@fluidframework/datastore 2.40.0-336023 → 2.41.0-337492

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 (62) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/api-report/datastore.legacy.alpha.api.md +5 -2
  3. package/dist/channelContext.d.ts +1 -1
  4. package/dist/channelContext.d.ts.map +1 -1
  5. package/dist/channelContext.js.map +1 -1
  6. package/dist/channelDeltaConnection.d.ts +1 -1
  7. package/dist/channelDeltaConnection.d.ts.map +1 -1
  8. package/dist/channelDeltaConnection.js +2 -2
  9. package/dist/channelDeltaConnection.js.map +1 -1
  10. package/dist/dataStoreRuntime.d.ts +4 -3
  11. package/dist/dataStoreRuntime.d.ts.map +1 -1
  12. package/dist/dataStoreRuntime.js +7 -3
  13. package/dist/dataStoreRuntime.js.map +1 -1
  14. package/dist/fluidHandle.d.ts +2 -1
  15. package/dist/fluidHandle.d.ts.map +1 -1
  16. package/dist/fluidHandle.js +2 -1
  17. package/dist/fluidHandle.js.map +1 -1
  18. package/dist/localChannelContext.d.ts +1 -1
  19. package/dist/localChannelContext.d.ts.map +1 -1
  20. package/dist/localChannelContext.js +2 -2
  21. package/dist/localChannelContext.js.map +1 -1
  22. package/dist/packageVersion.d.ts +1 -1
  23. package/dist/packageVersion.js +1 -1
  24. package/dist/packageVersion.js.map +1 -1
  25. package/dist/remoteChannelContext.d.ts +1 -1
  26. package/dist/remoteChannelContext.d.ts.map +1 -1
  27. package/dist/remoteChannelContext.js +2 -2
  28. package/dist/remoteChannelContext.js.map +1 -1
  29. package/lib/channelContext.d.ts +1 -1
  30. package/lib/channelContext.d.ts.map +1 -1
  31. package/lib/channelContext.js.map +1 -1
  32. package/lib/channelDeltaConnection.d.ts +1 -1
  33. package/lib/channelDeltaConnection.d.ts.map +1 -1
  34. package/lib/channelDeltaConnection.js +2 -2
  35. package/lib/channelDeltaConnection.js.map +1 -1
  36. package/lib/dataStoreRuntime.d.ts +4 -3
  37. package/lib/dataStoreRuntime.d.ts.map +1 -1
  38. package/lib/dataStoreRuntime.js +7 -3
  39. package/lib/dataStoreRuntime.js.map +1 -1
  40. package/lib/fluidHandle.d.ts +2 -1
  41. package/lib/fluidHandle.d.ts.map +1 -1
  42. package/lib/fluidHandle.js +2 -1
  43. package/lib/fluidHandle.js.map +1 -1
  44. package/lib/localChannelContext.d.ts +1 -1
  45. package/lib/localChannelContext.d.ts.map +1 -1
  46. package/lib/localChannelContext.js +2 -2
  47. package/lib/localChannelContext.js.map +1 -1
  48. package/lib/packageVersion.d.ts +1 -1
  49. package/lib/packageVersion.js +1 -1
  50. package/lib/packageVersion.js.map +1 -1
  51. package/lib/remoteChannelContext.d.ts +1 -1
  52. package/lib/remoteChannelContext.d.ts.map +1 -1
  53. package/lib/remoteChannelContext.js +2 -2
  54. package/lib/remoteChannelContext.js.map +1 -1
  55. package/package.json +19 -15
  56. package/src/channelContext.ts +1 -1
  57. package/src/channelDeltaConnection.ts +3 -5
  58. package/src/dataStoreRuntime.ts +17 -2
  59. package/src/fluidHandle.ts +2 -1
  60. package/src/localChannelContext.ts +2 -2
  61. package/src/packageVersion.ts +1 -1
  62. package/src/remoteChannelContext.ts +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"localChannelContext.js","sourceRoot":"","sources":["../src/localChannelContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAiBhF,OAAO,EAEN,mBAAmB,GACnB,MAAM,0CAA0C,CAAC;AAElD,OAAO,EAGN,6BAA6B,EAC7B,WAAW,EACX,+BAA+B,EAC/B,gBAAgB,EAChB,qBAAqB,GACrB,MAAM,qBAAqB,CAAC;AAG7B;;GAEG;AACH,MAAM,OAAgB,uBAAuB;IAO5C,YACoB,EAAU,EACV,OAA+B,EAC/B,QAAuC,EACzC,QAA2B,EACpC,QAAmB;QAJR,OAAE,GAAF,EA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ACnB,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QACrB,CAAC,CAAC;IACH,CAAC;IAEM,cAAc;QACpB,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;IACpD,CAAC;CACD;AAED;;;;;;;;GAQG;AACH,SAAS,iBAAiB,CAAC,IAAmB;IAC7C,MAAM,KAAK,GAAG,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,EAAE,GAAG,IAAI,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;IAC/D,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACjD,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC;IACvC,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ISnapshotTreeWithBlobContents } from \"@fluidframework/container-definitions/internal\";\nimport { assert, Lazy, LazyPromise } from \"@fluidframework/core-utils/internal\";\nimport {\n\tIChannel,\n\tIFluidDataStoreRuntime,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport {\n\tIDocumentStorageService,\n\tISnapshotTree,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tITelemetryContext,\n\tIFluidDataStoreContext,\n\tIGarbageCollectionData,\n\tISummarizeResult,\n\ttype IPendingMessagesState,\n\ttype IRuntimeMessageCollection,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport {\n\tITelemetryLoggerExt,\n\tDataProcessingError,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\tChannelServiceEndpoints,\n\tIChannelContext,\n\tcreateChannelServiceEndpoints,\n\tloadChannel,\n\tloadChannelFactoryAndAttributes,\n\tsummarizeChannel,\n\tsummarizeChannelAsync,\n} from \"./channelContext.js\";\nimport { ISharedObjectRegistry } from \"./dataStoreRuntime.js\";\n\n/**\n * Channel context for a locally created channel\n */\nexport abstract class LocalChannelContextBase implements IChannelContext {\n\tprivate globallyVisible = false;\n\t/** Tracks the messages for this channel that are sent while it's not loaded */\n\tprotected pendingMessagesState: IPendingMessagesState = {\n\t\tmessageCollections: [],\n\t\tpendingCount: 0,\n\t};\n\tconstructor(\n\t\tprotected readonly id: string,\n\t\tprotected readonly runtime: IFluidDataStoreRuntime,\n\t\tprotected readonly services: Lazy<ChannelServiceEndpoints>,\n\t\tprivate readonly channelP: Promise<IChannel>,\n\t\tprivate _channel?: IChannel,\n\t) {\n\t\tassert(!this.id.includes(\"/\"), 0x30f /* Channel context ID cannot contain slashes */);\n\t}\n\n\tprotected get isGloballyVisible() {\n\t\treturn this.globallyVisible;\n\t}\n\n\tpublic async getChannel(): Promise<IChannel> {\n\t\tif (this._channel === undefined) {\n\t\t\treturn this.channelP.then((c) => (this._channel = c));\n\t\t}\n\t\treturn this.channelP;\n\t}\n\n\tpublic get isLoaded(): boolean {\n\t\treturn this._channel !== undefined;\n\t}\n\n\tpublic setConnectionState(connected: boolean, clientId?: string) {\n\t\t// Connection events are ignored if the data store is not yet globallyVisible or loaded\n\t\tif (this.globallyVisible && this.isLoaded) {\n\t\t\tthis.services.value.deltaConnection.setConnectionState(connected);\n\t\t}\n\t}\n\n\t/**\n\t * Process messages for this channel context. The messages here are contiguous messages for this context in a batch.\n\t * @param messageCollection - The collection of messages to process.\n\t */\n\tprocessMessages(messageCollection: IRuntimeMessageCollection): void {\n\t\tassert(\n\t\t\tthis.globallyVisible,\n\t\t\t0x2d3 /* \"Local channel must be globally visible when processing op\" */,\n\t\t);\n\n\t\t// A local channel may not be loaded in case where we rehydrate the container from a snapshot because of\n\t\t// delay loading. So after the container is attached and some other client joins which start generating\n\t\t// ops for this channel. So not loaded local channel can still receive ops and we store them to process later.\n\t\tif (this.isLoaded) {\n\t\t\tthis.services.value.deltaConnection.processMessages(messageCollection);\n\t\t} else {\n\t\t\tassert(\n\t\t\t\t!messageCollection.local,\n\t\t\t\t0x189 /* \"Should always be remote because a local dds shouldn't generate ops before loading\" */,\n\t\t\t);\n\t\t\tconst propsCopy = {\n\t\t\t\t...messageCollection,\n\t\t\t\tmessagesContent: Array.from(messageCollection.messagesContent),\n\t\t\t};\n\t\t\tthis.pendingMessagesState.messageCollections.push(propsCopy);\n\t\t}\n\t}\n\n\tpublic reSubmit(content: any, localOpMetadata: unknown) {\n\t\tassert(this.isLoaded, 0x18a /* \"Channel should be loaded to resubmit ops\" */);\n\t\tassert(\n\t\t\tthis.globallyVisible,\n\t\t\t0x2d4 /* \"Local channel must be globally visible when resubmitting op\" */,\n\t\t);\n\t\tthis.services.value.deltaConnection.reSubmit(content, localOpMetadata);\n\t}\n\tpublic rollback(content: any, localOpMetadata: unknown) {\n\t\tassert(this.isLoaded, 0x2ee /* \"Channel should be loaded to rollback ops\" */);\n\t\tassert(\n\t\t\tthis.globallyVisible,\n\t\t\t0x2ef /* \"Local channel must be globally visible when rolling back op\" */,\n\t\t);\n\t\tthis.services.value.deltaConnection.rollback(content, localOpMetadata);\n\t}\n\n\tpublic abstract applyStashedOp(content: unknown): unknown;\n\n\t/**\n\t * Returns a summary at the current sequence number.\n\t * @param fullTree - true to bypass optimizations and force a full summary tree\n\t * @param trackState - This tells whether we should track state from this summary.\n\t * @param telemetryContext - summary data passed through the layers for telemetry purposes\n\t */\n\tpublic async summarize(\n\t\tfullTree: boolean = false,\n\t\ttrackState: boolean = false,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<ISummarizeResult> {\n\t\tconst channel = await this.getChannel();\n\t\treturn summarizeChannelAsync(channel, fullTree, trackState, telemetryContext);\n\t}\n\n\t/**\n\t * For crafting the DataStore attach op. Only to be called when the channel is loaded (if applicable).\n\t *\n\t * Synchronously generates the channel's attach summary to be joined with the same from the DataStore's other channels\n\t */\n\tpublic getAttachSummary(telemetryContext?: ITelemetryContext): ISummarizeResult {\n\t\tassert(\n\t\t\tthis._channel !== undefined,\n\t\t\t0x18d /* \"Channel should be loaded to take snapshot\" */,\n\t\t);\n\t\treturn summarizeChannel(\n\t\t\tthis._channel,\n\t\t\ttrue /* fullTree */,\n\t\t\tfalse /* trackState */,\n\t\t\ttelemetryContext,\n\t\t);\n\t}\n\n\t/**\n\t * For crafting the DataStore attach op. Only to be called when the channel is loaded (if applicable).\n\t *\n\t * Synchronously generates the channel's attach GC data (set of outbound routes in the initial state)\n\t * to be joined with the same from the DataStore's other channels\n\t */\n\tpublic getAttachGCData(telemetryContext?: ITelemetryContext): IGarbageCollectionData {\n\t\tassert(\n\t\t\tthis._channel !== undefined,\n\t\t\t0x8fd /* Local Channel should be loaded before being attached */,\n\t\t);\n\n\t\t// We need the GC Data to detect references added in this attach op\n\t\treturn this._channel.getGCData(/* fullGC: */ true);\n\t}\n\n\tpublic makeVisible(): void {\n\t\tif (this.globallyVisible) {\n\t\t\tthrow new Error(\"Channel is already globally visible\");\n\t\t}\n\n\t\tif (this.isLoaded) {\n\t\t\tassert(!!this._channel, 0x192 /* \"Channel should be there if loaded!!\" */);\n\t\t\tthis._channel.connect(this.services.value);\n\t\t}\n\t\tthis.globallyVisible = true;\n\t}\n\n\t/**\n\t * Returns the data used for garbage collection. This includes a list of GC nodes that represent this context.\n\t * Each node has a set of outbound routes to other GC nodes in the document. This should be called only after\n\t * the context has loaded.\n\t * @param fullGC - true to bypass optimizations and force full generation of GC data.\n\t */\n\tpublic async getGCData(fullGC: boolean = false): Promise<IGarbageCollectionData> {\n\t\tconst channel = await this.getChannel();\n\t\treturn channel.getGCData(fullGC);\n\t}\n\n\tpublic updateUsedRoutes(usedRoutes: string[]) {\n\t\t/**\n\t\t * Currently, DDSes are always considered referenced and are not garbage collected.\n\t\t * Once we have GC at DDS level, this channel context's used routes will be updated as per the passed\n\t\t * value. See - https://github.com/microsoft/FluidFramework/issues/4611\n\t\t */\n\t}\n}\n\nexport class RehydratedLocalChannelContext extends LocalChannelContextBase {\n\tprivate readonly dirtyFn: () => void;\n\tconstructor(\n\t\tid: string,\n\t\tregistry: ISharedObjectRegistry,\n\t\truntime: IFluidDataStoreRuntime,\n\t\tdataStoreContext: IFluidDataStoreContext,\n\t\tstorageService: IDocumentStorageService,\n\t\tlogger: ITelemetryLoggerExt,\n\t\tsubmitFn: (content: any, localOpMetadata: unknown) => void,\n\t\tdirtyFn: (address: string) => void,\n\t\tprivate readonly snapshotTree: ISnapshotTree,\n\t\textraBlob?: Map<string, ArrayBufferLike>,\n\t) {\n\t\tsuper(\n\t\t\tid,\n\t\t\truntime,\n\t\t\tnew Lazy(() => {\n\t\t\t\tconst blobMap: Map<string, ArrayBufferLike> = new Map<string, ArrayBufferLike>(\n\t\t\t\t\textraBlob,\n\t\t\t\t);\n\t\t\t\tconst clonedSnapshotTree = cloneSnapshotTree(this.snapshotTree);\n\t\t\t\t// 0.47 back-compat Need to sanitize if snapshotTree.blobs still contains blob contents too.\n\t\t\t\t// This is for older snapshot which is generated by loader <=0.47 version which still contains\n\t\t\t\t// the contents within blobs. After a couple of revisions we can remove it.\n\t\t\t\tif (this.isSnapshotInOldFormatAndCollectBlobs(clonedSnapshotTree, blobMap)) {\n\t\t\t\t\tthis.sanitizeSnapshot(clonedSnapshotTree);\n\t\t\t\t}\n\t\t\t\treturn createChannelServiceEndpoints(\n\t\t\t\t\tdataStoreContext.connected,\n\t\t\t\t\tsubmitFn,\n\t\t\t\t\tthis.dirtyFn,\n\t\t\t\t\t() => this.isGloballyVisible,\n\t\t\t\t\tstorageService,\n\t\t\t\t\tlogger,\n\t\t\t\t\tclonedSnapshotTree,\n\t\t\t\t\tblobMap,\n\t\t\t\t);\n\t\t\t}),\n\t\t\tnew LazyPromise<IChannel>(async () => {\n\t\t\t\ttry {\n\t\t\t\t\tconst { attributes, factory } = await loadChannelFactoryAndAttributes(\n\t\t\t\t\t\tdataStoreContext,\n\t\t\t\t\t\tthis.services.value,\n\t\t\t\t\t\tthis.id,\n\t\t\t\t\t\tregistry,\n\t\t\t\t\t);\n\t\t\t\t\tconst channel = await loadChannel(\n\t\t\t\t\t\truntime,\n\t\t\t\t\t\tattributes,\n\t\t\t\t\t\tfactory,\n\t\t\t\t\t\tthis.services.value,\n\t\t\t\t\t\tlogger,\n\t\t\t\t\t\tthis.id,\n\t\t\t\t\t);\n\t\t\t\t\t// Send all pending messages to the channel\n\t\t\t\t\tfor (const messageCollection of this.pendingMessagesState.messageCollections) {\n\t\t\t\t\t\tthis.services.value.deltaConnection.processMessages(messageCollection);\n\t\t\t\t\t}\n\t\t\t\t\treturn channel;\n\t\t\t\t} catch (err) {\n\t\t\t\t\tthrow DataProcessingError.wrapIfUnrecognized(\n\t\t\t\t\t\terr,\n\t\t\t\t\t\t\"rehydratedLocalChannelContextFailedToLoadChannel\",\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}),\n\t\t);\n\n\t\tthis.dirtyFn = () => {\n\t\t\tdirtyFn(id);\n\t\t};\n\t}\n\n\tpublic override applyStashedOp(content) {\n\t\treturn this.services.value.deltaConnection.applyStashedOp(content);\n\t}\n\n\tprivate isSnapshotInOldFormatAndCollectBlobs(\n\t\tsnapshotTree: ISnapshotTreeWithBlobContents,\n\t\tblobMap: Map<string, ArrayBufferLike>,\n\t): boolean {\n\t\tlet sanitize = false;\n\t\tconst blobsContents = snapshotTree.blobsContents;\n\t\tif (blobsContents !== undefined) {\n\t\t\tObject.entries(blobsContents).forEach(([key, value]) => {\n\t\t\t\tblobMap.set(key, value);\n\t\t\t\tif (snapshotTree.blobs[key] !== undefined) {\n\t\t\t\t\tsanitize = true;\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\tfor (const value of Object.values(snapshotTree.trees)) {\n\t\t\tsanitize = sanitize || this.isSnapshotInOldFormatAndCollectBlobs(value, blobMap);\n\t\t}\n\t\treturn sanitize;\n\t}\n\n\tprivate sanitizeSnapshot(snapshotTree: ISnapshotTree) {\n\t\tconst blobMapInitial = new Map(Object.entries(snapshotTree.blobs));\n\t\tfor (const [blobName, blobId] of blobMapInitial.entries()) {\n\t\t\tconst blobValue = blobMapInitial.get(blobId);\n\t\t\tif (blobValue === undefined) {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n\t\t\t\tdelete snapshotTree.blobs[blobName];\n\t\t\t}\n\t\t}\n\t\tfor (const value of Object.values(snapshotTree.trees)) {\n\t\t\tthis.sanitizeSnapshot(value);\n\t\t}\n\t}\n}\n\nexport class LocalChannelContext extends LocalChannelContextBase {\n\tprivate readonly dirtyFn: () => void;\n\tconstructor(\n\t\tpublic readonly channel: IChannel,\n\t\truntime: IFluidDataStoreRuntime,\n\t\tdataStoreContext: IFluidDataStoreContext,\n\t\tstorageService: IDocumentStorageService,\n\t\tlogger: ITelemetryLoggerExt,\n\t\tsubmitFn: (content: any, localOpMetadata: unknown) => void,\n\t\tdirtyFn: (address: string) => void,\n\t) {\n\t\tsuper(\n\t\t\tchannel.id,\n\t\t\truntime,\n\t\t\tnew Lazy(() => {\n\t\t\t\treturn createChannelServiceEndpoints(\n\t\t\t\t\tdataStoreContext.connected,\n\t\t\t\t\tsubmitFn,\n\t\t\t\t\tthis.dirtyFn,\n\t\t\t\t\t() => this.isGloballyVisible,\n\t\t\t\t\tstorageService,\n\t\t\t\t\tlogger,\n\t\t\t\t);\n\t\t\t}),\n\t\t\tPromise.resolve(channel),\n\t\t\tchannel,\n\t\t);\n\t\tthis.channel = channel;\n\n\t\tthis.dirtyFn = () => {\n\t\t\tdirtyFn(channel.id);\n\t\t};\n\t}\n\n\tpublic applyStashedOp() {\n\t\tthrow new Error(\"no stashed ops on local channel\");\n\t}\n}\n\n/**\n * Deep clones a snapshot tree.\n *\n * TODO: Investigate replacing this with a deep clone utility.\n * This is a temporary solution to avoid issues with lodash deepClone and ungap structuredClone.\n * Using lodash caused a significant bundle size regression. structuredClone cannot be used since\n * it does not support ArrayBuffer data types, and ISnapshotTree can contain blobContents properties,\n * which are ArrayBuffer data types.\n */\nfunction cloneSnapshotTree(tree: ISnapshotTree): ISnapshotTree {\n\tconst clone = { ...tree, blobs: { ...tree.blobs }, trees: {} };\n\tfor (const [k, v] of Object.entries(tree.trees)) {\n\t\tclone.trees[k] = cloneSnapshotTree(v);\n\t}\n\treturn clone;\n}\n"]}
