@mastra/deployer 0.10.3 → 0.10.4-alpha.1

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.
@@ -1,17 +1,61 @@
1
+ import { getNodeAutoInstrumentations } from '@opentelemetry/auto-instrumentations-node';
2
+ import { ExportResultCode } from '@opentelemetry/core';
3
+ import { OTLPTraceExporter as OTLPGrpcExporter } from '@opentelemetry/exporter-trace-otlp-grpc';
4
+ import { OTLPTraceExporter as OTLPHttpExporter } from '@opentelemetry/exporter-trace-otlp-http';
5
+ import { resourceFromAttributes } from '@opentelemetry/resources';
6
+ import { NodeSDK } from '@opentelemetry/sdk-node';
1
7
  import {
2
- NodeSDK,
3
- getNodeAutoInstrumentations,
4
- ATTR_SERVICE_NAME,
5
8
  ParentBasedSampler,
6
9
  TraceIdRatioBasedSampler,
7
10
  AlwaysOnSampler,
8
11
  AlwaysOffSampler,
9
- OTLPHttpExporter,
10
- OTLPGrpcExporter,
11
- CompositeExporter,
12
- resourceFromAttributes,
13
- } from '@mastra/core/telemetry/otel-vendor';
12
+ } from '@opentelemetry/sdk-trace-base';
13
+ import { ATTR_SERVICE_NAME } from '@opentelemetry/semantic-conventions';
14
14
  import { telemetry } from './telemetry-config.mjs';
15
+ class CompositeExporter {
16
+ constructor(exporters) {
17
+ this.exporters = exporters;
18
+ }
19
+ export(spans, resultCallback) {
20
+ const telemetryTraceIds = new Set(
21
+ spans.filter((span) => {
22
+ const attrs = span.attributes || {};
23
+ const httpTarget = attrs["http.target"];
24
+ return httpTarget === "/api/telemetry";
25
+ }).map((span) => span.spanContext().traceId)
26
+ );
27
+ const filteredSpans = spans.filter((span) => !telemetryTraceIds.has(span.spanContext().traceId));
28
+ if (filteredSpans.length === 0) {
29
+ resultCallback({ code: ExportResultCode.SUCCESS });
30
+ return;
31
+ }
32
+ void Promise.all(
33
+ this.exporters.map(
34
+ (exporter) => new Promise((resolve) => {
35
+ if (exporter.export) {
36
+ exporter.export(filteredSpans, resolve);
37
+ } else {
38
+ resolve({ code: ExportResultCode.FAILED });
39
+ }
40
+ })
41
+ )
42
+ ).then((results) => {
43
+ const hasError = results.some((r) => r.code === ExportResultCode.FAILED);
44
+ resultCallback({
45
+ code: hasError ? ExportResultCode.FAILED : ExportResultCode.SUCCESS
46
+ });
47
+ }).catch((error) => {
48
+ console.error("[CompositeExporter] Export error:", error);
49
+ resultCallback({ code: ExportResultCode.FAILED, error });
50
+ });
51
+ }
52
+ shutdown() {
53
+ return Promise.all(this.exporters.map((e) => e.shutdown?.() ?? Promise.resolve())).then(() => void 0);
54
+ }
55
+ forceFlush() {
56
+ return Promise.all(this.exporters.map((e) => e.forceFlush?.() ?? Promise.resolve())).then(() => void 0);
57
+ }
58
+ };
15
59
 
