@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.
@@ -653,7 +653,7 @@ var init_internal = __esm({
653
653
  workflows: /* @__PURE__ */ new Map(),
654
654
  webApps: /* @__PURE__ */ new Map(),
655
655
  materializedViews: /* @__PURE__ */ new Map(),
656
- customViews: /* @__PURE__ */ new Map()
656
+ views: /* @__PURE__ */ new Map()
657
657
  };
658
658
  defaultRetentionPeriod = 60 * 60 * 24 * 7;
659
659
  getMooseInternal = () => globalThis.moose_internal;
@@ -2535,6 +2535,13 @@ var init_etlPipeline = __esm({
2535
2535
  });
2536
2536
 
2537
2537
  // src/dmv2/sdk/materializedView.ts
2538
+ function formatTableReference(table) {
2539
+ const database = table instanceof OlapTable ? table.config.database : void 0;
2540
+ if (database) {
2541
+ return `\`${database}\`.\`${table.name}\``;
2542
+ }
2543
+ return `\`${table.name}\``;
2544
+ }
2538
2545
  var requireTargetTableName, MaterializedView;
2539
2546
  var init_materializedView = __esm({
2540
2547
  "src/dmv2/sdk/materializedView.ts"() {
@@ -2593,7 +2600,9 @@ var init_materializedView = __esm({
2593
2600
  this.name = options.materializedViewName;
2594
2601
  this.targetTable = targetTable;
2595
2602
  this.selectSql = selectStatement;
2596
- this.sourceTables = options.selectTables.map((t) => t.name);
2603
+ this.sourceTables = options.selectTables.map(
2604
+ (t) => formatTableReference(t)
2605
+ );
2597
2606
  this.metadata = options.metadata ? { ...options.metadata } : {};
2598
2607
  if (!this.metadata.source) {
2599
2608
  const stack = new Error().stack;
@@ -2676,16 +2685,24 @@ var init_sqlResource = __esm({
2676
2685
  });
2677
2686
 
2678
2687
  // src/dmv2/sdk/view.ts
2688
+ function formatTableReference2(table) {
2689
+ const database = table instanceof OlapTable ? table.config.database : void 0;
2690
+ if (database) {
2691
+ return `\`${database}\`.\`${table.name}\``;
2692
+ }
2693
+ return `\`${table.name}\``;
2694
+ }
2679
2695
  var View;
2680
2696
  var init_view = __esm({
2681
2697
  "src/dmv2/sdk/view.ts"() {
2682
2698
  "use strict";
2683
2699
  init_sqlHelpers();
2700
+ init_olapTable();
2684
2701
  init_internal();
2685
2702
  init_stackTrace();
2686
2703
  View = class {
2687
2704
  /** @internal */
2688
- kind = "CustomView";
2705
+ kind = "View";
2689
2706
  /** The name of the view */
2690
2707
  name;
2691
2708
  /** The SELECT SQL statement that defines the view */
@@ -2707,7 +2724,7 @@ var init_view = __esm({
2707
2724
  }
2708
2725
  this.name = name;
2709
2726
  this.selectSql = selectStatement;
2710
- this.sourceTables = baseTables.map((t) => t.name);
2727
+ this.sourceTables = baseTables.map((t) => formatTableReference2(t));
2711
2728
  this.metadata = metadata ? { ...metadata } : {};
2712
2729
  if (!this.metadata.source) {
2713
2730
  const stack = new Error().stack;
@@ -2716,11 +2733,11 @@ var init_view = __esm({
2716
2733
  this.metadata.source = { file: sourceInfo };
2717
2734
  }
2718
2735
  }
2719
- const customViews = getMooseInternal().customViews;
2720
- if (!isClientOnlyMode() && customViews.has(this.name)) {
2736
+ const views = getMooseInternal().views;
2737
+ if (!isClientOnlyMode() && views.has(this.name)) {
2721
2738
  throw new Error(`View with name ${this.name} already exists`);
2722
2739
  }
2723
- customViews.set(this.name, this);
2740
+ views.set(this.name, this);
2724
2741
  }
2725
2742
  };
2726
2743
  }
@@ -2930,11 +2947,11 @@ function getMaterializedViews() {
2930
2947
  function getMaterializedView(name) {
2931
2948
  return getMooseInternal().materializedViews.get(name);
2932
2949
  }
2933
- function getCustomViews() {
2934
- return getMooseInternal().customViews;
2950
+ function getViews() {
2951
+ return getMooseInternal().views;
2935
2952
  }
2936
- function getCustomView(name) {
2937
- return getMooseInternal().customViews.get(name);
2953
+ function getView(name) {
2954
+ return getMooseInternal().views.get(name);
2938
2955
  }
2939
2956
  var init_registry = __esm({
2940
2957
  "src/dmv2/registry.ts"() {
@@ -2992,8 +3009,6 @@ export {
2992
3009
  createClickhouseParameter,
2993
3010
  getApi,
2994
3011
  getApis2 as getApis,
2995
- getCustomView,
2996
- getCustomViews,
2997
3012
  getIngestApi,
2998
3013
  getIngestApis,
2999
3014
  getMaterializedView,
@@ -3005,6 +3020,8 @@ export {
3005
3020
  getTable,
3006
3021
  getTables,
3007
3022
  getValueFromParameter,
3023
+ getView,
3024
+ getViews,
3008
3025
  getWebApp,
3009
3026
  getWebApps2 as getWebApps,
3010
3027
  getWorkflow,