@fluidframework/map 2.0.0-internal.3.0.2 → 2.0.0-internal.3.2.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 (57) hide show
  1. package/.eslintrc.js +11 -16
  2. package/.mocharc.js +2 -2
  3. package/README.md +3 -3
  4. package/api-extractor.json +2 -2
  5. package/dist/directory.d.ts +1 -1
  6. package/dist/directory.d.ts.map +1 -1
  7. package/dist/directory.js +40 -18
  8. package/dist/directory.js.map +1 -1
  9. package/dist/interfaces.d.ts +12 -12
  10. package/dist/interfaces.d.ts.map +1 -1
  11. package/dist/interfaces.js.map +1 -1
  12. package/dist/internalInterfaces.d.ts.map +1 -1
  13. package/dist/internalInterfaces.js.map +1 -1
  14. package/dist/localValues.d.ts.map +1 -1
  15. package/dist/localValues.js.map +1 -1
  16. package/dist/map.d.ts +1 -1
  17. package/dist/map.d.ts.map +1 -1
  18. package/dist/map.js +4 -2
  19. package/dist/map.js.map +1 -1
  20. package/dist/mapKernel.d.ts.map +1 -1
  21. package/dist/mapKernel.js +33 -22
  22. package/dist/mapKernel.js.map +1 -1
  23. package/dist/packageVersion.d.ts +1 -1
  24. package/dist/packageVersion.js +1 -1
  25. package/dist/packageVersion.js.map +1 -1
  26. package/lib/directory.d.ts +1 -1
  27. package/lib/directory.d.ts.map +1 -1
  28. package/lib/directory.js +42 -20
  29. package/lib/directory.js.map +1 -1
  30. package/lib/interfaces.d.ts +12 -12
  31. package/lib/interfaces.d.ts.map +1 -1
  32. package/lib/interfaces.js.map +1 -1
  33. package/lib/internalInterfaces.d.ts.map +1 -1
  34. package/lib/internalInterfaces.js.map +1 -1
  35. package/lib/localValues.d.ts.map +1 -1
  36. package/lib/localValues.js.map +1 -1
  37. package/lib/map.d.ts +1 -1
  38. package/lib/map.d.ts.map +1 -1
  39. package/lib/map.js +5 -3
  40. package/lib/map.js.map +1 -1
  41. package/lib/mapKernel.d.ts.map +1 -1
  42. package/lib/mapKernel.js +34 -23
  43. package/lib/mapKernel.js.map +1 -1
  44. package/lib/packageVersion.d.ts +1 -1
  45. package/lib/packageVersion.js +1 -1
  46. package/lib/packageVersion.js.map +1 -1
  47. package/package.json +50 -50
  48. package/prettier.config.cjs +1 -1
  49. package/src/directory.ts +1952 -1875
  50. package/src/interfaces.ts +303 -306
  51. package/src/internalInterfaces.ts +67 -67
  52. package/src/localValues.ts +85 -94
  53. package/src/map.ts +363 -355
  54. package/src/mapKernel.ts +725 -690
  55. package/src/packageVersion.ts +1 -1
  56. package/tsconfig.esnext.json +5 -5
  57. package/tsconfig.json +9 -15
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/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 { ISharedObject, ISharedObjectEvents } from \"@fluidframework/shared-object-base\";\nimport { IDisposable, IEvent, IEventProvider, IEventThisPlaceHolder } from \"@fluidframework/common-definitions\";\n\n/**\n * Type of \"valueChanged\" event parameter.\n */\nexport interface IValueChanged {\n /**\n * The key storing the value that changed.\n */\n key: string;\n\n /**\n * The value that was stored at the key prior to the change.\n */\n // TODO: Use `unknown` instead (breaking change).\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n previousValue: any;\n}\n\n/**\n * Interface describing actions on a directory.\n *\n * @remarks When used as a Map, operates on its keys.\n */\n// TODO: Use `unknown` instead (breaking change).\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface IDirectory extends Map<string, any>, IEventProvider<IDirectoryEvents>, Partial<IDisposable> {\n /**\n * The absolute path of the directory.\n */\n readonly absolutePath: string;\n\n /**\n * Retrieves the value stored at the given key from the directory.\n * @param key - Key to retrieve from\n * @returns The stored value, or undefined if the key is not set\n */\n // TODO: Use `unknown` instead (breaking change).\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n get<T = any>(key: string): T | undefined;\n\n /**\n * Sets the value stored at key to the provided value.\n * @param key - Key to set at\n * @param value - Value to set\n * @returns The IDirectory itself\n */\n set<T = unknown>(key: string, value: T): this;\n\n /**\n * Get the number of sub directory within the directory.\n * @returns The number of sub directory within a directory.\n */\n countSubDirectory?(): number;\n\n /**\n * Creates an IDirectory child of this IDirectory, or retrieves the existing IDirectory child if one with the\n * same name already exists.\n * @param subdirName - Name of the new child directory to create\n * @returns The IDirectory child that was created or retrieved\n */\n createSubDirectory(subdirName: string): IDirectory;\n\n /**\n * Gets an IDirectory child of this IDirectory, if it exists.\n * @param subdirName - Name of the child directory to get\n * @returns The requested IDirectory\n */\n getSubDirectory(subdirName: string): IDirectory | undefined;\n\n /**\n * Checks whether this directory has a child directory with the given name.\n * @param subdirName - Name of the child directory to check\n * @returns True if it exists, false otherwise\n */\n hasSubDirectory(subdirName: string): boolean;\n\n /**\n * Deletes an IDirectory child of this IDirectory, if it exists, along with all descendent keys and directories.\n * @param subdirName - Name of the child directory to delete\n * @returns True if the IDirectory existed and was deleted, false if it did not exist\n */\n deleteSubDirectory(subdirName: string): boolean;\n\n /**\n * Gets an iterator over the IDirectory children of this IDirectory.\n * @returns The IDirectory iterator\n */\n subdirectories(): IterableIterator<[string, IDirectory]>;\n\n /**\n * Get an IDirectory within the directory, in order to use relative paths from that location.\n * @param relativePath - Path of the IDirectory to get, relative to this IDirectory\n * @returns The requested IDirectory\n */\n getWorkingDirectory(relativePath: string): IDirectory | undefined;\n}\n\n/**\n * Events emitted in response to changes to the directory data.\n * These events only emit on the {@link ISharedDirectory} itself, and not on subdirectories.\n */\nexport interface ISharedDirectoryEvents extends ISharedObjectEvents {\n /**\n * Emitted when a key is set or deleted. This is emitted for any key in the {@link ISharedDirectory} or any\n * subdirectory.\n *\n * @remarks Listener parameters:\n *\n * - `changed` - Information on the key that changed, its value prior to the change, and the path to the\n * key that changed.\n *\n * - `local` - Whether the change originated from this client.\n *\n * - `target` - The {@link ISharedDirectory} itself.\n */\n (event: \"valueChanged\", listener: (\n changed: IDirectoryValueChanged,\n local: boolean,\n target: IEventThisPlaceHolder,\n ) => void);\n\n /**\n * Emitted when the {@link ISharedDirectory} is cleared.\n *\n * @remarks Listener parameters:\n *\n * - `local` - Whether the clear originated from this client.\n *\n * - `target` - The {@link ISharedDirectory} itself.\n */\n (event: \"clear\", listener: (\n local: boolean,\n target: IEventThisPlaceHolder,\n ) => void);\n\n /**\n * Emitted when a subdirectory is created.\n *\n * @remarks Listener parameters:\n *\n * - `path` - The relative path to the subdirectory that is created.\n * It is relative from the object which raises the event.\n *\n * - `local` - Whether the create originated from the this client.\n *\n * - `target` - The {@link ISharedDirectory} itself.\n */\n (event: \"subDirectoryCreated\", listener: (\n path: string,\n local: boolean,\n target: IEventThisPlaceHolder,\n ) => void);\n\n /**\n * Emitted when a subdirectory is deleted.\n *\n * @remarks Listener parameters:\n *\n * - `path` - The relative path to the subdirectory that is deleted.\n * It is relative from the object which raises the event.\n *\n * - `local` - Whether the delete originated from the this client.\n *\n * - `target` - The {@link ISharedDirectory} itself.\n */\n (event: \"subDirectoryDeleted\", listener: (\n path: string,\n local: boolean,\n target: IEventThisPlaceHolder,\n ) => void);\n}\n\n/**\n * Events emitted in response to changes to the directory data.\n */\nexport interface IDirectoryEvents extends IEvent {\n /**\n * Emitted when a key is set or deleted. As opposed to the\n * {@link SharedDirectory}'s valueChanged event, this is emitted only on the {@link IDirectory} that directly\n * contains the key.\n *\n * @remarks Listener parameters:\n *\n * - `changed` - Information on the key that changed and its value prior to the change.\n *\n * - `local` - Whether the change originated from this client.\n *\n * - `target` - The {@link IDirectory} itself.\n */\n (event: \"containedValueChanged\", listener: (\n changed: IValueChanged,\n local: boolean,\n target: IEventThisPlaceHolder,\n ) => void);\n\n /**\n * Emitted when a subdirectory is created. Also emitted when a delete\n * of a subdirectory is rolled back.\n *\n * @remarks Listener parameters:\n *\n * - `path` - The relative path to the subdirectory that is created.\n * It is relative from the object which raises the event.\n *\n * - `local` - Whether the creation originated from the this client.\n *\n * - `target` - The {@link ISharedDirectory} itself.\n */\n (event: \"subDirectoryCreated\", listener: (\n path: string,\n local: boolean,\n target: IEventThisPlaceHolder,\n ) => void);\n\n /**\n * Emitted when a subdirectory is deleted.\n *\n * @remarks Listener parameters:\n *\n * - `path` - The relative path to the subdirectory that is deleted.\n * It is relative from the object which raises the event.\n *\n * - `local` - Whether the delete originated from the this client.\n *\n * - `target` - The {@link ISharedDirectory} itself.\n */\n (event: \"subDirectoryDeleted\", listener: (\n path: string,\n local: boolean,\n target: IEventThisPlaceHolder,\n ) => void);\n\n /**\n * Emitted when this sub directory is deleted.\n *\n * @remarks Listener parameters:\n *\n * - `target` - The {@link IDirectory} itself.\n */\n (event: \"disposed\", listener: (\n target: IEventThisPlaceHolder,\n ) => void);\n\n /**\n * Emitted when this previously deleted sub directory is restored.\n * This event only needs to be handled in the case of rollback. If your application does\n * not use the local rollback feature, you can ignore this event.\n *\n * @remarks Listener parameters:\n *\n * - `target` - The {@link IDirectory} itself.\n */\n (event: \"undisposed\", listener: (\n target: IEventThisPlaceHolder,\n ) => void);\n}\n\n/**\n * Provides a hierarchical organization of map-like data structures as SubDirectories.\n * The values stored within can be accessed like a map, and the hierarchy can be navigated using path syntax.\n * SubDirectories can be retrieved for use as working directories.\n */\nexport interface ISharedDirectory\n extends ISharedObject<ISharedDirectoryEvents & IDirectoryEvents>, Omit<IDirectory, \"on\" | \"once\" | \"off\">\n{\n // The Omit type excludes symbols, which we don't want to exclude. Adding them back here manually.\n // https://github.com/microsoft/TypeScript/issues/31671\n // TODO: Use `unknown` instead (breaking change).\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [Symbol.iterator](): IterableIterator<[string, any]>;\n readonly [Symbol.toStringTag]: string;\n}\n\n/**\n * Type of \"valueChanged\" event parameter for {@link ISharedDirectory}\n */\nexport interface IDirectoryValueChanged extends IValueChanged {\n /**\n * The absolute path to the IDirectory storing the key which changed.\n */\n path: string;\n}\n\n/**\n * Events emitted in response to changes to the {@link ISharedMap | map} data.\n */\nexport interface ISharedMapEvents extends ISharedObjectEvents {\n /**\n * Emitted when a key is set or deleted.\n *\n * @remarks Listener parameters:\n *\n * - `changed` - Information on the key that changed and its value prior to the change.\n *\n * - `local` - Whether the change originated from this client.\n *\n * - `target` - The {@link ISharedMap} itself.\n */\n (event: \"valueChanged\", listener: (\n changed: IValueChanged,\n local: boolean,\n target: IEventThisPlaceHolder) => void);\n\n /**\n * Emitted when the map is cleared.\n *\n * @remarks Listener parameters:\n *\n * - `local` - Whether the clear originated from this client.\n *\n * - `target` - The {@link ISharedMap} itself.\n */\n (event: \"clear\", listener: (\n local: boolean,\n target: IEventThisPlaceHolder) => void);\n}\n\n/**\n * The SharedMap distributed data structure can be used to store key-value pairs. It provides the same API for setting\n * and retrieving values that JavaScript developers are accustomed to with the\n * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map | Map} built-in object.\n * However, the keys of a SharedMap must be strings, and the values must either be a JSON-serializable object or a\n * {@link @fluidframework/datastore#FluidObjectHandle}.\n *\n * For more information, including example usages, see {@link https://fluidframework.com/docs/data-structures/map/}.\n */\n// TODO: Use `unknown` instead (breaking change).\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface ISharedMap extends ISharedObject<ISharedMapEvents>, Map<string, any> {\n /**\n * Retrieves the given key from the map if it exists.\n * @param key - Key to retrieve from\n * @returns The stored value, or undefined if the key is not set\n */\n // TODO: Use `unknown` instead (breaking change).\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n get<T = any>(key: string): T | undefined;\n\n /**\n * Sets the value stored at key to the provided value.\n * @param key - Key to set\n * @param value - Value to set\n * @returns The {@link ISharedMap} itself\n */\n set<T = unknown>(key: string, value: T): this;\n}\n\n/**\n * The _ready-for-serialization_ format of values contained in DDS contents. This allows us to use\n * {@link ISerializableValue.\"type\"} to understand whether they're storing a Plain JavaScript object,\n * a {@link @fluidframework/shared-object-base#SharedObject}, or a value type.\n *\n * @remarks\n *\n * Note that the in-memory equivalent of ISerializableValue is ILocalValue (similarly holding a type, but with\n * the _in-memory representation_ of the value instead). An ISerializableValue is what gets passed to\n * JSON.stringify and comes out of JSON.parse. This format is used both for snapshots (loadCore/populate)\n * and ops (set).\n *\n * If type is Plain, it must be a plain JS object that can survive a JSON.stringify/parse. E.g. a URL object will\n * just get stringified to a URL string and not rehydrate as a URL object on the other side. It may contain members\n * that are ISerializedHandle (the serialized form of a handle).\n *\n * If type is a value type then it must be amongst the types registered via registerValueType or we won't know how\n * to serialize/deserialize it (we rely on its factory via .load() and .store()). Its value will be type-dependent.\n * If type is Shared, then the in-memory value will just be a reference to the SharedObject. Its value will be a\n * channel ID.\n *\n * @deprecated This type is legacy and deprecated.\n */\nexport interface ISerializableValue {\n /**\n * A type annotation to help indicate how the value serializes.\n */\n type: string;\n\n /**\n * The JSONable representation of the value.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n value: any;\n}\n\n/**\n * Serialized {@link ISerializableValue} counterpart.\n */\nexport interface ISerializedValue {\n /**\n * A type annotation to help indicate how the value serializes.\n */\n type: string;\n\n /**\n * String representation of the value.\n *\n * @remarks Will be undefined if the original value was undefined.\n */\n value: string | undefined;\n}\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/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 { ISharedObject, ISharedObjectEvents } from \"@fluidframework/shared-object-base\";\nimport {\n\tIDisposable,\n\tIEvent,\n\tIEventProvider,\n\tIEventThisPlaceHolder,\n} from \"@fluidframework/common-definitions\";\n\n/**\n * Type of \"valueChanged\" event parameter.\n */\nexport interface IValueChanged {\n\t/**\n\t * The key storing the value that changed.\n\t */\n\tkey: string;\n\n\t/**\n\t * The value that was stored at the key prior to the change.\n\t */\n\t// TODO: Use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tpreviousValue: any;\n}\n\n/**\n * Interface describing actions on a directory.\n *\n * @remarks When used as a Map, operates on its keys.\n */\n// TODO: Use `unknown` instead (breaking change).\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface IDirectory\n\textends Map<string, any>,\n\t\tIEventProvider<IDirectoryEvents>,\n\t\tPartial<IDisposable> {\n\t/**\n\t * The absolute path of the directory.\n\t */\n\treadonly absolutePath: string;\n\n\t/**\n\t * Retrieves the value stored at the given key from the directory.\n\t * @param key - Key to retrieve from\n\t * @returns The stored value, or undefined if the key is not set\n\t */\n\t// TODO: Use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tget<T = any>(key: string): T | undefined;\n\n\t/**\n\t * Sets the value stored at key to the provided value.\n\t * @param key - Key to set at\n\t * @param value - Value to set\n\t * @returns The IDirectory itself\n\t */\n\tset<T = unknown>(key: string, value: T): this;\n\n\t/**\n\t * Get the number of sub directory within the directory.\n\t * @returns The number of sub directory within a directory.\n\t */\n\tcountSubDirectory?(): number;\n\n\t/**\n\t * Creates an IDirectory child of this IDirectory, or retrieves the existing IDirectory child if one with the\n\t * same name already exists.\n\t * @param subdirName - Name of the new child directory to create\n\t * @returns The IDirectory child that was created or retrieved\n\t */\n\tcreateSubDirectory(subdirName: string): IDirectory;\n\n\t/**\n\t * Gets an IDirectory child of this IDirectory, if it exists.\n\t * @param subdirName - Name of the child directory to get\n\t * @returns The requested IDirectory\n\t */\n\tgetSubDirectory(subdirName: string): IDirectory | undefined;\n\n\t/**\n\t * Checks whether this directory has a child directory with the given name.\n\t * @param subdirName - Name of the child directory to check\n\t * @returns True if it exists, false otherwise\n\t */\n\thasSubDirectory(subdirName: string): boolean;\n\n\t/**\n\t * Deletes an IDirectory child of this IDirectory, if it exists, along with all descendent keys and directories.\n\t * @param subdirName - Name of the child directory to delete\n\t * @returns True if the IDirectory existed and was deleted, false if it did not exist\n\t */\n\tdeleteSubDirectory(subdirName: string): boolean;\n\n\t/**\n\t * Gets an iterator over the IDirectory children of this IDirectory.\n\t * @returns The IDirectory iterator\n\t */\n\tsubdirectories(): IterableIterator<[string, IDirectory]>;\n\n\t/**\n\t * Get an IDirectory within the directory, in order to use relative paths from that location.\n\t * @param relativePath - Path of the IDirectory to get, relative to this IDirectory\n\t * @returns The requested IDirectory\n\t */\n\tgetWorkingDirectory(relativePath: string): IDirectory | undefined;\n}\n\n/**\n * Events emitted in response to changes to the directory data.\n * These events only emit on the {@link ISharedDirectory} itself, and not on subdirectories.\n */\nexport interface ISharedDirectoryEvents extends ISharedObjectEvents {\n\t/**\n\t * Emitted when a key is set or deleted. This is emitted for any key in the {@link ISharedDirectory} or any\n\t * subdirectory.\n\t *\n\t * @remarks Listener parameters:\n\t *\n\t * - `changed` - Information on the key that changed, its value prior to the change, and the path to the\n\t * key that changed.\n\t *\n\t * - `local` - Whether the change originated from this client.\n\t *\n\t * - `target` - The {@link ISharedDirectory} itself.\n\t */\n\t(\n\t\tevent: \"valueChanged\",\n\t\tlistener: (\n\t\t\tchanged: IDirectoryValueChanged,\n\t\t\tlocal: boolean,\n\t\t\ttarget: IEventThisPlaceHolder,\n\t\t) => void,\n\t);\n\n\t/**\n\t * Emitted when the {@link ISharedDirectory} is cleared.\n\t *\n\t * @remarks Listener parameters:\n\t *\n\t * - `local` - Whether the clear originated from this client.\n\t *\n\t * - `target` - The {@link ISharedDirectory} itself.\n\t */\n\t(event: \"clear\", listener: (local: boolean, target: IEventThisPlaceHolder) => void);\n\n\t/**\n\t * Emitted when a subdirectory is created.\n\t *\n\t * @remarks Listener parameters:\n\t *\n\t * - `path` - The relative path to the subdirectory that is created.\n\t * It is relative from the object which raises the event.\n\t *\n\t * - `local` - Whether the create originated from the this client.\n\t *\n\t * - `target` - The {@link ISharedDirectory} itself.\n\t */\n\t(\n\t\tevent: \"subDirectoryCreated\",\n\t\tlistener: (path: string, local: boolean, target: IEventThisPlaceHolder) => void,\n\t);\n\n\t/**\n\t * Emitted when a subdirectory is deleted.\n\t *\n\t * @remarks Listener parameters:\n\t *\n\t * - `path` - The relative path to the subdirectory that is deleted.\n\t * It is relative from the object which raises the event.\n\t *\n\t * - `local` - Whether the delete originated from the this client.\n\t *\n\t * - `target` - The {@link ISharedDirectory} itself.\n\t */\n\t(\n\t\tevent: \"subDirectoryDeleted\",\n\t\tlistener: (path: string, local: boolean, target: IEventThisPlaceHolder) => void,\n\t);\n}\n\n/**\n * Events emitted in response to changes to the directory data.\n */\nexport interface IDirectoryEvents extends IEvent {\n\t/**\n\t * Emitted when a key is set or deleted. As opposed to the\n\t * {@link SharedDirectory}'s valueChanged event, this is emitted only on the {@link IDirectory} that directly\n\t * contains the key.\n\t *\n\t * @remarks Listener parameters:\n\t *\n\t * - `changed` - Information on the key that changed and its value prior to the change.\n\t *\n\t * - `local` - Whether the change originated from this client.\n\t *\n\t * - `target` - The {@link IDirectory} itself.\n\t */\n\t(\n\t\tevent: \"containedValueChanged\",\n\t\tlistener: (changed: IValueChanged, local: boolean, target: IEventThisPlaceHolder) => void,\n\t);\n\n\t/**\n\t * Emitted when a subdirectory is created. Also emitted when a delete\n\t * of a subdirectory is rolled back.\n\t *\n\t * @remarks Listener parameters:\n\t *\n\t * - `path` - The relative path to the subdirectory that is created.\n\t * It is relative from the object which raises the event.\n\t *\n\t * - `local` - Whether the creation originated from the this client.\n\t *\n\t * - `target` - The {@link ISharedDirectory} itself.\n\t */\n\t(\n\t\tevent: \"subDirectoryCreated\",\n\t\tlistener: (path: string, local: boolean, target: IEventThisPlaceHolder) => void,\n\t);\n\n\t/**\n\t * Emitted when a subdirectory is deleted.\n\t *\n\t * @remarks Listener parameters:\n\t *\n\t * - `path` - The relative path to the subdirectory that is deleted.\n\t * It is relative from the object which raises the event.\n\t *\n\t * - `local` - Whether the delete originated from the this client.\n\t *\n\t * - `target` - The {@link ISharedDirectory} itself.\n\t */\n\t(\n\t\tevent: \"subDirectoryDeleted\",\n\t\tlistener: (path: string, local: boolean, target: IEventThisPlaceHolder) => void,\n\t);\n\n\t/**\n\t * Emitted when this sub directory is deleted.\n\t *\n\t * @remarks Listener parameters:\n\t *\n\t * - `target` - The {@link IDirectory} itself.\n\t */\n\t(event: \"disposed\", listener: (target: IEventThisPlaceHolder) => void);\n\n\t/**\n\t * Emitted when this previously deleted sub directory is restored.\n\t * This event only needs to be handled in the case of rollback. If your application does\n\t * not use the local rollback feature, you can ignore this event.\n\t *\n\t * @remarks Listener parameters:\n\t *\n\t * - `target` - The {@link IDirectory} itself.\n\t */\n\t(event: \"undisposed\", listener: (target: IEventThisPlaceHolder) => void);\n}\n\n/**\n * Provides a hierarchical organization of map-like data structures as SubDirectories.\n * The values stored within can be accessed like a map, and the hierarchy can be navigated using path syntax.\n * SubDirectories can be retrieved for use as working directories.\n */\nexport interface ISharedDirectory\n\textends ISharedObject<ISharedDirectoryEvents & IDirectoryEvents>,\n\t\tOmit<IDirectory, \"on\" | \"once\" | \"off\"> {\n\t// The Omit type excludes symbols, which we don't want to exclude. Adding them back here manually.\n\t// https://github.com/microsoft/TypeScript/issues/31671\n\t// TODO: Use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t[Symbol.iterator](): IterableIterator<[string, any]>;\n\treadonly [Symbol.toStringTag]: string;\n}\n\n/**\n * Type of \"valueChanged\" event parameter for {@link ISharedDirectory}\n */\nexport interface IDirectoryValueChanged extends IValueChanged {\n\t/**\n\t * The absolute path to the IDirectory storing the key which changed.\n\t */\n\tpath: string;\n}\n\n/**\n * Events emitted in response to changes to the {@link ISharedMap | map} data.\n */\nexport interface ISharedMapEvents extends ISharedObjectEvents {\n\t/**\n\t * Emitted when a key is set or deleted.\n\t *\n\t * @remarks Listener parameters:\n\t *\n\t * - `changed` - Information on the key that changed and its value prior to the change.\n\t *\n\t * - `local` - Whether the change originated from this client.\n\t *\n\t * - `target` - The {@link ISharedMap} itself.\n\t */\n\t(\n\t\tevent: \"valueChanged\",\n\t\tlistener: (changed: IValueChanged, local: boolean, target: IEventThisPlaceHolder) => void,\n\t);\n\n\t/**\n\t * Emitted when the map is cleared.\n\t *\n\t * @remarks Listener parameters:\n\t *\n\t * - `local` - Whether the clear originated from this client.\n\t *\n\t * - `target` - The {@link ISharedMap} itself.\n\t */\n\t(event: \"clear\", listener: (local: boolean, target: IEventThisPlaceHolder) => void);\n}\n\n/**\n * The SharedMap distributed data structure can be used to store key-value pairs. It provides the same API for setting\n * and retrieving values that JavaScript developers are accustomed to with the\n * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map | Map} built-in object.\n * However, the keys of a SharedMap must be strings, and the values must either be a JSON-serializable object or a\n * {@link @fluidframework/datastore#FluidObjectHandle}.\n *\n * For more information, including example usages, see {@link https://fluidframework.com/docs/data-structures/map/}.\n */\n// TODO: Use `unknown` instead (breaking change).\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface ISharedMap extends ISharedObject<ISharedMapEvents>, Map<string, any> {\n\t/**\n\t * Retrieves the given key from the map if it exists.\n\t * @param key - Key to retrieve from\n\t * @returns The stored value, or undefined if the key is not set\n\t */\n\t// TODO: Use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tget<T = any>(key: string): T | undefined;\n\n\t/**\n\t * Sets the value stored at key to the provided value.\n\t * @param key - Key to set\n\t * @param value - Value to set\n\t * @returns The {@link ISharedMap} itself\n\t */\n\tset<T = unknown>(key: string, value: T): this;\n}\n\n/**\n * The _ready-for-serialization_ format of values contained in DDS contents. This allows us to use\n * {@link ISerializableValue.\"type\"} to understand whether they're storing a Plain JavaScript object,\n * a {@link @fluidframework/shared-object-base#SharedObject}, or a value type.\n *\n * @remarks\n *\n * Note that the in-memory equivalent of ISerializableValue is ILocalValue (similarly holding a type, but with\n * the _in-memory representation_ of the value instead). An ISerializableValue is what gets passed to\n * JSON.stringify and comes out of JSON.parse. This format is used both for snapshots (loadCore/populate)\n * and ops (set).\n *\n * If type is Plain, it must be a plain JS object that can survive a JSON.stringify/parse. E.g. a URL object will\n * just get stringified to a URL string and not rehydrate as a URL object on the other side. It may contain members\n * that are ISerializedHandle (the serialized form of a handle).\n *\n * If type is a value type then it must be amongst the types registered via registerValueType or we won't know how\n * to serialize/deserialize it (we rely on its factory via .load() and .store()). Its value will be type-dependent.\n * If type is Shared, then the in-memory value will just be a reference to the SharedObject. Its value will be a\n * channel ID.\n *\n * @deprecated This type is legacy and deprecated.\n */\nexport interface ISerializableValue {\n\t/**\n\t * A type annotation to help indicate how the value serializes.\n\t */\n\ttype: string;\n\n\t/**\n\t * The JSONable representation of the value.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tvalue: any;\n}\n\n/**\n * Serialized {@link ISerializableValue} counterpart.\n */\nexport interface ISerializedValue {\n\t/**\n\t * A type annotation to help indicate how the value serializes.\n\t */\n\ttype: string;\n\n\t/**\n\t * String representation of the value.\n\t *\n\t * @remarks Will be undefined if the original value was undefined.\n\t */\n\tvalue: string | undefined;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"internalInterfaces.d.ts","sourceRoot":"","sources":["../src/internalInterfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C;;GAEG;AACF,MAAM,WAAW,gBAAgB;IAC9B;;OAEG;IACH,IAAI,EAAE,KAAK,CAAC;IAEZ;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;OAEG;IACH,KAAK,EAAE,kBAAkB,CAAC;CAC7B;AAED;;GAEG;AACF,MAAM,WAAW,kBAAkB;IAChC;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC;CACjB;AAED;;GAEG;AACF,MAAM,WAAW,mBAAmB;IACjC;;OAEG;IACH,IAAI,EAAE,QAAQ,CAAC;IAEf;;OAEG;IACH,GAAG,EAAE,MAAM,C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MAAM,CAAC;CACZ;AAED;;GAEG;AACH,MAAM,WAAW,0BAA0B;IAC1C;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACH,aAAa,EAAE,WAAW,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACzC;;OAEG;IACH,IAAI,EAAE,KAAK,CAAC;IAEZ;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACxC;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC;IAEd;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACH,WAAW,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;CACvC;AAED;;GAEG;AACH,oBAAY,qBAAqB,GAAG,0BAA0B,GAAG,yBAAyB,CAAC;AAE3F;;GAEG;AACH,oBAAY,kBAAkB,GAAG,wBAAwB,GAAG,qBAAqB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"internalInterfaces.js","sourceRoot":"","sources":["../src/internalInterfaces.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 { ISerializableValue } from \"./interfaces\";\nimport { ILocalValue } from \"./localValues\";\n\n/**\n * Operation indicating a value should be set for a key.\n */\n export interface IMapSetOperation {\n /**\n * String identifier of the operation type.\n */\n type: \"set\";\n\n /**\n * Map key being modified.\n */\n key: string;\n\n /**\n * Value to be set on the key.\n */\n value: ISerializableValue;\n}\n\n/**\n * Operation indicating the map should be cleared.\n */\n export interface IMapClearOperation {\n /**\n * String identifier of the operation type.\n */\n type: \"clear\";\n}\n\n/**\n * Operation indicating a key should be deleted from the map.\n */\n export interface IMapDeleteOperation {\n /**\n * String identifier of the operation type.\n */\n type: \"delete\";\n\n /**\n * Map key being modified.\n */\n key: string;\n}\n\n/**\n * Metadata for an local `edit` operation.\n */\nexport interface IMapKeyEditLocalOpMetadata {\n /**\n * String identifier of the operation type.\n */\n type: \"edit\";\n\n /**\n * Unique identifier for the local operation.\n */\n pendingMessageId: number;\n\n /**\n * Local value prior to the edit.\n */\n previousValue: ILocalValue;\n}\n\n/**\n * Metadata for an local `add` operation.\n */\nexport interface IMapKeyAddLocalOpMetadata {\n /**\n * String identifier of the operation type.\n */\n type: \"add\";\n\n /**\n * Unique identifier for the local operation.\n */\n pendingMessageId: number;\n}\n\n/**\n * Metadata for an local `clear` operation.\n */\nexport interface IMapClearLocalOpMetadata {\n /**\n * String identifier of the operation type.\n */\n type: \"clear\";\n\n /**\n * Unique identifier for the local operation.\n */\n pendingMessageId: number;\n\n /**\n * Local map contents prior to clearing it.\n */\n previousMap?: Map<string, ILocalValue>;\n}\n\n/**\n * Metadata for a local operation associated with a specific key entry in the map.\n */\nexport type MapKeyLocalOpMetadata = IMapKeyEditLocalOpMetadata | IMapKeyAddLocalOpMetadata;\n\n/**\n * Metadata for a local operation.\n */\nexport type MapLocalOpMetadata = IMapClearLocalOpMetadata | MapKeyLocalOpMetadata;\n"]}
1
+ {"version":3,"file":"internalInterfaces.js","sourceRoot":"","sources":["../src/internalInterfaces.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 { ISerializableValue } from \"./interfaces\";\nimport { ILocalValue } from \"./localValues\";\n\n/**\n * Operation indicating a value should be set for a key.\n */\nexport interface IMapSetOperation {\n\t/**\n\t * String identifier of the operation type.\n\t */\n\ttype: \"set\";\n\n\t/**\n\t * Map key being modified.\n\t */\n\tkey: string;\n\n\t/**\n\t * Value to be set on the key.\n\t */\n\tvalue: ISerializableValue;\n}\n\n/**\n * Operation indicating the map should be cleared.\n */\nexport interface IMapClearOperation {\n\t/**\n\t * String identifier of the operation type.\n\t */\n\ttype: \"clear\";\n}\n\n/**\n * Operation indicating a key should be deleted from the map.\n */\nexport interface IMapDeleteOperation {\n\t/**\n\t * String identifier of the operation type.\n\t */\n\ttype: \"delete\";\n\n\t/**\n\t * Map key being modified.\n\t */\n\tkey: string;\n}\n\n/**\n * Metadata for an local `edit` operation.\n */\nexport interface IMapKeyEditLocalOpMetadata {\n\t/**\n\t * String identifier of the operation type.\n\t */\n\ttype: \"edit\";\n\n\t/**\n\t * Unique identifier for the local operation.\n\t */\n\tpendingMessageId: number;\n\n\t/**\n\t * Local value prior to the edit.\n\t */\n\tpreviousValue: ILocalValue;\n}\n\n/**\n * Metadata for an local `add` operation.\n */\nexport interface IMapKeyAddLocalOpMetadata {\n\t/**\n\t * String identifier of the operation type.\n\t */\n\ttype: \"add\";\n\n\t/**\n\t * Unique identifier for the local operation.\n\t */\n\tpendingMessageId: number;\n}\n\n/**\n * Metadata for an local `clear` operation.\n */\nexport interface IMapClearLocalOpMetadata {\n\t/**\n\t * String identifier of the operation type.\n\t */\n\ttype: \"clear\";\n\n\t/**\n\t * Unique identifier for the local operation.\n\t */\n\tpendingMessageId: number;\n\n\t/**\n\t * Local map contents prior to clearing it.\n\t */\n\tpreviousMap?: Map<string, ILocalValue>;\n}\n\n/**\n * Metadata for a local operation associated with a specific key entry in the map.\n */\nexport type MapKeyLocalOpMetadata = IMapKeyEditLocalOpMetadata | IMapKeyAddLocalOpMetadata;\n\n/**\n * Metadata for a local operation.\n */\nexport type MapLocalOpMetadata = IMapClearLocalOpMetadata | MapKeyLocalOpMetadata;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"localValues.d.ts","sourceRoot":"","sources":["../src/localValues.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EACH,gBAAgB,EAKnB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACH,kBAAkB,EAClB,gBAAg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AAC,KAAc;QAC9B,OAAO,IAAI,eAAe,CAAC,KAAK,CAAC,CAAC;IACtC,CAAC;CACJ;AAnCD,0CAmCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport {\n IFluidSerializer,\n ISerializedHandle,\n parseHandles,\n serializeHandles,\n ValueType,\n} from \"@fluidframework/shared-object-base\";\nimport {\n ISerializableValue,\n ISerializedValue,\n} from \"./interfaces\";\n\n/**\n * A local value to be stored in a container type Distributed Data Store (DDS).\n */\nexport interface ILocalValue {\n /**\n * Type indicator of the value stored within.\n */\n readonly type: string;\n\n /**\n * The in-memory value stored within.\n */\n // TODO: Use `unknown` instead (breaking change).\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n readonly value: any;\n\n /**\n * Retrieve the serialized form of the value stored within.\n * @param serializer - Data store runtime's serializer\n * @param bind - Container type's handle\n * @returns The serialized form of the contained value\n */\n makeSerialized(\n serializer: IFluidSerializer,\n bind: IFluidHandle,\n ): ISerializedValue;\n}\n\n/**\n * Converts the provided `localValue` to its serialized form.\n *\n * @param localValue - The value to serialize.\n * @param serializer - Data store runtime's serializer.\n * @param bind - Container type's handle.\n *\n * @see {@link ILocalValue.makeSerialized}\n */\nexport function makeSerializable(\n localValue: ILocalValue,\n serializer: IFluidSerializer,\n bind: IFluidHandle,\n): ISerializableValue {\n const value = localValue.makeSerialized(serializer, bind);\n return {\n type: value.type,\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n value: value.value && JSON.parse(value.value),\n };\n}\n\n/**\n * Manages a contained plain value. May also contain shared object handles.\n */\nexport class PlainLocalValue implements ILocalValue {\n /**\n * Create a new PlainLocalValue.\n * @param value - The value to store, which may contain shared object handles\n */\n public constructor(public readonly value: unknown) { }\n\n /**\n * {@inheritDoc ILocalValue.\"type\"}\n */\n public get type(): string {\n return ValueType[ValueType.Plain];\n }\n\n /**\n * {@inheritDoc ILocalValue.makeSerialized}\n */\n public makeSerialized(\n serializer: IFluidSerializer,\n bind: IFluidHandle,\n ): ISerializedValue {\n // Stringify to convert to the serialized handle values - and then parse in order to create\n // a POJO for the op\n const value = serializeHandles(this.value, serializer, bind);\n\n return {\n type: this.type,\n value,\n };\n }\n}\n\n/**\n * Enables a container type {@link https://fluidframework.com/docs/build/dds/ | DDS} to produce and store local\n * values with minimal awareness of how those objects are stored, serialized, and deserialized.\n */\nexport class LocalValueMaker {\n /**\n * Create a new LocalValueMaker.\n * @param serializer - The serializer to serialize / parse handles.\n */\n public constructor(private readonly serializer: IFluidSerializer) { }\n\n /**\n * Create a new local value from an incoming serialized value.\n * @param serializable - The serializable value to make local\n */\n public fromSerializable(serializable: ISerializableValue): ILocalValue {\n // Migrate from old shared value to handles\n if (serializable.type === ValueType[ValueType.Shared]) {\n serializable.type = ValueType[ValueType.Plain];\n const handle: ISerializedHandle = {\n type: \"__fluid_handle__\",\n url: serializable.value as string,\n };\n serializable.value = handle;\n }\n\n const translatedValue: unknown = parseHandles(serializable.value, this.serializer);\n\n return new PlainLocalValue(translatedValue);\n }\n\n /**\n * Create a new local value containing a given plain object.\n * @param value - The value to store\n * @returns An ILocalValue containing the value\n */\n public fromInMemory(value: unknown): ILocalValue {\n return new PlainLocalValue(value);\n }\n}\n"]}
1
+ {"version":3,"file":"localValues.js","sourceRoot":"","sources":["../src/localValues.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,2EAM4C;AA4B5C;;;;;;;;GAQG;AACH,SAAgB,gBAAgB,CAC/B,UAAuB,EACvB,UAA4B,EAC5B,IAAkB;IAElB,MAAM,KAAK,GAAG,UAAU,CAAC,cAAc,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IAC1D,OAAO;QACN,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,mEAAmE;QACnE,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,K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AK,CAAC,CAAC;IACnC,CAAC;CACD;AAnCD,0CAmCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport {\n\tIFluidSerializer,\n\tISerializedHandle,\n\tparseHandles,\n\tserializeHandles,\n\tValueType,\n} from \"@fluidframework/shared-object-base\";\nimport { ISerializableValue, ISerializedValue } from \"./interfaces\";\n\n/**\n * A local value to be stored in a container type Distributed Data Store (DDS).\n */\nexport interface ILocalValue {\n\t/**\n\t * Type indicator of the value stored within.\n\t */\n\treadonly type: string;\n\n\t/**\n\t * The in-memory value stored within.\n\t */\n\t// TODO: Use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\treadonly value: any;\n\n\t/**\n\t * Retrieve the serialized form of the value stored within.\n\t * @param serializer - Data store runtime's serializer\n\t * @param bind - Container type's handle\n\t * @returns The serialized form of the contained value\n\t */\n\tmakeSerialized(serializer: IFluidSerializer, bind: IFluidHandle): ISerializedValue;\n}\n\n/**\n * Converts the provided `localValue` to its serialized form.\n *\n * @param localValue - The value to serialize.\n * @param serializer - Data store runtime's serializer.\n * @param bind - Container type's handle.\n *\n * @see {@link ILocalValue.makeSerialized}\n */\nexport function makeSerializable(\n\tlocalValue: ILocalValue,\n\tserializer: IFluidSerializer,\n\tbind: IFluidHandle,\n): ISerializableValue {\n\tconst value = localValue.makeSerialized(serializer, bind);\n\treturn {\n\t\ttype: value.type,\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\tvalue: value.value && JSON.parse(value.value),\n\t};\n}\n\n/**\n * Manages a contained plain value. May also contain shared object handles.\n */\nexport class PlainLocalValue implements ILocalValue {\n\t/**\n\t * Create a new PlainLocalValue.\n\t * @param value - The value to store, which may contain shared object handles\n\t */\n\tpublic constructor(public readonly value: unknown) {}\n\n\t/**\n\t * {@inheritDoc ILocalValue.\"type\"}\n\t */\n\tpublic get type(): string {\n\t\treturn ValueType[ValueType.Plain];\n\t}\n\n\t/**\n\t * {@inheritDoc ILocalValue.makeSerialized}\n\t */\n\tpublic makeSerialized(serializer: IFluidSerializer, bind: IFluidHandle): ISerializedValue {\n\t\t// Stringify to convert to the serialized handle values - and then parse in order to create\n\t\t// a POJO for the op\n\t\tconst value = serializeHandles(this.value, serializer, bind);\n\n\t\treturn {\n\t\t\ttype: this.type,\n\t\t\tvalue,\n\t\t};\n\t}\n}\n\n/**\n * Enables a container type {@link https://fluidframework.com/docs/build/dds/ | DDS} to produce and store local\n * values with minimal awareness of how those objects are stored, serialized, and deserialized.\n */\nexport class LocalValueMaker {\n\t/**\n\t * Create a new LocalValueMaker.\n\t * @param serializer - The serializer to serialize / parse handles.\n\t */\n\tpublic constructor(private readonly serializer: IFluidSerializer) {}\n\n\t/**\n\t * Create a new local value from an incoming serialized value.\n\t * @param serializable - The serializable value to make local\n\t */\n\tpublic fromSerializable(serializable: ISerializableValue): ILocalValue {\n\t\t// Migrate from old shared value to handles\n\t\tif (serializable.type === ValueType[ValueType.Shared]) {\n\t\t\tserializable.type = ValueType[ValueType.Plain];\n\t\t\tconst handle: ISerializedHandle = {\n\t\t\t\ttype: \"__fluid_handle__\",\n\t\t\t\turl: serializable.value as string,\n\t\t\t};\n\t\t\tserializable.value = handle;\n\t\t}\n\n\t\tconst translatedValue: unknown = parseHandles(serializable.value, this.serializer);\n\n\t\treturn new PlainLocalValue(translatedValue);\n\t}\n\n\t/**\n\t * Create a new local value containing a given plain object.\n\t * @param value - The value to store\n\t * @returns An ILocalValue containing the value\n\t */\n\tpublic fromInMemory(value: unknown): ILocalValue {\n\t\treturn new PlainLocalValue(value);\n\t}\n}\n"]}
package/dist/map.d.ts CHANGED
@@ -163,7 +163,7 @@ export declare class SharedMap extends SharedObject<ISharedMapEvents> implements
163
163
  /**
164
164
  * {@inheritDoc @fluidframework/shared-object-base#SharedObject.rollback}
165
165
  * @internal
166
- */
166
+ */
167
167
  protected rollback(content: unknown, localOpMetadata: unknown): void;
