@whaly/connector-sdk 0.3.10 → 0.3.12

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 CHANGED
@@ -1125,15 +1125,59 @@ interface DownloadFilesOptions {
1125
1125
  */
1126
1126
  declare function downloadFiles(client: Client, files: Client.FileInfo[], localDir: string, options?: DownloadFilesOptions): Promise<string[]>;
1127
1127
 
1128
+ /**
1129
+ * Common interface for storage services (cloud or local).
1130
+ * Implemented by CloudStorageService and LocalStorageService.
1131
+ */
1132
+ interface StorageService {
1133
+ /**
1134
+ * Lists all files with an optional prefix/path filter.
1135
+ */
1136
+ listFiles(prefix?: string): Promise<string[]>;
1137
+ /**
1138
+ * Returns files that haven't been marked as processed.
1139
+ */
1140
+ getUnprocessedFiles(): Promise<string[]>;
1141
+ /**
1142
+ * Creates a marker file to indicate a file has been processed.
1143
+ */
1144
+ createMarkerFile(fileName: string): Promise<void>;
1145
+ /**
1146
+ * Downloads/resolves a file and returns a local file path.
1147
+ */
1148
+ downloadFile(filePath: string, fileName: string): Promise<string>;
1149
+ /**
1150
+ * Resolves a file URI to a local file path.
1151
+ * Cloud: downloads from bucket. Local: resolves and validates the local path.
1152
+ */
1153
+ resolveFileUri(fileUri: string): Promise<string>;
1154
+ /**
1155
+ * Uploads a local file to the storage destination.
1156
+ */
1157
+ uploadFile(localPath: string, destPath: string): Promise<File>;
1158
+ /**
1159
+ * Reads a storage object and returns its contents as a UTF-8 string.
1160
+ */
1161
+ readObjectAsString(objectPath: string): Promise<string>;
1162
+ /**
1163
+ * Writes a string to a storage object with JSON content type.
1164
+ */
1165
+ writeStringObject(objectPath: string, contents: string): Promise<void>;
1166
+ /**
1167
+ * Uploads a local file with a unique generated name.
1168
+ */
1169
+ uploadFileWithUniqueName(filePath: string, prefix: string, streamId: string): Promise<File>;
1170
+ }
1171
+
1128
1172
  interface CloudStorageServiceOptions {
1129
1173
  processedSuffix?: string;
1130
1174
  supportedExtensions?: string[];
1131
1175
  }
1132
1176
  /**
1133
- * Service for interacting with Google Cloud Storage.
1177
+ * Google Cloud Storage implementation of StorageService.
1134
1178
  * Supports file download, upload, listing, and marker-file-based processing tracking.
1135
1179
  */
1136
- declare class CloudStorageService {
1180
+ declare class CloudStorageService implements StorageService {
1137
1181
  private storage;
1138
1182
  private bucket;
1139
1183
  private processedSuffix;
@@ -1170,6 +1214,14 @@ declare class CloudStorageService {
1170
1214
  * Writes a string to a GCS object with JSON content type.
1171
1215
  */
1172
1216
  writeStringObject(objectPath: string, contents: string): Promise<void>;
1217
+ /**
1218
+ * Resolves a file URI to a local file path by downloading it from the configured GCS bucket.
1219
+ *
1220
+ * @example
1221
+ * const storage = new CloudStorageService("my-bucket", "my-folder");
1222
+ * const localPath = await storage.resolveFileUri("folder/file.xlsx");
1223
+ */
1224
+ resolveFileUri(fileUri: string): Promise<string>;
1173
1225
  /**
1174
1226
  * Uploads a local file to the bucket with a unique name based on prefix, streamId, and UUID.
1175
1227
  * Files are stored under `<prefix>/<run-id>/` when the RUN_ID env var is set,
@@ -1179,6 +1231,30 @@ declare class CloudStorageService {
1179
1231
  uploadFileWithUniqueName(filePath: string, prefix: string, streamId: string): Promise<File>;
1180
1232
  }
1181
1233
 
1234
+ interface LocalStorageServiceOptions {
1235
+ processedSuffix?: string;
1236
+ supportedExtensions?: string[];
1237
+ }
1238
+ /**
1239
+ * Local filesystem implementation of StorageService.
1240
+ * Operates entirely on the local filesystem — no cloud interaction.
1241
+ */
1242
+ declare class LocalStorageService implements StorageService {
1243
+ private basePath;
1244
+ private processedSuffix;
1245
+ private supportedExtensions;
1246
+ constructor(basePath: string, opts?: LocalStorageServiceOptions);
1247
+ listFiles(prefix?: string): Promise<string[]>;
1248
+ getUnprocessedFiles(): Promise<string[]>;
1249
+ createMarkerFile(fileName: string): Promise<void>;
1250
+ downloadFile(filePath: string, _fileName: string): Promise<string>;
1251
+ resolveFileUri(fileUri: string): Promise<string>;
1252
+ uploadFile(localPath: string, destPath: string): Promise<File>;
1253
+ readObjectAsString(objectPath: string): Promise<string>;
1254
+ writeStringObject(objectPath: string, contents: string): Promise<void>;
1255
+ uploadFileWithUniqueName(filePath: string, prefix: string, streamId: string): Promise<File>;
1256
+ }
1257
+
1182
1258
  /**
1183
1259
  * Extract a ZIP (or other archive) file to a target directory.
1184
1260
  * Uses the `decompress` library which supports zip, tar, gz, bz2, etc.
@@ -1413,6 +1489,12 @@ interface WhalyDocument {
1413
1489
  size_kb: number;
1414
1490
  storage: string;
1415
1491
  metadata: Record<string, string> | null;
1492
+ /**
1493
+ * The document source this document belongs to.
1494
+ * `null` means the org's default source. On create this field is optional —
1495
+ * when omitted the document is attached to the default source.
1496
+ */
1497
+ document_source_id: string | null;
1416
1498
  }
1417
1499
  /** Paginated response from the Whaly Document API. */
1418
1500
  interface WhalyPaginatedResponse<T> {
@@ -1490,6 +1572,16 @@ interface WhalyDocumentServiceConfig {
1490
1572
  serviceAccountKey?: string;
1491
1573
  /** Object storage ID for file uploads. */
1492
1574
  objectStorageId: string;
1575
+ /**
1576
+ * The document source this connector manages. One connector maps to exactly
1577
+ * one source. All operations are scoped to it:
1578
+ * - `listAllDocuments()` only returns documents belonging to this source,
1579
+ * so the reconciliation (create / update / **delete**) never touches
1580
+ * documents from other sources — important because the DocumentTap
1581
+ * deletes any listed document not present in the source.
1582
+ * - Created and updated documents are always attached to this source.
1583
+ */
1584
+ documentSourceId: string;
1493
1585
  }
1494
1586
  interface WhalyUploadResult {
1495
1587
  storage: string;
@@ -1499,17 +1591,22 @@ interface WhalyUploadResult {
1499
1591
  declare class WhalyDocumentService {
1500
1592
  private axiosClient;
1501
1593
  readonly objectStorageId: string;
1594
+ readonly documentSourceId: string;
1502
1595
  private gcsBucket;
1503
1596
  constructor(config: WhalyDocumentServiceConfig);
1504
- /** Fetch all documents from the API, handling cursor-based pagination. */
1597
+ /**
1598
+ * Fetch all documents belonging to the configured document source,
1599
+ * handling cursor-based pagination. The `document_source_id` server-side
1600
+ * filter scopes the result to this connector's source only.
1601
+ */
1505
1602
  listAllDocuments(): Promise<WhalyDocument[]>;
1506
1603
  /** Upload a file to object storage. Returns storage path and size. */
1507
1604
  uploadFile(destinationPath: string, localFilePath: string, fileName: string): Promise<WhalyUploadResult>;
1508
1605
  private uploadFileViaGCS;
1509
1606
  private uploadFileViaAPI;
1510
- /** Create a new document record. */
1511
- createDocument(payload: Omit<WhalyDocument, "id">): Promise<WhalyDocument>;
1512
- /** Update an existing document record. */
1607
+ /** Create a new document record, attached to the configured document source. */
1608
+ createDocument(payload: Omit<WhalyDocument, "id" | "document_source_id">): Promise<WhalyDocument>;
1609
+ /** Update an existing document record, keeping it in the configured document source. */
1513
1610
  updateDocument(id: string, payload: Partial<WhalyDocument>): Promise<WhalyDocument>;
1514
1611
  /** Delete a document record. */
1515
1612
  deleteDocument(id: string): Promise<void>;
@@ -1644,4 +1741,4 @@ declare class GCSStateProvider implements StateProvider {
1644
1741
  writeState(state: string): Promise<void>;
1645
1742
  }
1646
1743
 
1647
- export { ALL_STREAM_ID_KEYWORD, API_CALLS_METRIC_NAME, type AssetEntry, type AssetManifest, type AssetManifestEntry, type AssetReplicationMode, AssetStream, AssetTap, AssetTarget, Authenticator, BATCH_INTERVAL_MS, type BaseConfig, type BigQueryConfig, BigQueryTarget, type BigqueryLocation, type Bookmark, type Bookmarks, CdnAssetTarget, type CdnAssetTargetConfig, type CdnFileMetadata, CdnService, type CdnServiceConfig, type CdnUploadResult, CloudStorageService, type CloudStorageServiceOptions, type ColumnMappingStoreUnsafeToSafe, CounterMetric, CsvExtractionConfigBuilder, type CsvFieldsArrayConfig, type CsvFieldsConfig, type CsvFieldsDictConfig, type CsvFileConfig, type CsvStreamConfig, DEFAULT_MAX_CONCURRENT_STREAMS, DEFAULT_SYNCED_AT_COLUMN, DocumentDownloadSkipError, type DocumentEntry, type DocumentManifest, type DocumentManifestEntry, type DocumentStatus, DocumentStream, type DocumentStreamManifest, type DocumentSummary, DocumentTap, type DownloadFilesOptions, EXECUTION_TIME_METRIC_NAME, type ErrorType, type ExcelCustomExtractorConfig, type ExcelDerivedField, type ExcelExtractionBaseConfig, type ExcelExtractionConfig, ExcelExtractionConfigBuilder, type ExcelFieldMapping, type ExcelFieldSpec, type ExcelSingleSheetExtractionConfig, type ExcelSourceColumn, type ExcelStreamConfig, type FieldType, FileFormat, FilePatterns, FileStream, type FileStreamConfig, type FileStreamEntry, FileTap, type FileTapConfig, type FlattenedSchema, GCSStateProvider, type GetConfig, type HTTPHeaders, type HTTPMethod, ITarget, ImageTransform, type InputTapState, type InternalTableField, type JSONSchemaFieldDefinition, type ListFilesOptions, MIME_TYPES, type Message, type MessageType, type MetricConfiguration, MissingFieldInSchemaError, MissingSchemaError, type PostConfig, type ProcessedAsset, type ProgressMarkers, type PropertiesMetadata, RESTStream, ROWS_SYNCED_METRIC_NAME, RecordMessage, RenameColumnStore, ReplicationMethod, ReplicationMethodMessage, type SafeColumnNameConverterFn, type Schema, SchemaMessage, SchemaValidationError, SftpService, type State, type StateHolder, StateMessage, type StateProvider, StateService, Stream, type StreamId, type StreamManifest, type StreamState, StreamWarehouseSyncService, type StreamWithTempFile, type SyncOptions, Tap, type TapState, type TargetSchemaHook, type TargetSchemaHookInput, type TempFile, type URLParams, VariableExtractors, type WarehouseTableField, type WebpTransformOptions, type WhalyDocument, WhalyDocumentService, type WhalyDocumentServiceConfig, WhalyDocumentTarget, type WhalyPaginatedResponse, type WhalyUploadResult, type WriteGeneratorToCsvOptions, _greaterThan, addDocumentSummaries, addWhalyFields, checkCsvHeaderRow, coerceCellValue, collectPaginated, countCsvLines, createCellReference, createCsvStreamConfig, createExcelGenerator, createExcelStreamConfig, createTemporaryFileStream, csvFieldsToJsonSchema, downloadFiles, emptyDocumentSummary, excelColumnToIndex, excelFieldsToJsonSchema, excelRowToIndex, extractExcelRows, extractPrimaryKeysFromCsvConfig, extractPrimaryKeysFromExcelFields, extractStateForStream, fieldTypeToJsonSchema, finalizeStateProgressMarkers, findAllMatchingConfigs, flattenSchema, getAllMetrics, getApiEndpoint, getAxiosInstance, getCdnId, getCounterMetric, getCounterMetrics, getDownloadFileApiCall, getDryRunLimit, getExtension, getJSONApiCall, getJSONApiCallWithFullResponse, getMimeType, getRawJSONApiCall, getServiceAccountKey, gracefulExit, haltAndCatchFire, incrementStreamState, indexToExcelColumn, indexToExcelRow, isDryRun, listFilesRecursively, loadJson, loadSchema, logger, optionalEnv, parseCellReference, postFormDataApiCall, postJSONApiCall, postUrlEncodedApiCall, printMemoryFootprint, processFileStreams, processFromAsyncIterable, removeParasiteProperties, requireEnv, rowGeneratorFromCsv, runWithConcurrency, safePath, unzip, validateExcelConfig, writeDataToCsv, writeGeneratorToCSV };
1744
+ export { ALL_STREAM_ID_KEYWORD, API_CALLS_METRIC_NAME, type AssetEntry, type AssetManifest, type AssetManifestEntry, type AssetReplicationMode, AssetStream, AssetTap, AssetTarget, Authenticator, BATCH_INTERVAL_MS, type BaseConfig, type BigQueryConfig, BigQueryTarget, type BigqueryLocation, type Bookmark, type Bookmarks, CdnAssetTarget, type CdnAssetTargetConfig, type CdnFileMetadata, CdnService, type CdnServiceConfig, type CdnUploadResult, CloudStorageService, type CloudStorageServiceOptions, type ColumnMappingStoreUnsafeToSafe, CounterMetric, CsvExtractionConfigBuilder, type CsvFieldsArrayConfig, type CsvFieldsConfig, type CsvFieldsDictConfig, type CsvFileConfig, type CsvStreamConfig, DEFAULT_MAX_CONCURRENT_STREAMS, DEFAULT_SYNCED_AT_COLUMN, DocumentDownloadSkipError, type DocumentEntry, type DocumentManifest, type DocumentManifestEntry, type DocumentStatus, DocumentStream, type DocumentStreamManifest, type DocumentSummary, DocumentTap, type DownloadFilesOptions, EXECUTION_TIME_METRIC_NAME, type ErrorType, type ExcelCustomExtractorConfig, type ExcelDerivedField, type ExcelExtractionBaseConfig, type ExcelExtractionConfig, ExcelExtractionConfigBuilder, type ExcelFieldMapping, type ExcelFieldSpec, type ExcelSingleSheetExtractionConfig, type ExcelSourceColumn, type ExcelStreamConfig, type FieldType, FileFormat, FilePatterns, FileStream, type FileStreamConfig, type FileStreamEntry, FileTap, type FileTapConfig, type FlattenedSchema, GCSStateProvider, type GetConfig, type HTTPHeaders, type HTTPMethod, ITarget, ImageTransform, type InputTapState, type InternalTableField, type JSONSchemaFieldDefinition, type ListFilesOptions, LocalStorageService, type LocalStorageServiceOptions, MIME_TYPES, type Message, type MessageType, type MetricConfiguration, MissingFieldInSchemaError, MissingSchemaError, type PostConfig, type ProcessedAsset, type ProgressMarkers, type PropertiesMetadata, RESTStream, ROWS_SYNCED_METRIC_NAME, RecordMessage, RenameColumnStore, ReplicationMethod, ReplicationMethodMessage, type SafeColumnNameConverterFn, type Schema, SchemaMessage, SchemaValidationError, SftpService, type State, type StateHolder, StateMessage, type StateProvider, StateService, type StorageService, Stream, type StreamId, type StreamManifest, type StreamState, StreamWarehouseSyncService, type StreamWithTempFile, type SyncOptions, Tap, type TapState, type TargetSchemaHook, type TargetSchemaHookInput, type TempFile, type URLParams, VariableExtractors, type WarehouseTableField, type WebpTransformOptions, type WhalyDocument, WhalyDocumentService, type WhalyDocumentServiceConfig, WhalyDocumentTarget, type WhalyPaginatedResponse, type WhalyUploadResult, type WriteGeneratorToCsvOptions, _greaterThan, addDocumentSummaries, addWhalyFields, checkCsvHeaderRow, coerceCellValue, collectPaginated, countCsvLines, createCellReference, createCsvStreamConfig, createExcelGenerator, createExcelStreamConfig, createTemporaryFileStream, csvFieldsToJsonSchema, downloadFiles, emptyDocumentSummary, excelColumnToIndex, excelFieldsToJsonSchema, excelRowToIndex, extractExcelRows, extractPrimaryKeysFromCsvConfig, extractPrimaryKeysFromExcelFields, extractStateForStream, fieldTypeToJsonSchema, finalizeStateProgressMarkers, findAllMatchingConfigs, flattenSchema, getAllMetrics, getApiEndpoint, getAxiosInstance, getCdnId, getCounterMetric, getCounterMetrics, getDownloadFileApiCall, getDryRunLimit, getExtension, getJSONApiCall, getJSONApiCallWithFullResponse, getMimeType, getRawJSONApiCall, getServiceAccountKey, gracefulExit, haltAndCatchFire, incrementStreamState, indexToExcelColumn, indexToExcelRow, isDryRun, listFilesRecursively, loadJson, loadSchema, logger, optionalEnv, parseCellReference, postFormDataApiCall, postJSONApiCall, postUrlEncodedApiCall, printMemoryFootprint, processFileStreams, processFromAsyncIterable, removeParasiteProperties, requireEnv, rowGeneratorFromCsv, runWithConcurrency, safePath, unzip, validateExcelConfig, writeDataToCsv, writeGeneratorToCSV };
package/dist/index.d.ts CHANGED
@@ -1125,15 +1125,59 @@ interface DownloadFilesOptions {
1125
1125
  */
1126
1126
  declare function downloadFiles(client: Client, files: Client.FileInfo[], localDir: string, options?: DownloadFilesOptions): Promise<string[]>;
1127
1127
 
1128
+ /**
1129
+ * Common interface for storage services (cloud or local).
1130
+ * Implemented by CloudStorageService and LocalStorageService.
1131
+ */
1132
+ interface StorageService {
1133
+ /**
1134
+ * Lists all files with an optional prefix/path filter.
1135
+ */
1136
+ listFiles(prefix?: string): Promise<string[]>;
1137
+ /**
1138
+ * Returns files that haven't been marked as processed.
1139
+ */
1140
+ getUnprocessedFiles(): Promise<string[]>;
1141
+ /**
1142
+ * Creates a marker file to indicate a file has been processed.
1143
+ */
1144
+ createMarkerFile(fileName: string): Promise<void>;
1145
+ /**
1146
+ * Downloads/resolves a file and returns a local file path.
1147
+ */
1148
+ downloadFile(filePath: string, fileName: string): Promise<string>;
1149
+ /**
1150
+ * Resolves a file URI to a local file path.
1151
+ * Cloud: downloads from bucket. Local: resolves and validates the local path.
1152
+ */
1153
+ resolveFileUri(fileUri: string): Promise<string>;
1154
+ /**
1155
+ * Uploads a local file to the storage destination.
1156
+ */
1157
+ uploadFile(localPath: string, destPath: string): Promise<File>;
1158
+ /**
1159
+ * Reads a storage object and returns its contents as a UTF-8 string.
1160
+ */
1161
+ readObjectAsString(objectPath: string): Promise<string>;
1162
+ /**
1163
+ * Writes a string to a storage object with JSON content type.
1164
+ */
1165
+ writeStringObject(objectPath: string, contents: string): Promise<void>;
1166
+ /**
1167
+ * Uploads a local file with a unique generated name.
1168
+ */
1169
+ uploadFileWithUniqueName(filePath: string, prefix: string, streamId: string): Promise<File>;
1170
+ }
1171
+
1128
1172
  interface CloudStorageServiceOptions {
1129
1173
  processedSuffix?: string;
1130
1174
  supportedExtensions?: string[];
1131
1175
  }
1132
1176
  /**
1133
- * Service for interacting with Google Cloud Storage.
1177
+ * Google Cloud Storage implementation of StorageService.
1134
1178
  * Supports file download, upload, listing, and marker-file-based processing tracking.
1135
1179
  */
1136
- declare class CloudStorageService {
1180
+ declare class CloudStorageService implements StorageService {
1137
1181
  private storage;
1138
1182
  private bucket;
1139
1183
  private processedSuffix;
@@ -1170,6 +1214,14 @@ declare class CloudStorageService {
1170
1214
  * Writes a string to a GCS object with JSON content type.
1171
1215
  */
1172
1216
  writeStringObject(objectPath: string, contents: string): Promise<void>;
1217
+ /**
1218
+ * Resolves a file URI to a local file path by downloading it from the configured GCS bucket.
1219
+ *
1220
+ * @example
1221
+ * const storage = new CloudStorageService("my-bucket", "my-folder");
1222
+ * const localPath = await storage.resolveFileUri("folder/file.xlsx");
1223
+ */
1224
+ resolveFileUri(fileUri: string): Promise<string>;
1173
1225
  /**
1174
1226
  * Uploads a local file to the bucket with a unique name based on prefix, streamId, and UUID.
1175
1227
  * Files are stored under `<prefix>/<run-id>/` when the RUN_ID env var is set,
@@ -1179,6 +1231,30 @@ declare class CloudStorageService {
1179
1231
  uploadFileWithUniqueName(filePath: string, prefix: string, streamId: string): Promise<File>;
1180
1232
  }
1181
1233
 
1234
+ interface LocalStorageServiceOptions {
1235
+ processedSuffix?: string;
1236
+ supportedExtensions?: string[];
1237
+ }
1238
+ /**
1239
+ * Local filesystem implementation of StorageService.
1240
+ * Operates entirely on the local filesystem — no cloud interaction.
1241
+ */
1242
+ declare class LocalStorageService implements StorageService {
1243
+ private basePath;
1244
+ private processedSuffix;
1245
+ private supportedExtensions;
1246
+ constructor(basePath: string, opts?: LocalStorageServiceOptions);
1247
+ listFiles(prefix?: string): Promise<string[]>;
1248
+ getUnprocessedFiles(): Promise<string[]>;
1249
+ createMarkerFile(fileName: string): Promise<void>;
1250
+ downloadFile(filePath: string, _fileName: string): Promise<string>;
1251
+ resolveFileUri(fileUri: string): Promise<string>;
1252
+ uploadFile(localPath: string, destPath: string): Promise<File>;
1253
+ readObjectAsString(objectPath: string): Promise<string>;
1254
+ writeStringObject(objectPath: string, contents: string): Promise<void>;
1255
+ uploadFileWithUniqueName(filePath: string, prefix: string, streamId: string): Promise<File>;
1256
+ }
1257
+
1182
1258
  /**
1183
1259
  * Extract a ZIP (or other archive) file to a target directory.
1184
1260
  * Uses the `decompress` library which supports zip, tar, gz, bz2, etc.
@@ -1413,6 +1489,12 @@ interface WhalyDocument {
1413
1489
  size_kb: number;
1414
1490
  storage: string;
1415
1491
  metadata: Record<string, string> | null;
1492
+ /**
1493
+ * The document source this document belongs to.
1494
+ * `null` means the org's default source. On create this field is optional —
1495
+ * when omitted the document is attached to the default source.
1496
+ */
1497
+ document_source_id: string | null;
1416
1498
  }
1417
1499
  /** Paginated response from the Whaly Document API. */
1418
1500
  interface WhalyPaginatedResponse<T> {
@@ -1490,6 +1572,16 @@ interface WhalyDocumentServiceConfig {
1490
1572
  serviceAccountKey?: string;
1491
1573
  /** Object storage ID for file uploads. */
1492
1574
  objectStorageId: string;
1575
+ /**
1576
+ * The document source this connector manages. One connector maps to exactly
1577
+ * one source. All operations are scoped to it:
1578
+ * - `listAllDocuments()` only returns documents belonging to this source,
1579
+ * so the reconciliation (create / update / **delete**) never touches
1580
+ * documents from other sources — important because the DocumentTap
1581
+ * deletes any listed document not present in the source.
1582
+ * - Created and updated documents are always attached to this source.
1583
+ */
1584
+ documentSourceId: string;
1493
1585
  }
1494
1586
  interface WhalyUploadResult {
1495
1587
  storage: string;
@@ -1499,17 +1591,22 @@ interface WhalyUploadResult {
1499
1591
  declare class WhalyDocumentService {
1500
1592
  private axiosClient;
1501
1593
  readonly objectStorageId: string;
1594
+ readonly documentSourceId: string;
1502
1595
  private gcsBucket;
1503
1596
  constructor(config: WhalyDocumentServiceConfig);
1504
- /** Fetch all documents from the API, handling cursor-based pagination. */
1597
+ /**
1598
+ * Fetch all documents belonging to the configured document source,
1599
+ * handling cursor-based pagination. The `document_source_id` server-side
1600
+ * filter scopes the result to this connector's source only.
1601
+ */
1505
1602
  listAllDocuments(): Promise<WhalyDocument[]>;
1506
1603
  /** Upload a file to object storage. Returns storage path and size. */
1507
1604
  uploadFile(destinationPath: string, localFilePath: string, fileName: string): Promise<WhalyUploadResult>;
1508
1605
  private uploadFileViaGCS;
1509
1606
  private uploadFileViaAPI;
1510
- /** Create a new document record. */
1511
- createDocument(payload: Omit<WhalyDocument, "id">): Promise<WhalyDocument>;
1512
- /** Update an existing document record. */
1607
+ /** Create a new document record, attached to the configured document source. */
1608
+ createDocument(payload: Omit<WhalyDocument, "id" | "document_source_id">): Promise<WhalyDocument>;
1609
+ /** Update an existing document record, keeping it in the configured document source. */
1513
1610
  updateDocument(id: string, payload: Partial<WhalyDocument>): Promise<WhalyDocument>;
1514
1611
  /** Delete a document record. */
1515
1612
  deleteDocument(id: string): Promise<void>;
@@ -1644,4 +1741,4 @@ declare class GCSStateProvider implements StateProvider {
1644
1741
  writeState(state: string): Promise<void>;
1645
1742
  }
1646
1743
 
1647
- export { ALL_STREAM_ID_KEYWORD, API_CALLS_METRIC_NAME, type AssetEntry, type AssetManifest, type AssetManifestEntry, type AssetReplicationMode, AssetStream, AssetTap, AssetTarget, Authenticator, BATCH_INTERVAL_MS, type BaseConfig, type BigQueryConfig, BigQueryTarget, type BigqueryLocation, type Bookmark, type Bookmarks, CdnAssetTarget, type CdnAssetTargetConfig, type CdnFileMetadata, CdnService, type CdnServiceConfig, type CdnUploadResult, CloudStorageService, type CloudStorageServiceOptions, type ColumnMappingStoreUnsafeToSafe, CounterMetric, CsvExtractionConfigBuilder, type CsvFieldsArrayConfig, type CsvFieldsConfig, type CsvFieldsDictConfig, type CsvFileConfig, type CsvStreamConfig, DEFAULT_MAX_CONCURRENT_STREAMS, DEFAULT_SYNCED_AT_COLUMN, DocumentDownloadSkipError, type DocumentEntry, type DocumentManifest, type DocumentManifestEntry, type DocumentStatus, DocumentStream, type DocumentStreamManifest, type DocumentSummary, DocumentTap, type DownloadFilesOptions, EXECUTION_TIME_METRIC_NAME, type ErrorType, type ExcelCustomExtractorConfig, type ExcelDerivedField, type ExcelExtractionBaseConfig, type ExcelExtractionConfig, ExcelExtractionConfigBuilder, type ExcelFieldMapping, type ExcelFieldSpec, type ExcelSingleSheetExtractionConfig, type ExcelSourceColumn, type ExcelStreamConfig, type FieldType, FileFormat, FilePatterns, FileStream, type FileStreamConfig, type FileStreamEntry, FileTap, type FileTapConfig, type FlattenedSchema, GCSStateProvider, type GetConfig, type HTTPHeaders, type HTTPMethod, ITarget, ImageTransform, type InputTapState, type InternalTableField, type JSONSchemaFieldDefinition, type ListFilesOptions, MIME_TYPES, type Message, type MessageType, type MetricConfiguration, MissingFieldInSchemaError, MissingSchemaError, type PostConfig, type ProcessedAsset, type ProgressMarkers, type PropertiesMetadata, RESTStream, ROWS_SYNCED_METRIC_NAME, RecordMessage, RenameColumnStore, ReplicationMethod, ReplicationMethodMessage, type SafeColumnNameConverterFn, type Schema, SchemaMessage, SchemaValidationError, SftpService, type State, type StateHolder, StateMessage, type StateProvider, StateService, Stream, type StreamId, type StreamManifest, type StreamState, StreamWarehouseSyncService, type StreamWithTempFile, type SyncOptions, Tap, type TapState, type TargetSchemaHook, type TargetSchemaHookInput, type TempFile, type URLParams, VariableExtractors, type WarehouseTableField, type WebpTransformOptions, type WhalyDocument, WhalyDocumentService, type WhalyDocumentServiceConfig, WhalyDocumentTarget, type WhalyPaginatedResponse, type WhalyUploadResult, type WriteGeneratorToCsvOptions, _greaterThan, addDocumentSummaries, addWhalyFields, checkCsvHeaderRow, coerceCellValue, collectPaginated, countCsvLines, createCellReference, createCsvStreamConfig, createExcelGenerator, createExcelStreamConfig, createTemporaryFileStream, csvFieldsToJsonSchema, downloadFiles, emptyDocumentSummary, excelColumnToIndex, excelFieldsToJsonSchema, excelRowToIndex, extractExcelRows, extractPrimaryKeysFromCsvConfig, extractPrimaryKeysFromExcelFields, extractStateForStream, fieldTypeToJsonSchema, finalizeStateProgressMarkers, findAllMatchingConfigs, flattenSchema, getAllMetrics, getApiEndpoint, getAxiosInstance, getCdnId, getCounterMetric, getCounterMetrics, getDownloadFileApiCall, getDryRunLimit, getExtension, getJSONApiCall, getJSONApiCallWithFullResponse, getMimeType, getRawJSONApiCall, getServiceAccountKey, gracefulExit, haltAndCatchFire, incrementStreamState, indexToExcelColumn, indexToExcelRow, isDryRun, listFilesRecursively, loadJson, loadSchema, logger, optionalEnv, parseCellReference, postFormDataApiCall, postJSONApiCall, postUrlEncodedApiCall, printMemoryFootprint, processFileStreams, processFromAsyncIterable, removeParasiteProperties, requireEnv, rowGeneratorFromCsv, runWithConcurrency, safePath, unzip, validateExcelConfig, writeDataToCsv, writeGeneratorToCSV };
1744
+ export { ALL_STREAM_ID_KEYWORD, API_CALLS_METRIC_NAME, type AssetEntry, type AssetManifest, type AssetManifestEntry, type AssetReplicationMode, AssetStream, AssetTap, AssetTarget, Authenticator, BATCH_INTERVAL_MS, type BaseConfig, type BigQueryConfig, BigQueryTarget, type BigqueryLocation, type Bookmark, type Bookmarks, CdnAssetTarget, type CdnAssetTargetConfig, type CdnFileMetadata, CdnService, type CdnServiceConfig, type CdnUploadResult, CloudStorageService, type CloudStorageServiceOptions, type ColumnMappingStoreUnsafeToSafe, CounterMetric, CsvExtractionConfigBuilder, type CsvFieldsArrayConfig, type CsvFieldsConfig, type CsvFieldsDictConfig, type CsvFileConfig, type CsvStreamConfig, DEFAULT_MAX_CONCURRENT_STREAMS, DEFAULT_SYNCED_AT_COLUMN, DocumentDownloadSkipError, type DocumentEntry, type DocumentManifest, type DocumentManifestEntry, type DocumentStatus, DocumentStream, type DocumentStreamManifest, type DocumentSummary, DocumentTap, type DownloadFilesOptions, EXECUTION_TIME_METRIC_NAME, type ErrorType, type ExcelCustomExtractorConfig, type ExcelDerivedField, type ExcelExtractionBaseConfig, type ExcelExtractionConfig, ExcelExtractionConfigBuilder, type ExcelFieldMapping, type ExcelFieldSpec, type ExcelSingleSheetExtractionConfig, type ExcelSourceColumn, type ExcelStreamConfig, type FieldType, FileFormat, FilePatterns, FileStream, type FileStreamConfig, type FileStreamEntry, FileTap, type FileTapConfig, type FlattenedSchema, GCSStateProvider, type GetConfig, type HTTPHeaders, type HTTPMethod, ITarget, ImageTransform, type InputTapState, type InternalTableField, type JSONSchemaFieldDefinition, type ListFilesOptions, LocalStorageService, type LocalStorageServiceOptions, MIME_TYPES, type Message, type MessageType, type MetricConfiguration, MissingFieldInSchemaError, MissingSchemaError, type PostConfig, type ProcessedAsset, type ProgressMarkers, type PropertiesMetadata, RESTStream, ROWS_SYNCED_METRIC_NAME, RecordMessage, RenameColumnStore, ReplicationMethod, ReplicationMethodMessage, type SafeColumnNameConverterFn, type Schema, SchemaMessage, SchemaValidationError, SftpService, type State, type StateHolder, StateMessage, type StateProvider, StateService, type StorageService, Stream, type StreamId, type StreamManifest, type StreamState, StreamWarehouseSyncService, type StreamWithTempFile, type SyncOptions, Tap, type TapState, type TargetSchemaHook, type TargetSchemaHookInput, type TempFile, type URLParams, VariableExtractors, type WarehouseTableField, type WebpTransformOptions, type WhalyDocument, WhalyDocumentService, type WhalyDocumentServiceConfig, WhalyDocumentTarget, type WhalyPaginatedResponse, type WhalyUploadResult, type WriteGeneratorToCsvOptions, _greaterThan, addDocumentSummaries, addWhalyFields, checkCsvHeaderRow, coerceCellValue, collectPaginated, countCsvLines, createCellReference, createCsvStreamConfig, createExcelGenerator, createExcelStreamConfig, createTemporaryFileStream, csvFieldsToJsonSchema, downloadFiles, emptyDocumentSummary, excelColumnToIndex, excelFieldsToJsonSchema, excelRowToIndex, extractExcelRows, extractPrimaryKeysFromCsvConfig, extractPrimaryKeysFromExcelFields, extractStateForStream, fieldTypeToJsonSchema, finalizeStateProgressMarkers, findAllMatchingConfigs, flattenSchema, getAllMetrics, getApiEndpoint, getAxiosInstance, getCdnId, getCounterMetric, getCounterMetrics, getDownloadFileApiCall, getDryRunLimit, getExtension, getJSONApiCall, getJSONApiCallWithFullResponse, getMimeType, getRawJSONApiCall, getServiceAccountKey, gracefulExit, haltAndCatchFire, incrementStreamState, indexToExcelColumn, indexToExcelRow, isDryRun, listFilesRecursively, loadJson, loadSchema, logger, optionalEnv, parseCellReference, postFormDataApiCall, postJSONApiCall, postUrlEncodedApiCall, printMemoryFootprint, processFileStreams, processFromAsyncIterable, removeParasiteProperties, requireEnv, rowGeneratorFromCsv, runWithConcurrency, safePath, unzip, validateExcelConfig, writeDataToCsv, writeGeneratorToCSV };