@fluidframework/map 1.3.0 → 2.0.0-dev.1.4.5.105745

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 (69) hide show
  1. package/.eslintrc.js +4 -1
  2. package/.mocharc.js +12 -0
  3. package/dist/directory.d.ts +26 -7
  4. package/dist/directory.d.ts.map +1 -1
  5. package/dist/directory.js +9 -18
  6. package/dist/directory.js.map +1 -1
  7. package/dist/index.d.ts +2 -2
  8. package/dist/index.js +2 -2
  9. package/dist/index.js.map +1 -1
  10. package/dist/interfaces.d.ts +139 -181
  11. package/dist/interfaces.d.ts.map +1 -1
  12. package/dist/interfaces.js.map +1 -1
  13. package/dist/internalInterfaces.d.ts +62 -0
  14. package/dist/internalInterfaces.d.ts.map +1 -0
  15. package/dist/internalInterfaces.js +7 -0
  16. package/dist/internalInterfaces.js.map +1 -0
  17. package/dist/localValues.d.ts +3 -3
  18. package/dist/localValues.js +2 -2
  19. package/dist/localValues.js.map +1 -1
  20. package/dist/map.d.ts +3 -5
  21. package/dist/map.d.ts.map +1 -1
  22. package/dist/map.js +4 -7
  23. package/dist/map.js.map +1 -1
  24. package/dist/mapKernel.d.ts +10 -41
  25. package/dist/mapKernel.d.ts.map +1 -1
  26. package/dist/mapKernel.js +34 -25
  27. package/dist/mapKernel.js.map +1 -1
  28. package/dist/packageVersion.d.ts +1 -1
  29. package/dist/packageVersion.d.ts.map +1 -1
  30. package/dist/packageVersion.js +1 -1
  31. package/dist/packageVersion.js.map +1 -1
  32. package/lib/directory.d.ts +26 -7
  33. package/lib/directory.d.ts.map +1 -1
  34. package/lib/directory.js +9 -18
  35. package/lib/directory.js.map +1 -1
  36. package/lib/index.d.ts +2 -2
  37. package/lib/index.js +2 -2
  38. package/lib/index.js.map +1 -1
  39. package/lib/interfaces.d.ts +139 -181
  40. package/lib/interfaces.d.ts.map +1 -1
  41. package/lib/interfaces.js.map +1 -1
  42. package/lib/internalInterfaces.d.ts +62 -0
  43. package/lib/internalInterfaces.d.ts.map +1 -0
  44. package/lib/internalInterfaces.js +6 -0
  45. package/lib/internalInterfaces.js.map +1 -0
  46. package/lib/localValues.d.ts +3 -3
  47. package/lib/localValues.js +2 -2
  48. package/lib/localValues.js.map +1 -1
  49. package/lib/map.d.ts +3 -5
  50. package/lib/map.d.ts.map +1 -1
  51. package/lib/map.js +4 -7
  52. package/lib/map.js.map +1 -1
  53. package/lib/mapKernel.d.ts +10 -41
  54. package/lib/mapKernel.d.ts.map +1 -1
  55. package/lib/mapKernel.js +34 -25
  56. package/lib/mapKernel.js.map +1 -1
  57. package/lib/packageVersion.d.ts +1 -1
  58. package/lib/packageVersion.d.ts.map +1 -1
  59. package/lib/packageVersion.js +1 -1
  60. package/lib/packageVersion.js.map +1 -1
  61. package/package.json +61 -21
  62. package/src/directory.ts +35 -20
  63. package/src/index.ts +2 -2
  64. package/src/interfaces.ts +146 -181
  65. package/src/internalInterfaces.ts +72 -0
  66. package/src/localValues.ts +3 -3
  67. package/src/map.ts +8 -11
  68. package/src/mapKernel.ts +64 -96
  69. package/src/packageVersion.ts +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/map",
3
- "version": "1.3.0",
3
+ "version": "2.0.0-dev.1.4.5.105745",
4
4
  "description": "Distributed map",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -32,7 +32,9 @@
32
32
  "lint:fix": "npm run eslint:fix",
