@fluidframework/legacy-dds 2.52.0 → 2.53.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # @fluid-private/legacy-dds
2
2
 
3
+ ## 2.53.0
4
+
5
+ Dependency updates only.
6
+
3
7
  ## 2.52.0
4
8
 
5
9
  Dependency updates only.
@@ -117,6 +117,11 @@ export declare class SharedArrayClass<T extends SerializableTypeForSharedArray>
117
117
  * For messages from a remote client, this will be undefined.
118
118
  */
119
119
  protected processCore(message: ISequencedDocumentMessage, local: boolean, _localOpMetadata: unknown): void;
120
+ private handleInsertOp;
121
+ private handleDeleteOp;
122
+ private handleMoveOp;
123
+ private handleToggleOp;
124
+ private handleToggleMoveOp;
120
125
  private findInternalIndex;
121
126
  private findInternalInsertionIndex;
122
127
  private findInternalDeletionIndex;
@@ -143,7 +148,6 @@ export declare class SharedArrayClass<T extends SerializableTypeForSharedArray>
143
148
  * Returns the index of the first entry starting with startIndex that does not have the isAckPending flag
144
149
  */
145
150
  private getInternalInsertIndexByIgnoringLocalPendingInserts;
146
- private handleInsertOp;
147
151
  private findIndexOfEntryId;
148
152
  private prepareToMakeEntryIdLive;
149
153
  /**
@@ -170,6 +174,6 @@ export declare class SharedArrayClass<T extends SerializableTypeForSharedArray>
170
174
  * existingEntry -\> deadeEntry(appended) -\> existing chain(if any).
171
175
  */
172
176
  private updateDeadEntry;
173
- protected applyStashedOp(_content: unknown): void;
177
+ protected applyStashedOp(content: unknown): void;
174
178
  }
175
179
  //# sourceMappingURL=sharedArray.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sharedArray.d.ts","sourceRoot":"","sources":["../../src/array/sharedArray.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EACX,YAAY,EACZ,kBAAkB,EAClB,sBAAsB,EACtB,eAAe,EACf,sBAAsB,EACtB,MAAM,gDAAgD,CA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AmBtB,OAAO,CAAC,cAAc;IActB,OAAO,CAAC,YAAY;IAiCpB,OAAO,CAAC,cAAc;IActB,OAAO,CAAC,kBAAkB;IAe1B,OAAO,CAAC,iBAAiB;IAoBzB,OAAO,CAAC,0BAA0B;IAIlC,OAAO,CAAC,yBAAyB;IAIjC,OAAO,CAAC,cAAc;IAMtB,OAAO,CAAC,QAAQ;IAahB,OAAO,CAAC,qBAAqB;IAI7B,OAAO,CAAC,mBAAmB;IAK3B,OAAO,CAAC,UAAU;IAalB,OAAO,CAAC,eAAe;IAoBvB;;;;;OAKG;IACH,OAAO,CAAC,cAAc;IAiBtB;;;;OAIG;IACH,OAAO,CAAC,eAAe;IAMvB;;OAEG;IACH,OAAO,CAAC,mDAAmD;IAgB3D,OAAO,CAAC,kBAAkB;IAS1B,OAAO,CAAC,wBAAwB;IAiBhC;;;;;;;;;OASG;IACH,OAAO,CAAC,YAAY;IAQpB;;;;;OAKG;IACH,OAAO,CAAC,eAAe;IAevB;;;;OAIG;IACH,OAAO,CAAC,eAAe;IAiBvB,SAAS,CAAC,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;CAmChD"}
