@yorkie-js/react 0.6.10 → 0.6.11-rc

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.
@@ -7,7 +7,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
7
7
 
8
8
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
9
9
  const name$1 = "@yorkie-js/react";
10
- const version$1 = "0.6.10";
10
+ const version$1 = "0.6.11-rc";
11
11
  const pkg$1 = {
12
12
  name: name$1,
13
13
  version: version$1
@@ -20420,7 +20420,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
20420
20420
  };
20421
20421
  }
20422
20422
  const name = "@yorkie-js/sdk";
20423
- const version = "0.6.10";
20423
+ const version = "0.6.11-rc";
20424
20424
  const pkg = {
20425
20425
  name,
20426
20426
  version
@@ -20578,15 +20578,16 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
20578
20578
  if (this.status === "deactivated") {
20579
20579
  return Promise.resolve();
20580
20580
  }
20581
+ this.deactivateInternal();
20581
20582
  const task = async () => {
20582
20583
  try {
20583
20584
  await this.rpcClient.deactivateClient(
20584
20585
  { clientId: this.id },
20585
20586
  { headers: { "x-shard-key": this.apiKey } }
20586
20587
  );
20587
- this.deactivateInternal();
20588
20588
  logger.info(`[DC] c"${this.getKey()}" deactivated`);
20589
20589
  } catch (err) {
20590
+ this.status = "activated";
20590
20591
  logger.error(`[DC] c:"${this.getKey()}" err :`, err);
20591
20592
  await this.handleConnectError(err);
20592
20593
  throw err;
@@ -20670,12 +20671,12 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
20670
20671
  await this.runWatchLoop(doc.getKey());
20671
20672
  }
20672
20673
  logger.info(`[AD] c:"${this.getKey()}" attaches d:"${doc.getKey()}"`);
20673
- const crdtObject = doc.getRootObject();
20674
+ const crdtRoot = doc.getRootObject();
20674
20675
  if (opts.initialRoot) {
20675
20676
  const initialRoot = opts.initialRoot;
20676
20677
  doc.update((root) => {
20677
20678
  for (const [k, v] of Object.entries(initialRoot)) {
20678
- if (!crdtObject.has(k)) {
20679
+ if (!crdtRoot.has(k)) {
20679
20680
  const key = k;
20680
20681
  root[key] = v;
20681
20682
  }
@@ -20698,7 +20699,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
20698
20699
  * the changes should be applied to other replicas before GC time. For this,
20699
20700
  * if the document is no longer used by this client, it should be detached.
20700
20701
  */
20701
- detach(doc, opts = { keepalive: false }) {
20702
+ detach(doc, opts = { removeIfNotAttached: false }) {
20702
20703
  if (!this.isActive()) {
20703
20704
  throw new YorkieError(
20704
20705
  Code.ErrClientNotActivated,
@@ -20713,14 +20714,14 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
20713
20714
  );
20714
20715
  }
20715
20716
  doc.update((_, p) => p.clear());
20716
- const task = async () => {
20717
+ return this.enqueueTask(async () => {
20717
20718
  try {
20718
20719
  const res = await this.rpcClient.detachDocument(
20719
20720
  {
20720
20721
  clientId: this.id,
20721
20722
  documentId: attachment.docID,
20722
20723
  changePack: converter.toChangePack(doc.createChangePack()),
20723
- removeIfNotAttached: opts.removeIfNotAttached ?? false
20724
+ removeIfNotAttached: opts.removeIfNotAttached
20724
20725
  },
20725
20726
  { headers: { "x-shard-key": `${this.apiKey}/${doc.getKey()}` } }
20726
20727
  );
@@ -20737,14 +20738,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
20737
20738
  await this.handleConnectError(err);
20738
20739
  throw err;
20739
20740
  }
20740
- };
20741
- if (opts.keepalive) {
20742
- this.keepalive = true;
20743
- const resp = task();
20744
- this.keepalive = false;
20745
- return resp;
20746
- }
20747
- return this.enqueueTask(task);
20741
+ });
20748
20742
  }
20749
20743
  /**
20750
20744
  * `changeRealtimeSync` changes the synchronization mode of the given document.