@mastra/observability 1.2.0-alpha.0 → 1.2.0

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.js CHANGED
@@ -4,7 +4,7 @@ import { ConsoleLogger, LogLevel, RegisteredLogger } from '@mastra/core/logger';
4
4
  import { TracingEventType, SpanType, InternalSpans } from '@mastra/core/observability';
5
5
  import { fetchWithRetry, getNestedValue, setNestedValue } from '@mastra/core/utils';
6
6
  import { writeFile, readFile } from 'fs/promises';
7
- import { dirname, join } from 'path';
7
+ import { join, dirname } from 'path';
8
8
  import { fileURLToPath } from 'url';
9
9
  import { TransformStream } from 'stream/web';
10
10
 
@@ -6066,9 +6066,20 @@ var TestExporter = class extends BaseExporter {
6066
6066
  this.logger.info("TestExporter shutdown");
6067
6067
  }
6068
6068
  };
6069
- var __filename$1 = fileURLToPath(import.meta.url);
6070
- var __dirname$1 = dirname(__filename$1);
6071
- var SNAPSHOTS_DIR = join(__dirname$1, "..", "__snapshots__");
6069
+ var _snapshotsDir;
6070
+ function getSnapshotsDir() {
6071
+ if (!_snapshotsDir) {
6072
+ if (typeof import.meta.url !== "string") {
6073
+ throw new Error(
6074
+ "Snapshot functionality requires a Node.js environment. import.meta.url is not available in this runtime."
6075
+ );
6076
+ }
6077
+ const __filename = fileURLToPath(import.meta.url);
6078
+ const __dirname = dirname(__filename);
6079
+ _snapshotsDir = join(__dirname, "..", "__snapshots__");
6080
+ }
6081
+ return _snapshotsDir;
6082
+ }
6072
6083
  var JsonExporter = class extends BaseExporter {
6073
6084
  name = "json-exporter";
6074
6085
  /** All collected events */
@@ -6593,7 +6604,7 @@ var JsonExporter = class extends BaseExporter {
6593
6604
  * @throws Error if the snapshot doesn't match (and updateSnapshot is false)
6594
6605
  */
6595
6606
  async assertMatchesSnapshot(snapshotName, options) {
6596
- const snapshotPath = join(SNAPSHOTS_DIR, snapshotName);
6607
+ const snapshotPath = join(getSnapshotsDir(), snapshotName);
6597
6608
  const normalizedTree = this.buildNormalizedTree();
6598
6609
  const structureGraph = this.generateStructureGraph(normalizedTree);
6599
6610
  const currentData = {