@wirestate/core 0.6.3 → 0.7.0-experimental.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.
Files changed (167) hide show
  1. package/CHANGELOG.md +27 -1
  2. package/README.md +48 -37
  3. package/cjs/development/index.js +325 -91
  4. package/cjs/development/index.js.map +1 -1
  5. package/cjs/development/lib.js +1033 -248
  6. package/cjs/development/lib.js.map +1 -1
  7. package/cjs/development/test-utils.js +95 -32
  8. package/cjs/development/test-utils.js.map +1 -1
  9. package/cjs/production/index.js +1 -1
  10. package/cjs/production/index.js.map +1 -1
  11. package/cjs/production/lib.js +1 -1
  12. package/cjs/production/lib.js.map +1 -1
  13. package/cjs/production/test-utils.js +1 -1
  14. package/cjs/production/test-utils.js.map +1 -1
  15. package/esm/development/alias.js +10 -1
  16. package/esm/development/alias.js.map +1 -1
  17. package/esm/development/bind/bind-constant.js +25 -4
  18. package/esm/development/bind/bind-constant.js.map +1 -1
  19. package/esm/development/bind/bind-dynamic-value.js +27 -7
  20. package/esm/development/bind/bind-dynamic-value.js.map +1 -1
  21. package/esm/development/bind/bind-entry.js +50 -17
  22. package/esm/development/bind/bind-entry.js.map +1 -1
  23. package/esm/development/bind/bind-service.js +71 -19
  24. package/esm/development/bind/bind-service.js.map +1 -1
  25. package/esm/development/bind/get-entry-token.js +21 -5
  26. package/esm/development/bind/get-entry-token.js.map +1 -1
  27. package/esm/development/commands/command-bus.js +93 -46
  28. package/esm/development/commands/command-bus.js.map +1 -1
  29. package/esm/development/commands/command-optional.js +28 -5
  30. package/esm/development/commands/command-optional.js.map +1 -1
  31. package/esm/development/commands/command.js +26 -5
  32. package/esm/development/commands/command.js.map +1 -1
  33. package/esm/development/commands/get-command-handler-metadata.js +8 -3
  34. package/esm/development/commands/get-command-handler-metadata.js.map +1 -1
  35. package/esm/development/commands/on-command.js +19 -3
  36. package/esm/development/commands/on-command.js.map +1 -1
  37. package/esm/development/container/create-base-container.js +57 -0
  38. package/esm/development/container/create-base-container.js.map +1 -0
  39. package/esm/development/container/create-container.js +78 -0
  40. package/esm/development/container/create-container.js.map +1 -0
  41. package/esm/development/container/wire-scope.js +236 -54
  42. package/esm/development/container/wire-scope.js.map +1 -1
  43. package/esm/development/error/error-code.js +2 -1
  44. package/esm/development/error/error-code.js.map +1 -1
  45. package/esm/development/error/wirestate-error.js +25 -4
  46. package/esm/development/error/wirestate-error.js.map +1 -1
  47. package/esm/development/events/build-event-dispatcher.js +20 -2
  48. package/esm/development/events/build-event-dispatcher.js.map +1 -1
  49. package/esm/development/events/emit-event.js +18 -5
  50. package/esm/development/events/emit-event.js.map +1 -1
  51. package/esm/development/events/event-bus.js +58 -9
  52. package/esm/development/events/event-bus.js.map +1 -1
  53. package/esm/development/events/get-event-handler-metadata.js +19 -4
  54. package/esm/development/events/get-event-handler-metadata.js.map +1 -1
  55. package/esm/development/events/on-event.js +31 -2
  56. package/esm/development/events/on-event.js.map +1 -1
  57. package/esm/development/index.js +5 -4
  58. package/esm/development/index.js.map +1 -1
  59. package/esm/development/queries/get-query-handler-metadata.js +20 -4
  60. package/esm/development/queries/get-query-handler-metadata.js.map +1 -1
  61. package/esm/development/queries/on-query.js +24 -2
  62. package/esm/development/queries/on-query.js.map +1 -1
  63. package/esm/development/queries/query-bus.js +82 -31
  64. package/esm/development/queries/query-bus.js.map +1 -1
  65. package/esm/development/queries/query-optional.js +19 -5
  66. package/esm/development/queries/query-optional.js.map +1 -1
  67. package/esm/development/queries/query.js +25 -5
  68. package/esm/development/queries/query.js.map +1 -1
  69. package/esm/development/registry.js +81 -24
  70. package/esm/development/registry.js.map +1 -1
  71. package/esm/development/seeds/apply-seeds.js +19 -5
  72. package/esm/development/seeds/apply-seeds.js.map +1 -1
  73. package/esm/development/seeds/apply-shared-seed.js +16 -4
  74. package/esm/development/seeds/apply-shared-seed.js.map +1 -1
  75. package/esm/development/seeds/tokens.js +31 -0
  76. package/esm/development/seeds/tokens.js.map +1 -0
  77. package/esm/development/seeds/unapply-seeds.js +16 -5
  78. package/esm/development/seeds/unapply-seeds.js.map +1 -1
  79. package/esm/development/service/get-activated-handler-metadata.js +16 -4
  80. package/esm/development/service/get-activated-handler-metadata.js.map +1 -1
  81. package/esm/development/service/get-deactivation-handler-metadata.js +16 -4
  82. package/esm/development/service/get-deactivation-handler-metadata.js.map +1 -1
  83. package/esm/development/service/on-activated.js +22 -2
  84. package/esm/development/service/on-activated.js.map +1 -1
  85. package/esm/development/service/on-deactivation.js +22 -2
  86. package/esm/development/service/on-deactivation.js.map +1 -1
  87. package/esm/development/test-utils/mock-bind-entry.js +17 -7
  88. package/esm/development/test-utils/mock-bind-entry.js.map +1 -1
  89. package/esm/development/test-utils/mock-bind-service.js +17 -7
  90. package/esm/development/test-utils/mock-bind-service.js.map +1 -1
  91. package/esm/development/test-utils/mock-container.js +25 -8
  92. package/esm/development/test-utils/mock-container.js.map +1 -1
  93. package/esm/development/test-utils/mock-service.js +18 -5
  94. package/esm/development/test-utils/mock-service.js.map +1 -1
  95. package/esm/development/test-utils/mock-unbind-service.js +16 -3
  96. package/esm/development/test-utils/mock-unbind-service.js.map +1 -1
  97. package/esm/development/types/commands.js +6 -1
  98. package/esm/development/types/commands.js.map +1 -1
  99. package/esm/production/alias.js +1 -1
  100. package/esm/production/alias.js.map +1 -1
  101. package/esm/production/bind/bind-constant.js +1 -1
  102. package/esm/production/bind/bind-constant.js.map +1 -1
  103. package/esm/production/bind/bind-dynamic-value.js +1 -1
  104. package/esm/production/bind/bind-dynamic-value.js.map +1 -1
  105. package/esm/production/bind/bind-entry.js +1 -1
  106. package/esm/production/bind/bind-entry.js.map +1 -1
  107. package/esm/production/bind/bind-service.js.map +1 -1
  108. package/esm/production/bind/get-entry-token.js.map +1 -1
  109. package/esm/production/commands/command-bus.js +1 -1
  110. package/esm/production/commands/command-bus.js.map +1 -1
  111. package/esm/production/commands/command-optional.js.map +1 -1
  112. package/esm/production/commands/command.js.map +1 -1
  113. package/esm/production/commands/get-command-handler-metadata.js.map +1 -1
  114. package/esm/production/commands/on-command.js.map +1 -1
  115. package/esm/production/container/create-base-container.js +1 -0
  116. package/esm/production/container/create-base-container.js.map +1 -0
  117. package/esm/production/container/create-container.js +1 -0
  118. package/esm/production/container/create-container.js.map +1 -0
  119. package/esm/production/container/wire-scope.js +1 -1
  120. package/esm/production/container/wire-scope.js.map +1 -1
  121. package/esm/production/error/error-code.js +1 -1
  122. package/esm/production/error/error-code.js.map +1 -1
  123. package/esm/production/error/wirestate-error.js.map +1 -1
  124. package/esm/production/events/build-event-dispatcher.js.map +1 -1
  125. package/esm/production/events/emit-event.js.map +1 -1
  126. package/esm/production/events/event-bus.js +1 -1
  127. package/esm/production/events/event-bus.js.map +1 -1
  128. package/esm/production/events/get-event-handler-metadata.js.map +1 -1
  129. package/esm/production/events/on-event.js.map +1 -1
  130. package/esm/production/index.js +1 -1
  131. package/esm/production/queries/get-query-handler-metadata.js.map +1 -1
  132. package/esm/production/queries/on-query.js.map +1 -1
  133. package/esm/production/queries/query-bus.js +1 -1
  134. package/esm/production/queries/query-bus.js.map +1 -1
  135. package/esm/production/queries/query-optional.js.map +1 -1
  136. package/esm/production/queries/query.js.map +1 -1
  137. package/esm/production/registry.js +1 -1
  138. package/esm/production/registry.js.map +1 -1
  139. package/esm/production/seeds/apply-seeds.js +1 -1
  140. package/esm/production/seeds/apply-seeds.js.map +1 -1
  141. package/esm/production/seeds/apply-shared-seed.js +1 -1
  142. package/esm/production/seeds/apply-shared-seed.js.map +1 -1
  143. package/esm/production/seeds/tokens.js +1 -0
  144. package/esm/production/seeds/tokens.js.map +1 -0
  145. package/esm/production/seeds/unapply-seeds.js +1 -1
  146. package/esm/production/seeds/unapply-seeds.js.map +1 -1
  147. package/esm/production/service/get-activated-handler-metadata.js.map +1 -1
  148. package/esm/production/service/get-deactivation-handler-metadata.js.map +1 -1
  149. package/esm/production/service/on-activated.js.map +1 -1
  150. package/esm/production/service/on-deactivation.js.map +1 -1
  151. package/esm/production/test-utils/mock-bind-entry.js +1 -1
  152. package/esm/production/test-utils/mock-bind-entry.js.map +1 -1
  153. package/esm/production/test-utils/mock-bind-service.js +1 -1
  154. package/esm/production/test-utils/mock-bind-service.js.map +1 -1
  155. package/esm/production/test-utils/mock-container.js +1 -1
  156. package/esm/production/test-utils/mock-container.js.map +1 -1
  157. package/esm/production/test-utils/mock-service.js.map +1 -1
  158. package/esm/production/test-utils/mock-unbind-service.js.map +1 -1
  159. package/esm/production/types/commands.js.map +1 -1
  160. package/index.d.ts +1159 -229
  161. package/lib.d.ts +128 -9
  162. package/package.json +1 -2
  163. package/test-utils.d.ts +140 -40
  164. package/esm/development/container/create-ioc-container.js +0 -35
  165. package/esm/development/container/create-ioc-container.js.map +0 -1
  166. package/esm/production/container/create-ioc-container.js +0 -1
  167. package/esm/production/container/create-ioc-container.js.map +0 -1
