@mastra/deployer-netlify 0.0.0-vnextWorkflows-20250422142014 → 0.0.0-workflow-deno-20250616115451
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 +2 -18
- package/dist/_tsup-dts-rollup.d.ts +2 -18
- package/dist/index.cjs +52 -83
- package/dist/index.js +52 -83
- package/package.json +15 -13
|
@@ -1,22 +1,5 @@
|
|
|
1
1
|
import { Deployer } from '@mastra/deployer';
|
|
2
2
|
|
|
3
|
-
export declare function getOrCreateSite({ token, name, scope }: {
|
|
4
|
-
token: string;
|
|
5
|
-
name: string;
|
|
6
|
-
scope: string;
|
|
7
|
-
}): Promise<{
|
|
8
|
-
id: string | undefined;
|
|
9
|
-
name: string | undefined;
|
|
10
|
-
url: string | undefined;
|
|
11
|
-
adminUrl: string | undefined;
|
|
12
|
-
} | {
|
|
13
|
-
id: string;
|
|
14
|
-
name: string;
|
|
15
|
-
ssl_url: string;
|
|
16
|
-
url: string;
|
|
17
|
-
admin_url: string;
|
|
18
|
-
}>;
|
|
19
|
-
|
|
20
3
|
export declare class NetlifyDeployer extends Deployer {
|
|
21
4
|
protected scope: string;
|
|
22
5
|
protected projectName: string;
|
|
@@ -30,10 +13,11 @@ export declare class NetlifyDeployer extends Deployer {
|
|
|
30
13
|
dir: string;
|
|
31
14
|
}): void;
|
|
32
15
|
protected installDependencies(outputDirectory: string, rootDir?: string): Promise<void>;
|
|
33
|
-
deploy(
|
|
16
|
+
deploy(): Promise<void>;
|
|
34
17
|
prepare(outputDirectory: string): Promise<void>;
|
|
35
18
|
bundle(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void>;
|
|
36
19
|
private getEntry;
|
|
20
|
+
lint(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void>;
|
|
37
21
|
}
|
|
38
22
|
|
|
39
23
|
export { }
|
|
@@ -1,22 +1,5 @@
|
|
|
1
1
|
import { Deployer } from '@mastra/deployer';
|
|
2
2
|
|
|
3
|
-
export declare function getOrCreateSite({ token, name, scope }: {
|
|
4
|
-
token: string;
|
|
5
|
-
name: string;
|
|
6
|
-
scope: string;
|
|
7
|
-
}): Promise<{
|
|
8
|
-
id: string | undefined;
|
|
9
|
-
name: string | undefined;
|
|
10
|
-
url: string | undefined;
|
|
11
|
-
adminUrl: string | undefined;
|
|
12
|
-
} | {
|
|
13
|
-
id: string;
|
|
14
|
-
name: string;
|
|
15
|
-
ssl_url: string;
|
|
16
|
-
url: string;
|
|
17
|
-
admin_url: string;
|
|
18
|
-
}>;
|
|
19
|
-
|
|
20
3
|
export declare class NetlifyDeployer extends Deployer {
|
|
21
4
|
protected scope: string;
|
|
22
5
|
protected projectName: string;
|
|
@@ -30,10 +13,11 @@ export declare class NetlifyDeployer extends Deployer {
|
|
|
30
13
|
dir: string;
|
|
31
14
|
}): void;
|
|
32
15
|
protected installDependencies(outputDirectory: string, rootDir?: string): Promise<void>;
|
|
33
|
-
deploy(
|
|
16
|
+
deploy(): Promise<void>;
|
|
34
17
|
prepare(outputDirectory: string): Promise<void>;
|
|
35
18
|
bundle(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void>;
|
|
36
19
|
private getEntry;
|
|
20
|
+
lint(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void>;
|
|
37
21
|
}
|
|
38
22
|
|
|
39
23
|
export { }
|
package/dist/index.cjs
CHANGED
|
@@ -4,62 +4,6 @@ var fs = require('fs');
|
|
|
4
4
|
var path = require('path');
|
|
5
5
|
var deployer = require('@mastra/deployer');
|
|
6
6
|
var services = require('@mastra/deployer/services');
|
|
7
|
-
var execa = require('execa');
|
|
8
|
-
|
|
9
|
-
// src/index.ts
|
|
10
|
-
|
|
11
|
-
// src/helpers.ts
|
|
12
|
-
async function createNetlifySite({ token, name, scope }) {
|
|
13
|
-
const response = await fetch("https://api.netlify.com/api/v1/sites", {
|
|
14
|
-
method: "POST",
|
|
15
|
-
headers: {
|
|
16
|
-
Authorization: `Bearer ${token}`,
|
|
17
|
-
"Content-Type": "application/json"
|
|
18
|
-
},
|
|
19
|
-
body: JSON.stringify({
|
|
20
|
-
name,
|
|
21
|
-
account_slug: scope,
|
|
22
|
-
// Optional - if not provided, creates in user's default account
|
|
23
|
-
force_ssl: true
|
|
24
|
-
// Enable HTTPS
|
|
25
|
-
})
|
|
26
|
-
});
|
|
27
|
-
const data = await response.json();
|
|
28
|
-
if (!response.ok) {
|
|
29
|
-
console.error(JSON.stringify(data));
|
|
30
|
-
throw new Error(`Failed to create site: ${data.message || "Unknown error"}`);
|
|
31
|
-
}
|
|
32
|
-
return {
|
|
33
|
-
id: data.id,
|
|
34
|
-
name: data.name,
|
|
35
|
-
url: data.ssl_url || data.url,
|
|
36
|
-
adminUrl: data.admin_url
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
async function findNetlifySite({ token, name, scope }) {
|
|
40
|
-
const response = await fetch(`https://api.netlify.com/api/v1/${scope}/sites?filter=all&name=${name}`, {
|
|
41
|
-
headers: {
|
|
42
|
-
Authorization: `Bearer ${token}`,
|
|
43
|
-
"Content-Type": "application/json"
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
const data = await response.json();
|
|
47
|
-
if (!response.ok || !Array.isArray(data)) {
|
|
48
|
-
throw new Error(`Failed to search sites: ${data.message || "Unknown error"}`);
|
|
49
|
-
}
|
|
50
|
-
return data.find((site) => site.name === name);
|
|
51
|
-
}
|
|
52
|
-
async function getOrCreateSite({ token, name, scope }) {
|
|
53
|
-
let existingSite;
|
|
54
|
-
try {
|
|
55
|
-
existingSite = await findNetlifySite({ token, name, scope });
|
|
56
|
-
} catch {
|
|
57
|
-
}
|
|
58
|
-
if (existingSite) {
|
|
59
|
-
return existingSite;
|
|
60
|
-
}
|
|
61
|
-
return createNetlifySite({ token, name, scope });
|
|
62
|
-
}
|
|
63
7
|
|
|
64
8
|
// src/index.ts
|
|
65
9
|
var NetlifyDeployer = class extends deployer.Deployer {
|
|
@@ -102,28 +46,8 @@ to = "/.netlify/functions/api/:splat"
|
|
|
102
46
|
}
|
|
103
47
|
});
|
|
104
48
|
}
|
|
105
|
-
async deploy(
|
|
106
|
-
|
|
107
|
-
const p2 = execa.execa(
|
|
108
|
-
"npx",
|
|
109
|
-
[
|
|
110
|
-
"netlify-cli",
|
|
111
|
-
"deploy",
|
|
112
|
-
"--site",
|
|
113
|
-
site.id,
|
|
114
|
-
"--auth",
|
|
115
|
-
this.token,
|
|
116
|
-
"--dir",
|
|
117
|
-
".",
|
|
118
|
-
"--functions",
|
|
119
|
-
"./netlify/functions"
|
|
120
|
-
],
|
|
121
|
-
{
|
|
122
|
-
cwd: path.join(outputDirectory, this.outputDir)
|
|
123
|
-
}
|
|
124
|
-
);
|
|
125
|
-
p2.stdout.pipe(process.stdout);
|
|
126
|
-
await p2;
|
|
49
|
+
async deploy() {
|
|
50
|
+
this.logger?.info("Deploying to Netlify failed. Please use the Netlify dashboard to deploy.");
|
|
127
51
|
}
|
|
128
52
|
async prepare(outputDirectory) {
|
|
129
53
|
await super.prepare(outputDirectory);
|
|
@@ -140,15 +64,60 @@ to = "/.netlify/functions/api/:splat"
|
|
|
140
64
|
}
|
|
141
65
|
getEntry() {
|
|
142
66
|
return `
|
|
143
|
-
import { handle } from 'hono/netlify'
|
|
144
|
-
import { mastra } from '#mastra';
|
|
145
|
-
import { createHonoServer } from '#server';
|
|
67
|
+
import { handle } from 'hono/netlify'
|
|
68
|
+
import { mastra } from '#mastra';
|
|
69
|
+
import { createHonoServer } from '#server';
|
|
70
|
+
import { evaluate } from '@mastra/core/eval';
|
|
71
|
+
import { AvailableHooks, registerHook } from '@mastra/core/hooks';
|
|
72
|
+
import { TABLE_EVALS } from '@mastra/core/storage';
|
|
73
|
+
import { checkEvalStorageFields } from '@mastra/core/utils';
|
|
74
|
+
|
|
75
|
+
registerHook(AvailableHooks.ON_GENERATION, ({ input, output, metric, runId, agentName, instructions }) => {
|
|
76
|
+
evaluate({
|
|
77
|
+
agentName,
|
|
78
|
+
input,
|
|
79
|
+
metric,
|
|
80
|
+
output,
|
|
81
|
+
runId,
|
|
82
|
+
globalRunId: runId,
|
|
83
|
+
instructions,
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
registerHook(AvailableHooks.ON_EVALUATION, async traceObject => {
|
|
88
|
+
const storage = mastra.getStorage();
|
|
89
|
+
if (storage) {
|
|
90
|
+
// Check for required fields
|
|
91
|
+
const logger = mastra.getLogger();
|
|
92
|
+
const areFieldsValid = checkEvalStorageFields(traceObject, logger);
|
|
93
|
+
if (!areFieldsValid) return;
|
|
146
94
|
|
|
147
|
-
|
|
95
|
+
await storage.insert({
|
|
96
|
+
tableName: TABLE_EVALS,
|
|
97
|
+
record: {
|
|
98
|
+
input: traceObject.input,
|
|
99
|
+
output: traceObject.output,
|
|
100
|
+
result: JSON.stringify(traceObject.result || {}),
|
|
101
|
+
agent_name: traceObject.agentName,
|
|
102
|
+
metric_name: traceObject.metricName,
|
|
103
|
+
instructions: traceObject.instructions,
|
|
104
|
+
test_info: null,
|
|
105
|
+
global_run_id: traceObject.globalRunId,
|
|
106
|
+
run_id: traceObject.runId,
|
|
107
|
+
created_at: new Date().toISOString(),
|
|
108
|
+
},
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
});
|
|
148
112
|
|
|
149
|
-
|
|
113
|
+
const app = await createHonoServer(mastra);
|
|
114
|
+
|
|
115
|
+
export default handle(app)
|
|
150
116
|
`;
|
|
151
117
|
}
|
|
118
|
+
async lint(entryFile, outputDirectory, toolsPaths) {
|
|
119
|
+
await super.lint(entryFile, outputDirectory, toolsPaths);
|
|
120
|
+
}
|
|
152
121
|
};
|
|
153
122
|
|
|
154
123
|
exports.NetlifyDeployer = NetlifyDeployer;
|
package/dist/index.js
CHANGED
|
@@ -2,62 +2,6 @@ import { existsSync, mkdirSync, writeFileSync } from 'fs';
|
|
|
2
2
|
import { join } from 'path';
|
|
3
3
|
import { Deployer } from '@mastra/deployer';
|
|
4
4
|
import { DepsService } from '@mastra/deployer/services';
|
|
5
|
-
import { execa } from 'execa';
|
|
6
|
-
|
|
7
|
-
// src/index.ts
|
|
8
|
-
|
|
9
|
-
// src/helpers.ts
|
|
10
|
-
async function createNetlifySite({ token, name, scope }) {
|
|
11
|
-
const response = await fetch("https://api.netlify.com/api/v1/sites", {
|
|
12
|
-
method: "POST",
|
|
13
|
-
headers: {
|
|
14
|
-
Authorization: `Bearer ${token}`,
|
|
15
|
-
"Content-Type": "application/json"
|
|
16
|
-
},
|
|
17
|
-
body: JSON.stringify({
|
|
18
|
-
name,
|
|
19
|
-
account_slug: scope,
|
|
20
|
-
// Optional - if not provided, creates in user's default account
|
|
21
|
-
force_ssl: true
|
|
22
|
-
// Enable HTTPS
|
|
23
|
-
})
|
|
24
|
-
});
|
|
25
|
-
const data = await response.json();
|
|
26
|
-
if (!response.ok) {
|
|
27
|
-
console.error(JSON.stringify(data));
|
|
28
|
-
throw new Error(`Failed to create site: ${data.message || "Unknown error"}`);
|
|
29
|
-
}
|
|
30
|
-
return {
|
|
31
|
-
id: data.id,
|
|
32
|
-
name: data.name,
|
|
33
|
-
url: data.ssl_url || data.url,
|
|
34
|
-
adminUrl: data.admin_url
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
async function findNetlifySite({ token, name, scope }) {
|
|
38
|
-
const response = await fetch(`https://api.netlify.com/api/v1/${scope}/sites?filter=all&name=${name}`, {
|
|
39
|
-
headers: {
|
|
40
|
-
Authorization: `Bearer ${token}`,
|
|
41
|
-
"Content-Type": "application/json"
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
const data = await response.json();
|
|
45
|
-
if (!response.ok || !Array.isArray(data)) {
|
|
46
|
-
throw new Error(`Failed to search sites: ${data.message || "Unknown error"}`);
|
|
47
|
-
}
|
|
48
|
-
return data.find((site) => site.name === name);
|
|
49
|
-
}
|
|
50
|
-
async function getOrCreateSite({ token, name, scope }) {
|
|
51
|
-
let existingSite;
|
|
52
|
-
try {
|
|
53
|
-
existingSite = await findNetlifySite({ token, name, scope });
|
|
54
|
-
} catch {
|
|
55
|
-
}
|
|
56
|
-
if (existingSite) {
|
|
57
|
-
return existingSite;
|
|
58
|
-
}
|
|
59
|
-
return createNetlifySite({ token, name, scope });
|
|
60
|
-
}
|
|
61
5
|
|
|
62
6
|
// src/index.ts
|
|
63
7
|
var NetlifyDeployer = class extends Deployer {
|
|
@@ -100,28 +44,8 @@ to = "/.netlify/functions/api/:splat"
|
|
|
100
44
|
}
|
|
101
45
|
});
|
|
102
46
|
}
|
|
103
|
-
async deploy(
|
|
104
|
-
|
|
105
|
-
const p2 = execa(
|
|
106
|
-
"npx",
|
|
107
|
-
[
|
|
108
|
-
"netlify-cli",
|
|
109
|
-
"deploy",
|
|
110
|
-
"--site",
|
|
111
|
-
site.id,
|
|
112
|
-
"--auth",
|
|
113
|
-
this.token,
|
|
114
|
-
"--dir",
|
|
115
|
-
".",
|
|
116
|
-
"--functions",
|
|
117
|
-
"./netlify/functions"
|
|
118
|
-
],
|
|
119
|
-
{
|
|
120
|
-
cwd: join(outputDirectory, this.outputDir)
|
|
121
|
-
}
|
|
122
|
-
);
|
|
123
|
-
p2.stdout.pipe(process.stdout);
|
|
124
|
-
await p2;
|
|
47
|
+
async deploy() {
|
|
48
|
+
this.logger?.info("Deploying to Netlify failed. Please use the Netlify dashboard to deploy.");
|
|
125
49
|
}
|
|
126
50
|
async prepare(outputDirectory) {
|
|
127
51
|
await super.prepare(outputDirectory);
|
|
@@ -138,15 +62,60 @@ to = "/.netlify/functions/api/:splat"
|
|
|
138
62
|
}
|
|
139
63
|
getEntry() {
|
|
140
64
|
return `
|
|
141
|
-
import { handle } from 'hono/netlify'
|
|
142
|
-
import { mastra } from '#mastra';
|
|
143
|
-
import { createHonoServer } from '#server';
|
|
65
|
+
import { handle } from 'hono/netlify'
|
|
66
|
+
import { mastra } from '#mastra';
|
|
67
|
+
import { createHonoServer } from '#server';
|
|
68
|
+
import { evaluate } from '@mastra/core/eval';
|
|
69
|
+
import { AvailableHooks, registerHook } from '@mastra/core/hooks';
|
|
70
|
+
import { TABLE_EVALS } from '@mastra/core/storage';
|
|
71
|
+
import { checkEvalStorageFields } from '@mastra/core/utils';
|
|
72
|
+
|
|
73
|
+
registerHook(AvailableHooks.ON_GENERATION, ({ input, output, metric, runId, agentName, instructions }) => {
|
|
74
|
+
evaluate({
|
|
75
|
+
agentName,
|
|
76
|
+
input,
|
|
77
|
+
metric,
|
|
78
|
+
output,
|
|
79
|
+
runId,
|
|
80
|
+
globalRunId: runId,
|
|
81
|
+
instructions,
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
registerHook(AvailableHooks.ON_EVALUATION, async traceObject => {
|
|
86
|
+
const storage = mastra.getStorage();
|
|
87
|
+
if (storage) {
|
|
88
|
+
// Check for required fields
|
|
89
|
+
const logger = mastra.getLogger();
|
|
90
|
+
const areFieldsValid = checkEvalStorageFields(traceObject, logger);
|
|
91
|
+
if (!areFieldsValid) return;
|
|
144
92
|
|
|
145
|
-
|
|
93
|
+
await storage.insert({
|
|
94
|
+
tableName: TABLE_EVALS,
|
|
95
|
+
record: {
|
|
96
|
+
input: traceObject.input,
|
|
97
|
+
output: traceObject.output,
|
|
98
|
+
result: JSON.stringify(traceObject.result || {}),
|
|
99
|
+
agent_name: traceObject.agentName,
|
|
100
|
+
metric_name: traceObject.metricName,
|
|
101
|
+
instructions: traceObject.instructions,
|
|
102
|
+
test_info: null,
|
|
103
|
+
global_run_id: traceObject.globalRunId,
|
|
104
|
+
run_id: traceObject.runId,
|
|
105
|
+
created_at: new Date().toISOString(),
|
|
106
|
+
},
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
});
|
|
146
110
|
|
|
147
|
-
|
|
111
|
+
const app = await createHonoServer(mastra);
|
|
112
|
+
|
|
113
|
+
export default handle(app)
|
|
148
114
|
`;
|
|
149
115
|
}
|
|
116
|
+
async lint(entryFile, outputDirectory, toolsPaths) {
|
|
117
|
+
await super.lint(entryFile, outputDirectory, toolsPaths);
|
|
118
|
+
}
|
|
150
119
|
};
|
|
151
120
|
|
|
152
121
|
export { NetlifyDeployer };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/deployer-netlify",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-workflow-deno-20250616115451",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -27,20 +27,22 @@
|
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@rollup/plugin-virtual": "^3.0.2",
|
|
29
29
|
"date-fns": "^4.1.0",
|
|
30
|
-
"execa": "^9.
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"@mastra/core": "0.0.0-vnextWorkflows-20250422142014",
|
|
34
|
-
"@mastra/deployer": "0.0.0-vnextWorkflows-20250422142014"
|
|
30
|
+
"execa": "^9.6.0",
|
|
31
|
+
"zod": "^3.25.57",
|
|
32
|
+
"@mastra/deployer": "0.0.0-workflow-deno-20250616115451"
|
|
35
33
|
},
|
|
36
34
|
"devDependencies": {
|
|
37
|
-
"@microsoft/api-extractor": "^7.52.
|
|
38
|
-
"@types/node": "^20.
|
|
39
|
-
"eslint": "^9.
|
|
40
|
-
"tsup": "^8.
|
|
41
|
-
"typescript": "^5.8.
|
|
42
|
-
"vitest": "^3.
|
|
43
|
-
"@internal/lint": "0.0.
|
|
35
|
+
"@microsoft/api-extractor": "^7.52.8",
|
|
36
|
+
"@types/node": "^20.19.0",
|
|
37
|
+
"eslint": "^9.28.0",
|
|
38
|
+
"tsup": "^8.5.0",
|
|
39
|
+
"typescript": "^5.8.3",
|
|
40
|
+
"vitest": "^3.2.3",
|
|
41
|
+
"@internal/lint": "0.0.0-workflow-deno-20250616115451",
|
|
42
|
+
"@mastra/core": "0.0.0-workflow-deno-20250616115451"
|
|
43
|
+
},
|
|
44
|
+
"peerDependencies": {
|
|
45
|
+
"@mastra/core": "^0.10.1-alpha.0"
|
|
44
46
|
},
|
|
45
47
|
"scripts": {
|
|
46
48
|
"build": "tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting",
|