@fluidframework/container-loader 0.52.1 → 0.54.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.
Files changed (75) hide show
  1. package/dist/connectionManager.d.ts +153 -0
  2. package/dist/connectionManager.d.ts.map +1 -0
  3. package/dist/connectionManager.js +664 -0
  4. package/dist/connectionManager.js.map +1 -0
  5. package/dist/connectionStateHandler.d.ts +1 -0
  6. package/dist/connectionStateHandler.d.ts.map +1 -1
  7. package/dist/connectionStateHandler.js +6 -0
  8. package/dist/connectionStateHandler.js.map +1 -1
  9. package/dist/container.d.ts +2 -22
  10. package/dist/container.d.ts.map +1 -1
  11. package/dist/container.js +121 -151
  12. package/dist/container.js.map +1 -1
  13. package/dist/containerContext.d.ts +1 -0
  14. package/dist/containerContext.d.ts.map +1 -1
  15. package/dist/containerContext.js +4 -0
  16. package/dist/containerContext.js.map +1 -1
  17. package/dist/contracts.d.ts +112 -0
  18. package/dist/contracts.d.ts.map +1 -0
  19. package/dist/contracts.js +14 -0
  20. package/dist/contracts.js.map +1 -0
  21. package/dist/deltaManager.d.ts +26 -142
  22. package/dist/deltaManager.d.ts.map +1 -1
  23. package/dist/deltaManager.js +143 -770
  24. package/dist/deltaManager.js.map +1 -1
  25. package/dist/loader.d.ts +14 -4
  26. package/dist/loader.d.ts.map +1 -1
  27. package/dist/loader.js +10 -4
  28. package/dist/loader.js.map +1 -1
  29. package/dist/packageVersion.d.ts +1 -1
  30. package/dist/packageVersion.js +1 -1
  31. package/dist/packageVersion.js.map +1 -1
  32. package/dist/protocolTreeDocumentStorageService.d.ts +2 -2
  33. package/dist/protocolTreeDocumentStorageService.d.ts.map +1 -1
  34. package/lib/connectionManager.d.ts +153 -0
  35. package/lib/connectionManager.d.ts.map +1 -0
  36. package/lib/connectionManager.js +660 -0
  37. package/lib/connectionManager.js.map +1 -0
  38. package/lib/connectionStateHandler.d.ts +1 -0
  39. package/lib/connectionStateHandler.d.ts.map +1 -1
  40. package/lib/connectionStateHandler.js +6 -0
  41. package/lib/connectionStateHandler.js.map +1 -1
  42. package/lib/container.d.ts +2 -22
  43. package/lib/container.d.ts.map +1 -1
  44. package/lib/container.js +122 -152
  45. package/lib/container.js.map +1 -1
  46. package/lib/containerContext.d.ts +1 -0
  47. package/lib/containerContext.d.ts.map +1 -1
  48. package/lib/containerContext.js +4 -0
  49. package/lib/containerContext.js.map +1 -1
  50. package/lib/contracts.d.ts +112 -0
  51. package/lib/contracts.d.ts.map +1 -0
  52. package/lib/contracts.js +11 -0
  53. package/lib/contracts.js.map +1 -0
  54. package/lib/deltaManager.d.ts +26 -142
  55. package/lib/deltaManager.d.ts.map +1 -1
  56. package/lib/deltaManager.js +147 -774
  57. package/lib/deltaManager.js.map +1 -1
  58. package/lib/loader.d.ts +14 -4
  59. package/lib/loader.d.ts.map +1 -1
  60. package/lib/loader.js +11 -5
  61. package/lib/loader.js.map +1 -1
  62. package/lib/packageVersion.d.ts +1 -1
  63. package/lib/packageVersion.js +1 -1
  64. package/lib/packageVersion.js.map +1 -1
  65. package/lib/protocolTreeDocumentStorageService.d.ts +2 -2
  66. package/lib/protocolTreeDocumentStorageService.d.ts.map +1 -1
  67. package/package.json +9 -9
  68. package/src/connectionManager.ts +892 -0
  69. package/src/connectionStateHandler.ts +8 -0
  70. package/src/container.ts +165 -187
  71. package/src/containerContext.ts +4 -0
  72. package/src/contracts.ts +156 -0
  73. package/src/deltaManager.ts +181 -978
  74. package/src/loader.ts +59 -27
  75. package/src/packageVersion.ts +1 -1
