@mastra/deployer-netlify 0.0.0-vector-query-sources-20250516172905 → 0.0.0-vector-query-tool-provider-options-20250828222356

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
@@ -1,96 +1,22 @@
1
1
  'use strict';
2
2
 
3
- var fs = require('fs');
4
3
  var path = require('path');
4
+ var process = require('process');
5
5
  var deployer = require('@mastra/deployer');
6
6
  var services = require('@mastra/deployer/services');
7
- var execa = require('execa');
7
+ var esm = require('fs-extra/esm');
8
8
 
9
- // src/index.ts
9
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
10
10
 
11
- // src/helpers.ts
12
- async function createNetlifySite({ token, name, scope }) {
13
- const response = await fetch("https://api.netlify.com/api/v1/sites", {
14
- method: "POST",
15
- headers: {
16
- Authorization: `Bearer ${token}`,
17
- "Content-Type": "application/json"
18
- },
19
- body: JSON.stringify({
20
- name,
21
- account_slug: scope,
22
- // Optional - if not provided, creates in user's default account
23
- force_ssl: true
24
- // Enable HTTPS
25
- })
26
- });
27
- const data = await response.json();
28
- if (!response.ok) {
29
- console.error(JSON.stringify(data));
30
- throw new Error(`Failed to create site: ${data.message || "Unknown error"}`);
31
- }
32
- return {
33
- id: data.id,
34
- name: data.name,
35
- url: data.ssl_url || data.url,
36
- adminUrl: data.admin_url
37
- };
38
- }
39
- async function findNetlifySite({ token, name, scope }) {
40
- const response = await fetch(`https://api.netlify.com/api/v1/${scope}/sites?filter=all&name=${name}`, {
41
- headers: {
42
- Authorization: `Bearer ${token}`,
43
- "Content-Type": "application/json"
44
- }
45
- });
46
- const data = await response.json();
47
- if (!response.ok || !Array.isArray(data)) {
48
- throw new Error(`Failed to search sites: ${data.message || "Unknown error"}`);
49
- }
50
- return data.find((site) => site.name === name);
51
- }
52
- async function getOrCreateSite({ token, name, scope }) {
53
- let existingSite;
54
- try {
55
- existingSite = await findNetlifySite({ token, name, scope });
56
- } catch {
57
- }
58
- if (existingSite) {
59
- return existingSite;
60
- }
61
- return createNetlifySite({ token, name, scope });
62
- }
11
+ var process__default = /*#__PURE__*/_interopDefault(process);
63
12
 
64
13
  // src/index.ts