@@ -1,50 +1,119 @@
1
1
  'use strict';
2
2
 
3
3
  var inversify = require('inversify');
4
- var createIocContainer = require('./lib.js');
4
+ var createContainer = require('./lib.js');
5
5
  var tslib = require('tslib');
6
6
 
7
+ /**
8
+ * Util to resolve circular dependencies by wrapping the service identifier in a lazy identifier.
9
+ *
10
+ * @group External-inversify
11
+ * @see {@link https://inversify.io/}
12
+ *
13
+ * @param forward - A function that returns the service identifier.
14
+ * @returns A lazy service identifier.
15
+ */
7
16
  function forwardRef(forward) {
8
17
  return new inversify.LazyServiceIdentifier(forward);
9
18
  }
10
19
 
11
20
  /**
12
- * Dispatches a command on the provided container.
21
+ * Dispatches a command through the {@link CommandBus} resolved from the container.
22
+ *
23
+ * @remarks
24
+ * This is a convenience wrapper around the `CommandBus.command` method.
25
+ * Commands allow for decoupled communication between services.
26
+ *
27
+ * @group Commands
28
+ *
29
+ * @template R - Type of the expected result from the command execution.
30
+ * @template D - Type of the data (payload) passed to the command.
31
+ * @template T - Type of the command identifier.
32
+ *
33
+ * @param container - Inversify {@link Container} to resolve the {@link CommandBus} from.
34
+ * @param type - Unique identifier of the command to dispatch.
35
+ * @param data - Optional payload for the command handler.
36
+ * @returns A descriptor to track the command execution and result.
37
+ *
38
+ * @example
39
+ * ```typescript
40
+ * const descriptor = command<User, UserFindParameters>(
41
+ * container,
42
+ * "FIND_USER",
43
+ * { id: "123" }
44
+ * );
13
45
  *
14
- * @param container - inversify container
15
- * @param type - command type
16
- * @param data - command data
17
- * @returns command descriptor
46
+ * const user: User = await descriptor.task;
47
+ * ```
18
48
  */
