@mastra/deployer-netlify 0.0.1-alpha.0
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/CHANGELOG.md +9 -0
- package/LICENSE +44 -0
- package/dist/deployer-netlify.cjs.development.js +551 -0
- package/dist/deployer-netlify.cjs.development.js.map +1 -0
- package/dist/deployer-netlify.cjs.production.min.js +2 -0
- package/dist/deployer-netlify.cjs.production.min.js.map +1 -0
- package/dist/deployer-netlify.esm.js +547 -0
- package/dist/deployer-netlify.esm.js.map +1 -0
- package/dist/helpers.d.ts +6 -0
- package/dist/helpers.d.ts.map +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/package.json +49 -0
- package/src/helpers.ts +60 -0
- package/src/index.ts +71 -0
- package/tsconfig.json +10 -0
- package/vitest.config.ts +8 -0
package/CHANGELOG.md
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
Elastic License 2.0 (ELv2)
|
|
2
|
+
|
|
3
|
+
**Acceptance**
|
|
4
|
+
By using the software, you agree to all of the terms and conditions below.
|
|
5
|
+
|
|
6
|
+
**Copyright License**
|
|
7
|
+
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
|
|
8
|
+
|
|
9
|
+
**Limitations**
|
|
10
|
+
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.
|
|
11
|
+
|
|
12
|
+
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.
|
|
13
|
+
|
|
14
|
+
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.
|
|
15
|
+
|
|
16
|
+
**Patents**
|
|
17
|
+
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.
|
|
18
|
+
|
|
19
|
+
**Notices**
|
|
20
|
+
You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these terms.
|
|
21
|
+
|
|
22
|
+
If you modify the software, you must include in any modified copies of the software prominent notices stating that you have modified the software.
|
|
23
|
+
|
|
24
|
+
**No Other Rights**
|
|
25
|
+
These terms do not imply any licenses other than those expressly granted in these terms.
|
|
26
|
+
|
|
27
|
+
**Termination**
|
|
28
|
+
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.
|
|
29
|
+
|
|
30
|
+
**No Liability**
|
|
31
|
+
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.
|
|
32
|
+
|
|
33
|
+
**Definitions**
|
|
34
|
+
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.
|
|
35
|
+
|
|
36
|
+
_you_ refers to the individual or entity agreeing to these terms.
|
|
37
|
+
|
|
38
|
+
_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.
|
|
39
|
+
|
|
40
|
+
_your licenses_ are all the licenses granted to you for the software under these terms.
|
|
41
|
+
|
|
42
|
+
_use_ means anything you do with the software requiring one of your licenses.
|
|
43
|
+
|
|
44
|
+
_trademark_ means trademarks, service marks, and similar rights.
|
|
@@ -0,0 +1,551 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var core = require('@mastra/core');
|
|
6
|
+
var execa = require('execa');
|
|
7
|
+
var fs = require('fs');
|
|
8
|
+
var path = require('path');
|
|
9
|
+
|
|
10
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
11
|
+
try {
|
|
12
|
+
var i = n[a](c),
|
|
13
|
+
u = i.value;
|
|
14
|
+
} catch (n) {
|
|
15
|
+
return void e(n);
|
|
16
|
+
}
|
|
17
|
+
i.done ? t(u) : Promise.resolve(u).then(r, o);
|
|
18
|
+
}
|
|
19
|
+
function _asyncToGenerator(n) {
|
|
20
|
+
return function () {
|
|
21
|
+
var t = this,
|
|
22
|
+
e = arguments;
|
|
23
|
+
return new Promise(function (r, o) {
|
|
24
|
+
var a = n.apply(t, e);
|
|
25
|
+
function _next(n) {
|
|
26
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
|
|
27
|
+
}
|
|
28
|
+
function _throw(n) {
|
|
29
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
|
|
30
|
+
}
|
|
31
|
+
_next(void 0);
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function _inheritsLoose(t, o) {
|
|
36
|
+
t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
|
|
37
|
+
}
|
|
38
|
+
function _regeneratorRuntime() {
|
|
39
|
+
_regeneratorRuntime = function () {
|
|
40
|
+
return e;
|
|
41
|
+
};
|
|
42
|
+
var t,
|
|
43
|
+
e = {},
|
|
44
|
+
r = Object.prototype,
|
|
45
|
+
n = r.hasOwnProperty,
|
|
46
|
+
o = Object.defineProperty || function (t, e, r) {
|
|
47
|
+
t[e] = r.value;
|
|
48
|
+
},
|
|
49
|
+
i = "function" == typeof Symbol ? Symbol : {},
|
|
50
|
+
a = i.iterator || "@@iterator",
|
|
51
|
+
c = i.asyncIterator || "@@asyncIterator",
|
|
52
|
+
u = i.toStringTag || "@@toStringTag";
|
|
53
|
+
function define(t, e, r) {
|
|
54
|
+
return Object.defineProperty(t, e, {
|
|
55
|
+
value: r,
|
|
56
|
+
enumerable: !0,
|
|
57
|
+
configurable: !0,
|
|
58
|
+
writable: !0
|
|
59
|
+
}), t[e];
|
|
60
|
+
}
|
|
61
|
+
try {
|
|
62
|
+
define({}, "");
|
|
63
|
+
} catch (t) {
|
|
64
|
+
define = function (t, e, r) {
|
|
65
|
+
return t[e] = r;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
function wrap(t, e, r, n) {
|
|
69
|
+
var i = e && e.prototype instanceof Generator ? e : Generator,
|
|
70
|
+
a = Object.create(i.prototype),
|
|
71
|
+
c = new Context(n || []);
|
|
72
|
+
return o(a, "_invoke", {
|
|
73
|
+
value: makeInvokeMethod(t, r, c)
|
|
74
|
+
}), a;
|
|
75
|
+
}
|
|
76
|
+
function tryCatch(t, e, r) {
|
|
77
|
+
try {
|
|
78
|
+
return {
|
|
79
|
+
type: "normal",
|
|
80
|
+
arg: t.call(e, r)
|
|
81
|
+
};
|
|
82
|
+
} catch (t) {
|
|
83
|
+
return {
|
|
84
|
+
type: "throw",
|
|
85
|
+
arg: t
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
e.wrap = wrap;
|
|
90
|
+
var h = "suspendedStart",
|
|
91
|
+
l = "suspendedYield",
|
|
92
|
+
f = "executing",
|
|
93
|
+
s = "completed",
|
|
94
|
+
y = {};
|
|
95
|
+
function Generator() {}
|
|
96
|
+
function GeneratorFunction() {}
|
|
97
|
+
function GeneratorFunctionPrototype() {}
|
|
98
|
+
var p = {};
|
|
99
|
+
define(p, a, function () {
|
|
100
|
+
return this;
|
|
101
|
+
});
|
|
102
|
+
var d = Object.getPrototypeOf,
|
|
103
|
+
v = d && d(d(values([])));
|
|
104
|
+
v && v !== r && n.call(v, a) && (p = v);
|
|
105
|
+
var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
|
|
106
|
+
function defineIteratorMethods(t) {
|
|
107
|
+
["next", "throw", "return"].forEach(function (e) {
|
|
108
|
+
define(t, e, function (t) {
|
|
109
|
+
return this._invoke(e, t);
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
function AsyncIterator(t, e) {
|
|
114
|
+
function invoke(r, o, i, a) {
|
|
115
|
+
var c = tryCatch(t[r], t, o);
|
|
116
|
+
if ("throw" !== c.type) {
|
|
117
|
+
var u = c.arg,
|
|
118
|
+
h = u.value;
|
|
119
|
+
return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
|
|
120
|
+
invoke("next", t, i, a);
|
|
121
|
+
}, function (t) {
|
|
122
|
+
invoke("throw", t, i, a);
|
|
123
|
+
}) : e.resolve(h).then(function (t) {
|
|
124
|
+
u.value = t, i(u);
|
|
125
|
+
}, function (t) {
|
|
126
|
+
return invoke("throw", t, i, a);
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
a(c.arg);
|
|
130
|
+
}
|
|
131
|
+
var r;
|
|
132
|
+
o(this, "_invoke", {
|
|
133
|
+
value: function (t, n) {
|
|
134
|
+
function callInvokeWithMethodAndArg() {
|
|
135
|
+
return new e(function (e, r) {
|
|
136
|
+
invoke(t, n, e, r);
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
function makeInvokeMethod(e, r, n) {
|
|
144
|
+
var o = h;
|
|
145
|
+
return function (i, a) {
|
|
146
|
+
if (o === f) throw Error("Generator is already running");
|
|
147
|
+
if (o === s) {
|
|
148
|
+
if ("throw" === i) throw a;
|
|
149
|
+
return {
|
|
150
|
+
value: t,
|
|
151
|
+
done: !0
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
for (n.method = i, n.arg = a;;) {
|
|
155
|
+
var c = n.delegate;
|
|
156
|
+
if (c) {
|
|
157
|
+
var u = maybeInvokeDelegate(c, n);
|
|
158
|
+
if (u) {
|
|
159
|
+
if (u === y) continue;
|
|
160
|
+
return u;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
|
|
164
|
+
if (o === h) throw o = s, n.arg;
|
|
165
|
+
n.dispatchException(n.arg);
|
|
166
|
+
} else "return" === n.method && n.abrupt("return", n.arg);
|
|
167
|
+
o = f;
|
|
168
|
+
var p = tryCatch(e, r, n);
|
|
169
|
+
if ("normal" === p.type) {
|
|
170
|
+
if (o = n.done ? s : l, p.arg === y) continue;
|
|
171
|
+
return {
|
|
172
|
+
value: p.arg,
|
|
173
|
+
done: n.done
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
"throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
function maybeInvokeDelegate(e, r) {
|
|
181
|
+
var n = r.method,
|
|
182
|
+
o = e.iterator[n];
|
|
183
|
+
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;
|
|
184
|
+
var i = tryCatch(o, e.iterator, r.arg);
|
|
185
|
+
if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
|
|
186
|
+
var a = i.arg;
|
|
187
|
+
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);
|
|
188
|
+
}
|
|
189
|
+
function pushTryEntry(t) {
|
|
190
|
+
var e = {
|
|
191
|
+
tryLoc: t[0]
|
|
192
|
+
};
|
|
193
|
+
1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
|
|
194
|
+
}
|
|
195
|
+
function resetTryEntry(t) {
|
|
196
|
+
var e = t.completion || {};
|
|
197
|
+
e.type = "normal", delete e.arg, t.completion = e;
|
|
198
|
+
}
|
|
199
|
+
function Context(t) {
|
|
200
|
+
this.tryEntries = [{
|
|
201
|
+
tryLoc: "root"
|
|
202
|
+
}], t.forEach(pushTryEntry, this), this.reset(!0);
|
|
203
|
+
}
|
|
204
|
+
function values(e) {
|
|
205
|
+
if (e || "" === e) {
|
|
206
|
+
var r = e[a];
|
|
207
|
+
if (r) return r.call(e);
|
|
208
|
+
if ("function" == typeof e.next) return e;
|
|
209
|
+
if (!isNaN(e.length)) {
|
|
210
|
+
var o = -1,
|
|
211
|
+
i = function next() {
|
|
212
|
+
for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
|
|
213
|
+
return next.value = t, next.done = !0, next;
|
|
214
|
+
};
|
|
215
|
+
return i.next = i;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
throw new TypeError(typeof e + " is not iterable");
|
|
219
|
+
}
|
|
220
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
|
|
221
|
+
value: GeneratorFunctionPrototype,
|
|
222
|
+
configurable: !0
|
|
223
|
+
}), o(GeneratorFunctionPrototype, "constructor", {
|
|
224
|
+
value: GeneratorFunction,
|
|
225
|
+
configurable: !0
|
|
226
|
+
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
|
|
227
|
+
var e = "function" == typeof t && t.constructor;
|
|
228
|
+
return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
|
|
229
|
+
}, e.mark = function (t) {
|
|
230
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
|
|
231
|
+
}, e.awrap = function (t) {
|
|
232
|
+
return {
|
|
233
|
+
__await: t
|
|
234
|
+
};
|
|
235
|
+
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
|
|
236
|
+
return this;
|
|
237
|
+
}), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
|
|
238
|
+
void 0 === i && (i = Promise);
|
|
239
|
+
var a = new AsyncIterator(wrap(t, r, n, o), i);
|
|
240
|
+
return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
|
|
241
|
+
return t.done ? t.value : a.next();
|
|
242
|
+
});
|
|
243
|
+
}, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
|
|
244
|
+
return this;
|
|
245
|
+
}), define(g, "toString", function () {
|
|
246
|
+
return "[object Generator]";
|
|
247
|
+
}), e.keys = function (t) {
|
|
248
|
+
var e = Object(t),
|
|
249
|
+
r = [];
|
|
250
|
+
for (var n in e) r.push(n);
|
|
251
|
+
return r.reverse(), function next() {
|
|
252
|
+
for (; r.length;) {
|
|
253
|
+
var t = r.pop();
|
|
254
|
+
if (t in e) return next.value = t, next.done = !1, next;
|
|
255
|
+
}
|
|
256
|
+
return next.done = !0, next;
|
|
257
|
+
};
|
|
258
|
+
}, e.values = values, Context.prototype = {
|
|
259
|
+
constructor: Context,
|
|
260
|
+
reset: function (e) {
|
|
261
|
+
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);
|
|
262
|
+
},
|
|
263
|
+
stop: function () {
|
|
264
|
+
this.done = !0;
|
|
265
|
+
var t = this.tryEntries[0].completion;
|
|
266
|
+
if ("throw" === t.type) throw t.arg;
|
|
267
|
+
return this.rval;
|
|
268
|
+
},
|
|
269
|
+
dispatchException: function (e) {
|
|
270
|
+
if (this.done) throw e;
|
|
271
|
+
var r = this;
|
|
272
|
+
function handle(n, o) {
|
|
273
|
+
return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
|
|
274
|
+
}
|
|
275
|
+
for (var o = this.tryEntries.length - 1; o >= 0; --o) {
|
|
276
|
+
var i = this.tryEntries[o],
|
|
277
|
+
a = i.completion;
|
|
278
|
+
if ("root" === i.tryLoc) return handle("end");
|
|
279
|
+
if (i.tryLoc <= this.prev) {
|
|
280
|
+
var c = n.call(i, "catchLoc"),
|
|
281
|
+
u = n.call(i, "finallyLoc");
|
|
282
|
+
if (c && u) {
|
|
283
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
284
|
+
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
285
|
+
} else if (c) {
|
|
286
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
287
|
+
} else {
|
|
288
|
+
if (!u) throw Error("try statement without catch or finally");
|
|
289
|
+
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
abrupt: function (t, e) {
|
|
295
|
+
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
|
|
296
|
+
var o = this.tryEntries[r];
|
|
297
|
+
if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
|
|
298
|
+
var i = o;
|
|
299
|
+
break;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
|
|
303
|
+
var a = i ? i.completion : {};
|
|
304
|
+
return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
|
|
305
|
+
},
|
|
306
|
+
complete: function (t, e) {
|
|
307
|
+
if ("throw" === t.type) throw t.arg;
|
|
308
|
+
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;
|
|
309
|
+
},
|
|
310
|
+
finish: function (t) {
|
|
311
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
312
|
+
var r = this.tryEntries[e];
|
|
313
|
+
if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
|
|
314
|
+
}
|
|
315
|
+
},
|
|
316
|
+
catch: function (t) {
|
|
317
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
318
|
+
var r = this.tryEntries[e];
|
|
319
|
+
if (r.tryLoc === t) {
|
|
320
|
+
var n = r.completion;
|
|
321
|
+
if ("throw" === n.type) {
|
|
322
|
+
var o = n.arg;
|
|
323
|
+
resetTryEntry(r);
|
|
324
|
+
}
|
|
325
|
+
return o;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
throw Error("illegal catch attempt");
|
|
329
|
+
},
|
|
330
|
+
delegateYield: function (e, r, n) {
|
|
331
|
+
return this.delegate = {
|
|
332
|
+
iterator: values(e),
|
|
333
|
+
resultName: r,
|
|
334
|
+
nextLoc: n
|
|
335
|
+
}, "next" === this.method && (this.arg = t), y;
|
|
336
|
+
}
|
|
337
|
+
}, e;
|
|
338
|
+
}
|
|
339
|
+
function _setPrototypeOf(t, e) {
|
|
340
|
+
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
|
|
341
|
+
return t.__proto__ = e, t;
|
|
342
|
+
}, _setPrototypeOf(t, e);
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
function createNetlifySite(_x) {
|
|
346
|
+
return _createNetlifySite.apply(this, arguments);
|
|
347
|
+
}
|
|
348
|
+
function _createNetlifySite() {
|
|
349
|
+
_createNetlifySite = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
|
|
350
|
+
var token, name, scope, response, data;
|
|
351
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
352
|
+
while (1) switch (_context.prev = _context.next) {
|
|
353
|
+
case 0:
|
|
354
|
+
token = _ref.token, name = _ref.name, scope = _ref.scope;
|
|
355
|
+
console.log(token, name, scope);
|
|
356
|
+
_context.next = 4;
|
|
357
|
+
return fetch('https://api.netlify.com/api/v1/sites', {
|
|
358
|
+
method: 'POST',
|
|
359
|
+
headers: {
|
|
360
|
+
Authorization: "Bearer " + token,
|
|
361
|
+
'Content-Type': 'application/json'
|
|
362
|
+
},
|
|
363
|
+
body: JSON.stringify({
|
|
364
|
+
name: name,
|
|
365
|
+
account_slug: scope,
|
|
366
|
+
// Optional - if not provided, creates in user's default account
|
|
367
|
+
force_ssl: true // Enable HTTPS
|
|
368
|
+
})
|
|
369
|
+
});
|
|
370
|
+
case 4:
|
|
371
|
+
response = _context.sent;
|
|
372
|
+
_context.next = 7;
|
|
373
|
+
return response.json();
|
|
374
|
+
case 7:
|
|
375
|
+
data = _context.sent;
|
|
376
|
+
if (response.ok) {
|
|
377
|
+
_context.next = 11;
|
|
378
|
+
break;
|
|
379
|
+
}
|
|
380
|
+
console.error(JSON.stringify(data));
|
|
381
|
+
throw new Error("Failed to create site: " + (data.message || 'Unknown error'));
|
|
382
|
+
case 11:
|
|
383
|
+
return _context.abrupt("return", {
|
|
384
|
+
id: data.id,
|
|
385
|
+
name: data.name,
|
|
386
|
+
url: data.ssl_url || data.url,
|
|
387
|
+
adminUrl: data.admin_url
|
|
388
|
+
});
|
|
389
|
+
case 12:
|
|
390
|
+
case "end":
|
|
391
|
+
return _context.stop();
|
|
392
|
+
}
|
|
393
|
+
}, _callee);
|
|
394
|
+
}));
|
|
395
|
+
return _createNetlifySite.apply(this, arguments);
|
|
396
|
+
}
|
|
397
|
+
function findNetlifySite(_x2) {
|
|
398
|
+
return _findNetlifySite.apply(this, arguments);
|
|
399
|
+
}
|
|
400
|
+
function _findNetlifySite() {
|
|
401
|
+
_findNetlifySite = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref2) {
|
|
402
|
+
var token, name, scope, response, data;
|
|
403
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
404
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
405
|
+
case 0:
|
|
406
|
+
token = _ref2.token, name = _ref2.name, scope = _ref2.scope;
|
|
407
|
+
_context2.next = 3;
|
|
408
|
+
return fetch("https://api.netlify.com/api/v1/" + scope + "/sites?filter=all&name=" + name, {
|
|
409
|
+
headers: {
|
|
410
|
+
Authorization: "Bearer " + token,
|
|
411
|
+
'Content-Type': 'application/json'
|
|
412
|
+
}
|
|
413
|
+
});
|
|
414
|
+
case 3:
|
|
415
|
+
response = _context2.sent;
|
|
416
|
+
_context2.next = 6;
|
|
417
|
+
return response.json();
|
|
418
|
+
case 6:
|
|
419
|
+
data = _context2.sent;
|
|
420
|
+
if (response.ok) {
|
|
421
|
+
_context2.next = 9;
|
|
422
|
+
break;
|
|
423
|
+
}
|
|
424
|
+
throw new Error("Failed to search sites: " + (data.message || 'Unknown error'));
|
|
425
|
+
case 9:
|
|
426
|
+
return _context2.abrupt("return", data.find(function (site) {
|
|
427
|
+
return site.name === name;
|
|
428
|
+
}));
|
|
429
|
+
case 10:
|
|
430
|
+
case "end":
|
|
431
|
+
return _context2.stop();
|
|
432
|
+
}
|
|
433
|
+
}, _callee2);
|
|
434
|
+
}));
|
|
435
|
+
return _findNetlifySite.apply(this, arguments);
|
|
436
|
+
}
|
|
437
|
+
function getOrCreateSite(_x3) {
|
|
438
|
+
return _getOrCreateSite.apply(this, arguments);
|
|
439
|
+
}
|
|
440
|
+
function _getOrCreateSite() {
|
|
441
|
+
_getOrCreateSite = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref3) {
|
|
442
|
+
var token, name, scope, existingSite;
|
|
443
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
444
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
445
|
+
case 0:
|
|
446
|
+
token = _ref3.token, name = _ref3.name, scope = _ref3.scope;
|
|
447
|
+
_context3.prev = 1;
|
|
448
|
+
_context3.next = 4;
|
|
449
|
+
return findNetlifySite({
|
|
450
|
+
token: token,
|
|
451
|
+
name: name,
|
|
452
|
+
scope: scope
|
|
453
|
+
});
|
|
454
|
+
case 4:
|
|
455
|
+
existingSite = _context3.sent;
|
|
456
|
+
_context3.next = 9;
|
|
457
|
+
break;
|
|
458
|
+
case 7:
|
|
459
|
+
_context3.prev = 7;
|
|
460
|
+
_context3.t0 = _context3["catch"](1);
|
|
461
|
+
case 9:
|
|
462
|
+
if (!existingSite) {
|
|
463
|
+
_context3.next = 11;
|
|
464
|
+
break;
|
|
465
|
+
}
|
|
466
|
+
return _context3.abrupt("return", existingSite);
|
|
467
|
+
case 11:
|
|
468
|
+
return _context3.abrupt("return", createNetlifySite({
|
|
469
|
+
token: token,
|
|
470
|
+
name: name,
|
|
471
|
+
scope: scope
|
|
472
|
+
}));
|
|
473
|
+
case 12:
|
|
474
|
+
case "end":
|
|
475
|
+
return _context3.stop();
|
|
476
|
+
}
|
|
477
|
+
}, _callee3, null, [[1, 7]]);
|
|
478
|
+
}));
|
|
479
|
+
return _getOrCreateSite.apply(this, arguments);
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
var NetlifyDeployer = /*#__PURE__*/function (_MastraDeployer) {
|
|
483
|
+
function NetlifyDeployer(_ref) {
|
|
484
|
+
var scope = _ref.scope,
|
|
485
|
+
env = _ref.env,
|
|
486
|
+
projectName = _ref.projectName;
|
|
487
|
+
return _MastraDeployer.call(this, {
|
|
488
|
+
scope: scope,
|
|
489
|
+
env: env,
|
|
490
|
+
projectName: projectName
|
|
491
|
+
}) || this;
|
|
492
|
+
}
|
|
493
|
+
_inheritsLoose(NetlifyDeployer, _MastraDeployer);
|
|
494
|
+
var _proto = NetlifyDeployer.prototype;
|
|
495
|
+
_proto.writeFiles = function writeFiles(_ref2) {
|
|
496
|
+
var dir = _ref2.dir;
|
|
497
|
+
if (!fs.existsSync(path.join(dir, 'netlify/functions/api'))) {
|
|
498
|
+
fs.mkdirSync(path.join(dir, 'netlify/functions/api'), {
|
|
499
|
+
recursive: true
|
|
500
|
+
});
|
|
501
|
+
}
|
|
502
|
+
// TODO ENV KEYS
|
|
503
|
+
fs.writeFileSync(path.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 ");
|
|
504
|
+
this.writeIndex({
|
|
505
|
+
dir: dir
|
|
506
|
+
});
|
|
507
|
+
};
|
|
508
|
+
_proto.deploy = /*#__PURE__*/function () {
|
|
509
|
+
var _deploy = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref3) {
|
|
510
|
+
var dir, token, site, p2;
|
|
511
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
512
|
+
while (1) switch (_context.prev = _context.next) {
|
|
513
|
+
case 0:
|
|
514
|
+
dir = _ref3.dir, token = _ref3.token;
|
|
515
|
+
_context.next = 3;
|
|
516
|
+
return getOrCreateSite({
|
|
517
|
+
token: token,
|
|
518
|
+
name: this.projectName || "mastra",
|
|
519
|
+
scope: this.scope
|
|
520
|
+
});
|
|
521
|
+
case 3:
|
|
522
|
+
site = _context.sent;
|
|
523
|
+
p2 = execa.execa('netlify', ['deploy', '--site', site.id, '--auth', token, '--dir', '.', '--functions', './netlify/functions'], {
|
|
524
|
+
cwd: dir
|
|
525
|
+
});
|
|
526
|
+
p2.stdout.pipe(process.stdout);
|
|
527
|
+
_context.next = 8;
|
|
528
|
+
return p2;
|
|
529
|
+
case 8:
|
|
530
|
+
case "end":
|
|
531
|
+
return _context.stop();
|
|
532
|
+
}
|
|
533
|
+
}, _callee, this);
|
|
534
|
+
}));
|
|
535
|
+
function deploy(_x) {
|
|
536
|
+
return _deploy.apply(this, arguments);
|
|
537
|
+
}
|
|
538
|
+
return deploy;
|
|
539
|
+
}();
|
|
540
|
+
_proto.writeIndex = function writeIndex(_ref4) {
|
|
541
|
+
var dir = _ref4.dir;
|
|
542
|
+
['mastra.mjs', 'hono.mjs', 'server.mjs'].forEach(function (file) {
|
|
543
|
+
fs.renameSync(path.join(dir, file), path.join(dir, "netlify/functions/api/" + file));
|
|
544
|
+
});
|
|
545
|
+
fs.writeFileSync(path.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 ");
|
|
546
|
+
};
|
|
547
|
+
return NetlifyDeployer;
|
|
548
|
+
}(core.MastraDeployer);
|
|
549
|
+
|
|
550
|
+
exports.NetlifyDeployer = NetlifyDeployer;
|
|
551
|
+
//# sourceMappingURL=deployer-netlify.cjs.development.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deployer-netlify.cjs.development.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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAeA,SAAAA,iBAAiBA,CAAAC,EAAA,EAAA;AA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,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,aAAU,CAAChB,SAAI,CAACF,GAAG,EAAEiB,IAAI,CAAC,EAAEf,SAAI,CAACF,GAAG,EAA2BiB,wBAAAA,GAAAA,IAAM,CAAC,CAAC,CAAA;AACzE,KAAC,CAAC,CAAA;IAEFZ,gBAAa,CACXH,SAAI,CAACF,GAAG,EAAE,+BAA+B,CAAC,iZAUnC,CACR,CAAA;GACF,CAAA;AAAA,EAAA,OAAAT,eAAA,CAAA;AAAA,CAAA,CA9DkC4B,mBAAc;;;;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@mastra/core"),e=require("execa"),r=require("fs"),n=require("path");function o(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function i(t){return function(){var e=this,r=arguments;return new Promise((function(n,i){var a=t.apply(e,r);function c(t){o(a,n,i,c,u,"next",t)}function u(t){o(a,n,i,c,u,"throw",t)}c(void 0)}))}}function a(){a=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},c=i.iterator||"@@iterator",u=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function f(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{f({},"")}catch(t){f=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var i=Object.create((e&&e.prototype instanceof g?e:g).prototype),a=new F(n||[]);return o(i,"_invoke",{value:O(t,r,a)}),i}function p(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var h="suspendedStart",y="suspendedYield",v="executing",d="completed",m={};function g(){}function w(){}function x(){}var b={};f(b,c,(function(){return this}));var j=Object.getPrototypeOf,k=j&&j(j(T([])));k&&k!==r&&n.call(k,c)&&(b=k);var L=x.prototype=g.prototype=Object.create(b);function E(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,e){function r(o,i,a,c){var u=p(t[o],t,i);if("throw"!==u.type){var s=u.arg,f=s.value;return f&&"object"==typeof f&&n.call(f,"__await")?e.resolve(f.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(f).then((function(t){s.value=t,a(s)}),(function(t){return r("throw",t,a,c)}))}c(u.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function O(e,r,n){var o=h;return function(i,a){if(o===v)throw Error("Generator is already running");if(o===d){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=N(c,n);if(u){if(u===m)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=d,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=v;var s=p(e,r,n);if("normal"===s.type){if(o=n.done?d:y,s.arg===m)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=d,n.method="throw",n.arg=s.arg)}}}function N(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,N(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var i=p(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,m;var a=i.arg;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,m):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function P(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function S(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function F(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function T(e){if(e||""===e){var r=e[c];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(typeof e+" is not iterable")}return w.prototype=x,o(L,"constructor",{value:x,configurable:!0}),o(x,"constructor",{value:w,configurable:!0}),w.displayName=f(x,s,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,x):(t.__proto__=x,f(t,s,"GeneratorFunction")),t.prototype=Object.create(L),t},e.awrap=function(t){return{__await:t}},E(_.prototype),f(_.prototype,u,(function(){return this})),e.AsyncIterator=_,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new _(l(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},E(L),f(L,s,"Generator"),f(L,c,(function(){return this})),f(L,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=T,F.prototype={constructor:F,reset:function(e){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(S),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),s=n.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;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),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),S(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;S(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:T(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),m}},e}function c(t,e){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},c(t,e)}function u(t){return s.apply(this,arguments)}function s(){return(s=i(a().mark((function t(e){var r,n,o,i,c;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.token,n=e.name,o=e.scope,console.log(r,n,o),t.next=4,fetch("https://api.netlify.com/api/v1/sites",{method:"POST",headers:{Authorization:"Bearer "+r,"Content-Type":"application/json"},body:JSON.stringify({name:n,account_slug:o,force_ssl:!0})});case 4:return i=t.sent,t.next=7,i.json();case 7:if(c=t.sent,i.ok){t.next=11;break}throw console.error(JSON.stringify(c)),new Error("Failed to create site: "+(c.message||"Unknown error"));case 11:return t.abrupt("return",{id:c.id,name:c.name,url:c.ssl_url||c.url,adminUrl:c.admin_url});case 12:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function f(t){return l.apply(this,arguments)}function l(){return(l=i(a().mark((function t(e){var r,n,o,i,c;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.token,n=e.name,o=e.scope,t.next=3,fetch("https://api.netlify.com/api/v1/"+o+"/sites?filter=all&name="+n,{headers:{Authorization:"Bearer "+r,"Content-Type":"application/json"}});case 3:return i=t.sent,t.next=6,i.json();case 6:if(c=t.sent,i.ok){t.next=9;break}throw new Error("Failed to search sites: "+(c.message||"Unknown error"));case 9:return t.abrupt("return",c.find((function(t){return t.name===n})));case 10:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function p(t){return h.apply(this,arguments)}function h(){return(h=i(a().mark((function t(e){var r,n,o,i;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.token,n=e.name,o=e.scope,t.prev=1,t.next=4,f({token:r,name:n,scope:o});case 4:i=t.sent,t.next=9;break;case 7:t.prev=7,t.t0=t.catch(1);case 9:if(!i){t.next=11;break}return t.abrupt("return",i);case 11:return t.abrupt("return",u({token:r,name:n,scope:o}));case 12:case"end":return t.stop()}}),t,null,[[1,7]])})))).apply(this,arguments)}exports.NetlifyDeployer=function(t){function o(e){return t.call(this,{scope:e.scope,env:e.env,projectName:e.projectName})||this}var u,s;s=t,(u=o).prototype=Object.create(s.prototype),u.prototype.constructor=u,c(u,s);var f=o.prototype;return f.writeFiles=function(t){var e=t.dir;r.existsSync(n.join(e,"netlify/functions/api"))||r.mkdirSync(n.join(e,"netlify/functions/api"),{recursive:!0}),r.writeFileSync(n.join(e,"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 '),this.writeIndex({dir:e})},f.deploy=function(){var t=i(a().mark((function t(r){var n,o,i;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=r.dir,o=r.token,t.next=3,p({token:o,name:this.projectName||"mastra",scope:this.scope});case 3:return(i=e.execa("netlify",["deploy","--site",t.sent.id,"--auth",o,"--dir",".","--functions","./netlify/functions"],{cwd:n})).stdout.pipe(process.stdout),t.next=8,i;case 8:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),f.writeIndex=function(t){var e=t.dir;["mastra.mjs","hono.mjs","server.mjs"].forEach((function(t){r.renameSync(n.join(e,t),n.join(e,"netlify/functions/api/"+t))})),r.writeFileSync(n.join(e,"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 ")},o}(t.MastraDeployer);
|
|
2
|
+
//# sourceMappingURL=deployer-netlify.cjs.production.min.js.map
|