@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.
- package/CHANGELOG.md +51 -0
- package/LICENSE +21 -0
- package/README.md +319 -0
- package/cjs/development/index.js +301 -0
- package/cjs/development/index.js.map +1 -0
- package/cjs/development/lib.js +1007 -0
- package/cjs/development/lib.js.map +1 -0
- package/cjs/development/test-utils.js +128 -0
- package/cjs/development/test-utils.js.map +1 -0
- package/cjs/production/index.js +1 -0
- package/cjs/production/index.js.map +1 -0
- package/cjs/production/lib.js +1 -0
- package/cjs/production/lib.js.map +1 -0
- package/cjs/production/test-utils.js +1 -0
- package/cjs/production/test-utils.js.map +1 -0
- package/esm/development/alias.js +9 -0
- package/esm/development/alias.js.map +1 -0
- package/esm/development/bind/bind-constant.js +19 -0
- package/esm/development/bind/bind-constant.js.map +1 -0
- package/esm/development/bind/bind-dynamic-value.js +28 -0
- package/esm/development/bind/bind-dynamic-value.js.map +1 -0
- package/esm/development/bind/bind-entry.js +39 -0
- package/esm/development/bind/bind-entry.js.map +1 -0
- package/esm/development/bind/bind-service.js +253 -0
- package/esm/development/bind/bind-service.js.map +1 -0
- package/esm/development/bind/get-entry-token.js +14 -0
- package/esm/development/bind/get-entry-token.js.map +1 -0
- package/esm/development/commands/command-bus.js +112 -0
- package/esm/development/commands/command-bus.js.map +1 -0
- package/esm/development/commands/command-optional.js +16 -0
- package/esm/development/commands/command-optional.js.map +1 -0
- package/esm/development/commands/command.js +16 -0
- package/esm/development/commands/command.js.map +1 -0
- package/esm/development/commands/get-command-handler-metadata.js +27 -0
- package/esm/development/commands/get-command-handler-metadata.js.map +1 -0
- package/esm/development/commands/on-command.js +26 -0
- package/esm/development/commands/on-command.js.map +1 -0
- package/esm/development/container/create-ioc-container.js +35 -0
- package/esm/development/container/create-ioc-container.js.map +1 -0
- package/esm/development/container/wire-scope.js +151 -0
- package/esm/development/container/wire-scope.js.map +1 -0
- package/esm/development/error/error-code.js +10 -0
- package/esm/development/error/error-code.js.map +1 -0
- package/esm/development/error/wirestate-error.js +29 -0
- package/esm/development/error/wirestate-error.js.map +1 -0
- package/esm/development/events/build-event-dispatcher.js +39 -0
- package/esm/development/events/build-event-dispatcher.js.map +1 -0
- package/esm/development/events/emit-event.js +20 -0
- package/esm/development/events/emit-event.js.map +1 -0
- package/esm/development/events/event-bus.js +52 -0
- package/esm/development/events/event-bus.js.map +1 -0
- package/esm/development/events/get-event-handler-metadata.js +27 -0
- package/esm/development/events/get-event-handler-metadata.js.map +1 -0
- package/esm/development/events/on-event.js +29 -0
- package/esm/development/events/on-event.js.map +1 -0
- package/esm/development/index.js +28 -0
- package/esm/development/index.js.map +1 -0
- package/esm/development/queries/get-query-handler-metadata.js +27 -0
- package/esm/development/queries/get-query-handler-metadata.js.map +1 -0
- package/esm/development/queries/on-query.js +26 -0
- package/esm/development/queries/on-query.js.map +1 -0
- package/esm/development/queries/query-bus.js +99 -0
- package/esm/development/queries/query-bus.js.map +1 -0
- package/esm/development/queries/query-optional.js +16 -0
- package/esm/development/queries/query-optional.js.map +1 -0
- package/esm/development/queries/query.js +16 -0
- package/esm/development/queries/query.js.map +1 -0
- package/esm/development/registry.js +56 -0
- package/esm/development/registry.js.map +1 -0
- package/esm/development/seeds/apply-seeds.js +21 -0
- package/esm/development/seeds/apply-seeds.js.map +1 -0
- package/esm/development/seeds/apply-shared-seed.js +14 -0
- package/esm/development/seeds/apply-shared-seed.js.map +1 -0
- package/esm/development/seeds/unapply-seeds.js +19 -0
- package/esm/development/seeds/unapply-seeds.js.map +1 -0
- package/esm/development/service/get-activated-handler-metadata.js +27 -0
- package/esm/development/service/get-activated-handler-metadata.js.map +1 -0
- package/esm/development/service/get-deactivation-handler-metadata.js +27 -0
- package/esm/development/service/get-deactivation-handler-metadata.js.map +1 -0
- package/esm/development/service/on-activated.js +21 -0
- package/esm/development/service/on-activated.js.map +1 -0
- package/esm/development/service/on-deactivation.js +21 -0
- package/esm/development/service/on-deactivation.js.map +1 -0
- package/esm/development/test-utils/mock-bind-entry.js +24 -0
- package/esm/development/test-utils/mock-bind-entry.js.map +1 -0
- package/esm/development/test-utils/mock-bind-service.js +24 -0
- package/esm/development/test-utils/mock-bind-service.js.map +1 -0
- package/esm/development/test-utils/mock-container.js +52 -0
- package/esm/development/test-utils/mock-container.js.map +1 -0
- package/esm/development/test-utils/mock-service.js +26 -0
- package/esm/development/test-utils/mock-service.js.map +1 -0
- package/esm/development/test-utils/mock-unbind-service.js +13 -0
- package/esm/development/test-utils/mock-unbind-service.js.map +1 -0
- package/esm/development/test-utils.js +6 -0
- package/esm/development/test-utils.js.map +1 -0
- package/esm/development/types/commands.js +12 -0
- package/esm/development/types/commands.js.map +1 -0
- package/esm/production/alias.js +1 -0
- package/esm/production/alias.js.map +1 -0
- package/esm/production/bind/bind-constant.js +1 -0
- package/esm/production/bind/bind-constant.js.map +1 -0
- package/esm/production/bind/bind-dynamic-value.js +1 -0
- package/esm/production/bind/bind-dynamic-value.js.map +1 -0
- package/esm/production/bind/bind-entry.js +1 -0
- package/esm/production/bind/bind-entry.js.map +1 -0
- package/esm/production/bind/bind-service.js +1 -0
- package/esm/production/bind/bind-service.js.map +1 -0
- package/esm/production/bind/get-entry-token.js +1 -0
- package/esm/production/bind/get-entry-token.js.map +1 -0
- package/esm/production/commands/command-bus.js +1 -0
- package/esm/production/commands/command-bus.js.map +1 -0
- package/esm/production/commands/command-optional.js +1 -0
- package/esm/production/commands/command-optional.js.map +1 -0
- package/esm/production/commands/command.js +1 -0
- package/esm/production/commands/command.js.map +1 -0
- package/esm/production/commands/get-command-handler-metadata.js +1 -0
- package/esm/production/commands/get-command-handler-metadata.js.map +1 -0
- package/esm/production/commands/on-command.js +1 -0
- package/esm/production/commands/on-command.js.map +1 -0
- package/esm/production/container/create-ioc-container.js +1 -0
- package/esm/production/container/create-ioc-container.js.map +1 -0
- package/esm/production/container/wire-scope.js +1 -0
- package/esm/production/container/wire-scope.js.map +1 -0
- package/esm/production/error/error-code.js +1 -0
- package/esm/production/error/error-code.js.map +1 -0
- package/esm/production/error/wirestate-error.js +1 -0
- package/esm/production/error/wirestate-error.js.map +1 -0
- package/esm/production/events/build-event-dispatcher.js +1 -0
- package/esm/production/events/build-event-dispatcher.js.map +1 -0
- package/esm/production/events/emit-event.js +1 -0
- package/esm/production/events/emit-event.js.map +1 -0
- package/esm/production/events/event-bus.js +1 -0
- package/esm/production/events/event-bus.js.map +1 -0
- package/esm/production/events/get-event-handler-metadata.js +1 -0
- package/esm/production/events/get-event-handler-metadata.js.map +1 -0
- package/esm/production/events/on-event.js +1 -0
- package/esm/production/events/on-event.js.map +1 -0
- package/esm/production/index.js +1 -0
- package/esm/production/index.js.map +1 -0
- package/esm/production/queries/get-query-handler-metadata.js +1 -0
- package/esm/production/queries/get-query-handler-metadata.js.map +1 -0
- package/esm/production/queries/on-query.js +1 -0
- package/esm/production/queries/on-query.js.map +1 -0
- package/esm/production/queries/query-bus.js +1 -0
- package/esm/production/queries/query-bus.js.map +1 -0
- package/esm/production/queries/query-optional.js +1 -0
- package/esm/production/queries/query-optional.js.map +1 -0
- package/esm/production/queries/query.js +1 -0
- package/esm/production/queries/query.js.map +1 -0
- package/esm/production/registry.js +1 -0
- package/esm/production/registry.js.map +1 -0
- package/esm/production/seeds/apply-seeds.js +1 -0
- package/esm/production/seeds/apply-seeds.js.map +1 -0
- package/esm/production/seeds/apply-shared-seed.js +1 -0
- package/esm/production/seeds/apply-shared-seed.js.map +1 -0
- package/esm/production/seeds/unapply-seeds.js +1 -0
- package/esm/production/seeds/unapply-seeds.js.map +1 -0
- package/esm/production/service/get-activated-handler-metadata.js +1 -0
- package/esm/production/service/get-activated-handler-metadata.js.map +1 -0
- package/esm/production/service/get-deactivation-handler-metadata.js +1 -0
- package/esm/production/service/get-deactivation-handler-metadata.js.map +1 -0
- package/esm/production/service/on-activated.js +1 -0
- package/esm/production/service/on-activated.js.map +1 -0
- package/esm/production/service/on-deactivation.js +1 -0
- package/esm/production/service/on-deactivation.js.map +1 -0
- package/esm/production/test-utils/mock-bind-entry.js +1 -0
- package/esm/production/test-utils/mock-bind-entry.js.map +1 -0
- package/esm/production/test-utils/mock-bind-service.js +1 -0
- package/esm/production/test-utils/mock-bind-service.js.map +1 -0
- package/esm/production/test-utils/mock-container.js +1 -0
- package/esm/production/test-utils/mock-container.js.map +1 -0
- package/esm/production/test-utils/mock-service.js +1 -0
- package/esm/production/test-utils/mock-service.js.map +1 -0
- package/esm/production/test-utils/mock-unbind-service.js +1 -0
- package/esm/production/test-utils/mock-unbind-service.js.map +1 -0
- package/esm/production/test-utils.js +1 -0
- package/esm/production/test-utils.js.map +1 -0
- package/esm/production/types/commands.js +1 -0
- package/esm/production/types/commands.js.map +1 -0
- package/index.d.ts +566 -0
- package/lib.d.ts +17 -0
- package/package.json +61 -0
- package/test-utils.d.ts +108 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Token for the container-scoped seeds map.
|
|
3
|
+
*/
|
|
4
|
+
var SEEDS_TOKEN = Symbol("@wirestate/seeds");
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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;;;;"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SEEDS_TOKEN } from '../registry.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Applies seeds to the container into the existing instance instead of replacing it.
|
|
5
|
+
* This allows multiple providers to co-exist without wiping each other's seeds.
|
|
6
|
+
*
|
|
7
|
+
* @param container - target container
|
|
8
|
+
* @param seeds - targeted seed entries apply
|
|
9
|
+
*/
|
|
10
|
+
function applySeeds(container, seeds) {
|
|
11
|
+
var existing = container.get(SEEDS_TOKEN);
|
|
12
|
+
for (var _i = 0, seeds_1 = seeds; _i < seeds_1.length; _i++) {
|
|
13
|
+
var _a = seeds_1[_i],
|
|
14
|
+
key = _a[0],
|
|
15
|
+
state = _a[1];
|
|
16
|
+
existing.set(key, state);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { applySeeds };
|
|
21
|
+
//# sourceMappingURL=apply-seeds.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply-seeds.js","sources":["../../../../../../../../src/wirestate-core/seeds/apply-seeds.ts"],"sourcesContent":[null],"names":["applySeeds","container","seeds","existing","get","SEEDS_TOKEN","_i","seeds_1","_a","key","state","set"],"mappings":";;AAQA;;;;;;AAMG;AACG,SAAUA,UAAUA,CAACC,SAAoB,EAAEC,KAAmB,EAAA;AAClE,EAAA,IAAMC,QAAQ,GAAcF,SAAS,CAACG,GAAG,CAACC,WAAW,CAAC;AAItD,EAAA,KAA2B,IAAAC,EAAA,GAAA,CAAK,EAALC,OAAA,GAAAL,KAAK,EAALI,mBAAK,EAALA,EAAA,EAAK,EAAE;AAAvB,IAAA,IAAAE,gBAAY;AAAXC,MAAAA,GAAG,GAAAD,EAAA,CAAA,CAAA,CAAA;AAAEE,MAAAA,KAAK,GAAAF,EAAA,CAAA,CAAA,CAAA;AACpBL,IAAAA,QAAQ,CAACQ,GAAG,CAACF,GAAG,EAAEC,KAAK,CAAC;AAC1B,EAAA;AACF;;;;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { SEED_TOKEN } from '../registry.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Applies shared seed to the container.
|
|
5
|
+
*
|
|
6
|
+
* @param container - target container
|
|
7
|
+
* @param seed - shared seed object
|
|
8
|
+
*/
|
|
9
|
+
function applySharedSeed(container, seed) {
|
|
10
|
+
container.rebind(SEED_TOKEN).toConstantValue(seed);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export { applySharedSeed };
|
|
14
|
+
//# sourceMappingURL=apply-shared-seed.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply-shared-seed.js","sources":["../../../../../../../../src/wirestate-core/seeds/apply-shared-seed.ts"],"sourcesContent":[null],"names":["applySharedSeed","container","seed","rebind","SEED_TOKEN","toConstantValue"],"mappings":";;AAQA;;;;;AAKG;AACG,SAAUA,eAAeA,CAACC,SAAoB,EAAEC,IAAgB,EAAA;EAGpED,SAAS,CAACE,MAAM,CAAaC,UAAU,CAAC,CAACC,eAAe,CAACH,IAAI,CAAC;AAChE;;;;"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SEEDS_TOKEN } from '../registry.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Removes specific seeds from the container.
|
|
5
|
+
* Used during provider unmounting to clean up only the entries owned by that provider.
|
|
6
|
+
*
|
|
7
|
+
* @param container - target container
|
|
8
|
+
* @param seeds - targeted seeds to remove
|
|
9
|
+
*/
|
|
10
|
+
function unapplySeeds(container, seeds) {
|
|
11
|
+
var existing = container.get(SEEDS_TOKEN);
|
|
12
|
+
for (var _i = 0, seeds_1 = seeds; _i < seeds_1.length; _i++) {
|
|
13
|
+
var key = seeds_1[_i][0];
|
|
14
|
+
existing.delete(key);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { unapplySeeds };
|
|
19
|
+
//# sourceMappingURL=unapply-seeds.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unapply-seeds.js","sources":["../../../../../../../../src/wirestate-core/seeds/unapply-seeds.ts"],"sourcesContent":[null],"names":["unapplySeeds","container","seeds","existing","get","SEEDS_TOKEN","_i","seeds_1","key","delete"],"mappings":";;AAQA;;;;;;AAMG;AACG,SAAUA,YAAYA,CAACC,SAAoB,EAAEC,KAAmB,EAAA;AACpE,EAAA,IAAMC,QAAQ,GAAcF,SAAS,CAACG,GAAG,CAACC,WAAW,CAAC;AAItD,EAAA,KAAoB,IAAAC,EAAA,GAAA,CAAK,EAALC,OAAA,GAAAL,KAAK,EAALI,mBAAK,EAALA,EAAA,EAAK,EAAE;IAAf,IAAAE,GAAG,GAAAD,OAAA,CAAAD,EAAA,CAAA,CAAA,CAAA,CAAA;AACbH,IAAAA,QAAQ,CAACM,MAAM,CAACD,GAAG,CAAC;AACtB,EAAA;AACF;;;;"}
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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;;;;"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { DEACTIVATION_HANDLER_METADATA } from '../registry.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Retrieves `@OnDeactivation` 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 getDeactivationHandlerMetadata(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 = DEACTIVATION_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 { getDeactivationHandlerMetadata };
|
|
27
|
+
//# sourceMappingURL=get-deactivation-handler-metadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-deactivation-handler-metadata.js","sources":["../../../../../../../../src/wirestate-core/service/get-deactivation-handler-metadata.ts"],"sourcesContent":[null],"names":["getDeactivationHandlerMetadata","instance","constructor","chain","Object","Function","prototype","own","DEACTIVATION_HANDLER_METADATA","get","length","push","getPrototypeOf","reverse","flat"],"mappings":";;AAMA;;;;;;;AAOG;AACG,SAAUA,8BAA8BA,CAACC,QAAgB,EAAA;AAG7D,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,6BAA6B,CAACC,GAAG,CAACP,WAAqB,CAAC;AAEnG,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;;;;"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ACTIVATED_HANDLER_METADATA } from '../registry.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Decorator for service methods that run after activation.
|
|
5
|
+
*
|
|
6
|
+
* @returns decorator function
|
|
7
|
+
*/
|
|
8
|
+
function OnActivated() {
|
|
9
|
+
return function (target, propertyKey) {
|
|
10
|
+
var constructor = target.constructor;
|
|
11
|
+
var list = ACTIVATED_HANDLER_METADATA.get(constructor);
|
|
12
|
+
if (!list) {
|
|
13
|
+
list = [];
|
|
14
|
+
ACTIVATED_HANDLER_METADATA.set(constructor, list);
|
|
15
|
+
}
|
|
16
|
+
list.push(propertyKey);
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { OnActivated };
|
|
21
|
+
//# sourceMappingURL=on-activated.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"on-activated.js","sources":["../../../../../../../../src/wirestate-core/service/on-activated.ts"],"sourcesContent":[null],"names":["OnActivated","target","propertyKey","constructor","list","ACTIVATED_HANDLER_METADATA","get","set","push"],"mappings":";;AAMA;;;;AAIG;SACaA,WAAWA,GAAA;AACzB,EAAA,OAAO,UAACC,MAAM,EAAEC,WAAW,EAAA;AAQzB,IAAA,IAAMC,WAAW,GAAIF,MAAiB,CAACE,WAAW;AAElD,IAAA,IAAIC,IAAI,GAAkCC,0BAA0B,CAACC,GAAG,CAACH,WAAW,CAAC;IAErF,IAAI,CAACC,IAAI,EAAE;AACTA,MAAAA,IAAI,GAAG,EAAE;AACTC,MAAAA,0BAA0B,CAACE,GAAG,CAACJ,WAAW,EAAEC,IAAI,CAAC;AACnD,IAAA;AAEAA,IAAAA,IAAI,CAACI,IAAI,CAACN,WAAW,CAAC;EACxB,CAAC;AACH;;;;"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { DEACTIVATION_HANDLER_METADATA } from '../registry.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Decorator for service methods that run before deactivation.
|
|
5
|
+
*
|
|
6
|
+
* @returns decorator function
|
|
7
|
+
*/
|
|
8
|
+
function OnDeactivation() {
|
|
9
|
+
return function (target, propertyKey) {
|
|
10
|
+
var constructor = target.constructor;
|
|
11
|
+
var list = DEACTIVATION_HANDLER_METADATA.get(constructor);
|
|
12
|
+
if (!list) {
|
|
13
|
+
list = [];
|
|
14
|
+
DEACTIVATION_HANDLER_METADATA.set(constructor, list);
|
|
15
|
+
}
|
|
16
|
+
list.push(propertyKey);
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { OnDeactivation };
|
|
21
|
+
//# sourceMappingURL=on-deactivation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"on-deactivation.js","sources":["../../../../../../../../src/wirestate-core/service/on-deactivation.ts"],"sourcesContent":[null],"names":["OnDeactivation","target","propertyKey","constructor","list","DEACTIVATION_HANDLER_METADATA","get","set","push"],"mappings":";;AAMA;;;;AAIG;SACaA,cAAcA,GAAA;AAC5B,EAAA,OAAO,UAACC,MAAM,EAAEC,WAAW,EAAA;AAQzB,IAAA,IAAMC,WAAW,GAAIF,MAAiB,CAACE,WAAW;AAElD,IAAA,IAAIC,IAAI,GAAkCC,6BAA6B,CAACC,GAAG,CAACH,WAAW,CAAC;IAExF,IAAI,CAACC,IAAI,EAAE;AACTA,MAAAA,IAAI,GAAG,EAAE;AACTC,MAAAA,6BAA6B,CAACE,GAAG,CAACJ,WAAW,EAAEC,IAAI,CAAC;AACtD,IAAA;AAEAA,IAAAA,IAAI,CAACI,IAAI,CAACN,WAAW,CAAC;EACxB,CAAC;AACH;;;;"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { bindEntry } from '../bind/bind-entry.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Binds a service entry to the IoC container for testing purposes.
|
|
5
|
+
* This utility uses {@link bindEntry} internally.
|
|
6
|
+
* It supports both service classes and injectable descriptors (constants, dynamic values, etc.).
|
|
7
|
+
*
|
|
8
|
+
* @param container - the IoC container to bind the entry to
|
|
9
|
+
* @param entry - the service class or injectable descriptor to bind
|
|
10
|
+
* @param options - optional binding configuration
|
|
11
|
+
* @returns void
|
|
12
|
+
*/
|
|
13
|
+
function mockBindEntry(container, entry, options) {
|
|
14
|
+
if (options === void 0) {
|
|
15
|
+
options = {};
|
|
16
|
+
}
|
|
17
|
+
var skipLifecycle = options.skipLifecycle;
|
|
18
|
+
return bindEntry(container, entry, {
|
|
19
|
+
isWithIgnoreLifecycle: skipLifecycle
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { mockBindEntry };
|
|
24
|
+
//# sourceMappingURL=mock-bind-entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mock-bind-entry.js","sources":["../../../../../../../../src/wirestate-core/test-utils/mock-bind-entry.ts"],"sourcesContent":[null],"names":["mockBindEntry","container","entry","options","skipLifecycle","bindEntry","isWithIgnoreLifecycle"],"mappings":";;AAiBA;;;;;;;;;AASG;SACaA,aAAaA,CAC3BC,SAAoB,EACpBC,KAAyC,EACzCC,OAAmC,EAAA;AAAnC,EAAA,IAAAA,OAAA,KAAA,MAAA,EAAA;IAAAA,OAAA,GAAA,EAAmC;AAAA,EAAA;AAE3B,EAAA,IAAAC,aAAa,GAAKD,OAAO,CAAAC,aAAZ;AAErB,EAAA,OAAOC,SAAS,CAACJ,SAAS,EAAEC,KAAK,EAAE;AACjCI,IAAAA,qBAAqB,EAAEF;AACxB,GAAA,CAAC;AACJ;;;;"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { bindService } from '../bind/bind-service.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Binds a service class to the IoC container for testing purposes.
|
|
5
|
+
* This utility uses {@link bindService} internally to ensure the service is correctly registered
|
|
6
|
+
* with the appropriate scope and metadata.
|
|
7
|
+
*
|
|
8
|
+
* @param container - the IoC container to bind the service to
|
|
9
|
+
* @param ServiceClass - the service class to bind
|
|
10
|
+
* @param options - optional binding configuration
|
|
11
|
+
* @returns void
|
|
12
|
+
*/
|
|
13
|
+
function mockBindService(container, ServiceClass, options) {
|
|
14
|
+
if (options === void 0) {
|
|
15
|
+
options = {};
|
|
16
|
+
}
|
|
17
|
+
var skipLifecycle = options.skipLifecycle;
|
|
18
|
+
return bindService(container, ServiceClass, {
|
|
19
|
+
isWithIgnoreLifecycle: skipLifecycle
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { mockBindService };
|
|
24
|
+
//# sourceMappingURL=mock-bind-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mock-bind-service.js","sources":["../../../../../../../../src/wirestate-core/test-utils/mock-bind-service.ts"],"sourcesContent":[null],"names":["mockBindService","container","ServiceClass","options","skipLifecycle","bindService","isWithIgnoreLifecycle"],"mappings":";;AAeA;;;;;;;;;AASG;SACaA,eAAeA,CAC7BC,SAAoB,EACpBC,YAAwB,EACxBC,OAAqC,EAAA;AAArC,EAAA,IAAAA,OAAA,KAAA,MAAA,EAAA;IAAAA,OAAA,GAAA,EAAqC;AAAA,EAAA;AAE7B,EAAA,IAAAC,aAAa,GAAKD,OAAO,CAAAC,aAAZ;AAErB,EAAA,OAAOC,WAAW,CAACJ,SAAS,EAAEC,YAAY,EAAE;AAC1CI,IAAAA,qBAAqB,EAAEF;AACxB,GAAA,CAAC;AACJ;;;;"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { getEntryToken } from '../bind/get-entry-token.js';
|
|
2
|
+
import { createIocContainer } from '../container/create-ioc-container.js';
|
|
3
|
+
import { ERROR_CODE_INVALID_ARGUMENTS } from '../error/error-code.js';
|
|
4
|
+
import { WirestateError } from '../error/wirestate-error.js';
|
|
5
|
+
import { mockBindEntry } from './mock-bind-entry.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Creates and configures a mock IoC container for testing.
|
|
9
|
+
* This utility initializes a new container and binds the provided services or descriptors using {@link mockBindEntry}.
|
|
10
|
+
* It also supports optional immediate activation of services.
|
|
11
|
+
*
|
|
12
|
+
* @param options - configuration options for the mock container
|
|
13
|
+
* @returns a configured InversifyJS {@link Container}
|
|
14
|
+
*
|
|
15
|
+
* @throws {WirestateError} if an identifier in `activate` is not found in `services`
|
|
16
|
+
*/
|
|
17
|
+
function mockContainer(options) {
|
|
18
|
+
if (options === void 0) {
|
|
19
|
+
options = {};
|
|
20
|
+
}
|
|
21
|
+
var _a = options.activate,
|
|
22
|
+
activate = _a === void 0 ? [] : _a,
|
|
23
|
+
_b = options.entries,
|
|
24
|
+
entries = _b === void 0 ? [] : _b,
|
|
25
|
+
skipLifecycle = options.skipLifecycle;
|
|
26
|
+
if (activate.length) {
|
|
27
|
+
var serviceTokens = entries.map(function (s) {
|
|
28
|
+
return getEntryToken(s);
|
|
29
|
+
});
|
|
30
|
+
for (var _i = 0, activate_1 = activate; _i < activate_1.length; _i++) {
|
|
31
|
+
var token = activate_1[_i];
|
|
32
|
+
if (!serviceTokens.includes(token)) {
|
|
33
|
+
throw new WirestateError(ERROR_CODE_INVALID_ARGUMENTS, "Provided services for activation not matching list of services to bind.");
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
var container = createIocContainer();
|
|
38
|
+
for (var _c = 0, entries_1 = entries; _c < entries_1.length; _c++) {
|
|
39
|
+
var it_1 = entries_1[_c];
|
|
40
|
+
mockBindEntry(container, it_1, {
|
|
41
|
+
skipLifecycle: skipLifecycle
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
for (var _d = 0, activate_2 = activate; _d < activate_2.length; _d++) {
|
|
45
|
+
var it_2 = activate_2[_d];
|
|
46
|
+
container.get(it_2);
|
|
47
|
+
}
|
|
48
|
+
return container;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export { mockContainer };
|
|
52
|
+
//# sourceMappingURL=mock-container.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mock-container.js","sources":["../../../../../../../../src/wirestate-core/test-utils/mock-container.ts"],"sourcesContent":[null],"names":["mockContainer","options","_a","activate","_b","entries","skipLifecycle","length","serviceTokens","map","s","getEntryToken","_i","activate_1","token","includes","WirestateError","ERROR_CODE_INVALID_ARGUMENTS","container","createIocContainer","_c","entries_1","it_1","mockBindEntry","_d","activate_2","it_2","get"],"mappings":";;;;;;AA6BA;;;;;;;;;AASG;AACG,SAAUA,aAAaA,CAACC,OAAmC,EAAA;AAAnC,EAAA,IAAAA,OAAA,KAAA,MAAA,EAAA;IAAAA,OAAA,GAAA,EAAmC;AAAA,EAAA;AACvD,EAAA,IAAAC,EAAA,GAA+CD,OAAO,CAAAE,QAAzC;IAAbA,QAAQ,GAAAD,EAAA,KAAA,MAAA,GAAG,EAAE,GAAAA,EAAA;IAAEE,EAAA,GAAgCH,OAAO,QAA3B;IAAZI,OAAO,mBAAG,EAAE,GAAAD,EAAA;IAAEE,aAAa,GAAKL,OAAO,CAAAK,aAAZ;EAElD,IAAIH,QAAQ,CAACI,MAAM,EAAE;IACnB,IAAMC,aAAa,GAA6BH,OAAO,CAACI,GAAG,CAAC,UAACC,CAAC,EAAA;MAAK,OAAAC,aAAa,CAACD,CAAC,CAAC;AAAhB,IAAA,CAAgB,CAAC;AAEpF,IAAA,KAAoB,IAAAE,EAAA,GAAA,CAAQ,EAARC,UAAA,GAAAV,QAAQ,EAARS,sBAAQ,EAARA,EAAA,EAAQ,EAAE;AAAzB,MAAA,IAAME,KAAK,GAAAD,UAAA,CAAAD,EAAA,CAAA;AACd,MAAA,IAAI,CAACJ,aAAa,CAACO,QAAQ,CAACD,KAAK,CAAC,EAAE;AAClC,QAAA,MAAM,IAAIE,cAAc,CACtBC,4BAA4B,EAC5B,yEAAyE,CAC1E;AACH,MAAA;AACF,IAAA;AACF,EAAA;AAEA,EAAA,IAAMC,SAAS,GAAcC,kBAAkB,EAAE;AAEjD,EAAA,KAAiB,IAAAC,EAAA,GAAA,CAAO,EAAPC,SAAA,GAAAhB,OAAO,EAAPe,qBAAO,EAAPA,EAAA,EAAO,EAAE;AAArB,IAAA,IAAME,IAAE,GAAAD,SAAA,CAAAD,EAAA,CAAA;AACXG,IAAAA,aAAa,CAACL,SAAS,EAAEI,IAAE,EAAE;AAAEhB,MAAAA,aAAa,EAAEA;AAAa,KAAE,CAAC;AAChE,EAAA;AAEA,EAAA,KAAiB,IAAAkB,EAAA,GAAA,CAAQ,EAARC,UAAA,GAAAtB,QAAQ,EAARqB,sBAAQ,EAARA,EAAA,EAAQ,EAAE;AAAtB,IAAA,IAAME,IAAE,GAAAD,UAAA,CAAAD,EAAA,CAAA;AACXN,IAAAA,SAAS,CAACS,GAAG,CAACD,IAAE,CAAC;AACnB,EAAA;AAEA,EAAA,OAAOR,SAAS;AAClB;;;;"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { mockBindService } from './mock-bind-service.js';
|
|
2
|
+
import { mockContainer } from './mock-container.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Mocks a service by binding it to an IoC container and returning its instance.
|
|
6
|
+
*
|
|
7
|
+
* @param service - the service class to mock
|
|
8
|
+
* @param container - the IoC container to use, defaults to a new {@link mockContainer}
|
|
9
|
+
* @param options - additional options for mocking
|
|
10
|
+
* @returns the instantiated service instance
|
|
11
|
+
*/
|
|
12
|
+
function mockService(service, container, options) {
|
|
13
|
+
if (container === void 0) {
|
|
14
|
+
container = mockContainer();
|
|
15
|
+
}
|
|
16
|
+
if (options === void 0) {
|
|
17
|
+
options = {};
|
|
18
|
+
}
|
|
19
|
+
mockBindService(container, service, {
|
|
20
|
+
skipLifecycle: options.skipLifecycle
|
|
21
|
+
});
|
|
22
|
+
return container.get(service);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { mockService };
|
|
26
|
+
//# sourceMappingURL=mock-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mock-service.js","sources":["../../../../../../../../src/wirestate-core/test-utils/mock-service.ts"],"sourcesContent":[null],"names":["mockService","service","container","options","mockContainer","mockBindService","skipLifecycle","get"],"mappings":";;;AAeA;;;;;;;AAOG;SACaA,WAAWA,CACzBC,OAAmB,EACnBC,SAA2B,EAC3BC,OAAiC,EAAA;AADjC,EAAA,IAAAD,SAAA,KAAA,MAAA,EAAA;IAAAA,SAAA,GAAYE,aAAa,EAAE;AAAA,EAAA;AAC3B,EAAA,IAAAD,OAAA,KAAA,MAAA,EAAA;IAAAA,OAAA,GAAA,EAAiC;AAAA,EAAA;AAEjCE,EAAAA,eAAe,CAACH,SAAS,EAAED,OAAO,EAAE;IAClCK,aAAa,EAAEH,OAAO,CAACG;AACxB,GAAA,CAAC;AAEF,EAAA,OAAOJ,SAAS,CAACK,GAAG,CAACN,OAAO,CAAM;AACpC;;;;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unbinds a service from the IoC container.
|
|
3
|
+
* This is useful in tests to reset or override specific service registrations.
|
|
4
|
+
*
|
|
5
|
+
* @param container - the IoC container to unbind the service from
|
|
6
|
+
* @param ServiceClass - the service class to unbind
|
|
7
|
+
*/
|
|
8
|
+
function mockUnbindService(container, ServiceClass) {
|
|
9
|
+
container.unbind(ServiceClass);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { mockUnbindService };
|
|
13
|
+
//# sourceMappingURL=mock-unbind-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mock-unbind-service.js","sources":["../../../../../../../../src/wirestate-core/test-utils/mock-unbind-service.ts"],"sourcesContent":[null],"names":["mockUnbindService","container","ServiceClass","unbind"],"mappings":"AAEA;;;;;;AAMG;AACG,SAAUA,iBAAiBA,CAAmBC,SAAoB,EAAEC,YAAwB,EAAA;AAChGD,EAAAA,SAAS,CAACE,MAAM,CAACD,YAAY,CAAC;AAChC;;;;"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { mockBindService } from './test-utils/mock-bind-service.js';
|
|
2
|
+
export { mockBindEntry } from './test-utils/mock-bind-entry.js';
|
|
3
|
+
export { mockUnbindService } from './test-utils/mock-unbind-service.js';
|
|
4
|
+
export { mockContainer } from './test-utils/mock-container.js';
|
|
5
|
+
export { mockService } from './test-utils/mock-service.js';
|
|
6
|
+
//# sourceMappingURL=test-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-utils.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Command execution status.
|
|
3
|
+
*/
|
|
4
|
+
var ECommandStatus;
|
|
5
|
+
(function (ECommandStatus) {
|
|
6
|
+
ECommandStatus["PENDING"] = "pending";
|
|
7
|
+
ECommandStatus["SETTLED"] = "settled";
|
|
8
|
+
ECommandStatus["ERROR"] = "error";
|
|
9
|
+
})(ECommandStatus || (ECommandStatus = {}));
|
|
10
|
+
|
|
11
|
+
export { ECommandStatus };
|
|
12
|
+
//# sourceMappingURL=commands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commands.js","sources":["../../../../../../../../src/wirestate-core/types/commands.ts"],"sourcesContent":[null],"names":["ECommandStatus"],"mappings":"AA2CA;;AAEG;IACSA;AAAZ,CAAA,UAAYA,cAAc,EAAA;AACxBA,EAAAA,cAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnBA,EAAAA,cAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnBA,EAAAA,cAAA,CAAA,OAAA,CAAA,GAAA,OAAe;AACjB,CAAC,EAJWA,cAAc,KAAdA,cAAc,GAAA,EAAA,CAAA,CAAA;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{LazyServiceIdentifier as e}from"inversify";export{bindingTypeValues as BindingType,Container,ContainerModule,inject as Inject,injectable as Injectable,LazyServiceIdentifier,multiInject as MultiInject,named as Named,optional as Optional,postConstruct as PostConstruct,preDestroy as PreDestroy,bindingScopeValues as ScopeBindingType,tagged as Tagged}from"inversify";function n(n){return new e(n)}export{n as forwardRef};//# sourceMappingURL=alias.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alias.js","sources":["../../../../../../../src/wirestate-core/alias.ts"],"sourcesContent":[null],"names":["forwardRef","forward","LazyServiceIdentifier"],"mappings":"mXAoBM,SAAUA,EACdC,GAEA,OAAO,IAAIC,EAAsBD,EACnC,QAAAD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{bindingScopeValues as r}from"inversify";import{ERROR_CODE_BINDING_SCOPE as e}from"../error/error-code.js";import{WirestateError as o}from"../error/wirestate-error.js";function i(i,n){if(n.scopeBindingType&&n.scopeBindingType!==r.Singleton)throw new o(e,"Provided unexpected binding scope for constant value.");i.bind(n.id).toConstantValue(n.value)}export{i as bindConstant};//# sourceMappingURL=bind-constant.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bind-constant.js","sources":["../../../../../../../../src/wirestate-core/bind/bind-constant.ts"],"sourcesContent":[null],"names":["bindingScopeValues","ERROR_CODE_BINDING_SCOPE","WirestateError","bindConstant","container","entry","scopeBindingType","ScopeBindingType","Singleton","bind","id","toConstantValue","value"],"mappings":"6BAUAA,MAAA,+CAAAC,MAAA,kDAAAC,MAAA,8BAMM,SAAUC,EAAgBC,EAAsBC,GAQpD,GAAIA,EAAMC,kBAAoBD,EAAMC,mBAAqBC,EAAiBC,UACxE,MAAM,IAAIN,EAAeD,EAA0B,yDAGrDG,EAAUK,KAAQJ,EAAMK,IAA4BC,gBAAgBN,EAAMO,MAC5E,QAAAT"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{bindingScopeValues as n}from"inversify";function e(e,i){var o=e.bind(i.id).toDynamicValue((function(){return i.factory?i.factory():i.value}));i.scopeBindingType&&(i.scopeBindingType===n.Transient?o.inTransientScope():i.scopeBindingType===n.Request?o.inRequestScope():o.inSingletonScope())}export{e as bindDynamicValue};//# sourceMappingURL=bind-dynamic-value.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bind-dynamic-value.js","sources":["../../../../../../../../src/wirestate-core/bind/bind-dynamic-value.ts"],"sourcesContent":[null],"names":["bindingScopeValues","bindDynamicValue","container","entry","binding","bind","id","toDynamicValue","factory","value","scopeBindingType","Transient","inTransientScope","Request","inRequestScope","inSingletonScope"],"mappings":"6BAOAA,MAAA,YAMM,SAAUC,EAAiBC,EAAsBC,GAMrD,IAAMC,EAA6CF,EAAUG,KAAKF,EAAMG,IAAIC,gBAAe,WACzF,OAAIJ,EAAMK,QACDL,EAAMK,UAGRL,EAAMM,KACf,IAEKN,EAAMO,mBAEAP,EAAMO,mBAAqBV,EAAmBW,UACvDP,EAAQQ,mBACCT,EAAMO,mBAAqBV,EAAmBa,QACvDT,EAAQU,iBAERV,EAAQW,mBAEZ,QAAAd"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{bindingTypeValues as i}from"inversify";import{bindConstant as n}from"./bind-constant.js";import{bindDynamicValue as o}from"./bind-dynamic-value.js";import{bindService as e}from"./bind-service.js";function r(r,t,m){return void 0===m&&(m={}),"function"==typeof t?e(r,t,m):t.bindingType&&t.bindingType!==i.ConstantValue?t.bindingType===i.DynamicValue?o(r,t):e(r,t.value,m):n(r,t)}export{r as bindEntry};//# sourceMappingURL=bind-entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bind-entry.js","sources":["../../../../../../../../src/wirestate-core/bind/bind-entry.ts"],"sourcesContent":[null],"names":["bindingTypeValues","bindConstant","bindDynamicValue","bindService","bindEntry","container","entry","options","bindingType","ConstantValue","DynamicValue","value"],"mappings":"4BAiBAA,MAAA,mCAAAC,MAAA,gDAAAC,MAAA,gDAAAC,MAAA,6BAegBC,EACdC,EACAC,EACAC,GAEA,YAFA,IAAAA,IAAAA,EAAA,CAAA,GAEqB,mBAAVD,EACFH,EAAYE,EAAWC,EAAOC,GAGlCD,EAAME,aAAeF,EAAME,cAAgBR,EAAkBS,cAI9DH,EAAME,cAAgBR,EAAkBU,aAMnCR,EAAiBG,EAAWC,GAS9BH,EAAYE,EAAWC,EAAMK,MAAgCJ,GAlB3DN,EAAaI,EAAWC,EAmBnC,QAAAF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{CommandBus as e}from"../commands/command-bus.js";import{getCommandHandlerMetadata as t}from"../commands/get-command-handler-metadata.js";import{WireScope as r}from"../container/wire-scope.js";import{buildEventDispatcher as n}from"../events/build-event-dispatcher.js";import{EventBus as o}from"../events/event-bus.js";import{getQueryHandlerMetadata as i}from"../queries/get-query-handler-metadata.js";import{QueryBus as a}from"../queries/query-bus.js";import{CONTAINER_REFS_BY_SERVICE as f,WIRE_SCOPES_BY_SERVICE as c,EVENT_UNSUBSCRIBERS_BY_SERVICE as s,QUERY_UNREGISTERS_BY_SERVICE as u,COMMAND_UNREGISTERS_BY_SERVICE as v}from"../registry.js";import{getActivatedHandlerMetadata as l}from"../service/get-activated-handler-metadata.js";import{getDeactivationHandlerMetadata as m}from"../service/get-deactivation-handler-metadata.js";function d(d,h,y){var j=d.bind(h).to(h).inSingletonScope();j.onActivation((function(u,v){v.IS_DISPOSED=!1,f.set(v,d),function(e,t){var n=Reflect.getMetadata("design:paramtypes",t);if(!(null==n?void 0:n.some((function(e){return e===r}))))return;for(var o=[],i=0,a=Object.getOwnPropertyNames(e);i<a.length;i++){var f=e[a[i]];(null==f?void 0:f.constructor)===r&&o.push(f)}o.length>0&&c.set(e,o)}(v,h);var m=n(v);m&&function(e,t){var r,n=null===(r=f.get(e))||void 0===r?void 0:r.get(o);n&&s.set(e,n.subscribe(t))}(v,m);for(var j=d.get(a),b=0,S=i(v);b<S.length;b++){var D=S[b];if("function"==typeof(N=v[D.methodName])){var I=j.register(D.type,N.bind(v));g(v,I)}}for(var O=d.get(e),q=0,w=t(v);q<w.length;q++){var N;D=w[q];if("function"==typeof(N=v[D.methodName])){I=O.register(D.type,N.bind(v));p(v,I)}}if(null==y?void 0:y.isWithIgnoreLifecycle);else for(var P=function(e){var t=v[e];if("function"!=typeof t)return"continue";var r=t.call(v);r&&"function"==typeof r.then&&r.catch((function(t){console.error("[wirestate] @OnActivated rejected for:",h.name,String(e),t)}))},A=0,E=l(v);A<E.length;A++){P(E[A])}return v})),j.onDeactivation((function(e){if(null==y?void 0:y.isWithIgnoreLifecycle);else for(var t=0,r=m(e);t<r.length;t++){var n=e[r[t]];"function"==typeof n&&n.call(e)}var o,i;e.IS_DISPOSED=!0,function(e){var t=c.get(e);if(!t)return;for(var r=0,n=t;r<n.length;r++){var o=n[r];o.isDisposed=!0,o.container=null}c.delete(e)}(e),function(e){var t=v.get(e);if(!t)return;for(var r=0,n=t;r<n.length;r++){(0,n[r])()}v.delete(e)}(e),function(e){var t=u.get(e);if(!t)return;for(var r=0,n=t;r<n.length;r++){(0,n[r])()}u.delete(e)}(e),o=e,(i=s.get(o))&&(i(),s.delete(o)),f.delete(e)}))}function g(e,t){var r=u.get(e);r||(r=[],u.set(e,r)),r.push(t)}function p(e,t){var r=v.get(e);r||(r=[],v.set(e,r)),r.push(t)}export{d as bindService};//# sourceMappingURL=bind-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bind-service.js","sources":["../../../../../../../../src/wirestate-core/bind/bind-service.ts"],"sourcesContent":[null],"names":["CommandBus","getCommandHandlerMetadata","WireScope","buildEventDispatcher","EventBus","getQueryHandlerMetadata","QueryBus","CONTAINER_REFS_BY_SERVICE","WIRE_SCOPES_BY_SERVICE","EVENT_UNSUBSCRIBERS_BY_SERVICE","QUERY_UNREGISTERS_BY_SERVICE","COMMAND_UNREGISTERS_BY_SERVICE","getActivatedHandlerMetadata","getDeactivationHandlerMetadata","bindService","container","entry","options","whenBind","bind","to","inSingletonScope","onActivation","context","instance","IS_DISPOSED","set","service","Service","paramTypes","Reflect","getMetadata","some","type","scopes","_i","_a","Object","getOwnPropertyNames","length","value","constructor","push","attachWireScopes","dispatcher","handler","bus","get","subscribe","attachEventsSubscription","queryBus","meta","method","methodName","unregister","register","attachQueryUnregister","commandBus","_b","_c","attachCommandUnregister","isWithIgnoreLifecycle","result","call","then","catch","error","console","name","String","_d","_e","onDeactivation","unsubscribe","scopes_1","scope","isDisposed","delete","detachWireScopes","list","list_2","detachCommandUnregister","list_1","detachQueryUnregister"],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function n(n){return"function"==typeof n?n:n.id}export{n as getEntryToken};//# sourceMappingURL=get-entry-token.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-entry-token.js","sources":["../../../../../../../../src/wirestate-core/bind/get-entry-token.ts"],"sourcesContent":[null],"names":["getEntryToken","entry","id"],"mappings":"AAYM,SAAUA,EAAyCC,GACvD,MAAwB,mBAAVA,EAAuBA,EAAQA,EAAMC,EACrD,QAAAF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ERROR_CODE_FAILED_TO_RESOLVE_COMMAND_HANDLER as t}from"../error/error-code.js";import{WirestateError as r}from"../error/wirestate-error.js";import{ECommandStatus as n}from"../types/commands.js";var e=function(){function e(){this.handlers=new Map}return e.prototype.register=function(t,r){var n=this,e=this.handlers.get(t);return e||(e=[],this.handlers.set(t,e)),e.push(r),function(){var e=n.handlers.get(t);if(e){var o=e.indexOf(r);o>=0&&e.splice(o,1),0===e.length&&n.handlers.delete(t)}}},e.prototype.command=function(e,o){var s=this.handlers.get(e);if(!(null==s?void 0:s.length))throw new r(t,"No command handler registered in container for type: '".concat(String(e),"'."));var i=s[s.length-1],a={task:null,status:n.PENDING};return a.task=Promise.resolve().then((function(){return i(o)})).then((function(t){return a.status=n.SETTLED,t})).catch((function(t){throw a.status=n.ERROR,t})),a},e.prototype.commandOptional=function(t,r){var n=this.handlers.get(t);return(null==n?void 0:n.length)?this.command(t,r):null},e.prototype.has=function(t){var r;return Boolean(null===(r=this.handlers.get(t))||void 0===r?void 0:r.length)},e.prototype.clear=function(){this.handlers.clear()},e}();export{e as CommandBus};//# sourceMappingURL=command-bus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-bus.js","sources":["../../../../../../../../src/wirestate-core/commands/command-bus.ts"],"sourcesContent":[null],"names":["ERROR_CODE_FAILED_TO_RESOLVE_COMMAND_HANDLER","WirestateError","ECommandStatus","CommandBus","this","handlers","Map","prototype","register","type","handler","_this","stack","get","set","push","current","index","indexOf","splice","length","delete","command","data","concat","String","descriptor","task","status","PENDING","Promise","resolve","then","result","SETTLED","catch","error","ERROR","commandOptional","has","Boolean","_a","clear"],"mappings":"uDAcAA,MAAA,kDAAAC,MAAA,uDAAAC,MAAA,uBAMA,IAAAC,EAAA,WAAA,SAAAA,IAKmBC,KAAAC,SAAsD,IAAIC,GA4H7E,CAAA,OAlHSH,EAAAI,UAAAC,SAAP,SAA0CC,EAAoBC,GAA9D,IAAAC,EAAAP,KAOMQ,EAAuCR,KAAKC,SAASQ,IAAIJ,GAS7D,OAPKG,IACHA,EAAQ,GACRR,KAAKC,SAASS,IAAIL,EAAMG,IAG1BA,EAAMG,KAAKL,GAEJ,WAOL,IAAMM,EAAyCL,EAAKN,SAASQ,IAAIJ,GAEjE,GAAKO,EAAL,CAIA,IAAMC,EAAgBD,EAAQE,QAAQR,GAElCO,GAAS,GACXD,EAAQG,OAAOF,EAAO,GAID,IAAnBD,EAAQI,QACVT,EAAKN,SAASgB,OAAOZ,EAVvB,CAYF,CACF,EAYON,EAAAI,UAAAe,QAAP,SAAyCb,EAAoBc,GAC3D,IAAMX,EAAuCR,KAAKC,SAASQ,IAAIJ,GAE/D,KAAKG,aAAK,EAALA,EAAOQ,QACV,MAAM,IAAInB,EACRD,EACA,yDAAAwB,OAAyDC,OAAOhB,GAAK,OAIzE,IAAMC,EAAUE,EAAMA,EAAMQ,OAAS,GAE/BM,EAAoC,CACxCC,KAAM,KACNC,OAAQ1B,EAAe2B,SAgBzB,OAbCH,EAAoCC,KAAOG,QAAQC,UACjDC,MAAK,WAAM,OAAAtB,EAAQa,EAAR,IACXS,MAAK,SAACC,GAGL,OAFCP,EAA0CE,OAAS1B,EAAegC,QAE5DD,CACT,IACCE,OAAM,SAACC,GAGN,MAFCV,EAA0CE,OAAS1B,EAAemC,MAE7DD,CACR,IAEKV,CACT,EASOvB,EAAAI,UAAA+B,gBAAP,SAAiD7B,EAAoBc,GACnE,IAAMX,EAAuCR,KAAKC,SAASQ,IAAIJ,GAE/D,OAAOG,eAAAA,EAAOQ,QAAShB,KAAKkB,QAAcb,EAAMc,GAAQ,IAC1D,EAQOpB,EAAAI,UAAAgC,IAAP,SAAW9B,SACT,OAAO+B,QAA+B,QAAvBC,EAAArC,KAAKC,SAASQ,IAAIJ,UAAK,IAAAgC,OAAA,EAAAA,EAAErB,OAC1C,EAKOjB,EAAAI,UAAAmC,MAAP,WACEtC,KAAKC,SAASqC,OAChB,EACFvC,CAAA,CAjIA,UAiICA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{CommandBus as o}from"./command-bus.js";function m(m,n,t){return m.get(o).commandOptional(n,t)}export{m as commandOptional};//# sourceMappingURL=command-optional.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-optional.js","sources":["../../../../../../../../src/wirestate-core/commands/command-optional.ts"],"sourcesContent":[null],"names":["CommandBus","commandOptional","container","type","data","get"],"mappings":"qBASAA,MAAA,4BAQgBC,EACdC,EACAC,EACAC,GAIA,OAAOF,EAAUG,IAAIL,GAAYC,gBAAsBE,EAAMC,EAC/D,QAAAH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{CommandBus as m}from"./command-bus.js";function o(o,n,r){return o.get(m).command(n,r)}export{o as command};//# sourceMappingURL=command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command.js","sources":["../../../../../../../../src/wirestate-core/commands/command.ts"],"sourcesContent":[null],"names":["CommandBus","command","container","type","data","get"],"mappings":"qBAQAA,MAAA,4BAQgBC,EACdC,EACAC,EACAC,GAIA,OAAOF,EAAUG,IAAIL,GAAYC,QAAcE,EAAMC,EACvD,QAAAH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{COMMAND_HANDLER_METADATA as t}from"../registry.js";function r(r){for(var e=r.constructor,o=[];"function"==typeof e&&e!==Object&&e!==Function.prototype;){var n=t.get(e);n&&n.length>0&&o.push(n),e=Object.getPrototypeOf(e)}return o.reverse().flat()}export{r as getCommandHandlerMetadata};//# sourceMappingURL=get-command-handler-metadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-command-handler-metadata.js","sources":["../../../../../../../../src/wirestate-core/commands/get-command-handler-metadata.ts"],"sourcesContent":[null],"names":["COMMAND_HANDLER_METADATA","getCommandHandlerMetadata","instance","constructor","chain","Object","Function","prototype","own","get","length","push","getPrototypeOf","reverse","flat"],"mappings":"mCAOAA,MAAA,iBAQM,SAAUC,EAA0BC,GAWxC,IALA,IAAIC,EAAuBD,EAASC,YAE9BC,EAA+C,GAGvB,mBAAhBD,GAA8BA,IAAgBE,QAAUF,IAAgBG,SAASC,WAAW,CACxG,IAAMC,EAA6CR,EAAyBS,IAAIN,GAE5EK,GAAOA,EAAIE,OAAS,GACtBN,EAAMO,KAAKH,GAGbL,EAAcE,OAAOO,eAAeT,EACtC,CASA,OAAOC,EAAMS,UAAUC,MACzB,QAAAb"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{COMMAND_HANDLER_METADATA as t}from"../registry.js";function r(r){return function(e,o){var n=e.constructor,s=t.get(n);s||(s=[],t.set(n,s)),s.push({methodName:o,type:r})}}export{r as OnCommand};//# sourceMappingURL=on-command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"on-command.js","sources":["../../../../../../../../src/wirestate-core/commands/on-command.ts"],"sourcesContent":[null],"names":["COMMAND_HANDLER_METADATA","OnCommand","type","target","propertyKey","constructor","list","get","set","push","methodName"],"mappings":"mCAOAA,MAAA,iBAMM,SAAUC,EAAUC,GACxB,OAAO,SAACC,EAAQC,GASd,IAAMC,EAAcF,EAAOE,YAEvBC,EAA8CN,EAAyBO,IAAIF,GAE1EC,IACHA,EAAO,GACPN,EAAyBQ,IAAIH,EAAaC,IAI5CA,EAAKG,KAAK,CAAEC,WAAYN,EAAaF,KAAIA,GAC3C,CACF,QAAAD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Container as n}from"inversify";import{CommandBus as e}from"../commands/command-bus.js";import{WireScope as o}from"./wire-scope.js";import{EventBus as t}from"../events/event-bus.js";import{QueryBus as r}from"../queries/query-bus.js";import{SEEDS_TOKEN as i,SEED_TOKEN as s}from"../registry.js";function a(a){var u;void 0===a&&(a={});var m=new n({defaultScope:"Singleton",parent:a.parent});return m.bind(t).toConstantValue(new t),m.bind(r).toConstantValue(new r),m.bind(e).toConstantValue(new e),m.bind(i).toConstantValue(new Map),m.bind(s).toConstantValue(null!==(u=a.seed)&&void 0!==u?u:{}),m.bind(o).toResolvedValue((function(){return new o(m)})).inTransientScope(),m}export{a as createIocContainer};//# sourceMappingURL=create-ioc-container.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-ioc-container.js","sources":["../../../../../../../../src/wirestate-core/container/create-ioc-container.ts"],"sourcesContent":[null],"names":["Container","CommandBus","WireScope","EventBus","QueryBus","SEEDS_TOKEN","SEED_TOKEN","createIocContainer","options","container","defaultScope","parent","bind","toConstantValue","Map","_a","seed","toResolvedValue","inTransientScope"],"mappings":"oBAwBAA,MAAA,iCAAAC,MAAA,iDAAAC,MAAA,qCAAAC,MAAA,4CAAAC,MAAA,gDAAAC,gBAAAC,MAAA,iBAMM,SAAUC,EAAmBC,cAAA,IAAAA,IAAAA,EAAA,CAAA,GAGjC,IAAMC,EAAuB,IAAIT,EAAU,CACzCU,aAAc,YACdC,OAAQH,EAAQG,SAgBlB,OAbAF,EAAUG,KAAKT,GAAUU,gBAAgB,IAAIV,GAC7CM,EAAUG,KAAKR,GAAUS,gBAAgB,IAAIT,GAC7CK,EAAUG,KAAKX,GAAYY,gBAAgB,IAAIZ,GAC/CQ,EAAUG,KAAKP,GAAaQ,gBAAgB,IAAIC,KAChDL,EAAUG,KAAKN,GAAYO,gBAA4B,QAAZE,EAAAP,EAAQQ,YAAI,IAAAD,EAAAA,EAAI,CAAA,GAE3DN,EACGG,KAAKV,GACLe,iBAAgB,WAAiB,OAAA,IAAIf,EAAUO,EAAd,IACjCS,mBAIIT,CACT,QAAAF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__decorate as t,__metadata as e}from"tslib";import{injectable as r}from"inversify";import{CommandBus as o}from"../commands/command-bus.js";import{ERROR_CODE_ACCESS_AFTER_DISPOSAL as n,ERROR_CODE_ACCESS_BEFORE_ACTIVATION as i}from"../error/error-code.js";import{WirestateError as s}from"../error/wirestate-error.js";import{EventBus as a}from"../events/event-bus.js";import{QueryBus as p}from"../queries/query-bus.js";import{SEEDS_TOKEN as u,SEED_TOKEN as c}from"../registry.js";var m=function(){function m(t){this.container=t,this.isDisposed=!1}return m.prototype.getContainer=function(){if(this.container)return this.container;throw this.isDisposed?new s(n,"WireScope::container accessed after deactivation. Ensure service is properly disposed."):new s(i,"WireScope::container accessed before activation. Ensure service is bound to container and is properly resolved.")},m.prototype.resolve=function(t){return this.getContainer().get(t)},m.prototype.resolveOptional=function(t){var e=this.getContainer();return e.isBound(t)?e.get(t):null},m.prototype.emitEvent=function(t,e,r){this.getContainer().get(a).emit({type:t,payload:e,from:void 0===r?this:r})},m.prototype.queryData=function(t,e){return this.getContainer().get(p).query(t,e)},m.prototype.queryOptionalData=function(t,e){return this.getContainer().get(p).queryOptional(t,e)},m.prototype.executeCommand=function(t,e){return this.getContainer().get(o).command(t,e)},m.prototype.executeOptionalCommand=function(t,e){return this.getContainer().get(o).commandOptional(t,e)},m.prototype.getSeed=function(t){return t?this.getContainer().get(u).get(t)||null:this.getContainer().get(c)},m=t([r(),e("design:paramtypes",[Object])],m)}();export{m as WireScope};//# sourceMappingURL=wire-scope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wire-scope.js","sources":["../../../../../../../../src/wirestate-core/container/wire-scope.ts"],"sourcesContent":[null],"names":["__decorate","__metadata","injectable","CommandBus","ERROR_CODE_ACCESS_AFTER_DISPOSAL","ERROR_CODE_ACCESS_BEFORE_ACTIVATION","WirestateError","EventBus","QueryBus","SEEDS_TOKEN","SEED_TOKEN","WireScope","container","this","isDisposed","prototype","getContainer","resolve","injectionId","get","resolveOptional","isBound","emitEvent","type","payload","from","emit","undefined","queryData","data","query","queryOptionalData","queryOptional","executeCommand","command","executeOptionalCommand","commandOptional","getSeed","seed"],"mappings":"qBAoBAA,gBAAAC,MAAA,6BAAAC,MAAA,iCAAAC,MAAA,wEAAAC,yCAAAC,MAAA,kDAAAC,MAAA,iDAAAC,MAAA,4CAAAC,MAAA,gDAAAC,gBAAAC,MAAA,iBAMA,IAAAC,EAAA,WAME,SAAAA,EAAoCC,GAAAC,KAAAD,UAAAA,EAFpBC,KAAAC,YAAsB,CAE+B,CA0LvE,OAhLSH,EAAAI,UAAAC,aAAP,WACE,GAAIH,KAAKD,UACP,OAAOC,KAAKD,UAGd,MAAIC,KAAKC,WACD,IAAIR,EACRF,EACA,0FAGI,IAAIE,EACRD,EACA,kHAIN,EAYOM,EAAAI,UAAAE,QAAP,SAAkBC,GAMhB,OAAOL,KAAKG,eAAeG,IAAOD,EACpC,EAYOP,EAAAI,UAAAK,gBAAP,SAA0BF,GAMxB,IAAMN,EAAuBC,KAAKG,eAElC,OAAOJ,EAAUS,QAAQH,GAAeN,EAAUO,IAAOD,GAAe,IAC1E,EAYOP,EAAAI,UAAAO,UAAP,SAAuDC,EAASC,EAAaC,GAO3EZ,KAAKG,eACFG,IAAIZ,GACJmB,KAAK,CACJH,KAAIA,EACJC,QAAOA,EACPC,UAAeE,IAATF,EAAqBZ,KAAOY,GAExC,EAYOd,EAAAI,UAAAa,UAAP,SAA8EL,EAASM,GAGrF,OAAOhB,KAAKG,eAAeG,IAAIX,GAAUsB,MAAYP,EAAMM,EAC7D,EAUOlB,EAAAI,UAAAgB,kBAAP,SACER,EACAM,GAIA,OAAOhB,KAAKG,eAAeG,IAAIX,GAAUwB,cAAoBT,EAAMM,EACrE,EAYOlB,EAAAI,UAAAkB,eAAP,SACEV,EACAM,GAIA,OAAOhB,KAAKG,eAAeG,IAAIhB,GAAY+B,QAAcX,EAAMM,EACjE,EAUOlB,EAAAI,UAAAoB,uBAAP,SACEZ,EACAM,GAIA,OAAOhB,KAAKG,eAAeG,IAAIhB,GAAYiC,gBAAsBb,EAAMM,EACzE,EAeOlB,EAAAI,UAAAsB,QAAP,SAAqCC,GAKnC,OAAOA,EACFzB,KAAKG,eAAeG,IAAeV,GAAaU,IAAImB,IAAe,KACpEzB,KAAKG,eAAeG,IAAOT,EACjC,EA/LWC,EAASX,EAAA,CADrBE,qCACYS,EAgMZ,CAhMD,UADAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var r=1,a=51,e=52,o=101,p=102,t=200,v=201;export{v as ERROR_CODE_ACCESS_AFTER_DISPOSAL,t as ERROR_CODE_ACCESS_BEFORE_ACTIVATION,e as ERROR_CODE_BINDING_SCOPE,p as ERROR_CODE_FAILED_TO_RESOLVE_COMMAND_HANDLER,o as ERROR_CODE_FAILED_TO_RESOLVE_QUERY_HANDLER,r as ERROR_CODE_GENERIC,a as ERROR_CODE_INVALID_ARGUMENTS};//# sourceMappingURL=error-code.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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,EAA6B,EAG7BC,EAAuC,GACvCC,EAAmC,GAGnCC,EAAqD,IACrDC,EAAuD,IAEvDC,EAA8C,IAC9CC,EAA2C,WAAAA,sCAAAD,yCAAAH,8BAAAE,kDAAAD,gDAAAH,wBAAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__extends as r}from"tslib";import{ERROR_CODE_GENERIC as e}from"./error-code.js";var o=function(o){function t(r,t){void 0===r&&(r=e);var i=o.call(this)||this;return i.name="WirestateError",i.code=r,i.message=t||"Wirestate error.",i}return r(t,o),t}(Error);export{o as WirestateError};//# sourceMappingURL=wirestate-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wirestate-error.js","sources":["../../../../../../../../src/wirestate-core/error/wirestate-error.ts"],"sourcesContent":[null],"names":["__extends","ERROR_CODE_GENERIC","WirestateError","_super","code","detail","_this","this","name","message","Error"],"mappings":"oBAEAA,MAAA,qCAAAC,MAAA,kBAMA,IAAAC,EAAA,SAAAC,GAcE,SAAAD,EAAmBE,EAAmCC,QAAnC,IAAAD,IAAAA,EAAAH,GACjB,IAAAK,EAAAH,cAAOI,YAXOD,EAAAE,KAAe,iBAa7BF,EAAKF,KAAOA,EACZE,EAAKG,QAAUJ,GAAU,oBAC3B,CACF,OApBoCL,EAAAE,EAAAC,GAoBpCD,CAAA,CApBA,CAAoCQ,cAAKR"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{getEventHandlerMetadata as e}from"./get-event-handler-metadata.js";function t(t){for(var n=[],r=0,a=e(t);r<a.length;r++){var l=a[r],o=t[l.methodName];"function"==typeof o&&n.push({types:l.types,handler:o.bind(t)})}return n.length?function(e){for(var t=0,r=n;t<r.length;t++){var a=r[t];(null===a.types||a.types.includes(e.type))&&a.handler(e)}}:null}export{t as buildEventDispatcher};//# sourceMappingURL=build-event-dispatcher.js.map
|