UNPKG

@o3r/core

Version:
1 lines • 53.7 kB
{"version":3,"file":"o3r-core.mjs","sources":["../../src/core/application/build-properties.ts","../../src/core/metadata/component-decorator.ts","../../src/core/metadata/component-identifier.ts","../../src/messages/message-interfaces.ts","../../src/messages/message-helpers.ts","../../src/store/async/async.adapter.ts","../../src/store/async/async-entity.adapter.ts","../../src/store/async/async.helpers.ts","../../src/store/async/async.operators.ts","../../src/store/async/async.props.ts","../../src/store/async/async.serializer.ts","../../src/store/types.ts","../../src/utils/debug/debug-helper.ts","../../src/utils/deep-fill/deep-fill.ts","../../src/utils/rendering/rendering-helpers.ts","../../src/o3r-core.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention -- exception for `BuildTimeProperties` */\n\n/**\n * Library build time properties\n */\nexport interface BuildTimeProperties {\n /**\n * True if the application in launch in debug mode\n */\n DEBUG_MODE: boolean;\n\n /**\n * True if the webStorage option is enabled\n */\n ENABLE_WEBSTORAGE: boolean;\n\n /**\n * Name of the current environment\n */\n ENVIRONMENT: string;\n\n /**\n * Boolean that can be used to activate API calls mocks for development or mock-up purpose.\n */\n USE_MOCKS: boolean;\n\n /**\n * Maximum size of the dev tool history\n */\n DEVTOOL_HISTORY_SIZE: number | undefined;\n\n /**\n * path to bundles in published folder\n */\n LOCALIZATION_BUNDLES_OUTPUT: string;\n\n /**\n * The name of the bundle generated with the default localization components keys\n */\n DEFAULT_LOC_BUNDLE_NAME: string;\n\n /**\n * Indicates the default server prefix to be used in case no dynamic is found\n */\n APP_BASE_HREF: string | undefined;\n\n /**\n * Version of the App based on the package.json\n */\n APP_VERSION: string;\n\n /**\n * Determine if the ghosting is activated on the app\n */\n ENABLE_GHOSTING: boolean;\n}\n\n/**\n * Library build time default properties\n */\nexport const DEFAULT_BUILD_PROPERTIES: Readonly<BuildTimeProperties> = {\n DEBUG_MODE: true,\n APP_BASE_HREF: '.',\n APP_VERSION: '0.0.0',\n DEFAULT_LOC_BUNDLE_NAME: '',\n DEVTOOL_HISTORY_SIZE: 20,\n ENABLE_GHOSTING: false,\n ENABLE_WEBSTORAGE: true,\n ENVIRONMENT: 'dev',\n LOCALIZATION_BUNDLES_OUTPUT: 'localizations/',\n USE_MOCKS: false\n} as const;\n","import type {\n Translation,\n} from '../interfaces';\n\n/** Type of component */\nexport type ComponentType = 'Block' | 'Page' | 'ExposedComponent' | 'Component';\n\n/**\n * Information about an Otter component to provide\n */\nexport interface OtterComponentInfoToProvide {\n /** Type of component */\n componentType: ComponentType;\n}\n\n/**\n * Information about an Otter component\n */\nexport interface OtterComponentInfo extends OtterComponentInfoToProvide {\n /** Configuration ID */\n configId?: string;\n /** Translation keys */\n translations?: Translation;\n /** Component Name */\n componentName: string;\n}\n\n/**\n * Private field where Otter component information are stored\n */\nexport const otterComponentInfoPropertyName = '__otter-info__';\n\n/**\n * Decorates an Angular component to provide Otter information\n * @param info Information to define the Otter component\n * @returns the component with the information\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention -- decorator should be PascalCase\nexport function O3rComponent(info: OtterComponentInfoToProvide) {\n return <T extends new (...args: any[]) => object>(constructor: T) => {\n const componentName = constructor.name;\n constructor.prototype[otterComponentInfoPropertyName] = { ...info, componentName };\n return constructor;\n };\n}\n","/**\n * Compute the name of the component with the library's name to generate unique component identifier used in metadata and different modules\n * @param componentName Name of the component to get the configuration\n * @param libraryName Name of the library the component is coming from\n */\nexport function computeItemIdentifier<C extends string, L extends string>(componentName: C, libraryName?: L): `${L extends string ? `${L}#` : ''}${C}` {\n return (libraryName ? libraryName + '#' : '') + componentName as `${L extends string ? `${L}#` : ''}${C}`;\n}\n","/** Type of a message exchanged within the Otter Framework */\nexport const otterMessageType = 'otter';\n\n/** Target of a message that should be handled by the application */\nexport const applicationMessageTarget = 'app';\n\nexport interface OtterMessageContent<DataType extends string = string> {\n /** Type of data */\n dataType: DataType;\n}\n\nexport interface OtterMessage<Content extends OtterMessageContent = OtterMessageContent, Target extends string | undefined = undefined | string> {\n /** Type of the message */\n type: typeof otterMessageType;\n\n /** Version of the message (default to the @o3r/core version ) */\n version?: string;\n\n /** Target of the message */\n to: Target;\n\n /** Message content */\n content: Content;\n}\n\n/** Type helper to retrieve the data types of a union of MessageContent */\nexport type MessageDataTypes<T extends OtterMessageContent> = T['dataType'];\n\n/** Type helper to filter the message that can be received by the application */\nexport type FilterMessageToApplication<T extends OtterMessage> = T extends { to: infer U } ? U extends (typeof applicationMessageTarget | undefined) ? T : never : never;\n\nexport type ContentMessageData<T extends OtterMessageContent> = T extends any\n ? Omit<T, 'dataType'>\n : never;\n","import {\n filter,\n map,\n Observable,\n} from 'rxjs';\nimport {\n applicationMessageTarget,\n ContentMessageData,\n FilterMessageToApplication,\n OtterMessage,\n OtterMessageContent,\n otterMessageType,\n} from './message-interfaces';\n\n/**\n * Determine if a message should be handle by the application\n * @param message Message to analyze\n */\nexport const isToAppOtterMessage = <T extends OtterMessage>(message?: T): message is FilterMessageToApplication<T & { to: 'app' }> => {\n return message?.to === applicationMessageTarget;\n};\n\n/**\n * Determine if a message is emitted by an Otter tool\n * @param message Message to analyze\n */\nexport const isOtterMessage = <T extends OtterMessageContent>(message: any): message is OtterMessage<T> => {\n return message?.type === otterMessageType;\n};\n\n/**\n * Send an Otter Message\n * @param dataType Type of the message\n * @param content content of the message\n * @param preStringify determine if the message should JSON.stringify before being send (will use the default mechanism otherwise)\n */\nexport const sendOtterMessage = <T extends OtterMessageContent>(dataType: T['dataType'], content: ContentMessageData<T>, preStringify = true) => {\n const message = {\n type: otterMessageType,\n content: {\n ...content,\n dataType\n }\n };\n return window.postMessage(preStringify ? JSON.stringify(message) : message, '*');\n};\n\nexport function filterMessageContent<T extends Event | MessageEvent>(): (source$: Observable<T>) => Observable<OtterMessageContent<string>>;\nexport function filterMessageContent<T extends Event | MessageEvent, S extends OtterMessageContent>(predicate: (message: any) => message is S): (source$: Observable<T>) => Observable<S>;\n/**\n * Filter the Otter message that should be handle by the application and returns it content\n * @param predicate condition to filter the message\n * @returns content of the message\n */\n\n/**\n * Operator to get only Otter messages that match the predicate\n * @param predicate\n */\nexport function filterMessageContent<T extends Event | MessageEvent, S extends OtterMessageContent>(predicate?: (message: any) => message is S):\n(source$: Observable<T>) => Observable<OtterMessageContent<string> | S> {\n return (source$: Observable<T>) => {\n const obs = source$.pipe(\n map((event) => {\n const data = (event as MessageEvent).data;\n return typeof data === 'string' ? JSON.parse(data) : data;\n }),\n filter(isOtterMessage),\n filter(isToAppOtterMessage),\n map((message) => message.content)\n );\n if (predicate) {\n return obs.pipe(filter(predicate));\n }\n return obs;\n };\n}\n","import {\n AsyncStoreItem,\n EntityStatus,\n RequestId,\n} from './async.interfaces';\n\n/**\n * Adapter to help manipulate AsyncStoreItems to register new request and update the status when they fail or resolve.\n */\nexport interface AsyncStoreItemAdapter {\n /**\n * Adds a request to an AsyncStoreItem.\n * If the item had a failure and no ongoing requests, sets it's failure status back to false\n * @param item\n * @param requestId\n */\n addRequest<T extends AsyncStoreItem>(item: T, requestId: string): T;\n\n /**\n * Updates an AsyncStoreItem when a request has resolved.\n * Removes it from its requestIds array.\n * If no requestId provided, the method returns the current status of the AsyncStoreItem\n * @param item\n * @param requestId\n */\n resolveRequest<T extends AsyncStoreItem>(item: T, requestId?: string): T;\n\n /**\n * Updates an AsyncStoreItem when a request has failed.\n * Removes it from its requestIds array and set its failure status.\n * @param item\n * @param requestId\n */\n failRequest<T extends AsyncStoreItem>(item: T, requestId?: string): T;\n\n /**\n * Add AsyncStoreItem properties (with initial values) to the given entity\n * @param entityItem\n * @returns Given item improved with AsyncStoreItem properties\n */\n initialize<T extends object>(entityItem: T): T & AsyncStoreItem;\n\n /**\n * Extract only AsyncStoreItem properties from the given entity\n * @param entityItem A model containing AsyncStoreItem properties\n * @returns Object containing only AsyncStoreItem properties\n */\n extractAsyncStoreItem<T extends AsyncStoreItem>(entityItem: T): AsyncStoreItem;\n\n /**\n * Clear AsyncStoreItem properties from the given entity\n * @param entityItem A model containing AsyncStoreItem properties\n */\n clearAsyncStoreItem<T extends AsyncStoreItem>(entityItem: T): T;\n\n /**\n * Merges an AsyncStoreItem collection into one item that gives an overall status.\n * @param items\n */\n merge(...items: (AsyncStoreItem | undefined)[]): AsyncStoreItem;\n\n /**\n * Add a request to the given subResource of an EntityStatus object\n * @param status\n * @param subResource\n * @param requestId\n */\n entityStatusAddRequest<T extends EntityStatus<T>>(status: T, subResource: keyof T, requestId: string): T;\n\n /**\n * Resolve a request on the given subResource of an EntityStatus object\n * @param status\n * @param subResource\n * @param requestId\n */\n entityStatusResolveRequest<T extends EntityStatus<T>>(status: T, subResource: keyof T, requestId?: string): T;\n\n /**\n * Fail a request to the given subResource of an EntityStatus object\n * @param status\n * @param subResource\n * @param requestId\n */\n entityStatusFailRequest<T extends EntityStatus<T>>(status: T, subResource: keyof T, requestId?: string): T;\n\n /**\n * Reset the failure status of the given subResource of an EntityStatus object\n * @param status\n * @param subResource\n */\n entityStatusResetFailure<T extends EntityStatus<T>>(status: T, subResource: keyof T): T;\n\n /**\n * Reset the failure status of the given AsyncStoreItem to false\n * @param entityItem\n * @returns AsyncStoreItem with the updated failure status\n */\n resetFailureStatus<T extends AsyncStoreItem>(entityItem: T): T;\n\n /**\n * Set the pending status of the given AsyncStoreItem to true\n * @param entityItem\n * @returns AsyncStoreItem with the updated pending status\n */\n setLoadingStatus<T extends AsyncStoreItem>(entityItem: T): T;\n}\n\nexport const asyncStoreItemAdapter: AsyncStoreItemAdapter = {\n addRequest: (item, requestId) => {\n return {\n ...item,\n requestIds: [...item.requestIds, requestId],\n isFailure: item.requestIds.length === 0 ? false : item.isFailure,\n isPending: true\n };\n },\n\n failRequest: (item, requestId) => {\n const requestIds = requestId ? item.requestIds.filter((id) => id !== requestId) : item.requestIds;\n return {\n ...item,\n isFailure: true,\n isPending: requestIds.length > 0,\n requestIds\n };\n },\n\n resolveRequest: (item, requestId) => {\n const requestIds = requestId ? item.requestIds.filter((id) => id !== requestId) : item.requestIds;\n return {\n ...item,\n requestIds,\n isPending: requestIds.length > 0\n };\n },\n\n initialize: (entityItem) => {\n return {\n ...entityItem,\n requestIds: [] as RequestId[]\n };\n },\n\n extractAsyncStoreItem: (entityItem) => {\n return {\n requestIds: [...entityItem.requestIds],\n isFailure: entityItem.isFailure,\n isPending: entityItem.isPending\n };\n },\n\n clearAsyncStoreItem: <T extends AsyncStoreItem>(entityItem: T) => {\n const { isPending, isFailure, ...newResponse }: T = { ...entityItem, requestIds: [] };\n return newResponse as T;\n },\n\n merge: (...items) => {\n return items.reduce<AsyncStoreItem>((mergedItem, item) => item\n ? {\n requestIds: [...mergedItem.requestIds, ...item.requestIds],\n isFailure: mergedItem.isFailure || item.isFailure,\n isPending: mergedItem.isPending || item.isPending\n }\n : mergedItem, asyncStoreItemAdapter.initialize({}));\n },\n\n entityStatusAddRequest: (status, subResource, requestId) => {\n const currentSubStatus: AsyncStoreItem = status[subResource] || asyncStoreItemAdapter.initialize({});\n return {\n ...status,\n [subResource]: asyncStoreItemAdapter.addRequest(currentSubStatus, requestId)\n };\n },\n\n entityStatusResolveRequest: (status, subResource, requestId) => {\n const currentSubStatus = status[subResource];\n return {\n ...status,\n [subResource]: currentSubStatus ? asyncStoreItemAdapter.resolveRequest(currentSubStatus, requestId) : { requestIds: [] as RequestId[] }\n };\n },\n\n entityStatusFailRequest: (status, subResource, requestId) => {\n const currentSubStatus = status[subResource];\n return {\n ...status,\n [subResource]: currentSubStatus ? asyncStoreItemAdapter.failRequest(currentSubStatus, requestId) : { requestIds: [] as RequestId[], isFailure: true }\n };\n },\n\n entityStatusResetFailure: (status, subResource) => {\n const currentSubStatus = status[subResource];\n return {\n ...status,\n [subResource]: currentSubStatus ? asyncStoreItemAdapter.resetFailureStatus(currentSubStatus) : { requestIds: [] as RequestId[] }\n };\n },\n\n resetFailureStatus: (entityItem) => {\n return {\n ...entityItem,\n isFailure: false\n };\n },\n\n setLoadingStatus: (entityItem) => {\n return {\n ...entityItem,\n isPending: true\n };\n }\n};\n","import type {\n EntityAdapter,\n EntityState,\n Update,\n} from '@ngrx/entity';\nimport {\n asyncStoreItemAdapter,\n} from './async.adapter';\nimport {\n AsyncStoreItem,\n EntityWithoutAsyncStoreItem,\n} from './async.interfaces';\n\n/** Adapter for Asynchronous Entity Store */\nexport interface EntityAsyncRequestAdapter<T extends AsyncStoreItem> extends EntityAdapter<T> {\n\n /**\n * Updates the AsyncStoreItem properties of each entity matching an id from the list of given ids, when a request has failed.\n * @param state Actual state\n * @param ids Ids of the entity to be updated with AsyncStoreItem properties\n * @param requestId Id of request which has failed\n */\n failRequestMany<V extends EntityState<T> & AsyncStoreItem>(state: V, ids?: (string | number)[], requestId?: string): V;\n\n /**\n * Adds AsyncStoreItem property to the global store, or the entity if it already exists, when a request is triggered.\n * @param state Actual state\n * @param id Id of the entity to update\n * @param requestId Id of the request which is triggered\n */\n addRequestOne<V extends EntityState<T> & AsyncStoreItem>(state: V, id: string | number | null | undefined, requestId: string): V;\n\n /**\n * Adds AsyncStoreItem properties for each entity matching the given ids, when a request is triggered\n * @param state Actual state\n * @param ids Ids of the entity to be updated with AsyncStoreItem properties\n * @param requestId Id of request which is triggered\n */\n addRequestMany<V extends EntityState<T>>(state: V, ids: (string | number)[], requestId: string): V;\n\n /**\n * Updates the state with the given entity. Update the global or the current entity's status if it exists.\n * @param state Actual state\n * @param entity Payload item;\n * @param requestId Id of request which has resolved if any\n */\n resolveRequestOne<V extends EntityState<T> & AsyncStoreItem>(state: V, entity: EntityWithoutAsyncStoreItem<T> & Record<'id', string | number>, requestId?: string): V;\n\n /**\n * Updates the state with the given entity. Update the global or the current entity's status if it exists.\n * @param state Actual state\n * @param entity Payload item;\n * @param requestId Id of request which has resolved if any\n * @param idProperty Property of the entity containing its unique identifier\n */\n resolveRequestOne<V extends EntityState<T> & AsyncStoreItem, W extends keyof T>(state: V, entity: EntityWithoutAsyncStoreItem<T> & Record<W, string | number>, requestId?: string, idProperty?: W): V;\n\n /**\n * Updates the state with the given entities. Updates also AsyncStoreItem properties of each entity, when a request is resolved.\n * @param state Actual state\n * @param entities Payload items;\n * @param requestId Id of request which has resolved if any\n */\n resolveRequestMany<V extends EntityState<T>>(state: V, entities: (Partial<T> & Record<'id', string | number>)[], requestId?: string): V;\n\n /**\n * Updates the state with the given entities. Updates also AsyncStoreItem properties of each entity, when a request is resolved.\n * @param state Actual state\n * @param entities Payload items;\n * @param requestId Id of request which has resolved if any\n * @param idProperty Property of the entity containing its unique identifier\n */\n resolveRequestMany<V extends EntityState<T>, W extends keyof T>(state: V, entities: (Partial<T> & Record<W, string | number>)[], requestId?: string, idProperty?: W): V;\n}\n\n/**\n * Create an Asynchronous Request Entity Adapter\n * @param adapter Entity Adapter\n */\nexport function createEntityAsyncRequestAdapter<T extends AsyncStoreItem>(adapter: EntityAdapter<T>): EntityAsyncRequestAdapter<T> {\n const addRequestOne: <V extends EntityState<T> & AsyncStoreItem>(state: V, id: string | number | null | undefined, requestId: string) => V = (state, id, requestId) => {\n const currentEntity = typeof id !== 'undefined' && id !== null && state.entities[id];\n if (currentEntity) {\n const changes = asyncStoreItemAdapter.addRequest(asyncStoreItemAdapter.extractAsyncStoreItem(currentEntity), requestId);\n return adapter.updateOne({ id, changes } as Update<T>, state);\n }\n return asyncStoreItemAdapter.addRequest(state, requestId);\n };\n\n const addRequestMany: <V extends EntityState<T>>(state: V, ids: (string | number)[], requestId: string) => V = <V extends EntityState<T>>(state: V, ids: (string | number)[], requestId: string): V =>\n adapter.updateMany(ids.filter((id) => !!state.entities[id]).map((id) => ({\n id,\n changes: asyncStoreItemAdapter.addRequest(asyncStoreItemAdapter.extractAsyncStoreItem(state.entities[id]!), requestId)\n } as Update<T>)\n ), state);\n\n const resolveRequestOne: <V extends EntityState<T> & AsyncStoreItem, W extends keyof T | 'id' = 'id'>\n (state: V, entity: EntityWithoutAsyncStoreItem<T> & Record<W, string | number>, requestId?: string, idProperty?: W) => V = <V extends EntityState<T> & AsyncStoreItem, W extends keyof T | 'id'>\n (state: V, entity: EntityWithoutAsyncStoreItem<T> & Record<W, string | number>, requestId?: string, idProperty: W = 'id' as W): V => {\n const currentEntity = state.entities[entity[idProperty]];\n const newEntity = currentEntity\n ? asyncStoreItemAdapter.resolveRequest({ ...entity, ...asyncStoreItemAdapter.extractAsyncStoreItem(currentEntity) }, requestId)\n : asyncStoreItemAdapter.initialize(entity);\n state = asyncStoreItemAdapter.resolveRequest(state, requestId);\n return adapter.upsertOne(newEntity as T, state);\n };\n\n const resolveRequestMany: <V extends EntityState<T>, W extends keyof T | 'id' = 'id'>\n (state: V, entities: (Partial<T> & Record<W, string | number>)[], requestId?: string, idProperty?: W) => V = <V extends EntityState<T>, W extends keyof T | 'id'>\n (state: V, entities: (Partial<T> & Record<W, string | number>)[], requestId?: string, idProperty: W = 'id' as W): V =>\n adapter.updateMany(\n entities.filter((entity) => !!state.entities[entity[idProperty]]).map((entity) => {\n const model = { ...entity, ...asyncStoreItemAdapter.extractAsyncStoreItem(state.entities[entity[idProperty]]!) };\n return { id: entity[idProperty], changes: asyncStoreItemAdapter.resolveRequest(model, requestId) } as Update<T>;\n }\n ), state);\n\n const failRequestMany: <V extends EntityState<T> & AsyncStoreItem>\n (state: V, ids?: (string | number)[], requestId?: string) => V = <V extends EntityState<T> & AsyncStoreItem>\n (state: V, ids: (string | number)[] = [], requestId?: string): V => {\n if (ids.length > 0 && !ids.some((id) => state.entities[id] === undefined)) {\n return adapter.updateMany(ids.map((id) => ({\n id,\n changes: asyncStoreItemAdapter.failRequest(asyncStoreItemAdapter.extractAsyncStoreItem(state.entities[id]!), requestId)\n } as Update<T>)\n ), state);\n }\n return asyncStoreItemAdapter.failRequest(state, requestId);\n };\n\n return {\n ...adapter,\n failRequestMany,\n addRequestOne,\n addRequestMany,\n resolveRequestOne,\n resolveRequestMany\n };\n}\n","import {\n AsyncRequest,\n FromApiActionPayload,\n} from './async.interfaces';\n\n/**\n * Determine if the action is an AsyncRequest action\n * @param action Redux Action\n */\nexport function isCallAction<T = any>(action?: any): action is FromApiActionPayload<T> {\n if (!action) {\n return false;\n }\n\n return !!action.call && action.call instanceof Promise;\n}\n\n/**\n * Determine if the action is an AsyncRequest action with a Request ID\n * @param action Redux Action\n */\nexport function isIdentifiedCallAction<T = any>(action?: any): action is FromApiActionPayload<T> & AsyncRequest {\n return isCallAction(action) && typeof action.requestId !== 'undefined';\n}\n\n/**\n * Determine if the given item implements the AsyncRequest interface\n * @param item\n */\nexport function isAsyncRequest<T>(item: any): item is T & AsyncRequest {\n return typeof item.requestId !== 'undefined';\n}\n","import {\n Action,\n} from '@ngrx/store';\nimport {\n BehaviorSubject,\n EMPTY,\n from,\n identity,\n isObservable,\n merge,\n Observable,\n of,\n OperatorFunction,\n Subject,\n} from 'rxjs';\nimport {\n catchError,\n delay,\n filter,\n finalize,\n pairwise,\n startWith,\n switchMap,\n tap,\n} from 'rxjs/operators';\nimport {\n isIdentifiedCallAction,\n} from './async.helpers';\nimport {\n AsyncRequest,\n ExtractFromApiActionPayloadType,\n FromApiActionPayload,\n} from './async.interfaces';\n\n/**\n * Determine if the given parameter is a Promise\n * @param object\n */\nconst isPromise = <U>(object: U | Promise<U>): object is Promise<U> => object && typeof object === 'object' && typeof (object as any).then !== 'undefined';\n\n/**\n * Custom operator to use instead of SwitchMap with effects based on FromApi actions.\n * 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.\n * @param successHandler function that returns the action to emit in case the FromApi call is a success\n * @param errorHandler function that returns the action to emit in case the FromApi call fails\n * @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\n */\nexport function fromApiEffectSwitchMap<T extends FromApiActionPayload<any>, S extends ExtractFromApiActionPayloadType<T>, U extends Action, V extends Action, W extends Action>(\n successHandler: (result: S, action: T) => U | Observable<U> | Promise<U>,\n errorHandler?: (error: any, action: T) => Observable<V>,\n cancelRequestActionFactory?: (props: AsyncRequest, action: T) => W): OperatorFunction<T, U | V | W> {\n const pendingRequestIdsContext: Record<string, boolean> = {};\n\n return (source$) => source$.pipe(\n tap((action) => {\n if (isIdentifiedCallAction(action)) {\n pendingRequestIdsContext[action.requestId] = true;\n }\n }),\n startWith(undefined),\n pairwise(),\n switchMap(([previousAction, action]) => {\n if (!action) {\n return EMPTY;\n }\n const isPreviousActionStillRunning = isIdentifiedCallAction(previousAction) && pendingRequestIdsContext[previousAction.requestId];\n const cleanStack = () => {\n if (isIdentifiedCallAction(action)) {\n delete pendingRequestIdsContext[action.requestId];\n }\n };\n return from(action.call).pipe(\n tap(cleanStack),\n switchMap((result) => {\n const success = successHandler(result, action);\n return isObservable(success) ? success : (isPromise(success) ? success : of(success));\n }),\n catchError((error) => {\n cleanStack();\n return errorHandler?.(error, action) || EMPTY;\n }),\n isPreviousActionStillRunning && cancelRequestActionFactory ? startWith(cancelRequestActionFactory({ requestId: previousAction.requestId }, action)) : identity\n );\n })\n );\n}\n\n/**\n * Same as {@link fromApiEffectSwitchMap}, instead one inner subscription is kept by id.\n * @param successHandler\n * @param errorHandler\n * @param cancelRequestActionFactory\n * @param cleanUpTimer\n */\nexport function fromApiEffectSwitchMapById<T extends FromApiActionPayload<any> & { id: string },\n S extends ExtractFromApiActionPayloadType<T>,\n U extends Action,\n V extends Action,\n W extends Action>(\n successHandler: (result: S, action: T) => U | Observable<U> | Promise<U>,\n errorHandler?: (error: any, action: T) => Observable<V>,\n cancelRequestActionFactory?: (props: AsyncRequest, action: T) => W,\n cleanUpTimer?: number\n): OperatorFunction<T, U | V | W> {\n const innerSourcesById: Record<string, [Subject<any>, Observable<any>]> = {};\n return (source$: Observable<T>) => {\n return source$.pipe(\n filter((action: T) => {\n if (!isIdentifiedCallAction(action) || !action.id) {\n return false;\n }\n if (isIdentifiedCallAction(action) && innerSourcesById[action.id]) {\n innerSourcesById[action.id][0].next(action);\n return false;\n }\n return true;\n }),\n switchMap((action: T) => {\n const newIdSubject = new BehaviorSubject(action);\n const newId$ = newIdSubject.pipe(\n fromApiEffectSwitchMap(\n successHandler,\n errorHandler,\n cancelRequestActionFactory\n )\n );\n innerSourcesById[action.id] = [newIdSubject, newId$];\n if (cleanUpTimer !== undefined) {\n newIdSubject.pipe(\n switchMap((myAction) => from(myAction.call).pipe(\n delay(cleanUpTimer),\n finalize(() => {\n delete innerSourcesById[myAction.id];\n newIdSubject.complete();\n })\n ))\n ).subscribe();\n }\n const streams = Object.values(innerSourcesById).map(([_, obs]) => obs);\n return merge(...streams);\n })\n );\n };\n}\n","import {\n v4,\n} from 'uuid';\nimport {\n isAsyncRequest,\n} from './async.helpers';\nimport {\n AsyncRequest,\n} from './async.interfaces';\n\n/**\n * Returns a creator that makes sure that requestId is defined in the action's properties by generating one\n * if needed.\n */\nexport const asyncProps = <P extends object>(): (props: P) => P & AsyncRequest => {\n return (props: P) => isAsyncRequest(props) ? props : { ...props, requestId: v4() };\n};\n","import type {\n EntityState,\n} from '@ngrx/entity';\nimport {\n asyncStoreItemAdapter,\n} from './async.adapter';\nimport {\n AsyncStoreItem,\n EntityStatus,\n} from './async.interfaces';\n\n/**\n * Serializer for asynchronous store.\n * @param state State of an asynchronous store to serialize\n * @returns a plain json object to pass to json.stringify\n */\nexport function asyncSerializer<T extends AsyncStoreItem>(state: T) {\n return asyncStoreItemAdapter.clearAsyncStoreItem(state);\n}\n\n/**\n * Serializer for asynchronous entity store.\n * @param state State of an asynchronous entity store to serialize\n * @returns a plain json object to pass to json.stringify\n */\nexport function asyncEntitySerializer<T extends AsyncStoreItem & EntityState<AsyncStoreItem>>(state: T) {\n const entities = (state.ids as string[]).reduce((entitiesAcc, entityId) => {\n entitiesAcc[entityId] = asyncStoreItemAdapter.clearAsyncStoreItem(state.entities[entityId]!);\n return entitiesAcc;\n }, {} as typeof state.entities);\n\n return { ...asyncStoreItemAdapter.clearAsyncStoreItem(state), entities };\n}\n\n/**\n * Serializer for asynchronous entity store with status.\n * @param state State of an asynchronous entity store with status to serialize\n * @returns a plain json object to pass to json.stringify\n */\nexport function asyncEntityWithStatusSerializer<T extends AsyncStoreItem & EntityState<AsyncStoreItem & { status: EntityStatus<T['entities']['status']> }>>(state: T) {\n const entities = (state.ids as string[]).reduce((entitiesAcc, entityId) => {\n entitiesAcc[entityId] = { ...asyncStoreItemAdapter.clearAsyncStoreItem(state.entities[entityId]!), status: {} };\n return entitiesAcc;\n }, {} as typeof state.entities);\n\n return { ...asyncStoreItemAdapter.clearAsyncStoreItem(state), entities };\n}\n","/**\n * Object that define how to serialize a specific state\n */\nexport interface Serializer<T> {\n serialize?: (obj: T) => any;\n deserialize?: (data?: any) => T;\n reviver?: (key: string, value: any) => any;\n replacer?: (key: string, value: any) => any;\n initialState?: T;\n}\n\nexport class StateSerializer<T> implements Serializer<T> {\n public serialize?: (obj: T) => any;\n public deserialize?: (data?: any) => T;\n public replacer?: (key: string, value: any) => any;\n public initialState?: T;\n\n constructor(serializer: Serializer<T>) {\n this.serialize = serializer.serialize || this.serialize;\n this.deserialize = serializer.deserialize || this.deserialize;\n this.reviver = serializer.reviver || this.reviver;\n this.replacer = serializer.replacer || this.replacer;\n this.initialState = serializer.initialState || this.initialState;\n }\n\n public reviver = (_: string, value: any): any => value;\n}\n\nexport interface LocalStateModel {\n /**\n * Temporary ID of the model in the dictionary\n */\n tid: string;\n}\n\n/**\n * Adds an `id` to the given type\n */\nexport type Idfy<T> = T & { id: string | number };\n\n/**\n * Payload to update actions\n */\nexport interface UpdateActionPayload<T> {\n stateDetails: Partial<T>;\n}\n\n/**\n * Payload to set actions\n */\nexport interface SetActionPayload<T> {\n stateDetails: T;\n}\n\n/**\n * Payload to set state actions\n */\nexport interface SetStateActionPayload<T> {\n state: T;\n}\n/**\n * Payload to fail actions\n */\nexport interface FailActionPayload<T> {\n error?: T;\n}\n\nexport type Keep<T, K extends keyof T> = Partial<T> & Pick<T, K>;\n\n/** Payload to update entities actions */\nexport interface UpdateEntitiesActionPayload<T, K extends keyof T> {\n entities: Keep<T, K>[];\n}\n\n/** Payload to update entities actions with a field ID */\nexport interface UpdateEntitiesActionPayloadWithId<T extends { id: string | number }> {\n entities: Keep<T, 'id'>[];\n}\n\n/** Payload to update entities actions */\nexport interface UpdateEntityActionPayload<T, K extends keyof T> {\n entity: Keep<T, K>;\n}\n\n/** Payload to update entities actions with a field ID */\nexport interface UpdateEntityActionPayloadWithId<T extends { id: string | number }> {\n entity: Keep<T, 'id'>;\n}\n\n/** Payload to set entities and upsert entities actions */\nexport interface SetEntitiesActionPayload<T> {\n entities: T[];\n}\n\n/** Payload to set entity and upsert entity actions */\nexport interface SetEntityActionPayload<T> {\n entity: T;\n}\n\n/** Payload to fail entities actions */\nexport interface FailEntitiesActionPayload<T> extends FailActionPayload<T> {\n ids?: (string | number)[];\n}\n\n/**\n * Payload to clear the store in case of failure\n */\nexport interface ClearOnFailurePayload {\n /** Clear store on failure */\n clearOnFailure?: boolean;\n}\n","import type {\n BootstrapConfig,\n Dataset,\n} from '../../core/application/dgp-interfaces';\n\n/**\n * Pad number\n * @param val\n * @param digits\n */\nexport function padNumber(val: number, digits = 2): string {\n const str = `${val}`;\n return '0'.repeat(Math.max(0, digits - str.length)) + str;\n}\n\n/**\n * Returns TRUE if bootstrap config environment is production FALSE otherwise\n * @param dataset\n * @returns TRUE if bootstrap config environment is production FALSE otherwise\n */\nexport function isProductionEnvironment(dataset: Dataset): boolean {\n const bootstrapConfig: BootstrapConfig = dataset.bootstrapconfig && JSON.parse(dataset.bootstrapconfig);\n return bootstrapConfig?.environment === 'prod';\n}\n","/** Reviver Mapper to detect and create object on deepFill */\nexport interface PrimitiveReviverMapper<T = any> {\n /** Condition to fill to be determine as */\n condition: (data: any) => boolean;\n\n /**\n * Construct the primitive type if needed\n * @param data to be constructed\n * @default {@see defaultConstruct}\n */\n construct?: (data: any) => T;\n}\n\nconst defaultConstruct = (data: any) => data;\n\nconst isDate = (data: any) => data instanceof Date && !Number.isNaN(data as any);\n\n/**\n * Check if an object is not an array or a date\n * @param obj\n * @param additionalMappers\n */\nexport function isObject(obj: any, additionalMappers?: PrimitiveReviverMapper[]) {\n return obj instanceof Object && !Array.isArray(obj) && !additionalMappers?.some((mapper) => mapper.condition(obj)) && !isDate(obj);\n}\n\n/**\n * Return a new reference of the given object\n * @param obj\n * @param additionalMappers\n */\nexport function immutablePrimitive(obj: any, additionalMappers?: PrimitiveReviverMapper[]) {\n if (Array.isArray(obj)) {\n return obj.slice();\n }\n\n const matchingPrimitive = additionalMappers?.find((mapper) => mapper.condition(obj));\n const resolvedType = matchingPrimitive && ((matchingPrimitive.construct || defaultConstruct)(obj));\n if (resolvedType !== undefined) {\n return resolvedType;\n }\n if (isDate(obj)) {\n return new Date(obj);\n } else if (obj instanceof Object) {\n return deepFill(obj, obj, additionalMappers);\n } else {\n return obj;\n }\n}\n\n/**\n * Deep fill of base object using source\n * It will do a deep merge of the objects, overriding arrays\n * All properties not present in source, but present in base, will remain\n * @param base\n * @param source\n * @param additionalMappers Map of conditions of type mapper\n */\nexport function deepFill<T extends { [x: string]: any }>(base: T, source?: { [x: string]: any }, additionalMappers?: PrimitiveReviverMapper[]): T {\n if (typeof source === 'undefined') {\n return deepFill(base, base, additionalMappers);\n }\n if (!isObject(base, additionalMappers)) {\n return immutablePrimitive(typeof source === 'undefined' ? base : source, additionalMappers);\n }\n const newObj = { ...base };\n for (const key in base) {\n if (source[key] === null) {\n newObj[key] = immutablePrimitive(null, additionalMappers);\n } else if (key in source && typeof base[key] === typeof source[key]) {\n const keyOfSource = source[key];\n newObj[key] = typeof keyOfSource === 'undefined' ? immutablePrimitive(base[key], additionalMappers) : deepFill(base[key], keyOfSource, additionalMappers);\n } else {\n newObj[key] = immutablePrimitive(base[key], additionalMappers);\n }\n }\n\n // getting keys present in source and not present in base\n for (const key in source) {\n if (!(key in newObj)) {\n newObj[key as keyof T] = immutablePrimitive(source[key], additionalMappers);\n }\n }\n return newObj;\n}\n","import {\n animationFrameScheduler,\n from,\n Observable,\n observeOn,\n of,\n} from 'rxjs';\nimport {\n bufferCount,\n concatMap,\n delay,\n mergeMap,\n scan,\n tap,\n} from 'rxjs/operators';\n\n/**\n * Buffers and emits data for lazy/progressive rendering of big lists\n * That could solve issues with long-running tasks when trying to render an array\n * of similar components.\n * @param delayMs Delay between data emits\n * @param concurrency Amount of elements that should be emitted at once\n */\nexport function lazyArray<T>(delayMs = 0, concurrency = 2) {\n let isFirstEmission = true;\n return (source$: Observable<T[]>) => {\n return source$.pipe(\n mergeMap((items) => {\n if (!isFirstEmission) {\n return of(items);\n }\n\n const items$ = from(items);\n\n return items$.pipe(\n bufferCount(concurrency),\n concatMap((value, index) => {\n return of(value).pipe(\n observeOn(animationFrameScheduler),\n delay(index * delayMs)\n );\n }),\n scan((acc: T[], steps: T[]) => {\n return [...acc, ...steps];\n }, []),\n tap((scannedItems: T[]) => {\n const scanDidComplete = scannedItems.length === items.length;\n\n if (scanDidComplete) {\n isFirstEmission = false;\n }\n })\n );\n })\n );\n };\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["filter"],"mappings":";;;;AAAA;AAyDA;;AAEG;AACI,MAAM,wBAAwB,GAAkC;AACrE,IAAA,UAAU,EAAE,IAAI;AAChB,IAAA,aAAa,EAAE,GAAG;AAClB,IAAA,WAAW,EAAE,OAAO;AACpB,IAAA,uBAAuB,EAAE,EAAE;AAC3B,IAAA,oBAAoB,EAAE,EAAE;AACxB,IAAA,eAAe,EAAE,KAAK;AACtB,IAAA,iBAAiB,EAAE,IAAI;AACvB,IAAA,WAAW,EAAE,KAAK;AAClB,IAAA,2BAA2B,EAAE,gBAAgB;AAC7C,IAAA,SAAS,EAAE;;;AC3Cb;;AAEG;AACI,MAAM,8BAA8B,GAAG;AAE9C;;;;AAIG;AACH;AACM,SAAU,YAAY,CAAC,IAAiC,EAAA;IAC5D,OAAO,CAA2C,WAAc,KAAI;AAClE,QAAA,MAAM,aAAa,GAAG,WAAW,CAAC,IAAI;AACtC,QAAA,WAAW,CAAC,SAAS,CAAC,8BAA8B,CAAC,GAAG,EAAE,GAAG,IAAI,EAAE,aAAa,EAAE;AAClF,QAAA,OAAO,WAAW;AACpB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