@fluidframework/sequence 0.59.3003 → 0.59.4000

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 (80) hide show
  1. package/dist/{mapKernel.d.ts → defaultMap.d.ts} +21 -145
  2. package/dist/defaultMap.d.ts.map +1 -0
  3. package/dist/defaultMap.js +317 -0
  4. package/dist/defaultMap.js.map +1 -0
  5. package/dist/{mapKernelInterfaces.d.ts → defaultMapInterfaces.d.ts} +9 -51
  6. package/dist/defaultMapInterfaces.d.ts.map +1 -0
  7. package/dist/{mapKernelInterfaces.js → defaultMapInterfaces.js} +1 -1
  8. package/dist/defaultMapInterfaces.js.map +1 -0
  9. package/dist/index.d.ts +1 -1
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js.map +1 -1
  12. package/dist/intervalCollection.d.ts +12 -3
  13. package/dist/intervalCollection.d.ts.map +1 -1
  14. package/dist/intervalCollection.js +44 -39
  15. package/dist/intervalCollection.js.map +1 -1
  16. package/dist/localValues.d.ts +7 -86
  17. package/dist/localValues.d.ts.map +1 -1
  18. package/dist/localValues.js +1 -131
  19. package/dist/localValues.js.map +1 -1
  20. package/dist/packageVersion.d.ts +1 -1
  21. package/dist/packageVersion.js +1 -1
  22. package/dist/packageVersion.js.map +1 -1
  23. package/dist/sequence.d.ts +5 -1
  24. package/dist/sequence.d.ts.map +1 -1
  25. package/dist/sequence.js +23 -23
  26. package/dist/sequence.js.map +1 -1
  27. package/dist/sharedIntervalCollection.d.ts +13 -5
  28. package/dist/sharedIntervalCollection.d.ts.map +1 -1
  29. package/dist/sharedIntervalCollection.js +16 -12
  30. package/dist/sharedIntervalCollection.js.map +1 -1
  31. package/lib/{mapKernel.d.ts → defaultMap.d.ts} +21 -145
  32. package/lib/defaultMap.d.ts.map +1 -0
  33. package/lib/defaultMap.js +313 -0
  34. package/lib/defaultMap.js.map +1 -0
  35. package/lib/{mapKernelInterfaces.d.ts → defaultMapInterfaces.d.ts} +9 -51
  36. package/lib/defaultMapInterfaces.d.ts.map +1 -0
  37. package/lib/{mapKernelInterfaces.js → defaultMapInterfaces.js} +1 -1
  38. package/lib/defaultMapInterfaces.js.map +1 -0
  39. package/lib/index.d.ts +1 -1
  40. package/lib/index.d.ts.map +1 -1
  41. package/lib/index.js.map +1 -1
  42. package/lib/intervalCollection.d.ts +12 -3
  43. package/lib/intervalCollection.d.ts.map +1 -1
  44. package/lib/intervalCollection.js +44 -39
  45. package/lib/intervalCollection.js.map +1 -1
  46. package/lib/localValues.d.ts +7 -86
  47. package/lib/localValues.d.ts.map +1 -1
  48. package/lib/localValues.js +1 -129
  49. package/lib/localValues.js.map +1 -1
  50. package/lib/packageVersion.d.ts +1 -1
  51. package/lib/packageVersion.js +1 -1
  52. package/lib/packageVersion.js.map +1 -1
  53. package/lib/sequence.d.ts +5 -1
  54. package/lib/sequence.d.ts.map +1 -1
  55. package/lib/sequence.js +23 -23
  56. package/lib/sequence.js.map +1 -1
  57. package/lib/sharedIntervalCollection.d.ts +13 -5
  58. package/lib/sharedIntervalCollection.d.ts.map +1 -1
  59. package/lib/sharedIntervalCollection.js +16 -12
  60. package/lib/sharedIntervalCollection.js.map +1 -1
  61. package/package.json +23 -18
  62. package/src/defaultMap.ts +453 -0
  63. package/src/{mapKernelInterfaces.ts → defaultMapInterfaces.ts} +14 -59
  64. package/src/index.ts +1 -1
  65. package/src/intervalCollection.ts +58 -43
  66. package/src/localValues.ts +6 -154
  67. package/src/packageVersion.ts +1 -1
  68. package/src/sequence.ts +32 -33
  69. package/src/sharedIntervalCollection.ts +22 -25
  70. package/dist/mapKernel.d.ts.map +0 -1
  71. package/dist/mapKernel.js +0 -599
  72. package/dist/mapKernel.js.map +0 -1
  73. package/dist/mapKernelInterfaces.d.ts.map +0 -1
  74. package/dist/mapKernelInterfaces.js.map +0 -1
  75. package/lib/mapKernel.d.ts.map +0 -1
  76. package/lib/mapKernel.js +0 -595
  77. package/lib/mapKernel.js.map +0 -1
  78. package/lib/mapKernelInterfaces.d.ts.map +0 -1
  79. package/lib/mapKernelInterfaces.js.map +0 -1
  80. package/src/mapKernel.ts +0 -850
