@genesislcap/foundation-store 14.117.0 → 14.118.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. package/README.md +94 -36
  2. package/dist/dts/__test__/elements.d.ts +701 -0
  3. package/dist/dts/__test__/elements.d.ts.map +1 -0
  4. package/dist/dts/__test__/index.d.ts +5 -0
  5. package/dist/dts/__test__/index.d.ts.map +1 -0
  6. package/dist/dts/__test__/services.d.ts +40 -0
  7. package/dist/dts/__test__/services.d.ts.map +1 -0
  8. package/dist/dts/__test__/store.d.ts +145 -0
  9. package/dist/dts/__test__/store.d.ts.map +1 -0
  10. package/dist/dts/__test__/types.d.ts +15 -0
  11. package/dist/dts/__test__/types.d.ts.map +1 -0
  12. package/dist/dts/store/errorMap.d.ts +3 -0
  13. package/dist/dts/store/errorMap.d.ts.map +1 -1
  14. package/dist/dts/store/foundationStore.d.ts +108 -12
  15. package/dist/dts/store/foundationStore.d.ts.map +1 -1
  16. package/dist/esm/__test__/elements.js +118 -0
  17. package/dist/esm/__test__/index.js +4 -0
  18. package/dist/esm/__test__/services.js +37 -0
  19. package/dist/esm/__test__/store.js +154 -0
  20. package/dist/esm/__test__/types.js +1 -0
  21. package/dist/esm/store/foundationStore.js +145 -40
  22. package/dist/foundation-store.api.json +174 -13
  23. package/dist/foundation-store.d.ts +113 -12
  24. package/docs/api/foundation-store.abstractstore.createasynclistener.md +35 -1
  25. package/docs/api/foundation-store.abstractstore.createerrorlistener.md +1 -1
  26. package/docs/api/foundation-store.abstractstore.createlistener.md +1 -1
  27. package/docs/api/foundation-store.abstractstore.invokeasyncapi.md +46 -0
  28. package/docs/api/foundation-store.abstractstore.md +4 -3
  29. package/docs/api/foundation-store.errordetailmap.md +4 -0
  30. package/docs/api/foundation-store.errormap.md +4 -0
  31. package/docs/api/foundation-store.errormaplogger.md +4 -0
  32. package/docs/api/foundation-store.registerstore.md +1 -1
  33. package/docs/api-report.md +27 -6
  34. package/package.json +11 -7
