@yorkie-js/sdk 0.6.5 → 0.6.6
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/yorkie-js-sdk.es.js +508 -532
- package/dist/yorkie-js-sdk.es.js.map +1 -1
- package/dist/yorkie-js-sdk.js +508 -532
- package/dist/yorkie-js-sdk.js.map +1 -1
- package/package.json +1 -1
package/dist/yorkie-js-sdk.es.js
CHANGED
|
@@ -3441,6 +3441,7 @@ function makeAnyClient(service, createMethod) {
|
|
|
3441
3441
|
}
|
|
3442
3442
|
return client;
|
|
3443
3443
|
}
|
|
3444
|
+
const compressedFlag = 1;
|
|
3444
3445
|
function createEnvelopeReadableStream(stream) {
|
|
3445
3446
|
let reader;
|
|
3446
3447
|
let buffer = new Uint8Array(0);
|
|
@@ -3655,7 +3656,7 @@ var __asyncGenerator$1 = function(thisArg, _arguments, generator) {
|
|
|
3655
3656
|
if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]);
|
|
3656
3657
|
}
|
|
3657
3658
|
};
|
|
3658
|
-
function
|
|
3659
|
+
function createClient(service, transport) {
|
|
3659
3660
|
return makeAnyClient(service, (method) => {
|
|
3660
3661
|
switch (method.kind) {
|
|
3661
3662
|
case MethodKind.Unary:
|
|
@@ -3671,6 +3672,9 @@ function createPromiseClient(service, transport) {
|
|
|
3671
3672
|
}
|
|
3672
3673
|
});
|
|
3673
3674
|
}
|
|
3675
|
+
function createPromiseClient(service, transport) {
|
|
3676
|
+
return createClient(service, transport);
|
|
3677
|
+
}
|
|
3674
3678
|
function createUnaryFn(transport, service, method) {
|
|
3675
3679
|
return async function(input, options) {
|
|
3676
3680
|
var _a2, _b2;
|
|
@@ -3692,12 +3696,14 @@ function createClientStreamingFn(transport, service, method) {
|
|
|
3692
3696
|
const response = await transport.stream(service, method, options === null || options === void 0 ? void 0 : options.signal, options === null || options === void 0 ? void 0 : options.timeoutMs, options === null || options === void 0 ? void 0 : options.headers, request, options === null || options === void 0 ? void 0 : options.contextValues);
|
|
3693
3697
|
(_d2 = options === null || options === void 0 ? void 0 : options.onHeader) === null || _d2 === void 0 ? void 0 : _d2.call(options, response.header);
|
|
3694
3698
|
let singleMessage;
|
|
3699
|
+
let count = 0;
|
|
3695
3700
|
try {
|
|
3696
3701
|
for (var _f2 = true, _g2 = __asyncValues(response.message), _h2; _h2 = await _g2.next(), _a2 = _h2.done, !_a2; _f2 = true) {
|
|
3697
3702
|
_c2 = _h2.value;
|
|
3698
3703
|
_f2 = false;
|
|
3699
3704
|
const message = _c2;
|
|
3700
3705
|
singleMessage = message;
|
|
3706
|
+
count++;
|
|
3701
3707
|
}
|
|
3702
3708
|
} catch (e_1_1) {
|
|
3703
3709
|
e_1 = { error: e_1_1 };
|
|
@@ -3709,7 +3715,10 @@ function createClientStreamingFn(transport, service, method) {
|
|
|
3709
3715
|
}
|
|
3710
3716
|
}
|
|
3711
3717
|
if (!singleMessage) {
|
|
3712
|
-
throw new ConnectError("protocol error: missing response message", Code$1.
|
|
3718
|
+
throw new ConnectError("protocol error: missing response message", Code$1.Unimplemented);
|
|
3719
|
+
}
|
|
3720
|
+
if (count > 1) {
|
|
3721
|
+
throw new ConnectError("protocol error: received extra messages for client streaming method", Code$1.Unimplemented);
|
|
3713
3722
|
}
|
|
3714
3723
|
(_e2 = options === null || options === void 0 ? void 0 : options.onTrailer) === null || _e2 === void 0 ? void 0 : _e2.call(options, response.trailer);
|
|
3715
3724
|
return singleMessage;
|
|
@@ -3722,8 +3731,8 @@ function createBiDiStreamingFn(transport, service, method) {
|
|
|
3722
3731
|
}
|
|
3723
3732
|
function handleStreamResponse(stream, options) {
|
|
3724
3733
|
const it = function() {
|
|
3725
|
-
var _a2, _b2;
|
|
3726
3734
|
return __asyncGenerator$1(this, arguments, function* () {
|
|
3735
|
+
var _a2, _b2;
|
|
3727
3736
|
const response = yield __await$1(stream);
|
|
3728
3737
|
(_a2 = options === null || options === void 0 ? void 0 : options.onHeader) === null || _a2 === void 0 ? void 0 : _a2.call(options, response.header);
|
|
3729
3738
|
yield __await$1(yield* __asyncDelegator(__asyncValues(response.message)));
|
|
@@ -3954,7 +3963,7 @@ function createBinarySerialization(messageType, options) {
|
|
|
3954
3963
|
return messageType.fromBinary(data, options);
|
|
3955
3964
|
} catch (e) {
|
|
3956
3965
|
const m = e instanceof Error ? e.message : String(e);
|
|
3957
|
-
throw new ConnectError(`parse binary: ${m}`, Code$1.
|
|
3966
|
+
throw new ConnectError(`parse binary: ${m}`, Code$1.Internal);
|
|
3958
3967
|
}
|
|
3959
3968
|
},
|
|
3960
3969
|
serialize(data) {
|
|
@@ -4067,12 +4076,15 @@ function validateTrailer(trailer, header) {
|
|
|
4067
4076
|
});
|
|
4068
4077
|
throw err;
|
|
4069
4078
|
}
|
|
4079
|
+
if (!header.has(headerGrpcStatus) && !trailer.has(headerGrpcStatus)) {
|
|
4080
|
+
throw new ConnectError("protocol error: missing status", Code$1.Internal);
|
|
4081
|
+
}
|
|
4070
4082
|
}
|
|
4071
4083
|
function requestHeader(useBinaryFormat, timeoutMs, userProvidedHeaders, setUserAgent) {
|
|
4072
4084
|
const result = new Headers(userProvidedHeaders !== null && userProvidedHeaders !== void 0 ? userProvidedHeaders : {});
|
|
4073
4085
|
result.set(headerContentType, useBinaryFormat ? contentTypeProto : contentTypeJson);
|
|
4074
4086
|
result.set(headerXGrpcWeb, "1");
|
|
4075
|
-
result.set(headerXUserAgent, "connect-es/1.
|
|
4087
|
+
result.set(headerXUserAgent, "connect-es/1.6.1");
|
|
4076
4088
|
if (timeoutMs !== void 0) {
|
|
4077
4089
|
result.set(headerTimeout, `${timeoutMs}m`);
|
|
4078
4090
|
}
|
|
@@ -4103,11 +4115,10 @@ function codeFromHttpStatus(httpStatus) {
|
|
|
4103
4115
|
function validateResponse(status, headers) {
|
|
4104
4116
|
var _a2;
|
|
4105
4117
|
if (status >= 200 && status < 300) {
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
}
|
|
4110
|
-
return { foundStatus: headers.has(headerGrpcStatus) };
|
|
4118
|
+
return {
|
|
4119
|
+
foundStatus: headers.has(headerGrpcStatus),
|
|
4120
|
+
headerError: findTrailerError(headers)
|
|
4121
|
+
};
|
|
4111
4122
|
}
|
|
4112
4123
|
throw new ConnectError(decodeURIComponent((_a2 = headers.get(headerGrpcMessage)) !== null && _a2 !== void 0 ? _a2 : `HTTP ${status}`), codeFromHttpStatus(status), headers);
|
|
4113
4124
|
}
|
|
@@ -4187,8 +4198,10 @@ function createGrpcWebTransport(options) {
|
|
|
4187
4198
|
var _a4;
|
|
4188
4199
|
const fetch2 = (_a4 = options.fetch) !== null && _a4 !== void 0 ? _a4 : globalThis.fetch;
|
|
4189
4200
|
const response = await fetch2(req.url, Object.assign(Object.assign({}, req.init), { headers: req.header, signal: req.signal, body: encodeEnvelope(0, serialize(req.message)) }));
|
|
4190
|
-
validateResponse(response.status, response.headers);
|
|
4201
|
+
const { headerError } = validateResponse(response.status, response.headers);
|
|
4191
4202
|
if (!response.body) {
|
|
4203
|
+
if (headerError !== void 0)
|
|
4204
|
+
throw headerError;
|
|
4192
4205
|
throw "missing response body";
|
|
4193
4206
|
}
|
|
4194
4207
|
const reader = createEnvelopeReadableStream(response.body).getReader();
|
|
@@ -4200,6 +4213,9 @@ function createGrpcWebTransport(options) {
|
|
|
4200
4213
|
break;
|
|
4201
4214
|
}
|
|
4202
4215
|
const { flags, data } = r.value;
|
|
4216
|
+
if ((flags & compressedFlag) === compressedFlag) {
|
|
4217
|
+
throw new ConnectError(`protocol error: received unsupported compressed output`, Code$1.Internal);
|
|
4218
|
+
}
|
|
4203
4219
|
if (flags === trailerFlag) {
|
|
4204
4220
|
if (trailer !== void 0) {
|
|
4205
4221
|
throw "extra trailer";
|
|
@@ -4208,16 +4224,18 @@ function createGrpcWebTransport(options) {
|
|
|
4208
4224
|
continue;
|
|
4209
4225
|
}
|
|
4210
4226
|
if (message2 !== void 0) {
|
|
4211
|
-
throw "extra message";
|
|
4227
|
+
throw new ConnectError("extra message", Code$1.Unimplemented);
|
|
4212
4228
|
}
|
|
4213
4229
|
message2 = parse(data);
|
|
4214
4230
|
}
|
|
4215
4231
|
if (trailer === void 0) {
|
|
4216
|
-
|
|
4232
|
+
if (headerError !== void 0)
|
|
4233
|
+
throw headerError;
|
|
4234
|
+
throw new ConnectError("missing trailer", response.headers.has(headerGrpcStatus) ? Code$1.Unimplemented : Code$1.Unknown);
|
|
4217
4235
|
}
|
|
4218
4236
|
validateTrailer(trailer, response.headers);
|
|
4219
4237
|
if (message2 === void 0) {
|
|
4220
|
-
throw "missing message";
|
|
4238
|
+
throw new ConnectError("missing message", trailer.has(headerGrpcStatus) ? Code$1.Unimplemented : Code$1.Unknown);
|
|
4221
4239
|
}
|
|
4222
4240
|
return {
|
|
4223
4241
|
stream: false,
|
|
@@ -4233,7 +4251,7 @@ function createGrpcWebTransport(options) {
|
|
|
4233
4251
|
async stream(service, method, signal, timeoutMs, header, input, contextValues) {
|
|
4234
4252
|
var _a3;
|
|
4235
4253
|
const { serialize, parse } = createClientMethodSerializers(method, useBinaryFormat, options.jsonOptions, options.binaryOptions);
|
|
4236
|
-
function parseResponseBody(body, foundStatus, trailerTarget, header2) {
|
|
4254
|
+
function parseResponseBody(body, foundStatus, trailerTarget, header2, signal2) {
|
|
4237
4255
|
return __asyncGenerator(this, arguments, function* parseResponseBody_1() {
|
|
4238
4256
|
const reader = createEnvelopeReadableStream(body).getReader();
|
|
4239
4257
|
if (foundStatus) {
|
|
@@ -4263,7 +4281,9 @@ function createGrpcWebTransport(options) {
|
|
|
4263
4281
|
throw "extra message";
|
|
4264
4282
|
}
|
|
4265
4283
|
yield yield __await(parse(data));
|
|
4266
|
-
|
|
4284
|
+
}
|
|
4285
|
+
if ("throwIfAborted" in signal2) {
|
|
4286
|
+
signal2.throwIfAborted();
|
|
4267
4287
|
}
|
|
4268
4288
|
if (!trailerReceived) {
|
|
4269
4289
|
throw "missing trailer";
|
|
@@ -4304,12 +4324,15 @@ function createGrpcWebTransport(options) {
|
|
|
4304
4324
|
var _a4;
|
|
4305
4325
|
const fetch2 = (_a4 = options.fetch) !== null && _a4 !== void 0 ? _a4 : globalThis.fetch;
|
|
4306
4326
|
const fRes = await fetch2(req.url, Object.assign(Object.assign({}, req.init), { headers: req.header, signal: req.signal, body: await createRequestBody(req.message) }));
|
|
4307
|
-
const { foundStatus } = validateResponse(fRes.status, fRes.headers);
|
|
4327
|
+
const { foundStatus, headerError } = validateResponse(fRes.status, fRes.headers);
|
|
4328
|
+
if (headerError != void 0) {
|
|
4329
|
+
throw headerError;
|
|
4330
|
+
}
|
|
4308
4331
|
if (!fRes.body) {
|
|
4309
4332
|
throw "missing response body";
|
|
4310
4333
|
}
|
|
4311
4334
|
const trailer = new Headers();
|
|
4312
|
-
const res = Object.assign(Object.assign({}, req), { header: fRes.headers, trailer, message: parseResponseBody(fRes.body, foundStatus, trailer, fRes.headers) });
|
|
4335
|
+
const res = Object.assign(Object.assign({}, req), { header: fRes.headers, trailer, message: parseResponseBody(fRes.body, foundStatus, trailer, fRes.headers, req.signal) });
|
|
4313
4336
|
return res;
|
|
4314
4337
|
}
|
|
4315
4338
|
});
|
|
@@ -7410,7 +7433,15 @@ const BadRequest_FieldViolation = proto3.makeMessageType(
|
|
|
7410
7433
|
kind: "scalar",
|
|
7411
7434
|
T: 9
|
|
7412
7435
|
/* ScalarType.STRING */
|
|
7413
|
-
}
|
|
7436
|
+
},
|
|
7437
|
+
{
|
|
7438
|
+
no: 3,
|
|
7439
|
+
name: "reason",
|
|
7440
|
+
kind: "scalar",
|
|
7441
|
+
T: 9
|
|
7442
|
+
/* ScalarType.STRING */
|
|
7443
|
+
},
|
|
7444
|
+
{ no: 4, name: "localized_message", kind: "message", T: LocalizedMessage }
|
|
7414
7445
|
],
|
|
7415
7446
|
{ localName: "BadRequest_FieldViolation" }
|
|
7416
7447
|
);
|
|
@@ -7492,7 +7523,7 @@ const Help_Link = proto3.makeMessageType(
|
|
|
7492
7523
|
],
|
|
7493
7524
|
{ localName: "Help_Link" }
|
|
7494
7525
|
);
|
|
7495
|
-
proto3.makeMessageType(
|
|
7526
|
+
const LocalizedMessage = proto3.makeMessageType(
|
|
7496
7527
|
"google.rpc.LocalizedMessage",
|
|
7497
7528
|
() => [
|
|
7498
7529
|
{
|
|
@@ -8657,295 +8688,328 @@ class SplayTree {
|
|
|
8657
8688
|
*/
|
|
8658
8689
|
var wasm = null;
|
|
8659
8690
|
try {
|
|
8660
|
-
wasm = new WebAssembly.Instance(
|
|
8661
|
-
|
|
8662
|
-
|
|
8663
|
-
|
|
8664
|
-
|
|
8665
|
-
|
|
8666
|
-
|
|
8667
|
-
|
|
8668
|
-
|
|
8669
|
-
|
|
8670
|
-
|
|
8671
|
-
|
|
8672
|
-
|
|
8673
|
-
|
|
8674
|
-
|
|
8675
|
-
|
|
8676
|
-
|
|
8677
|
-
|
|
8678
|
-
|
|
8679
|
-
|
|
8680
|
-
|
|
8681
|
-
|
|
8682
|
-
|
|
8683
|
-
|
|
8684
|
-
|
|
8685
|
-
|
|
8686
|
-
|
|
8687
|
-
|
|
8688
|
-
|
|
8689
|
-
|
|
8690
|
-
|
|
8691
|
-
|
|
8692
|
-
|
|
8693
|
-
|
|
8694
|
-
|
|
8695
|
-
|
|
8696
|
-
|
|
8697
|
-
|
|
8698
|
-
|
|
8699
|
-
|
|
8700
|
-
|
|
8701
|
-
|
|
8702
|
-
|
|
8703
|
-
|
|
8704
|
-
|
|
8705
|
-
|
|
8706
|
-
|
|
8707
|
-
|
|
8708
|
-
|
|
8709
|
-
|
|
8710
|
-
|
|
8711
|
-
|
|
8712
|
-
|
|
8713
|
-
|
|
8714
|
-
|
|
8715
|
-
|
|
8716
|
-
|
|
8717
|
-
|
|
8718
|
-
|
|
8719
|
-
|
|
8720
|
-
|
|
8721
|
-
|
|
8722
|
-
|
|
8723
|
-
|
|
8724
|
-
|
|
8725
|
-
|
|
8726
|
-
|
|
8727
|
-
|
|
8728
|
-
|
|
8729
|
-
|
|
8730
|
-
|
|
8731
|
-
|
|
8732
|
-
|
|
8733
|
-
|
|
8734
|
-
|
|
8735
|
-
|
|
8736
|
-
|
|
8737
|
-
|
|
8738
|
-
|
|
8739
|
-
|
|
8740
|
-
|
|
8741
|
-
|
|
8742
|
-
|
|
8743
|
-
|
|
8744
|
-
|
|
8745
|
-
|
|
8746
|
-
|
|
8747
|
-
|
|
8748
|
-
|
|
8749
|
-
|
|
8750
|
-
|
|
8751
|
-
|
|
8752
|
-
|
|
8753
|
-
|
|
8754
|
-
|
|
8755
|
-
|
|
8756
|
-
|
|
8757
|
-
|
|
8758
|
-
|
|
8759
|
-
|
|
8760
|
-
|
|
8761
|
-
|
|
8762
|
-
|
|
8763
|
-
|
|
8764
|
-
|
|
8765
|
-
|
|
8766
|
-
|
|
8767
|
-
|
|
8768
|
-
|
|
8769
|
-
|
|
8770
|
-
|
|
8771
|
-
|
|
8772
|
-
|
|
8773
|
-
|
|
8774
|
-
|
|
8775
|
-
|
|
8776
|
-
|
|
8777
|
-
|
|
8778
|
-
|
|
8779
|
-
|
|
8780
|
-
|
|
8781
|
-
|
|
8782
|
-
|
|
8783
|
-
|
|
8784
|
-
|
|
8785
|
-
|
|
8786
|
-
|
|
8787
|
-
|
|
8788
|
-
|
|
8789
|
-
|
|
8790
|
-
|
|
8791
|
-
|
|
8792
|
-
|
|
8793
|
-
|
|
8794
|
-
|
|
8795
|
-
|
|
8796
|
-
|
|
8797
|
-
|
|
8798
|
-
|
|
8799
|
-
|
|
8800
|
-
|
|
8801
|
-
|
|
8802
|
-
|
|
8803
|
-
|
|
8804
|
-
|
|
8805
|
-
|
|
8806
|
-
|
|
8807
|
-
|
|
8808
|
-
|
|
8809
|
-
|
|
8810
|
-
|
|
8811
|
-
|
|
8812
|
-
|
|
8813
|
-
|
|
8814
|
-
|
|
8815
|
-
|
|
8816
|
-
|
|
8817
|
-
|
|
8818
|
-
|
|
8819
|
-
|
|
8820
|
-
|
|
8821
|
-
|
|
8822
|
-
|
|
8823
|
-
|
|
8824
|
-
|
|
8825
|
-
|
|
8826
|
-
|
|
8827
|
-
|
|
8828
|
-
|
|
8829
|
-
|
|
8830
|
-
|
|
8831
|
-
|
|
8832
|
-
|
|
8833
|
-
|
|
8834
|
-
|
|
8835
|
-
|
|
8836
|
-
|
|
8837
|
-
|
|
8838
|
-
|
|
8839
|
-
|
|
8840
|
-
|
|
8841
|
-
|
|
8842
|
-
|
|
8843
|
-
|
|
8844
|
-
|
|
8845
|
-
|
|
8846
|
-
|
|
8847
|
-
|
|
8848
|
-
|
|
8849
|
-
|
|
8850
|
-
|
|
8851
|
-
|
|
8852
|
-
|
|
8853
|
-
|
|
8854
|
-
|
|
8855
|
-
|
|
8856
|
-
|
|
8857
|
-
|
|
8858
|
-
|
|
8859
|
-
|
|
8860
|
-
|
|
8861
|
-
|
|
8862
|
-
|
|
8863
|
-
|
|
8864
|
-
|
|
8865
|
-
|
|
8866
|
-
|
|
8867
|
-
|
|
8868
|
-
|
|
8869
|
-
|
|
8870
|
-
|
|
8871
|
-
|
|
8872
|
-
|
|
8873
|
-
|
|
8874
|
-
|
|
8875
|
-
|
|
8876
|
-
|
|
8877
|
-
|
|
8878
|
-
|
|
8879
|
-
|
|
8880
|
-
|
|
8881
|
-
|
|
8882
|
-
|
|
8883
|
-
|
|
8884
|
-
|
|
8885
|
-
|
|
8886
|
-
|
|
8887
|
-
|
|
8888
|
-
|
|
8889
|
-
|
|
8890
|
-
|
|
8891
|
-
|
|
8892
|
-
|
|
8893
|
-
|
|
8894
|
-
|
|
8895
|
-
|
|
8896
|
-
|
|
8897
|
-
|
|
8898
|
-
|
|
8899
|
-
|
|
8900
|
-
|
|
8901
|
-
|
|
8902
|
-
|
|
8903
|
-
|
|
8904
|
-
|
|
8905
|
-
|
|
8906
|
-
|
|
8907
|
-
|
|
8908
|
-
|
|
8909
|
-
|
|
8910
|
-
|
|
8911
|
-
|
|
8912
|
-
|
|
8913
|
-
|
|
8914
|
-
|
|
8915
|
-
|
|
8916
|
-
|
|
8917
|
-
|
|
8918
|
-
|
|
8919
|
-
|
|
8920
|
-
|
|
8921
|
-
|
|
8922
|
-
|
|
8923
|
-
|
|
8924
|
-
|
|
8925
|
-
|
|
8926
|
-
|
|
8927
|
-
|
|
8928
|
-
|
|
8929
|
-
|
|
8930
|
-
|
|
8931
|
-
|
|
8932
|
-
|
|
8933
|
-
|
|
8934
|
-
|
|
8935
|
-
|
|
8936
|
-
|
|
8937
|
-
|
|
8938
|
-
|
|
8939
|
-
|
|
8940
|
-
|
|
8941
|
-
|
|
8942
|
-
|
|
8943
|
-
|
|
8944
|
-
|
|
8945
|
-
|
|
8946
|
-
|
|
8947
|
-
|
|
8948
|
-
|
|
8691
|
+
wasm = new WebAssembly.Instance(
|
|
8692
|
+
new WebAssembly.Module(
|
|
8693
|
+
new Uint8Array([
|
|
8694
|
+
// \0asm
|
|
8695
|
+
0,
|
|
8696
|
+
97,
|
|
8697
|
+
115,
|
|
8698
|
+
109,
|
|
8699
|
+
// version 1
|
|
8700
|
+
1,
|
|
8701
|
+
0,
|
|
8702
|
+
0,
|
|
8703
|
+
0,
|
|
8704
|
+
// section "type"
|
|
8705
|
+
1,
|
|
8706
|
+
13,
|
|
8707
|
+
2,
|
|
8708
|
+
// 0, () => i32
|
|
8709
|
+
96,
|
|
8710
|
+
0,
|
|
8711
|
+
1,
|
|
8712
|
+
127,
|
|
8713
|
+
// 1, (i32, i32, i32, i32) => i32
|
|
8714
|
+
96,
|
|
8715
|
+
4,
|
|
8716
|
+
127,
|
|
8717
|
+
127,
|
|
8718
|
+
127,
|
|
8719
|
+
127,
|
|
8720
|
+
1,
|
|
8721
|
+
127,
|
|
8722
|
+
// section "function"
|
|
8723
|
+
3,
|
|
8724
|
+
7,
|
|
8725
|
+
6,
|
|
8726
|
+
// 0, type 0
|
|
8727
|
+
0,
|
|
8728
|
+
// 1, type 1
|
|
8729
|
+
1,
|
|
8730
|
+
// 2, type 1
|
|
8731
|
+
1,
|
|
8732
|
+
// 3, type 1
|
|
8733
|
+
1,
|
|
8734
|
+
// 4, type 1
|
|
8735
|
+
1,
|
|
8736
|
+
// 5, type 1
|
|
8737
|
+
1,
|
|
8738
|
+
// section "global"
|
|
8739
|
+
6,
|
|
8740
|
+
6,
|
|
8741
|
+
1,
|
|
8742
|
+
// 0, "high", mutable i32
|
|
8743
|
+
127,
|
|
8744
|
+
1,
|
|
8745
|
+
65,
|
|
8746
|
+
0,
|
|
8747
|
+
11,
|
|
8748
|
+
// section "export"
|
|
8749
|
+
7,
|
|
8750
|
+
50,
|
|
8751
|
+
6,
|
|
8752
|
+
// 0, "mul"
|
|
8753
|
+
3,
|
|
8754
|
+
109,
|
|
8755
|
+
117,
|
|
8756
|
+
108,
|
|
8757
|
+
0,
|
|
8758
|
+
1,
|
|
8759
|
+
// 1, "div_s"
|
|
8760
|
+
5,
|
|
8761
|
+
100,
|
|
8762
|
+
105,
|
|
8763
|
+
118,
|
|
8764
|
+
95,
|
|
8765
|
+
115,
|
|
8766
|
+
0,
|
|
8767
|
+
2,
|
|
8768
|
+
// 2, "div_u"
|
|
8769
|
+
5,
|
|
8770
|
+
100,
|
|
8771
|
+
105,
|
|
8772
|
+
118,
|
|
8773
|
+
95,
|
|
8774
|
+
117,
|
|
8775
|
+
0,
|
|
8776
|
+
3,
|
|
8777
|
+
// 3, "rem_s"
|
|
8778
|
+
5,
|
|
8779
|
+
114,
|
|
8780
|
+
101,
|
|
8781
|
+
109,
|
|
8782
|
+
95,
|
|
8783
|
+
115,
|
|
8784
|
+
0,
|
|
8785
|
+
4,
|
|
8786
|
+
// 4, "rem_u"
|
|
8787
|
+
5,
|
|
8788
|
+
114,
|
|
8789
|
+
101,
|
|
8790
|
+
109,
|
|
8791
|
+
95,
|
|
8792
|
+
117,
|
|
8793
|
+
0,
|
|
8794
|
+
5,
|
|
8795
|
+
// 5, "get_high"
|
|
8796
|
+
8,
|
|
8797
|
+
103,
|
|
8798
|
+
101,
|
|
8799
|
+
116,
|
|
8800
|
+
95,
|
|
8801
|
+
104,
|
|
8802
|
+
105,
|
|
8803
|
+
103,
|
|
8804
|
+
104,
|
|
8805
|
+
0,
|
|
8806
|
+
0,
|
|
8807
|
+
// section "code"
|
|
8808
|
+
10,
|
|
8809
|
+
191,
|
|
8810
|
+
1,
|
|
8811
|
+
6,
|
|
8812
|
+
// 0, "get_high"
|
|
8813
|
+
4,
|
|
8814
|
+
0,
|
|
8815
|
+
35,
|
|
8816
|
+
0,
|
|
8817
|
+
11,
|
|
8818
|
+
// 1, "mul"
|
|
8819
|
+
36,
|
|
8820
|
+
1,
|
|
8821
|
+
1,
|
|
8822
|
+
126,
|
|
8823
|
+
32,
|
|
8824
|
+
0,
|
|
8825
|
+
173,
|
|
8826
|
+
32,
|
|
8827
|
+
1,
|
|
8828
|
+
173,
|
|
8829
|
+
66,
|
|
8830
|
+
32,
|
|
8831
|
+
134,
|
|
8832
|
+
132,
|
|
8833
|
+
32,
|
|
8834
|
+
2,
|
|
8835
|
+
173,
|
|
8836
|
+
32,
|
|
8837
|
+
3,
|
|
8838
|
+
173,
|
|
8839
|
+
66,
|
|
8840
|
+
32,
|
|
8841
|
+
134,
|
|
8842
|
+
132,
|
|
8843
|
+
126,
|
|
8844
|
+
34,
|
|
8845
|
+
4,
|
|
8846
|
+
66,
|
|
8847
|
+
32,
|
|
8848
|
+
135,
|
|
8849
|
+
167,
|
|
8850
|
+
36,
|
|
8851
|
+
0,
|
|
8852
|
+
32,
|
|
8853
|
+
4,
|
|
8854
|
+
167,
|
|
8855
|
+
11,
|
|
8856
|
+
// 2, "div_s"
|
|
8857
|
+
36,
|
|
8858
|
+
1,
|
|
8859
|
+
1,
|
|
8860
|
+
126,
|
|
8861
|
+
32,
|
|
8862
|
+
0,
|
|
8863
|
+
173,
|
|
8864
|
+
32,
|
|
8865
|
+
1,
|
|
8866
|
+
173,
|
|
8867
|
+
66,
|
|
8868
|
+
32,
|
|
8869
|
+
134,
|
|
8870
|
+
132,
|
|
8871
|
+
32,
|
|
8872
|
+
2,
|
|
8873
|
+
173,
|
|
8874
|
+
32,
|
|
8875
|
+
3,
|
|
8876
|
+
173,
|
|
8877
|
+
66,
|
|
8878
|
+
32,
|
|
8879
|
+
134,
|
|
8880
|
+
132,
|
|
8881
|
+
127,
|
|
8882
|
+
34,
|
|
8883
|
+
4,
|
|
8884
|
+
66,
|
|
8885
|
+
32,
|
|
8886
|
+
135,
|
|
8887
|
+
167,
|
|
8888
|
+
36,
|
|
8889
|
+
0,
|
|
8890
|
+
32,
|
|
8891
|
+
4,
|
|
8892
|
+
167,
|
|
8893
|
+
11,
|
|
8894
|
+
// 3, "div_u"
|
|
8895
|
+
36,
|
|
8896
|
+
1,
|
|
8897
|
+
1,
|
|
8898
|
+
126,
|
|
8899
|
+
32,
|
|
8900
|
+
0,
|
|
8901
|
+
173,
|
|
8902
|
+
32,
|
|
8903
|
+
1,
|
|
8904
|
+
173,
|
|
8905
|
+
66,
|
|
8906
|
+
32,
|
|
8907
|
+
134,
|
|
8908
|
+
132,
|
|
8909
|
+
32,
|
|
8910
|
+
2,
|
|
8911
|
+
173,
|
|
8912
|
+
32,
|
|
8913
|
+
3,
|
|
8914
|
+
173,
|
|
8915
|
+
66,
|
|
8916
|
+
32,
|
|
8917
|
+
134,
|
|
8918
|
+
132,
|
|
8919
|
+
128,
|
|
8920
|
+
34,
|
|
8921
|
+
4,
|
|
8922
|
+
66,
|
|
8923
|
+
32,
|
|
8924
|
+
135,
|
|
8925
|
+
167,
|
|
8926
|
+
36,
|
|
8927
|
+
0,
|
|
8928
|
+
32,
|
|
8929
|
+
4,
|
|
8930
|
+
167,
|
|
8931
|
+
11,
|
|
8932
|
+
// 4, "rem_s"
|
|
8933
|
+
36,
|
|
8934
|
+
1,
|
|
8935
|
+
1,
|
|
8936
|
+
126,
|
|
8937
|
+
32,
|
|
8938
|
+
0,
|
|
8939
|
+
173,
|
|
8940
|
+
32,
|
|
8941
|
+
1,
|
|
8942
|
+
173,
|
|
8943
|
+
66,
|
|
8944
|
+
32,
|
|
8945
|
+
134,
|
|
8946
|
+
132,
|
|
8947
|
+
32,
|
|
8948
|
+
2,
|
|
8949
|
+
173,
|
|
8950
|
+
32,
|
|
8951
|
+
3,
|
|
8952
|
+
173,
|
|
8953
|
+
66,
|
|
8954
|
+
32,
|
|
8955
|
+
134,
|
|
8956
|
+
132,
|
|
8957
|
+
129,
|
|
8958
|
+
34,
|
|
8959
|
+
4,
|
|
8960
|
+
66,
|
|
8961
|
+
32,
|
|
8962
|
+
135,
|
|
8963
|
+
167,
|
|
8964
|
+
36,
|
|
8965
|
+
0,
|
|
8966
|
+
32,
|
|
8967
|
+
4,
|
|
8968
|
+
167,
|
|
8969
|
+
11,
|
|
8970
|
+
// 5, "rem_u"
|
|
8971
|
+
36,
|
|
8972
|
+
1,
|
|
8973
|
+
1,
|
|
8974
|
+
126,
|
|
8975
|
+
32,
|
|
8976
|
+
0,
|
|
8977
|
+
173,
|
|
8978
|
+
32,
|
|
8979
|
+
1,
|
|
8980
|
+
173,
|
|
8981
|
+
66,
|
|
8982
|
+
32,
|
|
8983
|
+
134,
|
|
8984
|
+
132,
|
|
8985
|
+
32,
|
|
8986
|
+
2,
|
|
8987
|
+
173,
|
|
8988
|
+
32,
|
|
8989
|
+
3,
|
|
8990
|
+
173,
|
|
8991
|
+
66,
|
|
8992
|
+
32,
|
|
8993
|
+
134,
|
|
8994
|
+
132,
|
|
8995
|
+
130,
|
|
8996
|
+
34,
|
|
8997
|
+
4,
|
|
8998
|
+
66,
|
|
8999
|
+
32,
|
|
9000
|
+
135,
|
|
9001
|
+
167,
|
|
9002
|
+
36,
|
|
9003
|
+
0,
|
|
9004
|
+
32,
|
|
9005
|
+
4,
|
|
9006
|
+
167,
|
|
9007
|
+
11
|
|
9008
|
+
])
|
|
9009
|
+
),
|
|
9010
|
+
{}
|
|
9011
|
+
).exports;
|
|
9012
|
+
} catch {
|
|
8949
9013
|
}
|
|
8950
9014
|
function Long(low, high, unsigned) {
|
|
8951
9015
|
this.low = low | 0;
|
|
@@ -8970,44 +9034,38 @@ function fromInt(value, unsigned) {
|
|
|
8970
9034
|
value >>>= 0;
|
|
8971
9035
|
if (cache = 0 <= value && value < 256) {
|
|
8972
9036
|
cachedObj = UINT_CACHE[value];
|
|
8973
|
-
if (cachedObj)
|
|
8974
|
-
return cachedObj;
|
|
9037
|
+
if (cachedObj) return cachedObj;
|
|
8975
9038
|
}
|
|
8976
9039
|
obj = fromBits(value, 0, true);
|
|
8977
|
-
if (cache)
|
|
8978
|
-
UINT_CACHE[value] = obj;
|
|
9040
|
+
if (cache) UINT_CACHE[value] = obj;
|
|
8979
9041
|
return obj;
|
|
8980
9042
|
} else {
|
|
8981
9043
|
value |= 0;
|
|
8982
9044
|
if (cache = -128 <= value && value < 128) {
|
|
8983
9045
|
cachedObj = INT_CACHE[value];
|
|
8984
|
-
if (cachedObj)
|
|
8985
|
-
return cachedObj;
|
|
9046
|
+
if (cachedObj) return cachedObj;
|
|
8986
9047
|
}
|
|
8987
9048
|
obj = fromBits(value, value < 0 ? -1 : 0, false);
|
|
8988
|
-
if (cache)
|
|
8989
|
-
INT_CACHE[value] = obj;
|
|
9049
|
+
if (cache) INT_CACHE[value] = obj;
|
|
8990
9050
|
return obj;
|
|
8991
9051
|
}
|
|
8992
9052
|
}
|
|
8993
9053
|
Long.fromInt = fromInt;
|
|
8994
9054
|
function fromNumber(value, unsigned) {
|
|
8995
|
-
if (isNaN(value))
|
|
8996
|
-
return unsigned ? UZERO : ZERO;
|
|
9055
|
+
if (isNaN(value)) return unsigned ? UZERO : ZERO;
|
|
8997
9056
|
if (unsigned) {
|
|
8998
|
-
if (value < 0)
|
|
8999
|
-
|
|
9000
|
-
if (value >= TWO_PWR_64_DBL)
|
|
9001
|
-
return MAX_UNSIGNED_VALUE;
|
|
9057
|
+
if (value < 0) return UZERO;
|
|
9058
|
+
if (value >= TWO_PWR_64_DBL) return MAX_UNSIGNED_VALUE;
|
|
9002
9059
|
} else {
|
|
9003
|
-
if (value <= -
|
|
9004
|
-
|
|
9005
|
-
if (value + 1 >= TWO_PWR_63_DBL)
|
|
9006
|
-
return MAX_VALUE;
|
|
9060
|
+
if (value <= -9223372036854776e3) return MIN_VALUE;
|
|
9061
|
+
if (value + 1 >= TWO_PWR_63_DBL) return MAX_VALUE;
|
|
9007
9062
|
}
|
|
9008
|
-
if (value < 0)
|
|
9009
|
-
|
|
9010
|
-
|
|
9063
|
+
if (value < 0) return fromNumber(-value, unsigned).neg();
|
|
9064
|
+
return fromBits(
|
|
9065
|
+
value % TWO_PWR_32_DBL | 0,
|
|
9066
|
+
value / TWO_PWR_32_DBL | 0,
|
|
9067
|
+
unsigned
|
|
9068
|
+
);
|
|
9011
9069
|
}
|
|
9012
9070
|
Long.fromNumber = fromNumber;
|
|
9013
9071
|
function fromBits(lowBits, highBits, unsigned) {
|
|
@@ -9016,8 +9074,7 @@ function fromBits(lowBits, highBits, unsigned) {
|
|
|
9016
9074
|
Long.fromBits = fromBits;
|
|
9017
9075
|
var pow_dbl = Math.pow;
|
|
9018
9076
|
function fromString(str, unsigned, radix) {
|
|
9019
|
-
if (str.length === 0)
|
|
9020
|
-
throw Error("empty string");
|
|
9077
|
+
if (str.length === 0) throw Error("empty string");
|
|
9021
9078
|
if (typeof unsigned === "number") {
|
|
9022
9079
|
radix = unsigned;
|
|
9023
9080
|
unsigned = false;
|
|
@@ -9027,11 +9084,9 @@ function fromString(str, unsigned, radix) {
|
|
|
9027
9084
|
if (str === "NaN" || str === "Infinity" || str === "+Infinity" || str === "-Infinity")
|
|
9028
9085
|
return unsigned ? UZERO : ZERO;
|
|
9029
9086
|
radix = radix || 10;
|
|
9030
|
-
if (radix < 2 || 36 < radix)
|
|
9031
|
-
throw RangeError("radix");
|
|
9087
|
+
if (radix < 2 || 36 < radix) throw RangeError("radix");
|
|
9032
9088
|
var p;
|
|
9033
|
-
if ((p = str.indexOf("-")) > 0)
|
|
9034
|
-
throw Error("interior hyphen");
|
|
9089
|
+
if ((p = str.indexOf("-")) > 0) throw Error("interior hyphen");
|
|
9035
9090
|
else if (p === 0) {
|
|
9036
9091
|
return fromString(str.substring(1), unsigned, radix).neg();
|
|
9037
9092
|
}
|
|
@@ -9052,11 +9107,13 @@ function fromString(str, unsigned, radix) {
|
|
|
9052
9107
|
}
|
|
9053
9108
|
Long.fromString = fromString;
|
|
9054
9109
|
function fromValue(val, unsigned) {
|
|
9055
|
-
if (typeof val === "number")
|
|
9056
|
-
|
|
9057
|
-
|
|
9058
|
-
|
|
9059
|
-
|
|
9110
|
+
if (typeof val === "number") return fromNumber(val, unsigned);
|
|
9111
|
+
if (typeof val === "string") return fromString(val, unsigned);
|
|
9112
|
+
return fromBits(
|
|
9113
|
+
val.low,
|
|
9114
|
+
val.high,
|
|
9115
|
+
typeof unsigned === "boolean" ? unsigned : val.unsigned
|
|
9116
|
+
);
|
|
9060
9117
|
}
|
|
9061
9118
|
Long.fromValue = fromValue;
|
|
9062
9119
|
var TWO_PWR_16_DBL = 1 << 16;
|
|
@@ -9092,27 +9149,22 @@ LongPrototype.toNumber = function toNumber() {
|
|
|
9092
9149
|
};
|
|
9093
9150
|
LongPrototype.toString = function toString(radix) {
|
|
9094
9151
|
radix = radix || 10;
|
|
9095
|
-
if (radix < 2 || 36 < radix)
|
|
9096
|
-
|
|
9097
|
-
if (this.isZero())
|
|
9098
|
-
return "0";
|
|
9152
|
+
if (radix < 2 || 36 < radix) throw RangeError("radix");
|
|
9153
|
+
if (this.isZero()) return "0";
|
|
9099
9154
|
if (this.isNegative()) {
|
|
9100
9155
|
if (this.eq(MIN_VALUE)) {
|
|
9101
9156
|
var radixLong = fromNumber(radix), div = this.div(radixLong), rem1 = div.mul(radixLong).sub(this);
|
|
9102
9157
|
return div.toString(radix) + rem1.toInt().toString(radix);
|
|
9103
|
-
} else
|
|
9104
|
-
return "-" + this.neg().toString(radix);
|
|
9158
|
+
} else return "-" + this.neg().toString(radix);
|
|
9105
9159
|
}
|
|
9106
9160
|
var radixToPower = fromNumber(pow_dbl(radix, 6), this.unsigned), rem = this;
|
|
9107
9161
|
var result = "";
|
|
9108
9162
|
while (true) {
|
|
9109
9163
|
var remDiv = rem.div(radixToPower), intval = rem.sub(remDiv.mul(radixToPower)).toInt() >>> 0, digits = intval.toString(radix);
|
|
9110
9164
|
rem = remDiv;
|
|
9111
|
-
if (rem.isZero())
|
|
9112
|
-
return digits + result;
|
|
9165
|
+
if (rem.isZero()) return digits + result;
|
|
9113
9166
|
else {
|
|
9114
|
-
while (digits.length < 6)
|
|
9115
|
-
digits = "0" + digits;
|
|
9167
|
+
while (digits.length < 6) digits = "0" + digits;
|
|
9116
9168
|
result = "" + digits + result;
|
|
9117
9169
|
}
|
|
9118
9170
|
}
|
|
@@ -9133,11 +9185,15 @@ LongPrototype.getNumBitsAbs = function getNumBitsAbs() {
|
|
|
9133
9185
|
if (this.isNegative())
|
|
9134
9186
|
return this.eq(MIN_VALUE) ? 64 : this.neg().getNumBitsAbs();
|
|
9135
9187
|
var val = this.high != 0 ? this.high : this.low;
|
|
9136
|
-
for (var bit = 31; bit > 0; bit--)
|
|
9137
|
-
if ((val & 1 << bit) != 0)
|
|
9138
|
-
break;
|
|
9188
|
+
for (var bit = 31; bit > 0; bit--) if ((val & 1 << bit) != 0) break;
|
|
9139
9189
|
return this.high != 0 ? bit + 33 : bit + 1;
|
|
9140
9190
|
};
|
|
9191
|
+
LongPrototype.isSafeInteger = function isSafeInteger() {
|
|
9192
|
+
var top11Bits = this.high >> 21;
|
|
9193
|
+
if (!top11Bits) return true;
|
|
9194
|
+
if (this.unsigned) return false;
|
|
9195
|
+
return top11Bits === -1 && !(this.low === 0 && this.high === -2097152);
|
|
9196
|
+
};
|
|
9141
9197
|
LongPrototype.isZero = function isZero() {
|
|
9142
9198
|
return this.high === 0 && this.low === 0;
|
|
9143
9199
|
};
|
|
@@ -9155,8 +9211,7 @@ LongPrototype.isEven = function isEven() {
|
|
|
9155
9211
|
return (this.low & 1) === 0;
|
|
9156
9212
|
};
|
|
9157
9213
|
LongPrototype.equals = function equals(other) {
|
|
9158
|
-
if (!isLong(other))
|
|
9159
|
-
other = fromValue(other);
|
|
9214
|
+
if (!isLong(other)) other = fromValue(other);
|
|
9160
9215
|
if (this.unsigned !== other.unsigned && this.high >>> 31 === 1 && other.high >>> 31 === 1)
|
|
9161
9216
|
return false;
|
|
9162
9217
|
return this.high === other.high && this.low === other.low;
|
|
@@ -9201,29 +9256,22 @@ LongPrototype.greaterThanOrEqual = function greaterThanOrEqual(other) {
|
|
|
9201
9256
|
LongPrototype.gte = LongPrototype.greaterThanOrEqual;
|
|
9202
9257
|
LongPrototype.ge = LongPrototype.greaterThanOrEqual;
|
|
9203
9258
|
LongPrototype.compare = function compare(other) {
|
|
9204
|
-
if (!isLong(other))
|
|
9205
|
-
|
|
9206
|
-
if (this.eq(other))
|
|
9207
|
-
return 0;
|
|
9259
|
+
if (!isLong(other)) other = fromValue(other);
|
|
9260
|
+
if (this.eq(other)) return 0;
|
|
9208
9261
|
var thisNeg = this.isNegative(), otherNeg = other.isNegative();
|
|
9209
|
-
if (thisNeg && !otherNeg)
|
|
9210
|
-
|
|
9211
|
-
if (!
|
|
9212
|
-
return 1;
|
|
9213
|
-
if (!this.unsigned)
|
|
9214
|
-
return this.sub(other).isNegative() ? -1 : 1;
|
|
9262
|
+
if (thisNeg && !otherNeg) return -1;
|
|
9263
|
+
if (!thisNeg && otherNeg) return 1;
|
|
9264
|
+
if (!this.unsigned) return this.sub(other).isNegative() ? -1 : 1;
|
|
9215
9265
|
return other.high >>> 0 > this.high >>> 0 || other.high === this.high && other.low >>> 0 > this.low >>> 0 ? -1 : 1;
|
|
9216
9266
|
};
|
|
9217
9267
|
LongPrototype.comp = LongPrototype.compare;
|
|
9218
9268
|
LongPrototype.negate = function negate2() {
|
|
9219
|
-
if (!this.unsigned && this.eq(MIN_VALUE))
|
|
9220
|
-
return MIN_VALUE;
|
|
9269
|
+
if (!this.unsigned && this.eq(MIN_VALUE)) return MIN_VALUE;
|
|
9221
9270
|
return this.not().add(ONE);
|
|
9222
9271
|
};
|
|
9223
9272
|
LongPrototype.neg = LongPrototype.negate;
|
|
9224
9273
|
LongPrototype.add = function add(addend) {
|
|
9225
|
-
if (!isLong(addend))
|
|
9226
|
-
addend = fromValue(addend);
|
|
9274
|
+
if (!isLong(addend)) addend = fromValue(addend);
|
|
9227
9275
|
var a48 = this.high >>> 16;
|
|
9228
9276
|
var a32 = this.high & 65535;
|
|
9229
9277
|
var a16 = this.low >>> 16;
|
|
@@ -9247,38 +9295,24 @@ LongPrototype.add = function add(addend) {
|
|
|
9247
9295
|
return fromBits(c16 << 16 | c00, c48 << 16 | c32, this.unsigned);
|
|
9248
9296
|
};
|
|
9249
9297
|
LongPrototype.subtract = function subtract(subtrahend) {
|
|
9250
|
-
if (!isLong(subtrahend))
|
|
9251
|
-
subtrahend = fromValue(subtrahend);
|
|
9298
|
+
if (!isLong(subtrahend)) subtrahend = fromValue(subtrahend);
|
|
9252
9299
|
return this.add(subtrahend.neg());
|
|
9253
9300
|
};
|
|
9254
9301
|
LongPrototype.sub = LongPrototype.subtract;
|
|
9255
9302
|
LongPrototype.multiply = function multiply(multiplier) {
|
|
9256
|
-
if (this.isZero())
|
|
9257
|
-
|
|
9258
|
-
if (!isLong(multiplier))
|
|
9259
|
-
multiplier = fromValue(multiplier);
|
|
9303
|
+
if (this.isZero()) return this;
|
|
9304
|
+
if (!isLong(multiplier)) multiplier = fromValue(multiplier);
|
|
9260
9305
|
if (wasm) {
|
|
9261
|
-
var low = wasm["mul"](
|
|
9262
|
-
this.low,
|
|
9263
|
-
this.high,
|
|
9264
|
-
multiplier.low,
|
|
9265
|
-
multiplier.high
|
|
9266
|
-
);
|
|
9306
|
+
var low = wasm["mul"](this.low, this.high, multiplier.low, multiplier.high);
|
|
9267
9307
|
return fromBits(low, wasm["get_high"](), this.unsigned);
|
|
9268
9308
|
}
|
|
9269
|
-
if (multiplier.isZero())
|
|
9270
|
-
|
|
9271
|
-
if (
|
|
9272
|
-
return multiplier.isOdd() ? MIN_VALUE : ZERO;
|
|
9273
|
-
if (multiplier.eq(MIN_VALUE))
|
|
9274
|
-
return this.isOdd() ? MIN_VALUE : ZERO;
|
|
9309
|
+
if (multiplier.isZero()) return this.unsigned ? UZERO : ZERO;
|
|
9310
|
+
if (this.eq(MIN_VALUE)) return multiplier.isOdd() ? MIN_VALUE : ZERO;
|
|
9311
|
+
if (multiplier.eq(MIN_VALUE)) return this.isOdd() ? MIN_VALUE : ZERO;
|
|
9275
9312
|
if (this.isNegative()) {
|
|
9276
|
-
if (multiplier.isNegative())
|
|
9277
|
-
|
|
9278
|
-
|
|
9279
|
-
return this.neg().mul(multiplier).neg();
|
|
9280
|
-
} else if (multiplier.isNegative())
|
|
9281
|
-
return this.mul(multiplier.neg()).neg();
|
|
9313
|
+
if (multiplier.isNegative()) return this.neg().mul(multiplier.neg());
|
|
9314
|
+
else return this.neg().mul(multiplier).neg();
|
|
9315
|
+
} else if (multiplier.isNegative()) return this.mul(multiplier.neg()).neg();
|
|
9282
9316
|
if (this.lt(TWO_PWR_24) && multiplier.lt(TWO_PWR_24))
|
|
9283
9317
|
return fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned);
|
|
9284
9318
|
var a48 = this.high >>> 16;
|
|
@@ -9314,10 +9348,8 @@ LongPrototype.multiply = function multiply(multiplier) {
|
|
|
9314
9348
|
};
|
|
9315
9349
|
LongPrototype.mul = LongPrototype.multiply;
|
|
9316
9350
|
LongPrototype.divide = function divide(divisor) {
|
|
9317
|
-
if (!isLong(divisor))
|
|
9318
|
-
|
|
9319
|
-
if (divisor.isZero())
|
|
9320
|
-
throw Error("division by zero");
|
|
9351
|
+
if (!isLong(divisor)) divisor = fromValue(divisor);
|
|
9352
|
+
if (divisor.isZero()) throw Error("division by zero");
|
|
9321
9353
|
if (wasm) {
|
|
9322
9354
|
if (!this.unsigned && this.high === -2147483648 && divisor.low === -1 && divisor.high === -1) {
|
|
9323
9355
|
return this;
|
|
@@ -9330,15 +9362,13 @@ LongPrototype.divide = function divide(divisor) {
|
|
|
9330
9362
|
);
|
|
9331
9363
|
return fromBits(low, wasm["get_high"](), this.unsigned);
|
|
9332
9364
|
}
|
|
9333
|
-
if (this.isZero())
|
|
9334
|
-
return this.unsigned ? UZERO : ZERO;
|
|
9365
|
+
if (this.isZero()) return this.unsigned ? UZERO : ZERO;
|
|
9335
9366
|
var approx, rem, res;
|
|
9336
9367
|
if (!this.unsigned) {
|
|
9337
9368
|
if (this.eq(MIN_VALUE)) {
|
|
9338
9369
|
if (divisor.eq(ONE) || divisor.eq(NEG_ONE))
|
|
9339
9370
|
return MIN_VALUE;
|
|
9340
|
-
else if (divisor.eq(MIN_VALUE))
|
|
9341
|
-
return ONE;
|
|
9371
|
+
else if (divisor.eq(MIN_VALUE)) return ONE;
|
|
9342
9372
|
else {
|
|
9343
9373
|
var halfThis = this.shr(1);
|
|
9344
9374
|
approx = halfThis.div(divisor).shl(1);
|
|
@@ -9350,20 +9380,15 @@ LongPrototype.divide = function divide(divisor) {
|
|
|
9350
9380
|
return res;
|
|
9351
9381
|
}
|
|
9352
9382
|
}
|
|
9353
|
-
} else if (divisor.eq(MIN_VALUE))
|
|
9354
|
-
return this.unsigned ? UZERO : ZERO;
|
|
9383
|
+
} else if (divisor.eq(MIN_VALUE)) return this.unsigned ? UZERO : ZERO;
|
|
9355
9384
|
if (this.isNegative()) {
|
|
9356
|
-
if (divisor.isNegative())
|
|
9357
|
-
return this.neg().div(divisor.neg());
|
|
9385
|
+
if (divisor.isNegative()) return this.neg().div(divisor.neg());
|
|
9358
9386
|
return this.neg().div(divisor).neg();
|
|
9359
|
-
} else if (divisor.isNegative())
|
|
9360
|
-
return this.div(divisor.neg()).neg();
|
|
9387
|
+
} else if (divisor.isNegative()) return this.div(divisor.neg()).neg();
|
|
9361
9388
|
res = ZERO;
|
|
9362
9389
|
} else {
|
|
9363
|
-
if (!divisor.unsigned)
|
|
9364
|
-
|
|
9365
|
-
if (divisor.gt(this))
|
|
9366
|
-
return UZERO;
|
|
9390
|
+
if (!divisor.unsigned) divisor = divisor.toUnsigned();
|
|
9391
|
+
if (divisor.gt(this)) return UZERO;
|
|
9367
9392
|
if (divisor.gt(this.shru(1)))
|
|
9368
9393
|
return UONE;
|
|
9369
9394
|
res = UZERO;
|
|
@@ -9377,8 +9402,7 @@ LongPrototype.divide = function divide(divisor) {
|
|
|
9377
9402
|
approxRes = fromNumber(approx, this.unsigned);
|
|
9378
9403
|
approxRem = approxRes.mul(divisor);
|
|
9379
9404
|
}
|
|
9380
|
-
if (approxRes.isZero())
|
|
9381
|
-
approxRes = ONE;
|
|
9405
|
+
if (approxRes.isZero()) approxRes = ONE;
|
|
9382
9406
|
res = res.add(approxRes);
|
|
9383
9407
|
rem = rem.sub(approxRem);
|
|
9384
9408
|
}
|
|
@@ -9386,8 +9410,7 @@ LongPrototype.divide = function divide(divisor) {
|
|
|
9386
9410
|
};
|
|
9387
9411
|
LongPrototype.div = LongPrototype.divide;
|
|
9388
9412
|
LongPrototype.modulo = function modulo(divisor) {
|
|
9389
|
-
if (!isLong(divisor))
|
|
9390
|
-
divisor = fromValue(divisor);
|
|
9413
|
+
if (!isLong(divisor)) divisor = fromValue(divisor);
|
|
9391
9414
|
if (wasm) {
|
|
9392
9415
|
var low = (this.unsigned ? wasm["rem_u"] : wasm["rem_s"])(
|
|
9393
9416
|
this.low,
|
|
@@ -9413,46 +9436,55 @@ LongPrototype.countTrailingZeros = function countTrailingZeros() {
|
|
|
9413
9436
|
};
|
|
9414
9437
|
LongPrototype.ctz = LongPrototype.countTrailingZeros;
|
|
9415
9438
|
LongPrototype.and = function and(other) {
|
|
9416
|
-
if (!isLong(other))
|
|
9417
|
-
other = fromValue(other);
|
|
9439
|
+
if (!isLong(other)) other = fromValue(other);
|
|
9418
9440
|
return fromBits(this.low & other.low, this.high & other.high, this.unsigned);
|
|
9419
9441
|
};
|
|
9420
9442
|
LongPrototype.or = function or(other) {
|
|
9421
|
-
if (!isLong(other))
|
|
9422
|
-
other = fromValue(other);
|
|
9443
|
+
if (!isLong(other)) other = fromValue(other);
|
|
9423
9444
|
return fromBits(this.low | other.low, this.high | other.high, this.unsigned);
|
|
9424
9445
|
};
|
|
9425
9446
|
LongPrototype.xor = function xor(other) {
|
|
9426
|
-
if (!isLong(other))
|
|
9427
|
-
other = fromValue(other);
|
|
9447
|
+
if (!isLong(other)) other = fromValue(other);
|
|
9428
9448
|
return fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned);
|
|
9429
9449
|
};
|
|
9430
9450
|
LongPrototype.shiftLeft = function shiftLeft(numBits) {
|
|
9431
|
-
if (isLong(numBits))
|
|
9432
|
-
|
|
9433
|
-
if ((numBits &= 63) === 0)
|
|
9434
|
-
return this;
|
|
9451
|
+
if (isLong(numBits)) numBits = numBits.toInt();
|
|
9452
|
+
if ((numBits &= 63) === 0) return this;
|
|
9435
9453
|
else if (numBits < 32)
|
|
9436
|
-
return fromBits(
|
|
9437
|
-
|
|
9438
|
-
|
|
9454
|
+
return fromBits(
|
|
9455
|
+
this.low << numBits,
|
|
9456
|
+
this.high << numBits | this.low >>> 32 - numBits,
|
|
9457
|
+
this.unsigned
|
|
9458
|
+
);
|
|
9459
|
+
else return fromBits(0, this.low << numBits - 32, this.unsigned);
|
|
9439
9460
|
};
|
|
9440
9461
|
LongPrototype.shl = LongPrototype.shiftLeft;
|
|
9441
9462
|
LongPrototype.shiftRight = function shiftRight(numBits) {
|
|
9442
|
-
if (isLong(numBits))
|
|
9443
|
-
|
|
9444
|
-
if ((numBits &= 63) === 0)
|
|
9445
|
-
return this;
|
|
9463
|
+
if (isLong(numBits)) numBits = numBits.toInt();
|
|
9464
|
+
if ((numBits &= 63) === 0) return this;
|
|
9446
9465
|
else if (numBits < 32)
|
|
9447
|
-
return fromBits(
|
|
9466
|
+
return fromBits(
|
|
9467
|
+
this.low >>> numBits | this.high << 32 - numBits,
|
|
9468
|
+
this.high >> numBits,
|
|
9469
|
+
this.unsigned
|
|
9470
|
+
);
|
|
9448
9471
|
else
|
|
9449
|
-
return fromBits(
|
|
9472
|
+
return fromBits(
|
|
9473
|
+
this.high >> numBits - 32,
|
|
9474
|
+
this.high >= 0 ? 0 : -1,
|
|
9475
|
+
this.unsigned
|
|
9476
|
+
);
|
|
9450
9477
|
};
|
|
9451
9478
|
LongPrototype.shr = LongPrototype.shiftRight;
|
|
9452
9479
|
LongPrototype.shiftRightUnsigned = function shiftRightUnsigned(numBits) {
|
|
9453
9480
|
if (isLong(numBits)) numBits = numBits.toInt();
|
|
9454
9481
|
if ((numBits &= 63) === 0) return this;
|
|
9455
|
-
if (numBits < 32)
|
|
9482
|
+
if (numBits < 32)
|
|
9483
|
+
return fromBits(
|
|
9484
|
+
this.low >>> numBits | this.high << 32 - numBits,
|
|
9485
|
+
this.high >>> numBits,
|
|
9486
|
+
this.unsigned
|
|
9487
|
+
);
|
|
9456
9488
|
if (numBits === 32) return fromBits(this.high, 0, this.unsigned);
|
|
9457
9489
|
return fromBits(this.high >>> numBits - 32, 0, this.unsigned);
|
|
9458
9490
|
};
|
|
@@ -9465,11 +9497,19 @@ LongPrototype.rotateLeft = function rotateLeft(numBits) {
|
|
|
9465
9497
|
if (numBits === 32) return fromBits(this.high, this.low, this.unsigned);
|
|
9466
9498
|
if (numBits < 32) {
|
|
9467
9499
|
b = 32 - numBits;
|
|
9468
|
-
return fromBits(
|
|
9500
|
+
return fromBits(
|
|
9501
|
+
this.low << numBits | this.high >>> b,
|
|
9502
|
+
this.high << numBits | this.low >>> b,
|
|
9503
|
+
this.unsigned
|
|
9504
|
+
);
|
|
9469
9505
|
}
|
|
9470
9506
|
numBits -= 32;
|
|
9471
9507
|
b = 32 - numBits;
|
|
9472
|
-
return fromBits(
|
|
9508
|
+
return fromBits(
|
|
9509
|
+
this.high << numBits | this.low >>> b,
|
|
9510
|
+
this.low << numBits | this.high >>> b,
|
|
9511
|
+
this.unsigned
|
|
9512
|
+
);
|
|
9473
9513
|
};
|
|
9474
9514
|
LongPrototype.rotl = LongPrototype.rotateLeft;
|
|
9475
9515
|
LongPrototype.rotateRight = function rotateRight(numBits) {
|
|
@@ -9479,21 +9519,27 @@ LongPrototype.rotateRight = function rotateRight(numBits) {
|
|
|
9479
9519
|
if (numBits === 32) return fromBits(this.high, this.low, this.unsigned);
|
|
9480
9520
|
if (numBits < 32) {
|
|
9481
9521
|
b = 32 - numBits;
|
|
9482
|
-
return fromBits(
|
|
9522
|
+
return fromBits(
|
|
9523
|
+
this.high << b | this.low >>> numBits,
|
|
9524
|
+
this.low << b | this.high >>> numBits,
|
|
9525
|
+
this.unsigned
|
|
9526
|
+
);
|
|
9483
9527
|
}
|
|
9484
9528
|
numBits -= 32;
|
|
9485
9529
|
b = 32 - numBits;
|
|
9486
|
-
return fromBits(
|
|
9530
|
+
return fromBits(
|
|
9531
|
+
this.low << b | this.high >>> numBits,
|
|
9532
|
+
this.high << b | this.low >>> numBits,
|
|
9533
|
+
this.unsigned
|
|
9534
|
+
);
|
|
9487
9535
|
};
|
|
9488
9536
|
LongPrototype.rotr = LongPrototype.rotateRight;
|
|
9489
9537
|
LongPrototype.toSigned = function toSigned() {
|
|
9490
|
-
if (!this.unsigned)
|
|
9491
|
-
return this;
|
|
9538
|
+
if (!this.unsigned) return this;
|
|
9492
9539
|
return fromBits(this.low, this.high, false);
|
|
9493
9540
|
};
|
|
9494
9541
|
LongPrototype.toUnsigned = function toUnsigned2() {
|
|
9495
|
-
if (this.unsigned)
|
|
9496
|
-
return this;
|
|
9542
|
+
if (this.unsigned) return this;
|
|
9497
9543
|
return fromBits(this.low, this.high, true);
|
|
9498
9544
|
};
|
|
9499
9545
|
LongPrototype.toBytes = function toBytes(le) {
|
|
@@ -9542,6 +9588,22 @@ Long.fromBytesBE = function fromBytesBE(bytes, unsigned) {
|
|
|
9542
9588
|
unsigned
|
|
9543
9589
|
);
|
|
9544
9590
|
};
|
|
9591
|
+
if (typeof BigInt === "function") {
|
|
9592
|
+
Long.fromBigInt = function fromBigInt2(value, unsigned) {
|
|
9593
|
+
var lowBits = Number(BigInt.asIntN(32, value));
|
|
9594
|
+
var highBits = Number(BigInt.asIntN(32, value >> BigInt(32)));
|
|
9595
|
+
return fromBits(lowBits, highBits, unsigned);
|
|
9596
|
+
};
|
|
9597
|
+
Long.fromValue = function fromValueWithBigInt(value, unsigned) {
|
|
9598
|
+
if (typeof value === "bigint") return fromBigInt(value, unsigned);
|
|
9599
|
+
return fromValue(value, unsigned);
|
|
9600
|
+
};
|
|
9601
|
+
LongPrototype.toBigInt = function toBigInt() {
|
|
9602
|
+
var lowBigInt = BigInt(this.low >>> 0);
|
|
9603
|
+
var highBigInt = BigInt(this.unsigned ? this.high >>> 0 : this.high);
|
|
9604
|
+
return highBigInt << BigInt(32) | lowBigInt;
|
|
9605
|
+
};
|
|
9606
|
+
}
|
|
9545
9607
|
var PrimitiveType = /* @__PURE__ */ ((PrimitiveType2) => {
|
|
9546
9608
|
PrimitiveType2[PrimitiveType2["Null"] = 0] = "Null";
|
|
9547
9609
|
PrimitiveType2[PrimitiveType2["Boolean"] = 1] = "Boolean";
|
|
@@ -20153,96 +20215,10 @@ function createAuthInterceptor(apiKey, token) {
|
|
|
20153
20215
|
};
|
|
20154
20216
|
}
|
|
20155
20217
|
const name = "@yorkie-js/sdk";
|
|
20156
|
-
const version = "0.6.
|
|
20157
|
-
const description = "Yorkie JS SDK";
|
|
20158
|
-
const main = "./src/yorkie.ts";
|
|
20159
|
-
const publishConfig = {
|
|
20160
|
-
access: "public",
|
|
20161
|
-
main: "./dist/yorkie-js-sdk.js",
|
|
20162
|
-
typings: "./dist/yorkie-js-sdk.d.ts"
|
|
20163
|
-
};
|
|
20164
|
-
const files = [
|
|
20165
|
-
"dist",
|
|
20166
|
-
"README.md"
|
|
20167
|
-
];
|
|
20168
|
-
const scripts = {
|
|
20169
|
-
build: "tsc && vite build",
|
|
20170
|
-
"build:proto": "npx buf generate",
|
|
20171
|
-
"build:docs": "typedoc",
|
|
20172
|
-
"build:ghpages": "mkdir -p ghpages/examples && cp -r docs ghpages/api-reference && find ../../examples -name 'dist' -type d -exec sh -c 'cp -r {} ghpages/examples/$(basename $(dirname {}))' \\;",
|
|
20173
|
-
dev: "vite build -c vite.preview.ts && vite preview",
|
|
20174
|
-
test: "vitest run",
|
|
20175
|
-
"test:watch": "vitest",
|
|
20176
|
-
"test:bench": "vitest bench",
|
|
20177
|
-
"test:ci": "vitest run --coverage",
|
|
20178
|
-
"test:yorkie.dev": "TEST_RPC_ADDR=https://api.yorkie.dev vitest run --coverage",
|
|
20179
|
-
prepare: "pnpm build"
|
|
20180
|
-
};
|
|
20181
|
-
const engines = {
|
|
20182
|
-
node: ">=18.0.0",
|
|
20183
|
-
npm: ">=7.1.0"
|
|
20184
|
-
};
|
|
20185
|
-
const repository = {
|
|
20186
|
-
type: "git",
|
|
20187
|
-
url: "git+https://github.com/yorkie-team/yorkie-js-sdk.git"
|
|
20188
|
-
};
|
|
20189
|
-
const author = {
|
|
20190
|
-
name: "hackerwins",
|
|
20191
|
-
email: "susukang98@gmail.com"
|
|
20192
|
-
};
|
|
20193
|
-
const license = "Apache-2.0";
|
|
20194
|
-
const bugs = {
|
|
20195
|
-
url: "https://github.com/yorkie-team/yorkie-js-sdk/issues"
|
|
20196
|
-
};
|
|
20197
|
-
const homepage = "https://github.com/yorkie-team/yorkie-js-sdk#readme";
|
|
20198
|
-
const devDependencies = {
|
|
20199
|
-
"@buf/googleapis_googleapis.bufbuild_es": "^1.4.0-20240524201209-f0e53af8f2fc.3",
|
|
20200
|
-
"@bufbuild/buf": "^1.28.1",
|
|
20201
|
-
"@bufbuild/protoc-gen-es": "^1.6.0",
|
|
20202
|
-
"@connectrpc/protoc-gen-connect-es": "^1.4.0",
|
|
20203
|
-
"@types/express": "^4.17.21",
|
|
20204
|
-
"@types/google-protobuf": "^3.15.5",
|
|
20205
|
-
"@types/long": "^4.0.1",
|
|
20206
|
-
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
|
20207
|
-
"@typescript-eslint/parser": "^6.21.0",
|
|
20208
|
-
"@vitest/coverage-istanbul": "^0.34.5",
|
|
20209
|
-
"@vitest/coverage-v8": "^0.34.5",
|
|
20210
|
-
axios: "^1.7.7",
|
|
20211
|
-
"eslint-plugin-tsdoc": "^0.2.16",
|
|
20212
|
-
express: "^4.21.1",
|
|
20213
|
-
prettier: "^2.7.1",
|
|
20214
|
-
"ts-node": "^10.9.1",
|
|
20215
|
-
typedoc: "^0.25.13",
|
|
20216
|
-
typescript: "^5.3.3",
|
|
20217
|
-
"typescript-transform-paths": "^3.3.1",
|
|
20218
|
-
vite: "^5.0.12",
|
|
20219
|
-
"vite-plugin-commonjs": "^0.10.1",
|
|
20220
|
-
"vite-plugin-dts": "^3.9.1",
|
|
20221
|
-
"vite-tsconfig-paths": "^4.3.1",
|
|
20222
|
-
vitest: "^0.34.5"
|
|
20223
|
-
};
|
|
20224
|
-
const dependencies = {
|
|
20225
|
-
"@bufbuild/protobuf": "^1.6.0",
|
|
20226
|
-
"@connectrpc/connect": "^1.4.0",
|
|
20227
|
-
"@connectrpc/connect-web": "^1.4.0",
|
|
20228
|
-
long: "^5.2.0"
|
|
20229
|
-
};
|
|
20218
|
+
const version = "0.6.6";
|
|
20230
20219
|
const pkg = {
|
|
20231
20220
|
name,
|
|
20232
|
-
version
|
|
20233
|
-
description,
|
|
20234
|
-
main,
|
|
20235
|
-
publishConfig,
|
|
20236
|
-
files,
|
|
20237
|
-
scripts,
|
|
20238
|
-
engines,
|
|
20239
|
-
repository,
|
|
20240
|
-
author,
|
|
20241
|
-
license,
|
|
20242
|
-
bugs,
|
|
20243
|
-
homepage,
|
|
20244
|
-
devDependencies,
|
|
20245
|
-
dependencies
|
|
20221
|
+
version
|
|
20246
20222
|
};
|
|
20247
20223
|
function createMetricInterceptor() {
|
|
20248
20224
|
return (next) => async (req) => {
|