@spooky-sync/cli 0.0.1-canary.207 → 0.0.1-canary.209

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.
@@ -24,6 +24,7 @@ export declare const BRIDGE_METHODS: {
24
24
  readonly GET_STATE: "getState";
25
25
  readonly RUN_QUERY: "runQuery";
26
26
  readonly GET_TABLE_DATA: "getTableData";
27
+ readonly GET_QUERY_ROWS: "getQueryRows";
27
28
  readonly UPDATE_TABLE_ROW: "updateTableRow";
28
29
  readonly DELETE_TABLE_ROW: "deleteTableRow";
29
30
  readonly CLEAR_HISTORY: "clearHistory";
@@ -4,6 +4,7 @@ export const BRIDGE_METHODS = {
4
4
  GET_STATE: 'getState',
5
5
  RUN_QUERY: 'runQuery',
6
6
  GET_TABLE_DATA: 'getTableData',
7
+ GET_QUERY_ROWS: 'getQueryRows',
7
8
  UPDATE_TABLE_ROW: 'updateTableRow',
8
9
  DELETE_TABLE_ROW: 'deleteTableRow',
9
10
  CLEAR_HISTORY: 'clearHistory',
@@ -49,6 +49,16 @@ export function createServer(bridge, surreal) {
49
49
  }
50
50
  throw new Error('No extension connected and no direct database configured.');
51
51
  });
52
+ server.tool('get_query_rows', 'Fetch the rows (data, localArray, remoteArray) of ONE active query by its queryHash. ' +
53
+ 'The state from get_active_queries carries counts and capped ids only.', {
54
+ queryHash: z.number().describe('queryHash from get_active_queries'),
55
+ tabId: z.number().optional().describe('Browser tab ID'),
56
+ }, async ({ queryHash, tabId }) => {
57
+ if (!bridge.isConnected)
58
+ throw new Error('No extension connected.');
59
+ const result = await bridge.request(BRIDGE_METHODS.GET_QUERY_ROWS, { queryHash }, tabId);
60
+ return json(result);
61
+ });
52
62
  server.tool('get_table_data', 'Fetch records from a database table', {
53
63
  tableName: z.string().describe('Name of the table'),
54
64
  limit: z.number().optional().default(100).describe('Max number of records to return'),
@@ -95,7 +105,8 @@ export function createServer(bridge, surreal) {
95
105
  }
96
106
  throw new Error('No extension connected and no direct database configured.');
97
107
  });
98
- server.tool('get_active_queries', 'Get all active live queries and their data', { tabId: z.number().optional().describe('Browser tab ID') }, async ({ tabId }) => {
108
+ server.tool('get_active_queries', 'Get all active live queries: surql, params, counts, capped membership ids and timings ' +
109
+ '(rows are not included; use get_query_rows for one query)', { tabId: z.number().optional().describe('Browser tab ID') }, async ({ tabId }) => {
99
110
  if (bridge.isConnected) {
100
111
  const state = (await bridge.request(BRIDGE_METHODS.GET_STATE, {}, tabId));
101
112
  return json(state?.activeQueries ?? []);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spooky-sync/cli",
3
- "version": "0.0.1-canary.207",
3
+ "version": "0.0.1-canary.209",
4
4
  "description": "Generate TypeScript/Dart types from SurrealDB schema files",
5
5
  "type": "module",
6
6
  "main": "./dist/syncgen.cjs",
@@ -61,10 +61,10 @@
61
61
  "vitest": "^1.0.0"
62
62
  },
63
63
  "optionalDependencies": {
64
- "@spooky-sync/cli-darwin-arm64": "0.0.1-canary.207",
65
- "@spooky-sync/cli-darwin-x64": "0.0.1-canary.207",
66
- "@spooky-sync/cli-linux-arm64": "0.0.1-canary.207",
67
- "@spooky-sync/cli-linux-x64": "0.0.1-canary.207",
68
- "@spooky-sync/cli-win32-x64": "0.0.1-canary.207"
64
+ "@spooky-sync/cli-darwin-arm64": "0.0.1-canary.209",
65
+ "@spooky-sync/cli-darwin-x64": "0.0.1-canary.209",
66
+ "@spooky-sync/cli-linux-arm64": "0.0.1-canary.209",
67
+ "@spooky-sync/cli-linux-x64": "0.0.1-canary.209",
68
+ "@spooky-sync/cli-win32-x64": "0.0.1-canary.209"
69
69
  }
70
70
  }