@apia/store 4.0.20 → 4.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/store.tsx","../src/index.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/ban-types */\
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/store.tsx","../src/index.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/ban-types */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport {\n configureStore,\n combineReducers,\n Reducer,\n Action,\n AnyAction,\n ReducersMapObject,\n createSlice,\n EnhancedStore,\n Dispatch,\n MiddlewareAPI,\n StoreEnhancer,\n SerializableStateInvariantMiddlewareOptions,\n ImmutableStateInvariantMiddlewareOptions,\n ThunkMiddleware,\n} from '@reduxjs/toolkit';\nimport { ReactNode } from 'react';\nimport { EqualityFn, Provider, useSelector } from 'react-redux';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst injectedReducers: ReducersMapObject<any, any> = {};\n\nconst store = configureStore({\n middleware: (getDefaultMiddleware) =>\n getDefaultMiddleware({\n serializableCheck: false,\n immutableCheck: false,\n }),\n devTools: false,\n reducer: combineReducers({\n defaultSlice: createSlice({\n name: 'defaultSlice',\n initialState: {},\n reducers: {\n update() {},\n },\n }).reducer,\n }),\n});\n\ntype TypedUseSelectorHook<TState> = <TSelected>(\n selector: (state: TState) => TSelected,\n equalityFn?: EqualityFn<TSelected>,\n) => TSelected;\n\n/**\n * Esta función permite agregar reducers al store en forma dinámica.\n *\n * @example\n *\n import { injectReducers, createSlice } from '@apia/store';\n\n const slice = createSlice({\n name: 'holaMundo',\n initialState: {\n hola: 'mundo',\n } as { hola: string },\n reducers: {\n updateMundo(state) {\n state.hola = 'world';\n },\n },\n });\n\n const store = injectReducers({\n holaMundo: slice.reducer,\n });\n\n store.dispatch(slice.actions.updateMundo());\n\n // Ahora el store dice hola: 'world'\n */\ntype Enhancers = readonly StoreEnhancer[];\ninterface ThunkOptions<E = any> {\n extraArgument: E;\n}\ninterface GetDefaultMiddlewareOptions {\n thunk?: boolean | ThunkOptions;\n immutableCheck?: boolean | ImmutableStateInvariantMiddlewareOptions;\n serializableCheck?: boolean | SerializableStateInvariantMiddlewareOptions;\n}\n\ntype ThunkMiddlewareFor<\n S,\n O extends GetDefaultMiddlewareOptions = {},\n> = O extends {\n thunk: false;\n}\n ? never\n : O extends {\n thunk: {\n extraArgument: infer E;\n };\n }\n ? ThunkMiddleware<S, AnyAction, E>\n : ThunkMiddleware<S>;\n\nexport type Middleware<S = any, D extends Dispatch = Dispatch> = (\n api: MiddlewareAPI<D, S>,\n) => (next: Dispatch) => (action: any) => any;\ntype Middlewares<S> = readonly Middleware<S>[];\n\nexport function injectReducers<\n S,\n A extends Action = AnyAction,\n M extends Middlewares<S> = [ThunkMiddlewareFor<S>],\n E extends Enhancers = [StoreEnhancer],\n>(reducers: ReducersMapObject<S, A>) {\n Object.entries(reducers).forEach(([name, value]) => {\n injectedReducers[name] = value as Reducer;\n });\n\n const newReducer = combineReducers(injectedReducers);\n store.replaceReducer(newReducer);\n const newUseSelector: TypedUseSelectorHook<S> = useSelector;\n\n return {\n store: store as EnhancedStore<S, A, M, E>,\n useSelector: newUseSelector,\n };\n}\n\nexport const StoreProvider = ({ children }: { children: ReactNode }) => {\n return <Provider store={store}>{children}</Provider>;\n};\n","/* eslint-disable no-restricted-imports */\n/* eslint-disable @typescript-eslint/no-unused-vars */\n\nimport * as store from 'react-redux';\n\nconst { useSelector: nomatter, ...reactReduxRest } = store;\nexport const reactRedux = {\n ...reactReduxRest,\n};\n\nexport type { Draft } from 'immer';\n\nexport { createSlice } from '@reduxjs/toolkit';\n\nexport type {\n PayloadAction,\n AnyAction,\n CaseReducer,\n SliceCaseReducers,\n Slice,\n} from '@reduxjs/toolkit';\n\nexport { shallowEqual } from 'react-redux';\n\nexport { StoreProvider, injectReducers } from './store';\n\nexport * as reduxjsToolkit from '@reduxjs/toolkit';\n"],"names":["store"],"mappings":";;;;;;;;;AAsBA,MAAM,mBAAgD,EAAC;AAEvD,MAAM,QAAQ,cAAA,CAAe;AAAA,EAC3B,UAAA,EAAY,CAAC,oBAAA,KACX,oBAAA,CAAqB;AAAA,IACnB,iBAAA,EAAmB,KAAA;AAAA,IACnB,cAAA,EAAgB;AAAA,GACjB,CAAA;AAAA,EACH,QAAA,EAAU,KAAA;AAAA,EACV,SAAS,eAAA,CAAgB;AAAA,IACvB,cAAc,WAAA,CAAY;AAAA,MACxB,IAAA,EAAM,cAAA;AAAA,MACN,cAAc,EAAC;AAAA,MACf,QAAA,EAAU;AAAA,QACR,MAAA,GAAS;AAAA;AAAC;AACZ,KACD,CAAA,CAAE;AAAA,GACJ;AACH,CAAC,CAAA;AAgEM,SAAS,eAKd,QAAA,EAAmC;AACnC,EAAA,MAAA,CAAO,OAAA,CAAQ,QAAQ,CAAA,CAAE,OAAA,CAAQ,CAAC,CAAC,IAAA,EAAM,KAAK,CAAA,KAAM;AAClD,IAAA,gBAAA,CAAiB,IAAI,CAAA,GAAI,KAAA;AAAA,GAC1B,CAAA;AAED,EAAA,MAAM,UAAA,GAAa,gBAAgB,gBAAgB,CAAA;AACnD,EAAA,KAAA,CAAM,eAAe,UAAU,CAAA;AAC/B,EAAA,MAAM,cAAA,GAA0C,WAAA;AAEhD,EAAA,OAAO;AAAA,IACL,KAAA;AAAA,IACA,WAAA,EAAa;AAAA,GACf;AACF;AAEO,MAAM,aAAA,GAAgB,CAAC,EAAE,QAAA,EAAS,KAA+B;AACtE,EAAA,uBAAO,GAAA,CAAC,QAAA,EAAA,EAAS,KAAA,EAAe,QAAA,EAAS,CAAA;AAC3C;;ACzHA,MAAM,EAAE,WAAA,EAAa,QAAA,EAAU,GAAG,gBAAe,GAAIA,OAAA;AAC9C,MAAM,UAAA,GAAa;AAAA,EACxB,GAAG;AACL;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apia/store",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.25",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"author": "Alexis Leite <alexisleite@live.com>",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
"libDev": "rollup --config ../../config/rollup.common.mjs --environment MODE:development,ENTRY:index.ts",
|
|
12
12
|
"libBuild": "rollup --config ../../config/rollup.common.mjs --environment MODE:production,ENTRY:index.ts",
|
|
13
13
|
"libWatch": "rollup --watch --config ../../config/rollup.common.mjs --environment MODE:development,ENTRY:index.ts,WATCH:true",
|
|
14
|
-
"
|
|
15
|
-
"
|
|
14
|
+
"libWatchForExecution": "rollup --watch --config ../../config/rollup.common.mjs --environment MODE:development,ENTRY:index.ts,WATCH:true,DEV_SERVER_MODULE:execution",
|
|
15
|
+
"libWatchForDashboards": "rollup --watch --config ../../config/rollup.common.mjs --environment MODE:development,ENTRY:index.ts,WATCH:true,DEV_SERVER_MODULE:dashboards"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@reduxjs/toolkit": "^1.9.3",
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"access": "public",
|
|
37
37
|
"registry": "https://registry.npmjs.org/"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "3e7ab497e829f8dbd6e9c2080b8606aa00f6e478"
|
|
40
40
|
}
|