{"version":3,"file":"ngrx-fsm.mjs","sources":["../../../../packages/ngrx-fsm/src/+state/component-state.actions.ts","../../../../packages/ngrx-fsm/src/+state/component-state.reducer.ts","../../../../packages/ngrx-fsm/src/+state/component-state.selectors.ts","../../../../packages/ngrx-fsm/src/component-state.service.ts","../../../../packages/ngrx-fsm/src/component-state.enum.ts","../../../../packages/ngrx-fsm/src/component-state.facade.ts","../../../../packages/ngrx-fsm/src/component-state.builder.ts","../../../../packages/ngrx-fsm/src/component-state.machine.ts","../../../../packages/ngrx-fsm/src/ngrx-fsm.ts"],"sourcesContent":["import { createAction, props } from '@ngrx/store';\n\nexport const updateComponentState = createAction(\n  '[ComponentState/API] Update ComponentState',\n  props<any>()\n);\n\nexport const passthroughComponentState = createAction(\n  '[ComponentState/API] Passthrough ComponentState'\n);\n\nexport const deleteComponentState = createAction(\n  '[ComponentState/API] Delete ComponentState',\n  props<any>()\n);\n","import { createReducer, on, Action } from '@ngrx/store';\n\nimport * as ComponentStateActions from './component-state.actions';\n\nexport const COMPONENT_STATE_FEATURE_KEY = 'componentState';\n\nexport interface ComponentStateState {\n  [index: string]: any;\n}\n\n// export interface ComponentStatePartialState {\n//   readonly [COMPONENT_STATE_FEATURE_KEY]: ComponentStateState;\n// }\n\n// export const componentStateAdapter: EntityAdapter<ComponentStateEntity> =\n//   createEntityAdapter<ComponentStateEntity>();\n\nexport const initialComponentStateState: ComponentStateState = {};\n\nconst reducer = createReducer(\n  initialComponentStateState,\n  on(\n    ComponentStateActions.updateComponentState,\n    (state, { componentName, componentState }) => ({\n      ...Object.assign({}, state),\n      [componentName]: componentState,\n    })\n  ),\n  on(ComponentStateActions.deleteComponentState, (state, { componentName }) => {\n    const newState = Object.assign({}, state);\n    if (state[componentName]) {\n      delete newState[componentName];\n    }\n    return newState;\n  })\n);\n\nexport function componentStateReducer(\n  state: ComponentStateState | undefined,\n  action: Action\n) {\n  return reducer(state, action);\n}\n","import { createFeatureSelector, createSelector } from '@ngrx/store';\nimport {\n  COMPONENT_STATE_FEATURE_KEY,\n  ComponentStateState,\n} from './component-state.reducer';\n\n// Lookup the 'ComponentState' feature state managed by NgRx\nexport const selectComponentStateState =\n  createFeatureSelector<ComponentStateState>(COMPONENT_STATE_FEATURE_KEY);\n\n// const { selectAll, selectEntities } = componentStateAdapter.getSelectors();\n\nexport const selectComponentState = createSelector(\n  selectComponentStateState,\n  (state: ComponentStateState) => state\n);\n","import { inject, Injectable } from '@angular/core';\nimport { Store } from '@ngrx/store';\nimport { forOwn, isEmpty } from 'lodash';\nimport * as ComponentStateActions from './+state/component-state.actions';\nimport { ComponentStateState } from './+state/component-state.reducer';\nimport { ComponentStateEnum } from './component-state.enum';\n\n@Injectable()\nexport class ComponentStateService {\n  private readonly store = inject(\n    Store<{ componentState: ComponentStateState }>\n  );\n  public componentStates: any = {};\n\n  constructor() {}\n\n  public addComponentStates(componentStateData: any) {\n    this.deleteComponentState(componentStateData.name);\n    forOwn(componentStateData.states, (value: any, key: string) => {\n      if (!this.componentStates[key]) {\n        this.componentStates[key] = {};\n      }\n      if (!this.componentStates[key][componentStateData.name]) {\n        if (componentStateData.id) {\n          value.id = componentStateData.id;\n        }\n        this.componentStates[key][componentStateData.name] = value;\n      }\n    });\n  }\n\n  public removeComponentStates(componentName: string) {\n    forOwn(this.componentStates, (value: any, key: string) => {\n      if (value[componentName]) {\n        delete this.componentStates[key][componentName];\n      }\n      if (isEmpty(this.componentStates[key])) {\n        delete this.componentStates[key];\n      }\n    });\n    this.deleteComponentState(componentName);\n  }\n\n  public updateComponentState(\n    componentName: string,\n    componentState: ComponentStateEnum\n  ) {\n    this.store.dispatch(\n      ComponentStateActions.updateComponentState({\n        componentName,\n        componentState,\n      })\n    );\n  }\n\n  public deleteComponentState(componentName: string) {\n    this.store.dispatch(\n      ComponentStateActions.deleteComponentState({ componentName })\n    );\n  }\n}\n","export enum ComponentStateEnum {\n  Idle = 'idle',\n  Processing = 'processing',\n  Completed = 'completed',\n  Retry = 'retry',\n  Maximised = 'maximised',\n  Minimised = 'minimised',\n  Success = 'success',\n  Disabled = 'disabled',\n}\n","import { Injectable, inject } from '@angular/core';\nimport { select, Store, Action } from '@ngrx/store';\n\nimport * as ComponentStateSelectors from './+state/component-state.selectors';\nimport { map } from 'rxjs/operators';\nimport { filter } from 'rxjs';\nimport { ComponentStateState } from './+state/component-state.reducer';\nimport { ComponentStateEnum } from './component-state.enum';\n\n@Injectable()\nexport class ComponentStateFacade {\n  private readonly store = inject(Store);\n\n  /**\n   * Combine pieces of state using createSelector,\n   * and expose them as observables through the facade.\n   */\n  // loaded$ = this.store.pipe(\n  //   select(ComponentStateSelectors.selectComponentStateLoaded)\n  // );\n  componentState$ = this.store.pipe(\n    select(ComponentStateSelectors.selectComponentState)\n  );\n  // selectedComponentState$ = this.store.pipe(\n  //   select(ComponentStateSelectors.selectEntity)\n  // );\n\n  /**\n   * Use the initialization action to perform one\n   * or more tasks in your Effects.\n   */\n  // init() {\n  //   this.store.dispatch(ComponentStateActions.initComponentState());\n  // }\n\n  processingComponentName(componentName: string) {\n    return this.componentState$.pipe(\n      filter(\n        (state: ComponentStateState) =>\n          state && state[componentName] !== undefined\n      ),\n      map((state: ComponentStateState) => state[componentName]),\n      map(\n        (componentState: ComponentStateEnum) =>\n          componentState === ComponentStateEnum.Processing\n      )\n    );\n  }\n}\n","import { forOwn } from 'lodash';\nimport { Injectable } from '@angular/core';\n\nimport { passthroughComponentState } from './+state/component-state.actions';\nimport { ComponentStateEnum } from './component-state.enum';\n\nexport interface ComponentState {\n  id?: string | number;\n  name: string;\n  disableWhenProcessing: boolean;\n  showProgressBar: boolean;\n  states: { [action: string]: ActionState };\n}\n\nexport interface ActionState {\n  [state: string]: Transition;\n}\n\nexport interface Transition {\n  to?: ComponentStateEnum;\n  action?: Function;\n  terminate?: boolean;\n}\n\n@Injectable()\nexport class ComponentStateBuilder {\n  private _componentStates!: ComponentState;\n  private _currentAction!: string;\n  private _currentFromState!: ComponentStateEnum;\n\n  public create(componentName: string) {\n    this._currentAction = undefined as never;\n    this._currentFromState = undefined as never;\n    this._componentStates = {\n      name: componentName,\n      disableWhenProcessing: false,\n      showProgressBar: true,\n      states: {},\n    };\n    return this;\n  }\n\n  public withId(id: string | number) {\n    this._componentStates.id = id;\n    return this;\n  }\n\n  public disableWhenProcessing() {\n    this._componentStates.disableWhenProcessing = true;\n    return this;\n  }\n\n  public showProgressBar(showProgressbar: boolean) {\n    this._componentStates.showProgressBar = showProgressbar;\n    return this;\n  }\n\n  public forAction(actionType: string) {\n    this._componentStates.states[actionType] = {};\n    this._currentAction = actionType;\n    return this;\n  }\n\n  public fromState(fromState: ComponentStateEnum) {\n    this._componentStates.states[this._currentAction][fromState] = {};\n    this._currentFromState = fromState;\n    return this;\n  }\n\n  public toState(toState: ComponentStateEnum) {\n    this._componentStates.states[this._currentAction][\n      this._currentFromState\n    ].to = toState;\n    return this;\n  }\n\n  public passThrough() {\n    this._componentStates.states[this._currentAction][\n      this._currentFromState\n    ].action = passthroughComponentState;\n    return this;\n  }\n\n  public terminate() {\n    this._componentStates.states[this._currentAction][\n      this._currentFromState\n    ].terminate = true;\n    return this;\n  }\n\n  public transformTo(action: Function) {\n    this._componentStates.states[this._currentAction][\n      this._currentFromState\n    ].action = action;\n    return this;\n  }\n\n  public build() {\n    this.validate(this._componentStates.states);\n    return this._componentStates;\n  }\n\n  public validate(states: any) {\n    forOwn(states, (value: any, key: string) => {\n      forOwn(value, (actionValue: any, actionKey: string) => {\n        if (!actionValue.action && !actionValue.terminate) {\n          throw new Error(\n            `The component state change for ${key} is missing a passthrough, transform, or terminate flag`\n          );\n        }\n      });\n    });\n  }\n}\n","import { Injectable, Injector } from '@angular/core';\nimport { Store, ActionsSubject } from '@ngrx/store';\nimport { forOwn, filter } from 'lodash';\nimport { take } from 'rxjs/operators';\n\nimport { ComponentStateService } from './component-state.service';\nimport { ComponentStateState } from './+state/component-state.reducer';\nimport * as ComponentStateActions from './+state/component-state.actions';\nimport { ComponentStateEnum } from './component-state.enum';\n\n@Injectable()\nexport class ComponentStateMachine extends ActionsSubject {\n  private _store!: Store<{ componentState: ComponentStateState }>;\n  private _componentStateService!: ComponentStateService;\n\n  constructor(private _injector: Injector) {\n    super();\n  }\n  public override next(action: any) {\n    if (!this._store) {\n      this._store = <Store<{ componentState: ComponentStateState }>>(\n        this._injector.get(Store)\n      );\n      this._componentStateService = <ComponentStateService>(\n        this._injector.get(ComponentStateService)\n      );\n    }\n    // check if the any components have registered an interest in this component\n    if (this._componentStateService.componentStates[action.type]) {\n      this.processAction(action);\n    } else {\n      // no components are interested in this action so just pass on\n      super.next(action);\n    }\n  }\n\n  private processAction(action: any) {\n    // a the current slice of the ui state from the store\n    this._store\n      .select((state) => state.componentState)\n      .pipe(take(1))\n      .subscribe((componentState: ComponentStateState) => {\n        // now get the details from the stateMachine service about which components\n        // are interested in this action\n        const stateMachine =\n          this._componentStateService.componentStates[action.type];\n        let actionForwarded = false;\n        forOwn(stateMachine, (value, key) => {\n          // for each entry check what the current state of the component is\n          const currentState = componentState[key]\n            ? componentState[key]\n            : ComponentStateEnum.Idle;\n          const stateTransition = stateMachine[key][currentState];\n          if (\n            stateTransition &&\n            this.checkValidTransition(action.payload, value.id)\n          ) {\n            // set the new state from the given component\n            const newState = stateTransition.to;\n            super.next(\n              ComponentStateActions.updateComponentState({\n                componentName: key,\n                componentState: newState,\n              })\n            );\n            if (stateTransition.action) {\n              // process the action by either transforming to another action or passing through\n              const args = filter(action, (param: any, paramKey: any) => {\n                return paramKey !== 'type';\n              });\n\n              const transitionAction = stateTransition.action(...args);\n              if (\n                transitionAction.type ===\n                ComponentStateActions.passthroughComponentState.type\n              ) {\n                if (!actionForwarded) {\n                  super.next(action);\n                  actionForwarded = true;\n                }\n              } else {\n                super.next(transitionAction);\n              }\n            }\n          }\n        });\n      });\n  }\n\n  private checkValidTransition(actionPayload: any, transitionId: number) {\n    return (\n      !actionPayload ||\n      !actionPayload.componentStateId ||\n      (actionPayload.componentStateId && !transitionId) ||\n      (actionPayload.componentStateId &&\n        transitionId === actionPayload.componentStateId)\n    );\n  }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["ComponentStateActions.updateComponentState","ComponentStateActions.deleteComponentState","ComponentStateSelectors.selectComponentState","filter","ComponentStateActions.passthroughComponentState"],"mappings":";;;;;;;AAEa,MAAA,oBAAoB,GAAG,YAAY,CAC9C,4CAA4C,EAC5C,KAAK,EAAO,EACZ;MAEW,yBAAyB,GAAG,YAAY,CACnD,iDAAiD,EACjD;AAEW,MAAA,oBAAoB,GAAG,YAAY,CAC9C,4CAA4C,EAC5C,KAAK,EAAO;;ACTP,MAAM,2BAA2B,GAAG,iBAAiB;AAM5D;AACA;AACA;AAEA;AACA;AAEO,MAAM,0BAA0B,GAAwB,GAAG;AAElE,MAAM,OAAO,GAAG,aAAa,CAC3B,0BAA0B,EAC1B,EAAE,CACAA,oBAA0C,EAC1C,CAAC,KAAK,EAAE,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM;AAC7C,IAAA,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC;IAC3B,CAAC,aAAa,GAAG,cAAc;AAChC,CAAA,CAAC,CACH,EACD,EAAE,CAACC,oBAA0C,EAAE,CAAC,KAAK,EAAE,EAAE,aAAa,EAAE,KAAI;IAC1E,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;AAC1C,IAAA,IAAI,KAAK,CAAC,aAAa,CAAC,EAAE;AACxB,QAAA,OAAO,QAAQ,CAAC,aAAa,CAAC,CAAC;AAChC,KAAA;AACD,IAAA,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC,CACH,CAAC;AAEc,SAAA,qBAAqB,CACnC,KAAsC,EACtC,MAAc,EAAA;AAEd,IAAA,OAAO,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AAChC;;ACpCA;MACa,yBAAyB,GACpC,qBAAqB,CAAsB,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