@514labs/moose-lib 0.6.320 → 0.6.321-ci-5-ga23d35fe
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/browserCompatible.d.mts +7 -3
- package/dist/browserCompatible.d.ts +7 -3
- package/dist/browserCompatible.js +197 -180
- package/dist/browserCompatible.js.map +1 -1
- package/dist/browserCompatible.mjs +196 -180
- package/dist/browserCompatible.mjs.map +1 -1
- package/dist/compilerPlugin.js.map +1 -1
- package/dist/compilerPlugin.mjs.map +1 -1
- package/dist/dataModels/toDataModels.js.map +1 -1
- package/dist/dataModels/toDataModels.mjs.map +1 -1
- package/dist/dmv2/index.d.mts +2 -1
- package/dist/dmv2/index.d.ts +2 -1
- package/dist/dmv2/index.js +41 -24
- package/dist/dmv2/index.js.map +1 -1
- package/dist/dmv2/index.mjs +40 -24
- package/dist/dmv2/index.mjs.map +1 -1
- package/dist/{index-C4miZc-A.d.mts → index-Aq9KzsRd.d.mts} +181 -33
- package/dist/{index-C4miZc-A.d.ts → index-Aq9KzsRd.d.ts} +181 -33
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +176 -202
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +176 -199
- package/dist/index.mjs.map +1 -1
- package/dist/moose-runner.js +88 -257
- package/dist/moose-runner.js.map +1 -1
- package/dist/moose-runner.mjs +89 -258
- package/dist/moose-runner.mjs.map +1 -1
- package/dist/scripts/workflow.js +9 -11
- package/dist/scripts/workflow.js.map +1 -1
- package/dist/scripts/workflow.mjs +9 -11
- package/dist/scripts/workflow.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/browserCompatible-BVw4gSAN.d.mts +0 -184
- package/dist/browserCompatible-rK8ei0bt.d.ts +0 -184
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
export { A as Aggregated, h as Api, i as ApiConfig,
|
|
2
|
-
export { C as ClickHouseByteSize, q as ClickHouseCodec, j as ClickHouseDecimal, n as ClickHouseDefault, k as ClickHouseFixedStringSize, l as ClickHouseFloat, a as ClickHouseInt, m as ClickHouseJson, p as ClickHouseMaterialized, b as ClickHouseNamedTuple, i as ClickHousePrecision, o as ClickHouseTTL, D as DateTime, r as DateTime64, t as DateTime64String, s as DateTimeString, E as Decimal, F as FixedString, u as Float32, v as Float64, w as Int16, x as Int32, y as Int64, I as Int8, J as JWT, K as Key, L as LowCardinality, z as UInt16, A as UInt32, B as UInt64, U as UInt8, W as WithDefault } from './browserCompatible-BVw4gSAN.mjs';
|
|
1
|
+
export { A as Aggregated, h as Api, i as ApiConfig, ao as ApiUtil, Y as ClickHouseByteSize, a7 as ClickHouseCodec, X as ClickHouseDecimal, a3 as ClickHouseDefault, C as ClickHouseEngines, Z as ClickHouseFixedStringSize, _ as ClickHouseFloat, $ as ClickHouseInt, a0 as ClickHouseJson, a5 as ClickHouseMaterialized, a2 as ClickHouseNamedTuple, U as ClickHousePrecision, a4 as ClickHouseTTL, j as ConsumptionApi, ap as ConsumptionUtil, a8 as DateTime, a9 as DateTime64, ab as DateTime64String, aa as DateTimeString, e as DeadLetter, D as DeadLetterModel, f as DeadLetterQueue, an as Decimal, m as ETLPipeline, n as ETLPipelineConfig, E as EgressConfig, ac as FixedString, ad as Float32, ae as Float64, F as FrameworkApp, ar as IdentifierBrandedString, I as IngestApi, g as IngestConfig, k as IngestPipeline, ag as Int16, ah as Int32, ai as Int64, af as Int8, L as LifeCycle, a1 as LowCardinality, M as MaterializedView, as as NonIdentifierBrandedString, a as OlapConfig, O as OlapTable, au as RawValue, b as S3QueueTableSettings, S as SimpleAggregated, aw as Sql, l as SqlResource, c as Stream, d as StreamConfig, T as Task, ak as UInt16, al as UInt32, am as UInt64, aj as UInt8, at as Value, V as View, o as WebApp, p as WebAppConfig, q as WebAppHandler, a6 as WithDefault, W as Workflow, aB as createClickhouseParameter, y as getApi, x as getApis, w as getIngestApi, v as getIngestApis, Q as getMaterializedView, R as getMaterializedViews, B as getSqlResource, z as getSqlResources, u as getStream, t as getStreams, s as getTable, r as getTables, aA as getValueFromParameter, N as getView, P as getViews, K as getWebApp, J as getWebApps, H as getWorkflow, G as getWorkflows, aC as mapToClickHouseType, aq as quoteIdentifier, av as sql, ay as toQuery, az as toQueryPreview, ax as toStaticQuery } from './index-Aq9KzsRd.mjs';
|
|
3
2
|
import 'typia';
|
|
4
3
|
import 'typia/src/schemas/json/IJsonSchemaCollection';
|
|
4
|
+
import 'typia/lib/tags';
|
|
5
5
|
import 'node:stream';
|
|
6
6
|
import '@clickhouse/client';
|
|
7
7
|
import '@temporalio/client';
|
|
8
8
|
import 'jose';
|
|
9
9
|
import 'http';
|
|
10
|
-
|
|
10
|
+
|
|
11
|
+
type Key<T extends string | number | Date> = T;
|
|
12
|
+
type JWT<T extends object> = T;
|
|
13
|
+
|
|
14
|
+
export type { JWT, Key };
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
export { A as Aggregated, h as Api, i as ApiConfig,
|
|
2
|
-
export { C as ClickHouseByteSize, q as ClickHouseCodec, j as ClickHouseDecimal, n as ClickHouseDefault, k as ClickHouseFixedStringSize, l as ClickHouseFloat, a as ClickHouseInt, m as ClickHouseJson, p as ClickHouseMaterialized, b as ClickHouseNamedTuple, i as ClickHousePrecision, o as ClickHouseTTL, D as DateTime, r as DateTime64, t as DateTime64String, s as DateTimeString, E as Decimal, F as FixedString, u as Float32, v as Float64, w as Int16, x as Int32, y as Int64, I as Int8, J as JWT, K as Key, L as LowCardinality, z as UInt16, A as UInt32, B as UInt64, U as UInt8, W as WithDefault } from './browserCompatible-rK8ei0bt.js';
|
|
1
|
+
export { A as Aggregated, h as Api, i as ApiConfig, ao as ApiUtil, Y as ClickHouseByteSize, a7 as ClickHouseCodec, X as ClickHouseDecimal, a3 as ClickHouseDefault, C as ClickHouseEngines, Z as ClickHouseFixedStringSize, _ as ClickHouseFloat, $ as ClickHouseInt, a0 as ClickHouseJson, a5 as ClickHouseMaterialized, a2 as ClickHouseNamedTuple, U as ClickHousePrecision, a4 as ClickHouseTTL, j as ConsumptionApi, ap as ConsumptionUtil, a8 as DateTime, a9 as DateTime64, ab as DateTime64String, aa as DateTimeString, e as DeadLetter, D as DeadLetterModel, f as DeadLetterQueue, an as Decimal, m as ETLPipeline, n as ETLPipelineConfig, E as EgressConfig, ac as FixedString, ad as Float32, ae as Float64, F as FrameworkApp, ar as IdentifierBrandedString, I as IngestApi, g as IngestConfig, k as IngestPipeline, ag as Int16, ah as Int32, ai as Int64, af as Int8, L as LifeCycle, a1 as LowCardinality, M as MaterializedView, as as NonIdentifierBrandedString, a as OlapConfig, O as OlapTable, au as RawValue, b as S3QueueTableSettings, S as SimpleAggregated, aw as Sql, l as SqlResource, c as Stream, d as StreamConfig, T as Task, ak as UInt16, al as UInt32, am as UInt64, aj as UInt8, at as Value, V as View, o as WebApp, p as WebAppConfig, q as WebAppHandler, a6 as WithDefault, W as Workflow, aB as createClickhouseParameter, y as getApi, x as getApis, w as getIngestApi, v as getIngestApis, Q as getMaterializedView, R as getMaterializedViews, B as getSqlResource, z as getSqlResources, u as getStream, t as getStreams, s as getTable, r as getTables, aA as getValueFromParameter, N as getView, P as getViews, K as getWebApp, J as getWebApps, H as getWorkflow, G as getWorkflows, aC as mapToClickHouseType, aq as quoteIdentifier, av as sql, ay as toQuery, az as toQueryPreview, ax as toStaticQuery } from './index-Aq9KzsRd.js';
|
|
3
2
|
import 'typia';
|
|
4
3
|
import 'typia/src/schemas/json/IJsonSchemaCollection';
|
|
4
|
+
import 'typia/lib/tags';
|
|
5
5
|
import 'node:stream';
|
|
6
6
|
import '@clickhouse/client';
|
|
7
7
|
import '@temporalio/client';
|
|
8
8
|
import 'jose';
|
|
9
9
|
import 'http';
|
|
10
|
-
|
|
10
|
+
|
|
11
|
+
type Key<T extends string | number | Date> = T;
|
|
12
|
+
type JWT<T extends object> = T;
|
|
13
|
+
|
|
14
|
+
export type { JWT, Key };
|
|
@@ -177,171 +177,33 @@ var init_dataModelTypes = __esm({
|
|
|
177
177
|
}
|
|
178
178
|
});
|
|
179
179
|
|
|
180
|
-
// src/
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
function createClickhouseParameter(parameterIndex, value) {
|
|
185
|
-
return `{p${parameterIndex}:${mapToClickHouseType(value)}}`;
|
|
186
|
-
}
|
|
187
|
-
function emptyIfUndefined(value) {
|
|
188
|
-
return value === void 0 ? "" : value;
|
|
189
|
-
}
|
|
190
|
-
var quoteIdentifier, isTable, isView, isColumn, instanceofSql, Sql, toStaticQuery, toQuery, toQueryPreview, getValueFromParameter, mapToClickHouseType;
|
|
191
|
-
var init_sqlHelpers = __esm({
|
|
192
|
-
"src/sqlHelpers.ts"() {
|
|
193
|
-
"use strict";
|
|
194
|
-
quoteIdentifier = (name) => {
|
|
195
|
-
return name.startsWith("`") && name.endsWith("`") ? name : `\`${name}\``;
|
|
196
|
-
};
|
|
197
|
-
isTable = (value) => typeof value === "object" && value !== null && "kind" in value && value.kind === "OlapTable";
|
|
198
|
-
isView = (value) => typeof value === "object" && value !== null && "kind" in value && value.kind === "View";
|
|
199
|
-
isColumn = (value) => typeof value === "object" && value !== null && !("kind" in value) && "name" in value && "annotations" in value;
|
|
200
|
-
instanceofSql = (value) => typeof value === "object" && "values" in value && "strings" in value;
|
|
201
|
-
Sql = class {
|
|
202
|
-
values;
|
|
203
|
-
strings;
|
|
204
|
-
constructor(rawStrings, rawValues) {
|
|
205
|
-
if (rawStrings.length - 1 !== rawValues.length) {
|
|
206
|
-
if (rawStrings.length === 0) {
|
|
207
|
-
throw new TypeError("Expected at least 1 string");
|
|
208
|
-
}
|
|
209
|
-
throw new TypeError(
|
|
210
|
-
`Expected ${rawStrings.length} strings to have ${rawStrings.length - 1} values`
|
|
211
|
-
);
|
|
212
|
-
}
|
|
213
|
-
const valuesLength = rawValues.reduce(
|
|
214
|
-
(len, value) => len + (instanceofSql(value) ? value.values.length : isColumn(value) || isTable(value) || isView(value) ? 0 : 1),
|
|
215
|
-
0
|
|
216
|
-
);
|
|
217
|
-
this.values = new Array(valuesLength);
|
|
218
|
-
this.strings = new Array(valuesLength + 1);
|
|
219
|
-
this.strings[0] = rawStrings[0];
|
|
220
|
-
let i = 0, pos = 0;
|
|
221
|
-
while (i < rawValues.length) {
|
|
222
|
-
const child = rawValues[i++];
|
|
223
|
-
const rawString = rawStrings[i];
|
|
224
|
-
if (instanceofSql(child)) {
|
|
225
|
-
this.strings[pos] += child.strings[0];
|
|
226
|
-
let childIndex = 0;
|
|
227
|
-
while (childIndex < child.values.length) {
|
|
228
|
-
this.values[pos++] = child.values[childIndex++];
|
|
229
|
-
this.strings[pos] = child.strings[childIndex];
|
|
230
|
-
}
|
|
231
|
-
this.strings[pos] += rawString;
|
|
232
|
-
} else if (isColumn(child)) {
|
|
233
|
-
const aggregationFunction = child.annotations.find(
|
|
234
|
-
([k, _]) => k === "aggregationFunction"
|
|
235
|
-
);
|
|
236
|
-
if (aggregationFunction !== void 0) {
|
|
237
|
-
this.strings[pos] += `${aggregationFunction[1].functionName}Merge(\`${child.name}\`)`;
|
|
238
|
-
} else {
|
|
239
|
-
this.strings[pos] += `\`${child.name}\``;
|
|
240
|
-
}
|
|
241
|
-
this.strings[pos] += rawString;
|
|
242
|
-
} else if (isTable(child)) {
|
|
243
|
-
if (child.config.database) {
|
|
244
|
-
this.strings[pos] += `\`${child.config.database}\`.\`${child.name}\``;
|
|
245
|
-
} else {
|
|
246
|
-
this.strings[pos] += `\`${child.name}\``;
|
|
247
|
-
}
|
|
248
|
-
this.strings[pos] += rawString;
|
|
249
|
-
} else if (isView(child)) {
|
|
250
|
-
this.strings[pos] += `\`${child.name}\``;
|
|
251
|
-
this.strings[pos] += rawString;
|
|
252
|
-
} else {
|
|
253
|
-
this.values[pos++] = child;
|
|
254
|
-
this.strings[pos] = rawString;
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
};
|
|
259
|
-
toStaticQuery = (sql3) => {
|
|
260
|
-
const [query, params] = toQuery(sql3);
|
|
261
|
-
if (Object.keys(params).length !== 0) {
|
|
262
|
-
throw new Error(
|
|
263
|
-
"Dynamic SQL is not allowed in the select statement in view creation."
|
|
264
|
-
);
|
|
265
|
-
}
|
|
266
|
-
return query;
|
|
267
|
-
};
|
|
268
|
-
toQuery = (sql3) => {
|
|
269
|
-
const parameterizedStubs = sql3.values.map(
|
|
270
|
-
(v, i) => createClickhouseParameter(i, v)
|
|
271
|
-
);
|
|
272
|
-
const query = sql3.strings.map(
|
|
273
|
-
(s, i) => s != "" ? `${s}${emptyIfUndefined(parameterizedStubs[i])}` : ""
|
|
274
|
-
).join("");
|
|
275
|
-
const query_params = sql3.values.reduce(
|
|
276
|
-
(acc, v, i) => ({
|
|
277
|
-
...acc,
|
|
278
|
-
[`p${i}`]: getValueFromParameter(v)
|
|
279
|
-
}),
|
|
280
|
-
{}
|
|
281
|
-
);
|
|
282
|
-
return [query, query_params];
|
|
283
|
-
};
|
|
284
|
-
toQueryPreview = (sql3) => {
|
|
285
|
-
try {
|
|
286
|
-
const formatValue = (v) => {
|
|
287
|
-
if (Array.isArray(v)) {
|
|
288
|
-
const [type, val] = v;
|
|
289
|
-
if (type === "Identifier") {
|
|
290
|
-
return `\`${String(val)}\``;
|
|
291
|
-
}
|
|
292
|
-
return `[${v.map((x) => formatValue(x)).join(", ")}]`;
|
|
293
|
-
}
|
|
294
|
-
if (v === null || v === void 0) return "NULL";
|
|
295
|
-
if (typeof v === "string") return `'${v.replace(/'/g, "''")}'`;
|
|
296
|
-
if (typeof v === "number") return String(v);
|
|
297
|
-
if (typeof v === "boolean") return v ? "true" : "false";
|
|
298
|
-
if (v instanceof Date)
|
|
299
|
-
return `'${v.toISOString().replace("T", " ").slice(0, 19)}'`;
|
|
300
|
-
try {
|
|
301
|
-
return JSON.stringify(v);
|
|
302
|
-
} catch {
|
|
303
|
-
return String(v);
|
|
304
|
-
}
|
|
305
|
-
};
|
|
306
|
-
let out = sql3.strings[0] ?? "";
|
|
307
|
-
for (let i = 0; i < sql3.values.length; i++) {
|
|
308
|
-
const val = getValueFromParameter(sql3.values[i]);
|
|
309
|
-
out += formatValue(val);
|
|
310
|
-
out += sql3.strings[i + 1] ?? "";
|
|
311
|
-
}
|
|
312
|
-
return out.replace(/\s+/g, " ").trim();
|
|
313
|
-
} catch (error) {
|
|
314
|
-
console.log(`toQueryPreview error: ${error}`);
|
|
315
|
-
return "/* query preview unavailable */";
|
|
316
|
-
}
|
|
317
|
-
};
|
|
318
|
-
getValueFromParameter = (value) => {
|
|
319
|
-
if (Array.isArray(value)) {
|
|
320
|
-
const [type, val] = value;
|
|
321
|
-
if (type === "Identifier") return val;
|
|
322
|
-
}
|
|
323
|
-
return value;
|
|
324
|
-
};
|
|
325
|
-
mapToClickHouseType = (value) => {
|
|
326
|
-
if (typeof value === "number") {
|
|
327
|
-
return Number.isInteger(value) ? "Int" : "Float";
|
|
328
|
-
}
|
|
329
|
-
if (typeof value === "boolean") return "Bool";
|
|
330
|
-
if (value instanceof Date) return "DateTime";
|
|
331
|
-
if (Array.isArray(value)) {
|
|
332
|
-
const [type, _] = value;
|
|
333
|
-
return type;
|
|
334
|
-
}
|
|
335
|
-
return "String";
|
|
336
|
-
};
|
|
337
|
-
}
|
|
338
|
-
});
|
|
339
|
-
|
|
340
|
-
// src/blocks/helpers.ts
|
|
341
|
-
var init_helpers = __esm({
|
|
342
|
-
"src/blocks/helpers.ts"() {
|
|
180
|
+
// src/dataModels/types.ts
|
|
181
|
+
var ClickHouseEngines;
|
|
182
|
+
var init_types = __esm({
|
|
183
|
+
"src/dataModels/types.ts"() {
|
|
343
184
|
"use strict";
|
|
344
|
-
|
|
185
|
+
ClickHouseEngines = /* @__PURE__ */ ((ClickHouseEngines2) => {
|
|
186
|
+
ClickHouseEngines2["MergeTree"] = "MergeTree";
|
|
187
|
+
ClickHouseEngines2["ReplacingMergeTree"] = "ReplacingMergeTree";
|
|
188
|
+
ClickHouseEngines2["SummingMergeTree"] = "SummingMergeTree";
|
|
189
|
+
ClickHouseEngines2["AggregatingMergeTree"] = "AggregatingMergeTree";
|
|
190
|
+
ClickHouseEngines2["CollapsingMergeTree"] = "CollapsingMergeTree";
|
|
191
|
+
ClickHouseEngines2["VersionedCollapsingMergeTree"] = "VersionedCollapsingMergeTree";
|
|
192
|
+
ClickHouseEngines2["GraphiteMergeTree"] = "GraphiteMergeTree";
|
|
193
|
+
ClickHouseEngines2["S3Queue"] = "S3Queue";
|
|
194
|
+
ClickHouseEngines2["S3"] = "S3";
|
|
195
|
+
ClickHouseEngines2["Buffer"] = "Buffer";
|
|
196
|
+
ClickHouseEngines2["Distributed"] = "Distributed";
|
|
197
|
+
ClickHouseEngines2["IcebergS3"] = "IcebergS3";
|
|
198
|
+
ClickHouseEngines2["Kafka"] = "Kafka";
|
|
199
|
+
ClickHouseEngines2["ReplicatedMergeTree"] = "ReplicatedMergeTree";
|
|
200
|
+
ClickHouseEngines2["ReplicatedReplacingMergeTree"] = "ReplicatedReplacingMergeTree";
|
|
201
|
+
ClickHouseEngines2["ReplicatedAggregatingMergeTree"] = "ReplicatedAggregatingMergeTree";
|
|
202
|
+
ClickHouseEngines2["ReplicatedSummingMergeTree"] = "ReplicatedSummingMergeTree";
|
|
203
|
+
ClickHouseEngines2["ReplicatedCollapsingMergeTree"] = "ReplicatedCollapsingMergeTree";
|
|
204
|
+
ClickHouseEngines2["ReplicatedVersionedCollapsingMergeTree"] = "ReplicatedVersionedCollapsingMergeTree";
|
|
205
|
+
return ClickHouseEngines2;
|
|
206
|
+
})(ClickHouseEngines || {});
|
|
345
207
|
}
|
|
346
208
|
});
|
|
347
209
|
|
|
@@ -519,9 +381,169 @@ var init_secrets = __esm({
|
|
|
519
381
|
}
|
|
520
382
|
});
|
|
521
383
|
|
|
384
|
+
// src/sqlHelpers.ts
|
|
385
|
+
function sql(strings, ...values) {
|
|
386
|
+
return new Sql(strings, values);
|
|
387
|
+
}
|
|
388
|
+
function createClickhouseParameter(parameterIndex, value) {
|
|
389
|
+
return `{p${parameterIndex}:${mapToClickHouseType(value)}}`;
|
|
390
|
+
}
|
|
391
|
+
function emptyIfUndefined(value) {
|
|
392
|
+
return value === void 0 ? "" : value;
|
|
393
|
+
}
|
|
394
|
+
var quoteIdentifier, isTable, isView, isColumn, instanceofSql, Sql, toStaticQuery, toQuery, toQueryPreview, getValueFromParameter, mapToClickHouseType;
|
|
395
|
+
var init_sqlHelpers = __esm({
|
|
396
|
+
"src/sqlHelpers.ts"() {
|
|
397
|
+
"use strict";
|
|
398
|
+
quoteIdentifier = (name) => {
|
|
399
|
+
return name.startsWith("`") && name.endsWith("`") ? name : `\`${name}\``;
|
|
400
|
+
};
|
|
401
|
+
isTable = (value) => typeof value === "object" && value !== null && "kind" in value && value.kind === "OlapTable";
|
|
402
|
+
isView = (value) => typeof value === "object" && value !== null && "kind" in value && value.kind === "View";
|
|
403
|
+
isColumn = (value) => typeof value === "object" && value !== null && !("kind" in value) && "name" in value && "annotations" in value;
|
|
404
|
+
instanceofSql = (value) => typeof value === "object" && "values" in value && "strings" in value;
|
|
405
|
+
Sql = class {
|
|
406
|
+
values;
|
|
407
|
+
strings;
|
|
408
|
+
constructor(rawStrings, rawValues) {
|
|
409
|
+
if (rawStrings.length - 1 !== rawValues.length) {
|
|
410
|
+
if (rawStrings.length === 0) {
|
|
411
|
+
throw new TypeError("Expected at least 1 string");
|
|
412
|
+
}
|
|
413
|
+
throw new TypeError(
|
|
414
|
+
`Expected ${rawStrings.length} strings to have ${rawStrings.length - 1} values`
|
|
415
|
+
);
|
|
416
|
+
}
|
|
417
|
+
const valuesLength = rawValues.reduce(
|
|
418
|
+
(len, value) => len + (instanceofSql(value) ? value.values.length : isColumn(value) || isTable(value) || isView(value) ? 0 : 1),
|
|
419
|
+
0
|
|
420
|
+
);
|
|
421
|
+
this.values = new Array(valuesLength);
|
|
422
|
+
this.strings = new Array(valuesLength + 1);
|
|
423
|
+
this.strings[0] = rawStrings[0];
|
|
424
|
+
let i = 0, pos = 0;
|
|
425
|
+
while (i < rawValues.length) {
|
|
426
|
+
const child = rawValues[i++];
|
|
427
|
+
const rawString = rawStrings[i];
|
|
428
|
+
if (instanceofSql(child)) {
|
|
429
|
+
this.strings[pos] += child.strings[0];
|
|
430
|
+
let childIndex = 0;
|
|
431
|
+
while (childIndex < child.values.length) {
|
|
432
|
+
this.values[pos++] = child.values[childIndex++];
|
|
433
|
+
this.strings[pos] = child.strings[childIndex];
|
|
434
|
+
}
|
|
435
|
+
this.strings[pos] += rawString;
|
|
436
|
+
} else if (isColumn(child)) {
|
|
437
|
+
const aggregationFunction = child.annotations.find(
|
|
438
|
+
([k, _]) => k === "aggregationFunction"
|
|
439
|
+
);
|
|
440
|
+
if (aggregationFunction !== void 0) {
|
|
441
|
+
this.strings[pos] += `${aggregationFunction[1].functionName}Merge(\`${child.name}\`)`;
|
|
442
|
+
} else {
|
|
443
|
+
this.strings[pos] += `\`${child.name}\``;
|
|
444
|
+
}
|
|
445
|
+
this.strings[pos] += rawString;
|
|
446
|
+
} else if (isTable(child)) {
|
|
447
|
+
if (child.config.database) {
|
|
448
|
+
this.strings[pos] += `\`${child.config.database}\`.\`${child.name}\``;
|
|
449
|
+
} else {
|
|
450
|
+
this.strings[pos] += `\`${child.name}\``;
|
|
451
|
+
}
|
|
452
|
+
this.strings[pos] += rawString;
|
|
453
|
+
} else if (isView(child)) {
|
|
454
|
+
this.strings[pos] += `\`${child.name}\``;
|
|
455
|
+
this.strings[pos] += rawString;
|
|
456
|
+
} else {
|
|
457
|
+
this.values[pos++] = child;
|
|
458
|
+
this.strings[pos] = rawString;
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
};
|
|
463
|
+
toStaticQuery = (sql3) => {
|
|
464
|
+
const [query, params] = toQuery(sql3);
|
|
465
|
+
if (Object.keys(params).length !== 0) {
|
|
466
|
+
throw new Error(
|
|
467
|
+
"Dynamic SQL is not allowed in the select statement in view creation."
|
|
468
|
+
);
|
|
469
|
+
}
|
|
470
|
+
return query;
|
|
471
|
+
};
|
|
472
|
+
toQuery = (sql3) => {
|
|
473
|
+
const parameterizedStubs = sql3.values.map(
|
|
474
|
+
(v, i) => createClickhouseParameter(i, v)
|
|
475
|
+
);
|
|
476
|
+
const query = sql3.strings.map(
|
|
477
|
+
(s, i) => s != "" ? `${s}${emptyIfUndefined(parameterizedStubs[i])}` : ""
|
|
478
|
+
).join("");
|
|
479
|
+
const query_params = sql3.values.reduce(
|
|
480
|
+
(acc, v, i) => ({
|
|
481
|
+
...acc,
|
|
482
|
+
[`p${i}`]: getValueFromParameter(v)
|
|
483
|
+
}),
|
|
484
|
+
{}
|
|
485
|
+
);
|
|
486
|
+
return [query, query_params];
|
|
487
|
+
};
|
|
488
|
+
toQueryPreview = (sql3) => {
|
|
489
|
+
try {
|
|
490
|
+
const formatValue = (v) => {
|
|
491
|
+
if (Array.isArray(v)) {
|
|
492
|
+
const [type, val] = v;
|
|
493
|
+
if (type === "Identifier") {
|
|
494
|
+
return `\`${String(val)}\``;
|
|
495
|
+
}
|
|
496
|
+
return `[${v.map((x) => formatValue(x)).join(", ")}]`;
|
|
497
|
+
}
|
|
498
|
+
if (v === null || v === void 0) return "NULL";
|
|
499
|
+
if (typeof v === "string") return `'${v.replace(/'/g, "''")}'`;
|
|
500
|
+
if (typeof v === "number") return String(v);
|
|
501
|
+
if (typeof v === "boolean") return v ? "true" : "false";
|
|
502
|
+
if (v instanceof Date)
|
|
503
|
+
return `'${v.toISOString().replace("T", " ").slice(0, 19)}'`;
|
|
504
|
+
try {
|
|
505
|
+
return JSON.stringify(v);
|
|
506
|
+
} catch {
|
|
507
|
+
return String(v);
|
|
508
|
+
}
|
|
509
|
+
};
|
|
510
|
+
let out = sql3.strings[0] ?? "";
|
|
511
|
+
for (let i = 0; i < sql3.values.length; i++) {
|
|
512
|
+
const val = getValueFromParameter(sql3.values[i]);
|
|
513
|
+
out += formatValue(val);
|
|
514
|
+
out += sql3.strings[i + 1] ?? "";
|
|
515
|
+
}
|
|
516
|
+
return out.replace(/\s+/g, " ").trim();
|
|
517
|
+
} catch (error) {
|
|
518
|
+
console.log(`toQueryPreview error: ${error}`);
|
|
519
|
+
return "/* query preview unavailable */";
|
|
520
|
+
}
|
|
521
|
+
};
|
|
522
|
+
getValueFromParameter = (value) => {
|
|
523
|
+
if (Array.isArray(value)) {
|
|
524
|
+
const [type, val] = value;
|
|
525
|
+
if (type === "Identifier") return val;
|
|
526
|
+
}
|
|
527
|
+
return value;
|
|
528
|
+
};
|
|
529
|
+
mapToClickHouseType = (value) => {
|
|
530
|
+
if (typeof value === "number") {
|
|
531
|
+
return Number.isInteger(value) ? "Int" : "Float";
|
|
532
|
+
}
|
|
533
|
+
if (typeof value === "boolean") return "Bool";
|
|
534
|
+
if (value instanceof Date) return "DateTime";
|
|
535
|
+
if (Array.isArray(value)) {
|
|
536
|
+
const [type, _] = value;
|
|
537
|
+
return type;
|
|
538
|
+
}
|
|
539
|
+
return "String";
|
|
540
|
+
};
|
|
541
|
+
}
|
|
542
|
+
});
|
|
543
|
+
|
|
522
544
|
// src/consumption-apis/helpers.ts
|
|
523
545
|
var import_client2, import_node_crypto;
|
|
524
|
-
var
|
|
546
|
+
var init_helpers = __esm({
|
|
525
547
|
"src/consumption-apis/helpers.ts"() {
|
|
526
548
|
"use strict";
|
|
527
549
|
import_client2 = require("@temporalio/client");
|
|
@@ -562,7 +584,7 @@ var init_runner = __esm({
|
|
|
562
584
|
"src/consumption-apis/runner.ts"() {
|
|
563
585
|
"use strict";
|
|
564
586
|
init_commons();
|
|
565
|
-
|
|
587
|
+
init_helpers();
|
|
566
588
|
jose = __toESM(require("jose"));
|
|
567
589
|
init_cluster_utils();
|
|
568
590
|
init_sqlHelpers();
|
|
@@ -583,7 +605,7 @@ var init_redisClient = __esm({
|
|
|
583
605
|
var init_standalone = __esm({
|
|
584
606
|
"src/consumption-apis/standalone.ts"() {
|
|
585
607
|
"use strict";
|
|
586
|
-
|
|
608
|
+
init_helpers();
|
|
587
609
|
init_commons();
|
|
588
610
|
init_sqlHelpers();
|
|
589
611
|
}
|
|
@@ -633,27 +655,19 @@ var init_dataSource = __esm({
|
|
|
633
655
|
}
|
|
634
656
|
});
|
|
635
657
|
|
|
636
|
-
// src/dataModels/types.ts
|
|
637
|
-
var init_types = __esm({
|
|
638
|
-
"src/dataModels/types.ts"() {
|
|
639
|
-
"use strict";
|
|
640
|
-
}
|
|
641
|
-
});
|
|
642
|
-
|
|
643
658
|
// src/index.ts
|
|
644
659
|
var init_index = __esm({
|
|
645
660
|
"src/index.ts"() {
|
|
646
661
|
"use strict";
|
|
647
662
|
init_browserCompatible();
|
|
648
|
-
init_helpers();
|
|
649
663
|
init_commons();
|
|
650
664
|
init_secrets();
|
|
651
|
-
|
|
665
|
+
init_helpers();
|
|
652
666
|
init_webAppHelpers();
|
|
653
667
|
init_task();
|
|
654
668
|
init_runner();
|
|
655
669
|
init_redisClient();
|
|
656
|
-
|
|
670
|
+
init_helpers();
|
|
657
671
|
init_standalone();
|
|
658
672
|
init_sqlHelpers();
|
|
659
673
|
init_utilities();
|
|
@@ -1005,7 +1019,7 @@ var init_olapTable = __esm({
|
|
|
1005
1019
|
"use strict";
|
|
1006
1020
|
init_typedBase();
|
|
1007
1021
|
init_dataModelTypes();
|
|
1008
|
-
|
|
1022
|
+
init_types();
|
|
1009
1023
|
init_internal();
|
|
1010
1024
|
import_node_stream = require("stream");
|
|
1011
1025
|
import_node_crypto2 = require("crypto");
|
|
@@ -2300,7 +2314,7 @@ var init_ingestPipeline = __esm({
|
|
|
2300
2314
|
init_stream();
|
|
2301
2315
|
init_olapTable();
|
|
2302
2316
|
init_ingestApi();
|
|
2303
|
-
|
|
2317
|
+
init_types();
|
|
2304
2318
|
IngestPipeline = class extends TypedBase {
|
|
2305
2319
|
/**
|
|
2306
2320
|
* The OLAP table component of the pipeline, if configured.
|
|
@@ -2573,7 +2587,7 @@ var requireTargetTableName, MaterializedView;
|
|
|
2573
2587
|
var init_materializedView = __esm({
|
|
2574
2588
|
"src/dmv2/sdk/materializedView.ts"() {
|
|
2575
2589
|
"use strict";
|
|
2576
|
-
|
|
2590
|
+
init_types();
|
|
2577
2591
|
init_sqlHelpers();
|
|
2578
2592
|
init_olapTable();
|
|
2579
2593
|
init_internal();
|
|
@@ -2992,6 +3006,7 @@ var init_dmv2 = __esm({
|
|
|
2992
3006
|
"src/dmv2/index.ts"() {
|
|
2993
3007
|
"use strict";
|
|
2994
3008
|
init_olapTable();
|
|
3009
|
+
init_types();
|
|
2995
3010
|
init_stream();
|
|
2996
3011
|
init_workflow();
|
|
2997
3012
|
init_ingestApi();
|
|
@@ -3011,6 +3026,7 @@ var init_dmv2 = __esm({
|
|
|
3011
3026
|
var browserCompatible_exports = {};
|
|
3012
3027
|
__export(browserCompatible_exports, {
|
|
3013
3028
|
Api: () => Api,
|
|
3029
|
+
ClickHouseEngines: () => ClickHouseEngines,
|
|
3014
3030
|
ConsumptionApi: () => ConsumptionApi,
|
|
3015
3031
|
DeadLetterQueue: () => DeadLetterQueue,
|
|
3016
3032
|
ETLPipeline: () => ETLPipeline,
|
|
@@ -3065,6 +3081,7 @@ init_browserCompatible();
|
|
|
3065
3081
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3066
3082
|
0 && (module.exports = {
|
|
3067
3083
|
Api,
|
|
3084
|
+
ClickHouseEngines,
|
|
3068
3085
|
ConsumptionApi,
|
|
3069
3086
|
DeadLetterQueue,
|
|
3070
3087
|
ETLPipeline,
|