@jokio/sdk 0.4.1 → 0.4.2
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/auth.service.d.ts +5 -4
- package/dist/jokio.sdk.es.js +127 -146
- package/dist/jokio.sdk.umd.js +9 -9
- package/package.json +1 -1
package/dist/jokio.sdk.es.js
CHANGED
|
@@ -329,34 +329,15 @@ async function Ji(r) {
|
|
|
329
329
|
authenticatorAttachment: Yr(a.authenticatorAttachment)
|
|
330
330
|
};
|
|
331
331
|
}
|
|
332
|
-
const
|
|
332
|
+
const yt = "ACCESS_TOKEN", _r = "SESSION_SEED", wt = "LAST_AUTH_DATA";
|
|
333
333
|
class Xr {
|
|
334
334
|
constructor(e) {
|
|
335
335
|
h(this, "onUserDataUpdate");
|
|
336
|
-
|
|
337
|
-
h(this, "isAuthenticatedResolver", () => {
|
|
338
|
-
});
|
|
339
|
-
this.options = e, this.isAuthenticated = new Promise(
|
|
340
|
-
(t) => this.isAuthenticatedResolver = t
|
|
341
|
-
);
|
|
336
|
+
this.options = e;
|
|
342
337
|
}
|
|
343
338
|
get url() {
|
|
344
339
|
return this.options.authUrl;
|
|
345
340
|
}
|
|
346
|
-
async init() {
|
|
347
|
-
var t, s;
|
|
348
|
-
const e = localStorage.getItem(Ze);
|
|
349
|
-
if (e)
|
|
350
|
-
try {
|
|
351
|
-
const i = JSON.parse(e);
|
|
352
|
-
(t = this.onUserDataUpdate) == null || t.call(this, i), this.isAuthenticatedResolver();
|
|
353
|
-
} catch {
|
|
354
|
-
}
|
|
355
|
-
else {
|
|
356
|
-
const i = await this.me();
|
|
357
|
-
await this.options.storage.setItem(Ze, i), (s = this.onUserDataUpdate) == null || s.call(this, i), this.isAuthenticatedResolver();
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
341
|
async me() {
|
|
361
342
|
return await fetch(this.options.authUrl + "/me", {
|
|
362
343
|
headers: await this.getAuthHeader()
|
|
@@ -379,9 +360,9 @@ class Xr {
|
|
|
379
360
|
}
|
|
380
361
|
).then(xt);
|
|
381
362
|
return await this.options.storage.setItem(
|
|
382
|
-
|
|
363
|
+
yt,
|
|
383
364
|
s.accessToken
|
|
384
|
-
), await this.options.storage.setItem(
|
|
365
|
+
), await this.options.storage.setItem(wt, s.jwtData), (i = this.onUserDataUpdate) == null || i.call(this, s.jwtData), s.jwtData;
|
|
385
366
|
}
|
|
386
367
|
async requestPasskeyLogin(e = {}) {
|
|
387
368
|
var f, p;
|
|
@@ -419,9 +400,9 @@ class Xr {
|
|
|
419
400
|
}
|
|
420
401
|
).then(xt);
|
|
421
402
|
return await this.options.storage.setItem(
|
|
422
|
-
|
|
403
|
+
yt,
|
|
423
404
|
a.accessToken
|
|
424
|
-
), await this.options.storage.setItem(
|
|
405
|
+
), await this.options.storage.setItem(wt, a.jwtData), (p = this.onUserDataUpdate) == null || p.call(this, a.jwtData), a.jwtData;
|
|
425
406
|
}
|
|
426
407
|
async guestLogin() {
|
|
427
408
|
var t;
|
|
@@ -429,24 +410,24 @@ class Xr {
|
|
|
429
410
|
this.options.authUrl + "/guest-session"
|
|
430
411
|
).then(xt);
|
|
431
412
|
return await this.options.storage.setItem(
|
|
432
|
-
|
|
413
|
+
yt,
|
|
433
414
|
e.accessToken
|
|
434
415
|
), await this.options.storage.setItem(
|
|
435
416
|
_r,
|
|
436
417
|
e.sessionSeed
|
|
437
|
-
), await this.options.storage.setItem(
|
|
418
|
+
), await this.options.storage.setItem(wt, e.jwtData), (t = this.onUserDataUpdate) == null || t.call(this, e.jwtData), e.jwtData;
|
|
438
419
|
}
|
|
439
420
|
signOut() {
|
|
440
421
|
var e;
|
|
441
|
-
this.options.storage.removeItem(
|
|
422
|
+
this.options.storage.removeItem(yt), this.options.storage.removeItem(wt), (e = this.onUserDataUpdate) == null || e.call(this, null);
|
|
442
423
|
}
|
|
443
424
|
getLastLoginData() {
|
|
444
425
|
return this.options.storage.getItem(
|
|
445
|
-
|
|
426
|
+
wt
|
|
446
427
|
);
|
|
447
428
|
}
|
|
448
429
|
getAccessToken() {
|
|
449
|
-
return this.options.storage.getItem(
|
|
430
|
+
return this.options.storage.getItem(yt);
|
|
450
431
|
}
|
|
451
432
|
getSessionSeed() {
|
|
452
433
|
return this.options.storage.getItem(_r);
|
|
@@ -710,7 +691,7 @@ function cs(r, ...e) {
|
|
|
710
691
|
function Kt(r) {
|
|
711
692
|
return xe.decode(r).replace(/\n/g, "␊").replace(/\r/g, "␍");
|
|
712
693
|
}
|
|
713
|
-
function
|
|
694
|
+
function ut(r, e = !0) {
|
|
714
695
|
const t = e ? T.errorForCode(k.Timeout) : null;
|
|
715
696
|
let s, i;
|
|
716
697
|
const n = new Promise((o, a) => {
|
|
@@ -724,7 +705,7 @@ function lt(r, e = !0) {
|
|
|
724
705
|
});
|
|
725
706
|
return Object.assign(n, s);
|
|
726
707
|
}
|
|
727
|
-
function
|
|
708
|
+
function dt(r = 0) {
|
|
728
709
|
let e;
|
|
729
710
|
const t = new Promise((s) => {
|
|
730
711
|
const i = setTimeout(() => {
|
|
@@ -1056,7 +1037,7 @@ class Qs {
|
|
|
1056
1037
|
}
|
|
1057
1038
|
}
|
|
1058
1039
|
h(Qs, "jc");
|
|
1059
|
-
function
|
|
1040
|
+
function ot(r) {
|
|
1060
1041
|
return hs("durable", r);
|
|
1061
1042
|
}
|
|
1062
1043
|
function pe(r) {
|
|
@@ -1130,7 +1111,7 @@ function on(r, e, t) {
|
|
|
1130
1111
|
}, n = new Qs(i, ve, {});
|
|
1131
1112
|
return n._headers = s, n._subject = t, n;
|
|
1132
1113
|
}
|
|
1133
|
-
function
|
|
1114
|
+
function at(r) {
|
|
1134
1115
|
if (r.data.length !== 0)
|
|
1135
1116
|
return null;
|
|
1136
1117
|
const e = r.headers;
|
|
@@ -1320,10 +1301,10 @@ var ce;
|
|
|
1320
1301
|
(function(r) {
|
|
1321
1302
|
r.None = "none", r.All = "all", r.Explicit = "explicit", r.NotSet = "";
|
|
1322
1303
|
})(ce || (ce = {}));
|
|
1323
|
-
var
|
|
1304
|
+
var lt;
|
|
1324
1305
|
(function(r) {
|
|
1325
1306
|
r.Instant = "instant", r.Original = "original";
|
|
1326
|
-
})(
|
|
1307
|
+
})(lt || (lt = {}));
|
|
1327
1308
|
var Ve;
|
|
1328
1309
|
(function(r) {
|
|
1329
1310
|
r.None = "none", r.S2 = "s2";
|
|
@@ -1338,7 +1319,7 @@ function cn(r, e = {}) {
|
|
|
1338
1319
|
deliver_policy: se.All,
|
|
1339
1320
|
ack_policy: ce.Explicit,
|
|
1340
1321
|
ack_wait: W(30 * 1e3),
|
|
1341
|
-
replay_policy:
|
|
1322
|
+
replay_policy: lt.Instant
|
|
1342
1323
|
}, e);
|
|
1343
1324
|
}
|
|
1344
1325
|
var kr;
|
|
@@ -1353,10 +1334,10 @@ var Re;
|
|
|
1353
1334
|
(function(r) {
|
|
1354
1335
|
r.LastValue = "", r.AllHistory = "history", r.UpdatesOnly = "updates";
|
|
1355
1336
|
})(Re || (Re = {}));
|
|
1356
|
-
var
|
|
1337
|
+
var it;
|
|
1357
1338
|
(function(r) {
|
|
1358
1339
|
r.Stream = "Nats-Stream", r.Sequence = "Nats-Sequence", r.TimeStamp = "Nats-Time-Stamp", r.Subject = "Nats-Subject";
|
|
1359
|
-
})(
|
|
1340
|
+
})(it || (it = {}));
|
|
1360
1341
|
var Or;
|
|
1361
1342
|
(function(r) {
|
|
1362
1343
|
r.Stream = "Nats-Stream", r.Subject = "Nats-Subject", r.Sequence = "Nats-Sequence", r.LastSequence = "Nats-Last-Sequence", r.Size = "Nats-Msg-Size";
|
|
@@ -1399,7 +1380,7 @@ class hn {
|
|
|
1399
1380
|
return this.config.deliver_subject = e, this;
|
|
1400
1381
|
}
|
|
1401
1382
|
durable(e) {
|
|
1402
|
-
return
|
|
1383
|
+
return ot(e), this.config.durable_name = e, this;
|
|
1403
1384
|
}
|
|
1404
1385
|
startSequence(e) {
|
|
1405
1386
|
if (e <= 0)
|
|
@@ -1446,10 +1427,10 @@ class hn {
|
|
|
1446
1427
|
return this.filters = this.filters || [], this.filters.push(e), this;
|
|
1447
1428
|
}
|
|
1448
1429
|
replayInstantly() {
|
|
1449
|
-
return this.config.replay_policy =
|
|
1430
|
+
return this.config.replay_policy = lt.Instant, this;
|
|
1450
1431
|
}
|
|
1451
1432
|
replayOriginal() {
|
|
1452
|
-
return this.config.replay_policy =
|
|
1433
|
+
return this.config.replay_policy = lt.Original, this;
|
|
1453
1434
|
}
|
|
1454
1435
|
sample(e) {
|
|
1455
1436
|
if (e = Math.trunc(e), e < 0 || e > 100)
|
|
@@ -1532,12 +1513,12 @@ class un {
|
|
|
1532
1513
|
return t ? Uint8Array.from(s, (i) => i.charCodeAt(0)) : s;
|
|
1533
1514
|
}
|
|
1534
1515
|
}
|
|
1535
|
-
class
|
|
1516
|
+
class ct {
|
|
1536
1517
|
static encode(e) {
|
|
1537
|
-
return
|
|
1518
|
+
return ct.toB64URLEncoding(un.encode(e));
|
|
1538
1519
|
}
|
|
1539
1520
|
static decode(e, t = !1) {
|
|
1540
|
-
return
|
|
1521
|
+
return ct.decode(ct.fromB64URLEncoding(e), t);
|
|
1541
1522
|
}
|
|
1542
1523
|
static toB64URLEncoding(e) {
|
|
1543
1524
|
return e.replace(/\+/g, "-").replace(/\//g, "_");
|
|
@@ -1546,7 +1527,7 @@ class ht {
|
|
|
1546
1527
|
return e.replace(/_/g, "/").replace(/-/g, "+");
|
|
1547
1528
|
}
|
|
1548
1529
|
}
|
|
1549
|
-
class
|
|
1530
|
+
class ft {
|
|
1550
1531
|
constructor() {
|
|
1551
1532
|
h(this, "buffers");
|
|
1552
1533
|
h(this, "byteLength");
|
|
@@ -2007,7 +1988,7 @@ class ri extends si {
|
|
|
2007
1988
|
super(t, s, n);
|
|
2008
1989
|
h(this, "deferred");
|
|
2009
1990
|
h(this, "timer");
|
|
2010
|
-
this.deferred = Y(), this.timer =
|
|
1991
|
+
this.deferred = Y(), this.timer = ut(i.timeout, n);
|
|
2011
1992
|
}
|
|
2012
1993
|
resolver(t, s) {
|
|
2013
1994
|
this.timer && this.timer.cancel(), t ? (this.ctx && (t.stack += `
|
|
@@ -2057,7 +2038,7 @@ class Tt {
|
|
|
2057
2038
|
} catch (f) {
|
|
2058
2039
|
const p = f;
|
|
2059
2040
|
if ((p.code === "503" || p.code === k.Timeout) && a + 1 < n)
|
|
2060
|
-
await
|
|
2041
|
+
await dt(o.backoff(a));
|
|
2061
2042
|
else
|
|
2062
2043
|
throw f;
|
|
2063
2044
|
}
|
|
@@ -2138,7 +2119,7 @@ class At {
|
|
|
2138
2119
|
}
|
|
2139
2120
|
}
|
|
2140
2121
|
}
|
|
2141
|
-
function
|
|
2122
|
+
function Ze(r = "") {
|
|
2142
2123
|
const e = r.match(/(\d+).(\d+).(\d+)/);
|
|
2143
2124
|
if (e)
|
|
2144
2125
|
return {
|
|
@@ -2172,14 +2153,14 @@ class An {
|
|
|
2172
2153
|
return this.disabled.indexOf(e) !== -1;
|
|
2173
2154
|
}
|
|
2174
2155
|
update(e) {
|
|
2175
|
-
typeof e == "string" && (e =
|
|
2156
|
+
typeof e == "string" && (e = Ze(e)), this.server = e, this.set(H.JS_KV, "2.6.2"), this.set(H.JS_OBJECTSTORE, "2.6.3"), this.set(H.JS_PULL_MAX_BYTES, "2.8.3"), this.set(H.JS_NEW_CONSUMER_CREATE_API, "2.9.0"), this.set(H.JS_ALLOW_DIRECT, "2.9.0"), this.set(H.JS_MULTIPLE_CONSUMER_FILTER, "2.10.0"), this.set(H.JS_SIMPLIFICATION, "2.9.4"), this.set(H.JS_STREAM_CONSUMER_METADATA, "2.10.0"), this.set(H.JS_CONSUMER_FILTER_SUBJECTS, "2.10.0"), this.set(H.JS_STREAM_FIRST_SEQ, "2.10.0"), this.set(H.JS_STREAM_SUBJECT_TRANSFORM, "2.10.0"), this.set(H.JS_STREAM_SOURCE_SUBJECT_TRANSFORM, "2.10.0"), this.set(H.JS_STREAM_COMPRESSION, "2.10.0"), this.set(H.JS_DEFAULT_CONSUMER_LIMITS, "2.10.0"), this.set(H.JS_BATCH_DIRECT_GET, "2.11.0"), this.disabled.forEach((t) => {
|
|
2176
2157
|
this.features.delete(t);
|
|
2177
2158
|
});
|
|
2178
2159
|
}
|
|
2179
2160
|
set(e, t) {
|
|
2180
2161
|
this.features.set(e, {
|
|
2181
2162
|
min: t,
|
|
2182
|
-
ok: Ds(this.server,
|
|
2163
|
+
ok: Ds(this.server, Ze(t)) >= 0
|
|
2183
2164
|
});
|
|
2184
2165
|
}
|
|
2185
2166
|
get(e) {
|
|
@@ -2193,7 +2174,7 @@ class An {
|
|
|
2193
2174
|
return ((t = this.get(e)) == null ? void 0 : t.ok) || !1;
|
|
2194
2175
|
}
|
|
2195
2176
|
require(e) {
|
|
2196
|
-
return typeof e == "string" && (e =
|
|
2177
|
+
return typeof e == "string" && (e = Ze(e)), Ds(this.server, e) >= 0;
|
|
2197
2178
|
}
|
|
2198
2179
|
}
|
|
2199
2180
|
class rs extends Tt {
|
|
@@ -2206,7 +2187,7 @@ class rs extends Tt {
|
|
|
2206
2187
|
if (t.deliver_group && t.idle_heartbeat)
|
|
2207
2188
|
throw new Error("jetstream idle heartbeat is not supported with queue groups");
|
|
2208
2189
|
const i = {};
|
|
2209
|
-
i.config = t, i.stream_name = e, i.action = s, i.config.durable_name &&
|
|
2190
|
+
i.config = t, i.stream_name = e, i.action = s, i.config.durable_name && ot(i.config.durable_name);
|
|
2210
2191
|
const n = this.nc;
|
|
2211
2192
|
let { min: o, ok: a } = n.features.get(H.JS_NEW_CONSUMER_CREATE_API);
|
|
2212
2193
|
const f = t.name === "" ? void 0 : t.name;
|
|
@@ -2243,10 +2224,10 @@ class rs extends Tt {
|
|
|
2243
2224
|
return this.add(e, Object.assign(i.config, n), ss.Update);
|
|
2244
2225
|
}
|
|
2245
2226
|
async info(e, t) {
|
|
2246
|
-
return pe(e),
|
|
2227
|
+
return pe(e), ot(t), await this._request(`${this.prefix}.CONSUMER.INFO.${e}.${t}`);
|
|
2247
2228
|
}
|
|
2248
2229
|
async delete(e, t) {
|
|
2249
|
-
return pe(e),
|
|
2230
|
+
return pe(e), ot(t), (await this._request(`${this.prefix}.CONSUMER.DELETE.${e}.${t}`)).success;
|
|
2250
2231
|
}
|
|
2251
2232
|
list(e) {
|
|
2252
2233
|
pe(e);
|
|
@@ -2263,7 +2244,7 @@ class rs extends Tt {
|
|
|
2263
2244
|
return this.pause(e, t, /* @__PURE__ */ new Date(0));
|
|
2264
2245
|
}
|
|
2265
2246
|
}
|
|
2266
|
-
function
|
|
2247
|
+
function rt(r, e, t = !1) {
|
|
2267
2248
|
if (t === !0 && !r)
|
|
2268
2249
|
throw T.errorForCode(k.ApiError, new Error(`${e} is not a function`));
|
|
2269
2250
|
if (r && typeof r != "function")
|
|
@@ -2275,7 +2256,7 @@ class Pn extends he {
|
|
|
2275
2256
|
h(this, "sub");
|
|
2276
2257
|
h(this, "adapter");
|
|
2277
2258
|
h(this, "subIterDone");
|
|
2278
|
-
|
|
2259
|
+
rt(i.adapter, "adapter", !0), this.adapter = i.adapter, i.callback && rt(i.callback, "callback"), this.noIterator = typeof i.callback == "function", i.ingestionFilterFn && (rt(i.ingestionFilterFn, "ingestionFilterFn"), this.ingestionFilterFn = i.ingestionFilterFn), i.protocolFilterFn && (rt(i.protocolFilterFn, "protocolFilterFn"), this.protocolFilterFn = i.protocolFilterFn), i.dispatchedFn && (rt(i.dispatchedFn, "dispatchedFn"), this.dispatchedFn = i.dispatchedFn), i.cleanupFn && rt(i.cleanupFn, "cleanupFn");
|
|
2279
2260
|
let n = (g, y) => {
|
|
2280
2261
|
this.callback(g, y);
|
|
2281
2262
|
};
|
|
@@ -2369,7 +2350,7 @@ function Hs() {
|
|
|
2369
2350
|
return Se !== void 0 && Se.dnsResolveFn ? Se.dnsResolveFn : void 0;
|
|
2370
2351
|
}
|
|
2371
2352
|
const Yt = `\r
|
|
2372
|
-
`, is =
|
|
2353
|
+
`, is = ft.fromAscii(Yt), Cn = new Uint8Array(is)[0], In = new Uint8Array(is)[1];
|
|
2373
2354
|
function jn(r) {
|
|
2374
2355
|
for (let e = 0; e < r.length; e++) {
|
|
2375
2356
|
const t = e + 1;
|
|
@@ -3584,7 +3565,7 @@ var C;
|
|
|
3584
3565
|
252
|
|
3585
3566
|
]);
|
|
3586
3567
|
function ie(c, l, u, d, m, b) {
|
|
3587
|
-
var v, E, _, S, M = new Uint32Array(17), D = new Uint32Array(17), Z = new Uint32Array(17), je = new Uint32Array(17),
|
|
3568
|
+
var v, E, _, S, M = new Uint32Array(17), D = new Uint32Array(17), Z = new Uint32Array(17), je = new Uint32Array(17), st = new Uint32Array(17);
|
|
3588
3569
|
for (_ = 0; _ < 17; _++) D[_] = Z[_] = 0;
|
|
3589
3570
|
for (_ = 0; _ < 16; _++) D[_] = b[_];
|
|
3590
3571
|
for (D[3] &= 15, D[4] &= 252, D[7] &= 15, D[8] &= 252, D[11] &= 15, D[12] &= 252, D[15] &= 15; m > 0; ) {
|
|
@@ -3599,8 +3580,8 @@ var C;
|
|
|
3599
3580
|
S = S + Z[_] | 0, Z[_] = S & 255, S >>>= 8;
|
|
3600
3581
|
S = S + Z[16] | 0, Z[16] = S;
|
|
3601
3582
|
}
|
|
3602
|
-
for (_ = 0; _ < 17; _++)
|
|
3603
|
-
for (re(Z, ne), v = -(Z[16] >>> 7) | 0, _ = 0; _ < 17; _++) Z[_] ^= v & (
|
|
3583
|
+
for (_ = 0; _ < 17; _++) st[_] = Z[_];
|
|
3584
|
+
for (re(Z, ne), v = -(Z[16] >>> 7) | 0, _ = 0; _ < 17; _++) Z[_] ^= v & (st[_] ^ Z[_]);
|
|
3604
3585
|
for (_ = 0; _ < 16; _++) je[_] = b[_ + 16];
|
|
3605
3586
|
for (je[16] = 0, re(Z, je), _ = 0; _ < 16; _++) c[l + _] = Z[_];
|
|
3606
3587
|
return 0;
|
|
@@ -3634,7 +3615,7 @@ var C;
|
|
|
3634
3615
|
for (var d, m = ~(u - 1), b = 0; b < 16; b++)
|
|
3635
3616
|
d = m & (c[b] ^ l[b]), c[b] ^= d, l[b] ^= d;
|
|
3636
3617
|
}
|
|
3637
|
-
function
|
|
3618
|
+
function Qe(c, l) {
|
|
3638
3619
|
var u, d, m, b = t(), v = t();
|
|
3639
3620
|
for (u = 0; u < 16; u++) v[u] = l[u];
|
|
3640
3621
|
for (te(v), te(v), te(v), d = 0; d < 2; d++) {
|
|
@@ -3647,11 +3628,11 @@ var C;
|
|
|
3647
3628
|
}
|
|
3648
3629
|
function nr(c, l) {
|
|
3649
3630
|
var u = new Uint8Array(32), d = new Uint8Array(32);
|
|
3650
|
-
return
|
|
3631
|
+
return Qe(u, c), Qe(d, l), w(u, 0, d, 0);
|
|
3651
3632
|
}
|
|
3652
3633
|
function or(c) {
|
|
3653
3634
|
var l = new Uint8Array(32);
|
|
3654
|
-
return
|
|
3635
|
+
return Qe(l, c), l[0] & 1;
|
|
3655
3636
|
}
|
|
3656
3637
|
function ds(c, l) {
|
|
3657
3638
|
var u;
|
|
@@ -3703,8 +3684,8 @@ var C;
|
|
|
3703
3684
|
b = d[v >>> 3] >>> (v & 7) & 1, ae(E, _, b), ae(S, M, b), Ce(D, E, S), Ie(E, E, S), Ce(S, _, M), Ie(_, _, M), Ee(M, D), Ee(Z, E), B(E, S, E), B(S, _, D), Ce(D, E, S), Ie(E, E, S), Ee(_, E), Ie(S, M, Z), B(E, S, f), Ce(E, E, M), B(S, S, E), B(E, M, Z), B(M, _, m), Ee(_, D), ae(E, _, b), ae(S, M, b);
|
|
3704
3685
|
for (v = 0; v < 16; v++)
|
|
3705
3686
|
m[v + 16] = E[v], m[v + 32] = S[v], m[v + 48] = _[v], m[v + 64] = M[v];
|
|
3706
|
-
var je = m.subarray(32),
|
|
3707
|
-
return ar(je, je), B(
|
|
3687
|
+
var je = m.subarray(32), st = m.subarray(16);
|
|
3688
|
+
return ar(je, je), B(st, st, je), Qe(c, st), 0;
|
|
3708
3689
|
}
|
|
3709
3690
|
function $t(c, l) {
|
|
3710
3691
|
return Ut(c, l, n);
|
|
@@ -3725,7 +3706,7 @@ var C;
|
|
|
3725
3706
|
var v = new Uint8Array(32);
|
|
3726
3707
|
return Lt(v, m, b), wi(c, l, u, d, v);
|
|
3727
3708
|
}
|
|
3728
|
-
function
|
|
3709
|
+
function pt() {
|
|
3729
3710
|
var c = 0, l = 0, u = 0, d = 0, m = 65535, b, v, E;
|
|
3730
3711
|
for (E = 0; E < arguments.length; E++)
|
|
3731
3712
|
b = arguments[E].lo, v = arguments[E].hi, c += b & m, l += b >>> 16, u += v & m, d += v >>> 16;
|
|
@@ -3853,13 +3834,13 @@ var C;
|
|
|
3853
3834
|
for (_ = 0; _ < 16; _++) v[_] = J(l, 8 * _ + M);
|
|
3854
3835
|
for (_ = 0; _ < 80; _++) {
|
|
3855
3836
|
for (S = 0; S < 8; S++) m[S] = b[S];
|
|
3856
|
-
for (E =
|
|
3837
|
+
for (E = pt(b[7], Pi(b[4]), vi(b[4], b[5], b[6]), Ci[_], v[_ % 16]), m[7] = pt(E, Ai(b[0]), Ei(b[0], b[1], b[2])), m[3] = pt(m[3], E), S = 0; S < 8; S++) b[(S + 1) % 8] = m[S];
|
|
3857
3838
|
if (_ % 16 === 15)
|
|
3858
3839
|
for (S = 0; S < 16; S++)
|
|
3859
|
-
v[S] =
|
|
3840
|
+
v[S] = pt(v[S], v[(S + 9) % 16], ki(v[(S + 1) % 16]), Oi(v[(S + 14) % 16]));
|
|
3860
3841
|
}
|
|
3861
3842
|
for (_ = 0; _ < 8; _++)
|
|
3862
|
-
b[_] =
|
|
3843
|
+
b[_] = pt(b[_], d[_]), d[_] = b[_];
|
|
3863
3844
|
M += 128, u -= 128;
|
|
3864
3845
|
}
|
|
3865
3846
|
for (_ = 0; _ < 8; _++) L(c, 8 * _, d[_]);
|
|
@@ -3950,7 +3931,7 @@ var C;
|
|
|
3950
3931
|
}
|
|
3951
3932
|
function ps(c, l) {
|
|
3952
3933
|
var u = t(), d = t(), m = t();
|
|
3953
|
-
ar(m, l[2]), B(u, l[0], m), B(d, l[1], m),
|
|
3934
|
+
ar(m, l[2]), B(u, l[0], m), B(d, l[1], m), Qe(c, d), c[31] ^= or(u) << 7;
|
|
3954
3935
|
}
|
|
3955
3936
|
function ms(c, l, u) {
|
|
3956
3937
|
var d, m;
|
|
@@ -4074,7 +4055,7 @@ var C;
|
|
|
4074
4055
|
for (m = 0; m < u; m++) c[m] = l[m + 64];
|
|
4075
4056
|
return u;
|
|
4076
4057
|
}
|
|
4077
|
-
var ws = 32, Ht = 24,
|
|
4058
|
+
var ws = 32, Ht = 24, mt = 32, et = 16, bt = 32, Jt = 32, gt = 32, _t = 32, xs = 32, mr = Ht, Ri = mt, Ni = et, Le = 64, Xe = 32, tt = 64, Ss = 32, vs = 64;
|
|
4078
4059
|
r.lowlevel = {
|
|
4079
4060
|
crypto_core_hsalsa20: R,
|
|
4080
4061
|
crypto_stream_xor: V,
|
|
@@ -4100,25 +4081,25 @@ var C;
|
|
|
4100
4081
|
crypto_sign_open: ys,
|
|
4101
4082
|
crypto_secretbox_KEYBYTES: ws,
|
|
4102
4083
|
crypto_secretbox_NONCEBYTES: Ht,
|
|
4103
|
-
crypto_secretbox_ZEROBYTES:
|
|
4104
|
-
crypto_secretbox_BOXZEROBYTES:
|
|
4105
|
-
crypto_scalarmult_BYTES:
|
|
4084
|
+
crypto_secretbox_ZEROBYTES: mt,
|
|
4085
|
+
crypto_secretbox_BOXZEROBYTES: et,
|
|
4086
|
+
crypto_scalarmult_BYTES: bt,
|
|
4106
4087
|
crypto_scalarmult_SCALARBYTES: Jt,
|
|
4107
|
-
crypto_box_PUBLICKEYBYTES:
|
|
4108
|
-
crypto_box_SECRETKEYBYTES:
|
|
4088
|
+
crypto_box_PUBLICKEYBYTES: gt,
|
|
4089
|
+
crypto_box_SECRETKEYBYTES: _t,
|
|
4109
4090
|
crypto_box_BEFORENMBYTES: xs,
|
|
4110
4091
|
crypto_box_NONCEBYTES: mr,
|
|
4111
4092
|
crypto_box_ZEROBYTES: Ri,
|
|
4112
4093
|
crypto_box_BOXZEROBYTES: Ni,
|
|
4113
4094
|
crypto_sign_BYTES: Le,
|
|
4114
4095
|
crypto_sign_PUBLICKEYBYTES: Xe,
|
|
4115
|
-
crypto_sign_SECRETKEYBYTES:
|
|
4096
|
+
crypto_sign_SECRETKEYBYTES: tt,
|
|
4116
4097
|
crypto_sign_SEEDBYTES: Ss,
|
|
4117
4098
|
crypto_hash_BYTES: vs,
|
|
4118
4099
|
gf: t,
|
|
4119
4100
|
D: p,
|
|
4120
4101
|
L: Dt,
|
|
4121
|
-
pack25519:
|
|
4102
|
+
pack25519: Qe,
|
|
4122
4103
|
unpack25519: ds,
|
|
4123
4104
|
M: B,
|
|
4124
4105
|
A: Ce,
|
|
@@ -4136,8 +4117,8 @@ var C;
|
|
|
4136
4117
|
if (l.length !== Ht) throw new Error("bad nonce size");
|
|
4137
4118
|
}
|
|
4138
4119
|
function Ti(c, l) {
|
|
4139
|
-
if (c.length !==
|
|
4140
|
-
if (l.length !==
|
|
4120
|
+
if (c.length !== gt) throw new Error("bad public key size");
|
|
4121
|
+
if (l.length !== _t) throw new Error("bad secret key size");
|
|
4141
4122
|
}
|
|
4142
4123
|
function _e() {
|
|
4143
4124
|
for (var c = 0; c < arguments.length; c++)
|
|
@@ -4151,22 +4132,22 @@ var C;
|
|
|
4151
4132
|
return s(l, c), l;
|
|
4152
4133
|
}, r.secretbox = function(c, l, u) {
|
|
4153
4134
|
_e(c, l, u), br(u, l);
|
|
4154
|
-
for (var d = new Uint8Array(
|
|
4155
|
-
return ue(m, d, d.length, l, u), m.subarray(
|
|
4135
|
+
for (var d = new Uint8Array(mt + c.length), m = new Uint8Array(d.length), b = 0; b < c.length; b++) d[b + mt] = c[b];
|
|
4136
|
+
return ue(m, d, d.length, l, u), m.subarray(et);
|
|
4156
4137
|
}, r.secretbox.open = function(c, l, u) {
|
|
4157
4138
|
_e(c, l, u), br(u, l);
|
|
4158
|
-
for (var d = new Uint8Array(
|
|
4159
|
-
return d.length < 32 || le(m, d, d.length, l, u) !== 0 ? null : m.subarray(
|
|
4160
|
-
}, r.secretbox.keyLength = ws, r.secretbox.nonceLength = Ht, r.secretbox.overheadLength =
|
|
4139
|
+
for (var d = new Uint8Array(et + c.length), m = new Uint8Array(d.length), b = 0; b < c.length; b++) d[b + et] = c[b];
|
|
4140
|
+
return d.length < 32 || le(m, d, d.length, l, u) !== 0 ? null : m.subarray(mt);
|
|
4141
|
+
}, r.secretbox.keyLength = ws, r.secretbox.nonceLength = Ht, r.secretbox.overheadLength = et, r.scalarMult = function(c, l) {
|
|
4161
4142
|
if (_e(c, l), c.length !== Jt) throw new Error("bad n size");
|
|
4162
|
-
if (l.length !==
|
|
4163
|
-
var u = new Uint8Array(
|
|
4143
|
+
if (l.length !== bt) throw new Error("bad p size");
|
|
4144
|
+
var u = new Uint8Array(bt);
|
|
4164
4145
|
return Ut(u, c, l), u;
|
|
4165
4146
|
}, r.scalarMult.base = function(c) {
|
|
4166
4147
|
if (_e(c), c.length !== Jt) throw new Error("bad n size");
|
|
4167
|
-
var l = new Uint8Array(
|
|
4148
|
+
var l = new Uint8Array(bt);
|
|
4168
4149
|
return $t(l, c), l;
|
|
4169
|
-
}, r.scalarMult.scalarLength = Jt, r.scalarMult.groupElementLength =
|
|
4150
|
+
}, r.scalarMult.scalarLength = Jt, r.scalarMult.groupElementLength = bt, r.box = function(c, l, u, d) {
|
|
4170
4151
|
var m = r.box.before(u, d);
|
|
4171
4152
|
return r.secretbox(c, l, m);
|
|
4172
4153
|
}, r.box.before = function(c, l) {
|
|
@@ -4177,20 +4158,20 @@ var C;
|
|
|
4177
4158
|
var m = r.box.before(u, d);
|
|
4178
4159
|
return r.secretbox.open(c, l, m);
|
|
4179
4160
|
}, r.box.open.after = r.secretbox.open, r.box.keyPair = function() {
|
|
4180
|
-
var c = new Uint8Array(
|
|
4161
|
+
var c = new Uint8Array(gt), l = new Uint8Array(_t);
|
|
4181
4162
|
return hr(c, l), {
|
|
4182
4163
|
publicKey: c,
|
|
4183
4164
|
secretKey: l
|
|
4184
4165
|
};
|
|
4185
4166
|
}, r.box.keyPair.fromSecretKey = function(c) {
|
|
4186
|
-
if (_e(c), c.length !==
|
|
4187
|
-
var l = new Uint8Array(
|
|
4167
|
+
if (_e(c), c.length !== _t) throw new Error("bad secret key size");
|
|
4168
|
+
var l = new Uint8Array(gt);
|
|
4188
4169
|
return $t(l, c), {
|
|
4189
4170
|
publicKey: l,
|
|
4190
4171
|
secretKey: new Uint8Array(c)
|
|
4191
4172
|
};
|
|
4192
|
-
}, r.box.publicKeyLength =
|
|
4193
|
-
if (_e(c, l), l.length !==
|
|
4173
|
+
}, r.box.publicKeyLength = gt, r.box.secretKeyLength = _t, r.box.sharedKeyLength = xs, r.box.nonceLength = mr, r.box.overheadLength = r.secretbox.overheadLength, r.sign = function(c, l) {
|
|
4174
|
+
if (_e(c, l), l.length !== tt) throw new Error("bad secret key size");
|
|
4194
4175
|
var u = new Uint8Array(Le + c.length);
|
|
4195
4176
|
return pr(u, c, c.length, l), u;
|
|
4196
4177
|
}, r.sign.open = function(c, l) {
|
|
@@ -4210,13 +4191,13 @@ var C;
|
|
|
4210
4191
|
for (b = 0; b < c.length; b++) d[b + Le] = c[b];
|
|
4211
4192
|
return ys(m, d, d.length, u) >= 0;
|
|
4212
4193
|
}, r.sign.keyPair = function() {
|
|
4213
|
-
var c = new Uint8Array(Xe), l = new Uint8Array(
|
|
4194
|
+
var c = new Uint8Array(Xe), l = new Uint8Array(tt);
|
|
4214
4195
|
return bs(c, l), {
|
|
4215
4196
|
publicKey: c,
|
|
4216
4197
|
secretKey: l
|
|
4217
4198
|
};
|
|
4218
4199
|
}, r.sign.keyPair.fromSecretKey = function(c) {
|
|
4219
|
-
if (_e(c), c.length !==
|
|
4200
|
+
if (_e(c), c.length !== tt) throw new Error("bad secret key size");
|
|
4220
4201
|
for (var l = new Uint8Array(Xe), u = 0; u < l.length; u++) l[u] = c[32 + u];
|
|
4221
4202
|
return {
|
|
4222
4203
|
publicKey: l,
|
|
@@ -4224,12 +4205,12 @@ var C;
|
|
|
4224
4205
|
};
|
|
4225
4206
|
}, r.sign.keyPair.fromSeed = function(c) {
|
|
4226
4207
|
if (_e(c), c.length !== Ss) throw new Error("bad seed size");
|
|
4227
|
-
for (var l = new Uint8Array(Xe), u = new Uint8Array(
|
|
4208
|
+
for (var l = new Uint8Array(Xe), u = new Uint8Array(tt), d = 0; d < 32; d++) u[d] = c[d];
|
|
4228
4209
|
return bs(l, u, !0), {
|
|
4229
4210
|
publicKey: l,
|
|
4230
4211
|
secretKey: u
|
|
4231
4212
|
};
|
|
4232
|
-
}, r.sign.publicKeyLength = Xe, r.sign.secretKeyLength =
|
|
4213
|
+
}, r.sign.publicKeyLength = Xe, r.sign.secretKeyLength = tt, r.sign.seedLength = Ss, r.sign.signatureLength = Le, r.hash = function(c) {
|
|
4233
4214
|
_e(c);
|
|
4234
4215
|
var l = new Uint8Array(vs);
|
|
4235
4216
|
return Ye(l, c, c.length), l;
|
|
@@ -4591,7 +4572,7 @@ var z;
|
|
|
4591
4572
|
(function(r) {
|
|
4592
4573
|
r[r.Seed = 144] = "Seed", r[r.Private = 120] = "Private", r[r.Operator = 112] = "Operator", r[r.Server = 104] = "Server", r[r.Cluster = 16] = "Cluster", r[r.Account = 0] = "Account", r[r.User = 160] = "User";
|
|
4593
4574
|
})(z || (z = {}));
|
|
4594
|
-
class
|
|
4575
|
+
class nt {
|
|
4595
4576
|
static isValidPublicPrefix(e) {
|
|
4596
4577
|
return e == z.Server || e == z.Operator || e == z.Cluster || e == z.Account || e == z.User;
|
|
4597
4578
|
}
|
|
@@ -4627,21 +4608,21 @@ class be {
|
|
|
4627
4608
|
static encode(e, t) {
|
|
4628
4609
|
if (!t || !(t instanceof Uint8Array))
|
|
4629
4610
|
throw new G(K.SerializationError);
|
|
4630
|
-
if (!
|
|
4611
|
+
if (!nt.isValidPrefix(e))
|
|
4631
4612
|
throw new G(K.InvalidPrefixByte);
|
|
4632
4613
|
return be._encode(!1, e, t);
|
|
4633
4614
|
}
|
|
4634
4615
|
static encodeSeed(e, t) {
|
|
4635
4616
|
if (!t)
|
|
4636
4617
|
throw new G(K.ApiError);
|
|
4637
|
-
if (!
|
|
4618
|
+
if (!nt.isValidPublicPrefix(e))
|
|
4638
4619
|
throw new G(K.InvalidPrefixByte);
|
|
4639
4620
|
if (t.byteLength !== 32)
|
|
4640
4621
|
throw new G(K.InvalidSeedLen);
|
|
4641
4622
|
return be._encode(!0, e, t);
|
|
4642
4623
|
}
|
|
4643
4624
|
static decode(e, t) {
|
|
4644
|
-
if (!
|
|
4625
|
+
if (!nt.isValidPrefix(e))
|
|
4645
4626
|
throw new G(K.InvalidPrefixByte);
|
|
4646
4627
|
const s = be._decode(t);
|
|
4647
4628
|
if (s[0] !== e)
|
|
@@ -4652,7 +4633,7 @@ class be {
|
|
|
4652
4633
|
const t = be._decode(e), s = be._decodePrefix(t);
|
|
4653
4634
|
if (s[0] != z.Seed)
|
|
4654
4635
|
throw new G(K.InvalidSeed);
|
|
4655
|
-
if (!
|
|
4636
|
+
if (!nt.isValidPublicPrefix(s[1]))
|
|
4656
4637
|
throw new G(K.InvalidPrefixByte);
|
|
4657
4638
|
return {
|
|
4658
4639
|
buf: t.slice(2),
|
|
@@ -4777,8 +4758,8 @@ class so {
|
|
|
4777
4758
|
}
|
|
4778
4759
|
}
|
|
4779
4760
|
function ro(r) {
|
|
4780
|
-
const e = new TextEncoder().encode(r), t = be._decode(e), s =
|
|
4781
|
-
if (
|
|
4761
|
+
const e = new TextEncoder().encode(r), t = be._decode(e), s = nt.parsePrefix(t[0]);
|
|
4762
|
+
if (nt.isValidPublicPrefix(s))
|
|
4782
4763
|
return new so(e);
|
|
4783
4764
|
throw new G(K.InvalidPublicKey);
|
|
4784
4765
|
}
|
|
@@ -4963,7 +4944,7 @@ class li extends he {
|
|
|
4963
4944
|
h(this, "requestSubject");
|
|
4964
4945
|
cs(this, i), this.protocol = t, this.subject = s, this.draining = !1, this.noIterator = typeof i.callback == "function", this.closed = Y();
|
|
4965
4946
|
const n = !((o = t.options) != null && o.noAsyncTraces);
|
|
4966
|
-
i.timeout && (this.timer =
|
|
4947
|
+
i.timeout && (this.timer = ut(i.timeout, n), this.timer.then(() => {
|
|
4967
4948
|
this.timer = void 0;
|
|
4968
4949
|
}).catch((a) => {
|
|
4969
4950
|
this.stop(a), this.noIterator && this.callback(a, {});
|
|
@@ -5109,7 +5090,7 @@ class os {
|
|
|
5109
5090
|
h(this, "server");
|
|
5110
5091
|
h(this, "features");
|
|
5111
5092
|
h(this, "connectPromise");
|
|
5112
|
-
this._closed = !1, this.connected = !1, this.connectedOnce = !1, this.infoReceived = !1, this.noMorePublishing = !1, this.abortReconnect = !1, this.listeners = [], this.pendingLimit = yo, this.outMsgs = 0, this.inMsgs = 0, this.outBytes = 0, this.inBytes = 0, this.options = e, this.publisher = t, this.subscriptions = new vo(), this.muxSubscriptions = new Kn(), this.outbound = new
|
|
5093
|
+
this._closed = !1, this.connected = !1, this.connectedOnce = !1, this.infoReceived = !1, this.noMorePublishing = !1, this.abortReconnect = !1, this.listeners = [], this.pendingLimit = yo, this.outMsgs = 0, this.inMsgs = 0, this.outBytes = 0, this.inBytes = 0, this.options = e, this.publisher = t, this.subscriptions = new vo(), this.muxSubscriptions = new Kn(), this.outbound = new ft(), this.pongs = [], this.whyClosed = "", this.pendingLimit = e.pendingLimit || this.pendingLimit, this.features = new An({
|
|
5113
5094
|
major: 0,
|
|
5114
5095
|
minor: 0,
|
|
5115
5096
|
micro: 0
|
|
@@ -5182,7 +5163,7 @@ class os {
|
|
|
5182
5163
|
const t = this.prepare();
|
|
5183
5164
|
let s;
|
|
5184
5165
|
try {
|
|
5185
|
-
s =
|
|
5166
|
+
s = ut(this.options.timeout || 2e4);
|
|
5186
5167
|
const i = this.transport.connect(e, this.options);
|
|
5187
5168
|
await Promise.race([
|
|
5188
5169
|
i,
|
|
@@ -5260,7 +5241,7 @@ class os {
|
|
|
5260
5241
|
a !== -1 && i.reconnects >= a && this.servers.removeCurrentServer();
|
|
5261
5242
|
}
|
|
5262
5243
|
} else
|
|
5263
|
-
s = Math.min(s, i.lastConnect + t - n), await
|
|
5244
|
+
s = Math.min(s, i.lastConnect + t - n), await dt(s);
|
|
5264
5245
|
}
|
|
5265
5246
|
}
|
|
5266
5247
|
static async connect(e, t) {
|
|
@@ -5323,7 +5304,7 @@ class os {
|
|
|
5323
5304
|
this.info = t;
|
|
5324
5305
|
const s = this.options && this.options.ignoreClusterUpdates ? void 0 : this.servers.update(t, this.transport.isEncrypted());
|
|
5325
5306
|
if (!this.infoReceived) {
|
|
5326
|
-
this.features.update(
|
|
5307
|
+
this.features.update(Ze(t.version)), this.infoReceived = !0, this.transport.isEncrypted() && this.servers.updateTLSName();
|
|
5327
5308
|
const { version: n, lang: o } = this.transport;
|
|
5328
5309
|
try {
|
|
5329
5310
|
const a = new So({
|
|
@@ -5585,7 +5566,7 @@ class Mt {
|
|
|
5585
5566
|
h(this, "_stopped");
|
|
5586
5567
|
h(this, "_done");
|
|
5587
5568
|
h(this, "started");
|
|
5588
|
-
this.nc = e, this.config = Object.assign({}, t), this.config.queue || (this.config.queue = "q"), Et("name", this.config.name), Et("queue", this.config.queue),
|
|
5569
|
+
this.nc = e, this.config = Object.assign({}, t), this.config.queue || (this.config.queue = "q"), Et("name", this.config.name), Et("queue", this.config.queue), Ze(this.config.version), this._id = Ge.next(), this.internal = [], this._done = Y(), this._stopped = !1, this.handlers = [], this.started = (/* @__PURE__ */ new Date()).toISOString(), this.reset(), this.nc.closed().then(() => {
|
|
5589
5570
|
this.close().catch();
|
|
5590
5571
|
}).catch((s) => {
|
|
5591
5572
|
this.close(s).catch();
|
|
@@ -5968,7 +5949,7 @@ class Rt {
|
|
|
5968
5949
|
this.subjectForBucket()
|
|
5969
5950
|
];
|
|
5970
5951
|
e.metadata && (s.metadata = e.metadata), typeof e.compression == "boolean" && (s.compression = e.compression ? Ve.S2 : Ve.None);
|
|
5971
|
-
const n = this.js.nc, o = n.getServerVersion(), a = o ? Ds(o,
|
|
5952
|
+
const n = this.js.nc, o = n.getServerVersion(), a = o ? Ds(o, Ze("2.7.2")) >= 0 : !1;
|
|
5972
5953
|
s.discard = a ? It.New : It.Old;
|
|
5973
5954
|
const { ok: f, min: p } = n.features.get(H.JS_ALLOW_DIRECT);
|
|
5974
5955
|
if (!f && e.allow_direct === !0) {
|
|
@@ -6448,10 +6429,10 @@ var $e;
|
|
|
6448
6429
|
(function(r) {
|
|
6449
6430
|
r.HeartbeatsMissed = "heartbeats_missed", r.ConsumerNotFound = "consumer_not_found", r.StreamNotFound = "stream_not_found", r.ConsumerDeleted = "consumer_deleted", r.OrderedConsumerRecreated = "ordered_consumer_recreated", r.NoResponders = "no_responders";
|
|
6450
6431
|
})($e || ($e = {}));
|
|
6451
|
-
var
|
|
6432
|
+
var ht;
|
|
6452
6433
|
(function(r) {
|
|
6453
6434
|
r.DebugEvent = "debug", r.Discard = "discard", r.Reset = "reset", r.Next = "next";
|
|
6454
|
-
})(
|
|
6435
|
+
})(ht || (ht = {}));
|
|
6455
6436
|
const Hr = Uint8Array.of(43, 65, 67, 75), Lo = Uint8Array.of(45, 78, 65, 75), vt = Uint8Array.of(43, 87, 80, 73), qo = Uint8Array.of(43, 78, 88, 84), Fo = Uint8Array.of(43, 84, 69, 82, 77), Bo = Uint8Array.of(32);
|
|
6456
6437
|
function Nt(r, e = 5e3) {
|
|
6457
6438
|
return new ia(r, e);
|
|
@@ -6507,7 +6488,7 @@ class Ns extends he {
|
|
|
6507
6488
|
return;
|
|
6508
6489
|
const N = (x = p.headers) == null ? void 0 : x.code, J = ((I = (A = p.headers) == null ? void 0 : A.description) == null ? void 0 : I.toLowerCase()) || "unknown", { msgsLeft: ee, bytesLeft: L } = this.parseDiscard(p.headers);
|
|
6509
6490
|
if (ee > 0 || L > 0)
|
|
6510
|
-
this.pending.msgs -= ee, this.pending.bytes -= L, this.pending.requests--, this.notify(
|
|
6491
|
+
this.pending.msgs -= ee, this.pending.bytes -= L, this.pending.requests--, this.notify(ht.Discard, {
|
|
6511
6492
|
msgsLeft: ee,
|
|
6512
6493
|
bytesLeft: L
|
|
6513
6494
|
});
|
|
@@ -6527,7 +6508,7 @@ class Ns extends he {
|
|
|
6527
6508
|
return;
|
|
6528
6509
|
}
|
|
6529
6510
|
} else
|
|
6530
|
-
this.notify(
|
|
6511
|
+
this.notify(ht.DebugEvent, `${N} ${J}`);
|
|
6531
6512
|
} else
|
|
6532
6513
|
this._push(Nt(p, this.consumer.api.timeout)), this.received++, this.pending.msgs && this.pending.msgs--, this.pending.bytes && (this.pending.bytes -= p.size());
|
|
6533
6514
|
if (this.pending.msgs === 0 && this.pending.bytes === 0 && (this.pending.requests = 0), this.refilling) {
|
|
@@ -6624,7 +6605,7 @@ class Ns extends he {
|
|
|
6624
6605
|
} else
|
|
6625
6606
|
t = 0, s = 0;
|
|
6626
6607
|
this.inBackOff = !0;
|
|
6627
|
-
const a = i.backoff(n), f =
|
|
6608
|
+
const a = i.backoff(n), f = dt(a);
|
|
6628
6609
|
await Promise.race([
|
|
6629
6610
|
f,
|
|
6630
6611
|
this.consumer.api.nc.closed()
|
|
@@ -6638,7 +6619,7 @@ class Ns extends he {
|
|
|
6638
6619
|
this._push(() => {
|
|
6639
6620
|
s.publish(`${this.consumer.api.prefix}.CONSUMER.MSG.NEXT.${this.consumer.stream}.${this.consumer.name}`, this.consumer.api.jc.encode(t), {
|
|
6640
6621
|
reply: this.inbox
|
|
6641
|
-
}), this.notify(
|
|
6622
|
+
}), this.notify(ht.Next, t);
|
|
6642
6623
|
});
|
|
6643
6624
|
}
|
|
6644
6625
|
pullOptions() {
|
|
@@ -6762,7 +6743,7 @@ class Gs {
|
|
|
6762
6743
|
max_messages: 100,
|
|
6763
6744
|
expires: 3e4
|
|
6764
6745
|
}) {
|
|
6765
|
-
const t = new Ns(this, e, !1), s = Math.round(t.opts.expires * 1.05), i =
|
|
6746
|
+
const t = new Ns(this, e, !1), s = Math.round(t.opts.expires * 1.05), i = ut(s);
|
|
6766
6747
|
return t.closed().catch(() => {
|
|
6767
6748
|
}).finally(() => {
|
|
6768
6749
|
i.cancel();
|
|
@@ -6789,7 +6770,7 @@ class Gs {
|
|
|
6789
6770
|
}
|
|
6790
6771
|
})().catch(() => {
|
|
6791
6772
|
});
|
|
6792
|
-
const o =
|
|
6773
|
+
const o = ut(n);
|
|
6793
6774
|
return i.closed().then((a) => {
|
|
6794
6775
|
a ? t.reject(a) : t.resolve(null);
|
|
6795
6776
|
}).catch((a) => {
|
|
@@ -6867,7 +6848,7 @@ class Ho {
|
|
|
6867
6848
|
return (g = this.iter) == null || g.stop(x), Promise.reject(x);
|
|
6868
6849
|
if (t && y >= this.maxInitialReset)
|
|
6869
6850
|
throw x;
|
|
6870
|
-
await
|
|
6851
|
+
await dt(i.backoff(y + 1));
|
|
6871
6852
|
}
|
|
6872
6853
|
return n;
|
|
6873
6854
|
}
|
|
@@ -6907,7 +6888,7 @@ class Ho {
|
|
|
6907
6888
|
}
|
|
6908
6889
|
notifyOrderedResetAndReset() {
|
|
6909
6890
|
var e;
|
|
6910
|
-
(e = this.iter) == null || e.notify(
|
|
6891
|
+
(e = this.iter) == null || e.notify(ht.Reset, ""), this.reset(this.opts, {
|
|
6911
6892
|
orderedReset: !0
|
|
6912
6893
|
});
|
|
6913
6894
|
}
|
|
@@ -7192,7 +7173,7 @@ class Jo extends Tt {
|
|
|
7192
7173
|
i && (s = null);
|
|
7193
7174
|
const n = s ? this.jc.encode(s) : ve, o = this.opts.apiPrefix || "$JS.API", a = i ? `${o}.DIRECT.GET.${e}.${i}` : `${o}.DIRECT.GET.${e}`, f = await this.nc.request(a, n, {
|
|
7194
7175
|
timeout: this.timeout
|
|
7195
|
-
}), p =
|
|
7176
|
+
}), p = at(f);
|
|
7196
7177
|
if (p)
|
|
7197
7178
|
return Promise.reject(p);
|
|
7198
7179
|
const g = new Ws(f);
|
|
@@ -7245,20 +7226,20 @@ class Ws {
|
|
|
7245
7226
|
this.data = e.data, this.header = e.headers;
|
|
7246
7227
|
}
|
|
7247
7228
|
get subject() {
|
|
7248
|
-
return this.header.last(
|
|
7229
|
+
return this.header.last(it.Subject);
|
|
7249
7230
|
}
|
|
7250
7231
|
get seq() {
|
|
7251
|
-
const e = this.header.last(
|
|
7232
|
+
const e = this.header.last(it.Sequence);
|
|
7252
7233
|
return typeof e == "string" ? parseInt(e) : 0;
|
|
7253
7234
|
}
|
|
7254
7235
|
get time() {
|
|
7255
7236
|
return new Date(Date.parse(this.timestamp));
|
|
7256
7237
|
}
|
|
7257
7238
|
get timestamp() {
|
|
7258
|
-
return this.header.last(
|
|
7239
|
+
return this.header.last(it.TimeStamp);
|
|
7259
7240
|
}
|
|
7260
7241
|
get stream() {
|
|
7261
|
-
return this.header.last(
|
|
7242
|
+
return this.header.last(it.Stream);
|
|
7262
7243
|
}
|
|
7263
7244
|
json(e) {
|
|
7264
7245
|
return Oe(e).decode(this.data);
|
|
@@ -7506,7 +7487,7 @@ class Ct {
|
|
|
7506
7487
|
nuid: A,
|
|
7507
7488
|
size: 0,
|
|
7508
7489
|
chunks: 0
|
|
7509
|
-
}, Jr(e)), ee = Y(), L = [], Q = new
|
|
7490
|
+
}, Jr(e)), ee = Y(), L = [], Q = new ft();
|
|
7510
7491
|
try {
|
|
7511
7492
|
const w = t ? t.getReader() : null, j = Nr.create();
|
|
7512
7493
|
for (; ; ) {
|
|
@@ -7522,7 +7503,7 @@ class Ct {
|
|
|
7522
7503
|
}));
|
|
7523
7504
|
}
|
|
7524
7505
|
await Promise.all(L), L.length = 0, J.mtime = (/* @__PURE__ */ new Date()).toISOString();
|
|
7525
|
-
const P =
|
|
7506
|
+
const P = ct.encode(j.digest());
|
|
7526
7507
|
J.digest = `${Dr}${P}`, J.deleted = !1;
|
|
7527
7508
|
const U = Fe();
|
|
7528
7509
|
typeof o == "number" && U.set(Ue.ExpectedLastSubjectSequenceHdr, `${o}`), U.set(ge.RollupHdr, ge.RollupValueSubject);
|
|
@@ -7572,7 +7553,7 @@ class Ct {
|
|
|
7572
7553
|
}
|
|
7573
7554
|
async getBlob(e) {
|
|
7574
7555
|
async function t(n) {
|
|
7575
|
-
const o = new
|
|
7556
|
+
const o = new ft(), a = n.getReader();
|
|
7576
7557
|
for (; ; ) {
|
|
7577
7558
|
const { done: f, value: p } = await a.read();
|
|
7578
7559
|
if (f)
|
|
@@ -7743,7 +7724,7 @@ class Ct {
|
|
|
7743
7724
|
return `$O.${this.name}.C.${e}`;
|
|
7744
7725
|
}
|
|
7745
7726
|
_metaSubject(e) {
|
|
7746
|
-
return `$O.${this.name}.M.${
|
|
7727
|
+
return `$O.${this.name}.M.${ct.encode(e)}`;
|
|
7747
7728
|
}
|
|
7748
7729
|
_metaSubjectAll() {
|
|
7749
7730
|
return `$O.${this.name}.M.>`;
|
|
@@ -7828,7 +7809,7 @@ class rr extends Tt {
|
|
|
7828
7809
|
break;
|
|
7829
7810
|
} catch (A) {
|
|
7830
7811
|
if (A.code === "503" && x + 1 < f)
|
|
7831
|
-
await
|
|
7812
|
+
await dt(p);
|
|
7832
7813
|
else
|
|
7833
7814
|
throw A;
|
|
7834
7815
|
}
|
|
@@ -7838,7 +7819,7 @@ class rr extends Tt {
|
|
|
7838
7819
|
return y.duplicate = y.duplicate ? y.duplicate : !1, y;
|
|
7839
7820
|
}
|
|
7840
7821
|
async pull(t, s, i = 0) {
|
|
7841
|
-
pe(t),
|
|
7822
|
+
pe(t), ot(s);
|
|
7842
7823
|
let n = this.timeout;
|
|
7843
7824
|
i > n && (n = i), i = i < 0 ? 0 : W(i);
|
|
7844
7825
|
const o = {
|
|
@@ -7848,13 +7829,13 @@ class rr extends Tt {
|
|
|
7848
7829
|
}, a = await this.nc.request(`${this.prefix}.CONSUMER.MSG.NEXT.${t}.${s}`, this.jc.encode(o), {
|
|
7849
7830
|
noMux: !0,
|
|
7850
7831
|
timeout: n
|
|
7851
|
-
}), f =
|
|
7832
|
+
}), f = at(a);
|
|
7852
7833
|
if (f)
|
|
7853
7834
|
throw f;
|
|
7854
7835
|
return Nt(a, this.timeout);
|
|
7855
7836
|
}
|
|
7856
7837
|
fetch(t, s, i = {}) {
|
|
7857
|
-
pe(t),
|
|
7838
|
+
pe(t), ot(s);
|
|
7858
7839
|
let n = null;
|
|
7859
7840
|
const o = (i.max_bytes ?? 0) > 0;
|
|
7860
7841
|
let a = 0;
|
|
@@ -7885,10 +7866,10 @@ class rr extends Tt {
|
|
|
7885
7866
|
const J = qe(this.nc.options.inboxPrefix), ee = this.nc.subscribe(J, {
|
|
7886
7867
|
max: i.batch,
|
|
7887
7868
|
callback: (L, Q) => {
|
|
7888
|
-
L === null && (L =
|
|
7869
|
+
L === null && (L = at(Q)), L !== null ? (n && (n.cancel(), n = null), tn(L) ? A.stop(bi(L) === null ? void 0 : L) : A.stop(L)) : (p == null || p.work(), A.received++, A.push(Nt(Q, this.timeout)));
|
|
7889
7870
|
}
|
|
7890
7871
|
});
|
|
7891
|
-
return y && (n =
|
|
7872
|
+
return y && (n = ut(y), n.catch(() => {
|
|
7892
7873
|
ee.isClosed() || (ee.drain().catch(() => {
|
|
7893
7874
|
}), n = null), p && p.cancel();
|
|
7894
7875
|
})), (async () => {
|
|
@@ -7992,7 +7973,7 @@ class rr extends Tt {
|
|
|
7992
7973
|
deliver_policy: se.All,
|
|
7993
7974
|
ack_policy: ce.Explicit,
|
|
7994
7975
|
ack_wait: W(30 * 1e3),
|
|
7995
|
-
replay_policy:
|
|
7976
|
+
replay_policy: lt.Instant
|
|
7996
7977
|
}, t.config);
|
|
7997
7978
|
const s = await this.consumerAPI.add(t.stream, t.config);
|
|
7998
7979
|
if (Array.isArray(t.config.filter_subjects && !Array.isArray(s.config.filter_subjects)))
|
|
@@ -8008,7 +7989,7 @@ class rr extends Tt {
|
|
|
8008
7989
|
protocol: !1
|
|
8009
7990
|
};
|
|
8010
7991
|
const o = s;
|
|
8011
|
-
if (
|
|
7992
|
+
if (at(o.msg) || (f = n.monitor) == null || f.work(), Ls(o.msg)) {
|
|
8012
7993
|
const p = t ? n._checkHbOrderConsumer(o.msg) : !0;
|
|
8013
7994
|
return t || n.info.flow_control.heartbeat_count++, {
|
|
8014
7995
|
ingest: p,
|
|
@@ -8282,7 +8263,7 @@ ${a.stack}`), o.reject(p)) : o.resolve(g));
|
|
|
8282
8263
|
}
|
|
8283
8264
|
getServerVersion() {
|
|
8284
8265
|
const e = this.info;
|
|
8285
|
-
return e ?
|
|
8266
|
+
return e ? Ze(e.version) : void 0;
|
|
8286
8267
|
}
|
|
8287
8268
|
async rtt() {
|
|
8288
8269
|
if (!this.protocol._closed && !this.protocol.connected)
|
|
@@ -8505,7 +8486,7 @@ function ea(r) {
|
|
|
8505
8486
|
return (e, t) => e ? [
|
|
8506
8487
|
e,
|
|
8507
8488
|
null
|
|
8508
|
-
] : (e =
|
|
8489
|
+
] : (e = at(t), e ? [
|
|
8509
8490
|
e,
|
|
8510
8491
|
null
|
|
8511
8492
|
] : [
|
|
@@ -8520,7 +8501,7 @@ function ta(r) {
|
|
|
8520
8501
|
e,
|
|
8521
8502
|
null
|
|
8522
8503
|
];
|
|
8523
|
-
const s =
|
|
8504
|
+
const s = at(t);
|
|
8524
8505
|
return s !== null ? [
|
|
8525
8506
|
bi(s),
|
|
8526
8507
|
null
|
|
@@ -8638,7 +8619,7 @@ class ia {
|
|
|
8638
8619
|
}) {
|
|
8639
8620
|
const s = {};
|
|
8640
8621
|
s.batch = t.batch || 1, s.no_wait = t.no_wait || !1, t.expires && t.expires > 0 && (s.expires = W(t.expires));
|
|
8641
|
-
const i = Oe().encode(s), n =
|
|
8622
|
+
const i = Oe().encode(s), n = ft.concat(qo, Bo, i), o = e ? {
|
|
8642
8623
|
reply: e
|
|
8643
8624
|
} : void 0;
|
|
8644
8625
|
this.msg.respond(n, o);
|
|
@@ -8692,7 +8673,7 @@ class aa {
|
|
|
8692
8673
|
this.signal.resolve();
|
|
8693
8674
|
return;
|
|
8694
8675
|
}
|
|
8695
|
-
const o =
|
|
8676
|
+
const o = ft.concat(...this.yields), a = Rn(o);
|
|
8696
8677
|
if (a !== "") {
|
|
8697
8678
|
const f = wo.exec(a);
|
|
8698
8679
|
if (!f) {
|
|
@@ -8727,7 +8708,7 @@ class aa {
|
|
|
8727
8708
|
if (!this.isDiscarded() && this.connected && !this.done) {
|
|
8728
8709
|
if (this.closeError = e, !e)
|
|
8729
8710
|
for (; !this.socketClosed && this.socket.bufferedAmount > 0; )
|
|
8730
|
-
await
|
|
8711
|
+
await dt(100);
|
|
8731
8712
|
this.done = !0;
|
|
8732
8713
|
try {
|
|
8733
8714
|
this.socket.close(e ? 1002 : 1e3, e ? e.message : void 0);
|