@n8n/decorators 0.8.1 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/build.tsbuildinfo +1 -1
- package/dist/module/index.d.ts +1 -1
- package/dist/module/index.js +2 -2
- package/dist/module/index.js.map +1 -1
- package/dist/module/module-metadata.d.ts +8 -3
- package/dist/module/module-metadata.js +5 -5
- package/dist/module/module-metadata.js.map +1 -1
- package/dist/module/module.d.ts +18 -4
- package/dist/module/module.js +7 -4
- package/dist/module/module.js.map +1 -1
- package/package.json +4 -4
package/dist/module/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { ModuleInterface, BackendModule, EntityClass } from './module';
|
|
2
2
|
export { ModuleMetadata } from './module-metadata';
|
package/dist/module/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ModuleMetadata = exports.
|
|
3
|
+
exports.ModuleMetadata = exports.BackendModule = void 0;
|
|
4
4
|
var module_1 = require("./module");
|
|
5
|
-
Object.defineProperty(exports, "
|
|
5
|
+
Object.defineProperty(exports, "BackendModule", { enumerable: true, get: function () { return module_1.BackendModule; } });
|
|
6
6
|
var module_metadata_1 = require("./module-metadata");
|
|
7
7
|
Object.defineProperty(exports, "ModuleMetadata", { enumerable: true, get: function () { return module_metadata_1.ModuleMetadata; } });
|
|
8
8
|
//# sourceMappingURL=index.js.map
|
package/dist/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/module/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/module/index.ts"],"names":[],"mappings":";;;AAAA,mCAAuE;AAA7C,uGAAA,aAAa,OAAA;AACvC,qDAAmD;AAA1C,iHAAA,cAAc,OAAA"}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { LicenseFlag, ModuleClass } from './module';
|
|
2
|
+
type ModuleEntry = {
|
|
3
|
+
class: ModuleClass;
|
|
4
|
+
licenseFlag?: LicenseFlag;
|
|
5
|
+
};
|
|
2
6
|
export declare class ModuleMetadata {
|
|
3
7
|
private readonly modules;
|
|
4
|
-
register(
|
|
5
|
-
|
|
8
|
+
register(moduleName: string, moduleEntry: ModuleEntry): void;
|
|
9
|
+
getEntries(): ModuleEntry[];
|
|
6
10
|
}
|
|
11
|
+
export {};
|
|
@@ -10,13 +10,13 @@ exports.ModuleMetadata = void 0;
|
|
|
10
10
|
const di_1 = require("@n8n/di");
|
|
11
11
|
let ModuleMetadata = class ModuleMetadata {
|
|
12
12
|
constructor() {
|
|
13
|
-
this.modules = new
|
|
13
|
+
this.modules = new Map();
|
|
14
14
|
}
|
|
15
|
-
register(
|
|
16
|
-
this.modules.
|
|
15
|
+
register(moduleName, moduleEntry) {
|
|
16
|
+
this.modules.set(moduleName, moduleEntry);
|
|
17
17
|
}
|
|
18
|
-
|
|
19
|
-
return this.modules.
|
|
18
|
+
getEntries() {
|
|
19
|
+
return [...this.modules.values()];
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
22
|
exports.ModuleMetadata = ModuleMetadata;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-metadata.js","sourceRoot":"","sources":["../../src/module/module-metadata.ts"],"names":[],"mappings":";;;;;;;;;AAAA,gCAAkC;
|
|
1
|
+
{"version":3,"file":"module-metadata.js","sourceRoot":"","sources":["../../src/module/module-metadata.ts"],"names":[],"mappings":";;;;;;;;;AAAA,gCAAkC;AAU3B,IAAM,cAAc,GAApB,MAAM,cAAc;IAApB;QACW,YAAO,GAA6B,IAAI,GAAG,EAAE,CAAC;IAShE,CAAC;IAPA,QAAQ,CAAC,UAAkB,EAAE,WAAwB;QACpD,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;IAC3C,CAAC;IAED,UAAU;QACT,OAAO,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IACnC,CAAC;CACD,CAAA;AAVY,wCAAc;yBAAd,cAAc;IAD1B,IAAA,YAAO,GAAE;GACG,cAAc,CAU1B"}
|
package/dist/module/module.d.ts
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
|
+
import type { LICENSE_FEATURES } from '@n8n/constants';
|
|
1
2
|
import { type Constructable } from '@n8n/di';
|
|
2
|
-
export interface
|
|
3
|
-
|
|
3
|
+
export interface BaseEntity {
|
|
4
|
+
hasId(): boolean;
|
|
5
|
+
save(options?: unknown): Promise<this>;
|
|
6
|
+
remove(options?: unknown): Promise<this>;
|
|
7
|
+
softRemove(options?: unknown): Promise<this>;
|
|
8
|
+
recover(options?: unknown): Promise<this>;
|
|
9
|
+
reload(): Promise<void>;
|
|
4
10
|
}
|
|
5
|
-
export type
|
|
6
|
-
export
|
|
11
|
+
export type EntityClass = new () => BaseEntity;
|
|
12
|
+
export interface ModuleInterface {
|
|
13
|
+
init?(): void | Promise<void>;
|
|
14
|
+
entities?(): EntityClass[];
|
|
15
|
+
}
|
|
16
|
+
export type ModuleClass = Constructable<ModuleInterface>;
|
|
17
|
+
export type LicenseFlag = (typeof LICENSE_FEATURES)[keyof typeof LICENSE_FEATURES];
|
|
18
|
+
export declare const BackendModule: (opts?: {
|
|
19
|
+
licenseFlag: LicenseFlag;
|
|
20
|
+
}) => ClassDecorator;
|
package/dist/module/module.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.BackendModule = void 0;
|
|
4
4
|
const di_1 = require("@n8n/di");
|
|
5
5
|
const module_metadata_1 = require("./module-metadata");
|
|
6
|
-
const
|
|
7
|
-
di_1.Container.get(module_metadata_1.ModuleMetadata).register(target
|
|
6
|
+
const BackendModule = (opts) => (target) => {
|
|
7
|
+
di_1.Container.get(module_metadata_1.ModuleMetadata).register(target.name, {
|
|
8
|
+
class: target,
|
|
9
|
+
licenseFlag: opts?.licenseFlag,
|
|
10
|
+
});
|
|
8
11
|
return (0, di_1.Service)()(target);
|
|
9
12
|
};
|
|
10
|
-
exports.
|
|
13
|
+
exports.BackendModule = BackendModule;
|
|
11
14
|
//# sourceMappingURL=module.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/module/module.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/module/module.ts"],"names":[],"mappings":";;;AACA,gCAAiE;AAEjE,uDAAmD;AA0B5C,MAAM,aAAa,GACzB,CAAC,IAAmC,EAAkB,EAAE,CACxD,CAAC,MAAM,EAAE,EAAE;IACV,cAAS,CAAC,GAAG,CAAC,gCAAc,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE;QACnD,KAAK,EAAE,MAAgC;QACvC,WAAW,EAAE,IAAI,EAAE,WAAW;KAC9B,CAAC,CAAC;IAGH,OAAO,IAAA,YAAO,GAAE,CAAC,MAAM,CAAC,CAAC;AAC1B,CAAC,CAAC;AAVU,QAAA,aAAa,iBAUvB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@n8n/decorators",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "src/index.ts",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"lodash": "4.17.21",
|
|
19
|
-
"@n8n/constants": "^0.6.1",
|
|
20
19
|
"@n8n/di": "^0.6.0",
|
|
21
|
-
"n8n-workflow": "^1.
|
|
22
|
-
"@n8n/
|
|
20
|
+
"n8n-workflow": "^1.96.0",
|
|
21
|
+
"@n8n/constants": "^0.7.0",
|
|
22
|
+
"@n8n/permissions": "^0.28.0"
|
|
23
23
|
},
|
|
24
24
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
25
25
|
"homepage": "https://n8n.io",
|