@514labs/moose-lib 0.6.256-ci-4-g0ca62054 → 0.6.256-ci-3-gafce5840
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-B_aEflr_.d.ts → browserCompatible-B6i2YRSY.d.ts} +1 -1
- package/dist/{browserCompatible-DnYA4Zgi.d.mts → browserCompatible-CMIa49e4.d.mts} +1 -1
- package/dist/browserCompatible.d.mts +2 -2
- package/dist/browserCompatible.d.ts +2 -2
- package/dist/browserCompatible.js +91 -95
- package/dist/browserCompatible.js.map +1 -1
- package/dist/browserCompatible.mjs +91 -95
- package/dist/browserCompatible.mjs.map +1 -1
- package/dist/compilerPlugin.js.map +1 -1
- package/dist/compilerPlugin.mjs.map +1 -1
- package/dist/dmv2/index.d.mts +1 -1
- package/dist/dmv2/index.d.ts +1 -1
- package/dist/dmv2/index.js +91 -95
- package/dist/dmv2/index.js.map +1 -1
- package/dist/dmv2/index.mjs +91 -95
- package/dist/dmv2/index.mjs.map +1 -1
- package/dist/{index-rECDLgTX.d.mts → index-BpasnHLt.d.mts} +56 -36
- package/dist/{index-rECDLgTX.d.ts → index-BpasnHLt.d.ts} +56 -36
- package/dist/index.d.mts +5 -28
- package/dist/index.d.ts +5 -28
- package/dist/index.js +93 -87
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +93 -86
- package/dist/index.mjs.map +1 -1
- package/dist/moose-runner.js +231 -105
- package/dist/moose-runner.js.map +1 -1
- package/dist/moose-runner.mjs +231 -105
- package/dist/moose-runner.mjs.map +1 -1
- package/package.json +2 -2
package/dist/dmv2/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as Aggregated, h as Api, i as ApiConfig, ag as ConsumerConfig, C as ConsumptionApi, e as DeadLetter, D as DeadLetterModel, f as DeadLetterQueue, l as ETLPipeline, m as ETLPipelineConfig, E as EgressConfig, F as FrameworkApp, I as IngestApi, g as IngestConfig, j as IngestPipeline, ak as IngestPipelineConfig, L as LifeCycle, M as MaterializedView, al as MaterializedViewConfig, a as OlapConfig, O as OlapTable, b as S3QueueTableSettings, S as SimpleAggregated, k as SqlResource, c as Stream, d as StreamConfig, T as Task, aj as TaskConfig, ai as TaskContext, ah as TransformConfig, V as View, n as WebApp, o as WebAppConfig, p as WebAppHandler, W as Workflow, x as getApi, w as getApis, v as getIngestApi, u as getIngestApis, z as getSqlResource, y as getSqlResources, t as getStream, s as getStreams, r as getTable, q as getTables, J as getWebApp, H as getWebApps, G as getWorkflow, B as getWorkflows } from '../index-
|
|
1
|
+
export { A as Aggregated, h as Api, i as ApiConfig, ag as ConsumerConfig, C as ConsumptionApi, e as DeadLetter, D as DeadLetterModel, f as DeadLetterQueue, l as ETLPipeline, m as ETLPipelineConfig, E as EgressConfig, F as FrameworkApp, I as IngestApi, g as IngestConfig, j as IngestPipeline, ak as IngestPipelineConfig, L as LifeCycle, M as MaterializedView, al as MaterializedViewConfig, a as OlapConfig, O as OlapTable, b as S3QueueTableSettings, S as SimpleAggregated, k as SqlResource, c as Stream, d as StreamConfig, T as Task, aj as TaskConfig, ai as TaskContext, ah as TransformConfig, V as View, n as WebApp, o as WebAppConfig, p as WebAppHandler, W as Workflow, x as getApi, w as getApis, v as getIngestApi, u as getIngestApis, z as getSqlResource, y as getSqlResources, t as getStream, s as getStreams, r as getTable, q as getTables, J as getWebApp, H as getWebApps, G as getWorkflow, B as getWorkflows } from '../index-BpasnHLt.mjs';
|
|
2
2
|
import 'typia';
|
|
3
3
|
import 'typia/src/schemas/json/IJsonSchemaCollection';
|
|
4
4
|
import 'node:stream';
|
package/dist/dmv2/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as Aggregated, h as Api, i as ApiConfig, ag as ConsumerConfig, C as ConsumptionApi, e as DeadLetter, D as DeadLetterModel, f as DeadLetterQueue, l as ETLPipeline, m as ETLPipelineConfig, E as EgressConfig, F as FrameworkApp, I as IngestApi, g as IngestConfig, j as IngestPipeline, ak as IngestPipelineConfig, L as LifeCycle, M as MaterializedView, al as MaterializedViewConfig, a as OlapConfig, O as OlapTable, b as S3QueueTableSettings, S as SimpleAggregated, k as SqlResource, c as Stream, d as StreamConfig, T as Task, aj as TaskConfig, ai as TaskContext, ah as TransformConfig, V as View, n as WebApp, o as WebAppConfig, p as WebAppHandler, W as Workflow, x as getApi, w as getApis, v as getIngestApi, u as getIngestApis, z as getSqlResource, y as getSqlResources, t as getStream, s as getStreams, r as getTable, q as getTables, J as getWebApp, H as getWebApps, G as getWorkflow, B as getWorkflows } from '../index-
|
|
1
|
+
export { A as Aggregated, h as Api, i as ApiConfig, ag as ConsumerConfig, C as ConsumptionApi, e as DeadLetter, D as DeadLetterModel, f as DeadLetterQueue, l as ETLPipeline, m as ETLPipelineConfig, E as EgressConfig, F as FrameworkApp, I as IngestApi, g as IngestConfig, j as IngestPipeline, ak as IngestPipelineConfig, L as LifeCycle, M as MaterializedView, al as MaterializedViewConfig, a as OlapConfig, O as OlapTable, b as S3QueueTableSettings, S as SimpleAggregated, k as SqlResource, c as Stream, d as StreamConfig, T as Task, aj as TaskConfig, ai as TaskContext, ah as TransformConfig, V as View, n as WebApp, o as WebAppConfig, p as WebAppHandler, W as Workflow, x as getApi, w as getApis, v as getIngestApi, u as getIngestApis, z as getSqlResource, y as getSqlResources, t as getStream, s as getStreams, r as getTable, q as getTables, J as getWebApp, H as getWebApps, G as getWorkflow, B as getWorkflows } from '../index-BpasnHLt.js';
|
|
2
2
|
import 'typia';
|
|
3
3
|
import 'typia/src/schemas/json/IJsonSchemaCollection';
|
|
4
4
|
import 'node:stream';
|
package/dist/dmv2/index.js
CHANGED
|
@@ -42,7 +42,6 @@ __export(commons_exports, {
|
|
|
42
42
|
antiCachePath: () => antiCachePath,
|
|
43
43
|
cliLog: () => cliLog,
|
|
44
44
|
compilerLog: () => compilerLog,
|
|
45
|
-
createProducerConfig: () => createProducerConfig,
|
|
46
45
|
getClickhouseClient: () => getClickhouseClient,
|
|
47
46
|
getFileName: () => getFileName,
|
|
48
47
|
getKafkaClient: () => getKafkaClient,
|
|
@@ -65,25 +64,18 @@ function isTruthy(value) {
|
|
|
65
64
|
function mapTstoJs(filePath) {
|
|
66
65
|
return filePath.replace(/\.ts$/, ".js").replace(/\.cts$/, ".cjs").replace(/\.mts$/, ".mjs");
|
|
67
66
|
}
|
|
68
|
-
function
|
|
69
|
-
|
|
67
|
+
async function getKafkaProducer(cfg, logger) {
|
|
68
|
+
const kafka = await getKafkaClient(cfg, logger);
|
|
69
|
+
const producer = kafka.producer({
|
|
70
70
|
kafkaJS: {
|
|
71
|
-
idempotent:
|
|
72
|
-
// Not needed for at-least-once delivery
|
|
71
|
+
idempotent: true,
|
|
73
72
|
acks: ACKs,
|
|
74
73
|
retry: {
|
|
75
74
|
retries: MAX_RETRIES_PRODUCER,
|
|
76
75
|
maxRetryTime: MAX_RETRY_TIME_MS
|
|
77
76
|
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// This is to make sure at least once delivery with immediate feedback on the send
|
|
81
|
-
...maxMessageBytes && { "message.max.bytes": maxMessageBytes }
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
async function getKafkaProducer(cfg, logger, maxMessageBytes) {
|
|
85
|
-
const kafka = await getKafkaClient(cfg, logger);
|
|
86
|
-
const producer = kafka.producer(createProducerConfig(maxMessageBytes));
|
|
77
|
+
}
|
|
78
|
+
});
|
|
87
79
|
await producer.connect();
|
|
88
80
|
return producer;
|
|
89
81
|
}
|
|
@@ -563,16 +555,6 @@ function emptyIfUndefined(value) {
|
|
|
563
555
|
return value === void 0 ? "" : value;
|
|
564
556
|
}
|
|
565
557
|
|
|
566
|
-
// src/blocks/helpers.ts
|
|
567
|
-
function dropView(name) {
|
|
568
|
-
return `DROP VIEW IF EXISTS ${quoteIdentifier(name)}`.trim();
|
|
569
|
-
}
|
|
570
|
-
function createMaterializedView(options) {
|
|
571
|
-
return `CREATE MATERIALIZED VIEW IF NOT EXISTS ${quoteIdentifier(options.name)}
|
|
572
|
-
TO ${quoteIdentifier(options.destinationTable)}
|
|
573
|
-
AS ${options.select}`.trim();
|
|
574
|
-
}
|
|
575
|
-
|
|
576
558
|
// src/dmv2/internal.ts
|
|
577
559
|
var import_process = __toESM(require("process"));
|
|
578
560
|
|
|
@@ -623,7 +605,9 @@ var moose_internal = {
|
|
|
623
605
|
apis: /* @__PURE__ */ new Map(),
|
|
624
606
|
sqlResources: /* @__PURE__ */ new Map(),
|
|
625
607
|
workflows: /* @__PURE__ */ new Map(),
|
|
626
|
-
webApps: /* @__PURE__ */ new Map()
|
|
608
|
+
webApps: /* @__PURE__ */ new Map(),
|
|
609
|
+
materializedViews: /* @__PURE__ */ new Map(),
|
|
610
|
+
customViews: /* @__PURE__ */ new Map()
|
|
627
611
|
};
|
|
628
612
|
var defaultRetentionPeriod = 60 * 60 * 24 * 7;
|
|
629
613
|
var getMooseInternal = () => globalThis.moose_internal;
|
|
@@ -2239,6 +2223,67 @@ var ETLPipeline = class {
|
|
|
2239
2223
|
}
|
|
2240
2224
|
};
|
|
2241
2225
|
|
|
2226
|
+
// src/dmv2/sdk/materializedView.ts
|
|
2227
|
+
var requireTargetTableName = (tableName) => {
|
|
2228
|
+
if (typeof tableName === "string") {
|
|
2229
|
+
return tableName;
|
|
2230
|
+
} else {
|
|
2231
|
+
throw new Error("Name of targetTable is not specified.");
|
|
2232
|
+
}
|
|
2233
|
+
};
|
|
2234
|
+
var MaterializedView = class {
|
|
2235
|
+
/** @internal */
|
|
2236
|
+
kind = "MaterializedView";
|
|
2237
|
+
/** The name of the materialized view */
|
|
2238
|
+
name;
|
|
2239
|
+
/** The target OlapTable instance where the materialized data is stored. */
|
|
2240
|
+
targetTable;
|
|
2241
|
+
/** The SELECT SQL statement */
|
|
2242
|
+
selectSql;
|
|
2243
|
+
/** Names of source tables that the SELECT reads from */
|
|
2244
|
+
sourceTables;
|
|
2245
|
+
/** @internal Source file path where this MV was defined */
|
|
2246
|
+
sourceFile;
|
|
2247
|
+
constructor(options, targetSchema, targetColumns) {
|
|
2248
|
+
let selectStatement = options.selectStatement;
|
|
2249
|
+
if (typeof selectStatement !== "string") {
|
|
2250
|
+
selectStatement = toStaticQuery(selectStatement);
|
|
2251
|
+
}
|
|
2252
|
+
if (targetSchema === void 0 || targetColumns === void 0) {
|
|
2253
|
+
throw new Error(
|
|
2254
|
+
"Supply the type param T so that the schema is inserted by the compiler plugin."
|
|
2255
|
+
);
|
|
2256
|
+
}
|
|
2257
|
+
const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
|
|
2258
|
+
requireTargetTableName(
|
|
2259
|
+
options.targetTable?.name ?? options.tableName
|
|
2260
|
+
),
|
|
2261
|
+
{
|
|
2262
|
+
orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
|
|
2263
|
+
engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
|
|
2264
|
+
},
|
|
2265
|
+
targetSchema,
|
|
2266
|
+
targetColumns
|
|
2267
|
+
);
|
|
2268
|
+
if (targetTable.name === options.materializedViewName) {
|
|
2269
|
+
throw new Error(
|
|
2270
|
+
"Materialized view name cannot be the same as the target table name."
|
|
2271
|
+
);
|
|
2272
|
+
}
|
|
2273
|
+
this.name = options.materializedViewName;
|
|
2274
|
+
this.targetTable = targetTable;
|
|
2275
|
+
this.selectSql = selectStatement;
|
|
2276
|
+
this.sourceTables = options.selectTables.map((t) => t.name);
|
|
2277
|
+
const stack = new Error().stack;
|
|
2278
|
+
this.sourceFile = getSourceFileFromStack(stack);
|
|
2279
|
+
const materializedViews = getMooseInternal().materializedViews;
|
|
2280
|
+
if (!isClientOnlyMode() && materializedViews.has(this.name)) {
|
|
2281
|
+
throw new Error(`MaterializedView with name ${this.name} already exists`);
|
|
2282
|
+
}
|
|
2283
|
+
materializedViews.set(this.name, this);
|
|
2284
|
+
}
|
|
2285
|
+
};
|
|
2286
|
+
|
|
2242
2287
|
// src/dmv2/sdk/sqlResource.ts
|
|
2243
2288
|
var SqlResource = class {
|
|
2244
2289
|
/** @internal */
|
|
@@ -2284,66 +2329,18 @@ var SqlResource = class {
|
|
|
2284
2329
|
}
|
|
2285
2330
|
};
|
|
2286
2331
|
|
|
2287
|
-
// src/dmv2/sdk/materializedView.ts
|
|
2288
|
-
var requireTargetTableName = (tableName) => {
|
|
2289
|
-
if (typeof tableName === "string") {
|
|
2290
|
-
return tableName;
|
|
2291
|
-
} else {
|
|
2292
|
-
throw new Error("Name of targetTable is not specified.");
|
|
2293
|
-
}
|
|
2294
|
-
};
|
|
2295
|
-
var MaterializedView = class extends SqlResource {
|
|
2296
|
-
/** The target OlapTable instance where the materialized data is stored. */
|
|
2297
|
-
targetTable;
|
|
2298
|
-
constructor(options, targetSchema, targetColumns) {
|
|
2299
|
-
let selectStatement = options.selectStatement;
|
|
2300
|
-
if (typeof selectStatement !== "string") {
|
|
2301
|
-
selectStatement = toStaticQuery(selectStatement);
|
|
2302
|
-
}
|
|
2303
|
-
if (targetSchema === void 0 || targetColumns === void 0) {
|
|
2304
|
-
throw new Error(
|
|
2305
|
-
"Supply the type param T so that the schema is inserted by the compiler plugin."
|
|
2306
|
-
);
|
|
2307
|
-
}
|
|
2308
|
-
const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
|
|
2309
|
-
requireTargetTableName(
|
|
2310
|
-
options.targetTable?.name ?? options.tableName
|
|
2311
|
-
),
|
|
2312
|
-
{
|
|
2313
|
-
orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
|
|
2314
|
-
engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
|
|
2315
|
-
},
|
|
2316
|
-
targetSchema,
|
|
2317
|
-
targetColumns
|
|
2318
|
-
);
|
|
2319
|
-
if (targetTable.name === options.materializedViewName) {
|
|
2320
|
-
throw new Error(
|
|
2321
|
-
"Materialized view name cannot be the same as the target table name."
|
|
2322
|
-
);
|
|
2323
|
-
}
|
|
2324
|
-
super(
|
|
2325
|
-
options.materializedViewName,
|
|
2326
|
-
[
|
|
2327
|
-
createMaterializedView({
|
|
2328
|
-
name: options.materializedViewName,
|
|
2329
|
-
destinationTable: targetTable.name,
|
|
2330
|
-
select: selectStatement
|
|
2331
|
-
})
|
|
2332
|
-
// Population is now handled automatically by Rust infrastructure
|
|
2333
|
-
// based on table engine type and whether this is a new or updated view
|
|
2334
|
-
],
|
|
2335
|
-
[dropView(options.materializedViewName)],
|
|
2336
|
-
{
|
|
2337
|
-
pullsDataFrom: options.selectTables,
|
|
2338
|
-
pushesDataTo: [targetTable]
|
|
2339
|
-
}
|
|
2340
|
-
);
|
|
2341
|
-
this.targetTable = targetTable;
|
|
2342
|
-
}
|
|
2343
|
-
};
|
|
2344
|
-
|
|
2345
2332
|
// src/dmv2/sdk/view.ts
|
|
2346
|
-
var View = class
|
|
2333
|
+
var View = class {
|
|
2334
|
+
/** @internal */
|
|
2335
|
+
kind = "CustomView";
|
|
2336
|
+
/** The name of the view */
|
|
2337
|
+
name;
|
|
2338
|
+
/** The SELECT SQL statement that defines the view */
|
|
2339
|
+
selectSql;
|
|
2340
|
+
/** Names of source tables/views that the SELECT reads from */
|
|
2341
|
+
sourceTables;
|
|
2342
|
+
/** @internal Source file path where this view was defined */
|
|
2343
|
+
sourceFile;
|
|
2347
2344
|
/**
|
|
2348
2345
|
* Creates a new View instance.
|
|
2349
2346
|
* @param name The name of the view to be created.
|
|
@@ -2354,17 +2351,16 @@ var View = class extends SqlResource {
|
|
|
2354
2351
|
if (typeof selectStatement !== "string") {
|
|
2355
2352
|
selectStatement = toStaticQuery(selectStatement);
|
|
2356
2353
|
}
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
{
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
);
|
|
2354
|
+
this.name = name;
|
|
2355
|
+
this.selectSql = selectStatement;
|
|
2356
|
+
this.sourceTables = baseTables.map((t) => t.name);
|
|
2357
|
+
const stack = new Error().stack;
|
|
2358
|
+
this.sourceFile = getSourceFileFromStack(stack);
|
|
2359
|
+
const customViews = getMooseInternal().customViews;
|
|
2360
|
+
if (!isClientOnlyMode() && customViews.has(this.name)) {
|
|
2361
|
+
throw new Error(`View with name ${this.name} already exists`);
|
|
2362
|
+
}
|
|
2363
|
+
customViews.set(this.name, this);
|
|
2368
2364
|
}
|
|
2369
2365
|
};
|
|
2370
2366
|
|