@stompbox/tape-delay 1.0.9 → 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.
Files changed (2) hide show
  1. package/dist/index.d.ts +53 -6
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -20,23 +20,70 @@ export declare const Scope: {
20
20
  ConstantValue: <T>(value: T) => ConstantValueEntry<T>;
21
21
  };
22
22
  /**
23
- * Tape Delay container.
23
+ * Tape Delay container. Takes entries and optional environment detector in the constructor.
24
24
  *
25
25
  * @example
26
26
  * ```ts
27
- * import { TapeDelay, injectable } from '@stompbox/tape-delay'
27
+ * import { TapeDelay } from '@stompbox/tape-delay'
28
+ * import { UserService } from '@/services/user.service'
28
29
  *
29
- * @injectable()
30
- * class A {}
30
+ * export const container = new TapeDelay({ UserService })
31
31
  *
32
- * const container = new TapeDelay({ A })
32
+ * const userService = container.instance('UserService')
33
33
  * ```
34
34
  */
35
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
+ */
36
59
  private readonly entries;
37
60
  private readonly getEnvironment?;
38
61
  private readonly key;
39
- constructor(entries: T, getEnvironment?: EnvironmentDetector | undefined);
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);
40
87
  private container;
41
88
  instance: <E extends keyof T>(entryName: E) => EntryType<T[E]>;
42
89
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stompbox/tape-delay",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "license": "MIT",
5
5
  "description": "Plug-and-play DI based on Inversify",
6
6
  "repository": {