@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.
package/dist/index.mjs CHANGED
@@ -2492,8 +2492,8 @@ var init_materializedView = __esm({
2492
2492
  selectSql;
2493
2493
  /** Names of source tables that the SELECT reads from */
2494
2494
  sourceTables;
2495
- /** @internal Source file path where this MV was defined */
2496
- sourceFile;
2495
+ /** Optional metadata for the materialized view */
2496
+ metadata;
2497
2497
  constructor(options, targetSchema, targetColumns) {
2498
2498
  let selectStatement = options.selectStatement;
2499
2499
  if (typeof selectStatement !== "string") {
@@ -2524,8 +2524,14 @@ var init_materializedView = __esm({
2524
2524
  this.targetTable = targetTable;
2525
2525
  this.selectSql = selectStatement;
2526
2526
  this.sourceTables = options.selectTables.map((t) => t.name);
2527
- const stack = new Error().stack;
2528
- this.sourceFile = getSourceFileFromStack(stack);
2527
+ this.metadata = options.metadata ? { ...options.metadata } : {};
2528
+ if (!this.metadata.source) {
2529
+ const stack = new Error().stack;
2530
+ const sourceInfo = getSourceFileFromStack(stack);
2531
+ if (sourceInfo) {
2532
+ this.metadata.source = { file: sourceInfo };
2533
+ }
2534
+ }
2529
2535
  const materializedViews = getMooseInternal().materializedViews;
2530
2536
  if (!isClientOnlyMode() && materializedViews.has(this.name)) {
2531
2537
  throw new Error(`MaterializedView with name ${this.name} already exists`);
@@ -2616,23 +2622,30 @@ var init_view = __esm({
2616
2622
  selectSql;
2617
2623
  /** Names of source tables/views that the SELECT reads from */
2618
2624
  sourceTables;
2619
- /** @internal Source file path where this view was defined */
2620
- sourceFile;
2625
+ /** Optional metadata for the view */
2626
+ metadata;
2621
2627
  /**
2622
2628
  * Creates a new View instance.
2623
2629
  * @param name The name of the view to be created.
2624
2630
  * @param selectStatement The SQL SELECT statement that defines the view's logic.
2625
2631
  * @param baseTables An array of OlapTable or View objects that the `selectStatement` reads from. Used for dependency tracking.
2632
+ * @param metadata Optional metadata for the view (e.g., description, source file).
2626
2633
  */
2627
- constructor(name, selectStatement, baseTables) {
2634
+ constructor(name, selectStatement, baseTables, metadata) {
2628
2635
  if (typeof selectStatement !== "string") {
2629
2636
  selectStatement = toStaticQuery(selectStatement);
2630
2637
  }
2631
2638
  this.name = name;
2632
2639
  this.selectSql = selectStatement;
2633
2640
  this.sourceTables = baseTables.map((t) => t.name);
2634
- const stack = new Error().stack;
2635
- this.sourceFile = getSourceFileFromStack(stack);
2641
+ this.metadata = metadata ? { ...metadata } : {};
2642
+ if (!this.metadata.source) {
2643
+ const stack = new Error().stack;
2644
+ const sourceInfo = getSourceFileFromStack(stack);
2645
+ if (sourceInfo) {
2646
+ this.metadata.source = { file: sourceInfo };
2647
+ }
2648
+ }
2636
2649
  const customViews = getMooseInternal().customViews;
2637
2650
  if (!isClientOnlyMode() && customViews.has(this.name)) {
2638
2651
  throw new Error(`View with name ${this.name} already exists`);