33
33
  "test": "npm run test:mocha",
34
34
  "test:coverage": "nyc npm test -- --reporter xunit --reporter-option output=nyc/junit-report.xml",
35
- "test:mocha": "mocha --ignore 'dist/test/types/*' --recursive dist/test -r node_modules/@fluidframework/mocha-test-setup --unhandled-rejections=strict",
35
+ "test:memory": "mocha --config ./src/test/memory/.mocharc.js",
36
+ "test:memory-profiling:report": "mocha --config ./src/test/memory/.mocharc.js",
37
+ "test:mocha": "mocha --unhandled-rejections=strict --recursive 'dist/test/mocha/**/*.spec.js' -r node_modules/@fluidframework/mocha-test-setup --exit",
36
38
  "test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
37
39
  "tsc": "tsc",
38
40
  "tsfmt": "tsfmt --verify",
@@ -61,31 +63,32 @@
61
63
  },
62
64
  "dependencies": {
63
65
  "@fluidframework/common-definitions": "^0.20.1",
64
- "@fluidframework/common-utils": "^0.32.1",
65
- "@fluidframework/container-utils": "^1.3.0",
66
- "@fluidframework/core-interfaces": "^1.3.0",
67
- "@fluidframework/datastore-definitions": "^1.3.0",
68
- "@fluidframework/driver-utils": "^1.3.0",
69
- "@fluidframework/protocol-definitions": "^0.1028.2000",
70
- "@fluidframework/runtime-definitions": "^1.3.0",
71
- "@fluidframework/runtime-utils": "^1.3.0",
72
- "@fluidframework/shared-object-base": "^1.3.0",
66
+ "@fluidframework/common-utils": "^1.0.0",
67
+ "@fluidframework/container-utils": "2.0.0-dev.1.4.5.105745",
68
+ "@fluidframework/core-interfaces": "2.0.0-dev.1.4.5.105745",
69
+ "@fluidframework/datastore-definitions": "2.0.0-dev.1.4.5.105745",
70
+ "@fluidframework/driver-utils": "2.0.0-dev.1.4.5.105745",
71
+ "@fluidframework/protocol-definitions": "^1.0.0",
72
+ "@fluidframework/runtime-definitions": "2.0.0-dev.1.4.5.105745",
73
+ "@fluidframework/runtime-utils": "2.0.0-dev.1.4.5.105745",
74
+ "@fluidframework/shared-object-base": "2.0.0-dev.1.4.5.105745",
73
75
  "path-browserify": "^1.0.1"
74
76
  },
75
77
  "devDependencies": {
76
- "@fluid-internal/test-dds-utils": "^1.3.0",
77
- "@fluidframework/build-common": "^0.24.0",
78
- "@fluidframework/build-tools": "^0.2.74327",
79
- "@fluidframework/eslint-config-fluid": "^0.28.2000",
80
- "@fluidframework/map-previous": "npm:@fluidframework/map@^1.2.0",
81
- "@fluidframework/mocha-test-setup": "^1.3.0",
82
- "@fluidframework/test-runtime-utils": "^1.3.0",
78
+ "@fluid-internal/test-dds-utils": "2.0.0-dev.1.4.5.105745",
79
+ "@fluid-tools/benchmark": "^0.43.0",
80
+ "@fluidframework/build-common": "^1.0.0",
81
+ "@fluidframework/build-tools": "^0.4.4000",
82
+ "@fluidframework/eslint-config-fluid": "^1.0.0",
83
+ "@fluidframework/map-previous": "npm:@fluidframework/map@^1.0.0",
84
+ "@fluidframework/mocha-test-setup": "2.0.0-dev.1.4.5.105745",
85
+ "@fluidframework/test-runtime-utils": "2.0.0-dev.1.4.5.105745",
83
86
  "@microsoft/api-extractor": "^7.22.2",
84
87
  "@rushstack/eslint-config": "^2.5.1",
85
88
  "@types/mocha": "^9.1.1",
86
89
  "@types/node": "^14.18.0",
87
90
  "concurrently": "^6.2.0",
88
- "copyfiles": "^2.1.0",
91
+ "copyfiles": "^2.4.1",
89
92
  "cross-env": "^7.0.2",
90
93
  "eslint": "~8.6.0",
91
94
  "mocha": "^10.0.0",
@@ -95,7 +98,44 @@
95
98
  "typescript-formatter": "7.1.0"
96
99
  },
