@wirestate/core 0.6.0

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 (183) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/LICENSE +21 -0
  3. package/README.md +319 -0
  4. package/cjs/development/index.js +301 -0
  5. package/cjs/development/index.js.map +1 -0
  6. package/cjs/development/lib.js +1007 -0
  7. package/cjs/development/lib.js.map +1 -0
  8. package/cjs/development/test-utils.js +128 -0
  9. package/cjs/development/test-utils.js.map +1 -0
  10. package/cjs/production/index.js +1 -0
  11. package/cjs/production/index.js.map +1 -0
  12. package/cjs/production/lib.js +1 -0
  13. package/cjs/production/lib.js.map +1 -0
  14. package/cjs/production/test-utils.js +1 -0
  15. package/cjs/production/test-utils.js.map +1 -0
  16. package/esm/development/alias.js +9 -0
  17. package/esm/development/alias.js.map +1 -0
  18. package/esm/development/bind/bind-constant.js +19 -0
  19. package/esm/development/bind/bind-constant.js.map +1 -0
  20. package/esm/development/bind/bind-dynamic-value.js +28 -0
  21. package/esm/development/bind/bind-dynamic-value.js.map +1 -0
  22. package/esm/development/bind/bind-entry.js +39 -0
  23. package/esm/development/bind/bind-entry.js.map +1 -0
  24. package/esm/development/bind/bind-service.js +253 -0
  25. package/esm/development/bind/bind-service.js.map +1 -0
  26. package/esm/development/bind/get-entry-token.js +14 -0
  27. package/esm/development/bind/get-entry-token.js.map +1 -0
  28. package/esm/development/commands/command-bus.js +112 -0
  29. package/esm/development/commands/command-bus.js.map +1 -0
  30. package/esm/development/commands/command-optional.js +16 -0
  31. package/esm/development/commands/command-optional.js.map +1 -0
  32. package/esm/development/commands/command.js +16 -0
  33. package/esm/development/commands/command.js.map +1 -0
  34. package/esm/development/commands/get-command-handler-metadata.js +27 -0
  35. package/esm/development/commands/get-command-handler-metadata.js.map +1 -0
  36. package/esm/development/commands/on-command.js +26 -0
  37. package/esm/development/commands/on-command.js.map +1 -0
  38. package/esm/development/container/create-ioc-container.js +35 -0
  39. package/esm/development/container/create-ioc-container.js.map +1 -0
  40. package/esm/development/container/wire-scope.js +151 -0
  41. package/esm/development/container/wire-scope.js.map +1 -0
  42. package/esm/development/error/error-code.js +10 -0
  43. package/esm/development/error/error-code.js.map +1 -0
  44. package/esm/development/error/wirestate-error.js +29 -0
  45. package/esm/development/error/wirestate-error.js.map +1 -0
  46. package/esm/development/events/build-event-dispatcher.js +39 -0
  47. package/esm/development/events/build-event-dispatcher.js.map +1 -0
  48. package/esm/development/events/emit-event.js +20 -0
  49. package/esm/development/events/emit-event.js.map +1 -0
  50. package/esm/development/events/event-bus.js +52 -0
  51. package/esm/development/events/event-bus.js.map +1 -0
  52. package/esm/development/events/get-event-handler-metadata.js +27 -0
  53. package/esm/development/events/get-event-handler-metadata.js.map +1 -0
  54. package/esm/development/events/on-event.js +29 -0
  55. package/esm/development/events/on-event.js.map +1 -0
  56. package/esm/development/index.js +28 -0
  57. package/esm/development/index.js.map +1 -0
  58. package/esm/development/queries/get-query-handler-metadata.js +27 -0
  59. package/esm/development/queries/get-query-handler-metadata.js.map +1 -0
  60. package/esm/development/queries/on-query.js +26 -0
  61. package/esm/development/queries/on-query.js.map +1 -0
  62. package/esm/development/queries/query-bus.js +99 -0
  63. package/esm/development/queries/query-bus.js.map +1 -0
  64. package/esm/development/queries/query-optional.js +16 -0
  65. package/esm/development/queries/query-optional.js.map +1 -0
  66. package/esm/development/queries/query.js +16 -0
  67. package/esm/development/queries/query.js.map +1 -0
  68. package/esm/development/registry.js +56 -0
  69. package/esm/development/registry.js.map +1 -0
  70. package/esm/development/seeds/apply-seeds.js +21 -0
  71. package/esm/development/seeds/apply-seeds.js.map +1 -0
  72. package/esm/development/seeds/apply-shared-seed.js +14 -0
  73. package/esm/development/seeds/apply-shared-seed.js.map +1 -0
  74. package/esm/development/seeds/unapply-seeds.js +19 -0
  75. package/esm/development/seeds/unapply-seeds.js.map +1 -0
  76. package/esm/development/service/get-activated-handler-metadata.js +27 -0
  77. package/esm/development/service/get-activated-handler-metadata.js.map +1 -0
  78. package/esm/development/service/get-deactivation-handler-metadata.js +27 -0
  79. package/esm/development/service/get-deactivation-handler-metadata.js.map +1 -0
  80. package/esm/development/service/on-activated.js +21 -0
  81. package/esm/development/service/on-activated.js.map +1 -0
  82. package/esm/development/service/on-deactivation.js +21 -0
  83. package/esm/development/service/on-deactivation.js.map +1 -0
  84. package/esm/development/test-utils/mock-bind-entry.js +24 -0
  85. package/esm/development/test-utils/mock-bind-entry.js.map +1 -0
  86. package/esm/development/test-utils/mock-bind-service.js +24 -0
  87. package/esm/development/test-utils/mock-bind-service.js.map +1 -0
  88. package/esm/development/test-utils/mock-container.js +52 -0
  89. package/esm/development/test-utils/mock-container.js.map +1 -0
  90. package/esm/development/test-utils/mock-service.js +26 -0
  91. package/esm/development/test-utils/mock-service.js.map +1 -0
  92. package/esm/development/test-utils/mock-unbind-service.js +13 -0
  93. package/esm/development/test-utils/mock-unbind-service.js.map +1 -0
  94. package/esm/development/test-utils.js +6 -0
  95. package/esm/development/test-utils.js.map +1 -0
  96. package/esm/development/types/commands.js +12 -0
  97. package/esm/development/types/commands.js.map +1 -0
  98. package/esm/production/alias.js +1 -0
  99. package/esm/production/alias.js.map +1 -0
  100. package/esm/production/bind/bind-constant.js +1 -0
  101. package/esm/production/bind/bind-constant.js.map +1 -0
  102. package/esm/production/bind/bind-dynamic-value.js +1 -0
  103. package/esm/production/bind/bind-dynamic-value.js.map +1 -0
  104. package/esm/production/bind/bind-entry.js +1 -0
  105. package/esm/production/bind/bind-entry.js.map +1 -0
  106. package/esm/production/bind/bind-service.js +1 -0
  107. package/esm/production/bind/bind-service.js.map +1 -0
  108. package/esm/production/bind/get-entry-token.js +1 -0
  109. package/esm/production/bind/get-entry-token.js.map +1 -0
  110. package/esm/production/commands/command-bus.js +1 -0
  111. package/esm/production/commands/command-bus.js.map +1 -0
  112. package/esm/production/commands/command-optional.js +1 -0
  113. package/esm/production/commands/command-optional.js.map +1 -0
  114. package/esm/production/commands/command.js +1 -0
  115. package/esm/production/commands/command.js.map +1 -0
  116. package/esm/production/commands/get-command-handler-metadata.js +1 -0
  117. package/esm/production/commands/get-command-handler-metadata.js.map +1 -0
  118. package/esm/production/commands/on-command.js +1 -0
  119. package/esm/production/commands/on-command.js.map +1 -0
  120. package/esm/production/container/create-ioc-container.js +1 -0
  121. package/esm/production/container/create-ioc-container.js.map +1 -0
  122. package/esm/production/container/wire-scope.js +1 -0
  123. package/esm/production/container/wire-scope.js.map +1 -0
  124. package/esm/production/error/error-code.js +1 -0
  125. package/esm/production/error/error-code.js.map +1 -0
  126. package/esm/production/error/wirestate-error.js +1 -0
  127. package/esm/production/error/wirestate-error.js.map +1 -0
  128. package/esm/production/events/build-event-dispatcher.js +1 -0
  129. package/esm/production/events/build-event-dispatcher.js.map +1 -0
  130. package/esm/production/events/emit-event.js +1 -0
  131. package/esm/production/events/emit-event.js.map +1 -0
  132. package/esm/production/events/event-bus.js +1 -0
  133. package/esm/production/events/event-bus.js.map +1 -0
  134. package/esm/production/events/get-event-handler-metadata.js +1 -0
  135. package/esm/production/events/get-event-handler-metadata.js.map +1 -0
  136. package/esm/production/events/on-event.js +1 -0
  137. package/esm/production/events/on-event.js.map +1 -0
  138. package/esm/production/index.js +1 -0
  139. package/esm/production/index.js.map +1 -0
  140. package/esm/production/queries/get-query-handler-metadata.js +1 -0
  141. package/esm/production/queries/get-query-handler-metadata.js.map +1 -0
  142. package/esm/production/queries/on-query.js +1 -0
  143. package/esm/production/queries/on-query.js.map +1 -0
  144. package/esm/production/queries/query-bus.js +1 -0
  145. package/esm/production/queries/query-bus.js.map +1 -0
  146. package/esm/production/queries/query-optional.js +1 -0
  147. package/esm/production/queries/query-optional.js.map +1 -0
  148. package/esm/production/queries/query.js +1 -0
  149. package/esm/production/queries/query.js.map +1 -0
  150. package/esm/production/registry.js +1 -0
  151. package/esm/production/registry.js.map +1 -0
  152. package/esm/production/seeds/apply-seeds.js +1 -0
  153. package/esm/production/seeds/apply-seeds.js.map +1 -0
  154. package/esm/production/seeds/apply-shared-seed.js +1 -0
  155. package/esm/production/seeds/apply-shared-seed.js.map +1 -0
  156. package/esm/production/seeds/unapply-seeds.js +1 -0
  157. package/esm/production/seeds/unapply-seeds.js.map +1 -0
  158. package/esm/production/service/get-activated-handler-metadata.js +1 -0
  159. package/esm/production/service/get-activated-handler-metadata.js.map +1 -0
  160. package/esm/production/service/get-deactivation-handler-metadata.js +1 -0
  161. package/esm/production/service/get-deactivation-handler-metadata.js.map +1 -0
  162. package/esm/production/service/on-activated.js +1 -0
  163. package/esm/production/service/on-activated.js.map +1 -0
  164. package/esm/production/service/on-deactivation.js +1 -0
  165. package/esm/production/service/on-deactivation.js.map +1 -0
  166. package/esm/production/test-utils/mock-bind-entry.js +1 -0
  167. package/esm/production/test-utils/mock-bind-entry.js.map +1 -0
  168. package/esm/production/test-utils/mock-bind-service.js +1 -0
  169. package/esm/production/test-utils/mock-bind-service.js.map +1 -0
  170. package/esm/production/test-utils/mock-container.js +1 -0
  171. package/esm/production/test-utils/mock-container.js.map +1 -0
  172. package/esm/production/test-utils/mock-service.js +1 -0
  173. package/esm/production/test-utils/mock-service.js.map +1 -0
  174. package/esm/production/test-utils/mock-unbind-service.js +1 -0
  175. package/esm/production/test-utils/mock-unbind-service.js.map +1 -0
  176. package/esm/production/test-utils.js +1 -0
  177. package/esm/production/test-utils.js.map +1 -0
  178. package/esm/production/types/commands.js +1 -0
  179. package/esm/production/types/commands.js.map +1 -0
  180. package/index.d.ts +566 -0
  181. package/lib.d.ts +17 -0
  182. package/package.json +61 -0
  183. package/test-utils.d.ts +108 -0
