@decohere/crucible 0.0.1-dev.38 → 0.0.1-dev.4
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/package.json +3 -3
- package/{es6/src → src}/decorators/inject.decorator.js +2 -2
- package/src/services/crucible.js +133 -0
- package/tests/container.spec.js +259 -0
- package/commonjs/src/const.js +0 -33
- package/commonjs/src/decorators/index.js +0 -21
- package/commonjs/src/decorators/inject.decorator.js +0 -27
- package/commonjs/src/decorators/injectable.dectorator.js +0 -16
- package/commonjs/src/index.js +0 -22
- package/commonjs/src/models/registration-key.model.js +0 -31
- package/commonjs/src/models/service-registration.model.js +0 -30
- package/commonjs/src/services/crucible-builder.js +0 -68
- package/commonjs/src/services/crucible.js +0 -165
- package/commonjs/src/services/index.js +0 -21
- package/commonjs/src/services/service-registry.js +0 -50
- package/commonjs/src/types/errors.js +0 -29
- package/commonjs/src/types/index.js +0 -20
- package/commonjs/src/types/types.js +0 -6
- package/es6/src/services/crucible.js +0 -155
- package/types/src/const.d.ts +0 -9
- package/types/src/decorators/index.d.ts +0 -2
- package/types/src/decorators/inject.decorator.d.ts +0 -5
- package/types/src/decorators/injectable.dectorator.d.ts +0 -1
- package/types/src/index.d.ts +0 -3
- package/types/src/models/registration-key.model.d.ts +0 -7
- package/types/src/models/service-registration.model.d.ts +0 -11
- package/types/src/services/crucible-builder.d.ts +0 -26
- package/types/src/services/crucible.d.ts +0 -31
- package/types/src/services/index.d.ts +0 -2
- package/types/src/services/service-registry.d.ts +0 -16
- package/types/src/types/errors.d.ts +0 -6
- package/types/src/types/index.d.ts +0 -1
- package/types/src/types/types.d.ts +0 -1
- /package/{es6/src → src}/const.js +0 -0
- /package/{es6/src → src}/decorators/index.js +0 -0
- /package/{es6/src → src}/decorators/injectable.dectorator.js +0 -0
- /package/{es6/src → src}/index.js +0 -0
- /package/{es6/src → src}/models/registration-key.model.js +0 -0
- /package/{es6/src → src}/models/service-registration.model.js +0 -0
- /package/{es6/src → src}/services/crucible-builder.js +0 -0
- /package/{es6/src → src}/services/index.js +0 -0
- /package/{es6/src → src}/services/service-registry.js +0 -0
- /package/{es6/src → src}/types/errors.js +0 -0
- /package/{es6/src → src}/types/index.js +0 -0
- /package/{es6/src → src}/types/types.js +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function injectable(): ClassDecorator;
|
package/types/src/index.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Constructable, FunctionType } from "@decohere/nexus/reflection";
|
|
2
|
-
import type { Scope } from "../types/types.js";
|
|
3
|
-
import type { RegistrationKey } from "./registration-key.model.js";
|
|
4
|
-
export declare class ServiceRegistration {
|
|
5
|
-
key: RegistrationKey;
|
|
6
|
-
scope: Scope;
|
|
7
|
-
type: Constructable | FunctionType | object;
|
|
8
|
-
isInstance: boolean;
|
|
9
|
-
constructor(key: RegistrationKey, type: Constructable | FunctionType | object, scope: Scope, isInstance: boolean);
|
|
10
|
-
isEqual(other: ServiceRegistration): boolean;
|
|
11
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { Constructable, FunctionType } from "@decohere/nexus/reflection";
|
|
2
|
-
import type { ServiceRegistration } from "../models/service-registration.model.js";
|
|
3
|
-
import type { ContainerBuilder, Scope } from "../types/types.js";
|
|
4
|
-
import { Crucible } from "./crucible.js";
|
|
5
|
-
import { ServiceRegistry } from "./service-registry.js";
|
|
6
|
-
type ContainerBuilderOptions = {
|
|
7
|
-
serviceRegistry: ServiceRegistry;
|
|
8
|
-
};
|
|
9
|
-
export declare class CrucibleBuilder implements ContainerBuilder {
|
|
10
|
-
private serviceRegistry;
|
|
11
|
-
constructor(options?: ContainerBuilderOptions);
|
|
12
|
-
registerType(type: Constructable, scope?: Scope): ServiceRegistration;
|
|
13
|
-
registerTypes(...types: Constructable[]): ServiceRegistration[];
|
|
14
|
-
registerTypes(scope: Scope, ...types: Constructable[]): ServiceRegistration[];
|
|
15
|
-
registerTransient(key: string | symbol, type: Constructable | FunctionType): ServiceRegistration;
|
|
16
|
-
registerTransient(type: Constructable): ServiceRegistration;
|
|
17
|
-
registerSingleton(key: string | symbol | Constructable | object, instance: object): ServiceRegistration;
|
|
18
|
-
registerSingleton(key: string | symbol, type: Constructable): ServiceRegistration;
|
|
19
|
-
registerSingleton(type: Constructable): ServiceRegistration;
|
|
20
|
-
registerRequestScoped<T>(type: () => T): ServiceRegistration;
|
|
21
|
-
registerRequestScoped<T>(key: string | symbol, type: () => T): ServiceRegistration;
|
|
22
|
-
registerRequestScoped(key: string | symbol, type: Constructable): ServiceRegistration;
|
|
23
|
-
registerRequestScoped(type: Constructable): ServiceRegistration;
|
|
24
|
-
build(): Crucible;
|
|
25
|
-
}
|
|
26
|
-
export {};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { IContainer, ResolveRequest } from "../types/types.js";
|
|
2
|
-
import { ServiceRegistry } from "./service-registry.js";
|
|
3
|
-
type CrucibleOptions = {
|
|
4
|
-
key?: string;
|
|
5
|
-
rootScope?: Crucible;
|
|
6
|
-
serviceRegistry: ServiceRegistry;
|
|
7
|
-
};
|
|
8
|
-
export declare class Crucible implements IContainer {
|
|
9
|
-
key: string;
|
|
10
|
-
protected instances: Map<unknown, object>;
|
|
11
|
-
private serviceRegistry;
|
|
12
|
-
private rootScope;
|
|
13
|
-
private scopes;
|
|
14
|
-
private logger;
|
|
15
|
-
private isDisposed;
|
|
16
|
-
constructor(options?: CrucibleOptions);
|
|
17
|
-
resolveMany<T extends object = object>(resolveRequest: ResolveRequest<T>): T[];
|
|
18
|
-
resolve<T extends object | object[]>(resolveRequest: ResolveRequest<T>): T;
|
|
19
|
-
beginScope(name?: string): Crucible;
|
|
20
|
-
[Symbol.dispose](): void;
|
|
21
|
-
[Symbol.asyncDispose](): Promise<void>;
|
|
22
|
-
private disposeSync;
|
|
23
|
-
private disposeAsync;
|
|
24
|
-
private getRegistrationFrom;
|
|
25
|
-
private resolveRegistration;
|
|
26
|
-
private getOrCreateInstance;
|
|
27
|
-
private createInstance;
|
|
28
|
-
private resolveDependencies;
|
|
29
|
-
private registerLifetimeScope;
|
|
30
|
-
}
|
|
31
|
-
export {};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { Constructable, FunctionType } from "@decohere/nexus/reflection";
|
|
2
|
-
import { ServiceRegistration } from "../models/service-registration.model.js";
|
|
3
|
-
import type { Scope } from "../types/types.js";
|
|
4
|
-
export type RegisterTypeOptions = {
|
|
5
|
-
typeOrKey: string | symbol | Constructable | FunctionType;
|
|
6
|
-
typeOrInstance?: Constructable | FunctionType | object;
|
|
7
|
-
};
|
|
8
|
-
export declare class ServiceRegistry {
|
|
9
|
-
private readonly registrations;
|
|
10
|
-
constructor(parent?: ServiceRegistry);
|
|
11
|
-
registerType(scope: Scope, options: RegisterTypeOptions): ServiceRegistration;
|
|
12
|
-
getRegistration(key: string | symbol | Constructable): ServiceRegistration[];
|
|
13
|
-
private createRegistrationFrom;
|
|
14
|
-
private getRegistrations;
|
|
15
|
-
private setRegistration;
|
|
16
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./types.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type { ContainerBuilder, IContainer, LifetimeScope, ResolveRequest, Scope, ServiceProvider, } from "@decohere/nexus/composition";
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|