1
+ {"version":3,"file":"localChannelContext.js","sourceRoot":"","sources":["../src/localChannelContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAiBhF,OAAO,EAEN,mBAAmB,GACnB,MAAM,0CAA0C,CAAC;AAElD,OAAO,EAGN,6BAA6B,EAC7B,WAAW,EACX,+BAA+B,EAC/B,gBAAgB,EAChB,qBAAqB,GACrB,MAAM,qBAAqB,CAAC;AAG7B;;GAEG;AACH,MAAM,OAAgB,uBAAuB;IAO5C,YACoB,EAAU,EACV,OAA+B,EAC/B,QAAuC,EACzC,QAA2B,EACpC,QAAmB;QAJR,OAAE,GAAF,EAAE,CAAQ;QACV,YAAO,GAAP,OAAO,CAAwB;QAC/B,aAAQ,GAAR,QAAQ,CAA+B;QACzC,aAAQ,GAAR,QAAQ,CAAmB;QACpC,aAAQ,GAAR,QAAQ,CAAW;QAXpB,oBAAe,GAAG,KAAK,CAAC;QAChC,+EAA+E;QACrE,yBAAoB,GAA0B;YACvD,kBAAkB,EAAE,EAAE;YACtB,YAAY,EAAE,CAAC;SACf,CAAC;QAQD,MAAM,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,+CAA+C,CAAC,CAAC;IACvF,CAAC;IAED,IAAc,iBAAiB;QAC9B,OAAO,IAAI,CAAC,eAAe,CAAC;IAC7B,CAAC;IAEM,KAAK,CAAC,UAAU;QACtB,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;YACjC,OA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,CAAC;IACvC,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ISnapshotTreeWithBlobContents } from \"@fluidframework/container-definitions/internal\";\nimport { assert, Lazy, LazyPromise } from \"@fluidframework/core-utils/internal\";\nimport {\n\tIChannel,\n\tIFluidDataStoreRuntime,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport {\n\tIDocumentStorageService,\n\tISnapshotTree,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tITelemetryContext,\n\tIFluidDataStoreContext,\n\tIGarbageCollectionData,\n\tISummarizeResult,\n\ttype IPendingMessagesState,\n\ttype IRuntimeMessageCollection,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport {\n\tITelemetryLoggerExt,\n\tDataProcessingError,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\tChannelServiceEndpoints,\n\tIChannelContext,\n\tcreateChannelServiceEndpoints,\n\tloadChannel,\n\tloadChannelFactoryAndAttributes,\n\tsummarizeChannel,\n\tsummarizeChannelAsync,\n} from \"./channelContext.js\";\nimport { ISharedObjectRegistry } from \"./dataStoreRuntime.js\";\n\n/**\n * Channel context for a locally created channel\n */\nexport abstract class LocalChannelContextBase implements IChannelContext {\n\tprivate globallyVisible = false;\n\t/** Tracks the messages for this channel that are sent while it's not loaded */\n\tprotected pendingMessagesState: IPendingMessagesState = {\n\t\tmessageCollections: [],\n\t\tpendingCount: 0,\n\t};\n\tconstructor(\n\t\tprotected readonly id: string,\n\t\tprotected readonly runtime: IFluidDataStoreRuntime,\n\t\tprotected readonly services: Lazy<ChannelServiceEndpoints>,\n\t\tprivate readonly channelP: Promise<IChannel>,\n\t\tprivate _channel?: IChannel,\n\t) {\n\t\tassert(!this.id.includes(\"/\"), 0x30f /* Channel context ID cannot contain slashes */);\n\t}\n\n\tprotected get isGloballyVisible() {\n\t\treturn this.globallyVisible;\n\t}\n\n\tpublic async getChannel(): Promise<IChannel> {\n\t\tif (this._channel === undefined) {\n\t\t\treturn this.channelP.then((c) => (this._channel = c));\n\t\t}\n\t\treturn this.channelP;\n\t}\n\n\tpublic get isLoaded(): boolean {\n\t\treturn this._channel !== undefined;\n\t}\n\n\tpublic setConnectionState(connected: boolean, clientId?: string) {\n\t\t// Connection events are ignored if the data store is not yet globallyVisible or loaded\n\t\tif (this.globallyVisible && this.isLoaded) {\n\t\t\tthis.services.value.deltaConnection.setConnectionState(connected);\n\t\t}\n\t}\n\n\t/**\n\t * Process messages for this channel context. The messages here are contiguous messages for this context in a batch.\n\t * @param messageCollection - The collection of messages to process.\n\t */\n\tprocessMessages(messageCollection: IRuntimeMessageCollection): void {\n\t\tassert(\n\t\t\tthis.globallyVisible,\n\t\t\t0x2d3 /* \"Local channel must be globally visible when processing op\" */,\n\t\t);\n\n\t\t// A local channel may not be loaded in case where we rehydrate the container from a snapshot because of\n\t\t// delay loading. So after the container is attached and some other client joins which start generating\n\t\t// ops for this channel. So not loaded local channel can still receive ops and we store them to process later.\n\t\tif (this.isLoaded) {\n\t\t\tthis.services.value.deltaConnection.processMessages(messageCollection);\n\t\t} else {\n\t\t\tassert(\n\t\t\t\t!messageCollection.local,\n\t\t\t\t0x189 /* \"Should always be remote because a local dds shouldn't generate ops before loading\" */,\n\t\t\t);\n\t\t\tconst propsCopy = {\n\t\t\t\t...messageCollection,\n\t\t\t\tmessagesContent: Array.from(messageCollection.messagesContent),\n\t\t\t};\n\t\t\tthis.pendingMessagesState.messageCollections.push(propsCopy);\n\t\t}\n\t}\n\n\tpublic reSubmit(content: any, localOpMetadata: unknown, squash: boolean) {\n\t\tassert(this.isLoaded, 0x18a /* \"Channel should be loaded to resubmit ops\" */);\n\t\tassert(\n\t\t\tthis.globallyVisible,\n\t\t\t0x2d4 /* \"Local channel must be globally visible when resubmitting op\" */,\n\t\t);\n\t\tthis.services.value.deltaConnection.reSubmit(content, localOpMetadata, squash);\n\t}\n\tpublic rollback(content: any, localOpMetadata: unknown) {\n\t\tassert(this.isLoaded, 0x2ee /* \"Channel should be loaded to rollback ops\" */);\n\t\tassert(\n\t\t\tthis.globallyVisible,\n\t\t\t0x2ef /* \"Local channel must be globally visible when rolling back op\" */,\n\t\t);\n\t\tthis.services.value.deltaConnection.rollback(content, localOpMetadata);\n\t}\n\n\tpublic abstract applyStashedOp(content: unknown): unknown;\n\n\t/**\n\t * Returns a summary at the current sequence number.\n\t * @param fullTree - true to bypass optimizations and force a full summary tree\n\t * @param trackState - This tells whether we should track state from this summary.\n\t * @param telemetryContext - summary data passed through the layers for telemetry purposes\n\t */\n\tpublic async summarize(\n\t\tfullTree: boolean = false,\n\t\ttrackState: boolean = false,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<ISummarizeResult> {\n\t\tconst channel = await this.getChannel();\n\t\treturn summarizeChannelAsync(channel, fullTree, trackState, telemetryContext);\n\t}\n\n\t/**\n\t * For crafting the DataStore attach op. Only to be called when the channel is loaded (if applicable).\n\t *\n\t * Synchronously generates the channel's attach summary to be joined with the same from the DataStore's other channels\n\t */\n\tpublic getAttachSummary(telemetryContext?: ITelemetryContext): ISummarizeResult {\n\t\tassert(\n\t\t\tthis._channel !== undefined,\n\t\t\t0x18d /* \"Channel should be loaded to take snapshot\" */,\n\t\t);\n\t\treturn summarizeChannel(\n\t\t\tthis._channel,\n\t\t\ttrue /* fullTree */,\n\t\t\tfalse /* trackState */,\n\t\t\ttelemetryContext,\n\t\t);\n\t}\n\n\t/**\n\t * For crafting the DataStore attach op. Only to be called when the channel is loaded (if applicable).\n\t *\n\t * Synchronously generates the channel's attach GC data (set of outbound routes in the initial state)\n\t * to be joined with the same from the DataStore's other channels\n\t */\n\tpublic getAttachGCData(telemetryContext?: ITelemetryContext): IGarbageCollectionData {\n\t\tassert(\n\t\t\tthis._channel !== undefined,\n\t\t\t0x8fd /* Local Channel should be loaded before being attached */,\n\t\t);\n\n\t\t// We need the GC Data to detect references added in this attach op\n\t\treturn this._channel.getGCData(/* fullGC: */ true);\n\t}\n\n\tpublic makeVisible(): void {\n\t\tif (this.globallyVisible) {\n\t\t\tthrow new Error(\"Channel is already globally visible\");\n\t\t}\n\n\t\tif (this.isLoaded) {\n\t\t\tassert(!!this._channel, 0x192 /* \"Channel should be there if loaded!!\" */);\n\t\t\tthis._channel.connect(this.services.value);\n\t\t}\n\t\tthis.globallyVisible = true;\n\t}\n\n\t/**\n\t * Returns the data used for garbage collection. This includes a list of GC nodes that represent this context.\n\t * Each node has a set of outbound routes to other GC nodes in the document. This should be called only after\n\t * the context has loaded.\n\t * @param fullGC - true to bypass optimizations and force full generation of GC data.\n\t */\n\tpublic async getGCData(fullGC: boolean = false): Promise<IGarbageCollectionData> {\n\t\tconst channel = await this.getChannel();\n\t\treturn channel.getGCData(fullGC);\n\t}\n\n\tpublic updateUsedRoutes(usedRoutes: string[]) {\n\t\t/**\n\t\t * Currently, DDSes are always considered referenced and are not garbage collected.\n\t\t * Once we have GC at DDS level, this channel context's used routes will be updated as per the passed\n\t\t * value. See - https://github.com/microsoft/FluidFramework/issues/4611\n\t\t */\n\t}\n}\n\nexport class RehydratedLocalChannelContext extends LocalChannelContextBase {\n\tprivate readonly dirtyFn: () => void;\n\tconstructor(\n\t\tid: string,\n\t\tregistry: ISharedObjectRegistry,\n\t\truntime: IFluidDataStoreRuntime,\n\t\tdataStoreContext: IFluidDataStoreContext,\n\t\tstorageService: IDocumentStorageService,\n\t\tlogger: ITelemetryLoggerExt,\n\t\tsubmitFn: (content: any, localOpMetadata: unknown) => void,\n\t\tdirtyFn: (address: string) => void,\n\t\tprivate readonly snapshotTree: ISnapshotTree,\n\t\textraBlob?: Map<string, ArrayBufferLike>,\n\t) {\n\t\tsuper(\n\t\t\tid,\n\t\t\truntime,\n\t\t\tnew Lazy(() => {\n\t\t\t\tconst blobMap: Map<string, ArrayBufferLike> = new Map<string, ArrayBufferLike>(\n\t\t\t\t\textraBlob,\n\t\t\t\t);\n\t\t\t\tconst clonedSnapshotTree = cloneSnapshotTree(this.snapshotTree);\n\t\t\t\t// 0.47 back-compat Need to sanitize if snapshotTree.blobs still contains blob contents too.\n\t\t\t\t// This is for older snapshot which is generated by loader <=0.47 version which still contains\n\t\t\t\t// the contents within blobs. After a couple of revisions we can remove it.\n\t\t\t\tif (this.isSnapshotInOldFormatAndCollectBlobs(clonedSnapshotTree, blobMap)) {\n\t\t\t\t\tthis.sanitizeSnapshot(clonedSnapshotTree);\n\t\t\t\t}\n\t\t\t\treturn createChannelServiceEndpoints(\n\t\t\t\t\tdataStoreContext.connected,\n\t\t\t\t\tsubmitFn,\n\t\t\t\t\tthis.dirtyFn,\n\t\t\t\t\t() => this.isGloballyVisible,\n\t\t\t\t\tstorageService,\n\t\t\t\t\tlogger,\n\t\t\t\t\tclonedSnapshotTree,\n\t\t\t\t\tblobMap,\n\t\t\t\t);\n\t\t\t}),\n\t\t\tnew LazyPromise<IChannel>(async () => {\n\t\t\t\ttry {\n\t\t\t\t\tconst { attributes, factory } = await loadChannelFactoryAndAttributes(\n\t\t\t\t\t\tdataStoreContext,\n\t\t\t\t\t\tthis.services.value,\n\t\t\t\t\t\tthis.id,\n\t\t\t\t\t\tregistry,\n\t\t\t\t\t);\n\t\t\t\t\tconst channel = await loadChannel(\n\t\t\t\t\t\truntime,\n\t\t\t\t\t\tattributes,\n\t\t\t\t\t\tfactory,\n\t\t\t\t\t\tthis.services.value,\n\t\t\t\t\t\tlogger,\n\t\t\t\t\t\tthis.id,\n\t\t\t\t\t);\n\t\t\t\t\t// Send all pending messages to the channel\n\t\t\t\t\tfor (const messageCollection of this.pendingMessagesState.messageCollections) {\n\t\t\t\t\t\tthis.services.value.deltaConnection.processMessages(messageCollection);\n\t\t\t\t\t}\n\t\t\t\t\treturn channel;\n\t\t\t\t} catch (err) {\n\t\t\t\t\tthrow DataProcessingError.wrapIfUnrecognized(\n\t\t\t\t\t\terr,\n\t\t\t\t\t\t\"rehydratedLocalChannelContextFailedToLoadChannel\",\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}),\n\t\t);\n\n\t\tthis.dirtyFn = () => {\n\t\t\tdirtyFn(id);\n\t\t};\n\t}\n\n\tpublic override applyStashedOp(content) {\n\t\treturn this.services.value.deltaConnection.applyStashedOp(content);\n\t}\n\n\tprivate isSnapshotInOldFormatAndCollectBlobs(\n\t\tsnapshotTree: ISnapshotTreeWithBlobContents,\n\t\tblobMap: Map<string, ArrayBufferLike>,\n\t): boolean {\n\t\tlet sanitize = false;\n\t\tconst blobsContents = snapshotTree.blobsContents;\n\t\tif (blobsContents !== undefined) {\n\t\t\tObject.entries(blobsContents).forEach(([key, value]) => {\n\t\t\t\tblobMap.set(key, value);\n\t\t\t\tif (snapshotTree.blobs[key] !== undefined) {\n\t\t\t\t\tsanitize = true;\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\tfor (const value of Object.values(snapshotTree.trees)) {\n\t\t\tsanitize = sanitize || this.isSnapshotInOldFormatAndCollectBlobs(value, blobMap);\n\t\t}\n\t\treturn sanitize;\n\t}\n\n\tprivate sanitizeSnapshot(snapshotTree: ISnapshotTree) {\n\t\tconst blobMapInitial = new Map(Object.entries(snapshotTree.blobs));\n\t\tfor (const [blobName, blobId] of blobMapInitial.entries()) {\n\t\t\tconst blobValue = blobMapInitial.get(blobId);\n\t\t\tif (blobValue === undefined) {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n\t\t\t\tdelete snapshotTree.blobs[blobName];\n\t\t\t}\n\t\t}\n\t\tfor (const value of Object.values(snapshotTree.trees)) {\n\t\t\tthis.sanitizeSnapshot(value);\n\t\t}\n\t}\n}\n\nexport class LocalChannelContext extends LocalChannelContextBase {\n\tprivate readonly dirtyFn: () => void;\n\tconstructor(\n\t\tpublic readonly channel: IChannel,\n\t\truntime: IFluidDataStoreRuntime,\n\t\tdataStoreContext: IFluidDataStoreContext,\n\t\tstorageService: IDocumentStorageService,\n\t\tlogger: ITelemetryLoggerExt,\n\t\tsubmitFn: (content: any, localOpMetadata: unknown) => void,\n\t\tdirtyFn: (address: string) => void,\n\t) {\n\t\tsuper(\n\t\t\tchannel.id,\n\t\t\truntime,\n\t\t\tnew Lazy(() => {\n\t\t\t\treturn createChannelServiceEndpoints(\n\t\t\t\t\tdataStoreContext.connected,\n\t\t\t\t\tsubmitFn,\n\t\t\t\t\tthis.dirtyFn,\n\t\t\t\t\t() => this.isGloballyVisible,\n\t\t\t\t\tstorageService,\n\t\t\t\t\tlogger,\n\t\t\t\t);\n\t\t\t}),\n\t\t\tPromise.resolve(channel),\n\t\t\tchannel,\n\t\t);\n\t\tthis.channel = channel;\n\n\t\tthis.dirtyFn = () => {\n\t\t\tdirtyFn(channel.id);\n\t\t};\n\t}\n\n\tpublic applyStashedOp() {\n\t\tthrow new Error(\"no stashed ops on local channel\");\n\t}\n}\n\n/**\n * Deep clones a snapshot tree.\n *\n * TODO: Investigate replacing this with a deep clone utility.\n * This is a temporary solution to avoid issues with lodash deepClone and ungap structuredClone.\n * Using lodash caused a significant bundle size regression. structuredClone cannot be used since\n * it does not support ArrayBuffer data types, and ISnapshotTree can contain blobContents properties,\n * which are ArrayBuffer data types.\n */\nfunction cloneSnapshotTree(tree: ISnapshotTree): ISnapshotTree {\n\tconst clone = { ...tree, blobs: { ...tree.blobs }, trees: {} };\n\tfor (const [k, v] of Object.entries(tree.trees)) {\n\t\tclone.trees[k] = cloneSnapshotTree(v);\n\t}\n\treturn clone;\n}\n"]}
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export declare const pkgName = "@fluidframework/datastore";
8
- export declare const pkgVersion = "2.40.0-336023";
8
+ export declare const pkgVersion = "2.41.0-337492";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export const pkgName = "@fluidframework/datastore";
8
- export const pkgVersion = "2.40.0-336023";
8
+ export const pkgVersion = "2.41.0-337492";
9
9
  //# sourceMappingURL=packageVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,2BAA2B,CAAC;AACnD,MAAM,CAAC,MAAM,UAAU,GAAG,eAAe,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/datastore\";\nexport const pkgVersion = \"2.40.0-336023\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,2BAA2B,CAAC;AACnD,MAAM,CAAC,MAAM,UAAU,GAAG,eAAe,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/datastore\";\nexport const pkgVersion = \"2.41.0-337492\";\n"]}
