@bayoudhi/moose-lib-serverless 0.1.2 → 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} +155 -166
- package/dist/index.js.map +1 -0
- package/dist/{serverless.mjs → index.mjs} +91 -86
- 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
|
@@ -5,8 +5,8 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var
|
|
9
|
-
return
|
|
8
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
9
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
10
|
};
|
|
11
11
|
var __export = (target, all) => {
|
|
12
12
|
for (var name in all)
|
|
@@ -30,7 +30,115 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
30
|
));
|
|
31
31
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
32
|
|
|
33
|
-
//
|
|
33
|
+
// stub-native:@514labs/kafka-javascript
|
|
34
|
+
var require_kafka_javascript = __commonJS({
|
|
35
|
+
"stub-native:@514labs/kafka-javascript"(exports2, module2) {
|
|
36
|
+
"use strict";
|
|
37
|
+
module2.exports = {};
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
// stub-native:@kafkajs/confluent-schema-registry
|
|
42
|
+
var require_confluent_schema_registry = __commonJS({
|
|
43
|
+
"stub-native:@kafkajs/confluent-schema-registry"(exports2, module2) {
|
|
44
|
+
"use strict";
|
|
45
|
+
module2.exports = {};
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
// src/index.ts
|
|
50
|
+
var index_exports = {};
|
|
51
|
+
__export(index_exports, {
|
|
52
|
+
ACKs: () => ACKs,
|
|
53
|
+
Api: () => Api,
|
|
54
|
+
CSV_DELIMITERS: () => CSV_DELIMITERS,
|
|
55
|
+
ClickHouseEngines: () => ClickHouseEngines,
|
|
56
|
+
ConsumptionApi: () => ConsumptionApi,
|
|
57
|
+
DEFAULT_CSV_CONFIG: () => DEFAULT_CSV_CONFIG,
|
|
58
|
+
DEFAULT_JSON_CONFIG: () => DEFAULT_JSON_CONFIG,
|
|
59
|
+
DataSource: () => DataSource,
|
|
60
|
+
DeadLetterQueue: () => DeadLetterQueue,
|
|
61
|
+
ETLPipeline: () => ETLPipeline,
|
|
62
|
+
IngestApi: () => IngestApi,
|
|
63
|
+
IngestPipeline: () => IngestPipeline,
|
|
64
|
+
LifeCycle: () => LifeCycle,
|
|
65
|
+
MAX_RETRIES: () => MAX_RETRIES,
|
|
66
|
+
MAX_RETRIES_PRODUCER: () => MAX_RETRIES_PRODUCER,
|
|
67
|
+
MAX_RETRY_TIME_MS: () => MAX_RETRY_TIME_MS,
|
|
68
|
+
MOOSE_RUNTIME_ENV_PREFIX: () => MOOSE_RUNTIME_ENV_PREFIX,
|
|
69
|
+
MaterializedView: () => MaterializedView,
|
|
70
|
+
OlapTable: () => OlapTable,
|
|
71
|
+
RETRY_FACTOR_PRODUCER: () => RETRY_FACTOR_PRODUCER,
|
|
72
|
+
RETRY_INITIAL_TIME_MS: () => RETRY_INITIAL_TIME_MS,
|
|
73
|
+
Sql: () => Sql,
|
|
74
|
+
SqlResource: () => SqlResource,
|
|
75
|
+
Stream: () => Stream,
|
|
76
|
+
Task: () => Task,
|
|
77
|
+
View: () => View,
|
|
78
|
+
WebApp: () => WebApp,
|
|
79
|
+
Workflow: () => Workflow,
|
|
80
|
+
antiCachePath: () => antiCachePath,
|
|
81
|
+
cliLog: () => cliLog,
|
|
82
|
+
compilerLog: () => compilerLog,
|
|
83
|
+
createClickhouseParameter: () => createClickhouseParameter,
|
|
84
|
+
getApi: () => getApi,
|
|
85
|
+
getApis: () => getApis,
|
|
86
|
+
getFileName: () => getFileName,
|
|
87
|
+
getIngestApi: () => getIngestApi,
|
|
88
|
+
getIngestApis: () => getIngestApis,
|
|
89
|
+
getMaterializedView: () => getMaterializedView,
|
|
90
|
+
getMaterializedViews: () => getMaterializedViews,
|
|
91
|
+
getSqlResource: () => getSqlResource,
|
|
92
|
+
getSqlResources: () => getSqlResources,
|
|
93
|
+
getStream: () => getStream,
|
|
94
|
+
getStreams: () => getStreams,
|
|
95
|
+
getTable: () => getTable,
|
|
96
|
+
getTables: () => getTables,
|
|
97
|
+
getValueFromParameter: () => getValueFromParameter,
|
|
98
|
+
getView: () => getView,
|
|
99
|
+
getViews: () => getViews,
|
|
100
|
+
getWebApp: () => getWebApp,
|
|
101
|
+
getWebApps: () => getWebApps,
|
|
102
|
+
getWorkflow: () => getWorkflow,
|
|
103
|
+
getWorkflows: () => getWorkflows,
|
|
104
|
+
isValidCSVDelimiter: () => isValidCSVDelimiter,
|
|
105
|
+
logError: () => logError,
|
|
106
|
+
mapToClickHouseType: () => mapToClickHouseType,
|
|
107
|
+
mapTstoJs: () => mapTstoJs,
|
|
108
|
+
mooseEnvSecrets: () => mooseEnvSecrets,
|
|
109
|
+
mooseRuntimeEnv: () => mooseRuntimeEnv,
|
|
110
|
+
parseCSV: () => parseCSV,
|
|
111
|
+
parseJSON: () => parseJSON,
|
|
112
|
+
parseJSONWithDates: () => parseJSONWithDates,
|
|
113
|
+
quoteIdentifier: () => quoteIdentifier,
|
|
114
|
+
sql: () => sql,
|
|
115
|
+
toQuery: () => toQuery,
|
|
116
|
+
toQueryPreview: () => toQueryPreview,
|
|
117
|
+
toStaticQuery: () => toStaticQuery
|
|
118
|
+
});
|
|
119
|
+
module.exports = __toCommonJS(index_exports);
|
|
120
|
+
|
|
121
|
+
// ../ts-moose-lib/dist/serverless.mjs
|
|
122
|
+
var import_path = __toESM(require("path"), 1);
|
|
123
|
+
var toml = __toESM(require("toml"), 1);
|
|
124
|
+
var import_kafka_javascript = __toESM(require_kafka_javascript(), 1);
|
|
125
|
+
var import_client = require("@clickhouse/client");
|
|
126
|
+
var import_fs = require("fs");
|
|
127
|
+
var import_path2 = __toESM(require("path"), 1);
|
|
128
|
+
var import_process = __toESM(require("process"), 1);
|
|
129
|
+
var import_stream = require("stream");
|
|
130
|
+
var import_crypto = require("crypto");
|
|
131
|
+
var import_crypto2 = require("crypto");
|
|
132
|
+
var import_csv_parse = require("csv-parse");
|
|
133
|
+
var __defProp2 = Object.defineProperty;
|
|
134
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
135
|
+
var __esm = (fn, res) => function __init() {
|
|
136
|
+
return fn && (res = (0, fn[__getOwnPropNames2(fn)[0]])(fn = 0)), res;
|
|
137
|
+
};
|
|
138
|
+
var __export2 = (target, all) => {
|
|
139
|
+
for (var name in all)
|
|
140
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
141
|
+
};
|
|
34
142
|
function isTruthy(value) {
|
|
35
143
|
if (!value) return false;
|
|
36
144
|
switch (value.trim().toLowerCase()) {
|
|
@@ -46,7 +154,17 @@ function isTruthy(value) {
|
|
|
46
154
|
function mapTstoJs(filePath) {
|
|
47
155
|
return filePath.replace(/\.ts$/, ".js").replace(/\.cts$/, ".cjs").replace(/\.mts$/, ".mjs");
|
|
48
156
|
}
|
|
49
|
-
var compilerLog
|
|
157
|
+
var compilerLog;
|
|
158
|
+
var antiCachePath;
|
|
159
|
+
var getFileName;
|
|
160
|
+
var cliLog;
|
|
161
|
+
var MAX_RETRIES;
|
|
162
|
+
var MAX_RETRY_TIME_MS;
|
|
163
|
+
var RETRY_INITIAL_TIME_MS;
|
|
164
|
+
var MAX_RETRIES_PRODUCER;
|
|
165
|
+
var RETRY_FACTOR_PRODUCER;
|
|
166
|
+
var ACKs;
|
|
167
|
+
var logError;
|
|
50
168
|
var init_commons_types = __esm({
|
|
51
169
|
"src/commons-types.ts"() {
|
|
52
170
|
"use strict";
|
|
@@ -92,17 +210,15 @@ var init_commons_types = __esm({
|
|
|
92
210
|
};
|
|
93
211
|
}
|
|
94
212
|
});
|
|
95
|
-
|
|
96
|
-
// src/config/configFile.ts
|
|
97
213
|
async function findConfigFile(startDir = process.cwd()) {
|
|
98
214
|
const fs = await import("fs");
|
|
99
|
-
let currentDir =
|
|
215
|
+
let currentDir = import_path.default.resolve(startDir);
|
|
100
216
|
while (true) {
|
|
101
|
-
const configPath =
|
|
217
|
+
const configPath = import_path.default.join(currentDir, "moose.config.toml");
|
|
102
218
|
if (fs.existsSync(configPath)) {
|
|
103
219
|
return configPath;
|
|
104
220
|
}
|
|
105
|
-
const parentDir =
|
|
221
|
+
const parentDir = import_path.default.dirname(currentDir);
|
|
106
222
|
if (parentDir === currentDir) {
|
|
107
223
|
break;
|
|
108
224
|
}
|
|
@@ -126,12 +242,10 @@ async function readProjectConfig() {
|
|
|
126
242
|
throw new ConfigError(`Failed to parse moose.config.toml: ${error}`);
|
|
127
243
|
}
|
|
128
244
|
}
|
|
129
|
-
var
|
|
245
|
+
var ConfigError;
|
|
130
246
|
var init_configFile = __esm({
|
|
131
247
|
"src/config/configFile.ts"() {
|
|
132
248
|
"use strict";
|
|
133
|
-
import_node_path = __toESM(require("path"));
|
|
134
|
-
toml = __toESM(require("toml"));
|
|
135
249
|
ConfigError = class extends Error {
|
|
136
250
|
constructor(message) {
|
|
137
251
|
super(message);
|
|
@@ -140,8 +254,6 @@ var init_configFile = __esm({
|
|
|
140
254
|
};
|
|
141
255
|
}
|
|
142
256
|
});
|
|
143
|
-
|
|
144
|
-
// src/config/runtime.ts
|
|
145
257
|
var runtime_exports = {};
|
|
146
258
|
var ConfigurationRegistry;
|
|
147
259
|
var init_runtime = __esm({
|
|
@@ -276,10 +388,8 @@ var init_runtime = __esm({
|
|
|
276
388
|
globalThis._mooseConfigRegistry = ConfigurationRegistry.getInstance();
|
|
277
389
|
}
|
|
278
390
|
});
|
|
279
|
-
|
|
280
|
-
// src/commons.ts
|
|
281
391
|
var commons_exports = {};
|
|
282
|
-
|
|
392
|
+
__export2(commons_exports, {
|
|
283
393
|
ACKs: () => ACKs,
|
|
284
394
|
MAX_RETRIES: () => MAX_RETRIES,
|
|
285
395
|
MAX_RETRIES_PRODUCER: () => MAX_RETRIES_PRODUCER,
|
|
@@ -306,13 +416,13 @@ function walkDirectory(dir, extensions) {
|
|
|
306
416
|
try {
|
|
307
417
|
const entries = (0, import_fs.readdirSync)(dir, { withFileTypes: true });
|
|
308
418
|
for (const entry of entries) {
|
|
309
|
-
const fullPath =
|
|
419
|
+
const fullPath = import_path2.default.join(dir, entry.name);
|
|
310
420
|
if (entry.isDirectory()) {
|
|
311
421
|
if (entry.name !== "node_modules") {
|
|
312
422
|
results.push(...walkDirectory(fullPath, extensions));
|
|
313
423
|
}
|
|
314
424
|
} else if (entry.isFile()) {
|
|
315
|
-
const ext =
|
|
425
|
+
const ext = import_path2.default.extname(entry.name);
|
|
316
426
|
if (extensions.includes(ext)) {
|
|
317
427
|
results.push(fullPath);
|
|
318
428
|
}
|
|
@@ -353,23 +463,23 @@ function rewriteImportPath(match, prefix, importPath, quote, fileDir) {
|
|
|
353
463
|
return match;
|
|
354
464
|
}
|
|
355
465
|
if (fileDir) {
|
|
356
|
-
const resolvedPath =
|
|
466
|
+
const resolvedPath = import_path2.default.resolve(fileDir, importPath);
|
|
357
467
|
if ((0, import_fs.existsSync)(`${resolvedPath}.js`)) {
|
|
358
468
|
return `${prefix}${importPath}.js${quote}`;
|
|
359
469
|
}
|
|
360
|
-
if ((0, import_fs.existsSync)(
|
|
470
|
+
if ((0, import_fs.existsSync)(import_path2.default.join(resolvedPath, "index.js"))) {
|
|
361
471
|
return `${prefix}${importPath}/index.js${quote}`;
|
|
362
472
|
}
|
|
363
473
|
if ((0, import_fs.existsSync)(`${resolvedPath}.mjs`)) {
|
|
364
474
|
return `${prefix}${importPath}.mjs${quote}`;
|
|
365
475
|
}
|
|
366
|
-
if ((0, import_fs.existsSync)(
|
|
476
|
+
if ((0, import_fs.existsSync)(import_path2.default.join(resolvedPath, "index.mjs"))) {
|
|
367
477
|
return `${prefix}${importPath}/index.mjs${quote}`;
|
|
368
478
|
}
|
|
369
479
|
if ((0, import_fs.existsSync)(`${resolvedPath}.cjs`)) {
|
|
370
480
|
return `${prefix}${importPath}.cjs${quote}`;
|
|
371
481
|
}
|
|
372
|
-
if ((0, import_fs.existsSync)(
|
|
482
|
+
if ((0, import_fs.existsSync)(import_path2.default.join(resolvedPath, "index.cjs"))) {
|
|
373
483
|
return `${prefix}${importPath}/index.cjs${quote}`;
|
|
374
484
|
}
|
|
375
485
|
}
|
|
@@ -379,7 +489,7 @@ function rewriteImportExtensions(outDir) {
|
|
|
379
489
|
const files = walkDirectory(outDir, [".js", ".mjs"]);
|
|
380
490
|
for (const filePath of files) {
|
|
381
491
|
const content = (0, import_fs.readFileSync)(filePath, "utf-8");
|
|
382
|
-
const fileDir =
|
|
492
|
+
const fileDir = import_path2.default.dirname(filePath);
|
|
383
493
|
const rewritten = addJsExtensionToImports(content, fileDir);
|
|
384
494
|
if (content !== rewritten) {
|
|
385
495
|
(0, import_fs.writeFileSync)(filePath, rewritten, "utf-8");
|
|
@@ -408,15 +518,15 @@ async function getKafkaProducer(cfg, logger, maxMessageBytes) {
|
|
|
408
518
|
await producer.connect();
|
|
409
519
|
return producer;
|
|
410
520
|
}
|
|
411
|
-
var
|
|
521
|
+
var Kafka;
|
|
522
|
+
var getClickhouseClient;
|
|
523
|
+
var parseBrokerString;
|
|
524
|
+
var buildSaslConfig;
|
|
525
|
+
var getKafkaClient;
|
|
412
526
|
var init_commons = __esm({
|
|
413
527
|
"src/commons.ts"() {
|
|
414
528
|
"use strict";
|
|
415
529
|
init_commons_types();
|
|
416
|
-
import_kafka_javascript = require("@514labs/kafka-javascript");
|
|
417
|
-
import_client = require("@clickhouse/client");
|
|
418
|
-
import_fs = require("fs");
|
|
419
|
-
import_path = __toESM(require("path"));
|
|
420
530
|
init_commons_types();
|
|
421
531
|
({ Kafka } = import_kafka_javascript.KafkaJS);
|
|
422
532
|
getClickhouseClient = ({
|
|
@@ -481,80 +591,6 @@ var init_commons = __esm({
|
|
|
481
591
|
};
|
|
482
592
|
}
|
|
483
593
|
});
|
|
484
|
-
|
|
485
|
-
// src/serverless.ts
|
|
486
|
-
var serverless_exports = {};
|
|
487
|
-
__export(serverless_exports, {
|
|
488
|
-
ACKs: () => ACKs,
|
|
489
|
-
Api: () => Api,
|
|
490
|
-
CSV_DELIMITERS: () => CSV_DELIMITERS,
|
|
491
|
-
ClickHouseEngines: () => ClickHouseEngines,
|
|
492
|
-
ConsumptionApi: () => ConsumptionApi,
|
|
493
|
-
DEFAULT_CSV_CONFIG: () => DEFAULT_CSV_CONFIG,
|
|
494
|
-
DEFAULT_JSON_CONFIG: () => DEFAULT_JSON_CONFIG,
|
|
495
|
-
DataSource: () => DataSource,
|
|
496
|
-
DeadLetterQueue: () => DeadLetterQueue,
|
|
497
|
-
ETLPipeline: () => ETLPipeline,
|
|
498
|
-
IngestApi: () => IngestApi,
|
|
499
|
-
IngestPipeline: () => IngestPipeline,
|
|
500
|
-
LifeCycle: () => LifeCycle,
|
|
501
|
-
MAX_RETRIES: () => MAX_RETRIES,
|
|
502
|
-
MAX_RETRIES_PRODUCER: () => MAX_RETRIES_PRODUCER,
|
|
503
|
-
MAX_RETRY_TIME_MS: () => MAX_RETRY_TIME_MS,
|
|
504
|
-
MOOSE_RUNTIME_ENV_PREFIX: () => MOOSE_RUNTIME_ENV_PREFIX,
|
|
505
|
-
MaterializedView: () => MaterializedView,
|
|
506
|
-
OlapTable: () => OlapTable,
|
|
507
|
-
RETRY_FACTOR_PRODUCER: () => RETRY_FACTOR_PRODUCER,
|
|
508
|
-
RETRY_INITIAL_TIME_MS: () => RETRY_INITIAL_TIME_MS,
|
|
509
|
-
Sql: () => Sql,
|
|
510
|
-
SqlResource: () => SqlResource,
|
|
511
|
-
Stream: () => Stream,
|
|
512
|
-
Task: () => Task,
|
|
513
|
-
View: () => View,
|
|
514
|
-
WebApp: () => WebApp,
|
|
515
|
-
Workflow: () => Workflow,
|
|
516
|
-
antiCachePath: () => antiCachePath,
|
|
517
|
-
cliLog: () => cliLog,
|
|
518
|
-
compilerLog: () => compilerLog,
|
|
519
|
-
createClickhouseParameter: () => createClickhouseParameter,
|
|
520
|
-
getApi: () => getApi,
|
|
521
|
-
getApis: () => getApis,
|
|
522
|
-
getFileName: () => getFileName,
|
|
523
|
-
getIngestApi: () => getIngestApi,
|
|
524
|
-
getIngestApis: () => getIngestApis,
|
|
525
|
-
getMaterializedView: () => getMaterializedView,
|
|
526
|
-
getMaterializedViews: () => getMaterializedViews,
|
|
527
|
-
getSqlResource: () => getSqlResource,
|
|
528
|
-
getSqlResources: () => getSqlResources,
|
|
529
|
-
getStream: () => getStream,
|
|
530
|
-
getStreams: () => getStreams,
|
|
531
|
-
getTable: () => getTable,
|
|
532
|
-
getTables: () => getTables,
|
|
533
|
-
getValueFromParameter: () => getValueFromParameter,
|
|
534
|
-
getView: () => getView,
|
|
535
|
-
getViews: () => getViews,
|
|
536
|
-
getWebApp: () => getWebApp,
|
|
537
|
-
getWebApps: () => getWebApps,
|
|
538
|
-
getWorkflow: () => getWorkflow,
|
|
539
|
-
getWorkflows: () => getWorkflows,
|
|
540
|
-
isValidCSVDelimiter: () => isValidCSVDelimiter,
|
|
541
|
-
logError: () => logError,
|
|
542
|
-
mapToClickHouseType: () => mapToClickHouseType,
|
|
543
|
-
mapTstoJs: () => mapTstoJs,
|
|
544
|
-
mooseEnvSecrets: () => mooseEnvSecrets,
|
|
545
|
-
mooseRuntimeEnv: () => mooseRuntimeEnv,
|
|
546
|
-
parseCSV: () => parseCSV,
|
|
547
|
-
parseJSON: () => parseJSON,
|
|
548
|
-
parseJSONWithDates: () => parseJSONWithDates,
|
|
549
|
-
quoteIdentifier: () => quoteIdentifier,
|
|
550
|
-
sql: () => sql,
|
|
551
|
-
toQuery: () => toQuery,
|
|
552
|
-
toQueryPreview: () => toQueryPreview,
|
|
553
|
-
toStaticQuery: () => toStaticQuery
|
|
554
|
-
});
|
|
555
|
-
module.exports = __toCommonJS(serverless_exports);
|
|
556
|
-
|
|
557
|
-
// src/dataModels/types.ts
|
|
558
594
|
var ClickHouseEngines = /* @__PURE__ */ ((ClickHouseEngines2) => {
|
|
559
595
|
ClickHouseEngines2["MergeTree"] = "MergeTree";
|
|
560
596
|
ClickHouseEngines2["ReplacingMergeTree"] = "ReplacingMergeTree";
|
|
@@ -577,8 +613,6 @@ var ClickHouseEngines = /* @__PURE__ */ ((ClickHouseEngines2) => {
|
|
|
577
613
|
ClickHouseEngines2["ReplicatedVersionedCollapsingMergeTree"] = "ReplicatedVersionedCollapsingMergeTree";
|
|
578
614
|
return ClickHouseEngines2;
|
|
579
615
|
})(ClickHouseEngines || {});
|
|
580
|
-
|
|
581
|
-
// src/dmv2/utils/stackTrace.ts
|
|
582
616
|
function shouldSkipStackLine(line) {
|
|
583
617
|
return line.includes("node_modules") || // Skip npm installed packages (prod)
|
|
584
618
|
line.includes("node:internal") || // Skip Node.js internals (modern format)
|
|
@@ -639,8 +673,6 @@ function getSourceFileFromStack(stack) {
|
|
|
639
673
|
const location = getSourceLocationFromStack(stack);
|
|
640
674
|
return location?.file;
|
|
641
675
|
}
|
|
642
|
-
|
|
643
|
-
// src/dmv2/typedBase.ts
|
|
644
676
|
var TypedBase = class {
|
|
645
677
|
/** The JSON schema representation of type T. Injected by the compiler plugin. */
|
|
646
678
|
schema;
|
|
@@ -699,17 +731,12 @@ var TypedBase = class {
|
|
|
699
731
|
}
|
|
700
732
|
}
|
|
701
733
|
};
|
|
702
|
-
|
|
703
|
-
// src/dataModels/dataModelTypes.ts
|
|
704
734
|
function isArrayNestedType(dt) {
|
|
705
735
|
return typeof dt === "object" && dt !== null && dt.elementType !== null && typeof dt.elementType === "object" && dt.elementType.hasOwnProperty("columns") && Array.isArray(dt.elementType.columns);
|
|
706
736
|
}
|
|
707
737
|
function isNestedType(dt) {
|
|
708
738
|
return typeof dt === "object" && dt !== null && Array.isArray(dt.columns);
|
|
709
739
|
}
|
|
710
|
-
|
|
711
|
-
// src/dmv2/internal.ts
|
|
712
|
-
var import_process = __toESM(require("process"));
|
|
713
740
|
init_commons_types();
|
|
714
741
|
var isClientOnlyMode = () => import_process.default.env.MOOSE_CLIENT_ONLY === "true";
|
|
715
742
|
var moose_internal = {
|
|
@@ -852,12 +879,6 @@ var dlqColumns = [
|
|
|
852
879
|
comment: null
|
|
853
880
|
}
|
|
854
881
|
];
|
|
855
|
-
|
|
856
|
-
// src/dmv2/sdk/olapTable.ts
|
|
857
|
-
var import_node_stream = require("stream");
|
|
858
|
-
var import_node_crypto = require("crypto");
|
|
859
|
-
|
|
860
|
-
// src/sqlHelpers.ts
|
|
861
882
|
var quoteIdentifier = (name) => {
|
|
862
883
|
return name.startsWith("`") && name.endsWith("`") ? name : `\`${name}\``;
|
|
863
884
|
};
|
|
@@ -1028,8 +1049,6 @@ var mapToClickHouseType = (value) => {
|
|
|
1028
1049
|
function emptyIfUndefined(value) {
|
|
1029
1050
|
return value === void 0 ? "" : value;
|
|
1030
1051
|
}
|
|
1031
|
-
|
|
1032
|
-
// src/dmv2/sdk/olapTable.ts
|
|
1033
1052
|
var OlapTable = class extends TypedBase {
|
|
1034
1053
|
name;
|
|
1035
1054
|
/** @internal */
|
|
@@ -1041,7 +1060,14 @@ var OlapTable = class extends TypedBase {
|
|
|
1041
1060
|
/** @internal Cached table name to avoid repeated generation */
|
|
1042
1061
|
_cachedTableName;
|
|
1043
1062
|
constructor(name, config, schema, columns, validators) {
|
|
1044
|
-
const resolvedConfig = config ? "engine" in config ? config : {
|
|
1063
|
+
const resolvedConfig = config ? "engine" in config ? config : {
|
|
1064
|
+
...config,
|
|
1065
|
+
engine: "MergeTree"
|
|
1066
|
+
/* MergeTree */
|
|
1067
|
+
} : {
|
|
1068
|
+
engine: "MergeTree"
|
|
1069
|
+
/* MergeTree */
|
|
1070
|
+
};
|
|
1045
1071
|
const hasFields = Array.isArray(resolvedConfig.orderByFields) && resolvedConfig.orderByFields.length > 0;
|
|
1046
1072
|
const hasExpr = typeof resolvedConfig.orderByExpression === "string" && resolvedConfig.orderByExpression.length > 0;
|
|
1047
1073
|
if (hasFields && hasExpr) {
|
|
@@ -1094,7 +1120,7 @@ var OlapTable = class extends TypedBase {
|
|
|
1094
1120
|
createConfigHash(clickhouseConfig) {
|
|
1095
1121
|
const effectiveDatabase = this.config.database ?? clickhouseConfig.database;
|
|
1096
1122
|
const configString = `${clickhouseConfig.host}:${clickhouseConfig.port}:${clickhouseConfig.username}:${clickhouseConfig.password}:${effectiveDatabase}:${clickhouseConfig.useSSL}`;
|
|
1097
|
-
return (0,
|
|
1123
|
+
return (0, import_crypto.createHash)("sha256").update(configString).digest("hex").substring(0, 16);
|
|
1098
1124
|
}
|
|
1099
1125
|
/**
|
|
1100
1126
|
* Gets or creates a memoized ClickHouse client.
|
|
@@ -1304,7 +1330,7 @@ var OlapTable = class extends TypedBase {
|
|
|
1304
1330
|
* @private
|
|
1305
1331
|
*/
|
|
1306
1332
|
validateInsertParameters(data, options) {
|
|
1307
|
-
const isStream = data instanceof
|
|
1333
|
+
const isStream = data instanceof import_stream.Readable;
|
|
1308
1334
|
const strategy = options?.strategy || "fail-fast";
|
|
1309
1335
|
const shouldValidate = options?.validate !== false;
|
|
1310
1336
|
if (isStream && strategy === "isolate") {
|
|
@@ -1711,9 +1737,6 @@ var OlapTable = class extends TypedBase {
|
|
|
1711
1737
|
// were removed in ENG-856. Use direct configuration instead, e.g.:
|
|
1712
1738
|
// new OlapTable(name, { engine: ClickHouseEngines.ReplacingMergeTree, orderByFields: ["id"], ver: "updated_at" })
|
|
1713
1739
|
};
|
|
1714
|
-
|
|
1715
|
-
// src/dmv2/sdk/stream.ts
|
|
1716
|
-
var import_node_crypto2 = require("crypto");
|
|
1717
1740
|
var RoutedMessage = class {
|
|
1718
1741
|
/** The destination stream for the message */
|
|
1719
1742
|
destination;
|
|
@@ -1787,7 +1810,7 @@ var Stream = class extends TypedBase {
|
|
|
1787
1810
|
kafkaConfig.securityProtocol,
|
|
1788
1811
|
kafkaConfig.namespace
|
|
1789
1812
|
].join(":");
|
|
1790
|
-
return (0,
|
|
1813
|
+
return (0, import_crypto2.createHash)("sha256").update(configString).digest("hex").substring(0, 16);
|
|
1791
1814
|
}
|
|
1792
1815
|
/**
|
|
1793
1816
|
* Gets or creates a memoized KafkaJS producer using runtime configuration.
|
|
@@ -1867,7 +1890,7 @@ var Stream = class extends TypedBase {
|
|
|
1867
1890
|
}
|
|
1868
1891
|
const {
|
|
1869
1892
|
default: { SchemaRegistry }
|
|
1870
|
-
} = await
|
|
1893
|
+
} = await Promise.resolve().then(() => __toESM(require_confluent_schema_registry(), 1));
|
|
1871
1894
|
const registry = new SchemaRegistry({ host: schemaRegistryUrl });
|
|
1872
1895
|
let schemaId;
|
|
1873
1896
|
if ("id" in sr.reference) {
|
|
@@ -2047,8 +2070,6 @@ var DeadLetterQueue = class extends Stream {
|
|
|
2047
2070
|
super.addMultiTransform(withValidate);
|
|
2048
2071
|
}
|
|
2049
2072
|
};
|
|
2050
|
-
|
|
2051
|
-
// src/dmv2/sdk/workflow.ts
|
|
2052
2073
|
var Task = class {
|
|
2053
2074
|
/**
|
|
2054
2075
|
* Creates a new Task instance.
|
|
@@ -2156,8 +2177,6 @@ var Workflow = class {
|
|
|
2156
2177
|
validateTask(startingTask, []);
|
|
2157
2178
|
}
|
|
2158
2179
|
};
|
|
2159
|
-
|
|
2160
|
-
// src/dmv2/sdk/ingestApi.ts
|
|
2161
2180
|
var IngestApi = class extends TypedBase {
|
|
2162
2181
|
constructor(name, config, schema, columns, validators, allowExtraFields) {
|
|
2163
2182
|
super(name, config, schema, columns, void 0, allowExtraFields);
|
|
@@ -2168,8 +2187,6 @@ var IngestApi = class extends TypedBase {
|
|
|
2168
2187
|
ingestApis.set(name, this);
|
|
2169
2188
|
}
|
|
2170
2189
|
};
|
|
2171
|
-
|
|
2172
|
-
// src/dmv2/sdk/consumptionApi.ts
|
|
2173
2190
|
var Api = class extends TypedBase {
|
|
2174
2191
|
/** @internal The handler function that processes requests and generates responses. */
|
|
2175
2192
|
_handler;
|
|
@@ -2276,8 +2293,6 @@ var Api = class extends TypedBase {
|
|
|
2276
2293
|
}
|
|
2277
2294
|
};
|
|
2278
2295
|
var ConsumptionApi = Api;
|
|
2279
|
-
|
|
2280
|
-
// src/dmv2/sdk/ingestPipeline.ts
|
|
2281
2296
|
var IngestPipeline = class extends TypedBase {
|
|
2282
2297
|
/**
|
|
2283
2298
|
* The OLAP table component of the pipeline, if configured.
|
|
@@ -2316,7 +2331,7 @@ var IngestPipeline = class extends TypedBase {
|
|
|
2316
2331
|
...config.version && { version: config.version }
|
|
2317
2332
|
} : {
|
|
2318
2333
|
lifeCycle: config.lifeCycle,
|
|
2319
|
-
engine: "MergeTree"
|
|
2334
|
+
engine: "MergeTree",
|
|
2320
2335
|
...config.version && { version: config.version }
|
|
2321
2336
|
};
|
|
2322
2337
|
this.table = new OlapTable(
|
|
@@ -2386,8 +2401,6 @@ var IngestPipeline = class extends TypedBase {
|
|
|
2386
2401
|
}
|
|
2387
2402
|
}
|
|
2388
2403
|
};
|
|
2389
|
-
|
|
2390
|
-
// src/dmv2/sdk/etlPipeline.ts
|
|
2391
2404
|
var InternalBatcher = class {
|
|
2392
2405
|
iterator;
|
|
2393
2406
|
batchSize;
|
|
@@ -2528,8 +2541,6 @@ var ETLPipeline = class {
|
|
|
2528
2541
|
console.log(`Completed ETL Pipeline: ${this.name}`);
|
|
2529
2542
|
}
|
|
2530
2543
|
};
|
|
2531
|
-
|
|
2532
|
-
// src/dmv2/sdk/materializedView.ts
|
|
2533
2544
|
function formatTableReference(table) {
|
|
2534
2545
|
const database = table instanceof OlapTable ? table.config.database : void 0;
|
|
2535
2546
|
if (database) {
|
|
@@ -2573,7 +2584,8 @@ var MaterializedView = class {
|
|
|
2573
2584
|
),
|
|
2574
2585
|
{
|
|
2575
2586
|
orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
|
|
2576
|
-
engine: options.targetTable?.engine ?? options.engine ?? "MergeTree"
|
|
2587
|
+
engine: options.targetTable?.engine ?? options.engine ?? "MergeTree"
|
|
2588
|
+
/* MergeTree */
|
|
2577
2589
|
},
|
|
2578
2590
|
targetSchema,
|
|
2579
2591
|
targetColumns
|
|
@@ -2604,8 +2616,6 @@ var MaterializedView = class {
|
|
|
2604
2616
|
materializedViews.set(this.name, this);
|
|
2605
2617
|
}
|
|
2606
2618
|
};
|
|
2607
|
-
|
|
2608
|
-
// src/dmv2/sdk/sqlResource.ts
|
|
2609
2619
|
var SqlResource = class {
|
|
2610
2620
|
/** @internal */
|
|
2611
2621
|
kind = "SqlResource";
|
|
@@ -2658,8 +2668,6 @@ var SqlResource = class {
|
|
|
2658
2668
|
}
|
|
2659
2669
|
}
|
|
2660
2670
|
};
|
|
2661
|
-
|
|
2662
|
-
// src/dmv2/sdk/view.ts
|
|
2663
2671
|
function formatTableReference2(table) {
|
|
2664
2672
|
const database = table instanceof OlapTable ? table.config.database : void 0;
|
|
2665
2673
|
if (database) {
|
|
@@ -2707,16 +2715,12 @@ var View = class {
|
|
|
2707
2715
|
views.set(this.name, this);
|
|
2708
2716
|
}
|
|
2709
2717
|
};
|
|
2710
|
-
|
|
2711
|
-
// src/dmv2/sdk/lifeCycle.ts
|
|
2712
2718
|
var LifeCycle = /* @__PURE__ */ ((LifeCycle2) => {
|
|
2713
2719
|
LifeCycle2["FULLY_MANAGED"] = "FULLY_MANAGED";
|
|
2714
2720
|
LifeCycle2["DELETION_PROTECTED"] = "DELETION_PROTECTED";
|
|
2715
2721
|
LifeCycle2["EXTERNALLY_MANAGED"] = "EXTERNALLY_MANAGED";
|
|
2716
2722
|
return LifeCycle2;
|
|
2717
2723
|
})(LifeCycle || {});
|
|
2718
|
-
|
|
2719
|
-
// src/dmv2/sdk/webApp.ts
|
|
2720
2724
|
var RESERVED_MOUNT_PATHS = [
|
|
2721
2725
|
"/admin",
|
|
2722
2726
|
"/api",
|
|
@@ -2829,8 +2833,6 @@ Examples:
|
|
|
2829
2833
|
return this._rawApp;
|
|
2830
2834
|
}
|
|
2831
2835
|
};
|
|
2832
|
-
|
|
2833
|
-
// src/dmv2/registry.ts
|
|
2834
2836
|
function getTables() {
|
|
2835
2837
|
return getMooseInternal().tables;
|
|
2836
2838
|
}
|
|
@@ -2906,11 +2908,7 @@ function getViews() {
|
|
|
2906
2908
|
function getView(name) {
|
|
2907
2909
|
return getMooseInternal().views.get(name);
|
|
2908
2910
|
}
|
|
2909
|
-
|
|
2910
|
-
// src/serverless.ts
|
|
2911
2911
|
init_commons_types();
|
|
2912
|
-
|
|
2913
|
-
// src/connectors/dataSource.ts
|
|
2914
2912
|
var DataSource = class {
|
|
2915
2913
|
name;
|
|
2916
2914
|
supportsIncremental;
|
|
@@ -2919,8 +2917,6 @@ var DataSource = class {
|
|
|
2919
2917
|
this.supportsIncremental = config.supportsIncremental ?? false;
|
|
2920
2918
|
}
|
|
2921
2919
|
};
|
|
2922
|
-
|
|
2923
|
-
// src/secrets.ts
|
|
2924
2920
|
var MOOSE_RUNTIME_ENV_PREFIX = "__MOOSE_RUNTIME_ENV__:";
|
|
2925
2921
|
var mooseRuntimeEnv = {
|
|
2926
2922
|
/**
|
|
@@ -2965,11 +2961,6 @@ var mooseRuntimeEnv = {
|
|
|
2965
2961
|
}
|
|
2966
2962
|
};
|
|
2967
2963
|
var mooseEnvSecrets = mooseRuntimeEnv;
|
|
2968
|
-
|
|
2969
|
-
// src/utilities/dataParser.ts
|
|
2970
|
-
var import_csv_parse = require("csv-parse");
|
|
2971
|
-
|
|
2972
|
-
// src/utilities/json.ts
|
|
2973
2964
|
function jsonDateReviver(key, value) {
|
|
2974
2965
|
const iso8601Format = /^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24\:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)$/;
|
|
2975
2966
|
if (typeof value === "string" && iso8601Format.test(value)) {
|
|
@@ -2977,8 +2968,6 @@ function jsonDateReviver(key, value) {
|
|
|
2977
2968
|
}
|
|
2978
2969
|
return value;
|
|
2979
2970
|
}
|
|
2980
|
-
|
|
2981
|
-
// src/utilities/dataParser.ts
|
|
2982
2971
|
function parseCSV(content, config) {
|
|
2983
2972
|
return new Promise((resolve, reject) => {
|
|
2984
2973
|
const results = [];
|
|
@@ -3100,4 +3089,4 @@ var DEFAULT_JSON_CONFIG = {
|
|
|
3100
3089
|
toQueryPreview,
|
|
3101
3090
|
toStaticQuery
|
|
3102
3091
|
});
|
|
3103
|
-
//# sourceMappingURL=
|
|
3092
|
+
//# sourceMappingURL=index.js.map
|