@apia/store 0.3.3 → 1.0.1
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/LICENSE.md +20 -20
- package/README.md +22 -22
- package/cleanDist.json +3 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/LICENSE.md
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) [year] [fullname]
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) [year] [fullname]
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
# Initiator
|
|
2
|
-
|
|
3
|
-
Este package se creó con la única utilidad de copiarlo entero y pegarlo a la hora de crear un nuevo package.
|
|
4
|
-
|
|
5
|
-
Este iniciador permite crear un paquete que compila typescript y puede ser importado desde otros packages.
|
|
6
|
-
|
|
7
|
-
## IMPORTANTE
|
|
8
|
-
|
|
9
|
-
Los archivos **tsconfig.json** y **tsup.config.ts** no son archivos únicos sino symlinks a archivos de configuración comunes a todos los packages. En caso de que sea necesario modificar alguno de ellos **que en la gran mayoría de los casos no sería necesario**, es necesario eliminar el archivo a modificar y crear uno nuevo.
|
|
10
|
-
|
|
11
|
-
## Procedimiento
|
|
12
|
-
|
|
13
|
-
- Copiar la carpeta initiator y pegarla con otro nombre dentro de packages.
|
|
14
|
-
- Modificar el package.json:
|
|
15
|
-
- Eliminar la línea ```private: true```.
|
|
16
|
-
- Cambiar la ocurrencia `initiator` por el nombre del nuevo paquete.
|
|
17
|
-
- Agregar los scripts convenientes: dev, build, etc.
|
|
18
|
-
- Ejecutar el comando lerna bootstrap desde la carpeta raíz.
|
|
19
|
-
|
|
20
|
-
Luego de ejecutar estos pasos, el package estaría listo para comenzar a usarse.
|
|
21
|
-
|
|
22
|
-
Este package trae como dependencias por defecto theme-ui y react. Si se desea agregar más dependencias se debe ejecutar el comando ```lerna add --scope="@apia/packageName" dependencyName```. Ejemplo, si creamos un paquete con el nombre @apia/myPackage y queremos agregar lodash como dependencia, ejecutamos el comando ```lerna add --scope="@apia/myPackage" lodash```. **Importante**: lerna no permite instalar de a varias dependencias a la vez como lo hace npm, por lo tanto, si se desea agregar varias dependencias se debe ejecutar el comando anterior tantas veces como dependencias se quiera agregar.
|
|
1
|
+
# Initiator
|
|
2
|
+
|
|
3
|
+
Este package se creó con la única utilidad de copiarlo entero y pegarlo a la hora de crear un nuevo package.
|
|
4
|
+
|
|
5
|
+
Este iniciador permite crear un paquete que compila typescript y puede ser importado desde otros packages.
|
|
6
|
+
|
|
7
|
+
## IMPORTANTE
|
|
8
|
+
|
|
9
|
+
Los archivos **tsconfig.json** y **tsup.config.ts** no son archivos únicos sino symlinks a archivos de configuración comunes a todos los packages. En caso de que sea necesario modificar alguno de ellos **que en la gran mayoría de los casos no sería necesario**, es necesario eliminar el archivo a modificar y crear uno nuevo.
|
|
10
|
+
|
|
11
|
+
## Procedimiento
|
|
12
|
+
|
|
13
|
+
- Copiar la carpeta initiator y pegarla con otro nombre dentro de packages.
|
|
14
|
+
- Modificar el package.json:
|
|
15
|
+
- Eliminar la línea ```private: true```.
|
|
16
|
+
- Cambiar la ocurrencia `initiator` por el nombre del nuevo paquete.
|
|
17
|
+
- Agregar los scripts convenientes: dev, build, etc.
|
|
18
|
+
- Ejecutar el comando lerna bootstrap desde la carpeta raíz.
|
|
19
|
+
|
|
20
|
+
Luego de ejecutar estos pasos, el package estaría listo para comenzar a usarse.
|
|
21
|
+
|
|
22
|
+
Este package trae como dependencias por defecto theme-ui y react. Si se desea agregar más dependencias se debe ejecutar el comando ```lerna add --scope="@apia/packageName" dependencyName```. Ejemplo, si creamos un paquete con el nombre @apia/myPackage y queremos agregar lodash como dependencia, ejecutamos el comando ```lerna add --scope="@apia/myPackage" lodash```. **Importante**: lerna no permite instalar de a varias dependencias a la vez como lo hace npm, por lo tanto, si se desea agregar varias dependencias se debe ejecutar el comando anterior tantas veces como dependencias se quiera agregar.
|
package/cleanDist.json
ADDED
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\nexport const store = configureStore({\n devTools: {\n actionSanitizer: (action) => {\n if (\n [\n 'responsiveTableSlice/handleKey',\n 'responsiveTableSlice/update',\n 'responsiveTableSlice/addRows',\n ].includes(action.type as string)\n )\n return {\n ...action,\n payload: `Sanitized due to performance ${action.type as string}`,\n };\n return action;\n },\n },\n middleware: (defaultMiddleWare) => {\n return defaultMiddleWare({\n immutableCheck: {\n ignoredPaths: ['responsiveTableSlice'],\n },\n serializableCheck: {\n ignoredPaths: ['responsiveTableSlice', 'panelsSlice'],\n ignoredActions: [\n 'responsiveTableSlice/handleKey',\n 'responsiveTableSlice/update',\n 'responsiveTableSlice/addRows',\n 'panelsSlice/updatePanelStore',\n ],\n },\n });\n },\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":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,MAAM,mBAAgD,EAAC,CAAA;AAEhD,MAAM,QAAQ,cAAe,CAAA;AAAA,EAClC,QAAU,EAAA;AAAA,IACR,eAAA,EAAiB,CAAC,MAAW,KAAA;AAC3B,MACE,IAAA;AAAA,QACE,gCAAA;AAAA,QACA,6BAAA;AAAA,QACA,8BAAA;AAAA,OACF,CAAE,QAAS,CAAA,MAAA,CAAO,IAAc,CAAA;AAEhC,QAAA,OAAO,mCACF,MADE,CAAA,EAAA;AAAA,UAEL,OAAA,EAAS,gCAAgC,MAAO,CAAA,IAAA,CAAA,CAAA;AAAA,SAClD,CAAA,CAAA;AACF,MAAO,OAAA,MAAA,CAAA;AAAA,KACT;AAAA,GACF;AAAA,EACA,UAAA,EAAY,CAAC,iBAAsB,KAAA;AACjC,IAAA,OAAO,iBAAkB,CAAA;AA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,cAAnB,cAAA,GAAA,SAAA,CAAmB,IAAnB,CAA1B,aAAA,CAAA,EAAA;AACD,MAAM,aAAa,cACrB,CAAA,EAAA,EAAA,cAAA;;;;"}
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"main": "./dist/index.js",
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "1.0.1",
|
|
10
10
|
"scripts": {
|
|
11
11
|
"build": "rollup -c rollup.config.esb.mjs",
|
|
12
12
|
"buildDev": "rollup -c rollup.config.esb.mjs --dev",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"url": "http://corp-gitlab-01.domst.st.net/products/apia/ApiaNPMPackages.git",
|
|
47
47
|
"directory": "packages/store"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "a2430a210dacdfec4869e14b8fd438253b9c16a9"
|
|
50
50
|
}
|