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
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { R as RowDelta, T as TableSchema } from './types-BdGBv2ba.js';
|
|
2
|
+
import { R as Result, A as AdapterError, H as HLCTimestamp } from './result-CojzlFE2.js';
|
|
3
|
+
|
|
4
|
+
/** Information about an object in the lake store. */
|
|
5
|
+
interface ObjectInfo {
|
|
6
|
+
/** S3 object key */
|
|
7
|
+
key: string;
|
|
8
|
+
/** Object size in bytes */
|
|
9
|
+
size: number;
|
|
10
|
+
/** Last modification date */
|
|
11
|
+
lastModified: Date;
|
|
12
|
+
}
|
|
13
|
+
/** Abstract interface for lake storage operations. */
|
|
14
|
+
interface LakeAdapter {
|
|
15
|
+
/** Store an object in the lake. */
|
|
16
|
+
putObject(path: string, data: Uint8Array, contentType?: string): Promise<Result<void, AdapterError>>;
|
|
17
|
+
/** Retrieve an object from the lake. */
|
|
18
|
+
getObject(path: string): Promise<Result<Uint8Array, AdapterError>>;
|
|
19
|
+
/** Get object metadata without retrieving the body. */
|
|
20
|
+
headObject(path: string): Promise<Result<{
|
|
21
|
+
size: number;
|
|
22
|
+
lastModified: Date;
|
|
23
|
+
}, AdapterError>>;
|
|
24
|
+
/** List objects matching a given prefix. */
|
|
25
|
+
listObjects(prefix: string): Promise<Result<ObjectInfo[], AdapterError>>;
|
|
26
|
+
/** Delete a single object from the lake. */
|
|
27
|
+
deleteObject(path: string): Promise<Result<void, AdapterError>>;
|
|
28
|
+
/** Delete multiple objects from the lake in a single batch operation. */
|
|
29
|
+
deleteObjects(paths: string[]): Promise<Result<void, AdapterError>>;
|
|
30
|
+
}
|
|
31
|
+
/** Configuration for a database adapter connection. */
|
|
32
|
+
interface DatabaseAdapterConfig {
|
|
33
|
+
/** Connection string (e.g. postgres://user:pass@host/db) */
|
|
34
|
+
connectionString: string;
|
|
35
|
+
/** Maximum number of connections in the pool (default: 10). */
|
|
36
|
+
poolMax?: number;
|
|
37
|
+
/** Connection idle timeout in milliseconds (default: 10000). */
|
|
38
|
+
idleTimeoutMs?: number;
|
|
39
|
+
/** Connection acquisition timeout in milliseconds (default: 30000). */
|
|
40
|
+
connectionTimeoutMs?: number;
|
|
41
|
+
/** Statement timeout in milliseconds (default: 30000). */
|
|
42
|
+
statementTimeoutMs?: number;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Abstract interface for SQL database storage operations.
|
|
46
|
+
* Alternative to LakeAdapter for small-data backends (Postgres, MySQL, etc).
|
|
47
|
+
*/
|
|
48
|
+
interface DatabaseAdapter {
|
|
49
|
+
/** Insert deltas into the database in a single batch. Idempotent via deltaId uniqueness. */
|
|
50
|
+
insertDeltas(deltas: RowDelta[]): Promise<Result<void, AdapterError>>;
|
|
51
|
+
/** Query deltas with HLC greater than the given timestamp, optionally filtered by table. */
|
|
52
|
+
queryDeltasSince(hlc: HLCTimestamp, tables?: string[]): Promise<Result<RowDelta[], AdapterError>>;
|
|
53
|
+
/** Get the latest merged state for a specific row. Returns null if the row doesn't exist. */
|
|
54
|
+
getLatestState(table: string, rowId: string): Promise<Result<Record<string, unknown> | null, AdapterError>>;
|
|
55
|
+
/** Ensure the database schema matches the given TableSchema. Creates/alters tables as needed. */
|
|
56
|
+
ensureSchema(schema: TableSchema): Promise<Result<void, AdapterError>>;
|
|
57
|
+
/** Close the database connection and release resources. */
|
|
58
|
+
close(): Promise<void>;
|
|
59
|
+
}
|
|
60
|
+
/** Type guard to distinguish DatabaseAdapter from LakeAdapter at runtime. */
|
|
61
|
+
declare function isDatabaseAdapter(adapter: unknown): adapter is DatabaseAdapter;
|
|
62
|
+
/**
|
|
63
|
+
* Opt-in capability for adapters that can materialise deltas into destination tables.
|
|
64
|
+
*
|
|
65
|
+
* Materialisation is a separate concern from delta storage — adapters that store
|
|
66
|
+
* deltas (via `DatabaseAdapter.insertDeltas`) may also materialise them into
|
|
67
|
+
* queryable destination tables by implementing this interface.
|
|
68
|
+
*
|
|
69
|
+
* Destination tables follow the hybrid column model:
|
|
70
|
+
* - Synced columns (written by materialiser, derived from `TableSchema.columns`)
|
|
71
|
+
* - `props JSONB DEFAULT '{}'` — consumer-extensible, never touched by materialiser
|
|
72
|
+
* - `synced_at` — updated on every materialise cycle
|
|
73
|
+
*/
|
|
74
|
+
interface Materialisable {
|
|
75
|
+
/**
|
|
76
|
+
* Materialise deltas into destination tables.
|
|
77
|
+
*
|
|
78
|
+
* For each table with a matching schema, merges delta history into the
|
|
79
|
+
* latest row state and upserts into the destination table. Tombstoned
|
|
80
|
+
* rows are deleted. The `props` column is never touched.
|
|
81
|
+
*
|
|
82
|
+
* @param deltas - The deltas that were just flushed.
|
|
83
|
+
* @param schemas - Table schemas defining destination tables and column mappings.
|
|
84
|
+
*/
|
|
85
|
+
materialise(deltas: RowDelta[], schemas: ReadonlyArray<TableSchema>): Promise<Result<void, AdapterError>>;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Type guard to check if an adapter supports materialisation.
|
|
89
|
+
*
|
|
90
|
+
* Uses duck-typing (same pattern as `isDatabaseAdapter`).
|
|
91
|
+
*/
|
|
92
|
+
declare function isMaterialisable(adapter: unknown): adapter is Materialisable;
|
|
93
|
+
|
|
94
|
+
export { type DatabaseAdapter as D, type LakeAdapter as L, type Materialisable as M, type ObjectInfo as O, type DatabaseAdapterConfig as a, isMaterialisable as b, isDatabaseAdapter as i };
|
package/dist/adapter.d.ts
CHANGED
|
@@ -1,44 +1,15 @@
|
|
|
1
1
|
import { BigQuery } from '@google-cloud/bigquery';
|
|
2
2
|
import { R as Result, A as AdapterError, H as HLCTimestamp } from './result-CojzlFE2.js';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import { L as LakeAdapter, A as AdapterConfig, O as ObjectInfo } from './types-DSC_EiwR.js';
|
|
3
|
+
import { D as DatabaseAdapter, M as Materialisable, L as LakeAdapter, O as ObjectInfo, a as DatabaseAdapterConfig } from './adapter-types-DwsQGQS4.js';
|
|
4
|
+
export { i as isDatabaseAdapter, b as isMaterialisable } from './adapter-types-DwsQGQS4.js';
|
|
5
|
+
import { T as TableSchema, a as ColumnDelta, R as RowDelta } from './types-BdGBv2ba.js';
|
|
6
|
+
export { A as AdapterFactory, a as AdapterFactoryRegistry, c as createAdapterFactoryRegistry, b as createDatabaseAdapter, d as defaultAdapterFactoryRegistry } from './factory-DFfR-030.js';
|
|
8
7
|
import mysql from 'mysql2/promise';
|
|
9
8
|
import { Pool } from 'pg';
|
|
9
|
+
import { C as ConnectorConfig } from './types-D2C9jTbL.js';
|
|
10
|
+
|
|
11
|
+
declare function lakeSyncTypeToBigQuery(type: TableSchema["columns"][number]["type"]): string;
|
|
10
12
|
|
|
11
|
-
/**
|
|
12
|
-
* Opt-in capability for adapters that can materialise deltas into destination tables.
|
|
13
|
-
*
|
|
14
|
-
* Materialisation is a separate concern from delta storage — adapters that store
|
|
15
|
-
* deltas (via `DatabaseAdapter.insertDeltas`) may also materialise them into
|
|
16
|
-
* queryable destination tables by implementing this interface.
|
|
17
|
-
*
|
|
18
|
-
* Destination tables follow the hybrid column model:
|
|
19
|
-
* - Synced columns (written by materialiser, derived from `TableSchema.columns`)
|
|
20
|
-
* - `props JSONB DEFAULT '{}'` — consumer-extensible, never touched by materialiser
|
|
21
|
-
* - `synced_at` — updated on every materialise cycle
|
|
22
|
-
*/
|
|
23
|
-
interface Materialisable {
|
|
24
|
-
/**
|
|
25
|
-
* Materialise deltas into destination tables.
|
|
26
|
-
*
|
|
27
|
-
* For each table with a matching schema, merges delta history into the
|
|
28
|
-
* latest row state and upserts into the destination table. Tombstoned
|
|
29
|
-
* rows are deleted. The `props` column is never touched.
|
|
30
|
-
*
|
|
31
|
-
* @param deltas - The deltas that were just flushed.
|
|
32
|
-
* @param schemas - Table schemas defining destination tables and column mappings.
|
|
33
|
-
*/
|
|
34
|
-
materialise(deltas: RowDelta[], schemas: ReadonlyArray<TableSchema>): Promise<Result<void, AdapterError>>;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Type guard to check if an adapter supports materialisation.
|
|
38
|
-
*
|
|
39
|
-
* Uses duck-typing (same pattern as `isDatabaseAdapter`).
|
|
40
|
-
*/
|
|
41
|
-
declare function isMaterialisable(adapter: unknown): adapter is Materialisable;
|
|
42
13
|
/**
|
|
43
14
|
* Resolve the primary key columns for a table schema.
|
|
44
15
|
* Defaults to `["row_id"]` when not explicitly set.
|
|
@@ -258,18 +229,6 @@ declare class CompositeAdapter implements DatabaseAdapter {
|
|
|
258
229
|
close(): Promise<void>;
|
|
259
230
|
}
|
|
260
231
|
|
|
261
|
-
/**
|
|
262
|
-
* Instantiate a {@link DatabaseAdapter} from a {@link ConnectorConfig}.
|
|
263
|
-
*
|
|
264
|
-
* Switches on `config.type` and creates the matching adapter using
|
|
265
|
-
* the type-specific connection configuration. Returns an {@link AdapterError}
|
|
266
|
-
* if the type is unsupported or the adapter constructor throws.
|
|
267
|
-
*
|
|
268
|
-
* @param config - Validated connector configuration.
|
|
269
|
-
* @returns The instantiated adapter or an error.
|
|
270
|
-
*/
|
|
271
|
-
declare function createDatabaseAdapter(config: ConnectorConfig): Result<DatabaseAdapter, AdapterError>;
|
|
272
|
-
|
|
273
232
|
/** Configuration for the FanOutAdapter. */
|
|
274
233
|
interface FanOutAdapterConfig {
|
|
275
234
|
/** The primary adapter that handles all reads and authoritative writes. */
|
|
@@ -413,6 +372,21 @@ interface MigrateResult {
|
|
|
413
372
|
*/
|
|
414
373
|
declare function migrateAdapter(opts: MigrateOptions): Promise<Result<MigrateResult, AdapterError>>;
|
|
415
374
|
|
|
375
|
+
/** Configuration for connecting to the lake store */
|
|
376
|
+
interface AdapterConfig {
|
|
377
|
+
/** Endpoint URL (e.g. http://localhost:9000) */
|
|
378
|
+
endpoint: string;
|
|
379
|
+
/** Bucket name */
|
|
380
|
+
bucket: string;
|
|
381
|
+
/** AWS region (defaults to us-east-1) */
|
|
382
|
+
region?: string;
|
|
383
|
+
/** Access credentials */
|
|
384
|
+
credentials: {
|
|
385
|
+
accessKeyId: string;
|
|
386
|
+
secretAccessKey: string;
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
|
|
416
390
|
/**
|
|
417
391
|
* MinIO/S3-compatible lake adapter.
|
|
418
392
|
*
|
|
@@ -624,4 +598,4 @@ declare function mergeLatestState(rows: Array<{
|
|
|
624
598
|
op: string;
|
|
625
599
|
}>): Record<string, unknown> | null;
|
|
626
600
|
|
|
627
|
-
export { AdapterConfig, BigQueryAdapter, type BigQueryAdapterConfig, BigQuerySqlDialect, CompositeAdapter, type CompositeAdapterConfig, type CompositeRoute, DatabaseAdapter, DatabaseAdapterConfig, FanOutAdapter, type FanOutAdapterConfig, LakeAdapter, LifecycleAdapter, type LifecycleAdapterConfig,
|
|
601
|
+
export { type AdapterConfig, BigQueryAdapter, type BigQueryAdapterConfig, BigQuerySqlDialect, CompositeAdapter, type CompositeAdapterConfig, type CompositeRoute, DatabaseAdapter, DatabaseAdapterConfig, FanOutAdapter, type FanOutAdapterConfig, LakeAdapter, LifecycleAdapter, type LifecycleAdapterConfig, Materialisable, type MigrateOptions, type MigrateProgress, type MigrateResult, MinIOAdapter, MySQLAdapter, MySqlDialect, ObjectInfo, PostgresAdapter, PostgresSqlDialect, type QueryExecutor, type QueryFn, type SqlDialect, buildSchemaIndex, createQueryFn, executeMaterialise, groupAndMerge, groupDeltasByTable, isSoftDelete, lakeSyncTypeToBigQuery, mergeLatestState, migrateAdapter, migrateToTier, resolveConflictColumns, resolvePrimaryKey, toCause, wrapAsync };
|
package/dist/adapter.js
CHANGED
|
@@ -10,13 +10,13 @@ import {
|
|
|
10
10
|
PostgresAdapter,
|
|
11
11
|
PostgresSqlDialect,
|
|
12
12
|
buildSchemaIndex,
|
|
13
|
+
createAdapterFactoryRegistry,
|
|
13
14
|
createDatabaseAdapter,
|
|
14
15
|
createQueryFn,
|
|
16
|
+
defaultAdapterFactoryRegistry,
|
|
15
17
|
executeMaterialise,
|
|
16
18
|
groupAndMerge,
|
|
17
19
|
groupDeltasByTable,
|
|
18
|
-
isDatabaseAdapter,
|
|
19
|
-
isMaterialisable,
|
|
20
20
|
isSoftDelete,
|
|
21
21
|
lakeSyncTypeToBigQuery,
|
|
22
22
|
mergeLatestState,
|
|
@@ -26,8 +26,11 @@ import {
|
|
|
26
26
|
resolvePrimaryKey,
|
|
27
27
|
toCause,
|
|
28
28
|
wrapAsync
|
|
29
|
-
} from "./chunk-
|
|
30
|
-
import
|
|
29
|
+
} from "./chunk-C4KD6YKP.js";
|
|
30
|
+
import {
|
|
31
|
+
isDatabaseAdapter,
|
|
32
|
+
isMaterialisable
|
|
33
|
+
} from "./chunk-4SG66H5K.js";
|
|
31
34
|
import "./chunk-DGUM43GV.js";
|
|
32
35
|
export {
|
|
33
36
|
BigQueryAdapter,
|
|
@@ -41,8 +44,10 @@ export {
|
|
|
41
44
|
PostgresAdapter,
|
|
42
45
|
PostgresSqlDialect,
|
|
43
46
|
buildSchemaIndex,
|
|
47
|
+
createAdapterFactoryRegistry,
|
|
44
48
|
createDatabaseAdapter,
|
|
45
49
|
createQueryFn,
|
|
50
|
+
defaultAdapterFactoryRegistry,
|
|
46
51
|
executeMaterialise,
|
|
47
52
|
groupAndMerge,
|
|
48
53
|
groupDeltasByTable,
|
package/dist/analyst.js
CHANGED
|
@@ -111,6 +111,8 @@ declare abstract class BaseSourcePoller {
|
|
|
111
111
|
protected readonly clientId: string;
|
|
112
112
|
private readonly scheduler;
|
|
113
113
|
private readonly pusher;
|
|
114
|
+
/** Optional callback invoked after each poll with the current cursor state. */
|
|
115
|
+
onCursorUpdate?: (state: Record<string, unknown>) => void;
|
|
114
116
|
constructor(config: {
|
|
115
117
|
name: string;
|
|
116
118
|
intervalMs: number;
|
package/dist/catalogue.js
CHANGED
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
buildPartitionSpec,
|
|
5
5
|
lakeSyncTableName,
|
|
6
6
|
tableSchemaToIceberg
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-U2NV4DUX.js";
|
|
8
|
+
import "./chunk-4SG66H5K.js";
|
|
9
9
|
import "./chunk-DGUM43GV.js";
|
|
10
10
|
export {
|
|
11
11
|
CatalogueError,
|
|
@@ -156,6 +156,14 @@ function validateAction(action) {
|
|
|
156
156
|
return Ok(action);
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
+
// ../core/src/adapter-types.ts
|
|
160
|
+
function isDatabaseAdapter(adapter) {
|
|
161
|
+
return adapter !== null && typeof adapter === "object" && "insertDeltas" in adapter && "queryDeltasSince" in adapter && typeof adapter.insertDeltas === "function";
|
|
162
|
+
}
|
|
163
|
+
function isMaterialisable(adapter) {
|
|
164
|
+
return adapter !== null && typeof adapter === "object" && "materialise" in adapter && typeof adapter.materialise === "function";
|
|
165
|
+
}
|
|
166
|
+
|
|
159
167
|
// ../core/src/auth.ts
|
|
160
168
|
var AuthError = class extends Error {
|
|
161
169
|
constructor(message) {
|
|
@@ -536,6 +544,8 @@ var BaseSourcePoller = class {
|
|
|
536
544
|
clientId;
|
|
537
545
|
scheduler;
|
|
538
546
|
pusher;
|
|
547
|
+
/** Optional callback invoked after each poll with the current cursor state. */
|
|
548
|
+
onCursorUpdate;
|
|
539
549
|
constructor(config) {
|
|
540
550
|
this.gateway = config.gateway;
|
|
541
551
|
this.hlc = new HLC();
|
|
@@ -551,7 +561,12 @@ var BaseSourcePoller = class {
|
|
|
551
561
|
chunkSize: config.memory?.chunkSize ?? DEFAULT_CHUNK_SIZE,
|
|
552
562
|
pressure
|
|
553
563
|
});
|
|
554
|
-
this.scheduler = new PollingScheduler(() =>
|
|
564
|
+
this.scheduler = new PollingScheduler(async () => {
|
|
565
|
+
await this.poll();
|
|
566
|
+
if (this.onCursorUpdate) {
|
|
567
|
+
this.onCursorUpdate(this.getCursorState());
|
|
568
|
+
}
|
|
569
|
+
}, config.intervalMs);
|
|
555
570
|
}
|
|
556
571
|
/** Start the polling loop. */
|
|
557
572
|
start() {
|
|
@@ -909,31 +924,32 @@ function validateConnectorConfig(input) {
|
|
|
909
924
|
if (typeof obj.name !== "string" || obj.name.length === 0) {
|
|
910
925
|
return Err(new ConnectorValidationError("Connector name must be a non-empty string"));
|
|
911
926
|
}
|
|
912
|
-
if (typeof obj.type !== "string" ||
|
|
913
|
-
return Err(
|
|
914
|
-
new ConnectorValidationError(`Connector type must be one of: ${CONNECTOR_TYPES.join(", ")}`)
|
|
915
|
-
);
|
|
927
|
+
if (typeof obj.type !== "string" || obj.type.length === 0) {
|
|
928
|
+
return Err(new ConnectorValidationError("Connector type must be a non-empty string"));
|
|
916
929
|
}
|
|
917
930
|
const connectorType = obj.type;
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
931
|
+
if (CONNECTOR_TYPES.includes(connectorType)) {
|
|
932
|
+
const knownType = connectorType;
|
|
933
|
+
let typeResult;
|
|
934
|
+
switch (knownType) {
|
|
935
|
+
case "postgres":
|
|
936
|
+
typeResult = validatePostgresConfig(obj);
|
|
937
|
+
break;
|
|
938
|
+
case "mysql":
|
|
939
|
+
typeResult = validateMySQLConfig(obj);
|
|
940
|
+
break;
|
|
941
|
+
case "bigquery":
|
|
942
|
+
typeResult = validateBigQueryConfig(obj);
|
|
943
|
+
break;
|
|
944
|
+
case "jira":
|
|
945
|
+
typeResult = validateJiraConfig(obj);
|
|
946
|
+
break;
|
|
947
|
+
case "salesforce":
|
|
948
|
+
typeResult = validateSalesforceConfig(obj);
|
|
949
|
+
break;
|
|
950
|
+
}
|
|
951
|
+
if (!typeResult.ok) return typeResult;
|
|
952
|
+
}
|
|
937
953
|
const ingestResult = validateIngestConfig(obj, connectorType);
|
|
938
954
|
if (!ingestResult.ok) return ingestResult;
|
|
939
955
|
return Ok(input);
|
|
@@ -1228,12 +1244,8 @@ function buildPollerRegistry(map) {
|
|
|
1228
1244
|
}
|
|
1229
1245
|
};
|
|
1230
1246
|
}
|
|
1231
|
-
var pollerFactories = /* @__PURE__ */ new Map();
|
|
1232
|
-
function registerPollerFactory(type, factory) {
|
|
1233
|
-
pollerFactories.set(type, factory);
|
|
1234
|
-
}
|
|
1235
1247
|
function createPoller(config, gateway, registry) {
|
|
1236
|
-
const factory = registry
|
|
1248
|
+
const factory = registry.get(config.type);
|
|
1237
1249
|
if (!factory) {
|
|
1238
1250
|
throw new Error(
|
|
1239
1251
|
`No poller factory registered for connector type "${config.type}". Did you import the connector package (e.g. "@lakesync/connector-${config.type}")?`
|
|
@@ -1596,6 +1608,8 @@ export {
|
|
|
1596
1608
|
unwrapOrThrow,
|
|
1597
1609
|
fromPromise,
|
|
1598
1610
|
validateAction,
|
|
1611
|
+
isDatabaseAdapter,
|
|
1612
|
+
isMaterialisable,
|
|
1599
1613
|
AuthError,
|
|
1600
1614
|
verifyToken,
|
|
1601
1615
|
HLC,
|
|
@@ -1617,7 +1631,6 @@ export {
|
|
|
1617
1631
|
CONNECTOR_TYPES,
|
|
1618
1632
|
validateConnectorConfig,
|
|
1619
1633
|
createPollerRegistry,
|
|
1620
|
-
registerPollerFactory,
|
|
1621
1634
|
createPoller,
|
|
1622
1635
|
applyDelta,
|
|
1623
1636
|
extractDelta,
|
|
@@ -1637,4 +1650,4 @@ export {
|
|
|
1637
1650
|
assertValidIdentifier,
|
|
1638
1651
|
quoteIdentifier
|
|
1639
1652
|
};
|
|
1640
|
-
//# sourceMappingURL=chunk-
|
|
1653
|
+
//# sourceMappingURL=chunk-4SG66H5K.js.map
|