@mastra/deployer-netlify 0.0.1-alpha.21 → 0.0.1-alpha.24

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.
@@ -1,547 +0,0 @@
1
- import { MastraDeployer } from '@mastra/core';
2
- import { execa } from 'execa';
3
- import { existsSync, mkdirSync, writeFileSync, renameSync } from 'fs';
4
- import { join } from 'path';
5
-
6
- function asyncGeneratorStep(n, t, e, r, o, a, c) {
7
- try {
8
- var i = n[a](c),
9
- u = i.value;
10
- } catch (n) {
11
- return void e(n);
12
- }
13
- i.done ? t(u) : Promise.resolve(u).then(r, o);
14
- }
15
- function _asyncToGenerator(n) {
16
- return function () {
17
- var t = this,
18
- e = arguments;
19
- return new Promise(function (r, o) {
20
- var a = n.apply(t, e);
21
- function _next(n) {
22
- asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
23
- }
24
- function _throw(n) {
25
- asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
26
- }
27
- _next(void 0);
28
- });
29
- };
30
- }
31
- function _inheritsLoose(t, o) {
32
- t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
33
- }
34
- function _regeneratorRuntime() {
35
- _regeneratorRuntime = function () {
36
- return e;
37
- };
38
- var t,
39
- e = {},
40
- r = Object.prototype,
41
- n = r.hasOwnProperty,
42
- o = Object.defineProperty || function (t, e, r) {
43
- t[e] = r.value;
44
- },
45
- i = "function" == typeof Symbol ? Symbol : {},
46
- a = i.iterator || "@@iterator",
47
- c = i.asyncIterator || "@@asyncIterator",
48
- u = i.toStringTag || "@@toStringTag";
49
- function define(t, e, r) {
50
- return Object.defineProperty(t, e, {
51
- value: r,
52
- enumerable: !0,
53
- configurable: !0,
54
- writable: !0
55
- }), t[e];
56
- }
57
- try {
58
- define({}, "");
59
- } catch (t) {
60
- define = function (t, e, r) {
61
- return t[e] = r;
62
- };
63
- }
64
- function wrap(t, e, r, n) {
65
- var i = e && e.prototype instanceof Generator ? e : Generator,
66
- a = Object.create(i.prototype),
67
- c = new Context(n || []);
68
- return o(a, "_invoke", {
69
- value: makeInvokeMethod(t, r, c)
70
- }), a;
71
- }
72
- function tryCatch(t, e, r) {
73
- try {
74
- return {
75
- type: "normal",
76
- arg: t.call(e, r)
77
- };
78
- } catch (t) {
79
- return {
80
- type: "throw",
81
- arg: t
82
- };
83
- }
84
- }
85
- e.wrap = wrap;
86
- var h = "suspendedStart",
87
- l = "suspendedYield",
88
- f = "executing",
89
- s = "completed",
90
- y = {};
91
- function Generator() {}
92
- function GeneratorFunction() {}
93
- function GeneratorFunctionPrototype() {}
94
- var p = {};
95
- define(p, a, function () {
96
- return this;
97
- });
98
- var d = Object.getPrototypeOf,
99
- v = d && d(d(values([])));
100
- v && v !== r && n.call(v, a) && (p = v);
101
- var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
102
- function defineIteratorMethods(t) {
103
- ["next", "throw", "return"].forEach(function (e) {
104
- define(t, e, function (t) {
105
- return this._invoke(e, t);
106
- });
107
- });
108
- }
109
- function AsyncIterator(t, e) {
110
- function invoke(r, o, i, a) {
111
- var c = tryCatch(t[r], t, o);
112
- if ("throw" !== c.type) {
113
- var u = c.arg,
114
- h = u.value;
115
- return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
116
- invoke("next", t, i, a);
117
- }, function (t) {
118
- invoke("throw", t, i, a);
119
- }) : e.resolve(h).then(function (t) {
120
- u.value = t, i(u);
121
- }, function (t) {
122
- return invoke("throw", t, i, a);
123
- });
124
- }
125
- a(c.arg);
126
- }
127
- var r;
128
- o(this, "_invoke", {
129
- value: function (t, n) {
130
- function callInvokeWithMethodAndArg() {
131
- return new e(function (e, r) {
132
- invoke(t, n, e, r);
133
- });
134
- }
135
- return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
136
- }
137
- });
138
- }
139
- function makeInvokeMethod(e, r, n) {
140
- var o = h;
141
- return function (i, a) {
142
- if (o === f) throw Error("Generator is already running");
143
- if (o === s) {
144
- if ("throw" === i) throw a;
145
- return {
146
- value: t,
147
- done: !0
148
- };
149
- }
150
- for (n.method = i, n.arg = a;;) {
151
- var c = n.delegate;
152
- if (c) {
153
- var u = maybeInvokeDelegate(c, n);
154
- if (u) {
155
- if (u === y) continue;
156
- return u;
157
- }
158
- }
159
- if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
160
- if (o === h) throw o = s, n.arg;
161
- n.dispatchException(n.arg);
162
- } else "return" === n.method && n.abrupt("return", n.arg);
163
- o = f;
164
- var p = tryCatch(e, r, n);
165
- if ("normal" === p.type) {
166
- if (o = n.done ? s : l, p.arg === y) continue;
167
- return {
168
- value: p.arg,
169
- done: n.done
170
- };
171
- }
172
- "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
173
- }
174
- };
175
- }
176
- function maybeInvokeDelegate(e, r) {
177
- var n = r.method,
178
- o = e.iterator[n];
179
- if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
180
- var i = tryCatch(o, e.iterator, r.arg);
181
- if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
182
- var a = i.arg;
183
- return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
184
- }
185
- function pushTryEntry(t) {
186
- var e = {
187
- tryLoc: t[0]
188
- };
189
- 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
190
- }
191
- function resetTryEntry(t) {
192
- var e = t.completion || {};
193
- e.type = "normal", delete e.arg, t.completion = e;
194
- }
195
- function Context(t) {
196
- this.tryEntries = [{
197
- tryLoc: "root"
198
- }], t.forEach(pushTryEntry, this), this.reset(!0);
199
- }
200
- function values(e) {
201
- if (e || "" === e) {
202
- var r = e[a];
203
- if (r) return r.call(e);
204
- if ("function" == typeof e.next) return e;
205
- if (!isNaN(e.length)) {
206
- var o = -1,
207
- i = function next() {
208
- for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
209
- return next.value = t, next.done = !0, next;
210
- };
211
- return i.next = i;
212
- }
213
- }
214
- throw new TypeError(typeof e + " is not iterable");
215
- }
216
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
217
- value: GeneratorFunctionPrototype,
218
- configurable: !0
219
- }), o(GeneratorFunctionPrototype, "constructor", {
220
- value: GeneratorFunction,
221
- configurable: !0
222
- }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
223
- var e = "function" == typeof t && t.constructor;
224
- return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
225
- }, e.mark = function (t) {
226
- return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
227
- }, e.awrap = function (t) {
228
- return {
229
- __await: t
230
- };
231
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
232
- return this;
233
- }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
234
- void 0 === i && (i = Promise);
235
- var a = new AsyncIterator(wrap(t, r, n, o), i);
236
- return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
237
- return t.done ? t.value : a.next();
238
- });
239
- }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
240
- return this;
241
- }), define(g, "toString", function () {
242
- return "[object Generator]";
243
- }), e.keys = function (t) {
244
- var e = Object(t),
245
- r = [];
246
- for (var n in e) r.push(n);
247
- return r.reverse(), function next() {
248
- for (; r.length;) {
249
- var t = r.pop();
250
- if (t in e) return next.value = t, next.done = !1, next;
251
- }
252
- return next.done = !0, next;
253
- };
254
- }, e.values = values, Context.prototype = {
255
- constructor: Context,
256
- reset: function (e) {
257
- if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
258
- },
259
- stop: function () {
260
- this.done = !0;
261
- var t = this.tryEntries[0].completion;
262
- if ("throw" === t.type) throw t.arg;
263
- return this.rval;
264
- },
265
- dispatchException: function (e) {
266
- if (this.done) throw e;
267
- var r = this;
268
- function handle(n, o) {
269
- return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
270
- }
271
- for (var o = this.tryEntries.length - 1; o >= 0; --o) {
272
- var i = this.tryEntries[o],
273
- a = i.completion;
274
- if ("root" === i.tryLoc) return handle("end");
275
- if (i.tryLoc <= this.prev) {
276
- var c = n.call(i, "catchLoc"),
277
- u = n.call(i, "finallyLoc");
278
- if (c && u) {
279
- if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
280
- if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
281
- } else if (c) {
282
- if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
283
- } else {
284
- if (!u) throw Error("try statement without catch or finally");
285
- if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
286
- }
287
- }
288
- }
289
- },
290
- abrupt: function (t, e) {
291
- for (var r = this.tryEntries.length - 1; r >= 0; --r) {
292
- var o = this.tryEntries[r];
293
- if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
294
- var i = o;
295
- break;
296
- }
297
- }
298
- i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
299
- var a = i ? i.completion : {};
300
- return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
301
- },
302
- complete: function (t, e) {
303
- if ("throw" === t.type) throw t.arg;
304
- return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
305
- },
306
- finish: function (t) {
307
- for (var e = this.tryEntries.length - 1; e >= 0; --e) {
308
- var r = this.tryEntries[e];
309
- if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
310
- }
311
- },
312
- catch: function (t) {
313
- for (var e = this.tryEntries.length - 1; e >= 0; --e) {
314
- var r = this.tryEntries[e];
315
- if (r.tryLoc === t) {
316
- var n = r.completion;
317
- if ("throw" === n.type) {
318
- var o = n.arg;
319
- resetTryEntry(r);
320
- }
321
- return o;
322
- }
323
- }
324
- throw Error("illegal catch attempt");
325
- },
326
- delegateYield: function (e, r, n) {
327
- return this.delegate = {
328
- iterator: values(e),
329
- resultName: r,
330
- nextLoc: n
331
- }, "next" === this.method && (this.arg = t), y;
332
- }
333
- }, e;
334
- }
335
- function _setPrototypeOf(t, e) {
336
- return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
337
- return t.__proto__ = e, t;
338
- }, _setPrototypeOf(t, e);
339
- }
340
-
341
- function createNetlifySite(_x) {
342
- return _createNetlifySite.apply(this, arguments);
343
- }
344
- function _createNetlifySite() {
345
- _createNetlifySite = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
346
- var token, name, scope, response, data;
347
- return _regeneratorRuntime().wrap(function _callee$(_context) {
348
- while (1) switch (_context.prev = _context.next) {
349
- case 0:
350
- token = _ref.token, name = _ref.name, scope = _ref.scope;
351
- console.log(token, name, scope);
352
- _context.next = 4;
353
- return fetch('https://api.netlify.com/api/v1/sites', {
354
- method: 'POST',
355
- headers: {
356
- Authorization: "Bearer " + token,
357
- 'Content-Type': 'application/json'
358
- },
359
- body: JSON.stringify({
360
- name: name,
361
- account_slug: scope,
362
- // Optional - if not provided, creates in user's default account
363
- force_ssl: true // Enable HTTPS
364
- })
365
- });
366
- case 4:
367
- response = _context.sent;
368
- _context.next = 7;
369
- return response.json();
370
- case 7:
371
- data = _context.sent;
372
- if (response.ok) {
373
- _context.next = 11;
374
- break;
375
- }
376
- console.error(JSON.stringify(data));
377
- throw new Error("Failed to create site: " + (data.message || 'Unknown error'));
378
- case 11:
379
- return _context.abrupt("return", {
380
- id: data.id,
381
- name: data.name,
382
- url: data.ssl_url || data.url,
383
- adminUrl: data.admin_url
384
- });
385
- case 12:
386
- case "end":
387
- return _context.stop();
388
- }
389
- }, _callee);
390
- }));
391
- return _createNetlifySite.apply(this, arguments);
392
- }
393
- function findNetlifySite(_x2) {
394
- return _findNetlifySite.apply(this, arguments);
395
- }
396
- function _findNetlifySite() {
397
- _findNetlifySite = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref2) {
398
- var token, name, scope, response, data;
399
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
400
- while (1) switch (_context2.prev = _context2.next) {
401
- case 0:
402
- token = _ref2.token, name = _ref2.name, scope = _ref2.scope;
403
- _context2.next = 3;
404
- return fetch("https://api.netlify.com/api/v1/" + scope + "/sites?filter=all&name=" + name, {
405
- headers: {
406
- Authorization: "Bearer " + token,
407
- 'Content-Type': 'application/json'
408
- }
409
- });
410
- case 3:
411
- response = _context2.sent;
412
- _context2.next = 6;
413
- return response.json();
414
- case 6:
415
- data = _context2.sent;
416
- if (response.ok) {
417
- _context2.next = 9;
418
- break;
419
- }
420
- throw new Error("Failed to search sites: " + (data.message || 'Unknown error'));
421
- case 9:
422
- return _context2.abrupt("return", data.find(function (site) {
423
- return site.name === name;
424
- }));
425
- case 10:
426
- case "end":
427
- return _context2.stop();
428
- }
429
- }, _callee2);
430
- }));
431
- return _findNetlifySite.apply(this, arguments);
432
- }
433
- function getOrCreateSite(_x3) {
434
- return _getOrCreateSite.apply(this, arguments);
435
- }
436
- function _getOrCreateSite() {
437
- _getOrCreateSite = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref3) {
438
- var token, name, scope, existingSite;
439
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
440
- while (1) switch (_context3.prev = _context3.next) {
441
- case 0:
442
- token = _ref3.token, name = _ref3.name, scope = _ref3.scope;
443
- _context3.prev = 1;
444
- _context3.next = 4;
445
- return findNetlifySite({
446
- token: token,
447
- name: name,
448
- scope: scope
449
- });
450
- case 4:
451
- existingSite = _context3.sent;
452
- _context3.next = 9;
453
- break;
454
- case 7:
455
- _context3.prev = 7;
456
- _context3.t0 = _context3["catch"](1);
457
- case 9:
458
- if (!existingSite) {
459
- _context3.next = 11;
460
- break;
461
- }
462
- return _context3.abrupt("return", existingSite);
463
- case 11:
464
- return _context3.abrupt("return", createNetlifySite({
465
- token: token,
466
- name: name,
467
- scope: scope
468
- }));
469
- case 12:
470
- case "end":
471
- return _context3.stop();
472
- }
473
- }, _callee3, null, [[1, 7]]);
474
- }));
475
- return _getOrCreateSite.apply(this, arguments);
476
- }
477
-
478
- var NetlifyDeployer = /*#__PURE__*/function (_MastraDeployer) {
479
- function NetlifyDeployer(_ref) {
480
- var scope = _ref.scope,
481
- env = _ref.env,
482
- projectName = _ref.projectName;
483
- return _MastraDeployer.call(this, {
484
- scope: scope,
485
- env: env,
486
- projectName: projectName
487
- }) || this;
488
- }
489
- _inheritsLoose(NetlifyDeployer, _MastraDeployer);
490
- var _proto = NetlifyDeployer.prototype;
491
- _proto.writeFiles = function writeFiles(_ref2) {
492
- var dir = _ref2.dir;
493
- if (!existsSync(join(dir, 'netlify/functions/api'))) {
494
- mkdirSync(join(dir, 'netlify/functions/api'), {
495
- recursive: true
496
- });
497
- }
498
- // TODO ENV KEYS
499
- writeFileSync(join(dir, 'netlify.toml'), "\n [functions]\n node_bundler = \"esbuild\" \n directory = \"/netlify/functions\"\n\n [[redirects]]\n force = true\n from = \"/*\"\n status = 200\n to = \"/.netlify/functions/api/:splat\"\n ");
500
- this.writeIndex({
501
- dir: dir
502
- });
503
- };
504
- _proto.deploy = /*#__PURE__*/function () {
505
- var _deploy = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref3) {
506
- var dir, token, site, p2;
507
- return _regeneratorRuntime().wrap(function _callee$(_context) {
508
- while (1) switch (_context.prev = _context.next) {
509
- case 0:
510
- dir = _ref3.dir, token = _ref3.token;
511
- _context.next = 3;
512
- return getOrCreateSite({
513
- token: token,
514
- name: this.projectName || "mastra",
515
- scope: this.scope
516
- });
517
- case 3:
518
- site = _context.sent;
519
- p2 = execa('netlify', ['deploy', '--site', site.id, '--auth', token, '--dir', '.', '--functions', './netlify/functions'], {
520
- cwd: dir
521
- });
522
- p2.stdout.pipe(process.stdout);
523
- _context.next = 8;
524
- return p2;
525
- case 8:
526
- case "end":
527
- return _context.stop();
528
- }
529
- }, _callee, this);
530
- }));
531
- function deploy(_x) {
532
- return _deploy.apply(this, arguments);
533
- }
534
- return deploy;
535
- }();
536
- _proto.writeIndex = function writeIndex(_ref4) {
537
- var dir = _ref4.dir;
538
- ['mastra.mjs', 'hono.mjs', 'server.mjs'].forEach(function (file) {
539
- renameSync(join(dir, file), join(dir, "netlify/functions/api/" + file));
540
- });
541
- writeFileSync(join(dir, 'netlify/functions/api/api.mts'), " \n export default async (req, context) => {\n const { app } = await import('./hono.mjs');\n // Pass the request directly to Hono\n return app.fetch(req, {\n // Optional context passing if needed\n env: { context }\n })\n }\n ");
542
- };
543
- return NetlifyDeployer;
544
- }(MastraDeployer);
545
-
546
- export { NetlifyDeployer };
547
- //# sourceMappingURL=deployer-netlify.esm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"deployer-netlify.esm.js","sources":["../src/helpers.ts","../src/index.ts"],"sourcesContent":["async function createNetlifySite({ token, name, scope }: { token: string; name: string; scope?: string }) {\n console.log(token, name, scope);\n const response = await fetch('https://api.netlify.com/api/v1/sites', {\n method: 'POST',\n headers: {\n Authorization: `Bearer ${token}`,\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n name: name,\n account_slug: scope, // Optional - if not provided, creates in user's default account\n force_ssl: true, // Enable HTTPS\n }),\n });\n\n const data = await response.json();\n\n if (!response.ok) {\n console.error(JSON.stringify(data));\n throw new Error(`Failed to create site: ${data.message || 'Unknown error'}`);\n }\n\n return {\n id: data.id,\n name: data.name,\n url: data.ssl_url || data.url,\n adminUrl: data.admin_url,\n };\n}\n\nasync function findNetlifySite({ token, name, scope }: { token: string; name: string; scope: string }) {\n const response = await fetch(`https://api.netlify.com/api/v1/${scope}/sites?filter=all&name=${name}`, {\n headers: {\n Authorization: `Bearer ${token}`,\n 'Content-Type': 'application/json',\n },\n });\n\n const data = await response.json();\n\n if (!response.ok) {\n throw new Error(`Failed to search sites: ${data.message || 'Unknown error'}`);\n }\n\n // Find exact match (filter can return partial matches)\n return data.find((site: any) => site.name === name);\n}\n\nexport async function getOrCreateSite({ token, name, scope }: { token: string; name: string; scope: string }) {\n let existingSite;\n try {\n existingSite = await findNetlifySite({ token, name, scope });\n } catch (e) {}\n\n if (existingSite) {\n return existingSite;\n }\n\n return createNetlifySite({ token, name, scope });\n}\n","import { MastraDeployer } from '@mastra/core';\nimport { execa } from 'execa';\nimport { existsSync, mkdirSync, renameSync, writeFileSync } from 'fs';\nimport { join } from 'path';\n\nimport { getOrCreateSite } from './helpers.js';\n\nexport class NetlifyDeployer extends MastraDeployer {\n constructor({ scope, env, projectName }: { projectName: string; env?: Record<string, any>; scope: string }) {\n super({ scope, env, projectName });\n }\n\n writeFiles({ dir }: { dir: string }): void {\n if (!existsSync(join(dir, 'netlify/functions/api'))) {\n mkdirSync(join(dir, 'netlify/functions/api'), { recursive: true });\n }\n\n // TODO ENV KEYS\n writeFileSync(\n join(dir, 'netlify.toml'),\n `\n [functions]\n node_bundler = \"esbuild\" \n directory = \"/netlify/functions\"\n\n [[redirects]]\n force = true\n from = \"/*\"\n status = 200\n to = \"/.netlify/functions/api/:splat\"\n `,\n );\n\n this.writeIndex({ dir });\n }\n\n async deploy({ dir, token }: { dir: string; token: string }): Promise<void> {\n const site = await getOrCreateSite({ token, name: this.projectName || `mastra`, scope: this.scope });\n\n const p2 = execa(\n 'netlify',\n ['deploy', '--site', site.id, '--auth', token, '--dir', '.', '--functions', './netlify/functions'],\n {\n cwd: dir,\n },\n );\n\n p2.stdout.pipe(process.stdout);\n await p2;\n }\n\n writeIndex({ dir }: { dir: string }): void {\n ['mastra.mjs', 'hono.mjs', 'server.mjs'].forEach(file => {\n renameSync(join(dir, file), join(dir, `netlify/functions/api/${file}`));\n });\n\n writeFileSync(\n join(dir, 'netlify/functions/api/api.mts'),\n ` \n export default async (req, context) => {\n const { app } = await import('./hono.mjs');\n // Pass the request directly to Hono\n return app.fetch(req, {\n // Optional context passing if needed\n env: { context }\n })\n }\n `,\n );\n }\n}\n"],"names":["createNetlifySite","_x","_createNetlifySite","apply","arguments","_asyncToGenerator","_regeneratorRuntime","mark","_callee","_ref","token","name","scope","response","data","wrap","_callee$","_context","prev","next","console","log","fetch","method","headers","Authorization","body","JSON","stringify","account_slug","force_ssl","sent","json","ok","error","Error","message","abrupt","id","url","ssl_url","adminUrl","admin_url","stop","findNetlifySite","_x2","_findNetlifySite","_callee2","_ref2","_callee2$","_context2","find","site","getOrCreateSite","_x3","_getOrCreateSite","_callee3","_ref3","existingSite","_callee3$","_context3","t0","NetlifyDeployer","_MastraDeployer","env","projectName","call","_inheritsLoose","_proto","prototype","writeFiles","dir","existsSync","join","mkdirSync","recursive","writeFileSync","writeIndex","deploy","_deploy","p2","execa","cwd","stdout","pipe","process","_ref4","forEach","file","renameSync","MastraDeployer"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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M,CAAC,CAAA;AAAClE,YAAAA,QAAA,CAAAE,IAAA,GAAA,CAAA,CAAA;AAAA,YAAA,OACzB6D,EAAE,CAAA;AAAA,UAAA,KAAA,CAAA,CAAA;AAAA,UAAA,KAAA,KAAA;YAAA,OAAA/D,QAAA,CAAA0B,IAAA,EAAA,CAAA;AAAA,SAAA;AAAA,OAAA,EAAAnC,OAAA,EAAA,IAAA,CAAA,CAAA;KACT,CAAA,CAAA,CAAA;IAAA,SAbKsE,MAAMA,CAAA7E,EAAA,EAAA;AAAA,MAAA,OAAA8E,OAAA,CAAA5E,KAAA,CAAA,IAAA,EAAAC,SAAA,CAAA,CAAA;AAAA,KAAA;AAAA,IAAA,OAAN0E,MAAM,CAAA;AAAA,GAAA,EAAA,CAAA;AAAAV,EAAAA,MAAA,CAeZS,UAAU,GAAV,SAAAA,UAAUA,CAAAS,KAAA,EAAyB;AAAA,IAAA,IAAtBf,GAAG,GAAAe,KAAA,CAAHf,GAAG,CAAA;IACd,CAAC,YAAY,EAAE,UAAU,EAAE,YAAY,CAAC,CAACgB,OAAO,CAAC,UAAAC,IAAI,EAAG;AACtDC,MAAAA,UAAU,CAAChB,IAAI,CAACF,GAAG,EAAEiB,IAAI,CAAC,EAAEf,IAAI,CAACF,GAAG,EAA2BiB,wBAAAA,GAAAA,IAAM,CAAC,CAAC,CAAA;AACzE,KAAC,CAAC,CAAA;IAEFZ,aAAa,CACXH,IAAI,CAACF,GAAG,EAAE,+BAA+B,CAAC,iZAUnC,CACR,CAAA;GACF,CAAA;AAAA,EAAA,OAAAT,eAAA,CAAA;AAAA,CAAA,CA9DkC4B,cAAc;;;;"}
package/dist/helpers.d.ts DELETED
@@ -1,6 +0,0 @@
1
- export declare function getOrCreateSite({ token, name, scope }: {
2
- token: string;
3
- name: string;
4
- scope: string;
5
- }): Promise<any>;
6
- //# sourceMappingURL=helpers.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAgDA,wBAAsB,eAAe,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,gBAW3G"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAO9C,qBAAa,eAAgB,SAAQ,cAAc;gBACrC,EAAE,KAAK,EAAE,GAAG,EAAE,WAAW,EAAE,EAAE;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE;IAI1G,UAAU,CAAC,EAAE,GAAG,EAAE,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAwBpC,MAAM,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAe3E,UAAU,CAAC,EAAE,GAAG,EAAE,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;CAmB3C"}