@mastra/deployer-cloudflare 0.10.1-alpha.0 → 0.10.1-alpha.3

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;
@@ -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,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;
@@ -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) {
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) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/deployer-cloudflare",
3
- "version": "0.10.1-alpha.0",
3
+ "version": "0.10.1-alpha.3",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "files": [
@@ -41,7 +41,7 @@
41
41
  "rollup": "^4.35.0",
42
42
  "wrangler": "^4.4.0",
43
43
  "zod": "^3.24.3",
44
- "@mastra/deployer": "^0.10.1-alpha.0"
44
+ "@mastra/deployer": "^0.10.1-alpha.3"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@microsoft/api-extractor": "^7.52.5",
@@ -51,7 +51,7 @@
51
51
  "typescript": "^5.8.2",
52
52
  "vitest": "^3.1.2",
53
53
  "@internal/lint": "0.0.6",
54
- "@mastra/core": "0.10.1-alpha.0"
54
+ "@mastra/core": "0.10.1-alpha.3"
55
55
  },
56
56
  "peerDependencies": {
57
57
  "@mastra/core": "^0.10.0"