@fluidframework/container-loader 2.0.0-rc.1.0.4 → 2.0.0-rc.2.0.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/{.eslintrc.js → .eslintrc.cjs} +5 -6
- package/{.mocharc.js → .mocharc.cjs} +1 -1
- package/CHANGELOG.md +48 -0
- package/README.md +3 -3
- package/{api-extractor-esm.json → api-extractor-cjs.json} +5 -1
- package/api-extractor-lint.json +1 -1
- package/api-extractor.json +1 -1
- package/api-report/container-loader.api.md +2 -2
- package/dist/attachment.d.ts +115 -0
- package/dist/attachment.d.ts.map +1 -0
- package/dist/attachment.js +83 -0
- package/dist/attachment.js.map +1 -0
- package/dist/audience.d.ts +9 -4
- package/dist/audience.d.ts.map +1 -1
- package/dist/audience.js +10 -4
- package/dist/audience.js.map +1 -1
- package/dist/connectionManager.d.ts +3 -3
- package/dist/connectionManager.d.ts.map +1 -1
- package/dist/connectionManager.js +17 -18
- package/dist/connectionManager.js.map +1 -1
- package/dist/connectionState.d.ts +1 -0
- package/dist/connectionState.d.ts.map +1 -1
- package/dist/connectionState.js +1 -0
- package/dist/connectionState.js.map +1 -1
- package/dist/connectionStateHandler.d.ts +7 -7
- package/dist/connectionStateHandler.d.ts.map +1 -1
- package/dist/connectionStateHandler.js +32 -32
- package/dist/connectionStateHandler.js.map +1 -1
- package/dist/container-loader-alpha.d.ts +2 -1
- package/dist/container-loader-beta.d.ts +3 -0
- package/dist/container-loader-public.d.ts +3 -0
- package/dist/container-loader-untrimmed.d.ts +5 -5
- package/dist/container.d.ts +29 -27
- package/dist/container.d.ts.map +1 -1
- package/dist/container.js +219 -284
- package/dist/container.js.map +1 -1
- package/dist/containerContext.d.ts +3 -2
- package/dist/containerContext.d.ts.map +1 -1
- package/dist/containerContext.js +2 -1
- package/dist/containerContext.js.map +1 -1
- package/dist/containerStorageAdapter.d.ts +5 -6
- package/dist/containerStorageAdapter.d.ts.map +1 -1
- package/dist/containerStorageAdapter.js +14 -21
- package/dist/containerStorageAdapter.js.map +1 -1
- package/dist/contracts.d.ts +3 -3
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js.map +1 -1
- package/dist/debugLogger.js.map +1 -1
- package/dist/deltaManager.d.ts +5 -5
- package/dist/deltaManager.d.ts.map +1 -1
- package/dist/deltaManager.js +6 -6
- package/dist/deltaManager.js.map +1 -1
- package/dist/error.d.ts.map +1 -1
- package/dist/error.js.map +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -11
- package/dist/index.js.map +1 -1
- package/dist/loader.d.ts +3 -3
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +13 -17
- package/dist/loader.js.map +1 -1
- package/dist/location-redirection-utilities/index.d.ts +1 -1
- package/dist/location-redirection-utilities/index.d.ts.map +1 -1
- package/dist/location-redirection-utilities/index.js +3 -3
- package/dist/location-redirection-utilities/index.js.map +1 -1
- package/dist/package.json +3 -0
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/protocolTreeDocumentStorageService.d.ts +1 -1
- package/dist/protocolTreeDocumentStorageService.d.ts.map +1 -1
- package/dist/protocolTreeDocumentStorageService.js +1 -3
- package/dist/protocolTreeDocumentStorageService.js.map +1 -1
- package/dist/retriableDocumentStorageService.d.ts +2 -2
- package/dist/retriableDocumentStorageService.d.ts.map +1 -1
- package/dist/retriableDocumentStorageService.js +8 -6
- package/dist/retriableDocumentStorageService.js.map +1 -1
- package/dist/serializedStateManager.d.ts +44 -0
- package/dist/serializedStateManager.d.ts.map +1 -0
- package/dist/serializedStateManager.js +149 -0
- package/dist/serializedStateManager.js.map +1 -0
- package/dist/tsdoc-metadata.json +1 -1
- package/dist/utils.d.ts +16 -11
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +107 -32
- package/dist/utils.js.map +1 -1
- package/lib/attachment.d.ts +115 -0
- package/lib/attachment.d.ts.map +1 -0
- package/lib/attachment.js +79 -0
- package/lib/attachment.js.map +1 -0
- package/lib/{audience.d.mts → audience.d.ts} +14 -5
- package/lib/audience.d.ts.map +1 -0
- package/lib/{audience.mjs → audience.js} +14 -4
- package/lib/audience.js.map +1 -0
- package/lib/{catchUpMonitor.d.mts → catchUpMonitor.d.ts} +1 -1
- package/lib/catchUpMonitor.d.ts.map +1 -0
- package/lib/{catchUpMonitor.mjs → catchUpMonitor.js} +1 -1
- package/lib/catchUpMonitor.js.map +1 -0
- package/lib/{connectionManager.d.mts → connectionManager.d.ts} +4 -4
- package/lib/connectionManager.d.ts.map +1 -0
- package/lib/{connectionManager.mjs → connectionManager.js} +7 -10
- package/lib/connectionManager.js.map +1 -0
- package/lib/{connectionState.d.mts → connectionState.d.ts} +2 -1
- package/lib/connectionState.d.ts.map +1 -0
- package/lib/{connectionState.mjs → connectionState.js} +2 -1
- package/lib/connectionState.js.map +1 -0
- package/lib/{connectionStateHandler.d.mts → connectionStateHandler.d.ts} +8 -8
- package/lib/connectionStateHandler.d.ts.map +1 -0
- package/lib/{connectionStateHandler.mjs → connectionStateHandler.js} +3 -3
- package/lib/connectionStateHandler.js.map +1 -0
- package/lib/{container-loader-alpha.d.mts → container-loader-alpha.d.ts} +2 -1
- package/lib/{container-loader-beta.d.mts → container-loader-beta.d.ts} +3 -0
- package/lib/{container-loader-public.d.mts → container-loader-public.d.ts} +3 -0
- package/lib/{container-loader-untrimmed.d.mts → container-loader-untrimmed.d.ts} +5 -5
- package/lib/{container.d.mts → container.d.ts} +30 -28
- package/lib/container.d.ts.map +1 -0
- package/lib/{container.mjs → container.js} +179 -247
- package/lib/container.js.map +1 -0
- package/lib/{containerContext.d.mts → containerContext.d.ts} +4 -3
- package/lib/containerContext.d.ts.map +1 -0
- package/lib/{containerContext.mjs → containerContext.js} +3 -2
- package/lib/containerContext.js.map +1 -0
- package/lib/{containerStorageAdapter.d.mts → containerStorageAdapter.d.ts} +6 -7
- package/lib/containerStorageAdapter.d.ts.map +1 -0
- package/lib/{containerStorageAdapter.mjs → containerStorageAdapter.js} +13 -20
- package/lib/containerStorageAdapter.js.map +1 -0
- package/lib/{contracts.d.mts → contracts.d.ts} +4 -4
- package/lib/contracts.d.ts.map +1 -0
- package/lib/{contracts.mjs → contracts.js} +1 -1
- package/lib/contracts.js.map +1 -0
- package/lib/{debugLogger.d.mts → debugLogger.d.ts} +1 -1
- package/lib/debugLogger.d.ts.map +1 -0
- package/lib/{debugLogger.mjs → debugLogger.js} +2 -1
- package/lib/debugLogger.js.map +1 -0
- package/lib/{deltaManager.d.mts → deltaManager.d.ts} +6 -6
- package/lib/deltaManager.d.ts.map +1 -0
- package/lib/{deltaManager.mjs → deltaManager.js} +4 -4
- package/lib/deltaManager.js.map +1 -0
- package/lib/{deltaQueue.d.mts → deltaQueue.d.ts} +1 -1
- package/lib/deltaQueue.d.ts.map +1 -0
- package/lib/{deltaQueue.mjs → deltaQueue.js} +1 -1
- package/lib/deltaQueue.js.map +1 -0
- package/lib/{disposal.d.mts → disposal.d.ts} +1 -1
- package/lib/disposal.d.ts.map +1 -0
- package/lib/{disposal.mjs → disposal.js} +1 -1
- package/lib/disposal.js.map +1 -0
- package/lib/{error.d.mts → error.d.ts} +1 -1
- package/lib/error.d.ts.map +1 -0
- package/lib/{error.mjs → error.js} +1 -1
- package/lib/error.js.map +1 -0
- package/lib/{index.d.mts → index.d.ts} +7 -7
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +10 -0
- package/lib/index.js.map +1 -0
- package/lib/{loader.d.mts → loader.d.ts} +4 -4
- package/lib/loader.d.ts.map +1 -0
- package/lib/{loader.mjs → loader.js} +7 -11
- package/lib/loader.js.map +1 -0
- package/lib/location-redirection-utilities/{index.mjs → index.d.ts} +2 -2
- package/lib/location-redirection-utilities/index.d.ts.map +1 -0
- package/lib/location-redirection-utilities/{index.d.mts → index.js} +2 -2
- package/lib/location-redirection-utilities/index.js.map +1 -0
- package/lib/location-redirection-utilities/{resolveWithLocationRedirection.d.mts → resolveWithLocationRedirection.d.ts} +1 -1
- package/lib/location-redirection-utilities/resolveWithLocationRedirection.d.ts.map +1 -0
- package/lib/location-redirection-utilities/{resolveWithLocationRedirection.mjs → resolveWithLocationRedirection.js} +1 -1
- package/lib/location-redirection-utilities/resolveWithLocationRedirection.js.map +1 -0
- package/lib/{noopHeuristic.d.mts → noopHeuristic.d.ts} +1 -1
- package/lib/noopHeuristic.d.ts.map +1 -0
- package/lib/{noopHeuristic.mjs → noopHeuristic.js} +1 -1
- package/lib/noopHeuristic.js.map +1 -0
- package/lib/{packageVersion.d.mts → packageVersion.d.ts} +2 -2
- package/lib/packageVersion.d.ts.map +1 -0
- package/lib/{packageVersion.mjs → packageVersion.js} +2 -2
- package/lib/packageVersion.js.map +1 -0
- package/lib/{protocol.d.mts → protocol.d.ts} +1 -1
- package/lib/protocol.d.ts.map +1 -0
- package/lib/{protocol.mjs → protocol.js} +1 -1
- package/lib/protocol.js.map +1 -0
- package/lib/{protocolTreeDocumentStorageService.d.mts → protocolTreeDocumentStorageService.d.ts} +2 -2
- package/lib/protocolTreeDocumentStorageService.d.ts.map +1 -0
- package/lib/{protocolTreeDocumentStorageService.mjs → protocolTreeDocumentStorageService.js} +2 -4
- package/lib/protocolTreeDocumentStorageService.js.map +1 -0
- package/lib/{quorum.d.mts → quorum.d.ts} +5 -1
- package/lib/quorum.d.ts.map +1 -0
- package/lib/{quorum.mjs → quorum.js} +1 -1
- package/lib/quorum.js.map +1 -0
- package/lib/{retriableDocumentStorageService.d.mts → retriableDocumentStorageService.d.ts} +3 -3
- package/lib/retriableDocumentStorageService.d.ts.map +1 -0
- package/lib/{retriableDocumentStorageService.mjs → retriableDocumentStorageService.js} +10 -8
- package/lib/retriableDocumentStorageService.js.map +1 -0
- package/lib/serializedStateManager.d.ts +44 -0
- package/lib/serializedStateManager.d.ts.map +1 -0
- package/lib/serializedStateManager.js +145 -0
- package/lib/serializedStateManager.js.map +1 -0
- package/lib/test/attachment.spec.js +380 -0
- package/lib/test/attachment.spec.js.map +1 -0
- package/lib/test/catchUpMonitor.spec.js +88 -0
- package/lib/test/catchUpMonitor.spec.js.map +1 -0
- package/lib/test/connectionManager.spec.js +201 -0
- package/lib/test/connectionManager.spec.js.map +1 -0
- package/lib/test/connectionStateHandler.spec.js +555 -0
- package/lib/test/connectionStateHandler.spec.js.map +1 -0
- package/lib/test/container.spec.js +64 -0
- package/lib/test/container.spec.js.map +1 -0
- package/lib/test/deltaManager.spec.js +405 -0
- package/lib/test/deltaManager.spec.js.map +1 -0
- package/lib/test/loader.spec.js +212 -0
- package/lib/test/loader.spec.js.map +1 -0
- package/lib/test/locationRedirectionTests.spec.js +44 -0
- package/lib/test/locationRedirectionTests.spec.js.map +1 -0
- package/lib/test/serializedStateManager.spec.js +148 -0
- package/lib/test/serializedStateManager.spec.js.map +1 -0
- package/lib/test/snapshotConversionTest.spec.js +79 -0
- package/lib/test/snapshotConversionTest.spec.js.map +1 -0
- package/lib/test/types/validateContainerLoaderPrevious.generated.js +38 -0
- package/lib/test/types/validateContainerLoaderPrevious.generated.js.map +1 -0
- package/lib/test/utils.spec.js +31 -0
- package/lib/test/utils.spec.js.map +1 -0
- package/lib/{utils.d.mts → utils.d.ts} +17 -12
- package/lib/utils.d.ts.map +1 -0
- package/lib/utils.js +206 -0
- package/lib/utils.js.map +1 -0
- package/package.json +63 -63
- package/src/attachment.ts +222 -0
- package/src/audience.ts +9 -3
- package/src/connectionManager.ts +9 -11
- package/src/connectionState.ts +1 -0
- package/src/connectionStateHandler.ts +8 -7
- package/src/container.ts +297 -323
- package/src/containerContext.ts +2 -1
- package/src/containerStorageAdapter.ts +21 -26
- package/src/contracts.ts +3 -3
- package/src/debugLogger.ts +2 -2
- package/src/deltaManager.ts +8 -8
- package/src/error.ts +2 -2
- package/src/index.ts +6 -6
- package/src/loader.ts +9 -13
- package/src/location-redirection-utilities/index.ts +1 -1
- package/src/packageVersion.ts +1 -1
- package/src/protocolTreeDocumentStorageService.ts +1 -3
- package/src/retriableDocumentStorageService.ts +18 -8
- package/src/serializedStateManager.ts +217 -0
- package/src/utils.ts +140 -43
- package/tsconfig.cjs.json +7 -0
- package/tsconfig.json +2 -5
- package/lib/audience.d.mts.map +0 -1
- package/lib/audience.mjs.map +0 -1
- package/lib/catchUpMonitor.d.mts.map +0 -1
- package/lib/catchUpMonitor.mjs.map +0 -1
- package/lib/connectionManager.d.mts.map +0 -1
- package/lib/connectionManager.mjs.map +0 -1
- package/lib/connectionState.d.mts.map +0 -1
- package/lib/connectionState.mjs.map +0 -1
- package/lib/connectionStateHandler.d.mts.map +0 -1
- package/lib/connectionStateHandler.mjs.map +0 -1
- package/lib/container.d.mts.map +0 -1
- package/lib/container.mjs.map +0 -1
- package/lib/containerContext.d.mts.map +0 -1
- package/lib/containerContext.mjs.map +0 -1
- package/lib/containerStorageAdapter.d.mts.map +0 -1
- package/lib/containerStorageAdapter.mjs.map +0 -1
- package/lib/contracts.d.mts.map +0 -1
- package/lib/contracts.mjs.map +0 -1
- package/lib/debugLogger.d.mts.map +0 -1
- package/lib/debugLogger.mjs.map +0 -1
- package/lib/deltaManager.d.mts.map +0 -1
- package/lib/deltaManager.mjs.map +0 -1
- package/lib/deltaQueue.d.mts.map +0 -1
- package/lib/deltaQueue.mjs.map +0 -1
- package/lib/disposal.d.mts.map +0 -1
- package/lib/disposal.mjs.map +0 -1
- package/lib/error.d.mts.map +0 -1
- package/lib/error.mjs.map +0 -1
- package/lib/index.d.mts.map +0 -1
- package/lib/index.mjs +0 -10
- package/lib/index.mjs.map +0 -1
- package/lib/loader.d.mts.map +0 -1
- package/lib/loader.mjs.map +0 -1
- package/lib/location-redirection-utilities/index.d.mts.map +0 -1
- package/lib/location-redirection-utilities/index.mjs.map +0 -1
- package/lib/location-redirection-utilities/resolveWithLocationRedirection.d.mts.map +0 -1
- package/lib/location-redirection-utilities/resolveWithLocationRedirection.mjs.map +0 -1
- package/lib/noopHeuristic.d.mts.map +0 -1
- package/lib/noopHeuristic.mjs.map +0 -1
- package/lib/packageVersion.d.mts.map +0 -1
- package/lib/packageVersion.mjs.map +0 -1
- package/lib/protocol.d.mts.map +0 -1
- package/lib/protocol.mjs.map +0 -1
- package/lib/protocolTreeDocumentStorageService.d.mts.map +0 -1
- package/lib/protocolTreeDocumentStorageService.mjs.map +0 -1
- package/lib/quorum.d.mts.map +0 -1
- package/lib/quorum.mjs.map +0 -1
- package/lib/retriableDocumentStorageService.d.mts.map +0 -1
- package/lib/retriableDocumentStorageService.mjs.map +0 -1
- package/lib/utils.d.mts.map +0 -1
- package/lib/utils.mjs +0 -133
- package/lib/utils.mjs.map +0 -1
package/lib/contracts.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"contracts.mjs","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAGI,EAKN,cAAc,GAEd,MAAM,uCAAuC;AAY9C,MAAM,CAAN,IAAY,aAIX;AAJD,WAAY,aAAa;IACxB,gCAAe,CAAA;IACf,sCAAqB,CAAA;IACrB,oCAAmB,CAAA;AACpB,CAAC,EAJW,aAAa,KAAb,aAAa,QAIxB;AA0KD;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAC7B,WAA0C,EAClB,EAAE;IAC1B,IAAI,oBAAoB,CAAC;IACzB,IAAI,WAAW,IAAI,MAAM,IAAI,WAAW,EAAE;QACzC,oBAAoB,GAAG,WAAW,CAAC;KACnC;SAAM,IAAI,cAAc,CAAC,WAAW,EAAE,OAAO,CAAC,EAAE;QAChD,oBAAoB,GAAG,WAAW,EAAE,OAAO,CAAC,IAAI,CAAC;KACjD;SAAM;QACN,oBAAoB,GAAG,WAAW,EAAE,OAAO,CAAC;KAC5C;IACD,OAAO,EAAE,IAAI,EAAE,oBAAoB,EAAE,CAAC;AACvC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IErrorBase, ITelemetryProperties } from \"@fluidframework/core-interfaces\";\nimport {\n\tIConnectionDetails,\n\tICriticalContainerError,\n\tIDeltaQueue,\n\tIFluidCodeDetails,\n\tisFluidPackage,\n\tReadOnlyInfo,\n} from \"@fluidframework/container-definitions\";\nimport {\n\tConnectionMode,\n\tIClientConfiguration,\n\tIClientDetails,\n\tIDocumentMessage,\n\tISequencedDocumentMessage,\n\tISignalClient,\n\tISignalMessage,\n} from \"@fluidframework/protocol-definitions\";\nimport { IContainerPackageInfo } from \"@fluidframework/driver-definitions\";\n\nexport enum ReconnectMode {\n\tNever = \"Never\",\n\tDisabled = \"Disabled\",\n\tEnabled = \"Enabled\",\n}\n\nexport interface IConnectionStateChangeReason<T extends IErrorBase = IErrorBase> {\n\ttext: string;\n\terror?: T;\n}\n\n/**\n * Internal version of IConnectionDetails with props are only exposed internally\n */\nexport interface IConnectionDetailsInternal extends IConnectionDetails {\n\tmode: ConnectionMode;\n\tversion: string;\n\tinitialClients: ISignalClient[];\n\treason: IConnectionStateChangeReason;\n}\n\n/**\n * Connection manager (implements this interface) is responsible for maintaining connection\n * to relay service.\n */\nexport interface IConnectionManager {\n\treadonly connected: boolean;\n\n\treadonly clientId: string | undefined;\n\n\t/** The queue of outbound delta messages */\n\treadonly outbound: IDeltaQueue<IDocumentMessage[]>;\n\n\t/** Details of client */\n\treadonly clientDetails: IClientDetails;\n\n\t/** Protocol version being used to communicate with the service */\n\treadonly version: string;\n\n\t/** Max message size allowed to the delta manager */\n\treadonly maxMessageSize: number;\n\n\t/** Service configuration provided by the service. */\n\treadonly serviceConfiguration: IClientConfiguration | undefined;\n\n\treadonly readOnlyInfo: ReadOnlyInfo;\n\n\t// Various connectivity properties for telemetry describing type of current connection\n\t// Things like connection mode, service info, etc.\n\t// Called when connection state changes (connect / disconnect)\n\treadonly connectionProps: ITelemetryProperties;\n\n\t// Verbose information about connection logged to telemetry in case of issues with\n\t// maintaining healthy connection, including op gaps, not receiving join op in time, etc.\n\t// Contains details information, like sequence numbers at connection time, initial ops info, etc.\n\treadonly connectionVerboseProps: ITelemetryProperties;\n\n\t/**\n\t * Prepares message to be sent. Fills in clientSequenceNumber.\n\t * Called only when active connection is present.\n\t */\n\tprepareMessageToSend(\n\t\tmessage: Omit<IDocumentMessage, \"clientSequenceNumber\">,\n\t): IDocumentMessage | undefined;\n\n\t/**\n\t * Called before incoming message is processed. Incoming messages can be combing from connection,\n\t * but also could come from storage.\n\t * This call allows connection manager to adjust knowledge about acked ops sent on previous connection.\n\t * Can be called at any time, including when there is no active connection.\n\t */\n\tbeforeProcessingIncomingOp(message: ISequencedDocumentMessage): void;\n\n\t/**\n\t * Submits signal to relay service.\n\t * Called only when active connection is present.\n\t */\n\tsubmitSignal(content: any, targetClientId?: string): void;\n\n\t/**\n\t * Submits messages to relay service.\n\t * Called only when active connection is present.\n\t */\n\tsendMessages(messages: IDocumentMessage[]): void;\n\n\t/**\n\t * Initiates connection to relay service (noop if already connected).\n\t */\n\tconnect(reason: IConnectionStateChangeReason, connectionMode?: ConnectionMode): void;\n\n\t/**\n\t * Disposed connection manager\n\t */\n\tdispose(error?: ICriticalContainerError, switchToReadonly?: boolean): void;\n\n\tget connectionMode(): ConnectionMode;\n}\n\n/**\n * This interface represents a set of callbacks provided by DeltaManager to IConnectionManager on its creation\n * IConnectionManager instance will use them to communicate to DeltaManager about various events.\n */\nexport interface IConnectionManagerFactoryArgs {\n\t/**\n\t * Called by connection manager for each incoming op. Some ops maybe delivered before\n\t * connectHandler is called (initial ops on socket connection)\n\t */\n\treadonly incomingOpHandler: (messages: ISequencedDocumentMessage[], reason: string) => void;\n\n\t/**\n\t * Called by connection manager for each incoming signal.\n\t * May be called before connectHandler is called (due to initial signals on socket connection)\n\t */\n\treadonly signalHandler: (signals: ISignalMessage[]) => void;\n\n\t/**\n\t * Called when connection manager experiences delay in connecting to relay service.\n\t * This can happen because client is offline, or service is busy and asks to not connect for some time.\n\t * Can be called many times while not connected.\n\t * Situation is considered resolved when connection is established and connectHandler is called.\n\t */\n\treadonly reconnectionDelayHandler: (delayMs: number, error: unknown) => void;\n\n\t/**\n\t * Called by connection manager whenever critical error happens and container should be closed.\n\t * Expects dispose() call in response to this call.\n\t */\n\treadonly closeHandler: (error?: any) => void;\n\n\t/**\n\t * Called whenever connection to relay service is lost.\n\t */\n\treadonly disconnectHandler: (reason: IConnectionStateChangeReason) => void;\n\n\t/**\n\t * Called whenever new connection to rely service is established\n\t */\n\treadonly connectHandler: (connection: IConnectionDetailsInternal) => void;\n\n\t/**\n\t * Called whenever ping/pong messages are roundtripped on connection.\n\t */\n\treadonly pongHandler: (latency: number) => void;\n\n\t/**\n\t * Called whenever connection type changes from writable to read-only or vice versa.\n\t *\n\t * @remarks\n\t *\n\t * Connection can be read-only if user has no edit permissions, or if container forced\n\t * connection to be read-only.\n\t * This should not be confused with \"read\" / \"write\"connection mode which is internal\n\t * optimization.\n\t *\n\t * @param readonly - Whether or not the container is now read-only.\n\t * `undefined` indicates that user permissions are not yet known.\n\t * @param readonlyConnectionReason - reason/error if any for the change\n\t */\n\treadonly readonlyChangeHandler: (\n\t\treadonly?: boolean,\n\t\treadonlyConnectionReason?: IConnectionStateChangeReason,\n\t) => void;\n\n\t/**\n\t * Called whenever we try to start establishing a new connection.\n\t */\n\treadonly establishConnectionHandler: (reason: IConnectionStateChangeReason) => void;\n\n\t/**\n\t * Called whenever we cancel the connection in progress.\n\t */\n\treadonly cancelConnectionHandler: (reason: IConnectionStateChangeReason) => void;\n}\n\n/**\n *\n * @param codeDetails- - Data structure used to describe the code to load on the Fluid document\n * @returns The name of the Fluid package\n */\nexport const getPackageName = (\n\tcodeDetails: IFluidCodeDetails | undefined,\n): IContainerPackageInfo => {\n\tlet containerPackageName;\n\tif (codeDetails && \"name\" in codeDetails) {\n\t\tcontainerPackageName = codeDetails;\n\t} else if (isFluidPackage(codeDetails?.package)) {\n\t\tcontainerPackageName = codeDetails?.package.name;\n\t} else {\n\t\tcontainerPackageName = codeDetails?.package;\n\t}\n\treturn { name: containerPackageName };\n};\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"debugLogger.d.mts","sourceRoot":"","sources":["../src/debugLogger.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EACN,mBAAmB,EACnB,oBAAoB,EAEpB,MAAM,iCAAiC;OAGjC,EACN,mBAAmB,EACnB,4BAA4B,EAI5B,MAAM,iCAAiC;AAQxC;;GAEG;AACH,qBAAa,WAAY,YAAW,oBAAoB;IAwCtD,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAxC1B;;;;;;;OAOG;WACW,gBAAgB,CAC7B,SAAS,EAAE,MAAM,EACjB,UAAU,CAAC,EAAE,oBAAoB,EACjC,UAAU,CAAC,EAAE,4BAA4B,GACvC,mBAAmB;IA0BtB,OAAO;IAKP;;;;OAIG;IACI,IAAI,CAAC,KAAK,EAAE,mBAAmB,GAAG,IAAI;CA4C7C"}
|
package/lib/debugLogger.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"debugLogger.mjs","sourceRoot":"","sources":["../src/debugLogger.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAOI,EAAE,WAAW,EAAE,MAAM,8BAA8B;OAEnD,EAGN,qBAAqB,EACrB,uBAAuB,EACvB,UAAU,GACV,MAAM,iCAAiC;OAGjC,QAAQ,MAAM,OAAO;AAC5B,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,GAAG,QAAQ,CAAC;AAI1C;;GAEG;AACH,MAAM,OAAO,WAAW;IACvB;;;;;;;OAOG;IACI,MAAM,CAAC,gBAAgB,CAC7B,SAAiB,EACjB,UAAiC,EACjC,UAAyC;QAEzC,uEAAuE;QACvE,MAAM,KAAK,GAAG,aAAa,CAAC,SAAS,CAAC,CAAC;QAEvC,+CAA+C;QAC/C,uFAAuF;QACvF,MAAM,QAAQ,GAAG,aAAa,CAAC,SAA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AC,CAAC;SAC5D;QACD,QAAQ,CAAC,SAAS,GAAG,SAAS,CAAC;QAE/B,IAAI,IAAI,GAAG,EAAE,CAAC;QACd,IAAI,GAAG,QAAQ,UAAU,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC;QAE/C,8FAA8F;QAC9F,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,IAAI,EAAE,CAAC;QACnC,QAAQ,CAAC,KAAK,GAAG,SAAS,CAAC;QAE3B,qEAAqE;QACrE,wEAAwE;QACxE,sFAAsF;QACtF,IAAI,OAAe,CAAC;QACpB,IAAI;YACH,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;SACnC;QAAC,OAAO,KAAK,EAAE;YACf,QAAQ,CAAC,KAAK,GAAG,SAAS,CAAC;YAC3B,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;SACnC;QAED,IAAI,OAAO,KAAK,IAAI,EAAE;YACrB,OAAO,GAAG,EAAE,CAAC;SACb;QAED,6CAA6C;QAC7C,IAAI,OAAO,EAAE;YACZ,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC;SACtB;QAED,oBAAoB;QACpB,gEAAgE;QAChE,MAAM,CAAC,GAAG,IAAI,IAAI,OAAO,IAAI,IAAI,IAAI,KAAK,EAAE,CAAC,CAAC;IAC/C,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tITelemetryBaseEvent,\n\tITelemetryBaseLogger,\n\tITelemetryProperties,\n} from \"@fluidframework/core-interfaces\";\nimport { performance } from \"@fluid-internal/client-utils\";\n\nimport {\n\tITelemetryLoggerExt,\n\tITelemetryLoggerPropertyBags,\n\tcreateMultiSinkLogger,\n\teventNamespaceSeparator,\n\tformatTick,\n} from \"@fluidframework/telemetry-utils\";\n\n// This import style is necessary to ensure the emitted JS code works in both CJS and ESM.\nimport debugPkg from \"debug\";\nconst { debug: registerDebug } = debugPkg;\n\nimport type { IDebugger } from \"debug\";\n\n/**\n * Implementation of debug logger\n */\nexport class DebugLogger implements ITelemetryBaseLogger {\n\t/**\n\t * Mix in debug logger with another logger.\n\t * Returned logger will output events to both newly created debug logger, as well as base logger\n\t * @param namespace - Telemetry event name prefix to add to all events\n\t * @param properties - Base properties to add to all events\n\t * @param propertyGetters - Getters to add additional properties to all events\n\t * @param baseLogger - Base logger to output events (in addition to debug logger being created). Can be undefined.\n\t */\n\tpublic static mixinDebugLogger(\n\t\tnamespace: string,\n\t\tbaseLogger?: ITelemetryBaseLogger,\n\t\tproperties?: ITelemetryLoggerPropertyBags,\n\t): ITelemetryLoggerExt {\n\t\t// Setup base logger upfront, such that host can disable it (if needed)\n\t\tconst debug = registerDebug(namespace);\n\n\t\t// Create one for errors that is always enabled\n\t\t// It can be silenced by replacing console.error if the debug namespace is not enabled.\n\t\tconst debugErr = registerDebug(namespace);\n\t\tdebugErr.log = function (...args) {\n\t\t\tif (debug.enabled === true) {\n\t\t\t\t// if the namespace is enabled, just use the default logger\n\t\t\t\tregisterDebug.log(...args);\n\t\t\t} else {\n\t\t\t\t// other wise, use the console logger (which could be replaced and silenced)\n\t\t\t\tconsole.error(...args);\n\t\t\t}\n\t\t};\n\t\tdebugErr.enabled = true;\n\n\t\treturn createMultiSinkLogger({\n\t\t\tnamespace,\n\t\t\tloggers: [baseLogger, new DebugLogger(debug, debugErr)],\n\t\t\tproperties,\n\t\t\ttryInheritProperties: true,\n\t\t});\n\t}\n\n\tprivate constructor(\n\t\tprivate readonly debug: IDebugger,\n\t\tprivate readonly debugErr: IDebugger,\n\t) {}\n\n\t/**\n\t * Send an event to debug loggers\n\t *\n\t * @param event - the event to send\n\t */\n\tpublic send(event: ITelemetryBaseEvent): void {\n\t\tconst newEvent: ITelemetryProperties = { ...event };\n\t\tconst isError = newEvent.category === \"error\";\n\t\tlet logger = isError ? this.debugErr : this.debug;\n\n\t\t// Use debug's coloring schema for base of the event\n\t\tconst index = event.eventName.lastIndexOf(eventNamespaceSeparator);\n\t\tconst name = event.eventName.substring(index + 1);\n\t\tif (index > 0) {\n\t\t\tlogger = logger.extend(event.eventName.substring(0, index));\n\t\t}\n\t\tnewEvent.eventName = undefined;\n\n\t\tlet tick = \"\";\n\t\ttick = `tick=${formatTick(performance.now())}`;\n\n\t\t// Extract stack to put it last, but also to avoid escaping '\\n' in it by JSON.stringify below\n\t\tconst stack = newEvent.stack ?? \"\";\n\t\tnewEvent.stack = undefined;\n\n\t\t// Watch out for circular references - they can come from two sources\n\t\t// 1) error object - we do not control it and should remove it and retry\n\t\t// 2) properties supplied by telemetry caller - that's a bug that should be addressed!\n\t\tlet payload: string;\n\t\ttry {\n\t\t\tpayload = JSON.stringify(newEvent);\n\t\t} catch (error) {\n\t\t\tnewEvent.error = undefined;\n\t\t\tpayload = JSON.stringify(newEvent);\n\t\t}\n\n\t\tif (payload === \"{}\") {\n\t\t\tpayload = \"\";\n\t\t}\n\n\t\t// Force errors out, to help with diagnostics\n\t\tif (isError) {\n\t\t\tlogger.enabled = true;\n\t\t}\n\n\t\t// Print multi-line.\n\t\t// eslint-disable-next-line @typescript-eslint/no-base-to-string\n\t\tlogger(`${name} ${payload} ${tick} ${stack}`);\n\t}\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deltaManager.d.mts","sourceRoot":"","sources":["../src/deltaManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAGI,EACN,kBAAkB,EAClB,cAAc,EACd,oBAAoB,EACpB,oBAAoB,EAEpB,MAAM,iCAAiC;OACjC,EACN,uBAAuB,EACvB,aAAa,EACb,mBAAmB,EACnB,WAAW,EACX,MAAM,uCAAuC;OACvC,EAAE,iBAAiB,EAAE,MAAM,8BAA8B;OAEzD,EAMN,mBAAmB,EAInB,MAAM,iCAAiC;OACjC,EAEN,gBAAgB,EAEhB,MAAM,oCAAoC;OACpC,EACN,gBAAgB,EAChB,yBA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;SACjC;IACF,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { v4 as uuid } from \"uuid\";\nimport {\n\tIThrottlingWarning,\n\tIEventProvider,\n\tITelemetryProperties,\n\tITelemetryErrorEvent,\n\ttype ITelemetryBaseEvent,\n} from \"@fluidframework/core-interfaces\";\nimport {\n\tICriticalContainerError,\n\tIDeltaManager,\n\tIDeltaManagerEvents,\n\tIDeltaQueue,\n} from \"@fluidframework/container-definitions\";\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport {\n\tDataProcessingError,\n\textractSafePropertiesFromMessage,\n\tnormalizeError,\n\tsafeRaiseEvent,\n\tisFluidError,\n\tITelemetryLoggerExt,\n\tDataCorruptionError,\n\tUsageError,\n\ttype ITelemetryGenericEventExt,\n} from \"@fluidframework/telemetry-utils\";\nimport {\n\tIDocumentDeltaStorageService,\n\tIDocumentService,\n\tDriverErrorTypes,\n} from \"@fluidframework/driver-definitions\";\nimport {\n\tIDocumentMessage,\n\tISequencedDocumentMessage,\n\tISignalMessage,\n\tMessageType,\n\tConnectionMode,\n} from \"@fluidframework/protocol-definitions\";\nimport { NonRetryableError, isRuntimeMessage, MessageType2 } from \"@fluidframework/driver-utils\";\n\nimport {\n\tIConnectionDetailsInternal,\n\tIConnectionManager,\n\tIConnectionManagerFactoryArgs,\n\tIConnectionStateChangeReason,\n} from \"./contracts\";\nimport { DeltaQueue } from \"./deltaQueue\";\nimport { ThrottlingWarning } from \"./error\";\n\nexport interface IConnectionArgs {\n\tmode?: ConnectionMode;\n\tfetchOpsFromStorage?: boolean;\n\treason: IConnectionStateChangeReason;\n}\n\n/**\n * Includes events emitted by the concrete implementation DeltaManager\n * but not exposed on the public interface IDeltaManager\n */\nexport interface IDeltaManagerInternalEvents extends IDeltaManagerEvents {\n\t(event: \"throttled\", listener: (error: IThrottlingWarning) => void);\n\t(event: \"closed\" | \"disposed\", listener: (error?: ICriticalContainerError) => void);\n\t(event: \"connect\", listener: (details: IConnectionDetailsInternal, opsBehind?: number) => void);\n\t(event: \"establishingConnection\", listener: (reason: IConnectionStateChangeReason) => void);\n\t(\n\t\tevent: \"cancelEstablishingConnection\",\n\t\tlistener: (reason: IConnectionStateChangeReason) => void,\n\t);\n}\n\n/**\n * Batching makes assumptions about what might be on the metadata. This interface codifies those assumptions, but does not validate them.\n */\ninterface IBatchMetadata {\n\tbatch?: boolean;\n}\n\n/**\n * Interface used to define a strategy for handling incoming delta messages\n */\nexport interface IDeltaHandlerStrategy {\n\t/**\n\t * Processes the message.\n\t */\n\tprocess: (message: ISequencedDocumentMessage) => void;\n\n\t/**\n\t * Processes the signal.\n\t */\n\tprocessSignal: (message: ISignalMessage) => void;\n}\n\n/**\n * Determines if message was sent by client, not service\n */\nfunction isClientMessage(message: ISequencedDocumentMessage | IDocumentMessage): boolean {\n\tif (isRuntimeMessage(message)) {\n\t\treturn true;\n\t}\n\tswitch (message.type) {\n\t\tcase MessageType.Propose:\n\t\tcase MessageType.Reject:\n\t\tcase MessageType.NoOp:\n\t\tcase MessageType2.Accept:\n\t\tcase MessageType.Summarize:\n\t\t\treturn true;\n\t\tdefault:\n\t\t\treturn false;\n\t}\n}\n\n/**\n * Like assert, but logs only if the condition is false, rather than throwing\n * @param condition - The condition to attest too\n * @param logger - The logger to log with\n * @param event - The string or event to log\n * @returns The outcome of the condition\n */\nfunction logIfFalse(\n\tcondition: boolean,\n\tlogger: ITelemetryLoggerExt,\n\tevent: string | ITelemetryGenericEventExt,\n): condition is true {\n\tif (condition) {\n\t\treturn true;\n\t}\n\tconst newEvent: ITelemetryBaseEvent =\n\t\ttypeof event === \"string\"\n\t\t\t? { eventName: event, category: \"error\" }\n\t\t\t: { category: \"error\", ...event };\n\tlogger.send(newEvent);\n\treturn false;\n}\n\n/**\n * Manages the flow of both inbound and outbound messages. This class ensures that shared objects receive delta\n * messages in order regardless of possible network conditions or timings causing out of order delivery.\n */\nexport class DeltaManager<TConnectionManager extends IConnectionManager>\n\textends TypedEventEmitter<IDeltaManagerInternalEvents>\n\timplements\n\t\tIDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,\n\t\tIEventProvider<IDeltaManagerInternalEvents>\n{\n\tpublic readonly connectionManager: TConnectionManager;\n\n\tpublic get active(): boolean {\n\t\treturn this._active();\n\t}\n\n\tpublic get disposed() {\n\t\treturn this._closed;\n\t}\n\n\tpublic get IDeltaSender() {\n\t\treturn this;\n\t}\n\n\tprivate pending: ISequencedDocumentMessage[] = [];\n\tprivate fetchReason: string | undefined;\n\n\t// A boolean used to assert that ops are not being sent while processing another op.\n\tprivate currentlyProcessingOps: boolean = false;\n\n\t// The minimum sequence number and last sequence number received from the server\n\tprivate minSequenceNumber: number = 0;\n\n\t// There are three numbers we track\n\t// * lastQueuedSequenceNumber is the last queued sequence number. If there are gaps in seq numbers, then this number\n\t// is not updated until we cover that gap, so it increases each time by 1.\n\t// * lastObservedSeqNumber is an estimation of last known sequence number for container in storage. It's initially\n\t// populated at web socket connection time (if storage provides that info) and is updated once ops shows up.\n\t// It's never less than lastQueuedSequenceNumber\n\t// * lastProcessedSequenceNumber - last processed sequence number\n\tprivate lastQueuedSequenceNumber: number = 0;\n\tprivate lastObservedSeqNumber: number = 0;\n\tprivate lastProcessedSequenceNumber: number = 0;\n\tprivate lastProcessedMessage: ISequencedDocumentMessage | undefined;\n\n\t/** count number of noops sent by the client which may not be acked */\n\tprivate noOpCount: number = 0;\n\t/** Track clientSequenceNumber of the last op */\n\tprivate lastClientSequenceNumber: number = 0;\n\n\t/**\n\t * Track down the ops size.\n\t */\n\tprivate opsSize: number = 0;\n\tprivate prevEnqueueMessagesReason: string | undefined;\n\tprivate previouslyProcessedMessage: ISequencedDocumentMessage | undefined;\n\n\t// The sequence number we initially loaded from\n\t// In case of reading from a snapshot or pending state, its value will be equal to\n\t// the last message that got serialized.\n\tprivate initSequenceNumber: number = 0;\n\n\tprivate readonly _inbound: DeltaQueue<ISequencedDocumentMessage>;\n\tprivate readonly _inboundSignal: DeltaQueue<ISignalMessage>;\n\n\tprivate _closed = false;\n\tprivate _disposed = false;\n\n\tprivate handler: IDeltaHandlerStrategy | undefined;\n\tprivate deltaStorage: IDocumentDeltaStorageService | undefined;\n\n\tprivate readonly throttlingIdSet = new Set<string>();\n\tprivate timeTillThrottling: number = 0;\n\n\tpublic readonly closeAbortController = new AbortController();\n\n\tprivate readonly deltaStorageDelayId = uuid();\n\tprivate readonly deltaStreamDelayId = uuid();\n\n\tprivate messageBuffer: IDocumentMessage[] = [];\n\n\tprivate _checkpointSequenceNumber: number | undefined;\n\n\tpublic get inbound(): IDeltaQueue<ISequencedDocumentMessage> {\n\t\treturn this._inbound;\n\t}\n\n\tpublic get inboundSignal(): IDeltaQueue<ISignalMessage> {\n\t\treturn this._inboundSignal;\n\t}\n\n\tpublic get initialSequenceNumber(): number {\n\t\treturn this.initSequenceNumber;\n\t}\n\n\tpublic get lastSequenceNumber(): number {\n\t\treturn this.lastProcessedSequenceNumber;\n\t}\n\n\tpublic get lastMessage() {\n\t\treturn this.lastProcessedMessage;\n\t}\n\n\tpublic get lastKnownSeqNumber() {\n\t\treturn this.lastObservedSeqNumber;\n\t}\n\n\tpublic get minimumSequenceNumber(): number {\n\t\treturn this.minSequenceNumber;\n\t}\n\n\t/**\n\t * Tells if current connection has checkpoint information.\n\t * I.e. we know how far behind the client was at the time of establishing connection\n\t */\n\tpublic get hasCheckpointSequenceNumber() {\n\t\t// Valid to be called only if we have active connection.\n\t\tassert(this.connectionManager.connected, 0x0df /* \"Missing active connection\" */);\n\t\treturn this._checkpointSequenceNumber !== undefined;\n\t}\n\n\t// Forwarding connection manager properties / IDeltaManager implementation\n\tpublic get maxMessageSize(): number {\n\t\treturn this.connectionManager.maxMessageSize;\n\t}\n\tpublic get version() {\n\t\treturn this.connectionManager.version;\n\t}\n\tpublic get serviceConfiguration() {\n\t\treturn this.connectionManager.serviceConfiguration;\n\t}\n\tpublic get outbound() {\n\t\treturn this.connectionManager.outbound;\n\t}\n\tpublic get readOnlyInfo() {\n\t\treturn this.connectionManager.readOnlyInfo;\n\t}\n\tpublic get clientDetails() {\n\t\treturn this.connectionManager.clientDetails;\n\t}\n\n\tpublic submit(\n\t\ttype: MessageType,\n\t\tcontents?: string,\n\t\tbatch = false,\n\t\tmetadata?: any,\n\t\tcompression?: string,\n\t\treferenceSequenceNumber?: number,\n\t) {\n\t\t// Back-compat ADO:3455\n\t\tconst backCompatRefSeqNum = referenceSequenceNumber ?? this.lastProcessedSequenceNumber;\n\t\tconst messagePartial: Omit<IDocumentMessage, \"clientSequenceNumber\"> = {\n\t\t\tcontents,\n\t\t\tmetadata,\n\t\t\treferenceSequenceNumber: backCompatRefSeqNum,\n\t\t\ttype,\n\t\t\tcompression,\n\t\t};\n\n\t\tif (!batch) {\n\t\t\tthis.flush();\n\t\t}\n\t\tconst message = this.connectionManager.prepareMessageToSend(messagePartial);\n\t\tif (message === undefined) {\n\t\t\treturn -1;\n\t\t}\n\n\t\tassert(isClientMessage(message), 0x419 /* client sends non-client message */);\n\n\t\tif (contents !== undefined) {\n\t\t\tthis.opsSize += contents.length;\n\t\t}\n\n\t\tthis.messageBuffer.push(message);\n\n\t\tif (message.type === MessageType.NoOp) {\n\t\t\tthis.noOpCount++;\n\t\t}\n\n\t\tthis.emit(\"submitOp\", message);\n\n\t\tif (!batch) {\n\t\t\tthis.flush();\n\t\t}\n\t\treturn message.clientSequenceNumber;\n\t}\n\n\tpublic submitSignal(content: any, targetClientId?: string) {\n\t\treturn this.connectionManager.submitSignal(content, targetClientId);\n\t}\n\n\tpublic flush() {\n\t\tconst batch = this.messageBuffer;\n\t\tif (batch.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.messageBuffer = [];\n\n\t\t// The prepareFlush event allows listeners to append metadata to the batch prior to submission.\n\t\tthis.emit(\"prepareSend\", batch);\n\n\t\tif (batch.length === 1) {\n\t\t\tassert(\n\t\t\t\t(batch[0].metadata as IBatchMetadata)?.batch === undefined,\n\t\t\t\t0x3c9 /* no batch markup on single message */,\n\t\t\t);\n\t\t} else {\n\t\t\tassert(\n\t\t\t\t(batch[0].metadata as IBatchMetadata)?.batch === true,\n\t\t\t\t0x3ca /* no start batch markup */,\n\t\t\t);\n\t\t\tassert(\n\t\t\t\t(batch[batch.length - 1].metadata as IBatchMetadata)?.batch === false,\n\t\t\t\t0x3cb /* no end batch markup */,\n\t\t\t);\n\t\t}\n\n\t\tthis.connectionManager.sendMessages(batch);\n\n\t\tassert(this.messageBuffer.length === 0, 0x3cc /* reentrancy */);\n\t}\n\n\tpublic get connectionProps(): ITelemetryProperties {\n\t\treturn {\n\t\t\tsequenceNumber: this.lastSequenceNumber,\n\t\t\topsSize: this.opsSize > 0 ? this.opsSize : undefined,\n\t\t\tdeltaManagerState: this._disposed ? \"disposed\" : this._closed ? \"closed\" : \"open\",\n\t\t\t...this.connectionManager.connectionProps,\n\t\t};\n\t}\n\n\t/**\n\t * Log error event with a bunch of internal to DeltaManager information about state of op processing\n\t * Used to diagnose connectivity issues related to op processing (i.e. cases where for some reason\n\t * we stop processing ops that results in no processing join op and thus moving to connected state)\n\t * @param event - Event to log.\n\t */\n\tpublic logConnectionIssue(event: ITelemetryErrorEvent) {\n\t\tassert(this.connectionManager.connected, 0x238 /* \"called only in connected state\" */);\n\n\t\tconst pendingSorted = this.pending.sort((a, b) => a.sequenceNumber - b.sequenceNumber);\n\t\tthis.logger.sendTelemetryEvent({\n\t\t\t...event,\n\t\t\t// This directly tells us if fetching ops is in flight, and thus likely the reason of\n\t\t\t// stalled op processing\n\t\t\tfetchReason: this.fetchReason,\n\t\t\t// A bunch of useful sequence numbers to understand if we are holding some ops from processing\n\t\t\tlastQueuedSequenceNumber: this.lastQueuedSequenceNumber, // last sequential op\n\t\t\tlastProcessedSequenceNumber: this.lastProcessedSequenceNumber, // same as above, but after processing\n\t\t\tlastObserved: this.lastObservedSeqNumber, // last sequence we ever saw; may have gaps with above.\n\t\t\t// connection info\n\t\t\t...this.connectionManager.connectionVerboseProps,\n\t\t\tpendingOps: this.pending.length, // Do we have any pending ops?\n\t\t\tpendingFirst: pendingSorted[0]?.sequenceNumber, // is the first pending op the one that we are missing?\n\t\t\thaveHandler: this.handler !== undefined, // do we have handler installed?\n\t\t\tinboundLength: this.inbound.length,\n\t\t\tinboundPaused: this.inbound.paused,\n\t\t});\n\t}\n\n\tconstructor(\n\t\tprivate readonly serviceProvider: () => IDocumentService | undefined,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t\tprivate readonly _active: () => boolean,\n\t\tcreateConnectionManager: (props: IConnectionManagerFactoryArgs) => TConnectionManager,\n\t) {\n\t\tsuper();\n\t\tconst props: IConnectionManagerFactoryArgs = {\n\t\t\tincomingOpHandler: (messages: ISequencedDocumentMessage[], reason: string) => {\n\t\t\t\ttry {\n\t\t\t\t\tthis.enqueueMessages(messages, reason);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tthis.logger.sendErrorEvent({ eventName: \"EnqueueMessages_Exception\" }, error);\n\t\t\t\t\tthis.close(normalizeError(error));\n\t\t\t\t}\n\t\t\t},\n\t\t\tsignalHandler: (signals: ISignalMessage[]) => {\n\t\t\t\tfor (const signal of signals) {\n\t\t\t\t\tthis._inboundSignal.push(signal);\n\t\t\t\t}\n\t\t\t},\n\t\t\treconnectionDelayHandler: (delayMs: number, error: unknown) =>\n\t\t\t\tthis.emitDelayInfo(this.deltaStreamDelayId, delayMs, error),\n\t\t\tcloseHandler: (error: any) => this.close(error),\n\t\t\tdisconnectHandler: (reason: IConnectionStateChangeReason) =>\n\t\t\t\tthis.disconnectHandler(reason),\n\t\t\tconnectHandler: (connection: IConnectionDetailsInternal) =>\n\t\t\t\tthis.connectHandler(connection),\n\t\t\tpongHandler: (latency: number) => this.emit(\"pong\", latency),\n\t\t\treadonlyChangeHandler: (\n\t\t\t\treadonly?: boolean,\n\t\t\t\treadonlyConnectionReason?: IConnectionStateChangeReason,\n\t\t\t) => {\n\t\t\t\tsafeRaiseEvent(this, this.logger, \"readonly\", readonly, readonlyConnectionReason);\n\t\t\t},\n\t\t\testablishConnectionHandler: (reason: IConnectionStateChangeReason) =>\n\t\t\t\tthis.establishingConnection(reason),\n\t\t\tcancelConnectionHandler: (reason: IConnectionStateChangeReason) =>\n\t\t\t\tthis.cancelEstablishingConnection(reason),\n\t\t};\n\n\t\tthis.connectionManager = createConnectionManager(props);\n\t\tthis._inbound = new DeltaQueue<ISequencedDocumentMessage>((op) => {\n\t\t\tthis.processInboundMessage(op);\n\t\t});\n\n\t\tthis._inbound.on(\"error\", (error) => {\n\t\t\tthis.close(\n\t\t\t\tDataProcessingError.wrapIfUnrecognized(\n\t\t\t\t\terror,\n\t\t\t\t\t\"deltaManagerInboundErrorHandler\",\n\t\t\t\t\tthis.lastMessage,\n\t\t\t\t),\n\t\t\t);\n\t\t});\n\n\t\t// Inbound signal queue\n\t\tthis._inboundSignal = new DeltaQueue<ISignalMessage>((message) => {\n\t\t\tif (this.handler === undefined) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t\"Attempted to process an inbound signal without a handler attached\",\n\t\t\t\t);\n\t\t\t}\n\t\t\tthis.handler.processSignal({\n\t\t\t\tclientId: message.clientId,\n\t\t\t\tcontent: JSON.parse(message.content as string),\n\t\t\t});\n\t\t});\n\n\t\tthis._inboundSignal.on(\"error\", (error) => {\n\t\t\tthis.close(normalizeError(error));\n\t\t});\n\n\t\t// Initially, all queues are created paused.\n\t\t// - outbound is flipped back and forth in setupNewSuccessfulConnection / disconnectFromDeltaStream\n\t\t// - inbound & inboundSignal are resumed in attachOpHandler() when we have handler setup\n\t}\n\n\tprivate cancelEstablishingConnection(reason: IConnectionStateChangeReason) {\n\t\tthis.emit(\"cancelEstablishingConnection\", reason);\n\t}\n\n\tprivate establishingConnection(reason: IConnectionStateChangeReason) {\n\t\tthis.emit(\"establishingConnection\", reason);\n\t}\n\n\tprivate connectHandler(connection: IConnectionDetailsInternal) {\n\t\tthis.refreshDelayInfo(this.deltaStreamDelayId);\n\n\t\tconst props = this.connectionManager.connectionVerboseProps;\n\t\tprops.connectionLastQueuedSequenceNumber = this.lastQueuedSequenceNumber;\n\t\tprops.connectionLastObservedSeqNumber = this.lastObservedSeqNumber;\n\n\t\tconst checkpointSequenceNumber = connection.checkpointSequenceNumber;\n\t\tthis._checkpointSequenceNumber = checkpointSequenceNumber;\n\t\tif (checkpointSequenceNumber !== undefined) {\n\t\t\tthis.updateLatestKnownOpSeqNumber(checkpointSequenceNumber);\n\t\t}\n\n\t\t// We cancel all ops on lost of connectivity, and rely on DDSes to resubmit them.\n\t\t// Semantics are not well defined for batches (and they are broken right now on disconnects anyway),\n\t\t// but it's safe to assume (until better design is put into place) that batches should not exist\n\t\t// across multiple connections. Right now we assume runtime will not submit any ops in disconnected\n\t\t// state. As requirements change, so should these checks.\n\t\tassert(\n\t\t\tthis.messageBuffer.length === 0,\n\t\t\t0x0e9 /* \"messageBuffer is not empty on new connection\" */,\n\t\t);\n\n\t\tthis.opsSize = 0;\n\t\tthis.noOpCount = 0;\n\n\t\tthis.emit(\n\t\t\t\"connect\",\n\t\t\tconnection,\n\t\t\tcheckpointSequenceNumber !== undefined\n\t\t\t\t? this.lastObservedSeqNumber - this.lastSequenceNumber\n\t\t\t\t: undefined,\n\t\t);\n\n\t\t// If we got some initial ops, then we know the gap and call above fetched ops to fill it.\n\t\t// Same is true for \"write\" mode even if we have no ops - we will get \"join\" own op very very soon.\n\t\t// However if we are connecting as view-only, then there is no good signal to realize if client is behind.\n\t\t// Thus we have to hit storage to see if any ops are there.\n\t\tif (checkpointSequenceNumber !== undefined) {\n\t\t\t// We know how far we are behind (roughly). If it's non-zero gap, fetch ops right away.\n\t\t\tif (checkpointSequenceNumber > this.lastQueuedSequenceNumber) {\n\t\t\t\tthis.fetchMissingDeltas(\"AfterConnection\");\n\t\t\t}\n\t\t\t// we do not know the gap, and we will not learn about it if socket is quite - have to ask.\n\t\t} else if (connection.mode === \"read\") {\n\t\t\tthis.fetchMissingDeltas(\"AfterReadConnection\");\n\t\t}\n\t}\n\n\t/**\n\t * Sets the sequence number from which inbound messages should be returned\n\t */\n\tpublic async attachOpHandler(\n\t\tminSequenceNumber: number,\n\t\tsequenceNumber: number,\n\t\thandler: IDeltaHandlerStrategy,\n\t\tprefetchType: \"sequenceNumber\" | \"cached\" | \"all\" | \"none\" = \"none\",\n\t) {\n\t\tthis.initSequenceNumber = sequenceNumber;\n\t\tthis.lastProcessedSequenceNumber = sequenceNumber;\n\t\tthis.minSequenceNumber = minSequenceNumber;\n\t\tthis.lastQueuedSequenceNumber = sequenceNumber;\n\t\tthis.lastObservedSeqNumber = sequenceNumber;\n\n\t\t// We will use same check in other places to make sure all the seq number above are set properly.\n\t\tassert(\n\t\t\tthis.handler === undefined,\n\t\t\t0x0e2 /* \"DeltaManager already has attached op handler!\" */,\n\t\t);\n\t\tthis.handler = handler;\n\t\t// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n\t\tassert(!!(this.handler as any), 0x0e3 /* \"Newly set op handler is null/undefined!\" */);\n\n\t\t// There should be no pending fetch!\n\t\t// This API is called right after attachOpHandler by Container.load().\n\t\t// We might have connection already and it might have called fetchMissingDeltas() from\n\t\t// setupNewSuccessfulConnection. But it should do nothing, because there is no way to fetch ops before\n\t\t// we know snapshot sequence number that is set in attachOpHandler. So all such calls should be noop.\n\t\tassert(\n\t\t\tthis.fetchReason === undefined,\n\t\t\t0x268 /* \"There can't be pending fetch that early in boot sequence!\" */,\n\t\t);\n\n\t\tif (this._closed) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._inbound.resume();\n\t\tthis._inboundSignal.resume();\n\n\t\tif (prefetchType !== \"none\") {\n\t\t\tconst cacheOnly = prefetchType === \"cached\";\n\t\t\tawait this.fetchMissingDeltasCore(`DocumentOpen_${prefetchType}`, cacheOnly);\n\n\t\t\t// Keep going with fetching ops from storage once we have all cached ops in.\n\t\t\t// But do not block load and make this request async / not blocking this api.\n\t\t\t// Ops processing will start once cached ops are in and and will stop when queue is empty\n\t\t\t// (which in most cases will happen when we are done processing cached ops)\n\t\t\tif (cacheOnly) {\n\t\t\t\t// fire and forget\n\t\t\t\tthis.fetchMissingDeltas(\"PostDocumentOpen\");\n\t\t\t}\n\t\t}\n\n\t\t// Ensure there is no need to call this.processPendingOps() at the end of boot sequence\n\t\tassert(\n\t\t\tthis.fetchReason !== undefined || this.pending.length === 0,\n\t\t\t0x269 /* \"pending ops are not dropped\" */,\n\t\t);\n\t}\n\n\tpublic connect(args: IConnectionArgs) {\n\t\tconst fetchOpsFromStorage = args.fetchOpsFromStorage ?? true;\n\t\tlogIfFalse(\n\t\t\tthis.handler !== undefined || !fetchOpsFromStorage,\n\t\t\tthis.logger,\n\t\t\t\"CantFetchWithoutBaseline\",\n\t\t); // can't fetch if no baseline\n\n\t\t// Note: There is race condition here.\n\t\t// We want to issue request to storage as soon as possible, to\n\t\t// reduce latency of becoming current, thus this code here.\n\t\t// But there is no ordering between fetching OPs and connection to delta stream\n\t\t// As result, we might be behind by the time we connect to delta stream\n\t\t// In case of r/w connection, that's not an issue, because we will hear our\n\t\t// own \"join\" message and realize any gap client has in ops.\n\t\t// But for view-only connection, we have no such signal, and with no traffic\n\t\t// on the wire, we might be always behind.\n\t\t// See comment at the end of \"connect\" handler\n\t\tif (fetchOpsFromStorage) {\n\t\t\tthis.fetchMissingDeltas(args.reason.text);\n\t\t}\n\n\t\tthis.connectionManager.connect(args.reason, args.mode);\n\t}\n\n\tprivate async getDeltas(\n\t\tfrom: number, // inclusive\n\t\tto: number | undefined, // exclusive\n\t\tfetchReason: string,\n\t\tcallback: (messages: ISequencedDocumentMessage[]) => void,\n\t\tcacheOnly: boolean,\n\t) {\n\t\tconst docService = this.serviceProvider();\n\t\tif (docService === undefined) {\n\t\t\tthrow new Error(\"Delta manager is not attached\");\n\t\t}\n\n\t\tif (this.deltaStorage === undefined) {\n\t\t\tthis.deltaStorage = await docService.connectToDeltaStorage();\n\t\t}\n\n\t\tlet cancelFetch: (op: ISequencedDocumentMessage) => boolean;\n\n\t\tif (to !== undefined) {\n\t\t\tconst lastExpectedOp = to - 1; // make it inclusive!\n\n\t\t\t// It is possible that due to asynchrony (including await above), required ops were already\n\t\t\t// received through delta stream. Validate that before moving forward.\n\t\t\tif (this.lastQueuedSequenceNumber >= lastExpectedOp) {\n\t\t\t\tthis.logger.sendPerformanceEvent({\n\t\t\t\t\treason: fetchReason,\n\t\t\t\t\teventName: \"ExtraStorageCall\",\n\t\t\t\t\tearly: true,\n\t\t\t\t\tfrom,\n\t\t\t\t\tto,\n\t\t\t\t\t...this.connectionManager.connectionVerboseProps,\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Be prepared for the case where webSocket would receive the ops that we are trying to fill through\n\t\t\t// storage. Ideally it should never happen (i.e. ops on socket are always ordered, and thus once we\n\t\t\t// detected gap, this gap can't be filled in later on through websocket).\n\t\t\t// And in practice that does look like the case. The place where this code gets hit is if we lost\n\t\t\t// connection and reconnected (likely to another box), and new socket's initial ops contains these ops.\n\t\t\tcancelFetch = (op: ISequencedDocumentMessage) => op.sequenceNumber >= lastExpectedOp;\n\t\t} else {\n\t\t\t// Unbound requests are made to proactively fetch ops, but also get up to date in cases where socket\n\t\t\t// is silent (and connection is \"read\", thus we might not have any data on how far client is behind).\n\t\t\t// Once we have any op coming in from socket, we can cancel it as it's not needed any more.\n\t\t\t// That said, if we have socket connection, make sure we got ops up to checkpointSequenceNumber!\n\t\t\tcancelFetch = (op: ISequencedDocumentMessage) =>\n\t\t\t\top.sequenceNumber >= this.lastObservedSeqNumber;\n\t\t}\n\n\t\tconst controller = new AbortController();\n\t\tlet opsFromFetch = false;\n\n\t\tconst opListener = (op: ISequencedDocumentMessage) => {\n\t\t\tassert(op.sequenceNumber === this.lastQueuedSequenceNumber, 0x23a /* \"seq#'s\" */);\n\t\t\t// Ops that are coming from this request should not cancel itself.\n\t\t\t// This is useless for known ranges (to is defined) as it means request is over either way.\n\t\t\t// And it will cancel unbound request too early, not allowing us to learn where the end of the file is.\n\t\t\tif (!opsFromFetch && cancelFetch(op)) {\n\t\t\t\tcontroller.abort(\"DeltaManager getDeltas fetch cancelled\");\n\t\t\t\tthis._inbound.off(\"push\", opListener);\n\t\t\t}\n\t\t};\n\n\t\ttry {\n\t\t\tthis._inbound.on(\"push\", opListener);\n\t\t\tassert(this.closeAbortController.signal.onabort === null, 0x1e8 /* \"reentrancy\" */);\n\t\t\tthis.closeAbortController.signal.onabort = () =>\n\t\t\t\tcontroller.abort(this.closeAbortController.signal.reason);\n\n\t\t\tconst stream = this.deltaStorage.fetchMessages(\n\t\t\t\tfrom, // inclusive\n\t\t\t\tto, // exclusive\n\t\t\t\tcontroller.signal,\n\t\t\t\tcacheOnly,\n\t\t\t\tfetchReason,\n\t\t\t);\n\n\t\t\t// eslint-disable-next-line no-constant-condition\n\t\t\twhile (true) {\n\t\t\t\tconst result = await stream.read();\n\t\t\t\tif (result.done) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\ttry {\n\t\t\t\t\topsFromFetch = true;\n\t\t\t\t\tcallback(result.value);\n\t\t\t\t} finally {\n\t\t\t\t\topsFromFetch = false;\n\t\t\t\t}\n\t\t\t}\n\t\t} finally {\n\t\t\tif (controller.signal.aborted) {\n\t\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\t\teventName: \"DeltaManager_GetDeltasAborted\",\n\t\t\t\t\tfetchReason,\n\t\t\t\t\treason: controller.signal.reason,\n\t\t\t\t});\n\t\t\t}\n\t\t\tthis.closeAbortController.signal.onabort = null;\n\t\t\tthis._inbound.off(\"push\", opListener);\n\t\t\tassert(!opsFromFetch, 0x289 /* \"logic error\" */);\n\t\t}\n\t}\n\n\t/**\n\t * Closes the connection and clears inbound & outbound queues.\n\t *\n\t * Differences from dispose:\n\t * - close will trigger readonly notification\n\t * - close emits \"closed\"\n\t * - close cannot be called after dispose\n\t */\n\tpublic close(error?: ICriticalContainerError): void {\n\t\tif (this._closed) {\n\t\t\treturn;\n\t\t}\n\t\tthis._closed = true;\n\n\t\tthis.connectionManager.dispose(error, true /* switchToReadonly */);\n\t\tthis.clearQueues();\n\t\tthis.emit(\"closed\", error);\n\t}\n\n\t/**\n\t * Disposes the connection and clears the inbound & outbound queues.\n\t *\n\t * Differences from close:\n\t * - dispose will emit \"disposed\"\n\t * - dispose will remove all listeners\n\t * - dispose can be called after closure\n\t */\n\tpublic dispose(error?: Error | ICriticalContainerError): void {\n\t\tif (this._disposed) {\n\t\t\treturn;\n\t\t}\n\t\tif (error !== undefined && !isFluidError(error)) {\n\t\t\tthrow new UsageError(\"Error must be a Fluid error\");\n\t\t}\n\n\t\tthis._disposed = true;\n\t\tthis._closed = true; // We consider \"disposed\" as a further state than \"closed\"\n\n\t\tthis.connectionManager.dispose(error, false /* switchToReadonly */);\n\t\tthis.clearQueues();\n\n\t\t// This needs to be the last thing we do (before removing listeners), as it causes\n\t\t// Container to dispose context and break ability of data stores / runtime to \"hear\" from delta manager.\n\t\tthis.emit(\"disposed\", error);\n\t\tthis.removeAllListeners();\n\t}\n\n\tprivate clearQueues() {\n\t\tthis.closeAbortController.abort(\"DeltaManager is closed\");\n\n\t\tthis._inbound.clear();\n\t\tthis._inboundSignal.clear();\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-floating-promises\n\t\tthis._inbound.pause();\n\t\t// eslint-disable-next-line @typescript-eslint/no-floating-promises\n\t\tthis._inboundSignal.pause();\n\n\t\t// Drop pending messages - this will ensure catchUp() does not go into infinite loop\n\t\tthis.pending = [];\n\t}\n\n\tpublic refreshDelayInfo(id: string) {\n\t\tthis.throttlingIdSet.delete(id);\n\t\tif (this.throttlingIdSet.size === 0) {\n\t\t\tthis.timeTillThrottling = 0;\n\t\t}\n\t}\n\n\tprivate disconnectHandler(reason: IConnectionStateChangeReason) {\n\t\tthis.messageBuffer.length = 0;\n\t\tthis.emit(\"disconnect\", reason);\n\t}\n\n\t/**\n\t * Emit info about a delay in service communication on account of throttling.\n\t * @param id - Id of the connection that is delayed\n\t * @param delayMs - Duration of the delay\n\t * @param error - error object indicating the throttling\n\t */\n\tpublic emitDelayInfo(id: string, delayMs: number, error: unknown) {\n\t\tconst timeNow = Date.now();\n\t\tthis.throttlingIdSet.add(id);\n\t\tif (delayMs > 0 && timeNow + delayMs > this.timeTillThrottling) {\n\t\t\tthis.timeTillThrottling = timeNow + delayMs;\n\n\t\t\tconst throttlingWarning: IThrottlingWarning = ThrottlingWarning.wrap(\n\t\t\t\terror,\n\t\t\t\tdelayMs / 1000 /* retryAfterSeconds */,\n\t\t\t\tthis.logger,\n\t\t\t);\n\t\t\tthis.emit(\"throttled\", throttlingWarning);\n\t\t}\n\t}\n\n\t// returns parts of message (in string format) that should never change for a given message.\n\t// Used for message comparison. It attempts to avoid comparing fields that potentially may differ.\n\t// for example, it's not clear if serverMetadata or timestamp property is a property of message or server state.\n\t// We only extract the most obvious fields that are sufficient (with high probability) to detect sequence number\n\t// reuse.\n\t// Also payload goes to telemetry, so no content or anything else that shouldn't be logged for privacy reasons\n\t// Note: It's possible for a duplicate op to be broadcasted and have everything the same except the timestamp.\n\tprivate comparableMessagePayload(m: ISequencedDocumentMessage) {\n\t\treturn `${m.clientId}-${m.type}-${m.minimumSequenceNumber}-${m.referenceSequenceNumber}-${m.timestamp}`;\n\t}\n\n\tprivate enqueueMessages(\n\t\tmessages: ISequencedDocumentMessage[],\n\t\treason: string,\n\t\tallowGaps = false,\n\t): void {\n\t\tif (this.handler === undefined) {\n\t\t\t// We did not setup handler yet.\n\t\t\t// This happens when we connect to web socket faster than we get attributes for container\n\t\t\t// and thus faster than attachOpHandler() is called\n\t\t\t// this.lastProcessedSequenceNumber is still zero, so we can't rely on this.fetchMissingDeltas()\n\t\t\t// to do the right thing.\n\t\t\tthis.pending = this.pending.concat(messages);\n\t\t\treturn;\n\t\t}\n\n\t\t// Pending ops should never just hang around for nothing.\n\t\t// This invariant will stay true through this function execution,\n\t\t// so there is no need to process pending ops here.\n\t\t// It's responsibility of\n\t\t// - attachOpHandler()\n\t\t// - fetchMissingDeltas() after it's done with querying storage\n\t\tassert(\n\t\t\tthis.pending.length === 0 || this.fetchReason !== undefined,\n\t\t\t0x1e9 /* \"Pending ops\" */,\n\t\t);\n\n\t\tif (messages.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst from = messages[0].sequenceNumber;\n\t\tconst last = messages[messages.length - 1].sequenceNumber;\n\n\t\t// Report stats about missing and duplicate ops\n\t\t// This helps better understand why we fetch ops from storage, and thus may delay\n\t\t// getting current / sending ops\n\t\t// It's possible that this batch is already too late - do not bother\n\t\tif (last > this.lastQueuedSequenceNumber) {\n\t\t\tlet prev = from - 1;\n\t\t\tconst initialGap = prev - this.lastQueuedSequenceNumber;\n\t\t\tlet firstMissing: number | undefined;\n\t\t\tlet duplicate = 0;\n\t\t\tlet gap = 0;\n\n\t\t\t// Count all gaps and duplicates\n\t\t\tfor (const message of messages) {\n\t\t\t\tif (message.sequenceNumber === prev) {\n\t\t\t\t\tduplicate++;\n\t\t\t\t} else if (message.sequenceNumber !== prev + 1) {\n\t\t\t\t\tgap++;\n\t\t\t\t\tif (firstMissing === undefined) {\n\t\t\t\t\t\tfirstMissing = prev + 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tprev = message.sequenceNumber;\n\t\t\t}\n\n\t\t\tlet eventName: string | undefined;\n\n\t\t\t// Report if we found some issues\n\t\t\tif (\n\t\t\t\tduplicate !== 0 ||\n\t\t\t\t(gap !== 0 && !allowGaps) ||\n\t\t\t\t(initialGap > 0 && this.fetchReason === undefined)\n\t\t\t) {\n\t\t\t\teventName = \"enqueueMessages\";\n\t\t\t\t// Also report if we are fetching ops, and same range comes in, thus making this fetch obsolete.\n\t\t\t} else if (\n\t\t\t\tthis.fetchReason !== undefined &&\n\t\t\t\tthis.fetchReason !== reason &&\n\t\t\t\tfrom <= this.lastQueuedSequenceNumber + 1 &&\n\t\t\t\tlast > this.lastQueuedSequenceNumber\n\t\t\t) {\n\t\t\t\teventName = \"enqueueMessagesExtraFetch\";\n\t\t\t}\n\n\t\t\t// Report if there is something to report\n\t\t\t// Do not report when pending fetch is in progress, as such reporting will not\n\t\t\t// correctly take into account pending ops.\n\t\t\tif (eventName !== undefined) {\n\t\t\t\tthis.logger.sendPerformanceEvent({\n\t\t\t\t\teventName,\n\t\t\t\t\treason,\n\t\t\t\t\tpreviousReason: this.prevEnqueueMessagesReason,\n\t\t\t\t\tfrom,\n\t\t\t\t\tto: last + 1, // exclusive, being consistent with the other telemetry / APIs\n\t\t\t\t\tlength: messages.length,\n\t\t\t\t\tfetchReason: this.fetchReason,\n\t\t\t\t\tduplicate: duplicate > 0 ? duplicate : undefined,\n\t\t\t\t\tinitialGap: initialGap !== 0 ? initialGap : undefined,\n\t\t\t\t\tgap: gap > 0 ? gap : undefined,\n\t\t\t\t\tfirstMissing,\n\t\t\t\t\tdmInitialSeqNumber: this.initialSequenceNumber,\n\t\t\t\t\t...this.connectionManager.connectionVerboseProps,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\tthis.updateLatestKnownOpSeqNumber(messages[messages.length - 1].sequenceNumber);\n\n\t\tconst n = this.previouslyProcessedMessage?.sequenceNumber;\n\t\tassert(\n\t\t\tn === undefined || n === this.lastQueuedSequenceNumber,\n\t\t\t0x0ec /* \"Unexpected value for previously processed message's sequence number\" */,\n\t\t);\n\n\t\tfor (const message of messages) {\n\t\t\t// Check that the messages are arriving in the expected order\n\t\t\tif (message.sequenceNumber <= this.lastQueuedSequenceNumber) {\n\t\t\t\t// Validate that we do not have data loss, i.e. sequencing is reset and started again\n\t\t\t\t// with numbers that this client already observed before.\n\t\t\t\tif (this.previouslyProcessedMessage?.sequenceNumber === message.sequenceNumber) {\n\t\t\t\t\tconst message1 = this.comparableMessagePayload(this.previouslyProcessedMessage);\n\t\t\t\t\tconst message2 = this.comparableMessagePayload(message);\n\t\t\t\t\tif (message1 !== message2) {\n\t\t\t\t\t\tconst error = new NonRetryableError(\n\t\t\t\t\t\t\t// This looks like a data corruption but the culprit was that the file was overwritten\n\t\t\t\t\t\t\t// in storage. See PR #5882.\n\t\t\t\t\t\t\t// Likely to be an issue with Fluid Services. Content does not match previous client\n\t\t\t\t\t\t\t// knowledge about this file. If the file is overwritten for any reason, this error can be\n\t\t\t\t\t\t\t// hit. One example is that some clients could be submitting ops to two different service\n\t\t\t\t\t\t\t// instances such that the same sequence number is reused for two different ops.\n\t\t\t\t\t\t\t// pre-0.58 error message: twoMessagesWithSameSeqNumAndDifferentPayload\n\t\t\t\t\t\t\t\"Found two messages with the same sequenceNumber but different payloads. Likely to be a \" +\n\t\t\t\t\t\t\t\t\"service issue\",\n\t\t\t\t\t\t\tDriverErrorTypes.fileOverwrittenInStorage,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tclientId: this.connectionManager.clientId,\n\t\t\t\t\t\t\t\tsequenceNumber: message.sequenceNumber,\n\t\t\t\t\t\t\t\tmessage1,\n\t\t\t\t\t\t\t\tmessage2,\n\t\t\t\t\t\t\t\tdriverVersion: undefined,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t);\n\t\t\t\t\t\tthis.close(error);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (message.sequenceNumber !== this.lastQueuedSequenceNumber + 1) {\n\t\t\t\tthis.pending.push(message);\n\t\t\t\tthis.fetchMissingDeltas(reason, message.sequenceNumber);\n\t\t\t} else {\n\t\t\t\tthis.lastQueuedSequenceNumber = message.sequenceNumber;\n\t\t\t\tthis.previouslyProcessedMessage = message;\n\t\t\t\tthis._inbound.push(message);\n\t\t\t}\n\t\t}\n\n\t\t// When / if we report a gap in ops in the future, we want telemetry to correctly reflect source\n\t\t// of prior ops. But if we have some out of order ops (this.pending), then reporting current reason\n\t\t// becomes not accurate, as the gap existed before current batch, so we should just report \"unknown\".\n\t\tthis.prevEnqueueMessagesReason = this.pending.length > 0 ? \"unknown\" : reason;\n\t}\n\n\tprivate processInboundMessage(message: ISequencedDocumentMessage): void {\n\t\tconst startTime = Date.now();\n\t\tassert(!this.currentlyProcessingOps, 0x3af /* Already processing ops. */);\n\t\tthis.currentlyProcessingOps = true;\n\t\tthis.lastProcessedMessage = message;\n\n\t\tconst isString = typeof message.clientId === \"string\";\n\t\tassert(message.clientId === null || isString, 0x41a /* undefined or string */);\n\t\t// All client messages are coming from some client, and should have clientId,\n\t\t// and non-client message should not have clientId. But, there are two exceptions:\n\t\t// 1. (Legacy) We can see message.type === \"attach\" or \"chunkedOp\" for legacy files before RTM\n\t\t// 2. Non-immediate noops (contents: null) can be sent by service without clientId\n\t\tif (!isString && isClientMessage(message) && message.type !== MessageType.NoOp) {\n\t\t\tthrow new DataCorruptionError(\"Mismatch in clientId\", {\n\t\t\t\t...extractSafePropertiesFromMessage(message),\n\t\t\t\tmessageType: message.type,\n\t\t\t});\n\t\t}\n\n\t\t// TODO Remove after SPO picks up the latest build.\n\t\tif (\n\t\t\ttypeof message.contents === \"string\" &&\n\t\t\tmessage.contents !== \"\" &&\n\t\t\tmessage.type !== MessageType.ClientLeave\n\t\t) {\n\t\t\tmessage.contents = JSON.parse(message.contents);\n\t\t}\n\n\t\t// Validate client sequence number has no gap. Decrement the noOpCount by gap\n\t\t// If the count ends up negative, that means we have a real gap and throw error\n\t\tif (\n\t\t\tthis.connectionManager.clientId !== undefined &&\n\t\t\tthis.connectionManager.clientId === message.clientId\n\t\t) {\n\t\t\tif (message.type === MessageType.NoOp) {\n\t\t\t\tthis.noOpCount--;\n\t\t\t}\n\t\t\tconst clientSeqNumGap =\n\t\t\t\tmessage.clientSequenceNumber - this.lastClientSequenceNumber - 1;\n\t\t\tthis.noOpCount -= clientSeqNumGap;\n\t\t\tif (this.noOpCount < 0) {\n\t\t\t\tthrow new Error(`gap in client sequence number: ${clientSeqNumGap}`);\n\t\t\t}\n\t\t\tthis.lastClientSequenceNumber = message.clientSequenceNumber;\n\t\t}\n\n\t\tthis.connectionManager.beforeProcessingIncomingOp(message);\n\n\t\t// Watch the minimum sequence number and be ready to update as needed\n\t\tif (this.minSequenceNumber > message.minimumSequenceNumber) {\n\t\t\t// pre-0.58 error message: msnMovesBackwards\n\t\t\tthrow new DataCorruptionError(\n\t\t\t\t\"Found a lower minimumSequenceNumber (msn) than previously recorded\",\n\t\t\t\t{\n\t\t\t\t\t...extractSafePropertiesFromMessage(message),\n\t\t\t\t\tclientId: this.connectionManager.clientId,\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\n\t\t// Client ops: MSN has to be lower than sequence #, as client can continue to send ops with same\n\t\t// reference sequence number as this op.\n\t\t// System ops (when no clients are connected) are the only ops where equation is possible.\n\t\tconst diff = message.sequenceNumber - message.minimumSequenceNumber;\n\t\tif (diff < 0 || (diff === 0 && message.clientId !== null)) {\n\t\t\tthrow new DataCorruptionError(\n\t\t\t\t\"MSN has to be lower than sequence #\",\n\t\t\t\textractSafePropertiesFromMessage(message),\n\t\t\t);\n\t\t}\n\n\t\tthis.minSequenceNumber = message.minimumSequenceNumber;\n\n\t\tif (message.sequenceNumber !== this.lastProcessedSequenceNumber + 1) {\n\t\t\t// pre-0.58 error message: nonSequentialSequenceNumber\n\t\t\tthrow new DataCorruptionError(\"Found a non-Sequential sequenceNumber\", {\n\t\t\t\t...extractSafePropertiesFromMessage(message),\n\t\t\t\tclientId: this.connectionManager.clientId,\n\t\t\t});\n\t\t}\n\t\tthis.lastProcessedSequenceNumber = message.sequenceNumber;\n\n\t\t// a bunch of code assumes that this is true\n\t\tassert(\n\t\t\tthis.lastProcessedSequenceNumber <= this.lastObservedSeqNumber,\n\t\t\t0x267 /* \"lastObservedSeqNumber should be updated first\" */,\n\t\t);\n\n\t\tif (this.handler === undefined) {\n\t\t\tthrow new Error(\"Attempted to process an inbound message without a handler attached\");\n\t\t}\n\t\tthis.handler.process(message);\n\t\tthis.currentlyProcessingOps = false;\n\t\tconst endTime = Date.now();\n\n\t\t// Should be last, after changing this.lastProcessedSequenceNumber above, as many callers\n\t\t// test this.lastProcessedSequenceNumber instead of using op.sequenceNumber itself.\n\t\tthis.emit(\"op\", message, endTime - startTime);\n\t}\n\n\t/**\n\t * Retrieves the missing deltas between the given sequence numbers\n\t */\n\tprivate fetchMissingDeltas(reasonArg: string, to?: number) {\n\t\tthis.fetchMissingDeltasCore(reasonArg, false /* cacheOnly */, to).catch((error) => {\n\t\t\tthis.logger.sendErrorEvent({ eventName: \"fetchMissingDeltasException\" }, error);\n\t\t});\n\t}\n\n\t/**\n\t * Retrieves the missing deltas between the given sequence numbers\n\t */\n\tprivate async fetchMissingDeltasCore(reason: string, cacheOnly: boolean, to?: number) {\n\t\t// Exit out early if we're already fetching deltas\n\t\tif (this.fetchReason !== undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._closed) {\n\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\teventName: \"fetchMissingDeltasClosedConnection\",\n\t\t\t\treason,\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.handler === undefined) {\n\t\t\t// We do not poses yet any information\n\t\t\tassert(this.lastQueuedSequenceNumber === 0, 0x26b /* \"initial state\" */);\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tlet from = this.lastQueuedSequenceNumber + 1;\n\n\t\t\tconst n = this.previouslyProcessedMessage?.sequenceNumber;\n\t\t\tif (n !== undefined) {\n\t\t\t\t// If we already processed at least one op, then we have this.previouslyProcessedMessage populated\n\t\t\t\t// and can use it to validate that we are operating on same file, i.e. it was not overwritten.\n\t\t\t\t// Knowing about this mechanism, we could ask for op we already observed to increase validation.\n\t\t\t\t// This is especially useful when coming out of offline mode or loading from\n\t\t\t\t// very old cached (by client / driver) snapshot.\n\t\t\t\tassert(\n\t\t\t\t\tn === this.lastQueuedSequenceNumber,\n\t\t\t\t\t0x0f2 /* \"previouslyProcessedMessage\" */,\n\t\t\t\t);\n\t\t\t\tassert(from > 1, 0x0f3 /* \"not positive\" */);\n\t\t\t\tfrom--;\n\t\t\t}\n\n\t\t\tconst fetchReason = `${reason}_fetch`;\n\t\t\tthis.fetchReason = fetchReason;\n\n\t\t\tawait this.getDeltas(\n\t\t\t\tfrom,\n\t\t\t\tto,\n\t\t\t\tfetchReason,\n\t\t\t\t(messages) => {\n\t\t\t\t\tthis.refreshDelayInfo(this.deltaStorageDelayId);\n\t\t\t\t\tthis.enqueueMessages(messages, fetchReason);\n\t\t\t\t},\n\t\t\t\tcacheOnly,\n\t\t\t);\n\t\t} catch (error) {\n\t\t\tthis.logger.sendErrorEvent({ eventName: \"GetDeltas_Exception\" }, error);\n\t\t\tthis.close(normalizeError(error));\n\t\t} finally {\n\t\t\tthis.refreshDelayInfo(this.deltaStorageDelayId);\n\t\t\tthis.fetchReason = undefined;\n\t\t\tthis.processPendingOps(reason);\n\t\t}\n\t}\n\n\t/**\n\t * Sorts pending ops and attempts to apply them\n\t */\n\tprivate processPendingOps(reason?: string): void {\n\t\tif (this._closed) {\n\t\t\treturn;\n\t\t}\n\n\t\tassert(this.handler !== undefined, 0x26c /* \"handler should be installed\" */);\n\n\t\tconst pendingSorted = this.pending.sort((a, b) => a.sequenceNumber - b.sequenceNumber);\n\t\tthis.pending = [];\n\t\t// Given that we do not track where these ops came from any more, it's not very\n\t\t// actionably to report gaps in this range.\n\t\tthis.enqueueMessages(pendingSorted, `${reason}_pending`, true /* allowGaps */);\n\n\t\t// Re-entrancy is ignored by fetchMissingDeltas, execution will come here when it's over\n\t\tif (this.fetchReason === undefined) {\n\t\t\t// See issue #7312 for more details\n\t\t\t// We observe cases where client gets into situation where it is not aware of missing ops\n\t\t\t// (i.e. client being behind), and as such, does not attempt to fetch them.\n\t\t\t// In some cases client may not have enough signal (example - \"read\" connection that is silent -\n\t\t\t// there is no easy way for client to realize it's behind, see a bit of commentary / logic at the\n\t\t\t// end of setupNewSuccessfulConnection). In other cases it should be able to learn that info (\"write\"\n\t\t\t// connection, learn by receiving its own join op), but data suggest it does not happen.\n\t\t\t// In 50% of these cases we do know we are behind through checkpointSequenceNumber on connection object\n\t\t\t// and thus can leverage that to trigger recovery. But this is not going to solve all the problems\n\t\t\t// (the other 50%), and thus these errors below should be looked at even if code below results in\n\t\t\t// recovery.\n\t\t\tif (this.lastQueuedSequenceNumber < this.lastObservedSeqNumber) {\n\t\t\t\tthis.fetchMissingDeltas(\"OpsBehind\");\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate updateLatestKnownOpSeqNumber(seq: number) {\n\t\tif (this.lastObservedSeqNumber < seq) {\n\t\t\tthis.lastObservedSeqNumber = seq;\n\t\t}\n\t}\n}\n"]}
|
package/lib/deltaQueue.d.mts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deltaQueue.d.mts","sourceRoot":"","sources":["../src/deltaQueue.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,uCAAuC;OAE/E,EAAe,iBAAiB,EAAE,MAAM,8BAA8B;AAG7E,MAAM,WAAW,iBAAiB,CAAC,CAAC;IACnC,IAAI,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC;IACpB,KAAK,IAAI,IAAI,CAAC;CACd;AAED,qBAAa,UAAU,CAAC,CAAC,CACxB,SAAQ,iBAAiB,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAC9C,YAAW,WAAW,CAAC,CAAC,CAAC,EAAE,iBAAiB,CAAC,CAAC,CAAC;IA6CnC,OAAO,CAAC,QAAQ,CAAC,MAAM;IA3CnC,OAAO,CAAC,UAAU,CAAkB;IACpC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAkB;IAEpC;;;OAGG;IACH,OAAO,CAAC,UAAU,CAAK;IAEvB,OAAO,CAAC,KAAK,CAAkB;IAE/B;;;OAGG;IACH,OAAO,CAAC,iBAAiB,CAA2D;IAEpF,IAAW,QAAQ,IAAI,OAAO,CAE7B;IAED;;OAEG;IACH,IAAW,MAAM,IAAI,OAAO,CAE3B;IAED,IAAW,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C;QAChC,IAAI,KAAK,GAAG,CAAC,CAAC;QAEd,8FAA8F;QAC9F,0FAA0F;QAC1F,OAAO,IAAI,CAAC,iBAAiB,EAAE,EAAE;YAChC,oCAAoC;YACpC,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC;YAC5B,KAAK,EAAE,CAAC;YACR,uBAAuB;YACvB,8EAA8E;YAC9E,oEAAoE;YACpE,IAAI,CAAC,MAAM,CAAC,IAAK,CAAC,CAAC;YACnB,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;SACtB;QAED,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC;QAC3C,IAAI,IAAI,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE;YACxB,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;SACnC;QACD,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;IAC5B,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IDeltaQueue, IDeltaQueueEvents } from \"@fluidframework/container-definitions\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport { performance, TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport Deque from \"double-ended-queue\";\n\nexport interface IDeltaQueueWriter<T> {\n\tpush(task: T): void;\n\tclear(): void;\n}\n\nexport class DeltaQueue<T>\n\textends TypedEventEmitter<IDeltaQueueEvents<T>>\n\timplements IDeltaQueue<T>, IDeltaQueueWriter<T>\n{\n\tprivate isDisposed: boolean = false;\n\tprivate readonly q = new Deque<T>();\n\n\t/**\n\t * Tracks the number of pause requests for the queue.\n\t * The DeltaQueue is created initially paused.\n\t */\n\tprivate pauseCount = 1;\n\n\tprivate error: any | undefined;\n\n\t/**\n\t * When processing is ongoing, holds a deferred that will resolve once processing stops.\n\t * Undefined when not processing.\n\t */\n\tprivate processingPromise: Promise<{ count: number; duration: number }> | undefined;\n\n\tpublic get disposed(): boolean {\n\t\treturn this.isDisposed;\n\t}\n\n\t/**\n\t * @returns True if the queue is paused, false if not.\n\t */\n\tpublic get paused(): boolean {\n\t\treturn this.pauseCount !== 0;\n\t}\n\n\tpublic get length(): number {\n\t\treturn this.q.length;\n\t}\n\n\tpublic get idle(): boolean {\n\t\treturn this.processingPromise === undefined && this.q.length === 0;\n\t}\n\n\tpublic async waitTillProcessingDone() {\n\t\treturn this.processingPromise ?? { count: 0, duration: 0 };\n\t}\n\n\t/**\n\t * @param worker - A callback to process a delta.\n\t */\n\tconstructor(private readonly worker: (delta: T) => void) {\n\t\tsuper();\n\t}\n\n\tpublic dispose() {\n\t\tthrow new Error(\"Not implemented.\");\n\t\tthis.isDisposed = true;\n\t}\n\n\tpublic clear(): void {\n\t\tthis.q.clear();\n\t}\n\n\tpublic peek(): T | undefined {\n\t\treturn this.q.peekFront();\n\t}\n\n\tpublic toArray(): T[] {\n\t\treturn this.q.toArray();\n\t}\n\n\tpublic push(task: T) {\n\t\ttry {\n\t\t\tthis.q.push(task);\n\t\t\tthis.emit(\"push\", task);\n\t\t\tthis.ensureProcessing();\n\t\t} catch (error) {\n\t\t\tthis.emit(\"error\", error);\n\t\t}\n\t}\n\n\tpublic async pause(): Promise<void> {\n\t\tthis.pauseCount++;\n\t\t// If called from within the processing loop, we are in the middle of processing an op. Return a promise\n\t\t// that will resolve when processing has actually stopped.\n\t\tawait this.waitTillProcessingDone();\n\t}\n\n\tpublic resume(): void {\n\t\tassert(this.pauseCount > 0, 0x0f4 /* \"Nonzero pause-count on resume()\" */);\n\t\tthis.pauseCount--;\n\t\tthis.ensureProcessing();\n\t}\n\n\t/**\n\t * There are several actions that may need to kick off delta processing, so we want to guard against\n\t * accidental reentrancy. ensureProcessing can be called safely to start the processing loop if it is\n\t * not already started.\n\t */\n\tprivate ensureProcessing() {\n\t\tif (this.anythingToProcess() && this.processingPromise === undefined) {\n\t\t\t// Use a resolved promise to start the processing on a separate stack.\n\t\t\tthis.processingPromise = Promise.resolve()\n\t\t\t\t.then(() => {\n\t\t\t\t\tassert(this.processingPromise !== undefined, 0x37f /* reentrancy? */);\n\t\t\t\t\tconst result = this.processDeltas();\n\t\t\t\t\tassert(this.processingPromise !== undefined, 0x380 /* reentrancy? */);\n\t\t\t\t\t// WARNING: Do not move next line to .finally() clause!\n\t\t\t\t\t// It runs async and creates a race condition where incoming ensureProcessing() call observes\n\t\t\t\t\t// from previous run while previous run is over (but finally clause was not scheduled yet)\n\t\t\t\t\tthis.processingPromise = undefined;\n\t\t\t\t\treturn result;\n\t\t\t\t})\n\t\t\t\t.catch((error) => {\n\t\t\t\t\tthis.error = error;\n\t\t\t\t\tthis.processingPromise = undefined;\n\t\t\t\t\tthis.emit(\"error\", error);\n\t\t\t\t\treturn { count: 0, duration: 0 };\n\t\t\t\t});\n\t\t\tassert(\n\t\t\t\tthis.processingPromise !== undefined,\n\t\t\t\t0x381 /* processDeltas() should run async */,\n\t\t\t);\n\t\t}\n\t}\n\n\tprivate anythingToProcess() {\n\t\treturn this.q.length !== 0 && !this.paused && this.error === undefined;\n\t}\n\n\t/**\n\t * Executes the delta processing loop until a stop condition is reached.\n\t */\n\tprivate processDeltas() {\n\t\tconst start = performance.now();\n\t\tlet count = 0;\n\n\t\t// For grouping to work we must process all local messages immediately and in the single turn.\n\t\t// So loop over them until no messages to process, we have become paused, or hit an error.\n\t\twhile (this.anythingToProcess()) {\n\t\t\t// Get the next message in the queue\n\t\t\tconst next = this.q.shift();\n\t\t\tcount++;\n\t\t\t// Process the message.\n\t\t\t// We know next is defined since we did a length check just prior to shifting.\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tthis.worker(next!);\n\t\t\tthis.emit(\"op\", next);\n\t\t}\n\n\t\tconst duration = performance.now() - start;\n\t\tif (this.q.length === 0) {\n\t\t\tthis.emit(\"idle\", count, duration);\n\t\t}\n\t\treturn { count, duration };\n\t}\n}\n"]}
|
package/lib/disposal.d.mts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"disposal.d.mts","sourceRoot":"","sources":["../src/disposal.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,WAAW,EAAE,MAAM,iCAAiC;AAE7D;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAChC,UAAU,EAAE,WAAW,EACvB,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,GACtB,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAQvB"}
|
package/lib/disposal.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"disposal.mjs","sourceRoot":"","sources":["../src/disposal.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAC9B,UAAuB,EACvB,CAAwB;IAExB,OAAO,CAAC,GAAG,IAAW,EAAK,EAAE;QAC5B,IAAI,UAAU,CAAC,QAAQ,EAAE;YACxB,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;SACpC;aAAM;YACN,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;SAClB;IACF,CAAC,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IDisposable } from \"@fluidframework/core-interfaces\";\n\n/**\n * Returns a wrapper around the provided function, which will only invoke the inner function if the provided\n * {@link @fluidframework/core-interfaces#IDisposable | disposable} object has not yet been disposed.\n *\n * @throws Will throw an error if the item has already been disposed.\n */\nexport function doIfNotDisposed<T>(\n\tdisposable: IDisposable,\n\tf: (...args: any[]) => T,\n): (...args: any[]) => T {\n\treturn (...args: any[]): T => {\n\t\tif (disposable.disposed) {\n\t\t\tthrow new Error(\"Already disposed\");\n\t\t} else {\n\t\t\treturn f(...args);\n\t\t}\n\t};\n}\n"]}
|
package/lib/error.d.mts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"error.d.mts","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAwB,kBAAkB,EAAE,MAAM,iCAAiC;OAEnF,EACN,eAAe,EACf,mBAAmB,EACnB,YAAY,EAEZ,MAAM,iCAAiC;AAExC;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,YAAa,YAAW,kBAAkB,EAAE,eAAe;IAQhG,QAAQ,CAAC,iBAAiB,EAAE,MAAM;IAPnC;;OAEG;IACH,SAAgB,SAAS,oBAAuC;IAEhE,OAAO;IAQP;;;OAGG;WACW,IAAI,CACjB,KAAK,EAAE,OAAO,EACd,iBAAiB,EAAE,MAAM,EACzB,MAAM,EAAE,mBAAmB,GACzB,kBAAkB;CAIrB"}
|
package/lib/error.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"error.mjs","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAGI,EAAE,mBAAmB,EAAE,MAAM,uCAAuC;OACpE,EAGN,YAAY,EACZ,eAAe,GACf,MAAM,iCAAiC;AAExC;;GAEG;AACH,MAAM,OAAO,iBAAkB,SAAQ,YAAY;IAMlD,YACC,OAAe,EACN,iBAAyB,EAClC,KAA4B;QAE5B,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAHb,sBAAiB,GAAjB,iBAAiB,CAAQ;QAPnC;;WAEG;QACa,cAAS,GAAG,mBAAmB,CAAC,eAAe,CAAC;IAQhE,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,IAAI,CACjB,KAAc,EACd,iBAAyB,EACzB,MAA2B;QAE3B,MAAM,UAAU,GAAG,CAAC,MAAc,EAAE,EAAE,CAAC,IAAI,iBAAiB,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;QACxF,OAAO,eAAe,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;IACnD,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryProperties, IThrottlingWarning } from \"@fluidframework/core-interfaces\";\nimport { ContainerErrorTypes } from \"@fluidframework/container-definitions\";\nimport {\n\tIFluidErrorBase,\n\tITelemetryLoggerExt,\n\tLoggingError,\n\twrapErrorAndLog,\n} from \"@fluidframework/telemetry-utils\";\n\n/**\n * Warning emitted when requests to storage are being throttled.\n */\nexport class ThrottlingWarning extends LoggingError implements IThrottlingWarning, IFluidErrorBase {\n\t/**\n\t * {@inheritDoc @fluidframework/telemetry-utils#IFluidErrorBase.errorType}\n\t */\n\tpublic readonly errorType = ContainerErrorTypes.throttlingError;\n\n\tprivate constructor(\n\t\tmessage: string,\n\t\treadonly retryAfterSeconds: number,\n\t\tprops?: ITelemetryProperties,\n\t) {\n\t\tsuper(message, props);\n\t}\n\n\t/**\n\t * Wrap the given error as a ThrottlingWarning\n\t * Only preserves the error message, and applies the given retry after to the new warning object\n\t */\n\tpublic static wrap(\n\t\terror: unknown,\n\t\tretryAfterSeconds: number,\n\t\tlogger: ITelemetryLoggerExt,\n\t): IThrottlingWarning {\n\t\tconst newErrorFn = (errMsg: string) => new ThrottlingWarning(errMsg, retryAfterSeconds);\n\t\treturn wrapErrorAndLog(error, newErrorFn, logger);\n\t}\n}\n"]}
|
package/lib/index.d.mts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,eAAe,EAAE;OACnB,EAAE,sBAAsB,EAAE,sBAAsB,EAAE;OAClD,EACN,kBAAkB,EAClB,oBAAoB,EACpB,uBAAuB,EACvB,cAAc,EACd,YAAY,EACZ,eAAe,EACf,MAAM,GACN;OACM,EACN,0BAA0B,EAC1B,sCAAsC,GACtC;OACM,EAAE,gBAAgB,EAAE,sBAAsB,EAAE;OAC5C,EAAE,6BAA6B,EAAE,UAAU,EAAE"}
|
package/lib/index.mjs
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
export { ConnectionState } from "./connectionState.mjs";
|
|
6
|
-
export { waitContainerToCatchUp } from "./container.mjs";
|
|
7
|
-
export { Loader, } from "./loader.mjs";
|
|
8
|
-
export { isLocationRedirectionError, resolveWithLocationRedirectionHandling, } from "./location-redirection-utilities/index.mjs";
|
|
9
|
-
export { tryParseCompatibleResolvedUrl } from "./utils.mjs";
|
|
10
|
-
//# sourceMappingURL=index.mjs.map
|
package/lib/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,eAAe,EAAE;OACnB,EAA0B,sBAAsB,EAAE;OAClD,EAON,MAAM,GACN;OACM,EACN,0BAA0B,EAC1B,sCAAsC,GACtC;OAEM,EAAE,6BAA6B,EAAc","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { ConnectionState } from \"./connectionState\";\nexport { IContainerExperimental, waitContainerToCatchUp } from \"./container\";\nexport {\n\tICodeDetailsLoader,\n\tIDetachedBlobStorage,\n\tIFluidModuleWithDetails,\n\tILoaderOptions,\n\tILoaderProps,\n\tILoaderServices,\n\tLoader,\n} from \"./loader\";\nexport {\n\tisLocationRedirectionError,\n\tresolveWithLocationRedirectionHandling,\n} from \"./location-redirection-utilities\";\nexport { IProtocolHandler, ProtocolHandlerBuilder } from \"./protocol\";\nexport { tryParseCompatibleResolvedUrl, IParsedUrl } from \"./utils\";\n"]}
|
package/lib/loader.d.mts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.mts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAGI,EACN,mBAAmB,EAOnB,MAAM,iCAAiC;OACjC,EACN,oBAAoB,EACpB,WAAW,EACX,QAAQ,EACR,mBAAmB,EACnB,MAAM,iCAAiC;OACjC,EACN,UAAU,EACV,YAAY,EACZ,WAAW,EACX,OAAO,EACP,cAAc,IAAI,eAAe,EAEjC,gCAAgC,EAChC,iBAAiB,EACjB,MAAM,uCAAuC;OACvC,EACN,uBAAuB,EACvB,uBAAuB,EAEvB,YAAY,EACZ,MAAM,oCAAoC;OACpC,EAAE,cAAc,EAAE,MAAM,sCAAsC;OAC9D,EAAE,SAAS,EAA0B;OAGrC,EAAE,sBAAsB,EAAE;AAUjC;;GAEG;AACH,qBAAa,cAAe,YAAW,OAAO;IAE5C,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,MAAM;gBADN,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,OAAO,GAAG,SAAS;IAGhC,OAAO,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC;CAsB5D;AAED;;GAEG;AACH,MAAM,WAAW,cAAe,SAAQ,eAAe;IACtD,qBAAqB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED;;;;;;GAMG;AACH,MAAM,WAAW,uBAAuB;IACvC,yGAAyG;IACzG,MAAM,EAAE,YAAY,CAAC;IACrB;;;;OAIG;IACH,OAAO,EAAE,iBAAiB,CAAC;CAC3B;AAED;;;;;;GAMG;AACH,MAAM,WAAW,kBAAmB,SAAQ,OAAO,CAAC,gCAAgC,CAAC;IACpF;;;;;OAKG;IACH,IAAI,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;CAClE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EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,YAAY,CAAC,cAAc,CAAC;SACpE,EACD;YACC,YAAY,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,YAAY,CAAC,SAAS,CAAC;YACvD,qBAAqB,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,YAAY,CAAC,aAAa,CAAC;YACpE,GAAG,IAAI,CAAC,QAAQ;SAChB,CACD,CAAC;IACH,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { v4 as uuid } from \"uuid\";\nimport {\n\tITelemetryLoggerExt,\n\tmixinMonitoringContext,\n\tMonitoringContext,\n\tPerformanceEvent,\n\tsessionStorageConfigProvider,\n\tcreateChildMonitoringContext,\n\tUsageError,\n} from \"@fluidframework/telemetry-utils\";\nimport {\n\tITelemetryBaseLogger,\n\tFluidObject,\n\tIRequest,\n\tIConfigProviderBase,\n} from \"@fluidframework/core-interfaces\";\nimport {\n\tIContainer,\n\tIFluidModule,\n\tIHostLoader,\n\tILoader,\n\tILoaderOptions as ILoaderOptions1,\n\tLoaderHeader,\n\tIProvideFluidCodeDetailsComparer,\n\tIFluidCodeDetails,\n} from \"@fluidframework/container-definitions\";\nimport {\n\tIDocumentServiceFactory,\n\tIDocumentStorageService,\n\tIResolvedUrl,\n\tIUrlResolver,\n} from \"@fluidframework/driver-definitions\";\nimport { IClientDetails } from \"@fluidframework/protocol-definitions\";\nimport { Container, IPendingContainerState } from \"./container\";\nimport { IParsedUrl, tryParseCompatibleResolvedUrl } from \"./utils\";\nimport { pkgVersion } from \"./packageVersion\";\nimport { ProtocolHandlerBuilder } from \"./protocol\";\nimport { DebugLogger } from \"./debugLogger\";\n\nfunction ensureResolvedUrlDefined(\n\tresolved: IResolvedUrl | undefined,\n): asserts resolved is IResolvedUrl {\n\tif (resolved === undefined) {\n\t\tthrow new Error(`Object is not a IResolveUrl.`);\n\t}\n}\n/**\n * @internal\n */\nexport class RelativeLoader implements ILoader {\n\tconstructor(\n\t\tprivate readonly container: Container,\n\t\tprivate readonly loader: ILoader | undefined,\n\t) {}\n\n\tpublic async resolve(request: IRequest): Promise<IContainer> {\n\t\tif (request.url.startsWith(\"/\")) {\n\t\t\tensureResolvedUrlDefined(this.container.resolvedUrl);\n\t\t\tconst container = await this.container.clone(\n\t\t\t\t{\n\t\t\t\t\tresolvedUrl: { ...this.container.resolvedUrl },\n\t\t\t\t\tversion: request.headers?.[LoaderHeader.version] ?? undefined,\n\t\t\t\t\tloadMode: request.headers?.[LoaderHeader.loadMode],\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tcanReconnect: request.headers?.[LoaderHeader.reconnect],\n\t\t\t\t\tclientDetailsOverride: request.headers?.[LoaderHeader.clientDetails],\n\t\t\t\t},\n\t\t\t);\n\t\t\treturn container;\n\t\t}\n\n\t\tif (this.loader === undefined) {\n\t\t\tthrow new Error(\"Cannot resolve external containers\");\n\t\t}\n\t\treturn this.loader.resolve(request);\n\t}\n}\n\n/**\n * @alpha\n */\nexport interface ILoaderOptions extends ILoaderOptions1 {\n\tsummarizeProtocolTree?: boolean;\n}\n\n/**\n * @deprecated IFluidModuleWithDetails interface is moved to\n * {@link @fluidframework/container-definitions#IFluidModuleWithDetails}\n * to have all the code loading modules in one package. #8193\n * Encapsulates a module entry point with corresponding code details.\n * @alpha\n */\nexport interface IFluidModuleWithDetails {\n\t/** Fluid code module that implements the runtime factory needed to instantiate the container runtime. */\n\tmodule: IFluidModule;\n\t/**\n\t * Code details associated with the module. Represents a document schema this module supports.\n\t * If the code loader implements the {@link @fluidframework/core-interfaces#IFluidCodeDetailsComparer} interface,\n\t * it'll be called to determine whether the module code details satisfy the new code proposal in the quorum.\n\t */\n\tdetails: IFluidCodeDetails;\n}\n\n/**\n * @deprecated ICodeDetailsLoader interface is moved to {@link @fluidframework/container-definition#ICodeDetailsLoader}\n * to have code loading modules in one package. #8193\n * Fluid code loader resolves a code module matching the document schema, i.e. code details, such as\n * a package name and package version range.\n * @alpha\n */\nexport interface ICodeDetailsLoader extends Partial<IProvideFluidCodeDetailsComparer> {\n\t/**\n\t * Load the code module (package) that is capable to interact with the document.\n\t *\n\t * @param source - Code proposal that articulates the current schema the document is written in.\n\t * @returns Code module entry point along with the code details associated with it.\n\t */\n\tload(source: IFluidCodeDetails): Promise<IFluidModuleWithDetails>;\n}\n\n/**\n * Services and properties necessary for creating a loader\n * @alpha\n */\nexport interface ILoaderProps {\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 used by various layers\n\t * to control features\n\t */\n\treadonly options?: ILoaderOptions;\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;\n\n\t/**\n\t * The logger that all telemetry should be pushed to.\n\t */\n\treadonly logger?: ITelemetryBaseLogger;\n\n\t/**\n\t * Blobs storage for detached containers.\n\t */\n\treadonly detachedBlobStorage?: IDetachedBlobStorage;\n\n\t/**\n\t * The configuration provider which may be used to control features.\n\t */\n\treadonly configProvider?: IConfigProviderBase;\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;\n}\n\n/**\n * Services and properties used by and exposed by the loader\n * @alpha\n */\nexport interface ILoaderServices {\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 used by various layers\n\t * to control features\n\t */\n\treadonly options: ILoaderOptions;\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;\n\n\t/**\n\t * The logger downstream consumers should construct their loggers from\n\t */\n\treadonly subLogger: ITelemetryLoggerExt;\n\n\t/**\n\t * Blobs storage for detached containers.\n\t */\n\treadonly detachedBlobStorage?: IDetachedBlobStorage;\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;\n}\n\n/**\n * Subset of IDocumentStorageService which only supports createBlob() and readBlob(). This is used to support\n * blobs in detached containers.\n * @alpha\n */\nexport type IDetachedBlobStorage = Pick<IDocumentStorageService, \"createBlob\" | \"readBlob\"> & {\n\tsize: number;\n\t/**\n\t * Return an array of all blob IDs present in storage\n\t */\n\tgetBlobIds(): string[];\n};\n\n/**\n * Manages Fluid resource loading\n * @alpha\n */\nexport class Loader implements IHostLoader {\n\tpublic readonly services: ILoaderServices;\n\tprivate readonly mc: MonitoringContext;\n\n\tconstructor(loaderProps: ILoaderProps) {\n\t\tconst {\n\t\t\turlResolver,\n\t\t\tdocumentServiceFactory,\n\t\t\tcodeLoader,\n\t\t\toptions,\n\t\t\tscope,\n\t\t\tlogger,\n\t\t\tdetachedBlobStorage,\n\t\t\tconfigProvider,\n\t\t\tprotocolHandlerBuilder,\n\t\t} = loaderProps;\n\n\t\tconst telemetryProps = {\n\t\t\tloaderId: uuid(),\n\t\t\tloaderVersion: pkgVersion,\n\t\t};\n\n\t\tconst subMc = mixinMonitoringContext(\n\t\t\tDebugLogger.mixinDebugLogger(\"fluid:telemetry\", logger, {\n\t\t\t\tall: telemetryProps,\n\t\t\t}),\n\t\t\tsessionStorageConfigProvider.value,\n\t\t\tconfigProvider,\n\t\t);\n\n\t\tthis.services = {\n\t\t\turlResolver,\n\t\t\tdocumentServiceFactory,\n\t\t\tcodeLoader,\n\t\t\toptions: options ?? {},\n\t\t\tscope:\n\t\t\t\toptions?.provideScopeLoader !== false ? { ...scope, ILoader: this } : { ...scope },\n\t\t\tdetachedBlobStorage,\n\t\t\tprotocolHandlerBuilder,\n\t\t\tsubLogger: subMc.logger,\n\t\t};\n\t\tthis.mc = createChildMonitoringContext({\n\t\t\tlogger: this.services.subLogger,\n\t\t\tnamespace: \"Loader\",\n\t\t});\n\t}\n\n\tpublic async createDetachedContainer(\n\t\tcodeDetails: IFluidCodeDetails,\n\t\tcreateDetachedProps?: {\n\t\t\tcanReconnect?: boolean;\n\t\t\tclientDetailsOverride?: IClientDetails;\n\t\t},\n\t): Promise<IContainer> {\n\t\treturn Container.createDetached(\n\t\t\t{\n\t\t\t\t...createDetachedProps,\n\t\t\t\t...this.services,\n\t\t\t},\n\t\t\tcodeDetails,\n\t\t);\n\t}\n\n\tpublic async rehydrateDetachedContainerFromSnapshot(\n\t\tsnapshot: string,\n\t\tcreateDetachedProps?: {\n\t\t\tcanReconnect?: boolean;\n\t\t\tclientDetailsOverride?: IClientDetails;\n\t\t},\n\t): Promise<IContainer> {\n\t\treturn Container.rehydrateDetachedFromSnapshot(\n\t\t\t{\n\t\t\t\t...createDetachedProps,\n\t\t\t\t...this.services,\n\t\t\t},\n\t\t\tsnapshot,\n\t\t);\n\t}\n\n\tpublic async resolve(request: IRequest, pendingLocalState?: string): Promise<IContainer> {\n\t\tconst eventName = pendingLocalState === undefined ? \"Resolve\" : \"ResolveWithPendingState\";\n\t\treturn PerformanceEvent.timedExecAsync(this.mc.logger, { eventName }, async () => {\n\t\t\tconst resolved = await this.resolveCore(\n\t\t\t\trequest,\n\t\t\t\tpendingLocalState !== undefined ? JSON.parse(pendingLocalState) : undefined,\n\t\t\t);\n\t\t\treturn resolved.container;\n\t\t});\n\t}\n\n\tprivate async resolveCore(\n\t\trequest: IRequest,\n\t\tpendingLocalState?: IPendingContainerState,\n\t): Promise<{ container: Container; parsed: IParsedUrl }> {\n\t\tconst resolvedAsFluid = await this.services.urlResolver.resolve(request);\n\t\tensureResolvedUrlDefined(resolvedAsFluid);\n\n\t\t// Parse URL into data stores\n\t\tconst parsed = tryParseCompatibleResolvedUrl(resolvedAsFluid.url);\n\t\tif (parsed === undefined) {\n\t\t\tthrow new Error(`Invalid URL ${resolvedAsFluid.url}`);\n\t\t}\n\n\t\tif (pendingLocalState !== undefined) {\n\t\t\tconst parsedPendingUrl = tryParseCompatibleResolvedUrl(pendingLocalState.url);\n\t\t\tif (\n\t\t\t\tparsedPendingUrl?.id !== parsed.id ||\n\t\t\t\tparsedPendingUrl?.path.replace(/\\/$/, \"\") !== parsed.path.replace(/\\/$/, \"\")\n\t\t\t) {\n\t\t\t\tconst message = `URL ${resolvedAsFluid.url} does not match pending state URL ${pendingLocalState.url}`;\n\t\t\t\tthrow new Error(message);\n\t\t\t}\n\t\t}\n\n\t\trequest.headers ??= {};\n\t\t// If set in both query string and headers, use query string. Also write the value from the query string into the header either way.\n\t\trequest.headers[LoaderHeader.version] =\n\t\t\tparsed.version ?? request.headers[LoaderHeader.version];\n\t\tconst fromSequenceNumber = request.headers[LoaderHeader.sequenceNumber] as\n\t\t\t| number\n\t\t\t| undefined;\n\t\tconst opsBeforeReturn = request.headers[LoaderHeader.loadMode]?.opsBeforeReturn as\n\t\t\t| string\n\t\t\t| undefined;\n\n\t\tif (\n\t\t\topsBeforeReturn === \"sequenceNumber\" &&\n\t\t\t(fromSequenceNumber === undefined || fromSequenceNumber < 0)\n\t\t) {\n\t\t\t// If opsBeforeReturn is set to \"sequenceNumber\", then fromSequenceNumber should be set to a non-negative integer.\n\t\t\tthrow new UsageError(\"sequenceNumber must be set to a non-negative integer\");\n\t\t} else if (opsBeforeReturn !== \"sequenceNumber\" && fromSequenceNumber !== undefined) {\n\t\t\t// If opsBeforeReturn is not set to \"sequenceNumber\", then fromSequenceNumber should be undefined (default value).\n\t\t\t// In this case, we should throw an error since opsBeforeReturn is not explicitly set to \"sequenceNumber\".\n\t\t\tthrow new UsageError('opsBeforeReturn must be set to \"sequenceNumber\"');\n\t\t}\n\n\t\treturn {\n\t\t\tcontainer: await this.loadContainer(request, resolvedAsFluid, pendingLocalState),\n\t\t\tparsed,\n\t\t};\n\t}\n\n\tprivate async loadContainer(\n\t\trequest: IRequest,\n\t\tresolvedUrl: IResolvedUrl,\n\t\tpendingLocalState?: IPendingContainerState,\n\t): Promise<Container> {\n\t\treturn Container.load(\n\t\t\t{\n\t\t\t\tresolvedUrl,\n\t\t\t\tversion: request.headers?.[LoaderHeader.version] ?? undefined,\n\t\t\t\tloadMode: request.headers?.[LoaderHeader.loadMode],\n\t\t\t\tpendingLocalState,\n\t\t\t\tloadToSequenceNumber: request.headers?.[LoaderHeader.sequenceNumber],\n\t\t\t},\n\t\t\t{\n\t\t\t\tcanReconnect: request.headers?.[LoaderHeader.reconnect],\n\t\t\t\tclientDetailsOverride: request.headers?.[LoaderHeader.clientDetails],\n\t\t\t\t...this.services,\n\t\t\t},\n\t\t);\n\t}\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/location-redirection-utilities/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EACN,0BAA0B,EAC1B,sCAAsC,GACtC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/location-redirection-utilities/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EACN,0BAA0B,EAC1B,sCAAsC,GACtC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tisLocationRedirectionError,\n\tresolveWithLocationRedirectionHandling,\n} from \"./resolveWithLocationRedirection\";\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolveWithLocationRedirection.d.mts","sourceRoot":"","sources":["../../src/location-redirection-utilities/resolveWithLocationRedirection.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,oBAAoB,EAAE,QAAQ,EAAE,MAAM,iCAAiC;OACzE,EAEN,yBAAyB,EACzB,YAAY,EACZ,MAAM,oCAAoC;AAG3C;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,yBAAyB,CAMzF;AAED;;;;;;;;GAQG;AACH,wBAAsB,sCAAsC,CAAC,CAAC,EAC7D,GAAG,EAAE,CAAC,OAAO,EAAE,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,EACtC,OAAO,EAAE,QAAQ,EACjB,WAAW,EAAE,YAAY,EACzB,MAAM,CAAC,EAAE,oBAAoB,GAC3B,OAAO,CAAC,CAAC,CAAC,CAmBZ"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolveWithLocationRedirection.mjs","sourceRoot":"","sources":["../../src/location-redirection-utilities/resolveWithLocationRedirection.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAGI,EACN,gBAAgB,GAGhB,MAAM,oCAAoC;OACpC,EAAE,iBAAiB,EAAE,MAAM,iCAAiC;AAEnE;;;;;GAKG;AACH,MAAM,UAAU,0BAA0B,CAAC,KAAU;IACpD,OAAO,CACN,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,KAAK,CAAC,SAAS,KAAK,gBAAgB,CAAC,mBAAmB,CACxD,CAAC;AACH,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,sCAAsC,CAC3D,GAAsC,EACtC,OAAiB,EACjB,WAAyB,EACzB,MAA6B;IAE7B,IAAI,GAAG,GAAa,OAAO,CAAC;IAC5B,MAAM,WAAW,GAAG,iBAAiB,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,qBAAqB,EAAE,CAAC,CAAC;IACpF,SAAS;QACR,IAAI;YACH,OAAO,MAAM,GAAG,CAAC,GAAG,CAAC,CAAC;SACtB;QAAC,OAAO,KAAU,EAAE;YACpB,IAAI,CAAC,0BAA0B,CAAC,KAAK,CAAC,EAAE;gBACvC,MAAM,KAAK,CAAC;aACZ;YACD,WAAW,CAAC,kBAAkB,CAAC,EAAE,SAAS,EAAE,0BAA0B,EAAE,CAAC,CAAC;YAC1E,MAAM,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;YACtC,yGAAyG;YACzG,kGAAkG;YAClG,oCAAoC;YACpC,MAAM,WAAW,GAAG,MAAM,WAAW,CAAC,cAAc,CAAC,WAAW,EAAE,EAAE,EAAE,SAAS,CAAC,CAAC;YACjF,GAAG,GAAG,EAAE,GAAG,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC;SACjD;KACD;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryBaseLogger, IRequest } from \"@fluidframework/core-interfaces\";\nimport {\n\tDriverErrorTypes,\n\tILocationRedirectionError,\n\tIUrlResolver,\n} from \"@fluidframework/driver-definitions\";\nimport { createChildLogger } from \"@fluidframework/telemetry-utils\";\n\n/**\n * Checks if the error is location redirection error.\n * @param error - error whose type is to be determined.\n * @returns `true` is the error is location redirection error, otherwise `false`.\n * @internal\n */\nexport function isLocationRedirectionError(error: any): error is ILocationRedirectionError {\n\treturn (\n\t\ttypeof error === \"object\" &&\n\t\terror !== null &&\n\t\terror.errorType === DriverErrorTypes.locationRedirection\n\t);\n}\n\n/**\n * Handles location redirection while fulfilling the loader request.\n * @param api - Callback in which user can wrap the loader.resolve or loader.request call.\n * @param request - request to be resolved.\n * @param urlResolver - resolver used to resolve the url.\n * @param logger - logger to send events.\n * @returns Response from the API call.\n * @alpha\n */\nexport async function resolveWithLocationRedirectionHandling<T>(\n\tapi: (request: IRequest) => Promise<T>,\n\trequest: IRequest,\n\turlResolver: IUrlResolver,\n\tlogger?: ITelemetryBaseLogger,\n): Promise<T> {\n\tlet req: IRequest = request;\n\tconst childLogger = createChildLogger({ logger, namespace: \"LocationRedirection\" });\n\tfor (;;) {\n\t\ttry {\n\t\t\treturn await api(req);\n\t\t} catch (error: any) {\n\t\t\tif (!isLocationRedirectionError(error)) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\tchildLogger.sendTelemetryEvent({ eventName: \"LocationRedirectionError\" });\n\t\t\tconst resolvedUrl = error.redirectUrl;\n\t\t\t// Generate the new request with new location details from the resolved url. For datastore/relative path,\n\t\t\t// we don't need to pass \"/\" as host could have asked for a specific data store. So driver need to\n\t\t\t// extract it from the resolved url.\n\t\t\tconst absoluteUrl = await urlResolver.getAbsoluteUrl(resolvedUrl, \"\", undefined);\n\t\t\treq = { url: absoluteUrl, headers: req.headers };\n\t\t}\n\t}\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"noopHeuristic.d.mts","sourceRoot":"","sources":["../src/noopHeuristic.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,iBAAiB,EAAE,MAAM,8BAA8B;OAEzD,EAAE,yBAAyB,EAAE,MAAM,sCAAsC;OAEzE,EAAE,MAAM,EAAE,MAAM,iCAAiC;AAKxD,MAAM,WAAW,iBAAkB,SAAQ,MAAM;IAChD,CAAC,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,IAAI,OAAE;CAC3C;AAqBD,qBAAa,aAAc,SAAQ,iBAAiB,CAAC,iBAAiB,CAAC;IAMrE,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IALpC,OAAO,CAAC,uBAAuB,CA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AAE;oBACvC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;iBACvB;YACF,CAAC,CAAC,CAAC;SACH;IACF,CAAC;IAED;;OAEG;IACI,sBAAsB,CAAC,OAAkC;QAC/D,gFAAgF;QAChF,+DAA+D;QAC/D,sFAAsF;QACtF,yCAAyC;QACzC,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,EAAE;YAC/B,OAAO;SACP;QAED,IAAI,CAAC,uBAAuB,EAAE,CAAC;QAC/B,IAAI,IAAI,CAAC,uBAAuB,KAAK,IAAI,CAAC,kBAAkB,EAAE;YAC7D,qGAAqG;YACrG,gJAAgJ;YAChJ,+FAA+F;YAC/F,cAAc,CAAC,GAAG,EAAE;gBACnB,IAAI,IAAI,CAAC,uBAAuB,IAAI,IAAI,CAAC,kBAAkB,EAAE;oBAC5D,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;oBACvB,MAAM,CACL,IAAI,CAAC,uBAAuB,KAAK,CAAC,EAClC,KAAK,CAAC,gDAAgD,CACtD,CAAC;iBACF;gBACD,OAAO;YACR,CAAC,CAAC,CAAC;SACH;QAED,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,EAAE;YAC7B,yDAAyD;YACzD,6HAA6H;YAC7H,IAAI,IAAI,CAAC,uBAAuB,KAAK,CAAC,EAAE;gBACvC,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;aACrB;YAED,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC;SACrD;IACF,CAAC;IAEM,gBAAgB;QACtB,2GAA2G;QAC3G,IAAI,CAAC,uBAAuB,GAAG,CAAC,CAAC;IAClC,CAAC;IAEM,iBAAiB;QACvB,6DAA6D;QAC7D,IAAI,CAAC,uBAAuB,GAAG,CAAC,CAAC;IAClC,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport { assert, Timer } from \"@fluidframework/core-utils\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport { isRuntimeMessage } from \"@fluidframework/driver-utils\";\nimport { IEvent } from \"@fluidframework/core-interfaces\";\n\nconst defaultNoopTimeFrequency = 2000;\nconst defaultNoopCountFrequency = 50;\n\nexport interface INoopSenderEvents extends IEvent {\n\t(event: \"wantsNoop\", listener: () => void);\n}\n\n// Here are key considerations when deciding conditions for when to send non-immediate noops:\n// 1. Sending them too often results in increase in file size and bandwidth, as well as catch up performance\n// 2. Sending too infrequently ensures that collab window is large, and as result Sequence DDS would have\n// large catchUp blobs - see Issue #6364\n// 3. Similarly, processes that rely on \"core\" snapshot (and can't parse trailing ops, including above), like search\n// parser in SPO, will result in non-accurate results due to presence of catch up blobs.\n// 4. Ordering service used 250ms timeout to coalesce non-immediate noops. It was changed to 2000 ms to allow more\n// aggressive noop sending from client side.\n// 5. Number of ops sent by all clients is proportional to number of \"write\" clients (every client sends noops),\n// but number of sequenced noops is a function of time (one op per 2 seconds at most).\n// We should consider impact to both outbound traffic (might be huge, depends on number of clients) and file size.\n// Please also see Issue #5629 for more discussions.\n//\n// With that, the current algorithm is as follows:\n// 1. Sent noop 2000 ms of receiving an op if no ops were sent by this client within this timeframe.\n// This will ensure that MSN moves forward with reasonable speed. If that results in too many sequenced noops,\n// server timeout of 2000ms should be reconsidered to be increased.\n// 2. If there are more than 50 ops received without sending any ops, send noop to keep collab window small.\n// Note that system ops (including noops themselves) are excluded, so it's 1 noop per 50 real ops.\nexport class NoopHeuristic extends TypedEventEmitter<INoopSenderEvents> {\n\tprivate opsProcessedSinceOpSent = 0;\n\tprivate readonly timer: Timer | undefined;\n\n\tconstructor(\n\t\tNoopTimeFrequency: number = defaultNoopTimeFrequency,\n\t\tprivate readonly NoopCountFrequency: number = defaultNoopCountFrequency,\n\t) {\n\t\tsuper();\n\t\tif (NoopTimeFrequency !== Infinity) {\n\t\t\tthis.timer = new Timer(NoopTimeFrequency, () => {\n\t\t\t\t// We allow the timer to expire even if an op is sent or we disconnect.\n\t\t\t\t// This condition is to guard against trying to send a noop anyway in that case.\n\t\t\t\tif (this.opsProcessedSinceOpSent !== 0) {\n\t\t\t\t\tthis.emit(\"wantsNoop\");\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Schedules as ack to the server to update the reference sequence number\n\t */\n\tpublic notifyMessageProcessed(message: ISequencedDocumentMessage): void {\n\t\t// We don't acknowledge no-ops to avoid acknowledgement cycles (i.e. ack the MSN\n\t\t// update, which updates the MSN, then ack the update, etc...).\n\t\t// Intent here is for runtime (and DDSes) not to keep too much tracking state / memory\n\t\t// due to runtime ops from other clients.\n\t\tif (!isRuntimeMessage(message)) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.opsProcessedSinceOpSent++;\n\t\tif (this.opsProcessedSinceOpSent === this.NoopCountFrequency) {\n\t\t\t// Wait to send a noop if we are still synchronously processing ops. This guards against two things:\n\t\t\t// 1. If we're processing many ops, we may pass the frequency threshold many times. We only need to send one noop at the very end in this case.\n\t\t\t// 2. We may send another (non-noop) op in response to processing those ops, e.g. an Accept op.\n\t\t\tqueueMicrotask(() => {\n\t\t\t\tif (this.opsProcessedSinceOpSent >= this.NoopCountFrequency) {\n\t\t\t\t\tthis.emit(\"wantsNoop\");\n\t\t\t\t\tassert(\n\t\t\t\t\t\tthis.opsProcessedSinceOpSent === 0,\n\t\t\t\t\t\t0x243 /* \"Expected a noop to be synchronously sent\" */,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t});\n\t\t}\n\n\t\tif (this.timer !== undefined) {\n\t\t\t// Start the timer if we newly have ops that want a noop.\n\t\t\t// If the timer was already running (e.g. we surpassed the op count and sent a noop) this will reset it to its full duration.\n\t\t\tif (this.opsProcessedSinceOpSent === 1) {\n\t\t\t\tthis.timer.restart();\n\t\t\t}\n\n\t\t\tassert(this.timer.hasTimer, 0x242 /* \"has timer\" */);\n\t\t}\n\t}\n\n\tpublic notifyDisconnect(): void {\n\t\t// No need to noop for any ops processed prior to disconnect - we are already removed from MSN calculation.\n\t\tthis.opsProcessedSinceOpSent = 0;\n\t}\n\n\tpublic notifyMessageSent(): void {\n\t\t// Sending any message is as good as a noop for updating MSN.\n\t\tthis.opsProcessedSinceOpSent = 0;\n\t}\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.d.mts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,qCAAqC,CAAC;AAC1D,eAAO,MAAM,UAAU,mBAAmB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.mjs","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,kCAAkC,CAAC;AAC1D,MAAM,CAAC,MAAM,UAAU,GAAG,gBAAgB,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/container-loader\";\nexport const pkgVersion = \"2.0.0-rc.1.0.4\";\n"]}
|
package/lib/protocol.d.mts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.d.mts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,cAAc,EAAE,MAAM,uCAAuC;OAE/D,EACN,gBAAgB,IAAI,oBAAoB,EACxC,eAAe,EACf,iBAAiB,EACjB,MAAM,+BAA+B;OAC/B,EACN,mBAAmB,EACnB,qBAAqB,EACrB,yBAAyB,EAEzB,cAAc,EAE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U,CAAC,WAAW,CAAC,CAAC;gBAC5B,MAAM,YAAY,GAAG,YAAY,CAAC,OAAiB,CAAC;gBACpD,2DAA2D;gBAC3D,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,YAAY,CAAC,EAAE,IAAI,KAAK,MAAM,EAAE;oBAC3D,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;iBACzC;gBACD,MAAM;aACN;YACD;gBACC,MAAM;SACP;IACF,CAAC;CACD;AAED;;;;GAIG;AACH,MAAM,UAAU,kCAAkC,CAAC,OAAuB;IACzE,gCAAgC;IAChC,IAAI,OAAO,CAAC,QAAQ,KAAK,IAAI,EAAE;QAC9B,MAAM,YAAY,GAAG,OAAO,CAAC,OAA6C,CAAC;QAC3E,OAAO,CACN,YAAY,CAAC,IAAI,KAAK,UAAU,CAAC,KAAK;YACtC,YAAY,CAAC,IAAI,KAAK,UAAU,CAAC,UAAU;YAC3C,YAAY,CAAC,IAAI,KAAK,UAAU,CAAC,WAAW,CAC5C,CAAC;KACF;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 { IAudienceOwner } from \"@fluidframework/container-definitions\";\nimport { canBeCoalescedByService } from \"@fluidframework/driver-utils\";\nimport {\n\tIProtocolHandler as IBaseProtocolHandler,\n\tIQuorumSnapshot,\n\tProtocolOpHandler,\n} from \"@fluidframework/protocol-base\";\nimport {\n\tIDocumentAttributes,\n\tIProcessMessageResult,\n\tISequencedDocumentMessage,\n\tISignalClient,\n\tISignalMessage,\n\tMessageType,\n} from \"@fluidframework/protocol-definitions\";\n\n// ADO: #1986: Start using enum from protocol-base.\nexport enum SignalType {\n\tClientJoin = \"join\", // same value as MessageType.ClientJoin,\n\tClientLeave = \"leave\", // same value as MessageType.ClientLeave,\n\tClear = \"clear\", // used only by client for synthetic signals\n}\n\n/**\n * Function to be used for creating a protocol handler.\n * @alpha\n */\nexport type ProtocolHandlerBuilder = (\n\tattributes: IDocumentAttributes,\n\tsnapshot: IQuorumSnapshot,\n\tsendProposal: (key: string, value: any) => number,\n) => IProtocolHandler;\n\n/**\n * @alpha\n */\nexport interface IProtocolHandler extends IBaseProtocolHandler {\n\treadonly audience: IAudienceOwner;\n\tprocessSignal(message: ISignalMessage);\n}\n\nexport class ProtocolHandler extends ProtocolOpHandler implements IProtocolHandler {\n\tconstructor(\n\t\tattributes: IDocumentAttributes,\n\t\tquorumSnapshot: IQuorumSnapshot,\n\t\tsendProposal: (key: string, value: any) => number,\n\t\tpublic readonly audience: IAudienceOwner,\n\t\tprivate readonly shouldClientHaveLeft: (clientId: string) => boolean,\n\t) {\n\t\tsuper(\n\t\t\tattributes.minimumSequenceNumber,\n\t\t\tattributes.sequenceNumber,\n\t\t\tquorumSnapshot.members,\n\t\t\tquorumSnapshot.proposals,\n\t\t\tquorumSnapshot.values,\n\t\t\tsendProposal,\n\t\t);\n\n\t\t// Join / leave signals are ignored for \"write\" clients in favor of join / leave ops\n\t\tthis.quorum.on(\"addMember\", (clientId, details) =>\n\t\t\taudience.addMember(clientId, details.client),\n\t\t);\n\t\tthis.quorum.on(\"removeMember\", (clientId) => audience.removeMember(clientId));\n\t\tfor (const [clientId, details] of this.quorum.getMembers()) {\n\t\t\tthis.audience.addMember(clientId, details.client);\n\t\t}\n\t}\n\n\tpublic processMessage(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocal: boolean,\n\t): IProcessMessageResult {\n\t\t// Check and report if we're getting messages from a clientId that we previously\n\t\t// flagged as shouldHaveLeft, or from a client that's not in the quorum but should be\n\t\tif (message.clientId != null) {\n\t\t\tconst client = this.quorum.getMember(message.clientId);\n\n\t\t\tif (client === undefined && message.type !== MessageType.ClientJoin) {\n\t\t\t\t// pre-0.58 error message: messageClientIdMissingFromQuorum\n\t\t\t\tthrow new Error(\"Remote message's clientId is missing from the quorum\");\n\t\t\t}\n\n\t\t\t// Here checking canBeCoalescedByService is used as an approximation of \"is benign to process despite being unexpected\".\n\t\t\t// It's still not good to see these messages from unexpected clientIds, but since they don't harm the integrity of the\n\t\t\t// document we don't need to blow up aggressively.\n\t\t\tif (this.shouldClientHaveLeft(message.clientId) && !canBeCoalescedByService(message)) {\n\t\t\t\t// pre-0.58 error message: messageClientIdShouldHaveLeft\n\t\t\t\tthrow new Error(\"Remote message's clientId already should have left\");\n\t\t\t}\n\t\t}\n\n\t\treturn super.processMessage(message, local);\n\t}\n\n\tpublic processSignal(message: ISignalMessage) {\n\t\tconst innerContent = message.content as { content: any; type: string };\n\t\tswitch (innerContent.type) {\n\t\t\tcase SignalType.Clear: {\n\t\t\t\tconst members = this.audience.getMembers();\n\t\t\t\tfor (const [clientId, client] of members) {\n\t\t\t\t\tif (client.mode === \"read\") {\n\t\t\t\t\t\tthis.audience.removeMember(clientId);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase SignalType.ClientJoin: {\n\t\t\t\tconst newClient = innerContent.content as ISignalClient;\n\t\t\t\t// Ignore write clients - quorum will control such clients.\n\t\t\t\tif (newClient.client.mode === \"read\") {\n\t\t\t\t\tthis.audience.addMember(newClient.clientId, newClient.client);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase SignalType.ClientLeave: {\n\t\t\t\tconst leftClientId = innerContent.content as string;\n\t\t\t\t// Ignore write clients - quorum will control such clients.\n\t\t\t\tif (this.audience.getMember(leftClientId)?.mode === \"read\") {\n\t\t\t\t\tthis.audience.removeMember(leftClientId);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\t}\n}\n\n/**\n * Function to check whether the protocol handler should process the Signal.\n * The protocol handler should strictly handle only ClientJoin, ClientLeave\n * and Clear signal types.\n */\nexport function protocolHandlerShouldProcessSignal(message: ISignalMessage) {\n\t// Signal originates from server\n\tif (message.clientId === null) {\n\t\tconst innerContent = message.content as { content: unknown; type: string };\n\t\treturn (\n\t\t\tinnerContent.type === SignalType.Clear ||\n\t\t\tinnerContent.type === SignalType.ClientJoin ||\n\t\t\tinnerContent.type === SignalType.ClientLeave\n\t\t);\n\t}\n\treturn false;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"protocolTreeDocumentStorageService.d.mts","sourceRoot":"","sources":["../src/protocolTreeDocumentStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,WAAW,EAAE,MAAM,iCAAiC;OACtD,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,oCAAoC;OACtF,EAAE,YAAY,EAAE,MAAM,sCAAsC;AAEnE;;;GAGG;AACH,qBAAa,0BAA2B,YAAW,uBAAuB,EAAE,WAAW;IAErF,OAAO,CAAC,QAAQ,CAAC,sBAAsB;IACvC,OAAO,CAAC,QAAQ,CAAC,2BAA2B;gBAD3B,sBAAsB,EAAE,uBAAuB,GAAG,WAAW,EAC7D,2BAA2B,EAAE,CAAC,WAAW,EAAE,YAAY,KAAK,YAAY;IAE1F,IAAW,QAAQ,6FAElB;IACD,IAAW,aAAa,WAEvB;IACD,IAAW,QAAQ,YAElB;IAED,eAAe,qMAAiF;IAChG,WAAW,yOAA6E;IACxF,UAAU,yGAA4E;IACtF,QAAQ,2CAA0E;IAClF,eAAe,mGAAiF;IAChG,OAAO,sCAAyE;IAE1E,wBAAwB,CAC7B,OAAO,EAAE,YAAY,EACrB,OAAO,EAAE,eAAe,GACtB,OAAO,CAAC,MAAM,CAAC;CAMlB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"protocolTreeDocumentStorageService.mjs","sourceRoot":"","sources":["../src/protocolTreeDocumentStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH;;;GAGG;AACH,MAAM,OAAO,0BAA0B;IACtC,YACkB,sBAA6D,EAC7D,2BAAwE;QADxE,2BAAsB,GAAtB,sBAAsB,CAAuC;QAC7D,gCAA2B,GAA3B,2BAA2B,CAA6C;QAY1F,oBAAe,GAAG,IAAI,CAAC,sBAAsB,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QAChG,gBAAW,GAAG,IAAI,CAAC,sBAAsB,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QACxF,eAAU,GAAG,IAAI,CAAC,sBAAsB,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QACtF,aAAQ,GAAG,IAAI,CAAC,sBAAsB,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QAClF,oBAAe,GAAG,IAAI,CAAC,sBAAsB,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QAChG,YAAO,GAAG,IAAI,CAAC,sBAAsB,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;IAhB7E,CAAC;IACJ,IAAW,QAAQ;QAClB,OAAO,IAAI,CAAC,sBAAsB,CAAC,QAAQ,CAAC;IAC7C,CAAC;IACD,IAAW,aAAa;QACvB,OAAO,IAAI,CAAC,sBAAsB,CAAC,aAAa,CAAC;IAClD,CAAC;IACD,IAAW,QAAQ;QAClB,OAAO,IAAI,CAAC,sBAAsB,CAAC,QAAQ,CAAC;IAC7C,CAAC;IASD,KAAK,CAAC,wBAAwB,CAC7B,OAAqB,EACrB,OAAwB;QAExB,OAAO,IAAI,CAAC,sBAAsB,CAAC,wBAAwB,CAC1D,IAAI,CAAC,2BAA2B,CAAC,OAAO,CAAC,EACzC,OAAO,CACP,CAAC;IACH,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IDisposable } from \"@fluidframework/core-interfaces\";\nimport { IDocumentStorageService, ISummaryContext } from \"@fluidframework/driver-definitions\";\nimport { ISummaryTree } from \"@fluidframework/protocol-definitions\";\n\n/**\n * A storage service wrapper whose sole job is to intercept calls to uploadSummaryWithContext and ensure they include\n * the protocol summary, using the provided callback to add it if necessary.\n */\nexport class ProtocolTreeStorageService implements IDocumentStorageService, IDisposable {\n\tconstructor(\n\t\tprivate readonly internalStorageService: IDocumentStorageService & IDisposable,\n\t\tprivate readonly addProtocolSummaryIfMissing: (summaryTree: ISummaryTree) => ISummaryTree,\n\t) {}\n\tpublic get policies() {\n\t\treturn this.internalStorageService.policies;\n\t}\n\tpublic get repositoryUrl() {\n\t\treturn this.internalStorageService.repositoryUrl;\n\t}\n\tpublic get disposed() {\n\t\treturn this.internalStorageService.disposed;\n\t}\n\n\tgetSnapshotTree = this.internalStorageService.getSnapshotTree.bind(this.internalStorageService);\n\tgetVersions = this.internalStorageService.getVersions.bind(this.internalStorageService);\n\tcreateBlob = this.internalStorageService.createBlob.bind(this.internalStorageService);\n\treadBlob = this.internalStorageService.readBlob.bind(this.internalStorageService);\n\tdownloadSummary = this.internalStorageService.downloadSummary.bind(this.internalStorageService);\n\tdispose = this.internalStorageService.dispose.bind(this.internalStorageService);\n\n\tasync uploadSummaryWithContext(\n\t\tsummary: ISummaryTree,\n\t\tcontext: ISummaryContext,\n\t): Promise<string> {\n\t\treturn this.internalStorageService.uploadSummaryWithContext(\n\t\t\tthis.addProtocolSummaryIfMissing(summary),\n\t\t\tcontext,\n\t\t);\n\t}\n}\n"]}
|
package/lib/quorum.d.mts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"quorum.d.mts","sourceRoot":"","sources":["../src/quorum.ts"],"names":[],"mappings":"OAIO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC;OAC5D,EAAE,kBAAkB,EAAE,MAAM,sCAAsC;AAEzE,wBAAgB,+BAA+B,CAC9C,MAAM,EAAE,iBAAiB,GACvB,CAAC,MAAM,EAAE,kBAAkB,CAAC,EAAE,CAUhC"}
|
package/lib/quorum.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"quorum.mjs","sourceRoot":"","sources":["../src/quorum.ts"],"names":[],"mappings":"AAOA,MAAM,UAAU,+BAA+B,CAC9C,MAAyB;IAEzB,kEAAkE;IAClE,MAAM,qBAAqB,GAAuB;QACjD,GAAG,EAAE,MAAM;QACX,KAAK,EAAE,MAAM;QACb,sBAAsB,EAAE,CAAC;QACzB,oBAAoB,EAAE,CAAC;QACvB,cAAc,EAAE,CAAC;KACjB,CAAC;IACF,OAAO,CAAC,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC,CAAC;AAC1C,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { IFluidCodeDetails } from \"@fluidframework/core-interfaces\";\nimport { ICommittedProposal } from \"@fluidframework/protocol-definitions\";\n\nexport function initQuorumValuesFromCodeDetails(\n\tsource: IFluidCodeDetails,\n): [string, ICommittedProposal][] {\n\t// Seed the base quorum to be an empty list with a code quorum set\n\tconst committedCodeProposal: ICommittedProposal = {\n\t\tkey: \"code\",\n\t\tvalue: source,\n\t\tapprovalSequenceNumber: 0,\n\t\tcommitSequenceNumber: 0,\n\t\tsequenceNumber: 0,\n\t};\n\treturn [[\"code\", committedCodeProposal]];\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"retriableDocumentStorageService.d.mts","sourceRoot":"","sources":["../src/retriableDocumentStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAGI,EACN,WAAW,EACX,uBAAuB,EACvB,+BAA+B,EAC/B,eAAe,EACf,MAAM,oCAAoC;OACpC,EACN,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,YAAY,EACZ,QAAQ,EACR,MAAM,sCAAsC;OACtC,EAAE,WAAW,EAAE,MAAM,iCAAiC;OACtD,EAAgB,m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CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils\";\nimport {\n\tFetchSource,\n\tIDocumentStorageService,\n\tIDocumentStorageServicePolicies,\n\tISummaryContext,\n} from \"@fluidframework/driver-definitions\";\nimport {\n\tICreateBlobResponse,\n\tISnapshotTree,\n\tISummaryHandle,\n\tISummaryTree,\n\tIVersion,\n} from \"@fluidframework/protocol-definitions\";\nimport { IDisposable } from \"@fluidframework/core-interfaces\";\nimport { GenericError, ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils\";\nimport { runWithRetry } from \"@fluidframework/driver-utils\";\n\nexport class RetriableDocumentStorageService implements IDocumentStorageService, IDisposable {\n\tprivate _disposed = false;\n\tprivate internalStorageService: IDocumentStorageService | undefined;\n\tconstructor(\n\t\tprivate readonly internalStorageServiceP: Promise<IDocumentStorageService>,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t) {\n\t\tthis.internalStorageServiceP.then((s) => (this.internalStorageService = s)).catch(() => {});\n\t}\n\n\tpublic get policies(): IDocumentStorageServicePolicies | undefined {\n\t\tif (this.internalStorageService) {\n\t\t\treturn this.internalStorageService.policies;\n\t\t}\n\t\tthrow new Error(\"storage service not yet instantiated\");\n\t}\n\tpublic get disposed() {\n\t\treturn this._disposed;\n\t}\n\tpublic dispose() {\n\t\tthis._disposed = true;\n\t}\n\n\tpublic get repositoryUrl(): string {\n\t\tif (this.internalStorageService) {\n\t\t\treturn this.internalStorageService.repositoryUrl;\n\t\t}\n\t\tthrow new Error(\"storage service not yet instantiated\");\n\t}\n\n\tpublic async getSnapshotTree(\n\t\tversion?: IVersion,\n\t\tscenarioName?: string,\n\t): Promise<ISnapshotTree | null> {\n\t\treturn this.runWithRetry(\n\t\t\tasync () =>\n\t\t\t\tthis.internalStorageServiceP.then(async (s) =>\n\t\t\t\t\ts.getSnapshotTree(version, scenarioName),\n\t\t\t\t),\n\t\t\t\"storage_getSnapshotTree\",\n\t\t);\n\t}\n\n\tpublic async readBlob(id: string): Promise<ArrayBufferLike> {\n\t\treturn this.runWithRetry(\n\t\t\tasync () => this.internalStorageServiceP.then(async (s) => s.readBlob(id)),\n\t\t\t\"storage_readBlob\",\n\t\t);\n\t}\n\n\tpublic async getVersions(\n\t\tversionId: string | null,\n\t\tcount: number,\n\t\tscenarioName?: string,\n\t\tfetchSource?: FetchSource,\n\t): Promise<IVersion[]> {\n\t\treturn this.runWithRetry(\n\t\t\tasync () =>\n\t\t\t\tthis.internalStorageServiceP.then(async (s) =>\n\t\t\t\t\ts.getVersions(versionId, count, scenarioName, fetchSource),\n\t\t\t\t),\n\t\t\t\"storage_getVersions\",\n\t\t);\n\t}\n\n\tpublic async uploadSummaryWithContext(\n\t\tsummary: ISummaryTree,\n\t\tcontext: ISummaryContext,\n\t): Promise<string> {\n\t\t// Not using retry loop here. Couple reasons:\n\t\t// 1. If client lost connectivity, then retry loop will result in uploading stale summary\n\t\t// by stale summarizer after connectivity comes back. It will cause failures for this client and for\n\t\t// real (new) summarizer. This problem in particular should be solved in future by supplying abort handle\n\t\t// on all APIs and caller (ContainerRuntime.submitSummary) aborting call on loss of connectivity\n\t\t// 2. Similar, if we get 429 with retryAfter = 10 minutes, it's likely not the right call to retry summary\n\t\t// upload in 10 minutes - it's better to keep processing ops and retry later. Though caller needs to take\n\t\t// retryAfter into account!\n\t\t// But retry loop is required for creation flow (Container.attach)\n\t\tassert(\n\t\t\t(context.referenceSequenceNumber === 0) === (context.ackHandle === undefined),\n\t\t\t0x251 /* \"creation summary has to have seq=0 && handle === undefined\" */,\n\t\t);\n\t\tif (context.referenceSequenceNumber !== 0) {\n\t\t\treturn this.internalStorageServiceP.then(async (s) =>\n\t\t\t\ts.uploadSummaryWithContext(summary, context),\n\t\t\t);\n\t\t}\n\n\t\t// Creation flow with attachment blobs - need to do retries!\n\t\treturn this.runWithRetry(\n\t\t\tasync () =>\n\t\t\t\tthis.internalStorageServiceP.then(async (s) =>\n\t\t\t\t\ts.uploadSummaryWithContext(summary, context),\n\t\t\t\t),\n\t\t\t\"storage_uploadSummaryWithContext\",\n\t\t);\n\t}\n\n\tpublic async downloadSummary(handle: ISummaryHandle): Promise<ISummaryTree> {\n\t\treturn this.runWithRetry(\n\t\t\tasync () => this.internalStorageServiceP.then(async (s) => s.downloadSummary(handle)),\n\t\t\t\"storage_downloadSummary\",\n\t\t);\n\t}\n\n\tpublic async createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse> {\n\t\treturn this.runWithRetry(\n\t\t\tasync () => this.internalStorageServiceP.then(async (s) => s.createBlob(file)),\n\t\t\t\"storage_createBlob\",\n\t\t);\n\t}\n\n\tprivate checkStorageDisposed(callName: string, error: unknown) {\n\t\tif (this._disposed) {\n\t\t\tthis.logger.sendTelemetryEvent(\n\t\t\t\t{\n\t\t\t\t\teventName: `${callName}_abortedStorageDisposed`,\n\t\t\t\t\tfetchCallName: callName, // fetchCallName matches logs in runWithRetry.ts\n\t\t\t\t},\n\t\t\t\terror,\n\t\t\t);\n\t\t\t// pre-0.58 error message: storageServiceDisposedCannotRetry\n\t\t\tthrow new GenericError(\"Storage Service is disposed. Cannot retry\", {\n\t\t\t\tcanRetry: false,\n\t\t\t});\n\t\t}\n\t\treturn;\n\t}\n\n\tprivate async runWithRetry<T>(api: () => Promise<T>, callName: string): Promise<T> {\n\t\treturn runWithRetry(api, callName, this.logger, {\n\t\t\tonRetry: (_delayInMs: number, error: unknown) =>\n\t\t\t\tthis.checkStorageDisposed(callName, error),\n\t\t});\n\t}\n}\n"]}
|
package/lib/utils.d.mts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.mts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAMI,EAAE,YAAY,EAAE,aAAa,EAAe,MAAM,sCAAsC;OAExF,EACN,6BAA6B,EAC7B,mCAAmC,EAEnC,MAAM,8BAA8B;AAKrC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