@yorkie-js/sdk 0.6.42 → 0.6.44
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.d.ts
CHANGED
|
@@ -978,7 +978,6 @@ export declare class Client {
|
|
|
978
978
|
* Overloaded to support both types.
|
|
979
979
|
*/
|
|
980
980
|
detach<R, P extends Indexable>(resource: Document_2<R, P>, opts?: {
|
|
981
|
-
removeIfNotAttached?: boolean;
|
|
982
981
|
keepalive?: boolean;
|
|
983
982
|
}): Promise<Document_2<R, P>>;
|
|
984
983
|
/**
|
|
@@ -5656,9 +5655,15 @@ declare class SplayTree<V> {
|
|
|
5656
5655
|
*/
|
|
5657
5656
|
get length(): number;
|
|
5658
5657
|
/**
|
|
5659
|
-
* `
|
|
5658
|
+
* `findForText` returns the Node and offset of the given position (cursor).
|
|
5659
|
+
* Used for Text where cursor placed between characters.
|
|
5660
5660
|
*/
|
|
5661
|
-
|
|
5661
|
+
findForText(pos: number): [SplayNode<V> | undefined, number];
|
|
5662
|
+
/**
|
|
5663
|
+
* `findForArray` returns the Node of the given position (index).
|
|
5664
|
+
* Used for Array where index points to the element.
|
|
5665
|
+
*/
|
|
5666
|
+
findForArray(idx: number): SplayNode<V> | undefined;
|
|
5662
5667
|
/**
|
|
5663
5668
|
* Find the index of the given node in BST.
|
|
5664
5669
|
*
|
package/dist/yorkie-js-sdk.es.js
CHANGED
|
@@ -6298,9 +6298,10 @@ class SplayTree {
|
|
|
6298
6298
|
return this.root ? this.root.getWeight() : 0;
|
|
6299
6299
|
}
|
|
6300
6300
|
/**
|
|
6301
|
-
* `
|
|
6301
|
+
* `findForText` returns the Node and offset of the given position (cursor).
|
|
6302
|
+
* Used for Text where cursor placed between characters.
|
|
6302
6303
|
*/
|
|
6303
|
-
|
|
6304
|
+
findForText(pos) {
|
|
6304
6305
|
if (!this.root || pos < 0) {
|
|
6305
6306
|
return [void 0, 0];
|
|
6306
6307
|
}
|
|
@@ -6325,6 +6326,34 @@ class SplayTree {
|
|
|
6325
6326
|
this.splayNode(node);
|
|
6326
6327
|
return [node, pos];
|
|
6327
6328
|
}
|
|
6329
|
+
/**
|
|
6330
|
+
* `findForArray` returns the Node of the given position (index).
|
|
6331
|
+
* Used for Array where index points to the element.
|
|
6332
|
+
*/
|
|
6333
|
+
findForArray(idx) {
|
|
6334
|
+
if (!this.root) {
|
|
6335
|
+
return void 0;
|
|
6336
|
+
}
|
|
6337
|
+
if (idx < 0 || idx >= this.length) {
|
|
6338
|
+
throw new YorkieError(
|
|
6339
|
+
Code.ErrInvalidArgument,
|
|
6340
|
+
`out of index range: idx: ${idx}, length: ${this.length}`
|
|
6341
|
+
);
|
|
6342
|
+
}
|
|
6343
|
+
let node = this.root;
|
|
6344
|
+
for (; ; ) {
|
|
6345
|
+
if (node.hasLeft() && idx < node.getLeftWeight()) {
|
|
6346
|
+
node = node.getLeft();
|
|
6347
|
+
} else if (node.hasRight() && node.getLeftWeight() + node.getLength() <= idx) {
|
|
6348
|
+
idx -= node.getLeftWeight() + node.getLength();
|
|
6349
|
+
node = node.getRight();
|
|
6350
|
+
} else {
|
|
6351
|
+
break;
|
|
6352
|
+
}
|
|
6353
|
+
}
|
|
6354
|
+
this.splayNode(node);
|
|
6355
|
+
return node;
|
|
6356
|
+
}
|
|
6328
6357
|
/**
|
|
6329
6358
|
* Find the index of the given node in BST.
|
|
6330
6359
|
*
|
|
@@ -8007,15 +8036,8 @@ class RGATreeList {
|
|
|
8007
8036
|
if (idx >= this.length) {
|
|
8008
8037
|
return;
|
|
8009
8038
|
}
|
|
8010
|
-
const
|
|
8011
|
-
|
|
8012
|
-
if (idx === 0 && node === this.dummyHead || offset > 0) {
|
|
8013
|
-
do {
|
|
8014
|
-
if (rgaNode) {
|
|
8015
|
-
rgaNode = rgaNode.getNext();
|
|
8016
|
-
}
|
|
8017
|
-
} while (rgaNode && rgaNode.isRemoved());
|
|
8018
|
-
}
|
|
8039
|
+
const node = this.nodeMapByIndex.findForArray(idx);
|
|
8040
|
+
const rgaNode = node;
|
|
8019
8041
|
return rgaNode;
|
|
8020
8042
|
}
|
|
8021
8043
|
/**
|
|
@@ -9482,7 +9504,7 @@ class RGATreeSplit {
|
|
|
9482
9504
|
* `indexToPos` finds RGATreeSplitPos of given offset.
|
|
9483
9505
|
*/
|
|
9484
9506
|
indexToPos(idx) {
|
|
9485
|
-
const [node, offset] = this.treeByIndex.
|
|
9507
|
+
const [node, offset] = this.treeByIndex.findForText(idx);
|
|
9486
9508
|
const splitNode = node;
|
|
9487
9509
|
return RGATreeSplitPos.of(splitNode.getID(), offset);
|
|
9488
9510
|
}
|
|
@@ -19247,7 +19269,7 @@ function createAuthInterceptor(apiKey, token) {
|
|
|
19247
19269
|
};
|
|
19248
19270
|
}
|
|
19249
19271
|
const name = "@yorkie-js/sdk";
|
|
19250
|
-
const version = "0.6.
|
|
19272
|
+
const version = "0.6.44";
|
|
19251
19273
|
const pkg = {
|
|
19252
19274
|
name,
|
|
19253
19275
|
version
|
|
@@ -19790,8 +19812,7 @@ class Client {
|
|
|
19790
19812
|
{
|
|
19791
19813
|
clientId: this.id,
|
|
19792
19814
|
documentId: attachment.resourceID,
|
|
19793
|
-
changePack: converter.toChangePack(doc.createChangePack())
|
|
19794
|
-
removeIfNotAttached: opts.removeIfNotAttached ?? false
|
|
19815
|
+
changePack: converter.toChangePack(doc.createChangePack())
|
|
19795
19816
|
},
|
|
19796
19817
|
{ headers: { "x-shard-key": `${this.apiKey}/${doc.getKey()}` } }
|
|
19797
19818
|
);
|