@fluidframework/container-loader 0.59.3003 → 0.59.4000-71128

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/dist/collabWindowTracker.d.ts +1 -2
  2. package/dist/collabWindowTracker.d.ts.map +1 -1
  3. package/dist/collabWindowTracker.js +22 -23
  4. package/dist/collabWindowTracker.js.map +1 -1
  5. package/dist/connectionManager.d.ts.map +1 -1
  6. package/dist/connectionManager.js.map +1 -1
  7. package/dist/connectionState.d.ts +19 -0
  8. package/dist/connectionState.d.ts.map +1 -0
  9. package/dist/connectionState.js +23 -0
  10. package/dist/connectionState.js.map +1 -0
  11. package/dist/connectionStateHandler.d.ts +1 -1
  12. package/dist/connectionStateHandler.d.ts.map +1 -1
  13. package/dist/connectionStateHandler.js +12 -12
  14. package/dist/connectionStateHandler.js.map +1 -1
  15. package/dist/container.d.ts +9 -15
  16. package/dist/container.d.ts.map +1 -1
  17. package/dist/container.js +58 -39
  18. package/dist/container.js.map +1 -1
  19. package/dist/contracts.d.ts +1 -0
  20. package/dist/contracts.d.ts.map +1 -1
  21. package/dist/contracts.js.map +1 -1
  22. package/dist/index.d.ts +2 -1
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +2 -1
  25. package/dist/index.js.map +1 -1
  26. package/dist/loader.js.map +1 -1
  27. package/dist/packageVersion.d.ts +1 -1
  28. package/dist/packageVersion.d.ts.map +1 -1
  29. package/dist/packageVersion.js +1 -1
  30. package/dist/packageVersion.js.map +1 -1
  31. package/lib/collabWindowTracker.d.ts +1 -2
  32. package/lib/collabWindowTracker.d.ts.map +1 -1
  33. package/lib/collabWindowTracker.js +22 -23
  34. package/lib/collabWindowTracker.js.map +1 -1
  35. package/lib/connectionManager.d.ts.map +1 -1
  36. package/lib/connectionManager.js.map +1 -1
  37. package/lib/connectionState.d.ts +19 -0
  38. package/lib/connectionState.d.ts.map +1 -0
  39. package/lib/connectionState.js +20 -0
  40. package/lib/connectionState.js.map +1 -0
  41. package/lib/connectionStateHandler.d.ts +1 -1
  42. package/lib/connectionStateHandler.d.ts.map +1 -1
  43. package/lib/connectionStateHandler.js +1 -1
  44. package/lib/connectionStateHandler.js.map +1 -1
  45. package/lib/container.d.ts +9 -15
  46. package/lib/container.d.ts.map +1 -1
  47. package/lib/container.js +40 -21
  48. package/lib/container.js.map +1 -1
  49. package/lib/contracts.d.ts +1 -0
  50. package/lib/contracts.d.ts.map +1 -1
  51. package/lib/contracts.js.map +1 -1
  52. package/lib/index.d.ts +2 -1
  53. package/lib/index.d.ts.map +1 -1
  54. package/lib/index.js +2 -1
  55. package/lib/index.js.map +1 -1
  56. package/lib/loader.js.map +1 -1
  57. package/lib/packageVersion.d.ts +1 -1
  58. package/lib/packageVersion.d.ts.map +1 -1
  59. package/lib/packageVersion.js +1 -1
  60. package/lib/packageVersion.js.map +1 -1
  61. package/package.json +16 -14
  62. package/src/collabWindowTracker.ts +27 -27
  63. package/src/connectionManager.ts +1 -1
  64. package/src/connectionState.ts +21 -0
  65. package/src/connectionStateHandler.ts +1 -1
  66. package/src/container.ts +47 -26
  67. package/src/contracts.ts +2 -0
  68. package/src/index.ts +1 -1
  69. package/src/loader.ts +1 -1
  70. package/src/packageVersion.ts +1 -1
@@ -61,6 +61,7 @@ export interface IConnectionManager {
61
61
  * Disposed connection manager
62
62
  */
63
63
  dispose(error?: ICriticalContainerError): void;
64
+ get connectionMode(): ConnectionMode;
64
65
  }
