@514labs/moose-lib 0.6.297-ci-4-g3b2674ae → 0.6.297-ci-22-g1be0de24

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.
@@ -1,4 +1,4 @@
1
- export { A as Aggregated, h as Api, i as ApiConfig, ah 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, al as IngestPipelineConfig, L as LifeCycle, M as MaterializedView, am 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, ak as TaskConfig, aj as TaskContext, ai 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, z as getSqlResource, y as getSqlResources, t as getStream, s as getStreams, r as getTable, q as getTables, J as getWebApp, H as getWebApps, G as getWorkflow, B as getWorkflows } from '../index-CcHF2cVT.mjs';
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, K as getCustomView, N as getCustomViews, 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, J as getWebApp, H as getWebApps, G as getWorkflow, B as getWorkflows } from '../index-9XL-mk89.mjs';
2
2
  import 'typia';
3
3
  import 'typia/src/schemas/json/IJsonSchemaCollection';
4
4
  import 'node:stream';
@@ -1,4 +1,4 @@
1
- export { A as Aggregated, h as Api, i as ApiConfig, ah 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, al as IngestPipelineConfig, L as LifeCycle, M as MaterializedView, am 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, ak as TaskConfig, aj as TaskContext, ai 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, z as getSqlResource, y as getSqlResources, t as getStream, s as getStreams, r as getTable, q as getTables, J as getWebApp, H as getWebApps, G as getWorkflow, B as getWorkflows } from '../index-CcHF2cVT.js';
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, K as getCustomView, N as getCustomViews, 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, J as getWebApp, H as getWebApps, G as getWorkflow, B as getWorkflows } from '../index-9XL-mk89.js';
2
2
  import 'typia';
3
3
  import 'typia/src/schemas/json/IJsonSchemaCollection';
4
4
  import 'node:stream';
@@ -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
+ customViews: /* @__PURE__ */ new Map()
601
595
  };
602
596
  defaultRetentionPeriod = 60 * 60 * 24 * 7;
603
597
  getMooseInternal = () => globalThis.moose_internal;
@@ -2478,6 +2472,78 @@ var init_etlPipeline = __esm({
2478
2472
  }
2479
2473
  });
2480
2474
 
2475
+ // src/dmv2/sdk/materializedView.ts
2476
+ var requireTargetTableName, MaterializedView;
2477
+ var init_materializedView = __esm({
2478
+ "src/dmv2/sdk/materializedView.ts"() {
2479
+ "use strict";
2480
+ init_helpers();
2481
+ init_sqlHelpers();
2482
+ init_olapTable();
2483
+ init_internal();
2484
+ init_stackTrace();
2485
+ requireTargetTableName = (tableName) => {
2486
+ if (typeof tableName === "string") {
2487
+ return tableName;
2488
+ } else {
2489
+ throw new Error("Name of targetTable is not specified.");
2490
+ }
2491
+ };
2492
+ MaterializedView = class {
2493
+ /** @internal */
2494
+ kind = "MaterializedView";
2495
+ /** The name of the materialized view */
2496
+ name;
2497
+ /** The target OlapTable instance where the materialized data is stored. */
2498
+ targetTable;
2499
+ /** The SELECT SQL statement */
2500
+ selectSql;
2501
+ /** Names of source tables that the SELECT reads from */
2502
+ sourceTables;
2503
+ /** @internal Source file path where this MV was defined */
2504
+ sourceFile;
2505
+ constructor(options, targetSchema, targetColumns) {
2506
+ let selectStatement = options.selectStatement;
2507
+ if (typeof selectStatement !== "string") {
2508
+ selectStatement = toStaticQuery(selectStatement);
2509
+ }
2510
+ if (targetSchema === void 0 || targetColumns === void 0) {
2511
+ throw new Error(
2512
+ "Supply the type param T so that the schema is inserted by the compiler plugin."
2513
+ );
2514
+ }
2515
+ const targetTable = options.targetTable instanceof OlapTable ? options.targetTable : new OlapTable(
2516
+ requireTargetTableName(
2517
+ options.targetTable?.name ?? options.tableName
2518
+ ),
2519
+ {
2520
+ orderByFields: options.targetTable?.orderByFields ?? options.orderByFields,
2521
+ engine: options.targetTable?.engine ?? options.engine ?? "MergeTree" /* MergeTree */
2522
+ },
2523
+ targetSchema,
2524
+ targetColumns
2525
+ );
2526
+ if (targetTable.name === options.materializedViewName) {
2527
+ throw new Error(
2528
+ "Materialized view name cannot be the same as the target table name."
2529
+ );
2530
+ }
2531
+ this.name = options.materializedViewName;
2532
+ this.targetTable = targetTable;
2533
+ this.selectSql = selectStatement;
2534
+ this.sourceTables = options.selectTables.map((t) => t.name);
2535
+ const stack = new Error().stack;
2536
+ this.sourceFile = getSourceFileFromStack(stack);
2537
+ const materializedViews = getMooseInternal().materializedViews;
2538
+ if (!isClientOnlyMode() && materializedViews.has(this.name)) {
2539
+ throw new Error(`MaterializedView with name ${this.name} already exists`);
2540
+ }
2541
+ materializedViews.set(this.name, this);
2542
+ }
2543
+ };
2544
+ }
2545
+ });
2546
+
2481
2547
  // src/dmv2/sdk/sqlResource.ts