@@ -28,7 +28,7 @@ export declare class RemoteChannelContext implements IChannelContext {
28
28
  * @param messageCollection - The collection of messages to process.
29
29
  */
30
30
  processMessages(messageCollection: IRuntimeMessageCollection): void;
31
- reSubmit(content: any, localOpMetadata: unknown): void;
31
+ reSubmit(content: any, localOpMetadata: unknown, squash: boolean): void;
32
32
  rollback(content: any, localOpMetadata: unknown): void;
33
33
  /**
34
34
  * Returns a summary at the current sequence number.
@@ -1 +1 @@
1
- {"version":3,"file":"remoteChannelContext.d.ts","sourceRoot":"","sources":["../src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E,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,OAAO;IAMtD;;;;;OAKG;IACU,SAAS,CACrB,QAAQ,GAAE,OAAe,EACzB,UAAU,GAAE,OAAc,EAC1B,gBAAgB,CAAC,EAAE,iBAAiB,GAClC,OAAO,CAAC,gBAAgB,CAAC;YAId,iBAAiB;IAiB/B;;;;;;OAMG;IACU,SAAS,CAAC,MAAM,GAAE,OAAe,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAIhF;;;;OAIG;YACW,iBAAiB;IAKxB,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE;CAS5C"}
@@ -78,9 +78,9 @@ export class RemoteChannelContext {
78
78
  this.thresholdOpsCounter.sendIfMultiple("StorePendingOps", this.pendingMessagesState.pendingCount);
79
79
  }
80
80
  }
81
- reSubmit(content, localOpMetadata) {
81
+ reSubmit(content, localOpMetadata, squash) {
82
82
  assert(this.isLoaded, 0x196 /* "Remote channel must be loaded when resubmitting op" */);