65
66
  /**
66
67
  * This interface represents a set of callbacks provided by DeltaManager to IConnectionManager on its creation
@@ -1 +1 @@
1
- {"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,oBAAoB,EACvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACH,WAAW,EACX,YAAY,EACZ,kBAAkB,EAClB,uBAAuB,EACvB,iBAAiB,EAEpB,MAAM,uCAAuC,CAAC;AAC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ings":"AAAA;;;GAGG;AAKH,OAAO,EAMH,cAAc,GACjB,MAAM,uCAAuC,CAAC;AAW/C,MAAM,CAAN,IAAY,aAIX;AAJD,WAAY,aAAa;IACrB,gCAAe,CAAA;IACf,sCAAqB,CAAA;IACrB,oCAAmB,CAAA;AACvB,CAAC,EAJW,aAAa,KAAb,aAAa,QAIxB;AAmID;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,WAA0C,EAAyB,EAAE;IAChG,IAAI,oBAAoB,CAAC;IACzB,IAAI,WAAW,IAAI,MAAM,IAAI,WAAW,EAAE;QACtC,oBAAoB,GAAG,WAAW,CAAC;KACtC;SAAM,IAAI,cAAc,CAAC,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,OAAO,CAAC,EAAE;QAC7C,oBAAoB,GAAG,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,OAAO,CAAC,IAAI,CAAC;KACpD;SAAM;QACH,oBAAoB,GAAG,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,OAAO,CAAC;KAC/C;IACD,OAAO,EAAE,IAAI,EAAE,oBAAoB,EAAE,CAAC;AAC1C,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n ITelemetryProperties,\n} from \"@fluidframework/common-definitions\";\nimport {\n IDeltaQueue,\n ReadOnlyInfo,\n IConnectionDetails,\n ICriticalContainerError,\n IFluidCodeDetails,\n isFluidPackage,\n} from \"@fluidframework/container-definitions\";\nimport {\n ConnectionMode,\n IDocumentMessage,\n ISequencedDocumentMessage,\n IClientConfiguration,\n IClientDetails,\n ISignalMessage,\n} from \"@fluidframework/protocol-definitions\";\nimport { IContainerPackageInfo } from \"@fluidframework/driver-definitions\";\n\nexport enum ReconnectMode {\n Never = \"Never\",\n Disabled = \"Disabled\",\n Enabled = \"Enabled\",\n}\n\n/**\n * Connection manager (implements this interface) is responsible for maintaining connection\n * to relay service.\n */\nexport interface IConnectionManager {\n readonly connected: boolean;\n\n readonly clientId: string | undefined;\n\n /** The queue of outbound delta messages */\n readonly outbound: IDeltaQueue<IDocumentMessage[]>;\n\n /** Details of client */\n readonly clientDetails: IClientDetails;\n\n /** Protocol version being used to communicate with the service */\n readonly version: string;\n\n /** Max message size allowed to the delta manager */\n readonly maxMessageSize: number;\n\n /** Service configuration provided by the service. */\n readonly serviceConfiguration: IClientConfiguration | undefined;\n\n readonly readOnlyInfo: ReadOnlyInfo;\n\n // Various connectivity propetries for telemetry describing type of current connection\n // Things like connection mode, service info, etc.\n // Called when connection state changes (connect / disconnect)\n readonly connectionProps: ITelemetryProperties;\n\n // Verbose information about connection logged to telemetry in case of issues with\n // maintaining healphy connection, including op gaps, not receiving join op in time, etc.\n // Contains details information, like sequence numbers at connection time, initial ops info, etc.\n readonly connectionVerboseProps: ITelemetryProperties;\n\n /**\n * Prepares message to be sent. Fills in clientSequenceNumber.\n * Called only when active connection is present.\n */\n prepareMessageToSend(message: Omit<IDocumentMessage, \"clientSequenceNumber\">): IDocumentMessage | undefined;\n\n /**\n * Called before incomming message is processed. Incomming messages can be comming from connection,\n * but also could come from storage.\n * This call allows connection manager to adjust knowledge about acked ops sent on previous connection.\n * Can be called at any time, including when there is no active connection.\n */\n beforeProcessingIncomingOp(message: ISequencedDocumentMessage): void;\n\n /**\n * Submits signal to relay service.\n * Called only when active connection is present.\n */\n submitSignal(content: any): void;\n\n /**\n * Submits messages to relay service.\n * Called only when active connection is present.\n */\n sendMessages(messages: IDocumentMessage[]): void;\n\n /**\n * Initiates connection to relay service (noop if already connected).\n */\n connect(connectionMode?: ConnectionMode): void;\n\n /**\n * Disposed connection manager\n */\n dispose(error?: ICriticalContainerError): void;\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 abour various events.\n */\nexport interface IConnectionManagerFactoryArgs {\n /**\n * Called by connection manager for each incomming op. Some ops maybe delivered before\n * connectHandler is called (initial ops on socket connection)\n */\n readonly incomingOpHandler: (messages: ISequencedDocumentMessage[], reason: string) => void;\n\n /**\n * Called by connection manager for each incoming signals.\n * Maybe called before connectHandler is called (initial signals on socket connection)\n */\n readonly signalHandler: (message: ISignalMessage) => void;\n\n /**\n * Called when connection manager experiences delay in connecting to relay service.\n * This can happen because client is offline, or service is busy and asks to not connect for some time.\n * Can be called many times while not connected.\n * Situation is considered resolved when connection is established and connectHandler is called.\n */\n readonly reconnectionDelayHandler: (delayMs: number, error: unknown) => void;\n\n /**\n * Called by connection manager whwnever critical error happens and container should be closed.\n * Expects dispose() call in respose to this call.\n */\n readonly closeHandler: (error?: any) => void;\n\n /**\n * Called whenever connection to relay service is lost.\n */\n readonly disconnectHandler: (reason: string) => void;\n\n /**\n * Called whenever new connection to rely service is established\n */\n readonly connectHandler: (connection: IConnectionDetails) => void;\n\n /**\n * Called whenever ping/pong messages are roundtripped on connection.\n */\n readonly pongHandler: (latency: number) => void;\n\n /**\n * Called whenever connection type changes from writable to read-only or vice versa.\n * Connection can be read-only if user has no edit permissions, or if container forced\n * connection to be read-only.\n * This should not be confused with \"read\" / \"write\"connection mode which is internal\n * optimization.\n */\n readonly readonlyChangeHandler: (readonly?: boolean) => 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 = (codeDetails: IFluidCodeDetails | undefined): IContainerPackageInfo => {\n let containerPackageName;\n if (codeDetails && \"name\" in codeDetails) {\n containerPackageName = codeDetails;\n } else if (isFluidPackage(codeDetails?.package)) {\n containerPackageName = codeDetails?.package.name;\n } else {\n containerPackageName = codeDetails?.package;\n }\n return { name: containerPackageName };\n};\n"]}
1
+ {"version":3,"file":"contracts.js","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAMH,cAAc,GACjB,MAAM,uCAAuC,CAAC;AAW/C,MAAM,CAAN,IAAY,aAIX;AAJD,WAAY,aAAa;IACrB,gCAAe,CAAA;IACf,sCAAqB,CAAA;IACrB,oCAAmB,CAAA;AACvB,CAAC,EAJW,aAAa,KAAb,aAAa,QAIxB;AAqID;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,WAA0C,EAAyB,EAAE;IAChG,IAAI,oBAAoB,CAAC;IACzB,IAAI,WAAW,IAAI,MAAM,IAAI,WAAW,EAAE;QACtC,oBAAoB,GAAG,WAAW,CAAC;KACtC;SAAM,IAAI,cAAc,CAAC,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,OAAO,CAAC,EAAE;QAC7C,oBAAoB,GAAG,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,OAAO,CAAC,IAAI,CAAC;KACpD;SAAM;QACH,oBAAoB,GAAG,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,OAAO,CAAC;KAC/C;IACD,OAAO,EAAE,IAAI,EAAE,oBAAoB,EAAE,CAAC;AAC1C,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n ITelemetryProperties,\n} from \"@fluidframework/common-definitions\";\nimport {\n IDeltaQueue,\n ReadOnlyInfo,\n IConnectionDetails,\n ICriticalContainerError,\n IFluidCodeDetails,\n isFluidPackage,\n} from \"@fluidframework/container-definitions\";\nimport {\n ConnectionMode,\n IDocumentMessage,\n ISequencedDocumentMessage,\n IClientConfiguration,\n IClientDetails,\n ISignalMessage,\n} from \"@fluidframework/protocol-definitions\";\nimport { IContainerPackageInfo } from \"@fluidframework/driver-definitions\";\n\nexport enum ReconnectMode {\n Never = \"Never\",\n Disabled = \"Disabled\",\n Enabled = \"Enabled\",\n}\n\n/**\n * Connection manager (implements this interface) is responsible for maintaining connection\n * to relay service.\n */\nexport interface IConnectionManager {\n readonly connected: boolean;\n\n readonly clientId: string | undefined;\n\n /** The queue of outbound delta messages */\n readonly outbound: IDeltaQueue<IDocumentMessage[]>;\n\n /** Details of client */\n readonly clientDetails: IClientDetails;\n\n /** Protocol version being used to communicate with the service */\n readonly version: string;\n\n /** Max message size allowed to the delta manager */\n readonly maxMessageSize: number;\n\n /** Service configuration provided by the service. */\n readonly serviceConfiguration: IClientConfiguration | undefined;\n\n readonly readOnlyInfo: ReadOnlyInfo;\n\n // Various connectivity propetries for telemetry describing type of current connection\n // Things like connection mode, service info, etc.\n // Called when connection state changes (connect / disconnect)\n readonly connectionProps: ITelemetryProperties;\n\n // Verbose information about connection logged to telemetry in case of issues with\n // maintaining healphy connection, including op gaps, not receiving join op in time, etc.\n // Contains details information, like sequence numbers at connection time, initial ops info, etc.\n readonly connectionVerboseProps: ITelemetryProperties;\n\n /**\n * Prepares message to be sent. Fills in clientSequenceNumber.\n * Called only when active connection is present.\n */\n prepareMessageToSend(message: Omit<IDocumentMessage, \"clientSequenceNumber\">): IDocumentMessage | undefined;\n\n /**\n * Called before incomming message is processed. Incomming messages can be comming from connection,\n * but also could come from storage.\n * This call allows connection manager to adjust knowledge about acked ops sent on previous connection.\n * Can be called at any time, including when there is no active connection.\n */\n beforeProcessingIncomingOp(message: ISequencedDocumentMessage): void;\n\n /**\n * Submits signal to relay service.\n * Called only when active connection is present.\n */\n submitSignal(content: any): void;\n\n /**\n * Submits messages to relay service.\n * Called only when active connection is present.\n */\n sendMessages(messages: IDocumentMessage[]): void;\n\n /**\n * Initiates connection to relay service (noop if already connected).\n */\n connect(connectionMode?: ConnectionMode): void;\n\n /**\n * Disposed connection manager\n */\n dispose(error?: ICriticalContainerError): void;\n\n get 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 abour various events.\n */\nexport interface IConnectionManagerFactoryArgs {\n /**\n * Called by connection manager for each incomming op. Some ops maybe delivered before\n * connectHandler is called (initial ops on socket connection)\n */\n readonly incomingOpHandler: (messages: ISequencedDocumentMessage[], reason: string) => void;\n\n /**\n * Called by connection manager for each incoming signals.\n * Maybe called before connectHandler is called (initial signals on socket connection)\n */\n readonly signalHandler: (message: ISignalMessage) => void;\n\n /**\n * Called when connection manager experiences delay in connecting to relay service.\n * This can happen because client is offline, or service is busy and asks to not connect for some time.\n * Can be called many times while not connected.\n * Situation is considered resolved when connection is established and connectHandler is called.\n */\n readonly reconnectionDelayHandler: (delayMs: number, error: unknown) => void;\n\n /**\n * Called by connection manager whwnever critical error happens and container should be closed.\n * Expects dispose() call in respose to this call.\n */\n readonly closeHandler: (error?: any) => void;\n\n /**\n * Called whenever connection to relay service is lost.\n */\n readonly disconnectHandler: (reason: string) => void;\n\n /**\n * Called whenever new connection to rely service is established\n */\n readonly connectHandler: (connection: IConnectionDetails) => void;\n\n /**\n * Called whenever ping/pong messages are roundtripped on connection.\n */\n readonly pongHandler: (latency: number) => void;\n\n /**\n * Called whenever connection type changes from writable to read-only or vice versa.\n * Connection can be read-only if user has no edit permissions, or if container forced\n * connection to be read-only.\n * This should not be confused with \"read\" / \"write\"connection mode which is internal\n * optimization.\n */\n readonly readonlyChangeHandler: (readonly?: boolean) => 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 = (codeDetails: IFluidCodeDetails | undefined): IContainerPackageInfo => {\n let containerPackageName;\n if (codeDetails && \"name\" in codeDetails) {\n containerPackageName = codeDetails;\n } else if (isFluidPackage(codeDetails?.package)) {\n containerPackageName = codeDetails?.package.name;\n } else {\n containerPackageName = codeDetails?.package;\n }\n return { name: containerPackageName };\n};\n"]}
package/lib/index.d.ts CHANGED
@@ -2,6 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- export { ConnectionState, Container, IContainerLoadOptions, IContainerConfig, waitContainerToCatchUp, } from "./container";
5
+ export { ConnectionState } from "./connectionState";
6
+ export { Container, IContainerLoadOptions, IContainerConfig, waitContainerToCatchUp, } from "./container";
6
7
  export { ICodeDetailsLoader, IDetachedBlobStorage, IFluidModuleWithDetails, ILoaderOptions, ILoaderProps, ILoaderServices, Loader, RelativeLoader, } from "./loader";
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,eAAe,EACf,SAAS,EACT,qBAAqB,EACrB,gBAAgB,EAChB,sBAAsB,GACzB,MAAM,aAAa,CAAC;AACrB,OAAO,EACH,kBAAkB,EAClB,oBAAoB,EACpB,uBAAuB,EACvB,cAAc,EACd,YAAY,EACZ,eAAe,EACf,MAAM,EACN,cAAc,GACjB,MAAM,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EACH,SAAS,EACT,qBAAqB,EACrB,gBAAgB,EAChB,sBAAsB,GACzB,MAAM,aAAa,CAAC;AACrB,OAAO,EACH,kBAAkB,EAClB,oBAAoB,EACpB,uBAAuB,EACvB,cAAc,EACd,YAAY,EACZ,eAAe,EACf,MAAM,EACN,cAAc,GACjB,MAAM,UAAU,CAAC"}
package/lib/index.js CHANGED
@@ -2,6 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- export { ConnectionState, Container, waitContainerToCatchUp, } from "./container";
5
+ export { ConnectionState } from "./connectionState";
6
+ export { Container, waitContainerToCatchUp, } from "./container";
6
7
  export { Loader, RelativeLoader, } from "./loader";
