@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.es.js
CHANGED
|
@@ -16143,7 +16143,8 @@ function toVersionVector(vector) {
|
|
|
16143
16143
|
}
|
|
16144
16144
|
const pbVector = new VersionVector$1();
|
|
16145
16145
|
for (const [actorID, lamport] of vector) {
|
|
16146
|
-
|
|
16146
|
+
const base64ActorID = uint8ArrayToBase64(toUint8Array(actorID));
|
|
16147
|
+
pbVector.vector[base64ActorID] = BigInt(lamport.toString());
|
|
16147
16148
|
}
|
|
16148
16149
|
return pbVector;
|
|
16149
16150
|
}
|
|
@@ -16641,7 +16642,8 @@ function fromVersionVector(pbVersionVector) {
|
|
|
16641
16642
|
}
|
|
16642
16643
|
const vector = new VersionVector();
|
|
16643
16644
|
Object.entries(pbVersionVector.vector).forEach(([key, value]) => {
|
|
16644
|
-
|
|
16645
|
+
const hexKey = bytesToHex(base64ToUint8Array(key));
|
|
16646
|
+
vector.set(hexKey, BigInt(value.toString()));
|
|
16645
16647
|
});
|
|
16646
16648
|
return vector;
|
|
16647
16649
|
}
|
|
@@ -17169,9 +17171,39 @@ function hexToBytes(hex) {
|
|
|
17169
17171
|
hex.match(/.{1,2}/g).map((byte) => parseInt(byte, 16))
|
|
17170
17172
|
);
|
|
17171
17173
|
}
|
|
17174
|
+
function base64ToUint8Array(base64) {
|
|
17175
|
+
if (typeof window !== "undefined" && typeof window.atob === "function") {
|
|
17176
|
+
const binary = window.atob(base64);
|
|
17177
|
+
const len = binary.length;
|
|
17178
|
+
const bytes = new Uint8Array(len);
|
|
17179
|
+
for (let i = 0; i < len; i++) {
|
|
17180
|
+
bytes[i] = binary.charCodeAt(i);
|
|
17181
|
+
}
|
|
17182
|
+
return bytes;
|
|
17183
|
+
} else if (typeof globalThis !== "undefined" && typeof globalThis.Buffer !== "undefined") {
|
|
17184
|
+
const Buffer2 = globalThis.Buffer;
|
|
17185
|
+
return new Uint8Array(Buffer2.from(base64, "base64"));
|
|
17186
|
+
} else {
|
|
17187
|
+
throw new Error("No base64 decoder available");
|
|
17188
|
+
}
|
|
17189
|
+
}
|
|
17172
17190
|
function toUint8Array(hex) {
|
|
17173
17191
|
return hexToBytes(hex);
|
|
17174
17192
|
}
|
|
17193
|
+
function uint8ArrayToBase64(bytes) {
|
|
17194
|
+
if (typeof window !== "undefined" && typeof window.btoa === "function") {
|
|
17195
|
+
let binary = "";
|
|
17196
|
+
for (let i = 0; i < bytes.byteLength; i++) {
|
|
17197
|
+
binary += String.fromCharCode(bytes[i]);
|
|
17198
|
+
}
|
|
17199
|
+
return window.btoa(binary);
|
|
17200
|
+
} else if (typeof globalThis !== "undefined" && typeof globalThis.Buffer !== "undefined") {
|
|
17201
|
+
const Buffer2 = globalThis.Buffer;
|
|
17202
|
+
return Buffer2.from(bytes).toString("base64");
|
|
17203
|
+
} else {
|
|
17204
|
+
throw new Error("No base64 encoder available");
|
|
17205
|
+
}
|
|
17206
|
+
}
|
|
17175
17207
|
function bytesToChangeID(bytes) {
|
|
17176
17208
|
const pbChangeID = ChangeID$1.fromBinary(bytes);
|
|
17177
17209
|
return fromChangeID(pbChangeID);
|
|
@@ -21236,7 +21268,7 @@ function createAuthInterceptor(apiKey, token) {
|
|
|
21236
21268
|
};
|
|
21237
21269
|
}
|
|
21238
21270
|
const name = "@yorkie-js/sdk";
|
|
21239
|
-
const version = "0.6.
|
|
21271
|
+
const version = "0.6.22";
|
|
21240
21272
|
const pkg = {
|
|
21241
21273
|
name,
|
|
21242
21274
|
version
|