83
- this.services.deltaConnection.reSubmit(content, localOpMetadata);
83
+ this.services.deltaConnection.reSubmit(content, localOpMetadata, squash);
84
84
  }
85
85
  rollback(content, localOpMetadata) {
86
86
  assert(this.isLoaded, 0x2f0 /* "Remote channel must be loaded when rolling back op" */);
@@ -1 +1 @@
1
- {"version":3,"file":"remoteChannelContext.js","sourceRoot":"","sources":["../src/remoteChannelContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAqB1E,OAAO,EAEN,gBAAgB,EAChB,iBAAiB,GACjB,MAAM,0CAA0C,CAAC;AAElD,OAAO,EAGN,6BAA6B,EAC7B,WAAW,EACX,+BAA+B,EAC/B,qBAAqB,GACrB,MAAM,qBAAqB,CAAC;AAG7B,MAAM,OAAO,oBAAoB;IAehC,YACC,OAA+B,EAC/B,gBAAwC,EAC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AAC;IAClC,CAAC;IAEM,gBAAgB,CAAC,UAAoB;QAC3C;;;;;WAKG;QACH,IAAI,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC5C,CAAC;;AAzNuB,6CAAwB,GAAG,IAAI,AAAP,CAAQ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport { assert, LazyPromise } from \"@fluidframework/core-utils/internal\";\nimport {\n\tIChannel,\n\tIFluidDataStoreRuntime,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport {\n\tIDocumentStorageService,\n\tISnapshotTree,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tIExperimentalIncrementalSummaryContext,\n\tITelemetryContext,\n\tIGarbageCollectionData,\n\tCreateChildSummarizerNodeFn,\n\tIFluidDataStoreContext,\n\tISummarizeInternalResult,\n\tISummarizeResult,\n\tISummarizerNodeWithGC,\n\ttype IPendingMessagesState,\n\ttype IRuntimeMessageCollection,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport {\n\tITelemetryLoggerExt,\n\tThresholdCounter,\n\tcreateChildLogger,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\tChannelServiceEndpoints,\n\tIChannelContext,\n\tcreateChannelServiceEndpoints,\n\tloadChannel,\n\tloadChannelFactoryAndAttributes,\n\tsummarizeChannelAsync,\n} from \"./channelContext.js\";\nimport { ISharedObjectRegistry } from \"./dataStoreRuntime.js\";\n\nexport class RemoteChannelContext implements IChannelContext {\n\tprivate isLoaded = false;\n\t/** Tracks the messages for this channel that are sent while it's not loaded */\n\tprivate pendingMessagesState: IPendingMessagesState | undefined = {\n\t\tmessageCollections: [],\n\t\tpendingCount: 0,\n\t};\n\tprivate readonly channelP: Promise<IChannel>;\n\tprivate channel: IChannel | undefined;\n\tprivate readonly services: ChannelServiceEndpoints;\n\tprivate readonly summarizerNode: ISummarizerNodeWithGC;\n\tprivate readonly subLogger: ITelemetryLoggerExt;\n\tprivate readonly thresholdOpsCounter: ThresholdCounter;\n\tprivate static readonly pendingOpsCountThreshold = 1000;\n\n\tconstructor(\n\t\truntime: IFluidDataStoreRuntime,\n\t\tdataStoreContext: IFluidDataStoreContext,\n\t\tstorageService: IDocumentStorageService,\n\t\tsubmitFn: (content: any, localOpMetadata: unknown) => void,\n\t\tdirtyFn: (address: string) => void,\n\t\tprivate readonly id: string,\n\t\tbaseSnapshot: ISnapshotTree,\n\t\tregistry: ISharedObjectRegistry,\n\t\textraBlobs: Map<string, ArrayBufferLike> | undefined,\n\t\tcreateSummarizerNode: CreateChildSummarizerNodeFn,\n\t\tattachMessageType?: string,\n\t) {\n\t\tassert(!this.id.includes(\"/\"), 0x310 /* Channel context ID cannot contain slashes */);\n\n\t\tthis.subLogger = createChildLogger({\n\t\t\tlogger: runtime.logger,\n\t\t\tnamespace: \"RemoteChannelContext\",\n\t\t});\n\n\t\tthis.services = createChannelServiceEndpoints(\n\t\t\tdataStoreContext.connected,\n\t\t\tsubmitFn,\n\t\t\t() => dirtyFn(this.id),\n\t\t\t() => runtime.attachState !== AttachState.Detached,\n\t\t\tstorageService,\n\t\t\tthis.subLogger,\n\t\t\tbaseSnapshot,\n\t\t\textraBlobs,\n\t\t);\n\n\t\tthis.channelP = new LazyPromise<IChannel>(async () => {\n\t\t\tconst { attributes, factory } = await loadChannelFactoryAndAttributes(\n\t\t\t\tdataStoreContext,\n\t\t\t\tthis.services,\n\t\t\t\tthis.id,\n\t\t\t\tregistry,\n\t\t\t\tattachMessageType,\n\t\t\t);\n\n\t\t\tconst channel = await loadChannel(\n\t\t\t\truntime,\n\t\t\t\tattributes,\n\t\t\t\tfactory,\n\t\t\t\tthis.services,\n\t\t\t\tthis.subLogger,\n\t\t\t\tthis.id,\n\t\t\t);\n\n\t\t\tassert(\n\t\t\t\tthis.pendingMessagesState !== undefined,\n\t\t\t\t0xa6c /* pending messages state is undefined */,\n\t\t\t);\n\t\t\tfor (const messageCollection of this.pendingMessagesState.messageCollections) {\n\t\t\t\tthis.services.deltaConnection.processMessages(messageCollection);\n\t\t\t}\n\t\t\tthis.thresholdOpsCounter.send(\n\t\t\t\t\"ProcessPendingOps\",\n\t\t\t\tthis.pendingMessagesState.pendingCount,\n\t\t\t);\n\n\t\t\t// Commit changes.\n\t\t\tthis.channel = channel;\n\t\t\tthis.pendingMessagesState = undefined;\n\t\t\tthis.isLoaded = true;\n\n\t\t\t// Because have some await between we created the service and here, the connection state might have changed\n\t\t\t// and we don't propagate the connection state when we are not loaded. So we have to set it again here.\n\t\t\tthis.services.deltaConnection.setConnectionState(dataStoreContext.connected);\n\t\t\treturn this.channel;\n\t\t});\n\n\t\tconst thisSummarizeInternal = async (\n\t\t\tfullTree: boolean,\n\t\t\ttrackState: boolean,\n\t\t\ttelemetryContext?: ITelemetryContext,\n\t\t\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext,\n\t\t) =>\n\t\t\tthis.summarizeInternal(\n\t\t\t\tfullTree,\n\t\t\t\ttrackState,\n\t\t\t\ttelemetryContext,\n\t\t\t\tincrementalSummaryContext,\n\t\t\t);\n\n\t\tthis.summarizerNode = createSummarizerNode(\n\t\t\tthisSummarizeInternal,\n\t\t\tasync (fullGC?: boolean) => this.getGCDataInternal(fullGC),\n\t\t);\n\n\t\tthis.thresholdOpsCounter = new ThresholdCounter(\n\t\t\tRemoteChannelContext.pendingOpsCountThreshold,\n\t\t\tthis.subLogger,\n\t\t);\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/promise-function-async\n\tpublic getChannel(): Promise<IChannel> {\n\t\treturn this.channelP;\n\t}\n\n\tpublic setConnectionState(connected: boolean, clientId?: string) {\n\t\t// Connection events are ignored if the data store is not yet loaded\n\t\tif (!this.isLoaded) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.services.deltaConnection.setConnectionState(connected);\n\t}\n\n\tpublic applyStashedOp(content: any): unknown {\n\t\tassert(this.isLoaded, 0x194 /* \"Remote channel must be loaded when rebasing op\" */);\n\t\treturn this.services.deltaConnection.applyStashedOp(content);\n\t}\n\n\t/**\n\t * Process messages for this channel context. The messages here are contiguous messages for this context in a batch.\n\t * @param messageCollection - The collection of messages to process.\n\t */\n\tpublic processMessages(messageCollection: IRuntimeMessageCollection): void {\n\t\tconst { envelope, messagesContent, local } = messageCollection;\n\t\tthis.summarizerNode.invalidate(envelope.sequenceNumber);\n\n\t\tif (this.isLoaded) {\n\t\t\tthis.services.deltaConnection.processMessages(messageCollection);\n\t\t} else {\n\t\t\tassert(!local, 0x195 /* \"Remote channel must not be local when processing op\" */);\n\t\t\tassert(\n\t\t\t\tthis.pendingMessagesState !== undefined,\n\t\t\t\t0xa6d /* pending messages queue is undefined */,\n\t\t\t);\n\t\t\tthis.pendingMessagesState.messageCollections.push({\n\t\t\t\t...messageCollection,\n\t\t\t\tmessagesContent: Array.from(messagesContent),\n\t\t\t});\n\t\t\tthis.pendingMessagesState.pendingCount += messagesContent.length;\n\t\t\tthis.thresholdOpsCounter.sendIfMultiple(\n\t\t\t\t\"StorePendingOps\",\n\t\t\t\tthis.pendingMessagesState.pendingCount,\n\t\t\t);\n\t\t}\n\t}\n\n\tpublic reSubmit(content: any, localOpMetadata: unknown) {\n\t\tassert(this.isLoaded, 0x196 /* \"Remote channel must be loaded when resubmitting op\" */);\n\n\t\tthis.services.deltaConnection.reSubmit(content, localOpMetadata);\n\t}\n\n\tpublic rollback(content: any, localOpMetadata: unknown) {\n\t\tassert(this.isLoaded, 0x2f0 /* \"Remote channel must be loaded when rolling back op\" */);\n\n\t\tthis.services.deltaConnection.rollback(content, localOpMetadata);\n\t}\n\n\t/**\n\t * Returns a summary at the current sequence number.\n\t * @param fullTree - true to bypass optimizations and force a full summary tree\n\t * @param trackState - This tells whether we should track state from this summary.\n\t * @param telemetryContext - summary data passed through the layers for telemetry purposes\n\t */\n\tpublic async summarize(\n\t\tfullTree: boolean = false,\n\t\ttrackState: boolean = true,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<ISummarizeResult> {\n\t\treturn this.summarizerNode.summarize(fullTree, trackState, telemetryContext);\n\t}\n\n\tprivate async summarizeInternal(\n\t\tfullTree: boolean,\n\t\ttrackState: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext,\n\t): Promise<ISummarizeInternalResult> {\n\t\tconst channel = await this.getChannel();\n\t\tconst summarizeResult = await summarizeChannelAsync(\n\t\t\tchannel,\n\t\t\tfullTree,\n\t\t\ttrackState,\n\t\t\ttelemetryContext,\n\t\t\tincrementalSummaryContext,\n\t\t);\n\t\treturn { ...summarizeResult, id: this.id };\n\t}\n\n\t/**\n\t * Returns the data used for garbage collection. This includes a list of GC nodes that represent this context.\n\t * Each node has a set of outbound routes to other GC nodes in the document.\n\t * If there is no new data in this context since the last summary, previous GC data is used.\n\t * If there is new data, the GC data is generated again (by calling getGCDataInternal).\n\t * @param fullGC - true to bypass optimizations and force full generation of GC data.\n\t */\n\tpublic async getGCData(fullGC: boolean = false): Promise<IGarbageCollectionData> {\n\t\treturn this.summarizerNode.getGCData(fullGC);\n\t}\n\n\t/**\n\t * Generates the data used for garbage collection. This is called when there is new data since last summary. It\n\t * loads the context and calls into the channel to get its GC data.\n\t * @param fullGC - true to bypass optimizations and force full generation of GC data.\n\t */\n\tprivate async getGCDataInternal(fullGC: boolean = false): Promise<IGarbageCollectionData> {\n\t\tconst channel = await this.getChannel();\n\t\treturn channel.getGCData(fullGC);\n\t}\n\n\tpublic updateUsedRoutes(usedRoutes: string[]) {\n\t\t/**\n\t\t * Currently, DDSes are always considered referenced and are not garbage collected. Update the summarizer node's\n\t\t * used routes to contain a route to this channel context.\n\t\t * Once we have GC at DDS level, this will be updated to use the passed usedRoutes. See -\n\t\t * https://github.com/microsoft/FluidFramework/issues/4611\n\t\t */\n\t\tthis.summarizerNode.updateUsedRoutes([\"\"]);\n\t}\n}\n"]}
1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P,QAAQ,EACR,UAAU,EACV,gBAAgB,EAChB,yBAAyB,CACzB,CAAC;QACF,OAAO,EAAE,GAAG,eAAe,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC;IAC5C,CAAC;IAED;;;;;;OAMG;IACI,KAAK,CAAC,SAAS,CAAC,SAAkB,KAAK;QAC7C,OAAO,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAC9C,CAAC;IAED;;;;OAIG;IACK,KAAK,CAAC,iBAAiB,CAAC,SAAkB,KAAK;QACtD,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC;QACxC,OAAO,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;IAEM,gBAAgB,CAAC,UAAoB;QAC3C;;;;;WAKG;QACH,IAAI,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC5C,CAAC;;AAzNuB,6CAAwB,GAAG,IAAI,AAAP,CAAQ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport { assert, LazyPromise } from \"@fluidframework/core-utils/internal\";\nimport {\n\tIChannel,\n\tIFluidDataStoreRuntime,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport {\n\tIDocumentStorageService,\n\tISnapshotTree,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tIExperimentalIncrementalSummaryContext,\n\tITelemetryContext,\n\tIGarbageCollectionData,\n\tCreateChildSummarizerNodeFn,\n\tIFluidDataStoreContext,\n\tISummarizeInternalResult,\n\tISummarizeResult,\n\tISummarizerNodeWithGC,\n\ttype IPendingMessagesState,\n\ttype IRuntimeMessageCollection,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport {\n\tITelemetryLoggerExt,\n\tThresholdCounter,\n\tcreateChildLogger,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport {\n\tChannelServiceEndpoints,\n\tIChannelContext,\n\tcreateChannelServiceEndpoints,\n\tloadChannel,\n\tloadChannelFactoryAndAttributes,\n\tsummarizeChannelAsync,\n} from \"./channelContext.js\";\nimport { ISharedObjectRegistry } from \"./dataStoreRuntime.js\";\n\nexport class RemoteChannelContext implements IChannelContext {\n\tprivate isLoaded = false;\n\t/** Tracks the messages for this channel that are sent while it's not loaded */\n\tprivate pendingMessagesState: IPendingMessagesState | undefined = {\n\t\tmessageCollections: [],\n\t\tpendingCount: 0,\n\t};\n\tprivate readonly channelP: Promise<IChannel>;\n\tprivate channel: IChannel | undefined;\n\tprivate readonly services: ChannelServiceEndpoints;\n\tprivate readonly summarizerNode: ISummarizerNodeWithGC;\n\tprivate readonly subLogger: ITelemetryLoggerExt;\n\tprivate readonly thresholdOpsCounter: ThresholdCounter;\n\tprivate static readonly pendingOpsCountThreshold = 1000;\n\n\tconstructor(\n\t\truntime: IFluidDataStoreRuntime,\n\t\tdataStoreContext: IFluidDataStoreContext,\n\t\tstorageService: IDocumentStorageService,\n\t\tsubmitFn: (content: any, localOpMetadata: unknown) => void,\n\t\tdirtyFn: (address: string) => void,\n\t\tprivate readonly id: string,\n\t\tbaseSnapshot: ISnapshotTree,\n\t\tregistry: ISharedObjectRegistry,\n\t\textraBlobs: Map<string, ArrayBufferLike> | undefined,\n\t\tcreateSummarizerNode: CreateChildSummarizerNodeFn,\n\t\tattachMessageType?: string,\n\t) {\n\t\tassert(!this.id.includes(\"/\"), 0x310 /* Channel context ID cannot contain slashes */);\n\n\t\tthis.subLogger = createChildLogger({\n\t\t\tlogger: runtime.logger,\n\t\t\tnamespace: \"RemoteChannelContext\",\n\t\t});\n\n\t\tthis.services = createChannelServiceEndpoints(\n\t\t\tdataStoreContext.connected,\n\t\t\tsubmitFn,\n\t\t\t() => dirtyFn(this.id),\n\t\t\t() => runtime.attachState !== AttachState.Detached,\n\t\t\tstorageService,\n\t\t\tthis.subLogger,\n\t\t\tbaseSnapshot,\n\t\t\textraBlobs,\n\t\t);\n\n\t\tthis.channelP = new LazyPromise<IChannel>(async () => {\n\t\t\tconst { attributes, factory } = await loadChannelFactoryAndAttributes(\n\t\t\t\tdataStoreContext,\n\t\t\t\tthis.services,\n\t\t\t\tthis.id,\n\t\t\t\tregistry,\n\t\t\t\tattachMessageType,\n\t\t\t);\n\n\t\t\tconst channel = await loadChannel(\n\t\t\t\truntime,\n\t\t\t\tattributes,\n\t\t\t\tfactory,\n\t\t\t\tthis.services,\n\t\t\t\tthis.subLogger,\n\t\t\t\tthis.id,\n\t\t\t);\n\n\t\t\tassert(\n\t\t\t\tthis.pendingMessagesState !== undefined,\n\t\t\t\t0xa6c /* pending messages state is undefined */,\n\t\t\t);\n\t\t\tfor (const messageCollection of this.pendingMessagesState.messageCollections) {\n\t\t\t\tthis.services.deltaConnection.processMessages(messageCollection);\n\t\t\t}\n\t\t\tthis.thresholdOpsCounter.send(\n\t\t\t\t\"ProcessPendingOps\",\n\t\t\t\tthis.pendingMessagesState.pendingCount,\n\t\t\t);\n\n\t\t\t// Commit changes.\n\t\t\tthis.channel = channel;\n\t\t\tthis.pendingMessagesState = undefined;\n\t\t\tthis.isLoaded = true;\n\n\t\t\t// Because have some await between we created the service and here, the connection state might have changed\n\t\t\t// and we don't propagate the connection state when we are not loaded. So we have to set it again here.\n\t\t\tthis.services.deltaConnection.setConnectionState(dataStoreContext.connected);\n\t\t\treturn this.channel;\n\t\t});\n\n\t\tconst thisSummarizeInternal = async (\n\t\t\tfullTree: boolean,\n\t\t\ttrackState: boolean,\n\t\t\ttelemetryContext?: ITelemetryContext,\n\t\t\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext,\n\t\t) =>\n\t\t\tthis.summarizeInternal(\n\t\t\t\tfullTree,\n\t\t\t\ttrackState,\n\t\t\t\ttelemetryContext,\n\t\t\t\tincrementalSummaryContext,\n\t\t\t);\n\n\t\tthis.summarizerNode = createSummarizerNode(\n\t\t\tthisSummarizeInternal,\n\t\t\tasync (fullGC?: boolean) => this.getGCDataInternal(fullGC),\n\t\t);\n\n\t\tthis.thresholdOpsCounter = new ThresholdCounter(\n\t\t\tRemoteChannelContext.pendingOpsCountThreshold,\n\t\t\tthis.subLogger,\n\t\t);\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/promise-function-async\n\tpublic getChannel(): Promise<IChannel> {\n\t\treturn this.channelP;\n\t}\n\n\tpublic setConnectionState(connected: boolean, clientId?: string) {\n\t\t// Connection events are ignored if the data store is not yet loaded\n\t\tif (!this.isLoaded) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.services.deltaConnection.setConnectionState(connected);\n\t}\n\n\tpublic applyStashedOp(content: any): unknown {\n\t\tassert(this.isLoaded, 0x194 /* \"Remote channel must be loaded when rebasing op\" */);\n\t\treturn this.services.deltaConnection.applyStashedOp(content);\n\t}\n\n\t/**\n\t * Process messages for this channel context. The messages here are contiguous messages for this context in a batch.\n\t * @param messageCollection - The collection of messages to process.\n\t */\n\tpublic processMessages(messageCollection: IRuntimeMessageCollection): void {\n\t\tconst { envelope, messagesContent, local } = messageCollection;\n\t\tthis.summarizerNode.invalidate(envelope.sequenceNumber);\n\n\t\tif (this.isLoaded) {\n\t\t\tthis.services.deltaConnection.processMessages(messageCollection);\n\t\t} else {\n\t\t\tassert(!local, 0x195 /* \"Remote channel must not be local when processing op\" */);\n\t\t\tassert(\n\t\t\t\tthis.pendingMessagesState !== undefined,\n\t\t\t\t0xa6d /* pending messages queue is undefined */,\n\t\t\t);\n\t\t\tthis.pendingMessagesState.messageCollections.push({\n\t\t\t\t...messageCollection,\n\t\t\t\tmessagesContent: Array.from(messagesContent),\n\t\t\t});\n\t\t\tthis.pendingMessagesState.pendingCount += messagesContent.length;\n\t\t\tthis.thresholdOpsCounter.sendIfMultiple(\n\t\t\t\t\"StorePendingOps\",\n\t\t\t\tthis.pendingMessagesState.pendingCount,\n\t\t\t);\n\t\t}\n\t}\n\n\tpublic reSubmit(content: any, localOpMetadata: unknown, squash: boolean) {\n\t\tassert(this.isLoaded, 0x196 /* \"Remote channel must be loaded when resubmitting op\" */);\n\n\t\tthis.services.deltaConnection.reSubmit(content, localOpMetadata, squash);\n\t}\n\n\tpublic rollback(content: any, localOpMetadata: unknown) {\n\t\tassert(this.isLoaded, 0x2f0 /* \"Remote channel must be loaded when rolling back op\" */);\n\n\t\tthis.services.deltaConnection.rollback(content, localOpMetadata);\n\t}\n\n\t/**\n\t * Returns a summary at the current sequence number.\n\t * @param fullTree - true to bypass optimizations and force a full summary tree\n\t * @param trackState - This tells whether we should track state from this summary.\n\t * @param telemetryContext - summary data passed through the layers for telemetry purposes\n\t */\n\tpublic async summarize(\n\t\tfullTree: boolean = false,\n\t\ttrackState: boolean = true,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): Promise<ISummarizeResult> {\n\t\treturn this.summarizerNode.summarize(fullTree, trackState, telemetryContext);\n\t}\n\n\tprivate async summarizeInternal(\n\t\tfullTree: boolean,\n\t\ttrackState: boolean,\n\t\ttelemetryContext?: ITelemetryContext,\n\t\tincrementalSummaryContext?: IExperimentalIncrementalSummaryContext,\n\t): Promise<ISummarizeInternalResult> {\n\t\tconst channel = await this.getChannel();\n\t\tconst summarizeResult = await summarizeChannelAsync(\n\t\t\tchannel,\n\t\t\tfullTree,\n\t\t\ttrackState,\n\t\t\ttelemetryContext,\n\t\t\tincrementalSummaryContext,\n\t\t);\n\t\treturn { ...summarizeResult, id: this.id };\n\t}\n\n\t/**\n\t * Returns the data used for garbage collection. This includes a list of GC nodes that represent this context.\n\t * Each node has a set of outbound routes to other GC nodes in the document.\n\t * If there is no new data in this context since the last summary, previous GC data is used.\n\t * If there is new data, the GC data is generated again (by calling getGCDataInternal).\n\t * @param fullGC - true to bypass optimizations and force full generation of GC data.\n\t */\n\tpublic async getGCData(fullGC: boolean = false): Promise<IGarbageCollectionData> {\n\t\treturn this.summarizerNode.getGCData(fullGC);\n\t}\n\n\t/**\n\t * Generates the data used for garbage collection. This is called when there is new data since last summary. It\n\t * loads the context and calls into the channel to get its GC data.\n\t * @param fullGC - true to bypass optimizations and force full generation of GC data.\n\t */\n\tprivate async getGCDataInternal(fullGC: boolean = false): Promise<IGarbageCollectionData> {\n\t\tconst channel = await this.getChannel();\n\t\treturn channel.getGCData(fullGC);\n\t}\n\n\tpublic updateUsedRoutes(usedRoutes: string[]) {\n\t\t/**\n\t\t * Currently, DDSes are always considered referenced and are not garbage collected. Update the summarizer node's\n\t\t * used routes to contain a route to this channel context.\n\t\t * Once we have GC at DDS level, this will be updated to use the passed usedRoutes. See -\n\t\t * https://github.com/microsoft/FluidFramework/issues/4611\n\t\t */\n\t\tthis.summarizerNode.updateUsedRoutes([\"\"]);\n\t}\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/datastore",
3
- "version": "2.40.0-336023",
3
+ "version": "2.41.0-337492",
4
4
  "description": "Fluid data store implementation",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -69,29 +69,29 @@
69
69
  "temp-directory": "nyc/.nyc_output"
70
70
  },