19
49
  function command(container, type, data) {
20
- return container.get(createIocContainer.CommandBus).command(type, data);
50
+ return container.get(createContainer.CommandBus).command(type, data);
21
51
  }
22
52
 
23
53
  /**
24
- * Dispatches a command on the provided container, returning null if no handler is registered.
54
+ * Dispatches a command through the {@link CommandBus} resolved from the container, returning null if no handler exists.
25
55
  *
26
- * @param container - inversify container
27
- * @param type - command type
28
- * @param data - command data
29
- * @returns command descriptor or null
56
+ * @remarks
57
+ * This is a convenience wrapper around the `CommandBus.commandOptional` method.
58
+ * Unlike {@link command}, it does not throw if no handler is registered.
59
+ *
60
+ * @group Commands
61
+ *
62
+ * @template R - Type of the expected result from the command execution.
63
+ * @template D - Type of the data (payload) passed to the command.
64
+ * @template T - Type of the command identifier.
65
+ *
66
+ * @param container - Inversify {@link Container} to resolve the {@link CommandBus} from.
67
+ * @param type - Unique identifier of the command to dispatch.
68
+ * @param data - Optional payload for the command handler.
69
+ * @returns A {@link CommandDescriptor} if a handler was found, or `null` otherwise.
70
+ *
71
+ * @example
72
+ * ```typescript
73
+ * const descriptor = commandOptional<User, FindUserOptions>(
74
+ * container,
75
+ * "FIND_USER",
76
+ * { id: "123" }
77
+ * );
78
+ *
79
+ * if (descriptor) {
80
+ * const user: User = await descriptor.task;
81
+ * }
82
+ * ```
30
83
  */
31
84
  function commandOptional(container, type, data) {
32
- return container.get(createIocContainer.CommandBus).commandOptional(type, data);
85
+ return container.get(createContainer.CommandBus).commandOptional(type, data);
33
86
  }
34
87
 
35
88
  /**
36
- * Decorator for service methods that handle a command.
89
+ * Decorator for service methods that handle a specific command.
37
90
  *
38
- * @param type - command type identifier
39
- * @returns decorator function
91
+ * @remarks
92
+ * Methods decorated with `@OnCommand` are automatically registered as command handlers
93
+ * when the service is bound via {@link bindService}.
94
+ *
95
+ * @group Commands
96
+ *
97
+ * @param type - Unique identifier of the command to handle.
98
+ * @returns A method decorator function.
99
+ *
100
+ * @example
101
+ * ```typescript
102
+ * class UserService {
103
+ * @OnCommand("USER_LOGIN")
104
+ * private onUserLogin(credentials: Credentials): Promise<Session> {
105
+ * return auth.login(credentials);
106
+ * }
107
+ * }
108
+ * ```
40
109
  */
