UNPKG

40.2 kBSource Map (JSON)View Raw
1{"version":3,"file":"typesafe-actions.umd.development.js","sources":["../src/utils/validation.ts","../src/action.ts","../src/create-custom-action.ts","../src/create-action.ts","../src/create-async-action.ts","../src/get-type.ts","../src/create-reducer.ts","../src/is-of-type.ts","../src/is-action-of.ts","../src/deprecated/create-action.ts","../src/deprecated/create-custom-action.ts","../src/deprecated/create-standard-action.ts","../src/deprecated/index.ts"],"sourcesContent":["import {\n ActionCreator,\n ActionCreatorTypeMetadata,\n TypeConstant,\n} from '../type-helpers';\n\nexport function checkIsEmpty(arg: unknown) {\n return arg == null;\n}\n\nexport function throwIsEmpty(argPosition: number): never {\n throw new Error(`Argument ${argPosition} is empty.`);\n}\n\nexport function checkValidActionCreator(\n arg: unknown\n): arg is ActionCreator<TypeConstant> {\n return typeof arg === 'function' && 'getType' in arg;\n}\n\nexport function checkInvalidActionCreator(arg: unknown) {\n return !checkValidActionCreator(arg);\n}\n\nexport function throwInvalidActionCreator(argPosition: number): never {\n throw new Error(\n `Argument ${argPosition} is invalid, it should be an action-creator instance from \"typesafe-actions\"`\n );\n}\n\nexport function checkInvalidActionCreatorInArray(\n arg: ActionCreator<TypeConstant> & ActionCreatorTypeMetadata<TypeConstant>,\n idx: number\n): void | never {\n if (arg == null) {\n throw new Error(\n `Argument contains array with empty element at index ${idx}`\n );\n } else if (arg.getType == null) {\n throw new Error(\n // tslint:disable-next-line:max-line-length\n `Argument contains array with invalid element at index ${idx}, it should be an action-creator instance from \"typesafe-actions\"`\n );\n }\n}\n\nexport function checkValidActionType(arg: unknown): arg is string | symbol {\n return typeof arg === 'string' || typeof arg === 'symbol';\n}\n\nexport function checkInvalidActionType(arg: unknown) {\n return !checkValidActionType(arg);\n}\n\nexport function throwInvalidActionType(argPosition: number): never {\n throw new Error(\n `Argument ${argPosition} is invalid, it should be an action type of type: string | symbol`\n );\n}\n\nexport function checkInvalidActionTypeInArray(\n arg: TypeConstant,\n idx: number\n): void | never {\n if (arg == null) {\n throw new Error(\n `Argument contains array with empty element at index ${idx}`\n );\n } else if (typeof arg !== 'string' && typeof arg !== 'symbol') {\n throw new Error(\n `Argument contains array with invalid element at index ${idx}, it should be of type: string | symbol`\n );\n }\n}\n\nexport function throwInvalidActionTypeOrActionCreator(\n argPosition: number\n): never {\n throw new Error(\n `Argument ${argPosition} is invalid, it should be an action-creator instance from \"typesafe-actions\" or action type of type: string | symbol`\n );\n}\n","import { TypeConstant } from './type-helpers';\nimport {\n checkIsEmpty,\n throwIsEmpty,\n checkInvalidActionType,\n throwInvalidActionCreator,\n} from './utils/validation';\n\nexport function action<T extends TypeConstant, E>(\n type: T,\n payload: undefined,\n meta: undefined,\n error: E\n): { type: T; error: E };\n\nexport function action<T extends TypeConstant, M, E>(\n type: T,\n payload: undefined,\n meta: M,\n error: E\n): { type: T; meta: M; error: E };\n\nexport function action<T extends TypeConstant, P, E>(\n type: T,\n payload: P,\n meta: undefined,\n error: E\n): { type: T; payload: P; error: E };\n\nexport function action<T extends TypeConstant, P, M, E>(\n type: T,\n payload: P,\n meta: M,\n error: E\n): { type: T; payload: P; meta: M; error: E };\n\nexport function action<T extends TypeConstant, M>(\n type: T,\n payload: undefined,\n meta: M\n): { type: T; meta: M };\n\nexport function action<T extends TypeConstant, P, M>(\n type: T,\n payload: P,\n meta: M\n): { type: T; payload: P; meta: M };\n\nexport function action<T extends TypeConstant, P>(\n type: T,\n payload: P\n): { type: T; payload: P };\n\nexport function action<T extends TypeConstant>(type: T): { type: T };\n\n/**\n * @description flux standard action factory\n * @example\n * ```\n * const add = (amount: number, meta?: Meta, error?: boolean) => action('INCREMENT', amount, meta, error);\n * ```\n */\nexport function action<\n T extends TypeConstant,\n P = undefined,\n M = undefined,\n E = undefined\n>(type: T, payload?: P, meta?: M, error?: E) {\n if (checkIsEmpty(type)) {\n throwIsEmpty(1);\n }\n\n if (checkInvalidActionType(type)) {\n throwInvalidActionCreator(1);\n }\n\n return { type, payload, meta, error } as any;\n}\n","import {\n TypeConstant,\n ResolveType,\n ActionCreatorTypeMetadata,\n} from './type-helpers';\nimport {\n checkIsEmpty,\n throwIsEmpty,\n checkInvalidActionType,\n throwInvalidActionType,\n} from './utils/validation';\n\n/**\n * @description create custom action-creator using constructor function with injected type argument\n */\nexport function createCustomAction<\n TType extends TypeConstant,\n TArgs extends any[] = [],\n TReturn extends any = {}\n>(\n type: TType,\n createHandler?: (...args: TArgs) => TReturn\n): ((...args: TArgs) => ResolveType<{ type: TType } & TReturn>) &\n ActionCreatorTypeMetadata<TType> {\n if (checkIsEmpty(type)) {\n throwIsEmpty(1);\n }\n\n if (checkInvalidActionType(type)) {\n throwInvalidActionType(1);\n }\n\n const actionCreator = (...args: TArgs) => {\n const customProps =\n createHandler != null ? createHandler(...args) : undefined;\n return { type, ...customProps } as ResolveType<{ type: TType } & TReturn>;\n };\n\n const typeMeta = {\n getType: () => type,\n // redux-actions compatibility\n toString: () => type,\n } as ActionCreatorTypeMetadata<TType>;\n\n return Object.assign(actionCreator, typeMeta);\n}\n","import {\n TypeConstant,\n ActionCreatorBuilder,\n ActionCreatorTypeMetadata,\n ActionBuilder,\n} from './type-helpers';\nimport { createCustomAction } from './create-custom-action';\nimport {\n checkIsEmpty,\n throwIsEmpty,\n checkInvalidActionType,\n throwInvalidActionType,\n} from './utils/validation';\n\nexport function createAction<TType extends TypeConstant>(\n type: TType\n): <TPayload = undefined, TMeta = undefined>() => ActionCreatorBuilder<\n TType,\n TPayload,\n TMeta\n>;\n\nexport function createAction<\n TType extends TypeConstant,\n TCreatorPayload extends any = undefined,\n TCreatorMeta extends any = undefined,\n TArgs extends any[] = any[]\n>(\n type: TType,\n payloadCreator: undefined | ((...args: TArgs) => TCreatorPayload),\n metaCreator?: (...args: TArgs) => TCreatorMeta\n): <\n TPayload extends TCreatorPayload = TCreatorPayload,\n TMeta extends TCreatorMeta = TCreatorMeta\n>() => (...args: TArgs) => ActionBuilder<TType, TPayload, TMeta>;\n\n/**\n * @description create an action-creator\n */\nexport function createAction<\n TType extends TypeConstant,\n TCreatorPayload extends any = undefined,\n TCreatorMeta extends any = undefined,\n TArgs extends any[] = any[]\n>(\n type: TType,\n payloadCreator?: undefined | ((...args: TArgs) => TCreatorPayload),\n metaCreator?: (...args: TArgs) => TCreatorMeta\n):\n | (<\n TPayload extends TCreatorPayload = TCreatorPayload,\n TMeta extends TCreatorMeta = TCreatorMeta\n >() => (...args: TArgs) => ActionBuilder<TType, TPayload, TMeta>)\n | (<TPayload = undefined, TMeta = undefined>() => ActionCreatorBuilder<\n TType,\n TPayload,\n TMeta\n >) {\n if (checkIsEmpty(type)) {\n throwIsEmpty(1);\n }\n\n if (checkInvalidActionType(type)) {\n throwInvalidActionType(1);\n }\n\n return <TPayload, TMeta = undefined>() => {\n return createCustomAction(type, (...args: TArgs) => {\n let payload = args[0];\n let meta = args[1];\n\n if (payloadCreator != null || metaCreator != null) {\n payload = payloadCreator != null ? payloadCreator(...args) : undefined;\n meta = metaCreator != null ? metaCreator(...args) : undefined;\n }\n\n return {\n ...(payload !== undefined && { payload }),\n ...(meta !== undefined && { meta }),\n };\n }) as ActionCreatorBuilder<TType, TPayload, TMeta>;\n };\n}\n","import {\n TypeConstant,\n ActionCreatorBuilder,\n ActionBuilder,\n} from './type-helpers';\nimport { createAction } from './create-action';\n\nexport function throwInvalidAsyncActionArgument(argPosition: number): never {\n throw new Error(\n `Argument ${argPosition} is invalid, it should be an action type of \"string | symbol\" or a tuple of \"[string | symbol, Function, Function?]\"`\n );\n}\n\ntype AsyncActionHandler<\n TType extends TypeConstant,\n TArgs extends any[],\n TPayloadMeta\n> = [TArgs] extends [never]\n ? ActionCreatorBuilder<\n TType,\n unknown extends TPayloadMeta\n ? any\n : [TPayloadMeta] extends [[infer T, any]]\n ? T\n : TPayloadMeta,\n unknown extends TPayloadMeta\n ? undefined\n : [TPayloadMeta] extends [[any, infer T]]\n ? T\n : undefined\n >\n : (\n ...args: TArgs\n ) => ActionBuilder<\n TType,\n [TPayloadMeta] extends [[infer T, any]] ? T : TPayloadMeta,\n [TPayloadMeta] extends [[any, infer T]] ? T : undefined\n >;\n\ninterface AsyncAction<\n TType1 extends TypeConstant,\n TPayload1 extends any,\n TMeta1 extends any,\n TArgs1 extends any[],\n TType2 extends TypeConstant,\n TPayload2 extends any,\n TMeta2 extends any,\n TArgs2 extends any[],\n TType3 extends TypeConstant,\n TPayload3 extends any,\n TMeta3 extends any,\n TArgs3 extends any[],\n TType4 extends TypeConstant,\n TPayload4 extends any,\n TMeta4 extends any,\n TArgs4 extends any[]\n> {\n // tslint:disable-next-line: callable-types\n <\n TPayloadMeta1 extends\n | TPayload1\n | [TPayload1, TMeta1] = TMeta1 extends undefined\n ? TPayload1\n : [TPayload1, TMeta1],\n TPayloadMeta2 extends\n | TPayload2\n | [TPayload2, TMeta2] = TMeta2 extends undefined\n ? TPayload2\n : [TPayload2, TMeta2],\n TPayloadMeta3 extends\n | TPayload3\n | [TPayload3, TMeta3] = TMeta3 extends undefined\n ? TPayload3\n : [TPayload3, TMeta3],\n TPayloadMeta4 extends\n | TPayload4\n | [TPayload4, TMeta4] = TMeta3 extends undefined\n ? TPayload4\n : [TPayload4, TMeta4]\n >(): [TType4] extends [never]\n ? {\n request: AsyncActionHandler<TType1, TArgs1, TPayloadMeta1>;\n success: AsyncActionHandler<TType2, TArgs2, TPayloadMeta2>;\n failure: AsyncActionHandler<TType3, TArgs3, TPayloadMeta3>;\n }\n : {\n request: AsyncActionHandler<TType1, TArgs1, TPayloadMeta1>;\n success: AsyncActionHandler<TType2, TArgs2, TPayloadMeta2>;\n failure: AsyncActionHandler<TType3, TArgs3, TPayloadMeta3>;\n cancel: AsyncActionHandler<TType4, TArgs4, TPayloadMeta4>;\n };\n}\n\nexport function createAsyncAction<\n TType1 extends TypeConstant,\n TType2 extends TypeConstant,\n TType3 extends TypeConstant,\n TType4 extends TypeConstant = never\n>(\n requestArg: TType1,\n successArg: TType2,\n failureArg: TType3,\n cancelArg?: TType4\n): AsyncAction<\n TType1,\n unknown,\n unknown,\n never,\n TType2,\n unknown,\n unknown,\n never,\n TType3,\n unknown,\n unknown,\n never,\n TType4,\n unknown,\n unknown,\n never\n>;\n\nexport function createAsyncAction<\n TType1 extends TypeConstant,\n TType2 extends TypeConstant,\n TType3 extends TypeConstant,\n TType4 extends TypeConstant = never,\n TPayloadCreator1 extends\n | ((...args: TArgs1) => TPayload1)\n | undefined = undefined,\n TPayloadCreator2 extends\n | ((...args: TArgs2) => TPayload2)\n | undefined = undefined,\n TPayloadCreator3 extends\n | ((...args: TArgs3) => TPayload3)\n | undefined = undefined,\n TPayloadCreator4 extends\n | ((...args: TArgs4) => TPayload4)\n | undefined = undefined,\n TMetaCreator1 extends ((...args: TArgs1) => TMeta1) | undefined = undefined,\n TMetaCreator2 extends ((...args: TArgs2) => TMeta2) | undefined = undefined,\n TMetaCreator3 extends ((...args: TArgs3) => TMeta3) | undefined = undefined,\n TMetaCreator4 extends ((...args: TArgs4) => TMeta4) | undefined = undefined,\n TPayload1 extends any = TPayloadCreator1 extends ((...args: any[]) => infer T)\n ? T\n : undefined,\n TMeta1 extends any = TMetaCreator1 extends ((...args: any[]) => infer T)\n ? T\n : undefined,\n TPayload2 extends any = TPayloadCreator2 extends ((...args: any[]) => infer T)\n ? T\n : undefined,\n TMeta2 extends any = TMetaCreator2 extends ((...args: any[]) => infer T)\n ? T\n : undefined,\n TPayload3 extends any = TPayloadCreator3 extends ((...args: any[]) => infer T)\n ? T\n : undefined,\n TMeta3 extends any = TMetaCreator3 extends ((...args: any[]) => infer T)\n ? T\n : undefined,\n TPayload4 extends any = TPayloadCreator4 extends ((...args: any[]) => infer T)\n ? T\n : undefined,\n TMeta4 extends any = TMetaCreator4 extends ((...args: any[]) => infer T)\n ? T\n : undefined,\n TArgs1 extends any[] = TPayloadCreator1 extends ((...args: infer T) => any)\n ? T\n : TMetaCreator1 extends ((...args: infer T) => any)\n ? T\n : never,\n TArgs2 extends any[] = TPayloadCreator2 extends ((...args: infer T) => any)\n ? T\n : TMetaCreator2 extends ((...args: infer T) => any)\n ? T\n : never,\n TArgs3 extends any[] = TPayloadCreator3 extends ((...args: infer T) => any)\n ? T\n : TMetaCreator3 extends ((...args: infer T) => any)\n ? T\n : never,\n TArgs4 extends any[] = TPayloadCreator4 extends ((...args: infer T) => any)\n ? T\n : TMetaCreator4 extends ((...args: infer T) => any)\n ? T\n : never\n>(\n requestArg:\n | TType1\n | [TType1, TPayloadCreator1]\n | [TType1, TPayloadCreator1, TMetaCreator1],\n successArg:\n | TType2\n | [TType2, TPayloadCreator2]\n | [TType2, TPayloadCreator2, TMetaCreator2],\n failureArg:\n | TType3\n | [TType3, TPayloadCreator3]\n | [TType3, TPayloadCreator3, TMetaCreator3],\n cancelArg?:\n | TType4\n | [TType4, TPayloadCreator4]\n | [TType4, TPayloadCreator4, TMetaCreator4]\n): AsyncAction<\n TType1,\n TPayload1,\n TMeta1,\n TArgs1,\n TType2,\n TPayload2,\n TMeta2,\n TArgs2,\n TType3,\n TPayload3,\n TMeta3,\n TArgs3,\n TType4,\n TPayload4,\n TMeta4,\n TArgs4\n>;\n\n/**\n * @description create an async action-creator object that contains `request`, `success` and `failure` actions as props\n */\nexport function createAsyncAction<\n TType1 extends TypeConstant,\n TType2 extends TypeConstant,\n TType3 extends TypeConstant,\n TType4 extends TypeConstant = never,\n TPayloadCreator1 extends\n | ((...args: TArgs1) => TPayload1)\n | undefined = undefined,\n TPayloadCreator2 extends\n | ((...args: TArgs2) => TPayload2)\n | undefined = undefined,\n TPayloadCreator3 extends\n | ((...args: TArgs3) => TPayload3)\n | undefined = undefined,\n TPayloadCreator4 extends\n | ((...args: TArgs4) => TPayload4)\n | undefined = undefined,\n TMetaCreator1 extends ((...args: TArgs1) => TMeta1) | undefined = undefined,\n TMetaCreator2 extends ((...args: TArgs2) => TMeta2) | undefined = undefined,\n TMetaCreator3 extends ((...args: TArgs3) => TMeta3) | undefined = undefined,\n TMetaCreator4 extends ((...args: TArgs4) => TMeta4) | undefined = undefined,\n TPayload1 extends any = TPayloadCreator1 extends ((...args: any[]) => infer T)\n ? T\n : undefined,\n TMeta1 extends any = TMetaCreator1 extends ((...args: any[]) => infer T)\n ? T\n : undefined,\n TPayload2 extends any = TPayloadCreator2 extends ((...args: any[]) => infer T)\n ? T\n : undefined,\n TMeta2 extends any = TMetaCreator2 extends ((...args: any[]) => infer T)\n ? T\n : undefined,\n TPayload3 extends any = TPayloadCreator3 extends ((...args: any[]) => infer T)\n ? T\n : undefined,\n TMeta3 extends any = TMetaCreator3 extends ((...args: any[]) => infer T)\n ? T\n : undefined,\n TPayload4 extends any = TPayloadCreator4 extends ((...args: any[]) => infer T)\n ? T\n : undefined,\n TMeta4 extends any = TMetaCreator4 extends ((...args: any[]) => infer T)\n ? T\n : undefined,\n TArgs1 extends any[] = TPayloadCreator1 extends ((...args: infer T) => any)\n ? T\n : TMetaCreator1 extends ((...args: infer T) => any)\n ? T\n : never,\n TArgs2 extends any[] = TPayloadCreator2 extends ((...args: infer T) => any)\n ? T\n : TMetaCreator2 extends ((...args: infer T) => any)\n ? T\n : never,\n TArgs3 extends any[] = TPayloadCreator3 extends ((...args: infer T) => any)\n ? T\n : TMetaCreator3 extends ((...args: infer T) => any)\n ? T\n : never,\n TArgs4 extends any[] = TPayloadCreator4 extends ((...args: infer T) => any)\n ? T\n : TMetaCreator4 extends ((...args: infer T) => any)\n ? T\n : never\n>(\n requestArg:\n | TType1\n | [TType1, TPayloadCreator1]\n | [TType1, TPayloadCreator1, TMetaCreator1],\n successArg:\n | TType2\n | [TType2, TPayloadCreator2]\n | [TType2, TPayloadCreator2, TMetaCreator2],\n failureArg:\n | TType3\n | [TType3, TPayloadCreator3]\n | [TType3, TPayloadCreator3, TMetaCreator3],\n cancelArg?:\n | TType4\n | [TType4, TPayloadCreator4]\n | [TType4, TPayloadCreator4, TMetaCreator4]\n): AsyncAction<\n TType1,\n TPayload1,\n TMeta1,\n TArgs1,\n TType2,\n TPayload2,\n TMeta2,\n TArgs2,\n TType3,\n TPayload3,\n TMeta3,\n TArgs3,\n TType4,\n TPayload4,\n TMeta4,\n TArgs4\n> {\n const constructor = (<\n TP1 = undefined,\n TM1 = undefined,\n TP2 = undefined,\n TM2 = undefined,\n TP3 = undefined,\n TM3 = undefined,\n TP4 = undefined,\n TM4 = undefined\n >() => {\n const results = [requestArg, successArg, failureArg, cancelArg].map(\n (arg, index) => {\n if (Array.isArray(arg)) {\n return createAction(arg[0], arg[1] as any, arg[2] as any)();\n } else if (typeof arg === 'string' || typeof arg === 'symbol') {\n return createAction(arg as string)();\n } else if (index < 3) {\n throwInvalidAsyncActionArgument(index);\n }\n }\n );\n\n const [request, success, failure, cancel] = results;\n\n return {\n request,\n success,\n failure,\n cancel,\n };\n }) as AsyncAction<\n TType1,\n TPayload1,\n TMeta1,\n TArgs1,\n TType2,\n TPayload2,\n TMeta2,\n TArgs2,\n TType3,\n TPayload3,\n TMeta3,\n TArgs3,\n TType4,\n TPayload4,\n TMeta4,\n TArgs4\n >;\n\n return constructor;\n}\n","import {\n TypeConstant,\n ActionCreator,\n ActionCreatorTypeMetadata,\n} from './type-helpers';\nimport {\n checkIsEmpty,\n throwIsEmpty,\n checkInvalidActionCreator,\n throwInvalidActionCreator,\n} from './utils/validation';\n\n/**\n * @description get the \"type literal\" of a given action-creator\n */\nexport function getType<TType extends TypeConstant>(\n actionCreator: ActionCreator<TType> & ActionCreatorTypeMetadata<TType>\n): TType {\n if (checkIsEmpty(actionCreator)) {\n throwIsEmpty(1);\n }\n\n if (checkInvalidActionCreator(actionCreator)) {\n throwInvalidActionCreator(1);\n }\n\n return actionCreator.getType!();\n}\n","import { getType } from './get-type';\nimport {\n checkValidActionCreator,\n checkValidActionType,\n throwInvalidActionTypeOrActionCreator,\n} from './utils/validation';\nimport { Reducer, Action, Types } from './type-helpers';\n\ntype HandleActionChainApi<\n TState,\n TInputAction extends Action,\n TRootAction extends Action\n> = <\n TActionCreator extends (...args: any[]) => TInputAction,\n THandledAction extends ReturnType<TActionCreator>,\n TOutputAction extends Exclude<TInputAction, THandledAction>\n>(\n singleOrMultipleCreatorsAndTypes: TActionCreator | TActionCreator[],\n reducer: (state: TState, action: THandledAction) => TState\n) => [TOutputAction] extends [Action]\n ? Reducer<TState, TRootAction> & {\n handlers: Record<\n Exclude<TRootAction, TOutputAction>['type'],\n (state: TState, action: TRootAction) => TState\n >;\n handleAction: HandleActionChainApi<TState, TOutputAction, TRootAction>;\n }\n : Reducer<TState, TRootAction> & {\n handlers: Record<\n TRootAction['type'],\n (state: TState, action: TRootAction) => TState\n >;\n };\n\ntype HandleTypeChainApi<\n TState,\n TInputAction extends Action,\n TRootAction extends Action\n> = <\n TType extends TInputAction['type'],\n THandledAction extends Extract<TInputAction, Action<TType>>,\n TOutputAction extends Exclude<TInputAction, THandledAction>\n>(\n singleOrMultipleCreatorsAndTypes: TType | TType[],\n reducer: (state: TState, action: THandledAction) => TState\n) => [TOutputAction] extends [Action]\n ? Reducer<TState, TRootAction> & {\n handlers: Record<\n Exclude<TRootAction, TOutputAction>['type'],\n (state: TState, action: TRootAction) => TState\n >;\n handleType: HandleTypeChainApi<TState, TOutputAction, TRootAction>;\n }\n : Reducer<TState, TRootAction> & {\n handlers: Record<\n TRootAction['type'],\n (state: TState, action: TRootAction) => TState\n >;\n };\n\ntype GetAction<\n TAction extends Action,\n TType extends TAction['type']\n> = TAction extends Action<TType> ? TAction : never;\n\ntype InitialHandler<TState, TRootAction extends Action> = {\n [P in TRootAction['type']]?: (\n state: TState,\n action: GetAction<TRootAction, P>\n ) => TState;\n};\n\ntype RootAction = Types extends { RootAction: infer T } ? T : any;\n\nexport function createReducer<TState, TRootAction extends Action = RootAction>(\n initialState: TState,\n initialHandlers: InitialHandler<TState, TRootAction> = {}\n) {\n const handlers: any = {\n ...initialHandlers,\n };\n\n const rootReducer: Reducer<TState, TRootAction> = (\n state = initialState,\n action: TRootAction\n ) => {\n if (handlers.hasOwnProperty(action.type)) {\n const reducer = handlers[action.type];\n if (typeof reducer !== 'function') {\n throw Error(\n `Reducer under \"${action.type}\" key is not a valid reducer`\n );\n }\n return reducer(state, action);\n } else {\n return state;\n }\n };\n\n const reducerHandler = ((\n singleOrMultipleCreatorsAndTypes: any,\n reducer: any\n ) => {\n const creatorsAndTypes = Array.isArray(singleOrMultipleCreatorsAndTypes)\n ? singleOrMultipleCreatorsAndTypes\n : [singleOrMultipleCreatorsAndTypes];\n\n const newHandlers: typeof handlers = {};\n\n creatorsAndTypes\n .map(\n (\n acOrType: TRootAction['type'] | ((...args: any[]) => TRootAction),\n index\n ) =>\n checkValidActionCreator(acOrType)\n ? getType(acOrType)\n : checkValidActionType(acOrType)\n ? acOrType\n : throwInvalidActionTypeOrActionCreator(index + 1)\n )\n .forEach(type => (newHandlers[type] = reducer));\n\n return createReducer<TState, TRootAction>(initialState, {\n ...handlers,\n ...newHandlers,\n });\n }) as\n | HandleActionChainApi<TState, TRootAction, TRootAction>\n | HandleTypeChainApi<TState, TRootAction, TRootAction>;\n\n const chainApi = Object.assign(rootReducer, {\n handlers: { ...handlers },\n handleAction: reducerHandler,\n handleType: reducerHandler,\n }) as Reducer<TState, TRootAction> &\n Readonly<{\n handlers: InitialHandler<TState, RootAction>;\n handleAction: [unknown] extends [TRootAction]\n ? any\n : HandleActionChainApi<TState, TRootAction, TRootAction>;\n handleType: [unknown] extends [TRootAction]\n ? any\n : HandleTypeChainApi<TState, TRootAction, TRootAction>;\n }>;\n\n return chainApi;\n}\n","import {\n checkInvalidActionTypeInArray,\n checkIsEmpty,\n throwIsEmpty,\n} from './utils/validation';\n/**\n * @description (curried assert function) check if action type is equal given type-constant\n * @description it works with discriminated union types\n */\nexport function isOfType<T extends string, A extends { type: string }>(\n type: T | T[],\n action: A\n): action is A extends { type: T } ? A : never;\n\n/**\n * @description (curried assert function) check if action type is equal given type-constant\n * @description it works with discriminated union types\n */\nexport function isOfType<T extends string>(\n type: T | T[]\n): <A extends { type: string }>(\n action: A\n) => action is A extends { type: T } ? A : never;\n\n/**\n * implementation\n */\nexport function isOfType<T extends string, A extends { type: T }>(\n actionTypeOrTypes: T | T[],\n action?: A\n) {\n if (checkIsEmpty(actionTypeOrTypes)) {\n throwIsEmpty(1);\n }\n\n const actionTypes = Array.isArray(actionTypeOrTypes)\n ? actionTypeOrTypes\n : [actionTypeOrTypes];\n\n actionTypes.forEach(checkInvalidActionTypeInArray);\n\n const assertFn = (_action: A) => actionTypes.includes(_action.type);\n\n // 1 arg case => return curried version\n if (action === undefined) {\n return assertFn;\n }\n // 2 args case => invoke assertFn and return the result\n return assertFn(action);\n}\n","import { ActionCreatorTypeMetadata } from './type-helpers';\nimport {\n checkInvalidActionCreatorInArray,\n checkIsEmpty,\n throwIsEmpty,\n} from './utils/validation';\n\nexport type ActionCreator<T extends { type: string }> = ((\n ...args: any[]\n) => T) &\n ActionCreatorTypeMetadata<T['type']>;\n\n/**\n * @description (curried assert function) check if an action is the instance of given action-creator(s)\n * @description it works with discriminated union types\n */\nexport function isActionOf<AC extends ActionCreator<{ type: string }>>(\n actionCreator: AC | AC[],\n action: { type: string }\n): action is ReturnType<AC>;\n\n/**\n * @description (curried assert function) check if an action is the instance of given action-creator(s)\n * @description it works with discriminated union types\n */\nexport function isActionOf<AC extends ActionCreator<{ type: string }>>(\n actionCreator: AC | AC[]\n): (action: { type: string }) => action is ReturnType<AC>;\n\n/**\n * implementation\n */\nexport function isActionOf<AC extends ActionCreator<{ type: string }>>(\n actionCreatorOrCreators: AC | AC[],\n action?: { type: string }\n) {\n if (checkIsEmpty(actionCreatorOrCreators)) {\n throwIsEmpty(1);\n }\n\n const actionCreators = Array.isArray(actionCreatorOrCreators)\n ? actionCreatorOrCreators\n : [actionCreatorOrCreators];\n\n actionCreators.forEach(checkInvalidActionCreatorInArray);\n\n const assertFn = (_action: { type: string }) =>\n actionCreators.some(\n actionCreator => _action.type === actionCreator.getType!()\n );\n\n // 1 arg case => return curried version\n if (action === undefined) {\n return assertFn;\n }\n // 2 args case => invoke assertFn and return the result\n return assertFn(action);\n}\n","import { TypeConstant, ActionCreator } from '../type-helpers';\nimport { action } from '../action';\n\nexport type PayloadMetaAction<\n T extends TypeConstant,\n P,\n M\n> = P extends undefined\n ? M extends undefined\n ? { type: T }\n : { type: T; meta: M }\n : M extends undefined\n ? { type: T; payload: P }\n : { type: T; payload: P; meta: M };\n\n/**\n * @description typesafe action-creator factory\n */\nexport function createAction<\n T extends TypeConstant,\n AC extends ActionCreator<T> = () => { type: T }\n>(\n type: T,\n createHandler?: (\n actionCallback: <P = undefined, M = undefined>(\n payload?: P,\n meta?: M\n ) => PayloadMetaAction<T, P, M>\n ) => AC\n): AC {\n // validation is already done in action function\n\n const actionCreator: AC =\n createHandler == null\n ? ((() => action(type)) as AC)\n : createHandler(action.bind(null, type) as Parameters<\n typeof createHandler\n >[0]);\n\n return Object.assign(actionCreator, {\n getType: () => type,\n // redux-actions compatibility\n toString: () => type,\n });\n}\n","import { ActionCreator, TypeConstant } from '../type-helpers';\nimport {\n checkIsEmpty,\n throwIsEmpty,\n checkInvalidActionType,\n throwInvalidActionType,\n} from '../utils/validation';\n\n/**\n * @description create custom action-creator using constructor function with injected type argument\n */\nexport function createCustomAction<\n T extends TypeConstant,\n AC extends ActionCreator<T> = () => { type: T }\n>(type: T, createHandler?: (type: T) => AC): AC {\n if (checkIsEmpty(type)) {\n throwIsEmpty(1);\n }\n\n if (checkInvalidActionType(type)) {\n throwInvalidActionType(1);\n }\n\n const actionCreator: AC =\n createHandler != null ? createHandler(type) : ((() => ({ type })) as AC);\n\n return Object.assign(actionCreator, {\n getType: () => type,\n // redux-actions compatibility\n toString: () => type,\n });\n}\n","import { TypeConstant, ActionCreatorBuilder } from '../type-helpers';\nimport {\n checkIsEmpty,\n throwIsEmpty,\n checkInvalidActionType,\n throwInvalidActionType,\n} from '../utils/validation';\nimport { createCustomAction } from './create-custom-action';\n\n/** @private */\nexport type ActionBuilderMap<\n TType extends TypeConstant,\n TActionProps extends any,\n TPayloadArg extends any = undefined,\n TMetaArg extends any = undefined\n> = [TMetaArg] extends [undefined]\n ? [TPayloadArg] extends [undefined]\n ? () => { type: TType } & TActionProps\n : (payload: TPayloadArg) => { type: TType } & TActionProps\n : (payload: TPayloadArg, meta: TMetaArg) => { type: TType } & TActionProps;\n\nexport interface ActionBuilder<T extends TypeConstant> {\n <P = undefined, M = undefined>(): ActionCreatorBuilder<T, P, M>;\n map<R, P = undefined, M = undefined>(\n fn: (payload: P, meta: M) => R\n ): ActionBuilderMap<T, R, P, M>;\n}\n\n/**\n * @description create an action-creator of a given function that contains hidden \"type\" metadata\n */\nexport function createStandardAction<T extends TypeConstant>(\n type: T\n): ActionBuilder<T> {\n if (checkIsEmpty(type)) {\n throwIsEmpty(1);\n }\n\n if (checkInvalidActionType(type)) {\n throwInvalidActionType(1);\n }\n\n function constructor<P, M = undefined>(): ActionCreatorBuilder<T, P, M> {\n return createCustomAction(type, _type => (payload: P, meta: M) => ({\n type: _type,\n payload,\n meta,\n })) as ActionCreatorBuilder<T, P, M>;\n }\n\n function map<R, P, M>(\n fn: (payload: P, meta: M) => R\n ): ActionBuilderMap<T, R, P, M> {\n return createCustomAction(type, _type => (payload: P, meta: M) =>\n Object.assign(fn(payload, meta), { type: _type })\n ) as ActionBuilderMap<T, R, P, M>;\n }\n\n return Object.assign(constructor, { map });\n}\n","import { createAction } from './create-action';\nimport { createCustomAction } from './create-custom-action';\nimport { createStandardAction } from './create-standard-action';\n\nexport default { createAction, createCustomAction, createStandardAction };\n"],"names":["checkIsEmpty","arg","throwIsEmpty","argPosition","Error","checkValidActionCreator","checkInvalidActionCreator","throwInvalidActionCreator","checkInvalidActionCreatorInArray","idx","getType","checkValidActionType","checkInvalidActionType","throwInvalidActionType","checkInvalidActionTypeInArray","throwInvalidActionTypeOrActionCreator","action","type","payload","meta","error","createCustomAction","createHandler","actionCreator","customProps","undefined","typeMeta","toString","Object","assign","createAction","payloadCreator","metaCreator","throwInvalidAsyncActionArgument","createAsyncAction","requestArg","successArg","failureArg","cancelArg","constructor","results","map","index","Array","isArray","request","success","failure","cancel","createReducer","initialState","initialHandlers","handlers","rootReducer","state","hasOwnProperty","reducer","reducerHandler","singleOrMultipleCreatorsAndTypes","creatorsAndTypes","newHandlers","acOrType","forEach","chainApi","handleAction","handleType","isOfType","actionTypeOrTypes","actionTypes","assertFn","_action","includes","isActionOf","actionCreatorOrCreators","actionCreators","some","bind","createStandardAction","_type","fn"],"mappings":";;;;;;aAMgBA,aAAaC;IAC3B,SAAOA,GAAG,IAAI,IAAd;IACD;AAED,aAAgBC,aAAaC;IAC3B,QAAM,IAAIC,KAAJ,eAAsBD,WAAtB,gBAAN;IACD;AAED,aAAgBE,wBACdJ;IAEA,SAAO,OAAOA,GAAP,KAAe,UAAf,IAA6B,aAAaA,GAAjD;IACD;AAED,aAAgBK,0BAA0BL;IACxC,SAAO,CAACI,uBAAuB,CAACJ,GAAD,CAA/B;IACD;AAED,aAAgBM,0BAA0BJ;IACxC,QAAM,IAAIC,KAAJ,eACQD,WADR,oFAAN;IAGD;AAED,aAAgBK,iCACdP,KACAQ;IAEA,MAAIR,GAAG,IAAI,IAAX,EAAiB;IACf,UAAM,IAAIG,KAAJ,0DACmDK,GADnD,CAAN;IAGD,GAJD,MAIO,IAAIR,GAAG,CAACS,OAAJ,IAAe,IAAnB,EAAyB;IAC9B,UAAM,IAAIN,KAAJ,4DAEqDK,GAFrD,yEAAN;IAID;IACF;AAED,aAAgBE,qBAAqBV;IACnC,SAAO,OAAOA,GAAP,KAAe,QAAf,IAA2B,OAAOA,GAAP,KAAe,QAAjD;IACD;AAED,aAAgBW,uBAAuBX;IACrC,SAAO,CAACU,oBAAoB,CAACV,GAAD,CAA5B;IACD;AAED,aAAgBY,uBAAuBV;IACrC,QAAM,IAAIC,KAAJ,eACQD,WADR,uEAAN;IAGD;AAED,aAAgBW,8BACdb,KACAQ;IAEA,MAAIR,GAAG,IAAI,IAAX,EAAiB;IACf,UAAM,IAAIG,KAAJ,0DACmDK,GADnD,CAAN;IAGD,GAJD,MAIO,IAAI,OAAOR,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