@noego/ioc 0.0.7 → 0.0.8
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/framework/decorators/Component.cjs +41 -0
- package/dist/framework/decorators/Component.cjs.map +1 -0
- package/dist/framework/decorators/Component.d.cts +12 -0
- package/dist/framework/decorators/Component.d.ts +12 -0
- package/dist/framework/decorators/Component.js +17 -0
- package/dist/framework/decorators/Component.js.map +1 -0
- package/dist/framework/decorators/Inject.cjs +37 -0
- package/dist/framework/decorators/Inject.cjs.map +1 -0
- package/dist/{cjs/framework/decorators/Inject.d.ts → framework/decorators/Inject.d.cts} +3 -2
- package/dist/{esm/framework → framework}/decorators/Inject.d.ts +3 -2
- package/dist/framework/decorators/Inject.js +13 -0
- package/dist/framework/decorators/Inject.js.map +1 -0
- package/dist/framework/decorators/index.cjs +35 -0
- package/dist/framework/decorators/index.cjs.map +1 -0
- package/dist/framework/decorators/index.d.cts +4 -0
- package/dist/framework/decorators/index.d.ts +4 -0
- package/dist/framework/decorators/index.js +8 -0
- package/dist/framework/decorators/index.js.map +1 -0
- package/dist/framework/decorators/metadataKeys.cjs +35 -0
- package/dist/framework/decorators/metadataKeys.cjs.map +1 -0
- package/dist/framework/decorators/metadataKeys.d.cts +5 -0
- package/dist/framework/decorators/metadataKeys.d.ts +5 -0
- package/dist/framework/decorators/metadataKeys.js +9 -0
- package/dist/framework/decorators/metadataKeys.js.map +1 -0
- package/dist/framework/errors/ContainerErrors.cjs +61 -0
- package/dist/framework/errors/ContainerErrors.cjs.map +1 -0
- package/dist/{cjs/framework/errors/ContainerErrors.d.ts → framework/errors/ContainerErrors.d.cts} +7 -5
- package/dist/{esm/framework → framework}/errors/ContainerErrors.d.ts +7 -5
- package/dist/framework/errors/ContainerErrors.js +33 -0
- package/dist/framework/errors/ContainerErrors.js.map +1 -0
- package/dist/framework/implementation/Container.cjs +342 -0
- package/dist/framework/implementation/Container.cjs.map +1 -0
- package/dist/{cjs/framework/implementation/Container.d.ts → framework/implementation/Container.d.cts} +9 -6
- package/dist/{esm/framework → framework}/implementation/Container.d.ts +9 -6
- package/dist/framework/implementation/Container.js +320 -0
- package/dist/framework/implementation/Container.js.map +1 -0
- package/dist/framework/implementation/DecoratorSupport.cjs +92 -0
- package/dist/framework/implementation/DecoratorSupport.cjs.map +1 -0
- package/dist/framework/implementation/DecoratorSupport.d.cts +33 -0
- package/dist/framework/implementation/DecoratorSupport.d.ts +33 -0
- package/dist/framework/implementation/DecoratorSupport.js +63 -0
- package/dist/framework/implementation/DecoratorSupport.js.map +1 -0
- package/dist/framework/implementation/LoadAs.cjs +34 -0
- package/dist/framework/implementation/LoadAs.cjs.map +1 -0
- package/dist/{esm/framework/implementation/LoadAs.d.ts → framework/implementation/LoadAs.d.cts} +3 -1
- package/dist/{cjs/framework → framework}/implementation/LoadAs.d.ts +3 -1
- package/dist/framework/implementation/LoadAs.js +10 -0
- package/dist/framework/implementation/LoadAs.js.map +1 -0
- package/dist/framework/implementation/Parameter.cjs +82 -0
- package/dist/framework/implementation/Parameter.cjs.map +1 -0
- package/dist/{esm/framework/implementation/Parameter.d.ts → framework/implementation/Parameter.d.cts} +4 -2
- package/dist/{cjs/framework → framework}/implementation/Parameter.d.ts +4 -2
- package/dist/framework/implementation/Parameter.js +47 -0
- package/dist/framework/implementation/Parameter.js.map +1 -0
- package/dist/framework/interface/Container.cjs +17 -0
- package/dist/framework/interface/Container.cjs.map +1 -0
- package/dist/{esm/framework/interface/Container.d.ts → framework/interface/Container.d.cts} +10 -7
- package/dist/{cjs/framework → framework}/interface/Container.d.ts +10 -7
- package/dist/framework/interface/Container.js +1 -0
- package/dist/framework/interface/Container.js.map +1 -0
- package/dist/index.cjs +58 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +12 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/package.json +16 -14
- package/dist/cjs/framework/decorators/Component.d.ts +0 -10
- package/dist/cjs/framework/decorators/Component.js +0 -25
- package/dist/cjs/framework/decorators/Component.js.map +0 -1
- package/dist/cjs/framework/decorators/Inject.js +0 -22
- package/dist/cjs/framework/decorators/Inject.js.map +0 -1
- package/dist/cjs/framework/decorators/index.d.ts +0 -3
- package/dist/cjs/framework/decorators/index.js +0 -24
- package/dist/cjs/framework/decorators/index.js.map +0 -1
- package/dist/cjs/framework/decorators/metadataKeys.d.ts +0 -3
- package/dist/cjs/framework/decorators/metadataKeys.js +0 -8
- package/dist/cjs/framework/decorators/metadataKeys.js.map +0 -1
- package/dist/cjs/framework/errors/ContainerErrors.js +0 -52
- package/dist/cjs/framework/errors/ContainerErrors.js.map +0 -1
- package/dist/cjs/framework/implementation/Container.js +0 -448
- package/dist/cjs/framework/implementation/Container.js.map +0 -1
- package/dist/cjs/framework/implementation/Container.test.d.ts +0 -1
- package/dist/cjs/framework/implementation/Container.test.js +0 -184
- package/dist/cjs/framework/implementation/Container.test.js.map +0 -1
- package/dist/cjs/framework/implementation/ContainerAsync.test.d.ts +0 -1
- package/dist/cjs/framework/implementation/ContainerAsync.test.js +0 -178
- package/dist/cjs/framework/implementation/ContainerAsync.test.js.map +0 -1
- package/dist/cjs/framework/implementation/ContainerBasic.test.d.ts +0 -1
- package/dist/cjs/framework/implementation/ContainerBasic.test.js +0 -101
- package/dist/cjs/framework/implementation/ContainerBasic.test.js.map +0 -1
- package/dist/cjs/framework/implementation/ContainerDecorators.test.d.ts +0 -1
- package/dist/cjs/framework/implementation/ContainerDecorators.test.js +0 -517
- package/dist/cjs/framework/implementation/ContainerDecorators.test.js.map +0 -1
- package/dist/cjs/framework/implementation/ContainerExtension.test.d.ts +0 -1
- package/dist/cjs/framework/implementation/ContainerExtension.test.js +0 -169
- package/dist/cjs/framework/implementation/ContainerExtension.test.js.map +0 -1
- package/dist/cjs/framework/implementation/ContainerLifetimes.test.d.ts +0 -1
- package/dist/cjs/framework/implementation/ContainerLifetimes.test.js +0 -154
- package/dist/cjs/framework/implementation/ContainerLifetimes.test.js.map +0 -1
- package/dist/cjs/framework/implementation/DecoratorSupport.d.ts +0 -31
- package/dist/cjs/framework/implementation/DecoratorSupport.js +0 -96
- package/dist/cjs/framework/implementation/DecoratorSupport.js.map +0 -1
- package/dist/cjs/framework/implementation/LoadAs.js +0 -10
- package/dist/cjs/framework/implementation/LoadAs.js.map +0 -1
- package/dist/cjs/framework/implementation/Parameter.js +0 -87
- package/dist/cjs/framework/implementation/Parameter.js.map +0 -1
- package/dist/cjs/framework/implementation/Parameter.test.d.ts +0 -1
- package/dist/cjs/framework/implementation/Parameter.test.js +0 -19
- package/dist/cjs/framework/implementation/Parameter.test.js.map +0 -1
- package/dist/cjs/framework/implementation/SimpleDecoratorTest.test.d.ts +0 -1
- package/dist/cjs/framework/implementation/SimpleDecoratorTest.test.js +0 -78
- package/dist/cjs/framework/implementation/SimpleDecoratorTest.test.js.map +0 -1
- package/dist/cjs/framework/implementation/SingletonTest.test.d.ts +0 -1
- package/dist/cjs/framework/implementation/SingletonTest.test.js +0 -85
- package/dist/cjs/framework/implementation/SingletonTest.test.js.map +0 -1
- package/dist/cjs/framework/interface/Container.js +0 -3
- package/dist/cjs/framework/interface/Container.js.map +0 -1
- package/dist/cjs/index.d.ts +0 -18
- package/dist/cjs/index.js +0 -24
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/jest.config.d.ts +0 -3
- package/dist/cjs/jest.config.js +0 -9
- package/dist/cjs/jest.config.js.map +0 -1
- package/dist/esm/framework/decorators/Component.d.ts +0 -10
- package/dist/esm/framework/decorators/Component.js +0 -21
- package/dist/esm/framework/decorators/Component.js.map +0 -1
- package/dist/esm/framework/decorators/Inject.js +0 -19
- package/dist/esm/framework/decorators/Inject.js.map +0 -1
- package/dist/esm/framework/decorators/index.d.ts +0 -3
- package/dist/esm/framework/decorators/index.js +0 -5
- package/dist/esm/framework/decorators/index.js.map +0 -1
- package/dist/esm/framework/decorators/metadataKeys.d.ts +0 -3
- package/dist/esm/framework/decorators/metadataKeys.js +0 -5
- package/dist/esm/framework/decorators/metadataKeys.js.map +0 -1
- package/dist/esm/framework/errors/ContainerErrors.js +0 -44
- package/dist/esm/framework/errors/ContainerErrors.js.map +0 -1
- package/dist/esm/framework/implementation/Container.js +0 -432
- package/dist/esm/framework/implementation/Container.js.map +0 -1
- package/dist/esm/framework/implementation/Container.test.d.ts +0 -1
- package/dist/esm/framework/implementation/Container.test.js +0 -173
- package/dist/esm/framework/implementation/Container.test.js.map +0 -1
- package/dist/esm/framework/implementation/ContainerAsync.test.d.ts +0 -1
- package/dist/esm/framework/implementation/ContainerAsync.test.js +0 -151
- package/dist/esm/framework/implementation/ContainerAsync.test.js.map +0 -1
- package/dist/esm/framework/implementation/ContainerBasic.test.d.ts +0 -1
- package/dist/esm/framework/implementation/ContainerBasic.test.js +0 -90
- package/dist/esm/framework/implementation/ContainerBasic.test.js.map +0 -1
- package/dist/esm/framework/implementation/ContainerDecorators.test.d.ts +0 -1
- package/dist/esm/framework/implementation/ContainerDecorators.test.js +0 -498
- package/dist/esm/framework/implementation/ContainerDecorators.test.js.map +0 -1
- package/dist/esm/framework/implementation/ContainerExtension.test.d.ts +0 -1
- package/dist/esm/framework/implementation/ContainerExtension.test.js +0 -158
- package/dist/esm/framework/implementation/ContainerExtension.test.js.map +0 -1
- package/dist/esm/framework/implementation/ContainerLifetimes.test.d.ts +0 -1
- package/dist/esm/framework/implementation/ContainerLifetimes.test.js +0 -143
- package/dist/esm/framework/implementation/ContainerLifetimes.test.js.map +0 -1
- package/dist/esm/framework/implementation/DecoratorSupport.d.ts +0 -31
- package/dist/esm/framework/implementation/DecoratorSupport.js +0 -87
- package/dist/esm/framework/implementation/DecoratorSupport.js.map +0 -1
- package/dist/esm/framework/implementation/LoadAs.js +0 -7
- package/dist/esm/framework/implementation/LoadAs.js.map +0 -1
- package/dist/esm/framework/implementation/Parameter.js +0 -49
- package/dist/esm/framework/implementation/Parameter.js.map +0 -1
- package/dist/esm/framework/implementation/Parameter.test.d.ts +0 -1
- package/dist/esm/framework/implementation/Parameter.test.js +0 -17
- package/dist/esm/framework/implementation/Parameter.test.js.map +0 -1
- package/dist/esm/framework/implementation/SimpleDecoratorTest.test.d.ts +0 -1
- package/dist/esm/framework/implementation/SimpleDecoratorTest.test.js +0 -67
- package/dist/esm/framework/implementation/SimpleDecoratorTest.test.js.map +0 -1
- package/dist/esm/framework/implementation/SingletonTest.test.d.ts +0 -1
- package/dist/esm/framework/implementation/SingletonTest.test.js +0 -74
- package/dist/esm/framework/implementation/SingletonTest.test.js.map +0 -1
- package/dist/esm/framework/interface/Container.js +0 -2
- package/dist/esm/framework/interface/Container.js.map +0 -1
- package/dist/esm/index.d.ts +0 -18
- package/dist/esm/index.js +0 -15
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/jest.config.d.ts +0 -3
- package/dist/esm/jest.config.js +0 -7
- package/dist/esm/jest.config.js.map +0 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var LoadAs_exports = {};
|
|
20
|
+
__export(LoadAs_exports, {
|
|
21
|
+
LoadAs: () => LoadAs
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(LoadAs_exports);
|
|
24
|
+
var LoadAs = /* @__PURE__ */ ((LoadAs2) => {
|
|
25
|
+
LoadAs2[LoadAs2["Singleton"] = 0] = "Singleton";
|
|
26
|
+
LoadAs2[LoadAs2["Scoped"] = 1] = "Scoped";
|
|
27
|
+
LoadAs2[LoadAs2["Transient"] = 2] = "Transient";
|
|
28
|
+
return LoadAs2;
|
|
29
|
+
})(LoadAs || {});
|
|
30
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
31
|
+
0 && (module.exports = {
|
|
32
|
+
LoadAs
|
|
33
|
+
});
|
|
34
|
+
//# sourceMappingURL=LoadAs.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../framework/implementation/LoadAs.ts"],"sourcesContent":["\r\n\r\n\r\n\r\n\r\nexport enum LoadAs {\r\n Singleton,\r\n Scoped,\r\n Transient\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKO,IAAK,SAAL,kBAAKA,YAAL;AACH,EAAAA,gBAAA;AACA,EAAAA,gBAAA;AACA,EAAAA,gBAAA;AAHQ,SAAAA;AAAA,GAAA;","names":["LoadAs"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
var LoadAs = /* @__PURE__ */ ((LoadAs2) => {
|
|
2
|
+
LoadAs2[LoadAs2["Singleton"] = 0] = "Singleton";
|
|
3
|
+
LoadAs2[LoadAs2["Scoped"] = 1] = "Scoped";
|
|
4
|
+
LoadAs2[LoadAs2["Transient"] = 2] = "Transient";
|
|
5
|
+
return LoadAs2;
|
|
6
|
+
})(LoadAs || {});
|
|
7
|
+
export {
|
|
8
|
+
LoadAs
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=LoadAs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../framework/implementation/LoadAs.ts"],"sourcesContent":["\r\n\r\n\r\n\r\n\r\nexport enum LoadAs {\r\n Singleton,\r\n Scoped,\r\n Transient\r\n}\r\n"],"mappings":"AAKO,IAAK,SAAL,kBAAKA,YAAL;AACH,EAAAA,gBAAA;AACA,EAAAA,gBAAA;AACA,EAAAA,gBAAA;AAHQ,SAAAA;AAAA,GAAA;","names":["LoadAs"]}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var Parameter_exports = {};
|
|
30
|
+
__export(Parameter_exports, {
|
|
31
|
+
Parameter: () => Parameter,
|
|
32
|
+
ParameterValue: () => ParameterValue
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(Parameter_exports);
|
|
35
|
+
var randomstring = __toESM(require("randomstring"), 1);
|
|
36
|
+
class Parameter {
|
|
37
|
+
constructor(id) {
|
|
38
|
+
this.id = id;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Create a new Parameter instance
|
|
42
|
+
* @param name Optional name for the parameter for better error messages
|
|
43
|
+
*/
|
|
44
|
+
static create(name) {
|
|
45
|
+
const id = randomstring.generate(32);
|
|
46
|
+
const param = new Parameter(id);
|
|
47
|
+
if (name) {
|
|
48
|
+
param.name = name;
|
|
49
|
+
}
|
|
50
|
+
return param;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Create a ParameterValue with the specified value
|
|
54
|
+
*/
|
|
55
|
+
value(value) {
|
|
56
|
+
return new ParameterValue(this, value);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* String representation for debugging and error messages
|
|
60
|
+
*/
|
|
61
|
+
toString() {
|
|
62
|
+
return this.name || `Parameter_${this.id.substring(0, 8)}`;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
class ParameterValue {
|
|
66
|
+
constructor(param, value) {
|
|
67
|
+
this.param = param;
|
|
68
|
+
this.value = value;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Check if this value belongs to the given parameter
|
|
72
|
+
*/
|
|
73
|
+
belongsTo(param) {
|
|
74
|
+
return this.param === param;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
78
|
+
0 && (module.exports = {
|
|
79
|
+
Parameter,
|
|
80
|
+
ParameterValue
|
|
81
|
+
});
|
|
82
|
+
//# sourceMappingURL=Parameter.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../framework/implementation/Parameter.ts"],"sourcesContent":["import * as randomstring from 'randomstring';\r\n\r\n/**\r\n * Parameter class for dependency injection\r\n */\r\nexport class Parameter{\r\n private name?: string;\r\n\r\n private constructor(private id: string){\r\n }\r\n\r\n /**\r\n * Create a new Parameter instance\r\n * @param name Optional name for the parameter for better error messages\r\n */\r\n static create(name?: string){\r\n const id = randomstring.generate(32);\r\n const param = new Parameter(id);\r\n if (name) {\r\n param.name = name;\r\n }\r\n return param;\r\n }\r\n\r\n /**\r\n * Create a ParameterValue with the specified value\r\n */\r\n value<T>(value: T): ParameterValue<T>{\r\n return new ParameterValue<T>(this, value);\r\n }\r\n\r\n /**\r\n * String representation for debugging and error messages\r\n */\r\n toString(): string {\r\n return this.name || `Parameter_${this.id.substring(0, 8)}`;\r\n }\r\n}\r\n\r\n/**\r\n * Holds a value for a specific Parameter\r\n */\r\nexport class ParameterValue<T>{\r\n constructor(private param: Parameter, public value: T){\r\n }\r\n\r\n /**\r\n * Check if this value belongs to the given parameter\r\n */\r\n belongsTo(param: Parameter): boolean {\r\n return this.param === param;\r\n }\r\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA8B;AAKvB,MAAM,UAAS;AAAA,EAGV,YAAoB,IAAW;AAAX;AAAA,EAC5B;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,OAAO,OAAO,MAAc;AACxB,UAAM,KAAK,aAAa,SAAS,EAAE;AACnC,UAAM,QAAQ,IAAI,UAAU,EAAE;AAC9B,QAAI,MAAM;AACN,YAAM,OAAO;AAAA,IACjB;AACA,WAAO;AAAA,EACX;AAAA;AAAA;AAAA;AAAA,EAKA,MAAS,OAA4B;AACjC,WAAO,IAAI,eAAkB,MAAM,KAAK;AAAA,EAC5C;AAAA;AAAA;AAAA;AAAA,EAKA,WAAmB;AACf,WAAO,KAAK,QAAQ,aAAa,KAAK,GAAG,UAAU,GAAG,CAAC,CAAC;AAAA,EAC5D;AACJ;AAKO,MAAM,eAAiB;AAAA,EAC1B,YAAoB,OAAyB,OAAS;AAAlC;AAAyB;AAAA,EAC7C;AAAA;AAAA;AAAA;AAAA,EAKA,UAAU,OAA2B;AACjC,WAAO,KAAK,UAAU;AAAA,EAC1B;AACJ;","names":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Parameter class for dependency injection
|
|
3
3
|
*/
|
|
4
|
-
|
|
4
|
+
declare class Parameter {
|
|
5
5
|
private id;
|
|
6
6
|
private name?;
|
|
7
7
|
private constructor();
|
|
@@ -22,7 +22,7 @@ export declare class Parameter {
|
|
|
22
22
|
/**
|
|
23
23
|
* Holds a value for a specific Parameter
|
|
24
24
|
*/
|
|
25
|
-
|
|
25
|
+
declare class ParameterValue<T> {
|
|
26
26
|
private param;
|
|
27
27
|
value: T;
|
|
28
28
|
constructor(param: Parameter, value: T);
|
|
@@ -31,3 +31,5 @@ export declare class ParameterValue<T> {
|
|
|
31
31
|
*/
|
|
32
32
|
belongsTo(param: Parameter): boolean;
|
|
33
33
|
}
|
|
34
|
+
|
|
35
|
+
export { Parameter, ParameterValue };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Parameter class for dependency injection
|
|
3
3
|
*/
|
|
4
|
-
|
|
4
|
+
declare class Parameter {
|
|
5
5
|
private id;
|
|
6
6
|
private name?;
|
|
7
7
|
private constructor();
|
|
@@ -22,7 +22,7 @@ export declare class Parameter {
|
|
|
22
22
|
/**
|
|
23
23
|
* Holds a value for a specific Parameter
|
|
24
24
|
*/
|
|
25
|
-
|
|
25
|
+
declare class ParameterValue<T> {
|
|
26
26
|
private param;
|
|
27
27
|
value: T;
|
|
28
28
|
constructor(param: Parameter, value: T);
|
|
@@ -31,3 +31,5 @@ export declare class ParameterValue<T> {
|
|
|
31
31
|
*/
|
|
32
32
|
belongsTo(param: Parameter): boolean;
|
|
33
33
|
}
|
|
34
|
+
|
|
35
|
+
export { Parameter, ParameterValue };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as randomstring from "randomstring";
|
|
2
|
+
class Parameter {
|
|
3
|
+
constructor(id) {
|
|
4
|
+
this.id = id;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Create a new Parameter instance
|
|
8
|
+
* @param name Optional name for the parameter for better error messages
|
|
9
|
+
*/
|
|
10
|
+
static create(name) {
|
|
11
|
+
const id = randomstring.generate(32);
|
|
12
|
+
const param = new Parameter(id);
|
|
13
|
+
if (name) {
|
|
14
|
+
param.name = name;
|
|
15
|
+
}
|
|
16
|
+
return param;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Create a ParameterValue with the specified value
|
|
20
|
+
*/
|
|
21
|
+
value(value) {
|
|
22
|
+
return new ParameterValue(this, value);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* String representation for debugging and error messages
|
|
26
|
+
*/
|
|
27
|
+
toString() {
|
|
28
|
+
return this.name || `Parameter_${this.id.substring(0, 8)}`;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
class ParameterValue {
|
|
32
|
+
constructor(param, value) {
|
|
33
|
+
this.param = param;
|
|
34
|
+
this.value = value;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Check if this value belongs to the given parameter
|
|
38
|
+
*/
|
|
39
|
+
belongsTo(param) {
|
|
40
|
+
return this.param === param;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
export {
|
|
44
|
+
Parameter,
|
|
45
|
+
ParameterValue
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=Parameter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../framework/implementation/Parameter.ts"],"sourcesContent":["import * as randomstring from 'randomstring';\r\n\r\n/**\r\n * Parameter class for dependency injection\r\n */\r\nexport class Parameter{\r\n private name?: string;\r\n\r\n private constructor(private id: string){\r\n }\r\n\r\n /**\r\n * Create a new Parameter instance\r\n * @param name Optional name for the parameter for better error messages\r\n */\r\n static create(name?: string){\r\n const id = randomstring.generate(32);\r\n const param = new Parameter(id);\r\n if (name) {\r\n param.name = name;\r\n }\r\n return param;\r\n }\r\n\r\n /**\r\n * Create a ParameterValue with the specified value\r\n */\r\n value<T>(value: T): ParameterValue<T>{\r\n return new ParameterValue<T>(this, value);\r\n }\r\n\r\n /**\r\n * String representation for debugging and error messages\r\n */\r\n toString(): string {\r\n return this.name || `Parameter_${this.id.substring(0, 8)}`;\r\n }\r\n}\r\n\r\n/**\r\n * Holds a value for a specific Parameter\r\n */\r\nexport class ParameterValue<T>{\r\n constructor(private param: Parameter, public value: T){\r\n }\r\n\r\n /**\r\n * Check if this value belongs to the given parameter\r\n */\r\n belongsTo(param: Parameter): boolean {\r\n return this.param === param;\r\n }\r\n}"],"mappings":"AAAA,YAAY,kBAAkB;AAKvB,MAAM,UAAS;AAAA,EAGV,YAAoB,IAAW;AAAX;AAAA,EAC5B;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,OAAO,OAAO,MAAc;AACxB,UAAM,KAAK,aAAa,SAAS,EAAE;AACnC,UAAM,QAAQ,IAAI,UAAU,EAAE;AAC9B,QAAI,MAAM;AACN,YAAM,OAAO;AAAA,IACjB;AACA,WAAO;AAAA,EACX;AAAA;AAAA;AAAA;AAAA,EAKA,MAAS,OAA4B;AACjC,WAAO,IAAI,eAAkB,MAAM,KAAK;AAAA,EAC5C;AAAA;AAAA;AAAA;AAAA,EAKA,WAAmB;AACf,WAAO,KAAK,QAAQ,aAAa,KAAK,GAAG,UAAU,GAAG,CAAC,CAAC;AAAA,EAC5D;AACJ;AAKO,MAAM,eAAiB;AAAA,EAC1B,YAAoB,OAAyB,OAAS;AAAlC;AAAyB;AAAA,EAC7C;AAAA;AAAA;AAAA;AAAA,EAKA,UAAU,OAA2B;AACjC,WAAO,KAAK,UAAU;AAAA,EAC1B;AACJ;","names":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var Container_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(Container_exports);
|
|
17
|
+
//# sourceMappingURL=Container.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../framework/interface/Container.ts"],"sourcesContent":["import type { ParameterValue } from \"../implementation/Parameter\"\nimport type { LoadAs } from \"../implementation/LoadAs\"\n\r\nexport interface IContainerClient {\r\n instance<T, Args extends any[]>(classDefinition: new (...args: Args) => T,params?:ParameterValue<any>[]): Promise<T>\r\n get<T>(label:any,param?:ParameterValue<any>[]):Promise<T>|T\r\n extend(): IContainerClient\r\n}\r\n\r\n\r\nexport interface IContainerSetup{\r\n registerClass<T, Args extends any[]>(classDefinition: { new (...args: Args): T }, options?: Partial<ContainerOptions>): void\r\n registerFunction<T extends (...arg:any[])=>any>(label:any,func: T, options?: ContainerOptions): void\r\n}\r\n\r\n\r\nexport type IContainer = IContainerClient & IContainerSetup\r\n\r\nexport type ContainerOptions = {\r\n param?: any[]\r\n loadAs?: LoadAs\r\n}\r\n\r\n\r\nexport interface IContainerFunctionDefinition{\r\n function:Function\r\n options:Partial<ContainerOptions>\r\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
@@ -1,22 +1,25 @@
|
|
|
1
|
-
import { ParameterValue } from
|
|
2
|
-
import { LoadAs } from
|
|
3
|
-
|
|
1
|
+
import { ParameterValue } from '../implementation/Parameter.cjs';
|
|
2
|
+
import { LoadAs } from '../implementation/LoadAs.cjs';
|
|
3
|
+
|
|
4
|
+
interface IContainerClient {
|
|
4
5
|
instance<T, Args extends any[]>(classDefinition: new (...args: Args) => T, params?: ParameterValue<any>[]): Promise<T>;
|
|
5
6
|
get<T>(label: any, param?: ParameterValue<any>[]): Promise<T> | T;
|
|
6
7
|
extend(): IContainerClient;
|
|
7
8
|
}
|
|
8
|
-
|
|
9
|
+
interface IContainerSetup {
|
|
9
10
|
registerClass<T, Args extends any[]>(classDefinition: {
|
|
10
11
|
new (...args: Args): T;
|
|
11
12
|
}, options?: Partial<ContainerOptions>): void;
|
|
12
13
|
registerFunction<T extends (...arg: any[]) => any>(label: any, func: T, options?: ContainerOptions): void;
|
|
13
14
|
}
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
type IContainer = IContainerClient & IContainerSetup;
|
|
16
|
+
type ContainerOptions = {
|
|
16
17
|
param?: any[];
|
|
17
18
|
loadAs?: LoadAs;
|
|
18
19
|
};
|
|
19
|
-
|
|
20
|
+
interface IContainerFunctionDefinition {
|
|
20
21
|
function: Function;
|
|
21
22
|
options: Partial<ContainerOptions>;
|
|
22
23
|
}
|
|
24
|
+
|
|
25
|
+
export type { ContainerOptions, IContainer, IContainerClient, IContainerFunctionDefinition, IContainerSetup };
|
|
@@ -1,22 +1,25 @@
|
|
|
1
|
-
import { ParameterValue } from
|
|
2
|
-
import { LoadAs } from
|
|
3
|
-
|
|
1
|
+
import { ParameterValue } from '../implementation/Parameter.js';
|
|
2
|
+
import { LoadAs } from '../implementation/LoadAs.js';
|
|
3
|
+
|
|
4
|
+
interface IContainerClient {
|
|
4
5
|
instance<T, Args extends any[]>(classDefinition: new (...args: Args) => T, params?: ParameterValue<any>[]): Promise<T>;
|
|
5
6
|
get<T>(label: any, param?: ParameterValue<any>[]): Promise<T> | T;
|
|
6
7
|
extend(): IContainerClient;
|
|
7
8
|
}
|
|
8
|
-
|
|
9
|
+
interface IContainerSetup {
|
|
9
10
|
registerClass<T, Args extends any[]>(classDefinition: {
|
|
10
11
|
new (...args: Args): T;
|
|
11
12
|
}, options?: Partial<ContainerOptions>): void;
|
|
12
13
|
registerFunction<T extends (...arg: any[]) => any>(label: any, func: T, options?: ContainerOptions): void;
|
|
13
14
|
}
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
type IContainer = IContainerClient & IContainerSetup;
|
|
16
|
+
type ContainerOptions = {
|
|
16
17
|
param?: any[];
|
|
17
18
|
loadAs?: LoadAs;
|
|
18
19
|
};
|
|
19
|
-
|
|
20
|
+
interface IContainerFunctionDefinition {
|
|
20
21
|
function: Function;
|
|
21
22
|
options: Partial<ContainerOptions>;
|
|
22
23
|
}
|
|
24
|
+
|
|
25
|
+
export type { ContainerOptions, IContainer, IContainerClient, IContainerFunctionDefinition, IContainerSetup };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=Container.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var index_exports = {};
|
|
20
|
+
__export(index_exports, {
|
|
21
|
+
CircularDependencyError: () => import_ContainerErrors.CircularDependencyError,
|
|
22
|
+
Component: () => import_decorators.Component,
|
|
23
|
+
Container: () => import_Container2.Container,
|
|
24
|
+
DependencyNotFoundError: () => import_ContainerErrors.DependencyNotFoundError,
|
|
25
|
+
Inject: () => import_decorators.Inject,
|
|
26
|
+
InstanceNotCreatedError: () => import_ContainerErrors.InstanceNotCreatedError,
|
|
27
|
+
LoadAs: () => import_LoadAs.LoadAs,
|
|
28
|
+
NotAClassDefinitionError: () => import_ContainerErrors.NotAClassDefinitionError,
|
|
29
|
+
Parameter: () => import_Parameter.Parameter,
|
|
30
|
+
ParameterNotFoundError: () => import_ContainerErrors.ParameterNotFoundError,
|
|
31
|
+
createContainer: () => import_Container3.createContainer,
|
|
32
|
+
default: () => index_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(index_exports);
|
|
35
|
+
var import_reflect_metadata = require("reflect-metadata");
|
|
36
|
+
var import_Container = require("./framework/implementation/Container.cjs");
|
|
37
|
+
var import_Container2 = require("./framework/implementation/Container.cjs");
|
|
38
|
+
var import_LoadAs = require("./framework/implementation/LoadAs.cjs");
|
|
39
|
+
var import_Parameter = require("./framework/implementation/Parameter.cjs");
|
|
40
|
+
var import_ContainerErrors = require("./framework/errors/ContainerErrors.cjs");
|
|
41
|
+
var import_decorators = require("./framework/decorators/index.cjs");
|
|
42
|
+
var import_Container3 = require("./framework/implementation/Container.cjs");
|
|
43
|
+
var index_default = import_Container.createContainer;
|
|
44
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
45
|
+
0 && (module.exports = {
|
|
46
|
+
CircularDependencyError,
|
|
47
|
+
Component,
|
|
48
|
+
Container,
|
|
49
|
+
DependencyNotFoundError,
|
|
50
|
+
Inject,
|
|
51
|
+
InstanceNotCreatedError,
|
|
52
|
+
LoadAs,
|
|
53
|
+
NotAClassDefinitionError,
|
|
54
|
+
Parameter,
|
|
55
|
+
ParameterNotFoundError,
|
|
56
|
+
createContainer
|
|
57
|
+
});
|
|
58
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../index.ts"],"sourcesContent":["import 'reflect-metadata';\nimport { createContainer } from \"./framework/implementation/Container\"\nimport { Container } from \"./framework/implementation/Container\"\nimport { LoadAs } from \"./framework/implementation/LoadAs\"\nimport { Parameter } from \"./framework/implementation/Parameter\"\nimport type { IContainer, IContainerClient, IContainerSetup } from \"./framework/interface/Container\"\nimport { NotAClassDefinitionError, ParameterNotFoundError, DependencyNotFoundError, InstanceNotCreatedError, CircularDependencyError } from \"./framework/errors/ContainerErrors\"\nimport { Component, Inject } from \"./framework/decorators/index\"\n\nexport type { IContainer, IContainerClient, IContainerSetup }\nexport { LoadAs }\nexport { Parameter }\nexport { Container }\nexport { NotAClassDefinitionError, ParameterNotFoundError, DependencyNotFoundError, InstanceNotCreatedError, CircularDependencyError }\nexport { Component, Inject }\nexport { createContainer } from \"./framework/implementation/Container\"\nexport default createContainer\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8BAAO;AACP,uBAAgC;AAChC,IAAAA,oBAA0B;AAC1B,oBAAuB;AACvB,uBAA0B;AAE1B,6BAA4I;AAC5I,wBAAkC;AAQlC,IAAAA,oBAAgC;AAChC,IAAO,gBAAQ;","names":["import_Container"]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createContainer } from './framework/implementation/Container.cjs';
|
|
2
|
+
export { Container } from './framework/implementation/Container.cjs';
|
|
3
|
+
export { LoadAs } from './framework/implementation/LoadAs.cjs';
|
|
4
|
+
export { Parameter } from './framework/implementation/Parameter.cjs';
|
|
5
|
+
export { IContainer, IContainerClient, IContainerSetup } from './framework/interface/Container.cjs';
|
|
6
|
+
export { CircularDependencyError, DependencyNotFoundError, InstanceNotCreatedError, NotAClassDefinitionError, ParameterNotFoundError } from './framework/errors/ContainerErrors.cjs';
|
|
7
|
+
export { Component } from './framework/decorators/Component.cjs';
|
|
8
|
+
export { Inject } from './framework/decorators/Inject.cjs';
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
export { createContainer, createContainer as default };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createContainer } from './framework/implementation/Container.js';
|
|
2
|
+
export { Container } from './framework/implementation/Container.js';
|
|
3
|
+
export { LoadAs } from './framework/implementation/LoadAs.js';
|
|
4
|
+
export { Parameter } from './framework/implementation/Parameter.js';
|
|
5
|
+
export { IContainer, IContainerClient, IContainerSetup } from './framework/interface/Container.js';
|
|
6
|
+
export { CircularDependencyError, DependencyNotFoundError, InstanceNotCreatedError, NotAClassDefinitionError, ParameterNotFoundError } from './framework/errors/ContainerErrors.js';
|
|
7
|
+
export { Component } from './framework/decorators/Component.js';
|
|
8
|
+
export { Inject } from './framework/decorators/Inject.js';
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
export { createContainer, createContainer as default };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import "reflect-metadata";
|
|
2
|
+
import { createContainer } from "./framework/implementation/Container.js";
|
|
3
|
+
import { Container } from "./framework/implementation/Container.js";
|
|
4
|
+
import { LoadAs } from "./framework/implementation/LoadAs.js";
|
|
5
|
+
import { Parameter } from "./framework/implementation/Parameter.js";
|
|
6
|
+
import { NotAClassDefinitionError, ParameterNotFoundError, DependencyNotFoundError, InstanceNotCreatedError, CircularDependencyError } from "./framework/errors/ContainerErrors.js";
|
|
7
|
+
import { Component, Inject } from "./framework/decorators/index.js";
|
|
8
|
+
import { createContainer as createContainer2 } from "./framework/implementation/Container.js";
|
|
9
|
+
var index_default = createContainer;
|
|
10
|
+
export {
|
|
11
|
+
CircularDependencyError,
|
|
12
|
+
Component,
|
|
13
|
+
Container,
|
|
14
|
+
DependencyNotFoundError,
|
|
15
|
+
Inject,
|
|
16
|
+
InstanceNotCreatedError,
|
|
17
|
+
LoadAs,
|
|
18
|
+
NotAClassDefinitionError,
|
|
19
|
+
Parameter,
|
|
20
|
+
ParameterNotFoundError,
|
|
21
|
+
createContainer2 as createContainer,
|
|
22
|
+
index_default as default
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../index.ts"],"sourcesContent":["import 'reflect-metadata';\nimport { createContainer } from \"./framework/implementation/Container\"\nimport { Container } from \"./framework/implementation/Container\"\nimport { LoadAs } from \"./framework/implementation/LoadAs\"\nimport { Parameter } from \"./framework/implementation/Parameter\"\nimport type { IContainer, IContainerClient, IContainerSetup } from \"./framework/interface/Container\"\nimport { NotAClassDefinitionError, ParameterNotFoundError, DependencyNotFoundError, InstanceNotCreatedError, CircularDependencyError } from \"./framework/errors/ContainerErrors\"\nimport { Component, Inject } from \"./framework/decorators/index\"\n\nexport type { IContainer, IContainerClient, IContainerSetup }\nexport { LoadAs }\nexport { Parameter }\nexport { Container }\nexport { NotAClassDefinitionError, ParameterNotFoundError, DependencyNotFoundError, InstanceNotCreatedError, CircularDependencyError }\nexport { Component, Inject }\nexport { createContainer } from \"./framework/implementation/Container\"\nexport default createContainer\n"],"mappings":"AAAA,OAAO;AACP,SAAS,uBAAuB;AAChC,SAAS,iBAAiB;AAC1B,SAAS,cAAc;AACvB,SAAS,iBAAiB;AAE1B,SAAS,0BAA0B,wBAAwB,yBAAyB,yBAAyB,+BAA+B;AAC5I,SAAS,WAAW,cAAc;AAQlC,SAAS,mBAAAA,wBAAuB;AAChC,IAAO,gBAAQ;","names":["createContainer"]}
|
package/package.json
CHANGED
|
@@ -1,28 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@noego/ioc",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"description": "A self contained IoC container for Node.js",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.cjs",
|
|
7
|
+
"module": "dist/index.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
8
9
|
"scripts": {
|
|
9
10
|
"test": "jest --silent",
|
|
10
|
-
"build
|
|
11
|
-
"build:esm": "tsc -p tsconfig.esm.json",
|
|
12
|
-
"build": "npm run build:cjs && npm run build:esm",
|
|
11
|
+
"build": "tsup && node scripts/fix-import-extensions.mjs",
|
|
13
12
|
"prepublishOnly": "npm run build",
|
|
14
|
-
"typecheck": "tsc
|
|
13
|
+
"typecheck": "tsc --noEmit"
|
|
15
14
|
},
|
|
16
15
|
"exports": {
|
|
17
16
|
".": {
|
|
18
|
-
"types": "./dist/
|
|
19
|
-
"require": "./dist/
|
|
20
|
-
"import": "./dist/
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"require": "./dist/index.cjs",
|
|
19
|
+
"import": "./dist/index.js",
|
|
20
|
+
"default": "./dist/index.js"
|
|
21
21
|
},
|
|
22
22
|
"./*": {
|
|
23
|
-
"types": "./dist
|
|
24
|
-
"require": "./dist
|
|
25
|
-
"import": "./dist
|
|
23
|
+
"types": "./dist/*.d.ts",
|
|
24
|
+
"require": "./dist/*.cjs",
|
|
25
|
+
"import": "./dist/*.js",
|
|
26
|
+
"default": "./dist/*.js"
|
|
26
27
|
},
|
|
27
28
|
"./package.json": "./package.json",
|
|
28
29
|
"./readme.md": "./readme.md"
|
|
@@ -48,6 +49,7 @@
|
|
|
48
49
|
"jest": "^29.7.0",
|
|
49
50
|
"ts-jest": "^29.3.2",
|
|
50
51
|
"ts-node": "^10.9.2",
|
|
52
|
+
"tsup": "^8.5.0",
|
|
51
53
|
"typescript": "^5.8.3"
|
|
52
54
|
}
|
|
53
55
|
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import 'reflect-metadata';
|
|
2
|
-
import { LoadAs } from '../implementation/LoadAs';
|
|
3
|
-
export interface ComponentOptions {
|
|
4
|
-
scope?: LoadAs;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Marks a class as a component managed by the IOC container.
|
|
8
|
-
* @param options Configuration options, primarily the scope (lifetime). Defaults to Transient.
|
|
9
|
-
*/
|
|
10
|
-
export declare function Component(options?: ComponentOptions): ClassDecorator;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Component = Component;
|
|
4
|
-
// framework/decorators/Component.ts
|
|
5
|
-
require("reflect-metadata");
|
|
6
|
-
const metadataKeys_1 = require("./metadataKeys");
|
|
7
|
-
const LoadAs_1 = require("../implementation/LoadAs");
|
|
8
|
-
/**
|
|
9
|
-
* Marks a class as a component managed by the IOC container.
|
|
10
|
-
* @param options Configuration options, primarily the scope (lifetime). Defaults to Transient.
|
|
11
|
-
*/
|
|
12
|
-
function Component(options = {}) {
|
|
13
|
-
return (target) => {
|
|
14
|
-
var _a;
|
|
15
|
-
// Ensure default scope if not provided
|
|
16
|
-
const finalOptions = {
|
|
17
|
-
scope: (_a = options.scope) !== null && _a !== void 0 ? _a : LoadAs_1.LoadAs.Transient, // Default to Transient
|
|
18
|
-
};
|
|
19
|
-
// Define metadata on the class constructor - use both Symbol and string versions
|
|
20
|
-
Reflect.defineMetadata(metadataKeys_1.COMPONENT_OPTIONS_METADATA_KEY, finalOptions, target);
|
|
21
|
-
// Also define with string key for easier debugging
|
|
22
|
-
Reflect.defineMetadata('ComponentOptions', finalOptions, target);
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
//# sourceMappingURL=Component.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Component.js","sourceRoot":"","sources":["../../../../framework/decorators/Component.ts"],"names":[],"mappings":";;AAaA,8BAaC;AA1BD,oCAAoC;AACpC,4BAA0B;AAC1B,iDAAgE;AAChE,qDAAkD;AAMlD;;;GAGG;AACH,SAAgB,SAAS,CAAC,UAA4B,EAAE;IACpD,OAAO,CAAC,MAAgB,EAAE,EAAE;;QACxB,uCAAuC;QACvC,MAAM,YAAY,GAA+B;YAC7C,KAAK,EAAE,MAAA,OAAO,CAAC,KAAK,mCAAI,eAAM,CAAC,SAAS,EAAE,uBAAuB;SACpE,CAAC;QAEF,iFAAiF;QACjF,OAAO,CAAC,cAAc,CAAC,6CAA8B,EAAE,YAAY,EAAE,MAAM,CAAC,CAAC;QAE7E,mDAAmD;QACnD,OAAO,CAAC,cAAc,CAAC,kBAAkB,EAAE,YAAY,EAAE,MAAM,CAAC,CAAC;IACrE,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Inject = Inject;
|
|
4
|
-
// framework/decorators/Inject.ts
|
|
5
|
-
require("reflect-metadata");
|
|
6
|
-
const metadataKeys_1 = require("./metadataKeys");
|
|
7
|
-
/**
|
|
8
|
-
* Decorator to explicitly specify the token/identifier for a constructor parameter dependency.
|
|
9
|
-
* Necessary for interfaces or when multiple implementations exist for a type.
|
|
10
|
-
* @param token The identifier (Symbol, string, or class) to inject.
|
|
11
|
-
*/
|
|
12
|
-
function Inject(token) {
|
|
13
|
-
return (target, propertyKey, parameterIndex) => {
|
|
14
|
-
// Get existing injection tokens array or initialize if not present
|
|
15
|
-
const injectionTokens = Reflect.getOwnMetadata(metadataKeys_1.INJECT_TOKEN_METADATA_KEY, target) || new Map();
|
|
16
|
-
// Store the token at the specific parameter index
|
|
17
|
-
injectionTokens.set(parameterIndex, token);
|
|
18
|
-
// Define the metadata on the target (class constructor)
|
|
19
|
-
Reflect.defineMetadata(metadataKeys_1.INJECT_TOKEN_METADATA_KEY, injectionTokens, target);
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=Inject.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Inject.js","sourceRoot":"","sources":["../../../../framework/decorators/Inject.ts"],"names":[],"mappings":";;AASA,wBAWC;AApBD,iCAAiC;AACjC,4BAA0B;AAC1B,iDAA2D;AAE3D;;;;GAIG;AACH,SAAgB,MAAM,CAAC,KAAU;IAC7B,OAAO,CAAC,MAAc,EAAE,WAAwC,EAAE,cAAsB,EAAE,EAAE;QACxF,mEAAmE;QACnE,MAAM,eAAe,GAAqB,OAAO,CAAC,cAAc,CAAC,wCAAyB,EAAE,MAAM,CAAC,IAAI,IAAI,GAAG,EAAe,CAAC;QAE9H,kDAAkD;QAClD,eAAe,CAAC,GAAG,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;QAE3C,wDAAwD;QACxD,OAAO,CAAC,cAAc,CAAC,wCAAyB,EAAE,eAAe,EAAE,MAAM,CAAC,CAAC;IAC/E,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
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
|
-
exports.Inject = exports.Component = void 0;
|
|
18
|
-
// Export decorators
|
|
19
|
-
var Component_1 = require("./Component");
|
|
20
|
-
Object.defineProperty(exports, "Component", { enumerable: true, get: function () { return Component_1.Component; } });
|
|
21
|
-
var Inject_1 = require("./Inject");
|
|
22
|
-
Object.defineProperty(exports, "Inject", { enumerable: true, get: function () { return Inject_1.Inject; } });
|
|
23
|
-
__exportStar(require("./metadataKeys"), exports);
|
|
24
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../framework/decorators/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,oBAAoB;AACpB,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;AAClB,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AACf,iDAA+B"}
|