7
8
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,eAAe,EACf,SAAS,EAGT,sBAAsB,GACzB,MAAM,aAAa,CAAC;AACrB,OAAO,EAOH,MAAM,EACN,cAAc,GACjB,MAAM,UAAU,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n ConnectionState,\n Container,\n IContainerLoadOptions,\n IContainerConfig,\n waitContainerToCatchUp,\n} from \"./container\";\nexport {\n ICodeDetailsLoader,\n IDetachedBlobStorage,\n IFluidModuleWithDetails,\n ILoaderOptions,\n ILoaderProps,\n ILoaderServices,\n Loader,\n RelativeLoader,\n} from \"./loader\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EACH,SAAS,EAGT,sBAAsB,GACzB,MAAM,aAAa,CAAC;AACrB,OAAO,EAOH,MAAM,EACN,cAAc,GACjB,MAAM,UAAU,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { ConnectionState } from \"./connectionState\";\nexport {\n Container,\n IContainerLoadOptions,\n IContainerConfig,\n waitContainerToCatchUp,\n} from \"./container\";\nexport {\n ICodeDetailsLoader,\n IDetachedBlobStorage,\n IFluidModuleWithDetails,\n ILoaderOptions,\n ILoaderProps,\n ILoaderServices,\n Loader,\n RelativeLoader,\n} from \"./loader\";\n"]}
package/lib/loader.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"loader.js","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AASlC,OAAO,EAQH,YAAY,GAGf,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACH,WAAW,EACX,WAAW,EAE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AAY,CAAC,aAAa,CAAC;YACpE,WAAW,EAAE,QAAQ;YACrB,OAAO,EAAE,MAAA,MAAA,OAAO,CAAC,OAAO,0CAAG,YAAY,CAAC,OAAO,CAAC,mCAAI,SAAS;YAC7D,QAAQ,EAAE,MAAA,OAAO,CAAC,OAAO,0CAAG,YAAY,CAAC,QAAQ,CAAC;SACrD,EACD,iBAAiB,CACpB,CAAC;IACN,CAAC;CACJ","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 { ITelemetryBaseLogger, ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport {\n FluidObject,\n IFluidRouter,\n IRequest,\n IRequestHeader,\n IResponse,\n} from \"@fluidframework/core-interfaces\";\nimport {\n IContainer,\n IFluidModule,\n IHostLoader,\n ILoader,\n IPendingLocalState,\n ILoaderOptions as ILoaderOptions1,\n IProxyLoaderFactory,\n LoaderHeader,\n IProvideFluidCodeDetailsComparer,\n IFluidCodeDetails,\n} from \"@fluidframework/container-definitions\";\nimport {\n ChildLogger,\n DebugLogger,\n IConfigProviderBase,\n loggerToMonitoringContext,\n mixinMonitoringContext,\n MonitoringContext,\n PerformanceEvent,\n sessionStorageConfigProvider,\n} from \"@fluidframework/telemetry-utils\";\nimport {\n IDocumentServiceFactory,\n IDocumentStorageService,\n IFluidResolvedUrl,\n IResolvedUrl,\n IUrlResolver,\n} from \"@fluidframework/driver-definitions\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport {\n ensureFluidResolvedUrl,\n MultiUrlResolver,\n MultiDocumentServiceFactory,\n} from \"@fluidframework/driver-utils\";\nimport { Container } from \"./container\";\nimport { IParsedUrl, parseUrl } from \"./utils\";\nimport { pkgVersion } from \"./packageVersion\";\n\nfunction canUseCache(request: IRequest): boolean {\n if (request.headers === undefined) {\n return true;\n }\n\n return request.headers[LoaderHeader.cache] !== false;\n}\n\nexport class RelativeLoader implements ILoader {\n constructor(\n private readonly container: Container,\n private readonly loader: ILoader | undefined,\n ) {\n }\n\n public get IFluidRouter(): IFluidRouter { return this; }\n\n public async resolve(request: IRequest): Promise<IContainer> {\n if (request.url.startsWith(\"/\")) {\n if (canUseCache(request)) {\n return this.container;\n } else {\n const resolvedUrl = this.container.resolvedUrl;\n ensureFluidResolvedUrl(resolvedUrl);\n const container = await Container.load(\n this.loader as Loader,\n {\n canReconnect: request.headers?.[LoaderHeader.reconnect],\n clientDetailsOverride: request.headers?.[LoaderHeader.clientDetails],\n resolvedUrl: { ...resolvedUrl },\n version: request.headers?.[LoaderHeader.version] ?? undefined,\n loadMode: request.headers?.[LoaderHeader.loadMode],\n },\n );\n return container;\n }\n }\n\n if (this.loader === undefined) {\n throw new Error(\"Cannot resolve external containers\");\n }\n return this.loader.resolve(request);\n }\n\n public async request(request: IRequest): Promise<IResponse> {\n if (request.url.startsWith(\"/\")) {\n const container = await this.resolve(request);\n return container.request(request);\n }\n\n if (this.loader === undefined) {\n return {\n status: 404,\n value: \"Cannot request external containers\",\n mimeType: \"plain/text\",\n };\n }\n return this.loader.request(request);\n }\n}\n\nfunction createCachedResolver(resolver: IUrlResolver) {\n const cacheResolver = Object.create(resolver) as IUrlResolver;\n const resolveCache = new Map<string, Promise<IResolvedUrl | undefined>>();\n cacheResolver.resolve = async (request: IRequest): Promise<IResolvedUrl | undefined> => {\n if (!canUseCache(request)) {\n return resolver.resolve(request);\n }\n if (!resolveCache.has(request.url)) {\n resolveCache.set(request.url, resolver.resolve(request));\n }\n\n return resolveCache.get(request.url);\n };\n return cacheResolver;\n}\n\nexport interface ILoaderOptions extends ILoaderOptions1{\n summarizeProtocolTree?: boolean;\n}\n\n/**\n * @deprecated IFluidModuleWithDetails interface is moved to\n * {@link @fluidframework/container-definition#IFluidModuleWithDetails}\n * to have all the code loading modules in one package. #8193\n * Encapsulates a module entry point with corresponding code details.\n */\nexport interface IFluidModuleWithDetails {\n /** Fluid code module that implements the runtime factory needed to instantiate the container runtime. */\n module: IFluidModule;\n /**\n * Code details associated with the module. Represents a document schema this module supports.\n * If the code loader implements the {@link @fluidframework/core-interfaces#IFluidCodeDetailsComparer} interface,\n * it'll be called to determine whether the module code details satisfy the new code proposal in the quorum.\n */\n details: 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 */\nexport interface ICodeDetailsLoader\n extends Partial<IProvideFluidCodeDetailsComparer> {\n /**\n * Load the code module (package) that is capable to interact with the document.\n *\n * @param source - Code proposal that articulates the current schema the document is written in.\n * @returns - Code module entry point along with the code details associated with it.\n */\n load(source: IFluidCodeDetails): Promise<IFluidModuleWithDetails>;\n}\n\n/**\n * Services and properties necessary for creating a loader\n */\nexport interface ILoaderProps {\n /**\n * The url resolver used by the loader for resolving external urls\n * into Fluid urls such that the container specified by the\n * external url can be loaded.\n */\n readonly urlResolver: IUrlResolver;\n /**\n * The document service factory take the Fluid url provided\n * by the resolved url and constructs all the necessary services\n * for communication with the container's server.\n */\n readonly documentServiceFactory: IDocumentServiceFactory;\n /**\n * The code loader handles loading the necessary code\n * for running a container once it is loaded.\n */\n readonly codeLoader: ICodeDetailsLoader;\n\n /**\n * A property bag of options used by various layers\n * to control features\n */\n readonly options?: ILoaderOptions;\n\n /**\n * Scope is provided to all container and is a set of shared\n * services for container's to integrate with their host environment.\n */\n readonly scope?: FluidObject;\n\n /**\n * Proxy loader factories for loading containers via proxy in other contexts,\n * like web workers, or worker threads.\n * @deprecated Not recommended for general use and will be removed in an upcoming release.\n */\n readonly proxyLoaderFactories?: Map<string, IProxyLoaderFactory>;\n\n /**\n * The logger that all telemetry should be pushed to.\n */\n readonly logger?: ITelemetryBaseLogger;\n\n /**\n * Blobs storage for detached containers.\n */\n readonly detachedBlobStorage?: IDetachedBlobStorage;\n\n /**\n * The configuration provider which may be used to control features.\n */\n readonly configProvider?: IConfigProviderBase;\n}\n\n/**\n * Services and properties used by and exposed by the loader\n */\nexport interface ILoaderServices {\n /**\n * The url resolver used by the loader for resolving external urls\n * into Fluid urls such that the container specified by the\n * external url can be loaded.\n */\n readonly urlResolver: IUrlResolver;\n /**\n * The document service factory take the Fluid url provided\n * by the resolved url and constructs all the necessary services\n * for communication with the container's server.\n */\n readonly documentServiceFactory: IDocumentServiceFactory;\n /**\n * The code loader handles loading the necessary code\n * for running a container once it is loaded.\n */\n readonly codeLoader: ICodeDetailsLoader;\n\n /**\n * A property bag of options used by various layers\n * to control features\n */\n readonly options: ILoaderOptions;\n\n /**\n * Scope is provided to all container and is a set of shared\n * services for container's to integrate with their host environment.\n */\n readonly scope: FluidObject;\n\n /**\n * Proxy loader factories for loading containers via proxy in other contexts,\n * like web workers, or worker threads.\n * @deprecated Not recommended for general use and will be removed in an upcoming release.\n */\n readonly proxyLoaderFactories: Map<string, IProxyLoaderFactory>;\n\n /**\n * The logger downstream consumers should construct their loggers from\n */\n readonly subLogger: ITelemetryLogger;\n\n /**\n * Blobs storage for detached containers.\n */\n readonly detachedBlobStorage?: IDetachedBlobStorage;\n}\n\n/**\n * Subset of IDocumentStorageService which only supports createBlob() and readBlob(). This is used to support\n * blobs in detached containers.\n */\nexport type IDetachedBlobStorage = Pick<IDocumentStorageService, \"createBlob\" | \"readBlob\"> & {\n size: number;\n /**\n * Return an array of all blob IDs present in storage\n */\n getBlobIds(): string[];\n };\n\n/**\n * Manages Fluid resource loading\n */\nexport class Loader implements IHostLoader {\n private readonly containers = new Map<string, Promise<Container>>();\n public readonly services: ILoaderServices;\n private readonly mc: MonitoringContext;\n\n constructor(loaderProps: ILoaderProps) {\n const scope: FluidObject<ILoader> = { ...loaderProps.scope };\n if (loaderProps.options?.provideScopeLoader !== false) {\n scope.ILoader = this;\n }\n const telemetryProps = {\n loaderId: uuid(),\n loaderVersion: pkgVersion,\n };\n\n const subMc = mixinMonitoringContext(\n DebugLogger.mixinDebugLogger(\"fluid:telemetry\", loaderProps.logger, { all: telemetryProps }),\n sessionStorageConfigProvider.value,\n loaderProps.configProvider,\n );\n\n this.services = {\n urlResolver: createCachedResolver(MultiUrlResolver.create(loaderProps.urlResolver)),\n documentServiceFactory: MultiDocumentServiceFactory.create(loaderProps.documentServiceFactory),\n codeLoader: loaderProps.codeLoader,\n options: loaderProps.options ?? {},\n scope,\n subLogger: subMc.logger,\n proxyLoaderFactories: loaderProps.proxyLoaderFactories ?? new Map<string, IProxyLoaderFactory>(),\n detachedBlobStorage: loaderProps.detachedBlobStorage,\n };\n this.mc = loggerToMonitoringContext(\n ChildLogger.create(this.services.subLogger, \"Loader\"));\n }\n\n public get IFluidRouter(): IFluidRouter { return this; }\n\n public async createDetachedContainer(codeDetails: IFluidCodeDetails): Promise<IContainer> {\n const container = await Container.createDetached(\n this,\n codeDetails,\n );\n\n if (this.cachingEnabled) {\n container.once(\"attached\", () => {\n ensureFluidResolvedUrl(container.resolvedUrl);\n const parsedUrl = parseUrl(container.resolvedUrl.url);\n if (parsedUrl !== undefined) {\n this.addToContainerCache(parsedUrl.id, Promise.resolve(container));\n }\n });\n }\n\n return container;\n }\n\n public async rehydrateDetachedContainerFromSnapshot(snapshot: string): Promise<IContainer> {\n return Container.rehydrateDetachedFromSnapshot(this, snapshot);\n }\n\n public async resolve(request: IRequest, pendingLocalState?: string): Promise<IContainer> {\n const eventName = pendingLocalState === undefined ? \"Resolve\" : \"ResolveWithPendingState\";\n return PerformanceEvent.timedExecAsync(this.mc.logger, { eventName }, async () => {\n const resolved = await this.resolveCore(\n request,\n pendingLocalState !== undefined ? JSON.parse(pendingLocalState) : undefined,\n );\n return resolved.container;\n });\n }\n\n public async request(request: IRequest): Promise<IResponse> {\n return PerformanceEvent.timedExecAsync(this.mc.logger, { eventName: \"Request\" }, async () => {\n const resolved = await this.resolveCore(request);\n return resolved.container.request({\n ...request,\n url: `${resolved.parsed.path}${resolved.parsed.query}`,\n });\n });\n }\n\n private getKeyForContainerCache(request: IRequest, parsedUrl: IParsedUrl): string {\n const key = request.headers?.[LoaderHeader.version] !== undefined\n ? `${parsedUrl.id}@${request.headers[LoaderHeader.version]}`\n : parsedUrl.id;\n return key;\n }\n\n private addToContainerCache(key: string, containerP: Promise<Container>) {\n this.containers.set(key, containerP);\n containerP.then((container) => {\n // If the container is closed or becomes closed after we resolve it, remove it from the cache.\n if (container.closed) {\n this.containers.delete(key);\n } else {\n container.once(\"closed\", () => {\n this.containers.delete(key);\n });\n }\n }).catch((error) => {});\n }\n\n private async resolveCore(\n request: IRequest,\n pendingLocalState?: IPendingLocalState,\n ): Promise<{ container: Container; parsed: IParsedUrl; }> {\n const resolvedAsFluid = await this.services.urlResolver.resolve(request);\n ensureFluidResolvedUrl(resolvedAsFluid);\n\n // Parse URL into data stores\n const parsed = parseUrl(resolvedAsFluid.url);\n if (parsed === undefined) {\n throw new Error(`Invalid URL ${resolvedAsFluid.url}`);\n }\n\n if (pendingLocalState !== undefined) {\n const parsedPendingUrl = parseUrl(pendingLocalState.url);\n if (parsedPendingUrl?.id !== parsed.id ||\n parsedPendingUrl?.path.replace(/\\/$/, \"\") !== parsed.path.replace(/\\/$/, \"\")) {\n const message = `URL ${resolvedAsFluid.url} does not match pending state URL ${pendingLocalState.url}`;\n throw new Error(message);\n }\n }\n\n const { canCache, fromSequenceNumber } = this.parseHeader(parsed, request);\n const shouldCache = pendingLocalState !== undefined ? false : canCache;\n\n let container: Container;\n if (shouldCache) {\n const key = this.getKeyForContainerCache(request, parsed);\n const maybeContainer = await this.containers.get(key);\n if (maybeContainer !== undefined) {\n container = maybeContainer;\n } else {\n const containerP =\n this.loadContainer(\n request,\n resolvedAsFluid);\n this.addToContainerCache(key, containerP);\n container = await containerP;\n }\n } else {\n container =\n await this.loadContainer(\n request,\n resolvedAsFluid,\n pendingLocalState?.pendingRuntimeState);\n }\n\n if (container.deltaManager.lastSequenceNumber <= fromSequenceNumber) {\n await new Promise<void>((resolve, reject) => {\n function opHandler(message: ISequencedDocumentMessage) {\n if (message.sequenceNumber > fromSequenceNumber) {\n resolve();\n container.removeListener(\"op\", opHandler);\n }\n }\n\n container.on(\"op\", opHandler);\n });\n }\n\n return { container, parsed };\n }\n\n private get cachingEnabled() {\n return this.services.options.cache !== false;\n }\n\n private canCacheForRequest(headers: IRequestHeader): boolean {\n return this.cachingEnabled && headers[LoaderHeader.cache] !== false;\n }\n\n private parseHeader(parsed: IParsedUrl, request: IRequest) {\n let fromSequenceNumber = -1;\n\n request.headers = request.headers ?? {};\n\n const headerSeqNum = request.headers[LoaderHeader.sequenceNumber];\n if (headerSeqNum !== undefined) {\n fromSequenceNumber = headerSeqNum;\n }\n\n // If set in both query string and headers, use query string\n request.headers[LoaderHeader.version] = parsed.version ?? request.headers[LoaderHeader.version];\n\n const canCache = this.canCacheForRequest(request.headers);\n\n return {\n canCache,\n fromSequenceNumber,\n };\n }\n\n private async loadContainer(\n request: IRequest,\n resolved: IFluidResolvedUrl,\n pendingLocalState?: unknown,\n ): Promise<Container> {\n return Container.load(\n this,\n {\n canReconnect: request.headers?.[LoaderHeader.reconnect],\n clientDetailsOverride: request.headers?.[LoaderHeader.clientDetails],\n resolvedUrl: resolved,\n version: request.headers?.[LoaderHeader.version] ?? undefined,\n loadMode: request.headers?.[LoaderHeader.loadMode],\n },\n pendingLocalState,\n );\n }\n}\n"]}
1
+ {"version":3,"file":"loader.js","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AASlC,OAAO,EAQH,YAAY,GAGf,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACH,WAAW,EACX,WAAW,EAEX,yBAAyB,EACzB,sBAAsB,EAEtB,gBAAgB,EAChB,4BAA4B,GAC/B,MAAM,iCAAiC,CAAC;AASzC,OAAO,EACH,sBAAsB,EACtB,gBAAgB,EAChB,2BAA2B,GAC9B,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7D,QAAQ,EAAE,MAAA,OAAO,CAAC,OAAO,0CAAG,YAAY,CAAC,QAAQ,CAAC;SACrD,EACD,iBAAiB,CACpB,CAAC;IACN,CAAC;CACJ","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 { ITelemetryBaseLogger, ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport {\n FluidObject,\n IFluidRouter,\n IRequest,\n IRequestHeader,\n IResponse,\n} from \"@fluidframework/core-interfaces\";\nimport {\n IContainer,\n IFluidModule,\n IHostLoader,\n ILoader,\n IPendingLocalState,\n ILoaderOptions as ILoaderOptions1,\n IProxyLoaderFactory,\n LoaderHeader,\n IProvideFluidCodeDetailsComparer,\n IFluidCodeDetails,\n} from \"@fluidframework/container-definitions\";\nimport {\n ChildLogger,\n DebugLogger,\n IConfigProviderBase,\n loggerToMonitoringContext,\n mixinMonitoringContext,\n MonitoringContext,\n PerformanceEvent,\n sessionStorageConfigProvider,\n} from \"@fluidframework/telemetry-utils\";\nimport {\n IDocumentServiceFactory,\n IDocumentStorageService,\n IFluidResolvedUrl,\n IResolvedUrl,\n IUrlResolver,\n} from \"@fluidframework/driver-definitions\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport {\n ensureFluidResolvedUrl,\n MultiUrlResolver,\n MultiDocumentServiceFactory,\n} from \"@fluidframework/driver-utils\";\nimport { Container } from \"./container\";\nimport { IParsedUrl, parseUrl } from \"./utils\";\nimport { pkgVersion } from \"./packageVersion\";\n\nfunction canUseCache(request: IRequest): boolean {\n if (request.headers === undefined) {\n return true;\n }\n\n return request.headers[LoaderHeader.cache] !== false;\n}\n\nexport class RelativeLoader implements ILoader {\n constructor(\n private readonly container: Container,\n private readonly loader: ILoader | undefined,\n ) {\n }\n\n public get IFluidRouter(): IFluidRouter { return this; }\n\n public async resolve(request: IRequest): Promise<IContainer> {\n if (request.url.startsWith(\"/\")) {\n if (canUseCache(request)) {\n return this.container;\n } else {\n const resolvedUrl = this.container.resolvedUrl;\n ensureFluidResolvedUrl(resolvedUrl);\n const container = await Container.load(\n this.loader as Loader,\n {\n canReconnect: request.headers?.[LoaderHeader.reconnect],\n clientDetailsOverride: request.headers?.[LoaderHeader.clientDetails],\n resolvedUrl: { ...resolvedUrl },\n version: request.headers?.[LoaderHeader.version] ?? undefined,\n loadMode: request.headers?.[LoaderHeader.loadMode],\n },\n );\n return container;\n }\n }\n\n if (this.loader === undefined) {\n throw new Error(\"Cannot resolve external containers\");\n }\n return this.loader.resolve(request);\n }\n\n public async request(request: IRequest): Promise<IResponse> {\n if (request.url.startsWith(\"/\")) {\n const container = await this.resolve(request);\n return container.request(request);\n }\n\n if (this.loader === undefined) {\n return {\n status: 404,\n value: \"Cannot request external containers\",\n mimeType: \"plain/text\",\n };\n }\n return this.loader.request(request);\n }\n}\n\nfunction createCachedResolver(resolver: IUrlResolver) {\n const cacheResolver = Object.create(resolver) as IUrlResolver;\n const resolveCache = new Map<string, Promise<IResolvedUrl | undefined>>();\n cacheResolver.resolve = async (request: IRequest): Promise<IResolvedUrl | undefined> => {\n if (!canUseCache(request)) {\n return resolver.resolve(request);\n }\n if (!resolveCache.has(request.url)) {\n resolveCache.set(request.url, resolver.resolve(request));\n }\n\n return resolveCache.get(request.url);\n };\n return cacheResolver;\n}\n\nexport interface ILoaderOptions extends ILoaderOptions1 {\n summarizeProtocolTree?: boolean;\n}\n\n/**\n * @deprecated IFluidModuleWithDetails interface is moved to\n * {@link @fluidframework/container-definition#IFluidModuleWithDetails}\n * to have all the code loading modules in one package. #8193\n * Encapsulates a module entry point with corresponding code details.\n */\nexport interface IFluidModuleWithDetails {\n /** Fluid code module that implements the runtime factory needed to instantiate the container runtime. */\n module: IFluidModule;\n /**\n * Code details associated with the module. Represents a document schema this module supports.\n * If the code loader implements the {@link @fluidframework/core-interfaces#IFluidCodeDetailsComparer} interface,\n * it'll be called to determine whether the module code details satisfy the new code proposal in the quorum.\n */\n details: 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 */\nexport interface ICodeDetailsLoader\n extends Partial<IProvideFluidCodeDetailsComparer> {\n /**\n * Load the code module (package) that is capable to interact with the document.\n *\n * @param source - Code proposal that articulates the current schema the document is written in.\n * @returns - Code module entry point along with the code details associated with it.\n */\n load(source: IFluidCodeDetails): Promise<IFluidModuleWithDetails>;\n}\n\n/**\n * Services and properties necessary for creating a loader\n */\nexport interface ILoaderProps {\n /**\n * The url resolver used by the loader for resolving external urls\n * into Fluid urls such that the container specified by the\n * external url can be loaded.\n */\n readonly urlResolver: IUrlResolver;\n /**\n * The document service factory take the Fluid url provided\n * by the resolved url and constructs all the necessary services\n * for communication with the container's server.\n */\n readonly documentServiceFactory: IDocumentServiceFactory;\n /**\n * The code loader handles loading the necessary code\n * for running a container once it is loaded.\n */\n readonly codeLoader: ICodeDetailsLoader;\n\n /**\n * A property bag of options used by various layers\n * to control features\n */\n readonly options?: ILoaderOptions;\n\n /**\n * Scope is provided to all container and is a set of shared\n * services for container's to integrate with their host environment.\n */\n readonly scope?: FluidObject;\n\n /**\n * Proxy loader factories for loading containers via proxy in other contexts,\n * like web workers, or worker threads.\n * @deprecated Not recommended for general use and will be removed in an upcoming release.\n */\n readonly proxyLoaderFactories?: Map<string, IProxyLoaderFactory>;\n\n /**\n * The logger that all telemetry should be pushed to.\n */\n readonly logger?: ITelemetryBaseLogger;\n\n /**\n * Blobs storage for detached containers.\n */\n readonly detachedBlobStorage?: IDetachedBlobStorage;\n\n /**\n * The configuration provider which may be used to control features.\n */\n readonly configProvider?: IConfigProviderBase;\n}\n\n/**\n * Services and properties used by and exposed by the loader\n */\nexport interface ILoaderServices {\n /**\n * The url resolver used by the loader for resolving external urls\n * into Fluid urls such that the container specified by the\n * external url can be loaded.\n */\n readonly urlResolver: IUrlResolver;\n /**\n * The document service factory take the Fluid url provided\n * by the resolved url and constructs all the necessary services\n * for communication with the container's server.\n */\n readonly documentServiceFactory: IDocumentServiceFactory;\n /**\n * The code loader handles loading the necessary code\n * for running a container once it is loaded.\n */\n readonly codeLoader: ICodeDetailsLoader;\n\n /**\n * A property bag of options used by various layers\n * to control features\n */\n readonly options: ILoaderOptions;\n\n /**\n * Scope is provided to all container and is a set of shared\n * services for container's to integrate with their host environment.\n */\n readonly scope: FluidObject;\n\n /**\n * Proxy loader factories for loading containers via proxy in other contexts,\n * like web workers, or worker threads.\n * @deprecated Not recommended for general use and will be removed in an upcoming release.\n */\n readonly proxyLoaderFactories: Map<string, IProxyLoaderFactory>;\n\n /**\n * The logger downstream consumers should construct their loggers from\n */\n readonly subLogger: ITelemetryLogger;\n\n /**\n * Blobs storage for detached containers.\n */\n readonly detachedBlobStorage?: IDetachedBlobStorage;\n}\n\n/**\n * Subset of IDocumentStorageService which only supports createBlob() and readBlob(). This is used to support\n * blobs in detached containers.\n */\nexport type IDetachedBlobStorage = Pick<IDocumentStorageService, \"createBlob\" | \"readBlob\"> & {\n size: number;\n /**\n * Return an array of all blob IDs present in storage\n */\n getBlobIds(): string[];\n };\n\n/**\n * Manages Fluid resource loading\n */\nexport class Loader implements IHostLoader {\n private readonly containers = new Map<string, Promise<Container>>();\n public readonly services: ILoaderServices;\n private readonly mc: MonitoringContext;\n\n constructor(loaderProps: ILoaderProps) {\n const scope: FluidObject<ILoader> = { ...loaderProps.scope };\n if (loaderProps.options?.provideScopeLoader !== false) {\n scope.ILoader = this;\n }\n const telemetryProps = {\n loaderId: uuid(),\n loaderVersion: pkgVersion,\n };\n\n const subMc = mixinMonitoringContext(\n DebugLogger.mixinDebugLogger(\"fluid:telemetry\", loaderProps.logger, { all: telemetryProps }),\n sessionStorageConfigProvider.value,\n loaderProps.configProvider,\n );\n\n this.services = {\n urlResolver: createCachedResolver(MultiUrlResolver.create(loaderProps.urlResolver)),\n documentServiceFactory: MultiDocumentServiceFactory.create(loaderProps.documentServiceFactory),\n codeLoader: loaderProps.codeLoader,\n options: loaderProps.options ?? {},\n scope,\n subLogger: subMc.logger,\n proxyLoaderFactories: loaderProps.proxyLoaderFactories ?? new Map<string, IProxyLoaderFactory>(),\n detachedBlobStorage: loaderProps.detachedBlobStorage,\n };\n this.mc = loggerToMonitoringContext(\n ChildLogger.create(this.services.subLogger, \"Loader\"));\n }\n\n public get IFluidRouter(): IFluidRouter { return this; }\n\n public async createDetachedContainer(codeDetails: IFluidCodeDetails): Promise<IContainer> {\n const container = await Container.createDetached(\n this,\n codeDetails,\n );\n\n if (this.cachingEnabled) {\n container.once(\"attached\", () => {\n ensureFluidResolvedUrl(container.resolvedUrl);\n const parsedUrl = parseUrl(container.resolvedUrl.url);\n if (parsedUrl !== undefined) {\n this.addToContainerCache(parsedUrl.id, Promise.resolve(container));\n }\n });\n }\n\n return container;\n }\n\n public async rehydrateDetachedContainerFromSnapshot(snapshot: string): Promise<IContainer> {\n return Container.rehydrateDetachedFromSnapshot(this, snapshot);\n }\n\n public async resolve(request: IRequest, pendingLocalState?: string): Promise<IContainer> {\n const eventName = pendingLocalState === undefined ? \"Resolve\" : \"ResolveWithPendingState\";\n return PerformanceEvent.timedExecAsync(this.mc.logger, { eventName }, async () => {\n const resolved = await this.resolveCore(\n request,\n pendingLocalState !== undefined ? JSON.parse(pendingLocalState) : undefined,\n );\n return resolved.container;\n });\n }\n\n public async request(request: IRequest): Promise<IResponse> {\n return PerformanceEvent.timedExecAsync(this.mc.logger, { eventName: \"Request\" }, async () => {\n const resolved = await this.resolveCore(request);\n return resolved.container.request({\n ...request,\n url: `${resolved.parsed.path}${resolved.parsed.query}`,\n });\n });\n }\n\n private getKeyForContainerCache(request: IRequest, parsedUrl: IParsedUrl): string {\n const key = request.headers?.[LoaderHeader.version] !== undefined\n ? `${parsedUrl.id}@${request.headers[LoaderHeader.version]}`\n : parsedUrl.id;\n return key;\n }\n\n private addToContainerCache(key: string, containerP: Promise<Container>) {\n this.containers.set(key, containerP);\n containerP.then((container) => {\n // If the container is closed or becomes closed after we resolve it, remove it from the cache.\n if (container.closed) {\n this.containers.delete(key);\n } else {\n container.once(\"closed\", () => {\n this.containers.delete(key);\n });\n }\n }).catch((error) => {});\n }\n\n private async resolveCore(\n request: IRequest,\n pendingLocalState?: IPendingLocalState,\n ): Promise<{ container: Container; parsed: IParsedUrl; }> {\n const resolvedAsFluid = await this.services.urlResolver.resolve(request);\n ensureFluidResolvedUrl(resolvedAsFluid);\n\n // Parse URL into data stores\n const parsed = parseUrl(resolvedAsFluid.url);\n if (parsed === undefined) {\n throw new Error(`Invalid URL ${resolvedAsFluid.url}`);\n }\n\n if (pendingLocalState !== undefined) {\n const parsedPendingUrl = parseUrl(pendingLocalState.url);\n if (parsedPendingUrl?.id !== parsed.id ||\n parsedPendingUrl?.path.replace(/\\/$/, \"\") !== parsed.path.replace(/\\/$/, \"\")) {\n const message = `URL ${resolvedAsFluid.url} does not match pending state URL ${pendingLocalState.url}`;\n throw new Error(message);\n }\n }\n\n const { canCache, fromSequenceNumber } = this.parseHeader(parsed, request);\n const shouldCache = pendingLocalState !== undefined ? false : canCache;\n\n let container: Container;\n if (shouldCache) {\n const key = this.getKeyForContainerCache(request, parsed);\n const maybeContainer = await this.containers.get(key);\n if (maybeContainer !== undefined) {\n container = maybeContainer;\n } else {\n const containerP =\n this.loadContainer(\n request,\n resolvedAsFluid);\n this.addToContainerCache(key, containerP);\n container = await containerP;\n }\n } else {\n container =\n await this.loadContainer(\n request,\n resolvedAsFluid,\n pendingLocalState?.pendingRuntimeState);\n }\n\n if (container.deltaManager.lastSequenceNumber <= fromSequenceNumber) {\n await new Promise<void>((resolve, reject) => {\n function opHandler(message: ISequencedDocumentMessage) {\n if (message.sequenceNumber > fromSequenceNumber) {\n resolve();\n container.removeListener(\"op\", opHandler);\n }\n }\n\n container.on(\"op\", opHandler);\n });\n }\n\n return { container, parsed };\n }\n\n private get cachingEnabled() {\n return this.services.options.cache !== false;\n }\n\n private canCacheForRequest(headers: IRequestHeader): boolean {\n return this.cachingEnabled && headers[LoaderHeader.cache] !== false;\n }\n\n private parseHeader(parsed: IParsedUrl, request: IRequest) {\n let fromSequenceNumber = -1;\n\n request.headers = request.headers ?? {};\n\n const headerSeqNum = request.headers[LoaderHeader.sequenceNumber];\n if (headerSeqNum !== undefined) {\n fromSequenceNumber = headerSeqNum;\n }\n\n // If set in both query string and headers, use query string\n request.headers[LoaderHeader.version] = parsed.version ?? request.headers[LoaderHeader.version];\n\n const canCache = this.canCacheForRequest(request.headers);\n\n return {\n canCache,\n fromSequenceNumber,\n };\n }\n\n private async loadContainer(\n request: IRequest,\n resolved: IFluidResolvedUrl,\n pendingLocalState?: unknown,\n ): Promise<Container> {\n return Container.load(\n this,\n {\n canReconnect: request.headers?.[LoaderHeader.reconnect],\n clientDetailsOverride: request.headers?.[LoaderHeader.clientDetails],\n resolvedUrl: resolved,\n version: request.headers?.[LoaderHeader.version] ?? undefined,\n loadMode: request.headers?.[LoaderHeader.loadMode],\n },\n pendingLocalState,\n );\n }\n}\n"]}
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export declare const pkgName = "@fluidframework/container-loader";
8
- export declare const pkgVersion = "0.59.3003";
8
+ export declare const pkgVersion = "0.59.4000-71128";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,qCAAqC,CAAC;AAC1D,eAAO,MAAM,UAAU,cAAc,CAAC"}
1
+ {"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,qCAAqC,CAAC;AAC1D,eAAO,MAAM,UAAU,oBAAoB,CAAC"}
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export const pkgName = "@fluidframework/container-loader";
8
- export const pkgVersion = "0.59.3003";
8
+ export const pkgVersion = "0.59.4000-71128";
9
9
  //# sourceMappingURL=packageVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,kCAAkC,CAAC;AAC1D,MAAM,CAAC,MAAM,UAAU,GAAG,WAAW,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 = \"0.59.3003\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,kCAAkC,CAAC;AAC1D,MAAM,CAAC,MAAM,UAAU,GAAG,iBAAiB,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 = \"0.59.4000-71128\";\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/container-loader",