@@ -0,0 +1,1007 @@
1
+ 'use strict';
2
+
3
+ var inversify = require('inversify');
4
+ var tslib = require('tslib');
5
+
6
+ var ERROR_CODE_GENERIC = 1;
7
+ var ERROR_CODE_INVALID_ARGUMENTS = 51;
8
+ var ERROR_CODE_BINDING_SCOPE = 52;
9
+ var ERROR_CODE_FAILED_TO_RESOLVE_QUERY_HANDLER = 101;
10
+ var ERROR_CODE_FAILED_TO_RESOLVE_COMMAND_HANDLER = 102;
11
+ var ERROR_CODE_ACCESS_BEFORE_ACTIVATION = 200;
12
+ var ERROR_CODE_ACCESS_AFTER_DISPOSAL = 201;
13
+
14
+ /**
15
+ * A custom error class that contains generic error information for Wirestate-related issues.
16
+ *
17
+ * This class extends the native `Error` class and is used to represent errors specific
18
+ * to the Wirestate library, providing more structured error handling.
19
+ */
20
+ var WirestateError = /** @class */function (_super) {
21
+ tslib.__extends(WirestateError, _super);
22
+ function WirestateError(code, detail) {
23
+ if (code === void 0) {
24
+ code = ERROR_CODE_GENERIC;
25
+ }
26
+ var _this = _super.call(this) || this;
27
+ /**
28
+ * Name or error class to help differentiate error class in minified environments.
29
+ */
30
+ _this.name = "WirestateError";
31
+ _this.code = code;
32
+ _this.message = detail || "Wirestate error.";
33
+ return _this;
34
+ }
35
+ return WirestateError;
36
+ }(Error);
37
+
38
+ /**
39
+ * Binds a constant value to a token in the container.
40
+ *
41
+ * @param container - target Inversify container
42
+ * @param entry - entry descriptor to bind
43
+ */
44
+ function bindConstant(container, entry) {
45
+ if (entry.scopeBindingType && entry.scopeBindingType !== inversify.bindingScopeValues.Singleton) {
46
+ throw new WirestateError(ERROR_CODE_BINDING_SCOPE, "Provided unexpected binding scope for constant value.");
47
+ }
48
+ container.bind(entry.id).toConstantValue(entry.value);
49
+ }
50
+
51
+ /**
52
+ * Binds a constant value to a token in the container.
53
+ *
54
+ * @param container - target Inversify container
55
+ * @param entry - descriptor of entry to bind
56
+ */
57
+ function bindDynamicValue(container, entry) {
58
+ var binding = container.bind(entry.id).toDynamicValue(function () {
59
+ if (entry.factory) {
60
+ return entry.factory();
61
+ }
62
+ return entry.value;
63
+ });
64
+ if (!entry.scopeBindingType) {
65
+ return;
66
+ } else if (entry.scopeBindingType === inversify.bindingScopeValues.Transient) {
67
+ binding.inTransientScope();
68
+ } else if (entry.scopeBindingType === inversify.bindingScopeValues.Request) {
69
+ binding.inRequestScope();
70
+ } else {
71
+ binding.inSingletonScope();
72
+ }
73
+ }
74
+
75
+ /**
76
+ * Command execution status.
77
+ */
78
+ exports.ECommandStatus = void 0;
79
+ (function (ECommandStatus) {
80
+ ECommandStatus["PENDING"] = "pending";
81
+ ECommandStatus["SETTLED"] = "settled";
82
+ ECommandStatus["ERROR"] = "error";
83
+ })(exports.ECommandStatus || (exports.ECommandStatus = {}));
84
+
85
+ /**
86
+ * Dispatches commands to handlers.
87
+ *
88
+ * Unlike queries, command execution always wraps the handler in a promise
89
+ * and returns a descriptor with task, status, and responder.
90
+ */
91
+ var CommandBus = /** @class */function () {
92
+ function CommandBus() {
93
+ /**
94
+ * Internal handler storage.
95
+ * Uses a stack for each command type to support shadowing.
96
+ */
97
+ this.handlers = new Map();
98
+ }
99
+ /**
100
+ * Registers a command handler.
101
+ * Returns an unregister function.
102
+ *
103
+ * @param type - command type
104
+ * @param handler - handler function
105
+ * @returns unregister function
106
+ */
107
+ CommandBus.prototype.register = function (type, handler) {
108
+ var _this = this;
109
+ var stack = this.handlers.get(type);
110
+ if (!stack) {
111
+ stack = [];
112
+ this.handlers.set(type, stack);
113
+ }
114
+ stack.push(handler);
115
+ return function () {
116
+ var current = _this.handlers.get(type);
117
+ if (!current) {
118
+ return;
119
+ }
120
+ var index = current.indexOf(handler);
121
+ if (index >= 0) {
122
+ current.splice(index, 1);
123
+ }
124
+ // Clean empty stacks.
125
+ if (current.length === 0) {
126
+ _this.handlers.delete(type);
127
+ }
128
+ };
129
+ };
130
+ /**
131
+ * Dispatches a command to the last registered handler.
132
+ * Wraps the handler execution in a promise and returns a descriptor.
133
+ *
134
+ * @param type - command type
135
+ * @param data - command payload
136
+ * @returns command descriptor with task, status, and responder
137
+ *
138
+ * @throws if no handler is registered
139
+ */
140
+ CommandBus.prototype.command = function (type, data) {
141
+ var stack = this.handlers.get(type);
142
+ if (!(stack === null || stack === void 0 ? void 0 : stack.length)) {
143
+ throw new WirestateError(ERROR_CODE_FAILED_TO_RESOLVE_COMMAND_HANDLER, "No command handler registered in container for type: '".concat(String(type), "'."));
144
+ }
145
+ var handler = stack[stack.length - 1];
146
+ var descriptor = {
147
+ task: null,
148
+ status: exports.ECommandStatus.PENDING
149
+ };
150
+ descriptor.task = Promise.resolve().then(function () {
151
+ return handler(data);
152
+ }).then(function (result) {
153
+ descriptor.status = exports.ECommandStatus.SETTLED;
154
+ return result;
155
+ }).catch(function (error) {
156
+ descriptor.status = exports.ECommandStatus.ERROR;
157
+ throw error;
158
+ });
159
+ return descriptor;
160
+ };
161
+ /**
162
+ * Dispatches a command to the last registered handler, returning null if no handler exists.
163
+ *
164
+ * @param type - command type
165
+ * @param data - command payload
166
+ * @returns command descriptor or null if no handler is registered
167
+ */
168
+ CommandBus.prototype.commandOptional = function (type, data) {
169
+ var stack = this.handlers.get(type);
170
+ return (stack === null || stack === void 0 ? void 0 : stack.length) ? this.command(type, data) : null;
171
+ };
172
+ /**
173
+ * Checks if a handler is registered for the given type.
174
+ *
175
+ * @param type - command type
176
+ * @returns true if handler exists
177
+ */
178
+ CommandBus.prototype.has = function (type) {
179
+ var _a;
180
+ return Boolean((_a = this.handlers.get(type)) === null || _a === void 0 ? void 0 : _a.length);
181
+ };
182
+ /**
183
+ * Removes all registered handlers.
184
+ */
185
+ CommandBus.prototype.clear = function () {
186
+ this.handlers.clear();
187
+ };
188
+ return CommandBus;
189
+ }();
190
+
191
+ /**
192
+ * Token for the container-scoped seeds map.
193
+ */
194
+ var SEEDS_TOKEN = Symbol("@wirestate/seeds");
195
+ /**
196
+ * Token for the container-scoped shared seed object.
197
+ */
198
+ var SEED_TOKEN = Symbol("@wirestate/seed");
199
+ /**
200
+ * Map of class constructors to their declared query handlers.
201
+ * Inherited via a prototype chain at resolve time.
202
+ */
203
+ var QUERY_HANDLER_METADATA = new WeakMap();
204
+ /**
205
+ * Map of class constructors to their declared command handlers.
206
+ * Inherited via a prototype chain at resolve time.
207
+ */
208
+ var COMMAND_HANDLER_METADATA = new WeakMap();
209
+ /**
210
+ * Map of class constructors to their `@OnActivated`-decorated method names.
211
+ * Inherited via a prototype chain at resolve time.
212
+ */
213
+ var ACTIVATED_HANDLER_METADATA = new WeakMap();
214
+ /**
215
+ * Map of class constructors to their `@OnDeactivation`-decorated method names.
216
+ * Inherited via a prototype chain at resolve time.
217
+ */
218
+ var DEACTIVATION_HANDLER_METADATA = new WeakMap();
219
+ /**
220
+ * Map of class constructors for their declared event handlers.
221
+ * Inherited via a prototype chain at resolve time.
222
+ */
223
+ var EVENT_HANDLER_METADATA = new WeakMap();
224
+ /**
225
+ * Private storage for service-to-container references.
226
+ */
227
+ var CONTAINER_REFS_BY_SERVICE = new WeakMap();
228
+ /**
229
+ * Private storage for injected WireScope instances per service.
230
+ */
231
+ var WIRE_SCOPES_BY_SERVICE = new WeakMap();
232
+ /**
233
+ * Private storage for service event unsubscribers.
234
+ */
235
+ var EVENT_UNSUBSCRIBERS_BY_SERVICE = new WeakMap();
236
+ /**
237
+ * Private storage for service query unregisters.
238
+ */
239
+ var QUERY_UNREGISTERS_BY_SERVICE = new WeakMap();
240
+ /**
241
+ * Private storage for service command unregisters.
242
+ */
243
+ var COMMAND_UNREGISTERS_BY_SERVICE = new WeakMap();
244
+
245
+ /**
246
+ * Retrieves `@OnCommand` metadata from the class hierarchy.
247
+ * Returns handlers ordered from base to derived class.
248
+ *
249
+ * @param instance - service instance
250
+ * @returns metadata list
251
+ * @internal
252
+ */
253
+ function getCommandHandlerMetadata(instance) {
254
+ var constructor = instance.constructor;
255
+ var chain = [];
256
+ // Traverse prototype chain up to Object/Function
257
+ while (typeof constructor === "function" && constructor !== Object && constructor !== Function.prototype) {
258
+ var own = COMMAND_HANDLER_METADATA.get(constructor);
259
+ if (own && own.length > 0) {
260
+ chain.push(own);
261
+ }
262
+ constructor = Object.getPrototypeOf(constructor);
263
+ }
264
+ // Reverse to ensure parent-first execution order.
265
+ return chain.reverse().flat();
266
+ }
267
+
268
+ /**
269
+ * Dispatches events to subscribers.
270
+ */
271
+ var EventBus = /** @class */function () {
272
+ function EventBus() {
273
+ this.handlers = new Set();
274
+ }
275
+ /**
276
+ * Broadcasts an event to all subscribers.
277
+ *
278
+ * @param event - event to emit
279
+ */
280
+ EventBus.prototype.emit = function (event) {
281
+ // Snapshot prevents concurrent modification errors if handlers sub/unsub during emit.
282
+ var snapshot = Array.from(this.handlers);
283
+ for (var _i = 0, snapshot_1 = snapshot; _i < snapshot_1.length; _i++) {
284
+ var handler = snapshot_1[_i];
285
+ try {
286
+ handler(event);
287
+ } catch (error) {
288
+ // Prevent one failing listener from stalling the entire bus.
289
+ console.error("[wirestate] Event handler threw:", error);
290
+ }
291
+ }
292
+ };
293
+ /**
294
+ * Subscribes a handler to all events.
295
+ * Returns an unsubscribe function.
296
+ *
297
+ * @param handler - event handler function
298
+ * @returns unsubscribe function
299
+ */
300
+ EventBus.prototype.subscribe = function (handler) {
301
+ var _this = this;
302
+ this.handlers.add(handler);
303
+ return function () {
304
+ _this.handlers.delete(handler);
305
+ };
306
+ };
307
+ /**
308
+ * Removes all registered handlers.
309
+ *
310
+ * @internal
311
+ */
312
+ EventBus.prototype.clear = function () {
313
+ this.handlers.clear();
314
+ };
315
+ return EventBus;
316
+ }();
317
+
318
+ /**
319
+ * Dispatches queries to handlers.
320
+ */
321
+ var QueryBus = /** @class */function () {
322
+ function QueryBus() {
323
+ /**
324
+ * Internal handler storage.
325
+ * Uses a stack for each query type to support shadowing (e.g., component-level vs service-level).
326
+ */
327
+ this.handlers = new Map();
328
+ }
329
+ /**
330
+ * Registers a query handler.
331
+ * Returns an unregister function.
332
+ *
333
+ * @param type - query type
334
+ * @param handler - handler function
335
+ * @returns unregister function
336
+ */
337
+ QueryBus.prototype.register = function (type, handler) {
338
+ var _this = this;
339
+ var stack = this.handlers.get(type);
340
+ if (!stack) {
341
+ stack = [];
342
+ this.handlers.set(type, stack);
343
+ }
344
+ stack.push(handler);
345
+ return function () {
346
+ var current = _this.handlers.get(type);
347
+ if (!current) {
348
+ return;
349
+ }
350
+ var index = current.indexOf(handler);
351
+ if (index >= 0) {
352
+ current.splice(index, 1);
353
+ }
354
+ // Clean empty stacks.
355
+ if (current.length === 0) {
356
+ _this.handlers.delete(type);
357
+ }
358
+ };
359
+ };
360
+ /**
361
+ * Dispatches a query to the last registered handler.
362
+ *
363
+ * @param type - query type
364
+ * @param data - query payload
365
+ * @returns query result
366
+ *
367
+ * @throws if no handler is registered
368
+ */
369
+ QueryBus.prototype.query = function (type, data) {
370
+ var stack = this.handlers.get(type);
371
+ // Always use the top of the stack (most recent registration) if handlers are available.
372
+ if (stack === null || stack === void 0 ? void 0 : stack.length) {
373
+ return stack[stack.length - 1](data);
374
+ }
375
+ throw new WirestateError(ERROR_CODE_FAILED_TO_RESOLVE_QUERY_HANDLER, "No query handler registered in container for type: '".concat(String(type), "'."));
376
+ };
377
+ /**
378
+ * Dispatches a query to the last registered handler, returning null if no handler exists.
379
+ *
380
+ * @param type - query type
381
+ * @param data - query payload
382
+ * @returns query result or null if no handler is registered
383
+ */
384
+ QueryBus.prototype.queryOptional = function (type, data) {
385
+ var stack = this.handlers.get(type);
386
+ if (stack === null || stack === void 0 ? void 0 : stack.length) {
387
+ return stack[stack.length - 1](data);
388
+ }
389
+ return null;
390
+ };
391
+ /**
392
+ * Checks if a handler is registered for the given type.
393
+ *
394
+ * @param type - query type
395
+ * @returns true if handler exists
396
+ */
397
+ QueryBus.prototype.has = function (type) {
398
+ var stack = this.handlers.get(type);
399
+ return Boolean(stack && stack.length);
400
+ };
401
+ /**
402
+ * Removes all registered handlers.
403
+ *
404
+ * @internal
405
+ */
406
+ QueryBus.prototype.clear = function () {
407
+ this.handlers.clear();
408
+ };
409
+ return QueryBus;
410
+ }();
411
+
412
+ /**
413
+ * Injectable scope providing access to wirestate buses and seeds.
414
+ * Each injecting service receives its own instance (transient scope).
415
+ * The scope is activated and deactivated automatically alongside its owner service.
416
+ */
417
+ var WireScope = /** @class */function () {
418
+ function WireScope(container) {
419
+ this.container = container;
420
+ /**
421
+ * Whether the scope was deactivated and disposed from the container.
422
+ */
423
+ this.isDisposed = false;
424
+ }
425
+ /**
426
+ * Access the IoC container.
427
+ * Available only for activated instances of scope.
428
+ *
429
+ * @returns active container
430
+ *
431
+ * @throws WirestateError if scope is not activated or already disposed
432
+ */
433
+ WireScope.prototype.getContainer = function () {
434
+ if (this.container) {
435
+ return this.container;
436
+ }
437
+ if (this.isDisposed) {
438
+ throw new WirestateError(ERROR_CODE_ACCESS_AFTER_DISPOSAL, "WireScope::container accessed after deactivation. Ensure service is properly disposed.");
439
+ } else {
440
+ throw new WirestateError(ERROR_CODE_ACCESS_BEFORE_ACTIVATION, "WireScope::container accessed before activation. " + "Ensure service is bound to container and is properly resolved.");
441
+ }
442
+ };
443
+ /**
444
+ * Resolves a sibling service or injected value.
445
+ * Use for lazy resolution or circular dependency breaking.
446
+ * Available only for activated containers.
447
+ *
448
+ * @param injectionId - injection identifier
449
+ * @returns resolved injection, service instance, or generic value
450
+ *
451
+ * @throws WirestateError if scope is not activated
452
+ */
453
+ WireScope.prototype.resolve = function (injectionId) {
454
+ return this.getContainer().get(injectionId);
455
+ };
456
+ /**
457
+ * Resolves a sibling service or injected value.
458
+ * Use for lazy resolution or circular dependency breaking.
459
+ * Available only for activated containers.
460
+ *
461
+ * @param injectionId - injection identifier
462
+ * @returns resolved injection, service instance, generic value, or null if it is not bound
463
+ *
464
+ * @throws WirestateError if scope is not activated
465
+ */
466
+ WireScope.prototype.resolveOptional = function (injectionId) {
467
+ var container = this.getContainer();
468
+ return container.isBound(injectionId) ? container.get(injectionId) : null;
469
+ };
470
+ /**
471
+ * Broadcasts an event.
472
+ * Available only for activated containers.
473
+ *
474
+ * @param type - type of event to emit
475
+ * @param payload - optional payload to send with the event
476
+ * @param from - optional sender of the event
477
+ *
478
+ * @throws WirestateError if scope is not activated
479
+ */
480
+ WireScope.prototype.emitEvent = function (type, payload, from) {
481
+ this.getContainer().get(EventBus).emit({
482
+ type: type,
483
+ payload: payload,
484
+ from: from === undefined ? this : from
485
+ });
486
+ };
487
+ /**
488
+ * Dispatches a query and returns the result.
489
+ * Available only for activated containers.
490
+ *
491
+ * @param type - query type
492
+ * @param data - query data
493
+ * @returns query result
494
+ *
495
+ * @throws WirestateError if scope is not activated
496
+ */
497
+ WireScope.prototype.queryData = function (type, data) {
498
+ return this.getContainer().get(QueryBus).query(type, data);
499
+ };
500
+ /**
501
+ * Dispatches a query and returns the result.
502
+ * Available only for activated containers.
503
+ *
504
+ * @param type - query type
505
+ * @param data - query data
506
+ * @returns query result or null if handler is not registered
507
+ */
508
+ WireScope.prototype.queryOptionalData = function (type, data) {
509
+ return this.getContainer().get(QueryBus).queryOptional(type, data);
510
+ };
511
+ /**
512
+ * Dispatches a command and returns the descriptor.
513
+ * Available only for activated containers.
514
+ *
515
+ * @param type - command type
516
+ * @param data - command data
517
+ * @returns command descriptor
518
+ *
519
+ * @throws WirestateError if scope is not activated
520
+ */
521
+ WireScope.prototype.executeCommand = function (type, data) {
522
+ return this.getContainer().get(CommandBus).command(type, data);
523
+ };
524
+ /**
525
+ * Dispatches a command and returns the descriptor.
526
+ * Available only for activated containers.
527
+ *
528
+ * @param type - command type
529
+ * @param data - command data
530
+ * @returns command descriptor or null if handler is not registered
531
+ */
532
+ WireScope.prototype.executeOptionalCommand = function (type, data) {
533
+ return this.getContainer().get(CommandBus).commandOptional(type, data);
534
+ };
535
+ /**
536
+ * Reads seed for the provided injection.
537
+ * Returns shared seed if parameters are not provided.
538
+ * Available only for activated containers.
539
+ *
540
+ * @param seed - lookup key
541
+ * @returns seed data or null if missing
542
+ *
543
+ * @throws WirestateError if context is not activated
544
+ */
545
+ WireScope.prototype.getSeed = function (seed) {
546
+ return seed ? this.getContainer().get(SEEDS_TOKEN).get(seed) || null : this.getContainer().get(SEED_TOKEN);
547
+ };
548
+ WireScope = tslib.__decorate([inversify.injectable(), tslib.__metadata("design:paramtypes", [Object])], WireScope);
549
+ return WireScope;
550
+ }();
551
+
552
+ /**
553
+ * Retrieves `@OnEvent` metadata from the class hierarchy.
554
+ * Returns handlers ordered from base to derived class.
555
+ *
556
+ * @param instance - service instance
557
+ * @returns metadata list
558
+ * @internal
559
+ */
560
+ function getEventHandlerMetadata(instance) {
561
+ var constructor = instance.constructor;
562
+ var chain = [];
563
+ // Traverse prototype chain up to Object/Function
564
+ while (typeof constructor === "function" && constructor !== Object && constructor !== Function.prototype) {
565
+ var own = EVENT_HANDLER_METADATA.get(constructor);
566
+ if (own && own.length > 0) {
567
+ chain.push(own);
568
+ }
569
+ constructor = Object.getPrototypeOf(constructor);
570
+ }
571
+ // Reverse to ensure parent-first execution order
572
+ return chain.reverse().flat();
573
+ }
574
+
575
+ /**
576
+ * Composes service event handlers into a single dispatcher.
577
+ *
578
+ * @param instance - service instance
579
+ * @returns event handler or null if no handlers are declared
580
+ * @internal
581
+ */
582
+ function buildEventDispatcher(instance) {
583
+ var entries = [];
584
+ // Register methods decorated with @OnEvent.
585
+ for (var _i = 0, _a = getEventHandlerMetadata(instance); _i < _a.length; _i++) {
586
+ var meta = _a[_i];
587
+ var method = instance[meta.methodName];
588
+ if (typeof method === "function") {
589
+ entries.push({
590
+ types: meta.types,
591
+ handler: method.bind(instance)
592
+ });
593
+ }
594
+ }
595
+ if (entries.length) {
596
+ return function (event) {
597
+ // Fan out events to all matching handlers.
598
+ for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
599
+ var entry = entries_1[_i];
600
+ if (entry.types === null || entry.types.includes(event.type)) {
601
+ entry.handler(event);
602
+ }
603
+ }
604
+ };
605
+ } else {
606
+ return null;
607
+ }
608
+ }
609
+
610
+ /**
611
+ * Retrieves `@OnQuery` metadata from the class hierarchy.
612
+ * Returns handlers ordered from base to derived class.
613
+ *
614
+ * @param instance - service instance
615
+ * @returns metadata list
616
+ * @internal
617
+ */
618
+ function getQueryHandlerMetadata(instance) {
619
+ var constructor = instance.constructor;
620
+ var chain = [];
621
+ // Traverse prototype chain up to Object/Function
622
+ while (typeof constructor === "function" && constructor !== Object && constructor !== Function.prototype) {
623
+ var own = QUERY_HANDLER_METADATA.get(constructor);
624
+ if (own && own.length > 0) {
625
+ chain.push(own);
626
+ }
627
+ constructor = Object.getPrototypeOf(constructor);
628
+ }
629
+ // Reverse to ensure parent-first execution order.
630
+ return chain.reverse().flat();
631
+ }
632
+
633
+ /**
634
+ * Retrieves `@OnActivated` method names from the class hierarchy.
635
+ * Returns method names ordered from base to derived class.
636
+ *
637
+ * @param instance - service instance
638
+ * @returns list of method names
639
+ * @internal
640
+ */
641
+ function getActivatedHandlerMetadata(instance) {
642
+ var constructor = instance.constructor;
643
+ var chain = [];
644
+ // Traverse prototype chain up to Object/Function.
645
+ while (typeof constructor === "function" && constructor !== Object && constructor !== Function.prototype) {
646
+ var own = ACTIVATED_HANDLER_METADATA.get(constructor);
647
+ if (own && own.length > 0) {
648
+ chain.push(own);
649
+ }
650
+ constructor = Object.getPrototypeOf(constructor);
651
+ }
652
+ // Reverse to ensure parent-first execution order.
653
+ return chain.reverse().flat();
654
+ }
655
+
656
+ /**
657
+ * Retrieves `@OnDeactivation` method names from the class hierarchy.
658
+ * Returns method names ordered from base to derived class.
659
+ *
660
+ * @param instance - service instance
661
+ * @returns list of method names
662
+ * @internal
663
+ */
664
+ function getDeactivationHandlerMetadata(instance) {
665
+ var constructor = instance.constructor;
666
+ var chain = [];
667
+ // Traverse prototype chain up to Object/Function.
668
+ while (typeof constructor === "function" && constructor !== Object && constructor !== Function.prototype) {
669
+ var own = DEACTIVATION_HANDLER_METADATA.get(constructor);
670
+ if (own && own.length > 0) {
671
+ chain.push(own);
672
+ }
673
+ constructor = Object.getPrototypeOf(constructor);
674
+ }
675
+ // Reverse to ensure parent-first execution order.
676
+ return chain.reverse().flat();
677
+ }
678
+
679
+ /**
680
+ * Registers a service class in the container with activation/deactivation logic.
681
+ * Ensures container references, event subscriptions, command and query handlers are managed correctly.
682
+ *
683
+ * @param container - target Inversify container
684
+ * @param entry - service constructor
685
+ * @param options - options object to control binding flow
686
+ */
687
+ function bindService(container, entry, options) {
688
+ // Inversify's fluent binding API only allows a single `.onActivation` /
689
+ // `.onDeactivation` call per chain, so we register them on the container
690
+ // itself instead — this also works correctly if a later call rebinds the
691
+ // same token.
692
+ var whenBind = container.bind(entry).to(entry).inSingletonScope();
693
+ whenBind.onActivation(function (context, instance) {
694
+ // Ensure flag is initialized on activation.
695
+ instance.IS_DISPOSED = false;
696
+ CONTAINER_REFS_BY_SERVICE.set(instance, container);
697
+ attachWireScopes(instance, entry);
698
+ // Compose all events listeners into a single bus subscription so we only
699
+ // pay one Set lookup per emitted event.
700
+ var dispatcher = buildEventDispatcher(instance);
701
+ if (dispatcher) {
702
+ attachEventsSubscription(instance, dispatcher);
703
+ }
704
+ // Register every `@OnQuery` handler on the container's QueryBus, and
705
+ // remember the unregister functions so we can roll them back when the
706
+ // service is deactivated.
707
+ var queryBus = container.get(QueryBus);
708
+ for (var _i = 0, _a = getQueryHandlerMetadata(instance); _i < _a.length; _i++) {
709
+ var meta = _a[_i];
710
+ var method = instance[meta.methodName];
711
+ if (typeof method !== "function") {
712
+ continue;
713
+ }
714
+ var unregister = queryBus.register(meta.type, method.bind(instance));
715
+ attachQueryUnregister(instance, unregister);
716
+ }
717
+ // Register every `@OnCommand` handler on the container's CommandBus, and
718
+ // remember the unregister functions so we can roll them back when the
719
+ // service is deactivated.
720
+ var commandBus = container.get(CommandBus);
721
+ for (var _b = 0, _c = getCommandHandlerMetadata(instance); _b < _c.length; _b++) {
722
+ var meta = _c[_b];
723
+ var method = instance[meta.methodName];
724
+ if (typeof method !== "function") {
725
+ continue;
726
+ }
727
+ var unregister = commandBus.register(meta.type, method.bind(instance));
728
+ attachCommandUnregister(instance, unregister);
729
+ }
730
+ if (options === null || options === void 0 ? void 0 : options.isWithIgnoreLifecycle) ; else {
731
+ var _loop_1 = function (methodName) {
732
+ var method = instance[methodName];
733
+ if (typeof method !== "function") {
734
+ return "continue";
735
+ }
736
+ var result = method.call(instance);
737
+ if (result && typeof result.then === "function") {
738
+ result.catch(function (error) {
739
+ console.error("[wirestate] @OnActivated rejected for:", entry.name, String(methodName), error);
740
+ });
741
+ }
742
+ };
743
+ // Call every `@OnActivated`-decorated method in base-to-derived order.
744
+ // Fire-and-forget any async init so we stay synchronous from the
745
+ // container's point of view.
746
+ for (var _d = 0, _e = getActivatedHandlerMetadata(instance); _d < _e.length; _d++) {
747
+ var methodName = _e[_d];
748
+ _loop_1(methodName);
749
+ }
750
+ }
751
+ return instance;
752
+ });
753
+ whenBind.onDeactivation(function (instance) {
754
+ if (options === null || options === void 0 ? void 0 : options.isWithIgnoreLifecycle) ; else {
755
+ // Call every `@OnDeactivation`-decorated method in base-to-derived order.
756
+ for (var _i = 0, _a = getDeactivationHandlerMetadata(instance); _i < _a.length; _i++) {
757
+ var methodName = _a[_i];
758
+ var method = instance[methodName];
759
+ if (typeof method === "function") {
760
+ method.call(instance);
761
+ }
762
+ }
763
+ }
764
+ // Flip the public disposal flag first so any async work already in
765
+ // flight (fetches awaiting in @Action methods, scheduled reactions,
766
+ // etc.) can short-circuit before it mutates the about-to-die instance.
767
+ // The cast is the only write-site for this `readonly` field.
768
+ instance.IS_DISPOSED = true;
769
+ detachWireScopes(instance);
770
+ detachCommandUnregister(instance);
771
+ detachQueryUnregister(instance);
772
+ detachEventSubscription(instance);
773
+ CONTAINER_REFS_BY_SERVICE.delete(instance);
774
+ });
775
+ }
776
+ /**
777
+ * Attaches a event subscription to a service.
778
+ *
779
+ * @param service - service instance
780
+ * @param handler - event handler
781
+ * @internal
782
+ */
783
+ function attachEventsSubscription(service, handler) {
784
+ var _a;
785
+ var bus = (_a = CONTAINER_REFS_BY_SERVICE.get(service)) === null || _a === void 0 ? void 0 : _a.get(EventBus);
786
+ if (bus) {
787
+ EVENT_UNSUBSCRIBERS_BY_SERVICE.set(service, bus.subscribe(handler));
788
+ }
789
+ }
790
+ /**
791
+ * Detaches the event subscription from a service.
792
+ *
793
+ * @param service - service instance
794
+ * @internal
795
+ */
796
+ function detachEventSubscription(service) {
797
+ var unsubscribe = EVENT_UNSUBSCRIBERS_BY_SERVICE.get(service);
798
+ if (unsubscribe) {
799
+ unsubscribe();
800
+ EVENT_UNSUBSCRIBERS_BY_SERVICE.delete(service);
801
+ }
802
+ }
803
+ /**
804
+ * Registers a query unregister function for a service.
805
+ *
806
+ * @param service - service instance
807
+ * @param unregister - query unregister function
808
+ * @internal
809
+ */
810
+ function attachQueryUnregister(service, unregister) {
811
+ var list = QUERY_UNREGISTERS_BY_SERVICE.get(service);
812
+ if (!list) {
813
+ list = [];
814
+ QUERY_UNREGISTERS_BY_SERVICE.set(service, list);
815
+ }
816
+ list.push(unregister);
817
+ }
818
+ /**
819
+ * Executes and removes all query unregister functions for a service.
820
+ *
821
+ * @param service - service instance
822
+ * @internal
823
+ */
824
+ function detachQueryUnregister(service) {
825
+ var list = QUERY_UNREGISTERS_BY_SERVICE.get(service);
826
+ if (!list) {
827
+ return;
828
+ }
829
+ for (var _i = 0, list_1 = list; _i < list_1.length; _i++) {
830
+ var unregister = list_1[_i];
831
+ unregister();
832
+ }
833
+ QUERY_UNREGISTERS_BY_SERVICE.delete(service);
834
+ }
835
+ /**
836
+ * Registers a command unregister function for a service.
837
+ *
838
+ * @param service - service instance
839
+ * @param unregister - command unregister function
840
+ * @internal
841
+ */
842
+ function attachCommandUnregister(service, unregister) {
843
+ var list = COMMAND_UNREGISTERS_BY_SERVICE.get(service);
844
+ if (!list) {
845
+ list = [];
846
+ COMMAND_UNREGISTERS_BY_SERVICE.set(service, list);
847
+ }
848
+ list.push(unregister);
849
+ }
850
+ /**
851
+ * Executes and removes all command unregister functions for a service.
852
+ *
853
+ * @param service - service instance
854
+ * @internal
855
+ */
856
+ function detachCommandUnregister(service) {
857
+ var list = COMMAND_UNREGISTERS_BY_SERVICE.get(service);
858
+ if (!list) {
859
+ return;
860
+ }
861
+ for (var _i = 0, list_2 = list; _i < list_2.length; _i++) {
862
+ var unregister = list_2[_i];
863
+ unregister();
864
+ }
865
+ COMMAND_UNREGISTERS_BY_SERVICE.delete(service);
866
+ }
867
+ /**
868
+ * Reads `design:paramtypes` from the service constructor to find parameters typed as WireScope.
869
+ * Property iteration happens only when the constructor metadata declares a WireScope
870
+ * parameter, avoiding false positives from manually created or subclassed scopes.
871
+ *
872
+ * todo: Simplify this part.
873
+ *
874
+ * @param service - service instance
875
+ * @param Service - service constructor
876
+ * @internal
877
+ */
878
+ function attachWireScopes(service, Service) {
879
+ var paramTypes = Reflect.getMetadata("design:paramtypes", Service);
880
+ if (!(paramTypes === null || paramTypes === void 0 ? void 0 : paramTypes.some(function (type) {
881
+ return type === WireScope;
882
+ }))) {
883
+ return;
884
+ }
885
+ var scopes = [];
886
+ for (var _i = 0, _a = Object.getOwnPropertyNames(service); _i < _a.length; _i++) {
887
+ var key = _a[_i];
888
+ var value = service[key];
889
+ if ((value === null || value === void 0 ? void 0 : value.constructor) === WireScope) {
890
+ scopes.push(value);
891
+ }
892
+ }
893
+ if (scopes.length > 0) {
894
+ WIRE_SCOPES_BY_SERVICE.set(service, scopes);
895
+ }
896
+ }
897
+ /**
898
+ * Marks all injected WireScope instances for this service as disposed and removes
899
+ * the stored references.
900
+ *
901
+ * todo: Simplify this part.
902
+ *
903
+ * @param service - service instance
904
+ * @internal
905
+ */
906
+ function detachWireScopes(service) {
907
+ var scopes = WIRE_SCOPES_BY_SERVICE.get(service);
908
+ if (!scopes) {
909
+ return;
910
+ }
911
+ for (var _i = 0, scopes_1 = scopes; _i < scopes_1.length; _i++) {
912
+ var scope = scopes_1[_i];
913
+ scope.isDisposed = true;
914
+ scope.container = null;
915
+ }
916
+ WIRE_SCOPES_BY_SERVICE.delete(service);
917
+ }
918
+
919
+ /**
920
+ * Binds a single service entry to the container, dispatching to the
921
+ * correct binding strategy based on the descriptor's `type` field.
922
+ *
923
+ * Supports:
924
+ * - Service classes (function entries) - bound as singleton
925
+ * - Constant values - bound via `bindConstant`
926
+ * - Dynamic values - bound via `toDynamicValue` with optional scope
927
+ * - Instance bindings - bound as generic singleton service
928
+ *
929
+ * @param container - target IOC container to bind into
930
+ * @param entry - entry descriptor to bind
931
+ * @param options - optional binding configuration
932
+ * @returns void
933
+ */
934
+ function bindEntry(container, entry, options) {
935
+ if (options === void 0) {
936
+ options = {};
937
+ }
938
+ if (typeof entry === "function") {
939
+ return bindService(container, entry, options);
940
+ }
941
+ if (!entry.bindingType || entry.bindingType === inversify.bindingTypeValues.ConstantValue) {
942
+ return bindConstant(container, entry);
943
+ }
944
+ if (entry.bindingType === inversify.bindingTypeValues.DynamicValue) {
945
+ return bindDynamicValue(container, entry);
946
+ }
947
+ // Default: treat as class descriptor (Instance binding).
948
+ return bindService(container, entry.value, options);
949
+ }
950
+
951
+ /**
952
+ * Returns the container token for a service entry.
953
+ * For plain service classes the class itself is the token;
954
+ * for descriptors the `id` field is used.
955
+ *
956
+ * @param entry - entry descriptor to get service identifier for
957
+ * @returns injectable identifier token
958
+ */
959
+ function getEntryToken(entry) {
960
+ return typeof entry === "function" ? entry : entry.id;
961
+ }
962
+
963
+ /**
964
+ * Creates an IoC container with framework essentials.
965
+ *
966
+ * @param options - container configuration
967
+ * @returns new IoC container
968
+ */
969
+ function createIocContainer(options) {
970
+ var _a;
971
+ if (options === void 0) {
972
+ options = {};
973
+ }
974
+ var container = new inversify.Container({
975
+ defaultScope: "Singleton",
976
+ parent: options.parent
977
+ });
978
+ container.bind(EventBus).toConstantValue(new EventBus());
979
+ container.bind(QueryBus).toConstantValue(new QueryBus());
980
+ container.bind(CommandBus).toConstantValue(new CommandBus());
981
+ container.bind(SEEDS_TOKEN).toConstantValue(new Map());
982
+ container.bind(SEED_TOKEN).toConstantValue((_a = options.seed) !== null && _a !== void 0 ? _a : {});
983
+ container.bind(WireScope).toResolvedValue(function () {
984
+ return new WireScope(container);
985
+ }).inTransientScope();
986
+ return container;
987
+ }
988
+
989
+ exports.ACTIVATED_HANDLER_METADATA = ACTIVATED_HANDLER_METADATA;
990
+ exports.COMMAND_HANDLER_METADATA = COMMAND_HANDLER_METADATA;
991
+ exports.CommandBus = CommandBus;
992
+ exports.DEACTIVATION_HANDLER_METADATA = DEACTIVATION_HANDLER_METADATA;
993
+ exports.ERROR_CODE_INVALID_ARGUMENTS = ERROR_CODE_INVALID_ARGUMENTS;
994
+ exports.EVENT_HANDLER_METADATA = EVENT_HANDLER_METADATA;
995
+ exports.EventBus = EventBus;
996
+ exports.QUERY_HANDLER_METADATA = QUERY_HANDLER_METADATA;
997
+ exports.QueryBus = QueryBus;
998
+ exports.SEEDS_TOKEN = SEEDS_TOKEN;
999
+ exports.SEED_TOKEN = SEED_TOKEN;
1000
+ exports.WireScope = WireScope;
1001
+ exports.WirestateError = WirestateError;
1002
+ exports.bindConstant = bindConstant;
1003
+ exports.bindEntry = bindEntry;
1004
+ exports.bindService = bindService;
1005
+ exports.createIocContainer = createIocContainer;
1006
+ exports.getEntryToken = getEntryToken;
1007
+ //# sourceMappingURL=lib.js.map