@@ -0,0 +1 @@
1
+ {"version":3,"file":"elements.d.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C;IAC7E;;OAEG;IACQ,SAAS,EAAE,SAAS,CAAC;IAEhC;;;OAGG;IACY,aAAa,EAAE,aAAa,CAAC;IAE5C;;;OAGG;IACS,UAAU,EAAE,UAAU,CAAC;IAEnC;;OAEG;IACS,KAAK,EAAE,gBAAgB,CAAC;IAEpC;;OAEG;IACH,iBAAiB;IAMjB;;OAEG;IACH,oBAAoB;IAMpB;;OAEG;IACH,SAAS,CAAC,iBAAiB;IAI3B;;OAEG;IACH,SAAS,CAAC,oBAAoB;IAI9B;;OAEG;IACH,SAAS,CAAC,UAAU;IAKpB;;OAEG;IACH,SAAS,CAAC,eAAe;CAG1B"}
@@ -0,0 +1,5 @@
1
+ export * from './elements';
2
+ export * from './services';
3
+ export * from './store';
4
+ export * from './types';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/__test__/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
@@ -0,0 +1,40 @@
1
+ import type { ReportEntity, SubEntity } from './types';
2
+ /**
3
+ * @internal
4
+ */
5
+ export interface SubService {
6
+ nextResponse: SubEntity[] | Error;
7
+ list(): Promise<SubEntity[]>;
8
+ }
9
+ /**
10
+ * @internal
11
+ */
12
+ export declare class DefaultSubService implements SubService {
13
+ nextResponse: SubEntity[] | Error;
14
+ list: () => Promise<SubEntity[]>;
15
+ }
16
+ /**
17
+ * @internal
18
+ */
19
+ export declare const SubService: import("@microsoft/fast-foundation").InterfaceSymbol<SubService>;
20
+ /**
21
+ * @internal
22
+ */
23
+ export interface ReportService {
24
+ nextResponse: boolean | Error;
25
+ lastSendReport: ReportEntity;
26
+ send(report: ReportEntity): Promise<boolean>;
27
+ }
28
+ /**
29
+ * @internal
30
+ */
31
+ export declare class DefaultReportService implements ReportService {
32
+ nextResponse: boolean | Error;
33
+ lastSendReport: ReportEntity;
34
+ send: (report: ReportEntity) => Promise<boolean>;
35
+ }
36
+ /**
37
+ * @internal
38
+ */
39
+ export declare const ReportService: import("@microsoft/fast-foundation").InterfaceSymbol<ReportService>;
40
+ //# sourceMappingURL=services.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../../src/__test__/services.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEvD;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,YAAY,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;IAClC,IAAI,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;CAC9B;AAED;;GAEG;AACH,qBAAa,iBAAkB,YAAW,UAAU;IAClD,YAAY,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;IAClC,IAAI,QAAa,QAAQ,SAAS,EAAE,CAAC,CAKpC;CACF;AAED;;GAEG;AACH,eAAO,MAAM,UAAU,kEAAsE,CAAC;AAE9F;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,YAAY,EAAE,OAAO,GAAG,KAAK,CAAC;IAC9B,cAAc,EAAE,YAAY,CAAC;IAC7B,IAAI,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC9C;AAED;;GAEG;AACH,qBAAa,oBAAqB,YAAW,aAAa;IACxD,YAAY,EAAE,OAAO,GAAG,KAAK,CAAC;IAC9B,cAAc,EAAE,YAAY,CAAC;IAC7B,IAAI,WAAkB,YAAY,KAAG,QAAQ,OAAO,CAAC,CAMnD;CACH;AAED;;GAEG;AACH,eAAO,MAAM,aAAa,qEAA4E,CAAC"}
@@ -0,0 +1,145 @@
1
+ import { CustomEventMap } from '@genesislcap/foundation-events';
2
+ import { AbstractStore, AbstractStoreRoot, Store, StoreRoot, StoreRootEventDetailMap } from '../store';
3
+ import { ReportService, SubService } from './services';
4
+ import type { ReportEntity, SubEntity } from './types';
5
+ /**
6
+ * @internal
7
+ */
8
+ export type SubStoreEventMap = {
9
+ 'x-changed': string;
10
+ 'y-changed': number;
11
+ 'z-changed': number;
12
+ 'select-sub-entity': SubEntity;
13
+ 'remove-sub-entity': SubEntity;
14
+ };
15
+ type SubStoreInternalEventMap = {
16
+ 'sub-load': string;
17
+ 'sub-load-error': Error;
18
+ 'sub-load-success': SubEntity[];
19
+ };
20
+ declare global {
21
+ interface HTMLElementEventMap extends CustomEventMap<SubStoreEventMap> {
22
+ }
23
+ }
24
+ /**
25
+ * SubStore.
26
+ *
27
+ * @remarks
28
+ * These stores demo common usage patterns.
29
+ *
30
+ * @internal
31
+ */
32
+ export interface SubStore extends Store {
33
+ readonly x: string;
34
+ readonly y: number;
35
+ readonly z: number;
36
+ readonly lastChangedProperty: string;
37
+ readonly derived: number;
38
+ readonly entities: SubEntity[];
39
+ readonly selectedEntity: SubEntity;
40
+ onXChanged(event: CustomEvent<string>): void;
41
+ onYChanged(event: CustomEvent<number>): void;
42
+ onZChanged(event: CustomEvent<number>): void;
43
+ onSelectSubEntity(event: CustomEvent<SubEntity>): void;
44
+ onRemoveSubEntity(event: CustomEvent<SubEntity>): void;
45
+ toEntity(): SubEntity;
46
+ }
47
+ /**
48
+ * @internal
49
+ */
50
+ export declare class DefaultSubStore extends AbstractStore<SubStore, SubStoreEventMap, SubStoreInternalEventMap> implements SubStore {
51
+ readonly service: SubService;
52
+ x: string;
53
+ y: number;
54
+ z: number;
55
+ lastChangedProperty: string;
56
+ entities: SubEntity[];
57
+ selectedEntity: SubEntity;
58
+ constructor(service: SubService);
59
+ onXChanged: EventListener;
60
+ onYChanged: EventListener;
61
+ onZChanged: EventListener;
62
+ onSelectSubEntity: EventListener;
63
+ onRemoveSubEntity: EventListener;
64
+ /**
65
+ * Does not need any special code as it's computing based on properties that are already observable.
66
+ */
67
+ get derived(): number;
68
+ /**
69
+ * Some serialised store state.
70
+ */
71
+ toEntity: () => {
72
+ label: string;
73
+ quantity: number;
74
+ };
75
+ }
76
+ /**
77
+ * Registering as `transient` with the DI directly instead of via `registerStore` given test suite create/destroy cycle.
78
+ * Normally store fragments are singletons, use `registerStore` in 99% of cases.
79
+ * @internal
80
+ */
81
+ export declare const SubStore: import("@microsoft/fast-foundation").InterfaceSymbol<SubStore>;
82
+ /**
83
+ * @internal
84
+ */
85
+ export type TestStoreEventDetailMap = StoreRootEventDetailMap & {
86
+ 'a-changed': string;
87
+ 'b-changed': number;
88
+ 'c-changed': number;
89
+ };
90
+ type TestStoreInternalEventMap = {
91
+ 'post-report': ReportEntity;
92
+ };
93
+ declare global {
94
+ interface HTMLElementEventMap extends CustomEventMap<TestStoreEventDetailMap> {
95
+ }
96
+ }
97
+ /**
98
+ * TestStore.
99
+ *
100
+ * @remarks
101
+ * These stores demo common usage patterns.
102
+ *
103
+ * @internal
104
+ */
105
+ export interface TestStore extends StoreRoot {
106
+ readonly a: string;
107
+ readonly b: number;
108
+ readonly c: number;
109
+ readonly volatileDerived: number;
110
+ readonly classNames: string;
111
+ readonly subStore: SubStore;
112
+ onAChanged(event: CustomEvent<string>): void;
113
+ onBChanged(event: CustomEvent<number>): void;
114
+ onCChanged(event: CustomEvent<number>): void;
115
+ }
116
+ /**
117
+ * @internal
118
+ */
119
+ export declare class DefaultTestStore extends AbstractStoreRoot<TestStore, TestStoreEventDetailMap, TestStoreInternalEventMap> implements TestStore {
120
+ readonly subStore: SubStore;
121
+ readonly service: ReportService;
122
+ a: string;
123
+ b: number;
124
+ c: number;
125
+ constructor(subStore: SubStore, service: ReportService);
126
+ onAChanged: EventListener;
127
+ onBChanged: EventListener;
128
+ onCChanged: EventListener;
129
+ /**
130
+ * Marked as volatile as it contains branching code paths
131
+ */
132
+ get volatileDerived(): number;
133
+ /**
134
+ * Generates css classnames based on store state
135
+ */
136
+ get classNames(): string;
137
+ }
138
+ /**
139
+ * Registering as `transient` with the DI directly instead of via `registerStore` given test suite create/destroy cycle.
140
+ * Normally store fragments are singletons, use `registerStore` in 99% of cases.
141
+ * @internal
142
+ */
143
+ export declare const TestStore: import("@microsoft/fast-foundation").InterfaceSymbol<TestStore>;
144
+ export {};
145
+ //# sourceMappingURL=store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../src/__test__/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAIhE,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,KAAK,EAAE,SAAS,EAAE,uBAAuB,EAAG,MAAM,UAAU,CAAC;AACxG,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEvD;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,mBAAmB,EAAE,SAAS,CAAC;IAC/B,mBAAmB,EAAE,SAAS,CAAC;CAChC,CAAC;AAEF,KAAK,wBAAwB,GAAG;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,KAAK,CAAC;IACxB,kBAAkB,EAAE,SAAS,EAAE,CAAC;CACjC,CAAC;AAEF,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,mBAAoB,SAAQ,cAAc,CAAC,gBAAgB,CAAC;KAAG;CAC1E;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,QAAS,SAAQ,KAAK;IACrC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;IACrC,QAAQ,CAAC,OAAO,EAAE,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AAED;;;;GAIG;AACH,eAAO,MAAM,SAAS,iEAAoE,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @internal
3
+ */
4
+ export type SubEntity = {
5
+ label: string;
6
+ quantity?: number;
7
+ };
8
+ /**
9
+ * @internal
10
+ */
11
+ export type ReportEntity = {
12
+ trigger: string;
13
+ value: string | number;
14
+ };
15
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/__test__/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;CACxB,CAAC"}
@@ -1,12 +1,15 @@
1
1
  /**
2
+ * @deprecated - Use `ErrorDetailMap` from `@genesislcap/foundation-utils` instead.
2
3
  * @public
3
4
  */