@@ -52,6 +52,7 @@ export declare class ContainerContext implements IContainerContext {
52
52
  get codeDetails(): IFluidCodeDetails;
53
53
  private readonly _fluidModuleP;
54
54
  constructor(container: Container, scope: IFluidObject & FluidObject, codeLoader: ICodeDetailsLoader | ICodeLoader, _codeDetails: IFluidCodeDetails, _baseSnapshot: ISnapshotTree | undefined, deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>, quorum: IQuorum, loader: ILoader, raiseContainerWarning: (warning: ContainerWarning) => void, submitFn: (type: MessageType, contents: any, batch: boolean, appData: any) => number, submitSignalFn: (contents: any) => void, closeFn: (error?: ICriticalContainerError) => void, version: string, updateDirtyContainerState: (dirty: boolean) => void, existing: boolean, pendingLocalState?: unknown);
55
+ getSpecifiedCodeDetails(): IFluidCodeDetails | undefined;
55
56
  dispose(error?: Error): void;
56
57
  snapshot(tagMessage?: string, fullTree?: boolean): Promise<ITree | null>;
57
58
  getLoadedFromVersion(): IVersion | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"containerContext.d.ts","sourceRoot":"","sources":["../src/containerContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EACH,YAAY,EACZ,mBAAmB,EACnB,QAAQ,EACR,SAAS,EACT,iBAAiB,EAGjB,WAAW,EACd,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACH,SAAS,EACT,iBAAiB,EACjB,aAAa,EACb,OAAO,EAEP,uBAAuB,EACvB,gBAAgB,EAChB,WAAW,EACX,cAAc,EAEd,WAAW,EAEd,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EACH,oBAAoB,EACpB,cAAc,EACd,gBAAgB,EAChB,OAAO,EACP,yBAAyB,EACzB,cAAc,EACd,aAAa,EACb,KAAK,EACL,WAAW,EACX,YAAY,EACZ,QAAQ,EACX,MAAM,sCAAsC,CAAC;AAG9C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAA2B,MAAM,UAAU,CAAC;AAIvE,qBAAa,gBAAiB,YAAW,iBAAiB;IAqHlD,OAAO,CAAC,QAAQ,CAAC,SAAS;aACV,KAAK,EAAE,YAAY,GAAG,WAAW;IACjD,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,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AE,KAAK,GAAG,IAAI;IAWtB,QAAQ,CAAC,UAAU,GAAE,MAAW,EAAE,QAAQ,GAAE,OAAe,GAAG,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;IAIzF,oBAAoB,IAAI,QAAQ,GAAG,SAAS;IAInD,IAAW,WAAW,IAAI,WAAW,CAEpC;IAED;;;;;;OAMG;IACI,aAAa,CAAC,iBAAiB,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,YAAY;IAIpE,kBAAkB,CAAC,SAAS,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,MAAM;IAQxD,OAAO,CAAC,OAAO,EAAE,yBAAyB,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG;IAIxE,aAAa,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,OAAO;IAI/C,OAAO,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,SAAS,CAAC;IAI3C,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAItE,oBAAoB,IAAI,OAAO;IAItC;;;OAGG;IACU,SAAS,CAAC,qBAAqB,EAAE,iBAAiB;IAoCxD,eAAe;YAMR,iBAAiB;YAWjB,kBAAkB;IAKhC,OAAO,CAAC,cAAc;YAMR,cAAc;CAkB/B"}
@@ -88,6 +88,10 @@ export class ContainerContext {
88
88
  return this._disposed;
89
89
  }
90
90
  get codeDetails() { return this._codeDetails; }
91
+ getSpecifiedCodeDetails() {
92
+ var _a;
93
+ return ((_a = this.quorum.get("code")) !== null && _a !== void 0 ? _a : this.quorum.get("code2"));
94
+ }
91
95
  dispose(error) {
92
96
  if (this._disposed) {
93
97
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"containerContext.js","sourceRoot":"","sources":["../src/containerContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAaH,OAAO,EAQH,WAAW,GAKd,MAAM,uCAAuC,CAAC;AAe/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MAAM,cAAc,CAAC,kBAAkB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC5E,CAAC;IAEO,cAAc;QAClB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,EAAE,GAAG,EAAE;YACjC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QACtD,CAAC,CAAC,CAAC;IACP,CAAC;IAEO,KAAK,CAAC,cAAc,CAAC,WAA8B;QACvD,MAAM,cAAc,GAAG,MAAM,gBAAgB,CAAC,cAAc,CACxD,IAAI,CAAC,YAAY,EACjB,EAAE,SAAS,EAAE,UAAU,EAAE,EACzB,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,CAChD,CAAC;QAEF,IAAI,QAAQ,IAAI,cAAc,EAAE;YAC5B,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,cAAc,CAAC;YAC3C,OAAO;gBACH,MAAM;gBACN,OAAO,EAAE,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,WAAW;aAClC,CAAC;SACL;aAAM;YACH,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;SAC3D;IACL,CAAC;CAEJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport {\n IFluidObject,\n IFluidConfiguration,\n IRequest,\n IResponse,\n IFluidCodeDetails,\n IFluidCodeDetailsComparer,\n IProvideFluidCodeDetailsComparer,\n FluidObject,\n} from \"@fluidframework/core-interfaces\";\nimport {\n IAudience,\n IContainerContext,\n IDeltaManager,\n ILoader,\n IRuntime,\n ICriticalContainerError,\n ContainerWarning,\n AttachState,\n ILoaderOptions,\n IRuntimeFactory,\n ICodeLoader,\n IProvideRuntimeFactory,\n} from \"@fluidframework/container-definitions\";\nimport { IDocumentStorageService } from \"@fluidframework/driver-definitions\";\nimport {\n IClientConfiguration,\n IClientDetails,\n IDocumentMessage,\n IQuorum,\n ISequencedDocumentMessage,\n ISignalMessage,\n ISnapshotTree,\n ITree,\n MessageType,\n ISummaryTree,\n IVersion,\n} from \"@fluidframework/protocol-definitions\";\nimport { PerformanceEvent } from \"@fluidframework/telemetry-utils\";\nimport { assert, LazyPromise } from \"@fluidframework/common-utils\";\nimport { Container } from \"./container\";\nimport { ICodeDetailsLoader, IFluidModuleWithDetails } from \"./loader\";\n\nconst PackageNotFactoryError = \"Code package does not implement IRuntimeFactory\";\n\nexport class ContainerContext implements IContainerContext {\n public static async createOrLoad(\n container: Container,\n scope: FluidObject,\n codeLoader: ICodeDetailsLoader | ICodeLoader,\n codeDetails: IFluidCodeDetails,\n baseSnapshot: ISnapshotTree | undefined,\n deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,\n quorum: IQuorum,\n loader: ILoader,\n raiseContainerWarning: (warning: ContainerWarning) => void,\n submitFn: (type: MessageType, contents: any, batch: boolean, appData: any) => number,\n submitSignalFn: (contents: any) => void,\n closeFn: (error?: ICriticalContainerError) => void,\n version: string,\n updateDirtyContainerState: (dirty: boolean) => void,\n existing: boolean,\n pendingLocalState?: unknown,\n ): Promise<ContainerContext> {\n const context = new ContainerContext(\n container,\n scope,\n codeLoader,\n codeDetails,\n baseSnapshot,\n deltaManager,\n quorum,\n loader,\n raiseContainerWarning,\n submitFn,\n submitSignalFn,\n closeFn,\n version,\n updateDirtyContainerState,\n existing,\n pendingLocalState);\n await context.instantiateRuntime(existing);\n return context;\n }\n\n public readonly taggedLogger: ITelemetryLogger;\n\n /**\n * Subtlety: returns this.taggedLogger since vanilla this.logger is now deprecated. See IContainerContext for more\n * details.\n */\n /** @deprecated See IContainerContext for more details. */\n public get logger(): ITelemetryLogger {\n return this.taggedLogger;\n }\n\n public get id(): string {\n return this.container.id;\n }\n\n public get clientId(): string | undefined {\n return this.container.clientId;\n }\n\n public get clientDetails(): IClientDetails {\n return this.container.clientDetails;\n }\n\n public get connected(): boolean {\n return this.container.connected;\n }\n\n public get canSummarize(): boolean {\n return \"summarize\" in this.runtime;\n }\n\n public get serviceConfiguration(): IClientConfiguration | undefined {\n return this.container.serviceConfiguration;\n }\n\n public get audience(): IAudience {\n return this.container.audience;\n }\n\n public get options(): ILoaderOptions {\n return this.container.options;\n }\n\n public get configuration(): IFluidConfiguration {\n const config: Partial<IFluidConfiguration> = {\n scopes: this.container.scopes,\n };\n return config as IFluidConfiguration;\n }\n\n public get baseSnapshot() {\n return this._baseSnapshot;\n }\n\n public get storage(): IDocumentStorageService {\n return this.container.storage;\n }\n\n private _runtime: IRuntime | undefined;\n private get runtime() {\n if (this._runtime === undefined) {\n throw new Error(\"Attempted to access runtime before it was defined\");\n }\n return this._runtime;\n }\n\n private _disposed = false;\n\n public get disposed() {\n return this._disposed;\n }\n\n public get codeDetails() { return this._codeDetails; }\n\n private readonly _fluidModuleP: Promise<IFluidModuleWithDetails>;\n\n constructor(\n private readonly container: Container,\n public readonly scope: IFluidObject & FluidObject,\n private readonly codeLoader: ICodeDetailsLoader | ICodeLoader,\n private readonly _codeDetails: IFluidCodeDetails,\n private readonly _baseSnapshot: ISnapshotTree | undefined,\n public readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,\n public readonly quorum: IQuorum,\n public readonly loader: ILoader,\n public readonly raiseContainerWarning: (warning: ContainerWarning) => void,\n public readonly submitFn: (type: MessageType, contents: any, batch: boolean, appData: any) => number,\n public readonly submitSignalFn: (contents: any) => void,\n public readonly closeFn: (error?: ICriticalContainerError) => void,\n public readonly version: string,\n public readonly updateDirtyContainerState: (dirty: boolean) => void,\n public readonly existing: boolean,\n public readonly pendingLocalState?: unknown,\n\n ) {\n this.taggedLogger = container.subLogger;\n this._fluidModuleP = new LazyPromise<IFluidModuleWithDetails>(\n async () => this.loadCodeModule(_codeDetails),\n );\n this.attachListener();\n }\n\n public dispose(error?: Error): void {\n if (this._disposed) {\n return;\n }\n this._disposed = true;\n\n this.runtime.dispose(error);\n this.quorum.dispose();\n this.deltaManager.dispose();\n }\n\n public async snapshot(tagMessage: string = \"\", fullTree: boolean = false): Promise<ITree | null> {\n return this.runtime.snapshot(tagMessage, fullTree);\n }\n\n public getLoadedFromVersion(): IVersion | undefined {\n return this.container.loadedFromVersion;\n }\n\n public get attachState(): AttachState {\n return this.container.attachState;\n }\n\n /**\n * Create a summary. Used when attaching or serializing a detached container.\n *\n * @param blobRedirectTable - A table passed during the attach process. While detached, blob upload is supported\n * using IDs generated locally. After attach, these IDs cannot be used, so this table maps the old local IDs to the\n * new storage IDs so requests can be redirected.\n */\n public createSummary(blobRedirectTable?: Map<string, string>): ISummaryTree {\n return this.runtime.createSummary(blobRedirectTable);\n }\n\n public setConnectionState(connected: boolean, clientId?: string) {\n const runtime = this.runtime;\n\n assert(connected === this.connected, 0x0de /* \"Mismatch in connection state while setting\" */);\n\n runtime.setConnectionState(connected, clientId);\n }\n\n public process(message: ISequencedDocumentMessage, local: boolean, context: any) {\n this.runtime.process(message, local, context);\n }\n\n public processSignal(message: ISignalMessage, local: boolean) {\n this.runtime.processSignal(message, local);\n }\n\n public async request(path: IRequest): Promise<IResponse> {\n return this.runtime.request(path);\n }\n\n public async getAbsoluteUrl(relativeUrl: string): Promise<string | undefined> {\n return this.container.getAbsoluteUrl(relativeUrl);\n }\n\n public getPendingLocalState(): unknown {\n return this.runtime.getPendingLocalState();\n }\n\n /**\n * Determines if the current code details of the context\n * satisfy the incoming constraint code details\n */\n public async satisfies(constraintCodeDetails: IFluidCodeDetails) {\n const comparers: IFluidCodeDetailsComparer[] = [];\n\n const maybeCompareCodeLoader = this.codeLoader;\n if (maybeCompareCodeLoader.IFluidCodeDetailsComparer !== undefined) {\n comparers.push(maybeCompareCodeLoader.IFluidCodeDetailsComparer);\n }\n\n const moduleWithDetails = await this._fluidModuleP;\n const maybeCompareExport: Partial<IProvideFluidCodeDetailsComparer> | undefined =\n moduleWithDetails.module?.fluidExport;\n if (maybeCompareExport?.IFluidCodeDetailsComparer !== undefined) {\n comparers.push(maybeCompareExport.IFluidCodeDetailsComparer);\n }\n\n // if there are not comparers it is not possible to know\n // if the current satisfy the incoming, so return false,\n // as assuming they do not satisfy is safer .e.g we will\n // reload, rather than potentially running with\n // incompatible code\n if (comparers.length === 0) {\n return false;\n }\n\n for (const comparer of comparers) {\n const satisfies = await comparer.satisfies(\n moduleWithDetails.details,\n constraintCodeDetails,\n );\n if (satisfies === false) {\n return false;\n }\n }\n return true;\n }\n\n public notifyAttaching() {\n this.runtime.setAttachState(AttachState.Attaching);\n }\n\n // #region private\n\n private async getRuntimeFactory(): Promise<IRuntimeFactory> {\n const fluidExport: FluidObject<IProvideRuntimeFactory> | undefined =\n (await this._fluidModuleP).module?.fluidExport;\n const runtimeFactory = fluidExport?.IRuntimeFactory;\n if (runtimeFactory === undefined) {\n throw new Error(PackageNotFactoryError);\n }\n\n return runtimeFactory;\n }\n\n private async instantiateRuntime(existing: boolean) {\n const runtimeFactory = await this.getRuntimeFactory();\n this._runtime = await runtimeFactory.instantiateRuntime(this, existing);\n }\n\n private attachListener() {\n this.container.once(\"attached\", () => {\n this.runtime.setAttachState(AttachState.Attached);\n });\n }\n\n private async loadCodeModule(codeDetails: IFluidCodeDetails) {\n const loadCodeResult = await PerformanceEvent.timedExecAsync(\n this.taggedLogger,\n { eventName: \"CodeLoad\" },\n async () => this.codeLoader.load(codeDetails),\n );\n\n if (\"module\" in loadCodeResult) {\n const { module, details } = loadCodeResult;\n return {\n module,\n details: details ?? codeDetails,\n };\n } else {\n return { module: loadCodeResult, details: codeDetails };\n }\n }\n // #endregion\n}\n"]}
1
+ {"version":3,"file":"containerContext.js","sourceRoot":"","sources":["../src/containerContext.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAaH,OAAO,EAQH,WAAW,GAKd,MAAM,uCAAuC,CAAC;AAe/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,i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AAK,CAAC,kBAAkB,CAAC,QAAiB;QAC9C,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACtD,IAAI,CAAC,QAAQ,GAAG,MAAM,cAAc,CAAC,kBAAkB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC5E,CAAC;IAEO,cAAc;QAClB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,EAAE,GAAG,EAAE;YACjC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QACtD,CAAC,CAAC,CAAC;IACP,CAAC;IAEO,KAAK,CAAC,cAAc,CAAC,WAA8B;QACvD,MAAM,cAAc,GAAG,MAAM,gBAAgB,CAAC,cAAc,CACxD,IAAI,CAAC,YAAY,EACjB,EAAE,SAAS,EAAE,UAAU,EAAE,EACzB,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,CAChD,CAAC;QAEF,IAAI,QAAQ,IAAI,cAAc,EAAE;YAC5B,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,cAAc,CAAC;YAC3C,OAAO;gBACH,MAAM;gBACN,OAAO,EAAE,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,WAAW;aAClC,CAAC;SACL;aAAM;YACH,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;SAC3D;IACL,CAAC;CAEJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport {\n IFluidObject,\n IFluidConfiguration,\n IRequest,\n IResponse,\n IFluidCodeDetails,\n IFluidCodeDetailsComparer,\n IProvideFluidCodeDetailsComparer,\n FluidObject,\n} from \"@fluidframework/core-interfaces\";\nimport {\n IAudience,\n IContainerContext,\n IDeltaManager,\n ILoader,\n IRuntime,\n ICriticalContainerError,\n ContainerWarning,\n AttachState,\n ILoaderOptions,\n IRuntimeFactory,\n ICodeLoader,\n IProvideRuntimeFactory,\n} from \"@fluidframework/container-definitions\";\nimport { IDocumentStorageService } from \"@fluidframework/driver-definitions\";\nimport {\n IClientConfiguration,\n IClientDetails,\n IDocumentMessage,\n IQuorum,\n ISequencedDocumentMessage,\n ISignalMessage,\n ISnapshotTree,\n ITree,\n MessageType,\n ISummaryTree,\n IVersion,\n} from \"@fluidframework/protocol-definitions\";\nimport { PerformanceEvent } from \"@fluidframework/telemetry-utils\";\nimport { assert, LazyPromise } from \"@fluidframework/common-utils\";\nimport { Container } from \"./container\";\nimport { ICodeDetailsLoader, IFluidModuleWithDetails } from \"./loader\";\n\nconst PackageNotFactoryError = \"Code package does not implement IRuntimeFactory\";\n\nexport class ContainerContext implements IContainerContext {\n public static async createOrLoad(\n container: Container,\n scope: FluidObject,\n codeLoader: ICodeDetailsLoader | ICodeLoader,\n codeDetails: IFluidCodeDetails,\n baseSnapshot: ISnapshotTree | undefined,\n deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,\n quorum: IQuorum,\n loader: ILoader,\n raiseContainerWarning: (warning: ContainerWarning) => void,\n submitFn: (type: MessageType, contents: any, batch: boolean, appData: any) => number,\n submitSignalFn: (contents: any) => void,\n closeFn: (error?: ICriticalContainerError) => void,\n version: string,\n updateDirtyContainerState: (dirty: boolean) => void,\n existing: boolean,\n pendingLocalState?: unknown,\n ): Promise<ContainerContext> {\n const context = new ContainerContext(\n container,\n scope,\n codeLoader,\n codeDetails,\n baseSnapshot,\n deltaManager,\n quorum,\n loader,\n raiseContainerWarning,\n submitFn,\n submitSignalFn,\n closeFn,\n version,\n updateDirtyContainerState,\n existing,\n pendingLocalState);\n await context.instantiateRuntime(existing);\n return context;\n }\n\n public readonly taggedLogger: ITelemetryLogger;\n\n /**\n * Subtlety: returns this.taggedLogger since vanilla this.logger is now deprecated. See IContainerContext for more\n * details.\n */\n /** @deprecated See IContainerContext for more details. */\n public get logger(): ITelemetryLogger {\n return this.taggedLogger;\n }\n\n public get id(): string {\n return this.container.id;\n }\n\n public get clientId(): string | undefined {\n return this.container.clientId;\n }\n\n public get clientDetails(): IClientDetails {\n return this.container.clientDetails;\n }\n\n public get connected(): boolean {\n return this.container.connected;\n }\n\n public get canSummarize(): boolean {\n return \"summarize\" in this.runtime;\n }\n\n public get serviceConfiguration(): IClientConfiguration | undefined {\n return this.container.serviceConfiguration;\n }\n\n public get audience(): IAudience {\n return this.container.audience;\n }\n\n public get options(): ILoaderOptions {\n return this.container.options;\n }\n\n public get configuration(): IFluidConfiguration {\n const config: Partial<IFluidConfiguration> = {\n scopes: this.container.scopes,\n };\n return config as IFluidConfiguration;\n }\n\n public get baseSnapshot() {\n return this._baseSnapshot;\n }\n\n public get storage(): IDocumentStorageService {\n return this.container.storage;\n }\n\n private _runtime: IRuntime | undefined;\n private get runtime() {\n if (this._runtime === undefined) {\n throw new Error(\"Attempted to access runtime before it was defined\");\n }\n return this._runtime;\n }\n\n private _disposed = false;\n\n public get disposed() {\n return this._disposed;\n }\n\n public get codeDetails() { return this._codeDetails; }\n\n private readonly _fluidModuleP: Promise<IFluidModuleWithDetails>;\n\n constructor(\n private readonly container: Container,\n public readonly scope: IFluidObject & FluidObject,\n private readonly codeLoader: ICodeDetailsLoader | ICodeLoader,\n private readonly _codeDetails: IFluidCodeDetails,\n private readonly _baseSnapshot: ISnapshotTree | undefined,\n public readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,\n public readonly quorum: IQuorum,\n public readonly loader: ILoader,\n public readonly raiseContainerWarning: (warning: ContainerWarning) => void,\n public readonly submitFn: (type: MessageType, contents: any, batch: boolean, appData: any) => number,\n public readonly submitSignalFn: (contents: any) => void,\n public readonly closeFn: (error?: ICriticalContainerError) => void,\n public readonly version: string,\n public readonly updateDirtyContainerState: (dirty: boolean) => void,\n public readonly existing: boolean,\n public readonly pendingLocalState?: unknown,\n\n ) {\n this.taggedLogger = container.subLogger;\n this._fluidModuleP = new LazyPromise<IFluidModuleWithDetails>(\n async () => this.loadCodeModule(_codeDetails),\n );\n this.attachListener();\n }\n\n public getSpecifiedCodeDetails(): IFluidCodeDetails | undefined {\n return (this.quorum.get(\"code\") ?? this.quorum.get(\"code2\")) as IFluidCodeDetails | undefined;\n }\n\n public dispose(error?: Error): void {\n if (this._disposed) {\n return;\n }\n this._disposed = true;\n\n this.runtime.dispose(error);\n this.quorum.dispose();\n this.deltaManager.dispose();\n }\n\n public async snapshot(tagMessage: string = \"\", fullTree: boolean = false): Promise<ITree | null> {\n return this.runtime.snapshot(tagMessage, fullTree);\n }\n\n public getLoadedFromVersion(): IVersion | undefined {\n return this.container.loadedFromVersion;\n }\n\n public get attachState(): AttachState {\n return this.container.attachState;\n }\n\n /**\n * Create a summary. Used when attaching or serializing a detached container.\n *\n * @param blobRedirectTable - A table passed during the attach process. While detached, blob upload is supported\n * using IDs generated locally. After attach, these IDs cannot be used, so this table maps the old local IDs to the\n * new storage IDs so requests can be redirected.\n */\n public createSummary(blobRedirectTable?: Map<string, string>): ISummaryTree {\n return this.runtime.createSummary(blobRedirectTable);\n }\n\n public setConnectionState(connected: boolean, clientId?: string) {\n const runtime = this.runtime;\n\n assert(connected === this.connected, 0x0de /* \"Mismatch in connection state while setting\" */);\n\n runtime.setConnectionState(connected, clientId);\n }\n\n public process(message: ISequencedDocumentMessage, local: boolean, context: any) {\n this.runtime.process(message, local, context);\n }\n\n public processSignal(message: ISignalMessage, local: boolean) {\n this.runtime.processSignal(message, local);\n }\n\n public async request(path: IRequest): Promise<IResponse> {\n return this.runtime.request(path);\n }\n\n public async getAbsoluteUrl(relativeUrl: string): Promise<string | undefined> {\n return this.container.getAbsoluteUrl(relativeUrl);\n }\n\n public getPendingLocalState(): unknown {\n return this.runtime.getPendingLocalState();\n }\n\n /**\n * Determines if the current code details of the context\n * satisfy the incoming constraint code details\n */\n public async satisfies(constraintCodeDetails: IFluidCodeDetails) {\n const comparers: IFluidCodeDetailsComparer[] = [];\n\n const maybeCompareCodeLoader = this.codeLoader;\n if (maybeCompareCodeLoader.IFluidCodeDetailsComparer !== undefined) {\n comparers.push(maybeCompareCodeLoader.IFluidCodeDetailsComparer);\n }\n\n const moduleWithDetails = await this._fluidModuleP;\n const maybeCompareExport: Partial<IProvideFluidCodeDetailsComparer> | undefined =\n moduleWithDetails.module?.fluidExport;\n if (maybeCompareExport?.IFluidCodeDetailsComparer !== undefined) {\n comparers.push(maybeCompareExport.IFluidCodeDetailsComparer);\n }\n\n // if there are not comparers it is not possible to know\n // if the current satisfy the incoming, so return false,\n // as assuming they do not satisfy is safer .e.g we will\n // reload, rather than potentially running with\n // incompatible code\n if (comparers.length === 0) {\n return false;\n }\n\n for (const comparer of comparers) {\n const satisfies = await comparer.satisfies(\n moduleWithDetails.details,\n constraintCodeDetails,\n );\n if (satisfies === false) {\n return false;\n }\n }\n return true;\n }\n\n public notifyAttaching() {\n this.runtime.setAttachState(AttachState.Attaching);\n }\n\n // #region private\n\n private async getRuntimeFactory(): Promise<IRuntimeFactory> {\n const fluidExport: FluidObject<IProvideRuntimeFactory> | undefined =\n (await this._fluidModuleP).module?.fluidExport;\n const runtimeFactory = fluidExport?.IRuntimeFactory;\n if (runtimeFactory === undefined) {\n throw new Error(PackageNotFactoryError);\n }\n\n return runtimeFactory;\n }\n\n private async instantiateRuntime(existing: boolean) {\n const runtimeFactory = await this.getRuntimeFactory();\n this._runtime = await runtimeFactory.instantiateRuntime(this, existing);\n }\n\n private attachListener() {\n this.container.once(\"attached\", () => {\n this.runtime.setAttachState(AttachState.Attached);\n });\n }\n\n private async loadCodeModule(codeDetails: IFluidCodeDetails) {\n const loadCodeResult = await PerformanceEvent.timedExecAsync(\n this.taggedLogger,\n { eventName: \"CodeLoad\" },\n async () => this.codeLoader.load(codeDetails),\n );\n\n if (\"module\" in loadCodeResult) {\n const { module, details } = loadCodeResult;\n return {\n module,\n details: details ?? codeDetails,\n };\n } else {\n return { module: loadCodeResult, details: codeDetails };\n }\n }\n // #endregion\n}\n"]}
@@ -0,0 +1,112 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { ITelemetryProperties } from "@fluidframework/common-definitions";
6
+ import { IDeltaQueue, ReadOnlyInfo, IConnectionDetails } from "@fluidframework/container-definitions";
7
+ import { ConnectionMode, IDocumentMessage, ISequencedDocumentMessage, IClientConfiguration, IClientDetails, ISignalMessage } from "@fluidframework/protocol-definitions";
8
+ export declare enum ReconnectMode {
9
+ Never = "Never",
10
+ Disabled = "Disabled",
11
+ Enabled = "Enabled"
12
+ }
13
+ /**
14
+ * Connection manager (implements this interface) is responsible for maintaining connection
15
+ * to relay service.
16
+ */
17
+ export interface IConnectionManager {
18
+ readonly connected: boolean;
19
+ readonly clientId: string | undefined;
20
+ /** The queue of outbound delta messages */
21
+ readonly outbound: IDeltaQueue<IDocumentMessage[]>;
22
+ /** Details of client */
23
+ readonly clientDetails: IClientDetails;
24
+ /** Protocol version being used to communicate with the service */
25
+ readonly version: string;
26
+ /** Max message size allowed to the delta manager */
27
+ readonly maxMessageSize: number;
28
+ /** Service configuration provided by the service. */
29
+ readonly serviceConfiguration: IClientConfiguration | undefined;
30
+ readonly readOnlyInfo: ReadOnlyInfo;
31
+ readonly connectionProps: ITelemetryProperties;
32
+ readonly connectionVerboseProps: ITelemetryProperties;
33
+ /**
34
+ * Prepares message to be sent. Fills in clientSequenceNumber.
35
+ * Called only when active connection is present.
36
+ */
37
+ prepareMessageToSend(message: Omit<IDocumentMessage, "clientSequenceNumber">): IDocumentMessage | undefined;
38
+ /**
39
+ * Called before incomming message is processed. Incomming messages can be comming from connection,
40
+ * but also could come from storage.
41
+ * This call allows connection manager to adjust knowledge about acked ops sent on previous connection.
42
+ * Can be called at any time, including when there is no active connection.
43
+ */
44
+ beforeProcessingIncomingOp(message: ISequencedDocumentMessage): void;
45
+ /**
46
+ * Submits signal to relay service.
47
+ * Called only when active connection is present.
48
+ */
49
+ submitSignal(content: any): void;
50
+ /**
51
+ * Submits messages to relay service.
52
+ * Called only when active connection is present.
53
+ */
54
+ sendMessages(messages: IDocumentMessage[]): void;
55
+ /**
56
+ * Initiates connection to relay service (noop if already connected).
57
+ */
58
+ connect(connectionMode?: ConnectionMode): void;
59
+ /**
60
+ * Disposed connection manager
61
+ */
62
+ dispose(error: any): void;
63
+ }
64
+ /**
65
+ * This interface represents a set of callbacks provided by DeltaManager to IConnectionManager on its creation
66
+ * IConnectionManager instance will use them to communicate to DeltaManager abour various events.
67
+ */
68
+ export interface IConnectionManagerFactoryArgs {
69
+ /**
70
+ * Called by connection manager for each incomming op. Some ops maybe delivered before
71
+ * connectHandler is called (initial ops on socket connection)
72
+ */
73
+ readonly incomingOpHandler: (messages: ISequencedDocumentMessage[], reason: string) => void;
74
+ /**
75
+ * Called by connection manager for each incoming signals.
76
+ * Maybe called before connectHandler is called (initial signals on socket connection)
77
+ */
78
+ readonly signalHandler: (message: ISignalMessage) => void;
79
+ /**
80
+ * Called when connection manager experiences delay in connecting to relay service.
81
+ * This can happen because client is offline, or service is busy and asks to not connect for some time.
82
+ * Can be called many times while not connected.
83
+ * Situation is considered resolved when connection is established and connectHandler is called.
84
+ */
85
+ readonly reconnectionDelayHandler: (delayMs: number, error: unknown) => void;
86
+ /**
87
+ * Called by connection manager whwnever critical error happens and container should be closed.
88
+ * Expects dispose() call in respose to this call.
89
+ */
90
+ readonly closeHandler: (error?: any) => void;
91
+ /**
92
+ * Called whenever connection to relay service is lost.
93
+ */
94
+ readonly disconnectHandler: (reason: string) => void;
95
+ /**
96
+ * Called whenever new connection to rely service is established
97
+ */
98
+ readonly connectHandler: (connection: IConnectionDetails) => void;
99
+ /**
100
+ * Called whenever ping/pong messages are roundtripped on connection.
101
+ */
102
+ readonly pongHandler: (latency: number) => void;
103
+ /**
104
+ * Called whenever connection type changes from writable to read-only or vice versa.
105
+ * Connection can be read-only if user has no edit permissions, or if container forced
106
+ * connection to be read-only.
107
+ * This should not be confused with "read" / "write"connection mode which is internal
108
+ * optimization.
109
+ */
110
+ readonly readonlyChangeHandler: (readonly?: boolean) => void;
111
+ }
112
+ //# sourceMappingURL=contracts.d.ts.map
@@ -0,0 +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,EACrB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACH,cAAc,EACd,gBAAgB,EAChB,yBAAyB,EACzB,oBAAoB,EACpB,cAAc,EACd,cAAc,EACjB,MAAM,sCAAsC,CAAC;AAE9C,oBAAY,aAAa;IACrB,KAAK,UAAU;IACf,QAAQ,aAAa;IACrB,OAAO,YAAY;CACtB;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IAC/B,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAE5B,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAEtC,2CAA2C;IAC3C,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAEnD,wBAAwB;IACxB,QAAQ,CAAC,aAAa,EAAE,cAAc,CAAC;IAEvC,kEAAkE;IAClE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB,oDAAoD;IACpD,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAEhC,qDAAqD;IACrD,QAAQ,CAAC,oBAAoB,EAAE,oBAAoB,GAAG,SAAS,CAAC;IAEhE,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IAKpC,QAAQ,CAAC,eAAe,EAAE,oBAAoB,CAAC;IAK/C,QAAQ,CAAC,sBAAsB,EAAE,oBAAoB,CAAC;IAEtD;;;OAGG;IACH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BAAqB,EAAE,CAAC,QAAQ,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;CAChE"}
@@ -0,0 +1,11 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ export var ReconnectMode;
6
+ (function (ReconnectMode) {
7
+ ReconnectMode["Never"] = "Never";
8
+ ReconnectMode["Disabled"] = "Disabled";
9
+ ReconnectMode["Enabled"] = "Enabled";
10
+ })(ReconnectMode || (ReconnectMode = {}));
11
+ //# sourceMappingURL=contracts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contracts.js","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAmBH,MAAM,CAAN,IAAY,aAIX;AAJD,WAAY,aAAa;IACrB,gCAAe,CAAA;IACf,sCAAqB,CAAA;IACrB,oCAAmB,CAAA;AACvB,CAAC,EAJW,aAAa,KAAb,aAAa,QAIxB","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} from \"@fluidframework/container-definitions\";\nimport {\n ConnectionMode,\n IDocumentMessage,\n ISequencedDocumentMessage,\n IClientConfiguration,\n IClientDetails,\n ISignalMessage,\n} from \"@fluidframework/protocol-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: any): 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"]}
@@ -3,20 +3,16 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { ITelemetryLogger, IEventProvider, ITelemetryProperties, ITelemetryErrorEvent } from "@fluidframework/common-definitions";
6
- import { IConnectionDetails, IDeltaHandlerStrategy, IDeltaManager, IDeltaManagerEvents, IDeltaQueue, ICriticalContainerError, IThrottlingWarning, ReadOnlyInfo } from "@fluidframework/container-definitions";
6
+ import { IDeltaHandlerStrategy, IDeltaManager, IDeltaManagerEvents, IDeltaQueue, ICriticalContainerError, IThrottlingWarning } from "@fluidframework/container-definitions";
7
7
  import { TypedEventEmitter } from "@fluidframework/common-utils";
8
8
  import { IDocumentService } from "@fluidframework/driver-definitions";
9
- import { ConnectionMode, IClient, IClientConfiguration, IClientDetails, IDocumentMessage, ISequencedDocumentMessage, ISignalMessage, MessageType } from "@fluidframework/protocol-definitions";
9
+ import { IDocumentMessage, ISequencedDocumentMessage, ISignalMessage, MessageType, ConnectionMode } from "@fluidframework/protocol-definitions";
10
+ import { IConnectionManagerFactoryArgs, IConnectionManager } from "./contracts";
10
11
  export interface IConnectionArgs {
11
12
  mode?: ConnectionMode;
12
13
  fetchOpsFromStorage?: boolean;
13
14
  reason: string;
14
15
  }
15
- export declare enum ReconnectMode {
16
- Never = "Never",
17
- Disabled = "Disabled",
18
- Enabled = "Enabled"
19
- }
20
16
  /**
21
17
  * Includes events emitted by the concrete implementation DeltaManager
22
18
  * but not exposed on the public interface IDeltaManager
@@ -29,22 +25,14 @@ export interface IDeltaManagerInternalEvents extends IDeltaManagerEvents {
29
25
  * Manages the flow of both inbound and outbound messages. This class ensures that shared objects receive delta
30
26
  * messages in order regardless of possible network conditions or timings causing out of order delivery.
31
27
  */
32
- export declare class DeltaManager extends TypedEventEmitter<IDeltaManagerInternalEvents> implements IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>, IEventProvider<IDeltaManagerInternalEvents> {
28
+ export declare class DeltaManager<TConnectionManager extends IConnectionManager> extends TypedEventEmitter<IDeltaManagerInternalEvents> implements IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>, IEventProvider<IDeltaManagerInternalEvents> {
33
29
  private readonly serviceProvider;
34
- private client;
35
30
  private readonly logger;
36
31
  private readonly _active;
32
+ readonly connectionManager: TConnectionManager;
37
33
  get active(): boolean;
38
34
  get disposed(): boolean;
39
- readonly clientDetails: IClientDetails;
40
35
  get IDeltaSender(): this;
41
- /**
42
- * Controls whether the DeltaManager will automatically reconnect to the delta stream after receiving a disconnect.
43
- */
44
- private _reconnectMode;
45
- private _readonlyPermissions;
46
- private _forceReadonly;
47
- private readonly defaultReconnectionMode;
48
36
  private pending;
49
37
  private fetchReason;
50
38
  private minSequenceNumber;
@@ -58,34 +46,17 @@ export declare class DeltaManager extends TypedEventEmitter<IDeltaManagerInterna
58
46
  private initSequenceNumber;
59
47
  private readonly _inbound;
60
48
  private readonly _inboundSignal;
61
- private readonly _outbound;
62
- private connectionP;
63
- private connection;
64
- private clientSequenceNumber;
65
- private clientSequenceNumberObserved;
66
- private trailingNoopCount;
67
49
  private closed;
68
- private readonly deltaStreamDelayId;
69
- private readonly deltaStorageDelayId;
70
- private lastSubmittedClientId;
71
50
  private handler;
72
51
  private deltaStorage;
73
- private messageBuffer;
74
- private connectFirstConnection;
75
52
  private readonly throttlingIdSet;
76
53
  private timeTillThrottling;
77
- private connectionStateProps;
78
- private _hasCheckpointSequenceNumber;
79
54
  private readonly closeAbortController;
80
- private pendingReconnect;
81
- private downgradedConnection;
82
- /**
83
- * Tells if current connection has checkpoint information.
84
- * I.e. we know how far behind the client was at the time of establishing connection
85
- */
86
- get hasCheckpointSequenceNumber(): boolean;
55
+ private readonly deltaStorageDelayId;
56
+ private readonly deltaStreamDelayId;
57
+ private messageBuffer;
58
+ private _checkpointSequenceNumber;
87
59
  get inbound(): IDeltaQueue<ISequencedDocumentMessage>;
88
- get outbound(): IDeltaQueue<IDocumentMessage[]>;
89
60
  get inboundSignal(): IDeltaQueue<ISignalMessage>;
90
61
  get initialSequenceNumber(): number;
91
62
  get lastSequenceNumber(): number;
@@ -93,15 +64,17 @@ export declare class DeltaManager extends TypedEventEmitter<IDeltaManagerInterna
93
64
  get lastKnownSeqNumber(): number;
94
65
  get referenceTerm(): number;
95
66
  get minimumSequenceNumber(): number;
96
- get maxMessageSize(): number;
97
- get version(): string;
98
- get serviceConfiguration(): IClientConfiguration | undefined;
99
- get scopes(): string[] | undefined;
100
- get socketDocumentId(): string | undefined;
101
67
  /**
102
- * The current connection mode, initially read.
68
+ * Tells if current connection has checkpoint information.
69
+ * I.e. we know how far behind the client was at the time of establishing connection
103
70
  */
104
- get connectionMode(): ConnectionMode;
71
+ get hasCheckpointSequenceNumber(): boolean;
72
+ get maxMessageSize(): number;
73
+ get version(): string;
74
+ get serviceConfiguration(): import("@fluidframework/protocol-definitions").IClientConfiguration | undefined;
75
+ get outbound(): IDeltaQueue<IDocumentMessage[]>;
76
+ get readOnlyInfo(): import("@fluidframework/container-definitions").ReadOnlyInfo;
77
+ get clientDetails(): import("@fluidframework/protocol-definitions").IClientDetails;
105
78
  /**
106
79
  * Tells if container is in read-only mode.
107
80
  * Data stores should listen for "readonly" notifications and disallow user
@@ -113,48 +86,10 @@ export declare class DeltaManager extends TypedEventEmitter<IDeltaManagerInterna
113
86
  * @deprecated - use readOnlyInfo
114
87
  */
115
88
  get readonly(): boolean | undefined;
116
- /**
117
- * Tells if user has no write permissions for file in storage
118
- * It is undefined if we have not yet established websocket connection
119
- * and do not know if user has write access to a file.
120
- * @deprecated - use readOnlyInfo
121
- */
122
- get readonlyPermissions(): boolean | undefined;
123
- get readOnlyInfo(): ReadOnlyInfo;
124
- /**
125
- * Automatic reconnecting enabled or disabled.
126
- * If set to Never, then reconnecting will never be allowed.
127
- */
128
- get reconnectMode(): ReconnectMode;
129
- shouldJoinWrite(): boolean;
130
- /**
131
- * Returns set of props that can be logged in telemetry that provide some insights / statistics
132
- * about current or last connection (if there is no connection at the moment)
133
- */
134
- connectionProps(): ITelemetryProperties;
135
- /**
136
- * Enables or disables automatic reconnecting.
137
- * Will throw an error if reconnectMode set to Never.
138
- */
139
- setAutoReconnect(mode: ReconnectMode): void;
140
- /**
141
- * Sends signal to runtime (and data stores) to be read-only.
142
- * Hosts may have read only views, indicating to data stores that no edits are allowed.
143
- * This is independent from this._readonlyPermissions (permissions) and this.connectionMode
144
- * (server can return "write" mode even when asked for "read")
145
- * Leveraging same "readonly" event as runtime & data stores should behave the same in such case
146
- * as in read-only permissions.
147
- * But this.active can be used by some DDSes to figure out if ops can be sent
148
- * (for example, read-only view still participates in code proposals / upgrades decisions)
149
- *
150
- * Forcing Readonly does not prevent DDS from generating ops. It is up to user code to honour
151
- * the readonly flag. If ops are generated, they will accumulate locally and not be sent. If
152
- * there are pending in the outbound queue, it will stop sending until force readonly is
153
- * cleared.
154
- *
155
- * @param readonly - set or clear force readonly.
156
- */
157
- forceReadonly(readonly: boolean): void;
89
+ submit(type: MessageType, contents: any, batch?: boolean, metadata?: any): number;
90
+ submitSignal(content: any): void;
91
+ flush(): void;
92
+ get connectionProps(): ITelemetryProperties;
158
93
  /**
159
94
  * Log error event with a bunch of internal to DeltaManager information about state of op processing
160
95
  * Used to diagnose connectivity issues related to op processing (i.e. cases where for some reason
@@ -162,39 +97,21 @@ export declare class DeltaManager extends TypedEventEmitter<IDeltaManagerInterna
162
97
  * @param event - Event to log.
163
98
  */
164
99
  logConnectionIssue(event: ITelemetryErrorEvent): void;
165
- private set_readonlyPermissions;
166
- constructor(serviceProvider: () => IDocumentService | undefined, client: IClient, logger: ITelemetryLogger, reconnectAllowed: boolean, _active: () => boolean);
100
+ constructor(serviceProvider: () => IDocumentService | undefined, logger: ITelemetryLogger, _active: () => boolean, createConnectionManager: (props: IConnectionManagerFactoryArgs) => TConnectionManager);
101
+ private connectHandler;
167
102
  dispose(): void;
168
103
  /**
169
104
  * Sets the sequence number from which inbound messages should be returned
170
105
  */
171
106
  attachOpHandler(minSequenceNumber: number, sequenceNumber: number, term: number, handler: IDeltaHandlerStrategy, prefetchType?: "cached" | "all" | "none"): Promise<void>;
172
- private static detailsFromConnection;
173
- connect(args: IConnectionArgs): Promise<IConnectionDetails>;
174
- /**
175
- * Start the connection. Any error should result in container being close.
176
- * And report the error if it excape for any reason.
177
- * @param args - The connection arguments
178
- */
179
- private triggerConnect;
180
- private connectCore;
181
- flush(): void;
182
- /**
183
- * Submits the given delta returning the client sequence number for the message. Contents is the actual
184
- * contents of the message. appData is optional metadata that can be attached to the op by the app.
185
- *
186
- * If batch is set to true then the submit will be batched - and as a result guaranteed to be ordered sequentially
187
- * in the global sequencing space. The batch will be flushed either when flush is called or when a non-batched
188
- * op is submitted.
189
- */
190
- submit(type: MessageType, contents: any, batch?: boolean, metadata?: any): number;
191
- submitSignal(content: any): void;
107
+ connect(args: IConnectionArgs): void;
192
108
  private getDeltas;
193
109
  /**
194
110
  * Closes the connection and clears inbound & outbound queues.
195
111
  */
196
112
  close(error?: ICriticalContainerError): void;
197
113
  refreshDelayInfo(id: string): void;
114
+ private disconnectHandler;
198
115
  /**
199
116
  * Emit info about a delay in service communication on account of throttling.
200
117
  * @param id - Id of the connection that is delayed
@@ -202,39 +119,6 @@ export declare class DeltaManager extends TypedEventEmitter<IDeltaManagerInterna
202
119
  * @param error - error object indicating the throttling
203
120
  */
204
121
  emitDelayInfo(id: string, delayMs: number, error: unknown): void;
205
- private readonly opHandler;
206
- private readonly signalHandler;
207
- private readonly nackHandler;
208
- private readonly disconnectHandler;
209
- private readonly errorHandler;
210
- private readonly pongHandler;
211
- /**
212
- * Once we've successfully gotten a connection, we need to set up state, attach event listeners, and process
213
- * initial messages.
214
- * @param connection - The newly established connection
215
- */
216
- private setupNewSuccessfulConnection;
217
- /**
218
- * Disconnect the current connection.
219
- * @param reason - Text description of disconnect reason to emit with disconnect event
220
- */
221
- private disconnectFromDeltaStream;
222
- /**
223
- * Disconnect the current connection and reconnect.
224
- * @param connection - The connection that wants to reconnect - no-op if it's different from this.connection
225
- * @param requestedMode - Read or write
226
- * @param error - Error reconnect information including whether or not to reconnect
227
- * @returns A promise that resolves when the connection is reestablished or we stop trying
228
- */
229
- private reconnectOnError;
230
- /**
231
- * Disconnect the current connection and reconnect.
232
- * @param connection - The connection that wants to reconnect - no-op if it's different from this.connection
233
- * @param requestedMode - Read or write
234
- * @param error - Error reconnect information including whether or not to reconnect
235
- * @returns A promise that resolves when the connection is reestablished or we stop trying
236
- */
237
- private reconnectOnErrorCore;
238
122
  private comparableMessagePayload;
239
123
  private enqueueMessages;
240
124
  private processInboundMessage;
@@ -1 +1 @@
1
- {"version":3,"file":"deltaManager.d.ts","sourceRoot":"","sources":["../src/deltaManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAEH,gBAAgB,EAChB,cAAc,EACd,oBAAoB,EACpB,oBAAoB,EACvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACH,kBAAkB,EAClB,qBAAqB,EACrB,aAAa,EACb,mBAAmB,EACnB,WAAW,EACX,uBAAuB,EACvB,kBAAkB,EAClB,YAAY,EACf,MAAM,uCAAuC,CA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