@fluidframework/map 2.0.0-rc.3.0.3 → 2.0.0-rc.4.0.1

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 (83) hide show
  1. package/.eslintrc.cjs +1 -1
  2. package/CHANGELOG.md +13 -0
  3. package/api-report/map.api.md +32 -7
  4. package/dist/directory.d.ts +23 -15
  5. package/dist/directory.d.ts.map +1 -1
  6. package/dist/directory.js +1 -0
  7. package/dist/directory.js.map +1 -1
  8. package/dist/directoryFactory.d.ts +0 -1
  9. package/dist/directoryFactory.d.ts.map +1 -1
  10. package/dist/directoryFactory.js +2 -28
  11. package/dist/directoryFactory.js.map +1 -1
  12. package/dist/index.d.ts +3 -1
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js.map +1 -1
  15. package/dist/interfaces.d.ts +2 -2
  16. package/dist/interfaces.d.ts.map +1 -1
  17. package/dist/interfaces.js.map +1 -1
  18. package/dist/internalInterfaces.d.ts +2 -2
  19. package/dist/internalInterfaces.d.ts.map +1 -1
  20. package/dist/internalInterfaces.js.map +1 -1
  21. package/dist/legacy.d.ts +5 -1
  22. package/dist/localValues.d.ts +3 -3
  23. package/dist/localValues.d.ts.map +1 -1
  24. package/dist/localValues.js.map +1 -1
  25. package/dist/map.d.ts +5 -6
  26. package/dist/map.d.ts.map +1 -1
  27. package/dist/map.js +1 -1
  28. package/dist/map.js.map +1 -1
  29. package/dist/mapFactory.d.ts.map +1 -1
  30. package/dist/mapFactory.js +2 -8
  31. package/dist/mapFactory.js.map +1 -1
  32. package/dist/mapKernel.d.ts +7 -11
  33. package/dist/mapKernel.d.ts.map +1 -1
  34. package/dist/mapKernel.js.map +1 -1
  35. package/dist/packageVersion.d.ts +1 -1
  36. package/dist/packageVersion.js +1 -1
  37. package/dist/packageVersion.js.map +1 -1
  38. package/lib/directory.d.ts +23 -15
  39. package/lib/directory.d.ts.map +1 -1
  40. package/lib/directory.js +1 -0
  41. package/lib/directory.js.map +1 -1
  42. package/lib/directoryFactory.d.ts +0 -1
  43. package/lib/directoryFactory.d.ts.map +1 -1
  44. package/lib/directoryFactory.js +2 -28
  45. package/lib/directoryFactory.js.map +1 -1
  46. package/lib/index.d.ts +3 -1
  47. package/lib/index.d.ts.map +1 -1
  48. package/lib/index.js.map +1 -1
  49. package/lib/interfaces.d.ts +2 -2
  50. package/lib/interfaces.d.ts.map +1 -1
  51. package/lib/interfaces.js.map +1 -1
  52. package/lib/internalInterfaces.d.ts +2 -2
  53. package/lib/internalInterfaces.d.ts.map +1 -1
  54. package/lib/internalInterfaces.js.map +1 -1
  55. package/lib/legacy.d.ts +5 -1
  56. package/lib/localValues.d.ts +3 -3
  57. package/lib/localValues.d.ts.map +1 -1
  58. package/lib/localValues.js.map +1 -1
  59. package/lib/map.d.ts +5 -6
  60. package/lib/map.d.ts.map +1 -1
  61. package/lib/map.js +1 -1
  62. package/lib/map.js.map +1 -1
  63. package/lib/mapFactory.d.ts.map +1 -1
  64. package/lib/mapFactory.js +2 -8
  65. package/lib/mapFactory.js.map +1 -1
  66. package/lib/mapKernel.d.ts +7 -11
  67. package/lib/mapKernel.d.ts.map +1 -1
  68. package/lib/mapKernel.js.map +1 -1
  69. package/lib/packageVersion.d.ts +1 -1
  70. package/lib/packageVersion.js +1 -1
  71. package/lib/packageVersion.js.map +1 -1
  72. package/lib/tsdoc-metadata.json +1 -1
  73. package/package.json +30 -81
  74. package/src/directory.ts +38 -25
  75. package/src/directoryFactory.ts +3 -29
  76. package/src/index.ts +3 -1
  77. package/src/interfaces.ts +2 -2
  78. package/src/internalInterfaces.ts +2 -3
  79. package/src/localValues.ts +4 -4
  80. package/src/map.ts +7 -7
  81. package/src/mapFactory.ts +2 -11
  82. package/src/mapKernel.ts +10 -14
  83. package/src/packageVersion.ts +1 -1
