@yorkie-js/sdk 0.6.21 → 0.6.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/yorkie-js-sdk.js
CHANGED
|
@@ -16147,7 +16147,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
16147
16147
|
}
|
|
16148
16148
|
const pbVector = new VersionVector$1();
|
|
16149
16149
|
for (const [actorID, lamport] of vector) {
|
|
16150
|
-
|
|
16150
|
+
const base64ActorID = uint8ArrayToBase64(toUint8Array(actorID));
|
|
16151
|
+
pbVector.vector[base64ActorID] = BigInt(lamport.toString());
|
|
16151
16152
|
}
|
|
16152
16153
|
return pbVector;
|
|
16153
16154
|
}
|
|
@@ -16645,7 +16646,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
16645
16646
|
}
|
|
16646
16647
|
const vector = new VersionVector();
|
|
16647
16648
|
Object.entries(pbVersionVector.vector).forEach(([key, value]) => {
|
|
16648
|
-
|
|
16649
|
+
const hexKey = bytesToHex(base64ToUint8Array(key));
|
|
16650
|
+
vector.set(hexKey, BigInt(value.toString()));
|
|
16649
16651
|
});
|
|
16650
16652
|
return vector;
|
|
16651
16653
|
}
|
|
@@ -17173,9 +17175,39 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
17173
17175
|
hex.match(/.{1,2}/g).map((byte) => parseInt(byte, 16))
|
|
17174
17176
|
);
|
|
17175
17177
|
}
|
|
17178
|
+
function base64ToUint8Array(base64) {
|
|
17179
|
+
if (typeof window !== "undefined" && typeof window.atob === "function") {
|
|
17180
|
+
const binary = window.atob(base64);
|
|
17181
|
+
const len = binary.length;
|
|
17182
|
+
const bytes = new Uint8Array(len);
|
|
17183
|
+
for (let i = 0; i < len; i++) {
|
|
17184
|
+
bytes[i] = binary.charCodeAt(i);
|
|
17185
|
+
}
|
|
17186
|
+
return bytes;
|
|
17187
|
+
} else if (typeof globalThis !== "undefined" && typeof globalThis.Buffer !== "undefined") {
|
|
17188
|
+
const Buffer2 = globalThis.Buffer;
|
|
17189
|
+
return new Uint8Array(Buffer2.from(base64, "base64"));
|
|
17190
|
+
} else {
|
|
17191
|
+
throw new Error("No base64 decoder available");
|
|
17192
|
+
}
|
|
17193
|
+
}
|
|
17176
17194
|
function toUint8Array(hex) {
|
|
17177
17195
|
return hexToBytes(hex);
|
|
17178
17196
|
}
|
|
17197
|
+
function uint8ArrayToBase64(bytes) {
|
|
17198
|
+
if (typeof window !== "undefined" && typeof window.btoa === "function") {
|
|
17199
|
+
let binary = "";
|
|
17200
|
+
for (let i = 0; i < bytes.byteLength; i++) {
|
|
17201
|
+
binary += String.fromCharCode(bytes[i]);
|
|
17202
|
+
}
|
|
17203
|
+
return window.btoa(binary);
|
|
17204
|
+
} else if (typeof globalThis !== "undefined" && typeof globalThis.Buffer !== "undefined") {
|
|
17205
|
+
const Buffer2 = globalThis.Buffer;
|
|
17206
|
+
return Buffer2.from(bytes).toString("base64");
|
|
17207
|
+
} else {
|
|
17208
|
+
throw new Error("No base64 encoder available");
|
|
17209
|
+
}
|
|
17210
|
+
}
|
|
17179
17211
|
function bytesToChangeID(bytes) {
|
|
17180
17212
|
const pbChangeID = ChangeID$1.fromBinary(bytes);
|
|
17181
17213
|
return fromChangeID(pbChangeID);
|
|
@@ -21240,7 +21272,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
21240
21272
|
};
|
|
21241
21273
|
}
|
|
21242
21274
|
const name = "@yorkie-js/sdk";
|
|
21243
|
-
const version = "0.6.
|
|
21275
|
+
const version = "0.6.22";
|
|
21244
21276
|
const pkg = {
|
|
21245
21277
|
name,
|
|
21246
21278
|
version
|