@go-labs-sg/event-tech 1.7.0 → 1.8.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/dist/index.js +1162 -976
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -35,7 +35,7 @@ var __toESM = (mod, isNodeMode, target) => {
|
|
|
35
35
|
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
36
36
|
var __require = import.meta.require;
|
|
37
37
|
|
|
38
|
-
// ../../../node_modules/.bun/dotenv@18.0.
|
|
38
|
+
// ../../../node_modules/.bun/dotenv@18.0.10/node_modules/dotenv/dist/index.cjs
|
|
39
39
|
var require_dist = __commonJS(function(exports, module) {
|
|
40
40
|
var j = (e, n) => () => {
|
|
41
41
|
try {
|
|
@@ -44,428 +44,227 @@ var require_dist = __commonJS(function(exports, module) {
|
|
|
44
44
|
throw n = 0, t;
|
|
45
45
|
}
|
|
46
46
|
};
|
|
47
|
-
var
|
|
48
|
-
function
|
|
47
|
+
var R = j((Z, N) => {
|
|
48
|
+
function T(e) {
|
|
49
49
|
return typeof e == "string" ? !["false", "0", "no", "off", ""].includes(e.toLowerCase()) : !!e;
|
|
50
50
|
}
|
|
51
|
-
function
|
|
51
|
+
function U(e = process.env) {
|
|
52
52
|
let n = {};
|
|
53
53
|
for (let t of ["ENCODING", "PATH", "QUIET", "DEBUG", "OVERRIDE", "FAST"]) {
|
|
54
|
-
let
|
|
55
|
-
|
|
54
|
+
let r = e[`DOTENV_${t}`] != null ? e[`DOTENV_${t}`] : e[`DOTENV_CONFIG_${t}`];
|
|
55
|
+
r != null && (n[t.toLowerCase()] = t === "ENCODING" || t === "PATH" ? r : T(r));
|
|
56
56
|
}
|
|
57
57
|
return n;
|
|
58
58
|
}
|
|
59
|
-
|
|
59
|
+
N.exports = { parseBoolean: T, optionsFromEnv: U };
|
|
60
60
|
});
|
|
61
|
-
var
|
|
62
|
-
var
|
|
61
|
+
var P = j((ee, b) => {
|
|
62
|
+
var F = __require("fs"), _ = __require("path"), B = __require("os"), { URL: L, fileURLToPath: Q } = __require("url"), { parseBoolean: $, optionsFromEnv: I } = R(), G = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg, y = new Uint8Array(256);
|
|
63
63
|
for (let e = 48;e <= 57; e++)
|
|
64
|
-
|
|
64
|
+
y[e] = 1;
|
|
65
65
|
for (let e = 65;e <= 90; e++)
|
|
66
|
-
|
|
66
|
+
y[e] = 1;
|
|
67
67
|
for (let e = 97;e <= 122; e++)
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
function
|
|
68
|
+
y[e] = 1;
|
|
69
|
+
y[45] = 1;
|
|
70
|
+
y[46] = 1;
|
|
71
|
+
y[95] = 1;
|
|
72
|
+
function H(e) {
|
|
73
73
|
let n = {}, t = e.toString();
|
|
74
74
|
t = t.replace(/\r\n?/mg, `
|
|
75
75
|
`);
|
|
76
|
-
let
|
|
77
|
-
for (;(
|
|
78
|
-
let
|
|
79
|
-
|
|
80
|
-
let
|
|
81
|
-
|
|
82
|
-
`),
|
|
76
|
+
let r;
|
|
77
|
+
for (;(r = G.exec(t)) != null; ) {
|
|
78
|
+
let o = r[1], i = r[2] || "";
|
|
79
|
+
i = i.trim();
|
|
80
|
+
let c = i[0];
|
|
81
|
+
i = i.replace(/^(['"`])([\s\S]*)\1$/mg, "$2"), c === '"' && (i = i.replace(/\\n/g, `
|
|
82
|
+
`), i = i.replace(/\\r/g, "\r")), n[o] = i;
|
|
83
83
|
}
|
|
84
84
|
return n;
|
|
85
85
|
}
|
|
86
|
-
function
|
|
86
|
+
function g(e) {
|
|
87
87
|
return e <= 32 ? e === 32 || e >= 9 && e <= 13 : e >= 160 && (e === 160 || e === 5760 || e >= 8192 && e <= 8202 || e === 8232 || e === 8233 || e === 8239 || e === 8287 || e === 12288 || e === 65279);
|
|
88
88
|
}
|
|
89
|
-
function
|
|
89
|
+
function O(e) {
|
|
90
90
|
return e === 10 || e === 8232 || e === 8233;
|
|
91
91
|
}
|
|
92
|
-
function
|
|
92
|
+
function V(e) {
|
|
93
93
|
let n = {}, t = typeof e == "string" ? e : e.toString();
|
|
94
94
|
t.indexOf("\r") !== -1 && (t = t.replace(/\r\n?/g, `
|
|
95
95
|
`));
|
|
96
|
-
let
|
|
97
|
-
for (;
|
|
98
|
-
let
|
|
99
|
-
for (;
|
|
100
|
-
|
|
101
|
-
if (
|
|
96
|
+
let r = t.length, o = 0;
|
|
97
|
+
for (;o < r; ) {
|
|
98
|
+
let i = t.charCodeAt(o);
|
|
99
|
+
for (;o < r && g(i); )
|
|
100
|
+
o++, i = t.charCodeAt(o);
|
|
101
|
+
if (o >= r)
|
|
102
102
|
break;
|
|
103
|
-
if (
|
|
104
|
-
for (;
|
|
105
|
-
|
|
103
|
+
if (i === 35) {
|
|
104
|
+
for (;o < r && !O(t.charCodeAt(o)); )
|
|
105
|
+
o++;
|
|
106
106
|
continue;
|
|
107
107
|
}
|
|
108
|
-
let
|
|
109
|
-
if (
|
|
110
|
-
let
|
|
111
|
-
if (
|
|
112
|
-
let
|
|
113
|
-
for (;
|
|
114
|
-
|
|
115
|
-
|
|
108
|
+
let c = -1;
|
|
109
|
+
if (i === 101 && o + 6 < r && t.charCodeAt(o + 1) === 120 && t.charCodeAt(o + 2) === 112 && t.charCodeAt(o + 3) === 111 && t.charCodeAt(o + 4) === 114 && t.charCodeAt(o + 5) === 116) {
|
|
110
|
+
let u = t.charCodeAt(o + 6);
|
|
111
|
+
if (g(u)) {
|
|
112
|
+
let s = o + 7;
|
|
113
|
+
for (;s < r && g(t.charCodeAt(s)); )
|
|
114
|
+
s++;
|
|
115
|
+
y[t.charCodeAt(s)] && (c = o + 6, o = s);
|
|
116
116
|
} else
|
|
117
|
-
|
|
118
|
-
}
|
|
119
|
-
let
|
|
120
|
-
for (;
|
|
121
|
-
|
|
122
|
-
if (
|
|
123
|
-
for (;
|
|
124
|
-
|
|
117
|
+
i = t.charCodeAt(o);
|
|
118
|
+
}
|
|
119
|
+
let E = o, p = 0;
|
|
120
|
+
for (;o < r && (p = t.charCodeAt(o), y[p]); )
|
|
121
|
+
o++;
|
|
122
|
+
if (o === E) {
|
|
123
|
+
for (;o < r && !O(t.charCodeAt(o)); )
|
|
124
|
+
o++;
|
|
125
125
|
continue;
|
|
126
126
|
}
|
|
127
|
-
let
|
|
128
|
-
if (
|
|
127
|
+
let k = t.slice(E, o), D = o;
|
|
128
|
+
if (o >= r && (p = 0), g(p))
|
|
129
129
|
do
|
|
130
|
-
|
|
131
|
-
while (
|
|
132
|
-
if (
|
|
133
|
-
|
|
134
|
-
else if (
|
|
135
|
-
|
|
130
|
+
o++, p = o < r ? t.charCodeAt(o) : 0;
|
|
131
|
+
while (g(p));
|
|
132
|
+
if (p === 61)
|
|
133
|
+
o++;
|
|
134
|
+
else if (p === 58 && o === D && o + 1 < r && g(t.charCodeAt(o + 1)))
|
|
135
|
+
o += 2;
|
|
136
136
|
else {
|
|
137
|
-
for (
|
|
138
|
-
|
|
137
|
+
for (o = c === -1 ? D : c;o < r && !O(t.charCodeAt(o)); )
|
|
138
|
+
o++;
|
|
139
139
|
continue;
|
|
140
140
|
}
|
|
141
|
-
let
|
|
142
|
-
for (;
|
|
143
|
-
|
|
144
|
-
let
|
|
145
|
-
if (
|
|
146
|
-
let
|
|
147
|
-
for (;
|
|
148
|
-
let
|
|
149
|
-
for (;
|
|
150
|
-
|
|
151
|
-
if ((
|
|
141
|
+
let d = o, l = o;
|
|
142
|
+
for (;l < r && g(t.charCodeAt(l)); )
|
|
143
|
+
l++;
|
|
144
|
+
let C = t.charCodeAt(l), a, q = false;
|
|
145
|
+
if (C === 39 || C === 34 || C === 96) {
|
|
146
|
+
let u = t[l], s = t.indexOf(u, l + 1), f = -1, h = -1;
|
|
147
|
+
for (;s !== -1; ) {
|
|
148
|
+
let x = t.charCodeAt(s - 1) === 92, w = s + 1;
|
|
149
|
+
for (;w < r && !O(t.charCodeAt(w)) && g(t.charCodeAt(w)); )
|
|
150
|
+
w++;
|
|
151
|
+
if ((w === r || O(t.charCodeAt(w)) || t.charCodeAt(w) === 35) && (f = s, h = w), !x)
|
|
152
152
|
break;
|
|
153
|
-
|
|
153
|
+
s = t.indexOf(u, s + 1);
|
|
154
154
|
}
|
|
155
|
-
if (
|
|
156
|
-
if (
|
|
157
|
-
for (;
|
|
158
|
-
|
|
159
|
-
|
|
155
|
+
if (f !== -1) {
|
|
156
|
+
if (a = t.slice(l + 1, f), o = h, t.charCodeAt(o) === 35)
|
|
157
|
+
for (;o < r && !O(t.charCodeAt(o)); )
|
|
158
|
+
o++;
|
|
159
|
+
q = true;
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
|
-
if (!
|
|
163
|
-
let
|
|
164
|
-
`,
|
|
165
|
-
|
|
166
|
-
let
|
|
167
|
-
if (
|
|
168
|
-
|
|
162
|
+
if (!q) {
|
|
163
|
+
let u = t.indexOf(`
|
|
164
|
+
`, d);
|
|
165
|
+
u === -1 && (u = r);
|
|
166
|
+
let s;
|
|
167
|
+
if (r < 4096)
|
|
168
|
+
s = t.indexOf("#", d), (s === -1 || s > u) && (s = u);
|
|
169
169
|
else
|
|
170
|
-
for (
|
|
171
|
-
|
|
172
|
-
let
|
|
173
|
-
for (;
|
|
174
|
-
|
|
175
|
-
for (;
|
|
176
|
-
|
|
177
|
-
let
|
|
178
|
-
if (
|
|
179
|
-
for (;
|
|
180
|
-
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
`).replace(/\\r/g, "\r")), n[
|
|
170
|
+
for (s = d;s < u && t.charCodeAt(s) !== 35; )
|
|
171
|
+
s++;
|
|
172
|
+
let f = d, h = s;
|
|
173
|
+
for (;f < h && g(t.charCodeAt(f)); )
|
|
174
|
+
f++;
|
|
175
|
+
for (;h > f && g(t.charCodeAt(h - 1)); )
|
|
176
|
+
h--;
|
|
177
|
+
let x = t.charCodeAt(f);
|
|
178
|
+
if (a = t.slice(f, h), a.includes("\u2028") || a.includes("\u2029") ? a = a.replace(/^(['"`])([\s\S]*)\1$/mg, "$2") : h - f >= 2 && (x === 39 || x === 34 || x === 96) && t.charCodeAt(h - 1) === x && (a = t.slice(f + 1, h - 1)), o = s, s < u)
|
|
179
|
+
for (;o < r && !O(t.charCodeAt(o)); )
|
|
180
|
+
o++;
|
|
181
|
+
}
|
|
182
|
+
C === 34 && (q || l < o) && a.indexOf("\\") !== -1 && (a = a.replace(/\\n/g, `
|
|
183
|
+
`).replace(/\\r/g, "\r")), n[k] = a;
|
|
184
184
|
}
|
|
185
185
|
return n;
|
|
186
186
|
}
|
|
187
|
-
function
|
|
188
|
-
return n && $(n.fast) ?
|
|
187
|
+
function J(e, n) {
|
|
188
|
+
return n && $(n.fast) ? V(e) : H(e);
|
|
189
189
|
}
|
|
190
|
-
function
|
|
190
|
+
function v(e) {
|
|
191
191
|
console.log(`\u2506 ${e}`);
|
|
192
192
|
}
|
|
193
|
-
function
|
|
193
|
+
function W(e) {
|
|
194
194
|
console.error(`\u25C7 ${e}`);
|
|
195
195
|
}
|
|
196
|
-
function
|
|
197
|
-
return e[0] === "~" ?
|
|
196
|
+
function S(e) {
|
|
197
|
+
return e[0] === "~" ? _.join(B.homedir(), e.slice(1)) : e;
|
|
198
198
|
}
|
|
199
|
-
function
|
|
199
|
+
function K(e = {}) {
|
|
200
200
|
let n = { ...e };
|
|
201
201
|
for (let t of Object.keys(n))
|
|
202
202
|
n[t] === undefined && delete n[t];
|
|
203
|
-
return { ...
|
|
204
|
-
}
|
|
205
|
-
function
|
|
206
|
-
e =
|
|
207
|
-
let n =
|
|
208
|
-
e && e.processEnv != null && (
|
|
209
|
-
let
|
|
210
|
-
e && e.encoding ? t = e.encoding :
|
|
211
|
-
let
|
|
203
|
+
return { ...I(), ...n };
|
|
204
|
+
}
|
|
205
|
+
function M(e) {
|
|
206
|
+
e = K(e);
|
|
207
|
+
let n = _.resolve(process.cwd(), ".env"), t = "utf8", r = process.env;
|
|
208
|
+
e && e.processEnv != null && (r = e.processEnv);
|
|
209
|
+
let o = $(e && e.debug);
|
|
210
|
+
e && e.encoding ? t = e.encoding : o && v("no encoding is specified (UTF-8 is used by default)");
|
|
211
|
+
let i = [n];
|
|
212
212
|
if (e && e.path)
|
|
213
213
|
if (!Array.isArray(e.path))
|
|
214
|
-
|
|
214
|
+
i = [S(e.path)];
|
|
215
215
|
else {
|
|
216
|
-
|
|
217
|
-
for (let
|
|
218
|
-
|
|
216
|
+
i = [];
|
|
217
|
+
for (let d of e.path)
|
|
218
|
+
i.push(S(d));
|
|
219
219
|
}
|
|
220
|
-
let
|
|
221
|
-
for (let
|
|
220
|
+
let c, E = {}, p = { fast: e.fast };
|
|
221
|
+
for (let d of i)
|
|
222
222
|
try {
|
|
223
|
-
let
|
|
224
|
-
A.populate(
|
|
225
|
-
} catch (
|
|
226
|
-
|
|
227
|
-
}
|
|
228
|
-
let
|
|
229
|
-
if (
|
|
230
|
-
let
|
|
231
|
-
for (let
|
|
223
|
+
let l = A.parse(F.readFileSync(d, { encoding: t }), p);
|
|
224
|
+
A.populate(E, l, e);
|
|
225
|
+
} catch (l) {
|
|
226
|
+
o && v(`failed to load ${d} ${l.message}`), c = l;
|
|
227
|
+
}
|
|
228
|
+
let k = A.populate(r, E, e), D = $(Object.prototype.hasOwnProperty.call(e, "quiet") ? e.quiet : I(r).quiet);
|
|
229
|
+
if (o || !D) {
|
|
230
|
+
let d = Object.keys(k).length, l = [];
|
|
231
|
+
for (let C of i)
|
|
232
232
|
try {
|
|
233
|
-
let
|
|
234
|
-
|
|
235
|
-
} catch (
|
|
236
|
-
|
|
233
|
+
let a = _.relative(process.cwd(), C instanceof L ? Q(C) : C);
|
|
234
|
+
l.push(a);
|
|
235
|
+
} catch (a) {
|
|
236
|
+
o && v(`failed to load ${C} ${a.message}`), c = a;
|
|
237
237
|
}
|
|
238
|
-
|
|
238
|
+
W(`injected env (${d}) from ${l.join(",")}`);
|
|
239
239
|
}
|
|
240
|
-
return
|
|
240
|
+
return c ? { parsed: E, error: c } : { parsed: E };
|
|
241
241
|
}
|
|
242
|
-
function
|
|
242
|
+
function Y(e) {
|
|
243
243
|
return A.configDotenv(e);
|
|
244
244
|
}
|
|
245
|
-
function
|
|
246
|
-
let
|
|
245
|
+
function z(e, n, t = {}) {
|
|
246
|
+
let r = $(t && t.debug), o = $(t && t.override), i = {};
|
|
247
247
|
if (e === null || typeof e != "object" || n === null || typeof n != "object") {
|
|
248
|
-
let
|
|
249
|
-
throw
|
|
250
|
-
}
|
|
251
|
-
for (let i of Object.keys(n))
|
|
252
|
-
Object.prototype.hasOwnProperty.call(e, i) ? (r === true && (e[i] = n[i], s[i] = n[i]), o && T(r === true ? `"${i}" is already defined and WAS overwritten` : `"${i}" is already defined and was NOT overwritten`)) : (e[i] = n[i], s[i] = n[i]);
|
|
253
|
-
return s;
|
|
254
|
-
}
|
|
255
|
-
var A = { configDotenv: ae, config: le, parse: se, populate: fe };
|
|
256
|
-
x.exports.configDotenv = A.configDotenv;
|
|
257
|
-
x.exports.config = A.config;
|
|
258
|
-
x.exports.parse = A.parse;
|
|
259
|
-
x.exports.populate = A.populate;
|
|
260
|
-
x.exports = A;
|
|
261
|
-
});
|
|
262
|
-
var M = j((Te, W) => {
|
|
263
|
-
var _ = __require("child_process"), ue = __require("fs"), L = __require("path");
|
|
264
|
-
function de(e) {
|
|
265
|
-
let n = ['"'], t = 0;
|
|
266
|
-
for (let o of e) {
|
|
267
|
-
if (o === "\\") {
|
|
268
|
-
t++;
|
|
269
|
-
continue;
|
|
270
|
-
}
|
|
271
|
-
o === '"' ? n.push("\\".repeat(t * 2 + 1), '"') : n.push("\\".repeat(t), o), t = 0;
|
|
272
|
-
}
|
|
273
|
-
return n.push("\\".repeat(t * 2), '"'), n.join("");
|
|
274
|
-
}
|
|
275
|
-
function H(e, n = 1) {
|
|
276
|
-
for (let t = 0;t < n; t++) {
|
|
277
|
-
let o = [];
|
|
278
|
-
for (let r of e) {
|
|
279
|
-
let s = r.charCodeAt(0), i = s >= 48 && s <= 57 || s >= 65 && s <= 90 || s >= 97 && s <= 122, l = "\\/:._-".includes(r);
|
|
280
|
-
!i && !l && s < 128 && o.push("^"), o.push(r);
|
|
281
|
-
}
|
|
282
|
-
e = o.join("");
|
|
283
|
-
}
|
|
284
|
-
return e;
|
|
285
|
-
}
|
|
286
|
-
function P(e, n) {
|
|
287
|
-
let t = Object.keys(e).reverse().find((o) => o.toUpperCase() === n);
|
|
288
|
-
return t === undefined ? undefined : e[t];
|
|
289
|
-
}
|
|
290
|
-
function pe(e, n, t) {
|
|
291
|
-
let o = (P(n, "PATHEXT") || ".COM;.EXE;.BAT;.CMD").split(";").filter(Boolean), s = o.some((l) => e.toLowerCase().endsWith(l.toLowerCase())) ? ["", ...o] : [...o, ""], i = /[\\/]/.test(e) ? [t] : [t, ...(P(n, "PATH") || "").split(";")];
|
|
292
|
-
for (let l of i)
|
|
293
|
-
for (let d of s) {
|
|
294
|
-
let h = L.resolve(t, l.replace(/^"|"$/g, ""), e + d);
|
|
295
|
-
try {
|
|
296
|
-
if (ue.statSync(h).isFile())
|
|
297
|
-
return h;
|
|
298
|
-
} catch {}
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
function he(e, n, t) {
|
|
302
|
-
if (process.platform !== "win32")
|
|
303
|
-
return _.spawn(e, n, t);
|
|
304
|
-
let o = t.env || process.env, r = pe(e, o, t.cwd || process.cwd());
|
|
305
|
-
if (r && /\.(?:exe|com)$/i.test(r))
|
|
306
|
-
return _.spawn(r, n, t);
|
|
307
|
-
let s = /\.(?:bat|cmd)$/i.test(r || e), i = [H(L.normalize(r || e))];
|
|
308
|
-
for (let d of n)
|
|
309
|
-
i.push(H(de(d), s ? 2 : 1));
|
|
310
|
-
let l = i.join(" ");
|
|
311
|
-
return _.spawn(P(o, "COMSPEC") || "cmd.exe", ["/d", "/v:off", "/s", "/c", `"${l}"`], { ...t, windowsVerbatimArguments: true });
|
|
312
|
-
}
|
|
313
|
-
W.exports = he;
|
|
314
|
-
});
|
|
315
|
-
var X = j(($e, F) => {
|
|
316
|
-
var ge = __require("fs"), me = __require("os"), Q = __require("path"), ve = __require("child_process"), Ce = M(), R = N(), { optionsFromEnv: J } = k();
|
|
317
|
-
function D() {
|
|
318
|
-
console.log(["Usage: dotenv run [--help] [-q|--quiet] [--debug] [--override] [--fast] [-f|--file <paths>] [--] <command> [args...]", "", "Run a command with environment variables from a .env file.", "Place dotenv options before the command; all following arguments go to the command.", "", "Options:", " -f, --file <paths> .env paths, comma-separated or repeated (default: .env)", " -q, --quiet suppress the injected env message", " --debug enable debug logging", " --override override existing environment variables", " --fast use the faster character-scanner parser", "", "Environment variables (DOTENV_CONFIG_* names remain as fallbacks):", " DOTENV_PATH, DOTENV_ENCODING, DOTENV_QUIET,", " DOTENV_DEBUG, DOTENV_OVERRIDE,", " DOTENV_FAST"].join(`
|
|
319
|
-
`));
|
|
320
|
-
}
|
|
321
|
-
function we(e) {
|
|
322
|
-
let n = [], t = false, o, r, s, i, l = -1;
|
|
323
|
-
for (let h = 0;h < e.length; h++) {
|
|
324
|
-
let f = e[h];
|
|
325
|
-
if (f === "--") {
|
|
326
|
-
l = h + 1;
|
|
327
|
-
break;
|
|
328
|
-
}
|
|
329
|
-
if (f === "--help" || f === "-h")
|
|
330
|
-
return { help: true };
|
|
331
|
-
if (f === "--quiet" || f === "-q") {
|
|
332
|
-
o = true;
|
|
333
|
-
continue;
|
|
334
|
-
}
|
|
335
|
-
if (f === "--debug") {
|
|
336
|
-
r = true;
|
|
337
|
-
continue;
|
|
338
|
-
}
|
|
339
|
-
if (f === "--override") {
|
|
340
|
-
s = true;
|
|
341
|
-
continue;
|
|
342
|
-
}
|
|
343
|
-
if (f === "--fast") {
|
|
344
|
-
i = true;
|
|
345
|
-
continue;
|
|
346
|
-
}
|
|
347
|
-
if (f === "-f" || f === "--file" || f.startsWith("-f=") || f.startsWith("--file=")) {
|
|
348
|
-
let c = f.indexOf("="), a = c === -1 ? f : f.slice(0, c), g = c === -1 ? e[++h] : f.slice(c + 1);
|
|
349
|
-
if (!g || g === "--")
|
|
350
|
-
return { error: `${a} requires a path` };
|
|
351
|
-
let p = g.split(",").map((y) => y.trim()).filter(Boolean);
|
|
352
|
-
if (p.length === 0)
|
|
353
|
-
return { error: `${a} requires a path` };
|
|
354
|
-
n.push(...p), t = true;
|
|
355
|
-
continue;
|
|
356
|
-
}
|
|
357
|
-
if (f.startsWith("-"))
|
|
358
|
-
return { error: `unknown option: ${f}` };
|
|
359
|
-
l = h;
|
|
360
|
-
break;
|
|
361
|
-
}
|
|
362
|
-
let d = l === -1 ? [] : e.slice(l);
|
|
363
|
-
return { paths: n, pathSet: t, quiet: o, debug: r, override: s, fast: i, command: d };
|
|
364
|
-
}
|
|
365
|
-
function Ae(e) {
|
|
366
|
-
return e[0] === "~" ? Q.join(me.homedir(), e.slice(1)) : e;
|
|
367
|
-
}
|
|
368
|
-
function Ee(e) {
|
|
369
|
-
let n = J(), t = { encoding: n.encoding || "utf8", quiet: n.quiet, debug: n.debug === true, override: n.override === true, fast: n.fast === true, paths: [".env"], defaultPath: true };
|
|
370
|
-
return n.path && (t.paths = [n.path], t.defaultPath = false), e.pathSet && (t.paths = e.paths, t.defaultPath = false), e.quiet != null && (t.quiet = e.quiet), e.debug != null && (t.debug = e.debug), e.override != null && (t.override = e.override), e.fast != null && (t.fast = e.fast), t;
|
|
371
|
-
}
|
|
372
|
-
function be(e) {
|
|
373
|
-
let n = {}, t = [], o = { override: e.override, debug: e.debug };
|
|
374
|
-
for (let s of e.paths) {
|
|
375
|
-
let i = Q.resolve(process.cwd(), Ae(s));
|
|
376
|
-
try {
|
|
377
|
-
let l = R.parse(ge.readFileSync(i, { encoding: e.encoding }), { fast: e.fast });
|
|
378
|
-
R.populate(n, l, o), t.push(s);
|
|
379
|
-
} catch (l) {
|
|
380
|
-
if (e.debug && console.log(`\u2506 failed to load ${s} ${l.message}`), !(e.defaultPath && l.code === "ENOENT"))
|
|
381
|
-
throw l;
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
return { injected: R.populate(process.env, n, o), loadedPaths: t };
|
|
385
|
-
}
|
|
386
|
-
function K(e) {
|
|
387
|
-
let n = e[0];
|
|
388
|
-
if (n === "--help" || n === "-h") {
|
|
389
|
-
D();
|
|
390
|
-
return;
|
|
391
|
-
}
|
|
392
|
-
if (n !== "run") {
|
|
393
|
-
D(), process.exitCode = 1;
|
|
394
|
-
return;
|
|
395
|
-
}
|
|
396
|
-
let t = we(e.slice(1));
|
|
397
|
-
if (t.help) {
|
|
398
|
-
D();
|
|
399
|
-
return;
|
|
400
|
-
}
|
|
401
|
-
if (t.error) {
|
|
402
|
-
console.error(`dotenv: ${t.error}`), D(), process.exitCode = 1;
|
|
403
|
-
return;
|
|
404
|
-
}
|
|
405
|
-
if (t.command.length === 0) {
|
|
406
|
-
D(), process.exitCode = 1;
|
|
407
|
-
return;
|
|
408
|
-
}
|
|
409
|
-
let o = Ee(t);
|
|
410
|
-
try {
|
|
411
|
-
let c = be(o);
|
|
412
|
-
if (!(o.quiet == null ? J().quiet : o.quiet)) {
|
|
413
|
-
let g = `\u25C7 injected env (${Object.keys(c.injected).length})`;
|
|
414
|
-
c.loadedPaths.length > 0 && (g += ` from ${c.loadedPaths.join(", ")}`), console.error(g);
|
|
415
|
-
}
|
|
416
|
-
} catch (c) {
|
|
417
|
-
console.error(`dotenv: ${c.message}`), process.exitCode = 1;
|
|
418
|
-
return;
|
|
419
|
-
}
|
|
420
|
-
let r = !!process.stdin.isTTY, s = process.platform !== "win32" && !r, i = Ce(t.command[0], t.command.slice(1), { stdio: "inherit", detached: s }), l = new Map, d = 0;
|
|
421
|
-
function h(c) {
|
|
422
|
-
if (!(!i.pid || i.exitCode !== null || i.signalCode !== null)) {
|
|
423
|
-
if (process.platform === "win32") {
|
|
424
|
-
ve.spawnSync("taskkill", ["/pid", String(i.pid), "/T", "/F"], { stdio: "ignore" });
|
|
425
|
-
return;
|
|
426
|
-
}
|
|
427
|
-
try {
|
|
428
|
-
process.kill(s ? -i.pid : i.pid, c);
|
|
429
|
-
} catch (a) {
|
|
430
|
-
if (a.code !== "ESRCH")
|
|
431
|
-
throw a;
|
|
432
|
-
}
|
|
433
|
-
}
|
|
248
|
+
let c = new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");
|
|
249
|
+
throw c.code = "OBJECT_REQUIRED", c;
|
|
434
250
|
}
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
}
|
|
439
|
-
for (let c of ["SIGINT", "SIGTERM", "SIGHUP", "SIGQUIT"]) {
|
|
440
|
-
let a = () => {
|
|
441
|
-
if (c === "SIGINT") {
|
|
442
|
-
if (d++, r && process.platform !== "win32" && d === 1)
|
|
443
|
-
return;
|
|
444
|
-
if (d > 1) {
|
|
445
|
-
h(d === 2 ? "SIGTERM" : "SIGKILL");
|
|
446
|
-
return;
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
h(c);
|
|
450
|
-
};
|
|
451
|
-
l.set(c, a), process.on(c, a);
|
|
452
|
-
}
|
|
453
|
-
i.on("error", function(c) {
|
|
454
|
-
f(), console.error(`dotenv: ${c.message}`), process.exitCode = 1;
|
|
455
|
-
}), i.on("exit", function(c, a) {
|
|
456
|
-
f(), typeof c == "number" ? process.exit(c) : (setInterval(() => {}, 1000), process.kill(process.pid, a));
|
|
457
|
-
});
|
|
251
|
+
for (let c of Object.keys(n))
|
|
252
|
+
Object.prototype.hasOwnProperty.call(e, c) ? (o === true && (e[c] = n[c], i[c] = n[c]), r && v(o === true ? `"${c}" is already defined and WAS overwritten` : `"${c}" is already defined and was NOT overwritten`)) : (e[c] = n[c], i[c] = n[c]);
|
|
253
|
+
return i;
|
|
458
254
|
}
|
|
459
|
-
|
|
460
|
-
|
|
255
|
+
var A = { configDotenv: M, config: Y, parse: J, populate: z };
|
|
256
|
+
b.exports.configDotenv = A.configDotenv;
|
|
257
|
+
b.exports.config = A.config;
|
|
258
|
+
b.exports.parse = A.parse;
|
|
259
|
+
b.exports.populate = A.populate;
|
|
260
|
+
b.exports = A;
|
|
461
261
|
});
|
|
462
|
-
var
|
|
463
|
-
|
|
464
|
-
module.exports =
|
|
465
|
-
module.exports.
|
|
466
|
-
module.exports.
|
|
467
|
-
module.exports.
|
|
468
|
-
module.exports.populate = S.populate;
|
|
262
|
+
var m = P();
|
|
263
|
+
module.exports = m;
|
|
264
|
+
module.exports.config = m.config;
|
|
265
|
+
module.exports.configDotenv = m.configDotenv;
|
|
266
|
+
module.exports.parse = m.parse;
|
|
267
|
+
module.exports.populate = m.populate;
|
|
469
268
|
});
|
|
470
269
|
|
|
471
270
|
// src/load-env.ts
|
|
@@ -6535,38 +6334,48 @@ var getCredentialLockPath = async (product, account) => {
|
|
|
6535
6334
|
const key = createHash2("sha256").update(`${product}:${account}`).digest("hex");
|
|
6536
6335
|
return join(await ensurePrivateCredentialLockDirectory(), `${key}.lock`);
|
|
6537
6336
|
};
|
|
6337
|
+
var hasErrorCode = (cause, code) => cause instanceof Error && ("code" in cause) && cause.code === code;
|
|
6338
|
+
var createRefreshLockFile = async (path) => {
|
|
6339
|
+
const handle = await open2(path, "wx");
|
|
6340
|
+
const owner = randomUUID();
|
|
6341
|
+
try {
|
|
6342
|
+
await handle.writeFile(owner);
|
|
6343
|
+
} catch (cause) {
|
|
6344
|
+
await handle.close().catch(() => {
|
|
6345
|
+
return;
|
|
6346
|
+
});
|
|
6347
|
+
await unlink(path).catch(() => {
|
|
6348
|
+
return;
|
|
6349
|
+
});
|
|
6350
|
+
throw cause;
|
|
6351
|
+
}
|
|
6352
|
+
return { handle, owner };
|
|
6353
|
+
};
|
|
6354
|
+
var refreshLockVanished = async (path) => {
|
|
6355
|
+
try {
|
|
6356
|
+
const lock = await stat(path);
|
|
6357
|
+
if (Date.now() - lock.mtimeMs > refreshLockTimeoutMs) {
|
|
6358
|
+
throw new Error(`The CLI credential lock appears stale at ${path}. Ensure no CLI authentication command is running, remove that lock file, and retry.`);
|
|
6359
|
+
}
|
|
6360
|
+
} catch (statCause) {
|
|
6361
|
+
if (hasErrorCode(statCause, "ENOENT")) {
|
|
6362
|
+
return true;
|
|
6363
|
+
}
|
|
6364
|
+
throw statCause;
|
|
6365
|
+
}
|
|
6366
|
+
return false;
|
|
6367
|
+
};
|
|
6538
6368
|
var acquireRefreshLock = async (path) => {
|
|
6539
6369
|
const deadline = Date.now() + refreshLockTimeoutMs;
|
|
6540
6370
|
while (Date.now() < deadline) {
|
|
6541
6371
|
try {
|
|
6542
|
-
|
|
6543
|
-
const owner = randomUUID();
|
|
6544
|
-
try {
|
|
6545
|
-
await handle.writeFile(owner);
|
|
6546
|
-
} catch (cause) {
|
|
6547
|
-
await handle.close().catch(() => {
|
|
6548
|
-
return;
|
|
6549
|
-
});
|
|
6550
|
-
await unlink(path).catch(() => {
|
|
6551
|
-
return;
|
|
6552
|
-
});
|
|
6553
|
-
throw cause;
|
|
6554
|
-
}
|
|
6555
|
-
return { handle, owner };
|
|
6372
|
+
return await createRefreshLockFile(path);
|
|
6556
6373
|
} catch (cause) {
|
|
6557
|
-
if (!(cause
|
|
6374
|
+
if (!hasErrorCode(cause, "EEXIST")) {
|
|
6558
6375
|
throw cause;
|
|
6559
6376
|
}
|
|
6560
|
-
|
|
6561
|
-
|
|
6562
|
-
if (Date.now() - lock.mtimeMs > refreshLockTimeoutMs) {
|
|
6563
|
-
throw new Error(`The CLI credential lock appears stale at ${path}. Ensure no CLI authentication command is running, remove that lock file, and retry.`);
|
|
6564
|
-
}
|
|
6565
|
-
} catch (statCause) {
|
|
6566
|
-
if (statCause instanceof Error && "code" in statCause && statCause.code === "ENOENT") {
|
|
6567
|
-
continue;
|
|
6568
|
-
}
|
|
6569
|
-
throw statCause;
|
|
6377
|
+
if (await refreshLockVanished(path)) {
|
|
6378
|
+
continue;
|
|
6570
6379
|
}
|
|
6571
6380
|
await Bun.sleep(refreshLockRetryMs);
|
|
6572
6381
|
}
|
|
@@ -6716,6 +6525,36 @@ var openSystemBrowser = async (url) => {
|
|
|
6716
6525
|
return false;
|
|
6717
6526
|
}
|
|
6718
6527
|
};
|
|
6528
|
+
var persistLoginCredentials = async ({
|
|
6529
|
+
store,
|
|
6530
|
+
credentials,
|
|
6531
|
+
baseUrl,
|
|
6532
|
+
fetchImplementation
|
|
6533
|
+
}) => {
|
|
6534
|
+
try {
|
|
6535
|
+
await withCredentialLock(store, () => persistIssuedCredentials({
|
|
6536
|
+
store,
|
|
6537
|
+
credentials,
|
|
6538
|
+
apiBaseUrl: baseUrl,
|
|
6539
|
+
fetch: fetchImplementation,
|
|
6540
|
+
phase: "login"
|
|
6541
|
+
}));
|
|
6542
|
+
} catch (error) {
|
|
6543
|
+
if (error instanceof CliCredentialPersistenceError)
|
|
6544
|
+
throw error;
|
|
6545
|
+
throw new CliCredentialPersistenceError(await revokeIssuedCredentials(fetchImplementation, baseUrl, credentials), false, "login");
|
|
6546
|
+
}
|
|
6547
|
+
};
|
|
6548
|
+
var nextPollIntervalMs = (errorCode, intervalMs) => {
|
|
6549
|
+
if (errorCode === "authorization_pending")
|
|
6550
|
+
return intervalMs;
|
|
6551
|
+
if (errorCode === "slow_down")
|
|
6552
|
+
return intervalMs + 5000;
|
|
6553
|
+
if (errorCode === "access_denied") {
|
|
6554
|
+
throw new Error("CLI authentication was denied in the browser.");
|
|
6555
|
+
}
|
|
6556
|
+
throw new Error("CLI authentication expired. Run auth login again.");
|
|
6557
|
+
};
|
|
6719
6558
|
var loginWithBrowser = async ({
|
|
6720
6559
|
apiBaseUrl,
|
|
6721
6560
|
clientName = hostname(),
|
|
@@ -6758,35 +6597,19 @@ var loginWithBrowser = async ({
|
|
|
6758
6597
|
if (response.ok) {
|
|
6759
6598
|
const issued = tokenResponseSchema.parse(payload);
|
|
6760
6599
|
const credentials = toStoredCredentials(issued, baseUrl, now());
|
|
6761
|
-
|
|
6762
|
-
|
|
6763
|
-
|
|
6764
|
-
|
|
6765
|
-
|
|
6766
|
-
|
|
6767
|
-
phase: "login"
|
|
6768
|
-
}));
|
|
6769
|
-
} catch (error) {
|
|
6770
|
-
if (error instanceof CliCredentialPersistenceError)
|
|
6771
|
-
throw error;
|
|
6772
|
-
throw new CliCredentialPersistenceError(await revokeIssuedCredentials(fetchImplementation, baseUrl, credentials), false, "login");
|
|
6773
|
-
}
|
|
6600
|
+
await persistLoginCredentials({
|
|
6601
|
+
store,
|
|
6602
|
+
credentials,
|
|
6603
|
+
baseUrl,
|
|
6604
|
+
fetchImplementation
|
|
6605
|
+
});
|
|
6774
6606
|
return credentials;
|
|
6775
6607
|
}
|
|
6776
6608
|
const error = deviceTokenErrorSchema.safeParse(payload);
|
|
6777
6609
|
if (!error.success) {
|
|
6778
6610
|
throw new Error(`CLI authentication failed with HTTP ${response.status}.`);
|
|
6779
6611
|
}
|
|
6780
|
-
|
|
6781
|
-
continue;
|
|
6782
|
-
if (error.data.error === "slow_down") {
|
|
6783
|
-
intervalMs += 5000;
|
|
6784
|
-
continue;
|
|
6785
|
-
}
|
|
6786
|
-
if (error.data.error === "access_denied") {
|
|
6787
|
-
throw new Error("CLI authentication was denied in the browser.");
|
|
6788
|
-
}
|
|
6789
|
-
throw new Error("CLI authentication expired. Run auth login again.");
|
|
6612
|
+
intervalMs = nextPollIntervalMs(error.data.error, intervalMs);
|
|
6790
6613
|
}
|
|
6791
6614
|
throw new Error("CLI authentication expired. Run auth login again.");
|
|
6792
6615
|
};
|
|
@@ -6798,6 +6621,40 @@ var revokeIssuedCredentials = async (fetchImplementation, apiBaseUrl, credential
|
|
|
6798
6621
|
return false;
|
|
6799
6622
|
}
|
|
6800
6623
|
};
|
|
6624
|
+
var restoreLoginSnapshot = async (store, credentials, current, prior) => {
|
|
6625
|
+
if (isDeepStrictEqual(current, prior))
|
|
6626
|
+
return true;
|
|
6627
|
+
if (current !== null && current.refreshToken !== credentials.refreshToken) {
|
|
6628
|
+
return false;
|
|
6629
|
+
}
|
|
6630
|
+
if (prior)
|
|
6631
|
+
await store.set(prior);
|
|
6632
|
+
else
|
|
6633
|
+
await store.delete();
|
|
6634
|
+
return isDeepStrictEqual(await store.get(), prior);
|
|
6635
|
+
};
|
|
6636
|
+
var removeRefreshedCredentials = async (store, current) => {
|
|
6637
|
+
if (current)
|
|
6638
|
+
await store.delete();
|
|
6639
|
+
return await store.get() === null;
|
|
6640
|
+
};
|
|
6641
|
+
var restoreLocalCredentials = async ({
|
|
6642
|
+
store,
|
|
6643
|
+
credentials,
|
|
6644
|
+
phase,
|
|
6645
|
+
prior
|
|
6646
|
+
}) => {
|
|
6647
|
+
try {
|
|
6648
|
+
const current = await store.get();
|
|
6649
|
+
if (phase === "login" && prior !== undefined) {
|
|
6650
|
+
return await restoreLoginSnapshot(store, credentials, current, prior);
|
|
6651
|
+
}
|
|
6652
|
+
if (phase === "refresh" && (!current || current.refreshToken === credentials.refreshToken || current.refreshToken === prior?.refreshToken)) {
|
|
6653
|
+
return await removeRefreshedCredentials(store, current);
|
|
6654
|
+
}
|
|
6655
|
+
} catch {}
|
|
6656
|
+
return false;
|
|
6657
|
+
};
|
|
6801
6658
|
var persistIssuedCredentials = async ({
|
|
6802
6659
|
store,
|
|
6803
6660
|
credentials,
|
|
@@ -6817,25 +6674,12 @@ var persistIssuedCredentials = async ({
|
|
|
6817
6674
|
return;
|
|
6818
6675
|
} catch {
|
|
6819
6676
|
const remoteRevoked = await revokeIssuedCredentials(fetchImplementation, apiBaseUrl, credentials);
|
|
6820
|
-
|
|
6821
|
-
|
|
6822
|
-
|
|
6823
|
-
|
|
6824
|
-
|
|
6825
|
-
|
|
6826
|
-
else if (current === null || current.refreshToken === credentials.refreshToken) {
|
|
6827
|
-
if (prior)
|
|
6828
|
-
await store.set(prior);
|
|
6829
|
-
else
|
|
6830
|
-
await store.delete();
|
|
6831
|
-
localRestored = isDeepStrictEqual(await store.get(), prior);
|
|
6832
|
-
}
|
|
6833
|
-
} else if (phase === "refresh" && (!current || current.refreshToken === credentials.refreshToken || current.refreshToken === prior?.refreshToken)) {
|
|
6834
|
-
if (current)
|
|
6835
|
-
await store.delete();
|
|
6836
|
-
localRestored = await store.get() === null;
|
|
6837
|
-
}
|
|
6838
|
-
} catch {}
|
|
6677
|
+
const localRestored = await restoreLocalCredentials({
|
|
6678
|
+
store,
|
|
6679
|
+
credentials,
|
|
6680
|
+
phase,
|
|
6681
|
+
prior
|
|
6682
|
+
});
|
|
6839
6683
|
throw new CliCredentialPersistenceError(remoteRevoked, localRestored, phase);
|
|
6840
6684
|
}
|
|
6841
6685
|
};
|
|
@@ -6999,7 +6843,7 @@ var DEPRECATED_EVENT_TYPES = [
|
|
|
6999
6843
|
var activeEventTypeSchema = _enum(EventType).exclude(DEPRECATED_EVENT_TYPES);
|
|
7000
6844
|
var ACTIVE_EVENT_TYPES = activeEventTypeSchema.options;
|
|
7001
6845
|
|
|
7002
|
-
// ../../../node_modules/.bun/@trpc+server@11.
|
|
6846
|
+
// ../../../node_modules/.bun/@trpc+server@11.25.2+aec250ebf9e68690/node_modules/@trpc/server/dist/observable-kpFFzvou.mjs
|
|
7003
6847
|
function observable(subscribe) {
|
|
7004
6848
|
const self = {
|
|
7005
6849
|
subscribe(observer) {
|
|
@@ -7007,6 +6851,20 @@ function observable(subscribe) {
|
|
|
7007
6851
|
let isDone = false;
|
|
7008
6852
|
let unsubscribed = false;
|
|
7009
6853
|
let teardownImmediately = false;
|
|
6854
|
+
let subscribing = true;
|
|
6855
|
+
let thrownWhileSubscribing = null;
|
|
6856
|
+
function end(notify) {
|
|
6857
|
+
try {
|
|
6858
|
+
notify();
|
|
6859
|
+
} catch (cause) {
|
|
6860
|
+
var _thrownWhileSubscribi;
|
|
6861
|
+
if (!subscribing)
|
|
6862
|
+
throw cause;
|
|
6863
|
+
(_thrownWhileSubscribi = thrownWhileSubscribing) !== null && _thrownWhileSubscribi !== undefined || (thrownWhileSubscribing = { cause });
|
|
6864
|
+
} finally {
|
|
6865
|
+
unsubscribe();
|
|
6866
|
+
}
|
|
6867
|
+
}
|
|
7010
6868
|
function unsubscribe() {
|
|
7011
6869
|
if (teardownRef === null) {
|
|
7012
6870
|
teardownImmediately = true;
|
|
@@ -7028,24 +6886,29 @@ function observable(subscribe) {
|
|
|
7028
6886
|
(_observer$next = observer.next) === null || _observer$next === undefined || _observer$next.call(observer, value);
|
|
7029
6887
|
},
|
|
7030
6888
|
error(err) {
|
|
7031
|
-
var _observer$error;
|
|
7032
6889
|
if (isDone)
|
|
7033
6890
|
return;
|
|
7034
6891
|
isDone = true;
|
|
7035
|
-
(
|
|
7036
|
-
|
|
6892
|
+
end(() => {
|
|
6893
|
+
var _observer$error;
|
|
6894
|
+
return (_observer$error = observer.error) === null || _observer$error === undefined ? undefined : _observer$error.call(observer, err);
|
|
6895
|
+
});
|
|
7037
6896
|
},
|
|
7038
6897
|
complete() {
|
|
7039
|
-
var _observer$complete;
|
|
7040
6898
|
if (isDone)
|
|
7041
6899
|
return;
|
|
7042
6900
|
isDone = true;
|
|
7043
|
-
(
|
|
7044
|
-
|
|
6901
|
+
end(() => {
|
|
6902
|
+
var _observer$complete;
|
|
6903
|
+
return (_observer$complete = observer.complete) === null || _observer$complete === undefined ? undefined : _observer$complete.call(observer);
|
|
6904
|
+
});
|
|
7045
6905
|
}
|
|
7046
6906
|
});
|
|
6907
|
+
subscribing = false;
|
|
7047
6908
|
if (teardownImmediately)
|
|
7048
6909
|
unsubscribe();
|
|
6910
|
+
if (thrownWhileSubscribing)
|
|
6911
|
+
throw thrownWhileSubscribing.cause;
|
|
7049
6912
|
return { unsubscribe };
|
|
7050
6913
|
},
|
|
7051
6914
|
pipe(...operations) {
|
|
@@ -7086,8 +6949,117 @@ function observableToPromise(observable) {
|
|
|
7086
6949
|
});
|
|
7087
6950
|
});
|
|
7088
6951
|
}
|
|
6952
|
+
function observableToAsyncIterable(observable, signal) {
|
|
6953
|
+
const values = [];
|
|
6954
|
+
const pending = [];
|
|
6955
|
+
let error = null;
|
|
6956
|
+
let finished = false;
|
|
6957
|
+
let subscription = null;
|
|
6958
|
+
function unsubscribe() {
|
|
6959
|
+
if (finished)
|
|
6960
|
+
return null;
|
|
6961
|
+
finished = true;
|
|
6962
|
+
signal.removeEventListener("abort", abort);
|
|
6963
|
+
try {
|
|
6964
|
+
subscription === null || subscription === undefined || subscription.unsubscribe();
|
|
6965
|
+
return null;
|
|
6966
|
+
} catch (cause) {
|
|
6967
|
+
return { cause };
|
|
6968
|
+
}
|
|
6969
|
+
}
|
|
6970
|
+
function settle() {
|
|
6971
|
+
const first = error ? pending.shift() : undefined;
|
|
6972
|
+
if (error && first) {
|
|
6973
|
+
const { cause } = error;
|
|
6974
|
+
error = null;
|
|
6975
|
+
first.reject(cause);
|
|
6976
|
+
}
|
|
6977
|
+
for (const promise of pending.splice(0))
|
|
6978
|
+
promise.resolve({
|
|
6979
|
+
value: undefined,
|
|
6980
|
+
done: true
|
|
6981
|
+
});
|
|
6982
|
+
}
|
|
6983
|
+
function finish() {
|
|
6984
|
+
const failure = unsubscribe();
|
|
6985
|
+
settle();
|
|
6986
|
+
if (failure)
|
|
6987
|
+
throw failure.cause;
|
|
6988
|
+
}
|
|
6989
|
+
function abort() {
|
|
6990
|
+
const failure = unsubscribe();
|
|
6991
|
+
if (failure)
|
|
6992
|
+
error = failure;
|
|
6993
|
+
settle();
|
|
6994
|
+
}
|
|
6995
|
+
subscription = observable.subscribe({
|
|
6996
|
+
next(value) {
|
|
6997
|
+
if (finished)
|
|
6998
|
+
return;
|
|
6999
|
+
const promise = pending.shift();
|
|
7000
|
+
if (promise)
|
|
7001
|
+
promise.resolve({
|
|
7002
|
+
value,
|
|
7003
|
+
done: false
|
|
7004
|
+
});
|
|
7005
|
+
else
|
|
7006
|
+
values.push(value);
|
|
7007
|
+
},
|
|
7008
|
+
error(cause) {
|
|
7009
|
+
if (finished)
|
|
7010
|
+
return;
|
|
7011
|
+
error = { cause };
|
|
7012
|
+
finish();
|
|
7013
|
+
},
|
|
7014
|
+
complete: finish
|
|
7015
|
+
});
|
|
7016
|
+
if (finished)
|
|
7017
|
+
subscription.unsubscribe();
|
|
7018
|
+
else if (signal.aborted)
|
|
7019
|
+
abort();
|
|
7020
|
+
else
|
|
7021
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
7022
|
+
const iterator = {
|
|
7023
|
+
[Symbol.asyncIterator]() {
|
|
7024
|
+
return iterator;
|
|
7025
|
+
},
|
|
7026
|
+
async next() {
|
|
7027
|
+
if (values.length > 0)
|
|
7028
|
+
return {
|
|
7029
|
+
value: values.shift(),
|
|
7030
|
+
done: false
|
|
7031
|
+
};
|
|
7032
|
+
if (error) {
|
|
7033
|
+
const { cause } = error;
|
|
7034
|
+
error = null;
|
|
7035
|
+
throw cause;
|
|
7036
|
+
}
|
|
7037
|
+
if (finished)
|
|
7038
|
+
return {
|
|
7039
|
+
value: undefined,
|
|
7040
|
+
done: true
|
|
7041
|
+
};
|
|
7042
|
+
return new Promise((resolve, reject) => {
|
|
7043
|
+
pending.push({
|
|
7044
|
+
resolve,
|
|
7045
|
+
reject
|
|
7046
|
+
});
|
|
7047
|
+
});
|
|
7048
|
+
},
|
|
7049
|
+
async return() {
|
|
7050
|
+
values.length = 0;
|
|
7051
|
+
error = null;
|
|
7052
|
+
finish();
|
|
7053
|
+
return {
|
|
7054
|
+
value: undefined,
|
|
7055
|
+
done: true
|
|
7056
|
+
};
|
|
7057
|
+
}
|
|
7058
|
+
};
|
|
7059
|
+
return iterator;
|
|
7060
|
+
}
|
|
7089
7061
|
|
|
7090
|
-
// ../../../node_modules/.bun/@trpc+server@11.
|
|
7062
|
+
// ../../../node_modules/.bun/@trpc+server@11.25.2+aec250ebf9e68690/node_modules/@trpc/server/dist/observable-Cmd1MFy3.mjs
|
|
7091
7063
|
function share(_opts) {
|
|
7092
7064
|
return (source) => {
|
|
7093
7065
|
let refCount = 0;
|
|
@@ -7171,6 +7143,15 @@ function share(_opts) {
|
|
|
7171
7143
|
};
|
|
7172
7144
|
}
|
|
7173
7145
|
var distinctUnsetMarker = Symbol();
|
|
7146
|
+
function callObserver(callback) {
|
|
7147
|
+
try {
|
|
7148
|
+
callback();
|
|
7149
|
+
} catch (error) {
|
|
7150
|
+
setTimeout(() => {
|
|
7151
|
+
throw error;
|
|
7152
|
+
});
|
|
7153
|
+
}
|
|
7154
|
+
}
|
|
7174
7155
|
function behaviorSubject(initialValue) {
|
|
7175
7156
|
let value = initialValue;
|
|
7176
7157
|
const observerList = /* @__PURE__ */ new Set;
|
|
@@ -7194,13 +7175,13 @@ function behaviorSubject(initialValue) {
|
|
|
7194
7175
|
value = nextValue;
|
|
7195
7176
|
for (const observer of [...observerList])
|
|
7196
7177
|
if (observerList.has(observer))
|
|
7197
|
-
observer.next(nextValue);
|
|
7178
|
+
callObserver(() => observer.next(nextValue));
|
|
7198
7179
|
};
|
|
7199
7180
|
obs.get = () => value;
|
|
7200
7181
|
return obs;
|
|
7201
7182
|
}
|
|
7202
7183
|
|
|
7203
|
-
// ../../../node_modules/.bun/@trpc+client@11.
|
|
7184
|
+
// ../../../node_modules/.bun/@trpc+client@11.25.2+73a9f6e6dedcb27f/node_modules/@trpc/client/dist/splitLink-DcpFI5s5.mjs
|
|
7204
7185
|
function createChain(opts) {
|
|
7205
7186
|
return observable((observer) => {
|
|
7206
7187
|
function execute(index = 0, op = opts.op) {
|
|
@@ -7218,7 +7199,7 @@ function createChain(opts) {
|
|
|
7218
7199
|
});
|
|
7219
7200
|
}
|
|
7220
7201
|
|
|
7221
|
-
// ../../../node_modules/.bun/@trpc+client@11.
|
|
7202
|
+
// ../../../node_modules/.bun/@trpc+client@11.25.2+73a9f6e6dedcb27f/node_modules/@trpc/client/dist/objectSpread2-weooBxVk.mjs
|
|
7222
7203
|
function _typeof(o) {
|
|
7223
7204
|
"@babel/helpers - typeof";
|
|
7224
7205
|
return _typeof = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(o) {
|
|
@@ -7273,7 +7254,7 @@ function _objectSpread2(e) {
|
|
|
7273
7254
|
return e;
|
|
7274
7255
|
}
|
|
7275
7256
|
|
|
7276
|
-
// ../../../node_modules/.bun/@trpc+server@11.
|
|
7257
|
+
// ../../../node_modules/.bun/@trpc+server@11.25.2+aec250ebf9e68690/node_modules/@trpc/server/dist/codes-nbrm_zWY.mjs
|
|
7277
7258
|
function isObject2(value) {
|
|
7278
7259
|
return !!value && !Array.isArray(value) && typeof value === "object";
|
|
7279
7260
|
}
|
|
@@ -7310,7 +7291,7 @@ var retryableRpcCodes = [
|
|
|
7310
7291
|
TRPC_ERROR_CODES_BY_KEY.INTERNAL_SERVER_ERROR
|
|
7311
7292
|
];
|
|
7312
7293
|
|
|
7313
|
-
// ../../../node_modules/.bun/@trpc+server@11.
|
|
7294
|
+
// ../../../node_modules/.bun/@trpc+server@11.25.2+aec250ebf9e68690/node_modules/@trpc/server/dist/getErrorShape-B5jPKHJ3.mjs
|
|
7314
7295
|
var noop = () => {};
|
|
7315
7296
|
var freezeIfAvailable = (obj) => {
|
|
7316
7297
|
if (Object.freeze)
|
|
@@ -7413,7 +7394,7 @@ function _objectSpread22(e) {
|
|
|
7413
7394
|
return e;
|
|
7414
7395
|
}
|
|
7415
7396
|
|
|
7416
|
-
// ../../../node_modules/.bun/@trpc+server@11.
|
|
7397
|
+
// ../../../node_modules/.bun/@trpc+server@11.25.2+aec250ebf9e68690/node_modules/@trpc/server/dist/asyncGeneratorDelegate-JWx0LJUD.mjs
|
|
7417
7398
|
function transformResultInner(response, transformer) {
|
|
7418
7399
|
if ("error" in response) {
|
|
7419
7400
|
const error = transformer.deserialize(response.error);
|
|
@@ -7522,7 +7503,7 @@ AsyncGenerator.prototype[typeof Symbol == "function" && Symbol.asyncIterator ||
|
|
|
7522
7503
|
};
|
|
7523
7504
|
var trackedSymbol = Symbol();
|
|
7524
7505
|
|
|
7525
|
-
// ../../../node_modules/.bun/@trpc+client@11.
|
|
7506
|
+
// ../../../node_modules/.bun/@trpc+client@11.25.2+73a9f6e6dedcb27f/node_modules/@trpc/client/dist/TRPCClientError-Byo7P4QG.mjs
|
|
7526
7507
|
function isTRPCClientError(cause) {
|
|
7527
7508
|
return cause instanceof TRPCClientError;
|
|
7528
7509
|
}
|
|
@@ -7568,7 +7549,7 @@ var TRPCClientError = class TRPCClientError extends Error {
|
|
|
7568
7549
|
}
|
|
7569
7550
|
};
|
|
7570
7551
|
|
|
7571
|
-
// ../../../node_modules/.bun/@trpc+client@11.
|
|
7552
|
+
// ../../../node_modules/.bun/@trpc+client@11.25.2+73a9f6e6dedcb27f/node_modules/@trpc/client/dist/unstable-internals.mjs
|
|
7572
7553
|
function getTransformer(transformer) {
|
|
7573
7554
|
const _transformer = transformer;
|
|
7574
7555
|
if (!_transformer)
|
|
@@ -7590,7 +7571,7 @@ function getTransformer(transformer) {
|
|
|
7590
7571
|
};
|
|
7591
7572
|
}
|
|
7592
7573
|
|
|
7593
|
-
// ../../../node_modules/.bun/@trpc+client@11.
|
|
7574
|
+
// ../../../node_modules/.bun/@trpc+client@11.25.2+73a9f6e6dedcb27f/node_modules/@trpc/client/dist/httpUtils-5Hmhcy-z.mjs
|
|
7594
7575
|
var isFunction2 = (fn) => typeof fn === "function";
|
|
7595
7576
|
function getFetch(customFetchImpl) {
|
|
7596
7577
|
if (customFetchImpl)
|
|
@@ -7743,7 +7724,7 @@ async function httpRequest(opts) {
|
|
|
7743
7724
|
};
|
|
7744
7725
|
}
|
|
7745
7726
|
|
|
7746
|
-
// ../../../node_modules/.bun/@trpc+client@11.
|
|
7727
|
+
// ../../../node_modules/.bun/@trpc+client@11.25.2+73a9f6e6dedcb27f/node_modules/@trpc/client/dist/httpBatchLink-aPx7u_sr.mjs
|
|
7747
7728
|
var throwFatalError = () => {
|
|
7748
7729
|
throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new");
|
|
7749
7730
|
};
|
|
@@ -7938,7 +7919,7 @@ function httpBatchLink(opts) {
|
|
|
7938
7919
|
};
|
|
7939
7920
|
}
|
|
7940
7921
|
|
|
7941
|
-
// ../../../node_modules/.bun/@trpc+client@11.
|
|
7922
|
+
// ../../../node_modules/.bun/@trpc+client@11.25.2+73a9f6e6dedcb27f/node_modules/@trpc/client/dist/wsLink-l0dX0ah6.mjs
|
|
7942
7923
|
var resultOf = (value, ...args) => {
|
|
7943
7924
|
return typeof value === "function" ? value(...args) : value;
|
|
7944
7925
|
};
|
|
@@ -7976,12 +7957,28 @@ function asyncWsOpen(ws) {
|
|
|
7976
7957
|
ws.addEventListener("error", reject);
|
|
7977
7958
|
return promise;
|
|
7978
7959
|
}
|
|
7960
|
+
var pongCallbacks = /* @__PURE__ */ new WeakMap;
|
|
7961
|
+
function sendPing(ws, onPong) {
|
|
7962
|
+
let callbacks = pongCallbacks.get(ws);
|
|
7963
|
+
if (!callbacks) {
|
|
7964
|
+
const queue = [];
|
|
7965
|
+
callbacks = queue;
|
|
7966
|
+
pongCallbacks.set(ws, queue);
|
|
7967
|
+
ws.addEventListener("message", ({ data }) => {
|
|
7968
|
+
var _queue$shift;
|
|
7969
|
+
if (data === "PONG")
|
|
7970
|
+
(_queue$shift = queue.shift()) === null || _queue$shift === undefined || _queue$shift();
|
|
7971
|
+
});
|
|
7972
|
+
}
|
|
7973
|
+
callbacks.push(onPong);
|
|
7974
|
+
ws.send("PING");
|
|
7975
|
+
}
|
|
7979
7976
|
function setupPingInterval(ws, { intervalMs, pongTimeoutMs }) {
|
|
7980
7977
|
let pingTimeout;
|
|
7981
7978
|
let pongTimeout;
|
|
7982
7979
|
function start() {
|
|
7983
7980
|
pingTimeout = setTimeout(() => {
|
|
7984
|
-
ws
|
|
7981
|
+
sendPing(ws, null);
|
|
7985
7982
|
pongTimeout = setTimeout(() => {
|
|
7986
7983
|
ws.close();
|
|
7987
7984
|
}, pongTimeoutMs);
|
|
@@ -8075,7 +8072,15 @@ var WsConnection = class WsConnection {
|
|
|
8075
8072
|
};
|
|
8076
8073
|
_defineProperty(WsConnection, "connectCount", 0);
|
|
8077
8074
|
|
|
8078
|
-
// ../../../node_modules/.bun/@trpc+client@11.
|
|
8075
|
+
// ../../../node_modules/.bun/@trpc+client@11.25.2+73a9f6e6dedcb27f/node_modules/@trpc/client/dist/index.mjs
|
|
8076
|
+
var observerKeys = [
|
|
8077
|
+
"onStarted",
|
|
8078
|
+
"onData",
|
|
8079
|
+
"onError",
|
|
8080
|
+
"onStopped",
|
|
8081
|
+
"onComplete",
|
|
8082
|
+
"onConnectionStateChange"
|
|
8083
|
+
];
|
|
8079
8084
|
var TRPCUntypedClient = class {
|
|
8080
8085
|
constructor(opts) {
|
|
8081
8086
|
_defineProperty(this, "links", undefined);
|
|
@@ -8121,14 +8126,36 @@ var TRPCUntypedClient = class {
|
|
|
8121
8126
|
signal: opts === null || opts === undefined ? undefined : opts.signal
|
|
8122
8127
|
});
|
|
8123
8128
|
}
|
|
8124
|
-
subscription(path, input, opts) {
|
|
8125
|
-
|
|
8129
|
+
subscription(path, input, opts = {}) {
|
|
8130
|
+
const hasCallbacks = observerKeys.some((key) => typeof opts[key] === "function");
|
|
8131
|
+
const observable$ = this.$request({
|
|
8126
8132
|
type: "subscription",
|
|
8127
8133
|
path,
|
|
8128
8134
|
input,
|
|
8129
8135
|
context: opts.context,
|
|
8130
8136
|
signal: opts.signal
|
|
8131
|
-
})
|
|
8137
|
+
});
|
|
8138
|
+
if (!hasCallbacks) {
|
|
8139
|
+
var _opts$signal;
|
|
8140
|
+
const data$ = observable((observer) => observable$.subscribe({
|
|
8141
|
+
next(envelope) {
|
|
8142
|
+
if (envelope.result.type === "data" || envelope.result.type === undefined)
|
|
8143
|
+
observer.next(envelope.result.data);
|
|
8144
|
+
},
|
|
8145
|
+
error: (err) => observer.error(err),
|
|
8146
|
+
complete: () => observer.complete()
|
|
8147
|
+
}));
|
|
8148
|
+
const iterator = observableToAsyncIterable(data$, (_opts$signal = opts.signal) !== null && _opts$signal !== undefined ? _opts$signal : new AbortController().signal);
|
|
8149
|
+
let iterated = false;
|
|
8150
|
+
iterator[Symbol.asyncIterator] = () => {
|
|
8151
|
+
if (iterated)
|
|
8152
|
+
throw new Error("A subscription can only be iterated once. Call subscribe() again for another loop.");
|
|
8153
|
+
iterated = true;
|
|
8154
|
+
return iterator;
|
|
8155
|
+
};
|
|
8156
|
+
return iterator;
|
|
8157
|
+
}
|
|
8158
|
+
return observable$.subscribe({
|
|
8132
8159
|
next(envelope) {
|
|
8133
8160
|
switch (envelope.result.type) {
|
|
8134
8161
|
case "state":
|
|
@@ -8396,6 +8423,29 @@ var booleanFlags = new Set([
|
|
|
8396
8423
|
"public",
|
|
8397
8424
|
"version"
|
|
8398
8425
|
]);
|
|
8426
|
+
var recordFlag = (args, index, token, flags) => {
|
|
8427
|
+
const [rawName, inlineValue] = token.slice(2).split("=", 2);
|
|
8428
|
+
if (!rawName)
|
|
8429
|
+
throw new CliUsageError("Flag names cannot be empty.");
|
|
8430
|
+
if (booleanFlags.has(rawName)) {
|
|
8431
|
+
if (inlineValue !== undefined) {
|
|
8432
|
+
throw new CliUsageError(`--${rawName} is a bare flag and does not take a value.`);
|
|
8433
|
+
}
|
|
8434
|
+
flags.set(rawName, true);
|
|
8435
|
+
return index;
|
|
8436
|
+
}
|
|
8437
|
+
if (inlineValue !== undefined) {
|
|
8438
|
+
flags.set(rawName, inlineValue);
|
|
8439
|
+
return index;
|
|
8440
|
+
}
|
|
8441
|
+
const nextValue = args[index + 1];
|
|
8442
|
+
if (nextValue && !nextValue.startsWith("--")) {
|
|
8443
|
+
flags.set(rawName, nextValue);
|
|
8444
|
+
return index + 1;
|
|
8445
|
+
}
|
|
8446
|
+
flags.set(rawName, true);
|
|
8447
|
+
return index;
|
|
8448
|
+
};
|
|
8399
8449
|
var parseArguments = (args) => {
|
|
8400
8450
|
const positionals = [];
|
|
8401
8451
|
const flags = new Map;
|
|
@@ -8407,27 +8457,7 @@ var parseArguments = (args) => {
|
|
|
8407
8457
|
positionals.push(token);
|
|
8408
8458
|
continue;
|
|
8409
8459
|
}
|
|
8410
|
-
|
|
8411
|
-
if (!rawName)
|
|
8412
|
-
throw new CliUsageError("Flag names cannot be empty.");
|
|
8413
|
-
if (booleanFlags.has(rawName)) {
|
|
8414
|
-
if (inlineValue !== undefined) {
|
|
8415
|
-
throw new CliUsageError(`--${rawName} is a bare flag and does not take a value.`);
|
|
8416
|
-
}
|
|
8417
|
-
flags.set(rawName, true);
|
|
8418
|
-
continue;
|
|
8419
|
-
}
|
|
8420
|
-
if (inlineValue !== undefined) {
|
|
8421
|
-
flags.set(rawName, inlineValue);
|
|
8422
|
-
continue;
|
|
8423
|
-
}
|
|
8424
|
-
const nextValue = args[index + 1];
|
|
8425
|
-
if (nextValue && !nextValue.startsWith("--")) {
|
|
8426
|
-
flags.set(rawName, nextValue);
|
|
8427
|
-
index += 1;
|
|
8428
|
-
} else {
|
|
8429
|
-
flags.set(rawName, true);
|
|
8430
|
-
}
|
|
8460
|
+
index = recordFlag(args, index, token, flags);
|
|
8431
8461
|
}
|
|
8432
8462
|
return { positionals, flags };
|
|
8433
8463
|
};
|
|
@@ -8835,177 +8865,219 @@ var assertPrizesBelongToEvent = (prizes, prizeIds, eventId) => {
|
|
|
8835
8865
|
}
|
|
8836
8866
|
};
|
|
8837
8867
|
var saveConfig = (eventId, config) => api2.event.luckyDraw.updateLuckyDrawConfigJson.mutate({ eventId, config });
|
|
8838
|
-
var
|
|
8839
|
-
|
|
8840
|
-
|
|
8841
|
-
|
|
8842
|
-
|
|
8843
|
-
|
|
8844
|
-
|
|
8845
|
-
|
|
8846
|
-
|
|
8847
|
-
|
|
8848
|
-
|
|
8849
|
-
|
|
8850
|
-
|
|
8851
|
-
|
|
8852
|
-
|
|
8853
|
-
|
|
8854
|
-
|
|
8855
|
-
|
|
8856
|
-
|
|
8857
|
-
|
|
8858
|
-
|
|
8859
|
-
|
|
8860
|
-
|
|
8861
|
-
|
|
8862
|
-
|
|
8863
|
-
|
|
8864
|
-
|
|
8865
|
-
return true;
|
|
8866
|
-
}
|
|
8867
|
-
if (action === "background" && subAction === "upload") {
|
|
8868
|
-
assertPositionalCount(parsed, 3);
|
|
8869
|
-
assertOnlyFlags(parsed, ["event-id", "file", "content-type"]);
|
|
8870
|
-
const eventId = getRequiredFlag(parsed, "event-id");
|
|
8871
|
-
const filePath = getRequiredFlag(parsed, "file");
|
|
8872
|
-
const contentType = getRequiredFlag(parsed, "content-type");
|
|
8873
|
-
if (!contentType.startsWith("image/")) {
|
|
8874
|
-
throw new CliUsageError("--content-type must be an image MIME type.");
|
|
8875
|
-
}
|
|
8876
|
-
let file;
|
|
8877
|
-
try {
|
|
8878
|
-
file = await readFile3(filePath);
|
|
8879
|
-
} catch {
|
|
8880
|
-
throw new CliUsageError("--file could not be read.");
|
|
8881
|
-
}
|
|
8882
|
-
await authenticate();
|
|
8883
|
-
const signed = await api2.attachment.getPresignedUrlToUpload.mutate({
|
|
8884
|
-
folder: LUCKY_DRAW_BACKGROUND_FOLDER,
|
|
8885
|
-
fileName: basename(filePath),
|
|
8886
|
-
contentType,
|
|
8887
|
-
size: file.byteLength,
|
|
8888
|
-
eventId
|
|
8889
|
-
});
|
|
8890
|
-
const uploadResponse = await fetch(signed.uploadUrl, {
|
|
8891
|
-
method: "PUT",
|
|
8892
|
-
headers: { "content-type": contentType },
|
|
8893
|
-
body: file
|
|
8894
|
-
});
|
|
8895
|
-
if (!uploadResponse.ok) {
|
|
8896
|
-
throw new Error(`Lucky draw background upload failed with HTTP ${uploadResponse.status}.`);
|
|
8897
|
-
}
|
|
8898
|
-
const config = mergeLuckyDrawConfig(await loadCurrentConfig(eventId), {
|
|
8899
|
-
customBackgroundImage: signed.key
|
|
8900
|
-
});
|
|
8901
|
-
await saveConfig(eventId, config);
|
|
8902
|
-
writeSuccess(runtime, await api2.event.luckyDraw.getLuckyDrawByEventId.query({ eventId }));
|
|
8903
|
-
return true;
|
|
8904
|
-
}
|
|
8905
|
-
if (action === "background" && subAction === "clear") {
|
|
8906
|
-
assertPositionalCount(parsed, 3);
|
|
8907
|
-
assertOnlyFlags(parsed, ["event-id", "allow-state-change", "target"]);
|
|
8908
|
-
const eventId = getRequiredFlag(parsed, "event-id");
|
|
8909
|
-
assertStateChangeTarget(parsed, eventId);
|
|
8910
|
-
await authenticate();
|
|
8911
|
-
const config = mergeLuckyDrawConfig(await loadCurrentConfig(eventId), {
|
|
8912
|
-
customBackgroundImage: null
|
|
8868
|
+
var runConfigGet = async ({
|
|
8869
|
+
parsed,
|
|
8870
|
+
runtime,
|
|
8871
|
+
authenticate
|
|
8872
|
+
}) => {
|
|
8873
|
+
assertPositionalCount(parsed, 3);
|
|
8874
|
+
assertOnlyFlags(parsed, ["event-id"]);
|
|
8875
|
+
const eventId = getRequiredFlag(parsed, "event-id");
|
|
8876
|
+
await authenticate();
|
|
8877
|
+
writeSuccess(runtime, await api2.event.luckyDraw.getLuckyDrawByEventId.query({ eventId }));
|
|
8878
|
+
};
|
|
8879
|
+
var runConfigUpdate = async ({
|
|
8880
|
+
parsed,
|
|
8881
|
+
runtime,
|
|
8882
|
+
authenticate
|
|
8883
|
+
}) => {
|
|
8884
|
+
assertPositionalCount(parsed, 3);
|
|
8885
|
+
assertOnlyFlags(parsed, ["event-id", "config", "config-file", "dry-run"]);
|
|
8886
|
+
const eventId = getRequiredFlag(parsed, "event-id");
|
|
8887
|
+
const patch = parseLuckyDrawConfigPatch(await readInlineOrFile(parsed, "config", "config-file"));
|
|
8888
|
+
await authenticate();
|
|
8889
|
+
const config = mergeLuckyDrawConfig(await loadCurrentConfig(eventId), patch);
|
|
8890
|
+
if (parsed.flags.get("dry-run") === true) {
|
|
8891
|
+
writeSuccess(runtime, {
|
|
8892
|
+
dryRun: true,
|
|
8893
|
+
changedFields: Object.keys(patch).sort(),
|
|
8894
|
+
config
|
|
8913
8895
|
});
|
|
8914
|
-
|
|
8915
|
-
return true;
|
|
8916
|
-
}
|
|
8917
|
-
if (action === "prizes" && subAction === "list") {
|
|
8918
|
-
assertPositionalCount(parsed, 3);
|
|
8919
|
-
assertOnlyFlags(parsed, ["event-id"]);
|
|
8920
|
-
const eventId = getRequiredFlag(parsed, "event-id");
|
|
8921
|
-
await authenticate();
|
|
8922
|
-
writeSuccess(runtime, await api2.event.luckyDraw.getLuckyDrawPrizesByEventId.query({ eventId }));
|
|
8923
|
-
return true;
|
|
8924
|
-
}
|
|
8925
|
-
if (action === "prizes" && subAction === "create") {
|
|
8926
|
-
assertPositionalCount(parsed, 3);
|
|
8927
|
-
assertOnlyFlags(parsed, [
|
|
8928
|
-
"event-id",
|
|
8929
|
-
"name",
|
|
8930
|
-
"description",
|
|
8931
|
-
"prizes",
|
|
8932
|
-
"prizes-file"
|
|
8933
|
-
]);
|
|
8934
|
-
const eventId = getRequiredFlag(parsed, "event-id");
|
|
8935
|
-
const name = getOptionalFlag(parsed, "name");
|
|
8936
|
-
const description = getOptionalFlag(parsed, "description");
|
|
8937
|
-
const hasList = parsed.flags.has("prizes") || parsed.flags.has("prizes-file");
|
|
8938
|
-
if (hasList === (name !== undefined)) {
|
|
8939
|
-
throw new CliUsageError("Provide either --name [--description] or one of --prizes / --prizes-file.");
|
|
8940
|
-
}
|
|
8941
|
-
if (hasList && description !== undefined) {
|
|
8942
|
-
throw new CliUsageError("--description is only valid with --name; include descriptions in the --prizes JSON.");
|
|
8943
|
-
}
|
|
8944
|
-
const prizes = hasList ? parsePrizeList(await readInlineOrFile(parsed, "prizes", "prizes-file")) : parsePrizeList(JSON.stringify([
|
|
8945
|
-
{ name, ...description === undefined ? {} : { description } }
|
|
8946
|
-
]));
|
|
8947
|
-
await authenticate();
|
|
8948
|
-
writeSuccess(runtime, await api2.event.luckyDraw.createLuckyDrawPrize.mutate({
|
|
8949
|
-
eventId,
|
|
8950
|
-
prizes
|
|
8951
|
-
}));
|
|
8952
|
-
return true;
|
|
8896
|
+
return;
|
|
8953
8897
|
}
|
|
8954
|
-
|
|
8955
|
-
|
|
8956
|
-
|
|
8957
|
-
|
|
8958
|
-
|
|
8959
|
-
|
|
8960
|
-
|
|
8961
|
-
|
|
8962
|
-
|
|
8963
|
-
|
|
8964
|
-
|
|
8965
|
-
|
|
8966
|
-
|
|
8967
|
-
|
|
8968
|
-
|
|
8898
|
+
writeSuccess(runtime, await saveConfig(eventId, config));
|
|
8899
|
+
};
|
|
8900
|
+
var runBackgroundUpload = async ({
|
|
8901
|
+
parsed,
|
|
8902
|
+
runtime,
|
|
8903
|
+
authenticate
|
|
8904
|
+
}) => {
|
|
8905
|
+
assertPositionalCount(parsed, 3);
|
|
8906
|
+
assertOnlyFlags(parsed, ["event-id", "file", "content-type"]);
|
|
8907
|
+
const eventId = getRequiredFlag(parsed, "event-id");
|
|
8908
|
+
const filePath = getRequiredFlag(parsed, "file");
|
|
8909
|
+
const contentType = getRequiredFlag(parsed, "content-type");
|
|
8910
|
+
if (!contentType.startsWith("image/")) {
|
|
8911
|
+
throw new CliUsageError("--content-type must be an image MIME type.");
|
|
8912
|
+
}
|
|
8913
|
+
let file;
|
|
8914
|
+
try {
|
|
8915
|
+
file = await readFile3(filePath);
|
|
8916
|
+
} catch {
|
|
8917
|
+
throw new CliUsageError("--file could not be read.");
|
|
8969
8918
|
}
|
|
8970
|
-
|
|
8971
|
-
|
|
8972
|
-
|
|
8973
|
-
|
|
8974
|
-
|
|
8975
|
-
|
|
8976
|
-
|
|
8977
|
-
|
|
8978
|
-
|
|
8979
|
-
|
|
8980
|
-
|
|
8981
|
-
|
|
8982
|
-
|
|
8983
|
-
|
|
8984
|
-
|
|
8919
|
+
await authenticate();
|
|
8920
|
+
const signed = await api2.attachment.getPresignedUrlToUpload.mutate({
|
|
8921
|
+
folder: LUCKY_DRAW_BACKGROUND_FOLDER,
|
|
8922
|
+
fileName: basename(filePath),
|
|
8923
|
+
contentType,
|
|
8924
|
+
size: file.byteLength,
|
|
8925
|
+
eventId
|
|
8926
|
+
});
|
|
8927
|
+
const uploadResponse = await fetch(signed.uploadUrl, {
|
|
8928
|
+
method: "PUT",
|
|
8929
|
+
headers: { "content-type": contentType },
|
|
8930
|
+
body: file
|
|
8931
|
+
});
|
|
8932
|
+
if (!uploadResponse.ok) {
|
|
8933
|
+
throw new Error(`Lucky draw background upload failed with HTTP ${uploadResponse.status}.`);
|
|
8985
8934
|
}
|
|
8986
|
-
|
|
8987
|
-
|
|
8988
|
-
|
|
8989
|
-
|
|
8990
|
-
|
|
8991
|
-
|
|
8992
|
-
|
|
8993
|
-
|
|
8994
|
-
|
|
8995
|
-
|
|
8996
|
-
|
|
8997
|
-
|
|
8998
|
-
|
|
8999
|
-
|
|
9000
|
-
|
|
9001
|
-
|
|
9002
|
-
|
|
9003
|
-
|
|
9004
|
-
|
|
9005
|
-
|
|
9006
|
-
|
|
8935
|
+
const config = mergeLuckyDrawConfig(await loadCurrentConfig(eventId), {
|
|
8936
|
+
customBackgroundImage: signed.key
|
|
8937
|
+
});
|
|
8938
|
+
await saveConfig(eventId, config);
|
|
8939
|
+
writeSuccess(runtime, await api2.event.luckyDraw.getLuckyDrawByEventId.query({ eventId }));
|
|
8940
|
+
};
|
|
8941
|
+
var runBackgroundClear = async ({
|
|
8942
|
+
parsed,
|
|
8943
|
+
runtime,
|
|
8944
|
+
authenticate
|
|
8945
|
+
}) => {
|
|
8946
|
+
assertPositionalCount(parsed, 3);
|
|
8947
|
+
assertOnlyFlags(parsed, ["event-id", "allow-state-change", "target"]);
|
|
8948
|
+
const eventId = getRequiredFlag(parsed, "event-id");
|
|
8949
|
+
assertStateChangeTarget(parsed, eventId);
|
|
8950
|
+
await authenticate();
|
|
8951
|
+
const config = mergeLuckyDrawConfig(await loadCurrentConfig(eventId), {
|
|
8952
|
+
customBackgroundImage: null
|
|
8953
|
+
});
|
|
8954
|
+
writeSuccess(runtime, await saveConfig(eventId, config));
|
|
8955
|
+
};
|
|
8956
|
+
var runPrizesList = async ({
|
|
8957
|
+
parsed,
|
|
8958
|
+
runtime,
|
|
8959
|
+
authenticate
|
|
8960
|
+
}) => {
|
|
8961
|
+
assertPositionalCount(parsed, 3);
|
|
8962
|
+
assertOnlyFlags(parsed, ["event-id"]);
|
|
8963
|
+
const eventId = getRequiredFlag(parsed, "event-id");
|
|
8964
|
+
await authenticate();
|
|
8965
|
+
writeSuccess(runtime, await api2.event.luckyDraw.getLuckyDrawPrizesByEventId.query({ eventId }));
|
|
8966
|
+
};
|
|
8967
|
+
var runPrizesCreate = async ({
|
|
8968
|
+
parsed,
|
|
8969
|
+
runtime,
|
|
8970
|
+
authenticate
|
|
8971
|
+
}) => {
|
|
8972
|
+
assertPositionalCount(parsed, 3);
|
|
8973
|
+
assertOnlyFlags(parsed, [
|
|
8974
|
+
"event-id",
|
|
8975
|
+
"name",
|
|
8976
|
+
"description",
|
|
8977
|
+
"prizes",
|
|
8978
|
+
"prizes-file"
|
|
8979
|
+
]);
|
|
8980
|
+
const eventId = getRequiredFlag(parsed, "event-id");
|
|
8981
|
+
const name = getOptionalFlag(parsed, "name");
|
|
8982
|
+
const description = getOptionalFlag(parsed, "description");
|
|
8983
|
+
const hasList = parsed.flags.has("prizes") || parsed.flags.has("prizes-file");
|
|
8984
|
+
if (hasList === (name !== undefined)) {
|
|
8985
|
+
throw new CliUsageError("Provide either --name [--description] or one of --prizes / --prizes-file.");
|
|
8986
|
+
}
|
|
8987
|
+
if (hasList && description !== undefined) {
|
|
8988
|
+
throw new CliUsageError("--description is only valid with --name; include descriptions in the --prizes JSON.");
|
|
8989
|
+
}
|
|
8990
|
+
const prizes = hasList ? parsePrizeList(await readInlineOrFile(parsed, "prizes", "prizes-file")) : parsePrizeList(JSON.stringify([
|
|
8991
|
+
{ name, ...description === undefined ? {} : { description } }
|
|
8992
|
+
]));
|
|
8993
|
+
await authenticate();
|
|
8994
|
+
writeSuccess(runtime, await api2.event.luckyDraw.createLuckyDrawPrize.mutate({
|
|
8995
|
+
eventId,
|
|
8996
|
+
prizes
|
|
8997
|
+
}));
|
|
8998
|
+
};
|
|
8999
|
+
var runPrizesUpdate = async ({
|
|
9000
|
+
parsed,
|
|
9001
|
+
runtime,
|
|
9002
|
+
authenticate
|
|
9003
|
+
}) => {
|
|
9004
|
+
assertPositionalCount(parsed, 3);
|
|
9005
|
+
assertOnlyFlags(parsed, ["event-id", "prize-id", "name", "description"]);
|
|
9006
|
+
const eventId = getRequiredFlag(parsed, "event-id");
|
|
9007
|
+
const prizeId = getRequiredFlag(parsed, "prize-id");
|
|
9008
|
+
const name = getRequiredFlag(parsed, "name");
|
|
9009
|
+
const description = getOptionalFlag(parsed, "description");
|
|
9010
|
+
await authenticate();
|
|
9011
|
+
assertPrizesBelongToEvent(await loadPrizes(eventId), [prizeId], eventId);
|
|
9012
|
+
writeSuccess(runtime, await api2.event.luckyDraw.updateLuckyDrawPrize.mutate({
|
|
9013
|
+
id: prizeId,
|
|
9014
|
+
name,
|
|
9015
|
+
...description === undefined ? {} : { description }
|
|
9016
|
+
}));
|
|
9017
|
+
};
|
|
9018
|
+
var runPrizesDelete = async ({
|
|
9019
|
+
parsed,
|
|
9020
|
+
runtime,
|
|
9021
|
+
authenticate
|
|
9022
|
+
}) => {
|
|
9023
|
+
assertPositionalCount(parsed, 3);
|
|
9024
|
+
assertOnlyFlags(parsed, [
|
|
9025
|
+
"event-id",
|
|
9026
|
+
"prize-ids",
|
|
9027
|
+
"allow-state-change",
|
|
9028
|
+
"target"
|
|
9029
|
+
]);
|
|
9030
|
+
const eventId = getRequiredFlag(parsed, "event-id");
|
|
9031
|
+
const prizeIds = parseIdList(getRequiredFlag(parsed, "prize-ids"), "prize-ids");
|
|
9032
|
+
assertStateChangeTarget(parsed, eventId);
|
|
9033
|
+
await authenticate();
|
|
9034
|
+
assertPrizesBelongToEvent(await loadPrizes(eventId), prizeIds, eventId);
|
|
9035
|
+
writeSuccess(runtime, await api2.event.luckyDraw.deleteLuckyDrawPrize.mutate({ prizeIds }));
|
|
9036
|
+
};
|
|
9037
|
+
var runPrizesReorder = async ({
|
|
9038
|
+
parsed,
|
|
9039
|
+
runtime,
|
|
9040
|
+
authenticate
|
|
9041
|
+
}) => {
|
|
9042
|
+
assertPositionalCount(parsed, 3);
|
|
9043
|
+
assertOnlyFlags(parsed, ["event-id", "prize-ids"]);
|
|
9044
|
+
const eventId = getRequiredFlag(parsed, "event-id");
|
|
9045
|
+
const prizeIds = parseIdList(getRequiredFlag(parsed, "prize-ids"), "prize-ids");
|
|
9046
|
+
await authenticate();
|
|
9047
|
+
const prizes = await loadPrizes(eventId);
|
|
9048
|
+
assertPrizesBelongToEvent(prizes, prizeIds, eventId);
|
|
9049
|
+
if (prizeIds.length !== prizes.length) {
|
|
9050
|
+
throw new CliUsageError(`--prize-ids must list all ${prizes.length} active prizes in the new order.`);
|
|
9007
9051
|
}
|
|
9008
|
-
|
|
9052
|
+
const namesById = new Map(prizes.map((prize) => [prize.id, prize.name]));
|
|
9053
|
+
writeSuccess(runtime, await api2.event.luckyDraw.updateLuckyDrawPrizesOrder.mutate({
|
|
9054
|
+
eventId,
|
|
9055
|
+
prizes: prizeIds.map((id, order) => ({
|
|
9056
|
+
id,
|
|
9057
|
+
order,
|
|
9058
|
+
name: namesById.get(id) ?? ""
|
|
9059
|
+
}))
|
|
9060
|
+
}));
|
|
9061
|
+
};
|
|
9062
|
+
var LUCKY_DRAW_SETUP_HANDLERS = new Map([
|
|
9063
|
+
["config get", runConfigGet],
|
|
9064
|
+
["config update", runConfigUpdate],
|
|
9065
|
+
["background upload", runBackgroundUpload],
|
|
9066
|
+
["background clear", runBackgroundClear],
|
|
9067
|
+
["prizes list", runPrizesList],
|
|
9068
|
+
["prizes create", runPrizesCreate],
|
|
9069
|
+
["prizes update", runPrizesUpdate],
|
|
9070
|
+
["prizes delete", runPrizesDelete],
|
|
9071
|
+
["prizes reorder", runPrizesReorder]
|
|
9072
|
+
]);
|
|
9073
|
+
var runLuckyDrawSetupCommand = async (input) => {
|
|
9074
|
+
const { parsed, runtime, authenticate } = input;
|
|
9075
|
+
const [, action, subAction] = parsed.positionals;
|
|
9076
|
+
const handler = LUCKY_DRAW_SETUP_HANDLERS.get(`${action} ${subAction}`);
|
|
9077
|
+
if (!handler)
|
|
9078
|
+
return false;
|
|
9079
|
+
await handler({ parsed, runtime, authenticate });
|
|
9080
|
+
return true;
|
|
9009
9081
|
};
|
|
9010
9082
|
|
|
9011
9083
|
// ../validators/src/event-passport/passport-input.schema.ts
|
|
@@ -9267,6 +9339,56 @@ var date3 = (value, name) => {
|
|
|
9267
9339
|
throw new CliUsageError(`${name} must be a valid ISO date-time.`);
|
|
9268
9340
|
return parsed;
|
|
9269
9341
|
};
|
|
9342
|
+
var parseStaffTallyCollection = (item, extras) => {
|
|
9343
|
+
keys(item, [
|
|
9344
|
+
"collectionMode",
|
|
9345
|
+
"tallyItems",
|
|
9346
|
+
"tallyEarnsStamp",
|
|
9347
|
+
"stampValue",
|
|
9348
|
+
"category"
|
|
9349
|
+
], "collection");
|
|
9350
|
+
if (!Array.isArray(item.tallyItems))
|
|
9351
|
+
throw new CliUsageError("tallyItems must be an array of item names.");
|
|
9352
|
+
if (item.tallyItems.length < 1 || item.tallyItems.length > 30)
|
|
9353
|
+
throw new CliUsageError("tallyItems must have 1 to 30 items.");
|
|
9354
|
+
const tallyItems = item.tallyItems.map((name, index) => text(name, `tallyItems[${index}]`, 60));
|
|
9355
|
+
if (new Set(tallyItems.map((name) => name.toLocaleLowerCase())).size !== tallyItems.length)
|
|
9356
|
+
throw new CliUsageError("tallyItems must be unique ignoring case.");
|
|
9357
|
+
if (item.tallyEarnsStamp !== undefined && typeof item.tallyEarnsStamp !== "boolean")
|
|
9358
|
+
throw new CliUsageError("tallyEarnsStamp must be true or false.");
|
|
9359
|
+
return {
|
|
9360
|
+
collectionMode: "STAFF_TALLY",
|
|
9361
|
+
tallyItems,
|
|
9362
|
+
tallyEarnsStamp: item.tallyEarnsStamp === true,
|
|
9363
|
+
...extras
|
|
9364
|
+
};
|
|
9365
|
+
};
|
|
9366
|
+
var parsePassportCollection = (raw) => {
|
|
9367
|
+
const item = object2(raw, "collection");
|
|
9368
|
+
const stampValue = item.stampValue === undefined ? {} : { stampValue: integer2(item.stampValue, "stampValue", 0, 1000) };
|
|
9369
|
+
const category = item.category === undefined ? {} : { category: stationCategory(item.category) };
|
|
9370
|
+
if (item.collectionMode === "STAFF_SCORE") {
|
|
9371
|
+
keys(item, ["collectionMode", "maxPoints", "stampValue", "category"], "collection");
|
|
9372
|
+
return {
|
|
9373
|
+
collectionMode: "STAFF_SCORE",
|
|
9374
|
+
maxPoints: integer2(item.maxPoints, "maxPoints"),
|
|
9375
|
+
...stampValue,
|
|
9376
|
+
...category
|
|
9377
|
+
};
|
|
9378
|
+
}
|
|
9379
|
+
if (item.collectionMode === "STAFF_TALLY") {
|
|
9380
|
+
return parseStaffTallyCollection(item, { ...stampValue, ...category });
|
|
9381
|
+
}
|
|
9382
|
+
if (item.collectionMode === "SELF_SCAN" || item.collectionMode === "STAFF_SCAN") {
|
|
9383
|
+
keys(item, ["collectionMode", "stampValue", "category"], "collection");
|
|
9384
|
+
return {
|
|
9385
|
+
collectionMode: item.collectionMode,
|
|
9386
|
+
...stampValue,
|
|
9387
|
+
...category
|
|
9388
|
+
};
|
|
9389
|
+
}
|
|
9390
|
+
throw new CliUsageError("collectionMode must be SELF_SCAN, STAFF_SCAN, STAFF_SCORE or STAFF_TALLY.");
|
|
9391
|
+
};
|
|
9270
9392
|
var parsePassportStationInput = (raw, eventId) => {
|
|
9271
9393
|
const value = json(raw, "--station-json");
|
|
9272
9394
|
keys(value, [
|
|
@@ -9280,53 +9402,7 @@ var parsePassportStationInput = (raw, eventId) => {
|
|
|
9280
9402
|
"closesAt",
|
|
9281
9403
|
"collection"
|
|
9282
9404
|
], "Station");
|
|
9283
|
-
|
|
9284
|
-
if (value.collection !== undefined) {
|
|
9285
|
-
const item = object2(value.collection, "collection");
|
|
9286
|
-
const stampValue = item.stampValue === undefined ? {} : { stampValue: integer2(item.stampValue, "stampValue", 0, 1000) };
|
|
9287
|
-
const category = item.category === undefined ? {} : { category: stationCategory(item.category) };
|
|
9288
|
-
if (item.collectionMode === "STAFF_SCORE") {
|
|
9289
|
-
keys(item, ["collectionMode", "maxPoints", "stampValue", "category"], "collection");
|
|
9290
|
-
collection = {
|
|
9291
|
-
collectionMode: "STAFF_SCORE",
|
|
9292
|
-
maxPoints: integer2(item.maxPoints, "maxPoints"),
|
|
9293
|
-
...stampValue,
|
|
9294
|
-
...category
|
|
9295
|
-
};
|
|
9296
|
-
} else if (item.collectionMode === "STAFF_TALLY") {
|
|
9297
|
-
keys(item, [
|
|
9298
|
-
"collectionMode",
|
|
9299
|
-
"tallyItems",
|
|
9300
|
-
"tallyEarnsStamp",
|
|
9301
|
-
"stampValue",
|
|
9302
|
-
"category"
|
|
9303
|
-
], "collection");
|
|
9304
|
-
if (!Array.isArray(item.tallyItems))
|
|
9305
|
-
throw new CliUsageError("tallyItems must be an array of item names.");
|
|
9306
|
-
if (item.tallyItems.length < 1 || item.tallyItems.length > 30)
|
|
9307
|
-
throw new CliUsageError("tallyItems must have 1 to 30 items.");
|
|
9308
|
-
const tallyItems = item.tallyItems.map((name, index) => text(name, `tallyItems[${index}]`, 60));
|
|
9309
|
-
if (new Set(tallyItems.map((name) => name.toLocaleLowerCase())).size !== tallyItems.length)
|
|
9310
|
-
throw new CliUsageError("tallyItems must be unique ignoring case.");
|
|
9311
|
-
if (item.tallyEarnsStamp !== undefined && typeof item.tallyEarnsStamp !== "boolean")
|
|
9312
|
-
throw new CliUsageError("tallyEarnsStamp must be true or false.");
|
|
9313
|
-
collection = {
|
|
9314
|
-
collectionMode: "STAFF_TALLY",
|
|
9315
|
-
tallyItems,
|
|
9316
|
-
tallyEarnsStamp: item.tallyEarnsStamp === true,
|
|
9317
|
-
...stampValue,
|
|
9318
|
-
...category
|
|
9319
|
-
};
|
|
9320
|
-
} else if (item.collectionMode === "SELF_SCAN" || item.collectionMode === "STAFF_SCAN") {
|
|
9321
|
-
keys(item, ["collectionMode", "stampValue", "category"], "collection");
|
|
9322
|
-
collection = {
|
|
9323
|
-
collectionMode: item.collectionMode,
|
|
9324
|
-
...stampValue,
|
|
9325
|
-
...category
|
|
9326
|
-
};
|
|
9327
|
-
} else
|
|
9328
|
-
throw new CliUsageError("collectionMode must be SELF_SCAN, STAFF_SCAN, STAFF_SCORE or STAFF_TALLY.");
|
|
9329
|
-
}
|
|
9405
|
+
const collection = value.collection === undefined ? undefined : parsePassportCollection(value.collection);
|
|
9330
9406
|
return {
|
|
9331
9407
|
eventId,
|
|
9332
9408
|
...value.id === undefined ? {} : { id: text(value.id, "id", 200) },
|
|
@@ -9375,6 +9451,7 @@ var parsePassportSettingsInput = (raw, eventId) => {
|
|
|
9375
9451
|
...loginMethods ? { loginMethods } : {}
|
|
9376
9452
|
};
|
|
9377
9453
|
};
|
|
9454
|
+
var optionalEntry = (key, value, parse) => value === undefined ? {} : { [key]: parse(value) };
|
|
9378
9455
|
var runPassportCommand = async (input) => {
|
|
9379
9456
|
const { flags, positionals } = input;
|
|
9380
9457
|
const action = positionals.slice(1).join(" ");
|
|
@@ -9478,7 +9555,7 @@ var runPassportCommand = async (input) => {
|
|
|
9478
9555
|
const payload = {
|
|
9479
9556
|
...station(),
|
|
9480
9557
|
profileCode: requiredFlag(flags, "profile-code"),
|
|
9481
|
-
...points
|
|
9558
|
+
...optionalEntry("points", points, (raw) => integer2(raw, "--points"))
|
|
9482
9559
|
};
|
|
9483
9560
|
operation = () => api2.event.passport.collectPassportStampByStaff.mutate(payload);
|
|
9484
9561
|
break;
|
|
@@ -9498,7 +9575,7 @@ var runPassportCommand = async (input) => {
|
|
|
9498
9575
|
participantId: requiredFlag(flags, "participant-id"),
|
|
9499
9576
|
stamped: boolean3(requiredFlag(flags, "stamped"), "--stamped"),
|
|
9500
9577
|
reason: requiredFlag(flags, "reason"),
|
|
9501
|
-
...points
|
|
9578
|
+
...optionalEntry("points", points, (raw) => integer2(raw, "--points"))
|
|
9502
9579
|
};
|
|
9503
9580
|
operation = () => api2.event.passport.correctPassportStamp.mutate(payload);
|
|
9504
9581
|
break;
|
|
@@ -9524,11 +9601,11 @@ var runPassportCommand = async (input) => {
|
|
|
9524
9601
|
keys(value, ["id", "name", "description", "stock", "stampCost", "order"], "Prize");
|
|
9525
9602
|
const payload = {
|
|
9526
9603
|
eventId,
|
|
9527
|
-
...value.id
|
|
9604
|
+
...optionalEntry("id", value.id, (raw) => text(raw, "id", 200)),
|
|
9528
9605
|
name: text(value.name, "name", 100),
|
|
9529
9606
|
description: nullableText(value.description, "description", 1000),
|
|
9530
9607
|
stock: integer2(value.stock, "stock"),
|
|
9531
|
-
...value.stampCost
|
|
9608
|
+
...optionalEntry("stampCost", value.stampCost, (raw) => integer2(raw, "stampCost", 0, 1e5)),
|
|
9532
9609
|
order: integer2(value.order ?? 0, "order")
|
|
9533
9610
|
};
|
|
9534
9611
|
operation = () => api2.event.passport.upsertPassportPrize.mutate(payload);
|
|
@@ -9546,7 +9623,7 @@ var runPassportCommand = async (input) => {
|
|
|
9546
9623
|
const quantity = flag(flags, "quantity", false);
|
|
9547
9624
|
const payload = {
|
|
9548
9625
|
eventId,
|
|
9549
|
-
...quantity
|
|
9626
|
+
...optionalEntry("quantity", quantity, (raw) => integer2(raw, "--quantity", 1, 20)),
|
|
9550
9627
|
prizeId: requiredFlag(flags, "prize-id"),
|
|
9551
9628
|
participantId: requiredFlag(flags, "participant-id")
|
|
9552
9629
|
};
|
|
@@ -9571,7 +9648,7 @@ var runPassportCommand = async (input) => {
|
|
|
9571
9648
|
...station(),
|
|
9572
9649
|
profileCode: requiredFlag(flags, "profile-code"),
|
|
9573
9650
|
item: requiredFlag(flags, "item"),
|
|
9574
|
-
...quantity
|
|
9651
|
+
...optionalEntry("quantity", quantity, (raw) => integer2(raw, "--quantity", 1, 20))
|
|
9575
9652
|
};
|
|
9576
9653
|
operation = () => api2.event.passport.recordPassportTally.mutate(payload);
|
|
9577
9654
|
break;
|
|
@@ -13081,6 +13158,36 @@ var parseRetainedIds = (value) => {
|
|
|
13081
13158
|
return parsed;
|
|
13082
13159
|
};
|
|
13083
13160
|
var luckyDrawParticipantFields = new Set(["email", "luckyDrawId", "name"]);
|
|
13161
|
+
var asParticipantRecord = (participant, index) => {
|
|
13162
|
+
if (typeof participant !== "object" || participant === null || Array.isArray(participant)) {
|
|
13163
|
+
throw new CliUsageError(`--participants[${index}] must be an object.`);
|
|
13164
|
+
}
|
|
13165
|
+
if (Object.keys(participant).some((key) => !luckyDrawParticipantFields.has(key))) {
|
|
13166
|
+
throw new CliUsageError(`--participants[${index}] contains an unsupported field.`);
|
|
13167
|
+
}
|
|
13168
|
+
return participant;
|
|
13169
|
+
};
|
|
13170
|
+
var readParticipantField = (participant, key) => (key in participant) ? participant[key] : undefined;
|
|
13171
|
+
var parseLuckyDrawParticipant = (participant, index) => {
|
|
13172
|
+
const record = asParticipantRecord(participant, index);
|
|
13173
|
+
const luckyDrawId = readParticipantField(record, "luckyDrawId");
|
|
13174
|
+
const name = readParticipantField(record, "name");
|
|
13175
|
+
const email = readParticipantField(record, "email");
|
|
13176
|
+
if (typeof luckyDrawId !== "string") {
|
|
13177
|
+
throw new CliUsageError(`--participants[${index}].luckyDrawId must be a string.`);
|
|
13178
|
+
}
|
|
13179
|
+
if (name !== undefined && typeof name !== "string") {
|
|
13180
|
+
throw new CliUsageError(`--participants[${index}].name must be a string.`);
|
|
13181
|
+
}
|
|
13182
|
+
if (email !== undefined && email !== null && typeof email !== "string") {
|
|
13183
|
+
throw new CliUsageError(`--participants[${index}].email must be a string or null.`);
|
|
13184
|
+
}
|
|
13185
|
+
return {
|
|
13186
|
+
luckyDrawId,
|
|
13187
|
+
...name === undefined ? {} : { name },
|
|
13188
|
+
...email === undefined ? {} : { email }
|
|
13189
|
+
};
|
|
13190
|
+
};
|
|
13084
13191
|
var parseLuckyDrawParticipants = (value) => {
|
|
13085
13192
|
let parsed;
|
|
13086
13193
|
try {
|
|
@@ -13091,31 +13198,7 @@ var parseLuckyDrawParticipants = (value) => {
|
|
|
13091
13198
|
if (!Array.isArray(parsed)) {
|
|
13092
13199
|
throw new CliUsageError("--participants must be a JSON array.");
|
|
13093
13200
|
}
|
|
13094
|
-
return parsed.map(
|
|
13095
|
-
if (typeof participant !== "object" || participant === null || Array.isArray(participant)) {
|
|
13096
|
-
throw new CliUsageError(`--participants[${index}] must be an object.`);
|
|
13097
|
-
}
|
|
13098
|
-
if (Object.keys(participant).some((key) => !luckyDrawParticipantFields.has(key))) {
|
|
13099
|
-
throw new CliUsageError(`--participants[${index}] contains an unsupported field.`);
|
|
13100
|
-
}
|
|
13101
|
-
const luckyDrawId = "luckyDrawId" in participant ? participant.luckyDrawId : undefined;
|
|
13102
|
-
const name = "name" in participant ? participant.name : undefined;
|
|
13103
|
-
const email = "email" in participant ? participant.email : undefined;
|
|
13104
|
-
if (typeof luckyDrawId !== "string") {
|
|
13105
|
-
throw new CliUsageError(`--participants[${index}].luckyDrawId must be a string.`);
|
|
13106
|
-
}
|
|
13107
|
-
if (name !== undefined && typeof name !== "string") {
|
|
13108
|
-
throw new CliUsageError(`--participants[${index}].name must be a string.`);
|
|
13109
|
-
}
|
|
13110
|
-
if (email !== undefined && email !== null && typeof email !== "string") {
|
|
13111
|
-
throw new CliUsageError(`--participants[${index}].email must be a string or null.`);
|
|
13112
|
-
}
|
|
13113
|
-
return {
|
|
13114
|
-
luckyDrawId,
|
|
13115
|
-
...name === undefined ? {} : { name },
|
|
13116
|
-
...email === undefined ? {} : { email }
|
|
13117
|
-
};
|
|
13118
|
-
});
|
|
13201
|
+
return parsed.map(parseLuckyDrawParticipant);
|
|
13119
13202
|
};
|
|
13120
13203
|
var parseAppearanceMediaType = (value) => {
|
|
13121
13204
|
if (value === "image" || value === "video")
|
|
@@ -13163,6 +13246,361 @@ var parseIsoDateTime = (value, name) => {
|
|
|
13163
13246
|
}
|
|
13164
13247
|
return parsed;
|
|
13165
13248
|
};
|
|
13249
|
+
var commandKey = (action, subAction) => JSON.stringify([action ?? null, subAction ?? null]);
|
|
13250
|
+
var runAuthLogin = async ({
|
|
13251
|
+
parsed,
|
|
13252
|
+
runtime,
|
|
13253
|
+
credentialStore,
|
|
13254
|
+
apiBaseUrl,
|
|
13255
|
+
cliVersion
|
|
13256
|
+
}) => {
|
|
13257
|
+
assertPositionalCount(parsed, 2);
|
|
13258
|
+
assertOnlyFlags(parsed, ["no-browser"]);
|
|
13259
|
+
const credentials = await loginWithBrowser({
|
|
13260
|
+
apiBaseUrl,
|
|
13261
|
+
clientVersion: cliVersion,
|
|
13262
|
+
onVerification: ({ browserOpened, userCode, verificationUriComplete }) => {
|
|
13263
|
+
runtime.stderr.write(`${browserOpened ? "Opened" : "Open"} ${verificationUriComplete}
|
|
13264
|
+
Code: ${userCode}
|
|
13265
|
+
Waiting for approval\u2026
|
|
13266
|
+
`);
|
|
13267
|
+
},
|
|
13268
|
+
...parsed.flags.get("no-browser") === true ? { openBrowser: async () => false } : {},
|
|
13269
|
+
store: credentialStore
|
|
13270
|
+
});
|
|
13271
|
+
writeSuccess(runtime, {
|
|
13272
|
+
authenticated: true,
|
|
13273
|
+
session: credentials.session,
|
|
13274
|
+
storage: "Bun.secrets"
|
|
13275
|
+
});
|
|
13276
|
+
};
|
|
13277
|
+
var runAuthStatus = async ({
|
|
13278
|
+
parsed,
|
|
13279
|
+
runtime,
|
|
13280
|
+
credentialStore,
|
|
13281
|
+
apiBaseUrl
|
|
13282
|
+
}) => {
|
|
13283
|
+
assertPositionalCount(parsed, 2);
|
|
13284
|
+
assertOnlyFlags(parsed, []);
|
|
13285
|
+
const credentials = await credentialStore.get();
|
|
13286
|
+
writeSuccess(runtime, credentials && isCliCredentialForIssuer(credentials, apiBaseUrl) ? {
|
|
13287
|
+
authenticated: true,
|
|
13288
|
+
accessTokenExpiresAt: credentials.accessTokenExpiresAt,
|
|
13289
|
+
refreshTokenExpiresAt: credentials.refreshTokenExpiresAt,
|
|
13290
|
+
session: credentials.session,
|
|
13291
|
+
storage: "Bun.secrets"
|
|
13292
|
+
} : { authenticated: false, storage: "Bun.secrets" });
|
|
13293
|
+
};
|
|
13294
|
+
var runAuthLogout = async ({
|
|
13295
|
+
parsed,
|
|
13296
|
+
runtime,
|
|
13297
|
+
credentialStore,
|
|
13298
|
+
apiBaseUrl
|
|
13299
|
+
}) => {
|
|
13300
|
+
assertPositionalCount(parsed, 2);
|
|
13301
|
+
assertOnlyFlags(parsed, []);
|
|
13302
|
+
writeSuccess(runtime, {
|
|
13303
|
+
loggedOut: true,
|
|
13304
|
+
...await logoutCliSession({ apiBaseUrl, store: credentialStore })
|
|
13305
|
+
});
|
|
13306
|
+
};
|
|
13307
|
+
var runAuthWhoami = async ({
|
|
13308
|
+
parsed,
|
|
13309
|
+
runtime,
|
|
13310
|
+
ensureAuthentication
|
|
13311
|
+
}) => {
|
|
13312
|
+
assertPositionalCount(parsed, 2);
|
|
13313
|
+
assertOnlyFlags(parsed, []);
|
|
13314
|
+
await ensureAuthentication();
|
|
13315
|
+
writeSuccess(runtime, await api2.auth.whoami.query(undefined));
|
|
13316
|
+
};
|
|
13317
|
+
var runOrganizationList = async ({
|
|
13318
|
+
parsed,
|
|
13319
|
+
runtime,
|
|
13320
|
+
ensureAuthentication
|
|
13321
|
+
}) => {
|
|
13322
|
+
assertPositionalCount(parsed, 2);
|
|
13323
|
+
assertOnlyFlags(parsed, []);
|
|
13324
|
+
await ensureAuthentication();
|
|
13325
|
+
writeSuccess(runtime, await api2.organization.getOrganizationsForUser.query(undefined));
|
|
13326
|
+
};
|
|
13327
|
+
var runOrganizationGet = async ({
|
|
13328
|
+
parsed,
|
|
13329
|
+
runtime,
|
|
13330
|
+
ensureAuthentication
|
|
13331
|
+
}) => {
|
|
13332
|
+
assertPositionalCount(parsed, 2);
|
|
13333
|
+
assertOnlyFlags(parsed, ["organization-id"]);
|
|
13334
|
+
await ensureAuthentication();
|
|
13335
|
+
writeSuccess(runtime, await api2.organization.getOrganizationById.query({
|
|
13336
|
+
organizationId: getRequiredFlag(parsed, "organization-id")
|
|
13337
|
+
}));
|
|
13338
|
+
};
|
|
13339
|
+
var runOrganizationCreate = async ({
|
|
13340
|
+
parsed,
|
|
13341
|
+
runtime,
|
|
13342
|
+
ensureAuthentication
|
|
13343
|
+
}) => {
|
|
13344
|
+
assertPositionalCount(parsed, 2);
|
|
13345
|
+
assertOnlyFlags(parsed, ["name", "owner-email", "allowed-event-types"]);
|
|
13346
|
+
const allowedEventTypes = getOptionalFlag(parsed, "allowed-event-types");
|
|
13347
|
+
const input = {
|
|
13348
|
+
name: getRequiredFlag(parsed, "name"),
|
|
13349
|
+
ownerEmail: getRequiredFlag(parsed, "owner-email"),
|
|
13350
|
+
...allowedEventTypes === undefined ? {} : { allowedEventTypes: parseEventTypeList(allowedEventTypes) }
|
|
13351
|
+
};
|
|
13352
|
+
await ensureAuthentication();
|
|
13353
|
+
writeSuccess(runtime, await api2.admin.organization.createOrganization.mutate(input));
|
|
13354
|
+
};
|
|
13355
|
+
var runEventCreate = async ({
|
|
13356
|
+
parsed,
|
|
13357
|
+
runtime,
|
|
13358
|
+
ensureAuthentication
|
|
13359
|
+
}) => {
|
|
13360
|
+
assertPositionalCount(parsed, 2);
|
|
13361
|
+
assertOnlyFlags(parsed, [
|
|
13362
|
+
"organization-id",
|
|
13363
|
+
"name",
|
|
13364
|
+
"type",
|
|
13365
|
+
"start",
|
|
13366
|
+
"end",
|
|
13367
|
+
"location"
|
|
13368
|
+
]);
|
|
13369
|
+
const end = getOptionalFlag(parsed, "end");
|
|
13370
|
+
const input = {
|
|
13371
|
+
organizationId: getRequiredFlag(parsed, "organization-id"),
|
|
13372
|
+
name: getRequiredFlag(parsed, "name"),
|
|
13373
|
+
type: parseCreatableEventType(getRequiredFlag(parsed, "type")),
|
|
13374
|
+
location: getRequiredFlag(parsed, "location"),
|
|
13375
|
+
eventDateRange: {
|
|
13376
|
+
from: parseIsoDateTime(getRequiredFlag(parsed, "start"), "start"),
|
|
13377
|
+
...end === undefined ? {} : { to: parseIsoDateTime(end, "end") }
|
|
13378
|
+
}
|
|
13379
|
+
};
|
|
13380
|
+
await ensureAuthentication();
|
|
13381
|
+
writeSuccess(runtime, await api2.event.createEvent.mutate(input));
|
|
13382
|
+
};
|
|
13383
|
+
var runEventList = async ({
|
|
13384
|
+
parsed,
|
|
13385
|
+
runtime,
|
|
13386
|
+
ensureAuthentication
|
|
13387
|
+
}) => {
|
|
13388
|
+
assertPositionalCount(parsed, 2);
|
|
13389
|
+
assertOnlyFlags(parsed, [
|
|
13390
|
+
"organization-id",
|
|
13391
|
+
"page",
|
|
13392
|
+
"per-page",
|
|
13393
|
+
"name",
|
|
13394
|
+
"status",
|
|
13395
|
+
"archive-status"
|
|
13396
|
+
]);
|
|
13397
|
+
const input = {
|
|
13398
|
+
organizationId: getRequiredFlag(parsed, "organization-id"),
|
|
13399
|
+
page: parsePositiveInteger(getOptionalFlag(parsed, "page") ?? "1", "page"),
|
|
13400
|
+
perPage: parsePositiveInteger(getOptionalFlag(parsed, "per-page") ?? "20", "per-page"),
|
|
13401
|
+
name: getOptionalFlag(parsed, "name") ?? "",
|
|
13402
|
+
status: parseEventListStatus(getOptionalFlag(parsed, "status") ?? "ALL"),
|
|
13403
|
+
archiveStatus: parseArchiveStatus(getOptionalFlag(parsed, "archive-status") ?? "active")
|
|
13404
|
+
};
|
|
13405
|
+
await ensureAuthentication();
|
|
13406
|
+
writeSuccess(runtime, await api2.event.getEventsByOrgId.query(input));
|
|
13407
|
+
};
|
|
13408
|
+
var runEventGet = async ({
|
|
13409
|
+
parsed,
|
|
13410
|
+
runtime,
|
|
13411
|
+
ensureAuthentication
|
|
13412
|
+
}) => {
|
|
13413
|
+
assertPositionalCount(parsed, 2);
|
|
13414
|
+
assertOnlyFlags(parsed, ["event-id"]);
|
|
13415
|
+
await ensureAuthentication();
|
|
13416
|
+
writeSuccess(runtime, await api2.event.getEventForNav.query({
|
|
13417
|
+
eventId: getRequiredFlag(parsed, "event-id")
|
|
13418
|
+
}));
|
|
13419
|
+
};
|
|
13420
|
+
var runEventAppearanceGet = async ({
|
|
13421
|
+
parsed,
|
|
13422
|
+
runtime,
|
|
13423
|
+
ensureAuthentication
|
|
13424
|
+
}) => {
|
|
13425
|
+
assertPositionalCount(parsed, 3);
|
|
13426
|
+
assertOnlyFlags(parsed, ["event-id", "public"]);
|
|
13427
|
+
const eventId = getRequiredFlag(parsed, "event-id");
|
|
13428
|
+
if (parsed.flags.get("public") === true) {
|
|
13429
|
+
writeSuccess(runtime, await api2.public.getEventAppearance.query({ eventId }));
|
|
13430
|
+
return;
|
|
13431
|
+
}
|
|
13432
|
+
await ensureAuthentication();
|
|
13433
|
+
writeSuccess(runtime, await api2.event.getEventAppearance.query({
|
|
13434
|
+
eventId
|
|
13435
|
+
}));
|
|
13436
|
+
};
|
|
13437
|
+
var runEventAppearanceUpdate = async ({
|
|
13438
|
+
parsed,
|
|
13439
|
+
runtime,
|
|
13440
|
+
ensureAuthentication
|
|
13441
|
+
}) => {
|
|
13442
|
+
assertPositionalCount(parsed, 3);
|
|
13443
|
+
assertOnlyFlags(parsed, [
|
|
13444
|
+
"event-id",
|
|
13445
|
+
"appearance-version",
|
|
13446
|
+
"appearance",
|
|
13447
|
+
"reset"
|
|
13448
|
+
]);
|
|
13449
|
+
const reset = parsed.positionals[2] === "reset" || parsed.flags.get("reset") === true;
|
|
13450
|
+
const appearanceValue = getOptionalFlag(parsed, "appearance");
|
|
13451
|
+
if (reset && appearanceValue !== undefined) {
|
|
13452
|
+
throw new CliUsageError("Use either --appearance or --reset, not both.");
|
|
13453
|
+
}
|
|
13454
|
+
if (!reset && appearanceValue === undefined) {
|
|
13455
|
+
throw new CliUsageError("--appearance is required unless --reset is provided.");
|
|
13456
|
+
}
|
|
13457
|
+
const input = {
|
|
13458
|
+
eventId: getRequiredFlag(parsed, "event-id"),
|
|
13459
|
+
appearanceVersion: parseNonnegativeInteger(getRequiredFlag(parsed, "appearance-version"), "appearance-version"),
|
|
13460
|
+
appearance: reset ? null : parseAppearance(appearanceValue)
|
|
13461
|
+
};
|
|
13462
|
+
await ensureAuthentication();
|
|
13463
|
+
writeSuccess(runtime, await api2.event.updateEventAppearance.mutate(input));
|
|
13464
|
+
};
|
|
13465
|
+
var runEventAppearanceUpload = async ({
|
|
13466
|
+
parsed,
|
|
13467
|
+
runtime,
|
|
13468
|
+
ensureAuthentication
|
|
13469
|
+
}) => {
|
|
13470
|
+
assertPositionalCount(parsed, 3);
|
|
13471
|
+
assertOnlyFlags(parsed, ["event-id", "file", "content-type", "media-type"]);
|
|
13472
|
+
const eventId = getRequiredFlag(parsed, "event-id");
|
|
13473
|
+
const filePath = getRequiredFlag(parsed, "file");
|
|
13474
|
+
const contentType = getRequiredFlag(parsed, "content-type");
|
|
13475
|
+
const mediaType = parseAppearanceMediaType(getRequiredFlag(parsed, "media-type"));
|
|
13476
|
+
const file = await readFile4(filePath);
|
|
13477
|
+
await ensureAuthentication();
|
|
13478
|
+
const signed = await api2.attachment.getPresignedUrlToUpload.mutate({
|
|
13479
|
+
folder: `event-appearance/${mediaType === "image" ? "images" : "videos"}`,
|
|
13480
|
+
fileName: basename2(filePath),
|
|
13481
|
+
contentType,
|
|
13482
|
+
size: file.byteLength,
|
|
13483
|
+
eventId
|
|
13484
|
+
});
|
|
13485
|
+
const uploadResponse = await fetch(signed.uploadUrl, {
|
|
13486
|
+
method: "PUT",
|
|
13487
|
+
headers: { "content-type": contentType },
|
|
13488
|
+
body: file
|
|
13489
|
+
});
|
|
13490
|
+
if (!uploadResponse.ok) {
|
|
13491
|
+
throw new Error(`Appearance media upload failed with HTTP ${uploadResponse.status}.`);
|
|
13492
|
+
}
|
|
13493
|
+
writeSuccess(runtime, signed);
|
|
13494
|
+
};
|
|
13495
|
+
var runPhotoWallDisplayItems = async ({
|
|
13496
|
+
parsed,
|
|
13497
|
+
runtime,
|
|
13498
|
+
ensureAuthentication
|
|
13499
|
+
}) => {
|
|
13500
|
+
assertPositionalCount(parsed, 3);
|
|
13501
|
+
assertOnlyFlags(parsed, ["event-id", "limit", "cursor", "retained-ids"]);
|
|
13502
|
+
const cursorValue = getOptionalFlag(parsed, "cursor");
|
|
13503
|
+
const retainedIdsValue = getOptionalFlag(parsed, "retained-ids");
|
|
13504
|
+
const input = {
|
|
13505
|
+
eventId: getRequiredFlag(parsed, "event-id"),
|
|
13506
|
+
limit: parseBoundedInteger(getOptionalFlag(parsed, "limit") ?? "30", "limit", 1, 60),
|
|
13507
|
+
...cursorValue === undefined ? {} : { cursor: parseCursor(cursorValue) },
|
|
13508
|
+
retainedIds: retainedIdsValue === undefined ? [] : parseRetainedIds(retainedIdsValue)
|
|
13509
|
+
};
|
|
13510
|
+
await ensureAuthentication();
|
|
13511
|
+
writeSuccess(runtime, await api2.event.photoWall.getPhotoWallDisplayItems.query(input));
|
|
13512
|
+
};
|
|
13513
|
+
var runLuckyDrawPreDraw = async ({
|
|
13514
|
+
parsed,
|
|
13515
|
+
runtime,
|
|
13516
|
+
ensureAuthentication
|
|
13517
|
+
}) => {
|
|
13518
|
+
assertPositionalCount(parsed, 2);
|
|
13519
|
+
assertOnlyFlags(parsed, ["event-id", "prize-count"]);
|
|
13520
|
+
const input = {
|
|
13521
|
+
eventId: getRequiredFlag(parsed, "event-id"),
|
|
13522
|
+
prizeCount: parsePositiveInteger(getRequiredFlag(parsed, "prize-count"), "prize-count")
|
|
13523
|
+
};
|
|
13524
|
+
await ensureAuthentication();
|
|
13525
|
+
writeSuccess(runtime, await api2.event.luckyDraw.preDrawPrizes.mutate(input));
|
|
13526
|
+
};
|
|
13527
|
+
var runLuckyDrawParticipantsReplace = async ({
|
|
13528
|
+
parsed,
|
|
13529
|
+
runtime,
|
|
13530
|
+
ensureAuthentication
|
|
13531
|
+
}) => {
|
|
13532
|
+
assertPositionalCount(parsed, 3);
|
|
13533
|
+
assertOnlyFlags(parsed, [
|
|
13534
|
+
"event-id",
|
|
13535
|
+
"participants",
|
|
13536
|
+
"participants-file",
|
|
13537
|
+
"allow-state-change",
|
|
13538
|
+
"target"
|
|
13539
|
+
]);
|
|
13540
|
+
const eventId = getRequiredFlag(parsed, "event-id");
|
|
13541
|
+
assertStateChangeTarget(parsed, eventId);
|
|
13542
|
+
const input = {
|
|
13543
|
+
eventId,
|
|
13544
|
+
participants: parseLuckyDrawParticipants(await readInlineOrFile(parsed, "participants", "participants-file"))
|
|
13545
|
+
};
|
|
13546
|
+
await ensureAuthentication();
|
|
13547
|
+
writeSuccess(runtime, await api2.event.luckyDraw.createLuckyDrawParticipant.mutate(input));
|
|
13548
|
+
};
|
|
13549
|
+
var runLuckyDrawParticipantsList = async ({
|
|
13550
|
+
parsed,
|
|
13551
|
+
runtime,
|
|
13552
|
+
ensureAuthentication
|
|
13553
|
+
}) => {
|
|
13554
|
+
assertPositionalCount(parsed, 3);
|
|
13555
|
+
assertOnlyFlags(parsed, ["event-id", "page", "per-page"]);
|
|
13556
|
+
const input = {
|
|
13557
|
+
eventId: getRequiredFlag(parsed, "event-id"),
|
|
13558
|
+
page: parsePositiveInteger(getOptionalFlag(parsed, "page") ?? "1", "page"),
|
|
13559
|
+
perPage: parseBoundedInteger(getOptionalFlag(parsed, "per-page") ?? "100", "per-page", 1, 100)
|
|
13560
|
+
};
|
|
13561
|
+
await ensureAuthentication();
|
|
13562
|
+
writeSuccess(runtime, await api2.event.luckyDraw.getLuckyDrawParticipantsByEventId.query(input));
|
|
13563
|
+
};
|
|
13564
|
+
var organizationCommands = new Map([
|
|
13565
|
+
[commandKey("list"), runOrganizationList],
|
|
13566
|
+
[commandKey("get"), runOrganizationGet],
|
|
13567
|
+
[commandKey("create"), runOrganizationCreate]
|
|
13568
|
+
]);
|
|
13569
|
+
var commandTable = new Map([
|
|
13570
|
+
[
|
|
13571
|
+
"auth",
|
|
13572
|
+
new Map([
|
|
13573
|
+
[commandKey("login"), runAuthLogin],
|
|
13574
|
+
[commandKey("status"), runAuthStatus],
|
|
13575
|
+
[commandKey("logout"), runAuthLogout],
|
|
13576
|
+
[commandKey("whoami"), runAuthWhoami]
|
|
13577
|
+
])
|
|
13578
|
+
],
|
|
13579
|
+
["organization", organizationCommands],
|
|
13580
|
+
["org", organizationCommands],
|
|
13581
|
+
[
|
|
13582
|
+
"event",
|
|
13583
|
+
new Map([
|
|
13584
|
+
[commandKey("create"), runEventCreate],
|
|
13585
|
+
[commandKey("list"), runEventList],
|
|
13586
|
+
[commandKey("get"), runEventGet],
|
|
13587
|
+
[commandKey("appearance", "get"), runEventAppearanceGet],
|
|
13588
|
+
[commandKey("appearance", "update"), runEventAppearanceUpdate],
|
|
13589
|
+
[commandKey("appearance", "reset"), runEventAppearanceUpdate],
|
|
13590
|
+
[commandKey("appearance", "upload"), runEventAppearanceUpload],
|
|
13591
|
+
[commandKey("photo-wall", "display-items"), runPhotoWallDisplayItems],
|
|
13592
|
+
[commandKey("photo-wall", "display"), runPhotoWallDisplayItems]
|
|
13593
|
+
])
|
|
13594
|
+
],
|
|
13595
|
+
[
|
|
13596
|
+
"lucky-draw",
|
|
13597
|
+
new Map([
|
|
13598
|
+
[commandKey("pre-draw"), runLuckyDrawPreDraw],
|
|
13599
|
+
[commandKey("participants", "replace"), runLuckyDrawParticipantsReplace],
|
|
13600
|
+
[commandKey("participants", "list"), runLuckyDrawParticipantsList]
|
|
13601
|
+
])
|
|
13602
|
+
]
|
|
13603
|
+
]);
|
|
13166
13604
|
var runCommand = async (parsed, runtime, credentialStore, apiBaseUrl, configureAccessToken) => {
|
|
13167
13605
|
const [group, action, subAction] = parsed.positionals;
|
|
13168
13606
|
const cliVersion = getInstalledCliVersion();
|
|
@@ -13205,227 +13643,6 @@ var runCommand = async (parsed, runtime, credentialStore, apiBaseUrl, configureA
|
|
|
13205
13643
|
});
|
|
13206
13644
|
return;
|
|
13207
13645
|
}
|
|
13208
|
-
if (group === "auth" && action === "login" && subAction === undefined) {
|
|
13209
|
-
assertPositionalCount(parsed, 2);
|
|
13210
|
-
assertOnlyFlags(parsed, ["no-browser"]);
|
|
13211
|
-
const credentials = await loginWithBrowser({
|
|
13212
|
-
apiBaseUrl,
|
|
13213
|
-
clientVersion: cliVersion,
|
|
13214
|
-
onVerification: ({
|
|
13215
|
-
browserOpened,
|
|
13216
|
-
userCode,
|
|
13217
|
-
verificationUriComplete
|
|
13218
|
-
}) => {
|
|
13219
|
-
runtime.stderr.write(`${browserOpened ? "Opened" : "Open"} ${verificationUriComplete}
|
|
13220
|
-
Code: ${userCode}
|
|
13221
|
-
Waiting for approval\u2026
|
|
13222
|
-
`);
|
|
13223
|
-
},
|
|
13224
|
-
...parsed.flags.get("no-browser") === true ? { openBrowser: async () => false } : {},
|
|
13225
|
-
store: credentialStore
|
|
13226
|
-
});
|
|
13227
|
-
writeSuccess(runtime, {
|
|
13228
|
-
authenticated: true,
|
|
13229
|
-
session: credentials.session,
|
|
13230
|
-
storage: "Bun.secrets"
|
|
13231
|
-
});
|
|
13232
|
-
return;
|
|
13233
|
-
}
|
|
13234
|
-
if (group === "auth" && action === "status" && subAction === undefined) {
|
|
13235
|
-
assertPositionalCount(parsed, 2);
|
|
13236
|
-
assertOnlyFlags(parsed, []);
|
|
13237
|
-
const credentials = await credentialStore.get();
|
|
13238
|
-
writeSuccess(runtime, credentials && isCliCredentialForIssuer(credentials, apiBaseUrl) ? {
|
|
13239
|
-
authenticated: true,
|
|
13240
|
-
accessTokenExpiresAt: credentials.accessTokenExpiresAt,
|
|
13241
|
-
refreshTokenExpiresAt: credentials.refreshTokenExpiresAt,
|
|
13242
|
-
session: credentials.session,
|
|
13243
|
-
storage: "Bun.secrets"
|
|
13244
|
-
} : { authenticated: false, storage: "Bun.secrets" });
|
|
13245
|
-
return;
|
|
13246
|
-
}
|
|
13247
|
-
if (group === "auth" && action === "logout" && subAction === undefined) {
|
|
13248
|
-
assertPositionalCount(parsed, 2);
|
|
13249
|
-
assertOnlyFlags(parsed, []);
|
|
13250
|
-
writeSuccess(runtime, {
|
|
13251
|
-
loggedOut: true,
|
|
13252
|
-
...await logoutCliSession({ apiBaseUrl, store: credentialStore })
|
|
13253
|
-
});
|
|
13254
|
-
return;
|
|
13255
|
-
}
|
|
13256
|
-
if (group === "auth" && action === "whoami" && subAction === undefined) {
|
|
13257
|
-
assertPositionalCount(parsed, 2);
|
|
13258
|
-
assertOnlyFlags(parsed, []);
|
|
13259
|
-
await ensureAuthentication();
|
|
13260
|
-
writeSuccess(runtime, await api2.auth.whoami.query(undefined));
|
|
13261
|
-
return;
|
|
13262
|
-
}
|
|
13263
|
-
if ((group === "organization" || group === "org") && action === "list" && subAction === undefined) {
|
|
13264
|
-
assertPositionalCount(parsed, 2);
|
|
13265
|
-
assertOnlyFlags(parsed, []);
|
|
13266
|
-
await ensureAuthentication();
|
|
13267
|
-
writeSuccess(runtime, await api2.organization.getOrganizationsForUser.query(undefined));
|
|
13268
|
-
return;
|
|
13269
|
-
}
|
|
13270
|
-
if ((group === "organization" || group === "org") && action === "get" && subAction === undefined) {
|
|
13271
|
-
assertPositionalCount(parsed, 2);
|
|
13272
|
-
assertOnlyFlags(parsed, ["organization-id"]);
|
|
13273
|
-
await ensureAuthentication();
|
|
13274
|
-
writeSuccess(runtime, await api2.organization.getOrganizationById.query({
|
|
13275
|
-
organizationId: getRequiredFlag(parsed, "organization-id")
|
|
13276
|
-
}));
|
|
13277
|
-
return;
|
|
13278
|
-
}
|
|
13279
|
-
if ((group === "organization" || group === "org") && action === "create" && subAction === undefined) {
|
|
13280
|
-
assertPositionalCount(parsed, 2);
|
|
13281
|
-
assertOnlyFlags(parsed, ["name", "owner-email", "allowed-event-types"]);
|
|
13282
|
-
const allowedEventTypes = getOptionalFlag(parsed, "allowed-event-types");
|
|
13283
|
-
const input = {
|
|
13284
|
-
name: getRequiredFlag(parsed, "name"),
|
|
13285
|
-
ownerEmail: getRequiredFlag(parsed, "owner-email"),
|
|
13286
|
-
...allowedEventTypes === undefined ? {} : { allowedEventTypes: parseEventTypeList(allowedEventTypes) }
|
|
13287
|
-
};
|
|
13288
|
-
await ensureAuthentication();
|
|
13289
|
-
writeSuccess(runtime, await api2.admin.organization.createOrganization.mutate(input));
|
|
13290
|
-
return;
|
|
13291
|
-
}
|
|
13292
|
-
if (group === "event" && action === "create" && subAction === undefined) {
|
|
13293
|
-
assertPositionalCount(parsed, 2);
|
|
13294
|
-
assertOnlyFlags(parsed, [
|
|
13295
|
-
"organization-id",
|
|
13296
|
-
"name",
|
|
13297
|
-
"type",
|
|
13298
|
-
"start",
|
|
13299
|
-
"end",
|
|
13300
|
-
"location"
|
|
13301
|
-
]);
|
|
13302
|
-
const end = getOptionalFlag(parsed, "end");
|
|
13303
|
-
const input = {
|
|
13304
|
-
organizationId: getRequiredFlag(parsed, "organization-id"),
|
|
13305
|
-
name: getRequiredFlag(parsed, "name"),
|
|
13306
|
-
type: parseCreatableEventType(getRequiredFlag(parsed, "type")),
|
|
13307
|
-
location: getRequiredFlag(parsed, "location"),
|
|
13308
|
-
eventDateRange: {
|
|
13309
|
-
from: parseIsoDateTime(getRequiredFlag(parsed, "start"), "start"),
|
|
13310
|
-
...end === undefined ? {} : { to: parseIsoDateTime(end, "end") }
|
|
13311
|
-
}
|
|
13312
|
-
};
|
|
13313
|
-
await ensureAuthentication();
|
|
13314
|
-
writeSuccess(runtime, await api2.event.createEvent.mutate(input));
|
|
13315
|
-
return;
|
|
13316
|
-
}
|
|
13317
|
-
if (group === "event" && action === "list" && subAction === undefined) {
|
|
13318
|
-
assertPositionalCount(parsed, 2);
|
|
13319
|
-
assertOnlyFlags(parsed, [
|
|
13320
|
-
"organization-id",
|
|
13321
|
-
"page",
|
|
13322
|
-
"per-page",
|
|
13323
|
-
"name",
|
|
13324
|
-
"status",
|
|
13325
|
-
"archive-status"
|
|
13326
|
-
]);
|
|
13327
|
-
const input = {
|
|
13328
|
-
organizationId: getRequiredFlag(parsed, "organization-id"),
|
|
13329
|
-
page: parsePositiveInteger(getOptionalFlag(parsed, "page") ?? "1", "page"),
|
|
13330
|
-
perPage: parsePositiveInteger(getOptionalFlag(parsed, "per-page") ?? "20", "per-page"),
|
|
13331
|
-
name: getOptionalFlag(parsed, "name") ?? "",
|
|
13332
|
-
status: parseEventListStatus(getOptionalFlag(parsed, "status") ?? "ALL"),
|
|
13333
|
-
archiveStatus: parseArchiveStatus(getOptionalFlag(parsed, "archive-status") ?? "active")
|
|
13334
|
-
};
|
|
13335
|
-
await ensureAuthentication();
|
|
13336
|
-
writeSuccess(runtime, await api2.event.getEventsByOrgId.query(input));
|
|
13337
|
-
return;
|
|
13338
|
-
}
|
|
13339
|
-
if (group === "event" && action === "get" && subAction === undefined) {
|
|
13340
|
-
assertPositionalCount(parsed, 2);
|
|
13341
|
-
assertOnlyFlags(parsed, ["event-id"]);
|
|
13342
|
-
await ensureAuthentication();
|
|
13343
|
-
writeSuccess(runtime, await api2.event.getEventForNav.query({
|
|
13344
|
-
eventId: getRequiredFlag(parsed, "event-id")
|
|
13345
|
-
}));
|
|
13346
|
-
return;
|
|
13347
|
-
}
|
|
13348
|
-
if (group === "event" && action === "appearance" && subAction === "get") {
|
|
13349
|
-
assertPositionalCount(parsed, 3);
|
|
13350
|
-
assertOnlyFlags(parsed, ["event-id", "public"]);
|
|
13351
|
-
const eventId = getRequiredFlag(parsed, "event-id");
|
|
13352
|
-
if (parsed.flags.get("public") === true) {
|
|
13353
|
-
writeSuccess(runtime, await api2.public.getEventAppearance.query({ eventId }));
|
|
13354
|
-
return;
|
|
13355
|
-
}
|
|
13356
|
-
await ensureAuthentication();
|
|
13357
|
-
writeSuccess(runtime, await api2.event.getEventAppearance.query({
|
|
13358
|
-
eventId
|
|
13359
|
-
}));
|
|
13360
|
-
return;
|
|
13361
|
-
}
|
|
13362
|
-
if (group === "event" && action === "appearance" && (subAction === "update" || subAction === "reset")) {
|
|
13363
|
-
assertPositionalCount(parsed, 3);
|
|
13364
|
-
assertOnlyFlags(parsed, [
|
|
13365
|
-
"event-id",
|
|
13366
|
-
"appearance-version",
|
|
13367
|
-
"appearance",
|
|
13368
|
-
"reset"
|
|
13369
|
-
]);
|
|
13370
|
-
const reset = subAction === "reset" || parsed.flags.get("reset") === true;
|
|
13371
|
-
const appearanceValue = getOptionalFlag(parsed, "appearance");
|
|
13372
|
-
if (reset && appearanceValue !== undefined) {
|
|
13373
|
-
throw new CliUsageError("Use either --appearance or --reset, not both.");
|
|
13374
|
-
}
|
|
13375
|
-
if (!reset && appearanceValue === undefined) {
|
|
13376
|
-
throw new CliUsageError("--appearance is required unless --reset is provided.");
|
|
13377
|
-
}
|
|
13378
|
-
const input = {
|
|
13379
|
-
eventId: getRequiredFlag(parsed, "event-id"),
|
|
13380
|
-
appearanceVersion: parseNonnegativeInteger(getRequiredFlag(parsed, "appearance-version"), "appearance-version"),
|
|
13381
|
-
appearance: reset ? null : parseAppearance(appearanceValue)
|
|
13382
|
-
};
|
|
13383
|
-
await ensureAuthentication();
|
|
13384
|
-
writeSuccess(runtime, await api2.event.updateEventAppearance.mutate(input));
|
|
13385
|
-
return;
|
|
13386
|
-
}
|
|
13387
|
-
if (group === "event" && action === "appearance" && subAction === "upload") {
|
|
13388
|
-
assertPositionalCount(parsed, 3);
|
|
13389
|
-
assertOnlyFlags(parsed, ["event-id", "file", "content-type", "media-type"]);
|
|
13390
|
-
const eventId = getRequiredFlag(parsed, "event-id");
|
|
13391
|
-
const filePath = getRequiredFlag(parsed, "file");
|
|
13392
|
-
const contentType = getRequiredFlag(parsed, "content-type");
|
|
13393
|
-
const mediaType = parseAppearanceMediaType(getRequiredFlag(parsed, "media-type"));
|
|
13394
|
-
const file = await readFile4(filePath);
|
|
13395
|
-
await ensureAuthentication();
|
|
13396
|
-
const signed = await api2.attachment.getPresignedUrlToUpload.mutate({
|
|
13397
|
-
folder: `event-appearance/${mediaType === "image" ? "images" : "videos"}`,
|
|
13398
|
-
fileName: basename2(filePath),
|
|
13399
|
-
contentType,
|
|
13400
|
-
size: file.byteLength,
|
|
13401
|
-
eventId
|
|
13402
|
-
});
|
|
13403
|
-
const uploadResponse = await fetch(signed.uploadUrl, {
|
|
13404
|
-
method: "PUT",
|
|
13405
|
-
headers: { "content-type": contentType },
|
|
13406
|
-
body: file
|
|
13407
|
-
});
|
|
13408
|
-
if (!uploadResponse.ok) {
|
|
13409
|
-
throw new Error(`Appearance media upload failed with HTTP ${uploadResponse.status}.`);
|
|
13410
|
-
}
|
|
13411
|
-
writeSuccess(runtime, signed);
|
|
13412
|
-
return;
|
|
13413
|
-
}
|
|
13414
|
-
if (group === "event" && action === "photo-wall" && (subAction === "display-items" || subAction === "display")) {
|
|
13415
|
-
assertPositionalCount(parsed, 3);
|
|
13416
|
-
assertOnlyFlags(parsed, ["event-id", "limit", "cursor", "retained-ids"]);
|
|
13417
|
-
const cursorValue = getOptionalFlag(parsed, "cursor");
|
|
13418
|
-
const retainedIdsValue = getOptionalFlag(parsed, "retained-ids");
|
|
13419
|
-
const input = {
|
|
13420
|
-
eventId: getRequiredFlag(parsed, "event-id"),
|
|
13421
|
-
limit: parseBoundedInteger(getOptionalFlag(parsed, "limit") ?? "30", "limit", 1, 60),
|
|
13422
|
-
...cursorValue === undefined ? {} : { cursor: parseCursor(cursorValue) },
|
|
13423
|
-
retainedIds: retainedIdsValue === undefined ? [] : parseRetainedIds(retainedIdsValue)
|
|
13424
|
-
};
|
|
13425
|
-
await ensureAuthentication();
|
|
13426
|
-
writeSuccess(runtime, await api2.event.photoWall.getPhotoWallDisplayItems.query(input));
|
|
13427
|
-
return;
|
|
13428
|
-
}
|
|
13429
13646
|
if (group === "lucky-draw" && await runLuckyDrawSetupCommand({
|
|
13430
13647
|
parsed,
|
|
13431
13648
|
runtime,
|
|
@@ -13433,49 +13650,18 @@ Waiting for approval\u2026
|
|
|
13433
13650
|
})) {
|
|
13434
13651
|
return;
|
|
13435
13652
|
}
|
|
13436
|
-
|
|
13437
|
-
|
|
13438
|
-
|
|
13439
|
-
const input = {
|
|
13440
|
-
eventId: getRequiredFlag(parsed, "event-id"),
|
|
13441
|
-
prizeCount: parsePositiveInteger(getRequiredFlag(parsed, "prize-count"), "prize-count")
|
|
13442
|
-
};
|
|
13443
|
-
await ensureAuthentication();
|
|
13444
|
-
writeSuccess(runtime, await api2.event.luckyDraw.preDrawPrizes.mutate(input));
|
|
13445
|
-
return;
|
|
13446
|
-
}
|
|
13447
|
-
if (group === "lucky-draw" && action === "participants" && subAction === "replace") {
|
|
13448
|
-
assertPositionalCount(parsed, 3);
|
|
13449
|
-
assertOnlyFlags(parsed, [
|
|
13450
|
-
"event-id",
|
|
13451
|
-
"participants",
|
|
13452
|
-
"participants-file",
|
|
13453
|
-
"allow-state-change",
|
|
13454
|
-
"target"
|
|
13455
|
-
]);
|
|
13456
|
-
const eventId = getRequiredFlag(parsed, "event-id");
|
|
13457
|
-
assertStateChangeTarget(parsed, eventId);
|
|
13458
|
-
const input = {
|
|
13459
|
-
eventId,
|
|
13460
|
-
participants: parseLuckyDrawParticipants(await readInlineOrFile(parsed, "participants", "participants-file"))
|
|
13461
|
-
};
|
|
13462
|
-
await ensureAuthentication();
|
|
13463
|
-
writeSuccess(runtime, await api2.event.luckyDraw.createLuckyDrawParticipant.mutate(input));
|
|
13464
|
-
return;
|
|
13465
|
-
}
|
|
13466
|
-
if (group === "lucky-draw" && action === "participants" && subAction === "list") {
|
|
13467
|
-
assertPositionalCount(parsed, 3);
|
|
13468
|
-
assertOnlyFlags(parsed, ["event-id", "page", "per-page"]);
|
|
13469
|
-
const input = {
|
|
13470
|
-
eventId: getRequiredFlag(parsed, "event-id"),
|
|
13471
|
-
page: parsePositiveInteger(getOptionalFlag(parsed, "page") ?? "1", "page"),
|
|
13472
|
-
perPage: parseBoundedInteger(getOptionalFlag(parsed, "per-page") ?? "100", "per-page", 1, 100)
|
|
13473
|
-
};
|
|
13474
|
-
await ensureAuthentication();
|
|
13475
|
-
writeSuccess(runtime, await api2.event.luckyDraw.getLuckyDrawParticipantsByEventId.query(input));
|
|
13476
|
-
return;
|
|
13653
|
+
const handler = group === undefined ? undefined : commandTable.get(group)?.get(commandKey(action, subAction));
|
|
13654
|
+
if (handler === undefined) {
|
|
13655
|
+
throw new CliUsageError("Unknown command. Run `et --help` for available commands.");
|
|
13477
13656
|
}
|
|
13478
|
-
|
|
13657
|
+
await handler({
|
|
13658
|
+
parsed,
|
|
13659
|
+
runtime,
|
|
13660
|
+
credentialStore,
|
|
13661
|
+
apiBaseUrl,
|
|
13662
|
+
cliVersion,
|
|
13663
|
+
ensureAuthentication
|
|
13664
|
+
});
|
|
13479
13665
|
};
|
|
13480
13666
|
var runCli = async (args, runtime = processRuntime, credentialStore = createBunCredentialStore({
|
|
13481
13667
|
product: "event-tech"
|