@@ -355,78 +355,25 @@ class SharedArrayClass extends internal_4.SharedObject {
355
355
  // eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison
356
356
  if (message.type === internal_2.MessageType.Operation) {
357
357
  const op = message.contents;
358
- const opEntry = this.getEntryForId(op.entryId);
359
358
  switch (op.type) {
360
359
  case sharedArrayOperations_js_1.OperationType.insertEntry: {
361
360
  this.handleInsertOp(op.entryId, op.insertAfterEntryId, local, op.value);
362
361
  break;
363
362
  }
364
363
  case sharedArrayOperations_js_1.OperationType.deleteEntry: {
365
- if (local) {
366
- // Decrementing local pending counter as op is already applied to local state
367
- opEntry.isLocalPendingDelete -= 1;
368
- }
369
- else {
370
- // If local pending, then ignore else apply the remote op
371
- if (!this.isLocalPending(op.entryId, "isLocalPendingDelete")) {
372
- // last element in skip list is the most recent and live entry, so marking it deleted
373
- this.getLiveEntry(op.entryId).isDeleted = true;
374
- }
375
- }
364
+ this.handleDeleteOp(op, local);
376
365
  break;
377
366
  }
378
367
  case sharedArrayOperations_js_1.OperationType.moveEntry: {
379
- this.handleInsertOp(op.changedToEntryId, op.insertAfterEntryId, local, opEntry.value);
380
- if (local) {
381
- // decrement the local pending move op as its already applied to local state
382
- opEntry.isLocalPendingMove -= 1;
383
- }
384
- else {
385
- const newElementEntryId = op.changedToEntryId;
386
- const newElement = this.getEntryForId(newElementEntryId);
387
- // If local pending then simply mark the new location dead as finally the local op will win
388
- if (this.isLocalPending(op.entryId, "isLocalPendingDelete") ||
389
- this.isLocalPending(op.entryId, "isLocalPendingMove")) {
390
- this.updateDeadEntry(op.entryId, newElementEntryId);
391
- }
392
- else {
393
- // move the element
394
- const liveEntry = this.getLiveEntry(op.entryId);
395
- const isDeleted = liveEntry.isDeleted;
396
- this.updateLiveEntry(liveEntry.entryId, newElementEntryId);
397
- // mark newly added element as deleted if existing live element was already deleted
398
- if (isDeleted) {
399
- newElement.isDeleted = isDeleted;
400
- }
401
- }
402
- }
368
+ this.handleMoveOp(op, local);
403
369
  break;
404
370
  }
405
371
  case sharedArrayOperations_js_1.OperationType.toggle: {
406
- if (local) {
407
- // decrement the local pending delete op as its already applied to local state
408
- if (opEntry.isLocalPendingDelete) {
409
- opEntry.isLocalPendingDelete -= 1;
410
- }
411
- }
412
- else {
413
- if (!this.isLocalPending(op.entryId, "isLocalPendingDelete")) {
414
- this.getLiveEntry(op.entryId).isDeleted = op.isDeleted;
415
- }
416
- }
372
+ this.handleToggleOp(op, local);
417
373
  break;
418
374
  }
419
375
  case sharedArrayOperations_js_1.OperationType.toggleMove: {
420
- if (local) {
421
- // decrement the local pending move op as its already applied to local state
422
- if (opEntry.isLocalPendingMove) {
423
- opEntry.isLocalPendingMove -= 1;
424
- }
425
- }
426
- else if (!this.isLocalPending(op.entryId, "isLocalPendingDelete") &&
427
- !this.isLocalPending(op.entryId, "isLocalPendingMove")) {
428
- this.updateLiveEntry(this.getLiveEntry(op.entryId).entryId, op.entryId);
429
- }
376
+ this.handleToggleMoveOp(op, local);
430
377
  break;
431
378
  }
432
379
  default: {
@@ -438,6 +385,88 @@ class SharedArrayClass extends internal_4.SharedObject {
438
385
  }
439
386
  }
440
387
  }
388
+ handleInsertOp(entryId, insertAfterEntryId, local, value) {
389
+ let index = 0;
390
+ if (local) {
391
+ this.getEntryForId(entryId).isAckPending = false;
392
+ }
393
+ else {
394
+ if (insertAfterEntryId !== undefined) {
395
+ index = this.findIndexOfEntryId(insertAfterEntryId) + 1;
396
+ }
397
+ const newEntry = this.createNewEntry(entryId, value);
398
+ newEntry.isAckPending = false;
399
+ this.addEntry(this.getInternalInsertIndexByIgnoringLocalPendingInserts(index), newEntry);
400
+ }
401
+ }
402
+ handleDeleteOp(op, local) {
403
+ const opEntry = this.getEntryForId(op.entryId);
404
+ if (local) {
405
+ // Decrementing local pending counter as op is already applied to local state
406
+ opEntry.isLocalPendingDelete -= 1;
407
+ }
408
+ else {
409
+ // If local pending, then ignore else apply the remote op
410
+ if (!this.isLocalPending(op.entryId, "isLocalPendingDelete")) {
411
+ // last element in skip list is the most recent and live entry, so marking it deleted
412
+ this.getLiveEntry(op.entryId).isDeleted = true;
413
+ }
414
+ }
415
+ }
416
+ handleMoveOp(op, local) {
417
+ const opEntry = this.getEntryForId(op.entryId);
418
+ this.handleInsertOp(op.changedToEntryId, op.insertAfterEntryId, local, opEntry.value);
419
+ if (local) {
420
+ // decrement the local pending move op as its already applied to local state
421
+ opEntry.isLocalPendingMove -= 1;
422
+ }
423
+ else {
424
+ const newElementEntryId = op.changedToEntryId;
425
+ const newElement = this.getEntryForId(newElementEntryId);
426
+ // If local pending then simply mark the new location dead as finally the local op will win
427
+ if (this.isLocalPending(op.entryId, "isLocalPendingDelete") ||
428
+ this.isLocalPending(op.entryId, "isLocalPendingMove")) {
429
+ this.updateDeadEntry(op.entryId, newElementEntryId);
430
+ }
431
+ else {
432
+ // move the element
433
+ const liveEntry = this.getLiveEntry(op.entryId);
434
+ const isDeleted = liveEntry.isDeleted;
435
+ this.updateLiveEntry(liveEntry.entryId, newElementEntryId);
436
+ // mark newly added element as deleted if existing live element was already deleted
437
+ if (isDeleted) {
438
+ newElement.isDeleted = isDeleted;
439
+ }
440
+ }
441
+ }
442
+ }
443
+ handleToggleOp(op, local) {
444
+ const opEntry = this.getEntryForId(op.entryId);
445
+ if (local) {
446
+ // decrement the local pending delete op as its already applied to local state
447
+ if (opEntry.isLocalPendingDelete) {
448
+ opEntry.isLocalPendingDelete -= 1;
449
+ }
450
+ }
451
+ else {
452
+ if (!this.isLocalPending(op.entryId, "isLocalPendingDelete")) {
453
+ this.getLiveEntry(op.entryId).isDeleted = op.isDeleted;
454
+ }
455
+ }
456
+ }
457
+ handleToggleMoveOp(op, local) {
458
+ const opEntry = this.getEntryForId(op.entryId);
459
+ if (local) {
460
+ // decrement the local pending move op as its already applied to local state
461
+ if (opEntry.isLocalPendingMove) {
462
+ opEntry.isLocalPendingMove -= 1;
463
+ }
464
+ }
465
+ else if (!this.isLocalPending(op.entryId, "isLocalPendingDelete") &&
466
+ !this.isLocalPending(op.entryId, "isLocalPendingMove")) {
467
+ this.updateLiveEntry(this.getLiveEntry(op.entryId).entryId, op.entryId);
468
+ }
469
+ }
441
470
  findInternalIndex(countEntries) {
442
471
  if (countEntries < 0) {
443
472
  throw new Error("Input count is zero");
@@ -549,20 +578,6 @@ class SharedArrayClass extends internal_4.SharedObject {
549
578
  }
550
579
  return localOpsIterator;
551
580
  }
552
- handleInsertOp(entryId, insertAfterEntryId, local, value) {
553
- let index = 0;
554
- if (local) {
555
- this.getEntryForId(entryId).isAckPending = false;
556
- }
557
- else {
558
- if (insertAfterEntryId !== undefined) {
559
- index = this.findIndexOfEntryId(insertAfterEntryId) + 1;
560
- }
561
- const newEntry = this.createNewEntry(entryId, value);
562
- newEntry.isAckPending = false;
563
- this.addEntry(this.getInternalInsertIndexByIgnoringLocalPendingInserts(index), newEntry);
564
- }
565
- }
566
581
  findIndexOfEntryId(entryId) {
567
582
  for (let index = 0; index < this.sharedArray.length; index = index + 1) {
568
583
  if (this.sharedArray[index]?.entryId === entryId) {
@@ -644,8 +659,35 @@ class SharedArrayClass extends internal_4.SharedObject {
644
659
  deadEntry.prevEntryId = existingEntryId;
645
660
  deadEntry.isDeleted = true;
646
661
  }
647
- applyStashedOp(_content) {
648
- throw new Error("Not implemented");
662
+ applyStashedOp(content) {
663
+ const op = content;
664
+ switch (op.type) {
665
+ case sharedArrayOperations_js_1.OperationType.insertEntry: {
666
+ this.handleInsertOp(op.entryId, op.insertAfterEntryId, false, // treat it as remote op
667
+ op.value);
668
+ break;
669
+ }
670
+ case sharedArrayOperations_js_1.OperationType.deleteEntry: {
671
+ this.handleDeleteOp(op, false /* local - treat as remote op */);
672
+ break;
673
+ }
674
+ case sharedArrayOperations_js_1.OperationType.moveEntry: {
675
+ this.handleMoveOp(op, false /* local - treat as remote op */);
676
+ break;
677
+ }
678
+ case sharedArrayOperations_js_1.OperationType.toggle: {
679
+ this.handleToggleOp(op, false /* local - treat as remote op */);
680
+ break;
681
+ }
682
+ case sharedArrayOperations_js_1.OperationType.toggleMove: {
683
+ this.handleToggleMoveOp(op, false /* local - treat as remote op */);
684
+ break;
685
+ }
686
+ default: {
687
+ (0, internal_1.unreachableCase)(op);
688
+ }
689
+ }
690
+ this.submitLocalMessage(op);
649
691
  }
650
692
  }
651
693
  exports.SharedArrayClass = SharedArrayClass;
@@ -1 +1 @@
1
- {"version":3,"file":"sharedArray.js","sourceRoot":"","sources":["../../src/array/sharedArray.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAY7D,0EAA+F;AAE/F,qEAAuF;AAEvF,0EAA2E;AAC3E,+BAAkC;AAWlC,mEAA6D;AAQ7D,yEAA2D;AAC3D,yEAAmE;AAEnE,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAElC;;;;GAIG;AACH,MAAa,gBACZ,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,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC;QAC1D,MAAM,SAAS,GAAG,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;QAElD,0FAA0F;QAC1F,6FAA6F;QAC7F,IAAI,aAAa,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;YAC7C,SAAS,CAAC,WAAW,GAAG,aAAa,CAAC,WAAW,CAAC;YAClD,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,WAAW,GAAG,WAAW,CAAC;QACzE,CAAC;QAED,oEAAoE;QACpE,aAAa,CAAC,WAAW,GAAG,WAAW,CAAC;QACxC,SAAS,CAAC,WAAW,GAAG,eAAe,CAAC;QACxC,SAAS,CAAC,SAAS,GAAG,IAAI,CAAC;IAC5B,CAAC;IAES,cAAc,CAAC,QAAiB;QACzC,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACpC,CAAC;CACD;AA/wBD,4CA+wBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type {\n\tSerializable,\n\tIChannelAttributes,\n\tIFluidDataStoreRuntime,\n\tIChannelFactory,\n\tIChannelStorageService,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport type {\n\tISequencedDocumentMessage,\n\tITree,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { FileMode, MessageType, TreeEntry } from \"@fluidframework/driver-definitions/internal\";\nimport type { ISummaryTreeWithStats } from \"@fluidframework/runtime-definitions/internal\";\nimport { convertToSummaryTreeWithStats } from \"@fluidframework/runtime-utils/internal\";\nimport type { IFluidSerializer } from \"@fluidframework/shared-object-base/internal\";\nimport { SharedObject } from \"@fluidframework/shared-object-base/internal\";\nimport { v4 as uuid } from \"uuid\";\n\nimport type {\n\tISharedArrayEvents,\n\tISharedArray,\n\tISharedArrayRevertible,\n\tSerializableTypeForSharedArray,\n\tSharedArrayEntry,\n\tSnapshotFormat,\n\tSharedArrayEntryCore,\n} from \"./interfaces.js\";\nimport { SharedArrayFactory } from \"./sharedArrayFactory.js\";\nimport type {\n\tISharedArrayOperation,\n\tIDeleteOperation,\n\tIMoveOperation,\n\tIToggleMoveOperation,\n\tIToggleOperation,\n} from \"./sharedArrayOperations.js\";\nimport { OperationType } from \"./sharedArrayOperations.js\";\nimport { SharedArrayRevertible } from \"./sharedArrayRevertible.js\";\n\nconst snapshotFileName = \"header\";\n\n/**\n * Represents a shared array that allows communication between distributed clients.\n *\n * @internal\n */\nexport class SharedArrayClass<T extends SerializableTypeForSharedArray>\n\textends SharedObject<ISharedArrayEvents>\n\timplements ISharedArray<T>, ISharedArrayRevertible\n{\n\t/**\n\t * Stores the data held by this shared array.\n\t */\n\tprivate sharedArray: SharedArrayEntry<T>[];\n\n\t/**\n\t * Stores a map of entryid to entries of the sharedArray. This is meant of search optimizations and\n\t * so shouldn't be snapshotted.\n\t * Note: This map needs to be updated only when the sharedArray is being deserialized and when new entries are\n\t * being added. New entries are added upon insert ops and the second leg of the move op.\n\t * As we don't delete the entries once created, deletion or move to another position needs no special\n\t * handling for this data structure\n\t */\n\tprivate readonly idToEntryMap: Map<string, SharedArrayEntry<T>>;\n\n\t/**\n\t * Create a new shared array\n\t *\n\t * @param runtime - data store runtime the new shared array belongs to\n\t * @param id - optional name of the shared array\n\t * @returns newly create shared array (but not attached yet)\n\t */\n\tpublic static create<T extends SerializableTypeForSharedArray>(\n\t\truntime: IFluidDataStoreRuntime,\n\t\tid?: string,\n\t): SharedArrayClass<T> {\n\t\treturn runtime.createChannel(id, SharedArrayFactory.Type) as SharedArrayClass<T>;\n\t}\n\n\t/**\n\t * Get a factory for SharedArray to register with the data store.\n\t *\n\t * @returns a factory that creates and load SharedArray\n\t */\n\tpublic static getFactory<T extends SerializableTypeForSharedArray>(): IChannelFactory {\n\t\treturn new SharedArrayFactory<T>();\n\t}\n\n\t/**\n\t * Constructs a new shared array. If the object is non-local an id and service interfaces will\n\t * be provided\n\t *\n\t * @param id - optional name of the shared array\n\t * @param runtime - data store runtime the shared array belongs to\n\t * @param attributes - represents the attributes of a channel/DDS.\n\t */\n\tpublic constructor(\n\t\tid: string,\n\t\truntime: IFluidDataStoreRuntime,\n\t\tattributes: IChannelAttributes,\n\t) {\n\t\tsuper(id, runtime, attributes, \"loop_sharedArray_\" /* telemetryContextPrefix */);\n\t\tthis.sharedArray = [];\n\t\tthis.idToEntryMap = new Map<string, SharedArrayEntry<T>>();\n\t}\n\n\t/**\n\t * Method that returns the ordered list of the items held in the DDS at this point in time.\n\t * Note: This is only a snapshot of the array\n\t */\n\tpublic get(): readonly T[] {\n\t\treturn this.sharedArray.filter((item) => !item.isDeleted).map((entry) => entry.value);\n\t}\n\n\tprotected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats {\n\t\t// Deep copy and unset the local flags. Needed when snapshotting is happening for runtime not attached\n\t\tconst dataArrayCopy: SharedArrayEntryCore<T>[] = [];\n\t\tfor (const entry of this.sharedArray) {\n\t\t\tdataArrayCopy.push({\n\t\t\t\tentryId: entry.entryId,\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\t\t\tvalue: JSON.parse(serializer.stringify(entry.value, this.handle)),\n\t\t\t\tisDeleted: entry.isDeleted,\n\t\t\t\tprevEntryId: entry.prevEntryId,\n\t\t\t\tnextEntryId: entry.nextEntryId,\n\t\t\t});\n\t\t}\n\n\t\t// We are snapshotting current client data so autoacking pending local.\n\t\t// Assumption : This should happen only for offline client creating the array. All other scenarios should\n\t\t// get to MSN - where there can be no local pending possible.\n\t\tfor (const entry of this.sharedArray) {\n\t\t\tthis.unsetLocalFlags(entry);\n\t\t}\n\t\tconst contents: SnapshotFormat<SharedArrayEntryCore<T>> = {\n\t\t\tdataArray: dataArrayCopy,\n\t\t};\n\t\tconst tree: ITree = {\n\t\t\tentries: [\n\t\t\t\t{\n\t\t\t\t\tmode: FileMode.File,\n\t\t\t\t\tpath: snapshotFileName,\n\t\t\t\t\ttype: TreeEntry[TreeEntry.Blob],\n\t\t\t\t\tvalue: {\n\t\t\t\t\t\tcontents: serializer.stringify(contents, this.handle),\n\t\t\t\t\t\t// eslint-disable-next-line unicorn/text-encoding-identifier-case\n\t\t\t\t\t\tencoding: \"utf-8\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t};\n\t\tconst summaryTreeWithStats = convertToSummaryTreeWithStats(tree);\n\n\t\treturn summaryTreeWithStats;\n\t}\n\n\tpublic insertBulkAfter<TWrite>(\n\t\tref: T | undefined,\n\t\tvalues: (Serializable<TWrite> & T)[],\n\t): void {\n\t\tlet itemIndex: number = 0;\n\n\t\tif (ref !== undefined) {\n\t\t\tfor (itemIndex = this.sharedArray.length - 1; itemIndex > 0; itemIndex -= 1) {\n\t\t\t\tconst item = this.sharedArray[itemIndex];\n\t\t\t\tif (item && !item.isDeleted && item.value === ref) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Add one since we're inserting it after this rowId. If rowId is not found, we will get -1, which after\n\t\t\t// adding one, will be 0, which will place the new rows at the right place too\n\t\t\titemIndex += 1;\n\t\t}\n\n\t\t// Insert new elements\n\t\tfor (const value of values) {\n\t\t\tthis.insertCore(itemIndex, value);\n\t\t\titemIndex += 1;\n\t\t}\n\t}\n\n\tpublic insert<TWrite>(index: number, value: Serializable<TWrite> & T): void {\n\t\tif (index < 0) {\n\t\t\tthrow new Error(\"Invalid input: Insertion index provided is less than 0.\");\n\t\t}\n\t\tthis.insertCore(this.findInternalInsertionIndex(index), value);\n\t}\n\n\tprivate insertCore<TWrite>(indexInternal: number, value: Serializable<TWrite> & T): void {\n\t\tconst insertAfterEntryId =\n\t\t\tindexInternal >= 1 ? this.sharedArray[indexInternal - 1]?.entryId : undefined;\n\t\tconst newEntryId = this.createAddEntry(indexInternal, value);\n\n\t\tconst op = {\n\t\t\ttype: OperationType.insertEntry,\n\t\t\tentryId: newEntryId,\n\t\t\tvalue,\n\t\t\tinsertAfterEntryId,\n\t\t};\n\n\t\tthis.emitValueChangedEvent(op, true /* isLocal */);\n\t\tthis.emitRevertibleEvent(op);\n\n\t\t// If we are not attached, don't submit the op.\n\t\tif (!this.isAttached()) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.submitLocalMessage(op);\n\t}\n\n\tpublic delete(index: number): void {\n\t\tif (index < 0) {\n\t\t\tthrow new Error(\"Invalid input: Deletion index provided is less than 0.\");\n\t\t}\n\n\t\tconst indexInternal: number = this.findInternalDeletionIndex(index);\n\n\t\tconst entry = this.sharedArray[indexInternal];\n\t\tassert(entry !== undefined, 0xb90 /* Invalid index */);\n\t\tconst entryId = entry.entryId;\n\t\tthis.deleteCore(indexInternal);\n\n\t\tconst op: IDeleteOperation = {\n\t\t\ttype: OperationType.deleteEntry,\n\t\t\tentryId,\n\t\t};\n\t\tthis.emitValueChangedEvent(op, true /* isLocal */);\n\t\tthis.emitRevertibleEvent(op);\n\n\t\t// If we are not attached, don't submit the op.\n\t\tif (!this.isAttached()) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.submitLocalMessage(op);\n\t}\n\n\tpublic rearrangeToFront(values: T[]): void {\n\t\tfor (let toIndex = 0; toIndex < values.length; toIndex += 1) {\n\t\t\tconst value = values[toIndex];\n\t\t\t// Can skip searching first <toIndex> indices, as they contain elements we already moved.\n\t\t\tfor (let fromIndex = toIndex; fromIndex < this.sharedArray.length; fromIndex += 1) {\n\t\t\t\tconst item = this.sharedArray[fromIndex];\n\t\t\t\tassert(item !== undefined, 0xb91 /* Invalid index */);\n\t\t\t\tif (item.value !== value) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (\n\t\t\t\t\t!item.isDeleted &&\n\t\t\t\t\t// Moving to and from the same index makes no sense, so noOp\n\t\t\t\t\tfromIndex !== toIndex &&\n\t\t\t\t\t// Moving the same entry from current location to its immediate next makes no sense so noOp\n\t\t\t\t\ttoIndex !== fromIndex + 1\n\t\t\t\t) {\n\t\t\t\t\tthis.moveCore(fromIndex, toIndex);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Moves the DDS entry from one index to another\n\t *\n\t * @param fromIndex - User index of the element to be moved\n\t * @param toIndex - User index to which the element should move to\n\t */\n\tpublic move(fromIndex: number, toIndex: number): void {\n\t\tif (fromIndex < 0) {\n\t\t\tthrow new Error(\"Invalid input: fromIndex value provided is less than 0\");\n\t\t}\n\n\t\tif (toIndex < 0) {\n\t\t\tthrow new Error(\"Invalid input: toIndex value provided is less than 0\");\n\t\t}\n\n\t\tif (\n\t\t\t// Moving to and from the same index makes no sense, so noOp\n\t\t\tfromIndex === toIndex ||\n\t\t\t// Moving the same entry from current location to its immediate next makes no sense so noOp\n\t\t\ttoIndex === fromIndex + 1\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\tconst fromIndexInternal: number = this.findInternalDeletionIndex(fromIndex);\n\t\tconst toIndexInternal: number = this.findInternalInsertionIndex(toIndex);\n\n\t\tthis.moveCore(fromIndexInternal, toIndexInternal);\n\t}\n\n\tprivate moveCore(fromIndexInternal: number, toIndexInternal: number): void {\n\t\tconst insertAfterEntryId =\n\t\t\ttoIndexInternal >= 1 ? this.sharedArray[toIndexInternal - 1]?.entryId : undefined;\n\t\tconst entryId = this.sharedArray[fromIndexInternal]?.entryId;\n\t\tassert(entryId !== undefined, 0xb92 /* Invalid index */);\n\t\tconst changedToEntryId = this.createMoveEntry(fromIndexInternal, toIndexInternal);\n\n\t\tconst op: IMoveOperation = {\n\t\t\ttype: OperationType.moveEntry,\n\t\t\tentryId,\n\t\t\tinsertAfterEntryId,\n\t\t\tchangedToEntryId,\n\t\t};\n\t\tthis.emitValueChangedEvent(op, true /* isLocal */);\n\t\tthis.emitRevertibleEvent(op);\n\n\t\t// If we are not attached, don't submit the op.\n\t\tif (!this.isAttached()) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.submitLocalMessage(op);\n\t}\n\n\t/**\n\t * Method used to do undo/redo operation for the given entry id. This method is\n\t * used for undo/redo of only insert and delete operations. Move operation is NOT handled\n\t * by this method\n\t *\n\t * @param entryId - Entry Id for which the the undo/redo operation is to be applied\n\t */\n\tpublic toggle(entryId: string): void {\n\t\tconst liveEntry = this.getLiveEntry(entryId);\n\t\tconst isDeleted = !liveEntry.isDeleted;\n\n\t\t// Adding local pending counter\n\t\tthis.getEntryForId(entryId).isLocalPendingDelete += 1;\n\n\t\t// Toggling the isDeleted flag to undo the last operation for the skip list payload/value\n\t\tliveEntry.isDeleted = isDeleted;\n\n\t\tconst op: IToggleOperation = {\n\t\t\ttype: OperationType.toggle,\n\t\t\tentryId,\n\t\t\tisDeleted,\n\t\t};\n\t\tthis.emitValueChangedEvent(op, true /* isLocal */);\n\t\tthis.emitRevertibleEvent(op);\n\n\t\t// If we are not attached, don't submit the op.\n\t\tif (!this.isAttached()) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.submitLocalMessage(op);\n\t}\n\n\t/**\n\t * Method to do undo/redo of move operation. All entries of the same payload/value are stored\n\t * in the same doubly linked skip list. This skip list is updated upon every move by adding the\n\t * new location as a new entry in the skip list and update the isDeleted flag to indicate the new\n\t * entry is the cuurent live location for the user.\n\t *\n\t * @param oldEntryId - EntryId of the last live entry\n\t * @param newEntryId - EntryId of the to be live entry\n\t */\n\tpublic toggleMove(oldEntryId: string, newEntryId: string): void {\n\t\tif (this.getEntryForId(newEntryId).isDeleted) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Adding local pending counter\n\t\tthis.getEntryForId(oldEntryId).isLocalPendingMove += 1;\n\n\t\tthis.updateLiveEntry(newEntryId, oldEntryId);\n\n\t\tconst op: IToggleMoveOperation = {\n\t\t\ttype: OperationType.toggleMove,\n\t\t\tentryId: oldEntryId,\n\t\t\tchangedToEntryId: newEntryId,\n\t\t};\n\t\tthis.emitValueChangedEvent(op, true /* isLocal */);\n\t\tthis.emitRevertibleEvent(op);\n\n\t\t// If we are not attached, don't submit the op.\n\t\tif (!this.isAttached()) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.submitLocalMessage(op);\n\t}\n\n\t/**\n\t * Load share array from snapshot\n\t *\n\t * @param storage - the storage to get the snapshot from\n\t * @returns - promise that resolved when the load is completed\n\t */\n\tprotected async loadCore(storage: IChannelStorageService): Promise<void> {\n\t\tconst header = await storage.readBlob(snapshotFileName);\n\t\t// eslint-disable-next-line unicorn/text-encoding-identifier-case\n\t\tconst utf8 = new TextDecoder(\"utf-8\").decode(header);\n\t\t// Note: IFluidSerializer.parse() doesn't guarantee any typing; the explicit typing here is based on this code's\n\t\t// knowledge of what it is deserializing.\n\t\tconst deserializedSharedArray = this.serializer.parse(utf8) as {\n\t\t\tdataArray: SharedArrayEntry<T>[];\n\t\t};\n\t\tthis.sharedArray = deserializedSharedArray.dataArray;\n\t\t// Initializing the idToEntryMap optimizer data set\n\t\tfor (const entry of this.sharedArray) {\n\t\t\tthis.idToEntryMap.set(entry.entryId, entry);\n\t\t\tthis.unsetLocalFlags(entry);\n\t\t}\n\t}\n\n\t/**\n\t * Callback on disconnect\n\t */\n\tprotected onDisconnect(): void {}\n\n\t/**\n\t * Tracks the doubly linked skip list for the given entry to identify local pending counter attribute.\n\t * It signifies if a local pending operation exists for the payload/value being tracked in the skip list\n\t *\n\t * returns true if counterAttribute's count \\> 0\n\t * @param entryId - id for which counter attribute is to be tracked in chian.\n\t * @param counterAttribute - flag or property name from SharedArrayEntry whose counter is to be tracked.\n\t */\n\tprivate isLocalPending(\n\t\tentryId: string,\n\t\tcounterAttribute: keyof SharedArrayEntry<T>,\n\t): boolean {\n\t\tconst getCounterAttributeValue = (\n\t\t\tentry: SharedArrayEntry<T>,\n\t\t\tcounterAttr: keyof SharedArrayEntry<T>,\n\t\t): number => {\n\t\t\treturn entry[counterAttr] as number;\n\t\t};\n\n\t\tconst inputEntry = this.getEntryForId(entryId);\n\t\tlet prevEntryId = inputEntry.prevEntryId;\n\t\tlet nextEntryId = inputEntry.nextEntryId;\n\t\tif (getCounterAttributeValue(inputEntry, counterAttribute) > 0) {\n\t\t\treturn true;\n\t\t}\n\t\t// track back in chain\n\t\twhile (prevEntryId !== undefined && prevEntryId) {\n\t\t\tconst prevEntry = this.getEntryForId(prevEntryId);\n\t\t\tif (getCounterAttributeValue(prevEntry, counterAttribute)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tprevEntryId = prevEntry.prevEntryId;\n\t\t}\n\n\t\t// track forward in the chain\n\t\twhile (nextEntryId !== undefined && nextEntryId) {\n\t\t\tconst nextEntry = this.getEntryForId(nextEntryId);\n\t\t\tif (getCounterAttributeValue(nextEntry, counterAttribute)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tnextEntryId = nextEntry.nextEntryId;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tprivate getEntryForId(entryId: string): SharedArrayEntry<T> {\n\t\treturn this.idToEntryMap.get(entryId) as SharedArrayEntry<T>;\n\t}\n\n\t/**\n\t * Process a shared array operation\n\t *\n\t * @param message - the message to prepare\n\t * @param local - whether the message was sent by the local client\n\t * @param _localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t */\n\tprotected processCore(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocal: boolean,\n\t\t_localOpMetadata: unknown,\n\t): void {\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison\n\t\tif (message.type === MessageType.Operation) {\n\t\t\tconst op = message.contents as ISharedArrayOperation<T>;\n\t\t\tconst opEntry = this.getEntryForId(op.entryId);\n\n\t\t\tswitch (op.type) {\n\t\t\t\tcase OperationType.insertEntry: {\n\t\t\t\t\tthis.handleInsertOp<SerializableTypeForSharedArray>(\n\t\t\t\t\t\top.entryId,\n\t\t\t\t\t\top.insertAfterEntryId,\n\t\t\t\t\t\tlocal,\n\t\t\t\t\t\top.value,\n\t\t\t\t\t);\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcase OperationType.deleteEntry: {\n\t\t\t\t\tif (local) {\n\t\t\t\t\t\t// Decrementing local pending counter as op is already applied to local state\n\t\t\t\t\t\topEntry.isLocalPendingDelete -= 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// If local pending, then ignore else apply the remote op\n\t\t\t\t\t\tif (!this.isLocalPending(op.entryId, \"isLocalPendingDelete\")) {\n\t\t\t\t\t\t\t// last element in skip list is the most recent and live entry, so marking it deleted\n\t\t\t\t\t\t\tthis.getLiveEntry(op.entryId).isDeleted = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcase OperationType.moveEntry: {\n\t\t\t\t\tthis.handleInsertOp<SerializableTypeForSharedArray>(\n\t\t\t\t\t\top.changedToEntryId,\n\t\t\t\t\t\top.insertAfterEntryId,\n\t\t\t\t\t\tlocal,\n\t\t\t\t\t\topEntry.value,\n\t\t\t\t\t);\n\t\t\t\t\tif (local) {\n\t\t\t\t\t\t// decrement the local pending move op as its already applied to local state\n\t\t\t\t\t\topEntry.isLocalPendingMove -= 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst newElementEntryId = op.changedToEntryId;\n\t\t\t\t\t\tconst newElement = this.getEntryForId(newElementEntryId);\n\t\t\t\t\t\t// If local pending then simply mark the new location dead as finally the local op will win\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tthis.isLocalPending(op.entryId, \"isLocalPendingDelete\") ||\n\t\t\t\t\t\t\tthis.isLocalPending(op.entryId, \"isLocalPendingMove\")\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tthis.updateDeadEntry(op.entryId, newElementEntryId);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// move the element\n\t\t\t\t\t\t\tconst liveEntry = this.getLiveEntry(op.entryId);\n\t\t\t\t\t\t\tconst isDeleted = liveEntry.isDeleted;\n\t\t\t\t\t\t\tthis.updateLiveEntry(liveEntry.entryId, newElementEntryId);\n\t\t\t\t\t\t\t// mark newly added element as deleted if existing live element was already deleted\n\t\t\t\t\t\t\tif (isDeleted) {\n\t\t\t\t\t\t\t\tnewElement.isDeleted = isDeleted;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcase OperationType.toggle: {\n\t\t\t\t\tif (local) {\n\t\t\t\t\t\t// decrement the local pending delete op as its already applied to local state\n\t\t\t\t\t\tif (opEntry.isLocalPendingDelete) {\n\t\t\t\t\t\t\topEntry.isLocalPendingDelete -= 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (!this.isLocalPending(op.entryId, \"isLocalPendingDelete\")) {\n\t\t\t\t\t\t\tthis.getLiveEntry(op.entryId).isDeleted = op.isDeleted;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcase OperationType.toggleMove: {\n\t\t\t\t\tif (local) {\n\t\t\t\t\t\t// decrement the local pending move op as its already applied to local state\n\t\t\t\t\t\tif (opEntry.isLocalPendingMove) {\n\t\t\t\t\t\t\topEntry.isLocalPendingMove -= 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (\n\t\t\t\t\t\t!this.isLocalPending(op.entryId, \"isLocalPendingDelete\") &&\n\t\t\t\t\t\t!this.isLocalPending(op.entryId, \"isLocalPendingMove\")\n\t\t\t\t\t) {\n\t\t\t\t\t\tthis.updateLiveEntry(this.getLiveEntry(op.entryId).entryId, op.entryId);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tdefault: {\n\t\t\t\t\tthrow new Error(\"Unknown operation\");\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!local) {\n\t\t\t\tthis.emitValueChangedEvent(op, local);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate findInternalIndex(countEntries: number): number {\n\t\tif (countEntries < 0) {\n\t\t\tthrow new Error(\"Input count is zero\");\n\t\t}\n\n\t\tlet countDown = countEntries;\n\t\tlet entriesIterator = 0;\n\t\tfor (; entriesIterator < this.sharedArray.length; entriesIterator = entriesIterator + 1) {\n\t\t\tconst entry = this.sharedArray[entriesIterator];\n\t\t\tassert(entry !== undefined, 0xb93 /* Invalid index */);\n\t\t\tif (entry.isDeleted === false) {\n\t\t\t\tif (countDown === 0) {\n\t\t\t\t\treturn entriesIterator;\n\t\t\t\t}\n\t\t\t\tcountDown = countDown - 1;\n\t\t\t}\n\t\t}\n\t\tthrow new Error(`Count of live entries is less than required`);\n\t}\n\n\tprivate findInternalInsertionIndex(index: number): number {\n\t\treturn index === 0 ? index : this.findInternalIndex(index - 1) + 1;\n\t}\n\n\tprivate findInternalDeletionIndex(index: number): number {\n\t\treturn this.findInternalIndex(index);\n\t}\n\n\tprivate createAddEntry<TWrite>(index: number, value: Serializable<TWrite> & T): string {\n\t\tconst newEntry = this.createNewEntry(uuid(), value);\n\t\tthis.addEntry(index, newEntry);\n\t\treturn newEntry.entryId;\n\t}\n\n\tprivate addEntry(insertIndex: number, newEntry: SharedArrayEntry<T>): void {\n\t\t// in scenario where we populate 100K rows, we insert them all at the end of array.\n\t\t// slicing array is way slower than pushing elements.\n\t\tif (insertIndex === this.sharedArray.length) {\n\t\t\tthis.sharedArray.push(newEntry);\n\t\t} else {\n\t\t\tthis.sharedArray.splice(insertIndex, 0 /* deleteCount */, newEntry);\n\t\t}\n\n\t\t// Updating the idToEntryMap optimizer data set as new entry has been added\n\t\tthis.idToEntryMap.set(newEntry.entryId, newEntry);\n\t}\n\n\tprivate emitValueChangedEvent(op: ISharedArrayOperation, isLocal: boolean): void {\n\t\tthis.emit(\"valueChanged\", op, isLocal, this);\n\t}\n\n\tprivate emitRevertibleEvent(op: ISharedArrayOperation): void {\n\t\tconst revertible = new SharedArrayRevertible(this, op);\n\t\tthis.emit(\"revertible\", revertible);\n\t}\n\n\tprivate deleteCore(index: number): void {\n\t\tconst entry = this.sharedArray[index];\n\t\tassert(entry !== undefined, 0xb94 /* Invalid index */);\n\n\t\tif (entry.isDeleted) {\n\t\t\tthrow new Error(\"Entry already deleted.\");\n\t\t}\n\t\tentry.isDeleted = true;\n\n\t\t// Adding local pending counter\n\t\tentry.isLocalPendingDelete += 1;\n\t}\n\n\tprivate createMoveEntry(oldIndex: number, newIndex: number): string {\n\t\tconst oldEntry = this.sharedArray[oldIndex];\n\t\tassert(oldEntry !== undefined, 0xb95 /* Invalid index */);\n\t\tconst newEntry = this.createNewEntry<SerializableTypeForSharedArray>(\n\t\t\tuuid(),\n\t\t\toldEntry.value,\n\t\t\toldEntry.entryId,\n\t\t);\n\n\t\toldEntry.isDeleted = true;\n\t\toldEntry.nextEntryId = newEntry.entryId;\n\n\t\t// Adding local pending counter\n\t\toldEntry.isLocalPendingMove += 1;\n\n\t\tthis.addEntry(newIndex /* insertIndex */, newEntry);\n\n\t\treturn newEntry.entryId;\n\t}\n\n\t/**\n\t * Creates new entry of type SharedArrayEntry interface.\n\t * @param entryId - id for which new entry is created\n\t * @param value - value for the new entry\n\t * @param prevEntryId - prevEntryId if exists to update the previous pointer of double ended linked list\n\t */\n\tprivate createNewEntry<TWrite>(\n\t\tentryId: string,\n\t\tvalue: Serializable<TWrite> & T,\n\t\tprevEntryId?: string,\n\t): SharedArrayEntry<T> {\n\t\treturn {\n\t\t\tentryId,\n\t\t\tvalue,\n\t\t\tisAckPending: true,\n\t\t\tisDeleted: false,\n\t\t\tprevEntryId,\n\t\t\tnextEntryId: undefined,\n\t\t\tisLocalPendingDelete: 0,\n\t\t\tisLocalPendingMove: 0,\n\t\t};\n\t}\n\n\t/**\n\t * Unsets all local flags used by the DDS. This method can be used after reading from snapshott to ensure\n\t * local flags are initialized for use by the DDS.\n\t * @param entry - Entry for which the local flags have to be cleaned up\n\t */\n\tprivate unsetLocalFlags(entry: SharedArrayEntry<T>): void {\n\t\tentry.isAckPending = false;\n\t\tentry.isLocalPendingDelete = 0;\n\t\tentry.isLocalPendingMove = 0;\n\t}\n\n\t/**\n\t * Returns the index of the first entry starting with startIndex that does not have the isAckPending flag\n\t */\n\tprivate getInternalInsertIndexByIgnoringLocalPendingInserts(startIndex: number): number {\n\t\tlet localOpsIterator = startIndex;\n\t\tfor (\n\t\t\t;\n\t\t\tlocalOpsIterator < this.sharedArray.length;\n\t\t\tlocalOpsIterator = localOpsIterator + 1\n\t\t) {\n\t\t\tconst entry = this.sharedArray[localOpsIterator];\n\t\t\tassert(entry !== undefined, 0xb96 /* Invalid index */);\n\t\t\tif (!entry.isAckPending) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn localOpsIterator;\n\t}\n\n\tprivate handleInsertOp<TWrite>(\n\t\tentryId: string,\n\t\tinsertAfterEntryId: string | undefined,\n\t\tlocal: boolean,\n\t\tvalue: Serializable<TWrite> & T,\n\t): void {\n\t\tlet index = 0;\n\t\tif (local) {\n\t\t\tthis.getEntryForId(entryId).isAckPending = false;\n\t\t} else {\n\t\t\tif (insertAfterEntryId !== undefined) {\n\t\t\t\tindex = this.findIndexOfEntryId(insertAfterEntryId) + 1;\n\t\t\t}\n\t\t\tconst newEntry = this.createNewEntry(entryId, value);\n\t\t\tnewEntry.isAckPending = false;\n\t\t\tthis.addEntry(this.getInternalInsertIndexByIgnoringLocalPendingInserts(index), newEntry);\n\t\t}\n\t}\n\n\tprivate findIndexOfEntryId(entryId: string | undefined): number {\n\t\tfor (let index = 0; index < this.sharedArray.length; index = index + 1) {\n\t\t\tif (this.sharedArray[index]?.entryId === entryId) {\n\t\t\t\treturn index;\n\t\t\t}\n\t\t}\n\t\treturn -1;\n\t}\n\n\tprivate prepareToMakeEntryIdLive(entry: SharedArrayEntry<T>): void {\n\t\tconst prevIndex = this.findIndexOfEntryId(entry.prevEntryId);\n\t\tconst nextIndex = this.findIndexOfEntryId(entry.nextEntryId);\n\t\tif (prevIndex !== -1) {\n\t\t\tconst prevEntry = this.sharedArray[prevIndex];\n\t\t\tassert(prevEntry !== undefined, 0xb97 /* Invalid index */);\n\t\t\tprevEntry.nextEntryId = entry.nextEntryId;\n\t\t}\n\t\tif (nextIndex !== -1) {\n\t\t\tconst nextEntry = this.sharedArray[nextIndex];\n\t\t\tassert(nextEntry !== undefined, 0xb98 /* Invalid index */);\n\t\t\tnextEntry.prevEntryId = entry.prevEntryId;\n\t\t}\n\t\tentry.prevEntryId = undefined;\n\t\tentry.nextEntryId = undefined;\n\t}\n\n\t/**\n\t * Method that returns the live entry.\n\t * The shared array internally can store a skip list of all related entries which got created\n\t * due to move operations for the same payload/value. However, all elements except for one element\n\t * can have isDeleted flag as false indicating this is the live entry for the value.\n\t * Current implementation ensures that the last element in the skip list of entries is the liveEntry/\n\t * last live entry\n\t *\n\t * @param entryId - Entry id of any node in the skip list for the same payload/value\n\t */\n\tprivate getLiveEntry(entryId: string): SharedArrayEntry<T> {\n\t\tlet liveEntry = this.getEntryForId(entryId);\n\t\twhile (liveEntry.nextEntryId !== undefined && liveEntry.nextEntryId) {\n\t\t\tliveEntry = this.getEntryForId(liveEntry.nextEntryId);\n\t\t}\n\t\treturn liveEntry;\n\t}\n\n\t/**\n\t * We track sequence of moves for a entry in the shared array using doubly linked skip list.\n\t * This utility function helps us keep track of the current position of an entry.value by marking the entry\n\t * at previous position deleted and appending the entry at the new position at the end of the double linked\n\t * list for that entry.value.\n\t */\n\tprivate updateLiveEntry(oldLiveEntryEntryId: string, newLiveEntryEntryId: string): void {\n\t\tconst oldLiveEntry = this.getEntryForId(oldLiveEntryEntryId);\n\t\tconst newLiveEntry = this.getEntryForId(newLiveEntryEntryId);\n\t\tif (oldLiveEntryEntryId === newLiveEntryEntryId) {\n\t\t\toldLiveEntry.isDeleted = false;\n\t\t} else {\n\t\t\tthis.prepareToMakeEntryIdLive(newLiveEntry);\n\t\t\t// Make entryId live\n\t\t\toldLiveEntry.nextEntryId = newLiveEntryEntryId;\n\t\t\tnewLiveEntry.prevEntryId = oldLiveEntryEntryId;\n\t\t\tnewLiveEntry.isDeleted = false;\n\t\t\toldLiveEntry.isDeleted = true;\n\t\t}\n\t}\n\n\t/**\n\t * We track sequence of moves for a entry in the shared array using doubly linked skip list.\n\t * This utility function helps to insert the new entry as dead entry and reconnecting the double linked list with\n\t * existingEntry -\\> deadeEntry(appended) -\\> existing chain(if any).\n\t */\n\tprivate updateDeadEntry(existingEntryId: string, deadEntryId: string): void {\n\t\tconst existingEntry = this.getEntryForId(existingEntryId);\n\t\tconst deadEntry = this.getEntryForId(deadEntryId);\n\n\t\t// update dead entry's next to existingEntry's next, if existingEntry's next entry exists.\n\t\t// It can be undefined if the exiting element is the last element (or only element) of chain.\n\t\tif (existingEntry.nextEntryId !== undefined) {\n\t\t\tdeadEntry.nextEntryId = existingEntry.nextEntryId;\n\t\t\tthis.getEntryForId(existingEntry.nextEntryId).prevEntryId = deadEntryId;\n\t\t}\n\n\t\t// update current entry's next pointer to dead entry and vice versa.\n\t\texistingEntry.nextEntryId = deadEntryId;\n\t\tdeadEntry.prevEntryId = existingEntryId;\n\t\tdeadEntry.isDeleted = true;\n\t}\n\n\tprotected applyStashedOp(_content: unknown): void {\n\t\tthrow new Error(\"Not implemented\");\n\t}\n}\n"]}
1
+ {"version":3,"file":"sharedArray.js","sourceRoot":"","sources":["../../src/array/sharedArray.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA8E;AAY9E,0EAA+F;AAE/F,qEAAuF;AAEvF,0EAA2E;AAC3E,+BAAkC;AAWlC,mEAA6D;AAQ7D,yEAA2D;AAC3D,yEAAmE;AAEnE,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAElC;;;;GAIG;AACH,MAAa,gBACZ,SAAQ,uBAAgC;IAkBxC;;;;;;OAMG;IACI,MAAM,CAAC,MAAM,CACnB,OAA+B,EAC/B,EAAW;QAEX,OAAO,OAAO,CAAC,aAAa,CAAC,EAAE,EAAE,0CAAkB,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C,kBAAkB,EACrB,KAAK,EAAE,wBAAwB;gBAC/B,EAAE,CAAC,KAAK,CACR,CAAC;gBACF,MAAM;YACP,CAAC;YACD,KAAK,wCAAa,CAAC,WAAW,CAAC,CAAC,CAAC;gBAChC,IAAI,CAAC,cAAc,CAAC,EAAE,EAAE,KAAK,CAAC,gCAAgC,CAAC,CAAC;gBAChE,MAAM;YACP,CAAC;YACD,KAAK,wCAAa,CAAC,SAAS,CAAC,CAAC,CAAC;gBAC9B,IAAI,CAAC,YAAY,CAAC,EAAE,EAAE,KAAK,CAAC,gCAAgC,CAAC,CAAC;gBAC9D,MAAM;YACP,CAAC;YACD,KAAK,wCAAa,CAAC,MAAM,CAAC,CAAC,CAAC;gBAC3B,IAAI,CAAC,cAAc,CAAC,EAAE,EAAE,KAAK,CAAC,gCAAgC,CAAC,CAAC;gBAChE,MAAM;YACP,CAAC;YACD,KAAK,wCAAa,CAAC,UAAU,CAAC,CAAC,CAAC;gBAC/B,IAAI,CAAC,kBAAkB,CAAC,EAAE,EAAE,KAAK,CAAC,gCAAgC,CAAC,CAAC;gBACpE,MAAM;YACP,CAAC;YACD,OAAO,CAAC,CAAC,CAAC;gBACT,IAAA,0BAAe,EAAC,EAAE,CAAC,CAAC;YACrB,CAAC;QACF,CAAC;QACD,IAAI,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC;IAC7B,CAAC;CACD;AA3zBD,4CA2zBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport type {\n\tSerializable,\n\tIChannelAttributes,\n\tIFluidDataStoreRuntime,\n\tIChannelFactory,\n\tIChannelStorageService,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport type {\n\tISequencedDocumentMessage,\n\tITree,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { FileMode, MessageType, TreeEntry } from \"@fluidframework/driver-definitions/internal\";\nimport type { ISummaryTreeWithStats } from \"@fluidframework/runtime-definitions/internal\";\nimport { convertToSummaryTreeWithStats } from \"@fluidframework/runtime-utils/internal\";\nimport type { IFluidSerializer } from \"@fluidframework/shared-object-base/internal\";\nimport { SharedObject } from \"@fluidframework/shared-object-base/internal\";\nimport { v4 as uuid } from \"uuid\";\n\nimport type {\n\tISharedArrayEvents,\n\tISharedArray,\n\tISharedArrayRevertible,\n\tSerializableTypeForSharedArray,\n\tSharedArrayEntry,\n\tSnapshotFormat,\n\tSharedArrayEntryCore,\n} from \"./interfaces.js\";\nimport { SharedArrayFactory } from \"./sharedArrayFactory.js\";\nimport type {\n\tISharedArrayOperation,\n\tIDeleteOperation,\n\tIMoveOperation,\n\tIToggleMoveOperation,\n\tIToggleOperation,\n} from \"./sharedArrayOperations.js\";\nimport { OperationType } from \"./sharedArrayOperations.js\";\nimport { SharedArrayRevertible } from \"./sharedArrayRevertible.js\";\n\nconst snapshotFileName = \"header\";\n\n/**\n * Represents a shared array that allows communication between distributed clients.\n *\n * @internal\n */\nexport class SharedArrayClass<T extends SerializableTypeForSharedArray>\n\textends SharedObject<ISharedArrayEvents>\n\timplements ISharedArray<T>, ISharedArrayRevertible\n{\n\t/**\n\t * Stores the data held by this shared array.\n\t */\n\tprivate sharedArray: SharedArrayEntry<T>[];\n\n\t/**\n\t * Stores a map of entryid to entries of the sharedArray. This is meant of search optimizations and\n\t * so shouldn't be snapshotted.\n\t * Note: This map needs to be updated only when the sharedArray is being deserialized and when new entries are\n\t * being added. New entries are added upon insert ops and the second leg of the move op.\n\t * As we don't delete the entries once created, deletion or move to another position needs no special\n\t * handling for this data structure\n\t */\n\tprivate readonly idToEntryMap: Map<string, SharedArrayEntry<T>>;\n\n\t/**\n\t * Create a new shared array\n\t *\n\t * @param runtime - data store runtime the new shared array belongs to\n\t * @param id - optional name of the shared array\n\t * @returns newly create shared array (but not attached yet)\n\t */\n\tpublic static create<T extends SerializableTypeForSharedArray>(\n\t\truntime: IFluidDataStoreRuntime,\n\t\tid?: string,\n\t): SharedArrayClass<T> {\n\t\treturn runtime.createChannel(id, SharedArrayFactory.Type) as SharedArrayClass<T>;\n\t}\n\n\t/**\n\t * Get a factory for SharedArray to register with the data store.\n\t *\n\t * @returns a factory that creates and load SharedArray\n\t */\n\tpublic static getFactory<T extends SerializableTypeForSharedArray>(): IChannelFactory {\n\t\treturn new SharedArrayFactory<T>();\n\t}\n\n\t/**\n\t * Constructs a new shared array. If the object is non-local an id and service interfaces will\n\t * be provided\n\t *\n\t * @param id - optional name of the shared array\n\t * @param runtime - data store runtime the shared array belongs to\n\t * @param attributes - represents the attributes of a channel/DDS.\n\t */\n\tpublic constructor(\n\t\tid: string,\n\t\truntime: IFluidDataStoreRuntime,\n\t\tattributes: IChannelAttributes,\n\t) {\n\t\tsuper(id, runtime, attributes, \"loop_sharedArray_\" /* telemetryContextPrefix */);\n\t\tthis.sharedArray = [];\n\t\tthis.idToEntryMap = new Map<string, SharedArrayEntry<T>>();\n\t}\n\n\t/**\n\t * Method that returns the ordered list of the items held in the DDS at this point in time.\n\t * Note: This is only a snapshot of the array\n\t */\n\tpublic get(): readonly T[] {\n\t\treturn this.sharedArray.filter((item) => !item.isDeleted).map((entry) => entry.value);\n\t}\n\n\tprotected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats {\n\t\t// Deep copy and unset the local flags. Needed when snapshotting is happening for runtime not attached\n\t\tconst dataArrayCopy: SharedArrayEntryCore<T>[] = [];\n\t\tfor (const entry of this.sharedArray) {\n\t\t\tdataArrayCopy.push({\n\t\t\t\tentryId: entry.entryId,\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\t\t\tvalue: JSON.parse(serializer.stringify(entry.value, this.handle)),\n\t\t\t\tisDeleted: entry.isDeleted,\n\t\t\t\tprevEntryId: entry.prevEntryId,\n\t\t\t\tnextEntryId: entry.nextEntryId,\n\t\t\t});\n\t\t}\n\n\t\t// We are snapshotting current client data so autoacking pending local.\n\t\t// Assumption : This should happen only for offline client creating the array. All other scenarios should\n\t\t// get to MSN - where there can be no local pending possible.\n\t\tfor (const entry of this.sharedArray) {\n\t\t\tthis.unsetLocalFlags(entry);\n\t\t}\n\t\tconst contents: SnapshotFormat<SharedArrayEntryCore<T>> = {\n\t\t\tdataArray: dataArrayCopy,\n\t\t};\n\t\tconst tree: ITree = {\n\t\t\tentries: [\n\t\t\t\t{\n\t\t\t\t\tmode: FileMode.File,\n\t\t\t\t\tpath: snapshotFileName,\n\t\t\t\t\ttype: TreeEntry[TreeEntry.Blob],\n\t\t\t\t\tvalue: {\n\t\t\t\t\t\tcontents: serializer.stringify(contents, this.handle),\n\t\t\t\t\t\t// eslint-disable-next-line unicorn/text-encoding-identifier-case\n\t\t\t\t\t\tencoding: \"utf-8\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t};\n\t\tconst summaryTreeWithStats = convertToSummaryTreeWithStats(tree);\n\n\t\treturn summaryTreeWithStats;\n\t}\n\n\tpublic insertBulkAfter<TWrite>(\n\t\tref: T | undefined,\n\t\tvalues: (Serializable<TWrite> & T)[],\n\t): void {\n\t\tlet itemIndex: number = 0;\n\n\t\tif (ref !== undefined) {\n\t\t\tfor (itemIndex = this.sharedArray.length - 1; itemIndex > 0; itemIndex -= 1) {\n\t\t\t\tconst item = this.sharedArray[itemIndex];\n\t\t\t\tif (item && !item.isDeleted && item.value === ref) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Add one since we're inserting it after this rowId. If rowId is not found, we will get -1, which after\n\t\t\t// adding one, will be 0, which will place the new rows at the right place too\n\t\t\titemIndex += 1;\n\t\t}\n\n\t\t// Insert new elements\n\t\tfor (const value of values) {\n\t\t\tthis.insertCore(itemIndex, value);\n\t\t\titemIndex += 1;\n\t\t}\n\t}\n\n\tpublic insert<TWrite>(index: number, value: Serializable<TWrite> & T): void {\n\t\tif (index < 0) {\n\t\t\tthrow new Error(\"Invalid input: Insertion index provided is less than 0.\");\n\t\t}\n\t\tthis.insertCore(this.findInternalInsertionIndex(index), value);\n\t}\n\n\tprivate insertCore<TWrite>(indexInternal: number, value: Serializable<TWrite> & T): void {\n\t\tconst insertAfterEntryId =\n\t\t\tindexInternal >= 1 ? this.sharedArray[indexInternal - 1]?.entryId : undefined;\n\t\tconst newEntryId = this.createAddEntry(indexInternal, value);\n\n\t\tconst op = {\n\t\t\ttype: OperationType.insertEntry,\n\t\t\tentryId: newEntryId,\n\t\t\tvalue,\n\t\t\tinsertAfterEntryId,\n\t\t};\n\n\t\tthis.emitValueChangedEvent(op, true /* isLocal */);\n\t\tthis.emitRevertibleEvent(op);\n\n\t\t// If we are not attached, don't submit the op.\n\t\tif (!this.isAttached()) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.submitLocalMessage(op);\n\t}\n\n\tpublic delete(index: number): void {\n\t\tif (index < 0) {\n\t\t\tthrow new Error(\"Invalid input: Deletion index provided is less than 0.\");\n\t\t}\n\n\t\tconst indexInternal: number = this.findInternalDeletionIndex(index);\n\n\t\tconst entry = this.sharedArray[indexInternal];\n\t\tassert(entry !== undefined, 0xb90 /* Invalid index */);\n\t\tconst entryId = entry.entryId;\n\t\tthis.deleteCore(indexInternal);\n\n\t\tconst op: IDeleteOperation = {\n\t\t\ttype: OperationType.deleteEntry,\n\t\t\tentryId,\n\t\t};\n\t\tthis.emitValueChangedEvent(op, true /* isLocal */);\n\t\tthis.emitRevertibleEvent(op);\n\n\t\t// If we are not attached, don't submit the op.\n\t\tif (!this.isAttached()) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.submitLocalMessage(op);\n\t}\n\n\tpublic rearrangeToFront(values: T[]): void {\n\t\tfor (let toIndex = 0; toIndex < values.length; toIndex += 1) {\n\t\t\tconst value = values[toIndex];\n\t\t\t// Can skip searching first <toIndex> indices, as they contain elements we already moved.\n\t\t\tfor (let fromIndex = toIndex; fromIndex < this.sharedArray.length; fromIndex += 1) {\n\t\t\t\tconst item = this.sharedArray[fromIndex];\n\t\t\t\tassert(item !== undefined, 0xb91 /* Invalid index */);\n\t\t\t\tif (item.value !== value) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (\n\t\t\t\t\t!item.isDeleted &&\n\t\t\t\t\t// Moving to and from the same index makes no sense, so noOp\n\t\t\t\t\tfromIndex !== toIndex &&\n\t\t\t\t\t// Moving the same entry from current location to its immediate next makes no sense so noOp\n\t\t\t\t\ttoIndex !== fromIndex + 1\n\t\t\t\t) {\n\t\t\t\t\tthis.moveCore(fromIndex, toIndex);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Moves the DDS entry from one index to another\n\t *\n\t * @param fromIndex - User index of the element to be moved\n\t * @param toIndex - User index to which the element should move to\n\t */\n\tpublic move(fromIndex: number, toIndex: number): void {\n\t\tif (fromIndex < 0) {\n\t\t\tthrow new Error(\"Invalid input: fromIndex value provided is less than 0\");\n\t\t}\n\n\t\tif (toIndex < 0) {\n\t\t\tthrow new Error(\"Invalid input: toIndex value provided is less than 0\");\n\t\t}\n\n\t\tif (\n\t\t\t// Moving to and from the same index makes no sense, so noOp\n\t\t\tfromIndex === toIndex ||\n\t\t\t// Moving the same entry from current location to its immediate next makes no sense so noOp\n\t\t\ttoIndex === fromIndex + 1\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\tconst fromIndexInternal: number = this.findInternalDeletionIndex(fromIndex);\n\t\tconst toIndexInternal: number = this.findInternalInsertionIndex(toIndex);\n\n\t\tthis.moveCore(fromIndexInternal, toIndexInternal);\n\t}\n\n\tprivate moveCore(fromIndexInternal: number, toIndexInternal: number): void {\n\t\tconst insertAfterEntryId =\n\t\t\ttoIndexInternal >= 1 ? this.sharedArray[toIndexInternal - 1]?.entryId : undefined;\n\t\tconst entryId = this.sharedArray[fromIndexInternal]?.entryId;\n\t\tassert(entryId !== undefined, 0xb92 /* Invalid index */);\n\t\tconst changedToEntryId = this.createMoveEntry(fromIndexInternal, toIndexInternal);\n\n\t\tconst op: IMoveOperation = {\n\t\t\ttype: OperationType.moveEntry,\n\t\t\tentryId,\n\t\t\tinsertAfterEntryId,\n\t\t\tchangedToEntryId,\n\t\t};\n\t\tthis.emitValueChangedEvent(op, true /* isLocal */);\n\t\tthis.emitRevertibleEvent(op);\n\n\t\t// If we are not attached, don't submit the op.\n\t\tif (!this.isAttached()) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.submitLocalMessage(op);\n\t}\n\n\t/**\n\t * Method used to do undo/redo operation for the given entry id. This method is\n\t * used for undo/redo of only insert and delete operations. Move operation is NOT handled\n\t * by this method\n\t *\n\t * @param entryId - Entry Id for which the the undo/redo operation is to be applied\n\t */\n\tpublic toggle(entryId: string): void {\n\t\tconst liveEntry = this.getLiveEntry(entryId);\n\t\tconst isDeleted = !liveEntry.isDeleted;\n\n\t\t// Adding local pending counter\n\t\tthis.getEntryForId(entryId).isLocalPendingDelete += 1;\n\n\t\t// Toggling the isDeleted flag to undo the last operation for the skip list payload/value\n\t\tliveEntry.isDeleted = isDeleted;\n\n\t\tconst op: IToggleOperation = {\n\t\t\ttype: OperationType.toggle,\n\t\t\tentryId,\n\t\t\tisDeleted,\n\t\t};\n\t\tthis.emitValueChangedEvent(op, true /* isLocal */);\n\t\tthis.emitRevertibleEvent(op);\n\n\t\t// If we are not attached, don't submit the op.\n\t\tif (!this.isAttached()) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.submitLocalMessage(op);\n\t}\n\n\t/**\n\t * Method to do undo/redo of move operation. All entries of the same payload/value are stored\n\t * in the same doubly linked skip list. This skip list is updated upon every move by adding the\n\t * new location as a new entry in the skip list and update the isDeleted flag to indicate the new\n\t * entry is the cuurent live location for the user.\n\t *\n\t * @param oldEntryId - EntryId of the last live entry\n\t * @param newEntryId - EntryId of the to be live entry\n\t */\n\tpublic toggleMove(oldEntryId: string, newEntryId: string): void {\n\t\tif (this.getEntryForId(newEntryId).isDeleted) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Adding local pending counter\n\t\tthis.getEntryForId(oldEntryId).isLocalPendingMove += 1;\n\n\t\tthis.updateLiveEntry(newEntryId, oldEntryId);\n\n\t\tconst op: IToggleMoveOperation = {\n\t\t\ttype: OperationType.toggleMove,\n\t\t\tentryId: oldEntryId,\n\t\t\tchangedToEntryId: newEntryId,\n\t\t};\n\t\tthis.emitValueChangedEvent(op, true /* isLocal */);\n\t\tthis.emitRevertibleEvent(op);\n\n\t\t// If we are not attached, don't submit the op.\n\t\tif (!this.isAttached()) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.submitLocalMessage(op);\n\t}\n\n\t/**\n\t * Load share array from snapshot\n\t *\n\t * @param storage - the storage to get the snapshot from\n\t * @returns - promise that resolved when the load is completed\n\t */\n\tprotected async loadCore(storage: IChannelStorageService): Promise<void> {\n\t\tconst header = await storage.readBlob(snapshotFileName);\n\t\t// eslint-disable-next-line unicorn/text-encoding-identifier-case\n\t\tconst utf8 = new TextDecoder(\"utf-8\").decode(header);\n\t\t// Note: IFluidSerializer.parse() doesn't guarantee any typing; the explicit typing here is based on this code's\n\t\t// knowledge of what it is deserializing.\n\t\tconst deserializedSharedArray = this.serializer.parse(utf8) as {\n\t\t\tdataArray: SharedArrayEntry<T>[];\n\t\t};\n\t\tthis.sharedArray = deserializedSharedArray.dataArray;\n\t\t// Initializing the idToEntryMap optimizer data set\n\t\tfor (const entry of this.sharedArray) {\n\t\t\tthis.idToEntryMap.set(entry.entryId, entry);\n\t\t\tthis.unsetLocalFlags(entry);\n\t\t}\n\t}\n\n\t/**\n\t * Callback on disconnect\n\t */\n\tprotected onDisconnect(): void {}\n\n\t/**\n\t * Tracks the doubly linked skip list for the given entry to identify local pending counter attribute.\n\t * It signifies if a local pending operation exists for the payload/value being tracked in the skip list\n\t *\n\t * returns true if counterAttribute's count \\> 0\n\t * @param entryId - id for which counter attribute is to be tracked in chian.\n\t * @param counterAttribute - flag or property name from SharedArrayEntry whose counter is to be tracked.\n\t */\n\tprivate isLocalPending(\n\t\tentryId: string,\n\t\tcounterAttribute: keyof SharedArrayEntry<T>,\n\t): boolean {\n\t\tconst getCounterAttributeValue = (\n\t\t\tentry: SharedArrayEntry<T>,\n\t\t\tcounterAttr: keyof SharedArrayEntry<T>,\n\t\t): number => {\n\t\t\treturn entry[counterAttr] as number;\n\t\t};\n\n\t\tconst inputEntry = this.getEntryForId(entryId);\n\t\tlet prevEntryId = inputEntry.prevEntryId;\n\t\tlet nextEntryId = inputEntry.nextEntryId;\n\t\tif (getCounterAttributeValue(inputEntry, counterAttribute) > 0) {\n\t\t\treturn true;\n\t\t}\n\t\t// track back in chain\n\t\twhile (prevEntryId !== undefined && prevEntryId) {\n\t\t\tconst prevEntry = this.getEntryForId(prevEntryId);\n\t\t\tif (getCounterAttributeValue(prevEntry, counterAttribute)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tprevEntryId = prevEntry.prevEntryId;\n\t\t}\n\n\t\t// track forward in the chain\n\t\twhile (nextEntryId !== undefined && nextEntryId) {\n\t\t\tconst nextEntry = this.getEntryForId(nextEntryId);\n\t\t\tif (getCounterAttributeValue(nextEntry, counterAttribute)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tnextEntryId = nextEntry.nextEntryId;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tprivate getEntryForId(entryId: string): SharedArrayEntry<T> {\n\t\treturn this.idToEntryMap.get(entryId) as SharedArrayEntry<T>;\n\t}\n\n\t/**\n\t * Process a shared array operation\n\t *\n\t * @param message - the message to prepare\n\t * @param local - whether the message was sent by the local client\n\t * @param _localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t */\n\tprotected processCore(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocal: boolean,\n\t\t_localOpMetadata: unknown,\n\t): void {\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison\n\t\tif (message.type === MessageType.Operation) {\n\t\t\tconst op = message.contents as ISharedArrayOperation<T>;\n\t\t\tswitch (op.type) {\n\t\t\t\tcase OperationType.insertEntry: {\n\t\t\t\t\tthis.handleInsertOp<SerializableTypeForSharedArray>(\n\t\t\t\t\t\top.entryId,\n\t\t\t\t\t\top.insertAfterEntryId,\n\t\t\t\t\t\tlocal,\n\t\t\t\t\t\top.value,\n\t\t\t\t\t);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase OperationType.deleteEntry: {\n\t\t\t\t\tthis.handleDeleteOp(op, local);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase OperationType.moveEntry: {\n\t\t\t\t\tthis.handleMoveOp(op, local);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase OperationType.toggle: {\n\t\t\t\t\tthis.handleToggleOp(op, local);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase OperationType.toggleMove: {\n\t\t\t\t\tthis.handleToggleMoveOp(op, local);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tdefault: {\n\t\t\t\t\tthrow new Error(\"Unknown operation\");\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!local) {\n\t\t\t\tthis.emitValueChangedEvent(op, local);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate handleInsertOp<TWrite>(\n\t\tentryId: string,\n\t\tinsertAfterEntryId: string | undefined,\n\t\tlocal: boolean,\n\t\tvalue: Serializable<TWrite> & T,\n\t): void {\n\t\tlet index = 0;\n\t\tif (local) {\n\t\t\tthis.getEntryForId(entryId).isAckPending = false;\n\t\t} else {\n\t\t\tif (insertAfterEntryId !== undefined) {\n\t\t\t\tindex = this.findIndexOfEntryId(insertAfterEntryId) + 1;\n\t\t\t}\n\t\t\tconst newEntry = this.createNewEntry(entryId, value);\n\t\t\tnewEntry.isAckPending = false;\n\t\t\tthis.addEntry(this.getInternalInsertIndexByIgnoringLocalPendingInserts(index), newEntry);\n\t\t}\n\t}\n\n\tprivate handleDeleteOp(op: IDeleteOperation, local: boolean): void {\n\t\tconst opEntry = this.getEntryForId(op.entryId);\n\t\tif (local) {\n\t\t\t// Decrementing local pending counter as op is already applied to local state\n\t\t\topEntry.isLocalPendingDelete -= 1;\n\t\t} else {\n\t\t\t// If local pending, then ignore else apply the remote op\n\t\t\tif (!this.isLocalPending(op.entryId, \"isLocalPendingDelete\")) {\n\t\t\t\t// last element in skip list is the most recent and live entry, so marking it deleted\n\t\t\t\tthis.getLiveEntry(op.entryId).isDeleted = true;\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate handleMoveOp(op: IMoveOperation, local: boolean): void {\n\t\tconst opEntry = this.getEntryForId(op.entryId);\n\t\tthis.handleInsertOp<SerializableTypeForSharedArray>(\n\t\t\top.changedToEntryId,\n\t\t\top.insertAfterEntryId,\n\t\t\tlocal,\n\t\t\topEntry.value,\n\t\t);\n\t\tif (local) {\n\t\t\t// decrement the local pending move op as its already applied to local state\n\t\t\topEntry.isLocalPendingMove -= 1;\n\t\t} else {\n\t\t\tconst newElementEntryId = op.changedToEntryId;\n\t\t\tconst newElement = this.getEntryForId(newElementEntryId);\n\t\t\t// If local pending then simply mark the new location dead as finally the local op will win\n\t\t\tif (\n\t\t\t\tthis.isLocalPending(op.entryId, \"isLocalPendingDelete\") ||\n\t\t\t\tthis.isLocalPending(op.entryId, \"isLocalPendingMove\")\n\t\t\t) {\n\t\t\t\tthis.updateDeadEntry(op.entryId, newElementEntryId);\n\t\t\t} else {\n\t\t\t\t// move the element\n\t\t\t\tconst liveEntry = this.getLiveEntry(op.entryId);\n\t\t\t\tconst isDeleted = liveEntry.isDeleted;\n\t\t\t\tthis.updateLiveEntry(liveEntry.entryId, newElementEntryId);\n\t\t\t\t// mark newly added element as deleted if existing live element was already deleted\n\t\t\t\tif (isDeleted) {\n\t\t\t\t\tnewElement.isDeleted = isDeleted;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate handleToggleOp(op: IToggleOperation, local: boolean): void {\n\t\tconst opEntry = this.getEntryForId(op.entryId);\n\t\tif (local) {\n\t\t\t// decrement the local pending delete op as its already applied to local state\n\t\t\tif (opEntry.isLocalPendingDelete) {\n\t\t\t\topEntry.isLocalPendingDelete -= 1;\n\t\t\t}\n\t\t} else {\n\t\t\tif (!this.isLocalPending(op.entryId, \"isLocalPendingDelete\")) {\n\t\t\t\tthis.getLiveEntry(op.entryId).isDeleted = op.isDeleted;\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate handleToggleMoveOp(op: IToggleMoveOperation, local: boolean): void {\n\t\tconst opEntry = this.getEntryForId(op.entryId);\n\t\tif (local) {\n\t\t\t// decrement the local pending move op as its already applied to local state\n\t\t\tif (opEntry.isLocalPendingMove) {\n\t\t\t\topEntry.isLocalPendingMove -= 1;\n\t\t\t}\n\t\t} else if (\n\t\t\t!this.isLocalPending(op.entryId, \"isLocalPendingDelete\") &&\n\t\t\t!this.isLocalPending(op.entryId, \"isLocalPendingMove\")\n\t\t) {\n\t\t\tthis.updateLiveEntry(this.getLiveEntry(op.entryId).entryId, op.entryId);\n\t\t}\n\t}\n\n\tprivate findInternalIndex(countEntries: number): number {\n\t\tif (countEntries < 0) {\n\t\t\tthrow new Error(\"Input count is zero\");\n\t\t}\n\n\t\tlet countDown = countEntries;\n\t\tlet entriesIterator = 0;\n\t\tfor (; entriesIterator < this.sharedArray.length; entriesIterator = entriesIterator + 1) {\n\t\t\tconst entry = this.sharedArray[entriesIterator];\n\t\t\tassert(entry !== undefined, 0xb93 /* Invalid index */);\n\t\t\tif (entry.isDeleted === false) {\n\t\t\t\tif (countDown === 0) {\n\t\t\t\t\treturn entriesIterator;\n\t\t\t\t}\n\t\t\t\tcountDown = countDown - 1;\n\t\t\t}\n\t\t}\n\t\tthrow new Error(`Count of live entries is less than required`);\n\t}\n\n\tprivate findInternalInsertionIndex(index: number): number {\n\t\treturn index === 0 ? index : this.findInternalIndex(index - 1) + 1;\n\t}\n\n\tprivate findInternalDeletionIndex(index: number): number {\n\t\treturn this.findInternalIndex(index);\n\t}\n\n\tprivate createAddEntry<TWrite>(index: number, value: Serializable<TWrite> & T): string {\n\t\tconst newEntry = this.createNewEntry(uuid(), value);\n\t\tthis.addEntry(index, newEntry);\n\t\treturn newEntry.entryId;\n\t}\n\n\tprivate addEntry(insertIndex: number, newEntry: SharedArrayEntry<T>): void {\n\t\t// in scenario where we populate 100K rows, we insert them all at the end of array.\n\t\t// slicing array is way slower than pushing elements.\n\t\tif (insertIndex === this.sharedArray.length) {\n\t\t\tthis.sharedArray.push(newEntry);\n\t\t} else {\n\t\t\tthis.sharedArray.splice(insertIndex, 0 /* deleteCount */, newEntry);\n\t\t}\n\n\t\t// Updating the idToEntryMap optimizer data set as new entry has been added\n\t\tthis.idToEntryMap.set(newEntry.entryId, newEntry);\n\t}\n\n\tprivate emitValueChangedEvent(op: ISharedArrayOperation, isLocal: boolean): void {\n\t\tthis.emit(\"valueChanged\", op, isLocal, this);\n\t}\n\n\tprivate emitRevertibleEvent(op: ISharedArrayOperation): void {\n\t\tconst revertible = new SharedArrayRevertible(this, op);\n\t\tthis.emit(\"revertible\", revertible);\n\t}\n\n\tprivate deleteCore(index: number): void {\n\t\tconst entry = this.sharedArray[index];\n\t\tassert(entry !== undefined, 0xb94 /* Invalid index */);\n\n\t\tif (entry.isDeleted) {\n\t\t\tthrow new Error(\"Entry already deleted.\");\n\t\t}\n\t\tentry.isDeleted = true;\n\n\t\t// Adding local pending counter\n\t\tentry.isLocalPendingDelete += 1;\n\t}\n\n\tprivate createMoveEntry(oldIndex: number, newIndex: number): string {\n\t\tconst oldEntry = this.sharedArray[oldIndex];\n\t\tassert(oldEntry !== undefined, 0xb95 /* Invalid index */);\n\t\tconst newEntry = this.createNewEntry<SerializableTypeForSharedArray>(\n\t\t\tuuid(),\n\t\t\toldEntry.value,\n\t\t\toldEntry.entryId,\n\t\t);\n\n\t\toldEntry.isDeleted = true;\n\t\toldEntry.nextEntryId = newEntry.entryId;\n\n\t\t// Adding local pending counter\n\t\toldEntry.isLocalPendingMove += 1;\n\n\t\tthis.addEntry(newIndex /* insertIndex */, newEntry);\n\n\t\treturn newEntry.entryId;\n\t}\n\n\t/**\n\t * Creates new entry of type SharedArrayEntry interface.\n\t * @param entryId - id for which new entry is created\n\t * @param value - value for the new entry\n\t * @param prevEntryId - prevEntryId if exists to update the previous pointer of double ended linked list\n\t */\n\tprivate createNewEntry<TWrite>(\n\t\tentryId: string,\n\t\tvalue: Serializable<TWrite> & T,\n\t\tprevEntryId?: string,\n\t): SharedArrayEntry<T> {\n\t\treturn {\n\t\t\tentryId,\n\t\t\tvalue,\n\t\t\tisAckPending: true,\n\t\t\tisDeleted: false,\n\t\t\tprevEntryId,\n\t\t\tnextEntryId: undefined,\n\t\t\tisLocalPendingDelete: 0,\n\t\t\tisLocalPendingMove: 0,\n\t\t};\n\t}\n\n\t/**\n\t * Unsets all local flags used by the DDS. This method can be used after reading from snapshott to ensure\n\t * local flags are initialized for use by the DDS.\n\t * @param entry - Entry for which the local flags have to be cleaned up\n\t */\n\tprivate unsetLocalFlags(entry: SharedArrayEntry<T>): void {\n\t\tentry.isAckPending = false;\n\t\tentry.isLocalPendingDelete = 0;\n\t\tentry.isLocalPendingMove = 0;\n\t}\n\n\t/**\n\t * Returns the index of the first entry starting with startIndex that does not have the isAckPending flag\n\t */\n\tprivate getInternalInsertIndexByIgnoringLocalPendingInserts(startIndex: number): number {\n\t\tlet localOpsIterator = startIndex;\n\t\tfor (\n\t\t\t;\n\t\t\tlocalOpsIterator < this.sharedArray.length;\n\t\t\tlocalOpsIterator = localOpsIterator + 1\n\t\t) {\n\t\t\tconst entry = this.sharedArray[localOpsIterator];\n\t\t\tassert(entry !== undefined, 0xb96 /* Invalid index */);\n\t\t\tif (!entry.isAckPending) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn localOpsIterator;\n\t}\n\n\tprivate findIndexOfEntryId(entryId: string | undefined): number {\n\t\tfor (let index = 0; index < this.sharedArray.length; index = index + 1) {\n\t\t\tif (this.sharedArray[index]?.entryId === entryId) {\n\t\t\t\treturn index;\n\t\t\t}\n\t\t}\n\t\treturn -1;\n\t}\n\n\tprivate prepareToMakeEntryIdLive(entry: SharedArrayEntry<T>): void {\n\t\tconst prevIndex = this.findIndexOfEntryId(entry.prevEntryId);\n\t\tconst nextIndex = this.findIndexOfEntryId(entry.nextEntryId);\n\t\tif (prevIndex !== -1) {\n\t\t\tconst prevEntry = this.sharedArray[prevIndex];\n\t\t\tassert(prevEntry !== undefined, 0xb97 /* Invalid index */);\n\t\t\tprevEntry.nextEntryId = entry.nextEntryId;\n\t\t}\n\t\tif (nextIndex !== -1) {\n\t\t\tconst nextEntry = this.sharedArray[nextIndex];\n\t\t\tassert(nextEntry !== undefined, 0xb98 /* Invalid index */);\n\t\t\tnextEntry.prevEntryId = entry.prevEntryId;\n\t\t}\n\t\tentry.prevEntryId = undefined;\n\t\tentry.nextEntryId = undefined;\n\t}\n\n\t/**\n\t * Method that returns the live entry.\n\t * The shared array internally can store a skip list of all related entries which got created\n\t * due to move operations for the same payload/value. However, all elements except for one element\n\t * can have isDeleted flag as false indicating this is the live entry for the value.\n\t * Current implementation ensures that the last element in the skip list of entries is the liveEntry/\n\t * last live entry\n\t *\n\t * @param entryId - Entry id of any node in the skip list for the same payload/value\n\t */\n\tprivate getLiveEntry(entryId: string): SharedArrayEntry<T> {\n\t\tlet liveEntry = this.getEntryForId(entryId);\n\t\twhile (liveEntry.nextEntryId !== undefined && liveEntry.nextEntryId) {\n\t\t\tliveEntry = this.getEntryForId(liveEntry.nextEntryId);\n\t\t}\n\t\treturn liveEntry;\n\t}\n\n\t/**\n\t * We track sequence of moves for a entry in the shared array using doubly linked skip list.\n\t * This utility function helps us keep track of the current position of an entry.value by marking the entry\n\t * at previous position deleted and appending the entry at the new position at the end of the double linked\n\t * list for that entry.value.\n\t */\n\tprivate updateLiveEntry(oldLiveEntryEntryId: string, newLiveEntryEntryId: string): void {\n\t\tconst oldLiveEntry = this.getEntryForId(oldLiveEntryEntryId);\n\t\tconst newLiveEntry = this.getEntryForId(newLiveEntryEntryId);\n\t\tif (oldLiveEntryEntryId === newLiveEntryEntryId) {\n\t\t\toldLiveEntry.isDeleted = false;\n\t\t} else {\n\t\t\tthis.prepareToMakeEntryIdLive(newLiveEntry);\n\t\t\t// Make entryId live\n\t\t\toldLiveEntry.nextEntryId = newLiveEntryEntryId;\n\t\t\tnewLiveEntry.prevEntryId = oldLiveEntryEntryId;\n\t\t\tnewLiveEntry.isDeleted = false;\n\t\t\toldLiveEntry.isDeleted = true;\n\t\t}\n\t}\n\n\t/**\n\t * We track sequence of moves for a entry in the shared array using doubly linked skip list.\n\t * This utility function helps to insert the new entry as dead entry and reconnecting the double linked list with\n\t * existingEntry -\\> deadeEntry(appended) -\\> existing chain(if any).\n\t */\n\tprivate updateDeadEntry(existingEntryId: string, deadEntryId: string): void {\n\t\tconst existingEntry = this.getEntryForId(existingEntryId);\n\t\tconst deadEntry = this.getEntryForId(deadEntryId);\n\n\t\t// update dead entry's next to existingEntry's next, if existingEntry's next entry exists.\n\t\t// It can be undefined if the exiting element is the last element (or only element) of chain.\n\t\tif (existingEntry.nextEntryId !== undefined) {\n\t\t\tdeadEntry.nextEntryId = existingEntry.nextEntryId;\n\t\t\tthis.getEntryForId(existingEntry.nextEntryId).prevEntryId = deadEntryId;\n\t\t}\n\n\t\t// update current entry's next pointer to dead entry and vice versa.\n\t\texistingEntry.nextEntryId = deadEntryId;\n\t\tdeadEntry.prevEntryId = existingEntryId;\n\t\tdeadEntry.isDeleted = true;\n\t}\n\n\tprotected applyStashedOp(content: unknown): void {\n\t\tconst op = content as ISharedArrayOperation<T>;\n\n\t\tswitch (op.type) {\n\t\t\tcase OperationType.insertEntry: {\n\t\t\t\tthis.handleInsertOp<SerializableTypeForSharedArray>(\n\t\t\t\t\top.entryId,\n\t\t\t\t\top.insertAfterEntryId,\n\t\t\t\t\tfalse, // treat it as remote op\n\t\t\t\t\top.value,\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase OperationType.deleteEntry: {\n\t\t\t\tthis.handleDeleteOp(op, false /* local - treat as remote op */);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase OperationType.moveEntry: {\n\t\t\t\tthis.handleMoveOp(op, false /* local - treat as remote op */);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase OperationType.toggle: {\n\t\t\t\tthis.handleToggleOp(op, false /* local - treat as remote op */);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase OperationType.toggleMove: {\n\t\t\t\tthis.handleToggleMoveOp(op, false /* local - treat as remote op */);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tunreachableCase(op);\n\t\t\t}\n\t\t}\n\t\tthis.submitLocalMessage(op);\n\t}\n}\n"]}
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export declare const pkgName = "@fluidframework/legacy-dds";
8
- export declare const pkgVersion = "2.52.0";
8
+ export declare const pkgVersion = "2.53.0";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -8,5 +8,5 @@
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.pkgVersion = exports.pkgName = void 0;
10
10
  exports.pkgName = "@fluidframework/legacy-dds";
11
- exports.pkgVersion = "2.52.0";
11
+ exports.pkgVersion = "2.53.0";
12
12
  //# sourceMappingURL=packageVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,4BAA4B,CAAC;AACvC,QAAA,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/legacy-dds\";\nexport const pkgVersion = \"2.52.0\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,4BAA4B,CAAC;AACvC,QAAA,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/legacy-dds\";\nexport const pkgVersion = \"2.53.0\";\n"]}
@@ -117,6 +117,11 @@ export declare class SharedArrayClass<T extends SerializableTypeForSharedArray>
117
117
  * For messages from a remote client, this will be undefined.
118
118
  */
119
119
  protected processCore(message: ISequencedDocumentMessage, local: boolean, _localOpMetadata: unknown): void;
120
+ private handleInsertOp;
121
+ private handleDeleteOp;
122
+ private handleMoveOp;
123
+ private handleToggleOp;
124
+ private handleToggleMoveOp;
120
125
  private findInternalIndex;
121
126
  private findInternalInsertionIndex;
122
127
  private findInternalDeletionIndex;
@@ -143,7 +148,6 @@ export declare class SharedArrayClass<T extends SerializableTypeForSharedArray>
143
148
  * Returns the index of the first entry starting with startIndex that does not have the isAckPending flag
144
149
  */
145
150
  private getInternalInsertIndexByIgnoringLocalPendingInserts;
146
- private handleInsertOp;
147
151
  private findIndexOfEntryId;
148
152
  private prepareToMakeEntryIdLive;
149
153
  /**
@@ -170,6 +174,6 @@ export declare class SharedArrayClass<T extends SerializableTypeForSharedArray>
170
174
  * existingEntry -\> deadeEntry(appended) -\> existing chain(if any).
171
175
  */
172
176
  private updateDeadEntry;
173
- protected applyStashedOp(_content: unknown): void;
177
+ protected applyStashedOp(content: unknown): void;
174
178
  }
175
179
  //# sourceMappingURL=sharedArray.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sharedArray.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