@rockster/class-injector 0.0.1
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/decorators/index.d.ts +3 -0
- package/decorators/index.js +20 -0
- package/decorators/index.js.map +1 -0
- package/decorators/inject.decorator.d.ts +1 -0
- package/decorators/inject.decorator.js +44 -0
- package/decorators/inject.decorator.js.map +1 -0
- package/decorators/injectable.decorator.d.ts +1 -0
- package/decorators/injectable.decorator.js +25 -0
- package/decorators/injectable.decorator.js.map +1 -0
- package/decorators/on-create.decorator.d.ts +1 -0
- package/decorators/on-create.decorator.js +13 -0
- package/decorators/on-create.decorator.js.map +1 -0
- package/functions/create-executors.d.ts +6 -0
- package/functions/create-executors.js +71 -0
- package/functions/create-executors.js.map +1 -0
- package/functions/create-instance.d.ts +3 -0
- package/functions/create-instance.js +16 -0
- package/functions/create-instance.js.map +1 -0
- package/functions/index.d.ts +9 -0
- package/functions/index.js +26 -0
- package/functions/index.js.map +1 -0
- package/functions/init-objects.d.ts +3 -0
- package/functions/init-objects.js +14 -0
- package/functions/init-objects.js.map +1 -0
- package/functions/mark-executable.d.ts +1 -0
- package/functions/mark-executable.js +12 -0
- package/functions/mark-executable.js.map +1 -0
- package/functions/mark-injectable.d.ts +1 -0
- package/functions/mark-injectable.js +7 -0
- package/functions/mark-injectable.js.map +1 -0
- package/functions/post-inject-handle.d.ts +4 -0
- package/functions/post-inject-handle.js +3 -0
- package/functions/post-inject-handle.js.map +1 -0
- package/functions/resolve-on-create.d.ts +2 -0
- package/functions/resolve-on-create.js +23 -0
- package/functions/resolve-on-create.js.map +1 -0
- package/functions/resolve-params.d.ts +2 -0
- package/functions/resolve-params.js +38 -0
- package/functions/resolve-params.js.map +1 -0
- package/functions/resolve-post-injects.d.ts +2 -0
- package/functions/resolve-post-injects.js +39 -0
- package/functions/resolve-post-injects.js.map +1 -0
- package/global.d.ts +9 -0
- package/global.js +17 -0
- package/global.js.map +1 -0
- package/index.d.ts +7 -0
- package/index.js +24 -0
- package/index.js.map +1 -0
- package/interfaces/executor-data.d.ts +8 -0
- package/interfaces/executor-data.js +3 -0
- package/interfaces/executor-data.js.map +1 -0
- package/interfaces/executor-handle.d.ts +4 -0
- package/interfaces/executor-handle.js +3 -0
- package/interfaces/executor-handle.js.map +1 -0
- package/interfaces/get-param-handle.d.ts +4 -0
- package/interfaces/get-param-handle.js +3 -0
- package/interfaces/get-param-handle.js.map +1 -0
- package/interfaces/index.d.ts +11 -0
- package/interfaces/index.js +28 -0
- package/interfaces/index.js.map +1 -0
- package/interfaces/initial-data.d.ts +2 -0
- package/interfaces/initial-data.js +3 -0
- package/interfaces/initial-data.js.map +1 -0
- package/interfaces/object.d.ts +8 -0
- package/interfaces/object.js +3 -0
- package/interfaces/object.js.map +1 -0
- package/interfaces/on-create-handle.d.ts +4 -0
- package/interfaces/on-create-handle.js +3 -0
- package/interfaces/on-create-handle.js.map +1 -0
- package/interfaces/override.d.ts +4 -0
- package/interfaces/override.js +3 -0
- package/interfaces/override.js.map +1 -0
- package/interfaces/pipe-docs.d.ts +5 -0
- package/interfaces/pipe-docs.js +3 -0
- package/interfaces/pipe-docs.js.map +1 -0
- package/interfaces/pipe-executor.d.ts +4 -0
- package/interfaces/pipe-executor.js +3 -0
- package/interfaces/pipe-executor.js.map +1 -0
- package/interfaces/pipe.d.ts +9 -0
- package/interfaces/pipe.js +3 -0
- package/interfaces/pipe.js.map +1 -0
- package/interfaces/property.d.ts +11 -0
- package/interfaces/property.js +3 -0
- package/interfaces/property.js.map +1 -0
- package/package.json +34 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./inject.decorator"), exports);
|
|
18
|
+
__exportStar(require("./injectable.decorator"), exports);
|
|
19
|
+
__exportStar(require("./on-create.decorator"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../decorators/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,yDAAuC;AACvC,wDAAsC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const Inject: (name?: string) => (target: any, propertyKey: string, index?: number) => void;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Inject = void 0;
|
|
4
|
+
const Inject = (name) => {
|
|
5
|
+
return (target, propertyKey, index) => {
|
|
6
|
+
if (index >= 0 && !propertyKey) {
|
|
7
|
+
if (!name) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
const object = classInjector
|
|
11
|
+
.storage
|
|
12
|
+
.createObject(target);
|
|
13
|
+
object
|
|
14
|
+
.overrides
|
|
15
|
+
.push({
|
|
16
|
+
index,
|
|
17
|
+
name
|
|
18
|
+
});
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
if (index >= 0) {
|
|
22
|
+
if (!name) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const property = classInjector
|
|
26
|
+
.storage
|
|
27
|
+
.createProperty(target, propertyKey);
|
|
28
|
+
property
|
|
29
|
+
.overrides
|
|
30
|
+
.push({
|
|
31
|
+
index,
|
|
32
|
+
name
|
|
33
|
+
});
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const property = classInjector
|
|
37
|
+
.storage
|
|
38
|
+
.createProperty(target, propertyKey);
|
|
39
|
+
property.postInject = true;
|
|
40
|
+
property.postName = name;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
exports.Inject = Inject;
|
|
44
|
+
//# sourceMappingURL=inject.decorator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inject.decorator.js","sourceRoot":"","sources":["../../decorators/inject.decorator.ts"],"names":[],"mappings":";;;AAAO,MAAM,MAAM,GAAG,CAAC,IAAa,EAAE,EAAE;IAErC,OAAO,CACJ,MAAM,EACN,WAAmB,EACnB,KAAc,EACf,EAAE;QAED,IAAI,KAAK,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YAC9B,IAAI,CAAC,IAAI,EAAE,CAAC;gBAAC,OAAO;YAAC,CAAC;YACtB,MAAM,MAAM,GAAG,aAAa;iBACxB,OAAO;iBACP,YAAY,CAAC,MAAM,CAAC,CAAC;YACzB,MAAM;iBACF,SAAS;iBACT,IAAI,CAAC;gBACH,KAAK;gBACL,IAAI;aACN,CAAC,CAAC;YACN,OAAO;QACV,CAAC;QAED,IAAI,KAAK,IAAG,CAAC,EAAE,CAAC;YACb,IAAI,CAAC,IAAI,EAAE,CAAC;gBAAC,OAAO;YAAC,CAAC;YACtB,MAAM,QAAQ,GAAG,aAAa;iBAC1B,OAAO;iBACP,cAAc,CACZ,MAAM,EACN,WAAW,CACb,CAAC;YACL,QAAQ;iBACJ,SAAS;iBACT,IAAI,CAAC;gBACH,KAAK;gBACL,IAAI;aACN,CAAC,CAAC;YACN,OAAO;QACV,CAAC;QAED,MAAM,QAAQ,GAAG,aAAa;aAC1B,OAAO;aACP,cAAc,CACZ,MAAM,EACN,WAAW,CACb,CAAC;QACL,QAAQ,CAAC,UAAU,GAAG,IAAI,CAAC;QAC3B,QAAQ,CAAC,QAAQ,GAAG,IAAI,CAAC;IAC5B,CAAC,CAAA;AACJ,CAAC,CAAA;AAhDY,QAAA,MAAM,UAgDlB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const Injectable: () => (target: any) => void;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Injectable = void 0;
|
|
4
|
+
const functions_1 = require("../functions");
|
|
5
|
+
const Injectable = () => {
|
|
6
|
+
return (target) => {
|
|
7
|
+
const object = classInjector
|
|
8
|
+
.storage
|
|
9
|
+
.createObject(target);
|
|
10
|
+
const onCreateHandles = (0, functions_1.resolveOnCreate)(target);
|
|
11
|
+
const postInjectHandles = (0, functions_1.resolvePostInjects)(target);
|
|
12
|
+
const getParamHandles = (0, functions_1.resolveParams)(object.objectKey, object.overrides, object.metadata["design:paramtypes"]);
|
|
13
|
+
object.create = async (initialData) => {
|
|
14
|
+
const args = await Promise.all(getParamHandles.map((getParam) => (getParam(initialData))));
|
|
15
|
+
const instance = new target(...args);
|
|
16
|
+
await Promise.all(postInjectHandles.map((postInject) => {
|
|
17
|
+
postInject(instance, initialData);
|
|
18
|
+
}));
|
|
19
|
+
await Promise.all(onCreateHandles.map((onCreate) => (onCreate(instance, initialData))));
|
|
20
|
+
return instance;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
exports.Injectable = Injectable;
|
|
25
|
+
//# sourceMappingURL=injectable.decorator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"injectable.decorator.js","sourceRoot":"","sources":["../../decorators/injectable.decorator.ts"],"names":[],"mappings":";;;AAAA,4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,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OnCreate = void 0;
|
|
4
|
+
const OnCreate = () => {
|
|
5
|
+
return (target, propertyKey) => {
|
|
6
|
+
const property = classInjector
|
|
7
|
+
.storage
|
|
8
|
+
.createProperty(target, propertyKey);
|
|
9
|
+
property.executeOnCreate = true;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
exports.OnCreate = OnCreate;
|
|
13
|
+
//# sourceMappingURL=on-create.decorator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"on-create.decorator.js","sourceRoot":"","sources":["../../decorators/on-create.decorator.ts"],"names":[],"mappings":";;;AAAO,MAAM,QAAQ,GAAG,GAAG,EAAE;IAC1B,OAAO,CAAC,MAAM,EAAE,WAAmB,EAAE,EAAE;QACpC,MAAM,QAAQ,GAAG,aAAa;aAC1B,OAAO;aACP,cAAc,CACZ,MAAM,EACN,WAAW,CACb,CAAC;QACL,QAAQ,CAAC,eAAe,GAAG,IAAI,CAAC;IACnC,CAAC,CAAA;AACJ,CAAC,CAAA;AAVY,QAAA,QAAQ,YAUpB"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Dictionary } from "@rockster/common";
|
|
2
|
+
import { ExecutorData, InitialData } from "../interfaces";
|
|
3
|
+
export declare const createExecutors: (target: any, targetInitialData?: InitialData) => Promise<{
|
|
4
|
+
instance: unknown;
|
|
5
|
+
executors: Dictionary<ExecutorData>;
|
|
6
|
+
}>;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createExecutors = void 0;
|
|
4
|
+
const create_instance_1 = require("./create-instance");
|
|
5
|
+
const resolve_params_1 = require("./resolve-params");
|
|
6
|
+
const loadPipes = async (pipes) => {
|
|
7
|
+
const executors = [];
|
|
8
|
+
const docs = [];
|
|
9
|
+
for (const pipe of pipes) {
|
|
10
|
+
const pipeInstance = await (0, create_instance_1.createInstance)(pipe.executor);
|
|
11
|
+
executors.push(pipeInstance);
|
|
12
|
+
if (pipe.expose) {
|
|
13
|
+
docs.push({
|
|
14
|
+
name: pipe.name,
|
|
15
|
+
description: pipe.description,
|
|
16
|
+
params: pipe.params
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
executors,
|
|
22
|
+
docs
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
const createExecutors = async (target, targetInitialData = {}) => {
|
|
26
|
+
const executors = {};
|
|
27
|
+
const targetInstance = await (0, create_instance_1.createInstance)(target, targetInitialData);
|
|
28
|
+
const properties = classInjector
|
|
29
|
+
.storage
|
|
30
|
+
.getProperties(target)
|
|
31
|
+
.filter((property) => {
|
|
32
|
+
return property.executable;
|
|
33
|
+
});
|
|
34
|
+
const object = classInjector
|
|
35
|
+
.storage
|
|
36
|
+
.findObject(target);
|
|
37
|
+
const globalPipes = await loadPipes(object.pipes || []);
|
|
38
|
+
for (const property of properties) {
|
|
39
|
+
const loadedPipes = await loadPipes(property.pipes || []);
|
|
40
|
+
const pipesExecutors = [
|
|
41
|
+
...globalPipes.executors,
|
|
42
|
+
...loadedPipes.executors
|
|
43
|
+
];
|
|
44
|
+
const pipesDocs = [
|
|
45
|
+
...globalPipes.docs,
|
|
46
|
+
...loadedPipes.docs
|
|
47
|
+
];
|
|
48
|
+
const propertyKey = property.propertyKey;
|
|
49
|
+
const alias = property.executableName || propertyKey;
|
|
50
|
+
const params = (0, resolve_params_1.resolveParams)(object.objectKey, property.overrides, property.metadata["design:paramtypes"], propertyKey);
|
|
51
|
+
executors[alias] = {
|
|
52
|
+
alias: alias,
|
|
53
|
+
name: propertyKey,
|
|
54
|
+
pipesDocs: pipesDocs,
|
|
55
|
+
handle: async (initialData) => {
|
|
56
|
+
var _a;
|
|
57
|
+
await Promise.all(pipesExecutors.map((pipeExecutor) => {
|
|
58
|
+
pipeExecutor.execute(initialData);
|
|
59
|
+
}));
|
|
60
|
+
const args = await Promise.all(params.map((param) => (param(initialData))));
|
|
61
|
+
return (_a = targetInstance[propertyKey]) === null || _a === void 0 ? void 0 : _a.apply(targetInstance, args);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
return {
|
|
66
|
+
instance: targetInstance,
|
|
67
|
+
executors: executors
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
exports.createExecutors = createExecutors;
|
|
71
|
+
//# sourceMappingURL=create-executors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-executors.js","sourceRoot":"","sources":["../../functions/create-executors.ts"],"names":[],"mappings":";;;AACA,uDAAkD;AAQlD,qDAAiD;AAEjD,MAAM,SAAS,GAAG,KAAK,EAAE,KAAa,EAAE,EAAE;IACvC,MAAM,SAAS,GAAG,EAA0B,CAAC;IAC7C,MAAM,IAAI,GAAG,EAAgB,CAAC;IAC9B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACxB,MAAM,YAAY,GAAG,MAClB,IAAA,gCAAc,EAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACjC,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAC7B,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YACf,IAAI,CAAC,IAAI,CAAC;gBACP,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,WAAW,EAAE,IAAI,CAAC,WAAW;gBAC7B,MAAM,EAAE,IAAI,CAAC,MAAM;aACrB,CAAC,CAAA;QACL,CAAC;IACJ,CAAC;IACD,OAAO;QACJ,SAAS;QACT,IAAI;KACN,CAAC;AACL,CAAC,CAAA;AAEM,MAAM,eAAe,GAAG,KAAK,EACjC,MAAM,EACN,oBAAiC,EAAE,EACpC,EAAE;IACD,MAAM,SAAS,GAAG,EAA8B,CAAC;IACjD,MAAM,cAA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AAE;oBACjC,YAAY,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;gBACrC,CAAC,CAAC,CACJ,CAAC;gBACF,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,GAAG,CAC3B,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CACnB,KAAK,CAAC,WAAW,CAAC,CACpB,CAAC,CACJ,CAAC;gBACF,OAAO,MAAA,cAAc,CACjB,WAAW,CAAC,0CACX,KAAK,CACJ,cAAc,EACd,IAAI,CACN,CAAC;YACR,CAAC;SACH,CAAC;IACL,CAAC;IACD,OAAO;QACJ,QAAQ,EAAE,cAAc;QACxB,SAAS,EAAE,SAAS;KACtB,CAAA;AACJ,CAAC,CAAA;AArEY,QAAA,eAAe,mBAqE3B"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createInstance = void 0;
|
|
4
|
+
const logger_1 = require("@rockster/logger");
|
|
5
|
+
const createInstance = async (target, initialData) => {
|
|
6
|
+
const object = classInjector
|
|
7
|
+
.storage
|
|
8
|
+
.findObject(target);
|
|
9
|
+
if (!(object === null || object === void 0 ? void 0 : object.create)) {
|
|
10
|
+
const logger = new logger_1.Logger(target.name);
|
|
11
|
+
logger.throw(new Error(`This object is not injectable. Please use @Injectable() to fix it!`));
|
|
12
|
+
}
|
|
13
|
+
return object.create(initialData);
|
|
14
|
+
};
|
|
15
|
+
exports.createInstance = createInstance;
|
|
16
|
+
//# sourceMappingURL=create-instance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-instance.js","sourceRoot":"","sources":["../../functions/create-instance.ts"],"names":[],"mappings":";;;AAEA,6CAA0C;AAEnC,MAAM,cAAc,GAAG,KAAK,EAChC,MAAuB,EACvB,WAAyB,EAC1B,EAAE;IACD,MAAM,MAAM,GAAG,aAAa;SACxB,OAAO;SACP,UAAU,CAAC,MAAM,CAAC,CAAC;IACvB,IAAI,CAAC,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,CAAA,EAAE,CAAC;QACnB,MAAM,MAAM,GAAG,IAAI,eAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACvC,MAAM,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,oEAAoE,CAAC,CAAC,CAAC;IACjG,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,WAAW,CAAM,CAAC;AAC1C,CAAC,CAAA;AAZY,QAAA,cAAc,kBAY1B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './create-executors';
|
|
2
|
+
export * from './create-instance';
|
|
3
|
+
export * from './init-objects';
|
|
4
|
+
export * from './mark-executable';
|
|
5
|
+
export * from './mark-injectable';
|
|
6
|
+
export * from './post-inject-handle';
|
|
7
|
+
export * from './resolve-on-create';
|
|
8
|
+
export * from './resolve-params';
|
|
9
|
+
export * from './resolve-post-injects';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./create-executors"), exports);
|
|
18
|
+
__exportStar(require("./create-instance"), exports);
|
|
19
|
+
__exportStar(require("./init-objects"), exports);
|
|
20
|
+
__exportStar(require("./mark-executable"), exports);
|
|
21
|
+
__exportStar(require("./mark-injectable"), exports);
|
|
22
|
+
__exportStar(require("./post-inject-handle"), exports);
|
|
23
|
+
__exportStar(require("./resolve-on-create"), exports);
|
|
24
|
+
__exportStar(require("./resolve-params"), exports);
|
|
25
|
+
__exportStar(require("./resolve-post-injects"), exports);
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../functions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,oDAAkC;AAClC,iDAA+B;AAC/B,oDAAkC;AAClC,oDAAkC;AAClC,uDAAqC;AACrC,sDAAoC;AACpC,mDAAiC;AACjC,yDAAuC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.initObjects = void 0;
|
|
4
|
+
const create_instance_1 = require("./create-instance");
|
|
5
|
+
const initObjects = async (objects, params) => {
|
|
6
|
+
const instances = [];
|
|
7
|
+
for (const object of objects) {
|
|
8
|
+
const instance = await (0, create_instance_1.createInstance)(object, params);
|
|
9
|
+
instances.push(instance);
|
|
10
|
+
}
|
|
11
|
+
return instances;
|
|
12
|
+
};
|
|
13
|
+
exports.initObjects = initObjects;
|
|
14
|
+
//# sourceMappingURL=init-objects.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init-objects.js","sourceRoot":"","sources":["../../functions/init-objects.ts"],"names":[],"mappings":";;;AAEA,uDAAmD;AAE5C,MAAM,WAAW,GAAG,KAAK,EAC7B,OAAuB,EACvB,MAAoB,EACrB,EAAE;IACD,MAAM,SAAS,GAAG,EAAE,CAAC;IACrB,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC5B,MAAM,QAAQ,GAAG,MAAM,IAAA,gCAAc,EAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACtD,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC5B,CAAC;IACD,OAAO,SAAS,CAAC;AACpB,CAAC,CAAA;AAVY,QAAA,WAAW,eAUvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const markExecutable: (target: any, propertyKey: string, name?: string) => void;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.markExecutable = void 0;
|
|
4
|
+
const markExecutable = (target, propertyKey, name) => {
|
|
5
|
+
const property = classInjector
|
|
6
|
+
.storage
|
|
7
|
+
.createProperty(target, propertyKey);
|
|
8
|
+
property.executable = true;
|
|
9
|
+
property.executableName = name;
|
|
10
|
+
};
|
|
11
|
+
exports.markExecutable = markExecutable;
|
|
12
|
+
//# sourceMappingURL=mark-executable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mark-executable.js","sourceRoot":"","sources":["../../functions/mark-executable.ts"],"names":[],"mappings":";;;AAAO,MAAM,cAAc,GAAG,CAC3B,MAAM,EACN,WAAmB,EACnB,IAAa,EACd,EAAE;IACD,MAAM,QAAQ,GAAG,aAAa;SAC1B,OAAO;SACP,cAAc,CACZ,MAAM,EACN,WAAW,CACb,CAAC;IACL,QAAQ,CAAC,UAAU,GAAG,IAAI,CAAC;IAC3B,QAAQ,CAAC,cAAc,GAAG,IAAI,CAAC;AAClC,CAAC,CAAA;AAbY,QAAA,cAAc,kBAa1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const markInjectable: (target: any) => void;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.markInjectable = void 0;
|
|
4
|
+
const decorators_1 = require("../decorators");
|
|
5
|
+
const markInjectable = (target) => (0, decorators_1.Injectable)()(target);
|
|
6
|
+
exports.markInjectable = markInjectable;
|
|
7
|
+
//# sourceMappingURL=mark-injectable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mark-injectable.js","sourceRoot":"","sources":["../../functions/mark-injectable.ts"],"names":[],"mappings":";;;AAAA,8CAA2C;AAEpC,MAAM,cAAc,GAAI,CAAC,MAAM,EAAE,EAAE,CAAC,IAAA,uBAAU,GAAE,CAAC,MAAM,CAAC,CAAC;AAAnD,QAAA,cAAc,kBAAqC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"post-inject-handle.js","sourceRoot":"","sources":["../../functions/post-inject-handle.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveOnCreate = void 0;
|
|
4
|
+
const resolve_params_1 = require("./resolve-params");
|
|
5
|
+
const resolveOnCreate = (target) => {
|
|
6
|
+
const onCreateHandles = [];
|
|
7
|
+
const properties = classInjector
|
|
8
|
+
.storage
|
|
9
|
+
.getProperties(target)
|
|
10
|
+
.filter((property) => {
|
|
11
|
+
return property.executeOnCreate;
|
|
12
|
+
});
|
|
13
|
+
for (const property of properties) {
|
|
14
|
+
const getArgsHandles = (0, resolve_params_1.resolveParams)(property.objectKey, property.overrides, property.metadata["design:paramtypes"], property.propertyKey);
|
|
15
|
+
onCreateHandles.push(async (instance, initialData) => {
|
|
16
|
+
const args = await Promise.all(getArgsHandles.map((getArgsHandle) => (getArgsHandle(initialData))));
|
|
17
|
+
return instance[property.propertyKey](...args);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return onCreateHandles;
|
|
21
|
+
};
|
|
22
|
+
exports.resolveOnCreate = resolveOnCreate;
|
|
23
|
+
//# sourceMappingURL=resolve-on-create.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-on-create.js","sourceRoot":"","sources":["../../functions/resolve-on-create.ts"],"names":[],"mappings":";;;AACA,qDAAiD;AAE1C,MAAM,eAAe,GAAG,CAC5B,MAAM,EACP,EAAE;IACD,MAAM,eAAe,GAAG,EAAsB,CAAC;IAC/C,MAAM,UAAU,GAAG,aAAa;SAC5B,OAAO;SACP,aAAa,CAAC,MAAM,CAAC;SACrB,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE;QAClB,OAAO,QAAQ,CAAC,eAAe,CAAC;IACnC,CAAC,CAAC,CAAC;IACN,KAAK,MAAM,QAAQ,IAAI,UAAU,EAAE,CAAC;QACjC,MAAM,cAAc,GACjB,IAAA,8BAAa,EACV,QAAQ,CAAC,SAAS,EAClB,QAAQ,CAAC,SAAS,EAClB,QAAQ,CAAC,QAAQ,CAAC,mBAAmB,CAAC,EACtC,QAAQ,CAAC,WAAW,CACtB,CAAC;QACL,eAAe,CAAC,IAAI,CAAC,KAAK,EACvB,QAAQ,EACR,WAAW,EACZ,EAAE;YACD,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,GAAG,CAC3B,cAAc,CAAC,GAAG,CAAC,CAAC,aAAa,EAAE,EAAE,CAAC,CACnC,aAAa,CAAC,WAAW,CAAC,CAC5B,CAAC,CACJ,CAAC;YACF,OAAO,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;QAClD,CAAC,CAAC,CAAC;IACN,CAAC;IACD,OAAO,eAAe,CAAC;AAC1B,CAAC,CAAA;AA/BY,QAAA,eAAe,mBA+B3B"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveParams = void 0;
|
|
4
|
+
const logger_1 = require("@rockster/logger");
|
|
5
|
+
const resolveParams = (objectKey, overrides, paramTypes, propertyKey) => {
|
|
6
|
+
const params = [];
|
|
7
|
+
const propertyInfo = propertyKey
|
|
8
|
+
? `.${propertyKey}`
|
|
9
|
+
: '';
|
|
10
|
+
const logger = new logger_1.Logger(`${objectKey}${propertyInfo}`);
|
|
11
|
+
if (!paramTypes) {
|
|
12
|
+
return params;
|
|
13
|
+
}
|
|
14
|
+
for (let i = 0; i < paramTypes.length; i++) {
|
|
15
|
+
const paramType = paramTypes[i];
|
|
16
|
+
const hasOverride = overrides
|
|
17
|
+
.find((override) => {
|
|
18
|
+
return override.index === i;
|
|
19
|
+
});
|
|
20
|
+
if (hasOverride) {
|
|
21
|
+
params.push((data) => {
|
|
22
|
+
return data[hasOverride.name];
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
const objectNote = classInjector
|
|
27
|
+
.storage
|
|
28
|
+
.findObject(paramType);
|
|
29
|
+
if (!(objectNote === null || objectNote === void 0 ? void 0 : objectNote.create)) {
|
|
30
|
+
logger.throw(new Error(`Param with type{${paramType === null || paramType === void 0 ? void 0 : paramType.name}} index[${i}] is not injectable`));
|
|
31
|
+
}
|
|
32
|
+
params.push(objectNote.create);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return params;
|
|
36
|
+
};
|
|
37
|
+
exports.resolveParams = resolveParams;
|
|
38
|
+
//# sourceMappingURL=resolve-params.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-params.js","sourceRoot":"","sources":["../../functions/resolve-params.ts"],"names":[],"mappings":";;;AAAA,6CAA0C;AAMnC,MAAM,aAAa,GAAG,CAC1B,SAAiB,EACjB,SAAqB,EACrB,UAAiB,EACjB,WAAoB,EACrB,EAAE;IACD,MAAM,MAAM,GAAG,EAAsB,CAAC;IACtC,MAAM,YAAY,GAAG,WAAW;QAC7B,CAAC,CAAC,IAAI,WAAW,EAAE;QACnB,CAAC,CAAC,EA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olvePostInjects = void 0;
|
|
4
|
+
const logger_1 = require("@rockster/logger");
|
|
5
|
+
const resolvePostInjects = (target) => {
|
|
6
|
+
const postInjects = [];
|
|
7
|
+
const logger = new logger_1.Logger(target.name);
|
|
8
|
+
const properties = classInjector
|
|
9
|
+
.storage
|
|
10
|
+
.getProperties(target)
|
|
11
|
+
.filter((property) => {
|
|
12
|
+
return property.postInject;
|
|
13
|
+
});
|
|
14
|
+
for (const property of properties) {
|
|
15
|
+
const postName = property.postName;
|
|
16
|
+
const propertyKey = property.propertyKey;
|
|
17
|
+
if (property.postName) {
|
|
18
|
+
postInjects.push(async (instance, initalData) => {
|
|
19
|
+
instance[propertyKey] = initalData[postName];
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
const type = property
|
|
24
|
+
.metadata["design:type"];
|
|
25
|
+
const object = classInjector
|
|
26
|
+
.storage
|
|
27
|
+
.findObject(type);
|
|
28
|
+
if (!object) {
|
|
29
|
+
logger.throw(new Error(`Type {${type === null || type === void 0 ? void 0 : type.name}} on property {${propertyKey}} is not injectable`));
|
|
30
|
+
}
|
|
31
|
+
postInjects.push(async (instance, initalData) => {
|
|
32
|
+
instance[propertyKey] = await object.create(initalData);
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return postInjects;
|
|
37
|
+
};
|
|
38
|
+
exports.resolvePostInjects = resolvePostInjects;
|
|
39
|
+
//# sourceMappingURL=resolve-post-injects.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-post-injects.js","sourceRoot":"","sources":["../../functions/resolve-post-injects.ts"],"names":[],"mappings":";;;AAAA,6CAA0C;AAGnC,MAAM,kBAAkB,GAAG,CAC/B,MAAM,EACP,EAAE;IACD,MAAM,WAAW,GAAG,EAAwB,CAAC;IAC7C,MAAM,MAAM,GAAG,IAAI,eAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACvC,MAAM,UAAU,GA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strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
require("@rockster/common/node-utils");
|
|
4
|
+
const class_memory_1 = require("@rockster/class-memory");
|
|
5
|
+
global.classInjector = {
|
|
6
|
+
storage: (0, class_memory_1.createStorage)('classInjector', {
|
|
7
|
+
onCreateObject: (object) => {
|
|
8
|
+
object.overrides = [];
|
|
9
|
+
return object;
|
|
10
|
+
},
|
|
11
|
+
onCreateProperty: (property) => {
|
|
12
|
+
property.overrides = [];
|
|
13
|
+
return property;
|
|
14
|
+
}
|
|
15
|
+
})
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=global.js.map
|
package/global.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global.js","sourceRoot":"","sources":["../global.ts"],"names":[],"mappings":";;AAAA,uCAAqC;AACrC,yDAIgC;AAahC,MAAM,CAAC,aAAa,GAAG;IACpB,OAAO,EAAE,IAAA,4BAAa,EAAC,eAAe,EAAE;QACrC,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE;YACxB,MAAM,CAAC,SAAS,GAAG,EAAE,CAAC;YACtB,OAAO,MAAM,CAAC;QACjB,CAAC;QACD,gBAAgB,EAAE,CAAC,QAAQ,EAAE,EAAE;YAC5B,QAAQ,CAAC,SAAS,GAAG,EAAE,CAAC;YACxB,OAAO,QAAQ,CAAC;QACnB,CAAC;KACH,CAAC;CACJ,CAAC"}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import './global';
|
|
2
|
+
export * from './functions/init-objects';
|
|
3
|
+
export * from './functions/create-instance';
|
|
4
|
+
export * from './functions/mark-executable';
|
|
5
|
+
export * from './functions/mark-injectable';
|
|
6
|
+
export * from './functions/create-executors';
|
|
7
|
+
export * from './decorators';
|
package/index.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
require("./global");
|
|
18
|
+
__exportStar(require("./functions/init-objects"), exports);
|
|
19
|
+
__exportStar(require("./functions/create-instance"), exports);
|
|
20
|
+
__exportStar(require("./functions/mark-executable"), exports);
|
|
21
|
+
__exportStar(require("./functions/mark-injectable"), exports);
|
|
22
|
+
__exportStar(require("./functions/create-executors"), exports);
|
|
23
|
+
__exportStar(require("./decorators"), exports);
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
package/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oBAAkB;AAClB,2DAAyC;AACzC,8DAA4C;AAC5C,8DAA4C;AAC5C,8DAA4C;AAC5C,+DAA6C;AAC7C,+CAA6B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor-data.js","sourceRoot":"","sources":["../../interfaces/executor-data.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor-handle.js","sourceRoot":"","sources":["../../interfaces/executor-handle.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-param-handle.js","sourceRoot":"","sources":["../../interfaces/get-param-handle.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './executor-data';
|
|
2
|
+
export * from './executor-handle';
|
|
3
|
+
export * from './get-param-handle';
|
|
4
|
+
export * from './initial-data';
|
|
5
|
+
export * from './object';
|
|
6
|
+
export * from './on-create-handle';
|
|
7
|
+
export * from './override';
|
|
8
|
+
export * from './pipe-docs';
|
|
9
|
+
export * from './pipe-executor';
|
|
10
|
+
export * from './pipe';
|
|
11
|
+
export * from './property';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./executor-data"), exports);
|
|
18
|
+
__exportStar(require("./executor-handle"), exports);
|
|
19
|
+
__exportStar(require("./get-param-handle"), exports);
|
|
20
|
+
__exportStar(require("./initial-data"), exports);
|
|
21
|
+
__exportStar(require("./object"), exports);
|
|
22
|
+
__exportStar(require("./on-create-handle"), exports);
|
|
23
|
+
__exportStar(require("./override"), exports);
|
|
24
|
+
__exportStar(require("./pipe-docs"), exports);
|
|
25
|
+
__exportStar(require("./pipe-executor"), exports);
|
|
26
|
+
__exportStar(require("./pipe"), exports);
|
|
27
|
+
__exportStar(require("./property"), exports);
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../interfaces/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,oDAAkC;AAClC,qDAAmC;AACnC,iDAA+B;AAC/B,2CAAyB;AACzB,qDAAmC;AACnC,6CAA2B;AAC3B,8CAA4B;AAC5B,kDAAgC;AAChC,yCAAuB;AACvB,6CAA2B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initial-data.js","sourceRoot":"","sources":["../../interfaces/initial-data.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object.js","sourceRoot":"","sources":["../../interfaces/object.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"on-create-handle.js","sourceRoot":"","sources":["../../interfaces/on-create-handle.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"override.js","sourceRoot":"","sources":["../../interfaces/override.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipe-docs.js","sourceRoot":"","sources":["../../interfaces/pipe-docs.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipe-executor.js","sourceRoot":"","sources":["../../interfaces/pipe-executor.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipe.js","sourceRoot":"","sources":["../../interfaces/pipe.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Override } from "./override";
|
|
2
|
+
import { Pipe } from "./pipe";
|
|
3
|
+
export interface IProperty {
|
|
4
|
+
executeOnCreate?: boolean;
|
|
5
|
+
postInject?: boolean;
|
|
6
|
+
postName?: string;
|
|
7
|
+
overrides: Override[];
|
|
8
|
+
executable?: boolean;
|
|
9
|
+
executableName?: string;
|
|
10
|
+
pipes: Pipe[];
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"property.js","sourceRoot":"","sources":["../../interfaces/property.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@rockster/class-injector",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"main": "index",
|
|
5
|
+
"types": "index.d.ts",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"pre:build": "rm -rf ./dist && mkdir ./dist && cp package.json ./dist",
|
|
8
|
+
"build:prod": "npm run pre:build && tsc -p tsconfig.prod.json",
|
|
9
|
+
"build:dev": "npm run pre:build && tsc -p tsconfig.prod.json -w",
|
|
10
|
+
"post:publish": "cd ./dist && npm publish"
|
|
11
|
+
},
|
|
12
|
+
"author": "Headcore Co.",
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"publishConfig": {
|
|
15
|
+
"access": "public"
|
|
16
|
+
},
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "https://git.hubseat.io/rockster/rockster-class-injector"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@types/dot-object": "^2.1.2",
|
|
23
|
+
"@types/node": "^20.1.3",
|
|
24
|
+
"typescript": "^5.0.4"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@rockster/class-memory": "0.0.1",
|
|
28
|
+
"@rockster/common": "0.0.1",
|
|
29
|
+
"@rockster/logger": "0.0.1",
|
|
30
|
+
"dot-object": "^2.1.4",
|
|
31
|
+
"reflect-metadata": "^0.1.13",
|
|
32
|
+
"uuid": "^9.0.0"
|
|
33
|
+
}
|
|
34
|
+
}
|