@514labs/moose-lib 0.6.297-ci-40-g26f564af → 0.6.297
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-Cs3UY_5a.d.ts → browserCompatible-CMEunMFq.d.ts} +1 -1
- package/dist/{browserCompatible-Dfx6yRB5.d.mts → browserCompatible-FzU17dxm.d.mts} +1 -1
- package/dist/browserCompatible.d.mts +2 -2
- package/dist/browserCompatible.d.ts +2 -2
- package/dist/browserCompatible.js +91 -148
- package/dist/browserCompatible.js.map +1 -1
- package/dist/browserCompatible.mjs +91 -144
- 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 +91 -148
- package/dist/dmv2/index.js.map +1 -1
- package/dist/dmv2/index.mjs +91 -144
- package/dist/dmv2/index.mjs.map +1 -1
- package/dist/{index-CI9e2hZ2.d.mts → index-CcHF2cVT.d.mts} +43 -96
- package/dist/{index-CI9e2hZ2.d.ts → index-CcHF2cVT.d.ts} +43 -96
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +83 -150
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +83 -146
- package/dist/index.mjs.map +1 -1
- package/dist/moose-runner.js +14 -66
- package/dist/moose-runner.js.map +1 -1
- package/dist/moose-runner.mjs +14 -66
- package/dist/moose-runner.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -546,9 +546,7 @@ var init_internal = __esm({
|
|
|
546
546
|
apis: /* @__PURE__ */ new Map(),
|
|
547
547
|
sqlResources: /* @__PURE__ */ new Map(),
|
|
548
548
|
workflows: /* @__PURE__ */ new Map(),
|
|
549
|
-
webApps: /* @__PURE__ */ new Map()
|
|
550
|
-
materializedViews: /* @__PURE__ */ new Map(),
|
|
551
|
-
views: /* @__PURE__ */ new Map()
|
|
549
|
+
webApps: /* @__PURE__ */ new Map()
|
|
552
550
|
};
|
|
553
551
|
defaultRetentionPeriod = 60 * 60 * 24 * 7;
|
|
554
552
|
getMooseInternal = () => globalThis.moose_internal;
|
|
@@ -564,8 +562,6 @@ var init_internal = __esm({
|
|
|
564
562
|
registry.sqlResources.clear();
|
|
565
563
|
registry.workflows.clear();
|
|
566
564
|
registry.webApps.clear();
|
|
567
|
-
registry.materializedViews.clear();
|
|
568
|
-
registry.views.clear();
|
|
569
565
|
const appDir = `${process2.cwd()}/${getSourceDir()}`;
|
|
570
566
|
Object.keys(__require.cache).forEach((key) => {
|
|
571
567
|
if (key.startsWith(appDir)) {
|
|
@@ -2464,93 +2460,6 @@ var init_etlPipeline = __esm({
|
|
|
2464
2460
|
}
|
|
2465
2461
|
});
|
|
2466
2462
|
|
|
2467
|
-
// src/dmv2/sdk/materializedView.ts
|
|
2468
|
-
function formatTableReference(table) {
|
|
2469
|
-
const database = table instanceof OlapTable ? table.config.database : void 0;
|
|
2470
|
-
if (database) {
|
|
2471
|
-
return `\`${database}\`.\`${table.name}\``;
|
|
2472
|
-
}
|
|
2473
|
-
return `\`${table.name}\``;
|
|
2474
|
-
}
|
|
2475
|
-
var requireTargetTableName, MaterializedView;
|
|
2476
|
-
var init_materializedView = __esm({
|
|
2477
|
-
"src/dmv2/sdk/materializedView.ts"() {
|
|
2478
|
-
"use strict";
|
|
2479
|
-
init_helpers();
|
|
2480
|
-
init_sqlHelpers();
|
|
2481
|
-
init_olapTable();
|
|
2482
|
-
init_internal();
|
|
2483
|
-
init_stackTrace();
|
|
2484
|
-
requireTargetTableName = (tableName) => {
|
|
2485
|
-
if (typeof tableName === "string") {
|
|
2486
|
-
return tableName;
|
|
2487
|
-
} else {
|
|
2488
|
-
throw new Error("Name of targetTable is not specified.");
|
|
2489
|
-
}
|
|
2490
|
-
};
|
|
2491
|
-
MaterializedView = class {
|
|
2492
|
-
/** @internal */
|
|
2493
|
-
kind = "MaterializedView";
|
|
2494
|
-
/** The name of the materialized view */
|
|
2495
|
-
name;
|
|
2496
|
-
/** The target OlapTable instance where the materialized data is stored. */
|
|
2497
|
-
targetTable;
|
|
2498
|
-
/** The SELECT SQL statement */
|
|
2499
|
-
selectSql;
|
|
2500
|
-
/** Names of source tables that the SELECT reads from */
|
|
2501
|
-
sourceTables;
|
|
2502
|
-
/** Optional metadata for the materialized view */
|
|
2503
|
-
metadata;
|
|
2504
|
-
constructor(options, targetSchema, targetColumns) {
|
|
2505
|
-
let selectStatement = options.selectStatement;
|
|
2506
|
-
if (typeof selectStatement !== "string") {
|
|
2507
|
-
selectStatement = toStaticQuery(selectStatement);
|
|
2508
|
-
}
|
|
2509
|
-
if (targetSchema === void 0 || targetColumns === void 0) {
|
|
2510
|
-
throw new Error(
|
|
2511
|
-
"Supply the type param T so that the schema is inserted by the compiler plugin."
|
|
2512
|
-
);
|
|
2513
|
-
}
|
|
2514
|
-
const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
|
|
2515
|
-
requireTargetTableName(
|
|
2516
|
-
options.targetTable?.name ?? options.tableName
|
|
2517
|
-
),
|
|
2518
|
-
{
|
|
2519
|
-
orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
|
|
2520
|
-
engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
|
|
2521
|
-
},
|
|
2522
|
-
targetSchema,
|
|
2523
|
-
targetColumns
|
|
2524
|
-
);
|
|
2525
|
-
if (targetTable.name === options.materializedViewName) {
|
|
2526
|
-
throw new Error(
|
|
2527
|
-
"Materialized view name cannot be the same as the target table name."
|
|
2528
|
-
);
|
|
2529
|
-
}
|
|
2530
|
-
this.name = options.materializedViewName;
|
|
2531
|
-
this.targetTable = targetTable;
|
|
2532
|
-
this.selectSql = selectStatement;
|
|
2533
|
-
this.sourceTables = options.selectTables.map(
|
|
2534
|
-
(t) => formatTableReference(t)
|
|
2535
|
-
);
|
|
2536
|
-
this.metadata = options.metadata ? { ...options.metadata } : {};
|
|
2537
|
-
if (!this.metadata.source) {
|
|
2538
|
-
const stack = new Error().stack;
|
|
2539
|
-
const sourceInfo = getSourceFileFromStack(stack);
|
|
2540
|
-
if (sourceInfo) {
|
|
2541
|
-
this.metadata.source = { file: sourceInfo };
|
|
2542
|
-
}
|
|
2543
|
-
}
|
|
2544
|
-
const materializedViews = getMooseInternal().materializedViews;
|
|
2545
|
-
if (!isClientOnlyMode() && materializedViews.has(this.name)) {
|
|
2546
|
-
throw new Error(`MaterializedView with name ${this.name} already exists`);
|
|
2547
|
-
}
|
|
2548
|
-
materializedViews.set(this.name, this);
|
|
2549
|
-
}
|
|
2550
|
-
};
|
|
2551
|
-
}
|
|
2552
|
-
});
|
|
2553
|
-
|
|
2554
2463
|
// src/dmv2/sdk/sqlResource.ts
|
|
2555
2464
|
var SqlResource;
|
|
2556
2465
|
var init_sqlResource = __esm({
|
|
@@ -2614,60 +2523,104 @@ var init_sqlResource = __esm({
|
|
|
2614
2523
|
}
|
|
2615
2524
|
});
|
|
2616
2525
|
|
|
2617
|
-
// src/dmv2/sdk/
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2526
|
+
// src/dmv2/sdk/materializedView.ts
|
|
2527
|
+
var requireTargetTableName, MaterializedView;
|
|
2528
|
+
var init_materializedView = __esm({
|
|
2529
|
+
"src/dmv2/sdk/materializedView.ts"() {
|
|
2530
|
+
"use strict";
|
|
2531
|
+
init_helpers();
|
|
2532
|
+
init_sqlHelpers();
|
|
2533
|
+
init_olapTable();
|
|
2534
|
+
init_sqlResource();
|
|
2535
|
+
requireTargetTableName = (tableName) => {
|
|
2536
|
+
if (typeof tableName === "string") {
|
|
2537
|
+
return tableName;
|
|
2538
|
+
} else {
|
|
2539
|
+
throw new Error("Name of targetTable is not specified.");
|
|
2540
|
+
}
|
|
2541
|
+
};
|
|
2542
|
+
MaterializedView = class extends SqlResource {
|
|
2543
|
+
/** The target OlapTable instance where the materialized data is stored. */
|
|
2544
|
+
targetTable;
|
|
2545
|
+
constructor(options, targetSchema, targetColumns) {
|
|
2546
|
+
let selectStatement = options.selectStatement;
|
|
2547
|
+
if (typeof selectStatement !== "string") {
|
|
2548
|
+
selectStatement = toStaticQuery(selectStatement);
|
|
2549
|
+
}
|
|
2550
|
+
if (targetSchema === void 0 || targetColumns === void 0) {
|
|
2551
|
+
throw new Error(
|
|
2552
|
+
"Supply the type param T so that the schema is inserted by the compiler plugin."
|
|
2553
|
+
);
|
|
2554
|
+
}
|
|
2555
|
+
const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
|
|
2556
|
+
requireTargetTableName(
|
|
2557
|
+
options.targetTable?.name ?? options.tableName
|
|
2558
|
+
),
|
|
2559
|
+
{
|
|
2560
|
+
orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
|
|
2561
|
+
engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
|
|
2562
|
+
},
|
|
2563
|
+
targetSchema,
|
|
2564
|
+
targetColumns
|
|
2565
|
+
);
|
|
2566
|
+
if (targetTable.name === options.materializedViewName) {
|
|
2567
|
+
throw new Error(
|
|
2568
|
+
"Materialized view name cannot be the same as the target table name."
|
|
2569
|
+
);
|
|
2570
|
+
}
|
|
2571
|
+
super(
|
|
2572
|
+
options.materializedViewName,
|
|
2573
|
+
[
|
|
2574
|
+
createMaterializedView({
|
|
2575
|
+
name: options.materializedViewName,
|
|
2576
|
+
destinationTable: targetTable.name,
|
|
2577
|
+
select: selectStatement
|
|
2578
|
+
})
|
|
2579
|
+
// Population is now handled automatically by Rust infrastructure
|
|
2580
|
+
// based on table engine type and whether this is a new or updated view
|
|
2581
|
+
],
|
|
2582
|
+
[dropView(options.materializedViewName)],
|
|
2583
|
+
{
|
|
2584
|
+
pullsDataFrom: options.selectTables,
|
|
2585
|
+
pushesDataTo: [targetTable]
|
|
2586
|
+
}
|
|
2587
|
+
);
|
|
2588
|
+
this.targetTable = targetTable;
|
|
2589
|
+
}
|
|
2590
|
+
};
|
|
2622
2591
|
}
|
|
2623
|
-
|
|
2624
|
-
|
|
2592
|
+
});
|
|
2593
|
+
|
|
2594
|
+
// src/dmv2/sdk/view.ts
|
|
2625
2595
|
var View;
|
|
2626
2596
|
var init_view = __esm({
|
|
2627
2597
|
"src/dmv2/sdk/view.ts"() {
|
|
2628
2598
|
"use strict";
|
|
2599
|
+
init_helpers();
|
|
2629
2600
|
init_sqlHelpers();
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
init_stackTrace();
|
|
2633
|
-
View = class {
|
|
2634
|
-
/** @internal */
|
|
2635
|
-
kind = "View";
|
|
2636
|
-
/** The name of the view */
|
|
2637
|
-
name;
|
|
2638
|
-
/** The SELECT SQL statement that defines the view */
|
|
2639
|
-
selectSql;
|
|
2640
|
-
/** Names of source tables/views that the SELECT reads from */
|
|
2641
|
-
sourceTables;
|
|
2642
|
-
/** Optional metadata for the view */
|
|
2643
|
-
metadata;
|
|
2601
|
+
init_sqlResource();
|
|
2602
|
+
View = class extends SqlResource {
|
|
2644
2603
|
/**
|
|
2645
2604
|
* Creates a new View instance.
|
|
2646
2605
|
* @param name The name of the view to be created.
|
|
2647
2606
|
* @param selectStatement The SQL SELECT statement that defines the view's logic.
|
|
2648
2607
|
* @param baseTables An array of OlapTable or View objects that the `selectStatement` reads from. Used for dependency tracking.
|
|
2649
|
-
* @param metadata Optional metadata for the view (e.g., description, source file).
|
|
2650
2608
|
*/
|
|
2651
|
-
constructor(name, selectStatement, baseTables
|
|
2609
|
+
constructor(name, selectStatement, baseTables) {
|
|
2652
2610
|
if (typeof selectStatement !== "string") {
|
|
2653
2611
|
selectStatement = toStaticQuery(selectStatement);
|
|
2654
2612
|
}
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2613
|
+
super(
|
|
2614
|
+
name,
|
|
2615
|
+
[
|
|
2616
|
+
`CREATE VIEW IF NOT EXISTS ${name}
|
|
2617
|
+
AS ${selectStatement}`.trim()
|
|
2618
|
+
],
|
|
2619
|
+
[dropView(name)],
|
|
2620
|
+
{
|
|
2621
|
+
pullsDataFrom: baseTables
|
|
2664
2622
|
}
|
|
2665
|
-
|
|
2666
|
-
const views = getMooseInternal().views;
|
|
2667
|
-
if (!isClientOnlyMode() && views.has(this.name)) {
|
|
2668
|
-
throw new Error(`View with name ${this.name} already exists`);
|
|
2669
|
-
}
|
|
2670
|
-
views.set(this.name, this);
|
|
2623
|
+
);
|
|
2671
2624
|
}
|
|
2672
2625
|
};
|
|
2673
2626
|
}
|
|
@@ -2871,18 +2824,6 @@ function getWebApps() {
|
|
|
2871
2824
|
function getWebApp(name) {
|
|
2872
2825
|
return getMooseInternal().webApps.get(name);
|
|
2873
2826
|
}
|
|
2874
|
-
function getMaterializedViews() {
|
|
2875
|
-
return getMooseInternal().materializedViews;
|
|
2876
|
-
}
|
|
2877
|
-
function getMaterializedView(name) {
|
|
2878
|
-
return getMooseInternal().materializedViews.get(name);
|
|
2879
|
-
}
|
|
2880
|
-
function getViews() {
|
|
2881
|
-
return getMooseInternal().views;
|
|
2882
|
-
}
|
|
2883
|
-
function getView(name) {
|
|
2884
|
-
return getMooseInternal().views.get(name);
|
|
2885
|
-
}
|
|
2886
2827
|
var init_registry = __esm({
|
|
2887
2828
|
"src/dmv2/registry.ts"() {
|
|
2888
2829
|
"use strict";
|
|
@@ -3792,8 +3733,6 @@ export {
|
|
|
3792
3733
|
getKafkaClient,
|
|
3793
3734
|
getKafkaProducer,
|
|
3794
3735
|
getLegacyMooseUtils,
|
|
3795
|
-
getMaterializedView,
|
|
3796
|
-
getMaterializedViews,
|
|
3797
3736
|
getMooseClients,
|
|
3798
3737
|
getMooseUtils,
|
|
3799
3738
|
getMooseUtilsFromRequest,
|
|
@@ -3805,8 +3744,6 @@ export {
|
|
|
3805
3744
|
getTables,
|
|
3806
3745
|
getTemporalClient,
|
|
3807
3746
|
getValueFromParameter,
|
|
3808
|
-
getView,
|
|
3809
|
-
getViews,
|
|
3810
3747
|
getWebApp,
|
|
3811
3748
|
getWebApps,
|
|
3812
3749
|
getWorkflow,
|