3
- "version": "0.59.3003",
3
+ "version": "0.59.4000-71128",
4
4
  "description": "Fluid container loader",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -63,14 +63,14 @@
63
63
  "dependencies": {
64
64
  "@fluidframework/common-definitions": "^0.20.1",
65
65
  "@fluidframework/common-utils": "^0.32.1",
66
- "@fluidframework/container-definitions": "^0.48.1000",
67
- "@fluidframework/container-utils": "^0.59.3003",
66
+ "@fluidframework/container-definitions": "^0.48.2000-0",
67
+ "@fluidframework/container-utils": "0.59.4000-71128",
68
68
  "@fluidframework/core-interfaces": "^0.43.1000",
69
- "@fluidframework/driver-definitions": "^0.46.1000",
70
- "@fluidframework/driver-utils": "^0.59.3003",
71
- "@fluidframework/protocol-base": "^0.1036.3000",
72
- "@fluidframework/protocol-definitions": "^0.1028.1000",
73
- "@fluidframework/telemetry-utils": "^0.59.3003",
69
+ "@fluidframework/driver-definitions": "^0.46.2000-0",
70
+ "@fluidframework/driver-utils": "0.59.4000-71128",
71
+ "@fluidframework/protocol-base": "^0.1036.4000-0",
72
+ "@fluidframework/protocol-definitions": "^0.1028.2000-0",
73
+ "@fluidframework/telemetry-utils": "0.59.4000-71128",
74
74
  "abort-controller": "^3.0.0",
75
75
  "double-ended-queue": "^2.1.0-0",
76
76
  "lodash": "^4.17.21",
@@ -78,16 +78,16 @@
78
78
  },
