lakesync 0.1.5 → 0.1.8
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.d.ts +199 -19
- package/dist/adapter.js +19 -3
- package/dist/analyst.js +2 -2
- package/dist/{base-poller-CBvhdvcj.d.ts → base-poller-Bj9kX9dv.d.ts} +76 -19
- package/dist/catalogue.d.ts +1 -1
- package/dist/catalogue.js +3 -3
- package/dist/chunk-DGUM43GV.js +11 -0
- package/dist/{chunk-PWGQ3PXE.js → chunk-JI4C4R5H.js} +280 -140
- package/dist/chunk-JI4C4R5H.js.map +1 -0
- package/dist/{chunk-L4ZL5JA7.js → chunk-KVSWLIJR.js} +2 -2
- package/dist/{chunk-7UBS6MFH.js → chunk-LDFFCG2K.js} +377 -247
- package/dist/chunk-LDFFCG2K.js.map +1 -0
- package/dist/{chunk-Z7FGLEQU.js → chunk-LPWXOYNS.js} +376 -287
- package/dist/chunk-LPWXOYNS.js.map +1 -0
- package/dist/{chunk-SZSGSTVZ.js → chunk-PYRS74YP.js} +15 -4
- package/dist/{chunk-SZSGSTVZ.js.map → chunk-PYRS74YP.js.map} +1 -1
- package/dist/{chunk-TVLTXHW6.js → chunk-QNITY4F6.js} +30 -7
- package/dist/{chunk-TVLTXHW6.js.map → chunk-QNITY4F6.js.map} +1 -1
- package/dist/{chunk-46CKACNC.js → chunk-SSICS5KI.js} +2 -2
- package/dist/{chunk-B3QEUG6E.js → chunk-TMLG32QV.js} +2 -2
- package/dist/client.d.ts +164 -13
- package/dist/client.js +310 -163
- package/dist/client.js.map +1 -1
- package/dist/compactor.d.ts +1 -1
- package/dist/compactor.js +4 -4
- package/dist/connector-jira.d.ts +2 -2
- package/dist/connector-jira.js +3 -3
- package/dist/connector-salesforce.d.ts +2 -2
- package/dist/connector-salesforce.js +3 -3
- package/dist/{coordinator-DN8D8C7W.d.ts → coordinator-NXy6tA0h.d.ts} +23 -16
- package/dist/{db-types-B6_JKQWK.d.ts → db-types-CfLMUBfW.d.ts} +1 -1
- package/dist/gateway-server.d.ts +158 -64
- package/dist/gateway-server.js +482 -4003
- package/dist/gateway-server.js.map +1 -1
- package/dist/gateway.d.ts +61 -104
- package/dist/gateway.js +12 -6
- package/dist/index.d.ts +45 -10
- package/dist/index.js +14 -2
- package/dist/parquet.d.ts +1 -1
- package/dist/parquet.js +3 -3
- package/dist/proto.d.ts +1 -1
- package/dist/proto.js +3 -3
- package/dist/react.d.ts +47 -10
- package/dist/react.js +88 -40
- package/dist/react.js.map +1 -1
- package/dist/{registry-BN_9spxE.d.ts → registry-BcspAtZI.d.ts} +19 -4
- package/dist/{gateway-CvO7Xy3T.d.ts → request-handler-pUvL7ozF.d.ts} +139 -10
- package/dist/{resolver-BZURzdlL.d.ts → resolver-CXxmC0jR.d.ts} +1 -1
- package/dist/{src-RR7I76OL.js → src-B6NLV3FP.js} +4 -4
- package/dist/{src-SLVE5567.js → src-ROW4XLO7.js} +15 -3
- package/dist/{src-V2CTPR7V.js → src-ZRHKG42A.js} +4 -4
- package/dist/{types-GGBfZBKQ.d.ts → types-BdGBv2ba.d.ts} +23 -2
- package/dist/{types-D-E0VrfS.d.ts → types-BrcD1oJg.d.ts} +26 -19
- package/package.json +1 -1
- package/dist/chunk-7D4SUZUM.js +0 -38
- package/dist/chunk-7UBS6MFH.js.map +0 -1
- package/dist/chunk-PWGQ3PXE.js.map +0 -1
- package/dist/chunk-Z7FGLEQU.js.map +0 -1
- /package/dist/{chunk-7D4SUZUM.js.map → chunk-DGUM43GV.js.map} +0 -0
- /package/dist/{chunk-L4ZL5JA7.js.map → chunk-KVSWLIJR.js.map} +0 -0
- /package/dist/{chunk-46CKACNC.js.map → chunk-SSICS5KI.js.map} +0 -0
- /package/dist/{chunk-B3QEUG6E.js.map → chunk-TMLG32QV.js.map} +0 -0
- /package/dist/{src-RR7I76OL.js.map → src-B6NLV3FP.js.map} +0 -0
- /package/dist/{src-SLVE5567.js.map → src-ROW4XLO7.js.map} +0 -0
- /package/dist/{src-V2CTPR7V.js.map → src-ZRHKG42A.js.map} +0 -0
package/dist/gateway.d.ts
CHANGED
|
@@ -1,47 +1,17 @@
|
|
|
1
1
|
import { S as SyncRulesConfig, R as ResolvedClaims, b as SyncRulesContext, i as ActionPush } from './types-Bs-QyOe-.js';
|
|
2
2
|
export { d as ActionDiscovery, g as ActionHandler, j as ActionResponse, l as AuthContext } from './types-Bs-QyOe-.js';
|
|
3
|
-
export { I as IngestTarget, i as isIngestTarget } from './base-poller-
|
|
4
|
-
import { T as TableSchema, R as RowDelta,
|
|
5
|
-
export {
|
|
3
|
+
export { I as IngestTarget, i as isIngestTarget } from './base-poller-Bj9kX9dv.js';
|
|
4
|
+
import { T as TableSchema, R as RowDelta, e as SyncPull, S as SyncPush } from './types-BdGBv2ba.js';
|
|
5
|
+
export { f as SyncResponse } from './types-BdGBv2ba.js';
|
|
6
6
|
export { b as bigintReplacer, a as bigintReviver } from './json-dYtqiL0F.js';
|
|
7
|
-
import {
|
|
8
|
-
export { A as ActionDispatcher, B as BufferConfig,
|
|
9
|
-
import { C as ConnectorConfig } from './types-D-E0VrfS.js';
|
|
7
|
+
import { D as DeltaBuffer } from './request-handler-pUvL7ozF.js';
|
|
8
|
+
export { A as ActionCacheConfig, a as ActionDispatcher, B as BufferConfig, C as ConfigStore, F as FlushEnvelope, G as GatewayConfig, b as GatewayState, H as HandlePushResult, c as HandlerResult, M as MemoryConfigStore, S as SchemaManager, d as SyncGateway, h as handleActionRequest, e as handleFlushRequest, f as handleListConnectorTypes, g as handleListConnectors, i as handleMetrics, j as handlePullRequest, k as handlePushRequest, l as handleRegisterConnector, m as handleSaveSchema, n as handleSaveSyncRules, o as handleUnregisterConnector } from './request-handler-pUvL7ozF.js';
|
|
10
9
|
import { R as Result, F as FlushError, H as HLCTimestamp } from './result-CojzlFE2.js';
|
|
11
|
-
import { D as DatabaseAdapter } from './db-types-
|
|
10
|
+
import { D as DatabaseAdapter } from './db-types-CfLMUBfW.js';
|
|
12
11
|
import { L as LakeAdapter } from './types-DSC_EiwR.js';
|
|
13
12
|
import { N as NessieCatalogueClient } from './nessie-client-DrNikVXy.js';
|
|
14
13
|
import './hlc-DiD8QNG3.js';
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Platform-agnostic configuration storage interface.
|
|
18
|
-
*
|
|
19
|
-
* Implemented by MemoryConfigStore (tests, gateway-server) and
|
|
20
|
-
* DurableStorageConfigStore (gateway-worker).
|
|
21
|
-
*/
|
|
22
|
-
interface ConfigStore {
|
|
23
|
-
getSchema(gatewayId: string): Promise<TableSchema | undefined>;
|
|
24
|
-
setSchema(gatewayId: string, schema: TableSchema): Promise<void>;
|
|
25
|
-
getSyncRules(gatewayId: string): Promise<SyncRulesConfig | undefined>;
|
|
26
|
-
setSyncRules(gatewayId: string, rules: SyncRulesConfig): Promise<void>;
|
|
27
|
-
getConnectors(): Promise<Record<string, ConnectorConfig>>;
|
|
28
|
-
setConnectors(connectors: Record<string, ConnectorConfig>): Promise<void>;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* In-memory implementation of ConfigStore.
|
|
32
|
-
* Used by tests and gateway-server.
|
|
33
|
-
*/
|
|
34
|
-
declare class MemoryConfigStore implements ConfigStore {
|
|
35
|
-
private schemas;
|
|
36
|
-
private syncRules;
|
|
37
|
-
private connectors;
|
|
38
|
-
getSchema(gatewayId: string): Promise<TableSchema | undefined>;
|
|
39
|
-
setSchema(gatewayId: string, schema: TableSchema): Promise<void>;
|
|
40
|
-
getSyncRules(gatewayId: string): Promise<SyncRulesConfig | undefined>;
|
|
41
|
-
setSyncRules(gatewayId: string, rules: SyncRulesConfig): Promise<void>;
|
|
42
|
-
getConnectors(): Promise<Record<string, ConnectorConfig>>;
|
|
43
|
-
setConnectors(connectors: Record<string, ConnectorConfig>): Promise<void>;
|
|
44
|
-
}
|
|
14
|
+
import './types-BrcD1oJg.js';
|
|
45
15
|
|
|
46
16
|
/** Maximum push payload size (1 MiB). */
|
|
47
17
|
declare const MAX_PUSH_PAYLOAD_BYTES = 1048576;
|
|
@@ -51,8 +21,8 @@ declare const MAX_DELTAS_PER_PUSH = 10000;
|
|
|
51
21
|
declare const MAX_PULL_LIMIT = 10000;
|
|
52
22
|
/** Default number of deltas returned in a pull when no limit is specified. */
|
|
53
23
|
declare const DEFAULT_PULL_LIMIT = 100;
|
|
54
|
-
/** Allowed column types for schema validation. */
|
|
55
|
-
declare const VALID_COLUMN_TYPES:
|
|
24
|
+
/** Allowed column types for schema validation. Derived from core COLUMN_TYPES. */
|
|
25
|
+
declare const VALID_COLUMN_TYPES: ReadonlySet<string>;
|
|
56
26
|
/** Default maximum buffer size before triggering flush (4 MiB). */
|
|
57
27
|
declare const DEFAULT_MAX_BUFFER_BYTES: number;
|
|
58
28
|
/** Default maximum buffer age before triggering flush (30 seconds). */
|
|
@@ -92,80 +62,67 @@ declare function flushEntries(entries: RowDelta[], byteSize: number, deps: Flush
|
|
|
92
62
|
*/
|
|
93
63
|
declare function commitToCatalogue(objectKey: string, fileSizeInBytes: number, recordCount: number, catalogue: NessieCatalogueClient, schema: TableSchema): Promise<void>;
|
|
94
64
|
|
|
95
|
-
/**
|
|
96
|
-
interface
|
|
97
|
-
|
|
98
|
-
|
|
65
|
+
/** Dependencies for flush operations. */
|
|
66
|
+
interface FlushCoordinatorDeps {
|
|
67
|
+
/** Gateway configuration for flush. */
|
|
68
|
+
config: FlushConfig;
|
|
69
|
+
/** Table schemas for materialisation after flush. */
|
|
70
|
+
schemas?: ReadonlyArray<TableSchema>;
|
|
99
71
|
}
|
|
100
72
|
/**
|
|
101
|
-
*
|
|
73
|
+
* Coordinates flush operations from the buffer to the adapter.
|
|
102
74
|
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
declare function handleActionRequest(gateway: SyncGateway, raw: string, headerClientId?: string | null, claims?: ResolvedClaims): Promise<HandlerResult>;
|
|
129
|
-
/**
|
|
130
|
-
* Handle a flush request.
|
|
131
|
-
*/
|
|
132
|
-
declare function handleFlushRequest(gateway: SyncGateway, opts?: {
|
|
133
|
-
clearPersistence?: () => void;
|
|
134
|
-
}): Promise<HandlerResult>;
|
|
135
|
-
/**
|
|
136
|
-
* Handle saving a table schema.
|
|
137
|
-
*/
|
|
138
|
-
declare function handleSaveSchema(raw: string, store: ConfigStore, gatewayId: string): Promise<HandlerResult>;
|
|
139
|
-
/**
|
|
140
|
-
* Handle saving sync rules.
|
|
141
|
-
*/
|
|
142
|
-
declare function handleSaveSyncRules(raw: string, store: ConfigStore, gatewayId: string): Promise<HandlerResult>;
|
|
143
|
-
/**
|
|
144
|
-
* Handle registering a connector.
|
|
145
|
-
*/
|
|
146
|
-
declare function handleRegisterConnector(raw: string, store: ConfigStore): Promise<HandlerResult>;
|
|
147
|
-
/**
|
|
148
|
-
* Handle unregistering a connector.
|
|
149
|
-
*/
|
|
150
|
-
declare function handleUnregisterConnector(name: string, store: ConfigStore): Promise<HandlerResult>;
|
|
151
|
-
/**
|
|
152
|
-
* Handle listing connectors.
|
|
153
|
-
*/
|
|
154
|
-
declare function handleListConnectors(store: ConfigStore): Promise<HandlerResult>;
|
|
155
|
-
/**
|
|
156
|
-
* Handle listing available connector types (static metadata).
|
|
157
|
-
*/
|
|
158
|
-
declare function handleListConnectorTypes(): HandlerResult;
|
|
75
|
+
* Owns the flushing state to prevent concurrent flushes and handles
|
|
76
|
+
* entry restoration on failure.
|
|
77
|
+
*/
|
|
78
|
+
declare class FlushCoordinator {
|
|
79
|
+
private flushing;
|
|
80
|
+
/** Whether a flush is currently in progress. */
|
|
81
|
+
get isFlushing(): boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Flush all entries from the buffer to the adapter.
|
|
84
|
+
*
|
|
85
|
+
* Drains the buffer first, then writes to the adapter. On failure,
|
|
86
|
+
* entries are restored to the buffer.
|
|
87
|
+
*/
|
|
88
|
+
flush(buffer: DeltaBuffer, adapter: LakeAdapter | DatabaseAdapter | null, deps: FlushCoordinatorDeps): Promise<Result<void, FlushError>>;
|
|
89
|
+
/**
|
|
90
|
+
* Flush a single table's deltas from the buffer.
|
|
91
|
+
*
|
|
92
|
+
* Drains only the specified table's deltas and flushes them,
|
|
93
|
+
* leaving other tables in the buffer.
|
|
94
|
+
*/
|
|
95
|
+
flushTable(table: string, buffer: DeltaBuffer, adapter: LakeAdapter | DatabaseAdapter | null, deps: FlushCoordinatorDeps): Promise<Result<void, FlushError>>;
|
|
96
|
+
/** Restore drained entries back to the buffer for retry. */
|
|
97
|
+
private restoreEntries;
|
|
98
|
+
}
|
|
99
|
+
|
|
159
100
|
/**
|
|
160
|
-
*
|
|
161
|
-
|
|
162
|
-
|
|
101
|
+
* Registry for named source adapters used in adapter-sourced pulls.
|
|
102
|
+
*
|
|
103
|
+
* Manages the mapping of source names to DatabaseAdapter instances,
|
|
104
|
+
* decoupling source adapter management from the gateway.
|
|
105
|
+
*/
|
|
106
|
+
declare class SourceRegistry {
|
|
107
|
+
private sources;
|
|
108
|
+
constructor(initial?: Record<string, DatabaseAdapter>);
|
|
109
|
+
/** Register a named source adapter. */
|
|
110
|
+
register(name: string, adapter: DatabaseAdapter): void;
|
|
111
|
+
/** Unregister a named source adapter. */
|
|
112
|
+
unregister(name: string): void;
|
|
113
|
+
/** Get a source adapter by name, or undefined if not registered. */
|
|
114
|
+
get(name: string): DatabaseAdapter | undefined;
|
|
115
|
+
/** List all registered source adapter names. */
|
|
116
|
+
list(): string[];
|
|
117
|
+
}
|
|
163
118
|
|
|
164
119
|
/** Validation error with HTTP status code. */
|
|
165
120
|
interface RequestError {
|
|
166
121
|
status: number;
|
|
167
122
|
message: string;
|
|
168
123
|
}
|
|
124
|
+
/** Parse a JSON string, returning Err on invalid JSON. */
|
|
125
|
+
declare function parseJson<T>(raw: string, reviver?: (key: string, value: unknown) => unknown): Result<T, RequestError>;
|
|
169
126
|
/**
|
|
170
127
|
* Validate and parse a push request body.
|
|
171
128
|
* Handles JSON parsing with bigint revival.
|
|
@@ -198,4 +155,4 @@ declare function pushErrorToStatus(code: string): number;
|
|
|
198
155
|
*/
|
|
199
156
|
declare function buildSyncRulesContext(rules: SyncRulesConfig | undefined, claims: ResolvedClaims): SyncRulesContext | undefined;
|
|
200
157
|
|
|
201
|
-
export { ActionPush,
|
|
158
|
+
export { ActionPush, DEFAULT_MAX_BUFFER_AGE_MS, DEFAULT_MAX_BUFFER_BYTES, DEFAULT_PULL_LIMIT, DeltaBuffer, type FlushConfig, FlushCoordinator, type FlushCoordinatorDeps, type FlushDeps, MAX_DELTAS_PER_PUSH, MAX_PULL_LIMIT, MAX_PUSH_PAYLOAD_BYTES, type RequestError, SourceRegistry, SyncPull, SyncPush, VALID_COLUMN_TYPES, buildSyncRulesContext, commitToCatalogue, flushEntries, hlcRange, parseJson, parsePullParams, pushErrorToStatus, validateActionBody, validatePushBody, validateSchemaBody };
|
package/dist/gateway.js
CHANGED
|
@@ -4,11 +4,13 @@ import {
|
|
|
4
4
|
DEFAULT_MAX_BUFFER_BYTES,
|
|
5
5
|
DEFAULT_PULL_LIMIT,
|
|
6
6
|
DeltaBuffer,
|
|
7
|
+
FlushCoordinator,
|
|
7
8
|
MAX_DELTAS_PER_PUSH,
|
|
8
9
|
MAX_PULL_LIMIT,
|
|
9
10
|
MAX_PUSH_PAYLOAD_BYTES,
|
|
10
11
|
MemoryConfigStore,
|
|
11
12
|
SchemaManager,
|
|
13
|
+
SourceRegistry,
|
|
12
14
|
SyncGateway,
|
|
13
15
|
VALID_COLUMN_TYPES,
|
|
14
16
|
buildSyncRulesContext,
|
|
@@ -26,32 +28,35 @@ import {
|
|
|
26
28
|
handleSaveSyncRules,
|
|
27
29
|
handleUnregisterConnector,
|
|
28
30
|
hlcRange,
|
|
31
|
+
parseJson,
|
|
29
32
|
parsePullParams,
|
|
30
33
|
pushErrorToStatus,
|
|
31
34
|
validateActionBody,
|
|
32
35
|
validatePushBody,
|
|
33
36
|
validateSchemaBody
|
|
34
|
-
} from "./chunk-
|
|
35
|
-
import "./chunk-
|
|
36
|
-
import "./chunk-
|
|
37
|
-
import "./chunk-
|
|
37
|
+
} from "./chunk-JI4C4R5H.js";
|
|
38
|
+
import "./chunk-LPWXOYNS.js";
|
|
39
|
+
import "./chunk-TMLG32QV.js";
|
|
40
|
+
import "./chunk-SSICS5KI.js";
|
|
38
41
|
import {
|
|
39
42
|
bigintReplacer,
|
|
40
43
|
bigintReviver,
|
|
41
44
|
isIngestTarget
|
|
42
|
-
} from "./chunk-
|
|
43
|
-
import "./chunk-
|
|
45
|
+
} from "./chunk-LDFFCG2K.js";
|
|
46
|
+
import "./chunk-DGUM43GV.js";
|
|
44
47
|
export {
|
|
45
48
|
ActionDispatcher,
|
|
46
49
|
DEFAULT_MAX_BUFFER_AGE_MS,
|
|
47
50
|
DEFAULT_MAX_BUFFER_BYTES,
|
|
48
51
|
DEFAULT_PULL_LIMIT,
|
|
49
52
|
DeltaBuffer,
|
|
53
|
+
FlushCoordinator,
|
|
50
54
|
MAX_DELTAS_PER_PUSH,
|
|
51
55
|
MAX_PULL_LIMIT,
|
|
52
56
|
MAX_PUSH_PAYLOAD_BYTES,
|
|
53
57
|
MemoryConfigStore,
|
|
54
58
|
SchemaManager,
|
|
59
|
+
SourceRegistry,
|
|
55
60
|
SyncGateway,
|
|
56
61
|
VALID_COLUMN_TYPES,
|
|
57
62
|
bigintReplacer,
|
|
@@ -72,6 +77,7 @@ export {
|
|
|
72
77
|
handleUnregisterConnector,
|
|
73
78
|
hlcRange,
|
|
74
79
|
isIngestTarget,
|
|
80
|
+
parseJson,
|
|
75
81
|
parsePullParams,
|
|
76
82
|
pushErrorToStatus,
|
|
77
83
|
validateActionBody,
|
package/dist/index.d.ts
CHANGED
|
@@ -3,14 +3,14 @@ export { c as ActionDescriptor, d as ActionDiscovery, e as ActionErrorResult, f
|
|
|
3
3
|
import { H as HLCTimestamp, R as Result, C as ConflictError, L as LakeSyncError, S as SchemaError } from './result-CojzlFE2.js';
|
|
4
4
|
export { A as AdapterError, a as AdapterNotFoundError, B as BackpressureError, b as ClockDriftError, E as Err, F as FlushError, O as Ok, f as flatMapResult, c as fromPromise, m as mapResult, t as toError, u as unwrapOrThrow } from './result-CojzlFE2.js';
|
|
5
5
|
export { A as AuthClaims, a as AuthError, v as verifyToken } from './auth-CAVutXzx.js';
|
|
6
|
-
import { P as PushTarget, B as BaseSourcePoller } from './base-poller-
|
|
7
|
-
export { I as IngestTarget, a as PollerMemoryConfig, i as isIngestTarget } from './base-poller-
|
|
8
|
-
import { S as SyncPush, R as RowDelta, T as TableSchema } from './types-
|
|
9
|
-
export { C as ColumnDelta, D as DeltaOp,
|
|
10
|
-
import { C as ConflictResolver } from './resolver-
|
|
11
|
-
export { C as ConnectorCategory, a as ConnectorDescriptor, g as getConnectorDescriptor, l as listConnectorDescriptors, r as registerConnectorDescriptor,
|
|
12
|
-
import { C as ConnectorConfig } from './types-
|
|
13
|
-
export { B as BigQueryConnectorConfig, a as CONNECTOR_TYPES, b as ConnectorIngestConfig, c as ConnectorIngestTable, d as ConnectorType, J as JiraConnectorConfig, M as MySQLConnectorConfig, P as PostgresConnectorConfig, S as SalesforceConnectorConfig } from './types-
|
|
6
|
+
import { P as PushTarget, B as BaseSourcePoller } from './base-poller-Bj9kX9dv.js';
|
|
7
|
+
export { C as ChunkedPusher, F as FlushableTarget, I as IngestTarget, a as PollerMemoryConfig, b as PressureManager, i as isIngestTarget } from './base-poller-Bj9kX9dv.js';
|
|
8
|
+
import { S as SyncPush, R as RowDelta, T as TableSchema } from './types-BdGBv2ba.js';
|
|
9
|
+
export { C as COLUMN_TYPES, a as ColumnDelta, b as ColumnReference, c as ColumnType, D as DeltaOp, d as RowKey, e as SyncPull, f as SyncResponse, r as rowKey } from './types-BdGBv2ba.js';
|
|
10
|
+
import { C as ConflictResolver } from './resolver-CXxmC0jR.js';
|
|
11
|
+
export { C as ConnectorCategory, a as ConnectorDescriptor, b as ConnectorRegistry, c as createConnectorRegistry, g as getConnectorDescriptor, l as listConnectorDescriptors, r as registerConnectorDescriptor, d as registerOutputSchemas } from './registry-BcspAtZI.js';
|
|
12
|
+
import { C as ConnectorConfig } from './types-BrcD1oJg.js';
|
|
13
|
+
export { B as BigQueryConnectorConfig, a as CONNECTOR_TYPES, b as ConnectorIngestConfig, c as ConnectorIngestTable, d as ConnectorType, J as JiraConnectorConfig, M as MySQLConnectorConfig, P as PostgresConnectorConfig, S as SalesforceConnectorConfig } from './types-BrcD1oJg.js';
|
|
14
14
|
export { H as HLC } from './hlc-DiD8QNG3.js';
|
|
15
15
|
export { b as bigintReplacer, a as bigintReviver } from './json-dYtqiL0F.js';
|
|
16
16
|
|
|
@@ -104,6 +104,17 @@ declare function validateConnectorConfig(input: unknown): Result<ConnectorConfig
|
|
|
104
104
|
|
|
105
105
|
/** Factory function that creates a poller from a ConnectorConfig. */
|
|
106
106
|
type PollerFactory = (config: ConnectorConfig, gateway: PushTarget) => BaseSourcePoller;
|
|
107
|
+
/** Immutable registry of poller factories keyed by connector type. */
|
|
108
|
+
interface PollerRegistry {
|
|
109
|
+
/** Look up a factory by type. */
|
|
110
|
+
get(type: string): PollerFactory | undefined;
|
|
111
|
+
/** Create a new registry with an additional or replaced factory. */
|
|
112
|
+
with(type: string, factory: PollerFactory): PollerRegistry;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Create an immutable {@link PollerRegistry} from a Map of factories.
|
|
116
|
+
*/
|
|
117
|
+
declare function createPollerRegistry(factories?: Map<string, PollerFactory>): PollerRegistry;
|
|
107
118
|
/**
|
|
108
119
|
* Register a poller factory for a connector type.
|
|
109
120
|
* Connector packages call this at module load time so that
|
|
@@ -113,9 +124,12 @@ declare function registerPollerFactory(type: string, factory: PollerFactory): vo
|
|
|
113
124
|
/**
|
|
114
125
|
* Create a poller from a {@link ConnectorConfig}.
|
|
115
126
|
*
|
|
127
|
+
* @param config - Connector configuration.
|
|
128
|
+
* @param gateway - Push target for the poller.
|
|
129
|
+
* @param registry - Optional explicit registry. Defaults to the global registry.
|
|
116
130
|
* @throws If no factory has been registered for the config's `type`.
|
|
117
131
|
*/
|
|
118
|
-
declare function createPoller(config: ConnectorConfig, gateway: PushTarget): BaseSourcePoller;
|
|
132
|
+
declare function createPoller(config: ConnectorConfig, gateway: PushTarget, registry?: PollerRegistry): BaseSourcePoller;
|
|
119
133
|
|
|
120
134
|
/**
|
|
121
135
|
* Apply a delta to an existing row, returning the merged result.
|
|
@@ -153,6 +167,27 @@ declare function extractDelta(before: Record<string, unknown> | null | undefined
|
|
|
153
167
|
schema?: TableSchema;
|
|
154
168
|
}): Promise<RowDelta | null>;
|
|
155
169
|
|
|
170
|
+
/**
|
|
171
|
+
* Manages the start/stop lifecycle and timer scheduling for a poll function.
|
|
172
|
+
* Has no knowledge of deltas, gateways, or sync protocol.
|
|
173
|
+
*/
|
|
174
|
+
declare class PollingScheduler {
|
|
175
|
+
private readonly pollFn;
|
|
176
|
+
private readonly intervalMs;
|
|
177
|
+
private timer;
|
|
178
|
+
private running;
|
|
179
|
+
constructor(pollFn: () => Promise<void>, intervalMs: number);
|
|
180
|
+
/** Start the polling loop. No-op if already running. */
|
|
181
|
+
start(): void;
|
|
182
|
+
/** Stop the polling loop. */
|
|
183
|
+
stop(): void;
|
|
184
|
+
/** Whether the scheduler is currently running. */
|
|
185
|
+
get isRunning(): boolean;
|
|
186
|
+
/** Execute a single poll cycle without the timer loop. */
|
|
187
|
+
pollOnce(): Promise<void>;
|
|
188
|
+
private schedule;
|
|
189
|
+
}
|
|
190
|
+
|
|
156
191
|
/**
|
|
157
192
|
* Create a pass-all sync rules configuration.
|
|
158
193
|
*
|
|
@@ -270,4 +305,4 @@ declare function assertValidIdentifier(name: string): Result<void, SchemaError>;
|
|
|
270
305
|
*/
|
|
271
306
|
declare function quoteIdentifier(name: string): string;
|
|
272
307
|
|
|
273
|
-
export { Action, ActionValidationError, BaseSourcePoller, BucketDefinition, CallbackPushTarget, ConflictError, ConflictResolver, ConnectorConfig, ConnectorValidationError, HLCTimestamp, LWWResolver, LakeSyncError, type PollerFactory, PushTarget, ResolvedClaims, Result, RowDelta, SchemaError, SyncPush, SyncRuleError, SyncRulesConfig, SyncRulesContext, TableSchema, applyDelta, assertValidIdentifier, createPassAllRules, createPoller, createUserScopedRules, deltaMatchesBucket, extractDelta, filterDeltas, generateActionId, isValidIdentifier, quoteIdentifier, registerPollerFactory, resolveClientBuckets, resolveFilterValue, resolveLWW, validateAction, validateConnectorConfig, validateSyncRules };
|
|
308
|
+
export { Action, ActionValidationError, BaseSourcePoller, BucketDefinition, CallbackPushTarget, ConflictError, ConflictResolver, ConnectorConfig, ConnectorValidationError, HLCTimestamp, LWWResolver, LakeSyncError, type PollerFactory, type PollerRegistry, PollingScheduler, PushTarget, ResolvedClaims, Result, RowDelta, SchemaError, SyncPush, SyncRuleError, SyncRulesConfig, SyncRulesContext, TableSchema, applyDelta, assertValidIdentifier, createPassAllRules, createPoller, createPollerRegistry, createUserScopedRules, deltaMatchesBucket, extractDelta, filterDeltas, generateActionId, isValidIdentifier, quoteIdentifier, registerPollerFactory, resolveClientBuckets, resolveFilterValue, resolveLWW, validateAction, validateConnectorConfig, validateSyncRules };
|
package/dist/index.js
CHANGED
|
@@ -7,8 +7,10 @@ import {
|
|
|
7
7
|
AuthError,
|
|
8
8
|
BackpressureError,
|
|
9
9
|
BaseSourcePoller,
|
|
10
|
+
COLUMN_TYPES,
|
|
10
11
|
CONNECTOR_TYPES,
|
|
11
12
|
CallbackPushTarget,
|
|
13
|
+
ChunkedPusher,
|
|
12
14
|
ClockDriftError,
|
|
13
15
|
ConflictError,
|
|
14
16
|
ConnectorValidationError,
|
|
@@ -18,14 +20,18 @@ import {
|
|
|
18
20
|
LWWResolver,
|
|
19
21
|
LakeSyncError,
|
|
20
22
|
Ok,
|
|
23
|
+
PollingScheduler,
|
|
24
|
+
PressureManager,
|
|
21
25
|
SchemaError,
|
|
22
26
|
SyncRuleError,
|
|
23
27
|
applyDelta,
|
|
24
28
|
assertValidIdentifier,
|
|
25
29
|
bigintReplacer,
|
|
26
30
|
bigintReviver,
|
|
31
|
+
createConnectorRegistry,
|
|
27
32
|
createPassAllRules,
|
|
28
33
|
createPoller,
|
|
34
|
+
createPollerRegistry,
|
|
29
35
|
createUserScopedRules,
|
|
30
36
|
deltaMatchesBucket,
|
|
31
37
|
extractDelta,
|
|
@@ -54,8 +60,8 @@ import {
|
|
|
54
60
|
validateConnectorConfig,
|
|
55
61
|
validateSyncRules,
|
|
56
62
|
verifyToken
|
|
57
|
-
} from "./chunk-
|
|
58
|
-
import "./chunk-
|
|
63
|
+
} from "./chunk-LDFFCG2K.js";
|
|
64
|
+
import "./chunk-DGUM43GV.js";
|
|
59
65
|
export {
|
|
60
66
|
ActionExecutionError,
|
|
61
67
|
ActionNotSupportedError,
|
|
@@ -65,8 +71,10 @@ export {
|
|
|
65
71
|
AuthError,
|
|
66
72
|
BackpressureError,
|
|
67
73
|
BaseSourcePoller,
|
|
74
|
+
COLUMN_TYPES,
|
|
68
75
|
CONNECTOR_TYPES,
|
|
69
76
|
CallbackPushTarget,
|
|
77
|
+
ChunkedPusher,
|
|
70
78
|
ClockDriftError,
|
|
71
79
|
ConflictError,
|
|
72
80
|
ConnectorValidationError,
|
|
@@ -76,14 +84,18 @@ export {
|
|
|
76
84
|
LWWResolver,
|
|
77
85
|
LakeSyncError,
|
|
78
86
|
Ok,
|
|
87
|
+
PollingScheduler,
|
|
88
|
+
PressureManager,
|
|
79
89
|
SchemaError,
|
|
80
90
|
SyncRuleError,
|
|
81
91
|
applyDelta,
|
|
82
92
|
assertValidIdentifier,
|
|
83
93
|
bigintReplacer,
|
|
84
94
|
bigintReviver,
|
|
95
|
+
createConnectorRegistry,
|
|
85
96
|
createPassAllRules,
|
|
86
97
|
createPoller,
|
|
98
|
+
createPollerRegistry,
|
|
87
99
|
createUserScopedRules,
|
|
88
100
|
deltaMatchesBucket,
|
|
89
101
|
extractDelta,
|
package/dist/parquet.d.ts
CHANGED
package/dist/parquet.js
CHANGED
|
@@ -3,9 +3,9 @@ import {
|
|
|
3
3
|
deltasToArrowTable,
|
|
4
4
|
readParquetToDeltas,
|
|
5
5
|
writeDeltasToParquet
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-SSICS5KI.js";
|
|
7
|
+
import "./chunk-LDFFCG2K.js";
|
|
8
|
+
import "./chunk-DGUM43GV.js";
|
|
9
9
|
export {
|
|
10
10
|
buildArrowSchema,
|
|
11
11
|
deltasToArrowTable,
|
package/dist/proto.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { H as HLCTimestamp, R as Result } from './result-CojzlFE2.js';
|
|
2
2
|
import { i as ActionPush$1, j as ActionResponse$1 } from './types-Bs-QyOe-.js';
|
|
3
|
-
import { R as RowDelta$1 } from './types-
|
|
3
|
+
import { R as RowDelta$1 } from './types-BdGBv2ba.js';
|
|
4
4
|
import { GenMessage, GenEnum } from '@bufbuild/protobuf/codegenv2';
|
|
5
5
|
import { Message } from '@bufbuild/protobuf';
|
|
6
6
|
|
package/dist/proto.js
CHANGED
|
@@ -29,9 +29,9 @@ import {
|
|
|
29
29
|
encodeSyncPull,
|
|
30
30
|
encodeSyncPush,
|
|
31
31
|
encodeSyncResponse
|
|
32
|
-
} from "./chunk-
|
|
33
|
-
import "./chunk-
|
|
34
|
-
import "./chunk-
|
|
32
|
+
} from "./chunk-KVSWLIJR.js";
|
|
33
|
+
import "./chunk-LDFFCG2K.js";
|
|
34
|
+
import "./chunk-DGUM43GV.js";
|
|
35
35
|
export {
|
|
36
36
|
ActionPushSchema,
|
|
37
37
|
ActionResponseSchema,
|
package/dist/react.d.ts
CHANGED
|
@@ -1,21 +1,30 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { b as SyncCoordinator,
|
|
2
|
+
import { b as SyncCoordinator, k as SyncTracker, D as DbError } from './coordinator-NXy6tA0h.js';
|
|
3
3
|
import { L as LakeSyncError, R as Result } from './result-CojzlFE2.js';
|
|
4
4
|
import { c as ActionDescriptor, k as ActionResult, e as ActionErrorResult } from './types-Bs-QyOe-.js';
|
|
5
|
-
import { a as ConnectorDescriptor } from './registry-
|
|
5
|
+
import { a as ConnectorDescriptor } from './registry-BcspAtZI.js';
|
|
6
6
|
import './hlc-DiD8QNG3.js';
|
|
7
|
-
import './types-
|
|
8
|
-
import './types-
|
|
7
|
+
import './types-BdGBv2ba.js';
|
|
8
|
+
import './types-BrcD1oJg.js';
|
|
9
9
|
|
|
10
|
-
/**
|
|
11
|
-
interface
|
|
10
|
+
/** Stable context value — coordinator and tracker references that never change. */
|
|
11
|
+
interface LakeSyncStableContextValue {
|
|
12
12
|
coordinator: SyncCoordinator;
|
|
13
13
|
tracker: SyncTracker;
|
|
14
|
+
}
|
|
15
|
+
/** Reactive context value — data version that changes on every delta. */
|
|
16
|
+
interface LakeSyncDataContextValue {
|
|
14
17
|
/** Monotonically increasing counter — bumped on every data change. */
|
|
15
18
|
dataVersion: number;
|
|
16
19
|
/** Increment dataVersion to trigger query re-runs. */
|
|
17
20
|
invalidate: () => void;
|
|
18
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* Combined context value for backwards compatibility.
|
|
24
|
+
* @see useLakeSync
|
|
25
|
+
*/
|
|
26
|
+
interface LakeSyncContextValue extends LakeSyncStableContextValue, LakeSyncDataContextValue {
|
|
27
|
+
}
|
|
19
28
|
/** Props for the LakeSyncProvider component. */
|
|
20
29
|
interface LakeSyncProviderProps {
|
|
21
30
|
/** An already-constructed SyncCoordinator instance. */
|
|
@@ -28,11 +37,32 @@ interface LakeSyncProviderProps {
|
|
|
28
37
|
* Subscribes to `onChange` events from the coordinator and maintains a
|
|
29
38
|
* `dataVersion` counter that increments on every remote delta application,
|
|
30
39
|
* triggering reactive query re-runs in `useQuery`.
|
|
40
|
+
*
|
|
41
|
+
* Uses a split context pattern: stable refs (coordinator, tracker) are
|
|
42
|
+
* provided separately from reactive data (dataVersion) so that hooks
|
|
43
|
+
* like `useSyncStatus` and `useAction` do not re-render on data changes.
|
|
44
|
+
*/
|
|
45
|
+
declare function LakeSyncProvider(props: LakeSyncProviderProps): react.FunctionComponentElement<react.ProviderProps<LakeSyncStableContextValue | null>>;
|
|
46
|
+
/**
|
|
47
|
+
* Access the stable LakeSync SDK instances from context.
|
|
48
|
+
*
|
|
49
|
+
* This hook does NOT cause re-renders when dataVersion changes.
|
|
50
|
+
* Use {@link useLakeSyncData} for reactive data.
|
|
51
|
+
*
|
|
52
|
+
* @throws if called outside a `<LakeSyncProvider>`.
|
|
53
|
+
*/
|
|
54
|
+
declare function useLakeSyncStable(): LakeSyncStableContextValue;
|
|
55
|
+
/**
|
|
56
|
+
* Access reactive data (dataVersion, invalidate) from context.
|
|
57
|
+
*
|
|
58
|
+
* @throws if called outside a `<LakeSyncProvider>`.
|
|
31
59
|
*/
|
|
32
|
-
declare function
|
|
60
|
+
declare function useLakeSyncData(): LakeSyncDataContextValue;
|
|
33
61
|
/**
|
|
34
62
|
* Access the raw LakeSync SDK instances from context.
|
|
35
63
|
*
|
|
64
|
+
* Returns both stable and reactive values for backwards compatibility.
|
|
65
|
+
*
|
|
36
66
|
* @throws if called outside a `<LakeSyncProvider>`.
|
|
37
67
|
*/
|
|
38
68
|
declare function useLakeSync(): LakeSyncContextValue;
|
|
@@ -59,6 +89,12 @@ interface UseActionResult {
|
|
|
59
89
|
* Wraps `SyncCoordinator.executeAction()` and subscribes to
|
|
60
90
|
* `onActionComplete` events to track the latest result.
|
|
61
91
|
*
|
|
92
|
+
* Uses a `pendingRef` to track whether we are waiting for a completion.
|
|
93
|
+
* When `execute()` is called, we set the ref to `true` so the next
|
|
94
|
+
* `onActionComplete` event is captured. This avoids the identity bug
|
|
95
|
+
* where a stale action completion from a different hook instance would
|
|
96
|
+
* overwrite state.
|
|
97
|
+
*
|
|
62
98
|
* ```ts
|
|
63
99
|
* const { execute, lastResult, isPending } = useAction();
|
|
64
100
|
*
|
|
@@ -168,9 +204,10 @@ interface UseSyncStatusResult {
|
|
|
168
204
|
/**
|
|
169
205
|
* Observe the sync lifecycle.
|
|
170
206
|
*
|
|
171
|
-
*
|
|
172
|
-
*
|
|
207
|
+
* Reads `coordinator.state` directly for sync status and subscribes to
|
|
208
|
+
* events only for invalidation (re-reading the state snapshot).
|
|
209
|
+
* Uses the stable context so it does not re-render on data version changes.
|
|
173
210
|
*/
|
|
174
211
|
declare function useSyncStatus(): UseSyncStatusResult;
|
|
175
212
|
|
|
176
|
-
export { type ActionParams, type LakeSyncContextValue, LakeSyncProvider, type LakeSyncProviderProps, type UseActionDiscoveryResult, type UseActionResult, type UseConnectorTypesResult, type UseMutationResult, type UseQueryResult, type UseSyncStatusResult, useAction, useActionDiscovery, useConnectorTypes, useLakeSync, useMutation, useQuery, useSyncStatus };
|
|
213
|
+
export { type ActionParams, type LakeSyncContextValue, type LakeSyncDataContextValue, LakeSyncProvider, type LakeSyncProviderProps, type LakeSyncStableContextValue, type UseActionDiscoveryResult, type UseActionResult, type UseConnectorTypesResult, type UseMutationResult, type UseQueryResult, type UseSyncStatusResult, useAction, useActionDiscovery, useConnectorTypes, useLakeSync, useLakeSyncData, useLakeSyncStable, useMutation, useQuery, useSyncStatus };
|