71
71
  "dependencies": {
72
- "@fluid-internal/client-utils": "2.40.0-336023",
73
- "@fluidframework/container-definitions": "2.40.0-336023",
74
- "@fluidframework/core-interfaces": "2.40.0-336023",
75
- "@fluidframework/core-utils": "2.40.0-336023",
76
- "@fluidframework/datastore-definitions": "2.40.0-336023",
77
- "@fluidframework/driver-definitions": "2.40.0-336023",
78
- "@fluidframework/driver-utils": "2.40.0-336023",
79
- "@fluidframework/id-compressor": "2.40.0-336023",
80
- "@fluidframework/runtime-definitions": "2.40.0-336023",
81
- "@fluidframework/runtime-utils": "2.40.0-336023",
82
- "@fluidframework/telemetry-utils": "2.40.0-336023",
72
+ "@fluid-internal/client-utils": "2.41.0-337492",
73
+ "@fluidframework/container-definitions": "2.41.0-337492",
74
+ "@fluidframework/core-interfaces": "2.41.0-337492",
75
+ "@fluidframework/core-utils": "2.41.0-337492",
76
+ "@fluidframework/datastore-definitions": "2.41.0-337492",
77
+ "@fluidframework/driver-definitions": "2.41.0-337492",
78
+ "@fluidframework/driver-utils": "2.41.0-337492",
79
+ "@fluidframework/id-compressor": "2.41.0-337492",
80
+ "@fluidframework/runtime-definitions": "2.41.0-337492",
81
+ "@fluidframework/runtime-utils": "2.41.0-337492",
82
+ "@fluidframework/telemetry-utils": "2.41.0-337492",
83
83
  "uuid": "^9.0.0"
84
84
  },
