@biglogic/rgs 3.9.8 → 3.9.9

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/SKILL.md ADDED
@@ -0,0 +1,148 @@
1
+ ---
2
+ name: biglogic-rgs
3
+ description: Reactive global state management library for React - simple, secure, scalable
4
+ ---
5
+
6
+ # @biglogic/rgs - Reactive Global State
7
+
8
+ ## Overview
9
+
10
+ RGS (Argis) is a reactive global state management library for React. Simple, secure, and scalable. It provides typed state management with built-in persistence, security, and sync capabilities.
11
+
12
+ ## Instructions
13
+
14
+ ### Constraints
15
+
16
+ 1. **TypeScript Strict**: Always use strict typing - avoid `any` unless absolutely necessary
17
+ 2. **No console.log**: Use `console.debug` for debugging, or `console.warn`/`console.error` for warnings/errors
18
+ 3. **Build before commit**: Always run `npm run build` successfully before any commit
19
+ 4. **Test TypeScript**: Run `npx tsc --noEmit` to verify no type errors
20
+ 5. **No console.log debugging**: Never leave console.log statements in production code
21
+ 6. **Use arrow functions**: Prefer arrow functions over function declarations
22
+
23
+ ### Workflow
24
+
25
+ 1. **For new features**:
26
+ - Create in `core/` folder
27
+ - Export from `index.ts` if public API
28
+ - Add types to `core/types.ts`
29
+ - Run build and type-check
30
+
31
+ 2. **For bug fixes**:
32
+ - Run `npx tsc --noEmit` to identify issues
33
+ - Fix type errors first
34
+ - Verify build succeeds
35
+
36
+ 3. **For testing**:
37
+ - Run `npm run build` or `npm run test`
38
+ - Config is in `tests/` folder
39
+
40
+ ### Output Format
41
+
42
+ When adding new hooks or functions:
43
+
44
+ ```typescript
45
+ /**
46
+ * Description of what the hook does.
47
+ * @param param - Description of parameter
48
+ * @returns Description of return value
49
+ */
50
+ export const myHook = (param: string): boolean => {
51
+ // Implementation
52
+ }
53
+ ```
54
+
55
+ ## Usage Examples
56
+
57
+ ### Basic Store Creation
58
+
59
+ ```typescript
60
+ import { gstate } from '@biglogic/rgs'
61
+
62
+ // Create store with typed hook
63
+ const store = gstate({ count: 0, name: 'John' })
64
+
65
+ // Use typed hook for specific keys
66
+ const [count, setCount] = store('count')
67
+ const [name, setName] = store('name')
68
+
69
+ // Or use store directly
70
+ store.set('count', 5)
71
+ store.get('count')
72
+ ```
73
+
74
+ ### SSR Support
75
+
76
+ ```typescript
77
+ import { isServerSide, hydrateOnClient } from '@biglogic/rgs'
78
+
79
+ if (isServerSide()) {
80
+ // Server-side logic
81
+ }
82
+
83
+ hydrateOnClient(myStore)
84
+ ```
85
+
86
+ ### Security
87
+
88
+ ```typescript
89
+ import { generateEncryptionKey, validateKey } from '@biglogic/rgs'
90
+
91
+ // Generate encryption key for secure persistence
92
+ const key = generateEncryptionKey()
93
+
94
+ // Validate keys to prevent XSS
95
+ if (validateKey(userInput)) {
96
+ store.set(userInput, value)
97
+ }
98
+ ```
99
+
100
+ ## API Quick Reference
101
+
102
+ ### Core
103
+
104
+ | Function | Description |
105
+ |----------|-------------|
106
+ | `gstate(initialState, config?)` | Creates store + returns typed hook |
107
+ | `useStore(key, store?)` | React hook for state subscription |
108
+ | `createStore(config?)` | Creates store instance |
109
+ | `initState(config?)` | Initializes global store |
110
+ | `getStore()` | Gets current default store |
111
+
112
+ ### SSR
113
+
114
+ | Function | Description |
115
+ |----------|-------------|
116
+ | `isServerSide()` | Check if running on server |
117
+ | `isClientSide()` | Check if running on client |
118
+ | `hydrateOnClient(store)` | Hydrate store on client |
119
+
120
+ ### Security
121
+
122
+ | Function | Description |
123
+ |----------|-------------|
124
+ | `generateEncryptionKey()` | Generate AES-256 key |
125
+ | `validateKey(key)` | Validate key format (XSS prevention) |
126
+ | `sanitizeValue(value)` | Sanitize value |
127
+
128
+ ## Project Structure
129
+
130
+ ```
131
+ core/
132
+ ├── hooks.ts # React hooks (useStore, useSyncedState)
133
+ ├── store.ts # Core store implementation
134
+ ├── types.ts # TypeScript types
135
+ ├── security.ts # Security utilities
136
+ ├── persistence.ts # Storage persistence
137
+ ├── sync.ts # Sync engine
138
+ └── ssr.ts # SSR support
139
+ ```
140
+
141
+ ## Dependencies
142
+
143
+ - **peerDependencies**: `react`, `react-dom` (>=16.8.0)
144
+ - **devDependencies**: `typescript`, `tsup`, `terser`
145
+
146
+ ## License
147
+
148
+ MIT - Copyright Dario Passariello
package/core/hooks.d.ts CHANGED
@@ -15,3 +15,4 @@ export declare function useSyncedState<T = unknown>(key: string, store?: IStore<
15
15
  ];
16
16
  export declare const useSyncStatus: () => SyncState;
17
17
  export declare const triggerSync: (namespace?: string) => Promise<void>;