97
100
  "typeValidation": {
98
- "version": "1.3.0",
99
- "broken": {}
101
+ "version": "2.0.0",
102
+ "broken": {
103
+ "RemovedInterfaceDeclaration_IDirectoryClearOperation": {
104
+ "forwardCompat": false,
105
+ "backCompat": false
106
+ },
107
+ "RemovedInterfaceDeclaration_IDirectoryCreateSubDirectoryOperation": {
108
+ "forwardCompat": false,
109
+ "backCompat": false
110
+ },
111
+ "RemovedInterfaceDeclaration_IDirectoryDeleteOperation": {
112
+ "forwardCompat": false,
113
+ "backCompat": false
114
+ },
115
+ "RemovedInterfaceDeclaration_IDirectoryDeleteSubDirectoryOperation": {
116
+ "forwardCompat": false,
117
+ "backCompat": false
118
+ },
119
+ "RemovedTypeAliasDeclaration_IDirectoryKeyOperation": {
120
+ "forwardCompat": false,
121
+ "backCompat": false
122
+ },
123
+ "RemovedInterfaceDeclaration_IDirectorySetOperation": {
124
+ "forwardCompat": false,
125
+ "backCompat": false
126
+ },
127
+ "RemovedTypeAliasDeclaration_IDirectoryStorageOperation": {
128
+ "forwardCompat": false,
129
+ "backCompat": false
130
+ },
131
+ "RemovedTypeAliasDeclaration_IDirectorySubDirectoryOperation": {
132
+ "forwardCompat": false,
133
+ "backCompat": false
134
+ },
135
+ "RemovedInterfaceDeclaration_ILocalValue": {
136
+ "forwardCompat": false,
137
+ "backCompat": false
138
+ }
139
+ }
100
140
  }
101
141
  }
package/src/directory.ts CHANGED
@@ -192,24 +192,47 @@ export type IDirectoryOperation = IDirectoryStorageOperation | IDirectorySubDire
192
192
 
193
193
  /**
194
194
  * Defines the in-memory object structure to be used for the conversion to/from serialized.
195
- * @privateRemarks
196
- * Directly used in JSON.stringify, direct result from JSON.parse.
195
+ *
196
+ * @remarks Directly used in
197
+ * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify
198
+ * | JSON.stringify}, direct result from
199
+ * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse | JSON.parse}.
197
200
  */
198
201
  export interface IDirectoryDataObject {
202
+ /**
203
+ * Key/value date set by the user.
204
+ */
199
205
  storage?: { [key: string]: ISerializableValue; };
206
+
207
+ /**
208
+ * Recursive sub-directories {@link IDirectoryDataObject | objects}.
209
+ */
200
210
  subdirectories?: { [subdirName: string]: IDirectoryDataObject; };
201
211
  }
202
212
 
213
+ /**
214
+ * {@link IDirectory} storage format.
215
+ *
216
+ * @internal
217
+ */
203
218
  export interface IDirectoryNewStorageFormat {
219
+ /**
220
+ * Blob IDs representing larger directory data that was serialized.
221
+ */
204
222
  blobs: string[];
223
+
224
+ /**
225
+ * Storage content representing directory data that was not serialized.
226
+ */
205
227
  content: IDirectoryDataObject;
206
228
  }
207
229
 
208
230
  /**
209
- * The factory that defines the directory.
231
+ * {@link @fluidframework/datastore-definitions#IChannelFactory} for {@link SharedDirectory}.
232
+ *
210
233
  * @sealed
211
234
  */
