@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
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
|
-
customViews: /* @__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.customViews.clear();
|
|
569
565
|
const appDir = `${process2.cwd()}/${getSourceDir()}`;
|
|
570
566
|
Object.keys(__require.cache).forEach((key) => {
|
|
571
567
|
if (key.startsWith(appDir)) {
|
|
@@ -2464,78 +2460,6 @@ var init_etlPipeline = __esm({
|
|
|
2464
2460
|
}
|
|
2465
2461
|
});
|
|
2466
2462
|
|
|
2467
|
-
// src/dmv2/sdk/materializedView.ts
|
|
2468
|
-
var requireTargetTableName, MaterializedView;
|
|
2469
|
-
var init_materializedView = __esm({
|
|
2470
|
-
"src/dmv2/sdk/materializedView.ts"() {
|
|
2471
|
-
"use strict";
|
|
2472
|
-
init_helpers();
|
|
2473
|
-
init_sqlHelpers();
|
|
2474
|
-
init_olapTable();
|
|
2475
|
-
init_internal();
|
|
2476
|
-
init_stackTrace();
|
|
2477
|
-
requireTargetTableName = (tableName) => {
|
|
2478
|
-
if (typeof tableName === "string") {
|
|
2479
|
-
return tableName;
|
|
2480
|
-
} else {
|
|
2481
|
-
throw new Error("Name of targetTable is not specified.");
|
|
2482
|
-
}
|
|
2483
|
-
};
|
|
2484
|
-
MaterializedView = class {
|
|
2485
|
-
/** @internal */
|
|
2486
|
-
kind = "MaterializedView";
|
|
2487
|
-
/** The name of the materialized view */
|
|
2488
|
-
name;
|
|
2489
|
-
/** The target OlapTable instance where the materialized data is stored. */
|
|
2490
|
-
targetTable;
|
|
2491
|
-
/** The SELECT SQL statement */
|
|
2492
|
-
selectSql;
|
|
2493
|
-
/** Names of source tables that the SELECT reads from */
|
|
2494
|
-
sourceTables;
|
|
2495
|
-
/** @internal Source file path where this MV was defined */
|
|
2496
|
-
sourceFile;
|
|
2497
|
-
constructor(options, targetSchema, targetColumns) {
|
|
2498
|
-
let selectStatement = options.selectStatement;
|
|
2499
|
-
if (typeof selectStatement !== "string") {
|
|
2500
|
-
selectStatement = toStaticQuery(selectStatement);
|
|
2501
|
-
}
|
|
2502
|
-
if (targetSchema === void 0 || targetColumns === void 0) {
|
|
2503
|
-
throw new Error(
|
|
2504
|
-
"Supply the type param T so that the schema is inserted by the compiler plugin."
|
|
2505
|
-
);
|
|
2506
|
-
}
|
|
2507
|
-
const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
|
|
2508
|
-
requireTargetTableName(
|
|
2509
|
-
options.targetTable?.name ?? options.tableName
|
|
2510
|
-
),
|
|
2511
|
-
{
|
|
2512
|
-
orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
|
|
2513
|
-
engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
|
|
2514
|
-
},
|
|
2515
|
-
targetSchema,
|
|
2516
|
-
targetColumns
|
|
2517
|
-
);
|
|
2518
|
-
if (targetTable.name === options.materializedViewName) {
|
|
2519
|
-
throw new Error(
|
|
2520
|
-
"Materialized view name cannot be the same as the target table name."
|
|
2521
|
-
);
|
|
2522
|
-
}
|
|
2523
|
-
this.name = options.materializedViewName;
|
|
2524
|
-
this.targetTable = targetTable;
|
|
2525
|
-
this.selectSql = selectStatement;
|
|
2526
|
-
this.sourceTables = options.selectTables.map((t) => t.name);
|
|
2527
|
-
const stack = new Error().stack;
|
|
2528
|
-
this.sourceFile = getSourceFileFromStack(stack);
|
|
2529
|
-
const materializedViews = getMooseInternal().materializedViews;
|
|
2530
|
-
if (!isClientOnlyMode() && materializedViews.has(this.name)) {
|
|
2531
|
-
throw new Error(`MaterializedView with name ${this.name} already exists`);
|
|
2532
|
-
}
|
|
2533
|
-
materializedViews.set(this.name, this);
|
|
2534
|
-
}
|
|
2535
|
-
};
|
|
2536
|
-
}
|
|
2537
|
-
});
|
|
2538
|
-
|
|
2539
2463
|
// src/dmv2/sdk/sqlResource.ts
|
|
2540
2464
|
var SqlResource;
|
|
2541
2465
|
var init_sqlResource = __esm({
|
|
@@ -2599,25 +2523,83 @@ var init_sqlResource = __esm({
|
|
|
2599
2523
|
}
|
|
2600
2524
|
});
|
|
2601
2525
|
|
|
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
|
+
};
|
|
2591
|
+
}
|
|
2592
|
+
});
|
|
2593
|
+
|
|
2602
2594
|
// src/dmv2/sdk/view.ts
|
|
2603
2595
|
var View;
|
|
2604
2596
|
var init_view = __esm({
|
|
2605
2597
|
"src/dmv2/sdk/view.ts"() {
|
|
2606
2598
|
"use strict";
|
|
2599
|
+
init_helpers();
|
|
2607
2600
|
init_sqlHelpers();
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
View = class {
|
|
2611
|
-
/** @internal */
|
|
2612
|
-
kind = "CustomView";
|
|
2613
|
-
/** The name of the view */
|
|
2614
|
-
name;
|
|
2615
|
-
/** The SELECT SQL statement that defines the view */
|
|
2616
|
-
selectSql;
|
|
2617
|
-
/** Names of source tables/views that the SELECT reads from */
|
|
2618
|
-
sourceTables;
|
|
2619
|
-
/** @internal Source file path where this view was defined */
|
|
2620
|
-
sourceFile;
|
|
2601
|
+
init_sqlResource();
|
|
2602
|
+
View = class extends SqlResource {
|
|
2621
2603
|
/**
|
|
2622
2604
|
* Creates a new View instance.
|
|
2623
2605
|
* @param name The name of the view to be created.
|
|
@@ -2628,16 +2610,17 @@ var init_view = __esm({
|
|
|
2628
2610
|
if (typeof selectStatement !== "string") {
|
|
2629
2611
|
selectStatement = toStaticQuery(selectStatement);
|
|
2630
2612
|
}
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2613
|
+
super(
|
|
2614
|
+
name,
|
|
2615
|
+
[
|
|
2616
|
+
`CREATE VIEW IF NOT EXISTS ${name}
|
|
2617
|
+
AS ${selectStatement}`.trim()
|
|
2618
|
+
],
|
|
2619
|
+
[dropView(name)],
|
|
2620
|
+
{
|
|
2621
|
+
pullsDataFrom: baseTables
|
|
2622
|
+
}
|
|
2623
|
+
);
|
|
2641
2624
|
}
|
|
2642
2625
|
};
|
|
2643
2626
|
}
|
|
@@ -2841,18 +2824,6 @@ function getWebApps() {
|
|
|
2841
2824
|
function getWebApp(name) {
|
|
2842
2825
|
return getMooseInternal().webApps.get(name);
|
|
2843
2826
|
}
|
|
2844
|
-
function getMaterializedViews() {
|
|
2845
|
-
return getMooseInternal().materializedViews;
|
|
2846
|
-
}
|
|
2847
|
-
function getMaterializedView(name) {
|
|
2848
|
-
return getMooseInternal().materializedViews.get(name);
|
|
2849
|
-
}
|
|
2850
|
-
function getCustomViews() {
|
|
2851
|
-
return getMooseInternal().customViews;
|
|
2852
|
-
}
|
|
2853
|
-
function getCustomView(name) {
|
|
2854
|
-
return getMooseInternal().customViews.get(name);
|
|
2855
|
-
}
|
|
2856
2827
|
var init_registry = __esm({
|
|
2857
2828
|
"src/dmv2/registry.ts"() {
|
|
2858
2829
|
"use strict";
|
|
@@ -3756,16 +3727,12 @@ export {
|
|
|
3756
3727
|
getApi,
|
|
3757
3728
|
getApis,
|
|
3758
3729
|
getClickhouseClient,
|
|
3759
|
-
getCustomView,
|
|
3760
|
-
getCustomViews,
|
|
3761
3730
|
getFileName,
|
|
3762
3731
|
getIngestApi,
|
|
3763
3732
|
getIngestApis,
|
|
3764
3733
|
getKafkaClient,
|
|
3765
3734
|
getKafkaProducer,
|
|
3766
3735
|
getLegacyMooseUtils,
|
|
3767
|
-
getMaterializedView,
|
|
3768
|
-
getMaterializedViews,
|
|
3769
3736
|
getMooseClients,
|
|
3770
3737
|
getMooseUtils,
|
|
3771
3738
|
getMooseUtilsFromRequest,
|