@mastra/deployer-cloudflare 0.0.1-alpha.11 → 0.0.1-alpha.12
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/package.json +3 -3
- package/dist/deployer-cloudflare.cjs.development.js +0 -479
- package/dist/deployer-cloudflare.cjs.development.js.map +0 -1
- package/dist/deployer-cloudflare.cjs.production.min.js +0 -2
- package/dist/deployer-cloudflare.cjs.production.min.js.map +0 -1
- package/dist/deployer-cloudflare.esm.js +0 -475
- package/dist/deployer-cloudflare.esm.js.map +0 -1
- package/dist/index.d.ts +0 -40
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -8
- package/dist/secrets-manager/index.d.ts +0 -25
- package/dist/secrets-manager/index.d.ts.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @mastra/deployer-cloudflare
|
|
2
2
|
|
|
3
|
+
## 0.0.1-alpha.12
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [dd6d87f]
|
|
8
|
+
- Updated dependencies [04434b6]
|
|
9
|
+
- @mastra/core@0.1.27-alpha.70
|
|
10
|
+
- @mastra/deployer@0.0.1-alpha.10
|
|
11
|
+
|
|
3
12
|
## 0.0.1-alpha.11
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/deployer-cloudflare",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.12",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"execa": "^9.3.1",
|
|
30
30
|
"wrangler": "^3.103.2",
|
|
31
31
|
"zod": "^3.24.1",
|
|
32
|
-
"@mastra/core": "0.1.27-alpha.
|
|
33
|
-
"@mastra/deployer": "0.0.1-alpha.
|
|
32
|
+
"@mastra/core": "0.1.27-alpha.70",
|
|
33
|
+
"@mastra/deployer": "0.0.1-alpha.10"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@babel/preset-env": "^7.26.0",
|
|
@@ -1,479 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var core = require('@mastra/core');
|
|
6
|
-
var deployer = require('@mastra/deployer');
|
|
7
|
-
var cloudflare = require('cloudflare');
|
|
8
|
-
var fs = require('fs');
|
|
9
|
-
var path = require('path');
|
|
10
|
-
|
|
11
|
-
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
12
|
-
try {
|
|
13
|
-
var i = n[a](c),
|
|
14
|
-
u = i.value;
|
|
15
|
-
} catch (n) {
|
|
16
|
-
return void e(n);
|
|
17
|
-
}
|
|
18
|
-
i.done ? t(u) : Promise.resolve(u).then(r, o);
|
|
19
|
-
}
|
|
20
|
-
function _asyncToGenerator(n) {
|
|
21
|
-
return function () {
|
|
22
|
-
var t = this,
|
|
23
|
-
e = arguments;
|
|
24
|
-
return new Promise(function (r, o) {
|
|
25
|
-
var a = n.apply(t, e);
|
|
26
|
-
function _next(n) {
|
|
27
|
-
asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
|
|
28
|
-
}
|
|
29
|
-
function _throw(n) {
|
|
30
|
-
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
|
|
31
|
-
}
|
|
32
|
-
_next(void 0);
|
|
33
|
-
});
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
function _extends() {
|
|
37
|
-
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
38
|
-
for (var e = 1; e < arguments.length; e++) {
|
|
39
|
-
var t = arguments[e];
|
|
40
|
-
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
41
|
-
}
|
|
42
|
-
return n;
|
|
43
|
-
}, _extends.apply(null, arguments);
|
|
44
|
-
}
|
|
45
|
-
function _inheritsLoose(t, o) {
|
|
46
|
-
t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
|
|
47
|
-
}
|
|
48
|
-
function _regeneratorRuntime() {
|
|
49
|
-
_regeneratorRuntime = function () {
|
|
50
|
-
return e;
|
|
51
|
-
};
|
|
52
|
-
var t,
|
|
53
|
-
e = {},
|
|
54
|
-
r = Object.prototype,
|
|
55
|
-
n = r.hasOwnProperty,
|
|
56
|
-
o = Object.defineProperty || function (t, e, r) {
|
|
57
|
-
t[e] = r.value;
|
|
58
|
-
},
|
|
59
|
-
i = "function" == typeof Symbol ? Symbol : {},
|
|
60
|
-
a = i.iterator || "@@iterator",
|
|
61
|
-
c = i.asyncIterator || "@@asyncIterator",
|
|
62
|
-
u = i.toStringTag || "@@toStringTag";
|
|
63
|
-
function define(t, e, r) {
|
|
64
|
-
return Object.defineProperty(t, e, {
|
|
65
|
-
value: r,
|
|
66
|
-
enumerable: !0,
|
|
67
|
-
configurable: !0,
|
|
68
|
-
writable: !0
|
|
69
|
-
}), t[e];
|
|
70
|
-
}
|
|
71
|
-
try {
|
|
72
|
-
define({}, "");
|
|
73
|
-
} catch (t) {
|
|
74
|
-
define = function (t, e, r) {
|
|
75
|
-
return t[e] = r;
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
function wrap(t, e, r, n) {
|
|
79
|
-
var i = e && e.prototype instanceof Generator ? e : Generator,
|
|
80
|
-
a = Object.create(i.prototype),
|
|
81
|
-
c = new Context(n || []);
|
|
82
|
-
return o(a, "_invoke", {
|
|
83
|
-
value: makeInvokeMethod(t, r, c)
|
|
84
|
-
}), a;
|
|
85
|
-
}
|
|
86
|
-
function tryCatch(t, e, r) {
|
|
87
|
-
try {
|
|
88
|
-
return {
|
|
89
|
-
type: "normal",
|
|
90
|
-
arg: t.call(e, r)
|
|
91
|
-
};
|
|
92
|
-
} catch (t) {
|
|
93
|
-
return {
|
|
94
|
-
type: "throw",
|
|
95
|
-
arg: t
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
e.wrap = wrap;
|
|
100
|
-
var h = "suspendedStart",
|
|
101
|
-
l = "suspendedYield",
|
|
102
|
-
f = "executing",
|
|
103
|
-
s = "completed",
|
|
104
|
-
y = {};
|
|
105
|
-
function Generator() {}
|
|
106
|
-
function GeneratorFunction() {}
|
|
107
|
-
function GeneratorFunctionPrototype() {}
|
|
108
|
-
var p = {};
|
|
109
|
-
define(p, a, function () {
|
|
110
|
-
return this;
|
|
111
|
-
});
|
|
112
|
-
var d = Object.getPrototypeOf,
|
|
113
|
-
v = d && d(d(values([])));
|
|
114
|
-
v && v !== r && n.call(v, a) && (p = v);
|
|
115
|
-
var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
|
|
116
|
-
function defineIteratorMethods(t) {
|
|
117
|
-
["next", "throw", "return"].forEach(function (e) {
|
|
118
|
-
define(t, e, function (t) {
|
|
119
|
-
return this._invoke(e, t);
|
|
120
|
-
});
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
function AsyncIterator(t, e) {
|
|
124
|
-
function invoke(r, o, i, a) {
|
|
125
|
-
var c = tryCatch(t[r], t, o);
|
|
126
|
-
if ("throw" !== c.type) {
|
|
127
|
-
var u = c.arg,
|
|
128
|
-
h = u.value;
|
|
129
|
-
return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
|
|
130
|
-
invoke("next", t, i, a);
|
|
131
|
-
}, function (t) {
|
|
132
|
-
invoke("throw", t, i, a);
|
|
133
|
-
}) : e.resolve(h).then(function (t) {
|
|
134
|
-
u.value = t, i(u);
|
|
135
|
-
}, function (t) {
|
|
136
|
-
return invoke("throw", t, i, a);
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
a(c.arg);
|
|
140
|
-
}
|
|
141
|
-
var r;
|
|
142
|
-
o(this, "_invoke", {
|
|
143
|
-
value: function (t, n) {
|
|
144
|
-
function callInvokeWithMethodAndArg() {
|
|
145
|
-
return new e(function (e, r) {
|
|
146
|
-
invoke(t, n, e, r);
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
function makeInvokeMethod(e, r, n) {
|
|
154
|
-
var o = h;
|
|
155
|
-
return function (i, a) {
|
|
156
|
-
if (o === f) throw Error("Generator is already running");
|
|
157
|
-
if (o === s) {
|
|
158
|
-
if ("throw" === i) throw a;
|
|
159
|
-
return {
|
|
160
|
-
value: t,
|
|
161
|
-
done: !0
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
for (n.method = i, n.arg = a;;) {
|
|
165
|
-
var c = n.delegate;
|
|
166
|
-
if (c) {
|
|
167
|
-
var u = maybeInvokeDelegate(c, n);
|
|
168
|
-
if (u) {
|
|
169
|
-
if (u === y) continue;
|
|
170
|
-
return u;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
|
|
174
|
-
if (o === h) throw o = s, n.arg;
|
|
175
|
-
n.dispatchException(n.arg);
|
|
176
|
-
} else "return" === n.method && n.abrupt("return", n.arg);
|
|
177
|
-
o = f;
|
|
178
|
-
var p = tryCatch(e, r, n);
|
|
179
|
-
if ("normal" === p.type) {
|
|
180
|
-
if (o = n.done ? s : l, p.arg === y) continue;
|
|
181
|
-
return {
|
|
182
|
-
value: p.arg,
|
|
183
|
-
done: n.done
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
"throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
|
|
187
|
-
}
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
|
-
function maybeInvokeDelegate(e, r) {
|
|
191
|
-
var n = r.method,
|
|
192
|
-
o = e.iterator[n];
|
|
193
|
-
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;
|
|
194
|
-
var i = tryCatch(o, e.iterator, r.arg);
|
|
195
|
-
if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
|
|
196
|
-
var a = i.arg;
|
|
197
|
-
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);
|
|
198
|
-
}
|
|
199
|
-
function pushTryEntry(t) {
|
|
200
|
-
var e = {
|
|
201
|
-
tryLoc: t[0]
|
|
202
|
-
};
|
|
203
|
-
1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
|
|
204
|
-
}
|
|
205
|
-
function resetTryEntry(t) {
|
|
206
|
-
var e = t.completion || {};
|
|
207
|
-
e.type = "normal", delete e.arg, t.completion = e;
|
|
208
|
-
}
|
|
209
|
-
function Context(t) {
|
|
210
|
-
this.tryEntries = [{
|
|
211
|
-
tryLoc: "root"
|
|
212
|
-
}], t.forEach(pushTryEntry, this), this.reset(!0);
|
|
213
|
-
}
|
|
214
|
-
function values(e) {
|
|
215
|
-
if (e || "" === e) {
|
|
216
|
-
var r = e[a];
|
|
217
|
-
if (r) return r.call(e);
|
|
218
|
-
if ("function" == typeof e.next) return e;
|
|
219
|
-
if (!isNaN(e.length)) {
|
|
220
|
-
var o = -1,
|
|
221
|
-
i = function next() {
|
|
222
|
-
for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
|
|
223
|
-
return next.value = t, next.done = !0, next;
|
|
224
|
-
};
|
|
225
|
-
return i.next = i;
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
throw new TypeError(typeof e + " is not iterable");
|
|
229
|
-
}
|
|
230
|
-
return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
|
|
231
|
-
value: GeneratorFunctionPrototype,
|
|
232
|
-
configurable: !0
|
|
233
|
-
}), o(GeneratorFunctionPrototype, "constructor", {
|
|
234
|
-
value: GeneratorFunction,
|
|
235
|
-
configurable: !0
|
|
236
|
-
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
|
|
237
|
-
var e = "function" == typeof t && t.constructor;
|
|
238
|
-
return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
|
|
239
|
-
}, e.mark = function (t) {
|
|
240
|
-
return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
|
|
241
|
-
}, e.awrap = function (t) {
|
|
242
|
-
return {
|
|
243
|
-
__await: t
|
|
244
|
-
};
|
|
245
|
-
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
|
|
246
|
-
return this;
|
|
247
|
-
}), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
|
|
248
|
-
void 0 === i && (i = Promise);
|
|
249
|
-
var a = new AsyncIterator(wrap(t, r, n, o), i);
|
|
250
|
-
return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
|
|
251
|
-
return t.done ? t.value : a.next();
|
|
252
|
-
});
|
|
253
|
-
}, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
|
|
254
|
-
return this;
|
|
255
|
-
}), define(g, "toString", function () {
|
|
256
|
-
return "[object Generator]";
|
|
257
|
-
}), e.keys = function (t) {
|
|
258
|
-
var e = Object(t),
|
|
259
|
-
r = [];
|
|
260
|
-
for (var n in e) r.push(n);
|
|
261
|
-
return r.reverse(), function next() {
|
|
262
|
-
for (; r.length;) {
|
|
263
|
-
var t = r.pop();
|
|
264
|
-
if (t in e) return next.value = t, next.done = !1, next;
|
|
265
|
-
}
|
|
266
|
-
return next.done = !0, next;
|
|
267
|
-
};
|
|
268
|
-
}, e.values = values, Context.prototype = {
|
|
269
|
-
constructor: Context,
|
|
270
|
-
reset: function (e) {
|
|
271
|
-
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);
|
|
272
|
-
},
|
|
273
|
-
stop: function () {
|
|
274
|
-
this.done = !0;
|
|
275
|
-
var t = this.tryEntries[0].completion;
|
|
276
|
-
if ("throw" === t.type) throw t.arg;
|
|
277
|
-
return this.rval;
|
|
278
|
-
},
|
|
279
|
-
dispatchException: function (e) {
|
|
280
|
-
if (this.done) throw e;
|
|
281
|
-
var r = this;
|
|
282
|
-
function handle(n, o) {
|
|
283
|
-
return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
|
|
284
|
-
}
|
|
285
|
-
for (var o = this.tryEntries.length - 1; o >= 0; --o) {
|
|
286
|
-
var i = this.tryEntries[o],
|
|
287
|
-
a = i.completion;
|
|
288
|
-
if ("root" === i.tryLoc) return handle("end");
|
|
289
|
-
if (i.tryLoc <= this.prev) {
|
|
290
|
-
var c = n.call(i, "catchLoc"),
|
|
291
|
-
u = n.call(i, "finallyLoc");
|
|
292
|
-
if (c && u) {
|
|
293
|
-
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
294
|
-
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
295
|
-
} else if (c) {
|
|
296
|
-
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
297
|
-
} else {
|
|
298
|
-
if (!u) throw Error("try statement without catch or finally");
|
|
299
|
-
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
},
|
|
304
|
-
abrupt: function (t, e) {
|
|
305
|
-
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
|
|
306
|
-
var o = this.tryEntries[r];
|
|
307
|
-
if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
|
|
308
|
-
var i = o;
|
|
309
|
-
break;
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
|
|
313
|
-
var a = i ? i.completion : {};
|
|
314
|
-
return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
|
|
315
|
-
},
|
|
316
|
-
complete: function (t, e) {
|
|
317
|
-
if ("throw" === t.type) throw t.arg;
|
|
318
|
-
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;
|
|
319
|
-
},
|
|
320
|
-
finish: function (t) {
|
|
321
|
-
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
322
|
-
var r = this.tryEntries[e];
|
|
323
|
-
if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
|
|
324
|
-
}
|
|
325
|
-
},
|
|
326
|
-
catch: function (t) {
|
|
327
|
-
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
328
|
-
var r = this.tryEntries[e];
|
|
329
|
-
if (r.tryLoc === t) {
|
|
330
|
-
var n = r.completion;
|
|
331
|
-
if ("throw" === n.type) {
|
|
332
|
-
var o = n.arg;
|
|
333
|
-
resetTryEntry(r);
|
|
334
|
-
}
|
|
335
|
-
return o;
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
throw Error("illegal catch attempt");
|
|
339
|
-
},
|
|
340
|
-
delegateYield: function (e, r, n) {
|
|
341
|
-
return this.delegate = {
|
|
342
|
-
iterator: values(e),
|
|
343
|
-
resultName: r,
|
|
344
|
-
nextLoc: n
|
|
345
|
-
}, "next" === this.method && (this.arg = t), y;
|
|
346
|
-
}
|
|
347
|
-
}, e;
|
|
348
|
-
}
|
|
349
|
-
function _setPrototypeOf(t, e) {
|
|
350
|
-
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
|
|
351
|
-
return t.__proto__ = e, t;
|
|
352
|
-
}, _setPrototypeOf(t, e);
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
var CloudflareDeployer = /*#__PURE__*/function (_MastraDeployer) {
|
|
356
|
-
function CloudflareDeployer(_ref) {
|
|
357
|
-
var _this;
|
|
358
|
-
var scope = _ref.scope,
|
|
359
|
-
env = _ref.env,
|
|
360
|
-
projectName = _ref.projectName,
|
|
361
|
-
routes = _ref.routes,
|
|
362
|
-
workerNamespace = _ref.workerNamespace,
|
|
363
|
-
auth = _ref.auth;
|
|
364
|
-
_this = _MastraDeployer.call(this, {
|
|
365
|
-
scope: scope,
|
|
366
|
-
env: env,
|
|
367
|
-
projectName: projectName
|
|
368
|
-
}) || this;
|
|
369
|
-
_this.cloudflare = void 0;
|
|
370
|
-
_this.routes = [];
|
|
371
|
-
_this.workerNamespace = void 0;
|
|
372
|
-
_this.routes = routes;
|
|
373
|
-
_this.workerNamespace = workerNamespace;
|
|
374
|
-
if (auth) {
|
|
375
|
-
_this.cloudflare = new cloudflare.Cloudflare(auth);
|
|
376
|
-
}
|
|
377
|
-
return _this;
|
|
378
|
-
}
|
|
379
|
-
_inheritsLoose(CloudflareDeployer, _MastraDeployer);
|
|
380
|
-
var _proto = CloudflareDeployer.prototype;
|
|
381
|
-
_proto.writeFiles = function writeFiles(_ref2) {
|
|
382
|
-
var dir = _ref2.dir;
|
|
383
|
-
this.loadEnvVars();
|
|
384
|
-
this.writeIndex({
|
|
385
|
-
dir: dir
|
|
386
|
-
});
|
|
387
|
-
var cfWorkerName = this.projectName || 'mastra';
|
|
388
|
-
var wranglerConfig = {
|
|
389
|
-
name: cfWorkerName,
|
|
390
|
-
main: 'index.mjs',
|
|
391
|
-
compatibility_date: '2024-12-02',
|
|
392
|
-
compatibility_flags: ['nodejs_compat'],
|
|
393
|
-
build: {
|
|
394
|
-
command: 'npm install'
|
|
395
|
-
},
|
|
396
|
-
observability: {
|
|
397
|
-
logs: {
|
|
398
|
-
enabled: true
|
|
399
|
-
}
|
|
400
|
-
},
|
|
401
|
-
vars: this.env
|
|
402
|
-
};
|
|
403
|
-
if (!this.workerNamespace && this.routes) {
|
|
404
|
-
wranglerConfig.routes = this.routes;
|
|
405
|
-
}
|
|
406
|
-
fs.writeFileSync(path.join(dir, 'wrangler.json'), JSON.stringify(wranglerConfig));
|
|
407
|
-
};
|
|
408
|
-
_proto.writeIndex = function writeIndex(_ref3) {
|
|
409
|
-
var dir = _ref3.dir;
|
|
410
|
-
fs.writeFileSync(path.join(dir, './index.mjs'), "\n export default {\n fetch: async (request, env, context) => {\n Object.keys(env).forEach(key => {\n process.env[key] = env[key]\n })\n const { app } = await import('./hono.mjs');\n return app.fetch(request, env, context);\n }\n }\n ");
|
|
411
|
-
};
|
|
412
|
-
_proto.deploy = /*#__PURE__*/function () {
|
|
413
|
-
var _deploy = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref4) {
|
|
414
|
-
var dir, token, cmd, cpLogger;
|
|
415
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
416
|
-
while (1) switch (_context.prev = _context.next) {
|
|
417
|
-
case 0:
|
|
418
|
-
dir = _ref4.dir, token = _ref4.token;
|
|
419
|
-
cmd = this.workerNamespace ? "npm exec -- wrangler deploy --dispatch-namespace " + this.workerNamespace : 'npm exec -- wrangler deploy';
|
|
420
|
-
cpLogger = deployer.createChildProcessLogger({
|
|
421
|
-
logger: this.logger,
|
|
422
|
-
root: dir
|
|
423
|
-
});
|
|
424
|
-
_context.next = 5;
|
|
425
|
-
return cpLogger({
|
|
426
|
-
cmd: cmd,
|
|
427
|
-
args: [],
|
|
428
|
-
env: _extends({
|
|
429
|
-
CLOUDFLARE_API_TOKEN: token,
|
|
430
|
-
CLOUDFLARE_ACCOUNT_ID: this.scope
|
|
431
|
-
}, this.env, {
|
|
432
|
-
PATH: process.env.PATH
|
|
433
|
-
})
|
|
434
|
-
});
|
|
435
|
-
case 5:
|
|
436
|
-
case "end":
|
|
437
|
-
return _context.stop();
|
|
438
|
-
}
|
|
439
|
-
}, _callee, this);
|
|
440
|
-
}));
|
|
441
|
-
function deploy(_x) {
|
|
442
|
-
return _deploy.apply(this, arguments);
|
|
443
|
-
}
|
|
444
|
-
return deploy;
|
|
445
|
-
}();
|
|
446
|
-
_proto.tagWorker = /*#__PURE__*/function () {
|
|
447
|
-
var _tagWorker = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref5) {
|
|
448
|
-
var workerName, namespace, tags, scope;
|
|
449
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
450
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
451
|
-
case 0:
|
|
452
|
-
workerName = _ref5.workerName, namespace = _ref5.namespace, tags = _ref5.tags, scope = _ref5.scope;
|
|
453
|
-
if (this.cloudflare) {
|
|
454
|
-
_context2.next = 3;
|
|
455
|
-
break;
|
|
456
|
-
}
|
|
457
|
-
throw new Error('Cloudflare Deployer not initialized');
|
|
458
|
-
case 3:
|
|
459
|
-
_context2.next = 5;
|
|
460
|
-
return this.cloudflare.workersForPlatforms.dispatch.namespaces.scripts.tags.update(namespace, workerName, {
|
|
461
|
-
account_id: scope,
|
|
462
|
-
body: tags
|
|
463
|
-
});
|
|
464
|
-
case 5:
|
|
465
|
-
case "end":
|
|
466
|
-
return _context2.stop();
|
|
467
|
-
}
|
|
468
|
-
}, _callee2, this);
|
|
469
|
-
}));
|
|
470
|
-
function tagWorker(_x2) {
|
|
471
|
-
return _tagWorker.apply(this, arguments);
|
|
472
|
-
}
|
|
473
|
-
return tagWorker;
|
|
474
|
-
}();
|
|
475
|
-
return CloudflareDeployer;
|
|
476
|
-
}(core.MastraDeployer);
|
|
477
|
-
|
|
478
|
-
exports.CloudflareDeployer = CloudflareDeployer;
|
|
479
|
-
//# sourceMappingURL=deployer-cloudflare.cjs.development.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deployer-cloudflare.cjs.development.js","sources":["../src/index.ts"],"sourcesContent":["import { MastraDeployer } from '@mastra/core';\nimport { createChildProcessLogger } from '@mastra/deployer';\nimport { Cloudflare } from 'cloudflare';\nimport { writeFileSync } from 'fs';\nimport { join } from 'path';\n\ninterface CFRoute {\n pattern: string;\n zone_name: string;\n custom_domain?: boolean;\n}\n\nexport class CloudflareDeployer extends MastraDeployer {\n private cloudflare: Cloudflare | undefined;\n routes?: CFRoute[] = [];\n workerNamespace?: string;\n constructor({\n scope,\n env,\n projectName,\n routes,\n workerNamespace,\n auth,\n }: {\n env?: Record<string, any>;\n scope: string;\n projectName: string;\n routes?: CFRoute[];\n workerNamespace?: string;\n auth?: {\n apiToken: string;\n apiEmail: string;\n };\n }) {\n super({ scope, env, projectName });\n\n this.routes = routes;\n this.workerNamespace = workerNamespace;\n\n if (auth) {\n this.cloudflare = new Cloudflare(auth);\n }\n }\n\n writeFiles({ dir }: { dir: string }): void {\n this.loadEnvVars();\n\n this.writeIndex({ dir });\n\n const cfWorkerName = this.projectName || 'mastra';\n\n const wranglerConfig: Record<string, any> = {\n name: cfWorkerName,\n main: 'index.mjs',\n compatibility_date: '2024-12-02',\n compatibility_flags: ['nodejs_compat'],\n build: {\n command: 'npm install',\n },\n observability: {\n logs: {\n enabled: true,\n },\n },\n vars: this.env,\n };\n\n if (!this.workerNamespace && this.routes) {\n wranglerConfig.routes = this.routes;\n }\n\n writeFileSync(join(dir, 'wrangler.json'), JSON.stringify(wranglerConfig));\n }\n\n writeIndex({ dir }: { dir: string }): void {\n writeFileSync(\n join(dir, './index.mjs'),\n `\n export default {\n fetch: async (request, env, context) => {\n Object.keys(env).forEach(key => {\n process.env[key] = env[key]\n })\n const { app } = await import('./hono.mjs');\n return app.fetch(request, env, context);\n }\n }\n `,\n );\n }\n\n async deploy({ dir, token }: { dir: string; token: string }): Promise<void> {\n const cmd = this.workerNamespace\n ? `npm exec -- wrangler deploy --dispatch-namespace ${this.workerNamespace}`\n : 'npm exec -- wrangler deploy';\n\n const cpLogger = createChildProcessLogger({\n logger: this.logger,\n root: dir,\n });\n\n await cpLogger({\n cmd,\n args: [],\n env: {\n CLOUDFLARE_API_TOKEN: token,\n CLOUDFLARE_ACCOUNT_ID: this.scope,\n ...this.env,\n PATH: process.env.PATH!,\n },\n });\n }\n\n async tagWorker({\n workerName,\n namespace,\n tags,\n scope,\n }: {\n scope: string;\n workerName: string;\n namespace: string;\n tags: string[];\n }): Promise<void> {\n if (!this.cloudflare) {\n throw new Error('Cloudflare Deployer not initialized');\n }\n\n await this.cloudflare.workersForPlatforms.dispatch.namespaces.scripts.tags.update(namespace, workerName, {\n account_id: scope,\n body: tags,\n });\n }\n}\n"],"names":["CloudflareDeployer","_MastraDeployer","_ref","_this","scope","env","projectName","routes","workerNamespace","auth","call","cloudflare","Cloudflare","_inheritsLoose","_proto","prototype","writeFiles","_ref2","dir","loadEnvVars","writeIndex","cfWorkerName","wranglerConfig","name","main","compatibility_date","compatibility_flags","build","command","observability","logs","enabled","vars","writeFileSync","join","JSON","stringify","_ref3","deploy","_deploy","_asyncToGenerator","_regeneratorRuntime","mark","_callee","_ref4","token","cmd","cpLogger","wrap","_callee$","_context","prev","next","createChildProcessLogger","logger","root","args","_extends","CLOUDFLARE_API_TOKEN","CLOUDFLARE_ACCOUNT_ID","PATH","process","stop","_x","apply","arguments","tagWorker","_tagWorker","_callee2","_ref5","workerName","namespace","tags","_callee2$","_context2","Error","workersForPlatforms","dispatch","namespaces","scripts","update","account_id","body","_x2","MastraDeployer"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYaA,IAAAA,kBAAmB,0BAAAC,eAAA,EAAA;EAI9B,SAAAD,kBAAAA,CAAAE,IAAA,EAiBC;AAAA,IAAA,IAAAC,KAAA,CAAA;AAAA,IAAA,IAhBCC,KAAK,GAAAF,IAAA,CAALE,KAAK;MACLC,GAAG,GAAAH,IAAA,CAAHG,GAAG;MACHC,WAAW,GAAAJ,IAAA,CAAXI,WAAW;MACXC,MAAM,GAAAL,IAAA,CAANK,MAAM;MACNC,eAAe,GAAAN,IAAA,CAAfM,eAAe;MACfC,IAAI,GAAAP,IAAA,CAAJO,IAAI,CAAA;AAYJN,IAAAA,KAAA,GAAAF,eAAA,CAAAS,IAAA,CAAM,IAAA,EAAA;AAAEN,MAAAA,KAAK,EAALA,KAAK;AAAEC,MAAAA,GAAG,EAAHA,GAAG;AAAEC,MAAAA,WAAW,EAAXA,WAAAA;AAAa,KAAA,CAAC,IAAA,IAAA,CAAA;AAACH,IAAAA,KAAA,CArB7BQ,UAAU,GAAA,KAAA,CAAA,CAAA;IAAAR,KAAA,CAClBI,MAAM,GAAe,EAAE,CAAA;AAAAJ,IAAAA,KAAA,C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CAAA;YAAA,IAOA,IAAI,CAACO,UAAU,EAAA;AAAA+D,cAAAA,SAAA,CAAAtB,IAAA,GAAA,CAAA,CAAA;AAAA,cAAA,MAAA;AAAA,aAAA;AAAA,YAAA,MACZ,IAAIuB,KAAK,CAAC,qCAAqC,CAAC,CAAA;AAAA,UAAA,KAAA,CAAA;AAAAD,YAAAA,SAAA,CAAAtB,IAAA,GAAA,CAAA,CAAA;AAAA,YAAA,OAGlD,IAAI,CAACzC,UAAU,CAACiE,mBAAmB,CAACC,QAAQ,CAACC,UAAU,CAACC,OAAO,CAACP,IAAI,CAACQ,MAAM,CAACT,SAAS,EAAED,UAAU,EAAE;AACvGW,cAAAA,UAAU,EAAE7E,KAAK;AACjB8E,cAAAA,IAAI,EAAEV,IAAAA;AACP,aAAA,CAAC,CAAA;AAAA,UAAA,KAAA,CAAA,CAAA;AAAA,UAAA,KAAA,KAAA;YAAA,OAAAE,SAAA,CAAAZ,IAAA,EAAA,CAAA;AAAA,SAAA;AAAA,OAAA,EAAAM,QAAA,EAAA,IAAA,CAAA,CAAA;KACH,CAAA,CAAA,CAAA;IAAA,SAnBKF,SAASA,CAAAiB,GAAA,EAAA;AAAA,MAAA,OAAAhB,UAAA,CAAAH,KAAA,CAAA,IAAA,EAAAC,SAAA,CAAA,CAAA;AAAA,KAAA;AAAA,IAAA,OAATC,SAAS,CAAA;AAAA,GAAA,EAAA,CAAA;AAAA,EAAA,OAAAlE,kBAAA,CAAA;AAAA,CAAA,CArGuBoF,mBAAc;;;;"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@mastra/core"),e=require("@mastra/deployer"),r=require("cloudflare"),n=require("fs"),o=require("path");function i(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 a(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var a=t.apply(e,r);function c(t){i(a,n,o,c,u,"next",t)}function u(t){i(a,n,o,c,u,"throw",t)}c(void 0)}))}}function c(){return c=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)({}).hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},c.apply(null,arguments)}function u(){u=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:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function f(t,e,r,n){var i=Object.create((e&&e.prototype instanceof g?e:g).prototype),a=new T(n||[]);return o(i,"_invoke",{value:k(t,r,a)}),i}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=f;var p="suspendedStart",y="suspendedYield",v="executing",d="completed",m={};function g(){}function w(){}function b(){}var x={};l(x,a,(function(){return this}));var L=Object.getPrototypeOf,j=L&&L(L(S([])));j&&j!==r&&n.call(j,a)&&(x=j);var E=b.prototype=g.prototype=Object.create(x);function O(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,e){function r(o,i,a,c){var u=h(t[o],t,i);if("throw"!==u.type){var s=u.arg,l=s.value;return l&&"object"==typeof l&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(l).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 k(e,r,n){var o=p;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===p)throw o=d,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=v;var s=h(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=h(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 F(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function S(e){if(e||""===e){var r=e[a];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=b,o(E,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:w,configurable:!0}),w.displayName=l(b,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,b):(t.__proto__=b,l(t,s,"GeneratorFunction")),t.prototype=Object.create(E),t},e.awrap=function(t){return{__await:t}},O(_.prototype),l(_.prototype,c,(function(){return this})),e.AsyncIterator=_,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new _(f(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},O(E),l(E,s,"Generator"),l(E,a,(function(){return this})),l(E,"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=S,T.prototype={constructor:T,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(F),!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),F(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;F(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:S(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),m}},e}function s(t,e){return s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},s(t,e)}exports.CloudflareDeployer=function(t){function i(e){var n,o=e.routes,i=e.workerNamespace,a=e.auth;return(n=t.call(this,{scope:e.scope,env:e.env,projectName:e.projectName})||this).cloudflare=void 0,n.routes=[],n.workerNamespace=void 0,n.routes=o,n.workerNamespace=i,a&&(n.cloudflare=new r.Cloudflare(a)),n}var l,f;f=t,(l=i).prototype=Object.create(f.prototype),l.prototype.constructor=l,s(l,f);var h=i.prototype;return h.writeFiles=function(t){var e=t.dir;this.loadEnvVars(),this.writeIndex({dir:e});var r={name:this.projectName||"mastra",main:"index.mjs",compatibility_date:"2024-12-02",compatibility_flags:["nodejs_compat"],build:{command:"npm install"},observability:{logs:{enabled:!0}},vars:this.env};!this.workerNamespace&&this.routes&&(r.routes=this.routes),n.writeFileSync(o.join(e,"wrangler.json"),JSON.stringify(r))},h.writeIndex=function(t){n.writeFileSync(o.join(t.dir,"./index.mjs"),"\n export default {\n fetch: async (request, env, context) => {\n Object.keys(env).forEach(key => {\n process.env[key] = env[key]\n })\n const { app } = await import('./hono.mjs');\n return app.fetch(request, env, context);\n }\n }\n ")},h.deploy=function(){var t=a(u().mark((function t(r){var n,o,i;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=r.token,o=this.workerNamespace?"npm exec -- wrangler deploy --dispatch-namespace "+this.workerNamespace:"npm exec -- wrangler deploy",i=e.createChildProcessLogger({logger:this.logger,root:r.dir}),t.next=5,i({cmd:o,args:[],env:c({CLOUDFLARE_API_TOKEN:n,CLOUDFLARE_ACCOUNT_ID:this.scope},this.env,{PATH:process.env.PATH})});case 5:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),h.tagWorker=function(){var t=a(u().mark((function t(e){var r,n,o,i;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.workerName,n=e.namespace,o=e.tags,i=e.scope,this.cloudflare){t.next=3;break}throw new Error("Cloudflare Deployer not initialized");case 3:return t.next=5,this.cloudflare.workersForPlatforms.dispatch.namespaces.scripts.tags.update(n,r,{account_id:i,body:o});case 5:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),i}(t.MastraDeployer);
|
|
2
|
-
//# sourceMappingURL=deployer-cloudflare.cjs.production.min.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deployer-cloudflare.cjs.production.min.js","sources":["../src/index.ts"],"sourcesContent":["import { MastraDeployer } from '@mastra/core';\nimport { createChildProcessLogger } from '@mastra/deployer';\nimport { Cloudflare } from 'cloudflare';\nimport { writeFileSync } from 'fs';\nimport { join } from 'path';\n\ninterface CFRoute {\n pattern: string;\n zone_name: string;\n custom_domain?: boolean;\n}\n\nexport class CloudflareDeployer extends MastraDeployer {\n private cloudflare: Cloudflare | undefined;\n routes?: CFRoute[] = [];\n workerNamespace?: string;\n constructor({\n scope,\n env,\n projectName,\n routes,\n workerNamespace,\n auth,\n }: {\n env?: Record<string, any>;\n scope: string;\n projectName: string;\n routes?: CFRoute[];\n workerNamespace?: string;\n auth?: {\n apiToken: string;\n apiEmail: string;\n };\n }) {\n super({ scope, env, projectName });\n\n this.routes = routes;\n this.workerNamespace = workerNamespace;\n\n if (auth) {\n this.cloudflare = new Cloudflare(auth);\n }\n }\n\n writeFiles({ dir }: { dir: string }): void {\n this.loadEnvVars();\n\n this.writeIndex({ dir });\n\n const cfWorkerName = this.projectName || 'mastra';\n\n const wranglerConfig: Record<string, any> = {\n name: cfWorkerName,\n main: 'index.mjs',\n compatibility_date: '2024-12-02',\n compatibility_flags: ['nodejs_compat'],\n build: {\n command: 'npm install',\n },\n observability: {\n logs: {\n enabled: true,\n },\n },\n vars: this.env,\n };\n\n if (!this.workerNamespace && this.routes) {\n wranglerConfig.routes = this.routes;\n }\n\n writeFileSync(join(dir, 'wrangler.json'), JSON.stringify(wranglerConfig));\n }\n\n writeIndex({ dir }: { dir: string }): void {\n writeFileSync(\n join(dir, './index.mjs'),\n `\n export default {\n fetch: async (request, env, context) => {\n Object.keys(env).forEach(key => {\n process.env[key] = env[key]\n })\n const { app } = await import('./hono.mjs');\n return app.fetch(request, env, context);\n }\n }\n `,\n );\n }\n\n async deploy({ dir, token }: { dir: string; token: string }): Promise<void> {\n const cmd = this.workerNamespace\n ? `npm exec -- wrangler deploy --dispatch-namespace ${this.workerNamespace}`\n : 'npm exec -- wrangler deploy';\n\n const cpLogger = createChildProcessLogger({\n logger: this.logger,\n root: dir,\n });\n\n await cpLogger({\n cmd,\n args: [],\n env: {\n CLOUDFLARE_API_TOKEN: token,\n CLOUDFLARE_ACCOUNT_ID: this.scope,\n ...this.env,\n PATH: process.env.PATH!,\n },\n });\n }\n\n async tagWorker({\n workerName,\n namespace,\n tags,\n scope,\n }: {\n scope: string;\n workerName: string;\n namespace: string;\n tags: string[];\n }): Promise<void> {\n if (!this.cloudflare) {\n throw new Error('Cloudflare Deployer not initialized');\n }\n\n await this.cloudflare.workersForPlatforms.dispatch.namespaces.scripts.tags.update(namespace, workerName, {\n account_id: scope,\n body: tags,\n });\n }\n}\n"],"names":["_MastraDeployer","CloudflareDeployer","_ref","_this","routes","workerNamespace","auth","call","this","scope","env","projectName","cloudflare","Cloudflare","_proto","prototype","writeFiles","_ref2","dir","loadEnvVars","writeIndex","wranglerConfig","name","main","compatibility_date","compatibility_flags","build","command","observability","logs","enabled","vars","writeFileSync","join","JSON","stringify","_ref3","deploy","_deploy","_asyncToGenerator","_regeneratorRuntime","mark","_callee","_ref4","token","cmd","cpLogger","wrap","_context","prev","next","createChildProcessLogger","logger","root","args","_extends","CLOUDFLARE_API_TOKEN","CLOUDFLARE_ACCOUNT_ID","PATH","process","stop","_x","apply","arguments","tagWorker","_tagWorker","_callee2","_ref5","workerName","namespace","tags","_context2","Error","workersForPlatforms","dispatch","namespaces","scripts","update","account_id","body","_x2","MastraDeployer"],"mappings":"+sOAYgCA,GAI9B,SAAAC,EAAAC,GAiBC,IAAAC,EAbCC,EAAMF,EAANE,OACAC,EAAeH,EAAfG,gBACAC,EAAIJ,EAAJI,KAmBC,OAPDH,EAAAH,EAAAO,KAAMC,KAAA,CAAEC,MAjBHP,EAALO,MAiBeC,IAhBZR,EAAHQ,IAgBoBC,YAfTT,EAAXS,eAekCH,MArB5BI,gBAAU,EAAAT,EAClBC,OAAqB,GAAED,EACvBE,qBAAe,EAqBbF,EAAKC,OAASA,EACdD,EAAKE,gBAAkBA,EAEnBC,IACFH,EAAKS,WAAa,IAAIC,EAAUA,WAACP,IAClCH,CACH,WAACH,KAAAC,yEAAA,IAAAa,EAAAb,EAAAc,UAuEc,OAvEdD,EAEDE,WAAA,SAAUC,GAAyB,IAAtBC,EAAGD,EAAHC,IACXV,KAAKW,cAELX,KAAKY,WAAW,CAAEF,IAAAA,IAElB,IAEMG,EAAsC,CAC1CC,KAHmBd,KAAKG,aAAe,SAIvCY,KAAM,YACNC,mBAAoB,aACpBC,oBAAqB,CAAC,iBACtBC,MAAO,CACLC,QAAS,eAEXC,cAAe,CACbC,KAAM,CACJC,S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KAAA,EAAA,KAAA,CAAA,MACZ,IAAIsB,MAAM,uCAAsC,KAAA,EAAA,OAAAD,EAAArB,KAAA,EAGlD1C,KAAKI,WAAW6D,oBAAoBC,SAASC,WAAWC,QAAQN,KAAKO,OAAOR,EAAWD,EAAY,CACvGU,WAAYrE,EACZsE,KAAMT,IACN,KAAA,EAAA,IAAA,MAAA,OAAAC,EAAAX,OAAA,GAAAM,EAAA1D,KACH,KAnBc,OAmBd,SAnBcwE,GAAA,OAAAf,EAAAH,MAAAtD,KAAAuD,UAAA,CAAA,CAAA,GAAA9D,CAAA,EArGuBgF,EAAcA"}
|
|
@@ -1,475 +0,0 @@
|
|
|
1
|
-
import { MastraDeployer } from '@mastra/core';
|
|
2
|
-
import { createChildProcessLogger } from '@mastra/deployer';
|
|
3
|
-
import { Cloudflare } from 'cloudflare';
|
|
4
|
-
import { writeFileSync } from 'fs';
|
|
5
|
-
import { join } from 'path';
|
|
6
|
-
|
|
7
|
-
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
8
|
-
try {
|
|
9
|
-
var i = n[a](c),
|
|
10
|
-
u = i.value;
|
|
11
|
-
} catch (n) {
|
|
12
|
-
return void e(n);
|
|
13
|
-
}
|
|
14
|
-
i.done ? t(u) : Promise.resolve(u).then(r, o);
|
|
15
|
-
}
|
|
16
|
-
function _asyncToGenerator(n) {
|
|
17
|
-
return function () {
|
|
18
|
-
var t = this,
|
|
19
|
-
e = arguments;
|
|
20
|
-
return new Promise(function (r, o) {
|
|
21
|
-
var a = n.apply(t, e);
|
|
22
|
-
function _next(n) {
|
|
23
|
-
asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
|
|
24
|
-
}
|
|
25
|
-
function _throw(n) {
|
|
26
|
-
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
|
|
27
|
-
}
|
|
28
|
-
_next(void 0);
|
|
29
|
-
});
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
function _extends() {
|
|
33
|
-
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
34
|
-
for (var e = 1; e < arguments.length; e++) {
|
|
35
|
-
var t = arguments[e];
|
|
36
|
-
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
37
|
-
}
|
|
38
|
-
return n;
|
|
39
|
-
}, _extends.apply(null, arguments);
|
|
40
|
-
}
|
|
41
|
-
function _inheritsLoose(t, o) {
|
|
42
|
-
t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
|
|
43
|
-
}
|
|
44
|
-
function _regeneratorRuntime() {
|
|
45
|
-
_regeneratorRuntime = function () {
|
|
46
|
-
return e;
|
|
47
|
-
};
|
|
48
|
-
var t,
|
|
49
|
-
e = {},
|
|
50
|
-
r = Object.prototype,
|
|
51
|
-
n = r.hasOwnProperty,
|
|
52
|
-
o = Object.defineProperty || function (t, e, r) {
|
|
53
|
-
t[e] = r.value;
|
|
54
|
-
},
|
|
55
|
-
i = "function" == typeof Symbol ? Symbol : {},
|
|
56
|
-
a = i.iterator || "@@iterator",
|
|
57
|
-
c = i.asyncIterator || "@@asyncIterator",
|
|
58
|
-
u = i.toStringTag || "@@toStringTag";
|
|
59
|
-
function define(t, e, r) {
|
|
60
|
-
return Object.defineProperty(t, e, {
|
|
61
|
-
value: r,
|
|
62
|
-
enumerable: !0,
|
|
63
|
-
configurable: !0,
|
|
64
|
-
writable: !0
|
|
65
|
-
}), t[e];
|
|
66
|
-
}
|
|
67
|
-
try {
|
|
68
|
-
define({}, "");
|
|
69
|
-
} catch (t) {
|
|
70
|
-
define = function (t, e, r) {
|
|
71
|
-
return t[e] = r;
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
function wrap(t, e, r, n) {
|
|
75
|
-
var i = e && e.prototype instanceof Generator ? e : Generator,
|
|
76
|
-
a = Object.create(i.prototype),
|
|
77
|
-
c = new Context(n || []);
|
|
78
|
-
return o(a, "_invoke", {
|
|
79
|
-
value: makeInvokeMethod(t, r, c)
|
|
80
|
-
}), a;
|
|
81
|
-
}
|
|
82
|
-
function tryCatch(t, e, r) {
|
|
83
|
-
try {
|
|
84
|
-
return {
|
|
85
|
-
type: "normal",
|
|
86
|
-
arg: t.call(e, r)
|
|
87
|
-
};
|
|
88
|
-
} catch (t) {
|
|
89
|
-
return {
|
|
90
|
-
type: "throw",
|
|
91
|
-
arg: t
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
e.wrap = wrap;
|
|
96
|
-
var h = "suspendedStart",
|
|
97
|
-
l = "suspendedYield",
|
|
98
|
-
f = "executing",
|
|
99
|
-
s = "completed",
|
|
100
|
-
y = {};
|
|
101
|
-
function Generator() {}
|
|
102
|
-
function GeneratorFunction() {}
|
|
103
|
-
function GeneratorFunctionPrototype() {}
|
|
104
|
-
var p = {};
|
|
105
|
-
define(p, a, function () {
|
|
106
|
-
return this;
|
|
107
|
-
});
|
|
108
|
-
var d = Object.getPrototypeOf,
|
|
109
|
-
v = d && d(d(values([])));
|
|
110
|
-
v && v !== r && n.call(v, a) && (p = v);
|
|
111
|
-
var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
|
|
112
|
-
function defineIteratorMethods(t) {
|
|
113
|
-
["next", "throw", "return"].forEach(function (e) {
|
|
114
|
-
define(t, e, function (t) {
|
|
115
|
-
return this._invoke(e, t);
|
|
116
|
-
});
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
function AsyncIterator(t, e) {
|
|
120
|
-
function invoke(r, o, i, a) {
|
|
121
|
-
var c = tryCatch(t[r], t, o);
|
|
122
|
-
if ("throw" !== c.type) {
|
|
123
|
-
var u = c.arg,
|
|
124
|
-
h = u.value;
|
|
125
|
-
return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
|
|
126
|
-
invoke("next", t, i, a);
|
|
127
|
-
}, function (t) {
|
|
128
|
-
invoke("throw", t, i, a);
|
|
129
|
-
}) : e.resolve(h).then(function (t) {
|
|
130
|
-
u.value = t, i(u);
|
|
131
|
-
}, function (t) {
|
|
132
|
-
return invoke("throw", t, i, a);
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
a(c.arg);
|
|
136
|
-
}
|
|
137
|
-
var r;
|
|
138
|
-
o(this, "_invoke", {
|
|
139
|
-
value: function (t, n) {
|
|
140
|
-
function callInvokeWithMethodAndArg() {
|
|
141
|
-
return new e(function (e, r) {
|
|
142
|
-
invoke(t, n, e, r);
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
function makeInvokeMethod(e, r, n) {
|
|
150
|
-
var o = h;
|
|
151
|
-
return function (i, a) {
|
|
152
|
-
if (o === f) throw Error("Generator is already running");
|
|
153
|
-
if (o === s) {
|
|
154
|
-
if ("throw" === i) throw a;
|
|
155
|
-
return {
|
|
156
|
-
value: t,
|
|
157
|
-
done: !0
|
|
158
|
-
};
|
|
159
|
-
}
|
|
160
|
-
for (n.method = i, n.arg = a;;) {
|
|
161
|
-
var c = n.delegate;
|
|
162
|
-
if (c) {
|
|
163
|
-
var u = maybeInvokeDelegate(c, n);
|
|
164
|
-
if (u) {
|
|
165
|
-
if (u === y) continue;
|
|
166
|
-
return u;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
|
|
170
|
-
if (o === h) throw o = s, n.arg;
|
|
171
|
-
n.dispatchException(n.arg);
|
|
172
|
-
} else "return" === n.method && n.abrupt("return", n.arg);
|
|
173
|
-
o = f;
|
|
174
|
-
var p = tryCatch(e, r, n);
|
|
175
|
-
if ("normal" === p.type) {
|
|
176
|
-
if (o = n.done ? s : l, p.arg === y) continue;
|
|
177
|
-
return {
|
|
178
|
-
value: p.arg,
|
|
179
|
-
done: n.done
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
|
-
"throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
|
|
183
|
-
}
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
function maybeInvokeDelegate(e, r) {
|
|
187
|
-
var n = r.method,
|
|
188
|
-
o = e.iterator[n];
|
|
189
|
-
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;
|
|
190
|
-
var i = tryCatch(o, e.iterator, r.arg);
|
|
191
|
-
if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
|
|
192
|
-
var a = i.arg;
|
|
193
|
-
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);
|
|
194
|
-
}
|
|
195
|
-
function pushTryEntry(t) {
|
|
196
|
-
var e = {
|
|
197
|
-
tryLoc: t[0]
|
|
198
|
-
};
|
|
199
|
-
1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
|
|
200
|
-
}
|
|
201
|
-
function resetTryEntry(t) {
|
|
202
|
-
var e = t.completion || {};
|
|
203
|
-
e.type = "normal", delete e.arg, t.completion = e;
|
|
204
|
-
}
|
|
205
|
-
function Context(t) {
|
|
206
|
-
this.tryEntries = [{
|
|
207
|
-
tryLoc: "root"
|
|
208
|
-
}], t.forEach(pushTryEntry, this), this.reset(!0);
|
|
209
|
-
}
|
|
210
|
-
function values(e) {
|
|
211
|
-
if (e || "" === e) {
|
|
212
|
-
var r = e[a];
|
|
213
|
-
if (r) return r.call(e);
|
|
214
|
-
if ("function" == typeof e.next) return e;
|
|
215
|
-
if (!isNaN(e.length)) {
|
|
216
|
-
var o = -1,
|
|
217
|
-
i = function next() {
|
|
218
|
-
for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
|
|
219
|
-
return next.value = t, next.done = !0, next;
|
|
220
|
-
};
|
|
221
|
-
return i.next = i;
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
throw new TypeError(typeof e + " is not iterable");
|
|
225
|
-
}
|
|
226
|
-
return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
|
|
227
|
-
value: GeneratorFunctionPrototype,
|
|
228
|
-
configurable: !0
|
|
229
|
-
}), o(GeneratorFunctionPrototype, "constructor", {
|
|
230
|
-
value: GeneratorFunction,
|
|
231
|
-
configurable: !0
|
|
232
|
-
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
|
|
233
|
-
var e = "function" == typeof t && t.constructor;
|
|
234
|
-
return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
|
|
235
|
-
}, e.mark = function (t) {
|
|
236
|
-
return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
|
|
237
|
-
}, e.awrap = function (t) {
|
|
238
|
-
return {
|
|
239
|
-
__await: t
|
|
240
|
-
};
|
|
241
|
-
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
|
|
242
|
-
return this;
|
|
243
|
-
}), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
|
|
244
|
-
void 0 === i && (i = Promise);
|
|
245
|
-
var a = new AsyncIterator(wrap(t, r, n, o), i);
|
|
246
|
-
return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
|
|
247
|
-
return t.done ? t.value : a.next();
|
|
248
|
-
});
|
|
249
|
-
}, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
|
|
250
|
-
return this;
|
|
251
|
-
}), define(g, "toString", function () {
|
|
252
|
-
return "[object Generator]";
|
|
253
|
-
}), e.keys = function (t) {
|
|
254
|
-
var e = Object(t),
|
|
255
|
-
r = [];
|
|
256
|
-
for (var n in e) r.push(n);
|
|
257
|
-
return r.reverse(), function next() {
|
|
258
|
-
for (; r.length;) {
|
|
259
|
-
var t = r.pop();
|
|
260
|
-
if (t in e) return next.value = t, next.done = !1, next;
|
|
261
|
-
}
|
|
262
|
-
return next.done = !0, next;
|
|
263
|
-
};
|
|
264
|
-
}, e.values = values, Context.prototype = {
|
|
265
|
-
constructor: Context,
|
|
266
|
-
reset: function (e) {
|
|
267
|
-
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);
|
|
268
|
-
},
|
|
269
|
-
stop: function () {
|
|
270
|
-
this.done = !0;
|
|
271
|
-
var t = this.tryEntries[0].completion;
|
|
272
|
-
if ("throw" === t.type) throw t.arg;
|
|
273
|
-
return this.rval;
|
|
274
|
-
},
|
|
275
|
-
dispatchException: function (e) {
|
|
276
|
-
if (this.done) throw e;
|
|
277
|
-
var r = this;
|
|
278
|
-
function handle(n, o) {
|
|
279
|
-
return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
|
|
280
|
-
}
|
|
281
|
-
for (var o = this.tryEntries.length - 1; o >= 0; --o) {
|
|
282
|
-
var i = this.tryEntries[o],
|
|
283
|
-
a = i.completion;
|
|
284
|
-
if ("root" === i.tryLoc) return handle("end");
|
|
285
|
-
if (i.tryLoc <= this.prev) {
|
|
286
|
-
var c = n.call(i, "catchLoc"),
|
|
287
|
-
u = n.call(i, "finallyLoc");
|
|
288
|
-
if (c && u) {
|
|
289
|
-
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
290
|
-
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
291
|
-
} else if (c) {
|
|
292
|
-
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
293
|
-
} else {
|
|
294
|
-
if (!u) throw Error("try statement without catch or finally");
|
|
295
|
-
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
},
|
|
300
|
-
abrupt: function (t, e) {
|
|
301
|
-
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
|
|
302
|
-
var o = this.tryEntries[r];
|
|
303
|
-
if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
|
|
304
|
-
var i = o;
|
|
305
|
-
break;
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
|
|
309
|
-
var a = i ? i.completion : {};
|
|
310
|
-
return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
|
|
311
|
-
},
|
|
312
|
-
complete: function (t, e) {
|
|
313
|
-
if ("throw" === t.type) throw t.arg;
|
|
314
|
-
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;
|
|
315
|
-
},
|
|
316
|
-
finish: function (t) {
|
|
317
|
-
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
318
|
-
var r = this.tryEntries[e];
|
|
319
|
-
if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
|
|
320
|
-
}
|
|
321
|
-
},
|
|
322
|
-
catch: function (t) {
|
|
323
|
-
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
324
|
-
var r = this.tryEntries[e];
|
|
325
|
-
if (r.tryLoc === t) {
|
|
326
|
-
var n = r.completion;
|
|
327
|
-
if ("throw" === n.type) {
|
|
328
|
-
var o = n.arg;
|
|
329
|
-
resetTryEntry(r);
|
|
330
|
-
}
|
|
331
|
-
return o;
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
throw Error("illegal catch attempt");
|
|
335
|
-
},
|
|
336
|
-
delegateYield: function (e, r, n) {
|
|
337
|
-
return this.delegate = {
|
|
338
|
-
iterator: values(e),
|
|
339
|
-
resultName: r,
|
|
340
|
-
nextLoc: n
|
|
341
|
-
}, "next" === this.method && (this.arg = t), y;
|
|
342
|
-
}
|
|
343
|
-
}, e;
|
|
344
|
-
}
|
|
345
|
-
function _setPrototypeOf(t, e) {
|
|
346
|
-
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
|
|
347
|
-
return t.__proto__ = e, t;
|
|
348
|
-
}, _setPrototypeOf(t, e);
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
var CloudflareDeployer = /*#__PURE__*/function (_MastraDeployer) {
|
|
352
|
-
function CloudflareDeployer(_ref) {
|
|
353
|
-
var _this;
|
|
354
|
-
var scope = _ref.scope,
|
|
355
|
-
env = _ref.env,
|
|
356
|
-
projectName = _ref.projectName,
|
|
357
|
-
routes = _ref.routes,
|
|
358
|
-
workerNamespace = _ref.workerNamespace,
|
|
359
|
-
auth = _ref.auth;
|
|
360
|
-
_this = _MastraDeployer.call(this, {
|
|
361
|
-
scope: scope,
|
|
362
|
-
env: env,
|
|
363
|
-
projectName: projectName
|
|
364
|
-
}) || this;
|
|
365
|
-
_this.cloudflare = void 0;
|
|
366
|
-
_this.routes = [];
|
|
367
|
-
_this.workerNamespace = void 0;
|
|
368
|
-
_this.routes = routes;
|
|
369
|
-
_this.workerNamespace = workerNamespace;
|
|
370
|
-
if (auth) {
|
|
371
|
-
_this.cloudflare = new Cloudflare(auth);
|
|
372
|
-
}
|
|
373
|
-
return _this;
|
|
374
|
-
}
|
|
375
|
-
_inheritsLoose(CloudflareDeployer, _MastraDeployer);
|
|
376
|
-
var _proto = CloudflareDeployer.prototype;
|
|
377
|
-
_proto.writeFiles = function writeFiles(_ref2) {
|
|
378
|
-
var dir = _ref2.dir;
|
|
379
|
-
this.loadEnvVars();
|
|
380
|
-
this.writeIndex({
|
|
381
|
-
dir: dir
|
|
382
|
-
});
|
|
383
|
-
var cfWorkerName = this.projectName || 'mastra';
|
|
384
|
-
var wranglerConfig = {
|
|
385
|
-
name: cfWorkerName,
|
|
386
|
-
main: 'index.mjs',
|
|
387
|
-
compatibility_date: '2024-12-02',
|
|
388
|
-
compatibility_flags: ['nodejs_compat'],
|
|
389
|
-
build: {
|
|
390
|
-
command: 'npm install'
|
|
391
|
-
},
|
|
392
|
-
observability: {
|
|
393
|
-
logs: {
|
|
394
|
-
enabled: true
|
|
395
|
-
}
|
|
396
|
-
},
|
|
397
|
-
vars: this.env
|
|
398
|
-
};
|
|
399
|
-
if (!this.workerNamespace && this.routes) {
|
|
400
|
-
wranglerConfig.routes = this.routes;
|
|
401
|
-
}
|
|
402
|
-
writeFileSync(join(dir, 'wrangler.json'), JSON.stringify(wranglerConfig));
|
|
403
|
-
};
|
|
404
|
-
_proto.writeIndex = function writeIndex(_ref3) {
|
|
405
|
-
var dir = _ref3.dir;
|
|
406
|
-
writeFileSync(join(dir, './index.mjs'), "\n export default {\n fetch: async (request, env, context) => {\n Object.keys(env).forEach(key => {\n process.env[key] = env[key]\n })\n const { app } = await import('./hono.mjs');\n return app.fetch(request, env, context);\n }\n }\n ");
|
|
407
|
-
};
|
|
408
|
-
_proto.deploy = /*#__PURE__*/function () {
|
|
409
|
-
var _deploy = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref4) {
|
|
410
|
-
var dir, token, cmd, cpLogger;
|
|
411
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
412
|
-
while (1) switch (_context.prev = _context.next) {
|
|
413
|
-
case 0:
|
|
414
|
-
dir = _ref4.dir, token = _ref4.token;
|
|
415
|
-
cmd = this.workerNamespace ? "npm exec -- wrangler deploy --dispatch-namespace " + this.workerNamespace : 'npm exec -- wrangler deploy';
|
|
416
|
-
cpLogger = createChildProcessLogger({
|
|
417
|
-
logger: this.logger,
|
|
418
|
-
root: dir
|
|
419
|
-
});
|
|
420
|
-
_context.next = 5;
|
|
421
|
-
return cpLogger({
|
|
422
|
-
cmd: cmd,
|
|
423
|
-
args: [],
|
|
424
|
-
env: _extends({
|
|
425
|
-
CLOUDFLARE_API_TOKEN: token,
|
|
426
|
-
CLOUDFLARE_ACCOUNT_ID: this.scope
|
|
427
|
-
}, this.env, {
|
|
428
|
-
PATH: process.env.PATH
|
|
429
|
-
})
|
|
430
|
-
});
|
|
431
|
-
case 5:
|
|
432
|
-
case "end":
|
|
433
|
-
return _context.stop();
|
|
434
|
-
}
|
|
435
|
-
}, _callee, this);
|
|
436
|
-
}));
|
|
437
|
-
function deploy(_x) {
|
|
438
|
-
return _deploy.apply(this, arguments);
|
|
439
|
-
}
|
|
440
|
-
return deploy;
|
|
441
|
-
}();
|
|
442
|
-
_proto.tagWorker = /*#__PURE__*/function () {
|
|
443
|
-
var _tagWorker = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref5) {
|
|
444
|
-
var workerName, namespace, tags, scope;
|
|
445
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
446
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
447
|
-
case 0:
|
|
448
|
-
workerName = _ref5.workerName, namespace = _ref5.namespace, tags = _ref5.tags, scope = _ref5.scope;
|
|
449
|
-
if (this.cloudflare) {
|
|
450
|
-
_context2.next = 3;
|
|
451
|
-
break;
|
|
452
|
-
}
|
|
453
|
-
throw new Error('Cloudflare Deployer not initialized');
|
|
454
|
-
case 3:
|
|
455
|
-
_context2.next = 5;
|
|
456
|
-
return this.cloudflare.workersForPlatforms.dispatch.namespaces.scripts.tags.update(namespace, workerName, {
|
|
457
|
-
account_id: scope,
|
|
458
|
-
body: tags
|
|
459
|
-
});
|
|
460
|
-
case 5:
|
|
461
|
-
case "end":
|
|
462
|
-
return _context2.stop();
|
|
463
|
-
}
|
|
464
|
-
}, _callee2, this);
|
|
465
|
-
}));
|
|
466
|
-
function tagWorker(_x2) {
|
|
467
|
-
return _tagWorker.apply(this, arguments);
|
|
468
|
-
}
|
|
469
|
-
return tagWorker;
|
|
470
|
-
}();
|
|
471
|
-
return CloudflareDeployer;
|
|
472
|
-
}(MastraDeployer);
|
|
473
|
-
|
|
474
|
-
export { CloudflareDeployer };
|
|
475
|
-
//# sourceMappingURL=deployer-cloudflare.esm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deployer-cloudflare.esm.js","sources":["../src/index.ts"],"sourcesContent":["import { MastraDeployer } from '@mastra/core';\nimport { createChildProcessLogger } from '@mastra/deployer';\nimport { Cloudflare } from 'cloudflare';\nimport { writeFileSync } from 'fs';\nimport { join } from 'path';\n\ninterface CFRoute {\n pattern: string;\n zone_name: string;\n custom_domain?: boolean;\n}\n\nexport class CloudflareDeployer extends MastraDeployer {\n private cloudflare: Cloudflare | undefined;\n routes?: CFRoute[] = [];\n workerNamespace?: string;\n constructor({\n scope,\n env,\n projectName,\n routes,\n workerNamespace,\n auth,\n }: {\n env?: Record<string, any>;\n scope: string;\n projectName: string;\n routes?: CFRoute[];\n workerNamespace?: string;\n auth?: {\n apiToken: string;\n apiEmail: string;\n };\n }) {\n super({ scope, env, projectName });\n\n this.routes = routes;\n this.workerNamespace = workerNamespace;\n\n if (auth) {\n this.cloudflare = new Cloudflare(auth);\n }\n }\n\n writeFiles({ dir }: { dir: string }): void {\n this.loadEnvVars();\n\n this.writeIndex({ dir });\n\n const cfWorkerName = this.projectName || 'mastra';\n\n const wranglerConfig: Record<string, any> = {\n name: cfWorkerName,\n main: 'index.mjs',\n compatibility_date: '2024-12-02',\n compatibility_flags: ['nodejs_compat'],\n build: {\n command: 'npm install',\n },\n observability: {\n logs: {\n enabled: true,\n },\n },\n vars: this.env,\n };\n\n if (!this.workerNamespace && this.routes) {\n wranglerConfig.routes = this.routes;\n }\n\n writeFileSync(join(dir, 'wrangler.json'), JSON.stringify(wranglerConfig));\n }\n\n writeIndex({ dir }: { dir: string }): void {\n writeFileSync(\n join(dir, './index.mjs'),\n `\n export default {\n fetch: async (request, env, context) => {\n Object.keys(env).forEach(key => {\n process.env[key] = env[key]\n })\n const { app } = await import('./hono.mjs');\n return app.fetch(request, env, context);\n }\n }\n `,\n );\n }\n\n async deploy({ dir, token }: { dir: string; token: string }): Promise<void> {\n const cmd = this.workerNamespace\n ? `npm exec -- wrangler deploy --dispatch-namespace ${this.workerNamespace}`\n : 'npm exec -- wrangler deploy';\n\n const cpLogger = createChildProcessLogger({\n logger: this.logger,\n root: dir,\n });\n\n await cpLogger({\n cmd,\n args: [],\n env: {\n CLOUDFLARE_API_TOKEN: token,\n CLOUDFLARE_ACCOUNT_ID: this.scope,\n ...this.env,\n PATH: process.env.PATH!,\n },\n });\n }\n\n async tagWorker({\n workerName,\n namespace,\n tags,\n scope,\n }: {\n scope: string;\n workerName: string;\n namespace: string;\n tags: string[];\n }): Promise<void> {\n if (!this.cloudflare) {\n throw new Error('Cloudflare Deployer not initialized');\n }\n\n await this.cloudflare.workersForPlatforms.dispatch.namespaces.scripts.tags.update(namespace, workerName, {\n account_id: scope,\n body: tags,\n });\n }\n}\n"],"names":["CloudflareDeployer","_MastraDeployer","_ref","_this","scope","env","projectName","routes","workerNamespace","auth","call","cloudflare","Cloudflare","_inheritsLoose","_proto","prototype","writeFiles","_ref2","dir","loadEnvVars","writeIndex","cfWorkerName","wranglerConfig","name","main","compatibility_date","compatibility_flags","build","command","observability","logs","enabled","vars","writeFileSync","join","JSON","stringify","_ref3","deploy","_deploy","_asyncToGenerator","_regeneratorRuntime","mark","_callee","_ref4","token","cmd","cpLogger","wrap","_callee$","_context","prev","next","createChildProcessLogger","logger","root","args","_extends","CLOUDFLARE_API_TOKEN","CLOUDFLARE_ACCOUNT_ID","PATH","process","stop","_x","apply","arguments","tagWorker","_tagWorker","_callee2","_ref5","workerName","namespace","tags","_callee2$","_context2","Error","workersForPlatforms","dispatch","namespaces","scripts","update","account_id","body","_x2","MastraDeployer"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYaA,IAAAA,kBAAmB,0BAAAC,eAAA,EAAA;EAI9B,SAAAD,kBAAAA,CAAAE,IAAA,EAiBC;AAAA,IAAA,IAAAC,KAAA,CAAA;AAAA,IAAA,IAhBCC,KAAK,GAAAF,IAAA,CAALE,KAAK;MACLC,GAAG,GAAAH,IAAA,CAAHG,GAAG;MACHC,WAAW,GAAAJ,IAAA,CAAXI,WAAW;MACXC,MAAM,GAAAL,IAAA,CAANK,MAAM;MACNC,eAAe,GAAAN,IAAA,CAAfM,eAAe;MACfC,IAAI,GAAAP,IAAA,CAAJO,IAAI,CAAA;AAYJN,IAAAA,KAAA,GAAAF,eAAA,CAAAS,IAAA,CAAM,IAAA,EAAA;AAAEN,MAAAA,KAAK,EAALA,KAAK;AAAEC,MAAAA,GAAG,EAAHA,GAAG;AAAEC,MAAAA,WAAW,EAAXA,WAAAA;AAAa,KAAA,CAAC,IAAA,IAAA,CAAA;AAACH,IAAAA,KAAA,CArB7BQ,UAAU,GAAA,KAAA,CAAA,CAAA;IA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,KAAA,CAAJG,IAAI,EACJpE,KAAK,GAAAiE,KAAA,CAALjE,KAAK,CAAA;YAAA,IAOA,IAAI,CAACO,UAAU,EAAA;AAAA+D,cAAAA,SAAA,CAAAtB,IAAA,GAAA,CAAA,CAAA;AAAA,cAAA,MAAA;AAAA,aAAA;AAAA,YAAA,MACZ,IAAIuB,KAAK,CAAC,qCAAqC,CAAC,CAAA;AAAA,UAAA,KAAA,CAAA;AAAAD,YAAAA,SAAA,CAAAtB,IAAA,GAAA,CAAA,CAAA;AAAA,YAAA,OAGlD,IAAI,CAACzC,UAAU,CAACiE,mBAAmB,CAACC,QAAQ,CAACC,UAAU,CAACC,OAAO,CAACP,IAAI,CAACQ,MAAM,CAACT,SAAS,EAAED,UAAU,EAAE;AACvGW,cAAAA,UAAU,EAAE7E,KAAK;AACjB8E,cAAAA,IAAI,EAAEV,IAAAA;AACP,aAAA,CAAC,CAAA;AAAA,UAAA,KAAA,CAAA,CAAA;AAAA,UAAA,KAAA,KAAA;YAAA,OAAAE,SAAA,CAAAZ,IAAA,EAAA,CAAA;AAAA,SAAA;AAAA,OAAA,EAAAM,QAAA,EAAA,IAAA,CAAA,CAAA;KACH,CAAA,CAAA,CAAA;IAAA,SAnBKF,SAASA,CAAAiB,GAAA,EAAA;AAAA,MAAA,OAAAhB,UAAA,CAAAH,KAAA,CAAA,IAAA,EAAAC,SAAA,CAAA,CAAA;AAAA,KAAA;AAAA,IAAA,OAATC,SAAS,CAAA;AAAA,GAAA,EAAA,CAAA;AAAA,EAAA,OAAAlE,kBAAA,CAAA;AAAA,CAAA,CArGuBoF,cAAc;;;;"}
|
package/dist/index.d.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { MastraDeployer } from '@mastra/core';
|
|
2
|
-
interface CFRoute {
|
|
3
|
-
pattern: string;
|
|
4
|
-
zone_name: string;
|
|
5
|
-
custom_domain?: boolean;
|
|
6
|
-
}
|
|
7
|
-
export declare class CloudflareDeployer extends MastraDeployer {
|
|
8
|
-
private cloudflare;
|
|
9
|
-
routes?: CFRoute[];
|
|
10
|
-
workerNamespace?: string;
|
|
11
|
-
constructor({ scope, env, projectName, routes, workerNamespace, auth, }: {
|
|
12
|
-
env?: Record<string, any>;
|
|
13
|
-
scope: string;
|
|
14
|
-
projectName: string;
|
|
15
|
-
routes?: CFRoute[];
|
|
16
|
-
workerNamespace?: string;
|
|
17
|
-
auth?: {
|
|
18
|
-
apiToken: string;
|
|
19
|
-
apiEmail: string;
|
|
20
|
-
};
|
|
21
|
-
});
|
|
22
|
-
writeFiles({ dir }: {
|
|
23
|
-
dir: string;
|
|
24
|
-
}): void;
|
|
25
|
-
writeIndex({ dir }: {
|
|
26
|
-
dir: string;
|
|
27
|
-
}): void;
|
|
28
|
-
deploy({ dir, token }: {
|
|
29
|
-
dir: string;
|
|
30
|
-
token: string;
|
|
31
|
-
}): Promise<void>;
|
|
32
|
-
tagWorker({ workerName, namespace, tags, scope, }: {
|
|
33
|
-
scope: string;
|
|
34
|
-
workerName: string;
|
|
35
|
-
namespace: string;
|
|
36
|
-
tags: string[];
|
|
37
|
-
}): Promise<void>;
|
|
38
|
-
}
|
|
39
|
-
export {};
|
|
40
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
DELETED
|
@@ -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;AAM9C,UAAU,OAAO;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,qBAAa,kBAAmB,SAAQ,cAAc;IACpD,OAAO,CAAC,UAAU,CAAyB;IAC3C,MAAM,CAAC,EAAE,OAAO,EAAE,CAAM;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;gBACb,EACV,KAAK,EACL,GAAG,EACH,WAAW,EACX,MAAM,EACN,eAAe,EACf,IAAI,GACL,EAAE;QACD,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAC1B,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,EAAE,MAAM,CAAC;QACpB,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC;QACnB,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,IAAI,CAAC,EAAE;YACL,QAAQ,EAAE,MAAM,CAAC;YACjB,QAAQ,EAAE,MAAM,CAAC;SAClB,CAAC;KACH;IAWD,UAAU,CAAC,EAAE,GAAG,EAAE,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IA8B1C,UAAU,CAAC,EAAE,GAAG,EAAE,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAiBpC,MAAM,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAsBrE,SAAS,CAAC,EACd,UAAU,EACV,SAAS,EACT,IAAI,EACJ,KAAK,GACN,EAAE;QACD,KAAK,EAAE,MAAM,CAAC;QACd,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC;QAClB,IAAI,EAAE,MAAM,EAAE,CAAC;KAChB,GAAG,OAAO,CAAC,IAAI,CAAC;CAUlB"}
|
package/dist/index.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export declare class CloudflareSecretsManager {
|
|
2
|
-
accountId: string;
|
|
3
|
-
apiToken: string;
|
|
4
|
-
baseUrl: string;
|
|
5
|
-
constructor({ accountId, apiToken }: {
|
|
6
|
-
accountId: string;
|
|
7
|
-
apiToken: string;
|
|
8
|
-
});
|
|
9
|
-
createSecret({ workerId, secretName, secretValue, }: {
|
|
10
|
-
workerId: string;
|
|
11
|
-
secretName: string;
|
|
12
|
-
secretValue: string;
|
|
13
|
-
}): Promise<any>;
|
|
14
|
-
createProjectSecrets({ workerId, customerId, envVars, }: {
|
|
15
|
-
workerId: string;
|
|
16
|
-
customerId: string;
|
|
17
|
-
envVars: Record<string, string>;
|
|
18
|
-
}): Promise<any>;
|
|
19
|
-
deleteSecret({ workerId, secretName }: {
|
|
20
|
-
workerId: string;
|
|
21
|
-
secretName: string;
|
|
22
|
-
}): Promise<any>;
|
|
23
|
-
listSecrets(workerId: string): Promise<any>;
|
|
24
|
-
}
|
|
25
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/secrets-manager/index.ts"],"names":[],"mappings":"AAAA,qBAAa,wBAAwB;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;gBAEJ,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE;IAMtE,YAAY,CAAC,EACjB,QAAQ,EACR,UAAU,EACV,WAAW,GACZ,EAAE;QACD,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;QACnB,WAAW,EAAE,MAAM,CAAC;KACrB;IA6BK,oBAAoB,CAAC,EACzB,QAAQ,EACR,UAAU,EACV,OAAO,GACR,EAAE;QACD,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;QACnB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACjC;IAOK,YAAY,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE;IAwB/E,WAAW,CAAC,QAAQ,EAAE,MAAM;CAsBnC"}
|