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