@@ -1 +0,0 @@
1
- {"version":3,"file":"mapKernel.js","sourceRoot":"","sources":["../src/mapKernel.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAoB,uBAAuB,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AACxH,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAEH,eAAe,EACf,gBAAgB,GAEnB,MAAM,eAAe,CAAC;AAuIvB;;GAEG;AACH,MAAM,OAAO,SAAS;IAyClB;;;;;;;;OAQG;IACH,YACqB,UAA4B,EAC5B,MAAoB,EACpB,aAA2E,EAC3E,UAAyB,EAC1C,UAAuC,EACvB,eAAe,IAAI,iBAAiB,EAAoB;QALvD,eAAU,GAAV,UAAU,CAAkB;QAC5B,WAAM,GAAN,MAAM,CAAc;QACpB,kBAAa,GAAb,aAAa,CAA8D;QAC3E,eAAU,GAAV,UAAU,CAAe;QAE1B,iBAAY,GAAZ,YAAY,CAA4C;QAhD5E;;WAEG;QACc,oBAAe,GAA4C,IAAI,GAAG,EAAE,CAAC;QAEtF;;WAEG;QACc,SAAI,GAAG,IAAI,GAAG,EAAuB,CAAC;QAEvD;;WAEG;QACc,gBAAW,GAAwB,IAAI,GAAG,EAAE,CAAC;QAE9D;;WAEG;QACK,qBAAgB,GAAW,CAAC,CAAC,CAAC;QAEtC;;;WAGG;QACK,0BAAqB,GAAW,CAAC,CAAC,CAAC;QAOnC,qBAAgB,GAAW,CAAC,CAAC,CAAC;QAmBlC,IAAI,CAAC,eAAe,GAAG,IAAI,eAAe,CAAC,UAAU,CAAC,CAAC;QACvD,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,kBAAkB,EAAE,CAAC;QACjD,KAAK,MAAM,IAAI,IAAI,UAAU,EAAE;YAC3B,IAAI,CAA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E,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;QAC/C,OAAO,gBAAgB,CAAC;IAC5B,CAAC;IAED;;;OAGG;IACK,mBAAmB,CAAC,EAAoB;QAC5C,MAAM,gBAAgB,GAAG,IAAI,CAAC,6BAA6B,CAAC,EAAE,CAAC,CAAC;QAChE,IAAI,CAAC,aAAa,CAAC,EAAE,EAAE,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,IAAI,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAC1F,CAAC;IAED;;;;;OAKG;IACK,qBAAqB,CAAC,GAAW;QACrC,MAAM,IAAI,GAAG,CAAC,MAAc,EAAE,aAAkB,EAAE,MAAW,EAAE,EAAE;YAC7D,MAAM,gBAAgB,GAAG,uBAAuB,CAC5C,MAAM,EACN,IAAI,CAAC,UAAU,EACf,IAAI,CAAC,MAAM,CAAC,CAAC;YAEjB,MAAM,EAAE,GAA2B;gBAC/B,GAAG;gBACH,IAAI,EAAE,KAAK;gBACX,KAAK,EAAE;oBACH,MAAM;oBACN,KAAK,EAAE,gBAAgB;iBAC1B;aACJ,CAAC;YACF,6EAA6E;YAC7E,IAAI,CAAC,aAAa,CAAC,EAAE,EAAE,EAAE,gBAAgB,EAAE,IAAI,CAAC,gBAAgB,EAAE,CAAC,CAAC;YAEpE,MAAM,KAAK,GAAkB,EAAE,GAAG,EAAE,aAAa,EAAE,CAAC;YACpD,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,cAAc,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;QACjF,CAAC,CAAC;QAEF,OAAO,EAAE,IAAI,EAAE,CAAC;IACpB,CAAC;CACJ","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 { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport { IFluidSerializer, makeHandlesSerializable, parseHandles, ValueType } from \"@fluidframework/shared-object-base\";\nimport { assert, TypedEventEmitter } from \"@fluidframework/common-utils\";\nimport {\n ILocalValue,\n LocalValueMaker,\n makeSerializable,\n ValueTypeLocalValue,\n} from \"./localValues\";\nimport {\n ISerializableValue,\n ISerializedValue,\n IValueChanged,\n IValueOpEmitter,\n IValueType,\n IValueTypeCreator,\n IValueTypeOperationValue,\n ISharedMapEvents,\n} from \"./mapKernelInterfaces\";\n\n/**\n * Defines the means to process and submit a given op on a map.\n */\ninterface IMapMessageHandler {\n /**\n * Apply the given operation.\n * @param op - The map operation to apply\n * @param local - Whether the message originated from the local client\n * @param message - The full message. Not provided for stashed ops.\n * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n * For messages from a remote client, this will be undefined.\n */\n process(\n op: IMapOperation,\n local: boolean,\n message: ISequencedDocumentMessage | undefined,\n localOpMetadata: IMapMessageLocalMetadata,\n ): void;\n\n /**\n * Communicate the operation to remote clients.\n * @param op - The map operation to submit\n * @param localOpMetadata - The metadata to be submitted with the message.\n */\n submit(op: IMapOperation): void;\n\n getStashedOpLocalMetadata(op: IMapOperation): unknown;\n}\n\ninterface IMapMessageLocalMetadata{\n pendingClearMessageId?: number;\n pendingMessageId?: number;\n lastProcessedSeq: number;\n}\n\n/**\n * Describes an operation specific to a value type.\n */\nexport interface IMapValueTypeOperation {\n /**\n * String identifier of the operation type.\n */\n type: \"act\";\n\n /**\n * Map key being modified.\n */\n key: string;\n\n /**\n * Value of the operation, specific to the value type.\n * @alpha\n */\n value: IValueTypeOperationValue;\n}\n\n/**\n * Operation indicating a value should be set for a key.\n */\nexport 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 a key should be deleted from the map.\n */\nexport 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 * Map key operations are one of several types.\n */\nexport type IMapKeyOperation = IMapValueTypeOperation | IMapSetOperation | IMapDeleteOperation;\n\n/**\n * Operation indicating the map should be cleared.\n */\nexport interface IMapClearOperation {\n /**\n * String identifier of the operation type.\n */\n type: \"clear\";\n}\n\n/**\n * Description of a map delta operation\n */\nexport type IMapOperation = IMapKeyOperation | IMapClearOperation;\n\n/**\n * Defines the in-memory object structure to be used for the conversion to/from serialized.\n * Directly used in JSON.stringify, direct result from JSON.parse\n */\nexport interface IMapDataObjectSerializable {\n [key: string]: ISerializableValue;\n}\n\nexport interface IMapDataObjectSerialized {\n [key: string]: ISerializedValue;\n}\n\n/**\n * A SharedMap is a map-like distributed data structure.\n */\nexport class MapKernel implements IValueTypeCreator {\n /**\n * The number of key/value pairs stored in the map.\n */\n public get size(): number {\n return this.data.size;\n }\n\n /**\n * Mapping of op types to message handlers.\n */\n private readonly messageHandlers: ReadonlyMap<string, IMapMessageHandler> = new Map();\n\n /**\n * The in-memory data the map is storing.\n */\n private readonly data = new Map<string, ILocalValue>();\n\n /**\n * Keys that have been modified locally but not yet ack'd from the server.\n */\n private readonly pendingKeys: Map<string, number> = new Map();\n\n /**\n * This is used to assign a unique id to every outgoing operation and helps in tracking unacked ops.\n */\n private pendingMessageId: number = -1;\n\n /**\n * If a clear has been performed locally but not yet ack'd from the server, then this stores the pending id\n * of that clear operation. Otherwise, is -1.\n */\n private pendingClearMessageId: number = -1;\n\n /**\n * Object to create encapsulations of the values stored in the map.\n */\n private readonly localValueMaker: LocalValueMaker;\n\n private lastProcessedSeq: number = -1;\n\n /**\n * Create a new shared map kernel.\n * @param serializer - The serializer to serialize / parse handles\n * @param handle - The handle of the shared object using the kernel\n * @param submitMessage - A callback to submit a message through the shared object\n * @param isAttached - To query whether the shared object should generate ops\n * @param valueTypes - The value types to register\n * @param eventEmitter - The object that will emit map events\n */\n constructor(\n private readonly serializer: IFluidSerializer,\n private readonly handle: IFluidHandle,\n private readonly submitMessage: (op: any, localOpMetadata: IMapMessageLocalMetadata) => void,\n private readonly isAttached: () => boolean,\n valueTypes: Readonly<IValueType<any>[]>,\n public readonly eventEmitter = new TypedEventEmitter<ISharedMapEvents>(),\n ) {\n this.localValueMaker = new LocalValueMaker(serializer);\n this.messageHandlers = this.getMessageHandlers();\n for (const type of valueTypes) {\n this.localValueMaker.registerValueType(type);\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.data.keys();\n }\n\n /**\n * Get an iterator over the entries in this map.\n * @returns The iterator\n */\n public entries(): IterableIterator<[string, any]> {\n const localEntriesIterator = this.data.entries();\n const iterator = {\n next(): IteratorResult<[string, any]> {\n const nextVal = localEntriesIterator.next();\n if (nextVal.done) {\n return { value: undefined, done: true };\n } else {\n // Unpack the stored value\n return { value: [nextVal.value[0], nextVal.value[1].value], done: false };\n }\n },\n [Symbol.iterator]() {\n return this;\n },\n };\n return iterator;\n }\n\n /**\n * Get an iterator over the values in this map.\n * @returns The iterator\n */\n public values(): IterableIterator<any> {\n const localValuesIterator = this.data.values();\n const iterator = {\n next(): IteratorResult<any> {\n const nextVal = localValuesIterator.next();\n if (nextVal.done) {\n return { value: undefined, done: true };\n } else {\n // Unpack the stored value\n return { value: nextVal.value.value, done: false };\n }\n },\n [Symbol.iterator]() {\n return this;\n },\n };\n return iterator;\n }\n\n /**\n * Get an iterator over the entries in this map.\n * @returns The iterator\n */\n public [Symbol.iterator](): IterableIterator<[string, any]> {\n return this.entries();\n }\n\n /**\n * Executes the given callback on each entry in the map.\n * @param callbackFn - Callback function\n */\n public forEach(callbackFn: (value: any, key: string, map: Map<string, any>) => void): void {\n this.data.forEach((localValue, key, m) => {\n callbackFn(localValue.value, key, m);\n });\n }\n\n /**\n * {@inheritDoc ISharedMap.get}\n */\n public get<T = any>(key: string): T | undefined {\n if (!this.data.has(key)) {\n return undefined;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const localValue = this.data.get(key)!;\n\n return localValue.value as T;\n }\n\n /**\n * {@inheritDoc ISharedMap.wait}\n */\n public async wait<T = any>(key: string): Promise<T> {\n // Return immediately if the value already exists\n if (this.has(key)) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return this.get<T>(key)!;\n }\n\n // Otherwise subscribe to changes\n return new Promise<T>((resolve) => {\n const callback = (changed: IValueChanged) => {\n if (key === changed.key) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n resolve(this.get<T>(changed.key)!);\n this.eventEmitter.removeListener(\"create\", callback);\n }\n };\n\n this.eventEmitter.on(\"create\", callback);\n });\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.data.has(key);\n }\n\n /**\n * {@inheritDoc ISharedMap.set}\n */\n public set(key: string, value: any) {\n // Undefined/null keys can't be serialized to JSON in the manner we currently snapshot.\n if (key === undefined || key === null) {\n throw new Error(\"Undefined and null keys are not supported\");\n }\n\n // Create a local value and serialize it.\n const localValue = this.localValueMaker.fromInMemory(value);\n const serializableValue = makeSerializable(\n localValue,\n this.serializer,\n this.handle);\n\n // Set the value locally.\n this.setCore(\n key,\n localValue,\n true,\n undefined,\n );\n\n // If we are not attached, don't submit the op.\n if (!this.isAttached()) {\n return;\n }\n\n const op: IMapSetOperation = {\n key,\n type: \"set\",\n value: serializableValue,\n };\n this.submitMapKeyMessage(op);\n }\n\n /**\n * {@inheritDoc IValueTypeCreator.createValueType}\n */\n public createValueType(key: string, type: string, params: any) {\n // Create a local value and serialize it.\n const localValue = this.localValueMaker.makeValueType(type, this.makeMapValueOpEmitter(key), params);\n\n // TODO ideally we could use makeSerialized in this case as well. But the interval\n // collection has assumptions of attach being called prior. Given the IFluidSerializer it\n // may be possible to remove custom value type serialization entirely.\n const transformedValue = makeHandlesSerializable(\n params,\n this.serializer,\n this.handle);\n\n // Set the value locally.\n this.setCore(\n key,\n localValue,\n true,\n undefined,\n );\n\n // If we are not attached, don't submit the op.\n if (!this.isAttached()) {\n return this;\n }\n\n // This is a special form of serialized valuetype only used for set, containing info for initialization.\n // After initialization, the serialized form will need to come from the .store of the value type's factory.\n const serializableValue = { type, value: transformedValue };\n const op: IMapSetOperation = {\n key,\n type: \"set\",\n value: serializableValue,\n };\n this.submitMapKeyMessage(op);\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 // Delete the key locally first.\n const successfullyRemoved = this.deleteCore(key, true, undefined);\n\n // If we are not attached, don't submit the op.\n if (!this.isAttached()) {\n return successfullyRemoved;\n }\n\n const op: IMapDeleteOperation = {\n key,\n type: \"delete\",\n };\n this.submitMapKeyMessage(op);\n\n return successfullyRemoved;\n }\n\n /**\n * Clear all data from the map.\n */\n public clear(): void {\n // Clear the data locally first.\n this.clearCore(true, undefined);\n\n // If we are not attached, don't submit the op.\n if (!this.isAttached()) {\n return;\n }\n\n const op: IMapClearOperation = {\n type: \"clear\",\n };\n this.submitMapClearMessage(op);\n }\n\n /**\n * Serializes the data stored in the shared map to a JSON string\n * @param serializer - The serializer to use to serialize handles in its values.\n * @returns A JSON string containing serialized map data\n */\n public getSerializedStorage(serializer: IFluidSerializer): IMapDataObjectSerialized {\n const serializableMapData: IMapDataObjectSerialized = {};\n this.data.forEach((localValue, key) => {\n serializableMapData[key] = localValue.makeSerialized(serializer, this.handle);\n });\n return serializableMapData;\n }\n\n public getSerializableStorage(serializer: IFluidSerializer): IMapDataObjectSerializable {\n const serializableMapData: IMapDataObjectSerializable = {};\n this.data.forEach((localValue, key) => {\n serializableMapData[key] = makeSerializable(localValue, serializer, this.handle);\n });\n return serializableMapData;\n }\n\n public serialize(serializer: IFluidSerializer): string {\n return JSON.stringify(this.getSerializableStorage(serializer));\n }\n\n /**\n * Populate the kernel with the given map data.\n * @param data - A JSON string containing serialized map data\n */\n public populateFromSerializable(json: IMapDataObjectSerializable): void {\n for (const [key, serializable] of Object.entries(json)) {\n const localValue = {\n key,\n value: this.makeLocal(key, serializable),\n };\n\n this.data.set(localValue.key, localValue.value);\n }\n }\n\n public populate(json: string): void {\n this.populateFromSerializable(JSON.parse(json) as IMapDataObjectSerializable);\n }\n\n /**\n * Submit the given op if a handler is registered.\n * @param op - The operation to attempt to submit\n * @param localOpMetadata - The local metadata associated with the op. This is kept locally by the runtime\n * and not sent to the server. This will be sent back when this message is received back from the server. This is\n * also sent if we are asked to resubmit the message.\n * @returns True if the operation was submitted, false otherwise.\n */\n public trySubmitMessage(op: any, localOpMetadata: unknown): boolean {\n const type: string = op.type;\n if (this.messageHandlers.has(type)) {\n const mapLocalMetadata: Partial<IMapMessageLocalMetadata> = localOpMetadata;\n // we don't know how to rebase these operations, so if any other op has come in\n // we will fail.\n if (this.lastProcessedSeq !== mapLocalMetadata?.lastProcessedSeq) {\n throw new Error(\"SharedInterval does not support reconnect in presence of external changes\");\n }\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this.messageHandlers.get(type)!.submit(op as IMapOperation);\n return true;\n }\n return false;\n }\n\n public tryGetStashedOpLocalMetadata(op: any): unknown {\n const type: string = op.type;\n if (this.messageHandlers.has(type)) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return this.messageHandlers.get(type)!.getStashedOpLocalMetadata(op as IMapOperation);\n }\n throw new Error(\"no apply stashed op handler\");\n }\n\n /**\n * Process the given op if a handler is registered.\n * @param message - The message to process\n * @param local - Whether the message originated from the local client\n * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n * For messages from a remote client, this will be undefined.\n * @returns True if the operation was processed, false otherwise.\n */\n public tryProcessMessage(\n op: IMapOperation,\n local: boolean,\n message: ISequencedDocumentMessage | undefined,\n localOpMetadata: unknown,\n ): boolean {\n // track the seq of every incoming message, so we can detect if any\n // changes happened during a resubmit\n this.lastProcessedSeq = message.sequenceNumber;\n if (this.messageHandlers.has(op.type)) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this.messageHandlers\n .get(op.type)!\n .process(op, local, message, localOpMetadata as IMapMessageLocalMetadata);\n return true;\n }\n return false;\n }\n\n /**\n * Set implementation used for both locally sourced sets as well as incoming remote sets.\n * @param key - The key being set\n * @param value - The value being set\n * @param local - Whether the message originated from the local client\n * @param op - The message if from a remote set, or null if from a local set\n */\n private setCore(key: string, value: ILocalValue, local: boolean, op: ISequencedDocumentMessage | undefined): void {\n const previousValue = this.get(key);\n this.data.set(key, value);\n const event: IValueChanged = { key, previousValue };\n this.eventEmitter.emit(\"create\", event, local, op, this.eventEmitter);\n }\n\n /**\n * Clear implementation used for both locally sourced clears as well as incoming remote clears.\n * @param local - Whether the message originated from the local client\n * @param op - The message if from a remote clear, or null if from a local clear\n */\n private clearCore(local: boolean, op: ISequencedDocumentMessage | undefined): void {\n this.data.clear();\n this.eventEmitter.emit(\"clear\", local, op, this.eventEmitter);\n }\n\n /**\n * Delete implementation used for both locally sourced deletes as well as incoming remote deletes.\n * @param key - The key being deleted\n * @param local - Whether the message originated from the local client\n * @param op - The message if from a remote delete, or null if from a local delete\n * @returns True if the key existed and was deleted, false if it did not exist\n */\n private deleteCore(key: string, local: boolean, op: ISequencedDocumentMessage | undefined): boolean {\n const previousValue = this.get(key);\n const successfullyRemoved = this.data.delete(key);\n if (successfullyRemoved) {\n const event: IValueChanged = { key, previousValue };\n this.eventEmitter.emit(\"valueChanged\", event, local, op, this.eventEmitter);\n }\n return successfullyRemoved;\n }\n\n /**\n * Clear all keys in memory in response to a remote clear, but retain keys we have modified but not yet been ack'd.\n */\n private clearExceptPendingKeys(): void {\n // Assuming the pendingKeys is small and the map is large\n // we will get the value for the pendingKeys and clear the map\n const temp = new Map<string, ILocalValue>();\n this.pendingKeys.forEach((value, key) => {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n temp.set(key, this.data.get(key)!);\n });\n this.data.clear();\n temp.forEach((value, key) => {\n this.data.set(key, value);\n });\n }\n\n /**\n * The remote ISerializableValue we're receiving (either as a result of a load or an incoming set op) will\n * have the information we need to create a real object, but will not be the real object yet. For example,\n * we might know it's a map and the map's ID but not have the actual map or its data yet. makeLocal's\n * job is to convert that information into a real object for local usage.\n * @param key - The key that the caller intends to store the local value into (used for ops later). But\n * doesn't actually store the local value into that key. So better not lie!\n * @param serializable - The remote information that we can convert into a real object\n * @returns The local value that was produced\n */\n private makeLocal(key: string, serializable: ISerializableValue): ILocalValue {\n if (serializable.type === ValueType[ValueType.Plain] || serializable.type === ValueType[ValueType.Shared]) {\n return this.localValueMaker.fromSerializable(serializable);\n } else {\n return this.localValueMaker.fromSerializableValueType(\n serializable,\n this.makeMapValueOpEmitter(key),\n );\n }\n }\n\n /**\n * If our local operations that have not yet been ack'd will eventually overwrite an incoming operation, we should\n * not process the incoming operation.\n * @param op - Operation to check\n * @param local - Whether the message originated from the local client\n * @param message - The message\n * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n * For messages from a remote client, this will be undefined.\n * @returns True if the operation should be processed, false otherwise\n */\n private needProcessKeyOperation(\n op: IMapKeyOperation,\n local: boolean,\n localOpMetadata: IMapMessageLocalMetadata,\n ): boolean {\n if (this.pendingClearMessageId !== -1) {\n if (local) {\n assert(localOpMetadata?.pendingClearMessageId !== undefined\n && localOpMetadata.pendingClearMessageId < this.pendingClearMessageId,\n 0x1f1 /* \"Received out of order op when there is an unacked clear message\" */);\n }\n // If we have an unacked clear, we can ignore all ops.\n return false;\n }\n\n if (this.pendingKeys.has(op.key)) {\n // Found an unacked op. Clear it from the map if the pendingMessageId in the map matches this message's\n // and don't process the op.\n if (local) {\n assert(localOpMetadata !== undefined,\n 0x1f2 /* `pendingMessageId is missing from the local client's ${op.type} operation` */);\n const pendingMessageId = localOpMetadata.pendingMessageId;\n const pendingKeyMessageId = this.pendingKeys.get(op.key);\n if (pendingKeyMessageId === pendingMessageId) {\n this.pendingKeys.delete(op.key);\n }\n }\n return false;\n }\n\n // If we don't have a NACK op on the key, we need to process the remote ops.\n return !local;\n }\n\n /**\n * Get the message handlers for the map.\n * @returns A map of string op names to IMapMessageHandlers for those ops\n */\n private getMessageHandlers() {\n const messageHandlers = new Map<string, IMapMessageHandler>();\n messageHandlers.set(\n \"clear\",\n {\n process: (op: IMapClearOperation, local, message, localOpMetadata) => {\n if (local) {\n assert(localOpMetadata !== undefined,\n 0x1f3 /* \"pendingMessageId is missing from the local client's clear operation\" */);\n const pendingMessageId = localOpMetadata?.pendingMessageId;\n if (this.pendingClearMessageId === pendingMessageId) {\n this.pendingClearMessageId = -1;\n }\n return;\n }\n if (this.pendingKeys.size !== 0) {\n this.clearExceptPendingKeys();\n return;\n }\n this.clearCore(local, message);\n },\n submit: (op: IMapClearOperation) => {\n // We don't reuse the metadata but send a new one on each submit.\n this.submitMapClearMessage(op);\n },\n getStashedOpLocalMetadata: (op: IMapClearOperation) => {\n // We don't reuse the metadata but send a new one on each submit.\n return this.getMapClearMessageLocalMetadata(op);\n },\n });\n messageHandlers.set(\n \"delete\",\n {\n process: (op: IMapDeleteOperation, local, message, localOpMetadata) => {\n if (!this.needProcessKeyOperation(op, local, localOpMetadata)) {\n return;\n }\n this.deleteCore(op.key, local, message);\n },\n submit: (op: IMapDeleteOperation) => {\n // We don't reuse the metadata but send a new one on each submit.\n this.submitMapKeyMessage(op);\n },\n getStashedOpLocalMetadata: (op: IMapDeleteOperation) => {\n // We don't reuse the metadata but send a new one on each submit.\n return this.getMapKeyMessageLocalMetadata(op);\n },\n });\n messageHandlers.set(\n \"set\",\n {\n process: (op: IMapSetOperation, local, message, localOpMetadata) => {\n if (!this.needProcessKeyOperation(op, local, localOpMetadata)) {\n return;\n }\n\n // needProcessKeyOperation should have returned false if local is true\n const context = this.makeLocal(op.key, op.value);\n this.setCore(op.key, context, local, message);\n },\n submit: (op: IMapSetOperation) => {\n // We don't reuse the metadata but send a new one on each submit.\n this.submitMapKeyMessage(op);\n },\n getStashedOpLocalMetadata: (op: IMapSetOperation) => {\n // We don't reuse the metadata but send a new one on each submit.\n return this.getMapKeyMessageLocalMetadata(op);\n },\n });\n\n // Ops with type \"act\" describe actions taken by custom value type handlers of whatever item is\n // being addressed. These custom handlers can be retrieved from the ValueTypeLocalValue which has\n // stashed its valueType (and therefore its handlers). We also emit a valueChanged for anyone\n // watching for manipulations of that item.\n messageHandlers.set(\n \"act\",\n {\n process: (op: IMapValueTypeOperation, local, message, localOpMetadata) => {\n // Local value might not exist if we deleted it\n const localValue = this.data.get(op.key) as ValueTypeLocalValue;\n if (!localValue) {\n return;\n }\n\n const handler = localValue.getOpHandler(op.value.opName);\n const previousValue = localValue.value;\n const translatedValue = parseHandles(\n op.value.value,\n this.serializer);\n handler.process(previousValue, translatedValue, local, message);\n const event: IValueChanged = { key: op.key, previousValue };\n this.eventEmitter.emit(\"valueChanged\", event, local, message, this.eventEmitter);\n },\n submit: (op: IMapValueTypeOperation) => {\n this.submitMessage(op, { lastProcessedSeq: this.lastProcessedSeq });\n },\n getStashedOpLocalMetadata: (op: IMapValueTypeOperation) => {\n assert(false, 0x016 /* \"apply stashed op not implemented for custom value type ops\" */);\n },\n });\n\n return messageHandlers;\n }\n\n private getMapClearMessageLocalMetadata(op: IMapClearOperation): number {\n const pendingMessageId = ++this.pendingMessageId;\n this.pendingClearMessageId = pendingMessageId;\n return pendingMessageId;\n }\n\n /**\n * Submit a clear message to remote clients.\n * @param op - The clear message\n */\n private submitMapClearMessage(op: IMapClearOperation): void {\n const pendingClearMessageId = this.getMapClearMessageLocalMetadata(op);\n this.submitMessage(op, { pendingClearMessageId, lastProcessedSeq: this.lastProcessedSeq });\n }\n\n private getMapKeyMessageLocalMetadata(op: IMapKeyOperation): number {\n const pendingMessageId = ++this.pendingMessageId;\n this.pendingKeys.set(op.key, pendingMessageId);\n return pendingMessageId;\n }\n\n /**\n * Submit a map key message to remote clients.\n * @param op - The map key message\n */\n private submitMapKeyMessage(op: IMapKeyOperation): void {\n const pendingMessageId = this.getMapKeyMessageLocalMetadata(op);\n this.submitMessage(op, { pendingMessageId, lastProcessedSeq: this.lastProcessedSeq });\n }\n\n /**\n * Create an emitter for a value type to emit ops from the given key.\n * @alpha\n * @param key - The key of the map that the value type will be stored on\n * @returns A value op emitter for the given key\n */\n private makeMapValueOpEmitter(key: string): IValueOpEmitter {\n const emit = (opName: string, previousValue: any, params: any) => {\n const translatedParams = makeHandlesSerializable(\n params,\n this.serializer,\n this.handle);\n\n const op: IMapValueTypeOperation = {\n key,\n type: \"act\",\n value: {\n opName,\n value: translatedParams,\n },\n };\n // Send the localOpMetadata as undefined because we don't care about the ack.\n this.submitMessage(op, { lastProcessedSeq: this.lastProcessedSeq });\n\n const event: IValueChanged = { key, previousValue };\n this.eventEmitter.emit(\"valueChanged\", event, true, null, this.eventEmitter);\n };\n\n return { emit };\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"mapKernelInterfaces.d.ts","sourceRoot":"","sources":["../src/mapKernelInterfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACxF,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAE3E;;GAEG;AACH,MAAM,WAAW,aAAa;IAC1B;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;OAEG;IACH,aAAa,EAAE,GAAG,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC5B;;;;;;OAMG;IACH,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,GAAG,IAAI,CAAC;CAC/D;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa,CAAC,CAAC;IAC5B;;;;;;;OAOG;IACH,IAAI,CAAC,OAAO,EAAE,eAAe,EAAE,GAAG,EAAE,GAAG,GAAG,CAA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AAC;IAEzC;;;;OAIG;IACH,IAAI,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IAEvC;;;;;OAKG;IACH,GAAG,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;CAE7C;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,kBAAkB;IAC/B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,KAAK,EAAE,GAAG,CAAC;CACd;AAED,MAAM,WAAW,gBAAgB;IAC7B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;CAC7B;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,wBAAwB;IACrC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,KAAK,EAAE,GAAG,CAAC;CACd"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"mapKernelInterfaces.js","sourceRoot":"","sources":["../src/mapKernelInterfaces.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 { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport { ISharedObject, ISharedObjectEvents } from \"@fluidframework/shared-object-base\";\nimport { 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 previousValue: any;\n}\n\n/**\n * Value types are given an IValueOpEmitter to emit their ops through the container type that holds them.\n */\nexport interface IValueOpEmitter {\n /**\n * Called by the value type to emit a value type operation through the container type holding it.\n * @param opName - Name of the emitted operation\n * @param previousValue - JSONable previous value as defined by the value type\n * @param params - JSONable params for the operation as defined by the value type\n * @alpha\n */\n emit(opName: string, previousValue: any, params: any): void;\n}\n\n/**\n * A value factory is used to serialize/deserialize value types to a map\n * @alpha\n */\nexport interface IValueFactory<T> {\n /**\n * Create a new value type. Used both in creation of new value types, as well as in loading existing ones\n * from remote.\n * @param emitter - Emitter object that the created value type will use to emit operations\n * @param raw - Initialization parameters as defined by the value type\n * @returns The new value type\n * @alpha\n */\n load(emitter: IValueOpEmitter, raw: any): T;\n\n /**\n * Given a value type, provides a JSONable form of its data to be used for snapshotting. This data must be\n * loadable using the load method of its factory.\n * @param value - The value type to serialize\n * @returns The JSONable form of the value type\n * @alpha\n */\n store(value: T): any;\n}\n\n/**\n * Defines an operation that a value type is able to handle.\n * @alpha\n */\nexport interface IValueOperation<T> {\n /**\n * Performs the actual processing on the incoming operation.\n * @param value - The current value stored at the given key, which should be the value type\n * @param params - The params on the incoming operation\n * @param local - Whether the operation originated from this client\n * @param message - The operation itself\n * @alpha\n */\n process(value: T, params: any, local: boolean, message: ISequencedDocumentMessage | undefined);\n}\n\n/**\n * Defines a value type that can be registered on a container type.\n */\nexport interface IValueType<T> {\n /**\n * Name of the value type.\n * @alpha\n */\n name: string;\n\n /**\n * Factory method used to convert to/from a JSON form of the type.\n * @alpha\n */\n factory: IValueFactory<T>;\n\n /**\n * Operations that can be applied to the value type.\n * @alpha\n */\n ops: Map<string, IValueOperation<T>>;\n}\n\n/**\n * Container types that are able to create value types as contained values.\n */\nexport interface IValueTypeCreator {\n /**\n * Create a new value type at the given key.\n * @param key - Key to create the value type at\n * @param type - Type of the value type to create\n * @param params - Initialization params for the value type\n * @alpha\n */\n createValueType(key: string, type: string, params: any): this;\n}\n\nexport interface ISharedMapEvents extends ISharedObjectEvents {\n (event: \"valueChanged\" | \"create\", listener: (\n changed: IValueChanged,\n local: boolean,\n target: IEventThisPlaceHolder) => void);\n (event: \"clear\", listener: (\n local: boolean,\n target: IEventThisPlaceHolder\n ) => void);\n}\n\n/**\n * Shared map interface\n */\nexport interface ISharedMap extends ISharedObject<ISharedMapEvents>, Map<string, any> {\n /**\n * Retrieves the given key from the map.\n * @param key - Key to retrieve from\n * @returns The stored value, or undefined if the key is not set\n */\n get<T = any>(key: string): T | undefined;\n\n /**\n * A form of get except it will only resolve the promise once the key exists in the map.\n * @param key - Key to retrieve from\n * @returns The stored value once available\n */\n wait<T = any>(key: string): Promise<T>;\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 ISharedMap itself\n */\n set<T = any>(key: string, value: T): this;\n\n}\n\n/**\n * The _ready-for-serialization_ format of values contained in DDS contents. This allows us to use\n * ISerializableValue.type to understand whether they're storing a Plain JS object, a SharedObject, or a value type.\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 * 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 * 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. 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 value: any;\n}\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 value: string | undefined;\n}\n\n/**\n * ValueTypes handle ops slightly differently from SharedObjects or plain JS objects. Since the Map/Directory doesn't\n * know how to handle the ValueType's ops, those ops are instead passed along to the ValueType for processing.\n * IValueTypeOperationValue is that passed-along op. The opName on it is the ValueType-specific operation and the\n * value is whatever params the ValueType needs to complete that operation. Similar to ISerializableValue, it is\n * serializable via JSON.stringify/parse but differs in that it has no equivalency with an in-memory value - rather\n * it just describes an operation to be applied to an already-in-memory value.\n * @alpha\n */\nexport interface IValueTypeOperationValue {\n /**\n * The name of the operation.\n */\n opName: string;\n\n /**\n * The payload that is submitted along with the operation.\n */\n value: any;\n}\n"]}