@mastra/deployer-cloudflare 0.0.0-remove-cloud-span-transform-20250425214156 → 0.0.0-scorers-api-v2-20250801171841

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/LICENSE.md CHANGED
@@ -1,46 +1,15 @@
1
- # Elastic License 2.0 (ELv2)
1
+ # Apache License 2.0
2
2
 
3
- Copyright (c) 2025 Mastra AI, Inc.
3
+ Copyright (c) 2025 Kepler Software, Inc.
4
4
 
5
- **Acceptance**
6
- By using the software, you agree to all of the terms and conditions below.
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
7
8
 
8
- **Copyright License**
9
- The licensor grants you a non-exclusive, royalty-free, worldwide, non-sublicensable, non-transferable license to use, copy, distribute, make available, and prepare derivative works of the software, in each case subject to the limitations and conditions below
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
10
 
11
- **Limitations**
12
- You may not provide the software to third parties as a hosted or managed service, where the service provides users with access to any substantial set of the features or functionality of the software.
13
-
14
- You may not move, change, disable, or circumvent the license key functionality in the software, and you may not remove or obscure any functionality in the software that is protected by the license key.
15
-
16
- You may not alter, remove, or obscure any licensing, copyright, or other notices of the licensor in the software. Any use of the licensor’s trademarks is subject to applicable law.
17
-
18
- **Patents**
19
- The licensor grants you a license, under any patent claims the licensor can license, or becomes able to license, to make, have made, use, sell, offer for sale, import and have imported the software, in each case subject to the limitations and conditions in this license. This license does not cover any patent claims that you cause to be infringed by modifications or additions to the software. If you or your company make any written claim that the software infringes or contributes to infringement of any patent, your patent license for the software granted under these terms ends immediately. If your company makes such a claim, your patent license ends immediately for work on behalf of your company.
20
-
21
- **Notices**
22
- You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these terms.
23
-
24
- If you modify the software, you must include in any modified copies of the software prominent notices stating that you have modified the software.
25
-
26
- **No Other Rights**
27
- These terms do not imply any licenses other than those expressly granted in these terms.
28
-
29
- **Termination**
30
- If you use the software in violation of these terms, such use is not licensed, and your licenses will automatically terminate. If the licensor provides you with a notice of your violation, and you cease all violation of this license no later than 30 days after you receive that notice, your licenses will be reinstated retroactively. However, if you violate these terms after such reinstatement, any additional violation of these terms will cause your licenses to terminate automatically and permanently.
31
-
32
- **No Liability**
33
- As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim.
34
-
35
- **Definitions**
36
- The _licensor_ is the entity offering these terms, and the _software_ is the software the licensor makes available under these terms, including any portion of it.
37
-
38
- _you_ refers to the individual or entity agreeing to these terms.
39
-
40
- _your company_ is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all organizations that have control over, are under the control of, or are under common control with that organization. _control_ means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect.
41
-
42
- _your licenses_ are all the licenses granted to you for the software under these terms.
43
-
44
- _use_ means anything you do with the software requiring one of your licenses.
45
-
46
- _trademark_ means trademarks, service marks, and similar rights.
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
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,29 +11,29 @@ 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;
18
+ d1Databases;
19
+ kvNamespaces;
21
20
  constructor({
22
- scope,
23
21
  env,
24
22
  projectName = "mastra",
25
23
  routes,
26
24
  workerNamespace,
27
- auth
25
+ d1Databases,
26
+ kvNamespaces
28
27
  }) {
29
28
  super({ name: "CLOUDFLARE" });
30
- this.scope = scope;
31
29
  this.projectName = projectName;
32
30
  this.routes = routes;
33
31
  this.workerNamespace = workerNamespace;
34
32
  if (env) {
35
33
  this.env = env;
36
34
  }
37
- this.cloudflare = new cloudflare.Cloudflare(auth);
35
+ if (d1Databases) this.d1Databases = d1Databases;
36
+ if (kvNamespaces) this.kvNamespaces = kvNamespaces;
38
37
  }
