@514labs/moose-lib 0.6.297-ci-22-g1be0de24 → 0.6.297-ci-35-g4e0a867f
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-CprLtYmW.d.ts → browserCompatible-CMEunMFq.d.ts} +1 -1
- package/dist/{browserCompatible-CkQfVyoI.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 -118
- package/dist/browserCompatible.js.map +1 -1
- package/dist/browserCompatible.mjs +91 -114
- 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 -118
- package/dist/dmv2/index.js.map +1 -1
- package/dist/dmv2/index.mjs +91 -114
- package/dist/dmv2/index.mjs.map +1 -1
- package/dist/{index-9XL-mk89.d.mts → index-CcHF2cVT.d.mts} +41 -83
- package/dist/{index-9XL-mk89.d.ts → index-CcHF2cVT.d.ts} +41 -83
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +83 -120
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +83 -116
- package/dist/index.mjs.map +1 -1
- package/dist/moose-runner.js +14 -41
- package/dist/moose-runner.js.map +1 -1
- package/dist/moose-runner.mjs +14 -41
- package/dist/moose-runner.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -312,6 +312,14 @@ var init_sqlHelpers = __esm({
|
|
|
312
312
|
});
|
|
313
313
|
|
|
314
314
|
// src/blocks/helpers.ts
|
|
315
|
+
function dropView(name) {
|
|
316
|
+
return `DROP VIEW IF EXISTS ${quoteIdentifier(name)}`.trim();
|
|
317
|
+
}
|
|
318
|
+
function createMaterializedView(options) {
|
|
319
|
+
return `CREATE MATERIALIZED VIEW IF NOT EXISTS ${quoteIdentifier(options.name)}
|
|
320
|
+
TO ${quoteIdentifier(options.destinationTable)}
|
|
321
|
+
AS ${options.select}`.trim();
|
|
322
|
+
}
|
|
315
323
|
var init_helpers = __esm({
|
|
316
324
|
"src/blocks/helpers.ts"() {
|
|
317
325
|
"use strict";
|
|
@@ -651,9 +659,7 @@ var init_internal = __esm({
|
|
|
651
659
|
apis: /* @__PURE__ */ new Map(),
|
|
652
660
|
sqlResources: /* @__PURE__ */ new Map(),
|
|
653
661
|
workflows: /* @__PURE__ */ new Map(),
|
|
654
|
-
webApps: /* @__PURE__ */ new Map()
|
|
655
|
-
materializedViews: /* @__PURE__ */ new Map(),
|
|
656
|
-
customViews: /* @__PURE__ */ new Map()
|
|
662
|
+
webApps: /* @__PURE__ */ new Map()
|
|
657
663
|
};
|
|
658
664
|
defaultRetentionPeriod = 60 * 60 * 24 * 7;
|
|
659
665
|
getMooseInternal = () => globalThis.moose_internal;
|
|
@@ -2534,78 +2540,6 @@ var init_etlPipeline = __esm({
|
|
|
2534
2540
|
}
|
|
2535
2541
|
});
|
|
2536
2542
|
|
|
2537
|
-
// src/dmv2/sdk/materializedView.ts
|
|
2538
|
-
var requireTargetTableName, MaterializedView;
|
|
2539
|
-
var init_materializedView = __esm({
|
|
2540
|
-
"src/dmv2/sdk/materializedView.ts"() {
|
|
2541
|
-
"use strict";
|
|
2542
|
-
init_helpers();
|
|
2543
|
-
init_sqlHelpers();
|
|
2544
|
-
init_olapTable();
|
|
2545
|
-
init_internal();
|
|
2546
|
-
init_stackTrace();
|
|
2547
|
-
requireTargetTableName = (tableName) => {
|
|
2548
|
-
if (typeof tableName === "string") {
|
|
2549
|
-
return tableName;
|
|
2550
|
-
} else {
|
|
2551
|
-
throw new Error("Name of targetTable is not specified.");
|
|
2552
|
-
}
|
|
2553
|
-
};
|
|
2554
|
-
MaterializedView = class {
|
|
2555
|
-
/** @internal */
|
|
2556
|
-
kind = "MaterializedView";
|
|
2557
|
-
/** The name of the materialized view */
|
|
2558
|
-
name;
|
|
2559
|
-
/** The target OlapTable instance where the materialized data is stored. */
|
|
2560
|
-
targetTable;
|
|
2561
|
-
/** The SELECT SQL statement */
|
|
2562
|
-
selectSql;
|
|
2563
|
-
/** Names of source tables that the SELECT reads from */
|
|
2564
|
-
sourceTables;
|
|
2565
|
-
/** @internal Source file path where this MV was defined */
|
|
2566
|
-
sourceFile;
|
|
2567
|
-
constructor(options, targetSchema, targetColumns) {
|
|
2568
|
-
let selectStatement = options.selectStatement;
|
|
2569
|
-
if (typeof selectStatement !== "string") {
|
|
2570
|
-
selectStatement = toStaticQuery(selectStatement);
|
|
2571
|
-
}
|
|
2572
|
-
if (targetSchema === void 0 || targetColumns === void 0) {
|
|
2573
|
-
throw new Error(
|
|
2574
|
-
"Supply the type param T so that the schema is inserted by the compiler plugin."
|
|
2575
|
-
);
|
|
2576
|
-
}
|
|
2577
|
-
const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
|
|
2578
|
-
requireTargetTableName(
|
|
2579
|
-
options.targetTable?.name ?? options.tableName
|
|
2580
|
-
),
|
|
2581
|
-
{
|
|
2582
|
-
orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
|
|
2583
|
-
engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
|
|
2584
|
-
},
|
|
2585
|
-
targetSchema,
|
|
2586
|
-
targetColumns
|
|
2587
|
-
);
|
|
2588
|
-
if (targetTable.name === options.materializedViewName) {
|
|
2589
|
-
throw new Error(
|
|
2590
|
-
"Materialized view name cannot be the same as the target table name."
|
|
2591
|
-
);
|
|
2592
|
-
}
|
|
2593
|
-
this.name = options.materializedViewName;
|
|
2594
|
-
this.targetTable = targetTable;
|
|
2595
|
-
this.selectSql = selectStatement;
|
|
2596
|
-
this.sourceTables = options.selectTables.map((t) => t.name);
|
|
2597
|
-
const stack = new Error().stack;
|
|
2598
|
-
this.sourceFile = getSourceFileFromStack(stack);
|
|
2599
|
-
const materializedViews = getMooseInternal().materializedViews;
|
|
2600
|
-
if (!isClientOnlyMode() && materializedViews.has(this.name)) {
|
|
2601
|
-
throw new Error(`MaterializedView with name ${this.name} already exists`);
|
|
2602
|
-
}
|
|
2603
|
-
materializedViews.set(this.name, this);
|
|
2604
|
-
}
|
|
2605
|
-
};
|
|
2606
|
-
}
|
|
2607
|
-
});
|
|
2608
|
-
|
|
2609
2543
|
// src/dmv2/sdk/sqlResource.ts
|
|
2610
2544
|
var SqlResource;
|
|
2611
2545
|
var init_sqlResource = __esm({
|
|
@@ -2669,25 +2603,83 @@ var init_sqlResource = __esm({
|
|
|
2669
2603
|
}
|
|
2670
2604
|
});
|
|
2671
2605
|
|
|
2606
|
+
// src/dmv2/sdk/materializedView.ts
|
|
2607
|
+
var requireTargetTableName, MaterializedView;
|
|
2608
|
+
var init_materializedView = __esm({
|
|
2609
|
+
"src/dmv2/sdk/materializedView.ts"() {
|
|
2610
|
+
"use strict";
|
|
2611
|
+
init_helpers();
|
|
2612
|
+
init_sqlHelpers();
|
|
2613
|
+
init_olapTable();
|
|
2614
|
+
init_sqlResource();
|
|
2615
|
+
requireTargetTableName = (tableName) => {
|
|
2616
|
+
if (typeof tableName === "string") {
|
|
2617
|
+
return tableName;
|
|
2618
|
+
} else {
|
|
2619
|
+
throw new Error("Name of targetTable is not specified.");
|
|
2620
|
+
}
|
|
2621
|
+
};
|
|
2622
|
+
MaterializedView = class extends SqlResource {
|
|
2623
|
+
/** The target OlapTable instance where the materialized data is stored. */
|
|
2624
|
+
targetTable;
|
|
2625
|
+
constructor(options, targetSchema, targetColumns) {
|
|
2626
|
+
let selectStatement = options.selectStatement;
|
|
2627
|
+
if (typeof selectStatement !== "string") {
|
|
2628
|
+
selectStatement = toStaticQuery(selectStatement);
|
|
2629
|
+
}
|
|
2630
|
+
if (targetSchema === void 0 || targetColumns === void 0) {
|
|
2631
|
+
throw new Error(
|
|
2632
|
+
"Supply the type param T so that the schema is inserted by the compiler plugin."
|
|
2633
|
+
);
|
|
2634
|
+
}
|
|
2635
|
+
const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
|
|
2636
|
+
requireTargetTableName(
|
|
2637
|
+
options.targetTable?.name ?? options.tableName
|
|
2638
|
+
),
|
|
2639
|
+
{
|
|
2640
|
+
orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
|
|
2641
|
+
engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
|
|
2642
|
+
},
|
|
2643
|
+
targetSchema,
|
|
2644
|
+
targetColumns
|
|
2645
|
+
);
|
|
2646
|
+
if (targetTable.name === options.materializedViewName) {
|
|
2647
|
+
throw new Error(
|
|
2648
|
+
"Materialized view name cannot be the same as the target table name."
|
|
2649
|
+
);
|
|
2650
|
+
}
|
|
2651
|
+
super(
|
|
2652
|
+
options.materializedViewName,
|
|
2653
|
+
[
|
|
2654
|
+
createMaterializedView({
|
|
2655
|
+
name: options.materializedViewName,
|
|
2656
|
+
destinationTable: targetTable.name,
|
|
2657
|
+
select: selectStatement
|
|
2658
|
+
})
|
|
2659
|
+
// Population is now handled automatically by Rust infrastructure
|
|
2660
|
+
// based on table engine type and whether this is a new or updated view
|
|
2661
|
+
],
|
|
2662
|
+
[dropView(options.materializedViewName)],
|
|
2663
|
+
{
|
|
2664
|
+
pullsDataFrom: options.selectTables,
|
|
2665
|
+
pushesDataTo: [targetTable]
|
|
2666
|
+
}
|
|
2667
|
+
);
|
|
2668
|
+
this.targetTable = targetTable;
|
|
2669
|
+
}
|
|
2670
|
+
};
|
|
2671
|
+
}
|
|
2672
|
+
});
|
|
2673
|
+
|
|
2672
2674
|
// src/dmv2/sdk/view.ts
|
|
2673
2675
|
var View;
|
|
2674
2676
|
var init_view = __esm({
|
|
2675
2677
|
"src/dmv2/sdk/view.ts"() {
|
|
2676
2678
|
"use strict";
|
|
2679
|
+
init_helpers();
|
|
2677
2680
|
init_sqlHelpers();
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
View = class {
|
|
2681
|
-
/** @internal */
|
|
2682
|
-
kind = "CustomView";
|
|
2683
|
-
/** The name of the view */
|
|
2684
|
-
name;
|
|
2685
|
-
/** The SELECT SQL statement that defines the view */
|
|
2686
|
-
selectSql;
|
|
2687
|
-
/** Names of source tables/views that the SELECT reads from */
|
|
2688
|
-
sourceTables;
|
|
2689
|
-
/** @internal Source file path where this view was defined */
|
|
2690
|
-
sourceFile;
|
|
2681
|
+
init_sqlResource();
|
|
2682
|
+
View = class extends SqlResource {
|
|
2691
2683
|
/**
|
|
2692
2684
|
* Creates a new View instance.
|
|
2693
2685
|
* @param name The name of the view to be created.
|
|
@@ -2698,16 +2690,17 @@ var init_view = __esm({
|
|
|
2698
2690
|
if (typeof selectStatement !== "string") {
|
|
2699
2691
|
selectStatement = toStaticQuery(selectStatement);
|
|
2700
2692
|
}
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2693
|
+
super(
|
|
2694
|
+
name,
|
|
2695
|
+
[
|
|
2696
|
+
`CREATE VIEW IF NOT EXISTS ${name}
|
|
2697
|
+
AS ${selectStatement}`.trim()
|
|
2698
|
+
],
|
|
2699
|
+
[dropView(name)],
|
|
2700
|
+
{
|
|
2701
|
+
pullsDataFrom: baseTables
|
|
2702
|
+
}
|
|
2703
|
+
);
|
|
2711
2704
|
}
|
|
2712
2705
|
};
|
|
2713
2706
|
}
|
|
@@ -2911,18 +2904,6 @@ function getWebApps2() {
|
|
|
2911
2904
|
function getWebApp(name) {
|
|
2912
2905
|
return getMooseInternal().webApps.get(name);
|
|
2913
2906
|
}
|
|
2914
|
-
function getMaterializedViews() {
|
|
2915
|
-
return getMooseInternal().materializedViews;
|
|
2916
|
-
}
|
|
2917
|
-
function getMaterializedView(name) {
|
|
2918
|
-
return getMooseInternal().materializedViews.get(name);
|
|
2919
|
-
}
|
|
2920
|
-
function getCustomViews() {
|
|
2921
|
-
return getMooseInternal().customViews;
|
|
2922
|
-
}
|
|
2923
|
-
function getCustomView(name) {
|
|
2924
|
-
return getMooseInternal().customViews.get(name);
|
|
2925
|
-
}
|
|
2926
2907
|
var init_registry = __esm({
|
|
2927
2908
|
"src/dmv2/registry.ts"() {
|
|
2928
2909
|
"use strict";
|
|
@@ -2979,12 +2960,8 @@ export {
|
|
|
2979
2960
|
createClickhouseParameter,
|
|
2980
2961
|
getApi,
|
|
2981
2962
|
getApis2 as getApis,
|
|
2982
|
-
getCustomView,
|
|
2983
|
-
getCustomViews,
|
|
2984
2963
|
getIngestApi,
|
|
2985
2964
|
getIngestApis,
|
|
2986
|
-
getMaterializedView,
|
|
2987
|
-
getMaterializedViews,
|
|
2988
2965
|
getSqlResource,
|
|
2989
2966
|
getSqlResources,
|
|
2990
2967
|
getStream,
|