lakesync 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.
Files changed (69) hide show
  1. package/README.md +74 -0
  2. package/dist/adapter.d.ts +369 -0
  3. package/dist/adapter.js +39 -0
  4. package/dist/adapter.js.map +1 -0
  5. package/dist/analyst.d.ts +268 -0
  6. package/dist/analyst.js +495 -0
  7. package/dist/analyst.js.map +1 -0
  8. package/dist/auth-CAVutXzx.d.ts +30 -0
  9. package/dist/base-poller-Qo_SmCZs.d.ts +82 -0
  10. package/dist/catalogue.d.ts +65 -0
  11. package/dist/catalogue.js +17 -0
  12. package/dist/catalogue.js.map +1 -0
  13. package/dist/chunk-4ARO6KTJ.js +257 -0
  14. package/dist/chunk-4ARO6KTJ.js.map +1 -0
  15. package/dist/chunk-5YOFCJQ7.js +1115 -0
  16. package/dist/chunk-5YOFCJQ7.js.map +1 -0
  17. package/dist/chunk-7D4SUZUM.js +38 -0
  18. package/dist/chunk-7D4SUZUM.js.map +1 -0
  19. package/dist/chunk-BNJOGBYK.js +335 -0
  20. package/dist/chunk-BNJOGBYK.js.map +1 -0
  21. package/dist/chunk-ICNT7I3K.js +1180 -0
  22. package/dist/chunk-ICNT7I3K.js.map +1 -0
  23. package/dist/chunk-P5DRFKIT.js +413 -0
  24. package/dist/chunk-P5DRFKIT.js.map +1 -0
  25. package/dist/chunk-X3RO5SYJ.js +880 -0
  26. package/dist/chunk-X3RO5SYJ.js.map +1 -0
  27. package/dist/client.d.ts +428 -0
  28. package/dist/client.js +2048 -0
  29. package/dist/client.js.map +1 -0
  30. package/dist/compactor.d.ts +342 -0
  31. package/dist/compactor.js +793 -0
  32. package/dist/compactor.js.map +1 -0
  33. package/dist/coordinator-CxckTzYW.d.ts +396 -0
  34. package/dist/db-types-BR6Kt4uf.d.ts +29 -0
  35. package/dist/gateway-D5SaaMvT.d.ts +337 -0
  36. package/dist/gateway-server.d.ts +306 -0
  37. package/dist/gateway-server.js +4663 -0
  38. package/dist/gateway-server.js.map +1 -0
  39. package/dist/gateway.d.ts +196 -0
  40. package/dist/gateway.js +79 -0
  41. package/dist/gateway.js.map +1 -0
  42. package/dist/hlc-DiD8QNG3.d.ts +70 -0
  43. package/dist/index.d.ts +245 -0
  44. package/dist/index.js +102 -0
  45. package/dist/index.js.map +1 -0
  46. package/dist/json-dYtqiL0F.d.ts +18 -0
  47. package/dist/nessie-client-DrNikVXy.d.ts +160 -0
  48. package/dist/parquet.d.ts +78 -0
  49. package/dist/parquet.js +15 -0
  50. package/dist/parquet.js.map +1 -0
  51. package/dist/proto.d.ts +434 -0
  52. package/dist/proto.js +67 -0
  53. package/dist/proto.js.map +1 -0
  54. package/dist/react.d.ts +147 -0
  55. package/dist/react.js +224 -0
  56. package/dist/react.js.map +1 -0
  57. package/dist/resolver-C3Wphi6O.d.ts +10 -0
  58. package/dist/result-CojzlFE2.d.ts +64 -0
  59. package/dist/src-QU2YLPZY.js +383 -0
  60. package/dist/src-QU2YLPZY.js.map +1 -0
  61. package/dist/src-WYBF5LOI.js +102 -0
  62. package/dist/src-WYBF5LOI.js.map +1 -0
  63. package/dist/src-WZNPHANQ.js +426 -0
  64. package/dist/src-WZNPHANQ.js.map +1 -0
  65. package/dist/types-Bs-QyOe-.d.ts +143 -0
  66. package/dist/types-DAQL_vU_.d.ts +118 -0
  67. package/dist/types-DSC_EiwR.d.ts +45 -0
  68. package/dist/types-V_jVu2sA.d.ts +73 -0
  69. package/package.json +119 -0
