@navios/di 0.1.0 → 0.1.2
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 +2 -2
- package/src/service-locator.mts +0 -4
- package/src/utils/get-injectors.mts +1 -1
- package/dist/_tsup-dts-rollup.d.mts +0 -536
- package/dist/_tsup-dts-rollup.d.ts +0 -536
- package/dist/index.d.mts +0 -54
- package/dist/index.d.ts +0 -54
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@navios/di",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "Oleksandr Hanzha",
|
|
6
6
|
"email": "alex@granted.name"
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"url": "https://github.com/Arilas/navios.git"
|
|
12
12
|
},
|
|
13
13
|
"license": "MIT",
|
|
14
|
-
"typings": "./dist/index.d.
|
|
14
|
+
"typings": "./dist/src/index.d.mts",
|
|
15
15
|
"main": "./dist/index.js",
|
|
16
16
|
"module": "./dist/index.mjs",
|
|
17
17
|
"peerDependencies": {
|
package/src/service-locator.mts
CHANGED
|
@@ -90,22 +90,18 @@ export class ServiceLocator {
|
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
public removeInstance<Instance>(
|
|
93
|
-
instance: Instance,
|
|
94
93
|
token: BoundInjectionToken<Instance, any>,
|
|
95
94
|
): void
|
|
96
95
|
public removeInstance<Instance>(
|
|
97
|
-
instance: Instance,
|
|
98
96
|
token: FactoryInjectionToken<Instance, any>,
|
|
99
97
|
): void
|
|
100
98
|
public removeInstance<Instance>(
|
|
101
|
-
instance: Instance,
|
|
102
99
|
token: InjectionToken<Instance, undefined>,
|
|
103
100
|
): void
|
|
104
101
|
public removeInstance<
|
|
105
102
|
Instance,
|
|
106
103
|
Schema extends AnyZodObject | ZodOptional<AnyZodObject>,
|
|
107
104
|
>(
|
|
108
|
-
instance: Instance,
|
|
109
105
|
token: InjectionToken<Instance, Schema>,
|
|
110
106
|
args: z.input<Schema>,
|
|
111
107
|
): void
|
|
@@ -35,7 +35,7 @@ export interface Injectors {
|
|
|
35
35
|
): T
|
|
36
36
|
syncInject<T, S extends ZodOptional<AnyZodObject>>(
|
|
37
37
|
token: InjectionToken<T, S>,
|
|
38
|
-
args
|
|
38
|
+
args?: z.input<S>,
|
|
39
39
|
): T
|
|
40
40
|
syncInject<T>(token: InjectionToken<T, undefined>): T
|
|
41
41
|
syncInject<T>(token: BoundInjectionToken<T, any>): T
|
|
@@ -1,536 +0,0 @@
|
|
|
1
|
-
import { AnyZodObject } from 'zod';
|
|
2
|
-
import { BoundInjectionToken as BoundInjectionToken_2 } from './injection-token.mjs';
|
|
3
|
-
import { ClassType as ClassType_2 } from './injection-token.mjs';
|
|
4
|
-
import { FactoryInjectionToken as FactoryInjectionToken_2 } from './injection-token.mjs';
|
|
5
|
-
import { InjectionToken as InjectionToken_2 } from './injection-token.mjs';
|
|
6
|
-
import { input } from 'zod';
|
|
7
|
-
import { z } from 'zod';
|
|
8
|
-
import { ZodOptional } from 'zod';
|
|
9
|
-
|
|
10
|
-
declare class BoundInjectionToken<T, S extends AnyZodObject | ZodOptional<AnyZodObject>> {
|
|
11
|
-
readonly token: InjectionToken<T, S>;
|
|
12
|
-
readonly value: z.input<S>;
|
|
13
|
-
id: string;
|
|
14
|
-
name: string | symbol | ClassType;
|
|
15
|
-
schema: AnyZodObject | ZodOptional<AnyZodObject>;
|
|
16
|
-
constructor(token: InjectionToken<T, S>, value: z.input<S>);
|
|
17
|
-
toString(): string;
|
|
18
|
-
}
|
|
19
|
-
export { BoundInjectionToken }
|
|
20
|
-
export { BoundInjectionToken as BoundInjectionToken_alias_1 }
|
|
21
|
-
|
|
22
|
-
declare type ChannelEmitter<Events extends EventsConfig, Ns extends string, E extends EventsNames<Events>> = {
|
|
23
|
-
emit<Args extends EventsArgs<Events, E>>(ns: Ns, event: E, ...args: Args): Promise<any>;
|
|
24
|
-
};
|
|
25
|
-
export { ChannelEmitter }
|
|
26
|
-
export { ChannelEmitter as ChannelEmitter_alias_1 }
|
|
27
|
-
|
|
28
|
-
declare type ClassType = new (...args: any[]) => any;
|
|
29
|
-
export { ClassType }
|
|
30
|
-
export { ClassType as ClassType_alias_1 }
|
|
31
|
-
|
|
32
|
-
declare type ClassTypeWithInstance<T> = new (...args: any[]) => T;
|
|
33
|
-
export { ClassTypeWithInstance }
|
|
34
|
-
export { ClassTypeWithInstance as ClassTypeWithInstance_alias_1 }
|
|
35
|
-
|
|
36
|
-
declare interface CreateInjectorsOptions {
|
|
37
|
-
baseLocator: ServiceLocator;
|
|
38
|
-
}
|
|
39
|
-
export { CreateInjectorsOptions }
|
|
40
|
-
export { CreateInjectorsOptions as CreateInjectorsOptions_alias_1 }
|
|
41
|
-
export { CreateInjectorsOptions as CreateInjectorsOptions_alias_2 }
|
|
42
|
-
|
|
43
|
-
declare enum ErrorsEnum {
|
|
44
|
-
InstanceExpired = "InstanceExpired",
|
|
45
|
-
InstanceNotFound = "InstanceNotFound",
|
|
46
|
-
InstanceDestroying = "InstanceDestroying",
|
|
47
|
-
UnknownError = "UnknownError",
|
|
48
|
-
FactoryNotFound = "FactoryNotFound",
|
|
49
|
-
FactoryTokenNotResolved = "FactoryTokenNotResolved"
|
|
50
|
-
}
|
|
51
|
-
export { ErrorsEnum }
|
|
52
|
-
export { ErrorsEnum as ErrorsEnum_alias_1 }
|
|
53
|
-
export { ErrorsEnum as ErrorsEnum_alias_2 }
|
|
54
|
-
|
|
55
|
-
declare class EventEmitter<Events extends EventsConfig = {}> implements EventEmitterInterface<Events> {
|
|
56
|
-
private listeners;
|
|
57
|
-
on<E extends EventsNames<Events>, Args extends EventsArgs<Events, E>>(event: E, listener: (...args: Args) => void): () => void;
|
|
58
|
-
off<E extends EventsNames<Events>, Args extends EventsArgs<Events, E>>(event: E, listener: (...args: Args) => void): void;
|
|
59
|
-
once<E extends EventsNames<Events>, Args extends EventsArgs<Events, E>>(event: E, listener: (...args: Args) => void): () => void;
|
|
60
|
-
emit<E extends EventsNames<Events>, Args extends EventsArgs<Events, E>>(event: E, ...args: Args): Promise<any>;
|
|
61
|
-
addChannel<E extends EventsNames<Events>, Ns extends string, Emitter extends ChannelEmitter<Events, Ns, E>>(ns: Ns, event: E, target: Emitter): () => void;
|
|
62
|
-
}
|
|
63
|
-
export { EventEmitter }
|
|
64
|
-
export { EventEmitter as EventEmitter_alias_1 }
|
|
65
|
-
|
|
66
|
-
declare interface EventEmitterInterface<Events extends EventsConfig> {
|
|
67
|
-
on<E extends EventsNames<Events>, Args extends EventsArgs<Events, E>>(event: E, listener: (...args: Args) => void): () => void;
|
|
68
|
-
emit<E extends EventsNames<Events>, Args extends EventsArgs<Events, E>>(event: E, ...args: Args): void;
|
|
69
|
-
addChannel<E extends EventsNames<Events>, Ns extends string, Emmiter extends ChannelEmitter<Events, Ns, E>>(ns: Ns, event: E, target: Emmiter): () => void;
|
|
70
|
-
}
|
|
71
|
-
export { EventEmitterInterface }
|
|
72
|
-
export { EventEmitterInterface as EventEmitterInterface_alias_1 }
|
|
73
|
-
|
|
74
|
-
declare type EventsArgs<Events extends EventsConfig, Name extends EventsNames<Events>> = Events[Name] extends any[] ? Events[Name] : [];
|
|
75
|
-
export { EventsArgs }
|
|
76
|
-
export { EventsArgs as EventsArgs_alias_1 }
|
|
77
|
-
|
|
78
|
-
declare type EventsConfig = {
|
|
79
|
-
[event: string]: any[];
|
|
80
|
-
};
|
|
81
|
-
export { EventsConfig }
|
|
82
|
-
export { EventsConfig as EventsConfig_alias_1 }
|
|
83
|
-
|
|
84
|
-
declare type EventsNames<Events extends EventsConfig> = Exclude<keyof Events, symbol | number>;
|
|
85
|
-
export { EventsNames }
|
|
86
|
-
export { EventsNames as EventsNames_alias_1 }
|
|
87
|
-
|
|
88
|
-
declare interface Factory<T> {
|
|
89
|
-
create(ctx?: any): Promise<T> | T;
|
|
90
|
-
}
|
|
91
|
-
export { Factory }
|
|
92
|
-
export { Factory as Factory_alias_1 }
|
|
93
|
-
export { Factory as Factory_alias_2 }
|
|
94
|
-
|
|
95
|
-
declare interface FactoryContext {
|
|
96
|
-
inject: Injectors['inject'];
|
|
97
|
-
on: ServiceLocatorEventBus['on'];
|
|
98
|
-
getDependencies: () => string[];
|
|
99
|
-
invalidate: () => void;
|
|
100
|
-
addEffect: (listener: () => void) => void;
|
|
101
|
-
getDestroyListeners: () => (() => void)[];
|
|
102
|
-
setTtl: (ttl: number) => void;
|
|
103
|
-
getTtl: () => number;
|
|
104
|
-
locator: ServiceLocator;
|
|
105
|
-
}
|
|
106
|
-
export { FactoryContext }
|
|
107
|
-
export { FactoryContext as FactoryContext_alias_1 }
|
|
108
|
-
|
|
109
|
-
declare class FactoryInjectionToken<T, S extends AnyZodObject | ZodOptional<AnyZodObject>> {
|
|
110
|
-
readonly token: InjectionToken<T, S>;
|
|
111
|
-
readonly factory: () => Promise<z.input<S>>;
|
|
112
|
-
value?: z.input<S>;
|
|
113
|
-
resolved: boolean;
|
|
114
|
-
id: string;
|
|
115
|
-
name: string | symbol | ClassType;
|
|
116
|
-
schema: AnyZodObject | ZodOptional<AnyZodObject>;
|
|
117
|
-
constructor(token: InjectionToken<T, S>, factory: () => Promise<z.input<S>>);
|
|
118
|
-
resolve(): Promise<z.input<S>>;
|
|
119
|
-
toString(): string;
|
|
120
|
-
}
|
|
121
|
-
export { FactoryInjectionToken }
|
|
122
|
-
export { FactoryInjectionToken as FactoryInjectionToken_alias_1 }
|
|
123
|
-
|
|
124
|
-
declare class FactoryNotFound extends Error {
|
|
125
|
-
name: string;
|
|
126
|
-
code: ErrorsEnum;
|
|
127
|
-
constructor(name: string);
|
|
128
|
-
}
|
|
129
|
-
export { FactoryNotFound }
|
|
130
|
-
export { FactoryNotFound as FactoryNotFound_alias_1 }
|
|
131
|
-
export { FactoryNotFound as FactoryNotFound_alias_2 }
|
|
132
|
-
|
|
133
|
-
declare type FactoryRecord<Instance = any, Schema = any> = {
|
|
134
|
-
scope: InjectableScope;
|
|
135
|
-
originalToken: InjectionToken<Instance, Schema>;
|
|
136
|
-
factory: InjectionFactory<Instance, Schema extends AnyZodObject ? z.input<Schema> : unknown>;
|
|
137
|
-
};
|
|
138
|
-
export { FactoryRecord }
|
|
139
|
-
export { FactoryRecord as FactoryRecord_alias_1 }
|
|
140
|
-
|
|
141
|
-
declare class FactoryTokenNotResolved extends Error {
|
|
142
|
-
code: ErrorsEnum;
|
|
143
|
-
constructor(name: string | symbol | ClassType);
|
|
144
|
-
}
|
|
145
|
-
export { FactoryTokenNotResolved }
|
|
146
|
-
export { FactoryTokenNotResolved as FactoryTokenNotResolved_alias_1 }
|
|
147
|
-
export { FactoryTokenNotResolved as FactoryTokenNotResolved_alias_2 }
|
|
148
|
-
|
|
149
|
-
declare interface FactoryWithArgs<T, A extends AnyZodObject> {
|
|
150
|
-
create(ctx: any, args: z.output<A>): Promise<T> | T;
|
|
151
|
-
}
|
|
152
|
-
export { FactoryWithArgs }
|
|
153
|
-
export { FactoryWithArgs as FactoryWithArgs_alias_1 }
|
|
154
|
-
export { FactoryWithArgs as FactoryWithArgs_alias_2 }
|
|
155
|
-
|
|
156
|
-
declare function getGlobalServiceLocator(): ServiceLocator;
|
|
157
|
-
export { getGlobalServiceLocator }
|
|
158
|
-
export { getGlobalServiceLocator as getGlobalServiceLocator_alias_1 }
|
|
159
|
-
|
|
160
|
-
declare function getInjectableToken<R>(target: ClassType): R extends {
|
|
161
|
-
create(...args: any[]): infer V;
|
|
162
|
-
} ? InjectionToken<V> : InjectionToken<R>;
|
|
163
|
-
export { getInjectableToken }
|
|
164
|
-
export { getInjectableToken as getInjectableToken_alias_1 }
|
|
165
|
-
export { getInjectableToken as getInjectableToken_alias_2 }
|
|
166
|
-
|
|
167
|
-
declare function getInjectors({ baseLocator }: CreateInjectorsOptions): Injectors;
|
|
168
|
-
export { getInjectors }
|
|
169
|
-
export { getInjectors as getInjectors_alias_1 }
|
|
170
|
-
export { getInjectors as getInjectors_alias_2 }
|
|
171
|
-
|
|
172
|
-
declare const globalRegistry: Registry;
|
|
173
|
-
export { globalRegistry }
|
|
174
|
-
export { globalRegistry as globalRegistry_alias_1 }
|
|
175
|
-
|
|
176
|
-
declare const inject: {
|
|
177
|
-
<T extends ClassType_2>(token: T): Promise<InstanceType<T>>;
|
|
178
|
-
<T, S extends AnyZodObject>(token: InjectionToken_2<T, S>, args: input<S>): Promise<T>;
|
|
179
|
-
<T, S extends ZodOptional<AnyZodObject>>(token: InjectionToken_2<T, S>, args?: input<S>): Promise<T>;
|
|
180
|
-
<T>(token: InjectionToken_2<T, undefined>): Promise<T>;
|
|
181
|
-
<T>(token: BoundInjectionToken_2<T, any>): Promise<T>;
|
|
182
|
-
<T>(token: FactoryInjectionToken_2<T, any>): Promise<T>;
|
|
183
|
-
};
|
|
184
|
-
export { inject }
|
|
185
|
-
export { inject as inject_alias_1 }
|
|
186
|
-
|
|
187
|
-
declare function Injectable(): <T extends ClassType>(target: T, context: ClassDecoratorContext) => T & {
|
|
188
|
-
[InjectableTokenMeta]: InjectionToken<InstanceType<T>, undefined>;
|
|
189
|
-
};
|
|
190
|
-
|
|
191
|
-
declare function Injectable<T extends ClassType>(options: {
|
|
192
|
-
scope?: InjectableScope;
|
|
193
|
-
token: InjectionToken<T, undefined>;
|
|
194
|
-
}): (target: T, context: ClassDecoratorContext) => T & {
|
|
195
|
-
[InjectableTokenMeta]: InjectionToken<InstanceType<T>, undefined>;
|
|
196
|
-
};
|
|
197
|
-
|
|
198
|
-
declare function Injectable<R>(options: {
|
|
199
|
-
scope?: InjectableScope;
|
|
200
|
-
type: InjectableType.Factory;
|
|
201
|
-
}): <T extends ClassTypeWithInstance<Factory<R>>>(target: T, context: ClassDecoratorContext) => T & {
|
|
202
|
-
[InjectableTokenMeta]: InjectionToken<R, undefined>;
|
|
203
|
-
};
|
|
204
|
-
|
|
205
|
-
declare function Injectable<R, S extends AnyZodObject>(options: {
|
|
206
|
-
scope?: InjectableScope;
|
|
207
|
-
type: InjectableType.Factory;
|
|
208
|
-
token: InjectionToken<R, S>;
|
|
209
|
-
}): <T extends ClassTypeWithInstance<FactoryWithArgs<R, S>>>(target: T, context: ClassDecoratorContext) => T & {
|
|
210
|
-
[InjectableTokenMeta]: InjectionToken<R, S>;
|
|
211
|
-
};
|
|
212
|
-
|
|
213
|
-
declare function Injectable<R>(options: {
|
|
214
|
-
scope?: InjectableScope;
|
|
215
|
-
type: InjectableType.Factory;
|
|
216
|
-
token: InjectionToken<R, undefined>;
|
|
217
|
-
}): <T extends ClassTypeWithInstance<Factory<R>>>(target: T, context: ClassDecoratorContext) => T & {
|
|
218
|
-
[InjectableTokenMeta]: InjectionToken<R, undefined>;
|
|
219
|
-
};
|
|
220
|
-
export { Injectable }
|
|
221
|
-
export { Injectable as Injectable_alias_1 }
|
|
222
|
-
export { Injectable as Injectable_alias_2 }
|
|
223
|
-
|
|
224
|
-
declare interface InjectableOptions {
|
|
225
|
-
scope?: InjectableScope;
|
|
226
|
-
type?: InjectableType;
|
|
227
|
-
token?: InjectionToken<any, any>;
|
|
228
|
-
registry?: Registry;
|
|
229
|
-
}
|
|
230
|
-
export { InjectableOptions }
|
|
231
|
-
export { InjectableOptions as InjectableOptions_alias_1 }
|
|
232
|
-
export { InjectableOptions as InjectableOptions_alias_2 }
|
|
233
|
-
|
|
234
|
-
declare enum InjectableScope {
|
|
235
|
-
/**
|
|
236
|
-
* Singleton scope: The instance is created once and shared across the application.
|
|
237
|
-
*/
|
|
238
|
-
Singleton = "Singleton",
|
|
239
|
-
/**
|
|
240
|
-
* Instance scope: A new instance is created for each injection.
|
|
241
|
-
*/
|
|
242
|
-
Instance = "Instance"
|
|
243
|
-
}
|
|
244
|
-
export { InjectableScope }
|
|
245
|
-
export { InjectableScope as InjectableScope_alias_1 }
|
|
246
|
-
export { InjectableScope as InjectableScope_alias_2 }
|
|
247
|
-
|
|
248
|
-
declare const InjectableTokenMeta: unique symbol;
|
|
249
|
-
export { InjectableTokenMeta }
|
|
250
|
-
export { InjectableTokenMeta as InjectableTokenMeta_alias_1 }
|
|
251
|
-
export { InjectableTokenMeta as InjectableTokenMeta_alias_2 }
|
|
252
|
-
|
|
253
|
-
declare enum InjectableType {
|
|
254
|
-
Class = "Class",
|
|
255
|
-
Factory = "Factory"
|
|
256
|
-
}
|
|
257
|
-
export { InjectableType }
|
|
258
|
-
export { InjectableType as InjectableType_alias_1 }
|
|
259
|
-
export { InjectableType as InjectableType_alias_2 }
|
|
260
|
-
|
|
261
|
-
declare type InjectionFactory<T = unknown, Args = unknown> = (ctx: FactoryContext, args: Args) => Promise<T>;
|
|
262
|
-
export { InjectionFactory }
|
|
263
|
-
export { InjectionFactory as InjectionFactory_alias_1 }
|
|
264
|
-
|
|
265
|
-
declare class InjectionToken<T, S extends AnyZodObject | ZodOptional<AnyZodObject> | unknown = unknown> {
|
|
266
|
-
readonly name: string | symbol | ClassType;
|
|
267
|
-
readonly schema: AnyZodObject | undefined;
|
|
268
|
-
id: `${string}-${string}-${string}-${string}-${string}`;
|
|
269
|
-
private formattedName;
|
|
270
|
-
constructor(name: string | symbol | ClassType, schema: AnyZodObject | undefined);
|
|
271
|
-
static create<T extends ClassType>(name: T): InjectionToken<InstanceType<T>, undefined>;
|
|
272
|
-
static create<T extends ClassType, Schema extends AnyZodObject | ZodOptional<AnyZodObject>>(name: T, schema: Schema): InjectionToken<InstanceType<T>, Schema>;
|
|
273
|
-
static create<T>(name: string | symbol): InjectionToken<T, undefined>;
|
|
274
|
-
static create<T, Schema extends AnyZodObject | ZodOptional<AnyZodObject>>(name: string | any, schema: Schema): InjectionToken<T, Schema>;
|
|
275
|
-
static bound<T, S extends AnyZodObject | ZodOptional<AnyZodObject>>(token: InjectionToken<T, S>, value: z.input<S>): BoundInjectionToken<T, S>;
|
|
276
|
-
static factory<T, S extends AnyZodObject | ZodOptional<AnyZodObject>>(token: InjectionToken<T, S>, factory: () => Promise<z.input<S>>): FactoryInjectionToken<T, S>;
|
|
277
|
-
static refineType<T>(token: BoundInjectionToken<any, any>): BoundInjectionToken<T, any>;
|
|
278
|
-
toString(): string;
|
|
279
|
-
}
|
|
280
|
-
export { InjectionToken }
|
|
281
|
-
export { InjectionToken as InjectionToken_alias_1 }
|
|
282
|
-
|
|
283
|
-
declare interface Injectors {
|
|
284
|
-
inject<T extends ClassType>(token: T): Promise<InstanceType<T>>;
|
|
285
|
-
inject<T, S extends AnyZodObject>(token: InjectionToken<T, S>, args: z.input<S>): Promise<T>;
|
|
286
|
-
inject<T, S extends ZodOptional<AnyZodObject>>(token: InjectionToken<T, S>, args?: z.input<S>): Promise<T>;
|
|
287
|
-
inject<T>(token: InjectionToken<T, undefined>): Promise<T>;
|
|
288
|
-
inject<T>(token: BoundInjectionToken<T, any>): Promise<T>;
|
|
289
|
-
inject<T>(token: FactoryInjectionToken<T, any>): Promise<T>;
|
|
290
|
-
syncInject<T extends ClassType>(token: T): InstanceType<T>;
|
|
291
|
-
syncInject<T, S extends AnyZodObject>(token: InjectionToken<T, S>, args: z.input<S>): T;
|
|
292
|
-
syncInject<T, S extends ZodOptional<AnyZodObject>>(token: InjectionToken<T, S>, args: z.input<S>): T;
|
|
293
|
-
syncInject<T>(token: InjectionToken<T, undefined>): T;
|
|
294
|
-
syncInject<T>(token: BoundInjectionToken<T, any>): T;
|
|
295
|
-
syncInject<T>(token: FactoryInjectionToken<T, any>): T;
|
|
296
|
-
wrapSyncInit(cb: () => any): () => [any, Promise<any>[]];
|
|
297
|
-
provideServiceLocator(locator: ServiceLocator): ServiceLocator;
|
|
298
|
-
}
|
|
299
|
-
export { Injectors }
|
|
300
|
-
export { Injectors as Injectors_alias_1 }
|
|
301
|
-
export { Injectors as Injectors_alias_2 }
|
|
302
|
-
|
|
303
|
-
declare const InjectorsBase: Map<ServiceLocator, Injectors>;
|
|
304
|
-
export { InjectorsBase }
|
|
305
|
-
export { InjectorsBase as InjectorsBase_alias_1 }
|
|
306
|
-
export { InjectorsBase as InjectorsBase_alias_2 }
|
|
307
|
-
|
|
308
|
-
declare class InstanceDestroying extends Error {
|
|
309
|
-
name: string;
|
|
310
|
-
code: ErrorsEnum;
|
|
311
|
-
constructor(name: string);
|
|
312
|
-
}
|
|
313
|
-
export { InstanceDestroying }
|
|
314
|
-
export { InstanceDestroying as InstanceDestroying_alias_1 }
|
|
315
|
-
export { InstanceDestroying as InstanceDestroying_alias_2 }
|
|
316
|
-
|
|
317
|
-
declare class InstanceExpired extends Error {
|
|
318
|
-
name: string;
|
|
319
|
-
code: ErrorsEnum;
|
|
320
|
-
constructor(name: string);
|
|
321
|
-
}
|
|
322
|
-
export { InstanceExpired }
|
|
323
|
-
export { InstanceExpired as InstanceExpired_alias_1 }
|
|
324
|
-
export { InstanceExpired as InstanceExpired_alias_2 }
|
|
325
|
-
|
|
326
|
-
declare class InstanceNotFound extends Error {
|
|
327
|
-
name: string;
|
|
328
|
-
code: ErrorsEnum;
|
|
329
|
-
constructor(name: string);
|
|
330
|
-
}
|
|
331
|
-
export { InstanceNotFound }
|
|
332
|
-
export { InstanceNotFound as InstanceNotFound_alias_1 }
|
|
333
|
-
export { InstanceNotFound as InstanceNotFound_alias_2 }
|
|
334
|
-
|
|
335
|
-
declare function makeProxyServiceLocator(serviceLocator: ServiceLocator, ctx: FactoryContext): ServiceLocator;
|
|
336
|
-
export { makeProxyServiceLocator }
|
|
337
|
-
export { makeProxyServiceLocator as makeProxyServiceLocator_alias_1 }
|
|
338
|
-
|
|
339
|
-
declare const provideServiceLocator: (locator: ServiceLocator) => ServiceLocator;
|
|
340
|
-
export { provideServiceLocator }
|
|
341
|
-
export { provideServiceLocator as provideServiceLocator_alias_1 }
|
|
342
|
-
|
|
343
|
-
declare class ProxyServiceLocator implements ServiceLocator {
|
|
344
|
-
private readonly serviceLocator;
|
|
345
|
-
private readonly ctx;
|
|
346
|
-
constructor(serviceLocator: ServiceLocator, ctx: FactoryContext);
|
|
347
|
-
getEventBus(): ServiceLocatorEventBus;
|
|
348
|
-
getInstance(token: InjectionToken<any, any> | BoundInjectionToken<any, any> | FactoryInjectionToken<any, any>, args?: any): Promise<any[]>;
|
|
349
|
-
getOrThrowInstance<Instance, Schema extends AnyZodObject | ZodOptional<AnyZodObject> | undefined>(token: InjectionToken<Instance, Schema>, args: Schema extends AnyZodObject ? z.input<Schema> : Schema extends ZodOptional<AnyZodObject> ? z.input<Schema> | undefined : undefined): Promise<Instance>;
|
|
350
|
-
getSyncInstance<Instance, Schema extends AnyZodObject | ZodOptional<AnyZodObject> | undefined>(token: InjectionToken<Instance, Schema>, args: Schema extends AnyZodObject ? z.input<Schema> : Schema extends ZodOptional<AnyZodObject> ? z.input<Schema> | undefined : undefined): Instance | null;
|
|
351
|
-
invalidate(service: string, round?: number): Promise<any>;
|
|
352
|
-
ready(): Promise<null>;
|
|
353
|
-
makeInstanceName(token: InjectionToken<any, any>, args: any): string;
|
|
354
|
-
}
|
|
355
|
-
export { ProxyServiceLocator }
|
|
356
|
-
export { ProxyServiceLocator as ProxyServiceLocator_alias_1 }
|
|
357
|
-
|
|
358
|
-
declare class Registry {
|
|
359
|
-
private readonly parent?;
|
|
360
|
-
private readonly factories;
|
|
361
|
-
constructor(parent?: Registry | undefined);
|
|
362
|
-
has(token: InjectionToken<any, any>): boolean;
|
|
363
|
-
get<Instance, Schema>(token: InjectionToken<Instance, Schema>): FactoryRecord<Instance, Schema>;
|
|
364
|
-
set<Instance, Schema>(token: InjectionToken<Instance, Schema>, factory: InjectionFactory, scope: InjectableScope): void;
|
|
365
|
-
delete(token: InjectionToken<any, any>): void;
|
|
366
|
-
}
|
|
367
|
-
export { Registry }
|
|
368
|
-
export { Registry as Registry_alias_1 }
|
|
369
|
-
|
|
370
|
-
declare function resolveService<T extends ClassType>(ctx: FactoryContext, target: T, args?: any[]): Promise<InstanceType<T>>;
|
|
371
|
-
export { resolveService }
|
|
372
|
-
export { resolveService as resolveService_alias_1 }
|
|
373
|
-
|
|
374
|
-
declare class ServiceLocator {
|
|
375
|
-
private readonly registry;
|
|
376
|
-
private readonly logger;
|
|
377
|
-
private readonly eventBus;
|
|
378
|
-
private readonly manager;
|
|
379
|
-
constructor(registry?: Registry, logger?: Console | null);
|
|
380
|
-
getEventBus(): ServiceLocatorEventBus;
|
|
381
|
-
storeInstance<Instance>(instance: Instance, token: BoundInjectionToken<Instance, any>): void;
|
|
382
|
-
storeInstance<Instance>(instance: Instance, token: FactoryInjectionToken<Instance, any>): void;
|
|
383
|
-
storeInstance<Instance>(instance: Instance, token: InjectionToken<Instance, undefined>): void;
|
|
384
|
-
storeInstance<Instance, Schema extends AnyZodObject | ZodOptional<AnyZodObject>>(instance: Instance, token: InjectionToken<Instance, Schema>, args: z.input<Schema>): void;
|
|
385
|
-
removeInstance<Instance>(instance: Instance, token: BoundInjectionToken<Instance, any>): void;
|
|
386
|
-
removeInstance<Instance>(instance: Instance, token: FactoryInjectionToken<Instance, any>): void;
|
|
387
|
-
removeInstance<Instance>(instance: Instance, token: InjectionToken<Instance, undefined>): void;
|
|
388
|
-
removeInstance<Instance, Schema extends AnyZodObject | ZodOptional<AnyZodObject>>(instance: Instance, token: InjectionToken<Instance, Schema>, args: z.input<Schema>): void;
|
|
389
|
-
private resolveTokenArgs;
|
|
390
|
-
getInstanceIdentifier<Instance, Schema extends AnyZodObject>(token: InjectionToken<Instance, Schema>, args: z.input<Schema>): string;
|
|
391
|
-
getInstanceIdentifier<Instance, Schema extends ZodOptional<AnyZodObject>>(token: InjectionToken<Instance, Schema>, args?: z.input<Schema>): string;
|
|
392
|
-
getInstanceIdentifier<Instance>(token: InjectionToken<Instance, undefined>): string;
|
|
393
|
-
getInstanceIdentifier<Instance>(token: BoundInjectionToken<Instance, any>): string;
|
|
394
|
-
getInstanceIdentifier<Instance>(token: FactoryInjectionToken<Instance, any>): string;
|
|
395
|
-
getInstance<Instance, Schema extends AnyZodObject>(token: InjectionToken<Instance, Schema>, args: z.input<Schema>): Promise<[undefined, Instance] | [UnknownError | FactoryNotFound]>;
|
|
396
|
-
getInstance<Instance, Schema extends ZodOptional<AnyZodObject>>(token: InjectionToken<Instance, Schema>, args?: z.input<Schema>): Promise<[undefined, Instance] | [UnknownError | FactoryNotFound]>;
|
|
397
|
-
getInstance<Instance>(token: InjectionToken<Instance, undefined>): Promise<[undefined, Instance] | [UnknownError | FactoryNotFound]>;
|
|
398
|
-
getInstance<Instance>(token: BoundInjectionToken<Instance, any>): Promise<[undefined, Instance] | [UnknownError | FactoryNotFound]>;
|
|
399
|
-
getInstance<Instance>(token: FactoryInjectionToken<Instance, any>): Promise<[undefined, Instance] | [UnknownError | FactoryNotFound]>;
|
|
400
|
-
getOrThrowInstance<Instance, Schema extends AnyZodObject | ZodOptional<AnyZodObject> | undefined>(token: InjectionToken<Instance, Schema>, args: Schema extends AnyZodObject ? z.input<Schema> : Schema extends ZodOptional<AnyZodObject> ? z.input<Schema> | undefined : undefined): Promise<Instance>;
|
|
401
|
-
private notifyListeners;
|
|
402
|
-
private createInstance;
|
|
403
|
-
private resolveInstance;
|
|
404
|
-
private createFactoryContext;
|
|
405
|
-
getSyncInstance<Instance, Schema extends AnyZodObject | ZodOptional<AnyZodObject> | undefined>(token: InjectionToken<Instance, Schema>, args: Schema extends AnyZodObject ? z.input<Schema> : Schema extends ZodOptional<AnyZodObject> ? z.input<Schema> | undefined : undefined): Instance | null;
|
|
406
|
-
invalidate(service: string, round?: number): Promise<any>;
|
|
407
|
-
ready(): Promise<null>;
|
|
408
|
-
makeInstanceName(token: InjectionToken<any, any> | BoundInjectionToken<any, any> | FactoryInjectionToken<any, any>, args: any): string;
|
|
409
|
-
}
|
|
410
|
-
export { ServiceLocator }
|
|
411
|
-
export { ServiceLocator as ServiceLocator_alias_1 }
|
|
412
|
-
|
|
413
|
-
declare class ServiceLocatorEventBus {
|
|
414
|
-
private readonly logger;
|
|
415
|
-
private listeners;
|
|
416
|
-
constructor(logger?: Console | null);
|
|
417
|
-
on<Event extends string | `pre:${string}` | `post:${string}`>(ns: string, event: Event, listener: (event: Event) => void): () => void;
|
|
418
|
-
emit(key: string, event: string): Promise<PromiseSettledResult<any>[] | undefined>;
|
|
419
|
-
}
|
|
420
|
-
export { ServiceLocatorEventBus }
|
|
421
|
-
export { ServiceLocatorEventBus as ServiceLocatorEventBus_alias_1 }
|
|
422
|
-
|
|
423
|
-
declare type ServiceLocatorInstanceDestroyListener = () => void | Promise<void>;
|
|
424
|
-
export { ServiceLocatorInstanceDestroyListener }
|
|
425
|
-
export { ServiceLocatorInstanceDestroyListener as ServiceLocatorInstanceDestroyListener_alias_1 }
|
|
426
|
-
|
|
427
|
-
declare type ServiceLocatorInstanceEffect = () => void;
|
|
428
|
-
export { ServiceLocatorInstanceEffect }
|
|
429
|
-
export { ServiceLocatorInstanceEffect as ServiceLocatorInstanceEffect_alias_1 }
|
|
430
|
-
|
|
431
|
-
declare type ServiceLocatorInstanceHolder<Instance = unknown> = ServiceLocatorInstanceHolderCreating<Instance> | ServiceLocatorInstanceHolderCreated<Instance> | ServiceLocatorInstanceHolderDestroying<Instance>;
|
|
432
|
-
export { ServiceLocatorInstanceHolder }
|
|
433
|
-
export { ServiceLocatorInstanceHolder as ServiceLocatorInstanceHolder_alias_1 }
|
|
434
|
-
|
|
435
|
-
declare interface ServiceLocatorInstanceHolderCreated<Instance> {
|
|
436
|
-
status: ServiceLocatorInstanceHolderStatus.Created;
|
|
437
|
-
name: string;
|
|
438
|
-
instance: Instance;
|
|
439
|
-
creationPromise: null;
|
|
440
|
-
destroyPromise: null;
|
|
441
|
-
kind: ServiceLocatorInstanceHolderKind;
|
|
442
|
-
effects: ServiceLocatorInstanceEffect[];
|
|
443
|
-
deps: string[];
|
|
444
|
-
destroyListeners: ServiceLocatorInstanceDestroyListener[];
|
|
445
|
-
createdAt: number;
|
|
446
|
-
ttl: number;
|
|
447
|
-
}
|
|
448
|
-
export { ServiceLocatorInstanceHolderCreated }
|
|
449
|
-
export { ServiceLocatorInstanceHolderCreated as ServiceLocatorInstanceHolderCreated_alias_1 }
|
|
450
|
-
|
|
451
|
-
declare interface ServiceLocatorInstanceHolderCreating<Instance> {
|
|
452
|
-
status: ServiceLocatorInstanceHolderStatus.Creating;
|
|
453
|
-
name: string;
|
|
454
|
-
instance: null;
|
|
455
|
-
creationPromise: Promise<[undefined, Instance]> | null;
|
|
456
|
-
destroyPromise: null;
|
|
457
|
-
kind: ServiceLocatorInstanceHolderKind;
|
|
458
|
-
effects: ServiceLocatorInstanceEffect[];
|
|
459
|
-
deps: string[];
|
|
460
|
-
destroyListeners: ServiceLocatorInstanceDestroyListener[];
|
|
461
|
-
createdAt: number;
|
|
462
|
-
ttl: number;
|
|
463
|
-
}
|
|
464
|
-
export { ServiceLocatorInstanceHolderCreating }
|
|
465
|
-
export { ServiceLocatorInstanceHolderCreating as ServiceLocatorInstanceHolderCreating_alias_1 }
|
|
466
|
-
|
|
467
|
-
declare interface ServiceLocatorInstanceHolderDestroying<Instance> {
|
|
468
|
-
status: ServiceLocatorInstanceHolderStatus.Destroying;
|
|
469
|
-
name: string;
|
|
470
|
-
instance: Instance | null;
|
|
471
|
-
creationPromise: null;
|
|
472
|
-
destroyPromise: Promise<void>;
|
|
473
|
-
kind: ServiceLocatorInstanceHolderKind;
|
|
474
|
-
effects: ServiceLocatorInstanceEffect[];
|
|
475
|
-
deps: string[];
|
|
476
|
-
destroyListeners: ServiceLocatorInstanceDestroyListener[];
|
|
477
|
-
createdAt: number;
|
|
478
|
-
ttl: number;
|
|
479
|
-
}
|
|
480
|
-
export { ServiceLocatorInstanceHolderDestroying }
|
|
481
|
-
export { ServiceLocatorInstanceHolderDestroying as ServiceLocatorInstanceHolderDestroying_alias_1 }
|
|
482
|
-
|
|
483
|
-
declare enum ServiceLocatorInstanceHolderKind {
|
|
484
|
-
Instance = "instance",
|
|
485
|
-
Factory = "factory",
|
|
486
|
-
AbstractFactory = "abstractFactory"
|
|
487
|
-
}
|
|
488
|
-
export { ServiceLocatorInstanceHolderKind }
|
|
489
|
-
export { ServiceLocatorInstanceHolderKind as ServiceLocatorInstanceHolderKind_alias_1 }
|
|
490
|
-
|
|
491
|
-
declare enum ServiceLocatorInstanceHolderStatus {
|
|
492
|
-
Created = "created",
|
|
493
|
-
Creating = "creating",
|
|
494
|
-
Destroying = "destroying"
|
|
495
|
-
}
|
|
496
|
-
export { ServiceLocatorInstanceHolderStatus }
|
|
497
|
-
export { ServiceLocatorInstanceHolderStatus as ServiceLocatorInstanceHolderStatus_alias_1 }
|
|
498
|
-
|
|
499
|
-
declare class ServiceLocatorManager {
|
|
500
|
-
private readonly logger;
|
|
501
|
-
private readonly instancesHolders;
|
|
502
|
-
constructor(logger?: Console | null);
|
|
503
|
-
get(name: string): [InstanceExpired | InstanceDestroying, ServiceLocatorInstanceHolder] | [InstanceNotFound] | [undefined, ServiceLocatorInstanceHolder];
|
|
504
|
-
set(name: string, holder: ServiceLocatorInstanceHolder): void;
|
|
505
|
-
has(name: string): [InstanceExpired | InstanceDestroying] | [undefined, boolean];
|
|
506
|
-
delete(name: string): boolean;
|
|
507
|
-
filter(predicate: (value: ServiceLocatorInstanceHolder<any>, key: string) => boolean): Map<string, ServiceLocatorInstanceHolder>;
|
|
508
|
-
}
|
|
509
|
-
export { ServiceLocatorManager }
|
|
510
|
-
export { ServiceLocatorManager as ServiceLocatorManager_alias_1 }
|
|
511
|
-
|
|
512
|
-
declare const syncInject: {
|
|
513
|
-
<T extends ClassType_2>(token: T): InstanceType<T>;
|
|
514
|
-
<T, S extends AnyZodObject>(token: InjectionToken_2<T, S>, args: input<S>): T;
|
|
515
|
-
<T, S extends ZodOptional<AnyZodObject>>(token: InjectionToken_2<T, S>, args: input<S>): T;
|
|
516
|
-
<T>(token: InjectionToken_2<T, undefined>): T;
|
|
517
|
-
<T>(token: BoundInjectionToken_2<T, any>): T;
|
|
518
|
-
<T>(token: FactoryInjectionToken_2<T, any>): T;
|
|
519
|
-
};
|
|
520
|
-
export { syncInject }
|
|
521
|
-
export { syncInject as syncInject_alias_1 }
|
|
522
|
-
|
|
523
|
-
declare class UnknownError extends Error {
|
|
524
|
-
code: ErrorsEnum;
|
|
525
|
-
parent?: Error;
|
|
526
|
-
constructor(message: string | Error);
|
|
527
|
-
}
|
|
528
|
-
export { UnknownError }
|
|
529
|
-
export { UnknownError as UnknownError_alias_1 }
|
|
530
|
-
export { UnknownError as UnknownError_alias_2 }
|
|
531
|
-
|
|
532
|
-
declare const wrapSyncInit: (cb: () => any) => () => [any, Promise<any>[]];
|
|
533
|
-
export { wrapSyncInit }
|
|
534
|
-
export { wrapSyncInit as wrapSyncInit_alias_1 }
|
|
535
|
-
|
|
536
|
-
export { }
|
|
@@ -1,536 +0,0 @@
|
|
|
1
|
-
import { AnyZodObject } from 'zod';
|
|
2
|
-
import { BoundInjectionToken as BoundInjectionToken_2 } from './injection-token.mjs';
|
|
3
|
-
import { ClassType as ClassType_2 } from './injection-token.mjs';
|
|
4
|
-
import { FactoryInjectionToken as FactoryInjectionToken_2 } from './injection-token.mjs';
|
|
5
|
-
import { InjectionToken as InjectionToken_2 } from './injection-token.mjs';
|
|
6
|
-
import { input } from 'zod';
|
|
7
|
-
import { z } from 'zod';
|
|
8
|
-
import { ZodOptional } from 'zod';
|
|
9
|
-
|
|
10
|
-
declare class BoundInjectionToken<T, S extends AnyZodObject | ZodOptional<AnyZodObject>> {
|
|
11
|
-
readonly token: InjectionToken<T, S>;
|
|
12
|
-
readonly value: z.input<S>;
|
|
13
|
-
id: string;
|
|
14
|
-
name: string | symbol | ClassType;
|
|
15
|
-
schema: AnyZodObject | ZodOptional<AnyZodObject>;
|
|
16
|
-
constructor(token: InjectionToken<T, S>, value: z.input<S>);
|
|
17
|
-
toString(): string;
|
|
18
|
-
}
|
|
19
|
-
export { BoundInjectionToken }
|
|
20
|
-
export { BoundInjectionToken as BoundInjectionToken_alias_1 }
|
|
21
|
-
|
|
22
|
-
declare type ChannelEmitter<Events extends EventsConfig, Ns extends string, E extends EventsNames<Events>> = {
|
|
23
|
-
emit<Args extends EventsArgs<Events, E>>(ns: Ns, event: E, ...args: Args): Promise<any>;
|
|
24
|
-
};
|
|
25
|
-
export { ChannelEmitter }
|
|
26
|
-
export { ChannelEmitter as ChannelEmitter_alias_1 }
|
|
27
|
-
|
|
28
|
-
declare type ClassType = new (...args: any[]) => any;
|
|
29
|
-
export { ClassType }
|
|
30
|
-
export { ClassType as ClassType_alias_1 }
|
|
31
|
-
|
|
32
|
-
declare type ClassTypeWithInstance<T> = new (...args: any[]) => T;
|
|
33
|
-
export { ClassTypeWithInstance }
|
|
34
|
-
export { ClassTypeWithInstance as ClassTypeWithInstance_alias_1 }
|
|
35
|
-
|
|
36
|
-
declare interface CreateInjectorsOptions {
|
|
37
|
-
baseLocator: ServiceLocator;
|
|
38
|
-
}
|
|
39
|
-
export { CreateInjectorsOptions }
|
|
40
|
-
export { CreateInjectorsOptions as CreateInjectorsOptions_alias_1 }
|
|
41
|
-
export { CreateInjectorsOptions as CreateInjectorsOptions_alias_2 }
|
|
42
|
-
|
|
43
|
-
declare enum ErrorsEnum {
|
|
44
|
-
InstanceExpired = "InstanceExpired",
|
|
45
|
-
InstanceNotFound = "InstanceNotFound",
|
|
46
|
-
InstanceDestroying = "InstanceDestroying",
|
|
47
|
-
UnknownError = "UnknownError",
|
|
48
|
-
FactoryNotFound = "FactoryNotFound",
|
|
49
|
-
FactoryTokenNotResolved = "FactoryTokenNotResolved"
|
|
50
|
-
}
|
|
51
|
-
export { ErrorsEnum }
|
|
52
|
-
export { ErrorsEnum as ErrorsEnum_alias_1 }
|
|
53
|
-
export { ErrorsEnum as ErrorsEnum_alias_2 }
|
|
54
|
-
|
|
55
|
-
declare class EventEmitter<Events extends EventsConfig = {}> implements EventEmitterInterface<Events> {
|
|
56
|
-
private listeners;
|
|
57
|
-
on<E extends EventsNames<Events>, Args extends EventsArgs<Events, E>>(event: E, listener: (...args: Args) => void): () => void;
|
|
58
|
-
off<E extends EventsNames<Events>, Args extends EventsArgs<Events, E>>(event: E, listener: (...args: Args) => void): void;
|
|
59
|
-
once<E extends EventsNames<Events>, Args extends EventsArgs<Events, E>>(event: E, listener: (...args: Args) => void): () => void;
|
|
60
|
-
emit<E extends EventsNames<Events>, Args extends EventsArgs<Events, E>>(event: E, ...args: Args): Promise<any>;
|
|
61
|
-
addChannel<E extends EventsNames<Events>, Ns extends string, Emitter extends ChannelEmitter<Events, Ns, E>>(ns: Ns, event: E, target: Emitter): () => void;
|
|
62
|
-
}
|
|
63
|
-
export { EventEmitter }
|
|
64
|
-
export { EventEmitter as EventEmitter_alias_1 }
|
|
65
|
-
|
|
66
|
-
declare interface EventEmitterInterface<Events extends EventsConfig> {
|
|
67
|
-
on<E extends EventsNames<Events>, Args extends EventsArgs<Events, E>>(event: E, listener: (...args: Args) => void): () => void;
|
|
68
|
-
emit<E extends EventsNames<Events>, Args extends EventsArgs<Events, E>>(event: E, ...args: Args): void;
|
|
69
|
-
addChannel<E extends EventsNames<Events>, Ns extends string, Emmiter extends ChannelEmitter<Events, Ns, E>>(ns: Ns, event: E, target: Emmiter): () => void;
|
|
70
|
-
}
|
|
71
|
-
export { EventEmitterInterface }
|
|
72
|
-
export { EventEmitterInterface as EventEmitterInterface_alias_1 }
|
|
73
|
-
|
|
74
|
-
declare type EventsArgs<Events extends EventsConfig, Name extends EventsNames<Events>> = Events[Name] extends any[] ? Events[Name] : [];
|
|
75
|
-
export { EventsArgs }
|
|
76
|
-
export { EventsArgs as EventsArgs_alias_1 }
|
|
77
|
-
|
|
78
|
-
declare type EventsConfig = {
|
|
79
|
-
[event: string]: any[];
|
|
80
|
-
};
|
|
81
|
-
export { EventsConfig }
|
|
82
|
-
export { EventsConfig as EventsConfig_alias_1 }
|
|
83
|
-
|
|
84
|
-
declare type EventsNames<Events extends EventsConfig> = Exclude<keyof Events, symbol | number>;
|
|
85
|
-
export { EventsNames }
|
|
86
|
-
export { EventsNames as EventsNames_alias_1 }
|
|
87
|
-
|
|
88
|
-
declare interface Factory<T> {
|
|
89
|
-
create(ctx?: any): Promise<T> | T;
|
|
90
|
-
}
|
|
91
|
-
export { Factory }
|
|
92
|
-
export { Factory as Factory_alias_1 }
|
|
93
|
-
export { Factory as Factory_alias_2 }
|
|
94
|
-
|
|
95
|
-
declare interface FactoryContext {
|
|
96
|
-
inject: Injectors['inject'];
|
|
97
|
-
on: ServiceLocatorEventBus['on'];
|
|
98
|
-
getDependencies: () => string[];
|
|
99
|
-
invalidate: () => void;
|
|
100
|
-
addEffect: (listener: () => void) => void;
|
|
101
|
-
getDestroyListeners: () => (() => void)[];
|
|
102
|
-
setTtl: (ttl: number) => void;
|
|
103
|
-
getTtl: () => number;
|
|
104
|
-
locator: ServiceLocator;
|
|
105
|
-
}
|
|
106
|
-
export { FactoryContext }
|
|
107
|
-
export { FactoryContext as FactoryContext_alias_1 }
|
|
108
|
-
|
|
109
|
-
declare class FactoryInjectionToken<T, S extends AnyZodObject | ZodOptional<AnyZodObject>> {
|
|
110
|
-
readonly token: InjectionToken<T, S>;
|
|
111
|
-
readonly factory: () => Promise<z.input<S>>;
|
|
112
|
-
value?: z.input<S>;
|
|
113
|
-
resolved: boolean;
|
|
114
|
-
id: string;
|
|
115
|
-
name: string | symbol | ClassType;
|
|
116
|
-
schema: AnyZodObject | ZodOptional<AnyZodObject>;
|
|
117
|
-
constructor(token: InjectionToken<T, S>, factory: () => Promise<z.input<S>>);
|
|
118
|
-
resolve(): Promise<z.input<S>>;
|
|
119
|
-
toString(): string;
|
|
120
|
-
}
|
|
121
|
-
export { FactoryInjectionToken }
|
|
122
|
-
export { FactoryInjectionToken as FactoryInjectionToken_alias_1 }
|
|
123
|
-
|
|
124
|
-
declare class FactoryNotFound extends Error {
|
|
125
|
-
name: string;
|
|
126
|
-
code: ErrorsEnum;
|
|
127
|
-
constructor(name: string);
|
|
128
|
-
}
|
|
129
|
-
export { FactoryNotFound }
|
|
130
|
-
export { FactoryNotFound as FactoryNotFound_alias_1 }
|
|
131
|
-
export { FactoryNotFound as FactoryNotFound_alias_2 }
|
|
132
|
-
|
|
133
|
-
declare type FactoryRecord<Instance = any, Schema = any> = {
|
|
134
|
-
scope: InjectableScope;
|
|
135
|
-
originalToken: InjectionToken<Instance, Schema>;
|
|
136
|
-
factory: InjectionFactory<Instance, Schema extends AnyZodObject ? z.input<Schema> : unknown>;
|
|
137
|
-
};
|
|
138
|
-
export { FactoryRecord }
|
|
139
|
-
export { FactoryRecord as FactoryRecord_alias_1 }
|
|
140
|
-
|
|
141
|
-
declare class FactoryTokenNotResolved extends Error {
|
|
142
|
-
code: ErrorsEnum;
|
|
143
|
-
constructor(name: string | symbol | ClassType);
|
|
144
|
-
}
|
|
145
|
-
export { FactoryTokenNotResolved }
|
|
146
|
-
export { FactoryTokenNotResolved as FactoryTokenNotResolved_alias_1 }
|
|
147
|
-
export { FactoryTokenNotResolved as FactoryTokenNotResolved_alias_2 }
|
|
148
|
-
|
|
149
|
-
declare interface FactoryWithArgs<T, A extends AnyZodObject> {
|
|
150
|
-
create(ctx: any, args: z.output<A>): Promise<T> | T;
|
|
151
|
-
}
|
|
152
|
-
export { FactoryWithArgs }
|
|
153
|
-
export { FactoryWithArgs as FactoryWithArgs_alias_1 }
|
|
154
|
-
export { FactoryWithArgs as FactoryWithArgs_alias_2 }
|
|
155
|
-
|
|
156
|
-
declare function getGlobalServiceLocator(): ServiceLocator;
|
|
157
|
-
export { getGlobalServiceLocator }
|
|
158
|
-
export { getGlobalServiceLocator as getGlobalServiceLocator_alias_1 }
|
|
159
|
-
|
|
160
|
-
declare function getInjectableToken<R>(target: ClassType): R extends {
|
|
161
|
-
create(...args: any[]): infer V;
|
|
162
|
-
} ? InjectionToken<V> : InjectionToken<R>;
|
|
163
|
-
export { getInjectableToken }
|
|
164
|
-
export { getInjectableToken as getInjectableToken_alias_1 }
|
|
165
|
-
export { getInjectableToken as getInjectableToken_alias_2 }
|
|
166
|
-
|
|
167
|
-
declare function getInjectors({ baseLocator }: CreateInjectorsOptions): Injectors;
|
|
168
|
-
export { getInjectors }
|
|
169
|
-
export { getInjectors as getInjectors_alias_1 }
|
|
170
|
-
export { getInjectors as getInjectors_alias_2 }
|
|
171
|
-
|
|
172
|
-
declare const globalRegistry: Registry;
|
|
173
|
-
export { globalRegistry }
|
|
174
|
-
export { globalRegistry as globalRegistry_alias_1 }
|
|
175
|
-
|
|
176
|
-
declare const inject: {
|
|
177
|
-
<T extends ClassType_2>(token: T): Promise<InstanceType<T>>;
|
|
178
|
-
<T, S extends AnyZodObject>(token: InjectionToken_2<T, S>, args: input<S>): Promise<T>;
|
|
179
|
-
<T, S extends ZodOptional<AnyZodObject>>(token: InjectionToken_2<T, S>, args?: input<S>): Promise<T>;
|
|
180
|
-
<T>(token: InjectionToken_2<T, undefined>): Promise<T>;
|
|
181
|
-
<T>(token: BoundInjectionToken_2<T, any>): Promise<T>;
|
|
182
|
-
<T>(token: FactoryInjectionToken_2<T, any>): Promise<T>;
|
|
183
|
-
};
|
|
184
|
-
export { inject }
|
|
185
|
-
export { inject as inject_alias_1 }
|
|
186
|
-
|
|
187
|
-
declare function Injectable(): <T extends ClassType>(target: T, context: ClassDecoratorContext) => T & {
|
|
188
|
-
[InjectableTokenMeta]: InjectionToken<InstanceType<T>, undefined>;
|
|
189
|
-
};
|
|
190
|
-
|
|
191
|
-
declare function Injectable<T extends ClassType>(options: {
|
|
192
|
-
scope?: InjectableScope;
|
|
193
|
-
token: InjectionToken<T, undefined>;
|
|
194
|
-
}): (target: T, context: ClassDecoratorContext) => T & {
|
|
195
|
-
[InjectableTokenMeta]: InjectionToken<InstanceType<T>, undefined>;
|
|
196
|
-
};
|
|
197
|
-
|
|
198
|
-
declare function Injectable<R>(options: {
|
|
199
|
-
scope?: InjectableScope;
|
|
200
|
-
type: InjectableType.Factory;
|
|
201
|
-
}): <T extends ClassTypeWithInstance<Factory<R>>>(target: T, context: ClassDecoratorContext) => T & {
|
|
202
|
-
[InjectableTokenMeta]: InjectionToken<R, undefined>;
|
|
203
|
-
};
|
|
204
|
-
|
|
205
|
-
declare function Injectable<R, S extends AnyZodObject>(options: {
|
|
206
|
-
scope?: InjectableScope;
|
|
207
|
-
type: InjectableType.Factory;
|
|
208
|
-
token: InjectionToken<R, S>;
|
|
209
|
-
}): <T extends ClassTypeWithInstance<FactoryWithArgs<R, S>>>(target: T, context: ClassDecoratorContext) => T & {
|
|
210
|
-
[InjectableTokenMeta]: InjectionToken<R, S>;
|
|
211
|
-
};
|
|
212
|
-
|
|
213
|
-
declare function Injectable<R>(options: {
|
|
214
|
-
scope?: InjectableScope;
|
|
215
|
-
type: InjectableType.Factory;
|
|
216
|
-
token: InjectionToken<R, undefined>;
|
|
217
|
-
}): <T extends ClassTypeWithInstance<Factory<R>>>(target: T, context: ClassDecoratorContext) => T & {
|
|
218
|
-
[InjectableTokenMeta]: InjectionToken<R, undefined>;
|
|
219
|
-
};
|
|
220
|
-
export { Injectable }
|
|
221
|
-
export { Injectable as Injectable_alias_1 }
|
|
222
|
-
export { Injectable as Injectable_alias_2 }
|
|
223
|
-
|
|
224
|
-
declare interface InjectableOptions {
|
|
225
|
-
scope?: InjectableScope;
|
|
226
|
-
type?: InjectableType;
|
|
227
|
-
token?: InjectionToken<any, any>;
|
|
228
|
-
registry?: Registry;
|
|
229
|
-
}
|
|
230
|
-
export { InjectableOptions }
|
|
231
|
-
export { InjectableOptions as InjectableOptions_alias_1 }
|
|
232
|
-
export { InjectableOptions as InjectableOptions_alias_2 }
|
|
233
|
-
|
|
234
|
-
declare enum InjectableScope {
|
|
235
|
-
/**
|
|
236
|
-
* Singleton scope: The instance is created once and shared across the application.
|
|
237
|
-
*/
|
|
238
|
-
Singleton = "Singleton",
|
|
239
|
-
/**
|
|
240
|
-
* Instance scope: A new instance is created for each injection.
|
|
241
|
-
*/
|
|
242
|
-
Instance = "Instance"
|
|
243
|
-
}
|
|
244
|
-
export { InjectableScope }
|
|
245
|
-
export { InjectableScope as InjectableScope_alias_1 }
|
|
246
|
-
export { InjectableScope as InjectableScope_alias_2 }
|
|
247
|
-
|
|
248
|
-
declare const InjectableTokenMeta: unique symbol;
|
|
249
|
-
export { InjectableTokenMeta }
|
|
250
|
-
export { InjectableTokenMeta as InjectableTokenMeta_alias_1 }
|
|
251
|
-
export { InjectableTokenMeta as InjectableTokenMeta_alias_2 }
|
|
252
|
-
|
|
253
|
-
declare enum InjectableType {
|
|
254
|
-
Class = "Class",
|
|
255
|
-
Factory = "Factory"
|
|
256
|
-
}
|
|
257
|
-
export { InjectableType }
|
|
258
|
-
export { InjectableType as InjectableType_alias_1 }
|
|
259
|
-
export { InjectableType as InjectableType_alias_2 }
|
|
260
|
-
|
|
261
|
-
declare type InjectionFactory<T = unknown, Args = unknown> = (ctx: FactoryContext, args: Args) => Promise<T>;
|
|
262
|
-
export { InjectionFactory }
|
|
263
|
-
export { InjectionFactory as InjectionFactory_alias_1 }
|
|
264
|
-
|
|
265
|
-
declare class InjectionToken<T, S extends AnyZodObject | ZodOptional<AnyZodObject> | unknown = unknown> {
|
|
266
|
-
readonly name: string | symbol | ClassType;
|
|
267
|
-
readonly schema: AnyZodObject | undefined;
|
|
268
|
-
id: `${string}-${string}-${string}-${string}-${string}`;
|
|
269
|
-
private formattedName;
|
|
270
|
-
constructor(name: string | symbol | ClassType, schema: AnyZodObject | undefined);
|
|
271
|
-
static create<T extends ClassType>(name: T): InjectionToken<InstanceType<T>, undefined>;
|
|
272
|
-
static create<T extends ClassType, Schema extends AnyZodObject | ZodOptional<AnyZodObject>>(name: T, schema: Schema): InjectionToken<InstanceType<T>, Schema>;
|
|
273
|
-
static create<T>(name: string | symbol): InjectionToken<T, undefined>;
|
|
274
|
-
static create<T, Schema extends AnyZodObject | ZodOptional<AnyZodObject>>(name: string | any, schema: Schema): InjectionToken<T, Schema>;
|
|
275
|
-
static bound<T, S extends AnyZodObject | ZodOptional<AnyZodObject>>(token: InjectionToken<T, S>, value: z.input<S>): BoundInjectionToken<T, S>;
|
|
276
|
-
static factory<T, S extends AnyZodObject | ZodOptional<AnyZodObject>>(token: InjectionToken<T, S>, factory: () => Promise<z.input<S>>): FactoryInjectionToken<T, S>;
|
|
277
|
-
static refineType<T>(token: BoundInjectionToken<any, any>): BoundInjectionToken<T, any>;
|
|
278
|
-
toString(): string;
|
|
279
|
-
}
|
|
280
|
-
export { InjectionToken }
|
|
281
|
-
export { InjectionToken as InjectionToken_alias_1 }
|
|
282
|
-
|
|
283
|
-
declare interface Injectors {
|
|
284
|
-
inject<T extends ClassType>(token: T): Promise<InstanceType<T>>;
|
|
285
|
-
inject<T, S extends AnyZodObject>(token: InjectionToken<T, S>, args: z.input<S>): Promise<T>;
|
|
286
|
-
inject<T, S extends ZodOptional<AnyZodObject>>(token: InjectionToken<T, S>, args?: z.input<S>): Promise<T>;
|
|
287
|
-
inject<T>(token: InjectionToken<T, undefined>): Promise<T>;
|
|
288
|
-
inject<T>(token: BoundInjectionToken<T, any>): Promise<T>;
|
|
289
|
-
inject<T>(token: FactoryInjectionToken<T, any>): Promise<T>;
|
|
290
|
-
syncInject<T extends ClassType>(token: T): InstanceType<T>;
|
|
291
|
-
syncInject<T, S extends AnyZodObject>(token: InjectionToken<T, S>, args: z.input<S>): T;
|
|
292
|
-
syncInject<T, S extends ZodOptional<AnyZodObject>>(token: InjectionToken<T, S>, args: z.input<S>): T;
|
|
293
|
-
syncInject<T>(token: InjectionToken<T, undefined>): T;
|
|
294
|
-
syncInject<T>(token: BoundInjectionToken<T, any>): T;
|
|
295
|
-
syncInject<T>(token: FactoryInjectionToken<T, any>): T;
|
|
296
|
-
wrapSyncInit(cb: () => any): () => [any, Promise<any>[]];
|
|
297
|
-
provideServiceLocator(locator: ServiceLocator): ServiceLocator;
|
|
298
|
-
}
|
|
299
|
-
export { Injectors }
|
|
300
|
-
export { Injectors as Injectors_alias_1 }
|
|
301
|
-
export { Injectors as Injectors_alias_2 }
|
|
302
|
-
|
|
303
|
-
declare const InjectorsBase: Map<ServiceLocator, Injectors>;
|
|
304
|
-
export { InjectorsBase }
|
|
305
|
-
export { InjectorsBase as InjectorsBase_alias_1 }
|
|
306
|
-
export { InjectorsBase as InjectorsBase_alias_2 }
|
|
307
|
-
|
|
308
|
-
declare class InstanceDestroying extends Error {
|
|
309
|
-
name: string;
|
|
310
|
-
code: ErrorsEnum;
|
|
311
|
-
constructor(name: string);
|
|
312
|
-
}
|
|
313
|
-
export { InstanceDestroying }
|
|
314
|
-
export { InstanceDestroying as InstanceDestroying_alias_1 }
|
|
315
|
-
export { InstanceDestroying as InstanceDestroying_alias_2 }
|
|
316
|
-
|
|
317
|
-
declare class InstanceExpired extends Error {
|
|
318
|
-
name: string;
|
|
319
|
-
code: ErrorsEnum;
|
|
320
|
-
constructor(name: string);
|
|
321
|
-
}
|
|
322
|
-
export { InstanceExpired }
|
|
323
|
-
export { InstanceExpired as InstanceExpired_alias_1 }
|
|
324
|
-
export { InstanceExpired as InstanceExpired_alias_2 }
|
|
325
|
-
|
|
326
|
-
declare class InstanceNotFound extends Error {
|
|
327
|
-
name: string;
|
|
328
|
-
code: ErrorsEnum;
|
|
329
|
-
constructor(name: string);
|
|
330
|
-
}
|
|
331
|
-
export { InstanceNotFound }
|
|
332
|
-
export { InstanceNotFound as InstanceNotFound_alias_1 }
|
|
333
|
-
export { InstanceNotFound as InstanceNotFound_alias_2 }
|
|
334
|
-
|
|
335
|
-
declare function makeProxyServiceLocator(serviceLocator: ServiceLocator, ctx: FactoryContext): ServiceLocator;
|
|
336
|
-
export { makeProxyServiceLocator }
|
|
337
|
-
export { makeProxyServiceLocator as makeProxyServiceLocator_alias_1 }
|
|
338
|
-
|
|
339
|
-
declare const provideServiceLocator: (locator: ServiceLocator) => ServiceLocator;
|
|
340
|
-
export { provideServiceLocator }
|
|
341
|
-
export { provideServiceLocator as provideServiceLocator_alias_1 }
|
|
342
|
-
|
|
343
|
-
declare class ProxyServiceLocator implements ServiceLocator {
|
|
344
|
-
private readonly serviceLocator;
|
|
345
|
-
private readonly ctx;
|
|
346
|
-
constructor(serviceLocator: ServiceLocator, ctx: FactoryContext);
|
|
347
|
-
getEventBus(): ServiceLocatorEventBus;
|
|
348
|
-
getInstance(token: InjectionToken<any, any> | BoundInjectionToken<any, any> | FactoryInjectionToken<any, any>, args?: any): Promise<any[]>;
|
|
349
|
-
getOrThrowInstance<Instance, Schema extends AnyZodObject | ZodOptional<AnyZodObject> | undefined>(token: InjectionToken<Instance, Schema>, args: Schema extends AnyZodObject ? z.input<Schema> : Schema extends ZodOptional<AnyZodObject> ? z.input<Schema> | undefined : undefined): Promise<Instance>;
|
|
350
|
-
getSyncInstance<Instance, Schema extends AnyZodObject | ZodOptional<AnyZodObject> | undefined>(token: InjectionToken<Instance, Schema>, args: Schema extends AnyZodObject ? z.input<Schema> : Schema extends ZodOptional<AnyZodObject> ? z.input<Schema> | undefined : undefined): Instance | null;
|
|
351
|
-
invalidate(service: string, round?: number): Promise<any>;
|
|
352
|
-
ready(): Promise<null>;
|
|
353
|
-
makeInstanceName(token: InjectionToken<any, any>, args: any): string;
|
|
354
|
-
}
|
|
355
|
-
export { ProxyServiceLocator }
|
|
356
|
-
export { ProxyServiceLocator as ProxyServiceLocator_alias_1 }
|
|
357
|
-
|
|
358
|
-
declare class Registry {
|
|
359
|
-
private readonly parent?;
|
|
360
|
-
private readonly factories;
|
|
361
|
-
constructor(parent?: Registry | undefined);
|
|
362
|
-
has(token: InjectionToken<any, any>): boolean;
|
|
363
|
-
get<Instance, Schema>(token: InjectionToken<Instance, Schema>): FactoryRecord<Instance, Schema>;
|
|
364
|
-
set<Instance, Schema>(token: InjectionToken<Instance, Schema>, factory: InjectionFactory, scope: InjectableScope): void;
|
|
365
|
-
delete(token: InjectionToken<any, any>): void;
|
|
366
|
-
}
|
|
367
|
-
export { Registry }
|
|
368
|
-
export { Registry as Registry_alias_1 }
|
|
369
|
-
|
|
370
|
-
declare function resolveService<T extends ClassType>(ctx: FactoryContext, target: T, args?: any[]): Promise<InstanceType<T>>;
|
|
371
|
-
export { resolveService }
|
|
372
|
-
export { resolveService as resolveService_alias_1 }
|
|
373
|
-
|
|
374
|
-
declare class ServiceLocator {
|
|
375
|
-
private readonly registry;
|
|
376
|
-
private readonly logger;
|
|
377
|
-
private readonly eventBus;
|
|
378
|
-
private readonly manager;
|
|
379
|
-
constructor(registry?: Registry, logger?: Console | null);
|
|
380
|
-
getEventBus(): ServiceLocatorEventBus;
|
|
381
|
-
storeInstance<Instance>(instance: Instance, token: BoundInjectionToken<Instance, any>): void;
|
|
382
|
-
storeInstance<Instance>(instance: Instance, token: FactoryInjectionToken<Instance, any>): void;
|
|
383
|
-
storeInstance<Instance>(instance: Instance, token: InjectionToken<Instance, undefined>): void;
|
|
384
|
-
storeInstance<Instance, Schema extends AnyZodObject | ZodOptional<AnyZodObject>>(instance: Instance, token: InjectionToken<Instance, Schema>, args: z.input<Schema>): void;
|
|
385
|
-
removeInstance<Instance>(instance: Instance, token: BoundInjectionToken<Instance, any>): void;
|
|
386
|
-
removeInstance<Instance>(instance: Instance, token: FactoryInjectionToken<Instance, any>): void;
|
|
387
|
-
removeInstance<Instance>(instance: Instance, token: InjectionToken<Instance, undefined>): void;
|
|
388
|
-
removeInstance<Instance, Schema extends AnyZodObject | ZodOptional<AnyZodObject>>(instance: Instance, token: InjectionToken<Instance, Schema>, args: z.input<Schema>): void;
|
|
389
|
-
private resolveTokenArgs;
|
|
390
|
-
getInstanceIdentifier<Instance, Schema extends AnyZodObject>(token: InjectionToken<Instance, Schema>, args: z.input<Schema>): string;
|
|
391
|
-
getInstanceIdentifier<Instance, Schema extends ZodOptional<AnyZodObject>>(token: InjectionToken<Instance, Schema>, args?: z.input<Schema>): string;
|
|
392
|
-
getInstanceIdentifier<Instance>(token: InjectionToken<Instance, undefined>): string;
|
|
393
|
-
getInstanceIdentifier<Instance>(token: BoundInjectionToken<Instance, any>): string;
|
|
394
|
-
getInstanceIdentifier<Instance>(token: FactoryInjectionToken<Instance, any>): string;
|
|
395
|
-
getInstance<Instance, Schema extends AnyZodObject>(token: InjectionToken<Instance, Schema>, args: z.input<Schema>): Promise<[undefined, Instance] | [UnknownError | FactoryNotFound]>;
|
|
396
|
-
getInstance<Instance, Schema extends ZodOptional<AnyZodObject>>(token: InjectionToken<Instance, Schema>, args?: z.input<Schema>): Promise<[undefined, Instance] | [UnknownError | FactoryNotFound]>;
|
|
397
|
-
getInstance<Instance>(token: InjectionToken<Instance, undefined>): Promise<[undefined, Instance] | [UnknownError | FactoryNotFound]>;
|
|
398
|
-
getInstance<Instance>(token: BoundInjectionToken<Instance, any>): Promise<[undefined, Instance] | [UnknownError | FactoryNotFound]>;
|
|
399
|
-
getInstance<Instance>(token: FactoryInjectionToken<Instance, any>): Promise<[undefined, Instance] | [UnknownError | FactoryNotFound]>;
|
|
400
|
-
getOrThrowInstance<Instance, Schema extends AnyZodObject | ZodOptional<AnyZodObject> | undefined>(token: InjectionToken<Instance, Schema>, args: Schema extends AnyZodObject ? z.input<Schema> : Schema extends ZodOptional<AnyZodObject> ? z.input<Schema> | undefined : undefined): Promise<Instance>;
|
|
401
|
-
private notifyListeners;
|
|
402
|
-
private createInstance;
|
|
403
|
-
private resolveInstance;
|
|
404
|
-
private createFactoryContext;
|
|
405
|
-
getSyncInstance<Instance, Schema extends AnyZodObject | ZodOptional<AnyZodObject> | undefined>(token: InjectionToken<Instance, Schema>, args: Schema extends AnyZodObject ? z.input<Schema> : Schema extends ZodOptional<AnyZodObject> ? z.input<Schema> | undefined : undefined): Instance | null;
|
|
406
|
-
invalidate(service: string, round?: number): Promise<any>;
|
|
407
|
-
ready(): Promise<null>;
|
|
408
|
-
makeInstanceName(token: InjectionToken<any, any> | BoundInjectionToken<any, any> | FactoryInjectionToken<any, any>, args: any): string;
|
|
409
|
-
}
|
|
410
|
-
export { ServiceLocator }
|
|
411
|
-
export { ServiceLocator as ServiceLocator_alias_1 }
|
|
412
|
-
|
|
413
|
-
declare class ServiceLocatorEventBus {
|
|
414
|
-
private readonly logger;
|
|
415
|
-
private listeners;
|
|
416
|
-
constructor(logger?: Console | null);
|
|
417
|
-
on<Event extends string | `pre:${string}` | `post:${string}`>(ns: string, event: Event, listener: (event: Event) => void): () => void;
|
|
418
|
-
emit(key: string, event: string): Promise<PromiseSettledResult<any>[] | undefined>;
|
|
419
|
-
}
|
|
420
|
-
export { ServiceLocatorEventBus }
|
|
421
|
-
export { ServiceLocatorEventBus as ServiceLocatorEventBus_alias_1 }
|
|
422
|
-
|
|
423
|
-
declare type ServiceLocatorInstanceDestroyListener = () => void | Promise<void>;
|
|
424
|
-
export { ServiceLocatorInstanceDestroyListener }
|
|
425
|
-
export { ServiceLocatorInstanceDestroyListener as ServiceLocatorInstanceDestroyListener_alias_1 }
|
|
426
|
-
|
|
427
|
-
declare type ServiceLocatorInstanceEffect = () => void;
|
|
428
|
-
export { ServiceLocatorInstanceEffect }
|
|
429
|
-
export { ServiceLocatorInstanceEffect as ServiceLocatorInstanceEffect_alias_1 }
|
|
430
|
-
|
|
431
|
-
declare type ServiceLocatorInstanceHolder<Instance = unknown> = ServiceLocatorInstanceHolderCreating<Instance> | ServiceLocatorInstanceHolderCreated<Instance> | ServiceLocatorInstanceHolderDestroying<Instance>;
|
|
432
|
-
export { ServiceLocatorInstanceHolder }
|
|
433
|
-
export { ServiceLocatorInstanceHolder as ServiceLocatorInstanceHolder_alias_1 }
|
|
434
|
-
|
|
435
|
-
declare interface ServiceLocatorInstanceHolderCreated<Instance> {
|
|
436
|
-
status: ServiceLocatorInstanceHolderStatus.Created;
|
|
437
|
-
name: string;
|
|
438
|
-
instance: Instance;
|
|
439
|
-
creationPromise: null;
|
|
440
|
-
destroyPromise: null;
|
|
441
|
-
kind: ServiceLocatorInstanceHolderKind;
|
|
442
|
-
effects: ServiceLocatorInstanceEffect[];
|
|
443
|
-
deps: string[];
|
|
444
|
-
destroyListeners: ServiceLocatorInstanceDestroyListener[];
|
|
445
|
-
createdAt: number;
|
|
446
|
-
ttl: number;
|
|
447
|
-
}
|
|
448
|
-
export { ServiceLocatorInstanceHolderCreated }
|
|
449
|
-
export { ServiceLocatorInstanceHolderCreated as ServiceLocatorInstanceHolderCreated_alias_1 }
|
|
450
|
-
|
|
451
|
-
declare interface ServiceLocatorInstanceHolderCreating<Instance> {
|
|
452
|
-
status: ServiceLocatorInstanceHolderStatus.Creating;
|
|
453
|
-
name: string;
|
|
454
|
-
instance: null;
|
|
455
|
-
creationPromise: Promise<[undefined, Instance]> | null;
|
|
456
|
-
destroyPromise: null;
|
|
457
|
-
kind: ServiceLocatorInstanceHolderKind;
|
|
458
|
-
effects: ServiceLocatorInstanceEffect[];
|
|
459
|
-
deps: string[];
|
|
460
|
-
destroyListeners: ServiceLocatorInstanceDestroyListener[];
|
|
461
|
-
createdAt: number;
|
|
462
|
-
ttl: number;
|
|
463
|
-
}
|
|
464
|
-
export { ServiceLocatorInstanceHolderCreating }
|
|
465
|
-
export { ServiceLocatorInstanceHolderCreating as ServiceLocatorInstanceHolderCreating_alias_1 }
|
|
466
|
-
|
|
467
|
-
declare interface ServiceLocatorInstanceHolderDestroying<Instance> {
|
|
468
|
-
status: ServiceLocatorInstanceHolderStatus.Destroying;
|
|
469
|
-
name: string;
|
|
470
|
-
instance: Instance | null;
|
|
471
|
-
creationPromise: null;
|
|
472
|
-
destroyPromise: Promise<void>;
|
|
473
|
-
kind: ServiceLocatorInstanceHolderKind;
|
|
474
|
-
effects: ServiceLocatorInstanceEffect[];
|
|
475
|
-
deps: string[];
|
|
476
|
-
destroyListeners: ServiceLocatorInstanceDestroyListener[];
|
|
477
|
-
createdAt: number;
|
|
478
|
-
ttl: number;
|
|
479
|
-
}
|
|
480
|
-
export { ServiceLocatorInstanceHolderDestroying }
|
|
481
|
-
export { ServiceLocatorInstanceHolderDestroying as ServiceLocatorInstanceHolderDestroying_alias_1 }
|
|
482
|
-
|
|
483
|
-
declare enum ServiceLocatorInstanceHolderKind {
|
|
484
|
-
Instance = "instance",
|
|
485
|
-
Factory = "factory",
|
|
486
|
-
AbstractFactory = "abstractFactory"
|
|
487
|
-
}
|
|
488
|
-
export { ServiceLocatorInstanceHolderKind }
|
|
489
|
-
export { ServiceLocatorInstanceHolderKind as ServiceLocatorInstanceHolderKind_alias_1 }
|
|
490
|
-
|
|
491
|
-
declare enum ServiceLocatorInstanceHolderStatus {
|
|
492
|
-
Created = "created",
|
|
493
|
-
Creating = "creating",
|
|
494
|
-
Destroying = "destroying"
|
|
495
|
-
}
|
|
496
|
-
export { ServiceLocatorInstanceHolderStatus }
|
|
497
|
-
export { ServiceLocatorInstanceHolderStatus as ServiceLocatorInstanceHolderStatus_alias_1 }
|
|
498
|
-
|
|
499
|
-
declare class ServiceLocatorManager {
|
|
500
|
-
private readonly logger;
|
|
501
|
-
private readonly instancesHolders;
|
|
502
|
-
constructor(logger?: Console | null);
|
|
503
|
-
get(name: string): [InstanceExpired | InstanceDestroying, ServiceLocatorInstanceHolder] | [InstanceNotFound] | [undefined, ServiceLocatorInstanceHolder];
|
|
504
|
-
set(name: string, holder: ServiceLocatorInstanceHolder): void;
|
|
505
|
-
has(name: string): [InstanceExpired | InstanceDestroying] | [undefined, boolean];
|
|
506
|
-
delete(name: string): boolean;
|
|
507
|
-
filter(predicate: (value: ServiceLocatorInstanceHolder<any>, key: string) => boolean): Map<string, ServiceLocatorInstanceHolder>;
|
|
508
|
-
}
|
|
509
|
-
export { ServiceLocatorManager }
|
|
510
|
-
export { ServiceLocatorManager as ServiceLocatorManager_alias_1 }
|
|
511
|
-
|
|
512
|
-
declare const syncInject: {
|
|
513
|
-
<T extends ClassType_2>(token: T): InstanceType<T>;
|
|
514
|
-
<T, S extends AnyZodObject>(token: InjectionToken_2<T, S>, args: input<S>): T;
|
|
515
|
-
<T, S extends ZodOptional<AnyZodObject>>(token: InjectionToken_2<T, S>, args: input<S>): T;
|
|
516
|
-
<T>(token: InjectionToken_2<T, undefined>): T;
|
|
517
|
-
<T>(token: BoundInjectionToken_2<T, any>): T;
|
|
518
|
-
<T>(token: FactoryInjectionToken_2<T, any>): T;
|
|
519
|
-
};
|
|
520
|
-
export { syncInject }
|
|
521
|
-
export { syncInject as syncInject_alias_1 }
|
|
522
|
-
|
|
523
|
-
declare class UnknownError extends Error {
|
|
524
|
-
code: ErrorsEnum;
|
|
525
|
-
parent?: Error;
|
|
526
|
-
constructor(message: string | Error);
|
|
527
|
-
}
|
|
528
|
-
export { UnknownError }
|
|
529
|
-
export { UnknownError as UnknownError_alias_1 }
|
|
530
|
-
export { UnknownError as UnknownError_alias_2 }
|
|
531
|
-
|
|
532
|
-
declare const wrapSyncInit: (cb: () => any) => () => [any, Promise<any>[]];
|
|
533
|
-
export { wrapSyncInit }
|
|
534
|
-
export { wrapSyncInit as wrapSyncInit_alias_1 }
|
|
535
|
-
|
|
536
|
-
export { }
|
package/dist/index.d.mts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
export { Injectable } from './_tsup-dts-rollup.mjs';
|
|
2
|
-
export { InjectableOptions } from './_tsup-dts-rollup.mjs';
|
|
3
|
-
export { InjectableTokenMeta } from './_tsup-dts-rollup.mjs';
|
|
4
|
-
export { InjectableScope } from './_tsup-dts-rollup.mjs';
|
|
5
|
-
export { InjectableType } from './_tsup-dts-rollup.mjs';
|
|
6
|
-
export { ErrorsEnum } from './_tsup-dts-rollup.mjs';
|
|
7
|
-
export { FactoryNotFound } from './_tsup-dts-rollup.mjs';
|
|
8
|
-
export { FactoryTokenNotResolved } from './_tsup-dts-rollup.mjs';
|
|
9
|
-
export { InstanceDestroying } from './_tsup-dts-rollup.mjs';
|
|
10
|
-
export { InstanceExpired } from './_tsup-dts-rollup.mjs';
|
|
11
|
-
export { InstanceNotFound } from './_tsup-dts-rollup.mjs';
|
|
12
|
-
export { UnknownError } from './_tsup-dts-rollup.mjs';
|
|
13
|
-
export { Factory } from './_tsup-dts-rollup.mjs';
|
|
14
|
-
export { FactoryWithArgs } from './_tsup-dts-rollup.mjs';
|
|
15
|
-
export { getInjectors } from './_tsup-dts-rollup.mjs';
|
|
16
|
-
export { CreateInjectorsOptions } from './_tsup-dts-rollup.mjs';
|
|
17
|
-
export { Injectors } from './_tsup-dts-rollup.mjs';
|
|
18
|
-
export { InjectorsBase } from './_tsup-dts-rollup.mjs';
|
|
19
|
-
export { getInjectableToken } from './_tsup-dts-rollup.mjs';
|
|
20
|
-
export { EventsConfig_alias_1 as EventsConfig } from './_tsup-dts-rollup.mjs';
|
|
21
|
-
export { EventsNames_alias_1 as EventsNames } from './_tsup-dts-rollup.mjs';
|
|
22
|
-
export { EventsArgs_alias_1 as EventsArgs } from './_tsup-dts-rollup.mjs';
|
|
23
|
-
export { ChannelEmitter_alias_1 as ChannelEmitter } from './_tsup-dts-rollup.mjs';
|
|
24
|
-
export { EventEmitterInterface_alias_1 as EventEmitterInterface } from './_tsup-dts-rollup.mjs';
|
|
25
|
-
export { EventEmitter_alias_1 as EventEmitter } from './_tsup-dts-rollup.mjs';
|
|
26
|
-
export { FactoryContext_alias_1 as FactoryContext } from './_tsup-dts-rollup.mjs';
|
|
27
|
-
export { ClassType } from './_tsup-dts-rollup.mjs';
|
|
28
|
-
export { ClassTypeWithInstance } from './_tsup-dts-rollup.mjs';
|
|
29
|
-
export { InjectionToken } from './_tsup-dts-rollup.mjs';
|
|
30
|
-
export { BoundInjectionToken } from './_tsup-dts-rollup.mjs';
|
|
31
|
-
export { FactoryInjectionToken } from './_tsup-dts-rollup.mjs';
|
|
32
|
-
export { getGlobalServiceLocator } from './_tsup-dts-rollup.mjs';
|
|
33
|
-
export { inject } from './_tsup-dts-rollup.mjs';
|
|
34
|
-
export { syncInject } from './_tsup-dts-rollup.mjs';
|
|
35
|
-
export { wrapSyncInit } from './_tsup-dts-rollup.mjs';
|
|
36
|
-
export { provideServiceLocator } from './_tsup-dts-rollup.mjs';
|
|
37
|
-
export { makeProxyServiceLocator } from './_tsup-dts-rollup.mjs';
|
|
38
|
-
export { ProxyServiceLocator } from './_tsup-dts-rollup.mjs';
|
|
39
|
-
export { InjectionFactory } from './_tsup-dts-rollup.mjs';
|
|
40
|
-
export { FactoryRecord } from './_tsup-dts-rollup.mjs';
|
|
41
|
-
export { Registry } from './_tsup-dts-rollup.mjs';
|
|
42
|
-
export { globalRegistry } from './_tsup-dts-rollup.mjs';
|
|
43
|
-
export { resolveService } from './_tsup-dts-rollup.mjs';
|
|
44
|
-
export { ServiceLocator } from './_tsup-dts-rollup.mjs';
|
|
45
|
-
export { ServiceLocatorEventBus } from './_tsup-dts-rollup.mjs';
|
|
46
|
-
export { ServiceLocatorInstanceHolderKind } from './_tsup-dts-rollup.mjs';
|
|
47
|
-
export { ServiceLocatorInstanceHolderStatus } from './_tsup-dts-rollup.mjs';
|
|
48
|
-
export { ServiceLocatorInstanceEffect } from './_tsup-dts-rollup.mjs';
|
|
49
|
-
export { ServiceLocatorInstanceDestroyListener } from './_tsup-dts-rollup.mjs';
|
|
50
|
-
export { ServiceLocatorInstanceHolderCreating } from './_tsup-dts-rollup.mjs';
|
|
51
|
-
export { ServiceLocatorInstanceHolderCreated } from './_tsup-dts-rollup.mjs';
|
|
52
|
-
export { ServiceLocatorInstanceHolderDestroying } from './_tsup-dts-rollup.mjs';
|
|
53
|
-
export { ServiceLocatorInstanceHolder } from './_tsup-dts-rollup.mjs';
|
|
54
|
-
export { ServiceLocatorManager } from './_tsup-dts-rollup.mjs';
|
package/dist/index.d.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
export { Injectable } from './_tsup-dts-rollup.js';
|
|
2
|
-
export { InjectableOptions } from './_tsup-dts-rollup.js';
|
|
3
|
-
export { InjectableTokenMeta } from './_tsup-dts-rollup.js';
|
|
4
|
-
export { InjectableScope } from './_tsup-dts-rollup.js';
|
|
5
|
-
export { InjectableType } from './_tsup-dts-rollup.js';
|
|
6
|
-
export { ErrorsEnum } from './_tsup-dts-rollup.js';
|
|
7
|
-
export { FactoryNotFound } from './_tsup-dts-rollup.js';
|
|
8
|
-
export { FactoryTokenNotResolved } from './_tsup-dts-rollup.js';
|
|
9
|
-
export { InstanceDestroying } from './_tsup-dts-rollup.js';
|
|
10
|
-
export { InstanceExpired } from './_tsup-dts-rollup.js';
|
|
11
|
-
export { InstanceNotFound } from './_tsup-dts-rollup.js';
|
|
12
|
-
export { UnknownError } from './_tsup-dts-rollup.js';
|
|
13
|
-
export { Factory } from './_tsup-dts-rollup.js';
|
|
14
|
-
export { FactoryWithArgs } from './_tsup-dts-rollup.js';
|
|
15
|
-
export { getInjectors } from './_tsup-dts-rollup.js';
|
|
16
|
-
export { CreateInjectorsOptions } from './_tsup-dts-rollup.js';
|
|
17
|
-
export { Injectors } from './_tsup-dts-rollup.js';
|
|
18
|
-
export { InjectorsBase } from './_tsup-dts-rollup.js';
|
|
19
|
-
export { getInjectableToken } from './_tsup-dts-rollup.js';
|
|
20
|
-
export { EventsConfig_alias_1 as EventsConfig } from './_tsup-dts-rollup.js';
|
|
21
|
-
export { EventsNames_alias_1 as EventsNames } from './_tsup-dts-rollup.js';
|
|
22
|
-
export { EventsArgs_alias_1 as EventsArgs } from './_tsup-dts-rollup.js';
|
|
23
|
-
export { ChannelEmitter_alias_1 as ChannelEmitter } from './_tsup-dts-rollup.js';
|
|
24
|
-
export { EventEmitterInterface_alias_1 as EventEmitterInterface } from './_tsup-dts-rollup.js';
|
|
25
|
-
export { EventEmitter_alias_1 as EventEmitter } from './_tsup-dts-rollup.js';
|
|
26
|
-
export { FactoryContext_alias_1 as FactoryContext } from './_tsup-dts-rollup.js';
|
|
27
|
-
export { ClassType } from './_tsup-dts-rollup.js';
|
|
28
|
-
export { ClassTypeWithInstance } from './_tsup-dts-rollup.js';
|
|
29
|
-
export { InjectionToken } from './_tsup-dts-rollup.js';
|
|
30
|
-
export { BoundInjectionToken } from './_tsup-dts-rollup.js';
|
|
31
|
-
export { FactoryInjectionToken } from './_tsup-dts-rollup.js';
|
|
32
|
-
export { getGlobalServiceLocator } from './_tsup-dts-rollup.js';
|
|
33
|
-
export { inject } from './_tsup-dts-rollup.js';
|
|
34
|
-
export { syncInject } from './_tsup-dts-rollup.js';
|
|
35
|
-
export { wrapSyncInit } from './_tsup-dts-rollup.js';
|
|
36
|
-
export { provideServiceLocator } from './_tsup-dts-rollup.js';
|
|
37
|
-
export { makeProxyServiceLocator } from './_tsup-dts-rollup.js';
|
|
38
|
-
export { ProxyServiceLocator } from './_tsup-dts-rollup.js';
|
|
39
|
-
export { InjectionFactory } from './_tsup-dts-rollup.js';
|
|
40
|
-
export { FactoryRecord } from './_tsup-dts-rollup.js';
|
|
41
|
-
export { Registry } from './_tsup-dts-rollup.js';
|
|
42
|
-
export { globalRegistry } from './_tsup-dts-rollup.js';
|
|
43
|
-
export { resolveService } from './_tsup-dts-rollup.js';
|
|
44
|
-
export { ServiceLocator } from './_tsup-dts-rollup.js';
|
|
45
|
-
export { ServiceLocatorEventBus } from './_tsup-dts-rollup.js';
|
|
46
|
-
export { ServiceLocatorInstanceHolderKind } from './_tsup-dts-rollup.js';
|
|
47
|
-
export { ServiceLocatorInstanceHolderStatus } from './_tsup-dts-rollup.js';
|
|
48
|
-
export { ServiceLocatorInstanceEffect } from './_tsup-dts-rollup.js';
|
|
49
|
-
export { ServiceLocatorInstanceDestroyListener } from './_tsup-dts-rollup.js';
|
|
50
|
-
export { ServiceLocatorInstanceHolderCreating } from './_tsup-dts-rollup.js';
|
|
51
|
-
export { ServiceLocatorInstanceHolderCreated } from './_tsup-dts-rollup.js';
|
|
52
|
-
export { ServiceLocatorInstanceHolderDestroying } from './_tsup-dts-rollup.js';
|
|
53
|
-
export { ServiceLocatorInstanceHolder } from './_tsup-dts-rollup.js';
|
|
54
|
-
export { ServiceLocatorManager } from './_tsup-dts-rollup.js';
|