41
110
  function OnCommand(type) {
42
111
  return function (target, propertyKey) {
43
112
  var constructor = target.constructor;
44
- var list = createIocContainer.COMMAND_HANDLER_METADATA.get(constructor);
113
+ var list = createContainer.COMMAND_HANDLER_METADATA.get(constructor);
45
114
  if (!list) {
46
115
  list = [];
47
- createIocContainer.COMMAND_HANDLER_METADATA.set(constructor, list);
116
+ createContainer.COMMAND_HANDLER_METADATA.set(constructor, list);
48
117
  }
49
118
  // Register handler metadata for prototype-based retrieval.
50
119
  list.push({
@@ -55,15 +124,28 @@ function OnCommand(type) {
55
124
  }
56
125
 
57
126
  /**
58
- * Emits events for container from outside scope.
127
+ * Broadcasts an event to all subscribers via the {@link EventBus} resolved from the container.
128
+ *
129
+ * @remarks
130
+ * Use this utility to emit events from outside a service's {@link WireScope} (e.g., from a bootstrap script or external controller).
59
131
  *
60
- * @param container - inversify container
61
- * @param type - event type ot emit
62
- * @param payload - event payload
63
- * @param from - optional indicator of the event source
132
+ * @group Events
133
+ *
134
+ * @template P - Type of the event payload.
135
+ * @template T - Type of the event identifier.
136
+ *
137
+ * @param container - Inversify {@link Container} to resolve the {@link EventBus} from.
138
+ * @param type - Unique event identifier.
139
+ * @param payload - Optional data associated with the event.
140
+ * @param from - Optional source identifier.
141
+ *
142
+ * @example
143
+ * ```typescript
144
+ * emitEvent(container, "SYSTEM_READY", { version: "1.0.0" });
145
+ * ```
64
146
  */
65
147
  function emitEvent(container, type, payload, from) {
66
- container.get(createIocContainer.EventBus).emit({
148
+ container.get(createContainer.EventBus).emit({
67
149
  type: type,
68
150
  payload: payload,
69
151
  from: from
@@ -73,18 +155,47 @@ function emitEvent(container, type, payload, from) {
73
155
  /**
74
156
  * Decorator for service methods that respond to events.
75
157
  *
76
- * @param types - event type(s) to handle. If omitted, handles all events
77
- * @returns decorator function
158
+ * @remarks
159
+ * Methods decorated with `@OnEvent` are automatically registered as subscribers
160
+ * when the service is bound via {@link bindService}.
161
+ *
162
+ * You can specify one or more event types to handle. If `types` is omitted,
163
+ * the method acts as a catch-all handler for all events broadcasted to the {@link EventBus}.
164
+ *
165
+ * @group Events
166
+ *
167
+ * @param types - Event identifier(s) to handle. If omitted, handles all events.
168
+ * @returns Method decorator.
169
+ *
170
+ * @example
171
+ * ```typescript
172
+ * class MyService {
173
+ * @OnEvent("USER_LOGGED_IN")
174
+ * private onLogin(event: Event<User>): void {
175
+ * console.log("User logged in:", event);
176
+ * }
177
+ *
178
+ * @OnEvent(["LOGOUT", "SESSION_EXPIRED"])
179
+ * private onSessionEnd(event: Event): void {
180
+ * console.log("Specific event received:", event);
181
+ * }
182
+ *
183
+ * @OnEvent()
184
+ * private onAnyEvent(event: Event): void {
185
+ * // Catch-all handler
186
+ * }
187
+ * }
188
+ * ```
78
189
  */
79
190
  function OnEvent(types) {
80
191
  // Normalize types to an array or null for catch-all.
81
192
  var normalized = types === undefined ? null : Array.isArray(types) ? tslib.__spreadArray([], types, true) : [types];
82
193
  return function (target, propertyKey) {
83
194
  var constructor = target.constructor;
84
- var list = createIocContainer.EVENT_HANDLER_METADATA.get(constructor);
195
+ var list = createContainer.EVENT_HANDLER_METADATA.get(constructor);
85
196
  if (!list) {
86
197
  list = [];
87
- createIocContainer.EVENT_HANDLER_METADATA.set(constructor, list);
198
+ createContainer.EVENT_HANDLER_METADATA.set(constructor, list);
88
199
  }
89
200
  // Register handler metadata for prototype-based retrieval.
90
201
  list.push({
@@ -95,42 +206,98 @@ function OnEvent(types) {
95
206
  }
96
207
 
97
208
  /**
98
- * Dispatches a query on the provided container.
209
+ * Dispatches a query through the {@link QueryBus} resolved from the container.
99
210
  *
100
- * @param container - inversify container
101
- * @param type - query type
102
- * @param data - query data
103
- * @returns query result
211
+ * @remarks
212
+ * This is a convenience wrapper around the `QueryBus.query` method.
213
+ * Queries allow for decoupled request-response communication between services.
214
+ *
215
+ * @group Queries
216
+ *
217
+ * @template R - Type of the expected query result.
218
+ * @template D - Type of the input data (payload).
219
+ *
220
+ * @param container - Inversify {@link Container} to resolve the {@link QueryBus} from.
221
+ * @param type - Unique query identifier.
222
+ * @param data - Optional input data for the query handler.
223
+ * @returns The query result (can be a Promise).
224
+ *
225
+ * @throws {@link WirestateError} If no query handler is registered.
226
+ *
227
+ * @example
228
+ * ```typescript
229
+ * const result: string = await query<string, FindUserParameters>(
230
+ * container,
231
+ * "GET_USER_NAME",
232
+ * { id: 123 }
233
+ * );
234
+ * ```
104
235
  */
105
236
  function query(container, type, data) {
106
- return container.get(createIocContainer.QueryBus).query(type, data);
237
+ return container.get(createContainer.QueryBus).query(type, data);
107
238
  }
108
239
 
109
240
  /**
110
- * Dispatches a query on the provided container, returning null if no handler is registered.
241
+ * Dispatches a query through the {@link QueryBus}, returning null if no handler is registered.
242
+ *
243
+ * @remarks
244
+ * This is a convenience wrapper around the `QueryBus.queryOptional` method.
245
+ * Use this when the query resolution is optional and you want to avoid catching errors.
246
+ *
247
+ * @group Queries
248
+ *
249
+ * @template R - Type of the expected query result.
250
+ * @template D - Type of the input data (payload).
251
+ *
252
+ * @param container - Inversify {@link Container} to resolve the {@link QueryBus} from.
253
+ * @param type - Unique query identifier.
254
+ * @param data - Optional input data for the query handler.
255
+ * @returns The query result or `null` if no handler exists.
111
256
  *
112
- * @param container - inversify container
113
- * @param type - query type
114
- * @param data - query data
115
- * @returns query result or null
257
+ * @example
258
+ * ```typescript
259
+ * const config: Config | null = await queryOptional<Config>(container, "GET_OPTIONAL_CONFIG");
260
+ * ```
116
261
  */
117
262
  function queryOptional(container, type, data) {
118
- return container.get(createIocContainer.QueryBus).queryOptional(type, data);
263
+ return container.get(createContainer.QueryBus).queryOptional(type, data);
119
264
  }
120
265
 
121
266
  /**
122
267
  * Decorator for service methods that respond to a query.
123
268
  *
124
- * @param type - query type identifier
125
- * @returns decorator function
269
+ * @remarks
270
+ * Methods decorated with `@OnQuery` are automatically registered as query handlers
271
+ * when the service is bound via {@link bindService}.
272
+ *
273
+ * Unlike events, queries MUST be handled by exactly one handler. If multiple handlers
274
+ * are registered for the same query type, the most recent one (usually the most
275
+ * specific in terms of class hierarchy or registration order) will shadow the others.
276
+ *
277
+ * @group Queries
278
+ *
279
+ * @param type - Unique query identifier to handle.
280
+ * @returns Method decorator.
281
+ *
282
+ * @example
283
+ * ```typescript
284
+ * class UserProfileService {
285
+ * @OnQuery("GET_USER_AVATAR")
286
+ * private async onGetUserAvatar(userId: string): Promise<string> {
287
+ * const user: User = await this.userRepository.findById(userId);
288
+ *
289
+ * return user.avatarUrl;
290
+ * }
291
+ * }
292
+ * ```
126
293
  */
127
294
  function OnQuery(type) {
128
295
  return function (target, propertyKey) {
129
296
  var constructor = target.constructor;
130
- var list = createIocContainer.QUERY_HANDLER_METADATA.get(constructor);
297
+ var list = createContainer.QUERY_HANDLER_METADATA.get(constructor);
131
298
  if (!list) {
132
299
  list = [];
133
- createIocContainer.QUERY_HANDLER_METADATA.set(constructor, list);
300
+ createContainer.QUERY_HANDLER_METADATA.set(constructor, list);
134
301
  }
135
302
  // Register handler metadata for prototype-based retrieval.
136
303
  list.push({
@@ -141,41 +308,47 @@ function OnQuery(type) {
141
308
  }
142
309
 
143
310
  /**
144
- * Applies seeds to the container into the existing instance instead of replacing it.
145
- * This allows multiple providers to co-exist without wiping each other's seeds.
311
+ * Rebinds the global shared seed object in the container.
146
312
  *
147
- * @param container - target container
148
- * @param seeds - targeted seed entries apply
149
- */
150
- function applySeeds(container, seeds) {
151
- var existing = container.get(createIocContainer.SEEDS_TOKEN);
152
- for (var _i = 0, seeds_1 = seeds; _i < seeds_1.length; _i++) {
153
- var _a = seeds_1[_i],
154
- key = _a[0],
155
- state = _a[1];
156
- existing.set(key, state);
157
- }
158
- }
159
-
160
- /**
161
- * Applies shared seed to the container.
313
+ * @remarks
314
+ * Unlike targeted seeds, there is only one shared seed object per container.
315
+ * This function uses `rebind` to ensure the new shared seed replaces the previous one.
316
+ * The shared seed is typically used for global configuration or common state.
317
+ *
318
+ * @group Seeds
162
319
  *
163
- * @param container - target container
164
- * @param seed - shared seed object
320
+ * @param container - The Inversify {@link Container} to update.
321
+ * @param seed - The new shared seed object.
322
+ *
323
+ * @example
324
+ * ```typescript
325
+ * applySharedSeed(container, { theme: "dark", lang: "en" });
326
+ * ```
165
327
  */
166
328
  function applySharedSeed(container, seed) {
167
- container.rebind(createIocContainer.SEED_TOKEN).toConstantValue(seed);
329
+ container.rebind(createContainer.SEED_TOKEN).toConstantValue(seed);
168
330
  }
169
331
 
170
332
  /**
171
- * Removes specific seeds from the container.
172
- * Used during provider unmounting to clean up only the entries owned by that provider.
333
+ * Removes specific targeted seeds from the container's internal seed map.
334
+ *
335
+ * @remarks
336
+ * This is typically called during provider unmounting to ensure that only
337
+ * the seeds owned by that specific provider are removed, leaving other
338
+ * providers' seeds intact.
173
339
  *
174
- * @param container - target container
175
- * @param seeds - targeted seeds to remove
340
+ * @group Seeds
341
+ *
342
+ * @param container - The Inversify {@link Container} to clean up.
343
+ * @param seeds - The targeted {@link SeedEntries} to remove.
344
+ *
345
+ * @example
346
+ * ```typescript
347
+ * unapplySeeds(container, [[UserService, { initialUser: "admin" }]]);
348
+ * ```
176
349
  */
177
350
  function unapplySeeds(container, seeds) {
178
- var existing = container.get(createIocContainer.SEEDS_TOKEN);
351
+ var existing = container.get(createContainer.SEEDS_TOKEN);
179
352
  for (var _i = 0, seeds_1 = seeds; _i < seeds_1.length; _i++) {
180
353
  var key = seeds_1[_i][0];
181
354
  existing.delete(key);
@@ -183,34 +356,74 @@ function unapplySeeds(container, seeds) {
183
356
  }
184
357
 
185
358
  /**
186
- * Decorator for service methods that run after activation.
359
+ * Decorator for service methods that should be executed after the service instance is activated.
360
+ *
361
+ * @remarks
362
+ * Methods decorated with `@OnActivated` are automatically invoked when the service
363
+ * is resolved from the container and its activation lifecycle hook is triggered.
364
+ *
365
+ * It is commonly used for initial setup, subscribing to events, or starting background tasks.
366
+ * Multiple `@OnActivated` methods can exist in the same class hierarchy; they are executed
367
+ * in parent-to-child order.
187
368
  *
188
- * @returns decorator function
369
+ * @group Service
370
+ *
371
+ * @returns A method decorator function.
372
+ *
373
+ * @example
374
+ * ```typescript
375
+ * class MyService {
376
+ * @OnActivated()
377
+ * public onActivated(): void {
378
+ * console.log("Service activated!");
379
+ * }
380
+ * }
381
+ * ```
189
382
  */
190
383
  function OnActivated() {
191
384
  return function (target, propertyKey) {
192
385
  var constructor = target.constructor;
193
- var list = createIocContainer.ACTIVATED_HANDLER_METADATA.get(constructor);
386
+ var list = createContainer.ACTIVATED_HANDLER_METADATA.get(constructor);
194
387
  if (!list) {
195
388
  list = [];
196
- createIocContainer.ACTIVATED_HANDLER_METADATA.set(constructor, list);
389
+ createContainer.ACTIVATED_HANDLER_METADATA.set(constructor, list);
197
390
  }
198
391
  list.push(propertyKey);
199
392
  };
200
393
  }
201
394
 
202
395
  /**
203
- * Decorator for service methods that run before deactivation.
396
+ * Decorator for service methods that should be executed before the service instance is deactivated.
397
+ *
398
+ * @remarks
399
+ * Methods decorated with `@OnDeactivation` are automatically invoked when the service
400
+ * is being removed from the container or when the container itself is being disposed.
401
+ *
402
+ * It is commonly used for cleanup, unsubscribing from events, or stopping background tasks.
403
+ * Multiple `@OnDeactivation` methods can exist in the same class hierarchy; they are executed
404
+ * in parent-to-child order.
405
+ *
406
+ * @group Service
204
407
  *
205
- * @returns decorator function
408
+ * @returns A method decorator function.
409
+ *
410
+ * @example
411
+ * ```typescript
412
+ * class MyService {
413
+ * @OnDeactivation()
414
+ * public onDeactivation(): void {
415
+ * console.log("Service deactivating!");
416
+ * }
417
+ * }
418
+ * ```
206
419
  */
207
420
  function OnDeactivation() {
208
421
  return function (target, propertyKey) {
209
422
  var constructor = target.constructor;
210
- var list = createIocContainer.DEACTIVATION_HANDLER_METADATA.get(constructor);
423
+ var list = createContainer.DEACTIVATION_HANDLER_METADATA.get(constructor);
211
424
  if (!list) {
212
425
  list = [];
213
- createIocContainer.DEACTIVATION_HANDLER_METADATA.set(constructor, list);
426
+ createContainer.DEACTIVATION_HANDLER_METADATA.set(constructor, list);
214
427
  }
215
428
  list.push(propertyKey);
216
429
  };
@@ -232,6 +445,14 @@ Object.defineProperty(exports, "Inject", {
232
445
  enumerable: true,
233
446
  get: function () { return inversify.inject; }
234
447
  });
448
+ Object.defineProperty(exports, "InjectFromBase", {
449
+ enumerable: true,
450
+ get: function () { return inversify.injectFromBase; }
451
+ });
452
+ Object.defineProperty(exports, "InjectFromHierarchy", {
453
+ enumerable: true,
454
+ get: function () { return inversify.injectFromHierarchy; }
455
+ });
235
456
  Object.defineProperty(exports, "Injectable", {
236
457
  enumerable: true,
237
458
  get: function () { return inversify.injectable; }
@@ -268,28 +489,41 @@ Object.defineProperty(exports, "Tagged", {
268
489
  enumerable: true,
269
490
  get: function () { return inversify.tagged; }
270
491
  });
271
- exports.CommandBus = createIocContainer.CommandBus;
492
+ Object.defineProperty(exports, "Unmanaged", {
493
+ enumerable: true,
494
+ get: function () { return inversify.unmanaged; }
495
+ });
496
+ Object.defineProperty(exports, "bindingScopeValues", {
497
+ enumerable: true,
498
+ get: function () { return inversify.bindingScopeValues; }
499
+ });
500
+ Object.defineProperty(exports, "bindingTypeValues", {
501
+ enumerable: true,
502
+ get: function () { return inversify.bindingTypeValues; }
503
+ });
504
+ exports.CommandBus = createContainer.CommandBus;
272
505
  Object.defineProperty(exports, "CommandStatus", {
273
506
  enumerable: true,
274
- get: function () { return createIocContainer.CommandStatus; }
507
+ get: function () { return createContainer.CommandStatus; }
275
508
  });
276
- exports.EventBus = createIocContainer.EventBus;
277
- exports.QueryBus = createIocContainer.QueryBus;
278
- exports.SEED = createIocContainer.SEED_TOKEN;
279
- exports.SEEDS = createIocContainer.SEEDS_TOKEN;
280
- exports.WireScope = createIocContainer.WireScope;
281
- exports.WirestateError = createIocContainer.WirestateError;
282
- exports.bindConstant = createIocContainer.bindConstant;
283
- exports.bindEntry = createIocContainer.bindEntry;
284
- exports.bindService = createIocContainer.bindService;
285
- exports.createIocContainer = createIocContainer.createIocContainer;
286
- exports.getEntryToken = createIocContainer.getEntryToken;
509
+ exports.EventBus = createContainer.EventBus;
510
+ exports.QueryBus = createContainer.QueryBus;
511
+ exports.SEED = createContainer.SEED_TOKEN;
512
+ exports.SEEDS = createContainer.SEEDS_TOKEN;
513
+ exports.WireScope = createContainer.WireScope;
514
+ exports.WirestateError = createContainer.WirestateError;
515
+ exports.applySeeds = createContainer.applySeeds;
516
+ exports.bindConstant = createContainer.bindConstant;
517
+ exports.bindDynamicValue = createContainer.bindDynamicValue;
518
+ exports.bindEntry = createContainer.bindEntry;
519
+ exports.bindService = createContainer.bindService;
520
+ exports.createContainer = createContainer.createContainer;
521
+ exports.getEntryToken = createContainer.getEntryToken;
287
522
  exports.OnActivated = OnActivated;
288
523
  exports.OnCommand = OnCommand;
289
524
  exports.OnDeactivation = OnDeactivation;
290
525
  exports.OnEvent = OnEvent;
291
526
  exports.OnQuery = OnQuery;
292
- exports.applySeeds = applySeeds;
293
527
  exports.applySharedSeed = applySharedSeed;
294
528
  exports.command = command;
295
529
  exports.commandOptional = commandOptional;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../../../../src/wirestate-core/alias.ts","../../../../../../../src/wirestate-core/commands/command.ts","../../../../../../../src/wirestate-core/commands/command-optional.ts","../../../../../../../src/wirestate-core/commands/on-command.ts","../../../../../../../src/wirestate-core/events/emit-event.ts","../../../../../../../src/wirestate-core/events/on-event.ts","../../../../../../../src/wirestate-core/queries/query.ts","../../../../../../../src/wirestate-core/queries/query-optional.ts","../../../../../../../src/wirestate-core/queries/on-query.ts","../../../../../../../src/wirestate-core/seeds/apply-seeds.ts","../../../../../../../src/wirestate-core/seeds/apply-shared-seed.ts","../../../../../../../src/wirestate-core/seeds/unapply-seeds.ts","../../../../../../../src/wirestate-core/service/on-activated.ts","../../../../../../../src/wirestate-core/service/on-deactivation.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null],"names":["forwardRef","forward","LazyServiceIdentifier","command","container","type","data","get","CommandBus","commandOptional","OnCommand","target","propertyKey","constructor","list","COMMAND_HANDLER_METADATA","set","push","methodName","emitEvent","payload","from","EventBus","emit","OnEvent","types","normalized","undefined","Array","isArray","__spreadArray","EVENT_HANDLER_METADATA","query","QueryBus","queryOptional","OnQuery","QUERY_HANDLER_METADATA","applySeeds","seeds","existing","SEEDS_TOKEN","_i","seeds_1","_a","key","state","applySharedSeed","seed","rebind","SEED_TOKEN","toConstantValue","unapplySeeds","delete","OnActivated","ACTIVATED_HANDLER_METADATA","OnDeactivation","DEACTIVATION_HANDLER_METADATA"],"mappings":";;;;;;AAoBM,SAAUA,UAAUA,CACxBC,OAA2C,EAAA;AAE3C,EAAA,OAAO,IAAIC,+BAAqB,CAACD,OAAO,CAAC;AAC3C;;ACfA;;;;;;;AAOG;SACaE,OAAOA,CACrBC,SAAoB,EACpBC,IAAO,EACPC,IAAQ,EAAA;AAIR,EAAA,OAAOF,SAAS,CAACG,GAAG,CAACC,6BAAU,CAAC,CAACL,OAAO,CAAOE,IAAI,EAAEC,IAAI,CAAC;AAC5D;;ACfA;;;;;;;AAOG;SACaG,eAAeA,CAC7BL,SAAoB,EACpBC,IAAO,EACPC,IAAQ,EAAA;AAIR,EAAA,OAAOF,SAAS,CAACG,GAAG,CAACC,6BAAU,CAAC,CAACC,eAAe,CAAOJ,IAAI,EAAEC,IAAI,CAAC;AACpE;;ACnBA;;;;;AAKG;AACG,SAAUI,SAASA,CAACL,IAAiB,EAAA;AACzC,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AW,EAAEC,IAAI,CAAC;AACnD,IAAA;AAEAA,IAAAA,IAAI,CAACG,IAAI,CAACL,WAAW,CAAC;EACxB,CAAC;AACH;;ACzBA;;;;AAIG;SACa2C,cAAcA,GAAA;AAC5B,EAAA,OAAO,UAAC5C,MAAM,EAAEC,WAAW,EAAA;AAQzB,IAAA,IAAMC,WAAW,GAAIF,MAAiB,CAACE,WAAW;AAElD,IAAA,IAAIC,IAAI,GAAkC0C,gDAA6B,CAACjD,GAAG,CAACM,WAAW,CAAC;IAExF,IAAI,CAACC,IAAI,EAAE;AACTA,MAAAA,IAAI,GAAG,EAAE;AACT0C,MAAAA,gDAA6B,CAACxC,GAAG,CAACH,WAAW,EAAEC,IAAI,CAAC;AACtD,IAAA;AAEAA,IAAAA,IAAI,CAACG,IAAI,CAACL,WAAW,CAAC;EACxB,CAAC;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../../../../src/wirestate-core/alias.ts","../../../../../../../src/wirestate-core/commands/command.ts","../../../../../../../src/wirestate-core/commands/command-optional.ts","../../../../../../../src/wirestate-core/commands/on-command.ts","../../../../../../../src/wirestate-core/events/emit-event.ts","../../../../../../../src/wirestate-core/events/on-event.ts","../../../../../../../src/wirestate-core/queries/query.ts","../../../../../../../src/wirestate-core/queries/query-optional.ts","../../../../../../../src/wirestate-core/queries/on-query.ts","../../../../../../../src/wirestate-core/seeds/apply-shared-seed.ts","../../../../../../../src/wirestate-core/seeds/unapply-seeds.ts","../../../../../../../src/wirestate-core/service/on-activated.ts","../../../../../../../src/wirestate-core/service/on-deactivation.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null],"names":["forwardRef","forward","LazyServiceIdentifier","command","container","type","data","get","CommandBus","commandOptional","OnCommand","target","propertyKey","constructor","list","COMMAND_HANDLER_METADATA","set","push","methodName","emitEvent","payload","from","EventBus","emit","OnEvent","types","normalized","undefined","Array","isArray","__spreadArray","EVENT_HANDLER_METADATA","query","QueryBus","queryOptional","OnQuery","QUERY_HANDLER_METADATA","applySharedSeed","seed","rebind","SEED_TOKEN","toConstantValue","unapplySeeds","seeds","existing","SEEDS_TOKEN","_i","seeds_1","key","delete","OnActivated","ACTIVATED_HANDLER_METADATA","OnDeactivation","DEACTIVATION_HANDLER_METADATA"],"mappings":";;;;;;AAgFA;;;;;;;;AAQG;AACG,SAAUA,UAAUA,CACxBC,OAA2C,EAAA;AAE3C,EAAA,OAAO,IAAIC,+BAAqB,CAACD,OAAO,CAAC;AAC3C;;ACpFA;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BG;SACaE,OAAOA,CACrBC,SAAoB,EACpBC,IAAO,EACPC,IAAQ,EAAA;AAIR,EAAA,OAAOF,SAAS,CAACG,GAAG,CAACC,0BAAU,CAAC,CAACL,OAAO,CAAOE,IAAI,EAAEC,IAAI,CAAC;AAC5D;;ACpCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BG;SACaG,eAAeA,CAC7BL,SAAoB,EACpBC,IAAO,EACPC,IAAQ,EAAA;AAIR,EAAA,OAAOF,SAAS,CAACG,GAAG,CAACC,0BAAU,CAAC,CAACC,eAAe,CAAOJ,IAAI,EAAEC,IAAI,CAAC;AACpE;;AC1CA;;;;;;;;;;;;;;;;;;;;;AAqBG;AACG,SAAUI,SAASA,CAACL,IAAiB,EAAA;AACzC,EAAA,OAAO,UAACM,MAAM,EAAEC,WAAW,EAAA;AASzB,IAAA,IAAMC,WAAW,GAAGF,MAAM,CAACE,WAAW;AAEtC,IAAA,IAAIC,IAAI,GAAyCC,wCAAwB,CAACR,GAAG,CAACM,WAAW,CAAC;IAE1F,IAAI,CAACC,IAAI,EAAE;AACTA,MAAAA,IAAI,GAAG,EAAE;AACTC,MAAAA,wCAAwB,CAACC,GAAG,CAACH,WAAW,EAAEC,IAAI,CAAC;AACjD,IAAA;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