@mastra/deployer-cloudflare 0.0.0-mcp-server-deploy-20250507160341 → 0.0.0-pass-headers-for-create-mastra-client-20250529190531

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,6 +27,8 @@ 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;
@@ -38,6 +42,7 @@ export declare class CloudflareDeployer extends Deployer {
38
42
  namespace: string;
39
43
  tags: string[];
40
44
  }): Promise<void>;
45
+ lint(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void>;
41
46
  }
42
47
 
43
48
  export declare class CloudflareSecretsManager {
@@ -65,4 +70,16 @@ export declare class CloudflareSecretsManager {
65
70
  listSecrets(workerId: string): Promise<any>;
66
71
  }
67
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
+
68
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,6 +27,8 @@ 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;
@@ -38,6 +42,7 @@ export declare class CloudflareDeployer extends Deployer {
38
42
  namespace: string;
39
43
  tags: string[];
40
44
  }): Promise<void>;
45
+ lint(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void>;
41
46
  }
42
47
 
43
48
  export declare class CloudflareSecretsManager {
@@ -65,4 +70,16 @@ export declare class CloudflareSecretsManager {
65
70
  listSecrets(workerId: string): Promise<any>;
66
71
  }
67
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
+
68
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) {
@@ -171,6 +178,16 @@ process.versions.node = '${process.versions.node}';
171
178
  body: tags
172
179
  });
173
180
  }
181
+ async lint(entryFile, outputDirectory, toolsPaths) {
182
+ await super.lint(entryFile, outputDirectory, toolsPaths);
183
+ const hasLibsql = await this.deps.checkDependencies(["@mastra/libsql"]) === `ok`;
184
+ if (hasLibsql) {
185
+ this.logger.error(
186
+ "Cloudflare Deployer does not support @libsql/client(which may have been installed by @mastra/libsql) as a dependency. Please use Cloudflare D1 instead @mastra/cloudflare-d1"
187
+ );
188
+ process.exit(1);
189
+ }
190
+ }
174
191
  };
175
192
 
176
193
  exports.CloudflareDeployer = CloudflareDeployer;
package/dist/index.js CHANGED
@@ -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) {
@@ -165,6 +172,16 @@ process.versions.node = '${process.versions.node}';
165
172
  body: tags
166
173
  });
167
174
  }
175
+ async lint(entryFile, outputDirectory, toolsPaths) {
176
+ await super.lint(entryFile, outputDirectory, toolsPaths);
177
+ const hasLibsql = await this.deps.checkDependencies(["@mastra/libsql"]) === `ok`;
178
+ if (hasLibsql) {
179
+ this.logger.error(
180
+ "Cloudflare Deployer does not support @libsql/client(which may have been installed by @mastra/libsql) as a dependency. Please use Cloudflare D1 instead @mastra/cloudflare-d1"
181
+ );
182
+ process.exit(1);
183
+ }
184
+ }
168
185
  };
169
186
 
170
187
  export { CloudflareDeployer };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/deployer-cloudflare",
3
- "version": "0.0.0-mcp-server-deploy-20250507160341",
3
+ "version": "0.0.0-pass-headers-for-create-mastra-client-20250529190531",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "files": [
@@ -40,9 +40,8 @@
40
40
  "cloudflare": "^4.1.0",
41
41
  "rollup": "^4.35.0",
42
42
  "wrangler": "^4.4.0",
43
- "zod": "^3.24.2",
44
- "@mastra/core": "0.0.0-mcp-server-deploy-20250507160341",
45
- "@mastra/deployer": "0.0.0-mcp-server-deploy-20250507160341"
43
+ "zod": "^3.24.3",
44
+ "@mastra/deployer": "0.0.0-pass-headers-for-create-mastra-client-20250529190531"
46
45
  },
47
46
  "devDependencies": {
48
47
  "@microsoft/api-extractor": "^7.52.5",
@@ -51,7 +50,11 @@
51
50
  "tsup": "^8.4.0",
52
51
  "typescript": "^5.8.2",
53
52
  "vitest": "^3.1.2",
54
- "@internal/lint": "0.0.2"
53
+ "@mastra/core": "0.0.0-pass-headers-for-create-mastra-client-20250529190531",
54
+ "@internal/lint": "0.0.0-pass-headers-for-create-mastra-client-20250529190531"
55
+ },
56
+ "peerDependencies": {
57
+ "@mastra/core": "^0.10.0"
55
58
  },
56
59
  "scripts": {
57
60
  "build": "tsup src/index.ts src/secrets-manager/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting",