@noego/ioc 0.0.6 → 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 -13
- package/readme.md +9 -0
- 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,41 @@
|
|
|
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 Component_exports = {};
|
|
20
|
+
__export(Component_exports, {
|
|
21
|
+
Component: () => Component
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(Component_exports);
|
|
24
|
+
var import_reflect_metadata = require("reflect-metadata");
|
|
25
|
+
var import_metadataKeys = require("./metadataKeys.cjs");
|
|
26
|
+
var import_LoadAs = require("../implementation/LoadAs.cjs");
|
|
27
|
+
function Component(options = {}) {
|
|
28
|
+
return (target) => {
|
|
29
|
+
const finalOptions = {
|
|
30
|
+
scope: options.scope ?? import_LoadAs.LoadAs.Transient
|
|
31
|
+
// Default to Transient
|
|
32
|
+
};
|
|
33
|
+
Reflect.defineMetadata(import_metadataKeys.COMPONENT_OPTIONS_METADATA_KEY, finalOptions, target);
|
|
34
|
+
Reflect.defineMetadata("ComponentOptions", finalOptions, target);
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
38
|
+
0 && (module.exports = {
|
|
39
|
+
Component
|
|
40
|
+
});
|
|
41
|
+
//# sourceMappingURL=Component.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../framework/decorators/Component.ts"],"sourcesContent":["// framework/decorators/Component.ts\nimport 'reflect-metadata';\nimport { COMPONENT_OPTIONS_METADATA_KEY } from './metadataKeys';\nimport { LoadAs } from '../implementation/LoadAs';\n\nexport interface ComponentOptions {\n scope?: LoadAs;\n}\n\n/**\n * Marks a class as a component managed by the IOC container.\n * @param options Configuration options, primarily the scope (lifetime). Defaults to Transient.\n */\nexport function Component(options: ComponentOptions = {}): ClassDecorator {\n return (target: Function) => {\n // Ensure default scope if not provided\n const finalOptions: Required<ComponentOptions> = {\n scope: options.scope ?? LoadAs.Transient, // Default to Transient\n };\n \n // Define metadata on the class constructor - use both Symbol and string versions\n Reflect.defineMetadata(COMPONENT_OPTIONS_METADATA_KEY, finalOptions, target);\n \n // Also define with string key for easier debugging\n Reflect.defineMetadata('ComponentOptions', finalOptions, target);\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,8BAAO;AACP,0BAA+C;AAC/C,oBAAuB;AAUhB,SAAS,UAAU,UAA4B,CAAC,GAAmB;AACtE,SAAO,CAAC,WAAqB;AAEzB,UAAM,eAA2C;AAAA,MAC7C,OAAO,QAAQ,SAAS,qBAAO;AAAA;AAAA,IACnC;AAGA,YAAQ,eAAe,oDAAgC,cAAc,MAAM;AAG3E,YAAQ,eAAe,oBAAoB,cAAc,MAAM;AAAA,EACnE;AACJ;","names":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { LoadAs } from '../implementation/LoadAs.cjs';
|
|
2
|
+
|
|
3
|
+
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
|
+
declare function Component(options?: ComponentOptions): ClassDecorator;
|
|
11
|
+
|
|
12
|
+
export { Component, type ComponentOptions };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { LoadAs } from '../implementation/LoadAs.js';
|
|
2
|
+
|
|
3
|
+
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
|
+
declare function Component(options?: ComponentOptions): ClassDecorator;
|
|
11
|
+
|
|
12
|
+
export { Component, type ComponentOptions };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import "reflect-metadata";
|
|
2
|
+
import { COMPONENT_OPTIONS_METADATA_KEY } from "./metadataKeys.js";
|
|
3
|
+
import { LoadAs } from "../implementation/LoadAs.js";
|
|
4
|
+
function Component(options = {}) {
|
|
5
|
+
return (target) => {
|
|
6
|
+
const finalOptions = {
|
|
7
|
+
scope: options.scope ?? LoadAs.Transient
|
|
8
|
+
// Default to Transient
|
|
9
|
+
};
|
|
10
|
+
Reflect.defineMetadata(COMPONENT_OPTIONS_METADATA_KEY, finalOptions, target);
|
|
11
|
+
Reflect.defineMetadata("ComponentOptions", finalOptions, target);
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
Component
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=Component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../framework/decorators/Component.ts"],"sourcesContent":["// framework/decorators/Component.ts\nimport 'reflect-metadata';\nimport { COMPONENT_OPTIONS_METADATA_KEY } from './metadataKeys';\nimport { LoadAs } from '../implementation/LoadAs';\n\nexport interface ComponentOptions {\n scope?: LoadAs;\n}\n\n/**\n * Marks a class as a component managed by the IOC container.\n * @param options Configuration options, primarily the scope (lifetime). Defaults to Transient.\n */\nexport function Component(options: ComponentOptions = {}): ClassDecorator {\n return (target: Function) => {\n // Ensure default scope if not provided\n const finalOptions: Required<ComponentOptions> = {\n scope: options.scope ?? LoadAs.Transient, // Default to Transient\n };\n \n // Define metadata on the class constructor - use both Symbol and string versions\n Reflect.defineMetadata(COMPONENT_OPTIONS_METADATA_KEY, finalOptions, target);\n \n // Also define with string key for easier debugging\n Reflect.defineMetadata('ComponentOptions', finalOptions, target);\n };\n}\n"],"mappings":"AACA,OAAO;AACP,SAAS,sCAAsC;AAC/C,SAAS,cAAc;AAUhB,SAAS,UAAU,UAA4B,CAAC,GAAmB;AACtE,SAAO,CAAC,WAAqB;AAEzB,UAAM,eAA2C;AAAA,MAC7C,OAAO,QAAQ,SAAS,OAAO;AAAA;AAAA,IACnC;AAGA,YAAQ,eAAe,gCAAgC,cAAc,MAAM;AAG3E,YAAQ,eAAe,oBAAoB,cAAc,MAAM;AAAA,EACnE;AACJ;","names":[]}
|
|
@@ -0,0 +1,37 @@
|
|
|
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 Inject_exports = {};
|
|
20
|
+
__export(Inject_exports, {
|
|
21
|
+
Inject: () => Inject
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(Inject_exports);
|
|
24
|
+
var import_reflect_metadata = require("reflect-metadata");
|
|
25
|
+
var import_metadataKeys = require("./metadataKeys.cjs");
|
|
26
|
+
function Inject(token) {
|
|
27
|
+
return (target, propertyKey, parameterIndex) => {
|
|
28
|
+
const injectionTokens = Reflect.getOwnMetadata(import_metadataKeys.INJECT_TOKEN_METADATA_KEY, target) || /* @__PURE__ */ new Map();
|
|
29
|
+
injectionTokens.set(parameterIndex, token);
|
|
30
|
+
Reflect.defineMetadata(import_metadataKeys.INJECT_TOKEN_METADATA_KEY, injectionTokens, target);
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
34
|
+
0 && (module.exports = {
|
|
35
|
+
Inject
|
|
36
|
+
});
|
|
37
|
+
//# sourceMappingURL=Inject.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../framework/decorators/Inject.ts"],"sourcesContent":["// framework/decorators/Inject.ts\nimport 'reflect-metadata';\nimport { INJECT_TOKEN_METADATA_KEY } from './metadataKeys';\n\n/**\n * Decorator to explicitly specify the token/identifier for a constructor parameter dependency.\n * Necessary for interfaces or when multiple implementations exist for a type.\n * @param token The identifier (Symbol, string, or class) to inject.\n */\nexport function Inject(token: any): ParameterDecorator {\n return (target: Object, propertyKey: string | symbol | undefined, parameterIndex: number) => {\n // Get existing injection tokens array or initialize if not present\n const injectionTokens: Map<number, any> = Reflect.getOwnMetadata(INJECT_TOKEN_METADATA_KEY, target) || new Map<number, any>();\n\n // Store the token at the specific parameter index\n injectionTokens.set(parameterIndex, token);\n\n // Define the metadata on the target (class constructor)\n Reflect.defineMetadata(INJECT_TOKEN_METADATA_KEY, injectionTokens, target);\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,8BAAO;AACP,0BAA0C;AAOnC,SAAS,OAAO,OAAgC;AACnD,SAAO,CAAC,QAAgB,aAA0C,mBAA2B;AAEzF,UAAM,kBAAoC,QAAQ,eAAe,+CAA2B,MAAM,KAAK,oBAAI,IAAiB;AAG5H,oBAAgB,IAAI,gBAAgB,KAAK;AAGzC,YAAQ,eAAe,+CAA2B,iBAAiB,MAAM;AAAA,EAC7E;AACJ;","names":[]}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import 'reflect-metadata';
|
|
2
1
|
/**
|
|
3
2
|
* Decorator to explicitly specify the token/identifier for a constructor parameter dependency.
|
|
4
3
|
* Necessary for interfaces or when multiple implementations exist for a type.
|
|
5
4
|
* @param token The identifier (Symbol, string, or class) to inject.
|
|
6
5
|
*/
|
|
7
|
-
|
|
6
|
+
declare function Inject(token: any): ParameterDecorator;
|
|
7
|
+
|
|
8
|
+
export { Inject };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import 'reflect-metadata';
|
|
2
1
|
/**
|
|
3
2
|
* Decorator to explicitly specify the token/identifier for a constructor parameter dependency.
|
|
4
3
|
* Necessary for interfaces or when multiple implementations exist for a type.
|
|
5
4
|
* @param token The identifier (Symbol, string, or class) to inject.
|
|
6
5
|
*/
|
|
7
|
-
|
|
6
|
+
declare function Inject(token: any): ParameterDecorator;
|
|
7
|
+
|
|
8
|
+
export { Inject };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import "reflect-metadata";
|
|
2
|
+
import { INJECT_TOKEN_METADATA_KEY } from "./metadataKeys.js";
|
|
3
|
+
function Inject(token) {
|
|
4
|
+
return (target, propertyKey, parameterIndex) => {
|
|
5
|
+
const injectionTokens = Reflect.getOwnMetadata(INJECT_TOKEN_METADATA_KEY, target) || /* @__PURE__ */ new Map();
|
|
6
|
+
injectionTokens.set(parameterIndex, token);
|
|
7
|
+
Reflect.defineMetadata(INJECT_TOKEN_METADATA_KEY, injectionTokens, target);
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
Inject
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=Inject.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../framework/decorators/Inject.ts"],"sourcesContent":["// framework/decorators/Inject.ts\nimport 'reflect-metadata';\nimport { INJECT_TOKEN_METADATA_KEY } from './metadataKeys';\n\n/**\n * Decorator to explicitly specify the token/identifier for a constructor parameter dependency.\n * Necessary for interfaces or when multiple implementations exist for a type.\n * @param token The identifier (Symbol, string, or class) to inject.\n */\nexport function Inject(token: any): ParameterDecorator {\n return (target: Object, propertyKey: string | symbol | undefined, parameterIndex: number) => {\n // Get existing injection tokens array or initialize if not present\n const injectionTokens: Map<number, any> = Reflect.getOwnMetadata(INJECT_TOKEN_METADATA_KEY, target) || new Map<number, any>();\n\n // Store the token at the specific parameter index\n injectionTokens.set(parameterIndex, token);\n\n // Define the metadata on the target (class constructor)\n Reflect.defineMetadata(INJECT_TOKEN_METADATA_KEY, injectionTokens, target);\n };\n}\n"],"mappings":"AACA,OAAO;AACP,SAAS,iCAAiC;AAOnC,SAAS,OAAO,OAAgC;AACnD,SAAO,CAAC,QAAgB,aAA0C,mBAA2B;AAEzF,UAAM,kBAAoC,QAAQ,eAAe,2BAA2B,MAAM,KAAK,oBAAI,IAAiB;AAG5H,oBAAgB,IAAI,gBAAgB,KAAK;AAGzC,YAAQ,eAAe,2BAA2B,iBAAiB,MAAM;AAAA,EAC7E;AACJ;","names":[]}
|
|
@@ -0,0 +1,35 @@
|
|
|
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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var decorators_exports = {};
|
|
21
|
+
__export(decorators_exports, {
|
|
22
|
+
Component: () => import_Component.Component,
|
|
23
|
+
Inject: () => import_Inject.Inject
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(decorators_exports);
|
|
26
|
+
var import_Component = require("./Component.cjs");
|
|
27
|
+
var import_Inject = require("./Inject.cjs");
|
|
28
|
+
__reExport(decorators_exports, require("./metadataKeys.cjs"), module.exports);
|
|
29
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
+
0 && (module.exports = {
|
|
31
|
+
Component,
|
|
32
|
+
Inject,
|
|
33
|
+
...require("./metadataKeys.cjs")
|
|
34
|
+
});
|
|
35
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../framework/decorators/index.ts"],"sourcesContent":["// Export decorators\nexport { Component } from './Component';\nexport { Inject } from './Inject';\nexport * from './metadataKeys';\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,uBAA0B;AAC1B,oBAAuB;AACvB,+BAAc,2BAHd;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../framework/decorators/index.ts"],"sourcesContent":["// Export decorators\nexport { Component } from './Component';\nexport { Inject } from './Inject';\nexport * from './metadataKeys';\n"],"mappings":"AACA,SAAS,iBAAiB;AAC1B,SAAS,cAAc;AACvB,cAAc;","names":[]}
|
|
@@ -0,0 +1,35 @@
|
|
|
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 metadataKeys_exports = {};
|
|
20
|
+
__export(metadataKeys_exports, {
|
|
21
|
+
COMPONENT_OPTIONS_METADATA_KEY: () => COMPONENT_OPTIONS_METADATA_KEY,
|
|
22
|
+
INJECT_TOKEN_METADATA_KEY: () => INJECT_TOKEN_METADATA_KEY,
|
|
23
|
+
PARAM_TYPES_METADATA_KEY: () => PARAM_TYPES_METADATA_KEY
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(metadataKeys_exports);
|
|
26
|
+
const COMPONENT_OPTIONS_METADATA_KEY = Symbol.for("ioc:component:options");
|
|
27
|
+
const PARAM_TYPES_METADATA_KEY = "design:paramtypes";
|
|
28
|
+
const INJECT_TOKEN_METADATA_KEY = Symbol.for("ioc:inject:tokens");
|
|
29
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
+
0 && (module.exports = {
|
|
31
|
+
COMPONENT_OPTIONS_METADATA_KEY,
|
|
32
|
+
INJECT_TOKEN_METADATA_KEY,
|
|
33
|
+
PARAM_TYPES_METADATA_KEY
|
|
34
|
+
});
|
|
35
|
+
//# sourceMappingURL=metadataKeys.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../framework/decorators/metadataKeys.ts"],"sourcesContent":["// framework/decorators/metadataKeys.ts\nexport const COMPONENT_OPTIONS_METADATA_KEY = Symbol.for(\"ioc:component:options\");\nexport const PARAM_TYPES_METADATA_KEY = \"design:paramtypes\"; // Standard key\nexport const INJECT_TOKEN_METADATA_KEY = Symbol.for(\"ioc:inject:tokens\");"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACO,MAAM,iCAAiC,OAAO,IAAI,uBAAuB;AACzE,MAAM,2BAA2B;AACjC,MAAM,4BAA4B,OAAO,IAAI,mBAAmB;","names":[]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
declare const COMPONENT_OPTIONS_METADATA_KEY: unique symbol;
|
|
2
|
+
declare const PARAM_TYPES_METADATA_KEY = "design:paramtypes";
|
|
3
|
+
declare const INJECT_TOKEN_METADATA_KEY: unique symbol;
|
|
4
|
+
|
|
5
|
+
export { COMPONENT_OPTIONS_METADATA_KEY, INJECT_TOKEN_METADATA_KEY, PARAM_TYPES_METADATA_KEY };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
declare const COMPONENT_OPTIONS_METADATA_KEY: unique symbol;
|
|
2
|
+
declare const PARAM_TYPES_METADATA_KEY = "design:paramtypes";
|
|
3
|
+
declare const INJECT_TOKEN_METADATA_KEY: unique symbol;
|
|
4
|
+
|
|
5
|
+
export { COMPONENT_OPTIONS_METADATA_KEY, INJECT_TOKEN_METADATA_KEY, PARAM_TYPES_METADATA_KEY };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const COMPONENT_OPTIONS_METADATA_KEY = Symbol.for("ioc:component:options");
|
|
2
|
+
const PARAM_TYPES_METADATA_KEY = "design:paramtypes";
|
|
3
|
+
const INJECT_TOKEN_METADATA_KEY = Symbol.for("ioc:inject:tokens");
|
|
4
|
+
export {
|
|
5
|
+
COMPONENT_OPTIONS_METADATA_KEY,
|
|
6
|
+
INJECT_TOKEN_METADATA_KEY,
|
|
7
|
+
PARAM_TYPES_METADATA_KEY
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=metadataKeys.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../framework/decorators/metadataKeys.ts"],"sourcesContent":["// framework/decorators/metadataKeys.ts\nexport const COMPONENT_OPTIONS_METADATA_KEY = Symbol.for(\"ioc:component:options\");\nexport const PARAM_TYPES_METADATA_KEY = \"design:paramtypes\"; // Standard key\nexport const INJECT_TOKEN_METADATA_KEY = Symbol.for(\"ioc:inject:tokens\");"],"mappings":"AACO,MAAM,iCAAiC,OAAO,IAAI,uBAAuB;AACzE,MAAM,2BAA2B;AACjC,MAAM,4BAA4B,OAAO,IAAI,mBAAmB;","names":[]}
|
|
@@ -0,0 +1,61 @@
|
|
|
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 ContainerErrors_exports = {};
|
|
20
|
+
__export(ContainerErrors_exports, {
|
|
21
|
+
CircularDependencyError: () => CircularDependencyError,
|
|
22
|
+
DependencyNotFoundError: () => DependencyNotFoundError,
|
|
23
|
+
InstanceNotCreatedError: () => InstanceNotCreatedError,
|
|
24
|
+
NotAClassDefinitionError: () => NotAClassDefinitionError,
|
|
25
|
+
ParameterNotFoundError: () => ParameterNotFoundError
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(ContainerErrors_exports);
|
|
28
|
+
class NotAClassDefinitionError extends Error {
|
|
29
|
+
constructor(message = "Not a class definition") {
|
|
30
|
+
super(message);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
class ParameterNotFoundError extends Error {
|
|
34
|
+
constructor(paramName = "parameter") {
|
|
35
|
+
super(`No value found for ${paramName}`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
class DependencyNotFoundError extends Error {
|
|
39
|
+
constructor(label) {
|
|
40
|
+
super(`Dependency not found: ${label}`);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
class InstanceNotCreatedError extends Error {
|
|
44
|
+
constructor() {
|
|
45
|
+
super("Instance has not been created and therefore cannot be retrieved");
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
class CircularDependencyError extends Error {
|
|
49
|
+
constructor(dependencyChain) {
|
|
50
|
+
super(`Circular dependency detected: ${dependencyChain.join(" -> ")}`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
54
|
+
0 && (module.exports = {
|
|
55
|
+
CircularDependencyError,
|
|
56
|
+
DependencyNotFoundError,
|
|
57
|
+
InstanceNotCreatedError,
|
|
58
|
+
NotAClassDefinitionError,
|
|
59
|
+
ParameterNotFoundError
|
|
60
|
+
});
|
|
61
|
+
//# sourceMappingURL=ContainerErrors.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../framework/errors/ContainerErrors.ts"],"sourcesContent":["/**\n * Error types for the IOC container\n */\n\n/**\n * Thrown when a class definition is expected but not provided\n */\nexport class NotAClassDefinitionError extends Error {\n constructor(message = \"Not a class definition\") {\n super(message);\n }\n}\n\n/**\n * Thrown when a parameter value is required but not provided\n */\nexport class ParameterNotFoundError extends Error {\n constructor(paramName = \"parameter\") {\n super(`No value found for ${paramName}`);\n }\n}\n\n/**\n * Thrown when trying to resolve a dependency that is not registered\n */\nexport class DependencyNotFoundError extends Error {\n constructor(label: any) {\n super(`Dependency not found: ${label}`);\n }\n}\n\n/**\n * Thrown when an instance has not been created but is being retrieved\n */\nexport class InstanceNotCreatedError extends Error {\n constructor() {\n super(\"Instance has not been created and therefore cannot be retrieved\");\n }\n}\n\n/**\n * Thrown when circular dependencies are detected\n */\nexport class CircularDependencyError extends Error {\n constructor(dependencyChain: string[]) {\n super(`Circular dependency detected: ${dependencyChain.join(' -> ')}`);\n }\n}"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOO,MAAM,iCAAiC,MAAM;AAAA,EAChD,YAAY,UAAU,0BAA0B;AAC5C,UAAM,OAAO;AAAA,EACjB;AACJ;AAKO,MAAM,+BAA+B,MAAM;AAAA,EAC9C,YAAY,YAAY,aAAa;AACjC,UAAM,sBAAsB,SAAS,EAAE;AAAA,EAC3C;AACJ;AAKO,MAAM,gCAAgC,MAAM;AAAA,EAC/C,YAAY,OAAY;AACpB,UAAM,yBAAyB,KAAK,EAAE;AAAA,EAC1C;AACJ;AAKO,MAAM,gCAAgC,MAAM;AAAA,EAC/C,cAAc;AACV,UAAM,iEAAiE;AAAA,EAC3E;AACJ;AAKO,MAAM,gCAAgC,MAAM;AAAA,EAC/C,YAAY,iBAA2B;AACnC,UAAM,iCAAiC,gBAAgB,KAAK,MAAM,CAAC,EAAE;AAAA,EACzE;AACJ;","names":[]}
|
package/dist/{cjs/framework/errors/ContainerErrors.d.ts → framework/errors/ContainerErrors.d.cts}
RENAMED
|
@@ -4,30 +4,32 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* Thrown when a class definition is expected but not provided
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
declare class NotAClassDefinitionError extends Error {
|
|
8
8
|
constructor(message?: string);
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
11
|
* Thrown when a parameter value is required but not provided
|
|
12
12
|
*/
|
|
13
|
-
|
|
13
|
+
declare class ParameterNotFoundError extends Error {
|
|
14
14
|
constructor(paramName?: string);
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
17
|
* Thrown when trying to resolve a dependency that is not registered
|
|
18
18
|
*/
|
|
19
|
-
|
|
19
|
+
declare class DependencyNotFoundError extends Error {
|
|
20
20
|
constructor(label: any);
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
23
|
* Thrown when an instance has not been created but is being retrieved
|
|
24
24
|
*/
|
|
25
|
-
|
|
25
|
+
declare class InstanceNotCreatedError extends Error {
|
|
26
26
|
constructor();
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
29
|
* Thrown when circular dependencies are detected
|
|
30
30
|
*/
|
|
31
|
-
|
|
31
|
+
declare class CircularDependencyError extends Error {
|
|
32
32
|
constructor(dependencyChain: string[]);
|
|
33
33
|
}
|
|
34
|
+
|
|
35
|
+
export { CircularDependencyError, DependencyNotFoundError, InstanceNotCreatedError, NotAClassDefinitionError, ParameterNotFoundError };
|
|
@@ -4,30 +4,32 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* Thrown when a class definition is expected but not provided
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
declare class NotAClassDefinitionError extends Error {
|
|
8
8
|
constructor(message?: string);
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
11
|
* Thrown when a parameter value is required but not provided
|
|
12
12
|
*/
|
|
13
|
-
|
|
13
|
+
declare class ParameterNotFoundError extends Error {
|
|
14
14
|
constructor(paramName?: string);
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
17
|
* Thrown when trying to resolve a dependency that is not registered
|
|
18
18
|
*/
|
|
19
|
-
|
|
19
|
+
declare class DependencyNotFoundError extends Error {
|
|
20
20
|
constructor(label: any);
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
23
|
* Thrown when an instance has not been created but is being retrieved
|
|
24
24
|
*/
|
|
25
|
-
|
|
25
|
+
declare class InstanceNotCreatedError extends Error {
|
|
26
26
|
constructor();
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
29
|
* Thrown when circular dependencies are detected
|
|
30
30
|
*/
|
|
31
|
-
|
|
31
|
+
declare class CircularDependencyError extends Error {
|
|
32
32
|
constructor(dependencyChain: string[]);
|
|
33
33
|
}
|
|
34
|
+
|
|
35
|
+
export { CircularDependencyError, DependencyNotFoundError, InstanceNotCreatedError, NotAClassDefinitionError, ParameterNotFoundError };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
class NotAClassDefinitionError extends Error {
|
|
2
|
+
constructor(message = "Not a class definition") {
|
|
3
|
+
super(message);
|
|
4
|
+
}
|
|
5
|
+
}
|
|
6
|
+
class ParameterNotFoundError extends Error {
|
|
7
|
+
constructor(paramName = "parameter") {
|
|
8
|
+
super(`No value found for ${paramName}`);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
class DependencyNotFoundError extends Error {
|
|
12
|
+
constructor(label) {
|
|
13
|
+
super(`Dependency not found: ${label}`);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
class InstanceNotCreatedError extends Error {
|
|
17
|
+
constructor() {
|
|
18
|
+
super("Instance has not been created and therefore cannot be retrieved");
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
class CircularDependencyError extends Error {
|
|
22
|
+
constructor(dependencyChain) {
|
|
23
|
+
super(`Circular dependency detected: ${dependencyChain.join(" -> ")}`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export {
|
|
27
|
+
CircularDependencyError,
|
|
28
|
+
DependencyNotFoundError,
|
|
29
|
+
InstanceNotCreatedError,
|
|
30
|
+
NotAClassDefinitionError,
|
|
31
|
+
ParameterNotFoundError
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=ContainerErrors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../framework/errors/ContainerErrors.ts"],"sourcesContent":["/**\n * Error types for the IOC container\n */\n\n/**\n * Thrown when a class definition is expected but not provided\n */\nexport class NotAClassDefinitionError extends Error {\n constructor(message = \"Not a class definition\") {\n super(message);\n }\n}\n\n/**\n * Thrown when a parameter value is required but not provided\n */\nexport class ParameterNotFoundError extends Error {\n constructor(paramName = \"parameter\") {\n super(`No value found for ${paramName}`);\n }\n}\n\n/**\n * Thrown when trying to resolve a dependency that is not registered\n */\nexport class DependencyNotFoundError extends Error {\n constructor(label: any) {\n super(`Dependency not found: ${label}`);\n }\n}\n\n/**\n * Thrown when an instance has not been created but is being retrieved\n */\nexport class InstanceNotCreatedError extends Error {\n constructor() {\n super(\"Instance has not been created and therefore cannot be retrieved\");\n }\n}\n\n/**\n * Thrown when circular dependencies are detected\n */\nexport class CircularDependencyError extends Error {\n constructor(dependencyChain: string[]) {\n super(`Circular dependency detected: ${dependencyChain.join(' -> ')}`);\n }\n}"],"mappings":"AAOO,MAAM,iCAAiC,MAAM;AAAA,EAChD,YAAY,UAAU,0BAA0B;AAC5C,UAAM,OAAO;AAAA,EACjB;AACJ;AAKO,MAAM,+BAA+B,MAAM;AAAA,EAC9C,YAAY,YAAY,aAAa;AACjC,UAAM,sBAAsB,SAAS,EAAE;AAAA,EAC3C;AACJ;AAKO,MAAM,gCAAgC,MAAM;AAAA,EAC/C,YAAY,OAAY;AACpB,UAAM,yBAAyB,KAAK,EAAE;AAAA,EAC1C;AACJ;AAKO,MAAM,gCAAgC,MAAM;AAAA,EAC/C,cAAc;AACV,UAAM,iEAAiE;AAAA,EAC3E;AACJ;AAKO,MAAM,gCAAgC,MAAM;AAAA,EAC/C,YAAY,iBAA2B;AACnC,UAAM,iCAAiC,gBAAgB,KAAK,MAAM,CAAC,EAAE;AAAA,EACzE;AACJ;","names":[]}
|