stroid 0.0.4 → 0.1.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/CHANGELOG.md +103 -25
- package/README.md +608 -82
- package/dist/async-cache-DFHwcBQL.d.cts +52 -0
- package/dist/async-cache-DFHwcBQL.d.ts +52 -0
- package/dist/async.cjs +29 -0
- package/dist/async.d.cts +40 -0
- package/dist/async.d.ts +30 -20
- package/dist/async.js +29 -1
- package/dist/computed-BbAZm1Dq.d.cts +17 -0
- package/dist/computed-CccdgY5j.d.ts +17 -0
- package/dist/computed.cjs +11 -0
- package/dist/computed.d.cts +29 -0
- package/dist/computed.d.ts +29 -0
- package/dist/computed.js +11 -0
- package/dist/core.cjs +30 -0
- package/dist/core.d.cts +5 -0
- package/dist/core.d.ts +5 -1
- package/dist/core.js +30 -1
- package/dist/devtools.cjs +1 -0
- package/dist/devtools.d.cts +19 -0
- package/dist/devtools.d.ts +19 -0
- package/dist/devtools.js +1 -0
- package/dist/helpers.cjs +20 -0
- package/dist/helpers.d.cts +29 -0
- package/dist/helpers.d.ts +29 -0
- package/dist/helpers.js +20 -0
- package/dist/index.cjs +30 -0
- package/dist/index.d.cts +130 -0
- package/dist/index.d.ts +130 -3
- package/dist/index.js +30 -1
- package/dist/options-CB35e3Xo.d.cts +245 -0
- package/dist/options-CB35e3Xo.d.ts +245 -0
- package/dist/persist.cjs +1 -0
- package/dist/persist.d.cts +2 -0
- package/dist/persist.d.ts +2 -0
- package/dist/persist.js +1 -0
- package/dist/react.cjs +31 -0
- package/dist/react.d.cts +52 -0
- package/dist/react.d.ts +45 -13
- package/dist/react.js +31 -1
- package/dist/runtime-admin.cjs +1 -0
- package/dist/runtime-admin.d.cts +4 -0
- package/dist/runtime-admin.d.ts +4 -0
- package/dist/runtime-admin.js +1 -0
- package/dist/runtime-tools.cjs +3 -0
- package/dist/runtime-tools.d.cts +39 -0
- package/dist/runtime-tools.d.ts +39 -0
- package/dist/runtime-tools.js +3 -0
- package/dist/selectors.cjs +1 -0
- package/dist/selectors.d.cts +4 -0
- package/dist/selectors.d.ts +4 -0
- package/dist/selectors.js +1 -0
- package/dist/server.cjs +10 -0
- package/dist/server.d.cts +14 -0
- package/dist/server.d.ts +14 -0
- package/dist/server.js +10 -0
- package/dist/sync.cjs +1 -0
- package/dist/sync.d.cts +2 -0
- package/dist/sync.d.ts +2 -0
- package/dist/sync.js +1 -0
- package/dist/testing.cjs +20 -0
- package/dist/testing.d.cts +16 -0
- package/dist/testing.d.ts +7 -7
- package/dist/testing.js +20 -1
- package/dist/types/adapters/options.d.ts +247 -0
- package/dist/types/async/clone.d.ts +2 -0
- package/dist/types/async/errors.d.ts +3 -0
- package/dist/types/async/inflight.d.ts +13 -0
- package/dist/types/async/rate.d.ts +5 -0
- package/dist/types/async/request.d.ts +3 -0
- package/dist/types/async-cache.d.ts +57 -0
- package/dist/types/async-fetch.d.ts +37 -0
- package/dist/types/async-registry.d.ts +96 -0
- package/dist/types/async-retry.d.ts +10 -0
- package/dist/types/async.d.ts +2 -0
- package/dist/types/computed-graph.d.ts +31 -0
- package/dist/types/computed.d.ts +15 -0
- package/dist/types/config.d.ts +2 -0
- package/dist/types/core.d.ts +1 -0
- package/dist/types/devfreeze.d.ts +1 -0
- package/dist/types/feature-registry.d.ts +69 -0
- package/dist/types/features/lifecycle.d.ts +28 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/integrations/query.d.ts +8 -0
- package/dist/types/internals/config.d.ts +62 -0
- package/dist/types/internals/diagnostics.d.ts +21 -0
- package/dist/types/internals/hooks-warnings.d.ts +6 -0
- package/dist/types/internals/reporting.d.ts +8 -0
- package/dist/types/internals/store-admin.d.ts +7 -0
- package/dist/types/internals/store-ops.d.ts +3 -0
- package/dist/types/runtime-admin.d.ts +2 -0
- package/dist/types/store-lifecycle/bind.d.ts +3 -0
- package/dist/types/store-lifecycle/hooks.d.ts +44 -0
- package/dist/types/store-lifecycle/identity.d.ts +23 -0
- package/dist/types/store-lifecycle/registry.d.ts +39 -0
- package/dist/types/store-lifecycle/types.d.ts +39 -0
- package/dist/types/store-lifecycle/validation.d.ts +45 -0
- package/dist/types/store-lifecycle.d.ts +20 -0
- package/dist/types/store-name.d.ts +19 -0
- package/dist/types/store-notify.d.ts +12 -0
- package/dist/types/store-read.d.ts +12 -0
- package/dist/types/store-registry.d.ts +74 -0
- package/dist/types/store-transaction.d.ts +12 -0
- package/dist/types/store-write.d.ts +45 -0
- package/dist/types/store.d.ts +7 -0
- package/dist/types/utils/clone.d.ts +4 -0
- package/dist/types/utils/hash.d.ts +8 -0
- package/dist/types/utils/path.d.ts +5 -0
- package/dist/types/utils/validation.d.ts +14 -0
- package/dist/types/utils.d.ts +5 -0
- package/dist/types-grvlY4BX.d.cts +37 -0
- package/dist/types-grvlY4BX.d.ts +37 -0
- package/package.json +77 -6
- package/dist/chunk-5F2FD6DX.js +0 -17
- package/dist/chunk-G6JMMJYH.js +0 -5
- package/dist/chunk-JBYLHJKN.js +0 -3
- package/dist/chunk-K6QIWMMW.js +0 -1
- package/dist/core-CKzRwVaY.d.ts +0 -213
package/CHANGELOG.md
CHANGED
|
@@ -1,31 +1,109 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
|
|
15
|
-
- `
|
|
16
|
-
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
-
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
## 0.1.0 - 2026-03-14
|
|
6
|
+
### Added
|
|
7
|
+
- `configureStroid({ strictMissingFeatures: true })` option to hard-fail when a feature is requested without its side-effect registration import.
|
|
8
|
+
- `configureStroid({ allowUntrustedHydration: true })` to opt in to hydrateStores on untrusted snapshots.
|
|
9
|
+
- `configureStroid({ mutatorProduce })` to plug in a structural-sharing mutator engine (e.g. Immer).
|
|
10
|
+
- `getSubscriberCount`, `getAsyncInflightCount`, and `getPersistQueueDepth` observability helpers in `runtime-tools`.
|
|
11
|
+
- `configureStroid({ assertRuntime: true })` option to throw on warnings/errors for test-time assertions.
|
|
12
|
+
- `createComputed(...)` for reactive derived stores.
|
|
13
|
+
- `getComputedGraph()` and `getComputedDeps()` diagnostics in `runtime-tools`.
|
|
14
|
+
- `configureStroid({ strictMutatorReturns: true })` to forbid mutator return values.
|
|
15
|
+
- `useStore`/`useSelector` now warn once when a store is missing (including SSR renders).
|
|
16
|
+
- `StrictStoreMap` opt-in type mode for compile-time enforcement of known store names.
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
- Runtime now always surfaces missing feature registrations via warnings (even in production), and can throw when `strictMissingFeatures` is enabled.
|
|
20
|
+
- Default `Path<T>` inference depth increased to 10; use `PathDepth<T, N>` for deeper paths.
|
|
21
|
+
- Removed `mergeStore` and `chain` from the public API; use `setStore(name, partial)` and mutator updates instead.
|
|
22
|
+
- `setStoreBatch` is now transactional: batched writes are staged and only committed if the batch completes successfully. `createStore`, `deleteStore`, and `hydrateStores` are disallowed inside a batch.
|
|
23
|
+
- `setStoreBatch` now warns and no-ops when called with a non-function instead of throwing synchronously.
|
|
24
|
+
- `resetStore` and `deleteStore` now accept `StoreKey`/`StoreDefinition` handles in addition to string names.
|
|
25
|
+
- `useStore` overloads now return non-nullable values when called with `StoreKey`/`StoreDefinition` handles.
|
|
26
|
+
- Persist internals split into `features/persist/*` (crypto/load/save/watch/types) to keep responsibilities isolated.
|
|
27
|
+
- `fetchStore` now warns in dev when it auto-creates a missing store (to surface typos early).
|
|
28
|
+
- `fetchStore` now refuses to overwrite non-async store shapes unless a `stateAdapter` is provided.
|
|
29
|
+
- `fetchStore` now hard-fails when the per-store inflight slot limit is exceeded (throws instead of returning `null`).
|
|
30
|
+
- Selector cache logic in React hooks is shared between `useStore` and `useSelector` to avoid duplicate implementations and ensure consistent selector identity checks.
|
|
31
|
+
- Feature hook context creation now avoids full object spread copies on every write/delete to reduce overhead.
|
|
32
|
+
- Path validation cache is capped per-store (no global cache thrash); per-store cache entries are cleared on store invalidation/reset.
|
|
33
|
+
- Feature runtimes now initialize on registration/bind, removing redundant per-write initialization checks.
|
|
34
|
+
- `useAsyncStoreSuspense` now triggers/awaits async fetches and reuses inflight promises for React Suspense integration.
|
|
35
|
+
- Mutator-based `setStore` now honors non-undefined return values to replace draft updates.
|
|
36
|
+
- Mutator-based `setStore` now warns in dev when a mutator returns a value, since return values replace the entire store.
|
|
37
|
+
- `hydrateStores` now requires explicit trust via the third argument or `configureStroid({ allowUntrustedHydration: true })` (breaking for implicit hydration).
|
|
38
|
+
- Persist now supports async crypto hooks (`encryptAsync`/`decryptAsync`) and `checksum: "sha256"` for stronger integrity checks.
|
|
39
|
+
- `sanitize` now rejects non-serializable host objects (WeakRef/EventTarget/streams) earlier instead of letting clone fallbacks fail later.
|
|
40
|
+
|
|
41
|
+
### Fixed
|
|
42
|
+
- `deleteStore` no longer emits an intermediate null notification before deletion, preventing double-render transitions.
|
|
43
|
+
- Async fetch 60s timeout now clears on completion to avoid late error handling after a successful request.
|
|
44
|
+
- Async rate limiter metadata now clears on store deletion to prevent leakage across request scopes.
|
|
45
|
+
- Subscriber storage uses `Set` consistently across `subscribeStore` and `subscribeWithSelector`, preventing type mismatches.
|
|
46
|
+
- `clearAllStores` now removes stores created during delete hooks.
|
|
47
|
+
- SSR registry isolation now uses AsyncLocalStorage-backed registries to prevent concurrent request scope leakage.
|
|
48
|
+
- Registry bindings no longer go stale after scope rebinds; registry exports proxy to the active scope (SSR safe).
|
|
49
|
+
- Store names now reject `__proto__`, `constructor`, and `prototype`, and `hydrateStores` skips invalid names to prevent registry pollution.
|
|
50
|
+
- Persist now validates encrypt/decrypt round-trips and disables persistence when crypto hooks are misconfigured.
|
|
51
|
+
- `setStore` returns typed `WriteResult` objects without casting.
|
|
52
|
+
- `subscribeWithSelector` now uses store snapshots so selectors never receive mutable live references.
|
|
53
|
+
- `deepClone` fallback now preserves Dates consistently (no JSON stringify fallback).
|
|
54
|
+
- `hashState` now handles circular structures and uses a stronger 53-bit hash for non-string inputs while preserving legacy checksums for strings.
|
|
55
|
+
- Chunked notification delivery now defers remaining subscribers if the store updates mid-flush, avoiding mixed snapshots in a single delivery.
|
|
56
|
+
- Chunked notification delivery now includes subscribers added mid-flush in the same notification cycle.
|
|
57
|
+
- `_hardResetAllStoresForTest` is no longer exported from the main package entry; it remains in `stroid/testing`.
|
|
58
|
+
- Async rate limiter now initializes per-slot windows and prunes stale metadata to avoid unbounded growth.
|
|
59
|
+
- Computed cleanup registrations are now scoped to the active registry, preventing cross-request leaks in SSR.
|
|
60
|
+
- Store delete hooks now iterate the registered feature set (including third-party features).
|
|
61
|
+
- Computed creation logs now use the configured `logSink` instead of raw `console.log`.
|
|
62
|
+
- Async fetch usage errors now route through the configured `logSink.critical` in production.
|
|
63
|
+
- `useAsyncStoreSuspense` no longer allocates a new default options object each render, stabilizing memoization.
|
|
64
|
+
|
|
65
|
+
### Docs
|
|
66
|
+
- `subscribeWithSelector` now documents `prev` semantics for batched writes.
|
|
67
|
+
|
|
68
|
+
### Testing
|
|
69
|
+
- `patch0/test` completed the `P0` stabilization pass for core state safety and production failure handling.
|
|
70
|
+
- Core testing now covers immutable reads/snapshots/history, guarded validator and lifecycle failures, delete/persist races, reset persistence, sanitize rejection for hostile payloads, SSR async fail-fast behavior, hydration replacement semantics, and stale sync messages after delete.
|
|
71
|
+
- `patch1/testing` extends the stabilization pass across selector correctness, dotted-key path handling, retry/caching guardrails, environment defaults, and sync payload consistency.
|
|
72
|
+
- Patch1 testing now covers re-entrant notify delivery, selector subscription false positives, dependency-aware selector memoization, escaped dotted keys and dotted entity IDs, bounded retry/cache behavior, production fallback env resolution, and canonical sync payloads under redaction.
|
|
73
|
+
- `remain` continues the draft-issue hardening pass across persist initialization ordering, pollution-safe sanitization, deep-clone fallback safety, request-scope contract enforcement, promise retry semantics, synchronous batch guarantees, and fallback entity ID uniqueness.
|
|
74
|
+
- Testing now also covers persisted init load precedence, forbidden prototype keys, forced `deepClone` fallback behavior, request-scope unknown-store failures, promise-input retry bypass, async batch rejection, and fixed-clock fallback entity inserts.
|
|
75
|
+
- `debugging/bug` closes the remaining pre-push runtime gaps across React inline selector stability, async stale-request ordering, middleware veto semantics, clone fallback safety, and deep-freeze resilience.
|
|
76
|
+
- Testing now also includes mounted React hook runtime coverage for `useStore()` inline selectors, alongside the branch’s new regressions for stale async ordering, middleware vetoes, exact selector fallback matching, and cycle-safe deep freeze.
|
|
77
|
+
- CI test scripts now run directory-based Node tests and type tests build dist before type-checking package declarations.
|
|
78
|
+
- React Suspense coverage added for `useAsyncStoreSuspense`, including stable memoization under rerender.
|
|
79
|
+
- SSR carrier test now asserts the global store remains unpolluted after concurrent requests.
|
|
80
|
+
|
|
81
|
+
### Changed
|
|
82
|
+
- `v0.0.5` is now the active development branch. `main` stays locked on the released `0.0.4` line until the next release is cut.
|
|
83
|
+
- Release artifacts remain release-managed on this branch: `dist/` may be absent here or still reflect the last released `0.0.4` build while current source/docs continue to move forward.
|
|
84
|
+
|
|
85
|
+
## 0.0.4 - 2026-03-06
|
|
86
|
+
### Added
|
|
87
|
+
- Persistence recovery hooks: `persist.onMigrationFail` and `persist.onStorageCleared`.
|
|
88
|
+
- Sync hardening options and behaviors: `sync.maxPayloadBytes` plus snapshot requests for reconnecting tabs.
|
|
89
|
+
### Changed
|
|
90
|
+
- Docs: converted the repo docs into the chapter-based handbook, then aligned README and API chapters with the real package surface so examples now use `setStore(name, path, value)`, `getStore(name, path)`, `useStore(name, path)`, `subscribeWithSelector(name, selector, equalityFn, listener)`, and `useFormStore(name, field)`.
|
|
91
|
+
- Packaging: rebuilt `dist` from the current `src`, and fixed the `stroid/react` build entry so the published subpath exports `useAsyncStore` and `useFormStore` consistently with the root package and docs.
|
|
92
|
+
### Fixed
|
|
93
|
+
- `hydrateStores` now rejects invalid schema payloads without leaving broken store shells behind.
|
|
94
|
+
- Middleware throws no longer poison later notifications.
|
|
95
|
+
- Critical persistence failures in production now surface through `onError`.
|
|
96
|
+
- Async lifecycle cleanup is hardened: inflight metadata clears on store deletion, lifecycle-owned requests abort on delete, and internal cleanup registrations are removed correctly.
|
|
97
|
+
- Persisted version/schema mismatches can recover through `onMigrationFail`, and cleared storage keys can be detected through `onStorageCleared`.
|
|
98
|
+
- Sync now reports unavailable `BroadcastChannel` transport, rejects oversized payloads safely, orders conflicts with monotonic clocks, and requests fresh snapshots on reconnect/focus/online.
|
|
99
|
+
|
|
100
|
+
## 0.0.3 - 2026-03-04
|
|
101
|
+
### Fixed
|
|
102
|
+
- Persistence now catches `localStorage.setItem` / driver `setItem` errors (e.g., `QuotaExceededError`) and routes them to `onError` instead of letting them bubble and crash. State updates still apply while persistence failures surface to the app.
|
|
25
103
|
- Async fetch metadata (inflight, cache, registry) now cleans up when a store is deleted, avoiding stale entries and refetch surprises.
|
|
26
104
|
- `enableRevalidateOnFocus` now removes its focus/online listeners when the store is deleted, preventing event-listener leaks.
|
|
27
105
|
- React `useSelector` now memoizes selected values with shallow equality, preventing endless re-renders when selectors return new array/object references for unchanged data.
|
|
28
|
-
- Store schemas are now enforced on write (`setStore
|
|
106
|
+
- Store schemas are now enforced on write (`setStore`), blocking invalid shapes at runtime instead of silently accepting them.
|
|
29
107
|
- `createStore` no longer overwrites an existing store name; it warns and keeps the original state.
|
|
30
108
|
- `setStore` path updates now respect existing structure: array paths no longer auto-create missing indices and array shapes are preserved instead of converting to objects.
|
|
31
109
|
- Docs: README updated with the pre-v1 bundle-size promise so the published package README matches the repo.
|