@noego/ioc 0.0.5 → 0.0.7
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/cjs/framework/decorators/Component.d.ts +10 -0
- package/dist/cjs/framework/decorators/Component.js +25 -0
- package/dist/cjs/framework/decorators/Component.js.map +1 -0
- package/dist/cjs/framework/decorators/Inject.d.ts +7 -0
- package/dist/cjs/framework/decorators/Inject.js +22 -0
- package/dist/cjs/framework/decorators/Inject.js.map +1 -0
- package/dist/cjs/framework/decorators/index.d.ts +3 -0
- package/dist/cjs/framework/decorators/index.js +24 -0
- package/dist/cjs/framework/decorators/index.js.map +1 -0
- package/dist/cjs/framework/decorators/metadataKeys.d.ts +3 -0
- package/dist/cjs/framework/decorators/metadataKeys.js +8 -0
- package/dist/cjs/framework/decorators/metadataKeys.js.map +1 -0
- package/dist/cjs/framework/errors/ContainerErrors.d.ts +33 -0
- package/dist/cjs/framework/errors/ContainerErrors.js +52 -0
- package/dist/cjs/framework/errors/ContainerErrors.js.map +1 -0
- package/dist/cjs/framework/implementation/Container.d.ts +31 -0
- package/dist/cjs/framework/implementation/Container.js +448 -0
- package/dist/cjs/framework/implementation/Container.js.map +1 -0
- package/dist/cjs/framework/implementation/Container.test.d.ts +1 -0
- package/dist/cjs/framework/implementation/Container.test.js +184 -0
- package/dist/cjs/framework/implementation/Container.test.js.map +1 -0
- package/dist/cjs/framework/implementation/ContainerAsync.test.d.ts +1 -0
- package/dist/cjs/framework/implementation/ContainerAsync.test.js +178 -0
- package/dist/cjs/framework/implementation/ContainerAsync.test.js.map +1 -0
- package/dist/cjs/framework/implementation/ContainerBasic.test.d.ts +1 -0
- package/dist/cjs/framework/implementation/ContainerBasic.test.js +101 -0
- package/dist/cjs/framework/implementation/ContainerBasic.test.js.map +1 -0
- package/dist/cjs/framework/implementation/ContainerDecorators.test.d.ts +1 -0
- package/dist/cjs/framework/implementation/ContainerDecorators.test.js +517 -0
- package/dist/cjs/framework/implementation/ContainerDecorators.test.js.map +1 -0
- package/dist/cjs/framework/implementation/ContainerExtension.test.d.ts +1 -0
- package/dist/cjs/framework/implementation/ContainerExtension.test.js +169 -0
- package/dist/cjs/framework/implementation/ContainerExtension.test.js.map +1 -0
- package/dist/cjs/framework/implementation/ContainerLifetimes.test.d.ts +1 -0
- package/dist/cjs/framework/implementation/ContainerLifetimes.test.js +154 -0
- package/dist/cjs/framework/implementation/ContainerLifetimes.test.js.map +1 -0
- package/dist/cjs/framework/implementation/DecoratorSupport.d.ts +31 -0
- package/dist/cjs/framework/implementation/DecoratorSupport.js +96 -0
- package/dist/cjs/framework/implementation/DecoratorSupport.js.map +1 -0
- package/dist/cjs/framework/implementation/LoadAs.d.ts +5 -0
- package/dist/cjs/framework/implementation/LoadAs.js +10 -0
- package/dist/cjs/framework/implementation/LoadAs.js.map +1 -0
- package/dist/cjs/framework/implementation/Parameter.d.ts +33 -0
- package/dist/cjs/framework/implementation/Parameter.js +87 -0
- package/dist/cjs/framework/implementation/Parameter.js.map +1 -0
- package/dist/cjs/framework/implementation/Parameter.test.d.ts +1 -0
- package/dist/cjs/framework/implementation/Parameter.test.js +19 -0
- package/dist/cjs/framework/implementation/Parameter.test.js.map +1 -0
- package/dist/cjs/framework/implementation/SimpleDecoratorTest.test.d.ts +1 -0
- package/dist/cjs/framework/implementation/SimpleDecoratorTest.test.js +78 -0
- package/dist/cjs/framework/implementation/SimpleDecoratorTest.test.js.map +1 -0
- package/dist/cjs/framework/implementation/SingletonTest.test.d.ts +1 -0
- package/dist/cjs/framework/implementation/SingletonTest.test.js +85 -0
- package/dist/cjs/framework/implementation/SingletonTest.test.js.map +1 -0
- package/dist/cjs/framework/interface/Container.d.ts +22 -0
- package/dist/cjs/framework/interface/Container.js +3 -0
- package/dist/cjs/framework/interface/Container.js.map +1 -0
- package/dist/esm/framework/decorators/Component.d.ts +10 -0
- package/dist/esm/framework/decorators/Component.js +21 -0
- package/dist/esm/framework/decorators/Component.js.map +1 -0
- package/dist/esm/framework/decorators/Inject.d.ts +7 -0
- package/dist/esm/framework/decorators/Inject.js +19 -0
- package/dist/esm/framework/decorators/Inject.js.map +1 -0
- package/dist/esm/framework/decorators/index.d.ts +3 -0
- package/dist/esm/framework/decorators/index.js +5 -0
- package/dist/esm/framework/decorators/index.js.map +1 -0
- package/dist/esm/framework/decorators/metadataKeys.d.ts +3 -0
- package/dist/esm/framework/decorators/metadataKeys.js +5 -0
- package/dist/esm/framework/decorators/metadataKeys.js.map +1 -0
- package/dist/esm/framework/errors/ContainerErrors.d.ts +33 -0
- package/dist/esm/framework/errors/ContainerErrors.js +44 -0
- package/dist/esm/framework/errors/ContainerErrors.js.map +1 -0
- package/dist/esm/framework/implementation/Container.d.ts +31 -0
- package/dist/esm/framework/implementation/Container.js +432 -0
- package/dist/esm/framework/implementation/Container.js.map +1 -0
- package/dist/esm/framework/implementation/Container.test.d.ts +1 -0
- package/dist/esm/framework/implementation/Container.test.js +173 -0
- package/dist/esm/framework/implementation/Container.test.js.map +1 -0
- package/dist/esm/framework/implementation/ContainerAsync.test.d.ts +1 -0
- package/dist/esm/framework/implementation/ContainerAsync.test.js +151 -0
- package/dist/esm/framework/implementation/ContainerAsync.test.js.map +1 -0
- package/dist/esm/framework/implementation/ContainerBasic.test.d.ts +1 -0
- package/dist/esm/framework/implementation/ContainerBasic.test.js +90 -0
- package/dist/esm/framework/implementation/ContainerBasic.test.js.map +1 -0
- package/dist/esm/framework/implementation/ContainerDecorators.test.d.ts +1 -0
- package/dist/esm/framework/implementation/ContainerDecorators.test.js +498 -0
- package/dist/esm/framework/implementation/ContainerDecorators.test.js.map +1 -0
- package/dist/esm/framework/implementation/ContainerExtension.test.d.ts +1 -0
- package/dist/esm/framework/implementation/ContainerExtension.test.js +158 -0
- package/dist/esm/framework/implementation/ContainerExtension.test.js.map +1 -0
- package/dist/esm/framework/implementation/ContainerLifetimes.test.d.ts +1 -0
- package/dist/esm/framework/implementation/ContainerLifetimes.test.js +143 -0
- package/dist/esm/framework/implementation/ContainerLifetimes.test.js.map +1 -0
- package/dist/esm/framework/implementation/DecoratorSupport.d.ts +31 -0
- package/dist/esm/framework/implementation/DecoratorSupport.js +87 -0
- package/dist/esm/framework/implementation/DecoratorSupport.js.map +1 -0
- package/dist/esm/framework/implementation/LoadAs.d.ts +5 -0
- package/dist/esm/framework/implementation/LoadAs.js +7 -0
- package/dist/esm/framework/implementation/LoadAs.js.map +1 -0
- package/dist/esm/framework/implementation/Parameter.d.ts +33 -0
- package/dist/esm/framework/implementation/Parameter.js +49 -0
- package/dist/esm/framework/implementation/Parameter.js.map +1 -0
- package/dist/esm/framework/implementation/Parameter.test.d.ts +1 -0
- package/dist/esm/framework/implementation/Parameter.test.js +17 -0
- package/dist/esm/framework/implementation/Parameter.test.js.map +1 -0
- package/dist/esm/framework/implementation/SimpleDecoratorTest.test.d.ts +1 -0
- package/dist/esm/framework/implementation/SimpleDecoratorTest.test.js +67 -0
- package/dist/esm/framework/implementation/SimpleDecoratorTest.test.js.map +1 -0
- package/dist/esm/framework/implementation/SingletonTest.test.d.ts +1 -0
- package/dist/esm/framework/implementation/SingletonTest.test.js +74 -0
- package/dist/esm/framework/implementation/SingletonTest.test.js.map +1 -0
- package/dist/esm/framework/interface/Container.d.ts +22 -0
- package/dist/esm/framework/interface/Container.js +2 -0
- package/dist/esm/framework/interface/Container.js.map +1 -0
- package/package.json +11 -1
- package/readme.md +9 -0
|
@@ -0,0 +1,10 @@
|
|
|
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;
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
/**
|
|
3
|
+
* Decorator to explicitly specify the token/identifier for a constructor parameter dependency.
|
|
4
|
+
* Necessary for interfaces or when multiple implementations exist for a type.
|
|
5
|
+
* @param token The identifier (Symbol, string, or class) to inject.
|
|
6
|
+
*/
|
|
7
|
+
export declare function Inject(token: any): ParameterDecorator;
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.INJECT_TOKEN_METADATA_KEY = exports.PARAM_TYPES_METADATA_KEY = exports.COMPONENT_OPTIONS_METADATA_KEY = void 0;
|
|
4
|
+
// framework/decorators/metadataKeys.ts
|
|
5
|
+
exports.COMPONENT_OPTIONS_METADATA_KEY = Symbol.for("ioc:component:options");
|
|
6
|
+
exports.PARAM_TYPES_METADATA_KEY = "design:paramtypes"; // Standard key
|
|
7
|
+
exports.INJECT_TOKEN_METADATA_KEY = Symbol.for("ioc:inject:tokens");
|
|
8
|
+
//# sourceMappingURL=metadataKeys.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metadataKeys.js","sourceRoot":"","sources":["../../../../framework/decorators/metadataKeys.ts"],"names":[],"mappings":";;;AAAA,uCAAuC;AAC1B,QAAA,8BAA8B,GAAG,MAAM,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;AACrE,QAAA,wBAAwB,GAAG,mBAAmB,CAAC,CAAC,eAAe;AAC/D,QAAA,yBAAyB,GAAG,MAAM,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error types for the IOC container
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Thrown when a class definition is expected but not provided
|
|
6
|
+
*/
|
|
7
|
+
export declare class NotAClassDefinitionError extends Error {
|
|
8
|
+
constructor(message?: string);
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Thrown when a parameter value is required but not provided
|
|
12
|
+
*/
|
|
13
|
+
export declare class ParameterNotFoundError extends Error {
|
|
14
|
+
constructor(paramName?: string);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Thrown when trying to resolve a dependency that is not registered
|
|
18
|
+
*/
|
|
19
|
+
export declare class DependencyNotFoundError extends Error {
|
|
20
|
+
constructor(label: any);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Thrown when an instance has not been created but is being retrieved
|
|
24
|
+
*/
|
|
25
|
+
export declare class InstanceNotCreatedError extends Error {
|
|
26
|
+
constructor();
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Thrown when circular dependencies are detected
|
|
30
|
+
*/
|
|
31
|
+
export declare class CircularDependencyError extends Error {
|
|
32
|
+
constructor(dependencyChain: string[]);
|
|
33
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Error types for the IOC container
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.CircularDependencyError = exports.InstanceNotCreatedError = exports.DependencyNotFoundError = exports.ParameterNotFoundError = exports.NotAClassDefinitionError = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Thrown when a class definition is expected but not provided
|
|
9
|
+
*/
|
|
10
|
+
class NotAClassDefinitionError extends Error {
|
|
11
|
+
constructor(message = "Not a class definition") {
|
|
12
|
+
super(message);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.NotAClassDefinitionError = NotAClassDefinitionError;
|
|
16
|
+
/**
|
|
17
|
+
* Thrown when a parameter value is required but not provided
|
|
18
|
+
*/
|
|
19
|
+
class ParameterNotFoundError extends Error {
|
|
20
|
+
constructor(paramName = "parameter") {
|
|
21
|
+
super(`No value found for ${paramName}`);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.ParameterNotFoundError = ParameterNotFoundError;
|
|
25
|
+
/**
|
|
26
|
+
* Thrown when trying to resolve a dependency that is not registered
|
|
27
|
+
*/
|
|
28
|
+
class DependencyNotFoundError extends Error {
|
|
29
|
+
constructor(label) {
|
|
30
|
+
super(`Dependency not found: ${label}`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.DependencyNotFoundError = DependencyNotFoundError;
|
|
34
|
+
/**
|
|
35
|
+
* Thrown when an instance has not been created but is being retrieved
|
|
36
|
+
*/
|
|
37
|
+
class InstanceNotCreatedError extends Error {
|
|
38
|
+
constructor() {
|
|
39
|
+
super("Instance has not been created and therefore cannot be retrieved");
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.InstanceNotCreatedError = InstanceNotCreatedError;
|
|
43
|
+
/**
|
|
44
|
+
* Thrown when circular dependencies are detected
|
|
45
|
+
*/
|
|
46
|
+
class CircularDependencyError extends Error {
|
|
47
|
+
constructor(dependencyChain) {
|
|
48
|
+
super(`Circular dependency detected: ${dependencyChain.join(' -> ')}`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.CircularDependencyError = CircularDependencyError;
|
|
52
|
+
//# sourceMappingURL=ContainerErrors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContainerErrors.js","sourceRoot":"","sources":["../../../../framework/errors/ContainerErrors.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH;;GAEG;AACH,MAAa,wBAAyB,SAAQ,KAAK;IAC/C,YAAY,OAAO,GAAG,wBAAwB;QAC1C,KAAK,CAAC,OAAO,CAAC,CAAC;IACnB,CAAC;CACJ;AAJD,4DAIC;AAED;;GAEG;AACH,MAAa,sBAAuB,SAAQ,KAAK;IAC7C,YAAY,SAAS,GAAG,WAAW;QAC/B,KAAK,CAAC,sBAAsB,SAAS,EAAE,CAAC,CAAC;IAC7C,CAAC;CACJ;AAJD,wDAIC;AAED;;GAEG;AACH,MAAa,uBAAwB,SAAQ,KAAK;IAC9C,YAAY,KAAU;QAClB,KAAK,CAAC,yBAAyB,KAAK,EAAE,CAAC,CAAC;IAC5C,CAAC;CACJ;AAJD,0DAIC;AAED;;GAEG;AACH,MAAa,uBAAwB,SAAQ,KAAK;IAC9C;QACI,KAAK,CAAC,iEAAiE,CAAC,CAAC;IAC7E,CAAC;CACJ;AAJD,0DAIC;AAED;;GAEG;AACH,MAAa,uBAAwB,SAAQ,KAAK;IAC9C,YAAY,eAAyB;QACjC,KAAK,CAAC,iCAAiC,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAC3E,CAAC;CACJ;AAJD,0DAIC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
import { ContainerOptions, IContainerClient, IContainerSetup } from "../interface/Container";
|
|
3
|
+
import { ParameterValue } from "./Parameter";
|
|
4
|
+
export declare class Container implements IContainerClient, IContainerSetup {
|
|
5
|
+
private _routing;
|
|
6
|
+
private _functionDefinition;
|
|
7
|
+
private _classDefinition;
|
|
8
|
+
private _functionStorageSingleton;
|
|
9
|
+
private _functionStorageScoped;
|
|
10
|
+
private _classStorageSingleton;
|
|
11
|
+
private _classStorageScoped;
|
|
12
|
+
registerClass<T>(classDefinition: new (...args: any[]) => T, options?: Partial<ContainerOptions>): void;
|
|
13
|
+
registerFunction<T extends (...arg: any[]) => any>(label: any, func: T, options?: Partial<ContainerOptions>): void;
|
|
14
|
+
instance<T, Args extends any[]>(classDefinition: new (...args: Args) => T, params?: ParameterValue<any>[]): Promise<T>;
|
|
15
|
+
get<T>(label: any, param?: ParameterValue<any>[]): Promise<T> | T;
|
|
16
|
+
extend(): IContainerClient & IContainerSetup;
|
|
17
|
+
private clearDefinitions;
|
|
18
|
+
private isRegisteredAsClass;
|
|
19
|
+
private isRegisteredAsFunction;
|
|
20
|
+
private hasInstance;
|
|
21
|
+
private isClassType;
|
|
22
|
+
private getInstance;
|
|
23
|
+
private setInstance;
|
|
24
|
+
private getStorageType;
|
|
25
|
+
protected loadInstance(label: any, params?: ParameterValue<any>[], resolutionChain?: string[]): Promise<any>;
|
|
26
|
+
private resolveParameterValue;
|
|
27
|
+
private loadClassInstance;
|
|
28
|
+
private loadFunctionInstance;
|
|
29
|
+
}
|
|
30
|
+
export declare function isPromise(obj: any): obj is Promise<any>;
|
|
31
|
+
export declare function createContainer(): IContainerClient & IContainerSetup;
|