@@ -10,6 +10,7 @@ import type {
10
10
  IFluidDataStoreRuntime,
11
11
  } from "@fluidframework/datastore-definitions";
12
12
  import type { ISharedObjectKind } from "@fluidframework/shared-object-base";
13
+ import { createSharedObjectKind } from "@fluidframework/shared-object-base/internal";
13
14
 
14
15
  import { SharedDirectory as SharedDirectoryInternal } from "./directory.js";
15
16
  import type { ISharedDirectory } from "./interfaces.js";
@@ -78,37 +79,10 @@ export class DirectoryFactory implements IChannelFactory<ISharedDirectory> {
78
79
 
79
80
  /**
80
81
  * Entrypoint for {@link ISharedDirectory} creation.
81
- * @sealed
82
82
  * @alpha
83
83
  */
84
- export const SharedDirectory: ISharedObjectKind<ISharedDirectory> = {
85
- /**
86
- * Create a new shared directory
87
- *
88
- * @param runtime - Data store runtime the new shared directory belongs to
89
- * @param id - Optional name of the shared directory
90
- * @returns Newly create shared directory (but not attached yet)
91
- *
92
- * @example
93
- * To create a `SharedDirectory`, call the static create method:
94
- *
95
- * ```typescript
96
- * const myDirectory = SharedDirectory.create(this.runtime, id);
97
- * ```
98
- */
99
- create(runtime: IFluidDataStoreRuntime, id?: string): ISharedDirectory {
100
- return runtime.createChannel(id, DirectoryFactory.Type) as ISharedDirectory;
101
- },
102
-
103
- /**
104
- * Get a factory for SharedDirectory to register with the data store.
105
- *
106
- * @returns A factory that creates and load SharedDirectory
107
- */
108
- getFactory(): IChannelFactory<ISharedDirectory> {
109
- return new DirectoryFactory();
110
- },
111
- };
84
+ export const SharedDirectory: ISharedObjectKind<ISharedDirectory> =
85
+ createSharedObjectKind(DirectoryFactory);
112
86
 
113
87
  /**
114
88
  * Entrypoint for {@link ISharedDirectory} creation.
package/src/index.ts CHANGED
@@ -15,7 +15,7 @@
15
15
  * @packageDocumentation
16
16
  */
17
17
 
18
- export {
18
+ export type {
19
19
  IDirectory,
20
20
  IDirectoryEvents,
21
21
  IDirectoryValueChanged,
@@ -27,3 +27,5 @@ export {
27
27
  } from "./interfaces.js";
28
28
  export { MapFactory, SharedMap } from "./mapFactory.js";
29
29
  export { DirectoryFactory, SharedDirectory } from "./directoryFactory.js";
30
+ export type { ICreateInfo, IDirectoryNewStorageFormat, IDirectoryDataObject } from "./directory.js";
31
+ export type { ISerializableValue } from "./internalInterfaces.js";
package/src/interfaces.ts CHANGED
@@ -3,13 +3,13 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import {
6
+ import type {
7
7
  IDisposable,
8
8
  IEvent,
9
9
  IEventProvider,
10
10
  IEventThisPlaceHolder,
11
11
  } from "@fluidframework/core-interfaces";
12
- import { ISharedObject, ISharedObjectEvents } from "@fluidframework/shared-object-base";
12
+ import type { ISharedObject, ISharedObjectEvents } from "@fluidframework/shared-object-base";
13
13
 
14
14
  /**
15
15
  * Type of "valueChanged" event parameter.
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { ILocalValue } from "./localValues.js";
6
+ import type { ILocalValue } from "./localValues.js";
7
7
 
8
8
  /**
9
9
  * Operation indicating a value should be set for a key.
@@ -22,7 +22,6 @@ export interface IMapSetOperation {
22
22
  /**
23
23
  * Value to be set on the key.
24
24
  */
25
- // eslint-disable-next-line import/no-deprecated
26
25
  value: ISerializableValue;
27
26
  }
28
27
 
@@ -137,7 +136,7 @@ export type MapLocalOpMetadata = IMapClearLocalOpMetadata | MapKeyLocalOpMetadat
137
136
  * If type is Shared, then the in-memory value will just be a reference to the SharedObject. Its value will be a
138
137
  * channel ID.
139
138
  *
140
- * @deprecated This type is legacy and deprecated.
139
+ * @deprecated This type is legacy and deprecated(AB#8004).
141
140
  * @alpha
142
141
  */
143
142
  export interface ISerializableValue {
@@ -3,9 +3,9 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { IFluidHandle } from "@fluidframework/core-interfaces";
7
- import { ISerializedHandle } from "@fluidframework/runtime-utils/internal";
8
- import { IFluidSerializer } from "@fluidframework/shared-object-base";
6
+ import type { IFluidHandle } from "@fluidframework/core-interfaces";
7
+ import type { ISerializedHandle } from "@fluidframework/runtime-utils/internal";
8
+ import type { IFluidSerializer } from "@fluidframework/shared-object-base";
9
9
  import {
10
10
  ValueType,
11
11
  parseHandles,
@@ -13,7 +13,7 @@ import {
13
13
  } from "@fluidframework/shared-object-base/internal";
14
14
 
15
15
  // eslint-disable-next-line import/no-deprecated
16
- import { ISerializableValue, ISerializedValue } from "./internalInterfaces.js";
16
+ import type { ISerializableValue, ISerializedValue } from "./internalInterfaces.js";
17
17
 
18
18
  /**
19
19
  * A local value to be stored in a container type Distributed Data Store (DDS).
package/src/map.ts CHANGED
@@ -3,20 +3,20 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import {
6
+ import type {
7
7
  IChannelAttributes,
8
8
  IChannelStorageService,
9
9
  IFluidDataStoreRuntime,
10
10
  } from "@fluidframework/datastore-definitions";
11
11
  import { readAndParse } from "@fluidframework/driver-utils/internal";
12
- import { ISequencedDocumentMessage, MessageType } from "@fluidframework/protocol-definitions";
13
- import { ISummaryTreeWithStats, ITelemetryContext } from "@fluidframework/runtime-definitions";
12
+ import { MessageType, type ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
13
+ import type { ISummaryTreeWithStats, ITelemetryContext } from "@fluidframework/runtime-definitions";
14
14
  import { SummaryTreeBuilder } from "@fluidframework/runtime-utils/internal";
15
- import { IFluidSerializer } from "@fluidframework/shared-object-base";
15
+ import type { IFluidSerializer } from "@fluidframework/shared-object-base";
16
16
  import { SharedObject } from "@fluidframework/shared-object-base/internal";
17
17
 
18
- import { ISharedMap, ISharedMapEvents } from "./interfaces.js";
19
- import { IMapDataObjectSerializable, IMapOperation, MapKernel } from "./mapKernel.js";
18
+ import type { ISharedMap, ISharedMapEvents } from "./interfaces.js";
19
+ import { type IMapDataObjectSerializable, type IMapOperation, MapKernel } from "./mapKernel.js";
20
20
 
21
21
  interface IMapSerializationFormat {
22
22
  blobs?: string[];
@@ -27,7 +27,6 @@ const snapshotFileName = "header";
27
27
 
28
28
  /**
29
29
  * {@inheritDoc ISharedMap}
30
- * @alpha
31
30
  */
32
31
  export class SharedMap extends SharedObject<ISharedMapEvents> implements ISharedMap {
33
32
  /**
@@ -285,6 +284,7 @@ export class SharedMap extends SharedObject<ISharedMapEvents> implements IShared
285
284
  local: boolean,
286
285
  localOpMetadata: unknown,
287
286
  ): void {
287
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison
288
288
  if (message.type === MessageType.Operation) {
289
289
  this.kernel.tryProcessMessage(
290
290
  message.contents as IMapOperation,
package/src/mapFactory.ts CHANGED
@@ -3,8 +3,6 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- /* eslint-disable import/no-deprecated */
7
-
8
6
  import type {
9
7
  IChannelAttributes,
10
8
  IChannelFactory,
@@ -12,6 +10,7 @@ import type {
12
10
  IFluidDataStoreRuntime,
13
11
  } from "@fluidframework/datastore-definitions";
14
12
  import type { ISharedObjectKind } from "@fluidframework/shared-object-base";
13
+ import { createSharedObjectKind } from "@fluidframework/shared-object-base/internal";
15
14
 
16
15
  import type { ISharedMap } from "./interfaces.js";
17
16
  import { SharedMap as SharedMapInternal } from "./map.js";
@@ -82,15 +81,7 @@ export class MapFactory implements IChannelFactory<ISharedMap> {
82
81
  * Entrypoint for {@link ISharedMap} creation.
83
82
  * @alpha
84
83
  */
85
- export const SharedMap: ISharedObjectKind<ISharedMap> = {
86
- getFactory(): IChannelFactory<ISharedMap> {
87
- return new MapFactory();
88
- },
89
-
90
- create(runtime: IFluidDataStoreRuntime, id?: string): ISharedMap {
91
- return runtime.createChannel(id, MapFactory.Type) as ISharedMap;
92
- },
93
- };
84
+ export const SharedMap: ISharedObjectKind<ISharedMap> = createSharedObjectKind(MapFactory);
94
85
 
95
86
  /**
96
87
  * Entrypoint for {@link ISharedMap} creation.
package/src/mapKernel.ts CHANGED
@@ -3,14 +3,14 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { TypedEventEmitter } from "@fluid-internal/client-utils";
7
- import { IFluidHandle } from "@fluidframework/core-interfaces";
6
+ import type { TypedEventEmitter } from "@fluid-internal/client-utils";
7
+ import type { IFluidHandle } from "@fluidframework/core-interfaces";
8
8
  import { assert, unreachableCase } from "@fluidframework/core-utils/internal";
9
- import { IFluidSerializer } from "@fluidframework/shared-object-base";
9
+ import type { IFluidSerializer } from "@fluidframework/shared-object-base";
10
10
  import { ValueType, bindHandles } from "@fluidframework/shared-object-base/internal";
11
11
 
12
- import { ISharedMapEvents } from "./interfaces.js";
13
- import {
12
+ import type { ISharedMapEvents } from "./interfaces.js";
13
+ import type {
14
14
  IMapClearLocalOpMetadata,
15
15
  IMapClearOperation,
16
16
  IMapDeleteOperation,
@@ -21,7 +21,7 @@ import {
21
21
  ISerializableValue,
22
22
  ISerializedValue,
23
23
  } from "./internalInterfaces.js";
24
- import { ILocalValue, LocalValueMaker, makeSerializable } from "./localValues.js";
24
+ import { type ILocalValue, LocalValueMaker, makeSerializable } from "./localValues.js";
25
25
 
26
26
  /**
27
27
  * Defines the means to process and submit a given op on a map.
@@ -62,17 +62,13 @@ export type IMapOperation = IMapKeyOperation | IMapClearOperation;
62
62
  * | JSON.stringify}, direct result from
63
63
  * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse | JSON.parse}.
64
64
  */
65
- export interface IMapDataObjectSerializable {
66
- // eslint-disable-next-line import/no-deprecated
67
- [key: string]: ISerializableValue;
68
- }
65
+ // eslint-disable-next-line import/no-deprecated
66
+ export type IMapDataObjectSerializable = Record<string, ISerializableValue>;
69
67
 
70
68
  /**
71
69
  * Serialized key/value data.
72
70
  */
73
- export interface IMapDataObjectSerialized {
74
- [key: string]: ISerializedValue;
75
- }
71
+ export type IMapDataObjectSerialized = Record<string, ISerializedValue>;
76
72
 
77
73
  type MapKeyLocalOpMetadata = IMapKeyEditLocalOpMetadata | IMapKeyAddLocalOpMetadata;
78
74
  type MapLocalOpMetadata = IMapClearLocalOpMetadata | MapKeyLocalOpMetadata;
@@ -153,7 +149,7 @@ export class MapKernel {
153
149
  /**
154
150
  * Keys that have been modified locally but not yet ack'd from the server.
155
151
  */
156
- private readonly pendingKeys: Map<string, number[]> = new Map();
152
+ private readonly pendingKeys = new Map<string, number[]>();
157
153
 
158
154
  /**
159
155
  * This is used to assign a unique id to every outgoing operation and helps in tracking unack'd ops.
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/map";
9
- export const pkgVersion = "2.0.0-rc.3.0.3";
9
+ export const pkgVersion = "2.0.0-rc.4.0.1";