@wirestate/react 0.6.0 → 0.6.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.
- package/CHANGELOG.md +9 -0
- package/cjs/development/index.js +2 -2
- package/cjs/development/index.js.map +1 -1
- package/cjs/development/lib.js +4 -4
- package/cjs/development/lib.js.map +1 -1
- package/cjs/development/test-utils.js +2 -1050
- package/cjs/development/test-utils.js.map +1 -1
- package/cjs/production/index.js.map +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/commands/use-command-caller.js.map +1 -0
- package/esm/development/commands/use-command-handler.js.map +1 -0
- package/esm/development/commands/use-optional-command-caller.js.map +1 -0
- package/esm/development/error/error-code.js.map +1 -0
- package/esm/development/events/use-event-emitter.js.map +1 -0
- package/esm/development/events/use-event.js.map +1 -0
- package/esm/development/events/use-events-handler.js.map +1 -0
- package/esm/development/{wirestate-react/events → events}/use-events.js +0 -1
- package/esm/development/events/use-events.js.map +1 -0
- package/esm/development/{wirestate-react/provision → provision}/create-injectables-provider.js +2 -2
- package/esm/development/provision/create-injectables-provider.js.map +1 -0
- package/esm/development/{wirestate-react/provision → provision}/ioc-context.js +3 -3
- package/esm/development/provision/ioc-context.js.map +1 -0
- package/esm/development/{wirestate-react/provision → provision}/ioc-provider.js +2 -2
- package/esm/development/provision/ioc-provider.js.map +1 -0
- package/esm/development/provision/use-container-revision.js.map +1 -0
- package/esm/development/provision/use-container.js.map +1 -0
- package/esm/development/provision/use-injection.js.map +1 -0
- package/esm/development/{wirestate-react/provision → provision}/use-ioc-context.js +2 -2
- package/esm/development/provision/use-ioc-context.js.map +1 -0
- package/esm/development/provision/use-optional-injection.js.map +1 -0
- package/esm/development/queries/use-optional-query-caller.js.map +1 -0
- package/esm/development/queries/use-optional-sync-query-caller.js.map +1 -0
- package/esm/development/queries/use-query-caller.js.map +1 -0
- package/esm/development/queries/use-query-handler.js.map +1 -0
- package/esm/development/queries/use-sync-query-caller.js.map +1 -0
- package/esm/development/{wirestate-react/test-utils → test-utils}/with-ioc-provider.js +1 -7
- package/esm/development/test-utils/with-ioc-provider.js.map +1 -0
- package/esm/production/commands/use-command-caller.js.map +1 -0
- package/esm/production/commands/use-command-handler.js.map +1 -0
- package/esm/production/commands/use-optional-command-caller.js.map +1 -0
- package/esm/production/error/error-code.js.map +1 -0
- package/esm/production/events/use-event-emitter.js.map +1 -0
- package/esm/production/events/use-event.js.map +1 -0
- package/esm/production/events/use-events-handler.js.map +1 -0
- package/esm/production/events/use-events.js +1 -0
- package/esm/production/events/use-events.js.map +1 -0
- package/esm/production/provision/create-injectables-provider.js +1 -0
- package/esm/production/provision/create-injectables-provider.js.map +1 -0
- package/esm/production/provision/ioc-context.js +1 -0
- package/esm/production/provision/ioc-context.js.map +1 -0
- package/esm/production/provision/ioc-provider.js +1 -0
- package/esm/production/provision/ioc-provider.js.map +1 -0
- package/esm/production/provision/use-container-revision.js.map +1 -0
- package/esm/production/provision/use-container.js.map +1 -0
- package/esm/production/provision/use-injection.js.map +1 -0
- package/esm/production/provision/use-ioc-context.js +1 -0
- package/esm/production/provision/use-ioc-context.js.map +1 -0
- package/esm/production/provision/use-optional-injection.js.map +1 -0
- package/esm/production/queries/use-optional-query-caller.js.map +1 -0
- package/esm/production/queries/use-optional-sync-query-caller.js.map +1 -0
- package/esm/production/queries/use-query-caller.js.map +1 -0
- package/esm/production/queries/use-query-handler.js.map +1 -0
- package/esm/production/queries/use-sync-query-caller.js.map +1 -0
- package/esm/production/test-utils/with-ioc-provider.js +1 -0
- package/esm/production/test-utils/with-ioc-provider.js.map +1 -0
- package/index.d.ts +47 -11
- package/package.json +1 -1
- package/esm/development/wirestate-core/bind/bind-constant.js +0 -19
- package/esm/development/wirestate-core/bind/bind-constant.js.map +0 -1
- package/esm/development/wirestate-core/bind/bind-dynamic-value.js +0 -28
- package/esm/development/wirestate-core/bind/bind-dynamic-value.js.map +0 -1
- package/esm/development/wirestate-core/bind/bind-entry.js +0 -39
- package/esm/development/wirestate-core/bind/bind-entry.js.map +0 -1
- package/esm/development/wirestate-core/bind/bind-service.js +0 -253
- package/esm/development/wirestate-core/bind/bind-service.js.map +0 -1
- package/esm/development/wirestate-core/bind/get-entry-token.js +0 -14
- package/esm/development/wirestate-core/bind/get-entry-token.js.map +0 -1
- package/esm/development/wirestate-core/commands/command-bus.js +0 -112
- package/esm/development/wirestate-core/commands/command-bus.js.map +0 -1
- package/esm/development/wirestate-core/commands/get-command-handler-metadata.js +0 -27
- package/esm/development/wirestate-core/commands/get-command-handler-metadata.js.map +0 -1
- package/esm/development/wirestate-core/container/create-ioc-container.js +0 -35
- package/esm/development/wirestate-core/container/create-ioc-container.js.map +0 -1
- package/esm/development/wirestate-core/container/wire-scope.js +0 -151
- package/esm/development/wirestate-core/container/wire-scope.js.map +0 -1
- package/esm/development/wirestate-core/error/error-code.js +0 -10
- package/esm/development/wirestate-core/error/error-code.js.map +0 -1
- package/esm/development/wirestate-core/error/wirestate-error.js +0 -29
- package/esm/development/wirestate-core/error/wirestate-error.js.map +0 -1
- package/esm/development/wirestate-core/events/build-event-dispatcher.js +0 -39
- package/esm/development/wirestate-core/events/build-event-dispatcher.js.map +0 -1
- package/esm/development/wirestate-core/events/event-bus.js +0 -52
- package/esm/development/wirestate-core/events/event-bus.js.map +0 -1
- package/esm/development/wirestate-core/events/get-event-handler-metadata.js +0 -27
- package/esm/development/wirestate-core/events/get-event-handler-metadata.js.map +0 -1
- package/esm/development/wirestate-core/queries/get-query-handler-metadata.js +0 -27
- package/esm/development/wirestate-core/queries/get-query-handler-metadata.js.map +0 -1
- package/esm/development/wirestate-core/queries/query-bus.js +0 -99
- package/esm/development/wirestate-core/queries/query-bus.js.map +0 -1
- package/esm/development/wirestate-core/registry.js +0 -56
- package/esm/development/wirestate-core/registry.js.map +0 -1
- package/esm/development/wirestate-core/service/get-activated-handler-metadata.js +0 -27
- package/esm/development/wirestate-core/service/get-activated-handler-metadata.js.map +0 -1
- package/esm/development/wirestate-core/service/get-deactivation-handler-metadata.js +0 -27
- package/esm/development/wirestate-core/service/get-deactivation-handler-metadata.js.map +0 -1
- package/esm/development/wirestate-core/test-utils/mock-bind-entry.js +0 -24
- package/esm/development/wirestate-core/test-utils/mock-bind-entry.js.map +0 -1
- package/esm/development/wirestate-core/test-utils/mock-container.js +0 -52
- package/esm/development/wirestate-core/test-utils/mock-container.js.map +0 -1
- package/esm/development/wirestate-core/types/commands.js +0 -12
- package/esm/development/wirestate-core/types/commands.js.map +0 -1
- package/esm/development/wirestate-react/commands/use-command-caller.js.map +0 -1
- package/esm/development/wirestate-react/commands/use-command-handler.js.map +0 -1
- package/esm/development/wirestate-react/commands/use-optional-command-caller.js.map +0 -1
- package/esm/development/wirestate-react/error/error-code.js.map +0 -1
- package/esm/development/wirestate-react/events/use-event-emitter.js.map +0 -1
- package/esm/development/wirestate-react/events/use-event.js.map +0 -1
- package/esm/development/wirestate-react/events/use-events-handler.js.map +0 -1
- package/esm/development/wirestate-react/events/use-events.js.map +0 -1
- package/esm/development/wirestate-react/provision/create-injectables-provider.js.map +0 -1
- package/esm/development/wirestate-react/provision/ioc-context.js.map +0 -1
- package/esm/development/wirestate-react/provision/ioc-provider.js.map +0 -1
- package/esm/development/wirestate-react/provision/use-container-revision.js.map +0 -1
- package/esm/development/wirestate-react/provision/use-container.js.map +0 -1
- package/esm/development/wirestate-react/provision/use-injection.js.map +0 -1
- package/esm/development/wirestate-react/provision/use-ioc-context.js.map +0 -1
- package/esm/development/wirestate-react/provision/use-optional-injection.js.map +0 -1
- package/esm/development/wirestate-react/queries/use-optional-query-caller.js.map +0 -1
- package/esm/development/wirestate-react/queries/use-optional-sync-query-caller.js.map +0 -1
- package/esm/development/wirestate-react/queries/use-query-caller.js.map +0 -1
- package/esm/development/wirestate-react/queries/use-query-handler.js.map +0 -1
- package/esm/development/wirestate-react/queries/use-sync-query-caller.js.map +0 -1
- package/esm/development/wirestate-react/test-utils/with-ioc-provider.js.map +0 -1
- package/esm/production/wirestate-core/bind/bind-constant.js +0 -1
- package/esm/production/wirestate-core/bind/bind-constant.js.map +0 -1
- package/esm/production/wirestate-core/bind/bind-dynamic-value.js +0 -1
- package/esm/production/wirestate-core/bind/bind-dynamic-value.js.map +0 -1
- package/esm/production/wirestate-core/bind/bind-entry.js +0 -1
- package/esm/production/wirestate-core/bind/bind-entry.js.map +0 -1
- package/esm/production/wirestate-core/bind/bind-service.js +0 -1
- package/esm/production/wirestate-core/bind/bind-service.js.map +0 -1
- package/esm/production/wirestate-core/bind/get-entry-token.js +0 -1
- package/esm/production/wirestate-core/bind/get-entry-token.js.map +0 -1
- package/esm/production/wirestate-core/commands/command-bus.js +0 -1
- package/esm/production/wirestate-core/commands/command-bus.js.map +0 -1
- package/esm/production/wirestate-core/commands/get-command-handler-metadata.js +0 -1
- package/esm/production/wirestate-core/commands/get-command-handler-metadata.js.map +0 -1
- package/esm/production/wirestate-core/container/create-ioc-container.js +0 -1
- package/esm/production/wirestate-core/container/create-ioc-container.js.map +0 -1
- package/esm/production/wirestate-core/container/wire-scope.js +0 -1
- package/esm/production/wirestate-core/container/wire-scope.js.map +0 -1
- package/esm/production/wirestate-core/error/error-code.js +0 -1
- package/esm/production/wirestate-core/error/error-code.js.map +0 -1
- package/esm/production/wirestate-core/error/wirestate-error.js +0 -1
- package/esm/production/wirestate-core/error/wirestate-error.js.map +0 -1
- package/esm/production/wirestate-core/events/build-event-dispatcher.js +0 -1
- package/esm/production/wirestate-core/events/build-event-dispatcher.js.map +0 -1
- package/esm/production/wirestate-core/events/event-bus.js +0 -1
- package/esm/production/wirestate-core/events/event-bus.js.map +0 -1
- package/esm/production/wirestate-core/events/get-event-handler-metadata.js +0 -1
- package/esm/production/wirestate-core/events/get-event-handler-metadata.js.map +0 -1
- package/esm/production/wirestate-core/queries/get-query-handler-metadata.js +0 -1
- package/esm/production/wirestate-core/queries/get-query-handler-metadata.js.map +0 -1
- package/esm/production/wirestate-core/queries/query-bus.js +0 -1
- package/esm/production/wirestate-core/queries/query-bus.js.map +0 -1
- package/esm/production/wirestate-core/registry.js +0 -1
- package/esm/production/wirestate-core/registry.js.map +0 -1
- package/esm/production/wirestate-core/service/get-activated-handler-metadata.js +0 -1
- package/esm/production/wirestate-core/service/get-activated-handler-metadata.js.map +0 -1
- package/esm/production/wirestate-core/service/get-deactivation-handler-metadata.js +0 -1
- package/esm/production/wirestate-core/service/get-deactivation-handler-metadata.js.map +0 -1
- package/esm/production/wirestate-core/test-utils/mock-bind-entry.js +0 -1
- package/esm/production/wirestate-core/test-utils/mock-bind-entry.js.map +0 -1
- package/esm/production/wirestate-core/test-utils/mock-container.js +0 -1
- package/esm/production/wirestate-core/test-utils/mock-container.js.map +0 -1
- package/esm/production/wirestate-core/types/commands.js +0 -1
- package/esm/production/wirestate-core/types/commands.js.map +0 -1
- package/esm/production/wirestate-react/commands/use-command-caller.js.map +0 -1
- package/esm/production/wirestate-react/commands/use-command-handler.js.map +0 -1
- package/esm/production/wirestate-react/commands/use-optional-command-caller.js.map +0 -1
- package/esm/production/wirestate-react/error/error-code.js.map +0 -1
- package/esm/production/wirestate-react/events/use-event-emitter.js.map +0 -1
- package/esm/production/wirestate-react/events/use-event.js.map +0 -1
- package/esm/production/wirestate-react/events/use-events-handler.js.map +0 -1
- package/esm/production/wirestate-react/events/use-events.js +0 -1
- package/esm/production/wirestate-react/events/use-events.js.map +0 -1
- package/esm/production/wirestate-react/provision/create-injectables-provider.js +0 -1
- package/esm/production/wirestate-react/provision/create-injectables-provider.js.map +0 -1
- package/esm/production/wirestate-react/provision/ioc-context.js +0 -1
- package/esm/production/wirestate-react/provision/ioc-context.js.map +0 -1
- package/esm/production/wirestate-react/provision/ioc-provider.js +0 -1
- package/esm/production/wirestate-react/provision/ioc-provider.js.map +0 -1
- package/esm/production/wirestate-react/provision/use-container-revision.js.map +0 -1
- package/esm/production/wirestate-react/provision/use-container.js.map +0 -1
- package/esm/production/wirestate-react/provision/use-injection.js.map +0 -1
- package/esm/production/wirestate-react/provision/use-ioc-context.js +0 -1
- package/esm/production/wirestate-react/provision/use-ioc-context.js.map +0 -1
- package/esm/production/wirestate-react/provision/use-optional-injection.js.map +0 -1
- package/esm/production/wirestate-react/queries/use-optional-query-caller.js.map +0 -1
- package/esm/production/wirestate-react/queries/use-optional-sync-query-caller.js.map +0 -1
- package/esm/production/wirestate-react/queries/use-query-caller.js.map +0 -1
- package/esm/production/wirestate-react/queries/use-query-handler.js.map +0 -1
- package/esm/production/wirestate-react/queries/use-sync-query-caller.js.map +0 -1
- package/esm/production/wirestate-react/test-utils/with-ioc-provider.js +0 -1
- package/esm/production/wirestate-react/test-utils/with-ioc-provider.js.map +0 -1
- /package/esm/development/{wirestate-react/commands → commands}/use-command-caller.js +0 -0
- /package/esm/development/{wirestate-react/commands → commands}/use-command-handler.js +0 -0
- /package/esm/development/{wirestate-react/commands → commands}/use-optional-command-caller.js +0 -0
- /package/esm/development/{wirestate-react/error → error}/error-code.js +0 -0
- /package/esm/development/{wirestate-react/events → events}/use-event-emitter.js +0 -0
- /package/esm/development/{wirestate-react/events → events}/use-event.js +0 -0
- /package/esm/development/{wirestate-react/events → events}/use-events-handler.js +0 -0
- /package/esm/development/{wirestate-react/index.js → index.js} +0 -0
- /package/esm/development/{wirestate-react/index.js.map → index.js.map} +0 -0
- /package/esm/development/{wirestate-react/provision → provision}/use-container-revision.js +0 -0
- /package/esm/development/{wirestate-react/provision → provision}/use-container.js +0 -0
- /package/esm/development/{wirestate-react/provision → provision}/use-injection.js +0 -0
- /package/esm/development/{wirestate-react/provision → provision}/use-optional-injection.js +0 -0
- /package/esm/development/{wirestate-react/queries → queries}/use-optional-query-caller.js +0 -0
- /package/esm/development/{wirestate-react/queries → queries}/use-optional-sync-query-caller.js +0 -0
- /package/esm/development/{wirestate-react/queries → queries}/use-query-caller.js +0 -0
- /package/esm/development/{wirestate-react/queries → queries}/use-query-handler.js +0 -0
- /package/esm/development/{wirestate-react/queries → queries}/use-sync-query-caller.js +0 -0
- /package/esm/development/{wirestate-react/test-utils.js → test-utils.js} +0 -0
- /package/esm/development/{wirestate-react/test-utils.js.map → test-utils.js.map} +0 -0
- /package/esm/production/{wirestate-react/commands → commands}/use-command-caller.js +0 -0
- /package/esm/production/{wirestate-react/commands → commands}/use-command-handler.js +0 -0
- /package/esm/production/{wirestate-react/commands → commands}/use-optional-command-caller.js +0 -0
- /package/esm/production/{wirestate-react/error → error}/error-code.js +0 -0
- /package/esm/production/{wirestate-react/events → events}/use-event-emitter.js +0 -0
- /package/esm/production/{wirestate-react/events → events}/use-event.js +0 -0
- /package/esm/production/{wirestate-react/events → events}/use-events-handler.js +0 -0
- /package/esm/production/{wirestate-react/index.js → index.js} +0 -0
- /package/esm/production/{wirestate-react/index.js.map → index.js.map} +0 -0
- /package/esm/production/{wirestate-react/provision → provision}/use-container-revision.js +0 -0
- /package/esm/production/{wirestate-react/provision → provision}/use-container.js +0 -0
- /package/esm/production/{wirestate-react/provision → provision}/use-injection.js +0 -0
- /package/esm/production/{wirestate-react/provision → provision}/use-optional-injection.js +0 -0
- /package/esm/production/{wirestate-react/queries → queries}/use-optional-query-caller.js +0 -0
- /package/esm/production/{wirestate-react/queries → queries}/use-optional-sync-query-caller.js +0 -0
- /package/esm/production/{wirestate-react/queries → queries}/use-query-caller.js +0 -0
- /package/esm/production/{wirestate-react/queries → queries}/use-query-handler.js +0 -0
- /package/esm/production/{wirestate-react/queries → queries}/use-sync-query-caller.js +0 -0
- /package/esm/production/{wirestate-react/test-utils.js → test-utils.js} +0 -0
- /package/esm/production/{wirestate-react/test-utils.js.map → test-utils.js.map} +0 -0
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { COMMAND_HANDLER_METADATA } from '../registry.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Retrieves `@OnCommand` metadata from the class hierarchy.
|
|
5
|
-
* Returns handlers ordered from base to derived class.
|
|
6
|
-
*
|
|
7
|
-
* @param instance - service instance
|
|
8
|
-
* @returns metadata list
|
|
9
|
-
* @internal
|
|
10
|
-
*/
|
|
11
|
-
function getCommandHandlerMetadata(instance) {
|
|
12
|
-
var constructor = instance.constructor;
|
|
13
|
-
var chain = [];
|
|
14
|
-
// Traverse prototype chain up to Object/Function
|
|
15
|
-
while (typeof constructor === "function" && constructor !== Object && constructor !== Function.prototype) {
|
|
16
|
-
var own = COMMAND_HANDLER_METADATA.get(constructor);
|
|
17
|
-
if (own && own.length > 0) {
|
|
18
|
-
chain.push(own);
|
|
19
|
-
}
|
|
20
|
-
constructor = Object.getPrototypeOf(constructor);
|
|
21
|
-
}
|
|
22
|
-
// Reverse to ensure parent-first execution order.
|
|
23
|
-
return chain.reverse().flat();
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export { getCommandHandlerMetadata };
|
|
27
|
-
//# sourceMappingURL=get-command-handler-metadata.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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;;;;;;;AAOG;AACG,SAAUA,yBAAyBA,CAACC,QAAgB,EAAA;AAMxD,EAAA,IAAIC,WAAW,GAAYD,QAAQ,CAACC,WAAW;EAE/C,IAAMC,KAAK,GAA0C,EAAE;AAEvD;AACA,EAAA,OAAO,OAAOD,WAAW,KAAK,UAAU,IAAIA,WAAW,KAAKE,MAAM,IAAIF,WAAW,KAAKG,QAAQ,CAACC,SAAS,EAAE;AACxG,IAAA,IAAMC,GAAG,GAA0CC,wBAAwB,CAACC,GAAG,CAACP,WAAqB,CAAC;AAEtG,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,35 +0,0 @@
|
|
|
1
|
-
import { Container } from 'inversify';
|
|
2
|
-
import { CommandBus } from '../commands/command-bus.js';
|
|
3
|
-
import { WireScope } from './wire-scope.js';
|
|
4
|
-
import { EventBus } from '../events/event-bus.js';
|
|
5
|
-
import { QueryBus } from '../queries/query-bus.js';
|
|
6
|
-
import { SEEDS_TOKEN, SEED_TOKEN } from '../registry.js';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Creates an IoC container with framework essentials.
|
|
10
|
-
*
|
|
11
|
-
* @param options - container configuration
|
|
12
|
-
* @returns new IoC container
|
|
13
|
-
*/
|
|
14
|
-
function createIocContainer(options) {
|
|
15
|
-
var _a;
|
|
16
|
-
if (options === void 0) {
|
|
17
|
-
options = {};
|
|
18
|
-
}
|
|
19
|
-
var container = new Container({
|
|
20
|
-
defaultScope: "Singleton",
|
|
21
|
-
parent: options.parent
|
|
22
|
-
});
|
|
23
|
-
container.bind(EventBus).toConstantValue(new EventBus());
|
|
24
|
-
container.bind(QueryBus).toConstantValue(new QueryBus());
|
|
25
|
-
container.bind(CommandBus).toConstantValue(new CommandBus());
|
|
26
|
-
container.bind(SEEDS_TOKEN).toConstantValue(new Map());
|
|
27
|
-
container.bind(SEED_TOKEN).toConstantValue((_a = options.seed) !== null && _a !== void 0 ? _a : {});
|
|
28
|
-
container.bind(WireScope).toResolvedValue(function () {
|
|
29
|
-
return new WireScope(container);
|
|
30
|
-
}).inTransientScope();
|
|
31
|
-
return container;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export { createIocContainer };
|
|
35
|
-
//# sourceMappingURL=create-ioc-container.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-ioc-container.js","sources":["../../../../../../../../../src/wirestate-core/container/create-ioc-container.ts"],"sourcesContent":[null],"names":["createIocContainer","options","container","Container","defaultScope","parent","bind","EventBus","toConstantValue","QueryBus","CommandBus","SEEDS_TOKEN","Map","SEED_TOKEN","_a","seed","WireScope","toResolvedValue","inTransientScope"],"mappings":";;;;;;;AAwBA;;;;;AAKG;AACG,SAAUA,kBAAkBA,CAACC,OAAwC,EAAA;;AAAxC,EAAA,IAAAA,OAAA,KAAA,MAAA,EAAA;IAAAA,OAAA,GAAA,EAAwC;AAAA,EAAA;AAGzE,EAAA,IAAMC,SAAS,GAAc,IAAIC,SAAS,CAAC;AACzCC,IAAAA,YAAY,EAAE,WAAW;IACzBC,MAAM,EAAEJ,OAAO,CAACI;AACjB,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;AAC5DR,EAAAA,SAAS,CAACI,IAAI,CAACK,WAAW,CAAC,CAACH,eAAe,CAAC,IAAII,GAAG,EAAe,CAAC;EACnEV,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;EAE9DZ,SAAS,CACNI,IAAI,CAACU,SAAS,CAAC,CACfC,eAAe,CAAC,YAAA;AAAiB,IAAA,OAAA,IAAID,SAAS,CAACd,SAAS,CAAC;AAAxB,EAAA,CAAwB,CAAC,CAC1DgB,gBAAgB,EAAE;AAIrB,EAAA,OAAOhB,SAAS;AAClB;;;;"}
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import { __decorate, __metadata } from 'tslib';
|
|
2
|
-
import { injectable } from 'inversify';
|
|
3
|
-
import { CommandBus } from '../commands/command-bus.js';
|
|
4
|
-
import { ERROR_CODE_ACCESS_AFTER_DISPOSAL, ERROR_CODE_ACCESS_BEFORE_ACTIVATION } from '../error/error-code.js';
|
|
5
|
-
import { WirestateError } from '../error/wirestate-error.js';
|
|
6
|
-
import { EventBus } from '../events/event-bus.js';
|
|
7
|
-
import { QueryBus } from '../queries/query-bus.js';
|
|
8
|
-
import { SEEDS_TOKEN, SEED_TOKEN } from '../registry.js';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Injectable scope providing access to wirestate buses and seeds.
|
|
12
|
-
* Each injecting service receives its own instance (transient scope).
|
|
13
|
-
* The scope is activated and deactivated automatically alongside its owner service.
|
|
14
|
-
*/
|
|
15
|
-
var WireScope = /** @class */function () {
|
|
16
|
-
function WireScope(container) {
|
|
17
|
-
this.container = container;
|
|
18
|
-
/**
|
|
19
|
-
* Whether the scope was deactivated and disposed from the container.
|
|
20
|
-
*/
|
|
21
|
-
this.isDisposed = false;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Access the IoC container.
|
|
25
|
-
* Available only for activated instances of scope.
|
|
26
|
-
*
|
|
27
|
-
* @returns active container
|
|
28
|
-
*
|
|
29
|
-
* @throws WirestateError if scope is not activated or already disposed
|
|
30
|
-
*/
|
|
31
|
-
WireScope.prototype.getContainer = function () {
|
|
32
|
-
if (this.container) {
|
|
33
|
-
return this.container;
|
|
34
|
-
}
|
|
35
|
-
if (this.isDisposed) {
|
|
36
|
-
throw new WirestateError(ERROR_CODE_ACCESS_AFTER_DISPOSAL, "WireScope::container accessed after deactivation. Ensure service is properly disposed.");
|
|
37
|
-
} else {
|
|
38
|
-
throw new WirestateError(ERROR_CODE_ACCESS_BEFORE_ACTIVATION, "WireScope::container accessed before activation. " + "Ensure service is bound to container and is properly resolved.");
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
/**
|
|
42
|
-
* Resolves a sibling service or injected value.
|
|
43
|
-
* Use for lazy resolution or circular dependency breaking.
|
|
44
|
-
* Available only for activated containers.
|
|
45
|
-
*
|
|
46
|
-
* @param injectionId - injection identifier
|
|
47
|
-
* @returns resolved injection, service instance, or generic value
|
|
48
|
-
*
|
|
49
|
-
* @throws WirestateError if scope is not activated
|
|
50
|
-
*/
|
|
51
|
-
WireScope.prototype.resolve = function (injectionId) {
|
|
52
|
-
return this.getContainer().get(injectionId);
|
|
53
|
-
};
|
|
54
|
-
/**
|
|
55
|
-
* Resolves a sibling service or injected value.
|
|
56
|
-
* Use for lazy resolution or circular dependency breaking.
|
|
57
|
-
* Available only for activated containers.
|
|
58
|
-
*
|
|
59
|
-
* @param injectionId - injection identifier
|
|
60
|
-
* @returns resolved injection, service instance, generic value, or null if it is not bound
|
|
61
|
-
*
|
|
62
|
-
* @throws WirestateError if scope is not activated
|
|
63
|
-
*/
|
|
64
|
-
WireScope.prototype.resolveOptional = function (injectionId) {
|
|
65
|
-
var container = this.getContainer();
|
|
66
|
-
return container.isBound(injectionId) ? container.get(injectionId) : null;
|
|
67
|
-
};
|
|
68
|
-
/**
|
|
69
|
-
* Broadcasts an event.
|
|
70
|
-
* Available only for activated containers.
|
|
71
|
-
*
|
|
72
|
-
* @param type - type of event to emit
|
|
73
|
-
* @param payload - optional payload to send with the event
|
|
74
|
-
* @param from - optional sender of the event
|
|
75
|
-
*
|
|
76
|
-
* @throws WirestateError if scope is not activated
|
|
77
|
-
*/
|
|
78
|
-
WireScope.prototype.emitEvent = function (type, payload, from) {
|
|
79
|
-
this.getContainer().get(EventBus).emit({
|
|
80
|
-
type: type,
|
|
81
|
-
payload: payload,
|
|
82
|
-
from: from === undefined ? this : from
|
|
83
|
-
});
|
|
84
|
-
};
|
|
85
|
-
/**
|
|
86
|
-
* Dispatches a query and returns the result.
|
|
87
|
-
* Available only for activated containers.
|
|
88
|
-
*
|
|
89
|
-
* @param type - query type
|
|
90
|
-
* @param data - query data
|
|
91
|
-
* @returns query result
|
|
92
|
-
*
|
|
93
|
-
* @throws WirestateError if scope is not activated
|
|
94
|
-
*/
|
|
95
|
-
WireScope.prototype.queryData = function (type, data) {
|
|
96
|
-
return this.getContainer().get(QueryBus).query(type, data);
|
|
97
|
-
};
|
|
98
|
-
/**
|
|
99
|
-
* Dispatches a query and returns the result.
|
|
100
|
-
* Available only for activated containers.
|
|
101
|
-
*
|
|
102
|
-
* @param type - query type
|
|
103
|
-
* @param data - query data
|
|
104
|
-
* @returns query result or null if handler is not registered
|
|
105
|
-
*/
|
|
106
|
-
WireScope.prototype.queryOptionalData = function (type, data) {
|
|
107
|
-
return this.getContainer().get(QueryBus).queryOptional(type, data);
|
|
108
|
-
};
|
|
109
|
-
/**
|
|
110
|
-
* Dispatches a command and returns the descriptor.
|
|
111
|
-
* Available only for activated containers.
|
|
112
|
-
*
|
|
113
|
-
* @param type - command type
|
|
114
|
-
* @param data - command data
|
|
115
|
-
* @returns command descriptor
|
|
116
|
-
*
|
|
117
|
-
* @throws WirestateError if scope is not activated
|
|
118
|
-
*/
|
|
119
|
-
WireScope.prototype.executeCommand = function (type, data) {
|
|
120
|
-
return this.getContainer().get(CommandBus).command(type, data);
|
|
121
|
-
};
|
|
122
|
-
/**
|
|
123
|
-
* Dispatches a command and returns the descriptor.
|
|
124
|
-
* Available only for activated containers.
|
|
125
|
-
*
|
|
126
|
-
* @param type - command type
|
|
127
|
-
* @param data - command data
|
|
128
|
-
* @returns command descriptor or null if handler is not registered
|
|
129
|
-
*/
|
|
130
|
-
WireScope.prototype.executeOptionalCommand = function (type, data) {
|
|
131
|
-
return this.getContainer().get(CommandBus).commandOptional(type, data);
|
|
132
|
-
};
|
|
133
|
-
/**
|
|
134
|
-
* Reads seed for the provided injection.
|
|
135
|
-
* Returns shared seed if parameters are not provided.
|
|
136
|
-
* Available only for activated containers.
|
|
137
|
-
*
|
|
138
|
-
* @param seed - lookup key
|
|
139
|
-
* @returns seed data or null if missing
|
|
140
|
-
*
|
|
141
|
-
* @throws WirestateError if context is not activated
|
|
142
|
-
*/
|
|
143
|
-
WireScope.prototype.getSeed = function (seed) {
|
|
144
|
-
return seed ? this.getContainer().get(SEEDS_TOKEN).get(seed) || null : this.getContainer().get(SEED_TOKEN);
|
|
145
|
-
};
|
|
146
|
-
WireScope = __decorate([injectable(), __metadata("design:paramtypes", [Object])], WireScope);
|
|
147
|
-
return WireScope;
|
|
148
|
-
}();
|
|
149
|
-
|
|
150
|
-
export { WireScope };
|
|
151
|
-
//# sourceMappingURL=wire-scope.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wire-scope.js","sources":["../../../../../../../../../src/wirestate-core/container/wire-scope.ts"],"sourcesContent":[null],"names":["WireScope","container","isDisposed","prototype","getContainer","WirestateError","ERROR_CODE_ACCESS_AFTER_DISPOSAL","ERROR_CODE_ACCESS_BEFORE_ACTIVATION","resolve","injectionId","get","resolveOptional","isBound","emitEvent","type","payload","from","EventBus","emit","undefined","queryData","data","QueryBus","query","queryOptionalData","queryOptional","executeCommand","CommandBus","command","executeOptionalCommand","commandOptional","getSeed","seed","SEEDS_TOKEN","SEED_TOKEN","__decorate","injectable"],"mappings":";;;;;;;;;AAoBA;;;;AAIG;AAEH,IAAAA,SAAA,gBAAA,YAAA;EAME,SAAAA,SAAAA,CAAoCC,SAA8B,EAAA;IAA9B,IAAA,CAAAA,SAAS,GAATA,SAAS;AAL7C;;AAEG;IACa,IAAA,CAAAC,UAAU,GAAY,KAAK;AAE0B,EAAA;AAErE;;;;;;;AAOG;AACIF,EAAAA,SAAA,CAAAG,SAAA,CAAAC,YAAY,GAAnB,YAAA;IACE,IAAI,IAAI,CAACH,SAAS,EAAE;MAClB,OAAO,IAAI,CAACA,SAAS;AACvB,IAAA;IAEA,IAAI,IAAI,CAACC,UAAU,EAAE;AACnB,MAAA,M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
|
-
var ERROR_CODE_BINDING_SCOPE = 52;
|
|
4
|
-
var ERROR_CODE_FAILED_TO_RESOLVE_QUERY_HANDLER = 101;
|
|
5
|
-
var ERROR_CODE_FAILED_TO_RESOLVE_COMMAND_HANDLER = 102;
|
|
6
|
-
var ERROR_CODE_ACCESS_BEFORE_ACTIVATION = 200;
|
|
7
|
-
var ERROR_CODE_ACCESS_AFTER_DISPOSAL = 201;
|
|
8
|
-
|
|
9
|
-
export { ERROR_CODE_ACCESS_AFTER_DISPOSAL, ERROR_CODE_ACCESS_BEFORE_ACTIVATION, ERROR_CODE_BINDING_SCOPE, ERROR_CODE_FAILED_TO_RESOLVE_COMMAND_HANDLER, ERROR_CODE_FAILED_TO_RESOLVE_QUERY_HANDLER, ERROR_CODE_GENERIC, ERROR_CODE_INVALID_ARGUMENTS };
|
|
10
|
-
//# sourceMappingURL=error-code.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"error-code.js","sources":["../../../../../../../../../src/wirestate-core/error/error-code.ts"],"sourcesContent":[null],"names":["ERROR_CODE_GENERIC","ERROR_CODE_INVALID_ARGUMENTS","ERROR_CODE_BINDING_SCOPE","ERROR_CODE_FAILED_TO_RESOLVE_QUERY_HANDLER","ERROR_CODE_FAILED_TO_RESOLVE_COMMAND_HANDLER","ERROR_CODE_ACCESS_BEFORE_ACTIVATION","ERROR_CODE_ACCESS_AFTER_DISPOSAL"],"mappings":"AAAO,IAAMA,kBAAkB,GAAW;AAGnC,IAAMC,4BAA4B,GAAW;AAC7C,IAAMC,wBAAwB,GAAW;AAGzC,IAAMC,0CAA0C,GAAW;AAC3D,IAAMC,4CAA4C,GAAW;AAE7D,IAAMC,mCAAmC,GAAW;AACpD,IAAMC,gCAAgC,GAAW;;;;"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { __extends } from 'tslib';
|
|
2
|
-
import { ERROR_CODE_GENERIC } from './error-code.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* A custom error class that contains generic error information for Wirestate-related issues.
|
|
6
|
-
*
|
|
7
|
-
* This class extends the native `Error` class and is used to represent errors specific
|
|
8
|
-
* to the Wirestate library, providing more structured error handling.
|
|
9
|
-
*/
|
|
10
|
-
var WirestateError = /** @class */function (_super) {
|
|
11
|
-
__extends(WirestateError, _super);
|
|
12
|
-
function WirestateError(code, detail) {
|
|
13
|
-
if (code === void 0) {
|
|
14
|
-
code = ERROR_CODE_GENERIC;
|
|
15
|
-
}
|
|
16
|
-
var _this = _super.call(this) || this;
|
|
17
|
-
/**
|
|
18
|
-
* Name or error class to help differentiate error class in minified environments.
|
|
19
|
-
*/
|
|
20
|
-
_this.name = "WirestateError";
|
|
21
|
-
_this.code = code;
|
|
22
|
-
_this.message = detail || "Wirestate error.";
|
|
23
|
-
return _this;
|
|
24
|
-
}
|
|
25
|
-
return WirestateError;
|
|
26
|
-
}(Error);
|
|
27
|
-
|
|
28
|
-
export { WirestateError };
|
|
29
|
-
//# sourceMappingURL=wirestate-error.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wirestate-error.js","sources":["../../../../../../../../../src/wirestate-core/error/wirestate-error.ts"],"sourcesContent":[null],"names":["WirestateError","_super","__extends","code","detail","ERROR_CODE_GENERIC","_this","name","message","Error"],"mappings":";;;AAEA;;;;;AAKG;AACH,IAAAA,cAAA,gBAAA,UAAAC,MAAA,EAAA;AAAoCC,EAAAA,SAAA,CAAAF,cAAA,EAAAC,MAAA,CAAA;AAclC,EAAA,SAAAD,cAAAA,CAAmBG,IAAiC,EAAEC,MAAe,EAAA;AAAlD,IAAA,IAAAD,IAAA,KAAA,MAAA,EAAA;AAAAA,MAAAA,IAAA,GAAAE,kBAAiC;AAAA,IAAA;IAClD,IAAAC,KAAA,GAAAL,MAAK,WAAE,IAAA,IAAA;AAdT;;AAEG;IACaK,KAAA,CAAAC,IAAI,GAAW,gBAAgB;IAa7CD,KAAI,CAACH,IAAI,GAAGA,IAAI;AAChBG,IAAAA,KAAI,CAACE,OAAO,GAAGJ,MAAM,IAAI,kBAAkB;;AAC7C,EAAA;AACF,EAAA,OAAAJ,cAAC;AAAD,CApBA,CAAoCS,KAAK;;;;"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { getEventHandlerMetadata } from './get-event-handler-metadata.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Composes service event handlers into a single dispatcher.
|
|
5
|
-
*
|
|
6
|
-
* @param instance - service instance
|
|
7
|
-
* @returns event handler or null if no handlers are declared
|
|
8
|
-
* @internal
|
|
9
|
-
*/
|
|
10
|
-
function buildEventDispatcher(instance) {
|
|
11
|
-
var entries = [];
|
|
12
|
-
// Register methods decorated with @OnEvent.
|
|
13
|
-
for (var _i = 0, _a = getEventHandlerMetadata(instance); _i < _a.length; _i++) {
|
|
14
|
-
var meta = _a[_i];
|
|
15
|
-
var method = instance[meta.methodName];
|
|
16
|
-
if (typeof method === "function") {
|
|
17
|
-
entries.push({
|
|
18
|
-
types: meta.types,
|
|
19
|
-
handler: method.bind(instance)
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
if (entries.length) {
|
|
24
|
-
return function (event) {
|
|
25
|
-
// Fan out events to all matching handlers.
|
|
26
|
-
for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
|
|
27
|
-
var entry = entries_1[_i];
|
|
28
|
-
if (entry.types === null || entry.types.includes(event.type)) {
|
|
29
|
-
entry.handler(event);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
} else {
|
|
34
|
-
return null;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export { buildEventDispatcher };
|
|
39
|
-
//# sourceMappingURL=build-event-dispatcher.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build-event-dispatcher.js","sources":["../../../../../../../../../src/wirestate-core/events/build-event-dispatcher.ts"],"sourcesContent":[null],"names":["buildEventDispatcher","instance","entries","_i","_a","getEventHandlerMetadata","length","meta","method","methodName","push","types","handler","bind","event","entries_1","entry","includes","type"],"mappings":";;AAOA;;;;;;AAMG;AACG,SAAUA,oBAAoBA,CAAmBC,QAAW,EAAA;EAGhE,IAAMC,OAAO,GAA+B,EAAE;AAE9C;EACA,KAAmB,IAAAC,EAAA,GAAA,CAAiC,EAAjCC,EAAA,GAAAC,uBAAuB,CAACJ,QAAQ,CAAC,EAAjCE,EAAA,GAAAC,EAAA,CAAAE,MAAiC,EAAjCH,EAAA,EAAiC,EAAE;AAAjD,IAAA,IAAMI,IAAI,GAAAH,EAAA,CAAAD,EAAA,CAAA;AACb,IAAA,IAAMK,MAAM,GAAIP,QAAwD,CAACM,IAAI,CAACE,UAAU,CAAC;AAEzF,IAAA,IAAI,OAAOD,MAAM,KAAK,UAAU,EAAE;MAChCN,OAAO,CAACQ,IAAI,CAAC;QACXC,KAAK,EAAEJ,IAAI,CAACI,KAAK;AACjBC,QAAAA,OAAO,EAAGJ,MAAwB,CAACK,IAAI,CAACZ,QAAQ;AACjD,OAAA,CAAC;AACJ,IAAA;AACF,EAAA;EAEA,IAAIC,OAAO,CAACI,MAAM,EAAE;IAOlB,OAAO,UAACQ,KAAK,EAAA;AACX;AACA,MAAA,KAAoB,IAAAX,EAAA,GAAA,CAAO,EAAPY,SAAA,GAAAb,OAAO,EAAPC,qBAAO,EAAPA,EAAA,EAAO,EAAE;AAAxB,QAAA,IAAMa,KAAK,GAAAD,SAAA,CAAAZ,EAAA,CAAA;AACd,QAAA,IAAIa,KAAK,CAACL,KAAK,KAAK,IAAI,IAAIK,KAAK,CAACL,KAAK,CAACM,QAAQ,CAACH,KAAK,CAACI,IAAI,CAAC,EAAE;AAC5DF,UAAAA,KAAK,CAACJ,OAAO,CAACE,KAAK,CAAC;AACtB,QAAA;AACF,MAAA;IACF,CAAC;AACH,EAAA,CAAC,MAAM;AAOL,IAAA,OAAO,IAAI;AACb,EAAA;AACF;;;;"}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Dispatches events to subscribers.
|
|
3
|
-
*/
|
|
4
|
-
var EventBus = /** @class */function () {
|
|
5
|
-
function EventBus() {
|
|
6
|
-
this.handlers = new Set();
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Broadcasts an event to all subscribers.
|
|
10
|
-
*
|
|
11
|
-
* @param event - event to emit
|
|
12
|
-
*/
|
|
13
|
-
EventBus.prototype.emit = function (event) {
|
|
14
|
-
// Snapshot prevents concurrent modification errors if handlers sub/unsub during emit.
|
|
15
|
-
var snapshot = Array.from(this.handlers);
|
|
16
|
-
for (var _i = 0, snapshot_1 = snapshot; _i < snapshot_1.length; _i++) {
|
|
17
|
-
var handler = snapshot_1[_i];
|
|
18
|
-
try {
|
|
19
|
-
handler(event);
|
|
20
|
-
} catch (error) {
|
|
21
|
-
// Prevent one failing listener from stalling the entire bus.
|
|
22
|
-
console.error("[wirestate] Event handler threw:", error);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* Subscribes a handler to all events.
|
|
28
|
-
* Returns an unsubscribe function.
|
|
29
|
-
*
|
|
30
|
-
* @param handler - event handler function
|
|
31
|
-
* @returns unsubscribe function
|
|
32
|
-
*/
|
|
33
|
-
EventBus.prototype.subscribe = function (handler) {
|
|
34
|
-
var _this = this;
|
|
35
|
-
this.handlers.add(handler);
|
|
36
|
-
return function () {
|
|
37
|
-
_this.handlers.delete(handler);
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
/**
|
|
41
|
-
* Removes all registered handlers.
|
|
42
|
-
*
|
|
43
|
-
* @internal
|
|
44
|
-
*/
|
|
45
|
-
EventBus.prototype.clear = function () {
|
|
46
|
-
this.handlers.clear();
|
|
47
|
-
};
|
|
48
|
-
return EventBus;
|
|
49
|
-
}();
|
|
50
|
-
|
|
51
|
-
export { EventBus };
|
|
52
|
-
//# sourceMappingURL=event-bus.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"event-bus.js","sources":["../../../../../../../../../src/wirestate-core/events/event-bus.ts"],"sourcesContent":[null],"names":["EventBus","handlers","Set","prototype","emit","event","snapshot","Array","from","_i","snapshot_1","handler","error","console","subscribe","_this","add","delete","clear"],"mappings":"AAKA;;AAEG;AACH,IAAAA,QAAA,gBAAA,YAAA;EAAA,SAAAA,QAAAA,GAAA;AACmB,IAAA,IAAA,CAAAC,QAAQ,GAAuB,IAAIC,GAAG,EAAE;AAsD3D,EAAA;AApDE;;;;AAIG;AACIF,EAAAA,QAAA,CAAAG,SAAA,CAAAC,IAAI,GAAX,UAAyEC,KAAsB,EAAA;AAC7F;IACA,IAAMC,QAAQ,GAAyBC,KAAK,CAACC,IAAI,CAAC,IAAI,CAACP,QAAQ,CAAC;AAEhE,IAAA,KAAsB,IAAAQ,EAAA,GAAA,CAAQ,EAARC,UAAA,GAAAJ,QAAQ,EAARG,sBAAQ,EAARA,EAAA,EAAQ,EAAE;AAA3B,MAAA,IAAME,OAAO,GAAAD,UAAA,CAAAD,EAAA,CAAA;MAChB,IAAI;QACFE,OAAO,CAACN,KAAK,CAAC;MAChB,CAAC,CAAC,OAAOO,KAAK,EAAE;AACd;AACAC,QAAAA,OAAO,CAACD,KAAK,CAAC,kCAAkC,EAAEA,KAAK,CAAC;AAC1D,MAAA;AACF,IAAA;EACF,CAAC;AAED;;;;;;AAMG;AACIZ,EAAAA,QAAA,CAAAG,SAAA,CAAAW,SAAS,GAAhB,UAAiBH,OAAsB,EAAA;IAAvC,IAAAI,KAAA,GAAA,IAAA;AAME,IAAA,IAAI,CAACd,QAAQ,CAACe,GAAG,CAACL,OAAO,CAAC;AAE1B,IAAA,OAAO,YAAA;AAMLI,MAAAA,KAAI,CAACd,QAAQ,CAACgB,MAAM,CAACN,OAAO,CAAC;IAC/B,CAAC;EACH,CAAC;AAED;;;;AAIG;AACIX,EAAAA,QAAA,CAAAG,SAAA,CAAAe,KAAK,GAAZ,YAAA;AACE,IAAA,IAAI,CAACjB,QAAQ,CAACiB,KAAK,EAAE;EACvB,CAAC;AACH,EAAA,OAAAlB,QAAC;AAAD,CAAC;;;;"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { EVENT_HANDLER_METADATA } from '../registry.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Retrieves `@OnEvent` metadata from the class hierarchy.
|
|
5
|
-
* Returns handlers ordered from base to derived class.
|
|
6
|
-
*
|
|
7
|
-
* @param instance - service instance
|
|
8
|
-
* @returns metadata list
|
|
9
|
-
* @internal
|
|
10
|
-
*/
|
|
11
|
-
function getEventHandlerMetadata(instance) {
|
|
12
|
-
var constructor = instance.constructor;
|
|
13
|
-
var chain = [];
|
|
14
|
-
// Traverse prototype chain up to Object/Function
|
|
15
|
-
while (typeof constructor === "function" && constructor !== Object && constructor !== Function.prototype) {
|
|
16
|
-
var own = EVENT_HANDLER_METADATA.get(constructor);
|
|
17
|
-
if (own && own.length > 0) {
|
|
18
|
-
chain.push(own);
|
|
19
|
-
}
|
|
20
|
-
constructor = Object.getPrototypeOf(constructor);
|
|
21
|
-
}
|
|
22
|
-
// Reverse to ensure parent-first execution order
|
|
23
|
-
return chain.reverse().flat();
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export { getEventHandlerMetadata };
|
|
27
|
-
//# sourceMappingURL=get-event-handler-metadata.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-event-handler-metadata.js","sources":["../../../../../../../../../src/wirestate-core/events/get-event-handler-metadata.ts"],"sourcesContent":[null],"names":["getEventHandlerMetadata","instance","constructor","chain","Object","Function","prototype","own","EVENT_HANDLER_METADATA","get","length","push","getPrototypeOf","reverse","flat"],"mappings":";;AAOA;;;;;;;AAOG;AACG,SAAUA,uBAAuBA,CAACC,QAAgB,EAAA;AAGtD,EAAA,IAAIC,WAAW,GAAYD,QAAQ,CAACC,WAAW;EAE/C,IAAMC,KAAK,GAAwC,EAAE;AAErD;AACA,EAAA,OAAO,OAAOD,WAAW,KAAK,UAAU,IAAIA,WAAW,KAAKE,MAAM,IAAIF,WAAW,KAAKG,QAAQ,CAACC,SAAS,EAAE;AACxG,IAAA,IAAMC,GAAG,GAAwCC,sBAAsB,CAACC,GAAG,CAACP,WAAqB,CAAC;AAElG,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,27 +0,0 @@
|
|
|
1
|
-
import { QUERY_HANDLER_METADATA } from '../registry.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Retrieves `@OnQuery` metadata from the class hierarchy.
|
|
5
|
-
* Returns handlers ordered from base to derived class.
|
|
6
|
-
*
|
|
7
|
-
* @param instance - service instance
|
|
8
|
-
* @returns metadata list
|
|
9
|
-
* @internal
|
|
10
|
-
*/
|
|
11
|
-
function getQueryHandlerMetadata(instance) {
|
|
12
|
-
var constructor = instance.constructor;
|
|
13
|
-
var chain = [];
|
|
14
|
-
// Traverse prototype chain up to Object/Function
|
|
15
|
-
while (typeof constructor === "function" && constructor !== Object && constructor !== Function.prototype) {
|
|
16
|
-
var own = QUERY_HANDLER_METADATA.get(constructor);
|
|
17
|
-
if (own && own.length > 0) {
|
|
18
|
-
chain.push(own);
|
|
19
|
-
}
|
|
20
|
-
constructor = Object.getPrototypeOf(constructor);
|
|
21
|
-
}
|
|
22
|
-
// Reverse to ensure parent-first execution order.
|
|
23
|
-
return chain.reverse().flat();
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export { getQueryHandlerMetadata };
|
|
27
|
-
//# sourceMappingURL=get-query-handler-metadata.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-query-handler-metadata.js","sources":["../../../../../../../../../src/wirestate-core/queries/get-query-handler-metadata.ts"],"sourcesContent":[null],"names":["getQueryHandlerMetadata","instance","constructor","chain","Object","Function","prototype","own","QUERY_HANDLER_METADATA","get","length","push","getPrototypeOf","reverse","flat"],"mappings":";;AAOA;;;;;;;AAOG;AACG,SAAUA,uBAAuBA,CAACC,QAAgB,EAAA;AAGtD,EAAA,IAAIC,WAAW,GAAYD,QAAQ,CAACC,WAAW;EAE/C,IAAMC,KAAK,GAAwC,EAAE;AAErD;AACA,EAAA,OAAO,OAAOD,WAAW,KAAK,UAAU,IAAIA,WAAW,KAAKE,MAAM,IAAIF,WAAW,KAAKG,QAAQ,CAACC,SAAS,EAAE;AACxG,IAAA,IAAMC,GAAG,GAAwCC,sBAAsB,CAACC,GAAG,CAACP,WAAqB,CAAC;AAElG,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,99 +0,0 @@
|
|
|
1
|
-
import { ERROR_CODE_FAILED_TO_RESOLVE_QUERY_HANDLER } from '../error/error-code.js';
|
|
2
|
-
import { WirestateError } from '../error/wirestate-error.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Dispatches queries to handlers.
|
|
6
|
-
*/
|
|
7
|
-
var QueryBus = /** @class */function () {
|
|
8
|
-
function QueryBus() {
|
|
9
|
-
/**
|
|
10
|
-
* Internal handler storage.
|
|
11
|
-
* Uses a stack for each query type to support shadowing (e.g., component-level vs service-level).
|
|
12
|
-
*/
|
|
13
|
-
this.handlers = new Map();
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Registers a query handler.
|
|
17
|
-
* Returns an unregister function.
|
|
18
|
-
*
|
|
19
|
-
* @param type - query type
|
|
20
|
-
* @param handler - handler function
|
|
21
|
-
* @returns unregister function
|
|
22
|
-
*/
|
|
23
|
-
QueryBus.prototype.register = function (type, handler) {
|
|
24
|
-
var _this = this;
|
|
25
|
-
var stack = this.handlers.get(type);
|
|
26
|
-
if (!stack) {
|
|
27
|
-
stack = [];
|
|
28
|
-
this.handlers.set(type, stack);
|
|
29
|
-
}
|
|
30
|
-
stack.push(handler);
|
|
31
|
-
return function () {
|
|
32
|
-
var current = _this.handlers.get(type);
|
|
33
|
-
if (!current) {
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
var index = current.indexOf(handler);
|
|
37
|
-
if (index >= 0) {
|
|
38
|
-
current.splice(index, 1);
|
|
39
|
-
}
|
|
40
|
-
// Clean empty stacks.
|
|
41
|
-
if (current.length === 0) {
|
|
42
|
-
_this.handlers.delete(type);
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
};
|
|
46
|
-
/**
|
|
47
|
-
* Dispatches a query to the last registered handler.
|
|
48
|
-
*
|
|
49
|
-
* @param type - query type
|
|
50
|
-
* @param data - query payload
|
|
51
|
-
* @returns query result
|
|
52
|
-
*
|
|
53
|
-
* @throws if no handler is registered
|
|
54
|
-
*/
|
|
55
|
-
QueryBus.prototype.query = function (type, data) {
|
|
56
|
-
var stack = this.handlers.get(type);
|
|
57
|
-
// Always use the top of the stack (most recent registration) if handlers are available.
|
|
58
|
-
if (stack === null || stack === void 0 ? void 0 : stack.length) {
|
|
59
|
-
return stack[stack.length - 1](data);
|
|
60
|
-
}
|
|
61
|
-
throw new WirestateError(ERROR_CODE_FAILED_TO_RESOLVE_QUERY_HANDLER, "No query handler registered in container for type: '".concat(String(type), "'."));
|
|
62
|
-
};
|
|
63
|
-
/**
|
|
64
|
-
* Dispatches a query to the last registered handler, returning null if no handler exists.
|
|
65
|
-
*
|
|
66
|
-
* @param type - query type
|
|
67
|
-
* @param data - query payload
|
|
68
|
-
* @returns query result or null if no handler is registered
|
|
69
|
-
*/
|
|
70
|
-
QueryBus.prototype.queryOptional = function (type, data) {
|
|
71
|
-
var stack = this.handlers.get(type);
|
|
72
|
-
if (stack === null || stack === void 0 ? void 0 : stack.length) {
|
|
73
|
-
return stack[stack.length - 1](data);
|
|
74
|
-
}
|
|
75
|
-
return null;
|
|
76
|
-
};
|
|
77
|
-
/**
|
|
78
|
-
* Checks if a handler is registered for the given type.
|
|
79
|
-
*
|
|
80
|
-
* @param type - query type
|
|
81
|
-
* @returns true if handler exists
|
|
82
|
-
*/
|
|
83
|
-
QueryBus.prototype.has = function (type) {
|
|
84
|
-
var stack = this.handlers.get(type);
|
|
85
|
-
return Boolean(stack && stack.length);
|
|
86
|
-
};
|
|
87
|
-
/**
|
|
88
|
-
* Removes all registered handlers.
|
|
89
|
-
*
|
|
90
|
-
* @internal
|
|
91
|
-
*/
|
|
92
|
-
QueryBus.prototype.clear = function () {
|
|
93
|
-
this.handlers.clear();
|
|
94
|
-
};
|
|
95
|
-
return QueryBus;
|
|
96
|
-
}();
|
|
97
|
-
|
|
98
|
-
export { QueryBus };
|
|
99
|
-
//# sourceMappingURL=query-bus.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"query-bus.js","sources":["../../../../../../../../../src/wirestate-core/queries/query-bus.ts"],"sourcesContent":[null],"names":["QueryBus","handlers","Map","prototype","register","type","handler","_this","stack","get","set","push","current","index","indexOf","splice","length","delete","query","data","WirestateError","ERROR_CODE_FAILED_TO_RESOLVE_QUERY_HANDLER","concat","String","queryOptional","has","Boolean","clear"],"mappings":";;;AAQA;;AAEG;AACH,IAAAA,QAAA,gBAAA,YAAA;EAAA,SAAAA,QAAAA,GAAA;AACE;;;AAGG;A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
|
5
|
-
/**
|
|
6
|
-
* Token for the container-scoped shared seed object.
|
|
7
|
-
*/
|
|
8
|
-
var SEED_TOKEN = Symbol("@wirestate/seed");
|
|
9
|
-
/**
|
|
10
|
-
* Map of class constructors to their declared query handlers.
|
|
11
|
-
* Inherited via a prototype chain at resolve time.
|
|
12
|
-
*/
|
|
13
|
-
var QUERY_HANDLER_METADATA = new WeakMap();
|
|
14
|
-
/**
|
|
15
|
-
* Map of class constructors to their declared command handlers.
|
|
16
|
-
* Inherited via a prototype chain at resolve time.
|
|
17
|
-
*/
|
|
18
|
-
var COMMAND_HANDLER_METADATA = new WeakMap();
|
|
19
|
-
/**
|
|
20
|
-
* Map of class constructors to their `@OnActivated`-decorated method names.
|
|
21
|
-
* Inherited via a prototype chain at resolve time.
|
|
22
|
-
*/
|
|
23
|
-
var ACTIVATED_HANDLER_METADATA = new WeakMap();
|
|
24
|
-
/**
|
|
25
|
-
* Map of class constructors to their `@OnDeactivation`-decorated method names.
|
|
26
|
-
* Inherited via a prototype chain at resolve time.
|
|
27
|
-
*/
|
|
28
|
-
var DEACTIVATION_HANDLER_METADATA = new WeakMap();
|
|
29
|
-
/**
|
|
30
|
-
* Map of class constructors for their declared event handlers.
|
|
31
|
-
* Inherited via a prototype chain at resolve time.
|
|
32
|
-
*/
|
|
33
|
-
var EVENT_HANDLER_METADATA = new WeakMap();
|
|
34
|
-
/**
|
|
35
|
-
* Private storage for service-to-container references.
|
|
36
|
-
*/
|
|
37
|
-
var CONTAINER_REFS_BY_SERVICE = new WeakMap();
|
|
38
|
-
/**
|
|
39
|
-
* Private storage for injected WireScope instances per service.
|
|
40
|
-
*/
|
|
41
|
-
var WIRE_SCOPES_BY_SERVICE = new WeakMap();
|
|
42
|
-
/**
|
|
43
|
-
* Private storage for service event unsubscribers.
|
|
44
|
-
*/
|
|
45
|
-
var EVENT_UNSUBSCRIBERS_BY_SERVICE = new WeakMap();
|
|
46
|
-
/**
|
|
47
|
-
* Private storage for service query unregisters.
|
|
48
|
-
*/
|
|
49
|
-
var QUERY_UNREGISTERS_BY_SERVICE = new WeakMap();
|
|
50
|
-
/**
|
|
51
|
-
* Private storage for service command unregisters.
|
|
52
|
-
*/
|
|
53
|
-
var COMMAND_UNREGISTERS_BY_SERVICE = new WeakMap();
|
|
54
|
-
|
|
55
|
-
export { ACTIVATED_HANDLER_METADATA, COMMAND_HANDLER_METADATA, COMMAND_UNREGISTERS_BY_SERVICE, CONTAINER_REFS_BY_SERVICE, DEACTIVATION_HANDLER_METADATA, EVENT_HANDLER_METADATA, EVENT_UNSUBSCRIBERS_BY_SERVICE, QUERY_HANDLER_METADATA, QUERY_UNREGISTERS_BY_SERVICE, SEEDS_TOKEN, SEED_TOKEN, WIRE_SCOPES_BY_SERVICE };
|
|
56
|
-
//# sourceMappingURL=registry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sources":["../../../../../../../../src/wirestate-core/registry.ts"],"sourcesContent":[null],"names":["SEEDS_TOKEN","Symbol","SEED_TOKEN","QUERY_HANDLER_METADATA","WeakMap","COMMAND_HANDLER_METADATA","ACTIVATED_HANDLER_METADATA","DEACTIVATION_HANDLER_METADATA","EVENT_HANDLER_METADATA","CONTAINER_REFS_BY_SERVICE","WIRE_SCOPES_BY_SERVICE","EVENT_UNSUBSCRIBERS_BY_SERVICE","QUERY_UNREGISTERS_BY_SERVICE","COMMAND_UNREGISTERS_BY_SERVICE"],"mappings":"AAOA;;AAEG;IACUA,WAAW,GAAkBC,MAAM,CAAC,kBAAkB;AAEnE;;AAEG;IACUC,UAAU,GAAkBD,MAAM,CAAC,iBAAiB;AAEjE;;;AAGG;IACUE,sBAAsB,GAAkD,IAAIC,OAAO;AAEhG;;;AAGG;IACUC,wBAAwB,GAAoD,IAAID,OAAO;AAEpG;;;AAGG;IACUE,0BAA0B,GAA4C,IAAIF,OAAO;AAE9F;;;AAGG;IACUG,6BAA6B,GAA4C,IAAIH,OAAO;AAEjG;;;AAGG;IACUI,sBAAsB,GAAkD,IAAIJ,OAAO;AAEhG;;AAEG;IACUK,yBAAyB,GAA+B,IAAIL,OAAO;AAEhF;;AAEG;IACUM,sBAAsB,GAAsC,IAAIN,OAAO;AAEpF;;AAEG;IACUO,8BAA8B,GAAwC,IAAIP,OAAO;AAE9F;;AAEG;IACUQ,4BAA4B,GAA6C,IAAIR,OAAO;AAEjG;;AAEG;IACUS,8BAA8B,GAA+C,IAAIT,OAAO;;;;"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { ACTIVATED_HANDLER_METADATA } from '../registry.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Retrieves `@OnActivated` method names from the class hierarchy.
|
|
5
|
-
* Returns method names ordered from base to derived class.
|
|
6
|
-
*
|
|
7
|
-
* @param instance - service instance
|
|
8
|
-
* @returns list of method names
|
|
9
|
-
* @internal
|
|
10
|
-
*/
|
|
11
|
-
function getActivatedHandlerMetadata(instance) {
|
|
12
|
-
var constructor = instance.constructor;
|
|
13
|
-
var chain = [];
|
|
14
|
-
// Traverse prototype chain up to Object/Function.
|
|
15
|
-
while (typeof constructor === "function" && constructor !== Object && constructor !== Function.prototype) {
|
|
16
|
-
var own = ACTIVATED_HANDLER_METADATA.get(constructor);
|
|
17
|
-
if (own && own.length > 0) {
|
|
18
|
-
chain.push(own);
|
|
19
|
-
}
|
|
20
|
-
constructor = Object.getPrototypeOf(constructor);
|
|
21
|
-
}
|
|
22
|
-
// Reverse to ensure parent-first execution order.
|
|
23
|
-
return chain.reverse().flat();
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export { getActivatedHandlerMetadata };
|
|
27
|
-
//# sourceMappingURL=get-activated-handler-metadata.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-activated-handler-metadata.js","sources":["../../../../../../../../../src/wirestate-core/service/get-activated-handler-metadata.ts"],"sourcesContent":[null],"names":["getActivatedHandlerMetadata","instance","constructor","chain","Object","Function","prototype","own","ACTIVATED_HANDLER_METADATA","get","length","push","getPrototypeOf","reverse","flat"],"mappings":";;AAMA;;;;;;;AAOG;AACG,SAAUA,2BAA2BA,CAACC,QAAgB,EAAA;AAG1D,EAAA,IAAIC,WAAW,GAAYD,QAAQ,CAACC,WAAW;EAE/C,IAAMC,KAAK,GAAkC,EAAE;AAE/C;AACA,EAAA,OAAO,OAAOD,WAAW,KAAK,UAAU,IAAIA,WAAW,KAAKE,MAAM,IAAIF,WAAW,KAAKG,QAAQ,CAACC,SAAS,EAAE;AACxG,IAAA,IAAMC,GAAG,GAAkCC,0BAA0B,CAACC,GAAG,CAACP,WAAqB,CAAC;AAEhG,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;AAIA;EACA,OAAOC,KAAK,CAACU,OAAO,EAAE,CAACC,IAAI,EAAE;AAC/B;;;;"}
|