@@ -0,0 +1,434 @@
1
+ import { H as HLCTimestamp, R as Result } from './result-CojzlFE2.js';
2
+ import { i as ActionPush$1, j as ActionResponse$1 } from './types-Bs-QyOe-.js';
3
+ import { R as RowDelta$1 } from './types-V_jVu2sA.js';
4
+ import { GenMessage, GenEnum } from '@bufbuild/protobuf/codegenv2';
5
+ import { Message } from '@bufbuild/protobuf';
6
+
7
+ /** Error returned when encoding or decoding a protobuf message fails. */
8
+ declare class CodecError extends Error {
9
+ readonly code = "CODEC_ERROR";
10
+ constructor(message: string, cause?: Error);
11
+ }
12
+ /** Shape of a SyncPush payload using core domain types. */
13
+ interface SyncPushPayload {
14
+ /** Client identifier. */
15
+ clientId: string;
16
+ /** Deltas to push to the server. */
17
+ deltas: RowDelta$1[];
18
+ /** Last HLC timestamp seen by the client. */
19
+ lastSeenHlc: HLCTimestamp;
20
+ }
21
+ /** Shape of a SyncPull request using core domain types. */
22
+ interface SyncPullPayload {
23
+ /** Client identifier. */
24
+ clientId: string;
25
+ /** Request deltas since this HLC timestamp. */
26
+ sinceHlc: HLCTimestamp;
27
+ /** Maximum number of deltas to return. */
28
+ maxDeltas: number;
29
+ }
30
+ /** Shape of a SyncResponse using core domain types. */
31
+ interface SyncResponsePayload {
32
+ /** Deltas returned by the server. */
33
+ deltas: RowDelta$1[];
34
+ /** Current server HLC timestamp. */
35
+ serverHlc: HLCTimestamp;
36
+ /** Whether more deltas are available. */
37
+ hasMore: boolean;
38
+ }
39
+ /** Tag byte for SyncPush frames. */
40
+ declare const TAG_SYNC_PUSH = 1;
41
+ /** Tag byte for SyncPull frames. */
42
+ declare const TAG_SYNC_PULL = 2;
43
+ /** Tag byte for server-initiated broadcast frames. */
44
+ declare const TAG_BROADCAST = 3;
45
+ /** Tag byte for ActionPush frames. */
46
+ declare const TAG_ACTION_PUSH = 4;
47
+ /** Tag byte for ActionResponse frames. */
48
+ declare const TAG_ACTION_RESPONSE = 5;
49
+ /**
50
+ * Encode a broadcast frame: tag `0x03` + SyncResponse proto bytes.
51
+ *
52
+ * Used by the server to push deltas to connected WebSocket clients.
53
+ *
54
+ * @param response - The SyncResponse payload to broadcast.
55
+ * @returns A `Result` containing the framed binary, or a `CodecError` on failure.
56
+ */
57
+ declare function encodeBroadcastFrame(response: SyncResponsePayload): Result<Uint8Array, CodecError>;
58
+ /**
59
+ * Decode a broadcast frame: strip tag `0x03` and decode the SyncResponse.
60
+ *
61
+ * @param frame - The full framed binary (tag byte + proto payload).
62
+ * @returns A `Result` containing the SyncResponse payload, or a `CodecError` on failure.
63
+ */
64
+ declare function decodeBroadcastFrame(frame: Uint8Array): Result<SyncResponsePayload, CodecError>;
65
+ /**
66
+ * Serialise a core RowDelta to protobuf binary.
67
+ *
68
+ * @param delta - The core RowDelta to serialise.
69
+ * @returns A `Result` containing the binary bytes, or a `CodecError` on failure.
70
+ */
71
+ declare function encodeRowDelta(delta: RowDelta$1): Result<Uint8Array, CodecError>;
72
+ /**
73
+ * Deserialise protobuf binary to a core RowDelta.
74
+ *
75
+ * @param bytes - The protobuf binary to deserialise.
76
+ * @returns A `Result` containing the core RowDelta, or a `CodecError` on failure.
77
+ */
78
+ declare function decodeRowDelta(bytes: Uint8Array): Result<RowDelta$1, CodecError>;
79
+ /**
80
+ * Serialise a SyncPush payload to protobuf binary.
81
+ *
82
+ * @param push - The SyncPush payload containing client ID, deltas, and last seen HLC.
83
+ * @returns A `Result` containing the binary bytes, or a `CodecError` on failure.
84
+ */
85
+ declare function encodeSyncPush(push: SyncPushPayload): Result<Uint8Array, CodecError>;
86
+ /**
87
+ * Deserialise protobuf binary to a SyncPush payload.
88
+ *
89
+ * @param bytes - The protobuf binary to deserialise.
90
+ * @returns A `Result` containing the SyncPush payload, or a `CodecError` on failure.
91
+ */
92
+ declare function decodeSyncPush(bytes: Uint8Array): Result<SyncPushPayload, CodecError>;
93
+ /**
94
+ * Serialise a SyncPull request to protobuf binary.
95
+ *
96
+ * @param pull - The SyncPull payload containing client ID, since HLC, and max deltas.
97
+ * @returns A `Result` containing the binary bytes, or a `CodecError` on failure.
98
+ */
99
+ declare function encodeSyncPull(pull: SyncPullPayload): Result<Uint8Array, CodecError>;
100
+ /**
101
+ * Deserialise protobuf binary to a SyncPull payload.
102
+ *
103
+ * @param bytes - The protobuf binary to deserialise.
104
+ * @returns A `Result` containing the SyncPull payload, or a `CodecError` on failure.
105
+ */
106
+ declare function decodeSyncPull(bytes: Uint8Array): Result<SyncPullPayload, CodecError>;
107
+ /**
108
+ * Serialise a SyncResponse to protobuf binary.
109
+ *
110
+ * @param response - The SyncResponse payload containing deltas, server HLC, and has_more flag.
111
+ * @returns A `Result` containing the binary bytes, or a `CodecError` on failure.
112
+ */
113
+ declare function encodeSyncResponse(response: SyncResponsePayload): Result<Uint8Array, CodecError>;
114
+ /**
115
+ * Deserialise protobuf binary to a SyncResponse payload.
116
+ *
117
+ * @param bytes - The protobuf binary to deserialise.
118
+ * @returns A `Result` containing the SyncResponse payload, or a `CodecError` on failure.
119
+ */
120
+ declare function decodeSyncResponse(bytes: Uint8Array): Result<SyncResponsePayload, CodecError>;
121
+ /**
122
+ * Serialise an ActionPush payload to protobuf binary.
123
+ *
124
+ * @param push - The ActionPush payload containing client ID and actions.
125
+ * @returns A `Result` containing the binary bytes, or a `CodecError` on failure.
126
+ */
127
+ declare function encodeActionPush(push: ActionPush$1): Result<Uint8Array, CodecError>;
128
+ /**
129
+ * Deserialise protobuf binary to an ActionPush payload.
130
+ *
131
+ * @param bytes - The protobuf binary to deserialise.
132
+ * @returns A `Result` containing the ActionPush payload, or a `CodecError` on failure.
133
+ */
134
+ declare function decodeActionPush(bytes: Uint8Array): Result<ActionPush$1, CodecError>;
135
+ /**
136
+ * Serialise an ActionResponse to protobuf binary.
137
+ *
138
+ * @param response - The ActionResponse payload.
139
+ * @returns A `Result` containing the binary bytes, or a `CodecError` on failure.
140
+ */
141
+ declare function encodeActionResponse(response: ActionResponse$1): Result<Uint8Array, CodecError>;
142
+ /**
143
+ * Deserialise protobuf binary to an ActionResponse payload.
144
+ *
145
+ * @param bytes - The protobuf binary to deserialise.
146
+ * @returns A `Result` containing the ActionResponse payload, or a `CodecError` on failure.
147
+ */
148
+ declare function decodeActionResponse(bytes: Uint8Array): Result<ActionResponse$1, CodecError>;
149
+
150
+ /**
151
+ * @generated from message lakesync.v1.ColumnDelta
152
+ */
153
+ type ColumnDelta = Message<"lakesync.v1.ColumnDelta"> & {
154
+ /**
155
+ * @generated from field: string column = 1;
156
+ */
157
+ column: string;
158
+ /**
159
+ * @generated from field: bytes value = 2;
160
+ */
161
+ value: Uint8Array;
162
+ };
163
+ /**
164
+ * Describes the message lakesync.v1.ColumnDelta.
165
+ * Use `create(ColumnDeltaSchema)` to create a new message.
166
+ */
167
+ declare const ColumnDeltaSchema: GenMessage<ColumnDelta>;
168
+ /**
169
+ * @generated from message lakesync.v1.RowDelta
170
+ */
171
+ type RowDelta = Message<"lakesync.v1.RowDelta"> & {
172
+ /**
173
+ * @generated from field: lakesync.v1.DeltaOp op = 1;
174
+ */
175
+ op: DeltaOp;
176
+ /**
177
+ * @generated from field: string table = 2;
178
+ */
179
+ table: string;
180
+ /**
181
+ * @generated from field: string row_id = 3;
182
+ */
183
+ rowId: string;
184
+ /**
185
+ * @generated from field: repeated lakesync.v1.ColumnDelta columns = 4;
186
+ */
187
+ columns: ColumnDelta[];
188
+ /**
189
+ * @generated from field: fixed64 hlc = 5;
190
+ */
191
+ hlc: bigint;
192
+ /**
193
+ * @generated from field: string client_id = 6;
194
+ */
195
+ clientId: string;
196
+ /**
197
+ * @generated from field: string delta_id = 7;
198
+ */
199
+ deltaId: string;
200
+ };
201
+ /**
202
+ * Describes the message lakesync.v1.RowDelta.
203
+ * Use `create(RowDeltaSchema)` to create a new message.
204
+ */
205
+ declare const RowDeltaSchema: GenMessage<RowDelta>;
206
+ /**
207
+ * @generated from message lakesync.v1.SyncPush
208
+ */
209
+ type SyncPush = Message<"lakesync.v1.SyncPush"> & {
210
+ /**
211
+ * @generated from field: string client_id = 1;
212
+ */
213
+ clientId: string;
214
+ /**
215
+ * @generated from field: repeated lakesync.v1.RowDelta deltas = 2;
216
+ */
217
+ deltas: RowDelta[];
218
+ /**
219
+ * @generated from field: fixed64 last_seen_hlc = 3;
220
+ */
221
+ lastSeenHlc: bigint;
222
+ };
223
+ /**
224
+ * Describes the message lakesync.v1.SyncPush.
225
+ * Use `create(SyncPushSchema)` to create a new message.
226
+ */
227
+ declare const SyncPushSchema: GenMessage<SyncPush>;
228
+ /**
229
+ * @generated from message lakesync.v1.SyncPull
230
+ */
231
+ type SyncPull = Message<"lakesync.v1.SyncPull"> & {
232
+ /**
233
+ * @generated from field: string client_id = 1;
234
+ */
235
+ clientId: string;
236
+ /**
237
+ * @generated from field: fixed64 since_hlc = 2;
238
+ */
239
+ sinceHlc: bigint;
240
+ /**
241
+ * @generated from field: uint32 max_deltas = 3;
242
+ */
243
+ maxDeltas: number;
244
+ };
245
+ /**
246
+ * Describes the message lakesync.v1.SyncPull.
247
+ * Use `create(SyncPullSchema)` to create a new message.
248
+ */
249
+ declare const SyncPullSchema: GenMessage<SyncPull>;
250
+ /**
251
+ * @generated from message lakesync.v1.SyncResponse
252
+ */
253
+ type SyncResponse = Message<"lakesync.v1.SyncResponse"> & {
254
+ /**
255
+ * @generated from field: repeated lakesync.v1.RowDelta deltas = 1;
256
+ */
257
+ deltas: RowDelta[];
258
+ /**
259
+ * @generated from field: fixed64 server_hlc = 2;
260
+ */
261
+ serverHlc: bigint;
262
+ /**
263
+ * @generated from field: bool has_more = 3;
264
+ */
265
+ hasMore: boolean;
266
+ };
267
+ /**
268
+ * Describes the message lakesync.v1.SyncResponse.
269
+ * Use `create(SyncResponseSchema)` to create a new message.
270
+ */
271
+ declare const SyncResponseSchema: GenMessage<SyncResponse>;
272
+ /**
273
+ * @generated from message lakesync.v1.Action
274
+ */
275
+ type Action = Message<"lakesync.v1.Action"> & {
276
+ /**
277
+ * @generated from field: string action_id = 1;
278
+ */
279
+ actionId: string;
280
+ /**
281
+ * @generated from field: string client_id = 2;
282
+ */
283
+ clientId: string;
284
+ /**
285
+ * @generated from field: fixed64 hlc = 3;
286
+ */
287
+ hlc: bigint;
288
+ /**
289
+ * @generated from field: string connector = 4;
290
+ */
291
+ connector: string;
292
+ /**
293
+ * @generated from field: string action_type = 5;
294
+ */
295
+ actionType: string;
296
+ /**
297
+ * @generated from field: bytes params = 6;
298
+ */
299
+ params: Uint8Array;
300
+ /**
301
+ * @generated from field: string idempotency_key = 7;
302
+ */
303
+ idempotencyKey: string;
304
+ };
305
+ /**
306
+ * Describes the message lakesync.v1.Action.
307
+ * Use `create(ActionSchema)` to create a new message.
308
+ */
309
+ declare const ActionSchema: GenMessage<Action>;
310
+ /**
311
+ * @generated from message lakesync.v1.ActionPush
312
+ */
313
+ type ActionPush = Message<"lakesync.v1.ActionPush"> & {
314
+ /**
315
+ * @generated from field: string client_id = 1;
316
+ */
317
+ clientId: string;
318
+ /**
319
+ * @generated from field: repeated lakesync.v1.Action actions = 2;
320
+ */
321
+ actions: Action[];
322
+ };
323
+ /**
324
+ * Describes the message lakesync.v1.ActionPush.
325
+ * Use `create(ActionPushSchema)` to create a new message.
326
+ */
327
+ declare const ActionPushSchema: GenMessage<ActionPush>;
328
+ /**
329
+ * @generated from message lakesync.v1.ActionResultMsg
330
+ */
331
+ type ActionResultMsg = Message<"lakesync.v1.ActionResultMsg"> & {
332
+ /**
333
+ * @generated from field: string action_id = 1;
334
+ */
335
+ actionId: string;
336
+ /**
337
+ * @generated from field: bytes data = 2;
338
+ */
339
+ data: Uint8Array;
340
+ /**
341
+ * @generated from field: fixed64 server_hlc = 3;
342
+ */
343
+ serverHlc: bigint;
344
+ };
345
+ /**
346
+ * @generated from message lakesync.v1.ActionErrorMsg
347
+ */
348
+ type ActionErrorMsg = Message<"lakesync.v1.ActionErrorMsg"> & {
349
+ /**
350
+ * @generated from field: string action_id = 1;
351
+ */
352
+ actionId: string;
353
+ /**
354
+ * @generated from field: string code = 2;
355
+ */
356
+ code: string;
357
+ /**
358
+ * @generated from field: string message = 3;
359
+ */
360
+ message: string;
361
+ /**
362
+ * @generated from field: bool retryable = 4;
363
+ */
364
+ retryable: boolean;
365
+ };
366
+ /**
367
+ * @generated from message lakesync.v1.ActionResponseEntry
368
+ */
369
+ type ActionResponseEntry = Message<"lakesync.v1.ActionResponseEntry"> & {
370
+ /**
371
+ * @generated from oneof lakesync.v1.ActionResponseEntry.result
372
+ */
373
+ result: {
374
+ /**
375
+ * @generated from field: lakesync.v1.ActionResultMsg success = 1;
376
+ */
377
+ value: ActionResultMsg;
378
+ case: "success";
379
+ } | {
380
+ /**
381
+ * @generated from field: lakesync.v1.ActionErrorMsg error = 2;
382
+ */
383
+ value: ActionErrorMsg;
384
+ case: "error";
385
+ } | {
386
+ case: undefined;
387
+ value?: undefined;
388
+ };
389
+ };
390
+ /**
391
+ * @generated from message lakesync.v1.ActionResponse
392
+ */
393
+ type ActionResponse = Message<"lakesync.v1.ActionResponse"> & {
394
+ /**
395
+ * @generated from field: repeated lakesync.v1.ActionResponseEntry results = 1;
396
+ */
397
+ results: ActionResponseEntry[];
398
+ /**
399
+ * @generated from field: fixed64 server_hlc = 2;
400
+ */
401
+ serverHlc: bigint;
402
+ };
403
+ /**
404
+ * Describes the message lakesync.v1.ActionResponse.
405
+ * Use `create(ActionResponseSchema)` to create a new message.
406
+ */
407
+ declare const ActionResponseSchema: GenMessage<ActionResponse>;
408
+ /**
409
+ * @generated from enum lakesync.v1.DeltaOp
410
+ */
411
+ declare enum DeltaOp {
412
+ /**
413
+ * @generated from enum value: DELTA_OP_UNSPECIFIED = 0;
414
+ */
415
+ UNSPECIFIED = 0,
416
+ /**
417
+ * @generated from enum value: DELTA_OP_INSERT = 1;
418
+ */
419
+ INSERT = 1,
420
+ /**
421
+ * @generated from enum value: DELTA_OP_UPDATE = 2;
422
+ */
423
+ UPDATE = 2,
424
+ /**
425
+ * @generated from enum value: DELTA_OP_DELETE = 3;
426
+ */
427
+ DELETE = 3
428
+ }
429
+ /**
430
+ * Describes the enum lakesync.v1.DeltaOp.
431
+ */
432
+ declare const DeltaOpSchema: GenEnum<DeltaOp>;
433
+
434
+ export { ActionPushSchema, ActionResponseSchema, ActionSchema, CodecError, ColumnDeltaSchema, DeltaOpSchema, type Action as ProtoAction, type ActionPush as ProtoActionPush, type ActionResponse as ProtoActionResponse, type ColumnDelta as ProtoColumnDelta, DeltaOp as ProtoDeltaOp, type RowDelta as ProtoRowDelta, type SyncPull as ProtoSyncPull, type SyncPush as ProtoSyncPush, type SyncResponse as ProtoSyncResponse, RowDeltaSchema, type SyncPullPayload, SyncPullSchema, type SyncPushPayload, SyncPushSchema, type SyncResponsePayload, SyncResponseSchema, TAG_ACTION_PUSH, TAG_ACTION_RESPONSE, TAG_BROADCAST, TAG_SYNC_PULL, TAG_SYNC_PUSH, decodeActionPush, decodeActionResponse, decodeBroadcastFrame, decodeRowDelta, decodeSyncPull, decodeSyncPush, decodeSyncResponse, encodeActionPush, encodeActionResponse, encodeBroadcastFrame, encodeRowDelta, encodeSyncPull, encodeSyncPush, encodeSyncResponse };
package/dist/proto.js ADDED
@@ -0,0 +1,67 @@
1
+ import {
2
+ ActionPushSchema,
3
+ ActionResponseSchema,
4
+ ActionSchema,
5
+ CodecError,
6
+ ColumnDeltaSchema,
7
+ DeltaOp,
8
+ DeltaOpSchema,
9
+ RowDeltaSchema,
10
+ SyncPullSchema,
11
+ SyncPushSchema,
12
+ SyncResponseSchema,
13
+ TAG_ACTION_PUSH,
14
+ TAG_ACTION_RESPONSE,
15
+ TAG_BROADCAST,
16
+ TAG_SYNC_PULL,
17
+ TAG_SYNC_PUSH,
18
+ decodeActionPush,
19
+ decodeActionResponse,
20
+ decodeBroadcastFrame,
21
+ decodeRowDelta,
22
+ decodeSyncPull,
23
+ decodeSyncPush,
24
+ decodeSyncResponse,
25
+ encodeActionPush,
26
+ encodeActionResponse,
27
+ encodeBroadcastFrame,
28
+ encodeRowDelta,
29
+ encodeSyncPull,
30
+ encodeSyncPush,
31
+ encodeSyncResponse
32
+ } from "./chunk-BNJOGBYK.js";
33
+ import "./chunk-ICNT7I3K.js";
34
+ import "./chunk-7D4SUZUM.js";
35
+ export {
36
+ ActionPushSchema,
37
+ ActionResponseSchema,
38
+ ActionSchema,
39
+ CodecError,
40
+ ColumnDeltaSchema,
41
+ DeltaOpSchema,
42
+ DeltaOp as ProtoDeltaOp,
43
+ RowDeltaSchema,
44
+ SyncPullSchema,
45
+ SyncPushSchema,
46
+ SyncResponseSchema,
47
+ TAG_ACTION_PUSH,
48
+ TAG_ACTION_RESPONSE,
49
+ TAG_BROADCAST,
50
+ TAG_SYNC_PULL,
51
+ TAG_SYNC_PUSH,
52
+ decodeActionPush,
53
+ decodeActionResponse,
54
+ decodeBroadcastFrame,
55
+ decodeRowDelta,
56
+ decodeSyncPull,
57
+ decodeSyncPush,
58
+ decodeSyncResponse,
59
+ encodeActionPush,
60
+ encodeActionResponse,
61
+ encodeBroadcastFrame,
62
+ encodeRowDelta,
63
+ encodeSyncPull,
64
+ encodeSyncPush,
65
+ encodeSyncResponse
66
+ };
67
+ //# sourceMappingURL=proto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,147 @@
1
+ import * as react from 'react';
2
+ import { f as SyncCoordinator, j as SyncTracker, D as DbError } from './coordinator-CxckTzYW.js';
3
+ import { L as LakeSyncError, R as Result } from './result-CojzlFE2.js';
4
+ import { c as ActionDescriptor, k as ActionResult, e as ActionErrorResult } from './types-Bs-QyOe-.js';
5
+ import './hlc-DiD8QNG3.js';
6
+ import './types-V_jVu2sA.js';
7
+
8
+ /** Internal context value shared across all hooks. */
9
+ interface LakeSyncContextValue {
10
+ coordinator: SyncCoordinator;
11
+ tracker: SyncTracker;
12
+ /** Monotonically increasing counter — bumped on every data change. */
13
+ dataVersion: number;
14
+ /** Increment dataVersion to trigger query re-runs. */
15
+ invalidate: () => void;
16
+ }
17
+ /** Props for the LakeSyncProvider component. */
18
+ interface LakeSyncProviderProps {
19
+ /** An already-constructed SyncCoordinator instance. */
20
+ coordinator: SyncCoordinator;
21
+ children: React.ReactNode;
22
+ }
23
+ /**
24
+ * Provides LakeSync context to the component tree.
25
+ *
26
+ * Subscribes to `onChange` events from the coordinator and maintains a
27
+ * `dataVersion` counter that increments on every remote delta application,
28
+ * triggering reactive query re-runs in `useQuery`.
29
+ */
30
+ declare function LakeSyncProvider(props: LakeSyncProviderProps): react.FunctionComponentElement<react.ProviderProps<LakeSyncContextValue | null>>;
31
+ /**
32
+ * Access the raw LakeSync SDK instances from context.
33
+ *
34
+ * @throws if called outside a `<LakeSyncProvider>`.
35
+ */
36
+ declare function useLakeSync(): LakeSyncContextValue;
37
+
38
+ /** Parameters for a single action execution. */
39
+ interface ActionParams {
40
+ connector: string;
41
+ actionType: string;
42
+ params: Record<string, unknown>;
43
+ idempotencyKey?: string;
44
+ }
45
+ /** Return type of `useAction`. */
46
+ interface UseActionResult {
47
+ /** Execute an action against a connector via the gateway. */
48
+ execute: (params: ActionParams) => Promise<void>;
49
+ /** Last action result (success or error). Null before first execution. */
50
+ lastResult: ActionResult | ActionErrorResult | null;
51
+ /** Whether an action is currently in flight. */
52
+ isPending: boolean;
53
+ }
54
+ /**
55
+ * Execute imperative actions against external systems via the gateway.
56
+ *
57
+ * Wraps `SyncCoordinator.executeAction()` and subscribes to
58
+ * `onActionComplete` events to track the latest result.
59
+ *
60
+ * ```ts
61
+ * const { execute, lastResult, isPending } = useAction();
62
+ *
63
+ * await execute({
64
+ * connector: "slack",
65
+ * actionType: "send_message",
66
+ * params: { channel: "#general", text: "Hello" },
67
+ * });
68
+ * ```
69
+ */
70
+ declare function useAction(): UseActionResult;
71
+ /** Return type of `useActionDiscovery`. */
72
+ interface UseActionDiscoveryResult {
73
+ /** Map of connector name to supported action descriptors. */
74
+ connectors: Record<string, ActionDescriptor[]>;
75
+ /** Whether discovery is loading. */
76
+ isLoading: boolean;
77
+ /** Error from the last fetch, or null. */
78
+ error: LakeSyncError | null;
79
+ /** Manually re-fetch available actions. */
80
+ refetch: () => void;
81
+ }
82
+ /**
83
+ * Discover available connectors and their supported action types.
84
+ *
85
+ * Calls `transport.describeActions()` on mount and returns the result
86
+ * reactively. Use this to build dynamic UI based on available actions.
87
+ *
88
+ * ```ts
89
+ * const { connectors, isLoading } = useActionDiscovery();
90
+ *
91
+ * for (const [name, actions] of Object.entries(connectors)) {
92
+ * console.log(name, actions.map(a => a.actionType));
93
+ * }
94
+ * ```
95
+ */
96
+ declare function useActionDiscovery(): UseActionDiscoveryResult;
97
+
98
+ /** Return type of `useMutation`. */
99
+ interface UseMutationResult {
100
+ insert: (table: string, rowId: string, data: Record<string, unknown>) => Promise<Result<void, LakeSyncError>>;
101
+ update: (table: string, rowId: string, data: Record<string, unknown>) => Promise<Result<void, LakeSyncError>>;
102
+ remove: (table: string, rowId: string) => Promise<Result<void, LakeSyncError>>;
103
+ }
104
+ /**
105
+ * Wraps SyncTracker mutations with automatic query invalidation.
106
+ *
107
+ * After each successful mutation, `dataVersion` is incremented so all
108
+ * active `useQuery` hooks re-run.
109
+ */
110
+ declare function useMutation(): UseMutationResult;
111
+
112
+ /** Return type of `useQuery`. */
113
+ interface UseQueryResult<T> {
114
+ data: T[];
115
+ error: DbError | null;
116
+ isLoading: boolean;
117
+ refetch: () => void;
118
+ }
119
+ /**
120
+ * Reactive SQL query hook.
121
+ *
122
+ * Re-runs automatically when:
123
+ * - Remote deltas are applied (via `onChange`)
124
+ * - A local mutation completes (via `invalidate()`)
125
+ * - The `sql` or `params` arguments change
126
+ *
127
+ * @param sql - SQL query string
128
+ * @param params - Optional bind parameters
129
+ */
130
+ declare function useQuery<T>(sql: string, params?: unknown[]): UseQueryResult<T>;
131
+
132
+ /** Return type of `useSyncStatus`. */
133
+ interface UseSyncStatusResult {
134
+ isSyncing: boolean;
135
+ lastSyncTime: Date | null;
136
+ queueDepth: number;
137
+ error: Error | null;
138
+ }
139
+ /**
140
+ * Observe the sync lifecycle.
141
+ *
142
+ * Tracks whether a sync is in progress, last successful sync time,
143
+ * outbox queue depth, and the most recent sync error (cleared on success).
144
+ */
145
+ declare function useSyncStatus(): UseSyncStatusResult;
146
+
147
+ export { type ActionParams, type LakeSyncContextValue, LakeSyncProvider, type LakeSyncProviderProps, type UseActionDiscoveryResult, type UseActionResult, type UseMutationResult, type UseQueryResult, type UseSyncStatusResult, useAction, useActionDiscovery, useLakeSync, useMutation, useQuery, useSyncStatus };