@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.
@@ -568,7 +568,7 @@ var init_internal = __esm({
568
568
  workflows: /* @__PURE__ */ new Map(),
569
569
  webApps: /* @__PURE__ */ new Map(),
570
570
  materializedViews: /* @__PURE__ */ new Map(),
571
- customViews: /* @__PURE__ */ new Map()
571
+ views: /* @__PURE__ */ new Map()
572
572
  };
573
573
  defaultRetentionPeriod = 60 * 60 * 24 * 7;
574
574
  getMooseInternal = () => globalThis.moose_internal;
@@ -2450,6 +2450,13 @@ var init_etlPipeline = __esm({
2450
2450
  });
2451
2451
 
2452
2452
  // src/dmv2/sdk/materializedView.ts
2453
+ function formatTableReference(table) {
2454
+ const database = table instanceof OlapTable ? table.config.database : void 0;
2455
+ if (database) {
2456
+ return `\`${database}\`.\`${table.name}\``;
2457
+ }
2458
+ return `\`${table.name}\``;
2459
+ }
2453
2460
  var requireTargetTableName, MaterializedView;
2454
2461
  var init_materializedView = __esm({
2455
2462
  "src/dmv2/sdk/materializedView.ts"() {
@@ -2508,7 +2515,9 @@ var init_materializedView = __esm({
2508
2515
  this.name = options.materializedViewName;
2509
2516
  this.targetTable = targetTable;
2510
2517
  this.selectSql = selectStatement;
2511
- this.sourceTables = options.selectTables.map((t) => t.name);
2518
+ this.sourceTables = options.selectTables.map(
2519
+ (t) => formatTableReference(t)
2520
+ );
2512
2521
  this.metadata = options.metadata ? { ...options.metadata } : {};
2513
2522
  if (!this.metadata.source) {
2514
2523
  const stack = new Error().stack;
@@ -2591,16 +2600,24 @@ var init_sqlResource = __esm({
2591
2600
  });
2592
2601
 
2593
2602
  // src/dmv2/sdk/view.ts
2603
+ function formatTableReference2(table) {
2604
+ const database = table instanceof OlapTable ? table.config.database : void 0;
2605
+ if (database) {
2606
+ return `\`${database}\`.\`${table.name}\``;
2607
+ }
2608
+ return `\`${table.name}\``;
2609
+ }
2594
2610
  var View;
2595
2611
  var init_view = __esm({
2596
2612
  "src/dmv2/sdk/view.ts"() {
2597
2613
  "use strict";
2598
2614
  init_sqlHelpers();
2615
+ init_olapTable();
2599
2616
  init_internal();
2600
2617
  init_stackTrace();
2601
2618
  View = class {
2602
2619
  /** @internal */
2603
- kind = "CustomView";
2620
+ kind = "View";
2604
2621
  /** The name of the view */
2605
2622
  name;
2606
2623
  /** The SELECT SQL statement that defines the view */
@@ -2622,7 +2639,7 @@ var init_view = __esm({
2622
2639
  }
2623
2640
  this.name = name;
2624
2641
  this.selectSql = selectStatement;
2625
- this.sourceTables = baseTables.map((t) => t.name);
2642
+ this.sourceTables = baseTables.map((t) => formatTableReference2(t));
2626
2643
  this.metadata = metadata ? { ...metadata } : {};
2627
2644
  if (!this.metadata.source) {
2628
2645
  const stack = new Error().stack;
@@ -2631,11 +2648,11 @@ var init_view = __esm({
2631
2648
  this.metadata.source = { file: sourceInfo };
2632
2649
  }
2633
2650
  }
2634
- const customViews = getMooseInternal().customViews;
2635
- if (!isClientOnlyMode() && customViews.has(this.name)) {
2651
+ const views = getMooseInternal().views;
2652
+ if (!isClientOnlyMode() && views.has(this.name)) {
2636
2653
  throw new Error(`View with name ${this.name} already exists`);
2637
2654
  }
2638
- customViews.set(this.name, this);
2655
+ views.set(this.name, this);
2639
2656
  }
2640
2657
  };
2641
2658
  }
@@ -2845,11 +2862,11 @@ function getMaterializedViews() {
2845
2862
  function getMaterializedView(name) {
2846
2863
  return getMooseInternal().materializedViews.get(name);
2847
2864
  }
2848
- function getCustomViews() {
2849
- return getMooseInternal().customViews;
2865
+ function getViews() {
2866
+ return getMooseInternal().views;
2850
2867
  }
2851
- function getCustomView(name) {
2852
- return getMooseInternal().customViews.get(name);
2868
+ function getView(name) {
2869
+ return getMooseInternal().views.get(name);
2853
2870
  }
2854
2871
  var init_registry = __esm({
2855
2872
  "src/dmv2/registry.ts"() {
@@ -2895,8 +2912,6 @@ export {
2895
2912
  Workflow,
2896
2913
  getApi,
2897
2914
  getApis,
2898
- getCustomView,
2899
- getCustomViews,
2900
2915
  getIngestApi,
2901
2916
  getIngestApis,
2902
2917
  getMaterializedView,
@@ -2907,6 +2922,8 @@ export {
2907
2922
  getStreams,
2908
2923
  getTable,
2909
2924
  getTables,
2925
+ getView,
2926
+ getViews,
2910
2927
  getWebApp,
2911
2928
  getWebApps,
2912
2929
  getWorkflow,