@yorkie-js/sdk 0.7.4 → 0.7.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/counter.html +1 -1
- package/dist/multi.html +1 -1
- package/dist/yorkie-js-sdk.d.ts +141 -40
- package/dist/yorkie-js-sdk.es.js +1856 -1300
- package/dist/yorkie-js-sdk.es.js.map +1 -1
- package/dist/yorkie-js-sdk.js +1838 -1282
- package/dist/yorkie-js-sdk.js.map +1 -1
- package/package.json +2 -4
package/dist/yorkie-js-sdk.es.js
CHANGED
|
@@ -100,7 +100,7 @@ function varint64write(lo, hi, bytes) {
|
|
|
100
100
|
}
|
|
101
101
|
bytes.push(hi >>> 31 & 1);
|
|
102
102
|
}
|
|
103
|
-
const TWO_PWR_32_DBL
|
|
103
|
+
const TWO_PWR_32_DBL = 4294967296;
|
|
104
104
|
function int64FromString(dec) {
|
|
105
105
|
const minus = dec[0] === "-";
|
|
106
106
|
if (minus) {
|
|
@@ -113,9 +113,9 @@ function int64FromString(dec) {
|
|
|
113
113
|
const digit1e6 = Number(dec.slice(begin, end));
|
|
114
114
|
highBits *= base;
|
|
115
115
|
lowBits = lowBits * base + digit1e6;
|
|
116
|
-
if (lowBits >= TWO_PWR_32_DBL
|
|
117
|
-
highBits = highBits + (lowBits / TWO_PWR_32_DBL
|
|
118
|
-
lowBits = lowBits % TWO_PWR_32_DBL
|
|
116
|
+
if (lowBits >= TWO_PWR_32_DBL) {
|
|
117
|
+
highBits = highBits + (lowBits / TWO_PWR_32_DBL | 0);
|
|
118
|
+
lowBits = lowBits % TWO_PWR_32_DBL;
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
add1e6digit(-24, -18);
|
|
@@ -136,7 +136,7 @@ function int64ToString(lo, hi) {
|
|
|
136
136
|
function uInt64ToString(lo, hi) {
|
|
137
137
|
({ lo, hi } = toUnsigned(lo, hi));
|
|
138
138
|
if (hi <= 2097151) {
|
|
139
|
-
return String(TWO_PWR_32_DBL
|
|
139
|
+
return String(TWO_PWR_32_DBL * hi + lo);
|
|
140
140
|
}
|
|
141
141
|
const low = lo & 16777215;
|
|
142
142
|
const mid = (lo >>> 24 | hi << 8) & 16777215;
|
|
@@ -4383,6 +4383,19 @@ function codeToString(value) {
|
|
|
4383
4383
|
}
|
|
4384
4384
|
return name2[0].toLowerCase() + name2.substring(1).replace(/[A-Z]/g, (c) => "_" + c.toLowerCase());
|
|
4385
4385
|
}
|
|
4386
|
+
let stringToCode;
|
|
4387
|
+
function codeFromString(value) {
|
|
4388
|
+
if (!stringToCode) {
|
|
4389
|
+
stringToCode = {};
|
|
4390
|
+
for (const value2 of Object.values(Code$1)) {
|
|
4391
|
+
if (typeof value2 == "string") {
|
|
4392
|
+
continue;
|
|
4393
|
+
}
|
|
4394
|
+
stringToCode[codeToString(value2)] = value2;
|
|
4395
|
+
}
|
|
4396
|
+
}
|
|
4397
|
+
return stringToCode[value];
|
|
4398
|
+
}
|
|
4386
4399
|
class ConnectError extends Error {
|
|
4387
4400
|
/**
|
|
4388
4401
|
* Create a new ConnectError.
|
|
@@ -4471,6 +4484,15 @@ function decodeBinaryHeader(value, desc, options) {
|
|
|
4471
4484
|
throw ConnectError.from(e, Code$1.DataLoss);
|
|
4472
4485
|
}
|
|
4473
4486
|
}
|
|
4487
|
+
function appendHeaders(...headers) {
|
|
4488
|
+
const h = new Headers();
|
|
4489
|
+
for (const e of headers) {
|
|
4490
|
+
e.forEach((value, key) => {
|
|
4491
|
+
h.append(key, value);
|
|
4492
|
+
});
|
|
4493
|
+
}
|
|
4494
|
+
return h;
|
|
4495
|
+
}
|
|
4474
4496
|
function makeAnyClient(service, createMethod) {
|
|
4475
4497
|
const client = {};
|
|
4476
4498
|
for (const desc of service.methods) {
|
|
@@ -4618,10 +4640,10 @@ var __asyncValues$1 = function(o) {
|
|
|
4618
4640
|
}, reject);
|
|
4619
4641
|
}
|
|
4620
4642
|
};
|
|
4621
|
-
var __await$
|
|
4622
|
-
return this instanceof __await$
|
|
4643
|
+
var __await$3 = function(v) {
|
|
4644
|
+
return this instanceof __await$3 ? (this.v = v, this) : new __await$3(v);
|
|
4623
4645
|
};
|
|
4624
|
-
var __asyncGenerator$
|
|
4646
|
+
var __asyncGenerator$3 = function(thisArg, _arguments, generator) {
|
|
4625
4647
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
4626
4648
|
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
4627
4649
|
return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function() {
|
|
@@ -4650,7 +4672,7 @@ var __asyncGenerator$2 = function(thisArg, _arguments, generator) {
|
|
|
4650
4672
|
}
|
|
4651
4673
|
}
|
|
4652
4674
|
function step(r) {
|
|
4653
|
-
r.value instanceof __await$
|
|
4675
|
+
r.value instanceof __await$3 ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);
|
|
4654
4676
|
}
|
|
4655
4677
|
function fulfill(value) {
|
|
4656
4678
|
resume("next", value);
|
|
@@ -4671,13 +4693,13 @@ var __asyncDelegator$1 = function(o) {
|
|
|
4671
4693
|
}, i;
|
|
4672
4694
|
function verb(n, f) {
|
|
4673
4695
|
i[n] = o[n] ? function(v) {
|
|
4674
|
-
return (p = !p) ? { value: __await$
|
|
4696
|
+
return (p = !p) ? { value: __await$3(o[n](v)), done: false } : f ? f(v) : v;
|
|
4675
4697
|
} : f;
|
|
4676
4698
|
}
|
|
4677
4699
|
};
|
|
4678
4700
|
function createAsyncIterable(items) {
|
|
4679
|
-
return __asyncGenerator$
|
|
4680
|
-
yield __await$
|
|
4701
|
+
return __asyncGenerator$3(this, arguments, function* createAsyncIterable_1() {
|
|
4702
|
+
yield __await$3(yield* __asyncDelegator$1(__asyncValues$1(items)));
|
|
4681
4703
|
});
|
|
4682
4704
|
}
|
|
4683
4705
|
var __asyncValues = function(o) {
|
|
@@ -4699,8 +4721,8 @@ var __asyncValues = function(o) {
|
|
|
4699
4721
|
}, reject);
|
|
4700
4722
|
}
|
|
4701
4723
|
};
|
|
4702
|
-
var __await$
|
|
4703
|
-
return this instanceof __await$
|
|
4724
|
+
var __await$2 = function(v) {
|
|
4725
|
+
return this instanceof __await$2 ? (this.v = v, this) : new __await$2(v);
|
|
4704
4726
|
};
|
|
4705
4727
|
var __asyncDelegator = function(o) {
|
|
4706
4728
|
var i, p;
|
|
@@ -4711,11 +4733,11 @@ var __asyncDelegator = function(o) {
|
|
|
4711
4733
|
}, i;
|
|
4712
4734
|
function verb(n, f) {
|
|
4713
4735
|
i[n] = o[n] ? function(v) {
|
|
4714
|
-
return (p = !p) ? { value: __await$
|
|
4736
|
+
return (p = !p) ? { value: __await$2(o[n](v)), done: false } : f ? f(v) : v;
|
|
4715
4737
|
} : f;
|
|
4716
4738
|
}
|
|
4717
4739
|
};
|
|
4718
|
-
var __asyncGenerator$
|
|
4740
|
+
var __asyncGenerator$2 = function(thisArg, _arguments, generator) {
|
|
4719
4741
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
4720
4742
|
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
4721
4743
|
return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function() {
|
|
@@ -4744,7 +4766,7 @@ var __asyncGenerator$1 = function(thisArg, _arguments, generator) {
|
|
|
4744
4766
|
}
|
|
4745
4767
|
}
|
|
4746
4768
|
function step(r) {
|
|
4747
|
-
r.value instanceof __await$
|
|
4769
|
+
r.value instanceof __await$2 ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);
|
|
4748
4770
|
}
|
|
4749
4771
|
function fulfill(value) {
|
|
4750
4772
|
resume("next", value);
|
|
@@ -4824,11 +4846,11 @@ function createBiDiStreamingFn(transport, method) {
|
|
|
4824
4846
|
}
|
|
4825
4847
|
function handleStreamResponse(stream, options) {
|
|
4826
4848
|
const it = (function() {
|
|
4827
|
-
return __asyncGenerator$
|
|
4849
|
+
return __asyncGenerator$2(this, arguments, function* () {
|
|
4828
4850
|
var _a, _b;
|
|
4829
|
-
const response = yield __await$
|
|
4851
|
+
const response = yield __await$2(stream);
|
|
4830
4852
|
(_a = options === null || options === void 0 ? void 0 : options.onHeader) === null || _a === void 0 ? void 0 : _a.call(options, response.header);
|
|
4831
|
-
yield __await$
|
|
4853
|
+
yield __await$2(yield* __asyncDelegator(__asyncValues(response.message)));
|
|
4832
4854
|
(_b = options === null || options === void 0 ? void 0 : options.onTrailer) === null || _b === void 0 ? void 0 : _b.call(options, response.trailer);
|
|
4833
4855
|
});
|
|
4834
4856
|
})()[Symbol.asyncIterator]();
|
|
@@ -4918,12 +4940,12 @@ function trailerParse(data) {
|
|
|
4918
4940
|
}
|
|
4919
4941
|
return headers;
|
|
4920
4942
|
}
|
|
4921
|
-
const headerContentType = "Content-Type";
|
|
4922
|
-
const headerTimeout = "Grpc-Timeout";
|
|
4943
|
+
const headerContentType$1 = "Content-Type";
|
|
4944
|
+
const headerTimeout$1 = "Grpc-Timeout";
|
|
4923
4945
|
const headerGrpcStatus = "Grpc-Status";
|
|
4924
4946
|
const headerGrpcMessage = "Grpc-Message";
|
|
4925
4947
|
const headerStatusDetailsBin = "Grpc-Status-Details-Bin";
|
|
4926
|
-
const headerUserAgent = "User-Agent";
|
|
4948
|
+
const headerUserAgent$1 = "User-Agent";
|
|
4927
4949
|
const headerXUserAgent = "X-User-Agent";
|
|
4928
4950
|
const headerXGrpcWeb = "X-Grpc-Web";
|
|
4929
4951
|
const contentTypeProto = "application/grpc-web+proto";
|
|
@@ -5061,6 +5083,204 @@ function createJsonSerialization(desc, options) {
|
|
|
5061
5083
|
}
|
|
5062
5084
|
};
|
|
5063
5085
|
}
|
|
5086
|
+
const contentTypeRegExp = /^application\/(connect\+)?(?:(json)(?:; ?charset=utf-?8)?|(proto))$/i;
|
|
5087
|
+
const contentTypeUnaryProto = "application/proto";
|
|
5088
|
+
const contentTypeUnaryJson = "application/json";
|
|
5089
|
+
const contentTypeStreamProto = "application/connect+proto";
|
|
5090
|
+
const contentTypeStreamJson = "application/connect+json";
|
|
5091
|
+
function parseContentType(contentType) {
|
|
5092
|
+
const match = contentType === null || contentType === void 0 ? void 0 : contentType.match(contentTypeRegExp);
|
|
5093
|
+
if (!match) {
|
|
5094
|
+
return void 0;
|
|
5095
|
+
}
|
|
5096
|
+
const stream = !!match[1];
|
|
5097
|
+
const binary = !!match[3];
|
|
5098
|
+
return { stream, binary };
|
|
5099
|
+
}
|
|
5100
|
+
(function(s, e) {
|
|
5101
|
+
var t = {};
|
|
5102
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5103
|
+
t[p] = s[p];
|
|
5104
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
5105
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
5106
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
5107
|
+
t[p[i]] = s[p[i]];
|
|
5108
|
+
}
|
|
5109
|
+
return t;
|
|
5110
|
+
});
|
|
5111
|
+
function errorFromJson(jsonValue, metadata, fallback) {
|
|
5112
|
+
var _a;
|
|
5113
|
+
if (metadata) {
|
|
5114
|
+
new Headers(metadata).forEach((value, key) => fallback.metadata.append(key, value));
|
|
5115
|
+
}
|
|
5116
|
+
if (typeof jsonValue !== "object" || jsonValue == null || Array.isArray(jsonValue)) {
|
|
5117
|
+
throw fallback;
|
|
5118
|
+
}
|
|
5119
|
+
let code = fallback.code;
|
|
5120
|
+
if ("code" in jsonValue && typeof jsonValue.code === "string") {
|
|
5121
|
+
code = (_a = codeFromString(jsonValue.code)) !== null && _a !== void 0 ? _a : code;
|
|
5122
|
+
}
|
|
5123
|
+
const message = jsonValue.message;
|
|
5124
|
+
if (message != null && typeof message !== "string") {
|
|
5125
|
+
throw fallback;
|
|
5126
|
+
}
|
|
5127
|
+
const error = new ConnectError(message !== null && message !== void 0 ? message : "", code, metadata);
|
|
5128
|
+
if ("details" in jsonValue && Array.isArray(jsonValue.details)) {
|
|
5129
|
+
for (const detail of jsonValue.details) {
|
|
5130
|
+
if (detail === null || typeof detail != "object" || Array.isArray(detail) || typeof detail.type != "string" || typeof detail.value != "string") {
|
|
5131
|
+
throw fallback;
|
|
5132
|
+
}
|
|
5133
|
+
try {
|
|
5134
|
+
error.details.push({
|
|
5135
|
+
type: detail.type,
|
|
5136
|
+
value: base64Decode(detail.value),
|
|
5137
|
+
debug: detail.debug
|
|
5138
|
+
});
|
|
5139
|
+
} catch (e) {
|
|
5140
|
+
throw fallback;
|
|
5141
|
+
}
|
|
5142
|
+
}
|
|
5143
|
+
}
|
|
5144
|
+
return error;
|
|
5145
|
+
}
|
|
5146
|
+
const endStreamFlag = 2;
|
|
5147
|
+
function endStreamFromJson(data) {
|
|
5148
|
+
const parseErr = new ConnectError("invalid end stream", Code$1.Unknown);
|
|
5149
|
+
let jsonValue;
|
|
5150
|
+
try {
|
|
5151
|
+
jsonValue = JSON.parse(typeof data == "string" ? data : new TextDecoder().decode(data));
|
|
5152
|
+
} catch (e) {
|
|
5153
|
+
throw parseErr;
|
|
5154
|
+
}
|
|
5155
|
+
if (typeof jsonValue != "object" || jsonValue == null || Array.isArray(jsonValue)) {
|
|
5156
|
+
throw parseErr;
|
|
5157
|
+
}
|
|
5158
|
+
const metadata = new Headers();
|
|
5159
|
+
if ("metadata" in jsonValue) {
|
|
5160
|
+
if (typeof jsonValue.metadata != "object" || jsonValue.metadata == null || Array.isArray(jsonValue.metadata)) {
|
|
5161
|
+
throw parseErr;
|
|
5162
|
+
}
|
|
5163
|
+
for (const [key, values] of Object.entries(jsonValue.metadata)) {
|
|
5164
|
+
if (!Array.isArray(values) || values.some((value) => typeof value != "string")) {
|
|
5165
|
+
throw parseErr;
|
|
5166
|
+
}
|
|
5167
|
+
for (const value of values) {
|
|
5168
|
+
metadata.append(key, value);
|
|
5169
|
+
}
|
|
5170
|
+
}
|
|
5171
|
+
}
|
|
5172
|
+
const error = "error" in jsonValue && jsonValue.error != null ? errorFromJson(jsonValue.error, metadata, parseErr) : void 0;
|
|
5173
|
+
return { metadata, error };
|
|
5174
|
+
}
|
|
5175
|
+
const headerContentType = "Content-Type";
|
|
5176
|
+
const headerUnaryContentLength = "Content-Length";
|
|
5177
|
+
const headerUnaryEncoding = "Content-Encoding";
|
|
5178
|
+
const headerUnaryAcceptEncoding = "Accept-Encoding";
|
|
5179
|
+
const headerTimeout = "Connect-Timeout-Ms";
|
|
5180
|
+
const headerProtocolVersion = "Connect-Protocol-Version";
|
|
5181
|
+
const headerUserAgent = "User-Agent";
|
|
5182
|
+
function codeFromHttpStatus$1(httpStatus) {
|
|
5183
|
+
switch (httpStatus) {
|
|
5184
|
+
case 400:
|
|
5185
|
+
return Code$1.Internal;
|
|
5186
|
+
case 401:
|
|
5187
|
+
return Code$1.Unauthenticated;
|
|
5188
|
+
case 403:
|
|
5189
|
+
return Code$1.PermissionDenied;
|
|
5190
|
+
case 404:
|
|
5191
|
+
return Code$1.Unimplemented;
|
|
5192
|
+
case 429:
|
|
5193
|
+
return Code$1.Unavailable;
|
|
5194
|
+
case 502:
|
|
5195
|
+
return Code$1.Unavailable;
|
|
5196
|
+
case 503:
|
|
5197
|
+
return Code$1.Unavailable;
|
|
5198
|
+
case 504:
|
|
5199
|
+
return Code$1.Unavailable;
|
|
5200
|
+
default:
|
|
5201
|
+
return Code$1.Unknown;
|
|
5202
|
+
}
|
|
5203
|
+
}
|
|
5204
|
+
function trailerDemux(header) {
|
|
5205
|
+
const h = new Headers(), t = new Headers();
|
|
5206
|
+
header.forEach((value, key) => {
|
|
5207
|
+
if (key.toLowerCase().startsWith("trailer-")) {
|
|
5208
|
+
t.append(key.substring(8), value);
|
|
5209
|
+
} else {
|
|
5210
|
+
h.append(key, value);
|
|
5211
|
+
}
|
|
5212
|
+
});
|
|
5213
|
+
return [h, t];
|
|
5214
|
+
}
|
|
5215
|
+
const protocolVersion = "1";
|
|
5216
|
+
function requestHeader$1(methodKind, useBinaryFormat, timeoutMs, userProvidedHeaders, setUserAgent) {
|
|
5217
|
+
const result = new Headers(userProvidedHeaders !== null && userProvidedHeaders !== void 0 ? userProvidedHeaders : {});
|
|
5218
|
+
if (timeoutMs !== void 0) {
|
|
5219
|
+
result.set(headerTimeout, `${timeoutMs}`);
|
|
5220
|
+
}
|
|
5221
|
+
result.set(headerContentType, methodKind == "unary" ? useBinaryFormat ? contentTypeUnaryProto : contentTypeUnaryJson : useBinaryFormat ? contentTypeStreamProto : contentTypeStreamJson);
|
|
5222
|
+
result.set(headerProtocolVersion, protocolVersion);
|
|
5223
|
+
if (!result.has(headerUserAgent) && setUserAgent) ;
|
|
5224
|
+
return result;
|
|
5225
|
+
}
|
|
5226
|
+
function validateResponse$1(methodKind, useBinaryFormat, status, headers) {
|
|
5227
|
+
const mimeType = headers.get(headerContentType);
|
|
5228
|
+
const parsedType = parseContentType(mimeType);
|
|
5229
|
+
if (status !== 200) {
|
|
5230
|
+
const errorFromStatus = new ConnectError(`HTTP ${status}`, codeFromHttpStatus$1(status), headers);
|
|
5231
|
+
if (methodKind == "unary" && parsedType && !parsedType.binary) {
|
|
5232
|
+
return { isUnaryError: true, unaryError: errorFromStatus };
|
|
5233
|
+
}
|
|
5234
|
+
throw errorFromStatus;
|
|
5235
|
+
}
|
|
5236
|
+
const allowedContentType = {
|
|
5237
|
+
binary: useBinaryFormat,
|
|
5238
|
+
stream: methodKind !== "unary"
|
|
5239
|
+
};
|
|
5240
|
+
if ((parsedType === null || parsedType === void 0 ? void 0 : parsedType.binary) !== allowedContentType.binary || parsedType.stream !== allowedContentType.stream) {
|
|
5241
|
+
throw new ConnectError(`unsupported content type ${mimeType}`, parsedType === void 0 ? Code$1.Unknown : Code$1.Internal, headers);
|
|
5242
|
+
}
|
|
5243
|
+
return { isUnaryError: false };
|
|
5244
|
+
}
|
|
5245
|
+
const contentTypePrefix = "application/";
|
|
5246
|
+
function encodeMessageForUrl(message, useBase64) {
|
|
5247
|
+
if (useBase64) {
|
|
5248
|
+
return base64Encode(message, "url");
|
|
5249
|
+
}
|
|
5250
|
+
return encodeURIComponent(new TextDecoder().decode(message));
|
|
5251
|
+
}
|
|
5252
|
+
function transformConnectPostToGetRequest(request, message, useBase64) {
|
|
5253
|
+
let query = `?connect=v${protocolVersion}`;
|
|
5254
|
+
const contentType = request.header.get(headerContentType);
|
|
5255
|
+
if ((contentType === null || contentType === void 0 ? void 0 : contentType.indexOf(contentTypePrefix)) === 0) {
|
|
5256
|
+
query += "&encoding=" + encodeURIComponent(contentType.slice(contentTypePrefix.length));
|
|
5257
|
+
}
|
|
5258
|
+
const compression = request.header.get(headerUnaryEncoding);
|
|
5259
|
+
if (compression !== null && compression !== "identity") {
|
|
5260
|
+
query += "&compression=" + encodeURIComponent(compression);
|
|
5261
|
+
useBase64 = true;
|
|
5262
|
+
}
|
|
5263
|
+
if (useBase64) {
|
|
5264
|
+
query += "&base64=1";
|
|
5265
|
+
}
|
|
5266
|
+
query += "&message=" + encodeMessageForUrl(message, useBase64);
|
|
5267
|
+
const url = request.url + query;
|
|
5268
|
+
const header = new Headers(request.header);
|
|
5269
|
+
for (const h of [
|
|
5270
|
+
headerProtocolVersion,
|
|
5271
|
+
headerContentType,
|
|
5272
|
+
headerUnaryContentLength,
|
|
5273
|
+
headerUnaryEncoding,
|
|
5274
|
+
headerUnaryAcceptEncoding
|
|
5275
|
+
]) {
|
|
5276
|
+
header.delete(h);
|
|
5277
|
+
}
|
|
5278
|
+
return Object.assign(Object.assign({}, request), {
|
|
5279
|
+
requestMethod: "GET",
|
|
5280
|
+
url,
|
|
5281
|
+
header
|
|
5282
|
+
});
|
|
5283
|
+
}
|
|
5064
5284
|
function runUnaryCall(opt) {
|
|
5065
5285
|
const next = applyInterceptors(opt.next, opt.interceptors);
|
|
5066
5286
|
const [signal, abort, done] = setupSignal(opt);
|
|
@@ -5129,6 +5349,181 @@ function assertFetchApi() {
|
|
|
5129
5349
|
throw new Error("connect-web requires the fetch API. Are you running on an old version of Node.js? Node.js is not supported in Connect for Web - please stay tuned for Connect for Node.");
|
|
5130
5350
|
}
|
|
5131
5351
|
}
|
|
5352
|
+
var __await$1 = function(v) {
|
|
5353
|
+
return this instanceof __await$1 ? (this.v = v, this) : new __await$1(v);
|
|
5354
|
+
};
|
|
5355
|
+
var __asyncGenerator$1 = function(thisArg, _arguments, generator) {
|
|
5356
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
5357
|
+
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
5358
|
+
return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function() {
|
|
5359
|
+
return this;
|
|
5360
|
+
}, i;
|
|
5361
|
+
function awaitReturn(f) {
|
|
5362
|
+
return function(v) {
|
|
5363
|
+
return Promise.resolve(v).then(f, reject);
|
|
5364
|
+
};
|
|
5365
|
+
}
|
|
5366
|
+
function verb(n, f) {
|
|
5367
|
+
if (g[n]) {
|
|
5368
|
+
i[n] = function(v) {
|
|
5369
|
+
return new Promise(function(a, b) {
|
|
5370
|
+
q.push([n, v, a, b]) > 1 || resume(n, v);
|
|
5371
|
+
});
|
|
5372
|
+
};
|
|
5373
|
+
if (f) i[n] = f(i[n]);
|
|
5374
|
+
}
|
|
5375
|
+
}
|
|
5376
|
+
function resume(n, v) {
|
|
5377
|
+
try {
|
|
5378
|
+
step(g[n](v));
|
|
5379
|
+
} catch (e) {
|
|
5380
|
+
settle(q[0][3], e);
|
|
5381
|
+
}
|
|
5382
|
+
}
|
|
5383
|
+
function step(r) {
|
|
5384
|
+
r.value instanceof __await$1 ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);
|
|
5385
|
+
}
|
|
5386
|
+
function fulfill(value) {
|
|
5387
|
+
resume("next", value);
|
|
5388
|
+
}
|
|
5389
|
+
function reject(value) {
|
|
5390
|
+
resume("throw", value);
|
|
5391
|
+
}
|
|
5392
|
+
function settle(f, v) {
|
|
5393
|
+
if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]);
|
|
5394
|
+
}
|
|
5395
|
+
};
|
|
5396
|
+
const fetchOptions$1 = {
|
|
5397
|
+
redirect: "error"
|
|
5398
|
+
};
|
|
5399
|
+
function createConnectTransport(options) {
|
|
5400
|
+
var _a;
|
|
5401
|
+
assertFetchApi();
|
|
5402
|
+
const useBinaryFormat = (_a = options.useBinaryFormat) !== null && _a !== void 0 ? _a : false;
|
|
5403
|
+
return {
|
|
5404
|
+
async unary(method, signal, timeoutMs, header, message, contextValues) {
|
|
5405
|
+
const { serialize, parse: parse2 } = createClientMethodSerializers(method, useBinaryFormat, options.jsonOptions, options.binaryOptions);
|
|
5406
|
+
timeoutMs = timeoutMs === void 0 ? options.defaultTimeoutMs : timeoutMs <= 0 ? void 0 : timeoutMs;
|
|
5407
|
+
return await runUnaryCall({
|
|
5408
|
+
interceptors: options.interceptors,
|
|
5409
|
+
signal,
|
|
5410
|
+
timeoutMs,
|
|
5411
|
+
req: {
|
|
5412
|
+
stream: false,
|
|
5413
|
+
service: method.parent,
|
|
5414
|
+
method,
|
|
5415
|
+
requestMethod: "POST",
|
|
5416
|
+
url: createMethodUrl(options.baseUrl, method),
|
|
5417
|
+
header: requestHeader$1(method.methodKind, useBinaryFormat, timeoutMs, header, false),
|
|
5418
|
+
contextValues: contextValues !== null && contextValues !== void 0 ? contextValues : createContextValues(),
|
|
5419
|
+
message
|
|
5420
|
+
},
|
|
5421
|
+
next: async (req) => {
|
|
5422
|
+
var _a2;
|
|
5423
|
+
const useGet = options.useHttpGet === true && method.idempotency === MethodOptions_IdempotencyLevel.NO_SIDE_EFFECTS;
|
|
5424
|
+
let body = null;
|
|
5425
|
+
if (useGet) {
|
|
5426
|
+
req = transformConnectPostToGetRequest(req, serialize(req.message), useBinaryFormat);
|
|
5427
|
+
} else {
|
|
5428
|
+
body = serialize(req.message);
|
|
5429
|
+
}
|
|
5430
|
+
const fetch2 = (_a2 = options.fetch) !== null && _a2 !== void 0 ? _a2 : globalThis.fetch;
|
|
5431
|
+
const response = await fetch2(req.url, Object.assign(Object.assign({}, fetchOptions$1), { method: req.requestMethod, headers: req.header, signal: req.signal, body }));
|
|
5432
|
+
const { isUnaryError, unaryError } = validateResponse$1(method.methodKind, useBinaryFormat, response.status, response.headers);
|
|
5433
|
+
if (isUnaryError) {
|
|
5434
|
+
throw errorFromJson(await response.json(), appendHeaders(...trailerDemux(response.headers)), unaryError);
|
|
5435
|
+
}
|
|
5436
|
+
const [demuxedHeader, demuxedTrailer] = trailerDemux(response.headers);
|
|
5437
|
+
return {
|
|
5438
|
+
stream: false,
|
|
5439
|
+
service: method.parent,
|
|
5440
|
+
method,
|
|
5441
|
+
header: demuxedHeader,
|
|
5442
|
+
message: useBinaryFormat ? parse2(new Uint8Array(await response.arrayBuffer())) : fromJson(method.output, await response.json(), getJsonOptions(options.jsonOptions)),
|
|
5443
|
+
trailer: demuxedTrailer
|
|
5444
|
+
};
|
|
5445
|
+
}
|
|
5446
|
+
});
|
|
5447
|
+
},
|
|
5448
|
+
async stream(method, signal, timeoutMs, header, input, contextValues) {
|
|
5449
|
+
const { serialize, parse: parse2 } = createClientMethodSerializers(method, useBinaryFormat, options.jsonOptions, options.binaryOptions);
|
|
5450
|
+
function parseResponseBody(body, trailerTarget, header2, signal2) {
|
|
5451
|
+
return __asyncGenerator$1(this, arguments, function* parseResponseBody_1() {
|
|
5452
|
+
const reader = createEnvelopeReadableStream(body).getReader();
|
|
5453
|
+
let endStreamReceived = false;
|
|
5454
|
+
for (; ; ) {
|
|
5455
|
+
const result = yield __await$1(reader.read());
|
|
5456
|
+
if (result.done) {
|
|
5457
|
+
break;
|
|
5458
|
+
}
|
|
5459
|
+
const { flags, data } = result.value;
|
|
5460
|
+
if ((flags & compressedFlag) === compressedFlag) {
|
|
5461
|
+
throw new ConnectError(`protocol error: received unsupported compressed output`, Code$1.Internal);
|
|
5462
|
+
}
|
|
5463
|
+
if ((flags & endStreamFlag) === endStreamFlag) {
|
|
5464
|
+
endStreamReceived = true;
|
|
5465
|
+
const endStream = endStreamFromJson(data);
|
|
5466
|
+
if (endStream.error) {
|
|
5467
|
+
const error = endStream.error;
|
|
5468
|
+
header2.forEach((value, key) => {
|
|
5469
|
+
error.metadata.append(key, value);
|
|
5470
|
+
});
|
|
5471
|
+
throw error;
|
|
5472
|
+
}
|
|
5473
|
+
endStream.metadata.forEach((value, key) => trailerTarget.set(key, value));
|
|
5474
|
+
continue;
|
|
5475
|
+
}
|
|
5476
|
+
yield yield __await$1(parse2(data));
|
|
5477
|
+
}
|
|
5478
|
+
if ("throwIfAborted" in signal2) {
|
|
5479
|
+
signal2.throwIfAborted();
|
|
5480
|
+
}
|
|
5481
|
+
if (!endStreamReceived) {
|
|
5482
|
+
throw "missing EndStreamResponse";
|
|
5483
|
+
}
|
|
5484
|
+
});
|
|
5485
|
+
}
|
|
5486
|
+
async function createRequestBody(input2) {
|
|
5487
|
+
if (method.methodKind != "server_streaming") {
|
|
5488
|
+
throw "The fetch API does not support streaming request bodies";
|
|
5489
|
+
}
|
|
5490
|
+
const r = await input2[Symbol.asyncIterator]().next();
|
|
5491
|
+
if (r.done == true) {
|
|
5492
|
+
throw "missing request message";
|
|
5493
|
+
}
|
|
5494
|
+
return encodeEnvelope(0, serialize(r.value));
|
|
5495
|
+
}
|
|
5496
|
+
timeoutMs = timeoutMs === void 0 ? options.defaultTimeoutMs : timeoutMs <= 0 ? void 0 : timeoutMs;
|
|
5497
|
+
return await runStreamingCall({
|
|
5498
|
+
interceptors: options.interceptors,
|
|
5499
|
+
timeoutMs,
|
|
5500
|
+
signal,
|
|
5501
|
+
req: {
|
|
5502
|
+
stream: true,
|
|
5503
|
+
service: method.parent,
|
|
5504
|
+
method,
|
|
5505
|
+
requestMethod: "POST",
|
|
5506
|
+
url: createMethodUrl(options.baseUrl, method),
|
|
5507
|
+
header: requestHeader$1(method.methodKind, useBinaryFormat, timeoutMs, header, false),
|
|
5508
|
+
contextValues: contextValues !== null && contextValues !== void 0 ? contextValues : createContextValues(),
|
|
5509
|
+
message: input
|
|
5510
|
+
},
|
|
5511
|
+
next: async (req) => {
|
|
5512
|
+
var _a2;
|
|
5513
|
+
const fetch2 = (_a2 = options.fetch) !== null && _a2 !== void 0 ? _a2 : globalThis.fetch;
|
|
5514
|
+
const fRes = await fetch2(req.url, Object.assign(Object.assign({}, fetchOptions$1), { method: req.requestMethod, headers: req.header, signal: req.signal, body: await createRequestBody(req.message) }));
|
|
5515
|
+
validateResponse$1(method.methodKind, useBinaryFormat, fRes.status, fRes.headers);
|
|
5516
|
+
if (fRes.body === null) {
|
|
5517
|
+
throw "missing response body";
|
|
5518
|
+
}
|
|
5519
|
+
const trailer = new Headers();
|
|
5520
|
+
const res = Object.assign(Object.assign({}, req), { header: fRes.headers, trailer, message: parseResponseBody(fRes.body, trailer, fRes.headers, req.signal) });
|
|
5521
|
+
return res;
|
|
5522
|
+
}
|
|
5523
|
+
});
|
|
5524
|
+
}
|
|
5525
|
+
};
|
|
5526
|
+
}
|
|
5132
5527
|
function validateTrailer(trailer, header) {
|
|
5133
5528
|
const err = findTrailerError(trailer);
|
|
5134
5529
|
if (err) {
|
|
@@ -5144,12 +5539,12 @@ function validateTrailer(trailer, header) {
|
|
|
5144
5539
|
function requestHeader(useBinaryFormat, timeoutMs, userProvidedHeaders, setUserAgent) {
|
|
5145
5540
|
var _a, _b;
|
|
5146
5541
|
const result = new Headers(userProvidedHeaders !== null && userProvidedHeaders !== void 0 ? userProvidedHeaders : {});
|
|
5147
|
-
result.set(headerContentType, useBinaryFormat ? contentTypeProto : contentTypeJson);
|
|
5542
|
+
result.set(headerContentType$1, useBinaryFormat ? contentTypeProto : contentTypeJson);
|
|
5148
5543
|
result.set(headerXGrpcWeb, "1");
|
|
5149
|
-
const userAgent = (_b = (_a = result.get(headerUserAgent)) !== null && _a !== void 0 ? _a : result.get(headerXUserAgent)) !== null && _b !== void 0 ? _b : "connect-es/2.1.1";
|
|
5544
|
+
const userAgent = (_b = (_a = result.get(headerUserAgent$1)) !== null && _a !== void 0 ? _a : result.get(headerXUserAgent)) !== null && _b !== void 0 ? _b : "connect-es/2.1.1";
|
|
5150
5545
|
result.set(headerXUserAgent, userAgent);
|
|
5151
5546
|
if (timeoutMs !== void 0) {
|
|
5152
|
-
result.set(headerTimeout, `${timeoutMs}m`);
|
|
5547
|
+
result.set(headerTimeout$1, `${timeoutMs}m`);
|
|
5153
5548
|
}
|
|
5154
5549
|
return result;
|
|
5155
5550
|
}
|
|
@@ -5393,7 +5788,7 @@ function createGrpcWebTransport(options) {
|
|
|
5393
5788
|
}
|
|
5394
5789
|
};
|
|
5395
5790
|
}
|
|
5396
|
-
const file_src_api_yorkie_v1_resources = /* @__PURE__ */ fileDesc("CiFzcmMvYXBpL3lvcmtpZS92MS9yZXNvdXJjZXMucHJvdG8SCXlvcmtpZS52MSKuAQoIU25hcHNob3QSJAoEcm9vdBgBIAEoCzIWLnlvcmtpZS52MS5KU09ORWxlbWVudBI1CglwcmVzZW5jZXMYAiADKAsyIi55b3JraWUudjEuU25hcHNob3QuUHJlc2VuY2VzRW50cnkaRQoOUHJlc2VuY2VzRW50cnkSCwoDa2V5GAEgASgJEiIKBXZhbHVlGAIgASgLMhMueW9ya2llLnYxLlByZXNlbmNlOgI4ASL7AQoKQ2hhbmdlUGFjaxIUCgxkb2N1bWVudF9rZXkYASABKAkSKQoKY2hlY2twb2ludBgCIAEoCzIVLnlvcmtpZS52MS5DaGVja3BvaW50EhAKCHNuYXBzaG90GAMgASgMEiIKB2NoYW5nZXMYBCADKAsyES55b3JraWUudjEuQ2hhbmdlEjAKEW1pbl9zeW5jZWRfdGlja2V0GAUgASgLMhUueW9ya2llLnYxLlR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X2F0GAUgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcCrUAgoJVmFsdWVUeXBlEhMKD1ZBTFVFX1RZUEVfTlVMTBAAEhYKElZBTFVFX1RZUEVfQk9PTEVBThABEhYKElZBTFVFX1RZUEVfSU5URUdFUhACEhMKD1ZBTFVFX1RZUEVfTE9ORxADEhUKEVZBTFVFX1RZUEVfRE9VQkxFEAQSFQoRVkFMVUVfVFlQRV9TVFJJTkcQBRIUChBWQUxVRV9UWVBFX0JZVEVTEAYSEwoPVkFMVUVfVFlQRV9EQVRFEAcSGgoWVkFMVUVfVFlQRV9KU09OX09CSkVDVBAIEhkKFVZBTFVFX1RZUEVfSlNPTl9BUlJBWRAJEhMKD1ZBTFVFX1RZUEVfVEVYVBAKEhoKFlZBTFVFX1RZUEVfSU5URUdFUl9DTlQQCxIXChNWQUxVRV9UWVBFX0xPTkdfQ05UEAwSEwoPVkFMVUVfVFlQRV9UUkVFEA0qpgEKDERvY0V2ZW50VHlwZRIjCh9ET0NfRVZFTlRfVFlQRV9ET0NVTUVOVF9DSEFOR0VEEAASIwofRE9DX0VWRU5UX1RZUEVfRE9DVU1FTlRfV0FUQ0hFRBABEiUKIURPQ19FVkVOVF9UWVBFX0RPQ1VNRU5UX1VOV0FUQ0hFRBACEiUKIURPQ19FVkVOVF9UWVBFX0RPQ1VNRU5UX0JST0FEQ0FTVBADQkUKEWRldi55b3JraWUuYXBpLnYxUAFaLmdpdGh1Yi5jb20veW9ya2llLXRlYW0veW9ya2llL2FwaS95b3JraWUvdjE7djFiBnByb3RvMw", [file_google_protobuf_timestamp, file_google_protobuf_wrappers]);
|
|
5791
|
+
const file_src_api_yorkie_v1_resources = /* @__PURE__ */ fileDesc("CiFzcmMvYXBpL3lvcmtpZS92MS9yZXNvdXJjZXMucHJvdG8SCXlvcmtpZS52MSKuAQoIU25hcHNob3QSJAoEcm9vdBgBIAEoCzIWLnlvcmtpZS52MS5KU09ORWxlbWVudBI1CglwcmVzZW5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RFWFQQChIaChZWQUxVRV9UWVBFX0lOVEVHRVJfQ05UEAsSFwoTVkFMVUVfVFlQRV9MT05HX0NOVBAMEhMKD1ZBTFVFX1RZUEVfVFJFRRANEiAKHFZBTFVFX1RZUEVfSU5URUdFUl9ERURVUF9DTlQQDiIECA8QDyqmAQoMRG9jRXZlbnRUeXBlEiMKH0RPQ19FVkVOVF9UWVBFX0RPQ1VNRU5UX0NIQU5HRUQQABIjCh9ET0NfRVZFTlRfVFlQRV9ET0NVTUVOVF9XQVRDSEVEEAESJQohRE9DX0VWRU5UX1RZUEVfRE9DVU1FTlRfVU5XQVRDSEVEEAISJQohRE9DX0VWRU5UX1RZUEVfRE9DVU1FTlRfQlJPQURDQVNUEANCRQoRZGV2LnlvcmtpZS5hcGkudjFQAVouZ2l0aHViLmNvbS95b3JraWUtdGVhbS95b3JraWUvYXBpL3lvcmtpZS92MTt2MWIGcHJvdG8z", [file_google_protobuf_timestamp, file_google_protobuf_wrappers]);
|
|
5397
5792
|
const SnapshotSchema = /* @__PURE__ */ messageDesc(file_src_api_yorkie_v1_resources, 0);
|
|
5398
5793
|
const ChangePackSchema = /* @__PURE__ */ messageDesc(file_src_api_yorkie_v1_resources, 1);
|
|
5399
5794
|
const ChangeSchema = /* @__PURE__ */ messageDesc(file_src_api_yorkie_v1_resources, 2);
|
|
@@ -5460,6 +5855,7 @@ var ValueType = /* @__PURE__ */ ((ValueType2) => {
|
|
|
5460
5855
|
ValueType2[ValueType2["INTEGER_CNT"] = 11] = "INTEGER_CNT";
|
|
5461
5856
|
ValueType2[ValueType2["LONG_CNT"] = 12] = "LONG_CNT";
|
|
5462
5857
|
ValueType2[ValueType2["TREE"] = 13] = "TREE";
|
|
5858
|
+
ValueType2[ValueType2["INTEGER_DEDUP_CNT"] = 14] = "INTEGER_DEDUP_CNT";
|
|
5463
5859
|
return ValueType2;
|
|
5464
5860
|
})(ValueType || {});
|
|
5465
5861
|
var DocEventType$1 = /* @__PURE__ */ ((DocEventType2) => {
|
|
@@ -5616,9 +6012,9 @@ class TimeTicket {
|
|
|
5616
6012
|
} else if (other.lamport > this.lamport) {
|
|
5617
6013
|
return -1;
|
|
5618
6014
|
}
|
|
5619
|
-
const
|
|
5620
|
-
if (
|
|
5621
|
-
return
|
|
6015
|
+
const compare = this.actorID.localeCompare(other.actorID);
|
|
6016
|
+
if (compare !== 0) {
|
|
6017
|
+
return compare;
|
|
5622
6018
|
}
|
|
5623
6019
|
if (this.delimiter > other.delimiter) {
|
|
5624
6020
|
return 1;
|
|
@@ -6611,923 +7007,32 @@ class SplayTree {
|
|
|
6611
7007
|
return false;
|
|
6612
7008
|
}
|
|
6613
7009
|
}
|
|
6614
|
-
|
|
6615
|
-
|
|
6616
|
-
|
|
6617
|
-
|
|
6618
|
-
|
|
6619
|
-
|
|
6620
|
-
|
|
6621
|
-
97,
|
|
6622
|
-
115,
|
|
6623
|
-
109,
|
|
6624
|
-
// version 1
|
|
6625
|
-
1,
|
|
6626
|
-
0,
|
|
6627
|
-
0,
|
|
6628
|
-
0,
|
|
6629
|
-
// section "type"
|
|
6630
|
-
1,
|
|
6631
|
-
13,
|
|
6632
|
-
2,
|
|
6633
|
-
// 0, () => i32
|
|
6634
|
-
96,
|
|
6635
|
-
0,
|
|
6636
|
-
1,
|
|
6637
|
-
127,
|
|
6638
|
-
// 1, (i32, i32, i32, i32) => i32
|
|
6639
|
-
96,
|
|
6640
|
-
4,
|
|
6641
|
-
127,
|
|
6642
|
-
127,
|
|
6643
|
-
127,
|
|
6644
|
-
127,
|
|
6645
|
-
1,
|
|
6646
|
-
127,
|
|
6647
|
-
// section "function"
|
|
6648
|
-
3,
|
|
6649
|
-
7,
|
|
6650
|
-
6,
|
|
6651
|
-
// 0, type 0
|
|
6652
|
-
0,
|
|
6653
|
-
// 1, type 1
|
|
6654
|
-
1,
|
|
6655
|
-
// 2, type 1
|
|
6656
|
-
1,
|
|
6657
|
-
// 3, type 1
|
|
6658
|
-
1,
|
|
6659
|
-
// 4, type 1
|
|
6660
|
-
1,
|
|
6661
|
-
// 5, type 1
|
|
6662
|
-
1,
|
|
6663
|
-
// section "global"
|
|
6664
|
-
6,
|
|
6665
|
-
6,
|
|
6666
|
-
1,
|
|
6667
|
-
// 0, "high", mutable i32
|
|
6668
|
-
127,
|
|
6669
|
-
1,
|
|
6670
|
-
65,
|
|
6671
|
-
0,
|
|
6672
|
-
11,
|
|
6673
|
-
// section "export"
|
|
6674
|
-
7,
|
|
6675
|
-
50,
|
|
6676
|
-
6,
|
|
6677
|
-
// 0, "mul"
|
|
6678
|
-
3,
|
|
6679
|
-
109,
|
|
6680
|
-
117,
|
|
6681
|
-
108,
|
|
6682
|
-
0,
|
|
6683
|
-
1,
|
|
6684
|
-
// 1, "div_s"
|
|
6685
|
-
5,
|
|
6686
|
-
100,
|
|
6687
|
-
105,
|
|
6688
|
-
118,
|
|
6689
|
-
95,
|
|
6690
|
-
115,
|
|
6691
|
-
0,
|
|
6692
|
-
2,
|
|
6693
|
-
// 2, "div_u"
|
|
6694
|
-
5,
|
|
6695
|
-
100,
|
|
6696
|
-
105,
|
|
6697
|
-
118,
|
|
6698
|
-
95,
|
|
6699
|
-
117,
|
|
6700
|
-
0,
|
|
6701
|
-
3,
|
|
6702
|
-
// 3, "rem_s"
|
|
6703
|
-
5,
|
|
6704
|
-
114,
|
|
6705
|
-
101,
|
|
6706
|
-
109,
|
|
6707
|
-
95,
|
|
6708
|
-
115,
|
|
6709
|
-
0,
|
|
6710
|
-
4,
|
|
6711
|
-
// 4, "rem_u"
|
|
6712
|
-
5,
|
|
6713
|
-
114,
|
|
6714
|
-
101,
|
|
6715
|
-
109,
|
|
6716
|
-
95,
|
|
6717
|
-
117,
|
|
6718
|
-
0,
|
|
6719
|
-
5,
|
|
6720
|
-
// 5, "get_high"
|
|
6721
|
-
8,
|
|
6722
|
-
103,
|
|
6723
|
-
101,
|
|
6724
|
-
116,
|
|
6725
|
-
95,
|
|
6726
|
-
104,
|
|
6727
|
-
105,
|
|
6728
|
-
103,
|
|
6729
|
-
104,
|
|
6730
|
-
0,
|
|
6731
|
-
0,
|
|
6732
|
-
// section "code"
|
|
6733
|
-
10,
|
|
6734
|
-
191,
|
|
6735
|
-
1,
|
|
6736
|
-
6,
|
|
6737
|
-
// 0, "get_high"
|
|
6738
|
-
4,
|
|
6739
|
-
0,
|
|
6740
|
-
35,
|
|
6741
|
-
0,
|
|
6742
|
-
11,
|
|
6743
|
-
// 1, "mul"
|
|
6744
|
-
36,
|
|
6745
|
-
1,
|
|
6746
|
-
1,
|
|
6747
|
-
126,
|
|
6748
|
-
32,
|
|
6749
|
-
0,
|
|
6750
|
-
173,
|
|
6751
|
-
32,
|
|
6752
|
-
1,
|
|
6753
|
-
173,
|
|
6754
|
-
66,
|
|
6755
|
-
32,
|
|
6756
|
-
134,
|
|
6757
|
-
132,
|
|
6758
|
-
32,
|
|
6759
|
-
2,
|
|
6760
|
-
173,
|
|
6761
|
-
32,
|
|
6762
|
-
3,
|
|
6763
|
-
173,
|
|
6764
|
-
66,
|
|
6765
|
-
32,
|
|
6766
|
-
134,
|
|
6767
|
-
132,
|
|
6768
|
-
126,
|
|
6769
|
-
34,
|
|
6770
|
-
4,
|
|
6771
|
-
66,
|
|
6772
|
-
32,
|
|
6773
|
-
135,
|
|
6774
|
-
167,
|
|
6775
|
-
36,
|
|
6776
|
-
0,
|
|
6777
|
-
32,
|
|
6778
|
-
4,
|
|
6779
|
-
167,
|
|
6780
|
-
11,
|
|
6781
|
-
// 2, "div_s"
|
|
6782
|
-
36,
|
|
6783
|
-
1,
|
|
6784
|
-
1,
|
|
6785
|
-
126,
|
|
6786
|
-
32,
|
|
6787
|
-
0,
|
|
6788
|
-
173,
|
|
6789
|
-
32,
|
|
6790
|
-
1,
|
|
6791
|
-
173,
|
|
6792
|
-
66,
|
|
6793
|
-
32,
|
|
6794
|
-
134,
|
|
6795
|
-
132,
|
|
6796
|
-
32,
|
|
6797
|
-
2,
|
|
6798
|
-
173,
|
|
6799
|
-
32,
|
|
6800
|
-
3,
|
|
6801
|
-
173,
|
|
6802
|
-
66,
|
|
6803
|
-
32,
|
|
6804
|
-
134,
|
|
6805
|
-
132,
|
|
6806
|
-
127,
|
|
6807
|
-
34,
|
|
6808
|
-
4,
|
|
6809
|
-
66,
|
|
6810
|
-
32,
|
|
6811
|
-
135,
|
|
6812
|
-
167,
|
|
6813
|
-
36,
|
|
6814
|
-
0,
|
|
6815
|
-
32,
|
|
6816
|
-
4,
|
|
6817
|
-
167,
|
|
6818
|
-
11,
|
|
6819
|
-
// 3, "div_u"
|
|
6820
|
-
36,
|
|
6821
|
-
1,
|
|
6822
|
-
1,
|
|
6823
|
-
126,
|
|
6824
|
-
32,
|
|
6825
|
-
0,
|
|
6826
|
-
173,
|
|
6827
|
-
32,
|
|
6828
|
-
1,
|
|
6829
|
-
173,
|
|
6830
|
-
66,
|
|
6831
|
-
32,
|
|
6832
|
-
134,
|
|
6833
|
-
132,
|
|
6834
|
-
32,
|
|
6835
|
-
2,
|
|
6836
|
-
173,
|
|
6837
|
-
32,
|
|
6838
|
-
3,
|
|
6839
|
-
173,
|
|
6840
|
-
66,
|
|
6841
|
-
32,
|
|
6842
|
-
134,
|
|
6843
|
-
132,
|
|
6844
|
-
128,
|
|
6845
|
-
34,
|
|
6846
|
-
4,
|
|
6847
|
-
66,
|
|
6848
|
-
32,
|
|
6849
|
-
135,
|
|
6850
|
-
167,
|
|
6851
|
-
36,
|
|
6852
|
-
0,
|
|
6853
|
-
32,
|
|
6854
|
-
4,
|
|
6855
|
-
167,
|
|
6856
|
-
11,
|
|
6857
|
-
// 4, "rem_s"
|
|
6858
|
-
36,
|
|
6859
|
-
1,
|
|
6860
|
-
1,
|
|
6861
|
-
126,
|
|
6862
|
-
32,
|
|
6863
|
-
0,
|
|
6864
|
-
173,
|
|
6865
|
-
32,
|
|
6866
|
-
1,
|
|
6867
|
-
173,
|
|
6868
|
-
66,
|
|
6869
|
-
32,
|
|
6870
|
-
134,
|
|
6871
|
-
132,
|
|
6872
|
-
32,
|
|
6873
|
-
2,
|
|
6874
|
-
173,
|
|
6875
|
-
32,
|
|
6876
|
-
3,
|
|
6877
|
-
173,
|
|
6878
|
-
66,
|
|
6879
|
-
32,
|
|
6880
|
-
134,
|
|
6881
|
-
132,
|
|
6882
|
-
129,
|
|
6883
|
-
34,
|
|
6884
|
-
4,
|
|
6885
|
-
66,
|
|
6886
|
-
32,
|
|
6887
|
-
135,
|
|
6888
|
-
167,
|
|
6889
|
-
36,
|
|
6890
|
-
0,
|
|
6891
|
-
32,
|
|
6892
|
-
4,
|
|
6893
|
-
167,
|
|
6894
|
-
11,
|
|
6895
|
-
// 5, "rem_u"
|
|
6896
|
-
36,
|
|
6897
|
-
1,
|
|
6898
|
-
1,
|
|
6899
|
-
126,
|
|
6900
|
-
32,
|
|
6901
|
-
0,
|
|
6902
|
-
173,
|
|
6903
|
-
32,
|
|
6904
|
-
1,
|
|
6905
|
-
173,
|
|
6906
|
-
66,
|
|
6907
|
-
32,
|
|
6908
|
-
134,
|
|
6909
|
-
132,
|
|
6910
|
-
32,
|
|
6911
|
-
2,
|
|
6912
|
-
173,
|
|
6913
|
-
32,
|
|
6914
|
-
3,
|
|
6915
|
-
173,
|
|
6916
|
-
66,
|
|
6917
|
-
32,
|
|
6918
|
-
134,
|
|
6919
|
-
132,
|
|
6920
|
-
130,
|
|
6921
|
-
34,
|
|
6922
|
-
4,
|
|
6923
|
-
66,
|
|
6924
|
-
32,
|
|
6925
|
-
135,
|
|
6926
|
-
167,
|
|
6927
|
-
36,
|
|
6928
|
-
0,
|
|
6929
|
-
32,
|
|
6930
|
-
4,
|
|
6931
|
-
167,
|
|
6932
|
-
11
|
|
6933
|
-
])
|
|
6934
|
-
),
|
|
6935
|
-
{}
|
|
6936
|
-
).exports;
|
|
6937
|
-
} catch {
|
|
6938
|
-
}
|
|
6939
|
-
function Long(low, high, unsigned) {
|
|
6940
|
-
this.low = low | 0;
|
|
6941
|
-
this.high = high | 0;
|
|
6942
|
-
this.unsigned = !!unsigned;
|
|
6943
|
-
}
|
|
6944
|
-
Long.prototype.__isLong__;
|
|
6945
|
-
Object.defineProperty(Long.prototype, "__isLong__", { value: true });
|
|
6946
|
-
function isLong$1(obj) {
|
|
6947
|
-
return (obj && obj["__isLong__"]) === true;
|
|
6948
|
-
}
|
|
6949
|
-
function ctz32(value) {
|
|
6950
|
-
var c = Math.clz32(value & -value);
|
|
6951
|
-
return value ? 31 - c : c;
|
|
6952
|
-
}
|
|
6953
|
-
Long.isLong = isLong$1;
|
|
6954
|
-
var INT_CACHE = {};
|
|
6955
|
-
var UINT_CACHE = {};
|
|
6956
|
-
function fromInt(value, unsigned) {
|
|
6957
|
-
var obj, cachedObj, cache;
|
|
6958
|
-
if (unsigned) {
|
|
6959
|
-
value >>>= 0;
|
|
6960
|
-
if (cache = 0 <= value && value < 256) {
|
|
6961
|
-
cachedObj = UINT_CACHE[value];
|
|
6962
|
-
if (cachedObj) return cachedObj;
|
|
6963
|
-
}
|
|
6964
|
-
obj = fromBits(value, 0, true);
|
|
6965
|
-
if (cache) UINT_CACHE[value] = obj;
|
|
6966
|
-
return obj;
|
|
6967
|
-
} else {
|
|
6968
|
-
value |= 0;
|
|
6969
|
-
if (cache = -128 <= value && value < 128) {
|
|
6970
|
-
cachedObj = INT_CACHE[value];
|
|
6971
|
-
if (cachedObj) return cachedObj;
|
|
6972
|
-
}
|
|
6973
|
-
obj = fromBits(value, value < 0 ? -1 : 0, false);
|
|
6974
|
-
if (cache) INT_CACHE[value] = obj;
|
|
6975
|
-
return obj;
|
|
7010
|
+
const removeDecimal = (number) => number < 0 ? Math.ceil(number) : Math.floor(number);
|
|
7011
|
+
function bigintToBytesLE(value) {
|
|
7012
|
+
const buf = new Uint8Array(8);
|
|
7013
|
+
let v = BigInt.asUintN(64, value);
|
|
7014
|
+
for (let i = 0; i < 8; i++) {
|
|
7015
|
+
buf[i] = Number(v & 0xffn);
|
|
7016
|
+
v >>= 8n;
|
|
6976
7017
|
}
|
|
7018
|
+
return buf;
|
|
6977
7019
|
}
|
|
6978
|
-
|
|
6979
|
-
|
|
6980
|
-
|
|
6981
|
-
|
|
6982
|
-
if (value < 0) return UZERO;
|
|
6983
|
-
if (value >= TWO_PWR_64_DBL) return MAX_UNSIGNED_VALUE;
|
|
6984
|
-
} else {
|
|
6985
|
-
if (value <= -TWO_PWR_63_DBL) return MIN_VALUE;
|
|
6986
|
-
if (value + 1 >= TWO_PWR_63_DBL) return MAX_VALUE;
|
|
6987
|
-
}
|
|
6988
|
-
if (value < 0) return fromNumber(-value, unsigned).neg();
|
|
6989
|
-
return fromBits(
|
|
6990
|
-
value % TWO_PWR_32_DBL | 0,
|
|
6991
|
-
value / TWO_PWR_32_DBL | 0,
|
|
6992
|
-
unsigned
|
|
6993
|
-
);
|
|
6994
|
-
}
|
|
6995
|
-
Long.fromNumber = fromNumber;
|
|
6996
|
-
function fromBits(lowBits, highBits, unsigned) {
|
|
6997
|
-
return new Long(lowBits, highBits, unsigned);
|
|
6998
|
-
}
|
|
6999
|
-
Long.fromBits = fromBits;
|
|
7000
|
-
var pow_dbl = Math.pow;
|
|
7001
|
-
function fromString(str, unsigned, radix) {
|
|
7002
|
-
if (str.length === 0) throw Error("empty string");
|
|
7003
|
-
if (typeof unsigned === "number") {
|
|
7004
|
-
radix = unsigned;
|
|
7005
|
-
unsigned = false;
|
|
7006
|
-
} else {
|
|
7007
|
-
unsigned = !!unsigned;
|
|
7008
|
-
}
|
|
7009
|
-
if (str === "NaN" || str === "Infinity" || str === "+Infinity" || str === "-Infinity")
|
|
7010
|
-
return unsigned ? UZERO : ZERO;
|
|
7011
|
-
radix = radix || 10;
|
|
7012
|
-
if (radix < 2 || 36 < radix) throw RangeError("radix");
|
|
7013
|
-
var p;
|
|
7014
|
-
if ((p = str.indexOf("-")) > 0) throw Error("interior hyphen");
|
|
7015
|
-
else if (p === 0) {
|
|
7016
|
-
return fromString(str.substring(1), unsigned, radix).neg();
|
|
7017
|
-
}
|
|
7018
|
-
var radixToPower = fromNumber(pow_dbl(radix, 8));
|
|
7019
|
-
var result = ZERO;
|
|
7020
|
-
for (var i = 0; i < str.length; i += 8) {
|
|
7021
|
-
var size = Math.min(8, str.length - i), value = parseInt(str.substring(i, i + size), radix);
|
|
7022
|
-
if (size < 8) {
|
|
7023
|
-
var power = fromNumber(pow_dbl(radix, size));
|
|
7024
|
-
result = result.mul(power).add(fromNumber(value));
|
|
7025
|
-
} else {
|
|
7026
|
-
result = result.mul(radixToPower);
|
|
7027
|
-
result = result.add(fromNumber(value));
|
|
7028
|
-
}
|
|
7020
|
+
function bigintFromBytesLE(bytes) {
|
|
7021
|
+
let v = 0n;
|
|
7022
|
+
for (let i = 7; i >= 0; i--) {
|
|
7023
|
+
v = v << 8n | BigInt(bytes[i]);
|
|
7029
7024
|
}
|
|
7030
|
-
|
|
7031
|
-
return result;
|
|
7025
|
+
return BigInt.asIntN(64, v);
|
|
7032
7026
|
}
|
|
7033
|
-
|
|
7034
|
-
|
|
7035
|
-
|
|
7036
|
-
|
|
7037
|
-
return fromBits(
|
|
7038
|
-
val.low,
|
|
7039
|
-
val.high,
|
|
7040
|
-
typeof unsigned === "boolean" ? unsigned : val.unsigned
|
|
7041
|
-
);
|
|
7042
|
-
}
|
|
7043
|
-
Long.fromValue = fromValue;
|
|
7044
|
-
var TWO_PWR_16_DBL = 1 << 16;
|
|
7045
|
-
var TWO_PWR_24_DBL = 1 << 24;
|
|
7046
|
-
var TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL;
|
|
7047
|
-
var TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL;
|
|
7048
|
-
var TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2;
|
|
7049
|
-
var TWO_PWR_24 = fromInt(TWO_PWR_24_DBL);
|
|
7050
|
-
var ZERO = fromInt(0);
|
|
7051
|
-
Long.ZERO = ZERO;
|
|
7052
|
-
var UZERO = fromInt(0, true);
|
|
7053
|
-
Long.UZERO = UZERO;
|
|
7054
|
-
var ONE = fromInt(1);
|
|
7055
|
-
Long.ONE = ONE;
|
|
7056
|
-
var UONE = fromInt(1, true);
|
|
7057
|
-
Long.UONE = UONE;
|
|
7058
|
-
var NEG_ONE = fromInt(-1);
|
|
7059
|
-
Long.NEG_ONE = NEG_ONE;
|
|
7060
|
-
var MAX_VALUE = fromBits(4294967295 | 0, 2147483647 | 0, false);
|
|
7061
|
-
Long.MAX_VALUE = MAX_VALUE;
|
|
7062
|
-
var MAX_UNSIGNED_VALUE = fromBits(4294967295 | 0, 4294967295 | 0, true);
|
|
7063
|
-
Long.MAX_UNSIGNED_VALUE = MAX_UNSIGNED_VALUE;
|
|
7064
|
-
var MIN_VALUE = fromBits(0, 2147483648 | 0, false);
|
|
7065
|
-
Long.MIN_VALUE = MIN_VALUE;
|
|
7066
|
-
var LongPrototype = Long.prototype;
|
|
7067
|
-
LongPrototype.toInt = function toInt() {
|
|
7068
|
-
return this.unsigned ? this.low >>> 0 : this.low;
|
|
7069
|
-
};
|
|
7070
|
-
LongPrototype.toNumber = function toNumber() {
|
|
7071
|
-
if (this.unsigned)
|
|
7072
|
-
return (this.high >>> 0) * TWO_PWR_32_DBL + (this.low >>> 0);
|
|
7073
|
-
return this.high * TWO_PWR_32_DBL + (this.low >>> 0);
|
|
7074
|
-
};
|
|
7075
|
-
LongPrototype.toString = function toString(radix) {
|
|
7076
|
-
radix = radix || 10;
|
|
7077
|
-
if (radix < 2 || 36 < radix) throw RangeError("radix");
|
|
7078
|
-
if (this.isZero()) return "0";
|
|
7079
|
-
if (this.isNegative()) {
|
|
7080
|
-
if (this.eq(MIN_VALUE)) {
|
|
7081
|
-
var radixLong = fromNumber(radix), div = this.div(radixLong), rem1 = div.mul(radixLong).sub(this);
|
|
7082
|
-
return div.toString(radix) + rem1.toInt().toString(radix);
|
|
7083
|
-
} else return "-" + this.neg().toString(radix);
|
|
7084
|
-
}
|
|
7085
|
-
var radixToPower = fromNumber(pow_dbl(radix, 6), this.unsigned), rem = this;
|
|
7086
|
-
var result = "";
|
|
7087
|
-
while (true) {
|
|
7088
|
-
var remDiv = rem.div(radixToPower), intval = rem.sub(remDiv.mul(radixToPower)).toInt() >>> 0, digits = intval.toString(radix);
|
|
7089
|
-
rem = remDiv;
|
|
7090
|
-
if (rem.isZero()) return digits + result;
|
|
7091
|
-
else {
|
|
7092
|
-
while (digits.length < 6) digits = "0" + digits;
|
|
7093
|
-
result = "" + digits + result;
|
|
7094
|
-
}
|
|
7027
|
+
function bigintFromBytesLEUnsigned(bytes) {
|
|
7028
|
+
let v = 0n;
|
|
7029
|
+
for (let i = 7; i >= 0; i--) {
|
|
7030
|
+
v = v << 8n | BigInt(bytes[i]);
|
|
7095
7031
|
}
|
|
7096
|
-
|
|
7097
|
-
|
|
7098
|
-
|
|
7099
|
-
|
|
7100
|
-
LongPrototype.getHighBitsUnsigned = function getHighBitsUnsigned() {
|
|
7101
|
-
return this.high >>> 0;
|
|
7102
|
-
};
|
|
7103
|
-
LongPrototype.getLowBits = function getLowBits() {
|
|
7104
|
-
return this.low;
|
|
7105
|
-
};
|
|
7106
|
-
LongPrototype.getLowBitsUnsigned = function getLowBitsUnsigned() {
|
|
7107
|
-
return this.low >>> 0;
|
|
7108
|
-
};
|
|
7109
|
-
LongPrototype.getNumBitsAbs = function getNumBitsAbs() {
|
|
7110
|
-
if (this.isNegative())
|
|
7111
|
-
return this.eq(MIN_VALUE) ? 64 : this.neg().getNumBitsAbs();
|
|
7112
|
-
var val = this.high != 0 ? this.high : this.low;
|
|
7113
|
-
for (var bit = 31; bit > 0; bit--) if ((val & 1 << bit) != 0) break;
|
|
7114
|
-
return this.high != 0 ? bit + 33 : bit + 1;
|
|
7115
|
-
};
|
|
7116
|
-
LongPrototype.isSafeInteger = function isSafeInteger() {
|
|
7117
|
-
var top11Bits = this.high >> 21;
|
|
7118
|
-
if (!top11Bits) return true;
|
|
7119
|
-
if (this.unsigned) return false;
|
|
7120
|
-
return top11Bits === -1 && !(this.low === 0 && this.high === -2097152);
|
|
7121
|
-
};
|
|
7122
|
-
LongPrototype.isZero = function isZero() {
|
|
7123
|
-
return this.high === 0 && this.low === 0;
|
|
7124
|
-
};
|
|
7125
|
-
LongPrototype.eqz = LongPrototype.isZero;
|
|
7126
|
-
LongPrototype.isNegative = function isNegative() {
|
|
7127
|
-
return !this.unsigned && this.high < 0;
|
|
7128
|
-
};
|
|
7129
|
-
LongPrototype.isPositive = function isPositive() {
|
|
7130
|
-
return this.unsigned || this.high >= 0;
|
|
7131
|
-
};
|
|
7132
|
-
LongPrototype.isOdd = function isOdd() {
|
|
7133
|
-
return (this.low & 1) === 1;
|
|
7134
|
-
};
|
|
7135
|
-
LongPrototype.isEven = function isEven() {
|
|
7136
|
-
return (this.low & 1) === 0;
|
|
7137
|
-
};
|
|
7138
|
-
LongPrototype.equals = function equals(other) {
|
|
7139
|
-
if (!isLong$1(other)) other = fromValue(other);
|
|
7140
|
-
if (this.unsigned !== other.unsigned && this.high >>> 31 === 1 && other.high >>> 31 === 1)
|
|
7141
|
-
return false;
|
|
7142
|
-
return this.high === other.high && this.low === other.low;
|
|
7143
|
-
};
|
|
7144
|
-
LongPrototype.eq = LongPrototype.equals;
|
|
7145
|
-
LongPrototype.notEquals = function notEquals(other) {
|
|
7146
|
-
return !this.eq(
|
|
7147
|
-
/* validates */
|
|
7148
|
-
other
|
|
7149
|
-
);
|
|
7150
|
-
};
|
|
7151
|
-
LongPrototype.neq = LongPrototype.notEquals;
|
|
7152
|
-
LongPrototype.ne = LongPrototype.notEquals;
|
|
7153
|
-
LongPrototype.lessThan = function lessThan(other) {
|
|
7154
|
-
return this.comp(
|
|
7155
|
-
/* validates */
|
|
7156
|
-
other
|
|
7157
|
-
) < 0;
|
|
7158
|
-
};
|
|
7159
|
-
LongPrototype.lt = LongPrototype.lessThan;
|
|
7160
|
-
LongPrototype.lessThanOrEqual = function lessThanOrEqual(other) {
|
|
7161
|
-
return this.comp(
|
|
7162
|
-
/* validates */
|
|
7163
|
-
other
|
|
7164
|
-
) <= 0;
|
|
7165
|
-
};
|
|
7166
|
-
LongPrototype.lte = LongPrototype.lessThanOrEqual;
|
|
7167
|
-
LongPrototype.le = LongPrototype.lessThanOrEqual;
|
|
7168
|
-
LongPrototype.greaterThan = function greaterThan(other) {
|
|
7169
|
-
return this.comp(
|
|
7170
|
-
/* validates */
|
|
7171
|
-
other
|
|
7172
|
-
) > 0;
|
|
7173
|
-
};
|
|
7174
|
-
LongPrototype.gt = LongPrototype.greaterThan;
|
|
7175
|
-
LongPrototype.greaterThanOrEqual = function greaterThanOrEqual(other) {
|
|
7176
|
-
return this.comp(
|
|
7177
|
-
/* validates */
|
|
7178
|
-
other
|
|
7179
|
-
) >= 0;
|
|
7180
|
-
};
|
|
7181
|
-
LongPrototype.gte = LongPrototype.greaterThanOrEqual;
|
|
7182
|
-
LongPrototype.ge = LongPrototype.greaterThanOrEqual;
|
|
7183
|
-
LongPrototype.compare = function compare(other) {
|
|
7184
|
-
if (!isLong$1(other)) other = fromValue(other);
|
|
7185
|
-
if (this.eq(other)) return 0;
|
|
7186
|
-
var thisNeg = this.isNegative(), otherNeg = other.isNegative();
|
|
7187
|
-
if (thisNeg && !otherNeg) return -1;
|
|
7188
|
-
if (!thisNeg && otherNeg) return 1;
|
|
7189
|
-
if (!this.unsigned) return this.sub(other).isNegative() ? -1 : 1;
|
|
7190
|
-
return other.high >>> 0 > this.high >>> 0 || other.high === this.high && other.low >>> 0 > this.low >>> 0 ? -1 : 1;
|
|
7191
|
-
};
|
|
7192
|
-
LongPrototype.comp = LongPrototype.compare;
|
|
7193
|
-
LongPrototype.negate = function negate2() {
|
|
7194
|
-
if (!this.unsigned && this.eq(MIN_VALUE)) return MIN_VALUE;
|
|
7195
|
-
return this.not().add(ONE);
|
|
7196
|
-
};
|
|
7197
|
-
LongPrototype.neg = LongPrototype.negate;
|
|
7198
|
-
LongPrototype.add = function add(addend) {
|
|
7199
|
-
if (!isLong$1(addend)) addend = fromValue(addend);
|
|
7200
|
-
var a48 = this.high >>> 16;
|
|
7201
|
-
var a32 = this.high & 65535;
|
|
7202
|
-
var a16 = this.low >>> 16;
|
|
7203
|
-
var a00 = this.low & 65535;
|
|
7204
|
-
var b48 = addend.high >>> 16;
|
|
7205
|
-
var b32 = addend.high & 65535;
|
|
7206
|
-
var b16 = addend.low >>> 16;
|
|
7207
|
-
var b00 = addend.low & 65535;
|
|
7208
|
-
var c48 = 0, c32 = 0, c16 = 0, c00 = 0;
|
|
7209
|
-
c00 += a00 + b00;
|
|
7210
|
-
c16 += c00 >>> 16;
|
|
7211
|
-
c00 &= 65535;
|
|
7212
|
-
c16 += a16 + b16;
|
|
7213
|
-
c32 += c16 >>> 16;
|
|
7214
|
-
c16 &= 65535;
|
|
7215
|
-
c32 += a32 + b32;
|
|
7216
|
-
c48 += c32 >>> 16;
|
|
7217
|
-
c32 &= 65535;
|
|
7218
|
-
c48 += a48 + b48;
|
|
7219
|
-
c48 &= 65535;
|
|
7220
|
-
return fromBits(c16 << 16 | c00, c48 << 16 | c32, this.unsigned);
|
|
7221
|
-
};
|
|
7222
|
-
LongPrototype.subtract = function subtract(subtrahend) {
|
|
7223
|
-
if (!isLong$1(subtrahend)) subtrahend = fromValue(subtrahend);
|
|
7224
|
-
return this.add(subtrahend.neg());
|
|
7225
|
-
};
|
|
7226
|
-
LongPrototype.sub = LongPrototype.subtract;
|
|
7227
|
-
LongPrototype.multiply = function multiply(multiplier) {
|
|
7228
|
-
if (this.isZero()) return this;
|
|
7229
|
-
if (!isLong$1(multiplier)) multiplier = fromValue(multiplier);
|
|
7230
|
-
if (wasm) {
|
|
7231
|
-
var low = wasm["mul"](this.low, this.high, multiplier.low, multiplier.high);
|
|
7232
|
-
return fromBits(low, wasm["get_high"](), this.unsigned);
|
|
7233
|
-
}
|
|
7234
|
-
if (multiplier.isZero()) return this.unsigned ? UZERO : ZERO;
|
|
7235
|
-
if (this.eq(MIN_VALUE)) return multiplier.isOdd() ? MIN_VALUE : ZERO;
|
|
7236
|
-
if (multiplier.eq(MIN_VALUE)) return this.isOdd() ? MIN_VALUE : ZERO;
|
|
7237
|
-
if (this.isNegative()) {
|
|
7238
|
-
if (multiplier.isNegative()) return this.neg().mul(multiplier.neg());
|
|
7239
|
-
else return this.neg().mul(multiplier).neg();
|
|
7240
|
-
} else if (multiplier.isNegative()) return this.mul(multiplier.neg()).neg();
|
|
7241
|
-
if (this.lt(TWO_PWR_24) && multiplier.lt(TWO_PWR_24))
|
|
7242
|
-
return fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned);
|
|
7243
|
-
var a48 = this.high >>> 16;
|
|
7244
|
-
var a32 = this.high & 65535;
|
|
7245
|
-
var a16 = this.low >>> 16;
|
|
7246
|
-
var a00 = this.low & 65535;
|
|
7247
|
-
var b48 = multiplier.high >>> 16;
|
|
7248
|
-
var b32 = multiplier.high & 65535;
|
|
7249
|
-
var b16 = multiplier.low >>> 16;
|
|
7250
|
-
var b00 = multiplier.low & 65535;
|
|
7251
|
-
var c48 = 0, c32 = 0, c16 = 0, c00 = 0;
|
|
7252
|
-
c00 += a00 * b00;
|
|
7253
|
-
c16 += c00 >>> 16;
|
|
7254
|
-
c00 &= 65535;
|
|
7255
|
-
c16 += a16 * b00;
|
|
7256
|
-
c32 += c16 >>> 16;
|
|
7257
|
-
c16 &= 65535;
|
|
7258
|
-
c16 += a00 * b16;
|
|
7259
|
-
c32 += c16 >>> 16;
|
|
7260
|
-
c16 &= 65535;
|
|
7261
|
-
c32 += a32 * b00;
|
|
7262
|
-
c48 += c32 >>> 16;
|
|
7263
|
-
c32 &= 65535;
|
|
7264
|
-
c32 += a16 * b16;
|
|
7265
|
-
c48 += c32 >>> 16;
|
|
7266
|
-
c32 &= 65535;
|
|
7267
|
-
c32 += a00 * b32;
|
|
7268
|
-
c48 += c32 >>> 16;
|
|
7269
|
-
c32 &= 65535;
|
|
7270
|
-
c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;
|
|
7271
|
-
c48 &= 65535;
|
|
7272
|
-
return fromBits(c16 << 16 | c00, c48 << 16 | c32, this.unsigned);
|
|
7273
|
-
};
|
|
7274
|
-
LongPrototype.mul = LongPrototype.multiply;
|
|
7275
|
-
LongPrototype.divide = function divide(divisor) {
|
|
7276
|
-
if (!isLong$1(divisor)) divisor = fromValue(divisor);
|
|
7277
|
-
if (divisor.isZero()) throw Error("division by zero");
|
|
7278
|
-
if (wasm) {
|
|
7279
|
-
if (!this.unsigned && this.high === -2147483648 && divisor.low === -1 && divisor.high === -1) {
|
|
7280
|
-
return this;
|
|
7281
|
-
}
|
|
7282
|
-
var low = (this.unsigned ? wasm["div_u"] : wasm["div_s"])(
|
|
7283
|
-
this.low,
|
|
7284
|
-
this.high,
|
|
7285
|
-
divisor.low,
|
|
7286
|
-
divisor.high
|
|
7287
|
-
);
|
|
7288
|
-
return fromBits(low, wasm["get_high"](), this.unsigned);
|
|
7289
|
-
}
|
|
7290
|
-
if (this.isZero()) return this.unsigned ? UZERO : ZERO;
|
|
7291
|
-
var approx, rem, res;
|
|
7292
|
-
if (!this.unsigned) {
|
|
7293
|
-
if (this.eq(MIN_VALUE)) {
|
|
7294
|
-
if (divisor.eq(ONE) || divisor.eq(NEG_ONE))
|
|
7295
|
-
return MIN_VALUE;
|
|
7296
|
-
else if (divisor.eq(MIN_VALUE)) return ONE;
|
|
7297
|
-
else {
|
|
7298
|
-
var halfThis = this.shr(1);
|
|
7299
|
-
approx = halfThis.div(divisor).shl(1);
|
|
7300
|
-
if (approx.eq(ZERO)) {
|
|
7301
|
-
return divisor.isNegative() ? ONE : NEG_ONE;
|
|
7302
|
-
} else {
|
|
7303
|
-
rem = this.sub(divisor.mul(approx));
|
|
7304
|
-
res = approx.add(rem.div(divisor));
|
|
7305
|
-
return res;
|
|
7306
|
-
}
|
|
7307
|
-
}
|
|
7308
|
-
} else if (divisor.eq(MIN_VALUE)) return this.unsigned ? UZERO : ZERO;
|
|
7309
|
-
if (this.isNegative()) {
|
|
7310
|
-
if (divisor.isNegative()) return this.neg().div(divisor.neg());
|
|
7311
|
-
return this.neg().div(divisor).neg();
|
|
7312
|
-
} else if (divisor.isNegative()) return this.div(divisor.neg()).neg();
|
|
7313
|
-
res = ZERO;
|
|
7314
|
-
} else {
|
|
7315
|
-
if (!divisor.unsigned) divisor = divisor.toUnsigned();
|
|
7316
|
-
if (divisor.gt(this)) return UZERO;
|
|
7317
|
-
if (divisor.gt(this.shru(1)))
|
|
7318
|
-
return UONE;
|
|
7319
|
-
res = UZERO;
|
|
7320
|
-
}
|
|
7321
|
-
rem = this;
|
|
7322
|
-
while (rem.gte(divisor)) {
|
|
7323
|
-
approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber()));
|
|
7324
|
-
var log2 = Math.ceil(Math.log(approx) / Math.LN2), delta = log2 <= 48 ? 1 : pow_dbl(2, log2 - 48), approxRes = fromNumber(approx), approxRem = approxRes.mul(divisor);
|
|
7325
|
-
while (approxRem.isNegative() || approxRem.gt(rem)) {
|
|
7326
|
-
approx -= delta;
|
|
7327
|
-
approxRes = fromNumber(approx, this.unsigned);
|
|
7328
|
-
approxRem = approxRes.mul(divisor);
|
|
7329
|
-
}
|
|
7330
|
-
if (approxRes.isZero()) approxRes = ONE;
|
|
7331
|
-
res = res.add(approxRes);
|
|
7332
|
-
rem = rem.sub(approxRem);
|
|
7333
|
-
}
|
|
7334
|
-
return res;
|
|
7335
|
-
};
|
|
7336
|
-
LongPrototype.div = LongPrototype.divide;
|
|
7337
|
-
LongPrototype.modulo = function modulo(divisor) {
|
|
7338
|
-
if (!isLong$1(divisor)) divisor = fromValue(divisor);
|
|
7339
|
-
if (wasm) {
|
|
7340
|
-
var low = (this.unsigned ? wasm["rem_u"] : wasm["rem_s"])(
|
|
7341
|
-
this.low,
|
|
7342
|
-
this.high,
|
|
7343
|
-
divisor.low,
|
|
7344
|
-
divisor.high
|
|
7345
|
-
);
|
|
7346
|
-
return fromBits(low, wasm["get_high"](), this.unsigned);
|
|
7347
|
-
}
|
|
7348
|
-
return this.sub(this.div(divisor).mul(divisor));
|
|
7349
|
-
};
|
|
7350
|
-
LongPrototype.mod = LongPrototype.modulo;
|
|
7351
|
-
LongPrototype.rem = LongPrototype.modulo;
|
|
7352
|
-
LongPrototype.not = function not() {
|
|
7353
|
-
return fromBits(~this.low, ~this.high, this.unsigned);
|
|
7354
|
-
};
|
|
7355
|
-
LongPrototype.countLeadingZeros = function countLeadingZeros() {
|
|
7356
|
-
return this.high ? Math.clz32(this.high) : Math.clz32(this.low) + 32;
|
|
7357
|
-
};
|
|
7358
|
-
LongPrototype.clz = LongPrototype.countLeadingZeros;
|
|
7359
|
-
LongPrototype.countTrailingZeros = function countTrailingZeros() {
|
|
7360
|
-
return this.low ? ctz32(this.low) : ctz32(this.high) + 32;
|
|
7361
|
-
};
|
|
7362
|
-
LongPrototype.ctz = LongPrototype.countTrailingZeros;
|
|
7363
|
-
LongPrototype.and = function and(other) {
|
|
7364
|
-
if (!isLong$1(other)) other = fromValue(other);
|
|
7365
|
-
return fromBits(this.low & other.low, this.high & other.high, this.unsigned);
|
|
7366
|
-
};
|
|
7367
|
-
LongPrototype.or = function or(other) {
|
|
7368
|
-
if (!isLong$1(other)) other = fromValue(other);
|
|
7369
|
-
return fromBits(this.low | other.low, this.high | other.high, this.unsigned);
|
|
7370
|
-
};
|
|
7371
|
-
LongPrototype.xor = function xor(other) {
|
|
7372
|
-
if (!isLong$1(other)) other = fromValue(other);
|
|
7373
|
-
return fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned);
|
|
7374
|
-
};
|
|
7375
|
-
LongPrototype.shiftLeft = function shiftLeft(numBits) {
|
|
7376
|
-
if (isLong$1(numBits)) numBits = numBits.toInt();
|
|
7377
|
-
if ((numBits &= 63) === 0) return this;
|
|
7378
|
-
else if (numBits < 32)
|
|
7379
|
-
return fromBits(
|
|
7380
|
-
this.low << numBits,
|
|
7381
|
-
this.high << numBits | this.low >>> 32 - numBits,
|
|
7382
|
-
this.unsigned
|
|
7383
|
-
);
|
|
7384
|
-
else return fromBits(0, this.low << numBits - 32, this.unsigned);
|
|
7385
|
-
};
|
|
7386
|
-
LongPrototype.shl = LongPrototype.shiftLeft;
|
|
7387
|
-
LongPrototype.shiftRight = function shiftRight(numBits) {
|
|
7388
|
-
if (isLong$1(numBits)) numBits = numBits.toInt();
|
|
7389
|
-
if ((numBits &= 63) === 0) return this;
|
|
7390
|
-
else if (numBits < 32)
|
|
7391
|
-
return fromBits(
|
|
7392
|
-
this.low >>> numBits | this.high << 32 - numBits,
|
|
7393
|
-
this.high >> numBits,
|
|
7394
|
-
this.unsigned
|
|
7395
|
-
);
|
|
7396
|
-
else
|
|
7397
|
-
return fromBits(
|
|
7398
|
-
this.high >> numBits - 32,
|
|
7399
|
-
this.high >= 0 ? 0 : -1,
|
|
7400
|
-
this.unsigned
|
|
7401
|
-
);
|
|
7402
|
-
};
|
|
7403
|
-
LongPrototype.shr = LongPrototype.shiftRight;
|
|
7404
|
-
LongPrototype.shiftRightUnsigned = function shiftRightUnsigned(numBits) {
|
|
7405
|
-
if (isLong$1(numBits)) numBits = numBits.toInt();
|
|
7406
|
-
if ((numBits &= 63) === 0) return this;
|
|
7407
|
-
if (numBits < 32)
|
|
7408
|
-
return fromBits(
|
|
7409
|
-
this.low >>> numBits | this.high << 32 - numBits,
|
|
7410
|
-
this.high >>> numBits,
|
|
7411
|
-
this.unsigned
|
|
7412
|
-
);
|
|
7413
|
-
if (numBits === 32) return fromBits(this.high, 0, this.unsigned);
|
|
7414
|
-
return fromBits(this.high >>> numBits - 32, 0, this.unsigned);
|
|
7415
|
-
};
|
|
7416
|
-
LongPrototype.shru = LongPrototype.shiftRightUnsigned;
|
|
7417
|
-
LongPrototype.shr_u = LongPrototype.shiftRightUnsigned;
|
|
7418
|
-
LongPrototype.rotateLeft = function rotateLeft(numBits) {
|
|
7419
|
-
var b;
|
|
7420
|
-
if (isLong$1(numBits)) numBits = numBits.toInt();
|
|
7421
|
-
if ((numBits &= 63) === 0) return this;
|
|
7422
|
-
if (numBits === 32) return fromBits(this.high, this.low, this.unsigned);
|
|
7423
|
-
if (numBits < 32) {
|
|
7424
|
-
b = 32 - numBits;
|
|
7425
|
-
return fromBits(
|
|
7426
|
-
this.low << numBits | this.high >>> b,
|
|
7427
|
-
this.high << numBits | this.low >>> b,
|
|
7428
|
-
this.unsigned
|
|
7429
|
-
);
|
|
7430
|
-
}
|
|
7431
|
-
numBits -= 32;
|
|
7432
|
-
b = 32 - numBits;
|
|
7433
|
-
return fromBits(
|
|
7434
|
-
this.high << numBits | this.low >>> b,
|
|
7435
|
-
this.low << numBits | this.high >>> b,
|
|
7436
|
-
this.unsigned
|
|
7437
|
-
);
|
|
7438
|
-
};
|
|
7439
|
-
LongPrototype.rotl = LongPrototype.rotateLeft;
|
|
7440
|
-
LongPrototype.rotateRight = function rotateRight(numBits) {
|
|
7441
|
-
var b;
|
|
7442
|
-
if (isLong$1(numBits)) numBits = numBits.toInt();
|
|
7443
|
-
if ((numBits &= 63) === 0) return this;
|
|
7444
|
-
if (numBits === 32) return fromBits(this.high, this.low, this.unsigned);
|
|
7445
|
-
if (numBits < 32) {
|
|
7446
|
-
b = 32 - numBits;
|
|
7447
|
-
return fromBits(
|
|
7448
|
-
this.high << b | this.low >>> numBits,
|
|
7449
|
-
this.low << b | this.high >>> numBits,
|
|
7450
|
-
this.unsigned
|
|
7451
|
-
);
|
|
7452
|
-
}
|
|
7453
|
-
numBits -= 32;
|
|
7454
|
-
b = 32 - numBits;
|
|
7455
|
-
return fromBits(
|
|
7456
|
-
this.low << b | this.high >>> numBits,
|
|
7457
|
-
this.high << b | this.low >>> numBits,
|
|
7458
|
-
this.unsigned
|
|
7459
|
-
);
|
|
7460
|
-
};
|
|
7461
|
-
LongPrototype.rotr = LongPrototype.rotateRight;
|
|
7462
|
-
LongPrototype.toSigned = function toSigned() {
|
|
7463
|
-
if (!this.unsigned) return this;
|
|
7464
|
-
return fromBits(this.low, this.high, false);
|
|
7465
|
-
};
|
|
7466
|
-
LongPrototype.toUnsigned = function toUnsigned2() {
|
|
7467
|
-
if (this.unsigned) return this;
|
|
7468
|
-
return fromBits(this.low, this.high, true);
|
|
7469
|
-
};
|
|
7470
|
-
LongPrototype.toBytes = function toBytes(le) {
|
|
7471
|
-
return le ? this.toBytesLE() : this.toBytesBE();
|
|
7472
|
-
};
|
|
7473
|
-
LongPrototype.toBytesLE = function toBytesLE() {
|
|
7474
|
-
var hi = this.high, lo = this.low;
|
|
7475
|
-
return [
|
|
7476
|
-
lo & 255,
|
|
7477
|
-
lo >>> 8 & 255,
|
|
7478
|
-
lo >>> 16 & 255,
|
|
7479
|
-
lo >>> 24,
|
|
7480
|
-
hi & 255,
|
|
7481
|
-
hi >>> 8 & 255,
|
|
7482
|
-
hi >>> 16 & 255,
|
|
7483
|
-
hi >>> 24
|
|
7484
|
-
];
|
|
7485
|
-
};
|
|
7486
|
-
LongPrototype.toBytesBE = function toBytesBE() {
|
|
7487
|
-
var hi = this.high, lo = this.low;
|
|
7488
|
-
return [
|
|
7489
|
-
hi >>> 24,
|
|
7490
|
-
hi >>> 16 & 255,
|
|
7491
|
-
hi >>> 8 & 255,
|
|
7492
|
-
hi & 255,
|
|
7493
|
-
lo >>> 24,
|
|
7494
|
-
lo >>> 16 & 255,
|
|
7495
|
-
lo >>> 8 & 255,
|
|
7496
|
-
lo & 255
|
|
7497
|
-
];
|
|
7498
|
-
};
|
|
7499
|
-
Long.fromBytes = function fromBytes(bytes, unsigned, le) {
|
|
7500
|
-
return le ? Long.fromBytesLE(bytes, unsigned) : Long.fromBytesBE(bytes, unsigned);
|
|
7501
|
-
};
|
|
7502
|
-
Long.fromBytesLE = function fromBytesLE(bytes, unsigned) {
|
|
7503
|
-
return new Long(
|
|
7504
|
-
bytes[0] | bytes[1] << 8 | bytes[2] << 16 | bytes[3] << 24,
|
|
7505
|
-
bytes[4] | bytes[5] << 8 | bytes[6] << 16 | bytes[7] << 24,
|
|
7506
|
-
unsigned
|
|
7507
|
-
);
|
|
7508
|
-
};
|
|
7509
|
-
Long.fromBytesBE = function fromBytesBE(bytes, unsigned) {
|
|
7510
|
-
return new Long(
|
|
7511
|
-
bytes[4] << 24 | bytes[5] << 16 | bytes[6] << 8 | bytes[7],
|
|
7512
|
-
bytes[0] << 24 | bytes[1] << 16 | bytes[2] << 8 | bytes[3],
|
|
7513
|
-
unsigned
|
|
7514
|
-
);
|
|
7515
|
-
};
|
|
7516
|
-
if (typeof BigInt === "function") {
|
|
7517
|
-
Long.fromBigInt = function fromBigInt(value, unsigned) {
|
|
7518
|
-
var lowBits = Number(BigInt.asIntN(32, value));
|
|
7519
|
-
var highBits = Number(BigInt.asIntN(32, value >> BigInt(32)));
|
|
7520
|
-
return fromBits(lowBits, highBits, unsigned);
|
|
7521
|
-
};
|
|
7522
|
-
Long.fromValue = function fromValueWithBigInt(value, unsigned) {
|
|
7523
|
-
if (typeof value === "bigint") return Long.fromBigInt(value, unsigned);
|
|
7524
|
-
return fromValue(value, unsigned);
|
|
7525
|
-
};
|
|
7526
|
-
LongPrototype.toBigInt = function toBigInt() {
|
|
7527
|
-
var lowBigInt = BigInt(this.low >>> 0);
|
|
7528
|
-
var highBigInt = BigInt(this.unsigned ? this.high >>> 0 : this.high);
|
|
7529
|
-
return highBigInt << BigInt(32) | lowBigInt;
|
|
7530
|
-
};
|
|
7032
|
+
return v;
|
|
7033
|
+
}
|
|
7034
|
+
function bigintToInt32(value) {
|
|
7035
|
+
return Number(BigInt.asIntN(32, value));
|
|
7531
7036
|
}
|
|
7532
7037
|
var PrimitiveType = /* @__PURE__ */ ((PrimitiveType2) => {
|
|
7533
7038
|
PrimitiveType2[PrimitiveType2["Null"] = 0] = "Null";
|
|
@@ -7575,11 +7080,11 @@ class Primitive extends CRDTElement {
|
|
|
7575
7080
|
case 5:
|
|
7576
7081
|
return new TextDecoder("utf-8").decode(bytes);
|
|
7577
7082
|
case 3:
|
|
7578
|
-
return
|
|
7083
|
+
return bigintFromBytesLE(bytes);
|
|
7579
7084
|
case 6:
|
|
7580
7085
|
return bytes;
|
|
7581
7086
|
case 7:
|
|
7582
|
-
return new Date(
|
|
7087
|
+
return new Date(Number(bigintFromBytesLEUnsigned(bytes)));
|
|
7583
7088
|
default:
|
|
7584
7089
|
throw new YorkieError(
|
|
7585
7090
|
Code.ErrUnimplemented,
|
|
@@ -7632,6 +7137,13 @@ class Primitive extends CRDTElement {
|
|
|
7632
7137
|
if (this.valueType === 5) {
|
|
7633
7138
|
return `"${escapeString(this.value)}"`;
|
|
7634
7139
|
}
|
|
7140
|
+
if (this.valueType === 6) {
|
|
7141
|
+
const bytes = this.value;
|
|
7142
|
+
return `"${btoa(String.fromCharCode(...bytes))}"`;
|
|
7143
|
+
}
|
|
7144
|
+
if (this.valueType === 7) {
|
|
7145
|
+
return `"${this.value.toISOString()}"`;
|
|
7146
|
+
}
|
|
7635
7147
|
return `${this.value}`;
|
|
7636
7148
|
}
|
|
7637
7149
|
/**
|
|
@@ -7680,13 +7192,13 @@ class Primitive extends CRDTElement {
|
|
|
7680
7192
|
} else {
|
|
7681
7193
|
return 4;
|
|
7682
7194
|
}
|
|
7195
|
+
case "bigint":
|
|
7196
|
+
return 3;
|
|
7683
7197
|
case "string":
|
|
7684
7198
|
return 5;
|
|
7685
7199
|
case "object":
|
|
7686
7200
|
if (value === null) {
|
|
7687
7201
|
return 0;
|
|
7688
|
-
} else if (value instanceof Long) {
|
|
7689
|
-
return 3;
|
|
7690
7202
|
} else if (value instanceof Uint8Array) {
|
|
7691
7203
|
return 6;
|
|
7692
7204
|
} else if (value instanceof Date) {
|
|
@@ -7756,9 +7268,7 @@ class Primitive extends CRDTElement {
|
|
|
7756
7268
|
return new TextEncoder().encode(this.value);
|
|
7757
7269
|
}
|
|
7758
7270
|
case 3: {
|
|
7759
|
-
|
|
7760
|
-
const longToBytes = longVal.toBytesLE();
|
|
7761
|
-
return Uint8Array.from(longToBytes);
|
|
7271
|
+
return bigintToBytesLE(this.value);
|
|
7762
7272
|
}
|
|
7763
7273
|
case 6: {
|
|
7764
7274
|
const bytesVal = this.value;
|
|
@@ -7766,11 +7276,7 @@ class Primitive extends CRDTElement {
|
|
|
7766
7276
|
}
|
|
7767
7277
|
case 7: {
|
|
7768
7278
|
const dateVal = this.value;
|
|
7769
|
-
|
|
7770
|
-
dateVal.getTime(),
|
|
7771
|
-
true
|
|
7772
|
-
).toBytesLE();
|
|
7773
|
-
return Uint8Array.from(dateToBytes);
|
|
7279
|
+
return bigintToBytesLE(BigInt(dateVal.getTime()));
|
|
7774
7280
|
}
|
|
7775
7281
|
default:
|
|
7776
7282
|
throw new YorkieError(
|
|
@@ -7780,19 +7286,54 @@ class Primitive extends CRDTElement {
|
|
|
7780
7286
|
}
|
|
7781
7287
|
}
|
|
7782
7288
|
}
|
|
7289
|
+
class ElementEntry {
|
|
7290
|
+
elem;
|
|
7291
|
+
positionNode;
|
|
7292
|
+
posMovedAt;
|
|
7293
|
+
constructor(elem) {
|
|
7294
|
+
this.elem = elem;
|
|
7295
|
+
}
|
|
7296
|
+
}
|
|
7783
7297
|
class RGATreeListNode extends SplayNode {
|
|
7298
|
+
_elementEntry;
|
|
7299
|
+
_createdAt;
|
|
7300
|
+
_removedAt;
|
|
7784
7301
|
prev;
|
|
7785
7302
|
next;
|
|
7786
|
-
|
|
7787
|
-
|
|
7788
|
-
|
|
7789
|
-
|
|
7303
|
+
constructor(elem, createdAt) {
|
|
7304
|
+
super(elem);
|
|
7305
|
+
this._createdAt = createdAt;
|
|
7306
|
+
}
|
|
7307
|
+
/**
|
|
7308
|
+
* `createWithElement` creates a new node that owns an element.
|
|
7309
|
+
*/
|
|
7310
|
+
static createWithElement(elem) {
|
|
7311
|
+
const entry = new ElementEntry(elem);
|
|
7312
|
+
const node = new RGATreeListNode(elem, elem.getCreatedAt());
|
|
7313
|
+
entry.positionNode = node;
|
|
7314
|
+
node._elementEntry = entry;
|
|
7315
|
+
return node;
|
|
7316
|
+
}
|
|
7317
|
+
/**
|
|
7318
|
+
* `createBarePosition` creates a position node without an element
|
|
7319
|
+
* (used for move).
|
|
7320
|
+
*/
|
|
7321
|
+
static createBarePosition(createdAt) {
|
|
7322
|
+
return new RGATreeListNode(void 0, createdAt);
|
|
7790
7323
|
}
|
|
7791
7324
|
/**
|
|
7792
|
-
* `createAfter` creates a new node
|
|
7325
|
+
* `createAfter` creates a new node with the given element after
|
|
7326
|
+
* the given prev node.
|
|
7793
7327
|
*/
|
|
7794
|
-
static createAfter(prev,
|
|
7795
|
-
const newNode =
|
|
7328
|
+
static createAfter(prev, elem) {
|
|
7329
|
+
const newNode = RGATreeListNode.createWithElement(elem);
|
|
7330
|
+
RGATreeListNode.insertNodeAfter(prev, newNode);
|
|
7331
|
+
return newNode;
|
|
7332
|
+
}
|
|
7333
|
+
/**
|
|
7334
|
+
* `insertNodeAfter` inserts a node after the given prev node.
|
|
7335
|
+
*/
|
|
7336
|
+
static insertNodeAfter(prev, newNode) {
|
|
7796
7337
|
const prevNext = prev.next;
|
|
7797
7338
|
prev.next = newNode;
|
|
7798
7339
|
newNode.prev = prev;
|
|
@@ -7800,26 +7341,41 @@ class RGATreeListNode extends SplayNode {
|
|
|
7800
7341
|
if (prevNext) {
|
|
7801
7342
|
prevNext.prev = newNode;
|
|
7802
7343
|
}
|
|
7803
|
-
return newNode;
|
|
7804
7344
|
}
|
|
7805
7345
|
/**
|
|
7806
|
-
* `remove` removes
|
|
7346
|
+
* `remove` removes the element based on removing time.
|
|
7807
7347
|
*/
|
|
7808
7348
|
remove(removedAt) {
|
|
7809
|
-
|
|
7349
|
+
if (!this._elementEntry) {
|
|
7350
|
+
return false;
|
|
7351
|
+
}
|
|
7352
|
+
return this._elementEntry.elem.remove(removedAt);
|
|
7810
7353
|
}
|
|
7811
7354
|
/**
|
|
7812
|
-
* `getCreatedAt` returns creation time
|
|
7355
|
+
* `getCreatedAt` returns the creation time. For live nodes with
|
|
7356
|
+
* elements, returns the element's createdAt for backward
|
|
7357
|
+
* compatibility.
|
|
7813
7358
|
*/
|
|
7814
7359
|
getCreatedAt() {
|
|
7815
|
-
|
|
7360
|
+
if (this._elementEntry) {
|
|
7361
|
+
return this._elementEntry.elem.getCreatedAt();
|
|
7362
|
+
}
|
|
7363
|
+
return this._createdAt;
|
|
7816
7364
|
}
|
|
7817
7365
|
/**
|
|
7818
|
-
* `getPositionedAt` returns the time
|
|
7819
|
-
*
|
|
7366
|
+
* `getPositionedAt` returns the time this element was positioned.
|
|
7367
|
+
* For live nodes, the position register (posMovedAt) is the source
|
|
7368
|
+
* of truth. For dead nodes (no element), the position node's own
|
|
7369
|
+
* createdAt is used.
|
|
7820
7370
|
*/
|
|
7821
7371
|
getPositionedAt() {
|
|
7822
|
-
|
|
7372
|
+
if (this._elementEntry) {
|
|
7373
|
+
if (this._elementEntry.posMovedAt) {
|
|
7374
|
+
return this._elementEntry.posMovedAt;
|
|
7375
|
+
}
|
|
7376
|
+
return this._elementEntry.elem.getCreatedAt();
|
|
7377
|
+
}
|
|
7378
|
+
return this._createdAt;
|
|
7823
7379
|
}
|
|
7824
7380
|
/**
|
|
7825
7381
|
* `release` releases prev and next node.
|
|
@@ -7836,9 +7392,13 @@ class RGATreeListNode extends SplayNode {
|
|
|
7836
7392
|
}
|
|
7837
7393
|
/**
|
|
7838
7394
|
* `getLength` returns the length of this node.
|
|
7395
|
+
* Dead nodes (no element) return 0, removed elements return 0.
|
|
7839
7396
|
*/
|
|
7840
7397
|
getLength() {
|
|
7841
|
-
|
|
7398
|
+
if (!this._elementEntry || this.isRemoved()) {
|
|
7399
|
+
return 0;
|
|
7400
|
+
}
|
|
7401
|
+
return 1;
|
|
7842
7402
|
}
|
|
7843
7403
|
/**
|
|
7844
7404
|
* `getPrev` returns a previous node.
|
|
@@ -7853,28 +7413,87 @@ class RGATreeListNode extends SplayNode {
|
|
|
7853
7413
|
return this.next;
|
|
7854
7414
|
}
|
|
7855
7415
|
/**
|
|
7856
|
-
* `
|
|
7416
|
+
* `getValue` returns the element value.
|
|
7857
7417
|
*/
|
|
7858
|
-
|
|
7859
|
-
|
|
7418
|
+
getValue() {
|
|
7419
|
+
if (!this._elementEntry) {
|
|
7420
|
+
return this.value;
|
|
7421
|
+
}
|
|
7422
|
+
return this._elementEntry.elem;
|
|
7860
7423
|
}
|
|
7861
7424
|
/**
|
|
7862
|
-
* `
|
|
7425
|
+
* `getElement` returns the element or undefined if dead position.
|
|
7863
7426
|
*/
|
|
7864
|
-
|
|
7865
|
-
this.
|
|
7427
|
+
getElement() {
|
|
7428
|
+
return this._elementEntry?.elem;
|
|
7866
7429
|
}
|
|
7867
7430
|
/**
|
|
7868
|
-
* `
|
|
7431
|
+
* `isRemoved` checks if the value was removed.
|
|
7869
7432
|
*/
|
|
7870
|
-
|
|
7871
|
-
|
|
7433
|
+
isRemoved() {
|
|
7434
|
+
if (!this._elementEntry) {
|
|
7435
|
+
return true;
|
|
7436
|
+
}
|
|
7437
|
+
return this._elementEntry.elem.isRemoved();
|
|
7872
7438
|
}
|
|
7873
7439
|
/**
|
|
7874
|
-
* `
|
|
7440
|
+
* `getElementEntry` returns the element entry.
|
|
7875
7441
|
*/
|
|
7876
|
-
|
|
7877
|
-
return this.
|
|
7442
|
+
getElementEntry() {
|
|
7443
|
+
return this._elementEntry;
|
|
7444
|
+
}
|
|
7445
|
+
/**
|
|
7446
|
+
* `setElementEntry` sets the element entry.
|
|
7447
|
+
*/
|
|
7448
|
+
setElementEntry(entry) {
|
|
7449
|
+
this._elementEntry = entry;
|
|
7450
|
+
}
|
|
7451
|
+
/**
|
|
7452
|
+
* `getPositionCreatedAt` returns the position node's own createdAt.
|
|
7453
|
+
*/
|
|
7454
|
+
getPositionCreatedAt() {
|
|
7455
|
+
return this._createdAt;
|
|
7456
|
+
}
|
|
7457
|
+
/**
|
|
7458
|
+
* `getPositionMovedAt` returns the LWW timestamp of the element's
|
|
7459
|
+
* move into this position. Undefined for insert-created positions.
|
|
7460
|
+
*/
|
|
7461
|
+
getPositionMovedAt() {
|
|
7462
|
+
if (!this._elementEntry) {
|
|
7463
|
+
return void 0;
|
|
7464
|
+
}
|
|
7465
|
+
return this._elementEntry.posMovedAt;
|
|
7466
|
+
}
|
|
7467
|
+
/**
|
|
7468
|
+
* `getRemovedAt` returns the time this dead position node was
|
|
7469
|
+
* removed (for GC).
|
|
7470
|
+
*/
|
|
7471
|
+
getRemovedAt() {
|
|
7472
|
+
return this._removedAt;
|
|
7473
|
+
}
|
|
7474
|
+
/**
|
|
7475
|
+
* `setRemovedAt` sets the removal time of this position node.
|
|
7476
|
+
*/
|
|
7477
|
+
setRemovedAt(removedAt) {
|
|
7478
|
+
this._removedAt = removedAt;
|
|
7479
|
+
}
|
|
7480
|
+
/**
|
|
7481
|
+
* `toIDString` returns a unique identifier for this position node
|
|
7482
|
+
* (for GC).
|
|
7483
|
+
*/
|
|
7484
|
+
toIDString() {
|
|
7485
|
+
return this._createdAt.toIDString();
|
|
7486
|
+
}
|
|
7487
|
+
/**
|
|
7488
|
+
* `getDataSize` returns the data size of this position node
|
|
7489
|
+
* (for GC).
|
|
7490
|
+
*/
|
|
7491
|
+
getDataSize() {
|
|
7492
|
+
let meta = TimeTicketSize;
|
|
7493
|
+
if (this._removedAt) {
|
|
7494
|
+
meta += TimeTicketSize;
|
|
7495
|
+
}
|
|
7496
|
+
return { data: 0, meta };
|
|
7878
7497
|
}
|
|
7879
7498
|
}
|
|
7880
7499
|
class RGATreeList {
|
|
@@ -7882,13 +7501,15 @@ class RGATreeList {
|
|
|
7882
7501
|
last;
|
|
7883
7502
|
nodeMapByIndex;
|
|
7884
7503
|
nodeMapByCreatedAt;
|
|
7504
|
+
elementMapByCreatedAt;
|
|
7885
7505
|
constructor() {
|
|
7886
7506
|
const dummyValue = Primitive.of(0, InitialTimeTicket);
|
|
7887
7507
|
dummyValue.setRemovedAt(InitialTimeTicket);
|
|
7888
|
-
this.dummyHead =
|
|
7508
|
+
this.dummyHead = RGATreeListNode.createWithElement(dummyValue);
|
|
7889
7509
|
this.last = this.dummyHead;
|
|
7890
7510
|
this.nodeMapByIndex = new SplayTree();
|
|
7891
7511
|
this.nodeMapByCreatedAt = /* @__PURE__ */ new Map();
|
|
7512
|
+
this.elementMapByCreatedAt = /* @__PURE__ */ new Map();
|
|
7892
7513
|
this.nodeMapByIndex.insert(this.dummyHead);
|
|
7893
7514
|
this.nodeMapByCreatedAt.set(
|
|
7894
7515
|
this.dummyHead.getCreatedAt().toIDString(),
|
|
@@ -7908,22 +7529,10 @@ class RGATreeList {
|
|
|
7908
7529
|
return this.nodeMapByIndex.length;
|
|
7909
7530
|
}
|
|
7910
7531
|
/**
|
|
7911
|
-
* `findNextBeforeExecutedAt`
|
|
7912
|
-
*
|
|
7913
|
-
* given node and returns the next node.
|
|
7914
|
-
* @returns the next node of the given createdAt and executedAt
|
|
7532
|
+
* `findNextBeforeExecutedAt` walks forward from the given node,
|
|
7533
|
+
* skipping nodes positioned after executedAt (RGA insertion rule).
|
|
7915
7534
|
*/
|
|
7916
|
-
findNextBeforeExecutedAt(
|
|
7917
|
-
let node = this.nodeMapByCreatedAt.get(createdAt.toIDString());
|
|
7918
|
-
if (!node) {
|
|
7919
|
-
throw new YorkieError(
|
|
7920
|
-
Code.ErrInvalidArgument,
|
|
7921
|
-
`cant find the given node: ${createdAt.toIDString()}`
|
|
7922
|
-
);
|
|
7923
|
-
}
|
|
7924
|
-
while (node.getValue().getMovedAt() && node.getValue().getMovedAt().after(executedAt) && node.getMovedFrom()) {
|
|
7925
|
-
node = node.getMovedFrom();
|
|
7926
|
-
}
|
|
7535
|
+
findNextBeforeExecutedAt(node, executedAt) {
|
|
7927
7536
|
while (node.getNext() && node.getNext().getPositionedAt().after(executedAt)) {
|
|
7928
7537
|
node = node.getNext();
|
|
7929
7538
|
}
|
|
@@ -7935,65 +7544,103 @@ class RGATreeList {
|
|
|
7935
7544
|
}
|
|
7936
7545
|
node.release();
|
|
7937
7546
|
this.nodeMapByIndex.delete(node);
|
|
7938
|
-
this.nodeMapByCreatedAt.delete(node.
|
|
7547
|
+
this.nodeMapByCreatedAt.delete(node.getPositionCreatedAt().toIDString());
|
|
7939
7548
|
}
|
|
7940
7549
|
/**
|
|
7941
|
-
* `insertAfter` adds a new node with the value after the given
|
|
7550
|
+
* `insertAfter` adds a new node with the value after the given
|
|
7551
|
+
* position. prevCreatedAt is a position node identity. Looks up
|
|
7552
|
+
* nodeMapByCreatedAt first, then elementMapByCreatedAt for backward
|
|
7553
|
+
* compatibility.
|
|
7942
7554
|
*/
|
|
7943
7555
|
insertAfter(prevCreatedAt, value, executedAt = value.getCreatedAt()) {
|
|
7944
|
-
|
|
7556
|
+
let startNode = this.nodeMapByCreatedAt.get(prevCreatedAt.toIDString());
|
|
7557
|
+
if (!startNode) {
|
|
7558
|
+
const entry = this.elementMapByCreatedAt.get(prevCreatedAt.toIDString());
|
|
7559
|
+
if (entry) {
|
|
7560
|
+
startNode = entry.positionNode;
|
|
7561
|
+
}
|
|
7562
|
+
}
|
|
7563
|
+
if (!startNode) {
|
|
7564
|
+
throw new YorkieError(
|
|
7565
|
+
Code.ErrInvalidArgument,
|
|
7566
|
+
`cant find the given node: ${prevCreatedAt.toIDString()}`
|
|
7567
|
+
);
|
|
7568
|
+
}
|
|
7569
|
+
const prevNode = this.findNextBeforeExecutedAt(startNode, executedAt);
|
|
7945
7570
|
const newNode = RGATreeListNode.createAfter(prevNode, value);
|
|
7946
7571
|
if (prevNode === this.last) {
|
|
7947
7572
|
this.last = newNode;
|
|
7948
7573
|
}
|
|
7949
7574
|
this.nodeMapByIndex.insertAfter(prevNode, newNode);
|
|
7950
|
-
this.nodeMapByCreatedAt.set(
|
|
7575
|
+
this.nodeMapByCreatedAt.set(value.getCreatedAt().toIDString(), newNode);
|
|
7576
|
+
this.elementMapByCreatedAt.set(
|
|
7577
|
+
value.getCreatedAt().toIDString(),
|
|
7578
|
+
newNode.getElementEntry()
|
|
7579
|
+
);
|
|
7580
|
+
return newNode;
|
|
7581
|
+
}
|
|
7582
|
+
/**
|
|
7583
|
+
* `insertPositionAfter` creates a bare position node after
|
|
7584
|
+
* resolving position via forward skip (RGA insertion rule).
|
|
7585
|
+
* Used by moveAfter. prevCreatedAt is a POSITION node identity.
|
|
7586
|
+
*/
|
|
7587
|
+
insertPositionAfter(prevCreatedAt, executedAt) {
|
|
7588
|
+
const startNode = this.nodeMapByCreatedAt.get(prevCreatedAt.toIDString());
|
|
7589
|
+
if (!startNode) {
|
|
7590
|
+
throw new YorkieError(
|
|
7591
|
+
Code.ErrInvalidArgument,
|
|
7592
|
+
`cant find the given node: ${prevCreatedAt.toIDString()}`
|
|
7593
|
+
);
|
|
7594
|
+
}
|
|
7595
|
+
const prevNode = this.findNextBeforeExecutedAt(startNode, executedAt);
|
|
7596
|
+
const newNode = RGATreeListNode.createBarePosition(executedAt);
|
|
7597
|
+
RGATreeListNode.insertNodeAfter(prevNode, newNode);
|
|
7598
|
+
if (prevNode === this.last) {
|
|
7599
|
+
this.last = newNode;
|
|
7600
|
+
}
|
|
7601
|
+
this.nodeMapByIndex.insertAfter(prevNode, newNode);
|
|
7602
|
+
this.nodeMapByCreatedAt.set(executedAt.toIDString(), newNode);
|
|
7951
7603
|
return newNode;
|
|
7952
7604
|
}
|
|
7953
7605
|
/**
|
|
7954
|
-
* `moveAfter` moves the given `createdAt` element
|
|
7955
|
-
*
|
|
7606
|
+
* `moveAfter` moves the given `createdAt` element after the
|
|
7607
|
+
* `prevCreatedAt` element using LWW position register semantics.
|
|
7608
|
+
* Returns the dead position node (if any) for GC registration.
|
|
7956
7609
|
*/
|
|
7957
7610
|
moveAfter(prevCreatedAt, createdAt, executedAt) {
|
|
7958
|
-
|
|
7959
|
-
if (!prevNode) {
|
|
7611
|
+
if (!this.nodeMapByCreatedAt.has(prevCreatedAt.toIDString())) {
|
|
7960
7612
|
throw new YorkieError(
|
|
7961
7613
|
Code.ErrInvalidArgument,
|
|
7962
7614
|
`cant find the given node: ${prevCreatedAt.toIDString()}`
|
|
7963
7615
|
);
|
|
7964
7616
|
}
|
|
7965
|
-
|
|
7966
|
-
if (!
|
|
7617
|
+
const entry = this.elementMapByCreatedAt.get(createdAt.toIDString());
|
|
7618
|
+
if (!entry) {
|
|
7967
7619
|
throw new YorkieError(
|
|
7968
7620
|
Code.ErrInvalidArgument,
|
|
7969
7621
|
`cant find the given node: ${createdAt.toIDString()}`
|
|
7970
7622
|
);
|
|
7971
7623
|
}
|
|
7972
|
-
if (
|
|
7973
|
-
|
|
7974
|
-
|
|
7975
|
-
this.release(node);
|
|
7976
|
-
node = this.insertAfter(
|
|
7977
|
-
prevNode.getCreatedAt(),
|
|
7978
|
-
node.getValue(),
|
|
7979
|
-
executedAt
|
|
7980
|
-
);
|
|
7981
|
-
node.getValue().setMovedAt(executedAt);
|
|
7982
|
-
node.setMovedFrom(movedFrom);
|
|
7983
|
-
while (nextNode && nextNode.getPositionedAt().after(executedAt)) {
|
|
7984
|
-
prevNode = node;
|
|
7985
|
-
node = nextNode;
|
|
7986
|
-
nextNode = node.getNext();
|
|
7987
|
-
this.release(node);
|
|
7988
|
-
node = this.insertAfter(
|
|
7989
|
-
prevNode.getCreatedAt(),
|
|
7990
|
-
node.getValue(),
|
|
7991
|
-
executedAt
|
|
7992
|
-
);
|
|
7993
|
-
node.getValue().setMovedAt(executedAt);
|
|
7994
|
-
node.setMovedFrom(movedFrom);
|
|
7624
|
+
if (entry.posMovedAt && !executedAt.after(entry.posMovedAt)) {
|
|
7625
|
+
if (this.nodeMapByCreatedAt.has(executedAt.toIDString())) {
|
|
7626
|
+
return void 0;
|
|
7995
7627
|
}
|
|
7628
|
+
const deadPosNode = this.insertPositionAfter(prevCreatedAt, executedAt);
|
|
7629
|
+
deadPosNode.setRemovedAt(executedAt);
|
|
7630
|
+
this.nodeMapByIndex.splayNode(deadPosNode);
|
|
7631
|
+
return deadPosNode;
|
|
7996
7632
|
}
|
|
7633
|
+
const newPosNode = this.insertPositionAfter(prevCreatedAt, executedAt);
|
|
7634
|
+
const oldPosNode = entry.positionNode;
|
|
7635
|
+
oldPosNode.setElementEntry(void 0);
|
|
7636
|
+
oldPosNode.setRemovedAt(executedAt);
|
|
7637
|
+
this.nodeMapByIndex.splayNode(oldPosNode);
|
|
7638
|
+
newPosNode.setElementEntry(entry);
|
|
7639
|
+
entry.positionNode = newPosNode;
|
|
7640
|
+
entry.posMovedAt = executedAt;
|
|
7641
|
+
entry.elem.setMovedAt(executedAt);
|
|
7642
|
+
this.nodeMapByIndex.splayNode(newPosNode);
|
|
7643
|
+
return oldPosNode;
|
|
7997
7644
|
}
|
|
7998
7645
|
/**
|
|
7999
7646
|
* `insert` adds the given element after the last node.
|
|
@@ -8002,34 +7649,53 @@ class RGATreeList {
|
|
|
8002
7649
|
this.insertAfter(this.last.getCreatedAt(), value);
|
|
8003
7650
|
}
|
|
8004
7651
|
/**
|
|
8005
|
-
* `getByID` returns the
|
|
7652
|
+
* `getByID` returns the node of the given creation time.
|
|
7653
|
+
* Checks elementMapByCreatedAt first (for moved elements whose
|
|
7654
|
+
* position node createdAt differs), then nodeMapByCreatedAt.
|
|
8006
7655
|
*/
|
|
8007
7656
|
getByID(createdAt) {
|
|
7657
|
+
const entry = this.elementMapByCreatedAt.get(createdAt.toIDString());
|
|
7658
|
+
if (entry) {
|
|
7659
|
+
return entry.positionNode;
|
|
7660
|
+
}
|
|
8008
7661
|
return this.nodeMapByCreatedAt.get(createdAt.toIDString());
|
|
8009
7662
|
}
|
|
8010
7663
|
/**
|
|
8011
7664
|
* `subPathOf` returns the sub path of the given element.
|
|
8012
7665
|
*/
|
|
8013
7666
|
subPathOf(createdAt) {
|
|
8014
|
-
const
|
|
8015
|
-
if (!
|
|
8016
|
-
|
|
7667
|
+
const entry = this.elementMapByCreatedAt.get(createdAt.toIDString());
|
|
7668
|
+
if (!entry) {
|
|
7669
|
+
const node = this.nodeMapByCreatedAt.get(createdAt.toIDString());
|
|
7670
|
+
if (!node) {
|
|
7671
|
+
return;
|
|
7672
|
+
}
|
|
7673
|
+
return String(this.nodeMapByIndex.indexOf(node));
|
|
8017
7674
|
}
|
|
8018
|
-
return String(this.nodeMapByIndex.indexOf(
|
|
7675
|
+
return String(this.nodeMapByIndex.indexOf(entry.positionNode));
|
|
8019
7676
|
}
|
|
8020
7677
|
/**
|
|
8021
|
-
* `purge` physically purges
|
|
7678
|
+
* `purge` physically purges the given child. Handles both dead
|
|
7679
|
+
* position nodes (GCChild from GCParent path) and CRDTElements
|
|
7680
|
+
* (from CRDTContainer path).
|
|
8022
7681
|
*/
|
|
8023
|
-
purge(
|
|
8024
|
-
|
|
7682
|
+
purge(child) {
|
|
7683
|
+
if (child instanceof RGATreeListNode) {
|
|
7684
|
+
this.release(child);
|
|
7685
|
+
return;
|
|
7686
|
+
}
|
|
7687
|
+
const element = child;
|
|
7688
|
+
const entry = this.elementMapByCreatedAt.get(
|
|
8025
7689
|
element.getCreatedAt().toIDString()
|
|
8026
7690
|
);
|
|
8027
|
-
if (!
|
|
7691
|
+
if (!entry) {
|
|
8028
7692
|
throw new YorkieError(
|
|
8029
7693
|
Code.ErrInvalidArgument,
|
|
8030
7694
|
`fail to find the given createdAt: ${element.getCreatedAt().toIDString()}`
|
|
8031
7695
|
);
|
|
8032
7696
|
}
|
|
7697
|
+
const node = entry.positionNode;
|
|
7698
|
+
this.elementMapByCreatedAt.delete(element.getCreatedAt().toIDString());
|
|
8033
7699
|
this.release(node);
|
|
8034
7700
|
}
|
|
8035
7701
|
/**
|
|
@@ -8040,42 +7706,69 @@ class RGATreeList {
|
|
|
8040
7706
|
return;
|
|
8041
7707
|
}
|
|
8042
7708
|
const node = this.nodeMapByIndex.findForArray(idx);
|
|
8043
|
-
|
|
8044
|
-
return rgaNode;
|
|
7709
|
+
return node;
|
|
8045
7710
|
}
|
|
8046
7711
|
/**
|
|
8047
|
-
* `
|
|
7712
|
+
* `findPrevCreatedAt` returns the position node's createdAt of the
|
|
7713
|
+
* previous element. This returns a position identity suitable for
|
|
7714
|
+
* use as prevCreatedAt in moveAfter.
|
|
8048
7715
|
*/
|
|
8049
|
-
|
|
8050
|
-
|
|
7716
|
+
findPrevCreatedAt(createdAt) {
|
|
7717
|
+
const entry = this.elementMapByCreatedAt.get(createdAt.toIDString());
|
|
7718
|
+
if (!entry) {
|
|
7719
|
+
throw new YorkieError(
|
|
7720
|
+
Code.ErrInvalidArgument,
|
|
7721
|
+
`cant find the given node: ${createdAt.toIDString()}`
|
|
7722
|
+
);
|
|
7723
|
+
}
|
|
7724
|
+
let node = entry.positionNode;
|
|
8051
7725
|
do {
|
|
8052
7726
|
node = node.getPrev();
|
|
8053
|
-
|
|
8054
|
-
|
|
7727
|
+
if (!node.getElementEntry()) {
|
|
7728
|
+
continue;
|
|
7729
|
+
}
|
|
7730
|
+
if (this.dummyHead === node || !node.isRemoved()) {
|
|
7731
|
+
break;
|
|
7732
|
+
}
|
|
7733
|
+
} while (node);
|
|
7734
|
+
return node.getPositionCreatedAt();
|
|
7735
|
+
}
|
|
7736
|
+
/**
|
|
7737
|
+
* `getPrevCreatedAt` returns the position node's createdAt of the
|
|
7738
|
+
* previous element. Delegates to findPrevCreatedAt.
|
|
7739
|
+
*/
|
|
7740
|
+
getPrevCreatedAt(createdAt) {
|
|
7741
|
+
return this.findPrevCreatedAt(createdAt);
|
|
8055
7742
|
}
|
|
8056
7743
|
/**
|
|
8057
7744
|
* `delete` deletes the node of the given creation time.
|
|
8058
7745
|
*/
|
|
8059
7746
|
delete(createdAt, editedAt) {
|
|
8060
|
-
const
|
|
7747
|
+
const entry = this.elementMapByCreatedAt.get(createdAt.toIDString());
|
|
7748
|
+
if (!entry) {
|
|
7749
|
+
throw new YorkieError(
|
|
7750
|
+
Code.ErrInvalidArgument,
|
|
7751
|
+
`cant find the given node: ${createdAt.toIDString()}`
|
|
7752
|
+
);
|
|
7753
|
+
}
|
|
7754
|
+
const node = entry.positionNode;
|
|
8061
7755
|
const alreadyRemoved = node.isRemoved();
|
|
8062
|
-
if (
|
|
7756
|
+
if (entry.elem.remove(editedAt) && !alreadyRemoved) {
|
|
8063
7757
|
this.nodeMapByIndex.splayNode(node);
|
|
8064
7758
|
}
|
|
8065
|
-
return
|
|
7759
|
+
return entry.elem;
|
|
8066
7760
|
}
|
|
8067
7761
|
/**
|
|
8068
7762
|
* `set` sets the given element at the given creation time.
|
|
8069
7763
|
*/
|
|
8070
7764
|
set(createdAt, element, executedAt) {
|
|
8071
|
-
|
|
8072
|
-
if (!node) {
|
|
7765
|
+
if (!this.elementMapByCreatedAt.has(createdAt.toIDString())) {
|
|
8073
7766
|
throw new YorkieError(
|
|
8074
7767
|
Code.ErrInvalidArgument,
|
|
8075
7768
|
`cant find the given node: ${createdAt.toIDString()}`
|
|
8076
7769
|
);
|
|
8077
7770
|
}
|
|
8078
|
-
this.insertAfter(
|
|
7771
|
+
this.insertAfter(createdAt, element, executedAt);
|
|
8079
7772
|
return this.delete(createdAt, executedAt);
|
|
8080
7773
|
}
|
|
8081
7774
|
/**
|
|
@@ -8104,18 +7797,80 @@ class RGATreeList {
|
|
|
8104
7797
|
return this.last.getValue();
|
|
8105
7798
|
}
|
|
8106
7799
|
/**
|
|
8107
|
-
* `getLastCreatedAt` returns the
|
|
7800
|
+
* `getLastCreatedAt` returns the position node's createdAt of the
|
|
7801
|
+
* last node in the linked list. This is a position identity
|
|
7802
|
+
* suitable for use as prevCreatedAt.
|
|
8108
7803
|
*/
|
|
8109
7804
|
getLastCreatedAt() {
|
|
8110
|
-
return this.last.
|
|
7805
|
+
return this.last.getPositionCreatedAt();
|
|
8111
7806
|
}
|
|
8112
7807
|
/**
|
|
8113
|
-
* `
|
|
8114
|
-
*
|
|
7808
|
+
* `posCreatedAt` returns the createdAt of the position node
|
|
7809
|
+
* currently holding the element. Used to convert element identity
|
|
7810
|
+
* to position identity.
|
|
7811
|
+
*/
|
|
7812
|
+
posCreatedAt(elemCreatedAt) {
|
|
7813
|
+
const entry = this.elementMapByCreatedAt.get(elemCreatedAt.toIDString());
|
|
7814
|
+
if (!entry) {
|
|
7815
|
+
throw new YorkieError(
|
|
7816
|
+
Code.ErrInvalidArgument,
|
|
7817
|
+
`cant find the given node: ${elemCreatedAt.toIDString()}`
|
|
7818
|
+
);
|
|
7819
|
+
}
|
|
7820
|
+
return entry.positionNode.getPositionCreatedAt();
|
|
7821
|
+
}
|
|
7822
|
+
/**
|
|
7823
|
+
* `addDeadPosition` appends a dead position node during snapshot
|
|
7824
|
+
* restoration.
|
|
7825
|
+
*/
|
|
7826
|
+
addDeadPosition(posCreatedAt, removedAt) {
|
|
7827
|
+
const node = RGATreeListNode.createBarePosition(posCreatedAt);
|
|
7828
|
+
node.setRemovedAt(removedAt);
|
|
7829
|
+
const prevNode = this.last;
|
|
7830
|
+
RGATreeListNode.insertNodeAfter(prevNode, node);
|
|
7831
|
+
this.last = node;
|
|
7832
|
+
this.nodeMapByIndex.insertAfter(prevNode, node);
|
|
7833
|
+
this.nodeMapByCreatedAt.set(posCreatedAt.toIDString(), node);
|
|
7834
|
+
}
|
|
7835
|
+
/**
|
|
7836
|
+
* `addMovedElement` appends an element with explicit position
|
|
7837
|
+
* identity during snapshot restoration.
|
|
7838
|
+
*/
|
|
7839
|
+
addMovedElement(elem, posCreatedAt, posMovedAt) {
|
|
7840
|
+
const entry = new ElementEntry(elem);
|
|
7841
|
+
entry.posMovedAt = posMovedAt;
|
|
7842
|
+
const node = RGATreeListNode.createBarePosition(posCreatedAt);
|
|
7843
|
+
node.setElementEntry(entry);
|
|
7844
|
+
entry.positionNode = node;
|
|
7845
|
+
const prevNode = this.last;
|
|
7846
|
+
RGATreeListNode.insertNodeAfter(prevNode, node);
|
|
7847
|
+
this.last = node;
|
|
7848
|
+
this.nodeMapByIndex.insertAfter(prevNode, node);
|
|
7849
|
+
this.nodeMapByCreatedAt.set(posCreatedAt.toIDString(), node);
|
|
7850
|
+
this.elementMapByCreatedAt.set(elem.getCreatedAt().toIDString(), entry);
|
|
7851
|
+
}
|
|
7852
|
+
/**
|
|
7853
|
+
* `allNodes` returns all nodes including dead position nodes.
|
|
7854
|
+
*/
|
|
7855
|
+
allNodes() {
|
|
7856
|
+
const nodes = [];
|
|
7857
|
+
let current = this.dummyHead.getNext();
|
|
7858
|
+
while (current) {
|
|
7859
|
+
nodes.push(current);
|
|
7860
|
+
current = current.getNext();
|
|
7861
|
+
}
|
|
7862
|
+
return nodes;
|
|
7863
|
+
}
|
|
7864
|
+
/**
|
|
7865
|
+
* `toTestString` returns a String containing the meta data of the
|
|
7866
|
+
* node id for debugging purpose.
|
|
8115
7867
|
*/
|
|
8116
7868
|
toTestString() {
|
|
8117
7869
|
const json = [];
|
|
8118
7870
|
for (const node of this) {
|
|
7871
|
+
if (!node.getElementEntry()) {
|
|
7872
|
+
continue;
|
|
7873
|
+
}
|
|
8119
7874
|
const elem = `${node.getCreatedAt().toIDString()}:${node.getValue().toJSON()}`;
|
|
8120
7875
|
if (node.isRemoved()) {
|
|
8121
7876
|
json.push(`{${elem}}`);
|
|
@@ -8172,10 +7927,11 @@ class CRDTArray extends CRDTContainer {
|
|
|
8172
7927
|
this.elements.insertAfter(prevCreatedAt, value, executedAt);
|
|
8173
7928
|
}
|
|
8174
7929
|
/**
|
|
8175
|
-
* `moveAfter` moves the given `createdAt` element after the
|
|
7930
|
+
* `moveAfter` moves the given `createdAt` element after the
|
|
7931
|
+
* `prevCreatedAt`. Returns the dead position node for GC.
|
|
8176
7932
|
*/
|
|
8177
7933
|
moveAfter(prevCreatedAt, createdAt, executedAt) {
|
|
8178
|
-
this.elements.moveAfter(prevCreatedAt, createdAt, executedAt);
|
|
7934
|
+
return this.elements.moveAfter(prevCreatedAt, createdAt, executedAt);
|
|
8179
7935
|
}
|
|
8180
7936
|
/**
|
|
8181
7937
|
* `get` returns the element of the given index.
|
|
@@ -8204,11 +7960,20 @@ class CRDTArray extends CRDTContainer {
|
|
|
8204
7960
|
return this.elements.getLast();
|
|
8205
7961
|
}
|
|
8206
7962
|
/**
|
|
8207
|
-
* `getPrevCreatedAt` returns the creation time of the previous
|
|
7963
|
+
* `getPrevCreatedAt` returns the creation time of the previous
|
|
7964
|
+
* node.
|
|
8208
7965
|
*/
|
|
8209
7966
|
getPrevCreatedAt(createdAt) {
|
|
8210
7967
|
return this.elements.getPrevCreatedAt(createdAt);
|
|
8211
7968
|
}
|
|
7969
|
+
/**
|
|
7970
|
+
* `posCreatedAt` returns the createdAt of the position node
|
|
7971
|
+
* currently holding the element. Used to convert element identity
|
|
7972
|
+
* to position identity for moves.
|
|
7973
|
+
*/
|
|
7974
|
+
posCreatedAt(elemCreatedAt) {
|
|
7975
|
+
return this.elements.posCreatedAt(elemCreatedAt);
|
|
7976
|
+
}
|
|
8212
7977
|
/**
|
|
8213
7978
|
* `delete` deletes the element of the given creation time.
|
|
8214
7979
|
*/
|
|
@@ -8222,7 +7987,8 @@ class CRDTArray extends CRDTContainer {
|
|
|
8222
7987
|
return this.elements.deleteByIndex(index, editedAt);
|
|
8223
7988
|
}
|
|
8224
7989
|
/**
|
|
8225
|
-
* `set` sets the given element at the given position of the
|
|
7990
|
+
* `set` sets the given element at the given position of the
|
|
7991
|
+
* creation time.
|
|
8226
7992
|
*/
|
|
8227
7993
|
set(createdAt, value, executedAt) {
|
|
8228
7994
|
return this.elements.set(createdAt, value, executedAt);
|
|
@@ -8240,18 +8006,19 @@ class CRDTArray extends CRDTContainer {
|
|
|
8240
8006
|
return this.elements.length;
|
|
8241
8007
|
}
|
|
8242
8008
|
/**
|
|
8243
|
-
* `[Symbol.iterator]` returns an iterator for the elements in
|
|
8009
|
+
* `[Symbol.iterator]` returns an iterator for the elements in
|
|
8010
|
+
* this array.
|
|
8244
8011
|
*/
|
|
8245
8012
|
*[Symbol.iterator]() {
|
|
8246
8013
|
for (const node of this.elements) {
|
|
8247
|
-
if (!node.isRemoved()) {
|
|
8014
|
+
if (node.getElementEntry() && !node.isRemoved()) {
|
|
8248
8015
|
yield node.getValue();
|
|
8249
8016
|
}
|
|
8250
8017
|
}
|
|
8251
8018
|
}
|
|
8252
8019
|
/**
|
|
8253
|
-
* `toTestString` returns a String containing the meta data of
|
|
8254
|
-
* for debugging purpose.
|
|
8020
|
+
* `toTestString` returns a String containing the meta data of
|
|
8021
|
+
* this value for debugging purpose.
|
|
8255
8022
|
*/
|
|
8256
8023
|
toTestString() {
|
|
8257
8024
|
return this.elements.toTestString();
|
|
@@ -8261,6 +8028,9 @@ class CRDTArray extends CRDTContainer {
|
|
|
8261
8028
|
*/
|
|
8262
8029
|
getDescendants(callback) {
|
|
8263
8030
|
for (const node of this.elements) {
|
|
8031
|
+
if (!node.getElementEntry()) {
|
|
8032
|
+
continue;
|
|
8033
|
+
}
|
|
8264
8034
|
const element = node.getValue();
|
|
8265
8035
|
if (callback(element, this)) {
|
|
8266
8036
|
return;
|
|
@@ -8322,21 +8092,52 @@ class CRDTArray extends CRDTContainer {
|
|
|
8322
8092
|
return this.toJSON();
|
|
8323
8093
|
}
|
|
8324
8094
|
/**
|
|
8325
|
-
* `getElements` returns
|
|
8095
|
+
* `getElements` returns the underlying RGATreeList.
|
|
8326
8096
|
*/
|
|
8327
8097
|
getElements() {
|
|
8328
8098
|
return this.elements;
|
|
8329
8099
|
}
|
|
8100
|
+
/**
|
|
8101
|
+
* `getRGATreeList` returns the underlying RGATreeList (GCParent
|
|
8102
|
+
* for dead positions).
|
|
8103
|
+
*/
|
|
8104
|
+
getRGATreeList() {
|
|
8105
|
+
return this.elements;
|
|
8106
|
+
}
|
|
8107
|
+
/**
|
|
8108
|
+
* `getAllRGANodes` returns all RGA nodes including dead position
|
|
8109
|
+
* nodes.
|
|
8110
|
+
*/
|
|
8111
|
+
getAllRGANodes() {
|
|
8112
|
+
return this.elements.allNodes();
|
|
8113
|
+
}
|
|
8330
8114
|
/**
|
|
8331
8115
|
* `deepcopy` copies itself deeply.
|
|
8332
8116
|
*/
|
|
8333
8117
|
deepcopy() {
|
|
8334
8118
|
const clone = CRDTArray.create(this.getCreatedAt());
|
|
8335
8119
|
for (const node of this.elements) {
|
|
8336
|
-
|
|
8337
|
-
|
|
8338
|
-
|
|
8339
|
-
|
|
8120
|
+
if (!node.getElementEntry()) {
|
|
8121
|
+
const removedAt = node.getRemovedAt();
|
|
8122
|
+
if (removedAt) {
|
|
8123
|
+
clone.elements.addDeadPosition(
|
|
8124
|
+
node.getPositionCreatedAt(),
|
|
8125
|
+
removedAt
|
|
8126
|
+
);
|
|
8127
|
+
}
|
|
8128
|
+
continue;
|
|
8129
|
+
}
|
|
8130
|
+
const value = node.getValue().deepcopy();
|
|
8131
|
+
const posMovedAt = node.getPositionMovedAt();
|
|
8132
|
+
if (posMovedAt) {
|
|
8133
|
+
clone.elements.addMovedElement(
|
|
8134
|
+
value,
|
|
8135
|
+
node.getPositionCreatedAt(),
|
|
8136
|
+
posMovedAt
|
|
8137
|
+
);
|
|
8138
|
+
} else {
|
|
8139
|
+
clone.elements.insertAfter(clone.getLastCreatedAt(), value);
|
|
8140
|
+
}
|
|
8340
8141
|
}
|
|
8341
8142
|
clone.setRemovedAt(this.getRemovedAt());
|
|
8342
8143
|
clone.setMovedAt(this.getMovedAt());
|
|
@@ -8593,6 +8394,9 @@ class SetOperation extends Operation {
|
|
|
8593
8394
|
if (removed) {
|
|
8594
8395
|
root.registerRemovedElement(removed);
|
|
8595
8396
|
}
|
|
8397
|
+
if (value.getRemovedAt()) {
|
|
8398
|
+
root.registerRemovedElement(value);
|
|
8399
|
+
}
|
|
8596
8400
|
return {
|
|
8597
8401
|
opInfos: [
|
|
8598
8402
|
{
|
|
@@ -8685,7 +8489,17 @@ class MoveOperation extends Operation {
|
|
|
8685
8489
|
const array = parentObject;
|
|
8686
8490
|
const reverseOp = this.toReverseOperation(array);
|
|
8687
8491
|
const previousIndex = Number(array.subPathOf(this.createdAt));
|
|
8688
|
-
array.moveAfter(
|
|
8492
|
+
const deadNode = array.moveAfter(
|
|
8493
|
+
this.prevCreatedAt,
|
|
8494
|
+
this.createdAt,
|
|
8495
|
+
this.getExecutedAt()
|
|
8496
|
+
);
|
|
8497
|
+
if (deadNode) {
|
|
8498
|
+
root.registerGCPair({
|
|
8499
|
+
parent: array.getRGATreeList(),
|
|
8500
|
+
child: deadNode
|
|
8501
|
+
});
|
|
8502
|
+
}
|
|
8689
8503
|
const index = Number(array.subPathOf(this.createdAt));
|
|
8690
8504
|
return {
|
|
8691
8505
|
opInfos: [
|
|
@@ -8708,7 +8522,8 @@ class MoveOperation extends Operation {
|
|
|
8708
8522
|
);
|
|
8709
8523
|
}
|
|
8710
8524
|
/**
|
|
8711
|
-
* `getEffectedCreatedAt` returns the creation time of the
|
|
8525
|
+
* `getEffectedCreatedAt` returns the creation time of the
|
|
8526
|
+
* effected element.
|
|
8712
8527
|
*/
|
|
8713
8528
|
getEffectedCreatedAt() {
|
|
8714
8529
|
return this.createdAt;
|
|
@@ -8720,7 +8535,8 @@ class MoveOperation extends Operation {
|
|
|
8720
8535
|
return `${this.getParentCreatedAt().toTestString()}.MOVE`;
|
|
8721
8536
|
}
|
|
8722
8537
|
/**
|
|
8723
|
-
* `getPrevCreatedAt` returns the creation time of previous
|
|
8538
|
+
* `getPrevCreatedAt` returns the creation time of previous
|
|
8539
|
+
* element.
|
|
8724
8540
|
*/
|
|
8725
8541
|
getPrevCreatedAt() {
|
|
8726
8542
|
return this.prevCreatedAt;
|
|
@@ -8732,7 +8548,8 @@ class MoveOperation extends Operation {
|
|
|
8732
8548
|
return this.createdAt;
|
|
8733
8549
|
}
|
|
8734
8550
|
/**
|
|
8735
|
-
* `setPrevCreatedAt` sets the creation time of the previous
|
|
8551
|
+
* `setPrevCreatedAt` sets the creation time of the previous
|
|
8552
|
+
* element.
|
|
8736
8553
|
*/
|
|
8737
8554
|
setPrevCreatedAt(createdAt) {
|
|
8738
8555
|
this.prevCreatedAt = createdAt;
|
|
@@ -8843,10 +8660,10 @@ class LLRBTree {
|
|
|
8843
8660
|
let node = this.root;
|
|
8844
8661
|
let result = void 0;
|
|
8845
8662
|
while (node) {
|
|
8846
|
-
const
|
|
8847
|
-
if (
|
|
8663
|
+
const compare = this.comparator(key, node.key);
|
|
8664
|
+
if (compare === 0) {
|
|
8848
8665
|
return node;
|
|
8849
|
-
} else if (
|
|
8666
|
+
} else if (compare < 0) {
|
|
8850
8667
|
node = node.left;
|
|
8851
8668
|
} else {
|
|
8852
8669
|
result = node;
|
|
@@ -8882,12 +8699,12 @@ class LLRBTree {
|
|
|
8882
8699
|
}
|
|
8883
8700
|
getInternal(key, node) {
|
|
8884
8701
|
while (node) {
|
|
8885
|
-
const
|
|
8886
|
-
if (
|
|
8702
|
+
const compare = this.comparator(key, node.key);
|
|
8703
|
+
if (compare === 0) {
|
|
8887
8704
|
return node;
|
|
8888
|
-
} else if (
|
|
8705
|
+
} else if (compare < 0) {
|
|
8889
8706
|
node = node.left;
|
|
8890
|
-
} else if (
|
|
8707
|
+
} else if (compare > 0) {
|
|
8891
8708
|
node = node.right;
|
|
8892
8709
|
}
|
|
8893
8710
|
}
|
|
@@ -8898,10 +8715,10 @@ class LLRBTree {
|
|
|
8898
8715
|
this.counter += 1;
|
|
8899
8716
|
return new LLRBNode(key, value, true);
|
|
8900
8717
|
}
|
|
8901
|
-
const
|
|
8902
|
-
if (
|
|
8718
|
+
const compare = this.comparator(key, node.key);
|
|
8719
|
+
if (compare < 0) {
|
|
8903
8720
|
node.left = this.putInternal(key, value, node.left);
|
|
8904
|
-
} else if (
|
|
8721
|
+
} else if (compare > 0) {
|
|
8905
8722
|
node.right = this.putInternal(key, value, node.right);
|
|
8906
8723
|
} else {
|
|
8907
8724
|
node.value = value;
|
|
@@ -9200,9 +9017,9 @@ class RGATreeSplitNode extends SplayNode {
|
|
|
9200
9017
|
*/
|
|
9201
9018
|
static createComparator() {
|
|
9202
9019
|
return (p1, p2) => {
|
|
9203
|
-
const
|
|
9204
|
-
if (
|
|
9205
|
-
return
|
|
9020
|
+
const compare = p1.getCreatedAt().compare(p2.getCreatedAt());
|
|
9021
|
+
if (compare !== 0) {
|
|
9022
|
+
return compare;
|
|
9206
9023
|
}
|
|
9207
9024
|
if (p1.getOffset() > p2.getOffset()) {
|
|
9208
9025
|
return 1;
|
|
@@ -11316,7 +11133,7 @@ class IndexTreeNode {
|
|
|
11316
11133
|
this._children = left;
|
|
11317
11134
|
clone._children = actualRight;
|
|
11318
11135
|
this.visibleSize = this._children.reduce(
|
|
11319
|
-
(acc, child) => acc + child.paddedSize(),
|
|
11136
|
+
(acc, child) => acc + (child.isRemoved ? 0 : child.paddedSize()),
|
|
11320
11137
|
0
|
|
11321
11138
|
);
|
|
11322
11139
|
this.totalSize = this._children.reduce(
|
|
@@ -11324,7 +11141,7 @@ class IndexTreeNode {
|
|
|
11324
11141
|
0
|
|
11325
11142
|
);
|
|
11326
11143
|
clone.visibleSize = clone._children.reduce(
|
|
11327
|
-
(acc, child) => acc + child.paddedSize(),
|
|
11144
|
+
(acc, child) => acc + (child.isRemoved ? 0 : child.paddedSize()),
|
|
11328
11145
|
0
|
|
11329
11146
|
);
|
|
11330
11147
|
clone.totalSize = clone._children.reduce(
|
|
@@ -11859,9 +11676,9 @@ class CRDTTreeNodeID {
|
|
|
11859
11676
|
*/
|
|
11860
11677
|
static createComparator() {
|
|
11861
11678
|
return (idA, idB) => {
|
|
11862
|
-
const
|
|
11863
|
-
if (
|
|
11864
|
-
return
|
|
11679
|
+
const compare = idA.getCreatedAt().compare(idB.getCreatedAt());
|
|
11680
|
+
if (compare !== 0) {
|
|
11681
|
+
return compare;
|
|
11865
11682
|
}
|
|
11866
11683
|
if (idA.getOffset() > idB.getOffset()) {
|
|
11867
11684
|
return 1;
|
|
@@ -12076,7 +11893,7 @@ class CRDTTreeNode extends IndexTreeNode {
|
|
|
12076
11893
|
CRDTTreeNodeID.of(issueTimeTicket(), 0),
|
|
12077
11894
|
this.type,
|
|
12078
11895
|
void 0,
|
|
12079
|
-
|
|
11896
|
+
this.attrs?.deepcopy(),
|
|
12080
11897
|
this.removedAt
|
|
12081
11898
|
);
|
|
12082
11899
|
}
|
|
@@ -12433,6 +12250,9 @@ class CRDTTree extends CRDTElement {
|
|
|
12433
12250
|
const changes = [];
|
|
12434
12251
|
const attrs = attributes ? parseObjectValues(attributes) : {};
|
|
12435
12252
|
const pairs = [];
|
|
12253
|
+
const prevAttributes = /* @__PURE__ */ new Map();
|
|
12254
|
+
const newAttrKeys = [];
|
|
12255
|
+
let capturedPrev = false;
|
|
12436
12256
|
this.traverseInPosRange(
|
|
12437
12257
|
fromParent,
|
|
12438
12258
|
fromLeft,
|
|
@@ -12448,6 +12268,16 @@ class CRDTTree extends CRDTElement {
|
|
|
12448
12268
|
if (tokenType === TokenType.End && versionVector !== void 0 && this.hasUnknownSplitSibling(node, versionVector)) {
|
|
12449
12269
|
return;
|
|
12450
12270
|
}
|
|
12271
|
+
if (!capturedPrev) {
|
|
12272
|
+
for (const key of Object.keys(attributes)) {
|
|
12273
|
+
if (node.attrs?.has(key)) {
|
|
12274
|
+
prevAttributes.set(key, node.attrs.get(key));
|
|
12275
|
+
} else {
|
|
12276
|
+
newAttrKeys.push(key);
|
|
12277
|
+
}
|
|
12278
|
+
}
|
|
12279
|
+
capturedPrev = true;
|
|
12280
|
+
}
|
|
12451
12281
|
const updatedAttrPairs = node.setAttrs(attributes, editedAt);
|
|
12452
12282
|
const affectedAttrs = updatedAttrPairs.reduce(
|
|
12453
12283
|
(acc, [, curr]) => {
|
|
@@ -12483,10 +12313,57 @@ class CRDTTree extends CRDTElement {
|
|
|
12483
12313
|
addDataSizes(diff, curr.getDataSize());
|
|
12484
12314
|
}
|
|
12485
12315
|
}
|
|
12316
|
+
if (tokenType === TokenType.Start && versionVector !== void 0) {
|
|
12317
|
+
let current = node;
|
|
12318
|
+
while (current.insNextID) {
|
|
12319
|
+
const next = this.findFloorNode(current.insNextID);
|
|
12320
|
+
if (!next || next.isText) {
|
|
12321
|
+
break;
|
|
12322
|
+
}
|
|
12323
|
+
if (ticketKnown(versionVector, next.id.getCreatedAt())) {
|
|
12324
|
+
break;
|
|
12325
|
+
}
|
|
12326
|
+
const siblingPairs = next.setAttrs(attributes, editedAt);
|
|
12327
|
+
const siblingAffectedAttrs = siblingPairs.reduce(
|
|
12328
|
+
(acc, [, curr]) => {
|
|
12329
|
+
if (curr) {
|
|
12330
|
+
acc[curr.getKey()] = attrs[curr.getKey()];
|
|
12331
|
+
}
|
|
12332
|
+
return acc;
|
|
12333
|
+
},
|
|
12334
|
+
{}
|
|
12335
|
+
);
|
|
12336
|
+
if (Object.keys(siblingAffectedAttrs).length > 0) {
|
|
12337
|
+
const parentOfNext = next.parent;
|
|
12338
|
+
const previousNext = next.prevSibling || parentOfNext;
|
|
12339
|
+
changes.push({
|
|
12340
|
+
type: "style",
|
|
12341
|
+
from: this.toIndex(parentOfNext, previousNext),
|
|
12342
|
+
to: this.toIndex(next, next),
|
|
12343
|
+
fromPath: this.toPath(parentOfNext, previousNext),
|
|
12344
|
+
toPath: this.toPath(next, next),
|
|
12345
|
+
actor: editedAt.getActorID(),
|
|
12346
|
+
value: siblingAffectedAttrs
|
|
12347
|
+
});
|
|
12348
|
+
}
|
|
12349
|
+
for (const [prev] of siblingPairs) {
|
|
12350
|
+
if (prev) {
|
|
12351
|
+
pairs.push({ parent: next, child: prev });
|
|
12352
|
+
}
|
|
12353
|
+
}
|
|
12354
|
+
for (const [key] of Object.entries(attrs)) {
|
|
12355
|
+
const curr = next.attrs?.getNodeMapByKey().get(key);
|
|
12356
|
+
if (curr !== void 0) {
|
|
12357
|
+
addDataSizes(diff, curr.getDataSize());
|
|
12358
|
+
}
|
|
12359
|
+
}
|
|
12360
|
+
current = next;
|
|
12361
|
+
}
|
|
12362
|
+
}
|
|
12486
12363
|
}
|
|
12487
12364
|
}
|
|
12488
12365
|
);
|
|
12489
|
-
return [pairs, changes, diff];
|
|
12366
|
+
return [pairs, changes, diff, prevAttributes, newAttrKeys];
|
|
12490
12367
|
}
|
|
12491
12368
|
/**
|
|
12492
12369
|
* `removeStyle` removes the given attributes of the given range.
|
|
@@ -12504,6 +12381,8 @@ class CRDTTree extends CRDTElement {
|
|
|
12504
12381
|
addDataSizes(diff, diffTo, diffFrom);
|
|
12505
12382
|
const changes = [];
|
|
12506
12383
|
const pairs = [];
|
|
12384
|
+
const prevAttributes = /* @__PURE__ */ new Map();
|
|
12385
|
+
let capturedPrev = false;
|
|
12507
12386
|
this.traverseInPosRange(
|
|
12508
12387
|
fromParent,
|
|
12509
12388
|
fromLeft,
|
|
@@ -12522,6 +12401,14 @@ class CRDTTree extends CRDTElement {
|
|
|
12522
12401
|
if (!node.attrs) {
|
|
12523
12402
|
node.attrs = new RHT();
|
|
12524
12403
|
}
|
|
12404
|
+
if (!capturedPrev) {
|
|
12405
|
+
for (const key of attributesToRemove) {
|
|
12406
|
+
if (node.attrs.has(key)) {
|
|
12407
|
+
prevAttributes.set(key, node.attrs.get(key));
|
|
12408
|
+
}
|
|
12409
|
+
}
|
|
12410
|
+
capturedPrev = true;
|
|
12411
|
+
}
|
|
12525
12412
|
for (const value of attributesToRemove) {
|
|
12526
12413
|
const nodesTobeRemoved = node.attrs.remove(value, editedAt);
|
|
12527
12414
|
for (const rhtNode of nodesTobeRemoved) {
|
|
@@ -12539,10 +12426,47 @@ class CRDTTree extends CRDTElement {
|
|
|
12539
12426
|
toPath: this.toPath(node, node),
|
|
12540
12427
|
value: attributesToRemove
|
|
12541
12428
|
});
|
|
12429
|
+
if (tokenType === TokenType.Start && versionVector !== void 0) {
|
|
12430
|
+
let current = node;
|
|
12431
|
+
while (current.insNextID) {
|
|
12432
|
+
const next = this.findFloorNode(current.insNextID);
|
|
12433
|
+
if (!next || next.isText) {
|
|
12434
|
+
break;
|
|
12435
|
+
}
|
|
12436
|
+
if (ticketKnown(versionVector, next.id.getCreatedAt())) {
|
|
12437
|
+
break;
|
|
12438
|
+
}
|
|
12439
|
+
if (!next.attrs) {
|
|
12440
|
+
next.attrs = new RHT();
|
|
12441
|
+
}
|
|
12442
|
+
let removedAny = false;
|
|
12443
|
+
for (const value of attributesToRemove) {
|
|
12444
|
+
const nodesTobeRemoved = next.attrs.remove(value, editedAt);
|
|
12445
|
+
removedAny = removedAny || nodesTobeRemoved.length > 0;
|
|
12446
|
+
for (const rhtNode of nodesTobeRemoved) {
|
|
12447
|
+
pairs.push({ parent: next, child: rhtNode });
|
|
12448
|
+
}
|
|
12449
|
+
}
|
|
12450
|
+
if (removedAny) {
|
|
12451
|
+
const parentOfNext = next.parent;
|
|
12452
|
+
const previousNext = next.prevSibling || parentOfNext;
|
|
12453
|
+
changes.push({
|
|
12454
|
+
actor: editedAt.getActorID(),
|
|
12455
|
+
type: "removeStyle",
|
|
12456
|
+
from: this.toIndex(parentOfNext, previousNext),
|
|
12457
|
+
to: this.toIndex(next, next),
|
|
12458
|
+
fromPath: this.toPath(parentOfNext, previousNext),
|
|
12459
|
+
toPath: this.toPath(next, next),
|
|
12460
|
+
value: attributesToRemove
|
|
12461
|
+
});
|
|
12462
|
+
}
|
|
12463
|
+
current = next;
|
|
12464
|
+
}
|
|
12465
|
+
}
|
|
12542
12466
|
}
|
|
12543
12467
|
}
|
|
12544
12468
|
);
|
|
12545
|
-
return [pairs, changes, diff];
|
|
12469
|
+
return [pairs, changes, diff, prevAttributes];
|
|
12546
12470
|
}
|
|
12547
12471
|
/**
|
|
12548
12472
|
* `edit` edits the tree with the given range and content.
|
|
@@ -12676,7 +12600,7 @@ class CRDTTree extends CRDTElement {
|
|
|
12676
12600
|
while (splitCount < splitLevel) {
|
|
12677
12601
|
parent.split(
|
|
12678
12602
|
this,
|
|
12679
|
-
parent.findOffset(left) + 1,
|
|
12603
|
+
parent.findOffset(left, true) + 1,
|
|
12680
12604
|
issueTimeTicket,
|
|
12681
12605
|
versionVector
|
|
12682
12606
|
);
|
|
@@ -13190,6 +13114,13 @@ class TreeEditOperation extends Operation {
|
|
|
13190
13114
|
toIdx;
|
|
13191
13115
|
lastFromIdx;
|
|
13192
13116
|
lastToIdx;
|
|
13117
|
+
/**
|
|
13118
|
+
* `redoSplitLevel` is set on boundary-deletion undo ops that were generated
|
|
13119
|
+
* to reverse a split. When this op executes (as undo), `toReverseOperation`
|
|
13120
|
+
* uses this value to generate a proper split op for redo, rather than
|
|
13121
|
+
* re-inserting the raw tombstoned boundary nodes as content.
|
|
13122
|
+
*/
|
|
13123
|
+
redoSplitLevel;
|
|
13193
13124
|
constructor(parentCreatedAt, fromPos, toPos, contents, splitLevel, executedAt, isUndoOp, fromIdx, toIdx) {
|
|
13194
13125
|
super(parentCreatedAt, executedAt);
|
|
13195
13126
|
this.fromPos = fromPos;
|
|
@@ -13275,7 +13206,13 @@ class TreeEditOperation extends Operation {
|
|
|
13275
13206
|
0
|
|
13276
13207
|
);
|
|
13277
13208
|
this.lastToIdx = preEditFromIdx + removedSize;
|
|
13278
|
-
|
|
13209
|
+
let reverseOp;
|
|
13210
|
+
const isPureL1Split = this.splitLevel === 1 && !this.contents?.length && removedNodes.length === 0;
|
|
13211
|
+
if (this.splitLevel === 0) {
|
|
13212
|
+
reverseOp = this.toReverseOperation(tree, removedNodes, preEditFromIdx);
|
|
13213
|
+
} else if (isPureL1Split) {
|
|
13214
|
+
reverseOp = this.toSplitReverseOperation(tree, preEditFromIdx);
|
|
13215
|
+
}
|
|
13279
13216
|
root.acc(diff);
|
|
13280
13217
|
for (const pair of pairs) {
|
|
13281
13218
|
root.registerGCPair(pair);
|
|
@@ -13311,6 +13248,24 @@ class TreeEditOperation extends Operation {
|
|
|
13311
13248
|
* @param preEditFromIdx - The from index captured BEFORE the edit
|
|
13312
13249
|
*/
|
|
13313
13250
|
toReverseOperation(tree, removedNodes, preEditFromIdx) {
|
|
13251
|
+
if (this.redoSplitLevel !== void 0 && this.redoSplitLevel > 0) {
|
|
13252
|
+
const splitRedoFromPos = tree.findPos(preEditFromIdx);
|
|
13253
|
+
const splitRedoOp = TreeEditOperation.create(
|
|
13254
|
+
this.getParentCreatedAt(),
|
|
13255
|
+
splitRedoFromPos,
|
|
13256
|
+
splitRedoFromPos,
|
|
13257
|
+
void 0,
|
|
13258
|
+
// no inserted content
|
|
13259
|
+
this.redoSplitLevel,
|
|
13260
|
+
void 0,
|
|
13261
|
+
// executedAt assigned at redo time
|
|
13262
|
+
true,
|
|
13263
|
+
// isUndoOp (treated as undo/redo op)
|
|
13264
|
+
preEditFromIdx,
|
|
13265
|
+
preEditFromIdx
|
|
13266
|
+
);
|
|
13267
|
+
return splitRedoOp;
|
|
13268
|
+
}
|
|
13314
13269
|
const insertedContentSize = this.contents ? this.contents.reduce((sum, node) => sum + node.paddedSize(), 0) : 0;
|
|
13315
13270
|
const maxNeededIdx = preEditFromIdx + insertedContentSize;
|
|
13316
13271
|
if (maxNeededIdx > tree.getSize()) {
|
|
@@ -13348,6 +13303,45 @@ class TreeEditOperation extends Operation {
|
|
|
13348
13303
|
reverseToIdx
|
|
13349
13304
|
);
|
|
13350
13305
|
}
|
|
13306
|
+
/**
|
|
13307
|
+
* `toSplitReverseOperation` creates the reverse operation for a split edit.
|
|
13308
|
+
*
|
|
13309
|
+
* A split creates element boundaries (close + open tags). The reverse
|
|
13310
|
+
* is a boundary deletion: a splitLevel=0 edit that removes those tokens,
|
|
13311
|
+
* merging the split elements back together.
|
|
13312
|
+
*
|
|
13313
|
+
* boundarySize = 2 * splitLevel (each level creates 1 close + 1 open tag)
|
|
13314
|
+
*
|
|
13315
|
+
* @param tree - The CRDTTree after the split has been applied
|
|
13316
|
+
* @param preEditFromIdx - The from index captured BEFORE the split
|
|
13317
|
+
*/
|
|
13318
|
+
toSplitReverseOperation(tree, preEditFromIdx) {
|
|
13319
|
+
const boundarySize = 2 * this.splitLevel;
|
|
13320
|
+
const reverseFromIdx = preEditFromIdx;
|
|
13321
|
+
const reverseToIdx = preEditFromIdx + boundarySize;
|
|
13322
|
+
if (reverseToIdx > tree.getSize()) {
|
|
13323
|
+
return void 0;
|
|
13324
|
+
}
|
|
13325
|
+
const reverseFromPos = tree.findPos(reverseFromIdx);
|
|
13326
|
+
const reverseToPos = tree.findPos(reverseToIdx);
|
|
13327
|
+
const boundaryDeletionOp = TreeEditOperation.create(
|
|
13328
|
+
this.getParentCreatedAt(),
|
|
13329
|
+
reverseFromPos,
|
|
13330
|
+
reverseToPos,
|
|
13331
|
+
void 0,
|
|
13332
|
+
// no content — this is a deletion
|
|
13333
|
+
0,
|
|
13334
|
+
// splitLevel=0: boundary deletion
|
|
13335
|
+
void 0,
|
|
13336
|
+
// executedAt assigned at undo time
|
|
13337
|
+
true,
|
|
13338
|
+
// isUndoOp
|
|
13339
|
+
reverseFromIdx,
|
|
13340
|
+
reverseToIdx
|
|
13341
|
+
);
|
|
13342
|
+
boundaryDeletionOp.redoSplitLevel = this.splitLevel;
|
|
13343
|
+
return boundaryDeletionOp;
|
|
13344
|
+
}
|
|
13351
13345
|
/**
|
|
13352
13346
|
* `normalizePos` returns the visible-index range of this operation.
|
|
13353
13347
|
* For undo ops, returns the stored (possibly reconciled) indices.
|
|
@@ -14053,35 +14047,196 @@ class Checkpoint {
|
|
|
14053
14047
|
}
|
|
14054
14048
|
}
|
|
14055
14049
|
const InitialCheckpoint = new Checkpoint(0n, 0);
|
|
14056
|
-
const
|
|
14050
|
+
const hllPrecision = 14;
|
|
14051
|
+
const hllRegisterCount = 1 << hllPrecision;
|
|
14052
|
+
const prime64x1 = 0x9e3779b185ebca87n;
|
|
14053
|
+
const prime64x2 = 0xc2b2ae3d27d4eb4fn;
|
|
14054
|
+
const prime64x3 = 0x165667b19e3779f9n;
|
|
14055
|
+
const prime64x4 = 0x85ebca77c2b2ae63n;
|
|
14056
|
+
const prime64x5 = 0x27d4eb2f165667c5n;
|
|
14057
|
+
const mask64 = 0xffffffffffffffffn;
|
|
14058
|
+
class HLL {
|
|
14059
|
+
registers;
|
|
14060
|
+
constructor() {
|
|
14061
|
+
this.registers = new Uint8Array(hllRegisterCount);
|
|
14062
|
+
}
|
|
14063
|
+
/**
|
|
14064
|
+
* `add` adds a value to the HLL and returns true if the register was updated.
|
|
14065
|
+
*/
|
|
14066
|
+
add(value) {
|
|
14067
|
+
const hash = xxhash64(value);
|
|
14068
|
+
const idx = Number(hash >> BigInt(64 - hllPrecision));
|
|
14069
|
+
const remaining = hash << BigInt(hllPrecision) & mask64 | 1n << BigInt(hllPrecision - 1);
|
|
14070
|
+
const rho = countLeadingZeros64(remaining) + 1;
|
|
14071
|
+
if (rho > this.registers[idx]) {
|
|
14072
|
+
this.registers[idx] = rho;
|
|
14073
|
+
return true;
|
|
14074
|
+
}
|
|
14075
|
+
return false;
|
|
14076
|
+
}
|
|
14077
|
+
/**
|
|
14078
|
+
* `count` returns the approximate cardinality estimate.
|
|
14079
|
+
*/
|
|
14080
|
+
count() {
|
|
14081
|
+
const m = hllRegisterCount;
|
|
14082
|
+
const alpha = 0.7213 / (1 + 1.079 / m);
|
|
14083
|
+
let sum = 0;
|
|
14084
|
+
let zeros = 0;
|
|
14085
|
+
for (let i = 0; i < m; i++) {
|
|
14086
|
+
sum += Math.pow(2, -this.registers[i]);
|
|
14087
|
+
if (this.registers[i] === 0) zeros++;
|
|
14088
|
+
}
|
|
14089
|
+
let estimate = alpha * m * m / sum;
|
|
14090
|
+
if (estimate <= 2.5 * m && zeros > 0) {
|
|
14091
|
+
estimate = m * Math.log(m / zeros);
|
|
14092
|
+
}
|
|
14093
|
+
return Math.round(estimate);
|
|
14094
|
+
}
|
|
14095
|
+
/**
|
|
14096
|
+
* `merge` merges another HLL into this one by taking the max of each register.
|
|
14097
|
+
* This operation is commutative, associative, and idempotent.
|
|
14098
|
+
*/
|
|
14099
|
+
merge(other) {
|
|
14100
|
+
for (let i = 0; i < hllRegisterCount; i++) {
|
|
14101
|
+
if (other.registers[i] > this.registers[i]) {
|
|
14102
|
+
this.registers[i] = other.registers[i];
|
|
14103
|
+
}
|
|
14104
|
+
}
|
|
14105
|
+
}
|
|
14106
|
+
/**
|
|
14107
|
+
* `toBytes` serializes the HLL registers to a byte array.
|
|
14108
|
+
*/
|
|
14109
|
+
toBytes() {
|
|
14110
|
+
return new Uint8Array(this.registers);
|
|
14111
|
+
}
|
|
14112
|
+
/**
|
|
14113
|
+
* `restore` restores the HLL registers from a byte array.
|
|
14114
|
+
* Throws if the data length does not match the register count.
|
|
14115
|
+
*/
|
|
14116
|
+
restore(data) {
|
|
14117
|
+
if (data.length !== hllRegisterCount) {
|
|
14118
|
+
throw new Error(
|
|
14119
|
+
`invalid HLL register payload: got ${data.length} bytes, want ${hllRegisterCount}`
|
|
14120
|
+
);
|
|
14121
|
+
}
|
|
14122
|
+
this.registers.set(data);
|
|
14123
|
+
}
|
|
14124
|
+
}
|
|
14125
|
+
function xxhash64(input) {
|
|
14126
|
+
const buf = new TextEncoder().encode(input);
|
|
14127
|
+
const len = buf.length;
|
|
14128
|
+
let h64;
|
|
14129
|
+
let offset = 0;
|
|
14130
|
+
const seed = 0n;
|
|
14131
|
+
if (len >= 32) {
|
|
14132
|
+
let v1 = seed + prime64x1 + prime64x2 & mask64;
|
|
14133
|
+
let v2 = seed + prime64x2 & mask64;
|
|
14134
|
+
let v3 = seed;
|
|
14135
|
+
let v4 = seed - prime64x1 & mask64;
|
|
14136
|
+
while (offset <= len - 32) {
|
|
14137
|
+
v1 = xxRound(v1, readU64LE(buf, offset));
|
|
14138
|
+
offset += 8;
|
|
14139
|
+
v2 = xxRound(v2, readU64LE(buf, offset));
|
|
14140
|
+
offset += 8;
|
|
14141
|
+
v3 = xxRound(v3, readU64LE(buf, offset));
|
|
14142
|
+
offset += 8;
|
|
14143
|
+
v4 = xxRound(v4, readU64LE(buf, offset));
|
|
14144
|
+
offset += 8;
|
|
14145
|
+
}
|
|
14146
|
+
h64 = rotl64(v1, 1n) + rotl64(v2, 7n) + rotl64(v3, 12n) + rotl64(v4, 18n) & mask64;
|
|
14147
|
+
h64 = xxMergeRound(h64, v1);
|
|
14148
|
+
h64 = xxMergeRound(h64, v2);
|
|
14149
|
+
h64 = xxMergeRound(h64, v3);
|
|
14150
|
+
h64 = xxMergeRound(h64, v4);
|
|
14151
|
+
} else {
|
|
14152
|
+
h64 = seed + prime64x5 & mask64;
|
|
14153
|
+
}
|
|
14154
|
+
h64 = h64 + BigInt(len) & mask64;
|
|
14155
|
+
while (offset + 8 <= len) {
|
|
14156
|
+
const k1 = xxRound(0n, readU64LE(buf, offset));
|
|
14157
|
+
h64 = rotl64(h64 ^ k1, 27n) * prime64x1 + prime64x4 & mask64;
|
|
14158
|
+
offset += 8;
|
|
14159
|
+
}
|
|
14160
|
+
if (offset + 4 <= len) {
|
|
14161
|
+
h64 = h64 ^ readU32LE(buf, offset) * prime64x1 & mask64;
|
|
14162
|
+
h64 = rotl64(h64, 23n) * prime64x2 + prime64x3 & mask64;
|
|
14163
|
+
offset += 4;
|
|
14164
|
+
}
|
|
14165
|
+
while (offset < len) {
|
|
14166
|
+
h64 = h64 ^ BigInt(buf[offset]) * prime64x5 & mask64;
|
|
14167
|
+
h64 = rotl64(h64, 11n) * prime64x1 & mask64;
|
|
14168
|
+
offset++;
|
|
14169
|
+
}
|
|
14170
|
+
h64 = (h64 ^ h64 >> 33n) * prime64x2 & mask64;
|
|
14171
|
+
h64 = (h64 ^ h64 >> 29n) * prime64x3 & mask64;
|
|
14172
|
+
h64 = (h64 ^ h64 >> 32n) & mask64;
|
|
14173
|
+
return h64;
|
|
14174
|
+
}
|
|
14175
|
+
function rotl64(x, r) {
|
|
14176
|
+
return (x << r | x >> 64n - r) & mask64;
|
|
14177
|
+
}
|
|
14178
|
+
function xxRound(acc, input) {
|
|
14179
|
+
acc = acc + input * prime64x2 & mask64;
|
|
14180
|
+
acc = rotl64(acc, 31n);
|
|
14181
|
+
return acc * prime64x1 & mask64;
|
|
14182
|
+
}
|
|
14183
|
+
function xxMergeRound(acc, val) {
|
|
14184
|
+
val = xxRound(0n, val);
|
|
14185
|
+
acc = (acc ^ val) & mask64;
|
|
14186
|
+
return acc * prime64x1 + prime64x4 & mask64;
|
|
14187
|
+
}
|
|
14188
|
+
function readU64LE(buf, offset) {
|
|
14189
|
+
let val = 0n;
|
|
14190
|
+
for (let i = 7; i >= 0; i--) {
|
|
14191
|
+
val = val << 8n | BigInt(buf[offset + i]);
|
|
14192
|
+
}
|
|
14193
|
+
return val;
|
|
14194
|
+
}
|
|
14195
|
+
function readU32LE(buf, offset) {
|
|
14196
|
+
return BigInt(buf[offset]) | BigInt(buf[offset + 1]) << 8n | BigInt(buf[offset + 2]) << 16n | BigInt(buf[offset + 3]) << 24n;
|
|
14197
|
+
}
|
|
14198
|
+
function countLeadingZeros64(x) {
|
|
14199
|
+
if (x === 0n) return 64;
|
|
14200
|
+
let n = 0;
|
|
14201
|
+
while ((x & 1n << 63n) === 0n) {
|
|
14202
|
+
n++;
|
|
14203
|
+
x <<= 1n;
|
|
14204
|
+
}
|
|
14205
|
+
return n;
|
|
14206
|
+
}
|
|
14057
14207
|
var CounterType = /* @__PURE__ */ ((CounterType2) => {
|
|
14058
14208
|
CounterType2[CounterType2["Int"] = 0] = "Int";
|
|
14059
14209
|
CounterType2[CounterType2["Long"] = 1] = "Long";
|
|
14210
|
+
CounterType2[CounterType2["IntDedup"] = 2] = "IntDedup";
|
|
14060
14211
|
return CounterType2;
|
|
14061
14212
|
})(CounterType || {});
|
|
14062
14213
|
class CRDTCounter extends CRDTElement {
|
|
14063
14214
|
valueType;
|
|
14064
14215
|
value;
|
|
14216
|
+
hll;
|
|
14065
14217
|
constructor(valueType, value, createdAt) {
|
|
14066
14218
|
super(createdAt);
|
|
14067
14219
|
this.valueType = valueType;
|
|
14068
14220
|
switch (valueType) {
|
|
14221
|
+
case 2:
|
|
14222
|
+
this.value = 0;
|
|
14223
|
+
break;
|
|
14069
14224
|
case 0:
|
|
14070
14225
|
if (typeof value === "number") {
|
|
14071
14226
|
if (value > Math.pow(2, 31) - 1 || value < -Math.pow(2, 31)) {
|
|
14072
|
-
this.value =
|
|
14227
|
+
this.value = bigintToInt32(BigInt(value));
|
|
14073
14228
|
} else {
|
|
14074
14229
|
this.value = removeDecimal(value);
|
|
14075
14230
|
}
|
|
14076
14231
|
} else {
|
|
14077
|
-
this.value = value
|
|
14232
|
+
this.value = bigintToInt32(value);
|
|
14078
14233
|
}
|
|
14079
14234
|
break;
|
|
14080
14235
|
case 1:
|
|
14081
14236
|
if (typeof value === "number") {
|
|
14082
|
-
this.value =
|
|
14237
|
+
this.value = BigInt.asIntN(64, BigInt(Math.trunc(value)));
|
|
14083
14238
|
} else {
|
|
14084
|
-
this.value = value;
|
|
14239
|
+
this.value = BigInt.asIntN(64, value);
|
|
14085
14240
|
}
|
|
14086
14241
|
break;
|
|
14087
14242
|
default:
|
|
@@ -14090,6 +14245,9 @@ class CRDTCounter extends CRDTElement {
|
|
|
14090
14245
|
`unimplemented type: ${valueType}`
|
|
14091
14246
|
);
|
|
14092
14247
|
}
|
|
14248
|
+
if (this.isDedup()) {
|
|
14249
|
+
this.hll ??= new HLL();
|
|
14250
|
+
}
|
|
14093
14251
|
}
|
|
14094
14252
|
/**
|
|
14095
14253
|
* `of` creates a new instance of Counter.
|
|
@@ -14103,9 +14261,10 @@ class CRDTCounter extends CRDTElement {
|
|
|
14103
14261
|
static valueFromBytes(counterType, bytes) {
|
|
14104
14262
|
switch (counterType) {
|
|
14105
14263
|
case 0:
|
|
14264
|
+
case 2:
|
|
14106
14265
|
return bytes[0] | bytes[1] << 8 | bytes[2] << 16 | bytes[3] << 24;
|
|
14107
14266
|
case 1:
|
|
14108
|
-
return
|
|
14267
|
+
return bigintFromBytesLE(bytes);
|
|
14109
14268
|
default:
|
|
14110
14269
|
throw new YorkieError(
|
|
14111
14270
|
Code.ErrUnimplemented,
|
|
@@ -14117,7 +14276,10 @@ class CRDTCounter extends CRDTElement {
|
|
|
14117
14276
|
* `getDataSize` returns the data usage of this element.
|
|
14118
14277
|
*/
|
|
14119
14278
|
getDataSize() {
|
|
14120
|
-
|
|
14279
|
+
let data = this.valueType === 0 || this.valueType === 2 ? 4 : 8;
|
|
14280
|
+
if (this.isDedup() && this.hll) {
|
|
14281
|
+
data += this.hll.toBytes().length;
|
|
14282
|
+
}
|
|
14121
14283
|
return {
|
|
14122
14284
|
data,
|
|
14123
14285
|
meta: this.getMetaUsage()
|
|
@@ -14156,6 +14318,9 @@ class CRDTCounter extends CRDTElement {
|
|
|
14156
14318
|
);
|
|
14157
14319
|
clone.setRemovedAt(this.getRemovedAt());
|
|
14158
14320
|
clone.setMovedAt(this.getMovedAt());
|
|
14321
|
+
if (this.isDedup() && this.hll) {
|
|
14322
|
+
clone.restoreHLL(this.hll.toBytes());
|
|
14323
|
+
}
|
|
14159
14324
|
return clone;
|
|
14160
14325
|
}
|
|
14161
14326
|
/**
|
|
@@ -14169,12 +14334,8 @@ class CRDTCounter extends CRDTElement {
|
|
|
14169
14334
|
*/
|
|
14170
14335
|
static getCounterType(value) {
|
|
14171
14336
|
switch (typeof value) {
|
|
14172
|
-
case "
|
|
14173
|
-
|
|
14174
|
-
return 1;
|
|
14175
|
-
} else {
|
|
14176
|
-
return;
|
|
14177
|
-
}
|
|
14337
|
+
case "bigint":
|
|
14338
|
+
return 1;
|
|
14178
14339
|
case "number":
|
|
14179
14340
|
if (value > Math.pow(2, 31) - 1 || value < -Math.pow(2, 31)) {
|
|
14180
14341
|
return 1;
|
|
@@ -14202,7 +14363,7 @@ class CRDTCounter extends CRDTElement {
|
|
|
14202
14363
|
*/
|
|
14203
14364
|
isNumericType() {
|
|
14204
14365
|
const t = this.valueType;
|
|
14205
|
-
return t === 0 || t === 1;
|
|
14366
|
+
return t === 0 || t === 1 || t === 2;
|
|
14206
14367
|
}
|
|
14207
14368
|
/**
|
|
14208
14369
|
* `getValueType` get counter value type.
|
|
@@ -14221,7 +14382,8 @@ class CRDTCounter extends CRDTElement {
|
|
|
14221
14382
|
*/
|
|
14222
14383
|
toBytes() {
|
|
14223
14384
|
switch (this.valueType) {
|
|
14224
|
-
case 0:
|
|
14385
|
+
case 0:
|
|
14386
|
+
case 2: {
|
|
14225
14387
|
const intVal = this.value;
|
|
14226
14388
|
return new Uint8Array([
|
|
14227
14389
|
intVal & 255,
|
|
@@ -14231,9 +14393,7 @@ class CRDTCounter extends CRDTElement {
|
|
|
14231
14393
|
]);
|
|
14232
14394
|
}
|
|
14233
14395
|
case 1: {
|
|
14234
|
-
|
|
14235
|
-
const longToBytes = longVal.toBytesLE();
|
|
14236
|
-
return Uint8Array.from(longToBytes);
|
|
14396
|
+
return bigintToBytesLE(this.value);
|
|
14237
14397
|
}
|
|
14238
14398
|
default:
|
|
14239
14399
|
throw new YorkieError(
|
|
@@ -14242,10 +14402,76 @@ class CRDTCounter extends CRDTElement {
|
|
|
14242
14402
|
);
|
|
14243
14403
|
}
|
|
14244
14404
|
}
|
|
14405
|
+
/**
|
|
14406
|
+
* `isDedup` returns whether dedup mode is enabled (derived from ValueType).
|
|
14407
|
+
*/
|
|
14408
|
+
isDedup() {
|
|
14409
|
+
return this.valueType === 2;
|
|
14410
|
+
}
|
|
14411
|
+
/**
|
|
14412
|
+
* `increaseDedup` increases the counter using HLL-based dedup.
|
|
14413
|
+
* Only updates the value if the actor is new (not seen before).
|
|
14414
|
+
*/
|
|
14415
|
+
increaseDedup(v, actor) {
|
|
14416
|
+
if (!this.isDedup() || !this.hll) {
|
|
14417
|
+
return this.increase(v);
|
|
14418
|
+
}
|
|
14419
|
+
if (!this.isNumericType() || !v.isNumericType()) {
|
|
14420
|
+
throw new TypeError(`Unsupported type of value: ${typeof v.getValue()}`);
|
|
14421
|
+
}
|
|
14422
|
+
if (!actor) {
|
|
14423
|
+
throw new YorkieError(
|
|
14424
|
+
Code.ErrInvalidArgument,
|
|
14425
|
+
"dedup counter requires actor"
|
|
14426
|
+
);
|
|
14427
|
+
}
|
|
14428
|
+
const val = v.getValue();
|
|
14429
|
+
const isUnit = v.getType() === PrimitiveType.Long ? val === 1n : val === 1;
|
|
14430
|
+
if (!isUnit) {
|
|
14431
|
+
throw new YorkieError(
|
|
14432
|
+
Code.ErrInvalidArgument,
|
|
14433
|
+
"dedup counter only supports increment by 1"
|
|
14434
|
+
);
|
|
14435
|
+
}
|
|
14436
|
+
if (this.hll.add(actor)) {
|
|
14437
|
+
this.recomputeValue();
|
|
14438
|
+
}
|
|
14439
|
+
return this;
|
|
14440
|
+
}
|
|
14441
|
+
/**
|
|
14442
|
+
* `hllBytes` returns the HLL register bytes, or undefined if not in dedup mode.
|
|
14443
|
+
*/
|
|
14444
|
+
hllBytes() {
|
|
14445
|
+
return this.hll?.toBytes();
|
|
14446
|
+
}
|
|
14447
|
+
/**
|
|
14448
|
+
* `restoreHLL` restores the HLL state from serialized bytes.
|
|
14449
|
+
*/
|
|
14450
|
+
restoreHLL(data) {
|
|
14451
|
+
if (!this.hll) {
|
|
14452
|
+
this.hll = new HLL();
|
|
14453
|
+
}
|
|
14454
|
+
this.hll.restore(data);
|
|
14455
|
+
this.recomputeValue();
|
|
14456
|
+
}
|
|
14457
|
+
/**
|
|
14458
|
+
* `recomputeValue` updates the counter value from the HLL cardinality estimate.
|
|
14459
|
+
*/
|
|
14460
|
+
recomputeValue() {
|
|
14461
|
+
if (!this.hll) return;
|
|
14462
|
+
this.value = this.hll.count();
|
|
14463
|
+
}
|
|
14245
14464
|
/**
|
|
14246
14465
|
* `increase` increases numeric data.
|
|
14466
|
+
* Dedup counters must use increaseDedup() instead.
|
|
14247
14467
|
*/
|
|
14248
14468
|
increase(v) {
|
|
14469
|
+
if (this.isDedup()) {
|
|
14470
|
+
throw new YorkieError(
|
|
14471
|
+
Code.ErrInvalidArgument,
|
|
14472
|
+
"dedup counter requires actor, use increaseDedup()"
|
|
14473
|
+
);
|
|
14474
|
+
}
|
|
14249
14475
|
function checkNumericType(target) {
|
|
14250
14476
|
if (!target.isNumericType()) {
|
|
14251
14477
|
throw new TypeError(
|
|
@@ -14256,14 +14482,17 @@ class CRDTCounter extends CRDTElement {
|
|
|
14256
14482
|
checkNumericType(this);
|
|
14257
14483
|
checkNumericType(v);
|
|
14258
14484
|
if (this.valueType === 1) {
|
|
14259
|
-
|
|
14485
|
+
const delta = typeof v.getValue() === "bigint" ? v.getValue() : BigInt(Math.trunc(v.getValue()));
|
|
14486
|
+
this.value = BigInt.asIntN(64, this.value + delta);
|
|
14260
14487
|
} else {
|
|
14261
14488
|
if (v.getType() === PrimitiveType.Long) {
|
|
14262
|
-
this.value = this.value + v.getValue()
|
|
14489
|
+
this.value = this.value + bigintToInt32(v.getValue());
|
|
14263
14490
|
} else {
|
|
14264
|
-
this.value =
|
|
14265
|
-
|
|
14266
|
-
|
|
14491
|
+
this.value = bigintToInt32(
|
|
14492
|
+
BigInt(
|
|
14493
|
+
this.value + removeDecimal(v.getValue())
|
|
14494
|
+
)
|
|
14495
|
+
);
|
|
14267
14496
|
}
|
|
14268
14497
|
}
|
|
14269
14498
|
return this;
|
|
@@ -14271,15 +14500,23 @@ class CRDTCounter extends CRDTElement {
|
|
|
14271
14500
|
}
|
|
14272
14501
|
class IncreaseOperation extends Operation {
|
|
14273
14502
|
value;
|
|
14274
|
-
|
|
14503
|
+
actor;
|
|
14504
|
+
constructor(parentCreatedAt, value, executedAt, actor) {
|
|
14275
14505
|
super(parentCreatedAt, executedAt);
|
|
14276
14506
|
this.value = value;
|
|
14507
|
+
this.actor = actor || "";
|
|
14277
14508
|
}
|
|
14278
14509
|
/**
|
|
14279
14510
|
* `create` creates a new instance of IncreaseOperation.
|
|
14280
14511
|
*/
|
|
14281
|
-
static create(parentCreatedAt, value, executedAt) {
|
|
14282
|
-
return new IncreaseOperation(parentCreatedAt, value, executedAt);
|
|
14512
|
+
static create(parentCreatedAt, value, executedAt, actor) {
|
|
14513
|
+
return new IncreaseOperation(parentCreatedAt, value, executedAt, actor);
|
|
14514
|
+
}
|
|
14515
|
+
/**
|
|
14516
|
+
* `getActor` returns the actor ID associated with this operation.
|
|
14517
|
+
*/
|
|
14518
|
+
getActor() {
|
|
14519
|
+
return this.actor;
|
|
14283
14520
|
}
|
|
14284
14521
|
/**
|
|
14285
14522
|
* `execute` executes this operation on the given `CRDTRoot`.
|
|
@@ -14300,7 +14537,17 @@ class IncreaseOperation extends Operation {
|
|
|
14300
14537
|
}
|
|
14301
14538
|
const counter = parentObject;
|
|
14302
14539
|
const value = this.value.deepcopy();
|
|
14303
|
-
counter.
|
|
14540
|
+
if (counter.isDedup()) {
|
|
14541
|
+
if (!this.actor) {
|
|
14542
|
+
throw new YorkieError(
|
|
14543
|
+
Code.ErrInvalidArgument,
|
|
14544
|
+
"dedup counter requires actor"
|
|
14545
|
+
);
|
|
14546
|
+
}
|
|
14547
|
+
counter.increaseDedup(value, this.actor);
|
|
14548
|
+
} else {
|
|
14549
|
+
counter.increase(value);
|
|
14550
|
+
}
|
|
14304
14551
|
return {
|
|
14305
14552
|
opInfos: [
|
|
14306
14553
|
{
|
|
@@ -14309,7 +14556,9 @@ class IncreaseOperation extends Operation {
|
|
|
14309
14556
|
value: value.getValue()
|
|
14310
14557
|
}
|
|
14311
14558
|
],
|
|
14312
|
-
|
|
14559
|
+
// Dedup counters do not support undo/redo because HLL cannot
|
|
14560
|
+
// remove an actor once added.
|
|
14561
|
+
reverseOp: this.actor ? void 0 : this.toReverseOperation()
|
|
14313
14562
|
};
|
|
14314
14563
|
}
|
|
14315
14564
|
/**
|
|
@@ -14318,7 +14567,7 @@ class IncreaseOperation extends Operation {
|
|
|
14318
14567
|
toReverseOperation() {
|
|
14319
14568
|
const primitiveValue = this.value.deepcopy();
|
|
14320
14569
|
const valueType = primitiveValue.getType();
|
|
14321
|
-
const value = valueType === PrimitiveType.Long ? primitiveValue.getValue()
|
|
14570
|
+
const value = valueType === PrimitiveType.Long ? -primitiveValue.getValue() : primitiveValue.getValue() * -1;
|
|
14322
14571
|
const reverseOp = IncreaseOperation.create(
|
|
14323
14572
|
this.getParentCreatedAt(),
|
|
14324
14573
|
Primitive.of(value, primitiveValue.getCreatedAt())
|
|
@@ -14403,28 +14652,67 @@ class TreeStyleOperation extends Operation {
|
|
|
14403
14652
|
let changes;
|
|
14404
14653
|
let pairs;
|
|
14405
14654
|
let diff = { data: 0, meta: 0 };
|
|
14655
|
+
const reversePrevAttributes = /* @__PURE__ */ new Map();
|
|
14656
|
+
const reverseAttrsToRemove = [];
|
|
14406
14657
|
if (this.attributes.size) {
|
|
14407
14658
|
const attributes = {};
|
|
14408
14659
|
[...this.attributes].forEach(([key, value]) => attributes[key] = value);
|
|
14409
|
-
|
|
14660
|
+
let prevAttributes;
|
|
14661
|
+
let newAttrKeys;
|
|
14662
|
+
[pairs, changes, diff, prevAttributes, newAttrKeys] = tree.style(
|
|
14410
14663
|
[this.fromPos, this.toPos],
|
|
14411
14664
|
attributes,
|
|
14412
14665
|
this.getExecutedAt(),
|
|
14413
14666
|
versionVector
|
|
14414
14667
|
);
|
|
14668
|
+
for (const [key, value] of prevAttributes) {
|
|
14669
|
+
reversePrevAttributes.set(key, value);
|
|
14670
|
+
}
|
|
14671
|
+
reverseAttrsToRemove.push(...newAttrKeys);
|
|
14415
14672
|
} else {
|
|
14416
14673
|
const attributesToRemove = this.attributesToRemove;
|
|
14417
|
-
|
|
14674
|
+
let prevAttributes;
|
|
14675
|
+
[pairs, changes, diff, prevAttributes] = tree.removeStyle(
|
|
14418
14676
|
[this.fromPos, this.toPos],
|
|
14419
14677
|
attributesToRemove,
|
|
14420
14678
|
this.getExecutedAt(),
|
|
14421
14679
|
versionVector
|
|
14422
14680
|
);
|
|
14681
|
+
for (const [key, value] of prevAttributes) {
|
|
14682
|
+
reversePrevAttributes.set(key, value);
|
|
14683
|
+
}
|
|
14423
14684
|
}
|
|
14424
14685
|
root.acc(diff);
|
|
14425
14686
|
for (const pair of pairs) {
|
|
14426
14687
|
root.registerGCPair(pair);
|
|
14427
14688
|
}
|
|
14689
|
+
let reverseOp;
|
|
14690
|
+
if (reversePrevAttributes.size > 0 && reverseAttrsToRemove.length > 0) {
|
|
14691
|
+
reverseOp = new TreeStyleOperation(
|
|
14692
|
+
this.getParentCreatedAt(),
|
|
14693
|
+
this.fromPos,
|
|
14694
|
+
this.toPos,
|
|
14695
|
+
reversePrevAttributes,
|
|
14696
|
+
reverseAttrsToRemove,
|
|
14697
|
+
void 0
|
|
14698
|
+
);
|
|
14699
|
+
} else if (reverseAttrsToRemove.length > 0) {
|
|
14700
|
+
reverseOp = TreeStyleOperation.createTreeRemoveStyleOperation(
|
|
14701
|
+
this.getParentCreatedAt(),
|
|
14702
|
+
this.fromPos,
|
|
14703
|
+
this.toPos,
|
|
14704
|
+
reverseAttrsToRemove,
|
|
14705
|
+
void 0
|
|
14706
|
+
);
|
|
14707
|
+
} else if (reversePrevAttributes.size > 0) {
|
|
14708
|
+
reverseOp = TreeStyleOperation.create(
|
|
14709
|
+
this.getParentCreatedAt(),
|
|
14710
|
+
this.fromPos,
|
|
14711
|
+
this.toPos,
|
|
14712
|
+
reversePrevAttributes,
|
|
14713
|
+
void 0
|
|
14714
|
+
);
|
|
14715
|
+
}
|
|
14428
14716
|
return {
|
|
14429
14717
|
opInfos: changes.map(({ from, to, value, fromPath, toPath }) => {
|
|
14430
14718
|
return {
|
|
@@ -14436,7 +14724,8 @@ class TreeStyleOperation extends Operation {
|
|
|
14436
14724
|
toPath,
|
|
14437
14725
|
path: root.createPath(this.getParentCreatedAt())
|
|
14438
14726
|
};
|
|
14439
|
-
})
|
|
14727
|
+
}),
|
|
14728
|
+
reverseOp
|
|
14440
14729
|
};
|
|
14441
14730
|
}
|
|
14442
14731
|
/**
|
|
@@ -14657,6 +14946,8 @@ function toCounterType(valueType) {
|
|
|
14657
14946
|
return ValueType.INTEGER_CNT;
|
|
14658
14947
|
case CounterType.Long:
|
|
14659
14948
|
return ValueType.LONG_CNT;
|
|
14949
|
+
case CounterType.IntDedup:
|
|
14950
|
+
return ValueType.INTEGER_DEDUP_CNT;
|
|
14660
14951
|
default:
|
|
14661
14952
|
throw new YorkieError(
|
|
14662
14953
|
Code.ErrInvalidType,
|
|
@@ -14829,6 +15120,7 @@ function toOperation(operation) {
|
|
|
14829
15120
|
pbIncreaseOperation.executedAt = toTimeTicket(
|
|
14830
15121
|
increaseOperation.getExecutedAt()
|
|
14831
15122
|
);
|
|
15123
|
+
pbIncreaseOperation.actor = increaseOperation.getActor();
|
|
14832
15124
|
pbOperation.body.case = "increase";
|
|
14833
15125
|
pbOperation.body.value = pbIncreaseOperation;
|
|
14834
15126
|
} else if (operation instanceof TreeEditOperation) {
|
|
@@ -14929,14 +15221,26 @@ function toRHTNodes(rht) {
|
|
|
14929
15221
|
}
|
|
14930
15222
|
return pbRHTNodes;
|
|
14931
15223
|
}
|
|
14932
|
-
function toRGANodes(
|
|
15224
|
+
function toRGANodes(arr) {
|
|
14933
15225
|
const pbRGANodes = [];
|
|
14934
|
-
for (const
|
|
14935
|
-
|
|
14936
|
-
|
|
14937
|
-
|
|
14938
|
-
|
|
14939
|
-
|
|
15226
|
+
for (const rgaNode of arr.getAllRGANodes()) {
|
|
15227
|
+
if (!rgaNode.getElementEntry()) {
|
|
15228
|
+
pbRGANodes.push(
|
|
15229
|
+
create(RGANodeSchema, {
|
|
15230
|
+
positionCreatedAt: toTimeTicket(rgaNode.getPositionCreatedAt()),
|
|
15231
|
+
positionRemovedAt: toTimeTicket(rgaNode.getRemovedAt())
|
|
15232
|
+
})
|
|
15233
|
+
);
|
|
15234
|
+
continue;
|
|
15235
|
+
}
|
|
15236
|
+
const pbNode = create(RGANodeSchema, {
|
|
15237
|
+
element: toElement(rgaNode.getValue())
|
|
15238
|
+
});
|
|
15239
|
+
if (rgaNode.getPositionMovedAt()) {
|
|
15240
|
+
pbNode.positionMovedAt = toTimeTicket(rgaNode.getPositionMovedAt());
|
|
15241
|
+
pbNode.positionCreatedAt = toTimeTicket(rgaNode.getPositionCreatedAt());
|
|
15242
|
+
}
|
|
15243
|
+
pbRGANodes.push(pbNode);
|
|
14940
15244
|
}
|
|
14941
15245
|
return pbRGANodes;
|
|
14942
15246
|
}
|
|
@@ -15036,7 +15340,7 @@ function toArray(arr) {
|
|
|
15036
15340
|
body: {
|
|
15037
15341
|
case: "jsonArray",
|
|
15038
15342
|
value: create(JSONElement_JSONArraySchema, {
|
|
15039
|
-
nodes: toRGANodes(arr
|
|
15343
|
+
nodes: toRGANodes(arr),
|
|
15040
15344
|
createdAt: toTimeTicket(arr.getCreatedAt()),
|
|
15041
15345
|
movedAt: toTimeTicket(arr.getMovedAt()),
|
|
15042
15346
|
removedAt: toTimeTicket(arr.getRemovedAt())
|
|
@@ -15080,7 +15384,8 @@ function toCounter(counter) {
|
|
|
15080
15384
|
value: counter.toBytes(),
|
|
15081
15385
|
createdAt: toTimeTicket(counter.getCreatedAt()),
|
|
15082
15386
|
movedAt: toTimeTicket(counter.getMovedAt()),
|
|
15083
|
-
removedAt: toTimeTicket(counter.getRemovedAt())
|
|
15387
|
+
removedAt: toTimeTicket(counter.getRemovedAt()),
|
|
15388
|
+
hllRegisters: counter.hllBytes() || new Uint8Array()
|
|
15084
15389
|
})
|
|
15085
15390
|
}
|
|
15086
15391
|
});
|
|
@@ -15244,6 +15549,8 @@ function fromCounterType(pbValueType) {
|
|
|
15244
15549
|
return CounterType.Int;
|
|
15245
15550
|
case ValueType.LONG_CNT:
|
|
15246
15551
|
return CounterType.Long;
|
|
15552
|
+
case ValueType.INTEGER_DEDUP_CNT:
|
|
15553
|
+
return CounterType.IntDedup;
|
|
15247
15554
|
}
|
|
15248
15555
|
throw new YorkieError(
|
|
15249
15556
|
Code.ErrUnimplemented,
|
|
@@ -15286,6 +15593,7 @@ function fromElementSimple(pbElementSimple) {
|
|
|
15286
15593
|
);
|
|
15287
15594
|
case ValueType.INTEGER_CNT:
|
|
15288
15595
|
case ValueType.LONG_CNT:
|
|
15596
|
+
case ValueType.INTEGER_DEDUP_CNT:
|
|
15289
15597
|
return CRDTCounter.create(
|
|
15290
15598
|
fromCounterType(pbElementSimple.type),
|
|
15291
15599
|
CRDTCounter.valueFromBytes(
|
|
@@ -15468,7 +15776,8 @@ function fromOperation(pbOperation) {
|
|
|
15468
15776
|
return IncreaseOperation.create(
|
|
15469
15777
|
fromTimeTicket(pbIncreaseOperation.parentCreatedAt),
|
|
15470
15778
|
fromElementSimple(pbIncreaseOperation.value),
|
|
15471
|
-
fromTimeTicket(pbIncreaseOperation.executedAt)
|
|
15779
|
+
fromTimeTicket(pbIncreaseOperation.executedAt),
|
|
15780
|
+
pbIncreaseOperation.actor || void 0
|
|
15472
15781
|
);
|
|
15473
15782
|
} else if (pbOperation.body.case === "treeEdit") {
|
|
15474
15783
|
const pbTreeEditOperation = pbOperation.body.value;
|
|
@@ -15569,7 +15878,32 @@ function fromObject(pbObject) {
|
|
|
15569
15878
|
function fromArray(pbArray) {
|
|
15570
15879
|
const rgaTreeList = new RGATreeList();
|
|
15571
15880
|
for (const pbRGANode of pbArray.nodes) {
|
|
15572
|
-
|
|
15881
|
+
if (!pbRGANode.element) {
|
|
15882
|
+
if (!pbRGANode.positionCreatedAt || !pbRGANode.positionRemovedAt) {
|
|
15883
|
+
throw new YorkieError(
|
|
15884
|
+
Code.ErrInvalidArgument,
|
|
15885
|
+
"dead RGA position node missing position timestamps"
|
|
15886
|
+
);
|
|
15887
|
+
}
|
|
15888
|
+
const posCreatedAt = fromTimeTicket(pbRGANode.positionCreatedAt);
|
|
15889
|
+
const posRemovedAt = fromTimeTicket(pbRGANode.positionRemovedAt);
|
|
15890
|
+
rgaTreeList.addDeadPosition(posCreatedAt, posRemovedAt);
|
|
15891
|
+
continue;
|
|
15892
|
+
}
|
|
15893
|
+
const elem = fromElement(pbRGANode.element);
|
|
15894
|
+
const posMovedAt = fromTimeTicket(pbRGANode.positionMovedAt);
|
|
15895
|
+
if (posMovedAt) {
|
|
15896
|
+
if (!pbRGANode.positionCreatedAt) {
|
|
15897
|
+
throw new YorkieError(
|
|
15898
|
+
Code.ErrInvalidArgument,
|
|
15899
|
+
"moved RGA node missing position_created_at"
|
|
15900
|
+
);
|
|
15901
|
+
}
|
|
15902
|
+
const posCreatedAt = fromTimeTicket(pbRGANode.positionCreatedAt);
|
|
15903
|
+
rgaTreeList.addMovedElement(elem, posCreatedAt, posMovedAt);
|
|
15904
|
+
} else {
|
|
15905
|
+
rgaTreeList.insert(elem);
|
|
15906
|
+
}
|
|
15573
15907
|
}
|
|
15574
15908
|
const arr = new CRDTArray(fromTimeTicket(pbArray.createdAt), rgaTreeList);
|
|
15575
15909
|
arr.setMovedAt(fromTimeTicket(pbArray.movedAt));
|
|
@@ -15616,6 +15950,9 @@ function fromCounter(pbCounter) {
|
|
|
15616
15950
|
);
|
|
15617
15951
|
counter.setMovedAt(fromTimeTicket(pbCounter.movedAt));
|
|
15618
15952
|
counter.setRemovedAt(fromTimeTicket(pbCounter.removedAt));
|
|
15953
|
+
if (counter.isDedup() && pbCounter.hllRegisters.length > 0) {
|
|
15954
|
+
counter.restoreHLL(pbCounter.hllRegisters);
|
|
15955
|
+
}
|
|
15619
15956
|
return counter;
|
|
15620
15957
|
}
|
|
15621
15958
|
function fromTree(pbTree) {
|
|
@@ -16354,10 +16691,16 @@ class ArrayProxy {
|
|
|
16354
16691
|
};
|
|
16355
16692
|
} else if (method === "insertAfter") {
|
|
16356
16693
|
return (prevID, value) => {
|
|
16694
|
+
let posCreatedAt;
|
|
16695
|
+
try {
|
|
16696
|
+
posCreatedAt = target.posCreatedAt(prevID);
|
|
16697
|
+
} catch {
|
|
16698
|
+
posCreatedAt = prevID;
|
|
16699
|
+
}
|
|
16357
16700
|
const inserted = ArrayProxy.insertAfterInternal(
|
|
16358
16701
|
context,
|
|
16359
16702
|
target,
|
|
16360
|
-
|
|
16703
|
+
posCreatedAt,
|
|
16361
16704
|
value
|
|
16362
16705
|
);
|
|
16363
16706
|
return toWrappedElement(context, inserted);
|
|
@@ -16542,7 +16885,7 @@ class ArrayProxy {
|
|
|
16542
16885
|
static moveBeforeInternal(context, target, nextCreatedAt, createdAt) {
|
|
16543
16886
|
const ticket = context.issueTimeTicket();
|
|
16544
16887
|
const prevCreatedAt = target.getPrevCreatedAt(nextCreatedAt);
|
|
16545
|
-
target.moveAfter(prevCreatedAt, createdAt, ticket);
|
|
16888
|
+
const deadNode = target.moveAfter(prevCreatedAt, createdAt, ticket);
|
|
16546
16889
|
context.push(
|
|
16547
16890
|
MoveOperation.create(
|
|
16548
16891
|
target.getCreatedAt(),
|
|
@@ -16551,26 +16894,45 @@ class ArrayProxy {
|
|
|
16551
16894
|
ticket
|
|
16552
16895
|
)
|
|
16553
16896
|
);
|
|
16897
|
+
if (deadNode) {
|
|
16898
|
+
context.registerGCPair({
|
|
16899
|
+
parent: target.getRGATreeList(),
|
|
16900
|
+
child: deadNode
|
|
16901
|
+
});
|
|
16902
|
+
}
|
|
16554
16903
|
}
|
|
16555
16904
|
/**
|
|
16556
16905
|
* `moveAfterInternal` moves the given `createdAt` element
|
|
16557
|
-
* after the specific element.
|
|
16906
|
+
* after the specific element. Converts element identity to
|
|
16907
|
+
* position identity for the prevCreatedAt.
|
|
16558
16908
|
*/
|
|
16559
16909
|
static moveAfterInternal(context, target, prevCreatedAt, createdAt) {
|
|
16560
16910
|
const ticket = context.issueTimeTicket();
|
|
16911
|
+
let posCreatedAt;
|
|
16912
|
+
try {
|
|
16913
|
+
posCreatedAt = target.posCreatedAt(prevCreatedAt);
|
|
16914
|
+
} catch {
|
|
16915
|
+
posCreatedAt = prevCreatedAt;
|
|
16916
|
+
}
|
|
16917
|
+
const deadNode = target.moveAfter(posCreatedAt, createdAt, ticket);
|
|
16561
16918
|
context.push(
|
|
16562
16919
|
MoveOperation.create(
|
|
16563
16920
|
target.getCreatedAt(),
|
|
16564
|
-
|
|
16921
|
+
posCreatedAt,
|
|
16565
16922
|
createdAt,
|
|
16566
16923
|
ticket
|
|
16567
16924
|
)
|
|
16568
16925
|
);
|
|
16569
|
-
|
|
16926
|
+
if (deadNode) {
|
|
16927
|
+
context.registerGCPair({
|
|
16928
|
+
parent: target.getRGATreeList(),
|
|
16929
|
+
child: deadNode
|
|
16930
|
+
});
|
|
16931
|
+
}
|
|
16570
16932
|
}
|
|
16571
16933
|
/**
|
|
16572
|
-
* `moveAfterByIndexInternal` moves the given element to its new
|
|
16573
|
-
* after the given previous element.
|
|
16934
|
+
* `moveAfterByIndexInternal` moves the given element to its new
|
|
16935
|
+
* position after the given previous element.
|
|
16574
16936
|
*/
|
|
16575
16937
|
static moveAfterByIndexInternal(context, target, prevIndex, targetIndex) {
|
|
16576
16938
|
const prevElem = target.get(prevIndex);
|
|
@@ -16601,7 +16963,7 @@ class ArrayProxy {
|
|
|
16601
16963
|
static moveFrontInternal(context, target, createdAt) {
|
|
16602
16964
|
const ticket = context.issueTimeTicket();
|
|
16603
16965
|
const head = target.getHead();
|
|
16604
|
-
target.moveAfter(head.getCreatedAt(), createdAt, ticket);
|
|
16966
|
+
const deadNode = target.moveAfter(head.getCreatedAt(), createdAt, ticket);
|
|
16605
16967
|
context.push(
|
|
16606
16968
|
MoveOperation.create(
|
|
16607
16969
|
target.getCreatedAt(),
|
|
@@ -16610,6 +16972,12 @@ class ArrayProxy {
|
|
|
16610
16972
|
ticket
|
|
16611
16973
|
)
|
|
16612
16974
|
);
|
|
16975
|
+
if (deadNode) {
|
|
16976
|
+
context.registerGCPair({
|
|
16977
|
+
parent: target.getRGATreeList(),
|
|
16978
|
+
child: deadNode
|
|
16979
|
+
});
|
|
16980
|
+
}
|
|
16613
16981
|
}
|
|
16614
16982
|
/**
|
|
16615
16983
|
* `moveLastInternal` moves the given `createdAt` element
|
|
@@ -16618,13 +16986,20 @@ class ArrayProxy {
|
|
|
16618
16986
|
static moveLastInternal(context, target, createdAt) {
|
|
16619
16987
|
const ticket = context.issueTimeTicket();
|
|
16620
16988
|
const last = target.getLastCreatedAt();
|
|
16621
|
-
target.moveAfter(last, createdAt, ticket);
|
|
16989
|
+
const deadNode = target.moveAfter(last, createdAt, ticket);
|
|
16622
16990
|
context.push(
|
|
16623
16991
|
MoveOperation.create(target.getCreatedAt(), last, createdAt, ticket)
|
|
16624
16992
|
);
|
|
16993
|
+
if (deadNode) {
|
|
16994
|
+
context.registerGCPair({
|
|
16995
|
+
parent: target.getRGATreeList(),
|
|
16996
|
+
child: deadNode
|
|
16997
|
+
});
|
|
16998
|
+
}
|
|
16625
16999
|
}
|
|
16626
17000
|
/**
|
|
16627
|
-
* `insertAfterInternal` inserts the value after the previously
|
|
17001
|
+
* `insertAfterInternal` inserts the value after the previously
|
|
17002
|
+
* created element.
|
|
16628
17003
|
*/
|
|
16629
17004
|
static insertAfterInternal(context, target, prevCreatedAt, value) {
|
|
16630
17005
|
const createdAt = context.issueTimeTicket();
|
|
@@ -16652,12 +17027,13 @@ class ArrayProxy {
|
|
|
16652
17027
|
`index out of bounds: ${index}`
|
|
16653
17028
|
);
|
|
16654
17029
|
}
|
|
16655
|
-
|
|
16656
|
-
|
|
16657
|
-
target
|
|
16658
|
-
|
|
16659
|
-
|
|
16660
|
-
|
|
17030
|
+
let posCreatedAt;
|
|
17031
|
+
try {
|
|
17032
|
+
posCreatedAt = target.posCreatedAt(prevElem.getCreatedAt());
|
|
17033
|
+
} catch {
|
|
17034
|
+
posCreatedAt = prevElem.getCreatedAt();
|
|
17035
|
+
}
|
|
17036
|
+
ArrayProxy.insertAfterInternal(context, target, posCreatedAt, value);
|
|
16661
17037
|
return target;
|
|
16662
17038
|
}
|
|
16663
17039
|
/**
|
|
@@ -16756,7 +17132,17 @@ class ArrayProxy {
|
|
|
16756
17132
|
}
|
|
16757
17133
|
}
|
|
16758
17134
|
if (items) {
|
|
16759
|
-
let previousID
|
|
17135
|
+
let previousID;
|
|
17136
|
+
if (from === 0) {
|
|
17137
|
+
previousID = target.getHead().getID();
|
|
17138
|
+
} else {
|
|
17139
|
+
const elemID = target.get(from - 1).getID();
|
|
17140
|
+
try {
|
|
17141
|
+
previousID = target.posCreatedAt(elemID);
|
|
17142
|
+
} catch {
|
|
17143
|
+
previousID = elemID;
|
|
17144
|
+
}
|
|
17145
|
+
}
|
|
16760
17146
|
for (const item of items) {
|
|
16761
17147
|
const newElem = ArrayProxy.insertAfterInternal(
|
|
16762
17148
|
context,
|
|
@@ -17085,7 +17471,7 @@ class Text {
|
|
|
17085
17471
|
return this.text.indexRangeToPosRange(fromIdx, toIdx);
|
|
17086
17472
|
}
|
|
17087
17473
|
}
|
|
17088
|
-
class
|
|
17474
|
+
class BaseCounter {
|
|
17089
17475
|
valueType;
|
|
17090
17476
|
value;
|
|
17091
17477
|
context;
|
|
@@ -17095,7 +17481,7 @@ class Counter {
|
|
|
17095
17481
|
this.value = value;
|
|
17096
17482
|
}
|
|
17097
17483
|
/**
|
|
17098
|
-
* `initialize`
|
|
17484
|
+
* `initialize` links this proxy to a ChangeContext and CRDTCounter.
|
|
17099
17485
|
*/
|
|
17100
17486
|
initialize(context, counter) {
|
|
17101
17487
|
this.valueType = counter.getValueType();
|
|
@@ -17104,17 +17490,11 @@ class Counter {
|
|
|
17104
17490
|
this.value = counter.getValue();
|
|
17105
17491
|
}
|
|
17106
17492
|
/**
|
|
17107
|
-
* `getID` returns the ID of this
|
|
17493
|
+
* `getID` returns the ID of this counter.
|
|
17108
17494
|
*/
|
|
17109
17495
|
getID() {
|
|
17110
17496
|
return this.counter.getID();
|
|
17111
17497
|
}
|
|
17112
|
-
/**
|
|
17113
|
-
* `getValue` returns the value of this counter;
|
|
17114
|
-
*/
|
|
17115
|
-
getValue() {
|
|
17116
|
-
return this.value;
|
|
17117
|
-
}
|
|
17118
17498
|
/**
|
|
17119
17499
|
* `getValueType` returns the value type of this counter.
|
|
17120
17500
|
*/
|
|
@@ -17122,15 +17502,45 @@ class Counter {
|
|
|
17122
17502
|
return this.valueType;
|
|
17123
17503
|
}
|
|
17124
17504
|
/**
|
|
17125
|
-
* `
|
|
17505
|
+
* `toJSForTest` returns value with meta data for testing.
|
|
17126
17506
|
*/
|
|
17127
|
-
|
|
17507
|
+
toJSForTest() {
|
|
17128
17508
|
if (!this.context || !this.counter) {
|
|
17129
17509
|
throw new YorkieError(
|
|
17130
17510
|
Code.ErrNotInitialized,
|
|
17131
17511
|
"Counter is not initialized yet"
|
|
17132
17512
|
);
|
|
17133
17513
|
}
|
|
17514
|
+
return this.counter.toJSForTest();
|
|
17515
|
+
}
|
|
17516
|
+
/**
|
|
17517
|
+
* `ensureInitialized` throws if this counter has not been initialized.
|
|
17518
|
+
*/
|
|
17519
|
+
ensureInitialized() {
|
|
17520
|
+
if (!this.context || !this.counter) {
|
|
17521
|
+
throw new YorkieError(
|
|
17522
|
+
Code.ErrNotInitialized,
|
|
17523
|
+
"Counter is not initialized yet"
|
|
17524
|
+
);
|
|
17525
|
+
}
|
|
17526
|
+
}
|
|
17527
|
+
}
|
|
17528
|
+
class Counter extends BaseCounter {
|
|
17529
|
+
constructor(value) {
|
|
17530
|
+
const type = typeof value === "bigint" ? CounterType.Long : CounterType.Int;
|
|
17531
|
+
super(type, value);
|
|
17532
|
+
}
|
|
17533
|
+
/**
|
|
17534
|
+
* `getValue` returns the value of this counter.
|
|
17535
|
+
*/
|
|
17536
|
+
getValue() {
|
|
17537
|
+
return this.value;
|
|
17538
|
+
}
|
|
17539
|
+
/**
|
|
17540
|
+
* `increase` increases numeric data.
|
|
17541
|
+
*/
|
|
17542
|
+
increase(v) {
|
|
17543
|
+
this.ensureInitialized();
|
|
17134
17544
|
const ticket = this.context.issueTimeTicket();
|
|
17135
17545
|
const value = Primitive.of(v, ticket);
|
|
17136
17546
|
if (!value.isNumericType()) {
|
|
@@ -17144,19 +17554,44 @@ class Counter {
|
|
|
17144
17554
|
);
|
|
17145
17555
|
return this;
|
|
17146
17556
|
}
|
|
17557
|
+
}
|
|
17558
|
+
class DedupCounter extends BaseCounter {
|
|
17559
|
+
constructor() {
|
|
17560
|
+
super(CounterType.IntDedup, 0);
|
|
17561
|
+
}
|
|
17147
17562
|
/**
|
|
17148
|
-
* `
|
|
17563
|
+
* `getValue` returns the value of this counter. Always a number since
|
|
17564
|
+
* DedupCounter only supports IntDedup.
|
|
17149
17565
|
*/
|
|
17150
|
-
|
|
17151
|
-
|
|
17152
|
-
|
|
17153
|
-
|
|
17154
|
-
|
|
17155
|
-
|
|
17566
|
+
getValue() {
|
|
17567
|
+
return this.value;
|
|
17568
|
+
}
|
|
17569
|
+
/**
|
|
17570
|
+
* `add` records a unique actor in the dedup counter. If the actor has
|
|
17571
|
+
* already been counted, the call is ignored.
|
|
17572
|
+
*/
|
|
17573
|
+
add(actor) {
|
|
17574
|
+
this.ensureInitialized();
|
|
17575
|
+
if (!actor) {
|
|
17576
|
+
throw new YorkieError(Code.ErrInvalidArgument, "actor is required");
|
|
17156
17577
|
}
|
|
17157
|
-
|
|
17578
|
+
const ticket = this.context.issueTimeTicket();
|
|
17579
|
+
const value = Primitive.of(1, ticket);
|
|
17580
|
+
this.counter.increaseDedup(value, actor);
|
|
17581
|
+
this.context.push(
|
|
17582
|
+
IncreaseOperation.create(
|
|
17583
|
+
this.counter.getCreatedAt(),
|
|
17584
|
+
value,
|
|
17585
|
+
ticket,
|
|
17586
|
+
actor
|
|
17587
|
+
)
|
|
17588
|
+
);
|
|
17589
|
+
return this;
|
|
17158
17590
|
}
|
|
17159
17591
|
}
|
|
17592
|
+
function isCounter$1(value) {
|
|
17593
|
+
return value instanceof Counter || value instanceof DedupCounter;
|
|
17594
|
+
}
|
|
17160
17595
|
function toTreeNode(node) {
|
|
17161
17596
|
if (node.isText) {
|
|
17162
17597
|
return {
|
|
@@ -17960,7 +18395,12 @@ function toWrappedElement(context, elem) {
|
|
|
17960
18395
|
} else if (elem instanceof CRDTText) {
|
|
17961
18396
|
return new Text(context, elem);
|
|
17962
18397
|
} else if (elem instanceof CRDTCounter) {
|
|
17963
|
-
|
|
18398
|
+
if (elem.isDedup()) {
|
|
18399
|
+
const counter2 = new DedupCounter();
|
|
18400
|
+
counter2.initialize(context, elem);
|
|
18401
|
+
return counter2;
|
|
18402
|
+
}
|
|
18403
|
+
const counter = new Counter(0);
|
|
17964
18404
|
counter.initialize(context, elem);
|
|
17965
18405
|
return counter;
|
|
17966
18406
|
} else if (elem instanceof CRDTTree) {
|
|
@@ -17990,7 +18430,7 @@ function buildCRDTElement(context, value, createdAt) {
|
|
|
17990
18430
|
if (value instanceof Text) {
|
|
17991
18431
|
element = CRDTText.create(RGATreeSplit.create(), createdAt);
|
|
17992
18432
|
value.initialize(context, element);
|
|
17993
|
-
} else if (value
|
|
18433
|
+
} else if (isCounter$1(value)) {
|
|
17994
18434
|
element = CRDTCounter.create(
|
|
17995
18435
|
value.getValueType(),
|
|
17996
18436
|
value.getValue(),
|
|
@@ -18052,6 +18492,16 @@ class CRDTRoot {
|
|
|
18052
18492
|
this.registerGCPair(pair);
|
|
18053
18493
|
}
|
|
18054
18494
|
}
|
|
18495
|
+
if (elem instanceof CRDTArray) {
|
|
18496
|
+
for (const node of elem.getAllRGANodes()) {
|
|
18497
|
+
if (!node.getElementEntry() && node.getRemovedAt()) {
|
|
18498
|
+
this.registerGCPair({
|
|
18499
|
+
parent: elem.getRGATreeList(),
|
|
18500
|
+
child: node
|
|
18501
|
+
});
|
|
18502
|
+
}
|
|
18503
|
+
}
|
|
18504
|
+
}
|
|
18055
18505
|
return false;
|
|
18056
18506
|
});
|
|
18057
18507
|
}
|
|
@@ -19143,6 +19593,11 @@ class Document {
|
|
|
19143
19593
|
if (logger.isEnabled(LogLevel.Trivial)) {
|
|
19144
19594
|
logger.trivial(`trying to update a local change: ${this.toJSON()}`);
|
|
19145
19595
|
}
|
|
19596
|
+
const prev = {
|
|
19597
|
+
hadPresence: this.presences.has(actorID),
|
|
19598
|
+
wasOnline: this.status === "attached",
|
|
19599
|
+
presence: this.presences.has(actorID) ? deepcopy(this.presences.get(actorID)) : void 0
|
|
19600
|
+
};
|
|
19146
19601
|
const change = ctx.toChange();
|
|
19147
19602
|
const { opInfos, reverseOps } = change.execute(
|
|
19148
19603
|
this.root,
|
|
@@ -19188,14 +19643,14 @@ class Document {
|
|
|
19188
19643
|
});
|
|
19189
19644
|
}
|
|
19190
19645
|
if (change.hasPresenceChange()) {
|
|
19191
|
-
|
|
19192
|
-
|
|
19193
|
-
|
|
19194
|
-
|
|
19195
|
-
|
|
19196
|
-
|
|
19197
|
-
|
|
19198
|
-
}
|
|
19646
|
+
const presenceEvent = this.reconcilePresence(
|
|
19647
|
+
actorID,
|
|
19648
|
+
prev,
|
|
19649
|
+
OpSource.Local
|
|
19650
|
+
);
|
|
19651
|
+
if (presenceEvent) {
|
|
19652
|
+
event.push(presenceEvent);
|
|
19653
|
+
}
|
|
19199
19654
|
}
|
|
19200
19655
|
this.publish(event);
|
|
19201
19656
|
if (logger.isEnabled(LogLevel.Trivial)) {
|
|
@@ -19679,41 +20134,11 @@ class Document {
|
|
|
19679
20134
|
change.execute(this.clone.root, this.clone.presences, source);
|
|
19680
20135
|
const events = [];
|
|
19681
20136
|
const actorID = change.getID().getActorID();
|
|
19682
|
-
|
|
19683
|
-
|
|
19684
|
-
|
|
19685
|
-
|
|
19686
|
-
|
|
19687
|
-
this.presences.has(actorID) ? {
|
|
19688
|
-
type: "presence-changed",
|
|
19689
|
-
source,
|
|
19690
|
-
value: {
|
|
19691
|
-
clientID: actorID,
|
|
19692
|
-
presence: presenceChange.presence
|
|
19693
|
-
}
|
|
19694
|
-
} : {
|
|
19695
|
-
type: "watched",
|
|
19696
|
-
source: OpSource.Remote,
|
|
19697
|
-
value: {
|
|
19698
|
-
clientID: actorID,
|
|
19699
|
-
presence: presenceChange.presence
|
|
19700
|
-
}
|
|
19701
|
-
}
|
|
19702
|
-
);
|
|
19703
|
-
break;
|
|
19704
|
-
case PresenceChangeType.Clear:
|
|
19705
|
-
events.push({
|
|
19706
|
-
type: "unwatched",
|
|
19707
|
-
source: OpSource.Remote,
|
|
19708
|
-
value: {
|
|
19709
|
-
clientID: actorID,
|
|
19710
|
-
presence: this.getPresence(actorID)
|
|
19711
|
-
}
|
|
19712
|
-
});
|
|
19713
|
-
this.removeOnlineClient(actorID);
|
|
19714
|
-
break;
|
|
19715
|
-
}
|
|
19716
|
-
}
|
|
20137
|
+
const prev = change.hasPresenceChange() ? {
|
|
20138
|
+
hadPresence: this.presences.has(actorID),
|
|
20139
|
+
wasOnline: this.onlineClients.has(actorID),
|
|
20140
|
+
presence: this.presences.has(actorID) ? deepcopy(this.presences.get(actorID)) : void 0
|
|
20141
|
+
} : void 0;
|
|
19717
20142
|
const { opInfos, operations } = change.execute(
|
|
19718
20143
|
this.root,
|
|
19719
20144
|
this.presences,
|
|
@@ -19768,6 +20193,16 @@ class Document {
|
|
|
19768
20193
|
}
|
|
19769
20194
|
);
|
|
19770
20195
|
}
|
|
20196
|
+
if (prev && change.hasPresenceChange()) {
|
|
20197
|
+
const presenceChange = change.getPresenceChange();
|
|
20198
|
+
if (presenceChange.type === PresenceChangeType.Clear) {
|
|
20199
|
+
this.removeOnlineClient(actorID);
|
|
20200
|
+
}
|
|
20201
|
+
const presenceEvent = this.reconcilePresence(actorID, prev, source);
|
|
20202
|
+
if (presenceEvent) {
|
|
20203
|
+
events.push(presenceEvent);
|
|
20204
|
+
}
|
|
20205
|
+
}
|
|
19771
20206
|
if (events.length) {
|
|
19772
20207
|
this.publish(events);
|
|
19773
20208
|
}
|
|
@@ -19796,46 +20231,43 @@ class Document {
|
|
|
19796
20231
|
* `applyDocEvent` applies the given doc event into this document.
|
|
19797
20232
|
*/
|
|
19798
20233
|
applyDocEvent(type, publisher) {
|
|
19799
|
-
const
|
|
20234
|
+
const prev = {
|
|
20235
|
+
hadPresence: this.presences.has(publisher),
|
|
20236
|
+
wasOnline: this.onlineClients.has(publisher),
|
|
20237
|
+
presence: this.presences.has(publisher) ? deepcopy(this.presences.get(publisher)) : void 0
|
|
20238
|
+
};
|
|
19800
20239
|
if (type === DocEventType$1.DOCUMENT_WATCHED) {
|
|
19801
20240
|
if (this.onlineClients.has(publisher) && this.hasPresence(publisher)) {
|
|
19802
20241
|
return;
|
|
19803
20242
|
}
|
|
19804
20243
|
this.addOnlineClient(publisher);
|
|
19805
|
-
if (this.hasPresence(publisher)) {
|
|
19806
|
-
events.push({
|
|
19807
|
-
type: "watched",
|
|
19808
|
-
source: OpSource.Remote,
|
|
19809
|
-
value: {
|
|
19810
|
-
clientID: publisher,
|
|
19811
|
-
presence: this.getPresence(publisher)
|
|
19812
|
-
}
|
|
19813
|
-
});
|
|
19814
|
-
}
|
|
19815
20244
|
} else if (type === DocEventType$1.DOCUMENT_UNWATCHED) {
|
|
19816
|
-
const presence = this.getPresence(publisher);
|
|
19817
20245
|
this.removeOnlineClient(publisher);
|
|
19818
20246
|
this.presences.delete(publisher);
|
|
19819
|
-
if (presence) {
|
|
19820
|
-
events.push({
|
|
19821
|
-
type: "unwatched",
|
|
19822
|
-
source: OpSource.Remote,
|
|
19823
|
-
value: { clientID: publisher, presence }
|
|
19824
|
-
});
|
|
19825
|
-
}
|
|
19826
20247
|
}
|
|
19827
|
-
|
|
19828
|
-
|
|
20248
|
+
const event = this.reconcilePresence(publisher, prev, OpSource.Remote);
|
|
20249
|
+
if (event) {
|
|
20250
|
+
this.publish([event]);
|
|
19829
20251
|
}
|
|
19830
20252
|
}
|
|
19831
20253
|
/**
|
|
19832
20254
|
* `applyStatus` applies the document status into this document.
|
|
19833
20255
|
*/
|
|
19834
20256
|
applyStatus(status) {
|
|
20257
|
+
const actorID = this.changeID.getActorID();
|
|
20258
|
+
const prev = {
|
|
20259
|
+
hadPresence: this.presences.has(actorID),
|
|
20260
|
+
wasOnline: this.status === "attached",
|
|
20261
|
+
presence: this.presences.has(actorID) ? deepcopy(this.presences.get(actorID)) : void 0
|
|
20262
|
+
};
|
|
19835
20263
|
this.status = status;
|
|
19836
20264
|
if (status === "detached") {
|
|
19837
20265
|
this.setActor(InitialActorID);
|
|
19838
20266
|
}
|
|
20267
|
+
const event = this.reconcilePresence(actorID, prev, OpSource.Local);
|
|
20268
|
+
if (event) {
|
|
20269
|
+
this.publish([event]);
|
|
20270
|
+
}
|
|
19839
20271
|
this.publish([
|
|
19840
20272
|
{
|
|
19841
20273
|
source: status === "removed" ? OpSource.Remote : OpSource.Local,
|
|
@@ -19935,6 +20367,57 @@ class Document {
|
|
|
19935
20367
|
removeOnlineClient(clientID) {
|
|
19936
20368
|
this.onlineClients.delete(clientID);
|
|
19937
20369
|
}
|
|
20370
|
+
/**
|
|
20371
|
+
* `reconcilePresence` compares the previous and current state of a client's
|
|
20372
|
+
* presence/online status and returns the appropriate event to emit.
|
|
20373
|
+
*
|
|
20374
|
+
* For remote clients, "online" means the client is in onlineClients.
|
|
20375
|
+
* For self, "online" means the document status is Attached.
|
|
20376
|
+
*
|
|
20377
|
+
* State transition table:
|
|
20378
|
+
* (!hadP || !wasOn) → (hasP && isOn) : watched (remote) or presence-changed (self)
|
|
20379
|
+
* (hadP && wasOn) → (hasP && isOn) : presence-changed
|
|
20380
|
+
* (hadP && wasOn) → (!hasP || !isOn): unwatched (remote only)
|
|
20381
|
+
* otherwise : no event (waiting)
|
|
20382
|
+
*/
|
|
20383
|
+
reconcilePresence(actorID, prev, source) {
|
|
20384
|
+
const isSelf = actorID === this.changeID.getActorID();
|
|
20385
|
+
const hasPresence = this.presences.has(actorID);
|
|
20386
|
+
const isOnline = isSelf ? this.status === "attached" : this.onlineClients.has(actorID);
|
|
20387
|
+
if (!hasPresence || !isOnline) {
|
|
20388
|
+
if (prev.hadPresence && prev.wasOnline && !isSelf) {
|
|
20389
|
+
return {
|
|
20390
|
+
type: "unwatched",
|
|
20391
|
+
source: OpSource.Remote,
|
|
20392
|
+
value: {
|
|
20393
|
+
clientID: actorID,
|
|
20394
|
+
presence: prev.presence
|
|
20395
|
+
}
|
|
20396
|
+
};
|
|
20397
|
+
}
|
|
20398
|
+
return void 0;
|
|
20399
|
+
}
|
|
20400
|
+
const presence = deepcopy(this.presences.get(actorID));
|
|
20401
|
+
if (!prev.hadPresence || !prev.wasOnline) {
|
|
20402
|
+
if (isSelf) {
|
|
20403
|
+
return {
|
|
20404
|
+
type: "presence-changed",
|
|
20405
|
+
source,
|
|
20406
|
+
value: { clientID: actorID, presence }
|
|
20407
|
+
};
|
|
20408
|
+
}
|
|
20409
|
+
return {
|
|
20410
|
+
type: "watched",
|
|
20411
|
+
source: OpSource.Remote,
|
|
20412
|
+
value: { clientID: actorID, presence }
|
|
20413
|
+
};
|
|
20414
|
+
}
|
|
20415
|
+
return {
|
|
20416
|
+
type: "presence-changed",
|
|
20417
|
+
source,
|
|
20418
|
+
value: { clientID: actorID, presence }
|
|
20419
|
+
};
|
|
20420
|
+
}
|
|
19938
20421
|
/**
|
|
19939
20422
|
* `hasPresence` returns whether the given clientID has a presence or not.
|
|
19940
20423
|
*/
|
|
@@ -20096,18 +20579,24 @@ class Document {
|
|
|
20096
20579
|
const ticket = ctx.issueTimeTicket();
|
|
20097
20580
|
op.setExecutedAt(ticket);
|
|
20098
20581
|
if (op instanceof ArraySetOperation) {
|
|
20099
|
-
const
|
|
20582
|
+
const prev2 = op.getCreatedAt();
|
|
20100
20583
|
op.getValue().setCreatedAt(ticket);
|
|
20101
|
-
this.internalHistory.reconcileCreatedAt(
|
|
20584
|
+
this.internalHistory.reconcileCreatedAt(prev2, ticket);
|
|
20102
20585
|
} else if (op instanceof AddOperation) {
|
|
20103
|
-
const
|
|
20586
|
+
const prev2 = op.getValue().getCreatedAt();
|
|
20104
20587
|
op.getValue().setCreatedAt(ticket);
|
|
20105
|
-
this.internalHistory.reconcileCreatedAt(
|
|
20588
|
+
this.internalHistory.reconcileCreatedAt(prev2, ticket);
|
|
20106
20589
|
}
|
|
20107
20590
|
ctx.push(op);
|
|
20108
20591
|
}
|
|
20109
20592
|
const change = ctx.toChange();
|
|
20110
20593
|
change.execute(this.clone.root, this.clone.presences, OpSource.UndoRedo);
|
|
20594
|
+
const actorID = this.changeID.getActorID();
|
|
20595
|
+
const prev = {
|
|
20596
|
+
hadPresence: this.presences.has(actorID),
|
|
20597
|
+
wasOnline: this.status === "attached",
|
|
20598
|
+
presence: this.presences.has(actorID) ? deepcopy(this.presences.get(actorID)) : void 0
|
|
20599
|
+
};
|
|
20111
20600
|
const { opInfos, reverseOps } = change.execute(
|
|
20112
20601
|
this.root,
|
|
20113
20602
|
this.presences,
|
|
@@ -20129,7 +20618,6 @@ class Document {
|
|
|
20129
20618
|
}
|
|
20130
20619
|
this.localChanges.push(change);
|
|
20131
20620
|
this.changeID = ctx.getNextID();
|
|
20132
|
-
const actorID = this.changeID.getActorID();
|
|
20133
20621
|
const events = [];
|
|
20134
20622
|
if (opInfos.length) {
|
|
20135
20623
|
events.push({
|
|
@@ -20146,14 +20634,14 @@ class Document {
|
|
|
20146
20634
|
});
|
|
20147
20635
|
}
|
|
20148
20636
|
if (change.hasPresenceChange()) {
|
|
20149
|
-
|
|
20150
|
-
|
|
20151
|
-
|
|
20152
|
-
|
|
20153
|
-
|
|
20154
|
-
|
|
20155
|
-
|
|
20156
|
-
}
|
|
20637
|
+
const presenceEvent = this.reconcilePresence(
|
|
20638
|
+
actorID,
|
|
20639
|
+
prev,
|
|
20640
|
+
OpSource.UndoRedo
|
|
20641
|
+
);
|
|
20642
|
+
if (presenceEvent) {
|
|
20643
|
+
events.push(presenceEvent);
|
|
20644
|
+
}
|
|
20157
20645
|
}
|
|
20158
20646
|
this.publish(events);
|
|
20159
20647
|
}
|
|
@@ -20169,6 +20657,8 @@ class Attachment {
|
|
|
20169
20657
|
watchStream;
|
|
20170
20658
|
watchLoopTimerID;
|
|
20171
20659
|
watchAbortController;
|
|
20660
|
+
syncPromise;
|
|
20661
|
+
_detaching = false;
|
|
20172
20662
|
constructor(reconnectStreamDelay, resource, resourceID, syncMode) {
|
|
20173
20663
|
this.reconnectStreamDelay = reconnectStreamDelay;
|
|
20174
20664
|
this.resource = resource;
|
|
@@ -20244,6 +20734,49 @@ class Attachment {
|
|
|
20244
20734
|
};
|
|
20245
20735
|
await doLoop();
|
|
20246
20736
|
}
|
|
20737
|
+
/**
|
|
20738
|
+
* `markDetaching` marks this attachment as being in the process of detaching.
|
|
20739
|
+
* Once marked, the sync loop will skip this attachment.
|
|
20740
|
+
*/
|
|
20741
|
+
markDetaching() {
|
|
20742
|
+
this._detaching = true;
|
|
20743
|
+
}
|
|
20744
|
+
/**
|
|
20745
|
+
* `isDetaching` returns whether this attachment is being detached.
|
|
20746
|
+
*/
|
|
20747
|
+
isDetaching() {
|
|
20748
|
+
return this._detaching;
|
|
20749
|
+
}
|
|
20750
|
+
/**
|
|
20751
|
+
* `resetDetaching` resets the detaching flag so the attachment can resume
|
|
20752
|
+
* syncing. Used when a detach RPC fails and the document remains attached.
|
|
20753
|
+
*/
|
|
20754
|
+
resetDetaching() {
|
|
20755
|
+
this._detaching = false;
|
|
20756
|
+
}
|
|
20757
|
+
/**
|
|
20758
|
+
* `setSyncPromise` sets the in-progress sync promise for this attachment.
|
|
20759
|
+
*/
|
|
20760
|
+
setSyncPromise(promise) {
|
|
20761
|
+
this.syncPromise = promise;
|
|
20762
|
+
}
|
|
20763
|
+
/**
|
|
20764
|
+
* `clearSyncPromise` clears the in-progress sync promise.
|
|
20765
|
+
*/
|
|
20766
|
+
clearSyncPromise() {
|
|
20767
|
+
this.syncPromise = void 0;
|
|
20768
|
+
}
|
|
20769
|
+
/**
|
|
20770
|
+
* `waitForSyncComplete` waits for any in-progress sync to complete.
|
|
20771
|
+
*/
|
|
20772
|
+
async waitForSyncComplete() {
|
|
20773
|
+
if (this.syncPromise) {
|
|
20774
|
+
try {
|
|
20775
|
+
await this.syncPromise;
|
|
20776
|
+
} catch {
|
|
20777
|
+
}
|
|
20778
|
+
}
|
|
20779
|
+
}
|
|
20247
20780
|
/**
|
|
20248
20781
|
* `cancelWatchStream` cancels the watch stream.
|
|
20249
20782
|
*/
|
|
@@ -20278,7 +20811,7 @@ function createAuthInterceptor(apiKey, token) {
|
|
|
20278
20811
|
};
|
|
20279
20812
|
}
|
|
20280
20813
|
const name = "@yorkie-js/sdk";
|
|
20281
|
-
const version = "0.7.
|
|
20814
|
+
const version = "0.7.6";
|
|
20282
20815
|
const pkg = {
|
|
20283
20816
|
name,
|
|
20284
20817
|
version
|
|
@@ -20603,6 +21136,7 @@ class Client {
|
|
|
20603
21136
|
taskQueue;
|
|
20604
21137
|
processing = false;
|
|
20605
21138
|
keepalive = false;
|
|
21139
|
+
deactivating = false;
|
|
20606
21140
|
/**
|
|
20607
21141
|
* @param rpcAddr - the address of the RPC server.
|
|
20608
21142
|
* @param opts - the options of the client.
|
|
@@ -20632,21 +21166,19 @@ class Client {
|
|
|
20632
21166
|
this.channelHeartbeatInterval = opts.channelHeartbeatInterval ?? DefaultClientOptions.channelHeartbeatInterval;
|
|
20633
21167
|
const { authInterceptor, setToken } = createAuthInterceptor(this.apiKey);
|
|
20634
21168
|
this.setAuthToken = setToken;
|
|
21169
|
+
const transportOptions = {
|
|
21170
|
+
baseUrl: rpcAddr,
|
|
21171
|
+
interceptors: [authInterceptor, createMetricInterceptor(opts?.userAgent)],
|
|
21172
|
+
fetch: (input, init) => {
|
|
21173
|
+
return fetch(input, {
|
|
21174
|
+
...init,
|
|
21175
|
+
keepalive: this.keepalive
|
|
21176
|
+
});
|
|
21177
|
+
}
|
|
21178
|
+
};
|
|
20635
21179
|
this.rpcClient = createClient(
|
|
20636
21180
|
YorkieService,
|
|
20637
|
-
createGrpcWebTransport(
|
|
20638
|
-
baseUrl: rpcAddr,
|
|
20639
|
-
interceptors: [
|
|
20640
|
-
authInterceptor,
|
|
20641
|
-
createMetricInterceptor(opts?.userAgent)
|
|
20642
|
-
],
|
|
20643
|
-
fetch: (input, init) => {
|
|
20644
|
-
return fetch(input, {
|
|
20645
|
-
...init,
|
|
20646
|
-
keepalive: this.keepalive
|
|
20647
|
-
});
|
|
20648
|
-
}
|
|
20649
|
-
})
|
|
21181
|
+
opts.useGrpcWebTransport ? createGrpcWebTransport(transportOptions) : createConnectTransport(transportOptions)
|
|
20650
21182
|
);
|
|
20651
21183
|
this.taskQueue = [];
|
|
20652
21184
|
}
|
|
@@ -20674,6 +21206,7 @@ class Client {
|
|
|
20674
21206
|
);
|
|
20675
21207
|
this.id = res.clientId;
|
|
20676
21208
|
this.status = "activated";
|
|
21209
|
+
this.deactivating = false;
|
|
20677
21210
|
this.runSyncLoop();
|
|
20678
21211
|
logger.info(`[AC] c:"${this.getKey()}" activated, id:"${this.id}"`);
|
|
20679
21212
|
if (typeof window !== "undefined") {
|
|
@@ -20702,6 +21235,7 @@ class Client {
|
|
|
20702
21235
|
if (this.status === "deactivated") {
|
|
20703
21236
|
return Promise.resolve();
|
|
20704
21237
|
}
|
|
21238
|
+
this.deactivating = true;
|
|
20705
21239
|
const task = async () => {
|
|
20706
21240
|
try {
|
|
20707
21241
|
await this.rpcClient.deactivateClient(
|
|
@@ -20715,6 +21249,7 @@ class Client {
|
|
|
20715
21249
|
logger.info(`[DC] c"${this.getKey()}" deactivated`);
|
|
20716
21250
|
} catch (err) {
|
|
20717
21251
|
logger.error(`[DC] c:"${this.getKey()}" err :`, err);
|
|
21252
|
+
this.deactivating = false;
|
|
20718
21253
|
await this.handleConnectError(err);
|
|
20719
21254
|
throw err;
|
|
20720
21255
|
}
|
|
@@ -20855,8 +21390,10 @@ class Client {
|
|
|
20855
21390
|
);
|
|
20856
21391
|
}
|
|
20857
21392
|
doc.update((_, p) => p.clear());
|
|
21393
|
+
attachment.markDetaching();
|
|
20858
21394
|
const task = async () => {
|
|
20859
21395
|
try {
|
|
21396
|
+
await attachment.waitForSyncComplete();
|
|
20860
21397
|
const res = await this.rpcClient.detachDocument(
|
|
20861
21398
|
{
|
|
20862
21399
|
clientId: this.id,
|
|
@@ -20875,6 +21412,7 @@ class Client {
|
|
|
20875
21412
|
return doc;
|
|
20876
21413
|
} catch (err) {
|
|
20877
21414
|
logger.error(`[DD] c:"${this.getKey()}" err :`, err);
|
|
21415
|
+
attachment.resetDetaching();
|
|
20878
21416
|
await this.handleConnectError(err);
|
|
20879
21417
|
throw err;
|
|
20880
21418
|
}
|
|
@@ -21441,7 +21979,7 @@ class Client {
|
|
|
21441
21979
|
*/
|
|
21442
21980
|
runSyncLoop() {
|
|
21443
21981
|
const doLoop = async () => {
|
|
21444
|
-
if (!this.isActive()) {
|
|
21982
|
+
if (!this.isActive() || this.deactivating) {
|
|
21445
21983
|
logger.debug(`[SL] c:"${this.getKey()}" exit sync loop`);
|
|
21446
21984
|
this.conditions[
|
|
21447
21985
|
"SyncLoop"
|
|
@@ -21453,43 +21991,62 @@ class Client {
|
|
|
21453
21991
|
await this.enqueueTask(async () => {
|
|
21454
21992
|
const syncs = [];
|
|
21455
21993
|
for (const [, attachment] of this.attachmentMap) {
|
|
21994
|
+
if (this.deactivating) {
|
|
21995
|
+
break;
|
|
21996
|
+
}
|
|
21456
21997
|
if (!attachment.needSync(this.channelHeartbeatInterval)) {
|
|
21457
21998
|
continue;
|
|
21458
21999
|
}
|
|
22000
|
+
if (attachment.isDetaching()) {
|
|
22001
|
+
continue;
|
|
22002
|
+
}
|
|
21459
22003
|
if (attachment.changeEventReceived !== void 0) {
|
|
21460
22004
|
attachment.changeEventReceived = false;
|
|
21461
22005
|
}
|
|
21462
|
-
|
|
21463
|
-
|
|
21464
|
-
|
|
21465
|
-
|
|
21466
|
-
|
|
21467
|
-
|
|
21468
|
-
|
|
21469
|
-
|
|
21470
|
-
|
|
21471
|
-
|
|
22006
|
+
const syncPromise = this.syncInternal(
|
|
22007
|
+
attachment,
|
|
22008
|
+
attachment.syncMode
|
|
22009
|
+
).then(() => {
|
|
22010
|
+
}).catch((e) => {
|
|
22011
|
+
if (isErrorCode(e, Code.ErrUnauthenticated)) {
|
|
22012
|
+
attachment.resource.publish([
|
|
22013
|
+
{
|
|
22014
|
+
type: DocEventType.AuthError,
|
|
22015
|
+
value: {
|
|
22016
|
+
reason: errorMetadataOf(e).reason,
|
|
22017
|
+
method: "PushPull"
|
|
21472
22018
|
}
|
|
21473
|
-
|
|
21474
|
-
|
|
21475
|
-
|
|
21476
|
-
|
|
21477
|
-
|
|
21478
|
-
|
|
21479
|
-
|
|
21480
|
-
|
|
21481
|
-
|
|
22019
|
+
}
|
|
22020
|
+
]);
|
|
22021
|
+
}
|
|
22022
|
+
if (isErrorCode(e, Code.ErrEpochMismatch)) {
|
|
22023
|
+
attachment.resource.publish([
|
|
22024
|
+
{
|
|
22025
|
+
type: DocEventType.EpochMismatch,
|
|
22026
|
+
value: {
|
|
22027
|
+
method: "PushPull"
|
|
21482
22028
|
}
|
|
21483
|
-
|
|
21484
|
-
|
|
21485
|
-
|
|
21486
|
-
|
|
21487
|
-
)
|
|
22029
|
+
}
|
|
22030
|
+
]);
|
|
22031
|
+
}
|
|
22032
|
+
throw e;
|
|
22033
|
+
}).finally(() => {
|
|
22034
|
+
attachment.clearSyncPromise();
|
|
22035
|
+
});
|
|
22036
|
+
attachment.setSyncPromise(syncPromise);
|
|
22037
|
+
syncs.push(syncPromise);
|
|
21488
22038
|
}
|
|
21489
22039
|
await Promise.all(syncs);
|
|
21490
22040
|
setTimeout(doLoop, this.syncLoopDuration);
|
|
21491
22041
|
});
|
|
21492
22042
|
} catch (err) {
|
|
22043
|
+
if (this.deactivating) {
|
|
22044
|
+
this.conditions[
|
|
22045
|
+
"SyncLoop"
|
|
22046
|
+
/* SyncLoop */
|
|
22047
|
+
] = false;
|
|
22048
|
+
return;
|
|
22049
|
+
}
|
|
21493
22050
|
logger.error(`[SL] c:"${this.getKey()}" sync failed:`, err);
|
|
21494
22051
|
if (await this.handleConnectError(err)) {
|
|
21495
22052
|
setTimeout(doLoop, this.retrySyncLoopDelay);
|
|
@@ -22150,15 +22707,14 @@ const yorkie = {
|
|
|
22150
22707
|
Primitive,
|
|
22151
22708
|
Text,
|
|
22152
22709
|
Counter,
|
|
22710
|
+
DedupCounter,
|
|
22153
22711
|
Tree,
|
|
22154
22712
|
Devtools,
|
|
22155
22713
|
Channel: Channel2,
|
|
22156
22714
|
ChannelEventType,
|
|
22157
22715
|
YSON,
|
|
22158
22716
|
LogLevel,
|
|
22159
|
-
setLogLevel
|
|
22160
|
-
IntType: CounterType.Int,
|
|
22161
|
-
LongType: CounterType.Long
|
|
22717
|
+
setLogLevel
|
|
22162
22718
|
};
|
|
22163
22719
|
if (typeof globalThis !== "undefined") {
|
|
22164
22720
|
globalThis.yorkie = {
|
|
@@ -22167,14 +22723,13 @@ if (typeof globalThis !== "undefined") {
|
|
|
22167
22723
|
Primitive,
|
|
22168
22724
|
Text,
|
|
22169
22725
|
Counter,
|
|
22726
|
+
DedupCounter,
|
|
22170
22727
|
Tree,
|
|
22171
22728
|
Channel: Channel2,
|
|
22172
22729
|
ChannelEventType,
|
|
22173
22730
|
YSON,
|
|
22174
22731
|
LogLevel,
|
|
22175
|
-
setLogLevel
|
|
22176
|
-
IntType: CounterType.Int,
|
|
22177
|
-
LongType: CounterType.Long
|
|
22732
|
+
setLogLevel
|
|
22178
22733
|
};
|
|
22179
22734
|
}
|
|
22180
22735
|
export {
|
|
@@ -22187,6 +22742,7 @@ export {
|
|
|
22187
22742
|
ClientStatus,
|
|
22188
22743
|
Counter,
|
|
22189
22744
|
CounterType,
|
|
22745
|
+
DedupCounter,
|
|
22190
22746
|
Devtools,
|
|
22191
22747
|
DocEventType,
|
|
22192
22748
|
DocStatus,
|