@514labs/moose-lib 0.6.295-ci-20-gbe187727 → 0.6.295
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-DhVPp9qX.d.ts → browserCompatible-B8CAYjv5.d.ts} +1 -1
- package/dist/{browserCompatible-DCCiBirg.d.mts → browserCompatible-ChWHzgtb.d.mts} +1 -1
- package/dist/browserCompatible.d.mts +2 -2
- package/dist/browserCompatible.d.ts +2 -2
- package/dist/browserCompatible.js +81 -105
- package/dist/browserCompatible.js.map +1 -1
- package/dist/browserCompatible.mjs +81 -101
- package/dist/browserCompatible.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 +81 -105
- package/dist/dmv2/index.js.map +1 -1
- package/dist/dmv2/index.mjs +81 -101
- package/dist/dmv2/index.mjs.map +1 -1
- package/dist/{index-CcZRaA0b.d.mts → index-rQOQo9sv.d.mts} +41 -83
- package/dist/{index-CcZRaA0b.d.ts → index-rQOQo9sv.d.ts} +41 -83
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +71 -107
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +71 -103
- package/dist/index.mjs.map +1 -1
- package/dist/moose-runner.js +2 -28
- package/dist/moose-runner.js.map +1 -1
- package/dist/moose-runner.mjs +2 -28
- package/dist/moose-runner.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -695,9 +695,7 @@ var moose_internal = {
|
|
|
695
695
|
apis: /* @__PURE__ */ new Map(),
|
|
696
696
|
sqlResources: /* @__PURE__ */ new Map(),
|
|
697
697
|
workflows: /* @__PURE__ */ new Map(),
|
|
698
|
-
webApps: /* @__PURE__ */ new Map()
|
|
699
|
-
materializedViews: /* @__PURE__ */ new Map(),
|
|
700
|
-
customViews: /* @__PURE__ */ new Map()
|
|
698
|
+
webApps: /* @__PURE__ */ new Map()
|
|
701
699
|
};
|
|
702
700
|
var defaultRetentionPeriod = 60 * 60 * 24 * 7;
|
|
703
701
|
var getMooseInternal = () => globalThis.moose_internal;
|
|
@@ -713,8 +711,6 @@ var loadIndex = () => {
|
|
|
713
711
|
registry.sqlResources.clear();
|
|
714
712
|
registry.workflows.clear();
|
|
715
713
|
registry.webApps.clear();
|
|
716
|
-
registry.materializedViews.clear();
|
|
717
|
-
registry.customViews.clear();
|
|
718
714
|
const appDir = `${process2.cwd()}/${getSourceDir()}`;
|
|
719
715
|
Object.keys(__require.cache).forEach((key) => {
|
|
720
716
|
if (key.startsWith(appDir)) {
|
|
@@ -2366,67 +2362,6 @@ var ETLPipeline = class {
|
|
|
2366
2362
|
}
|
|
2367
2363
|
};
|
|
2368
2364
|
|
|
2369
|
-
// src/dmv2/sdk/materializedView.ts
|
|
2370
|
-
var requireTargetTableName = (tableName) => {
|
|
2371
|
-
if (typeof tableName === "string") {
|
|
2372
|
-
return tableName;
|
|
2373
|
-
} else {
|
|
2374
|
-
throw new Error("Name of targetTable is not specified.");
|
|
2375
|
-
}
|
|
2376
|
-
};
|
|
2377
|
-
var MaterializedView = class {
|
|
2378
|
-
/** @internal */
|
|
2379
|
-
kind = "MaterializedView";
|
|
2380
|
-
/** The name of the materialized view */
|
|
2381
|
-
name;
|
|
2382
|
-
/** The target OlapTable instance where the materialized data is stored. */
|
|
2383
|
-
targetTable;
|
|
2384
|
-
/** The SELECT SQL statement */
|
|
2385
|
-
selectSql;
|
|
2386
|
-
/** Names of source tables that the SELECT reads from */
|
|
2387
|
-
sourceTables;
|
|
2388
|
-
/** @internal Source file path where this MV was defined */
|
|
2389
|
-
sourceFile;
|
|
2390
|
-
constructor(options, targetSchema, targetColumns) {
|
|
2391
|
-
let selectStatement = options.selectStatement;
|
|
2392
|
-
if (typeof selectStatement !== "string") {
|
|
2393
|
-
selectStatement = toStaticQuery(selectStatement);
|
|
2394
|
-
}
|
|
2395
|
-
if (targetSchema === void 0 || targetColumns === void 0) {
|
|
2396
|
-
throw new Error(
|
|
2397
|
-
"Supply the type param T so that the schema is inserted by the compiler plugin."
|
|
2398
|
-
);
|
|
2399
|
-
}
|
|
2400
|
-
const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
|
|
2401
|
-
requireTargetTableName(
|
|
2402
|
-
options.targetTable?.name ?? options.tableName
|
|
2403
|
-
),
|
|
2404
|
-
{
|
|
2405
|
-
orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
|
|
2406
|
-
engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
|
|
2407
|
-
},
|
|
2408
|
-
targetSchema,
|
|
2409
|
-
targetColumns
|
|
2410
|
-
);
|
|
2411
|
-
if (targetTable.name === options.materializedViewName) {
|
|
2412
|
-
throw new Error(
|
|
2413
|
-
"Materialized view name cannot be the same as the target table name."
|
|
2414
|
-
);
|
|
2415
|
-
}
|
|
2416
|
-
this.name = options.materializedViewName;
|
|
2417
|
-
this.targetTable = targetTable;
|
|
2418
|
-
this.selectSql = selectStatement;
|
|
2419
|
-
this.sourceTables = options.selectTables.map((t) => t.name);
|
|
2420
|
-
const stack = new Error().stack;
|
|
2421
|
-
this.sourceFile = getSourceFileFromStack(stack);
|
|
2422
|
-
const materializedViews = getMooseInternal().materializedViews;
|
|
2423
|
-
if (!isClientOnlyMode() && materializedViews.has(this.name)) {
|
|
2424
|
-
throw new Error(`MaterializedView with name ${this.name} already exists`);
|
|
2425
|
-
}
|
|
2426
|
-
materializedViews.set(this.name, this);
|
|
2427
|
-
}
|
|
2428
|
-
};
|
|
2429
|
-
|
|
2430
2365
|
// src/dmv2/sdk/sqlResource.ts
|
|
2431
2366
|
var SqlResource = class {
|
|
2432
2367
|
/** @internal */
|
|
@@ -2481,18 +2416,66 @@ var SqlResource = class {
|
|
|
2481
2416
|
}
|
|
2482
2417
|
};
|
|
2483
2418
|
|
|
2419
|
+
// src/dmv2/sdk/materializedView.ts
|
|
2420
|
+
var requireTargetTableName = (tableName) => {
|
|
2421
|
+
if (typeof tableName === "string") {
|
|
2422
|
+
return tableName;
|
|
2423
|
+
} else {
|
|
2424
|
+
throw new Error("Name of targetTable is not specified.");
|
|
2425
|
+
}
|
|
2426
|
+
};
|
|
2427
|
+
var MaterializedView = class extends SqlResource {
|
|
2428
|
+
/** The target OlapTable instance where the materialized data is stored. */
|
|
2429
|
+
targetTable;
|
|
2430
|
+
constructor(options, targetSchema, targetColumns) {
|
|
2431
|
+
let selectStatement = options.selectStatement;
|
|
2432
|
+
if (typeof selectStatement !== "string") {
|
|
2433
|
+
selectStatement = toStaticQuery(selectStatement);
|
|
2434
|
+
}
|
|
2435
|
+
if (targetSchema === void 0 || targetColumns === void 0) {
|
|
2436
|
+
throw new Error(
|
|
2437
|
+
"Supply the type param T so that the schema is inserted by the compiler plugin."
|
|
2438
|
+
);
|
|
2439
|
+
}
|
|
2440
|
+
const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
|
|
2441
|
+
requireTargetTableName(
|
|
2442
|
+
options.targetTable?.name ?? options.tableName
|
|
2443
|
+
),
|
|
2444
|
+
{
|
|
2445
|
+
orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
|
|
2446
|
+
engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
|
|
2447
|
+
},
|
|
2448
|
+
targetSchema,
|
|
2449
|
+
targetColumns
|
|
2450
|
+
);
|
|
2451
|
+
if (targetTable.name === options.materializedViewName) {
|
|
2452
|
+
throw new Error(
|
|
2453
|
+
"Materialized view name cannot be the same as the target table name."
|
|
2454
|
+
);
|
|
2455
|
+
}
|
|
2456
|
+
super(
|
|
2457
|
+
options.materializedViewName,
|
|
2458
|
+
[
|
|
2459
|
+
createMaterializedView({
|
|
2460
|
+
name: options.materializedViewName,
|
|
2461
|
+
destinationTable: targetTable.name,
|
|
2462
|
+
select: selectStatement
|
|
2463
|
+
})
|
|
2464
|
+
// Population is now handled automatically by Rust infrastructure
|
|
2465
|
+
// based on table engine type and whether this is a new or updated view
|
|
2466
|
+
],
|
|
2467
|
+
[dropView(options.materializedViewName)],
|
|
2468
|
+
{
|
|
2469
|
+
pullsDataFrom: options.selectTables,
|
|
2470
|
+
pushesDataTo: [targetTable]
|
|
2471
|
+
}
|
|
2472
|
+
);
|
|
2473
|
+
this.targetTable = targetTable;
|
|
2474
|
+
}
|
|
2475
|
+
};
|
|
2476
|
+
|
|
2484
2477
|
// src/dmv2/sdk/view.ts
|
|
2485
|
-
var View = class {
|
|
2486
|
-
/** @internal */
|
|
2487
|
-
kind = "CustomView";
|
|
2488
|
-
/** The name of the view */
|
|
2489
|
-
name;
|
|
2490
|
-
/** The SELECT SQL statement that defines the view */
|
|
2491
|
-
selectSql;
|
|
2492
|
-
/** Names of source tables/views that the SELECT reads from */
|
|
2493
|
-
sourceTables;
|
|
2494
|
-
/** @internal Source file path where this view was defined */
|
|
2495
|
-
sourceFile;
|
|
2478
|
+
var View = class extends SqlResource {
|
|
2496
2479
|
/**
|
|
2497
2480
|
* Creates a new View instance.
|
|
2498
2481
|
* @param name The name of the view to be created.
|
|
@@ -2503,16 +2486,17 @@ var View = class {
|
|
|
2503
2486
|
if (typeof selectStatement !== "string") {
|
|
2504
2487
|
selectStatement = toStaticQuery(selectStatement);
|
|
2505
2488
|
}
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2489
|
+
super(
|
|
2490
|
+
name,
|
|
2491
|
+
[
|
|
2492
|
+
`CREATE VIEW IF NOT EXISTS ${name}
|
|
2493
|
+
AS ${selectStatement}`.trim()
|
|
2494
|
+
],
|
|
2495
|
+
[dropView(name)],
|
|
2496
|
+
{
|
|
2497
|
+
pullsDataFrom: baseTables
|
|
2498
|
+
}
|
|
2499
|
+
);
|
|
2516
2500
|
}
|
|
2517
2501
|
};
|
|
2518
2502
|
|
|
@@ -2701,18 +2685,6 @@ function getWebApps() {
|
|
|
2701
2685
|
function getWebApp(name) {
|
|
2702
2686
|
return getMooseInternal().webApps.get(name);
|
|
2703
2687
|
}
|
|
2704
|
-
function getMaterializedViews() {
|
|
2705
|
-
return getMooseInternal().materializedViews;
|
|
2706
|
-
}
|
|
2707
|
-
function getMaterializedView(name) {
|
|
2708
|
-
return getMooseInternal().materializedViews.get(name);
|
|
2709
|
-
}
|
|
2710
|
-
function getCustomViews() {
|
|
2711
|
-
return getMooseInternal().customViews;
|
|
2712
|
-
}
|
|
2713
|
-
function getCustomView(name) {
|
|
2714
|
-
return getMooseInternal().customViews.get(name);
|
|
2715
|
-
}
|
|
2716
2688
|
|
|
2717
2689
|
// src/index.ts
|
|
2718
2690
|
init_commons();
|
|
@@ -3414,15 +3386,11 @@ export {
|
|
|
3414
3386
|
getApi,
|
|
3415
3387
|
getApis,
|
|
3416
3388
|
getClickhouseClient,
|
|
3417
|
-
getCustomView,
|
|
3418
|
-
getCustomViews,
|
|
3419
3389
|
getFileName,
|
|
3420
3390
|
getIngestApi,
|
|
3421
3391
|
getIngestApis,
|
|
3422
3392
|
getKafkaClient,
|
|
3423
3393
|
getKafkaProducer,
|
|
3424
|
-
getMaterializedView,
|
|
3425
|
-
getMaterializedViews,
|
|
3426
3394
|
getMooseClients,
|
|
3427
3395
|
getMooseUtils,
|
|
3428
3396
|
getSqlResource,
|