@o3r/core 14.2.0-prerelease.8 → 14.2.0-rc.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/core/application/build-properties.d.ts +50 -0
- package/core/application/build-properties.d.ts.map +1 -0
- package/core/application/build-properties.js +17 -0
- package/core/application/build-properties.js.map +1 -0
- package/core/application/dgp-interfaces.d.ts +35 -0
- package/core/application/dgp-interfaces.d.ts.map +1 -0
- package/core/application/dgp-interfaces.js +2 -0
- package/core/application/dgp-interfaces.js.map +1 -0
- package/core/application/index.d.ts +4 -0
- package/core/application/index.d.ts.map +1 -0
- package/core/application/index.js +4 -0
- package/core/application/index.js.map +1 -0
- package/core/application/runtime.d.ts +14 -0
- package/core/application/runtime.d.ts.map +1 -0
- package/core/application/runtime.js +2 -0
- package/core/application/runtime.js.map +1 -0
- package/core/common/index.d.ts +3 -0
- package/core/common/index.d.ts.map +1 -0
- package/core/common/index.js +3 -0
- package/core/common/index.js.map +1 -0
- package/core/common/interface-utils.d.ts +7 -0
- package/core/common/interface-utils.d.ts.map +1 -0
- package/core/common/interface-utils.js +2 -0
- package/core/common/interface-utils.js.map +1 -0
- package/core/common/label-value.d.ts +8 -0
- package/core/common/label-value.d.ts.map +1 -0
- package/core/common/label-value.js +2 -0
- package/core/common/label-value.js.map +1 -0
- package/core/devkit/devtools-interface.d.ts +34 -0
- package/core/devkit/devtools-interface.d.ts.map +1 -0
- package/core/devkit/devtools-interface.js +2 -0
- package/core/devkit/devtools-interface.js.map +1 -0
- package/core/devkit/index.d.ts +2 -0
- package/core/devkit/index.d.ts.map +1 -0
- package/core/devkit/index.js +2 -0
- package/core/devkit/index.js.map +1 -0
- package/core/index.d.ts +7 -0
- package/core/index.d.ts.map +1 -0
- package/core/index.js +7 -0
- package/core/index.js.map +1 -0
- package/core/interfaces/configuration.d.ts +90 -0
- package/core/interfaces/configuration.d.ts.map +1 -0
- package/core/interfaces/configuration.js +2 -0
- package/core/interfaces/configuration.js.map +1 -0
- package/core/interfaces/context.d.ts +57 -0
- package/core/interfaces/context.d.ts.map +1 -0
- package/core/interfaces/context.js +2 -0
- package/core/interfaces/context.js.map +1 -0
- package/core/interfaces/index.d.ts +5 -0
- package/core/interfaces/index.d.ts.map +1 -0
- package/core/interfaces/index.js +5 -0
- package/core/interfaces/index.js.map +1 -0
- package/core/interfaces/item-identifier.d.ts +14 -0
- package/core/interfaces/item-identifier.d.ts.map +1 -0
- package/core/interfaces/item-identifier.js +2 -0
- package/core/interfaces/item-identifier.js.map +1 -0
- package/core/interfaces/translation.d.ts +7 -0
- package/core/interfaces/translation.d.ts.map +1 -0
- package/core/interfaces/translation.js +2 -0
- package/core/interfaces/translation.js.map +1 -0
- package/core/metadata/component-decorator.d.ts +32 -0
- package/core/metadata/component-decorator.d.ts.map +1 -0
- package/core/metadata/component-decorator.js +18 -0
- package/core/metadata/component-decorator.js.map +1 -0
- package/core/metadata/component-identifier.d.ts +7 -0
- package/core/metadata/component-identifier.d.ts.map +1 -0
- package/core/metadata/component-identifier.js +9 -0
- package/core/metadata/component-identifier.js.map +1 -0
- package/core/metadata/index.d.ts +4 -0
- package/core/metadata/index.d.ts.map +1 -0
- package/core/metadata/index.js +4 -0
- package/core/metadata/index.js.map +1 -0
- package/core/metadata/metadata-interface.d.ts +10 -0
- package/core/metadata/metadata-interface.d.ts.map +1 -0
- package/core/metadata/metadata-interface.js +2 -0
- package/core/metadata/metadata-interface.js.map +1 -0
- package/core/rules-engine/index.d.ts +2 -0
- package/core/rules-engine/index.d.ts.map +1 -0
- package/core/rules-engine/index.js +2 -0
- package/core/rules-engine/index.js.map +1 -0
- package/core/rules-engine/rules-engine-interfaces.d.ts +24 -0
- package/core/rules-engine/rules-engine-interfaces.d.ts.map +1 -0
- package/core/rules-engine/rules-engine-interfaces.js +2 -0
- package/core/rules-engine/rules-engine-interfaces.js.map +1 -0
- package/log/index.d.ts +2 -0
- package/log/index.d.ts.map +1 -0
- package/log/index.js +2 -0
- package/log/index.js.map +1 -0
- package/log/logger.d.ts +36 -0
- package/log/logger.d.ts.map +1 -0
- package/log/logger.js +2 -0
- package/log/logger.js.map +1 -0
- package/messages/common-message-interface.d.ts +17 -0
- package/messages/common-message-interface.d.ts.map +1 -0
- package/messages/common-message-interface.js +2 -0
- package/messages/common-message-interface.js.map +1 -0
- package/messages/index.d.ts +4 -0
- package/messages/index.d.ts.map +1 -0
- package/messages/index.js +4 -0
- package/messages/index.js.map +1 -0
- package/messages/message-helpers.d.ts +24 -0
- package/messages/message-helpers.d.ts.map +1 -0
- package/messages/message-helpers.js +54 -0
- package/messages/message-helpers.js.map +1 -0
- package/messages/message-interfaces.d.ts +26 -0
- package/messages/message-interfaces.d.ts.map +1 -0
- package/messages/message-interfaces.js +5 -0
- package/messages/message-interfaces.js.map +1 -0
- package/package.json +9 -9
- package/public_api.d.ts +6 -0
- package/public_api.d.ts.map +1 -0
- package/public_api.js +6 -0
- package/public_api.js.map +1 -0
- package/store/async/async-entity.adapter.d.ts +62 -0
- package/store/async/async-entity.adapter.d.ts.map +1 -0
- package/store/async/async-entity.adapter.js +49 -0
- package/store/async/async-entity.adapter.js.map +1 -0
- package/store/async/async.adapter.d.ts +91 -0
- package/store/async/async.adapter.d.ts.map +1 -0
- package/store/async/async.adapter.js +94 -0
- package/store/async/async.adapter.js.map +1 -0
- package/store/async/async.helpers.d.ts +17 -0
- package/store/async/async.helpers.d.ts.map +1 -0
- package/store/async/async.helpers.js +25 -0
- package/store/async/async.helpers.js.map +1 -0
- package/store/async/async.interfaces.d.ts +91 -0
- package/store/async/async.interfaces.d.ts.map +1 -0
- package/store/async/async.interfaces.js +2 -0
- package/store/async/async.interfaces.js.map +1 -0
- package/store/async/async.operators.d.ts +22 -0
- package/store/async/async.operators.d.ts.map +1 -0
- package/store/async/async.operators.js +75 -0
- package/store/async/async.operators.js.map +1 -0
- package/store/async/async.props.d.ts +7 -0
- package/store/async/async.props.d.ts.map +1 -0
- package/store/async/async.props.js +10 -0
- package/store/async/async.props.js.map +1 -0
- package/store/async/async.serializer.d.ts +29 -0
- package/store/async/async.serializer.d.ts.map +1 -0
- package/store/async/async.serializer.js +34 -0
- package/store/async/async.serializer.js.map +1 -0
- package/store/async/index.d.ts +8 -0
- package/store/async/index.d.ts.map +1 -0
- package/store/async/index.js +8 -0
- package/store/async/index.js.map +1 -0
- package/store/index.d.ts +3 -0
- package/store/index.d.ts.map +1 -0
- package/store/index.js +3 -0
- package/store/index.js.map +1 -0
- package/store/types.d.ts +95 -0
- package/store/types.d.ts.map +1 -0
- package/store/types.js +11 -0
- package/store/types.js.map +1 -0
- package/types/o3r-core.d.ts.map +1 -1
- package/utils/debug/debug-helper.d.ts +14 -0
- package/utils/debug/debug-helper.d.ts.map +1 -0
- package/utils/debug/debug-helper.js +19 -0
- package/utils/debug/debug-helper.js.map +1 -0
- package/utils/deep-fill/deep-fill.d.ts +37 -0
- package/utils/deep-fill/deep-fill.d.ts.map +1 -0
- package/utils/deep-fill/deep-fill.js +71 -0
- package/utils/deep-fill/deep-fill.js.map +1 -0
- package/utils/index.d.ts +4 -0
- package/utils/index.d.ts.map +1 -0
- package/utils/index.js +4 -0
- package/utils/index.js.map +1 -0
- package/utils/rendering/rendering-helpers.d.ts +10 -0
- package/utils/rendering/rendering-helpers.d.ts.map +1 -0
- package/utils/rendering/rendering-helpers.js +31 -0
- package/utils/rendering/rendering-helpers.js.map +1 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compute the name of the component with the library's name to generate unique component identifier used in metadata and different modules
|
|
3
|
+
* @param componentName Name of the component to get the configuration
|
|
4
|
+
* @param libraryName Name of the library the component is coming from
|
|
5
|
+
*/
|
|
6
|
+
export declare function computeItemIdentifier<C extends string, L extends string>(componentName: C, libraryName?: L): `${L extends string ? `${L}#` : ''}${C}`;
|
|
7
|
+
//# sourceMappingURL=component-identifier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-identifier.d.ts","sourceRoot":"","sources":["../../../src/core/metadata/component-identifier.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,EAAE,aAAa,EAAE,CAAC,EAAE,WAAW,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,SAAS,MAAM,GAAG,GAAG,CAAC,GAAG,GAAG,EAAE,GAAG,CAAC,EAAE,CAErJ"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compute the name of the component with the library's name to generate unique component identifier used in metadata and different modules
|
|
3
|
+
* @param componentName Name of the component to get the configuration
|
|
4
|
+
* @param libraryName Name of the library the component is coming from
|
|
5
|
+
*/
|
|
6
|
+
export function computeItemIdentifier(componentName, libraryName) {
|
|
7
|
+
return (libraryName ? libraryName + '#' : '') + componentName;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=component-identifier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-identifier.js","sourceRoot":"","sources":["../../../src/core/metadata/component-identifier.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAqC,aAAgB,EAAE,WAAe;IACzG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,GAAG,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,aAAyD,CAAC;AAC5G,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/metadata/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/metadata/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metadata-interface.d.ts","sourceRoot":"","sources":["../../../src/core/metadata/metadata-interface.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,MAAM;IACrB,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,6BAA6B;IAC7B,IAAI,EAAE,MAAM,CAAC;CACd"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metadata-interface.js","sourceRoot":"","sources":["../../../src/core/metadata/metadata-interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/rules-engine/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/rules-engine/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimum action field
|
|
3
|
+
*/
|
|
4
|
+
export interface RulesEngineAction<A extends string = string, V = any> {
|
|
5
|
+
/** Type of the action */
|
|
6
|
+
actionType: A;
|
|
7
|
+
/** Generic value of the action */
|
|
8
|
+
value: V;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Action handler executed by the rules engine
|
|
12
|
+
*/
|
|
13
|
+
export interface RulesEngineActionHandler<T extends RulesEngineAction = RulesEngineAction> {
|
|
14
|
+
/**
|
|
15
|
+
* Execute the actions resulting of the rules engine
|
|
16
|
+
* @param actions List of actions executed by the rules engine
|
|
17
|
+
*/
|
|
18
|
+
executeActions(actions: T[]): void | Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Actions supported by the handler
|
|
21
|
+
*/
|
|
22
|
+
supportingActions: readonly T['actionType'][];
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=rules-engine-interfaces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rules-engine-interfaces.d.ts","sourceRoot":"","sources":["../../../src/core/rules-engine/rules-engine-interfaces.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,iBAAiB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,CAAC,GAAG,GAAG;IACnE,yBAAyB;IACzB,UAAU,EAAE,CAAC,CAAC;IACd,kCAAkC;IAClC,KAAK,EAAE,CAAC,CAAC;CACV;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB,CAAC,CAAC,SAAS,iBAAiB,GAAG,iBAAiB;IACvF;;;OAGG;IACH,cAAc,CAAC,OAAO,EAAE,CAAC,EAAE,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEnD;;OAEG;IACH,iBAAiB,EAAE,SAAS,CAAC,CAAC,YAAY,CAAC,EAAE,CAAC;CAC/C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rules-engine-interfaces.js","sourceRoot":"","sources":["../../../src/core/rules-engine/rules-engine-interfaces.ts"],"names":[],"mappings":""}
|
package/log/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/log/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
|
package/log/index.js
ADDED
package/log/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/log/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
|
package/log/logger.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logger Client interface.
|
|
3
|
+
*/
|
|
4
|
+
export interface Logger {
|
|
5
|
+
/**
|
|
6
|
+
* Log an error.
|
|
7
|
+
* @param message Message to log
|
|
8
|
+
* @param optionalParams Optional parameters to log
|
|
9
|
+
*/
|
|
10
|
+
error(message?: any, ...optionalParams: any[]): void;
|
|
11
|
+
/**
|
|
12
|
+
* Log a warning.
|
|
13
|
+
* @param message Message to log
|
|
14
|
+
* @param optionalParams Optional parameters to log
|
|
15
|
+
*/
|
|
16
|
+
warn(message?: any, ...optionalParams: any[]): void;
|
|
17
|
+
/**
|
|
18
|
+
* Log a message.
|
|
19
|
+
* @param message Message to log
|
|
20
|
+
* @param optionalParams Optional parameters to log
|
|
21
|
+
*/
|
|
22
|
+
info?(message?: any, ...optionalParams: any[]): void;
|
|
23
|
+
/**
|
|
24
|
+
* Log a message.
|
|
25
|
+
* @param message Message to log
|
|
26
|
+
* @param optionalParams Optional parameters to log
|
|
27
|
+
*/
|
|
28
|
+
log(message?: any, ...optionalParams: any[]): void;
|
|
29
|
+
/**
|
|
30
|
+
* Log a debug message.
|
|
31
|
+
* @param message Message to log
|
|
32
|
+
* @param optionalParams Optional parameters to log
|
|
33
|
+
*/
|
|
34
|
+
debug?(message?: any, ...optionalParams: any[]): void;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/log/logger.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,MAAM;IACrB;;;;OAIG;IACH,KAAK,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,GAAG,cAAc,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAErD;;;;OAIG;IACH,IAAI,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,GAAG,cAAc,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAEpD;;;;OAIG;IACH,IAAI,CAAC,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,GAAG,cAAc,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAErD;;;;OAIG;IACH,GAAG,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,GAAG,cAAc,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAEnD;;;;OAIG;IACH,KAAK,CAAC,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,GAAG,cAAc,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;CACvD"}
|
package/log/logger.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/log/logger.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { OtterMessageContent } from './message-interfaces';
|
|
2
|
+
/** Extension connection notification message content */
|
|
3
|
+
export interface ConnectContentMessage extends OtterMessageContent<'connect'> {
|
|
4
|
+
}
|
|
5
|
+
/** Script Injection message content */
|
|
6
|
+
export interface InjectContentMessage extends OtterMessageContent<'inject'> {
|
|
7
|
+
/** Path to the extension script to inject to the web application */
|
|
8
|
+
scriptToInject: string;
|
|
9
|
+
}
|
|
10
|
+
/** Requested messages Message Content */
|
|
11
|
+
export interface RequestMessagesContentMessage<AvailableMessageDataTypes extends string = string> extends OtterMessageContent<'requestMessages'> {
|
|
12
|
+
/** If specified, only the listed messages will be re-emitted */
|
|
13
|
+
only?: AvailableMessageDataTypes[];
|
|
14
|
+
}
|
|
15
|
+
/** List of common Otter content messages */
|
|
16
|
+
export type CommonContentMessages = ConnectContentMessage | InjectContentMessage | RequestMessagesContentMessage;
|
|
17
|
+
//# sourceMappingURL=common-message-interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common-message-interface.d.ts","sourceRoot":"","sources":["../../src/messages/common-message-interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACpB,MAAM,sBAAsB,CAAC;AAE9B,wDAAwD;AACxD,MAAM,WAAW,qBAAsB,SAAQ,mBAAmB,CAAC,SAAS,CAAC;CAC5E;AAED,uCAAuC;AACvC,MAAM,WAAW,oBAAqB,SAAQ,mBAAmB,CAAC,QAAQ,CAAC;IACzE,oEAAoE;IACpE,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,yCAAyC;AACzC,MAAM,WAAW,6BAA6B,CAAC,yBAAyB,SAAS,MAAM,GAAG,MAAM,CAAE,SAAQ,mBAAmB,CAAC,iBAAiB,CAAC;IAC9I,gEAAgE;IAChE,IAAI,CAAC,EAAE,yBAAyB,EAAE,CAAC;CACpC;AAED,4CAA4C;AAC5C,MAAM,MAAM,qBAAqB,GAAG,qBAAqB,GACrD,oBAAoB,GACpB,6BAA6B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common-message-interface.js","sourceRoot":"","sources":["../../src/messages/common-message-interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/messages/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/messages/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { ContentMessageData, FilterMessageToApplication, OtterMessage, OtterMessageContent } from './message-interfaces';
|
|
3
|
+
/**
|
|
4
|
+
* Determine if a message should be handle by the application
|
|
5
|
+
* @param message Message to analyze
|
|
6
|
+
*/
|
|
7
|
+
export declare const isToAppOtterMessage: <T extends OtterMessage>(message?: T) => message is FilterMessageToApplication<T & {
|
|
8
|
+
to: "app";
|
|
9
|
+
}>;
|
|
10
|
+
/**
|
|
11
|
+
* Determine if a message is emitted by an Otter tool
|
|
12
|
+
* @param message Message to analyze
|
|
13
|
+
*/
|
|
14
|
+
export declare const isOtterMessage: <T extends OtterMessageContent>(message: any) => message is OtterMessage<T>;
|
|
15
|
+
/**
|
|
16
|
+
* Send an Otter Message
|
|
17
|
+
* @param dataType Type of the message
|
|
18
|
+
* @param content content of the message
|
|
19
|
+
* @param preStringify determine if the message should JSON.stringify before being send (will use the default mechanism otherwise)
|
|
20
|
+
*/
|
|
21
|
+
export declare const sendOtterMessage: <T extends OtterMessageContent>(dataType: T["dataType"], content: ContentMessageData<T>, preStringify?: boolean) => void;
|
|
22
|
+
export declare function filterMessageContent<T extends Event | MessageEvent>(): (source$: Observable<T>) => Observable<OtterMessageContent<string>>;
|
|
23
|
+
export declare function filterMessageContent<T extends Event | MessageEvent, S extends OtterMessageContent>(predicate: (message: any) => message is S): (source$: Observable<T>) => Observable<S>;
|
|
24
|
+
//# sourceMappingURL=message-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message-helpers.d.ts","sourceRoot":"","sources":["../../src/messages/message-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,UAAU,EACX,MAAM,MAAM,CAAC;AACd,OAAO,EAEL,kBAAkB,EAClB,0BAA0B,EAC1B,YAAY,EACZ,mBAAmB,EAEpB,MAAM,sBAAsB,CAAC;AAE9B;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAAI,CAAC,SAAS,YAAY,EAAE,UAAU,CAAC,KAAG,OAAO,IAAI,0BAA0B,CAAC,CAAC,GAAG;IAAE,EAAE,EAAE,KAAK,CAAA;CAAE,CAEhI,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc,GAAI,CAAC,SAAS,mBAAmB,EAAE,SAAS,GAAG,KAAG,OAAO,IAAI,YAAY,CAAC,CAAC,CAErG,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAS,mBAAmB,EAAE,UAAU,CAAC,CAAC,UAAU,CAAC,EAAE,SAAS,kBAAkB,CAAC,CAAC,CAAC,EAAE,sBAAmB,SAS3I,CAAC;AAEF,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,KAAK,GAAG,YAAY,KAAK,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC;AAC5I,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,KAAK,GAAG,YAAY,EAAE,CAAC,SAAS,mBAAmB,EAAE,SAAS,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { filter, map, } from 'rxjs';
|
|
2
|
+
import { applicationMessageTarget, otterMessageType, } from './message-interfaces';
|
|
3
|
+
/**
|
|
4
|
+
* Determine if a message should be handle by the application
|
|
5
|
+
* @param message Message to analyze
|
|
6
|
+
*/
|
|
7
|
+
export const isToAppOtterMessage = (message) => {
|
|
8
|
+
return message?.to === applicationMessageTarget;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Determine if a message is emitted by an Otter tool
|
|
12
|
+
* @param message Message to analyze
|
|
13
|
+
*/
|
|
14
|
+
export const isOtterMessage = (message) => {
|
|
15
|
+
return message?.type === otterMessageType;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Send an Otter Message
|
|
19
|
+
* @param dataType Type of the message
|
|
20
|
+
* @param content content of the message
|
|
21
|
+
* @param preStringify determine if the message should JSON.stringify before being send (will use the default mechanism otherwise)
|
|
22
|
+
*/
|
|
23
|
+
export const sendOtterMessage = (dataType, content, preStringify = true) => {
|
|
24
|
+
const message = {
|
|
25
|
+
type: otterMessageType,
|
|
26
|
+
content: {
|
|
27
|
+
...content,
|
|
28
|
+
dataType
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
return window.postMessage(preStringify ? JSON.stringify(message) : message, '*');
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Filter the Otter message that should be handle by the application and returns it content
|
|
35
|
+
* @param predicate condition to filter the message
|
|
36
|
+
* @returns content of the message
|
|
37
|
+
*/
|
|
38
|
+
/**
|
|
39
|
+
* Operator to get only Otter messages that match the predicate
|
|
40
|
+
* @param predicate
|
|
41
|
+
*/
|
|
42
|
+
export function filterMessageContent(predicate) {
|
|
43
|
+
return (source$) => {
|
|
44
|
+
const obs = source$.pipe(map((event) => {
|
|
45
|
+
const data = event.data;
|
|
46
|
+
return typeof data === 'string' ? JSON.parse(data) : data;
|
|
47
|
+
}), filter(isOtterMessage), filter(isToAppOtterMessage), map((message) => message.content));
|
|
48
|
+
if (predicate) {
|
|
49
|
+
return obs.pipe(filter(predicate));
|
|
50
|
+
}
|
|
51
|
+
return obs;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=message-helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message-helpers.js","sourceRoot":"","sources":["../../src/messages/message-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,GAAG,GAEJ,MAAM,MAAM,CAAC;AACd,OAAO,EACL,wBAAwB,EAKxB,gBAAgB,GACjB,MAAM,sBAAsB,CAAC;AAE9B;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAyB,OAAW,EAA4D,EAAE;IACnI,OAAO,OAAO,EAAE,EAAE,KAAK,wBAAwB,CAAC;AAClD,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAgC,OAAY,EAA8B,EAAE;IACxG,OAAO,OAAO,EAAE,IAAI,KAAK,gBAAgB,CAAC;AAC5C,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAgC,QAAuB,EAAE,OAA8B,EAAE,YAAY,GAAG,IAAI,EAAE,EAAE;IAC9I,MAAM,OAAO,GAAG;QACd,IAAI,EAAE,gBAAgB;QACtB,OAAO,EAAE;YACP,GAAG,OAAO;YACV,QAAQ;SACT;KACF,CAAC;IACF,OAAO,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;AACnF,CAAC,CAAC;AAIF;;;;GAIG;AAEH;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAgE,SAA0C;IAE5I,OAAO,CAAC,OAAsB,EAAE,EAAE;QAChC,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,CACtB,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;YACZ,MAAM,IAAI,GAAI,KAAsB,CAAC,IAAI,CAAC;YAC1C,OAAO,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAC5D,CAAC,CAAC,EACF,MAAM,CAAC,cAAc,CAAC,EACtB,MAAM,CAAC,mBAAmB,CAAC,EAC3B,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAClC,CAAC;QACF,IAAI,SAAS,EAAE,CAAC;YACd,OAAO,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;QACrC,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** Type of a message exchanged within the Otter Framework */
|
|
2
|
+
export declare const otterMessageType = "otter";
|
|
3
|
+
/** Target of a message that should be handled by the application */
|
|
4
|
+
export declare const applicationMessageTarget = "app";
|
|
5
|
+
export interface OtterMessageContent<DataType extends string = string> {
|
|
6
|
+
/** Type of data */
|
|
7
|
+
dataType: DataType;
|
|
8
|
+
}
|
|
9
|
+
export interface OtterMessage<Content extends OtterMessageContent = OtterMessageContent, Target extends string | undefined = undefined | string> {
|
|
10
|
+
/** Type of the message */
|
|
11
|
+
type: typeof otterMessageType;
|
|
12
|
+
/** Version of the message (default to the `@o3r/core` version ) */
|
|
13
|
+
version?: string;
|
|
14
|
+
/** Target of the message */
|
|
15
|
+
to: Target;
|
|
16
|
+
/** Message content */
|
|
17
|
+
content: Content;
|
|
18
|
+
}
|
|
19
|
+
/** Type helper to retrieve the data types of a union of MessageContent */
|
|
20
|
+
export type MessageDataTypes<T extends OtterMessageContent> = T['dataType'];
|
|
21
|
+
/** Type helper to filter the message that can be received by the application */
|
|
22
|
+
export type FilterMessageToApplication<T extends OtterMessage> = T extends {
|
|
23
|
+
to: infer U;
|
|
24
|
+
} ? U extends (typeof applicationMessageTarget | undefined) ? T : never : never;
|
|
25
|
+
export type ContentMessageData<T extends OtterMessageContent> = T extends any ? Omit<T, 'dataType'> : never;
|
|
26
|
+
//# sourceMappingURL=message-interfaces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message-interfaces.d.ts","sourceRoot":"","sources":["../../src/messages/message-interfaces.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,eAAO,MAAM,gBAAgB,UAAU,CAAC;AAExC,oEAAoE;AACpE,eAAO,MAAM,wBAAwB,QAAQ,CAAC;AAE9C,MAAM,WAAW,mBAAmB,CAAC,QAAQ,SAAS,MAAM,GAAG,MAAM;IACnE,mBAAmB;IACnB,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED,MAAM,WAAW,YAAY,CAAC,OAAO,SAAS,mBAAmB,GAAG,mBAAmB,EAAE,MAAM,SAAS,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM;IAC7I,0BAA0B;IAC1B,IAAI,EAAE,OAAO,gBAAgB,CAAC;IAE9B,mEAAmE;IACnE,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,4BAA4B;IAC5B,EAAE,EAAE,MAAM,CAAC;IAEX,sBAAsB;IACtB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,0EAA0E;AAC1E,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,mBAAmB,IAAI,CAAC,CAAC,UAAU,CAAC,CAAC;AAE5E,gFAAgF;AAChF,MAAM,MAAM,0BAA0B,CAAC,CAAC,SAAS,YAAY,IAAI,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,CAAC,CAAA;CAAE,GAAG,CAAC,SAAS,CAAC,OAAO,wBAAwB,GAAG,SAAS,CAAC,GAAG,CAAC,GAAG,KAAK,GAAG,KAAK,CAAC;AAEzK,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,mBAAmB,IAAI,CAAC,SAAS,GAAG,GACzE,IAAI,CAAC,CAAC,EAAE,UAAU,CAAC,GACnB,KAAK,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Type of a message exchanged within the Otter Framework */
|
|
2
|
+
export const otterMessageType = 'otter';
|
|
3
|
+
/** Target of a message that should be handled by the application */
|
|
4
|
+
export const applicationMessageTarget = 'app';
|
|
5
|
+
//# sourceMappingURL=message-interfaces.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message-interfaces.js","sourceRoot":"","sources":["../../src/messages/message-interfaces.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,MAAM,CAAC,MAAM,gBAAgB,GAAG,OAAO,CAAC;AAExC,oEAAoE;AACpE,MAAM,CAAC,MAAM,wBAAwB,GAAG,KAAK,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@o3r/core",
|
|
3
|
-
"version": "14.2.0-
|
|
3
|
+
"version": "14.2.0-rc.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@ngrx/entity": "^21.0.0",
|
|
39
39
|
"@ngrx/store": "^21.0.0",
|
|
40
40
|
"@nx/angular": "^22.0.0",
|
|
41
|
-
"@o3r/telemetry": "~14.2.0-
|
|
41
|
+
"@o3r/telemetry": "~14.2.0-rc.0",
|
|
42
42
|
"@schematics/angular": "^21.0.0",
|
|
43
43
|
"chokidar": "^4.0.0 || ^5.0.0",
|
|
44
44
|
"globby": "^11.1.0",
|
|
@@ -76,19 +76,19 @@
|
|
|
76
76
|
}
|
|
77
77
|
},
|
|
78
78
|
"dependencies": {
|
|
79
|
-
"@o3r/schematics": "~14.2.0-
|
|
79
|
+
"@o3r/schematics": "~14.2.0-rc.0",
|
|
80
80
|
"tslib": "^2.6.2",
|
|
81
81
|
"uuid": "~13.0.0"
|
|
82
82
|
},
|
|
83
83
|
"generatorDependencies": {
|
|
84
84
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.4.0",
|
|
85
|
-
"@ngrx/effects": "~21.
|
|
86
|
-
"@ngrx/entity": "~21.
|
|
87
|
-
"@ngrx/router-store": "~21.
|
|
88
|
-
"@ngrx/store": "~21.
|
|
89
|
-
"@ngrx/store-devtools": "~21.
|
|
85
|
+
"@ngrx/effects": "~21.1.0",
|
|
86
|
+
"@ngrx/entity": "~21.1.0",
|
|
87
|
+
"@ngrx/router-store": "~21.1.0",
|
|
88
|
+
"@ngrx/store": "~21.1.0",
|
|
89
|
+
"@ngrx/store-devtools": "~21.1.0",
|
|
90
90
|
"@nx/eslint-plugin": "~22.6.0",
|
|
91
|
-
"@o3r/store-sync": "~14.2.0-
|
|
91
|
+
"@o3r/store-sync": "~14.2.0-rc.0",
|
|
92
92
|
"@stylistic/eslint-plugin": "~5.10.0",
|
|
93
93
|
"@types/jest": "~30.0.0",
|
|
94
94
|
"@typescript-eslint/eslint-plugin": "~8.57.0",
|
package/public_api.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public_api.d.ts","sourceRoot":"","sources":["../src/public_api.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC"}
|
package/public_api.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public_api.js","sourceRoot":"","sources":["../src/public_api.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { EntityAdapter, EntityState } from '@ngrx/entity';
|
|
2
|
+
import { AsyncStoreItem, EntityWithoutAsyncStoreItem } from './async.interfaces';
|
|
3
|
+
/** Adapter for Asynchronous Entity Store */
|
|
4
|
+
export interface EntityAsyncRequestAdapter<T extends AsyncStoreItem> extends EntityAdapter<T> {
|
|
5
|
+
/**
|
|
6
|
+
* Updates the AsyncStoreItem properties of each entity matching an id from the list of given ids, when a request has failed.
|
|
7
|
+
* @param state Actual state
|
|
8
|
+
* @param ids Ids of the entity to be updated with AsyncStoreItem properties
|
|
9
|
+
* @param requestId Id of request which has failed
|
|
10
|
+
*/
|
|
11
|
+
failRequestMany<V extends EntityState<T> & AsyncStoreItem>(state: V, ids?: (string | number)[], requestId?: string): V;
|
|
12
|
+
/**
|
|
13
|
+
* Adds AsyncStoreItem property to the global store, or the entity if it already exists, when a request is triggered.
|
|
14
|
+
* @param state Actual state
|
|
15
|
+
* @param id Id of the entity to update
|
|
16
|
+
* @param requestId Id of the request which is triggered
|
|
17
|
+
*/
|
|
18
|
+
addRequestOne<V extends EntityState<T> & AsyncStoreItem>(state: V, id: string | number | null | undefined, requestId: string): V;
|
|
19
|
+
/**
|
|
20
|
+
* Adds AsyncStoreItem properties for each entity matching the given ids, when a request is triggered
|
|
21
|
+
* @param state Actual state
|
|
22
|
+
* @param ids Ids of the entity to be updated with AsyncStoreItem properties
|
|
23
|
+
* @param requestId Id of request which is triggered
|
|
24
|
+
*/
|
|
25
|
+
addRequestMany<V extends EntityState<T>>(state: V, ids: (string | number)[], requestId: string): V;
|
|
26
|
+
/**
|
|
27
|
+
* Updates the state with the given entity. Update the global or the current entity's status if it exists.
|
|
28
|
+
* @param state Actual state
|
|
29
|
+
* @param entity Payload item;
|
|
30
|
+
* @param requestId Id of request which has resolved if any
|
|
31
|
+
*/
|
|
32
|
+
resolveRequestOne<V extends EntityState<T> & AsyncStoreItem>(state: V, entity: EntityWithoutAsyncStoreItem<T> & Record<'id', string | number>, requestId?: string): V;
|
|
33
|
+
/**
|
|
34
|
+
* Updates the state with the given entity. Update the global or the current entity's status if it exists.
|
|
35
|
+
* @param state Actual state
|
|
36
|
+
* @param entity Payload item;
|
|
37
|
+
* @param requestId Id of request which has resolved if any
|
|
38
|
+
* @param idProperty Property of the entity containing its unique identifier
|
|
39
|
+
*/
|
|
40
|
+
resolveRequestOne<V extends EntityState<T> & AsyncStoreItem, W extends keyof T>(state: V, entity: EntityWithoutAsyncStoreItem<T> & Record<W, string | number>, requestId?: string, idProperty?: W): V;
|
|
41
|
+
/**
|
|
42
|
+
* Updates the state with the given entities. Updates also AsyncStoreItem properties of each entity, when a request is resolved.
|
|
43
|
+
* @param state Actual state
|
|
44
|
+
* @param entities Payload items;
|
|
45
|
+
* @param requestId Id of request which has resolved if any
|
|
46
|
+
*/
|
|
47
|
+
resolveRequestMany<V extends EntityState<T>>(state: V, entities: (Partial<T> & Record<'id', string | number>)[], requestId?: string): V;
|
|
48
|
+
/**
|
|
49
|
+
* Updates the state with the given entities. Updates also AsyncStoreItem properties of each entity, when a request is resolved.
|
|
50
|
+
* @param state Actual state
|
|
51
|
+
* @param entities Payload items;
|
|
52
|
+
* @param requestId Id of request which has resolved if any
|
|
53
|
+
* @param idProperty Property of the entity containing its unique identifier
|
|
54
|
+
*/
|
|
55
|
+
resolveRequestMany<V extends EntityState<T>, W extends keyof T>(state: V, entities: (Partial<T> & Record<W, string | number>)[], requestId?: string, idProperty?: W): V;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Create an Asynchronous Request Entity Adapter
|
|
59
|
+
* @param adapter Entity Adapter
|
|
60
|
+
*/
|
|
61
|
+
export declare function createEntityAsyncRequestAdapter<T extends AsyncStoreItem>(adapter: EntityAdapter<T>): EntityAsyncRequestAdapter<T>;
|
|
62
|
+
//# sourceMappingURL=async-entity.adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"async-entity.adapter.d.ts","sourceRoot":"","sources":["../../../src/store/async/async-entity.adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,WAAW,EAEZ,MAAM,cAAc,CAAC;AAItB,OAAO,EACL,cAAc,EACd,2BAA2B,EAC5B,MAAM,oBAAoB,CAAC;AAE5B,4CAA4C;AAC5C,MAAM,WAAW,yBAAyB,CAAC,CAAC,SAAS,cAAc,CAAE,SAAQ,aAAa,CAAC,CAAC,CAAC;IAE3F;;;;;OAKG;IACH,eAAe,CAAC,CAAC,SAAS,WAAW,CAAC,CAAC,CAAC,GAAG,cAAc,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC;IAEvH;;;;;OAKG;IACH,aAAa,CAAC,CAAC,SAAS,WAAW,CAAC,CAAC,CAAC,GAAG,cAAc,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,SAAS,EAAE,MAAM,GAAG,CAAC,CAAC;IAEjI;;;;;OAKG;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,CAAC,CAAC,EAAE,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;CACzK;AAED;;;GAGG;AACH,wBAAgB,+BAA+B,CAAC,CAAC,SAAS,cAAc,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,yBAAyB,CAAC,CAAC,CAAC,CA2DjI"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { asyncStoreItemAdapter, } from './async.adapter';
|
|
2
|
+
/**
|
|
3
|
+
* Create an Asynchronous Request Entity Adapter
|
|
4
|
+
* @param adapter Entity Adapter
|
|
5
|
+
*/
|
|
6
|
+
export function createEntityAsyncRequestAdapter(adapter) {
|
|
7
|
+
const addRequestOne = (state, id, requestId) => {
|
|
8
|
+
const currentEntity = typeof id !== 'undefined' && id !== null && state.entities[id];
|
|
9
|
+
if (currentEntity) {
|
|
10
|
+
const changes = asyncStoreItemAdapter.addRequest(asyncStoreItemAdapter.extractAsyncStoreItem(currentEntity), requestId);
|
|
11
|
+
return adapter.updateOne({ id, changes }, state);
|
|
12
|
+
}
|
|
13
|
+
return asyncStoreItemAdapter.addRequest(state, requestId);
|
|
14
|
+
};
|
|
15
|
+
const addRequestMany = (state, ids, requestId) => adapter.updateMany(ids.filter((id) => !!state.entities[id]).map((id) => ({
|
|
16
|
+
id,
|
|
17
|
+
changes: asyncStoreItemAdapter.addRequest(asyncStoreItemAdapter.extractAsyncStoreItem(state.entities[id]), requestId)
|
|
18
|
+
})), state);
|
|
19
|
+
const resolveRequestOne = (state, entity, requestId, idProperty = 'id') => {
|
|
20
|
+
const currentEntity = state.entities[entity[idProperty]];
|
|
21
|
+
const newEntity = currentEntity
|
|
22
|
+
? asyncStoreItemAdapter.resolveRequest({ ...entity, ...asyncStoreItemAdapter.extractAsyncStoreItem(currentEntity) }, requestId)
|
|
23
|
+
: asyncStoreItemAdapter.initialize(entity);
|
|
24
|
+
state = asyncStoreItemAdapter.resolveRequest(state, requestId);
|
|
25
|
+
return adapter.upsertOne(newEntity, state);
|
|
26
|
+
};
|
|
27
|
+
const resolveRequestMany = (state, entities, requestId, idProperty = 'id') => adapter.updateMany(entities.filter((entity) => !!state.entities[entity[idProperty]]).map((entity) => {
|
|
28
|
+
const model = { ...entity, ...asyncStoreItemAdapter.extractAsyncStoreItem(state.entities[entity[idProperty]]) };
|
|
29
|
+
return { id: entity[idProperty], changes: asyncStoreItemAdapter.resolveRequest(model, requestId) };
|
|
30
|
+
}), state);
|
|
31
|
+
const failRequestMany = (state, ids = [], requestId) => {
|
|
32
|
+
if (ids.length > 0 && !ids.some((id) => state.entities[id] === undefined)) {
|
|
33
|
+
return adapter.updateMany(ids.map((id) => ({
|
|
34
|
+
id,
|
|
35
|
+
changes: asyncStoreItemAdapter.failRequest(asyncStoreItemAdapter.extractAsyncStoreItem(state.entities[id]), requestId)
|
|
36
|
+
})), state);
|
|
37
|
+
}
|
|
38
|
+
return asyncStoreItemAdapter.failRequest(state, requestId);
|
|
39
|
+
};
|
|
40
|
+
return {
|
|
41
|
+
...adapter,
|
|
42
|
+
failRequestMany,
|
|
43
|
+
addRequestOne,
|
|
44
|
+
addRequestMany,
|
|
45
|
+
resolveRequestOne,
|
|
46
|
+
resolveRequestMany
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=async-entity.adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"async-entity.adapter.js","sourceRoot":"","sources":["../../../src/store/async/async-entity.adapter.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,qBAAqB,GACtB,MAAM,iBAAiB,CAAC;AAoEzB;;;GAGG;AACH,MAAM,UAAU,+BAA+B,CAA2B,OAAyB;IACjG,MAAM,aAAa,GAA0H,CAAC,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE;QACpK,MAAM,aAAa,GAAG,OAAO,EAAE,KAAK,WAAW,IAAI,EAAE,KAAK,IAAI,IAAI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