lakesync 0.1.8 → 0.2.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.
- package/dist/adapter-types-DwsQGQS4.d.ts +94 -0
- package/dist/adapter.d.ts +23 -49
- package/dist/adapter.js +9 -4
- package/dist/analyst.js +1 -1
- package/dist/{base-poller-Bj9kX9dv.d.ts → base-poller-Y7ORYgUv.d.ts} +2 -0
- package/dist/catalogue.js +2 -2
- package/dist/{chunk-LDFFCG2K.js → chunk-4SG66H5K.js} +44 -31
- package/dist/chunk-4SG66H5K.js.map +1 -0
- package/dist/{chunk-LPWXOYNS.js → chunk-C4KD6YKP.js} +59 -43
- package/dist/chunk-C4KD6YKP.js.map +1 -0
- package/dist/{chunk-JI4C4R5H.js → chunk-FIIHPQMQ.js} +196 -118
- package/dist/chunk-FIIHPQMQ.js.map +1 -0
- package/dist/{chunk-TMLG32QV.js → chunk-U2NV4DUX.js} +2 -2
- package/dist/{chunk-QNITY4F6.js → chunk-XVP5DJJ7.js} +16 -13
- package/dist/{chunk-QNITY4F6.js.map → chunk-XVP5DJJ7.js.map} +1 -1
- package/dist/{chunk-KVSWLIJR.js → chunk-YHYBLU6W.js} +2 -2
- package/dist/{chunk-PYRS74YP.js → chunk-ZNY4DSFU.js} +16 -13
- package/dist/{chunk-PYRS74YP.js.map → chunk-ZNY4DSFU.js.map} +1 -1
- package/dist/{chunk-SSICS5KI.js → chunk-ZU7RC7CT.js} +2 -2
- package/dist/client.d.ts +28 -10
- package/dist/client.js +150 -29
- package/dist/client.js.map +1 -1
- package/dist/compactor.d.ts +1 -1
- package/dist/compactor.js +3 -3
- package/dist/connector-jira.d.ts +13 -3
- package/dist/connector-jira.js +6 -2
- package/dist/connector-salesforce.d.ts +13 -3
- package/dist/connector-salesforce.js +6 -2
- package/dist/{coordinator-NXy6tA0h.d.ts → coordinator-eGmZMnJ_.d.ts} +99 -16
- package/dist/create-poller-Cc2MGfhh.d.ts +55 -0
- package/dist/factory-DFfR-030.d.ts +33 -0
- package/dist/gateway-server.d.ts +398 -95
- package/dist/gateway-server.js +743 -56
- package/dist/gateway-server.js.map +1 -1
- package/dist/gateway.d.ts +14 -8
- package/dist/gateway.js +6 -5
- package/dist/index.d.ts +45 -73
- package/dist/index.js +5 -3
- package/dist/parquet.js +2 -2
- package/dist/proto.js +2 -2
- package/dist/react.d.ts +3 -3
- package/dist/{registry-BcspAtZI.d.ts → registry-Dd8JuW8T.d.ts} +1 -1
- package/dist/{request-handler-pUvL7ozF.d.ts → request-handler-B1I5xDOx.d.ts} +71 -27
- package/dist/{src-ROW4XLO7.js → src-WU7IBVC4.js} +6 -4
- package/dist/{types-BrcD1oJg.d.ts → types-D2C9jTbL.d.ts} +33 -23
- package/package.json +1 -1
- package/dist/auth-CAVutXzx.d.ts +0 -30
- package/dist/chunk-JI4C4R5H.js.map +0 -1
- package/dist/chunk-LDFFCG2K.js.map +0 -1
- package/dist/chunk-LPWXOYNS.js.map +0 -1
- package/dist/db-types-CfLMUBfW.d.ts +0 -29
- package/dist/src-B6NLV3FP.js +0 -27
- package/dist/src-ROW4XLO7.js.map +0 -1
- package/dist/src-ZRHKG42A.js +0 -25
- package/dist/src-ZRHKG42A.js.map +0 -1
- package/dist/types-DSC_EiwR.d.ts +0 -45
- /package/dist/{chunk-TMLG32QV.js.map → chunk-U2NV4DUX.js.map} +0 -0
- /package/dist/{chunk-KVSWLIJR.js.map → chunk-YHYBLU6W.js.map} +0 -0
- /package/dist/{chunk-SSICS5KI.js.map → chunk-ZU7RC7CT.js.map} +0 -0
- /package/dist/{src-B6NLV3FP.js.map → src-WU7IBVC4.js.map} +0 -0
package/dist/compactor.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { H as HLCTimestamp, R as Result, L as LakeSyncError, F as FlushError } from './result-CojzlFE2.js';
|
|
2
|
+
import { L as LakeAdapter } from './adapter-types-DwsQGQS4.js';
|
|
2
3
|
import { T as TableSchema } from './types-BdGBv2ba.js';
|
|
3
|
-
import { L as LakeAdapter } from './types-DSC_EiwR.js';
|
|
4
4
|
|
|
5
5
|
/** Configuration for checkpoint generation */
|
|
6
6
|
interface CheckpointConfig {
|
package/dist/compactor.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
encodeSyncResponse
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-YHYBLU6W.js";
|
|
4
4
|
import {
|
|
5
5
|
readParquetToDeltas,
|
|
6
6
|
writeDeltasToParquet
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-ZU7RC7CT.js";
|
|
8
8
|
import {
|
|
9
9
|
Err,
|
|
10
10
|
FlushError,
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
LakeSyncError,
|
|
13
13
|
Ok,
|
|
14
14
|
rowKey
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-4SG66H5K.js";
|
|
16
16
|
import "./chunk-DGUM43GV.js";
|
|
17
17
|
|
|
18
18
|
// ../compactor/src/checkpoint-generator.ts
|
package/dist/connector-jira.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { B as BaseSourcePoller, P as PushTarget } from './base-poller-Y7ORYgUv.js';
|
|
2
|
+
import { C as ConnectorConfig } from './types-D2C9jTbL.js';
|
|
3
3
|
import { T as TableSchema } from './types-BdGBv2ba.js';
|
|
4
|
+
import { L as LakeSyncError, R as Result } from './result-CojzlFE2.js';
|
|
4
5
|
import './hlc-DiD8QNG3.js';
|
|
5
6
|
|
|
6
7
|
/** HTTP error from the Jira REST API. */
|
|
@@ -228,4 +229,13 @@ declare const JIRA_TABLE_SCHEMAS: ReadonlyArray<TableSchema>;
|
|
|
228
229
|
*/
|
|
229
230
|
declare function testConnection(config: JiraConnectorConfig): Promise<Result<void, JiraApiError | JiraRateLimitError>>;
|
|
230
231
|
|
|
231
|
-
|
|
232
|
+
/**
|
|
233
|
+
* Poller factory for Jira connectors.
|
|
234
|
+
*
|
|
235
|
+
* Register with a {@link import("@lakesync/core").PollerRegistry} via `.with("jira", jiraPollerFactory)`.
|
|
236
|
+
*/
|
|
237
|
+
declare function jiraPollerFactory(config: ConnectorConfig, gateway: PushTarget): BaseSourcePoller;
|
|
238
|
+
/** @deprecated Use {@link jiraPollerFactory} instead. */
|
|
239
|
+
declare const createJiraPoller: typeof jiraPollerFactory;
|
|
240
|
+
|
|
241
|
+
export { JIRA_TABLE_SCHEMAS, JiraApiError, JiraClient, type JiraComment, type JiraCommentPage, type JiraConnectorConfig, type JiraIngestConfig, type JiraIssue, type JiraProject, type JiraProjectPage, JiraRateLimitError, type JiraSearchResponse, JiraSourcePoller, createJiraPoller, jiraPollerFactory, mapComment, mapIssue, mapProject, testConnection };
|
package/dist/connector-jira.js
CHANGED
|
@@ -4,12 +4,14 @@ import {
|
|
|
4
4
|
JiraClient,
|
|
5
5
|
JiraRateLimitError,
|
|
6
6
|
JiraSourcePoller,
|
|
7
|
+
createJiraPoller,
|
|
8
|
+
jiraPollerFactory,
|
|
7
9
|
mapComment,
|
|
8
10
|
mapIssue,
|
|
9
11
|
mapProject,
|
|
10
12
|
testConnection
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
+
} from "./chunk-ZNY4DSFU.js";
|
|
14
|
+
import "./chunk-4SG66H5K.js";
|
|
13
15
|
import "./chunk-DGUM43GV.js";
|
|
14
16
|
export {
|
|
15
17
|
JIRA_TABLE_SCHEMAS,
|
|
@@ -17,6 +19,8 @@ export {
|
|
|
17
19
|
JiraClient,
|
|
18
20
|
JiraRateLimitError,
|
|
19
21
|
JiraSourcePoller,
|
|
22
|
+
createJiraPoller,
|
|
23
|
+
jiraPollerFactory,
|
|
20
24
|
mapComment,
|
|
21
25
|
mapIssue,
|
|
22
26
|
mapProject,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { B as BaseSourcePoller, P as PushTarget } from './base-poller-Y7ORYgUv.js';
|
|
2
|
+
import { C as ConnectorConfig } from './types-D2C9jTbL.js';
|
|
3
3
|
import { T as TableSchema } from './types-BdGBv2ba.js';
|
|
4
|
+
import { L as LakeSyncError, R as Result } from './result-CojzlFE2.js';
|
|
4
5
|
import './hlc-DiD8QNG3.js';
|
|
5
6
|
|
|
6
7
|
/** HTTP error from the Salesforce REST API. */
|
|
@@ -251,4 +252,13 @@ declare const SALESFORCE_TABLE_SCHEMAS: ReadonlyArray<TableSchema>;
|
|
|
251
252
|
*/
|
|
252
253
|
declare function testConnection(config: SalesforceConnectorConfig): Promise<Result<void, SalesforceAuthError>>;
|
|
253
254
|
|
|
254
|
-
|
|
255
|
+
/**
|
|
256
|
+
* Poller factory for Salesforce connectors.
|
|
257
|
+
*
|
|
258
|
+
* Register with a {@link import("@lakesync/core").PollerRegistry} via `.with("salesforce", salesforcePollerFactory)`.
|
|
259
|
+
*/
|
|
260
|
+
declare function salesforcePollerFactory(config: ConnectorConfig, gateway: PushTarget): BaseSourcePoller;
|
|
261
|
+
/** @deprecated Use {@link salesforcePollerFactory} instead. */
|
|
262
|
+
declare const createSalesforcePoller: typeof salesforcePollerFactory;
|
|
263
|
+
|
|
264
|
+
export { SALESFORCE_TABLE_SCHEMAS, SalesforceApiError, SalesforceAuthError, type SalesforceAuthResponse, SalesforceClient, type SalesforceConnectorConfig, type SalesforceIngestConfig, type SalesforceQueryResponse, SalesforceSourcePoller, type SfAccount, type SfContact, type SfLead, type SfOpportunity, createSalesforcePoller, mapAccount, mapContact, mapLead, mapOpportunity, salesforcePollerFactory, testConnection };
|
|
@@ -4,13 +4,15 @@ import {
|
|
|
4
4
|
SalesforceAuthError,
|
|
5
5
|
SalesforceClient,
|
|
6
6
|
SalesforceSourcePoller,
|
|
7
|
+
createSalesforcePoller,
|
|
7
8
|
mapAccount,
|
|
8
9
|
mapContact,
|
|
9
10
|
mapLead,
|
|
10
11
|
mapOpportunity,
|
|
12
|
+
salesforcePollerFactory,
|
|
11
13
|
testConnection
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-XVP5DJJ7.js";
|
|
15
|
+
import "./chunk-4SG66H5K.js";
|
|
14
16
|
import "./chunk-DGUM43GV.js";
|
|
15
17
|
export {
|
|
16
18
|
SALESFORCE_TABLE_SCHEMAS,
|
|
@@ -18,10 +20,12 @@ export {
|
|
|
18
20
|
SalesforceAuthError,
|
|
19
21
|
SalesforceClient,
|
|
20
22
|
SalesforceSourcePoller,
|
|
23
|
+
createSalesforcePoller,
|
|
21
24
|
mapAccount,
|
|
22
25
|
mapContact,
|
|
23
26
|
mapLead,
|
|
24
27
|
mapOpportunity,
|
|
28
|
+
salesforcePollerFactory,
|
|
25
29
|
testConnection
|
|
26
30
|
};
|
|
27
31
|
//# sourceMappingURL=connector-salesforce.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { L as LakeSyncError, R as Result, H as HLCTimestamp } from './result-CojzlFE2.js';
|
|
2
2
|
import { A as Action, i as ActionPush, j as ActionResponse, d as ActionDiscovery, k as ActionResult, e as ActionErrorResult } from './types-Bs-QyOe-.js';
|
|
3
3
|
import { H as HLC } from './hlc-DiD8QNG3.js';
|
|
4
|
-
import { a as ConnectorDescriptor } from './registry-
|
|
4
|
+
import { a as ConnectorDescriptor } from './registry-Dd8JuW8T.js';
|
|
5
5
|
import { R as RowDelta, S as SyncPush, e as SyncPull, f as SyncResponse } from './types-BdGBv2ba.js';
|
|
6
6
|
|
|
7
7
|
/** Configuration for opening a local database */
|
|
@@ -154,6 +154,54 @@ interface ActionQueue {
|
|
|
154
154
|
clear(): Promise<Result<void, LakeSyncError>>;
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
+
/**
|
|
158
|
+
* Context provided to sync strategies with access to sync operations.
|
|
159
|
+
*
|
|
160
|
+
* Each method performs a single sync operation. The strategy decides
|
|
161
|
+
* ordering and which operations to perform.
|
|
162
|
+
*/
|
|
163
|
+
interface SyncContext {
|
|
164
|
+
/** Whether this is the first sync (lastSyncedHlc === 0). */
|
|
165
|
+
readonly isFirstSync: boolean;
|
|
166
|
+
/** Current sync mode. */
|
|
167
|
+
readonly syncMode: "full" | "pushOnly" | "pullOnly";
|
|
168
|
+
/** Perform initial sync via checkpoint download. */
|
|
169
|
+
initialSync(): Promise<void>;
|
|
170
|
+
/** Pull remote deltas from the gateway. */
|
|
171
|
+
pull(): Promise<number>;
|
|
172
|
+
/** Push local deltas to the gateway. */
|
|
173
|
+
push(): Promise<void>;
|
|
174
|
+
/** Process pending actions from the action queue. */
|
|
175
|
+
processActions(): Promise<void>;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Strategy that determines the ordering of sync operations.
|
|
179
|
+
*
|
|
180
|
+
* Decouples "what to sync" from "in what order".
|
|
181
|
+
*/
|
|
182
|
+
interface SyncStrategy {
|
|
183
|
+
/** Execute a sync cycle using the provided context. */
|
|
184
|
+
execute(ctx: SyncContext): Promise<void>;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Default strategy: pull before push.
|
|
188
|
+
*
|
|
189
|
+
* On first sync, performs initial sync (checkpoint download).
|
|
190
|
+
* Then pulls remote deltas, pushes local deltas, and processes actions.
|
|
191
|
+
*/
|
|
192
|
+
declare class PullFirstStrategy implements SyncStrategy {
|
|
193
|
+
execute(ctx: SyncContext): Promise<void>;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Push-first strategy for offline-first apps.
|
|
197
|
+
*
|
|
198
|
+
* Pushes local deltas first, then pulls remote deltas.
|
|
199
|
+
* Useful when local changes should be sent before receiving updates.
|
|
200
|
+
*/
|
|
201
|
+
declare class PushFirstStrategy implements SyncStrategy {
|
|
202
|
+
execute(ctx: SyncContext): Promise<void>;
|
|
203
|
+
}
|
|
204
|
+
|
|
157
205
|
/**
|
|
158
206
|
* Tracks local mutations (insert, update, delete) and produces
|
|
159
207
|
* column-level deltas that are pushed to a SyncQueue.
|
|
@@ -224,7 +272,7 @@ interface CheckpointResponse {
|
|
|
224
272
|
/** Snapshot HLC marking the point-in-time of this checkpoint */
|
|
225
273
|
snapshotHlc: HLCTimestamp;
|
|
226
274
|
}
|
|
227
|
-
/**
|
|
275
|
+
/** Core sync transport — push and pull deltas. */
|
|
228
276
|
interface SyncTransport {
|
|
229
277
|
/** Push local deltas to the gateway */
|
|
230
278
|
push(msg: SyncPush): Promise<Result<{
|
|
@@ -233,23 +281,39 @@ interface SyncTransport {
|
|
|
233
281
|
}, LakeSyncError>>;
|
|
234
282
|
/** Pull remote deltas from the gateway */
|
|
235
283
|
pull(msg: SyncPull): Promise<Result<SyncResponse, LakeSyncError>>;
|
|
284
|
+
}
|
|
285
|
+
/** Transport that supports checkpoint downloads for initial sync. */
|
|
286
|
+
interface CheckpointTransport {
|
|
236
287
|
/** Download checkpoint for initial sync. Returns null if no checkpoint available. */
|
|
237
|
-
checkpoint
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
describeActions?(): Promise<Result<ActionDiscovery, LakeSyncError>>;
|
|
242
|
-
/** List available connector types and their configuration schemas. */
|
|
243
|
-
listConnectorTypes?(): Promise<Result<ConnectorDescriptor[], LakeSyncError>>;
|
|
288
|
+
checkpoint(): Promise<Result<CheckpointResponse | null, LakeSyncError>>;
|
|
289
|
+
}
|
|
290
|
+
/** Transport that supports real-time server-initiated broadcasts. */
|
|
291
|
+
interface RealtimeTransport {
|
|
244
292
|
/** Whether this transport supports real-time server push. */
|
|
245
|
-
readonly supportsRealtime
|
|
293
|
+
readonly supportsRealtime: boolean;
|
|
246
294
|
/** Register callback for server-initiated broadcasts. */
|
|
247
|
-
onBroadcast
|
|
295
|
+
onBroadcast(callback: (deltas: RowDelta[], serverHlc: HLCTimestamp) => void): void;
|
|
248
296
|
/** Connect persistent transport (e.g. open WebSocket). */
|
|
249
|
-
connect
|
|
297
|
+
connect(): void;
|
|
250
298
|
/** Disconnect persistent transport (e.g. close WebSocket). */
|
|
251
|
-
disconnect
|
|
299
|
+
disconnect(): void;
|
|
300
|
+
}
|
|
301
|
+
/** Transport that supports imperative action execution. */
|
|
302
|
+
interface ActionTransport {
|
|
303
|
+
/** Execute imperative actions against external systems via the gateway. */
|
|
304
|
+
executeAction(msg: ActionPush): Promise<Result<ActionResponse, LakeSyncError>>;
|
|
305
|
+
/** Discover available connectors and their supported action types. */
|
|
306
|
+
describeActions(): Promise<Result<ActionDiscovery, LakeSyncError>>;
|
|
307
|
+
/** List available connector types and their configuration schemas. */
|
|
308
|
+
listConnectorTypes(): Promise<Result<ConnectorDescriptor[], LakeSyncError>>;
|
|
252
309
|
}
|
|
310
|
+
/**
|
|
311
|
+
* Union type combining the core sync transport with optional capabilities.
|
|
312
|
+
*
|
|
313
|
+
* Transports must implement push/pull. Checkpoint, real-time, and action
|
|
314
|
+
* capabilities are opt-in via the respective interfaces.
|
|
315
|
+
*/
|
|
316
|
+
type TransportWithCapabilities = SyncTransport & Partial<CheckpointTransport> & Partial<RealtimeTransport> & Partial<ActionTransport>;
|
|
253
317
|
|
|
254
318
|
/** Controls which operations syncOnce() / startAutoSync() performs */
|
|
255
319
|
type SyncMode = "full" | "pushOnly" | "pullOnly";
|
|
@@ -295,11 +359,13 @@ interface SyncCoordinatorConfig {
|
|
|
295
359
|
actionQueue?: ActionQueue;
|
|
296
360
|
/** Maximum retries for actions before dead-lettering. Defaults to 5. */
|
|
297
361
|
maxActionRetries?: number;
|
|
362
|
+
/** Sync strategy. Defaults to PullFirstStrategy. */
|
|
363
|
+
strategy?: SyncStrategy;
|
|
298
364
|
}
|
|
299
365
|
/**
|
|
300
366
|
* Coordinates local mutations (via SyncTracker) with gateway push/pull.
|
|
301
367
|
*
|
|
302
|
-
* Uses a {@link
|
|
368
|
+
* Uses a {@link TransportWithCapabilities} abstraction to communicate with the gateway,
|
|
303
369
|
* allowing both in-process (LocalTransport) and remote (HttpTransport) usage.
|
|
304
370
|
*
|
|
305
371
|
* Delegates auto-sync scheduling to {@link AutoSyncScheduler} and action
|
|
@@ -318,10 +384,14 @@ declare class SyncCoordinator {
|
|
|
318
384
|
private lastSyncedHlc;
|
|
319
385
|
private _lastSyncTime;
|
|
320
386
|
private syncing;
|
|
387
|
+
private _online;
|
|
388
|
+
private onlineHandler;
|
|
389
|
+
private offlineHandler;
|
|
390
|
+
private readonly strategy;
|
|
321
391
|
private readonly autoSyncScheduler;
|
|
322
392
|
private readonly actionProcessor;
|
|
323
393
|
private listeners;
|
|
324
|
-
constructor(db: LocalDB, transport:
|
|
394
|
+
constructor(db: LocalDB, transport: TransportWithCapabilities, config?: SyncCoordinatorConfig);
|
|
325
395
|
/** Register an event listener */
|
|
326
396
|
on<K extends keyof SyncEvents>(event: K, listener: SyncEvents[K]): void;
|
|
327
397
|
/** Remove an event listener */
|
|
@@ -329,6 +399,8 @@ declare class SyncCoordinator {
|
|
|
329
399
|
private emit;
|
|
330
400
|
/** Readable snapshot of the current sync state. */
|
|
331
401
|
get state(): SyncState;
|
|
402
|
+
/** Whether the client believes it is online. */
|
|
403
|
+
get isOnline(): boolean;
|
|
332
404
|
/** Push pending deltas to the gateway via the transport */
|
|
333
405
|
pushToGateway(): Promise<void>;
|
|
334
406
|
/**
|
|
@@ -357,6 +429,8 @@ declare class SyncCoordinator {
|
|
|
357
429
|
/**
|
|
358
430
|
* Start auto-sync: periodic interval + visibility change handler.
|
|
359
431
|
* Synchronises (push + pull) on tab focus and every N seconds.
|
|
432
|
+
* Registers online/offline listeners to skip sync when offline
|
|
433
|
+
* and trigger an immediate sync on reconnect.
|
|
360
434
|
*/
|
|
361
435
|
startAutoSync(): void;
|
|
362
436
|
/**
|
|
@@ -369,6 +443,8 @@ declare class SyncCoordinator {
|
|
|
369
443
|
* not support checkpoints, falls back to incremental pull.
|
|
370
444
|
*/
|
|
371
445
|
private initialSync;
|
|
446
|
+
/** Build a {@link SyncContext} exposing sync operations for the current cycle. */
|
|
447
|
+
private createSyncContext;
|
|
372
448
|
/** Perform a single sync cycle (push + pull + actions, depending on syncMode). */
|
|
373
449
|
syncOnce(): Promise<void>;
|
|
374
450
|
/**
|
|
@@ -408,6 +484,13 @@ declare class SyncCoordinator {
|
|
|
408
484
|
listConnectorTypes(): Promise<Result<ConnectorDescriptor[], LakeSyncError>>;
|
|
409
485
|
/** Stop auto-sync and clean up listeners */
|
|
410
486
|
stopAutoSync(): void;
|
|
487
|
+
/**
|
|
488
|
+
* Register window online/offline event listeners.
|
|
489
|
+
* Guards all browser API access with typeof checks for Node/SSR safety.
|
|
490
|
+
*/
|
|
491
|
+
private setupOnlineListeners;
|
|
492
|
+
/** Remove online/offline listeners. */
|
|
493
|
+
private teardownOnlineListeners;
|
|
411
494
|
}
|
|
412
495
|
|
|
413
|
-
export { type ActionQueue as A, type
|
|
496
|
+
export { type ActionQueue as A, type CheckpointTransport as C, DbError as D, LocalDB as L, PullFirstStrategy as P, type QueueEntry as Q, type RealtimeTransport as R, type SyncQueue as S, type TransportWithCapabilities as T, type SyncCoordinatorConfig as a, SyncCoordinator as b, type ActionQueueEntry as c, type SyncTransport as d, type ActionTransport as e, type CheckpointResponse as f, type ActionQueueEntryStatus as g, type DbConfig as h, PushFirstStrategy as i, type QueueEntryStatus as j, type SyncContext as k, type SyncEvents as l, type SyncMode as m, type SyncState as n, type SyncStrategy as o, SyncTracker as p, type Transaction as q };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { R as Result } from './result-CojzlFE2.js';
|
|
2
|
+
import { P as PushTarget, B as BaseSourcePoller } from './base-poller-Y7ORYgUv.js';
|
|
3
|
+
import { C as ConnectorConfig } from './types-D2C9jTbL.js';
|
|
4
|
+
|
|
5
|
+
/** Claims extracted from a verified JWT token */
|
|
6
|
+
interface AuthClaims {
|
|
7
|
+
/** Client identifier (from JWT `sub` claim) */
|
|
8
|
+
clientId: string;
|
|
9
|
+
/** Authorised gateway ID (from JWT `gw` claim) */
|
|
10
|
+
gatewayId: string;
|
|
11
|
+
/** Role for route-level access control (from JWT `role` claim, defaults to "client") */
|
|
12
|
+
role: string;
|
|
13
|
+
/** Non-standard JWT claims for sync rule evaluation */
|
|
14
|
+
customClaims: Record<string, string | string[]>;
|
|
15
|
+
}
|
|
16
|
+
/** Authentication error returned when JWT verification fails */
|
|
17
|
+
declare class AuthError extends Error {
|
|
18
|
+
constructor(message: string);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Verify a JWT token signed with HMAC-SHA256 and extract authentication claims.
|
|
22
|
+
*
|
|
23
|
+
* Uses the Web Crypto API exclusively (no external dependencies), making it
|
|
24
|
+
* suitable for Cloudflare Workers and other edge runtimes.
|
|
25
|
+
*
|
|
26
|
+
* @param token - The raw JWT string (header.payload.signature)
|
|
27
|
+
* @param secret - The HMAC-SHA256 secret key
|
|
28
|
+
* @returns A Result containing AuthClaims on success, or AuthError on failure
|
|
29
|
+
*/
|
|
30
|
+
declare function verifyToken(token: string, secret: string): Promise<Result<AuthClaims, AuthError>>;
|
|
31
|
+
|
|
32
|
+
/** Factory function that creates a poller from a ConnectorConfig. */
|
|
33
|
+
type PollerFactory = (config: ConnectorConfig, gateway: PushTarget) => BaseSourcePoller;
|
|
34
|
+
/** Immutable registry of poller factories keyed by connector type. */
|
|
35
|
+
interface PollerRegistry {
|
|
36
|
+
/** Look up a factory by type. */
|
|
37
|
+
get(type: string): PollerFactory | undefined;
|
|
38
|
+
/** Create a new registry with an additional or replaced factory. */
|
|
39
|
+
with(type: string, factory: PollerFactory): PollerRegistry;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Create an immutable {@link PollerRegistry} from a Map of factories.
|
|
43
|
+
*/
|
|
44
|
+
declare function createPollerRegistry(factories?: Map<string, PollerFactory>): PollerRegistry;
|
|
45
|
+
/**
|
|
46
|
+
* Create a poller from a {@link ConnectorConfig}.
|
|
47
|
+
*
|
|
48
|
+
* @param config - Connector configuration.
|
|
49
|
+
* @param gateway - Push target for the poller.
|
|
50
|
+
* @param registry - Registry of poller factories to look up the config's type.
|
|
51
|
+
* @throws If no factory has been registered for the config's `type`.
|
|
52
|
+
*/
|
|
53
|
+
declare function createPoller(config: ConnectorConfig, gateway: PushTarget, registry: PollerRegistry): BaseSourcePoller;
|
|
54
|
+
|
|
55
|
+
export { type AuthClaims as A, type PollerFactory as P, AuthError as a, type PollerRegistry as b, createPoller as c, createPollerRegistry as d, verifyToken as v };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { R as Result, A as AdapterError } from './result-CojzlFE2.js';
|
|
2
|
+
import { D as DatabaseAdapter } from './adapter-types-DwsQGQS4.js';
|
|
3
|
+
import { C as ConnectorConfig } from './types-D2C9jTbL.js';
|
|
4
|
+
|
|
5
|
+
/** Factory function that creates a DatabaseAdapter from a ConnectorConfig. */
|
|
6
|
+
type AdapterFactory = (config: ConnectorConfig) => DatabaseAdapter;
|
|
7
|
+
/** Immutable registry of adapter factories keyed by connector type. */
|
|
8
|
+
interface AdapterFactoryRegistry {
|
|
9
|
+
/** Look up a factory by type. */
|
|
10
|
+
get(type: string): AdapterFactory | undefined;
|
|
11
|
+
/** Create a new registry with an additional or replaced factory. */
|
|
12
|
+
with(type: string, factory: AdapterFactory): AdapterFactoryRegistry;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Create an immutable {@link AdapterFactoryRegistry} from a Map of factories.
|
|
16
|
+
*/
|
|
17
|
+
declare function createAdapterFactoryRegistry(factories?: Map<string, AdapterFactory>): AdapterFactoryRegistry;
|
|
18
|
+
/** Default registry with built-in database adapters (Postgres, MySQL, BigQuery). */
|
|
19
|
+
declare function defaultAdapterFactoryRegistry(): AdapterFactoryRegistry;
|
|
20
|
+
/**
|
|
21
|
+
* Instantiate a {@link DatabaseAdapter} from a {@link ConnectorConfig}.
|
|
22
|
+
*
|
|
23
|
+
* Uses the provided registry (or the default built-in registry) to look up
|
|
24
|
+
* a factory for the config's type. Returns an {@link AdapterError} if the
|
|
25
|
+
* type is unsupported or the adapter constructor throws.
|
|
26
|
+
*
|
|
27
|
+
* @param config - Validated connector configuration.
|
|
28
|
+
* @param registry - Optional adapter factory registry. Defaults to built-in adapters.
|
|
29
|
+
* @returns The instantiated adapter or an error.
|
|
30
|
+
*/
|
|
31
|
+
declare function createDatabaseAdapter(config: ConnectorConfig, registry?: AdapterFactoryRegistry): Result<DatabaseAdapter, AdapterError>;
|
|
32
|
+
|
|
33
|
+
export { type AdapterFactory as A, type AdapterFactoryRegistry as a, createDatabaseAdapter as b, createAdapterFactoryRegistry as c, defaultAdapterFactoryRegistry as d };
|