@mastra/deployer-vercel 0.0.0-support-monorepos-20250415183219 → 0.0.0-trigger-playground-ui-package-20250506151043
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/_tsup-dts-rollup.d.cts +3 -2
- package/dist/_tsup-dts-rollup.d.ts +3 -2
- package/dist/index.cjs +86 -29
- package/dist/index.js +87 -30
- package/package.json +6 -6
|
@@ -9,14 +9,15 @@ export declare class VercelDeployer extends Deployer {
|
|
|
9
9
|
projectName: string;
|
|
10
10
|
token: string;
|
|
11
11
|
});
|
|
12
|
-
writeFiles(outputDirectory: string): void;
|
|
13
12
|
private getProjectId;
|
|
14
13
|
private getTeamId;
|
|
15
14
|
private syncEnv;
|
|
16
15
|
prepare(outputDirectory: string): Promise<void>;
|
|
17
16
|
private getEntry;
|
|
18
|
-
|
|
17
|
+
private writeVercelJSON;
|
|
18
|
+
bundle(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void>;
|
|
19
19
|
deploy(outputDirectory: string): Promise<void>;
|
|
20
|
+
lint(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void>;
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
export { }
|
|
@@ -9,14 +9,15 @@ export declare class VercelDeployer extends Deployer {
|
|
|
9
9
|
projectName: string;
|
|
10
10
|
token: string;
|
|
11
11
|
});
|
|
12
|
-
writeFiles(outputDirectory: string): void;
|
|
13
12
|
private getProjectId;
|
|
14
13
|
private getTeamId;
|
|
15
14
|
private syncEnv;
|
|
16
15
|
prepare(outputDirectory: string): Promise<void>;
|
|
17
16
|
private getEntry;
|
|
18
|
-
|
|
17
|
+
private writeVercelJSON;
|
|
18
|
+
bundle(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void>;
|
|
19
19
|
deploy(outputDirectory: string): Promise<void>;
|
|
20
|
+
lint(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void>;
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
export { }
|
package/dist/index.cjs
CHANGED
|
@@ -40,32 +40,6 @@ var VercelDeployer = class extends deployer.Deployer {
|
|
|
40
40
|
this.projectName = projectName;
|
|
41
41
|
this.token = token;
|
|
42
42
|
}
|
|
43
|
-
writeFiles(outputDirectory) {
|
|
44
|
-
fs.writeFileSync(
|
|
45
|
-
path.join(outputDirectory, this.outputDir, "vercel.json"),
|
|
46
|
-
JSON.stringify(
|
|
47
|
-
{
|
|
48
|
-
version: 2,
|
|
49
|
-
installCommand: "npm install --omit=dev",
|
|
50
|
-
builds: [
|
|
51
|
-
{
|
|
52
|
-
src: "index.mjs",
|
|
53
|
-
use: "@vercel/node",
|
|
54
|
-
config: { includeFiles: ["**"] }
|
|
55
|
-
}
|
|
56
|
-
],
|
|
57
|
-
routes: [
|
|
58
|
-
{
|
|
59
|
-
src: "/(.*)",
|
|
60
|
-
dest: "index.mjs"
|
|
61
|
-
}
|
|
62
|
-
]
|
|
63
|
-
},
|
|
64
|
-
null,
|
|
65
|
-
2
|
|
66
|
-
)
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
43
|
getProjectId({ dir }) {
|
|
70
44
|
const projectJsonPath = path.join(dir, "output", ".vercel", "project.json");
|
|
71
45
|
try {
|
|
@@ -128,13 +102,59 @@ var VercelDeployer = class extends deployer.Deployer {
|
|
|
128
102
|
}
|
|
129
103
|
async prepare(outputDirectory) {
|
|
130
104
|
await super.prepare(outputDirectory);
|
|
131
|
-
await this.writeFiles(outputDirectory);
|
|
132
105
|
}
|
|
133
106
|
getEntry() {
|
|
134
107
|
return `
|
|
135
108
|
import { handle } from 'hono/vercel'
|
|
136
109
|
import { mastra } from '#mastra';
|
|
137
110
|
import { createHonoServer } from '#server';
|
|
111
|
+
import { evaluate } from '@mastra/core/eval';
|
|
112
|
+
import { AvailableHooks, registerHook } from '@mastra/core/hooks';
|
|
113
|
+
import { TABLE_EVALS } from '@mastra/core/storage';
|
|
114
|
+
import { checkEvalStorageFields } from '@mastra/core/utils';
|
|
115
|
+
|
|
116
|
+
registerHook(AvailableHooks.ON_GENERATION, ({ input, output, metric, runId, agentName, instructions }) => {
|
|
117
|
+
evaluate({
|
|
118
|
+
agentName,
|
|
119
|
+
input,
|
|
120
|
+
metric,
|
|
121
|
+
output,
|
|
122
|
+
runId,
|
|
123
|
+
globalRunId: runId,
|
|
124
|
+
instructions,
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
if (mastra.getStorage()) {
|
|
129
|
+
// start storage init in the background
|
|
130
|
+
mastra.getStorage().init();
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
registerHook(AvailableHooks.ON_EVALUATION, async traceObject => {
|
|
134
|
+
const storage = mastra.getStorage();
|
|
135
|
+
if (storage) {
|
|
136
|
+
// Check for required fields
|
|
137
|
+
const logger = mastra?.getLogger();
|
|
138
|
+
const areFieldsValid = checkEvalStorageFields(traceObject, logger);
|
|
139
|
+
if (!areFieldsValid) return;
|
|
140
|
+
|
|
141
|
+
await storage.insert({
|
|
142
|
+
tableName: TABLE_EVALS,
|
|
143
|
+
record: {
|
|
144
|
+
input: traceObject.input,
|
|
145
|
+
output: traceObject.output,
|
|
146
|
+
result: JSON.stringify(traceObject.result || {}),
|
|
147
|
+
agent_name: traceObject.agentName,
|
|
148
|
+
metric_name: traceObject.metricName,
|
|
149
|
+
instructions: traceObject.instructions,
|
|
150
|
+
test_info: null,
|
|
151
|
+
global_run_id: traceObject.globalRunId,
|
|
152
|
+
run_id: traceObject.runId,
|
|
153
|
+
created_at: new Date().toISOString(),
|
|
154
|
+
},
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
});
|
|
138
158
|
|
|
139
159
|
const app = await createHonoServer(mastra);
|
|
140
160
|
|
|
@@ -142,8 +162,42 @@ export const GET = handle(app);
|
|
|
142
162
|
export const POST = handle(app);
|
|
143
163
|
`;
|
|
144
164
|
}
|
|
145
|
-
|
|
146
|
-
|
|
165
|
+
writeVercelJSON(outputDirectory, files = ["./*"]) {
|
|
166
|
+
fs.writeFileSync(
|
|
167
|
+
path.join(outputDirectory, this.outputDir, "vercel.json"),
|
|
168
|
+
JSON.stringify(
|
|
169
|
+
{
|
|
170
|
+
version: 2,
|
|
171
|
+
installCommand: "npm install --omit=dev",
|
|
172
|
+
builds: [
|
|
173
|
+
{
|
|
174
|
+
src: "index.mjs",
|
|
175
|
+
use: "@vercel/node",
|
|
176
|
+
config: { includeFiles: files }
|
|
177
|
+
}
|
|
178
|
+
],
|
|
179
|
+
routes: [
|
|
180
|
+
{
|
|
181
|
+
src: "/(.*)",
|
|
182
|
+
dest: "index.mjs"
|
|
183
|
+
}
|
|
184
|
+
]
|
|
185
|
+
},
|
|
186
|
+
null,
|
|
187
|
+
2
|
|
188
|
+
)
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
async bundle(entryFile, outputDirectory, toolsPaths) {
|
|
192
|
+
const result = await this._bundle(this.getEntry(), entryFile, outputDirectory, toolsPaths);
|
|
193
|
+
const files = fs.readdirSync(path.join(outputDirectory, this.outputDir), {
|
|
194
|
+
recursive: true
|
|
195
|
+
});
|
|
196
|
+
const filesWithoutNodeModules = files.filter(
|
|
197
|
+
(file) => typeof file === "string" && !file.startsWith("node_modules")
|
|
198
|
+
);
|
|
199
|
+
this.writeVercelJSON(outputDirectory, filesWithoutNodeModules);
|
|
200
|
+
return result;
|
|
147
201
|
}
|
|
148
202
|
async deploy(outputDirectory) {
|
|
149
203
|
const envVars = await this.loadEnvVars();
|
|
@@ -172,6 +226,9 @@ export const POST = handle(app);
|
|
|
172
226
|
this.logger.info("\nAdd your ENV vars to .env or your vercel dashboard.\n");
|
|
173
227
|
}
|
|
174
228
|
}
|
|
229
|
+
async lint(entryFile, outputDirectory, toolsPaths) {
|
|
230
|
+
await super.lint(entryFile, outputDirectory, toolsPaths);
|
|
231
|
+
}
|
|
175
232
|
};
|
|
176
233
|
|
|
177
234
|
exports.VercelDeployer = VercelDeployer;
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as child_process from 'child_process';
|
|
2
|
-
import { writeFileSync,
|
|
2
|
+
import { readFileSync, writeFileSync, readdirSync } from 'fs';
|
|
3
3
|
import { join } from 'path';
|
|
4
4
|
import process from 'process';
|
|
5
5
|
import { Deployer } from '@mastra/deployer';
|
|
@@ -15,32 +15,6 @@ var VercelDeployer = class extends Deployer {
|
|
|
15
15
|
this.projectName = projectName;
|
|
16
16
|
this.token = token;
|
|
17
17
|
}
|
|
18
|
-
writeFiles(outputDirectory) {
|
|
19
|
-
writeFileSync(
|
|
20
|
-
join(outputDirectory, this.outputDir, "vercel.json"),
|
|
21
|
-
JSON.stringify(
|
|
22
|
-
{
|
|
23
|
-
version: 2,
|
|
24
|
-
installCommand: "npm install --omit=dev",
|
|
25
|
-
builds: [
|
|
26
|
-
{
|
|
27
|
-
src: "index.mjs",
|
|
28
|
-
use: "@vercel/node",
|
|
29
|
-
config: { includeFiles: ["**"] }
|
|
30
|
-
}
|
|
31
|
-
],
|
|
32
|
-
routes: [
|
|
33
|
-
{
|
|
34
|
-
src: "/(.*)",
|
|
35
|
-
dest: "index.mjs"
|
|
36
|
-
}
|
|
37
|
-
]
|
|
38
|
-
},
|
|
39
|
-
null,
|
|
40
|
-
2
|
|
41
|
-
)
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
18
|
getProjectId({ dir }) {
|
|
45
19
|
const projectJsonPath = join(dir, "output", ".vercel", "project.json");
|
|
46
20
|
try {
|
|
@@ -103,13 +77,59 @@ var VercelDeployer = class extends Deployer {
|
|
|
103
77
|
}
|
|
104
78
|
async prepare(outputDirectory) {
|
|
105
79
|
await super.prepare(outputDirectory);
|
|
106
|
-
await this.writeFiles(outputDirectory);
|
|
107
80
|
}
|
|
108
81
|
getEntry() {
|
|
109
82
|
return `
|
|
110
83
|
import { handle } from 'hono/vercel'
|
|
111
84
|
import { mastra } from '#mastra';
|
|
112
85
|
import { createHonoServer } from '#server';
|
|
86
|
+
import { evaluate } from '@mastra/core/eval';
|
|
87
|
+
import { AvailableHooks, registerHook } from '@mastra/core/hooks';
|
|
88
|
+
import { TABLE_EVALS } from '@mastra/core/storage';
|
|
89
|
+
import { checkEvalStorageFields } from '@mastra/core/utils';
|
|
90
|
+
|
|
91
|
+
registerHook(AvailableHooks.ON_GENERATION, ({ input, output, metric, runId, agentName, instructions }) => {
|
|
92
|
+
evaluate({
|
|
93
|
+
agentName,
|
|
94
|
+
input,
|
|
95
|
+
metric,
|
|
96
|
+
output,
|
|
97
|
+
runId,
|
|
98
|
+
globalRunId: runId,
|
|
99
|
+
instructions,
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
if (mastra.getStorage()) {
|
|
104
|
+
// start storage init in the background
|
|
105
|
+
mastra.getStorage().init();
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
registerHook(AvailableHooks.ON_EVALUATION, async traceObject => {
|
|
109
|
+
const storage = mastra.getStorage();
|
|
110
|
+
if (storage) {
|
|
111
|
+
// Check for required fields
|
|
112
|
+
const logger = mastra?.getLogger();
|
|
113
|
+
const areFieldsValid = checkEvalStorageFields(traceObject, logger);
|
|
114
|
+
if (!areFieldsValid) return;
|
|
115
|
+
|
|
116
|
+
await storage.insert({
|
|
117
|
+
tableName: TABLE_EVALS,
|
|
118
|
+
record: {
|
|
119
|
+
input: traceObject.input,
|
|
120
|
+
output: traceObject.output,
|
|
121
|
+
result: JSON.stringify(traceObject.result || {}),
|
|
122
|
+
agent_name: traceObject.agentName,
|
|
123
|
+
metric_name: traceObject.metricName,
|
|
124
|
+
instructions: traceObject.instructions,
|
|
125
|
+
test_info: null,
|
|
126
|
+
global_run_id: traceObject.globalRunId,
|
|
127
|
+
run_id: traceObject.runId,
|
|
128
|
+
created_at: new Date().toISOString(),
|
|
129
|
+
},
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
});
|
|
113
133
|
|
|
114
134
|
const app = await createHonoServer(mastra);
|
|
115
135
|
|
|
@@ -117,8 +137,42 @@ export const GET = handle(app);
|
|
|
117
137
|
export const POST = handle(app);
|
|
118
138
|
`;
|
|
119
139
|
}
|
|
120
|
-
|
|
121
|
-
|
|
140
|
+
writeVercelJSON(outputDirectory, files = ["./*"]) {
|
|
141
|
+
writeFileSync(
|
|
142
|
+
join(outputDirectory, this.outputDir, "vercel.json"),
|
|
143
|
+
JSON.stringify(
|
|
144
|
+
{
|
|
145
|
+
version: 2,
|
|
146
|
+
installCommand: "npm install --omit=dev",
|
|
147
|
+
builds: [
|
|
148
|
+
{
|
|
149
|
+
src: "index.mjs",
|
|
150
|
+
use: "@vercel/node",
|
|
151
|
+
config: { includeFiles: files }
|
|
152
|
+
}
|
|
153
|
+
],
|
|
154
|
+
routes: [
|
|
155
|
+
{
|
|
156
|
+
src: "/(.*)",
|
|
157
|
+
dest: "index.mjs"
|
|
158
|
+
}
|
|
159
|
+
]
|
|
160
|
+
},
|
|
161
|
+
null,
|
|
162
|
+
2
|
|
163
|
+
)
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
async bundle(entryFile, outputDirectory, toolsPaths) {
|
|
167
|
+
const result = await this._bundle(this.getEntry(), entryFile, outputDirectory, toolsPaths);
|
|
168
|
+
const files = readdirSync(join(outputDirectory, this.outputDir), {
|
|
169
|
+
recursive: true
|
|
170
|
+
});
|
|
171
|
+
const filesWithoutNodeModules = files.filter(
|
|
172
|
+
(file) => typeof file === "string" && !file.startsWith("node_modules")
|
|
173
|
+
);
|
|
174
|
+
this.writeVercelJSON(outputDirectory, filesWithoutNodeModules);
|
|
175
|
+
return result;
|
|
122
176
|
}
|
|
123
177
|
async deploy(outputDirectory) {
|
|
124
178
|
const envVars = await this.loadEnvVars();
|
|
@@ -147,6 +201,9 @@ export const POST = handle(app);
|
|
|
147
201
|
this.logger.info("\nAdd your ENV vars to .env or your vercel dashboard.\n");
|
|
148
202
|
}
|
|
149
203
|
}
|
|
204
|
+
async lint(entryFile, outputDirectory, toolsPaths) {
|
|
205
|
+
await super.lint(entryFile, outputDirectory, toolsPaths);
|
|
206
|
+
}
|
|
150
207
|
};
|
|
151
208
|
|
|
152
209
|
export { VercelDeployer };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/deployer-vercel",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-trigger-playground-ui-package-20250506151043",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -27,18 +27,18 @@
|
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@rollup/plugin-virtual": "^3.0.2",
|
|
29
29
|
"fs-extra": "^11.3.0",
|
|
30
|
-
"@mastra/core": "0.
|
|
31
|
-
"@mastra/deployer": "0.0.0-
|
|
30
|
+
"@mastra/core": "0.0.0-trigger-playground-ui-package-20250506151043",
|
|
31
|
+
"@mastra/deployer": "0.0.0-trigger-playground-ui-package-20250506151043"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@microsoft/api-extractor": "^7.52.
|
|
34
|
+
"@microsoft/api-extractor": "^7.52.5",
|
|
35
35
|
"@types/node": "^20.17.27",
|
|
36
36
|
"eslint": "^9.23.0",
|
|
37
37
|
"tsup": "^8.4.0",
|
|
38
38
|
"typescript": "^5.8.2",
|
|
39
39
|
"vercel": "^39.4.2",
|
|
40
|
-
"vitest": "^3.
|
|
41
|
-
"@internal/lint": "0.0.
|
|
40
|
+
"vitest": "^3.1.2",
|
|
41
|
+
"@internal/lint": "0.0.0-trigger-playground-ui-package-20250506151043"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"build": "tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting",
|