79
79
  "devDependencies": {
80
80
  "@fluidframework/build-common": "^0.23.0",
81
- "@fluidframework/build-tools": "^0.2.66793",
81
+ "@fluidframework/build-tools": "^0.2.70857",
82
82
  "@fluidframework/container-loader-previous": "npm:@fluidframework/container-loader@0.59.3000",
83
83
  "@fluidframework/eslint-config-fluid": "^0.28.2000",
84
- "@fluidframework/mocha-test-setup": "^0.59.3003",
85
- "@fluidframework/test-loader-utils": "^0.59.3003",
84
+ "@fluidframework/mocha-test-setup": "0.59.4000-71128",
85
+ "@fluidframework/test-loader-utils": "0.59.4000-71128",
86
86
  "@microsoft/api-extractor": "^7.22.2",
87
87
  "@rushstack/eslint-config": "^2.5.1",
88
88
  "@types/double-ended-queue": "^2.1.0",
89
89
  "@types/lodash": "^4.14.118",
90
- "@types/mocha": "^8.2.2",
90
+ "@types/mocha": "^9.1.1",
91
91
  "@types/node": "^14.18.0",
92
92
  "@types/sinon": "^7.0.13",
93
93
  "@typescript-eslint/eslint-plugin": "~5.9.0",
@@ -100,12 +100,14 @@
100
100
  "eslint-plugin-eslint-comments": "~3.2.0",
101
101
  "eslint-plugin-import": "~2.25.4",
102
102
  "eslint-plugin-jest": "~26.1.3",
103
+ "eslint-plugin-jsdoc": "~39.3.0",
103
104
  "eslint-plugin-mocha": "~10.0.3",
104
105
  "eslint-plugin-promise": "~6.0.0",
105
106
  "eslint-plugin-react": "~7.28.0",
106
107
  "eslint-plugin-tsdoc": "~0.2.14",
107
108
  "eslint-plugin-unicorn": "~40.0.0",
108
- "mocha": "^8.4.0",
109
+ "eslint-plugin-unused-imports": "~2.0.0",
110
+ "mocha": "^10.0.0",
109
111
  "nyc": "^15.0.0",
110
112
  "rimraf": "^2.6.2",
111
113
  "sinon": "^7.4.2",
@@ -113,7 +115,7 @@
113
115
  "typescript-formatter": "7.1.0"
114
116
  },
