@514labs/moose-lib 0.6.297-ci-25-g92aec239 → 0.6.297-ci-32-g6119ebc8

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/index.mjs CHANGED
@@ -548,7 +548,7 @@ var init_internal = __esm({
548
548
  workflows: /* @__PURE__ */ new Map(),
549
549
  webApps: /* @__PURE__ */ new Map(),
550
550
  materializedViews: /* @__PURE__ */ new Map(),
551
- customViews: /* @__PURE__ */ new Map()
551
+ views: /* @__PURE__ */ new Map()
552
552
  };
553
553
  defaultRetentionPeriod = 60 * 60 * 24 * 7;
554
554
  getMooseInternal = () => globalThis.moose_internal;
@@ -565,7 +565,7 @@ var init_internal = __esm({
565
565
  registry.workflows.clear();
566
566
  registry.webApps.clear();
567
567
  registry.materializedViews.clear();
568
- registry.customViews.clear();
568
+ registry.views.clear();
569
569
  const appDir = `${process2.cwd()}/${getSourceDir()}`;
570
570
  Object.keys(__require.cache).forEach((key) => {
571
571
  if (key.startsWith(appDir)) {
@@ -2465,6 +2465,13 @@ var init_etlPipeline = __esm({
2465
2465
  });
2466
2466
 
2467
2467
  // src/dmv2/sdk/materializedView.ts
2468
+ function formatTableReference(table) {
2469
+ const database = table instanceof OlapTable ? table.config.database : void 0;
2470
+ if (database) {
2471
+ return `\`${database}\`.\`${table.name}\``;
2472
+ }
2473
+ return `\`${table.name}\``;
2474
+ }
2468
2475
  var requireTargetTableName, MaterializedView;
2469
2476
  var init_materializedView = __esm({
2470
2477
  "src/dmv2/sdk/materializedView.ts"() {
@@ -2523,7 +2530,9 @@ var init_materializedView = __esm({
2523
2530
  this.name = options.materializedViewName;
2524
2531
  this.targetTable = targetTable;
2525
2532
  this.selectSql = selectStatement;
2526
- this.sourceTables = options.selectTables.map((t) => t.name);
2533
+ this.sourceTables = options.selectTables.map(
2534
+ (t) => formatTableReference(t)
2535
+ );
2527
2536
  this.metadata = options.metadata ? { ...options.metadata } : {};
2528
2537
  if (!this.metadata.source) {
2529
2538
  const stack = new Error().stack;
@@ -2606,16 +2615,24 @@ var init_sqlResource = __esm({
2606
2615
  });
2607
2616
 
2608
2617
  // src/dmv2/sdk/view.ts
2618
+ function formatTableReference2(table) {
2619
+ const database = table instanceof OlapTable ? table.config.database : void 0;
2620
+ if (database) {
2621
+ return `\`${database}\`.\`${table.name}\``;
2622
+ }
2623
+ return `\`${table.name}\``;
2624
+ }
2609
2625
  var View;
2610
2626
  var init_view = __esm({
2611
2627
  "src/dmv2/sdk/view.ts"() {
2612
2628
  "use strict";
2613
2629
  init_sqlHelpers();
2630
+ init_olapTable();
2614
2631
  init_internal();
2615
2632
  init_stackTrace();
2616
2633
  View = class {
2617
2634
  /** @internal */
2618
- kind = "CustomView";
2635
+ kind = "View";
2619
2636
  /** The name of the view */
2620
2637
  name;
2621
2638
  /** The SELECT SQL statement that defines the view */
@@ -2637,7 +2654,7 @@ var init_view = __esm({
2637
2654
  }
2638
2655
  this.name = name;
2639
2656
  this.selectSql = selectStatement;
2640
- this.sourceTables = baseTables.map((t) => t.name);
2657
+ this.sourceTables = baseTables.map((t) => formatTableReference2(t));
2641
2658
  this.metadata = metadata ? { ...metadata } : {};
2642
2659
  if (!this.metadata.source) {
2643
2660
  const stack = new Error().stack;
@@ -2646,11 +2663,11 @@ var init_view = __esm({
2646
2663
  this.metadata.source = { file: sourceInfo };
2647
2664
  }
2648
2665
  }
2649
- const customViews = getMooseInternal().customViews;
2650
- if (!isClientOnlyMode() && customViews.has(this.name)) {
2666
+ const views = getMooseInternal().views;
2667
+ if (!isClientOnlyMode() && views.has(this.name)) {
2651
2668
  throw new Error(`View with name ${this.name} already exists`);
2652
2669
  }
2653
- customViews.set(this.name, this);
2670
+ views.set(this.name, this);
2654
2671
  }
2655
2672
  };
2656
2673
  }
@@ -2860,11 +2877,11 @@ function getMaterializedViews() {
2860
2877
  function getMaterializedView(name) {
2861
2878
  return getMooseInternal().materializedViews.get(name);
2862
2879
  }
2863
- function getCustomViews() {
2864
- return getMooseInternal().customViews;
2880
+ function getViews() {
2881
+ return getMooseInternal().views;
2865
2882
  }
2866
- function getCustomView(name) {
2867
- return getMooseInternal().customViews.get(name);
2883
+ function getView(name) {
2884
+ return getMooseInternal().views.get(name);
2868
2885
  }
2869
2886
  var init_registry = __esm({
2870
2887
  "src/dmv2/registry.ts"() {
@@ -3769,8 +3786,6 @@ export {
3769
3786
  getApi,
3770
3787
  getApis,
3771
3788
  getClickhouseClient,
3772
- getCustomView,
3773
- getCustomViews,
3774
3789
  getFileName,
3775
3790
  getIngestApi,
3776
3791
  getIngestApis,
@@ -3790,6 +3805,8 @@ export {
3790
3805
  getTables,
3791
3806
  getTemporalClient,
3792
3807
  getValueFromParameter,
3808
+ getView,
3809
+ getViews,
3793
3810
  getWebApp,
3794
3811
  getWebApps,
3795
3812
  getWorkflow,