@fluidframework/container-loader 2.93.0 → 2.101.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/api-report/container-loader.legacy.alpha.api.md +13 -1
- package/dist/captureReferencedContents.d.ts +154 -0
- package/dist/captureReferencedContents.d.ts.map +1 -0
- package/dist/captureReferencedContents.js +349 -0
- package/dist/captureReferencedContents.js.map +1 -0
- package/dist/connectionManager.d.ts +2 -1
- package/dist/connectionManager.d.ts.map +1 -1
- package/dist/connectionManager.js +39 -8
- package/dist/connectionManager.js.map +1 -1
- package/dist/connectionStateHandler.d.ts.map +1 -1
- package/dist/connectionStateHandler.js +3 -1
- package/dist/connectionStateHandler.js.map +1 -1
- package/dist/container.d.ts.map +1 -1
- package/dist/container.js +13 -4
- package/dist/container.js.map +1 -1
- package/dist/containerStorageAdapter.d.ts +20 -2
- package/dist/containerStorageAdapter.d.ts.map +1 -1
- package/dist/containerStorageAdapter.js +2 -2
- package/dist/containerStorageAdapter.js.map +1 -1
- package/dist/createAndLoadContainerUtils.d.ts +95 -0
- package/dist/createAndLoadContainerUtils.d.ts.map +1 -1
- package/dist/createAndLoadContainerUtils.js +137 -11
- package/dist/createAndLoadContainerUtils.js.map +1 -1
- package/dist/frozenServices.d.ts +113 -30
- package/dist/frozenServices.d.ts.map +1 -1
- package/dist/frozenServices.js +236 -58
- package/dist/frozenServices.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/legacyAlpha.d.ts +2 -0
- package/dist/loader.d.ts +1 -1
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +1 -1
- package/dist/loader.js.map +1 -1
- package/dist/loaderLayerCompatState.d.ts +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/pendingLocalStateStore.d.ts.map +1 -1
- package/dist/pendingLocalStateStore.js +9 -3
- package/dist/pendingLocalStateStore.js.map +1 -1
- package/dist/retriableDocumentStorageService.d.ts +2 -1
- package/dist/retriableDocumentStorageService.d.ts.map +1 -1
- package/dist/retriableDocumentStorageService.js +3 -2
- package/dist/retriableDocumentStorageService.js.map +1 -1
- package/dist/serializedStateManager.d.ts +16 -1
- package/dist/serializedStateManager.d.ts.map +1 -1
- package/dist/serializedStateManager.js +11 -1
- package/dist/serializedStateManager.js.map +1 -1
- package/lib/captureReferencedContents.d.ts +154 -0
- package/lib/captureReferencedContents.d.ts.map +1 -0
- package/lib/captureReferencedContents.js +338 -0
- package/lib/captureReferencedContents.js.map +1 -0
- package/lib/connectionManager.d.ts +2 -1
- package/lib/connectionManager.d.ts.map +1 -1
- package/lib/connectionManager.js +40 -9
- package/lib/connectionManager.js.map +1 -1
- package/lib/connectionStateHandler.d.ts.map +1 -1
- package/lib/connectionStateHandler.js +3 -1
- package/lib/connectionStateHandler.js.map +1 -1
- package/lib/container.d.ts.map +1 -1
- package/lib/container.js +14 -5
- package/lib/container.js.map +1 -1
- package/lib/containerStorageAdapter.d.ts +20 -2
- package/lib/containerStorageAdapter.d.ts.map +1 -1
- package/lib/containerStorageAdapter.js +2 -2
- package/lib/containerStorageAdapter.js.map +1 -1
- package/lib/createAndLoadContainerUtils.d.ts +95 -0
- package/lib/createAndLoadContainerUtils.d.ts.map +1 -1
- package/lib/createAndLoadContainerUtils.js +128 -3
- package/lib/createAndLoadContainerUtils.js.map +1 -1
- package/lib/frozenServices.d.ts +113 -30
- package/lib/frozenServices.d.ts.map +1 -1
- package/lib/frozenServices.js +233 -57
- package/lib/frozenServices.js.map +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/legacyAlpha.d.ts +2 -0
- package/lib/loader.d.ts +1 -1
- package/lib/loader.d.ts.map +1 -1
- package/lib/loader.js +2 -2
- package/lib/loader.js.map +1 -1
- package/lib/loaderLayerCompatState.d.ts +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/pendingLocalStateStore.d.ts.map +1 -1
- package/lib/pendingLocalStateStore.js +9 -3
- package/lib/pendingLocalStateStore.js.map +1 -1
- package/lib/retriableDocumentStorageService.d.ts +2 -1
- package/lib/retriableDocumentStorageService.d.ts.map +1 -1
- package/lib/retriableDocumentStorageService.js +3 -2
- package/lib/retriableDocumentStorageService.js.map +1 -1
- package/lib/serializedStateManager.d.ts +16 -1
- package/lib/serializedStateManager.d.ts.map +1 -1
- package/lib/serializedStateManager.js +11 -1
- package/lib/serializedStateManager.js.map +1 -1
- package/package.json +13 -13
- package/src/captureReferencedContents.ts +446 -0
- package/src/connectionManager.ts +47 -8
- package/src/connectionStateHandler.ts +14 -9
- package/src/container.ts +18 -4
- package/src/containerStorageAdapter.ts +22 -2
- package/src/createAndLoadContainerUtils.ts +229 -2
- package/src/frozenServices.ts +285 -64
- package/src/index.ts +7 -0
- package/src/loader.ts +4 -2
- package/src/packageVersion.ts +1 -1
- package/src/pendingLocalStateStore.ts +8 -1
- package/src/retriableDocumentStorageService.ts +11 -4
- package/src/serializedStateManager.ts +28 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createAndLoadContainerUtils.js","sourceRoot":"","sources":["../src/createAndLoadContainerUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAQH,6EAA8E;AAY9E,0EAA2E;AAC3E,uEAQkD;AAClD,+BAAkC;AAElC,qDAA+C;AAC/C,2DAAyE;AACzE,2CAAqC;AACrC,2DAAiD;AAqIjD;;;;;GAKG;AACI,KAAK,UAAU,uBAAuB,CAC5C,4BAA2D;IAE3D,MAAM,MAAM,GAAG,IAAI,kBAAM,CAAC,4BAA4B,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,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,CAC7C,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tIContainer,\n\tICodeDetailsLoader,\n\tIFluidCodeDetails,\n\tIContainerPolicies,\n} from \"@fluidframework/container-definitions/internal\";\nimport { LoaderHeader } from \"@fluidframework/container-definitions/internal\";\nimport type {\n\tFluidObject,\n\tIConfigProviderBase,\n\tIRequest,\n\tITelemetryBaseLogger,\n} from \"@fluidframework/core-interfaces\";\nimport type { IClientDetails } from \"@fluidframework/driver-definitions\";\nimport type {\n\tIDocumentServiceFactory,\n\tIUrlResolver,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { DriverHeader } from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tGenericError,\n\tnormalizeError,\n\tcreateChildMonitoringContext,\n\tmixinMonitoringContext,\n\tsessionStorageConfigProvider,\n\tPerformanceEvent,\n\tisFluidError,\n} from \"@fluidframework/telemetry-utils/internal\";\nimport { v4 as uuid } from \"uuid\";\n\nimport { DebugLogger } from \"./debugLogger.js\";\nimport { createFrozenDocumentServiceFactory } from \"./frozenServices.js\";\nimport { Loader } from \"./loader.js\";\nimport { pkgVersion } from \"./packageVersion.js\";\nimport type { ProtocolHandlerBuilder } from \"./protocol.js\";\nimport type {\n\tLoadSummarizerSummaryResult,\n\tOnDemandSummaryResults,\n\tSummarizeOnDemandResults,\n} from \"./summarizerResultTypes.js\";\n\ninterface OnDemandSummarizeResultsPromises {\n\treadonly summarySubmitted: Promise<SummarizeOnDemandResults[\"summarySubmitted\"]>;\n\treadonly summaryOpBroadcasted: Promise<SummarizeOnDemandResults[\"summaryOpBroadcasted\"]>;\n}\n\ninterface OnDemandSummarizeOptions {\n\treadonly reason?: string;\n\treadonly retryOnFailure?: boolean;\n\treadonly fullTree?: boolean;\n}\n\ninterface SummarizerLike {\n\treadonly ISummarizer?: SummarizerLike;\n\tsummarizeOnDemand(options: OnDemandSummarizeOptions): OnDemandSummarizeResultsPromises;\n}\n\n/**\n * Properties necessary for creating and loading a container.\n * @legacy @beta\n */\nexport interface ICreateAndLoadContainerProps {\n\t/**\n\t * The url resolver used by the loader for resolving external urls\n\t * into Fluid urls such that the container specified by the\n\t * external url can be loaded.\n\t */\n\treadonly urlResolver: IUrlResolver;\n\t/**\n\t * The document service factory take the Fluid url provided\n\t * by the resolved url and constructs all the necessary services\n\t * for communication with the container's server.\n\t */\n\treadonly documentServiceFactory: IDocumentServiceFactory;\n\t/**\n\t * The code loader handles loading the necessary code\n\t * for running a container once it is loaded.\n\t */\n\treadonly codeLoader: ICodeDetailsLoader;\n\n\t/**\n\t * A property bag of options/policies used by various layers\n\t * to control features\n\t */\n\treadonly options?: IContainerPolicies | undefined;\n\n\t/**\n\t * Scope is provided to all container and is a set of shared\n\t * services for container's to integrate with their host environment.\n\t */\n\treadonly scope?: FluidObject | undefined;\n\n\t/**\n\t * The logger that all telemetry should be pushed to.\n\t */\n\treadonly logger?: ITelemetryBaseLogger | undefined;\n\n\t/**\n\t * The configuration provider which may be used to control features.\n\t */\n\treadonly configProvider?: IConfigProviderBase | undefined;\n\n\t/**\n\t * Optional property for allowing the container to use a custom\n\t * protocol implementation for handling the quorum and/or the audience.\n\t */\n\treadonly protocolHandlerBuilder?: ProtocolHandlerBuilder | undefined;\n\n\t/**\n\t * Disables the Container from reconnecting if false, allows reconnect otherwise.\n\t */\n\treadonly allowReconnect?: boolean | undefined;\n\n\t/**\n\t * Client details provided in the override will be merged over the default client.\n\t */\n\treadonly clientDetailsOverride?: IClientDetails | undefined;\n}\n\n/**\n * Props used to load a container.\n * @legacy @beta\n */\nexport interface ILoadExistingContainerProps extends ICreateAndLoadContainerProps {\n\t/**\n\t * The request to resolve the container.\n\t */\n\treadonly request: IRequest;\n\n\t/**\n\t * Pending local state to be applied to the container.\n\t */\n\treadonly pendingLocalState?: string | undefined;\n}\n\n/**\n * Props used to load summarizer container.\n * @legacy @alpha\n */\nexport type ILoadSummarizerContainerProps = Omit<\n\tILoadExistingContainerProps,\n\t\"pendingLocalState\"\n>;\n\n/**\n * Props used to create a detached container.\n * @legacy @beta\n */\nexport interface ICreateDetachedContainerProps extends ICreateAndLoadContainerProps {\n\t/**\n\t * The code details for the container to be created.\n\t */\n\treadonly codeDetails: IFluidCodeDetails;\n}\n\n/**\n * Props used to rehydrate a detached container.\n * @legacy @beta\n */\nexport interface IRehydrateDetachedContainerProps extends ICreateAndLoadContainerProps {\n\t/**\n\t * The serialized state returned by calling serialize on another container\n\t */\n\treadonly serializedState: string;\n}\n\n/**\n * Creates a new container using the specified code details but in an unattached state. While unattached, all\n * updates will only be local until the user explicitly attaches the container to a service provider.\n * @param createDetachedContainerProps - Services and properties necessary for creating detached container.\n * @legacy @beta\n */\nexport async function createDetachedContainer(\n\tcreateDetachedContainerProps: ICreateDetachedContainerProps,\n): Promise<IContainer> {\n\tconst loader = new Loader(createDetachedContainerProps);\n\treturn loader.createDetachedContainer(createDetachedContainerProps.codeDetails, {\n\t\tcanReconnect: createDetachedContainerProps.allowReconnect,\n\t\tclientDetailsOverride: createDetachedContainerProps.clientDetailsOverride,\n\t});\n}\n\n/**\n * Creates a new container using the specified snapshot but in an unattached state. While unattached, all\n * updates will only be local until the user explicitly attaches the container to a service provider.\n * @param rehydrateDetachedContainerProps - Services and properties necessary for rehydrating detached container from a previously serialized container's state.\n * @legacy @beta\n */\nexport async function rehydrateDetachedContainer(\n\trehydrateDetachedContainerProps: IRehydrateDetachedContainerProps,\n): Promise<IContainer> {\n\tconst loader = new Loader(rehydrateDetachedContainerProps);\n\treturn loader.rehydrateDetachedContainerFromSnapshot(\n\t\trehydrateDetachedContainerProps.serializedState,\n\t\t{\n\t\t\tcanReconnect: rehydrateDetachedContainerProps.allowReconnect,\n\t\t\tclientDetailsOverride: rehydrateDetachedContainerProps.clientDetailsOverride,\n\t\t},\n\t);\n}\n\n/**\n * Loads a container with an existing snapshot from the service.\n * @param loadExistingContainerProps - Services and properties necessary for loading an existing container.\n * @legacy @beta\n */\nexport async function loadExistingContainer(\n\tloadExistingContainerProps: ILoadExistingContainerProps,\n): Promise<IContainer> {\n\tconst loader = new Loader(loadExistingContainerProps);\n\treturn loader.resolve(\n\t\tloadExistingContainerProps.request,\n\t\tloadExistingContainerProps.pendingLocalState,\n\t);\n}\n\n/**\n * Properties required to load a frozen container from pending state.\n * @legacy @alpha\n */\nexport interface ILoadFrozenContainerFromPendingStateProps\n\textends ILoadExistingContainerProps {\n\t/**\n\t * Pending local state to be applied to the container.\n\t */\n\treadonly pendingLocalState: string;\n}\n\n/**\n * Loads a frozen container from pending local state.\n * @param props - Properties required to load a frozen container from pending state.\n * @legacy @alpha\n */\nexport async function loadFrozenContainerFromPendingState(\n\tprops: ILoadFrozenContainerFromPendingStateProps,\n): Promise<IContainer> {\n\treturn loadExistingContainer({\n\t\t...props,\n\t\tdocumentServiceFactory: createFrozenDocumentServiceFactory(props.documentServiceFactory),\n\t});\n}\n\n/**\n * Loads a summarizer container with the required headers, triggers an on-demand summary, and then closes it.\n * Returns success/failure and an optional error for host-side handling.\n *\n * @legacy @alpha\n */\nexport async function loadSummarizerContainerAndMakeSummary(\n\tloadSummarizerContainerProps: ILoadSummarizerContainerProps,\n): Promise<LoadSummarizerSummaryResult> {\n\tlet result = await loadSummarizerContainerAndMakeSummaryInternal(\n\t\tloadSummarizerContainerProps,\n\t);\n\tif (!result.success) {\n\t\t/**\n\t\t * We retry once as there is potential for a race condition when loading a snapshot.\n\t\t * If the newest snapshot is not ready when creating the container but becomes available upon catching up, the container\n\t\t * will be closed so it can load from the new snapshot.\n\t\t */\n\t\tresult = await loadSummarizerContainerAndMakeSummaryInternal(loadSummarizerContainerProps);\n\t}\n\treturn result;\n}\n\nasync function loadSummarizerContainerAndMakeSummaryInternal(\n\tloadSummarizerContainerProps: ILoadSummarizerContainerProps,\n): Promise<LoadSummarizerSummaryResult> {\n\tconst { logger, configProvider, request: originalRequest } = loadSummarizerContainerProps;\n\tconst telemetryProps = {\n\t\tloaderId: uuid(),\n\t\tloaderVersion: pkgVersion,\n\t};\n\n\tconst subMc = mixinMonitoringContext(\n\t\tDebugLogger.mixinDebugLogger(\"fluid:telemetry\", logger, {\n\t\t\tall: telemetryProps,\n\t\t}),\n\t\tsessionStorageConfigProvider.value,\n\t\tconfigProvider,\n\t);\n\tconst mc = createChildMonitoringContext({\n\t\tlogger: subMc.logger,\n\t\tnamespace: \"SummarizerOnDemand\",\n\t});\n\treturn PerformanceEvent.timedExecAsync(\n\t\tmc.logger,\n\t\t{ eventName: \"SummarizerOnDemandSummary\" },\n\t\tasync (event) => {\n\t\t\tconst baseHeaders = originalRequest.headers;\n\t\t\tconst request = {\n\t\t\t\t...originalRequest,\n\t\t\t\theaders: {\n\t\t\t\t\t...baseHeaders,\n\t\t\t\t\t[LoaderHeader.cache]: false,\n\t\t\t\t\t[LoaderHeader.clientDetails]: {\n\t\t\t\t\t\tcapabilities: { interactive: false },\n\t\t\t\t\t\ttype: \"summarizer\",\n\t\t\t\t\t},\n\t\t\t\t\t[DriverHeader.summarizingClient]: true,\n\t\t\t\t\t[LoaderHeader.reconnect]: false,\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tconst container = await loadExistingContainer({\n\t\t\t\t...loadSummarizerContainerProps,\n\t\t\t\trequest,\n\t\t\t});\n\n\t\t\tlet summarySubmitted: SummarizeOnDemandResults[\"summarySubmitted\"];\n\t\t\tlet summaryOpBroadcasted: SummarizeOnDemandResults[\"summaryOpBroadcasted\"];\n\t\t\ttry {\n\t\t\t\tif (container.getEntryPoint === undefined) {\n\t\t\t\t\tthrow new GenericError(\"container.getEntryPoint() is undefined\");\n\t\t\t\t}\n\t\t\t\tconst fluidObject = (await container.getEntryPoint()) as FluidObject<SummarizerLike>;\n\t\t\t\tconst summarizer = fluidObject?.ISummarizer;\n\t\t\t\tif (summarizer === undefined) {\n\t\t\t\t\tthrow new GenericError(\"Summarizer entry point not available\");\n\t\t\t\t}\n\t\t\t\t// Host controlled feature gate for fullTree\n\t\t\t\t// Default value will be false\n\t\t\t\tconst fullTreeGate =\n\t\t\t\t\tmc.config.getBoolean(\"Fluid.Summarizer.FullTree.OnDemand\") === true;\n\n\t\t\t\tconst summarizeResults: OnDemandSummarizeResultsPromises =\n\t\t\t\t\tsummarizer.summarizeOnDemand({\n\t\t\t\t\t\treason: \"summaryOnRequest\",\n\t\t\t\t\t\tretryOnFailure: true,\n\t\t\t\t\t\tfullTree: fullTreeGate,\n\t\t\t\t\t});\n\t\t\t\t[summarySubmitted, summaryOpBroadcasted] = await Promise.all([\n\t\t\t\t\tsummarizeResults.summarySubmitted,\n\t\t\t\t\tsummarizeResults.summaryOpBroadcasted,\n\t\t\t\t]);\n\n\t\t\t\tconst summaryResults: OnDemandSummaryResults = {\n\t\t\t\t\tsummarySubmitted: summarySubmitted.success,\n\t\t\t\t\tsummaryInfo: summarySubmitted.success\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\tstage: summarySubmitted.data.stage,\n\t\t\t\t\t\t\t\thandle: summaryOpBroadcasted.success\n\t\t\t\t\t\t\t\t\t? summaryOpBroadcasted.data.summarizeOp.contents.handle\n\t\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: {},\n\t\t\t\t\tsummaryOpBroadcasted: summaryOpBroadcasted.success,\n\t\t\t\t};\n\n\t\t\t\tif (summarySubmitted.success && summaryOpBroadcasted.success) {\n\t\t\t\t\tevent.end({\n\t\t\t\t\t\tsuccess: true,\n\t\t\t\t\t\tsummarySubmitted: true,\n\t\t\t\t\t\tsummaryOpBroadcasted: true,\n\t\t\t\t\t});\n\t\t\t\t\treturn {\n\t\t\t\t\t\tsuccess: true,\n\t\t\t\t\t\tsummaryResults,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tconst failureError =\n\t\t\t\t\tsummarySubmitted.success === false\n\t\t\t\t\t\t? summarySubmitted.error\n\t\t\t\t\t\t: summaryOpBroadcasted.success === false\n\t\t\t\t\t\t\t? summaryOpBroadcasted.error\n\t\t\t\t\t\t\t: new GenericError(\"On demand summary failed\");\n\n\t\t\t\tevent.end({\n\t\t\t\t\tsuccess: false,\n\t\t\t\t\tsummarySubmitted: summarySubmitted.success,\n\t\t\t\t\tsummaryOpBroadcasted: summaryOpBroadcasted.success,\n\t\t\t\t});\n\t\t\t\treturn {\n\t\t\t\t\tsuccess: false,\n\t\t\t\t\terror: failureError,\n\t\t\t\t};\n\t\t\t} catch (error) {\n\t\t\t\tevent.cancel({ success: false }, error);\n\t\t\t\tconst caughtError = isFluidError(error) ? error : normalizeError(error);\n\t\t\t\treturn { success: false, error: caughtError };\n\t\t\t} finally {\n\t\t\t\tcontainer.dispose();\n\t\t\t}\n\t\t},\n\t\t{ start: true, end: true, cancel: \"generic\" },\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"createAndLoadContainerUtils.js","sourceRoot":"","sources":["../src/createAndLoadContainerUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAQH,6EAA8E;AAe9E,0EAAwF;AACxF,oEAAwE;AACxE,uEASkD;AAClD,+BAAkC;AAElC,iFASwC;AACxC,qDAA+C;AAC/C,2DAAyE;AACzE,2CAAqC;AACrC,2DAAiD;AAQjD,yCAAmD;AA+HnD;;;;;GAKG;AACI,KAAK,UAAU,uBAAuB,CAC5C,4BAA2D;IAE3D,MAAM,MAAM,GAAG,IAAI,kBAAM,CAAC,4BAA4B,CAAC,CAAC;IACxD,OAAO,MAAM,CAAC,uBAAuB,CAAC,4BAA4B,CAAC,WAAW,EAAE;QAC/E,YAAY,EAAE,4BAA4B,CAAC,cAAc;QACzD,qBAAqB,EAAE,4BAA4B,CAAC,qBAAqB;KACzE,CAAC,CAAC;AACJ,CAAC;AARD,0DAQC;AAED;;;;;GAKG;AACI,KAAK,UAAU,0BAA0B,CAC/C,+BAAiE;IAEjE,MAAM,MAAM,GAAG,IAAI,kBAAM,CAAC,+BAA+B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;gBACd,gBAAgB,EAAE,gBAAgB,CAAC,OAAO;gBAC1C,oBAAoB,EAAE,oBAAoB,CAAC,OAAO;aAClD,CAAC,CAAC;YACH,OAAO;gBACN,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,YAAY;aACnB,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,CAAC,CAAC;YACxC,MAAM,WAAW,GAAG,IAAA,uBAAY,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAA,yBAAc,EAAC,KAAK,CAAC,CAAC;YACxE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;QAC/C,CAAC;gBAAS,CAAC;YACV,SAAS,CAAC,OAAO,EAAE,CAAC;QACrB,CAAC;IACF,CAAC,EACD,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,CAC7C,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tIContainer,\n\tICodeDetailsLoader,\n\tIFluidCodeDetails,\n\tIContainerPolicies,\n} from \"@fluidframework/container-definitions/internal\";\nimport { LoaderHeader } from \"@fluidframework/container-definitions/internal\";\nimport type {\n\tFluidObject,\n\tIConfigProviderBase,\n\tIRequest,\n\tITelemetryBaseLogger,\n} from \"@fluidframework/core-interfaces\";\nimport type { IClientDetails } from \"@fluidframework/driver-definitions\";\nimport type {\n\tIDocumentServiceFactory,\n\tISequencedDocumentMessage,\n\tISnapshot,\n\tISnapshotTree,\n\tIUrlResolver,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { DriverHeader, FetchSource } from \"@fluidframework/driver-definitions/internal\";\nimport { getSnapshotTree } from \"@fluidframework/driver-utils/internal\";\nimport {\n\tGenericError,\n\tUsageError,\n\tnormalizeError,\n\tcreateChildMonitoringContext,\n\tmixinMonitoringContext,\n\tsessionStorageConfigProvider,\n\tPerformanceEvent,\n\tisFluidError,\n} from \"@fluidframework/telemetry-utils/internal\";\nimport { v4 as uuid } from \"uuid\";\n\nimport {\n\tcaptureReferencedAttachmentBlobs,\n\textractBlobAttachReferences,\n\tinlineAttachmentBlobsByReference,\n\tparseGcSnapshotData,\n\treadReferencedSnapshotBlobs,\n\tsnapshotHasLoadingGroups,\n\tunreferencedAttachmentBlobLocalIds,\n\ttype IBlobAttachReference,\n} from \"./captureReferencedContents.js\";\nimport { DebugLogger } from \"./debugLogger.js\";\nimport { createFrozenDocumentServiceFactory } from \"./frozenServices.js\";\nimport { Loader } from \"./loader.js\";\nimport { pkgVersion } from \"./packageVersion.js\";\nimport type { ProtocolHandlerBuilder } from \"./protocol.js\";\nimport type { IPendingContainerState } from \"./serializedStateManager.js\";\nimport type {\n\tLoadSummarizerSummaryResult,\n\tOnDemandSummaryResults,\n\tSummarizeOnDemandResults,\n} from \"./summarizerResultTypes.js\";\nimport { getDocumentAttributes } from \"./utils.js\";\n\ninterface OnDemandSummarizeResultsPromises {\n\treadonly summarySubmitted: Promise<SummarizeOnDemandResults[\"summarySubmitted\"]>;\n\treadonly summaryOpBroadcasted: Promise<SummarizeOnDemandResults[\"summaryOpBroadcasted\"]>;\n}\n\ninterface OnDemandSummarizeOptions {\n\treadonly reason?: string;\n\treadonly retryOnFailure?: boolean;\n\treadonly fullTree?: boolean;\n}\n\ninterface SummarizerLike {\n\treadonly ISummarizer?: SummarizerLike;\n\tsummarizeOnDemand(options: OnDemandSummarizeOptions): OnDemandSummarizeResultsPromises;\n}\n\n/**\n * Properties necessary for creating and loading a container.\n * @legacy @beta\n */\nexport interface ICreateAndLoadContainerProps {\n\t/**\n\t * The url resolver used by the loader for resolving external urls\n\t * into Fluid urls such that the container specified by the\n\t * external url can be loaded.\n\t */\n\treadonly urlResolver: IUrlResolver;\n\t/**\n\t * The document service factory take the Fluid url provided\n\t * by the resolved url and constructs all the necessary services\n\t * for communication with the container's server.\n\t */\n\treadonly documentServiceFactory: IDocumentServiceFactory;\n\t/**\n\t * The code loader handles loading the necessary code\n\t * for running a container once it is loaded.\n\t */\n\treadonly codeLoader: ICodeDetailsLoader;\n\n\t/**\n\t * A property bag of options/policies used by various layers\n\t * to control features\n\t */\n\treadonly options?: IContainerPolicies | undefined;\n\n\t/**\n\t * Scope is provided to all container and is a set of shared\n\t * services for container's to integrate with their host environment.\n\t */\n\treadonly scope?: FluidObject | undefined;\n\n\t/**\n\t * The logger that all telemetry should be pushed to.\n\t */\n\treadonly logger?: ITelemetryBaseLogger | undefined;\n\n\t/**\n\t * The configuration provider which may be used to control features.\n\t */\n\treadonly configProvider?: IConfigProviderBase | undefined;\n\n\t/**\n\t * Optional property for allowing the container to use a custom\n\t * protocol implementation for handling the quorum and/or the audience.\n\t */\n\treadonly protocolHandlerBuilder?: ProtocolHandlerBuilder | undefined;\n\n\t/**\n\t * Disables the Container from reconnecting if false, allows reconnect otherwise.\n\t */\n\treadonly allowReconnect?: boolean | undefined;\n\n\t/**\n\t * Client details provided in the override will be merged over the default client.\n\t */\n\treadonly clientDetailsOverride?: IClientDetails | undefined;\n}\n\n/**\n * Props used to load a container.\n * @legacy @beta\n */\nexport interface ILoadExistingContainerProps extends ICreateAndLoadContainerProps {\n\t/**\n\t * The request to resolve the container.\n\t */\n\treadonly request: IRequest;\n\n\t/**\n\t * Pending local state to be applied to the container.\n\t */\n\treadonly pendingLocalState?: string | undefined;\n}\n\n/**\n * Props used to load summarizer container.\n * @legacy @alpha\n */\nexport type ILoadSummarizerContainerProps = Omit<\n\tILoadExistingContainerProps,\n\t\"pendingLocalState\"\n>;\n\n/**\n * Props used to create a detached container.\n * @legacy @beta\n */\nexport interface ICreateDetachedContainerProps extends ICreateAndLoadContainerProps {\n\t/**\n\t * The code details for the container to be created.\n\t */\n\treadonly codeDetails: IFluidCodeDetails;\n}\n\n/**\n * Props used to rehydrate a detached container.\n * @legacy @beta\n */\nexport interface IRehydrateDetachedContainerProps extends ICreateAndLoadContainerProps {\n\t/**\n\t * The serialized state returned by calling serialize on another container\n\t */\n\treadonly serializedState: string;\n}\n\n/**\n * Creates a new container using the specified code details but in an unattached state. While unattached, all\n * updates will only be local until the user explicitly attaches the container to a service provider.\n * @param createDetachedContainerProps - Services and properties necessary for creating detached container.\n * @legacy @beta\n */\nexport async function createDetachedContainer(\n\tcreateDetachedContainerProps: ICreateDetachedContainerProps,\n): Promise<IContainer> {\n\tconst loader = new Loader(createDetachedContainerProps);\n\treturn loader.createDetachedContainer(createDetachedContainerProps.codeDetails, {\n\t\tcanReconnect: createDetachedContainerProps.allowReconnect,\n\t\tclientDetailsOverride: createDetachedContainerProps.clientDetailsOverride,\n\t});\n}\n\n/**\n * Creates a new container using the specified snapshot but in an unattached state. While unattached, all\n * updates will only be local until the user explicitly attaches the container to a service provider.\n * @param rehydrateDetachedContainerProps - Services and properties necessary for rehydrating detached container from a previously serialized container's state.\n * @legacy @beta\n */\nexport async function rehydrateDetachedContainer(\n\trehydrateDetachedContainerProps: IRehydrateDetachedContainerProps,\n): Promise<IContainer> {\n\tconst loader = new Loader(rehydrateDetachedContainerProps);\n\treturn loader.rehydrateDetachedContainerFromSnapshot(\n\t\trehydrateDetachedContainerProps.serializedState,\n\t\t{\n\t\t\tcanReconnect: rehydrateDetachedContainerProps.allowReconnect,\n\t\t\tclientDetailsOverride: rehydrateDetachedContainerProps.clientDetailsOverride,\n\t\t},\n\t);\n}\n\n/**\n * Loads a container with an existing snapshot from the service.\n * @param loadExistingContainerProps - Services and properties necessary for loading an existing container.\n * @legacy @beta\n */\nexport async function loadExistingContainer(\n\tloadExistingContainerProps: ILoadExistingContainerProps,\n): Promise<IContainer> {\n\tconst loader = new Loader(loadExistingContainerProps);\n\treturn loader.resolve(\n\t\tloadExistingContainerProps.request,\n\t\tloadExistingContainerProps.pendingLocalState,\n\t);\n}\n\n/**\n * Properties required to load a frozen container from pending state.\n * @legacy @alpha\n */\nexport interface ILoadFrozenContainerFromPendingStateProps\n\textends ILoadExistingContainerProps {\n\t/**\n\t * Pending local state to be applied to the container.\n\t */\n\treadonly pendingLocalState: string;\n\n\t/**\n\t * Controls whether the frozen container is surfaced as read-only.\n\t *\n\t * Defaults to `true`. When `true`, the container reports `readOnlyInfo.readonly === true`\n\t * with `storageOnly === true`, matching the historical behavior of frozen loads.\n\t *\n\t * When `false`, the container loads as writable so the runtime will accept DDS submissions.\n\t * The connection itself stays `Connected`: the connection manager recognizes the synthetic\n\t * frozen delta stream and drops outbound messages at the network layer, so no read→write\n\t * reconnect is attempted. Local DDS state continues to update via optimistic apply, and\n\t * submitted ops accumulate in the runtime's pending-state manager. Use this when callers\n\t * want to accrue and capture pending state without publishing it.\n\t *\n\t * @remarks\n\t * The flag uses negative polarity (`readOnly`) rather than a positive opt-in (`writable`)\n\t * to align with `IContainer.readOnlyInfo.readonly`, which is the established surface for\n\t * read/write state on a loaded container. A future positive-polarity option can layer on\n\t * top of this without breaking callers, but flipping the polarity now would split readers\n\t * between two conventions for the same concept.\n\t *\n\t * Subsystem behavior is unchanged from the read-only frozen path regardless of `readOnly`:\n\t * storage operations still throw (only `readBlob` is supported); summarizer / id-compressor\n\t * never fire because no acks arrive; the quorum is whatever was captured in pending state\n\t * and gains no members during the writable-frozen lifetime. The only behavioral delta is\n\t * that the runtime accepts DDS submissions and accumulates them in `pendingStateManager`.\n\t */\n\treadonly readOnly?: boolean;\n}\n\n/**\n * Loads a frozen container from pending local state.\n * @param props - Properties required to load a frozen container from pending state.\n * @legacy @alpha\n */\nexport async function loadFrozenContainerFromPendingState(\n\tprops: ILoadFrozenContainerFromPendingStateProps,\n): Promise<IContainer> {\n\treturn loadExistingContainer({\n\t\t...props,\n\t\tdocumentServiceFactory: createFrozenDocumentServiceFactory(\n\t\t\tprops.documentServiceFactory,\n\t\t\tprops.readOnly,\n\t\t),\n\t});\n}\n\n/**\n * Properties for {@link captureFullContainerState}.\n * @legacy @alpha\n */\nexport interface ICaptureFullContainerStateProps {\n\t/**\n\t * The url resolver used to resolve the request into a Fluid resolved url.\n\t */\n\treadonly urlResolver: IUrlResolver;\n\t/**\n\t * The document service factory used to construct the driver services\n\t * against which the state is captured.\n\t */\n\treadonly documentServiceFactory: IDocumentServiceFactory;\n\t/**\n\t * The request identifying the container whose state is to be captured.\n\t */\n\treadonly request: IRequest;\n\t/**\n\t * Optional logger for driver-side telemetry.\n\t */\n\treadonly logger?: ITelemetryBaseLogger | undefined;\n}\n\n/**\n * Captures the current state of an attached container using only driver-level\n * services, without instantiating a runtime or loading a full container. The\n * returned string is a serialized pending container state in the same wire\n * format produced by a live container's pending-state serialization, and can\n * be handed to {@link loadExistingContainer} as `pendingLocalState`.\n *\n * The output is a self-contained view of the container's referenced graph:\n * the latest snapshot, inlined contents of every blob reachable through\n * referenced subtrees, inlined contents of every referenced attachment blob\n * keyed by storage id, and all ops with sequence numbers after the base\n * snapshot's sequence number (as read from its attributes blob).\n *\n * Reachability respects GC. Snapshot subtrees flagged `unreferenced: true`\n * are skipped (their contents are not inlined). Attachment blobs that GC has\n * marked unreferenced, tombstoned, or deleted are skipped. When the snapshot\n * has no GC tree (GC disabled or pre-GC document), no filtering is applied.\n *\n * Blob reads on load hit the `ContainerStorageAdapter` cache populated from\n * the captured `snapshotBlobs` map, so a frozen loader can serve the full\n * referenced graph without a live storage service.\n *\n * `pendingRuntimeState` is `undefined` — no runtime is instantiated — so the\n * output cannot carry DDS-level in-flight changes. It is intended for state\n * relay, inspection, and durable-state snapshot use cases.\n *\n * Containers that declare loading groups are not yet supported: the function\n * throws `UsageError` if any referenced subtree carries a `groupId`. Group\n * snapshots would need a separate prefetch + serialization path; until there\n * is a known consumer and end-to-end coverage, the capture refuses rather\n * than silently producing pending state that omits group data.\n *\n * Note: if a new snapshot lands between the snapshot fetch and the ops fetch,\n * the returned state may not reflect the very latest snapshot, but remains\n * internally consistent: ops are anchored to the snapshot that was captured.\n *\n * No `mixinMonitoringContext` / `configProvider` is wired here, deliberately\n * diverging from the sibling entry points in this file. The function reads\n * no feature flags and instantiates no runtime, so there is nothing for a\n * monitoring context to gate or attribute. If a future change introduces\n * config-gated behavior or runtime-attributed telemetry, add the wiring\n * back together with that change.\n * @legacy @alpha\n */\nexport async function captureFullContainerState({\n\turlResolver,\n\tdocumentServiceFactory,\n\trequest,\n\tlogger,\n}: ICaptureFullContainerStateProps): Promise<string> {\n\tconst resolvedUrl = await urlResolver.resolve(request);\n\tif (resolvedUrl === undefined) {\n\t\tthrow new UsageError(\"Failed to resolve request to a Fluid URL\");\n\t}\n\n\tconst documentService = await documentServiceFactory.createDocumentService(\n\t\tresolvedUrl,\n\t\tlogger,\n\t);\n\ttry {\n\t\tconst storage = await documentService.connectToStorage();\n\n\t\tconst versions = await storage.getVersions(\n\t\t\t// `null` signals \"latest\"\n\t\t\t// eslint-disable-next-line unicorn/no-null\n\t\t\tnull,\n\t\t\t1,\n\t\t\t\"captureFullContainerState\",\n\t\t\tFetchSource.noCache,\n\t\t);\n\t\tconst version = versions[0];\n\t\tconst snapshot: ISnapshot | ISnapshotTree | undefined =\n\t\t\tstorage.getSnapshot === undefined\n\t\t\t\t? ((await storage.getSnapshotTree(version, \"captureFullContainerState\")) ?? undefined)\n\t\t\t\t: await storage.getSnapshot({\n\t\t\t\t\t\tcacheSnapshot: false,\n\t\t\t\t\t\tversionId: version?.id,\n\t\t\t\t\t\tscenarioName: \"captureFullContainerState\",\n\t\t\t\t\t});\n\t\tif (snapshot === undefined) {\n\t\t\tthrow new GenericError(\"Failed to fetch snapshot for captureFullContainerState\");\n\t\t}\n\n\t\tconst baseSnapshot = getSnapshotTree(snapshot);\n\t\tif (snapshotHasLoadingGroups(baseSnapshot)) {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"captureFullContainerState does not yet support containers with loading groups\",\n\t\t\t);\n\t\t}\n\t\tconst attributes = await getDocumentAttributes(storage, baseSnapshot);\n\t\tconst gcData = await parseGcSnapshotData(baseSnapshot, storage);\n\t\t// Structural snapshot blobs (JSON/text the runtime authored) are\n\t\t// UTF-8-encoded; attachment blobs may carry arbitrary binary bytes\n\t\t// and are base64-encoded. Keep them on separate fields of the\n\t\t// pending state so the load side can apply the matching decoder\n\t\t// without ambiguity. See IPendingContainerState.attachmentBlobContents.\n\t\tconst [snapshotBlobs, attachmentBlobContents] = await Promise.all([\n\t\t\treadReferencedSnapshotBlobs(snapshot, storage), // utf8 encoded\n\t\t\tcaptureReferencedAttachmentBlobs(baseSnapshot, storage, gcData), // base64 encoded\n\t\t]);\n\n\t\tconst deltaStorage = await documentService.connectToDeltaStorage();\n\t\tconst opsStream = deltaStorage.fetchMessages(\n\t\t\tattributes.sequenceNumber + 1,\n\t\t\tundefined,\n\t\t\tundefined,\n\t\t\tfalse,\n\t\t\t\"captureFullContainerState\",\n\t\t);\n\t\tconst savedOps: ISequencedDocumentMessage[] = [];\n\t\tconst postSnapshotBlobReferences: IBlobAttachReference[] = [];\n\t\tlet opsResult = await opsStream.read();\n\t\twhile (!opsResult.done) {\n\t\t\tfor (const op of opsResult.value) {\n\t\t\t\tsavedOps.push(op);\n\t\t\t\t// Blobs uploaded after the base snapshot are not in its\n\t\t\t\t// `.blobs` redirect table, so `captureReferencedAttachmentBlobs`\n\t\t\t\t// did not see them. The wire-format BlobAttach op carries\n\t\t\t\t// `(localId, storageId)` in its metadata; collect those here so\n\t\t\t\t// we can backfill the bytes before sealing the artifact.\n\t\t\t\tconst refs = extractBlobAttachReferences(op);\n\t\t\t\tif (refs.length > 0) {\n\t\t\t\t\tpostSnapshotBlobReferences.push(...refs);\n\t\t\t\t}\n\t\t\t}\n\t\t\topsResult = await opsStream.read();\n\t\t}\n\n\t\tif (postSnapshotBlobReferences.length > 0) {\n\t\t\tconst added = await inlineAttachmentBlobsByReference(\n\t\t\t\tpostSnapshotBlobReferences,\n\t\t\t\tstorage,\n\t\t\t\tunreferencedAttachmentBlobLocalIds(gcData),\n\t\t\t\tattachmentBlobContents,\n\t\t\t);\n\t\t\tObject.assign(attachmentBlobContents, added);\n\t\t}\n\n\t\tconst pendingState: IPendingContainerState = {\n\t\t\tattached: true,\n\t\t\tbaseSnapshot,\n\t\t\tsnapshotBlobs,\n\t\t\tattachmentBlobContents:\n\t\t\t\tObject.keys(attachmentBlobContents).length === 0 ? undefined : attachmentBlobContents,\n\t\t\tloadedGroupIdSnapshots: undefined,\n\t\t\tpendingRuntimeState: undefined,\n\t\t\tsavedOps,\n\t\t\turl: resolvedUrl.url,\n\t\t};\n\t\treturn JSON.stringify(pendingState);\n\t} finally {\n\t\tdocumentService.dispose();\n\t}\n}\n\n/**\n * Loads a summarizer container with the required headers, triggers an on-demand summary, and then closes it.\n * Returns success/failure and an optional error for host-side handling.\n *\n * @legacy @alpha\n */\nexport async function loadSummarizerContainerAndMakeSummary(\n\tloadSummarizerContainerProps: ILoadSummarizerContainerProps,\n): Promise<LoadSummarizerSummaryResult> {\n\tlet result = await loadSummarizerContainerAndMakeSummaryInternal(\n\t\tloadSummarizerContainerProps,\n\t);\n\tif (!result.success) {\n\t\t/**\n\t\t * We retry once as there is potential for a race condition when loading a snapshot.\n\t\t * If the newest snapshot is not ready when creating the container but becomes available upon catching up, the container\n\t\t * will be closed so it can load from the new snapshot.\n\t\t */\n\t\tresult = await loadSummarizerContainerAndMakeSummaryInternal(loadSummarizerContainerProps);\n\t}\n\treturn result;\n}\n\nasync function loadSummarizerContainerAndMakeSummaryInternal(\n\tloadSummarizerContainerProps: ILoadSummarizerContainerProps,\n): Promise<LoadSummarizerSummaryResult> {\n\tconst { logger, configProvider, request: originalRequest } = loadSummarizerContainerProps;\n\tconst telemetryProps = {\n\t\tloaderId: uuid(),\n\t\tloaderVersion: pkgVersion,\n\t};\n\n\tconst subMc = mixinMonitoringContext(\n\t\tDebugLogger.mixinDebugLogger(\"fluid:telemetry\", logger, {\n\t\t\tall: telemetryProps,\n\t\t}),\n\t\tsessionStorageConfigProvider.value,\n\t\tconfigProvider,\n\t);\n\tconst mc = createChildMonitoringContext({\n\t\tlogger: subMc.logger,\n\t\tnamespace: \"SummarizerOnDemand\",\n\t});\n\treturn PerformanceEvent.timedExecAsync(\n\t\tmc.logger,\n\t\t{ eventName: \"SummarizerOnDemandSummary\" },\n\t\tasync (event) => {\n\t\t\tconst baseHeaders = originalRequest.headers;\n\t\t\tconst request = {\n\t\t\t\t...originalRequest,\n\t\t\t\theaders: {\n\t\t\t\t\t...baseHeaders,\n\t\t\t\t\t[LoaderHeader.cache]: false,\n\t\t\t\t\t[LoaderHeader.clientDetails]: {\n\t\t\t\t\t\tcapabilities: { interactive: false },\n\t\t\t\t\t\ttype: \"summarizer\",\n\t\t\t\t\t},\n\t\t\t\t\t[DriverHeader.summarizingClient]: true,\n\t\t\t\t\t[LoaderHeader.reconnect]: false,\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tconst container = await loadExistingContainer({\n\t\t\t\t...loadSummarizerContainerProps,\n\t\t\t\trequest,\n\t\t\t});\n\n\t\t\tlet summarySubmitted: SummarizeOnDemandResults[\"summarySubmitted\"];\n\t\t\tlet summaryOpBroadcasted: SummarizeOnDemandResults[\"summaryOpBroadcasted\"];\n\t\t\ttry {\n\t\t\t\tif (container.getEntryPoint === undefined) {\n\t\t\t\t\tthrow new GenericError(\"container.getEntryPoint() is undefined\");\n\t\t\t\t}\n\t\t\t\tconst fluidObject = (await container.getEntryPoint()) as FluidObject<SummarizerLike>;\n\t\t\t\tconst summarizer = fluidObject?.ISummarizer;\n\t\t\t\tif (summarizer === undefined) {\n\t\t\t\t\tthrow new GenericError(\"Summarizer entry point not available\");\n\t\t\t\t}\n\t\t\t\t// Host controlled feature gate for fullTree\n\t\t\t\t// Default value will be false\n\t\t\t\tconst fullTreeGate =\n\t\t\t\t\tmc.config.getBoolean(\"Fluid.Summarizer.FullTree.OnDemand\") === true;\n\n\t\t\t\tconst summarizeResults: OnDemandSummarizeResultsPromises =\n\t\t\t\t\tsummarizer.summarizeOnDemand({\n\t\t\t\t\t\treason: \"summaryOnRequest\",\n\t\t\t\t\t\tretryOnFailure: true,\n\t\t\t\t\t\tfullTree: fullTreeGate,\n\t\t\t\t\t});\n\t\t\t\t[summarySubmitted, summaryOpBroadcasted] = await Promise.all([\n\t\t\t\t\tsummarizeResults.summarySubmitted,\n\t\t\t\t\tsummarizeResults.summaryOpBroadcasted,\n\t\t\t\t]);\n\n\t\t\t\tconst summaryResults: OnDemandSummaryResults = {\n\t\t\t\t\tsummarySubmitted: summarySubmitted.success,\n\t\t\t\t\tsummaryInfo: summarySubmitted.success\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\tstage: summarySubmitted.data.stage,\n\t\t\t\t\t\t\t\thandle: summaryOpBroadcasted.success\n\t\t\t\t\t\t\t\t\t? summaryOpBroadcasted.data.summarizeOp.contents.handle\n\t\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: {},\n\t\t\t\t\tsummaryOpBroadcasted: summaryOpBroadcasted.success,\n\t\t\t\t};\n\n\t\t\t\tif (summarySubmitted.success && summaryOpBroadcasted.success) {\n\t\t\t\t\tevent.end({\n\t\t\t\t\t\tsuccess: true,\n\t\t\t\t\t\tsummarySubmitted: true,\n\t\t\t\t\t\tsummaryOpBroadcasted: true,\n\t\t\t\t\t});\n\t\t\t\t\treturn {\n\t\t\t\t\t\tsuccess: true,\n\t\t\t\t\t\tsummaryResults,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tconst failureError =\n\t\t\t\t\tsummarySubmitted.success === false\n\t\t\t\t\t\t? summarySubmitted.error\n\t\t\t\t\t\t: summaryOpBroadcasted.success === false\n\t\t\t\t\t\t\t? summaryOpBroadcasted.error\n\t\t\t\t\t\t\t: new GenericError(\"On demand summary failed\");\n\n\t\t\t\tevent.end({\n\t\t\t\t\tsuccess: false,\n\t\t\t\t\tsummarySubmitted: summarySubmitted.success,\n\t\t\t\t\tsummaryOpBroadcasted: summaryOpBroadcasted.success,\n\t\t\t\t});\n\t\t\t\treturn {\n\t\t\t\t\tsuccess: false,\n\t\t\t\t\terror: failureError,\n\t\t\t\t};\n\t\t\t} catch (error) {\n\t\t\t\tevent.cancel({ success: false }, error);\n\t\t\t\tconst caughtError = isFluidError(error) ? error : normalizeError(error);\n\t\t\t\treturn { success: false, error: caughtError };\n\t\t\t} finally {\n\t\t\t\tcontainer.dispose();\n\t\t\t}\n\t\t},\n\t\t{ start: true, end: true, cancel: \"generic\" },\n\t);\n}\n"]}
|
package/dist/frozenServices.d.ts
CHANGED
|
@@ -7,49 +7,132 @@ import type { IDisposable } from "@fluidframework/core-interfaces";
|
|
|
7
7
|
import { type ConnectionMode, type IClientConfiguration, type IDocumentDeltaConnection, type IDocumentDeltaConnectionEvents, type IDocumentMessage, type IDocumentService, type IDocumentServiceFactory, type IResolvedUrl, type ISequencedDocumentMessage, type ISignalClient, type ISignalMessage, type ITokenClaims } from "@fluidframework/driver-definitions/internal";
|
|
8
8
|
import type { IConnectionStateChangeReason } from "./contracts.js";
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
10
|
+
* Creates an `IDocumentServiceFactory` that produces a "frozen" document service: one whose
|
|
11
|
+
* delta stream never sends or receives ops, and whose storage service only supports
|
|
12
|
+
* `IDocumentStorageService.readBlob`. Used to load a container from pending local state
|
|
13
|
+
* without re-establishing a live connection.
|
|
12
14
|
*
|
|
13
|
-
* @param
|
|
14
|
-
*
|
|
15
|
+
* @param factory - The underlying factory to wrap. Its storage backs blob reads; all other
|
|
16
|
+
* storage operations throw. May be omitted when blob fetches are not required.
|
|
17
|
+
* @param readOnly - When `true` (the default), the document service advertises the
|
|
18
|
+
* `IDocumentServicePolicies.storageOnly` policy, which causes the loader to surface the
|
|
19
|
+
* container as read-only (see `IContainer.readOnlyInfo`).
|
|
20
|
+
*
|
|
21
|
+
* When `false`, the container is loaded as writable so the runtime will accept DDS submissions.
|
|
22
|
+
* The connection itself stays `Connected`: `ConnectionManager.sendMessages` recognizes the
|
|
23
|
+
* `WritableFrozenDeltaStream` as the live connection and short-circuits — the message is dropped
|
|
24
|
+
* at the network layer rather than triggering a read→write reconnect. Local DDS state continues
|
|
25
|
+
* to update via optimistic apply, and submitted ops accumulate in the runtime's pending-state
|
|
26
|
+
* manager, which is exactly the state needed to capture pending local state. Use `false` when
|
|
27
|
+
* callers want to accrue and capture pending state without publishing it.
|
|
28
|
+
* @returns A factory that produces frozen document services.
|
|
15
29
|
* @legacy @alpha
|
|
16
30
|
*/
|
|
17
|
-
export declare function createFrozenDocumentServiceFactory(factory?: IDocumentServiceFactory | Promise<IDocumentServiceFactory
|
|
31
|
+
export declare function createFrozenDocumentServiceFactory(factory?: IDocumentServiceFactory | Promise<IDocumentServiceFactory>, readOnly?: boolean): IDocumentServiceFactory;
|
|
18
32
|
export declare class FrozenDocumentServiceFactory implements IDocumentServiceFactory {
|
|
19
|
-
|
|
20
|
-
|
|
33
|
+
readonly readOnly: boolean;
|
|
34
|
+
readonly inner?: IDocumentServiceFactory | Promise<IDocumentServiceFactory> | undefined;
|
|
35
|
+
constructor(readOnly: boolean, inner?: IDocumentServiceFactory | Promise<IDocumentServiceFactory> | undefined);
|
|
21
36
|
createDocumentService(resolvedUrl: IResolvedUrl): Promise<IDocumentService>;
|
|
22
37
|
createContainer(): Promise<IDocumentService>;
|
|
23
38
|
}
|
|
24
39
|
/**
|
|
25
|
-
*
|
|
26
|
-
*
|
|
40
|
+
* Inert `IDocumentDeltaConnection` for frozen container loads. Has no server upstream:
|
|
41
|
+
* op and signal streams are empty, and `initialClients` contains only its own synthetic
|
|
42
|
+
* read-only client — which lets the connection state handler observe "self" in the audience
|
|
43
|
+
* and transition the container to Connected without waiting for a real join op or signal.
|
|
44
|
+
*
|
|
45
|
+
* Two concrete variants share this base — see their JSDoc for variant-specific details:
|
|
46
|
+
*
|
|
47
|
+
* - {@link FrozenDeltaStream} — read-only.
|
|
48
|
+
* - {@link WritableFrozenDeltaStream} — writable.
|
|
49
|
+
*
|
|
50
|
+
* Both variants nack any incoming `submit`: this connection has no upstream and
|
|
51
|
+
* `ConnectionManager.sendMessages` recognizes `WritableFrozenDeltaStream` and drops messages
|
|
52
|
+
* before they reach `submit`, so under normal flow it should never fire. A nack reaching the
|
|
53
|
+
* connectionManager surfaces the misuse — and may close the container — which is the right
|
|
54
|
+
* defensive signal that something has bypassed the expected flow.
|
|
55
|
+
*
|
|
56
|
+
* `submitSignal` is a silent no-op for both variants. Signals are ephemeral and best-effort —
|
|
57
|
+
* runtime/presence subsystems may submit them at any point in the writable-frozen lifetime, and
|
|
58
|
+
* dropping them is the correct behavior here (we have no upstream). Closing the container or
|
|
59
|
+
* triggering a reconnect on a stray signal would be strictly worse than dropping it.
|
|
27
60
|
*/
|
|
28
|
-
|
|
29
|
-
readonly
|
|
30
|
-
readonly
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
checkpointSequenceNumber?: number | undefined;
|
|
42
|
-
/**
|
|
43
|
-
* Connection which is not connected to socket.
|
|
44
|
-
* @param storageOnlyReason - Reason on why the connection to delta stream is not allowed.
|
|
45
|
-
* @param readonlyConnectionReason - reason/error if any which lead to using FrozenDeltaStream.
|
|
46
|
-
*/
|
|
47
|
-
constructor(storageOnlyReason?: string | undefined, readonlyConnectionReason?: IConnectionStateChangeReason<import("@fluidframework/core-interfaces").IErrorBase> | undefined);
|
|
61
|
+
declare abstract class FrozenDeltaStreamBase extends TypedEventEmitter<IDocumentDeltaConnectionEvents> implements IDocumentDeltaConnection, IDisposable {
|
|
62
|
+
readonly clientId: string;
|
|
63
|
+
readonly claims: ITokenClaims;
|
|
64
|
+
readonly initialClients: ISignalClient[];
|
|
65
|
+
readonly mode: ConnectionMode;
|
|
66
|
+
readonly existing: boolean;
|
|
67
|
+
readonly maxMessageSize: number;
|
|
68
|
+
readonly version: string;
|
|
69
|
+
readonly initialMessages: ISequencedDocumentMessage[];
|
|
70
|
+
readonly initialSignals: ISignalMessage[];
|
|
71
|
+
readonly serviceConfiguration: IClientConfiguration;
|
|
72
|
+
readonly checkpointSequenceNumber?: number | undefined;
|
|
73
|
+
constructor(clientId: string, claims: ITokenClaims);
|
|
48
74
|
submit(messages: IDocumentMessage[]): void;
|
|
49
|
-
submitSignal(
|
|
75
|
+
submitSignal(_message: unknown): void;
|
|
50
76
|
private _disposed;
|
|
51
77
|
get disposed(): boolean;
|
|
52
78
|
dispose(): void;
|
|
53
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* Read-only variant of {@link FrozenDeltaStreamBase}. Claims show only `DocRead`. Used by
|
|
82
|
+
* storage-only loads (where `connectionManager` synthesizes one directly via
|
|
83
|
+
* `policies.storageOnly`) and by the forbidden / out-of-storage fallback paths.
|
|
84
|
+
* {@link isFrozenDeltaStreamConnection} matches this variant and drives the read-only forcing
|
|
85
|
+
* in `ConnectionManager.readOnlyInfo`. Uses the historical `"storage-only client"` constant
|
|
86
|
+
* `clientId`, preserving existing behavior for any consumer that keys off it.
|
|
87
|
+
*
|
|
88
|
+
* `storageOnlyReason` and `readonlyConnectionReason` are surfaced through `IContainer.readOnlyInfo`
|
|
89
|
+
* for diagnostics on the fallback paths (`isDeltaStreamConnectionForbiddenError`,
|
|
90
|
+
* `outOfStorageError`).
|
|
91
|
+
*/
|
|
92
|
+
export declare class FrozenDeltaStream extends FrozenDeltaStreamBase {
|
|
93
|
+
readonly storageOnlyReason: string | undefined;
|
|
94
|
+
readonly readonlyConnectionReason: IConnectionStateChangeReason | undefined;
|
|
95
|
+
constructor(options?: {
|
|
96
|
+
storageOnlyReason?: string;
|
|
97
|
+
readonlyConnectionReason?: IConnectionStateChangeReason;
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Variant of {@link FrozenDeltaStreamBase} that appears to support writing but remains
|
|
102
|
+
* "frozen" — no messages are actually sent or received. The stream itself does not enforce
|
|
103
|
+
* the no-send guarantee; that lives in `ConnectionManager.sendMessages`, which recognizes
|
|
104
|
+
* any `WritableFrozenDeltaStream` (via {@link isWritableFrozenDeltaStreamConnection}) and
|
|
105
|
+
* short-circuits before its read-mode upgrade branch. Submitted ops are dropped at the
|
|
106
|
+
* connection-manager layer, so the container stays `Connected` and the runtime accumulates
|
|
107
|
+
* them in `pendingStateManager`.
|
|
108
|
+
*
|
|
109
|
+
* "Appears writable" mechanics: claims include `DocWrite` so the container surfaces as
|
|
110
|
+
* writable; not matched by {@link isFrozenDeltaStreamConnection}, so `readOnlyInfo` reports
|
|
111
|
+
* `readonly: false`. Connection mode stays `"read"` (advertising `"write"` would imply quorum
|
|
112
|
+
* membership we cannot honor).
|
|
113
|
+
*
|
|
114
|
+
* Each instance mints a fresh `frozen-delta-stream/<uuid>` `clientId` to avoid
|
|
115
|
+
* `pendingStateManager` `0x173` (`replayPendingStates called twice for same clientId!`) on
|
|
116
|
+
* reconnect with dirty pending ops. Sibling (not subclass) of `FrozenDeltaStream` so
|
|
117
|
+
* `instanceof` cleanly distinguishes the two for `ConnectionManager`'s short-circuits.
|
|
118
|
+
*/
|
|
119
|
+
export declare class WritableFrozenDeltaStream extends FrozenDeltaStreamBase {
|
|
120
|
+
constructor();
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Recognizes the read-only variant of {@link FrozenDeltaStreamBase}. Drives the storage-only
|
|
124
|
+
* forcing in `ConnectionManager.readOnlyInfo`: only the read-only variant should make the
|
|
125
|
+
* container surface as read-only. {@link WritableFrozenDeltaStream} is a sibling class, not
|
|
126
|
+
* a subclass, so `instanceof FrozenDeltaStream` already excludes it.
|
|
127
|
+
*/
|
|
54
128
|
export declare function isFrozenDeltaStreamConnection(connection: unknown): connection is FrozenDeltaStream;
|
|
129
|
+
/**
|
|
130
|
+
* Recognizes the writable variant of {@link FrozenDeltaStreamBase}. Drives the
|
|
131
|
+
* `ConnectionManager.sendMessages` short-circuit: writable-frozen submits must be dropped at
|
|
132
|
+
* the network layer instead of triggering a read→write reconnect. Sibling (not subclass) of
|
|
133
|
+
* {@link FrozenDeltaStream}, so `instanceof WritableFrozenDeltaStream` excludes the read-only
|
|
134
|
+
* variant.
|
|
135
|
+
*/
|
|
136
|
+
export declare function isWritableFrozenDeltaStreamConnection(connection: unknown): connection is WritableFrozenDeltaStream;
|
|
137
|
+
export {};
|
|
55
138
|
//# sourceMappingURL=frozenServices.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frozenServices.d.ts","sourceRoot":"","sources":["../src/frozenServices.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAEnE,OAAO,EAEN,KAAK,cAAc,EAEnB,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,8BAA8B,EAEnC,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EAErB,KAAK,uBAAuB,EAG5B,KAAK,YAAY,EACjB,KAAK,yBAAyB,EAC9B,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,MAAM,6CAA6C,CAAC;
|
|
1
|
+
{"version":3,"file":"frozenServices.d.ts","sourceRoot":"","sources":["../src/frozenServices.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAEnE,OAAO,EAEN,KAAK,cAAc,EAEnB,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,8BAA8B,EAEnC,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EAErB,KAAK,uBAAuB,EAG5B,KAAK,YAAY,EACjB,KAAK,yBAAyB,EAC9B,KA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