@wirestate/core 0.6.3 → 0.7.0-experimental.1
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/CHANGELOG.md +21 -1
- package/README.md +48 -37
- package/cjs/development/index.js +325 -91
- package/cjs/development/index.js.map +1 -1
- package/cjs/development/lib.js +1033 -248
- package/cjs/development/lib.js.map +1 -1
- package/cjs/development/test-utils.js +95 -32
- package/cjs/development/test-utils.js.map +1 -1
- package/cjs/production/index.js +1 -1
- package/cjs/production/index.js.map +1 -1
- package/cjs/production/lib.js +1 -1
- package/cjs/production/lib.js.map +1 -1
- package/cjs/production/test-utils.js +1 -1
- package/cjs/production/test-utils.js.map +1 -1
- package/esm/development/alias.js +10 -1
- package/esm/development/alias.js.map +1 -1
- package/esm/development/bind/bind-constant.js +25 -4
- package/esm/development/bind/bind-constant.js.map +1 -1
- package/esm/development/bind/bind-dynamic-value.js +27 -7
- package/esm/development/bind/bind-dynamic-value.js.map +1 -1
- package/esm/development/bind/bind-entry.js +50 -17
- package/esm/development/bind/bind-entry.js.map +1 -1
- package/esm/development/bind/bind-service.js +71 -19
- package/esm/development/bind/bind-service.js.map +1 -1
- package/esm/development/bind/get-entry-token.js +21 -5
- package/esm/development/bind/get-entry-token.js.map +1 -1
- package/esm/development/commands/command-bus.js +93 -46
- package/esm/development/commands/command-bus.js.map +1 -1
- package/esm/development/commands/command-optional.js +28 -5
- package/esm/development/commands/command-optional.js.map +1 -1
- package/esm/development/commands/command.js +26 -5
- package/esm/development/commands/command.js.map +1 -1
- package/esm/development/commands/get-command-handler-metadata.js +8 -3
- package/esm/development/commands/get-command-handler-metadata.js.map +1 -1
- package/esm/development/commands/on-command.js +19 -3
- package/esm/development/commands/on-command.js.map +1 -1
- package/esm/development/container/create-base-container.js +57 -0
- package/esm/development/container/create-base-container.js.map +1 -0
- package/esm/development/container/create-container.js +78 -0
- package/esm/development/container/create-container.js.map +1 -0
- package/esm/development/container/wire-scope.js +236 -54
- package/esm/development/container/wire-scope.js.map +1 -1
- package/esm/development/error/error-code.js +2 -1
- package/esm/development/error/error-code.js.map +1 -1
- package/esm/development/error/wirestate-error.js +25 -4
- package/esm/development/error/wirestate-error.js.map +1 -1
- package/esm/development/events/build-event-dispatcher.js +20 -2
- package/esm/development/events/build-event-dispatcher.js.map +1 -1
- package/esm/development/events/emit-event.js +18 -5
- package/esm/development/events/emit-event.js.map +1 -1
- package/esm/development/events/event-bus.js +58 -9
- package/esm/development/events/event-bus.js.map +1 -1
- package/esm/development/events/get-event-handler-metadata.js +19 -4
- package/esm/development/events/get-event-handler-metadata.js.map +1 -1
- package/esm/development/events/on-event.js +31 -2
- package/esm/development/events/on-event.js.map +1 -1
- package/esm/development/index.js +5 -4
- package/esm/development/index.js.map +1 -1
- package/esm/development/queries/get-query-handler-metadata.js +20 -4
- package/esm/development/queries/get-query-handler-metadata.js.map +1 -1
- package/esm/development/queries/on-query.js +24 -2
- package/esm/development/queries/on-query.js.map +1 -1
- package/esm/development/queries/query-bus.js +82 -31
- package/esm/development/queries/query-bus.js.map +1 -1
- package/esm/development/queries/query-optional.js +19 -5
- package/esm/development/queries/query-optional.js.map +1 -1
- package/esm/development/queries/query.js +25 -5
- package/esm/development/queries/query.js.map +1 -1
- package/esm/development/registry.js +81 -24
- package/esm/development/registry.js.map +1 -1
- package/esm/development/seeds/apply-seeds.js +19 -5
- package/esm/development/seeds/apply-seeds.js.map +1 -1
- package/esm/development/seeds/apply-shared-seed.js +16 -4
- package/esm/development/seeds/apply-shared-seed.js.map +1 -1
- package/esm/development/seeds/tokens.js +31 -0
- package/esm/development/seeds/tokens.js.map +1 -0
- package/esm/development/seeds/unapply-seeds.js +16 -5
- package/esm/development/seeds/unapply-seeds.js.map +1 -1
- package/esm/development/service/get-activated-handler-metadata.js +16 -4
- package/esm/development/service/get-activated-handler-metadata.js.map +1 -1
- package/esm/development/service/get-deactivation-handler-metadata.js +16 -4
- package/esm/development/service/get-deactivation-handler-metadata.js.map +1 -1
- package/esm/development/service/on-activated.js +22 -2
- package/esm/development/service/on-activated.js.map +1 -1
- package/esm/development/service/on-deactivation.js +22 -2
- package/esm/development/service/on-deactivation.js.map +1 -1
- package/esm/development/test-utils/mock-bind-entry.js +17 -7
- package/esm/development/test-utils/mock-bind-entry.js.map +1 -1
- package/esm/development/test-utils/mock-bind-service.js +17 -7
- package/esm/development/test-utils/mock-bind-service.js.map +1 -1
- package/esm/development/test-utils/mock-container.js +25 -8
- package/esm/development/test-utils/mock-container.js.map +1 -1
- package/esm/development/test-utils/mock-service.js +18 -5
- package/esm/development/test-utils/mock-service.js.map +1 -1
- package/esm/development/test-utils/mock-unbind-service.js +16 -3
- package/esm/development/test-utils/mock-unbind-service.js.map +1 -1
- package/esm/development/types/commands.js +6 -1
- package/esm/development/types/commands.js.map +1 -1
- package/esm/production/alias.js +1 -1
- package/esm/production/alias.js.map +1 -1
- package/esm/production/bind/bind-constant.js +1 -1
- package/esm/production/bind/bind-constant.js.map +1 -1
- package/esm/production/bind/bind-dynamic-value.js +1 -1
- package/esm/production/bind/bind-dynamic-value.js.map +1 -1
- package/esm/production/bind/bind-entry.js +1 -1
- package/esm/production/bind/bind-entry.js.map +1 -1
- package/esm/production/bind/bind-service.js.map +1 -1
- package/esm/production/bind/get-entry-token.js.map +1 -1
- package/esm/production/commands/command-bus.js +1 -1
- package/esm/production/commands/command-bus.js.map +1 -1
- package/esm/production/commands/command-optional.js.map +1 -1
- package/esm/production/commands/command.js.map +1 -1
- package/esm/production/commands/get-command-handler-metadata.js.map +1 -1
- package/esm/production/commands/on-command.js.map +1 -1
- package/esm/production/container/create-base-container.js +1 -0
- package/esm/production/container/create-base-container.js.map +1 -0
- package/esm/production/container/create-container.js +1 -0
- package/esm/production/container/create-container.js.map +1 -0
- package/esm/production/container/wire-scope.js +1 -1
- package/esm/production/container/wire-scope.js.map +1 -1
- package/esm/production/error/error-code.js +1 -1
- package/esm/production/error/error-code.js.map +1 -1
- package/esm/production/error/wirestate-error.js.map +1 -1
- package/esm/production/events/build-event-dispatcher.js.map +1 -1
- package/esm/production/events/emit-event.js.map +1 -1
- package/esm/production/events/event-bus.js +1 -1
- package/esm/production/events/event-bus.js.map +1 -1
- package/esm/production/events/get-event-handler-metadata.js.map +1 -1
- package/esm/production/events/on-event.js.map +1 -1
- package/esm/production/index.js +1 -1
- package/esm/production/queries/get-query-handler-metadata.js.map +1 -1
- package/esm/production/queries/on-query.js.map +1 -1
- package/esm/production/queries/query-bus.js +1 -1
- package/esm/production/queries/query-bus.js.map +1 -1
- package/esm/production/queries/query-optional.js.map +1 -1
- package/esm/production/queries/query.js.map +1 -1
- package/esm/production/registry.js +1 -1
- package/esm/production/registry.js.map +1 -1
- package/esm/production/seeds/apply-seeds.js +1 -1
- package/esm/production/seeds/apply-seeds.js.map +1 -1
- package/esm/production/seeds/apply-shared-seed.js +1 -1
- package/esm/production/seeds/apply-shared-seed.js.map +1 -1
- package/esm/production/seeds/tokens.js +1 -0
- package/esm/production/seeds/tokens.js.map +1 -0
- package/esm/production/seeds/unapply-seeds.js +1 -1
- package/esm/production/seeds/unapply-seeds.js.map +1 -1
- package/esm/production/service/get-activated-handler-metadata.js.map +1 -1
- package/esm/production/service/get-deactivation-handler-metadata.js.map +1 -1
- package/esm/production/service/on-activated.js.map +1 -1
- package/esm/production/service/on-deactivation.js.map +1 -1
- package/esm/production/test-utils/mock-bind-entry.js +1 -1
- package/esm/production/test-utils/mock-bind-entry.js.map +1 -1
- package/esm/production/test-utils/mock-bind-service.js +1 -1
- package/esm/production/test-utils/mock-bind-service.js.map +1 -1
- package/esm/production/test-utils/mock-container.js +1 -1
- package/esm/production/test-utils/mock-container.js.map +1 -1
- package/esm/production/test-utils/mock-service.js.map +1 -1
- package/esm/production/test-utils/mock-unbind-service.js.map +1 -1
- package/esm/production/types/commands.js.map +1 -1
- package/index.d.ts +1159 -229
- package/lib.d.ts +128 -9
- package/package.json +1 -2
- package/test-utils.d.ts +140 -40
- package/esm/development/container/create-ioc-container.js +0 -35
- package/esm/development/container/create-ioc-container.js.map +0 -1
- package/esm/production/container/create-ioc-container.js +0 -1
- package/esm/production/container/create-ioc-container.js.map +0 -1
|
@@ -3,10 +3,14 @@ import { WirestateError } from '../error/wirestate-error.js';
|
|
|
3
3
|
import { CommandStatus } from '../types/commands.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Orchestrates command dispatching and handler registration.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* The `CommandBus` provides a way to decouple command dispatchers from their handlers.
|
|
10
|
+
* It supports handler shadowing: when multiple handlers are registered for the same type,
|
|
11
|
+
* the last registered one takes priority.
|
|
12
|
+
*
|
|
13
|
+
* @group Commands
|
|
10
14
|
*/
|
|
11
15
|
var CommandBus = /** @class */function () {
|
|
12
16
|
function CommandBus() {
|
|
@@ -17,45 +21,32 @@ var CommandBus = /** @class */function () {
|
|
|
17
21
|
this.handlers = new Map();
|
|
18
22
|
}
|
|
19
23
|
/**
|
|
20
|
-
*
|
|
21
|
-
* Returns an unregister function.
|
|
22
|
-
*
|
|
23
|
-
* @param type - command type
|
|
24
|
-
* @param handler - handler function
|
|
25
|
-
* @returns unregister function
|
|
24
|
+
* Removes all registered command handlers from the bus.
|
|
26
25
|
*/
|
|
27
|
-
CommandBus.prototype.
|
|
28
|
-
|
|
29
|
-
var stack = this.handlers.get(type);
|
|
30
|
-
if (!stack) {
|
|
31
|
-
stack = [];
|
|
32
|
-
this.handlers.set(type, stack);
|
|
33
|
-
}
|
|
34
|
-
stack.push(handler);
|
|
35
|
-
return function () {
|
|
36
|
-
var current = _this.handlers.get(type);
|
|
37
|
-
if (!current) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
var index = current.indexOf(handler);
|
|
41
|
-
if (index >= 0) {
|
|
42
|
-
current.splice(index, 1);
|
|
43
|
-
}
|
|
44
|
-
// Clean empty stacks.
|
|
45
|
-
if (current.length === 0) {
|
|
46
|
-
_this.handlers.delete(type);
|
|
47
|
-
}
|
|
48
|
-
};
|
|
26
|
+
CommandBus.prototype.clear = function () {
|
|
27
|
+
this.handlers.clear();
|
|
49
28
|
};
|
|
50
29
|
/**
|
|
51
30
|
* Dispatches a command to the last registered handler.
|
|
52
|
-
* Wraps the handler execution in a promise and returns a descriptor.
|
|
53
31
|
*
|
|
54
|
-
* @
|
|
55
|
-
*
|
|
56
|
-
* @
|
|
32
|
+
* @remarks
|
|
33
|
+
* Execution is always asynchronous. The handler's return value is wrapped in a Promise.
|
|
34
|
+
* Returns a {@link CommandDescriptor} that tracks the execution status and task.
|
|
35
|
+
*
|
|
36
|
+
* @template R - Type of the command result.
|
|
37
|
+
* @template D - Type of the command payload data.
|
|
38
|
+
*
|
|
39
|
+
* @param type - Command identifier.
|
|
40
|
+
* @param data - Optional payload for the handler.
|
|
41
|
+
* @returns A descriptor for the executing command.
|
|
42
|
+
*
|
|
43
|
+
* @throws {@link WirestateError} If no handler is registered.
|
|
57
44
|
*
|
|
58
|
-
* @
|
|
45
|
+
* @example
|
|
46
|
+
* ```typescript
|
|
47
|
+
* const descriptor: CommandDescriptor<User> = commandBus.command<User, string>("GET_USER", "id-123");
|
|
48
|
+
* const user: User = await descriptor.task;
|
|
49
|
+
* ```
|
|
59
50
|
*/
|
|
60
51
|
CommandBus.prototype.command = function (type, data) {
|
|
61
52
|
var stack = this.handlers.get(type);
|
|
@@ -79,31 +70,87 @@ var CommandBus = /** @class */function () {
|
|
|
79
70
|
return descriptor;
|
|
80
71
|
};
|
|
81
72
|
/**
|
|
82
|
-
* Dispatches a command
|
|
73
|
+
* Dispatches a command if a handler exists, otherwise returns null.
|
|
83
74
|
*
|
|
84
|
-
* @
|
|
85
|
-
* @
|
|
86
|
-
*
|
|
75
|
+
* @template R - Type of the command result.
|
|
76
|
+
* @template D - Type of the command payload data.
|
|
77
|
+
*
|
|
78
|
+
* @param type - Command identifier.
|
|
79
|
+
* @param data - Optional payload for the handler.
|
|
80
|
+
* @returns A command descriptor, or `null` if no handler is found.
|
|
87
81
|
*/
|
|
88
82
|
CommandBus.prototype.commandOptional = function (type, data) {
|
|
89
83
|
var stack = this.handlers.get(type);
|
|
90
84
|
return (stack === null || stack === void 0 ? void 0 : stack.length) ? this.command(type, data) : null;
|
|
91
85
|
};
|
|
92
86
|
/**
|
|
93
|
-
* Checks if
|
|
87
|
+
* Checks if at least one handler is registered for the given command type.
|
|
94
88
|
*
|
|
95
|
-
* @param type -
|
|
96
|
-
* @returns true if handler
|
|
89
|
+
* @param type - Command identifier.
|
|
90
|
+
* @returns `true` if a handler is available, `false` otherwise.
|
|
97
91
|
*/
|
|
98
92
|
CommandBus.prototype.has = function (type) {
|
|
99
93
|
var _a;
|
|
100
94
|
return Boolean((_a = this.handlers.get(type)) === null || _a === void 0 ? void 0 : _a.length);
|
|
101
95
|
};
|
|
102
96
|
/**
|
|
103
|
-
*
|
|
97
|
+
* Registers a handler for a specific command type.
|
|
98
|
+
*
|
|
99
|
+
* @remarks
|
|
100
|
+
* If multiple handlers are registered for the same type, they are stored in a stack.
|
|
101
|
+
* The most recently registered handler will be used for dispatching.
|
|
102
|
+
*
|
|
103
|
+
* @template D - Type of the command payload data.
|
|
104
|
+
* @template R - Type of the command execution result.
|
|
105
|
+
*
|
|
106
|
+
* @param type - Command identifier.
|
|
107
|
+
* @param handler - Function to execute when the command is dispatched.
|
|
108
|
+
* @returns A function to unregister the handler.
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```typescript
|
|
112
|
+
* const unregister: CommandUnregister = commandBus.register("LOG_MESSAGE", (message: string) => {
|
|
113
|
+
* console.log(message);
|
|
114
|
+
* });
|
|
115
|
+
* ```
|
|
104
116
|
*/
|
|
105
|
-
CommandBus.prototype.
|
|
106
|
-
this
|
|
117
|
+
CommandBus.prototype.register = function (type, handler) {
|
|
118
|
+
var _this = this;
|
|
119
|
+
var stack = this.handlers.get(type);
|
|
120
|
+
if (!stack) {
|
|
121
|
+
stack = [];
|
|
122
|
+
this.handlers.set(type, stack);
|
|
123
|
+
}
|
|
124
|
+
stack.push(handler);
|
|
125
|
+
return function () {
|
|
126
|
+
return _this.unregister(type, handler);
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* Removes a previously registered command handler.
|
|
131
|
+
*
|
|
132
|
+
* @remarks
|
|
133
|
+
* If the handler was not registered for the given type, this operation does nothing.
|
|
134
|
+
*
|
|
135
|
+
* @template D - Type of the command payload data.
|
|
136
|
+
* @template R - Type of the command execution result.
|
|
137
|
+
*
|
|
138
|
+
* @param type - Command identifier.
|
|
139
|
+
* @param handler - The handler function instance to remove.
|
|
140
|
+
*/
|
|
141
|
+
CommandBus.prototype.unregister = function (type, handler) {
|
|
142
|
+
var current = this.handlers.get(type);
|
|
143
|
+
if (!current) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
var index = current.indexOf(handler);
|
|
147
|
+
if (index >= 0) {
|
|
148
|
+
current.splice(index, 1);
|
|
149
|
+
}
|
|
150
|
+
// Clean empty stacks.
|
|
151
|
+
if (current.length === 0) {
|
|
152
|
+
this.handlers.delete(type);
|
|
153
|
+
}
|
|
107
154
|
};
|
|
108
155
|
return CommandBus;
|
|
109
156
|
}();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-bus.js","sources":["../../../../../../../../src/wirestate-core/commands/command-bus.ts"],"sourcesContent":[null],"names":["CommandBus","handlers","Map","prototype","
|
|
1
|
+
{"version":3,"file":"command-bus.js","sources":["../../../../../../../../src/wirestate-core/commands/command-bus.ts"],"sourcesContent":[null],"names":["CommandBus","handlers","Map","prototype","clear","command","type","data","stack","get","length","WirestateError","ERROR_CODE_FAILED_TO_RESOLVE_COMMAND_HANDLER","concat","String","handler","descriptor","task","status","CommandStatus","PENDING","Promise","resolve","then","result","SETTLED","catch","error","ERROR","commandOptional","has","Boolean","_a","register","_this","set","push","unregister","current","index","indexOf","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,CAACrB,OAAyB,CAAC;AAErC,IAAA,OAAO,YAAA;AAAM,MAAA,OAAAmB,KAAI,CAACG,UAAU,CAAC/B,IAAI,EAAES,OAAyB,CAAC;IAAhD,CAAgD;EAC/D,CAAC;AAED;;;;;;;;;;;AAWG;EACIf,UAAA,CAAAG,SAAA,CAAAkC,UAAU,GAAjB,UAA4C/B,IAAiB,EAAES,OAA6B,EAAA;IAO1F,IAAMuB,OAAO,GAAiC,IAAI,CAACrC,QAAQ,CAACQ,GAAG,CAACH,IAAI,CAAC;IAErE,IAAI,CAACgC,OAAO,EAAE;AACZ,MAAA;AACF,IAAA;AAEA,IAAA,IAAMC,KAAK,GAAWD,OAAO,CAACE,OAAO,CAACzB,OAAyB,CAAC;IAEhE,IAAIwB,KAAK,IAAI,CAAC,EAAE;AACdD,MAAAA,OAAO,CAACG,MAAM,CAACF,KAAK,EAAE,CAAC,CAAC;AAC1B,IAAA;AAEA;AACA,IAAA,IAAID,OAAO,CAAC5B,MAAM,KAAK,CAAC,EAAE;AACxB,MAAA,IAAI,CAACT,QAAQ,CAACyC,MAAM,CAACpC,IAAI,CAAC;AAC5B,IAAA;EACF,CAAC;AACH,EAAA,OAAAN,UAAC;AAAD,CAAC;;;;"}
|
|
@@ -1,12 +1,35 @@
|
|
|
1
1
|
import { CommandBus } from './command-bus.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Dispatches a command
|
|
4
|
+
* Dispatches a command through the {@link CommandBus} resolved from the container, returning null if no handler exists.
|
|
5
5
|
*
|
|
6
|
-
* @
|
|
7
|
-
*
|
|
8
|
-
* @
|
|
9
|
-
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* This is a convenience wrapper around the `CommandBus.commandOptional` method.
|
|
8
|
+
* Unlike {@link command}, it does not throw if no handler is registered.
|
|
9
|
+
*
|
|
10
|
+
* @group Commands
|
|
11
|
+
*
|
|
12
|
+
* @template R - Type of the expected result from the command execution.
|
|
13
|
+
* @template D - Type of the data (payload) passed to the command.
|
|
14
|
+
* @template T - Type of the command identifier.
|
|
15
|
+
*
|
|
16
|
+
* @param container - Inversify {@link Container} to resolve the {@link CommandBus} from.
|
|
17
|
+
* @param type - Unique identifier of the command to dispatch.
|
|
18
|
+
* @param data - Optional payload for the command handler.
|
|
19
|
+
* @returns A {@link CommandDescriptor} if a handler was found, or `null` otherwise.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* const descriptor = commandOptional<User, FindUserOptions>(
|
|
24
|
+
* container,
|
|
25
|
+
* "FIND_USER",
|
|
26
|
+
* { id: "123" }
|
|
27
|
+
* );
|
|
28
|
+
*
|
|
29
|
+
* if (descriptor) {
|
|
30
|
+
* const user: User = await descriptor.task;
|
|
31
|
+
* }
|
|
32
|
+
* ```
|
|
10
33
|
*/
|
|
11
34
|
function commandOptional(container, type, data) {
|
|
12
35
|
return container.get(CommandBus).commandOptional(type, data);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-optional.js","sources":["../../../../../../../../src/wirestate-core/commands/command-optional.ts"],"sourcesContent":[null],"names":["commandOptional","container","type","data","get","CommandBus"],"mappings":";;AAUA
|
|
1
|
+
{"version":3,"file":"command-optional.js","sources":["../../../../../../../../src/wirestate-core/commands/command-optional.ts"],"sourcesContent":[null],"names":["commandOptional","container","type","data","get","CommandBus"],"mappings":";;AAUA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BG;SACaA,eAAeA,CAC7BC,SAAoB,EACpBC,IAAO,EACPC,IAAQ,EAAA;AAIR,EAAA,OAAOF,SAAS,CAACG,GAAG,CAACC,UAAU,CAAC,CAACL,eAAe,CAAOE,IAAI,EAAEC,IAAI,CAAC;AACpE;;;;"}
|
|
@@ -1,12 +1,33 @@
|
|
|
1
1
|
import { CommandBus } from './command-bus.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Dispatches a command
|
|
4
|
+
* Dispatches a command through the {@link CommandBus} resolved from the container.
|
|
5
5
|
*
|
|
6
|
-
* @
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* This is a convenience wrapper around the `CommandBus.command` method.
|
|
8
|
+
* Commands allow for decoupled communication between services.
|
|
9
|
+
*
|
|
10
|
+
* @group Commands
|
|
11
|
+
*
|
|
12
|
+
* @template R - Type of the expected result from the command execution.
|
|
13
|
+
* @template D - Type of the data (payload) passed to the command.
|
|
14
|
+
* @template T - Type of the command identifier.
|
|
15
|
+
*
|
|
16
|
+
* @param container - Inversify {@link Container} to resolve the {@link CommandBus} from.
|
|
17
|
+
* @param type - Unique identifier of the command to dispatch.
|
|
18
|
+
* @param data - Optional payload for the command handler.
|
|
19
|
+
* @returns A descriptor to track the command execution and result.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* const descriptor = command<User, UserFindParameters>(
|
|
24
|
+
* container,
|
|
25
|
+
* "FIND_USER",
|
|
26
|
+
* { id: "123" }
|
|
27
|
+
* );
|
|
28
|
+
*
|
|
29
|
+
* const user: User = await descriptor.task;
|
|
30
|
+
* ```
|
|
10
31
|
*/
|
|
11
32
|
function command(container, type, data) {
|
|
12
33
|
return container.get(CommandBus).command(type, data);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.js","sources":["../../../../../../../../src/wirestate-core/commands/command.ts"],"sourcesContent":[null],"names":["command","container","type","data","get","CommandBus"],"mappings":";;AASA
|
|
1
|
+
{"version":3,"file":"command.js","sources":["../../../../../../../../src/wirestate-core/commands/command.ts"],"sourcesContent":[null],"names":["command","container","type","data","get","CommandBus"],"mappings":";;AASA;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BG;SACaA,OAAOA,CACrBC,SAAoB,EACpBC,IAAO,EACPC,IAAQ,EAAA;AAIR,EAAA,OAAOF,SAAS,CAACG,GAAG,CAACC,UAAU,CAAC,CAACL,OAAO,CAAOE,IAAI,EAAEC,IAAI,CAAC;AAC5D;;;;"}
|
|
@@ -2,11 +2,16 @@ import { COMMAND_HANDLER_METADATA } from '../registry.js';
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Retrieves `@OnCommand` metadata from the class hierarchy.
|
|
5
|
-
* Returns handlers ordered from base to derived class.
|
|
6
5
|
*
|
|
7
|
-
* @
|
|
8
|
-
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* Traverses the prototype chain to collect all command handlers.
|
|
8
|
+
* Returns metadata ordered from base class to derived class to ensure parent-first execution.
|
|
9
|
+
*
|
|
10
|
+
* @group Commands
|
|
9
11
|
* @internal
|
|
12
|
+
*
|
|
13
|
+
* @param instance - The service instance to inspect.
|
|
14
|
+
* @returns A read-only array of metadata for all discovered command handlers.
|
|
10
15
|
*/
|
|
11
16
|
function getCommandHandlerMetadata(instance) {
|
|
12
17
|
var constructor = instance.constructor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-command-handler-metadata.js","sources":["../../../../../../../../src/wirestate-core/commands/get-command-handler-metadata.ts"],"sourcesContent":[null],"names":["getCommandHandlerMetadata","instance","constructor","chain","Object","Function","prototype","own","COMMAND_HANDLER_METADATA","get","length","push","getPrototypeOf","reverse","flat"],"mappings":";;AAOA
|
|
1
|
+
{"version":3,"file":"get-command-handler-metadata.js","sources":["../../../../../../../../src/wirestate-core/commands/get-command-handler-metadata.ts"],"sourcesContent":[null],"names":["getCommandHandlerMetadata","instance","constructor","chain","Object","Function","prototype","own","COMMAND_HANDLER_METADATA","get","length","push","getPrototypeOf","reverse","flat"],"mappings":";;AAOA;;;;;;;;;;;;AAYG;AACG,SAAUA,yBAAyBA,CAACC,QAAgB,EAAA;AAMxD,EAAA,IAAIC,WAAW,GAAYD,QAAQ,CAACC,WAAW;EAE/C,IAAMC,KAAK,GAAyC,EAAE;AAEtD;AACA,EAAA,OAAO,OAAOD,WAAW,KAAK,UAAU,IAAIA,WAAW,KAAKE,MAAM,IAAIF,WAAW,KAAKG,QAAQ,CAACC,SAAS,EAAE;AACxG,IAAA,IAAMC,GAAG,GAAyCC,wBAAwB,CAACC,GAAG,CAACP,WAAqB,CAAC;AAErG,IAAA,IAAIK,GAAG,IAAIA,GAAG,CAACG,MAAM,GAAG,CAAC,EAAE;AACzBP,MAAAA,KAAK,CAACQ,IAAI,CAACJ,GAAG,CAAC;AACjB,IAAA;AAEAL,IAAAA,WAAW,GAAGE,MAAM,CAACQ,cAAc,CAACV,WAAW,CAAC;AAClD,EAAA;AAQA;EACA,OAAOC,KAAK,CAACU,OAAO,EAAE,CAACC,IAAI,EAAE;AAC/B;;;;"}
|
|
@@ -1,10 +1,26 @@
|
|
|
1
1
|
import { COMMAND_HANDLER_METADATA } from '../registry.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Decorator for service methods that handle a command.
|
|
4
|
+
* Decorator for service methods that handle a specific command.
|
|
5
5
|
*
|
|
6
|
-
* @
|
|
7
|
-
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* Methods decorated with `@OnCommand` are automatically registered as command handlers
|
|
8
|
+
* when the service is bound via {@link bindService}.
|
|
9
|
+
*
|
|
10
|
+
* @group Commands
|
|
11
|
+
*
|
|
12
|
+
* @param type - Unique identifier of the command to handle.
|
|
13
|
+
* @returns A method decorator function.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* class UserService {
|
|
18
|
+
* @OnCommand("USER_LOGIN")
|
|
19
|
+
* private onUserLogin(credentials: Credentials): Promise<Session> {
|
|
20
|
+
* return auth.login(credentials);
|
|
21
|
+
* }
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
8
24
|
*/
|
|
9
25
|
function OnCommand(type) {
|
|
10
26
|
return function (target, propertyKey) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"on-command.js","sources":["../../../../../../../../src/wirestate-core/commands/on-command.ts"],"sourcesContent":[null],"names":["OnCommand","type","target","propertyKey","constructor","list","COMMAND_HANDLER_METADATA","get","set","push","methodName"],"mappings":";;AAOA
|
|
1
|
+
{"version":3,"file":"on-command.js","sources":["../../../../../../../../src/wirestate-core/commands/on-command.ts"],"sourcesContent":[null],"names":["OnCommand","type","target","propertyKey","constructor","list","COMMAND_HANDLER_METADATA","get","set","push","methodName"],"mappings":";;AAOA;;;;;;;;;;;;;;;;;;;;;AAqBG;AACG,SAAUA,SAASA,CAACC,IAAiB,EAAA;AACzC,EAAA,OAAO,UAACC,MAAM,EAAEC,WAAW,EAAA;AASzB,IAAA,IAAMC,WAAW,GAAGF,MAAM,CAACE,WAAW;AAEtC,IAAA,IAAIC,IAAI,GAAyCC,wBAAwB,CAACC,GAAG,CAACH,WAAW,CAAC;IAE1F,IAAI,CAACC,IAAI,EAAE;AACTA,MAAAA,IAAI,GAAG,EAAE;AACTC,MAAAA,wBAAwB,CAACE,GAAG,CAACJ,WAAW,EAAEC,IAAI,CAAC;AACjD,IAAA;AAEA;IACAA,IAAI,CAACI,IAAI,CAAC;AAAEC,MAAAA,UAAU,EAAEP,WAAW;AAAEF,MAAAA,IAAI,EAAAA;AAAA,KAAE,CAAC;EAC9C,CAAC;AACH;;;;"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Container } from 'inversify';
|
|
2
|
+
import { CommandBus } from '../commands/command-bus.js';
|
|
3
|
+
import { EventBus } from '../events/event-bus.js';
|
|
4
|
+
import { QueryBus } from '../queries/query-bus.js';
|
|
5
|
+
import { applySeeds } from '../seeds/apply-seeds.js';
|
|
6
|
+
import { SEEDS_TOKEN, SEED_TOKEN } from '../seeds/tokens.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Creates the foundational {@link Container} used by Wirestate.
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* This helper configures the core container primitives shared by higher-level
|
|
13
|
+
* container factories:
|
|
14
|
+
* - sets the default scope to `Singleton`
|
|
15
|
+
* - binds the core buses: {@link EventBus}, {@link QueryBus}, and {@link CommandBus}
|
|
16
|
+
* - registers the seed map tokens: `SEEDS_TOKEN` and `SEED_TOKEN`
|
|
17
|
+
* - applies any targeted seed entries passed in `options.seeds`
|
|
18
|
+
*
|
|
19
|
+
* @group Container
|
|
20
|
+
* @internal
|
|
21
|
+
*
|
|
22
|
+
* @param options - Base container configuration.
|
|
23
|
+
* @returns A configured {@link Container} instance.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* const SOME_TOKEN: unique symbol = Symbol("SOME_TOKEN");
|
|
28
|
+
*
|
|
29
|
+
* const container: Container = createBaseContainer({
|
|
30
|
+
* seed: { environment: "test" },
|
|
31
|
+
* seeds: [
|
|
32
|
+
* [SOME_TOKEN, { value: 123 }],
|
|
33
|
+
* ],
|
|
34
|
+
* });
|
|
35
|
+
*
|
|
36
|
+
* const rootSeed = container.get(SEED_TOKEN);
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
function createBaseContainer(options) {
|
|
40
|
+
var _a;
|
|
41
|
+
var container = new Container({
|
|
42
|
+
parent: options.parent,
|
|
43
|
+
defaultScope: "Singleton"
|
|
44
|
+
});
|
|
45
|
+
container.bind(EventBus).toConstantValue(new EventBus());
|
|
46
|
+
container.bind(QueryBus).toConstantValue(new QueryBus());
|
|
47
|
+
container.bind(CommandBus).toConstantValue(new CommandBus());
|
|
48
|
+
container.bind(SEEDS_TOKEN).toConstantValue(new Map());
|
|
49
|
+
container.bind(SEED_TOKEN).toConstantValue((_a = options.seed) !== null && _a !== void 0 ? _a : {});
|
|
50
|
+
if (options.seeds) {
|
|
51
|
+
applySeeds(container, options.seeds);
|
|
52
|
+
}
|
|
53
|
+
return container;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export { createBaseContainer };
|
|
57
|
+
//# sourceMappingURL=create-base-container.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-base-container.js","sources":["../../../../../../../../src/wirestate-core/container/create-base-container.ts"],"sourcesContent":[null],"names":["createBaseContainer","options","container","Container","parent","defaultScope","bind","EventBus","toConstantValue","QueryBus","CommandBus","SEEDS_TOKEN","Map","SEED_TOKEN","_a","seed","seeds","applySeeds"],"mappings":";;;;;;;AAmCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BG;AACG,SAAUA,mBAAmBA,CAACC,OAAmC,EAAA;;AACrE,EAAA,IAAMC,SAAS,GAAc,IAAIC,SAAS,CAAC;IACzCC,MAAM,EAAEH,OAAO,CAACG,MAAM;AACtBC,IAAAA,YAAY,EAAE;AACf,GAAA,CAAC;AAEFH,EAAAA,SAAS,CAACI,IAAI,CAACC,QAAQ,CAAC,CAACC,eAAe,CAAC,IAAID,QAAQ,EAAE,CAAC;AACxDL,EAAAA,SAAS,CAACI,IAAI,CAACG,QAAQ,CAAC,CAACD,eAAe,CAAC,IAAIC,QAAQ,EAAE,CAAC;AACxDP,EAAAA,SAAS,CAACI,IAAI,CAACI,UAAU,CAAC,CAACF,eAAe,CAAC,IAAIE,UAAU,EAAE,CAAC;AAE5DR,EAAAA,SAAS,CAACI,IAAI,CAACK,WAAW,CAAC,CAACH,eAAe,CAAC,IAAII,GAAG,EAAc,CAAC;EAClEV,SAAS,CAACI,IAAI,CAACO,UAAU,CAAC,CAACL,eAAe,CAAC,CAAAM,EAAA,GAAAb,OAAO,CAACc,IAAI,MAAA,IAAA,IAAAD,EAAA,KAAA,MAAA,GAAAA,EAAA,GAAI,EAAE,CAAC;EAE9D,IAAIb,OAAO,CAACe,KAAK,EAAE;AACjBC,IAAAA,UAAU,CAACf,SAAS,EAAED,OAAO,CAACe,KAAK,CAAC;AACtC,EAAA;AAEA,EAAA,OAAOd,SAAS;AAClB;;;;"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { createBaseContainer } from './create-base-container.js';
|
|
2
|
+
import { WireScope } from './wire-scope.js';
|
|
3
|
+
import { Container } from 'inversify';
|
|
4
|
+
import { bindEntry } from '../bind/bind-entry.js';
|
|
5
|
+
import { getEntryToken } from '../bind/get-entry-token.js';
|
|
6
|
+
import { ERROR_CODE_VALIDATION_ERROR } from '../error/error-code.js';
|
|
7
|
+
import { WirestateError } from '../error/wirestate-error.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Creates an Inversify IoC container pre-configured with Wirestate essentials.
|
|
11
|
+
*
|
|
12
|
+
* @remarks
|
|
13
|
+
* The container is initialized with:
|
|
14
|
+
* - State management tokens: `SEEDS_TOKEN` and `SEED_TOKEN`.
|
|
15
|
+
* - Messaging buses: {@link EventBus}, {@link QueryBus}, {@link CommandBus}.
|
|
16
|
+
* - Service bridge: {@link WireScope} (bound in transient scope).
|
|
17
|
+
* - Default scope set to `Singleton`.
|
|
18
|
+
*
|
|
19
|
+
* @group Container
|
|
20
|
+
*
|
|
21
|
+
* @param options - {@link CreateContainerOptions} configuration.
|
|
22
|
+
* @returns A new Inversify {@link Container} instance.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* const container: Container = createIocContainer({
|
|
27
|
+
* seeds: [
|
|
28
|
+
* [CounterService, { count: 1000 }],
|
|
29
|
+
* ["SOME_KEY", "VALUE"],
|
|
30
|
+
* ],
|
|
31
|
+
* entries: [CounterService, LoggerService],
|
|
32
|
+
* activate: [LoggerService]
|
|
33
|
+
* });
|
|
34
|
+
*
|
|
35
|
+
* bindService(container, MyService);
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
function createContainer(options) {
|
|
39
|
+
var _a;
|
|
40
|
+
if (options === void 0) {
|
|
41
|
+
options = {};
|
|
42
|
+
}
|
|
43
|
+
if (options.activate && options.activate.length) {
|
|
44
|
+
if (!((_a = options.entries) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
45
|
+
throw new WirestateError(ERROR_CODE_VALIDATION_ERROR, "Supplied activation list while entries for binding are not provided.");
|
|
46
|
+
}
|
|
47
|
+
var entryTokens = options.entries.map(getEntryToken);
|
|
48
|
+
for (var _i = 0, _b = options.activate; _i < _b.length; _i++) {
|
|
49
|
+
var eager = _b[_i];
|
|
50
|
+
if (!entryTokens.includes(eager)) {
|
|
51
|
+
throw new WirestateError(ERROR_CODE_VALIDATION_ERROR, "createInjectablesProvider: '".concat(String(eager), "' is listed in 'activate' but was not provided in 'entries'."));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
var container = new Container({
|
|
56
|
+
defaultScope: "Singleton",
|
|
57
|
+
parent: createBaseContainer(options)
|
|
58
|
+
});
|
|
59
|
+
container.bind(WireScope).toResolvedValue(function () {
|
|
60
|
+
return new WireScope(container);
|
|
61
|
+
}).inTransientScope();
|
|
62
|
+
if (options.entries) {
|
|
63
|
+
for (var _c = 0, _d = options.entries; _c < _d.length; _c++) {
|
|
64
|
+
var entry = _d[_c];
|
|
65
|
+
bindEntry(container, entry);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (options.activate) {
|
|
69
|
+
for (var _e = 0, _f = options.activate; _e < _f.length; _e++) {
|
|
70
|
+
var entry = _f[_e];
|
|
71
|
+
container.get(entry);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return container;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export { createContainer };
|
|
78
|
+
//# sourceMappingURL=create-container.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-container.js","sources":["../../../../../../../../src/wirestate-core/container/create-container.ts"],"sourcesContent":[null],"names":["createContainer","options","activate","length","_a","entries","WirestateError","ERROR_CODE_VALIDATION_ERROR","entryTokens","map","getEntryToken","_i","_b","eager","includes","concat","String","container","Container","defaultScope","parent","createBaseContainer","bind","WireScope","toResolvedValue","inTransientScope","_c","_d","entry","bindEntry","_e","_f","get"],"mappings":";;;;;;;;AAuDA;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BG;AACG,SAAUA,eAAeA,CAACC,O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