115
117
  "typeValidation": {
116
- "version": "0.59.3001",
118
+ "version": "0.59.4000",
117
119
  "broken": {}
118
120
  }
119
121
  }
@@ -5,7 +5,10 @@
5
5
 
6
6
  import { assert, Timer } from "@fluidframework/common-utils";
7
7
  import { ISequencedDocumentMessage, MessageType } from "@fluidframework/protocol-definitions";
8
- import { isSystemMessage } from "@fluidframework/protocol-base";
8
+ import { isRuntimeMessage } from "@fluidframework/driver-utils";
9
+
10
+ const defaultNoopTimeFrequency = 2000;
11
+ const defaultNoopCountFrequency = 50;
9
12
 
10
13
  // Here are key considerations when deciding conditions for when to send non-immediate noops:
11
14
  // 1. Sending them too often results in increase in file size and bandwidth, as well as catch up performance
@@ -28,35 +31,28 @@ import { isSystemMessage } from "@fluidframework/protocol-base";
28
31
  // Note that system ops (including noops themselves) are excluded, so it's 1 noop per 50 real ops.
29
32
  export class CollabWindowTracker {
30
33
  private opsCountSinceNoop = 0;
31
- private readonly timer: Timer;
34
+ private readonly timer: Timer | undefined;
32
35
 
33
36
  constructor(
34
37
  private readonly submit: (type: MessageType, contents: any) => void,
35
- private readonly activeConnection: () => boolean,
36
- NoopTimeFrequency: number = 2000,
37
- private readonly NoopCountFrequency: number = 50,
38
+ NoopTimeFrequency: number = defaultNoopTimeFrequency,
39
+ private readonly NoopCountFrequency: number = defaultNoopCountFrequency,
38
40
  ) {
39
- this.timer = new Timer(NoopTimeFrequency, () => {
40
- // Can get here due to this.stopSequenceNumberUpdate() not resetting timer.
41
- // Also timer callback can fire even after timer cancellation if it was queued before cancellation.
42
- if (this.opsCountSinceNoop !== 0) {
43
- assert(this.activeConnection(),
44
- 0x241 /* "disconnect should result in stopSequenceNumberUpdate() call" */);
45
- this.submitNoop(false /* immediate */);
46
- }
47
- });
41
+ if (NoopTimeFrequency !== Infinity) {
42
+ this.timer = new Timer(NoopTimeFrequency, () => {
43
+ // Can get here due to this.stopSequenceNumberUpdate() not resetting timer.
44
+ // Also timer callback can fire even after timer cancellation if it was queued before cancellation.
45
+ if (this.opsCountSinceNoop !== 0) {
46
+ this.submitNoop(false /* immediate */);
47
+ }
48
+ });
49
+ }
48
50
  }
49
51
 
50
52
  /**
51
53
  * Schedules as ack to the server to update the reference sequence number
52
54
  */
53
55
  public scheduleSequenceNumberUpdate(message: ISequencedDocumentMessage, immediateNoOp: boolean): void {
54
- // Exit early for inactive (not in quorum or not writers) clients.
55
- // They don't take part in the minimum sequence number calculation.
56
- if (!this.activeConnection()) {
57
- return;
58
- }
59
-
60
56
  // While processing a message, an immediate no-op can be requested.
61
57
  // i.e. to expedite approve or commit phase of quorum.
62
58
  if (immediateNoOp) {
@@ -65,22 +61,26 @@ export class CollabWindowTracker {
65
61
  }
66
62
 
67
63
  // We don't acknowledge no-ops to avoid acknowledgement cycles (i.e. ack the MSN
68
- // update, which updates the MSN, then ack the update, etc...). Also, don't
69
- // count system messages in ops count.
70
- if (isSystemMessage(message)) {
64
+ // update, which updates the MSN, then ack the update, etc...).
65
+ // Intent here is for runtime (and DDSs) not to keep too much tracking state / memory
66
+ // due to runtime ops from other clients.
67
+ if (!isRuntimeMessage(message)) {
71
68
  return;
72
69
  }
73
- assert(message.type !== MessageType.NoOp, 0x0ce /* "Don't acknowledge no-ops" */);
74
70
 
75
71
  this.opsCountSinceNoop++;
76
72
  if (this.opsCountSinceNoop >= this.NoopCountFrequency) {
77
73
  this.submitNoop(false /* immediate */);
78
74
  return;
79
75
  }
80
- if (this.opsCountSinceNoop === 1) {
81
- this.timer.restart();
76
+
77
+ if (this.timer !== undefined) {
78
+ if (this.opsCountSinceNoop === 1) {
79
+ this.timer.restart();
80
+ }
81
+
82
+ assert(this.timer.hasTimer, 0x242 /* "has timer" */);
82
83
  }
83
- assert(this.timer.hasTimer, 0x242 /* "has timer" */);
84
84
  }
85
85
 
86
86
  private submitNoop(immediate: boolean) {
@@ -171,7 +171,7 @@ export class ConnectionManager implements IConnectionManager {
171
171
  /**
172
172
  * The current connection mode, initially read.
173
173
  */
174
- public get connectionMode(): ConnectionMode {
174
+ public get connectionMode(): ConnectionMode {
175
175
  return this.connection?.mode ?? "read";
176
176
  }
177
177
 
@@ -0,0 +1,21 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ export enum ConnectionState {
7
+ /**
8
+ * The document is no longer connected to the delta server
9
+ */
10
+ Disconnected,
11
+
12
+ /**
13
+ * The document has an inbound connection but is still pending for outbound deltas
14
+ */
15
+ Connecting,
16
+
17
+ /**
18
+ * The document is fully connected
19
+ */
20
+ Connected,
21
+ }
@@ -8,7 +8,7 @@ import { IConnectionDetails } from "@fluidframework/container-definitions";
8
8
  import { ConnectionMode, IQuorumClients, ISequencedClient } from "@fluidframework/protocol-definitions";
9
9
  import { PerformanceEvent } from "@fluidframework/telemetry-utils";
10
10
  import { assert, Timer } from "@fluidframework/common-utils";
11
- import { ConnectionState } from "./container";
11
+ import { ConnectionState } from "./connectionState";
12
12
 
13
13
  export interface IConnectionStateHandler {
14
14
  quorumClients: () => IQuorumClients | undefined;
package/src/container.ts CHANGED
@@ -106,6 +106,7 @@ import { getProtocolSnapshotTree, getSnapshotTreeFromSerializedContainer } from
106
106
  import { initQuorumValuesFromCodeDetails, getCodeDetailsFromQuorumValues, QuorumProxy } from "./quorum";
107
107
  import { CollabWindowTracker } from "./collabWindowTracker";
108
108
  import { ConnectionManager } from "./connectionManager";
109
+ import { ConnectionState } from "./connectionState";
109
110
 
110
111
  const detachedContainerRefSeqNumber = 0;
111
112
 
@@ -141,23 +142,6 @@ export interface IContainerConfig {
141
142
  clientDetailsOverride?: IClientDetails;
142
143
  }
143
144
 
144
- export enum ConnectionState {
145
- /**
146
- * The document is no longer connected to the delta server
147
- */
148
- Disconnected,
149
-
150
- /**
151
- * The document has an inbound connection but is still pending for outbound deltas
152
- */
153
- Connecting,
154
-
155
- /**
156
- * The document is fully connected
157
- */
158
- Connected,
159
- }
160
-
161
145
  /**
162
146
  * Waits until container connects to delta storage and gets up-to-date
163
147
  * Useful when resolving URIs and hitting 404, due to container being loaded from (stale) snapshot and not being
@@ -423,12 +407,7 @@ export class Container extends EventEmitterWithErrorHandling<IContainerEvents> i
423
407
 
424
408
  private setAutoReconnectTime = performance.now();
425
409
 
426
- private readonly collabWindowTracker = new CollabWindowTracker(
427
- (type, contents) => this.submitMessage(type, contents),
428
- () => this.activeConnection(),
429
- this.loader.services.options?.noopTimeFrequency,
430
- this.loader.services.options?.noopCountFrequency,
431
- );
410
+ private collabWindowTracker: CollabWindowTracker | undefined;
432
411
 
433
412
  private get connectionMode() { return this._deltaManager.connectionManager.connectionMode; }
434
413
 
@@ -1542,7 +1521,7 @@ export class Container extends EventEmitterWithErrorHandling<IContainerEvents> i
1542
1521
  });
1543
1522
 
1544
1523
  deltaManager.on("disconnect", (reason: string) => {
1545
- this.collabWindowTracker.stopSequenceNumberUpdate();
1524
+ this.collabWindowTracker?.stopSequenceNumberUpdate();
1546
1525
  this.connectionStateHandler.receivedDisconnectEvent(reason);
1547
1526
  });
1548
1527
 
@@ -1698,7 +1677,7 @@ export class Container extends EventEmitterWithErrorHandling<IContainerEvents> i
1698
1677
  }
1699
1678
 
1700
1679
  this.messageCountAfterDisconnection += 1;
1701
- this.collabWindowTracker.stopSequenceNumberUpdate();
1680
+ this.collabWindowTracker?.stopSequenceNumberUpdate();
1702
1681
  return this._deltaManager.submit(type, contents, batch, metadata);
1703
1682
  }
1704
1683
 
@@ -1733,13 +1712,55 @@ export class Container extends EventEmitterWithErrorHandling<IContainerEvents> i
1733
1712
 
1734
1713
  // Allow the protocol handler to process the message
1735
1714
  const result = this.protocolHandler.processMessage(message, local);
1736
- this.collabWindowTracker.scheduleSequenceNumberUpdate(message, result.immediateNoOp === true);
1715
+ // Inactive (not in quorum or not writers) clients don't take part in the minimum sequence number calculation.
1716
+ if (this.activeConnection()) {
1717
+ if (this.collabWindowTracker === undefined) {
1718
+ // Note that config from first connection will be used for this container's lifetime.
1719
+ // That means that if relay service changes settings, such changes will impact only newly booted
1720
+ // clients.
1721
+ // All existing will continue to use settings they got earlier.
1722
+ const [noopTimeFrequency, noopCountFrequency] = this.getNoopConfig();
1723
+ this.collabWindowTracker = new CollabWindowTracker(
1724
+ (type, contents) => {
1725
+ assert(this.activeConnection(),
1726
+ 0x241 /* "disconnect should result in stopSequenceNumberUpdate() call" */);
1727
+ this.submitMessage(type, contents);
1728
+ },
1729
+ noopTimeFrequency,
1730
+ noopCountFrequency,
1731
+ );
1732
+ }
1733
+ this.collabWindowTracker.scheduleSequenceNumberUpdate(message, result.immediateNoOp === true);
1734
+ }
1737
1735
 
1738
1736
  this.emit("op", message);
1739
1737
 
1740
1738
  return result;
1741
1739
  }
1742
1740
 
1741
+ /**
1742
+ * #260 (ADO)
1743
+ * back-compat: noopTimeFrequency & noopCountFrequency properties were added to
1744
+ * IClientConfiguration in 0.59.3000. During the integration, we must read the
1745
+ * available configuration from the loader options.
1746
+ */
1747
+ private getNoopConfig(): [number | undefined, number | undefined] {
1748
+ assert(
1749
+ this.serviceConfiguration !== undefined,
1750
+ 0x2e2, /* "there should be service config for active connection" */
1751
+ );
1752
+
1753
+ if (this.serviceConfiguration.noopTimeFrequency !== undefined ||
1754
+ this.serviceConfiguration.noopCountFrequency !== undefined) {
1755
+ return [
1756
+ this.serviceConfiguration.noopTimeFrequency as number,
1757
+ this.serviceConfiguration.noopCountFrequency as number,
1758
+ ];
1759
+ }
1760
+
1761
+ return [this.loader.services.options?.noopTimeFrequency, this.loader.services.options?.noopCountFrequency];
1762
+ }
1763
+
1743
1764
  private submitSignal(message: any) {
1744
1765
  this._deltaManager.submitSignal(JSON.stringify(message));
1745
1766
  }
package/src/contracts.ts CHANGED
@@ -101,6 +101,8 @@ export interface IConnectionManager {
101
101
  * Disposed connection manager
102
102
  */
103
103
  dispose(error?: ICriticalContainerError): void;
104
+
105
+ get connectionMode(): ConnectionMode;
104
106
  }
105
107
 
106
108
  /**
package/src/index.ts CHANGED
@@ -3,8 +3,8 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
+ export { ConnectionState } from "./connectionState";
6
7
  export {
7
- ConnectionState,
8
8
  Container,
9
9
  IContainerLoadOptions,
10
10
  IContainerConfig,
package/src/loader.ts CHANGED
@@ -128,7 +128,7 @@ function createCachedResolver(resolver: IUrlResolver) {
128
128
  return cacheResolver;
129
129
  }
130
130
 
131
- export interface ILoaderOptions extends ILoaderOptions1{
131
+ export interface ILoaderOptions extends ILoaderOptions1 {
132
132
  summarizeProtocolTree?: boolean;
133
133
  }
134
134
 
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/container-loader";
9
- export const pkgVersion = "0.59.3003";
9
+ export const pkgVersion = "0.59.4000-71128";