├── .github └── workflows │ └── nodejs.yaml ├── .gitignore ├── .npmrc ├── README.md ├── jest.config.js ├── package-lock.json ├── package.json ├── src ├── _types.d.ts ├── immer.d.ts ├── immer.js ├── index.d.ts ├── index.js ├── reducer.d.ts ├── reducer.js ├── safe.d.ts └── safe.js ├── test ├── immer.test.ts ├── index.test.ts ├── reducer.test.ts ├── safe.test.ts ├── types-extract-utils.ts ├── types-index.ts └── types-safe.ts └── tsconfig.json /.github/workflows/nodejs.yaml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: [push] 4 | 5 | jobs: 6 | build: 7 | 8 | runs-on: ubuntu-latest 9 | 10 | strategy: 11 | matrix: 12 | node-version: [20.x] 13 | 14 | steps: 15 | - uses: actions/checkout@v3 16 | - name: Use Node.js ${{ matrix.node-version }} 17 | uses: actions/setup-node@v3 18 | with: 19 | node-version: ${{ matrix.node-version }} 20 | - name: install dependencies 21 | run: npm ci && npm run install-peers 22 | - name: check types 23 | run: npm run types 24 | - name: unit tests 25 | run: npm test 26 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | coverage 4 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | registry=https://registry.npmjs.org/ 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Rainbow actions 🌈 2 | 3 | [![npm version](https://img.shields.io/npm/v/rainbow-actions.svg?style=flat)](https://www.npmjs.com/package/rainbow-actions) 4 | [![npm license](https://img.shields.io/npm/l/rainbow-actions.svg?style=flat)](https://www.npmjs.com/package/rainbow-actions) 5 | 6 | This is **not** a project to reduce redux boilerplate. The project goal is to gather the same domain actions and action creators in namespaces by their domain purpose. 7 | 8 | ## Install 9 | 10 | ```shell 11 | npm install rainbow-actions 12 | ``` 13 | 14 | ## Basic usage 15 | 16 | ```typescript 17 | import {createActions} from 'rainbow-actions' 18 | 19 | type PostId = string 20 | 21 | type PayloadDictionary = { 22 | init: PostId; 23 | // ^^^^^^ action creator payload 24 | fulfill: {id: PostId; title: string}; 25 | error: {code: number}; 26 | fail: never; 27 | // ^^^^^ action creator has no payload 28 | } 29 | 30 | const requestPost = createActions()('get_post') 31 | 32 | /** 33 | * runtime value `'get_post_init'` 34 | * typescript type `'get_post_init'` 35 | */ 36 | const initType = requestPost.init.type 37 | 38 | /** 39 | * runtime value `{type: 'get_post_init', payload: '42'}` 40 | * typescript type `{type: 'get_post_init', payload: PostId}` 41 | */ 42 | const initAction = requestPost.init('42') 43 | ``` 44 | 45 | Typescript raises an error when one attempts to access a property of `requestPost` any other than the keys of `PayloadDictionary`. 46 | 47 | ## Extract action types 48 | 49 | ```typescript 50 | import {createActions, ExtractNamespaceActions, ExtractManyNamespaceActions} from 'rainbow-actions' 51 | 52 | type RequestPayloads = { 53 | init: number; 54 | get: string; 55 | end: never; 56 | } 57 | 58 | const request = createActions()('request') 59 | 60 | /** 61 | * To extract action types from a single namespace you can use `ExtractNamespaceActions` 62 | */ 63 | type Actions = ExtractNamespaceActions 64 | 65 | Actions // {type: 'request_init'; payload: number} | {type: 'request_get'; payload: string} | {type: 'request_end'} 66 | 67 | /** 68 | * To extract action types from multiple namespaces you can use `ExtractManyNamespaceActions` 69 | */ 70 | type AllActions = ExtractManyNamespaceActions<[typeof request, typeof anotherNamespace /*...etc*/]> 71 | ``` 72 | 73 | ## Advanced usage 74 | 75 | Note the object passed to the function after the action type base: 76 | 77 | ```typescript 78 | import {createActions} from 'rainbow-actions' 79 | 80 | type PayloadDictionary = { 81 | one: number; 82 | two: boolean; 83 | three: string; 84 | } 85 | 86 | /** 87 | * You can see that using the optional action dictionary argument you can define: 88 | * * payload - a function to generate/modify payload 89 | * * meta - a function to generate/modify meta information 90 | * * error - a flag for error actions 91 | * 92 | * You can define the ones you need or omit them alltogether 93 | */ 94 | const base = createActions()('base', { 95 | one: {payload: (id) => id * 2}, 96 | // ^^ the type inferred as number since we defined it in PayloadDictionary 97 | two: {meta: (flag) => `flag is ${flag}`}, 98 | three: {error: true}, 99 | }) 100 | 101 | /** 102 | * runtime value `{type: 'base_one', payload: 10}` 103 | * typescript type `{type: 'base_one', payload: number}` 104 | */ 105 | const one = base.one(5) 106 | 107 | /** 108 | * runtime value `{type: 'base_two', payload: true, meta: 'flag is true'}` 109 | * typescript type `{type: 'base_two', payload: boolean, meta: string}` 110 | */ 111 | const two = base.two(true) 112 | 113 | /** 114 | * runtime value `{type: 'base_three', payload: 'hey', error: true}` 115 | * typescript type `{type: 'base_three', payload: string, error: true}` 116 | */ 117 | const three = base.three('hey') 118 | ``` 119 | 120 | ## Caveat 121 | 122 | Both basic and advanced usage work using the Proxy object. This means if you are not 100% confident about your types, then developers may accidentally dispatch incorrect actions since any method on the created action namespace will be a valid action creator. If this sounds scary, worry no more, this package also provides a safe version. 123 | 124 | ## Safe usage 125 | 126 | If you prefer to avoid the Proxy usage or are not 100% confident in the typescript types in your project, you can use the safe version. It requires to pass all of the actions for the namespace to be accessible. 127 | 128 | ```typescript 129 | import {createActions} from 'rainbow-actions/safe' 130 | // note the import path ^^^^ 131 | 132 | type PayloadDictionary = { 133 | none: never; 134 | one: number; 135 | two: boolean; 136 | three: string; 137 | } 138 | 139 | const base = createActions()('base', { 140 | none: 0, 141 | // ^ if no creators are necessary, 0 can be a placeholer 142 | one: {payload: (id) => id * 2}, 143 | two: {meta: (flag) => `flag is ${flag}`}, 144 | three: {error: true}, 145 | }) 146 | 147 | /** 148 | * runtime value `{type: 'base_none'}` 149 | * typescript type `{type: 'base_none'}` 150 | */ 151 | const none = base.none() 152 | 153 | /** 154 | * runtime value `{type: 'base_one', payload: 10}` 155 | * typescript type `{type: 'base_one', payload: number}` 156 | */ 157 | const one = base.one(5) 158 | 159 | /** 160 | * runtime value `{type: 'base_two', payload: true, meta: 'flag is true'}` 161 | * typescript type `{type: 'base_two', payload: boolean, meta: string}` 162 | */ 163 | const two = base.two(true) 164 | 165 | /** 166 | * runtime value `{type: 'base_three', payload: 'hey', error: true}` 167 | * typescript type `{type: 'base_three', payload: string, error: true}` 168 | */ 169 | const three = base.three('hey') 170 | ``` 171 | 172 | ## Reducers 173 | 174 | There are two ways one may want to write reducers [redux-actions like](#redux-actions-like-reducers) or [immer way](#immer-reducers) 175 | 176 | ## Redux actions like reducers 177 | 178 | ```typescript 179 | import {handleActions} from 'rainbow-actions/reducer' 180 | import {request} from './actions' 181 | import type {Actions} from './actions' 182 | import type {State} from './state' 183 | 184 | const defaultState = {} 185 | 186 | export const reducer = handleActions( 187 | { 188 | [request.init.type]: (state, action) => ({ 189 | ...state, 190 | count: action.payload, 191 | isLoading: true, 192 | }) 193 | // other handlers 194 | }, 195 | defaultState, 196 | ) 197 | ``` 198 | 199 | ## Immer reducers 200 | 201 | On the other hand you can use [`immer`](https://github.com/immerjs/immer). Immer is a peer dependency and you have to have it installed in your project. 202 | 203 | ```typescript 204 | import {handleActions} from 'rainbow-actions/immer' 205 | import {request} from './actions' 206 | import type {Actions} from './actions' 207 | import type {State} from './state' 208 | 209 | const defaultState = {} 210 | 211 | export const reducer = handleActions( 212 | { 213 | [request.init.type]: (state, action) => { 214 | state.count = action.payload 215 | state.isLoading = true 216 | } 217 | // other handlers 218 | }, 219 | defaultState, 220 | ) 221 | ``` 222 | 223 | ## Acknowledgments 224 | 225 | This package is highly inspired by [typed-actions](https://github.com/lttb/typed-actions), [piler](https://github.com/lttb/piler) by [@lttb](https://github.com/lttb), and [immer](https://github.com/immerjs/immer) by [@mweststrate](https://github.com/mweststrate). 226 | -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | roots: ['/test'], 3 | preset: 'ts-jest', 4 | collectCoverageFrom: ['./src/*'], 5 | coverageThreshold: { 6 | global: { 7 | branches: 99, 8 | functions: 99, 9 | lines: 99, 10 | statements: 99, 11 | }, 12 | }, 13 | }; 14 | -------------------------------------------------------------------------------- /package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rainbow-actions", 3 | "version": "0.2.4", 4 | "lockfileVersion": 3, 5 | "requires": true, 6 | "packages": { 7 | "": { 8 | "name": "rainbow-actions", 9 | "version": "0.2.4", 10 | "license": "MIT", 11 | "devDependencies": { 12 | "copyfiles": "^2.4.1", 13 | "typescript": "^5.8.2", 14 | "vitest": "^3.1.1" 15 | }, 16 | "engines": { 17 | "node": ">=12" 18 | }, 19 | "funding": { 20 | "url": "https://github.com/sponsors/antonk52" 21 | }, 22 | "peerDependencies": { 23 | "immer": "^8.*.* || ^9.*.* || ^10.*.*" 24 | } 25 | }, 26 | "node_modules/@esbuild/aix-ppc64": { 27 | "version": "0.25.2", 28 | "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.2.tgz", 29 | "integrity": "sha512-wCIboOL2yXZym2cgm6mlA742s9QeJ8DjGVaL39dLN4rRwrOgOyYSnOaFPhKZGLb2ngj4EyfAFjsNJwPXZvseag==", 30 | "cpu": [ 31 | "ppc64" 32 | ], 33 | "dev": true, 34 | "license": "MIT", 35 | "optional": true, 36 | "os": [ 37 | "aix" 38 | ], 39 | "engines": { 40 | "node": ">=18" 41 | } 42 | }, 43 | "node_modules/@esbuild/android-arm": { 44 | "version": "0.25.2", 45 | "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.2.tgz", 46 | "integrity": "sha512-NQhH7jFstVY5x8CKbcfa166GoV0EFkaPkCKBQkdPJFvo5u+nGXLEH/ooniLb3QI8Fk58YAx7nsPLozUWfCBOJA==", 47 | "cpu": [ 48 | "arm" 49 | ], 50 | "dev": true, 51 | "license": "MIT", 52 | "optional": true, 53 | "os": [ 54 | "android" 55 | ], 56 | "engines": { 57 | "node": ">=18" 58 | } 59 | }, 60 | "node_modules/@esbuild/android-arm64": { 61 | "version": "0.25.2", 62 | "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.2.tgz", 63 | "integrity": "sha512-5ZAX5xOmTligeBaeNEPnPaeEuah53Id2tX4c2CVP3JaROTH+j4fnfHCkr1PjXMd78hMst+TlkfKcW/DlTq0i4w==", 64 | "cpu": [ 65 | "arm64" 66 | ], 67 | "dev": true, 68 | "license": "MIT", 69 | "optional": true, 70 | "os": [ 71 | "android" 72 | ], 73 | "engines": { 74 | "node": ">=18" 75 | } 76 | }, 77 | "node_modules/@esbuild/android-x64": { 78 | "version": "0.25.2", 79 | "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.2.tgz", 80 | "integrity": "sha512-Ffcx+nnma8Sge4jzddPHCZVRvIfQ0kMsUsCMcJRHkGJ1cDmhe4SsrYIjLUKn1xpHZybmOqCWwB0zQvsjdEHtkg==", 81 | "cpu": [ 82 | "x64" 83 | ], 84 | "dev": true, 85 | "license": "MIT", 86 | "optional": true, 87 | "os": [ 88 | "android" 89 | ], 90 | "engines": { 91 | "node": ">=18" 92 | } 93 | }, 94 | "node_modules/@esbuild/darwin-arm64": { 95 | "version": "0.25.2", 96 | "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.2.tgz", 97 | "integrity": "sha512-MpM6LUVTXAzOvN4KbjzU/q5smzryuoNjlriAIx+06RpecwCkL9JpenNzpKd2YMzLJFOdPqBpuub6eVRP5IgiSA==", 98 | "cpu": [ 99 | "arm64" 100 | ], 101 | "dev": true, 102 | "license": "MIT", 103 | "optional": true, 104 | "os": [ 105 | "darwin" 106 | ], 107 | "engines": { 108 | "node": ">=18" 109 | } 110 | }, 111 | "node_modules/@esbuild/darwin-x64": { 112 | "version": "0.25.2", 113 | "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.2.tgz", 114 | "integrity": "sha512-5eRPrTX7wFyuWe8FqEFPG2cU0+butQQVNcT4sVipqjLYQjjh8a8+vUTfgBKM88ObB85ahsnTwF7PSIt6PG+QkA==", 115 | "cpu": [ 116 | "x64" 117 | ], 118 | "dev": true, 119 | "license": "MIT", 120 | "optional": true, 121 | "os": [ 122 | "darwin" 123 | ], 124 | "engines": { 125 | "node": ">=18" 126 | } 127 | }, 128 | "node_modules/@esbuild/freebsd-arm64": { 129 | "version": "0.25.2", 130 | "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.2.tgz", 131 | "integrity": "sha512-mLwm4vXKiQ2UTSX4+ImyiPdiHjiZhIaE9QvC7sw0tZ6HoNMjYAqQpGyui5VRIi5sGd+uWq940gdCbY3VLvsO1w==", 132 | "cpu": [ 133 | "arm64" 134 | ], 135 | "dev": true, 136 | "license": "MIT", 137 | "optional": true, 138 | "os": [ 139 | "freebsd" 140 | ], 141 | "engines": { 142 | "node": ">=18" 143 | } 144 | }, 145 | "node_modules/@esbuild/freebsd-x64": { 146 | "version": "0.25.2", 147 | "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.2.tgz", 148 | "integrity": "sha512-6qyyn6TjayJSwGpm8J9QYYGQcRgc90nmfdUb0O7pp1s4lTY+9D0H9O02v5JqGApUyiHOtkz6+1hZNvNtEhbwRQ==", 149 | "cpu": [ 150 | "x64" 151 | ], 152 | "dev": true, 153 | "license": "MIT", 154 | "optional": true, 155 | "os": [ 156 | "freebsd" 157 | ], 158 | "engines": { 159 | "node": ">=18" 160 | } 161 | }, 162 | "node_modules/@esbuild/linux-arm": { 163 | "version": "0.25.2", 164 | "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.2.tgz", 165 | "integrity": "sha512-UHBRgJcmjJv5oeQF8EpTRZs/1knq6loLxTsjc3nxO9eXAPDLcWW55flrMVc97qFPbmZP31ta1AZVUKQzKTzb0g==", 166 | "cpu": [ 167 | "arm" 168 | ], 169 | "dev": true, 170 | "license": "MIT", 171 | "optional": true, 172 | "os": [ 173 | "linux" 174 | ], 175 | "engines": { 176 | "node": ">=18" 177 | } 178 | }, 179 | "node_modules/@esbuild/linux-arm64": { 180 | "version": "0.25.2", 181 | "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.2.tgz", 182 | "integrity": "sha512-gq/sjLsOyMT19I8obBISvhoYiZIAaGF8JpeXu1u8yPv8BE5HlWYobmlsfijFIZ9hIVGYkbdFhEqC0NvM4kNO0g==", 183 | "cpu": [ 184 | "arm64" 185 | ], 186 | "dev": true, 187 | "license": "MIT", 188 | "optional": true, 189 | "os": [ 190 | "linux" 191 | ], 192 | "engines": { 193 | "node": ">=18" 194 | } 195 | }, 196 | "node_modules/@esbuild/linux-ia32": { 197 | "version": "0.25.2", 198 | "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.2.tgz", 199 | "integrity": "sha512-bBYCv9obgW2cBP+2ZWfjYTU+f5cxRoGGQ5SeDbYdFCAZpYWrfjjfYwvUpP8MlKbP0nwZ5gyOU/0aUzZ5HWPuvQ==", 200 | "cpu": [ 201 | "ia32" 202 | ], 203 | "dev": true, 204 | "license": "MIT", 205 | "optional": true, 206 | "os": [ 207 | "linux" 208 | ], 209 | "engines": { 210 | "node": ">=18" 211 | } 212 | }, 213 | "node_modules/@esbuild/linux-loong64": { 214 | "version": "0.25.2", 215 | "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.2.tgz", 216 | "integrity": "sha512-SHNGiKtvnU2dBlM5D8CXRFdd+6etgZ9dXfaPCeJtz+37PIUlixvlIhI23L5khKXs3DIzAn9V8v+qb1TRKrgT5w==", 217 | "cpu": [ 218 | "loong64" 219 | ], 220 | "dev": true, 221 | "license": "MIT", 222 | "optional": true, 223 | "os": [ 224 | "linux" 225 | ], 226 | "engines": { 227 | "node": ">=18" 228 | } 229 | }, 230 | "node_modules/@esbuild/linux-mips64el": { 231 | "version": "0.25.2", 232 | "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.2.tgz", 233 | "integrity": "sha512-hDDRlzE6rPeoj+5fsADqdUZl1OzqDYow4TB4Y/3PlKBD0ph1e6uPHzIQcv2Z65u2K0kpeByIyAjCmjn1hJgG0Q==", 234 | "cpu": [ 235 | "mips64el" 236 | ], 237 | "dev": true, 238 | "license": "MIT", 239 | "optional": true, 240 | "os": [ 241 | "linux" 242 | ], 243 | "engines": { 244 | "node": ">=18" 245 | } 246 | }, 247 | "node_modules/@esbuild/linux-ppc64": { 248 | "version": "0.25.2", 249 | "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.2.tgz", 250 | "integrity": "sha512-tsHu2RRSWzipmUi9UBDEzc0nLc4HtpZEI5Ba+Omms5456x5WaNuiG3u7xh5AO6sipnJ9r4cRWQB2tUjPyIkc6g==", 251 | "cpu": [ 252 | "ppc64" 253 | ], 254 | "dev": true, 255 | "license": "MIT", 256 | "optional": true, 257 | "os": [ 258 | "linux" 259 | ], 260 | "engines": { 261 | "node": ">=18" 262 | } 263 | }, 264 | "node_modules/@esbuild/linux-riscv64": { 265 | "version": "0.25.2", 266 | "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.2.tgz", 267 | "integrity": "sha512-k4LtpgV7NJQOml/10uPU0s4SAXGnowi5qBSjaLWMojNCUICNu7TshqHLAEbkBdAszL5TabfvQ48kK84hyFzjnw==", 268 | "cpu": [ 269 | "riscv64" 270 | ], 271 | "dev": true, 272 | "license": "MIT", 273 | "optional": true, 274 | "os": [ 275 | "linux" 276 | ], 277 | "engines": { 278 | "node": ">=18" 279 | } 280 | }, 281 | "node_modules/@esbuild/linux-s390x": { 282 | "version": "0.25.2", 283 | "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.2.tgz", 284 | "integrity": "sha512-GRa4IshOdvKY7M/rDpRR3gkiTNp34M0eLTaC1a08gNrh4u488aPhuZOCpkF6+2wl3zAN7L7XIpOFBhnaE3/Q8Q==", 285 | "cpu": [ 286 | "s390x" 287 | ], 288 | "dev": true, 289 | "license": "MIT", 290 | "optional": true, 291 | "os": [ 292 | "linux" 293 | ], 294 | "engines": { 295 | "node": ">=18" 296 | } 297 | }, 298 | "node_modules/@esbuild/linux-x64": { 299 | "version": "0.25.2", 300 | "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.2.tgz", 301 | "integrity": "sha512-QInHERlqpTTZ4FRB0fROQWXcYRD64lAoiegezDunLpalZMjcUcld3YzZmVJ2H/Cp0wJRZ8Xtjtj0cEHhYc/uUg==", 302 | "cpu": [ 303 | "x64" 304 | ], 305 | "dev": true, 306 | "license": "MIT", 307 | "optional": true, 308 | "os": [ 309 | "linux" 310 | ], 311 | "engines": { 312 | "node": ">=18" 313 | } 314 | }, 315 | "node_modules/@esbuild/netbsd-arm64": { 316 | "version": "0.25.2", 317 | "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.2.tgz", 318 | "integrity": "sha512-talAIBoY5M8vHc6EeI2WW9d/CkiO9MQJ0IOWX8hrLhxGbro/vBXJvaQXefW2cP0z0nQVTdQ/eNyGFV1GSKrxfw==", 319 | "cpu": [ 320 | "arm64" 321 | ], 322 | "dev": true, 323 | "license": "MIT", 324 | "optional": true, 325 | "os": [ 326 | "netbsd" 327 | ], 328 | "engines": { 329 | "node": ">=18" 330 | } 331 | }, 332 | "node_modules/@esbuild/netbsd-x64": { 333 | "version": "0.25.2", 334 | "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.2.tgz", 335 | "integrity": "sha512-voZT9Z+tpOxrvfKFyfDYPc4DO4rk06qamv1a/fkuzHpiVBMOhpjK+vBmWM8J1eiB3OLSMFYNaOaBNLXGChf5tg==", 336 | "cpu": [ 337 | "x64" 338 | ], 339 | "dev": true, 340 | "license": "MIT", 341 | "optional": true, 342 | "os": [ 343 | "netbsd" 344 | ], 345 | "engines": { 346 | "node": ">=18" 347 | } 348 | }, 349 | "node_modules/@esbuild/openbsd-arm64": { 350 | "version": "0.25.2", 351 | "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.2.tgz", 352 | "integrity": "sha512-dcXYOC6NXOqcykeDlwId9kB6OkPUxOEqU+rkrYVqJbK2hagWOMrsTGsMr8+rW02M+d5Op5NNlgMmjzecaRf7Tg==", 353 | "cpu": [ 354 | "arm64" 355 | ], 356 | "dev": true, 357 | "license": "MIT", 358 | "optional": true, 359 | "os": [ 360 | "openbsd" 361 | ], 362 | "engines": { 363 | "node": ">=18" 364 | } 365 | }, 366 | "node_modules/@esbuild/openbsd-x64": { 367 | "version": "0.25.2", 368 | "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.2.tgz", 369 | "integrity": "sha512-t/TkWwahkH0Tsgoq1Ju7QfgGhArkGLkF1uYz8nQS/PPFlXbP5YgRpqQR3ARRiC2iXoLTWFxc6DJMSK10dVXluw==", 370 | "cpu": [ 371 | "x64" 372 | ], 373 | "dev": true, 374 | "license": "MIT", 375 | "optional": true, 376 | "os": [ 377 | "openbsd" 378 | ], 379 | "engines": { 380 | "node": ">=18" 381 | } 382 | }, 383 | "node_modules/@esbuild/sunos-x64": { 384 | "version": "0.25.2", 385 | "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.2.tgz", 386 | "integrity": "sha512-cfZH1co2+imVdWCjd+D1gf9NjkchVhhdpgb1q5y6Hcv9TP6Zi9ZG/beI3ig8TvwT9lH9dlxLq5MQBBgwuj4xvA==", 387 | "cpu": [ 388 | "x64" 389 | ], 390 | "dev": true, 391 | "license": "MIT", 392 | "optional": true, 393 | "os": [ 394 | "sunos" 395 | ], 396 | "engines": { 397 | "node": ">=18" 398 | } 399 | }, 400 | "node_modules/@esbuild/win32-arm64": { 401 | "version": "0.25.2", 402 | "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.2.tgz", 403 | "integrity": "sha512-7Loyjh+D/Nx/sOTzV8vfbB3GJuHdOQyrOryFdZvPHLf42Tk9ivBU5Aedi7iyX+x6rbn2Mh68T4qq1SDqJBQO5Q==", 404 | "cpu": [ 405 | "arm64" 406 | ], 407 | "dev": true, 408 | "license": "MIT", 409 | "optional": true, 410 | "os": [ 411 | "win32" 412 | ], 413 | "engines": { 414 | "node": ">=18" 415 | } 416 | }, 417 | "node_modules/@esbuild/win32-ia32": { 418 | "version": "0.25.2", 419 | "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.2.tgz", 420 | "integrity": "sha512-WRJgsz9un0nqZJ4MfhabxaD9Ft8KioqU3JMinOTvobbX6MOSUigSBlogP8QB3uxpJDsFS6yN+3FDBdqE5lg9kg==", 421 | "cpu": [ 422 | "ia32" 423 | ], 424 | "dev": true, 425 | "license": "MIT", 426 | "optional": true, 427 | "os": [ 428 | "win32" 429 | ], 430 | "engines": { 431 | "node": ">=18" 432 | } 433 | }, 434 | "node_modules/@esbuild/win32-x64": { 435 | "version": "0.25.2", 436 | "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.2.tgz", 437 | "integrity": "sha512-kM3HKb16VIXZyIeVrM1ygYmZBKybX8N4p754bw390wGO3Tf2j4L2/WYL+4suWujpgf6GBYs3jv7TyUivdd05JA==", 438 | "cpu": [ 439 | "x64" 440 | ], 441 | "dev": true, 442 | "license": "MIT", 443 | "optional": true, 444 | "os": [ 445 | "win32" 446 | ], 447 | "engines": { 448 | "node": ">=18" 449 | } 450 | }, 451 | "node_modules/@jridgewell/sourcemap-codec": { 452 | "version": "1.5.0", 453 | "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", 454 | "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", 455 | "dev": true, 456 | "license": "MIT" 457 | }, 458 | "node_modules/@rollup/rollup-android-arm-eabi": { 459 | "version": "4.39.0", 460 | "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.39.0.tgz", 461 | "integrity": "sha512-lGVys55Qb00Wvh8DMAocp5kIcaNzEFTmGhfFd88LfaogYTRKrdxgtlO5H6S49v2Nd8R2C6wLOal0qv6/kCkOwA==", 462 | "cpu": [ 463 | "arm" 464 | ], 465 | "dev": true, 466 | "license": "MIT", 467 | "optional": true, 468 | "os": [ 469 | "android" 470 | ] 471 | }, 472 | "node_modules/@rollup/rollup-android-arm64": { 473 | "version": "4.39.0", 474 | "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.39.0.tgz", 475 | "integrity": "sha512-It9+M1zE31KWfqh/0cJLrrsCPiF72PoJjIChLX+rEcujVRCb4NLQ5QzFkzIZW8Kn8FTbvGQBY5TkKBau3S8cCQ==", 476 | "cpu": [ 477 | "arm64" 478 | ], 479 | "dev": true, 480 | "license": "MIT", 481 | "optional": true, 482 | "os": [ 483 | "android" 484 | ] 485 | }, 486 | "node_modules/@rollup/rollup-darwin-arm64": { 487 | "version": "4.39.0", 488 | "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.39.0.tgz", 489 | "integrity": "sha512-lXQnhpFDOKDXiGxsU9/l8UEGGM65comrQuZ+lDcGUx+9YQ9dKpF3rSEGepyeR5AHZ0b5RgiligsBhWZfSSQh8Q==", 490 | "cpu": [ 491 | "arm64" 492 | ], 493 | "dev": true, 494 | "license": "MIT", 495 | "optional": true, 496 | "os": [ 497 | "darwin" 498 | ] 499 | }, 500 | "node_modules/@rollup/rollup-darwin-x64": { 501 | "version": "4.39.0", 502 | "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.39.0.tgz", 503 | "integrity": "sha512-mKXpNZLvtEbgu6WCkNij7CGycdw9cJi2k9v0noMb++Vab12GZjFgUXD69ilAbBh034Zwn95c2PNSz9xM7KYEAQ==", 504 | "cpu": [ 505 | "x64" 506 | ], 507 | "dev": true, 508 | "license": "MIT", 509 | "optional": true, 510 | "os": [ 511 | "darwin" 512 | ] 513 | }, 514 | "node_modules/@rollup/rollup-freebsd-arm64": { 515 | "version": "4.39.0", 516 | "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.39.0.tgz", 517 | "integrity": "sha512-jivRRlh2Lod/KvDZx2zUR+I4iBfHcu2V/BA2vasUtdtTN2Uk3jfcZczLa81ESHZHPHy4ih3T/W5rPFZ/hX7RtQ==", 518 | "cpu": [ 519 | "arm64" 520 | ], 521 | "dev": true, 522 | "license": "MIT", 523 | "optional": true, 524 | "os": [ 525 | "freebsd" 526 | ] 527 | }, 528 | "node_modules/@rollup/rollup-freebsd-x64": { 529 | "version": "4.39.0", 530 | "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.39.0.tgz", 531 | "integrity": "sha512-8RXIWvYIRK9nO+bhVz8DwLBepcptw633gv/QT4015CpJ0Ht8punmoHU/DuEd3iw9Hr8UwUV+t+VNNuZIWYeY7Q==", 532 | "cpu": [ 533 | "x64" 534 | ], 535 | "dev": true, 536 | "license": "MIT", 537 | "optional": true, 538 | "os": [ 539 | "freebsd" 540 | ] 541 | }, 542 | "node_modules/@rollup/rollup-linux-arm-gnueabihf": { 543 | "version": "4.39.0", 544 | "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.39.0.tgz", 545 | "integrity": "sha512-mz5POx5Zu58f2xAG5RaRRhp3IZDK7zXGk5sdEDj4o96HeaXhlUwmLFzNlc4hCQi5sGdR12VDgEUqVSHer0lI9g==", 546 | "cpu": [ 547 | "arm" 548 | ], 549 | "dev": true, 550 | "license": "MIT", 551 | "optional": true, 552 | "os": [ 553 | "linux" 554 | ] 555 | }, 556 | "node_modules/@rollup/rollup-linux-arm-musleabihf": { 557 | "version": "4.39.0", 558 | "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.39.0.tgz", 559 | "integrity": "sha512-+YDwhM6gUAyakl0CD+bMFpdmwIoRDzZYaTWV3SDRBGkMU/VpIBYXXEvkEcTagw/7VVkL2vA29zU4UVy1mP0/Yw==", 560 | "cpu": [ 561 | "arm" 562 | ], 563 | "dev": true, 564 | "license": "MIT", 565 | "optional": true, 566 | "os": [ 567 | "linux" 568 | ] 569 | }, 570 | "node_modules/@rollup/rollup-linux-arm64-gnu": { 571 | "version": "4.39.0", 572 | "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.39.0.tgz", 573 | "integrity": "sha512-EKf7iF7aK36eEChvlgxGnk7pdJfzfQbNvGV/+l98iiMwU23MwvmV0Ty3pJ0p5WQfm3JRHOytSIqD9LB7Bq7xdQ==", 574 | "cpu": [ 575 | "arm64" 576 | ], 577 | "dev": true, 578 | "license": "MIT", 579 | "optional": true, 580 | "os": [ 581 | "linux" 582 | ] 583 | }, 584 | "node_modules/@rollup/rollup-linux-arm64-musl": { 585 | "version": "4.39.0", 586 | "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.39.0.tgz", 587 | "integrity": "sha512-vYanR6MtqC7Z2SNr8gzVnzUul09Wi1kZqJaek3KcIlI/wq5Xtq4ZPIZ0Mr/st/sv/NnaPwy/D4yXg5x0B3aUUA==", 588 | "cpu": [ 589 | "arm64" 590 | ], 591 | "dev": true, 592 | "license": "MIT", 593 | "optional": true, 594 | "os": [ 595 | "linux" 596 | ] 597 | }, 598 | "node_modules/@rollup/rollup-linux-loongarch64-gnu": { 599 | "version": "4.39.0", 600 | "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.39.0.tgz", 601 | "integrity": "sha512-NMRUT40+h0FBa5fb+cpxtZoGAggRem16ocVKIv5gDB5uLDgBIwrIsXlGqYbLwW8YyO3WVTk1FkFDjMETYlDqiw==", 602 | "cpu": [ 603 | "loong64" 604 | ], 605 | "dev": true, 606 | "license": "MIT", 607 | "optional": true, 608 | "os": [ 609 | "linux" 610 | ] 611 | }, 612 | "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { 613 | "version": "4.39.0", 614 | "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.39.0.tgz", 615 | "integrity": "sha512-0pCNnmxgduJ3YRt+D+kJ6Ai/r+TaePu9ZLENl+ZDV/CdVczXl95CbIiwwswu4L+K7uOIGf6tMo2vm8uadRaICQ==", 616 | "cpu": [ 617 | "ppc64" 618 | ], 619 | "dev": true, 620 | "license": "MIT", 621 | "optional": true, 622 | "os": [ 623 | "linux" 624 | ] 625 | }, 626 | "node_modules/@rollup/rollup-linux-riscv64-gnu": { 627 | "version": "4.39.0", 628 | "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.39.0.tgz", 629 | "integrity": "sha512-t7j5Zhr7S4bBtksT73bO6c3Qa2AV/HqiGlj9+KB3gNF5upcVkx+HLgxTm8DK4OkzsOYqbdqbLKwvGMhylJCPhQ==", 630 | "cpu": [ 631 | "riscv64" 632 | ], 633 | "dev": true, 634 | "license": "MIT", 635 | "optional": true, 636 | "os": [ 637 | "linux" 638 | ] 639 | }, 640 | "node_modules/@rollup/rollup-linux-riscv64-musl": { 641 | "version": "4.39.0", 642 | "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.39.0.tgz", 643 | "integrity": "sha512-m6cwI86IvQ7M93MQ2RF5SP8tUjD39Y7rjb1qjHgYh28uAPVU8+k/xYWvxRO3/tBN2pZkSMa5RjnPuUIbrwVxeA==", 644 | "cpu": [ 645 | "riscv64" 646 | ], 647 | "dev": true, 648 | "license": "MIT", 649 | "optional": true, 650 | "os": [ 651 | "linux" 652 | ] 653 | }, 654 | "node_modules/@rollup/rollup-linux-s390x-gnu": { 655 | "version": "4.39.0", 656 | "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.39.0.tgz", 657 | "integrity": "sha512-iRDJd2ebMunnk2rsSBYlsptCyuINvxUfGwOUldjv5M4tpa93K8tFMeYGpNk2+Nxl+OBJnBzy2/JCscGeO507kA==", 658 | "cpu": [ 659 | "s390x" 660 | ], 661 | "dev": true, 662 | "license": "MIT", 663 | "optional": true, 664 | "os": [ 665 | "linux" 666 | ] 667 | }, 668 | "node_modules/@rollup/rollup-linux-x64-gnu": { 669 | "version": "4.39.0", 670 | "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.39.0.tgz", 671 | "integrity": "sha512-t9jqYw27R6Lx0XKfEFe5vUeEJ5pF3SGIM6gTfONSMb7DuG6z6wfj2yjcoZxHg129veTqU7+wOhY6GX8wmf90dA==", 672 | "cpu": [ 673 | "x64" 674 | ], 675 | "dev": true, 676 | "license": "MIT", 677 | "optional": true, 678 | "os": [ 679 | "linux" 680 | ] 681 | }, 682 | "node_modules/@rollup/rollup-linux-x64-musl": { 683 | "version": "4.39.0", 684 | "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.39.0.tgz", 685 | "integrity": "sha512-ThFdkrFDP55AIsIZDKSBWEt/JcWlCzydbZHinZ0F/r1h83qbGeenCt/G/wG2O0reuENDD2tawfAj2s8VK7Bugg==", 686 | "cpu": [ 687 | "x64" 688 | ], 689 | "dev": true, 690 | "license": "MIT", 691 | "optional": true, 692 | "os": [ 693 | "linux" 694 | ] 695 | }, 696 | "node_modules/@rollup/rollup-win32-arm64-msvc": { 697 | "version": "4.39.0", 698 | "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.39.0.tgz", 699 | "integrity": "sha512-jDrLm6yUtbOg2TYB3sBF3acUnAwsIksEYjLeHL+TJv9jg+TmTwdyjnDex27jqEMakNKf3RwwPahDIt7QXCSqRQ==", 700 | "cpu": [ 701 | "arm64" 702 | ], 703 | "dev": true, 704 | "license": "MIT", 705 | "optional": true, 706 | "os": [ 707 | "win32" 708 | ] 709 | }, 710 | "node_modules/@rollup/rollup-win32-ia32-msvc": { 711 | "version": "4.39.0", 712 | "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.39.0.tgz", 713 | "integrity": "sha512-6w9uMuza+LbLCVoNKL5FSLE7yvYkq9laSd09bwS0tMjkwXrmib/4KmoJcrKhLWHvw19mwU+33ndC69T7weNNjQ==", 714 | "cpu": [ 715 | "ia32" 716 | ], 717 | "dev": true, 718 | "license": "MIT", 719 | "optional": true, 720 | "os": [ 721 | "win32" 722 | ] 723 | }, 724 | "node_modules/@rollup/rollup-win32-x64-msvc": { 725 | "version": "4.39.0", 726 | "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.39.0.tgz", 727 | "integrity": "sha512-yAkUOkIKZlK5dl7u6dg897doBgLXmUHhIINM2c+sND3DZwnrdQkkSiDh7N75Ll4mM4dxSkYfXqU9fW3lLkMFug==", 728 | "cpu": [ 729 | "x64" 730 | ], 731 | "dev": true, 732 | "license": "MIT", 733 | "optional": true, 734 | "os": [ 735 | "win32" 736 | ] 737 | }, 738 | "node_modules/@types/estree": { 739 | "version": "1.0.7", 740 | "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.7.tgz", 741 | "integrity": "sha512-w28IoSUCJpidD/TGviZwwMJckNESJZXFu7NBZ5YJ4mEUnNraUn9Pm8HSZm/jDF1pDWYKspWE7oVphigUPRakIQ==", 742 | "dev": true, 743 | "license": "MIT" 744 | }, 745 | "node_modules/@types/node": { 746 | "version": "22.14.0", 747 | "resolved": "https://registry.npmjs.org/@types/node/-/node-22.14.0.tgz", 748 | "integrity": "sha512-Kmpl+z84ILoG+3T/zQFyAJsU6EPTmOCj8/2+83fSN6djd6I4o7uOuGIH6vq3PrjY5BGitSbFuMN18j3iknubbA==", 749 | "dev": true, 750 | "license": "MIT", 751 | "optional": true, 752 | "peer": true, 753 | "dependencies": { 754 | "undici-types": "~6.21.0" 755 | } 756 | }, 757 | "node_modules/@vitest/expect": { 758 | "version": "3.1.1", 759 | "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-3.1.1.tgz", 760 | "integrity": "sha512-q/zjrW9lgynctNbwvFtQkGK9+vvHA5UzVi2V8APrp1C6fG6/MuYYkmlx4FubuqLycCeSdHD5aadWfua/Vr0EUA==", 761 | "dev": true, 762 | "license": "MIT", 763 | "dependencies": { 764 | "@vitest/spy": "3.1.1", 765 | "@vitest/utils": "3.1.1", 766 | "chai": "^5.2.0", 767 | "tinyrainbow": "^2.0.0" 768 | }, 769 | "funding": { 770 | "url": "https://opencollective.com/vitest" 771 | } 772 | }, 773 | "node_modules/@vitest/mocker": { 774 | "version": "3.1.1", 775 | "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-3.1.1.tgz", 776 | "integrity": "sha512-bmpJJm7Y7i9BBELlLuuM1J1Q6EQ6K5Ye4wcyOpOMXMcePYKSIYlpcrCm4l/O6ja4VJA5G2aMJiuZkZdnxlC3SA==", 777 | "dev": true, 778 | "license": "MIT", 779 | "dependencies": { 780 | "@vitest/spy": "3.1.1", 781 | "estree-walker": "^3.0.3", 782 | "magic-string": "^0.30.17" 783 | }, 784 | "funding": { 785 | "url": "https://opencollective.com/vitest" 786 | }, 787 | "peerDependencies": { 788 | "msw": "^2.4.9", 789 | "vite": "^5.0.0 || ^6.0.0" 790 | }, 791 | "peerDependenciesMeta": { 792 | "msw": { 793 | "optional": true 794 | }, 795 | "vite": { 796 | "optional": true 797 | } 798 | } 799 | }, 800 | "node_modules/@vitest/pretty-format": { 801 | "version": "3.1.1", 802 | "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-3.1.1.tgz", 803 | "integrity": "sha512-dg0CIzNx+hMMYfNmSqJlLSXEmnNhMswcn3sXO7Tpldr0LiGmg3eXdLLhwkv2ZqgHb/d5xg5F7ezNFRA1fA13yA==", 804 | "dev": true, 805 | "license": "MIT", 806 | "dependencies": { 807 | "tinyrainbow": "^2.0.0" 808 | }, 809 | "funding": { 810 | "url": "https://opencollective.com/vitest" 811 | } 812 | }, 813 | "node_modules/@vitest/runner": { 814 | "version": "3.1.1", 815 | "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-3.1.1.tgz", 816 | "integrity": "sha512-X/d46qzJuEDO8ueyjtKfxffiXraPRfmYasoC4i5+mlLEJ10UvPb0XH5M9C3gWuxd7BAQhpK42cJgJtq53YnWVA==", 817 | "dev": true, 818 | "license": "MIT", 819 | "dependencies": { 820 | "@vitest/utils": "3.1.1", 821 | "pathe": "^2.0.3" 822 | }, 823 | "funding": { 824 | "url": "https://opencollective.com/vitest" 825 | } 826 | }, 827 | "node_modules/@vitest/snapshot": { 828 | "version": "3.1.1", 829 | "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-3.1.1.tgz", 830 | "integrity": "sha512-bByMwaVWe/+1WDf9exFxWWgAixelSdiwo2p33tpqIlM14vW7PRV5ppayVXtfycqze4Qhtwag5sVhX400MLBOOw==", 831 | "dev": true, 832 | "license": "MIT", 833 | "dependencies": { 834 | "@vitest/pretty-format": "3.1.1", 835 | "magic-string": "^0.30.17", 836 | "pathe": "^2.0.3" 837 | }, 838 | "funding": { 839 | "url": "https://opencollective.com/vitest" 840 | } 841 | }, 842 | "node_modules/@vitest/spy": { 843 | "version": "3.1.1", 844 | "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-3.1.1.tgz", 845 | "integrity": "sha512-+EmrUOOXbKzLkTDwlsc/xrwOlPDXyVk3Z6P6K4oiCndxz7YLpp/0R0UsWVOKT0IXWjjBJuSMk6D27qipaupcvQ==", 846 | "dev": true, 847 | "license": "MIT", 848 | "dependencies": { 849 | "tinyspy": "^3.0.2" 850 | }, 851 | "funding": { 852 | "url": "https://opencollective.com/vitest" 853 | } 854 | }, 855 | "node_modules/@vitest/utils": { 856 | "version": "3.1.1", 857 | "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-3.1.1.tgz", 858 | "integrity": "sha512-1XIjflyaU2k3HMArJ50bwSh3wKWPD6Q47wz/NUSmRV0zNywPc4w79ARjg/i/aNINHwA+mIALhUVqD9/aUvZNgg==", 859 | "dev": true, 860 | "license": "MIT", 861 | "dependencies": { 862 | "@vitest/pretty-format": "3.1.1", 863 | "loupe": "^3.1.3", 864 | "tinyrainbow": "^2.0.0" 865 | }, 866 | "funding": { 867 | "url": "https://opencollective.com/vitest" 868 | } 869 | }, 870 | "node_modules/ansi-regex": { 871 | "version": "5.0.1", 872 | "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", 873 | "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", 874 | "dev": true, 875 | "license": "MIT", 876 | "engines": { 877 | "node": ">=8" 878 | } 879 | }, 880 | "node_modules/assertion-error": { 881 | "version": "2.0.1", 882 | "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz", 883 | "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==", 884 | "dev": true, 885 | "license": "MIT", 886 | "engines": { 887 | "node": ">=12" 888 | } 889 | }, 890 | "node_modules/balanced-match": { 891 | "version": "1.0.0", 892 | "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", 893 | "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", 894 | "dev": true 895 | }, 896 | "node_modules/brace-expansion": { 897 | "version": "1.1.11", 898 | "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", 899 | "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", 900 | "dev": true, 901 | "dependencies": { 902 | "balanced-match": "^1.0.0", 903 | "concat-map": "0.0.1" 904 | } 905 | }, 906 | "node_modules/cac": { 907 | "version": "6.7.14", 908 | "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz", 909 | "integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==", 910 | "dev": true, 911 | "license": "MIT", 912 | "engines": { 913 | "node": ">=8" 914 | } 915 | }, 916 | "node_modules/chai": { 917 | "version": "5.2.0", 918 | "resolved": "https://registry.npmjs.org/chai/-/chai-5.2.0.tgz", 919 | "integrity": "sha512-mCuXncKXk5iCLhfhwTc0izo0gtEmpz5CtG2y8GiOINBlMVS6v8TMRc5TaLWKS6692m9+dVVfzgeVxR5UxWHTYw==", 920 | "dev": true, 921 | "license": "MIT", 922 | "dependencies": { 923 | "assertion-error": "^2.0.1", 924 | "check-error": "^2.1.1", 925 | "deep-eql": "^5.0.1", 926 | "loupe": "^3.1.0", 927 | "pathval": "^2.0.0" 928 | }, 929 | "engines": { 930 | "node": ">=12" 931 | } 932 | }, 933 | "node_modules/check-error": { 934 | "version": "2.1.1", 935 | "resolved": "https://registry.npmjs.org/check-error/-/check-error-2.1.1.tgz", 936 | "integrity": "sha512-OAlb+T7V4Op9OwdkjmguYRqncdlx5JiofwOAUkmTF+jNdHwzTaTs4sRAGpzLF3oOz5xAyDGrPgeIDFQmDOTiJw==", 937 | "dev": true, 938 | "license": "MIT", 939 | "engines": { 940 | "node": ">= 16" 941 | } 942 | }, 943 | "node_modules/concat-map": { 944 | "version": "0.0.1", 945 | "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", 946 | "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", 947 | "dev": true 948 | }, 949 | "node_modules/copyfiles": { 950 | "version": "2.4.1", 951 | "resolved": "https://registry.npmjs.org/copyfiles/-/copyfiles-2.4.1.tgz", 952 | "integrity": "sha512-fereAvAvxDrQDOXybk3Qu3dPbOoKoysFMWtkY3mv5BsL8//OSZVL5DCLYqgRfY5cWirgRzlC+WSrxp6Bo3eNZg==", 953 | "dev": true, 954 | "dependencies": { 955 | "glob": "^7.0.5", 956 | "minimatch": "^3.0.3", 957 | "mkdirp": "^1.0.4", 958 | "noms": "0.0.0", 959 | "through2": "^2.0.1", 960 | "untildify": "^4.0.0", 961 | "yargs": "^16.1.0" 962 | }, 963 | "bin": { 964 | "copyfiles": "copyfiles", 965 | "copyup": "copyfiles" 966 | } 967 | }, 968 | "node_modules/copyfiles/node_modules/cliui": { 969 | "version": "7.0.4", 970 | "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", 971 | "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", 972 | "dev": true, 973 | "dependencies": { 974 | "string-width": "^4.2.0", 975 | "strip-ansi": "^6.0.0", 976 | "wrap-ansi": "^7.0.0" 977 | } 978 | }, 979 | "node_modules/copyfiles/node_modules/yargs": { 980 | "version": "16.2.0", 981 | "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", 982 | "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", 983 | "dev": true, 984 | "dependencies": { 985 | "cliui": "^7.0.2", 986 | "escalade": "^3.1.1", 987 | "get-caller-file": "^2.0.5", 988 | "require-directory": "^2.1.1", 989 | "string-width": "^4.2.0", 990 | "y18n": "^5.0.5", 991 | "yargs-parser": "^20.2.2" 992 | }, 993 | "engines": { 994 | "node": ">=10" 995 | } 996 | }, 997 | "node_modules/copyfiles/node_modules/yargs-parser": { 998 | "version": "20.2.5", 999 | "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.5.tgz", 1000 | "integrity": "sha512-jYRGS3zWy20NtDtK2kBgo/TlAoy5YUuhD9/LZ7z7W4j1Fdw2cqD0xEEclf8fxc8xjD6X5Qr+qQQwCEsP8iRiYg==", 1001 | "dev": true, 1002 | "engines": { 1003 | "node": ">=10" 1004 | } 1005 | }, 1006 | "node_modules/core-util-is": { 1007 | "version": "1.0.2", 1008 | "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", 1009 | "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", 1010 | "dev": true 1011 | }, 1012 | "node_modules/debug": { 1013 | "version": "4.4.0", 1014 | "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", 1015 | "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", 1016 | "dev": true, 1017 | "license": "MIT", 1018 | "dependencies": { 1019 | "ms": "^2.1.3" 1020 | }, 1021 | "engines": { 1022 | "node": ">=6.0" 1023 | }, 1024 | "peerDependenciesMeta": { 1025 | "supports-color": { 1026 | "optional": true 1027 | } 1028 | } 1029 | }, 1030 | "node_modules/deep-eql": { 1031 | "version": "5.0.2", 1032 | "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-5.0.2.tgz", 1033 | "integrity": "sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==", 1034 | "dev": true, 1035 | "license": "MIT", 1036 | "engines": { 1037 | "node": ">=6" 1038 | } 1039 | }, 1040 | "node_modules/emoji-regex": { 1041 | "version": "8.0.0", 1042 | "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", 1043 | "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", 1044 | "dev": true 1045 | }, 1046 | "node_modules/es-module-lexer": { 1047 | "version": "1.6.0", 1048 | "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.6.0.tgz", 1049 | "integrity": "sha512-qqnD1yMU6tk/jnaMosogGySTZP8YtUgAffA9nMN+E/rjxcfRQ6IEk7IiozUjgxKoFHBGjTLnrHB/YC45r/59EQ==", 1050 | "dev": true, 1051 | "license": "MIT" 1052 | }, 1053 | "node_modules/esbuild": { 1054 | "version": "0.25.2", 1055 | "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.2.tgz", 1056 | "integrity": "sha512-16854zccKPnC+toMywC+uKNeYSv+/eXkevRAfwRD/G9Cleq66m8XFIrigkbvauLLlCfDL45Q2cWegSg53gGBnQ==", 1057 | "dev": true, 1058 | "hasInstallScript": true, 1059 | "license": "MIT", 1060 | "bin": { 1061 | "esbuild": "bin/esbuild" 1062 | }, 1063 | "engines": { 1064 | "node": ">=18" 1065 | }, 1066 | "optionalDependencies": { 1067 | "@esbuild/aix-ppc64": "0.25.2", 1068 | "@esbuild/android-arm": "0.25.2", 1069 | "@esbuild/android-arm64": "0.25.2", 1070 | "@esbuild/android-x64": "0.25.2", 1071 | "@esbuild/darwin-arm64": "0.25.2", 1072 | "@esbuild/darwin-x64": "0.25.2", 1073 | "@esbuild/freebsd-arm64": "0.25.2", 1074 | "@esbuild/freebsd-x64": "0.25.2", 1075 | "@esbuild/linux-arm": "0.25.2", 1076 | "@esbuild/linux-arm64": "0.25.2", 1077 | "@esbuild/linux-ia32": "0.25.2", 1078 | "@esbuild/linux-loong64": "0.25.2", 1079 | "@esbuild/linux-mips64el": "0.25.2", 1080 | "@esbuild/linux-ppc64": "0.25.2", 1081 | "@esbuild/linux-riscv64": "0.25.2", 1082 | "@esbuild/linux-s390x": "0.25.2", 1083 | "@esbuild/linux-x64": "0.25.2", 1084 | "@esbuild/netbsd-arm64": "0.25.2", 1085 | "@esbuild/netbsd-x64": "0.25.2", 1086 | "@esbuild/openbsd-arm64": "0.25.2", 1087 | "@esbuild/openbsd-x64": "0.25.2", 1088 | "@esbuild/sunos-x64": "0.25.2", 1089 | "@esbuild/win32-arm64": "0.25.2", 1090 | "@esbuild/win32-ia32": "0.25.2", 1091 | "@esbuild/win32-x64": "0.25.2" 1092 | } 1093 | }, 1094 | "node_modules/escalade": { 1095 | "version": "3.2.0", 1096 | "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", 1097 | "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", 1098 | "dev": true, 1099 | "license": "MIT", 1100 | "engines": { 1101 | "node": ">=6" 1102 | } 1103 | }, 1104 | "node_modules/estree-walker": { 1105 | "version": "3.0.3", 1106 | "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", 1107 | "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", 1108 | "dev": true, 1109 | "license": "MIT", 1110 | "dependencies": { 1111 | "@types/estree": "^1.0.0" 1112 | } 1113 | }, 1114 | "node_modules/expect-type": { 1115 | "version": "1.2.1", 1116 | "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.2.1.tgz", 1117 | "integrity": "sha512-/kP8CAwxzLVEeFrMm4kMmy4CCDlpipyA7MYLVrdJIkV0fYF0UaigQHRsxHiuY/GEea+bh4KSv3TIlgr+2UL6bw==", 1118 | "dev": true, 1119 | "license": "Apache-2.0", 1120 | "engines": { 1121 | "node": ">=12.0.0" 1122 | } 1123 | }, 1124 | "node_modules/fs.realpath": { 1125 | "version": "1.0.0", 1126 | "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", 1127 | "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", 1128 | "dev": true 1129 | }, 1130 | "node_modules/fsevents": { 1131 | "version": "2.3.3", 1132 | "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", 1133 | "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", 1134 | "dev": true, 1135 | "hasInstallScript": true, 1136 | "license": "MIT", 1137 | "optional": true, 1138 | "os": [ 1139 | "darwin" 1140 | ], 1141 | "engines": { 1142 | "node": "^8.16.0 || ^10.6.0 || >=11.0.0" 1143 | } 1144 | }, 1145 | "node_modules/get-caller-file": { 1146 | "version": "2.0.5", 1147 | "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", 1148 | "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", 1149 | "dev": true, 1150 | "engines": { 1151 | "node": "6.* || 8.* || >= 10.*" 1152 | } 1153 | }, 1154 | "node_modules/glob": { 1155 | "version": "7.1.6", 1156 | "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", 1157 | "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", 1158 | "deprecated": "Glob versions prior to v9 are no longer supported", 1159 | "dev": true, 1160 | "dependencies": { 1161 | "fs.realpath": "^1.0.0", 1162 | "inflight": "^1.0.4", 1163 | "inherits": "2", 1164 | "minimatch": "^3.0.4", 1165 | "once": "^1.3.0", 1166 | "path-is-absolute": "^1.0.0" 1167 | }, 1168 | "engines": { 1169 | "node": "*" 1170 | }, 1171 | "funding": { 1172 | "url": "https://github.com/sponsors/isaacs" 1173 | } 1174 | }, 1175 | "node_modules/immer": { 1176 | "version": "10.1.1", 1177 | "resolved": "https://registry.npmjs.org/immer/-/immer-10.1.1.tgz", 1178 | "integrity": "sha512-s2MPrmjovJcoMaHtx6K11Ra7oD05NT97w1IC5zpMkT6Atjr7H8LjaDd81iIxUYpMKSRRNMJE703M1Fhr/TctHw==", 1179 | "license": "MIT", 1180 | "peer": true, 1181 | "funding": { 1182 | "type": "opencollective", 1183 | "url": "https://opencollective.com/immer" 1184 | } 1185 | }, 1186 | "node_modules/inflight": { 1187 | "version": "1.0.6", 1188 | "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", 1189 | "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", 1190 | "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", 1191 | "dev": true, 1192 | "dependencies": { 1193 | "once": "^1.3.0", 1194 | "wrappy": "1" 1195 | } 1196 | }, 1197 | "node_modules/inherits": { 1198 | "version": "2.0.4", 1199 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", 1200 | "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", 1201 | "dev": true 1202 | }, 1203 | "node_modules/is-fullwidth-code-point": { 1204 | "version": "3.0.0", 1205 | "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", 1206 | "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", 1207 | "dev": true, 1208 | "engines": { 1209 | "node": ">=8" 1210 | } 1211 | }, 1212 | "node_modules/isarray": { 1213 | "version": "1.0.0", 1214 | "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", 1215 | "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", 1216 | "dev": true 1217 | }, 1218 | "node_modules/loupe": { 1219 | "version": "3.1.3", 1220 | "resolved": "https://registry.npmjs.org/loupe/-/loupe-3.1.3.tgz", 1221 | "integrity": "sha512-kkIp7XSkP78ZxJEsSxW3712C6teJVoeHHwgo9zJ380de7IYyJ2ISlxojcH2pC5OFLewESmnRi/+XCDIEEVyoug==", 1222 | "dev": true, 1223 | "license": "MIT" 1224 | }, 1225 | "node_modules/magic-string": { 1226 | "version": "0.30.17", 1227 | "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.17.tgz", 1228 | "integrity": "sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA==", 1229 | "dev": true, 1230 | "license": "MIT", 1231 | "dependencies": { 1232 | "@jridgewell/sourcemap-codec": "^1.5.0" 1233 | } 1234 | }, 1235 | "node_modules/minimatch": { 1236 | "version": "3.0.4", 1237 | "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", 1238 | "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", 1239 | "dev": true, 1240 | "dependencies": { 1241 | "brace-expansion": "^1.1.7" 1242 | }, 1243 | "engines": { 1244 | "node": "*" 1245 | } 1246 | }, 1247 | "node_modules/mkdirp": { 1248 | "version": "1.0.4", 1249 | "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", 1250 | "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", 1251 | "dev": true, 1252 | "bin": { 1253 | "mkdirp": "bin/cmd.js" 1254 | }, 1255 | "engines": { 1256 | "node": ">=10" 1257 | } 1258 | }, 1259 | "node_modules/ms": { 1260 | "version": "2.1.3", 1261 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", 1262 | "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", 1263 | "dev": true, 1264 | "license": "MIT" 1265 | }, 1266 | "node_modules/nanoid": { 1267 | "version": "3.3.11", 1268 | "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", 1269 | "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", 1270 | "dev": true, 1271 | "funding": [ 1272 | { 1273 | "type": "github", 1274 | "url": "https://github.com/sponsors/ai" 1275 | } 1276 | ], 1277 | "license": "MIT", 1278 | "bin": { 1279 | "nanoid": "bin/nanoid.cjs" 1280 | }, 1281 | "engines": { 1282 | "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" 1283 | } 1284 | }, 1285 | "node_modules/noms": { 1286 | "version": "0.0.0", 1287 | "resolved": "https://registry.npmjs.org/noms/-/noms-0.0.0.tgz", 1288 | "integrity": "sha1-2o69nzr51nYJGbJ9nNyAkqczKFk=", 1289 | "dev": true, 1290 | "dependencies": { 1291 | "inherits": "^2.0.1", 1292 | "readable-stream": "~1.0.31" 1293 | } 1294 | }, 1295 | "node_modules/once": { 1296 | "version": "1.4.0", 1297 | "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", 1298 | "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", 1299 | "dev": true, 1300 | "dependencies": { 1301 | "wrappy": "1" 1302 | } 1303 | }, 1304 | "node_modules/path-is-absolute": { 1305 | "version": "1.0.1", 1306 | "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", 1307 | "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", 1308 | "dev": true, 1309 | "engines": { 1310 | "node": ">=0.10.0" 1311 | } 1312 | }, 1313 | "node_modules/pathe": { 1314 | "version": "2.0.3", 1315 | "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz", 1316 | "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==", 1317 | "dev": true, 1318 | "license": "MIT" 1319 | }, 1320 | "node_modules/pathval": { 1321 | "version": "2.0.0", 1322 | "resolved": "https://registry.npmjs.org/pathval/-/pathval-2.0.0.tgz", 1323 | "integrity": "sha512-vE7JKRyES09KiunauX7nd2Q9/L7lhok4smP9RZTDeD4MVs72Dp2qNFVz39Nz5a0FVEW0BJR6C0DYrq6unoziZA==", 1324 | "dev": true, 1325 | "license": "MIT", 1326 | "engines": { 1327 | "node": ">= 14.16" 1328 | } 1329 | }, 1330 | "node_modules/picocolors": { 1331 | "version": "1.1.1", 1332 | "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", 1333 | "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", 1334 | "dev": true, 1335 | "license": "ISC" 1336 | }, 1337 | "node_modules/postcss": { 1338 | "version": "8.5.3", 1339 | "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.3.tgz", 1340 | "integrity": "sha512-dle9A3yYxlBSrt8Fu+IpjGT8SY8hN0mlaA6GY8t0P5PjIOZemULz/E2Bnm/2dcUOena75OTNkHI76uZBNUUq3A==", 1341 | "dev": true, 1342 | "funding": [ 1343 | { 1344 | "type": "opencollective", 1345 | "url": "https://opencollective.com/postcss/" 1346 | }, 1347 | { 1348 | "type": "tidelift", 1349 | "url": "https://tidelift.com/funding/github/npm/postcss" 1350 | }, 1351 | { 1352 | "type": "github", 1353 | "url": "https://github.com/sponsors/ai" 1354 | } 1355 | ], 1356 | "license": "MIT", 1357 | "dependencies": { 1358 | "nanoid": "^3.3.8", 1359 | "picocolors": "^1.1.1", 1360 | "source-map-js": "^1.2.1" 1361 | }, 1362 | "engines": { 1363 | "node": "^10 || ^12 || >=14" 1364 | } 1365 | }, 1366 | "node_modules/process-nextick-args": { 1367 | "version": "2.0.1", 1368 | "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", 1369 | "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", 1370 | "dev": true 1371 | }, 1372 | "node_modules/readable-stream": { 1373 | "version": "1.0.34", 1374 | "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", 1375 | "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", 1376 | "dev": true, 1377 | "dependencies": { 1378 | "core-util-is": "~1.0.0", 1379 | "inherits": "~2.0.1", 1380 | "isarray": "0.0.1", 1381 | "string_decoder": "~0.10.x" 1382 | } 1383 | }, 1384 | "node_modules/readable-stream/node_modules/isarray": { 1385 | "version": "0.0.1", 1386 | "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", 1387 | "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", 1388 | "dev": true 1389 | }, 1390 | "node_modules/require-directory": { 1391 | "version": "2.1.1", 1392 | "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", 1393 | "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", 1394 | "dev": true, 1395 | "engines": { 1396 | "node": ">=0.10.0" 1397 | } 1398 | }, 1399 | "node_modules/rollup": { 1400 | "version": "4.39.0", 1401 | "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.39.0.tgz", 1402 | "integrity": "sha512-thI8kNc02yNvnmJp8dr3fNWJ9tCONDhp6TV35X6HkKGGs9E6q7YWCHbe5vKiTa7TAiNcFEmXKj3X/pG2b3ci0g==", 1403 | "dev": true, 1404 | "license": "MIT", 1405 | "dependencies": { 1406 | "@types/estree": "1.0.7" 1407 | }, 1408 | "bin": { 1409 | "rollup": "dist/bin/rollup" 1410 | }, 1411 | "engines": { 1412 | "node": ">=18.0.0", 1413 | "npm": ">=8.0.0" 1414 | }, 1415 | "optionalDependencies": { 1416 | "@rollup/rollup-android-arm-eabi": "4.39.0", 1417 | "@rollup/rollup-android-arm64": "4.39.0", 1418 | "@rollup/rollup-darwin-arm64": "4.39.0", 1419 | "@rollup/rollup-darwin-x64": "4.39.0", 1420 | "@rollup/rollup-freebsd-arm64": "4.39.0", 1421 | "@rollup/rollup-freebsd-x64": "4.39.0", 1422 | "@rollup/rollup-linux-arm-gnueabihf": "4.39.0", 1423 | "@rollup/rollup-linux-arm-musleabihf": "4.39.0", 1424 | "@rollup/rollup-linux-arm64-gnu": "4.39.0", 1425 | "@rollup/rollup-linux-arm64-musl": "4.39.0", 1426 | "@rollup/rollup-linux-loongarch64-gnu": "4.39.0", 1427 | "@rollup/rollup-linux-powerpc64le-gnu": "4.39.0", 1428 | "@rollup/rollup-linux-riscv64-gnu": "4.39.0", 1429 | "@rollup/rollup-linux-riscv64-musl": "4.39.0", 1430 | "@rollup/rollup-linux-s390x-gnu": "4.39.0", 1431 | "@rollup/rollup-linux-x64-gnu": "4.39.0", 1432 | "@rollup/rollup-linux-x64-musl": "4.39.0", 1433 | "@rollup/rollup-win32-arm64-msvc": "4.39.0", 1434 | "@rollup/rollup-win32-ia32-msvc": "4.39.0", 1435 | "@rollup/rollup-win32-x64-msvc": "4.39.0", 1436 | "fsevents": "~2.3.2" 1437 | } 1438 | }, 1439 | "node_modules/safe-buffer": { 1440 | "version": "5.1.2", 1441 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", 1442 | "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", 1443 | "dev": true 1444 | }, 1445 | "node_modules/siginfo": { 1446 | "version": "2.0.0", 1447 | "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", 1448 | "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", 1449 | "dev": true, 1450 | "license": "ISC" 1451 | }, 1452 | "node_modules/source-map-js": { 1453 | "version": "1.2.1", 1454 | "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", 1455 | "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", 1456 | "dev": true, 1457 | "license": "BSD-3-Clause", 1458 | "engines": { 1459 | "node": ">=0.10.0" 1460 | } 1461 | }, 1462 | "node_modules/stackback": { 1463 | "version": "0.0.2", 1464 | "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", 1465 | "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", 1466 | "dev": true, 1467 | "license": "MIT" 1468 | }, 1469 | "node_modules/std-env": { 1470 | "version": "3.9.0", 1471 | "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.9.0.tgz", 1472 | "integrity": "sha512-UGvjygr6F6tpH7o2qyqR6QYpwraIjKSdtzyBdyytFOHmPZY917kwdwLG0RbOjWOnKmnm3PeHjaoLLMie7kPLQw==", 1473 | "dev": true, 1474 | "license": "MIT" 1475 | }, 1476 | "node_modules/string_decoder": { 1477 | "version": "0.10.31", 1478 | "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", 1479 | "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", 1480 | "dev": true 1481 | }, 1482 | "node_modules/string-width": { 1483 | "version": "4.2.3", 1484 | "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", 1485 | "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", 1486 | "dev": true, 1487 | "license": "MIT", 1488 | "dependencies": { 1489 | "emoji-regex": "^8.0.0", 1490 | "is-fullwidth-code-point": "^3.0.0", 1491 | "strip-ansi": "^6.0.1" 1492 | }, 1493 | "engines": { 1494 | "node": ">=8" 1495 | } 1496 | }, 1497 | "node_modules/strip-ansi": { 1498 | "version": "6.0.1", 1499 | "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", 1500 | "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", 1501 | "dev": true, 1502 | "license": "MIT", 1503 | "dependencies": { 1504 | "ansi-regex": "^5.0.1" 1505 | }, 1506 | "engines": { 1507 | "node": ">=8" 1508 | } 1509 | }, 1510 | "node_modules/through2": { 1511 | "version": "2.0.5", 1512 | "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", 1513 | "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", 1514 | "dev": true, 1515 | "dependencies": { 1516 | "readable-stream": "~2.3.6", 1517 | "xtend": "~4.0.1" 1518 | } 1519 | }, 1520 | "node_modules/through2/node_modules/readable-stream": { 1521 | "version": "2.3.7", 1522 | "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", 1523 | "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", 1524 | "dev": true, 1525 | "dependencies": { 1526 | "core-util-is": "~1.0.0", 1527 | "inherits": "~2.0.3", 1528 | "isarray": "~1.0.0", 1529 | "process-nextick-args": "~2.0.0", 1530 | "safe-buffer": "~5.1.1", 1531 | "string_decoder": "~1.1.1", 1532 | "util-deprecate": "~1.0.1" 1533 | } 1534 | }, 1535 | "node_modules/through2/node_modules/string_decoder": { 1536 | "version": "1.1.1", 1537 | "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", 1538 | "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", 1539 | "dev": true, 1540 | "dependencies": { 1541 | "safe-buffer": "~5.1.0" 1542 | } 1543 | }, 1544 | "node_modules/tinybench": { 1545 | "version": "2.9.0", 1546 | "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.9.0.tgz", 1547 | "integrity": "sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==", 1548 | "dev": true, 1549 | "license": "MIT" 1550 | }, 1551 | "node_modules/tinyexec": { 1552 | "version": "0.3.2", 1553 | "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-0.3.2.tgz", 1554 | "integrity": "sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==", 1555 | "dev": true, 1556 | "license": "MIT" 1557 | }, 1558 | "node_modules/tinypool": { 1559 | "version": "1.0.2", 1560 | "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-1.0.2.tgz", 1561 | "integrity": "sha512-al6n+QEANGFOMf/dmUMsuS5/r9B06uwlyNjZZql/zv8J7ybHCgoihBNORZCY2mzUuAnomQa2JdhyHKzZxPCrFA==", 1562 | "dev": true, 1563 | "license": "MIT", 1564 | "engines": { 1565 | "node": "^18.0.0 || >=20.0.0" 1566 | } 1567 | }, 1568 | "node_modules/tinyrainbow": { 1569 | "version": "2.0.0", 1570 | "resolved": "https://registry.npmjs.org/tinyrainbow/-/tinyrainbow-2.0.0.tgz", 1571 | "integrity": "sha512-op4nsTR47R6p0vMUUoYl/a+ljLFVtlfaXkLQmqfLR1qHma1h/ysYk4hEXZ880bf2CYgTskvTa/e196Vd5dDQXw==", 1572 | "dev": true, 1573 | "license": "MIT", 1574 | "engines": { 1575 | "node": ">=14.0.0" 1576 | } 1577 | }, 1578 | "node_modules/tinyspy": { 1579 | "version": "3.0.2", 1580 | "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-3.0.2.tgz", 1581 | "integrity": "sha512-n1cw8k1k0x4pgA2+9XrOkFydTerNcJ1zWCO5Nn9scWHTD+5tp8dghT2x1uduQePZTZgd3Tupf+x9BxJjeJi77Q==", 1582 | "dev": true, 1583 | "license": "MIT", 1584 | "engines": { 1585 | "node": ">=14.0.0" 1586 | } 1587 | }, 1588 | "node_modules/typescript": { 1589 | "version": "5.8.3", 1590 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz", 1591 | "integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==", 1592 | "dev": true, 1593 | "license": "Apache-2.0", 1594 | "bin": { 1595 | "tsc": "bin/tsc", 1596 | "tsserver": "bin/tsserver" 1597 | }, 1598 | "engines": { 1599 | "node": ">=14.17" 1600 | } 1601 | }, 1602 | "node_modules/undici-types": { 1603 | "version": "6.21.0", 1604 | "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", 1605 | "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", 1606 | "dev": true, 1607 | "license": "MIT", 1608 | "optional": true, 1609 | "peer": true 1610 | }, 1611 | "node_modules/untildify": { 1612 | "version": "4.0.0", 1613 | "resolved": "https://registry.npmjs.org/untildify/-/untildify-4.0.0.tgz", 1614 | "integrity": "sha512-KK8xQ1mkzZeg9inewmFVDNkg3l5LUhoq9kN6iWYB/CC9YMG8HA+c1Q8HwDe6dEX7kErrEVNVBO3fWsVq5iDgtw==", 1615 | "dev": true, 1616 | "engines": { 1617 | "node": ">=8" 1618 | } 1619 | }, 1620 | "node_modules/util-deprecate": { 1621 | "version": "1.0.2", 1622 | "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", 1623 | "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", 1624 | "dev": true 1625 | }, 1626 | "node_modules/vite": { 1627 | "version": "6.2.5", 1628 | "resolved": "https://registry.npmjs.org/vite/-/vite-6.2.5.tgz", 1629 | "integrity": "sha512-j023J/hCAa4pRIUH6J9HemwYfjB5llR2Ps0CWeikOtdR8+pAURAk0DoJC5/mm9kd+UgdnIy7d6HE4EAvlYhPhA==", 1630 | "dev": true, 1631 | "license": "MIT", 1632 | "dependencies": { 1633 | "esbuild": "^0.25.0", 1634 | "postcss": "^8.5.3", 1635 | "rollup": "^4.30.1" 1636 | }, 1637 | "bin": { 1638 | "vite": "bin/vite.js" 1639 | }, 1640 | "engines": { 1641 | "node": "^18.0.0 || ^20.0.0 || >=22.0.0" 1642 | }, 1643 | "funding": { 1644 | "url": "https://github.com/vitejs/vite?sponsor=1" 1645 | }, 1646 | "optionalDependencies": { 1647 | "fsevents": "~2.3.3" 1648 | }, 1649 | "peerDependencies": { 1650 | "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", 1651 | "jiti": ">=1.21.0", 1652 | "less": "*", 1653 | "lightningcss": "^1.21.0", 1654 | "sass": "*", 1655 | "sass-embedded": "*", 1656 | "stylus": "*", 1657 | "sugarss": "*", 1658 | "terser": "^5.16.0", 1659 | "tsx": "^4.8.1", 1660 | "yaml": "^2.4.2" 1661 | }, 1662 | "peerDependenciesMeta": { 1663 | "@types/node": { 1664 | "optional": true 1665 | }, 1666 | "jiti": { 1667 | "optional": true 1668 | }, 1669 | "less": { 1670 | "optional": true 1671 | }, 1672 | "lightningcss": { 1673 | "optional": true 1674 | }, 1675 | "sass": { 1676 | "optional": true 1677 | }, 1678 | "sass-embedded": { 1679 | "optional": true 1680 | }, 1681 | "stylus": { 1682 | "optional": true 1683 | }, 1684 | "sugarss": { 1685 | "optional": true 1686 | }, 1687 | "terser": { 1688 | "optional": true 1689 | }, 1690 | "tsx": { 1691 | "optional": true 1692 | }, 1693 | "yaml": { 1694 | "optional": true 1695 | } 1696 | } 1697 | }, 1698 | "node_modules/vite-node": { 1699 | "version": "3.1.1", 1700 | "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-3.1.1.tgz", 1701 | "integrity": "sha512-V+IxPAE2FvXpTCHXyNem0M+gWm6J7eRyWPR6vYoG/Gl+IscNOjXzztUhimQgTxaAoUoj40Qqimaa0NLIOOAH4w==", 1702 | "dev": true, 1703 | "license": "MIT", 1704 | "dependencies": { 1705 | "cac": "^6.7.14", 1706 | "debug": "^4.4.0", 1707 | "es-module-lexer": "^1.6.0", 1708 | "pathe": "^2.0.3", 1709 | "vite": "^5.0.0 || ^6.0.0" 1710 | }, 1711 | "bin": { 1712 | "vite-node": "vite-node.mjs" 1713 | }, 1714 | "engines": { 1715 | "node": "^18.0.0 || ^20.0.0 || >=22.0.0" 1716 | }, 1717 | "funding": { 1718 | "url": "https://opencollective.com/vitest" 1719 | } 1720 | }, 1721 | "node_modules/vitest": { 1722 | "version": "3.1.1", 1723 | "resolved": "https://registry.npmjs.org/vitest/-/vitest-3.1.1.tgz", 1724 | "integrity": "sha512-kiZc/IYmKICeBAZr9DQ5rT7/6bD9G7uqQEki4fxazi1jdVl2mWGzedtBs5s6llz59yQhVb7FFY2MbHzHCnT79Q==", 1725 | "dev": true, 1726 | "license": "MIT", 1727 | "dependencies": { 1728 | "@vitest/expect": "3.1.1", 1729 | "@vitest/mocker": "3.1.1", 1730 | "@vitest/pretty-format": "^3.1.1", 1731 | "@vitest/runner": "3.1.1", 1732 | "@vitest/snapshot": "3.1.1", 1733 | "@vitest/spy": "3.1.1", 1734 | "@vitest/utils": "3.1.1", 1735 | "chai": "^5.2.0", 1736 | "debug": "^4.4.0", 1737 | "expect-type": "^1.2.0", 1738 | "magic-string": "^0.30.17", 1739 | "pathe": "^2.0.3", 1740 | "std-env": "^3.8.1", 1741 | "tinybench": "^2.9.0", 1742 | "tinyexec": "^0.3.2", 1743 | "tinypool": "^1.0.2", 1744 | "tinyrainbow": "^2.0.0", 1745 | "vite": "^5.0.0 || ^6.0.0", 1746 | "vite-node": "3.1.1", 1747 | "why-is-node-running": "^2.3.0" 1748 | }, 1749 | "bin": { 1750 | "vitest": "vitest.mjs" 1751 | }, 1752 | "engines": { 1753 | "node": "^18.0.0 || ^20.0.0 || >=22.0.0" 1754 | }, 1755 | "funding": { 1756 | "url": "https://opencollective.com/vitest" 1757 | }, 1758 | "peerDependencies": { 1759 | "@edge-runtime/vm": "*", 1760 | "@types/debug": "^4.1.12", 1761 | "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", 1762 | "@vitest/browser": "3.1.1", 1763 | "@vitest/ui": "3.1.1", 1764 | "happy-dom": "*", 1765 | "jsdom": "*" 1766 | }, 1767 | "peerDependenciesMeta": { 1768 | "@edge-runtime/vm": { 1769 | "optional": true 1770 | }, 1771 | "@types/debug": { 1772 | "optional": true 1773 | }, 1774 | "@types/node": { 1775 | "optional": true 1776 | }, 1777 | "@vitest/browser": { 1778 | "optional": true 1779 | }, 1780 | "@vitest/ui": { 1781 | "optional": true 1782 | }, 1783 | "happy-dom": { 1784 | "optional": true 1785 | }, 1786 | "jsdom": { 1787 | "optional": true 1788 | } 1789 | } 1790 | }, 1791 | "node_modules/why-is-node-running": { 1792 | "version": "2.3.0", 1793 | "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.3.0.tgz", 1794 | "integrity": "sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==", 1795 | "dev": true, 1796 | "license": "MIT", 1797 | "dependencies": { 1798 | "siginfo": "^2.0.0", 1799 | "stackback": "0.0.2" 1800 | }, 1801 | "bin": { 1802 | "why-is-node-running": "cli.js" 1803 | }, 1804 | "engines": { 1805 | "node": ">=8" 1806 | } 1807 | }, 1808 | "node_modules/wrap-ansi": { 1809 | "version": "7.0.0", 1810 | "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", 1811 | "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", 1812 | "dev": true, 1813 | "license": "MIT", 1814 | "dependencies": { 1815 | "ansi-styles": "^4.0.0", 1816 | "string-width": "^4.1.0", 1817 | "strip-ansi": "^6.0.0" 1818 | }, 1819 | "engines": { 1820 | "node": ">=10" 1821 | }, 1822 | "funding": { 1823 | "url": "https://github.com/chalk/wrap-ansi?sponsor=1" 1824 | } 1825 | }, 1826 | "node_modules/wrap-ansi/node_modules/ansi-styles": { 1827 | "version": "4.3.0", 1828 | "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", 1829 | "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", 1830 | "dev": true, 1831 | "license": "MIT", 1832 | "dependencies": { 1833 | "color-convert": "^2.0.1" 1834 | }, 1835 | "engines": { 1836 | "node": ">=8" 1837 | }, 1838 | "funding": { 1839 | "url": "https://github.com/chalk/ansi-styles?sponsor=1" 1840 | } 1841 | }, 1842 | "node_modules/wrap-ansi/node_modules/color-convert": { 1843 | "version": "2.0.1", 1844 | "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", 1845 | "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", 1846 | "dev": true, 1847 | "license": "MIT", 1848 | "dependencies": { 1849 | "color-name": "~1.1.4" 1850 | }, 1851 | "engines": { 1852 | "node": ">=7.0.0" 1853 | } 1854 | }, 1855 | "node_modules/wrap-ansi/node_modules/color-name": { 1856 | "version": "1.1.4", 1857 | "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", 1858 | "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", 1859 | "dev": true, 1860 | "license": "MIT" 1861 | }, 1862 | "node_modules/wrappy": { 1863 | "version": "1.0.2", 1864 | "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", 1865 | "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", 1866 | "dev": true 1867 | }, 1868 | "node_modules/xtend": { 1869 | "version": "4.0.2", 1870 | "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", 1871 | "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", 1872 | "dev": true, 1873 | "engines": { 1874 | "node": ">=0.4" 1875 | } 1876 | }, 1877 | "node_modules/y18n": { 1878 | "version": "5.0.8", 1879 | "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", 1880 | "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", 1881 | "dev": true, 1882 | "license": "ISC", 1883 | "engines": { 1884 | "node": ">=10" 1885 | } 1886 | } 1887 | } 1888 | } 1889 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rainbow-actions", 3 | "version": "0.2.4", 4 | "description": "Type safe and namespaced redux actions", 5 | "funding": "https://github.com/sponsors/antonk52", 6 | "main": "index.js", 7 | "types": "index.d.js", 8 | "scripts": { 9 | "preversion": "npm run clean && npm ci && npm run install-peers && npm run types && npm test", 10 | "postversion": "npm run prep && npm publish ./dist && git push --follow-tags", 11 | "prep": "rm -rf ./dist && copyfiles ./src/* package.json README.md -f -a ./dist/", 12 | "install-peers": "npm i immer@8 --no-save", 13 | "clean": "rm -rf node_modules", 14 | "types": "tsc", 15 | "test": "vitest --run" 16 | }, 17 | "keywords": [ 18 | "redux", 19 | "actions", 20 | "typescript" 21 | ], 22 | "author": "antonk52", 23 | "license": "MIT", 24 | "devDependencies": { 25 | "copyfiles": "^2.4.1", 26 | "typescript": "^5.8.2", 27 | "vitest": "^3.1.1" 28 | }, 29 | "peerDependencies": { 30 | "immer": "^8.*.* || ^9.*.* || ^10.*.*" 31 | }, 32 | "engines": { 33 | "node": ">=12" 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/_types.d.ts: -------------------------------------------------------------------------------- 1 | export type PayloadDict = Record; 2 | 3 | export type AbstractAction = { 4 | type: string; 5 | payload?: any; 6 | meta?: any; 7 | error?: true; 8 | }; 9 | 10 | export type ActionUnionToDictionary = { 11 | [K in A['type']]: Extract; 12 | }; 13 | 14 | export type DeepReadonly = T extends Set | Map | Function | Date 15 | ? T 16 | : T extends object 17 | ? {readonly [P in keyof T]: DeepReadonly;} 18 | : T extends ReadonlyArray 19 | ? T 20 | : T extends Array 21 | ? ReadonlyArray 22 | : T 23 | 24 | export type DeepWriteable = T extends Set | Map | Function | Date 25 | ? T 26 | : T extends object 27 | ? {-readonly [P in keyof T]: DeepWriteable;} 28 | : T extends ReadonlyArray 29 | ? Array 30 | : T 31 | 32 | export type AnyAction = { 33 | type: string; 34 | payload?: any; 35 | meta?: any; 36 | } 37 | -------------------------------------------------------------------------------- /src/immer.d.ts: -------------------------------------------------------------------------------- 1 | import type {AbstractAction, ActionUnionToDictionary, AnyAction, DeepWriteable} from './_types'; 2 | 3 | /** 4 | * Handle actions `immer` way 5 | * 6 | * @example 7 | * 8 | * import {createActions} from 'rainbow-actions' 9 | * import {handleActions} from 'rainbow-actions/immer' 10 | * 11 | * const request = createActions<{init: string, fulfill: 'idle' | 'work'}>()('request') 12 | * const foo = createActions<{one: string, two: number}>()('dd') 13 | * 14 | * type Actions = ExtractManyNamespaceActions<[typeof request, typeof foo]> 15 | * type State = {isPending: boolean, kind: 'idle' | 'work'} 16 | * 17 | * const reducer = handleActions( 18 | * { 19 | * request_init: state => { 20 | * state.isPending = true 21 | * }, 22 | * request_fulfill: (state, action) => { 23 | * state.isPending: false 24 | * state.kind = action.payload 25 | * }, 26 | * }, 27 | * state, 28 | * ) 29 | */ 30 | export declare function handleActions( 31 | handlers: { 32 | [T in keyof ActionUnionToDictionary]?: (state: DeepWriteable, action: ActionUnionToDictionary[T]) => S | void; 33 | }, 34 | state: S, 35 | ): (state: S | undefined, action: A | AnyAction) => S; 36 | -------------------------------------------------------------------------------- /src/immer.js: -------------------------------------------------------------------------------- 1 | const {produce} = require('immer') 2 | 3 | module.exports.handleActions = function handleActions(handlers, defaultState) { 4 | return (state = defaultState, action) => produce( 5 | state, 6 | draft => handlers[action.type] 7 | ? handlers[action.type](draft, action, state) 8 | : undefined 9 | ) 10 | } 11 | -------------------------------------------------------------------------------- /src/index.d.ts: -------------------------------------------------------------------------------- 1 | import type {PayloadDict} from './_types'; 2 | 3 | export declare function createActions(): < 4 | T extends string, 5 | C extends { 6 | [K in keyof M]?: { 7 | payload?: (...args: M[K] extends never ? [] : [M[K]]) => any; 8 | meta?: (...args: M[K] extends never ? [] : [M[K]]) => any; 9 | error?: true; 10 | }; 11 | } 12 | >( 13 | type: T, 14 | creators?: C, 15 | ) => { 16 | [K in keyof M]: (( 17 | ...args: M[K] extends never ? [] : [M[K]] 18 | ) => C[K] extends object 19 | ? C[K]['payload'] extends (...payloadCreatorArgs: any) => infer P 20 | ? C[K]['meta'] extends (...payloadCreatorArgs: any) => infer Meta 21 | ? C[K]['error'] extends true 22 | ? { 23 | payload: P; 24 | meta: Meta; 25 | error: true; 26 | type: `${T}_${K extends string ? K : '*'}`; 27 | } 28 | : { 29 | payload: P; 30 | meta: Meta; 31 | type: `${T}_${K extends string ? K : '*'}`; 32 | } 33 | : { 34 | payload: P; 35 | type: `${T}_${K extends string ? K : '*'}`; 36 | } 37 | : C[K]['meta'] extends (...payloadCreatorArgs: any) => infer Meta 38 | ? C[K]['error'] extends true 39 | ? { 40 | type: `${T}_${K extends string ? K : '*'}`; 41 | meta: Meta; 42 | error: true; 43 | } 44 | : { 45 | type: `${T}_${K extends string ? K : '*'}`; 46 | meta: Meta; 47 | } 48 | : C[K]['error'] extends true 49 | ? { 50 | type: `${T}_${K extends string ? K : '*'}`; 51 | error: true; 52 | } 53 | : { 54 | type: `${T}_${K extends string ? K : '*'}`; 55 | } 56 | : M[K] extends never 57 | ? { 58 | type: `${T}_${K extends string ? K : '*'}`; 59 | } 60 | : { 61 | payload: M[K]; 62 | type: `${T}_${K extends string ? K : '*'}`; 63 | }) & {type: `${T}_${K extends string ? K : '*'}`}; 64 | }; 65 | 66 | type AbstractActionNamespace = Record {type: string}>; 67 | 68 | export type ExtractNamespaceActions = { 69 | [K in keyof T]: ReturnType 70 | }[keyof T]; 71 | 72 | export type ExtractManyNamespaceActions = { 73 | [K in keyof T]: T[K] extends AbstractActionNamespace ? ExtractNamespaceActions : never 74 | }[number]; 75 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | module.exports.createActions = function createActions() { 2 | return (baseType, methods) => { 3 | return new Proxy( 4 | {}, 5 | { 6 | get: function (_, prop) { 7 | const type = `${baseType}_${prop}`; 8 | 9 | return Object.assign( 10 | (...args) => { 11 | const action = {type}; 12 | 13 | const hasArgs = args.length > 0; 14 | if (hasArgs) { 15 | action.payload = args[0]; 16 | } 17 | 18 | if ( 19 | methods !== undefined && 20 | isObject(methods[prop]) 21 | ) { 22 | const actionMethods = methods[prop]; 23 | if (typeof actionMethods.meta === 'function') { 24 | action.meta = hasArgs 25 | ? actionMethods.meta(args[0]) 26 | : actionMethods.meta(); 27 | } 28 | 29 | if ( 30 | typeof actionMethods.payload === 'function' 31 | ) { 32 | action.payload = hasArgs 33 | ? actionMethods.payload(args[0]) 34 | : actionMethods.payload(); 35 | } 36 | 37 | if (actionMethods.error === true) { 38 | action.error = true; 39 | } 40 | } 41 | 42 | return action; 43 | }, 44 | { 45 | type, 46 | }, 47 | ); 48 | }, 49 | }, 50 | ); 51 | }; 52 | }; 53 | 54 | function isObject(arg) { 55 | return typeof arg === 'object' && arg !== null && !Array.isArray(arg); 56 | } 57 | -------------------------------------------------------------------------------- /src/reducer.d.ts: -------------------------------------------------------------------------------- 1 | import type {AbstractAction, ActionUnionToDictionary, AnyAction, DeepReadonly} from './_types'; 2 | 3 | /** 4 | * Handle actions `redux-actions` way 5 | * 6 | * @example 7 | * 8 | * const request = createActions<{init: string, fulfill: 'idle' | 'work'}>()('request') 9 | * const foo = createActions<{one: string, two: number}>()('dd') 10 | * 11 | * type Actions = ExtractManyNamespaceActions<[typeof request, typeof foo]> 12 | * type State = {isPending: boolean, kind: 'idle' | 'work'} 13 | * 14 | * const reducer = handleActions( 15 | * { 16 | * request_init: (state, action) => ({ 17 | * ...state, 18 | * isPending: true, 19 | * }), 20 | * request_fulfill: (state, action) => ({ 21 | * isPending: false, 22 | * kind: action.payload, 23 | * }), 24 | * }, 25 | * state, 26 | * ) 27 | */ 28 | export declare function handleActions( 29 | handlers: { 30 | [T in keyof ActionUnionToDictionary]?: (state: DeepReadonly, action: ActionUnionToDictionary[T]) => S; 31 | }, 32 | state: S, 33 | ): (state: S | undefined, action: A | AnyAction) => S; 34 | -------------------------------------------------------------------------------- /src/reducer.js: -------------------------------------------------------------------------------- 1 | module.exports.handleActions = function handleActions(handlers, defaultState) { 2 | return (state = defaultState, action) => typeof handlers[action.type] === 'function' ? handlers[action.type](state, action) : state 3 | } 4 | -------------------------------------------------------------------------------- /src/safe.d.ts: -------------------------------------------------------------------------------- 1 | import type {PayloadDict} from './_types'; 2 | 3 | export declare function createActions(): < 4 | T extends string, 5 | C extends { 6 | [K in keyof M]: 0 | { 7 | payload?: (...args: M[K] extends never ? [] : [M[K]]) => any; 8 | meta?: (...args: M[K] extends never ? [] : [M[K]]) => any; 9 | error?: true; 10 | }; 11 | } 12 | >( 13 | type: T, 14 | creators: C, 15 | ) => { 16 | [K in keyof M]: (( 17 | ...args: M[K] extends never ? [] : [M[K]] 18 | ) => C[K] extends object 19 | ? C[K]['payload'] extends (...payloadCreatorArgs: any) => infer P 20 | ? C[K]['meta'] extends (...payloadCreatorArgs: any) => infer Meta 21 | ? C[K]['error'] extends true 22 | ? { 23 | payload: P; 24 | meta: Meta; 25 | error: true; 26 | type: `${T}_${K extends string ? K : '*'}`; 27 | } 28 | : { 29 | payload: P; 30 | meta: Meta; 31 | type: `${T}_${K extends string ? K : '*'}`; 32 | } 33 | : { 34 | payload: P; 35 | type: `${T}_${K extends string ? K : '*'}`; 36 | } 37 | : C[K]['meta'] extends (...payloadCreatorArgs: any) => infer Meta 38 | ? C[K]['error'] extends true 39 | ? { 40 | type: `${T}_${K extends string ? K : '*'}`; 41 | meta: Meta; 42 | error: true; 43 | } 44 | : { 45 | type: `${T}_${K extends string ? K : '*'}`; 46 | meta: Meta; 47 | } 48 | : C[K]['error'] extends true 49 | ? { 50 | type: `${T}_${K extends string ? K : '*'}`; 51 | error: true; 52 | } 53 | : { 54 | type: `${T}_${K extends string ? K : '*'}`; 55 | } 56 | : M[K] extends never 57 | ? { 58 | type: `${T}_${K extends string ? K : '*'}`; 59 | } 60 | : { 61 | payload: M[K]; 62 | type: `${T}_${K extends string ? K : '*'}`; 63 | }) & {type: `${T}_${K extends string ? K : '*'}`}; 64 | }; 65 | -------------------------------------------------------------------------------- /src/safe.js: -------------------------------------------------------------------------------- 1 | module.exports.createActions = function createActions() { 2 | return (baseType, methods) => 3 | Object.keys(methods).reduce((acc, key) => { 4 | const type = `${baseType}_${key}`; 5 | const actionMethods = methods[key]; 6 | 7 | acc[key] = Object.assign( 8 | (...args) => { 9 | const action = {type}; 10 | const hasArgs = args.length > 0; 11 | if (hasArgs) { 12 | action.payload = args[0]; 13 | } 14 | 15 | if (isObject(actionMethods)) { 16 | if (typeof actionMethods.meta === 'function') { 17 | action.meta = hasArgs 18 | ? actionMethods.meta(args[0]) 19 | : actionMethods.meta(); 20 | } 21 | 22 | if (typeof actionMethods.payload === 'function') { 23 | action.payload = hasArgs 24 | ? actionMethods.payload(args[0]) 25 | : actionMethods.payload(); 26 | } 27 | 28 | if (actionMethods.error === true) { 29 | action.error = true; 30 | } 31 | } 32 | 33 | return action; 34 | }, 35 | {type}, 36 | ); 37 | 38 | return acc; 39 | }, {}); 40 | }; 41 | 42 | function isObject(arg) { 43 | return typeof arg === 'object' && arg !== null && !Array.isArray(arg); 44 | } 45 | -------------------------------------------------------------------------------- /test/immer.test.ts: -------------------------------------------------------------------------------- 1 | import {describe, it, expect} from 'vitest'; 2 | import {createActions, ExtractNamespaceActions} from '../src/index'; 3 | import {handleActions} from '../src/immer'; 4 | 5 | describe('immer', () => { 6 | const req = createActions<{init: number, done: 'result'}>()('req'); 7 | 8 | type State = { 9 | id: number; 10 | result: 'empty' | 'loading' | 'result'; 11 | }; 12 | const defaultState: State = { 13 | id: 0, 14 | result: 'empty', 15 | }; 16 | 17 | type Actions = ExtractNamespaceActions; 18 | const reducer = handleActions( 19 | { 20 | [req.init.type]: (state, {payload}) => { 21 | state.id = payload; 22 | state.result = 'loading'; 23 | }, 24 | [req.done.type]: (state, {payload}) => ({ 25 | ...state, 26 | result: payload, 27 | }), 28 | }, 29 | defaultState, 30 | ); 31 | 32 | it('modifies state as expected by mutating', () => { 33 | const st: State = { 34 | ...defaultState, 35 | }; 36 | const result = reducer(st, req.init(123)); 37 | 38 | expect(result).toEqual({id: 123, result: 'loading'}) 39 | }); 40 | 41 | it('accepts undefined as the state argument', () => { 42 | const result = reducer(undefined, req.init(123)); 43 | 44 | expect(result).toEqual({id: 123, result: 'loading'}) 45 | }); 46 | 47 | it('modifies state as expected by returning', () => { 48 | const st: State = { 49 | ...defaultState, 50 | }; 51 | const result = reducer(st, req.done('result')); 52 | 53 | expect(result).toEqual({id: 0, result: 'result'}) 54 | }); 55 | 56 | it('does not modify state for unknown action', () => { 57 | const st: State = { 58 | ...defaultState, 59 | }; 60 | const result = reducer(st, {type: 'unknown', payload: 'whatever'}); 61 | 62 | expect(result).toEqual(st) 63 | }); 64 | }); 65 | -------------------------------------------------------------------------------- /test/index.test.ts: -------------------------------------------------------------------------------- 1 | import {describe, it, expect} from 'vitest'; 2 | import {createActions} from '../src/index'; 3 | 4 | describe('createActions', () => { 5 | const actionNS = createActions<{ 6 | empty: never; 7 | payloadOnly: number; 8 | payloadNPayloadCreator: number; 9 | metaOnly: never; 10 | metaNPayload: string; 11 | errorOnly: never; 12 | allCreatorsNoPayload: never; 13 | allCreatorsWithPayload: boolean; 14 | }>()('base', { 15 | payloadNPayloadCreator: {payload: x => `number is ${x}`}, 16 | metaOnly: {meta: () => 42}, 17 | metaNPayload: {meta: x => `${x} there`}, 18 | errorOnly: {error: true}, 19 | allCreatorsNoPayload: { 20 | error: true, 21 | payload: () => 'p', 22 | meta: () => 'm', 23 | }, 24 | allCreatorsWithPayload: { 25 | error: true, 26 | payload: x => `p ${x}`, 27 | meta: x => `m ${x}`, 28 | }, 29 | }); 30 | 31 | it('empty', () => { 32 | const type = actionNS.empty.type; 33 | const action = actionNS.empty(); 34 | const expectedType = 'base_empty'; 35 | const expected = { 36 | type: expectedType, 37 | }; 38 | expect(type).toEqual(expectedType); 39 | expect(action).toEqual(expected); 40 | }); 41 | 42 | it('payloadOnly', () => { 43 | const type = actionNS.payloadOnly.type; 44 | const action = actionNS.payloadOnly(52); 45 | const expectedType = 'base_payloadOnly'; 46 | const expected = { 47 | type: expectedType, 48 | payload: 52, 49 | }; 50 | expect(type).toEqual(expectedType); 51 | expect(action).toEqual(expected); 52 | }); 53 | 54 | it('payloadNPayloadCreator', () => { 55 | const type = actionNS.payloadNPayloadCreator.type; 56 | const action = actionNS.payloadNPayloadCreator(52); 57 | const expectedType = 'base_payloadNPayloadCreator'; 58 | const expected = { 59 | type: expectedType, 60 | payload: 'number is 52', 61 | }; 62 | expect(type).toEqual(expectedType); 63 | expect(action).toEqual(expected); 64 | }); 65 | 66 | it('metaOnly', () => { 67 | const type = actionNS.metaOnly.type; 68 | const action = actionNS.metaOnly(); 69 | const expectedType = 'base_metaOnly'; 70 | const expected = { 71 | type: expectedType, 72 | meta: 42, 73 | }; 74 | expect(type).toEqual(expectedType); 75 | expect(action).toEqual(expected); 76 | }); 77 | 78 | it('metaNPayload', () => { 79 | const type = actionNS.metaNPayload.type; 80 | const action = actionNS.metaNPayload('hi'); 81 | const expectedType = 'base_metaNPayload'; 82 | const expected = { 83 | type: expectedType, 84 | meta: 'hi there', 85 | payload: 'hi', 86 | }; 87 | expect(type).toEqual(expectedType); 88 | expect(action).toEqual(expected); 89 | }); 90 | 91 | it('errorOnly', () => { 92 | const type = actionNS.errorOnly.type; 93 | const action = actionNS.errorOnly(); 94 | const expectedType = 'base_errorOnly'; 95 | const expected = { 96 | type: expectedType, 97 | error: true, 98 | }; 99 | expect(type).toEqual(expectedType); 100 | expect(action).toEqual(expected); 101 | }); 102 | 103 | it('allCreatorsNoPayload', () => { 104 | const type = actionNS.allCreatorsNoPayload.type; 105 | const action = actionNS.allCreatorsNoPayload(); 106 | const expectedType = 'base_allCreatorsNoPayload'; 107 | const expected = { 108 | type: expectedType, 109 | meta: 'm', 110 | payload: 'p', 111 | error: true, 112 | }; 113 | expect(type).toEqual(expectedType); 114 | expect(action).toEqual(expected); 115 | }); 116 | 117 | it('allCreatorsWithPayload', () => { 118 | const type = actionNS.allCreatorsWithPayload.type; 119 | const action = actionNS.allCreatorsWithPayload(true); 120 | const expectedType = 'base_allCreatorsWithPayload'; 121 | const expected = { 122 | type: expectedType, 123 | meta: 'm true', 124 | payload: 'p true', 125 | error: true, 126 | }; 127 | expect(type).toEqual(expectedType); 128 | expect(action).toEqual(expected); 129 | }); 130 | }); 131 | -------------------------------------------------------------------------------- /test/reducer.test.ts: -------------------------------------------------------------------------------- 1 | import {describe, it, expect} from 'vitest'; 2 | import {createActions, ExtractNamespaceActions} from '../src/index'; 3 | import {handleActions} from '../src/reducer'; 4 | 5 | describe('reducer', () => { 6 | const req = createActions<{init: number, done: 'result'}>()('req'); 7 | 8 | type State = { 9 | id: number; 10 | result: 'empty' | 'loading' | 'result'; 11 | }; 12 | const defaultState: State = { 13 | id: 0, 14 | result: 'empty', 15 | }; 16 | 17 | type Actions = ExtractNamespaceActions; 18 | 19 | const reducer = handleActions( 20 | { 21 | [req.init.type]: (state, {payload}) => ({ 22 | ...state, 23 | id: payload, 24 | result: 'loading', 25 | }), 26 | }, 27 | defaultState, 28 | ); 29 | 30 | it('modifies state as expected', () => { 31 | const st: State = { 32 | ...defaultState, 33 | }; 34 | const result = reducer(st, req.init(123)); 35 | 36 | expect(result).toEqual({id: 123, result: 'loading'}) 37 | }); 38 | 39 | it('accepts undefined as the state argument', () => { 40 | const result = reducer(undefined, req.init(123)); 41 | 42 | expect(result).toEqual({id: 123, result: 'loading'}) 43 | }); 44 | 45 | it('does not modify state for unknown action', () => { 46 | const st: State = { 47 | ...defaultState, 48 | }; 49 | const result = reducer(st, {type: 'unknown', payload: 'whatever'}); 50 | 51 | expect(result).toEqual(st) 52 | }); 53 | }); 54 | -------------------------------------------------------------------------------- /test/safe.test.ts: -------------------------------------------------------------------------------- 1 | import {describe, it, expect} from 'vitest'; 2 | import {createActions} from '../src/safe'; 3 | 4 | describe('createActions', () => { 5 | const actionNS = createActions<{ 6 | empty: never; 7 | payloadOnly: number; 8 | payloadNPayloadCreator: number; 9 | metaOnly: never; 10 | metaNPayload: string; 11 | errorOnly: never; 12 | allCreatorsNoPayload: never; 13 | allCreatorsWithPayload: boolean; 14 | }>()('base', { 15 | empty: 0, 16 | payloadOnly: 0, 17 | payloadNPayloadCreator: {payload: x => `number is ${x}`}, 18 | metaOnly: {meta: () => 42}, 19 | metaNPayload: {meta: x => `${x} there`}, 20 | errorOnly: {error: true}, 21 | allCreatorsNoPayload: { 22 | error: true, 23 | payload: () => 'p', 24 | meta: () => 'm', 25 | }, 26 | allCreatorsWithPayload: { 27 | error: true, 28 | payload: x => `p ${x}`, 29 | meta: x => `m ${x}`, 30 | }, 31 | }); 32 | 33 | it('empty', () => { 34 | const type = actionNS.empty.type; 35 | const action = actionNS.empty(); 36 | const expectedType = 'base_empty'; 37 | const expected = { 38 | type: expectedType, 39 | }; 40 | expect(type).toEqual(expectedType); 41 | expect(action).toEqual(expected); 42 | }); 43 | 44 | it('payloadOnly', () => { 45 | const type = actionNS.payloadOnly.type; 46 | const action = actionNS.payloadOnly(52); 47 | const expectedType = 'base_payloadOnly'; 48 | const expected = { 49 | type: expectedType, 50 | payload: 52, 51 | }; 52 | expect(type).toEqual(expectedType); 53 | expect(action).toEqual(expected); 54 | }); 55 | 56 | it('payloadNPayloadCreator', () => { 57 | const type = actionNS.payloadNPayloadCreator.type; 58 | const action = actionNS.payloadNPayloadCreator(52); 59 | const expectedType = 'base_payloadNPayloadCreator'; 60 | const expected = { 61 | type: expectedType, 62 | payload: 'number is 52', 63 | }; 64 | expect(type).toEqual(expectedType); 65 | expect(action).toEqual(expected); 66 | }); 67 | 68 | it('metaOnly', () => { 69 | const type = actionNS.metaOnly.type; 70 | const action = actionNS.metaOnly(); 71 | const expectedType = 'base_metaOnly'; 72 | const expected = { 73 | type: expectedType, 74 | meta: 42, 75 | }; 76 | expect(type).toEqual(expectedType); 77 | expect(action).toEqual(expected); 78 | }); 79 | 80 | it('metaNPayload', () => { 81 | const type = actionNS.metaNPayload.type; 82 | const action = actionNS.metaNPayload('hi'); 83 | const expectedType = 'base_metaNPayload'; 84 | const expected = { 85 | type: expectedType, 86 | meta: 'hi there', 87 | payload: 'hi', 88 | }; 89 | expect(type).toEqual(expectedType); 90 | expect(action).toEqual(expected); 91 | }); 92 | 93 | it('errorOnly', () => { 94 | const type = actionNS.errorOnly.type; 95 | const action = actionNS.errorOnly(); 96 | const expectedType = 'base_errorOnly'; 97 | const expected = { 98 | type: expectedType, 99 | error: true, 100 | }; 101 | expect(type).toEqual(expectedType); 102 | expect(action).toEqual(expected); 103 | }); 104 | 105 | it('allCreatorsNoPayload', () => { 106 | const type = actionNS.allCreatorsNoPayload.type; 107 | const action = actionNS.allCreatorsNoPayload(); 108 | const expectedType = 'base_allCreatorsNoPayload'; 109 | const expected = { 110 | type: expectedType, 111 | meta: 'm', 112 | payload: 'p', 113 | error: true, 114 | }; 115 | expect(type).toEqual(expectedType); 116 | expect(action).toEqual(expected); 117 | }); 118 | 119 | it('allCreatorsWithPayload', () => { 120 | const type = actionNS.allCreatorsWithPayload.type; 121 | const action = actionNS.allCreatorsWithPayload(true); 122 | const expectedType = 'base_allCreatorsWithPayload'; 123 | const expected = { 124 | type: expectedType, 125 | meta: 'm true', 126 | payload: 'p true', 127 | error: true, 128 | }; 129 | expect(type).toEqual(expectedType); 130 | expect(action).toEqual(expected); 131 | }); 132 | }); 133 | -------------------------------------------------------------------------------- /test/types-extract-utils.ts: -------------------------------------------------------------------------------- 1 | import {createActions} from '../src/index'; 2 | import type {ExtractNamespaceActions, ExtractManyNamespaceActions} from '../src/index'; 3 | 4 | type Expect = T 5 | type Equal = 6 | (() => T extends X ? 1 : 2) extends 7 | (() => T extends Y ? 1 : 2) ? true : false 8 | 9 | type RequestPayloads = { 10 | init: number; 11 | get: string; 12 | end: never; 13 | } 14 | 15 | const request = createActions()('request') 16 | 17 | type RequestActions = ExtractNamespaceActions; 18 | export type ExpectedRequestActionsType = {type: 'request_init'; payload: number} | {type: 'request_get'; payload: string} | {type: 'request_end'}; 19 | 20 | export type ReqestActionsTypeMatches = Expect> 21 | 22 | type ResponsePayloads = { 23 | init: number; 24 | get: string; 25 | end: never; 26 | } 27 | 28 | const response = createActions()('response') 29 | 30 | type ExpectedResponseActionsType = {type: 'response_init'; payload: number} | {type: 'response_get'; payload: string} | {type: 'response_end'}; 31 | 32 | type ResponseActions = ExtractNamespaceActions; 33 | 34 | export type ResponseActionsTypeMatches = Expect> 35 | 36 | type AllActions = ExtractManyNamespaceActions<[typeof request, typeof response]> 37 | 38 | export type ManyActionsTypeMatches = Expect> 39 | -------------------------------------------------------------------------------- /test/types-index.ts: -------------------------------------------------------------------------------- 1 | import {createActions} from '../src/index'; 2 | 3 | const actionNS = createActions<{ 4 | empty: never; 5 | payload: number; 6 | emptyWithPayloadCreator: never; 7 | }>()('base', {emptyWithPayloadCreator: {payload: () => 42}}); 8 | 9 | const emptyType: 'base_empty' = actionNS.empty.type; 10 | const emptyAction: {type: 'base_empty'} = actionNS.empty(); 11 | // @ts-expect-error [tsserver 2554] [E] Expected 0 arguments, but got 1. 12 | actionNS.empty(1); 13 | 14 | const payloadType: 'base_payload' = actionNS.payload.type; 15 | const payloadAction: {type: 'base_payload'; payload: number} = actionNS.payload( 16 | 1, 17 | ); 18 | // @ts-expect-error [tsserver 2554] [E] Expected 1 arguments, but got 0. 19 | actionNS.payload(); 20 | 21 | const emptyWithPayloadCreatorType: 'base_emptyWithPayloadCreator' = 22 | actionNS.emptyWithPayloadCreator.type; 23 | const emptyWithPayloadCreatorAction: { 24 | type: 'base_emptyWithPayloadCreator'; 25 | payload: number; 26 | } = actionNS.emptyWithPayloadCreator(); 27 | -------------------------------------------------------------------------------- /test/types-safe.ts: -------------------------------------------------------------------------------- 1 | import {createActions} from '../src/safe'; 2 | 3 | const actionNS = createActions<{ 4 | empty: never; 5 | payload: number; 6 | emptyWithPayloadCreator: never; 7 | }>()('base', { 8 | empty: 0, 9 | payload: 0, 10 | emptyWithPayloadCreator: {payload: () => 42}, 11 | }); 12 | 13 | const emptyType: 'base_empty' = actionNS.empty.type; 14 | const emptyAction: {type: 'base_empty'} = actionNS.empty(); 15 | // @ts-expect-error [tsserver 2554] [E] Expected 0 arguments, but got 1. 16 | actionNS.empty(1); 17 | 18 | const payloadType: 'base_payload' = actionNS.payload.type; 19 | const payloadAction: {type: 'base_payload'; payload: number} = actionNS.payload( 20 | 1, 21 | ); 22 | // @ts-expect-error [tsserver 2554] [E] Expected 1 arguments, but got 0. 23 | actionNS.payload(); 24 | 25 | const emptyWithPayloadCreatorType: 'base_emptyWithPayloadCreator' = 26 | actionNS.emptyWithPayloadCreator.type; 27 | const emptyWithPayloadCreatorAction: { 28 | type: 'base_emptyWithPayloadCreator'; 29 | payload: number; 30 | } = actionNS.emptyWithPayloadCreator(); 31 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "strict": true, 4 | "skipLibCheck": true, 5 | "lib": ["es2018"], 6 | "noEmit": true, 7 | "module": "commonjs", 8 | "rootDir": "./" 9 | }, 10 | "include": ["src/**/*.ts", "test/**/*.ts"] 11 | } 12 | --------------------------------------------------------------------------------