@514labs/moose-lib 0.6.297-ci-22-g1be0de24 → 0.6.297-ci-23-g751e4221

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.
@@ -2562,8 +2562,8 @@ var init_materializedView = __esm({
2562
2562
  selectSql;
2563
2563
  /** Names of source tables that the SELECT reads from */
2564
2564
  sourceTables;
2565
- /** @internal Source file path where this MV was defined */
2566
- sourceFile;
2565
+ /** Optional metadata for the materialized view */
2566
+ metadata;
2567
2567
  constructor(options, targetSchema, targetColumns) {
2568
2568
  let selectStatement = options.selectStatement;
2569
2569
  if (typeof selectStatement !== "string") {
@@ -2594,8 +2594,14 @@ var init_materializedView = __esm({
2594
2594
  this.targetTable = targetTable;
2595
2595
  this.selectSql = selectStatement;
2596
2596
  this.sourceTables = options.selectTables.map((t) => t.name);
2597
- const stack = new Error().stack;
2598
- this.sourceFile = getSourceFileFromStack(stack);
2597
+ this.metadata = options.metadata ? { ...options.metadata } : {};
2598
+ if (!this.metadata.source) {
2599
+ const stack = new Error().stack;
2600
+ const sourceInfo = getSourceFileFromStack(stack);
2601
+ if (sourceInfo) {
2602
+ this.metadata.source = { file: sourceInfo };
2603
+ }
2604
+ }
2599
2605
  const materializedViews = getMooseInternal().materializedViews;
2600
2606
  if (!isClientOnlyMode() && materializedViews.has(this.name)) {
2601
2607
  throw new Error(`MaterializedView with name ${this.name} already exists`);
@@ -2686,23 +2692,30 @@ var init_view = __esm({
2686
2692
  selectSql;
2687
2693
  /** Names of source tables/views that the SELECT reads from */
2688
2694
  sourceTables;
2689
- /** @internal Source file path where this view was defined */
2690
- sourceFile;
2695
+ /** Optional metadata for the view */
2696
+ metadata;
2691
2697
  /**
2692
2698
  * Creates a new View instance.
2693
2699
  * @param name The name of the view to be created.
2694
2700
  * @param selectStatement The SQL SELECT statement that defines the view's logic.
2695
2701
  * @param baseTables An array of OlapTable or View objects that the `selectStatement` reads from. Used for dependency tracking.
2702
+ * @param metadata Optional metadata for the view (e.g., description, source file).
2696
2703
  */
2697
- constructor(name, selectStatement, baseTables) {
2704
+ constructor(name, selectStatement, baseTables, metadata) {
2698
2705
  if (typeof selectStatement !== "string") {
2699
2706
  selectStatement = toStaticQuery(selectStatement);
2700
2707
  }
2701
2708
  this.name = name;
2702
2709
  this.selectSql = selectStatement;
2703
2710
  this.sourceTables = baseTables.map((t) => t.name);
2704
- const stack = new Error().stack;
2705
- this.sourceFile = getSourceFileFromStack(stack);
2711
+ this.metadata = metadata ? { ...metadata } : {};
2712
+ if (!this.metadata.source) {
2713
+ const stack = new Error().stack;
2714
+ const sourceInfo = getSourceFileFromStack(stack);
2715
+ if (sourceInfo) {
2716
+ this.metadata.source = { file: sourceInfo };
2717
+ }
2718
+ }
2706
2719
  const customViews = getMooseInternal().customViews;
2707
2720
  if (!isClientOnlyMode() && customViews.has(this.name)) {
2708
2721
  throw new Error(`View with name ${this.name} already exists`);