18
+ export declare function useStoreSubscribe<S extends Record<string, unknown> = Record<string, unknown>>(store?: IStore<S>): readonly [boolean, () => void];
package/docs/SKILL.md ADDED
@@ -0,0 +1,148 @@
1
+ ---
2
+ name: biglogic-rgs
3
+ description: Reactive global state management library for React - simple, secure, scalable
4
+ ---
5
+
6
+ # @biglogic/rgs - Reactive Global State
7
+
8
+ ## Overview
9
+
10
+ RGS (Argis) is a reactive global state management library for React. Simple, secure, and scalable. It provides typed state management with built-in persistence, security, and sync capabilities.
11
+
12
+ ## Instructions
13
+
14
+ ### Constraints
15
+
16
+ 1. **TypeScript Strict**: Always use strict typing - avoid `any` unless absolutely necessary
17
+ 2. **No console.log**: Use `console.debug` for debugging, or `console.warn`/`console.error` for warnings/errors
18
+ 3. **Build before commit**: Always run `npm run build` successfully before any commit
19
+ 4. **Test TypeScript**: Run `npx tsc --noEmit` to verify no type errors
20
+ 5. **No console.log debugging**: Never leave console.log statements in production code
21
+ 6. **Use arrow functions**: Prefer arrow functions over function declarations
22
+
23
+ ### Workflow
24
+
25
+ 1. **For new features**:
26
+ - Create in `core/` folder
27
+ - Export from `index.ts` if public API
28
+ - Add types to `core/types.ts`
29
+ - Run build and type-check
30
+
31
+ 2. **For bug fixes**:
32
+ - Run `npx tsc --noEmit` to identify issues
33
+ - Fix type errors first
34
+ - Verify build succeeds
35
+
36
+ 3. **For testing**:
37
+ - Run `npm run build` or `npm run test`
38
+ - Config is in `tests/` folder
39
+
40
+ ### Output Format
41
+
42
+ When adding new hooks or functions:
43
+
44
+ ```typescript
45
+ /**
46
+ * Description of what the hook does.
47
+ * @param param - Description of parameter
48
+ * @returns Description of return value
49
+ */
50
+ export const myHook = (param: string): boolean => {
51
+ // Implementation
52
+ }
53
+ ```
54
+
55
+ ## Usage Examples
56
+
57
+ ### Basic Store Creation
58
+
59
+ ```typescript
60
+ import { gstate } from '@biglogic/rgs'
61
+
62
+ // Create store with typed hook
63
+ const store = gstate({ count: 0, name: 'John' })
64
+
65
+ // Use typed hook for specific keys
66
+ const [count, setCount] = store('count')
67
+ const [name, setName] = store('name')
68
+
69
+ // Or use store directly
70
+ store.set('count', 5)
71
+ store.get('count')
72
+ ```
73
+
74
+ ### SSR Support
75
+
76
+ ```typescript
77
+ import { isServerSide, hydrateOnClient } from '@biglogic/rgs'
78
+
79
+ if (isServerSide()) {
80
+ // Server-side logic
81
+ }
82
+
83
+ hydrateOnClient(myStore)
84
+ ```
85
+
86
+ ### Security
87
+
88
+ ```typescript
89
+ import { generateEncryptionKey, validateKey } from '@biglogic/rgs'
90
+
91
+ // Generate encryption key for secure persistence
92
+ const key = generateEncryptionKey()
93
+
94
+ // Validate keys to prevent XSS
95
+ if (validateKey(userInput)) {
96
+ store.set(userInput, value)
97
+ }
98
+ ```
99
+
100
+ ## API Quick Reference
101
+
102
+ ### Core
103
+
104
+ | Function | Description |
105
+ |----------|-------------|
106
+ | `gstate(initialState, config?)` | Creates store + returns typed hook |
107
+ | `useStore(key, store?)` | React hook for state subscription |
108
+ | `createStore(config?)` | Creates store instance |
109
+ | `initState(config?)` | Initializes global store |
110
+ | `getStore()` | Gets current default store |
111
+
112
+ ### SSR
113
+
114
+ | Function | Description |
115
+ |----------|-------------|
116
+ | `isServerSide()` | Check if running on server |
117
+ | `isClientSide()` | Check if running on client |
118
+ | `hydrateOnClient(store)` | Hydrate store on client |
119
+
120
+ ### Security
121
+
122
+ | Function | Description |
123
+ |----------|-------------|
124
+ | `generateEncryptionKey()` | Generate AES-256 key |
125
+ | `validateKey(key)` | Validate key format (XSS prevention) |
126
+ | `sanitizeValue(value)` | Sanitize value |
127
+
128
+ ## Project Structure
129
+
130
+ ```
131
+ core/
132
+ ├── hooks.ts # React hooks (useStore, useSyncedState)
133
+ ├── store.ts # Core store implementation
134
+ ├── types.ts # TypeScript types
135
+ ├── security.ts # Security utilities
136
+ ├── persistence.ts # Storage persistence
137
+ ├── sync.ts # Sync engine
138
+ └── ssr.ts # SSR support
139
+ ```
140
+
141
+ ## Dependencies
142
+
143
+ - **peerDependencies**: `react`, `react-dom` (>=16.8.0)
144
+ - **devDependencies**: `typescript`, `tsup`, `terser`
145
+
146
+ ## License
147
+
148
+ MIT - Copyright Dario Passariello
@@ -6,6 +6,38 @@ Complete API reference for RGS (Argis) - Reactive Global State.
6
6
 
7
7
  ## Core Functions
8
8
 
9
+ ### `gstate`
10
+
11
+ Creates a reactive store with a built-in typed hook in one line.
12
+
13
+ ```typescript
14
+ function gstate<S extends Record<string, unknown>>(
15
+ initialState: S,
16
+ configOrNamespace?: string | StoreConfig<S>
17
+ ): (<K extends keyof S>(key: K) => readonly [S[K] | undefined, (val: S[K] | StateUpdater<S[K]>, options?: PersistOptions) => boolean]) & IStore<S>
18
+ ```
19
+
20
+ **Parameters:**
21
+ - `initialState` - Initial state object
22
+ - `configOrNamespace` - Optional namespace string or full StoreConfig
23
+
24
+ **Returns:** A callable function that returns typed hooks when called with a key, plus the full store interface.
25
+
26
+ **Example:**
27
+ ```typescript
28
+ const useCounter = gstate({ count: 0, name: 'John' })
29
+
30
+ // Get typed hook for specific key
31
+ const [count, setCount] = useCounter('count')
32
+ const [name, setName] = useCounter('name')
33
+
34
+ // Or use store methods directly
35
+ useCounter.set('count', 5)
36
+ useCounter.get('count')
37
+ ```
38
+
39
+ ---
40
+
9
41
  ### `initState`
10
42
 
11
43
  Initializes a global store instance.
@@ -7,62 +7,56 @@ Stop wasting time on boilerplate. Here is how you deploy the RGS Panzer in your
7
7
  The engine is lightweight but armored.
8
8
 
9
9
  ```bash
10
- npm install rgs
10
+ npm install @biglogic/rgs
11
11
  ```
12
12
 
13
- ## 2. Initialization: The "Big Bang"
13
+ ## 2. Quick Start: The Zen Way (Recommended)
14
14
 
15
- In your main entry file (e.g., `main.tsx` or `App.tsx`), wake up the engine once.
15
+ The simplest way to use RGS - one line creates both store and typed hook.
16
16
 
