@oxog/state 1.3.1 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-R6MFYVYQ.js → chunk-2QNZBQ4V.js} +12 -5
- package/dist/chunk-2QNZBQ4V.js.map +1 -0
- package/dist/{chunk-IWT3T2PM.cjs → chunk-V6ASKKTH.cjs} +12 -5
- package/dist/chunk-V6ASKKTH.cjs.map +1 -0
- package/dist/iife/index.global.js +1 -1
- package/dist/index.cjs +70 -70
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/vanilla.cjs +66 -66
- package/dist/vanilla.d.cts +2 -2
- package/dist/vanilla.d.ts +2 -2
- package/dist/vanilla.js +1 -1
- package/package.json +18 -9
- package/dist/chunk-IWT3T2PM.cjs.map +0 -1
- package/dist/chunk-R6MFYVYQ.js.map +0 -1
|
@@ -280,13 +280,14 @@ var Kernel = class {
|
|
|
280
280
|
} catch (error) {
|
|
281
281
|
throw new StoreError(
|
|
282
282
|
"PLUGIN_INSTALL_FAILED" /* PLUGIN_INSTALL_FAILED */,
|
|
283
|
+
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions -- message format kept from 1.x (the error's string form)
|
|
283
284
|
`Failed to install plugin '${plugin.name}': ${error}`,
|
|
284
285
|
{ cause: error }
|
|
285
286
|
);
|
|
286
287
|
}
|
|
287
288
|
this.plugins.set(plugin.name, instance);
|
|
288
289
|
if (!this.initializing && plugin.onInit) {
|
|
289
|
-
this.runOnInit(plugin, store);
|
|
290
|
+
void this.runOnInit(plugin, store);
|
|
290
291
|
}
|
|
291
292
|
}
|
|
292
293
|
/**
|
|
@@ -561,6 +562,12 @@ var StoreImpl = class {
|
|
|
561
562
|
if (update === null || update === void 0) {
|
|
562
563
|
return;
|
|
563
564
|
}
|
|
565
|
+
if (typeof update !== "object" || Array.isArray(update)) {
|
|
566
|
+
throw new StoreError(
|
|
567
|
+
"INVALID_STATE_UPDATE" /* INVALID_STATE_UPDATE */,
|
|
568
|
+
`setState expects an object or a function returning one, got ${Array.isArray(update) ? "an array" : typeof update}`
|
|
569
|
+
);
|
|
570
|
+
}
|
|
564
571
|
this.state = { ...this.state, ...withoutProtoKey(update) };
|
|
565
572
|
this.notifyOrQueue(this.state, prevState);
|
|
566
573
|
}
|
|
@@ -1482,7 +1489,7 @@ function createFederation(stores, options = {}) {
|
|
|
1482
1489
|
},
|
|
1483
1490
|
transaction(fn) {
|
|
1484
1491
|
if (isInTransaction) {
|
|
1485
|
-
fn(stores);
|
|
1492
|
+
void fn(stores);
|
|
1486
1493
|
return;
|
|
1487
1494
|
}
|
|
1488
1495
|
isInTransaction = true;
|
|
@@ -1941,7 +1948,7 @@ function history(options = {}) {
|
|
|
1941
1948
|
internalState = null;
|
|
1942
1949
|
const previousPresent = historyState.present;
|
|
1943
1950
|
const newPresent = state;
|
|
1944
|
-
let hasChanged
|
|
1951
|
+
let hasChanged;
|
|
1945
1952
|
if (keys && keys.length > 0) {
|
|
1946
1953
|
hasChanged = keys.some((key) => {
|
|
1947
1954
|
return previousPresent[key] !== newPresent[key];
|
|
@@ -3152,5 +3159,5 @@ function compose(...middlewares) {
|
|
|
3152
3159
|
}
|
|
3153
3160
|
|
|
3154
3161
|
export { StoreError, StoreErrorCode, assertState, batch, combineComputed, combineEffects, combineSlices, combineValidators, compose, computed, createAsyncValidator, createDebouncedEffect, createEffect, createFederatedComputed, createFederatedSelector, createFederation, createFieldValidator, createLogger, createMockStorage, createNamespacedSlice, createSimpleEffect, createSimpleMiddleware, createSlice, createStorage, createStore, createSubscriber, createTestStore, createValidator, createWithMiddleware, deepClone, deepEqual, deepMerge, delay, devtools, effects, extendStore, flushMicrotasks, hasHistory, history, identity, immer, isFunction, logger, memoizeSelector, middlewareCompat, mockAction, omit, persist, pick, produce, resetSlices, selector, sessionStorage, shallowEqual, snapshot, spyOnStore, stateDiff, subscribeOnce, subscribeToMany, subscribeWithOptions, sync, toMiddlewareApi, triggerSync, validate, waitForFederated };
|
|
3155
|
-
//# sourceMappingURL=chunk-
|
|
3156
|
-
//# sourceMappingURL=chunk-
|
|
3162
|
+
//# sourceMappingURL=chunk-2QNZBQ4V.js.map
|
|
3163
|
+
//# sourceMappingURL=chunk-2QNZBQ4V.js.map
|