@asgard-js/core 0.3.72 → 0.3.73
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.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +142 -142
- package/dist/index.mjs.map +1 -1
- package/dist/lib/source-set-client.d.ts +2 -2
- package/dist/lib/source-set-client.d.ts.map +1 -1
- package/dist/types/source-set-fs.d.ts +13 -0
- package/dist/types/source-set-fs.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -58,26 +58,26 @@ function Je(n) {
|
|
|
58
58
|
return function(o) {
|
|
59
59
|
t === void 0 ? (t = o, e = 0, s = -1) : t = Ze(t, o);
|
|
60
60
|
const a = t.length;
|
|
61
|
-
let
|
|
61
|
+
let u = 0;
|
|
62
62
|
for (; e < a; ) {
|
|
63
|
-
r && (t[e] === 10 && (
|
|
64
|
-
let
|
|
65
|
-
for (; e < a &&
|
|
63
|
+
r && (t[e] === 10 && (u = ++e), r = !1);
|
|
64
|
+
let c = -1;
|
|
65
|
+
for (; e < a && c === -1; ++e)
|
|
66
66
|
switch (t[e]) {
|
|
67
67
|
case 58:
|
|
68
|
-
s === -1 && (s = e -
|
|
68
|
+
s === -1 && (s = e - u);
|
|
69
69
|
break;
|
|
70
70
|
case 13:
|
|
71
71
|
r = !0;
|
|
72
72
|
case 10:
|
|
73
|
-
|
|
73
|
+
c = e;
|
|
74
74
|
break;
|
|
75
75
|
}
|
|
76
|
-
if (
|
|
76
|
+
if (c === -1)
|
|
77
77
|
break;
|
|
78
|
-
n(t.subarray(
|
|
78
|
+
n(t.subarray(u, c), s), u = e, s = -1;
|
|
79
79
|
}
|
|
80
|
-
|
|
80
|
+
u === a ? t = void 0 : u !== 0 && (t = t.subarray(u), e -= u);
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
83
|
function Qe(n, t, e) {
|
|
@@ -87,8 +87,8 @@ function Qe(n, t, e) {
|
|
|
87
87
|
if (o.length === 0)
|
|
88
88
|
e?.(s), s = le();
|
|
89
89
|
else if (a > 0) {
|
|
90
|
-
const
|
|
91
|
-
switch (
|
|
90
|
+
const u = r.decode(o.subarray(0, a)), c = a + (o[a + 1] === 32 ? 2 : 1), l = r.decode(o.subarray(c));
|
|
91
|
+
switch (u) {
|
|
92
92
|
case "data":
|
|
93
93
|
s.data = s.data ? s.data + `
|
|
94
94
|
` + l : l;
|
|
@@ -129,7 +129,7 @@ var et = function(n, t) {
|
|
|
129
129
|
};
|
|
130
130
|
const se = "text/event-stream", tt = 1e3, de = "last-event-id";
|
|
131
131
|
function Ce(n, t) {
|
|
132
|
-
var { signal: e, headers: s, onopen: r, onmessage: i, onclose: o, onerror: a, openWhenHidden:
|
|
132
|
+
var { signal: e, headers: s, onopen: r, onmessage: i, onclose: o, onerror: a, openWhenHidden: u, fetch: c } = t, l = et(t, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
|
|
133
133
|
return new Promise((m, v) => {
|
|
134
134
|
const h = Object.assign({}, s);
|
|
135
135
|
h.accept || (h.accept = se);
|
|
@@ -137,7 +137,7 @@ function Ce(n, t) {
|
|
|
137
137
|
function f() {
|
|
138
138
|
p.abort(), document.hidden || j();
|
|
139
139
|
}
|
|
140
|
-
|
|
140
|
+
u || document.addEventListener("visibilitychange", f);
|
|
141
141
|
let E = tt, w = 0;
|
|
142
142
|
function F() {
|
|
143
143
|
document.removeEventListener("visibilitychange", f), window.clearTimeout(w), p.abort();
|
|
@@ -145,7 +145,7 @@ function Ce(n, t) {
|
|
|
145
145
|
e?.addEventListener("abort", () => {
|
|
146
146
|
F(), m();
|
|
147
147
|
});
|
|
148
|
-
const k =
|
|
148
|
+
const k = c ?? window.fetch, L = r ?? nt;
|
|
149
149
|
async function j() {
|
|
150
150
|
var $;
|
|
151
151
|
p = new AbortController();
|
|
@@ -199,22 +199,22 @@ function st(n, t, e, s) {
|
|
|
199
199
|
return new (e || (e = Promise))(function(i, o) {
|
|
200
200
|
function a(l) {
|
|
201
201
|
try {
|
|
202
|
-
|
|
202
|
+
c(s.next(l));
|
|
203
203
|
} catch (m) {
|
|
204
204
|
o(m);
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
|
-
function
|
|
207
|
+
function u(l) {
|
|
208
208
|
try {
|
|
209
|
-
|
|
209
|
+
c(s.throw(l));
|
|
210
210
|
} catch (m) {
|
|
211
211
|
o(m);
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
|
-
function
|
|
215
|
-
l.done ? i(l.value) : r(l.value).then(a,
|
|
214
|
+
function c(l) {
|
|
215
|
+
l.done ? i(l.value) : r(l.value).then(a, u);
|
|
216
216
|
}
|
|
217
|
-
|
|
217
|
+
c((s = s.apply(n, t || [])).next());
|
|
218
218
|
});
|
|
219
219
|
}
|
|
220
220
|
function xe(n, t) {
|
|
@@ -225,56 +225,56 @@ function xe(n, t) {
|
|
|
225
225
|
return o.next = a(0), o.throw = a(1), o.return = a(2), typeof Symbol == "function" && (o[Symbol.iterator] = function() {
|
|
226
226
|
return this;
|
|
227
227
|
}), o;
|
|
228
|
-
function a(
|
|
228
|
+
function a(c) {
|
|
229
229
|
return function(l) {
|
|
230
|
-
return
|
|
230
|
+
return u([c, l]);
|
|
231
231
|
};
|
|
232
232
|
}
|
|
233
|
-
function c
|
|
233
|
+
function u(c) {
|
|
234
234
|
if (s) throw new TypeError("Generator is already executing.");
|
|
235
|
-
for (; o && (o = 0,
|
|
236
|
-
if (s = 1, r && (i =
|
|
237
|
-
switch (r = 0, i && (
|
|
235
|
+
for (; o && (o = 0, c[0] && (e = 0)), e; ) try {
|
|
236
|
+
if (s = 1, r && (i = c[0] & 2 ? r.return : c[0] ? r.throw || ((i = r.return) && i.call(r), 0) : r.next) && !(i = i.call(r, c[1])).done) return i;
|
|
237
|
+
switch (r = 0, i && (c = [c[0] & 2, i.value]), c[0]) {
|
|
238
238
|
case 0:
|
|
239
239
|
case 1:
|
|
240
|
-
i =
|
|
240
|
+
i = c;
|
|
241
241
|
break;
|
|
242
242
|
case 4:
|
|
243
|
-
return e.label++, { value:
|
|
243
|
+
return e.label++, { value: c[1], done: !1 };
|
|
244
244
|
case 5:
|
|
245
|
-
e.label++, r =
|
|
245
|
+
e.label++, r = c[1], c = [0];
|
|
246
246
|
continue;
|
|
247
247
|
case 7:
|
|
248
|
-
|
|
248
|
+
c = e.ops.pop(), e.trys.pop();
|
|
249
249
|
continue;
|
|
250
250
|
default:
|
|
251
|
-
if (i = e.trys, !(i = i.length > 0 && i[i.length - 1]) && (
|
|
251
|
+
if (i = e.trys, !(i = i.length > 0 && i[i.length - 1]) && (c[0] === 6 || c[0] === 2)) {
|
|
252
252
|
e = 0;
|
|
253
253
|
continue;
|
|
254
254
|
}
|
|
255
|
-
if (
|
|
256
|
-
e.label =
|
|
255
|
+
if (c[0] === 3 && (!i || c[1] > i[0] && c[1] < i[3])) {
|
|
256
|
+
e.label = c[1];
|
|
257
257
|
break;
|
|
258
258
|
}
|
|
259
|
-
if (
|
|
260
|
-
e.label = i[1], i =
|
|
259
|
+
if (c[0] === 6 && e.label < i[1]) {
|
|
260
|
+
e.label = i[1], i = c;
|
|
261
261
|
break;
|
|
262
262
|
}
|
|
263
263
|
if (i && e.label < i[2]) {
|
|
264
|
-
e.label = i[2], e.ops.push(
|
|
264
|
+
e.label = i[2], e.ops.push(c);
|
|
265
265
|
break;
|
|
266
266
|
}
|
|
267
267
|
i[2] && e.ops.pop(), e.trys.pop();
|
|
268
268
|
continue;
|
|
269
269
|
}
|
|
270
|
-
|
|
270
|
+
c = t.call(n, e);
|
|
271
271
|
} catch (l) {
|
|
272
|
-
|
|
272
|
+
c = [6, l], r = 0;
|
|
273
273
|
} finally {
|
|
274
274
|
s = i = 0;
|
|
275
275
|
}
|
|
276
|
-
if (
|
|
277
|
-
return { value:
|
|
276
|
+
if (c[0] & 5) throw c[1];
|
|
277
|
+
return { value: c[0] ? c[1] : void 0, done: !0 };
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
280
|
function U(n) {
|
|
@@ -326,28 +326,28 @@ function rt(n, t, e) {
|
|
|
326
326
|
function a(h, p) {
|
|
327
327
|
s[h] && (r[h] = function(f) {
|
|
328
328
|
return new Promise(function(E, w) {
|
|
329
|
-
i.push([h, f, E, w]) > 1 ||
|
|
329
|
+
i.push([h, f, E, w]) > 1 || u(h, f);
|
|
330
330
|
});
|
|
331
331
|
}, p && (r[h] = p(r[h])));
|
|
332
332
|
}
|
|
333
|
-
function
|
|
333
|
+
function u(h, p) {
|
|
334
334
|
try {
|
|
335
|
-
|
|
335
|
+
c(s[h](p));
|
|
336
336
|
} catch (f) {
|
|
337
337
|
v(i[0][3], f);
|
|
338
338
|
}
|
|
339
339
|
}
|
|
340
|
-
function
|
|
340
|
+
function c(h) {
|
|
341
341
|
h.value instanceof H ? Promise.resolve(h.value.v).then(l, m) : v(i[0][2], h);
|
|
342
342
|
}
|
|
343
343
|
function l(h) {
|
|
344
|
-
|
|
344
|
+
u("next", h);
|
|
345
345
|
}
|
|
346
346
|
function m(h) {
|
|
347
|
-
|
|
347
|
+
u("throw", h);
|
|
348
348
|
}
|
|
349
349
|
function v(h, p) {
|
|
350
|
-
h(p), i.shift(), i.length &&
|
|
350
|
+
h(p), i.shift(), i.length && u(i[0][0], i[0][1]);
|
|
351
351
|
}
|
|
352
352
|
}
|
|
353
353
|
function it(n) {
|
|
@@ -358,14 +358,14 @@ function it(n) {
|
|
|
358
358
|
}, e);
|
|
359
359
|
function s(i) {
|
|
360
360
|
e[i] = n[i] && function(o) {
|
|
361
|
-
return new Promise(function(a,
|
|
362
|
-
o = n[i](o), r(a,
|
|
361
|
+
return new Promise(function(a, u) {
|
|
362
|
+
o = n[i](o), r(a, u, o.done, o.value);
|
|
363
363
|
});
|
|
364
364
|
};
|
|
365
365
|
}
|
|
366
|
-
function r(i, o, a,
|
|
367
|
-
Promise.resolve(
|
|
368
|
-
i({ value:
|
|
366
|
+
function r(i, o, a, u) {
|
|
367
|
+
Promise.resolve(u).then(function(c) {
|
|
368
|
+
i({ value: c, done: a });
|
|
369
369
|
}, o);
|
|
370
370
|
}
|
|
371
371
|
}
|
|
@@ -405,15 +405,15 @@ var N = (function() {
|
|
|
405
405
|
if (o)
|
|
406
406
|
if (this._parentage = null, Array.isArray(o))
|
|
407
407
|
try {
|
|
408
|
-
for (var a = U(o),
|
|
409
|
-
var
|
|
410
|
-
|
|
408
|
+
for (var a = U(o), u = a.next(); !u.done; u = a.next()) {
|
|
409
|
+
var c = u.value;
|
|
410
|
+
c.remove(this);
|
|
411
411
|
}
|
|
412
412
|
} catch (f) {
|
|
413
413
|
t = { error: f };
|
|
414
414
|
} finally {
|
|
415
415
|
try {
|
|
416
|
-
|
|
416
|
+
u && !u.done && (e = a.return) && e.call(a);
|
|
417
417
|
} finally {
|
|
418
418
|
if (t) throw t.error;
|
|
419
419
|
}
|
|
@@ -619,8 +619,8 @@ var y = (function() {
|
|
|
619
619
|
}, n.prototype.subscribe = function(t, e, s) {
|
|
620
620
|
var r = this, i = ft(t) ? t : new oe(t, e, s);
|
|
621
621
|
return W(function() {
|
|
622
|
-
var o = r, a = o.operator,
|
|
623
|
-
i.add(a ? a.call(i,
|
|
622
|
+
var o = r, a = o.operator, u = o.source;
|
|
623
|
+
i.add(a ? a.call(i, u) : u ? r._subscribe(i) : r._trySubscribe(i));
|
|
624
624
|
}), i;
|
|
625
625
|
}, n.prototype._trySubscribe = function(t) {
|
|
626
626
|
try {
|
|
@@ -635,8 +635,8 @@ var y = (function() {
|
|
|
635
635
|
next: function(a) {
|
|
636
636
|
try {
|
|
637
637
|
t(a);
|
|
638
|
-
} catch (
|
|
639
|
-
i(
|
|
638
|
+
} catch (u) {
|
|
639
|
+
i(u), o.unsubscribe();
|
|
640
640
|
}
|
|
641
641
|
},
|
|
642
642
|
error: i,
|
|
@@ -701,30 +701,30 @@ function R(n, t, e, s, r) {
|
|
|
701
701
|
var mt = (function(n) {
|
|
702
702
|
O(t, n);
|
|
703
703
|
function t(e, s, r, i, o, a) {
|
|
704
|
-
var
|
|
705
|
-
return
|
|
704
|
+
var u = n.call(this, e) || this;
|
|
705
|
+
return u.onFinalize = o, u.shouldUnsubscribe = a, u._next = s ? function(c) {
|
|
706
706
|
try {
|
|
707
|
-
s(
|
|
707
|
+
s(c);
|
|
708
708
|
} catch (l) {
|
|
709
709
|
e.error(l);
|
|
710
710
|
}
|
|
711
|
-
} : n.prototype._next,
|
|
711
|
+
} : n.prototype._next, u._error = i ? function(c) {
|
|
712
712
|
try {
|
|
713
|
-
i(
|
|
713
|
+
i(c);
|
|
714
714
|
} catch (l) {
|
|
715
715
|
e.error(l);
|
|
716
716
|
} finally {
|
|
717
717
|
this.unsubscribe();
|
|
718
718
|
}
|
|
719
|
-
} : n.prototype._error,
|
|
719
|
+
} : n.prototype._error, u._complete = r ? function() {
|
|
720
720
|
try {
|
|
721
721
|
r();
|
|
722
|
-
} catch (
|
|
723
|
-
e.error(
|
|
722
|
+
} catch (c) {
|
|
723
|
+
e.error(c);
|
|
724
724
|
} finally {
|
|
725
725
|
this.unsubscribe();
|
|
726
726
|
}
|
|
727
|
-
} : n.prototype._complete,
|
|
727
|
+
} : n.prototype._complete, u;
|
|
728
728
|
}
|
|
729
729
|
return t.prototype.unsubscribe = function() {
|
|
730
730
|
var e;
|
|
@@ -757,11 +757,11 @@ var mt = (function(n) {
|
|
|
757
757
|
s.currentObservers || (s.currentObservers = Array.from(s.observers));
|
|
758
758
|
try {
|
|
759
759
|
for (var o = U(s.currentObservers), a = o.next(); !a.done; a = o.next()) {
|
|
760
|
-
var
|
|
761
|
-
|
|
760
|
+
var u = a.value;
|
|
761
|
+
u.next(e);
|
|
762
762
|
}
|
|
763
|
-
} catch (
|
|
764
|
-
r = { error:
|
|
763
|
+
} catch (c) {
|
|
764
|
+
r = { error: c };
|
|
765
765
|
} finally {
|
|
766
766
|
try {
|
|
767
767
|
a && !a.done && (i = o.return) && i.call(o);
|
|
@@ -1101,27 +1101,27 @@ function _t(n, t) {
|
|
|
1101
1101
|
var e, s, r, i;
|
|
1102
1102
|
return st(this, void 0, void 0, function() {
|
|
1103
1103
|
var o, a;
|
|
1104
|
-
return xe(this, function(
|
|
1105
|
-
switch (
|
|
1104
|
+
return xe(this, function(u) {
|
|
1105
|
+
switch (u.label) {
|
|
1106
1106
|
case 0:
|
|
1107
|
-
|
|
1107
|
+
u.trys.push([0, 5, 6, 11]), e = it(n), u.label = 1;
|
|
1108
1108
|
case 1:
|
|
1109
1109
|
return [4, e.next()];
|
|
1110
1110
|
case 2:
|
|
1111
|
-
if (s =
|
|
1111
|
+
if (s = u.sent(), !!s.done) return [3, 4];
|
|
1112
1112
|
if (o = s.value, t.next(o), t.closed)
|
|
1113
1113
|
return [2];
|
|
1114
|
-
|
|
1114
|
+
u.label = 3;
|
|
1115
1115
|
case 3:
|
|
1116
1116
|
return [3, 1];
|
|
1117
1117
|
case 4:
|
|
1118
1118
|
return [3, 11];
|
|
1119
1119
|
case 5:
|
|
1120
|
-
return a =
|
|
1120
|
+
return a = u.sent(), r = { error: a }, [3, 11];
|
|
1121
1121
|
case 6:
|
|
1122
|
-
return
|
|
1122
|
+
return u.trys.push([6, , 9, 10]), s && !s.done && (i = e.return) ? [4, i.call(e)] : [3, 8];
|
|
1123
1123
|
case 7:
|
|
1124
|
-
|
|
1124
|
+
u.sent(), u.label = 8;
|
|
1125
1125
|
case 8:
|
|
1126
1126
|
return [3, 10];
|
|
1127
1127
|
case 9:
|
|
@@ -1286,15 +1286,15 @@ function Wt() {
|
|
|
1286
1286
|
var e = Me(n), s = It(n), r = qt(n), i = r.args, o = r.keys;
|
|
1287
1287
|
if (i.length === 0)
|
|
1288
1288
|
return Ve([], e);
|
|
1289
|
-
var a = new y(Xt(i, e, o ? function(
|
|
1290
|
-
return Vt(o,
|
|
1289
|
+
var a = new y(Xt(i, e, o ? function(u) {
|
|
1290
|
+
return Vt(o, u);
|
|
1291
1291
|
} : z));
|
|
1292
1292
|
return s ? a.pipe(Dt(s)) : a;
|
|
1293
1293
|
}
|
|
1294
1294
|
function Xt(n, t, e) {
|
|
1295
1295
|
return e === void 0 && (e = z), function(s) {
|
|
1296
1296
|
be(t, function() {
|
|
1297
|
-
for (var r = n.length, i = new Array(r), o = r, a = r,
|
|
1297
|
+
for (var r = n.length, i = new Array(r), o = r, a = r, u = function(l) {
|
|
1298
1298
|
be(t, function() {
|
|
1299
1299
|
var m = Ve(n[l], t), v = !1;
|
|
1300
1300
|
m.subscribe(R(s, function(h) {
|
|
@@ -1303,8 +1303,8 @@ function Xt(n, t, e) {
|
|
|
1303
1303
|
--o || s.complete();
|
|
1304
1304
|
}));
|
|
1305
1305
|
}, s);
|
|
1306
|
-
},
|
|
1307
|
-
c
|
|
1306
|
+
}, c = 0; c < r; c++)
|
|
1307
|
+
u(c);
|
|
1308
1308
|
}, s);
|
|
1309
1309
|
};
|
|
1310
1310
|
}
|
|
@@ -1323,14 +1323,14 @@ function zt(n) {
|
|
|
1323
1323
|
for (var t, e, s = [], r = 1; r < arguments.length; r++)
|
|
1324
1324
|
s[r - 1] = arguments[r];
|
|
1325
1325
|
var i = (t = Me(s)) !== null && t !== void 0 ? t : wt, o = (e = s[0]) !== null && e !== void 0 ? e : null, a = s[1] || 1 / 0;
|
|
1326
|
-
return _(function(
|
|
1326
|
+
return _(function(u, c) {
|
|
1327
1327
|
var l = [], m = !1, v = function(f) {
|
|
1328
1328
|
var E = f.buffer, w = f.subs;
|
|
1329
|
-
w.unsubscribe(), K(l, f),
|
|
1329
|
+
w.unsubscribe(), K(l, f), c.next(E), m && h();
|
|
1330
1330
|
}, h = function() {
|
|
1331
1331
|
if (l) {
|
|
1332
1332
|
var f = new N();
|
|
1333
|
-
|
|
1333
|
+
c.add(f);
|
|
1334
1334
|
var E = [], w = {
|
|
1335
1335
|
buffer: E,
|
|
1336
1336
|
subs: f
|
|
@@ -1340,8 +1340,8 @@ function zt(n) {
|
|
|
1340
1340
|
}, n);
|
|
1341
1341
|
}
|
|
1342
1342
|
};
|
|
1343
|
-
o !== null && o >= 0 ? T(
|
|
1344
|
-
var p = R(
|
|
1343
|
+
o !== null && o >= 0 ? T(c, i, h, o, !0) : m = !0, h();
|
|
1344
|
+
var p = R(c, function(f) {
|
|
1345
1345
|
var E, w, F = l.slice();
|
|
1346
1346
|
try {
|
|
1347
1347
|
for (var k = U(F), L = k.next(); !L.done; L = k.next()) {
|
|
@@ -1359,12 +1359,12 @@ function zt(n) {
|
|
|
1359
1359
|
}
|
|
1360
1360
|
}, function() {
|
|
1361
1361
|
for (; l?.length; )
|
|
1362
|
-
|
|
1363
|
-
p?.unsubscribe(),
|
|
1362
|
+
c.next(l.shift().buffer);
|
|
1363
|
+
p?.unsubscribe(), c.complete(), c.unsubscribe();
|
|
1364
1364
|
}, void 0, function() {
|
|
1365
1365
|
return l = null;
|
|
1366
1366
|
});
|
|
1367
|
-
|
|
1367
|
+
u.subscribe(p);
|
|
1368
1368
|
});
|
|
1369
1369
|
}
|
|
1370
1370
|
function M(n, t) {
|
|
@@ -1398,8 +1398,8 @@ function Zt(n) {
|
|
|
1398
1398
|
function ve(n) {
|
|
1399
1399
|
const { endpoint: t, apiKey: e, payload: s, debugMode: r, customHeaders: i } = n, o = n.method ?? "POST";
|
|
1400
1400
|
return new y((a) => {
|
|
1401
|
-
const
|
|
1402
|
-
let
|
|
1401
|
+
const u = new AbortController();
|
|
1402
|
+
let c, l = !1, m = !1;
|
|
1403
1403
|
const v = {
|
|
1404
1404
|
"Content-Type": "application/json",
|
|
1405
1405
|
...i
|
|
@@ -1410,7 +1410,7 @@ function ve(n) {
|
|
|
1410
1410
|
method: o,
|
|
1411
1411
|
headers: v,
|
|
1412
1412
|
body: o === "POST" && s ? JSON.stringify(s) : void 0,
|
|
1413
|
-
signal:
|
|
1413
|
+
signal: u.signal,
|
|
1414
1414
|
/**
|
|
1415
1415
|
* Allow SSE to work when the page is hidden.
|
|
1416
1416
|
* https://github.com/Azure/fetch-event-source/issues/17#issuecomment-1525904929
|
|
@@ -1418,7 +1418,7 @@ function ve(n) {
|
|
|
1418
1418
|
openWhenHidden: !0,
|
|
1419
1419
|
onopen: async (p) => {
|
|
1420
1420
|
if (p.ok)
|
|
1421
|
-
|
|
1421
|
+
c = p.headers.get("X-Trace-Id") ?? void 0;
|
|
1422
1422
|
else {
|
|
1423
1423
|
let f;
|
|
1424
1424
|
try {
|
|
@@ -1430,13 +1430,13 @@ function ve(n) {
|
|
|
1430
1430
|
f = null;
|
|
1431
1431
|
}
|
|
1432
1432
|
}
|
|
1433
|
-
a.error(new I(p.status, p.statusText, f)),
|
|
1433
|
+
a.error(new I(p.status, p.statusText, f)), u.abort();
|
|
1434
1434
|
}
|
|
1435
1435
|
},
|
|
1436
1436
|
onmessage: (p) => {
|
|
1437
1437
|
p.id && (l = !0);
|
|
1438
1438
|
const f = JSON.parse(p.data);
|
|
1439
|
-
|
|
1439
|
+
c ? f.traceId = c : f.requestId && (f.traceId = f.requestId, c || (c = f.requestId)), a.next(f);
|
|
1440
1440
|
},
|
|
1441
1441
|
onclose: () => {
|
|
1442
1442
|
a.complete();
|
|
@@ -1444,10 +1444,10 @@ function ve(n) {
|
|
|
1444
1444
|
onerror: (p) => {
|
|
1445
1445
|
if (m) throw p;
|
|
1446
1446
|
if (!l)
|
|
1447
|
-
throw a.error(p),
|
|
1447
|
+
throw a.error(p), u.abort(), p;
|
|
1448
1448
|
}
|
|
1449
1449
|
}), () => {
|
|
1450
|
-
m = !0,
|
|
1450
|
+
m = !0, u.abort();
|
|
1451
1451
|
};
|
|
1452
1452
|
});
|
|
1453
1453
|
}
|
|
@@ -1594,12 +1594,12 @@ class _n {
|
|
|
1594
1594
|
lastActivityAt: a.lastActivityAt,
|
|
1595
1595
|
// F-019 — whitelist-pass the live-sandbox list (map the five backend fields); `[]` for an old
|
|
1596
1596
|
// backend / a channel with none live. metadata is the sole authority on "who is live".
|
|
1597
|
-
launchedSandboxes: (a.launchedSandboxes ?? []).map((
|
|
1598
|
-
sandboxName:
|
|
1599
|
-
sandboxBlueprintName:
|
|
1600
|
-
workingDirectory:
|
|
1601
|
-
editorServerEnabled:
|
|
1602
|
-
browserEnabled:
|
|
1597
|
+
launchedSandboxes: (a.launchedSandboxes ?? []).map((u) => ({
|
|
1598
|
+
sandboxName: u.sandboxName,
|
|
1599
|
+
sandboxBlueprintName: u.sandboxBlueprintName,
|
|
1600
|
+
workingDirectory: u.workingDirectory,
|
|
1601
|
+
editorServerEnabled: u.editorServerEnabled,
|
|
1602
|
+
browserEnabled: u.browserEnabled
|
|
1603
1603
|
}))
|
|
1604
1604
|
};
|
|
1605
1605
|
}
|
|
@@ -1749,8 +1749,8 @@ class _n {
|
|
|
1749
1749
|
});
|
|
1750
1750
|
if (!a.ok)
|
|
1751
1751
|
throw new Error(`Channel Home download failed: ${a.status} ${a.statusText}`);
|
|
1752
|
-
const
|
|
1753
|
-
return this.debugMode && console.log("[AsgardServiceClient] Channel Home download response:", { filename:
|
|
1752
|
+
const u = await a.blob(), c = t.split("/").pop() || "download";
|
|
1753
|
+
return this.debugMode && console.log("[AsgardServiceClient] Channel Home download response:", { filename: c, size: u.size }), { blob: u, filename: c };
|
|
1754
1754
|
} catch (a) {
|
|
1755
1755
|
throw console.error("[AsgardServiceClient] Channel Home download error:", a), a;
|
|
1756
1756
|
}
|
|
@@ -1842,13 +1842,13 @@ class _n {
|
|
|
1842
1842
|
if (!a.ok)
|
|
1843
1843
|
throw new I(a.status, a.statusText, await a.text().catch(() => {
|
|
1844
1844
|
}));
|
|
1845
|
-
const
|
|
1846
|
-
return { bytesWritten: (
|
|
1845
|
+
const u = await a.json();
|
|
1846
|
+
return { bytesWritten: (u.data ?? u).bytesWritten ?? 0 };
|
|
1847
1847
|
}
|
|
1848
1848
|
/** F-021 Cycle 2 — `sandbox://` fs mutation shared request helper (throws `HttpError` on non-OK). */
|
|
1849
1849
|
async sandboxFsRequest(t, e, s, r) {
|
|
1850
1850
|
const i = new URL(`${this.deriveSandboxFsEndpoint(t)}/${e}`);
|
|
1851
|
-
Object.entries(r).forEach(([a,
|
|
1851
|
+
Object.entries(r).forEach(([a, u]) => i.searchParams.set(a, u));
|
|
1852
1852
|
const o = await fetch(i.toString(), { method: s, headers: this.apiHeaders() });
|
|
1853
1853
|
if (!o.ok)
|
|
1854
1854
|
throw new I(o.status, o.statusText, await o.text().catch(() => {
|
|
@@ -1977,14 +1977,14 @@ class Ln {
|
|
|
1977
1977
|
return this.apiKey && (t["X-API-KEY"] = this.apiKey), t;
|
|
1978
1978
|
}
|
|
1979
1979
|
/** Issue one volume request, turning any non-2xx into {@link HttpError} (409 included, see R8). */
|
|
1980
|
-
async request(t, e, s, r) {
|
|
1981
|
-
const
|
|
1982
|
-
Object.entries(s).forEach(([
|
|
1983
|
-
const
|
|
1984
|
-
if (!
|
|
1985
|
-
throw new I(
|
|
1980
|
+
async request(t, e, s, r, i) {
|
|
1981
|
+
const o = new URL(`${this.endpoint}/${t}`);
|
|
1982
|
+
Object.entries(s).forEach(([u, c]) => o.searchParams.set(u, c));
|
|
1983
|
+
const a = await fetch(o.toString(), { method: e, headers: this.headers(), body: r, signal: i });
|
|
1984
|
+
if (!a.ok)
|
|
1985
|
+
throw new I(a.status, a.statusText, await a.text().catch(() => {
|
|
1986
1986
|
}));
|
|
1987
|
-
return
|
|
1987
|
+
return a;
|
|
1988
1988
|
}
|
|
1989
1989
|
/** One page of a directory (`GET volume/list?path=[&page&page_size]`). `path` may be the root `''`. */
|
|
1990
1990
|
async list(t, e) {
|
|
@@ -2007,24 +2007,24 @@ class Ln {
|
|
|
2007
2007
|
*/
|
|
2008
2008
|
async listAll(t, e) {
|
|
2009
2009
|
const s = Se(e?.pageSize ?? We), r = e?.maxEntries ?? rn, i = [];
|
|
2010
|
-
let o = 0, a = !0,
|
|
2010
|
+
let o = 0, a = !0, u = 0;
|
|
2011
2011
|
for (; ; ) {
|
|
2012
|
-
const
|
|
2013
|
-
if (l && l.index !==
|
|
2012
|
+
const c = await this.list(t, { page: u, pageSize: s }), l = c.paging;
|
|
2013
|
+
if (l && l.index !== u) {
|
|
2014
2014
|
o = l.total, a = !1;
|
|
2015
2015
|
break;
|
|
2016
2016
|
}
|
|
2017
|
-
if (i.push(...
|
|
2018
|
-
a =
|
|
2017
|
+
if (i.push(...c.entries), !l) {
|
|
2018
|
+
a = c.entries.length < s;
|
|
2019
2019
|
break;
|
|
2020
2020
|
}
|
|
2021
2021
|
if (o = l.total, i.length >= o)
|
|
2022
2022
|
break;
|
|
2023
|
-
if (i.length >= r ||
|
|
2023
|
+
if (i.length >= r || c.entries.length === 0) {
|
|
2024
2024
|
a = !1;
|
|
2025
2025
|
break;
|
|
2026
2026
|
}
|
|
2027
|
-
|
|
2027
|
+
u += 1;
|
|
2028
2028
|
}
|
|
2029
2029
|
return { entries: i, total: o, complete: a };
|
|
2030
2030
|
}
|
|
@@ -2060,12 +2060,12 @@ class Ln {
|
|
|
2060
2060
|
s?.mode != null && (r.mode = String(s.mode)), s?.createOnly && (r.create_only = "true");
|
|
2061
2061
|
const i = new FormData();
|
|
2062
2062
|
i.append("file", e instanceof Blob ? e : new Blob([e]));
|
|
2063
|
-
const a = await (await this.request("file", "PUT", r, i)).json();
|
|
2063
|
+
const a = await (await this.request("file", "PUT", r, i, s?.signal)).json();
|
|
2064
2064
|
return { bytesWritten: (a.data ?? a).bytesWritten ?? 0 };
|
|
2065
2065
|
}
|
|
2066
2066
|
/** Create a directory and any missing parents (`POST volume/mkdir?path=`). */
|
|
2067
|
-
async mkdir(t) {
|
|
2068
|
-
await this.request("mkdir", "POST", { path: C(t) });
|
|
2067
|
+
async mkdir(t, e) {
|
|
2068
|
+
await this.request("mkdir", "POST", { path: C(t) }, void 0, e?.signal);
|
|
2069
2069
|
}
|
|
2070
2070
|
/** Delete a file or empty directory (`DELETE volume/item?path=`). */
|
|
2071
2071
|
async remove(t) {
|
|
@@ -2369,10 +2369,10 @@ class g {
|
|
|
2369
2369
|
const s = e.template?.type === Te.CANVAS ? e.template : void 0, r = s?.canvas?.html;
|
|
2370
2370
|
if (!r) {
|
|
2371
2371
|
if (!this.messages?.has(e.messageId)) return this;
|
|
2372
|
-
const
|
|
2373
|
-
return
|
|
2372
|
+
const c = new Map(this.messages);
|
|
2373
|
+
return c.delete(e.messageId), new g({ messages: c, pendingConsent: this.pendingConsent });
|
|
2374
2374
|
}
|
|
2375
|
-
const i = this.messages?.get(e.messageId), o = i?.type === "canvas" ? i : void 0, a = new Map(this.messages),
|
|
2375
|
+
const i = this.messages?.get(e.messageId), o = i?.type === "canvas" ? i : void 0, a = new Map(this.messages), u = {
|
|
2376
2376
|
type: "canvas",
|
|
2377
2377
|
messageId: e.messageId,
|
|
2378
2378
|
// **Replace, never append.** This fragment is authoritative, and a rejoin replays only the
|
|
@@ -2383,7 +2383,7 @@ class g {
|
|
|
2383
2383
|
time: o?.time ?? /* @__PURE__ */ new Date(),
|
|
2384
2384
|
traceId: t.traceId ?? o?.traceId
|
|
2385
2385
|
};
|
|
2386
|
-
return a.set(e.messageId,
|
|
2386
|
+
return a.set(e.messageId, u), new g({ messages: a, pendingConsent: this.pendingConsent });
|
|
2387
2387
|
}
|
|
2388
2388
|
onMessageUser(t) {
|
|
2389
2389
|
const e = t.fact.messageUser;
|
|
@@ -2530,10 +2530,10 @@ function fn(n) {
|
|
|
2530
2530
|
// initial status = pending (keep existing on repeat)
|
|
2531
2531
|
});
|
|
2532
2532
|
} else if (s.toolName === "TaskUpdate") {
|
|
2533
|
-
const o = we(i.statusChange), a = x(r.taskId) || x(i.taskId),
|
|
2534
|
-
if (!a || !
|
|
2535
|
-
const
|
|
2536
|
-
|
|
2533
|
+
const o = we(i.statusChange), a = x(r.taskId) || x(i.taskId), u = x(o?.to) || x(r.status);
|
|
2534
|
+
if (!a || !u) continue;
|
|
2535
|
+
const c = e.get(a);
|
|
2536
|
+
c && e.set(a, { ...c, status: u });
|
|
2537
2537
|
}
|
|
2538
2538
|
}
|
|
2539
2539
|
return t.map((s) => e.get(s));
|
|
@@ -2880,8 +2880,8 @@ class X {
|
|
|
2880
2880
|
i,
|
|
2881
2881
|
o,
|
|
2882
2882
|
a,
|
|
2883
|
-
|
|
2884
|
-
|
|
2883
|
+
u,
|
|
2884
|
+
c
|
|
2885
2885
|
]) => ({
|
|
2886
2886
|
isConnecting: t,
|
|
2887
2887
|
conversation: e,
|
|
@@ -2890,8 +2890,8 @@ class X {
|
|
|
2890
2890
|
channelTitle: i,
|
|
2891
2891
|
promptSuggestion: o,
|
|
2892
2892
|
sandboxPhase: a,
|
|
2893
|
-
launchedSandboxes:
|
|
2894
|
-
runStatus:
|
|
2893
|
+
launchedSandboxes: u,
|
|
2894
|
+
runStatus: c
|
|
2895
2895
|
})
|
|
2896
2896
|
)
|
|
2897
2897
|
).subscribe(this.statesObserver);
|