4
5
  export type ErrorDetailMap = Record<string, unknown>;
5
6
  /**
7
+ * @deprecated - Use `ErrorMapLogger` from `@genesislcap/foundation-utils` instead.
6
8
  * @public
7
9
  */
8
10
  export type ErrorMapLogger = (...args: any[]) => void;
9
11
  /**
12
+ * @deprecated - Use `ErrorMap` from `@genesislcap/foundation-utils` instead.
10
13
  * @public
11
14
  */
12
15
  export interface ErrorMap<TErrorDetailMap extends ErrorDetailMap> extends Pick<Map<keyof TErrorDetailMap, Error>, 'get' | 'has' | 'delete' | 'clear' | 'size'> {
@@ -1 +1 @@
1
- {"version":3,"file":"errorMap.d.ts","sourceRoot":"","sources":["../../../src/store/errorMap.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAErD;;GAEG;AACH,MAAM,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@@ export interface StoreSubscriber<TStore extends Store, TReturn = any> {
209
209
  * @public
210
210
  */
211
211
  export type StoreBinding<TStore extends Store> = (store: TStore) => any;
212
+ /**
213
+ * @typeParam TEventDetailMaps - The store's complete event detail map.
214
+ *
215
+ * @internal
216
+ */
217
+ export type KeyOrKeys<TEventDetailMaps extends EventDetailMap> = keyof TEventDetailMaps | (keyof TEventDetailMaps)[];
218
+ /**
219
+ * @internal
220
+ */
221
+ export declare enum EventListenerType {
222
+ sync = "sync",
223
+ async = "async",
224
+ error = "error"
225
+ }
212
226
  /**
213
227
  * Creates a dependency injection key for the store being registered.
214
228
  * @param Base - The store fragment class.
@@ -217,7 +231,7 @@ export type StoreBinding<TStore extends Store> = (store: TStore) => any;
217
231
  *
218
232
  * @example
219
233
  * ```ts
220
- * export const TradeEntry = registerStore(DefaultTradeEntry, 'TradeEntry');
234
+ * export const TradeEntry = registerStore<TradeEntry>(DefaultTradeEntry, 'TradeEntry');
221
235
  * ```
222
236
  *
223
237
  * @public
@@ -236,6 +250,10 @@ export declare abstract class AbstractStore<TStore extends Store, TEventDetailMa
236
250
  /**
237
251
  * The store fragment's event listener map.
238
252
  *
253
+ * @remarks
254
+ * Keyed by listener to allow events to have multiple listeners for cleaner logic flows.
255
+ * See multiple event keys example in `createAsyncListener`.
256
+ *
239
257
  * @internal
240
258
  */
241
259
  private eventListenerMap;
@@ -333,18 +351,39 @@ export declare abstract class AbstractStore<TStore extends Store, TEventDetailMa
333
351
  */
334
352
  private logEvent;
335
353
  /**
336
- * Sets event listeners on the store fragment's internal map.
337
- * @param key - The event key from the store fragment's event detail map.
338
- * @param listener - The event listener.
339
- * @returns The event listener.
354
+ * Creates an event listener by type.
355
+ *
356
+ * @typeParam TDetail - The CustomEvent detail.
357
+ * @param type - The type of event listener to create. See {@link EventListenerType}.
358
+ * @param keys - The event key or keys from the store fragment's event detail map.
359
+ * @param token - The function handling the event.
360
+ * @returns The event listener when one key is passed or undefined.
361
+ *
362
+ * @internal
363
+ */
364
+ private createListenerType;
365
+ /**
366
+ * Creates an event listener envelope.
367
+ *
368
+ * @remarks
369
+ * These wrap the provided token.
370
+ *
371
+ * @typeParam TDetail - The CustomEvent detail.
372
+ * @param listenerType - The type of event listener to create. See {@link EventListenerType}.
373
+ * @param token - The function handling the event.
374
+ * @returns An event listener.
340
375
  *
341
376
  * @internal
342
377
  */
343
- private mappedListener;
378
+ private createListenerEnvelope;
344
379
  /**
345
380
  * Creates an event listener.
381
+ *
382
+ * @remarks
383
+ * See the `createAsyncListener` for usage examples.
384
+ *
346
385
  * @typeParam TDetail - The CustomEvent detail.
347
- * @param key - The event key from the store fragment's event detail map.
386
+ * @param keys - The event key or keys from the store fragment's event detail map.
348
387
  * @param token - The function handling the event.
349
388
  * @returns The event listener.
350
389
  *
@@ -353,11 +392,42 @@ export declare abstract class AbstractStore<TStore extends Store, TEventDetailMa
353
392
  * You can think of this like a `reducer` in the redux sense. You are allowed to commit values to the store in these
354
393
  * synchronous handlers.
355
394
  */
356
- protected createListener: <TDetail = void>(key: keyof (TEventDetailMap & TInternalEventDetailMap), token: (detail: TDetail) => void) => EventListener;
395
+ protected createListener: <TDetail = void>(keys: KeyOrKeys<TEventDetailMap & TInternalEventDetailMap>, token: (detail: TDetail, event?: CustomEvent<TDetail>) => void) => EventListener;
357
396
  /**
358
397
  * Creates an async event listener.
398
+ *
399
+ * @example
400
+ * Creating an interface defined handler for a single event key.
401
+ * ```ts
402
+ * onDomainAction = this.createAsyncListener<DomainActionDetail>(
403
+ * 'domain-action',
404
+ * async ({ id, message }) =>
405
+ * this.invokeAsyncAPI(
406
+ * async () => this.domainService.action(id, message),
407
+ * 'domain-action-error',
408
+ * 'domain-action-success'
409
+ * )
410
+ * );
411
+ * ```
412
+ *
413
+ * @example
414
+ * Creating an anonymous handler in the constructor for multiple event keys.
415
+ * ```ts
416
+ * this.createAsyncListener(
417
+ * [
418
+ * 'columns-changed',
419
+ * 'types-changed',
420
+ * 'max-rows-changed',
421
+ * 'max-view-changed',
422
+ * 'order-by-changed',
423
+ * 'reverse-changed',
424
+ * ],
425
+ * async (_, { type }) => this.emit('domain-load')
426
+ * );
427
+ * ```
428
+ *
359
429
  * @typeParam TDetail - The CustomEvent detail.
360
- * @param key - The event key from the store fragment's event detail map.
430
+ * @param keys - The event key or keys from the store fragment's event detail map.
361
431
  * @param token - The async function handling the event.
362
432
  * @returns The event listener.
363
433
  *
@@ -366,11 +436,11 @@ export declare abstract class AbstractStore<TStore extends Store, TEventDetailMa
366
436
  * You can think of this like an `effect` in the redux sense. You should not commit values to the store in these,
367
437
  * instead raise subsequent events to be handled synchronously, where commits are allowed.
368
438
  */
369
- protected createAsyncListener: <TDetail = void, TReturn = void>(key: keyof (TEventDetailMap & TInternalEventDetailMap), token: (detail: TDetail) => Promise<TReturn>) => EventListener;
439
+ protected createAsyncListener: <TDetail = void, TReturn = void>(keys: KeyOrKeys<TEventDetailMap & TInternalEventDetailMap>, token: (detail: TDetail, event?: CustomEvent<TDetail>) => Promise<TReturn>) => EventListener;
370
440
  /**
371
441
  * Creates an error event listener.
372
442
  * @typeParam TDetail - The CustomEvent detail.
373
- * @param key - The event key from the store fragment's event detail map.
443
+ * @param keys - The event key or keys from the store fragment's event detail map.
374
444
  * @param token - The function handling the event.
375
445
  * @returns The event listener.
376
446
  *
@@ -379,7 +449,7 @@ export declare abstract class AbstractStore<TStore extends Store, TEventDetailMa
379
449
  * This logs and stores errors by event key in the store fragment's {@link ErrorMap}, allowing multiple errors to
380
450
  * co-exist, and be presentable to the user via the UI for further action or dismissal.
381
451
  */
382
- protected createErrorListener: <TDetail extends Error = Error>(key: keyof (TEventDetailMap & TInternalEventDetailMap), token?: (detail: TDetail) => void) => EventListener;
452
+ protected createErrorListener: <TDetail extends Error = Error>(keys: KeyOrKeys<TEventDetailMap & TInternalEventDetailMap>, token?: (detail: TDetail, event?: CustomEvent<TDetail>) => void) => EventListener;
383
453
  /**
384
454
  * Add the store fragment's event listeners to the root element.
385
455
  * @param element - The store root element.
@@ -411,6 +481,32 @@ export declare abstract class AbstractStore<TStore extends Store, TEventDetailMa
411
481
  * fragments.
412
482
  */
413
483
  protected emit<K extends keyof (TEventDetailMap & TInternalEventDetailMap) & string>(...args: (TEventDetailMap & TInternalEventDetailMap)[K] extends void ? [key: K] : [key: K, detail: (TEventDetailMap & TInternalEventDetailMap)[K]]): void;
484
+ /**
485
+ * A convenience method to invoke an async api and emit success and error events.
486
+ *
487
+ * @remarks
488
+ * The async api function should throw when it encounters an error.
489
+ *
490
+ * @example
491
+ * ```ts
492
+ * onLoad = this.createAsyncListener('domain-load', async () =>
493
+ * this.invokeAsyncAPI(
494
+ * async () => {
495
+ * !this.domainService.initialized && (await this.domainService.initialize(this.asDomainServiceInit()));
496
+ * return this.domainService.list();
497
+ * },
498
+ * 'domain-load-error',
499
+ * 'domain-load-success'
500
+ * )
501
+ * );
502
+ * ```
503
+ *
504
+ * @param api - The async service api function.
505
+ * @param error - The event key from the store fragment's event detail map.
506
+ * @param success - The event key from the store fragment's event detail map.
507
+ * @public
508
+ */
509
+ protected invokeAsyncAPI<TResult>(api: () => Promise<TResult>, error: keyof (TEventDetailMap & TInternalEventDetailMap), success?: keyof (TEventDetailMap & TInternalEventDetailMap)): Promise<void>;
414
510
  }
415
511
  /**
416
512
  * Store root event key to event detail map.
@@ -1 +1 @@
1
- {"version":3,"file":"foundationStore.d.ts","sourceRoot":"","sources":["../../../src/store/foundationStore.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAkB,QAAQ,EAAS,MAAM,+BAA+B,CAAC;AAChF,OAAO,EACL,eAAe,EACf,aAAa,EAEb,gBAAgB,EAGjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAM,GAAG,EAAE,MAAM,4BAA4B,CAAC;AAErD,OAAO,EAAE,UAAU,IAAI,YAAY,EAAM,MAAM,MAAM,CAAC;AAItD;;;;GAIG;AACH,MAAM,MAAM,wBA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uBAAuB,CACtE,YAAW,SAAS;IAEpB,oCAAoC;IACxB,KAAK,EAAE,OAAO,CAAS;IAEnC,sCAAsC;IAC1B,OAAO,EAAE,WAAW,CAAC;IAEjC;;;;OAIG;IACH,SAAS,CAAC,IAAI,OAAQ;IAEtB;;;;;;;;OAQG;IACH,OAAO,CAAC,cAAc;IAWtB,WAAW,gBAGT;IACF,cAAc,gBAGZ;IACF,OAAO,gBAAuF;CAC/F"}
@@ -0,0 +1,118 @@
1
+ import { __decorate } from "tslib";
2
+ import { EventEmitter } from '@genesislcap/foundation-events';
3
+ import { children, customElement, elements, FASTElement, html, observable, ref, repeat } from '@microsoft/fast-element';
4
+ import { ReportService, SubService } from './services';
5
+ import { TestStore } from './store';
6
+ /**
7
+ * @internal
8
+ */
9
+ let TestChildElement = class TestChildElement extends EventEmitter(FASTElement) {
10
+ };
11
+ __decorate([
12
+ observable
13
+ ], TestChildElement.prototype, "subStore", void 0);
14
+ __decorate([
15
+ observable
16
+ ], TestChildElement.prototype, "entityNodes", void 0);
17
+ TestChildElement = __decorate([
18
+ customElement({
19
+ name: 'store-test-child-element',
20
+ /**
21
+ * Template contains some fake/non-registered tags to aid test assertions.
22
+ */
23
+ template: html `
24
+ <template>
25
+ <x-value>${(x) => x.subStore.x}</x-value>
26
+ <y-value>${(x) => x.subStore.y}</y-value>
27
+ <z-value>${(x) => x.subStore.z}</z-value>
28
+ <last-changed-value>${(x) => x.subStore.lastChangedProperty}</last-changed-value>
29
+ <ul ${children({ property: 'entityNodes', filter: elements('li') })}>
30
+ ${repeat((x) => x.subStore.entities, html `
31
+ <li>${(x, c) => c.index}: ${(x) => x.label}</li>
32
+ `, { positioning: true })}
33
+ )}
34
+ </ul>
35
+ </template>
36
+ `,
37
+ })
38
+ ], TestChildElement);
39
+ export { TestChildElement };
40
+ /**
41
+ * @internal
42
+ */
43
+ let TestElement = class TestElement extends EventEmitter(FASTElement) {
44
+ /**
45
+ * @public
46
+ */
47
+ connectedCallback() {
48
+ super.connectedCallback();
49
+ this.addEventListeners();
50
+ this.readyStore();
51
+ }
52
+ /**
53
+ * @public
54
+ */
55
+ disconnectedCallback() {
56
+ super.disconnectedCallback();
57
+ this.removeEventListeners();
58
+ this.disconnectStore();
59
+ }
60
+ /**
61
+ * @internal
62
+ */
63
+ addEventListeners() {
64
+ this.addEventListener('store-connected', this.testStore.onConnected);
65
+ }
66
+ /**
67
+ * @internal
68
+ */
69
+ removeEventListeners() {
70
+ this.removeEventListener('store-connected', this.testStore.onConnected);
71
+ }
72
+ /**
73
+ * @internal
74
+ */
75
+ readyStore() {
76
+ this.$emit('store-connected', this);
77
+ this.$emit('store-ready', true);
78
+ }
79
+ /**
80
+ * @internal
81
+ */
82
+ disconnectStore() {
83
+ this.$emit('store-disconnected');
84
+ }
85
+ };
86
+ __decorate([
87
+ TestStore
88
+ ], TestElement.prototype, "testStore", void 0);
89
+ __decorate([
90
+ ReportService
91
+ ], TestElement.prototype, "reportService", void 0);
92
+ __decorate([
93
+ SubService
94
+ ], TestElement.prototype, "subService", void 0);
95
+ __decorate([
96
+ observable
97
+ ], TestElement.prototype, "child", void 0);
98
+ TestElement = __decorate([
99
+ customElement({
100
+ name: 'store-test-element',
101
+ /**
102
+ * Template contains some fake/non-registered tags to aid test assertions.
103
+ */
104
+ template: html `
105
+ <template>
106
+ <store-test-child-element
107
+ ${ref('child')}
108
+ class=${(x) => x.testStore.classNames}
109
+ :subStore=${(x) => x.testStore.subStore}
110
+ ></store-test-child-element>
111
+ <a-value>${(x) => x.testStore.a}</a-value>
112
+ <b-value>${(x) => x.testStore.b}</b-value>
113
+ <c-value>${(x) => x.testStore.c}</c-value>
114
+ </template>
115
+ `,
116
+ })
117
+ ], TestElement);
118
+ export { TestElement };
@@ -0,0 +1,4 @@
1
+ export * from './elements';
2
+ export * from './services';
3
+ export * from './store';
4
+ export * from './types';
@@ -0,0 +1,37 @@
1
+ import { __awaiter } from "tslib";
2
+ import { DI } from '@microsoft/fast-foundation';
3
+ /**
4
+ * @internal
5
+ */
6
+ export class DefaultSubService {
7
+ constructor() {
8
+ this.list = () => __awaiter(this, void 0, void 0, function* () {
9
+ if (this.nextResponse instanceof Error) {
10
+ throw this.nextResponse;
11
+ }
12
+ return Promise.resolve(this.nextResponse);
13
+ });
14
+ }
15
+ }
16
+ /**
17
+ * @internal
18
+ */
19
+ export const SubService = DI.createInterface(x => x.singleton(DefaultSubService));
20
+ /**
21
+ * @internal
22
+ */
23
+ export class DefaultReportService {
24
+ constructor() {
25
+ this.send = (report) => __awaiter(this, void 0, void 0, function* () {
26
+ this.lastSendReport = report;
27
+ if (this.nextResponse instanceof Error) {
28
+ throw this.nextResponse;
29
+ }
30
+ return Promise.resolve(this.nextResponse);
31
+ });
32
+ }
33
+ }
34
+ /**
35
+ * @internal
36
+ */
37
+ export const ReportService = DI.createInterface(x => x.singleton(DefaultReportService));