@514labs/moose-lib 0.6.242 → 0.6.243

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.
@@ -351,24 +351,39 @@ var init_runtime = __esm({
351
351
  }
352
352
  });
353
353
 
354
- // src/dmv2/typedBase.ts
355
- function getInstantiationFileInfo(stack) {
354
+ // src/dmv2/utils/stackTrace.ts
355
+ function shouldSkipStackLine(line) {
356
+ return line.includes("node_modules") || // Skip npm installed packages (prod)
357
+ line.includes("internal/modules") || // Skip Node.js internals
358
+ line.includes("ts-node") || // Skip TypeScript execution
359
+ line.includes("/ts-moose-lib/") || // Skip dev/linked moose-lib (Unix)
360
+ line.includes("\\ts-moose-lib\\");
361
+ }
362
+ function parseStackLine(line) {
363
+ const match = line.match(/\((.*):(\d+):(\d+)\)/) || line.match(/at (.*):(\d+):(\d+)/);
364
+ if (match && match[1]) {
365
+ return {
366
+ file: match[1],
367
+ line: match[2]
368
+ };
369
+ }
370
+ return void 0;
371
+ }
372
+ function getSourceFileInfo(stack) {
356
373
  if (!stack) return {};
357
374
  const lines = stack.split("\n");
358
375
  for (const line of lines) {
359
- if (line.includes("node_modules") || line.includes("internal/modules") || line.includes("ts-node"))
360
- continue;
361
- const match = line.match(/\((.*):(\d+):(\d+)\)/) || line.match(/at (.*):(\d+):(\d+)/);
362
- if (match && match[1]) {
363
- return {
364
- file: match[1],
365
- line: match[2]
366
- // Only the line number
367
- };
368
- }
376
+ if (shouldSkipStackLine(line)) continue;
377
+ const info = parseStackLine(line);
378
+ if (info) return info;
369
379
  }
370
380
  return {};
371
381
  }
382
+ function getSourceFileFromStack(stack) {
383
+ return getSourceFileInfo(stack).file;
384
+ }
385
+
386
+ // src/dmv2/typedBase.ts
372
387
  var TypedBase = class {
373
388
  /** The JSON schema representation of type T. Injected by the compiler plugin. */
374
389
  schema;
@@ -412,7 +427,7 @@ var TypedBase = class {
412
427
  this.metadata = config?.metadata ? { ...config.metadata } : {};
413
428
  const stack = new Error().stack;
414
429
  if (stack) {
415
- const info = getInstantiationFileInfo(stack);
430
+ const info = getSourceFileInfo(stack);
416
431
  this.metadata.source = { file: info.file, line: info.line };
417
432
  } else {
418
433
  this.metadata.source = void 0;
@@ -1547,8 +1562,10 @@ var Stream = class extends TypedBase {
1547
1562
  * @param config Optional configuration for this specific transformation step, like a version.
1548
1563
  */
1549
1564
  addTransform(destination, transformation, config) {
1565
+ const sourceFile = getSourceFileFromStack(new Error().stack);
1550
1566
  const transformConfig = {
1551
- ...config ?? {}
1567
+ ...config ?? {},
1568
+ sourceFile
1552
1569
  };
1553
1570
  if (transformConfig.deadLetterQueue === void 0) {
1554
1571
  transformConfig.deadLetterQueue = this.defaultDeadLetterQueue;
@@ -1575,8 +1592,10 @@ var Stream = class extends TypedBase {
1575
1592
  * @param config Optional configuration for this specific consumer, like a version.
1576
1593
  */
1577
1594
  addConsumer(consumer, config) {
1595
+ const sourceFile = getSourceFileFromStack(new Error().stack);
1578
1596
  const consumerConfig = {
1579
- ...config ?? {}
1597
+ ...config ?? {},
1598
+ sourceFile
1580
1599
  };
1581
1600
  if (consumerConfig.deadLetterQueue === void 0) {
1582
1601
  consumerConfig.deadLetterQueue = this.defaultDeadLetterQueue;
@@ -2163,6 +2182,8 @@ var SqlResource = class {
2163
2182
  pullsDataFrom;
2164
2183
  /** List of OlapTables or Views that this resource writes data to. */
2165
2184
  pushesDataTo;
2185
+ /** @internal Source file path where this resource was defined */
2186
+ sourceFile;
2166
2187
  /**
2167
2188
  * Creates a new SqlResource instance.
2168
2189
  * @param name The name of the resource.
@@ -2187,6 +2208,8 @@ var SqlResource = class {
2187
2208
  );
2188
2209
  this.pullsDataFrom = options?.pullsDataFrom ?? [];
2189
2210
  this.pushesDataTo = options?.pushesDataTo ?? [];
2211
+ const stack = new Error().stack;
2212
+ this.sourceFile = getSourceFileFromStack(stack);
2190
2213
  }
2191
2214
  };
2192
2215