@fluidframework/legacy-dds 2.53.0 → 2.60.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.
Files changed (67) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/api-report/{legacy-dds.legacy.alpha.api.md → legacy-dds.legacy.beta.api.md} +20 -20
  3. package/dist/array/interfaces.d.ts +4 -8
  4. package/dist/array/interfaces.d.ts.map +1 -1
  5. package/dist/array/interfaces.js.map +1 -1
  6. package/dist/array/sharedArray.d.ts +8 -0
  7. package/dist/array/sharedArray.d.ts.map +1 -1
  8. package/dist/array/sharedArray.js +108 -8
  9. package/dist/array/sharedArray.js.map +1 -1
  10. package/dist/array/sharedArrayFactory.d.ts +2 -4
  11. package/dist/array/sharedArrayFactory.d.ts.map +1 -1
  12. package/dist/array/sharedArrayFactory.js +2 -4
  13. package/dist/array/sharedArrayFactory.js.map +1 -1
  14. package/dist/array/sharedArrayOperations.d.ts +9 -18
  15. package/dist/array/sharedArrayOperations.d.ts.map +1 -1
  16. package/dist/array/sharedArrayOperations.js +1 -2
  17. package/dist/array/sharedArrayOperations.js.map +1 -1
  18. package/dist/packageVersion.d.ts +1 -1
  19. package/dist/packageVersion.js +1 -1
  20. package/dist/packageVersion.js.map +1 -1
  21. package/dist/signal/interfaces.d.ts +3 -6
  22. package/dist/signal/interfaces.d.ts.map +1 -1
  23. package/dist/signal/interfaces.js.map +1 -1
  24. package/dist/signal/sharedSignal.d.ts.map +1 -1
  25. package/dist/signal/sharedSignal.js +19 -9
  26. package/dist/signal/sharedSignal.js.map +1 -1
  27. package/dist/signal/sharedSignalFactory.d.ts +1 -2
  28. package/dist/signal/sharedSignalFactory.d.ts.map +1 -1
  29. package/dist/signal/sharedSignalFactory.js +1 -2
  30. package/dist/signal/sharedSignalFactory.js.map +1 -1
  31. package/lib/array/interfaces.d.ts +4 -8
  32. package/lib/array/interfaces.d.ts.map +1 -1
  33. package/lib/array/interfaces.js.map +1 -1
  34. package/lib/array/sharedArray.d.ts +8 -0
  35. package/lib/array/sharedArray.d.ts.map +1 -1
  36. package/lib/array/sharedArray.js +108 -8
  37. package/lib/array/sharedArray.js.map +1 -1
  38. package/lib/array/sharedArrayFactory.d.ts +2 -4
  39. package/lib/array/sharedArrayFactory.d.ts.map +1 -1
  40. package/lib/array/sharedArrayFactory.js +2 -4
  41. package/lib/array/sharedArrayFactory.js.map +1 -1
  42. package/lib/array/sharedArrayOperations.d.ts +9 -18
  43. package/lib/array/sharedArrayOperations.d.ts.map +1 -1
  44. package/lib/array/sharedArrayOperations.js +1 -2
  45. package/lib/array/sharedArrayOperations.js.map +1 -1
  46. package/lib/packageVersion.d.ts +1 -1
  47. package/lib/packageVersion.js +1 -1
  48. package/lib/packageVersion.js.map +1 -1
  49. package/lib/signal/interfaces.d.ts +3 -6
  50. package/lib/signal/interfaces.d.ts.map +1 -1
  51. package/lib/signal/interfaces.js.map +1 -1
  52. package/lib/signal/sharedSignal.d.ts.map +1 -1
  53. package/lib/signal/sharedSignal.js +11 -1
  54. package/lib/signal/sharedSignal.js.map +1 -1
  55. package/lib/signal/sharedSignalFactory.d.ts +1 -2
  56. package/lib/signal/sharedSignalFactory.d.ts.map +1 -1
  57. package/lib/signal/sharedSignalFactory.js +1 -2
  58. package/lib/signal/sharedSignalFactory.js.map +1 -1
  59. package/package.json +16 -16
  60. package/src/array/interfaces.ts +4 -8
  61. package/src/array/sharedArray.ts +120 -10
  62. package/src/array/sharedArrayFactory.ts +2 -4
  63. package/src/array/sharedArrayOperations.ts +9 -18
  64. package/src/packageVersion.ts +1 -1
  65. package/src/signal/interfaces.ts +3 -6
  66. package/src/signal/sharedSignal.ts +11 -2
  67. package/src/signal/sharedSignalFactory.ts +1 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # @fluid-private/legacy-dds