17
17
  ```typescript
18
- import { initState, useStore } from '@biglogic/rgs';
18
+ import { gstate } from '@biglogic/rgs';
19
19
 
20
- // Initialize with optional settings
21
- initState({
22
- namespace: 'my-awesome-app',
23
- persistence: true // Optional: Saves everything to localStorage automatically
24
- });
25
- ```
26
-
27
- ## 3. Usage: Instant Reactions
28
-
29
- Use the `useStore` hook. No providers, no wrappers. Just raw, atomic power.
30
-
31
- ```tsx
32
- import { useStore } from '@biglogic/rgs';
20
+ // ONE line creates a typed store + hook
21
+ const useCounter = gstate({ count: 0, name: 'John' })
33
22
 
34
23
  function Counter() {
35
- // If 'count' doesn't exist yet, it defaults to undefined. Easy.
36
- const [count, setCount] = useStore<number>('count');
24
+ // Get typed hook for specific keys
25
+ const [count, setCount] = useCounter('count')
26
+ const [name, setName] = useCounter('name')
37
27
 
38
28
  return (
39
- <div className="card">
40
- <h1>Power Level: {count ?? 0}</h1>
41
- <button onClick={() => setCount((prev) => (prev || 0) + 1)}>
42
- Boost Power 💥
29
+ <div>
30
+ <p>Hello, {name}!</p>
31
+ <p>Count: {count}</p>
32
+ <button onClick={() =u003e setCount(count + 1)}>
33
+ +1
43
34
  </button>
44
35
  </div>
45
- );
36
+ )
46
37
  }
47
38
  ```
48
39
 
49
- ## 🧐 What just happened?
50
-
51
- - **Reactive Subscription**: `useStore('count')` tells React to watch the 'count' key. Surgical updates only.
52
- - **Global Scope**: `setCount` updates the value everywhere in the app, instantly.
53
- - **Resilient Nature**: If you access a key that hasn't been set yet, RGS returns `undefined` gracefully instead of throwing a tantrum.
40
+ Or use store methods directly:
41
+ ```typescript
42
+ useCounter.set('count', 5)
43
+ useCounter.get('count')
44
+ ```
54
45
 
55
- ## 🚨 Pro Tip: Direct Store Access
46
+ ## 3. Classic Way (Global Store)
56
47
 
57
- Need to access state outside of React components? Simple.
48
+ If you prefer a global store approach:
58
49
 
59
50
  ```typescript
60
- import { getStore } from '@biglogic/rgs';
61
-
62
- const value = getStore()?.get('count');
63
- getStore()?.set('count', 9001);
64
- ```
51
+ import { initState, useStore } from '@biglogic/rgs';
65
52
 
66
- ---
53
+ // Initialize once at app root
54
+ initState({
55
+ namespace: 'my-awesome-app',
56
+ persistence: true
57
+ });
67
58
 
