@bayoudhi/moose-lib-serverless 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/{helpers-C3Yr4RzN.d.mts → index.d.mts} +373 -39
- package/dist/{helpers-C3Yr4RzN.d.ts → index.d.ts} +373 -39
- package/dist/{serverless.js → index.js} +184 -176
- package/dist/index.js.map +1 -0
- package/dist/{serverless.mjs → index.mjs} +120 -91
- package/dist/index.mjs.map +1 -0
- package/package.json +15 -8
- package/dist/browserCompatible.d.mts +0 -14
- package/dist/browserCompatible.d.ts +0 -14
- package/dist/serverless.d.mts +0 -383
- package/dist/serverless.d.ts +0 -383
- package/dist/serverless.js.map +0 -1
- package/dist/serverless.mjs.map +0 -1
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Readable } from 'node:stream';
|
|
2
|
+
import { IsTuple } from 'typia/lib/typings/IsTuple';
|
|
3
|
+
import { IJsonSchemaCollection as IJsonSchemaCollection$1, tags } from 'typia';
|
|
2
4
|
import { ClickHouseClient, ResultSet, CommandResult } from '@clickhouse/client';
|
|
3
5
|
import { Client } from '@temporalio/client';
|
|
4
6
|
import { JWTPayload } from 'jose';
|
|
5
7
|
import http from 'http';
|
|
6
8
|
import { IJsonSchemaCollection } from 'typia/src/schemas/json/IJsonSchemaCollection';
|
|
7
9
|
import { Pattern, TagBase } from 'typia/lib/tags';
|
|
8
|
-
import { Readable } from 'node:stream';
|
|
9
10
|
|
|
10
11
|
type EnumValues = {
|
|
11
12
|
name: string;
|
|
@@ -229,24 +230,6 @@ type ClickHouseJson<maxDynamicPaths extends number | undefined = undefined, maxD
|
|
|
229
230
|
skipRegexes?: skipRegexes;
|
|
230
231
|
};
|
|
231
232
|
};
|
|
232
|
-
type ClickHousePoint = [number, number] & {
|
|
233
|
-
_clickhouse_mapped_type?: "Point";
|
|
234
|
-
};
|
|
235
|
-
type ClickHouseRing = ClickHousePoint[] & {
|
|
236
|
-
_clickhouse_mapped_type?: "Ring";
|
|
237
|
-
};
|
|
238
|
-
type ClickHouseLineString = ClickHousePoint[] & {
|
|
239
|
-
_clickhouse_mapped_type?: "LineString";
|
|
240
|
-
};
|
|
241
|
-
type ClickHouseMultiLineString = ClickHouseLineString[] & {
|
|
242
|
-
_clickhouse_mapped_type?: "MultiLineString";
|
|
243
|
-
};
|
|
244
|
-
type ClickHousePolygon = ClickHouseRing[] & {
|
|
245
|
-
_clickhouse_mapped_type?: "Polygon";
|
|
246
|
-
};
|
|
247
|
-
type ClickHouseMultiPolygon = ClickHousePolygon[] & {
|
|
248
|
-
_clickhouse_mapped_type?: "MultiPolygon";
|
|
249
|
-
};
|
|
250
233
|
/**
|
|
251
234
|
* typia may have trouble handling this type.
|
|
252
235
|
* In which case, use {@link WithDefault} as a workaround
|
|
@@ -2354,27 +2337,378 @@ declare class WorkflowClient {
|
|
|
2354
2337
|
private getWorkflowConfig;
|
|
2355
2338
|
private processInputData;
|
|
2356
2339
|
}
|
|
2340
|
+
|
|
2341
|
+
type Key<T extends string | number | Date> = T;
|
|
2342
|
+
type JWT<T extends object> = T;
|
|
2343
|
+
|
|
2357
2344
|
/**
|
|
2358
|
-
*
|
|
2359
|
-
*
|
|
2360
|
-
*
|
|
2361
|
-
*
|
|
2345
|
+
* @fileoverview Pure TypeScript types, interfaces, constants, and utility functions
|
|
2346
|
+
* extracted from commons.ts. This module has NO native dependencies (no Kafka,
|
|
2347
|
+
* no ClickHouse client, no fs) and is safe to import in serverless/Lambda environments.
|
|
2348
|
+
*
|
|
2349
|
+
* The full commons.ts re-exports everything from this module for backward compatibility.
|
|
2350
|
+
*
|
|
2351
|
+
* @module commons-types
|
|
2362
2352
|
*/
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2353
|
+
/**
|
|
2354
|
+
* Utility function for compiler-related logging that can be disabled via environment variable.
|
|
2355
|
+
* Set MOOSE_DISABLE_COMPILER_LOGS=true to suppress these logs (useful for testing environments).
|
|
2356
|
+
*/
|
|
2357
|
+
declare const compilerLog: (message: string) => void;
|
|
2358
|
+
declare const antiCachePath: (path: string) => string;
|
|
2359
|
+
declare const getFileName: (filePath: string) => string;
|
|
2360
|
+
type CliLogData = {
|
|
2361
|
+
message_type?: "Info" | "Success" | "Warning" | "Error" | "Highlight";
|
|
2362
|
+
action: string;
|
|
2363
|
+
message: string;
|
|
2367
2364
|
};
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2365
|
+
declare const cliLog: (log: CliLogData) => void;
|
|
2366
|
+
/**
|
|
2367
|
+
* Method to change .ts, .cts, and .mts to .js, .cjs, and .mjs
|
|
2368
|
+
* This is needed because 'import' does not support .ts, .cts, and .mts
|
|
2369
|
+
*/
|
|
2370
|
+
declare function mapTstoJs(filePath: string): string;
|
|
2371
|
+
declare const MAX_RETRIES = 150;
|
|
2372
|
+
declare const MAX_RETRY_TIME_MS = 1000;
|
|
2373
|
+
declare const RETRY_INITIAL_TIME_MS = 100;
|
|
2374
|
+
declare const MAX_RETRIES_PRODUCER = 150;
|
|
2375
|
+
declare const RETRY_FACTOR_PRODUCER = 0.2;
|
|
2376
|
+
declare const ACKs = -1;
|
|
2377
|
+
/**
|
|
2378
|
+
* Interface for logging functionality
|
|
2379
|
+
*/
|
|
2380
|
+
interface Logger {
|
|
2381
|
+
logPrefix: string;
|
|
2382
|
+
log: (message: string) => void;
|
|
2383
|
+
error: (message: string) => void;
|
|
2384
|
+
warn: (message: string) => void;
|
|
2385
|
+
}
|
|
2386
|
+
declare const logError: (logger: Logger, e: Error) => void;
|
|
2387
|
+
type KafkaClientConfig = {
|
|
2388
|
+
clientId: string;
|
|
2389
|
+
broker: string;
|
|
2390
|
+
securityProtocol?: string;
|
|
2391
|
+
saslUsername?: string;
|
|
2392
|
+
saslPassword?: string;
|
|
2393
|
+
saslMechanism?: string;
|
|
2372
2394
|
};
|
|
2373
|
-
declare function joinQueries({ values, separator, prefix, suffix, }: {
|
|
2374
|
-
values: readonly RawValue[];
|
|
2375
|
-
separator?: string;
|
|
2376
|
-
prefix?: string;
|
|
2377
|
-
suffix?: string;
|
|
2378
|
-
}): Sql;
|
|
2379
2395
|
|
|
2380
|
-
|
|
2396
|
+
/**
|
|
2397
|
+
* @module secrets
|
|
2398
|
+
* Utilities for runtime environment variable resolution.
|
|
2399
|
+
*
|
|
2400
|
+
* This module provides functionality to mark values that should be resolved
|
|
2401
|
+
* from environment variables at runtime by the Moose CLI, rather than being
|
|
2402
|
+
* embedded at build time.
|
|
2403
|
+
*
|
|
2404
|
+
* @example
|
|
2405
|
+
* ```typescript
|
|
2406
|
+
* import { S3QueueEngine, mooseRuntimeEnv } from 'moose-lib';
|
|
2407
|
+
*
|
|
2408
|
+
* const table = OlapTable<MyData>(
|
|
2409
|
+
* "MyTable",
|
|
2410
|
+
* OlapConfig({
|
|
2411
|
+
* engine: S3QueueEngine({
|
|
2412
|
+
* s3_path: "s3://bucket/data/*.json",
|
|
2413
|
+
* format: "JSONEachRow",
|
|
2414
|
+
* awsAccessKeyId: mooseRuntimeEnv.get("AWS_ACCESS_KEY_ID"),
|
|
2415
|
+
* awsSecretAccessKey: mooseRuntimeEnv.get("AWS_SECRET_ACCESS_KEY")
|
|
2416
|
+
* })
|
|
2417
|
+
* })
|
|
2418
|
+
* );
|
|
2419
|
+
* ```
|
|
2420
|
+
*/
|
|
2421
|
+
/**
|
|
2422
|
+
* Prefix used to mark values for runtime environment variable resolution.
|
|
2423
|
+
* @internal
|
|
2424
|
+
*/
|
|
2425
|
+
declare const MOOSE_RUNTIME_ENV_PREFIX = "__MOOSE_RUNTIME_ENV__:";
|
|
2426
|
+
/**
|
|
2427
|
+
* Utilities for marking values to be resolved from environment variables at runtime.
|
|
2428
|
+
*
|
|
2429
|
+
* When you use `mooseRuntimeEnv.get()`, the behavior depends on the context:
|
|
2430
|
+
* - During infrastructure map loading: Returns a marker string for later resolution
|
|
2431
|
+
* - During function/workflow execution: Returns the actual environment variable value
|
|
2432
|
+
*
|
|
2433
|
+
* This is useful for:
|
|
2434
|
+
* - Credentials that should never be embedded in Docker images
|
|
2435
|
+
* - Configuration that can be rotated without rebuilding
|
|
2436
|
+
* - Different values for different environments (dev, staging, prod)
|
|
2437
|
+
* - Any runtime configuration in infrastructure elements (Tables, Topics, etc.)
|
|
2438
|
+
*/
|
|
2439
|
+
declare const mooseRuntimeEnv: {
|
|
2440
|
+
/**
|
|
2441
|
+
* Gets a value from an environment variable, with behavior depending on context.
|
|
2442
|
+
*
|
|
2443
|
+
* When IS_LOADING_INFRA_MAP=true (infrastructure loading):
|
|
2444
|
+
* Returns a marker string that Moose CLI will resolve later
|
|
2445
|
+
*
|
|
2446
|
+
* When IS_LOADING_INFRA_MAP is unset (function/workflow runtime):
|
|
2447
|
+
* Returns the actual value from the environment variable
|
|
2448
|
+
*
|
|
2449
|
+
* @param envVarName - Name of the environment variable to resolve
|
|
2450
|
+
* @returns Either a marker string or the actual environment variable value
|
|
2451
|
+
* @throws {Error} If the environment variable name is empty
|
|
2452
|
+
* @throws {Error} If the environment variable is not set (runtime mode only)
|
|
2453
|
+
*
|
|
2454
|
+
* @example
|
|
2455
|
+
* ```typescript
|
|
2456
|
+
* // Instead of this (evaluated at build time):
|
|
2457
|
+
* awsAccessKeyId: process.env.AWS_ACCESS_KEY_ID
|
|
2458
|
+
*
|
|
2459
|
+
* // Use this (evaluated at runtime):
|
|
2460
|
+
* awsAccessKeyId: mooseRuntimeEnv.get("AWS_ACCESS_KEY_ID")
|
|
2461
|
+
* ```
|
|
2462
|
+
*/
|
|
2463
|
+
get(envVarName: string): string;
|
|
2464
|
+
};
|
|
2465
|
+
/** @deprecated Use mooseRuntimeEnv instead */
|
|
2466
|
+
declare const mooseEnvSecrets: {
|
|
2467
|
+
/**
|
|
2468
|
+
* Gets a value from an environment variable, with behavior depending on context.
|
|
2469
|
+
*
|
|
2470
|
+
* When IS_LOADING_INFRA_MAP=true (infrastructure loading):
|
|
2471
|
+
* Returns a marker string that Moose CLI will resolve later
|
|
2472
|
+
*
|
|
2473
|
+
* When IS_LOADING_INFRA_MAP is unset (function/workflow runtime):
|
|
2474
|
+
* Returns the actual value from the environment variable
|
|
2475
|
+
*
|
|
2476
|
+
* @param envVarName - Name of the environment variable to resolve
|
|
2477
|
+
* @returns Either a marker string or the actual environment variable value
|
|
2478
|
+
* @throws {Error} If the environment variable name is empty
|
|
2479
|
+
* @throws {Error} If the environment variable is not set (runtime mode only)
|
|
2480
|
+
*
|
|
2481
|
+
* @example
|
|
2482
|
+
* ```typescript
|
|
2483
|
+
* // Instead of this (evaluated at build time):
|
|
2484
|
+
* awsAccessKeyId: process.env.AWS_ACCESS_KEY_ID
|
|
2485
|
+
*
|
|
2486
|
+
* // Use this (evaluated at runtime):
|
|
2487
|
+
* awsAccessKeyId: mooseRuntimeEnv.get("AWS_ACCESS_KEY_ID")
|
|
2488
|
+
* ```
|
|
2489
|
+
*/
|
|
2490
|
+
get(envVarName: string): string;
|
|
2491
|
+
};
|
|
2492
|
+
|
|
2493
|
+
/**
|
|
2494
|
+
* Configuration for CSV parsing options
|
|
2495
|
+
*/
|
|
2496
|
+
interface CSVParsingConfig {
|
|
2497
|
+
/** CSV delimiter character */
|
|
2498
|
+
delimiter: string;
|
|
2499
|
+
/** Whether to treat first row as headers */
|
|
2500
|
+
columns?: boolean;
|
|
2501
|
+
/** Whether to skip empty lines */
|
|
2502
|
+
skipEmptyLines?: boolean;
|
|
2503
|
+
/** Whether to trim whitespace from values */
|
|
2504
|
+
trim?: boolean;
|
|
2505
|
+
}
|
|
2506
|
+
/**
|
|
2507
|
+
* Configuration for JSON parsing options
|
|
2508
|
+
*/
|
|
2509
|
+
interface JSONParsingConfig {
|
|
2510
|
+
/** Custom reviver function for JSON.parse */
|
|
2511
|
+
reviver?: (key: string, value: any) => any;
|
|
2512
|
+
}
|
|
2513
|
+
/**
|
|
2514
|
+
* Parses CSV content into an array of objects
|
|
2515
|
+
*
|
|
2516
|
+
* @param content - The CSV content as a string
|
|
2517
|
+
* @param config - CSV parsing configuration
|
|
2518
|
+
* @returns Promise resolving to an array of parsed objects
|
|
2519
|
+
*/
|
|
2520
|
+
declare function parseCSV<T = Record<string, any>>(content: string, config: CSVParsingConfig): Promise<T[]>;
|
|
2521
|
+
/**
|
|
2522
|
+
* Parses JSON content into an array of objects
|
|
2523
|
+
*
|
|
2524
|
+
* @param content - The JSON content as a string
|
|
2525
|
+
* @param config - JSON parsing configuration
|
|
2526
|
+
* @returns Array of parsed objects
|
|
2527
|
+
*/
|
|
2528
|
+
declare function parseJSON<T = any>(content: string, config?: JSONParsingConfig): T[];
|
|
2529
|
+
/**
|
|
2530
|
+
* Parses JSON content with automatic date revival
|
|
2531
|
+
*
|
|
2532
|
+
* @param content - The JSON content as a string
|
|
2533
|
+
* @returns Array of parsed objects with Date objects for ISO 8601 strings
|
|
2534
|
+
*/
|
|
2535
|
+
declare function parseJSONWithDates<T = any>(content: string): T[];
|
|
2536
|
+
/**
|
|
2537
|
+
* Type guard to check if a value is a valid CSV delimiter
|
|
2538
|
+
*/
|
|
2539
|
+
declare function isValidCSVDelimiter(delimiter: string): boolean;
|
|
2540
|
+
/**
|
|
2541
|
+
* Common CSV delimiters
|
|
2542
|
+
*/
|
|
2543
|
+
declare const CSV_DELIMITERS: {
|
|
2544
|
+
readonly COMMA: ",";
|
|
2545
|
+
readonly TAB: "\t";
|
|
2546
|
+
readonly SEMICOLON: ";";
|
|
2547
|
+
readonly PIPE: "|";
|
|
2548
|
+
};
|
|
2549
|
+
/**
|
|
2550
|
+
* Default CSV parsing configuration
|
|
2551
|
+
*/
|
|
2552
|
+
declare const DEFAULT_CSV_CONFIG: CSVParsingConfig;
|
|
2553
|
+
/**
|
|
2554
|
+
* Default JSON parsing configuration with date revival
|
|
2555
|
+
*/
|
|
2556
|
+
declare const DEFAULT_JSON_CONFIG: JSONParsingConfig;
|
|
2557
|
+
|
|
2558
|
+
type HasFunctionField<T> = T extends object ? {
|
|
2559
|
+
[K in keyof T]: T[K] extends Function ? true : false;
|
|
2560
|
+
}[keyof T] extends false | undefined ? false : true : false;
|
|
2561
|
+
type OptionalToUndefinedable<T> = {
|
|
2562
|
+
[K in {} & keyof T]: T[K];
|
|
2563
|
+
};
|
|
2564
|
+
type StripInterfaceFields<T> = {
|
|
2565
|
+
[K in keyof T]: StripDateIntersection<T[K]>;
|
|
2566
|
+
};
|
|
2567
|
+
/**
|
|
2568
|
+
* `Date & ...` is considered "nonsensible intersection" by typia,
|
|
2569
|
+
* causing JSON schema to fail.
|
|
2570
|
+
* This helper type recursively cleans up the intersection type tagging.
|
|
2571
|
+
*/
|
|
2572
|
+
type StripDateIntersection<T> = T extends Date ? Date extends T ? Date : T : T extends ReadonlyArray<unknown> ? IsTuple<T> extends true ? StripDateFromTuple<T> : T extends ReadonlyArray<infer U> ? ReadonlyArray<U> extends T ? ReadonlyArray<StripDateIntersection<U>> : Array<StripDateIntersection<U>> : T extends Array<infer U> ? Array<StripDateIntersection<U>> : T : true extends HasFunctionField<T> ? T : T extends object ? StripInterfaceFields<OptionalToUndefinedable<T>> : T;
|
|
2573
|
+
type StripDateFromTuple<T extends readonly any[]> = T extends ([
|
|
2574
|
+
infer T1,
|
|
2575
|
+
infer T2,
|
|
2576
|
+
infer T3,
|
|
2577
|
+
infer T4,
|
|
2578
|
+
infer T5,
|
|
2579
|
+
infer T6,
|
|
2580
|
+
infer T7,
|
|
2581
|
+
infer T8,
|
|
2582
|
+
infer T9,
|
|
2583
|
+
infer T10
|
|
2584
|
+
]) ? [
|
|
2585
|
+
StripDateIntersection<T1>,
|
|
2586
|
+
StripDateIntersection<T2>,
|
|
2587
|
+
StripDateIntersection<T3>,
|
|
2588
|
+
StripDateIntersection<T4>,
|
|
2589
|
+
StripDateIntersection<T5>,
|
|
2590
|
+
StripDateIntersection<T6>,
|
|
2591
|
+
StripDateIntersection<T7>,
|
|
2592
|
+
StripDateIntersection<T8>,
|
|
2593
|
+
StripDateIntersection<T9>,
|
|
2594
|
+
StripDateIntersection<T10>
|
|
2595
|
+
] : T extends ([
|
|
2596
|
+
infer T1,
|
|
2597
|
+
infer T2,
|
|
2598
|
+
infer T3,
|
|
2599
|
+
infer T4,
|
|
2600
|
+
infer T5,
|
|
2601
|
+
infer T6,
|
|
2602
|
+
infer T7,
|
|
2603
|
+
infer T8,
|
|
2604
|
+
infer T9
|
|
2605
|
+
]) ? [
|
|
2606
|
+
StripDateIntersection<T1>,
|
|
2607
|
+
StripDateIntersection<T2>,
|
|
2608
|
+
StripDateIntersection<T3>,
|
|
2609
|
+
StripDateIntersection<T4>,
|
|
2610
|
+
StripDateIntersection<T5>,
|
|
2611
|
+
StripDateIntersection<T6>,
|
|
2612
|
+
StripDateIntersection<T7>,
|
|
2613
|
+
StripDateIntersection<T8>,
|
|
2614
|
+
StripDateIntersection<T9>
|
|
2615
|
+
] : T extends ([
|
|
2616
|
+
infer T1,
|
|
2617
|
+
infer T2,
|
|
2618
|
+
infer T3,
|
|
2619
|
+
infer T4,
|
|
2620
|
+
infer T5,
|
|
2621
|
+
infer T6,
|
|
2622
|
+
infer T7,
|
|
2623
|
+
infer T8
|
|
2624
|
+
]) ? [
|
|
2625
|
+
StripDateIntersection<T1>,
|
|
2626
|
+
StripDateIntersection<T2>,
|
|
2627
|
+
StripDateIntersection<T3>,
|
|
2628
|
+
StripDateIntersection<T4>,
|
|
2629
|
+
StripDateIntersection<T5>,
|
|
2630
|
+
StripDateIntersection<T6>,
|
|
2631
|
+
StripDateIntersection<T7>,
|
|
2632
|
+
StripDateIntersection<T8>
|
|
2633
|
+
] : T extends ([
|
|
2634
|
+
infer T1,
|
|
2635
|
+
infer T2,
|
|
2636
|
+
infer T3,
|
|
2637
|
+
infer T4,
|
|
2638
|
+
infer T5,
|
|
2639
|
+
infer T6,
|
|
2640
|
+
infer T7
|
|
2641
|
+
]) ? [
|
|
2642
|
+
StripDateIntersection<T1>,
|
|
2643
|
+
StripDateIntersection<T2>,
|
|
2644
|
+
StripDateIntersection<T3>,
|
|
2645
|
+
StripDateIntersection<T4>,
|
|
2646
|
+
StripDateIntersection<T5>,
|
|
2647
|
+
StripDateIntersection<T6>,
|
|
2648
|
+
StripDateIntersection<T7>
|
|
2649
|
+
] : T extends [infer T1, infer T2, infer T3, infer T4, infer T5, infer T6] ? [
|
|
2650
|
+
StripDateIntersection<T1>,
|
|
2651
|
+
StripDateIntersection<T2>,
|
|
2652
|
+
StripDateIntersection<T3>,
|
|
2653
|
+
StripDateIntersection<T4>,
|
|
2654
|
+
StripDateIntersection<T5>,
|
|
2655
|
+
StripDateIntersection<T6>
|
|
2656
|
+
] : T extends [infer T1, infer T2, infer T3, infer T4, infer T5] ? [
|
|
2657
|
+
StripDateIntersection<T1>,
|
|
2658
|
+
StripDateIntersection<T2>,
|
|
2659
|
+
StripDateIntersection<T3>,
|
|
2660
|
+
StripDateIntersection<T4>,
|
|
2661
|
+
StripDateIntersection<T5>
|
|
2662
|
+
] : T extends [infer T1, infer T2, infer T3, infer T4] ? [
|
|
2663
|
+
StripDateIntersection<T1>,
|
|
2664
|
+
StripDateIntersection<T2>,
|
|
2665
|
+
StripDateIntersection<T3>,
|
|
2666
|
+
StripDateIntersection<T4>
|
|
2667
|
+
] : T extends [infer T1, infer T2, infer T3] ? [
|
|
2668
|
+
StripDateIntersection<T1>,
|
|
2669
|
+
StripDateIntersection<T2>,
|
|
2670
|
+
StripDateIntersection<T3>
|
|
2671
|
+
] : T extends [infer T1, infer T2] ? [
|
|
2672
|
+
StripDateIntersection<T1>,
|
|
2673
|
+
StripDateIntersection<T2>
|
|
2674
|
+
] : T extends [infer T1] ? [StripDateIntersection<T1>] : [];
|
|
2675
|
+
|
|
2676
|
+
/**
|
|
2677
|
+
* Configuration for a data source
|
|
2678
|
+
*/
|
|
2679
|
+
interface DataSourceConfig {
|
|
2680
|
+
name: string;
|
|
2681
|
+
supportsIncremental?: boolean;
|
|
2682
|
+
}
|
|
2683
|
+
/**
|
|
2684
|
+
* DataSource is an abstract class that defines the interface for all data sources.
|
|
2685
|
+
* It is used to extract data from a source and test the connection to the source.
|
|
2686
|
+
*/
|
|
2687
|
+
declare abstract class DataSource<T = any, ItemType = any> {
|
|
2688
|
+
protected name: string;
|
|
2689
|
+
protected supportsIncremental: boolean;
|
|
2690
|
+
constructor(config: DataSourceConfig);
|
|
2691
|
+
/**
|
|
2692
|
+
* Extract data from the source
|
|
2693
|
+
* Returns either ItemType (for single requests) or Readable (for paginated requests)
|
|
2694
|
+
*/
|
|
2695
|
+
abstract extract(): Promise<ItemType | Readable>;
|
|
2696
|
+
/**
|
|
2697
|
+
* Test connection to the source
|
|
2698
|
+
*/
|
|
2699
|
+
abstract testConnection(): Promise<{
|
|
2700
|
+
success: boolean;
|
|
2701
|
+
message?: string;
|
|
2702
|
+
}>;
|
|
2703
|
+
}
|
|
2704
|
+
/**
|
|
2705
|
+
* Result returned from extraction
|
|
2706
|
+
* For single requests: data is of type T
|
|
2707
|
+
* For paginated requests: data is a Readable stream yielding items of type T
|
|
2708
|
+
*/
|
|
2709
|
+
interface ExtractionResult<T = any> {
|
|
2710
|
+
data: T | Readable;
|
|
2711
|
+
metadata: Record<string, any>;
|
|
2712
|
+
}
|
|
2713
|
+
|
|
2714
|
+
export { ACKs, type Aggregated, Api, type ApiConfig, type ApiUtil, type CSVParsingConfig, CSV_DELIMITERS, type CliLogData, type ClickHouseByteSize, type ClickHouseCodec, type ClickHouseDecimal, type ClickHouseDefault, ClickHouseEngines, type ClickHouseFixedStringSize, type ClickHouseFloat, type ClickHouseInt, type ClickHouseJson, type ClickHouseMaterialized, type ClickHouseNamedTuple, type ClickHousePrecision, type ClickHouseTTL, ConsumptionApi, type ConsumptionUtil, DEFAULT_CSV_CONFIG, DEFAULT_JSON_CONFIG, DataSource, type DataSourceConfig, type DateTime, type DateTime64, type DateTime64String, type DateTimeString, type DeadLetter, type DeadLetterModel, DeadLetterQueue, type Decimal, ETLPipeline, type ETLPipelineConfig, type EgressConfig, type ExtractionResult, type FixedString, type Float32, type Float64, type FrameworkApp, type IdentifierBrandedString, IngestApi, type IngestConfig, IngestPipeline, type Int16, type Int32, type Int64, type Int8, type JSONParsingConfig, type JWT, type KafkaClientConfig, type Key, LifeCycle, type Logger, type LowCardinality, MAX_RETRIES, MAX_RETRIES_PRODUCER, MAX_RETRY_TIME_MS, MOOSE_RUNTIME_ENV_PREFIX, MaterializedView, type NonIdentifierBrandedString, type OlapConfig, OlapTable, RETRY_FACTOR_PRODUCER, RETRY_INITIAL_TIME_MS, type RawValue, type S3QueueTableSettings, type SimpleAggregated, Sql, SqlResource, type SqlTemplateTag, Stream, type StreamConfig, type StripDateIntersection, Task, type UInt16, type UInt32, type UInt64, type UInt8, type Value, View, WebApp, type WebAppConfig, type WebAppHandler, type WithDefault, Workflow, antiCachePath, cliLog, compilerLog, createClickhouseParameter, getApi, getApis, getFileName, getIngestApi, getIngestApis, getMaterializedView, getMaterializedViews, getSqlResource, getSqlResources, getStream, getStreams, getTable, getTables, getValueFromParameter, getView, getViews, getWebApp, getWebApps, getWorkflow, getWorkflows, isValidCSVDelimiter, logError, mapToClickHouseType, mapTstoJs, mooseEnvSecrets, mooseRuntimeEnv, parseCSV, parseJSON, parseJSONWithDates, quoteIdentifier, sql, toQuery, toQueryPreview, toStaticQuery };
|