@bayoudhi/moose-lib-serverless 0.2.0 → 0.2.1
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 +128 -141
- package/dist/index.d.ts +128 -141
- package/dist/index.js +673 -536
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +673 -536
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,12 +1,83 @@
|
|
|
1
1
|
import { Readable } from 'node:stream';
|
|
2
2
|
import { IsTuple } from 'typia/lib/typings/IsTuple';
|
|
3
3
|
import { IJsonSchemaCollection as IJsonSchemaCollection$1, tags } from 'typia';
|
|
4
|
+
import { IJsonSchemaCollection } from 'typia/src/schemas/json/IJsonSchemaCollection';
|
|
5
|
+
import { Pattern, TagBase } from 'typia/lib/tags';
|
|
4
6
|
import { ClickHouseClient, ResultSet, CommandResult } from '@clickhouse/client';
|
|
5
7
|
import { Client } from '@temporalio/client';
|
|
6
8
|
import { JWTPayload } from 'jose';
|
|
7
9
|
import http from 'http';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Quote a ClickHouse identifier with backticks if not already quoted.
|
|
13
|
+
* Backticks allow special characters (e.g., hyphens) in identifiers.
|
|
14
|
+
*/
|
|
15
|
+
declare const quoteIdentifier: (name: string) => string;
|
|
16
|
+
type IdentifierBrandedString = string & {
|
|
17
|
+
readonly __identifier_brand?: unique symbol;
|
|
18
|
+
};
|
|
19
|
+
type NonIdentifierBrandedString = string & {
|
|
20
|
+
readonly __identifier_brand?: unique symbol;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Values supported by SQL engine.
|
|
24
|
+
*/
|
|
25
|
+
type Value = NonIdentifierBrandedString | number | boolean | Date | [string, string];
|
|
26
|
+
/**
|
|
27
|
+
* Supported value or SQL instance.
|
|
28
|
+
*/
|
|
29
|
+
type RawValue = Value | Sql;
|
|
30
|
+
/**
|
|
31
|
+
* Sql template tag interface with attached helper methods.
|
|
32
|
+
*/
|
|
33
|
+
interface SqlTemplateTag {
|
|
34
|
+
(strings: readonly string[], ...values: readonly (RawValue | Column | OlapTable<any> | View)[]): Sql;
|
|
35
|
+
/**
|
|
36
|
+
* Join an array of Sql fragments with a separator.
|
|
37
|
+
* @param fragments - Array of Sql fragments to join
|
|
38
|
+
* @param separator - Optional separator string (defaults to ", ")
|
|
39
|
+
*/
|
|
40
|
+
join(fragments: Sql[], separator?: string): Sql;
|
|
41
|
+
/**
|
|
42
|
+
* Create raw SQL from a string without parameterization.
|
|
43
|
+
* WARNING: SQL injection risk if used with untrusted input.
|
|
44
|
+
*/
|
|
45
|
+
raw(text: string): Sql;
|
|
46
|
+
}
|
|
47
|
+
declare const sql: SqlTemplateTag;
|
|
48
|
+
/**
|
|
49
|
+
* A SQL instance can be nested within each other to build SQL strings.
|
|
50
|
+
*/
|
|
51
|
+
declare class Sql {
|
|
52
|
+
readonly values: Value[];
|
|
53
|
+
readonly strings: string[];
|
|
54
|
+
constructor(rawStrings: readonly string[], rawValues: readonly (RawValue | Column | OlapTable<any> | View | Sql)[]);
|
|
55
|
+
/**
|
|
56
|
+
* Append another Sql fragment, returning a new Sql instance.
|
|
57
|
+
*/
|
|
58
|
+
append(other: Sql): Sql;
|
|
59
|
+
}
|
|
60
|
+
declare const toStaticQuery: (sql: Sql) => string;
|
|
61
|
+
declare const toQuery: (sql: Sql) => [string, {
|
|
62
|
+
[pN: string]: any;
|
|
63
|
+
}];
|
|
64
|
+
/**
|
|
65
|
+
* Build a display-only SQL string with values inlined for logging/debugging.
|
|
66
|
+
* Does not alter execution behavior; use toQuery for actual execution.
|
|
67
|
+
*/
|
|
68
|
+
declare const toQueryPreview: (sql: Sql) => string;
|
|
69
|
+
declare const getValueFromParameter: (value: any) => any;
|
|
70
|
+
declare function createClickhouseParameter(parameterIndex: number, value: Value): string;
|
|
71
|
+
/**
|
|
72
|
+
* Convert the JS type (source is JSON format by API query parameter) to the corresponding ClickHouse type for generating named placeholder of parameterized query.
|
|
73
|
+
* Only support to convert number to Int or Float, boolean to Bool, string to String, other types will convert to String.
|
|
74
|
+
* If exist complex type e.g: object, Array, null, undefined, Date, Record.. etc, just convert to string type by ClickHouse function in SQL.
|
|
75
|
+
* ClickHouse support converting string to other types function.
|
|
76
|
+
* Please see Each section of the https://clickhouse.com/docs/en/sql-reference/functions and https://clickhouse.com/docs/en/sql-reference/functions/type-conversion-functions
|
|
77
|
+
* @param value
|
|
78
|
+
* @returns 'Float', 'Int', 'Bool', 'String'
|
|
79
|
+
*/
|
|
80
|
+
declare const mapToClickHouseType: (value: Value) => string;
|
|
10
81
|
|
|
11
82
|
type EnumValues = {
|
|
12
83
|
name: string;
|
|
@@ -1647,6 +1718,53 @@ declare class IngestApi<T> extends TypedBase<T, IngestConfig<T>> {
|
|
|
1647
1718
|
constructor(name: string, config: IngestConfig<T>, schema: IJsonSchemaCollection$1.IV3_1, columns: Column[], validators: undefined, allowExtraFields: boolean);
|
|
1648
1719
|
}
|
|
1649
1720
|
|
|
1721
|
+
/**
|
|
1722
|
+
* Utilities provided by getMooseUtils() for database access and SQL queries.
|
|
1723
|
+
* Works in both Moose runtime and standalone contexts.
|
|
1724
|
+
*/
|
|
1725
|
+
interface MooseUtils {
|
|
1726
|
+
client: MooseClient;
|
|
1727
|
+
sql: typeof sql;
|
|
1728
|
+
jwt?: JWTPayload;
|
|
1729
|
+
}
|
|
1730
|
+
/**
|
|
1731
|
+
* @deprecated Use MooseUtils instead. ApiUtil is now a type alias to MooseUtils
|
|
1732
|
+
* and will be removed in a future version.
|
|
1733
|
+
*
|
|
1734
|
+
* Migration: Replace `ApiUtil` with `MooseUtils` in your type annotations.
|
|
1735
|
+
*/
|
|
1736
|
+
type ApiUtil = MooseUtils;
|
|
1737
|
+
/** @deprecated Use MooseUtils instead. */
|
|
1738
|
+
type ConsumptionUtil = MooseUtils;
|
|
1739
|
+
declare class MooseClient {
|
|
1740
|
+
query: QueryClient;
|
|
1741
|
+
workflow: WorkflowClient;
|
|
1742
|
+
constructor(queryClient: QueryClient, temporalClient?: Client);
|
|
1743
|
+
}
|
|
1744
|
+
declare class QueryClient {
|
|
1745
|
+
client: ClickHouseClient;
|
|
1746
|
+
query_id_prefix: string;
|
|
1747
|
+
constructor(client: ClickHouseClient, query_id_prefix: string);
|
|
1748
|
+
execute<T = any>(sql: Sql): Promise<ResultSet<"JSONEachRow"> & {
|
|
1749
|
+
__query_result_t?: T[];
|
|
1750
|
+
}>;
|
|
1751
|
+
command(sql: Sql): Promise<CommandResult>;
|
|
1752
|
+
}
|
|
1753
|
+
declare class WorkflowClient {
|
|
1754
|
+
client: Client | undefined;
|
|
1755
|
+
constructor(temporalClient?: Client);
|
|
1756
|
+
execute(name: string, input_data: any): Promise<{
|
|
1757
|
+
status: number;
|
|
1758
|
+
body: string;
|
|
1759
|
+
}>;
|
|
1760
|
+
terminate(workflowId: string): Promise<{
|
|
1761
|
+
status: number;
|
|
1762
|
+
body: string;
|
|
1763
|
+
}>;
|
|
1764
|
+
private getWorkflowConfig;
|
|
1765
|
+
private processInputData;
|
|
1766
|
+
}
|
|
1767
|
+
|
|
1650
1768
|
/**
|
|
1651
1769
|
* Defines the signature for a handler function used by a Consumption API.
|
|
1652
1770
|
* @template T The expected type of the request parameters or query parameters.
|
|
@@ -2220,140 +2338,9 @@ type SimpleAggregated<AggregationFunction extends string, ArgType = any> = {
|
|
|
2220
2338
|
_argType?: ArgType;
|
|
2221
2339
|
};
|
|
2222
2340
|
|
|
2223
|
-
/**
|
|
2224
|
-
* Quote a ClickHouse identifier with backticks if not already quoted.
|
|
2225
|
-
* Backticks allow special characters (e.g., hyphens) in identifiers.
|
|
2226
|
-
*/
|
|
2227
|
-
declare const quoteIdentifier: (name: string) => string;
|
|
2228
|
-
type IdentifierBrandedString = string & {
|
|
2229
|
-
readonly __identifier_brand?: unique symbol;
|
|
2230
|
-
};
|
|
2231
|
-
type NonIdentifierBrandedString = string & {
|
|
2232
|
-
readonly __identifier_brand?: unique symbol;
|
|
2233
|
-
};
|
|
2234
|
-
/**
|
|
2235
|
-
* Values supported by SQL engine.
|
|
2236
|
-
*/
|
|
2237
|
-
type Value = NonIdentifierBrandedString | number | boolean | Date | [string, string];
|
|
2238
|
-
/**
|
|
2239
|
-
* Supported value or SQL instance.
|
|
2240
|
-
*/
|
|
2241
|
-
type RawValue = Value | Sql;
|
|
2242
|
-
/**
|
|
2243
|
-
* Sql template tag interface with attached helper methods.
|
|
2244
|
-
*/
|
|
2245
|
-
interface SqlTemplateTag {
|
|
2246
|
-
(strings: readonly string[], ...values: readonly (RawValue | Column | OlapTable<any> | View)[]): Sql;
|
|
2247
|
-
/**
|
|
2248
|
-
* Join an array of Sql fragments with a separator.
|
|
2249
|
-
* @param fragments - Array of Sql fragments to join
|
|
2250
|
-
* @param separator - Optional separator string (defaults to ", ")
|
|
2251
|
-
*/
|
|
2252
|
-
join(fragments: Sql[], separator?: string): Sql;
|
|
2253
|
-
/**
|
|
2254
|
-
* Create raw SQL from a string without parameterization.
|
|
2255
|
-
* WARNING: SQL injection risk if used with untrusted input.
|
|
2256
|
-
*/
|
|
2257
|
-
raw(text: string): Sql;
|
|
2258
|
-
}
|
|
2259
|
-
declare const sql: SqlTemplateTag;
|
|
2260
|
-
/**
|
|
2261
|
-
* A SQL instance can be nested within each other to build SQL strings.
|
|
2262
|
-
*/
|
|
2263
|
-
declare class Sql {
|
|
2264
|
-
readonly values: Value[];
|
|
2265
|
-
readonly strings: string[];
|
|
2266
|
-
constructor(rawStrings: readonly string[], rawValues: readonly (RawValue | Column | OlapTable<any> | View | Sql)[]);
|
|
2267
|
-
/**
|
|
2268
|
-
* Append another Sql fragment, returning a new Sql instance.
|
|
2269
|
-
*/
|
|
2270
|
-
append(other: Sql): Sql;
|
|
2271
|
-
}
|
|
2272
|
-
declare const toStaticQuery: (sql: Sql) => string;
|
|
2273
|
-
declare const toQuery: (sql: Sql) => [string, {
|
|
2274
|
-
[pN: string]: any;
|
|
2275
|
-
}];
|
|
2276
|
-
/**
|
|
2277
|
-
* Build a display-only SQL string with values inlined for logging/debugging.
|
|
2278
|
-
* Does not alter execution behavior; use toQuery for actual execution.
|
|
2279
|
-
*/
|
|
2280
|
-
declare const toQueryPreview: (sql: Sql) => string;
|
|
2281
|
-
declare const getValueFromParameter: (value: any) => any;
|
|
2282
|
-
declare function createClickhouseParameter(parameterIndex: number, value: Value): string;
|
|
2283
|
-
/**
|
|
2284
|
-
* Convert the JS type (source is JSON format by API query parameter) to the corresponding ClickHouse type for generating named placeholder of parameterized query.
|
|
2285
|
-
* Only support to convert number to Int or Float, boolean to Bool, string to String, other types will convert to String.
|
|
2286
|
-
* If exist complex type e.g: object, Array, null, undefined, Date, Record.. etc, just convert to string type by ClickHouse function in SQL.
|
|
2287
|
-
* ClickHouse support converting string to other types function.
|
|
2288
|
-
* Please see Each section of the https://clickhouse.com/docs/en/sql-reference/functions and https://clickhouse.com/docs/en/sql-reference/functions/type-conversion-functions
|
|
2289
|
-
* @param value
|
|
2290
|
-
* @returns 'Float', 'Int', 'Bool', 'String'
|
|
2291
|
-
*/
|
|
2292
|
-
declare const mapToClickHouseType: (value: Value) => string;
|
|
2293
|
-
|
|
2294
|
-
/**
|
|
2295
|
-
* Utilities provided by getMooseUtils() for database access and SQL queries.
|
|
2296
|
-
* Works in both Moose runtime and standalone contexts.
|
|
2297
|
-
*/
|
|
2298
|
-
interface MooseUtils {
|
|
2299
|
-
client: MooseClient;
|
|
2300
|
-
sql: typeof sql;
|
|
2301
|
-
jwt?: JWTPayload;
|
|
2302
|
-
}
|
|
2303
|
-
/**
|
|
2304
|
-
* @deprecated Use MooseUtils instead. ApiUtil is now a type alias to MooseUtils
|
|
2305
|
-
* and will be removed in a future version.
|
|
2306
|
-
*
|
|
2307
|
-
* Migration: Replace `ApiUtil` with `MooseUtils` in your type annotations.
|
|
2308
|
-
*/
|
|
2309
|
-
type ApiUtil = MooseUtils;
|
|
2310
|
-
/** @deprecated Use MooseUtils instead. */
|
|
2311
|
-
type ConsumptionUtil = MooseUtils;
|
|
2312
|
-
declare class MooseClient {
|
|
2313
|
-
query: QueryClient;
|
|
2314
|
-
workflow: WorkflowClient;
|
|
2315
|
-
constructor(queryClient: QueryClient, temporalClient?: Client);
|
|
2316
|
-
}
|
|
2317
|
-
declare class QueryClient {
|
|
2318
|
-
client: ClickHouseClient;
|
|
2319
|
-
query_id_prefix: string;
|
|
2320
|
-
constructor(client: ClickHouseClient, query_id_prefix: string);
|
|
2321
|
-
execute<T = any>(sql: Sql): Promise<ResultSet<"JSONEachRow"> & {
|
|
2322
|
-
__query_result_t?: T[];
|
|
2323
|
-
}>;
|
|
2324
|
-
command(sql: Sql): Promise<CommandResult>;
|
|
2325
|
-
}
|
|
2326
|
-
declare class WorkflowClient {
|
|
2327
|
-
client: Client | undefined;
|
|
2328
|
-
constructor(temporalClient?: Client);
|
|
2329
|
-
execute(name: string, input_data: any): Promise<{
|
|
2330
|
-
status: number;
|
|
2331
|
-
body: string;
|
|
2332
|
-
}>;
|
|
2333
|
-
terminate(workflowId: string): Promise<{
|
|
2334
|
-
status: number;
|
|
2335
|
-
body: string;
|
|
2336
|
-
}>;
|
|
2337
|
-
private getWorkflowConfig;
|
|
2338
|
-
private processInputData;
|
|
2339
|
-
}
|
|
2340
|
-
|
|
2341
2341
|
type Key<T extends string | number | Date> = T;
|
|
2342
2342
|
type JWT<T extends object> = T;
|
|
2343
2343
|
|
|
2344
|
-
/**
|
|
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
|
|
2352
|
-
*/
|
|
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
2344
|
declare const compilerLog: (message: string) => void;
|
|
2358
2345
|
declare const antiCachePath: (path: string) => string;
|
|
2359
2346
|
declare const getFileName: (filePath: string) => string;
|
|
@@ -2374,6 +2361,14 @@ declare const RETRY_INITIAL_TIME_MS = 100;
|
|
|
2374
2361
|
declare const MAX_RETRIES_PRODUCER = 150;
|
|
2375
2362
|
declare const RETRY_FACTOR_PRODUCER = 0.2;
|
|
2376
2363
|
declare const ACKs = -1;
|
|
2364
|
+
type KafkaClientConfig = {
|
|
2365
|
+
clientId: string;
|
|
2366
|
+
broker: string;
|
|
2367
|
+
securityProtocol?: string;
|
|
2368
|
+
saslUsername?: string;
|
|
2369
|
+
saslPassword?: string;
|
|
2370
|
+
saslMechanism?: string;
|
|
2371
|
+
};
|
|
2377
2372
|
/**
|
|
2378
2373
|
* Interface for logging functionality
|
|
2379
2374
|
*/
|
|
@@ -2384,14 +2379,6 @@ interface Logger {
|
|
|
2384
2379
|
warn: (message: string) => void;
|
|
2385
2380
|
}
|
|
2386
2381
|
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;
|
|
2394
|
-
};
|
|
2395
2382
|
|
|
2396
2383
|
/**
|
|
2397
2384
|
* @module secrets
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,83 @@
|
|
|
1
1
|
import { Readable } from 'node:stream';
|
|
2
2
|
import { IsTuple } from 'typia/lib/typings/IsTuple';
|
|
3
3
|
import { IJsonSchemaCollection as IJsonSchemaCollection$1, tags } from 'typia';
|
|
4
|
+
import { IJsonSchemaCollection } from 'typia/src/schemas/json/IJsonSchemaCollection';
|
|
5
|
+
import { Pattern, TagBase } from 'typia/lib/tags';
|
|
4
6
|
import { ClickHouseClient, ResultSet, CommandResult } from '@clickhouse/client';
|
|
5
7
|
import { Client } from '@temporalio/client';
|
|
6
8
|
import { JWTPayload } from 'jose';
|
|
7
9
|
import http from 'http';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Quote a ClickHouse identifier with backticks if not already quoted.
|
|
13
|
+
* Backticks allow special characters (e.g., hyphens) in identifiers.
|
|
14
|
+
*/
|
|
15
|
+
declare const quoteIdentifier: (name: string) => string;
|
|
16
|
+
type IdentifierBrandedString = string & {
|
|
17
|
+
readonly __identifier_brand?: unique symbol;
|
|
18
|
+
};
|
|
19
|
+
type NonIdentifierBrandedString = string & {
|
|
20
|
+
readonly __identifier_brand?: unique symbol;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Values supported by SQL engine.
|
|
24
|
+
*/
|
|
25
|
+
type Value = NonIdentifierBrandedString | number | boolean | Date | [string, string];
|
|
26
|
+
/**
|
|
27
|
+
* Supported value or SQL instance.
|
|
28
|
+
*/
|
|
29
|
+
type RawValue = Value | Sql;
|
|
30
|
+
/**
|
|
31
|
+
* Sql template tag interface with attached helper methods.
|
|
32
|
+
*/
|
|
33
|
+
interface SqlTemplateTag {
|
|
34
|
+
(strings: readonly string[], ...values: readonly (RawValue | Column | OlapTable<any> | View)[]): Sql;
|
|
35
|
+
/**
|
|
36
|
+
* Join an array of Sql fragments with a separator.
|
|
37
|
+
* @param fragments - Array of Sql fragments to join
|
|
38
|
+
* @param separator - Optional separator string (defaults to ", ")
|
|
39
|
+
*/
|
|
40
|
+
join(fragments: Sql[], separator?: string): Sql;
|
|
41
|
+
/**
|
|
42
|
+
* Create raw SQL from a string without parameterization.
|
|
43
|
+
* WARNING: SQL injection risk if used with untrusted input.
|
|
44
|
+
*/
|
|
45
|
+
raw(text: string): Sql;
|
|
46
|
+
}
|
|
47
|
+
declare const sql: SqlTemplateTag;
|
|
48
|
+
/**
|
|
49
|
+
* A SQL instance can be nested within each other to build SQL strings.
|
|
50
|
+
*/
|
|
51
|
+
declare class Sql {
|
|
52
|
+
readonly values: Value[];
|
|
53
|
+
readonly strings: string[];
|
|
54
|
+
constructor(rawStrings: readonly string[], rawValues: readonly (RawValue | Column | OlapTable<any> | View | Sql)[]);
|
|
55
|
+
/**
|
|
56
|
+
* Append another Sql fragment, returning a new Sql instance.
|
|
57
|
+
*/
|
|
58
|
+
append(other: Sql): Sql;
|
|
59
|
+
}
|
|
60
|
+
declare const toStaticQuery: (sql: Sql) => string;
|
|
61
|
+
declare const toQuery: (sql: Sql) => [string, {
|
|
62
|
+
[pN: string]: any;
|
|
63
|
+
}];
|
|
64
|
+
/**
|
|
65
|
+
* Build a display-only SQL string with values inlined for logging/debugging.
|
|
66
|
+
* Does not alter execution behavior; use toQuery for actual execution.
|
|
67
|
+
*/
|
|
68
|
+
declare const toQueryPreview: (sql: Sql) => string;
|
|
69
|
+
declare const getValueFromParameter: (value: any) => any;
|
|
70
|
+
declare function createClickhouseParameter(parameterIndex: number, value: Value): string;
|
|
71
|
+
/**
|
|
72
|
+
* Convert the JS type (source is JSON format by API query parameter) to the corresponding ClickHouse type for generating named placeholder of parameterized query.
|
|
73
|
+
* Only support to convert number to Int or Float, boolean to Bool, string to String, other types will convert to String.
|
|
74
|
+
* If exist complex type e.g: object, Array, null, undefined, Date, Record.. etc, just convert to string type by ClickHouse function in SQL.
|
|
75
|
+
* ClickHouse support converting string to other types function.
|
|
76
|
+
* Please see Each section of the https://clickhouse.com/docs/en/sql-reference/functions and https://clickhouse.com/docs/en/sql-reference/functions/type-conversion-functions
|
|
77
|
+
* @param value
|
|
78
|
+
* @returns 'Float', 'Int', 'Bool', 'String'
|
|
79
|
+
*/
|
|
80
|
+
declare const mapToClickHouseType: (value: Value) => string;
|
|
10
81
|
|
|
11
82
|
type EnumValues = {
|
|
12
83
|
name: string;
|
|
@@ -1647,6 +1718,53 @@ declare class IngestApi<T> extends TypedBase<T, IngestConfig<T>> {
|
|
|
1647
1718
|
constructor(name: string, config: IngestConfig<T>, schema: IJsonSchemaCollection$1.IV3_1, columns: Column[], validators: undefined, allowExtraFields: boolean);
|
|
1648
1719
|
}
|
|
1649
1720
|
|
|
1721
|
+
/**
|
|
1722
|
+
* Utilities provided by getMooseUtils() for database access and SQL queries.
|
|
1723
|
+
* Works in both Moose runtime and standalone contexts.
|
|
1724
|
+
*/
|
|
1725
|
+
interface MooseUtils {
|
|
1726
|
+
client: MooseClient;
|
|
1727
|
+
sql: typeof sql;
|
|
1728
|
+
jwt?: JWTPayload;
|
|
1729
|
+
}
|
|
1730
|
+
/**
|
|
1731
|
+
* @deprecated Use MooseUtils instead. ApiUtil is now a type alias to MooseUtils
|
|
1732
|
+
* and will be removed in a future version.
|
|
1733
|
+
*
|
|
1734
|
+
* Migration: Replace `ApiUtil` with `MooseUtils` in your type annotations.
|
|
1735
|
+
*/
|
|
1736
|
+
type ApiUtil = MooseUtils;
|
|
1737
|
+
/** @deprecated Use MooseUtils instead. */
|
|
1738
|
+
type ConsumptionUtil = MooseUtils;
|
|
1739
|
+
declare class MooseClient {
|
|
1740
|
+
query: QueryClient;
|
|
1741
|
+
workflow: WorkflowClient;
|
|
1742
|
+
constructor(queryClient: QueryClient, temporalClient?: Client);
|
|
1743
|
+
}
|
|
1744
|
+
declare class QueryClient {
|
|
1745
|
+
client: ClickHouseClient;
|
|
1746
|
+
query_id_prefix: string;
|
|
1747
|
+
constructor(client: ClickHouseClient, query_id_prefix: string);
|
|
1748
|
+
execute<T = any>(sql: Sql): Promise<ResultSet<"JSONEachRow"> & {
|
|
1749
|
+
__query_result_t?: T[];
|
|
1750
|
+
}>;
|
|
1751
|
+
command(sql: Sql): Promise<CommandResult>;
|
|
1752
|
+
}
|
|
1753
|
+
declare class WorkflowClient {
|
|
1754
|
+
client: Client | undefined;
|
|
1755
|
+
constructor(temporalClient?: Client);
|
|
1756
|
+
execute(name: string, input_data: any): Promise<{
|
|
1757
|
+
status: number;
|
|
1758
|
+
body: string;
|
|
1759
|
+
}>;
|
|
1760
|
+
terminate(workflowId: string): Promise<{
|
|
1761
|
+
status: number;
|
|
1762
|
+
body: string;
|
|
1763
|
+
}>;
|
|
1764
|
+
private getWorkflowConfig;
|
|
1765
|
+
private processInputData;
|
|
1766
|
+
}
|
|
1767
|
+
|
|
1650
1768
|
/**
|
|
1651
1769
|
* Defines the signature for a handler function used by a Consumption API.
|
|
1652
1770
|
* @template T The expected type of the request parameters or query parameters.
|
|
@@ -2220,140 +2338,9 @@ type SimpleAggregated<AggregationFunction extends string, ArgType = any> = {
|
|
|
2220
2338
|
_argType?: ArgType;
|
|
2221
2339
|
};
|
|
2222
2340
|
|
|
2223
|
-
/**
|
|
2224
|
-
* Quote a ClickHouse identifier with backticks if not already quoted.
|
|
2225
|
-
* Backticks allow special characters (e.g., hyphens) in identifiers.
|
|
2226
|
-
*/
|
|
2227
|
-
declare const quoteIdentifier: (name: string) => string;
|
|
2228
|
-
type IdentifierBrandedString = string & {
|
|
2229
|
-
readonly __identifier_brand?: unique symbol;
|
|
2230
|
-
};
|
|
2231
|
-
type NonIdentifierBrandedString = string & {
|
|
2232
|
-
readonly __identifier_brand?: unique symbol;
|
|
2233
|
-
};
|
|
2234
|
-
/**
|
|
2235
|
-
* Values supported by SQL engine.
|
|
2236
|
-
*/
|
|
2237
|
-
type Value = NonIdentifierBrandedString | number | boolean | Date | [string, string];
|
|
2238
|
-
/**
|
|
2239
|
-
* Supported value or SQL instance.
|
|
2240
|
-
*/
|
|
2241
|
-
type RawValue = Value | Sql;
|
|
2242
|
-
/**
|
|
2243
|
-
* Sql template tag interface with attached helper methods.
|
|
2244
|
-
*/
|
|
2245
|
-
interface SqlTemplateTag {
|
|
2246
|
-
(strings: readonly string[], ...values: readonly (RawValue | Column | OlapTable<any> | View)[]): Sql;
|
|
2247
|
-
/**
|
|
2248
|
-
* Join an array of Sql fragments with a separator.
|
|
2249
|
-
* @param fragments - Array of Sql fragments to join
|
|
2250
|
-
* @param separator - Optional separator string (defaults to ", ")
|
|
2251
|
-
*/
|
|
2252
|
-
join(fragments: Sql[], separator?: string): Sql;
|
|
2253
|
-
/**
|
|
2254
|
-
* Create raw SQL from a string without parameterization.
|
|
2255
|
-
* WARNING: SQL injection risk if used with untrusted input.
|
|
2256
|
-
*/
|
|
2257
|
-
raw(text: string): Sql;
|
|
2258
|
-
}
|
|
2259
|
-
declare const sql: SqlTemplateTag;
|
|
2260
|
-
/**
|
|
2261
|
-
* A SQL instance can be nested within each other to build SQL strings.
|
|
2262
|
-
*/
|
|
2263
|
-
declare class Sql {
|
|
2264
|
-
readonly values: Value[];
|
|
2265
|
-
readonly strings: string[];
|
|
2266
|
-
constructor(rawStrings: readonly string[], rawValues: readonly (RawValue | Column | OlapTable<any> | View | Sql)[]);
|
|
2267
|
-
/**
|
|
2268
|
-
* Append another Sql fragment, returning a new Sql instance.
|
|
2269
|
-
*/
|
|
2270
|
-
append(other: Sql): Sql;
|
|
2271
|
-
}
|
|
2272
|
-
declare const toStaticQuery: (sql: Sql) => string;
|
|
2273
|
-
declare const toQuery: (sql: Sql) => [string, {
|
|
2274
|
-
[pN: string]: any;
|
|
2275
|
-
}];
|
|
2276
|
-
/**
|
|
2277
|
-
* Build a display-only SQL string with values inlined for logging/debugging.
|
|
2278
|
-
* Does not alter execution behavior; use toQuery for actual execution.
|
|
2279
|
-
*/
|
|
2280
|
-
declare const toQueryPreview: (sql: Sql) => string;
|
|
2281
|
-
declare const getValueFromParameter: (value: any) => any;
|
|
2282
|
-
declare function createClickhouseParameter(parameterIndex: number, value: Value): string;
|
|
2283
|
-
/**
|
|
2284
|
-
* Convert the JS type (source is JSON format by API query parameter) to the corresponding ClickHouse type for generating named placeholder of parameterized query.
|
|
2285
|
-
* Only support to convert number to Int or Float, boolean to Bool, string to String, other types will convert to String.
|
|
2286
|
-
* If exist complex type e.g: object, Array, null, undefined, Date, Record.. etc, just convert to string type by ClickHouse function in SQL.
|
|
2287
|
-
* ClickHouse support converting string to other types function.
|
|
2288
|
-
* Please see Each section of the https://clickhouse.com/docs/en/sql-reference/functions and https://clickhouse.com/docs/en/sql-reference/functions/type-conversion-functions
|
|
2289
|
-
* @param value
|
|
2290
|
-
* @returns 'Float', 'Int', 'Bool', 'String'
|
|
2291
|
-
*/
|
|
2292
|
-
declare const mapToClickHouseType: (value: Value) => string;
|
|
2293
|
-
|
|
2294
|
-
/**
|
|
2295
|
-
* Utilities provided by getMooseUtils() for database access and SQL queries.
|
|
2296
|
-
* Works in both Moose runtime and standalone contexts.
|
|
2297
|
-
*/
|
|
2298
|
-
interface MooseUtils {
|
|
2299
|
-
client: MooseClient;
|
|
2300
|
-
sql: typeof sql;
|
|
2301
|
-
jwt?: JWTPayload;
|
|
2302
|
-
}
|
|
2303
|
-
/**
|
|
2304
|
-
* @deprecated Use MooseUtils instead. ApiUtil is now a type alias to MooseUtils
|
|
2305
|
-
* and will be removed in a future version.
|
|
2306
|
-
*
|
|
2307
|
-
* Migration: Replace `ApiUtil` with `MooseUtils` in your type annotations.
|
|
2308
|
-
*/
|
|
2309
|
-
type ApiUtil = MooseUtils;
|
|
2310
|
-
/** @deprecated Use MooseUtils instead. */
|
|
2311
|
-
type ConsumptionUtil = MooseUtils;
|
|
2312
|
-
declare class MooseClient {
|
|
2313
|
-
query: QueryClient;
|
|
2314
|
-
workflow: WorkflowClient;
|
|
2315
|
-
constructor(queryClient: QueryClient, temporalClient?: Client);
|
|
2316
|
-
}
|
|
2317
|
-
declare class QueryClient {
|
|
2318
|
-
client: ClickHouseClient;
|
|
2319
|
-
query_id_prefix: string;
|
|
2320
|
-
constructor(client: ClickHouseClient, query_id_prefix: string);
|
|
2321
|
-
execute<T = any>(sql: Sql): Promise<ResultSet<"JSONEachRow"> & {
|
|
2322
|
-
__query_result_t?: T[];
|
|
2323
|
-
}>;
|
|
2324
|
-
command(sql: Sql): Promise<CommandResult>;
|
|
2325
|
-
}
|
|
2326
|
-
declare class WorkflowClient {
|
|
2327
|
-
client: Client | undefined;
|
|
2328
|
-
constructor(temporalClient?: Client);
|
|
2329
|
-
execute(name: string, input_data: any): Promise<{
|
|
2330
|
-
status: number;
|
|
2331
|
-
body: string;
|
|
2332
|
-
}>;
|
|
2333
|
-
terminate(workflowId: string): Promise<{
|
|
2334
|
-
status: number;
|
|
2335
|
-
body: string;
|
|
2336
|
-
}>;
|
|
2337
|
-
private getWorkflowConfig;
|
|
2338
|
-
private processInputData;
|
|
2339
|
-
}
|
|
2340
|
-
|
|
2341
2341
|
type Key<T extends string | number | Date> = T;
|
|
2342
2342
|
type JWT<T extends object> = T;
|
|
2343
2343
|
|
|
2344
|
-
/**
|
|
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
|
|
2352
|
-
*/
|
|
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
2344
|
declare const compilerLog: (message: string) => void;
|
|
2358
2345
|
declare const antiCachePath: (path: string) => string;
|
|
2359
2346
|
declare const getFileName: (filePath: string) => string;
|
|
@@ -2374,6 +2361,14 @@ declare const RETRY_INITIAL_TIME_MS = 100;
|
|
|
2374
2361
|
declare const MAX_RETRIES_PRODUCER = 150;
|
|
2375
2362
|
declare const RETRY_FACTOR_PRODUCER = 0.2;
|
|
2376
2363
|
declare const ACKs = -1;
|
|
2364
|
+
type KafkaClientConfig = {
|
|
2365
|
+
clientId: string;
|
|
2366
|
+
broker: string;
|
|
2367
|
+
securityProtocol?: string;
|
|
2368
|
+
saslUsername?: string;
|
|
2369
|
+
saslPassword?: string;
|
|
2370
|
+
saslMechanism?: string;
|
|
2371
|
+
};
|
|
2377
2372
|
/**
|
|
2378
2373
|
* Interface for logging functionality
|
|
2379
2374
|
*/
|
|
@@ -2384,14 +2379,6 @@ interface Logger {
|
|
|
2384
2379
|
warn: (message: string) => void;
|
|
2385
2380
|
}
|
|
2386
2381
|
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;
|
|
2394
|
-
};
|
|
2395
2382
|
|
|
2396
2383
|
/**
|
|
2397
2384
|
* @module secrets
|