168
168
  }
169
169
  //# sourceMappingURL=map.d.ts.map
package/dist/map.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"map.d.ts","sourceRoot":"","sources":["../src/map.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,yBAAyB,EAAe,MAAM,sCAAsC,CAAC;AAC9F,OAAO,EACH,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACtB,gBAAgB,EAChB,eAAe,EAClB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAE/F,OAAO,EACH,gBAAgB,EAChB,YAAY,EACf,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EACH,UAAU,EACV,gBAAgB,EACnB,MAAM,cAAc,CAAC;AAWtB;;;;GAIG;AACH,qBAAa,UAAW,YAAW,eAAe;IAC9C;;OAEG;IACH,gBAAuB,IAAI,2CAA2C;IAEtE;;OAEG;IACH,gBAAuB,UAAU,EAAE,kBAAkB,CAInD;IAEF;;OAEG;IACH,IAAW,IAAI,IAAI,MAAM,CAExB;IAED;;OAEG;IACH,IAAW,UAAU,IAAI,kBAAkB,CAE1C;IAED;;OAEG;IACU,IAAI,CACb,OAAO,EAAE,sBAAsB,EAC/B,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,gBAAgB,EAC1B,UAAU,EAAE,kBAAkB,GAAG,OAAO,CAAC,UAAU,CAAC;IAOxD;;OAEG;IACI,MAAM,CAAC,OAAO,EAAE,sBAAsB,EAAE,EAAE,EAAE,MAAM,GAAG,UAAU;CAMzE;AAED;;GAEG;AACH,qBAAa,SAAU,SAAQ,YAAY,CAAC,gBAAgB,CAAE,YAAW,UAAU;IAC/E;;;;;;;;;;;;OAYG;WACW,MAAM,CAAC,OAAO,EAAE,sBAAsB,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,SAAS;IAI7E;;;O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,IAAI;IAK1F;;OAEG;IAGI,GAAG,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IAI/C;;;;OAIG;IACI,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAIhC;;OAEG;IACI,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI;IAK7C;;;;OAIG;IACI,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAInC;;OAEG;IACI,KAAK,IAAI,IAAI;IAIpB;;;OAGG;IACH,SAAS,CAAC,aAAa,CACtB,UAAU,EAAE,gBAAgB,EAC5B,gBAAgB,CAAC,EAAE,iBAAiB,GAClC,qBAAqB;IAyExB;;;OAGG;cACa,QAAQ,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;IAgBxE;;;OAGG;IACH,SAAS,CAAC,YAAY,IAAI,IAAI;IAE9B;;;OAGG;IACH,SAAS,CAAC,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO,GAAG,IAAI;IAIxE;;;OAGG;IACH,SAAS,CAAC,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO;IAInD;;;OAGG;IACH,SAAS,CAAC,WAAW,CACpB,OAAO,EAAE,yBAAyB,EAClC,KAAK,EAAE,OAAO,EACd,eAAe,EAAE,OAAO,GACtB,IAAI;IAUP;;;OAGG;IACH,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO,GAAG,IAAI;CAGpE"}
package/dist/map.js CHANGED
@@ -245,7 +245,9 @@ class SharedMap extends shared_object_base_1.SharedObject {
245
245
  }
