@514labs/moose-lib 0.6.297 → 0.6.298-ci-38-g9d285107
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-FzU17dxm.d.mts → browserCompatible-DGOtJiIs.d.mts} +1 -1
- package/dist/{browserCompatible-CMEunMFq.d.ts → browserCompatible-DzZUjqvL.d.ts} +1 -1
- package/dist/browserCompatible.d.mts +2 -2
- package/dist/browserCompatible.d.ts +2 -2
- package/dist/browserCompatible.js +148 -91
- package/dist/browserCompatible.js.map +1 -1
- package/dist/browserCompatible.mjs +144 -91
- 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 +148 -91
- package/dist/dmv2/index.js.map +1 -1
- package/dist/dmv2/index.mjs +144 -91
- package/dist/dmv2/index.mjs.map +1 -1
- package/dist/{index-CcHF2cVT.d.mts → index-BeUCYK3T.d.mts} +96 -43
- package/dist/{index-CcHF2cVT.d.ts → index-BeUCYK3T.d.ts} +96 -43
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +150 -83
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +146 -83
- package/dist/index.mjs.map +1 -1
- package/dist/moose-runner.js +66 -14
- package/dist/moose-runner.js.map +1 -1
- package/dist/moose-runner.mjs +66 -14
- package/dist/moose-runner.mjs.map +1 -1
- package/package.json +1 -1
package/dist/dmv2/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as Aggregated, h as Api, i as ApiConfig,
|
|
1
|
+
export { A as Aggregated, h as Api, i as ApiConfig, al as ConsumerConfig, C as ConsumptionApi, e as DeadLetter, D as DeadLetterModel, f as DeadLetterQueue, l as ETLPipeline, m as ETLPipelineConfig, E as EgressConfig, F as FrameworkApp, I as IngestApi, g as IngestConfig, j as IngestPipeline, ap as IngestPipelineConfig, L as LifeCycle, M as MaterializedView, aq as MaterializedViewConfig, a as OlapConfig, O as OlapTable, b as S3QueueTableSettings, S as SimpleAggregated, k as SqlResource, c as Stream, d as StreamConfig, T as Task, ao as TaskConfig, an as TaskContext, am as TransformConfig, V as View, n as WebApp, o as WebAppConfig, p as WebAppHandler, W as Workflow, x as getApi, w as getApis, v as getIngestApi, u as getIngestApis, P as getMaterializedView, Q as getMaterializedViews, z as getSqlResource, y as getSqlResources, t as getStream, s as getStreams, r as getTable, q as getTables, K as getView, N as getViews, J as getWebApp, H as getWebApps, G as getWorkflow, B as getWorkflows } from '../index-BeUCYK3T.mjs';
|
|
2
2
|
import 'typia';
|
|
3
3
|
import 'typia/src/schemas/json/IJsonSchemaCollection';
|
|
4
4
|
import 'node:stream';
|
package/dist/dmv2/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as Aggregated, h as Api, i as ApiConfig,
|
|
1
|
+
export { A as Aggregated, h as Api, i as ApiConfig, al as ConsumerConfig, C as ConsumptionApi, e as DeadLetter, D as DeadLetterModel, f as DeadLetterQueue, l as ETLPipeline, m as ETLPipelineConfig, E as EgressConfig, F as FrameworkApp, I as IngestApi, g as IngestConfig, j as IngestPipeline, ap as IngestPipelineConfig, L as LifeCycle, M as MaterializedView, aq as MaterializedViewConfig, a as OlapConfig, O as OlapTable, b as S3QueueTableSettings, S as SimpleAggregated, k as SqlResource, c as Stream, d as StreamConfig, T as Task, ao as TaskConfig, an as TaskContext, am as TransformConfig, V as View, n as WebApp, o as WebAppConfig, p as WebAppHandler, W as Workflow, x as getApi, w as getApis, v as getIngestApi, u as getIngestApis, P as getMaterializedView, Q as getMaterializedViews, z as getSqlResource, y as getSqlResources, t as getStream, s as getStreams, r as getTable, q as getTables, K as getView, N as getViews, J as getWebApp, H as getWebApps, G as getWorkflow, B as getWorkflows } from '../index-BeUCYK3T.js';
|
|
2
2
|
import 'typia';
|
|
3
3
|
import 'typia/src/schemas/json/IJsonSchemaCollection';
|
|
4
4
|
import 'node:stream';
|
package/dist/dmv2/index.js
CHANGED
|
@@ -239,14 +239,6 @@ var init_sqlHelpers = __esm({
|
|
|
239
239
|
});
|
|
240
240
|
|
|
241
241
|
// src/blocks/helpers.ts
|
|
242
|
-
function dropView(name) {
|
|
243
|
-
return `DROP VIEW IF EXISTS ${quoteIdentifier(name)}`.trim();
|
|
244
|
-
}
|
|
245
|
-
function createMaterializedView(options) {
|
|
246
|
-
return `CREATE MATERIALIZED VIEW IF NOT EXISTS ${quoteIdentifier(options.name)}
|
|
247
|
-
TO ${quoteIdentifier(options.destinationTable)}
|
|
248
|
-
AS ${options.select}`.trim();
|
|
249
|
-
}
|
|
250
242
|
var init_helpers = __esm({
|
|
251
243
|
"src/blocks/helpers.ts"() {
|
|
252
244
|
"use strict";
|
|
@@ -597,7 +589,9 @@ var init_internal = __esm({
|
|
|
597
589
|
apis: /* @__PURE__ */ new Map(),
|
|
598
590
|
sqlResources: /* @__PURE__ */ new Map(),
|
|
599
591
|
workflows: /* @__PURE__ */ new Map(),
|
|
600
|
-
webApps: /* @__PURE__ */ new Map()
|
|
592
|
+
webApps: /* @__PURE__ */ new Map(),
|
|
593
|
+
materializedViews: /* @__PURE__ */ new Map(),
|
|
594
|
+
views: /* @__PURE__ */ new Map()
|
|
601
595
|
};
|
|
602
596
|
defaultRetentionPeriod = 60 * 60 * 24 * 7;
|
|
603
597
|
getMooseInternal = () => globalThis.moose_internal;
|
|
@@ -2478,6 +2472,93 @@ var init_etlPipeline = __esm({
|
|
|
2478
2472
|
}
|
|
2479
2473
|
});
|
|
2480
2474
|
|
|
2475
|
+
// src/dmv2/sdk/materializedView.ts
|
|
2476
|
+
function formatTableReference(table) {
|
|
2477
|
+
const database = table instanceof OlapTable ? table.config.database : void 0;
|
|
2478
|
+
if (database) {
|
|
2479
|
+
return `\`${database}\`.\`${table.name}\``;
|
|
2480
|
+
}
|
|
2481
|
+
return `\`${table.name}\``;
|
|
2482
|
+
}
|
|
2483
|
+
var requireTargetTableName, MaterializedView;
|
|
2484
|
+
var init_materializedView = __esm({
|
|
2485
|
+
"src/dmv2/sdk/materializedView.ts"() {
|
|
2486
|
+
"use strict";
|
|
2487
|
+
init_helpers();
|
|
2488
|
+
init_sqlHelpers();
|
|
2489
|
+
init_olapTable();
|
|
2490
|
+
init_internal();
|
|
2491
|
+
init_stackTrace();
|
|
2492
|
+
requireTargetTableName = (tableName) => {
|
|
2493
|
+
if (typeof tableName === "string") {
|
|
2494
|
+
return tableName;
|
|
2495
|
+
} else {
|
|
2496
|
+
throw new Error("Name of targetTable is not specified.");
|
|
2497
|
+
}
|
|
2498
|
+
};
|
|
2499
|
+
MaterializedView = class {
|
|
2500
|
+
/** @internal */
|
|
2501
|
+
kind = "MaterializedView";
|
|
2502
|
+
/** The name of the materialized view */
|
|
2503
|
+
name;
|
|
2504
|
+
/** The target OlapTable instance where the materialized data is stored. */
|
|
2505
|
+
targetTable;
|
|
2506
|
+
/** The SELECT SQL statement */
|
|
2507
|
+
selectSql;
|
|
2508
|
+
/** Names of source tables that the SELECT reads from */
|
|
2509
|
+
sourceTables;
|
|
2510
|
+
/** Optional metadata for the materialized view */
|
|
2511
|
+
metadata;
|
|
2512
|
+
constructor(options, targetSchema, targetColumns) {
|
|
2513
|
+
let selectStatement = options.selectStatement;
|
|
2514
|
+
if (typeof selectStatement !== "string") {
|
|
2515
|
+
selectStatement = toStaticQuery(selectStatement);
|
|
2516
|
+
}
|
|
2517
|
+
if (targetSchema === void 0 || targetColumns === void 0) {
|
|
2518
|
+
throw new Error(
|
|
2519
|
+
"Supply the type param T so that the schema is inserted by the compiler plugin."
|
|
2520
|
+
);
|
|
2521
|
+
}
|
|
2522
|
+
const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
|
|
2523
|
+
requireTargetTableName(
|
|
2524
|
+
options.targetTable?.name ?? options.tableName
|
|
2525
|
+
),
|
|
2526
|
+
{
|
|
2527
|
+
orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
|
|
2528
|
+
engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
|
|
2529
|
+
},
|
|
2530
|
+
targetSchema,
|
|
2531
|
+
targetColumns
|
|
2532
|
+
);
|
|
2533
|
+
if (targetTable.name === options.materializedViewName) {
|
|
2534
|
+
throw new Error(
|
|
2535
|
+
"Materialized view name cannot be the same as the target table name."
|
|
2536
|
+
);
|
|
2537
|
+
}
|
|
2538
|
+
this.name = options.materializedViewName;
|
|
2539
|
+
this.targetTable = targetTable;
|
|
2540
|
+
this.selectSql = selectStatement;
|
|
2541
|
+
this.sourceTables = options.selectTables.map(
|
|
2542
|
+
(t) => formatTableReference(t)
|
|
2543
|
+
);
|
|
2544
|
+
this.metadata = options.metadata ? { ...options.metadata } : {};
|
|
2545
|
+
if (!this.metadata.source) {
|
|
2546
|
+
const stack = new Error().stack;
|
|
2547
|
+
const sourceInfo = getSourceFileFromStack(stack);
|
|
2548
|
+
if (sourceInfo) {
|
|
2549
|
+
this.metadata.source = { file: sourceInfo };
|
|
2550
|
+
}
|
|
2551
|
+
}
|
|
2552
|
+
const materializedViews = getMooseInternal().materializedViews;
|
|
2553
|
+
if (!isClientOnlyMode() && materializedViews.has(this.name)) {
|
|
2554
|
+
throw new Error(`MaterializedView with name ${this.name} already exists`);
|
|
2555
|
+
}
|
|
2556
|
+
materializedViews.set(this.name, this);
|
|
2557
|
+
}
|
|
2558
|
+
};
|
|
2559
|
+
}
|
|
2560
|
+
});
|
|
2561
|
+
|
|
2481
2562
|
// src/dmv2/sdk/sqlResource.ts
|
|
2482
2563
|
var SqlResource;
|
|
2483
2564
|
var init_sqlResource = __esm({
|
|
@@ -2541,104 +2622,60 @@ var init_sqlResource = __esm({
|
|
|
2541
2622
|
}
|
|
2542
2623
|
});
|
|
2543
2624
|
|
|
2544
|
-
// src/dmv2/sdk/materializedView.ts
|
|
2545
|
-
var requireTargetTableName, MaterializedView;
|
|
2546
|
-
var init_materializedView = __esm({
|
|
2547
|
-
"src/dmv2/sdk/materializedView.ts"() {
|
|
2548
|
-
"use strict";
|
|
2549
|
-
init_helpers();
|
|
2550
|
-
init_sqlHelpers();
|
|
2551
|
-
init_olapTable();
|
|
2552
|
-
init_sqlResource();
|
|
2553
|
-
requireTargetTableName = (tableName) => {
|
|
2554
|
-
if (typeof tableName === "string") {
|
|
2555
|
-
return tableName;
|
|
2556
|
-
} else {
|
|
2557
|
-
throw new Error("Name of targetTable is not specified.");
|
|
2558
|
-
}
|
|
2559
|
-
};
|
|
2560
|
-
MaterializedView = class extends SqlResource {
|
|
2561
|
-
/** The target OlapTable instance where the materialized data is stored. */
|
|
2562
|
-
targetTable;
|
|
2563
|
-
constructor(options, targetSchema, targetColumns) {
|
|
2564
|
-
let selectStatement = options.selectStatement;
|
|
2565
|
-
if (typeof selectStatement !== "string") {
|
|
2566
|
-
selectStatement = toStaticQuery(selectStatement);
|
|
2567
|
-
}
|
|
2568
|
-
if (targetSchema === void 0 || targetColumns === void 0) {
|
|
2569
|
-
throw new Error(
|
|
2570
|
-
"Supply the type param T so that the schema is inserted by the compiler plugin."
|
|
2571
|
-
);
|
|
2572
|
-
}
|
|
2573
|
-
const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
|
|
2574
|
-
requireTargetTableName(
|
|
2575
|
-
options.targetTable?.name ?? options.tableName
|
|
2576
|
-
),
|
|
2577
|
-
{
|
|
2578
|
-
orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
|
|
2579
|
-
engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
|
|
2580
|
-
},
|
|
2581
|
-
targetSchema,
|
|
2582
|
-
targetColumns
|
|
2583
|
-
);
|
|
2584
|
-
if (targetTable.name === options.materializedViewName) {
|
|
2585
|
-
throw new Error(
|
|
2586
|
-
"Materialized view name cannot be the same as the target table name."
|
|
2587
|
-
);
|
|
2588
|
-
}
|
|
2589
|
-
super(
|
|
2590
|
-
options.materializedViewName,
|
|
2591
|
-
[
|
|
2592
|
-
createMaterializedView({
|
|
2593
|
-
name: options.materializedViewName,
|
|
2594
|
-
destinationTable: targetTable.name,
|
|
2595
|
-
select: selectStatement
|
|
2596
|
-
})
|
|
2597
|
-
// Population is now handled automatically by Rust infrastructure
|
|
2598
|
-
// based on table engine type and whether this is a new or updated view
|
|
2599
|
-
],
|
|
2600
|
-
[dropView(options.materializedViewName)],
|
|
2601
|
-
{
|
|
2602
|
-
pullsDataFrom: options.selectTables,
|
|
2603
|
-
pushesDataTo: [targetTable]
|
|
2604
|
-
}
|
|
2605
|
-
);
|
|
2606
|
-
this.targetTable = targetTable;
|
|
2607
|
-
}
|
|
2608
|
-
};
|
|
2609
|
-
}
|
|
2610
|
-
});
|
|
2611
|
-
|
|
2612
2625
|
// src/dmv2/sdk/view.ts
|
|
2626
|
+
function formatTableReference2(table) {
|
|
2627
|
+
const database = table instanceof OlapTable ? table.config.database : void 0;
|
|
2628
|
+
if (database) {
|
|
2629
|
+
return `\`${database}\`.\`${table.name}\``;
|
|
2630
|
+
}
|
|
2631
|
+
return `\`${table.name}\``;
|
|
2632
|
+
}
|
|
2613
2633
|
var View;
|
|
2614
2634
|
var init_view = __esm({
|
|
2615
2635
|
"src/dmv2/sdk/view.ts"() {
|
|
2616
2636
|
"use strict";
|
|
2617
|
-
init_helpers();
|
|
2618
2637
|
init_sqlHelpers();
|
|
2619
|
-
|
|
2620
|
-
|
|
2638
|
+
init_olapTable();
|
|
2639
|
+
init_internal();
|
|
2640
|
+
init_stackTrace();
|
|
2641
|
+
View = class {
|
|
2642
|
+
/** @internal */
|
|
2643
|
+
kind = "View";
|
|
2644
|
+
/** The name of the view */
|
|
2645
|
+
name;
|
|
2646
|
+
/** The SELECT SQL statement that defines the view */
|
|
2647
|
+
selectSql;
|
|
2648
|
+
/** Names of source tables/views that the SELECT reads from */
|
|
2649
|
+
sourceTables;
|
|
2650
|
+
/** Optional metadata for the view */
|
|
2651
|
+
metadata;
|
|
2621
2652
|
/**
|
|
2622
2653
|
* Creates a new View instance.
|
|
2623
2654
|
* @param name The name of the view to be created.
|
|
2624
2655
|
* @param selectStatement The SQL SELECT statement that defines the view's logic.
|
|
2625
2656
|
* @param baseTables An array of OlapTable or View objects that the `selectStatement` reads from. Used for dependency tracking.
|
|
2657
|
+
* @param metadata Optional metadata for the view (e.g., description, source file).
|
|
2626
2658
|
*/
|
|
2627
|
-
constructor(name, selectStatement, baseTables) {
|
|
2659
|
+
constructor(name, selectStatement, baseTables, metadata) {
|
|
2628
2660
|
if (typeof selectStatement !== "string") {
|
|
2629
2661
|
selectStatement = toStaticQuery(selectStatement);
|
|
2630
2662
|
}
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
{
|
|
2639
|
-
|
|
2663
|
+
this.name = name;
|
|
2664
|
+
this.selectSql = selectStatement;
|
|
2665
|
+
this.sourceTables = baseTables.map((t) => formatTableReference2(t));
|
|
2666
|
+
this.metadata = metadata ? { ...metadata } : {};
|
|
2667
|
+
if (!this.metadata.source) {
|
|
2668
|
+
const stack = new Error().stack;
|
|
2669
|
+
const sourceInfo = getSourceFileFromStack(stack);
|
|
2670
|
+
if (sourceInfo) {
|
|
2671
|
+
this.metadata.source = { file: sourceInfo };
|
|
2640
2672
|
}
|
|
2641
|
-
|
|
2673
|
+
}
|
|
2674
|
+
const views = getMooseInternal().views;
|
|
2675
|
+
if (!isClientOnlyMode() && views.has(this.name)) {
|
|
2676
|
+
throw new Error(`View with name ${this.name} already exists`);
|
|
2677
|
+
}
|
|
2678
|
+
views.set(this.name, this);
|
|
2642
2679
|
}
|
|
2643
2680
|
};
|
|
2644
2681
|
}
|
|
@@ -2842,6 +2879,18 @@ function getWebApps() {
|
|
|
2842
2879
|
function getWebApp(name) {
|
|
2843
2880
|
return getMooseInternal().webApps.get(name);
|
|
2844
2881
|
}
|
|
2882
|
+
function getMaterializedViews() {
|
|
2883
|
+
return getMooseInternal().materializedViews;
|
|
2884
|
+
}
|
|
2885
|
+
function getMaterializedView(name) {
|
|
2886
|
+
return getMooseInternal().materializedViews.get(name);
|
|
2887
|
+
}
|
|
2888
|
+
function getViews() {
|
|
2889
|
+
return getMooseInternal().views;
|
|
2890
|
+
}
|
|
2891
|
+
function getView(name) {
|
|
2892
|
+
return getMooseInternal().views.get(name);
|
|
2893
|
+
}
|
|
2845
2894
|
var init_registry = __esm({
|
|
2846
2895
|
"src/dmv2/registry.ts"() {
|
|
2847
2896
|
"use strict";
|
|
@@ -2871,12 +2920,16 @@ __export(dmv2_exports, {
|
|
|
2871
2920
|
getApis: () => getApis,
|
|
2872
2921
|
getIngestApi: () => getIngestApi,
|
|
2873
2922
|
getIngestApis: () => getIngestApis,
|
|
2923
|
+
getMaterializedView: () => getMaterializedView,
|
|
2924
|
+
getMaterializedViews: () => getMaterializedViews,
|
|
2874
2925
|
getSqlResource: () => getSqlResource,
|
|
2875
2926
|
getSqlResources: () => getSqlResources,
|
|
2876
2927
|
getStream: () => getStream,
|
|
2877
2928
|
getStreams: () => getStreams,
|
|
2878
2929
|
getTable: () => getTable,
|
|
2879
2930
|
getTables: () => getTables,
|
|
2931
|
+
getView: () => getView,
|
|
2932
|
+
getViews: () => getViews,
|
|
2880
2933
|
getWebApp: () => getWebApp,
|
|
2881
2934
|
getWebApps: () => getWebApps,
|
|
2882
2935
|
getWorkflow: () => getWorkflow,
|
|
@@ -2922,12 +2975,16 @@ init_dmv2();
|
|
|
2922
2975
|
getApis,
|
|
2923
2976
|
getIngestApi,
|
|
2924
2977
|
getIngestApis,
|
|
2978
|
+
getMaterializedView,
|
|
2979
|
+
getMaterializedViews,
|
|
2925
2980
|
getSqlResource,
|
|
2926
2981
|
getSqlResources,
|
|
2927
2982
|
getStream,
|
|
2928
2983
|
getStreams,
|
|
2929
2984
|
getTable,
|
|
2930
2985
|
getTables,
|
|
2986
|
+
getView,
|
|
2987
|
+
getViews,
|
|
2931
2988
|
getWebApp,
|
|
2932
2989
|
getWebApps,
|
|
2933
2990
|
getWorkflow,
|