212
- export class DirectoryFactory {
235
+ export class DirectoryFactory implements IChannelFactory {
213
236
  /**
214
237
  * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory."type"}
215
238
  */
@@ -264,9 +287,7 @@ export class DirectoryFactory {
264
287
  }
265
288
 
266
289
  /**
267
- * SharedDirectory provides a hierarchical organization of map-like data structures as SubDirectories.
268
- * The values stored within can be accessed like a map, and the hierarchy can be navigated using path syntax.
269
- * SubDirectories can be retrieved for use as working directories.
290
+ * {@inheritDoc ISharedDirectory}
270
291
  *
271
292
  * @example
272
293
  * ```typescript
@@ -544,7 +565,7 @@ export class SharedDirectory extends SharedObject<ISharedDirectoryEvents> implem
544
565
  * {@inheritDoc @fluidframework/shared-object-base#SharedObject.onDisconnect}
545
566
  * @internal
546
567
  */
547
- protected onDisconnect() {}
568
+ protected onDisconnect() { }
548
569
 
549
570
  /**
550
571
  * {@inheritDoc @fluidframework/shared-object-base#SharedObject.reSubmitCore}
@@ -1203,12 +1224,9 @@ class SubDirectory extends TypedEventEmitter<IDirectoryEvents> implements IDirec
1203
1224
  const iterator = {
1204
1225
  next(): IteratorResult<[string, any]> {
1205
1226
  const nextVal = localEntriesIterator.next();
1206
- if (nextVal.done) {
1207
- return { value: undefined, done: true };
1208
- } else {
1209
- // Unpack the stored value
1210
- return { value: [nextVal.value[0], nextVal.value[1].value], done: false };
1211
- }
1227
+ return nextVal.done
1228
+ ? { value: undefined, done: true }
1229
+ : { value: [nextVal.value[0], nextVal.value[1].value], done: false };
1212
1230
  },
1213
1231
  [Symbol.iterator]() {
1214
1232
  return this;
@@ -1236,12 +1254,9 @@ class SubDirectory extends TypedEventEmitter<IDirectoryEvents> implements IDirec
1236
1254
  const iterator = {
1237
1255
  next(): IteratorResult<any> {
1238
1256
  const nextVal = localValuesIterator.next();
1239
- if (nextVal.done) {
1240
- return { value: undefined, done: true };
1241
- } else {
1242
- // Unpack the stored value
1243
- return { value: nextVal.value.value, done: false };
1244
- }
1257
+ return nextVal.done
1258
+ ? { value: undefined, done: true }
1259
+ : { value: nextVal.value.value, done: false };
1245
1260
  },
1246
1261
  [Symbol.iterator]() {
1247
1262
  return this;
package/src/index.ts CHANGED
@@ -4,9 +4,9 @@
4
4
  */
5
5
 
6
6
  /**
7
- * The `map` package provides interfaces and implementing classes for map-like distributed data structures.
7
+ * The `map` library provides interfaces and implementing classes for map-like distributed data structures.
8
8
  *
9
- * @remarks The following distributed data structures are defined in this package:
9
+ * @remarks The following distributed data structures are defined in this library:
10
10
  *
11
11
  * - {@link SharedMap}
12
12
  *
package/src/interfaces.ts CHANGED
@@ -98,94 +98,73 @@ export interface IDirectory extends Map<string, any>, IEventProvider<IDirectoryE
98
98
  }
99
99
 
100
100
  /**
101
- * Events emitted in response to changes to the directory data. These events only emit on the ISharedDirectory itself,
102
- * and not on subdirectories.
103
- *
104
- * @remarks
105
- *
106
- * The following is the list of events emitted.
107
- *
108
- * ### "valueChanged"
109
- *
110
- * The valueChanged event is emitted when a key is set or deleted. This is emitted for any key in the ISharedDirectory
111
- * or any subdirectory.
112
- *
113
- * #### Listener signature
114
- *
115
- * ```typescript
116
- * (
117
- * changed: IDirectoryValueChanged,
118
- * local: boolean,
119
- * target: IEventThisPlaceHolder,
120
- * ) => void
121
- * ```
122
- * - `changed` - Information on the key that changed, its value prior to the change, and the path to the key that
123
- * changed.
124
- *
125
- * - `local` - Whether the change originated from this client.
126
- *
127
- * - `target` - The ISharedDirectory itself.
128
- *
129
- * ### "clear"
130
- *
131
- * The clear event is emitted when the ISharedDirectory is cleared.
132
- *
133
- * #### Listener signature
134
- *
135
- * ```typescript
136
- * (local: boolean, target: IEventThisPlaceHolder) => void
137
- * ```
138
- * - `local` - Whether the clear originated from this client.
139
- *
140
- * - `target` - The ISharedDirectory itself.
141
- *
142
- * ### "subDirectoryCreated"
143
- *
144
- * The subDirectoryCreated event is emitted when a subdirectory is created.
145
- *
146
- * #### Listener signature
147
- *
148
- * ```typescript
149
- * (path: string, local: boolean, target: IEventThisPlaceHolder) => void
150
- * ```
151
- * - `path` - The relative path to the subdirectory that is created.
152
- * It is relative from the object which raises the event.
153
- *
154
- * - `local` - Whether the create originated from the this client.
155
- *
156
- * - `target` - The ISharedDirectory itself.
157
- *
158
- * ###"subDirectoryDeleted"
159
- *
160
- * The subDirectoryDeleted event is emitted when a subdirectory is deleted.
161
- *
162
- * #### Listener signature
163
- *
164
- * ```typescript
165
- * (path: string, local: boolean, target: IEventThisPlaceHolder) => void
166
- * ```
167
- * - `path` - The relative path to the subdirectory that is deleted.
168
- * It is relative from the object which raises the event.
169
- *
170
- * - `local` - Whether the delete originated from the this client.
171
- *
172
- * - `target` - The ISharedDirectory itself.
101
+ * Events emitted in response to changes to the directory data.
102
+ * These events only emit on the {@link ISharedDirectory} itself, and not on subdirectories.
173
103
  */
174
104
  export interface ISharedDirectoryEvents extends ISharedObjectEvents {
105
+ /**
106
+ * Emitted when a key is set or deleted. This is emitted for any key in the {@link ISharedDirectory} or any
107
+ * subdirectory.
108
+ *
109
+ * @remarks Listener parameters:
110
+ *
111
+ * - `changed` - Information on the key that changed, its value prior to the change, and the path to the
112
+ * key that changed.
113
+ *
114
+ * - `local` - Whether the change originated from this client.
115
+ *
116
+ * - `target` - The {@link ISharedDirectory} itself.
117
+ */
175
118
  (event: "valueChanged", listener: (
176
119
  changed: IDirectoryValueChanged,
177
120
  local: boolean,
178
121
  target: IEventThisPlaceHolder,
179
122
  ) => void);
123
+
124
+ /**
125
+ * Emitted when the {@link ISharedDirectory} is cleared.
126
+ *
127
+ * @remarks Listener parameters:
128
+ *
129
+ * - `local` - Whether the clear originated from this client.
130
+ *
131
+ * - `target` - The {@link ISharedDirectory} itself.
132
+ */
180
133
  (event: "clear", listener: (
181
134
  local: boolean,
182
135
  target: IEventThisPlaceHolder,
183
136
  ) => void);
137
+
138
+ /**
139
+ * Emitted when a subdirectory is created.
140
+ *
141
+ * @remarks Listener parameters:
142
+ *
143
+ * - `path` - The relative path to the subdirectory that is created.
144
+ * It is relative from the object which raises the event.
145
+ *
146
+ * - `local` - Whether the create originated from the this client.
147
+ *
148
+ * - `target` - The {@link ISharedDirectory} itself.
149
+ */
184
150
  (event: "subDirectoryCreated", listener: (
185
151
  path: string,
186
152
  local: boolean,
187
153
  target: IEventThisPlaceHolder,
188
154
  ) => void);
155
+
156
+ /**
157
+ * Emitted when a subdirectory is deleted.
158
+ *
159
+ * @remarks Listener parameters:
160
+ *
161
+ * - `path` - The relative path to the subdirectory that is deleted.
162
+ * It is relative from the object which raises the event.
163
+ *
164
+ * - `local` - Whether the delete originated from the this client.
165
+ *
166
+ * - `target` - The {@link ISharedDirectory} itself.
167
+ */
189
168
  // eslint-disable-next-line @typescript-eslint/unified-signatures
190
169
  (event: "subDirectoryDeleted", listener: (
191
170
  path: string,
@@ -196,95 +175,80 @@ export interface ISharedDirectoryEvents extends ISharedObjectEvents {
196
175
 
197
176
  /**
198
177
  * Events emitted in response to changes to the directory data.
199
- *
200
- * @remarks
201
- *
202
- * The following is the list of events emitted.
203
- *
204
- * ### "containedValueChanged"
205
- *
206
- * The containedValueChanged event is emitted when a key is set or deleted. As opposed to the SharedDirectory's
207
- * valueChanged event, this is emitted only on the IDirectory that directly contains the key.
208
- *
209
- * #### Listener signature
210
- *
211
- * ```typescript
212
- * (changed: IValueChanged, local: boolean, target: IEventThisPlaceHolder) => void
213
- * ```
214
- * - `changed` - Information on the key that changed and its value prior to the change.
215
- *
216
- * - `local` - Whether the change originated from this client.
217
- *
218
- * - `target` - The IDirectory itself.
219
- *
220
- * ### "subDirectoryCreated"
221
- *
222
- * The subDirectoryCreated event is emitted when a subdirectory is created.
223
- *
224
- * #### Listener signature
225
- *
226
- * ```typescript
227
- * (path: string, local: boolean, target: IEventThisPlaceHolder) => void
228
- * ```
229
- * - `path` - The relative path to the subdirectory that is created.
230
- * It is relative from the object which raises the event.
231
- *
232
- * - `local` - Whether the creation originated from the this client.
233
- *
234
- * - `target` - The ISharedDirectory itself.
235
- *
236
- * ### "subDirectoryDeleted"
237
- *
238
- * The subDirectoryDeleted event is emitted when a subdirectory is deleted.
239
- *
240
- * #### Listener signature
241
- *
242
- * ```typescript
243
- * (path: string, local: boolean, target: IEventThisPlaceHolder) => void
244
- * ```
245
- * - `path` - The relative path to the subdirectory that is deleted.
246
- * It is relative from the object which raises the event.
247
- *
248
- * - `local` - Whether the delete originated from the this client.
249
- *
250
- * - `target` - The ISharedDirectory itself.
251
- *
252
- * ### "disposed"
253
- *
254
- * The dispose event is emitted when this sub directory is deleted.
255
- *
256
- * #### Listener signature
257
- *
258
- * ```typescript
259
- * (local: boolean, target: IEventThisPlaceHolder) => void
260
- * ```
261
- *
262
- * - `target` - The IDirectory itself.
263
178
  */
264
179
  export interface IDirectoryEvents extends IEvent {
180
+ /**
181
+ * Emitted when a key is set or deleted. As opposed to the
182
+ * {@link SharedDirectory}'s valueChanged event, this is emitted only on the {@link IDirectory} that directly
183
+ * contains the key.
184
+ *
185
+ * @remarks Listener parameters:
186
+ *
187
+ * - `changed` - Information on the key that changed and its value prior to the change.
188
+ *
189
+ * - `local` - Whether the change originated from this client.
190
+ *
191
+ * - `target` - The {@link IDirectory} itself.
192
+ */
265
193
  (event: "containedValueChanged", listener: (
266
194
  changed: IValueChanged,
267
195
  local: boolean,
268
196
  target: IEventThisPlaceHolder,
269
197
  ) => void);
198
+
199
+ /**
200
+ * Emitted when a subdirectory is created.
201
+ *
202
+ * @remarks Listener parameters:
203
+ *
204
+ * - `path` - The relative path to the subdirectory that is created.
205
+ * It is relative from the object which raises the event.
206
+ *
207
+ * - `local` - Whether the creation originated from the this client.
208
+ *
209
+ * - `target` - The {@link ISharedDirectory} itself.
210
+ */
270
211
  (event: "subDirectoryCreated", listener: (
271
212
  path: string,
272
213
  local: boolean,
273
214
  target: IEventThisPlaceHolder,
274
215
  ) => void);
216
+
217
+ /**
218
+ * Emitted when a subdirectory is deleted.
219
+ *
220
+ * @remarks Listener parameters:
221
+ *
222
+ * - `path` - The relative path to the subdirectory that is deleted.
223
+ * It is relative from the object which raises the event.
224
+ *
225
+ * - `local` - Whether the delete originated from the this client.
226
+ *
227
+ * - `target` - The {@link ISharedDirectory} itself.
228
+ */
275
229
  // eslint-disable-next-line @typescript-eslint/unified-signatures
276
230
  (event: "subDirectoryDeleted", listener: (
277
231
  path: string,
278
232
  local: boolean,
279
233
  target: IEventThisPlaceHolder,
280
234
  ) => void);
235
+
236
+ /**
237
+ * Emitted when this sub directory is deleted.
238
+ *
239
+ * @remarks Listener parameters:
240
+ *
241
+ * - `target` - The {@link IDirectory} itself.
242
+ */
281
243
  (event: "disposed", listener: (
282
244
  target: IEventThisPlaceHolder,
283
245
  ) => void);
284
246
  }
285
247
 
286
248
  /**
287
- * Interface describing a shared directory.
249
+ * Provides a hierarchical organization of map-like data structures as SubDirectories.
250
+ * The values stored within can be accessed like a map, and the hierarchy can be navigated using path syntax.
251
+ * SubDirectories can be retrieved for use as working directories.
288
252
  */
289
253
  export interface ISharedDirectory extends
290
254
  ISharedObject<ISharedDirectoryEvents & IDirectoryEvents>,
@@ -296,7 +260,7 @@ export interface ISharedDirectory extends
296
260
  }
297
261
 
298
262
  /**
299
- * Type of "valueChanged" event parameter for SharedDirectory.
263
+ * Type of "valueChanged" event parameter for {@link ISharedDirectory}
300
264
  */
301
265
  export interface IDirectoryValueChanged extends IValueChanged {
302
266
  /**
@@ -306,60 +270,51 @@ export interface IDirectoryValueChanged extends IValueChanged {
306
270
  }
307
271
 
308
272
  /**
309
- * Events emitted in response to changes to the map data.
310
- *
311
- * @remarks
312
- *
313
- * The following is the list of events emitted.
314
- *
315
- * ### "valueChanged"
316
- *
317
- * The valueChanged event is emitted when a key is set or deleted.
318
- *
319
- * #### Listener signature
320
- *
321
- * ```typescript
322
- * (
323
- * changed: IValueChanged,
324
- * local: boolean,
325
- * target: IEventThisPlaceHolder,
326
- * ) => void
327
- * ```
328
- * - `changed` - Information on the key that changed and its value prior to the change.
329
- *
330
- * - `local` - Whether the change originated from this client.
331
- *
332
- * - `target` - The map itself.
333
- *
334
- * ### "clear"
335
- *
336
- * The clear event is emitted when the map is cleared.
337
- *
338
- * #### Listener signature
339
- *
340
- * ```typescript
341
- * (local: boolean, target: IEventThisPlaceHolder) => void
342
- * ```
343
- * - `local` - Whether the clear originated from this client.
344
- *
345
- * - `target` - The map itself.
273
+ * Events emitted in response to changes to the {@link ISharedMap | map} data.
346
274
  */
347
275
  export interface ISharedMapEvents extends ISharedObjectEvents {
276
+ /**
277
+ * Emitted when a key is set or deleted.
278
+ *
279
+ * @remarks Listener parameters:
280
+ *
281
+ * - `changed` - Information on the key that changed and its value prior to the change.
282
+ *
283
+ * - `local` - Whether the change originated from this client.
284
+ *
285
+ * - `target` - The {@link ISharedMap} itself.
286
+ */
348
287
  (event: "valueChanged", listener: (
349
288
  changed: IValueChanged,
350
289
  local: boolean,
351
290
  target: IEventThisPlaceHolder) => void);
291
+
292
+ /**
293
+ * Emitted when the map is cleared.
294
+ *
295
+ * @remarks Listener parameters:
296
+ *
297
+ * - `local` - Whether the clear originated from this client.
298
+ *
299
+ * - `target` - The {@link ISharedMap} itself.
300
+ */
352
301
  (event: "clear", listener: (
353
302
  local: boolean,
354
303
  target: IEventThisPlaceHolder) => void);
355
304
  }
356
305
 
357
306
  /**
358
- * Shared map interface
307
+ * The SharedMap distributed data structure can be used to store key-value pairs. It provides the same API for setting
308
+ * and retrieving values that JavaScript developers are accustomed to with the
309
+ * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map | Map} built-in object.
310
+ * However, the keys of a SharedMap must be strings, and the values must either be a JSON-serializable object or a
311
+ * {@link @fluidframework/shared-object-base#SharedObjectHandle}.
312
+ *
313
+ * For more information, including example usages, see {@link https://fluidframework.com/docs/data-structures/map/}.
359
314
  */
360
315
  export interface ISharedMap extends ISharedObject<ISharedMapEvents>, Map<string, any> {
361
316
  /**
362
- * Retrieves the given key from the map.
317
+ * Retrieves the given key from the map if it exists.
363
318
  * @param key - Key to retrieve from
364
319
  * @returns The stored value, or undefined if the key is not set
365
320
  */
@@ -367,16 +322,17 @@ export interface ISharedMap extends ISharedObject<ISharedMapEvents>, Map<string,
367
322
 
368
323
  /**
369
324
  * Sets the value stored at key to the provided value.
370
- * @param key - Key to set at
325
+ * @param key - Key to set
371
326
  * @param value - Value to set
372
- * @returns The ISharedMap itself
327
+ * @returns The {@link ISharedMap} itself
373
328
  */
374
329
  set<T = any>(key: string, value: T): this;
375
330
  }
376
331
 
377
332
  /**
378
333
  * The _ready-for-serialization_ format of values contained in DDS contents. This allows us to use
379
- * ISerializableValue.type to understand whether they're storing a Plain JS object, a SharedObject, or a value type.
334
+ * {@link ISerializableValue."type"} to understand whether they're storing a Plain JavaScript object,
335
+ * a {@link @fluidframework/shared-object-base#SharedObject}, or a value type.
380
336
  *
381
337
  * @remarks
382
338
  *
@@ -384,13 +340,17 @@ export interface ISharedMap extends ISharedObject<ISharedMapEvents>, Map<string,
384
340
  * the _in-memory representation_ of the value instead). An ISerializableValue is what gets passed to
385
341
  * JSON.stringify and comes out of JSON.parse. This format is used both for snapshots (loadCore/populate)
386
342
  * and ops (set).
343
+ *
387
344
  * If type is Plain, it must be a plain JS object that can survive a JSON.stringify/parse. E.g. a URL object will
388
345
  * just get stringified to a URL string and not rehydrate as a URL object on the other side. It may contain members
389
346
  * that are ISerializedHandle (the serialized form of a handle).
347
+ *
390
348
  * If type is a value type then it must be amongst the types registered via registerValueType or we won't know how
391
349
  * to serialize/deserialize it (we rely on its factory via .load() and .store()). Its value will be type-dependent.
392
350
  * If type is Shared, then the in-memory value will just be a reference to the SharedObject. Its value will be a
393
- * channel ID. This type is legacy and deprecated.
351
+ * channel ID.
352
+ *
353
+ * @deprecated This type is legacy and deprecated.
394
354
  */
395
355
  export interface ISerializableValue {
396
356
  /**
@@ -404,6 +364,9 @@ export interface ISerializableValue {
404
364
  value: any;
405
365
  }
406
366
 
367
+ /**
368
+ * Serialized {@link ISerializableValue} counterpart.
369
+ */
407
370
  export interface ISerializedValue {
408
371
  /**
409
372
  * A type annotation to help indicate how the value serializes.
@@ -412,6 +375,8 @@ export interface ISerializedValue {
412
375
 
413
376
  /**
414
377
  * String representation of the value.
378
+ *
379
+ * @remarks Will be undefined if the original value was undefined.
415
380
  */
416
381
  value: string | undefined;
417
382
  }