@jokio/sdk 0.4.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth.service.d.ts +8 -4
- package/dist/jokio.sdk.es.js +345 -351
- package/dist/jokio.sdk.umd.js +9 -9
- package/package.json +1 -1
package/dist/jokio.sdk.es.js
CHANGED
|
@@ -329,55 +329,40 @@ async function Ji(r) {
|
|
|
329
329
|
authenticatorAttachment: Yr(a.authenticatorAttachment)
|
|
330
330
|
};
|
|
331
331
|
}
|
|
332
|
-
const
|
|
332
|
+
const yt = "ACCESS_TOKEN", _r = "SESSION_SEED", wt = "LAST_AUTH_DATA";
|
|
333
333
|
class Xr {
|
|
334
334
|
constructor(e) {
|
|
335
335
|
h(this, "onUserDataUpdate");
|
|
336
|
-
|
|
337
|
-
h(this, "isAuthenticatedResolver", () => {
|
|
338
|
-
});
|
|
339
|
-
this.options = e, this.isAuthenticated = new Promise(
|
|
340
|
-
(t) => this.isAuthenticatedResolver = t
|
|
341
|
-
);
|
|
336
|
+
this.options = e;
|
|
342
337
|
}
|
|
343
338
|
get url() {
|
|
344
339
|
return this.options.authUrl;
|
|
345
340
|
}
|
|
346
|
-
async init() {
|
|
347
|
-
var t, s;
|
|
348
|
-
const e = localStorage.getItem(Ze);
|
|
349
|
-
if (e)
|
|
350
|
-
try {
|
|
351
|
-
const i = JSON.parse(e);
|
|
352
|
-
(t = this.onUserDataUpdate) == null || t.call(this, i), this.isAuthenticatedResolver();
|
|
353
|
-
} catch {
|
|
354
|
-
}
|
|
355
|
-
else {
|
|
356
|
-
const i = await this.me();
|
|
357
|
-
await this.options.storage.setItem(Ze, i), (s = this.onUserDataUpdate) == null || s.call(this, i), this.isAuthenticatedResolver();
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
341
|
async me() {
|
|
361
342
|
return await fetch(this.options.authUrl + "/me", {
|
|
362
|
-
|
|
343
|
+
headers: await this.getAuthHeader()
|
|
363
344
|
}).then((t) => t.json());
|
|
364
345
|
}
|
|
365
346
|
async requestEmailLogin(e, t = location.href) {
|
|
366
347
|
return await fetch(
|
|
367
348
|
this.options.authUrl + `/email-verification-request/${e}?returnUrl=${t}`,
|
|
368
|
-
{
|
|
349
|
+
{
|
|
350
|
+
headers: await this.getAuthHeader()
|
|
351
|
+
}
|
|
369
352
|
).then(xt);
|
|
370
353
|
}
|
|
371
354
|
async completeEmailLogin(e, t) {
|
|
372
355
|
var i;
|
|
373
356
|
const s = await fetch(
|
|
374
357
|
this.options.authUrl + `/email-verification-complete/${e}/${t}`,
|
|
375
|
-
{
|
|
358
|
+
{
|
|
359
|
+
headers: await this.getAuthHeader()
|
|
360
|
+
}
|
|
376
361
|
).then(xt);
|
|
377
362
|
return await this.options.storage.setItem(
|
|
378
|
-
|
|
363
|
+
yt,
|
|
379
364
|
s.accessToken
|
|
380
|
-
), await this.options.storage.setItem(
|
|
365
|
+
), await this.options.storage.setItem(wt, s.jwtData), (i = this.onUserDataUpdate) == null || i.call(this, s.jwtData), s.jwtData;
|
|
381
366
|
}
|
|
382
367
|
async requestPasskeyLogin(e = {}) {
|
|
383
368
|
var f, p;
|
|
@@ -387,7 +372,9 @@ class Xr {
|
|
|
387
372
|
addAsAdditionalDevice: i = !1
|
|
388
373
|
} = e, n = await fetch(
|
|
389
374
|
this.options.authUrl + `/webauth-challenge-request?registration=${s ? "true" : ""}&displayName=${t}`,
|
|
390
|
-
{
|
|
375
|
+
{
|
|
376
|
+
headers: await this.getAuthHeader()
|
|
377
|
+
}
|
|
391
378
|
).then(xt);
|
|
392
379
|
let o;
|
|
393
380
|
try {
|
|
@@ -407,15 +394,15 @@ class Xr {
|
|
|
407
394
|
method: "POST",
|
|
408
395
|
body: JSON.stringify(o),
|
|
409
396
|
headers: {
|
|
410
|
-
"Content-Type": "application/json"
|
|
411
|
-
|
|
412
|
-
|
|
397
|
+
"Content-Type": "application/json",
|
|
398
|
+
...await this.getAuthHeader()
|
|
399
|
+
}
|
|
413
400
|
}
|
|
414
401
|
).then(xt);
|
|
415
402
|
return await this.options.storage.setItem(
|
|
416
|
-
|
|
403
|
+
yt,
|
|
417
404
|
a.accessToken
|
|
418
|
-
), await this.options.storage.setItem(
|
|
405
|
+
), await this.options.storage.setItem(wt, a.jwtData), (p = this.onUserDataUpdate) == null || p.call(this, a.jwtData), a.jwtData;
|
|
419
406
|
}
|
|
420
407
|
async guestLogin() {
|
|
421
408
|
var t;
|
|
@@ -423,28 +410,35 @@ class Xr {
|
|
|
423
410
|
this.options.authUrl + "/guest-session"
|
|
424
411
|
).then(xt);
|
|
425
412
|
return await this.options.storage.setItem(
|
|
426
|
-
|
|
413
|
+
yt,
|
|
427
414
|
e.accessToken
|
|
428
415
|
), await this.options.storage.setItem(
|
|
429
416
|
_r,
|
|
430
417
|
e.sessionSeed
|
|
431
|
-
), await this.options.storage.setItem(
|
|
418
|
+
), await this.options.storage.setItem(wt, e.jwtData), (t = this.onUserDataUpdate) == null || t.call(this, e.jwtData), e.jwtData;
|
|
432
419
|
}
|
|
433
420
|
signOut() {
|
|
434
421
|
var e;
|
|
435
|
-
this.options.storage.removeItem(
|
|
422
|
+
this.options.storage.removeItem(yt), this.options.storage.removeItem(wt), (e = this.onUserDataUpdate) == null || e.call(this, null);
|
|
436
423
|
}
|
|
437
424
|
getLastLoginData() {
|
|
438
425
|
return this.options.storage.getItem(
|
|
439
|
-
|
|
426
|
+
wt
|
|
440
427
|
);
|
|
441
428
|
}
|
|
442
429
|
getAccessToken() {
|
|
443
|
-
return this.options.storage.getItem(
|
|
430
|
+
return this.options.storage.getItem(yt);
|
|
444
431
|
}
|
|
445
432
|
getSessionSeed() {
|
|
446
433
|
return this.options.storage.getItem(_r);
|
|
447
434
|
}
|
|
435
|
+
async getAuthHeader() {
|
|
436
|
+
const e = await this.getAccessToken();
|
|
437
|
+
if (e)
|
|
438
|
+
return {
|
|
439
|
+
authorization: "bearer " + e
|
|
440
|
+
};
|
|
441
|
+
}
|
|
448
442
|
}
|
|
449
443
|
const xt = async (r) => {
|
|
450
444
|
const e = await r.json();
|
|
@@ -578,25 +572,25 @@ class en {
|
|
|
578
572
|
}
|
|
579
573
|
}
|
|
580
574
|
const Ge = new en();
|
|
581
|
-
var
|
|
575
|
+
var ke;
|
|
582
576
|
(function(r) {
|
|
583
577
|
r.Disconnect = "disconnect", r.Reconnect = "reconnect", r.Update = "update", r.LDM = "ldm", r.Error = "error";
|
|
584
|
-
})(
|
|
578
|
+
})(ke || (ke = {}));
|
|
585
579
|
var He;
|
|
586
580
|
(function(r) {
|
|
587
581
|
r.Reconnecting = "reconnecting", r.PingTimer = "pingTimer", r.StaleConnection = "staleConnection", r.ClientInitiatedReconnect = "client initiated reconnect";
|
|
588
582
|
})(He || (He = {}));
|
|
589
|
-
var
|
|
583
|
+
var k;
|
|
590
584
|
(function(r) {
|
|
591
585
|
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";
|
|
592
|
-
})(
|
|
586
|
+
})(k || (k = {}));
|
|
593
587
|
function tn(r) {
|
|
594
588
|
return typeof r.code == "string";
|
|
595
589
|
}
|
|
596
590
|
class Zr {
|
|
597
591
|
constructor() {
|
|
598
592
|
h(this, "messages");
|
|
599
|
-
this.messages = /* @__PURE__ */ new Map(), this.messages.set(
|
|
593
|
+
this.messages = /* @__PURE__ */ new Map(), this.messages.set(k.InvalidPayload, "Invalid payload type - payloads can be 'binary', 'string', or 'json'"), this.messages.set(k.BadJson, "Bad JSON"), this.messages.set(k.WssRequired, "TLS is required, therefore a secure websocket connection is also required");
|
|
600
594
|
}
|
|
601
595
|
static getMessage(e) {
|
|
602
596
|
return sn.getMessage(e);
|
|
@@ -622,16 +616,16 @@ class T extends Error {
|
|
|
622
616
|
return new T(i, t, s);
|
|
623
617
|
}
|
|
624
618
|
isAuthError() {
|
|
625
|
-
return this.code ===
|
|
619
|
+
return this.code === k.AuthenticationExpired || this.code === k.AuthorizationViolation || this.code === k.AccountExpired;
|
|
626
620
|
}
|
|
627
621
|
isAuthTimeout() {
|
|
628
|
-
return this.code ===
|
|
622
|
+
return this.code === k.AuthenticationTimeout;
|
|
629
623
|
}
|
|
630
624
|
isPermissionError() {
|
|
631
|
-
return this.code ===
|
|
625
|
+
return this.code === k.PermissionsViolation;
|
|
632
626
|
}
|
|
633
627
|
isProtocolError() {
|
|
634
|
-
return this.code ===
|
|
628
|
+
return this.code === k.ProtocolError;
|
|
635
629
|
}
|
|
636
630
|
isJetStreamError() {
|
|
637
631
|
return this.api_error !== void 0;
|
|
@@ -648,10 +642,10 @@ var Ne;
|
|
|
648
642
|
(function(r) {
|
|
649
643
|
r.Timer = "timer", r.Count = "count", r.JitterTimer = "jitterTimer", r.SentinelMsg = "sentinelMsg";
|
|
650
644
|
})(Ne || (Ne = {}));
|
|
651
|
-
var
|
|
645
|
+
var kt;
|
|
652
646
|
(function(r) {
|
|
653
647
|
r.STATS = "io.nats.micro.v1.stats_response", r.INFO = "io.nats.micro.v1.info_response", r.PING = "io.nats.micro.v1.ping_response";
|
|
654
|
-
})(
|
|
648
|
+
})(kt || (kt = {}));
|
|
655
649
|
const Qt = "Nats-Service-Error", es = "Nats-Service-Error-Code";
|
|
656
650
|
class ts extends Error {
|
|
657
651
|
constructor(t, s) {
|
|
@@ -697,8 +691,8 @@ function cs(r, ...e) {
|
|
|
697
691
|
function Kt(r) {
|
|
698
692
|
return xe.decode(r).replace(/\n/g, "␊").replace(/\r/g, "␍");
|
|
699
693
|
}
|
|
700
|
-
function
|
|
701
|
-
const t = e ? T.errorForCode(
|
|
694
|
+
function ut(r, e = !0) {
|
|
695
|
+
const t = e ? T.errorForCode(k.Timeout) : null;
|
|
702
696
|
let s, i;
|
|
703
697
|
const n = new Promise((o, a) => {
|
|
704
698
|
s = {
|
|
@@ -706,12 +700,12 @@ function lt(r, e = !0) {
|
|
|
706
700
|
i && clearTimeout(i);
|
|
707
701
|
}
|
|
708
702
|
}, i = setTimeout(() => {
|
|
709
|
-
a(t === null ? T.errorForCode(
|
|
703
|
+
a(t === null ? T.errorForCode(k.Timeout) : t);
|
|
710
704
|
}, r);
|
|
711
705
|
});
|
|
712
706
|
return Object.assign(n, s);
|
|
713
707
|
}
|
|
714
|
-
function
|
|
708
|
+
function dt(r = 0) {
|
|
715
709
|
let e;
|
|
716
710
|
const t = new Promise((s) => {
|
|
717
711
|
const i = setTimeout(() => {
|
|
@@ -785,7 +779,7 @@ function Pr(r) {
|
|
|
785
779
|
for (let n = 0; n < r.length; n++) {
|
|
786
780
|
let o = r.charCodeAt(n);
|
|
787
781
|
if (o === 58 || o < 33 || o > 126)
|
|
788
|
-
throw new T(`'${r[n]}' is not a valid character for a header key`,
|
|
782
|
+
throw new T(`'${r[n]}' is not a valid character for a header key`, k.BadHeader);
|
|
789
783
|
s && 97 <= o && o <= 122 ? o -= 32 : !s && 65 <= o && o <= 90 && (o += 32), i[n] = o, s = o == 45;
|
|
790
784
|
}
|
|
791
785
|
return String.fromCharCode(...i);
|
|
@@ -795,7 +789,7 @@ function Fe(r = 0, e = "") {
|
|
|
795
789
|
throw new Error("setting status requires both code and description");
|
|
796
790
|
return new Ke(r, e);
|
|
797
791
|
}
|
|
798
|
-
const
|
|
792
|
+
const ks = "NATS/1.0";
|
|
799
793
|
class Ke {
|
|
800
794
|
constructor(e = 0, t = "") {
|
|
801
795
|
h(this, "_code");
|
|
@@ -831,8 +825,8 @@ class Ke {
|
|
|
831
825
|
static decode(e) {
|
|
832
826
|
const t = new Ke(), i = xe.decode(e).split(`\r
|
|
833
827
|
`), n = i[0];
|
|
834
|
-
if (n !==
|
|
835
|
-
let o = n.replace(
|
|
828
|
+
if (n !== ks) {
|
|
829
|
+
let o = n.replace(ks, "").trim();
|
|
836
830
|
if (o.length > 0) {
|
|
837
831
|
t._code = parseInt(o, 10), isNaN(t._code) && (t._code = 0);
|
|
838
832
|
const a = t._code.toString();
|
|
@@ -852,7 +846,7 @@ class Ke {
|
|
|
852
846
|
toString() {
|
|
853
847
|
if (this.headers.size === 0 && this._code === 0)
|
|
854
848
|
return "";
|
|
855
|
-
let e =
|
|
849
|
+
let e = ks;
|
|
856
850
|
this._code > 0 && this._description !== "" && (e += ` ${this._code} ${this._description}`);
|
|
857
851
|
for (const [t, s] of this.headers)
|
|
858
852
|
for (let i = 0; i < s.length; i++)
|
|
@@ -867,7 +861,7 @@ ${t}: ${s[i]}`;
|
|
|
867
861
|
}
|
|
868
862
|
static validHeaderValue(e) {
|
|
869
863
|
if (/[\r\n]/.test(e))
|
|
870
|
-
throw new T("invalid header value - \\r and \\n are not allowed.",
|
|
864
|
+
throw new T("invalid header value - \\r and \\n are not allowed.", k.BadHeader);
|
|
871
865
|
return e.trim();
|
|
872
866
|
}
|
|
873
867
|
keys() {
|
|
@@ -969,27 +963,27 @@ function Us() {
|
|
|
969
963
|
}
|
|
970
964
|
};
|
|
971
965
|
}
|
|
972
|
-
function
|
|
966
|
+
function Oe(r) {
|
|
973
967
|
return {
|
|
974
968
|
encode(e) {
|
|
975
969
|
try {
|
|
976
970
|
return e === void 0 && (e = null), We.encode(JSON.stringify(e));
|
|
977
971
|
} catch (t) {
|
|
978
|
-
throw T.errorForCode(
|
|
972
|
+
throw T.errorForCode(k.BadJson, t);
|
|
979
973
|
}
|
|
980
974
|
},
|
|
981
975
|
decode(e) {
|
|
982
976
|
try {
|
|
983
977
|
return JSON.parse(xe.decode(e), r);
|
|
984
978
|
} catch (t) {
|
|
985
|
-
throw T.errorForCode(
|
|
979
|
+
throw T.errorForCode(k.BadJson, t);
|
|
986
980
|
}
|
|
987
981
|
}
|
|
988
982
|
};
|
|
989
983
|
}
|
|
990
984
|
function ei(r) {
|
|
991
985
|
var e;
|
|
992
|
-
return r && r.data.length === 0 && ((e = r.headers) == null ? void 0 : e.code) === 503 ? T.errorForCode(
|
|
986
|
+
return r && r.data.length === 0 && ((e = r.headers) == null ? void 0 : e.code) === 503 ? T.errorForCode(k.NoResponders) : null;
|
|
993
987
|
}
|
|
994
988
|
class Qs {
|
|
995
989
|
constructor(e, t, s) {
|
|
@@ -1029,7 +1023,7 @@ class Qs {
|
|
|
1029
1023
|
return e + t + s;
|
|
1030
1024
|
}
|
|
1031
1025
|
json(e) {
|
|
1032
|
-
return
|
|
1026
|
+
return Oe(e).decode(this.data);
|
|
1033
1027
|
}
|
|
1034
1028
|
string() {
|
|
1035
1029
|
return xe.decode(this.data);
|
|
@@ -1043,7 +1037,7 @@ class Qs {
|
|
|
1043
1037
|
}
|
|
1044
1038
|
}
|
|
1045
1039
|
h(Qs, "jc");
|
|
1046
|
-
function
|
|
1040
|
+
function ot(r) {
|
|
1047
1041
|
return hs("durable", r);
|
|
1048
1042
|
}
|
|
1049
1043
|
function pe(r) {
|
|
@@ -1117,7 +1111,7 @@ function on(r, e, t) {
|
|
|
1117
1111
|
}, n = new Qs(i, ve, {});
|
|
1118
1112
|
return n._headers = s, n._subject = t, n;
|
|
1119
1113
|
}
|
|
1120
|
-
function
|
|
1114
|
+
function at(r) {
|
|
1121
1115
|
if (r.data.length !== 0)
|
|
1122
1116
|
return null;
|
|
1123
1117
|
const e = r.headers;
|
|
@@ -1128,7 +1122,7 @@ var Pe;
|
|
|
1128
1122
|
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";
|
|
1129
1123
|
})(Pe || (Pe = {}));
|
|
1130
1124
|
function an(r) {
|
|
1131
|
-
return r.code !==
|
|
1125
|
+
return r.code !== k.JetStream409 ? !1 : [
|
|
1132
1126
|
Pe.MaxBatchExceeded,
|
|
1133
1127
|
Pe.MaxExpiresExceeded,
|
|
1134
1128
|
Pe.MaxBytesExceeded,
|
|
@@ -1143,17 +1137,17 @@ function ti(r, e = "") {
|
|
|
1143
1137
|
return null;
|
|
1144
1138
|
switch (e = e.toLowerCase(), r) {
|
|
1145
1139
|
case 404:
|
|
1146
|
-
return new T(e,
|
|
1140
|
+
return new T(e, k.JetStream404NoMessages);
|
|
1147
1141
|
case 408:
|
|
1148
|
-
return new T(e,
|
|
1142
|
+
return new T(e, k.JetStream408RequestTimeout);
|
|
1149
1143
|
case 409: {
|
|
1150
|
-
const t = e.startsWith(Pe.IdleHeartbeatMissed) ?
|
|
1144
|
+
const t = e.startsWith(Pe.IdleHeartbeatMissed) ? k.JetStreamIdleHeartBeat : k.JetStream409;
|
|
1151
1145
|
return new T(e, t);
|
|
1152
1146
|
}
|
|
1153
1147
|
case 503:
|
|
1154
|
-
return T.errorForCode(
|
|
1148
|
+
return T.errorForCode(k.JetStreamNotEnabled, new Error(e));
|
|
1155
1149
|
default:
|
|
1156
|
-
return e === "" && (e =
|
|
1150
|
+
return e === "" && (e = k.Unknown), new T(e, `${r}`);
|
|
1157
1151
|
}
|
|
1158
1152
|
}
|
|
1159
1153
|
class he {
|
|
@@ -1196,9 +1190,9 @@ class he {
|
|
|
1196
1190
|
}
|
|
1197
1191
|
async *iterate() {
|
|
1198
1192
|
if (this.noIterator)
|
|
1199
|
-
throw new T("unsupported iterator",
|
|
1193
|
+
throw new T("unsupported iterator", k.ApiError);
|
|
1200
1194
|
if (this.yielding)
|
|
1201
|
-
throw new T("already yielding",
|
|
1195
|
+
throw new T("already yielding", k.ApiError);
|
|
1202
1196
|
this.yielding = !0;
|
|
1203
1197
|
try {
|
|
1204
1198
|
for (; ; ) {
|
|
@@ -1307,10 +1301,10 @@ var ce;
|
|
|
1307
1301
|
(function(r) {
|
|
1308
1302
|
r.None = "none", r.All = "all", r.Explicit = "explicit", r.NotSet = "";
|
|
1309
1303
|
})(ce || (ce = {}));
|
|
1310
|
-
var
|
|
1304
|
+
var lt;
|
|
1311
1305
|
(function(r) {
|
|
1312
1306
|
r.Instant = "instant", r.Original = "original";
|
|
1313
|
-
})(
|
|
1307
|
+
})(lt || (lt = {}));
|
|
1314
1308
|
var Ve;
|
|
1315
1309
|
(function(r) {
|
|
1316
1310
|
r.None = "none", r.S2 = "s2";
|
|
@@ -1325,13 +1319,13 @@ function cn(r, e = {}) {
|
|
|
1325
1319
|
deliver_policy: se.All,
|
|
1326
1320
|
ack_policy: ce.Explicit,
|
|
1327
1321
|
ack_wait: W(30 * 1e3),
|
|
1328
|
-
replay_policy:
|
|
1322
|
+
replay_policy: lt.Instant
|
|
1329
1323
|
}, e);
|
|
1330
1324
|
}
|
|
1331
|
-
var
|
|
1325
|
+
var kr;
|
|
1332
1326
|
(function(r) {
|
|
1333
1327
|
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";
|
|
1334
|
-
})(
|
|
1328
|
+
})(kr || (kr = {}));
|
|
1335
1329
|
var ge;
|
|
1336
1330
|
(function(r) {
|
|
1337
1331
|
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";
|
|
@@ -1340,14 +1334,14 @@ var Re;
|
|
|
1340
1334
|
(function(r) {
|
|
1341
1335
|
r.LastValue = "", r.AllHistory = "history", r.UpdatesOnly = "updates";
|
|
1342
1336
|
})(Re || (Re = {}));
|
|
1343
|
-
var
|
|
1337
|
+
var it;
|
|
1344
1338
|
(function(r) {
|
|
1345
1339
|
r.Stream = "Nats-Stream", r.Sequence = "Nats-Sequence", r.TimeStamp = "Nats-Time-Stamp", r.Subject = "Nats-Subject";
|
|
1346
|
-
})(
|
|
1347
|
-
var
|
|
1340
|
+
})(it || (it = {}));
|
|
1341
|
+
var Or;
|
|
1348
1342
|
(function(r) {
|
|
1349
1343
|
r.Stream = "Nats-Stream", r.Subject = "Nats-Subject", r.Sequence = "Nats-Sequence", r.LastSequence = "Nats-Last-Sequence", r.Size = "Nats-Msg-Size";
|
|
1350
|
-
})(
|
|
1344
|
+
})(Or || (Or = {}));
|
|
1351
1345
|
const we = "KV_";
|
|
1352
1346
|
class hn {
|
|
1353
1347
|
constructor(e) {
|
|
@@ -1386,7 +1380,7 @@ class hn {
|
|
|
1386
1380
|
return this.config.deliver_subject = e, this;
|
|
1387
1381
|
}
|
|
1388
1382
|
durable(e) {
|
|
1389
|
-
return
|
|
1383
|
+
return ot(e), this.config.durable_name = e, this;
|
|
1390
1384
|
}
|
|
1391
1385
|
startSequence(e) {
|
|
1392
1386
|
if (e <= 0)
|
|
@@ -1433,10 +1427,10 @@ class hn {
|
|
|
1433
1427
|
return this.filters = this.filters || [], this.filters.push(e), this;
|
|
1434
1428
|
}
|
|
1435
1429
|
replayInstantly() {
|
|
1436
|
-
return this.config.replay_policy =
|
|
1430
|
+
return this.config.replay_policy = lt.Instant, this;
|
|
1437
1431
|
}
|
|
1438
1432
|
replayOriginal() {
|
|
1439
|
-
return this.config.replay_policy =
|
|
1433
|
+
return this.config.replay_policy = lt.Original, this;
|
|
1440
1434
|
}
|
|
1441
1435
|
sample(e) {
|
|
1442
1436
|
if (e = Math.trunc(e), e < 0 || e > 100)
|
|
@@ -1519,12 +1513,12 @@ class un {
|
|
|
1519
1513
|
return t ? Uint8Array.from(s, (i) => i.charCodeAt(0)) : s;
|
|
1520
1514
|
}
|
|
1521
1515
|
}
|
|
1522
|
-
class
|
|
1516
|
+
class ct {
|
|
1523
1517
|
static encode(e) {
|
|
1524
|
-
return
|
|
1518
|
+
return ct.toB64URLEncoding(un.encode(e));
|
|
1525
1519
|
}
|
|
1526
1520
|
static decode(e, t = !1) {
|
|
1527
|
-
return
|
|
1521
|
+
return ct.decode(ct.fromB64URLEncoding(e), t);
|
|
1528
1522
|
}
|
|
1529
1523
|
static toB64URLEncoding(e) {
|
|
1530
1524
|
return e.replace(/\+/g, "-").replace(/\//g, "_");
|
|
@@ -1533,7 +1527,7 @@ class ht {
|
|
|
1533
1527
|
return e.replace(/_/g, "/").replace(/-/g, "+");
|
|
1534
1528
|
}
|
|
1535
1529
|
}
|
|
1536
|
-
class
|
|
1530
|
+
class ft {
|
|
1537
1531
|
constructor() {
|
|
1538
1532
|
h(this, "buffers");
|
|
1539
1533
|
h(this, "byteLength");
|
|
@@ -1638,7 +1632,7 @@ function pn(r) {
|
|
|
1638
1632
|
});
|
|
1639
1633
|
}), e;
|
|
1640
1634
|
}
|
|
1641
|
-
var
|
|
1635
|
+
var Os, us = {
|
|
1642
1636
|
exports: {}
|
|
1643
1637
|
}, jr = {}, Rr = pn(ln({
|
|
1644
1638
|
__proto__: null,
|
|
@@ -1646,12 +1640,12 @@ var ks, us = {
|
|
|
1646
1640
|
}, [
|
|
1647
1641
|
jr
|
|
1648
1642
|
]));
|
|
1649
|
-
|
|
1643
|
+
Os = us, function() {
|
|
1650
1644
|
var r = "input is invalid type", e = typeof window == "object", t = e ? window : {};
|
|
1651
1645
|
t.JS_SHA256_NO_WINDOW && (e = !1);
|
|
1652
1646
|
var s = !e && typeof self == "object", i = !t.JS_SHA256_NO_NODE_JS && Ir.versions && Ir.versions.node;
|
|
1653
1647
|
i ? t = dn : s && (t = self);
|
|
1654
|
-
var n = !t.JS_SHA256_NO_COMMON_JS &&
|
|
1648
|
+
var n = !t.JS_SHA256_NO_COMMON_JS && Os.exports, o = !t.JS_SHA256_NO_ARRAY_BUFFER && typeof ArrayBuffer < "u", a = "0123456789abcdef".split(""), f = [
|
|
1655
1649
|
-2147483648,
|
|
1656
1650
|
8388608,
|
|
1657
1651
|
32768,
|
|
@@ -1897,7 +1891,7 @@ ks = us, function() {
|
|
|
1897
1891
|
}
|
|
1898
1892
|
};
|
|
1899
1893
|
var de = I();
|
|
1900
|
-
de.sha256 = de, de.sha224 = I(!0), de.sha256.hmac = ee(), de.sha224.hmac = ee(!0), n ?
|
|
1894
|
+
de.sha256 = de, de.sha224 = I(!0), de.sha256.hmac = ee(), de.sha224.hmac = ee(!0), n ? Os.exports = de : (t.sha256 = de.sha256, t.sha224 = de.sha224);
|
|
1901
1895
|
}();
|
|
1902
1896
|
us.exports;
|
|
1903
1897
|
us.exports.sha224;
|
|
@@ -1994,7 +1988,7 @@ class ri extends si {
|
|
|
1994
1988
|
super(t, s, n);
|
|
1995
1989
|
h(this, "deferred");
|
|
1996
1990
|
h(this, "timer");
|
|
1997
|
-
this.deferred = Y(), this.timer =
|
|
1991
|
+
this.deferred = Y(), this.timer = ut(i.timeout, n);
|
|
1998
1992
|
}
|
|
1999
1993
|
resolver(t, s) {
|
|
2000
1994
|
this.timer && this.timer.cancel(), t ? (this.ctx && (t.stack += `
|
|
@@ -2002,7 +1996,7 @@ class ri extends si {
|
|
|
2002
1996
|
${this.ctx.stack}`), this.deferred.reject(t)) : this.deferred.resolve(s), this.cancel();
|
|
2003
1997
|
}
|
|
2004
1998
|
cancel(t) {
|
|
2005
|
-
this.timer && this.timer.cancel(), this.mux.cancel(this), this.deferred.reject(t || T.errorForCode(
|
|
1999
|
+
this.timer && this.timer.cancel(), this.mux.cancel(this), this.deferred.reject(t || T.errorForCode(k.Cancelled));
|
|
2006
2000
|
}
|
|
2007
2001
|
}
|
|
2008
2002
|
const vn = "$JS.API";
|
|
@@ -2019,7 +2013,7 @@ class Tt {
|
|
|
2019
2013
|
h(this, "prefix");
|
|
2020
2014
|
h(this, "timeout");
|
|
2021
2015
|
h(this, "jc");
|
|
2022
|
-
this.nc = e, this.opts = En(t), this._parseOpts(), this.prefix = this.opts.apiPrefix, this.timeout = this.opts.timeout, this.jc =
|
|
2016
|
+
this.nc = e, this.opts = En(t), this._parseOpts(), this.prefix = this.opts.apiPrefix, this.timeout = this.opts.timeout, this.jc = Oe();
|
|
2023
2017
|
}
|
|
2024
2018
|
getOptions() {
|
|
2025
2019
|
return Object.assign({}, this.opts);
|
|
@@ -2043,8 +2037,8 @@ class Tt {
|
|
|
2043
2037
|
return this.parseJsResponse(f);
|
|
2044
2038
|
} catch (f) {
|
|
2045
2039
|
const p = f;
|
|
2046
|
-
if ((p.code === "503" || p.code ===
|
|
2047
|
-
await
|
|
2040
|
+
if ((p.code === "503" || p.code === k.Timeout) && a + 1 < n)
|
|
2041
|
+
await dt(o.backoff(a));
|
|
2048
2042
|
else
|
|
2049
2043
|
throw f;
|
|
2050
2044
|
}
|
|
@@ -2125,7 +2119,7 @@ class At {
|
|
|
2125
2119
|
}
|
|
2126
2120
|
}
|
|
2127
2121
|
}
|
|
2128
|
-
function
|
|
2122
|
+
function Ze(r = "") {
|
|
2129
2123
|
const e = r.match(/(\d+).(\d+).(\d+)/);
|
|
2130
2124
|
if (e)
|
|
2131
2125
|
return {
|
|
@@ -2159,14 +2153,14 @@ class An {
|
|
|
2159
2153
|
return this.disabled.indexOf(e) !== -1;
|
|
2160
2154
|
}
|
|
2161
2155
|
update(e) {
|
|
2162
|
-
typeof e == "string" && (e =
|
|
2156
|
+
typeof e == "string" && (e = Ze(e)), this.server = e, this.set(H.JS_KV, "2.6.2"), this.set(H.JS_OBJECTSTORE, "2.6.3"), this.set(H.JS_PULL_MAX_BYTES, "2.8.3"), this.set(H.JS_NEW_CONSUMER_CREATE_API, "2.9.0"), this.set(H.JS_ALLOW_DIRECT, "2.9.0"), this.set(H.JS_MULTIPLE_CONSUMER_FILTER, "2.10.0"), this.set(H.JS_SIMPLIFICATION, "2.9.4"), this.set(H.JS_STREAM_CONSUMER_METADATA, "2.10.0"), this.set(H.JS_CONSUMER_FILTER_SUBJECTS, "2.10.0"), this.set(H.JS_STREAM_FIRST_SEQ, "2.10.0"), this.set(H.JS_STREAM_SUBJECT_TRANSFORM, "2.10.0"), this.set(H.JS_STREAM_SOURCE_SUBJECT_TRANSFORM, "2.10.0"), this.set(H.JS_STREAM_COMPRESSION, "2.10.0"), this.set(H.JS_DEFAULT_CONSUMER_LIMITS, "2.10.0"), this.set(H.JS_BATCH_DIRECT_GET, "2.11.0"), this.disabled.forEach((t) => {
|
|
2163
2157
|
this.features.delete(t);
|
|
2164
2158
|
});
|
|
2165
2159
|
}
|
|
2166
2160
|
set(e, t) {
|
|
2167
2161
|
this.features.set(e, {
|
|
2168
2162
|
min: t,
|
|
2169
|
-
ok: Ds(this.server,
|
|
2163
|
+
ok: Ds(this.server, Ze(t)) >= 0
|
|
2170
2164
|
});
|
|
2171
2165
|
}
|
|
2172
2166
|
get(e) {
|
|
@@ -2180,7 +2174,7 @@ class An {
|
|
|
2180
2174
|
return ((t = this.get(e)) == null ? void 0 : t.ok) || !1;
|
|
2181
2175
|
}
|
|
2182
2176
|
require(e) {
|
|
2183
|
-
return typeof e == "string" && (e =
|
|
2177
|
+
return typeof e == "string" && (e = Ze(e)), Ds(this.server, e) >= 0;
|
|
2184
2178
|
}
|
|
2185
2179
|
}
|
|
2186
2180
|
class rs extends Tt {
|
|
@@ -2193,7 +2187,7 @@ class rs extends Tt {
|
|
|
2193
2187
|
if (t.deliver_group && t.idle_heartbeat)
|
|
2194
2188
|
throw new Error("jetstream idle heartbeat is not supported with queue groups");
|
|
2195
2189
|
const i = {};
|
|
2196
|
-
i.config = t, i.stream_name = e, i.action = s, i.config.durable_name &&
|
|
2190
|
+
i.config = t, i.stream_name = e, i.action = s, i.config.durable_name && ot(i.config.durable_name);
|
|
2197
2191
|
const n = this.nc;
|
|
2198
2192
|
let { min: o, ok: a } = n.features.get(H.JS_NEW_CONSUMER_CREATE_API);
|
|
2199
2193
|
const f = t.name === "" ? void 0 : t.name;
|
|
@@ -2230,10 +2224,10 @@ class rs extends Tt {
|
|
|
2230
2224
|
return this.add(e, Object.assign(i.config, n), ss.Update);
|
|
2231
2225
|
}
|
|
2232
2226
|
async info(e, t) {
|
|
2233
|
-
return pe(e),
|
|
2227
|
+
return pe(e), ot(t), await this._request(`${this.prefix}.CONSUMER.INFO.${e}.${t}`);
|
|
2234
2228
|
}
|
|
2235
2229
|
async delete(e, t) {
|
|
2236
|
-
return pe(e),
|
|
2230
|
+
return pe(e), ot(t), (await this._request(`${this.prefix}.CONSUMER.DELETE.${e}.${t}`)).success;
|
|
2237
2231
|
}
|
|
2238
2232
|
list(e) {
|
|
2239
2233
|
pe(e);
|
|
@@ -2250,11 +2244,11 @@ class rs extends Tt {
|
|
|
2250
2244
|
return this.pause(e, t, /* @__PURE__ */ new Date(0));
|
|
2251
2245
|
}
|
|
2252
2246
|
}
|
|
2253
|
-
function
|
|
2247
|
+
function rt(r, e, t = !1) {
|
|
2254
2248
|
if (t === !0 && !r)
|
|
2255
|
-
throw T.errorForCode(
|
|
2249
|
+
throw T.errorForCode(k.ApiError, new Error(`${e} is not a function`));
|
|
2256
2250
|
if (r && typeof r != "function")
|
|
2257
|
-
throw T.errorForCode(
|
|
2251
|
+
throw T.errorForCode(k.ApiError, new Error(`${e} is not a function`));
|
|
2258
2252
|
}
|
|
2259
2253
|
class Pn extends he {
|
|
2260
2254
|
constructor(t, s, i) {
|
|
@@ -2262,7 +2256,7 @@ class Pn extends he {
|
|
|
2262
2256
|
h(this, "sub");
|
|
2263
2257
|
h(this, "adapter");
|
|
2264
2258
|
h(this, "subIterDone");
|
|
2265
|
-
|
|
2259
|
+
rt(i.adapter, "adapter", !0), this.adapter = i.adapter, i.callback && rt(i.callback, "callback"), this.noIterator = typeof i.callback == "function", i.ingestionFilterFn && (rt(i.ingestionFilterFn, "ingestionFilterFn"), this.ingestionFilterFn = i.ingestionFilterFn), i.protocolFilterFn && (rt(i.protocolFilterFn, "protocolFilterFn"), this.protocolFilterFn = i.protocolFilterFn), i.dispatchedFn && (rt(i.dispatchedFn, "dispatchedFn"), this.dispatchedFn = i.dispatchedFn), i.cleanupFn && rt(i.cleanupFn, "cleanupFn");
|
|
2266
2260
|
let n = (g, y) => {
|
|
2267
2261
|
this.callback(g, y);
|
|
2268
2262
|
};
|
|
@@ -2338,7 +2332,7 @@ class Pn extends he {
|
|
|
2338
2332
|
}
|
|
2339
2333
|
}
|
|
2340
2334
|
let Se;
|
|
2341
|
-
function
|
|
2335
|
+
function kn(r) {
|
|
2342
2336
|
Se = r;
|
|
2343
2337
|
}
|
|
2344
2338
|
function ii() {
|
|
@@ -2347,7 +2341,7 @@ function ii() {
|
|
|
2347
2341
|
function Cs() {
|
|
2348
2342
|
return Se !== void 0 && Se.urlParseFn ? Se.urlParseFn : void 0;
|
|
2349
2343
|
}
|
|
2350
|
-
function
|
|
2344
|
+
function On() {
|
|
2351
2345
|
if (!Se || typeof Se.factory != "function")
|
|
2352
2346
|
throw new Error("transport fn is not set");
|
|
2353
2347
|
return Se.factory();
|
|
@@ -2356,7 +2350,7 @@ function Hs() {
|
|
|
2356
2350
|
return Se !== void 0 && Se.dnsResolveFn ? Se.dnsResolveFn : void 0;
|
|
2357
2351
|
}
|
|
2358
2352
|
const Yt = `\r
|
|
2359
|
-
`, is =
|
|
2353
|
+
`, is = ft.fromAscii(Yt), Cn = new Uint8Array(is)[0], In = new Uint8Array(is)[1];
|
|
2360
2354
|
function jn(r) {
|
|
2361
2355
|
for (let e = 0; e < r.length; e++) {
|
|
2362
2356
|
const t = e + 1;
|
|
@@ -2538,7 +2532,7 @@ function Hn(r) {
|
|
|
2538
2532
|
port: t
|
|
2539
2533
|
};
|
|
2540
2534
|
}
|
|
2541
|
-
class
|
|
2535
|
+
class Ot {
|
|
2542
2536
|
constructor(e, t = !1) {
|
|
2543
2537
|
h(this, "src");
|
|
2544
2538
|
h(this, "listen");
|
|
@@ -2573,7 +2567,7 @@ class kt {
|
|
|
2573
2567
|
for (const i of s) {
|
|
2574
2568
|
const n = this.port === 80 ? "https" : "http", o = new URL(`${n}://${Ks(i) ? "[" + i + "]" : i}`);
|
|
2575
2569
|
o.port = `${this.port}`;
|
|
2576
|
-
const a = new
|
|
2570
|
+
const a = new Ot(o.host, !1);
|
|
2577
2571
|
a.tlsName = this.hostname, t.push(a);
|
|
2578
2572
|
}
|
|
2579
2573
|
}
|
|
@@ -2590,7 +2584,7 @@ class Jn {
|
|
|
2590
2584
|
this.firstSelect = !0, this.servers = [], this.tlsName = "", this.randomize = t.randomize || !1;
|
|
2591
2585
|
const s = Cs();
|
|
2592
2586
|
e && (e.forEach((i) => {
|
|
2593
|
-
i = s ? s(i) : i, this.servers.push(new
|
|
2587
|
+
i = s ? s(i) : i, this.servers.push(new Ot(i));
|
|
2594
2588
|
}), this.randomize && (this.servers = Qr(this.servers))), this.servers.length === 0 && this.addServer(`${Ms}:${ii()}`, !1), this.currentServer = this.servers[0];
|
|
2595
2589
|
}
|
|
2596
2590
|
clear() {
|
|
@@ -2608,7 +2602,7 @@ class Jn {
|
|
|
2608
2602
|
addServer(e, t = !1) {
|
|
2609
2603
|
const s = Cs();
|
|
2610
2604
|
e = s ? s(e) : e;
|
|
2611
|
-
const i = new
|
|
2605
|
+
const i = new Ot(e, t);
|
|
2612
2606
|
Js(i.hostname) && (i.tlsName = this.tlsName), this.servers.push(i);
|
|
2613
2607
|
}
|
|
2614
2608
|
selectServer() {
|
|
@@ -2641,7 +2635,7 @@ class Jn {
|
|
|
2641
2635
|
const n = Cs(), o = /* @__PURE__ */ new Map();
|
|
2642
2636
|
e.connect_urls && e.connect_urls.length > 0 && e.connect_urls.forEach((f) => {
|
|
2643
2637
|
f = n ? n(f, t) : f;
|
|
2644
|
-
const p = new
|
|
2638
|
+
const p = new Ot(f, !0);
|
|
2645
2639
|
o.set(f, p);
|
|
2646
2640
|
});
|
|
2647
2641
|
const a = [];
|
|
@@ -2712,7 +2706,7 @@ class Kn {
|
|
|
2712
2706
|
};
|
|
2713
2707
|
}
|
|
2714
2708
|
close() {
|
|
2715
|
-
const e = T.errorForCode(
|
|
2709
|
+
const e = T.errorForCode(k.Timeout);
|
|
2716
2710
|
this.reqs.forEach((t) => {
|
|
2717
2711
|
t.resolver(e, {});
|
|
2718
2712
|
});
|
|
@@ -2886,105 +2880,105 @@ class Ur {
|
|
|
2886
2880
|
h(this, "ma");
|
|
2887
2881
|
h(this, "argBuf");
|
|
2888
2882
|
h(this, "msgBuf");
|
|
2889
|
-
this.dispatcher = e, this.state =
|
|
2883
|
+
this.dispatcher = e, this.state = O.OP_START, this.as = 0, this.drop = 0, this.hdr = 0;
|
|
2890
2884
|
}
|
|
2891
2885
|
parse(e) {
|
|
2892
2886
|
let t;
|
|
2893
2887
|
for (t = 0; t < e.length; t++) {
|
|
2894
2888
|
const s = e[t];
|
|
2895
2889
|
switch (this.state) {
|
|
2896
|
-
case
|
|
2890
|
+
case O.OP_START:
|
|
2897
2891
|
switch (s) {
|
|
2898
2892
|
case C.M:
|
|
2899
2893
|
case C.m:
|
|
2900
|
-
this.state =
|
|
2894
|
+
this.state = O.OP_M, this.hdr = -1, this.ma = Mr();
|
|
2901
2895
|
break;
|
|
2902
2896
|
case C.H:
|
|
2903
2897
|
case C.h:
|
|
2904
|
-
this.state =
|
|
2898
|
+
this.state = O.OP_H, this.hdr = 0, this.ma = Mr();
|
|
2905
2899
|
break;
|
|
2906
2900
|
case C.P:
|
|
2907
2901
|
case C.p:
|
|
2908
|
-
this.state =
|
|
2902
|
+
this.state = O.OP_P;
|
|
2909
2903
|
break;
|
|
2910
2904
|
case C.PLUS:
|
|
2911
|
-
this.state =
|
|
2905
|
+
this.state = O.OP_PLUS;
|
|
2912
2906
|
break;
|
|
2913
2907
|
case C.MINUS:
|
|
2914
|
-
this.state =
|
|
2908
|
+
this.state = O.OP_MINUS;
|
|
2915
2909
|
break;
|
|
2916
2910
|
case C.I:
|
|
2917
2911
|
case C.i:
|
|
2918
|
-
this.state =
|
|
2912
|
+
this.state = O.OP_I;
|
|
2919
2913
|
break;
|
|
2920
2914
|
default:
|
|
2921
2915
|
throw this.fail(e.subarray(t));
|
|
2922
2916
|
}
|
|
2923
2917
|
break;
|
|
2924
|
-
case
|
|
2918
|
+
case O.OP_H:
|
|
2925
2919
|
switch (s) {
|
|
2926
2920
|
case C.M:
|
|
2927
2921
|
case C.m:
|
|
2928
|
-
this.state =
|
|
2922
|
+
this.state = O.OP_M;
|
|
2929
2923
|
break;
|
|
2930
2924
|
default:
|
|
2931
2925
|
throw this.fail(e.subarray(t));
|
|
2932
2926
|
}
|
|
2933
2927
|
break;
|
|
2934
|
-
case
|
|
2928
|
+
case O.OP_M:
|
|
2935
2929
|
switch (s) {
|
|
2936
2930
|
case C.S:
|
|
2937
2931
|
case C.s:
|
|
2938
|
-
this.state =
|
|
2932
|
+
this.state = O.OP_MS;
|
|
2939
2933
|
break;
|
|
2940
2934
|
default:
|
|
2941
2935
|
throw this.fail(e.subarray(t));
|
|
2942
2936
|
}
|
|
2943
2937
|
break;
|
|
2944
|
-
case
|
|
2938
|
+
case O.OP_MS:
|
|
2945
2939
|
switch (s) {
|
|
2946
2940
|
case C.G:
|
|
2947
2941
|
case C.g:
|
|
2948
|
-
this.state =
|
|
2942
|
+
this.state = O.OP_MSG;
|
|
2949
2943
|
break;
|
|
2950
2944
|
default:
|
|
2951
2945
|
throw this.fail(e.subarray(t));
|
|
2952
2946
|
}
|
|
2953
2947
|
break;
|
|
2954
|
-
case
|
|
2948
|
+
case O.OP_MSG:
|
|
2955
2949
|
switch (s) {
|
|
2956
2950
|
case C.SPACE:
|
|
2957
2951
|
case C.TAB:
|
|
2958
|
-
this.state =
|
|
2952
|
+
this.state = O.OP_MSG_SPC;
|
|
2959
2953
|
break;
|
|
2960
2954
|
default:
|
|
2961
2955
|
throw this.fail(e.subarray(t));
|
|
2962
2956
|
}
|
|
2963
2957
|
break;
|
|
2964
|
-
case
|
|
2958
|
+
case O.OP_MSG_SPC:
|
|
2965
2959
|
switch (s) {
|
|
2966
2960
|
case C.SPACE:
|
|
2967
2961
|
case C.TAB:
|
|
2968
2962
|
continue;
|
|
2969
2963
|
default:
|
|
2970
|
-
this.state =
|
|
2964
|
+
this.state = O.MSG_ARG, this.as = t;
|
|
2971
2965
|
}
|
|
2972
2966
|
break;
|
|
2973
|
-
case
|
|
2967
|
+
case O.MSG_ARG:
|
|
2974
2968
|
switch (s) {
|
|
2975
2969
|
case C.CR:
|
|
2976
2970
|
this.drop = 1;
|
|
2977
2971
|
break;
|
|
2978
2972
|
case C.NL: {
|
|
2979
2973
|
const i = this.argBuf ? this.argBuf.bytes() : e.subarray(this.as, t - this.drop);
|
|
2980
|
-
this.processMsgArgs(i), this.drop = 0, this.as = t + 1, this.state =
|
|
2974
|
+
this.processMsgArgs(i), this.drop = 0, this.as = t + 1, this.state = O.MSG_PAYLOAD, t = this.as + this.ma.size - 1;
|
|
2981
2975
|
break;
|
|
2982
2976
|
}
|
|
2983
2977
|
default:
|
|
2984
2978
|
this.argBuf && this.argBuf.writeByte(s);
|
|
2985
2979
|
}
|
|
2986
2980
|
break;
|
|
2987
|
-
case
|
|
2981
|
+
case O.MSG_PAYLOAD:
|
|
2988
2982
|
if (this.msgBuf)
|
|
2989
2983
|
if (this.msgBuf.length >= this.ma.size) {
|
|
2990
2984
|
const i = this.msgBuf.bytes({
|
|
@@ -2994,7 +2988,7 @@ class Ur {
|
|
|
2994
2988
|
kind: me.MSG,
|
|
2995
2989
|
msg: this.ma,
|
|
2996
2990
|
data: i
|
|
2997
|
-
}), this.argBuf = void 0, this.msgBuf = void 0, this.state =
|
|
2991
|
+
}), this.argBuf = void 0, this.msgBuf = void 0, this.state = O.MSG_END;
|
|
2998
2992
|
} else {
|
|
2999
2993
|
let i = this.ma.size - this.msgBuf.length;
|
|
3000
2994
|
const n = e.length - t;
|
|
@@ -3004,96 +2998,96 @@ class Ur {
|
|
|
3004
2998
|
kind: me.MSG,
|
|
3005
2999
|
msg: this.ma,
|
|
3006
3000
|
data: e.subarray(this.as, t)
|
|
3007
|
-
}), this.argBuf = void 0, this.msgBuf = void 0, this.state =
|
|
3001
|
+
}), this.argBuf = void 0, this.msgBuf = void 0, this.state = O.MSG_END);
|
|
3008
3002
|
break;
|
|
3009
|
-
case
|
|
3003
|
+
case O.MSG_END:
|
|
3010
3004
|
switch (s) {
|
|
3011
3005
|
case C.NL:
|
|
3012
|
-
this.drop = 0, this.as = t + 1, this.state =
|
|
3006
|
+
this.drop = 0, this.as = t + 1, this.state = O.OP_START;
|
|
3013
3007
|
break;
|
|
3014
3008
|
default:
|
|
3015
3009
|
continue;
|
|
3016
3010
|
}
|
|
3017
3011
|
break;
|
|
3018
|
-
case
|
|
3012
|
+
case O.OP_PLUS:
|
|
3019
3013
|
switch (s) {
|
|
3020
3014
|
case C.O:
|
|
3021
3015
|
case C.o:
|
|
3022
|
-
this.state =
|
|
3016
|
+
this.state = O.OP_PLUS_O;
|
|
3023
3017
|
break;
|
|
3024
3018
|
default:
|
|
3025
3019
|
throw this.fail(e.subarray(t));
|
|
3026
3020
|
}
|
|
3027
3021
|
break;
|
|
3028
|
-
case
|
|
3022
|
+
case O.OP_PLUS_O:
|
|
3029
3023
|
switch (s) {
|
|
3030
3024
|
case C.K:
|
|
3031
3025
|
case C.k:
|
|
3032
|
-
this.state =
|
|
3026
|
+
this.state = O.OP_PLUS_OK;
|
|
3033
3027
|
break;
|
|
3034
3028
|
default:
|
|
3035
3029
|
throw this.fail(e.subarray(t));
|
|
3036
3030
|
}
|
|
3037
3031
|
break;
|
|
3038
|
-
case
|
|
3032
|
+
case O.OP_PLUS_OK:
|
|
3039
3033
|
switch (s) {
|
|
3040
3034
|
case C.NL:
|
|
3041
3035
|
this.dispatcher.push({
|
|
3042
3036
|
kind: me.OK
|
|
3043
|
-
}), this.drop = 0, this.state =
|
|
3037
|
+
}), this.drop = 0, this.state = O.OP_START;
|
|
3044
3038
|
break;
|
|
3045
3039
|
}
|
|
3046
3040
|
break;
|
|
3047
|
-
case
|
|
3041
|
+
case O.OP_MINUS:
|
|
3048
3042
|
switch (s) {
|
|
3049
3043
|
case C.E:
|
|
3050
3044
|
case C.e:
|
|
3051
|
-
this.state =
|
|
3045
|
+
this.state = O.OP_MINUS_E;
|
|
3052
3046
|
break;
|
|
3053
3047
|
default:
|
|
3054
3048
|
throw this.fail(e.subarray(t));
|
|
3055
3049
|
}
|
|
3056
3050
|
break;
|
|
3057
|
-
case
|
|
3051
|
+
case O.OP_MINUS_E:
|
|
3058
3052
|
switch (s) {
|
|
3059
3053
|
case C.R:
|
|
3060
3054
|
case C.r:
|
|
3061
|
-
this.state =
|
|
3055
|
+
this.state = O.OP_MINUS_ER;
|
|
3062
3056
|
break;
|
|
3063
3057
|
default:
|
|
3064
3058
|
throw this.fail(e.subarray(t));
|
|
3065
3059
|
}
|
|
3066
3060
|
break;
|
|
3067
|
-
case
|
|
3061
|
+
case O.OP_MINUS_ER:
|
|
3068
3062
|
switch (s) {
|
|
3069
3063
|
case C.R:
|
|
3070
3064
|
case C.r:
|
|
3071
|
-
this.state =
|
|
3065
|
+
this.state = O.OP_MINUS_ERR;
|
|
3072
3066
|
break;
|
|
3073
3067
|
default:
|
|
3074
3068
|
throw this.fail(e.subarray(t));
|
|
3075
3069
|
}
|
|
3076
3070
|
break;
|
|
3077
|
-
case
|
|
3071
|
+
case O.OP_MINUS_ERR:
|
|
3078
3072
|
switch (s) {
|
|
3079
3073
|
case C.SPACE:
|
|
3080
3074
|
case C.TAB:
|
|
3081
|
-
this.state =
|
|
3075
|
+
this.state = O.OP_MINUS_ERR_SPC;
|
|
3082
3076
|
break;
|
|
3083
3077
|
default:
|
|
3084
3078
|
throw this.fail(e.subarray(t));
|
|
3085
3079
|
}
|
|
3086
3080
|
break;
|
|
3087
|
-
case
|
|
3081
|
+
case O.OP_MINUS_ERR_SPC:
|
|
3088
3082
|
switch (s) {
|
|
3089
3083
|
case C.SPACE:
|
|
3090
3084
|
case C.TAB:
|
|
3091
3085
|
continue;
|
|
3092
3086
|
default:
|
|
3093
|
-
this.state =
|
|
3087
|
+
this.state = O.MINUS_ERR_ARG, this.as = t;
|
|
3094
3088
|
}
|
|
3095
3089
|
break;
|
|
3096
|
-
case
|
|
3090
|
+
case O.MINUS_ERR_ARG:
|
|
3097
3091
|
switch (s) {
|
|
3098
3092
|
case C.CR:
|
|
3099
3093
|
this.drop = 1;
|
|
@@ -3103,135 +3097,135 @@ class Ur {
|
|
|
3103
3097
|
this.argBuf ? (i = this.argBuf.bytes(), this.argBuf = void 0) : i = e.subarray(this.as, t - this.drop), this.dispatcher.push({
|
|
3104
3098
|
kind: me.ERR,
|
|
3105
3099
|
data: i
|
|
3106
|
-
}), this.drop = 0, this.as = t + 1, this.state =
|
|
3100
|
+
}), this.drop = 0, this.as = t + 1, this.state = O.OP_START;
|
|
3107
3101
|
break;
|
|
3108
3102
|
}
|
|
3109
3103
|
default:
|
|
3110
3104
|
this.argBuf && this.argBuf.write(Uint8Array.of(s));
|
|
3111
3105
|
}
|
|
3112
3106
|
break;
|
|
3113
|
-
case
|
|
3107
|
+
case O.OP_P:
|
|
3114
3108
|
switch (s) {
|
|
3115
3109
|
case C.I:
|
|
3116
3110
|
case C.i:
|
|
3117
|
-
this.state =
|
|
3111
|
+
this.state = O.OP_PI;
|
|
3118
3112
|
break;
|
|
3119
3113
|
case C.O:
|
|
3120
3114
|
case C.o:
|
|
3121
|
-
this.state =
|
|
3115
|
+
this.state = O.OP_PO;
|
|
3122
3116
|
break;
|
|
3123
3117
|
default:
|
|
3124
3118
|
throw this.fail(e.subarray(t));
|
|
3125
3119
|
}
|
|
3126
3120
|
break;
|
|
3127
|
-
case
|
|
3121
|
+
case O.OP_PO:
|
|
3128
3122
|
switch (s) {
|
|
3129
3123
|
case C.N:
|
|
3130
3124
|
case C.n:
|
|
3131
|
-
this.state =
|
|
3125
|
+
this.state = O.OP_PON;
|
|
3132
3126
|
break;
|
|
3133
3127
|
default:
|
|
3134
3128
|
throw this.fail(e.subarray(t));
|
|
3135
3129
|
}
|
|
3136
3130
|
break;
|
|
3137
|
-
case
|
|
3131
|
+
case O.OP_PON:
|
|
3138
3132
|
switch (s) {
|
|
3139
3133
|
case C.G:
|
|
3140
3134
|
case C.g:
|
|
3141
|
-
this.state =
|
|
3135
|
+
this.state = O.OP_PONG;
|
|
3142
3136
|
break;
|
|
3143
3137
|
default:
|
|
3144
3138
|
throw this.fail(e.subarray(t));
|
|
3145
3139
|
}
|
|
3146
3140
|
break;
|
|
3147
|
-
case
|
|
3141
|
+
case O.OP_PONG:
|
|
3148
3142
|
switch (s) {
|
|
3149
3143
|
case C.NL:
|
|
3150
3144
|
this.dispatcher.push({
|
|
3151
3145
|
kind: me.PONG
|
|
3152
|
-
}), this.drop = 0, this.state =
|
|
3146
|
+
}), this.drop = 0, this.state = O.OP_START;
|
|
3153
3147
|
break;
|
|
3154
3148
|
}
|
|
3155
3149
|
break;
|
|
3156
|
-
case
|
|
3150
|
+
case O.OP_PI:
|
|
3157
3151
|
switch (s) {
|
|
3158
3152
|
case C.N:
|
|
3159
3153
|
case C.n:
|
|
3160
|
-
this.state =
|
|
3154
|
+
this.state = O.OP_PIN;
|
|
3161
3155
|
break;
|
|
3162
3156
|
default:
|
|
3163
3157
|
throw this.fail(e.subarray(t));
|
|
3164
3158
|
}
|
|
3165
3159
|
break;
|
|
3166
|
-
case
|
|
3160
|
+
case O.OP_PIN:
|
|
3167
3161
|
switch (s) {
|
|
3168
3162
|
case C.G:
|
|
3169
3163
|
case C.g:
|
|
3170
|
-
this.state =
|
|
3164
|
+
this.state = O.OP_PING;
|
|
3171
3165
|
break;
|
|
3172
3166
|
default:
|
|
3173
3167
|
throw this.fail(e.subarray(t));
|
|
3174
3168
|
}
|
|
3175
3169
|
break;
|
|
3176
|
-
case
|
|
3170
|
+
case O.OP_PING:
|
|
3177
3171
|
switch (s) {
|
|
3178
3172
|
case C.NL:
|
|
3179
3173
|
this.dispatcher.push({
|
|
3180
3174
|
kind: me.PING
|
|
3181
|
-
}), this.drop = 0, this.state =
|
|
3175
|
+
}), this.drop = 0, this.state = O.OP_START;
|
|
3182
3176
|
break;
|
|
3183
3177
|
}
|
|
3184
3178
|
break;
|
|
3185
|
-
case
|
|
3179
|
+
case O.OP_I:
|
|
3186
3180
|
switch (s) {
|
|
3187
3181
|
case C.N:
|
|
3188
3182
|
case C.n:
|
|
3189
|
-
this.state =
|
|
3183
|
+
this.state = O.OP_IN;
|
|
3190
3184
|
break;
|
|
3191
3185
|
default:
|
|
3192
3186
|
throw this.fail(e.subarray(t));
|
|
3193
3187
|
}
|
|
3194
3188
|
break;
|
|
3195
|
-
case
|
|
3189
|
+
case O.OP_IN:
|
|
3196
3190
|
switch (s) {
|
|
3197
3191
|
case C.F:
|
|
3198
3192
|
case C.f:
|
|
3199
|
-
this.state =
|
|
3193
|
+
this.state = O.OP_INF;
|
|
3200
3194
|
break;
|
|
3201
3195
|
default:
|
|
3202
3196
|
throw this.fail(e.subarray(t));
|
|
3203
3197
|
}
|
|
3204
3198
|
break;
|
|
3205
|
-
case
|
|
3199
|
+
case O.OP_INF:
|
|
3206
3200
|
switch (s) {
|
|
3207
3201
|
case C.O:
|
|
3208
3202
|
case C.o:
|
|
3209
|
-
this.state =
|
|
3203
|
+
this.state = O.OP_INFO;
|
|
3210
3204
|
break;
|
|
3211
3205
|
default:
|
|
3212
3206
|
throw this.fail(e.subarray(t));
|
|
3213
3207
|
}
|
|
3214
3208
|
break;
|
|
3215
|
-
case
|
|
3209
|
+
case O.OP_INFO:
|
|
3216
3210
|
switch (s) {
|
|
3217
3211
|
case C.SPACE:
|
|
3218
3212
|
case C.TAB:
|
|
3219
|
-
this.state =
|
|
3213
|
+
this.state = O.OP_INFO_SPC;
|
|
3220
3214
|
break;
|
|
3221
3215
|
default:
|
|
3222
3216
|
throw this.fail(e.subarray(t));
|
|
3223
3217
|
}
|
|
3224
3218
|
break;
|
|
3225
|
-
case
|
|
3219
|
+
case O.OP_INFO_SPC:
|
|
3226
3220
|
switch (s) {
|
|
3227
3221
|
case C.SPACE:
|
|
3228
3222
|
case C.TAB:
|
|
3229
3223
|
continue;
|
|
3230
3224
|
default:
|
|
3231
|
-
this.state =
|
|
3225
|
+
this.state = O.INFO_ARG, this.as = t;
|
|
3232
3226
|
}
|
|
3233
3227
|
break;
|
|
3234
|
-
case
|
|
3228
|
+
case O.INFO_ARG:
|
|
3235
3229
|
switch (s) {
|
|
3236
3230
|
case C.CR:
|
|
3237
3231
|
this.drop = 1;
|
|
@@ -3241,7 +3235,7 @@ class Ur {
|
|
|
3241
3235
|
this.argBuf ? (i = this.argBuf.bytes(), this.argBuf = void 0) : i = e.subarray(this.as, t - this.drop), this.dispatcher.push({
|
|
3242
3236
|
kind: me.INFO,
|
|
3243
3237
|
data: i
|
|
3244
|
-
}), this.drop = 0, this.as = t + 1, this.state =
|
|
3238
|
+
}), this.drop = 0, this.as = t + 1, this.state = O.OP_START;
|
|
3245
3239
|
break;
|
|
3246
3240
|
}
|
|
3247
3241
|
default:
|
|
@@ -3252,7 +3246,7 @@ class Ur {
|
|
|
3252
3246
|
throw this.fail(e.subarray(t));
|
|
3253
3247
|
}
|
|
3254
3248
|
}
|
|
3255
|
-
(this.state ===
|
|
3249
|
+
(this.state === O.MSG_ARG || this.state === O.MINUS_ERR_ARG || this.state === O.INFO_ARG) && !this.argBuf && (this.argBuf = new js(e.subarray(this.as, t - this.drop))), this.state === O.MSG_PAYLOAD && !this.msgBuf && (this.argBuf || this.cloneMsgArg(), this.msgBuf = new js(e.subarray(this.as)));
|
|
3256
3250
|
}
|
|
3257
3251
|
cloneMsgArg() {
|
|
3258
3252
|
const e = this.ma.subject.length, t = this.ma.reply ? this.ma.reply.length : 0, s = new Uint8Array(e + t);
|
|
@@ -3335,10 +3329,10 @@ class Ur {
|
|
|
3335
3329
|
return t;
|
|
3336
3330
|
}
|
|
3337
3331
|
}
|
|
3338
|
-
var
|
|
3332
|
+
var O;
|
|
3339
3333
|
(function(r) {
|
|
3340
3334
|
r[r.OP_START = 0] = "OP_START", r[r.OP_PLUS = 1] = "OP_PLUS", r[r.OP_PLUS_O = 2] = "OP_PLUS_O", r[r.OP_PLUS_OK = 3] = "OP_PLUS_OK", r[r.OP_MINUS = 4] = "OP_MINUS", r[r.OP_MINUS_E = 5] = "OP_MINUS_E", r[r.OP_MINUS_ER = 6] = "OP_MINUS_ER", r[r.OP_MINUS_ERR = 7] = "OP_MINUS_ERR", r[r.OP_MINUS_ERR_SPC = 8] = "OP_MINUS_ERR_SPC", r[r.MINUS_ERR_ARG = 9] = "MINUS_ERR_ARG", r[r.OP_M = 10] = "OP_M", r[r.OP_MS = 11] = "OP_MS", r[r.OP_MSG = 12] = "OP_MSG", r[r.OP_MSG_SPC = 13] = "OP_MSG_SPC", r[r.MSG_ARG = 14] = "MSG_ARG", r[r.MSG_PAYLOAD = 15] = "MSG_PAYLOAD", r[r.MSG_END = 16] = "MSG_END", r[r.OP_H = 17] = "OP_H", r[r.OP_P = 18] = "OP_P", r[r.OP_PI = 19] = "OP_PI", r[r.OP_PIN = 20] = "OP_PIN", r[r.OP_PING = 21] = "OP_PING", r[r.OP_PO = 22] = "OP_PO", r[r.OP_PON = 23] = "OP_PON", r[r.OP_PONG = 24] = "OP_PONG", r[r.OP_I = 25] = "OP_I", r[r.OP_IN = 26] = "OP_IN", r[r.OP_INF = 27] = "OP_INF", r[r.OP_INFO = 28] = "OP_INFO", r[r.OP_INFO_SPC = 29] = "OP_INFO_SPC", r[r.INFO_ARG = 30] = "INFO_ARG";
|
|
3341
|
-
})(
|
|
3335
|
+
})(O || (O = {}));
|
|
3342
3336
|
var C;
|
|
3343
3337
|
(function(r) {
|
|
3344
3338
|
r[r.CR = 13] = "CR", r[r.E = 69] = "E", r[r.e = 101] = "e", r[r.F = 70] = "F", r[r.f = 102] = "f", r[r.G = 71] = "G", r[r.g = 103] = "g", r[r.H = 72] = "H", r[r.h = 104] = "h", r[r.I = 73] = "I", r[r.i = 105] = "i", r[r.K = 75] = "K", r[r.k = 107] = "k", r[r.M = 77] = "M", r[r.m = 109] = "m", r[r.MINUS = 45] = "MINUS", r[r.N = 78] = "N", r[r.n = 110] = "n", r[r.NL = 10] = "NL", r[r.O = 79] = "O", r[r.o = 111] = "o", r[r.P = 80] = "P", r[r.p = 112] = "p", r[r.PLUS = 43] = "PLUS", r[r.R = 82] = "R", r[r.r = 114] = "r", r[r.S = 83] = "S", r[r.s = 115] = "s", r[r.SPACE = 32] = "SPACE", r[r.TAB = 9] = "TAB";
|
|
@@ -3571,7 +3565,7 @@ var C;
|
|
|
3571
3565
|
252
|
|
3572
3566
|
]);
|
|
3573
3567
|
function ie(c, l, u, d, m, b) {
|
|
3574
|
-
var v, E, _, S, M = new Uint32Array(17), D = new Uint32Array(17), Z = new Uint32Array(17), je = new Uint32Array(17),
|
|
3568
|
+
var v, E, _, S, M = new Uint32Array(17), D = new Uint32Array(17), Z = new Uint32Array(17), je = new Uint32Array(17), st = new Uint32Array(17);
|
|
3575
3569
|
for (_ = 0; _ < 17; _++) D[_] = Z[_] = 0;
|
|
3576
3570
|
for (_ = 0; _ < 16; _++) D[_] = b[_];
|
|
3577
3571
|
for (D[3] &= 15, D[4] &= 252, D[7] &= 15, D[8] &= 252, D[11] &= 15, D[12] &= 252, D[15] &= 15; m > 0; ) {
|
|
@@ -3586,8 +3580,8 @@ var C;
|
|
|
3586
3580
|
S = S + Z[_] | 0, Z[_] = S & 255, S >>>= 8;
|
|
3587
3581
|
S = S + Z[16] | 0, Z[16] = S;
|
|
3588
3582
|
}
|
|
3589
|
-
for (_ = 0; _ < 17; _++)
|
|
3590
|
-
for (re(Z, ne), v = -(Z[16] >>> 7) | 0, _ = 0; _ < 17; _++) Z[_] ^= v & (
|
|
3583
|
+
for (_ = 0; _ < 17; _++) st[_] = Z[_];
|
|
3584
|
+
for (re(Z, ne), v = -(Z[16] >>> 7) | 0, _ = 0; _ < 17; _++) Z[_] ^= v & (st[_] ^ Z[_]);
|
|
3591
3585
|
for (_ = 0; _ < 16; _++) je[_] = b[_ + 16];
|
|
3592
3586
|
for (je[16] = 0, re(Z, je), _ = 0; _ < 16; _++) c[l + _] = Z[_];
|
|
3593
3587
|
return 0;
|
|
@@ -3621,7 +3615,7 @@ var C;
|
|
|
3621
3615
|
for (var d, m = ~(u - 1), b = 0; b < 16; b++)
|
|
3622
3616
|
d = m & (c[b] ^ l[b]), c[b] ^= d, l[b] ^= d;
|
|
3623
3617
|
}
|
|
3624
|
-
function
|
|
3618
|
+
function Qe(c, l) {
|
|
3625
3619
|
var u, d, m, b = t(), v = t();
|
|
3626
3620
|
for (u = 0; u < 16; u++) v[u] = l[u];
|
|
3627
3621
|
for (te(v), te(v), te(v), d = 0; d < 2; d++) {
|
|
@@ -3634,11 +3628,11 @@ var C;
|
|
|
3634
3628
|
}
|
|
3635
3629
|
function nr(c, l) {
|
|
3636
3630
|
var u = new Uint8Array(32), d = new Uint8Array(32);
|
|
3637
|
-
return
|
|
3631
|
+
return Qe(u, c), Qe(d, l), w(u, 0, d, 0);
|
|
3638
3632
|
}
|
|
3639
3633
|
function or(c) {
|
|
3640
3634
|
var l = new Uint8Array(32);
|
|
3641
|
-
return
|
|
3635
|
+
return Qe(l, c), l[0] & 1;
|
|
3642
3636
|
}
|
|
3643
3637
|
function ds(c, l) {
|
|
3644
3638
|
var u;
|
|
@@ -3690,8 +3684,8 @@ var C;
|
|
|
3690
3684
|
b = d[v >>> 3] >>> (v & 7) & 1, ae(E, _, b), ae(S, M, b), Ce(D, E, S), Ie(E, E, S), Ce(S, _, M), Ie(_, _, M), Ee(M, D), Ee(Z, E), B(E, S, E), B(S, _, D), Ce(D, E, S), Ie(E, E, S), Ee(_, E), Ie(S, M, Z), B(E, S, f), Ce(E, E, M), B(S, S, E), B(E, M, Z), B(M, _, m), Ee(_, D), ae(E, _, b), ae(S, M, b);
|
|
3691
3685
|
for (v = 0; v < 16; v++)
|
|
3692
3686
|
m[v + 16] = E[v], m[v + 32] = S[v], m[v + 48] = _[v], m[v + 64] = M[v];
|
|
3693
|
-
var je = m.subarray(32),
|
|
3694
|
-
return ar(je, je), B(
|
|
3687
|
+
var je = m.subarray(32), st = m.subarray(16);
|
|
3688
|
+
return ar(je, je), B(st, st, je), Qe(c, st), 0;
|
|
3695
3689
|
}
|
|
3696
3690
|
function $t(c, l) {
|
|
3697
3691
|
return Ut(c, l, n);
|
|
@@ -3712,7 +3706,7 @@ var C;
|
|
|
3712
3706
|
var v = new Uint8Array(32);
|
|
3713
3707
|
return Lt(v, m, b), wi(c, l, u, d, v);
|
|
3714
3708
|
}
|
|
3715
|
-
function
|
|
3709
|
+
function pt() {
|
|
3716
3710
|
var c = 0, l = 0, u = 0, d = 0, m = 65535, b, v, E;
|
|
3717
3711
|
for (E = 0; E < arguments.length; E++)
|
|
3718
3712
|
b = arguments[E].lo, v = arguments[E].hi, c += b & m, l += b >>> 16, u += v & m, d += v >>> 16;
|
|
@@ -3745,10 +3739,10 @@ var C;
|
|
|
3745
3739
|
function Pi(c) {
|
|
3746
3740
|
return qt(Te(c, 14), Te(c, 18), Te(c, 41));
|
|
3747
3741
|
}
|
|
3748
|
-
function
|
|
3742
|
+
function ki(c) {
|
|
3749
3743
|
return qt(Te(c, 1), Te(c, 8), lr(c, 7));
|
|
3750
3744
|
}
|
|
3751
|
-
function
|
|
3745
|
+
function Oi(c) {
|
|
3752
3746
|
return qt(Te(c, 19), Te(c, 61), lr(c, 6));
|
|
3753
3747
|
}
|
|
3754
3748
|
var Ci = [
|
|
@@ -3840,13 +3834,13 @@ var C;
|
|
|
3840
3834
|
for (_ = 0; _ < 16; _++) v[_] = J(l, 8 * _ + M);
|
|
3841
3835
|
for (_ = 0; _ < 80; _++) {
|
|
3842
3836
|
for (S = 0; S < 8; S++) m[S] = b[S];
|
|
3843
|
-
for (E =
|
|
3837
|
+
for (E = pt(b[7], Pi(b[4]), vi(b[4], b[5], b[6]), Ci[_], v[_ % 16]), m[7] = pt(E, Ai(b[0]), Ei(b[0], b[1], b[2])), m[3] = pt(m[3], E), S = 0; S < 8; S++) b[(S + 1) % 8] = m[S];
|
|
3844
3838
|
if (_ % 16 === 15)
|
|
3845
3839
|
for (S = 0; S < 16; S++)
|
|
3846
|
-
v[S] =
|
|
3840
|
+
v[S] = pt(v[S], v[(S + 9) % 16], ki(v[(S + 1) % 16]), Oi(v[(S + 14) % 16]));
|
|
3847
3841
|
}
|
|
3848
3842
|
for (_ = 0; _ < 8; _++)
|
|
3849
|
-
b[_] =
|
|
3843
|
+
b[_] = pt(b[_], d[_]), d[_] = b[_];
|
|
3850
3844
|
M += 128, u -= 128;
|
|
3851
3845
|
}
|
|
3852
3846
|
for (_ = 0; _ < 8; _++) L(c, 8 * _, d[_]);
|
|
@@ -3937,7 +3931,7 @@ var C;
|
|
|
3937
3931
|
}
|
|
3938
3932
|
function ps(c, l) {
|
|
3939
3933
|
var u = t(), d = t(), m = t();
|
|
3940
|
-
ar(m, l[2]), B(u, l[0], m), B(d, l[1], m),
|
|
3934
|
+
ar(m, l[2]), B(u, l[0], m), B(d, l[1], m), Qe(c, d), c[31] ^= or(u) << 7;
|
|
3941
3935
|
}
|
|
3942
3936
|
function ms(c, l, u) {
|
|
3943
3937
|
var d, m;
|
|
@@ -4061,7 +4055,7 @@ var C;
|
|
|
4061
4055
|
for (m = 0; m < u; m++) c[m] = l[m + 64];
|
|
4062
4056
|
return u;
|
|
4063
4057
|
}
|
|
4064
|
-
var ws = 32, Ht = 24,
|
|
4058
|
+
var ws = 32, Ht = 24, mt = 32, et = 16, bt = 32, Jt = 32, gt = 32, _t = 32, xs = 32, mr = Ht, Ri = mt, Ni = et, Le = 64, Xe = 32, tt = 64, Ss = 32, vs = 64;
|
|
4065
4059
|
r.lowlevel = {
|
|
4066
4060
|
crypto_core_hsalsa20: R,
|
|
4067
4061
|
crypto_stream_xor: V,
|
|
@@ -4087,25 +4081,25 @@ var C;
|
|
|
4087
4081
|
crypto_sign_open: ys,
|
|
4088
4082
|
crypto_secretbox_KEYBYTES: ws,
|
|
4089
4083
|
crypto_secretbox_NONCEBYTES: Ht,
|
|
4090
|
-
crypto_secretbox_ZEROBYTES:
|
|
4091
|
-
crypto_secretbox_BOXZEROBYTES:
|
|
4092
|
-
crypto_scalarmult_BYTES:
|
|
4084
|
+
crypto_secretbox_ZEROBYTES: mt,
|
|
4085
|
+
crypto_secretbox_BOXZEROBYTES: et,
|
|
4086
|
+
crypto_scalarmult_BYTES: bt,
|
|
4093
4087
|
crypto_scalarmult_SCALARBYTES: Jt,
|
|
4094
|
-
crypto_box_PUBLICKEYBYTES:
|
|
4095
|
-
crypto_box_SECRETKEYBYTES:
|
|
4088
|
+
crypto_box_PUBLICKEYBYTES: gt,
|
|
4089
|
+
crypto_box_SECRETKEYBYTES: _t,
|
|
4096
4090
|
crypto_box_BEFORENMBYTES: xs,
|
|
4097
4091
|
crypto_box_NONCEBYTES: mr,
|
|
4098
4092
|
crypto_box_ZEROBYTES: Ri,
|
|
4099
4093
|
crypto_box_BOXZEROBYTES: Ni,
|
|
4100
4094
|
crypto_sign_BYTES: Le,
|
|
4101
4095
|
crypto_sign_PUBLICKEYBYTES: Xe,
|
|
4102
|
-
crypto_sign_SECRETKEYBYTES:
|
|
4096
|
+
crypto_sign_SECRETKEYBYTES: tt,
|
|
4103
4097
|
crypto_sign_SEEDBYTES: Ss,
|
|
4104
4098
|
crypto_hash_BYTES: vs,
|
|
4105
4099
|
gf: t,
|
|
4106
4100
|
D: p,
|
|
4107
4101
|
L: Dt,
|
|
4108
|
-
pack25519:
|
|
4102
|
+
pack25519: Qe,
|
|
4109
4103
|
unpack25519: ds,
|
|
4110
4104
|
M: B,
|
|
4111
4105
|
A: Ce,
|
|
@@ -4123,8 +4117,8 @@ var C;
|
|
|
4123
4117
|
if (l.length !== Ht) throw new Error("bad nonce size");
|
|
4124
4118
|
}
|
|
4125
4119
|
function Ti(c, l) {
|
|
4126
|
-
if (c.length !==
|
|
4127
|
-
if (l.length !==
|
|
4120
|
+
if (c.length !== gt) throw new Error("bad public key size");
|
|
4121
|
+
if (l.length !== _t) throw new Error("bad secret key size");
|
|
4128
4122
|
}
|
|
4129
4123
|
function _e() {
|
|
4130
4124
|
for (var c = 0; c < arguments.length; c++)
|
|
@@ -4138,22 +4132,22 @@ var C;
|
|
|
4138
4132
|
return s(l, c), l;
|
|
4139
4133
|
}, r.secretbox = function(c, l, u) {
|
|
4140
4134
|
_e(c, l, u), br(u, l);
|
|
4141
|
-
for (var d = new Uint8Array(
|
|
4142
|
-
return ue(m, d, d.length, l, u), m.subarray(
|
|
4135
|
+
for (var d = new Uint8Array(mt + c.length), m = new Uint8Array(d.length), b = 0; b < c.length; b++) d[b + mt] = c[b];
|
|
4136
|
+
return ue(m, d, d.length, l, u), m.subarray(et);
|
|
4143
4137
|
}, r.secretbox.open = function(c, l, u) {
|
|
4144
4138
|
_e(c, l, u), br(u, l);
|
|
4145
|
-
for (var d = new Uint8Array(
|
|
4146
|
-
return d.length < 32 || le(m, d, d.length, l, u) !== 0 ? null : m.subarray(
|
|
4147
|
-
}, r.secretbox.keyLength = ws, r.secretbox.nonceLength = Ht, r.secretbox.overheadLength =
|
|
4139
|
+
for (var d = new Uint8Array(et + c.length), m = new Uint8Array(d.length), b = 0; b < c.length; b++) d[b + et] = c[b];
|
|
4140
|
+
return d.length < 32 || le(m, d, d.length, l, u) !== 0 ? null : m.subarray(mt);
|
|
4141
|
+
}, r.secretbox.keyLength = ws, r.secretbox.nonceLength = Ht, r.secretbox.overheadLength = et, r.scalarMult = function(c, l) {
|
|
4148
4142
|
if (_e(c, l), c.length !== Jt) throw new Error("bad n size");
|
|
4149
|
-
if (l.length !==
|
|
4150
|
-
var u = new Uint8Array(
|
|
4143
|
+
if (l.length !== bt) throw new Error("bad p size");
|
|
4144
|
+
var u = new Uint8Array(bt);
|
|
4151
4145
|
return Ut(u, c, l), u;
|
|
4152
4146
|
}, r.scalarMult.base = function(c) {
|
|
4153
4147
|
if (_e(c), c.length !== Jt) throw new Error("bad n size");
|
|
4154
|
-
var l = new Uint8Array(
|
|
4148
|
+
var l = new Uint8Array(bt);
|
|
4155
4149
|
return $t(l, c), l;
|
|
4156
|
-
}, r.scalarMult.scalarLength = Jt, r.scalarMult.groupElementLength =
|
|
4150
|
+
}, r.scalarMult.scalarLength = Jt, r.scalarMult.groupElementLength = bt, r.box = function(c, l, u, d) {
|
|
4157
4151
|
var m = r.box.before(u, d);
|
|
4158
4152
|
return r.secretbox(c, l, m);
|
|
4159
4153
|
}, r.box.before = function(c, l) {
|
|
@@ -4164,20 +4158,20 @@ var C;
|
|
|
4164
4158
|
var m = r.box.before(u, d);
|
|
4165
4159
|
return r.secretbox.open(c, l, m);
|
|
4166
4160
|
}, r.box.open.after = r.secretbox.open, r.box.keyPair = function() {
|
|
4167
|
-
var c = new Uint8Array(
|
|
4161
|
+
var c = new Uint8Array(gt), l = new Uint8Array(_t);
|
|
4168
4162
|
return hr(c, l), {
|
|
4169
4163
|
publicKey: c,
|
|
4170
4164
|
secretKey: l
|
|
4171
4165
|
};
|
|
4172
4166
|
}, r.box.keyPair.fromSecretKey = function(c) {
|
|
4173
|
-
if (_e(c), c.length !==
|
|
4174
|
-
var l = new Uint8Array(
|
|
4167
|
+
if (_e(c), c.length !== _t) throw new Error("bad secret key size");
|
|
4168
|
+
var l = new Uint8Array(gt);
|
|
4175
4169
|
return $t(l, c), {
|
|
4176
4170
|
publicKey: l,
|
|
4177
4171
|
secretKey: new Uint8Array(c)
|
|
4178
4172
|
};
|
|
4179
|
-
}, r.box.publicKeyLength =
|
|
4180
|
-
if (_e(c, l), l.length !==
|
|
4173
|
+
}, r.box.publicKeyLength = gt, r.box.secretKeyLength = _t, r.box.sharedKeyLength = xs, r.box.nonceLength = mr, r.box.overheadLength = r.secretbox.overheadLength, r.sign = function(c, l) {
|
|
4174
|
+
if (_e(c, l), l.length !== tt) throw new Error("bad secret key size");
|
|
4181
4175
|
var u = new Uint8Array(Le + c.length);
|
|
4182
4176
|
return pr(u, c, c.length, l), u;
|
|
4183
4177
|
}, r.sign.open = function(c, l) {
|
|
@@ -4197,13 +4191,13 @@ var C;
|
|
|
4197
4191
|
for (b = 0; b < c.length; b++) d[b + Le] = c[b];
|
|
4198
4192
|
return ys(m, d, d.length, u) >= 0;
|
|
4199
4193
|
}, r.sign.keyPair = function() {
|
|
4200
|
-
var c = new Uint8Array(Xe), l = new Uint8Array(
|
|
4194
|
+
var c = new Uint8Array(Xe), l = new Uint8Array(tt);
|
|
4201
4195
|
return bs(c, l), {
|
|
4202
4196
|
publicKey: c,
|
|
4203
4197
|
secretKey: l
|
|
4204
4198
|
};
|
|
4205
4199
|
}, r.sign.keyPair.fromSecretKey = function(c) {
|
|
4206
|
-
if (_e(c), c.length !==
|
|
4200
|
+
if (_e(c), c.length !== tt) throw new Error("bad secret key size");
|
|
4207
4201
|
for (var l = new Uint8Array(Xe), u = 0; u < l.length; u++) l[u] = c[32 + u];
|
|
4208
4202
|
return {
|
|
4209
4203
|
publicKey: l,
|
|
@@ -4211,12 +4205,12 @@ var C;
|
|
|
4211
4205
|
};
|
|
4212
4206
|
}, r.sign.keyPair.fromSeed = function(c) {
|
|
4213
4207
|
if (_e(c), c.length !== Ss) throw new Error("bad seed size");
|
|
4214
|
-
for (var l = new Uint8Array(Xe), u = new Uint8Array(
|
|
4208
|
+
for (var l = new Uint8Array(Xe), u = new Uint8Array(tt), d = 0; d < 32; d++) u[d] = c[d];
|
|
4215
4209
|
return bs(l, u, !0), {
|
|
4216
4210
|
publicKey: l,
|
|
4217
4211
|
secretKey: u
|
|
4218
4212
|
};
|
|
4219
|
-
}, r.sign.publicKeyLength = Xe, r.sign.secretKeyLength =
|
|
4213
|
+
}, r.sign.publicKeyLength = Xe, r.sign.secretKeyLength = tt, r.sign.seedLength = Ss, r.sign.signatureLength = Le, r.hash = function(c) {
|
|
4220
4214
|
_e(c);
|
|
4221
4215
|
var l = new Uint8Array(vs);
|
|
4222
4216
|
return Ye(l, c, c.length), l;
|
|
@@ -4578,7 +4572,7 @@ var z;
|
|
|
4578
4572
|
(function(r) {
|
|
4579
4573
|
r[r.Seed = 144] = "Seed", r[r.Private = 120] = "Private", r[r.Operator = 112] = "Operator", r[r.Server = 104] = "Server", r[r.Cluster = 16] = "Cluster", r[r.Account = 0] = "Account", r[r.User = 160] = "User";
|
|
4580
4574
|
})(z || (z = {}));
|
|
4581
|
-
class
|
|
4575
|
+
class nt {
|
|
4582
4576
|
static isValidPublicPrefix(e) {
|
|
4583
4577
|
return e == z.Server || e == z.Operator || e == z.Cluster || e == z.Account || e == z.User;
|
|
4584
4578
|
}
|
|
@@ -4614,21 +4608,21 @@ class be {
|
|
|
4614
4608
|
static encode(e, t) {
|
|
4615
4609
|
if (!t || !(t instanceof Uint8Array))
|
|
4616
4610
|
throw new G(K.SerializationError);
|
|
4617
|
-
if (!
|
|
4611
|
+
if (!nt.isValidPrefix(e))
|
|
4618
4612
|
throw new G(K.InvalidPrefixByte);
|
|
4619
4613
|
return be._encode(!1, e, t);
|
|
4620
4614
|
}
|
|
4621
4615
|
static encodeSeed(e, t) {
|
|
4622
4616
|
if (!t)
|
|
4623
4617
|
throw new G(K.ApiError);
|
|
4624
|
-
if (!
|
|
4618
|
+
if (!nt.isValidPublicPrefix(e))
|
|
4625
4619
|
throw new G(K.InvalidPrefixByte);
|
|
4626
4620
|
if (t.byteLength !== 32)
|
|
4627
4621
|
throw new G(K.InvalidSeedLen);
|
|
4628
4622
|
return be._encode(!0, e, t);
|
|
4629
4623
|
}
|
|
4630
4624
|
static decode(e, t) {
|
|
4631
|
-
if (!
|
|
4625
|
+
if (!nt.isValidPrefix(e))
|
|
4632
4626
|
throw new G(K.InvalidPrefixByte);
|
|
4633
4627
|
const s = be._decode(t);
|
|
4634
4628
|
if (s[0] !== e)
|
|
@@ -4639,7 +4633,7 @@ class be {
|
|
|
4639
4633
|
const t = be._decode(e), s = be._decodePrefix(t);
|
|
4640
4634
|
if (s[0] != z.Seed)
|
|
4641
4635
|
throw new G(K.InvalidSeed);
|
|
4642
|
-
if (!
|
|
4636
|
+
if (!nt.isValidPublicPrefix(s[1]))
|
|
4643
4637
|
throw new G(K.InvalidPrefixByte);
|
|
4644
4638
|
return {
|
|
4645
4639
|
buf: t.slice(2),
|
|
@@ -4764,8 +4758,8 @@ class so {
|
|
|
4764
4758
|
}
|
|
4765
4759
|
}
|
|
4766
4760
|
function ro(r) {
|
|
4767
|
-
const e = new TextEncoder().encode(r), t = be._decode(e), s =
|
|
4768
|
-
if (
|
|
4761
|
+
const e = new TextEncoder().encode(r), t = be._decode(e), s = nt.parsePrefix(t[0]);
|
|
4762
|
+
if (nt.isValidPublicPrefix(s))
|
|
4769
4763
|
return new so(e);
|
|
4770
4764
|
throw new G(K.InvalidPublicKey);
|
|
4771
4765
|
}
|
|
@@ -4872,7 +4866,7 @@ function go(r) {
|
|
|
4872
4866
|
}, r.servers = r.servers || [], typeof r.servers == "string" && (r.servers = [
|
|
4873
4867
|
r.servers
|
|
4874
4868
|
]), r.servers.length > 0 && r.port)
|
|
4875
|
-
throw new T("port and servers options are mutually exclusive",
|
|
4869
|
+
throw new T("port and servers options are mutually exclusive", k.InvalidOption);
|
|
4876
4870
|
r.servers.length === 0 && r.port && (r.servers = [
|
|
4877
4871
|
`${Ms}:${r.port}`
|
|
4878
4872
|
]), r.servers && r.servers.length === 0 && (r.servers = [
|
|
@@ -4884,7 +4878,7 @@ function go(r) {
|
|
|
4884
4878
|
"authenticator"
|
|
4885
4879
|
].forEach((s) => {
|
|
4886
4880
|
if (t[s] && typeof t[s] != "function")
|
|
4887
|
-
throw new T(`${s} option should be a function`,
|
|
4881
|
+
throw new T(`${s} option should be a function`, k.NotFunction);
|
|
4888
4882
|
}), t.reconnectDelayHandler || (t.reconnectDelayHandler = () => {
|
|
4889
4883
|
let s = t.tls ? t.reconnectJitterTLS : t.reconnectJitter;
|
|
4890
4884
|
return s && (s++, s = Math.floor(Math.random() * s)), t.reconnectTimeWait + s;
|
|
@@ -4892,19 +4886,19 @@ function go(r) {
|
|
|
4892
4886
|
try {
|
|
4893
4887
|
qe(t.inboxPrefix);
|
|
4894
4888
|
} catch (s) {
|
|
4895
|
-
throw new T(s.message,
|
|
4889
|
+
throw new T(s.message, k.ApiError);
|
|
4896
4890
|
}
|
|
4897
4891
|
if (t.resolve === void 0 && (t.resolve = typeof Hs() == "function"), t.resolve && typeof Hs() != "function")
|
|
4898
|
-
throw new T("'resolve' is not supported on this client",
|
|
4892
|
+
throw new T("'resolve' is not supported on this client", k.InvalidOption);
|
|
4899
4893
|
return t;
|
|
4900
4894
|
}
|
|
4901
4895
|
function _o(r, e) {
|
|
4902
4896
|
const { proto: t, tls_required: s, tls_available: i } = r;
|
|
4903
4897
|
if ((t === void 0 || t < 1) && e.noEcho)
|
|
4904
|
-
throw new T("noEcho",
|
|
4898
|
+
throw new T("noEcho", k.ServerOptionNotAvailable);
|
|
4905
4899
|
const n = s || i || !1;
|
|
4906
4900
|
if (e.tls && !n)
|
|
4907
|
-
throw new T("tls",
|
|
4901
|
+
throw new T("tls", k.ServerOptionNotAvailable);
|
|
4908
4902
|
}
|
|
4909
4903
|
const yo = 1024 * 32, wo = /^INFO\s+([^\r\n]+)\r\n/i, xo = Pt(`PONG\r
|
|
4910
4904
|
`), qr = Pt(`PING\r
|
|
@@ -4950,7 +4944,7 @@ class li extends he {
|
|
|
4950
4944
|
h(this, "requestSubject");
|
|
4951
4945
|
cs(this, i), this.protocol = t, this.subject = s, this.draining = !1, this.noIterator = typeof i.callback == "function", this.closed = Y();
|
|
4952
4946
|
const n = !((o = t.options) != null && o.noAsyncTraces);
|
|
4953
|
-
i.timeout && (this.timer =
|
|
4947
|
+
i.timeout && (this.timer = ut(i.timeout, n), this.timer.then(() => {
|
|
4954
4948
|
this.timer = void 0;
|
|
4955
4949
|
}).catch((a) => {
|
|
4956
4950
|
this.stop(a), this.noIterator && this.callback(a, {});
|
|
@@ -4996,7 +4990,7 @@ class li extends he {
|
|
|
4996
4990
|
this.timer && (this.timer.cancel(), this.timer = void 0);
|
|
4997
4991
|
}
|
|
4998
4992
|
drain() {
|
|
4999
|
-
return this.protocol.isClosed() ? Promise.reject(T.errorForCode(
|
|
4993
|
+
return this.protocol.isClosed() ? Promise.reject(T.errorForCode(k.ConnectionClosed)) : this.isClosed() ? Promise.reject(T.errorForCode(k.SubClosed)) : (this.drained || (this.draining = !0, this.protocol.unsub(this), this.drained = this.protocol.flush(Y()).then(() => {
|
|
5000
4994
|
this.protocol.subscriptions.cancel(this);
|
|
5001
4995
|
}).catch(() => {
|
|
5002
4996
|
this.protocol.subscriptions.cancel(this);
|
|
@@ -5096,7 +5090,7 @@ class os {
|
|
|
5096
5090
|
h(this, "server");
|
|
5097
5091
|
h(this, "features");
|
|
5098
5092
|
h(this, "connectPromise");
|
|
5099
|
-
this._closed = !1, this.connected = !1, this.connectedOnce = !1, this.infoReceived = !1, this.noMorePublishing = !1, this.abortReconnect = !1, this.listeners = [], this.pendingLimit = yo, this.outMsgs = 0, this.inMsgs = 0, this.outBytes = 0, this.inBytes = 0, this.options = e, this.publisher = t, this.subscriptions = new vo(), this.muxSubscriptions = new Kn(), this.outbound = new
|
|
5093
|
+
this._closed = !1, this.connected = !1, this.connectedOnce = !1, this.infoReceived = !1, this.noMorePublishing = !1, this.abortReconnect = !1, this.listeners = [], this.pendingLimit = yo, this.outMsgs = 0, this.inMsgs = 0, this.outBytes = 0, this.inBytes = 0, this.options = e, this.publisher = t, this.subscriptions = new vo(), this.muxSubscriptions = new Kn(), this.outbound = new ft(), this.pongs = [], this.whyClosed = "", this.pendingLimit = e.pendingLimit || this.pendingLimit, this.features = new An({
|
|
5100
5094
|
major: 0,
|
|
5101
5095
|
minor: 0,
|
|
5102
5096
|
micro: 0
|
|
@@ -5112,7 +5106,7 @@ class os {
|
|
|
5112
5106
|
this.outbound.reset();
|
|
5113
5107
|
const e = this.pongs;
|
|
5114
5108
|
this.pongs = [];
|
|
5115
|
-
const t = T.errorForCode(
|
|
5109
|
+
const t = T.errorForCode(k.Disconnect);
|
|
5116
5110
|
t.stack = "", e.forEach((s) => {
|
|
5117
5111
|
s.reject(t);
|
|
5118
5112
|
}), this.parser = new Ur(this), this.infoReceived = !1;
|
|
@@ -5132,7 +5126,7 @@ class os {
|
|
|
5132
5126
|
return e.catch(() => {
|
|
5133
5127
|
}), this.pongs.unshift(e), this.connectError = (t) => {
|
|
5134
5128
|
e.reject(t);
|
|
5135
|
-
}, this.transport =
|
|
5129
|
+
}, this.transport = On(), this.transport.closed().then(async (t) => {
|
|
5136
5130
|
if (this.connected = !1, !this.isClosed()) {
|
|
5137
5131
|
await this.disconnected(this.transport.closeError || this.lastError);
|
|
5138
5132
|
return;
|
|
@@ -5153,14 +5147,14 @@ class os {
|
|
|
5153
5147
|
}
|
|
5154
5148
|
async disconnected(e) {
|
|
5155
5149
|
this.dispatchStatus({
|
|
5156
|
-
type:
|
|
5150
|
+
type: ke.Disconnect,
|
|
5157
5151
|
data: this.servers.getCurrentServer().toString()
|
|
5158
5152
|
}), this.options.reconnect ? await this.dialLoop().then(() => {
|
|
5159
5153
|
var t;
|
|
5160
5154
|
this.dispatchStatus({
|
|
5161
|
-
type:
|
|
5155
|
+
type: ke.Reconnect,
|
|
5162
5156
|
data: this.servers.getCurrentServer().toString()
|
|
5163
|
-
}), ((t = this.lastError) == null ? void 0 : t.code) ===
|
|
5157
|
+
}), ((t = this.lastError) == null ? void 0 : t.code) === k.AuthenticationExpired && (this.lastError = void 0);
|
|
5164
5158
|
}).catch((t) => {
|
|
5165
5159
|
this._close(t);
|
|
5166
5160
|
}) : await this._close(e);
|
|
@@ -5169,7 +5163,7 @@ class os {
|
|
|
5169
5163
|
const t = this.prepare();
|
|
5170
5164
|
let s;
|
|
5171
5165
|
try {
|
|
5172
|
-
s =
|
|
5166
|
+
s = ut(this.options.timeout || 2e4);
|
|
5173
5167
|
const i = this.transport.connect(e, this.options);
|
|
5174
5168
|
await Promise.race([
|
|
5175
5169
|
i,
|
|
@@ -5229,7 +5223,7 @@ class os {
|
|
|
5229
5223
|
let s = t;
|
|
5230
5224
|
const i = this.selectServer();
|
|
5231
5225
|
if (!i || this.abortReconnect)
|
|
5232
|
-
throw e || (this.lastError ? this.lastError : T.errorForCode(
|
|
5226
|
+
throw e || (this.lastError ? this.lastError : T.errorForCode(k.ConnectionRefused));
|
|
5233
5227
|
const n = Date.now();
|
|
5234
5228
|
if (i.lastConnect === 0 || i.lastConnect + t <= n) {
|
|
5235
5229
|
i.lastConnect = Date.now();
|
|
@@ -5247,7 +5241,7 @@ class os {
|
|
|
5247
5241
|
a !== -1 && i.reconnects >= a && this.servers.removeCurrentServer();
|
|
5248
5242
|
}
|
|
5249
5243
|
} else
|
|
5250
|
-
s = Math.min(s, i.lastConnect + t - n), await
|
|
5244
|
+
s = Math.min(s, i.lastConnect + t - n), await dt(s);
|
|
5251
5245
|
}
|
|
5252
5246
|
}
|
|
5253
5247
|
static async connect(e, t) {
|
|
@@ -5257,7 +5251,7 @@ class os {
|
|
|
5257
5251
|
static toError(e) {
|
|
5258
5252
|
const t = e ? e.toLowerCase() : "";
|
|
5259
5253
|
if (t.indexOf("permissions violation") !== -1) {
|
|
5260
|
-
const s = new T(e,
|
|
5254
|
+
const s = new T(e, k.PermissionsViolation), i = e.match(/(Publish|Subscription) to "(\S+)"/);
|
|
5261
5255
|
if (i) {
|
|
5262
5256
|
s.permissionContext = {
|
|
5263
5257
|
operation: i[1].toLowerCase(),
|
|
@@ -5268,7 +5262,7 @@ class os {
|
|
|
5268
5262
|
n && (s.permissionContext.queue = n[1]);
|
|
5269
5263
|
}
|
|
5270
5264
|
return s;
|
|
5271
|
-
} else return t.indexOf("authorization violation") !== -1 ? new T(e,
|
|
5265
|
+
} else return t.indexOf("authorization violation") !== -1 ? new T(e, k.AuthorizationViolation) : t.indexOf("user authentication expired") !== -1 ? new T(e, k.AuthenticationExpired) : t.indexOf("account authentication expired") != -1 ? new T(e, k.AccountExpired) : t.indexOf("authentication timeout") !== -1 ? new T(e, k.AuthenticationTimeout) : new T(e, k.ProtocolError);
|
|
5272
5266
|
}
|
|
5273
5267
|
processMsg(e, t) {
|
|
5274
5268
|
if (this.inMsgs++, this.inBytes += t.length, !this.subscriptions.sidCounter)
|
|
@@ -5278,7 +5272,7 @@ class os {
|
|
|
5278
5272
|
}
|
|
5279
5273
|
processError(e) {
|
|
5280
5274
|
const t = xr(e), s = os.toError(t), i = {
|
|
5281
|
-
type:
|
|
5275
|
+
type: ke.Error,
|
|
5282
5276
|
data: s.code
|
|
5283
5277
|
};
|
|
5284
5278
|
if (s.isPermissionError()) {
|
|
@@ -5310,7 +5304,7 @@ class os {
|
|
|
5310
5304
|
this.info = t;
|
|
5311
5305
|
const s = this.options && this.options.ignoreClusterUpdates ? void 0 : this.servers.update(t, this.transport.isEncrypted());
|
|
5312
5306
|
if (!this.infoReceived) {
|
|
5313
|
-
this.features.update(
|
|
5307
|
+
this.features.update(Ze(t.version)), this.infoReceived = !0, this.transport.isEncrypted() && this.servers.updateTLSName();
|
|
5314
5308
|
const { version: n, lang: o } = this.transport;
|
|
5315
5309
|
try {
|
|
5316
5310
|
const a = new So({
|
|
@@ -5325,10 +5319,10 @@ class os {
|
|
|
5325
5319
|
}
|
|
5326
5320
|
}
|
|
5327
5321
|
s && this.dispatchStatus({
|
|
5328
|
-
type:
|
|
5322
|
+
type: ke.Update,
|
|
5329
5323
|
data: s
|
|
5330
5324
|
}), (t.ldm !== void 0 ? t.ldm : !1) && this.dispatchStatus({
|
|
5331
|
-
type:
|
|
5325
|
+
type: ke.LDM,
|
|
5332
5326
|
data: this.servers.getCurrentServer().toString()
|
|
5333
5327
|
});
|
|
5334
5328
|
}
|
|
@@ -5369,17 +5363,17 @@ class os {
|
|
|
5369
5363
|
else if (typeof t == "string")
|
|
5370
5364
|
i = We.encode(t);
|
|
5371
5365
|
else
|
|
5372
|
-
throw T.errorForCode(
|
|
5366
|
+
throw T.errorForCode(k.BadPayload);
|
|
5373
5367
|
let n = i.length;
|
|
5374
5368
|
s = s || {}, s.reply = s.reply || "";
|
|
5375
5369
|
let o = ve, a = 0;
|
|
5376
5370
|
if (s.headers) {
|
|
5377
5371
|
if (this.info && !this.info.headers)
|
|
5378
|
-
throw new T("headers",
|
|
5372
|
+
throw new T("headers", k.ServerOptionNotAvailable);
|
|
5379
5373
|
o = s.headers.encode(), a = o.length, n = i.length + a;
|
|
5380
5374
|
}
|
|
5381
5375
|
if (this.info && n > this.info.max_payload)
|
|
5382
|
-
throw T.errorForCode(
|
|
5376
|
+
throw T.errorForCode(k.MaxPayloadExceeded);
|
|
5383
5377
|
this.outBytes += n, this.outMsgs++;
|
|
5384
5378
|
let f;
|
|
5385
5379
|
s.headers ? (s.reply ? f = `HPUB ${e} ${s.reply} ${a} ${n}\r
|
|
@@ -5572,7 +5566,7 @@ class Mt {
|
|
|
5572
5566
|
h(this, "_stopped");
|
|
5573
5567
|
h(this, "_done");
|
|
5574
5568
|
h(this, "started");
|
|
5575
|
-
this.nc = e, this.config = Object.assign({}, t), this.config.queue || (this.config.queue = "q"), Et("name", this.config.name), Et("queue", this.config.queue),
|
|
5569
|
+
this.nc = e, this.config = Object.assign({}, t), this.config.queue || (this.config.queue = "q"), Et("name", this.config.name), Et("queue", this.config.queue), Ze(this.config.version), this._id = Ge.next(), this.internal = [], this._done = Y(), this._stopped = !1, this.handlers = [], this.started = (/* @__PURE__ */ new Date()).toISOString(), this.reset(), this.nc.closed().then(() => {
|
|
5576
5570
|
this.close().catch();
|
|
5577
5571
|
}).catch((s) => {
|
|
5578
5572
|
this.close(s).catch();
|
|
@@ -5611,7 +5605,7 @@ class Mt {
|
|
|
5611
5605
|
}
|
|
5612
5606
|
setupHandler(e, t = !1) {
|
|
5613
5607
|
const s = t ? "" : e.queue ? e.queue : this.config.queue, { name: i, subject: n, handler: o } = e, a = e;
|
|
5614
|
-
a.internal = t, t && this.internal.push(a), a.stats = new
|
|
5608
|
+
a.internal = t, t && this.internal.push(a), a.stats = new ko(i, n, s), a.queue = s;
|
|
5615
5609
|
const f = o ? (p, g) => {
|
|
5616
5610
|
if (p) {
|
|
5617
5611
|
this.close(p);
|
|
@@ -5642,7 +5636,7 @@ class Mt {
|
|
|
5642
5636
|
}
|
|
5643
5637
|
info() {
|
|
5644
5638
|
return {
|
|
5645
|
-
type:
|
|
5639
|
+
type: kt.INFO,
|
|
5646
5640
|
name: this.name,
|
|
5647
5641
|
id: this.id,
|
|
5648
5642
|
version: this.version,
|
|
@@ -5674,7 +5668,7 @@ class Mt {
|
|
|
5674
5668
|
e.push(t.stats.stats(t.qi));
|
|
5675
5669
|
}
|
|
5676
5670
|
return {
|
|
5677
|
-
type:
|
|
5671
|
+
type: kt.STATS,
|
|
5678
5672
|
name: this.name,
|
|
5679
5673
|
id: this.id,
|
|
5680
5674
|
version: this.version,
|
|
@@ -5692,7 +5686,7 @@ class Mt {
|
|
|
5692
5686
|
o.name = e, o.subject = Mt.controlSubject(t, i, n), o.handler = s, this.setupHandler(o, !0);
|
|
5693
5687
|
}
|
|
5694
5688
|
start() {
|
|
5695
|
-
const e =
|
|
5689
|
+
const e = Oe(), t = (o, a) => o ? (this.close(o), Promise.reject(o)) : this.stats().then((f) => (a == null || a.respond(e.encode(f)), Promise.resolve())), s = (o, a) => o ? (this.close(o), Promise.reject(o)) : (a == null || a.respond(e.encode(this.info())), Promise.resolve()), i = e.encode(this.ping()), n = (o, a) => o ? (this.close(o).then().catch(), Promise.reject(o)) : (a.respond(i), Promise.resolve());
|
|
5696
5690
|
return this.addInternalHandler(Je.PING, n), this.addInternalHandler(Je.STATS, t), this.addInternalHandler(Je.INFO, s), this.handlers.forEach((o) => {
|
|
5697
5691
|
const { subject: a } = o;
|
|
5698
5692
|
typeof a == "string" && o.handler !== null && this.setupHandler(o);
|
|
@@ -5718,7 +5712,7 @@ class Mt {
|
|
|
5718
5712
|
}
|
|
5719
5713
|
ping() {
|
|
5720
5714
|
return {
|
|
5721
|
-
type:
|
|
5715
|
+
type: kt.PING,
|
|
5722
5716
|
name: this.name,
|
|
5723
5717
|
id: this.id,
|
|
5724
5718
|
version: this.version,
|
|
@@ -5747,7 +5741,7 @@ class Mt {
|
|
|
5747
5741
|
return s.qi = t, this.handlers.push(s), t;
|
|
5748
5742
|
}
|
|
5749
5743
|
}
|
|
5750
|
-
class
|
|
5744
|
+
class ko {
|
|
5751
5745
|
constructor(e, t, s = "") {
|
|
5752
5746
|
h(this, "name");
|
|
5753
5747
|
h(this, "subject");
|
|
@@ -5791,7 +5785,7 @@ class Oo {
|
|
|
5791
5785
|
return (t == null ? void 0 : t.noIterator) === !1 && (this.processing_time = W(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();
|
|
5792
5786
|
}
|
|
5793
5787
|
}
|
|
5794
|
-
class
|
|
5788
|
+
class Oo {
|
|
5795
5789
|
constructor(e, t = {
|
|
5796
5790
|
strategy: Ne.JitterTimer,
|
|
5797
5791
|
maxWait: 2e3
|
|
@@ -5811,7 +5805,7 @@ class ko {
|
|
|
5811
5805
|
return this.q(Je.INFO, e, t);
|
|
5812
5806
|
}
|
|
5813
5807
|
async q(e, t = "", s = "") {
|
|
5814
|
-
const i = new he(), n =
|
|
5808
|
+
const i = new he(), n = Oe(), o = Mt.controlSubject(e, t, s, this.prefix), a = await this.nc.requestMany(o, ve, this.opts);
|
|
5815
5809
|
return (async () => {
|
|
5816
5810
|
for await (const f of a)
|
|
5817
5811
|
try {
|
|
@@ -5955,7 +5949,7 @@ class Rt {
|
|
|
5955
5949
|
this.subjectForBucket()
|
|
5956
5950
|
];
|
|
5957
5951
|
e.metadata && (s.metadata = e.metadata), typeof e.compression == "boolean" && (s.compression = e.compression ? Ve.S2 : Ve.None);
|
|
5958
|
-
const n = this.js.nc, o = n.getServerVersion(), a = o ? Ds(o,
|
|
5952
|
+
const n = this.js.nc, o = n.getServerVersion(), a = o ? Ds(o, Ze("2.7.2")) >= 0 : !1;
|
|
5959
5953
|
s.discard = a ? It.New : It.Old;
|
|
5960
5954
|
const { ok: f, min: p } = n.features.get(H.JS_ALLOW_DIRECT);
|
|
5961
5955
|
if (!f && e.allow_direct === !0) {
|
|
@@ -6102,7 +6096,7 @@ class Rt {
|
|
|
6102
6096
|
const o = this.smToEntry(n);
|
|
6103
6097
|
return o.key !== s ? null : o;
|
|
6104
6098
|
} catch (o) {
|
|
6105
|
-
if (o.code ===
|
|
6099
|
+
if (o.code === k.JetStream404NoMessages)
|
|
6106
6100
|
return null;
|
|
6107
6101
|
throw o;
|
|
6108
6102
|
}
|
|
@@ -6435,10 +6429,10 @@ var $e;
|
|
|
6435
6429
|
(function(r) {
|
|
6436
6430
|
r.HeartbeatsMissed = "heartbeats_missed", r.ConsumerNotFound = "consumer_not_found", r.StreamNotFound = "stream_not_found", r.ConsumerDeleted = "consumer_deleted", r.OrderedConsumerRecreated = "ordered_consumer_recreated", r.NoResponders = "no_responders";
|
|
6437
6431
|
})($e || ($e = {}));
|
|
6438
|
-
var
|
|
6432
|
+
var ht;
|
|
6439
6433
|
(function(r) {
|
|
6440
6434
|
r.DebugEvent = "debug", r.Discard = "discard", r.Reset = "reset", r.Next = "next";
|
|
6441
|
-
})(
|
|
6435
|
+
})(ht || (ht = {}));
|
|
6442
6436
|
const Hr = Uint8Array.of(43, 65, 67, 75), Lo = Uint8Array.of(45, 78, 65, 75), vt = Uint8Array.of(43, 87, 80, 73), qo = Uint8Array.of(43, 78, 88, 84), Fo = Uint8Array.of(43, 84, 69, 82, 77), Bo = Uint8Array.of(32);
|
|
6443
6437
|
function Nt(r, e = 5e3) {
|
|
6444
6438
|
return new ia(r, e);
|
|
@@ -6494,7 +6488,7 @@ class Ns extends he {
|
|
|
6494
6488
|
return;
|
|
6495
6489
|
const N = (x = p.headers) == null ? void 0 : x.code, J = ((I = (A = p.headers) == null ? void 0 : A.description) == null ? void 0 : I.toLowerCase()) || "unknown", { msgsLeft: ee, bytesLeft: L } = this.parseDiscard(p.headers);
|
|
6496
6490
|
if (ee > 0 || L > 0)
|
|
6497
|
-
this.pending.msgs -= ee, this.pending.bytes -= L, this.pending.requests--, this.notify(
|
|
6491
|
+
this.pending.msgs -= ee, this.pending.bytes -= L, this.pending.requests--, this.notify(ht.Discard, {
|
|
6498
6492
|
msgsLeft: ee,
|
|
6499
6493
|
bytesLeft: L
|
|
6500
6494
|
});
|
|
@@ -6514,7 +6508,7 @@ class Ns extends he {
|
|
|
6514
6508
|
return;
|
|
6515
6509
|
}
|
|
6516
6510
|
} else
|
|
6517
|
-
this.notify(
|
|
6511
|
+
this.notify(ht.DebugEvent, `${N} ${J}`);
|
|
6518
6512
|
} else
|
|
6519
6513
|
this._push(Nt(p, this.consumer.api.timeout)), this.received++, this.pending.msgs && this.pending.msgs--, this.pending.bytes && (this.pending.bytes -= p.size());
|
|
6520
6514
|
if (this.pending.msgs === 0 && this.pending.bytes === 0 && (this.pending.requests = 0), this.refilling) {
|
|
@@ -6540,10 +6534,10 @@ class Ns extends he {
|
|
|
6540
6534
|
this.statusIterator = f;
|
|
6541
6535
|
for await (const g of f)
|
|
6542
6536
|
switch (g.type) {
|
|
6543
|
-
case
|
|
6537
|
+
case ke.Disconnect:
|
|
6544
6538
|
(p = this.monitor) == null || p.cancel();
|
|
6545
6539
|
break;
|
|
6546
|
-
case
|
|
6540
|
+
case ke.Reconnect:
|
|
6547
6541
|
this.resetPending().then((y) => {
|
|
6548
6542
|
var x;
|
|
6549
6543
|
y && ((x = this.monitor) == null || x.restart());
|
|
@@ -6611,7 +6605,7 @@ class Ns extends he {
|
|
|
6611
6605
|
} else
|
|
6612
6606
|
t = 0, s = 0;
|
|
6613
6607
|
this.inBackOff = !0;
|
|
6614
|
-
const a = i.backoff(n), f =
|
|
6608
|
+
const a = i.backoff(n), f = dt(a);
|
|
6615
6609
|
await Promise.race([
|
|
6616
6610
|
f,
|
|
6617
6611
|
this.consumer.api.nc.closed()
|
|
@@ -6625,7 +6619,7 @@ class Ns extends he {
|
|
|
6625
6619
|
this._push(() => {
|
|
6626
6620
|
s.publish(`${this.consumer.api.prefix}.CONSUMER.MSG.NEXT.${this.consumer.stream}.${this.consumer.name}`, this.consumer.api.jc.encode(t), {
|
|
6627
6621
|
reply: this.inbox
|
|
6628
|
-
}), this.notify(
|
|
6622
|
+
}), this.notify(ht.Next, t);
|
|
6629
6623
|
});
|
|
6630
6624
|
}
|
|
6631
6625
|
pullOptions() {
|
|
@@ -6749,7 +6743,7 @@ class Gs {
|
|
|
6749
6743
|
max_messages: 100,
|
|
6750
6744
|
expires: 3e4
|
|
6751
6745
|
}) {
|
|
6752
|
-
const t = new Ns(this, e, !1), s = Math.round(t.opts.expires * 1.05), i =
|
|
6746
|
+
const t = new Ns(this, e, !1), s = Math.round(t.opts.expires * 1.05), i = ut(s);
|
|
6753
6747
|
return t.closed().catch(() => {
|
|
6754
6748
|
}).finally(() => {
|
|
6755
6749
|
i.cancel();
|
|
@@ -6776,7 +6770,7 @@ class Gs {
|
|
|
6776
6770
|
}
|
|
6777
6771
|
})().catch(() => {
|
|
6778
6772
|
});
|
|
6779
|
-
const o =
|
|
6773
|
+
const o = ut(n);
|
|
6780
6774
|
return i.closed().then((a) => {
|
|
6781
6775
|
a ? t.reject(a) : t.resolve(null);
|
|
6782
6776
|
}).catch((a) => {
|
|
@@ -6854,7 +6848,7 @@ class Ho {
|
|
|
6854
6848
|
return (g = this.iter) == null || g.stop(x), Promise.reject(x);
|
|
6855
6849
|
if (t && y >= this.maxInitialReset)
|
|
6856
6850
|
throw x;
|
|
6857
|
-
await
|
|
6851
|
+
await dt(i.backoff(y + 1));
|
|
6858
6852
|
}
|
|
6859
6853
|
return n;
|
|
6860
6854
|
}
|
|
@@ -6894,7 +6888,7 @@ class Ho {
|
|
|
6894
6888
|
}
|
|
6895
6889
|
notifyOrderedResetAndReset() {
|
|
6896
6890
|
var e;
|
|
6897
|
-
(e = this.iter) == null || e.notify(
|
|
6891
|
+
(e = this.iter) == null || e.notify(ht.Reset, ""), this.reset(this.opts, {
|
|
6898
6892
|
orderedReset: !0
|
|
6899
6893
|
});
|
|
6900
6894
|
}
|
|
@@ -7179,7 +7173,7 @@ class Jo extends Tt {
|
|
|
7179
7173
|
i && (s = null);
|
|
7180
7174
|
const n = s ? this.jc.encode(s) : ve, o = this.opts.apiPrefix || "$JS.API", a = i ? `${o}.DIRECT.GET.${e}.${i}` : `${o}.DIRECT.GET.${e}`, f = await this.nc.request(a, n, {
|
|
7181
7175
|
timeout: this.timeout
|
|
7182
|
-
}), p =
|
|
7176
|
+
}), p = at(f);
|
|
7183
7177
|
if (p)
|
|
7184
7178
|
return Promise.reject(p);
|
|
7185
7179
|
const g = new Ws(f);
|
|
@@ -7232,23 +7226,23 @@ class Ws {
|
|
|
7232
7226
|
this.data = e.data, this.header = e.headers;
|
|
7233
7227
|
}
|
|
7234
7228
|
get subject() {
|
|
7235
|
-
return this.header.last(
|
|
7229
|
+
return this.header.last(it.Subject);
|
|
7236
7230
|
}
|
|
7237
7231
|
get seq() {
|
|
7238
|
-
const e = this.header.last(
|
|
7232
|
+
const e = this.header.last(it.Sequence);
|
|
7239
7233
|
return typeof e == "string" ? parseInt(e) : 0;
|
|
7240
7234
|
}
|
|
7241
7235
|
get time() {
|
|
7242
7236
|
return new Date(Date.parse(this.timestamp));
|
|
7243
7237
|
}
|
|
7244
7238
|
get timestamp() {
|
|
7245
|
-
return this.header.last(
|
|
7239
|
+
return this.header.last(it.TimeStamp);
|
|
7246
7240
|
}
|
|
7247
7241
|
get stream() {
|
|
7248
|
-
return this.header.last(
|
|
7242
|
+
return this.header.last(it.Stream);
|
|
7249
7243
|
}
|
|
7250
7244
|
json(e) {
|
|
7251
|
-
return
|
|
7245
|
+
return Oe(e).decode(this.data);
|
|
7252
7246
|
}
|
|
7253
7247
|
string() {
|
|
7254
7248
|
return xe.decode(this.data);
|
|
@@ -7325,7 +7319,7 @@ class pi {
|
|
|
7325
7319
|
return i;
|
|
7326
7320
|
}
|
|
7327
7321
|
json(e) {
|
|
7328
|
-
return
|
|
7322
|
+
return Oe(e).decode(this.data);
|
|
7329
7323
|
}
|
|
7330
7324
|
string() {
|
|
7331
7325
|
return xe.decode(this.data);
|
|
@@ -7451,7 +7445,7 @@ class Ct {
|
|
|
7451
7445
|
try {
|
|
7452
7446
|
const n = await this.jsm.streams.getMessage(this.stream, {
|
|
7453
7447
|
last_by_subj: i
|
|
7454
|
-
}), a =
|
|
7448
|
+
}), a = Oe().decode(n.data);
|
|
7455
7449
|
return a.revision = n.seq, a;
|
|
7456
7450
|
} catch (n) {
|
|
7457
7451
|
return n.code === "404" ? null : Promise.reject(n);
|
|
@@ -7493,7 +7487,7 @@ class Ct {
|
|
|
7493
7487
|
nuid: A,
|
|
7494
7488
|
size: 0,
|
|
7495
7489
|
chunks: 0
|
|
7496
|
-
}, Jr(e)), ee = Y(), L = [], Q = new
|
|
7490
|
+
}, Jr(e)), ee = Y(), L = [], Q = new ft();
|
|
7497
7491
|
try {
|
|
7498
7492
|
const w = t ? t.getReader() : null, j = Nr.create();
|
|
7499
7493
|
for (; ; ) {
|
|
@@ -7509,11 +7503,11 @@ class Ct {
|
|
|
7509
7503
|
}));
|
|
7510
7504
|
}
|
|
7511
7505
|
await Promise.all(L), L.length = 0, J.mtime = (/* @__PURE__ */ new Date()).toISOString();
|
|
7512
|
-
const P =
|
|
7506
|
+
const P = ct.encode(j.digest());
|
|
7513
7507
|
J.digest = `${Dr}${P}`, J.deleted = !1;
|
|
7514
7508
|
const U = Fe();
|
|
7515
7509
|
typeof o == "number" && U.set(Ue.ExpectedLastSubjectSequenceHdr, `${o}`), U.set(ge.RollupHdr, ge.RollupValueSubject);
|
|
7516
|
-
const q = await this.js.publish(N,
|
|
7510
|
+
const q = await this.js.publish(N, Oe().encode(J), {
|
|
7517
7511
|
headers: U,
|
|
7518
7512
|
timeout: n
|
|
7519
7513
|
});
|
|
@@ -7559,7 +7553,7 @@ class Ct {
|
|
|
7559
7553
|
}
|
|
7560
7554
|
async getBlob(e) {
|
|
7561
7555
|
async function t(n) {
|
|
7562
|
-
const o = new
|
|
7556
|
+
const o = new ft(), a = n.getReader();
|
|
7563
7557
|
for (; ; ) {
|
|
7564
7558
|
const { done: f, value: p } = await a.read();
|
|
7565
7559
|
if (f)
|
|
@@ -7666,7 +7660,7 @@ class Ct {
|
|
|
7666
7660
|
success: !1
|
|
7667
7661
|
});
|
|
7668
7662
|
t.deleted = !0, t.size = 0, t.chunks = 0, t.digest = "";
|
|
7669
|
-
const s =
|
|
7663
|
+
const s = Oe(), i = Fe();
|
|
7670
7664
|
return i.set(ge.RollupHdr, ge.RollupValueSubject), await this.js.publish(this._metaSubject(t.name), s.encode(t), {
|
|
7671
7665
|
headers: i
|
|
7672
7666
|
}), this.jsm.streams.purge(this.stream, {
|
|
@@ -7705,7 +7699,7 @@ class Ct {
|
|
|
7705
7699
|
} catch (f) {
|
|
7706
7700
|
f.code === "404" ? (s.push(null), t = !0) : s.stop(f);
|
|
7707
7701
|
}
|
|
7708
|
-
const n =
|
|
7702
|
+
const n = Oe(), o = ze();
|
|
7709
7703
|
o.orderedConsumer(), e.includeHistory ? o.deliverLastPerSubject() : (t = !0, o.deliverNew()), o.callback((f, p) => {
|
|
7710
7704
|
var g;
|
|
7711
7705
|
if (f) {
|
|
@@ -7730,7 +7724,7 @@ class Ct {
|
|
|
7730
7724
|
return `$O.${this.name}.C.${e}`;
|
|
7731
7725
|
}
|
|
7732
7726
|
_metaSubject(e) {
|
|
7733
|
-
return `$O.${this.name}.M.${
|
|
7727
|
+
return `$O.${this.name}.M.${ct.encode(e)}`;
|
|
7734
7728
|
}
|
|
7735
7729
|
_metaSubjectAll() {
|
|
7736
7730
|
return `$O.${this.name}.M.>`;
|
|
@@ -7815,17 +7809,17 @@ class rr extends Tt {
|
|
|
7815
7809
|
break;
|
|
7816
7810
|
} catch (A) {
|
|
7817
7811
|
if (A.code === "503" && x + 1 < f)
|
|
7818
|
-
await
|
|
7812
|
+
await dt(p);
|
|
7819
7813
|
else
|
|
7820
7814
|
throw A;
|
|
7821
7815
|
}
|
|
7822
7816
|
const y = this.parseJsResponse(g);
|
|
7823
7817
|
if (y.stream === "")
|
|
7824
|
-
throw T.errorForCode(
|
|
7818
|
+
throw T.errorForCode(k.JetStreamInvalidAck);
|
|
7825
7819
|
return y.duplicate = y.duplicate ? y.duplicate : !1, y;
|
|
7826
7820
|
}
|
|
7827
7821
|
async pull(t, s, i = 0) {
|
|
7828
|
-
pe(t),
|
|
7822
|
+
pe(t), ot(s);
|
|
7829
7823
|
let n = this.timeout;
|
|
7830
7824
|
i > n && (n = i), i = i < 0 ? 0 : W(i);
|
|
7831
7825
|
const o = {
|
|
@@ -7835,13 +7829,13 @@ class rr extends Tt {
|
|
|
7835
7829
|
}, a = await this.nc.request(`${this.prefix}.CONSUMER.MSG.NEXT.${t}.${s}`, this.jc.encode(o), {
|
|
7836
7830
|
noMux: !0,
|
|
7837
7831
|
timeout: n
|
|
7838
|
-
}), f =
|
|
7832
|
+
}), f = at(a);
|
|
7839
7833
|
if (f)
|
|
7840
7834
|
throw f;
|
|
7841
7835
|
return Nt(a, this.timeout);
|
|
7842
7836
|
}
|
|
7843
7837
|
fetch(t, s, i = {}) {
|
|
7844
|
-
pe(t),
|
|
7838
|
+
pe(t), ot(s);
|
|
7845
7839
|
let n = null;
|
|
7846
7840
|
const o = (i.max_bytes ?? 0) > 0;
|
|
7847
7841
|
let a = 0;
|
|
@@ -7872,16 +7866,16 @@ class rr extends Tt {
|
|
|
7872
7866
|
const J = qe(this.nc.options.inboxPrefix), ee = this.nc.subscribe(J, {
|
|
7873
7867
|
max: i.batch,
|
|
7874
7868
|
callback: (L, Q) => {
|
|
7875
|
-
L === null && (L =
|
|
7869
|
+
L === null && (L = at(Q)), L !== null ? (n && (n.cancel(), n = null), tn(L) ? A.stop(bi(L) === null ? void 0 : L) : A.stop(L)) : (p == null || p.work(), A.received++, A.push(Nt(Q, this.timeout)));
|
|
7876
7870
|
}
|
|
7877
7871
|
});
|
|
7878
|
-
return y && (n =
|
|
7872
|
+
return y && (n = ut(y), n.catch(() => {
|
|
7879
7873
|
ee.isClosed() || (ee.drain().catch(() => {
|
|
7880
7874
|
}), n = null), p && p.cancel();
|
|
7881
7875
|
})), (async () => {
|
|
7882
7876
|
try {
|
|
7883
7877
|
x && (p = new er(x, (L) => (A.push(() => {
|
|
7884
|
-
A.err = new T(`${Pe.IdleHeartbeatMissed}: ${L}`,
|
|
7878
|
+
A.err = new T(`${Pe.IdleHeartbeatMissed}: ${L}`, k.JetStreamIdleHeartBeat);
|
|
7885
7879
|
}), !0)));
|
|
7886
7880
|
} catch {
|
|
7887
7881
|
}
|
|
@@ -7932,15 +7926,15 @@ class rr extends Tt {
|
|
|
7932
7926
|
stream_seq: 0,
|
|
7933
7927
|
delivery_seq: 0
|
|
7934
7928
|
}, i.config.ack_policy !== ce.NotSet && i.config.ack_policy !== ce.None)
|
|
7935
|
-
throw new T("ordered consumer: ack_policy can only be set to 'none'",
|
|
7929
|
+
throw new T("ordered consumer: ack_policy can only be set to 'none'", k.ApiError);
|
|
7936
7930
|
if (i.config.durable_name && i.config.durable_name.length > 0)
|
|
7937
|
-
throw new T("ordered consumer: durable_name cannot be set",
|
|
7931
|
+
throw new T("ordered consumer: durable_name cannot be set", k.ApiError);
|
|
7938
7932
|
if (i.config.deliver_subject && i.config.deliver_subject.length > 0)
|
|
7939
|
-
throw new T("ordered consumer: deliver_subject cannot be set",
|
|
7933
|
+
throw new T("ordered consumer: deliver_subject cannot be set", k.ApiError);
|
|
7940
7934
|
if (i.config.max_deliver !== void 0 && i.config.max_deliver > 1)
|
|
7941
|
-
throw new T("ordered consumer: max_deliver cannot be set",
|
|
7935
|
+
throw new T("ordered consumer: max_deliver cannot be set", k.ApiError);
|
|
7942
7936
|
if (i.config.deliver_group && i.config.deliver_group.length > 0)
|
|
7943
|
-
throw new T("ordered consumer: deliver_group cannot be set",
|
|
7937
|
+
throw new T("ordered consumer: deliver_group cannot be set", k.ApiError);
|
|
7944
7938
|
i.config.deliver_subject = qe(this.nc.options.inboxPrefix), i.config.ack_policy = ce.None, i.config.max_deliver = 1, i.config.flow_control = !0, i.config.idle_heartbeat = i.config.idle_heartbeat || W(5e3), i.config.ack_wait = W(22 * 60 * 60 * 1e3), i.config.mem_storage = !0, i.config.num_replicas = 1;
|
|
7945
7939
|
}
|
|
7946
7940
|
if (i.config.ack_policy === ce.NotSet && (i.config.ack_policy = ce.All), i.api = this, i.config = i.config || {}, i.stream = i.stream ? i.stream : await this.findStream(t), i.attached = !1, i.config.durable_name)
|
|
@@ -7979,7 +7973,7 @@ class rr extends Tt {
|
|
|
7979
7973
|
deliver_policy: se.All,
|
|
7980
7974
|
ack_policy: ce.Explicit,
|
|
7981
7975
|
ack_wait: W(30 * 1e3),
|
|
7982
|
-
replay_policy:
|
|
7976
|
+
replay_policy: lt.Instant
|
|
7983
7977
|
}, t.config);
|
|
7984
7978
|
const s = await this.consumerAPI.add(t.stream, t.config);
|
|
7985
7979
|
if (Array.isArray(t.config.filter_subjects && !Array.isArray(s.config.filter_subjects)))
|
|
@@ -7995,7 +7989,7 @@ class rr extends Tt {
|
|
|
7995
7989
|
protocol: !1
|
|
7996
7990
|
};
|
|
7997
7991
|
const o = s;
|
|
7998
|
-
if (
|
|
7992
|
+
if (at(o.msg) || (f = n.monitor) == null || f.work(), Ls(o.msg)) {
|
|
7999
7993
|
const p = t ? n._checkHbOrderConsumer(o.msg) : !0;
|
|
8000
7994
|
return t || n.info.flow_control.heartbeat_count++, {
|
|
8001
7995
|
ingest: p,
|
|
@@ -8045,11 +8039,11 @@ class ir {
|
|
|
8045
8039
|
}
|
|
8046
8040
|
_check(e, t, s) {
|
|
8047
8041
|
if (this.isClosed())
|
|
8048
|
-
throw T.errorForCode(
|
|
8042
|
+
throw T.errorForCode(k.ConnectionClosed);
|
|
8049
8043
|
if (t && this.isDraining() || s && this.protocol.noMorePublishing)
|
|
8050
|
-
throw T.errorForCode(
|
|
8044
|
+
throw T.errorForCode(k.ConnectionDraining);
|
|
8051
8045
|
if (e = e || "", e.length === 0)
|
|
8052
|
-
throw T.errorForCode(
|
|
8046
|
+
throw T.errorForCode(k.BadSubject);
|
|
8053
8047
|
}
|
|
8054
8048
|
publish(e, t, s) {
|
|
8055
8049
|
this._check(e, !1, !0), this.protocol.publish(e, t, s);
|
|
@@ -8087,7 +8081,7 @@ class ir {
|
|
|
8087
8081
|
return Promise.reject(f);
|
|
8088
8082
|
}
|
|
8089
8083
|
if (s.strategy = s.strategy || Ne.Timer, s.maxWait = s.maxWait || 1e3, s.maxWait < 1)
|
|
8090
|
-
return Promise.reject(new T("timeout",
|
|
8084
|
+
return Promise.reject(new T("timeout", k.InvalidOption));
|
|
8091
8085
|
const n = new he();
|
|
8092
8086
|
function o(f) {
|
|
8093
8087
|
n.push(() => {
|
|
@@ -8103,7 +8097,7 @@ class ir {
|
|
|
8103
8097
|
const g = this.subscribe(qe(this.options.inboxPrefix), {
|
|
8104
8098
|
callback: (I, N) => {
|
|
8105
8099
|
var J, ee;
|
|
8106
|
-
if (((J = N == null ? void 0 : N.data) == null ? void 0 : J.length) === 0 && ((ee = N == null ? void 0 : N.headers) == null ? void 0 : ee.status) ===
|
|
8100
|
+
if (((J = N == null ? void 0 : N.data) == null ? void 0 : J.length) === 0 && ((ee = N == null ? void 0 : N.headers) == null ? void 0 : ee.status) === k.NoResponders && (I = T.errorForCode(k.NoResponders)), I) {
|
|
8107
8101
|
f && (I.stack += `
|
|
8108
8102
|
|
|
8109
8103
|
${f}`), y(I);
|
|
@@ -8177,15 +8171,15 @@ ${f}`), y(I);
|
|
|
8177
8171
|
}
|
|
8178
8172
|
const i = !this.protocol.options.noAsyncTraces;
|
|
8179
8173
|
if (s.timeout = s.timeout || 1e3, s.timeout < 1)
|
|
8180
|
-
return Promise.reject(new T("timeout",
|
|
8174
|
+
return Promise.reject(new T("timeout", k.InvalidOption));
|
|
8181
8175
|
if (!s.noMux && s.reply)
|
|
8182
|
-
return Promise.reject(new T("reply can only be used with noMux",
|
|
8176
|
+
return Promise.reject(new T("reply can only be used with noMux", k.InvalidOption));
|
|
8183
8177
|
if (s.noMux) {
|
|
8184
8178
|
const n = s.reply ? s.reply : qe(this.options.inboxPrefix), o = Y(), a = i ? new Error() : null, f = this.subscribe(n, {
|
|
8185
8179
|
max: 1,
|
|
8186
8180
|
timeout: s.timeout,
|
|
8187
8181
|
callback: (p, g) => {
|
|
8188
|
-
p ? (a && p.code !==
|
|
8182
|
+
p ? (a && p.code !== k.Timeout && (p.stack += `
|
|
8189
8183
|
|
|
8190
8184
|
${a.stack}`), f.unsubscribe(), o.reject(p)) : (p = ei(g), p ? (a && (p.stack += `
|
|
8191
8185
|
|
|
@@ -8217,10 +8211,10 @@ ${a.stack}`), o.reject(p)) : o.resolve(g));
|
|
|
8217
8211
|
}
|
|
8218
8212
|
}
|
|
8219
8213
|
flush() {
|
|
8220
|
-
return this.isClosed() ? Promise.reject(T.errorForCode(
|
|
8214
|
+
return this.isClosed() ? Promise.reject(T.errorForCode(k.ConnectionClosed)) : this.protocol.flush();
|
|
8221
8215
|
}
|
|
8222
8216
|
drain() {
|
|
8223
|
-
return this.isClosed() ? Promise.reject(T.errorForCode(
|
|
8217
|
+
return this.isClosed() ? Promise.reject(T.errorForCode(k.ConnectionClosed)) : this.isDraining() ? Promise.reject(T.errorForCode(k.ConnectionDraining)) : (this.draining = !0, this.protocol.drain());
|
|
8224
8218
|
}
|
|
8225
8219
|
isClosed() {
|
|
8226
8220
|
return this.protocol.isClosed();
|
|
@@ -8260,7 +8254,7 @@ ${a.stack}`), o.reject(p)) : o.resolve(g));
|
|
|
8260
8254
|
await t.getAccountInfo();
|
|
8261
8255
|
} catch (s) {
|
|
8262
8256
|
const i = s;
|
|
8263
|
-
throw i.code ===
|
|
8257
|
+
throw i.code === k.NoResponders && (i.code = k.JetStreamNotEnabled), i;
|
|
8264
8258
|
}
|
|
8265
8259
|
return t;
|
|
8266
8260
|
}
|
|
@@ -8269,11 +8263,11 @@ ${a.stack}`), o.reject(p)) : o.resolve(g));
|
|
|
8269
8263
|
}
|
|
8270
8264
|
getServerVersion() {
|
|
8271
8265
|
const e = this.info;
|
|
8272
|
-
return e ?
|
|
8266
|
+
return e ? Ze(e.version) : void 0;
|
|
8273
8267
|
}
|
|
8274
8268
|
async rtt() {
|
|
8275
8269
|
if (!this.protocol._closed && !this.protocol.connected)
|
|
8276
|
-
throw T.errorForCode(
|
|
8270
|
+
throw T.errorForCode(k.Disconnect);
|
|
8277
8271
|
const e = Date.now();
|
|
8278
8272
|
return await this.flush(), Date.now() - e;
|
|
8279
8273
|
}
|
|
@@ -8284,7 +8278,7 @@ ${a.stack}`), o.reject(p)) : o.resolve(g));
|
|
|
8284
8278
|
return this._services || (this._services = new Wo(this)), this._services;
|
|
8285
8279
|
}
|
|
8286
8280
|
reconnect() {
|
|
8287
|
-
return this.isClosed() ? Promise.reject(T.errorForCode(
|
|
8281
|
+
return this.isClosed() ? Promise.reject(T.errorForCode(k.ConnectionClosed)) : this.isDraining() ? Promise.reject(T.errorForCode(k.ConnectionDraining)) : this.protocol.reconnect();
|
|
8288
8282
|
}
|
|
8289
8283
|
}
|
|
8290
8284
|
class Wo {
|
|
@@ -8300,7 +8294,7 @@ class Wo {
|
|
|
8300
8294
|
}
|
|
8301
8295
|
}
|
|
8302
8296
|
client(e, t) {
|
|
8303
|
-
return new
|
|
8297
|
+
return new Oo(this.nc, e, t);
|
|
8304
8298
|
}
|
|
8305
8299
|
}
|
|
8306
8300
|
class Yo {
|
|
@@ -8405,7 +8399,7 @@ class mi extends Pn {
|
|
|
8405
8399
|
const p = f, g = this.sub.info;
|
|
8406
8400
|
g.last = p, this.info.config = p.config, this.info.name = p.name;
|
|
8407
8401
|
}).catch((f) => {
|
|
8408
|
-
const p = new T(`unable to recreate ordered consumer ${n.stream} at seq ${t}`,
|
|
8402
|
+
const p = new T(`unable to recreate ordered consumer ${n.stream} at seq ${t}`, k.RequestError, f);
|
|
8409
8403
|
this.sub.callback(p, {});
|
|
8410
8404
|
});
|
|
8411
8405
|
}
|
|
@@ -8492,7 +8486,7 @@ function ea(r) {
|
|
|
8492
8486
|
return (e, t) => e ? [
|
|
8493
8487
|
e,
|
|
8494
8488
|
null
|
|
8495
|
-
] : (e =
|
|
8489
|
+
] : (e = at(t), e ? [
|
|
8496
8490
|
e,
|
|
8497
8491
|
null
|
|
8498
8492
|
] : [
|
|
@@ -8507,7 +8501,7 @@ function ta(r) {
|
|
|
8507
8501
|
e,
|
|
8508
8502
|
null
|
|
8509
8503
|
];
|
|
8510
|
-
const s =
|
|
8504
|
+
const s = at(t);
|
|
8511
8505
|
return s !== null ? [
|
|
8512
8506
|
bi(s),
|
|
8513
8507
|
null
|
|
@@ -8520,10 +8514,10 @@ function ta(r) {
|
|
|
8520
8514
|
function bi(r) {
|
|
8521
8515
|
if (r !== null)
|
|
8522
8516
|
switch (r.code) {
|
|
8523
|
-
case
|
|
8524
|
-
case
|
|
8517
|
+
case k.JetStream404NoMessages:
|
|
8518
|
+
case k.JetStream408RequestTimeout:
|
|
8525
8519
|
return null;
|
|
8526
|
-
case
|
|
8520
|
+
case k.JetStream409:
|
|
8527
8521
|
return an(r) ? r : null;
|
|
8528
8522
|
default:
|
|
8529
8523
|
return r;
|
|
@@ -8625,7 +8619,7 @@ class ia {
|
|
|
8625
8619
|
}) {
|
|
8626
8620
|
const s = {};
|
|
8627
8621
|
s.batch = t.batch || 1, s.no_wait = t.no_wait || !1, t.expires && t.expires > 0 && (s.expires = W(t.expires));
|
|
8628
|
-
const i =
|
|
8622
|
+
const i = Oe().encode(s), n = ft.concat(qo, Bo, i), o = e ? {
|
|
8629
8623
|
reply: e
|
|
8630
8624
|
} : void 0;
|
|
8631
8625
|
this.msg.respond(n, o);
|
|
@@ -8662,7 +8656,7 @@ class aa {
|
|
|
8662
8656
|
async connect(e, t) {
|
|
8663
8657
|
const s = Y();
|
|
8664
8658
|
if (t.tls)
|
|
8665
|
-
return s.reject(new T("tls",
|
|
8659
|
+
return s.reject(new T("tls", k.InvalidOption)), s;
|
|
8666
8660
|
this.options = t;
|
|
8667
8661
|
const i = e.src;
|
|
8668
8662
|
if (t.wsFactory) {
|
|
@@ -8679,7 +8673,7 @@ class aa {
|
|
|
8679
8673
|
this.signal.resolve();
|
|
8680
8674
|
return;
|
|
8681
8675
|
}
|
|
8682
|
-
const o =
|
|
8676
|
+
const o = ft.concat(...this.yields), a = Rn(o);
|
|
8683
8677
|
if (a !== "") {
|
|
8684
8678
|
const f = wo.exec(a);
|
|
8685
8679
|
if (!f) {
|
|
@@ -8703,7 +8697,7 @@ class aa {
|
|
|
8703
8697
|
}, this.socket.onerror = (n) => {
|
|
8704
8698
|
if (this.isDiscarded())
|
|
8705
8699
|
return;
|
|
8706
|
-
const o = n, a = new T(o.message,
|
|
8700
|
+
const o = n, a = new T(o.message, k.Unknown, new Error(o.error));
|
|
8707
8701
|
s.reject(a);
|
|
8708
8702
|
}, s;
|
|
8709
8703
|
}
|
|
@@ -8714,7 +8708,7 @@ class aa {
|
|
|
8714
8708
|
if (!this.isDiscarded() && this.connected && !this.done) {
|
|
8715
8709
|
if (this.closeError = e, !e)
|
|
8716
8710
|
for (; !this.socketClosed && this.socket.bufferedAmount > 0; )
|
|
8717
|
-
await
|
|
8711
|
+
await dt(100);
|
|
8718
8712
|
this.done = !0;
|
|
8719
8713
|
try {
|
|
8720
8714
|
this.socket.close(e ? 1002 : 1e3, e ? e.message : void 0);
|
|
@@ -8798,13 +8792,13 @@ function ca(r, e) {
|
|
|
8798
8792
|
return `${n}//${a}:${o}${f}${p}`;
|
|
8799
8793
|
}
|
|
8800
8794
|
function ha(r = {}) {
|
|
8801
|
-
return
|
|
8795
|
+
return kn({
|
|
8802
8796
|
defaultPort: 443,
|
|
8803
8797
|
urlParseFn: ca,
|
|
8804
8798
|
factory: () => new aa()
|
|
8805
8799
|
}), ir.connect(r);
|
|
8806
8800
|
}
|
|
8807
|
-
const Be =
|
|
8801
|
+
const Be = Oe();
|
|
8808
8802
|
class Kr {
|
|
8809
8803
|
constructor(e) {
|
|
8810
8804
|
h(this, "onStatusChange");
|
|
@@ -8850,11 +8844,11 @@ class Kr {
|
|
|
8850
8844
|
var A, I;
|
|
8851
8845
|
for await (const N of this.nc.status())
|
|
8852
8846
|
switch (N.type !== He.PingTimer && console.log("[nats] connection status:", N.type), N.type) {
|
|
8853
|
-
case
|
|
8847
|
+
case ke.Reconnect:
|
|
8854
8848
|
(A = this.onStatusChange) == null || A.call(this, !0);
|
|
8855
8849
|
break;
|
|
8856
|
-
case
|
|
8857
|
-
case
|
|
8850
|
+
case ke.Disconnect:
|
|
8851
|
+
case ke.Error:
|
|
8858
8852
|
case He.Reconnecting:
|
|
8859
8853
|
(I = this.onStatusChange) == null || I.call(this, !1);
|
|
8860
8854
|
break;
|