65
14
  var NetlifyDeployer = class extends deployer.Deployer {
66
- scope;
67
- projectName;
68
- token;
69
- constructor({ scope, projectName, token }) {
15
+ constructor() {
70
16
  super({ name: "NETLIFY" });
71
- this.scope = scope;
72
- this.projectName = projectName;
73
- this.token = token;
17
+ this.outputDir = path.join(".netlify", "v1", "functions", "api");
74
18
  }
75
- writeFiles({ dir }) {
76
- if (!fs.existsSync(path.join(dir, "netlify/functions/api"))) {
77
- fs.mkdirSync(path.join(dir, "netlify/functions/api"), { recursive: true });
78
- }
79
- fs.writeFileSync(
80
- path.join(dir, "netlify.toml"),
81
- `[functions]
82
- node_bundler = "esbuild"
83
- directory = "netlify/functions"
84
-
85
- [[redirects]]
86
- force = true
87
- from = "/*"
88
- status = 200
89
- to = "/.netlify/functions/api/:splat"
90
- `
91
- );
92
- }
93
- async installDependencies(outputDirectory, rootDir = process.cwd()) {
19
+ async installDependencies(outputDirectory, rootDir = process__default.default.cwd()) {
94
20
  const deps = new services.DepsService(rootDir);
95
21
  deps.__setLogger(this.logger);
96
22
  await deps.install({
@@ -102,47 +28,41 @@ to = "/.netlify/functions/api/:splat"
102
28
  }
103
29
  });
104
30
  }
105
- async deploy(outputDirectory) {
106
- const site = await getOrCreateSite({ token: this.token, name: this.projectName || `mastra`, scope: this.scope });
107
- const p2 = execa.execa(
108
- "npx",
109
- [
110
- "netlify-cli",
111
- "deploy",
112
- "--site",
113
- site.id,
114
- "--auth",
115
- this.token,
116
- "--dir",
117
- ".",
118
- "--functions",
119
- "./netlify/functions"
120
- ],
121
- {
122
- cwd: path.join(outputDirectory, this.outputDir)
123
- }
124
- );
125
- p2.stdout.pipe(process.stdout);
126
- await p2;
31
+ async deploy() {
32
+ this.logger?.info("Deploying to Netlify failed. Please use the Netlify dashboard to deploy.");
127
33
  }
128
34
  async prepare(outputDirectory) {
129
35
  await super.prepare(outputDirectory);
130
- this.writeFiles({ dir: path.join(outputDirectory, this.outputDir) });
131
36
  }
132
37
  async bundle(entryFile, outputDirectory, toolsPaths) {
133
- return this._bundle(
38
+ const result = await this._bundle(
134
39
  this.getEntry(),
135
40
  entryFile,
136
41
  outputDirectory,
137
42
  toolsPaths,
138
- path.join(outputDirectory, this.outputDir, "netlify", "functions", "api")
43
+ path.join(outputDirectory, this.outputDir)
139
44
  );
45
+ await esm.writeJson(path.join(outputDirectory, ".netlify", "v1", "config.json"), {
46
+ redirects: [
47
+ {
48
+ force: true,
49
+ from: "/*",
50
+ to: "/.netlify/functions/api/:splat",
51
+ status: 200
52
+ }
53
+ ]
54
+ });
55
+ await esm.move(path.join(outputDirectory, ".netlify", "v1"), path.join(process__default.default.cwd(), ".netlify", "v1"), {
56
+ overwrite: true
57
+ });
58
+ return result;
140
59
  }
141
60
  getEntry() {
142
61
  return `
143
62
  import { handle } from 'hono/netlify'
144
63
  import { mastra } from '#mastra';
145
- import { createHonoServer } from '#server';
64
+ import { createHonoServer, getToolExports } from '#server';
65
+ import { tools } from '#tools';
146
66
  import { evaluate } from '@mastra/core/eval';
147
67
  import { AvailableHooks, registerHook } from '@mastra/core/hooks';
148
68
  import { TABLE_EVALS } from '@mastra/core/storage';
@@ -160,16 +80,11 @@ to = "/.netlify/functions/api/:splat"
160
80
  });
161
81
  });
162
82
 
163
- if (mastra.getStorage()) {
164
- // start storage init in the background
165
- mastra.getStorage().init();
166
- }
167
-
168
83
  registerHook(AvailableHooks.ON_EVALUATION, async traceObject => {
169
84
  const storage = mastra.getStorage();
170
85
  if (storage) {
171
86
  // Check for required fields
172
- const logger = mastra?.getLogger();
87
+ const logger = mastra.getLogger();
173
88
  const areFieldsValid = checkEvalStorageFields(traceObject, logger);
174
89
  if (!areFieldsValid) return;
175
90
 
@@ -191,7 +106,7 @@ to = "/.netlify/functions/api/:splat"
191
106
  }
192
107
  });
193
108
 
194
- const app = await createHonoServer(mastra);
109
+ const app = await createHonoServer(mastra, { tools: getToolExports(tools) });
195
110
 
196
111
  export default handle(app)
197
112
  `;
@@ -202,3 +117,5 @@ to = "/.netlify/functions/api/:splat"
202
117
  };
203
118
 
204
119
  exports.NetlifyDeployer = NetlifyDeployer;
120
+ //# sourceMappingURL=index.cjs.map
121
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"names":["Deployer","join","process","DepsService","writeJson","move"],"mappings":";;;;;;;;;;;;;AAMO,IAAM,eAAA,GAAN,cAA8BA,iBAAA,CAAS;AAAA,EAC5C,WAAA,GAAc;AACZ,IAAA,KAAA,CAAM,EAAE,IAAA,EAAM,SAAA,EAAW,CAAA;AACzB,IAAA,IAAA,CAAK,SAAA,GAAYC,SAAA,CAAK,UAAA,EAAY,IAAA,EAAM,aAAa,KAAK,CAAA;AAAA,EAC5D;AAAA,EAEA,MAAgB,m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,QAAA,CAAKJ,SAAA,CAAK,eAAA,EAAiB,UAAA,EAAY,IAAI,CAAA,EAAGA,SAAA,CAAKC,wBAAA,CAAQ,GAAA,EAAI,EAAG,UAAA,EAAY,IAAI,CAAA,EAAG;AAAA,MACzF,SAAA,EAAW;AAAA,KACZ,CAAA;AAED,IAAA,OAAO,MAAA;AAAA,EACT;AAAA,EAEQ,QAAA,GAAmB;AACzB,IAAA,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;;AAAA;AAAA,CAAA;AAAA,EAoDT;AAAA,EAEA,MAAM,IAAA,CAAK,SAAA,EAAmB,eAAA,EAAyB,UAAA,EAAkD;AACvG,IAAA,MAAM,KAAA,CAAM,IAAA,CAAK,SAAA,EAAW,eAAA,EAAiB,UAAU,CAAA;AAAA,EAGzD;AACF","file":"index.cjs","sourcesContent":["import { join } from 'path';\nimport process from 'process';\nimport { Deployer } from '@mastra/deployer';\nimport { DepsService } from '@mastra/deployer/services';\nimport { move, writeJson } from 'fs-extra/esm';\n\nexport class NetlifyDeployer extends Deployer {\n constructor() {\n super({ name: 'NETLIFY' });\n this.outputDir = join('.netlify', 'v1', 'functions', 'api');\n }\n\n protected async installDependencies(outputDirectory: string, rootDir = process.cwd()) {\n const deps = new DepsService(rootDir);\n deps.__setLogger(this.logger);\n\n await deps.install({\n dir: join(outputDirectory, this.outputDir),\n architecture: {\n os: ['linux'],\n cpu: ['x64'],\n libc: ['gnu'],\n },\n });\n }\n\n async deploy(): Promise<void> {\n this.logger?.info('Deploying to Netlify failed. Please use the Netlify dashboard to deploy.');\n }\n\n async prepare(outputDirectory: string): Promise<void> {\n await super.prepare(outputDirectory);\n }\n\n async bundle(entryFile: string, outputDirectory: string, toolsPaths: (string | string[])[]): Promise<void> {\n const result = await this._bundle(\n this.getEntry(),\n entryFile,\n outputDirectory,\n toolsPaths,\n join(outputDirectory, this.outputDir),\n );\n\n await writeJson(join(outputDirectory, '.netlify', 'v1', 'config.json'), {\n redirects: [\n {\n force: true,\n from: '/*',\n to: '/.netlify/functions/api/:splat',\n status: 200,\n },\n ],\n });\n\n await move(join(outputDirectory, '.netlify', 'v1'), join(process.cwd(), '.netlify', 'v1'), {\n overwrite: true,\n });\n\n return result;\n }\n\n private getEntry(): string {\n return `\n import { handle } from 'hono/netlify'\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 const app = await createHonoServer(mastra, { tools: getToolExports(tools) });\n\n export default handle(app)\n`;\n }\n\n async lint(entryFile: string, outputDirectory: string, toolsPaths: (string | string[])[]): Promise<void> {\n await super.lint(entryFile, outputDirectory, toolsPaths);\n\n // Lint for netlify support\n }\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -1 +1,11 @@
1
- export { NetlifyDeployer } from './_tsup-dts-rollup.js';
1
+ import { Deployer } from '@mastra/deployer';
2
+ export declare class NetlifyDeployer extends Deployer {
3
+ constructor();
4
+ protected installDependencies(outputDirectory: string, rootDir?: string): Promise<void>;
5
+ deploy(): Promise<void>;
6
+ prepare(outputDirectory: string): Promise<void>;
7
+ bundle(entryFile: string, outputDirectory: string, toolsPaths: (string | string[])[]): Promise<void>;
8
+ private getEntry;
9
+ lint(entryFile: string, outputDirectory: string, toolsPaths: (string | string[])[]): Promise<void>;
10
+ }
11
+ //# 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;AAI5C,qBAAa,eAAgB,SAAQ,QAAQ;;cAM3B,mBAAmB,CAAC,eAAe,EAAE,MAAM,EAAE,OAAO,SAAgB;IAc9E,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAIvB,OAAO,CAAC,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI/C,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IA2B1G,OAAO,CAAC,QAAQ;IAuDV,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAKzG"}
package/dist/index.js CHANGED
@@ -1,92 +1,14 @@
1
- import { existsSync, mkdirSync, writeFileSync } from 'fs';
2
1
  import { join } from 'path';
2
+ import process from 'process';
3
3
  import { Deployer } from '@mastra/deployer';
4
4
  import { DepsService } from '@mastra/deployer/services';
5
- import { execa } from 'execa';
6
-
7
- // src/index.ts
8
-
9
- // src/helpers.ts
10
- async function createNetlifySite({ token, name, scope }) {
11
- const response = await fetch("https://api.netlify.com/api/v1/sites", {
12
- method: "POST",
13
- headers: {
14
- Authorization: `Bearer ${token}`,
15
- "Content-Type": "application/json"
16
- },
17
- body: JSON.stringify({
18
- name,
19
- account_slug: scope,
20
- // Optional - if not provided, creates in user's default account
21
- force_ssl: true
22
- // Enable HTTPS
23
- })
24
- });
25
- const data = await response.json();
26
- if (!response.ok) {
27
- console.error(JSON.stringify(data));
28
- throw new Error(`Failed to create site: ${data.message || "Unknown error"}`);
29
- }
30
- return {
31
- id: data.id,
32
- name: data.name,
33
- url: data.ssl_url || data.url,
34
- adminUrl: data.admin_url
35
- };
36
- }
37
- async function findNetlifySite({ token, name, scope }) {
38
- const response = await fetch(`https://api.netlify.com/api/v1/${scope}/sites?filter=all&name=${name}`, {
39
- headers: {
40
- Authorization: `Bearer ${token}`,
41
- "Content-Type": "application/json"
42
- }
43
- });
44
- const data = await response.json();
45
- if (!response.ok || !Array.isArray(data)) {
46
- throw new Error(`Failed to search sites: ${data.message || "Unknown error"}`);
47
- }
48
- return data.find((site) => site.name === name);
49
- }
50
- async function getOrCreateSite({ token, name, scope }) {
51
- let existingSite;
52
- try {
53
- existingSite = await findNetlifySite({ token, name, scope });
54
- } catch {
55
- }
56
- if (existingSite) {
57
- return existingSite;
58
- }
59
- return createNetlifySite({ token, name, scope });
60
- }
5
+ import { writeJson, move } from 'fs-extra/esm';
61
6
 
62
7
  // src/index.ts
63
8
  var NetlifyDeployer = class extends Deployer {
64
- scope;
65
- projectName;
66
- token;
67
- constructor({ scope, projectName, token }) {
9
+ constructor() {
68
10
  super({ name: "NETLIFY" });
69
- this.scope = scope;
70
- this.projectName = projectName;
71
- this.token = token;
72
- }
73
- writeFiles({ dir }) {
74
- if (!existsSync(join(dir, "netlify/functions/api"))) {
75
- mkdirSync(join(dir, "netlify/functions/api"), { recursive: true });
76
- }
77
- writeFileSync(
78
- join(dir, "netlify.toml"),
79
- `[functions]
80
- node_bundler = "esbuild"
81
- directory = "netlify/functions"
82
-
83
- [[redirects]]
84
- force = true
85
- from = "/*"
86
- status = 200
87
- to = "/.netlify/functions/api/:splat"
88
- `
89
- );
11
+ this.outputDir = join(".netlify", "v1", "functions", "api");
90
12
  }
91
13
  async installDependencies(outputDirectory, rootDir = process.cwd()) {
92
14
  const deps = new DepsService(rootDir);
@@ -100,47 +22,41 @@ to = "/.netlify/functions/api/:splat"
100
22
  }
101
23
  });
102
24
  }
103
- async deploy(outputDirectory) {
104
- const site = await getOrCreateSite({ token: this.token, name: this.projectName || `mastra`, scope: this.scope });
105
- const p2 = execa(
106
- "npx",
107
- [
108
- "netlify-cli",
109
- "deploy",
110
- "--site",
111
- site.id,
112
- "--auth",
113
- this.token,
114
- "--dir",
115
- ".",
116
- "--functions",
117
- "./netlify/functions"
118
- ],
119
- {
120
- cwd: join(outputDirectory, this.outputDir)
121
- }
122
- );
123
- p2.stdout.pipe(process.stdout);
124
- await p2;
25
+ async deploy() {
26
+ this.logger?.info("Deploying to Netlify failed. Please use the Netlify dashboard to deploy.");
125
27
  }
126
28
  async prepare(outputDirectory) {
127
29
  await super.prepare(outputDirectory);
128
- this.writeFiles({ dir: join(outputDirectory, this.outputDir) });
129
30
  }
130
31
  async bundle(entryFile, outputDirectory, toolsPaths) {
131
- return this._bundle(
32
+ const result = await this._bundle(
132
33
  this.getEntry(),
133
34
  entryFile,
134
35
  outputDirectory,
135
36
  toolsPaths,
136
- join(outputDirectory, this.outputDir, "netlify", "functions", "api")
37
+ join(outputDirectory, this.outputDir)
137
38
  );
39
+ await writeJson(join(outputDirectory, ".netlify", "v1", "config.json"), {
40
+ redirects: [
41
+ {
42
+ force: true,
43
+ from: "/*",
44
+ to: "/.netlify/functions/api/:splat",
45
+ status: 200
46
+ }
47
+ ]
48
+ });
49
+ await move(join(outputDirectory, ".netlify", "v1"), join(process.cwd(), ".netlify", "v1"), {
50
+ overwrite: true
51
+ });
52
+ return result;
138
53
  }
139
54
  getEntry() {
140
55
  return `
141
56
  import { handle } from 'hono/netlify'
142
57
  import { mastra } from '#mastra';
143
- import { createHonoServer } from '#server';
58
+ import { createHonoServer, getToolExports } from '#server';
59
+ import { tools } from '#tools';
144
60
  import { evaluate } from '@mastra/core/eval';
145
61
  import { AvailableHooks, registerHook } from '@mastra/core/hooks';
146
62
  import { TABLE_EVALS } from '@mastra/core/storage';
@@ -158,16 +74,11 @@ to = "/.netlify/functions/api/:splat"
158
74
  });
159
75
  });
160
76
 
161
- if (mastra.getStorage()) {
162
- // start storage init in the background
163
- mastra.getStorage().init();
164
- }
165
-
166
77
  registerHook(AvailableHooks.ON_EVALUATION, async traceObject => {
167
78
  const storage = mastra.getStorage();
168
79
  if (storage) {
169
80
  // Check for required fields
170
- const logger = mastra?.getLogger();
81
+ const logger = mastra.getLogger();
171
82
  const areFieldsValid = checkEvalStorageFields(traceObject, logger);
172
83
  if (!areFieldsValid) return;
173
84
 
@@ -189,7 +100,7 @@ to = "/.netlify/functions/api/:splat"
189
100
  }
190
101
  });
191
102
 
192
- const app = await createHonoServer(mastra);
103
+ const app = await createHonoServer(mastra, { tools: getToolExports(tools) });
193
104
 
194
105
  export default handle(app)
195
106
  `;
@@ -200,3 +111,5 @@ to = "/.netlify/functions/api/:splat"
200
111
  };
201
112
 
202
113
  export { NetlifyDeployer };
114
+ //# sourceMappingURL=index.js.map
115
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;AAMO,IAAM,eAAA,GAAN,cAA8B,QAAA,CAAS;AAAA,EAC5C,WAAA,GAAc;AACZ,IAAA,KAAA,CAAM,EAAE,IAAA,EAAM,SAAA,EAAW,CAAA;AACzB,IAAA,IAAA,CAAK,SAAA,GAAY,I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,gCAAA;AAAA,UACJ,MAAA,EAAQ;AAAA;AACV;AACF,KACD,CAAA;AAED,IAAA,MAAM,IAAA,CAAK,IAAA,CAAK,eAAA,EAAiB,UAAA,EAAY,IAAI,CAAA,EAAG,IAAA,CAAK,OAAA,CAAQ,GAAA,EAAI,EAAG,UAAA,EAAY,IAAI,CAAA,EAAG;AAAA,MACzF,SAAA,EAAW;AAAA,KACZ,CAAA;AAED,IAAA,OAAO,MAAA;AAAA,EACT;AAAA,EAEQ,QAAA,GAAmB;AACzB,IAAA,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;;AAAA;AAAA,CAAA;AAAA,EAoDT;AAAA,EAEA,MAAM,IAAA,CAAK,SAAA,EAAmB,eAAA,EAAyB,UAAA,EAAkD;AACvG,IAAA,MAAM,KAAA,CAAM,IAAA,CAAK,SAAA,EAAW,eAAA,EAAiB,UAAU,CAAA;AAAA,EAGzD;AACF","file":"index.js","sourcesContent":["import { join } from 'path';\nimport process from 'process';\nimport { Deployer } from '@mastra/deployer';\nimport { DepsService } from '@mastra/deployer/services';\nimport { move, writeJson } from 'fs-extra/esm';\n\nexport class NetlifyDeployer extends Deployer {\n constructor() {\n super({ name: 'NETLIFY' });\n this.outputDir = join('.netlify', 'v1', 'functions', 'api');\n }\n\n protected async installDependencies(outputDirectory: string, rootDir = process.cwd()) {\n const deps = new DepsService(rootDir);\n deps.__setLogger(this.logger);\n\n await deps.install({\n dir: join(outputDirectory, this.outputDir),\n architecture: {\n os: ['linux'],\n cpu: ['x64'],\n libc: ['gnu'],\n },\n });\n }\n\n async deploy(): Promise<void> {\n this.logger?.info('Deploying to Netlify failed. Please use the Netlify dashboard to deploy.');\n }\n\n async prepare(outputDirectory: string): Promise<void> {\n await super.prepare(outputDirectory);\n }\n\n async bundle(entryFile: string, outputDirectory: string, toolsPaths: (string | string[])[]): Promise<void> {\n const result = await this._bundle(\n this.getEntry(),\n entryFile,\n outputDirectory,\n toolsPaths,\n join(outputDirectory, this.outputDir),\n );\n\n await writeJson(join(outputDirectory, '.netlify', 'v1', 'config.json'), {\n redirects: [\n {\n force: true,\n from: '/*',\n to: '/.netlify/functions/api/:splat',\n status: 200,\n },\n ],\n });\n\n await move(join(outputDirectory, '.netlify', 'v1'), join(process.cwd(), '.netlify', 'v1'), {\n overwrite: true,\n });\n\n return result;\n }\n\n private getEntry(): string {\n return `\n import { handle } from 'hono/netlify'\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 const app = await createHonoServer(mastra, { tools: getToolExports(tools) });\n\n export default handle(app)\n`;\n }\n\n async lint(entryFile: string, outputDirectory: string, toolsPaths: (string | string[])[]): Promise<void> {\n await super.lint(entryFile, outputDirectory, toolsPaths);\n\n // Lint for netlify support\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/deployer-netlify",
3
- "version": "0.0.0-vector-query-sources-20250516172905",
3
+ "version": "0.0.0-vector-query-tool-provider-options-20250828222356",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "files": [
@@ -15,7 +15,7 @@
15
15
  "default": "./dist/index.js"
16
16
  },
17
17
  "require": {
18
- "types": "./dist/index.d.cts",
18
+ "types": "./dist/index.d.ts",
19
19
  "default": "./dist/index.cjs"
20
20
  }
21
21
  },
@@ -23,28 +23,33 @@
23
23
  },
24
24
  "keywords": [],
25
25
  "author": "",
26
- "license": "Elastic-2.0",
26
+ "license": "Apache-2.0",
27
27
  "dependencies": {
28
28
  "@rollup/plugin-virtual": "^3.0.2",
29
29
  "date-fns": "^4.1.0",
30
- "execa": "^9.5.2",
31
- "netlify-cli": "^19.0.3",
32
- "zod": "^3.24.3",
33
- "@mastra/core": "0.0.0-vector-query-sources-20250516172905",
34
- "@mastra/deployer": "0.0.0-vector-query-sources-20250516172905"
30
+ "execa": "^9.6.0",
31
+ "fs-extra": "^11.3.0",
32
+ "@mastra/deployer": "0.0.0-vector-query-tool-provider-options-20250828222356"
35
33
  },
36
34
  "devDependencies": {
37
- "@microsoft/api-extractor": "^7.52.5",
38
- "@types/node": "^20.17.27",
39
- "eslint": "^9.23.0",
40
- "tsup": "^8.4.0",
41
- "typescript": "^5.8.2",
42
- "vitest": "^3.1.2",
43
- "@internal/lint": "0.0.0-vector-query-sources-20250516172905"
35
+ "@microsoft/api-extractor": "^7.52.8",
36
+ "@types/fs-extra": "^11.0.4",
37
+ "@types/node": "^20.19.0",
38
+ "eslint": "^9.30.1",
39
+ "tsup": "^8.5.0",
40
+ "typescript": "^5.8.3",
41
+ "vitest": "^3.2.4",
42
+ "@internal/lint": "0.0.0-vector-query-tool-provider-options-20250828222356",
43
+ "@internal/types-builder": "0.0.0-vector-query-tool-provider-options-20250828222356",
44
+ "@mastra/core": "0.0.0-vector-query-tool-provider-options-20250828222356"
45
+ },
46
+ "peerDependencies": {
47
+ "zod": "^3.25.0 || ^4.0.0",
48
+ "@mastra/core": "0.0.0-vector-query-tool-provider-options-20250828222356"
44
49
  },
45
50
  "scripts": {
46
- "build": "tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting",
47
- "build:watch": "pnpm build --watch",
51
+ "build": "tsup --silent --config tsup.config.ts",
52
+ "build:watch": "tsup --watch --silent --config tsup.config.ts",
48
53
  "test": "vitest run",
49
54
  "lint": "eslint ."
50
55
  }
@@ -1,40 +0,0 @@
1
- import { Deployer } from '@mastra/deployer';
2
-
3
- export declare function getOrCreateSite({ token, name, scope }: {
4
- token: string;
5
- name: string;
6
- scope: string;
7
- }): Promise<{
8
- id: string | undefined;
9
- name: string | undefined;
10
- url: string | undefined;
11
- adminUrl: string | undefined;
12
- } | {
13
- id: string;
14
- name: string;
15
- ssl_url: string;
16
- url: string;
17
- admin_url: string;
18
- }>;
19
-
20
- export declare class NetlifyDeployer extends Deployer {
21
- protected scope: string;
22
- protected projectName: string;
23
- protected token: string;
24
- constructor({ scope, projectName, token }: {
25
- scope: string;
26
- projectName: string;
27
- token: string;
28
- });
29
- writeFiles({ dir }: {
30
- dir: string;
31
- }): void;
32
- protected installDependencies(outputDirectory: string, rootDir?: string): Promise<void>;
33
- deploy(outputDirectory: string): Promise<void>;
34
- prepare(outputDirectory: string): Promise<void>;
35
- bundle(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void>;
36
- private getEntry;
37
- lint(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void>;
38
- }
39
-
40
- export { }
@@ -1,40 +0,0 @@
1
- import { Deployer } from '@mastra/deployer';
2
-
3
- export declare function getOrCreateSite({ token, name, scope }: {
4
- token: string;
5
- name: string;
6
- scope: string;
7
- }): Promise<{
8
- id: string | undefined;
9
- name: string | undefined;
10
- url: string | undefined;
11
- adminUrl: string | undefined;
12
- } | {
13
- id: string;
14
- name: string;
15
- ssl_url: string;
16
- url: string;
17
- admin_url: string;
18
- }>;
19
-
20
- export declare class NetlifyDeployer extends Deployer {
21
- protected scope: string;
22
- protected projectName: string;
23
- protected token: string;
24
- constructor({ scope, projectName, token }: {
25
- scope: string;
26
- projectName: string;
27
- token: string;
28
- });
29
- writeFiles({ dir }: {
30
- dir: string;
31
- }): void;
32
- protected installDependencies(outputDirectory: string, rootDir?: string): Promise<void>;
33
- deploy(outputDirectory: string): Promise<void>;
34
- prepare(outputDirectory: string): Promise<void>;
35
- bundle(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void>;
36
- private getEntry;
37
- lint(entryFile: string, outputDirectory: string, toolsPaths: string[]): Promise<void>;
38
- }
39
-
40
- export { }
package/dist/index.d.cts DELETED
@@ -1 +0,0 @@
1
- export { NetlifyDeployer } from './_tsup-dts-rollup.cjs';