@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
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
9
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
10
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
11
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
12
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
13
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
14
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
15
|
-
});
|
|
16
|
-
};
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
// SimpleDecoratorTest.test.ts
|
|
19
|
-
require("reflect-metadata");
|
|
20
|
-
const globals_1 = require("@jest/globals");
|
|
21
|
-
const Container_1 = require("./Container");
|
|
22
|
-
const Component_1 = require("../decorators/Component");
|
|
23
|
-
const LoadAs_1 = require("./LoadAs");
|
|
24
|
-
(0, globals_1.describe)('Simple Decorator Test', () => {
|
|
25
|
-
let container;
|
|
26
|
-
(0, globals_1.beforeEach)(() => {
|
|
27
|
-
container = (0, Container_1.createContainer)();
|
|
28
|
-
});
|
|
29
|
-
(0, globals_1.it)('should correctly apply and read decorator metadata', () => {
|
|
30
|
-
let TestClass = class TestClass {
|
|
31
|
-
constructor() {
|
|
32
|
-
this.value = Math.random();
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
TestClass = __decorate([
|
|
36
|
-
(0, Component_1.Component)({ scope: LoadAs_1.LoadAs.Singleton })
|
|
37
|
-
], TestClass);
|
|
38
|
-
// Check metadata is correctly set
|
|
39
|
-
const metadata = Reflect.getMetadata('ComponentOptions', TestClass);
|
|
40
|
-
console.log('Metadata:', metadata);
|
|
41
|
-
(0, globals_1.expect)(metadata).toBeDefined();
|
|
42
|
-
(0, globals_1.expect)(metadata.scope).toBe(LoadAs_1.LoadAs.Singleton);
|
|
43
|
-
});
|
|
44
|
-
(0, globals_1.it)('should respect singleton scope', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
45
|
-
class TestSingleton {
|
|
46
|
-
constructor() {
|
|
47
|
-
this.value = Math.random();
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
// Register with explicit singleton scope
|
|
51
|
-
container.registerClass(TestSingleton, { loadAs: LoadAs_1.LoadAs.Singleton });
|
|
52
|
-
// Get two instances
|
|
53
|
-
const instance1 = yield container.instance(TestSingleton);
|
|
54
|
-
const instance2 = yield container.instance(TestSingleton);
|
|
55
|
-
// Should be singleton
|
|
56
|
-
(0, globals_1.expect)(instance1).toBe(instance2);
|
|
57
|
-
(0, globals_1.expect)(instance1.value).toBe(instance2.value);
|
|
58
|
-
}));
|
|
59
|
-
(0, globals_1.it)('should respect scoped lifetime', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
60
|
-
class TestScoped {
|
|
61
|
-
constructor() {
|
|
62
|
-
this.value = Math.random();
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
// Register with explicit scoped lifetime
|
|
66
|
-
container.registerClass(TestScoped, { loadAs: LoadAs_1.LoadAs.Scoped });
|
|
67
|
-
// Get two instances from same container
|
|
68
|
-
const instance1 = yield container.instance(TestScoped);
|
|
69
|
-
const instance2 = yield container.instance(TestScoped);
|
|
70
|
-
// Same container = same instance
|
|
71
|
-
(0, globals_1.expect)(instance1).toBe(instance2);
|
|
72
|
-
// Different container = different instance
|
|
73
|
-
const childContainer = container.extend();
|
|
74
|
-
const instance3 = yield childContainer.instance(TestScoped);
|
|
75
|
-
(0, globals_1.expect)(instance1).not.toBe(instance3);
|
|
76
|
-
}));
|
|
77
|
-
});
|
|
78
|
-
//# sourceMappingURL=SimpleDecoratorTest.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SimpleDecoratorTest.test.js","sourceRoot":"","sources":["../../../../framework/implementation/SimpleDecoratorTest.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,8BAA8B;AAC9B,4BAA0B;AAC1B,2CAAiE;AACjE,2CAA8C;AAC9C,uDAAoD;AACpD,qCAAkC;AAIlC,IAAA,kBAAQ,EAAC,uBAAuB,EAAE,GAAG,EAAE;IACnC,IAAI,SAAqB,CAAC;IAE1B,IAAA,oBAAU,EAAC,GAAG,EAAE;QACZ,SAAS,GAAG,IAAA,2BAAe,GAAE,CAAC;IAClC,CAAC,CAAC,CAAC;IAEH,IAAA,YAAE,EAAC,oDAAoD,EAAE,GAAG,EAAE;QAE1D,IAAM,SAAS,GAAf,MAAM,SAAS;YAAf;gBACI,UAAK,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;YAC1B,CAAC;SAAA,CAAA;QAFK,SAAS;YADd,IAAA,qBAAS,EAAC,EAAE,KAAK,EAAE,eAAM,CAAC,SAAS,EAAE,CAAC;WACjC,SAAS,CAEd;QAED,kCAAkC;QAClC,MAAM,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC,kBAAkB,EAAE,SAAS,CAAC,CAAC;QACpE,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;QACnC,IAAA,gBAAM,EAAC,QAAQ,CAAC,CAAC,WAAW,EAAE,CAAC;QAC/B,IAAA,gBAAM,EAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,eAAM,CAAC,SAAS,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;IAEH,IAAA,YAAE,EAAC,gCAAgC,EAAE,GAAS,EAAE;QAC5C,MAAM,aAAa;YAAnB;gBACI,UAAK,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;YAC1B,CAAC;SAAA;QAED,yCAAyC;QACzC,SAAS,CAAC,aAAa,CAAC,aAAa,EAAE,EAAE,MAAM,EAAE,eAAM,CAAC,SAAS,EAAE,CAAC,CAAC;QAErE,oBAAoB;QACpB,MAAM,SAAS,GAAG,MAAM,SAAS,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;QAC1D,MAAM,SAAS,GAAG,MAAM,SAAS,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;QAE1D,sBAAsB;QACtB,IAAA,gBAAM,EAAC,SAAS,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAClC,IAAA,gBAAM,EAAC,SAAS,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAClD,CAAC,CAAA,CAAC,CAAC;IAEH,IAAA,YAAE,EAAC,gCAAgC,EAAE,GAAS,EAAE;QAC5C,MAAM,UAAU;YAAhB;gBACI,UAAK,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;YAC1B,CAAC;SAAA;QAED,yCAAyC;QACzC,SAAS,CAAC,aAAa,CAAC,UAAU,EAAE,EAAE,MAAM,EAAE,eAAM,CAAC,MAAM,EAAE,CAAC,CAAC;QAE/D,wCAAwC;QACxC,MAAM,SAAS,GAAG,MAAM,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;QACvD,MAAM,SAAS,GAAG,MAAM,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;QAEvD,iCAAiC;QACjC,IAAA,gBAAM,EAAC,SAAS,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAElC,2CAA2C;QAC3C,MAAM,cAAc,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC;QAC1C,MAAM,SAAS,GAAG,MAAM,cAAc,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;QAC5D,IAAA,gBAAM,EAAC,SAAS,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC1C,CAAC,CAAA,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import 'reflect-metadata';
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
9
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
10
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
11
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
12
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
13
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
14
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
15
|
-
});
|
|
16
|
-
};
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
// SingletonTest.test.ts - Minimal test for singleton functionality
|
|
19
|
-
require("reflect-metadata");
|
|
20
|
-
const globals_1 = require("@jest/globals");
|
|
21
|
-
const Container_1 = require("./Container");
|
|
22
|
-
const Component_1 = require("../decorators/Component");
|
|
23
|
-
const LoadAs_1 = require("./LoadAs");
|
|
24
|
-
(0, globals_1.describe)('Singleton and Decorator Test', () => {
|
|
25
|
-
let container;
|
|
26
|
-
(0, globals_1.beforeEach)(() => {
|
|
27
|
-
container = (0, Container_1.createContainer)();
|
|
28
|
-
});
|
|
29
|
-
(0, globals_1.it)('should handle singleton with manual registration', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
30
|
-
class TestService {
|
|
31
|
-
constructor() {
|
|
32
|
-
this.value = Math.random();
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
// Register with manual singleton option
|
|
36
|
-
container.registerClass(TestService, { loadAs: LoadAs_1.LoadAs.Singleton });
|
|
37
|
-
// Get two instances
|
|
38
|
-
const instance1 = yield container.instance(TestService);
|
|
39
|
-
const instance2 = yield container.instance(TestService);
|
|
40
|
-
// Should be same instance
|
|
41
|
-
(0, globals_1.expect)(instance1).toBe(instance2);
|
|
42
|
-
}));
|
|
43
|
-
(0, globals_1.it)('should maintain scoped instances within same container', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
44
|
-
class ScopedService {
|
|
45
|
-
constructor() {
|
|
46
|
-
this.value = Math.random();
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
// Register with manual scoped option
|
|
50
|
-
container.registerClass(ScopedService, { loadAs: LoadAs_1.LoadAs.Scoped });
|
|
51
|
-
// Get two instances from same container
|
|
52
|
-
const instance1 = yield container.instance(ScopedService);
|
|
53
|
-
const instance2 = yield container.instance(ScopedService);
|
|
54
|
-
// Should be same instance within same container
|
|
55
|
-
(0, globals_1.expect)(instance1).toBe(instance2);
|
|
56
|
-
}));
|
|
57
|
-
(0, globals_1.it)('should handle singleton with decorator', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
58
|
-
let SingletonWithDecorator = class SingletonWithDecorator {
|
|
59
|
-
constructor() {
|
|
60
|
-
this.value = Math.random();
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
SingletonWithDecorator = __decorate([
|
|
64
|
-
(0, Component_1.Component)({ scope: LoadAs_1.LoadAs.Singleton })
|
|
65
|
-
], SingletonWithDecorator);
|
|
66
|
-
// Check metadata - try both string and symbol keys
|
|
67
|
-
const metadataSymbol = Reflect.getMetadata(Symbol('ioc:component:options'), SingletonWithDecorator);
|
|
68
|
-
const metadataString = Reflect.getMetadata('ComponentOptions', SingletonWithDecorator);
|
|
69
|
-
console.log('Metadata keys:', Reflect.getMetadataKeys(SingletonWithDecorator));
|
|
70
|
-
console.log('Metadata for SingletonWithDecorator (symbol):', metadataSymbol);
|
|
71
|
-
console.log('Metadata for SingletonWithDecorator (string):', metadataString);
|
|
72
|
-
// Manual registration with singleton scope
|
|
73
|
-
container.registerClass(SingletonWithDecorator, { loadAs: LoadAs_1.LoadAs.Singleton });
|
|
74
|
-
// Get two instances
|
|
75
|
-
const instance1 = yield container.instance(SingletonWithDecorator);
|
|
76
|
-
const instance2 = yield container.instance(SingletonWithDecorator);
|
|
77
|
-
// Log instance details
|
|
78
|
-
console.log('Instance 1:', instance1);
|
|
79
|
-
console.log('Instance 2:', instance2);
|
|
80
|
-
console.log('Same instance?', instance1 === instance2);
|
|
81
|
-
// Should be same instance
|
|
82
|
-
(0, globals_1.expect)(instance1).toBe(instance2);
|
|
83
|
-
}));
|
|
84
|
-
});
|
|
85
|
-
//# sourceMappingURL=SingletonTest.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SingletonTest.test.js","sourceRoot":"","sources":["../../../../framework/implementation/SingletonTest.test.ts"],"names":[],"mappings":"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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Container.js","sourceRoot":"","sources":["../../../../framework/interface/Container.ts"],"names":[],"mappings":""}
|
package/dist/cjs/index.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import 'reflect-metadata';
|
|
2
|
-
import { createContainer } from "./framework/implementation/Container";
|
|
3
|
-
import { Container } from "./framework/implementation/Container";
|
|
4
|
-
import { LoadAs } from "./framework/implementation/LoadAs";
|
|
5
|
-
import { Parameter } from "./framework/implementation/Parameter";
|
|
6
|
-
import { IContainer, IContainerClient, IContainerSetup } from "./framework/interface/Container";
|
|
7
|
-
import { NotAClassDefinitionError, ParameterNotFoundError, DependencyNotFoundError, InstanceNotCreatedError, CircularDependencyError } from "./framework/errors/ContainerErrors";
|
|
8
|
-
import { Component, Inject } from "./framework/decorators/index";
|
|
9
|
-
export { IContainerSetup };
|
|
10
|
-
export { IContainerClient };
|
|
11
|
-
export { IContainer };
|
|
12
|
-
export { LoadAs };
|
|
13
|
-
export { Parameter };
|
|
14
|
-
export { Container };
|
|
15
|
-
export { NotAClassDefinitionError, ParameterNotFoundError, DependencyNotFoundError, InstanceNotCreatedError, CircularDependencyError };
|
|
16
|
-
export { Component, Inject };
|
|
17
|
-
export { createContainer } from "./framework/implementation/Container";
|
|
18
|
-
export default createContainer;
|
package/dist/cjs/index.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createContainer = exports.Inject = exports.Component = exports.CircularDependencyError = exports.InstanceNotCreatedError = exports.DependencyNotFoundError = exports.ParameterNotFoundError = exports.NotAClassDefinitionError = exports.Container = exports.Parameter = exports.LoadAs = void 0;
|
|
4
|
-
require("reflect-metadata");
|
|
5
|
-
const Container_1 = require("./framework/implementation/Container");
|
|
6
|
-
const Container_2 = require("./framework/implementation/Container");
|
|
7
|
-
Object.defineProperty(exports, "Container", { enumerable: true, get: function () { return Container_2.Container; } });
|
|
8
|
-
const LoadAs_1 = require("./framework/implementation/LoadAs");
|
|
9
|
-
Object.defineProperty(exports, "LoadAs", { enumerable: true, get: function () { return LoadAs_1.LoadAs; } });
|
|
10
|
-
const Parameter_1 = require("./framework/implementation/Parameter");
|
|
11
|
-
Object.defineProperty(exports, "Parameter", { enumerable: true, get: function () { return Parameter_1.Parameter; } });
|
|
12
|
-
const ContainerErrors_1 = require("./framework/errors/ContainerErrors");
|
|
13
|
-
Object.defineProperty(exports, "NotAClassDefinitionError", { enumerable: true, get: function () { return ContainerErrors_1.NotAClassDefinitionError; } });
|
|
14
|
-
Object.defineProperty(exports, "ParameterNotFoundError", { enumerable: true, get: function () { return ContainerErrors_1.ParameterNotFoundError; } });
|
|
15
|
-
Object.defineProperty(exports, "DependencyNotFoundError", { enumerable: true, get: function () { return ContainerErrors_1.DependencyNotFoundError; } });
|
|
16
|
-
Object.defineProperty(exports, "InstanceNotCreatedError", { enumerable: true, get: function () { return ContainerErrors_1.InstanceNotCreatedError; } });
|
|
17
|
-
Object.defineProperty(exports, "CircularDependencyError", { enumerable: true, get: function () { return ContainerErrors_1.CircularDependencyError; } });
|
|
18
|
-
const index_1 = require("./framework/decorators/index");
|
|
19
|
-
Object.defineProperty(exports, "Component", { enumerable: true, get: function () { return index_1.Component; } });
|
|
20
|
-
Object.defineProperty(exports, "Inject", { enumerable: true, get: function () { return index_1.Inject; } });
|
|
21
|
-
var Container_3 = require("./framework/implementation/Container");
|
|
22
|
-
Object.defineProperty(exports, "createContainer", { enumerable: true, get: function () { return Container_3.createContainer; } });
|
|
23
|
-
exports.default = Container_1.createContainer;
|
|
24
|
-
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":";;;AAAA,4BAA0B;AAC1B,oEAAsE;AACtE,oEAAgE;AAYvD,0FAZA,qBAAS,OAYA;AAXlB,8DAA0D;AASjD,uFATA,eAAM,OASA;AARf,oEAAgE;AASvD,0FATA,qBAAS,OASA;AAPlB,wEAAgL;AASvK,yGATA,0CAAwB,OASA;AAAE,uGATA,wCAAsB,OASA;AAAE,wGATA,yCAAuB,OASA;AAAE,wGATA,yCAAuB,OASA;AAAE,wGATA,yCAAuB,OASA;AARpI,wDAAgE;AASvD,0FATA,iBAAS,OASA;AAAE,uFATA,cAAM,OASA;AAC1B,kEAAsE;AAA7D,4GAAA,eAAe,OAAA;AACxB,kBAAe,2BAAe,CAAA"}
|
package/dist/cjs/jest.config.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const jestConfig = {
|
|
4
|
-
preset: 'ts-jest',
|
|
5
|
-
testEnvironment: 'node',
|
|
6
|
-
testPathIgnorePatterns: ['/node_modules/', '/dist/'],
|
|
7
|
-
};
|
|
8
|
-
exports.default = jestConfig;
|
|
9
|
-
//# sourceMappingURL=jest.config.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jest.config.js","sourceRoot":"","sources":["../../jest.config.ts"],"names":[],"mappings":";;AAEA,MAAM,UAAU,GAAyB;IACvC,MAAM,EAAE,SAAS;IACjB,eAAe,EAAE,MAAM;IACvB,sBAAsB,EAAE,CAAC,gBAAgB,EAAE,QAAQ,CAAC;CACrD,CAAC;AAEF,kBAAe,UAAU,CAAC"}
|
|
@@ -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,21 +0,0 @@
|
|
|
1
|
-
// framework/decorators/Component.ts
|
|
2
|
-
import 'reflect-metadata';
|
|
3
|
-
import { COMPONENT_OPTIONS_METADATA_KEY } from './metadataKeys';
|
|
4
|
-
import { LoadAs } from '../implementation/LoadAs';
|
|
5
|
-
/**
|
|
6
|
-
* Marks a class as a component managed by the IOC container.
|
|
7
|
-
* @param options Configuration options, primarily the scope (lifetime). Defaults to Transient.
|
|
8
|
-
*/
|
|
9
|
-
export function Component(options = {}) {
|
|
10
|
-
return (target) => {
|
|
11
|
-
// Ensure default scope if not provided
|
|
12
|
-
const finalOptions = {
|
|
13
|
-
scope: options.scope ?? LoadAs.Transient, // Default to Transient
|
|
14
|
-
};
|
|
15
|
-
// Define metadata on the class constructor - use both Symbol and string versions
|
|
16
|
-
Reflect.defineMetadata(COMPONENT_OPTIONS_METADATA_KEY, finalOptions, target);
|
|
17
|
-
// Also define with string key for easier debugging
|
|
18
|
-
Reflect.defineMetadata('ComponentOptions', finalOptions, target);
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=Component.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Component.js","sourceRoot":"","sources":["../../../../framework/decorators/Component.ts"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,8BAA8B,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAMlD;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,UAA4B,EAAE;IACpD,OAAO,CAAC,MAAgB,EAAE,EAAE;QACxB,uCAAuC;QACvC,MAAM,YAAY,GAA+B;YAC7C,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,MAAM,CAAC,SAAS,EAAE,uBAAuB;SACpE,CAAC;QAEF,iFAAiF;QACjF,OAAO,CAAC,cAAc,CAAC,8BAA8B,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,19 +0,0 @@
|
|
|
1
|
-
// framework/decorators/Inject.ts
|
|
2
|
-
import 'reflect-metadata';
|
|
3
|
-
import { INJECT_TOKEN_METADATA_KEY } from './metadataKeys';
|
|
4
|
-
/**
|
|
5
|
-
* Decorator to explicitly specify the token/identifier for a constructor parameter dependency.
|
|
6
|
-
* Necessary for interfaces or when multiple implementations exist for a type.
|
|
7
|
-
* @param token The identifier (Symbol, string, or class) to inject.
|
|
8
|
-
*/
|
|
9
|
-
export function Inject(token) {
|
|
10
|
-
return (target, propertyKey, parameterIndex) => {
|
|
11
|
-
// Get existing injection tokens array or initialize if not present
|
|
12
|
-
const injectionTokens = Reflect.getOwnMetadata(INJECT_TOKEN_METADATA_KEY, target) || new Map();
|
|
13
|
-
// Store the token at the specific parameter index
|
|
14
|
-
injectionTokens.set(parameterIndex, token);
|
|
15
|
-
// Define the metadata on the target (class constructor)
|
|
16
|
-
Reflect.defineMetadata(INJECT_TOKEN_METADATA_KEY, injectionTokens, target);
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=Inject.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Inject.js","sourceRoot":"","sources":["../../../../framework/decorators/Inject.ts"],"names":[],"mappings":"AAAA,iCAAiC;AACjC,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAE3D;;;;GAIG;AACH,MAAM,UAAU,MAAM,CAAC,KAAU;IAC7B,OAAO,CAAC,MAAc,EAAE,WAAwC,EAAE,cAAsB,EAAE,EAAE;QACxF,mEAAmE;QACnE,MAAM,eAAe,GAAqB,OAAO,CAAC,cAAc,CAAC,yBAAyB,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,yBAAyB,EAAE,eAAe,EAAE,MAAM,CAAC,CAAC;IAC/E,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../framework/decorators/index.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,cAAc,gBAAgB,CAAC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
// framework/decorators/metadataKeys.ts
|
|
2
|
-
export const COMPONENT_OPTIONS_METADATA_KEY = Symbol.for("ioc:component:options");
|
|
3
|
-
export const PARAM_TYPES_METADATA_KEY = "design:paramtypes"; // Standard key
|
|
4
|
-
export const INJECT_TOKEN_METADATA_KEY = Symbol.for("ioc:inject:tokens");
|
|
5
|
-
//# sourceMappingURL=metadataKeys.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"metadataKeys.js","sourceRoot":"","sources":["../../../../framework/decorators/metadataKeys.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,MAAM,CAAC,MAAM,8BAA8B,GAAG,MAAM,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;AAClF,MAAM,CAAC,MAAM,wBAAwB,GAAG,mBAAmB,CAAC,CAAC,eAAe;AAC5E,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Error types for the IOC container
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Thrown when a class definition is expected but not provided
|
|
6
|
-
*/
|
|
7
|
-
export class NotAClassDefinitionError extends Error {
|
|
8
|
-
constructor(message = "Not a class definition") {
|
|
9
|
-
super(message);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Thrown when a parameter value is required but not provided
|
|
14
|
-
*/
|
|
15
|
-
export class ParameterNotFoundError extends Error {
|
|
16
|
-
constructor(paramName = "parameter") {
|
|
17
|
-
super(`No value found for ${paramName}`);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Thrown when trying to resolve a dependency that is not registered
|
|
22
|
-
*/
|
|
23
|
-
export class DependencyNotFoundError extends Error {
|
|
24
|
-
constructor(label) {
|
|
25
|
-
super(`Dependency not found: ${label}`);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Thrown when an instance has not been created but is being retrieved
|
|
30
|
-
*/
|
|
31
|
-
export class InstanceNotCreatedError extends Error {
|
|
32
|
-
constructor() {
|
|
33
|
-
super("Instance has not been created and therefore cannot be retrieved");
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Thrown when circular dependencies are detected
|
|
38
|
-
*/
|
|
39
|
-
export class CircularDependencyError extends Error {
|
|
40
|
-
constructor(dependencyChain) {
|
|
41
|
-
super(`Circular dependency detected: ${dependencyChain.join(' -> ')}`);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
//# sourceMappingURL=ContainerErrors.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ContainerErrors.js","sourceRoot":"","sources":["../../../../framework/errors/ContainerErrors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,OAAO,wBAAyB,SAAQ,KAAK;IAC/C,YAAY,OAAO,GAAG,wBAAwB;QAC1C,KAAK,CAAC,OAAO,CAAC,CAAC;IACnB,CAAC;CACJ;AAED;;GAEG;AACH,MAAM,OAAO,sBAAuB,SAAQ,KAAK;IAC7C,YAAY,SAAS,GAAG,WAAW;QAC/B,KAAK,CAAC,sBAAsB,SAAS,EAAE,CAAC,CAAC;IAC7C,CAAC;CACJ;AAED;;GAEG;AACH,MAAM,OAAO,uBAAwB,SAAQ,KAAK;IAC9C,YAAY,KAAU;QAClB,KAAK,CAAC,yBAAyB,KAAK,EAAE,CAAC,CAAC;IAC5C,CAAC;CACJ;AAED;;GAEG;AACH,MAAM,OAAO,uBAAwB,SAAQ,KAAK;IAC9C;QACI,KAAK,CAAC,iEAAiE,CAAC,CAAC;IAC7E,CAAC;CACJ;AAED;;GAEG;AACH,MAAM,OAAO,uBAAwB,SAAQ,KAAK;IAC9C,YAAY,eAAyB;QACjC,KAAK,CAAC,iCAAiC,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAC3E,CAAC;CACJ"}
|