@514labs/moose-lib 0.6.238 → 0.6.239-ci-14-g85f6cfc1

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
@@ -357,24 +357,39 @@ var init_runtime = __esm({
357
357
  }
358
358
  });
359
359
 
360
- // src/dmv2/typedBase.ts
361
- function getInstantiationFileInfo(stack) {
360
+ // src/dmv2/utils/stackTrace.ts
361
+ function shouldSkipStackLine(line) {
362
+ return line.includes("node_modules") || // Skip npm installed packages (prod)
363
+ line.includes("internal/modules") || // Skip Node.js internals
364
+ line.includes("ts-node") || // Skip TypeScript execution
365
+ line.includes("/ts-moose-lib/") || // Skip dev/linked moose-lib (Unix)
366
+ line.includes("\\ts-moose-lib\\");
367
+ }
368
+ function parseStackLine(line) {
369
+ const match = line.match(/\((.*):(\d+):(\d+)\)/) || line.match(/at (.*):(\d+):(\d+)/);
370
+ if (match && match[1]) {
371
+ return {
372
+ file: match[1],
373
+ line: match[2]
374
+ };
375
+ }
376
+ return void 0;
377
+ }
378
+ function getSourceFileInfo(stack) {
362
379
  if (!stack) return {};
363
380
  const lines = stack.split("\n");
364
381
  for (const line of lines) {
365
- if (line.includes("node_modules") || line.includes("internal/modules") || line.includes("ts-node"))
366
- continue;
367
- const match = line.match(/\((.*):(\d+):(\d+)\)/) || line.match(/at (.*):(\d+):(\d+)/);
368
- if (match && match[1]) {
369
- return {
370
- file: match[1],
371
- line: match[2]
372
- // Only the line number
373
- };
374
- }
382
+ if (shouldSkipStackLine(line)) continue;
383
+ const info = parseStackLine(line);
384
+ if (info) return info;
375
385
  }
376
386
  return {};
377
387
  }
388
+ function getSourceFileFromStack(stack) {
389
+ return getSourceFileInfo(stack).file;
390
+ }
391
+
392
+ // src/dmv2/typedBase.ts
378
393
  var TypedBase = class {
379
394
  /** The JSON schema representation of type T. Injected by the compiler plugin. */
380
395
  schema;
@@ -418,7 +433,7 @@ var TypedBase = class {
418
433
  this.metadata = config?.metadata ? { ...config.metadata } : {};
419
434
  const stack = new Error().stack;
420
435
  if (stack) {
421
- const info = getInstantiationFileInfo(stack);
436
+ const info = getSourceFileInfo(stack);
422
437
  this.metadata.source = { file: info.file, line: info.line };
423
438
  } else {
424
439
  this.metadata.source = void 0;
@@ -1668,8 +1683,10 @@ var Stream = class extends TypedBase {
1668
1683
  * @param config Optional configuration for this specific transformation step, like a version.
1669
1684
  */
1670
1685
  addTransform(destination, transformation, config) {
1686
+ const sourceFile = getSourceFileFromStack(new Error().stack);
1671
1687
  const transformConfig = {
1672
- ...config ?? {}
1688
+ ...config ?? {},
1689
+ sourceFile
1673
1690
  };
1674
1691
  if (transformConfig.deadLetterQueue === void 0) {
1675
1692
  transformConfig.deadLetterQueue = this.defaultDeadLetterQueue;
@@ -1696,8 +1713,10 @@ var Stream = class extends TypedBase {
1696
1713
  * @param config Optional configuration for this specific consumer, like a version.
1697
1714
  */
1698
1715
  addConsumer(consumer, config) {
1716
+ const sourceFile = getSourceFileFromStack(new Error().stack);
1699
1717
  const consumerConfig = {
1700
- ...config ?? {}
1718
+ ...config ?? {},
1719
+ sourceFile
1701
1720
  };
1702
1721
  if (consumerConfig.deadLetterQueue === void 0) {
1703
1722
  consumerConfig.deadLetterQueue = this.defaultDeadLetterQueue;
@@ -2284,6 +2303,8 @@ var SqlResource = class {
2284
2303
  pullsDataFrom;
2285
2304
  /** List of OlapTables or Views that this resource writes data to. */
2286
2305
  pushesDataTo;
2306
+ /** @internal Source file path where this resource was defined */
2307
+ sourceFile;
2287
2308
  /**
2288
2309
  * Creates a new SqlResource instance.
2289
2310
  * @param name The name of the resource.
@@ -2308,6 +2329,8 @@ var SqlResource = class {
2308
2329
  );
2309
2330
  this.pullsDataFrom = options?.pullsDataFrom ?? [];
2310
2331
  this.pushesDataTo = options?.pushesDataTo ?? [];
2332
+ const stack = new Error().stack;
2333
+ this.sourceFile = getSourceFileFromStack(stack);
2311
2334
  }
2312
2335
  };
2313
2336