85
85
  "devDependencies": {
86
86
  "@arethetypeswrong/cli": "^0.17.1",
87
87
  "@biomejs/biome": "~1.9.3",
88
- "@fluid-internal/mocha-test-setup": "2.40.0-336023",
88
+ "@fluid-internal/mocha-test-setup": "2.41.0-337492",
89
89
  "@fluid-tools/build-cli": "^0.55.0",
90
90
  "@fluidframework/build-common": "^2.0.3",
91
91
  "@fluidframework/build-tools": "^0.55.0",
92
92
  "@fluidframework/datastore-previous": "npm:@fluidframework/datastore@2.33.0",
93
93
  "@fluidframework/eslint-config-fluid": "^5.7.3",
94
- "@fluidframework/test-runtime-utils": "2.40.0-336023",
94
+ "@fluidframework/test-runtime-utils": "2.41.0-337492",
95
95
  "@microsoft/api-extractor": "7.52.5",
96
96
  "@types/lodash": "^4.14.118",
97
97
  "@types/mocha": "^10.0.10",
@@ -110,7 +110,11 @@
110
110
  "typescript": "~5.4.5"
111
111
  },
112
112
  "typeValidation": {
113
- "broken": {},
113
+ "broken": {
114
+ "Class_FluidDataStoreRuntime": {
115
+ "forwardCompat": false
116
+ }
117
+ },
114
118
  "entrypoint": "legacy"
115
119
  },
