@whaly/connector-sdk 0.1.1 → 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/index.d.mts +112 -200
- package/dist/index.d.ts +112 -200
- package/dist/index.js +242 -470
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +241 -466
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,49 +1,90 @@
|
|
|
1
|
-
import winston from 'winston';
|
|
2
1
|
import { AxiosInstance, AxiosRequestHeaders, AxiosResponse, AxiosRequestConfig, AxiosError } from 'axios';
|
|
3
|
-
import moment from 'moment';
|
|
4
2
|
import { Validator, ValidationError } from 'jsonschema';
|
|
3
|
+
import { Dayjs } from 'dayjs';
|
|
5
4
|
import { WriteStream } from 'fs';
|
|
6
5
|
import { BigQuery, Dataset, Table } from '@google-cloud/bigquery';
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
metadata: CatalogStreamMetadata[];
|
|
7
|
+
declare const loadJson: (fileName: string) => any;
|
|
8
|
+
declare const loadSchema: (streamId: string) => any;
|
|
9
|
+
|
|
10
|
+
declare const getAxiosInstance: (retryCount?: number) => AxiosInstance;
|
|
11
|
+
interface GetConfig {
|
|
12
|
+
qs?: {
|
|
13
|
+
[key: string]: any;
|
|
14
|
+
};
|
|
15
|
+
headers?: AxiosRequestHeaders;
|
|
16
|
+
retryCount?: number;
|
|
19
17
|
}
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
declare const getRawJSONApiCall: <T>(endpoint: string, config: GetConfig, privateLogging?: boolean) => Promise<AxiosResponse<T>>;
|
|
19
|
+
declare const getJSONApiCallWithFullResponse: <T>(endpoint: string, config: GetConfig, privateLogging?: boolean) => Promise<AxiosResponse<any, any, {}>>;
|
|
20
|
+
declare const getJSONApiCall: <T>(endpoint: string, config: GetConfig, privateLogging?: boolean) => Promise<T>;
|
|
21
|
+
declare const getDownloadFileApiCall: <T>(endpoint: string, config: GetConfig, output: string, privateLogging?: boolean) => Promise<{
|
|
22
|
+
outputDir: string;
|
|
23
|
+
}>;
|
|
24
|
+
interface PostConfig {
|
|
25
|
+
qs?: {
|
|
26
|
+
[key: string]: any;
|
|
27
|
+
};
|
|
28
|
+
headers?: AxiosRequestHeaders;
|
|
29
|
+
retryCount?: number;
|
|
22
30
|
}
|
|
31
|
+
declare const postJSONApiCall: <T>(endpoint: string, config: PostConfig, payload: any) => Promise<T>;
|
|
32
|
+
declare const postFormDataApiCall: <T>(endpoint: string, config: PostConfig, payload: any) => Promise<T>;
|
|
33
|
+
declare const postUrlEncodedApiCall: (endpoint: string, config: PostConfig, payload: any) => Promise<any>;
|
|
23
34
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
35
|
+
declare const BATCH_INTERVAL_MS = 100;
|
|
36
|
+
declare const logger: {
|
|
37
|
+
info: (message: string | any, ...args: any[]) => void;
|
|
38
|
+
error: (message: string | any, ...args: any[]) => void;
|
|
39
|
+
debug: (message: string | any, ...args: any[]) => void;
|
|
40
|
+
warn: (message: string | any, ...args: any[]) => void;
|
|
41
|
+
closeWinston: (cb: () => void) => void;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
declare const ALL_STREAM_ID_KEYWORD = "all";
|
|
45
|
+
declare const ROWS_SYNCED_METRIC_NAME = "rows_synced_count";
|
|
46
|
+
declare const API_CALLS_METRIC_NAME = "api_calls_count";
|
|
47
|
+
declare const EXECUTION_TIME_METRIC_NAME = "execution_time_ms";
|
|
48
|
+
interface MetricConfiguration {
|
|
49
|
+
isEnabled: () => boolean;
|
|
50
|
+
getStreamIds?: () => string[];
|
|
28
51
|
}
|
|
52
|
+
declare const getCounterMetrics: (name: string, streamIds: string[]) => CounterMetric[];
|
|
53
|
+
declare const getCounterMetric: (name: string, streamId?: string) => CounterMetric;
|
|
54
|
+
declare const getAllMetrics: () => CounterMetric[];
|
|
55
|
+
declare class CounterMetric {
|
|
56
|
+
private value;
|
|
57
|
+
name: string;
|
|
58
|
+
streamId: string;
|
|
59
|
+
constructor(name: string, streamId: string);
|
|
60
|
+
increment(inc?: number): void;
|
|
61
|
+
getStreamId(): string;
|
|
62
|
+
getName(): string;
|
|
63
|
+
getValue(): number;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
declare const printMemoryFootprint: (prefix: string) => void;
|
|
67
|
+
|
|
68
|
+
type ErrorType = "unauthorized" | "unknown";
|
|
69
|
+
|
|
70
|
+
declare const haltAndCatchFire: (errorType: ErrorType, errorText: string, errorDebugText: string) => Promise<void>;
|
|
71
|
+
|
|
72
|
+
declare function gracefulExit(exitCode: number): Promise<void>;
|
|
29
73
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
from: string;
|
|
34
|
-
to: string;
|
|
35
|
-
type: "1-1" | "1-N" | "N-1";
|
|
74
|
+
declare enum ReplicationMethod {
|
|
75
|
+
INCREMENTAL = "INCREMENTAL",
|
|
76
|
+
FULL_TABLE = "FULL_TABLE"
|
|
36
77
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
from: string;
|
|
41
|
-
to: string;
|
|
78
|
+
|
|
79
|
+
interface HTTPHeaders {
|
|
80
|
+
[headerName: string]: any;
|
|
42
81
|
}
|
|
43
|
-
interface
|
|
44
|
-
|
|
45
|
-
right: DirectionalRelationship[];
|
|
82
|
+
interface URLParams {
|
|
83
|
+
[paramName: string]: any;
|
|
46
84
|
}
|
|
85
|
+
type HTTPMethod = "GET" | "POST";
|
|
86
|
+
|
|
87
|
+
type StreamId = string;
|
|
47
88
|
|
|
48
89
|
interface PropertiesMetadata {
|
|
49
90
|
[propName: string]: {
|
|
@@ -93,7 +134,6 @@ declare class SchemaMessage implements Message {
|
|
|
93
134
|
displayLabel: string | undefined;
|
|
94
135
|
description: string | undefined;
|
|
95
136
|
propertiesMetadata: PropertiesMetadata | undefined;
|
|
96
|
-
relationships: DirectionalRelationships;
|
|
97
137
|
constructor(opts: {
|
|
98
138
|
stream: StreamId;
|
|
99
139
|
schema: any;
|
|
@@ -101,7 +141,6 @@ declare class SchemaMessage implements Message {
|
|
|
101
141
|
bookmarkProperties?: string[];
|
|
102
142
|
displayLabel?: string;
|
|
103
143
|
description?: string;
|
|
104
|
-
relationships: DirectionalRelationships;
|
|
105
144
|
propertiesMetadata?: PropertiesMetadata | undefined;
|
|
106
145
|
});
|
|
107
146
|
toString(): string;
|
|
@@ -117,150 +156,6 @@ interface TargetSchemaHook {
|
|
|
117
156
|
writeSchema: (input: TargetSchemaHookInput) => Promise<void>;
|
|
118
157
|
}
|
|
119
158
|
|
|
120
|
-
type ErrorType = "unauthorized" | "unknown";
|
|
121
|
-
|
|
122
|
-
declare abstract class Resolver {
|
|
123
|
-
constructor();
|
|
124
|
-
abstract checkIfCanSync(): Promise<boolean>;
|
|
125
|
-
abstract markSyncStarted(): Promise<void>;
|
|
126
|
-
abstract getState(): Promise<StateHolder>;
|
|
127
|
-
abstract writeCatalog(catalog: CatalogFile): Promise<void>;
|
|
128
|
-
abstract writeState(state: string): Promise<void>;
|
|
129
|
-
abstract markSyncFailed(): Promise<void>;
|
|
130
|
-
abstract markSyncComplete(): Promise<void>;
|
|
131
|
-
abstract markDiscoveryComplete(): Promise<void>;
|
|
132
|
-
abstract flushMetrics(): Promise<void>;
|
|
133
|
-
abstract onError(errorType: ErrorType, errorText: string, errorDebugText: string): Promise<void>;
|
|
134
|
-
abstract getSchemaHooks(): TargetSchemaHook[];
|
|
135
|
-
abstract updateSourceValue(optionKey: string, optionValue: string): Promise<void>;
|
|
136
|
-
abstract getLogFormat(): winston.Logform.Format;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
declare const writeStateFile: (resolver: Resolver, state: string) => Promise<void>;
|
|
140
|
-
declare const loadJson: (fileName: string) => any;
|
|
141
|
-
declare const loadSchema: (streamId: string) => any;
|
|
142
|
-
|
|
143
|
-
declare const getAxiosInstance: (retryCount?: number) => AxiosInstance;
|
|
144
|
-
interface GetConfig {
|
|
145
|
-
qs?: {
|
|
146
|
-
[key: string]: any;
|
|
147
|
-
};
|
|
148
|
-
headers?: AxiosRequestHeaders;
|
|
149
|
-
retryCount?: number;
|
|
150
|
-
}
|
|
151
|
-
declare const getRawJSONApiCall: <T>(endpoint: string, config: GetConfig, privateLogging?: boolean) => Promise<AxiosResponse<T>>;
|
|
152
|
-
declare const getJSONApiCallWithFullResponse: <T>(endpoint: string, config: GetConfig, privateLogging?: boolean) => Promise<AxiosResponse<any, any, {}>>;
|
|
153
|
-
declare const getJSONApiCall: <T>(endpoint: string, config: GetConfig, privateLogging?: boolean) => Promise<T>;
|
|
154
|
-
declare const getDownloadFileApiCall: <T>(endpoint: string, config: GetConfig, output: string, privateLogging?: boolean) => Promise<{
|
|
155
|
-
outputDir: string;
|
|
156
|
-
}>;
|
|
157
|
-
interface PostConfig {
|
|
158
|
-
qs?: {
|
|
159
|
-
[key: string]: any;
|
|
160
|
-
};
|
|
161
|
-
headers?: AxiosRequestHeaders;
|
|
162
|
-
retryCount?: number;
|
|
163
|
-
}
|
|
164
|
-
declare const postJSONApiCall: <T>(endpoint: string, config: PostConfig, payload: any) => Promise<T>;
|
|
165
|
-
declare const postFormDataApiCall: <T>(endpoint: string, config: PostConfig, payload: any) => Promise<T>;
|
|
166
|
-
declare const postUrlEncodedApiCall: (endpoint: string, config: PostConfig, payload: any) => Promise<any>;
|
|
167
|
-
|
|
168
|
-
declare const BATCH_INTERVAL_MS = 100;
|
|
169
|
-
declare const logger: {
|
|
170
|
-
info: (message: string | any, ...args: any[]) => void;
|
|
171
|
-
error: (message: string | any, ...args: any[]) => void;
|
|
172
|
-
debug: (message: string | any, ...args: any[]) => void;
|
|
173
|
-
warn: (message: string | any, ...args: any[]) => void;
|
|
174
|
-
closeWinston: (cb: () => void) => void;
|
|
175
|
-
};
|
|
176
|
-
|
|
177
|
-
declare const ALL_STREAM_ID_KEYWORD = "all";
|
|
178
|
-
declare const ROWS_SYNCED_METRIC_NAME = "rows_synced_count";
|
|
179
|
-
declare const API_CALLS_METRIC_NAME = "api_calls_count";
|
|
180
|
-
declare const EXECUTION_TIME_METRIC_NAME = "execution_time_ms";
|
|
181
|
-
interface MetricConfiguration {
|
|
182
|
-
isEnabled: () => boolean;
|
|
183
|
-
getStreamIds?: () => string[];
|
|
184
|
-
}
|
|
185
|
-
declare const getCounterMetrics: (name: string, streamIds: string[]) => CounterMetric[];
|
|
186
|
-
declare const getCounterMetric: (name: string, streamId?: string) => CounterMetric;
|
|
187
|
-
declare const getAllMetrics: () => CounterMetric[];
|
|
188
|
-
declare class CounterMetric {
|
|
189
|
-
private value;
|
|
190
|
-
name: string;
|
|
191
|
-
streamId: string;
|
|
192
|
-
constructor(name: string, streamId: string);
|
|
193
|
-
increment(inc?: number): void;
|
|
194
|
-
getStreamId(): string;
|
|
195
|
-
getName(): string;
|
|
196
|
-
getValue(): number;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
declare const printMemoryFootprint: (prefix: string) => void;
|
|
200
|
-
|
|
201
|
-
declare const haltAndCatchFire: (errorType: ErrorType, errorText: string, errorDebugText: string) => Promise<void>;
|
|
202
|
-
|
|
203
|
-
declare function gracefulExit(exitCode: number): Promise<void>;
|
|
204
|
-
|
|
205
|
-
declare const findRelatedRelationships: (streamId: StreamId, allRels: StreamRelationship[]) => DirectionalRelationships;
|
|
206
|
-
|
|
207
|
-
declare const loadResolver: () => Resolver;
|
|
208
|
-
|
|
209
|
-
interface HTTPHeaders {
|
|
210
|
-
[headerName: string]: any;
|
|
211
|
-
}
|
|
212
|
-
interface URLParams {
|
|
213
|
-
[paramName: string]: any;
|
|
214
|
-
}
|
|
215
|
-
type HTTPMethod = "GET" | "POST";
|
|
216
|
-
|
|
217
|
-
type InclusionMode = "available" | "automatic" | "unsupported";
|
|
218
|
-
interface MetadataEntry {
|
|
219
|
-
selected?: boolean;
|
|
220
|
-
"replication-method"?: ReplicationMethod;
|
|
221
|
-
"replication-key"?: string;
|
|
222
|
-
"view-key-properties"?: string[];
|
|
223
|
-
"inclusion"?: InclusionMode;
|
|
224
|
-
"selected-by-default"?: boolean;
|
|
225
|
-
"valid-replication-keys"?: string[];
|
|
226
|
-
"forced-replication-method"?: ReplicationMethod;
|
|
227
|
-
"forced-replication-key"?: string;
|
|
228
|
-
"table-key-properties"?: string[];
|
|
229
|
-
"schema-name"?: string;
|
|
230
|
-
"is-view"?: boolean;
|
|
231
|
-
"row-count"?: number;
|
|
232
|
-
"database-name"?: string;
|
|
233
|
-
"sql-datatype"?: string;
|
|
234
|
-
"whaly-display-label"?: string;
|
|
235
|
-
"whaly-description"?: string;
|
|
236
|
-
"whaly-parent-stream"?: StreamId;
|
|
237
|
-
}
|
|
238
|
-
interface CatalogMetadata {
|
|
239
|
-
breadcrumb: string[];
|
|
240
|
-
metadata: MetadataEntry;
|
|
241
|
-
}
|
|
242
|
-
declare class MetadataMap extends Map<string[], MetadataEntry> {
|
|
243
|
-
private areEquals;
|
|
244
|
-
private findExistingEntry;
|
|
245
|
-
get(key: string[]): MetadataEntry | undefined;
|
|
246
|
-
set(key: string[], value: MetadataEntry): this;
|
|
247
|
-
}
|
|
248
|
-
declare class StreamMetadata {
|
|
249
|
-
metadataByBreadcrumb: MetadataMap;
|
|
250
|
-
constructor();
|
|
251
|
-
fromCatalogStreamMetadata(metadataArr: CatalogMetadata[]): this;
|
|
252
|
-
toString(): MetadataMap;
|
|
253
|
-
get(breadcrumb: string[]): MetadataEntry | undefined;
|
|
254
|
-
write(breadcrumb: string[], key: string, value: any): this;
|
|
255
|
-
private getRootBreadcrumbMetadata;
|
|
256
|
-
isStreamSelected(): boolean;
|
|
257
|
-
getKeyProperties(): string[];
|
|
258
|
-
getReplicationKey(): string | undefined;
|
|
259
|
-
getReplicationMethod(): ReplicationMethod | undefined;
|
|
260
|
-
getForcedReplicationMethod(): ReplicationMethod | undefined;
|
|
261
|
-
toList(): CatalogMetadata[];
|
|
262
|
-
}
|
|
263
|
-
|
|
264
159
|
interface FlattenedSchema {
|
|
265
160
|
[unsafePropertyName: string]: JSONSchemaFieldDefinition;
|
|
266
161
|
}
|
|
@@ -287,8 +182,9 @@ interface StreamWithTempFile {
|
|
|
287
182
|
tempFile: TempFile;
|
|
288
183
|
}
|
|
289
184
|
interface BaseConfig {
|
|
290
|
-
|
|
185
|
+
connector_id: string;
|
|
291
186
|
database: string;
|
|
187
|
+
schema: string;
|
|
292
188
|
}
|
|
293
189
|
|
|
294
190
|
interface ColumnMappingStoreUnsafeToSafe {
|
|
@@ -363,7 +259,7 @@ declare class StreamState$1 {
|
|
|
363
259
|
streamId: StreamId;
|
|
364
260
|
schema?: FlattenedSchema;
|
|
365
261
|
dbSync: StreamWarehouseSyncService;
|
|
366
|
-
batchDate:
|
|
262
|
+
batchDate: Dayjs;
|
|
367
263
|
batchedRowCount: number;
|
|
368
264
|
fileToLoad: TempFile;
|
|
369
265
|
syncedRowCount: number;
|
|
@@ -386,11 +282,19 @@ declare class StreamState$1 {
|
|
|
386
282
|
setHasBeenLoadedYet(): void;
|
|
387
283
|
}
|
|
388
284
|
|
|
285
|
+
interface StateHolder {
|
|
286
|
+
state?: any;
|
|
287
|
+
}
|
|
288
|
+
interface StateProvider {
|
|
289
|
+
getState(): Promise<StateHolder>;
|
|
290
|
+
writeState(state: string): Promise<void>;
|
|
291
|
+
}
|
|
292
|
+
|
|
389
293
|
declare abstract class ITarget<C extends BaseConfig = BaseConfig> {
|
|
390
294
|
config: C;
|
|
391
295
|
schemaHooks: TargetSchemaHook[];
|
|
392
|
-
|
|
393
|
-
|
|
296
|
+
syncTime: Dayjs;
|
|
297
|
+
stateProvider: StateProvider;
|
|
394
298
|
batchedState: any;
|
|
395
299
|
flushedState: any;
|
|
396
300
|
renameColumnStore: RenameColumnStore;
|
|
@@ -398,7 +302,7 @@ declare abstract class ITarget<C extends BaseConfig = BaseConfig> {
|
|
|
398
302
|
[streamName: string]: StreamState$1;
|
|
399
303
|
};
|
|
400
304
|
validator: Validator;
|
|
401
|
-
constructor(config: C,
|
|
305
|
+
constructor(config: C, stateProvider: StateProvider);
|
|
402
306
|
static requiredConfigKeys: string[];
|
|
403
307
|
abstract newDBSyncInstance: (streamId: StreamId, database: string, schema: string, table: string) => StreamWarehouseSyncService;
|
|
404
308
|
abstract genTableName: (streamId: string) => string;
|
|
@@ -462,11 +366,9 @@ declare class StateService {
|
|
|
462
366
|
bookmarks: Bookmarks;
|
|
463
367
|
constructor();
|
|
464
368
|
static getInstance(): StateService;
|
|
465
|
-
setBookmark(streamId: StreamId,
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
getBookmark(streamId: StreamId): moment.Moment;
|
|
469
|
-
getBookmarkV2(streamId: StreamId): StreamState;
|
|
369
|
+
setBookmark(streamId: StreamId, streamState: StreamState): void;
|
|
370
|
+
setBookmarkSignpost(streamId: StreamId, signpostValue: string): void;
|
|
371
|
+
getBookmark(streamId: StreamId): StreamState;
|
|
470
372
|
clearState(): void;
|
|
471
373
|
get(): State;
|
|
472
374
|
forwardStateToTarget(target: ITarget): Promise<void>;
|
|
@@ -491,7 +393,7 @@ declare abstract class Stream<O = any, C = any, P = undefined> {
|
|
|
491
393
|
config: C;
|
|
492
394
|
tapState: InputTapState;
|
|
493
395
|
target: ITarget;
|
|
494
|
-
|
|
396
|
+
replicationMethod: ReplicationMethod | undefined;
|
|
495
397
|
selectedByDefault: boolean;
|
|
496
398
|
STATE_MSG_FREQUENCY: number;
|
|
497
399
|
streamId: StreamId;
|
|
@@ -499,16 +401,15 @@ declare abstract class Stream<O = any, C = any, P = undefined> {
|
|
|
499
401
|
displayLabel: string | undefined;
|
|
500
402
|
description: string | undefined;
|
|
501
403
|
primaryKey: string[];
|
|
502
|
-
|
|
404
|
+
replicationKey: string | undefined;
|
|
503
405
|
useStateFromStreamId: string | undefined;
|
|
504
|
-
relationships: StreamRelationship[];
|
|
505
406
|
children: Stream<any, any, O | O[]>[];
|
|
506
407
|
isSorted: boolean;
|
|
507
408
|
isSilent: boolean;
|
|
508
409
|
childConcurrency: number;
|
|
509
410
|
rowsSyncedMetricsConf: MetricConfiguration;
|
|
510
411
|
executionTimeMetricsConf: MetricConfiguration;
|
|
511
|
-
constructor(config: C,
|
|
412
|
+
constructor(config: C, tapState: InputTapState, target: ITarget, childConcurrency?: number);
|
|
512
413
|
/**
|
|
513
414
|
* Sync this stream
|
|
514
415
|
* Called only for streams with no parents, aka. "root tap streams"
|
|
@@ -545,17 +446,17 @@ declare abstract class Stream<O = any, C = any, P = undefined> {
|
|
|
545
446
|
* or `start_date` config if set,
|
|
546
447
|
* or the UNIX Epoch
|
|
547
448
|
**/
|
|
548
|
-
getStartingTimestamp():
|
|
449
|
+
getStartingTimestamp(): Dayjs;
|
|
549
450
|
/**
|
|
550
451
|
* Return the max allowable bookmark value for this stream's replication key.
|
|
551
452
|
*
|
|
552
|
-
* For timestamp-based replication keys, this defaults to `
|
|
453
|
+
* For timestamp-based replication keys, this defaults to `dayjs()`. For
|
|
553
454
|
* non-timestamp replication keys, default to `undefined`.
|
|
554
455
|
*
|
|
555
456
|
* Override this value to prevent bookmarks from being advanced in cases where we
|
|
556
457
|
* may only have a partial set of records.
|
|
557
458
|
*/
|
|
558
|
-
getReplicationKeySignpost: () => Promise<
|
|
459
|
+
getReplicationKeySignpost: () => Promise<Dayjs | undefined>;
|
|
559
460
|
/**
|
|
560
461
|
* Return the default replication method for the stream that will be used to write the catalog.
|
|
561
462
|
*/
|
|
@@ -657,7 +558,7 @@ declare abstract class RESTStream<R, O, NPT, C, P = undefined> extends Stream<O,
|
|
|
657
558
|
* TODO: Make URL + Path templatisable and replace those with Extractor (or Tap) config
|
|
658
559
|
* @returns
|
|
659
560
|
*/
|
|
660
|
-
|
|
561
|
+
getNextUrl(previousToken?: NPT, parent?: P): string;
|
|
661
562
|
/**
|
|
662
563
|
* Parse the response and return an iterator of result rows.
|
|
663
564
|
*
|
|
@@ -677,8 +578,10 @@ declare abstract class Tap<C> {
|
|
|
677
578
|
config: C;
|
|
678
579
|
streams: Stream[];
|
|
679
580
|
concurrency: number;
|
|
581
|
+
stateProvider: StateProvider;
|
|
582
|
+
tapState: InputTapState;
|
|
680
583
|
abstract init(): Promise<void>;
|
|
681
|
-
constructor(target: ITarget, config: C);
|
|
584
|
+
constructor(target: ITarget, config: C, stateProvider: StateProvider);
|
|
682
585
|
sync: (options?: SyncOptions) => Promise<void>;
|
|
683
586
|
end(): Promise<void>;
|
|
684
587
|
}
|
|
@@ -754,7 +657,7 @@ declare class BigQueryDBSync extends StreamWarehouseSyncService {
|
|
|
754
657
|
}
|
|
755
658
|
|
|
756
659
|
declare class BigQueryTarget extends ITarget<BigQueryConfig> {
|
|
757
|
-
constructor(config: BigQueryConfig,
|
|
660
|
+
constructor(config: BigQueryConfig, stateProvider: StateProvider);
|
|
758
661
|
static requiredConfigKeys: string[];
|
|
759
662
|
newDBSyncInstance: (streamId: StreamId, database: string, schema: string, table: string) => BigQueryDBSync;
|
|
760
663
|
genTableName: (key: string) => string;
|
|
@@ -763,4 +666,13 @@ declare class BigQueryTarget extends ITarget<BigQueryConfig> {
|
|
|
763
666
|
convertNumberIntoDecimal: (record: any, schema: FlattenedSchema) => any;
|
|
764
667
|
}
|
|
765
668
|
|
|
766
|
-
|
|
669
|
+
declare class GCSStateProvider implements StateProvider {
|
|
670
|
+
private bucketName;
|
|
671
|
+
private connectorId;
|
|
672
|
+
constructor(connectorId: string, bucketName: string);
|
|
673
|
+
private getObjectPath;
|
|
674
|
+
getState(): Promise<StateHolder>;
|
|
675
|
+
writeState(state: string): Promise<void>;
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
export { ALL_STREAM_ID_KEYWORD, API_CALLS_METRIC_NAME, Authenticator, BATCH_INTERVAL_MS, type BaseConfig, type BigQueryConfig, BigQueryTarget, type BigqueryLocation, type Bookmark, type Bookmarks, type ColumnMappingStoreUnsafeToSafe, CounterMetric, DEFAULT_MAX_CONCURRENT_STREAMS, EXECUTION_TIME_METRIC_NAME, type ErrorType, type FlattenedSchema, GCSStateProvider, type GetConfig, type HTTPHeaders, type HTTPMethod, ITarget, type InputTapState, type InternalTableField, type JSONSchemaFieldDefinition, type Message, type MessageType, type MetricConfiguration, MissingFieldInSchemaError, MissingSchemaError, type PostConfig, type ProgressMarkers, type PropertiesMetadata, RESTStream, ROWS_SYNCED_METRIC_NAME, RecordMessage, RenameColumnStore, ReplicationMethod, ReplicationMethodMessage, type SafeColumnNameConverterFn, type Schema, SchemaMessage, SchemaValidationError, type State, type StateHolder, StateMessage, type StateProvider, StateService, Stream, type StreamId, type StreamState, StreamWarehouseSyncService, type StreamWithTempFile, type SyncOptions, Tap, type TapState, type TargetSchemaHook, type TargetSchemaHookInput, type TempFile, type URLParams, type WarehouseTableField, _greaterThan, addWhalyFields, createTemporaryFileStream, extractStateForStream, finalizeStateProgressMarkers, flattenSchema, getAllMetrics, getAxiosInstance, getCounterMetric, getCounterMetrics, getDownloadFileApiCall, getJSONApiCall, getJSONApiCallWithFullResponse, getRawJSONApiCall, gracefulExit, haltAndCatchFire, incrementStreamState, loadJson, loadSchema, logger, postFormDataApiCall, postJSONApiCall, postUrlEncodedApiCall, printMemoryFootprint, removeParasiteProperties, safePath };
|