68
- **Next step:** [The Magnetar Way: One-Liner Power](the-magnetar-way.md)
59
+ // Use anywhere in your app
60
+ const [count, setCount] = useStore('count')
61
+ const [user, setUser] = useStore('user')
62
+ ```
package/index.cjs CHANGED
@@ -315,20 +315,20 @@ function f(e, ...t) {
315
315
  var g = Object, h = g.getPrototypeOf, m = "constructor", S = "prototype", _ = "configurable", w = "enumerable", b = "writable", v = "value", E = e => !!e && !!e[y];
316
316
 
317
317
  function k(e) {
318
- return !!e && (C(e) || j(e) || !!e[d] || !!e[m]?.[d] || T(e) || I(e));
318
+ return !!e && (O(e) || j(e) || !!e[d] || !!e[m]?.[d] || T(e) || I(e));
319
319
  }
320
320
 
321
- var x = g[S][m].toString(), O = new WeakMap;
321
+ var x = g[S][m].toString(), C = new WeakMap;
322
322
 
323
- function C(e) {
323
+ function O(e) {
324
324
  if (!e || !z(e)) return !1;
325
325
  const t = h(e);
326
326
  if (null === t || t === g[S]) return !0;
327
327
  const n = g.hasOwnProperty.call(t, m) && t[m];
328
328
  if (n === Object) return !0;
329
329
  if (!V(n)) return !1;
330
- let r = O.get(n);
331
- return void 0 === r && (r = Function.toString.call(n), O.set(n, r)), r === x;
330
+ let r = C.get(n);
331
+ return void 0 === r && (r = Function.toString.call(n), C.set(n, r)), r === x;
332
332
  }
333
333
 
334
334
  function A(e, t, n = !0) {
@@ -356,7 +356,7 @@ function L(e, t) {
356
356
  if (T(e)) return new Map(e);
357
357
  if (I(e)) return new Set(e);
358
358
  if (j(e)) return Array[S].slice.call(e);
359
- const n = C(e);
359
+ const n = O(e);
360
360
  if (!0 === t || "class_only" === t && !n) {
361
361
  const t = g.getOwnPropertyDescriptors(e);
362
362
  delete t[y];
@@ -791,8 +791,8 @@ var we = (new class {
791
791
  iv: r
792
792
  }, t.key, s);
793
793
  return JSON.parse((new TextDecoder).decode(o));
794
- }, Oe = null, Ce = e => {
795
- Oe && Oe(e);
794
+ }, Ce = null, Oe = e => {
795
+ Ce && Ce(e);
796
796
  }, Ae = (e, t, n) => {
797
797
  e.set(t instanceof RegExp ? t.source : t, n);
798
798
  }, De = (e, t, n, r) => {
@@ -831,7 +831,7 @@ var we = (new class {
831
831
  granted: r,
832
832
  timestamp: Date.now()
833
833
  }, o = e.get(t) || [];
834
- return o.push(s), e.set(t, o), Ce({
834
+ return o.push(s), e.set(t, o), Oe({
835
835
  timestamp: Date.now(),
836
836
  action: "set",
837
837
  key: `consent:${n}`,
@@ -866,7 +866,7 @@ var Te = () => {
866
866
  }
867
867
  };
868
868
  }, Ve = n => {
869
- const r = new Map, s = new Map, o = new Map, a = new Set, i = new Map, u = new Set, d = new Map, y = new Map, p = new Map, f = new Map, g = new Map, h = new Map, m = new Map, S = new Map, _ = n?.namespace || "gstate", w = n?.silent ?? !1, b = n?.debounceTime ?? 150, v = n?.version ?? 0, E = n?.storage || Ie(), k = n?.onError, x = n?.maxObjectSize ?? 0, O = n?.maxTotalSize ?? 0, C = n?.encryptionKey ?? null, A = n?.validateInput ?? !0, D = n?.auditEnabled ?? !0, M = n?.userId, P = n?.immer ?? !0, R = n?.persistByDefault ?? n?.persistence ?? n?.persist ?? !1;
869
+ const r = new Map, s = new Map, o = new Map, a = new Set, i = new Map, u = new Set, d = new Map, y = new Map, p = new Map, f = new Map, g = new Map, h = new Map, m = new Map, S = new Map, _ = n?.namespace || "gstate", w = n?.silent ?? !1, b = n?.debounceTime ?? 150, v = n?.version ?? 0, E = n?.storage || Ie(), k = n?.onError, x = n?.maxObjectSize ?? 0, C = n?.maxTotalSize ?? 0, O = n?.encryptionKey ?? null, A = n?.validateInput ?? !0, D = n?.auditEnabled ?? !0, M = n?.userId, P = n?.immer ?? !0, R = n?.persistByDefault ?? n?.persistence ?? n?.persist ?? !1;
870
870
  n?.accessRules && n.accessRules.forEach(e => Ae(m, e.pattern, e.permissions));
871
871
  let j, T = !1, I = !1, z = !1, V = 0, $ = null, N = null;
872
872
  const U = new Promise(e => {
@@ -879,7 +879,7 @@ var Te = () => {
879
879
  storage: E,
880
880
  config: n || {},
881
881
  diskQueue: g,
882
- encryptionKey: C,
882
+ encryptionKey: O,
883
883
  audit: q,
884
884
  onError: k,
885
885
  silent: w,
@@ -924,7 +924,7 @@ var Te = () => {
924
924
  }
925
925
  })(B(), e, t);
926
926
  }, q = (e, t, n, r) => {
927
- D && null !== Oe && Ce && Ce({
927
+ D && null !== Ce && Oe && Oe({
928
928
  timestamp: Date.now(),
929
929
  action: e,
930
930
  key: t,
@@ -1038,7 +1038,7 @@ var Te = () => {
1038
1038
  })(K());
1039
1039
  }, X = {}, Z = {
1040
1040
  _setSilently: (t, n) => {
1041
- const a = o.get(t) || 0, i = P && null !== n && "object" == typeof n ? F(e(n), !0) : n, c = (x > 0 || O > 0) && !Te() ? J(i) : 0;
1041
+ const a = o.get(t) || 0, i = P && null !== n && "object" == typeof n ? F(e(n), !0) : n, c = (x > 0 || C > 0) && !Te() ? J(i) : 0;
1042
1042
  V = V - a + c, o.set(t, c), r.set(t, i), s.set(t, (s.get(t) || 0) + 1), N = null;
1043
1043
  },
1044
1044
  _registerMethod: (e, t, n) => {
@@ -1058,7 +1058,7 @@ var Te = () => {
1058
1058
  });
1059
1059
  const p = P && null !== d && "object" == typeof d ? F(e(d), !0) : d;
1060
1060
  if (!t(l, p)) {
1061
- const e = (x > 0 || O > 0) && !Te() ? J(p) : 0;
1061
+ const e = (x > 0 || C > 0) && !Te() ? J(p) : 0;
1062
1062
  if (x > 0 && e > x) {
1063
1063
  const t = new Error(`Object size (${e} bytes) exceeds maxObjectSize (${x} bytes)`);
1064
1064
  return k && k(t, {
@@ -1066,10 +1066,10 @@ var Te = () => {
1066
1066
  key: a
1067
1067
  }), !1;
1068
1068
  }
1069
- if (O > 0) {
1069
+ if (C > 0) {
1070
1070
  const t = V - y + e;
1071
- if (t > O) {
1072
- const e = new Error(`Total store size (${t} bytes) exceeds limit (${O} bytes)`);
1071
+ if (t > C) {
1072
+ const e = new Error(`Total store size (${t} bytes) exceeds limit (${C} bytes)`);
1073
1073
  return k && k(e, {
1074
1074
  operation: "set"
1075
1075
  }), !1;
@@ -1291,7 +1291,7 @@ var Te = () => {
1291
1291
  operation: "hydration"
1292
1292
  });
1293
1293
  }
1294
- })(K(), e => (x > 0 || O > 0) && !Te() ? J(e) : 0, () => {
1294
+ })(K(), e => (x > 0 || C > 0) && !Te() ? J(e) : 0, () => {
1295
1295
  z = !0, N = null, j(), Q();
1296
1296
  }).then(() => {}) : (z = !0, j()), n?.sync) {
1297
1297
  const e = n.sync, t = async () => {
@@ -1871,8 +1871,9 @@ exports.getStore = Ne, exports.gstate = (e, t) => {
1871
1871
  e && Object.entries(e).forEach(([e, t]) => {
1872
1872
  null === n.get(e) && n._setSilently(e, t);
1873
1873
  });
1874
- return "undefined" == typeof window || Te() || (window.gstate = n, window.gState = n,
1875
- window.rgs = n), Object.assign(e => Ue(e, n), n);
1874
+ const r = e => Ue(e, n);
1875
+ return "undefined" == typeof window || Te() || (window.gstate = r, window.gState = n,
1876
+ window.rgs = n), Object.assign(r, n);
1876
1877
  }, exports.guardPlugin = e => ({
1877
1878
  name: "gstate-guard",
1878
1879
  hooks: {
@@ -1982,7 +1983,7 @@ exports.hydrateOnClient = async e => {
1982
1983
  e._setSilently(t, n);
1983
1984
  });
1984
1985
  }, exports.isClientSide = Qe, exports.isCryptoAvailable = Ee, exports.isServerSide = He,
1985
- exports.logAudit = Ce, exports.loggerPlugin = e => ({
1986
+ exports.logAudit = Oe, exports.loggerPlugin = e => ({
1986
1987
  name: "gstate-logger",
1987
1988
  hooks: {
1988
1989
  onSet: ({key: e, value: t, version: n}) => {
@@ -2025,7 +2026,7 @@ exports.logAudit = Ce, exports.loggerPlugin = e => ({
2025
2026
  type: "select",
2026
2027
  selector: e
2027
2028
  }), exports.setAuditLogger = e => {
2028
- Oe = e;
2029
+ Ce = e;
2029
2030
  }, exports.snapshotPlugin = () => {
2030
2031
  const e = new Map;
2031
2032
  return {
@@ -2120,7 +2121,12 @@ exports.logAudit = Ce, exports.loggerPlugin = e => ({
2120
2121
  exports.useHydrationStatus = Ye, exports.useIsStoreReady = e => {
2121
2122
  const t = e || $e, r = n.useMemo(() => e => t ? t._subscribe(e) : () => {}, [ t ]);
2122
2123
  return n.useSyncExternalStore(r, () => !!t && t.isReady, () => !0);
2123
- }, exports.useSimpleState = Ue, exports.useStore = Ue, exports.useSyncStatus = () => {
2124
+ }, exports.useSimpleState = Ue, exports.useStore = Ue, exports.useStoreSubscribe = function(e) {
2125
+ const t = n.useMemo(() => e || $e, [ e ]), r = n.useCallback(e => t ? t._subscribe(e) : () => {}, [ t ]), s = n.useCallback(() => !0, []), o = n.useCallback(() => !0, []);
2126
+ n.useSyncExternalStore(r, s, o);
2127
+ const [, a] = n.useState(0);
2128
+ return [ !0, n.useCallback(() => a(e => e + 1), []) ];
2129
+ }, exports.useSyncStatus = () => {
2124
2130
  const [e, t] = n.useState({
2125
2131
  isOnline: !0,
2126
2132
  isSyncing: !1,
package/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import { createStore as baseCreateStore } from "./core/store";
2
2
  import { useStore as baseUseStore } from "./core/hooks";
3
3
  import * as Security from "./core/security";
4
4
  import type { IStore, StoreConfig } from "./core/types";
5
- export declare const gstate: <S extends Record<string, unknown>>(initialState: S, configOrNamespace?: string | StoreConfig<S>) => IStore<S> & (<K extends keyof S>(key: K) => readonly [S[K] | undefined, (val: S[K] | ((draft: S[K]) => S[K]), options?: unknown) => boolean]);
5
+ export declare const gstate: <S extends Record<string, unknown>>(initialState: S, configOrNamespace?: string | StoreConfig<S>) => (<K extends keyof S>(key: K) => readonly [S[K] | undefined, (val: S[K] | import(".").StateUpdater<S[K]>, options?: import("./advanced").PersistOptions) => boolean]) & IStore<S>;
6
6
  export { baseCreateStore as createStore };
7
7
  export { useStore, useIsStoreReady, initState, getStore, destroyState, useStore as useGState, useStore as useSimpleState } from "./core/hooks";
8
8
  export { createAsyncStore } from "./core/async";
@@ -12,7 +12,7 @@ export { createThunkStore, createActions, createAsyncAction, createAsyncActions,
12
12
  export type { ThunkAction, ThunkDispatch, ThunkActionPayload, Effect } from "./core/thunk";
13
13
  export { SyncEngine, createSyncEngine } from "./core/sync";
14
14
  export type { SyncConfig, SyncState, SyncResult, SyncStrategy, ConflictInfo, ConflictResolution } from "./core/sync";
15
- export { initSync, destroySync, useSyncedState, useSyncStatus, triggerSync } from "./core/hooks";
15
+ export { initSync, destroySync, useSyncedState, useSyncStatus, triggerSync, useStoreSubscribe } from "./core/hooks";
16
16
  export * from "./plugins/index";
17
17
  export { generateEncryptionKey, exportKey, importKey, isCryptoAvailable, setAuditLogger, logAudit, validateKey, sanitizeValue, deriveKeyFromPassword, generateSalt } from "./core/security";
18
18
  export declare const addAccessRule: (pattern: string | ((key: string, userId?: string) => boolean), perms: Security.Permission[]) => void | undefined;
package/index.js CHANGED
@@ -1446,7 +1446,7 @@ function at(e, t) {
1446
1446
  }, [ u, i, e, r ]), d ];
1447
1447
  }
1448
1448
 
1449
- var it, ct, lt, ut, dt, ft, yt = () => {
1449
+ var it = () => {
1450
1450
  const [e, t] = s({
1451
1451
  isOnline: !0,
1452
1452
  isSyncing: !1,
@@ -1472,12 +1472,21 @@ var it, ct, lt, ut, dt, ft, yt = () => {
1472
1472
  const n = Array.from(rt.values()).map(t => t.onStateChange(e));
1473
1473
  return () => n.forEach(e => e());
1474
1474
  }, []), e;
1475
- }, pt = async e => {
1475
+ }, ct = async e => {
1476
1476
  const t = e || Xe?.namespace;
1477
1477
  if (!t) return;
1478
1478
  const n = rt.get(t);
1479
1479
  n && await n.flush();
1480
- }, ht = (e, t) => {
1480
+ };
1481
+
1482
+ function lt(r) {
1483
+ const o = e(() => r || Xe, [ r ]), a = n(e => o ? o._subscribe(e) : () => {}, [ o ]), i = n(() => !0, []), c = n(() => !0, []);
1484
+ t(a, i, c);
1485
+ const [, l] = s(0);
1486
+ return [ !0, n(() => l(e => e + 1), []) ];
1487
+ }
1488
+
1489
+ var ut, dt, ft, yt, pt, ht, gt = (e, t) => {
1481
1490
  const n = t?.key || "async_data", r = t?.store || Ge({
1482
1491
  namespace: `async_${n}`,
1483
1492
  silent: !0
@@ -1531,22 +1540,22 @@ var it, ct, lt, ut, dt, ft, yt = () => {
1531
1540
  }
1532
1541
  }
1533
1542
  });
1534
- }, gt = () => "undefined" == typeof window || void 0 === window.document, mt = () => !gt(), _t = e => {
1543
+ }, mt = () => "undefined" == typeof window || void 0 === window.document, _t = () => !mt(), St = e => {
1535
1544
  const t = e?.ssrSafe ?? !0, n = e?.deferHydration ?? !1;
1536
1545
  let r = e?.storage;
1537
- !r && t && gt() && (r = He());
1546
+ !r && t && mt() && (r = He());
1538
1547
  const s = Ge({
1539
1548
  ...e,
1540
1549
  storage: r || void 0,
1541
1550
  persistByDefault: !n && (e?.persistByDefault ?? !1)
1542
1551
  });
1543
1552
  let o = !1, a = null;
1544
- e?.initialState && gt() && (Object.entries(e.initialState).forEach(([e, t]) => {
1553
+ e?.initialState && mt() && (Object.entries(e.initialState).forEach(([e, t]) => {
1545
1554
  s._setSilently(e, t);
1546
1555
  }), a = JSON.stringify(e.initialState));
1547
1556
  return Object.assign(s, {
1548
1557
  hydrate: async () => {
1549
- if (!o && !gt()) {
1558
+ if (!o && !mt()) {
1550
1559
  if (t && !s.namespace.startsWith("async_")) {
1551
1560
  const t = s.getSnapshot(), n = Ge({
1552
1561
  ...e,
@@ -1561,33 +1570,33 @@ var it, ct, lt, ut, dt, ft, yt = () => {
1561
1570
  await s.whenReady();
1562
1571
  }
1563
1572
  },
1564
- getSerializedState: () => gt() ? JSON.stringify(s.getSnapshot()) : a,
1573
+ getSerializedState: () => mt() ? JSON.stringify(s.getSnapshot()) : a,
1565
1574
  isHydrated: () => o || s.isReady
1566
1575
  });
1567
- }, St = async e => {
1568
- gt() || await e.whenReady();
1569
- }, wt = e => JSON.stringify(e.getSnapshot()), bt = (e, t) => {
1570
- if (!gt()) try {
1576
+ }, wt = async e => {
1577
+ mt() || await e.whenReady();
1578
+ }, bt = e => JSON.stringify(e.getSnapshot()), vt = (e, t) => {
1579
+ if (!mt()) try {
1571
1580
  const n = JSON.parse(t);
1572
1581
  Object.entries(n).forEach(([t, n]) => {
1573
1582
  e._setSilently(t, n);
1574
1583
  });
1575
1584
  } catch (e) {}
1576
- }, vt = () => (it || (it = f("react"), ct = it.useState, lt = it.useEffect, ut = it.useSyncExternalStore,
1577
- dt = it.useMemo, ft = it.useCallback), {
1578
- React: it,
1579
- useState: ct,
1580
- useEffect: lt,
1581
- useSyncExternalStore: ut,
1582
- useMemo: dt,
1583
- useCallback: ft
1584
- }), Et = () => {
1585
- const {useSyncExternalStore: e} = vt();
1586
- return e(e => () => {}, () => mt(), () => !0);
1587
- }, kt = () => {
1588
- const {useState: e, useEffect: t} = vt(), [n, r] = e(() => gt()), [s, o] = e(() => gt());
1585
+ }, Et = () => (ut || (ut = f("react"), dt = ut.useState, ft = ut.useEffect, yt = ut.useSyncExternalStore,
1586
+ pt = ut.useMemo, ht = ut.useCallback), {
1587
+ React: ut,
1588
+ useState: dt,
1589
+ useEffect: ft,
1590
+ useSyncExternalStore: yt,
1591
+ useMemo: pt,
1592
+ useCallback: ht
1593
+ }), kt = () => {
1594
+ const {useSyncExternalStore: e} = Et();
1595
+ return e(e => () => {}, () => _t(), () => !0);
1596
+ }, Ot = () => {
1597
+ const {useState: e, useEffect: t} = Et(), [n, r] = e(() => mt()), [s, o] = e(() => mt());
1589
1598
  return t(() => {
1590
- if (gt()) return;
1599
+ if (mt()) return;
1591
1600
  r(!0);
1592
1601
  const e = setTimeout(() => {
1593
1602
  o(!0), r(!1);
@@ -1597,10 +1606,10 @@ dt = it.useMemo, ft = it.useCallback), {
1597
1606
  isHydrated: s,
1598
1607
  isHydrating: n
1599
1608
  };
1600
- }, Ot = e => {
1601
- const {useState: t, useEffect: n, useMemo: r} = vt(), [s, o] = t(() => !!gt() || (e.isHydrated?.() ?? e.isReady));
1609
+ }, Ct = e => {
1610
+ const {useState: t, useEffect: n, useMemo: r} = Et(), [s, o] = t(() => !!mt() || (e.isHydrated?.() ?? e.isReady));
1602
1611
  return n(() => {
1603
- if (gt()) return;
1612
+ if (mt()) return;
1604
1613
  const t = () => {
1605
1614
  const t = e.isHydrated?.() ?? e.isReady;
1606
1615
  o(t);
@@ -1645,24 +1654,24 @@ dt = it.useMemo, ft = it.useCallback), {
1645
1654
  }
1646
1655
  };
1647
1656
  }, [ e, s ]);
1648
- }, Ct = e => {
1649
- const t = _t(e);
1657
+ }, Dt = e => {
1658
+ const t = St(e);
1650
1659
  return Object.assign(t, {
1651
- useHydrated: Et,
1652
- useHydrationStatus: kt,
1660
+ useHydrated: kt,
1661
+ useHydrationStatus: Ot,
1653
1662
  useDeferredStore: e => {
1654
- const n = Ot(t), {useCallback: r} = vt();
1663
+ const n = Ct(t), {useCallback: r} = Et();
1655
1664
  return (e => {
1656
- const {useSyncExternalStore: t} = vt();
1665
+ const {useSyncExternalStore: t} = Et();
1657
1666
  return t(r(t => n._subscribe(t, e), [ n, e ]), r(() => n.get(e), [ n, e ]), () => {});
1658
1667
  })(e);
1659
1668
  }
1660
1669
  });
1661
- }, Dt = e => e.getSnapshot(), Mt = (e, t) => {
1662
- gt() || Object.entries(t).forEach(([t, n]) => {
1670
+ }, Mt = e => e.getSnapshot(), At = (e, t) => {
1671
+ mt() || Object.entries(t).forEach(([t, n]) => {
1663
1672
  e._setSilently(t, n);
1664
1673
  });
1665
- }, At = (e, t) => {
1674
+ }, jt = (e, t) => {
1666
1675
  const n = t?.extraArgument, r = async t => {
1667
1676
  if ("function" == typeof t) return t(r, () => e.getSnapshot(), n);
1668
1677
  if (t.type) {
@@ -1681,10 +1690,10 @@ dt = it.useMemo, ft = it.useCallback), {
1681
1690
  return Object.assign(e, {
1682
1691
  dispatch: r
1683
1692
  });
1684
- }, jt = (e, t) => {
1685
- const n = At(e);
1693
+ }, Rt = (e, t) => {
1694
+ const n = jt(e);
1686
1695
  return Object.assign(n.dispatch, t);
1687
- }, Rt = (e, t) => async (n, r) => {
1696
+ }, Pt = (e, t) => async (n, r) => {
1688
1697
  const s = r()[e];
1689
1698
  n({
1690
1699
  type: `SET_${e.toUpperCase()}`,
@@ -1714,31 +1723,31 @@ dt = it.useMemo, ft = it.useCallback), {
1714
1723
  }
1715
1724
  }), t;
1716
1725
  }
1717
- }, Pt = (e, t) => {
1718
- At(e);
1726
+ }, Tt = (e, t) => {
1727
+ jt(e);
1719
1728
  const n = {};
1720
- for (const [e, r] of Object.entries(t)) n[e] = Rt(e, r);
1729
+ for (const [e, r] of Object.entries(t)) n[e] = Pt(e, r);
1721
1730
  return n;
1722
- }, Tt = (e, ...t) => ({
1731
+ }, It = (e, ...t) => ({
1723
1732
  type: "call",
1724
1733
  fn: e,
1725
1734
  args: t
1726
- }), It = e => ({
1735
+ }), zt = e => ({
1727
1736
  type: "put",
1728
1737
  action: e
1729
- }), zt = e => ({
1738
+ }), xt = e => ({
1730
1739
  type: "select",
1731
1740
  selector: e
1732
- }), xt = e => ({
1741
+ }), $t = e => ({
1733
1742
  type: "take",
1734
1743
  pattern: e
1735
- }), $t = e => ({
1744
+ }), Vt = e => ({
1736
1745
  type: "all",
1737
1746
  effects: e
1738
- }), Vt = e => ({
1747
+ }), Nt = e => ({
1739
1748
  type: "race",
1740
1749
  effects: e
1741
- }), Nt = e => async (t, n) => {
1750
+ }), Ut = e => async (t, n) => {
1742
1751
  const r = async e => {
1743
1752
  switch (e.type) {
1744
1753
  case "call":
@@ -1767,18 +1776,18 @@ dt = it.useMemo, ft = it.useCallback), {
1767
1776
  let t = e.next();
1768
1777
  for (;!t.done; ) await r(t.value), t = e.next();
1769
1778
  } catch (e) {}
1770
- }, Ut = (e, t) => (At(e).dispatch(t), () => {});
1779
+ }, Lt = (e, t) => (jt(e).dispatch(t), () => {});
1771
1780
 
1772
1781
  g();
1773
1782
 
1774
- var Lt = () => ({
1783
+ var Ft = () => ({
1775
1784
  name: "gstate-immer",
1776
1785
  hooks: {
1777
1786
  onInstall: ({store: e}) => {
1778
1787
  e._registerMethod("immer", "setWithProduce", (t, n) => e.set(t, n));
1779
1788
  }
1780
1789
  }
1781
- }), Ft = e => {
1790
+ }), Kt = e => {
1782
1791
  let t = [], n = -1, r = !1;
1783
1792
  const s = e?.limit || 50;
1784
1793
  return {
@@ -1810,7 +1819,7 @@ var Lt = () => ({
1810
1819
  }
1811
1820
  }
1812
1821
  };
1813
- }, Kt = e => ({
1822
+ }, Jt = e => ({
1814
1823
  name: "gstate-schema",
1815
1824
  hooks: {
1816
1825
  onSet: ({key: t, value: n}) => {
@@ -1822,7 +1831,7 @@ var Lt = () => ({
1822
1831
  }
1823
1832
  }
1824
1833
  }
1825
- }), Jt = e => {
1834
+ }), Bt = e => {
1826
1835
  const t = globalThis.__REDUX_DEVTOOLS_EXTENSION__;
1827
1836
  if (!t?.connect) return {
1828
1837
  name: "gstate-devtools-noop",
@@ -1845,7 +1854,7 @@ var Lt = () => ({
1845
1854
  }
1846
1855
  }
1847
1856
  };
1848
- }, Bt = () => {
1857
+ }, Wt = () => {
1849
1858
  const e = new Map;
1850
1859
  return {
1851
1860
  name: "gstate-snapshot",
@@ -1865,7 +1874,7 @@ var Lt = () => ({
1865
1874
  }
1866
1875
  }
1867
1876
  };
1868
- }, Wt = e => ({
1877
+ }, Qt = e => ({
1869
1878
  name: "gstate-guard",
1870
1879
  hooks: {
1871
1880
  onBeforeSet: ({key: t, value: n, store: r}) => {
@@ -1874,7 +1883,7 @@ var Lt = () => ({
1874
1883
  s && s(n);
1875
1884
  }
1876
1885
  }
1877
- }), Qt = e => ({
1886
+ }), qt = e => ({
1878
1887
  name: "gstate-analytics",
1879
1888
  hooks: {
1880
1889
  onSet: ({key: t, value: n}) => {
@@ -1892,7 +1901,7 @@ var Lt = () => ({
1892
1901
  }));
1893
1902
  }
1894
1903
  }
1895
- }), qt = e => {
1904
+ }), Ht = e => {
1896
1905
  const t = new BroadcastChannel(e?.channelName || "gstate_sync");
1897
1906
  let n = !1;
1898
1907
  return {
@@ -1922,7 +1931,7 @@ var Lt = () => ({
1922
1931
  }
1923
1932
  }
1924
1933
  };
1925
- }, Ht = () => {
1934
+ }, Gt = () => {
1926
1935
  if (Qe()) return {
1927
1936
  name: "gstate-debug-noop",
1928
1937
  hooks: {}
@@ -1960,7 +1969,7 @@ var Lt = () => ({
1960
1969
  }
1961
1970
  }
1962
1971
  };
1963
- }, Gt = (e = {}) => {
1972
+ }, Xt = (e = {}) => {
1964
1973
  const t = e.dbName || "rgs-db", n = e.storeName || "states", r = e.version || 1;
1965
1974
  let s = null;
1966
1975
  const o = () => new Promise((e, o) => {
@@ -2028,7 +2037,7 @@ var Lt = () => ({
2028
2037
  }
2029
2038
  }
2030
2039
  };
2031
- }, Xt = e => {
2040
+ }, Zt = e => {
2032
2041
  const {adapter: t, autoSyncInterval: n} = e, r = new Map, s = {
2033
2042
  lastSyncTimestamp: null,
2034
2043
  totalKeysSynced: 0,
@@ -2082,7 +2091,7 @@ var Lt = () => ({
2082
2091
  }
2083
2092
  }
2084
2093
  };
2085
- }, Zt = (e, t) => ({
2094
+ }, Yt = (e, t) => ({
2086
2095
  name: "MongoDB-Atlas",
2087
2096
  save: async n => (await fetch(`${e}/action/updateOne`, {
2088
2097
  method: "POST",
@@ -2106,7 +2115,7 @@ var Lt = () => ({
2106
2115
  upsert: !0
2107
2116
  })
2108
2117
  })).ok
2109
- }), Yt = (e, t) => ({
2118
+ }), en = (e, t) => ({
2110
2119
  name: "Firebase-Firestore",
2111
2120
  save: async e => {
2112
2121
  try {
@@ -2116,7 +2125,7 @@ var Lt = () => ({
2116
2125
  return !1;
2117
2126
  }
2118
2127
  }
2119
- }), en = (e, t) => ({
2128
+ }), tn = (e, t) => ({
2120
2129
  name: "SQL-REST-API",
2121
2130
  save: async n => {
2122
2131
  const r = t();
@@ -2131,7 +2140,7 @@ var Lt = () => ({
2131
2140
  credentials: "same-origin"
2132
2141
  })).ok;
2133
2142
  }
2134
- }), tn = e => ({
2143
+ }), nn = e => ({
2135
2144
  name: "gstate-logger",
2136
2145
  hooks: {
2137
2146
  onSet: ({key: e, value: t, version: n}) => {
@@ -2140,27 +2149,28 @@ var Lt = () => ({
2140
2149
  onRemove: ({key: e}) => {},
2141
2150
  onTransaction: ({key: e}) => {}
2142
2151
  }
2143
- }), nn = (e, t) => {
2152
+ }), rn = (e, t) => {
2144
2153
  const n = Ge("string" == typeof t ? {
2145
2154
  namespace: t
2146
2155
  } : t);
2147
2156
  e && Object.entries(e).forEach(([e, t]) => {
2148
2157
  null === n.get(e) && n._setSilently(e, t);
2149
2158
  });
2150
- return "undefined" == typeof window || Qe() || (window.gstate = n, window.gState = n,
2151
- window.rgs = n), Object.assign(e => nt(e, n), n);
2152
- }, rn = (e, t) => tt()?.addAccessRule(e, t), sn = (e, t, n) => tt()?.hasPermission(e, t, n) ?? !0, on = (e, t, n) => {
2159
+ const r = e => nt(e, n);
2160
+ return "undefined" == typeof window || Qe() || (window.gstate = r, window.gState = n,
2161
+ window.rgs = n), Object.assign(r, n);
2162
+ }, sn = (e, t) => tt()?.addAccessRule(e, t), on = (e, t, n) => tt()?.hasPermission(e, t, n) ?? !0, an = (e, t, n) => {
2153
2163
  const r = tt();
2154
2164
  if (!r) throw new Error("[gstate] recordConsent failed: No store found. call initState() first.");
2155
2165
  return r.recordConsent(e, t, n);
2156
- }, an = (e, t) => tt()?.hasConsent(e, t) ?? !1, cn = e => tt()?.getConsents(e) ?? [], ln = (e, t) => tt()?.revokeConsent(e, t), un = e => {
2166
+ }, cn = (e, t) => tt()?.hasConsent(e, t) ?? !1, ln = e => tt()?.getConsents(e) ?? [], un = (e, t) => tt()?.revokeConsent(e, t), dn = e => {
2157
2167
  const t = tt();
2158
2168
  if (!t) throw new Error("[gstate] exportUserData failed: No store found.");
2159
2169
  return t.exportUserData(e);
2160
- }, dn = e => {
2170
+ }, fn = e => {
2161
2171
  const t = tt();
2162
2172
  if (!t) throw new Error("[gstate] deleteUserData failed: No store found.");
2163
2173
  return t.deleteUserData(e);
2164
- }, fn = () => {}, yn = () => {};
2174
+ }, yn = () => {}, pn = () => {};
2165
2175
 
2166
- export { c as SyncEngine, rn as addAccessRule, $t as all, Qt as analyticsPlugin, Tt as call, fn as clearAccessRules, yn as clearAllConsents, Xt as cloudSyncPlugin, jt as createActions, Rt as createAsyncAction, Pt as createAsyncActions, ht as createAsyncStore, Yt as createFirestoreAdapter, Zt as createMongoAdapter, Ct as createNextStore, _t as createSSRStore, Nt as createSaga, en as createSqlRestAdapter, Ge as createStore, l as createSyncEngine, At as createThunkStore, Ht as debugPlugin, wt as dehydrateStore, dn as deleteUserData, Re as deriveKeyFromPassword, Ye as destroyState, ot as destroySync, Jt as devToolsPlugin, Ie as exportKey, un as exportUserData, Te as generateEncryptionKey, Pe as generateSalt, cn as getConsents, Dt as getSSRInitialState, tt as getStore, nn as gstate, Wt as guardPlugin, an as hasConsent, sn as hasPermission, St as hydrateOnClient, Lt as immerPlugin, ze as importKey, Gt as indexedDBPlugin, Ze as initState, st as initSync, Mt as initializeFromSSR, mt as isClientSide, je as isCryptoAvailable, gt as isServerSide, Ue as logAudit, tn as loggerPlugin, It as put, Vt as race, on as recordConsent, bt as rehydrateStore, ln as revokeConsent, Ut as runSaga, Ke as sanitizeValue, Kt as schemaPlugin, zt as select, Ne as setAuditLogger, Bt as snapshotPlugin, qt as syncPlugin, xt as take, pt as triggerSync, Ft as undoRedoPlugin, Ot as useDeferredStore, nt as useGState, Et as useHydrated, kt as useHydrationStatus, et as useIsStoreReady, nt as useSimpleState, nt as useStore, yt as useSyncStatus, at as useSyncedState, Je as validateKey };
2176
+ export { c as SyncEngine, sn as addAccessRule, Vt as all, qt as analyticsPlugin, It as call, yn as clearAccessRules, pn as clearAllConsents, Zt as cloudSyncPlugin, Rt as createActions, Pt as createAsyncAction, Tt as createAsyncActions, gt as createAsyncStore, en as createFirestoreAdapter, Yt as createMongoAdapter, Dt as createNextStore, St as createSSRStore, Ut as createSaga, tn as createSqlRestAdapter, Ge as createStore, l as createSyncEngine, jt as createThunkStore, Gt as debugPlugin, bt as dehydrateStore, fn as deleteUserData, Re as deriveKeyFromPassword, Ye as destroyState, ot as destroySync, Bt as devToolsPlugin, Ie as exportKey, dn as exportUserData, Te as generateEncryptionKey, Pe as generateSalt, ln as getConsents, Mt as getSSRInitialState, tt as getStore, rn as gstate, Qt as guardPlugin, cn as hasConsent, on as hasPermission, wt as hydrateOnClient, Ft as immerPlugin, ze as importKey, Xt as indexedDBPlugin, Ze as initState, st as initSync, At as initializeFromSSR, _t as isClientSide, je as isCryptoAvailable, mt as isServerSide, Ue as logAudit, nn as loggerPlugin, zt as put, Nt as race, an as recordConsent, vt as rehydrateStore, un as revokeConsent, Lt as runSaga, Ke as sanitizeValue, Jt as schemaPlugin, xt as select, Ne as setAuditLogger, Wt as snapshotPlugin, Ht as syncPlugin, $t as take, ct as triggerSync, Kt as undoRedoPlugin, Ct as useDeferredStore, nt as useGState, kt as useHydrated, Ot as useHydrationStatus, et as useIsStoreReady, nt as useSimpleState, nt as useStore, lt as useStoreSubscribe, it as useSyncStatus, at as useSyncedState, Je as validateKey };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@biglogic/rgs",
3
3
  "code": "argis",
4
- "version": "3.9.8",
4
+ "version": "3.9.9",
5
5
  "description": "Argis (RGS) - Reactive Global State: A react state everywhere made easy",
6
6
  "main": "./index.cjs",
7
7
  "browser": "./index.cjs",