39
38
  async writeFiles(outputDirectory) {
40
39
  const env = await this.loadEnvVars();
@@ -55,13 +54,20 @@ var CloudflareDeployer = class extends deployer.Deployer {
55
54
  if (!this.workerNamespace && this.routes) {
56
55
  wranglerConfig.routes = this.routes;
57
56
  }
57
+ if (this.d1Databases?.length) {
58
+ wranglerConfig.d1_databases = this.d1Databases;
59
+ }
60
+ if (this.kvNamespaces?.length) {
61
+ wranglerConfig.kv_namespaces = this.kvNamespaces;
62
+ }
58
63
  await promises.writeFile(path.join(outputDirectory, this.outputDir, "wrangler.json"), JSON.stringify(wranglerConfig));
59
64
  }
60
65
  getEntry() {
61
66
  return `
62
67
  import '#polyfills';
63
68
  import { mastra } from '#mastra';
64
- import { createHonoServer } from '#server';
69
+ import { createHonoServer, getToolExports } from '#server';
70
+ import { tools } from '#tools';
65
71
  import { evaluate } from '@mastra/core/eval';
66
72
  import { AvailableHooks, registerHook } from '@mastra/core/hooks';
67
73
  import { TABLE_EVALS } from '@mastra/core/storage';
@@ -79,11 +85,6 @@ var CloudflareDeployer = class extends deployer.Deployer {
79
85
  });
80
86
  });
81
87
 
82
- if (mastra.getStorage()) {
83
- // start storage init in the background
84
- mastra.getStorage().init();
85
- }
86
-
87
88
  registerHook(AvailableHooks.ON_EVALUATION, async traceObject => {
88
89
  const storage = mastra.getStorage();
89
90
  if (storage) {
@@ -112,7 +113,7 @@ var CloudflareDeployer = class extends deployer.Deployer {
112
113
 
113
114
  export default {
114
115
  fetch: async (request, env, context) => {
115
- const app = await createHonoServer(mastra)
116
+ const app = await createHonoServer(mastra, { tools: getToolExports(tools) });
116
117
  return app.fetch(request, env, context);
117
118
  }
118
119
  }
@@ -140,37 +141,24 @@ process.versions.node = '${process.versions.node}';
140
141
  async bundle(entryFile, outputDirectory, toolsPaths) {
141
142
  return this._bundle(this.getEntry(), entryFile, outputDirectory, toolsPaths);
142
143
  }
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
- });
144
+ async deploy() {
145
+ this.logger?.info("Deploying to Cloudflare failed. Please use the Cloudflare dashboard to deploy.");
159
146
  }
160
- async tagWorker({
161
- workerName,
162
- namespace,
163
- tags,
164
- scope
165
- }) {
166
- if (!this.cloudflare) {
167
- throw new Error("Cloudflare Deployer not initialized");
147
+ async tagWorker() {
148
+ throw new Error("tagWorker method is no longer supported. Use the Cloudflare dashboard or API directly.");
149
+ }
150
+ async lint(entryFile, outputDirectory, toolsPaths) {
151
+ await super.lint(entryFile, outputDirectory, toolsPaths);
152
+ const hasLibsql = await this.deps.checkDependencies(["@mastra/libsql"]) === `ok`;
153
+ if (hasLibsql) {
154
+ this.logger.error(
155
+ "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"
156
+ );
157
+ process.exit(1);
168
158
  }
169
- await this.cloudflare.workersForPlatforms.dispatch.namespaces.scripts.tags.update(namespace, workerName, {
170
- account_id: scope,
171
- body: tags
172
- });
173
159
  }
174
160
  };
175
161
 
176
162
  exports.CloudflareDeployer = CloudflareDeployer;
163
+ //# sourceMappingURL=index.cjs.map
164
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"names":["Deployer","writeFile","join","virtual"],"mappings":";;;;;;;;;;;;AAwBO,IAAM,kBAAA,GAAN,cAAiCA,iBAAA,CAAS;AAAA,EAC/C,SAAqB,EAAC;AAAA,EACtB,eAAA;AAAA,EACA,GAAA;AAAA,EACA,WAAA;AAAA,EACA,WAAA;AAAA,EACA,YAAA;AAAA,EAEA,WAAA,CAAY;AAAA,IACV,GAAA;AAAA,IACA,WAAA,GAAc,QAAA;AAAA,IACd,MAAA;AAAA,IACA,eAAA;AAAA,IACA,WAAA;AAAA,IACA;AAAA,GACF,EAOG;AACD,IAAA,KAAA,CAAM,EAAE,IAAA,EAAM,YAAA,EAAc,CAAA;AAE5B,IAAA,IAAA,CAAK,WAAA,GAAc,WAAA;AACnB,IAAA,IAAA,CAAK,MAAA,GAAS,MAAA;AACd,IAAA,IAAA,CAAK,eAAA,GAAkB,eAAA;AAEvB,IAAA,IAAI,GAAA,EAAK;AACP,MAAA,IAAA,CAAK,GAAA,GAAM,GAAA;AAAA,IACb;AAEA,IAAA,IAAI,WAAA,OAAkB,WAAA,GAAc,WAAA;AACpC,IAAA,IAAI,YAAA,OAAmB,YAAA,GAAe,YAAA;AAAA,EACxC;AAAA,EAEA,MAAM,WAAW,eAAA,EAAwC;AACvD,IAAA,MAAM,GAAA,GAAM,MAAM,IAAA,CAAK,WAAA,EAAY;AACnC,IAAA,MAAM,YAAA,GAAe,MAAA,CAAO,MAAA,CAAO,EAAC,EAAG,MAAA,CAAO,WAAA,CAAY,GAAA,CAAI,OAAA,EAAS,CAAA,EAAG,IAAA,CAAK,GAAG,CAAA;AAElF,IAAA,MAAM,eAAe,IAAA,CAAK,WAAA;AAE1B,IA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A;AAE9E,IAAA,IAAI,SAAA,EAAW;AACb,MAAA,IAAA,CAAK,MAAA,CAAO,KAAA;AAAA,QACV;AAAA,OACF;AACA,MAAA,OAAA,CAAQ,KAAK,CAAC,CAAA;AAAA,IAChB;AAAA,EACF;AACF","file":"index.cjs","sourcesContent":["import { writeFile } from 'fs/promises';\nimport { join } from 'path';\nimport { Deployer } from '@mastra/deployer';\nimport type { analyzeBundle } from '@mastra/deployer/analyze';\nimport virtual from '@rollup/plugin-virtual';\n\ninterface CFRoute {\n pattern: string;\n zone_name: string;\n custom_domain?: boolean;\n}\n\ninterface D1DatabaseBinding {\n binding: string;\n database_name: string;\n database_id: string;\n preview_database_id?: string;\n}\n\ninterface KVNamespaceBinding {\n binding: string;\n id: string;\n}\n\nexport class CloudflareDeployer extends Deployer {\n routes?: CFRoute[] = [];\n workerNamespace?: string;\n env?: Record<string, any>;\n projectName?: string;\n d1Databases?: D1DatabaseBinding[];\n kvNamespaces?: KVNamespaceBinding[];\n\n constructor({\n env,\n projectName = 'mastra',\n routes,\n workerNamespace,\n d1Databases,\n kvNamespaces,\n }: {\n env?: Record<string, any>;\n projectName?: string;\n routes?: CFRoute[];\n workerNamespace?: string;\n d1Databases?: D1DatabaseBinding[];\n kvNamespaces?: KVNamespaceBinding[];\n }) {\n super({ name: 'CLOUDFLARE' });\n\n this.projectName = projectName;\n this.routes = routes;\n this.workerNamespace = workerNamespace;\n\n if (env) {\n this.env = env;\n }\n\n if (d1Databases) this.d1Databases = d1Databases;\n if (kvNamespaces) this.kvNamespaces = kvNamespaces;\n }\n\n async writeFiles(outputDirectory: string): Promise<void> {\n const env = await this.loadEnvVars();\n const envsAsObject = Object.assign({}, Object.fromEntries(env.entries()), this.env);\n\n const cfWorkerName = this.projectName;\n\n const wranglerConfig: Record<string, any> = {\n name: cfWorkerName,\n main: './index.mjs',\n compatibility_date: '2025-04-01',\n compatibility_flags: ['nodejs_compat', 'nodejs_compat_populate_process_env'],\n observability: {\n logs: {\n enabled: true,\n },\n },\n vars: envsAsObject,\n };\n\n if (!this.workerNamespace && this.routes) {\n wranglerConfig.routes = this.routes;\n }\n\n if (this.d1Databases?.length) {\n wranglerConfig.d1_databases = this.d1Databases;\n }\n if (this.kvNamespaces?.length) {\n wranglerConfig.kv_namespaces = this.kvNamespaces;\n }\n await writeFile(join(outputDirectory, this.outputDir, 'wrangler.json'), JSON.stringify(wranglerConfig));\n }\n\n private getEntry(): string {\n return `\n import '#polyfills';\n import { mastra } from '#mastra';\n import { createHonoServer, getToolExports } from '#server';\n import { tools } from '#tools';\n import { evaluate } from '@mastra/core/eval';\n import { AvailableHooks, registerHook } from '@mastra/core/hooks';\n import { TABLE_EVALS } from '@mastra/core/storage';\n import { checkEvalStorageFields } from '@mastra/core/utils';\n\n registerHook(AvailableHooks.ON_GENERATION, ({ input, output, metric, runId, agentName, instructions }) => {\n evaluate({\n agentName,\n input,\n metric,\n output,\n runId,\n globalRunId: runId,\n instructions,\n });\n });\n\n registerHook(AvailableHooks.ON_EVALUATION, async traceObject => {\n const storage = mastra.getStorage();\n if (storage) {\n // Check for required fields\n const logger = mastra?.getLogger();\n const areFieldsValid = checkEvalStorageFields(traceObject, logger);\n if (!areFieldsValid) return;\n\n await storage.insert({\n tableName: TABLE_EVALS,\n record: {\n input: traceObject.input,\n output: traceObject.output,\n result: JSON.stringify(traceObject.result || {}),\n agent_name: traceObject.agentName,\n metric_name: traceObject.metricName,\n instructions: traceObject.instructions,\n test_info: null,\n global_run_id: traceObject.globalRunId,\n run_id: traceObject.runId,\n created_at: new Date().toISOString(),\n },\n });\n }\n });\n\n export default {\n fetch: async (request, env, context) => {\n const app = await createHonoServer(mastra, { tools: getToolExports(tools) });\n return app.fetch(request, env, context);\n }\n }\n`;\n }\n async prepare(outputDirectory: string): Promise<void> {\n await super.prepare(outputDirectory);\n await this.writeFiles(outputDirectory);\n }\n\n async getBundlerOptions(\n serverFile: string,\n mastraEntryFile: string,\n analyzedBundleInfo: Awaited<ReturnType<typeof analyzeBundle>>,\n toolsPaths: string[],\n ) {\n const inputOptions = await super.getBundlerOptions(serverFile, mastraEntryFile, analyzedBundleInfo, toolsPaths);\n\n if (Array.isArray(inputOptions.plugins)) {\n inputOptions.plugins = [\n virtual({\n '#polyfills': `\nprocess.versions = process.versions || {};\nprocess.versions.node = '${process.versions.node}';\n `,\n }),\n ...inputOptions.plugins,\n ];\n }\n\n return inputOptions;\n }\n\n async bundle(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void> {\n return this._bundle(this.getEntry(), entryFile, outputDirectory, toolsPaths);\n }\n\n async deploy(): Promise<void> {\n this.logger?.info('Deploying to Cloudflare failed. Please use the Cloudflare dashboard to deploy.');\n }\n\n async tagWorker(): Promise<void> {\n throw new Error('tagWorker method is no longer supported. Use the Cloudflare dashboard or API directly.');\n }\n\n async lint(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void> {\n await super.lint(entryFile, outputDirectory, toolsPaths);\n\n const hasLibsql = (await this.deps.checkDependencies(['@mastra/libsql'])) === `ok`;\n\n if (hasLibsql) {\n this.logger.error(\n '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',\n );\n process.exit(1);\n }\n }\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -1 +1,43 @@
1
- export { CloudflareDeployer } from './_tsup-dts-rollup.js';
1
+ import { Deployer } from '@mastra/deployer';
2
+ import type { analyzeBundle } from '@mastra/deployer/analyze';
3
+ interface CFRoute {
4
+ pattern: string;
5
+ zone_name: string;
6
+ custom_domain?: boolean;
7
+ }
8
+ interface D1DatabaseBinding {
9
+ binding: string;
10
+ database_name: string;
11
+ database_id: string;
12
+ preview_database_id?: string;
13
+ }
14
+ interface KVNamespaceBinding {
15
+ binding: string;
16
+ id: string;
17
+ }
18
+ export declare class CloudflareDeployer extends Deployer {
19
+ routes?: CFRoute[];
20
+ workerNamespace?: string;
21
+ env?: Record<string, any>;
22
+ projectName?: string;
23
+ d1Databases?: D1DatabaseBinding[];
24
+ kvNamespaces?: KVNamespaceBinding[];
25
+ constructor({ env, projectName, routes, workerNamespace, d1Databases, kvNamespaces, }: {
26
+ env?: Record<string, any>;
27
+ projectName?: string;
28
+ routes?: CFRoute[];
29
+ workerNamespace?: string;
30
+ d1Databases?: D1DatabaseBinding[];
31
+ kvNamespaces?: KVNamespaceBinding[];
32
+ });
33
+ writeFiles(outputDirectory: string): Promise<void>;
34
+ private getEntry;
35
+ prepare(outputDirectory: string): Promise<void>;
36
+ getBundlerOptions(serverFile: string, mastraEntryFile: string, analyzedBundleInfo: Awaited<ReturnType<typeof analyzeBundle>>, toolsPaths: string[]): Promise<import("rollup").InputOptions>;
37
+ bundle(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void>;
38
+ deploy(): Promise<void>;
39
+ tagWorker(): Promise<void>;
40
+ lint(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void>;
41
+ }
42
+ export {};
43
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAG9D,UAAU,OAAO;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,UAAU,iBAAiB;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,UAAU,kBAAkB;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,qBAAa,kBAAmB,SAAQ,QAAQ;IAC9C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U,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAY5F"}
package/dist/index.js CHANGED
@@ -1,34 +1,33 @@
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
- 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;
12
+ d1Databases;
13
+ kvNamespaces;
15
14
  constructor({
16
- scope,
17
15
  env,
18
16
  projectName = "mastra",
19
17
  routes,
20
18
  workerNamespace,
21
- auth
19
+ d1Databases,
20
+ kvNamespaces
22
21
  }) {
23
22
  super({ name: "CLOUDFLARE" });
24
- this.scope = scope;
25
23
  this.projectName = projectName;
26
24
  this.routes = routes;
27
25
  this.workerNamespace = workerNamespace;
28
26
  if (env) {
29
27
  this.env = env;
30
28
  }
31
- this.cloudflare = new Cloudflare(auth);
29
+ if (d1Databases) this.d1Databases = d1Databases;
30
+ if (kvNamespaces) this.kvNamespaces = kvNamespaces;
32
31
  }
33
32
  async writeFiles(outputDirectory) {
34
33
  const env = await this.loadEnvVars();
@@ -49,13 +48,20 @@ var CloudflareDeployer = class extends Deployer {
49
48
  if (!this.workerNamespace && this.routes) {
50
49
  wranglerConfig.routes = this.routes;
51
50
  }
51
+ if (this.d1Databases?.length) {
52
+ wranglerConfig.d1_databases = this.d1Databases;
53
+ }
54
+ if (this.kvNamespaces?.length) {
55
+ wranglerConfig.kv_namespaces = this.kvNamespaces;
56
+ }
52
57
  await writeFile(join(outputDirectory, this.outputDir, "wrangler.json"), JSON.stringify(wranglerConfig));
53
58
  }
54
59
  getEntry() {
55
60
  return `
56
61
  import '#polyfills';
57
62
  import { mastra } from '#mastra';
58
- import { createHonoServer } from '#server';
63
+ import { createHonoServer, getToolExports } from '#server';
64
+ import { tools } from '#tools';
59
65
  import { evaluate } from '@mastra/core/eval';
60
66
  import { AvailableHooks, registerHook } from '@mastra/core/hooks';
61
67
  import { TABLE_EVALS } from '@mastra/core/storage';
@@ -73,11 +79,6 @@ var CloudflareDeployer = class extends Deployer {
73
79
  });
74
80
  });
75
81
 
76
- if (mastra.getStorage()) {
77
- // start storage init in the background
78
- mastra.getStorage().init();
79
- }
80
-
81
82
  registerHook(AvailableHooks.ON_EVALUATION, async traceObject => {
82
83
  const storage = mastra.getStorage();
83
84
  if (storage) {
@@ -106,7 +107,7 @@ var CloudflareDeployer = class extends Deployer {
106
107
 
107
108
  export default {
108
109
  fetch: async (request, env, context) => {
109
- const app = await createHonoServer(mastra)
110
+ const app = await createHonoServer(mastra, { tools: getToolExports(tools) });
110
111
  return app.fetch(request, env, context);
111
112
  }
112
113
  }
@@ -134,37 +135,24 @@ process.versions.node = '${process.versions.node}';
134
135
  async bundle(entryFile, outputDirectory, toolsPaths) {
135
136
  return this._bundle(this.getEntry(), entryFile, outputDirectory, toolsPaths);
136
137
  }
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
- });
138
+ async deploy() {
139
+ this.logger?.info("Deploying to Cloudflare failed. Please use the Cloudflare dashboard to deploy.");
153
140
  }
154
- async tagWorker({
155
- workerName,
156
- namespace,
157
- tags,
158
- scope
159
- }) {
160
- if (!this.cloudflare) {
161
- throw new Error("Cloudflare Deployer not initialized");
141
+ async tagWorker() {
142
+ throw new Error("tagWorker method is no longer supported. Use the Cloudflare dashboard or API directly.");
143
+ }
144
+ async lint(entryFile, outputDirectory, toolsPaths) {
145
+ await super.lint(entryFile, outputDirectory, toolsPaths);
146
+ const hasLibsql = await this.deps.checkDependencies(["@mastra/libsql"]) === `ok`;
147
+ if (hasLibsql) {
148
+ this.logger.error(
149
+ "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"
150
+ );
151
+ process.exit(1);
162
152
  }
163
- await this.cloudflare.workersForPlatforms.dispatch.namespaces.scripts.tags.update(namespace, workerName, {
164
- account_id: scope,
165
- body: tags
166
- });
167
153
  }
168
154
  };
169
155
 
170
156
  export { CloudflareDeployer };
157
+ //# sourceMappingURL=index.js.map
158
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAwBO,IAAM,kBAAA,GAAN,cAAiC,QAAA,CAAS;AAAA,EAC/C,SAAqB,EAAC;AAAA,EACtB,eAAA;AAAA,EACA,GAAA;AAAA,EACA,WAAA;AAAA,EACA,WAAA;AAAA,EACA,YAAA;AAAA,EAEA,WAAA,CAAY;AAAA,IACV,GAAA;AAAA,IACA,WAAA,GAAc,QAAA;AAAA,IACd,MAAA;AAAA,IACA,eAAA;AAAA,IACA,WAAA;AAAA,IACA;AAAA,GACF,EAOG;AACD,IAAA,KAAA,CAAM,EAAE,IAAA,EAAM,YAAA,EAAc,CAAA;AAE5B,IAAA,IAAA,CAAK,WAAA,GAAc,WAAA;AACnB,IAAA,IAAA,CAAK,MAAA,GAAS,MAAA;AACd,IAAA,IAAA,CAAK,eAAA,GAAkB,eAAA;AAEvB,IAAA,IAAI,GAAA,EAAK;AACP,MAAA,IAAA,CAAK,GAAA,GAAM,GAAA;AAAA,IACb;AAEA,IAAA,IAAI,WAAA,OAAkB,WAAA,GAAc,WAAA;AACpC,IAAA,IAA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AAA,GAA2B;AAC/B,IAAA,MAAM,IAAI,MAAM,wFAAwF,CAAA;AAAA,EAC1G;AAAA,EAEA,MAAM,IAAA,CAAK,SAAA,EAAmB,eAAA,EAAyB,UAAA,EAAqC;AAC1F,IAAA,MAAM,KAAA,CAAM,IAAA,CAAK,SAAA,EAAW,eAAA,EAAiB,UAAU,CAAA;AAEvD,IAAA,MAAM,SAAA,GAAa,MAAM,IAAA,CAAK,IAAA,CAAK,kBAAkB,CAAC,gBAAgB,CAAC,CAAA,KAAO,CAAA,EAAA,CAAA;AAE9E,IAAA,IAAI,SAAA,EAAW;AACb,MAAA,IAAA,CAAK,MAAA,CAAO,KAAA;AAAA,QACV;AAAA,OACF;AACA,MAAA,OAAA,CAAQ,KAAK,CAAC,CAAA;AAAA,IAChB;AAAA,EACF;AACF","file":"index.js","sourcesContent":["import { writeFile } from 'fs/promises';\nimport { join } from 'path';\nimport { Deployer } from '@mastra/deployer';\nimport type { analyzeBundle } from '@mastra/deployer/analyze';\nimport virtual from '@rollup/plugin-virtual';\n\ninterface CFRoute {\n pattern: string;\n zone_name: string;\n custom_domain?: boolean;\n}\n\ninterface D1DatabaseBinding {\n binding: string;\n database_name: string;\n database_id: string;\n preview_database_id?: string;\n}\n\ninterface KVNamespaceBinding {\n binding: string;\n id: string;\n}\n\nexport class CloudflareDeployer extends Deployer {\n routes?: CFRoute[] = [];\n workerNamespace?: string;\n env?: Record<string, any>;\n projectName?: string;\n d1Databases?: D1DatabaseBinding[];\n kvNamespaces?: KVNamespaceBinding[];\n\n constructor({\n env,\n projectName = 'mastra',\n routes,\n workerNamespace,\n d1Databases,\n kvNamespaces,\n }: {\n env?: Record<string, any>;\n projectName?: string;\n routes?: CFRoute[];\n workerNamespace?: string;\n d1Databases?: D1DatabaseBinding[];\n kvNamespaces?: KVNamespaceBinding[];\n }) {\n super({ name: 'CLOUDFLARE' });\n\n this.projectName = projectName;\n this.routes = routes;\n this.workerNamespace = workerNamespace;\n\n if (env) {\n this.env = env;\n }\n\n if (d1Databases) this.d1Databases = d1Databases;\n if (kvNamespaces) this.kvNamespaces = kvNamespaces;\n }\n\n async writeFiles(outputDirectory: string): Promise<void> {\n const env = await this.loadEnvVars();\n const envsAsObject = Object.assign({}, Object.fromEntries(env.entries()), this.env);\n\n const cfWorkerName = this.projectName;\n\n const wranglerConfig: Record<string, any> = {\n name: cfWorkerName,\n main: './index.mjs',\n compatibility_date: '2025-04-01',\n compatibility_flags: ['nodejs_compat', 'nodejs_compat_populate_process_env'],\n observability: {\n logs: {\n enabled: true,\n },\n },\n vars: envsAsObject,\n };\n\n if (!this.workerNamespace && this.routes) {\n wranglerConfig.routes = this.routes;\n }\n\n if (this.d1Databases?.length) {\n wranglerConfig.d1_databases = this.d1Databases;\n }\n if (this.kvNamespaces?.length) {\n wranglerConfig.kv_namespaces = this.kvNamespaces;\n }\n await writeFile(join(outputDirectory, this.outputDir, 'wrangler.json'), JSON.stringify(wranglerConfig));\n }\n\n private getEntry(): string {\n return `\n import '#polyfills';\n import { mastra } from '#mastra';\n import { createHonoServer, getToolExports } from '#server';\n import { tools } from '#tools';\n import { evaluate } from '@mastra/core/eval';\n import { AvailableHooks, registerHook } from '@mastra/core/hooks';\n import { TABLE_EVALS } from '@mastra/core/storage';\n import { checkEvalStorageFields } from '@mastra/core/utils';\n\n registerHook(AvailableHooks.ON_GENERATION, ({ input, output, metric, runId, agentName, instructions }) => {\n evaluate({\n agentName,\n input,\n metric,\n output,\n runId,\n globalRunId: runId,\n instructions,\n });\n });\n\n registerHook(AvailableHooks.ON_EVALUATION, async traceObject => {\n const storage = mastra.getStorage();\n if (storage) {\n // Check for required fields\n const logger = mastra?.getLogger();\n const areFieldsValid = checkEvalStorageFields(traceObject, logger);\n if (!areFieldsValid) return;\n\n await storage.insert({\n tableName: TABLE_EVALS,\n record: {\n input: traceObject.input,\n output: traceObject.output,\n result: JSON.stringify(traceObject.result || {}),\n agent_name: traceObject.agentName,\n metric_name: traceObject.metricName,\n instructions: traceObject.instructions,\n test_info: null,\n global_run_id: traceObject.globalRunId,\n run_id: traceObject.runId,\n created_at: new Date().toISOString(),\n },\n });\n }\n });\n\n export default {\n fetch: async (request, env, context) => {\n const app = await createHonoServer(mastra, { tools: getToolExports(tools) });\n return app.fetch(request, env, context);\n }\n }\n`;\n }\n async prepare(outputDirectory: string): Promise<void> {\n await super.prepare(outputDirectory);\n await this.writeFiles(outputDirectory);\n }\n\n async getBundlerOptions(\n serverFile: string,\n mastraEntryFile: string,\n analyzedBundleInfo: Awaited<ReturnType<typeof analyzeBundle>>,\n toolsPaths: string[],\n ) {\n const inputOptions = await super.getBundlerOptions(serverFile, mastraEntryFile, analyzedBundleInfo, toolsPaths);\n\n if (Array.isArray(inputOptions.plugins)) {\n inputOptions.plugins = [\n virtual({\n '#polyfills': `\nprocess.versions = process.versions || {};\nprocess.versions.node = '${process.versions.node}';\n `,\n }),\n ...inputOptions.plugins,\n ];\n }\n\n return inputOptions;\n }\n\n async bundle(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void> {\n return this._bundle(this.getEntry(), entryFile, outputDirectory, toolsPaths);\n }\n\n async deploy(): Promise<void> {\n this.logger?.info('Deploying to Cloudflare failed. Please use the Cloudflare dashboard to deploy.');\n }\n\n async tagWorker(): Promise<void> {\n throw new Error('tagWorker method is no longer supported. Use the Cloudflare dashboard or API directly.');\n }\n\n async lint(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void> {\n await super.lint(entryFile, outputDirectory, toolsPaths);\n\n const hasLibsql = (await this.deps.checkDependencies(['@mastra/libsql'])) === `ok`;\n\n if (hasLibsql) {\n this.logger.error(\n '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',\n );\n process.exit(1);\n }\n }\n}\n"]}
@@ -87,3 +87,5 @@ var CloudflareSecretsManager = class {
87
87
  };
88
88
 
89
89
  exports.CloudflareSecretsManager = CloudflareSecretsManager;
90
+ //# sourceM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;AAAA,EAEA,MAAM,YAAY,QAAA,EAAkB;AAClC,IAAA,MAAM,GAAA,GAAM,GAAG,IAAA,CAAK,OAAO,aAAa,IAAA,CAAK,SAAS,oBAAoB,QAAQ,CAAA,QAAA,CAAA;AAElF,IAAA,IAAI;AACF,MAAA,MAAM,QAAA,GAAW,MAAM,KAAA,CAAM,GAAA,EAAK;AAAA,QAChC,OAAA,EAAS;AAAA,UACP,aAAA,EAAe,CAAA,OAAA,EAAU,IAAA,CAAK,QAAQ,CAAA;AAAA;AACxC,OACD,CAAA;AAED,MAAA,MAAM,IAAA,GAAQ,MAAM,QAAA,CAAS,IAAA,EAAK;AAElC,MAAA,IAAI,CAAC,KAAK,OAAA,EAAS;AACjB,QAAA,MAAM,IAAI,KAAA,CAAM,IAAA,CAAK,MAAA,CAAO,CAAC,EAAE,OAAO,CAAA;AAAA,MACxC;AAEA,MAAA,OAAO,IAAA,CAAK,MAAA;AAAA,IACd,SAAS,KAAA,EAAO;AACd,MAAA,OAAA,CAAQ,KAAA,CAAM,2BAA2B,KAAK,CAAA;AAC9C,MAAA,MAAM,KAAA;AAAA,IACR;AAAA,EACF;AACF","file":"index.cjs","sourcesContent":["export class CloudflareSecretsManager {\n accountId: string;\n apiToken: string;\n baseUrl: string;\n\n constructor({ accountId, apiToken }: { accountId: string; apiToken: string }) {\n this.accountId = accountId;\n this.apiToken = apiToken;\n this.baseUrl = 'https://api.cloudflare.com/client/v4';\n }\n\n async createSecret({\n workerId,\n secretName,\n secretValue,\n }: {\n workerId: string;\n secretName: string;\n secretValue: string;\n }) {\n const url = `${this.baseUrl}/accounts/${this.accountId}/workers/scripts/${workerId}/secrets`;\n\n try {\n const response = await fetch(url, {\n method: 'PUT',\n headers: {\n Authorization: `Bearer ${this.apiToken}`,\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n name: secretName,\n text: secretValue,\n }),\n });\n\n const data = (await response.json()) as { success: boolean; result: any; errors: any[] };\n\n if (!data.success) {\n throw new Error(data.errors[0].message);\n }\n\n return data.result;\n } catch (error) {\n console.error('Failed to create secret:', error);\n throw error;\n }\n }\n\n async createProjectSecrets({\n workerId,\n customerId,\n envVars,\n }: {\n workerId: string;\n customerId: string;\n envVars: Record<string, string>;\n }) {\n const secretName = `PROJECT_${customerId.toUpperCase()}`;\n const secretValue = JSON.stringify(envVars);\n\n return this.createSecret({ workerId, secretName, secretValue });\n }\n\n async deleteSecret({ workerId, secretName }: { workerId: string; secretName: string }) {\n const url = `${this.baseUrl}/accounts/${this.accountId}/workers/scripts/${workerId}/secrets/${secretName}`;\n\n try {\n const response = await fetch(url, {\n method: 'DELETE',\n headers: {\n Authorization: `Bearer ${this.apiToken}`,\n },\n });\n\n const data = (await response.json()) as { success: boolean; result: any; errors: any[] };\n\n if (!data.success) {\n throw new Error(data.errors[0].message);\n }\n\n return data.result;\n } catch (error) {\n console.error('Failed to delete secret:', error);\n throw error;\n }\n }\n\n async listSecrets(workerId: string) {\n const url = `${this.baseUrl}/accounts/${this.accountId}/workers/scripts/${workerId}/secrets`;\n\n try {\n const response = await fetch(url, {\n headers: {\n Authorization: `Bearer ${this.apiToken}`,\n },\n });\n\n const data = (await response.json()) as { success: boolean; result: any; errors: any[] };\n\n if (!data.success) {\n throw new Error(data.errors[0].message);\n }\n\n return data.result;\n } catch (error) {\n console.error('Failed to list secrets:', error);\n throw error;\n }\n }\n}\n"]}
@@ -1 +1,25 @@
1
- export { CloudflareSecretsManager } from '../_tsup-dts-rollup.js';
1
+ export declare class CloudflareSecretsManager {
2
+ accountId: string;
3
+ apiToken: string;
4
+ baseUrl: string;
5
+ constructor({ accountId, apiToken }: {
6
+ accountId: string;
7
+ apiToken: string;
8
+ });
9
+ createSecret({ workerId, secretName, secretValue, }: {
10
+ workerId: string;
11
+ secretName: string;
12
+ secretValue: string;
13
+ }): Promise<any>;
14
+ createProjectSecrets({ workerId, customerId, envVars, }: {
15
+ workerId: string;
16
+ customerId: string;
17
+ envVars: Record<string, string>;
18
+ }): Promise<any>;
19
+ deleteSecret({ workerId, secretName }: {
20
+ workerId: string;
21
+ secretName: string;
22
+ }): Promise<any>;
23
+ listSecrets(workerId: string): Promise<any>;
24
+ }
25
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/secrets-manager/index.ts"],"names":[],"mappings":"AAAA,qBAAa,wBAAwB;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;gBAEJ,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE;IAMtE,YAAY,CAAC,EACjB,QAAQ,EACR,UAAU,EACV,WAAW,GACZ,EAAE;QACD,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;QACnB,WAAW,EAAE,MAAM,CAAC;KACrB;IA6BK,oBAAoB,CAAC,EACzB,QAAQ,EACR,UAAU,EACV,OAAO,GACR,EAAE;QACD,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;QACnB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACjC;IAOK,YAAY,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE;IAwB/E,WAAW,CAAC,QAAQ,EAAE,MAAM;CAsBnC"}
@@ -85,3 +85,5 @@ var CloudflareSecretsManager = class {
85
85
  };
86
86
 
87
87
  export { CloudflareSecretsManager };
88
+ //# sourceMappingURL=index.js.map
89
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/secrets-manager/index.ts"],"names":[],"mappings":";AAAO,IAAM,2BAAN,MAA+B;AAAA,EACpC,SAAA;AAAA,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AI;AACF,MAAA,MAAM,QAAA,GAAW,MAAM,KAAA,CAAM,GAAA,EAAK;AAAA,QAChC,OAAA,EAAS;AAAA,UACP,aAAA,EAAe,CAAA,OAAA,EAAU,IAAA,CAAK,QAAQ,CAAA;AAAA;AACxC,OACD,CAAA;AAED,MAAA,MAAM,IAAA,GAAQ,MAAM,QAAA,CAAS,IAAA,EAAK;AAElC,MAAA,IAAI,CAAC,KAAK,OAAA,EAAS;AACjB,QAAA,MAAM,IAAI,KAAA,CAAM,IAAA,CAAK,MAAA,CAAO,CAAC,EAAE,OAAO,CAAA;AAAA,MACxC;AAEA,MAAA,OAAO,IAAA,CAAK,MAAA;AAAA,IACd,SAAS,KAAA,EAAO;AACd,MAAA,OAAA,CAAQ,KAAA,CAAM,2BAA2B,KAAK,CAAA;AAC9C,MAAA,MAAM,KAAA;AAAA,IACR;AAAA,EACF;AACF","file":"index.js","sourcesContent":["export class CloudflareSecretsManager {\n accountId: string;\n apiToken: string;\n baseUrl: string;\n\n constructor({ accountId, apiToken }: { accountId: string; apiToken: string }) {\n this.accountId = accountId;\n this.apiToken = apiToken;\n this.baseUrl = 'https://api.cloudflare.com/client/v4';\n }\n\n async createSecret({\n workerId,\n secretName,\n secretValue,\n }: {\n workerId: string;\n secretName: string;\n secretValue: string;\n }) {\n const url = `${this.baseUrl}/accounts/${this.accountId}/workers/scripts/${workerId}/secrets`;\n\n try {\n const response = await fetch(url, {\n method: 'PUT',\n headers: {\n Authorization: `Bearer ${this.apiToken}`,\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n name: secretName,\n text: secretValue,\n }),\n });\n\n const data = (await response.json()) as { success: boolean; result: any; errors: any[] };\n\n if (!data.success) {\n throw new Error(data.errors[0].message);\n }\n\n return data.result;\n } catch (error) {\n console.error('Failed to create secret:', error);\n throw error;\n }\n }\n\n async createProjectSecrets({\n workerId,\n customerId,\n envVars,\n }: {\n workerId: string;\n customerId: string;\n envVars: Record<string, string>;\n }) {\n const secretName = `PROJECT_${customerId.toUpperCase()}`;\n const secretValue = JSON.stringify(envVars);\n\n return this.createSecret({ workerId, secretName, secretValue });\n }\n\n async deleteSecret({ workerId, secretName }: { workerId: string; secretName: string }) {\n const url = `${this.baseUrl}/accounts/${this.accountId}/workers/scripts/${workerId}/secrets/${secretName}`;\n\n try {\n const response = await fetch(url, {\n method: 'DELETE',\n headers: {\n Authorization: `Bearer ${this.apiToken}`,\n },\n });\n\n const data = (await response.json()) as { success: boolean; result: any; errors: any[] };\n\n if (!data.success) {\n throw new Error(data.errors[0].message);\n }\n\n return data.result;\n } catch (error) {\n console.error('Failed to delete secret:', error);\n throw error;\n }\n }\n\n async listSecrets(workerId: string) {\n const url = `${this.baseUrl}/accounts/${this.accountId}/workers/scripts/${workerId}/secrets`;\n\n try {\n const response = await fetch(url, {\n headers: {\n Authorization: `Bearer ${this.apiToken}`,\n },\n });\n\n const data = (await response.json()) as { success: boolean; result: any; errors: any[] };\n\n if (!data.success) {\n throw new Error(data.errors[0].message);\n }\n\n return data.result;\n } catch (error) {\n console.error('Failed to list secrets:', error);\n throw error;\n }\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/deployer-cloudflare",
3
- "version": "0.0.0-remove-cloud-span-transform-20250425214156",
3
+ "version": "0.0.0-scorers-api-v2-20250801171841",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "files": [
@@ -33,29 +33,31 @@
33
33
  },
34
34
  "keywords": [],
35
35
  "author": "",
36
- "license": "Elastic-2.0",
36
+ "license": "Apache-2.0",
37
37
  "dependencies": {
38
- "@babel/core": "^7.26.10",
38
+ "@babel/core": "^7.28.0",
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/deployer": "0.0.0-remove-cloud-span-transform-20250425214156",
45
- "@mastra/core": "0.0.0-remove-cloud-span-transform-20250425214156"
40
+ "cloudflare": "^4.5.0",
41
+ "rollup": "~4.44.2",
42
+ "zod": "^3.25.67",
43
+ "@mastra/deployer": "0.0.0-scorers-api-v2-20250801171841"
46
44
  },
47
45
  "devDependencies": {
48
- "@microsoft/api-extractor": "^7.52.1",
49
- "@types/node": "^20.17.27",
50
- "eslint": "^9.23.0",
51
- "tsup": "^8.4.0",
52
- "typescript": "^5.8.2",
53
- "vitest": "^3.0.9",
54
- "@internal/lint": "0.0.2"
46
+ "@microsoft/api-extractor": "^7.52.8",
47
+ "@types/node": "^20.19.0",
48
+ "eslint": "^9.30.1",
49
+ "tsup": "^8.5.0",
50
+ "typescript": "^5.8.3",
51
+ "vitest": "^3.2.4",
52
+ "@internal/lint": "0.0.0-scorers-api-v2-20250801171841",
53
+ "@mastra/core": "0.0.0-scorers-api-v2-20250801171841"
54
+ },
55
+ "peerDependencies": {
56
+ "@mastra/core": "0.0.0-scorers-api-v2-20250801171841"
55
57
  },
56
58
  "scripts": {
57
- "build": "tsup src/index.ts src/secrets-manager/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting",
58
- "build:watch": "pnpm build --watch",
59
+ "build": "tsup --silent --config tsup.config.ts",
60
+ "build:watch": "tsup --watch --silent --config tsup.config.ts",
59
61
  "test": "vitest run",
60
62
  "lint": "eslint ."
61
63
  }
@@ -1,68 +0,0 @@
1
- import type { analyzeBundle } from '@mastra/deployer/analyze';
2
- import { Deployer } from '@mastra/deployer';
3
- import { InputOptions } from 'rollup';
4
-
5
- declare interface CFRoute {
6
- pattern: string;
7
- zone_name: string;
8
- custom_domain?: boolean;
9
- }
10
-
11
- export declare class CloudflareDeployer extends Deployer {
12
- private cloudflare;
13
- routes?: CFRoute[];
14
- workerNamespace?: string;
15
- scope: string;
16
- env?: Record<string, any>;
17
- projectName?: string;
18
- constructor({ scope, env, projectName, routes, workerNamespace, auth, }: {
19
- env?: Record<string, any>;
20
- scope: string;
21
- projectName?: string;
22
- routes?: CFRoute[];
23
- workerNamespace?: string;
24
- auth: {
25
- apiToken: string;
26
- apiEmail?: string;
27
- };
28
- });
29
- writeFiles(outputDirectory: string): Promise<void>;
30
- private getEntry;
31
- prepare(outputDirectory: string): Promise<void>;
32
- getBundlerOptions(serverFile: string, mastraEntryFile: string, analyzedBundleInfo: Awaited<ReturnType<typeof analyzeBundle>>, toolsPaths: string[]): Promise<InputOptions>;
33
- bundle(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void>;
34
- deploy(outputDirectory: string): Promise<void>;
35
- tagWorker({ workerName, namespace, tags, scope, }: {
36
- scope: string;
37
- workerName: string;
38
- namespace: string;
39
- tags: string[];
40
- }): Promise<void>;
41
- }
42
-
43
- export declare class CloudflareSecretsManager {
44
- accountId: string;
45
- apiToken: string;
46
- baseUrl: string;
47
- constructor({ accountId, apiToken }: {
48
- accountId: string;
49
- apiToken: string;
50
- });
51
- createSecret({ workerId, secretName, secretValue, }: {
52
- workerId: string;
53
- secretName: string;
54
- secretValue: string;
55
- }): Promise<any>;
56
- createProjectSecrets({ workerId, customerId, envVars, }: {
57
- workerId: string;
58
- customerId: string;
59
- envVars: Record<string, string>;
60
- }): Promise<any>;
61
- deleteSecret({ workerId, secretName }: {
62
- workerId: string;
63
- secretName: string;
64
- }): Promise<any>;
65
- listSecrets(workerId: string): Promise<any>;
66
- }
67
-
68
- export { }
@@ -1,68 +0,0 @@
1
- import type { analyzeBundle } from '@mastra/deployer/analyze';
2
- import { Deployer } from '@mastra/deployer';
3
- import { InputOptions } from 'rollup';
4
-
5
- declare interface CFRoute {
6
- pattern: string;
7
- zone_name: string;
8
- custom_domain?: boolean;
9
- }
10
-
11
- export declare class CloudflareDeployer extends Deployer {
12
- private cloudflare;
13
- routes?: CFRoute[];
14
- workerNamespace?: string;
15
- scope: string;
16
- env?: Record<string, any>;
17
- projectName?: string;
18
- constructor({ scope, env, projectName, routes, workerNamespace, auth, }: {
19
- env?: Record<string, any>;
20
- scope: string;
21
- projectName?: string;
22
- routes?: CFRoute[];
23
- workerNamespace?: string;
24
- auth: {
25
- apiToken: string;
26
- apiEmail?: string;
27
- };
28
- });
29
- writeFiles(outputDirectory: string): Promise<void>;
30
- private getEntry;
31
- prepare(outputDirectory: string): Promise<void>;
32
- getBundlerOptions(serverFile: string, mastraEntryFile: string, analyzedBundleInfo: Awaited<ReturnType<typeof analyzeBundle>>, toolsPaths: string[]): Promise<InputOptions>;
33
- bundle(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void>;
34
- deploy(outputDirectory: string): Promise<void>;
35
- tagWorker({ workerName, namespace, tags, scope, }: {
36
- scope: string;
37
- workerName: string;
38
- namespace: string;
39
- tags: string[];
40
- }): Promise<void>;
41
- }
42
-
43
- export declare class CloudflareSecretsManager {
44
- accountId: string;
45
- apiToken: string;
46
- baseUrl: string;
47
- constructor({ accountId, apiToken }: {
48
- accountId: string;
49
- apiToken: string;
50
- });
51
- createSecret({ workerId, secretName, secretValue, }: {
52
- workerId: string;
53
- secretName: string;
54
- secretValue: string;
55
- }): Promise<any>;
56
- createProjectSecrets({ workerId, customerId, envVars, }: {
57
- workerId: string;
58
- customerId: string;
59
- envVars: Record<string, string>;
60
- }): Promise<any>;
61
- deleteSecret({ workerId, secretName }: {
62
- workerId: string;
63
- secretName: string;
64
- }): Promise<any>;
65
- listSecrets(workerId: string): Promise<any>;
66
- }
67
-
68
- export { }
package/dist/index.d.cts DELETED
@@ -1 +0,0 @@
1
- export { CloudflareDeployer } from './_tsup-dts-rollup.cjs';
@@ -1 +0,0 @@
1
- export { CloudflareSecretsManager } from '../_tsup-dts-rollup.cjs';