{"version":3,"file":"daffodil-core-state.mjs","sources":["../../../libs/core/state/src/collection/adapter.class.ts","../../../libs/core/state/src/collection/initial-state.ts","../../../libs/core/state/src/collection/selector-factory.ts","../../../libs/core/state/src/collection/facade.ts","../../../libs/core/state/src/errors/transform-error-to-state-error.ts","../../../libs/core/state/src/operation/adapter.ts","../../../libs/core/state/src/operation/state.ts","../../../libs/core/state/src/states/helpers.ts","../../../libs/core/state/src/operation/selectors.ts","../../../libs/core/state/src/operation/entity/selectors.ts","../../../libs/core/state/src/operation/entity/adapter.ts","../../../libs/core/state/src/operation/entity/helpers/create-fake-id.ts","../../../libs/core/state/src/operators/substream.pipe.ts","../../../libs/core/state/src/reducers/create-meta.ts","../../../libs/core/state/src/reducers/identity.ts","../../../libs/core/state/src/daffodil-core-state.ts"],"sourcesContent":["import { defaultMemoize } from '@ngrx/store';\n\nimport {\n  daffCollectionBuildMetadataFromRequest,\n  DaffCollectionMetadata,\n  DaffCollectionRequest,\n  DaffFilters,\n} from '@daffodil/core';\n\n/**\n * Provides an abstracted way to manage a collection state.\n */\nexport class DaffCollectionStateAdapter<T extends DaffCollectionMetadata = DaffCollectionMetadata> {\n  /**\n   * Stores a collection request in state.\n   * This is useful when you want to preemptively reduce a request before waiting for a response.\n   */\n  storeRequest(request: DaffCollectionRequest, state: T): T {\n    return {\n      ...state,\n      ...daffCollectionBuildMetadataFromRequest(request),\n    };\n  }\n\n  /**\n   * Sets the page size.\n   */\n  setPageSize(size: number, state: T): T {\n    return {\n      ...state,\n      pageSize: size,\n      currentPage: 1,\n    };\n  }\n\n  /**\n   * Sets the current page.\n   */\n  setCurrentPage(page: number, state: T): T {\n    return {\n      ...state,\n      currentPage: page,\n    };\n  }\n\n  /**\n   * Sets the sorting option and direction.\n   */\n  setSort(option: string, direction: string, state: T): T {\n    return {\n      ...state,\n      appliedSortOption: option,\n      appliedSortDirection: direction,\n    };\n  }\n\n  /**\n   * Sets the collection filters.\n   */\n  setFilters(filters: DaffFilters, state: T): T {\n    return {\n      ...state,\n      currentPage: 1,\n      filters: filters || {},\n    };\n  }\n\n  /**\n   * Set the entire collection metadata at once.\n   */\n  setMetadata(metadata: DaffCollectionMetadata, state: T): T {\n    return {\n      ...state,\n      ids: metadata.ids,\n      count: metadata.count,\n      currentPage: metadata.currentPage,\n      pageSize: metadata.pageSize,\n      sortOptions: metadata.sortOptions,\n      totalPages: metadata.totalPages,\n      appliedSortOption: metadata.appliedSortOption || state.appliedSortOption,\n      appliedSortDirection: metadata.appliedSortDirection || state.appliedSortDirection,\n      filters: metadata.filters || {},\n    };\n  }\n}\n\n/**\n * Create the adapter for the collection state.\n */\nexport const getCollectionStateAdapter: <T extends DaffCollectionMetadata = DaffCollectionMetadata>() => DaffCollectionStateAdapter<T>\n  = defaultMemoize(() => new DaffCollectionStateAdapter()).memoized;\n","import { DaffCollectionMetadata } from '@daffodil/core';\n\nexport const daffCollectionReducerInitialState: DaffCollectionMetadata = {\n  count: 0,\n  appliedSortOption: null,\n  appliedSortDirection: null,\n  currentPage: null,\n  pageSize: null,\n  totalPages: null,\n  sortOptions: {\n    default: null,\n    options: [],\n  },\n  ids: [],\n  filters: {},\n};\n","import {\n  createSelector,\n  MemoizedSelector,\n} from '@ngrx/store';\n\nimport {\n  DaffCollectionMetadata,\n  DaffCollectionRequest,\n  daffComputeAppliedFilters,\n  DaffFilters,\n} from '@daffodil/core';\n\n/**\n * An interface to describe all selectors related to the collection metadata.\n */\nexport interface DaffCollectionMemoizedSelectors<\n  TState,\n  TMetadata extends DaffCollectionMetadata = DaffCollectionMetadata\n> {\n  /**\n   * Selects the metadata for the collection.\n   */\n  selectCollectionMetadata: MemoizedSelector<TState, TMetadata>;\n  /**\n   * Builds a request that matches the current collection.\n   */\n  selectCollectionRequest: MemoizedSelector<TState, DaffCollectionRequest>;\n  /**\n   * Selects the total number of items of the collection.\n   */\n  selectCollectionCount: MemoizedSelector<TState, TMetadata['count']>;\n  /**\n   * Selects the current page of items of the collection.\n   */\n  selectCollectionCurrentPage: MemoizedSelector<TState, TMetadata['currentPage']>;\n  /**\n   * Selects the total number of pages of items that exist in the collection.\n   */\n  selectCollectionTotalPages: MemoizedSelector<TState, TMetadata['totalPages']>;\n  /**\n   * Selects the number of items on each collection.\n   */\n  selectCollectionPageSize: MemoizedSelector<TState, TMetadata['pageSize']>;\n  /**\n   * Selects the sort options that may be applied to the collection.\n   */\n  selectCollectionSortOptions: MemoizedSelector<TState, TMetadata['sortOptions']['options']>;\n  /**\n   * Selects the applied sorting option if one is applied.\n   */\n  selectCollectionAppliedSortOption: MemoizedSelector<TState, TMetadata['appliedSortOption']>;\n  /**\n   * Selects the applied sorting direction if a sorting option is applied.\n   */\n  selectCollectionAppliedSortDirection: MemoizedSelector<TState, TMetadata['appliedSortDirection']>;\n  /**\n   * Selects the applied sorting direction if a sorting option is applied.\n   */\n  selectCollectionIds: MemoizedSelector<TState, TMetadata['ids']>;\n  /**\n   * Selects the filters that may be applied to the collection.\n   */\n  selectCollectionFilters: MemoizedSelector<TState, TMetadata['filters']>;\n  /**\n   * Returns a dict of filters and only their applied options.\n   * Filters with no applied options will be omitted.\n   */\n  selectCollectionAppliedFilters: MemoizedSelector<TState, DaffFilters>;\n}\n\n/**\n * Creates collection selectors.\n *\n * @param selectCollectionState A selector for the particular collection state upon which the returned selectors should operate.\n */\nexport const daffCollectionSelectorFactory = <\n  TState,\n  TMetadata extends DaffCollectionMetadata = DaffCollectionMetadata\n>(\n  selectCollectionState: MemoizedSelector<TState, TMetadata>,\n): DaffCollectionMemoizedSelectors<TState, TMetadata> => {\n\n  const selectCollectionMetadata = createSelector(\n    selectCollectionState,\n    state => state,\n  );\n\n  const selectCollectionRequest = createSelector(\n    selectCollectionMetadata,\n    metadata => ({\n      appliedSortOption: metadata.appliedSortOption,\n      appliedSortDirection: metadata.appliedSortDirection,\n      currentPage: metadata.currentPage,\n      pageSize: metadata.pageSize,\n    }),\n  );\n\n  const selectCollectionCount = createSelector(\n    selectCollectionMetadata,\n    state => state.count,\n  );\n\n  const selectCollectionCurrentPage = createSelector(\n    selectCollectionMetadata,\n    state => state.currentPage,\n  );\n\n  const selectCollectionTotalPages = createSelector(\n    selectCollectionMetadata,\n    state => state.totalPages,\n  );\n\n  const selectCollectionPageSize = createSelector(\n    selectCollectionMetadata,\n    state => state.pageSize,\n  );\n\n  const selectCollectionSortOptions = createSelector(\n    selectCollectionMetadata,\n    state => state.sortOptions.options,\n  );\n\n  const selectCollectionAppliedSortOption = createSelector(\n    selectCollectionMetadata,\n    state => state.appliedSortOption,\n  );\n\n  const selectCollectionAppliedSortDirection = createSelector(\n    selectCollectionMetadata,\n    state => state.appliedSortDirection,\n  );\n\n  const selectCollectionIds = createSelector(\n    selectCollectionMetadata,\n    state => state.ids,\n  );\n\n  const selectCollectionFilters = createSelector(\n    selectCollectionMetadata,\n    state => state.filters,\n  );\n\n  const selectCollectionAppliedFilters = createSelector(\n    selectCollectionFilters,\n    filters => daffComputeAppliedFilters(filters),\n  );\n\n  return {\n    selectCollectionMetadata,\n    selectCollectionRequest,\n    selectCollectionCount,\n    selectCollectionCurrentPage,\n    selectCollectionTotalPages,\n    selectCollectionPageSize,\n    selectCollectionSortOptions,\n    selectCollectionAppliedSortOption,\n    selectCollectionAppliedSortDirection,\n    selectCollectionIds,\n    selectCollectionFilters,\n    selectCollectionAppliedFilters,\n  };\n};\n","import {\n  Store,\n  select,\n  Action,\n} from '@ngrx/store';\nimport { Observable } from 'rxjs';\n\nimport {\n  DaffCollectionMetadata,\n  DaffCollectionRequest,\n  DaffFilters,\n  DaffSortDirectionEnum,\n  DaffSortOption,\n} from '@daffodil/core';\n\nimport { DaffCollectionFacadeInterface } from './facade.interface';\nimport { DaffCollectionMemoizedSelectors } from './selector-factory';\n\n/**\n * An abstract class for a collection facade.\n * It is configurable via its constructor parameters.\n * The particular collection state from which\n * this facade will read is determined by the selectors passed.\n *\n * @inheritdoc\n */\nexport abstract class DaffCollectionFacade<\n  TState,\n  TMetadata extends DaffCollectionMetadata = DaffCollectionMetadata\n> implements DaffCollectionFacadeInterface<TMetadata> {\n  metadata$: Observable<TMetadata>;\n  request$: Observable<DaffCollectionRequest>;\n  count$: Observable<number>;\n  currentPage$: Observable<number>;\n  totalPages$: Observable<number>;\n  pageSize$: Observable<number>;\n  sortOptions$: Observable<DaffSortOption[]>;\n  appliedSortOption$: Observable<string>;\n  appliedSortDirection$: Observable<DaffSortDirectionEnum>;\n  filters$: Observable<DaffFilters>;\n  appliedFilters$: Observable<DaffFilters>;\n\n  constructor(\n    protected store: Store<TState>,\n    selectors: DaffCollectionMemoizedSelectors<TState, TMetadata>,\n  ) {\n    this.metadata$ = this.store.pipe(select(selectors.selectCollectionMetadata));\n    this.request$ = this.store.pipe(select(selectors.selectCollectionRequest));\n    this.count$ = this.store.pipe(select(selectors.selectCollectionCount));\n    this.currentPage$ = this.store.pipe(select(selectors.selectCollectionCurrentPage));\n    this.totalPages$ = this.store.pipe(select(selectors.selectCollectionTotalPages));\n    this.pageSize$ = this.store.pipe(select(selectors.selectCollectionPageSize));\n    this.sortOptions$ = this.store.pipe(select(selectors.selectCollectionSortOptions));\n    this.appliedSortOption$ = this.store.pipe(select(selectors.selectCollectionAppliedSortOption));\n    this.appliedSortDirection$ = this.store.pipe(select(selectors.selectCollectionAppliedSortDirection));\n    this.filters$ = this.store.pipe(select(selectors.selectCollectionFilters));\n    this.appliedFilters$ = this.store.pipe(select(selectors.selectCollectionAppliedFilters));\n  }\n\n  /**\n   * Dispatches the given action.\n   *\n   * @param action action to dispatch.\n   */\n  dispatch(action: Action) {\n    this.store.dispatch(action);\n  }\n}\n","import { DaffError } from '@daffodil/core';\n\nimport { DaffStateError } from './state-error.interface';\n\nexport type ErrorTransformer = (DaffError) => DaffStateError;\n\n/**\n * Transforms an error instance to a state error object.\n */\nexport function daffTransformErrorToStateError({ code, message, recoverable }: DaffError): DaffStateError {\n  return { code, message, recoverable };\n}\n","import { DaffOperationState } from './state';\nimport { DaffState } from '../states/public_api';\n\n/**\n * Puts the state in a \"resolving\" state that correspondes to loading platform data in a GET fashion.\n * Sets loading to `DaffState.Resolving`\n */\nexport function daffStartResolution <T extends DaffOperationState = DaffOperationState>(state: T): T {\n  return {\n    ...state,\n    daffState: DaffState.Resolving,\n  };\n};\n\n/**\n * Puts the state in a \"mutating\" state that correspondes to loading platform data in a POST or PUT fashion.\n */\nexport function daffStartMutation <T extends DaffOperationState = DaffOperationState>(state: T): T {\n  return {\n    ...state,\n    daffState: DaffState.Updating,\n  };\n};\n\n/**\n * Indicates a successfully completed operation.\n * Sets loading to stable and resets errors.\n */\nexport function daffCompleteOperation <T extends DaffOperationState = DaffOperationState>(state: T): T {\n  return {\n    ...state,\n    daffState: DaffState.Stable,\n    daffErrors: [],\n  };\n};\n\n/**\n * Indicates a failed operation.\n * Sets loading to stable and stores errors.\n */\nexport function daffOperationFailed <T extends DaffOperationState = DaffOperationState>(errors: T['daffErrors'], state: T): T {\n  return {\n    ...state,\n    daffState: DaffState.Error,\n    daffErrors: errors,\n  };\n};\n\n/**\n * Resets errors.\n */\nexport function daffClearErrors <T extends DaffOperationState = DaffOperationState>(state: T): T {\n  return {\n    ...state,\n    daffErrors: [],\n  };\n};\n","import { DaffErrorable } from '../errors/public_api';\nimport {\n  DaffState,\n  DaffStateable,\n} from '../states/public_api';\n\n/**\n * A basic operation state.\n * Represents the current state of an operation and any associated errors.\n */\nexport interface DaffOperationState extends DaffErrorable, DaffStateable {}\n\nexport const daffOperationInitialState: DaffOperationState = {\n  daffState: DaffState.Stable,\n  daffErrors: [],\n};\n","import { DaffState } from './state.enum';\n\n/**\n * Returns whether the state is one that represents an operation in progress.\n */\nexport function daffStateIsLoading(daffState: DaffState): boolean {\n  return daffStateIsMutating(daffState) || daffState === DaffState.Resolving;\n}\n\n/**\n * Returns whether the state is one that represents a mutable operation in progress.\n */\nexport function daffStateIsMutating(daffState: DaffState): boolean {\n  return daffState === DaffState.Adding\n    || daffState === DaffState.Updating\n    || daffState === DaffState.Deleting;\n}\n","import {\n  createSelector,\n  MemoizedSelector,\n  Selector,\n} from '@ngrx/store';\n\nimport { DaffOperationState } from './state';\nimport {\n  DaffState,\n  daffStateIsLoading,\n  daffStateIsMutating,\n} from '../states/public_api';\n\n/**\n * Selectors for an operation state.\n */\nexport interface DaffOperationStateSelectors<\n  TRootState,\n  TState extends DaffOperationState = DaffOperationState\n> {\n  /**\n   * Selects the loading state enum.\n   */\n  selectLoadingState: MemoizedSelector<TRootState, TState['daffState']>;\n  /**\n   * Selects whether the operation state is in any of the loading states.\n   */\n  selectLoading: MemoizedSelector<TRootState, boolean>;\n  /**\n   * Selects whether the operation state is resolving.\n   */\n  selectResolving: MemoizedSelector<TRootState, boolean>;\n  /**\n   * Selects whether the operation state is mutating.\n   */\n  selectMutating: MemoizedSelector<TRootState, boolean>;\n  /**\n   * Selects the errors in the operation state.\n   */\n  selectErrors: MemoizedSelector<TRootState, TState['daffErrors']>;\n  /**\n   * Selects whether the operation state has any errors.\n   * If so, it should be considered to be in an \"error\" state.\n   */\n  selectHasErrors: MemoizedSelector<TRootState, boolean>;\n}\n\n/**\n * Creates a set of selectors for an operation state.\n *\n * @param selectState The feature selector for the operation state.\n */\nexport function daffOperationStateSelectorFactory <\n  TRootState,\n  TState extends DaffOperationState = DaffOperationState\n>(\n  selectState: Selector<TRootState, TState>,\n): DaffOperationStateSelectors<TRootState, TState> {\n  const selectLoadingState = createSelector(\n    selectState,\n    state => state.daffState,\n  );\n  const selectLoading = createSelector(\n    selectLoadingState,\n    loadingState => daffStateIsLoading(loadingState),\n  );\n  const selectResolving = createSelector(\n    selectLoadingState,\n    loadingState => loadingState === DaffState.Resolving,\n  );\n  const selectMutating = createSelector(\n    selectLoadingState,\n    loadingState => daffStateIsMutating(loadingState),\n  );\n  const selectErrors = createSelector(\n    selectState,\n    state => state.daffErrors,\n  );\n  const selectHasErrors = createSelector(\n    selectErrors,\n    errors => errors.length > 0,\n  );\n\n  return {\n    selectLoadingState,\n    selectLoading,\n    selectResolving,\n    selectMutating,\n    selectErrors,\n    selectHasErrors,\n  };\n};\n","import { EntityAdapter } from '@ngrx/entity';\nimport {\n  createSelector,\n  defaultMemoize,\n  MemoizedSelector,\n} from '@ngrx/store';\n\nimport { DaffIdentifiable } from '@daffodil/core';\n\nimport { DaffOperationEntity } from './type';\n\n// ngrx does not export EntitySelectors so we gotta do this nonsense\nconst giveMeType = <T, V>(adapter: EntityAdapter<T>) => adapter.getSelectors<V>((state) => ({ ids: [], entities: {}}));\ntype EntitySelectors<T, V> = ReturnType<typeof giveMeType<T, V>>;\n\n/**\n * Selectors for an operation state.\n */\nexport interface DaffOperationEntityStateSelectors<\n  TRootState,\n  T extends DaffIdentifiable = DaffIdentifiable\n> extends EntitySelectors<DaffOperationEntity<T>, TRootState> {\n  /**\n   * Selects an entity by ID.\n   */\n  selectEntity: (id: T['id']) => MemoizedSelector<TRootState, DaffOperationEntity<T>>;\n\n  /**\n   * Optimistically selects the list of entities.\n   * This excludes temporary entities with errors.\n   */\n  selectOptimisticList: MemoizedSelector<TRootState, DaffOperationEntity<T>[]>;\n}\n\n/**\n * Creates a set of selectors for an entity operation state.\n *\n * @param selectState The feature selector for the entity operation state.\n */\nexport function daffOperationEntityStateSelectorFactory<\n  TRootState,\n  T extends DaffIdentifiable = DaffIdentifiable\n>(\n  entitySelectors: EntitySelectors<DaffOperationEntity<T>, TRootState>,\n): DaffOperationEntityStateSelectors<TRootState, T> {\n  const selectEntity: (id: T['id']) => MemoizedSelector<TRootState, DaffOperationEntity<T>>\n    = defaultMemoize((id) => createSelector(\n      entitySelectors.selectEntities,\n      entities => entities[id],\n    )).memoized;\n\n  const selectOptimisticList = createSelector(\n    entitySelectors.selectAll,\n    (entities) => entities.filter(entity =>\n      // ignore entities that are deleting\n      // entity.daffState !== DaffState.Deleting &&\n    // ignore placeholders with errors\n      !(entity.daffTemp && entity.daffErrors.length > 0),\n    ),\n  );\n\n  return {\n    ...entitySelectors,\n    selectEntity,\n    selectOptimisticList,\n  };\n};\n","import {\n  createEntityAdapter,\n  EntityAdapter,\n} from '@ngrx/entity';\n\nimport { DaffIdentifiable } from '@daffodil/core';\n\nimport {\n  daffOperationEntityStateSelectorFactory,\n  DaffOperationEntityStateSelectors,\n} from './selectors';\nimport { DaffOperationEntityState } from './state.type';\nimport { DaffOperationEntity } from './type';\nimport { DaffStateError } from '../../errors/public_api';\nimport { DaffState } from '../../states/public_api';\n\n/**\n * An entity state adapter that takes care of managing contextual operation and error state for entities.\n */\nexport interface DaffOperationEntityStateAdapterInterface<T extends DaffIdentifiable = DaffIdentifiable> {\n  /**\n   * Stores a list of entities in state and resets them all to stable.\n   */\n  list<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(entities: T[], state: S): S;\n  /**\n   * Optimistically adds a placeholder entity into state if necessary and sets the entity to resolving.\n   */\n  preload<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(id: string, state: S): S;\n  /**\n   * Upserts the entity into state and resets operation state and errors.\n   */\n  load<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(entity: T, state: S): S;\n  /**\n   * Adds a placeholder entity into state if `placeholderId` is specified and sets state to adding.\n   */\n  preadd<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(entity: T, state: S, placeholderId?: string): S;\n  /**\n   * Adds the entity into state, sets operation state to added, and resets errors.\n   */\n  add<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(entity: T, state: S, placeholderId?: string): S;\n  /**\n   * Sets the entity's operation state to mutating.\n   */\n  preupdate<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(entity: Partial<T> & DaffIdentifiable, state: S): S;\n  /**\n   * Upserts the entity into state, sets operation state to mutated, and resets errors.\n   */\n  update<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(entity: Partial<T> & DaffIdentifiable, state: S): S;\n  /**\n   * Sets the entity's operation state to deleting.\n   */\n  preremove<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(key: string, state: S): S;\n  /**\n   * Removes the entity from state.\n   */\n  remove<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(key: string, state: S): S;\n  /**\n   * Resets the entity's operation state and stores errors on the entity.\n   */\n  operationFailed<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(key: string, errors: DaffStateError[], state: S): S;\n  /**\n   * Resets the entity's operation state to stable.\n   */\n  resetState<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(key: string, state: S): S;\n  /**\n   * Gets an empty entity state.\n   */\n  getInitialState<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(state?: S): S;\n  /**\n   * Gets entity selectors.\n   */\n  getSelectors<TRootState>(selectState: (state: TRootState) => DaffOperationEntityState<T>): DaffOperationEntityStateSelectors<TRootState, T>;\n}\n\n/**\n * @inheritdoc\n */\nexport class DaffOperationEntityStateAdapter<T extends DaffIdentifiable = DaffIdentifiable> implements DaffOperationEntityStateAdapterInterface<T> {\n  constructor(\n    protected adapter: EntityAdapter<DaffOperationEntity<T>> = createEntityAdapter<DaffOperationEntity<T>>(),\n  ) {}\n\n  list<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(entities: T[], state: S): S {\n    return this.adapter.setAll(\n      entities.map<DaffOperationEntity<T>>(entity => ({\n        daffState: DaffState.Stable,\n        ...entity,\n        daffErrors: [],\n        daffTemp: false,\n      })),\n      state,\n    );\n  }\n\n  preload<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(id: string, state: S): S {\n    return this.adapter.upsertOne(<DaffOperationEntity<T>>{\n      // TODO: allow for non identifiable entities?\n      id,\n      daffState: DaffState.Resolving,\n      daffErrors: [],\n      daffTemp: !state.entities[id],\n    }, state);\n  }\n\n  load<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(entity: T, state: S): S {\n    return this.adapter.upsertOne({\n      daffState: DaffState.Stable,\n      ...entity,\n      daffErrors: [],\n      daffTemp: false,\n    }, state);\n  }\n\n  preadd<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(entity: T, state: S, placeholderId?: string): S {\n    return placeholderId\n      ? this.adapter.upsertOne({\n        ...entity,\n        // TODO: allow for non identifiable entities?\n        id: placeholderId,\n        daffState: DaffState.Adding,\n        daffErrors: [],\n        daffTemp: true,\n      }, state)\n      : state;\n  }\n\n  add<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(entity: T, state: S, placeholderId?: string): S {\n    return this.adapter.upsertOne(\n      {\n        daffState: DaffState.Added,\n        ...entity,\n        daffErrors: [],\n        daffTemp: false,\n      },\n      placeholderId ? this.adapter.removeOne(placeholderId, state) : state,\n    );\n  }\n\n  preupdate<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(entity: Partial<T> & DaffIdentifiable, state: S): S {\n    return this.adapter.upsertOne({\n      ...state.entities[entity.id],\n      daffState: DaffState.Updating,\n      daffErrors: [],\n    }, state);\n  }\n\n  update<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(entity: Partial<T> & DaffIdentifiable, state: S): S {\n    return this.adapter.updateOne({\n      id: entity.id,\n      changes: <Partial<DaffOperationEntity<T>>>{\n        daffState: DaffState.Updated,\n        ...entity,\n        daffErrors: [],\n        daffTemp: false,\n      },\n    }, state);\n  }\n\n  preremove<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(key: string, state: S): S {\n    return this.adapter.upsertOne({\n      ...state.entities[key],\n      daffErrors: [],\n      daffState: DaffState.Deleting,\n    }, state);\n  }\n\n  remove<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(key: string, state: S): S {\n    return this.adapter.removeOne(key, state);\n  }\n\n  operationFailed<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(key: string, errors: DaffStateError[], state: S): S {\n    return state.entities[key] ? this.adapter.upsertOne({\n      ...state.entities[key],\n      daffState: DaffState.Error,\n      daffErrors: errors,\n    }, state) : state;\n  }\n\n  resetState<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(key: string, state: S): S {\n    return state.entities[key] ? this.adapter.upsertOne({\n      ...state.entities[key],\n      daffState: DaffState.Stable,\n    }, state) : state;\n  }\n\n  getInitialState<S extends DaffOperationEntityState<T> = DaffOperationEntityState<T>>(state?: S): S {\n    return this.adapter.getInitialState(state);\n  }\n\n  getSelectors<TRootState>(selectState: (state: TRootState) => DaffOperationEntityState<T>): DaffOperationEntityStateSelectors<TRootState, T> {\n    return daffOperationEntityStateSelectorFactory<TRootState, T>(this.adapter.getSelectors(selectState));\n  }\n}\n\nexport function daffCreateOperationEntityStateAdapter<T extends DaffIdentifiable = DaffIdentifiable>(adapter: EntityAdapter<DaffOperationEntity<T>> = createEntityAdapter<DaffOperationEntity<T>>()): DaffOperationEntityStateAdapter<T> {\n  return new DaffOperationEntityStateAdapter(adapter);\n}\n","/**\n * Generate a fake ID for use with placeholder entities.\n *\n * @param key An optional key that can augment the randomly generated ID.\n * @returns A string cont\n */\nexport function daffOperationEntityCreateFakeId(key: string = ''): string {\n  return `ε-${Date.now()}-${key}`;\n}\n","import { Action } from '@ngrx/store';\nimport { pipe } from 'rxjs';\nimport {\n  scan,\n  filter,\n} from 'rxjs/operators';\n\nexport type ActionType = Action['type'];\nexport type ActionSequenceStep = ActionType | ActionType[];\nexport type ActionSequence = ActionSequenceStep[];\n\nconst compareActionSequenceStep = (step: ActionSequenceStep, action: Action): boolean => Array.isArray(step)\n  ? step.reduce((acc, type) => acc || action.type === type, false)\n  : action.type === step;\n\n/**\n * Watches for a particular stream of actions in the specified order and\n * emits a list of those actions once all sequence steps have been matched.\n *\n * This will find the first occurence of the substream and not necessarily the most concise or recent substream.\n * For example, substream([A, B]) encountering an action stream of [A1, A2, B1, B2] will emit [A1, B1].\n * When a substream is found and emitted, the list is reset and it will continue to listen to the action stream.\n *\n * You can indicate that a particular step in the sequence can be matched by mutiple actions by passing an array for that step.\n * For example, if the first step of the sequence could be action A or action B: substream([[A, B], C]).\n * An action stream of [A1, C1] would cause substream to emit [A1, C1].\n * An action stream of [B1, C1] would cause substream to emit [B1, C1].\n * An action stream of [A1, B1, C1] would cause substream to emit [A1, C1].\n *\n * You can optionally pass a list of terminators.\n * If a terminator is encountered in the action stream, any partially matched substream is reset.\n * For example, substream([A, B], C) would not emit anything for an action stream of [A1, C1, B1].\n *\n * @param sequence The sequence of action types that define the substream to listen for.\n * @param terminators A list of terminators, any of which interrupt and reset a partially matched substream.\n */\nexport const substream = (sequence: ActionSequence, ...terminators: ActionType[]) => {\n  const isFullMatch = matchedSubstream => matchedSubstream.length === sequence.length;\n  const accumulateMatchedSubstream = (matchedSubstream, action) =>\n    compareActionSequenceStep(sequence[matchedSubstream.length], action)\n      ? [\n        ...matchedSubstream,\n        action,\n      ]\n      : matchedSubstream;\n\n  return pipe(\n    scan<Action, Action[]>((matchedSubstream, action) =>\n      terminators.indexOf(action.type) > -1\n        // terminator found, reset the list\n        ? []\n        : accumulateMatchedSubstream(\n          // reset the list if fully matched\n          isFullMatch(matchedSubstream) ? [] : matchedSubstream,\n          action,\n        ),\n    []),\n    filter(isFullMatch),\n  );\n};\n","import {\n  Action,\n  ActionReducer,\n} from '@ngrx/store';\n\n/**\n * Creates and returns a composite reducer that invokes each of the passed reducers in turn.\n */\nexport function daffComposeReducers<\n  T,\n  V extends Action = Action\n>(reducers: ActionReducer<T, V>[]): ActionReducer<T, V> {\n  return (state: T, action: V): T =>\n    reducers.reduce((nextState, reducer) => reducer(nextState, action), state);\n}\n","import { Action } from '@ngrx/store';\n\n/**\n * A simple reducer that simply returns the passed state.\n * This is useful for stubbing out parts of state that are not covered in an injected extra reducer map.\n */\nexport const daffIdentityReducer = <T = unknown>(state: T, action: Action): T => state;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AASA;;AAEG;MACU,0BAA0B,CAAA;AACrC;;;AAGG;IACH,YAAY,CAAC,OAA8B,EAAE,KAAQ,EAAA;QACnD,OAAO;AACL,YAAA,GAAG,KAAK;YACR,GAAG,sCAAsC,CAAC,OAAO,CAAC;SACnD;IACH;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