@jokio/sdk 0.1.11 → 0.2.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/auth.service.d.ts +6 -3
- package/dist/index.d.ts +4 -0
- package/dist/jokio.sdk.es.js +485 -451
- package/dist/jokio.sdk.umd.js +13 -13
- package/dist/nats.service.d.ts +3 -0
- package/dist/storage.service.d.ts +5 -0
- package/package.json +1 -1
package/dist/jokio.sdk.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var h = (r, e, t) =>
|
|
1
|
+
var Si = Object.defineProperty;
|
|
2
|
+
var Ei = (r, e, t) => e in r ? Si(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var h = (r, e, t) => Ei(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
4
|
function je(r) {
|
|
5
5
|
const e = new Uint8Array(r);
|
|
6
6
|
let t = "";
|
|
@@ -14,13 +14,13 @@ function zt(r) {
|
|
|
14
14
|
o[a] = i.charCodeAt(a);
|
|
15
15
|
return n;
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
return
|
|
17
|
+
function qs() {
|
|
18
|
+
return vi.stubThis((globalThis == null ? void 0 : globalThis.PublicKeyCredential) !== void 0 && typeof globalThis.PublicKeyCredential == "function");
|
|
19
19
|
}
|
|
20
|
-
const
|
|
20
|
+
const vi = {
|
|
21
21
|
stubThis: (r) => r
|
|
22
22
|
};
|
|
23
|
-
function
|
|
23
|
+
function $r(r) {
|
|
24
24
|
const { id: e } = r;
|
|
25
25
|
return {
|
|
26
26
|
...r,
|
|
@@ -33,7 +33,7 @@ function Ur(r) {
|
|
|
33
33
|
transports: r.transports
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function Ur(r) {
|
|
37
37
|
return (
|
|
38
38
|
// Consider localhost valid as well since it's okay wrt Secure Contexts
|
|
39
39
|
r === "localhost" || /^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(r)
|
|
@@ -49,7 +49,7 @@ class he extends Error {
|
|
|
49
49
|
}), this.name = i ?? s.name, this.code = t;
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
function
|
|
52
|
+
function Ai({ error: r, options: e }) {
|
|
53
53
|
var s, i, n;
|
|
54
54
|
const { publicKey: t } = e;
|
|
55
55
|
if (!t)
|
|
@@ -108,7 +108,7 @@ function Ei({ error: r, options: e }) {
|
|
|
108
108
|
});
|
|
109
109
|
if (r.name === "SecurityError") {
|
|
110
110
|
const o = globalThis.location.hostname;
|
|
111
|
-
if (
|
|
111
|
+
if (Ur(o)) {
|
|
112
112
|
if (t.rp.id !== o)
|
|
113
113
|
return new he({
|
|
114
114
|
message: `The RP ID "${t.rp.id}" is invalid for this domain`,
|
|
@@ -136,7 +136,7 @@ function Ei({ error: r, options: e }) {
|
|
|
136
136
|
}
|
|
137
137
|
return r;
|
|
138
138
|
}
|
|
139
|
-
class
|
|
139
|
+
class Pi {
|
|
140
140
|
constructor() {
|
|
141
141
|
Object.defineProperty(this, "controller", {
|
|
142
142
|
enumerable: !0,
|
|
@@ -160,16 +160,16 @@ class vi {
|
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
|
-
const
|
|
164
|
-
function
|
|
165
|
-
if (r && !(
|
|
163
|
+
const Lr = new Pi(), Oi = ["cross-platform", "platform"];
|
|
164
|
+
function qr(r) {
|
|
165
|
+
if (r && !(Oi.indexOf(r) < 0))
|
|
166
166
|
return r;
|
|
167
167
|
}
|
|
168
|
-
async function
|
|
168
|
+
async function ki(r) {
|
|
169
169
|
var I;
|
|
170
170
|
!r.optionsJSON && r.challenge && (console.warn("startRegistration() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information."), r = { optionsJSON: r });
|
|
171
171
|
const { optionsJSON: e, useAutoRegister: t = !1 } = r;
|
|
172
|
-
if (!
|
|
172
|
+
if (!qs())
|
|
173
173
|
throw new Error("WebAuthn is not supported in this browser");
|
|
174
174
|
const s = {
|
|
175
175
|
...e,
|
|
@@ -178,14 +178,14 @@ async function Pi(r) {
|
|
|
178
178
|
...e.user,
|
|
179
179
|
id: zt(e.user.id)
|
|
180
180
|
},
|
|
181
|
-
excludeCredentials: (I = e.excludeCredentials) == null ? void 0 : I.map(
|
|
181
|
+
excludeCredentials: (I = e.excludeCredentials) == null ? void 0 : I.map($r)
|
|
182
182
|
}, i = {};
|
|
183
|
-
t && (i.mediation = "conditional"), i.publicKey = s, i.signal =
|
|
183
|
+
t && (i.mediation = "conditional"), i.publicKey = s, i.signal = Lr.createNewAbortSignal();
|
|
184
184
|
let n;
|
|
185
185
|
try {
|
|
186
186
|
n = await navigator.credentials.create(i);
|
|
187
187
|
} catch (T) {
|
|
188
|
-
throw
|
|
188
|
+
throw Ai({ error: T, options: i });
|
|
189
189
|
}
|
|
190
190
|
if (!n)
|
|
191
191
|
throw new Error("Registration was not completed");
|
|
@@ -227,15 +227,15 @@ async function Pi(r) {
|
|
|
227
227
|
},
|
|
228
228
|
type: p,
|
|
229
229
|
clientExtensionResults: n.getClientExtensionResults(),
|
|
230
|
-
authenticatorAttachment:
|
|
230
|
+
authenticatorAttachment: qr(n.authenticatorAttachment)
|
|
231
231
|
};
|
|
232
232
|
}
|
|
233
233
|
function ms(r, e) {
|
|
234
234
|
console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${r}. You should report this error to them.
|
|
235
235
|
`, e);
|
|
236
236
|
}
|
|
237
|
-
function
|
|
238
|
-
if (!
|
|
237
|
+
function Ci() {
|
|
238
|
+
if (!qs())
|
|
239
239
|
return bs.stubThis(new Promise((e) => e(!1)));
|
|
240
240
|
const r = globalThis.PublicKeyCredential;
|
|
241
241
|
return (r == null ? void 0 : r.isConditionalMediationAvailable) === void 0 ? bs.stubThis(new Promise((e) => e(!1))) : bs.stubThis(r.isConditionalMediationAvailable());
|
|
@@ -243,7 +243,7 @@ function Oi() {
|
|
|
243
243
|
const bs = {
|
|
244
244
|
stubThis: (r) => r
|
|
245
245
|
};
|
|
246
|
-
function
|
|
246
|
+
function Ii({ error: r, options: e }) {
|
|
247
247
|
const { publicKey: t } = e;
|
|
248
248
|
if (!t)
|
|
249
249
|
throw Error("options was missing required publicKey property");
|
|
@@ -263,7 +263,7 @@ function ki({ error: r, options: e }) {
|
|
|
263
263
|
});
|
|
264
264
|
if (r.name === "SecurityError") {
|
|
265
265
|
const s = globalThis.location.hostname;
|
|
266
|
-
if (
|
|
266
|
+
if (Ur(s)) {
|
|
267
267
|
if (t.rpId !== s)
|
|
268
268
|
return new he({
|
|
269
269
|
message: `The RP ID "${t.rpId}" is invalid for this domain`,
|
|
@@ -284,32 +284,32 @@ function ki({ error: r, options: e }) {
|
|
|
284
284
|
}
|
|
285
285
|
return r;
|
|
286
286
|
}
|
|
287
|
-
async function
|
|
287
|
+
async function ji(r) {
|
|
288
288
|
var P, I;
|
|
289
289
|
!r.optionsJSON && r.challenge && (console.warn("startAuthentication() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information."), r = { optionsJSON: r });
|
|
290
290
|
const { optionsJSON: e, useBrowserAutofill: t = !1, verifyBrowserAutofillInput: s = !0 } = r;
|
|
291
|
-
if (!
|
|
291
|
+
if (!qs())
|
|
292
292
|
throw new Error("WebAuthn is not supported in this browser");
|
|
293
293
|
let i;
|
|
294
|
-
((P = e.allowCredentials) == null ? void 0 : P.length) !== 0 && (i = (I = e.allowCredentials) == null ? void 0 : I.map(
|
|
294
|
+
((P = e.allowCredentials) == null ? void 0 : P.length) !== 0 && (i = (I = e.allowCredentials) == null ? void 0 : I.map($r));
|
|
295
295
|
const n = {
|
|
296
296
|
...e,
|
|
297
297
|
challenge: zt(e.challenge),
|
|
298
298
|
allowCredentials: i
|
|
299
299
|
}, o = {};
|
|
300
300
|
if (t) {
|
|
301
|
-
if (!await
|
|
301
|
+
if (!await Ci())
|
|
302
302
|
throw Error("Browser does not support WebAuthn autofill");
|
|
303
303
|
if (document.querySelectorAll("input[autocomplete$='webauthn']").length < 1 && s)
|
|
304
304
|
throw Error('No <input> with "webauthn" as the only or last value in its `autocomplete` attribute was detected');
|
|
305
305
|
o.mediation = "conditional", n.allowCredentials = [];
|
|
306
306
|
}
|
|
307
|
-
o.publicKey = n, o.signal =
|
|
307
|
+
o.publicKey = n, o.signal = Lr.createNewAbortSignal();
|
|
308
308
|
let a;
|
|
309
309
|
try {
|
|
310
310
|
a = await navigator.credentials.get(o);
|
|
311
311
|
} catch (T) {
|
|
312
|
-
throw
|
|
312
|
+
throw Ii({ error: T, options: o });
|
|
313
313
|
}
|
|
314
314
|
if (!a)
|
|
315
315
|
throw new Error("Authentication was not completed");
|
|
@@ -326,26 +326,29 @@ async function Ci(r) {
|
|
|
326
326
|
},
|
|
327
327
|
type: y,
|
|
328
328
|
clientExtensionResults: a.getClientExtensionResults(),
|
|
329
|
-
authenticatorAttachment:
|
|
329
|
+
authenticatorAttachment: qr(a.authenticatorAttachment)
|
|
330
330
|
};
|
|
331
331
|
}
|
|
332
332
|
const dt = "LAST_AUTH_DATA";
|
|
333
|
-
class
|
|
333
|
+
class Fr {
|
|
334
334
|
constructor(e) {
|
|
335
|
-
this.
|
|
335
|
+
this.options = e;
|
|
336
|
+
}
|
|
337
|
+
get url() {
|
|
338
|
+
return this.options.authUrl;
|
|
336
339
|
}
|
|
337
340
|
async requestEmailLogin(e, t = location.href) {
|
|
338
341
|
return await fetch(
|
|
339
|
-
this.
|
|
342
|
+
this.options.authUrl + `/email-verification-request/${e}?returnUrl=${t}`,
|
|
340
343
|
{ credentials: "include" }
|
|
341
344
|
).then(pt);
|
|
342
345
|
}
|
|
343
346
|
async completeEmailLogin(e, t) {
|
|
344
347
|
const s = await fetch(
|
|
345
|
-
this.
|
|
348
|
+
this.options.authUrl + `/email-verification-complete/${e}/${t}`,
|
|
346
349
|
{ credentials: "include" }
|
|
347
350
|
).then(pt);
|
|
348
|
-
return
|
|
351
|
+
return await this.options.storage.setItem(dt, s), s;
|
|
349
352
|
}
|
|
350
353
|
async requestPasskeyLogin(e = {}) {
|
|
351
354
|
var d;
|
|
@@ -354,14 +357,14 @@ class As {
|
|
|
354
357
|
isRegistration: s = !1,
|
|
355
358
|
addAsAdditionalDevice: i = !1
|
|
356
359
|
} = e, n = await fetch(
|
|
357
|
-
this.
|
|
360
|
+
this.options.authUrl + `/webauth-challenge-request?registration=${s ? "true" : ""}&displayName=${t}`,
|
|
358
361
|
{ credentials: "include" }
|
|
359
362
|
).then(pt);
|
|
360
363
|
let o;
|
|
361
364
|
try {
|
|
362
|
-
(d = n.user) != null && d.id ? o = await
|
|
365
|
+
(d = n.user) != null && d.id ? o = await ki({
|
|
363
366
|
optionsJSON: n
|
|
364
|
-
}) : o = await
|
|
367
|
+
}) : o = await ji({
|
|
365
368
|
optionsJSON: n
|
|
366
369
|
});
|
|
367
370
|
} catch (p) {
|
|
@@ -370,7 +373,7 @@ class As {
|
|
|
370
373
|
) : alert(p.message), p;
|
|
371
374
|
}
|
|
372
375
|
const a = await fetch(
|
|
373
|
-
this.
|
|
376
|
+
this.options.authUrl + `/webauth-challenge-complete?displayName=${t}&addAsAdditionalDevice=${i ? "true" : ""}`,
|
|
374
377
|
{
|
|
375
378
|
method: "POST",
|
|
376
379
|
body: JSON.stringify(o),
|
|
@@ -380,16 +383,16 @@ class As {
|
|
|
380
383
|
credentials: "include"
|
|
381
384
|
}
|
|
382
385
|
).then(pt);
|
|
383
|
-
return
|
|
386
|
+
return await this.options.storage.setItem(dt, a), a;
|
|
384
387
|
}
|
|
385
388
|
async guestLogin() {
|
|
386
|
-
const e = await fetch(this.
|
|
389
|
+
const e = await fetch(this.options.authUrl + "/sign-out", {
|
|
387
390
|
credentials: "include"
|
|
388
391
|
}).then(pt);
|
|
389
|
-
return
|
|
392
|
+
return await this.options.storage.setItem(dt, e), e;
|
|
390
393
|
}
|
|
391
394
|
async clearLoginData() {
|
|
392
|
-
|
|
395
|
+
await this.options.storage.removeItem(dt);
|
|
393
396
|
}
|
|
394
397
|
getLastLoginData() {
|
|
395
398
|
const e = localStorage.getItem(dt);
|
|
@@ -407,10 +410,10 @@ const pt = async (r) => {
|
|
|
407
410
|
if (!r.ok)
|
|
408
411
|
throw new Error(e.message);
|
|
409
412
|
return e;
|
|
410
|
-
}, gs = (r) => [...r].map((e) => e.toString(16).padStart(2, "0")).join(""),
|
|
413
|
+
}, gs = (r) => [...r].map((e) => e.toString(16).padStart(2, "0")).join(""), ar = (r) => new Uint8Array(
|
|
411
414
|
r.match(/.{1,2}/g).map((e) => parseInt(e, 16))
|
|
412
|
-
),
|
|
413
|
-
class
|
|
415
|
+
), cr = (r) => btoa(String.fromCharCode(...new Uint8Array(r))), Ri = (r) => Uint8Array.from(atob(r), (e) => e.charCodeAt(0)).buffer, Ni = async (r) => await crypto.subtle.digest("SHA-256", r), Ti = new TextEncoder();
|
|
416
|
+
class Mi {
|
|
414
417
|
async createSessionKeyPair() {
|
|
415
418
|
return await crypto.subtle.generateKey(
|
|
416
419
|
{
|
|
@@ -424,10 +427,10 @@ class Ni {
|
|
|
424
427
|
}
|
|
425
428
|
async exportPublicKey(e) {
|
|
426
429
|
const t = await crypto.subtle.exportKey("spki", e);
|
|
427
|
-
return
|
|
430
|
+
return cr(t);
|
|
428
431
|
}
|
|
429
432
|
async deriveAESKey(e, t) {
|
|
430
|
-
const s =
|
|
433
|
+
const s = Ri(t), i = await crypto.subtle.importKey(
|
|
431
434
|
"spki",
|
|
432
435
|
s,
|
|
433
436
|
{ name: "ECDH", namedCurve: "P-256" },
|
|
@@ -458,7 +461,7 @@ class Ni {
|
|
|
458
461
|
return `${gs(new Uint8Array(n))}_${gs(s)}`;
|
|
459
462
|
}
|
|
460
463
|
async decrypt(e, t) {
|
|
461
|
-
const s = e.split("_"), i =
|
|
464
|
+
const s = e.split("_"), i = ar(s[0]).buffer, n = ar(s[1]), o = await crypto.subtle.decrypt(
|
|
462
465
|
{ name: "AES-GCM", iv: n },
|
|
463
466
|
t,
|
|
464
467
|
i
|
|
@@ -466,12 +469,12 @@ class Ni {
|
|
|
466
469
|
return new TextDecoder().decode(o);
|
|
467
470
|
}
|
|
468
471
|
async hashString(e) {
|
|
469
|
-
const t = await
|
|
470
|
-
return
|
|
472
|
+
const t = await Ni(Ti.encode(e).buffer);
|
|
473
|
+
return cr(t);
|
|
471
474
|
}
|
|
472
475
|
}
|
|
473
476
|
const ye = new Uint8Array(0), Ke = new TextEncoder(), ge = new TextDecoder();
|
|
474
|
-
function
|
|
477
|
+
function $i(...r) {
|
|
475
478
|
let e = 0;
|
|
476
479
|
for (let i = 0; i < r.length; i++)
|
|
477
480
|
e += r[i].length;
|
|
@@ -485,46 +488,46 @@ function yt(...r) {
|
|
|
485
488
|
const e = [];
|
|
486
489
|
for (let t = 0; t < r.length; t++)
|
|
487
490
|
e.push(Ke.encode(r[t]));
|
|
488
|
-
return e.length === 0 ? ye : e.length === 1 ? e[0] :
|
|
491
|
+
return e.length === 0 ? ye : e.length === 1 ? e[0] : $i(...e);
|
|
489
492
|
}
|
|
490
|
-
function
|
|
493
|
+
function hr(r) {
|
|
491
494
|
return !r || r.length === 0 ? "" : ge.decode(r);
|
|
492
495
|
}
|
|
493
|
-
const
|
|
494
|
-
function
|
|
496
|
+
const ur = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", lr = 36, Ui = 3656158440062976, fr = 33, Li = 333, dr = 22;
|
|
497
|
+
function qi(r) {
|
|
495
498
|
for (let e = 0; e < r.length; e++)
|
|
496
499
|
r[e] = Math.floor(Math.random() * 255);
|
|
497
500
|
}
|
|
498
|
-
function
|
|
501
|
+
function Fi(r) {
|
|
499
502
|
var e;
|
|
500
|
-
(e = globalThis == null ? void 0 : globalThis.crypto) != null && e.getRandomValues ? globalThis.crypto.getRandomValues(r) :
|
|
503
|
+
(e = globalThis == null ? void 0 : globalThis.crypto) != null && e.getRandomValues ? globalThis.crypto.getRandomValues(r) : qi(r);
|
|
501
504
|
}
|
|
502
|
-
class
|
|
505
|
+
class Bi {
|
|
503
506
|
constructor() {
|
|
504
507
|
h(this, "buf");
|
|
505
508
|
h(this, "seq");
|
|
506
509
|
h(this, "inc");
|
|
507
510
|
h(this, "inited");
|
|
508
|
-
this.buf = new Uint8Array(
|
|
511
|
+
this.buf = new Uint8Array(dr), this.inited = !1;
|
|
509
512
|
}
|
|
510
513
|
init() {
|
|
511
514
|
this.inited = !0, this.setPre(), this.initSeqAndInc(), this.fillSeq();
|
|
512
515
|
}
|
|
513
516
|
initSeqAndInc() {
|
|
514
|
-
this.seq = Math.floor(Math.random() *
|
|
517
|
+
this.seq = Math.floor(Math.random() * Ui), this.inc = Math.floor(Math.random() * (Li - fr) + fr);
|
|
515
518
|
}
|
|
516
519
|
setPre() {
|
|
517
520
|
const e = new Uint8Array(12);
|
|
518
|
-
|
|
521
|
+
Fi(e);
|
|
519
522
|
for (let t = 0; t < 12; t++) {
|
|
520
523
|
const s = e[t] % 36;
|
|
521
|
-
this.buf[t] =
|
|
524
|
+
this.buf[t] = ur.charCodeAt(s);
|
|
522
525
|
}
|
|
523
526
|
}
|
|
524
527
|
fillSeq() {
|
|
525
528
|
let e = this.seq;
|
|
526
|
-
for (let t =
|
|
527
|
-
this.buf[t] =
|
|
529
|
+
for (let t = dr - 1; t >= 12; t--)
|
|
530
|
+
this.buf[t] = ur.charCodeAt(e % lr), e = Math.floor(e / lr);
|
|
528
531
|
}
|
|
529
532
|
next() {
|
|
530
533
|
return this.inited || this.init(), this.seq += this.inc, this.seq > 3656158440062976 && (this.setPre(), this.initSeqAndInc()), this.fillSeq(), String.fromCharCode.apply(String, this.buf);
|
|
@@ -533,7 +536,7 @@ class qi {
|
|
|
533
536
|
this.init();
|
|
534
537
|
}
|
|
535
538
|
}
|
|
536
|
-
const De = new
|
|
539
|
+
const De = new Bi();
|
|
537
540
|
var Ee;
|
|
538
541
|
(function(r) {
|
|
539
542
|
r.Disconnect = "disconnect", r.Reconnect = "reconnect", r.Update = "update", r.LDM = "ldm", r.Error = "error";
|
|
@@ -546,7 +549,7 @@ var O;
|
|
|
546
549
|
(function(r) {
|
|
547
550
|
r.ApiError = "BAD API", r.BadAuthentication = "BAD_AUTHENTICATION", r.BadCreds = "BAD_CREDS", r.BadHeader = "BAD_HEADER", r.BadJson = "BAD_JSON", r.BadPayload = "BAD_PAYLOAD", r.BadSubject = "BAD_SUBJECT", r.Cancelled = "CANCELLED", r.ConnectionClosed = "CONNECTION_CLOSED", r.ConnectionDraining = "CONNECTION_DRAINING", r.ConnectionRefused = "CONNECTION_REFUSED", r.ConnectionTimeout = "CONNECTION_TIMEOUT", r.Disconnect = "DISCONNECT", r.InvalidOption = "INVALID_OPTION", r.InvalidPayload = "INVALID_PAYLOAD", r.MaxPayloadExceeded = "MAX_PAYLOAD_EXCEEDED", r.NoResponders = "503", r.NotFunction = "NOT_FUNC", r.RequestError = "REQUEST_ERROR", r.ServerOptionNotAvailable = "SERVER_OPT_NA", r.SubClosed = "SUB_CLOSED", r.SubDraining = "SUB_DRAINING", r.Timeout = "TIMEOUT", r.Tls = "TLS", r.Unknown = "UNKNOWN_ERROR", r.WssRequired = "WSS_REQUIRED", r.JetStreamInvalidAck = "JESTREAM_INVALID_ACK", r.JetStream404NoMessages = "404", r.JetStream408RequestTimeout = "408", r.JetStream409MaxAckPendingExceeded = "409", r.JetStream409 = "409", r.JetStreamNotEnabled = "503", r.JetStreamIdleHeartBeat = "IDLE_HEARTBEAT", r.AuthorizationViolation = "AUTHORIZATION_VIOLATION", r.AuthenticationExpired = "AUTHENTICATION_EXPIRED", r.ProtocolError = "NATS_PROTOCOL_ERR", r.PermissionsViolation = "PERMISSIONS_VIOLATION", r.AuthenticationTimeout = "AUTHENTICATION_TIMEOUT", r.AccountExpired = "ACCOUNT_EXPIRED";
|
|
548
551
|
})(O || (O = {}));
|
|
549
|
-
function
|
|
552
|
+
function Di(r) {
|
|
550
553
|
return typeof r.code == "string";
|
|
551
554
|
}
|
|
552
555
|
class Br {
|
|
@@ -555,13 +558,13 @@ class Br {
|
|
|
555
558
|
this.messages = /* @__PURE__ */ new Map(), this.messages.set(O.InvalidPayload, "Invalid payload type - payloads can be 'binary', 'string', or 'json'"), this.messages.set(O.BadJson, "Bad JSON"), this.messages.set(O.WssRequired, "TLS is required, therefore a secure websocket connection is also required");
|
|
556
559
|
}
|
|
557
560
|
static getMessage(e) {
|
|
558
|
-
return
|
|
561
|
+
return Hi.getMessage(e);
|
|
559
562
|
}
|
|
560
563
|
getMessage(e) {
|
|
561
564
|
return this.messages.get(e) || e;
|
|
562
565
|
}
|
|
563
566
|
}
|
|
564
|
-
const
|
|
567
|
+
const Hi = new Br();
|
|
565
568
|
class N extends Error {
|
|
566
569
|
constructor(t, s, i) {
|
|
567
570
|
super(t);
|
|
@@ -636,7 +639,7 @@ function Me(r = "") {
|
|
|
636
639
|
throw new Error(`inbox prefixes cannot have wildcards '${r}'`);
|
|
637
640
|
}), `${r}.${De.next()}`;
|
|
638
641
|
}
|
|
639
|
-
const
|
|
642
|
+
const As = "127.0.0.1";
|
|
640
643
|
var qe;
|
|
641
644
|
(function(r) {
|
|
642
645
|
r.PING = "PING", r.STATS = "STATS", r.INFO = "INFO";
|
|
@@ -701,10 +704,10 @@ function Dr(r) {
|
|
|
701
704
|
}
|
|
702
705
|
return r;
|
|
703
706
|
}
|
|
704
|
-
function
|
|
707
|
+
function Ji(r) {
|
|
705
708
|
return r === 0 ? 0 : Math.floor(r / 2 + Math.random() * r);
|
|
706
709
|
}
|
|
707
|
-
function
|
|
710
|
+
function Fs(r = [
|
|
708
711
|
0,
|
|
709
712
|
250,
|
|
710
713
|
250,
|
|
@@ -725,17 +728,17 @@ function Bs(r = [
|
|
|
725
728
|
const e = r.length - 1;
|
|
726
729
|
return {
|
|
727
730
|
backoff(t) {
|
|
728
|
-
return
|
|
731
|
+
return Ji(t > e ? r[e] : r[t]);
|
|
729
732
|
}
|
|
730
733
|
};
|
|
731
734
|
}
|
|
732
735
|
function G(r) {
|
|
733
736
|
return r * 1e6;
|
|
734
737
|
}
|
|
735
|
-
function
|
|
738
|
+
function Bs(r) {
|
|
736
739
|
return Math.floor(r / 1e6);
|
|
737
740
|
}
|
|
738
|
-
function
|
|
741
|
+
function pr(r) {
|
|
739
742
|
let s = !0;
|
|
740
743
|
const i = new Array(r.length);
|
|
741
744
|
for (let n = 0; n < r.length; n++) {
|
|
@@ -838,7 +841,7 @@ ${t}: ${s[i]}`;
|
|
|
838
841
|
case me.Exact:
|
|
839
842
|
return s.filter((i) => i === e);
|
|
840
843
|
case me.CanonicalMIME:
|
|
841
|
-
return e =
|
|
844
|
+
return e = pr(e), s.filter((i) => i === e);
|
|
842
845
|
default: {
|
|
843
846
|
const i = e.toLowerCase();
|
|
844
847
|
return s.filter((n) => i === n.toLowerCase());
|
|
@@ -870,7 +873,7 @@ ${t}: ${s[i]}`;
|
|
|
870
873
|
this.delete(e, s), this.append(e, t, s);
|
|
871
874
|
}
|
|
872
875
|
append(e, t, s = me.Exact) {
|
|
873
|
-
const i =
|
|
876
|
+
const i = pr(e);
|
|
874
877
|
s === me.CanonicalMIME && (e = i);
|
|
875
878
|
const n = this.findKeys(e, s);
|
|
876
879
|
e = n.length > 0 ? n[0] : e;
|
|
@@ -915,7 +918,7 @@ ${t}: ${s[i]}`;
|
|
|
915
918
|
return t;
|
|
916
919
|
}
|
|
917
920
|
}
|
|
918
|
-
function
|
|
921
|
+
function mr() {
|
|
919
922
|
return {
|
|
920
923
|
encode(r) {
|
|
921
924
|
return Ke.encode(r);
|
|
@@ -947,7 +950,7 @@ function Hr(r) {
|
|
|
947
950
|
var e;
|
|
948
951
|
return r && r.data.length === 0 && ((e = r.headers) == null ? void 0 : e.code) === 503 ? N.errorForCode(O.NoResponders) : null;
|
|
949
952
|
}
|
|
950
|
-
class
|
|
953
|
+
class Ds {
|
|
951
954
|
constructor(e, t, s) {
|
|
952
955
|
h(this, "_headers");
|
|
953
956
|
h(this, "_msg");
|
|
@@ -998,7 +1001,7 @@ class Hs {
|
|
|
998
1001
|
}) : null;
|
|
999
1002
|
}
|
|
1000
1003
|
}
|
|
1001
|
-
h(
|
|
1004
|
+
h(Ds, "jc");
|
|
1002
1005
|
function et(r) {
|
|
1003
1006
|
return ts("durable", r);
|
|
1004
1007
|
}
|
|
@@ -1040,11 +1043,11 @@ function ts(r, e = "") {
|
|
|
1040
1043
|
function gt(r, e = "") {
|
|
1041
1044
|
if (e === "")
|
|
1042
1045
|
throw Error(`${r} name required`);
|
|
1043
|
-
const t =
|
|
1046
|
+
const t = zi(e);
|
|
1044
1047
|
if (t.length)
|
|
1045
1048
|
throw new Error(`invalid ${r} name - ${r} name ${t}`);
|
|
1046
1049
|
}
|
|
1047
|
-
function
|
|
1050
|
+
function zi(r = "") {
|
|
1048
1051
|
if (r === "")
|
|
1049
1052
|
throw Error("name required");
|
|
1050
1053
|
const e = /^[-\w]+$/g;
|
|
@@ -1055,22 +1058,22 @@ function Hi(r = "") {
|
|
|
1055
1058
|
}
|
|
1056
1059
|
return "";
|
|
1057
1060
|
}
|
|
1058
|
-
function
|
|
1061
|
+
function Ps(r) {
|
|
1059
1062
|
if (r.data.length > 0)
|
|
1060
1063
|
return !1;
|
|
1061
1064
|
const e = r.headers;
|
|
1062
1065
|
return e ? e.code >= 100 && e.code < 200 : !1;
|
|
1063
1066
|
}
|
|
1064
|
-
function
|
|
1067
|
+
function Os(r) {
|
|
1065
1068
|
var e;
|
|
1066
|
-
return
|
|
1069
|
+
return Ps(r) && ((e = r.headers) == null ? void 0 : e.description) === "Idle Heartbeat";
|
|
1067
1070
|
}
|
|
1068
|
-
function
|
|
1071
|
+
function Gi(r, e, t) {
|
|
1069
1072
|
const s = $e(r, e), i = {
|
|
1070
1073
|
hdr: 1,
|
|
1071
1074
|
sid: 0,
|
|
1072
1075
|
size: 0
|
|
1073
|
-
}, n = new
|
|
1076
|
+
}, n = new Ds(i, ye, {});
|
|
1074
1077
|
return n._headers = s, n._subject = t, n;
|
|
1075
1078
|
}
|
|
1076
1079
|
function tt(r) {
|
|
@@ -1083,7 +1086,7 @@ var Se;
|
|
|
1083
1086
|
(function(r) {
|
|
1084
1087
|
r.MaxBatchExceeded = "exceeded maxrequestbatch of", r.MaxExpiresExceeded = "exceeded maxrequestexpires of", r.MaxBytesExceeded = "exceeded maxrequestmaxbytes of", r.MaxMessageSizeExceeded = "message size exceeds maxbytes", r.PushConsumer = "consumer is push based", r.MaxWaitingExceeded = "exceeded maxwaiting", r.IdleHeartbeatMissed = "idle heartbeats missed", r.ConsumerDeleted = "consumer deleted";
|
|
1085
1088
|
})(Se || (Se = {}));
|
|
1086
|
-
function
|
|
1089
|
+
function Ki(r) {
|
|
1087
1090
|
return r.code !== O.JetStream409 ? !1 : [
|
|
1088
1091
|
Se.MaxBatchExceeded,
|
|
1089
1092
|
Se.MaxExpiresExceeded,
|
|
@@ -1203,7 +1206,7 @@ class oe {
|
|
|
1203
1206
|
return this.received - this.filtered;
|
|
1204
1207
|
}
|
|
1205
1208
|
}
|
|
1206
|
-
class
|
|
1209
|
+
class Hs {
|
|
1207
1210
|
constructor(e, t, s = {
|
|
1208
1211
|
maxOut: 2
|
|
1209
1212
|
}) {
|
|
@@ -1243,18 +1246,18 @@ class Js {
|
|
|
1243
1246
|
}, this.interval);
|
|
1244
1247
|
}
|
|
1245
1248
|
}
|
|
1246
|
-
var
|
|
1249
|
+
var ks;
|
|
1247
1250
|
(function(r) {
|
|
1248
1251
|
r.Limits = "limits", r.Interest = "interest", r.Workqueue = "workqueue";
|
|
1249
|
-
})(
|
|
1252
|
+
})(ks || (ks = {}));
|
|
1250
1253
|
var Et;
|
|
1251
1254
|
(function(r) {
|
|
1252
1255
|
r.Old = "old", r.New = "new";
|
|
1253
1256
|
})(Et || (Et = {}));
|
|
1254
|
-
var
|
|
1257
|
+
var Cs;
|
|
1255
1258
|
(function(r) {
|
|
1256
1259
|
r.File = "file", r.Memory = "memory";
|
|
1257
|
-
})(
|
|
1260
|
+
})(Cs || (Cs = {}));
|
|
1258
1261
|
var Q;
|
|
1259
1262
|
(function(r) {
|
|
1260
1263
|
r.All = "all", r.Last = "last", r.New = "new", r.StartSequence = "by_start_sequence", r.StartTime = "by_start_time", r.LastPerSubject = "last_per_subject";
|
|
@@ -1275,7 +1278,7 @@ var Wt;
|
|
|
1275
1278
|
(function(r) {
|
|
1276
1279
|
r.CreateOrUpdate = "", r.Update = "update", r.Create = "create";
|
|
1277
1280
|
})(Wt || (Wt = {}));
|
|
1278
|
-
function
|
|
1281
|
+
function Vi(r, e = {}) {
|
|
1279
1282
|
return Object.assign({
|
|
1280
1283
|
name: r,
|
|
1281
1284
|
deliver_policy: Q.All,
|
|
@@ -1284,10 +1287,10 @@ function Gi(r, e = {}) {
|
|
|
1284
1287
|
replay_policy: nt.Instant
|
|
1285
1288
|
}, e);
|
|
1286
1289
|
}
|
|
1287
|
-
var
|
|
1290
|
+
var br;
|
|
1288
1291
|
(function(r) {
|
|
1289
1292
|
r.API = "api_audit", r.StreamAction = "stream_action", r.ConsumerAction = "consumer_action", r.SnapshotCreate = "snapshot_create", r.SnapshotComplete = "snapshot_complete", r.RestoreCreate = "restore_create", r.RestoreComplete = "restore_complete", r.MaxDeliver = "max_deliver", r.Terminated = "terminated", r.Ack = "consumer_ack", r.StreamLeaderElected = "stream_leader_elected", r.StreamQuorumLost = "stream_quorum_lost", r.ConsumerLeaderElected = "consumer_leader_elected", r.ConsumerQuorumLost = "consumer_quorum_lost";
|
|
1290
|
-
})(
|
|
1293
|
+
})(br || (br = {}));
|
|
1291
1294
|
var de;
|
|
1292
1295
|
(function(r) {
|
|
1293
1296
|
r.StreamSourceHdr = "Nats-Stream-Source", r.LastConsumerSeqHdr = "Nats-Last-Consumer", r.LastStreamSeqHdr = "Nats-Last-Stream", r.ConsumerStalledHdr = "Nats-Consumer-Stalled", r.MessageSizeHdr = "Nats-Msg-Size", r.RollupHdr = "Nats-Rollup", r.RollupValueSubject = "sub", r.RollupValueAll = "all", r.PendingMessagesHdr = "Nats-Pending-Messages", r.PendingBytesHdr = "Nats-Pending-Bytes";
|
|
@@ -1300,12 +1303,12 @@ var Qe;
|
|
|
1300
1303
|
(function(r) {
|
|
1301
1304
|
r.Stream = "Nats-Stream", r.Sequence = "Nats-Sequence", r.TimeStamp = "Nats-Time-Stamp", r.Subject = "Nats-Subject";
|
|
1302
1305
|
})(Qe || (Qe = {}));
|
|
1303
|
-
var
|
|
1306
|
+
var gr;
|
|
1304
1307
|
(function(r) {
|
|
1305
1308
|
r.Stream = "Nats-Stream", r.Subject = "Nats-Subject", r.Sequence = "Nats-Sequence", r.LastSequence = "Nats-Last-Sequence", r.Size = "Nats-Msg-Size";
|
|
1306
|
-
})(
|
|
1309
|
+
})(gr || (gr = {}));
|
|
1307
1310
|
const be = "KV_";
|
|
1308
|
-
class
|
|
1311
|
+
class Wi {
|
|
1309
1312
|
constructor(e) {
|
|
1310
1313
|
h(this, "config");
|
|
1311
1314
|
h(this, "ordered");
|
|
@@ -1316,7 +1319,7 @@ class Ki {
|
|
|
1316
1319
|
h(this, "qname");
|
|
1317
1320
|
h(this, "isBind");
|
|
1318
1321
|
h(this, "filters");
|
|
1319
|
-
this.stream = "", this.mack = !1, this.ordered = !1, this.config =
|
|
1322
|
+
this.stream = "", this.mack = !1, this.ordered = !1, this.config = Vi("", e || {});
|
|
1320
1323
|
}
|
|
1321
1324
|
getOpts() {
|
|
1322
1325
|
var t;
|
|
@@ -1458,12 +1461,12 @@ class Ki {
|
|
|
1458
1461
|
}
|
|
1459
1462
|
}
|
|
1460
1463
|
function Be(r) {
|
|
1461
|
-
return new
|
|
1464
|
+
return new Wi(r);
|
|
1462
1465
|
}
|
|
1463
|
-
function
|
|
1466
|
+
function _r(r) {
|
|
1464
1467
|
return typeof r.getOpts == "function";
|
|
1465
1468
|
}
|
|
1466
|
-
class
|
|
1469
|
+
class Yi {
|
|
1467
1470
|
static encode(e) {
|
|
1468
1471
|
if (typeof e == "string")
|
|
1469
1472
|
return btoa(e);
|
|
@@ -1477,7 +1480,7 @@ class Vi {
|
|
|
1477
1480
|
}
|
|
1478
1481
|
class st {
|
|
1479
1482
|
static encode(e) {
|
|
1480
|
-
return st.toB64URLEncoding(
|
|
1483
|
+
return st.toB64URLEncoding(Yi.encode(e));
|
|
1481
1484
|
}
|
|
1482
1485
|
static decode(e, t = !1) {
|
|
1483
1486
|
return st.decode(st.fromB64URLEncoding(e), t);
|
|
@@ -1559,7 +1562,7 @@ class ot {
|
|
|
1559
1562
|
return this.buffers.length;
|
|
1560
1563
|
}
|
|
1561
1564
|
}
|
|
1562
|
-
function
|
|
1565
|
+
function Xi(r, e) {
|
|
1563
1566
|
return e.forEach(function(t) {
|
|
1564
1567
|
t && typeof t != "string" && !Array.isArray(t) && Object.keys(t).forEach(function(s) {
|
|
1565
1568
|
if (s !== "default" && !(s in r)) {
|
|
@@ -1574,12 +1577,12 @@ function Wi(r, e) {
|
|
|
1574
1577
|
});
|
|
1575
1578
|
}), Object.freeze(r);
|
|
1576
1579
|
}
|
|
1577
|
-
var
|
|
1580
|
+
var Zi = typeof global < "u" ? global : typeof self < "u" ? self : typeof window < "u" ? window : {}, mt = Zi.performance || {};
|
|
1578
1581
|
mt.now || mt.mozNow || mt.msNow || mt.oNow || mt.webkitNow;
|
|
1579
|
-
var
|
|
1582
|
+
var yr = {
|
|
1580
1583
|
versions: {}
|
|
1581
|
-
},
|
|
1582
|
-
function
|
|
1584
|
+
}, Qi = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
1585
|
+
function en(r) {
|
|
1583
1586
|
if (r.__esModule) return r;
|
|
1584
1587
|
var e = Object.defineProperty({}, "__esModule", {
|
|
1585
1588
|
value: !0
|
|
@@ -1596,17 +1599,17 @@ function Zi(r) {
|
|
|
1596
1599
|
}
|
|
1597
1600
|
var ys, ss = {
|
|
1598
1601
|
exports: {}
|
|
1599
|
-
},
|
|
1602
|
+
}, wr = {}, xr = en(Xi({
|
|
1600
1603
|
__proto__: null,
|
|
1601
|
-
default:
|
|
1604
|
+
default: wr
|
|
1602
1605
|
}, [
|
|
1603
|
-
|
|
1606
|
+
wr
|
|
1604
1607
|
]));
|
|
1605
1608
|
ys = ss, function() {
|
|
1606
1609
|
var r = "input is invalid type", e = typeof window == "object", t = e ? window : {};
|
|
1607
1610
|
t.JS_SHA256_NO_WINDOW && (e = !1);
|
|
1608
|
-
var s = !e && typeof self == "object", i = !t.JS_SHA256_NO_NODE_JS &&
|
|
1609
|
-
i ? t =
|
|
1611
|
+
var s = !e && typeof self == "object", i = !t.JS_SHA256_NO_NODE_JS && yr.versions && yr.versions.node;
|
|
1612
|
+
i ? t = Qi : s && (t = self);
|
|
1610
1613
|
var n = !t.JS_SHA256_NO_COMMON_JS && ys.exports, o = !t.JS_SHA256_NO_ARRAY_BUFFER && typeof ArrayBuffer < "u", a = "0123456789abcdef".split(""), d = [
|
|
1611
1614
|
-2147483648,
|
|
1612
1615
|
8388608,
|
|
@@ -1710,7 +1713,7 @@ ys = ss, function() {
|
|
|
1710
1713
|
}
|
|
1711
1714
|
return j;
|
|
1712
1715
|
}, T = function(w, j) {
|
|
1713
|
-
var F, R =
|
|
1716
|
+
var F, R = xr, A = xr.Buffer, $ = j ? "sha224" : "sha256";
|
|
1714
1717
|
return F = A.from && !t.JS_SHA256_NO_BUFFER_FROM ? A.from : function(q) {
|
|
1715
1718
|
return new A(q);
|
|
1716
1719
|
}, function(q) {
|
|
@@ -1857,23 +1860,23 @@ ys = ss, function() {
|
|
|
1857
1860
|
}();
|
|
1858
1861
|
ss.exports;
|
|
1859
1862
|
ss.exports.sha224;
|
|
1860
|
-
var
|
|
1861
|
-
function
|
|
1862
|
-
return
|
|
1863
|
+
var Sr = ss.exports.sha256;
|
|
1864
|
+
function Is(r) {
|
|
1865
|
+
return an(r);
|
|
1863
1866
|
}
|
|
1864
|
-
function
|
|
1867
|
+
function tn(r) {
|
|
1865
1868
|
if (!/^[0-9A-Fa-f]+$/.test(r))
|
|
1866
1869
|
return !1;
|
|
1867
1870
|
const t = /^[0-9A-F]+$/.test(r), s = /^[0-9a-f]+$/.test(r);
|
|
1868
1871
|
return t || s ? r.length % 2 === 0 : !1;
|
|
1869
1872
|
}
|
|
1870
|
-
function
|
|
1873
|
+
function sn(r) {
|
|
1871
1874
|
return /^[A-Za-z0-9\-_]*(={0,2})?$/.test(r) || /^[A-Za-z0-9+/]*(={0,2})?$/.test(r);
|
|
1872
1875
|
}
|
|
1873
|
-
function
|
|
1874
|
-
return
|
|
1876
|
+
function rn(r) {
|
|
1877
|
+
return tn(r) ? "hex" : sn(r) ? "b64" : "";
|
|
1875
1878
|
}
|
|
1876
|
-
function
|
|
1879
|
+
function nn(r) {
|
|
1877
1880
|
if (r.length % 2 !== 0)
|
|
1878
1881
|
throw new Error("hex string must have an even length");
|
|
1879
1882
|
const e = new Uint8Array(r.length / 2);
|
|
@@ -1881,22 +1884,22 @@ function sn(r) {
|
|
|
1881
1884
|
e[t / 2] = parseInt(r.substring(t, t + 2), 16);
|
|
1882
1885
|
return e;
|
|
1883
1886
|
}
|
|
1884
|
-
function
|
|
1887
|
+
function on(r) {
|
|
1885
1888
|
r = r.replace(/-/g, "+"), r = r.replace(/_/g, "/");
|
|
1886
1889
|
const e = atob(r);
|
|
1887
1890
|
return Uint8Array.from(e, (t) => t.charCodeAt(0));
|
|
1888
1891
|
}
|
|
1889
|
-
function
|
|
1890
|
-
switch (
|
|
1892
|
+
function an(r) {
|
|
1893
|
+
switch (rn(r)) {
|
|
1891
1894
|
case "hex":
|
|
1892
|
-
return
|
|
1895
|
+
return nn(r);
|
|
1893
1896
|
case "b64":
|
|
1894
|
-
return
|
|
1897
|
+
return on(r);
|
|
1895
1898
|
}
|
|
1896
1899
|
return null;
|
|
1897
1900
|
}
|
|
1898
|
-
function
|
|
1899
|
-
const t = typeof r == "string" ?
|
|
1901
|
+
function cn(r, e) {
|
|
1902
|
+
const t = typeof r == "string" ? Is(r) : r, s = typeof e == "string" ? Is(e) : e;
|
|
1900
1903
|
if (t === null || s === null || t.length !== s.length)
|
|
1901
1904
|
return !1;
|
|
1902
1905
|
for (let i = 0; i < t.length; i++)
|
|
@@ -1914,7 +1917,7 @@ class zr {
|
|
|
1914
1917
|
this.mux = e, this.requestSubject = t, this.received = 0, this.token = De.next(), s && (this.ctx = new Error());
|
|
1915
1918
|
}
|
|
1916
1919
|
}
|
|
1917
|
-
class
|
|
1920
|
+
class hn extends zr {
|
|
1918
1921
|
constructor(t, s, i = {
|
|
1919
1922
|
maxWait: 1e3
|
|
1920
1923
|
}) {
|
|
@@ -1961,10 +1964,10 @@ ${this.ctx.stack}`), this.deferred.reject(t)) : this.deferred.resolve(s), this.c
|
|
|
1961
1964
|
this.timer && this.timer.cancel(), this.mux.cancel(this), this.deferred.reject(t || N.errorForCode(O.Cancelled));
|
|
1962
1965
|
}
|
|
1963
1966
|
}
|
|
1964
|
-
const
|
|
1965
|
-
function
|
|
1967
|
+
const un = "$JS.API";
|
|
1968
|
+
function ln(r) {
|
|
1966
1969
|
return r = r || {}, r.domain && (r.apiPrefix = `$JS.${r.domain}.API`, delete r.domain), es({
|
|
1967
|
-
apiPrefix:
|
|
1970
|
+
apiPrefix: un,
|
|
1968
1971
|
timeout: 5e3
|
|
1969
1972
|
}, r);
|
|
1970
1973
|
}
|
|
@@ -1975,7 +1978,7 @@ class Ot {
|
|
|
1975
1978
|
h(this, "prefix");
|
|
1976
1979
|
h(this, "timeout");
|
|
1977
1980
|
h(this, "jc");
|
|
1978
|
-
this.nc = e, this.opts =
|
|
1981
|
+
this.nc = e, this.opts = ln(t), this._parseOpts(), this.prefix = this.opts.apiPrefix, this.timeout = this.opts.timeout, this.jc = ve();
|
|
1979
1982
|
}
|
|
1980
1983
|
getOptions() {
|
|
1981
1984
|
return Object.assign({}, this.opts);
|
|
@@ -1992,7 +1995,7 @@ class Ot {
|
|
|
1992
1995
|
t && (i = this.jc.encode(t));
|
|
1993
1996
|
let { retries: n } = s;
|
|
1994
1997
|
n = n || 1, n = n === -1 ? Number.MAX_SAFE_INTEGER : n;
|
|
1995
|
-
const o =
|
|
1998
|
+
const o = Fs();
|
|
1996
1999
|
for (let a = 0; a < n; a++)
|
|
1997
2000
|
try {
|
|
1998
2001
|
const d = await this.nc.request(e, i, s);
|
|
@@ -2091,14 +2094,14 @@ function Ge(r = "") {
|
|
|
2091
2094
|
};
|
|
2092
2095
|
throw new Error(`'${r}' is not a semver value`);
|
|
2093
2096
|
}
|
|
2094
|
-
function
|
|
2097
|
+
function js(r, e) {
|
|
2095
2098
|
return r.major < e.major ? -1 : r.major > e.major ? 1 : r.minor < e.minor ? -1 : r.minor > e.minor ? 1 : r.micro < e.micro ? -1 : r.micro > e.micro ? 1 : 0;
|
|
2096
2099
|
}
|
|
2097
2100
|
var H;
|
|
2098
2101
|
(function(r) {
|
|
2099
2102
|
r.JS_KV = "js_kv", r.JS_OBJECTSTORE = "js_objectstore", r.JS_PULL_MAX_BYTES = "js_pull_max_bytes", r.JS_NEW_CONSUMER_CREATE_API = "js_new_consumer_create", r.JS_ALLOW_DIRECT = "js_allow_direct", r.JS_MULTIPLE_CONSUMER_FILTER = "js_multiple_consumer_filter", r.JS_SIMPLIFICATION = "js_simplification", r.JS_STREAM_CONSUMER_METADATA = "js_stream_consumer_metadata", r.JS_CONSUMER_FILTER_SUBJECTS = "js_consumer_filter_subjects", r.JS_STREAM_FIRST_SEQ = "js_stream_first_seq", r.JS_STREAM_SUBJECT_TRANSFORM = "js_stream_subject_transform", r.JS_STREAM_SOURCE_SUBJECT_TRANSFORM = "js_stream_source_subject_transform", r.JS_STREAM_COMPRESSION = "js_stream_compression", r.JS_DEFAULT_CONSUMER_LIMITS = "js_default_consumer_limits", r.JS_BATCH_DIRECT_GET = "js_batch_direct_get";
|
|
2100
2103
|
})(H || (H = {}));
|
|
2101
|
-
class
|
|
2104
|
+
class fn {
|
|
2102
2105
|
constructor(e) {
|
|
2103
2106
|
h(this, "server");
|
|
2104
2107
|
h(this, "features");
|
|
@@ -2122,7 +2125,7 @@ class un {
|
|
|
2122
2125
|
set(e, t) {
|
|
2123
2126
|
this.features.set(e, {
|
|
2124
2127
|
min: t,
|
|
2125
|
-
ok:
|
|
2128
|
+
ok: js(this.server, Ge(t)) >= 0
|
|
2126
2129
|
});
|
|
2127
2130
|
}
|
|
2128
2131
|
get(e) {
|
|
@@ -2136,7 +2139,7 @@ class un {
|
|
|
2136
2139
|
return ((t = this.get(e)) == null ? void 0 : t.ok) || !1;
|
|
2137
2140
|
}
|
|
2138
2141
|
require(e) {
|
|
2139
|
-
return typeof e == "string" && (e = Ge(e)),
|
|
2142
|
+
return typeof e == "string" && (e = Ge(e)), js(this.server, e) >= 0;
|
|
2140
2143
|
}
|
|
2141
2144
|
}
|
|
2142
2145
|
class Yt extends Ot {
|
|
@@ -2212,7 +2215,7 @@ function Ze(r, e, t = !1) {
|
|
|
2212
2215
|
if (r && typeof r != "function")
|
|
2213
2216
|
throw N.errorForCode(O.ApiError, new Error(`${e} is not a function`));
|
|
2214
2217
|
}
|
|
2215
|
-
class
|
|
2218
|
+
class dn extends oe {
|
|
2216
2219
|
constructor(t, s, i) {
|
|
2217
2220
|
super();
|
|
2218
2221
|
h(this, "sub");
|
|
@@ -2294,7 +2297,7 @@ class ln extends oe {
|
|
|
2294
2297
|
}
|
|
2295
2298
|
}
|
|
2296
2299
|
let _e;
|
|
2297
|
-
function
|
|
2300
|
+
function pn(r) {
|
|
2298
2301
|
_e = r;
|
|
2299
2302
|
}
|
|
2300
2303
|
function Kr() {
|
|
@@ -2303,34 +2306,34 @@ function Kr() {
|
|
|
2303
2306
|
function ws() {
|
|
2304
2307
|
return _e !== void 0 && _e.urlParseFn ? _e.urlParseFn : void 0;
|
|
2305
2308
|
}
|
|
2306
|
-
function
|
|
2309
|
+
function mn() {
|
|
2307
2310
|
if (!_e || typeof _e.factory != "function")
|
|
2308
2311
|
throw new Error("transport fn is not set");
|
|
2309
2312
|
return _e.factory();
|
|
2310
2313
|
}
|
|
2311
|
-
function
|
|
2314
|
+
function Rs() {
|
|
2312
2315
|
return _e !== void 0 && _e.dnsResolveFn ? _e.dnsResolveFn : void 0;
|
|
2313
2316
|
}
|
|
2314
2317
|
const Ht = `\r
|
|
2315
|
-
`, Xt = ot.fromAscii(Ht),
|
|
2316
|
-
function
|
|
2318
|
+
`, Xt = ot.fromAscii(Ht), bn = new Uint8Array(Xt)[0], gn = new Uint8Array(Xt)[1];
|
|
2319
|
+
function _n(r) {
|
|
2317
2320
|
for (let e = 0; e < r.length; e++) {
|
|
2318
2321
|
const t = e + 1;
|
|
2319
|
-
if (r.byteLength > t && r[e] ===
|
|
2322
|
+
if (r.byteLength > t && r[e] === bn && r[t] === gn)
|
|
2320
2323
|
return t + 1;
|
|
2321
2324
|
}
|
|
2322
2325
|
return 0;
|
|
2323
2326
|
}
|
|
2324
|
-
function
|
|
2325
|
-
const e =
|
|
2327
|
+
function yn(r) {
|
|
2328
|
+
const e = _n(r);
|
|
2326
2329
|
if (e > 0) {
|
|
2327
2330
|
const s = new Uint8Array(r).slice(0, e);
|
|
2328
2331
|
return ge.decode(s);
|
|
2329
2332
|
}
|
|
2330
2333
|
return "";
|
|
2331
2334
|
}
|
|
2332
|
-
const
|
|
2333
|
-
function
|
|
2335
|
+
const wn = 4, Vr = 48, xn = 65, Sn = 97;
|
|
2336
|
+
function En(r, e, t, s) {
|
|
2334
2337
|
const i = new Uint8Array(16);
|
|
2335
2338
|
return [
|
|
2336
2339
|
0,
|
|
@@ -2349,16 +2352,16 @@ function xn(r, e, t, s) {
|
|
|
2349
2352
|
i[a] = o;
|
|
2350
2353
|
}), i[12] = r, i[13] = e, i[14] = t, i[15] = s, i;
|
|
2351
2354
|
}
|
|
2352
|
-
function
|
|
2353
|
-
return
|
|
2355
|
+
function Ns(r) {
|
|
2356
|
+
return vn(r) !== void 0;
|
|
2354
2357
|
}
|
|
2355
|
-
function
|
|
2358
|
+
function vn(r) {
|
|
2356
2359
|
for (let e = 0; e < r.length; e++)
|
|
2357
2360
|
switch (r[e]) {
|
|
2358
2361
|
case ".":
|
|
2359
2362
|
return Wr(r);
|
|
2360
2363
|
case ":":
|
|
2361
|
-
return
|
|
2364
|
+
return An(r);
|
|
2362
2365
|
}
|
|
2363
2366
|
}
|
|
2364
2367
|
function Wr(r) {
|
|
@@ -2371,21 +2374,21 @@ function Wr(r) {
|
|
|
2371
2374
|
return;
|
|
2372
2375
|
r = r.substring(1);
|
|
2373
2376
|
}
|
|
2374
|
-
const { n: s, c: i, ok: n } =
|
|
2377
|
+
const { n: s, c: i, ok: n } = Pn(r);
|
|
2375
2378
|
if (!n || s > 255)
|
|
2376
2379
|
return;
|
|
2377
2380
|
r = r.substring(i), e[t] = s;
|
|
2378
2381
|
}
|
|
2379
|
-
return
|
|
2382
|
+
return En(e[0], e[1], e[2], e[3]);
|
|
2380
2383
|
}
|
|
2381
|
-
function
|
|
2384
|
+
function An(r) {
|
|
2382
2385
|
const e = new Uint8Array(16);
|
|
2383
2386
|
let t = -1;
|
|
2384
2387
|
if (r.length >= 2 && r[0] === ":" && r[1] === ":" && (t = 0, r = r.substring(2), r.length === 0))
|
|
2385
2388
|
return e;
|
|
2386
2389
|
let s = 0;
|
|
2387
2390
|
for (; s < 16; ) {
|
|
2388
|
-
const { n: i, c: n, ok: o } =
|
|
2391
|
+
const { n: i, c: n, ok: o } = On(r);
|
|
2389
2392
|
if (!o || i > 65535)
|
|
2390
2393
|
return;
|
|
2391
2394
|
if (n < r.length && r[n] === ".") {
|
|
@@ -2394,7 +2397,7 @@ function En(r) {
|
|
|
2394
2397
|
const a = Wr(r);
|
|
2395
2398
|
if (a === void 0)
|
|
2396
2399
|
return;
|
|
2397
|
-
e[s] = a[12], e[s + 1] = a[13], e[s + 2] = a[14], e[s + 3] = a[15], r = "", s +=
|
|
2400
|
+
e[s] = a[12], e[s + 1] = a[13], e[s + 2] = a[14], e[s + 3] = a[15], r = "", s += wn;
|
|
2398
2401
|
break;
|
|
2399
2402
|
}
|
|
2400
2403
|
if (e[s] = i >> 8, e[s + 1] = i, s += 2, r = r.substring(n), r.length === 0)
|
|
@@ -2422,7 +2425,7 @@ function En(r) {
|
|
|
2422
2425
|
return e;
|
|
2423
2426
|
}
|
|
2424
2427
|
}
|
|
2425
|
-
function
|
|
2428
|
+
function Pn(r) {
|
|
2426
2429
|
let e = 0, t = 0;
|
|
2427
2430
|
for (e = 0; e < r.length && 48 <= r.charCodeAt(e) && r.charCodeAt(e) <= 57; e++)
|
|
2428
2431
|
if (t = t * 10 + (r.charCodeAt(e) - Vr), t >= 16777215)
|
|
@@ -2441,15 +2444,15 @@ function vn(r) {
|
|
|
2441
2444
|
ok: !0
|
|
2442
2445
|
};
|
|
2443
2446
|
}
|
|
2444
|
-
function
|
|
2447
|
+
function On(r) {
|
|
2445
2448
|
let e = 0, t = 0;
|
|
2446
2449
|
for (t = 0; t < r.length; t++) {
|
|
2447
2450
|
if (48 <= r.charCodeAt(t) && r.charCodeAt(t) <= 57)
|
|
2448
2451
|
e *= 16, e += r.charCodeAt(t) - Vr;
|
|
2449
2452
|
else if (97 <= r.charCodeAt(t) && r.charCodeAt(t) <= 102)
|
|
2450
|
-
e *= 16, e += r.charCodeAt(t) -
|
|
2453
|
+
e *= 16, e += r.charCodeAt(t) - Sn + 10;
|
|
2451
2454
|
else if (65 <= r.charCodeAt(t) && r.charCodeAt(t) <= 70)
|
|
2452
|
-
e *= 16, e += r.charCodeAt(t) -
|
|
2455
|
+
e *= 16, e += r.charCodeAt(t) - xn + 10;
|
|
2453
2456
|
else
|
|
2454
2457
|
break;
|
|
2455
2458
|
if (e >= 16777215)
|
|
@@ -2469,13 +2472,13 @@ function An(r) {
|
|
|
2469
2472
|
ok: !0
|
|
2470
2473
|
};
|
|
2471
2474
|
}
|
|
2472
|
-
function
|
|
2475
|
+
function kn(r) {
|
|
2473
2476
|
return r.indexOf("[") !== -1 || r.indexOf("::") !== -1 ? !1 : r.indexOf(".") !== -1 || r.split(":").length <= 2;
|
|
2474
2477
|
}
|
|
2475
|
-
function
|
|
2476
|
-
return !
|
|
2478
|
+
function Ts(r) {
|
|
2479
|
+
return !kn(r);
|
|
2477
2480
|
}
|
|
2478
|
-
function
|
|
2481
|
+
function Cn(r) {
|
|
2479
2482
|
const e = "::FFFF:", t = r.toUpperCase().indexOf(e);
|
|
2480
2483
|
if (t !== -1 && r.indexOf(".") !== -1) {
|
|
2481
2484
|
let s = r.substring(t + e.length);
|
|
@@ -2483,9 +2486,9 @@ function On(r) {
|
|
|
2483
2486
|
}
|
|
2484
2487
|
return r;
|
|
2485
2488
|
}
|
|
2486
|
-
function
|
|
2487
|
-
r = r.trim(), r.match(/^(.*:\/\/)(.*)/m) && (r = r.replace(/^(.*:\/\/)(.*)/gm, "$2")), r =
|
|
2488
|
-
const e =
|
|
2489
|
+
function In(r) {
|
|
2490
|
+
r = r.trim(), r.match(/^(.*:\/\/)(.*)/m) && (r = r.replace(/^(.*:\/\/)(.*)/gm, "$2")), r = Cn(r), Ts(r) && r.indexOf("[") === -1 && (r = `[${r}]`);
|
|
2491
|
+
const e = Ts(r) ? r.match(/(]:)(\d+)/) : r.match(/(:)(\d+)/), t = e && e.length === 3 && e[1] && e[2] ? parseInt(e[2]) : 4222, s = t === 80 ? "https" : "http", i = new URL(`${s}://${r}`);
|
|
2489
2492
|
i.port = `${t}`;
|
|
2490
2493
|
let n = i.hostname;
|
|
2491
2494
|
return n.charAt(0) === "[" && (n = n.substring(1, n.length - 1)), {
|
|
@@ -2507,7 +2510,7 @@ class xt {
|
|
|
2507
2510
|
h(this, "tlsName");
|
|
2508
2511
|
h(this, "resolves");
|
|
2509
2512
|
this.src = e, this.tlsName = "";
|
|
2510
|
-
const s =
|
|
2513
|
+
const s = In(e);
|
|
2511
2514
|
this.listen = s.listen, this.hostname = s.hostname, this.port = s.port, this.didConnect = !1, this.reconnects = 0, this.lastConnect = 0, this.gossiped = t;
|
|
2512
2515
|
}
|
|
2513
2516
|
toString() {
|
|
@@ -2519,7 +2522,7 @@ class xt {
|
|
|
2519
2522
|
this
|
|
2520
2523
|
];
|
|
2521
2524
|
const t = [];
|
|
2522
|
-
if (
|
|
2525
|
+
if (Ns(this.hostname))
|
|
2523
2526
|
return [
|
|
2524
2527
|
this
|
|
2525
2528
|
];
|
|
@@ -2527,7 +2530,7 @@ class xt {
|
|
|
2527
2530
|
const s = await e.fn(this.hostname);
|
|
2528
2531
|
e.debug && console.log(`resolve ${this.hostname} = ${s.join(",")}`);
|
|
2529
2532
|
for (const i of s) {
|
|
2530
|
-
const n = this.port === 80 ? "https" : "http", o = new URL(`${n}://${
|
|
2533
|
+
const n = this.port === 80 ? "https" : "http", o = new URL(`${n}://${Ts(i) ? "[" + i + "]" : i}`);
|
|
2531
2534
|
o.port = `${this.port}`;
|
|
2532
2535
|
const a = new xt(o.host, !1);
|
|
2533
2536
|
a.tlsName = this.hostname, t.push(a);
|
|
@@ -2536,7 +2539,7 @@ class xt {
|
|
|
2536
2539
|
return e.randomize && Dr(t), this.resolves = t, t;
|
|
2537
2540
|
}
|
|
2538
2541
|
}
|
|
2539
|
-
class
|
|
2542
|
+
class jn {
|
|
2540
2543
|
constructor(e = [], t = {}) {
|
|
2541
2544
|
h(this, "firstSelect");
|
|
2542
2545
|
h(this, "servers");
|
|
@@ -2547,14 +2550,14 @@ class Cn {
|
|
|
2547
2550
|
const s = ws();
|
|
2548
2551
|
e && (e.forEach((i) => {
|
|
2549
2552
|
i = s ? s(i) : i, this.servers.push(new xt(i));
|
|
2550
|
-
}), this.randomize && (this.servers = Dr(this.servers))), this.servers.length === 0 && this.addServer(`${
|
|
2553
|
+
}), this.randomize && (this.servers = Dr(this.servers))), this.servers.length === 0 && this.addServer(`${As}:${Kr()}`, !1), this.currentServer = this.servers[0];
|
|
2551
2554
|
}
|
|
2552
2555
|
clear() {
|
|
2553
2556
|
this.servers.length = 0;
|
|
2554
2557
|
}
|
|
2555
2558
|
updateTLSName() {
|
|
2556
2559
|
const e = this.getCurrentServer();
|
|
2557
|
-
|
|
2560
|
+
Ns(e.hostname) || (this.tlsName = e.hostname, this.servers.forEach((t) => {
|
|
2558
2561
|
t.gossiped && (t.tlsName = this.tlsName);
|
|
2559
2562
|
}));
|
|
2560
2563
|
}
|
|
@@ -2565,7 +2568,7 @@ class Cn {
|
|
|
2565
2568
|
const s = ws();
|
|
2566
2569
|
e = s ? s(e) : e;
|
|
2567
2570
|
const i = new xt(e, t);
|
|
2568
|
-
|
|
2571
|
+
Ns(i.hostname) && (i.tlsName = this.tlsName), this.servers.push(i);
|
|
2569
2572
|
}
|
|
2570
2573
|
selectServer() {
|
|
2571
2574
|
if (this.firstSelect)
|
|
@@ -2615,7 +2618,7 @@ class Cn {
|
|
|
2615
2618
|
};
|
|
2616
2619
|
}
|
|
2617
2620
|
}
|
|
2618
|
-
class
|
|
2621
|
+
class Rn {
|
|
2619
2622
|
constructor() {
|
|
2620
2623
|
h(this, "baseInbox");
|
|
2621
2624
|
h(this, "reqs");
|
|
@@ -2674,7 +2677,7 @@ class In {
|
|
|
2674
2677
|
});
|
|
2675
2678
|
}
|
|
2676
2679
|
}
|
|
2677
|
-
class
|
|
2680
|
+
class Nn {
|
|
2678
2681
|
constructor(e, t, s) {
|
|
2679
2682
|
h(this, "ph");
|
|
2680
2683
|
h(this, "interval");
|
|
@@ -2710,16 +2713,16 @@ class jn {
|
|
|
2710
2713
|
this.pendings = this.pendings.filter((e) => (e.resolve(), !1));
|
|
2711
2714
|
}
|
|
2712
2715
|
}
|
|
2713
|
-
class
|
|
2716
|
+
class Tn extends Error {
|
|
2714
2717
|
constructor(e) {
|
|
2715
2718
|
super(e), this.name = "AssertionError";
|
|
2716
2719
|
}
|
|
2717
2720
|
}
|
|
2718
|
-
function
|
|
2721
|
+
function Mn(r, e = "Assertion failed.") {
|
|
2719
2722
|
if (!r)
|
|
2720
|
-
throw new
|
|
2723
|
+
throw new Tn(e);
|
|
2721
2724
|
}
|
|
2722
|
-
const
|
|
2725
|
+
const Er = 32 * 1024, xs = 2 ** 32 - 2;
|
|
2723
2726
|
function qt(r, e, t = 0) {
|
|
2724
2727
|
const s = e.byteLength - t;
|
|
2725
2728
|
return r.byteLength > s && (r = r.subarray(0, s)), e.set(r, t), r.byteLength;
|
|
@@ -2765,7 +2768,7 @@ class Ss {
|
|
|
2765
2768
|
return e <= this.capacity - t ? (this._reslice(t + e), t) : -1;
|
|
2766
2769
|
}
|
|
2767
2770
|
_reslice(e) {
|
|
2768
|
-
|
|
2771
|
+
Mn(e <= this._buf.buffer.byteLength), this._buf = new Uint8Array(this._buf.buffer, 0, e);
|
|
2769
2772
|
}
|
|
2770
2773
|
readByte() {
|
|
2771
2774
|
const e = new Uint8Array(1);
|
|
@@ -2814,9 +2817,9 @@ class Ss {
|
|
|
2814
2817
|
}
|
|
2815
2818
|
readFrom(e) {
|
|
2816
2819
|
let t = 0;
|
|
2817
|
-
const s = new Uint8Array(
|
|
2820
|
+
const s = new Uint8Array(Er);
|
|
2818
2821
|
for (; ; ) {
|
|
2819
|
-
const i = this.capacity - this.length <
|
|
2822
|
+
const i = this.capacity - this.length < Er, n = i ? s : new Uint8Array(this._buf.buffer, this.length), o = e.read(n);
|
|
2820
2823
|
if (o === null)
|
|
2821
2824
|
return t;
|
|
2822
2825
|
i ? this.write(n.subarray(0, o)) : this._reslice(this.length + o), t += o;
|
|
@@ -2827,12 +2830,12 @@ var fe;
|
|
|
2827
2830
|
(function(r) {
|
|
2828
2831
|
r[r.OK = 0] = "OK", r[r.ERR = 1] = "ERR", r[r.MSG = 2] = "MSG", r[r.INFO = 3] = "INFO", r[r.PING = 4] = "PING", r[r.PONG = 5] = "PONG";
|
|
2829
2832
|
})(fe || (fe = {}));
|
|
2830
|
-
function
|
|
2833
|
+
function vr() {
|
|
2831
2834
|
const r = {};
|
|
2832
2835
|
return r.sid = -1, r.hdr = -1, r.size = -1, r;
|
|
2833
2836
|
}
|
|
2834
|
-
const
|
|
2835
|
-
class
|
|
2837
|
+
const $n = 48;
|
|
2838
|
+
class Ar {
|
|
2836
2839
|
constructor(e) {
|
|
2837
2840
|
h(this, "dispatcher");
|
|
2838
2841
|
h(this, "state");
|
|
@@ -2853,11 +2856,11 @@ class Pr {
|
|
|
2853
2856
|
switch (s) {
|
|
2854
2857
|
case C.M:
|
|
2855
2858
|
case C.m:
|
|
2856
|
-
this.state = k.OP_M, this.hdr = -1, this.ma =
|
|
2859
|
+
this.state = k.OP_M, this.hdr = -1, this.ma = vr();
|
|
2857
2860
|
break;
|
|
2858
2861
|
case C.H:
|
|
2859
2862
|
case C.h:
|
|
2860
|
-
this.state = k.OP_H, this.hdr = 0, this.ma =
|
|
2863
|
+
this.state = k.OP_H, this.hdr = 0, this.ma = vr();
|
|
2861
2864
|
break;
|
|
2862
2865
|
case C.P:
|
|
2863
2866
|
case C.p:
|
|
@@ -3286,7 +3289,7 @@ class Pr {
|
|
|
3286
3289
|
for (let s = 0; s < e.length; s++) {
|
|
3287
3290
|
if (e[s] < 48 || e[s] > 57)
|
|
3288
3291
|
return -1;
|
|
3289
|
-
t = t * 10 + (e[s] -
|
|
3292
|
+
t = t * 10 + (e[s] - $n);
|
|
3290
3293
|
}
|
|
3291
3294
|
return t;
|
|
3292
3295
|
}
|
|
@@ -3588,11 +3591,11 @@ var C;
|
|
|
3588
3591
|
for (u = 0; u < 16; u++)
|
|
3589
3592
|
c[2 * u] = E[u] & 255, c[2 * u + 1] = E[u] >> 8;
|
|
3590
3593
|
}
|
|
3591
|
-
function
|
|
3594
|
+
function Vs(c, l) {
|
|
3592
3595
|
var u = new Uint8Array(32), f = new Uint8Array(32);
|
|
3593
3596
|
return Ve(u, c), Ve(f, l), w(u, 0, f, 0);
|
|
3594
3597
|
}
|
|
3595
|
-
function
|
|
3598
|
+
function Ws(c) {
|
|
3596
3599
|
var l = new Uint8Array(32);
|
|
3597
3600
|
return Ve(l, c), l[0] & 1;
|
|
3598
3601
|
}
|
|
@@ -3623,14 +3626,14 @@ var C;
|
|
|
3623
3626
|
function we(c, l) {
|
|
3624
3627
|
B(c, l, l);
|
|
3625
3628
|
}
|
|
3626
|
-
function
|
|
3629
|
+
function Ys(c, l) {
|
|
3627
3630
|
var u = t(), f;
|
|
3628
3631
|
for (f = 0; f < 16; f++) u[f] = l[f];
|
|
3629
3632
|
for (f = 253; f >= 0; f--)
|
|
3630
3633
|
we(u, u), f !== 2 && f !== 4 && B(u, u, l);
|
|
3631
3634
|
for (f = 0; f < 16; f++) c[f] = u[f];
|
|
3632
3635
|
}
|
|
3633
|
-
function
|
|
3636
|
+
function Xs(c, l) {
|
|
3634
3637
|
var u = t(), f;
|
|
3635
3638
|
for (f = 0; f < 16; f++) u[f] = l[f];
|
|
3636
3639
|
for (f = 250; f >= 0; f--)
|
|
@@ -3647,26 +3650,26 @@ var C;
|
|
|
3647
3650
|
for (E = 0; E < 16; E++)
|
|
3648
3651
|
m[E + 16] = v[E], m[E + 32] = S[E], m[E + 48] = g[E], m[E + 64] = M[E];
|
|
3649
3652
|
var Oe = m.subarray(32), Xe = m.subarray(16);
|
|
3650
|
-
return
|
|
3653
|
+
return Ys(Oe, Oe), B(Xe, Xe, Oe), Ve(c, Xe), 0;
|
|
3651
3654
|
}
|
|
3652
3655
|
function It(c, l) {
|
|
3653
3656
|
return Ct(c, l, n);
|
|
3654
3657
|
}
|
|
3655
|
-
function
|
|
3658
|
+
function Zs(c, l) {
|
|
3656
3659
|
return s(l, 32), It(c, l);
|
|
3657
3660
|
}
|
|
3658
3661
|
function jt(c, l, u) {
|
|
3659
3662
|
var f = new Uint8Array(32);
|
|
3660
3663
|
return Ct(f, u, l), R(c, i, f, A);
|
|
3661
3664
|
}
|
|
3662
|
-
var
|
|
3663
|
-
function
|
|
3665
|
+
var Qs = ae, ai = ce;
|
|
3666
|
+
function ci(c, l, u, f, m, b) {
|
|
3664
3667
|
var E = new Uint8Array(32);
|
|
3665
|
-
return jt(E, m, b),
|
|
3668
|
+
return jt(E, m, b), Qs(c, l, u, f, E);
|
|
3666
3669
|
}
|
|
3667
|
-
function
|
|
3670
|
+
function hi(c, l, u, f, m, b) {
|
|
3668
3671
|
var E = new Uint8Array(32);
|
|
3669
|
-
return jt(E, m, b),
|
|
3672
|
+
return jt(E, m, b), ai(c, l, u, f, E);
|
|
3670
3673
|
}
|
|
3671
3674
|
function ct() {
|
|
3672
3675
|
var c = 0, l = 0, u = 0, f = 0, m = 65535, b, E, v;
|
|
@@ -3674,7 +3677,7 @@ var C;
|
|
|
3674
3677
|
b = arguments[v].lo, E = arguments[v].hi, c += b & m, l += b >>> 16, u += E & m, f += E >>> 16;
|
|
3675
3678
|
return l += c >>> 16, u += l >>> 16, f += u >>> 16, new e(u & m | f << 16, c & m | l << 16);
|
|
3676
3679
|
}
|
|
3677
|
-
function
|
|
3680
|
+
function er(c, l) {
|
|
3678
3681
|
return new e(c.hi >>> l, c.lo >>> l | c.hi << 32 - l);
|
|
3679
3682
|
}
|
|
3680
3683
|
function Rt() {
|
|
@@ -3687,27 +3690,27 @@ var C;
|
|
|
3687
3690
|
var u, f, m = 32 - l;
|
|
3688
3691
|
return l < 32 ? (u = c.hi >>> l | c.lo << m, f = c.lo >>> l | c.hi << m) : l < 64 && (u = c.lo >>> l | c.hi << m, f = c.hi >>> l | c.lo << m), new e(u, f);
|
|
3689
3692
|
}
|
|
3690
|
-
function
|
|
3693
|
+
function ui(c, l, u) {
|
|
3691
3694
|
var f = c.hi & l.hi ^ ~c.hi & u.hi, m = c.lo & l.lo ^ ~c.lo & u.lo;
|
|
3692
3695
|
return new e(f, m);
|
|
3693
3696
|
}
|
|
3694
|
-
function
|
|
3697
|
+
function li(c, l, u) {
|
|
3695
3698
|
var f = c.hi & l.hi ^ c.hi & u.hi ^ l.hi & u.hi, m = c.lo & l.lo ^ c.lo & u.lo ^ l.lo & u.lo;
|
|
3696
3699
|
return new e(f, m);
|
|
3697
3700
|
}
|
|
3698
|
-
function
|
|
3701
|
+
function fi(c) {
|
|
3699
3702
|
return Rt(Ie(c, 28), Ie(c, 34), Ie(c, 39));
|
|
3700
3703
|
}
|
|
3701
|
-
function
|
|
3704
|
+
function di(c) {
|
|
3702
3705
|
return Rt(Ie(c, 14), Ie(c, 18), Ie(c, 41));
|
|
3703
3706
|
}
|
|
3704
|
-
function
|
|
3705
|
-
return Rt(Ie(c, 1), Ie(c, 8),
|
|
3707
|
+
function pi(c) {
|
|
3708
|
+
return Rt(Ie(c, 1), Ie(c, 8), er(c, 7));
|
|
3706
3709
|
}
|
|
3707
|
-
function
|
|
3708
|
-
return Rt(Ie(c, 19), Ie(c, 61),
|
|
3710
|
+
function mi(c) {
|
|
3711
|
+
return Rt(Ie(c, 19), Ie(c, 61), er(c, 6));
|
|
3709
3712
|
}
|
|
3710
|
-
var
|
|
3713
|
+
var bi = [
|
|
3711
3714
|
new e(1116352408, 3609767458),
|
|
3712
3715
|
new e(1899447441, 602891725),
|
|
3713
3716
|
new e(3049323471, 3964484399),
|
|
@@ -3789,17 +3792,17 @@ var C;
|
|
|
3789
3792
|
new e(1607167915, 987167468),
|
|
3790
3793
|
new e(1816402316, 1246189591)
|
|
3791
3794
|
];
|
|
3792
|
-
function
|
|
3795
|
+
function tr(c, l, u) {
|
|
3793
3796
|
var f = [], m = [], b = [], E = [], v, g, S;
|
|
3794
3797
|
for (g = 0; g < 8; g++) f[g] = b[g] = J(c, 8 * g);
|
|
3795
3798
|
for (var M = 0; u >= 128; ) {
|
|
3796
3799
|
for (g = 0; g < 16; g++) E[g] = J(l, 8 * g + M);
|
|
3797
3800
|
for (g = 0; g < 80; g++) {
|
|
3798
3801
|
for (S = 0; S < 8; S++) m[S] = b[S];
|
|
3799
|
-
for (v = ct(b[7],
|
|
3802
|
+
for (v = ct(b[7], di(b[4]), ui(b[4], b[5], b[6]), bi[g], E[g % 16]), m[7] = ct(v, fi(b[0]), li(b[0], b[1], b[2])), m[3] = ct(m[3], v), S = 0; S < 8; S++) b[(S + 1) % 8] = m[S];
|
|
3800
3803
|
if (g % 16 === 15)
|
|
3801
3804
|
for (S = 0; S < 16; S++)
|
|
3802
|
-
E[S] = ct(E[S], E[(S + 9) % 16],
|
|
3805
|
+
E[S] = ct(E[S], E[(S + 9) % 16], pi(E[(S + 1) % 16]), mi(E[(S + 14) % 16]));
|
|
3803
3806
|
}
|
|
3804
3807
|
for (g = 0; g < 8; g++)
|
|
3805
3808
|
b[g] = ct(b[g], f[g]), f[g] = b[g];
|
|
@@ -3808,7 +3811,7 @@ var C;
|
|
|
3808
3811
|
for (g = 0; g < 8; g++) L(c, 8 * g, f[g]);
|
|
3809
3812
|
return u;
|
|
3810
3813
|
}
|
|
3811
|
-
var
|
|
3814
|
+
var gi = new Uint8Array([
|
|
3812
3815
|
106,
|
|
3813
3816
|
9,
|
|
3814
3817
|
230,
|
|
@@ -3876,29 +3879,29 @@ var C;
|
|
|
3876
3879
|
]);
|
|
3877
3880
|
function Je(c, l, u) {
|
|
3878
3881
|
var f = new Uint8Array(64), m = new Uint8Array(256), b, E = u;
|
|
3879
|
-
for (b = 0; b < 64; b++) f[b] =
|
|
3880
|
-
for (
|
|
3882
|
+
for (b = 0; b < 64; b++) f[b] = gi[b];
|
|
3883
|
+
for (tr(f, l, u), u %= 128, b = 0; b < 256; b++) m[b] = 0;
|
|
3881
3884
|
for (b = 0; b < u; b++) m[b] = l[E - u + b];
|
|
3882
|
-
for (m[u] = 128, u = 256 - 128 * (u < 112 ? 1 : 0), m[u - 9] = 0, L(m, u - 8, new e(E / 536870912 | 0, E << 3)),
|
|
3885
|
+
for (m[u] = 128, u = 256 - 128 * (u < 112 ? 1 : 0), m[u - 9] = 0, L(m, u - 8, new e(E / 536870912 | 0, E << 3)), tr(f, m, u), b = 0; b < 64; b++) c[b] = f[b];
|
|
3883
3886
|
return 0;
|
|
3884
3887
|
}
|
|
3885
3888
|
function Nt(c, l) {
|
|
3886
3889
|
var u = t(), f = t(), m = t(), b = t(), E = t(), v = t(), g = t(), S = t(), M = t();
|
|
3887
3890
|
Pe(u, c[1], c[0]), Pe(M, l[1], l[0]), B(u, u, M), Ae(f, c[0], c[1]), Ae(M, l[0], l[1]), B(f, f, M), B(m, c[3], l[3]), B(m, m, _), B(b, c[2], l[2]), Ae(b, b, b), Pe(E, f, u), Pe(v, b, m), Ae(g, b, m), Ae(S, f, u), B(c[0], E, v), B(c[1], S, g), B(c[2], g, v), B(c[3], E, S);
|
|
3888
3891
|
}
|
|
3889
|
-
function
|
|
3892
|
+
function sr(c, l, u) {
|
|
3890
3893
|
var f;
|
|
3891
3894
|
for (f = 0; f < 4; f++)
|
|
3892
3895
|
ie(c[f], l[f], u);
|
|
3893
3896
|
}
|
|
3894
3897
|
function ns(c, l) {
|
|
3895
3898
|
var u = t(), f = t(), m = t();
|
|
3896
|
-
|
|
3899
|
+
Ys(m, l[2]), B(u, l[0], m), B(f, l[1], m), Ve(c, f), c[31] ^= Ws(u) << 7;
|
|
3897
3900
|
}
|
|
3898
3901
|
function os(c, l, u) {
|
|
3899
3902
|
var f, m;
|
|
3900
3903
|
for (V(c[0], o), V(c[1], a), V(c[2], a), V(c[3], o), m = 255; m >= 0; --m)
|
|
3901
|
-
f = u[m / 8 | 0] >> (m & 7) & 1,
|
|
3904
|
+
f = u[m / 8 | 0] >> (m & 7) & 1, sr(c, l, f), Nt(l, c), Nt(c, c), sr(c, l, f);
|
|
3902
3905
|
}
|
|
3903
3906
|
function Tt(c, l) {
|
|
3904
3907
|
var u = [
|
|
@@ -3972,7 +3975,7 @@ var C;
|
|
|
3972
3975
|
for (u = 0; u < 64; u++) c[u] = 0;
|
|
3973
3976
|
cs(c, l);
|
|
3974
3977
|
}
|
|
3975
|
-
function
|
|
3978
|
+
function rr(c, l, u, f) {
|
|
3976
3979
|
var m = new Uint8Array(64), b = new Uint8Array(64), E = new Uint8Array(64), v, g, S = new Float64Array(64), M = [
|
|
3977
3980
|
t(),
|
|
3978
3981
|
t(),
|
|
@@ -3991,9 +3994,9 @@ var C;
|
|
|
3991
3994
|
S[v + g] += b[v] * m[g];
|
|
3992
3995
|
return cs(c.subarray(32), S), D;
|
|
3993
3996
|
}
|
|
3994
|
-
function
|
|
3997
|
+
function _i(c, l) {
|
|
3995
3998
|
var u = t(), f = t(), m = t(), b = t(), E = t(), v = t(), g = t();
|
|
3996
|
-
return V(c[2], a), is(c[1], l), we(m, c[1]), B(b, m, p), Pe(m, m, c[2]), Ae(b, c[2], b), we(E, b), we(v, E), B(g, v, E), B(u, g, m), B(u, u, b),
|
|
3999
|
+
return V(c[2], a), is(c[1], l), we(m, c[1]), B(b, m, p), Pe(m, m, c[2]), Ae(b, c[2], b), we(E, b), we(v, E), B(g, v, E), B(u, g, m), B(u, u, b), Xs(u, u), B(u, u, m), B(u, u, b), B(u, u, b), B(c[0], u, b), we(f, c[0]), B(f, f, b), Vs(f, m) && B(c[0], c[0], P), we(f, c[0]), B(f, f, b), Vs(f, m) ? -1 : (Ws(c[0]) === l[31] >> 7 && Pe(c[0], o, c[0]), B(c[3], c[0], c[1]), 0);
|
|
3997
4000
|
}
|
|
3998
4001
|
function us(c, l, u, f) {
|
|
3999
4002
|
var m, b = new Uint8Array(32), E = new Uint8Array(64), v = [
|
|
@@ -4007,7 +4010,7 @@ var C;
|
|
|
4007
4010
|
t(),
|
|
4008
4011
|
t()
|
|
4009
4012
|
];
|
|
4010
|
-
if (u < 64 ||
|
|
4013
|
+
if (u < 64 || _i(g, f)) return -1;
|
|
4011
4014
|
for (m = 0; m < u; m++) c[m] = l[m];
|
|
4012
4015
|
for (m = 0; m < 32; m++) c[m + 32] = f[m];
|
|
4013
4016
|
if (Je(E, c, u), hs(E), os(v, g, E), Tt(g, l.subarray(32)), Nt(v, g), ns(b, v), u -= 64, w(l, 0, b, 0)) {
|
|
@@ -4017,7 +4020,7 @@ var C;
|
|
|
4017
4020
|
for (m = 0; m < u; m++) c[m] = l[m + 64];
|
|
4018
4021
|
return u;
|
|
4019
4022
|
}
|
|
4020
|
-
var ls = 32, $t = 24, ht = 32, We = 16, ut = 32, Ut = 32, lt = 32, ft = 32, fs = 32,
|
|
4023
|
+
var ls = 32, $t = 24, ht = 32, We = 16, ut = 32, Ut = 32, lt = 32, ft = 32, fs = 32, ir = $t, yi = ht, wi = We, Te = 64, ze = 32, Ye = 64, ds = 32, ps = 64;
|
|
4021
4024
|
r.lowlevel = {
|
|
4022
4025
|
crypto_core_hsalsa20: R,
|
|
4023
4026
|
crypto_stream_xor: z,
|
|
@@ -4033,12 +4036,12 @@ var C;
|
|
|
4033
4036
|
crypto_scalarmult: Ct,
|
|
4034
4037
|
crypto_scalarmult_base: It,
|
|
4035
4038
|
crypto_box_beforenm: jt,
|
|
4036
|
-
crypto_box_afternm:
|
|
4037
|
-
crypto_box:
|
|
4038
|
-
crypto_box_open:
|
|
4039
|
-
crypto_box_keypair:
|
|
4039
|
+
crypto_box_afternm: Qs,
|
|
4040
|
+
crypto_box: ci,
|
|
4041
|
+
crypto_box_open: hi,
|
|
4042
|
+
crypto_box_keypair: Zs,
|
|
4040
4043
|
crypto_hash: Je,
|
|
4041
|
-
crypto_sign:
|
|
4044
|
+
crypto_sign: rr,
|
|
4042
4045
|
crypto_sign_keypair: as,
|
|
4043
4046
|
crypto_sign_open: us,
|
|
4044
4047
|
crypto_secretbox_KEYBYTES: ls,
|
|
@@ -4050,9 +4053,9 @@ var C;
|
|
|
4050
4053
|
crypto_box_PUBLICKEYBYTES: lt,
|
|
4051
4054
|
crypto_box_SECRETKEYBYTES: ft,
|
|
4052
4055
|
crypto_box_BEFORENMBYTES: fs,
|
|
4053
|
-
crypto_box_NONCEBYTES:
|
|
4054
|
-
crypto_box_ZEROBYTES:
|
|
4055
|
-
crypto_box_BOXZEROBYTES:
|
|
4056
|
+
crypto_box_NONCEBYTES: ir,
|
|
4057
|
+
crypto_box_ZEROBYTES: yi,
|
|
4058
|
+
crypto_box_BOXZEROBYTES: wi,
|
|
4056
4059
|
crypto_sign_BYTES: Te,
|
|
4057
4060
|
crypto_sign_PUBLICKEYBYTES: ze,
|
|
4058
4061
|
crypto_sign_SECRETKEYBYTES: Ye,
|
|
@@ -4067,18 +4070,18 @@ var C;
|
|
|
4067
4070
|
A: Ae,
|
|
4068
4071
|
S: we,
|
|
4069
4072
|
Z: Pe,
|
|
4070
|
-
pow2523:
|
|
4073
|
+
pow2523: Xs,
|
|
4071
4074
|
add: Nt,
|
|
4072
4075
|
set25519: V,
|
|
4073
4076
|
modL: cs,
|
|
4074
4077
|
scalarmult: os,
|
|
4075
4078
|
scalarbase: Tt
|
|
4076
4079
|
};
|
|
4077
|
-
function
|
|
4080
|
+
function nr(c, l) {
|
|
4078
4081
|
if (c.length !== ls) throw new Error("bad key size");
|
|
4079
4082
|
if (l.length !== $t) throw new Error("bad nonce size");
|
|
4080
4083
|
}
|
|
4081
|
-
function
|
|
4084
|
+
function xi(c, l) {
|
|
4082
4085
|
if (c.length !== lt) throw new Error("bad public key size");
|
|
4083
4086
|
if (l.length !== ft) throw new Error("bad secret key size");
|
|
4084
4087
|
}
|
|
@@ -4086,18 +4089,18 @@ var C;
|
|
|
4086
4089
|
for (var c = 0; c < arguments.length; c++)
|
|
4087
4090
|
if (!(arguments[c] instanceof Uint8Array)) throw new TypeError("unexpected type, use Uint8Array");
|
|
4088
4091
|
}
|
|
4089
|
-
function
|
|
4092
|
+
function or(c) {
|
|
4090
4093
|
for (var l = 0; l < c.length; l++) c[l] = 0;
|
|
4091
4094
|
}
|
|
4092
4095
|
r.randomBytes = function(c) {
|
|
4093
4096
|
var l = new Uint8Array(c);
|
|
4094
4097
|
return s(l, c), l;
|
|
4095
4098
|
}, r.secretbox = function(c, l, u) {
|
|
4096
|
-
pe(c, l, u),
|
|
4099
|
+
pe(c, l, u), nr(u, l);
|
|
4097
4100
|
for (var f = new Uint8Array(ht + c.length), m = new Uint8Array(f.length), b = 0; b < c.length; b++) f[b + ht] = c[b];
|
|
4098
4101
|
return ae(m, f, f.length, l, u), m.subarray(We);
|
|
4099
4102
|
}, r.secretbox.open = function(c, l, u) {
|
|
4100
|
-
pe(c, l, u),
|
|
4103
|
+
pe(c, l, u), nr(u, l);
|
|
4101
4104
|
for (var f = new Uint8Array(We + c.length), m = new Uint8Array(f.length), b = 0; b < c.length; b++) f[b + We] = c[b];
|
|
4102
4105
|
return f.length < 32 || ce(m, f, f.length, l, u) !== 0 ? null : m.subarray(ht);
|
|
4103
4106
|
}, r.secretbox.keyLength = ls, r.secretbox.nonceLength = $t, r.secretbox.overheadLength = We, r.scalarMult = function(c, l) {
|
|
@@ -4113,7 +4116,7 @@ var C;
|
|
|
4113
4116
|
var m = r.box.before(u, f);
|
|
4114
4117
|
return r.secretbox(c, l, m);
|
|
4115
4118
|
}, r.box.before = function(c, l) {
|
|
4116
|
-
pe(c, l),
|
|
4119
|
+
pe(c, l), xi(c, l);
|
|
4117
4120
|
var u = new Uint8Array(fs);
|
|
4118
4121
|
return jt(u, c, l), u;
|
|
4119
4122
|
}, r.box.after = r.secretbox, r.box.open = function(c, l, u, f) {
|
|
@@ -4121,7 +4124,7 @@ var C;
|
|
|
4121
4124
|
return r.secretbox.open(c, l, m);
|
|
4122
4125
|
}, r.box.open.after = r.secretbox.open, r.box.keyPair = function() {
|
|
4123
4126
|
var c = new Uint8Array(lt), l = new Uint8Array(ft);
|
|
4124
|
-
return
|
|
4127
|
+
return Zs(c, l), {
|
|
4125
4128
|
publicKey: c,
|
|
4126
4129
|
secretKey: l
|
|
4127
4130
|
};
|
|
@@ -4132,10 +4135,10 @@ var C;
|
|
|
4132
4135
|
publicKey: l,
|
|
4133
4136
|
secretKey: new Uint8Array(c)
|
|
4134
4137
|
};
|
|
4135
|
-
}, r.box.publicKeyLength = lt, r.box.secretKeyLength = ft, r.box.sharedKeyLength = fs, r.box.nonceLength =
|
|
4138
|
+
}, r.box.publicKeyLength = lt, r.box.secretKeyLength = ft, r.box.sharedKeyLength = fs, r.box.nonceLength = ir, r.box.overheadLength = r.secretbox.overheadLength, r.sign = function(c, l) {
|
|
4136
4139
|
if (pe(c, l), l.length !== Ye) throw new Error("bad secret key size");
|
|
4137
4140
|
var u = new Uint8Array(Te + c.length);
|
|
4138
|
-
return
|
|
4141
|
+
return rr(u, c, c.length, l), u;
|
|
4139
4142
|
}, r.sign.open = function(c, l) {
|
|
4140
4143
|
if (pe(c, l), l.length !== ze) throw new Error("bad public key size");
|
|
4141
4144
|
var u = new Uint8Array(c.length), f = us(u, c, c.length, l);
|
|
@@ -4189,26 +4192,26 @@ var C;
|
|
|
4189
4192
|
for (m = 0; m < f; m += l)
|
|
4190
4193
|
c.getRandomValues(b.subarray(m, m + Math.min(f - m, l)));
|
|
4191
4194
|
for (m = 0; m < f; m++) u[m] = b[m];
|
|
4192
|
-
|
|
4195
|
+
or(b);
|
|
4193
4196
|
});
|
|
4194
4197
|
} else typeof require < "u" && (c = require("crypto"), c && c.randomBytes && r.setPRNG(function(u, f) {
|
|
4195
4198
|
var m, b = c.randomBytes(f);
|
|
4196
4199
|
for (m = 0; m < f; m++) u[m] = b[m];
|
|
4197
|
-
|
|
4200
|
+
or(b);
|
|
4198
4201
|
}));
|
|
4199
4202
|
}();
|
|
4200
4203
|
})(typeof module < "u" && module.exports ? module.exports : globalThis.nacl = globalThis.nacl || {});
|
|
4201
4204
|
const Ft = typeof module < "u" && module.exports ? module.exports : globalThis.nacl;
|
|
4202
4205
|
Ft.sign.keyPair.fromSeed, Ft.sign.detached, Ft.sign.detached.verify, Ft.randomBytes;
|
|
4203
|
-
var
|
|
4206
|
+
var Pr;
|
|
4204
4207
|
(function(r) {
|
|
4205
4208
|
r.InvalidPrefixByte = "nkeys: invalid prefix byte", r.InvalidKey = "nkeys: invalid key", r.InvalidPublicKey = "nkeys: invalid public key", r.InvalidSeedLen = "nkeys: invalid seed length", r.InvalidSeed = "nkeys: invalid seed", r.InvalidEncoding = "nkeys: invalid encoded key", r.InvalidSignature = "nkeys: signature verification failed", r.CannotSign = "nkeys: cannot sign, no private key available", r.PublicKeyOnly = "nkeys: no seed or private key available", r.InvalidChecksum = "nkeys: invalid checksum", r.SerializationError = "nkeys: serialization error", r.ApiError = "nkeys: api error", r.ClearedPair = "nkeys: pair is cleared";
|
|
4206
|
-
})(
|
|
4207
|
-
var
|
|
4209
|
+
})(Pr || (Pr = {}));
|
|
4210
|
+
var Or;
|
|
4208
4211
|
(function(r) {
|
|
4209
4212
|
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";
|
|
4210
|
-
})(
|
|
4211
|
-
function
|
|
4213
|
+
})(Or || (Or = {}));
|
|
4214
|
+
function Un(r) {
|
|
4212
4215
|
return (e) => {
|
|
4213
4216
|
let t = {};
|
|
4214
4217
|
return r.forEach((s) => {
|
|
@@ -4217,11 +4220,11 @@ function Mn(r) {
|
|
|
4217
4220
|
}), t;
|
|
4218
4221
|
};
|
|
4219
4222
|
}
|
|
4220
|
-
function
|
|
4223
|
+
function Ln() {
|
|
4221
4224
|
return () => {
|
|
4222
4225
|
};
|
|
4223
4226
|
}
|
|
4224
|
-
function
|
|
4227
|
+
function qn(r, e) {
|
|
4225
4228
|
return () => {
|
|
4226
4229
|
const t = typeof r == "function" ? r() : r, s = typeof e == "function" ? e() : e;
|
|
4227
4230
|
return {
|
|
@@ -4230,13 +4233,13 @@ function Un(r, e) {
|
|
|
4230
4233
|
};
|
|
4231
4234
|
};
|
|
4232
4235
|
}
|
|
4233
|
-
function
|
|
4236
|
+
function Fn(r) {
|
|
4234
4237
|
return () => ({
|
|
4235
4238
|
auth_token: typeof r == "function" ? r() : r
|
|
4236
4239
|
});
|
|
4237
4240
|
}
|
|
4238
|
-
const Yr = 2 * 60 * 1e3,
|
|
4239
|
-
function
|
|
4241
|
+
const Yr = 2 * 60 * 1e3, Bn = 2, Xr = 2 * 1e3;
|
|
4242
|
+
function Dn() {
|
|
4240
4243
|
return {
|
|
4241
4244
|
maxPingOut: 2,
|
|
4242
4245
|
maxReconnectAttempts: 10,
|
|
@@ -4253,12 +4256,12 @@ function Fn() {
|
|
|
4253
4256
|
ignoreAuthErrorAbort: !1
|
|
4254
4257
|
};
|
|
4255
4258
|
}
|
|
4256
|
-
function
|
|
4259
|
+
function Hn(r) {
|
|
4257
4260
|
const e = [];
|
|
4258
|
-
return typeof r.authenticator == "function" && e.push(r.authenticator), Array.isArray(r.authenticator) && e.push(...r.authenticator), r.token && e.push(
|
|
4261
|
+
return typeof r.authenticator == "function" && e.push(r.authenticator), Array.isArray(r.authenticator) && e.push(...r.authenticator), r.token && e.push(Fn(r.token)), r.user && e.push(qn(r.user, r.pass)), e.length === 0 ? Ln() : Un(e);
|
|
4259
4262
|
}
|
|
4260
|
-
function
|
|
4261
|
-
const e = `${
|
|
4263
|
+
function Jn(r) {
|
|
4264
|
+
const e = `${As}:${Kr()}`;
|
|
4262
4265
|
if (r = r || {
|
|
4263
4266
|
servers: [
|
|
4264
4267
|
e
|
|
@@ -4268,12 +4271,12 @@ function Dn(r) {
|
|
|
4268
4271
|
]), r.servers.length > 0 && r.port)
|
|
4269
4272
|
throw new N("port and servers options are mutually exclusive", O.InvalidOption);
|
|
4270
4273
|
r.servers.length === 0 && r.port && (r.servers = [
|
|
4271
|
-
`${
|
|
4274
|
+
`${As}:${r.port}`
|
|
4272
4275
|
]), r.servers && r.servers.length === 0 && (r.servers = [
|
|
4273
4276
|
e
|
|
4274
4277
|
]);
|
|
4275
|
-
const t = es(
|
|
4276
|
-
if (t.authenticator =
|
|
4278
|
+
const t = es(Dn(), r);
|
|
4279
|
+
if (t.authenticator = Hn(t), [
|
|
4277
4280
|
"reconnectDelayHandler",
|
|
4278
4281
|
"authenticator"
|
|
4279
4282
|
].forEach((s) => {
|
|
@@ -4288,11 +4291,11 @@ function Dn(r) {
|
|
|
4288
4291
|
} catch (s) {
|
|
4289
4292
|
throw new N(s.message, O.ApiError);
|
|
4290
4293
|
}
|
|
4291
|
-
if (t.resolve === void 0 && (t.resolve = typeof
|
|
4294
|
+
if (t.resolve === void 0 && (t.resolve = typeof Rs() == "function"), t.resolve && typeof Rs() != "function")
|
|
4292
4295
|
throw new N("'resolve' is not supported on this client", O.InvalidOption);
|
|
4293
4296
|
return t;
|
|
4294
4297
|
}
|
|
4295
|
-
function
|
|
4298
|
+
function zn(r, e) {
|
|
4296
4299
|
const { proto: t, tls_required: s, tls_available: i } = r;
|
|
4297
4300
|
if ((t === void 0 || t < 1) && e.noEcho)
|
|
4298
4301
|
throw new N("noEcho", O.ServerOptionNotAvailable);
|
|
@@ -4300,10 +4303,10 @@ function Hn(r, e) {
|
|
|
4300
4303
|
if (e.tls && !n)
|
|
4301
4304
|
throw new N("tls", O.ServerOptionNotAvailable);
|
|
4302
4305
|
}
|
|
4303
|
-
const
|
|
4304
|
-
`),
|
|
4306
|
+
const Gn = 1024 * 32, Kn = /^INFO\s+([^\r\n]+)\r\n/i, Vn = yt(`PONG\r
|
|
4307
|
+
`), kr = yt(`PING\r
|
|
4305
4308
|
`);
|
|
4306
|
-
class
|
|
4309
|
+
class Wn {
|
|
4307
4310
|
constructor(e, t, s) {
|
|
4308
4311
|
h(this, "echo");
|
|
4309
4312
|
h(this, "no_responders");
|
|
@@ -4412,7 +4415,7 @@ class Zr extends oe {
|
|
|
4412
4415
|
return this.sid;
|
|
4413
4416
|
}
|
|
4414
4417
|
}
|
|
4415
|
-
class
|
|
4418
|
+
class Yn {
|
|
4416
4419
|
constructor() {
|
|
4417
4420
|
h(this, "mux");
|
|
4418
4421
|
h(this, "subs");
|
|
@@ -4490,7 +4493,7 @@ class Zt {
|
|
|
4490
4493
|
h(this, "server");
|
|
4491
4494
|
h(this, "features");
|
|
4492
4495
|
h(this, "connectPromise");
|
|
4493
|
-
this._closed = !1, this.connected = !1, this.connectedOnce = !1, this.infoReceived = !1, this.noMorePublishing = !1, this.abortReconnect = !1, this.listeners = [], this.pendingLimit =
|
|
4496
|
+
this._closed = !1, this.connected = !1, this.connectedOnce = !1, this.infoReceived = !1, this.noMorePublishing = !1, this.abortReconnect = !1, this.listeners = [], this.pendingLimit = Gn, this.outMsgs = 0, this.inMsgs = 0, this.outBytes = 0, this.inBytes = 0, this.options = e, this.publisher = t, this.subscriptions = new Yn(), this.muxSubscriptions = new Rn(), this.outbound = new ot(), this.pongs = [], this.whyClosed = "", this.pendingLimit = e.pendingLimit || this.pendingLimit, this.features = new fn({
|
|
4494
4497
|
major: 0,
|
|
4495
4498
|
minor: 0,
|
|
4496
4499
|
micro: 0
|
|
@@ -4498,9 +4501,9 @@ class Zt {
|
|
|
4498
4501
|
const s = typeof e.servers == "string" ? [
|
|
4499
4502
|
e.servers
|
|
4500
4503
|
] : e.servers;
|
|
4501
|
-
this.servers = new
|
|
4504
|
+
this.servers = new jn(s, {
|
|
4502
4505
|
randomize: !e.noRandomize
|
|
4503
|
-
}), this.closed = K(), this.parser = new
|
|
4506
|
+
}), this.closed = K(), this.parser = new Ar(this), this.heartbeats = new Nn(this, this.options.pingInterval || Yr, this.options.maxPingOut || Bn);
|
|
4504
4507
|
}
|
|
4505
4508
|
resetOutbound() {
|
|
4506
4509
|
this.outbound.reset();
|
|
@@ -4509,7 +4512,7 @@ class Zt {
|
|
|
4509
4512
|
const t = N.errorForCode(O.Disconnect);
|
|
4510
4513
|
t.stack = "", e.forEach((s) => {
|
|
4511
4514
|
s.reject(t);
|
|
4512
|
-
}), this.parser = new
|
|
4515
|
+
}), this.parser = new Ar(this), this.infoReceived = !1;
|
|
4513
4516
|
}
|
|
4514
4517
|
dispatchStatus(e) {
|
|
4515
4518
|
this.listeners.forEach((t) => {
|
|
@@ -4526,7 +4529,7 @@ class Zt {
|
|
|
4526
4529
|
return e.catch(() => {
|
|
4527
4530
|
}), this.pongs.unshift(e), this.connectError = (t) => {
|
|
4528
4531
|
e.reject(t);
|
|
4529
|
-
}, this.transport =
|
|
4532
|
+
}, this.transport = mn(), this.transport.closed().then(async (t) => {
|
|
4530
4533
|
if (this.connected = !1, !this.isClosed()) {
|
|
4531
4534
|
await this.disconnected(this.transport.closeError || this.lastError);
|
|
4532
4535
|
return;
|
|
@@ -4590,7 +4593,7 @@ class Zt {
|
|
|
4590
4593
|
}
|
|
4591
4594
|
async _doDial(e) {
|
|
4592
4595
|
const { resolve: t } = this.options, s = await e.resolve({
|
|
4593
|
-
fn:
|
|
4596
|
+
fn: Rs(),
|
|
4594
4597
|
debug: this.options.debug,
|
|
4595
4598
|
randomize: !this.options.noRandomize,
|
|
4596
4599
|
resolve: t
|
|
@@ -4668,10 +4671,10 @@ class Zt {
|
|
|
4668
4671
|
if (this.inMsgs++, this.inBytes += t.length, !this.subscriptions.sidCounter)
|
|
4669
4672
|
return;
|
|
4670
4673
|
const s = this.subscriptions.get(e.sid);
|
|
4671
|
-
s && (s.received += 1, s.callback && s.callback(null, new
|
|
4674
|
+
s && (s.received += 1, s.callback && s.callback(null, new Ds(e, t, this)), s.max !== void 0 && s.received >= s.max && s.unsubscribe());
|
|
4672
4675
|
}
|
|
4673
4676
|
processError(e) {
|
|
4674
|
-
const t =
|
|
4677
|
+
const t = hr(e), s = Zt.toError(t), i = {
|
|
4675
4678
|
type: Ee.Error,
|
|
4676
4679
|
data: s.code
|
|
4677
4680
|
};
|
|
@@ -4693,27 +4696,27 @@ class Zt {
|
|
|
4693
4696
|
this.lastError && e.code === this.lastError.code && this.options.ignoreAuthErrorAbort === !1 && (this.abortReconnect = !0), this.connectError ? this.connectError(e) : this.disconnect();
|
|
4694
4697
|
}
|
|
4695
4698
|
processPing() {
|
|
4696
|
-
this.transport.send(
|
|
4699
|
+
this.transport.send(Vn);
|
|
4697
4700
|
}
|
|
4698
4701
|
processPong() {
|
|
4699
4702
|
const e = this.pongs.shift();
|
|
4700
4703
|
e && e.resolve();
|
|
4701
4704
|
}
|
|
4702
4705
|
processInfo(e) {
|
|
4703
|
-
const t = JSON.parse(
|
|
4706
|
+
const t = JSON.parse(hr(e));
|
|
4704
4707
|
this.info = t;
|
|
4705
4708
|
const s = this.options && this.options.ignoreClusterUpdates ? void 0 : this.servers.update(t, this.transport.isEncrypted());
|
|
4706
4709
|
if (!this.infoReceived) {
|
|
4707
4710
|
this.features.update(Ge(t.version)), this.infoReceived = !0, this.transport.isEncrypted() && this.servers.updateTLSName();
|
|
4708
4711
|
const { version: n, lang: o } = this.transport;
|
|
4709
4712
|
try {
|
|
4710
|
-
const a = new
|
|
4713
|
+
const a = new Wn({
|
|
4711
4714
|
version: n,
|
|
4712
4715
|
lang: o
|
|
4713
4716
|
}, this.options, t.nonce);
|
|
4714
4717
|
t.headers && (a.headers = !0, a.no_responders = !0);
|
|
4715
4718
|
const d = JSON.stringify(a);
|
|
4716
|
-
this.transport.send(yt(`CONNECT ${d}${Ht}`)), this.transport.send(
|
|
4719
|
+
this.transport.send(yt(`CONNECT ${d}${Ht}`)), this.transport.send(kr);
|
|
4717
4720
|
} catch (a) {
|
|
4718
4721
|
this._close(a);
|
|
4719
4722
|
}
|
|
@@ -4808,7 +4811,7 @@ class Zt {
|
|
|
4808
4811
|
!e || this.isClosed() || (this.unsub(e), e.subject = t, this.subscriptions.resub(e), this._sub(e));
|
|
4809
4812
|
}
|
|
4810
4813
|
flush(e) {
|
|
4811
|
-
return e || (e = K()), this.pongs.push(e), this.outbound.fill(
|
|
4814
|
+
return e || (e = K()), this.pongs.push(e), this.outbound.fill(kr), this.flushPending(), e;
|
|
4812
4815
|
}
|
|
4813
4816
|
sendSubscriptions() {
|
|
4814
4817
|
const e = [];
|
|
@@ -4856,8 +4859,8 @@ class Zt {
|
|
|
4856
4859
|
return this.server;
|
|
4857
4860
|
}
|
|
4858
4861
|
}
|
|
4859
|
-
const
|
|
4860
|
-
class
|
|
4862
|
+
const Xn = "$SRV";
|
|
4863
|
+
class Cr {
|
|
4861
4864
|
constructor(e) {
|
|
4862
4865
|
h(this, "msg");
|
|
4863
4866
|
this.msg = e;
|
|
@@ -4896,7 +4899,7 @@ class vt {
|
|
|
4896
4899
|
h(this, "subject");
|
|
4897
4900
|
h(this, "queue");
|
|
4898
4901
|
h(this, "srv");
|
|
4899
|
-
t !== "" &&
|
|
4902
|
+
t !== "" && Qn("service group", t);
|
|
4900
4903
|
let i = "";
|
|
4901
4904
|
if (e instanceof kt)
|
|
4902
4905
|
this.srv = e, i = "";
|
|
@@ -4920,7 +4923,7 @@ class vt {
|
|
|
4920
4923
|
} : t;
|
|
4921
4924
|
gt("endpoint", e);
|
|
4922
4925
|
let { subject: i, handler: n, metadata: o, queue: a } = s;
|
|
4923
|
-
i = i || e, a = a || this.queue,
|
|
4926
|
+
i = i || e, a = a || this.queue, Zn("endpoint subject", i), i = this.calcSubject(this.subject, i);
|
|
4924
4927
|
const d = {
|
|
4925
4928
|
name: e,
|
|
4926
4929
|
subject: i,
|
|
@@ -4934,7 +4937,7 @@ class vt {
|
|
|
4934
4937
|
return new vt(this, e, t);
|
|
4935
4938
|
}
|
|
4936
4939
|
}
|
|
4937
|
-
function
|
|
4940
|
+
function Zn(r, e) {
|
|
4938
4941
|
if (e === "")
|
|
4939
4942
|
throw new Error(`${r} cannot be empty`);
|
|
4940
4943
|
if (e.indexOf(" ") !== -1)
|
|
@@ -4945,7 +4948,7 @@ function Yn(r, e) {
|
|
|
4945
4948
|
throw new Error(`${r} cannot have internal '>': '${e}'`);
|
|
4946
4949
|
});
|
|
4947
4950
|
}
|
|
4948
|
-
function
|
|
4951
|
+
function Qn(r, e) {
|
|
4949
4952
|
if (e.indexOf(" ") !== -1)
|
|
4950
4953
|
throw new Error(`${r} cannot contain spaces: '${e}'`);
|
|
4951
4954
|
e.split(".").forEach((s) => {
|
|
@@ -4973,7 +4976,7 @@ class kt {
|
|
|
4973
4976
|
});
|
|
4974
4977
|
}
|
|
4975
4978
|
static controlSubject(e, t = "", s = "", i) {
|
|
4976
|
-
const n = i ??
|
|
4979
|
+
const n = i ?? Xn;
|
|
4977
4980
|
return t === "" && s === "" ? `${n}.${e}` : (gt("control subject name", t), s !== "" ? (gt("control subject id", s), `${n}.${e}.${t}.${s}`) : `${n}.${e}.${t}`);
|
|
4978
4981
|
}
|
|
4979
4982
|
get subjects() {
|
|
@@ -5005,7 +5008,7 @@ class kt {
|
|
|
5005
5008
|
}
|
|
5006
5009
|
setupHandler(e, t = !1) {
|
|
5007
5010
|
const s = t ? "" : e.queue ? e.queue : this.config.queue, { name: i, subject: n, handler: o } = e, a = e;
|
|
5008
|
-
a.internal = t, t && this.internal.push(a), a.stats = new
|
|
5011
|
+
a.internal = t, t && this.internal.push(a), a.stats = new eo(i, n, s), a.queue = s;
|
|
5009
5012
|
const d = o ? (p, _) => {
|
|
5010
5013
|
if (p) {
|
|
5011
5014
|
this.close(p);
|
|
@@ -5013,7 +5016,7 @@ class kt {
|
|
|
5013
5016
|
}
|
|
5014
5017
|
const y = Date.now();
|
|
5015
5018
|
try {
|
|
5016
|
-
o(p, new
|
|
5019
|
+
o(p, new Cr(_));
|
|
5017
5020
|
} catch (x) {
|
|
5018
5021
|
a.stats.countError(x), _ == null || _.respond(ye, {
|
|
5019
5022
|
headers: this.errorToHeader(x)
|
|
@@ -5133,7 +5136,7 @@ class kt {
|
|
|
5133
5136
|
_addEndpoint(e) {
|
|
5134
5137
|
const t = new oe();
|
|
5135
5138
|
t.noIterator = typeof e.handler == "function", t.noIterator || (e.handler = (i, n) => {
|
|
5136
|
-
i ? this.stop(i).catch() : t.push(new
|
|
5139
|
+
i ? this.stop(i).catch() : t.push(new Cr(n));
|
|
5137
5140
|
}, t.iterClosed.then(() => {
|
|
5138
5141
|
this.close().catch();
|
|
5139
5142
|
}));
|
|
@@ -5141,7 +5144,7 @@ class kt {
|
|
|
5141
5144
|
return s.qi = t, this.handlers.push(s), t;
|
|
5142
5145
|
}
|
|
5143
5146
|
}
|
|
5144
|
-
class
|
|
5147
|
+
class eo {
|
|
5145
5148
|
constructor(e, t, s = "") {
|
|
5146
5149
|
h(this, "name");
|
|
5147
5150
|
h(this, "subject");
|
|
@@ -5185,7 +5188,7 @@ class Zn {
|
|
|
5185
5188
|
return (t == null ? void 0 : t.noIterator) === !1 && (this.processing_time = G(t.time), this.num_requests = t.processed, this.average_processing_time = this.processing_time > 0 && this.num_requests > 0 ? this.processing_time / this.num_requests : 0), this._stats();
|
|
5186
5189
|
}
|
|
5187
5190
|
}
|
|
5188
|
-
class
|
|
5191
|
+
class to {
|
|
5189
5192
|
constructor(e, t = {
|
|
5190
5193
|
strategy: Ce.JitterTimer,
|
|
5191
5194
|
maxWait: 2e3
|
|
@@ -5244,7 +5247,7 @@ function Qr() {
|
|
|
5244
5247
|
}
|
|
5245
5248
|
};
|
|
5246
5249
|
}
|
|
5247
|
-
function
|
|
5250
|
+
function so() {
|
|
5248
5251
|
return {
|
|
5249
5252
|
replicas: 1,
|
|
5250
5253
|
history: 1,
|
|
@@ -5252,19 +5255,19 @@ function eo() {
|
|
|
5252
5255
|
max_bytes: -1,
|
|
5253
5256
|
maxValueSize: -1,
|
|
5254
5257
|
codec: Qr(),
|
|
5255
|
-
storage:
|
|
5258
|
+
storage: Cs.File
|
|
5256
5259
|
};
|
|
5257
5260
|
}
|
|
5258
|
-
const Qt = "KV-Operation",
|
|
5259
|
-
function
|
|
5260
|
-
if (r.startsWith(".") || r.endsWith(".") || !
|
|
5261
|
+
const Qt = "KV-Operation", Ir = "$KV", ro = /^[-/=.\w]+$/, io = /^[-/=.>*\w]+$/, no = /^[-\w]+$/;
|
|
5262
|
+
function oo(r) {
|
|
5263
|
+
if (r.startsWith(".") || r.endsWith(".") || !ro.test(r))
|
|
5261
5264
|
throw new Error(`invalid key: ${r}`);
|
|
5262
5265
|
}
|
|
5263
|
-
function
|
|
5264
|
-
if (r.startsWith(".") || r.endsWith(".") || !
|
|
5266
|
+
function ao(r) {
|
|
5267
|
+
if (r.startsWith(".") || r.endsWith(".") || !io.test(r))
|
|
5265
5268
|
throw new Error(`invalid key: ${r}`);
|
|
5266
5269
|
}
|
|
5267
|
-
function
|
|
5270
|
+
function co(r) {
|
|
5268
5271
|
if (r.startsWith(".") || r.endsWith("."))
|
|
5269
5272
|
throw new Error(`invalid key: ${r}`);
|
|
5270
5273
|
const e = r.split(".");
|
|
@@ -5283,7 +5286,7 @@ function oo(r) {
|
|
|
5283
5286
|
return t;
|
|
5284
5287
|
}
|
|
5285
5288
|
function Jt(r) {
|
|
5286
|
-
if (!
|
|
5289
|
+
if (!no.test(r))
|
|
5287
5290
|
throw new Error(`invalid bucket name: ${r}`);
|
|
5288
5291
|
}
|
|
5289
5292
|
var Re;
|
|
@@ -5302,10 +5305,10 @@ class At {
|
|
|
5302
5305
|
h(this, "editPrefix");
|
|
5303
5306
|
h(this, "useJsPrefix");
|
|
5304
5307
|
h(this, "_prefixLen");
|
|
5305
|
-
h(this, "validateKey",
|
|
5306
|
-
h(this, "validateSearchKey",
|
|
5307
|
-
h(this, "hasWildcards",
|
|
5308
|
-
Jt(e), this.js = t, this.jsm = s, this.bucket = e, this.prefix =
|
|
5308
|
+
h(this, "validateKey", oo);
|
|
5309
|
+
h(this, "validateSearchKey", ao);
|
|
5310
|
+
h(this, "hasWildcards", co);
|
|
5311
|
+
Jt(e), this.js = t, this.jsm = s, this.bucket = e, this.prefix = Ir, this.editPrefix = "", this.useJsPrefix = !1, this._prefixLen = 0;
|
|
5309
5312
|
}
|
|
5310
5313
|
static async create(e, t, s = {}) {
|
|
5311
5314
|
Jt(t);
|
|
@@ -5323,10 +5326,10 @@ class At {
|
|
|
5323
5326
|
return n.config.name = s.streamName ?? o.bucketName(), Object.assign(o, n), o.stream = n.config.name, o.codec = s.codec || Qr(), o.direct = n.config.allow_direct ?? !1, o.initializePrefixes(n), o;
|
|
5324
5327
|
}
|
|
5325
5328
|
async init(e = {}) {
|
|
5326
|
-
const t = Object.assign(
|
|
5329
|
+
const t = Object.assign(so(), e);
|
|
5327
5330
|
this.codec = t.codec;
|
|
5328
5331
|
const s = {};
|
|
5329
|
-
this.stream = s.name = e.streamName ?? this.bucketName(), s.retention =
|
|
5332
|
+
this.stream = s.name = e.streamName ?? this.bucketName(), s.retention = ks.Limits, s.max_msgs_per_subject = t.history, t.maxBucketSize && (t.max_bytes = t.maxBucketSize), t.max_bytes && (s.max_bytes = t.max_bytes), s.max_msg_size = t.maxValueSize, s.storage = t.storage;
|
|
5330
5333
|
const i = e.placementCluster ?? "";
|
|
5331
5334
|
if (i && (e.placement = {}, e.placement.cluster = i, e.placement.tags = []), e.placement && (s.placement = e.placement), e.republish && (s.republish = e.republish), e.description && (s.description = e.description), e.mirror) {
|
|
5332
5335
|
const y = Object.assign({}, e.mirror);
|
|
@@ -5349,7 +5352,7 @@ class At {
|
|
|
5349
5352
|
this.subjectForBucket()
|
|
5350
5353
|
];
|
|
5351
5354
|
e.metadata && (s.metadata = e.metadata), typeof e.compression == "boolean" && (s.compression = e.compression ? He.S2 : He.None);
|
|
5352
|
-
const n = this.js.nc, o = n.getServerVersion(), a = o ?
|
|
5355
|
+
const n = this.js.nc, o = n.getServerVersion(), a = o ? js(o, Ge("2.7.2")) >= 0 : !1;
|
|
5353
5356
|
s.discard = a ? Et.New : Et.Old;
|
|
5354
5357
|
const { ok: d, min: p } = n.features.get(H.JS_ALLOW_DIRECT);
|
|
5355
5358
|
if (!d && e.allow_direct === !0) {
|
|
@@ -5391,7 +5394,7 @@ class At {
|
|
|
5391
5394
|
return t ? (this.useJsPrefix && s.push(this.js.apiPrefix), this.editPrefix !== "" ? s.push(this.editPrefix) : s.push(this.prefix)) : this.prefix && s.push(this.prefix), s.push(e), s.join(".");
|
|
5392
5395
|
}
|
|
5393
5396
|
fullKeyName(e) {
|
|
5394
|
-
return this.prefix !== "" ? `${this.prefix}.${e}` : `${
|
|
5397
|
+
return this.prefix !== "" ? `${this.prefix}.${e}` : `${Ir}.${this.bucket}.${e}`;
|
|
5395
5398
|
}
|
|
5396
5399
|
get prefixLen() {
|
|
5397
5400
|
return this._prefixLen === 0 && (this._prefixLen = this.prefix.length + 1), this._prefixLen;
|
|
@@ -5432,11 +5435,11 @@ class At {
|
|
|
5432
5435
|
return s !== "" ? parseInt(s, 10) : e.length;
|
|
5433
5436
|
}
|
|
5434
5437
|
smToEntry(e) {
|
|
5435
|
-
return new
|
|
5438
|
+
return new vo(this.bucket, this.prefixLen, e);
|
|
5436
5439
|
}
|
|
5437
5440
|
jmToEntry(e) {
|
|
5438
5441
|
const t = this.decodeKey(e.subject.substring(this.prefixLen));
|
|
5439
|
-
return new
|
|
5442
|
+
return new Ao(this.bucket, t, e);
|
|
5440
5443
|
}
|
|
5441
5444
|
async create(e, t) {
|
|
5442
5445
|
var n;
|
|
@@ -5707,7 +5710,7 @@ class ei {
|
|
|
5707
5710
|
return this.si.config.max_msgs_per_subject;
|
|
5708
5711
|
}
|
|
5709
5712
|
get ttl() {
|
|
5710
|
-
return
|
|
5713
|
+
return Bs(this.si.config.max_age);
|
|
5711
5714
|
}
|
|
5712
5715
|
get bucket_location() {
|
|
5713
5716
|
return this.cluster;
|
|
@@ -5762,21 +5765,21 @@ class ei {
|
|
|
5762
5765
|
return this.si.config.compression ? this.si.config.compression !== He.None : !1;
|
|
5763
5766
|
}
|
|
5764
5767
|
}
|
|
5765
|
-
const
|
|
5766
|
-
function
|
|
5767
|
-
return Jt(r), `${
|
|
5768
|
+
const Js = "OBJ_", jr = "SHA-256=";
|
|
5769
|
+
function ho(r) {
|
|
5770
|
+
return Jt(r), `${Js}${r}`;
|
|
5768
5771
|
}
|
|
5769
|
-
function
|
|
5770
|
-
return r.startsWith(
|
|
5772
|
+
function uo(r) {
|
|
5773
|
+
return r.startsWith(Js) ? r.substring(4) : r;
|
|
5771
5774
|
}
|
|
5772
|
-
class
|
|
5775
|
+
class Ms {
|
|
5773
5776
|
constructor(e) {
|
|
5774
5777
|
h(this, "si");
|
|
5775
5778
|
h(this, "backingStore");
|
|
5776
5779
|
this.si = e, this.backingStore = "JetStream";
|
|
5777
5780
|
}
|
|
5778
5781
|
get bucket() {
|
|
5779
|
-
return
|
|
5782
|
+
return uo(this.si.config.name);
|
|
5780
5783
|
}
|
|
5781
5784
|
get description() {
|
|
5782
5785
|
return this.si.config.description ?? "";
|
|
@@ -5833,9 +5836,9 @@ var rt;
|
|
|
5833
5836
|
(function(r) {
|
|
5834
5837
|
r.DebugEvent = "debug", r.Discard = "discard", r.Reset = "reset", r.Next = "next";
|
|
5835
5838
|
})(rt || (rt = {}));
|
|
5836
|
-
const
|
|
5839
|
+
const Rr = Uint8Array.of(43, 65, 67, 75), lo = Uint8Array.of(45, 78, 65, 75), bt = Uint8Array.of(43, 87, 80, 73), fo = Uint8Array.of(43, 78, 88, 84), po = Uint8Array.of(43, 84, 69, 82, 77), mo = Uint8Array.of(32);
|
|
5837
5840
|
function Pt(r, e = 5e3) {
|
|
5838
|
-
return new
|
|
5841
|
+
return new Ro(r, e);
|
|
5839
5842
|
}
|
|
5840
5843
|
class Es extends oe {
|
|
5841
5844
|
constructor(t, s, i = !1) {
|
|
@@ -5884,7 +5887,7 @@ class Es extends oe {
|
|
|
5884
5887
|
return;
|
|
5885
5888
|
}
|
|
5886
5889
|
if ((y = this.monitor) == null || y.work(), p.subject === this.inbox) {
|
|
5887
|
-
if (
|
|
5890
|
+
if (Os(p))
|
|
5888
5891
|
return;
|
|
5889
5892
|
const T = (x = p.headers) == null ? void 0 : x.code, J = ((I = (P = p.headers) == null ? void 0 : P.description) == null ? void 0 : I.toLowerCase()) || "unknown", { msgsLeft: X, bytesLeft: L } = this.parseDiscard(p.headers);
|
|
5890
5893
|
if (X > 0 || L > 0)
|
|
@@ -5924,7 +5927,7 @@ class Es extends oe {
|
|
|
5924
5927
|
this.sub.draining && this._push(() => {
|
|
5925
5928
|
this.stop();
|
|
5926
5929
|
});
|
|
5927
|
-
}), i && (this.monitor = new
|
|
5930
|
+
}), i && (this.monitor = new Hs(i, (d) => (this.notify(Ne.HeartbeatsMissed, d), this.resetPending().then(() => {
|
|
5928
5931
|
}).catch(() => {
|
|
5929
5932
|
}), !1), {
|
|
5930
5933
|
maxOut: 2
|
|
@@ -5977,7 +5980,7 @@ class Es extends oe {
|
|
|
5977
5980
|
if (this.inBackOff)
|
|
5978
5981
|
return !1;
|
|
5979
5982
|
let t = 0, s = 0;
|
|
5980
|
-
const i =
|
|
5983
|
+
const i = Fs([
|
|
5981
5984
|
this.opts.expires
|
|
5982
5985
|
]);
|
|
5983
5986
|
let n = 0;
|
|
@@ -6083,7 +6086,7 @@ class Es extends oe {
|
|
|
6083
6086
|
return this.listeners.push(t), Promise.resolve(t);
|
|
6084
6087
|
}
|
|
6085
6088
|
}
|
|
6086
|
-
class
|
|
6089
|
+
class bo extends oe {
|
|
6087
6090
|
constructor() {
|
|
6088
6091
|
super();
|
|
6089
6092
|
h(this, "src");
|
|
@@ -6125,7 +6128,7 @@ class po extends oe {
|
|
|
6125
6128
|
return this.listeners.push(t), Promise.resolve(t);
|
|
6126
6129
|
}
|
|
6127
6130
|
}
|
|
6128
|
-
class
|
|
6131
|
+
class $s {
|
|
6129
6132
|
constructor(e, t) {
|
|
6130
6133
|
h(this, "api");
|
|
6131
6134
|
h(this, "_info");
|
|
@@ -6192,7 +6195,7 @@ class Us {
|
|
|
6192
6195
|
return this.api.info(t, s).then((i) => (this._info = i, this._info));
|
|
6193
6196
|
}
|
|
6194
6197
|
}
|
|
6195
|
-
class
|
|
6198
|
+
class go {
|
|
6196
6199
|
constructor(e, t, s = {}) {
|
|
6197
6200
|
h(this, "api");
|
|
6198
6201
|
h(this, "consumerOpts");
|
|
@@ -6235,7 +6238,7 @@ class mo {
|
|
|
6235
6238
|
}), e = e === 0 ? 1 : e, this.cursor.deliver_seq = 0;
|
|
6236
6239
|
const s = this.getConsumerOpts(e);
|
|
6237
6240
|
s.max_deliver = 1, s.mem_storage = !0;
|
|
6238
|
-
const i =
|
|
6241
|
+
const i = Fs([
|
|
6239
6242
|
((a = this.opts) == null ? void 0 : a.expires) || 3e4
|
|
6240
6243
|
]);
|
|
6241
6244
|
let n;
|
|
@@ -6276,7 +6279,7 @@ class mo {
|
|
|
6276
6279
|
(d = this.iter) == null || d.src.stop(), await ((p = this.iter) == null ? void 0 : p.closed()), this.currentConsumer = null;
|
|
6277
6280
|
return;
|
|
6278
6281
|
}
|
|
6279
|
-
(this.currentConsumer === null || i) && (this.currentConsumer = await this.resetConsumer(this.cursor.stream_seq + 1)), (this.iter === null || s) && (this.iter = new
|
|
6282
|
+
(this.currentConsumer === null || i) && (this.currentConsumer = await this.resetConsumer(this.cursor.stream_seq + 1)), (this.iter === null || s) && (this.iter = new bo()), this.consumer = new $s(this.api, this.currentConsumer);
|
|
6280
6283
|
const n = e;
|
|
6281
6284
|
n.callback = this.internalHandler(this.serial);
|
|
6282
6285
|
let o = null;
|
|
@@ -6346,7 +6349,7 @@ class mo {
|
|
|
6346
6349
|
return this.currentConsumer == null ? (this.currentConsumer = await this.resetConsumer(this.startSeq), Promise.resolve(this.currentConsumer)) : e && this.currentConsumer ? Promise.resolve(this.currentConsumer) : this.api.info(this.stream, this.currentConsumer.name);
|
|
6347
6350
|
}
|
|
6348
6351
|
}
|
|
6349
|
-
class
|
|
6352
|
+
class Us {
|
|
6350
6353
|
constructor(e) {
|
|
6351
6354
|
h(this, "api");
|
|
6352
6355
|
h(this, "notified");
|
|
@@ -6359,15 +6362,15 @@ class Ls {
|
|
|
6359
6362
|
getPullConsumerFor(e) {
|
|
6360
6363
|
if (e.config.deliver_subject !== void 0)
|
|
6361
6364
|
throw new Error("push consumer not supported");
|
|
6362
|
-
return new
|
|
6365
|
+
return new $s(this.api, e);
|
|
6363
6366
|
}
|
|
6364
6367
|
async get(e, t = {}) {
|
|
6365
|
-
return typeof t == "object" ? this.ordered(e, t) : (await this.checkVersion(), this.api.info(e, t).then((s) => s.config.deliver_subject !== void 0 ? Promise.reject(new Error("push consumer not supported")) : new
|
|
6368
|
+
return typeof t == "object" ? this.ordered(e, t) : (await this.checkVersion(), this.api.info(e, t).then((s) => s.config.deliver_subject !== void 0 ? Promise.reject(new Error("push consumer not supported")) : new $s(this.api, s)).catch((s) => Promise.reject(s)));
|
|
6366
6369
|
}
|
|
6367
6370
|
async ordered(e, t) {
|
|
6368
6371
|
await this.checkVersion();
|
|
6369
6372
|
const s = this.api;
|
|
6370
|
-
return new
|
|
6373
|
+
return new zs(s.nc, s.opts).info(e).then((n) => Promise.resolve(new go(this.api, e, t))).catch((n) => Promise.reject(n));
|
|
6371
6374
|
}
|
|
6372
6375
|
}
|
|
6373
6376
|
class rs {
|
|
@@ -6393,10 +6396,10 @@ class rs {
|
|
|
6393
6396
|
return e ? Promise.resolve(this._info) : this.api.info(this.name, t).then((s) => (this._info = s, this._info));
|
|
6394
6397
|
}
|
|
6395
6398
|
getConsumerFromInfo(e) {
|
|
6396
|
-
return new
|
|
6399
|
+
return new Us(new Yt(this.api.nc, this.api.opts)).getPullConsumerFor(e);
|
|
6397
6400
|
}
|
|
6398
6401
|
getConsumer(e) {
|
|
6399
|
-
return new
|
|
6402
|
+
return new Us(new Yt(this.api.nc, this.api.opts)).get(this.name, e);
|
|
6400
6403
|
}
|
|
6401
6404
|
getMessage(e) {
|
|
6402
6405
|
return this.api.getMessage(this.name, e);
|
|
@@ -6405,7 +6408,7 @@ class rs {
|
|
|
6405
6408
|
return this.api.deleteMessage(this.name, e, t);
|
|
6406
6409
|
}
|
|
6407
6410
|
}
|
|
6408
|
-
class
|
|
6411
|
+
class zs extends Ot {
|
|
6409
6412
|
constructor(e, t) {
|
|
6410
6413
|
super(e, t);
|
|
6411
6414
|
}
|
|
@@ -6544,10 +6547,10 @@ class Gs extends Ot {
|
|
|
6544
6547
|
}
|
|
6545
6548
|
listObjectStores() {
|
|
6546
6549
|
const e = (s) => {
|
|
6547
|
-
const n = s.streams.filter((a) => a.config.name.startsWith(
|
|
6550
|
+
const n = s.streams.filter((a) => a.config.name.startsWith(Js));
|
|
6548
6551
|
return n.forEach((a) => {
|
|
6549
6552
|
this._fixInfo(a);
|
|
6550
|
-
}), n.map((a) => new
|
|
6553
|
+
}), n.map((a) => new Ms(a));
|
|
6551
6554
|
}, t = `${this.prefix}.STREAM.LIST`;
|
|
6552
6555
|
return new _t(t, e, this);
|
|
6553
6556
|
}
|
|
@@ -6562,7 +6565,7 @@ class Gs extends Ot {
|
|
|
6562
6565
|
return Promise.resolve(new rs(this, t));
|
|
6563
6566
|
}
|
|
6564
6567
|
}
|
|
6565
|
-
class
|
|
6568
|
+
class _o extends Ot {
|
|
6566
6569
|
constructor(e, t) {
|
|
6567
6570
|
super(e, t);
|
|
6568
6571
|
}
|
|
@@ -6576,7 +6579,7 @@ class bo extends Ot {
|
|
|
6576
6579
|
}), p = tt(d);
|
|
6577
6580
|
if (p)
|
|
6578
6581
|
return Promise.reject(p);
|
|
6579
|
-
const _ = new
|
|
6582
|
+
const _ = new Ls(d);
|
|
6580
6583
|
return Promise.resolve(_);
|
|
6581
6584
|
}
|
|
6582
6585
|
async getBatch(e, t) {
|
|
@@ -6605,7 +6608,7 @@ class bo extends Ot {
|
|
|
6605
6608
|
}
|
|
6606
6609
|
if (I.data.length === 0)
|
|
6607
6610
|
break;
|
|
6608
|
-
o.push(new
|
|
6611
|
+
o.push(new Ls(I));
|
|
6609
6612
|
}
|
|
6610
6613
|
o.push(() => {
|
|
6611
6614
|
if (p)
|
|
@@ -6617,7 +6620,7 @@ class bo extends Ot {
|
|
|
6617
6620
|
})(), Promise.resolve(o);
|
|
6618
6621
|
}
|
|
6619
6622
|
}
|
|
6620
|
-
class
|
|
6623
|
+
class Ls {
|
|
6621
6624
|
constructor(e) {
|
|
6622
6625
|
h(this, "data");
|
|
6623
6626
|
h(this, "header");
|
|
@@ -6648,14 +6651,14 @@ class qs {
|
|
|
6648
6651
|
return ge.decode(this.data);
|
|
6649
6652
|
}
|
|
6650
6653
|
}
|
|
6651
|
-
h(
|
|
6652
|
-
class
|
|
6654
|
+
h(Ls, "jc");
|
|
6655
|
+
class yo extends Ot {
|
|
6653
6656
|
constructor(t, s) {
|
|
6654
6657
|
super(t, s);
|
|
6655
6658
|
h(this, "streams");
|
|
6656
6659
|
h(this, "consumers");
|
|
6657
6660
|
h(this, "direct");
|
|
6658
|
-
this.streams = new
|
|
6661
|
+
this.streams = new zs(t, s), this.consumers = new Yt(t, s), this.direct = new _o(t, s);
|
|
6659
6662
|
}
|
|
6660
6663
|
async getAccountInfo() {
|
|
6661
6664
|
return await this._request(`${this.prefix}.INFO`);
|
|
@@ -6726,7 +6729,7 @@ class ti {
|
|
|
6726
6729
|
}
|
|
6727
6730
|
}
|
|
6728
6731
|
h(ti, "jc");
|
|
6729
|
-
class
|
|
6732
|
+
class wo {
|
|
6730
6733
|
constructor(e) {
|
|
6731
6734
|
h(this, "api");
|
|
6732
6735
|
this.api = e;
|
|
@@ -6785,7 +6788,7 @@ class vs {
|
|
|
6785
6788
|
return ((e = this.info.options) == null ? void 0 : e.link) !== void 0 && ((t = this.info.options) == null ? void 0 : t.link) !== null;
|
|
6786
6789
|
}
|
|
6787
6790
|
}
|
|
6788
|
-
function
|
|
6791
|
+
function Nr(r) {
|
|
6789
6792
|
const e = {
|
|
6790
6793
|
name: r.name,
|
|
6791
6794
|
description: r.description ?? "",
|
|
@@ -6798,7 +6801,7 @@ function Tr(r) {
|
|
|
6798
6801
|
}
|
|
6799
6802
|
return e;
|
|
6800
6803
|
}
|
|
6801
|
-
function
|
|
6804
|
+
function xo() {
|
|
6802
6805
|
return new ReadableStream({
|
|
6803
6806
|
pull(r) {
|
|
6804
6807
|
r.enqueue(new Uint8Array(0)), r.close();
|
|
@@ -6860,11 +6863,11 @@ class St {
|
|
|
6860
6863
|
}
|
|
6861
6864
|
async seal() {
|
|
6862
6865
|
let e = await this._si();
|
|
6863
|
-
return e === null ? Promise.reject(new Error("object store not found")) : (e.config.sealed = !0, e = await this.jsm.streams.update(this.stream, e.config), Promise.resolve(new
|
|
6866
|
+
return e === null ? Promise.reject(new Error("object store not found")) : (e.config.sealed = !0, e = await this.jsm.streams.update(this.stream, e.config), Promise.resolve(new Ms(e)));
|
|
6864
6867
|
}
|
|
6865
6868
|
async status(e) {
|
|
6866
6869
|
const t = await this._si(e);
|
|
6867
|
-
return t === null ? Promise.reject(new Error("object store not found")) : Promise.resolve(new
|
|
6870
|
+
return t === null ? Promise.reject(new Error("object store not found")) : Promise.resolve(new Ms(t));
|
|
6868
6871
|
}
|
|
6869
6872
|
destroy() {
|
|
6870
6873
|
return this.jsm.streams.delete(this.stream);
|
|
@@ -6887,9 +6890,9 @@ class St {
|
|
|
6887
6890
|
nuid: P,
|
|
6888
6891
|
size: 0,
|
|
6889
6892
|
chunks: 0
|
|
6890
|
-
},
|
|
6893
|
+
}, Nr(e)), X = K(), L = [], Y = new ot();
|
|
6891
6894
|
try {
|
|
6892
|
-
const w = t ? t.getReader() : null, j =
|
|
6895
|
+
const w = t ? t.getReader() : null, j = Sr.create();
|
|
6893
6896
|
for (; ; ) {
|
|
6894
6897
|
const { done: F, value: R } = w ? await w.read() : {
|
|
6895
6898
|
done: !0,
|
|
@@ -6904,7 +6907,7 @@ class St {
|
|
|
6904
6907
|
}
|
|
6905
6908
|
await Promise.all(L), L.length = 0, J.mtime = (/* @__PURE__ */ new Date()).toISOString();
|
|
6906
6909
|
const A = st.encode(j.digest());
|
|
6907
|
-
J.digest = `${
|
|
6910
|
+
J.digest = `${jr}${A}`, J.deleted = !1;
|
|
6908
6911
|
const $ = $e();
|
|
6909
6912
|
typeof o == "number" && $.set(Re.ExpectedLastSubjectSequenceHdr, `${o}`), $.set(de.RollupHdr, de.RollupValueSubject);
|
|
6910
6913
|
const q = await this.js.publish(T, ve().encode(J), {
|
|
@@ -6980,9 +6983,9 @@ class St {
|
|
|
6980
6983
|
throw new Error("link is a bucket");
|
|
6981
6984
|
return (t.options.link.bucket !== this.name ? await St.create(this.js, t.options.link.bucket) : this).get(y);
|
|
6982
6985
|
}
|
|
6983
|
-
if (!t.digest.startsWith(
|
|
6986
|
+
if (!t.digest.startsWith(jr))
|
|
6984
6987
|
return Promise.reject(new Error(`unknown digest type: ${t.digest}`));
|
|
6985
|
-
const s =
|
|
6988
|
+
const s = Is(t.digest.substring(8));
|
|
6986
6989
|
if (s === null)
|
|
6987
6990
|
return Promise.reject(new Error(`unable to parse digest: ${t.digest}`));
|
|
6988
6991
|
const i = K(), n = {
|
|
@@ -6990,14 +6993,14 @@ class St {
|
|
|
6990
6993
|
error: i
|
|
6991
6994
|
};
|
|
6992
6995
|
if (t.size === 0)
|
|
6993
|
-
return n.data =
|
|
6996
|
+
return n.data = xo(), i.resolve(null), Promise.resolve(n);
|
|
6994
6997
|
let o;
|
|
6995
6998
|
const a = Be();
|
|
6996
6999
|
a.orderedConsumer();
|
|
6997
|
-
const d =
|
|
7000
|
+
const d = Sr.create(), p = `$O.${this.name}.C.${t.nuid}`, _ = await this.js.subscribe(p, a);
|
|
6998
7001
|
return (async () => {
|
|
6999
7002
|
for await (const y of _)
|
|
7000
|
-
y.data.length > 0 && (d.update(y.data), o.enqueue(y.data)), y.info.pending === 0 && (
|
|
7003
|
+
y.data.length > 0 && (d.update(y.data), o.enqueue(y.data)), y.info.pending === 0 && (cn(s, d.digest()) ? o.close() : o.error(new Error(`received a corrupt object, digests do not match received: ${t.digest} calculated ${s}`)), _.unsubscribe());
|
|
7001
7004
|
})().then(() => {
|
|
7002
7005
|
i.resolve();
|
|
7003
7006
|
}).catch((y) => {
|
|
@@ -7083,7 +7086,7 @@ class St {
|
|
|
7083
7086
|
return Promise.reject(new Error("an object already exists with that name"));
|
|
7084
7087
|
}
|
|
7085
7088
|
t.name = i;
|
|
7086
|
-
const o = Object.assign({}, s,
|
|
7089
|
+
const o = Object.assign({}, s, Nr(t)), a = await this.js.publish(this._metaSubject(o.name), JSON.stringify(o));
|
|
7087
7090
|
return e !== t.name && await this.jsm.streams.purge(this.stream, {
|
|
7088
7091
|
filter: this._metaSubject(e)
|
|
7089
7092
|
}), Promise.resolve(a);
|
|
@@ -7131,7 +7134,7 @@ class St {
|
|
|
7131
7134
|
}
|
|
7132
7135
|
async init(e = {}) {
|
|
7133
7136
|
try {
|
|
7134
|
-
this.stream =
|
|
7137
|
+
this.stream = ho(this.name);
|
|
7135
7138
|
} catch (i) {
|
|
7136
7139
|
return Promise.reject(i);
|
|
7137
7140
|
}
|
|
@@ -7155,7 +7158,7 @@ class St {
|
|
|
7155
7158
|
return await n.init(s), Promise.resolve(n);
|
|
7156
7159
|
}
|
|
7157
7160
|
}
|
|
7158
|
-
class
|
|
7161
|
+
class So {
|
|
7159
7162
|
constructor(e) {
|
|
7160
7163
|
h(this, "js");
|
|
7161
7164
|
this.js = e;
|
|
@@ -7172,14 +7175,14 @@ class wo {
|
|
|
7172
7175
|
return i ? St.create(this.js, e, t) : Promise.reject(new Error(`objectstore is only supported on servers ${n} or better`));
|
|
7173
7176
|
}
|
|
7174
7177
|
}
|
|
7175
|
-
class
|
|
7178
|
+
class Gs extends Ot {
|
|
7176
7179
|
constructor(t, s) {
|
|
7177
7180
|
super(t, s);
|
|
7178
7181
|
h(this, "consumers");
|
|
7179
7182
|
h(this, "streams");
|
|
7180
7183
|
h(this, "consumerAPI");
|
|
7181
7184
|
h(this, "streamAPI");
|
|
7182
|
-
this.consumerAPI = new Yt(t, s), this.streamAPI = new
|
|
7185
|
+
this.consumerAPI = new Yt(t, s), this.streamAPI = new zs(t, s), this.consumers = new Us(this.consumerAPI), this.streams = new wo(this.streamAPI);
|
|
7183
7186
|
}
|
|
7184
7187
|
jetstreamManager(t) {
|
|
7185
7188
|
t === void 0 && (t = this.opts.checkAPI);
|
|
@@ -7192,7 +7195,7 @@ class Ks extends Ot {
|
|
|
7192
7195
|
return this.prefix;
|
|
7193
7196
|
}
|
|
7194
7197
|
get views() {
|
|
7195
|
-
return new
|
|
7198
|
+
return new So(this);
|
|
7196
7199
|
}
|
|
7197
7200
|
async publish(t, s = ye, i) {
|
|
7198
7201
|
i = i || {}, i.expect = i.expect || {};
|
|
@@ -7256,7 +7259,7 @@ class Ks extends Ot {
|
|
|
7256
7259
|
x && (_.idle_heartbeat = G(x), i.delay_heartbeat === !0 && (_.idle_heartbeat = G(x * 4)));
|
|
7257
7260
|
const P = new oe(), I = _.batch;
|
|
7258
7261
|
let T = 0;
|
|
7259
|
-
P.protocolFilterFn = (L, Y = !1) =>
|
|
7262
|
+
P.protocolFilterFn = (L, Y = !1) => Os(L.msg) ? (p == null || p.work(), !1) : !0, P.dispatchedFn = (L) => {
|
|
7260
7263
|
if (L) {
|
|
7261
7264
|
if (o && (a += L.data.length), T++, n && L.info.pending === 0)
|
|
7262
7265
|
return;
|
|
@@ -7266,7 +7269,7 @@ class Ks extends Ot {
|
|
|
7266
7269
|
const J = Me(this.nc.options.inboxPrefix), X = this.nc.subscribe(J, {
|
|
7267
7270
|
max: i.batch,
|
|
7268
7271
|
callback: (L, Y) => {
|
|
7269
|
-
L === null && (L = tt(Y)), L !== null ? (n && (n.cancel(), n = null),
|
|
7272
|
+
L === null && (L = tt(Y)), L !== null ? (n && (n.cancel(), n = null), Di(L) ? P.stop(ri(L) === null ? void 0 : L) : P.stop(L)) : (p == null || p.work(), P.received++, P.push(Pt(Y, this.timeout)));
|
|
7270
7273
|
}
|
|
7271
7274
|
});
|
|
7272
7275
|
return y && (n = it(y), n.catch(() => {
|
|
@@ -7274,7 +7277,7 @@ class Ks extends Ot {
|
|
|
7274
7277
|
}), n = null), p && p.cancel();
|
|
7275
7278
|
})), (async () => {
|
|
7276
7279
|
try {
|
|
7277
|
-
x && (p = new
|
|
7280
|
+
x && (p = new Hs(x, (L) => (P.push(() => {
|
|
7278
7281
|
P.err = new N(`${Se.IdleHeartbeatMissed}: ${L}`, O.JetStreamIdleHeartBeat);
|
|
7279
7282
|
}), !0)));
|
|
7280
7283
|
} catch {
|
|
@@ -7293,7 +7296,7 @@ class Ks extends Ot {
|
|
|
7293
7296
|
const n = i.config.ack_policy;
|
|
7294
7297
|
if (n === ne.None || n === ne.All)
|
|
7295
7298
|
throw new Error("ack policy for pull consumers must be explicit");
|
|
7296
|
-
const o = this._buildTypedSubscriptionOpts(i), a = new
|
|
7299
|
+
const o = this._buildTypedSubscriptionOpts(i), a = new Po(this, i.deliver, o);
|
|
7297
7300
|
a.info = i;
|
|
7298
7301
|
try {
|
|
7299
7302
|
await this._maybeCreateConsumer(i);
|
|
@@ -7316,8 +7319,8 @@ class Ks extends Ot {
|
|
|
7316
7319
|
return o._maybeSetupHbMonitoring(), o;
|
|
7317
7320
|
}
|
|
7318
7321
|
async _processOptions(t, s = Be()) {
|
|
7319
|
-
const i =
|
|
7320
|
-
if (i.isBind =
|
|
7322
|
+
const i = _r(s) ? s.getOpts() : s;
|
|
7323
|
+
if (i.isBind = _r(s) ? s.isBind : !1, i.flow_control = {
|
|
7321
7324
|
heartbeat_count: 0,
|
|
7322
7325
|
fc_count: 0,
|
|
7323
7326
|
consumer_restarts: 0
|
|
@@ -7359,10 +7362,10 @@ class Ks extends Ot {
|
|
|
7359
7362
|
}
|
|
7360
7363
|
_buildTypedSubscriptionOpts(t) {
|
|
7361
7364
|
const s = {};
|
|
7362
|
-
return s.adapter =
|
|
7365
|
+
return s.adapter = Oo(t.callbackFn === void 0, this.timeout), s.ingestionFilterFn = Gs.ingestionFn(t.ordered), s.protocolFilterFn = (i, n = !1) => {
|
|
7363
7366
|
const o = i;
|
|
7364
|
-
return
|
|
7365
|
-
}, !t.mack && t.config.ack_policy !== ne.None && (s.dispatchedFn =
|
|
7367
|
+
return Ps(o.msg) ? (n || o.msg.respond(), !1) : !0;
|
|
7368
|
+
}, !t.mack && t.config.ack_policy !== ne.None && (s.dispatchedFn = Io), t.callbackFn && (s.callback = t.callbackFn), s.max = t.max || 0, s.queue = t.queue, s;
|
|
7366
7369
|
}
|
|
7367
7370
|
async _maybeCreateConsumer(t) {
|
|
7368
7371
|
if (t.attached)
|
|
@@ -7389,13 +7392,13 @@ class Ks extends Ot {
|
|
|
7389
7392
|
protocol: !1
|
|
7390
7393
|
};
|
|
7391
7394
|
const o = s;
|
|
7392
|
-
if (tt(o.msg) || (d = n.monitor) == null || d.work(),
|
|
7395
|
+
if (tt(o.msg) || (d = n.monitor) == null || d.work(), Os(o.msg)) {
|
|
7393
7396
|
const p = t ? n._checkHbOrderConsumer(o.msg) : !0;
|
|
7394
7397
|
return t || n.info.flow_control.heartbeat_count++, {
|
|
7395
7398
|
ingest: p,
|
|
7396
7399
|
protocol: !0
|
|
7397
7400
|
};
|
|
7398
|
-
} else if (
|
|
7401
|
+
} else if (Ps(o.msg))
|
|
7399
7402
|
return n.info.flow_control.fc_count++, {
|
|
7400
7403
|
ingest: !0,
|
|
7401
7404
|
protocol: !0
|
|
@@ -7407,18 +7410,18 @@ class Ks extends Ot {
|
|
|
7407
7410
|
};
|
|
7408
7411
|
}
|
|
7409
7412
|
}
|
|
7410
|
-
class
|
|
7413
|
+
class Ks {
|
|
7411
7414
|
constructor(e) {
|
|
7412
7415
|
h(this, "options");
|
|
7413
7416
|
h(this, "protocol");
|
|
7414
7417
|
h(this, "draining");
|
|
7415
7418
|
h(this, "listeners");
|
|
7416
7419
|
h(this, "_services");
|
|
7417
|
-
this.draining = !1, this.options =
|
|
7420
|
+
this.draining = !1, this.options = Jn(e), this.listeners = [];
|
|
7418
7421
|
}
|
|
7419
7422
|
static connect(e = {}) {
|
|
7420
7423
|
return new Promise((t, s) => {
|
|
7421
|
-
const i = new
|
|
7424
|
+
const i = new Ks(e);
|
|
7422
7425
|
Zt.connect(i.options, i).then((n) => {
|
|
7423
7426
|
i.protocol = n, async function() {
|
|
7424
7427
|
for await (const o of n.status())
|
|
@@ -7547,7 +7550,7 @@ ${d}`), y(I);
|
|
|
7547
7550
|
}).catch((_) => {
|
|
7548
7551
|
p.cancel(_);
|
|
7549
7552
|
});
|
|
7550
|
-
const p = new
|
|
7553
|
+
const p = new hn(this.protocol.muxSubscriptions, e, d);
|
|
7551
7554
|
this.protocol.request(p);
|
|
7552
7555
|
try {
|
|
7553
7556
|
this.publish(e, t, {
|
|
@@ -7648,7 +7651,7 @@ ${a.stack}`), o.reject(p)) : o.resolve(_));
|
|
|
7648
7651
|
};
|
|
7649
7652
|
}
|
|
7650
7653
|
async jetstreamManager(e = {}) {
|
|
7651
|
-
const t = new
|
|
7654
|
+
const t = new yo(this, e);
|
|
7652
7655
|
if (e.checkAPI !== !1)
|
|
7653
7656
|
try {
|
|
7654
7657
|
await t.getAccountInfo();
|
|
@@ -7659,7 +7662,7 @@ ${a.stack}`), o.reject(p)) : o.resolve(_));
|
|
|
7659
7662
|
return t;
|
|
7660
7663
|
}
|
|
7661
7664
|
jetstream(e = {}) {
|
|
7662
|
-
return new
|
|
7665
|
+
return new Gs(this, e);
|
|
7663
7666
|
}
|
|
7664
7667
|
getServerVersion() {
|
|
7665
7668
|
const e = this.info;
|
|
@@ -7675,13 +7678,13 @@ ${a.stack}`), o.reject(p)) : o.resolve(_));
|
|
|
7675
7678
|
return this.protocol.features;
|
|
7676
7679
|
}
|
|
7677
7680
|
get services() {
|
|
7678
|
-
return this._services || (this._services = new
|
|
7681
|
+
return this._services || (this._services = new Eo(this)), this._services;
|
|
7679
7682
|
}
|
|
7680
7683
|
reconnect() {
|
|
7681
7684
|
return this.isClosed() ? Promise.reject(N.errorForCode(O.ConnectionClosed)) : this.isDraining() ? Promise.reject(N.errorForCode(O.ConnectionDraining)) : this.protocol.reconnect();
|
|
7682
7685
|
}
|
|
7683
7686
|
}
|
|
7684
|
-
class
|
|
7687
|
+
class Eo {
|
|
7685
7688
|
constructor(e) {
|
|
7686
7689
|
h(this, "nc");
|
|
7687
7690
|
this.nc = e;
|
|
@@ -7694,10 +7697,10 @@ class xo {
|
|
|
7694
7697
|
}
|
|
7695
7698
|
}
|
|
7696
7699
|
client(e, t) {
|
|
7697
|
-
return new
|
|
7700
|
+
return new to(this.nc, e, t);
|
|
7698
7701
|
}
|
|
7699
7702
|
}
|
|
7700
|
-
class
|
|
7703
|
+
class vo {
|
|
7701
7704
|
constructor(e, t, s) {
|
|
7702
7705
|
h(this, "bucket");
|
|
7703
7706
|
h(this, "sm");
|
|
@@ -7733,7 +7736,7 @@ class So {
|
|
|
7733
7736
|
return this.sm.string();
|
|
7734
7737
|
}
|
|
7735
7738
|
}
|
|
7736
|
-
class
|
|
7739
|
+
class Ao {
|
|
7737
7740
|
constructor(e, t, s) {
|
|
7738
7741
|
h(this, "bucket");
|
|
7739
7742
|
h(this, "key");
|
|
@@ -7744,7 +7747,7 @@ class Eo {
|
|
|
7744
7747
|
return this.sm.data;
|
|
7745
7748
|
}
|
|
7746
7749
|
get created() {
|
|
7747
|
-
return new Date(
|
|
7750
|
+
return new Date(Bs(this.sm.info.timestampNanos));
|
|
7748
7751
|
}
|
|
7749
7752
|
get revision() {
|
|
7750
7753
|
return this.sm.seq;
|
|
@@ -7768,7 +7771,7 @@ class Eo {
|
|
|
7768
7771
|
return this.sm.string();
|
|
7769
7772
|
}
|
|
7770
7773
|
}
|
|
7771
|
-
class si extends
|
|
7774
|
+
class si extends dn {
|
|
7772
7775
|
constructor(t, s, i) {
|
|
7773
7776
|
super(t.nc, s, i);
|
|
7774
7777
|
h(this, "js");
|
|
@@ -7806,7 +7809,7 @@ class si extends ln {
|
|
|
7806
7809
|
_maybeSetupHbMonitoring() {
|
|
7807
7810
|
var s, i;
|
|
7808
7811
|
const t = ((i = (s = this.info) == null ? void 0 : s.config) == null ? void 0 : i.idle_heartbeat) || 0;
|
|
7809
|
-
t && this._setupHbMonitoring(
|
|
7812
|
+
t && this._setupHbMonitoring(Bs(t));
|
|
7810
7813
|
}
|
|
7811
7814
|
_setupHbMonitoring(t, s = 0) {
|
|
7812
7815
|
const i = {
|
|
@@ -7816,7 +7819,7 @@ class si extends ln {
|
|
|
7816
7819
|
s && (i.cancelAfter = s);
|
|
7817
7820
|
const n = this.sub, o = (a) => {
|
|
7818
7821
|
var _, y, x, P;
|
|
7819
|
-
const d =
|
|
7822
|
+
const d = Gi(409, `${Se.IdleHeartbeatMissed}: ${a}`, this.sub.subject);
|
|
7820
7823
|
if (!((_ = this.info) == null ? void 0 : _.ordered))
|
|
7821
7824
|
this.sub.callback(null, d);
|
|
7822
7825
|
else {
|
|
@@ -7827,7 +7830,7 @@ class si extends ln {
|
|
|
7827
7830
|
}
|
|
7828
7831
|
return !n.noIterator;
|
|
7829
7832
|
};
|
|
7830
|
-
this.monitor = new
|
|
7833
|
+
this.monitor = new Hs(t, o, i);
|
|
7831
7834
|
}
|
|
7832
7835
|
_checkHbOrderConsumer(t) {
|
|
7833
7836
|
const s = t.headers.get(de.ConsumerStalledHdr);
|
|
@@ -7849,7 +7852,7 @@ class si extends ln {
|
|
|
7849
7852
|
return t.last = n, n;
|
|
7850
7853
|
}
|
|
7851
7854
|
}
|
|
7852
|
-
class
|
|
7855
|
+
class Po extends si {
|
|
7853
7856
|
constructor(e, t, s) {
|
|
7854
7857
|
super(e, t, s);
|
|
7855
7858
|
}
|
|
@@ -7879,10 +7882,10 @@ class vo extends si {
|
|
|
7879
7882
|
}
|
|
7880
7883
|
}
|
|
7881
7884
|
}
|
|
7882
|
-
function
|
|
7883
|
-
return r ?
|
|
7885
|
+
function Oo(r, e) {
|
|
7886
|
+
return r ? Co(e) : ko(e);
|
|
7884
7887
|
}
|
|
7885
|
-
function
|
|
7888
|
+
function ko(r) {
|
|
7886
7889
|
return (e, t) => e ? [
|
|
7887
7890
|
e,
|
|
7888
7891
|
null
|
|
@@ -7894,7 +7897,7 @@ function Po(r) {
|
|
|
7894
7897
|
Pt(t, r)
|
|
7895
7898
|
]);
|
|
7896
7899
|
}
|
|
7897
|
-
function
|
|
7900
|
+
function Co(r) {
|
|
7898
7901
|
return (e, t) => {
|
|
7899
7902
|
if (e)
|
|
7900
7903
|
return [
|
|
@@ -7918,23 +7921,23 @@ function ri(r) {
|
|
|
7918
7921
|
case O.JetStream408RequestTimeout:
|
|
7919
7922
|
return null;
|
|
7920
7923
|
case O.JetStream409:
|
|
7921
|
-
return
|
|
7924
|
+
return Ki(r) ? r : null;
|
|
7922
7925
|
default:
|
|
7923
7926
|
return r;
|
|
7924
7927
|
}
|
|
7925
7928
|
return null;
|
|
7926
7929
|
}
|
|
7927
|
-
function
|
|
7930
|
+
function Io(r) {
|
|
7928
7931
|
r && r.ack();
|
|
7929
7932
|
}
|
|
7930
|
-
function
|
|
7933
|
+
function jo(r) {
|
|
7931
7934
|
const e = r.split(".");
|
|
7932
7935
|
if (e.length === 9 && e.splice(2, 0, "_", ""), e.length < 11 || e[0] !== "$JS" || e[1] !== "ACK")
|
|
7933
7936
|
throw new Error("not js message");
|
|
7934
7937
|
const t = {};
|
|
7935
7938
|
return t.domain = e[2] === "_" ? "" : e[2], t.account_hash = e[3], t.stream = e[4], t.consumer = e[5], t.deliveryCount = parseInt(e[6], 10), t.redeliveryCount = t.deliveryCount, t.redelivered = t.deliveryCount > 1, t.streamSequence = parseInt(e[7], 10), t.deliverySequence = parseInt(e[8], 10), t.timestampNanos = parseInt(e[9], 10), t.pending = parseInt(e[10], 10), t;
|
|
7936
7939
|
}
|
|
7937
|
-
class
|
|
7940
|
+
class Ro {
|
|
7938
7941
|
constructor(e, t) {
|
|
7939
7942
|
h(this, "msg");
|
|
7940
7943
|
h(this, "di");
|
|
@@ -7955,7 +7958,7 @@ class Io {
|
|
|
7955
7958
|
return this.msg.headers;
|
|
7956
7959
|
}
|
|
7957
7960
|
get info() {
|
|
7958
|
-
return this.di || (this.di =
|
|
7961
|
+
return this.di || (this.di = jo(this.reply)), this.di;
|
|
7959
7962
|
}
|
|
7960
7963
|
get redelivered() {
|
|
7961
7964
|
return this.info.deliveryCount > 1;
|
|
@@ -7984,7 +7987,7 @@ class Io {
|
|
|
7984
7987
|
}, o);
|
|
7985
7988
|
n.request(a);
|
|
7986
7989
|
try {
|
|
7987
|
-
n.publish(this.msg.reply,
|
|
7990
|
+
n.publish(this.msg.reply, Rr, {
|
|
7988
7991
|
reply: `${n.muxSubscriptions.baseInbox}${a.token}`
|
|
7989
7992
|
});
|
|
7990
7993
|
} catch (d) {
|
|
@@ -8003,11 +8006,11 @@ class Io {
|
|
|
8003
8006
|
return t;
|
|
8004
8007
|
}
|
|
8005
8008
|
ack() {
|
|
8006
|
-
this.doAck(
|
|
8009
|
+
this.doAck(Rr);
|
|
8007
8010
|
}
|
|
8008
8011
|
nak(e) {
|
|
8009
|
-
let t =
|
|
8010
|
-
e && (t =
|
|
8012
|
+
let t = lo;
|
|
8013
|
+
e && (t = mr().encode(`-NAK ${JSON.stringify({
|
|
8011
8014
|
delay: G(e)
|
|
8012
8015
|
})}`)), this.doAck(t);
|
|
8013
8016
|
}
|
|
@@ -8019,14 +8022,14 @@ class Io {
|
|
|
8019
8022
|
}) {
|
|
8020
8023
|
const s = {};
|
|
8021
8024
|
s.batch = t.batch || 1, s.no_wait = t.no_wait || !1, t.expires && t.expires > 0 && (s.expires = G(t.expires));
|
|
8022
|
-
const i = ve().encode(s), n = ot.concat(
|
|
8025
|
+
const i = ve().encode(s), n = ot.concat(fo, mo, i), o = e ? {
|
|
8023
8026
|
reply: e
|
|
8024
8027
|
} : void 0;
|
|
8025
8028
|
this.msg.respond(n, o);
|
|
8026
8029
|
}
|
|
8027
8030
|
term(e = "") {
|
|
8028
|
-
let t =
|
|
8029
|
-
(e == null ? void 0 : e.length) > 0 && (t =
|
|
8031
|
+
let t = po;
|
|
8032
|
+
(e == null ? void 0 : e.length) > 0 && (t = mr().encode(`+TERM ${e}`)), this.doAck(t);
|
|
8030
8033
|
}
|
|
8031
8034
|
json() {
|
|
8032
8035
|
return this.msg.json();
|
|
@@ -8035,8 +8038,8 @@ class Io {
|
|
|
8035
8038
|
return this.msg.string();
|
|
8036
8039
|
}
|
|
8037
8040
|
}
|
|
8038
|
-
const
|
|
8039
|
-
class
|
|
8041
|
+
const No = "1.30.3", To = "nats.ws";
|
|
8042
|
+
class Mo {
|
|
8040
8043
|
constructor() {
|
|
8041
8044
|
h(this, "version");
|
|
8042
8045
|
h(this, "lang");
|
|
@@ -8051,7 +8054,7 @@ class No {
|
|
|
8051
8054
|
h(this, "yields");
|
|
8052
8055
|
h(this, "signal");
|
|
8053
8056
|
h(this, "closedNotification");
|
|
8054
|
-
this.version =
|
|
8057
|
+
this.version = No, this.lang = To, this.connected = !1, this.done = !1, this.socketClosed = !1, this.encrypted = !1, this.peeked = !1, this.yields = [], this.signal = K(), this.closedNotification = K();
|
|
8055
8058
|
}
|
|
8056
8059
|
async connect(e, t) {
|
|
8057
8060
|
const s = K();
|
|
@@ -8073,16 +8076,16 @@ class No {
|
|
|
8073
8076
|
this.signal.resolve();
|
|
8074
8077
|
return;
|
|
8075
8078
|
}
|
|
8076
|
-
const o = ot.concat(...this.yields), a =
|
|
8079
|
+
const o = ot.concat(...this.yields), a = yn(o);
|
|
8077
8080
|
if (a !== "") {
|
|
8078
|
-
const d =
|
|
8081
|
+
const d = Kn.exec(a);
|
|
8079
8082
|
if (!d) {
|
|
8080
8083
|
t.debug && console.error("!!!", Lt(o)), s.reject(new Error("unexpected response from server"));
|
|
8081
8084
|
return;
|
|
8082
8085
|
}
|
|
8083
8086
|
try {
|
|
8084
8087
|
const p = JSON.parse(d[1]);
|
|
8085
|
-
|
|
8088
|
+
zn(p, this.options), this.peeked = !0, this.connected = !0, this.signal.resolve(), s.resolve();
|
|
8086
8089
|
} catch (p) {
|
|
8087
8090
|
s.reject(p);
|
|
8088
8091
|
return;
|
|
@@ -8167,7 +8170,7 @@ class No {
|
|
|
8167
8170
|
}
|
|
8168
8171
|
}
|
|
8169
8172
|
}
|
|
8170
|
-
function
|
|
8173
|
+
function $o(r, e) {
|
|
8171
8174
|
/^(.*:\/\/)(.*)/.test(r) || (typeof e == "boolean" ? r = `${e === !0 ? "https" : "http"}://${r}` : r = `https://${r}`);
|
|
8172
8175
|
let s = new URL(r);
|
|
8173
8176
|
const i = s.protocol.toLowerCase();
|
|
@@ -8191,15 +8194,15 @@ function To(r, e) {
|
|
|
8191
8194
|
}
|
|
8192
8195
|
return `${n}//${a}:${o}${d}${p}`;
|
|
8193
8196
|
}
|
|
8194
|
-
function
|
|
8195
|
-
return
|
|
8197
|
+
function Uo(r = {}) {
|
|
8198
|
+
return pn({
|
|
8196
8199
|
defaultPort: 443,
|
|
8197
|
-
urlParseFn:
|
|
8198
|
-
factory: () => new
|
|
8199
|
-
}),
|
|
8200
|
+
urlParseFn: $o,
|
|
8201
|
+
factory: () => new Mo()
|
|
8202
|
+
}), Ks.connect(r);
|
|
8200
8203
|
}
|
|
8201
8204
|
const Ue = ve();
|
|
8202
|
-
class
|
|
8205
|
+
class Tr {
|
|
8203
8206
|
constructor(e) {
|
|
8204
8207
|
h(this, "onStatusChange");
|
|
8205
8208
|
h(this, "nc");
|
|
@@ -8213,15 +8216,18 @@ class Mr {
|
|
|
8213
8216
|
));
|
|
8214
8217
|
this.config = e;
|
|
8215
8218
|
}
|
|
8219
|
+
get url() {
|
|
8220
|
+
return this.config.natsUrl;
|
|
8221
|
+
}
|
|
8216
8222
|
async connect(e = {}) {
|
|
8217
8223
|
var a;
|
|
8218
8224
|
const { natsWsServerUrls: t, user: s, prefix: i } = e, n = t ?? [
|
|
8219
8225
|
this.config.natsUrl
|
|
8220
8226
|
];
|
|
8221
|
-
this.nc = await
|
|
8227
|
+
this.nc = await Uo({
|
|
8222
8228
|
servers: n
|
|
8223
8229
|
});
|
|
8224
|
-
const o = s ??
|
|
8230
|
+
const o = s ?? this.config.auth.getLastLoginData();
|
|
8225
8231
|
if (!o)
|
|
8226
8232
|
throw new Error(
|
|
8227
8233
|
"Please authenticate first by calling `auth` apis"
|
|
@@ -8355,13 +8361,33 @@ class Mr {
|
|
|
8355
8361
|
return [this.globalPrefix, e, this.userId, this.sessionId].filter((t) => t).join(".");
|
|
8356
8362
|
}
|
|
8357
8363
|
}
|
|
8358
|
-
|
|
8364
|
+
class ii {
|
|
8365
|
+
async setItem(e, t) {
|
|
8366
|
+
if (!t)
|
|
8367
|
+
return this.removeItem(e);
|
|
8368
|
+
localStorage.setItem(e, JSON.stringify(t));
|
|
8369
|
+
}
|
|
8370
|
+
async getItem(e) {
|
|
8371
|
+
const t = localStorage.getItem(e);
|
|
8372
|
+
if (!t)
|
|
8373
|
+
return null;
|
|
8374
|
+
try {
|
|
8375
|
+
return JSON.parse(t);
|
|
8376
|
+
} catch {
|
|
8377
|
+
return null;
|
|
8378
|
+
}
|
|
8379
|
+
}
|
|
8380
|
+
async removeItem(e) {
|
|
8381
|
+
localStorage.removeItem(e);
|
|
8382
|
+
}
|
|
8383
|
+
}
|
|
8384
|
+
function ni(r) {
|
|
8359
8385
|
const e = new Blob([r], { type: "audio/mpeg" }), t = URL.createObjectURL(e), s = new Audio();
|
|
8360
8386
|
return s.src = t, s.onended = () => {
|
|
8361
8387
|
URL.revokeObjectURL(t);
|
|
8362
8388
|
}, s;
|
|
8363
8389
|
}
|
|
8364
|
-
class
|
|
8390
|
+
class Lo {
|
|
8365
8391
|
async getAudioBuffer(e, t, s) {
|
|
8366
8392
|
const i = [], n = crypto.randomUUID();
|
|
8367
8393
|
return new Promise((o, a) => {
|
|
@@ -8369,9 +8395,9 @@ class $o {
|
|
|
8369
8395
|
`${Dt.WSS_URL}?trustedclienttoken=${Dt.TRUSTED_CLIENT_TOKEN}&ConnectionId=${n}`
|
|
8370
8396
|
);
|
|
8371
8397
|
d.binaryType = "arraybuffer";
|
|
8372
|
-
const p =
|
|
8398
|
+
const p = Fo(e, t, s);
|
|
8373
8399
|
d.addEventListener("open", () => {
|
|
8374
|
-
const _ =
|
|
8400
|
+
const _ = qo();
|
|
8375
8401
|
d.send(_);
|
|
8376
8402
|
const y = `X-RequestId:${n}\r
|
|
8377
8403
|
Content-Type:application/ssml+xml\r
|
|
@@ -8384,7 +8410,7 @@ Path:ssml\r
|
|
|
8384
8410
|
const y = _.data;
|
|
8385
8411
|
if (y instanceof ArrayBuffer) {
|
|
8386
8412
|
const x = new Uint8Array(y), P = new TextEncoder().encode(`Path:audio\r
|
|
8387
|
-
`), I =
|
|
8413
|
+
`), I = Bo(x, P);
|
|
8388
8414
|
if (I !== -1) {
|
|
8389
8415
|
const J = x.subarray(I + P.length);
|
|
8390
8416
|
i.push(J);
|
|
@@ -8412,7 +8438,7 @@ Path:ssml\r
|
|
|
8412
8438
|
}
|
|
8413
8439
|
async getAudio(e, t, s) {
|
|
8414
8440
|
return this.getAudioBuffer(e, t, s).then(
|
|
8415
|
-
(i) =>
|
|
8441
|
+
(i) => ni(i)
|
|
8416
8442
|
);
|
|
8417
8443
|
}
|
|
8418
8444
|
async getVoices() {
|
|
@@ -8429,17 +8455,17 @@ const Dt = {
|
|
|
8429
8455
|
TRUSTED_CLIENT_TOKEN: "6A5AA1D4EAFF4E9FB37E23D68491D6F4",
|
|
8430
8456
|
WSS_URL: "wss://speech.platform.bing.com/consumer/speech/synthesize/readaloud/edge/v1",
|
|
8431
8457
|
VOICES_URL: "https://speech.platform.bing.com/consumer/speech/synthesize/readaloud/voices/list"
|
|
8432
|
-
},
|
|
8458
|
+
}, qo = () => `X-Timestamp:${(/* @__PURE__ */ new Date()).toISOString()}Z\r
|
|
8433
8459
|
Content-Type:application/json; charset=utf-8\r
|
|
8434
8460
|
Path:speech.config\r
|
|
8435
8461
|
\r
|
|
8436
|
-
{"context":{"synthesis":{"audio":{"metadataoptions":{"sentenceBoundaryEnabled":false,"wordBoundaryEnabled":true},"outputFormat":"audio-24khz-48kbitrate-mono-mp3"}}}}`,
|
|
8462
|
+
{"context":{"synthesis":{"audio":{"metadataoptions":{"sentenceBoundaryEnabled":false,"wordBoundaryEnabled":true},"outputFormat":"audio-24khz-48kbitrate-mono-mp3"}}}}`, Fo = (r, e, t = {}) => {
|
|
8437
8463
|
var o;
|
|
8438
8464
|
t.pitch = (o = t.pitch) == null ? void 0 : o.replace("hz", "Hz");
|
|
8439
8465
|
const s = t.pitch || "0Hz", i = t.rate || "0%", n = t.volume || "0%";
|
|
8440
8466
|
return `<speak version='1.0' xml:lang='en-US'><voice name='${e}'><prosody pitch='${s}' rate='${i}' volume='${n}'>${r}</prosody></voice></speak>`;
|
|
8441
8467
|
};
|
|
8442
|
-
function
|
|
8468
|
+
function Bo(r, e) {
|
|
8443
8469
|
for (let t = 0; t <= r.length - e.length; t++) {
|
|
8444
8470
|
let s = !0;
|
|
8445
8471
|
for (let i = 0; i < e.length; i++)
|
|
@@ -8451,7 +8477,7 @@ function qo(r, e) {
|
|
|
8451
8477
|
}
|
|
8452
8478
|
return -1;
|
|
8453
8479
|
}
|
|
8454
|
-
class
|
|
8480
|
+
class Ho {
|
|
8455
8481
|
constructor(e) {
|
|
8456
8482
|
this.config = e;
|
|
8457
8483
|
}
|
|
@@ -8499,7 +8525,7 @@ class Bo {
|
|
|
8499
8525
|
}
|
|
8500
8526
|
async getAudio(e, t) {
|
|
8501
8527
|
return this.getAudioBuffer(e, t).then(
|
|
8502
|
-
(s) => s ?
|
|
8528
|
+
(s) => s ? ni(s) : null
|
|
8503
8529
|
);
|
|
8504
8530
|
}
|
|
8505
8531
|
async getVoices() {
|
|
@@ -8514,21 +8540,29 @@ class Bo {
|
|
|
8514
8540
|
);
|
|
8515
8541
|
}
|
|
8516
8542
|
}
|
|
8517
|
-
const
|
|
8543
|
+
const oi = {
|
|
8518
8544
|
debug: !1,
|
|
8519
8545
|
authUrl: "https://auth.jok.io",
|
|
8520
|
-
natsUrl: "https://natsx.jok.io"
|
|
8521
|
-
|
|
8546
|
+
natsUrl: "https://natsx.jok.io",
|
|
8547
|
+
storage: new ii()
|
|
8548
|
+
}, Mr = new Fr(oi), Jo = {
|
|
8522
8549
|
setup(r) {
|
|
8523
|
-
r.authUrl
|
|
8550
|
+
(r.authUrl || r.storage) && (this.auth = new Fr({
|
|
8551
|
+
authUrl: r.authUrl ?? this.auth.url,
|
|
8552
|
+
storage: r.storage ?? this.storage
|
|
8553
|
+
})), (r.natsUrl || r.storage) && (this.nats = new Tr({
|
|
8554
|
+
natsUrl: r.natsUrl ?? this.nats.url,
|
|
8555
|
+
auth: this.auth
|
|
8556
|
+
}));
|
|
8524
8557
|
},
|
|
8525
|
-
auth:
|
|
8526
|
-
|
|
8527
|
-
|
|
8528
|
-
|
|
8558
|
+
auth: Mr,
|
|
8559
|
+
storage: new ii(),
|
|
8560
|
+
tts: new Lo(),
|
|
8561
|
+
nats: new Tr({ ...oi, auth: Mr }),
|
|
8562
|
+
crypto: new Mi()
|
|
8529
8563
|
};
|
|
8530
8564
|
export {
|
|
8531
|
-
|
|
8532
|
-
|
|
8533
|
-
|
|
8565
|
+
Tr as NatsService,
|
|
8566
|
+
Ho as VoicevoxTtsService,
|
|
8567
|
+
Jo as jok
|
|
8534
8568
|
};
|