@mastra/deployer 0.10.12-alpha.1 → 0.10.13
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/package.json +6 -6
- package/dist/_tsup-dts-rollup.d.cts +0 -836
- package/dist/_tsup-dts-rollup.d.ts +0 -836
- package/dist/build/analyze.cjs +0 -10
- package/dist/build/analyze.d.cts +0 -1
- package/dist/build/analyze.d.ts +0 -1
- package/dist/build/analyze.js +0 -1
- package/dist/build/bundler.cjs +0 -14
- package/dist/build/bundler.d.cts +0 -2
- package/dist/build/bundler.d.ts +0 -2
- package/dist/build/bundler.js +0 -1
- package/dist/build/index.cjs +0 -50
- package/dist/build/index.d.cts +0 -10
- package/dist/build/index.d.ts +0 -10
- package/dist/build/index.js +0 -5
- package/dist/bundler/index.cjs +0 -10
- package/dist/bundler/index.d.cts +0 -1
- package/dist/bundler/index.d.ts +0 -1
- package/dist/bundler/index.js +0 -1
- package/dist/chunk-2C7ENC5E.js +0 -474
- package/dist/chunk-54KOF3NB.cjs +0 -137
- package/dist/chunk-6QMONK4A.cjs +0 -2
- package/dist/chunk-C4JT7CIH.js +0 -1
- package/dist/chunk-D2DCFCLH.cjs +0 -157
- package/dist/chunk-D6736SJL.js +0 -209
- package/dist/chunk-ENT5RDOI.js +0 -99
- package/dist/chunk-FK2WUSEN.cjs +0 -238
- package/dist/chunk-GPD54HBC.js +0 -380
- package/dist/chunk-KCP5ITLV.cjs +0 -412
- package/dist/chunk-M2VZQFTW.cjs +0 -125
- package/dist/chunk-MKB7NDY3.cjs +0 -486
- package/dist/chunk-TIC2KT3M.js +0 -146
- package/dist/chunk-UYQZMNZL.js +0 -572
- package/dist/chunk-XKH6F4NE.cjs +0 -604
- package/dist/chunk-Z544XXXK.js +0 -111
- package/dist/index.cjs +0 -194
- package/dist/index.d.cts +0 -8
- package/dist/index.d.ts +0 -8
- package/dist/index.js +0 -153
- package/dist/server/index.cjs +0 -8326
- package/dist/server/index.d.cts +0 -2
- package/dist/server/index.d.ts +0 -2
- package/dist/server/index.js +0 -8318
- package/dist/services/index.cjs +0 -18
- package/dist/services/index.d.cts +0 -3
- package/dist/services/index.d.ts +0 -3
- package/dist/services/index.js +0 -1
- package/dist/templates/instrumentation-template.js +0 -137
- package/dist/validator/custom-resolver.cjs +0 -52
- package/dist/validator/custom-resolver.d.cts +0 -1
- package/dist/validator/custom-resolver.d.ts +0 -1
- package/dist/validator/custom-resolver.js +0 -50
- package/dist/validator/loader.cjs +0 -7
- package/dist/validator/loader.d.cts +0 -1
- package/dist/validator/loader.d.ts +0 -1
- package/dist/validator/loader.js +0 -4
package/dist/services/index.cjs
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunkKCP5ITLV_cjs = require('../chunk-KCP5ITLV.cjs');
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(exports, "DepsService", {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: function () { return chunkKCP5ITLV_cjs.DepsService; }
|
|
10
|
-
});
|
|
11
|
-
Object.defineProperty(exports, "EnvService", {
|
|
12
|
-
enumerable: true,
|
|
13
|
-
get: function () { return chunkKCP5ITLV_cjs.EnvService; }
|
|
14
|
-
});
|
|
15
|
-
Object.defineProperty(exports, "FileService", {
|
|
16
|
-
enumerable: true,
|
|
17
|
-
get: function () { return chunkKCP5ITLV_cjs.FileService; }
|
|
18
|
-
});
|
package/dist/services/index.d.ts
DELETED
package/dist/services/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { DepsService, EnvService, FileService } from '../chunk-GPD54HBC.js';
|
|
@@ -1,137 +0,0 @@
|
|
|
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';
|
|
7
|
-
import {
|
|
8
|
-
ParentBasedSampler,
|
|
9
|
-
TraceIdRatioBasedSampler,
|
|
10
|
-
AlwaysOnSampler,
|
|
11
|
-
AlwaysOffSampler,
|
|
12
|
-
} from '@opentelemetry/sdk-trace-base';
|
|
13
|
-
import { ATTR_SERVICE_NAME } from '@opentelemetry/semantic-conventions';
|
|
14
|
-
import { telemetry } from './telemetry-config.mjs';
|
|
15
|
-
|
|
16
|
-
class CompositeExporter {
|
|
17
|
-
constructor(exporters) {
|
|
18
|
-
this.exporters = exporters;
|
|
19
|
-
}
|
|
20
|
-
export(spans, resultCallback) {
|
|
21
|
-
const telemetryTraceIds = new Set(
|
|
22
|
-
spans.filter((span) => {
|
|
23
|
-
const attrs = span.attributes || {};
|
|
24
|
-
const httpTarget = attrs["http.target"];
|
|
25
|
-
return httpTarget === "/api/telemetry";
|
|
26
|
-
}).map((span) => span.spanContext().traceId)
|
|
27
|
-
);
|
|
28
|
-
const filteredSpans = spans.filter((span) => !telemetryTraceIds.has(span.spanContext().traceId));
|
|
29
|
-
if (filteredSpans.length === 0) {
|
|
30
|
-
resultCallback({ code: ExportResultCode.SUCCESS });
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
void Promise.all(
|
|
34
|
-
this.exporters.map(
|
|
35
|
-
(exporter) => new Promise((resolve) => {
|
|
36
|
-
if (exporter.export) {
|
|
37
|
-
exporter.export(filteredSpans, resolve);
|
|
38
|
-
} else {
|
|
39
|
-
resolve({ code: ExportResultCode.FAILED });
|
|
40
|
-
}
|
|
41
|
-
})
|
|
42
|
-
)
|
|
43
|
-
).then((results) => {
|
|
44
|
-
const hasError = results.some((r) => r.code === ExportResultCode.FAILED);
|
|
45
|
-
resultCallback({
|
|
46
|
-
code: hasError ? ExportResultCode.FAILED : ExportResultCode.SUCCESS
|
|
47
|
-
});
|
|
48
|
-
}).catch((error) => {
|
|
49
|
-
console.error("[CompositeExporter] Export error:", error);
|
|
50
|
-
resultCallback({ code: ExportResultCode.FAILED, error });
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
shutdown() {
|
|
54
|
-
return Promise.all(this.exporters.map((e) => e.shutdown?.() ?? Promise.resolve())).then(() => void 0);
|
|
55
|
-
}
|
|
56
|
-
forceFlush() {
|
|
57
|
-
return Promise.all(this.exporters.map((e) => e.forceFlush?.() ?? Promise.resolve())).then(() => void 0);
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
function getSampler(config) {
|
|
62
|
-
if (!config.sampling) {
|
|
63
|
-
return new AlwaysOnSampler();
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
if (!config.enabled) {
|
|
67
|
-
return new AlwaysOffSampler();
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
switch (config.sampling.type) {
|
|
71
|
-
case 'ratio':
|
|
72
|
-
return new TraceIdRatioBasedSampler(config.sampling.probability);
|
|
73
|
-
case 'always_on':
|
|
74
|
-
return new AlwaysOnSampler();
|
|
75
|
-
case 'always_off':
|
|
76
|
-
return new AlwaysOffSampler();
|
|
77
|
-
case 'parent_based':
|
|
78
|
-
const rootSampler = new TraceIdRatioBasedSampler(config.sampling.root?.probability || 1.0);
|
|
79
|
-
return new ParentBasedSampler({ root: rootSampler });
|
|
80
|
-
default:
|
|
81
|
-
return new AlwaysOnSampler();
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
async function getExporters(config) {
|
|
86
|
-
const exporters = [];
|
|
87
|
-
|
|
88
|
-
// Add local exporter by default
|
|
89
|
-
if (!config.disableLocalExport) {
|
|
90
|
-
exporters.push(new OTLPHttpExporter({
|
|
91
|
-
url: `http://localhost:${process.env.PORT ?? 4111}/api/telemetry`,
|
|
92
|
-
headers: process.env.MASTRA_DEV ? {
|
|
93
|
-
'x-mastra-dev-playground': 'true',
|
|
94
|
-
} : {},
|
|
95
|
-
}));
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
if (config.export?.type === 'otlp') {
|
|
99
|
-
if (config.export?.protocol === 'grpc') {
|
|
100
|
-
exporters.push(new OTLPGrpcExporter({
|
|
101
|
-
url: config.export.endpoint,
|
|
102
|
-
headers: config.export.headers,
|
|
103
|
-
}));
|
|
104
|
-
} else {
|
|
105
|
-
exporters.push(new OTLPHttpExporter({
|
|
106
|
-
url: config.export.endpoint,
|
|
107
|
-
headers: config.export.headers,
|
|
108
|
-
}));
|
|
109
|
-
}
|
|
110
|
-
} else if (config.export?.type === 'custom') {
|
|
111
|
-
exporters.push(config.export.exporter);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
return exporters
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
const sampler = getSampler(telemetry);
|
|
118
|
-
const exporters = await getExporters(telemetry);
|
|
119
|
-
const compositeExporter = new CompositeExporter(exporters);
|
|
120
|
-
|
|
121
|
-
const sdk = new NodeSDK({
|
|
122
|
-
resource: resourceFromAttributes({
|
|
123
|
-
[ATTR_SERVICE_NAME]: telemetry.serviceName || 'default-service',
|
|
124
|
-
}),
|
|
125
|
-
sampler,
|
|
126
|
-
traceExporter: compositeExporter,
|
|
127
|
-
instrumentations: [getNodeAutoInstrumentations()],
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
sdk.start();
|
|
131
|
-
|
|
132
|
-
// gracefully shut down the SDK on process exit
|
|
133
|
-
process.on('SIGTERM', () => {
|
|
134
|
-
sdk.shutdown().catch(() => {
|
|
135
|
-
// do nothing
|
|
136
|
-
});
|
|
137
|
-
});
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var promises = require('fs/promises');
|
|
4
|
-
var module$1 = require('module');
|
|
5
|
-
var path = require('path');
|
|
6
|
-
var url = require('url');
|
|
7
|
-
|
|
8
|
-
// src/validator/custom-resolver.ts
|
|
9
|
-
var cache = /* @__PURE__ */ new Map();
|
|
10
|
-
function isBuiltinModule(specifier) {
|
|
11
|
-
return module$1.builtinModules.includes(specifier) || specifier.startsWith("node:") || module$1.builtinModules.includes(specifier.replace(/^node:/, ""));
|
|
12
|
-
}
|
|
13
|
-
function isRelativePath(specifier) {
|
|
14
|
-
return specifier.startsWith("./") || specifier.startsWith("../") || specifier.startsWith("/") || /^[a-zA-Z]:\\/.test(specifier);
|
|
15
|
-
}
|
|
16
|
-
async function getParentPath(specifier, url$1) {
|
|
17
|
-
if (!cache.size) {
|
|
18
|
-
const moduleResolveMap = JSON.parse(
|
|
19
|
-
// cwd refers to the output/build directory
|
|
20
|
-
await promises.readFile(path.join(process.cwd(), "module-resolve-map.json"), "utf-8")
|
|
21
|
-
);
|
|
22
|
-
for (const [id, rest] of Object.entries(moduleResolveMap)) {
|
|
23
|
-
cache.set(url.pathToFileURL(id).toString(), rest);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
const importers = cache.get(url$1);
|
|
27
|
-
if (!importers || !importers[specifier]) {
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
30
|
-
const specifierParent = importers[specifier];
|
|
31
|
-
return url.pathToFileURL(specifierParent).toString();
|
|
32
|
-
}
|
|
33
|
-
async function resolve(specifier, context, nextResolve) {
|
|
34
|
-
if (isBuiltinModule(specifier)) {
|
|
35
|
-
return nextResolve(specifier, context);
|
|
36
|
-
}
|
|
37
|
-
if (isRelativePath(specifier)) {
|
|
38
|
-
return nextResolve(specifier, context);
|
|
39
|
-
}
|
|
40
|
-
if (context.parentURL) {
|
|
41
|
-
const parentPath = await getParentPath(specifier, context.parentURL);
|
|
42
|
-
if (parentPath) {
|
|
43
|
-
return nextResolve(specifier, {
|
|
44
|
-
...context,
|
|
45
|
-
parentURL: parentPath
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
return nextResolve(specifier, context);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
exports.resolve = resolve;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { resolve } from '../_tsup-dts-rollup.cjs';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { resolve } from '../_tsup-dts-rollup.js';
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { readFile } from 'fs/promises';
|
|
2
|
-
import { builtinModules } from 'module';
|
|
3
|
-
import { join } from 'path';
|
|
4
|
-
import { pathToFileURL } from 'url';
|
|
5
|
-
|
|
6
|
-
// src/validator/custom-resolver.ts
|
|
7
|
-
var cache = /* @__PURE__ */ new Map();
|
|
8
|
-
function isBuiltinModule(specifier) {
|
|
9
|
-
return builtinModules.includes(specifier) || specifier.startsWith("node:") || builtinModules.includes(specifier.replace(/^node:/, ""));
|
|
10
|
-
}
|
|
11
|
-
function isRelativePath(specifier) {
|
|
12
|
-
return specifier.startsWith("./") || specifier.startsWith("../") || specifier.startsWith("/") || /^[a-zA-Z]:\\/.test(specifier);
|
|
13
|
-
}
|
|
14
|
-
async function getParentPath(specifier, url) {
|
|
15
|
-
if (!cache.size) {
|
|
16
|
-
const moduleResolveMap = JSON.parse(
|
|
17
|
-
// cwd refers to the output/build directory
|
|
18
|
-
await readFile(join(process.cwd(), "module-resolve-map.json"), "utf-8")
|
|
19
|
-
);
|
|
20
|
-
for (const [id, rest] of Object.entries(moduleResolveMap)) {
|
|
21
|
-
cache.set(pathToFileURL(id).toString(), rest);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
const importers = cache.get(url);
|
|
25
|
-
if (!importers || !importers[specifier]) {
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
const specifierParent = importers[specifier];
|
|
29
|
-
return pathToFileURL(specifierParent).toString();
|
|
30
|
-
}
|
|
31
|
-
async function resolve(specifier, context, nextResolve) {
|
|
32
|
-
if (isBuiltinModule(specifier)) {
|
|
33
|
-
return nextResolve(specifier, context);
|
|
34
|
-
}
|
|
35
|
-
if (isRelativePath(specifier)) {
|
|
36
|
-
return nextResolve(specifier, context);
|
|
37
|
-
}
|
|
38
|
-
if (context.parentURL) {
|
|
39
|
-
const parentPath = await getParentPath(specifier, context.parentURL);
|
|
40
|
-
if (parentPath) {
|
|
41
|
-
return nextResolve(specifier, {
|
|
42
|
-
...context,
|
|
43
|
-
parentURL: parentPath
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return nextResolve(specifier, context);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export { resolve };
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var module$1 = require('module');
|
|
4
|
-
|
|
5
|
-
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
6
|
-
// src/validator/loader.ts
|
|
7
|
-
module$1.register("./custom-resolver.js", (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('loader.cjs', document.baseURI).href)));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/validator/loader.js
DELETED