246
246
  headerBlob[key] = {
247
247
  type: value.type,
248
- value: value.value === undefined ? undefined : JSON.parse(value.value),
248
+ value: value.value === undefined
249
+ ? undefined
250
+ : JSON.parse(value.value),
249
251
  };
250
252
  }
251
253
  }
@@ -305,7 +307,7 @@ class SharedMap extends shared_object_base_1.SharedObject {
305
307
  /**
306
308
  * {@inheritDoc @fluidframework/shared-object-base#SharedObject.rollback}
307
309
  * @internal
308
- */
310
+ */
309
311
  rollback(content, localOpMetadata) {
310
312
  this.kernel.rollback(content, localOpMetadata);
311
313
  }
package/dist/map.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"map.js","sourceRoot":"","sources":["../src/map.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAEH,+EAA8F;AAS9F,+DAA4D;AAC5D,2EAG4C;AAC5C,iEAAmE;AAKnE,2CAAmF;AACnF,qDAA8C;AAO9C,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAElC;;;;GAIG;AACH,MAAa,UAAU;IAenB;;OAEG;IACH,IAAW,IAAI;QACX,OAAO,UAAU,CAAC,IAAI,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,IAAW,UAAU;QACjB,OAAO,UAAU,CAAC,UAAU,CAAC;IACjC,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,IAAI,CACb,OAA+B,EAC/B,EAAU,EACV,QAA0B,EAC1B,UAA8B;QAC9B,MAAM,GAAG,GAAG,IAAI,SAAS,CAAC,EAAE,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;QACnD,MAAM,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAEzB,OAAO,GAAG,CAAC;IACf,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,OAA+B,EAAE,EAAU;QACrD,MAAM,GAAG,GAAG,IAAI,SAAS,CAAC,EAAE,EAAE,OAAO,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC;QAC9D,GAAG,CAAC,eAAe,EAAE,CAAC;QAEtB,OAAO,GAAG,CAAC;IACf,CAAC;;AAnDL,gCAoDC;AAnDG;;GAEG;AACoB,eAAI,GAAG,uCAAuC,CAAC;AAEtE;;GAEG;AACoB,qBAAU,GAAuB;IACpD,IAAI,EAAE,UAAU,CAAC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AwB,CAAC,OAAO,CAAC,CAAC;YAClD,CAAC,CAAC,CAAC,CAAC;SACP;aAAM;YACH,IAAI,CAAC,MAAM,CAAC,wBAAwB,CAAC,IAAkC,CAAC,CAAC;SAC5E;IACL,CAAC;IAED;;;OAGG;IACO,YAAY,KAAW,CAAC;IAElC;;;OAGG;IACO,YAAY,CAAC,OAAgB,EAAE,eAAwB;QAC7D,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,OAAwB,EAAE,eAAe,CAAC,CAAC;IAC5E,CAAC;IAED;;;OAGG;IACO,cAAc,CAAC,OAAgB;QACrC,OAAO,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,OAAwB,CAAC,CAAC;IACnE,CAAC;IAED;;;OAGG;IACO,WAAW,CAAC,OAAkC,EAAE,KAAc,EAAE,eAAwB;QAC9F,IAAI,OAAO,CAAC,IAAI,KAAK,kCAAW,CAAC,SAAS,EAAE;YACxC,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,OAAO,CAAC,QAAyB,EAAE,KAAK,EAAE,eAAe,CAAC,CAAC;SAC5F;IACL,CAAC;IAED;;;MAGE;IACQ,QAAQ,CAAC,OAAgB,EAAE,eAAwB;QACzD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IACnD,CAAC;CACJ;AAlSD,8BAkSC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ISequencedDocumentMessage, MessageType } from \"@fluidframework/protocol-definitions\";\nimport {\n IChannelAttributes,\n IFluidDataStoreRuntime,\n IChannelStorageService,\n IChannelServices,\n IChannelFactory,\n} from \"@fluidframework/datastore-definitions\";\nimport { ISummaryTreeWithStats, ITelemetryContext } from \"@fluidframework/runtime-definitions\";\nimport { readAndParse } from \"@fluidframework/driver-utils\";\nimport {\n IFluidSerializer,\n SharedObject,\n} from \"@fluidframework/shared-object-base\";\nimport { SummaryTreeBuilder } from \"@fluidframework/runtime-utils\";\nimport {\n ISharedMap,\n ISharedMapEvents,\n} from \"./interfaces\";\nimport { IMapDataObjectSerializable, IMapOperation, MapKernel } from \"./mapKernel\";\nimport { pkgVersion } from \"./packageVersion\";\n\ninterface IMapSerializationFormat {\n blobs?: string[];\n content: IMapDataObjectSerializable;\n}\n\nconst snapshotFileName = \"header\";\n\n/**\n * {@link @fluidframework/datastore-definitions#IChannelFactory} for {@link SharedMap}.\n *\n * @sealed\n */\nexport class MapFactory implements IChannelFactory {\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.\"type\"}\n */\n public static readonly Type = \"https://graph.microsoft.com/types/map\";\n\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.attributes}\n */\n public static readonly Attributes: IChannelAttributes = {\n type: MapFactory.Type,\n snapshotFormatVersion: \"0.2\",\n packageVersion: pkgVersion,\n };\n\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.\"type\"}\n */\n public get type(): string {\n return MapFactory.Type;\n }\n\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.attributes}\n */\n public get attributes(): IChannelAttributes {\n return MapFactory.Attributes;\n }\n\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}\n */\n public async load(\n runtime: IFluidDataStoreRuntime,\n id: string,\n services: IChannelServices,\n attributes: IChannelAttributes): Promise<ISharedMap> {\n const map = new SharedMap(id, runtime, attributes);\n await map.load(services);\n\n return map;\n }\n\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.create}\n */\n public create(runtime: IFluidDataStoreRuntime, id: string): ISharedMap {\n const map = new SharedMap(id, runtime, MapFactory.Attributes);\n map.initializeLocal();\n\n return map;\n }\n}\n\n/**\n * {@inheritDoc ISharedMap}\n */\nexport class SharedMap extends SharedObject<ISharedMapEvents> implements ISharedMap {\n /**\n * Create a new shared map.\n * @param runtime - The data store runtime that the new shared map belongs to.\n * @param id - Optional name of the shared map.\n * @returns Newly created shared map.\n *\n * @example\n * To create a `SharedMap`, call the static create method:\n *\n * ```typescript\n * const myMap = SharedMap.create(this.runtime, id);\n * ```\n */\n public static create(runtime: IFluidDataStoreRuntime, id?: string): SharedMap {\n return runtime.createChannel(id, MapFactory.Type) as SharedMap;\n }\n\n /**\n * Get a factory for SharedMap to register with the data store.\n * @returns A factory that creates SharedMaps and loads them from storage.\n */\n public static getFactory(): IChannelFactory {\n return new MapFactory();\n }\n\n /**\n * String representation for the class.\n */\n public readonly [Symbol.toStringTag]: string = \"SharedMap\";\n\n /**\n * MapKernel which manages actual map operations.\n */\n private readonly kernel: MapKernel;\n\n /**\n * Do not call the constructor. Instead, you should use the {@link SharedMap.create | create method}.\n *\n * @param id - String identifier.\n * @param runtime - Data store runtime.\n * @param attributes - The attributes for the map.\n */\n public constructor(\n id: string,\n runtime: IFluidDataStoreRuntime,\n attributes: IChannelAttributes,\n ) {\n super(id, runtime, attributes, \"fluid_map_\");\n this.kernel = new MapKernel(\n this.serializer,\n this.handle,\n (op, localOpMetadata) => this.submitLocalMessage(op, localOpMetadata),\n () => this.isAttached(),\n this,\n );\n }\n\n /**\n * Get an iterator over the keys in this map.\n * @returns The iterator\n */\n public keys(): IterableIterator<string> {\n return this.kernel.keys();\n }\n\n /**\n * Get an iterator over the entries in this map.\n * @returns The iterator\n */\n // TODO: Use `unknown` instead (breaking change).\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public entries(): IterableIterator<[string, any]> {\n return this.kernel.entries();\n }\n\n /**\n * Get an iterator over the values in this map.\n * @returns The iterator\n */\n // TODO: Use `unknown` instead (breaking change).\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public values(): IterableIterator<any> {\n return this.kernel.values();\n }\n\n /**\n * Get an iterator over the entries in this map.\n * @returns The iterator\n */\n // TODO: Use `unknown` instead (breaking change).\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public [Symbol.iterator](): IterableIterator<[string, any]> {\n return this.kernel.entries();\n }\n\n /**\n * The number of key/value pairs stored in the map.\n */\n public get size(): number {\n return this.kernel.size;\n }\n\n /**\n * Executes the given callback on each entry in the map.\n * @param callbackFn - Callback function\n */\n // TODO: Use `unknown` instead (breaking change).\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public forEach(callbackFn: (value: any, key: string, map: Map<string, any>) => void): void {\n // eslint-disable-next-line unicorn/no-array-for-each, unicorn/no-array-callback-reference\n this.kernel.forEach(callbackFn);\n }\n\n /**\n * {@inheritDoc ISharedMap.get}\n */\n // TODO: Use `unknown` instead (breaking change).\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public get<T = any>(key: string): T | undefined {\n return this.kernel.get<T>(key);\n }\n\n /**\n * Check if a key exists in the map.\n * @param key - The key to check\n * @returns True if the key exists, false otherwise\n */\n public has(key: string): boolean {\n return this.kernel.has(key);\n }\n\n /**\n * {@inheritDoc ISharedMap.set}\n */\n public set(key: string, value: unknown): this {\n this.kernel.set(key, value);\n return this;\n }\n\n /**\n * Delete a key from the map.\n * @param key - Key to delete\n * @returns True if the key existed and was deleted, false if it did not exist\n */\n public delete(key: string): boolean {\n return this.kernel.delete(key);\n }\n\n /**\n * Clear all data from the map.\n */\n public clear(): void {\n this.kernel.clear();\n }\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObject.summarizeCore}\n * @internal\n */\n protected summarizeCore(\n serializer: IFluidSerializer,\n telemetryContext?: ITelemetryContext,\n ): ISummaryTreeWithStats {\n let currentSize = 0;\n let counter = 0;\n let headerBlob: IMapDataObjectSerializable = {};\n const blobs: string[] = [];\n\n const builder = new SummaryTreeBuilder();\n\n const data = this.kernel.getSerializedStorage(serializer);\n\n // If single property exceeds this size, it goes into its own blob\n const MinValueSizeSeparateSnapshotBlob = 8 * 1024;\n\n // Maximum blob size for multiple map properties\n // Should be bigger than MinValueSizeSeparateSnapshotBlob\n const MaxSnapshotBlobSize = 16 * 1024;\n\n // Partitioning algorithm:\n // 1) Split large (over MinValueSizeSeparateSnapshotBlob = 8K) properties into their own blobs.\n // Naming (across snapshots) of such blob does not have to be stable across snapshots,\n // As de-duping process (in driver) should not care about paths, only content.\n // 2) Split remaining properties into blobs of MaxSnapshotBlobSize (16K) size.\n // This process does not produce stable partitioning. This means\n // modification (including addition / deletion) of property can shift properties across blobs\n // and result in non-incremental snapshot.\n // This can be improved in the future, without being format breaking change, as loading sequence\n // loads all blobs at once and partitioning schema has no impact on that process.\n for (const key of Object.keys(data)) {\n const value = data[key];\n if (value.value && value.value.length >= MinValueSizeSeparateSnapshotBlob) {\n const blobName = `blob${counter}`;\n counter++;\n blobs.push(blobName);\n const content: IMapDataObjectSerializable = {\n [key]: {\n type: value.type,\n value: JSON.parse(value.value) as unknown,\n },\n };\n builder.addBlob(blobName, JSON.stringify(content));\n } else {\n currentSize += value.type.length + 21; // Approximation cost of property header\n if (value.value) {\n currentSize += value.value.length;\n }\n\n if (currentSize > MaxSnapshotBlobSize) {\n const blobName = `blob${counter}`;\n counter++;\n blobs.push(blobName);\n builder.addBlob(blobName, JSON.stringify(headerBlob));\n headerBlob = {};\n currentSize = 0;\n }\n headerBlob[key] = {\n type: value.type,\n value: value.value === undefined ? undefined : JSON.parse(value.value) as unknown,\n };\n }\n }\n\n const header: IMapSerializationFormat = {\n blobs,\n content: headerBlob,\n };\n builder.addBlob(snapshotFileName, JSON.stringify(header));\n\n return builder.getSummaryTree();\n }\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}\n * @internal\n */\n protected async loadCore(storage: IChannelStorageService): Promise<void> {\n const json = await readAndParse<object>(storage, snapshotFileName);\n const newFormat = json as IMapSerializationFormat;\n if (Array.isArray(newFormat.blobs)) {\n this.kernel.populateFromSerializable(newFormat.content);\n await Promise.all(newFormat.blobs.map(async (value) => {\n const content = await readAndParse<IMapDataObjectSerializable>(storage, value);\n this.kernel.populateFromSerializable(content);\n }));\n } else {\n this.kernel.populateFromSerializable(json as IMapDataObjectSerializable);\n }\n }\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObject.onDisconnect}\n * @internal\n */\n protected onDisconnect(): void { }\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObject.reSubmitCore}\n * @internal\n */\n protected reSubmitCore(content: unknown, localOpMetadata: unknown): void {\n this.kernel.trySubmitMessage(content as IMapOperation, localOpMetadata);\n }\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObjectCore.applyStashedOp}\n * @internal\n */\n protected applyStashedOp(content: unknown): unknown {\n return this.kernel.tryApplyStashedOp(content as IMapOperation);\n }\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObject.processCore}\n * @internal\n */\n protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void {\n if (message.type === MessageType.Operation) {\n this.kernel.tryProcessMessage(message.contents as IMapOperation, local, localOpMetadata);\n }\n }\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObject.rollback}\n * @internal\n */\n protected rollback(content: unknown, localOpMetadata: unknown): void {\n this.kernel.rollback(content, localOpMetadata);\n }\n}\n"]}
1
+ {"version":3,"file":"map.js","sourceRoot":"","sources":["../src/map.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAEH,+EAA8F;AAS9F,+DAA4D;AAC5D,2EAAoF;AACpF,iEAAmE;AAEnE,2CAAmF;AACnF,qDAA8C;AAO9C,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAElC;;;;GAIG;AACH,MAAa,UAAU;IAetB;;OAEG;IACH,IAAW,IAAI;QACd,OAAO,UAAU,CAAC,IAAI,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,IAAW,UAAU;QACpB,OAAO,UAAU,CAAC,UAAU,CAAC;IAC9B,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,IAAI,CAChB,OAA+B,EAC/B,EAAU,EACV,QAA0B,EAC1B,UAA8B;QAE9B,MAAM,GAAG,GAAG,IAAI,SAAS,CAAC,EAAE,EAAE,OA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AC,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IAChD,CAAC;CACD;AA/SD,8BA+SC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ISequencedDocumentMessage, MessageType } from \"@fluidframework/protocol-definitions\";\nimport {\n\tIChannelAttributes,\n\tIFluidDataStoreRuntime,\n\tIChannelStorageService,\n\tIChannelServices,\n\tIChannelFactory,\n} from \"@fluidframework/datastore-definitions\";\nimport { ISummaryTreeWithStats, ITelemetryContext } from \"@fluidframework/runtime-definitions\";\nimport { readAndParse } from \"@fluidframework/driver-utils\";\nimport { IFluidSerializer, SharedObject } from \"@fluidframework/shared-object-base\";\nimport { SummaryTreeBuilder } from \"@fluidframework/runtime-utils\";\nimport { ISharedMap, ISharedMapEvents } from \"./interfaces\";\nimport { IMapDataObjectSerializable, IMapOperation, MapKernel } from \"./mapKernel\";\nimport { pkgVersion } from \"./packageVersion\";\n\ninterface IMapSerializationFormat {\n\tblobs?: string[];\n\tcontent: IMapDataObjectSerializable;\n}\n\nconst snapshotFileName = \"header\";\n\n/**\n * {@link @fluidframework/datastore-definitions#IChannelFactory} for {@link SharedMap}.\n *\n * @sealed\n */\nexport class MapFactory implements IChannelFactory {\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.\"type\"}\n\t */\n\tpublic static readonly Type = \"https://graph.microsoft.com/types/map\";\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.attributes}\n\t */\n\tpublic static readonly Attributes: IChannelAttributes = {\n\t\ttype: MapFactory.Type,\n\t\tsnapshotFormatVersion: \"0.2\",\n\t\tpackageVersion: pkgVersion,\n\t};\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.\"type\"}\n\t */\n\tpublic get type(): string {\n\t\treturn MapFactory.Type;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.attributes}\n\t */\n\tpublic get attributes(): IChannelAttributes {\n\t\treturn MapFactory.Attributes;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}\n\t */\n\tpublic async load(\n\t\truntime: IFluidDataStoreRuntime,\n\t\tid: string,\n\t\tservices: IChannelServices,\n\t\tattributes: IChannelAttributes,\n\t): Promise<ISharedMap> {\n\t\tconst map = new SharedMap(id, runtime, attributes);\n\t\tawait map.load(services);\n\n\t\treturn map;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.create}\n\t */\n\tpublic create(runtime: IFluidDataStoreRuntime, id: string): ISharedMap {\n\t\tconst map = new SharedMap(id, runtime, MapFactory.Attributes);\n\t\tmap.initializeLocal();\n\n\t\treturn map;\n\t}\n}\n\n/**\n * {@inheritDoc ISharedMap}\n */\nexport class SharedMap extends SharedObject<ISharedMapEvents> implements ISharedMap {\n\t/**\n\t * Create a new shared map.\n\t * @param runtime - The data store runtime that the new shared map belongs to.\n\t * @param id - Optional name of the shared map.\n\t * @returns Newly created shared map.\n\t *\n\t * @example\n\t * To create a `SharedMap`, call the static create method:\n\t *\n\t * ```typescript\n\t * const myMap = SharedMap.create(this.runtime, id);\n\t * ```\n\t */\n\tpublic static create(runtime: IFluidDataStoreRuntime, id?: string): SharedMap {\n\t\treturn runtime.createChannel(id, MapFactory.Type) as SharedMap;\n\t}\n\n\t/**\n\t * Get a factory for SharedMap to register with the data store.\n\t * @returns A factory that creates SharedMaps and loads them from storage.\n\t */\n\tpublic static getFactory(): IChannelFactory {\n\t\treturn new MapFactory();\n\t}\n\n\t/**\n\t * String representation for the class.\n\t */\n\tpublic readonly [Symbol.toStringTag]: string = \"SharedMap\";\n\n\t/**\n\t * MapKernel which manages actual map operations.\n\t */\n\tprivate readonly kernel: MapKernel;\n\n\t/**\n\t * Do not call the constructor. Instead, you should use the {@link SharedMap.create | create method}.\n\t *\n\t * @param id - String identifier.\n\t * @param runtime - Data store runtime.\n\t * @param attributes - The attributes for the map.\n\t */\n\tpublic constructor(\n\t\tid: string,\n\t\truntime: IFluidDataStoreRuntime,\n\t\tattributes: IChannelAttributes,\n\t) {\n\t\tsuper(id, runtime, attributes, \"fluid_map_\");\n\t\tthis.kernel = new MapKernel(\n\t\t\tthis.serializer,\n\t\t\tthis.handle,\n\t\t\t(op, localOpMetadata) => this.submitLocalMessage(op, localOpMetadata),\n\t\t\t() => this.isAttached(),\n\t\t\tthis,\n\t\t);\n\t}\n\n\t/**\n\t * Get an iterator over the keys in this map.\n\t * @returns The iterator\n\t */\n\tpublic keys(): IterableIterator<string> {\n\t\treturn this.kernel.keys();\n\t}\n\n\t/**\n\t * Get an iterator over the entries in this map.\n\t * @returns The iterator\n\t */\n\t// TODO: Use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tpublic entries(): IterableIterator<[string, any]> {\n\t\treturn this.kernel.entries();\n\t}\n\n\t/**\n\t * Get an iterator over the values in this map.\n\t * @returns The iterator\n\t */\n\t// TODO: Use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tpublic values(): IterableIterator<any> {\n\t\treturn this.kernel.values();\n\t}\n\n\t/**\n\t * Get an iterator over the entries in this map.\n\t * @returns The iterator\n\t */\n\t// TODO: Use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tpublic [Symbol.iterator](): IterableIterator<[string, any]> {\n\t\treturn this.kernel.entries();\n\t}\n\n\t/**\n\t * The number of key/value pairs stored in the map.\n\t */\n\tpublic get size(): number {\n\t\treturn this.kernel.size;\n\t}\n\n\t/**\n\t * Executes the given callback on each entry in the map.\n\t * @param callbackFn - Callback function\n\t */\n\t// TODO: Use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tpublic forEach(callbackFn: (value: any, key: string, map: Map<string, any>) => void): void {\n\t\t// eslint-disable-next-line unicorn/no-array-for-each, unicorn/no-array-callback-reference\n\t\tthis.kernel.forEach(callbackFn);\n\t}\n\n\t/**\n\t * {@inheritDoc ISharedMap.get}\n\t */\n\t// TODO: Use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tpublic get<T = any>(key: string): T | undefined {\n\t\treturn this.kernel.get<T>(key);\n\t}\n\n\t/**\n\t * Check if a key exists in the map.\n\t * @param key - The key to check\n\t * @returns True if the key exists, false otherwise\n\t */\n\tpublic has(key: string): boolean {\n\t\treturn this.kernel.has(key);\n\t}\n\n\t/**\n\t * {@inheritDoc ISharedMap.set}\n\t */\n\tpublic set(key: string, value: unknown): this {\n\t\tthis.kernel.set(key, value);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Delete a key from the map.\n\t * @param key - Key to delete\n\t * @returns True if the key existed and was deleted, false if it did not exist\n\t */\n\tpublic delete(key: string): boolean {\n\t\treturn this.kernel.delete(key);\n\t}\n\n\t/**\n\t * Clear all data from the map.\n\t */\n\tpublic clear(): void {\n\t\tthis.kernel.clear();\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.summarizeCore}\n\t * @internal\n\t */\n\tprotected summarizeCore(\n\t\tserializer: IFluidSerializer,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): ISummaryTreeWithStats {\n\t\tlet currentSize = 0;\n\t\tlet counter = 0;\n\t\tlet headerBlob: IMapDataObjectSerializable = {};\n\t\tconst blobs: string[] = [];\n\n\t\tconst builder = new SummaryTreeBuilder();\n\n\t\tconst data = this.kernel.getSerializedStorage(serializer);\n\n\t\t// If single property exceeds this size, it goes into its own blob\n\t\tconst MinValueSizeSeparateSnapshotBlob = 8 * 1024;\n\n\t\t// Maximum blob size for multiple map properties\n\t\t// Should be bigger than MinValueSizeSeparateSnapshotBlob\n\t\tconst MaxSnapshotBlobSize = 16 * 1024;\n\n\t\t// Partitioning algorithm:\n\t\t// 1) Split large (over MinValueSizeSeparateSnapshotBlob = 8K) properties into their own blobs.\n\t\t// Naming (across snapshots) of such blob does not have to be stable across snapshots,\n\t\t// As de-duping process (in driver) should not care about paths, only content.\n\t\t// 2) Split remaining properties into blobs of MaxSnapshotBlobSize (16K) size.\n\t\t// This process does not produce stable partitioning. This means\n\t\t// modification (including addition / deletion) of property can shift properties across blobs\n\t\t// and result in non-incremental snapshot.\n\t\t// This can be improved in the future, without being format breaking change, as loading sequence\n\t\t// loads all blobs at once and partitioning schema has no impact on that process.\n\t\tfor (const key of Object.keys(data)) {\n\t\t\tconst value = data[key];\n\t\t\tif (value.value && value.value.length >= MinValueSizeSeparateSnapshotBlob) {\n\t\t\t\tconst blobName = `blob${counter}`;\n\t\t\t\tcounter++;\n\t\t\t\tblobs.push(blobName);\n\t\t\t\tconst content: IMapDataObjectSerializable = {\n\t\t\t\t\t[key]: {\n\t\t\t\t\t\ttype: value.type,\n\t\t\t\t\t\tvalue: JSON.parse(value.value) as unknown,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t\tbuilder.addBlob(blobName, JSON.stringify(content));\n\t\t\t} else {\n\t\t\t\tcurrentSize += value.type.length + 21; // Approximation cost of property header\n\t\t\t\tif (value.value) {\n\t\t\t\t\tcurrentSize += value.value.length;\n\t\t\t\t}\n\n\t\t\t\tif (currentSize > MaxSnapshotBlobSize) {\n\t\t\t\t\tconst blobName = `blob${counter}`;\n\t\t\t\t\tcounter++;\n\t\t\t\t\tblobs.push(blobName);\n\t\t\t\t\tbuilder.addBlob(blobName, JSON.stringify(headerBlob));\n\t\t\t\t\theaderBlob = {};\n\t\t\t\t\tcurrentSize = 0;\n\t\t\t\t}\n\t\t\t\theaderBlob[key] = {\n\t\t\t\t\ttype: value.type,\n\t\t\t\t\tvalue:\n\t\t\t\t\t\tvalue.value === undefined\n\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t: (JSON.parse(value.value) as unknown),\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\tconst header: IMapSerializationFormat = {\n\t\t\tblobs,\n\t\t\tcontent: headerBlob,\n\t\t};\n\t\tbuilder.addBlob(snapshotFileName, JSON.stringify(header));\n\n\t\treturn builder.getSummaryTree();\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}\n\t * @internal\n\t */\n\tprotected async loadCore(storage: IChannelStorageService): Promise<void> {\n\t\tconst json = await readAndParse<object>(storage, snapshotFileName);\n\t\tconst newFormat = json as IMapSerializationFormat;\n\t\tif (Array.isArray(newFormat.blobs)) {\n\t\t\tthis.kernel.populateFromSerializable(newFormat.content);\n\t\t\tawait Promise.all(\n\t\t\t\tnewFormat.blobs.map(async (value) => {\n\t\t\t\t\tconst content = await readAndParse<IMapDataObjectSerializable>(storage, value);\n\t\t\t\t\tthis.kernel.populateFromSerializable(content);\n\t\t\t\t}),\n\t\t\t);\n\t\t} else {\n\t\t\tthis.kernel.populateFromSerializable(json as IMapDataObjectSerializable);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.onDisconnect}\n\t * @internal\n\t */\n\tprotected onDisconnect(): void {}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.reSubmitCore}\n\t * @internal\n\t */\n\tprotected reSubmitCore(content: unknown, localOpMetadata: unknown): void {\n\t\tthis.kernel.trySubmitMessage(content as IMapOperation, localOpMetadata);\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObjectCore.applyStashedOp}\n\t * @internal\n\t */\n\tprotected applyStashedOp(content: unknown): unknown {\n\t\treturn this.kernel.tryApplyStashedOp(content as IMapOperation);\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.processCore}\n\t * @internal\n\t */\n\tprotected processCore(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t): void {\n\t\tif (message.type === MessageType.Operation) {\n\t\t\tthis.kernel.tryProcessMessage(\n\t\t\t\tmessage.contents as IMapOperation,\n\t\t\t\tlocal,\n\t\t\t\tlocalOpMetadata,\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.rollback}\n\t * @internal\n\t */\n\tprotected rollback(content: unknown, localOpMetadata: unknown): void {\n\t\tthis.kernel.rollback(content, localOpMetadata);\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"mapKernel.d.ts","sourceRoot":"","sources":["../src/mapKernel.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAa,MAAM,oCAAoC,CAAC;AACjF,OAAO,EAAU,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EACH,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EACnB,MAAM,cAAc,CAAC;AACtB,OAAO,EACH,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAIrB,MAAM,sBAAsB,CAAC;AAkC9B;;GAEG;AACH,oBAAY,gBAAgB,GAAG,gBAAgB,GAAG,mBAAmB,CAAC;AAEtE;;GAEG;AACH,oBAAY,aAAa,GAAG,gBAAgB,GAAG,kBAAkB,CAAC;AAElE;;;;;;;GAOG;AACH,MAAM,WAAW,0BAA0B;IACvC,CAAC,GAAG,EAAE,MAAM,GAAG,kBAAkB,CAAC;CACrC;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACrC,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,CAAC;CACnC;AAwCD;;GAEG;AACH,qBAAa,SAAS;IAgDd,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,YAAY;IAnD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@@ -10,28 +10,33 @@ const common_utils_1 = require("@fluidframework/common-utils");
10
10
  const localValues_1 = require("./localValues");
11
11
  /* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access */
12
12
  function isMapKeyLocalOpMetadata(metadata) {
13
- return metadata !== undefined && typeof metadata.pendingMessageId === "number" &&
14
- (metadata.type === "add" || metadata.type === "edit");
13
+ return (metadata !== undefined &&
14
+ typeof metadata.pendingMessageId === "number" &&
15
+ (metadata.type === "add" || metadata.type === "edit"));
15
16
  }
16
17
  function isClearLocalOpMetadata(metadata) {
17
- return metadata !== undefined && metadata.type === "clear" && typeof metadata.pendingMessageId === "number";
18
+ return (metadata !== undefined &&
19
+ metadata.type === "clear" &&
20
+ typeof metadata.pendingMessageId === "number");
18
21
  }
19
22
  function isMapLocalOpMetadata(metadata) {
20
- return metadata !== undefined && typeof metadata.pendingMessageId === "number" &&
21
- (metadata.type === "add" || metadata.type === "edit" || metadata.type === "clear");
23
+ return (metadata !== undefined &&
24
+ typeof metadata.pendingMessageId === "number" &&
25
+ (metadata.type === "add" || metadata.type === "edit" || metadata.type === "clear"));
22
26
  }
23
27
  /* eslint-enable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access */
24
28
  function createClearLocalOpMetadata(op, pendingClearMessageId, previousMap) {
25
29
  const localMetadata = {
26
30
  type: "clear",
27
- pendingMessageId: pendingClearMessageId, previousMap,
31
+ pendingMessageId: pendingClearMessageId,
32
+ previousMap,
28
33
  };
29
34
  return localMetadata;
30
35
  }
31
36
  function createKeyLocalOpMetadata(op, pendingMessageId, previousValue) {
32
- const localMetadata = previousValue ?
33
- { type: "edit", pendingMessageId, previousValue } :
34
- { type: "add", pendingMessageId };
37
+ const localMetadata = previousValue
38
+ ? { type: "edit", pendingMessageId, previousValue }
39
+ : { type: "add", pendingMessageId };
35
40
  return localMetadata;
36
41
  }
37
42
  /**
@@ -102,8 +107,8 @@ class MapKernel {
102
107
  const nextVal = localEntriesIterator.next();
103
108
  return nextVal.done
104
109
  ? { value: undefined, done: true }
105
- // Unpack the stored value
106
- : { value: [nextVal.value[0], nextVal.value[1].value], done: false };
110
+ : // Unpack the stored value
111
+ { value: [nextVal.value[0], nextVal.value[1].value], done: false };
107
112
  },
108
113
  [Symbol.iterator]() {
109
114
  return this;
@@ -124,8 +129,8 @@ class MapKernel {
124
129
  const nextVal = localValuesIterator.next();
125
130
  return nextVal.done
126
131
  ? { value: undefined, done: true }
127
- // Unpack the stored value
128
- : { value: nextVal.value.value, done: false };
132
+ : // Unpack the stored value
133
+ { value: nextVal.value.value, done: false };
129
134
  },
130
135
  [Symbol.iterator]() {
131
136
  return this;
@@ -324,7 +329,8 @@ class MapKernel {
324
329
  this.setCore(key, localValue, true);
325
330
  }
326
331
  const lastPendingClearId = this.pendingClearMessageIds.pop();
327
- if (lastPendingClearId === undefined || lastPendingClearId !== localOpMetadata.pendingMessageId) {
332
+ if (lastPendingClearId === undefined ||
333
+ lastPendingClearId !== localOpMetadata.pendingMessageId) {
328
334
  throw new Error("Rollback op does match last clear");
329
335
  }
330
336
  }
@@ -332,7 +338,8 @@ class MapKernel {
332
338
  if (localOpMetadata.type === "add") {
333
339
  this.deleteCore(op.key, true);
334
340
  }
335
- else if (localOpMetadata.type === "edit" && localOpMetadata.previousValue !== undefined) {
341
+ else if (localOpMetadata.type === "edit" &&
342
+ localOpMetadata.previousValue !== undefined) {
336
343
  this.setCore(op.key, localOpMetadata.previousValue, true);
337
344
  }
338
345
  else {
@@ -416,7 +423,8 @@ class MapKernel {
416
423
  * @returns The local value that was produced
417
424
  */
418
425
  makeLocal(key, serializable) {
419
- if (serializable.type === shared_object_base_1.ValueType[shared_object_base_1.ValueType.Plain] || serializable.type === shared_object_base_1.ValueType[shared_object_base_1.ValueType.Shared]) {
426
+ if (serializable.type === shared_object_base_1.ValueType[shared_object_base_1.ValueType.Plain] ||
427
+ serializable.type === shared_object_base_1.ValueType[shared_object_base_1.ValueType.Shared]) {
420
428
  return this.localValueMaker.fromSerializable(serializable);
421
429
  }
422
430
  else {
@@ -435,7 +443,8 @@ class MapKernel {
435
443
  needProcessKeyOperation(op, local, localOpMetadata) {
436
444
  if (this.pendingClearMessageIds.length > 0) {
437
445
  if (local) {
438
- (0, common_utils_1.assert)(localOpMetadata !== undefined && isMapKeyLocalOpMetadata(localOpMetadata) &&
446
+ (0, common_utils_1.assert)(localOpMetadata !== undefined &&
447
+ isMapKeyLocalOpMetadata(localOpMetadata) &&
439
448
  localOpMetadata.pendingMessageId < this.pendingClearMessageIds[0], 0x013 /* "Received out of order op when there is an unackd clear message" */);
440
449
  }
441
450
  // If we have an unack'd clear, we can ignore all ops.
@@ -448,7 +457,8 @@ class MapKernel {
448
457
  if (local) {
449
458
  (0, common_utils_1.assert)(localOpMetadata !== undefined && isMapKeyLocalOpMetadata(localOpMetadata), 0x014 /* pendingMessageId is missing from the local client's operation */);
450
459
  const pendingMessageIds = this.pendingKeys.get(op.key);
451
- (0, common_utils_1.assert)(pendingMessageIds !== undefined && pendingMessageIds[0] === localOpMetadata.pendingMessageId, 0x2fa /* Unexpected pending message received */);
460
+ (0, common_utils_1.assert)(pendingMessageIds !== undefined &&
461
+ pendingMessageIds[0] === localOpMetadata.pendingMessageId, 0x2fa /* Unexpected pending message received */);
452
462
  pendingMessageIds.shift();
453
463
  if (pendingMessageIds.length === 0) {
454
464
  this.pendingKeys.delete(op.key);
@@ -572,16 +582,17 @@ class MapKernel {
572
582
  (0, common_utils_1.assert)(isMapKeyLocalOpMetadata(localOpMetadata), 0x2fe /* Invalid localOpMetadata in submit */);
573
583
  // clear the old pending message id
574
584
  const pendingMessageIds = this.pendingKeys.get(op.key);
575
- (0, common_utils_1.assert)(pendingMessageIds !== undefined && pendingMessageIds[0] === localOpMetadata.pendingMessageId, 0x2ff /* Unexpected pending message received */);
585
+ (0, common_utils_1.assert)(pendingMessageIds !== undefined &&
586
+ pendingMessageIds[0] === localOpMetadata.pendingMessageId, 0x2ff /* Unexpected pending message received */);
576
587
  pendingMessageIds.shift();
577
588
  if (pendingMessageIds.length === 0) {
578
589
  this.pendingKeys.delete(op.key);
579
590
  }
580
591
  // We don't reuse the metadata pendingMessageId but send a new one on each submit.
581
592
  const pendingMessageId = this.getMapKeyMessageId(op);
582
- const localMetadata = localOpMetadata.type === "edit" ?
583
- { type: "edit", pendingMessageId, previousValue: localOpMetadata.previousValue } :
584
- { type: "add", pendingMessageId };
593
+ const localMetadata = localOpMetadata.type === "edit"
594
+ ? { type: "edit", pendingMessageId, previousValue: localOpMetadata.previousValue }
595
+ : { type: "add", pendingMessageId };
585
596
  this.submitMessage(op, localMetadata);
586
597
  }
587
598
  }