@fluidframework/map 2.0.0-rc.2.0.1 → 2.0.0-rc.3.0.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 (129) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/api-report/map.api.md +17 -158
  3. package/dist/directory.d.ts +7 -51
  4. package/dist/directory.d.ts.map +1 -1
  5. package/dist/directory.js +39 -107
  6. package/dist/directory.js.map +1 -1
  7. package/dist/directoryFactory.d.ts +54 -0
  8. package/dist/directoryFactory.d.ts.map +1 -0
  9. package/dist/directoryFactory.js +91 -0
  10. package/dist/directoryFactory.js.map +1 -0
  11. package/dist/index.d.ts +3 -45
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +7 -55
  14. package/dist/index.js.map +1 -1
  15. package/dist/interfaces.d.ts +7 -57
  16. package/dist/interfaces.d.ts.map +1 -1
  17. package/dist/interfaces.js.map +1 -1
  18. package/dist/internalInterfaces.d.ts +50 -1
  19. package/dist/internalInterfaces.d.ts.map +1 -1
  20. package/dist/internalInterfaces.js.map +1 -1
  21. package/dist/legacy.d.ts +25 -0
  22. package/dist/localValues.d.ts +1 -1
  23. package/dist/localValues.d.ts.map +1 -1
  24. package/dist/localValues.js +6 -6
  25. package/dist/localValues.js.map +1 -1
  26. package/dist/map.d.ts +4 -36
  27. package/dist/map.d.ts.map +1 -1
  28. package/dist/map.js +9 -60
  29. package/dist/map.js.map +1 -1
  30. package/dist/mapFactory.d.ts +52 -0
  31. package/dist/mapFactory.d.ts.map +1 -0
  32. package/dist/mapFactory.js +71 -0
  33. package/dist/mapFactory.js.map +1 -0
  34. package/dist/mapKernel.d.ts +3 -3
  35. package/dist/mapKernel.d.ts.map +1 -1
  36. package/dist/mapKernel.js +14 -14
  37. package/dist/mapKernel.js.map +1 -1
  38. package/dist/packageVersion.d.ts +1 -1
  39. package/dist/packageVersion.js +1 -1
  40. package/dist/packageVersion.js.map +1 -1
  41. package/dist/public.d.ts +12 -0
  42. package/internal.d.ts +11 -0
  43. package/legacy.d.ts +11 -0
  44. package/lib/directory.d.ts +7 -51
  45. package/lib/directory.d.ts.map +1 -1
  46. package/lib/directory.js +6 -73
  47. package/lib/directory.js.map +1 -1
  48. package/lib/directoryFactory.d.ts +54 -0
  49. package/lib/directoryFactory.d.ts.map +1 -0
  50. package/lib/directoryFactory.js +87 -0
  51. package/lib/directoryFactory.js.map +1 -0
  52. package/lib/index.d.ts +3 -45
  53. package/lib/index.d.ts.map +1 -1
  54. package/lib/index.js +2 -50
  55. package/lib/index.js.map +1 -1
  56. package/lib/interfaces.d.ts +7 -57
  57. package/lib/interfaces.d.ts.map +1 -1
  58. package/lib/interfaces.js.map +1 -1
  59. package/lib/internalInterfaces.d.ts +50 -1
  60. package/lib/internalInterfaces.d.ts.map +1 -1
  61. package/lib/internalInterfaces.js.map +1 -1
  62. package/lib/legacy.d.ts +25 -0
  63. package/lib/localValues.d.ts +1 -1
  64. package/lib/localValues.d.ts.map +1 -1
  65. package/lib/localValues.js +1 -1
  66. package/lib/localValues.js.map +1 -1
  67. package/lib/map.d.ts +4 -36
  68. package/lib/map.d.ts.map +1 -1
  69. package/lib/map.js +4 -54
  70. package/lib/map.js.map +1 -1
  71. package/lib/mapFactory.d.ts +52 -0
  72. package/lib/mapFactory.d.ts.map +1 -0
  73. package/lib/mapFactory.js +67 -0
  74. package/lib/mapFactory.js.map +1 -0
  75. package/lib/mapKernel.d.ts +3 -3
  76. package/lib/mapKernel.d.ts.map +1 -1
  77. package/lib/mapKernel.js +2 -2
  78. package/lib/mapKernel.js.map +1 -1
  79. package/lib/packageVersion.d.ts +1 -1
  80. package/lib/packageVersion.js +1 -1
  81. package/lib/packageVersion.js.map +1 -1
  82. package/lib/public.d.ts +12 -0
  83. package/package.json +105 -59
  84. package/src/directory.ts +16 -100
  85. package/src/directoryFactory.ts +120 -0
  86. package/src/index.ts +2 -73
  87. package/src/interfaces.ts +7 -62
  88. package/src/internalInterfaces.ts +55 -2
  89. package/src/localValues.ts +6 -5
  90. package/src/map.ts +8 -71
  91. package/src/mapFactory.ts +101 -0
  92. package/src/mapKernel.ts +13 -9
  93. package/src/packageVersion.ts +1 -1
  94. package/api-extractor-cjs.json +0 -8
  95. package/dist/map-alpha.d.ts +0 -898
  96. package/dist/map-beta.d.ts +0 -195
  97. package/dist/map-public.d.ts +0 -195
  98. package/dist/map-untrimmed.d.ts +0 -912
  99. package/lib/map-alpha.d.ts +0 -898
  100. package/lib/map-beta.d.ts +0 -195
  101. package/lib/map-public.d.ts +0 -195
  102. package/lib/map-untrimmed.d.ts +0 -912
  103. package/lib/test/memory/directory.spec.js +0 -71
  104. package/lib/test/memory/directory.spec.js.map +0 -1
  105. package/lib/test/memory/map.spec.js +0 -71
  106. package/lib/test/memory/map.spec.js.map +0 -1
  107. package/lib/test/mocha/directory.order.spec.js +0 -422
  108. package/lib/test/mocha/directory.order.spec.js.map +0 -1
  109. package/lib/test/mocha/directory.snapshot.spec.js +0 -111
  110. package/lib/test/mocha/directory.snapshot.spec.js.map +0 -1
  111. package/lib/test/mocha/directory.spec.js +0 -1406
  112. package/lib/test/mocha/directory.spec.js.map +0 -1
  113. package/lib/test/mocha/directoryEquivalenceUtils.js +0 -36
  114. package/lib/test/mocha/directoryEquivalenceUtils.js.map +0 -1
  115. package/lib/test/mocha/directoryFuzzTests.spec.js +0 -337
  116. package/lib/test/mocha/directoryFuzzTests.spec.js.map +0 -1
  117. package/lib/test/mocha/dirname.cjs +0 -16
  118. package/lib/test/mocha/dirname.cjs.map +0 -1
  119. package/lib/test/mocha/map.fuzz.spec.js +0 -114
  120. package/lib/test/mocha/map.fuzz.spec.js.map +0 -1
  121. package/lib/test/mocha/map.spec.js +0 -685
  122. package/lib/test/mocha/map.spec.js.map +0 -1
  123. package/lib/test/mocha/rebasing.spec.js +0 -158
  124. package/lib/test/mocha/rebasing.spec.js.map +0 -1
  125. package/lib/test/mocha/reconnection.spec.js +0 -327
  126. package/lib/test/mocha/reconnection.spec.js.map +0 -1
  127. package/lib/test/types/validateMapPrevious.generated.js +0 -66
  128. package/lib/test/types/validateMapPrevious.generated.js.map +0 -1
  129. /package/{dist → lib}/tsdoc-metadata.json +0 -0
