@buoy-gg/zustand 4.0.1 → 5.0.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.
@@ -5,6 +5,11 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.zustandSyncAdapter = void 0;
7
7
  var _zustandStateStore = require("../utils/zustandStateStore");
8
+ /** Top-level keys of an object state, for the compact (no-values) view. */
9
+ function topLevelKeys(state) {
10
+ return state && typeof state === "object" && !Array.isArray(state) ? Object.keys(state) : undefined;
11
+ }
12
+
8
13
  /**
9
14
  * Sync adapter for the zustand tool, consumed by @buoy-gg/external-sync's
10
15
  * `useExternalSync` (structurally matches its ToolSyncAdapter interface so
@@ -36,6 +41,37 @@ const zustandSyncAdapter = exports.zustandSyncAdapter = {
36
41
  clearEvents: () => {
37
42
  _zustandStateStore.zustandStateStore.clearStateChanges();
38
43
  },
44
+ /**
45
+ * Compact current-state reader for a remote driver (MCP/LLM): the registered
46
+ * stores with light metadata; each store's full `currentState` object stays
47
+ * on the device unless `includeValues` is set (compact view returns just the
48
+ * top-level `keys` so the shape is visible cheaply).
49
+ */
50
+ listStores: params => {
51
+ const {
52
+ includeValues = false,
53
+ limit
54
+ } = params ?? {};
55
+ const all = _zustandStateStore.zustandStateStore.getStoreSnapshots();
56
+ const capped = typeof limit === "number" && limit > 0 ? all.slice(0, limit) : all;
57
+ const stores = capped.map(s => ({
58
+ name: s.name,
59
+ changes: s.stateChangeCount,
60
+ isPersisted: s.isPersisted,
61
+ persistName: s.persistName,
62
+ ...(includeValues ? {
63
+ currentState: s.currentState
64
+ } : {
65
+ keys: topLevelKeys(s.currentState)
66
+ })
67
+ }));
68
+ return {
69
+ stores,
70
+ total: all.length,
71
+ returned: stores.length,
72
+ includedValues: includeValues
73
+ };
74
+ },
39
75
  setState: params => {
40
76
  const {
41
77
  storeName,
@@ -1,6 +1,11 @@
1
1
  "use strict";
2
2
 
3
3
  import { zustandStateStore } from "../utils/zustandStateStore";
4
+ /** Top-level keys of an object state, for the compact (no-values) view. */
5
+ function topLevelKeys(state) {
6
+ return state && typeof state === "object" && !Array.isArray(state) ? Object.keys(state) : undefined;
7
+ }
8
+
4
9
  /**
5
10
  * Sync adapter for the zustand tool, consumed by @buoy-gg/external-sync's
6
11
  * `useExternalSync` (structurally matches its ToolSyncAdapter interface so
@@ -32,6 +37,37 @@ export const zustandSyncAdapter = {
32
37
  clearEvents: () => {
33
38
  zustandStateStore.clearStateChanges();
34
39
  },
40
+ /**
41
+ * Compact current-state reader for a remote driver (MCP/LLM): the registered
42
+ * stores with light metadata; each store's full `currentState` object stays
43
+ * on the device unless `includeValues` is set (compact view returns just the
44
+ * top-level `keys` so the shape is visible cheaply).
45
+ */
46
+ listStores: params => {
47
+ const {
48
+ includeValues = false,
49
+ limit
50
+ } = params ?? {};
51
+ const all = zustandStateStore.getStoreSnapshots();
52
+ const capped = typeof limit === "number" && limit > 0 ? all.slice(0, limit) : all;
53
+ const stores = capped.map(s => ({
54
+ name: s.name,
55
+ changes: s.stateChangeCount,
56
+ isPersisted: s.isPersisted,
57
+ persistName: s.persistName,
58
+ ...(includeValues ? {
59
+ currentState: s.currentState
60
+ } : {
61
+ keys: topLevelKeys(s.currentState)
62
+ })
63
+ }));
64
+ return {
65
+ stores,
66
+ total: all.length,
67
+ returned: stores.length,
68
+ includedValues: includeValues
69
+ };
70
+ },
35
71
  setState: params => {
36
72
  const {
37
73
  storeName,
@@ -20,6 +20,30 @@ export declare const zustandSyncAdapter: {
20
20
  subscribe: (onChange: () => void) => () => void;
21
21
  actions: {
22
22
  clearEvents: () => void;
23
+ /**
24
+ * Compact current-state reader for a remote driver (MCP/LLM): the registered
25
+ * stores with light metadata; each store's full `currentState` object stays
26
+ * on the device unless `includeValues` is set (compact view returns just the
27
+ * top-level `keys` so the shape is visible cheaply).
28
+ */
29
+ listStores: (params: unknown) => {
30
+ stores: ({
31
+ currentState: unknown;
32
+ name: string;
33
+ changes: number;
34
+ isPersisted: boolean;
35
+ persistName: string | undefined;
36
+ } | {
37
+ keys: string[] | undefined;
38
+ name: string;
39
+ changes: number;
40
+ isPersisted: boolean;
41
+ persistName: string | undefined;
42
+ })[];
43
+ total: number;
44
+ returned: number;
45
+ includedValues: boolean;
46
+ };
23
47
  setState: (params: unknown) => void;
24
48
  };
25
49
  };
@@ -1 +1 @@
1
- {"version":3,"file":"zustandSyncAdapter.d.ts","sourceRoot":"","sources":["../../../../src/zustand/sync/zustandSyncAdapter.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,kBAAkB;;;;;;0BAMP,MAAM,IAAI;;;2BAYX,OAAO;;CAQ7B,CAAC"}
1
+ {"version":3,"file":"zustandSyncAdapter.d.ts","sourceRoot":"","sources":["../../../../src/zustand/sync/zustandSyncAdapter.ts"],"names":[],"mappings":"AAsBA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,kBAAkB;;;;;;0BAMP,MAAM,IAAI;;;QAY9B;;;;;WAKG;6BACkB,OAAO;;;;;;;;;;;;;;;;;;2BAsBT,OAAO;;CAQ7B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buoy-gg/zustand",
3
- "version": "4.0.1",
3
+ "version": "5.0.0",
4
4
  "description": "Zustand store DevTools for React Native",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -26,8 +26,8 @@
26
26
  ],
27
27
  "sideEffects": false,
28
28
  "dependencies": {
29
- "@buoy-gg/license": "4.0.1",
30
- "@buoy-gg/shared-ui": "4.0.1"
29
+ "@buoy-gg/shared-ui": "5.0.0",
30
+ "@buoy-gg/license": "5.0.0"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "react": "*",