2
2
 
3
+ ## 2.60.0
4
+
5
+ Dependency updates only.
6
+
3
7
  ## 2.53.0
4
8
 
5
9
  Dependency updates only.
@@ -1,10 +1,10 @@
1
- ## Alpha API Report File for "@fluidframework/legacy-dds"
1
+ ## Beta API Report File for "@fluidframework/legacy-dds"
2
2
 
3
3
  > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
4
 
5
5
  ```ts
6
6
 
7
- // @alpha @legacy (undocumented)
7
+ // @beta @legacy (undocumented)
8
8
  export interface IDeleteOperation {
9
9
  // (undocumented)
10
10
  entryId: string;
@@ -12,7 +12,7 @@ export interface IDeleteOperation {
12
12
  type: typeof OperationType.deleteEntry;
13
13
  }
14
14
 
15
- // @alpha @legacy (undocumented)
15
+ // @beta @legacy (undocumented)
16
16
  export interface IInsertOperation<T = unknown> {
17
17
  // (undocumented)
18
18
  entryId: string;
@@ -24,7 +24,7 @@ export interface IInsertOperation<T = unknown> {
24
24
  value: T;
25
25
  }
26
26
 
27
- // @alpha @legacy (undocumented)
27
+ // @beta @legacy (undocumented)
28
28
  export interface IMoveOperation {
29
29
  // (undocumented)
30
30
  changedToEntryId: string;
@@ -36,7 +36,7 @@ export interface IMoveOperation {
36
36
  type: typeof OperationType.moveEntry;
37
37
  }
38
38
 
39
- // @alpha @legacy (undocumented)
39
+ // @beta @legacy (undocumented)
40
40
  export interface IRevertible {
41
41
  // (undocumented)
42
42
  dispose(): void;
@@ -44,7 +44,7 @@ export interface IRevertible {
44
44
  revert(): void;
45
45
  }
46
46
 
47
- // @alpha @legacy
47
+ // @beta @legacy
48
48
  export interface ISharedArray<T extends SerializableTypeForSharedArray> extends ISharedObject<ISharedArrayEvents> {
49
49
  // (undocumented)
50
50
  delete(index: number): void;
@@ -62,7 +62,7 @@ export interface ISharedArray<T extends SerializableTypeForSharedArray> extends
62
62
  toggleMove(oldEntryId: string, newEntryId: string): void;
63
63
  }
64
64
 
65
- // @alpha @legacy
65
+ // @beta @legacy
66
66
  export interface ISharedArrayEvents extends ISharedObjectEvents {
67
67
  // @eventProperty (undocumented)
68
68
  (event: "valueChanged", listener: (op: ISharedArrayOperation, isLocal: boolean, target: IEventThisPlaceHolder) => void): void;
@@ -70,25 +70,25 @@ export interface ISharedArrayEvents extends ISharedObjectEvents {
70
70
  (event: "revertible", listener: (revertible: IRevertible) => void): void;
71
71
  }
72
72
 
73
- // @alpha @legacy (undocumented)
73
+ // @beta @legacy (undocumented)
74
74
  export type ISharedArrayOperation<T = unknown> = IInsertOperation<T> | IDeleteOperation | IMoveOperation | ISharedArrayRevertibleOperation;
75
75
 
76
- // @alpha @legacy (undocumented)
76
+ // @beta @legacy (undocumented)
77
77
  export type ISharedArrayRevertibleOperation = IToggleOperation | IToggleMoveOperation;
78
78
 
79
- // @alpha @legacy (undocumented)
79
+ // @beta @legacy (undocumented)
80
80
  export interface ISharedSignal<T extends SerializableTypeForSharedSignal = any> extends ISharedObject<ISharedSignalEvents<T>> {
81
81
  // (undocumented)
82
82
  notify(metadata?: T): void;
83
83
  }
84
84
 
85
- // @alpha @legacy (undocumented)
85
+ // @beta @legacy (undocumented)
86
86
  export interface ISharedSignalEvents<T extends SerializableTypeForSharedSignal> extends ISharedObjectEvents {
87
87
  // (undocumented)
88
88
  (event: "notify", listener: (value: T, isLocal: boolean) => void): any;
89
89
  }
90
90
 
91
- // @alpha @legacy (undocumented)
91
+ // @beta @legacy (undocumented)
92
92
  export interface IToggleMoveOperation {
93
93
  // (undocumented)
94
94
  changedToEntryId: string;
@@ -98,7 +98,7 @@ export interface IToggleMoveOperation {
98
98
  type: typeof OperationType.toggleMove;
99
99
  }
100
100
 
101
- // @alpha @legacy (undocumented)
101
+ // @beta @legacy (undocumented)
102
102
  export interface IToggleOperation {
103
103
  // (undocumented)
104
104
  entryId: string;
@@ -108,7 +108,7 @@ export interface IToggleOperation {
108
108
  type: typeof OperationType.toggle;
109
109
  }
110
110
 
111
- // @alpha @legacy (undocumented)
111
+ // @beta @legacy (undocumented)
112
112
  export const OperationType: {
113
113
  readonly insertEntry: 0;
114
114
  readonly deleteEntry: 1;
@@ -117,22 +117,22 @@ export const OperationType: {
117
117
  readonly toggleMove: 4;
118
118
  };
119
119
 
120
- // @alpha @legacy (undocumented)
120
+ // @beta @legacy (undocumented)
121
121
  export type OperationType = (typeof OperationType)[keyof typeof OperationType];
122
122
 
123
- // @alpha @legacy
123
+ // @beta @legacy
124
124
  export type SerializableTypeForSharedArray = boolean | number | string | object | IFluidHandle;
125
125
 
126
- // @alpha @legacy
126
+ // @beta @legacy
127
127
  export type SerializableTypeForSharedSignal = boolean | number | string | IFluidHandle | object;
128
128
 
129
- // @alpha @legacy
129
+ // @beta @legacy
130
130
  export const SharedArray: ISharedObjectKind<ISharedArray<SerializableTypeForSharedArray>> & SharedObjectKind<ISharedArray<SerializableTypeForSharedArray>>;
131
131
 
132
- // @alpha @legacy
132
+ // @beta @legacy
133
133
  export const SharedArrayBuilder: <T extends SerializableTypeForSharedArray>() => ISharedObjectKind<ISharedArray<T>> & SharedObjectKind<ISharedArray<T>>;
134
134
 
135
- // @alpha @legacy
135
+ // @beta @legacy
136
136
  export const SharedSignal: ISharedObjectKind<ISharedSignal<any>> & SharedObjectKind<ISharedSignal<any>>;
137
137
 
138
138
  // (No @packageDocumentation comment for this package)
@@ -11,16 +11,14 @@ import type { ISharedArrayOperation } from "./sharedArrayOperations.js";
11
11
  * It can be used as a generic constraint (`extends SerializableTypeForSharedArray`) but is
12
12
  * *never* meant to be a concrete/real type on its own.
13
13
  *
14
- * @legacy
15
- * @alpha
14
+ * @legacy @beta
16
15
  */
17
16
  export type SerializableTypeForSharedArray = boolean | number | string | object | IFluidHandle;
18
17
  /**
19
18
  * Interface defining the events that can be emitted by the SharedArray DDS
20
19
  * and the events that can be listened to by the SharedArray DDS
21
20
  *
22
- * @legacy
23
- * @alpha
21
+ * @legacy @beta
24
22
  */
25
23
  export interface ISharedArrayEvents extends ISharedObjectEvents {
26
24
  /**
@@ -47,8 +45,7 @@ export interface ISharedArrayEvents extends ISharedObjectEvents {
47
45
  *
48
46
  * @typeParam T - The type of the SharedArray
49
47
  *
50
- * @legacy
51
- * @alpha
48
+ * @legacy @beta
52
49
  */
53
50
  export interface ISharedArray<T extends SerializableTypeForSharedArray> extends ISharedObject<ISharedArrayEvents> {
54
51
  get(): readonly T[];
@@ -132,8 +129,7 @@ export interface SnapshotFormat<T> {
132
129
  dataArray: T[];
133
130
  }
134
131
  /**
135
- * @legacy
136
- * @alpha
132
+ * @legacy @beta
137
133
  */
138
134
  export interface IRevertible {
139
135
  revert(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../src/array/interfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC3F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gDAAgD,CAAC;AACnF,OAAO,KAAK,EACX,mBAAmB,EACnB,aAAa,EACb,MAAM,6CAA6C,CAAC;AAErD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACxE;;;;;;;GAOG;AACH,MAAM,MAAM,8BAA8B,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,YAAY,CAAC;AAE/F;;;;;;GAMG;AACH,MAAM,WAAW,kBAAmB,SAAQ,mBAAmB;IAC9D;;;;;;OAMG;IACH,CACC,KAAK,EAAE,cAAc,EACrB,QAAQ,EAAE,CACT,EAAE,EAAE,qBAAqB,EACzB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,qBAAqB,KACzB,IAAI,GACP,IAAI,CAAC;IAER;;;;;;OAMG;IACH,CAAC,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,CAAC,UAAU,EAAE,WAAW,KAAK,IAAI,GAAG,IAAI,CAAC;CACzE;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,YAAY,CAAC,CAAC,SAAS,8BAA8B,CACrE,SAAQ,aAAa,CAAC,kBAAkB,CAAC;IACzC,GAAG,IAAI,SAAS,CAAC,EAAE,CA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EnB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;GAIG;AACH,MAAM,WAAW,cAAc,CAAC,CAAC;IAChC;;OAEG;IACH,SAAS,EAAE,CAAC,EAAE,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC3B,MAAM,IAAI,IAAI,CAAC;IACf,OAAO,IAAI,IAAI,CAAC;CAChB"}
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/array/interfaces.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IEventThisPlaceHolder, IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport type { Serializable } from \"@fluidframework/datastore-definitions/internal\";\nimport type {\n\tISharedObjectEvents,\n\tISharedObject,\n} from \"@fluidframework/shared-object-base/internal\";\n\nimport type { ISharedArrayOperation } from \"./sharedArrayOperations.js\";\n/**\n * Basic types for the SharedArray DDS\n * It can be used as a generic constraint (`extends SerializableTypeForSharedArray`) but is\n * *never* meant to be a concrete/real type on its own.\n *\n * @legacy\n * @alpha\n */\nexport type SerializableTypeForSharedArray = boolean | number | string | object | IFluidHandle;\n\n/**\n * Interface defining the events that can be emitted by the SharedArray DDS\n * and the events that can be listened to by the SharedArray DDS\n *\n * @legacy\n * @alpha\n */\nexport interface ISharedArrayEvents extends ISharedObjectEvents {\n\t/**\n\t *\n\t * @param event - The event name.\n\t * @param listener - An event listener.\n\t *\n\t * @eventProperty\n\t */\n\t(\n\t\tevent: \"valueChanged\",\n\t\tlistener: (\n\t\t\top: ISharedArrayOperation,\n\t\t\tisLocal: boolean,\n\t\t\ttarget: IEventThisPlaceHolder,\n\t\t) => void,\n\t): void;\n\n\t/**\n\t *\n\t * @param event - The event name.\n\t * @param listener - An event listener.\n\t *\n\t * @eventProperty\n\t */\n\t(event: \"revertible\", listener: (revertible: IRevertible) => void): void;\n}\n\n/**\n * Interface defining the SharedArray DDS\n * It is a generic interface that can be used to create a SharedArray of any type\n * The type of the SharedArray is defined by the type parameter T\n *\n * @typeParam T - The type of the SharedArray\n *\n * @legacy\n * @alpha\n */\nexport interface ISharedArray<T extends SerializableTypeForSharedArray>\n\textends ISharedObject<ISharedArrayEvents> {\n\tget(): readonly T[];\n\tinsert<TWrite>(index: number, value: Serializable<TWrite> & T): void;\n\tdelete(index: number): void;\n\tmove(oldIndex: number, newIndex: number): void;\n\ttoggle(entryId: string): void;\n\ttoggleMove(oldEntryId: string, newEntryId: string): void;\n\tinsertBulkAfter<TWrite>(ref: T | undefined, values: (Serializable<TWrite> & T)[]): void;\n}\n\n/**\n *\n * @internal\n */\nexport interface ISharedArrayRevertible extends ISharedObject<ISharedArrayEvents> {\n\ttoggle(entryId: string): void;\n\ttoggleMove(oldEntryId: string, newEntryId: string): void;\n}\n\n/**\n * Interface defining the in memory shared array entry of the DDS\n *\n * @internal\n */\nexport interface SharedArrayEntry<T extends SerializableTypeForSharedArray>\n\textends SharedArrayEntryCore<T> {\n\t/**\n\t * Flag that tracks whether an ack from the server has been received for a local insert.\n\t * True for local changes.\n\t */\n\tisAckPending: boolean;\n\n\t/**\n\t * Counter is shared by delete and undo/redo (of delete and insert) as undo/redo simply\n\t * operates on the isDeleted flag of the DDS. This flag will help us skip local op acks as\n\t * they have already inflicted state change. The flag helps us ignore remote ops if there is a\n\t * local pending delete as we would be getting the pending op after server stamping\n\t */\n\tisLocalPendingDelete: number;\n\n\t/**\n\t * Counter is for move and its undo/redo. This flag will be used to skip local op acks as\n\t * they have already inflicted state change. The flag helps us ignore remote ops if there is a\n\t * local pending delete as we would be getting the pending op after server stamping. Only exception\n\t * being if there is a remote delete, we will have to respect that\n\t */\n\tisLocalPendingMove: number;\n}\n\n/**\n * Interface defining the core entry attributes\n *\n * @internal\n */\nexport interface SharedArrayEntryCore<T extends SerializableTypeForSharedArray> {\n\t/**\n\t * a unique ID for this particular entry\n\t */\n\tentryId: string;\n\n\t/**\n\t * the value stored in this entry, may not be unique\n\t */\n\tvalue: T;\n\n\t/**\n\t * Flag to track whether this entry is deleted or not.\n\t */\n\tisDeleted: boolean;\n\n\t/**\n\t * Primarily used for move op and tracks the old entry id from which this entry was changed from.\n\t */\n\tprevEntryId?: string;\n\n\t/**\n\t * Primarily used for move op and tracks the new entry id to which this entry was changed to.\n\t */\n\tnextEntryId?: string;\n}\n\n/**\n * Format of the snapshot for the DDS\n *\n * @internal\n */\nexport interface SnapshotFormat<T> {\n\t/**\n\t * Array of the data entries that represent the DDS in-memory representation\n\t */\n\tdataArray: T[];\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport interface IRevertible {\n\trevert(): void;\n\tdispose(): void;\n}\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/array/interfaces.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IEventThisPlaceHolder, IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport type { Serializable } from \"@fluidframework/datastore-definitions/internal\";\nimport type {\n\tISharedObjectEvents,\n\tISharedObject,\n} from \"@fluidframework/shared-object-base/internal\";\n\nimport type { ISharedArrayOperation } from \"./sharedArrayOperations.js\";\n/**\n * Basic types for the SharedArray DDS\n * It can be used as a generic constraint (`extends SerializableTypeForSharedArray`) but is\n * *never* meant to be a concrete/real type on its own.\n *\n * @legacy @beta\n */\nexport type SerializableTypeForSharedArray = boolean | number | string | object | IFluidHandle;\n\n/**\n * Interface defining the events that can be emitted by the SharedArray DDS\n * and the events that can be listened to by the SharedArray DDS\n *\n * @legacy @beta\n */\nexport interface ISharedArrayEvents extends ISharedObjectEvents {\n\t/**\n\t *\n\t * @param event - The event name.\n\t * @param listener - An event listener.\n\t *\n\t * @eventProperty\n\t */\n\t(\n\t\tevent: \"valueChanged\",\n\t\tlistener: (\n\t\t\top: ISharedArrayOperation,\n\t\t\tisLocal: boolean,\n\t\t\ttarget: IEventThisPlaceHolder,\n\t\t) => void,\n\t): void;\n\n\t/**\n\t *\n\t * @param event - The event name.\n\t * @param listener - An event listener.\n\t *\n\t * @eventProperty\n\t */\n\t(event: \"revertible\", listener: (revertible: IRevertible) => void): void;\n}\n\n/**\n * Interface defining the SharedArray DDS\n * It is a generic interface that can be used to create a SharedArray of any type\n * The type of the SharedArray is defined by the type parameter T\n *\n * @typeParam T - The type of the SharedArray\n *\n * @legacy @beta\n */\nexport interface ISharedArray<T extends SerializableTypeForSharedArray>\n\textends ISharedObject<ISharedArrayEvents> {\n\tget(): readonly T[];\n\tinsert<TWrite>(index: number, value: Serializable<TWrite> & T): void;\n\tdelete(index: number): void;\n\tmove(oldIndex: number, newIndex: number): void;\n\ttoggle(entryId: string): void;\n\ttoggleMove(oldEntryId: string, newEntryId: string): void;\n\tinsertBulkAfter<TWrite>(ref: T | undefined, values: (Serializable<TWrite> & T)[]): void;\n}\n\n/**\n *\n * @internal\n */\nexport interface ISharedArrayRevertible extends ISharedObject<ISharedArrayEvents> {\n\ttoggle(entryId: string): void;\n\ttoggleMove(oldEntryId: string, newEntryId: string): void;\n}\n\n/**\n * Interface defining the in memory shared array entry of the DDS\n *\n * @internal\n */\nexport interface SharedArrayEntry<T extends SerializableTypeForSharedArray>\n\textends SharedArrayEntryCore<T> {\n\t/**\n\t * Flag that tracks whether an ack from the server has been received for a local insert.\n\t * True for local changes.\n\t */\n\tisAckPending: boolean;\n\n\t/**\n\t * Counter is shared by delete and undo/redo (of delete and insert) as undo/redo simply\n\t * operates on the isDeleted flag of the DDS. This flag will help us skip local op acks as\n\t * they have already inflicted state change. The flag helps us ignore remote ops if there is a\n\t * local pending delete as we would be getting the pending op after server stamping\n\t */\n\tisLocalPendingDelete: number;\n\n\t/**\n\t * Counter is for move and its undo/redo. This flag will be used to skip local op acks as\n\t * they have already inflicted state change. The flag helps us ignore remote ops if there is a\n\t * local pending delete as we would be getting the pending op after server stamping. Only exception\n\t * being if there is a remote delete, we will have to respect that\n\t */\n\tisLocalPendingMove: number;\n}\n\n/**\n * Interface defining the core entry attributes\n *\n * @internal\n */\nexport interface SharedArrayEntryCore<T extends SerializableTypeForSharedArray> {\n\t/**\n\t * a unique ID for this particular entry\n\t */\n\tentryId: string;\n\n\t/**\n\t * the value stored in this entry, may not be unique\n\t */\n\tvalue: T;\n\n\t/**\n\t * Flag to track whether this entry is deleted or not.\n\t */\n\tisDeleted: boolean;\n\n\t/**\n\t * Primarily used for move op and tracks the old entry id from which this entry was changed from.\n\t */\n\tprevEntryId?: string;\n\n\t/**\n\t * Primarily used for move op and tracks the new entry id to which this entry was changed to.\n\t */\n\tnextEntryId?: string;\n}\n\n/**\n * Format of the snapshot for the DDS\n *\n * @internal\n */\nexport interface SnapshotFormat<T> {\n\t/**\n\t * Array of the data entries that represent the DDS in-memory representation\n\t */\n\tdataArray: T[];\n}\n\n/**\n * @legacy @beta\n */\nexport interface IRevertible {\n\trevert(): void;\n\tdispose(): void;\n}\n"]}
@@ -27,6 +27,12 @@ export declare class SharedArrayClass<T extends SerializableTypeForSharedArray>
27
27
  * handling for this data structure
28
28
  */
29
29
  private readonly idToEntryMap;
30
+ /**
31
+ * Set of entry IDs that are marked for deletion by remote clients, but have local pending deletes.
32
+ * Used to prevent resuscitating entries while rolling back a delete operation.
33
+ * We should not rollback to life an entry that was deleted by remote clients.
34
+ */
35
+ private readonly remoteDeleteWithLocalPendingDelete;
30
36
  /**
31
37
  * Create a new shared array
32
38
  *
@@ -87,6 +93,7 @@ export declare class SharedArrayClass<T extends SerializableTypeForSharedArray>
87
93
  * @param newEntryId - EntryId of the to be live entry
88
94
  */
89
95
  toggleMove(oldEntryId: string, newEntryId: string): void;
96
+ rollback(op: unknown, _localOpMetadata: unknown): void;
90
97
  /**
91
98
  * Load share array from snapshot
92
99
  *
@@ -174,6 +181,7 @@ export declare class SharedArrayClass<T extends SerializableTypeForSharedArray>
174
181
  * existingEntry -\> deadeEntry(appended) -\> existing chain(if any).
175
182
  */
176
183
  private updateDeadEntry;
184
+ private handleStashedInsert;
177
185
  protected applyStashedOp(content: unknown): void;
178
186
  }
179
187
  //# 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,CAAC;AACxD,OAAO,KAAK,EACX,yBAAyB,EAEzB,MAAM,6CAA6C,CAAC;AAErD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AAE1F,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,CAAC;AACpF,OAAO,EAAE,YAAY,EAAE,MAAM,6CAA6C,CAAC;AAG3E,OAAO,KAAK,EACX,kBAAkB,EAClB,YAAY,EACZ,sBAAsB,EACtB,8BAA8B,EAI9B,MAAM,iBAAiB,CAAC;AAczB;;;;GAIG;AACH,qBAAa,gBAAgB,CAAC,CAAC,SAAS,8BAA8B,CACrE,SAAQ,YAAY,CAAC,kBAAkB,CACvC,YAAW,YAAY,CAAC,CAAC,CAAC,EAAE,sBAAsB;IAElD;;OAEG;IACH,OAAO,CAAC,WAAW,CAAwB;IAE3C;;;;;;;OAOG;IACH,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAmC;IAEhE;;;;;;OAMG;WACW,MAAM,CAAC,CAAC,SAAS,8BAA8B,EAC5D,OAAO,EAAE,sBAAsB,EAC/B,EAAE,CAAC,EAAE,MAAM,GACT,gBAAgB,CAAC,CAAC,CAAC;IAItB;;;;OAIG;WACW,UAAU,CAAC,CAAC,SAAS,8BAA8B,KAAK,eAAe;IAIrF;;;;;;;OA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;;OAKG;IACH,OAAO,CAAC,eAAe;IAevB;;;;OAIG;IACH,OAAO,CAAC,eAAe;IAiBvB,OAAO,CAAC,mBAAmB;IAc3B,SAAS,CAAC,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;CA6DhD"}
@@ -48,6 +48,12 @@ class SharedArrayClass extends internal_4.SharedObject {
48
48
  */
49
49
  constructor(id, runtime, attributes) {
50
50
  super(id, runtime, attributes, "loop_sharedArray_" /* telemetryContextPrefix */);
51
+ /**
52
+ * Set of entry IDs that are marked for deletion by remote clients, but have local pending deletes.
53
+ * Used to prevent resuscitating entries while rolling back a delete operation.
54
+ * We should not rollback to life an entry that was deleted by remote clients.
55
+ */
56
+ this.remoteDeleteWithLocalPendingDelete = new Set();
51
57
  this.sharedArray = [];
52
58
  this.idToEntryMap = new Map();
53
59
  }
@@ -280,6 +286,68 @@ class SharedArrayClass extends internal_4.SharedObject {
280
286
  }
281
287
  this.submitLocalMessage(op);
282
288
  }
289
+ rollback(op, _localOpMetadata) {
290
+ const arrayOp = op;
291
+ switch (arrayOp.type) {
292
+ case sharedArrayOperations_js_1.OperationType.insertEntry: {
293
+ const liveEntry = this.getLiveEntry(arrayOp.entryId);
294
+ liveEntry.isDeleted = true;
295
+ const deleteOp = {
296
+ type: sharedArrayOperations_js_1.OperationType.deleteEntry,
297
+ entryId: arrayOp.entryId,
298
+ };
299
+ this.emitValueChangedEvent(deleteOp, true /* isLocal */);
300
+ break;
301
+ }
302
+ case sharedArrayOperations_js_1.OperationType.deleteEntry: {
303
+ if (this.remoteDeleteWithLocalPendingDelete.has(arrayOp.entryId)) {
304
+ // If remote already deleted the entry, we should not resurrect it.
305
+ // Just remove the local pending delete.
306
+ this.remoteDeleteWithLocalPendingDelete.delete(arrayOp.entryId);
307
+ }
308
+ else {
309
+ const liveEntry = this.getLiveEntry(arrayOp.entryId);
310
+ liveEntry.isDeleted = false;
311
+ const insertOp = {
312
+ type: sharedArrayOperations_js_1.OperationType.insertEntry,
313
+ entryId: arrayOp.entryId,
314
+ value: liveEntry.value,
315
+ };
316
+ this.emitValueChangedEvent(insertOp, true /* isLocal */);
317
+ const entry = this.getEntryForId(arrayOp.entryId);
318
+ if (entry !== undefined && entry.isLocalPendingDelete > 0) {
319
+ entry.isLocalPendingDelete -= 1;
320
+ }
321
+ }
322
+ break;
323
+ }
324
+ case sharedArrayOperations_js_1.OperationType.moveEntry: {
325
+ const { entryId: oldEntryId, changedToEntryId: newEntryId } = arrayOp;
326
+ if (this.getEntryForId(newEntryId).isDeleted) {
327
+ return;
328
+ }
329
+ this.updateLiveEntry(newEntryId, oldEntryId);
330
+ const inputEntry = this.getEntryForId(oldEntryId);
331
+ inputEntry.prevEntryId = undefined;
332
+ inputEntry.nextEntryId = undefined;
333
+ inputEntry.isLocalPendingMove = 0;
334
+ const moveOp = {
335
+ type: sharedArrayOperations_js_1.OperationType.moveEntry,
336
+ entryId: newEntryId,
337
+ changedToEntryId: oldEntryId,
338
+ };
339
+ this.emitValueChangedEvent(moveOp, true /* isLocal */);
340
+ break;
341
+ }
342
+ case sharedArrayOperations_js_1.OperationType.toggle:
343
+ case sharedArrayOperations_js_1.OperationType.toggleMove: {
344
+ throw new Error(`Rollback not implemented for ${arrayOp.type} operations`);
345
+ }
346
+ default: {
347
+ (0, internal_1.unreachableCase)(arrayOp);
348
+ }
349
+ }
350
+ }
283
351
  /**
284
352
  * Load share array from snapshot
285
353
  *
@@ -404,10 +472,13 @@ class SharedArrayClass extends internal_4.SharedObject {
404
472
  if (local) {
405
473
  // Decrementing local pending counter as op is already applied to local state
406
474
  opEntry.isLocalPendingDelete -= 1;
475
+ this.remoteDeleteWithLocalPendingDelete.delete(op.entryId);
407
476
  }
408
477
  else {
409
- // If local pending, then ignore else apply the remote op
410
- if (!this.isLocalPending(op.entryId, "isLocalPendingDelete")) {
478
+ if (this.isLocalPending(op.entryId, "isLocalPendingDelete")) {
479
+ this.remoteDeleteWithLocalPendingDelete.add(op.entryId);
480
+ }
481
+ else {
411
482
  // last element in skip list is the most recent and live entry, so marking it deleted
412
483
  this.getLiveEntry(op.entryId).isDeleted = true;
413
484
  }
@@ -659,28 +730,57 @@ class SharedArrayClass extends internal_4.SharedObject {
659
730
  deadEntry.prevEntryId = existingEntryId;
660
731
  deadEntry.isDeleted = true;
661
732
  }
733
+ handleStashedInsert(entryId, insertAfterEntryId, value) {
734
+ let index = 0;
735
+ if (insertAfterEntryId !== undefined) {
736
+ index = this.findIndexOfEntryId(insertAfterEntryId) + 1;
737
+ }
738
+ const newEntry = this.createNewEntry(entryId, value);
739
+ newEntry.isAckPending = true;
740
+ this.addEntry(index, newEntry);
741
+ }
662
742
  applyStashedOp(content) {
663
743
  const op = content;
664
744
  switch (op.type) {
665
745
  case sharedArrayOperations_js_1.OperationType.insertEntry: {
666
- this.handleInsertOp(op.entryId, op.insertAfterEntryId, false, // treat it as remote op
667
- op.value);
746
+ this.handleStashedInsert(op.entryId, op.insertAfterEntryId, op.value);
668
747
  break;
669
748
  }
670
749
  case sharedArrayOperations_js_1.OperationType.deleteEntry: {
671
- this.handleDeleteOp(op, false /* local - treat as remote op */);
750
+ this.getLiveEntry(op.entryId).isDeleted = true;
751
+ this.getEntryForId(op.entryId).isLocalPendingDelete += 1;
672
752
  break;
673
753
  }
674
754
  case sharedArrayOperations_js_1.OperationType.moveEntry: {
675
- this.handleMoveOp(op, false /* local - treat as remote op */);
755
+ const opEntry = this.getEntryForId(op.entryId);
756
+ this.handleStashedInsert(op.changedToEntryId, op.insertAfterEntryId, opEntry.value);
757
+ const newElementEntryId = op.changedToEntryId;
758
+ const newElement = this.getEntryForId(newElementEntryId);
759
+ if (this.isLocalPending(op.entryId, "isLocalPendingDelete") ||
760
+ this.isLocalPending(op.entryId, "isLocalPendingMove")) {
761
+ this.updateDeadEntry(op.entryId, newElementEntryId);
762
+ }
763
+ else {
764
+ // move the element
765
+ const liveEntry = this.getLiveEntry(op.entryId);
766
+ const isDeleted = liveEntry.isDeleted;
767
+ this.updateLiveEntry(liveEntry.entryId, newElementEntryId);
768
+ // mark newly added element as deleted if existing live element was already deleted
769
+ if (isDeleted) {
770
+ newElement.isDeleted = isDeleted;
771
+ }
772
+ }
773
+ newElement.isLocalPendingMove += 1;
676
774
  break;
677
775
  }
678
776
  case sharedArrayOperations_js_1.OperationType.toggle: {
679
- this.handleToggleOp(op, false /* local - treat as remote op */);
777
+ this.getLiveEntry(op.entryId).isDeleted = op.isDeleted;
778
+ this.getEntryForId(op.entryId).isLocalPendingDelete += 1;
680
779
  break;
681
780
  }
682
781
  case sharedArrayOperations_js_1.OperationType.toggleMove: {
683
- this.handleToggleMoveOp(op, false /* local - treat as remote op */);
782
+ this.updateLiveEntry(this.getLiveEntry(op.entryId).entryId, op.entryId);
783
+ this.getEntryForId(op.entryId).isLocalPendingMove += 1;
684
784
  break;
685
785
  }
686
786
  default: {