@yorkie-js/react 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.
@@ -5,7 +5,7 @@ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
5
5
  import { jsx } from "react/jsx-runtime";
6
6
  import { createContext, useMemo, useState, useEffect, useContext, useCallback } from "react";
7
7
  const name$1 = "@yorkie-js/react";
8
- const version$1 = "0.6.21";
8
+ const version$1 = "0.6.22";
9
9
  const pkg$1 = {
10
10
  name: name$1,
11
11
  version: version$1
@@ -16176,7 +16176,8 @@ function toVersionVector(vector) {
16176
16176
  }
16177
16177
  const pbVector = new VersionVector$1();
16178
16178
  for (const [actorID, lamport] of vector) {
16179
- pbVector.vector[actorID] = BigInt(lamport.toString());
16179
+ const base64ActorID = uint8ArrayToBase64(toUint8Array(actorID));
16180
+ pbVector.vector[base64ActorID] = BigInt(lamport.toString());
16180
16181
  }
16181
16182
  return pbVector;
16182
16183
  }
@@ -16674,7 +16675,8 @@ function fromVersionVector(pbVersionVector) {
16674
16675
  }
16675
16676
  const vector = new VersionVector();
16676
16677
  Object.entries(pbVersionVector.vector).forEach(([key, value]) => {
16677
- vector.set(key, BigInt(value.toString()));
16678
+ const hexKey = bytesToHex(base64ToUint8Array(key));
16679
+ vector.set(hexKey, BigInt(value.toString()));
16678
16680
  });
16679
16681
  return vector;
16680
16682
  }
@@ -17202,9 +17204,39 @@ function hexToBytes(hex) {
17202
17204
  hex.match(/.{1,2}/g).map((byte) => parseInt(byte, 16))
17203
17205
  );
17204
17206
  }
17207
+ function base64ToUint8Array(base64) {
17208
+ if (typeof window !== "undefined" && typeof window.atob === "function") {
17209
+ const binary = window.atob(base64);
17210
+ const len = binary.length;
17211
+ const bytes = new Uint8Array(len);
17212
+ for (let i = 0; i < len; i++) {
17213
+ bytes[i] = binary.charCodeAt(i);
17214
+ }
17215
+ return bytes;
17216
+ } else if (typeof globalThis !== "undefined" && typeof globalThis.Buffer !== "undefined") {
17217
+ const Buffer2 = globalThis.Buffer;
17218
+ return new Uint8Array(Buffer2.from(base64, "base64"));
17219
+ } else {
17220
+ throw new Error("No base64 decoder available");
17221
+ }
17222
+ }
17205
17223
  function toUint8Array(hex) {
17206
17224
  return hexToBytes(hex);
17207
17225
  }
17226
+ function uint8ArrayToBase64(bytes) {
17227
+ if (typeof window !== "undefined" && typeof window.btoa === "function") {
17228
+ let binary = "";
17229
+ for (let i = 0; i < bytes.byteLength; i++) {
17230
+ binary += String.fromCharCode(bytes[i]);
17231
+ }
17232
+ return window.btoa(binary);
17233
+ } else if (typeof globalThis !== "undefined" && typeof globalThis.Buffer !== "undefined") {
17234
+ const Buffer2 = globalThis.Buffer;
17235
+ return Buffer2.from(bytes).toString("base64");
17236
+ } else {
17237
+ throw new Error("No base64 encoder available");
17238
+ }
17239
+ }
17208
17240
  function bytesToChangeID(bytes) {
17209
17241
  const pbChangeID = ChangeID$1.fromBinary(bytes);
17210
17242
  return fromChangeID(pbChangeID);
@@ -21264,7 +21296,7 @@ function createAuthInterceptor(apiKey, token) {
21264
21296
  };
21265
21297
  }
21266
21298
  const name = "@yorkie-js/sdk";
21267
- const version = "0.6.21";
21299
+ const version = "0.6.22";
21268
21300
  const pkg = {
21269
21301
  name,
21270
21302
  version