@o3r/core 14.0.0-prerelease.9 → 14.0.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/builders/app-version/index.js.map +1 -0
- package/builders/app-version/schema.js.map +1 -0
- package/builders/lib-build/index.js.map +1 -0
- package/builders/lib-build/schema.js.map +1 -0
- package/builders/multi-watcher/index.js.map +1 -0
- package/builders/multi-watcher/schema.js.map +1 -0
- package/builders/ngc/index.js.map +1 -0
- package/builders/ngc/schema.js.map +1 -0
- package/builders/pattern-replacement/index.js.map +1 -0
- package/builders/pattern-replacement/schema.js.map +1 -0
- package/builders/run-script/index.js.map +1 -0
- package/builders/run-script/schema.js.map +1 -0
- package/builders/utils.js.map +1 -0
- 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/fesm2022/o3r-core.mjs +1 -1
- 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/migration.json +5 -0
- package/package.json +5 -6
- 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/schematics/add-modules/index.js.map +1 -0
- package/schematics/add-modules/schema.js.map +1 -0
- package/schematics/component/container/index.js.map +1 -0
- package/schematics/component/container/schema.js.map +1 -0
- package/schematics/component/index.js.map +1 -0
- package/schematics/component/presenter/index.d.ts.map +1 -1
- package/schematics/component/presenter/index.js +1 -5
- package/schematics/component/presenter/index.js.map +1 -0
- package/schematics/component/presenter/schema.d.ts +0 -2
- package/schematics/component/presenter/schema.d.ts.map +1 -1
- package/schematics/component/presenter/schema.js.map +1 -0
- package/schematics/component/presenter/schema.json +0 -4
- package/schematics/component/schema.d.ts +0 -2
- package/schematics/component/schema.d.ts.map +1 -1
- package/schematics/component/schema.js.map +1 -0
- package/schematics/component/schema.json +0 -4
- package/schematics/component/structures.types.js.map +1 -0
- package/schematics/context-to-component/index.js.map +1 -0
- package/schematics/context-to-component/schema.js.map +1 -0
- package/schematics/convert-component/index.js.map +1 -0
- package/schematics/convert-component/schema.js.map +1 -0
- package/schematics/ng-add/component-decorator/index.js.map +1 -0
- package/schematics/ng-add/index.js.map +1 -0
- package/schematics/ng-add/project-setup/index.js.map +1 -0
- package/schematics/ng-add/schema.js.map +1 -0
- package/schematics/ng-add/updates-for-v8/cms-adapters/update-builders-names.js.map +1 -0
- package/schematics/ng-add/updates-for-v8/generators/update-generators-names.js.map +1 -0
- package/schematics/ng-add/updates-for-v8/replaced-packages.js.map +1 -0
- package/schematics/ng-add-create/index.js.map +1 -0
- package/schematics/ng-add-create/schema.js.map +1 -0
- package/schematics/ng-update/index.d.ts +4 -0
- package/schematics/ng-update/index.d.ts.map +1 -1
- package/schematics/ng-update/index.js +21 -1
- package/schematics/ng-update/index.js.map +1 -0
- package/schematics/ng-update/v10.0/configuration.js.map +1 -0
- package/schematics/ng-update/v14.0/remove-styling-design-deps.d.ts +7 -0
- package/schematics/ng-update/v14.0/remove-styling-design-deps.d.ts.map +1 -0
- package/schematics/ng-update/v14.0/remove-styling-design-deps.js +13 -0
- package/schematics/ng-update/v14.0/remove-styling-design-deps.js.map +1 -0
- package/schematics/ng-update/v14.0/update-styling-imports.d.ts +8 -0
- package/schematics/ng-update/v14.0/update-styling-imports.d.ts.map +1 -0
- package/schematics/ng-update/v14.0/update-styling-imports.js +35 -0
- package/schematics/ng-update/v14.0/update-styling-imports.js.map +1 -0
- package/schematics/ng-update/v8.2/import-map.js.map +1 -0
- package/schematics/page/index.d.ts.map +1 -1
- package/schematics/page/index.js +1 -3
- package/schematics/page/index.js.map +1 -0
- package/schematics/page/schema.d.ts +0 -2
- package/schematics/page/schema.d.ts.map +1 -1
- package/schematics/page/schema.js.map +1 -0
- package/schematics/page/schema.json +0 -4
- package/schematics/renovate/index.js.map +1 -0
- package/schematics/renovate/schema.js.map +1 -0
- package/schematics/rule-factories/additional-modules/index.js.map +1 -0
- package/schematics/rule-factories/component/analytics.js.map +1 -0
- package/schematics/rule-factories/component/common.js.map +1 -0
- package/schematics/rule-factories/component/configuration.js.map +1 -0
- package/schematics/rule-factories/component/context.js.map +1 -0
- package/schematics/rule-factories/component/fixture.js.map +1 -0
- package/schematics/rule-factories/component/localization.js.map +1 -0
- package/schematics/rule-factories/component/rules-engine.js.map +1 -0
- package/schematics/rule-factories/customization-environment/index.d.ts.map +1 -1
- package/schematics/rule-factories/customization-environment/index.js +2 -3
- package/schematics/rule-factories/customization-environment/index.js.map +1 -0
- package/schematics/rule-factories/index.js.map +1 -0
- package/schematics/rule-factories/o3r-basic-updates/index.js.map +1 -0
- package/schematics/rule-factories/otter-environment/index.js.map +1 -0
- package/schematics/rule-factories/store/index.js.map +1 -0
- package/schematics/rule-factories/update-package-json/index.js.map +1 -0
- package/schematics/schematics-update/index.js.map +1 -0
- package/schematics/schematics-update/schema.js.map +1 -0
- package/schematics/service/index.js.map +1 -0
- package/schematics/service/schema.js.map +1 -0
- package/schematics/shared/presets/all-preset.d.ts.map +1 -1
- package/schematics/shared/presets/all-preset.js +1 -2
- package/schematics/shared/presets/all-preset.js.map +1 -0
- package/schematics/shared/presets/basic-preset.js.map +1 -0
- package/schematics/shared/presets/cms-preset.js +1 -1
- package/schematics/shared/presets/cms-preset.js.map +1 -0
- package/schematics/shared/presets/external-preset.js.map +1 -0
- package/schematics/shared/presets/helpers.js.map +1 -0
- package/schematics/shared/presets/index.js.map +1 -0
- package/schematics/shared/presets/preset-interface.js.map +1 -0
- package/schematics/shared/presets/recommended-preset.js.map +1 -0
- package/schematics/show-modules/index.js.map +1 -0
- package/schematics/show-modules/schema.js.map +1 -0
- package/schematics/store/common/helpers.js.map +1 -0
- package/schematics/store/common/schema.js.map +1 -0
- package/schematics/store/entity-async/index.js.map +1 -0
- package/schematics/store/entity-async/schema.js.map +1 -0
- package/schematics/store/entity-sync/index.js.map +1 -0
- package/schematics/store/entity-sync/schema.js.map +1 -0
- package/schematics/store/index.js.map +1 -0
- package/schematics/store/schema.js.map +1 -0
- package/schematics/store/simple-async/index.js.map +1 -0
- package/schematics/store/simple-async/schema.js.map +1 -0
- package/schematics/store/simple-sync/index.js.map +1 -0
- package/schematics/store/simple-sync/schema.js.map +1 -0
- package/schematics/store-action/index.js.map +1 -0
- package/schematics/store-action/schema.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/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
- package/schematics/rule-factories/component/design-token.d.ts +0 -4
- package/schematics/rule-factories/component/design-token.d.ts.map +0 -1
- package/schematics/rule-factories/component/design-token.js +0 -10
- package/schematics/rule-factories/component/theming.d.ts +0 -4
- package/schematics/rule-factories/component/theming.d.ts.map +0 -1
- package/schematics/rule-factories/component/theming.js +0 -7
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { FailActionPayload, FailEntitiesActionPayload, SetActionPayload, SetEntitiesActionPayload, SetEntityActionPayload, UpdateEntitiesActionPayload, UpdateEntitiesActionPayloadWithId, UpdateEntityActionPayload, UpdateEntityActionPayloadWithId } from '../types';
|
|
2
|
+
export type RequestId = string;
|
|
3
|
+
/**
|
|
4
|
+
* Interface representing an asynchronous request
|
|
5
|
+
*/
|
|
6
|
+
export interface AsyncRequest {
|
|
7
|
+
/** ID of the request */
|
|
8
|
+
requestId: RequestId;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Represents a store item that can be manipulated via asynchronous calls
|
|
12
|
+
*/
|
|
13
|
+
export interface AsyncStoreItem {
|
|
14
|
+
/**
|
|
15
|
+
* IDs of the active asynchronous requests for this item.
|
|
16
|
+
*/
|
|
17
|
+
requestIds: RequestId[];
|
|
18
|
+
/**
|
|
19
|
+
* Has a recent call failed.
|
|
20
|
+
* This is reset back to false the next time a new async process is started and there are no active requests.
|
|
21
|
+
*/
|
|
22
|
+
isFailure?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Is an asynchronous process ongoing on that item
|
|
25
|
+
*/
|
|
26
|
+
isPending?: boolean;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Payload for actions relying on asynchronous requests
|
|
30
|
+
*/
|
|
31
|
+
export interface FromApiActionPayload<T> extends Partial<AsyncRequest> {
|
|
32
|
+
/** Promise call from API */
|
|
33
|
+
call: Promise<T>;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Unwraps the type of a FromApiActionPayload
|
|
37
|
+
*/
|
|
38
|
+
export type ExtractFromApiActionPayloadType<T extends FromApiActionPayload<any>> = T['call'] extends Promise<infer U> ? U : never;
|
|
39
|
+
/**
|
|
40
|
+
* Payload for actions relying on asynchronous requests
|
|
41
|
+
*/
|
|
42
|
+
export interface FromApiActionPayloadWithEntityId<T> extends FromApiActionPayload<T> {
|
|
43
|
+
/** ID of the entity affected by the call */
|
|
44
|
+
id?: string;
|
|
45
|
+
}
|
|
46
|
+
/** Add an optional request ID to the given object */
|
|
47
|
+
export type WithRequestId<T> = T & Partial<AsyncRequest>;
|
|
48
|
+
/** Payload to set entities actions from async */
|
|
49
|
+
export interface SetAsyncStoreItemActionPayload<T> extends SetActionPayload<T>, Partial<AsyncRequest> {
|
|
50
|
+
}
|
|
51
|
+
/** Payload to update entities actions from async */
|
|
52
|
+
export interface UpdateAsyncStoreItemEntitiesActionPayload<T extends object, K extends keyof T> extends UpdateEntitiesActionPayload<T, K>, Partial<AsyncRequest> {
|
|
53
|
+
}
|
|
54
|
+
/** Payload to update entities actions from async with a field ID */
|
|
55
|
+
export interface UpdateAsyncStoreItemEntitiesActionPayloadWithId<T extends {
|
|
56
|
+
id: string | number;
|
|
57
|
+
}> extends UpdateEntitiesActionPayloadWithId<T>, Partial<AsyncRequest> {
|
|
58
|
+
}
|
|
59
|
+
/** Payload to update entity actions from async */
|
|
60
|
+
export interface UpdateAsyncStoreItemEntityActionPayload<T extends object, K extends keyof T> extends UpdateEntityActionPayload<T, K>, Partial<AsyncRequest> {
|
|
61
|
+
}
|
|
62
|
+
/** Payload to update entity actions from async with a field ID */
|
|
63
|
+
export interface UpdateAsyncStoreItemEntityActionPayloadWithId<T extends {
|
|
64
|
+
id: string | number;
|
|
65
|
+
}> extends UpdateEntityActionPayloadWithId<T>, Partial<AsyncRequest> {
|
|
66
|
+
}
|
|
67
|
+
/** Payload to set/upsert entities actions from async */
|
|
68
|
+
export interface SetAsyncStoreItemEntitiesActionPayload<T extends object> extends SetEntitiesActionPayload<T>, Partial<AsyncRequest> {
|
|
69
|
+
}
|
|
70
|
+
/** Payload to set/upsert entity actions from async */
|
|
71
|
+
export interface SetAsyncStoreItemEntityActionPayload<T extends object> extends SetEntityActionPayload<T>, Partial<AsyncRequest> {
|
|
72
|
+
}
|
|
73
|
+
/** Payload to fail entity actions from async */
|
|
74
|
+
export interface FailAsyncStoreItemEntityActionPayload<T extends object> extends FailActionPayload<T>, Partial<AsyncRequest> {
|
|
75
|
+
}
|
|
76
|
+
/** Payload to fail entities actions from async */
|
|
77
|
+
export interface FailAsyncStoreItemEntitiesActionPayload<T extends object> extends FailEntitiesActionPayload<T>, Partial<AsyncRequest> {
|
|
78
|
+
}
|
|
79
|
+
/** Status for all the elements inside a cart */
|
|
80
|
+
export type EntityStatus<T, U extends keyof T = never> = {
|
|
81
|
+
[P in keyof Omit<T, 'id' | U>]?: AsyncStoreItem;
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* Extends an Entity model with a status property that holds async information for each of its sub-resources
|
|
85
|
+
*/
|
|
86
|
+
export type EntityWithStatus<T> = T & {
|
|
87
|
+
status: EntityStatus<T>;
|
|
88
|
+
};
|
|
89
|
+
/** Modifies the given type that extends AsyncStoreItem to remove those properties */
|
|
90
|
+
export type EntityWithoutAsyncStoreItem<T extends AsyncStoreItem> = Omit<T, keyof AsyncStoreItem>;
|
|
91
|
+
//# sourceMappingURL=async.interfaces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"async.interfaces.d.ts","sourceRoot":"","sources":["../../../src/store/async/async.interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,yBAAyB,EACzB,gBAAgB,EAChB,wBAAwB,EACxB,sBAAsB,EACtB,2BAA2B,EAC3B,iCAAiC,EACjC,yBAAyB,EACzB,+BAA+B,EAChC,MAAM,UAAU,CAAC;AAElB,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC;AAE/B;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,wBAAwB;IACxB,SAAS,EAAE,SAAS,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,UAAU,EAAE,SAAS,EAAE,CAAC;IAExB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB,CAAC,CAAC,CAAE,SAAQ,OAAO,CAAC,YAAY,CAAC;IACpE,4BAA4B;IAC5B,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,MAAM,+BAA+B,CAAC,CAAC,SAAS,oBAAoB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,SAAS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AAM,CAAE,SAAQ,wBAAwB,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC;CAAG;AAEvI,sDAAsD;AACtD,MAAM,WAAW,oCAAoC,CAAC,CAAC,SAAS,MAAM,CAAE,SAAQ,sBAAsB,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC;CAAG;AAEnI,gDAAgD;AAChD,MAAM,WAAW,qCAAqC,CAAC,CAAC,SAAS,MAAM,CAAE,SAAQ,iBAAiB,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC;CAAG;AAE/H,kDAAkD;AAClD,MAAM,WAAW,uCAAuC,CAAC,CAAC,SAAS,MAAM,CAAE,SAAQ,yBAAyB,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC;CAAG;AAEzI,gDAAgD;AAChD,MAAM,MAAM,YAAY,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,GAAG,KAAK,IAAI;KACtD,CAAC,IAAI,MAAM,IAAI,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,cAAc;CAChD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI,CAAC,GAAG;IAAE,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,CAAA;CAAE,CAAC;AAElE,qFAAqF;AACrF,MAAM,MAAM,2BAA2B,CAAC,CAAC,SAAS,cAAc,IAAI,IAAI,CAAC,CAAC,EAAE,MAAM,cAAc,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"async.interfaces.js","sourceRoot":"","sources":["../../../src/store/async/async.interfaces.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Action } from '@ngrx/store';
|
|
2
|
+
import { Observable, OperatorFunction } from 'rxjs';
|
|
3
|
+
import { AsyncRequest, ExtractFromApiActionPayloadType, FromApiActionPayload } from './async.interfaces';
|
|
4
|
+
/**
|
|
5
|
+
* Custom operator to use instead of SwitchMap with effects based on FromApi actions.
|
|
6
|
+
* It makes sure to emit an action when the inner subscription is unsubscribed in order to keep the store up-to-date with pending information.
|
|
7
|
+
* @param successHandler function that returns the action to emit in case the FromApi call is a success
|
|
8
|
+
* @param errorHandler function that returns the action to emit in case the FromApi call fails
|
|
9
|
+
* @param cancelRequestActionFactory function that returns the action to emit in case the FromApi action is 'cancelled' because a new action was received by the switchMap
|
|
10
|
+
*/
|
|
11
|
+
export declare function fromApiEffectSwitchMap<T extends FromApiActionPayload<any>, S extends ExtractFromApiActionPayloadType<T>, U extends Action, V extends Action, W extends Action>(successHandler: (result: S, action: T) => U | Observable<U> | Promise<U>, errorHandler?: (error: any, action: T) => Observable<V>, cancelRequestActionFactory?: (props: AsyncRequest, action: T) => W): OperatorFunction<T, U | V | W>;
|
|
12
|
+
/**
|
|
13
|
+
* Same as {@link fromApiEffectSwitchMap}, instead one inner subscription is kept by id.
|
|
14
|
+
* @param successHandler
|
|
15
|
+
* @param errorHandler
|
|
16
|
+
* @param cancelRequestActionFactory
|
|
17
|
+
* @param cleanUpTimer
|
|
18
|
+
*/
|
|
19
|
+
export declare function fromApiEffectSwitchMapById<T extends FromApiActionPayload<any> & {
|
|
20
|
+
id: string;
|
|
21
|
+
}, S extends ExtractFromApiActionPayloadType<T>, U extends Action, V extends Action, W extends Action>(successHandler: (result: S, action: T) => U | Observable<U> | Promise<U>, errorHandler?: (error: any, action: T) => Observable<V>, cancelRequestActionFactory?: (props: AsyncRequest, action: T) => W, cleanUpTimer?: number): OperatorFunction<T, U | V | W>;
|
|
22
|
+
//# sourceMappingURL=async.operators.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"async.operators.d.ts","sourceRoot":"","sources":["../../../src/store/async/async.operators.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACP,MAAM,aAAa,CAAC;AACrB,OAAO,EAOL,UA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AAC,EAAE,CAAC,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC,KAAK,CAAC,EAClE,YAAY,CAAC,EAAE,MAAM,GACpB,gBAAgB,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAwChC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { BehaviorSubject, EMPTY, from, identity, isObservable, merge, of, } from 'rxjs';
|
|
2
|
+
import { catchError, delay, filter, finalize, pairwise, startWith, switchMap, tap, } from 'rxjs/operators';
|
|
3
|
+
import { isIdentifiedCallAction, } from './async.helpers';
|
|
4
|
+
/**
|
|
5
|
+
* Determine if the given parameter is a Promise
|
|
6
|
+
* @param object
|
|
7
|
+
*/
|
|
8
|
+
const isPromise = (object) => object && typeof object === 'object' && typeof object.then !== 'undefined';
|
|
9
|
+
/**
|
|
10
|
+
* Custom operator to use instead of SwitchMap with effects based on FromApi actions.
|
|
11
|
+
* It makes sure to emit an action when the inner subscription is unsubscribed in order to keep the store up-to-date with pending information.
|
|
12
|
+
* @param successHandler function that returns the action to emit in case the FromApi call is a success
|
|
13
|
+
* @param errorHandler function that returns the action to emit in case the FromApi call fails
|
|
14
|
+
* @param cancelRequestActionFactory function that returns the action to emit in case the FromApi action is 'cancelled' because a new action was received by the switchMap
|
|
15
|
+
*/
|
|
16
|
+
export function fromApiEffectSwitchMap(successHandler, errorHandler, cancelRequestActionFactory) {
|
|
17
|
+
const pendingRequestIdsContext = {};
|
|
18
|
+
return (source$) => source$.pipe(tap((action) => {
|
|
19
|
+
if (isIdentifiedCallAction(action)) {
|
|
20
|
+
pendingRequestIdsContext[action.requestId] = true;
|
|
21
|
+
}
|
|
22
|
+
}), startWith(undefined), pairwise(), switchMap(([previousAction, action]) => {
|
|
23
|
+
if (!action) {
|
|
24
|
+
return EMPTY;
|
|
25
|
+
}
|
|
26
|
+
const isPreviousActionStillRunning = isIdentifiedCallAction(previousAction) && pendingRequestIdsContext[previousAction.requestId];
|
|
27
|
+
const cleanStack = () => {
|
|
28
|
+
if (isIdentifiedCallAction(action)) {
|
|
29
|
+
delete pendingRequestIdsContext[action.requestId];
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
return from(action.call).pipe(tap(cleanStack), switchMap((result) => {
|
|
33
|
+
const success = successHandler(result, action);
|
|
34
|
+
return isObservable(success) ? success : (isPromise(success) ? success : of(success));
|
|
35
|
+
}), catchError((error) => {
|
|
36
|
+
cleanStack();
|
|
37
|
+
return errorHandler?.(error, action) || EMPTY;
|
|
38
|
+
}), isPreviousActionStillRunning && cancelRequestActionFactory ? startWith(cancelRequestActionFactory({ requestId: previousAction.requestId }, action)) : identity);
|
|
39
|
+
}));
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Same as {@link fromApiEffectSwitchMap}, instead one inner subscription is kept by id.
|
|
43
|
+
* @param successHandler
|
|
44
|
+
* @param errorHandler
|
|
45
|
+
* @param cancelRequestActionFactory
|
|
46
|
+
* @param cleanUpTimer
|
|
47
|
+
*/
|
|
48
|
+
export function fromApiEffectSwitchMapById(successHandler, errorHandler, cancelRequestActionFactory, cleanUpTimer) {
|
|
49
|
+
const innerSourcesById = {};
|
|
50
|
+
return (source$) => {
|
|
51
|
+
return source$.pipe(filter((action) => {
|
|
52
|
+
if (!isIdentifiedCallAction(action) || !action.id) {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
if (isIdentifiedCallAction(action) && innerSourcesById[action.id]) {
|
|
56
|
+
innerSourcesById[action.id][0].next(action);
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
return true;
|
|
60
|
+
}), switchMap((action) => {
|
|
61
|
+
const newIdSubject = new BehaviorSubject(action);
|
|
62
|
+
const newId$ = newIdSubject.pipe(fromApiEffectSwitchMap(successHandler, errorHandler, cancelRequestActionFactory));
|
|
63
|
+
innerSourcesById[action.id] = [newIdSubject, newId$];
|
|
64
|
+
if (cleanUpTimer !== undefined) {
|
|
65
|
+
newIdSubject.pipe(switchMap((myAction) => from(myAction.call).pipe(delay(cleanUpTimer), finalize(() => {
|
|
66
|
+
delete innerSourcesById[myAction.id];
|
|
67
|
+
newIdSubject.complete();
|
|
68
|
+
})))).subscribe();
|
|
69
|
+
}
|
|
70
|
+
const streams = Object.values(innerSourcesById).map(([_, obs]) => obs);
|
|
71
|
+
return merge(...streams);
|
|
72
|
+
}));
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=async.operators.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"async.operators.js","sourceRoot":"","sources":["../../../src/store/async/async.operators.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,eAAe,EACf,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,YAAY,EACZ,KAAK,EAEL,EAAE,GAGH,MAAM,MAAM,CAAC;AACd,OAAO,EACL,UAAU,EACV,KAAK,EACL,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,SAAS,EACT,GAAG,GACJ,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,sBAAsB,GACvB,MAAM,iBAAiB,CAAC;AAOzB;;;GAGG;AACH,MAAM,SAAS,GAAG,CAAI,MAAsB,EAAwB,EAAE,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,OAAQ,MAAc,CAAC,IAAI,KAAK,WAAW,CAAC;AAE3J;;;;;;GAMG;AACH,MAAM,UAAU,sBAAsB,CAClC,cAAwE,EACxE,YAAuD,EACvD,0BAAkE;IACpE,MAAM,wBAAwB,GAA4B,EAAE,CAAC;IAE7D,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAC9B,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;QACb,IAAI,sBAAsB,CAAC,MAAM,CAAC,EAAE,CAAC;YACnC,wBAAwB,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;QACpD,CAAC;IACH,CAAC,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AAC;oBACrC,YAAY,CAAC,QAAQ,EAAE,CAAC;gBAC1B,CAAC,CAAC,CACH,CAAC,CACH,CAAC,SAAS,EAAE,CAAC;YAChB,CAAC;YACD,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC;YACvE,OAAO,KAAK,CAAC,GAAG,OAAO,CAAC,CAAC;QAC3B,CAAC,CAAC,CACH,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AsyncRequest } from './async.interfaces';
|
|
2
|
+
/**
|
|
3
|
+
* Returns a creator that makes sure that requestId is defined in the action's properties by generating one
|
|
4
|
+
* if needed.
|
|
5
|
+
*/
|
|
6
|
+
export declare const asyncProps: <P extends object>() => (props: P) => P & AsyncRequest;
|
|
7
|
+
//# sourceMappingURL=async.props.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"async.props.d.ts","sourceRoot":"","sources":["../../../src/store/async/async.props.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,YAAY,EACb,MAAM,oBAAoB,CAAC;AAE5B;;;GAGG;AACH,eAAO,MAAM,UAAU,GAAI,CAAC,SAAS,MAAM,OAAK,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,YAEjE,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { v4, } from 'uuid';
|
|
2
|
+
import { isAsyncRequest, } from './async.helpers';
|
|
3
|
+
/**
|
|
4
|
+
* Returns a creator that makes sure that requestId is defined in the action's properties by generating one
|
|
5
|
+
* if needed.
|
|
6
|
+
*/
|
|
7
|
+
export const asyncProps = () => {
|
|
8
|
+
return (props) => isAsyncRequest(props) ? props : { ...props, requestId: v4() };
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=async.props.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"async.props.js","sourceRoot":"","sources":["../../../src/store/async/async.props.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,EAAE,GACH,MAAM,MAAM,CAAC;AACd,OAAO,EACL,cAAc,GACf,MAAM,iBAAiB,CAAC;AAKzB;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,GAAqD,EAAE;IAC/E,OAAO,CAAC,KAAQ,EAAE,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,EAAE,CAAC;AACrF,CAAC,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { EntityState } from '@ngrx/entity';
|
|
2
|
+
import { AsyncStoreItem, EntityStatus } from './async.interfaces';
|
|
3
|
+
/**
|
|
4
|
+
* Serializer for asynchronous store.
|
|
5
|
+
* @param state State of an asynchronous store to serialize
|
|
6
|
+
* @returns a plain json object to pass to json.stringify
|
|
7
|
+
*/
|
|
8
|
+
export declare function asyncSerializer<T extends AsyncStoreItem>(state: T): T;
|
|
9
|
+
/**
|
|
10
|
+
* Serializer for asynchronous entity store.
|
|
11
|
+
* @param state State of an asynchronous entity store to serialize
|
|
12
|
+
* @returns a plain json object to pass to json.stringify
|
|
13
|
+
*/
|
|
14
|
+
export declare function asyncEntitySerializer<T extends AsyncStoreItem & EntityState<AsyncStoreItem>>(state: T): T & {
|
|
15
|
+
entities: import("@ngrx/entity").Dictionary<AsyncStoreItem>;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Serializer for asynchronous entity store with status.
|
|
19
|
+
* @param state State of an asynchronous entity store with status to serialize
|
|
20
|
+
* @returns a plain json object to pass to json.stringify
|
|
21
|
+
*/
|
|
22
|
+
export declare function asyncEntityWithStatusSerializer<T extends AsyncStoreItem & EntityState<AsyncStoreItem & {
|
|
23
|
+
status: EntityStatus<T['entities']['status']>;
|
|
24
|
+
}>>(state: T): T & {
|
|
25
|
+
entities: import("@ngrx/entity").Dictionary<AsyncStoreItem & {
|
|
26
|
+
status: EntityStatus<T["entities"]["status"]>;
|
|
27
|
+
}>;
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=async.serializer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"async.serializer.d.ts","sourceRoot":"","sources":["../../../src/store/async/async.serializer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACZ,MAAM,cAAc,CAAC;AAItB,OAAO,EACL,cAAc,EACd,YAAY,EACb,MAAM,oBAAoB,CAAC;AAE5B;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS,cAAc,EAAE,KAAK,EAAE,CAAC,KAEjE;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,cAAc,GAAG,WAAW,CAAC,cAAc,CAAC,EAAE,KAAK,EAAE,CAAC;;EAOrG;AAED;;;;GAIG;AACH,wBAAgB,+BAA+B,CAAC,CAAC,SAAS,cAAc,GAAG,WAAW,CAAC,cAAc,GAAG;IAAE,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAA;CAAE,CAAC,EAAE,KAAK,EAAE,CAAC;;gBAAlD,YAAY,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,CAAC;;EAOtJ"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { asyncStoreItemAdapter, } from './async.adapter';
|
|
2
|
+
/**
|
|
3
|
+
* Serializer for asynchronous store.
|
|
4
|
+
* @param state State of an asynchronous store to serialize
|
|
5
|
+
* @returns a plain json object to pass to json.stringify
|
|
6
|
+
*/
|
|
7
|
+
export function asyncSerializer(state) {
|
|
8
|
+
return asyncStoreItemAdapter.clearAsyncStoreItem(state);
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Serializer for asynchronous entity store.
|
|
12
|
+
* @param state State of an asynchronous entity store to serialize
|
|
13
|
+
* @returns a plain json object to pass to json.stringify
|
|
14
|
+
*/
|
|
15
|
+
export function asyncEntitySerializer(state) {
|
|
16
|
+
const entities = state.ids.reduce((entitiesAcc, entityId) => {
|
|
17
|
+
entitiesAcc[entityId] = asyncStoreItemAdapter.clearAsyncStoreItem(state.entities[entityId]);
|
|
18
|
+
return entitiesAcc;
|
|
19
|
+
}, {});
|
|
20
|
+
return { ...asyncStoreItemAdapter.clearAsyncStoreItem(state), entities };
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Serializer for asynchronous entity store with status.
|
|
24
|
+
* @param state State of an asynchronous entity store with status to serialize
|
|
25
|
+
* @returns a plain json object to pass to json.stringify
|
|
26
|
+
*/
|
|
27
|
+
export function asyncEntityWithStatusSerializer(state) {
|
|
28
|
+
const entities = state.ids.reduce((entitiesAcc, entityId) => {
|
|
29
|
+
entitiesAcc[entityId] = { ...asyncStoreItemAdapter.clearAsyncStoreItem(state.entities[entityId]), status: {} };
|
|
30
|
+
return entitiesAcc;
|
|
31
|
+
}, {});
|
|
32
|
+
return { ...asyncStoreItemAdapter.clearAsyncStoreItem(state), entities };
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=async.serializer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"async.serializer.js","sourceRoot":"","sources":["../../../src/store/async/async.serializer.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,qBAAqB,GACtB,MAAM,iBAAiB,CAAC;AAMzB;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAA2B,KAAQ;IAChE,OAAO,qBAAqB,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;AAC1D,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAyD,KAAQ;IACpG,MAAM,QAAQ,GAAI,KAAK,CAAC,GAAgB,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,QAAQ,EAAE,EAAE;QACxE,WAAW,CAAC,QAAQ,CAAC,GAAG,qBAAqB,CAAC,mBAAmB,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAE,CAAC,CAAC;QAC7F,OAAO,WAAW,CAAC;IACrB,CAAC,EAAE,EAA2B,CAAC,CAAC;IAEhC,OAAO,EAAE,GAAG,qBAAqB,CAAC,mBAAmB,CAAC,KAAK,CAAC,EAAE,QAAQ,EAAE,CAAC;AAC3E,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,+BAA+B,CAA6G,KAAQ;IAClK,MAAM,QAAQ,GAAI,KAAK,CAAC,GAAgB,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,QAAQ,EAAE,EAAE;QACxE,WAAW,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,qBAAqB,CAAC,mBAAmB,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;QAChH,OAAO,WAAW,CAAC;IACrB,CAAC,EAAE,EAA2B,CAAC,CAAC;IAEhC,OAAO,EAAE,GAAG,qBAAqB,CAAC,mBAAmB,CAAC,KAAK,CAAC,EAAE,QAAQ,EAAE,CAAC;AAC3E,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './async-entity.adapter';
|
|
2
|
+
export * from './async.adapter';
|
|
3
|
+
export * from './async.helpers';
|
|
4
|
+
export * from './async.interfaces';
|
|
5
|
+
export * from './async.operators';
|
|
6
|
+
export * from './async.props';
|
|
7
|
+
export * from './async.serializer';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/store/async/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './async-entity.adapter';
|
|
2
|
+
export * from './async.adapter';
|
|
3
|
+
export * from './async.helpers';
|
|
4
|
+
export * from './async.interfaces';
|
|
5
|
+
export * from './async.operators';
|
|
6
|
+
export * from './async.props';
|
|
7
|
+
export * from './async.serializer';
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/store/async/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC"}
|
package/store/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/store/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC"}
|
package/store/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/store/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC"}
|
package/store/types.d.ts
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Object that define how to serialize a specific state
|
|
3
|
+
*/
|
|
4
|
+
export interface Serializer<T> {
|
|
5
|
+
serialize?: (obj: T) => any;
|
|
6
|
+
deserialize?: (data?: any) => T;
|
|
7
|
+
reviver?: (key: string, value: any) => any;
|
|
8
|
+
replacer?: (key: string, value: any) => any;
|
|
9
|
+
initialState?: T;
|
|
10
|
+
}
|
|
11
|
+
export declare class StateSerializer<T> implements Serializer<T> {
|
|
12
|
+
serialize?: (obj: T) => any;
|
|
13
|
+
deserialize?: (data?: any) => T;
|
|
14
|
+
replacer?: (key: string, value: any) => any;
|
|
15
|
+
initialState?: T;
|
|
16
|
+
constructor(serializer: Serializer<T>);
|
|
17
|
+
reviver: (_: string, value: any) => any;
|
|
18
|
+
}
|
|
19
|
+
export interface LocalStateModel {
|
|
20
|
+
/**
|
|
21
|
+
* Temporary ID of the model in the dictionary
|
|
22
|
+
*/
|
|
23
|
+
tid: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Adds an `id` to the given type
|
|
27
|
+
*/
|
|
28
|
+
export type Idfy<T> = T & {
|
|
29
|
+
id: string | number;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Payload to update actions
|
|
33
|
+
*/
|
|
34
|
+
export interface UpdateActionPayload<T> {
|
|
35
|
+
stateDetails: Partial<T>;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Payload to set actions
|
|
39
|
+
*/
|
|
40
|
+
export interface SetActionPayload<T> {
|
|
41
|
+
stateDetails: T;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Payload to set state actions
|
|
45
|
+
*/
|
|
46
|
+
export interface SetStateActionPayload<T> {
|
|
47
|
+
state: T;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Payload to fail actions
|
|
51
|
+
*/
|
|
52
|
+
export interface FailActionPayload<T> {
|
|
53
|
+
error?: T;
|
|
54
|
+
}
|
|
55
|
+
export type Keep<T, K extends keyof T> = Partial<T> & Pick<T, K>;
|
|
56
|
+
/** Payload to update entities actions */
|
|
57
|
+
export interface UpdateEntitiesActionPayload<T, K extends keyof T> {
|
|
58
|
+
entities: Keep<T, K>[];
|
|
59
|
+
}
|
|
60
|
+
/** Payload to update entities actions with a field ID */
|
|
61
|
+
export interface UpdateEntitiesActionPayloadWithId<T extends {
|
|
62
|
+
id: string | number;
|
|
63
|
+
}> {
|
|
64
|
+
entities: Keep<T, 'id'>[];
|
|
65
|
+
}
|
|
66
|
+
/** Payload to update entities actions */
|
|
67
|
+
export interface UpdateEntityActionPayload<T, K extends keyof T> {
|
|
68
|
+
entity: Keep<T, K>;
|
|
69
|
+
}
|
|
70
|
+
/** Payload to update entities actions with a field ID */
|
|
71
|
+
export interface UpdateEntityActionPayloadWithId<T extends {
|
|
72
|
+
id: string | number;
|
|
73
|
+
}> {
|
|
74
|
+
entity: Keep<T, 'id'>;
|
|
75
|
+
}
|
|
76
|
+
/** Payload to set entities and upsert entities actions */
|
|
77
|
+
export interface SetEntitiesActionPayload<T> {
|
|
78
|
+
entities: T[];
|
|
79
|
+
}
|
|
80
|
+
/** Payload to set entity and upsert entity actions */
|
|
81
|
+
export interface SetEntityActionPayload<T> {
|
|
82
|
+
entity: T;
|
|
83
|
+
}
|
|
84
|
+
/** Payload to fail entities actions */
|
|
85
|
+
export interface FailEntitiesActionPayload<T> extends FailActionPayload<T> {
|
|
86
|
+
ids?: (string | number)[];
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Payload to clear the store in case of failure
|
|
90
|
+
*/
|
|
91
|
+
export interface ClearOnFailurePayload {
|
|
92
|
+
/** Clear store on failure */
|
|
93
|
+
clearOnFailure?: boolean;
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/store/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,UAAU,CAAC,CAAC;IAC3B,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,GAAG,CAAC;IAC5B,WAAW,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,GAAG,KAAK,CAAC,CAAC;IAChC,OAAO,C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AC1B"}
|
package/store/types.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export class StateSerializer {
|
|
2
|
+
constructor(serializer) {
|
|
3
|
+
this.reviver = (_, value) => value;
|
|
4
|
+
this.serialize = serializer.serialize || this.serialize;
|
|
5
|
+
this.deserialize = serializer.deserialize || this.deserialize;
|
|
6
|
+
this.reviver = serializer.reviver || this.reviver;
|
|
7
|
+
this.replacer = serializer.replacer || this.replacer;
|
|
8
|
+
this.initialState = serializer.initialState || this.initialState;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/store/types.ts"],"names":[],"mappings":"AAWA,MAAM,OAAO,eAAe;IAM1B,YAAY,UAAyB;QAQ9B,YAAO,GAAG,CAAC,CAAS,EAAE,KAAU,EAAO,EAAE,CAAC,KAAK,CAAC;QAPrD,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,IAAI,IAAI,CAAC,SAAS,CAAC;QACxD,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC,WAAW,IAAI,IAAI,CAAC,WAAW,CAAC;QAC9D,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC;QAClD,IAAI,CAAC,QAAQ,GAAG,UAAU,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC;QACrD,IAAI,CAAC,YAAY,GAAG,UAAU,CAAC,YAAY,IAAI,IAAI,CAAC,YAAY,CAAC;IACnE,CAAC;CAGF"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Dataset } from '../../core/application/dgp-interfaces';
|
|
2
|
+
/**
|
|
3
|
+
* Pad number
|
|
4
|
+
* @param val
|
|
5
|
+
* @param digits
|
|
6
|
+
*/
|
|
7
|
+
export declare function padNumber(val: number, digits?: number): string;
|
|
8
|
+
/**
|
|
9
|
+
* Returns TRUE if bootstrap config environment is production FALSE otherwise
|
|
10
|
+
* @param dataset
|
|
11
|
+
* @returns TRUE if bootstrap config environment is production FALSE otherwise
|
|
12
|
+
*/
|
|
13
|
+
export declare function isProductionEnvironment(dataset: Dataset): boolean;
|
|
14
|
+
//# sourceMappingURL=debug-helper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug-helper.d.ts","sourceRoot":"","sources":["../../../src/utils/debug/debug-helper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,OAAO,EACR,MAAM,uCAAuC,CAAC;AAE/C;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,SAAI,GAAG,MAAM,CAGzD;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAGjE"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pad number
|
|
3
|
+
* @param val
|
|
4
|
+
* @param digits
|
|
5
|
+
*/
|
|
6
|
+
export function padNumber(val, digits = 2) {
|
|
7
|
+
const str = `${val}`;
|
|
8
|
+
return '0'.repeat(Math.max(0, digits - str.length)) + str;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Returns TRUE if bootstrap config environment is production FALSE otherwise
|
|
12
|
+
* @param dataset
|
|
13
|
+
* @returns TRUE if bootstrap config environment is production FALSE otherwise
|
|
14
|
+
*/
|
|
15
|
+
export function isProductionEnvironment(dataset) {
|
|
16
|
+
const bootstrapConfig = dataset.bootstrapconfig && JSON.parse(dataset.bootstrapconfig);
|
|
17
|
+
return bootstrapConfig?.environment === 'prod';
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=debug-helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug-helper.js","sourceRoot":"","sources":["../../../src/utils/debug/debug-helper.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,GAAW,EAAE,MAAM,GAAG,CAAC;IAC/C,MAAM,GAAG,GAAG,GAAG,GAAG,EAAE,CAAC;IACrB,OAAO,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,GAAG,CAAC;AAC5D,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CAAC,OAAgB;IACtD,MAAM,eAAe,GAAoB,OAAO,CAAC,eAAe,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IACxG,OAAO,eAAe,EAAE,WAAW,KAAK,MAAM,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** Reviver Mapper to detect and create object on deepFill */
|
|
2
|
+
export interface PrimitiveReviverMapper<T = any> {
|
|
3
|
+
/** Condition to fill to be determine as */
|
|
4
|
+
condition: (data: any) => boolean;
|
|
5
|
+
/**
|
|
6
|
+
* Construct the primitive type if needed
|
|
7
|
+
* @param data to be constructed
|
|
8
|
+
* @default {@link defaultConstruct}
|
|
9
|
+
*/
|
|
10
|
+
construct?: (data: any) => T;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Check if an object is not an array or a date
|
|
14
|
+
* @param obj
|
|
15
|
+
* @param additionalMappers
|
|
16
|
+
*/
|
|
17
|
+
export declare function isObject(obj: any, additionalMappers?: PrimitiveReviverMapper[]): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Return a new reference of the given object
|
|
20
|
+
* @param obj
|
|
21
|
+
* @param additionalMappers
|
|
22
|
+
*/
|
|
23
|
+
export declare function immutablePrimitive(obj: any, additionalMappers?: PrimitiveReviverMapper[]): any;
|
|
24
|
+
/**
|
|
25
|
+
* Deep fill of base object using source
|
|
26
|
+
* It will do a deep merge of the objects, overriding arrays
|
|
27
|
+
* All properties not present in source, but present in base, will remain
|
|
28
|
+
* @param base
|
|
29
|
+
* @param source
|
|
30
|
+
* @param additionalMappers Map of conditions of type mapper
|
|
31
|
+
*/
|
|
32
|
+
export declare function deepFill<T extends {
|
|
33
|
+
[x: string]: any;
|
|
34
|
+
}>(base: T, source?: {
|
|
35
|
+
[x: string]: any;
|
|
36
|
+
}, additionalMappers?: PrimitiveReviverMapper[]): T;
|
|
37
|
+
//# sourceMappingURL=deep-fill.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deep-fill.d.ts","sourceRoot":"","sources":["../../../src/utils/deep-fill/deep-fill.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,MAAM,WAAW,sBAAsB,CAAC,CAAC,GAAG,GAAG;IAC7C,4CAA4C;IAC5C,SAAS,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC;IAElC;;;;OAIG;IACH,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,CAAC,CAAC;CAC9B;AAMD;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,GAAG,EAAE,iBAAiB,CAAC,EAAE,sBAAsB,EAAE,WAE9E;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,GAAG,EAAE,iBAAiB,CAAC,EAAE,sBAAsB,EAAE,OAiBxF;AAED;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,CAAC,EAAE;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,EAAE,iBAAiB,CAAC,EAAE,sBAAsB,EAAE,GAAG,CAAC,CA0BhJ"}
|