2482
2548
  var SqlResource;
2483
2549
  var init_sqlResource = __esm({
@@ -2541,83 +2607,25 @@ var init_sqlResource = __esm({
2541
2607
  }
2542
2608
  });
2543
2609
 
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
2610
  // src/dmv2/sdk/view.ts
2613
2611
  var View;
2614
2612
  var init_view = __esm({
2615
2613
  "src/dmv2/sdk/view.ts"() {
2616
2614
  "use strict";
2617
- init_helpers();
2618
2615
  init_sqlHelpers();
2619
- init_sqlResource();
2620
- View = class extends SqlResource {
2616
+ init_internal();
2617
+ init_stackTrace();
2618
+ View = class {
2619
+ /** @internal */
2620
+ kind = "CustomView";
2621
+ /** The name of the view */
2622
+ name;
2623
+ /** The SELECT SQL statement that defines the view */
2624
+ selectSql;
2625
+ /** Names of source tables/views that the SELECT reads from */
2626
+ sourceTables;
2627
+ /** @internal Source file path where this view was defined */
2628
+ sourceFile;
2621
2629
  /**
2622
2630
  * Creates a new View instance.
2623
2631
  * @param name The name of the view to be created.
@@ -2628,17 +2636,16 @@ var init_view = __esm({
2628
2636
  if (typeof selectStatement !== "string") {
2629
2637
  selectStatement = toStaticQuery(selectStatement);
2630
2638
  }
2631
- super(
2632
- name,
2633
- [
2634
- `CREATE VIEW IF NOT EXISTS ${name}
2635
- AS ${selectStatement}`.trim()
2636
- ],
2637
- [dropView(name)],
2638
- {
2639
- pullsDataFrom: baseTables
2640
- }
2641
- );
2639
+ this.name = name;
2640
+ this.selectSql = selectStatement;
2641
+ this.sourceTables = baseTables.map((t) => t.name);
2642
+ const stack = new Error().stack;
2643
+ this.sourceFile = getSourceFileFromStack(stack);
2644
+ const customViews = getMooseInternal().customViews;
2645
+ if (!isClientOnlyMode() && customViews.has(this.name)) {
2646
+ throw new Error(`View with name ${this.name} already exists`);
2647
+ }
2648
+ customViews.set(this.name, this);
2642
2649
  }
2643
2650
  };
2644
2651
  }
@@ -2842,6 +2849,18 @@ function getWebApps() {
2842
2849
  function getWebApp(name) {
2843
2850
  return getMooseInternal().webApps.get(name);
2844
2851
  }
2852
+ function getMaterializedViews() {
2853
+ return getMooseInternal().materializedViews;
2854
+ }
2855
+ function getMaterializedView(name) {
2856
+ return getMooseInternal().materializedViews.get(name);
2857
+ }
2858
+ function getCustomViews() {
2859
+ return getMooseInternal().customViews;
2860
+ }
2861
+ function getCustomView(name) {
2862
+ return getMooseInternal().customViews.get(name);
2863
+ }
2845
2864
  var init_registry = __esm({
2846
2865
  "src/dmv2/registry.ts"() {
2847
2866
  "use strict";
@@ -2869,8 +2888,12 @@ __export(dmv2_exports, {
2869
2888
  Workflow: () => Workflow,
2870
2889
  getApi: () => getApi,
2871
2890
  getApis: () => getApis,
2891
+ getCustomView: () => getCustomView,
2892
+ getCustomViews: () => getCustomViews,
2872
2893
  getIngestApi: () => getIngestApi,
2873
2894
  getIngestApis: () => getIngestApis,
2895
+ getMaterializedView: () => getMaterializedView,
2896
+ getMaterializedViews: () => getMaterializedViews,
2874
2897
  getSqlResource: () => getSqlResource,
2875
2898
  getSqlResources: () => getSqlResources,
2876
2899
  getStream: () => getStream,
@@ -2920,8 +2943,12 @@ init_dmv2();
2920
2943
  Workflow,
2921
2944
  getApi,
2922
2945
  getApis,
2946
+ getCustomView,
2947
+ getCustomViews,
2923
2948
  getIngestApi,
2924
2949
  getIngestApis,
2950
+ getMaterializedView,
2951
+ getMaterializedViews,
2925
2952
  getSqlResource,
2926
2953
  getSqlResources,
2927
2954
  getStream,