16
60
  function getSampler(config) {
17
61
  if (!config.sampling) {
@@ -1,7 +1,7 @@
1
- import { readFile } from 'node:fs/promises';
2
- import { builtinModules } from 'node:module';
3
- import { join } from 'node:path';
4
- import { pathToFileURL } from 'node:url';
1
+ import { readFile } from 'fs/promises';
2
+ import { builtinModules } from 'module';
3
+ import { join } from 'path';
4
+ import { pathToFileURL } from 'url';
5
5
 
6
6
  // src/validator/custom-resolver.ts
7
7
  var cache = /* @__PURE__ */ new Map();
@@ -1,4 +1,4 @@
1
- import { register } from 'node:module';
1
+ import { register } from 'module';
2
2
 
3
3
  // src/validator/loader.ts
4
4
  register("./custom-resolver.js", import.meta.url);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/deployer",
3
- "version": "0.10.3",
3
+ "version": "0.10.4-alpha.1",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "files": [
@@ -85,57 +85,57 @@
85
85
  "author": "",
86
86
  "license": "Elastic-2.0",
87
87
  "dependencies": {
88
- "@babel/core": "^7.26.10",
89
- "@babel/helper-module-imports": "^7.25.9",
88
+ "@babel/core": "^7.27.4",
89
+ "@babel/helper-module-imports": "^7.27.1",
90
90
  "@neon-rs/load": "^0.1.82",
91
91
  "@rollup/plugin-alias": "^5.1.1",
92
92
  "@rollup/plugin-commonjs": "^28.0.3",
93
93
  "@rollup/plugin-json": "^6.1.0",
94
- "@rollup/plugin-node-resolve": "^16.0.0",
94
+ "@rollup/plugin-node-resolve": "^16.0.1",
95
95
  "@rollup/plugin-virtual": "^3.0.2",
96
96
  "@sindresorhus/slugify": "^2.2.1",
97
97
  "builtins": "^5.1.0",
98
98
  "detect-libc": "^2.0.3",
99
- "dotenv": "^16.4.7",
99
+ "dotenv": "^16.5.0",
100
100
  "esbuild": "^0.25.1",
101
101
  "find-workspaces": "^0.3.1",
102
102
  "fs-extra": "^11.3.0",
103
103
  "globby": "^14.1.0",
104
- "hono": "^4.7.4",
104
+ "hono": "^4.7.11",
105
105
  "resolve-from": "^5.0.0",
106
- "rollup": "^4.35.0",
106
+ "rollup": "^4.41.1",
107
107
  "rollup-plugin-esbuild": "^6.2.1",
108
108
  "rollup-plugin-node-externals": "^8.0.0",
109
109
  "typescript-paths": "^1.5.1",
110
- "zod": "^3.24.3",
111
- "@mastra/server": "^0.10.3"
110
+ "zod": "^3.25.56",
111
+ "@mastra/server": "^0.10.4-alpha.1"
112
112
  },
113
113
  "devDependencies": {
114
- "@hono/node-server": "^1.13.8",
114
+ "@hono/node-server": "^1.14.3",
115
115
  "@hono/swagger-ui": "^0.5.1",
116
- "@microsoft/api-extractor": "^7.52.5",
116
+ "@microsoft/api-extractor": "^7.52.8",
117
117
  "@types/babel__core": "^7.20.5",
118
118
  "@types/babel__helper-module-imports": "^7.18.3",
119
119
  "@types/fs-extra": "^11.0.4",
120
- "@types/node": "^20.17.27",
121
- "eslint": "^9.23.0",
120
+ "@types/node": "^20.17.57",
121
+ "eslint": "^9.28.0",
122
122
  "fetch-to-node": "^2.1.0",
123
- "hono-openapi": "^0.4.6",
123
+ "hono-openapi": "^0.4.8",
124
124
  "rollup-plugin-visualizer": "^5.14.0",
125
125
  "superjson": "^2.2.2",
126
- "tsup": "^8.4.0",
127
- "type-fest": "^4.37.0",
126
+ "tsup": "^8.5.0",
127
+ "type-fest": "^4.41.0",
128
128
  "typescript": "^5.8.2",
129
129
  "vitest": "^2.1.9",
130
- "@internal/lint": "0.0.10",
131
- "@mastra/core": "0.10.3",
132
- "@mastra/mcp": "^0.10.2"
130
+ "@mastra/core": "0.10.4-alpha.1",
131
+ "@mastra/mcp": "^0.10.3-alpha.0",
132
+ "@internal/lint": "0.0.10"
133
133
  },
134
134
  "peerDependencies": {
135
135
  "@mastra/core": "^0.10.2-alpha.0"
136
136
  },
137
137
  "scripts": {
138
- "build": "tsup src/index.ts src/build/index.ts src/server/index.ts src/build/bundler.ts src/build/analyze.ts src/bundler/index.ts src/services/index.ts src/validator/loader.ts src/validator/custom-resolver.ts --format esm,cjs --clean --experimental-dts --treeshake=smallest --splitting --publicDir",
138
+ "build": "tsup src/index.ts src/build/index.ts src/server/index.ts src/build/bundler.ts src/build/analyze.ts src/bundler/index.ts src/services/index.ts src/validator/loader.ts src/validator/custom-resolver.ts src/instrumentation-template.ts --format esm,cjs --clean --experimental-dts --treeshake=smallest --splitting --publicDir",
139
139
  "build:watch": "pnpm build --watch",
140
140
  "pull:openapispec": "node src/server/openapi.script.js",
141
141
  "test": "vitest run",