@514labs/moose-lib 0.6.297-ci-37-gf180cb49 → 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 -42
- package/dist/moose-runner.js.map +1 -1
- package/dist/moose-runner.mjs +14 -42
- package/dist/moose-runner.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -562,9 +562,7 @@ var init_internal = __esm({
|
|
|
562
562
|
apis: /* @__PURE__ */ new Map(),
|
|
563
563
|
sqlResources: /* @__PURE__ */ new Map(),
|
|
564
564
|
workflows: /* @__PURE__ */ new Map(),
|
|
565
|
-
webApps: /* @__PURE__ */ new Map()
|
|
566
|
-
materializedViews: /* @__PURE__ */ new Map(),
|
|
567
|
-
views: /* @__PURE__ */ new Map()
|
|
565
|
+
webApps: /* @__PURE__ */ new Map()
|
|
568
566
|
};
|
|
569
567
|
defaultRetentionPeriod = 60 * 60 * 24 * 7;
|
|
570
568
|
getMooseInternal = () => globalThis.moose_internal;
|
|
@@ -580,8 +578,6 @@ var init_internal = __esm({
|
|
|
580
578
|
registry.sqlResources.clear();
|
|
581
579
|
registry.workflows.clear();
|
|
582
580
|
registry.webApps.clear();
|
|
583
|
-
registry.materializedViews.clear();
|
|
584
|
-
registry.views.clear();
|
|
585
581
|
const appDir = `${import_process.default.cwd()}/${getSourceDir()}`;
|
|
586
582
|
Object.keys(require.cache).forEach((key) => {
|
|
587
583
|
if (key.startsWith(appDir)) {
|
|
@@ -2480,93 +2476,6 @@ var init_etlPipeline = __esm({
|
|
|
2480
2476
|
}
|
|
2481
2477
|
});
|
|
2482
2478
|
|
|
2483
|
-
// src/dmv2/sdk/materializedView.ts
|
|
2484
|
-
function formatTableReference(table) {
|
|
2485
|
-
const database = table instanceof OlapTable ? table.config.database : void 0;
|
|
2486
|
-
if (database) {
|
|
2487
|
-
return `\`${database}\`.\`${table.name}\``;
|
|
2488
|
-
}
|
|
2489
|
-
return `\`${table.name}\``;
|
|
2490
|
-
}
|
|
2491
|
-
var requireTargetTableName, MaterializedView;
|
|
2492
|
-
var init_materializedView = __esm({
|
|
2493
|
-
"src/dmv2/sdk/materializedView.ts"() {
|
|
2494
|
-
"use strict";
|
|
2495
|
-
init_helpers();
|
|
2496
|
-
init_sqlHelpers();
|
|
2497
|
-
init_olapTable();
|
|
2498
|
-
init_internal();
|
|
2499
|
-
init_stackTrace();
|
|
2500
|
-
requireTargetTableName = (tableName) => {
|
|
2501
|
-
if (typeof tableName === "string") {
|
|
2502
|
-
return tableName;
|
|
2503
|
-
} else {
|
|
2504
|
-
throw new Error("Name of targetTable is not specified.");
|
|
2505
|
-
}
|
|
2506
|
-
};
|
|
2507
|
-
MaterializedView = class {
|
|
2508
|
-
/** @internal */
|
|
2509
|
-
kind = "MaterializedView";
|
|
2510
|
-
/** The name of the materialized view */
|
|
2511
|
-
name;
|
|
2512
|
-
/** The target OlapTable instance where the materialized data is stored. */
|
|
2513
|
-
targetTable;
|
|
2514
|
-
/** The SELECT SQL statement */
|
|
2515
|
-
selectSql;
|
|
2516
|
-
/** Names of source tables that the SELECT reads from */
|
|
2517
|
-
sourceTables;
|
|
2518
|
-
/** Optional metadata for the materialized view */
|
|
2519
|
-
metadata;
|
|
2520
|
-
constructor(options, targetSchema, targetColumns) {
|
|
2521
|
-
let selectStatement = options.selectStatement;
|
|
2522
|
-
if (typeof selectStatement !== "string") {
|
|
2523
|
-
selectStatement = toStaticQuery(selectStatement);
|
|
2524
|
-
}
|
|
2525
|
-
if (targetSchema === void 0 || targetColumns === void 0) {
|
|
2526
|
-
throw new Error(
|
|
2527
|
-
"Supply the type param T so that the schema is inserted by the compiler plugin."
|
|
2528
|
-
);
|
|
2529
|
-
}
|
|
2530
|
-
const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
|
|
2531
|
-
requireTargetTableName(
|
|
2532
|
-
options.targetTable?.name ?? options.tableName
|
|
2533
|
-
),
|
|
2534
|
-
{
|
|
2535
|
-
orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
|
|
2536
|
-
engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
|
|
2537
|
-
},
|
|
2538
|
-
targetSchema,
|
|
2539
|
-
targetColumns
|
|
2540
|
-
);
|
|
2541
|
-
if (targetTable.name === options.materializedViewName) {
|
|
2542
|
-
throw new Error(
|
|
2543
|
-
"Materialized view name cannot be the same as the target table name."
|
|
2544
|
-
);
|
|
2545
|
-
}
|
|
2546
|
-
this.name = options.materializedViewName;
|
|
2547
|
-
this.targetTable = targetTable;
|
|
2548
|
-
this.selectSql = selectStatement;
|
|
2549
|
-
this.sourceTables = options.selectTables.map(
|
|
2550
|
-
(t) => formatTableReference(t)
|
|
2551
|
-
);
|
|
2552
|
-
this.metadata = options.metadata ? { ...options.metadata } : {};
|
|
2553
|
-
if (!this.metadata.source) {
|
|
2554
|
-
const stack = new Error().stack;
|
|
2555
|
-
const sourceInfo = getSourceFileFromStack(stack);
|
|
2556
|
-
if (sourceInfo) {
|
|
2557
|
-
this.metadata.source = { file: sourceInfo };
|
|
2558
|
-
}
|
|
2559
|
-
}
|
|
2560
|
-
const materializedViews = getMooseInternal().materializedViews;
|
|
2561
|
-
if (!isClientOnlyMode() && materializedViews.has(this.name)) {
|
|
2562
|
-
throw new Error(`MaterializedView with name ${this.name} already exists`);
|
|
2563
|
-
}
|
|
2564
|
-
materializedViews.set(this.name, this);
|
|
2565
|
-
}
|
|
2566
|
-
};
|
|
2567
|
-
}
|
|
2568
|
-
});
|
|
2569
|
-
|
|
2570
2479
|
// src/dmv2/sdk/sqlResource.ts
|
|
2571
2480
|
var SqlResource;
|
|
2572
2481
|
var init_sqlResource = __esm({
|
|
@@ -2630,60 +2539,104 @@ var init_sqlResource = __esm({
|
|
|
2630
2539
|
}
|
|
2631
2540
|
});
|
|
2632
2541
|
|
|
2633
|
-
// src/dmv2/sdk/
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2542
|
+
// src/dmv2/sdk/materializedView.ts
|
|
2543
|
+
var requireTargetTableName, MaterializedView;
|
|
2544
|
+
var init_materializedView = __esm({
|
|
2545
|
+
"src/dmv2/sdk/materializedView.ts"() {
|
|
2546
|
+
"use strict";
|
|
2547
|
+
init_helpers();
|
|
2548
|
+
init_sqlHelpers();
|
|
2549
|
+
init_olapTable();
|
|
2550
|
+
init_sqlResource();
|
|
2551
|
+
requireTargetTableName = (tableName) => {
|
|
2552
|
+
if (typeof tableName === "string") {
|
|
2553
|
+
return tableName;
|
|
2554
|
+
} else {
|
|
2555
|
+
throw new Error("Name of targetTable is not specified.");
|
|
2556
|
+
}
|
|
2557
|
+
};
|
|
2558
|
+
MaterializedView = class extends SqlResource {
|
|
2559
|
+
/** The target OlapTable instance where the materialized data is stored. */
|
|
2560
|
+
targetTable;
|
|
2561
|
+
constructor(options, targetSchema, targetColumns) {
|
|
2562
|
+
let selectStatement = options.selectStatement;
|
|
2563
|
+
if (typeof selectStatement !== "string") {
|
|
2564
|
+
selectStatement = toStaticQuery(selectStatement);
|
|
2565
|
+
}
|
|
2566
|
+
if (targetSchema === void 0 || targetColumns === void 0) {
|
|
2567
|
+
throw new Error(
|
|
2568
|
+
"Supply the type param T so that the schema is inserted by the compiler plugin."
|
|
2569
|
+
);
|
|
2570
|
+
}
|
|
2571
|
+
const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
|
|
2572
|
+
requireTargetTableName(
|
|
2573
|
+
options.targetTable?.name ?? options.tableName
|
|
2574
|
+
),
|
|
2575
|
+
{
|
|
2576
|
+
orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
|
|
2577
|
+
engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
|
|
2578
|
+
},
|
|
2579
|
+
targetSchema,
|
|
2580
|
+
targetColumns
|
|
2581
|
+
);
|
|
2582
|
+
if (targetTable.name === options.materializedViewName) {
|
|
2583
|
+
throw new Error(
|
|
2584
|
+
"Materialized view name cannot be the same as the target table name."
|
|
2585
|
+
);
|
|
2586
|
+
}
|
|
2587
|
+
super(
|
|
2588
|
+
options.materializedViewName,
|
|
2589
|
+
[
|
|
2590
|
+
createMaterializedView({
|
|
2591
|
+
name: options.materializedViewName,
|
|
2592
|
+
destinationTable: targetTable.name,
|
|
2593
|
+
select: selectStatement
|
|
2594
|
+
})
|
|
2595
|
+
// Population is now handled automatically by Rust infrastructure
|
|
2596
|
+
// based on table engine type and whether this is a new or updated view
|
|
2597
|
+
],
|
|
2598
|
+
[dropView(options.materializedViewName)],
|
|
2599
|
+
{
|
|
2600
|
+
pullsDataFrom: options.selectTables,
|
|
2601
|
+
pushesDataTo: [targetTable]
|
|
2602
|
+
}
|
|
2603
|
+
);
|
|
2604
|
+
this.targetTable = targetTable;
|
|
2605
|
+
}
|
|
2606
|
+
};
|
|
2638
2607
|
}
|
|
2639
|
-
|
|
2640
|
-
|
|
2608
|
+
});
|
|
2609
|
+
|
|
2610
|
+
// src/dmv2/sdk/view.ts
|
|
2641
2611
|
var View;
|
|
2642
2612
|
var init_view = __esm({
|
|
2643
2613
|
"src/dmv2/sdk/view.ts"() {
|
|
2644
2614
|
"use strict";
|
|
2615
|
+
init_helpers();
|
|
2645
2616
|
init_sqlHelpers();
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
init_stackTrace();
|
|
2649
|
-
View = class {
|
|
2650
|
-
/** @internal */
|
|
2651
|
-
kind = "View";
|
|
2652
|
-
/** The name of the view */
|
|
2653
|
-
name;
|
|
2654
|
-
/** The SELECT SQL statement that defines the view */
|
|
2655
|
-
selectSql;
|
|
2656
|
-
/** Names of source tables/views that the SELECT reads from */
|
|
2657
|
-
sourceTables;
|
|
2658
|
-
/** Optional metadata for the view */
|
|
2659
|
-
metadata;
|
|
2617
|
+
init_sqlResource();
|
|
2618
|
+
View = class extends SqlResource {
|
|
2660
2619
|
/**
|
|
2661
2620
|
* Creates a new View instance.
|
|
2662
2621
|
* @param name The name of the view to be created.
|
|
2663
2622
|
* @param selectStatement The SQL SELECT statement that defines the view's logic.
|
|
2664
2623
|
* @param baseTables An array of OlapTable or View objects that the `selectStatement` reads from. Used for dependency tracking.
|
|
2665
|
-
* @param metadata Optional metadata for the view (e.g., description, source file).
|
|
2666
2624
|
*/
|
|
2667
|
-
constructor(name, selectStatement, baseTables
|
|
2625
|
+
constructor(name, selectStatement, baseTables) {
|
|
2668
2626
|
if (typeof selectStatement !== "string") {
|
|
2669
2627
|
selectStatement = toStaticQuery(selectStatement);
|
|
2670
2628
|
}
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2629
|
+
super(
|
|
2630
|
+
name,
|
|
2631
|
+
[
|
|
2632
|
+
`CREATE VIEW IF NOT EXISTS ${name}
|
|
2633
|
+
AS ${selectStatement}`.trim()
|
|
2634
|
+
],
|
|
2635
|
+
[dropView(name)],
|
|
2636
|
+
{
|
|
2637
|
+
pullsDataFrom: baseTables
|
|
2680
2638
|
}
|
|
2681
|
-
|
|
2682
|
-
const views = getMooseInternal().views;
|
|
2683
|
-
if (!isClientOnlyMode() && views.has(this.name)) {
|
|
2684
|
-
throw new Error(`View with name ${this.name} already exists`);
|
|
2685
|
-
}
|
|
2686
|
-
views.set(this.name, this);
|
|
2639
|
+
);
|
|
2687
2640
|
}
|
|
2688
2641
|
};
|
|
2689
2642
|
}
|
|
@@ -2887,18 +2840,6 @@ function getWebApps() {
|
|
|
2887
2840
|
function getWebApp(name) {
|
|
2888
2841
|
return getMooseInternal().webApps.get(name);
|
|
2889
2842
|
}
|
|
2890
|
-
function getMaterializedViews() {
|
|
2891
|
-
return getMooseInternal().materializedViews;
|
|
2892
|
-
}
|
|
2893
|
-
function getMaterializedView(name) {
|
|
2894
|
-
return getMooseInternal().materializedViews.get(name);
|
|
2895
|
-
}
|
|
2896
|
-
function getViews() {
|
|
2897
|
-
return getMooseInternal().views;
|
|
2898
|
-
}
|
|
2899
|
-
function getView(name) {
|
|
2900
|
-
return getMooseInternal().views.get(name);
|
|
2901
|
-
}
|
|
2902
2843
|
var init_registry = __esm({
|
|
2903
2844
|
"src/dmv2/registry.ts"() {
|
|
2904
2845
|
"use strict";
|
|
@@ -3787,8 +3728,6 @@ __export(index_exports, {
|
|
|
3787
3728
|
getKafkaClient: () => getKafkaClient,
|
|
3788
3729
|
getKafkaProducer: () => getKafkaProducer,
|
|
3789
3730
|
getLegacyMooseUtils: () => getLegacyMooseUtils,
|
|
3790
|
-
getMaterializedView: () => getMaterializedView,
|
|
3791
|
-
getMaterializedViews: () => getMaterializedViews,
|
|
3792
3731
|
getMooseClients: () => getMooseClients,
|
|
3793
3732
|
getMooseUtils: () => getMooseUtils,
|
|
3794
3733
|
getMooseUtilsFromRequest: () => getMooseUtilsFromRequest,
|
|
@@ -3800,8 +3739,6 @@ __export(index_exports, {
|
|
|
3800
3739
|
getTables: () => getTables,
|
|
3801
3740
|
getTemporalClient: () => getTemporalClient,
|
|
3802
3741
|
getValueFromParameter: () => getValueFromParameter,
|
|
3803
|
-
getView: () => getView,
|
|
3804
|
-
getViews: () => getViews,
|
|
3805
3742
|
getWebApp: () => getWebApp,
|
|
3806
3743
|
getWebApps: () => getWebApps,
|
|
3807
3744
|
getWorkflow: () => getWorkflow,
|
|
@@ -3899,8 +3836,6 @@ init_index();
|
|
|
3899
3836
|
getKafkaClient,
|
|
3900
3837
|
getKafkaProducer,
|
|
3901
3838
|
getLegacyMooseUtils,
|
|
3902
|
-
getMaterializedView,
|
|
3903
|
-
getMaterializedViews,
|
|
3904
3839
|
getMooseClients,
|
|
3905
3840
|
getMooseUtils,
|
|
3906
3841
|
getMooseUtilsFromRequest,
|
|
@@ -3912,8 +3847,6 @@ init_index();
|
|
|
3912
3847
|
getTables,
|
|
3913
3848
|
getTemporalClient,
|
|
3914
3849
|
getValueFromParameter,
|
|
3915
|
-
getView,
|
|
3916
|
-
getViews,
|
|
3917
3850
|
getWebApp,
|
|
3918
3851
|
getWebApps,
|
|
3919
3852
|
getWorkflow,
|