@mastra/deployer-cloudflare 0.10.16-alpha.1 → 0.11.0-alpha.2
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 -14
- package/dist/_tsup-dts-rollup.d.ts +2 -14
- package/dist/index.cjs +5 -22
- package/dist/index.js +5 -22
- package/package.json +4 -4
|
@@ -9,24 +9,17 @@ declare interface CFRoute {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export declare class CloudflareDeployer extends Deployer {
|
|
12
|
-
private cloudflare;
|
|
13
12
|
routes?: CFRoute[];
|
|
14
13
|
workerNamespace?: string;
|
|
15
|
-
scope: string;
|
|
16
14
|
env?: Record<string, any>;
|
|
17
15
|
projectName?: string;
|
|
18
16
|
d1Databases?: D1DatabaseBinding[];
|
|
19
17
|
kvNamespaces?: KVNamespaceBinding[];
|
|
20
|
-
constructor({
|
|
18
|
+
constructor({ env, projectName, routes, workerNamespace, d1Databases, kvNamespaces, }: {
|
|
21
19
|
env?: Record<string, any>;
|
|
22
|
-
scope: string;
|
|
23
20
|
projectName?: string;
|
|
24
21
|
routes?: CFRoute[];
|
|
25
22
|
workerNamespace?: string;
|
|
26
|
-
auth: {
|
|
27
|
-
apiToken: string;
|
|
28
|
-
apiEmail?: string;
|
|
29
|
-
};
|
|
30
23
|
d1Databases?: D1DatabaseBinding[];
|
|
31
24
|
kvNamespaces?: KVNamespaceBinding[];
|
|
32
25
|
});
|
|
@@ -36,12 +29,7 @@ export declare class CloudflareDeployer extends Deployer {
|
|
|
36
29
|
getBundlerOptions(serverFile: string, mastraEntryFile: string, analyzedBundleInfo: Awaited<ReturnType<typeof analyzeBundle>>, toolsPaths: string[]): Promise<InputOptions>;
|
|
37
30
|
bundle(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void>;
|
|
38
31
|
deploy(): Promise<void>;
|
|
39
|
-
tagWorker(
|
|
40
|
-
scope: string;
|
|
41
|
-
workerName: string;
|
|
42
|
-
namespace: string;
|
|
43
|
-
tags: string[];
|
|
44
|
-
}): Promise<void>;
|
|
32
|
+
tagWorker(): Promise<void>;
|
|
45
33
|
lint(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void>;
|
|
46
34
|
}
|
|
47
35
|
|
|
@@ -9,24 +9,17 @@ declare interface CFRoute {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export declare class CloudflareDeployer extends Deployer {
|
|
12
|
-
private cloudflare;
|
|
13
12
|
routes?: CFRoute[];
|
|
14
13
|
workerNamespace?: string;
|
|
15
|
-
scope: string;
|
|
16
14
|
env?: Record<string, any>;
|
|
17
15
|
projectName?: string;
|
|
18
16
|
d1Databases?: D1DatabaseBinding[];
|
|
19
17
|
kvNamespaces?: KVNamespaceBinding[];
|
|
20
|
-
constructor({
|
|
18
|
+
constructor({ env, projectName, routes, workerNamespace, d1Databases, kvNamespaces, }: {
|
|
21
19
|
env?: Record<string, any>;
|
|
22
|
-
scope: string;
|
|
23
20
|
projectName?: string;
|
|
24
21
|
routes?: CFRoute[];
|
|
25
22
|
workerNamespace?: string;
|
|
26
|
-
auth: {
|
|
27
|
-
apiToken: string;
|
|
28
|
-
apiEmail?: string;
|
|
29
|
-
};
|
|
30
23
|
d1Databases?: D1DatabaseBinding[];
|
|
31
24
|
kvNamespaces?: KVNamespaceBinding[];
|
|
32
25
|
});
|
|
@@ -36,12 +29,7 @@ export declare class CloudflareDeployer extends Deployer {
|
|
|
36
29
|
getBundlerOptions(serverFile: string, mastraEntryFile: string, analyzedBundleInfo: Awaited<ReturnType<typeof analyzeBundle>>, toolsPaths: string[]): Promise<InputOptions>;
|
|
37
30
|
bundle(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void>;
|
|
38
31
|
deploy(): Promise<void>;
|
|
39
|
-
tagWorker(
|
|
40
|
-
scope: string;
|
|
41
|
-
workerName: string;
|
|
42
|
-
namespace: string;
|
|
43
|
-
tags: string[];
|
|
44
|
-
}): Promise<void>;
|
|
32
|
+
tagWorker(): Promise<void>;
|
|
45
33
|
lint(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void>;
|
|
46
34
|
}
|
|
47
35
|
|
package/dist/index.cjs
CHANGED
|
@@ -4,7 +4,6 @@ var promises = require('fs/promises');
|
|
|
4
4
|
var path = require('path');
|
|
5
5
|
var deployer = require('@mastra/deployer');
|
|
6
6
|
var virtual = require('@rollup/plugin-virtual');
|
|
7
|
-
var cloudflare = require('cloudflare');
|
|
8
7
|
|
|
9
8
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
9
|
|
|
@@ -12,26 +11,21 @@ var virtual__default = /*#__PURE__*/_interopDefault(virtual);
|
|
|
12
11
|
|
|
13
12
|
// src/index.ts
|
|
14
13
|
var CloudflareDeployer = class extends deployer.Deployer {
|
|
15
|
-
cloudflare;
|
|
16
14
|
routes = [];
|
|
17
15
|
workerNamespace;
|
|
18
|
-
scope;
|
|
19
16
|
env;
|
|
20
17
|
projectName;
|
|
21
18
|
d1Databases;
|
|
22
19
|
kvNamespaces;
|
|
23
20
|
constructor({
|
|
24
|
-
scope,
|
|
25
21
|
env,
|
|
26
22
|
projectName = "mastra",
|
|
27
23
|
routes,
|
|
28
24
|
workerNamespace,
|
|
29
|
-
auth,
|
|
30
25
|
d1Databases,
|
|
31
26
|
kvNamespaces
|
|
32
27
|
}) {
|
|
33
28
|
super({ name: "CLOUDFLARE" });
|
|
34
|
-
this.scope = scope;
|
|
35
29
|
this.projectName = projectName;
|
|
36
30
|
this.routes = routes;
|
|
37
31
|
this.workerNamespace = workerNamespace;
|
|
@@ -40,7 +34,6 @@ var CloudflareDeployer = class extends deployer.Deployer {
|
|
|
40
34
|
}
|
|
41
35
|
if (d1Databases) this.d1Databases = d1Databases;
|
|
42
36
|
if (kvNamespaces) this.kvNamespaces = kvNamespaces;
|
|
43
|
-
this.cloudflare = new cloudflare.Cloudflare(auth);
|
|
44
37
|
}
|
|
45
38
|
async writeFiles(outputDirectory) {
|
|
46
39
|
const env = await this.loadEnvVars();
|
|
@@ -73,7 +66,8 @@ var CloudflareDeployer = class extends deployer.Deployer {
|
|
|
73
66
|
return `
|
|
74
67
|
import '#polyfills';
|
|
75
68
|
import { mastra } from '#mastra';
|
|
76
|
-
import { createHonoServer } from '#server';
|
|
69
|
+
import { createHonoServer, getToolExports } from '#server';
|
|
70
|
+
import { tools } from '#tools';
|
|
77
71
|
import { evaluate } from '@mastra/core/eval';
|
|
78
72
|
import { AvailableHooks, registerHook } from '@mastra/core/hooks';
|
|
79
73
|
import { TABLE_EVALS } from '@mastra/core/storage';
|
|
@@ -119,7 +113,7 @@ var CloudflareDeployer = class extends deployer.Deployer {
|
|
|
119
113
|
|
|
120
114
|
export default {
|
|
121
115
|
fetch: async (request, env, context) => {
|
|
122
|
-
const app = await createHonoServer(mastra)
|
|
116
|
+
const app = await createHonoServer(mastra, { tools: getToolExports(tools) });
|
|
123
117
|
return app.fetch(request, env, context);
|
|
124
118
|
}
|
|
125
119
|
}
|
|
@@ -150,19 +144,8 @@ process.versions.node = '${process.versions.node}';
|
|
|
150
144
|
async deploy() {
|
|
151
145
|
this.logger?.info("Deploying to Cloudflare failed. Please use the Cloudflare dashboard to deploy.");
|
|
152
146
|
}
|
|
153
|
-
async tagWorker({
|
|
154
|
-
|
|
155
|
-
namespace,
|
|
156
|
-
tags,
|
|
157
|
-
scope
|
|
158
|
-
}) {
|
|
159
|
-
if (!this.cloudflare) {
|
|
160
|
-
throw new Error("Cloudflare Deployer not initialized");
|
|
161
|
-
}
|
|
162
|
-
await this.cloudflare.workersForPlatforms.dispatch.namespaces.scripts.tags.update(namespace, workerName, {
|
|
163
|
-
account_id: scope,
|
|
164
|
-
body: tags
|
|
165
|
-
});
|
|
147
|
+
async tagWorker() {
|
|
148
|
+
throw new Error("tagWorker method is no longer supported. Use the Cloudflare dashboard or API directly.");
|
|
166
149
|
}
|
|
167
150
|
async lint(entryFile, outputDirectory, toolsPaths) {
|
|
168
151
|
await super.lint(entryFile, outputDirectory, toolsPaths);
|
package/dist/index.js
CHANGED
|
@@ -2,30 +2,24 @@ import { writeFile } from 'fs/promises';
|
|
|
2
2
|
import { join } from 'path';
|
|
3
3
|
import { Deployer } from '@mastra/deployer';
|
|
4
4
|
import virtual from '@rollup/plugin-virtual';
|
|
5
|
-
import { Cloudflare } from 'cloudflare';
|
|
6
5
|
|
|
7
6
|
// src/index.ts
|
|
8
7
|
var CloudflareDeployer = class extends Deployer {
|
|
9
|
-
cloudflare;
|
|
10
8
|
routes = [];
|
|
11
9
|
workerNamespace;
|
|
12
|
-
scope;
|
|
13
10
|
env;
|
|
14
11
|
projectName;
|
|
15
12
|
d1Databases;
|
|
16
13
|
kvNamespaces;
|
|
17
14
|
constructor({
|
|
18
|
-
scope,
|
|
19
15
|
env,
|
|
20
16
|
projectName = "mastra",
|
|
21
17
|
routes,
|
|
22
18
|
workerNamespace,
|
|
23
|
-
auth,
|
|
24
19
|
d1Databases,
|
|
25
20
|
kvNamespaces
|
|
26
21
|
}) {
|
|
27
22
|
super({ name: "CLOUDFLARE" });
|
|
28
|
-
this.scope = scope;
|
|
29
23
|
this.projectName = projectName;
|
|
30
24
|
this.routes = routes;
|
|
31
25
|
this.workerNamespace = workerNamespace;
|
|
@@ -34,7 +28,6 @@ var CloudflareDeployer = class extends Deployer {
|
|
|
34
28
|
}
|
|
35
29
|
if (d1Databases) this.d1Databases = d1Databases;
|
|
36
30
|
if (kvNamespaces) this.kvNamespaces = kvNamespaces;
|
|
37
|
-
this.cloudflare = new Cloudflare(auth);
|
|
38
31
|
}
|
|
39
32
|
async writeFiles(outputDirectory) {
|
|
40
33
|
const env = await this.loadEnvVars();
|
|
@@ -67,7 +60,8 @@ var CloudflareDeployer = class extends Deployer {
|
|
|
67
60
|
return `
|
|
68
61
|
import '#polyfills';
|
|
69
62
|
import { mastra } from '#mastra';
|
|
70
|
-
import { createHonoServer } from '#server';
|
|
63
|
+
import { createHonoServer, getToolExports } from '#server';
|
|
64
|
+
import { tools } from '#tools';
|
|
71
65
|
import { evaluate } from '@mastra/core/eval';
|
|
72
66
|
import { AvailableHooks, registerHook } from '@mastra/core/hooks';
|
|
73
67
|
import { TABLE_EVALS } from '@mastra/core/storage';
|
|
@@ -113,7 +107,7 @@ var CloudflareDeployer = class extends Deployer {
|
|
|
113
107
|
|
|
114
108
|
export default {
|
|
115
109
|
fetch: async (request, env, context) => {
|
|
116
|
-
const app = await createHonoServer(mastra)
|
|
110
|
+
const app = await createHonoServer(mastra, { tools: getToolExports(tools) });
|
|
117
111
|
return app.fetch(request, env, context);
|
|
118
112
|
}
|
|
119
113
|
}
|
|
@@ -144,19 +138,8 @@ process.versions.node = '${process.versions.node}';
|
|
|
144
138
|
async deploy() {
|
|
145
139
|
this.logger?.info("Deploying to Cloudflare failed. Please use the Cloudflare dashboard to deploy.");
|
|
146
140
|
}
|
|
147
|
-
async tagWorker({
|
|
148
|
-
|
|
149
|
-
namespace,
|
|
150
|
-
tags,
|
|
151
|
-
scope
|
|
152
|
-
}) {
|
|
153
|
-
if (!this.cloudflare) {
|
|
154
|
-
throw new Error("Cloudflare Deployer not initialized");
|
|
155
|
-
}
|
|
156
|
-
await this.cloudflare.workersForPlatforms.dispatch.namespaces.scripts.tags.update(namespace, workerName, {
|
|
157
|
-
account_id: scope,
|
|
158
|
-
body: tags
|
|
159
|
-
});
|
|
141
|
+
async tagWorker() {
|
|
142
|
+
throw new Error("tagWorker method is no longer supported. Use the Cloudflare dashboard or API directly.");
|
|
160
143
|
}
|
|
161
144
|
async lint(entryFile, outputDirectory, toolsPaths) {
|
|
162
145
|
await super.lint(entryFile, outputDirectory, toolsPaths);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/deployer-cloudflare",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0-alpha.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"cloudflare": "^4.4.1",
|
|
41
41
|
"rollup": "~4.44.2",
|
|
42
42
|
"zod": "^3.25.67",
|
|
43
|
-
"@mastra/deployer": "^0.11.0-alpha.
|
|
43
|
+
"@mastra/deployer": "^0.11.0-alpha.2"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@microsoft/api-extractor": "^7.52.8",
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"tsup": "^8.5.0",
|
|
50
50
|
"typescript": "^5.8.3",
|
|
51
51
|
"vitest": "^3.2.4",
|
|
52
|
-
"@
|
|
53
|
-
"@
|
|
52
|
+
"@internal/lint": "0.0.20",
|
|
53
|
+
"@mastra/core": "0.11.0-alpha.2"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"@mastra/core": "^0.10.1-alpha.0"
|