116
120
  "scripts": {
@@ -53,7 +53,7 @@ export interface IChannelContext {
53
53
  telemetryContext?: ITelemetryContext,
54
54
  ): Promise<ISummarizeResult>;
55
55
 
56
- reSubmit(content: any, localOpMetadata: unknown): void;
56
+ reSubmit(content: any, localOpMetadata: unknown, squash?: boolean): void;
57
57
 
58
58
  applyStashedOp(content: any): unknown;
59
59
 
@@ -117,11 +117,9 @@ export class ChannelDeltaConnection implements IDeltaConnection {
117
117
  }
118
118
  }
119
119
 
120
- public reSubmit(content: any, localOpMetadata: unknown) {
121
- processWithStashedOpMetadataHandling(
122
- content,
123
- localOpMetadata,
124
- this.handler.reSubmit.bind(this.handler),
120
+ public reSubmit(content: any, localOpMetadata: unknown, squash: boolean) {
121
+ processWithStashedOpMetadataHandling(content, localOpMetadata, (contents, metadata) =>
122
+ this.handler.reSubmit(contents, metadata, squash),
125
123
  );
126
124
  }
127
125
 
@@ -61,6 +61,7 @@ import {
61
61
  type IContainerRuntimeBaseExperimental,
62
62
  notifiesReadOnlyState,
63
63
  encodeHandlesInContainerRuntime,
64
+ type IFluidDataStorePolicies,
64
65
  } from "@fluidframework/runtime-definitions/internal";
65
66
  import {
66
67
  GCDataBuilder,
@@ -143,6 +144,10 @@ export interface ISharedObjectRegistry {
143
144
  get(name: string): IChannelFactory | undefined;
144
145
  }
145
146
 
147
+ const defaultPolicies: IFluidDataStorePolicies = {
148
+ readonlyInStagingMode: true,
149
+ };
150
+
146
151
  /**
147
152
  * Base data store class
148
153
  * @legacy
@@ -161,6 +166,8 @@ export class FluidDataStoreRuntime
161
166
  return this.dataStoreContext.connected;
162
167
  }
163
168
 
169
+ public readonly policies: IFluidDataStorePolicies;
170
+
164
171
  /**
165
172
  * {@inheritDoc @fluidframework/datastore-definitions#IFluidDataStoreRuntime.isReadOnly}
166
173
  */
@@ -280,6 +287,7 @@ export class FluidDataStoreRuntime
280
287
  private readonly sharedObjectRegistry: ISharedObjectRegistry,
281
288
  existing: boolean,
282
289
  provideEntryPoint: (runtime: IFluidDataStoreRuntime) => Promise<FluidObject>,
290
+ policies?: Partial<IFluidDataStorePolicies>,
283
291
  ) {
284
292
  super();
285
293
 
@@ -288,6 +296,8 @@ export class FluidDataStoreRuntime
288
296
  0x30e /* Id cannot contain slashes. DataStoreContext should have validated this. */,
289
297
  );
290
298
 
299
+ this.policies = { ...defaultPolicies, ...policies };
300
+
291
301
  // Validate that the Runtime is compatible with this DataStore.
292
302
  const { ILayerCompatDetails: runtimeCompatDetails } =
293
303
  dataStoreContext as FluidObject<ILayerCompatDetails>;
@@ -1212,7 +1222,12 @@ export class FluidDataStoreRuntime
1212
1222
  * @param content - The content of the original message.
1213
1223
  * @param localOpMetadata - The local metadata associated with the original message.
1214
1224
  */
1215
- public reSubmit(type: DataStoreMessageType, content: any, localOpMetadata: unknown) {
1225
+ public reSubmit(
1226
+ type: DataStoreMessageType,
1227
+ content: any,
1228
+ localOpMetadata: unknown,
1229
+ squash?: boolean,
1230
+ ) {
1216
1231
  this.verifyNotClosed();
1217
1232
 
1218
1233
  switch (type) {
@@ -1221,7 +1236,7 @@ export class FluidDataStoreRuntime
1221
1236
  const envelope = content as IEnvelope;
1222
1237
  const channelContext = this.contexts.get(envelope.address);
1223
1238
  assert(!!channelContext, 0x183 /* "There should be a channel context for the op" */);
1224
- channelContext.reSubmit(envelope.contents, localOpMetadata);
1239
+ channelContext.reSubmit(envelope.contents, localOpMetadata, squash);
1225
1240
  break;
1226
1241
  }
1227
1242
  case DataStoreMessageType.Attach:
@@ -99,7 +99,8 @@ export class FluidObjectHandle<
99
99
  }
100
100
 
101
101
  /**
102
- * {@inheritDoc @fluidframework/core-interfaces#IFluidHandle.bind}
102
+ * @deprecated No replacement provided. Arbitrary handles may not serve as a bind source.
103
+ * @privateRemarks This implementation will be moved to SharedObjectHandle once this is removed.
103
104
  */
104
105
  public bind(handle: IFluidHandleInternal) {
105
106
  // If this handle is visible, attach the graph of the incoming handle as well.
@@ -107,13 +107,13 @@ export abstract class LocalChannelContextBase implements IChannelContext {
107
107
  }
108
108
  }
109
109
 
110
- public reSubmit(content: any, localOpMetadata: unknown) {
110
+ public reSubmit(content: any, localOpMetadata: unknown, squash: boolean) {
111
111
  assert(this.isLoaded, 0x18a /* "Channel should be loaded to resubmit ops" */);
112
112
  assert(
113
113
  this.globallyVisible,
114
114
  0x2d4 /* "Local channel must be globally visible when resubmitting op" */,
115
115
  );
116
- this.services.value.deltaConnection.reSubmit(content, localOpMetadata);
116
+ this.services.value.deltaConnection.reSubmit(content, localOpMetadata, squash);
117
117
  }
118
118
  public rollback(content: any, localOpMetadata: unknown) {
119
119
  assert(this.isLoaded, 0x2ee /* "Channel should be loaded to rollback ops" */);
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/datastore";
9
- export const pkgVersion = "2.40.0-336023";
9
+ export const pkgVersion = "2.41.0-337492";
@@ -199,10 +199,10 @@ export class RemoteChannelContext implements IChannelContext {
199
199
  }
200
200
  }
201
201
 
202
- public reSubmit(content: any, localOpMetadata: unknown) {
202
+ public reSubmit(content: any, localOpMetadata: unknown, squash: boolean) {
203
203
  assert(this.isLoaded, 0x196 /* "Remote channel must be loaded when resubmitting op" */);
204
204
 
205
- this.services.deltaConnection.reSubmit(content, localOpMetadata);
205
+ this.services.deltaConnection.reSubmit(content, localOpMetadata, squash);
206
206
  }
207
207
 
208
208
  public rollback(content: any, localOpMetadata: unknown) {