@yorkie-js/react 0.6.41-rc → 0.6.41-rc3
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 +227 -31
- package/dist/yorkie-js-react.es.js.map +1 -1
- package/dist/yorkie-js-react.js +227 -31
- package/dist/yorkie-js-react.js.map +1 -1
- package/package.json +2 -2
|
@@ -437,12 +437,12 @@ function unsafeClear(target, field) {
|
|
|
437
437
|
}
|
|
438
438
|
}
|
|
439
439
|
}
|
|
440
|
-
function isObject(arg) {
|
|
440
|
+
function isObject$1(arg) {
|
|
441
441
|
return arg !== null && typeof arg == "object" && !Array.isArray(arg);
|
|
442
442
|
}
|
|
443
443
|
function isReflectList(arg, field) {
|
|
444
444
|
var _a, _b, _c, _d;
|
|
445
|
-
if (isObject(arg) && unsafeLocal in arg && "add" in arg && "field" in arg && typeof arg.field == "function") {
|
|
445
|
+
if (isObject$1(arg) && unsafeLocal in arg && "add" in arg && "field" in arg && typeof arg.field == "function") {
|
|
446
446
|
if (field !== void 0) {
|
|
447
447
|
const a = field;
|
|
448
448
|
const b = arg.field();
|
|
@@ -454,7 +454,7 @@ function isReflectList(arg, field) {
|
|
|
454
454
|
}
|
|
455
455
|
function isReflectMap(arg, field) {
|
|
456
456
|
var _a, _b, _c, _d;
|
|
457
|
-
if (isObject(arg) && unsafeLocal in arg && "has" in arg && "field" in arg && typeof arg.field == "function") {
|
|
457
|
+
if (isObject$1(arg) && unsafeLocal in arg && "has" in arg && "field" in arg && typeof arg.field == "function") {
|
|
458
458
|
if (field !== void 0) {
|
|
459
459
|
const a = field, b = arg.field();
|
|
460
460
|
return a.mapKey === b.mapKey && a.mapKind == b.mapKind && a.scalar === b.scalar && ((_a = a.message) === null || _a === void 0 ? void 0 : _a.typeName) === ((_b = b.message) === null || _b === void 0 ? void 0 : _b.typeName) && ((_c = a.enum) === null || _c === void 0 ? void 0 : _c.typeName) === ((_d = b.enum) === null || _d === void 0 ? void 0 : _d.typeName);
|
|
@@ -464,7 +464,7 @@ function isReflectMap(arg, field) {
|
|
|
464
464
|
return false;
|
|
465
465
|
}
|
|
466
466
|
function isReflectMessage(arg, messageDesc2) {
|
|
467
|
-
return isObject(arg) && unsafeLocal in arg && "desc" in arg && isObject(arg.desc) && arg.desc.kind === "message" && (messageDesc2 === void 0 || arg.desc.typeName == messageDesc2.typeName);
|
|
467
|
+
return isObject$1(arg) && unsafeLocal in arg && "desc" in arg && isObject$1(arg.desc) && arg.desc.kind === "message" && (messageDesc2 === void 0 || arg.desc.typeName == messageDesc2.typeName);
|
|
468
468
|
}
|
|
469
469
|
function isWrapper(arg) {
|
|
470
470
|
return isWrapperTypeName(arg.$typeName);
|
|
@@ -541,7 +541,7 @@ function initScalar(field, value) {
|
|
|
541
541
|
return value;
|
|
542
542
|
}
|
|
543
543
|
function initMap(field, value) {
|
|
544
|
-
if (isObject(value)) {
|
|
544
|
+
if (isObject$1(value)) {
|
|
545
545
|
if (field.scalar == ScalarType.BYTES) {
|
|
546
546
|
return convertObjectValues(value, toU8Arr);
|
|
547
547
|
}
|
|
@@ -566,7 +566,7 @@ function toMessage(field, value) {
|
|
|
566
566
|
if (field.fieldKind == "message" && !field.oneof && isWrapperDesc(field.message)) {
|
|
567
567
|
return initScalar(field.message.fields[0], value);
|
|
568
568
|
}
|
|
569
|
-
if (isObject(value)) {
|
|
569
|
+
if (isObject$1(value)) {
|
|
570
570
|
if (field.message.typeName == "google.protobuf.Struct" && field.parent.typeName !== "google.protobuf.Value") {
|
|
571
571
|
return value;
|
|
572
572
|
}
|
|
@@ -1589,7 +1589,7 @@ function messageToReflect(field, value, check) {
|
|
|
1589
1589
|
$typeName: field.message.typeName,
|
|
1590
1590
|
value: longToReflect(field.message.fields[0], value)
|
|
1591
1591
|
};
|
|
1592
|
-
} else if (field.message.typeName == "google.protobuf.Struct" && field.parent.typeName != "google.protobuf.Value" && isObject(value)) {
|
|
1592
|
+
} else if (field.message.typeName == "google.protobuf.Struct" && field.parent.typeName != "google.protobuf.Value" && isObject$1(value)) {
|
|
1593
1593
|
value = wktStructToReflect(value);
|
|
1594
1594
|
}
|
|
1595
1595
|
}
|
|
@@ -1706,7 +1706,7 @@ function wktStructToReflect(json) {
|
|
|
1706
1706
|
$typeName: "google.protobuf.Struct",
|
|
1707
1707
|
fields: {}
|
|
1708
1708
|
};
|
|
1709
|
-
if (isObject(json)) {
|
|
1709
|
+
if (isObject$1(json)) {
|
|
1710
1710
|
for (const [k, v] of Object.entries(json)) {
|
|
1711
1711
|
struct.fields[k] = wktValueToReflect(v);
|
|
1712
1712
|
}
|
|
@@ -5240,7 +5240,7 @@ function createGrpcWebTransport(options) {
|
|
|
5240
5240
|
const useBinaryFormat = (_a = options.useBinaryFormat) !== null && _a !== void 0 ? _a : true;
|
|
5241
5241
|
return {
|
|
5242
5242
|
async unary(method, signal, timeoutMs, header, message, contextValues) {
|
|
5243
|
-
const { serialize, parse } = createClientMethodSerializers(method, useBinaryFormat, options.jsonOptions, options.binaryOptions);
|
|
5243
|
+
const { serialize, parse: parse2 } = createClientMethodSerializers(method, useBinaryFormat, options.jsonOptions, options.binaryOptions);
|
|
5244
5244
|
timeoutMs = timeoutMs === void 0 ? options.defaultTimeoutMs : timeoutMs <= 0 ? void 0 : timeoutMs;
|
|
5245
5245
|
return await runUnaryCall({
|
|
5246
5246
|
interceptors: options.interceptors,
|
|
@@ -5288,7 +5288,7 @@ function createGrpcWebTransport(options) {
|
|
|
5288
5288
|
if (message2 !== void 0) {
|
|
5289
5289
|
throw new ConnectError("extra message", Code$1.Unimplemented);
|
|
5290
5290
|
}
|
|
5291
|
-
message2 =
|
|
5291
|
+
message2 = parse2(data);
|
|
5292
5292
|
}
|
|
5293
5293
|
if (trailer === void 0) {
|
|
5294
5294
|
if (headerError !== void 0)
|
|
@@ -5311,7 +5311,7 @@ function createGrpcWebTransport(options) {
|
|
|
5311
5311
|
});
|
|
5312
5312
|
},
|
|
5313
5313
|
async stream(method, signal, timeoutMs, header, input, contextValues) {
|
|
5314
|
-
const { serialize, parse } = createClientMethodSerializers(method, useBinaryFormat, options.jsonOptions, options.binaryOptions);
|
|
5314
|
+
const { serialize, parse: parse2 } = createClientMethodSerializers(method, useBinaryFormat, options.jsonOptions, options.binaryOptions);
|
|
5315
5315
|
function parseResponseBody(body, foundStatus, trailerTarget, header2, signal2) {
|
|
5316
5316
|
return __asyncGenerator(this, arguments, function* parseResponseBody_1() {
|
|
5317
5317
|
const reader = createEnvelopeReadableStream(body).getReader();
|
|
@@ -5341,7 +5341,7 @@ function createGrpcWebTransport(options) {
|
|
|
5341
5341
|
if (trailerReceived) {
|
|
5342
5342
|
throw "extra message";
|
|
5343
5343
|
}
|
|
5344
|
-
yield yield __await(
|
|
5344
|
+
yield yield __await(parse2(data));
|
|
5345
5345
|
}
|
|
5346
5346
|
if ("throwIfAborted" in signal2) {
|
|
5347
5347
|
signal2.throwIfAborted();
|
|
@@ -6913,14 +6913,14 @@ function Long(low, high, unsigned) {
|
|
|
6913
6913
|
}
|
|
6914
6914
|
Long.prototype.__isLong__;
|
|
6915
6915
|
Object.defineProperty(Long.prototype, "__isLong__", { value: true });
|
|
6916
|
-
function isLong(obj) {
|
|
6916
|
+
function isLong$1(obj) {
|
|
6917
6917
|
return (obj && obj["__isLong__"]) === true;
|
|
6918
6918
|
}
|
|
6919
6919
|
function ctz32(value) {
|
|
6920
6920
|
var c = Math.clz32(value & -value);
|
|
6921
6921
|
return value ? 31 - c : c;
|
|
6922
6922
|
}
|
|
6923
|
-
Long.isLong = isLong;
|
|
6923
|
+
Long.isLong = isLong$1;
|
|
6924
6924
|
var INT_CACHE = {};
|
|
6925
6925
|
var UINT_CACHE = {};
|
|
6926
6926
|
function fromInt(value, unsigned) {
|
|
@@ -7106,7 +7106,7 @@ LongPrototype.isEven = function isEven() {
|
|
|
7106
7106
|
return (this.low & 1) === 0;
|
|
7107
7107
|
};
|
|
7108
7108
|
LongPrototype.equals = function equals(other) {
|
|
7109
|
-
if (!isLong(other)) other = fromValue(other);
|
|
7109
|
+
if (!isLong$1(other)) other = fromValue(other);
|
|
7110
7110
|
if (this.unsigned !== other.unsigned && this.high >>> 31 === 1 && other.high >>> 31 === 1)
|
|
7111
7111
|
return false;
|
|
7112
7112
|
return this.high === other.high && this.low === other.low;
|
|
@@ -7151,7 +7151,7 @@ LongPrototype.greaterThanOrEqual = function greaterThanOrEqual(other) {
|
|
|
7151
7151
|
LongPrototype.gte = LongPrototype.greaterThanOrEqual;
|
|
7152
7152
|
LongPrototype.ge = LongPrototype.greaterThanOrEqual;
|
|
7153
7153
|
LongPrototype.compare = function compare(other) {
|
|
7154
|
-
if (!isLong(other)) other = fromValue(other);
|
|
7154
|
+
if (!isLong$1(other)) other = fromValue(other);
|
|
7155
7155
|
if (this.eq(other)) return 0;
|
|
7156
7156
|
var thisNeg = this.isNegative(), otherNeg = other.isNegative();
|
|
7157
7157
|
if (thisNeg && !otherNeg) return -1;
|
|
@@ -7166,7 +7166,7 @@ LongPrototype.negate = function negate2() {
|
|
|
7166
7166
|
};
|
|
7167
7167
|
LongPrototype.neg = LongPrototype.negate;
|
|
7168
7168
|
LongPrototype.add = function add(addend) {
|
|
7169
|
-
if (!isLong(addend)) addend = fromValue(addend);
|
|
7169
|
+
if (!isLong$1(addend)) addend = fromValue(addend);
|
|
7170
7170
|
var a48 = this.high >>> 16;
|
|
7171
7171
|
var a32 = this.high & 65535;
|
|
7172
7172
|
var a16 = this.low >>> 16;
|
|
@@ -7190,13 +7190,13 @@ LongPrototype.add = function add(addend) {
|
|
|
7190
7190
|
return fromBits(c16 << 16 | c00, c48 << 16 | c32, this.unsigned);
|
|
7191
7191
|
};
|
|
7192
7192
|
LongPrototype.subtract = function subtract(subtrahend) {
|
|
7193
|
-
if (!isLong(subtrahend)) subtrahend = fromValue(subtrahend);
|
|
7193
|
+
if (!isLong$1(subtrahend)) subtrahend = fromValue(subtrahend);
|
|
7194
7194
|
return this.add(subtrahend.neg());
|
|
7195
7195
|
};
|
|
7196
7196
|
LongPrototype.sub = LongPrototype.subtract;
|
|
7197
7197
|
LongPrototype.multiply = function multiply(multiplier) {
|
|
7198
7198
|
if (this.isZero()) return this;
|
|
7199
|
-
if (!isLong(multiplier)) multiplier = fromValue(multiplier);
|
|
7199
|
+
if (!isLong$1(multiplier)) multiplier = fromValue(multiplier);
|
|
7200
7200
|
if (wasm) {
|
|
7201
7201
|
var low = wasm["mul"](this.low, this.high, multiplier.low, multiplier.high);
|
|
7202
7202
|
return fromBits(low, wasm["get_high"](), this.unsigned);
|
|
@@ -7243,7 +7243,7 @@ LongPrototype.multiply = function multiply(multiplier) {
|
|
|
7243
7243
|
};
|
|
7244
7244
|
LongPrototype.mul = LongPrototype.multiply;
|
|
7245
7245
|
LongPrototype.divide = function divide(divisor) {
|
|
7246
|
-
if (!isLong(divisor)) divisor = fromValue(divisor);
|
|
7246
|
+
if (!isLong$1(divisor)) divisor = fromValue(divisor);
|
|
7247
7247
|
if (divisor.isZero()) throw Error("division by zero");
|
|
7248
7248
|
if (wasm) {
|
|
7249
7249
|
if (!this.unsigned && this.high === -2147483648 && divisor.low === -1 && divisor.high === -1) {
|
|
@@ -7305,7 +7305,7 @@ LongPrototype.divide = function divide(divisor) {
|
|
|
7305
7305
|
};
|
|
7306
7306
|
LongPrototype.div = LongPrototype.divide;
|
|
7307
7307
|
LongPrototype.modulo = function modulo(divisor) {
|
|
7308
|
-
if (!isLong(divisor)) divisor = fromValue(divisor);
|
|
7308
|
+
if (!isLong$1(divisor)) divisor = fromValue(divisor);
|
|
7309
7309
|
if (wasm) {
|
|
7310
7310
|
var low = (this.unsigned ? wasm["rem_u"] : wasm["rem_s"])(
|
|
7311
7311
|
this.low,
|
|
@@ -7331,19 +7331,19 @@ LongPrototype.countTrailingZeros = function countTrailingZeros() {
|
|
|
7331
7331
|
};
|
|
7332
7332
|
LongPrototype.ctz = LongPrototype.countTrailingZeros;
|
|
7333
7333
|
LongPrototype.and = function and(other) {
|
|
7334
|
-
if (!isLong(other)) other = fromValue(other);
|
|
7334
|
+
if (!isLong$1(other)) other = fromValue(other);
|
|
7335
7335
|
return fromBits(this.low & other.low, this.high & other.high, this.unsigned);
|
|
7336
7336
|
};
|
|
7337
7337
|
LongPrototype.or = function or(other) {
|
|
7338
|
-
if (!isLong(other)) other = fromValue(other);
|
|
7338
|
+
if (!isLong$1(other)) other = fromValue(other);
|
|
7339
7339
|
return fromBits(this.low | other.low, this.high | other.high, this.unsigned);
|
|
7340
7340
|
};
|
|
7341
7341
|
LongPrototype.xor = function xor(other) {
|
|
7342
|
-
if (!isLong(other)) other = fromValue(other);
|
|
7342
|
+
if (!isLong$1(other)) other = fromValue(other);
|
|
7343
7343
|
return fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned);
|
|
7344
7344
|
};
|
|
7345
7345
|
LongPrototype.shiftLeft = function shiftLeft(numBits) {
|
|
7346
|
-
if (isLong(numBits)) numBits = numBits.toInt();
|
|
7346
|
+
if (isLong$1(numBits)) numBits = numBits.toInt();
|
|
7347
7347
|
if ((numBits &= 63) === 0) return this;
|
|
7348
7348
|
else if (numBits < 32)
|
|
7349
7349
|
return fromBits(
|
|
@@ -7355,7 +7355,7 @@ LongPrototype.shiftLeft = function shiftLeft(numBits) {
|
|
|
7355
7355
|
};
|
|
7356
7356
|
LongPrototype.shl = LongPrototype.shiftLeft;
|
|
7357
7357
|
LongPrototype.shiftRight = function shiftRight(numBits) {
|
|
7358
|
-
if (isLong(numBits)) numBits = numBits.toInt();
|
|
7358
|
+
if (isLong$1(numBits)) numBits = numBits.toInt();
|
|
7359
7359
|
if ((numBits &= 63) === 0) return this;
|
|
7360
7360
|
else if (numBits < 32)
|
|
7361
7361
|
return fromBits(
|
|
@@ -7372,7 +7372,7 @@ LongPrototype.shiftRight = function shiftRight(numBits) {
|
|
|
7372
7372
|
};
|
|
7373
7373
|
LongPrototype.shr = LongPrototype.shiftRight;
|
|
7374
7374
|
LongPrototype.shiftRightUnsigned = function shiftRightUnsigned(numBits) {
|
|
7375
|
-
if (isLong(numBits)) numBits = numBits.toInt();
|
|
7375
|
+
if (isLong$1(numBits)) numBits = numBits.toInt();
|
|
7376
7376
|
if ((numBits &= 63) === 0) return this;
|
|
7377
7377
|
if (numBits < 32)
|
|
7378
7378
|
return fromBits(
|
|
@@ -7387,7 +7387,7 @@ LongPrototype.shru = LongPrototype.shiftRightUnsigned;
|
|
|
7387
7387
|
LongPrototype.shr_u = LongPrototype.shiftRightUnsigned;
|
|
7388
7388
|
LongPrototype.rotateLeft = function rotateLeft(numBits) {
|
|
7389
7389
|
var b;
|
|
7390
|
-
if (isLong(numBits)) numBits = numBits.toInt();
|
|
7390
|
+
if (isLong$1(numBits)) numBits = numBits.toInt();
|
|
7391
7391
|
if ((numBits &= 63) === 0) return this;
|
|
7392
7392
|
if (numBits === 32) return fromBits(this.high, this.low, this.unsigned);
|
|
7393
7393
|
if (numBits < 32) {
|
|
@@ -7409,7 +7409,7 @@ LongPrototype.rotateLeft = function rotateLeft(numBits) {
|
|
|
7409
7409
|
LongPrototype.rotl = LongPrototype.rotateLeft;
|
|
7410
7410
|
LongPrototype.rotateRight = function rotateRight(numBits) {
|
|
7411
7411
|
var b;
|
|
7412
|
-
if (isLong(numBits)) numBits = numBits.toInt();
|
|
7412
|
+
if (isLong$1(numBits)) numBits = numBits.toInt();
|
|
7413
7413
|
if ((numBits &= 63) === 0) return this;
|
|
7414
7414
|
if (numBits === 32) return fromBits(this.high, this.low, this.unsigned);
|
|
7415
7415
|
if (numBits < 32) {
|
|
@@ -19011,7 +19011,7 @@ function createAuthInterceptor(apiKey, token) {
|
|
|
19011
19011
|
};
|
|
19012
19012
|
}
|
|
19013
19013
|
const name$1 = "@yorkie-js/sdk";
|
|
19014
|
-
const version$1 = "0.6.41-
|
|
19014
|
+
const version$1 = "0.6.41-rc3";
|
|
19015
19015
|
const pkg$1 = {
|
|
19016
19016
|
name: name$1,
|
|
19017
19017
|
version: version$1
|
|
@@ -20581,6 +20581,201 @@ class Client {
|
|
|
20581
20581
|
this.processNext();
|
|
20582
20582
|
}
|
|
20583
20583
|
}
|
|
20584
|
+
function isText(value) {
|
|
20585
|
+
return typeof value === "object" && value !== null && value.type === "Text" && Array.isArray(value.nodes);
|
|
20586
|
+
}
|
|
20587
|
+
function isTree(value) {
|
|
20588
|
+
return typeof value === "object" && value !== null && value.type === "Tree" && typeof value.root === "object";
|
|
20589
|
+
}
|
|
20590
|
+
function isInt(value) {
|
|
20591
|
+
return typeof value === "object" && value !== null && value.type === "Int" && typeof value.value === "number";
|
|
20592
|
+
}
|
|
20593
|
+
function isLong(value) {
|
|
20594
|
+
return typeof value === "object" && value !== null && value.type === "Long" && typeof value.value === "number";
|
|
20595
|
+
}
|
|
20596
|
+
function isDate(value) {
|
|
20597
|
+
return typeof value === "object" && value !== null && value.type === "Date" && typeof value.value === "string";
|
|
20598
|
+
}
|
|
20599
|
+
function isBinData(value) {
|
|
20600
|
+
return typeof value === "object" && value !== null && value.type === "BinData" && typeof value.value === "string";
|
|
20601
|
+
}
|
|
20602
|
+
function isCounter(value) {
|
|
20603
|
+
return typeof value === "object" && value !== null && value.type === "Counter" && typeof value.value === "object";
|
|
20604
|
+
}
|
|
20605
|
+
function isObject(value) {
|
|
20606
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) && !isText(value) && !isTree(value) && !isInt(value) && !isLong(value) && !isDate(value) && !isBinData(value) && !isCounter(value);
|
|
20607
|
+
}
|
|
20608
|
+
function parse(yson) {
|
|
20609
|
+
try {
|
|
20610
|
+
const processed = preprocessYSON(yson);
|
|
20611
|
+
const parsed = JSON.parse(processed);
|
|
20612
|
+
return postprocessValue(parsed);
|
|
20613
|
+
} catch (err) {
|
|
20614
|
+
throw new YorkieError(
|
|
20615
|
+
Code.ErrInvalidArgument,
|
|
20616
|
+
`Failed to parse YSON: ${err instanceof Error ? err.message : String(err)}`
|
|
20617
|
+
);
|
|
20618
|
+
}
|
|
20619
|
+
}
|
|
20620
|
+
function preprocessYSON(yson) {
|
|
20621
|
+
let result = yson;
|
|
20622
|
+
result = result.replace(
|
|
20623
|
+
/Counter\((Int|Long)\((-?\d+)\)\)/g,
|
|
20624
|
+
(_, type, value) => {
|
|
20625
|
+
return `{"__yson_type":"Counter","__yson_data":{"__yson_type":"${type}","__yson_data":${value}}}`;
|
|
20626
|
+
}
|
|
20627
|
+
);
|
|
20628
|
+
result = result.replace(/Int\((-?\d+)\)/g, (_, value) => {
|
|
20629
|
+
return `{"__yson_type":"Int","__yson_data":${value}}`;
|
|
20630
|
+
});
|
|
20631
|
+
result = result.replace(/Long\((-?\d+)\)/g, (_, value) => {
|
|
20632
|
+
return `{"__yson_type":"Long","__yson_data":${value}}`;
|
|
20633
|
+
});
|
|
20634
|
+
result = result.replace(/Date\("([^"]*)"\)/g, (_, value) => {
|
|
20635
|
+
return `{"__yson_type":"Date","__yson_data":"${value}"}`;
|
|
20636
|
+
});
|
|
20637
|
+
result = result.replace(/BinData\("([^"]*)"\)/g, (_, value) => {
|
|
20638
|
+
return `{"__yson_type":"BinData","__yson_data":"${value}"}`;
|
|
20639
|
+
});
|
|
20640
|
+
result = result.replace(
|
|
20641
|
+
/Text\((\[(?:[^[\]]|\[(?:[^[\]]|\[[^[\]]*\])*\])*\])\)/g,
|
|
20642
|
+
(_, content) => {
|
|
20643
|
+
return `{"__yson_type":"Text","__yson_data":${content}}`;
|
|
20644
|
+
}
|
|
20645
|
+
);
|
|
20646
|
+
result = result.replace(
|
|
20647
|
+
/Tree\((\{[^{}]*(?:\{[^{}]*(?:\{[^{}]*\})*[^{}]*\})*[^{}]*\})\)/g,
|
|
20648
|
+
(_, content) => {
|
|
20649
|
+
return `{"__yson_type":"Tree","__yson_data":${content}}`;
|
|
20650
|
+
}
|
|
20651
|
+
);
|
|
20652
|
+
return result;
|
|
20653
|
+
}
|
|
20654
|
+
function postprocessValue(value) {
|
|
20655
|
+
if (value === null || typeof value !== "object") {
|
|
20656
|
+
return value;
|
|
20657
|
+
}
|
|
20658
|
+
if (value.__yson_type === "Int" && typeof value.__yson_data === "number") {
|
|
20659
|
+
return {
|
|
20660
|
+
type: "Int",
|
|
20661
|
+
value: value.__yson_data
|
|
20662
|
+
};
|
|
20663
|
+
}
|
|
20664
|
+
if (value.__yson_type === "Long" && typeof value.__yson_data === "number") {
|
|
20665
|
+
return {
|
|
20666
|
+
type: "Long",
|
|
20667
|
+
value: value.__yson_data
|
|
20668
|
+
};
|
|
20669
|
+
}
|
|
20670
|
+
if (value.__yson_type === "Date" && typeof value.__yson_data === "string") {
|
|
20671
|
+
return {
|
|
20672
|
+
type: "Date",
|
|
20673
|
+
value: value.__yson_data
|
|
20674
|
+
};
|
|
20675
|
+
}
|
|
20676
|
+
if (value.__yson_type === "BinData" && typeof value.__yson_data === "string") {
|
|
20677
|
+
return {
|
|
20678
|
+
type: "BinData",
|
|
20679
|
+
value: value.__yson_data
|
|
20680
|
+
};
|
|
20681
|
+
}
|
|
20682
|
+
if (value.__yson_type === "Counter" && typeof value.__yson_data === "object") {
|
|
20683
|
+
const counterValue = postprocessValue(value.__yson_data);
|
|
20684
|
+
if (typeof counterValue === "object" && counterValue !== null && "type" in counterValue && (counterValue.type === "Int" || counterValue.type === "Long")) {
|
|
20685
|
+
return {
|
|
20686
|
+
type: "Counter",
|
|
20687
|
+
value: counterValue
|
|
20688
|
+
};
|
|
20689
|
+
}
|
|
20690
|
+
throw new YorkieError(
|
|
20691
|
+
Code.ErrInvalidArgument,
|
|
20692
|
+
"Counter must contain Int or Long"
|
|
20693
|
+
);
|
|
20694
|
+
}
|
|
20695
|
+
if (value.__yson_type === "Text" && Array.isArray(value.__yson_data)) {
|
|
20696
|
+
return {
|
|
20697
|
+
type: "Text",
|
|
20698
|
+
nodes: value.__yson_data.map((node) => postprocessTextNode(node))
|
|
20699
|
+
};
|
|
20700
|
+
}
|
|
20701
|
+
if (value.__yson_type === "Tree" && typeof value.__yson_data === "object") {
|
|
20702
|
+
return {
|
|
20703
|
+
type: "Tree",
|
|
20704
|
+
root: postprocessTreeNode(value.__yson_data)
|
|
20705
|
+
};
|
|
20706
|
+
}
|
|
20707
|
+
if (Array.isArray(value)) {
|
|
20708
|
+
return value.map((item) => postprocessValue(item));
|
|
20709
|
+
}
|
|
20710
|
+
const result = {};
|
|
20711
|
+
for (const [key, val] of Object.entries(value)) {
|
|
20712
|
+
result[key] = postprocessValue(val);
|
|
20713
|
+
}
|
|
20714
|
+
return result;
|
|
20715
|
+
}
|
|
20716
|
+
function postprocessTextNode(node) {
|
|
20717
|
+
if (typeof node !== "object" || node === null || typeof node.val !== "string") {
|
|
20718
|
+
throw new YorkieError(Code.ErrInvalidArgument, "invalid text node format");
|
|
20719
|
+
}
|
|
20720
|
+
const result = { val: node.val };
|
|
20721
|
+
if (node.attrs && typeof node.attrs === "object") {
|
|
20722
|
+
result.attrs = node.attrs;
|
|
20723
|
+
}
|
|
20724
|
+
return result;
|
|
20725
|
+
}
|
|
20726
|
+
function postprocessTreeNode(node) {
|
|
20727
|
+
if (typeof node !== "object" || node === null || typeof node.type !== "string") {
|
|
20728
|
+
throw new YorkieError(Code.ErrInvalidArgument, "invalid tree node format");
|
|
20729
|
+
}
|
|
20730
|
+
const result = { type: node.type };
|
|
20731
|
+
if (node.type === "text" && typeof node.value === "string") {
|
|
20732
|
+
result.value = node.value;
|
|
20733
|
+
return result;
|
|
20734
|
+
}
|
|
20735
|
+
if (node.attrs && typeof node.attrs === "object") {
|
|
20736
|
+
result.attrs = node.attrs;
|
|
20737
|
+
}
|
|
20738
|
+
if (Array.isArray(node.children)) {
|
|
20739
|
+
result.children = node.children.map(
|
|
20740
|
+
(child) => postprocessTreeNode(child)
|
|
20741
|
+
);
|
|
20742
|
+
}
|
|
20743
|
+
return result;
|
|
20744
|
+
}
|
|
20745
|
+
function textToString(text) {
|
|
20746
|
+
return text.nodes.map((node) => node.val).join("");
|
|
20747
|
+
}
|
|
20748
|
+
function treeToXML(tree) {
|
|
20749
|
+
return treeNodeToXML(tree.root);
|
|
20750
|
+
}
|
|
20751
|
+
function treeNodeToXML(node) {
|
|
20752
|
+
const attrs = node.attrs ? Object.entries(node.attrs).map(([key, value]) => ` ${key}="${escapeXML(value)}"`).join("") : "";
|
|
20753
|
+
if (node.type === "text" && node.value !== void 0) {
|
|
20754
|
+
return `<${node.type}${attrs}>${escapeXML(node.value)}</${node.type}>`;
|
|
20755
|
+
}
|
|
20756
|
+
if (!node.children || node.children.length === 0) {
|
|
20757
|
+
return `<${node.type}${attrs} />`;
|
|
20758
|
+
}
|
|
20759
|
+
const children = node.children.map((child) => treeNodeToXML(child)).join("");
|
|
20760
|
+
return `<${node.type}${attrs}>${children}</${node.type}>`;
|
|
20761
|
+
}
|
|
20762
|
+
function escapeXML(str) {
|
|
20763
|
+
return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
20764
|
+
}
|
|
20765
|
+
const YSON = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
20766
|
+
__proto__: null,
|
|
20767
|
+
isBinData,
|
|
20768
|
+
isCounter,
|
|
20769
|
+
isDate,
|
|
20770
|
+
isInt,
|
|
20771
|
+
isLong,
|
|
20772
|
+
isObject,
|
|
20773
|
+
isText,
|
|
20774
|
+
isTree,
|
|
20775
|
+
parse,
|
|
20776
|
+
textToString,
|
|
20777
|
+
treeToXML
|
|
20778
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
20584
20779
|
({
|
|
20585
20780
|
IntType: CounterType.Int,
|
|
20586
20781
|
LongType: CounterType.Long
|
|
@@ -20595,6 +20790,7 @@ if (typeof globalThis !== "undefined") {
|
|
|
20595
20790
|
Tree,
|
|
20596
20791
|
Channel: Channel2,
|
|
20597
20792
|
ChannelEventType,
|
|
20793
|
+
YSON,
|
|
20598
20794
|
LogLevel,
|
|
20599
20795
|
setLogLevel,
|
|
20600
20796
|
IntType: CounterType.Int,
|
|
@@ -20602,7 +20798,7 @@ if (typeof globalThis !== "undefined") {
|
|
|
20602
20798
|
};
|
|
20603
20799
|
}
|
|
20604
20800
|
const name = "@yorkie-js/react";
|
|
20605
|
-
const version = "0.6.41-
|
|
20801
|
+
const version = "0.6.41-rc3";
|
|
20606
20802
|
const pkg = {
|
|
20607
20803
|
name,
|
|
20608
20804
|
version
|