@@ -1,912 +0,0 @@
1
- /**
2
- * The `map` library provides interfaces and implementing classes for map-like distributed data structures.
3
- *
4
- * @remarks The following distributed data structures are defined in this library:
5
- *
6
- * - {@link SharedMap}
7
- *
8
- * - {@link SharedDirectory}
9
- *
10
- * @packageDocumentation
11
- */
12
-
13
- import { IChannelAttributes } from '@fluidframework/datastore-definitions';
14
- import { IChannelFactory } from '@fluidframework/datastore-definitions';
15
- import { IChannelServices } from '@fluidframework/datastore-definitions';
16
- import { IChannelStorageService } from '@fluidframework/datastore-definitions';
17
- import { IDisposable } from '@fluidframework/core-interfaces';
18
- import { IEvent } from '@fluidframework/core-interfaces';
19
- import { IEventProvider } from '@fluidframework/core-interfaces';
20
- import { IEventThisPlaceHolder } from '@fluidframework/core-interfaces';
21
- import { IFluidDataStoreRuntime } from '@fluidframework/datastore-definitions';
22
- import { IFluidHandle } from '@fluidframework/core-interfaces';
23
- import { IFluidSerializer } from '@fluidframework/shared-object-base';
24
- import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
25
- import { ISharedObject } from '@fluidframework/shared-object-base';
26
- import { ISharedObjectEvents } from '@fluidframework/shared-object-base';
27
- import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
28
- import { ITelemetryContext } from '@fluidframework/runtime-definitions';
29
- import { SharedObject } from '@fluidframework/shared-object-base';
30
-
31
- /**
32
- * {@link @fluidframework/datastore-definitions#IChannelFactory} for {@link SharedDirectory}.
33
- *
34
- * @sealed
35
- * @alpha
36
- */
37
- export declare class DirectoryFactory implements IChannelFactory<ISharedDirectory> {
38
- /**
39
- * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory."type"}
40
- */
41
- static readonly Type = "https://graph.microsoft.com/types/directory";
42
- /**
43
- * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.attributes}
44
- */
45
- static readonly Attributes: IChannelAttributes;
46
- /**
47
- * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory."type"}
48
- */
49
- get type(): string;
50
- /**
51
- * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.attributes}
52
- */
53
- get attributes(): IChannelAttributes;
54
- /**
55
- * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}
56
- */
57
- load(runtime: IFluidDataStoreRuntime, id: string, services: IChannelServices, attributes: IChannelAttributes): Promise<ISharedDirectory>;
58
- /**
59
- * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.create}
60
- */
61
- create(runtime: IFluidDataStoreRuntime, id: string): ISharedDirectory;
62
- }
63
-
64
- /**
65
- * Create info for the subdirectory.
66
- * @alpha
67
- */
68
- export declare interface ICreateInfo {
69
- /**
70
- * Sequence number at which this subdirectory was created.
71
- */
72
- csn: number;
73
- /**
74
- * clientids of the clients which created this sub directory.
75
- */
76
- ccIds: string[];
77
- }
78
-
79
- /**
80
- * Interface describing actions on a directory.
81
- *
82
- * @remarks When used as a Map, operates on its keys.
83
- * @alpha
84
- */
85
- export declare interface IDirectory extends Map<string, any>, IEventProvider<IDirectoryEvents>, Partial<IDisposable> {
86
- /**
87
- * The absolute path of the directory.
88
- */
89
- readonly absolutePath: string;
90
- /**
91
- * Retrieves the value stored at the given key from the directory.
92
- * @param key - Key to retrieve from
93
- * @returns The stored value, or undefined if the key is not set
94
- */
95
- get<T = any>(key: string): T | undefined;
96
- /**
97
- * Sets the value stored at key to the provided value.
98
- * @param key - Key to set at
99
- * @param value - Value to set
100
- * @returns The IDirectory itself
101
- */
102
- set<T = unknown>(key: string, value: T): this;
103
- /**
104
- * Get the number of sub directory within the directory.
105
- * @returns The number of sub directory within a directory.
106
- */
107
- countSubDirectory?(): number;
108
- /**
109
- * Creates an IDirectory child of this IDirectory, or retrieves the existing IDirectory child if one with the
110
- * same name already exists.
111
- * @param subdirName - Name of the new child directory to create
112
- * @returns The IDirectory child that was created or retrieved
113
- */
114
- createSubDirectory(subdirName: string): IDirectory;
115
- /**
116
- * Gets an IDirectory child of this IDirectory, if it exists.
117
- * @param subdirName - Name of the child directory to get
118
- * @returns The requested IDirectory
119
- */
120
- getSubDirectory(subdirName: string): IDirectory | undefined;
121
- /**
122
- * Checks whether this directory has a child directory with the given name.
123
- * @param subdirName - Name of the child directory to check
124
- * @returns True if it exists, false otherwise
125
- */
126
- hasSubDirectory(subdirName: string): boolean;
127
- /**
128
- * Deletes an IDirectory child of this IDirectory, if it exists, along with all descendent keys and directories.
129
- * @param subdirName - Name of the child directory to delete
130
- * @returns True if the IDirectory existed and was deleted, false if it did not exist
131
- */
132
- deleteSubDirectory(subdirName: string): boolean;
133
- /**
134
- * Gets an iterator over the IDirectory children of this IDirectory.
135
- * @returns The IDirectory iterator
136
- */
137
- subdirectories(): IterableIterator<[string, IDirectory]>;
138
- /**
139
- * Get an IDirectory within the directory, in order to use relative paths from that location.
140
- * @param relativePath - Path of the IDirectory to get, relative to this IDirectory
141
- * @returns The requested IDirectory
142
- */
143
- getWorkingDirectory(relativePath: string): IDirectory | undefined;
144
- }
145
-
146
- /**
147
- * Operation indicating the directory should be cleared.
148
- * @alpha
149
- */
150
- export declare interface IDirectoryClearOperation {
151
- /**
152
- * String identifier of the operation type.
153
- */
154
- type: "clear";
155
- /**
156
- * Absolute path of the directory being cleared.
157
- */
158
- path: string;
159
- }
160
-
161
- /**
162
- * Operation indicating a subdirectory should be created.
163
- * @alpha
164
- */
165
- export declare interface IDirectoryCreateSubDirectoryOperation {
166
- /**
167
- * String identifier of the operation type.
168
- */
169
- type: "createSubDirectory";
170
- /**
171
- * Absolute path of the directory that will contain the new subdirectory.
172
- */
173
- path: string;
174
- /**
175
- * Name of the new subdirectory.
176
- */
177
- subdirName: string;
178
- }
179
-
180
- /**
181
- * Defines the in-memory object structure to be used for the conversion to/from serialized.
182
- *
183
- * @remarks Directly used in
184
- * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify
185
- * | JSON.stringify}, direct result from
186
- * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse | JSON.parse}.
187
- * @alpha
188
- */
189
- export declare interface IDirectoryDataObject {
190
- /**
191
- * Key/value date set by the user.
192
- */
193
- storage?: {
194
- [key: string]: ISerializableValue;
195
- };
196
- /**
197
- * Recursive sub-directories {@link IDirectoryDataObject | objects}.
198
- */
199
- subdirectories?: {
200
- [subdirName: string]: IDirectoryDataObject;
201
- };
202
- /**
203
- * Create info for the sub directory. Since directories with same name can get deleted/created by multiple clients
204
- * asynchronously, this info helps us to determine whether the ops where for the current instance of sub directory
205
- * or not and whether to process them or not based on that. Summaries which were not produced which this change
206
- * will not have this info and in that case we can still run in eventual consistency issues but that is no worse
207
- * than the state before this change.
208
- */
209
- ci?: ICreateInfo;
210
- }
211
-
212
- /**
213
- * Operation indicating a key should be deleted from the directory.
214
- * @alpha
215
- */
216
- export declare interface IDirectoryDeleteOperation {
217
- /**
218
- * String identifier of the operation type.
219
- */
220
- type: "delete";
221
- /**
222
- * Directory key being modified.
223
- */
224
- key: string;
225
- /**
226
- * Absolute path of the directory where the modified key is located.
227
- */
228
- path: string;
229
- }
230
-
231
- /**
232
- * Operation indicating a subdirectory should be deleted.
233
- * @alpha
234
- */
235
- export declare interface IDirectoryDeleteSubDirectoryOperation {
236
- /**
237
- * String identifier of the operation type.
238
- */
239
- type: "deleteSubDirectory";
240
- /**
241
- * Absolute path of the directory that contains the directory to be deleted.
242
- */
243
- path: string;
244
- /**
245
- * Name of the subdirectory to be deleted.
246
- */
247
- subdirName: string;
248
- }
249
-
250
- /**
251
- * Events emitted in response to changes to the directory data.
252
- * @alpha
253
- */
254
- export declare interface IDirectoryEvents extends IEvent {
255
- /**
256
- * Emitted when a key is set or deleted. As opposed to the
257
- * {@link SharedDirectory}'s valueChanged event, this is emitted only on the {@link IDirectory} that directly
258
- * contains the key.
259
- *
260
- * @remarks Listener parameters:
261
- *
262
- * - `changed` - Information on the key that changed and its value prior to the change.
263
- *
264
- * - `local` - Whether the change originated from this client.
265
- *
266
- * - `target` - The {@link IDirectory} itself.
267
- */
268
- (event: "containedValueChanged", listener: (changed: IValueChanged, local: boolean, target: IEventThisPlaceHolder) => void): any;
269
- /**
270
- * Emitted when a subdirectory is created. Also emitted when a delete
271
- * of a subdirectory is rolled back.
272
- *
273
- * @remarks Listener parameters:
274
- *
275
- * - `path` - The relative path to the subdirectory that is created.
276
- * It is relative from the object which raises the event.
277
- *
278
- * - `local` - Whether the creation originated from the this client.
279
- *
280
- * - `target` - The {@link ISharedDirectory} itself.
281
- */
282
- (event: "subDirectoryCreated", listener: (path: string, local: boolean, target: IEventThisPlaceHolder) => void): any;
283
- /**
284
- * Emitted when a subdirectory is deleted.
285
- *
286
- * @remarks Listener parameters:
287
- *
288
- * - `path` - The relative path to the subdirectory that is deleted.
289
- * It is relative from the object which raises the event.
290
- *
291
- * - `local` - Whether the delete originated from the this client.
292
- *
293
- * - `target` - The {@link ISharedDirectory} itself.
294
- */
295
- (event: "subDirectoryDeleted", listener: (path: string, local: boolean, target: IEventThisPlaceHolder) => void): any;
296
- /**
297
- * Emitted when this sub directory is deleted.
298
- *
299
- * @remarks Listener parameters:
300
- *
301
- * - `target` - The {@link IDirectory} itself.
302
- */
303
- (event: "disposed", listener: (target: IEventThisPlaceHolder) => void): any;
304
- /**
305
- * Emitted when this previously deleted sub directory is restored.
306
- * This event only needs to be handled in the case of rollback. If your application does
307
- * not use the local rollback feature, you can ignore this event.
308
- *
309
- * @remarks Listener parameters:
310
- *
311
- * - `target` - The {@link IDirectory} itself.
312
- */
313
- (event: "undisposed", listener: (target: IEventThisPlaceHolder) => void): any;
314
- }
315
-
316
- /**
317
- * An operation on a specific key within a directory.
318
- * @alpha
319
- */
320
- export declare type IDirectoryKeyOperation = IDirectorySetOperation | IDirectoryDeleteOperation;
321
-
322
- /**
323
- * {@link IDirectory} storage format.
324
- *
325
- * @internal
326
- */
327
- export declare interface IDirectoryNewStorageFormat {
328
- /**
329
- * Blob IDs representing larger directory data that was serialized.
330
- */
331
- blobs: string[];
332
- /**
333
- * Storage content representing directory data that was not serialized.
334
- */
335
- content: IDirectoryDataObject;
336
- }
337
-
338
- /**
339
- * Any operation on a directory.
340
- * @alpha
341
- */
342
- export declare type IDirectoryOperation = IDirectoryStorageOperation | IDirectorySubDirectoryOperation;
343
-
344
- /**
345
- * Operation indicating a value should be set for a key.
346
- * @alpha
347
- */
348
- export declare interface IDirectorySetOperation {
349
- /**
350
- * String identifier of the operation type.
351
- */
352
- type: "set";
353
- /**
354
- * Directory key being modified.
355
- */
356
- key: string;
357
- /**
358
- * Absolute path of the directory where the modified key is located.
359
- */
360
- path: string;
361
- /**
362
- * Value to be set on the key.
363
- */
364
- value: ISerializableValue;
365
- }
366
-
367
- /**
368
- * An operation on one or more of the keys within a directory.
369
- * @alpha
370
- */
371
- export declare type IDirectoryStorageOperation = IDirectoryKeyOperation | IDirectoryClearOperation;
372
-
373
- /**
374
- * An operation on the subdirectories within a directory.
375
- * @alpha
376
- */
377
- export declare type IDirectorySubDirectoryOperation = IDirectoryCreateSubDirectoryOperation | IDirectoryDeleteSubDirectoryOperation;
378
-
379
- /**
380
- * Type of "valueChanged" event parameter for {@link ISharedDirectory}.
381
- * @alpha
382
- */
383
- export declare interface IDirectoryValueChanged extends IValueChanged {
384
- /**
385
- * The absolute path to the IDirectory storing the key which changed.
386
- */
387
- path: string;
388
- }
389
-
390
- /**
391
- * A local value to be stored in a container type Distributed Data Store (DDS).
392
- * @alpha
393
- */
394
- export declare interface ILocalValue {
395
- /**
396
- * Type indicator of the value stored within.
397
- */
398
- readonly type: string;
399
- /**
400
- * The in-memory value stored within.
401
- */
402
- readonly value: any;
403
- /**
404
- * Retrieve the serialized form of the value stored within.
405
- * @param serializer - Data store runtime's serializer
406
- * @param bind - Container type's handle
407
- * @returns The serialized form of the contained value
408
- */
409
- makeSerialized(serializer: IFluidSerializer, bind: IFluidHandle): ISerializedValue;
410
- }
411
-
412
- /**
413
- * The _ready-for-serialization_ format of values contained in DDS contents. This allows us to use
414
- * {@link ISerializableValue."type"} to understand whether they're storing a Plain JavaScript object,
415
- * a {@link @fluidframework/shared-object-base#SharedObject}, or a value type.
416
- *
417
- * @remarks
418
- *
419
- * Note that the in-memory equivalent of ISerializableValue is ILocalValue (similarly holding a type, but with
420
- * the _in-memory representation_ of the value instead). An ISerializableValue is what gets passed to
421
- * JSON.stringify and comes out of JSON.parse. This format is used both for snapshots (loadCore/populate)
422
- * and ops (set).
423
- *
424
- * If type is Plain, it must be a plain JS object that can survive a JSON.stringify/parse. E.g. a URL object will
425
- * just get stringified to a URL string and not rehydrate as a URL object on the other side. It may contain members
426
- * that are ISerializedHandle (the serialized form of a handle).
427
- *
428
- * If type is a value type then it must be amongst the types registered via registerValueType or we won't know how
429
- * to serialize/deserialize it (we rely on its factory via .load() and .store()). Its value will be type-dependent.
430
- * If type is Shared, then the in-memory value will just be a reference to the SharedObject. Its value will be a
431
- * channel ID.
432
- *
433
- * @deprecated This type is legacy and deprecated.
434
- * @alpha
435
- */
436
- export declare interface ISerializableValue {
437
- /**
438
- * A type annotation to help indicate how the value serializes.
439
- */
440
- type: string;
441
- /**
442
- * The JSONable representation of the value.
443
- */
444
- value: any;
445
- }
446
-
447
- /**
448
- * Serialized {@link ISerializableValue} counterpart.
449
- * @alpha
450
- */
451
- export declare interface ISerializedValue {
452
- /**
453
- * A type annotation to help indicate how the value serializes.
454
- */
455
- type: string;
456
- /**
457
- * String representation of the value.
458
- *
459
- * @remarks Will be undefined if the original value was undefined.
460
- */
461
- value: string | undefined;
462
- }
463
-
464
- /**
465
- * Provides a hierarchical organization of map-like data structures as SubDirectories.
466
- * The values stored within can be accessed like a map, and the hierarchy can be navigated using path syntax.
467
- * SubDirectories can be retrieved for use as working directories.
468
- * @alpha
469
- */
470
- export declare interface ISharedDirectory extends ISharedObject<ISharedDirectoryEvents & IDirectoryEvents>, Omit<IDirectory, "on" | "once" | "off"> {
471
- [Symbol.iterator](): IterableIterator<[string, any]>;
472
- readonly [Symbol.toStringTag]: string;
473
- }
474
-
475
- /**
476
- * Events emitted in response to changes to the directory data.
477
- *
478
- * @remarks
479
- * These events only emit on the {@link ISharedDirectory} itself, and not on subdirectories.
480
- * @alpha
481
- */
482
- export declare interface ISharedDirectoryEvents extends ISharedObjectEvents {
483
- /**
484
- * Emitted when a key is set or deleted. This is emitted for any key in the {@link ISharedDirectory} or any
485
- * subdirectory.
486
- *
487
- * @remarks Listener parameters:
488
- *
489
- * - `changed` - Information on the key that changed, its value prior to the change, and the path to the
490
- * key that changed.
491
- *
492
- * - `local` - Whether the change originated from this client.
493
- *
494
- * - `target` - The {@link ISharedDirectory} itself.
495
- */
496
- (event: "valueChanged", listener: (changed: IDirectoryValueChanged, local: boolean, target: IEventThisPlaceHolder) => void): any;
497
- /**
498
- * Emitted when the {@link ISharedDirectory} is cleared.
499
- *
500
- * @remarks Listener parameters:
501
- *
502
- * - `local` - Whether the clear originated from this client.
503
- *
504
- * - `target` - The {@link ISharedDirectory} itself.
505
- */
506
- (event: "clear", listener: (local: boolean, target: IEventThisPlaceHolder) => void): any;
507
- /**
508
- * Emitted when a subdirectory is created.
509
- *
510
- * @remarks Listener parameters:
511
- *
512
- * - `path` - The relative path to the subdirectory that is created.
513
- * It is relative from the object which raises the event.
514
- *
515
- * - `local` - Whether the create originated from the this client.
516
- *
517
- * - `target` - The {@link ISharedDirectory} itself.
518
- */
519
- (event: "subDirectoryCreated", listener: (path: string, local: boolean, target: IEventThisPlaceHolder) => void): any;
520
- /**
521
- * Emitted when a subdirectory is deleted.
522
- *
523
- * @remarks Listener parameters:
524
- *
525
- * - `path` - The relative path to the subdirectory that is deleted.
526
- * It is relative from the object which raises the event.
527
- *
528
- * - `local` - Whether the delete originated from the this client.
529
- *
530
- * - `target` - The {@link ISharedDirectory} itself.
531
- */
532
- (event: "subDirectoryDeleted", listener: (path: string, local: boolean, target: IEventThisPlaceHolder) => void): any;
533
- }
534
-
535
- /**
536
- * The SharedMap distributed data structure can be used to store key-value pairs. It provides the same API for setting
537
- * and retrieving values that JavaScript developers are accustomed to with the
538
- * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map | Map} built-in object.
539
- * However, the keys of a SharedMap must be strings, and the values must either be a JSON-serializable object or a
540
- * {@link @fluidframework/datastore#FluidObjectHandle}.
541
- *
542
- * For more information, including example usages, see {@link https://fluidframework.com/docs/data-structures/map/}.
543
- * @sealed
544
- * @public
545
- */
546
- export declare interface ISharedMap extends ISharedObject<ISharedMapEvents>, Map<string, any> {
547
- /**
548
- * Retrieves the given key from the map if it exists.
549
- * @param key - Key to retrieve from
550
- * @returns The stored value, or undefined if the key is not set
551
- */
552
- get<T = any>(key: string): T | undefined;
553
- /**
554
- * Sets the value stored at key to the provided value.
555
- * @param key - Key to set
556
- * @param value - Value to set
557
- * @returns The {@link ISharedMap} itself
558
- */
559
- set<T = unknown>(key: string, value: T): this;
560
- }
561
-
562
- /**
563
- * Events emitted in response to changes to the {@link ISharedMap | map} data.
564
- * @sealed
565
- * @public
566
- */
567
- export declare interface ISharedMapEvents extends ISharedObjectEvents {
568
- /**
569
- * Emitted when a key is set or deleted.
570
- *
571
- * @remarks Listener parameters:
572
- *
573
- * - `changed` - Information on the key that changed and its value prior to the change.
574
- *
575
- * - `local` - Whether the change originated from this client.
576
- *
577
- * - `target` - The {@link ISharedMap} itself.
578
- */
579
- (event: "valueChanged", listener: (changed: IValueChanged, local: boolean, target: IEventThisPlaceHolder) => void): any;
580
- /**
581
- * Emitted when the map is cleared.
582
- *
583
- * @remarks Listener parameters:
584
- *
585
- * - `local` - Whether the clear originated from this client.
586
- *
587
- * - `target` - The {@link ISharedMap} itself.
588
- */
589
- (event: "clear", listener: (local: boolean, target: IEventThisPlaceHolder) => void): any;
590
- }
591
-
592
- /**
593
- * Type of "valueChanged" event parameter.
594
- * @sealed
595
- * @public
596
- */
597
- export declare interface IValueChanged {
598
- /**
599
- * The key storing the value that changed.
600
- */
601
- key: string;
602
- /**
603
- * The value that was stored at the key prior to the change.
604
- */
605
- previousValue: any;
606
- }
607
-
608
- /**
609
- * Enables a container type {@link https://fluidframework.com/docs/build/dds/ | DDS} to produce and store local
610
- * values with minimal awareness of how those objects are stored, serialized, and deserialized.
611
- * @alpha
612
- */
613
- export declare class LocalValueMaker {
614
- /**
615
- * Create a new LocalValueMaker.
616
- */
617
- constructor();
618
- /**
619
- * Create a new local value from an incoming serialized value.
620
- * @param serializable - The serializable value to make local
621
- */
622
- fromSerializable(serializable: ISerializableValue, serializer: IFluidSerializer, bind: IFluidHandle): ILocalValue;
623
- /**
624
- * Create a new local value containing a given plain object.
625
- * @param value - The value to store
626
- * @returns An ILocalValue containing the value
627
- */
628
- fromInMemory(value: unknown): ILocalValue;
629
- }
630
-
631
- /**
632
- * {@link @fluidframework/datastore-definitions#IChannelFactory} for {@link ISharedMap}.
633
- *
634
- * @sealed
635
- * @alpha
636
- */
637
- export declare class MapFactory implements IChannelFactory<ISharedMap> {
638
- /**
639
- * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory."type"}
640
- */
641
- static readonly Type = "https://graph.microsoft.com/types/map";
642
- /**
643
- * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.attributes}
644
- */
645
- static readonly Attributes: IChannelAttributes;
646
- /**
647
- * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory."type"}
648
- */
649
- get type(): string;
650
- /**
651
- * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.attributes}
652
- */
653
- get attributes(): IChannelAttributes;
654
- /**
655
- * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}
656
- */
657
- load(runtime: IFluidDataStoreRuntime, id: string, services: IChannelServices, attributes: IChannelAttributes): Promise<ISharedMap>;
658
- /**
659
- * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.create}
660
- */
661
- create(runtime: IFluidDataStoreRuntime, id: string): ISharedMap;
662
- }
663
-
664
- /**
665
- * {@inheritDoc ISharedDirectory}
666
- *
667
- * @example
668
- *
669
- * ```typescript
670
- * mySharedDirectory.createSubDirectory("a").createSubDirectory("b").createSubDirectory("c").set("foo", val1);
671
- * const mySubDir = mySharedDirectory.getWorkingDirectory("/a/b/c");
672
- * mySubDir.get("foo"); // returns val1
673
- * ```
674
- *
675
- * @sealed
676
- * @alpha
677
- */
678
- export declare class SharedDirectory extends SharedObject<ISharedDirectoryEvents> implements ISharedDirectory {
679
- /**
680
- * Create a new shared directory
681
- *
682
- * @param runtime - Data store runtime the new shared directory belongs to
683
- * @param id - Optional name of the shared directory
684
- * @returns Newly create shared directory (but not attached yet)
685
- */
686
- static create(runtime: IFluidDataStoreRuntime, id?: string): ISharedDirectory;
687
- /**
688
- * Get a factory for SharedDirectory to register with the data store.
689
- *
690
- * @returns A factory that creates and load SharedDirectory
691
- */
692
- static getFactory(): IChannelFactory<ISharedDirectory>;
693
- /**
694
- * String representation for the class.
695
- */
696
- [Symbol.toStringTag]: string;
697
- /**
698
- * {@inheritDoc IDirectory.absolutePath}
699
- */
700
- get absolutePath(): string;
701
- /***/
702
- readonly localValueMaker: LocalValueMaker;
703
- /**
704
- * Root of the SharedDirectory, most operations on the SharedDirectory itself act on the root.
705
- */
706
- private readonly root;
707
- /**
708
- * Mapping of op types to message handlers.
709
- */
710
- private readonly messageHandlers;
711
- /**
712
- * Constructs a new shared directory. If the object is non-local an id and service interfaces will
713
- * be provided.
714
- * @param id - String identifier for the SharedDirectory
715
- * @param runtime - Data store runtime
716
- * @param type - Type identifier
717
- */
718
- constructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes);
719
- /**
720
- * {@inheritDoc IDirectory.get}
721
- */
722
- get<T = any>(key: string): T | undefined;
723
- /**
724
- * {@inheritDoc IDirectory.set}
725
- */
726
- set<T = unknown>(key: string, value: T): this;
727
- dispose(error?: Error): void;
728
- get disposed(): boolean;
729
- /**
730
- * Deletes the given key from within this IDirectory.
731
- * @param key - The key to delete
732
- * @returns True if the key existed and was deleted, false if it did not exist
733
- */
734
- delete(key: string): boolean;
735
- /**
736
- * Deletes all keys from within this IDirectory.
737
- */
738
- clear(): void;
739
- /**
740
- * Checks whether the given key exists in this IDirectory.
741
- * @param key - The key to check
742
- * @returns True if the key exists, false otherwise
743
- */
744
- has(key: string): boolean;
745
- /**
746
- * The number of entries under this IDirectory.
747
- */
748
- get size(): number;
749
- /**
750
- * Issue a callback on each entry under this IDirectory.
751
- * @param callback - Callback to issue
752
- */
753
- forEach(callback: (value: any, key: string, map: Map<string, any>) => void): void;
754
- /**
755
- * Get an iterator over the entries under this IDirectory.
756
- * @returns The iterator
757
- */
758
- [Symbol.iterator](): IterableIterator<[string, any]>;
759
- /**
760
- * Get an iterator over the entries under this IDirectory.
761
- * @returns The iterator
762
- */
763
- entries(): IterableIterator<[string, any]>;
764
- /**
765
- * {@inheritDoc IDirectory.countSubDirectory}
766
- */
767
- countSubDirectory(): number;
768
- /**
769
- * Get an iterator over the keys under this IDirectory.
770
- * @returns The iterator
771
- */
772
- keys(): IterableIterator<string>;
773
- /**
774
- * Get an iterator over the values under this IDirectory.
775
- * @returns The iterator
776
- */
777
- values(): IterableIterator<any>;
778
- /**
779
- * {@inheritDoc IDirectory.createSubDirectory}
780
- */
781
- createSubDirectory(subdirName: string): IDirectory;
782
- /**
783
- * {@inheritDoc IDirectory.getSubDirectory}
784
- */
785
- getSubDirectory(subdirName: string): IDirectory | undefined;
786
- /**
787
- * {@inheritDoc IDirectory.hasSubDirectory}
788
- */
789
- hasSubDirectory(subdirName: string): boolean;
790
- /**
791
- * {@inheritDoc IDirectory.deleteSubDirectory}
792
- */
793
- deleteSubDirectory(subdirName: string): boolean;
794
- /**
795
- * {@inheritDoc IDirectory.subdirectories}
796
- */
797
- subdirectories(): IterableIterator<[string, IDirectory]>;
798
- /**
799
- * {@inheritDoc IDirectory.getWorkingDirectory}
800
- */
801
- getWorkingDirectory(relativePath: string): IDirectory | undefined;
802
- /**
803
- * {@inheritDoc @fluidframework/shared-object-base#SharedObject.summarizeCore}
804
- */
805
- protected summarizeCore(serializer: IFluidSerializer, telemetryContext?: ITelemetryContext): ISummaryTreeWithStats;
806
- /**
807
- * Submits an operation
808
- * @param op - Op to submit
809
- * @param localOpMetadata - The local metadata associated with the op. We send a unique id that is used to track
810
- * this op while it has not been ack'd. This will be sent when we receive this op back from the server.
811
- */
812
- submitDirectoryMessage(op: IDirectoryOperation, localOpMetadata: unknown): void;
813
- /**
814
- * {@inheritDoc @fluidframework/shared-object-base#SharedObject.onDisconnect}
815
- */
816
- protected onDisconnect(): void;
817
- /**
818
- * {@inheritDoc @fluidframework/shared-object-base#SharedObject.reSubmitCore}
819
- */
820
- protected reSubmitCore(content: unknown, localOpMetadata: unknown): void;
821
- /**
822
- * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}
823
- */
824
- protected loadCore(storage: IChannelStorageService): Promise<void>;
825
- /**
826
- * Populate the directory with the given directory data.
827
- * @param data - A JSON string containing serialized directory data
828
- */
829
- protected populate(data: IDirectoryDataObject): void;
830
- /**
831
- * {@inheritDoc @fluidframework/shared-object-base#SharedObject.processCore}
832
- */
833
- protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
834
- /**
835
- * {@inheritDoc @fluidframework/shared-object-base#SharedObject.rollback}
836
- */
837
- protected rollback(content: unknown, localOpMetadata: unknown): void;
838
- /**
839
- * Converts the given relative path to absolute against the root.
840
- * @param relativePath - The path to convert
841
- */
842
- private makeAbsolute;
843
- /**
844
- * The remote ISerializableValue we're receiving (either as a result of a snapshot load or an incoming set op)
845
- * will have the information we need to create a real object, but will not be the real object yet. For example,
846
- * we might know it's a map and the ID but not have the actual map or its data yet. makeLocal's job
847
- * is to convert that information into a real object for local usage.
848
- * @param key - Key of element being converted
849
- * @param absolutePath - Path of element being converted
850
- * @param serializable - The remote information that we can convert into a real object
851
- * @returns The local value that was produced
852
- */
853
- private makeLocal;
854
- /**
855
- * This checks if there is pending delete op for local delete for a any subdir in the relative path.
856
- * @param relativePath - path of sub directory.
857
- * @returns `true` if there is pending delete, `false` otherwise.
858
- */
859
- private isSubDirectoryDeletePending;
860
- /**
861
- * Set the message handlers for the directory.
862
- */
863
- private setMessageHandlers;
864
- /**
865
- * {@inheritDoc @fluidframework/shared-object-base#SharedObjectCore.applyStashedOp}
866
- */
867
- protected applyStashedOp(op: unknown): void;
868
- private serializeDirectory;
869
- }
870
-
871
- /**
872
- * {@inheritDoc ISharedMap}
873
- * @public
874
- * @deprecated Please use SharedTree for new containers. SharedMap is supported for loading preexisting Fluid Framework 1.0 containers only.
875
- */
876
- export declare const SharedMap: {
877
- /**
878
- * Get a factory for SharedMap to register with the data store.
879
- * @returns A factory that creates SharedMaps and loads them from storage.
880
- */
881
- getFactory(): IChannelFactory<ISharedMap>;
882
- /**
883
- * Create a new shared map.
884
- * @param runtime - The data store runtime that the new shared map belongs to.
885
- * @param id - Optional name of the shared map.
886
- * @returns Newly created shared map.
887
- *
888
- * @example
889
- * To create a `SharedMap`, call the static create method:
890
- *
891
- * ```typescript
892
- * const myMap = SharedMap.create(this.runtime, id);
893
- * ```
894
- * @privateRemarks
895
- * TODO:
896
- * Clarify how this differs from `MapFactory.create`.
897
- * They are different since making this forward to MapFactory.create breaks some things,
898
- * but the difference is unclear from the documentation.
899
- */
900
- create(runtime: IFluidDataStoreRuntime, id?: string): ISharedMap;
901
- };
902
-
903
- /**
904
- * {@inheritDoc ISharedMap}
905
- * @public
906
- * @deprecated Use ISharedMap instead.
907
- * @privateRemarks
908
- * This alias is for legacy compat from when the SharedMap class was exported as public.
909
- */
910
- export declare type SharedMap = ISharedMap;
911
-
912
- export { }