@mastra/deployer-cloudflare 0.0.0-trigger-playground-ui-package-20250506151043 → 0.0.0-tsconfig-compile-20250703214351

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.
@@ -15,7 +15,9 @@ export declare class CloudflareDeployer extends Deployer {
15
15
  scope: string;
16
16
  env?: Record<string, any>;
17
17
  projectName?: string;
18
- constructor({ scope, env, projectName, routes, workerNamespace, auth, }: {
18
+ d1Databases?: D1DatabaseBinding[];
19
+ kvNamespaces?: KVNamespaceBinding[];
20
+ constructor({ scope, env, projectName, routes, workerNamespace, auth, d1Databases, kvNamespaces, }: {
19
21
  env?: Record<string, any>;
20
22
  scope: string;
21
23
  projectName?: string;
@@ -25,13 +27,15 @@ export declare class CloudflareDeployer extends Deployer {
25
27
  apiToken: string;
26
28
  apiEmail?: string;
27
29
  };
30
+ d1Databases?: D1DatabaseBinding[];
31
+ kvNamespaces?: KVNamespaceBinding[];
28
32
  });
29
33
  writeFiles(outputDirectory: string): Promise<void>;
30
34
  private getEntry;
31
35
  prepare(outputDirectory: string): Promise<void>;
32
36
  getBundlerOptions(serverFile: string, mastraEntryFile: string, analyzedBundleInfo: Awaited<ReturnType<typeof analyzeBundle>>, toolsPaths: string[]): Promise<InputOptions>;
33
37
  bundle(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void>;
34
- deploy(outputDirectory: string): Promise<void>;
38
+ deploy(): Promise<void>;
35
39
  tagWorker({ workerName, namespace, tags, scope, }: {
36
40
  scope: string;
37
41
  workerName: string;
@@ -66,4 +70,16 @@ export declare class CloudflareSecretsManager {
66
70
  listSecrets(workerId: string): Promise<any>;
67
71
  }
68
72
 
73
+ declare interface D1DatabaseBinding {
74
+ binding: string;
75
+ database_name: string;
76
+ database_id: string;
77
+ preview_database_id?: string;
78
+ }
79
+
80
+ declare interface KVNamespaceBinding {
81
+ binding: string;
82
+ id: string;
83
+ }
84
+
69
85
  export { }
@@ -15,7 +15,9 @@ export declare class CloudflareDeployer extends Deployer {
15
15
  scope: string;
16
16
  env?: Record<string, any>;
17
17
  projectName?: string;
18
- constructor({ scope, env, projectName, routes, workerNamespace, auth, }: {
18
+ d1Databases?: D1DatabaseBinding[];
19
+ kvNamespaces?: KVNamespaceBinding[];
20
+ constructor({ scope, env, projectName, routes, workerNamespace, auth, d1Databases, kvNamespaces, }: {
19
21
  env?: Record<string, any>;
20
22
  scope: string;
21
23
  projectName?: string;
@@ -25,13 +27,15 @@ export declare class CloudflareDeployer extends Deployer {
25
27
  apiToken: string;
26
28
  apiEmail?: string;
27
29
  };
30
+ d1Databases?: D1DatabaseBinding[];
31
+ kvNamespaces?: KVNamespaceBinding[];
28
32
  });
29
33
  writeFiles(outputDirectory: string): Promise<void>;
30
34
  private getEntry;
31
35
  prepare(outputDirectory: string): Promise<void>;
32
36
  getBundlerOptions(serverFile: string, mastraEntryFile: string, analyzedBundleInfo: Awaited<ReturnType<typeof analyzeBundle>>, toolsPaths: string[]): Promise<InputOptions>;
33
37
  bundle(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void>;
34
- deploy(outputDirectory: string): Promise<void>;
38
+ deploy(): Promise<void>;
35
39
  tagWorker({ workerName, namespace, tags, scope, }: {
36
40
  scope: string;
37
41
  workerName: string;
@@ -66,4 +70,16 @@ export declare class CloudflareSecretsManager {
66
70
  listSecrets(workerId: string): Promise<any>;
67
71
  }
68
72
 
73
+ declare interface D1DatabaseBinding {
74
+ binding: string;
75
+ database_name: string;
76
+ database_id: string;
77
+ preview_database_id?: string;
78
+ }
79
+
80
+ declare interface KVNamespaceBinding {
81
+ binding: string;
82
+ id: string;
83
+ }
84
+
69
85
  export { }
package/dist/index.cjs CHANGED
@@ -18,13 +18,17 @@ var CloudflareDeployer = class extends deployer.Deployer {
18
18
  scope;
19
19
  env;
20
20
  projectName;
21
+ d1Databases;
22
+ kvNamespaces;
21
23
  constructor({
22
24
  scope,
23
25
  env,
24
26
  projectName = "mastra",
25
27
  routes,
26
28
  workerNamespace,
27
- auth
29
+ auth,
30
+ d1Databases,
31
+ kvNamespaces
28
32
  }) {
29
33
  super({ name: "CLOUDFLARE" });
30
34
  this.scope = scope;
@@ -34,6 +38,8 @@ var CloudflareDeployer = class extends deployer.Deployer {
34
38
  if (env) {
35
39
  this.env = env;
36
40
  }
41
+ if (d1Databases) this.d1Databases = d1Databases;
42
+ if (kvNamespaces) this.kvNamespaces = kvNamespaces;
37
43
  this.cloudflare = new cloudflare.Cloudflare(auth);
38
44
  }
39
45
  async writeFiles(outputDirectory) {
@@ -55,6 +61,12 @@ var CloudflareDeployer = class extends deployer.Deployer {
55
61
  if (!this.workerNamespace && this.routes) {
56
62
  wranglerConfig.routes = this.routes;
57
63
  }
64
+ if (this.d1Databases?.length) {
65
+ wranglerConfig.d1_databases = this.d1Databases;
66
+ }
67
+ if (this.kvNamespaces?.length) {
68
+ wranglerConfig.kv_namespaces = this.kvNamespaces;
69
+ }
58
70
  await promises.writeFile(path.join(outputDirectory, this.outputDir, "wrangler.json"), JSON.stringify(wranglerConfig));
59
71
  }
60
72
  getEntry() {
@@ -79,11 +91,6 @@ var CloudflareDeployer = class extends deployer.Deployer {
79
91
  });
80
92
  });
81
93
 
82
- if (mastra.getStorage()) {
83
- // start storage init in the background
84
- mastra.getStorage().init();
85
- }
86
-
87
94
  registerHook(AvailableHooks.ON_EVALUATION, async traceObject => {
88
95
  const storage = mastra.getStorage();
89
96
  if (storage) {
@@ -140,22 +147,8 @@ process.versions.node = '${process.versions.node}';
140
147
  async bundle(entryFile, outputDirectory, toolsPaths) {
141
148
  return this._bundle(this.getEntry(), entryFile, outputDirectory, toolsPaths);
142
149
  }
143
- async deploy(outputDirectory) {
144
- const cmd = this.workerNamespace ? `npm exec -- wrangler@latest deploy --dispatch-namespace ${this.workerNamespace}` : "npm exec -- wrangler@latest deploy";
145
- const cpLogger = deployer.createChildProcessLogger({
146
- logger: this.logger,
147
- root: path.join(outputDirectory, this.outputDir)
148
- });
149
- await cpLogger({
150
- cmd,
151
- args: [],
152
- env: {
153
- CLOUDFLARE_API_TOKEN: this.cloudflare.apiToken,
154
- CLOUDFLARE_ACCOUNT_ID: this.scope,
155
- ...this.env,
156
- PATH: process.env.PATH
157
- }
158
- });
150
+ async deploy() {
151
+ this.logger?.info("Deploying to Cloudflare failed. Please use the Cloudflare dashboard to deploy.");
159
152
  }
160
153
  async tagWorker({
161
154
  workerName,
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { writeFile } from 'fs/promises';
2
2
  import { join } from 'path';
3
- import { Deployer, createChildProcessLogger } from '@mastra/deployer';
3
+ import { Deployer } from '@mastra/deployer';
4
4
  import virtual from '@rollup/plugin-virtual';
5
5
  import { Cloudflare } from 'cloudflare';
6
6
 
@@ -12,13 +12,17 @@ var CloudflareDeployer = class extends Deployer {
12
12
  scope;
13
13
  env;
14
14
  projectName;
15
+ d1Databases;
16
+ kvNamespaces;
15
17
  constructor({
16
18
  scope,
17
19
  env,
18
20
  projectName = "mastra",
19
21
  routes,
20
22
  workerNamespace,
21
- auth
23
+ auth,
24
+ d1Databases,
25
+ kvNamespaces
22
26
  }) {
23
27
  super({ name: "CLOUDFLARE" });
24
28
  this.scope = scope;
@@ -28,6 +32,8 @@ var CloudflareDeployer = class extends Deployer {
28
32
  if (env) {
29
33
  this.env = env;
30
34
  }
35
+ if (d1Databases) this.d1Databases = d1Databases;
36
+ if (kvNamespaces) this.kvNamespaces = kvNamespaces;
31
37
  this.cloudflare = new Cloudflare(auth);
32
38
  }
33
39
  async writeFiles(outputDirectory) {
@@ -49,6 +55,12 @@ var CloudflareDeployer = class extends Deployer {
49
55
  if (!this.workerNamespace && this.routes) {
50
56
  wranglerConfig.routes = this.routes;
51
57
  }
58
+ if (this.d1Databases?.length) {
59
+ wranglerConfig.d1_databases = this.d1Databases;
60
+ }
61
+ if (this.kvNamespaces?.length) {
62
+ wranglerConfig.kv_namespaces = this.kvNamespaces;
63
+ }
52
64
  await writeFile(join(outputDirectory, this.outputDir, "wrangler.json"), JSON.stringify(wranglerConfig));
53
65
  }
54
66
  getEntry() {
@@ -73,11 +85,6 @@ var CloudflareDeployer = class extends Deployer {
73
85
  });
74
86
  });
75
87
 
76
- if (mastra.getStorage()) {
77
- // start storage init in the background
78
- mastra.getStorage().init();
79
- }
80
-
81
88
  registerHook(AvailableHooks.ON_EVALUATION, async traceObject => {
82
89
  const storage = mastra.getStorage();
83
90
  if (storage) {
@@ -134,22 +141,8 @@ process.versions.node = '${process.versions.node}';
134
141
  async bundle(entryFile, outputDirectory, toolsPaths) {
135
142
  return this._bundle(this.getEntry(), entryFile, outputDirectory, toolsPaths);
136
143
  }
137
- async deploy(outputDirectory) {
138
- const cmd = this.workerNamespace ? `npm exec -- wrangler@latest deploy --dispatch-namespace ${this.workerNamespace}` : "npm exec -- wrangler@latest deploy";
139
- const cpLogger = createChildProcessLogger({
140
- logger: this.logger,
141
- root: join(outputDirectory, this.outputDir)
142
- });
143
- await cpLogger({
144
- cmd,
145
- args: [],
146
- env: {
147
- CLOUDFLARE_API_TOKEN: this.cloudflare.apiToken,
148
- CLOUDFLARE_ACCOUNT_ID: this.scope,
149
- ...this.env,
150
- PATH: process.env.PATH
151
- }
152
- });
144
+ async deploy() {
145
+ this.logger?.info("Deploying to Cloudflare failed. Please use the Cloudflare dashboard to deploy.");
153
146
  }
154
147
  async tagWorker({
155
148
  workerName,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/deployer-cloudflare",
3
- "version": "0.0.0-trigger-playground-ui-package-20250506151043",
3
+ "version": "0.0.0-tsconfig-compile-20250703214351",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "files": [
@@ -35,23 +35,25 @@
35
35
  "author": "",
36
36
  "license": "Elastic-2.0",
37
37
  "dependencies": {
38
- "@babel/core": "^7.26.10",
38
+ "@babel/core": "^7.27.7",
39
39
  "@rollup/plugin-virtual": "^3.0.2",
40
- "cloudflare": "^4.1.0",
41
- "rollup": "^4.35.0",
42
- "wrangler": "^4.4.0",
43
- "zod": "^3.24.2",
44
- "@mastra/core": "0.0.0-trigger-playground-ui-package-20250506151043",
45
- "@mastra/deployer": "0.0.0-trigger-playground-ui-package-20250506151043"
40
+ "cloudflare": "^4.4.1",
41
+ "rollup": "^4.43.0",
42
+ "zod": "^3.25.67",
43
+ "@mastra/deployer": "0.0.0-tsconfig-compile-20250703214351"
46
44
  },
47
45
  "devDependencies": {
48
- "@microsoft/api-extractor": "^7.52.5",
49
- "@types/node": "^20.17.27",
50
- "eslint": "^9.23.0",
51
- "tsup": "^8.4.0",
52
- "typescript": "^5.8.2",
53
- "vitest": "^3.1.2",
54
- "@internal/lint": "0.0.0-trigger-playground-ui-package-20250506151043"
46
+ "@microsoft/api-extractor": "^7.52.8",
47
+ "@types/node": "^20.19.0",
48
+ "eslint": "^9.29.0",
49
+ "tsup": "^8.5.0",
50
+ "typescript": "^5.8.3",
51
+ "vitest": "^3.2.4",
52
+ "@internal/lint": "0.0.0-tsconfig-compile-20250703214351",
53
+ "@mastra/core": "0.0.0-tsconfig-compile-20250703214351"
54
+ },
55
+ "peerDependencies": {
56
+ "@mastra/core": "0.0.0-tsconfig-compile-20250703214351"
55
57
  },
56
58
  "scripts": {
57
59
  "build": "tsup src/index.ts src/secrets-manager/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting",