@gonvex/protocol 0.1.13 → 0.1.15

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.
Files changed (2) hide show
  1. package/dist/index.d.ts +65 -1
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export type FunctionKind = "query" | "mutation" | "action" | "http" | "internalMutation" | "liveGrid";
1
+ export type FunctionKind = "query" | "mutation" | "action" | "http" | "internalMutation" | "liveGrid" | "sync";
2
2
  export type JsonValue = null | boolean | number | string | JsonValue[] | {
3
3
  [key: string]: JsonValue;
4
4
  };
@@ -7,6 +7,25 @@ export type FunctionManifestEntry = {
7
7
  handler: string;
8
8
  file: string;
9
9
  dependencies?: FunctionDependencies;
10
+ sync?: SyncDefinition;
11
+ };
12
+ export type SyncDefinition = {
13
+ table: string;
14
+ key: string;
15
+ columns: string[];
16
+ equalFilters?: Record<string, string>;
17
+ excludeWhenSet?: string[];
18
+ visibilityTables?: string[];
19
+ orderBy?: string;
20
+ orderDirection?: "asc" | "desc";
21
+ mode?: "eager" | "progressive";
22
+ maxRows?: number;
23
+ maxBytes?: number;
24
+ retentionMs?: number;
25
+ };
26
+ export type SyncCursor = {
27
+ epoch: string;
28
+ revision: number;
10
29
  };
11
30
  export type FunctionDependencies = {
12
31
  reads?: Array<{
@@ -81,6 +100,16 @@ export type ClientMessage = {
81
100
  } | {
82
101
  type: "query.unsubscribe";
83
102
  id: string;
103
+ } | {
104
+ type: "sync.open";
105
+ id: string;
106
+ path: string;
107
+ args: JsonValue;
108
+ cursor?: SyncCursor;
109
+ keys?: string[];
110
+ } | {
111
+ type: "sync.close";
112
+ id: string;
84
113
  } | {
85
114
  type: "mutation.call";
86
115
  id: string;
@@ -154,6 +183,41 @@ export type ServerMessage = {
154
183
  cacheScope?: string;
155
184
  cacheRevision?: string;
156
185
  trace?: MessageTrace;
186
+ } | {
187
+ type: "sync.snapshot";
188
+ id: string;
189
+ path?: string;
190
+ result: JsonValue[];
191
+ cursor: SyncCursor;
192
+ key: string;
193
+ orderBy?: string;
194
+ orderDirection?: "asc" | "desc";
195
+ mode?: "eager" | "progressive";
196
+ maxRows?: number;
197
+ maxBytes?: number;
198
+ } | {
199
+ type: "sync.delta";
200
+ id: string;
201
+ path?: string;
202
+ cursor: SyncCursor;
203
+ upserts?: JsonValue[];
204
+ deleted?: string[];
205
+ mutationIds?: string[];
206
+ } | {
207
+ type: "sync.ready";
208
+ id: string;
209
+ path?: string;
210
+ cursor: SyncCursor;
211
+ } | {
212
+ type: "sync.reset";
213
+ id: string;
214
+ path?: string;
215
+ reason: "cursor-expired" | "definition-changed" | "visibility-changed" | "recover";
216
+ } | {
217
+ type: "sync.error";
218
+ id: string;
219
+ path?: string;
220
+ error: string;
157
221
  } | {
158
222
  type: "query.error";
159
223
  id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gonvex/protocol",
3
- "version": "0.1.13",
3
+ "version": "0.1.15",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"