@mastra/deployer 0.0.0-a2a-20250421213654
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/LICENSE.md +46 -0
- package/README.md +159 -0
- package/dist/_tsup-dts-rollup.d.cts +548 -0
- package/dist/_tsup-dts-rollup.d.ts +548 -0
- package/dist/build/analyze.cjs +10 -0
- package/dist/build/analyze.d.cts +1 -0
- package/dist/build/analyze.d.ts +1 -0
- package/dist/build/analyze.js +1 -0
- package/dist/build/bundler.cjs +14 -0
- package/dist/build/bundler.d.cts +2 -0
- package/dist/build/bundler.d.ts +2 -0
- package/dist/build/bundler.js +1 -0
- package/dist/build/index.cjs +46 -0
- package/dist/build/index.d.cts +9 -0
- package/dist/build/index.d.ts +9 -0
- package/dist/build/index.js +5 -0
- package/dist/bundler/index.cjs +10 -0
- package/dist/bundler/index.d.cts +1 -0
- package/dist/bundler/index.d.ts +1 -0
- package/dist/bundler/index.js +1 -0
- package/dist/chunk-2ZPQX6BX.cjs +254 -0
- package/dist/chunk-4AYFLP6G.js +227 -0
- package/dist/chunk-4VC5Z4YR.cjs +391 -0
- package/dist/chunk-54KOF3NB.cjs +137 -0
- package/dist/chunk-5QD7CDGY.js +306 -0
- package/dist/chunk-6QMONK4A.cjs +2 -0
- package/dist/chunk-AOSWYZKN.js +138 -0
- package/dist/chunk-C4JT7CIH.js +1 -0
- package/dist/chunk-IMGVLBV7.cjs +149 -0
- package/dist/chunk-KTYDROLB.js +136 -0
- package/dist/chunk-LA6Y6GAB.cjs +312 -0
- package/dist/chunk-Q6OKTZNC.cjs +316 -0
- package/dist/chunk-USZDOFES.js +301 -0
- package/dist/chunk-UV4RQQ3R.js +359 -0
- package/dist/chunk-WVBUOQT6.js +111 -0
- package/dist/chunk-Z7KAM3CZ.cjs +164 -0
- package/dist/index.cjs +190 -0
- package/dist/index.d.cts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +149 -0
- package/dist/server/index.cjs +3952 -0
- package/dist/server/index.d.cts +2 -0
- package/dist/server/index.d.ts +2 -0
- package/dist/server/index.js +3944 -0
- package/dist/services/index.cjs +18 -0
- package/dist/services/index.d.cts +3 -0
- package/dist/services/index.d.ts +3 -0
- package/dist/services/index.js +1 -0
- package/dist/templates/instrumentation-template.js +89 -0
- package/dist/validator/custom-resolver.cjs +52 -0
- package/dist/validator/custom-resolver.d.cts +1 -0
- package/dist/validator/custom-resolver.d.ts +1 -0
- package/dist/validator/custom-resolver.js +50 -0
- package/dist/validator/loader.cjs +7 -0
- package/dist/validator/loader.d.cts +1 -0
- package/dist/validator/loader.d.ts +1 -0
- package/dist/validator/loader.js +4 -0
- package/package.json +140 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunk4VC5Z4YR_cjs = require('../chunk-4VC5Z4YR.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "DepsService", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () { return chunk4VC5Z4YR_cjs.DepsService; }
|
|
10
|
+
});
|
|
11
|
+
Object.defineProperty(exports, "EnvService", {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function () { return chunk4VC5Z4YR_cjs.EnvService; }
|
|
14
|
+
});
|
|
15
|
+
Object.defineProperty(exports, "FileService", {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () { return chunk4VC5Z4YR_cjs.FileService; }
|
|
18
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DepsService, EnvService, FileService } from '../chunk-UV4RQQ3R.js';
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import {
|
|
2
|
+
NodeSDK,
|
|
3
|
+
getNodeAutoInstrumentations,
|
|
4
|
+
ATTR_SERVICE_NAME,
|
|
5
|
+
Resource,
|
|
6
|
+
ParentBasedSampler,
|
|
7
|
+
TraceIdRatioBasedSampler,
|
|
8
|
+
AlwaysOnSampler,
|
|
9
|
+
AlwaysOffSampler,
|
|
10
|
+
OTLPHttpExporter,
|
|
11
|
+
OTLPGrpcExporter,
|
|
12
|
+
CompositeExporter,
|
|
13
|
+
} from '@mastra/core/telemetry/otel-vendor';
|
|
14
|
+
import { telemetry } from './telemetry-config.mjs';
|
|
15
|
+
|
|
16
|
+
function getSampler(config) {
|
|
17
|
+
if (!config.sampling) {
|
|
18
|
+
return new AlwaysOnSampler();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (!config.enabled) {
|
|
22
|
+
return new AlwaysOffSampler();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
switch (config.sampling.type) {
|
|
26
|
+
case 'ratio':
|
|
27
|
+
return new TraceIdRatioBasedSampler(config.sampling.probability);
|
|
28
|
+
case 'always_on':
|
|
29
|
+
return new AlwaysOnSampler();
|
|
30
|
+
case 'always_off':
|
|
31
|
+
return new AlwaysOffSampler();
|
|
32
|
+
case 'parent_based':
|
|
33
|
+
const rootSampler = new TraceIdRatioBasedSampler(config.sampling.root?.probability || 1.0);
|
|
34
|
+
return new ParentBasedSampler({ root: rootSampler });
|
|
35
|
+
default:
|
|
36
|
+
return new AlwaysOnSampler();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async function getExporters(config) {
|
|
41
|
+
const exporters = [];
|
|
42
|
+
|
|
43
|
+
// Add local exporter by default
|
|
44
|
+
if (!config.disableLocalExport) {
|
|
45
|
+
exporters.push(new OTLPHttpExporter({
|
|
46
|
+
url: `http://localhost:${process.env.PORT ?? 4111}/api/telemetry`,
|
|
47
|
+
}));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (config.export?.type === 'otlp') {
|
|
51
|
+
if (config.export?.protocol === 'grpc') {
|
|
52
|
+
exporters.push(new OTLPGrpcExporter({
|
|
53
|
+
url: config.export.endpoint,
|
|
54
|
+
headers: config.export.headers,
|
|
55
|
+
}));
|
|
56
|
+
} else {
|
|
57
|
+
exporters.push(new OTLPHttpExporter({
|
|
58
|
+
url: config.export.endpoint,
|
|
59
|
+
headers: config.export.headers,
|
|
60
|
+
}));
|
|
61
|
+
}
|
|
62
|
+
} else if (config.export?.type === 'custom') {
|
|
63
|
+
exporters.push(config.export.exporter);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return exporters
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const sampler = getSampler(telemetry);
|
|
70
|
+
const exporters = await getExporters(telemetry);
|
|
71
|
+
const compositeExporter = new CompositeExporter(exporters);
|
|
72
|
+
|
|
73
|
+
const sdk = new NodeSDK({
|
|
74
|
+
resource: new Resource({
|
|
75
|
+
[ATTR_SERVICE_NAME]: telemetry.serviceName || 'default-service',
|
|
76
|
+
}),
|
|
77
|
+
sampler,
|
|
78
|
+
traceExporter: compositeExporter,
|
|
79
|
+
instrumentations: [getNodeAutoInstrumentations()],
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
sdk.start();
|
|
83
|
+
|
|
84
|
+
// gracefully shut down the SDK on process exit
|
|
85
|
+
process.on('SIGTERM', () => {
|
|
86
|
+
sdk.shutdown().catch(() => {
|
|
87
|
+
// do nothing
|
|
88
|
+
});
|
|
89
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { resolve } from '../_tsup-dts-rollup.cjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { resolve } from '../_tsup-dts-rollup.js';
|
|
@@ -0,0 +1,50 @@
|
|
|
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';
|
|
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 };
|
|
@@ -0,0 +1,7 @@
|
|
|
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)));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mastra/deployer",
|
|
3
|
+
"version": "0.0.0-a2a-20250421213654",
|
|
4
|
+
"description": "",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist"
|
|
8
|
+
],
|
|
9
|
+
"main": "dist/index.js",
|
|
10
|
+
"types": "dist/index.d.ts",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"import": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"default": "./dist/index.js"
|
|
16
|
+
},
|
|
17
|
+
"require": {
|
|
18
|
+
"types": "./dist/index.d.cts",
|
|
19
|
+
"default": "./dist/index.cjs"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"./server": {
|
|
23
|
+
"import": {
|
|
24
|
+
"types": "./dist/server/index.d.ts",
|
|
25
|
+
"default": "./dist/server/index.js"
|
|
26
|
+
},
|
|
27
|
+
"require": {
|
|
28
|
+
"types": "./dist/server/index.d.cts",
|
|
29
|
+
"default": "./dist/server/index.cjs"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"./services": {
|
|
33
|
+
"import": {
|
|
34
|
+
"types": "./dist/services/index.d.ts",
|
|
35
|
+
"default": "./dist/services/index.js"
|
|
36
|
+
},
|
|
37
|
+
"require": {
|
|
38
|
+
"types": "./dist/services/index.d.cts",
|
|
39
|
+
"default": "./dist/services/index.cjs"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"./build": {
|
|
43
|
+
"import": {
|
|
44
|
+
"types": "./dist/build/index.d.ts",
|
|
45
|
+
"default": "./dist/build/index.js"
|
|
46
|
+
},
|
|
47
|
+
"require": {
|
|
48
|
+
"types": "./dist/build/index.d.cts",
|
|
49
|
+
"default": "./dist/build/index.cjs"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"./bundler": {
|
|
53
|
+
"import": {
|
|
54
|
+
"types": "./dist/bundler/index.d.ts",
|
|
55
|
+
"default": "./dist/bundler/index.js"
|
|
56
|
+
},
|
|
57
|
+
"require": {
|
|
58
|
+
"types": "./dist/bundler/index.d.cts",
|
|
59
|
+
"default": "./dist/bundler/index.cjs"
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"./analyze": {
|
|
63
|
+
"import": {
|
|
64
|
+
"types": "./dist/build/analyze.d.ts",
|
|
65
|
+
"default": "./dist/build/analyze.js"
|
|
66
|
+
},
|
|
67
|
+
"require": {
|
|
68
|
+
"types": "./dist/build/analyze.d.cts",
|
|
69
|
+
"default": "./dist/build/analyze.cjs"
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
"./loader": {
|
|
73
|
+
"import": {
|
|
74
|
+
"types": "./dist/validator/loader.d.ts",
|
|
75
|
+
"default": "./dist/validator/loader.js"
|
|
76
|
+
},
|
|
77
|
+
"require": {
|
|
78
|
+
"types": "./dist/validator/loader.d.cts",
|
|
79
|
+
"default": "./dist/validator/loader.cjs"
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
"./package.json": "./package.json"
|
|
83
|
+
},
|
|
84
|
+
"keywords": [],
|
|
85
|
+
"author": "",
|
|
86
|
+
"license": "Elastic-2.0",
|
|
87
|
+
"dependencies": {
|
|
88
|
+
"@babel/core": "^7.26.10",
|
|
89
|
+
"@babel/helper-module-imports": "^7.25.9",
|
|
90
|
+
"@neon-rs/load": "^0.1.82",
|
|
91
|
+
"@rollup/plugin-alias": "^5.1.1",
|
|
92
|
+
"@rollup/plugin-commonjs": "^28.0.3",
|
|
93
|
+
"@rollup/plugin-json": "^6.1.0",
|
|
94
|
+
"@rollup/plugin-node-resolve": "^16.0.0",
|
|
95
|
+
"@rollup/plugin-virtual": "^3.0.2",
|
|
96
|
+
"@sindresorhus/slugify": "^2.2.1",
|
|
97
|
+
"builtins": "^5.1.0",
|
|
98
|
+
"detect-libc": "^2.0.3",
|
|
99
|
+
"dotenv": "^16.4.7",
|
|
100
|
+
"esbuild": "^0.25.1",
|
|
101
|
+
"find-workspaces": "^0.3.1",
|
|
102
|
+
"fs-extra": "^11.3.0",
|
|
103
|
+
"hono": "^4.7.4",
|
|
104
|
+
"resolve-from": "^5.0.0",
|
|
105
|
+
"rollup": "^4.35.0",
|
|
106
|
+
"rollup-plugin-esbuild": "^6.2.1",
|
|
107
|
+
"rollup-plugin-node-externals": "^8.0.0",
|
|
108
|
+
"typescript-paths": "^1.5.1",
|
|
109
|
+
"zod": "^3.24.2",
|
|
110
|
+
"@mastra/core": "0.0.0-a2a-20250421213654",
|
|
111
|
+
"@mastra/server": "0.0.0-a2a-20250421213654"
|
|
112
|
+
},
|
|
113
|
+
"devDependencies": {
|
|
114
|
+
"@hono/node-server": "^1.13.8",
|
|
115
|
+
"@hono/swagger-ui": "^0.5.1",
|
|
116
|
+
"@microsoft/api-extractor": "^7.52.1",
|
|
117
|
+
"@types/babel__core": "^7.20.5",
|
|
118
|
+
"@types/babel__helper-module-imports": "^7.18.3",
|
|
119
|
+
"@types/fs-extra": "^11.0.4",
|
|
120
|
+
"@types/node": "^20.17.27",
|
|
121
|
+
"concurrently": "^9.1.2",
|
|
122
|
+
"eslint": "^9.23.0",
|
|
123
|
+
"hono-openapi": "^0.4.6",
|
|
124
|
+
"rollup-plugin-visualizer": "^5.14.0",
|
|
125
|
+
"superjson": "^2.2.2",
|
|
126
|
+
"tsup": "^8.4.0",
|
|
127
|
+
"type-fest": "^4.37.0",
|
|
128
|
+
"typescript": "^5.8.2",
|
|
129
|
+
"vitest": "^2.1.9",
|
|
130
|
+
"zod-to-json-schema": "^3.24.3",
|
|
131
|
+
"@internal/lint": "0.0.2"
|
|
132
|
+
},
|
|
133
|
+
"scripts": {
|
|
134
|
+
"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",
|
|
135
|
+
"build:watch": "pnpm build --watch",
|
|
136
|
+
"pull:openapispec": "node src/server/openapi.script.js",
|
|
137
|
+
"test": "vitest run",
|
|
138
|
+
"lint": "eslint ."
|
|
139
|
+
}
|
|
140
|
+
}
|