@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.
@@ -2477,8 +2477,8 @@ var init_materializedView = __esm({
2477
2477
  selectSql;
2478
2478
  /** Names of source tables that the SELECT reads from */
2479
2479
  sourceTables;
2480
- /** @internal Source file path where this MV was defined */
2481
- sourceFile;
2480
+ /** Optional metadata for the materialized view */
2481
+ metadata;
2482
2482
  constructor(options, targetSchema, targetColumns) {
2483
2483
  let selectStatement = options.selectStatement;
2484
2484
  if (typeof selectStatement !== "string") {
@@ -2509,8 +2509,14 @@ var init_materializedView = __esm({
2509
2509
  this.targetTable = targetTable;
2510
2510
  this.selectSql = selectStatement;
2511
2511
  this.sourceTables = options.selectTables.map((t) => t.name);
2512
- const stack = new Error().stack;
2513
- this.sourceFile = getSourceFileFromStack(stack);
2512
+ this.metadata = options.metadata ? { ...options.metadata } : {};
2513
+ if (!this.metadata.source) {
2514
+ const stack = new Error().stack;
2515
+ const sourceInfo = getSourceFileFromStack(stack);
2516
+ if (sourceInfo) {
2517
+ this.metadata.source = { file: sourceInfo };
2518
+ }
2519
+ }
2514
2520
  const materializedViews = getMooseInternal().materializedViews;
2515
2521
  if (!isClientOnlyMode() && materializedViews.has(this.name)) {
2516
2522
  throw new Error(`MaterializedView with name ${this.name} already exists`);
@@ -2601,23 +2607,30 @@ var init_view = __esm({
2601
2607
  selectSql;
2602
2608
  /** Names of source tables/views that the SELECT reads from */
2603
2609
  sourceTables;
2604
- /** @internal Source file path where this view was defined */
2605
- sourceFile;
2610
+ /** Optional metadata for the view */
2611
+ metadata;
2606
2612
  /**
2607
2613
  * Creates a new View instance.
2608
2614
  * @param name The name of the view to be created.
2609
2615
  * @param selectStatement The SQL SELECT statement that defines the view's logic.
2610
2616
  * @param baseTables An array of OlapTable or View objects that the `selectStatement` reads from. Used for dependency tracking.
2617
+ * @param metadata Optional metadata for the view (e.g., description, source file).
2611
2618
  */
2612
- constructor(name, selectStatement, baseTables) {
2619
+ constructor(name, selectStatement, baseTables, metadata) {
2613
2620
  if (typeof selectStatement !== "string") {
2614
2621
  selectStatement = toStaticQuery(selectStatement);
2615
2622
  }
2616
2623
  this.name = name;
2617
2624
  this.selectSql = selectStatement;
2618
2625
  this.sourceTables = baseTables.map((t) => t.name);
2619
- const stack = new Error().stack;
2620
- this.sourceFile = getSourceFileFromStack(stack);
2626
+ this.metadata = metadata ? { ...metadata } : {};
2627
+ if (!this.metadata.source) {
2628
+ const stack = new Error().stack;
2629
+ const sourceInfo = getSourceFileFromStack(stack);
2630
+ if (sourceInfo) {
2631
+ this.metadata.source = { file: sourceInfo };
2632
+ }
2633
+ }
2621
2634
  const customViews = getMooseInternal().customViews;
2622
2635
  if (!isClientOnlyMode() && customViews.has(this.name)) {
2623
2636
  throw new Error(`View with name ${this.name} already exists`);