@stompbox/tape-delay 1.0.8 → 1.0.10
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/index.d.ts +61 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -19,11 +19,71 @@ export declare const Scope: {
|
|
|
19
19
|
Request: <T>(EntryClass: ClassEntry<T>) => EntryDescription<T>;
|
|
20
20
|
ConstantValue: <T>(value: T) => ConstantValueEntry<T>;
|
|
21
21
|
};
|
|
22
|
+
/**
|
|
23
|
+
* Tape Delay container. Takes entries and optional environment detector in the constructor.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* import { TapeDelay } from '@stompbox/tape-delay'
|
|
28
|
+
* import { UserService } from '@/services/user.service'
|
|
29
|
+
*
|
|
30
|
+
* export const container = new TapeDelay({ UserService })
|
|
31
|
+
*
|
|
32
|
+
* const userService = container.instance('UserService')
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
22
35
|
export declare class TapeDelay<T extends Entries> {
|
|
36
|
+
/**
|
|
37
|
+
* Entries describing DI container.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```ts
|
|
41
|
+
* import { Singleton } from '@stompbox/tape-delay'
|
|
42
|
+
* import { UserService } from '@/services/user.service'
|
|
43
|
+
* import { UsersInMemory, UsersInPrisma } from '@/stores/user'
|
|
44
|
+
*
|
|
45
|
+
* const entries = {
|
|
46
|
+
* // One implementation for all environments
|
|
47
|
+
* UserService,
|
|
48
|
+
* UserStore: [
|
|
49
|
+
* // Implementation for test environment
|
|
50
|
+
* Singleton(UsersInMemory),
|
|
51
|
+
* // Implementation for development environment
|
|
52
|
+
* UsersInPrisma,
|
|
53
|
+
* // Implementation for production environment
|
|
54
|
+
* UsersInPrisma
|
|
55
|
+
* ]
|
|
56
|
+
* }
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
23
59
|
private readonly entries;
|
|
24
60
|
private readonly getEnvironment?;
|
|
25
61
|
private readonly key;
|
|
26
|
-
constructor(
|
|
62
|
+
constructor(
|
|
63
|
+
/**
|
|
64
|
+
* Entries describing DI container.
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```ts
|
|
68
|
+
* import { Singleton } from '@stompbox/tape-delay'
|
|
69
|
+
* import { UserService } from '@/services/user.service'
|
|
70
|
+
* import { UsersInMemory, UsersInPrisma } from '@/stores/user'
|
|
71
|
+
*
|
|
72
|
+
* const entries = {
|
|
73
|
+
* // One implementation for all environments
|
|
74
|
+
* UserService,
|
|
75
|
+
* UserStore: [
|
|
76
|
+
* // Implementation for test environment
|
|
77
|
+
* Singleton(UsersInMemory),
|
|
78
|
+
* // Implementation for development environment
|
|
79
|
+
* UsersInPrisma,
|
|
80
|
+
* // Implementation for production environment
|
|
81
|
+
* UsersInPrisma
|
|
82
|
+
* ]
|
|
83
|
+
* }
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
entries: T, getEnvironment?: EnvironmentDetector | undefined);
|
|
27
87
|
private container;
|
|
28
88
|
instance: <E extends keyof T>(entryName: E) => EntryType<T[E]>;
|
|
29
89
|
}
|