@fluidframework/container-loader 2.33.2 → 2.40.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 (62) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/api-report/container-loader.legacy.alpha.api.md +0 -10
  3. package/dist/attachment.d.ts +2 -2
  4. package/dist/attachment.d.ts.map +1 -1
  5. package/dist/attachment.js.map +1 -1
  6. package/dist/container.d.ts +1 -14
  7. package/dist/container.d.ts.map +1 -1
  8. package/dist/container.js +4 -16
  9. package/dist/container.js.map +1 -1
  10. package/dist/containerStorageAdapter.d.ts +2 -2
  11. package/dist/containerStorageAdapter.d.ts.map +1 -1
  12. package/dist/containerStorageAdapter.js +2 -7
  13. package/dist/containerStorageAdapter.js.map +1 -1
  14. package/dist/index.d.ts +1 -1
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js.map +1 -1
  17. package/dist/legacy.d.ts +0 -1
  18. package/dist/loader.d.ts +1 -29
  19. package/dist/loader.d.ts.map +1 -1
  20. package/dist/loader.js +1 -2
  21. package/dist/loader.js.map +1 -1
  22. package/dist/memoryBlobStorage.d.ts +30 -4
  23. package/dist/memoryBlobStorage.d.ts.map +1 -1
  24. package/dist/memoryBlobStorage.js +11 -28
  25. package/dist/memoryBlobStorage.js.map +1 -1
  26. package/dist/packageVersion.d.ts +1 -1
  27. package/dist/packageVersion.js +1 -1
  28. package/dist/packageVersion.js.map +1 -1
  29. package/lib/attachment.d.ts +2 -2
  30. package/lib/attachment.d.ts.map +1 -1
  31. package/lib/attachment.js.map +1 -1
  32. package/lib/container.d.ts +1 -14
  33. package/lib/container.d.ts.map +1 -1
  34. package/lib/container.js +5 -17
  35. package/lib/container.js.map +1 -1
  36. package/lib/containerStorageAdapter.d.ts +2 -2
  37. package/lib/containerStorageAdapter.d.ts.map +1 -1
  38. package/lib/containerStorageAdapter.js +2 -7
  39. package/lib/containerStorageAdapter.js.map +1 -1
  40. package/lib/index.d.ts +1 -1
  41. package/lib/index.d.ts.map +1 -1
  42. package/lib/index.js.map +1 -1
  43. package/lib/legacy.d.ts +0 -1
  44. package/lib/loader.d.ts +1 -29
  45. package/lib/loader.d.ts.map +1 -1
  46. package/lib/loader.js +1 -2
  47. package/lib/loader.js.map +1 -1
  48. package/lib/memoryBlobStorage.d.ts +30 -4
  49. package/lib/memoryBlobStorage.d.ts.map +1 -1
  50. package/lib/memoryBlobStorage.js +11 -27
  51. package/lib/memoryBlobStorage.js.map +1 -1
  52. package/lib/packageVersion.d.ts +1 -1
  53. package/lib/packageVersion.js +1 -1
  54. package/lib/packageVersion.js.map +1 -1
  55. package/package.json +17 -12
  56. package/src/attachment.ts +2 -4
  57. package/src/container.ts +8 -29
  58. package/src/containerStorageAdapter.ts +4 -8
  59. package/src/index.ts +0 -1
  60. package/src/loader.ts +0 -35
  61. package/src/memoryBlobStorage.ts +36 -45
  62. package/src/packageVersion.ts +1 -1
@@ -7,7 +7,7 @@ import { IDisposable } from "@fluidframework/core-interfaces";
7
7
  import { ISummaryHandle, ISummaryTree } from "@fluidframework/driver-definitions";
8
8
  import { FetchSource, IDocumentService, IDocumentStorageService, IDocumentStorageServicePolicies, ISnapshot, ISnapshotFetchOptions, ISummaryContext, ICreateBlobResponse, ISnapshotTree, IVersion } from "@fluidframework/driver-definitions/internal";
9
9
  import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
10
- import { IDetachedBlobStorage } from "./loader.js";
10
+ import type { MemoryDetachedBlobStorage } from "./memoryBlobStorage.js";
11
11
  import type { ISerializedStateManagerDocumentStorageService, ISnapshotInfo } from "./serializedStateManager.js";
12
12
  /**
13
13
  * Stringified blobs from a summary/snapshot tree.
@@ -50,7 +50,7 @@ export declare class ContainerStorageAdapter implements ISerializedStateManagerD
50
50
  * upload, and fix it up with a protocol tree if needed
51
51
  * @param enableSummarizeProtocolTree - Enable uploading a protocol summary. Note: preference is given to service policy's "summarizeProtocolTree" before this value.
52
52
  */
53
- constructor(detachedBlobStorage: IDetachedBlobStorage | undefined, logger: ITelemetryLoggerExt,
53
+ constructor(detachedBlobStorage: MemoryDetachedBlobStorage | undefined, logger: ITelemetryLoggerExt,
54
54
  /**
55
55
  * ArrayBufferLikes or utf8 encoded strings, containing blobs from a snapshot
56
56
  */
@@ -1 +1 @@
1
- {"version":3,"file":"containerStorageAdapter.d.ts","sourceRoot":"","sources":["../src/containerStorageAdapter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,6BAA6B,EAAE,MAAM,gDAAgD,CAAC;AAC/F,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAE9D,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClF,OAAO,EACN,WAAW,EACX,gBAAgB,EAChB,uBAAuB,EACvB,+BAA+B,EAC/B,SAAS,EACT,qBAAqB,EACrB,eAAe,EACf,mBAAmB,EACnB,aAAa,EACb,QAAQ,EACR,MAAM,6CAA6C,CAAC;AAErD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAG/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAGnD,OAAO,KAAK,EACX,6CAA6C,EAC7C,aAAa,EACb,MAAM,6BAA6B,CAAC;AAGrC;;;GAGG;AACH,MAAM,WAAW,yBAAyB;IACzC,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;CACrB;AAED;;;GAGG;AACH,qBAAa,uBACZ,YACC,6CAA6C,EAC7C,uBAAuB,EACvB,WAAW;IAiCX,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,uCAAuC;IAC/C,OAAO,CAAC,QAAQ,CAAC,2BAA2B;IAC5C,OAAO,CAAC,QAAQ,CAAC,2BAA2B;IAtC7C,OAAO,CAAC,eAAe,CAAiD;IAExE,OAAO,CAAC,sBAAsB,CAA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W,CAAC,oBAAoB,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,SAAS,CAAC;IA2C7E,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAY9C,WAAW,CAGvB,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,KAAK,EAAE,MAAM,EACb,YAAY,CAAC,EAAE,MAAM,EACrB,WAAW,CAAC,EAAE,WAAW,GACvB,OAAO,CAAC,QAAQ,EAAE,CAAC;IAIT,wBAAwB,CACpC,OAAO,EAAE,YAAY,EACrB,OAAO,EAAE,eAAe,GACtB,OAAO,CAAC,MAAM,CAAC;IAIL,eAAe,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC;IAI9D,UAAU,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,mBAAmB,CAAC;CAG5E;AA6DD;;GAEG;AACH,wBAAsB,uBAAuB,CAC5C,QAAQ,EAAE,SAAS,GAAG,aAAa,EACnC,OAAO,EAAE,IAAI,CAAC,uBAAuB,EAAE,UAAU,CAAC,GAChD,OAAO,CAAC,yBAAyB,CAAC,CAYpC;AAqCD;;GAEG;AACH,wBAAgB,uCAAuC,CACtD,QAAQ,EAAE,6BAA6B,GACrC,yBAAyB,CAI3B"}
@@ -35,9 +35,7 @@ export class ContainerStorageAdapter {
35
35
  * upload, and fix it up with a protocol tree if needed
36
36
  * @param enableSummarizeProtocolTree - Enable uploading a protocol summary. Note: preference is given to service policy's "summarizeProtocolTree" before this value.
37
37
  */
38
- constructor(
39
- // eslint-disable-next-line import/no-deprecated
40
- detachedBlobStorage, logger,
38
+ constructor(detachedBlobStorage, logger,
41
39
  /**
42
40
  * ArrayBufferLikes or utf8 encoded strings, containing blobs from a snapshot
43
41
  */
@@ -168,9 +166,7 @@ export class ContainerStorageAdapter {
168
166
  * blobs in detached containers.
169
167
  */
170
168
  class BlobOnlyStorage {
171
- constructor(
172
- // eslint-disable-next-line import/no-deprecated
173
- detachedStorage, logger) {
169
+ constructor(detachedStorage, logger) {
174
170
  this.detachedStorage = detachedStorage;
175
171
  this.logger = logger;
176
172
  /* eslint-disable @typescript-eslint/unbound-method */
@@ -188,7 +184,6 @@ class BlobOnlyStorage {
188
184
  async readBlob(blobId) {
189
185
  return this.verifyStorage().readBlob(blobId);
190
186
  }
191
- // eslint-disable-next-line import/no-deprecated
192
187
  verifyStorage() {
193
188
  if (this.detachedStorage === undefined) {
194
189
  throw new UsageError("Real storage calls not allowed in Unattached container");
@@ -1 +1 @@
1
- {"version":3,"file":"containerStorageAdapter.js","sourceRoot":"","sources":["../src/containerStorageAdapter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAG9E,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAc7D,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AAK1F,OAAO,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AACrF,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AAKvF,OAAO,EAAE,6BAA6B,EAAE,MAAM,YAAY,CAAC;AAU3D;;;GAGG;AACH,MAAM,OAAO,uBAAuB;IASnC;;OAEG;IACH,IAAW,qBAAqB;QAC/B,OAAO,IAAI,CAAC,sBAAsB,KAAK,IAAI,CAAC;IAC7C,CAAC;IAGD;;OAEG;IACH,IAAW,sBAAsB;QAChC,OAAO,IAAI,CAAC,uBAAuB,CAAC;IACrC,CAAC;IAED;;;;;;;;;OASG;IACH;IACC,gDAAgD;IAChD,mBAAqD,EACpC,MAA2B;IAC5C;;OAEG;IACc,eAA2D,EAAE,EACtE,uCAAkF,EACzE,2BAAwE,EACxE,2BAAgD;QAPhD,WAAM,GAAN,MAAM,CAAqB;QAI3B,iBAAY,GAAZ,YAAY,CAAiD;QACtE,4CAAuC,GAAvC,uCAAuC,CAA2C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D;AACxD,SAAS,0CAA0C,CAClD,IAAmC,EACnC,KAAgC;IAEhC,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;IAC7C,MAAM,CACL,EAAE,KAAK,SAAS,EAChB,KAAK,CAAC,mEAAmE,CACzE,CAAC;IACF,MAAM,IAAI,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC,EAAE,CAAC,CAAC;IACtC,MAAM,CAAC,IAAI,KAAK,SAAS,EAAE,KAAK,CAAC,2CAA2C,CAAC,CAAC;IAC9E,oDAAoD;IACpD,KAAK,CAAC,EAAE,CAAC,GAAG,cAAc,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAC1C,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { bufferToString, stringToBuffer } from \"@fluid-internal/client-utils\";\nimport { ISnapshotTreeWithBlobContents } from \"@fluidframework/container-definitions/internal\";\nimport { IDisposable } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { ISummaryHandle, ISummaryTree } from \"@fluidframework/driver-definitions\";\nimport {\n\tFetchSource,\n\tIDocumentService,\n\tIDocumentStorageService,\n\tIDocumentStorageServicePolicies,\n\tISnapshot,\n\tISnapshotFetchOptions,\n\tISummaryContext,\n\tICreateBlobResponse,\n\tISnapshotTree,\n\tIVersion,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { isInstanceOfISnapshot, UsageError } from \"@fluidframework/driver-utils/internal\";\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils/internal\";\n\n// eslint-disable-next-line import/no-deprecated\nimport { IDetachedBlobStorage } from \"./loader.js\";\nimport { ProtocolTreeStorageService } from \"./protocolTreeDocumentStorageService.js\";\nimport { RetriableDocumentStorageService } from \"./retriableDocumentStorageService.js\";\nimport type {\n\tISerializedStateManagerDocumentStorageService,\n\tISnapshotInfo,\n} from \"./serializedStateManager.js\";\nimport { convertSnapshotInfoToSnapshot } from \"./utils.js\";\n\n/**\n * Stringified blobs from a summary/snapshot tree.\n * @internal\n */\nexport interface ISerializableBlobContents {\n\t[id: string]: string;\n}\n\n/**\n * This class wraps the actual storage and make sure no wrong apis are called according to\n * container attach state.\n */\nexport class ContainerStorageAdapter\n\timplements\n\t\tISerializedStateManagerDocumentStorageService,\n\t\tIDocumentStorageService,\n\t\tIDisposable\n{\n\tprivate _storageService: IDocumentStorageService & Partial<IDisposable>;\n\n\tprivate _summarizeProtocolTree: boolean | undefined;\n\t/**\n\t * Whether the adapter will enforce sending combined summary trees.\n\t */\n\tpublic get summarizeProtocolTree(): boolean {\n\t\treturn this._summarizeProtocolTree === true;\n\t}\n\n\tprivate _loadedGroupIdSnapshots: Record<string, ISnapshot> = {};\n\t/**\n\t * Any loading group id (virtualized) snapshot download from storage will be stored here.\n\t */\n\tpublic get loadedGroupIdSnapshots(): Record<string, ISnapshot> {\n\t\treturn this._loadedGroupIdSnapshots;\n\t}\n\n\t/**\n\t * An adapter that ensures we're using detachedBlobStorage up until we connect to a real service, and then\n\t * after connecting to a real service augments it with retry and combined summary tree enforcement.\n\t * @param detachedBlobStorage - The detached blob storage to use up until we connect to a real service\n\t * @param logger - Telemetry logger\n\t * @param loadingGroupIdSnapshotsFromPendingState - in offline mode, any loading group snapshots we've downloaded from the service that were stored in the pending state\n\t * @param addProtocolSummaryIfMissing - a callback to permit the container to inspect the summary we're about to\n\t * upload, and fix it up with a protocol tree if needed\n\t * @param enableSummarizeProtocolTree - Enable uploading a protocol summary. Note: preference is given to service policy's \"summarizeProtocolTree\" before this value.\n\t */\n\tpublic constructor(\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\tdetachedBlobStorage: IDetachedBlobStorage | undefined,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t\t/**\n\t\t * ArrayBufferLikes or utf8 encoded strings, containing blobs from a snapshot\n\t\t */\n\t\tprivate readonly blobContents: { [id: string]: ArrayBufferLike | string } = {},\n\t\tprivate loadingGroupIdSnapshotsFromPendingState: Record<string, ISnapshotInfo> | undefined,\n\t\tprivate readonly addProtocolSummaryIfMissing: (summaryTree: ISummaryTree) => ISummaryTree,\n\t\tprivate readonly enableSummarizeProtocolTree: boolean | undefined,\n\t) {\n\t\tthis._storageService = new BlobOnlyStorage(detachedBlobStorage, logger);\n\t}\n\n\tdisposed: boolean = false;\n\tdispose(error?: Error): void {\n\t\tthis._storageService?.dispose?.(error);\n\t\tthis.disposed = true;\n\t}\n\n\tpublic connectToService(service: IDocumentService): void {\n\t\tif (!(this._storageService instanceof BlobOnlyStorage)) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst storageServiceP = service.connectToStorage();\n\t\tconst retriableStorage = (this._storageService = new RetriableDocumentStorageService(\n\t\t\tstorageServiceP,\n\t\t\tthis.logger,\n\t\t));\n\n\t\t// A storage service wrapper which intercept calls to uploadSummaryWithContext and ensure they include\n\t\t// the protocol summary, provided single-commit summary is enabled.\n\t\tthis._storageService = new ProtocolTreeStorageService(\n\t\t\tretriableStorage,\n\t\t\t(...props) => {\n\t\t\t\tthis.logger.sendTelemetryEvent({ eventName: \"summarizeProtocolTreeEnabled\" });\n\t\t\t\treturn this.addProtocolSummaryIfMissing(...props);\n\t\t\t},\n\t\t\t// A callback to ensure we fetch the most updated value of service.policies.summarizeProtocolTree, which could be set\n\t\t\t// based on the response received from the service after connection is established.\n\t\t\t() => {\n\t\t\t\t// Determine whether or not container should upload the protocol summary along with the summary.\n\t\t\t\t// This is determined based on what value is set for serve policy's summariProtocolTree value or the enableSummarizeProtocolTree\n\t\t\t\t// retrievd from the loader options or monitoring context config.\n\t\t\t\tconst shouldSummarizeProtocolTree =\n\t\t\t\t\tservice.policies?.summarizeProtocolTree ?? this.enableSummarizeProtocolTree ?? false;\n\n\t\t\t\tif (this._summarizeProtocolTree !== shouldSummarizeProtocolTree) {\n\t\t\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\t\t\teventName: \"isSummarizeProtocolTreeEnabled\",\n\t\t\t\t\t\tdetails: { value: shouldSummarizeProtocolTree },\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tthis._summarizeProtocolTree = shouldSummarizeProtocolTree;\n\t\t\t\treturn this._summarizeProtocolTree;\n\t\t\t},\n\t\t);\n\t}\n\n\tpublic loadSnapshotFromSnapshotBlobs(snapshotBlobs: ISerializableBlobContents): void {\n\t\tfor (const [id, value] of Object.entries(snapshotBlobs)) {\n\t\t\tthis.blobContents[id] = value;\n\t\t}\n\t}\n\n\tpublic clearPendingState(): void {\n\t\tthis.loadingGroupIdSnapshotsFromPendingState = undefined;\n\t}\n\n\tpublic get policies(): IDocumentStorageServicePolicies | undefined {\n\t\t// back-compat 0.40 containerRuntime requests policies even in detached container if storage is present\n\t\t// and storage is always present in >=0.41.\n\t\ttry {\n\t\t\treturn this._storageService.policies;\n\t\t} catch {\n\t\t\t// No-op\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tpublic async getSnapshotTree(\n\t\tversion?: IVersion,\n\t\tscenarioName?: string,\n\t\t// API called below uses null\n\t\t// eslint-disable-next-line @rushstack/no-new-null\n\t): Promise<ISnapshotTree | null> {\n\t\treturn this._storageService.getSnapshotTree(version, scenarioName);\n\t}\n\n\tpublic async getSnapshot(snapshotFetchOptions?: ISnapshotFetchOptions): Promise<ISnapshot> {\n\t\tlet snapshot: ISnapshot;\n\t\tif (\n\t\t\tthis.loadingGroupIdSnapshotsFromPendingState !== undefined &&\n\t\t\tsnapshotFetchOptions?.loadingGroupIds !== undefined\n\t\t) {\n\t\t\tconst localSnapshot =\n\t\t\t\tthis.loadingGroupIdSnapshotsFromPendingState[snapshotFetchOptions.loadingGroupIds[0]];\n\t\t\tassert(localSnapshot !== undefined, 0x970 /* Local snapshot must be present */);\n\t\t\tsnapshot = convertSnapshotInfoToSnapshot(\n\t\t\t\tlocalSnapshot,\n\t\t\t\tlocalSnapshot.snapshotSequenceNumber,\n\t\t\t);\n\t\t} else {\n\t\t\tif (this._storageService.getSnapshot === undefined) {\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\"getSnapshot api should exist in internal storage in ContainerStorageAdapter\",\n\t\t\t\t);\n\t\t\t}\n\t\t\tsnapshot = await this._storageService.getSnapshot(snapshotFetchOptions);\n\t\t}\n\n\t\t// Track the latest snapshot for each loading group id\n\t\tconst loadingGroupIds = snapshotFetchOptions?.loadingGroupIds;\n\t\tassert(\n\t\t\tsnapshot.sequenceNumber !== undefined,\n\t\t\t0x971 /* Snapshot must have sequence number */,\n\t\t);\n\t\tif (loadingGroupIds !== undefined) {\n\t\t\tfor (const loadingGroupId of loadingGroupIds) {\n\t\t\t\t// Do we actually want to update the stored snapshot?\n\t\t\t\t// What if the incoming snapshot is way newer than the stored snapshot?\n\t\t\t\t// We only want to update the stored snapshot if the incoming snapshot is newer (stored sequence number < incoming sequence number)\n\t\t\t\tconst storedSeqNum =\n\t\t\t\t\tthis._loadedGroupIdSnapshots[loadingGroupId]?.sequenceNumber ?? -1;\n\t\t\t\tif (storedSeqNum < snapshot.sequenceNumber) {\n\t\t\t\t\tthis._loadedGroupIdSnapshots[loadingGroupId] = snapshot;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn snapshot;\n\t}\n\n\tpublic async readBlob(id: string): Promise<ArrayBufferLike> {\n\t\tconst maybeBlob = this.blobContents[id];\n\t\tif (maybeBlob !== undefined) {\n\t\t\tif (typeof maybeBlob === \"string\") {\n\t\t\t\tconst blob = stringToBuffer(maybeBlob, \"utf8\");\n\t\t\t\treturn blob;\n\t\t\t}\n\t\t\treturn maybeBlob;\n\t\t}\n\t\treturn this._storageService.readBlob(id);\n\t}\n\n\tpublic async getVersions(\n\t\t// API used below uses null\n\t\t// eslint-disable-next-line @rushstack/no-new-null\n\t\tversionId: string | null,\n\t\tcount: number,\n\t\tscenarioName?: string,\n\t\tfetchSource?: FetchSource,\n\t): Promise<IVersion[]> {\n\t\treturn this._storageService.getVersions(versionId, count, scenarioName, fetchSource);\n\t}\n\n\tpublic async uploadSummaryWithContext(\n\t\tsummary: ISummaryTree,\n\t\tcontext: ISummaryContext,\n\t): Promise<string> {\n\t\treturn this._storageService.uploadSummaryWithContext(summary, context);\n\t}\n\n\tpublic async downloadSummary(handle: ISummaryHandle): Promise<ISummaryTree> {\n\t\treturn this._storageService.downloadSummary(handle);\n\t}\n\n\tpublic async createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse> {\n\t\treturn this._storageService.createBlob(file);\n\t}\n}\n\n/**\n * Storage which only supports createBlob() and readBlob(). This is used with IDetachedBlobStorage to support\n * blobs in detached containers.\n */\nclass BlobOnlyStorage implements IDocumentStorageService {\n\tconstructor(\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\tprivate readonly detachedStorage: IDetachedBlobStorage | undefined,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t) {}\n\n\tpublic async createBlob(content: ArrayBufferLike): Promise<ICreateBlobResponse> {\n\t\treturn this.verifyStorage().createBlob(content);\n\t}\n\n\tpublic async readBlob(blobId: string): Promise<ArrayBufferLike> {\n\t\treturn this.verifyStorage().readBlob(blobId);\n\t}\n\n\t// eslint-disable-next-line import/no-deprecated\n\tprivate verifyStorage(): IDetachedBlobStorage {\n\t\tif (this.detachedStorage === undefined) {\n\t\t\tthrow new UsageError(\"Real storage calls not allowed in Unattached container\");\n\t\t}\n\t\treturn this.detachedStorage;\n\t}\n\n\tpublic get policies(): IDocumentStorageServicePolicies | undefined {\n\t\treturn this.notCalled();\n\t}\n\n\t/* eslint-disable @typescript-eslint/unbound-method */\n\t// eslint-disable-next-line @rushstack/no-new-null\n\tpublic getSnapshotTree: () => Promise<ISnapshotTree | null> = this.notCalled;\n\tpublic getSnapshot: () => Promise<ISnapshot> = this.notCalled;\n\tpublic getVersions: () => Promise<IVersion[]> = this.notCalled;\n\tpublic write: () => Promise<IVersion> = this.notCalled;\n\tpublic uploadSummaryWithContext: () => Promise<string> = this.notCalled;\n\tpublic downloadSummary: () => Promise<ISummaryTree> = this.notCalled;\n\t/* eslint-enable @typescript-eslint/unbound-method */\n\n\tprivate notCalled(): never {\n\t\tthis.verifyStorage();\n\t\ttry {\n\t\t\t// some browsers may not populate stack unless exception is thrown\n\t\t\tthrow new Error(\"BlobOnlyStorage not implemented method used\");\n\t\t} catch (error) {\n\t\t\tthis.logger.sendTelemetryEvent({ eventName: \"BlobOnlyStorageWrongCall\" }, error);\n\t\t\tthrow error;\n\t\t}\n\t}\n}\n\n// runtime will write a tree to the summary containing \"attachment\" type entries\n// which reference attachment blobs by ID, along with a blob containing the blob redirect table.\n// However, some drivers do not support the \"attachment\" type and will convert them to \"blob\" type\n// entries. We want to avoid saving these to reduce the size of stashed change blobs, but we\n// need to make sure the blob redirect table is saved.\nconst blobsTreeName = \".blobs\";\nconst redirectTableBlobName = \".redirectTable\";\n\n/**\n * Get blob contents of a snapshot tree from storage (or, ideally, cache)\n */\nexport async function getBlobContentsFromTree(\n\tsnapshot: ISnapshot | ISnapshotTree,\n\tstorage: Pick<IDocumentStorageService, \"readBlob\">,\n): Promise<ISerializableBlobContents> {\n\tconst blobs = {};\n\tif (isInstanceOfISnapshot(snapshot)) {\n\t\tconst blobContents = snapshot.blobContents;\n\t\tfor (const [id, content] of blobContents.entries()) {\n\t\t\t// ArrayBufferLike will not survive JSON.stringify()\n\t\t\tblobs[id] = bufferToString(content, \"utf8\");\n\t\t}\n\t} else {\n\t\tawait getBlobContentsFromTreeCore(snapshot, blobs, storage);\n\t}\n\treturn blobs;\n}\n\nasync function getBlobContentsFromTreeCore(\n\ttree: ISnapshotTree,\n\tblobs: ISerializableBlobContents,\n\tstorage: Pick<IDocumentStorageService, \"readBlob\">,\n\troot = true,\n): Promise<unknown[]> {\n\tconst treePs: Promise<unknown>[] = [];\n\tfor (const [key, subTree] of Object.entries(tree.trees)) {\n\t\tif (root && key === blobsTreeName) {\n\t\t\ttreePs.push(getBlobManagerTreeFromTree(subTree, blobs, storage));\n\t\t} else {\n\t\t\ttreePs.push(getBlobContentsFromTreeCore(subTree, blobs, storage, false));\n\t\t}\n\t}\n\tfor (const id of Object.values(tree.blobs)) {\n\t\tconst blob = await storage.readBlob(id);\n\t\t// ArrayBufferLike will not survive JSON.stringify()\n\t\tblobs[id] = bufferToString(blob, \"utf8\");\n\t}\n\treturn Promise.all(treePs);\n}\n\n// save redirect table from .blobs tree but nothing else\nasync function getBlobManagerTreeFromTree(\n\ttree: ISnapshotTree,\n\tblobs: ISerializableBlobContents,\n\tstorage: Pick<IDocumentStorageService, \"readBlob\">,\n): Promise<void> {\n\tconst id = tree.blobs[redirectTableBlobName];\n\tassert(id !== undefined, 0x9ce /* id is undefined in getBlobManagerTreeFromTree */);\n\tconst blob = await storage.readBlob(id);\n\t// ArrayBufferLike will not survive JSON.stringify()\n\tblobs[id] = bufferToString(blob, \"utf8\");\n}\n\n/**\n * Extract blob contents from a snapshot tree with blob contents\n */\nexport function getBlobContentsFromTreeWithBlobContents(\n\tsnapshot: ISnapshotTreeWithBlobContents,\n): ISerializableBlobContents {\n\tconst blobs = {};\n\tgetBlobContentsFromTreeWithBlobContentsCore(snapshot, blobs);\n\treturn blobs;\n}\n\nfunction getBlobContentsFromTreeWithBlobContentsCore(\n\ttree: ISnapshotTreeWithBlobContents,\n\tblobs: ISerializableBlobContents,\n\troot = true,\n): void {\n\tfor (const [key, subTree] of Object.entries(tree.trees)) {\n\t\tif (root && key === blobsTreeName) {\n\t\t\tgetBlobManagerTreeFromTreeWithBlobContents(subTree, blobs);\n\t\t} else {\n\t\t\tgetBlobContentsFromTreeWithBlobContentsCore(subTree, blobs, false);\n\t\t}\n\t}\n\tfor (const id of Object.values(tree.blobs)) {\n\t\tconst blob = tree.blobsContents?.[id];\n\t\tassert(blob !== undefined, 0x2ec /* \"Blob must be present in blobsContents\" */);\n\t\t// ArrayBufferLike will not survive JSON.stringify()\n\t\tblobs[id] = bufferToString(blob, \"utf8\");\n\t}\n}\n\n// save redirect table from .blobs tree but nothing else\nfunction getBlobManagerTreeFromTreeWithBlobContents(\n\ttree: ISnapshotTreeWithBlobContents,\n\tblobs: ISerializableBlobContents,\n): void {\n\tconst id = tree.blobs[redirectTableBlobName];\n\tassert(\n\t\tid !== undefined,\n\t\t0x9cf /* id is undefined in getBlobManagerTreeFromTreeWithBlobContents */,\n\t);\n\tconst blob = tree.blobsContents?.[id];\n\tassert(blob !== undefined, 0x70f /* Blob must be present in blobsContents */);\n\t// ArrayBufferLike will not survive JSON.stringify()\n\tblobs[id] = bufferToString(blob, \"utf8\");\n}\n"]}
1
+ {"version":3,"file":"containerStorageAdapter.js","sourceRoot":"","sources":["../src/containerStorageAdapter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAG9E,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAc7D,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AAI1F,OAAO,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AACrF,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AAKvF,OAAO,EAAE,6BAA6B,EAAE,MAAM,YAAY,CAAC;AAU3D;;;GAGG;AACH,MAAM,OAAO,uBAAuB;IASnC;;OAEG;IACH,IAAW,qBAAqB;QAC/B,OAAO,IAAI,CAAC,sBAAsB,KAAK,IAAI,CAAC;IAC7C,CAAC;IAGD;;OAEG;IACH,IAAW,sBAAsB;QAChC,OAAO,IAAI,CAAC,uBAAuB,CAAC;IACrC,CAAC;IAED;;;;;;;;;OASG;IACH,YACC,mBAA0D,EACzC,MAA2B;IAC5C;;OAEG;IACc,eAA2D,EAAE,EACtE,uCAAkF,EACzE,2BAAwE,EACxE,2BAAgD;QAPhD,WAAM,GAAN,MAAM,CAAqB;QAI3B,iBAAY,GAAZ,YAAY,CAAiD;QACtE,4CAAuC,GAAvC,uCAAuC,CAA2C;QACzE,gC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ACnC,KAAgC;IAEhC,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;IAC7C,MAAM,CACL,EAAE,KAAK,SAAS,EAChB,KAAK,CAAC,mEAAmE,CACzE,CAAC;IACF,MAAM,IAAI,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC,EAAE,CAAC,CAAC;IACtC,MAAM,CAAC,IAAI,KAAK,SAAS,EAAE,KAAK,CAAC,2CAA2C,CAAC,CAAC;IAC9E,oDAAoD;IACpD,KAAK,CAAC,EAAE,CAAC,GAAG,cAAc,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAC1C,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { bufferToString, stringToBuffer } from \"@fluid-internal/client-utils\";\nimport { ISnapshotTreeWithBlobContents } from \"@fluidframework/container-definitions/internal\";\nimport { IDisposable } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { ISummaryHandle, ISummaryTree } from \"@fluidframework/driver-definitions\";\nimport {\n\tFetchSource,\n\tIDocumentService,\n\tIDocumentStorageService,\n\tIDocumentStorageServicePolicies,\n\tISnapshot,\n\tISnapshotFetchOptions,\n\tISummaryContext,\n\tICreateBlobResponse,\n\tISnapshotTree,\n\tIVersion,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { isInstanceOfISnapshot, UsageError } from \"@fluidframework/driver-utils/internal\";\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils/internal\";\n\nimport type { MemoryDetachedBlobStorage } from \"./memoryBlobStorage.js\";\nimport { ProtocolTreeStorageService } from \"./protocolTreeDocumentStorageService.js\";\nimport { RetriableDocumentStorageService } from \"./retriableDocumentStorageService.js\";\nimport type {\n\tISerializedStateManagerDocumentStorageService,\n\tISnapshotInfo,\n} from \"./serializedStateManager.js\";\nimport { convertSnapshotInfoToSnapshot } from \"./utils.js\";\n\n/**\n * Stringified blobs from a summary/snapshot tree.\n * @internal\n */\nexport interface ISerializableBlobContents {\n\t[id: string]: string;\n}\n\n/**\n * This class wraps the actual storage and make sure no wrong apis are called according to\n * container attach state.\n */\nexport class ContainerStorageAdapter\n\timplements\n\t\tISerializedStateManagerDocumentStorageService,\n\t\tIDocumentStorageService,\n\t\tIDisposable\n{\n\tprivate _storageService: IDocumentStorageService & Partial<IDisposable>;\n\n\tprivate _summarizeProtocolTree: boolean | undefined;\n\t/**\n\t * Whether the adapter will enforce sending combined summary trees.\n\t */\n\tpublic get summarizeProtocolTree(): boolean {\n\t\treturn this._summarizeProtocolTree === true;\n\t}\n\n\tprivate _loadedGroupIdSnapshots: Record<string, ISnapshot> = {};\n\t/**\n\t * Any loading group id (virtualized) snapshot download from storage will be stored here.\n\t */\n\tpublic get loadedGroupIdSnapshots(): Record<string, ISnapshot> {\n\t\treturn this._loadedGroupIdSnapshots;\n\t}\n\n\t/**\n\t * An adapter that ensures we're using detachedBlobStorage up until we connect to a real service, and then\n\t * after connecting to a real service augments it with retry and combined summary tree enforcement.\n\t * @param detachedBlobStorage - The detached blob storage to use up until we connect to a real service\n\t * @param logger - Telemetry logger\n\t * @param loadingGroupIdSnapshotsFromPendingState - in offline mode, any loading group snapshots we've downloaded from the service that were stored in the pending state\n\t * @param addProtocolSummaryIfMissing - a callback to permit the container to inspect the summary we're about to\n\t * upload, and fix it up with a protocol tree if needed\n\t * @param enableSummarizeProtocolTree - Enable uploading a protocol summary. Note: preference is given to service policy's \"summarizeProtocolTree\" before this value.\n\t */\n\tpublic constructor(\n\t\tdetachedBlobStorage: MemoryDetachedBlobStorage | undefined,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t\t/**\n\t\t * ArrayBufferLikes or utf8 encoded strings, containing blobs from a snapshot\n\t\t */\n\t\tprivate readonly blobContents: { [id: string]: ArrayBufferLike | string } = {},\n\t\tprivate loadingGroupIdSnapshotsFromPendingState: Record<string, ISnapshotInfo> | undefined,\n\t\tprivate readonly addProtocolSummaryIfMissing: (summaryTree: ISummaryTree) => ISummaryTree,\n\t\tprivate readonly enableSummarizeProtocolTree: boolean | undefined,\n\t) {\n\t\tthis._storageService = new BlobOnlyStorage(detachedBlobStorage, logger);\n\t}\n\n\tdisposed: boolean = false;\n\tdispose(error?: Error): void {\n\t\tthis._storageService?.dispose?.(error);\n\t\tthis.disposed = true;\n\t}\n\n\tpublic connectToService(service: IDocumentService): void {\n\t\tif (!(this._storageService instanceof BlobOnlyStorage)) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst storageServiceP = service.connectToStorage();\n\t\tconst retriableStorage = (this._storageService = new RetriableDocumentStorageService(\n\t\t\tstorageServiceP,\n\t\t\tthis.logger,\n\t\t));\n\n\t\t// A storage service wrapper which intercept calls to uploadSummaryWithContext and ensure they include\n\t\t// the protocol summary, provided single-commit summary is enabled.\n\t\tthis._storageService = new ProtocolTreeStorageService(\n\t\t\tretriableStorage,\n\t\t\t(...props) => {\n\t\t\t\tthis.logger.sendTelemetryEvent({ eventName: \"summarizeProtocolTreeEnabled\" });\n\t\t\t\treturn this.addProtocolSummaryIfMissing(...props);\n\t\t\t},\n\t\t\t// A callback to ensure we fetch the most updated value of service.policies.summarizeProtocolTree, which could be set\n\t\t\t// based on the response received from the service after connection is established.\n\t\t\t() => {\n\t\t\t\t// Determine whether or not container should upload the protocol summary along with the summary.\n\t\t\t\t// This is determined based on what value is set for serve policy's summariProtocolTree value or the enableSummarizeProtocolTree\n\t\t\t\t// retrievd from the loader options or monitoring context config.\n\t\t\t\tconst shouldSummarizeProtocolTree =\n\t\t\t\t\tservice.policies?.summarizeProtocolTree ?? this.enableSummarizeProtocolTree ?? false;\n\n\t\t\t\tif (this._summarizeProtocolTree !== shouldSummarizeProtocolTree) {\n\t\t\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\t\t\teventName: \"isSummarizeProtocolTreeEnabled\",\n\t\t\t\t\t\tdetails: { value: shouldSummarizeProtocolTree },\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tthis._summarizeProtocolTree = shouldSummarizeProtocolTree;\n\t\t\t\treturn this._summarizeProtocolTree;\n\t\t\t},\n\t\t);\n\t}\n\n\tpublic loadSnapshotFromSnapshotBlobs(snapshotBlobs: ISerializableBlobContents): void {\n\t\tfor (const [id, value] of Object.entries(snapshotBlobs)) {\n\t\t\tthis.blobContents[id] = value;\n\t\t}\n\t}\n\n\tpublic clearPendingState(): void {\n\t\tthis.loadingGroupIdSnapshotsFromPendingState = undefined;\n\t}\n\n\tpublic get policies(): IDocumentStorageServicePolicies | undefined {\n\t\t// back-compat 0.40 containerRuntime requests policies even in detached container if storage is present\n\t\t// and storage is always present in >=0.41.\n\t\ttry {\n\t\t\treturn this._storageService.policies;\n\t\t} catch {\n\t\t\t// No-op\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tpublic async getSnapshotTree(\n\t\tversion?: IVersion,\n\t\tscenarioName?: string,\n\t\t// API called below uses null\n\t\t// eslint-disable-next-line @rushstack/no-new-null\n\t): Promise<ISnapshotTree | null> {\n\t\treturn this._storageService.getSnapshotTree(version, scenarioName);\n\t}\n\n\tpublic async getSnapshot(snapshotFetchOptions?: ISnapshotFetchOptions): Promise<ISnapshot> {\n\t\tlet snapshot: ISnapshot;\n\t\tif (\n\t\t\tthis.loadingGroupIdSnapshotsFromPendingState !== undefined &&\n\t\t\tsnapshotFetchOptions?.loadingGroupIds !== undefined\n\t\t) {\n\t\t\tconst localSnapshot =\n\t\t\t\tthis.loadingGroupIdSnapshotsFromPendingState[snapshotFetchOptions.loadingGroupIds[0]];\n\t\t\tassert(localSnapshot !== undefined, 0x970 /* Local snapshot must be present */);\n\t\t\tsnapshot = convertSnapshotInfoToSnapshot(\n\t\t\t\tlocalSnapshot,\n\t\t\t\tlocalSnapshot.snapshotSequenceNumber,\n\t\t\t);\n\t\t} else {\n\t\t\tif (this._storageService.getSnapshot === undefined) {\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\"getSnapshot api should exist in internal storage in ContainerStorageAdapter\",\n\t\t\t\t);\n\t\t\t}\n\t\t\tsnapshot = await this._storageService.getSnapshot(snapshotFetchOptions);\n\t\t}\n\n\t\t// Track the latest snapshot for each loading group id\n\t\tconst loadingGroupIds = snapshotFetchOptions?.loadingGroupIds;\n\t\tassert(\n\t\t\tsnapshot.sequenceNumber !== undefined,\n\t\t\t0x971 /* Snapshot must have sequence number */,\n\t\t);\n\t\tif (loadingGroupIds !== undefined) {\n\t\t\tfor (const loadingGroupId of loadingGroupIds) {\n\t\t\t\t// Do we actually want to update the stored snapshot?\n\t\t\t\t// What if the incoming snapshot is way newer than the stored snapshot?\n\t\t\t\t// We only want to update the stored snapshot if the incoming snapshot is newer (stored sequence number < incoming sequence number)\n\t\t\t\tconst storedSeqNum =\n\t\t\t\t\tthis._loadedGroupIdSnapshots[loadingGroupId]?.sequenceNumber ?? -1;\n\t\t\t\tif (storedSeqNum < snapshot.sequenceNumber) {\n\t\t\t\t\tthis._loadedGroupIdSnapshots[loadingGroupId] = snapshot;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn snapshot;\n\t}\n\n\tpublic async readBlob(id: string): Promise<ArrayBufferLike> {\n\t\tconst maybeBlob = this.blobContents[id];\n\t\tif (maybeBlob !== undefined) {\n\t\t\tif (typeof maybeBlob === \"string\") {\n\t\t\t\tconst blob = stringToBuffer(maybeBlob, \"utf8\");\n\t\t\t\treturn blob;\n\t\t\t}\n\t\t\treturn maybeBlob;\n\t\t}\n\t\treturn this._storageService.readBlob(id);\n\t}\n\n\tpublic async getVersions(\n\t\t// API used below uses null\n\t\t// eslint-disable-next-line @rushstack/no-new-null\n\t\tversionId: string | null,\n\t\tcount: number,\n\t\tscenarioName?: string,\n\t\tfetchSource?: FetchSource,\n\t): Promise<IVersion[]> {\n\t\treturn this._storageService.getVersions(versionId, count, scenarioName, fetchSource);\n\t}\n\n\tpublic async uploadSummaryWithContext(\n\t\tsummary: ISummaryTree,\n\t\tcontext: ISummaryContext,\n\t): Promise<string> {\n\t\treturn this._storageService.uploadSummaryWithContext(summary, context);\n\t}\n\n\tpublic async downloadSummary(handle: ISummaryHandle): Promise<ISummaryTree> {\n\t\treturn this._storageService.downloadSummary(handle);\n\t}\n\n\tpublic async createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse> {\n\t\treturn this._storageService.createBlob(file);\n\t}\n}\n\n/**\n * Storage which only supports createBlob() and readBlob(). This is used with IDetachedBlobStorage to support\n * blobs in detached containers.\n */\nclass BlobOnlyStorage implements IDocumentStorageService {\n\tconstructor(\n\t\tprivate readonly detachedStorage: MemoryDetachedBlobStorage | undefined,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t) {}\n\n\tpublic async createBlob(content: ArrayBufferLike): Promise<ICreateBlobResponse> {\n\t\treturn this.verifyStorage().createBlob(content);\n\t}\n\n\tpublic async readBlob(blobId: string): Promise<ArrayBufferLike> {\n\t\treturn this.verifyStorage().readBlob(blobId);\n\t}\n\n\tprivate verifyStorage(): MemoryDetachedBlobStorage {\n\t\tif (this.detachedStorage === undefined) {\n\t\t\tthrow new UsageError(\"Real storage calls not allowed in Unattached container\");\n\t\t}\n\t\treturn this.detachedStorage;\n\t}\n\n\tpublic get policies(): IDocumentStorageServicePolicies | undefined {\n\t\treturn this.notCalled();\n\t}\n\n\t/* eslint-disable @typescript-eslint/unbound-method */\n\t// eslint-disable-next-line @rushstack/no-new-null\n\tpublic getSnapshotTree: () => Promise<ISnapshotTree | null> = this.notCalled;\n\tpublic getSnapshot: () => Promise<ISnapshot> = this.notCalled;\n\tpublic getVersions: () => Promise<IVersion[]> = this.notCalled;\n\tpublic write: () => Promise<IVersion> = this.notCalled;\n\tpublic uploadSummaryWithContext: () => Promise<string> = this.notCalled;\n\tpublic downloadSummary: () => Promise<ISummaryTree> = this.notCalled;\n\t/* eslint-enable @typescript-eslint/unbound-method */\n\n\tprivate notCalled(): never {\n\t\tthis.verifyStorage();\n\t\ttry {\n\t\t\t// some browsers may not populate stack unless exception is thrown\n\t\t\tthrow new Error(\"BlobOnlyStorage not implemented method used\");\n\t\t} catch (error) {\n\t\t\tthis.logger.sendTelemetryEvent({ eventName: \"BlobOnlyStorageWrongCall\" }, error);\n\t\t\tthrow error;\n\t\t}\n\t}\n}\n\n// runtime will write a tree to the summary containing \"attachment\" type entries\n// which reference attachment blobs by ID, along with a blob containing the blob redirect table.\n// However, some drivers do not support the \"attachment\" type and will convert them to \"blob\" type\n// entries. We want to avoid saving these to reduce the size of stashed change blobs, but we\n// need to make sure the blob redirect table is saved.\nconst blobsTreeName = \".blobs\";\nconst redirectTableBlobName = \".redirectTable\";\n\n/**\n * Get blob contents of a snapshot tree from storage (or, ideally, cache)\n */\nexport async function getBlobContentsFromTree(\n\tsnapshot: ISnapshot | ISnapshotTree,\n\tstorage: Pick<IDocumentStorageService, \"readBlob\">,\n): Promise<ISerializableBlobContents> {\n\tconst blobs = {};\n\tif (isInstanceOfISnapshot(snapshot)) {\n\t\tconst blobContents = snapshot.blobContents;\n\t\tfor (const [id, content] of blobContents.entries()) {\n\t\t\t// ArrayBufferLike will not survive JSON.stringify()\n\t\t\tblobs[id] = bufferToString(content, \"utf8\");\n\t\t}\n\t} else {\n\t\tawait getBlobContentsFromTreeCore(snapshot, blobs, storage);\n\t}\n\treturn blobs;\n}\n\nasync function getBlobContentsFromTreeCore(\n\ttree: ISnapshotTree,\n\tblobs: ISerializableBlobContents,\n\tstorage: Pick<IDocumentStorageService, \"readBlob\">,\n\troot = true,\n): Promise<unknown[]> {\n\tconst treePs: Promise<unknown>[] = [];\n\tfor (const [key, subTree] of Object.entries(tree.trees)) {\n\t\tif (root && key === blobsTreeName) {\n\t\t\ttreePs.push(getBlobManagerTreeFromTree(subTree, blobs, storage));\n\t\t} else {\n\t\t\ttreePs.push(getBlobContentsFromTreeCore(subTree, blobs, storage, false));\n\t\t}\n\t}\n\tfor (const id of Object.values(tree.blobs)) {\n\t\tconst blob = await storage.readBlob(id);\n\t\t// ArrayBufferLike will not survive JSON.stringify()\n\t\tblobs[id] = bufferToString(blob, \"utf8\");\n\t}\n\treturn Promise.all(treePs);\n}\n\n// save redirect table from .blobs tree but nothing else\nasync function getBlobManagerTreeFromTree(\n\ttree: ISnapshotTree,\n\tblobs: ISerializableBlobContents,\n\tstorage: Pick<IDocumentStorageService, \"readBlob\">,\n): Promise<void> {\n\tconst id = tree.blobs[redirectTableBlobName];\n\tassert(id !== undefined, 0x9ce /* id is undefined in getBlobManagerTreeFromTree */);\n\tconst blob = await storage.readBlob(id);\n\t// ArrayBufferLike will not survive JSON.stringify()\n\tblobs[id] = bufferToString(blob, \"utf8\");\n}\n\n/**\n * Extract blob contents from a snapshot tree with blob contents\n */\nexport function getBlobContentsFromTreeWithBlobContents(\n\tsnapshot: ISnapshotTreeWithBlobContents,\n): ISerializableBlobContents {\n\tconst blobs = {};\n\tgetBlobContentsFromTreeWithBlobContentsCore(snapshot, blobs);\n\treturn blobs;\n}\n\nfunction getBlobContentsFromTreeWithBlobContentsCore(\n\ttree: ISnapshotTreeWithBlobContents,\n\tblobs: ISerializableBlobContents,\n\troot = true,\n): void {\n\tfor (const [key, subTree] of Object.entries(tree.trees)) {\n\t\tif (root && key === blobsTreeName) {\n\t\t\tgetBlobManagerTreeFromTreeWithBlobContents(subTree, blobs);\n\t\t} else {\n\t\t\tgetBlobContentsFromTreeWithBlobContentsCore(subTree, blobs, false);\n\t\t}\n\t}\n\tfor (const id of Object.values(tree.blobs)) {\n\t\tconst blob = tree.blobsContents?.[id];\n\t\tassert(blob !== undefined, 0x2ec /* \"Blob must be present in blobsContents\" */);\n\t\t// ArrayBufferLike will not survive JSON.stringify()\n\t\tblobs[id] = bufferToString(blob, \"utf8\");\n\t}\n}\n\n// save redirect table from .blobs tree but nothing else\nfunction getBlobManagerTreeFromTreeWithBlobContents(\n\ttree: ISnapshotTreeWithBlobContents,\n\tblobs: ISerializableBlobContents,\n): void {\n\tconst id = tree.blobs[redirectTableBlobName];\n\tassert(\n\t\tid !== undefined,\n\t\t0x9cf /* id is undefined in getBlobManagerTreeFromTreeWithBlobContents */,\n\t);\n\tconst blob = tree.blobsContents?.[id];\n\tassert(blob !== undefined, 0x70f /* Blob must be present in blobsContents */);\n\t// ArrayBufferLike will not survive JSON.stringify()\n\tblobs[id] = bufferToString(blob, \"utf8\");\n}\n"]}
package/lib/index.d.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  export { ConnectionState } from "./connectionState.js";
6
6
  export { IContainerExperimental, waitContainerToCatchUp } from "./container.js";
7
7
  export { createDetachedContainer, loadExistingContainer, rehydrateDetachedContainer, ICreateAndLoadContainerProps, ICreateDetachedContainerProps, ILoadExistingContainerProps, IRehydrateDetachedContainerProps, } from "./createAndLoadContainerUtils.js";
8
- export { ICodeDetailsLoader, IDetachedBlobStorage, IFluidModuleWithDetails, ILoaderProps, ILoaderServices, Loader, } from "./loader.js";
8
+ export { ICodeDetailsLoader, IFluidModuleWithDetails, ILoaderProps, ILoaderServices, Loader, } from "./loader.js";
9
9
  export { loadContainerPaused } from "./loadPaused.js";
10
10
  export { isLocationRedirectionError, resolveWithLocationRedirectionHandling, } from "./location-redirection-utilities/index.js";
11
11
  export { IProtocolHandler, ProtocolHandlerBuilder } from "./protocol.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAChF,OAAO,EACN,uBAAuB,EACvB,qBAAqB,EACrB,0BAA0B,EAC1B,4BAA4B,EAC5B,6BAA6B,EAC7B,2BAA2B,EAC3B,gCAAgC,GAChC,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACN,kBAAkB,EAClB,oBAAoB,EACpB,uBAAuB,EACvB,YAAY,EACZ,eAAe,EACf,MAAM,GACN,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EACN,0BAA0B,EAC1B,sCAAsC,GACtC,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,EACN,6BAA6B,EAC7B,UAAU,GACV,MAAM,YAAY,CAAC;AACpB,OAAO,EACN,oBAAoB,EACpB,oBAAoB,EACpB,eAAe,EACf,qBAAqB,EACrB,uBAAuB,GACvB,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAChF,OAAO,EACN,uBAAuB,EACvB,qBAAqB,EACrB,0BAA0B,EAC1B,4BAA4B,EAC5B,6BAA6B,EAC7B,2BAA2B,EAC3B,gCAAgC,GAChC,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACN,kBAAkB,EAClB,uBAAuB,EACvB,YAAY,EACZ,eAAe,EACf,MAAM,GACN,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EACN,0BAA0B,EAC1B,sCAAsC,GACtC,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,EACN,6BAA6B,EAC7B,UAAU,GACV,MAAM,YAAY,CAAC;AACpB,OAAO,EACN,oBAAoB,EACpB,oBAAoB,EACpB,eAAe,EACf,qBAAqB,EACrB,uBAAuB,GACvB,MAAM,qBAAqB,CAAC"}
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,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAA0B,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAChF,OAAO,EACN,uBAAuB,EACvB,qBAAqB,EACrB,0BAA0B,GAK1B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAMN,MAAM,GACN,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EACN,0BAA0B,EAC1B,sCAAsC,GACtC,MAAM,2CAA2C,CAAC;AAEnD,OAAO,EACN,6BAA6B,GAE7B,MAAM,YAAY,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { ConnectionState } from \"./connectionState.js\";\nexport { IContainerExperimental, waitContainerToCatchUp } from \"./container.js\";\nexport {\n\tcreateDetachedContainer,\n\tloadExistingContainer,\n\trehydrateDetachedContainer,\n\tICreateAndLoadContainerProps,\n\tICreateDetachedContainerProps,\n\tILoadExistingContainerProps,\n\tIRehydrateDetachedContainerProps,\n} from \"./createAndLoadContainerUtils.js\";\nexport {\n\tICodeDetailsLoader,\n\tIDetachedBlobStorage,\n\tIFluidModuleWithDetails,\n\tILoaderProps,\n\tILoaderServices,\n\tLoader,\n} from \"./loader.js\";\nexport { loadContainerPaused } from \"./loadPaused.js\";\nexport {\n\tisLocationRedirectionError,\n\tresolveWithLocationRedirectionHandling,\n} from \"./location-redirection-utilities/index.js\";\nexport { IProtocolHandler, ProtocolHandlerBuilder } from \"./protocol.js\";\nexport {\n\ttryParseCompatibleResolvedUrl,\n\tIParsedUrl,\n} from \"./utils.js\";\nexport {\n\tIBaseProtocolHandler,\n\tIScribeProtocolState,\n\tIQuorumSnapshot,\n\tQuorumClientsSnapshot,\n\tQuorumProposalsSnapshot,\n} from \"./protocol/index.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAA0B,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAChF,OAAO,EACN,uBAAuB,EACvB,qBAAqB,EACrB,0BAA0B,GAK1B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAKN,MAAM,GACN,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EACN,0BAA0B,EAC1B,sCAAsC,GACtC,MAAM,2CAA2C,CAAC;AAEnD,OAAO,EACN,6BAA6B,GAE7B,MAAM,YAAY,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { ConnectionState } from \"./connectionState.js\";\nexport { IContainerExperimental, waitContainerToCatchUp } from \"./container.js\";\nexport {\n\tcreateDetachedContainer,\n\tloadExistingContainer,\n\trehydrateDetachedContainer,\n\tICreateAndLoadContainerProps,\n\tICreateDetachedContainerProps,\n\tILoadExistingContainerProps,\n\tIRehydrateDetachedContainerProps,\n} from \"./createAndLoadContainerUtils.js\";\nexport {\n\tICodeDetailsLoader,\n\tIFluidModuleWithDetails,\n\tILoaderProps,\n\tILoaderServices,\n\tLoader,\n} from \"./loader.js\";\nexport { loadContainerPaused } from \"./loadPaused.js\";\nexport {\n\tisLocationRedirectionError,\n\tresolveWithLocationRedirectionHandling,\n} from \"./location-redirection-utilities/index.js\";\nexport { IProtocolHandler, ProtocolHandlerBuilder } from \"./protocol.js\";\nexport {\n\ttryParseCompatibleResolvedUrl,\n\tIParsedUrl,\n} from \"./utils.js\";\nexport {\n\tIBaseProtocolHandler,\n\tIScribeProtocolState,\n\tIQuorumSnapshot,\n\tQuorumClientsSnapshot,\n\tQuorumProposalsSnapshot,\n} from \"./protocol/index.js\";\n"]}
package/lib/legacy.d.ts CHANGED
@@ -17,7 +17,6 @@ export {
17
17
  ICodeDetailsLoader,
18
18
  ICreateAndLoadContainerProps,
19
19
  ICreateDetachedContainerProps,
20
- IDetachedBlobStorage,
21
20
  IFluidModuleWithDetails,
22
21
  ILoadExistingContainerProps,
23
22
  ILoaderProps,
package/lib/loader.d.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  import { IContainer, IFluidCodeDetails, IFluidModule, IHostLoader, ILoader, ILoaderOptions, IProvideFluidCodeDetailsComparer } from "@fluidframework/container-definitions/internal";
6
6
  import { FluidObject, IConfigProviderBase, IRequest, ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
7
7
  import { IClientDetails } from "@fluidframework/driver-definitions";
8
- import { IDocumentServiceFactory, IDocumentStorageService, IUrlResolver } from "@fluidframework/driver-definitions/internal";
8
+ import { IDocumentServiceFactory, IUrlResolver } from "@fluidframework/driver-definitions/internal";
9
9
  import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
10
10
  import { Container } from "./container.js";
11
11
  import { ProtocolHandlerBuilder } from "./protocol.js";
@@ -92,10 +92,6 @@ export interface ILoaderProps {
92
92
  * The logger that all telemetry should be pushed to.
93
93
  */
94
94
  readonly logger?: ITelemetryBaseLogger;
95
- /**
96
- * Blobs storage for detached containers.
97
- */
98
- readonly detachedBlobStorage?: IDetachedBlobStorage;
99
95
  /**
100
96
  * The configuration provider which may be used to control features.
101
97
  */
@@ -143,36 +139,12 @@ export interface ILoaderServices {
143
139
  * The logger downstream consumers should construct their loggers from
144
140
  */
145
141
  readonly subLogger: ITelemetryLoggerExt;
146
- /**
147
- * Blobs storage for detached containers.
148
- * @deprecated - IDetachedBlobStorage will be removed in a future release without a replacement. Blobs created while detached will be stored in memory to align with attached container behavior. AB#8049
149
- */
150
- readonly detachedBlobStorage?: IDetachedBlobStorage;
151
142
  /**
152
143
  * Optional property for allowing the container to use a custom
153
144
  * protocol implementation for handling the quorum and/or the audience.
154
145
  */
155
146
  readonly protocolHandlerBuilder?: ProtocolHandlerBuilder;
156
147
  }
157
- /**
158
- * Subset of IDocumentStorageService which only supports createBlob() and readBlob(). This is used to support
159
- * blobs in detached containers.
160
- * @legacy
161
- * @alpha
162
- *
163
- * @deprecated - IDetachedBlobStorage will be removed in a future release without a replacement. Blobs created while detached will be stored in memory to align with attached container behavior. AB#8049
164
- */
165
- export type IDetachedBlobStorage = Pick<IDocumentStorageService, "createBlob" | "readBlob"> & {
166
- size: number;
167
- /**
168
- * Return an array of all blob IDs present in storage
169
- */
170
- getBlobIds(): string[];
171
- /**
172
- * After the container is attached, the detached blob storage is no longer needed and will be disposed.
173
- */
174
- dispose?(): void;
175
- };
176
148
  /**
177
149
  * Manages Fluid resource loading
178
150
  * @legacy
@@ -1 +1 @@
1
- {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,UAAU,EACV,iBAAiB,EACjB,YAAY,EACZ,WAAW,EACX,OAAO,EACP,cAAc,EACd,gCAAgC,EAEhC,MAAM,gDAAgD,CAAC;AACxD,OAAO,EACN,WAAW,EACX,mBAAmB,EACnB,QAAQ,EACR,oBAAoB,EACpB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EACN,uBAAuB,EACvB,uBAAuB,EAEvB,YAAY,EACZ,MAAM,6CAA6C,CAAC;AACrD,OAAO,EACN,mBAAmB,EAMnB,MAAM,0CAA0C,CAAC;AAGlD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAG3C,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAcvD;;GAEG;AACH,qBAAa,cAAe,YAAW,OAAO;IAE5C,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,MAAM;gBADN,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,OAAO,GAAG,SAA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;IAUT,sCAAsC,CAClD,QAAQ,EAAE,MAAM,EAChB,mBAAmB,CAAC,EAAE;QACrB,YAAY,CAAC,EAAE,OAAO,CAAC;QACvB,qBAAqB,CAAC,EAAE,cAAc,CAAC;KACvC,GACC,OAAO,CAAC,UAAU,CAAC;IAUT,OAAO,CAAC,OAAO,EAAE,QAAQ,EAAE,iBAAiB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;YAU1E,WAAW;YAiCX,aAAa;CAuB3B"}
package/lib/loader.js CHANGED
@@ -54,7 +54,7 @@ export class RelativeLoader {
54
54
  */
55
55
  export class Loader {
56
56
  constructor(loaderProps) {
57
- const { urlResolver, documentServiceFactory, codeLoader, options, scope, logger, detachedBlobStorage, configProvider, protocolHandlerBuilder, } = loaderProps;
57
+ const { urlResolver, documentServiceFactory, codeLoader, options, scope, logger, configProvider, protocolHandlerBuilder, } = loaderProps;
58
58
  const telemetryProps = {
59
59
  loaderId: uuid(),
60
60
  loaderVersion: pkgVersion,
@@ -68,7 +68,6 @@ export class Loader {
68
68
  codeLoader,
69
69
  options: options ?? {},
70
70
  scope: options?.provideScopeLoader === false ? { ...scope } : { ...scope, ILoader: this },
71
- detachedBlobStorage,
72
71
  protocolHandlerBuilder,
73
72
  subLogger: subMc.logger,
74
73
  };
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,EAQN,YAAY,GACZ,MAAM,gDAAgD,CAAC;AAcxD,OAAO,EAGN,gBAAgB,EAChB,4BAA4B,EAC5B,sBAAsB,EACtB,4BAA4B,GAC5B,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AAElC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;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K,EAAE,EAAE,CAAC,KAAK,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,EAC3E,CAAC;gBACF,MAAM,OAAO,GAAG,OAAO,eAAe,CAAC,GAAG,qCAAqC,iBAAiB,CAAC,GAAG,EAAE,CAAC;gBACvG,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;YAC1B,CAAC;QACF,CAAC;QAED,OAAO,CAAC,OAAO,KAAK,EAAE,CAAC;QACvB,qIAAqI;QACrI,mEAAmE;QACnE,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC;YACpC,MAAM,CAAC,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QAEzD,OAAO,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,eAAe,EAAE,iBAAiB,CAAC,CAAC;IACxE,CAAC;IAEO,KAAK,CAAC,aAAa,CAC1B,OAAiB,EACjB,WAAyB,EACzB,iBAA0C;QAE1C,OAAO,SAAS,CAAC,IAAI,CACpB;YACC,WAAW;YACX,mEAAmE;YACnE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,SAAS;YAC7D,mEAAmE;YACnE,QAAQ,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC;YAClD,iBAAiB;SACjB,EACD;YACC,mEAAmE;YACnE,YAAY,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,YAAY,CAAC,SAAS,CAAC;YACvD,mEAAmE;YACnE,qBAAqB,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,YAAY,CAAC,aAAa,CAAC;YACpE,GAAG,IAAI,CAAC,QAAQ;SAChB,CACD,CAAC;IACH,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tIContainer,\n\tIFluidCodeDetails,\n\tIFluidModule,\n\tIHostLoader,\n\tILoader,\n\tILoaderOptions,\n\tIProvideFluidCodeDetailsComparer,\n\tLoaderHeader,\n} from \"@fluidframework/container-definitions/internal\";\nimport {\n\tFluidObject,\n\tIConfigProviderBase,\n\tIRequest,\n\tITelemetryBaseLogger,\n} from \"@fluidframework/core-interfaces\";\nimport { IClientDetails } from \"@fluidframework/driver-definitions\";\nimport {\n\tIDocumentServiceFactory,\n\tIDocumentStorageService,\n\tIResolvedUrl,\n\tIUrlResolver,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tITelemetryLoggerExt,\n\tMonitoringContext,\n\tPerformanceEvent,\n\tcreateChildMonitoringContext,\n\tmixinMonitoringContext,\n\tsessionStorageConfigProvider,\n} from \"@fluidframework/telemetry-utils/internal\";\nimport { v4 as uuid } from \"uuid\";\n\nimport { Container } from \"./container.js\";\nimport { DebugLogger } from \"./debugLogger.js\";\nimport { pkgVersion } from \"./packageVersion.js\";\nimport { ProtocolHandlerBuilder } from \"./protocol.js\";\nimport type { IPendingContainerState } from \"./serializedStateManager.js\";\nimport {\n\tgetAttachedContainerStateFromSerializedContainer,\n\ttryParseCompatibleResolvedUrl,\n} from \"./utils.js\";\n\nfunction ensureResolvedUrlDefined(\n\tresolved: IResolvedUrl | undefined,\n): asserts resolved is IResolvedUrl {\n\tif (resolved === undefined) {\n\t\tthrow new Error(`Object is not a IResolveUrl.`);\n\t}\n}\n/**\n * @internal\n */\nexport class RelativeLoader implements ILoader {\n\tconstructor(\n\t\tprivate readonly container: Container,\n\t\tprivate readonly loader: ILoader | undefined,\n\t) {}\n\n\tpublic async resolve(request: IRequest): Promise<IContainer> {\n\t\tif (request.url.startsWith(\"/\")) {\n\t\t\tensureResolvedUrlDefined(this.container.resolvedUrl);\n\t\t\tconst container = await this.container.clone(\n\t\t\t\t{\n\t\t\t\t\tresolvedUrl: { ...this.container.resolvedUrl },\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\t\t\t\tversion: request.headers?.[LoaderHeader.version] ?? undefined,\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\t\t\t\tloadMode: request.headers?.[LoaderHeader.loadMode],\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\t\t\t\tcanReconnect: request.headers?.[LoaderHeader.reconnect],\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\t\t\t\tclientDetailsOverride: request.headers?.[LoaderHeader.clientDetails],\n\t\t\t\t},\n\t\t\t);\n\t\t\treturn container;\n\t\t}\n\n\t\tif (this.loader === undefined) {\n\t\t\tthrow new Error(\"Cannot resolve external containers\");\n\t\t}\n\t\treturn this.loader.resolve(request);\n\t}\n}\n\n/**\n * @deprecated IFluidModuleWithDetails interface is moved to\n * {@link @fluidframework/container-definitions#IFluidModuleWithDetails}\n * to have all the code loading modules in one package. #8193\n * Encapsulates a module entry point with corresponding code details.\n * @legacy\n * @alpha\n */\nexport interface IFluidModuleWithDetails {\n\t/**\n\t * Fluid code module that implements the runtime factory needed to instantiate the container runtime.\n\t */\n\tmodule: IFluidModule;\n\t/**\n\t * Code details associated with the module. Represents a document schema this module supports.\n\t * If the code loader implements the {@link @fluidframework/core-interfaces#IFluidCodeDetailsComparer} interface,\n\t * it'll be called to determine whether the module code details satisfy the new code proposal in the quorum.\n\t */\n\tdetails: IFluidCodeDetails;\n}\n\n/**\n * @deprecated ICodeDetailsLoader interface is moved to {@link @fluidframework/container-definitions#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 * @legacy\n * @alpha\n */\nexport interface ICodeDetailsLoader extends Partial<IProvideFluidCodeDetailsComparer> {\n\t/**\n\t * Load the code module (package) that is capable to interact with the document.\n\t *\n\t * @param source - Code proposal that articulates the current schema the document is written in.\n\t * @returns Code module entry point along with the code details associated with it.\n\t */\n\tload(source: IFluidCodeDetails): Promise<IFluidModuleWithDetails>;\n}\n\n/**\n * Services and properties necessary for creating a loader\n * @legacy\n * @alpha\n */\nexport interface ILoaderProps {\n\t/**\n\t * The url resolver used by the loader for resolving external urls\n\t * into Fluid urls such that the container specified by the\n\t * external url can be loaded.\n\t */\n\treadonly urlResolver: IUrlResolver;\n\t/**\n\t * The document service factory take the Fluid url provided\n\t * by the resolved url and constructs all the necessary services\n\t * for communication with the container's server.\n\t */\n\treadonly documentServiceFactory: IDocumentServiceFactory;\n\t/**\n\t * The code loader handles loading the necessary code\n\t * for running a container once it is loaded.\n\t */\n\treadonly codeLoader: ICodeDetailsLoader;\n\n\t/**\n\t * A property bag of options used by various layers\n\t * to control features\n\t */\n\treadonly options?: ILoaderOptions;\n\n\t/**\n\t * Scope is provided to all container and is a set of shared\n\t * services for container's to integrate with their host environment.\n\t */\n\treadonly scope?: FluidObject;\n\n\t/**\n\t * The logger that all telemetry should be pushed to.\n\t */\n\treadonly logger?: ITelemetryBaseLogger;\n\n\t/**\n\t * Blobs storage for detached containers.\n\t */\n\treadonly detachedBlobStorage?: IDetachedBlobStorage;\n\n\t/**\n\t * The configuration provider which may be used to control features.\n\t */\n\treadonly configProvider?: IConfigProviderBase;\n\n\t/**\n\t * Optional property for allowing the container to use a custom\n\t * protocol implementation for handling the quorum and/or the audience.\n\t */\n\treadonly protocolHandlerBuilder?: ProtocolHandlerBuilder;\n}\n\n/**\n * Services and properties used by and exposed by the loader\n * @legacy\n * @alpha\n */\nexport interface ILoaderServices {\n\t/**\n\t * The url resolver used by the loader for resolving external urls\n\t * into Fluid urls such that the container specified by the\n\t * external url can be loaded.\n\t */\n\treadonly urlResolver: IUrlResolver;\n\t/**\n\t * The document service factory take the Fluid url provided\n\t * by the resolved url and constructs all the necessary services\n\t * for communication with the container's server.\n\t */\n\treadonly documentServiceFactory: IDocumentServiceFactory;\n\t/**\n\t * The code loader handles loading the necessary code\n\t * for running a container once it is loaded.\n\t */\n\treadonly codeLoader: ICodeDetailsLoader;\n\n\t/**\n\t * A property bag of options used by various layers\n\t * to control features\n\t */\n\treadonly options: ILoaderOptions;\n\n\t/**\n\t * Scope is provided to all container and is a set of shared\n\t * services for container's to integrate with their host environment.\n\t */\n\treadonly scope: FluidObject;\n\n\t/**\n\t * The logger downstream consumers should construct their loggers from\n\t */\n\treadonly subLogger: ITelemetryLoggerExt;\n\n\t/**\n\t * Blobs storage for detached containers.\n\t * @deprecated - IDetachedBlobStorage will be removed in a future release without a replacement. Blobs created while detached will be stored in memory to align with attached container behavior. AB#8049\n\t */\n\treadonly detachedBlobStorage?: IDetachedBlobStorage;\n\n\t/**\n\t * Optional property for allowing the container to use a custom\n\t * protocol implementation for handling the quorum and/or the audience.\n\t */\n\treadonly protocolHandlerBuilder?: ProtocolHandlerBuilder;\n}\n\n/**\n * Subset of IDocumentStorageService which only supports createBlob() and readBlob(). This is used to support\n * blobs in detached containers.\n * @legacy\n * @alpha\n *\n * @deprecated - IDetachedBlobStorage will be removed in a future release without a replacement. Blobs created while detached will be stored in memory to align with attached container behavior. AB#8049\n */\nexport type IDetachedBlobStorage = Pick<IDocumentStorageService, \"createBlob\" | \"readBlob\"> & {\n\tsize: number;\n\t/**\n\t * Return an array of all blob IDs present in storage\n\t */\n\tgetBlobIds(): string[];\n\n\t/**\n\t * After the container is attached, the detached blob storage is no longer needed and will be disposed.\n\t */\n\tdispose?(): void;\n};\n\n/**\n * Manages Fluid resource loading\n * @legacy\n * @alpha\n *\n * @remarks The Loader class is deprecated and will be removed in a future release. Use the free-form functions instead (See issue #24450 for more details).\n */\nexport class Loader implements IHostLoader {\n\tpublic readonly services: ILoaderServices;\n\tprivate readonly mc: MonitoringContext;\n\n\tconstructor(loaderProps: ILoaderProps) {\n\t\tconst {\n\t\t\turlResolver,\n\t\t\tdocumentServiceFactory,\n\t\t\tcodeLoader,\n\t\t\toptions,\n\t\t\tscope,\n\t\t\tlogger,\n\t\t\tdetachedBlobStorage,\n\t\t\tconfigProvider,\n\t\t\tprotocolHandlerBuilder,\n\t\t} = loaderProps;\n\n\t\tconst telemetryProps = {\n\t\t\tloaderId: uuid(),\n\t\t\tloaderVersion: pkgVersion,\n\t\t};\n\n\t\tconst subMc = mixinMonitoringContext(\n\t\t\tDebugLogger.mixinDebugLogger(\"fluid:telemetry\", logger, {\n\t\t\t\tall: telemetryProps,\n\t\t\t}),\n\t\t\tsessionStorageConfigProvider.value,\n\t\t\tconfigProvider,\n\t\t);\n\n\t\tthis.services = {\n\t\t\turlResolver,\n\t\t\tdocumentServiceFactory,\n\t\t\tcodeLoader,\n\t\t\toptions: options ?? {},\n\t\t\tscope:\n\t\t\t\toptions?.provideScopeLoader === false ? { ...scope } : { ...scope, ILoader: this },\n\t\t\tdetachedBlobStorage,\n\t\t\tprotocolHandlerBuilder,\n\t\t\tsubLogger: subMc.logger,\n\t\t};\n\t\tthis.mc = createChildMonitoringContext({\n\t\t\tlogger: this.services.subLogger,\n\t\t\tnamespace: \"Loader\",\n\t\t});\n\t}\n\n\tpublic async createDetachedContainer(\n\t\tcodeDetails: IFluidCodeDetails,\n\t\tcreateDetachedProps?: {\n\t\t\tcanReconnect?: boolean;\n\t\t\tclientDetailsOverride?: IClientDetails;\n\t\t},\n\t): Promise<IContainer> {\n\t\treturn Container.createDetached(\n\t\t\t{\n\t\t\t\t...createDetachedProps,\n\t\t\t\t...this.services,\n\t\t\t},\n\t\t\tcodeDetails,\n\t\t);\n\t}\n\n\tpublic async rehydrateDetachedContainerFromSnapshot(\n\t\tsnapshot: string,\n\t\tcreateDetachedProps?: {\n\t\t\tcanReconnect?: boolean;\n\t\t\tclientDetailsOverride?: IClientDetails;\n\t\t},\n\t): Promise<IContainer> {\n\t\treturn Container.rehydrateDetachedFromSnapshot(\n\t\t\t{\n\t\t\t\t...createDetachedProps,\n\t\t\t\t...this.services,\n\t\t\t},\n\t\t\tsnapshot,\n\t\t);\n\t}\n\n\tpublic async resolve(request: IRequest, pendingLocalState?: string): Promise<IContainer> {\n\t\tconst eventName = pendingLocalState === undefined ? \"Resolve\" : \"ResolveWithPendingState\";\n\t\treturn PerformanceEvent.timedExecAsync(this.mc.logger, { eventName }, async () => {\n\t\t\treturn this.resolveCore(\n\t\t\t\trequest,\n\t\t\t\tgetAttachedContainerStateFromSerializedContainer(pendingLocalState),\n\t\t\t);\n\t\t});\n\t}\n\n\tprivate async resolveCore(\n\t\trequest: IRequest,\n\t\tpendingLocalState?: IPendingContainerState,\n\t): Promise<Container> {\n\t\tconst resolvedAsFluid = await this.services.urlResolver.resolve(request);\n\t\tensureResolvedUrlDefined(resolvedAsFluid);\n\n\t\t// Parse URL into data stores\n\t\tconst parsed = tryParseCompatibleResolvedUrl(resolvedAsFluid.url);\n\t\tif (parsed === undefined) {\n\t\t\tthrow new Error(`Invalid URL ${resolvedAsFluid.url}`);\n\t\t}\n\n\t\tif (pendingLocalState !== undefined) {\n\t\t\tconst parsedPendingUrl = tryParseCompatibleResolvedUrl(pendingLocalState.url);\n\t\t\tif (\n\t\t\t\tparsedPendingUrl?.id !== parsed.id ||\n\t\t\t\tparsedPendingUrl?.path.replace(/\\/$/, \"\") !== parsed.path.replace(/\\/$/, \"\")\n\t\t\t) {\n\t\t\t\tconst message = `URL ${resolvedAsFluid.url} does not match pending state URL ${pendingLocalState.url}`;\n\t\t\t\tthrow new Error(message);\n\t\t\t}\n\t\t}\n\n\t\trequest.headers ??= {};\n\t\t// If set in both query string and headers, use query string. Also write the value from the query string into the header either way.\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\trequest.headers[LoaderHeader.version] =\n\t\t\tparsed.version ?? request.headers[LoaderHeader.version];\n\n\t\treturn this.loadContainer(request, resolvedAsFluid, pendingLocalState);\n\t}\n\n\tprivate async loadContainer(\n\t\trequest: IRequest,\n\t\tresolvedUrl: IResolvedUrl,\n\t\tpendingLocalState?: IPendingContainerState,\n\t): Promise<Container> {\n\t\treturn Container.load(\n\t\t\t{\n\t\t\t\tresolvedUrl,\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\t\t\tversion: request.headers?.[LoaderHeader.version] ?? undefined,\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\t\t\tloadMode: request.headers?.[LoaderHeader.loadMode],\n\t\t\t\tpendingLocalState,\n\t\t\t},\n\t\t\t{\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\t\t\tcanReconnect: request.headers?.[LoaderHeader.reconnect],\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\t\t\tclientDetailsOverride: request.headers?.[LoaderHeader.clientDetails],\n\t\t\t\t...this.services,\n\t\t\t},\n\t\t);\n\t}\n}\n"]}
1
+ {"version":3,"file":"loader.js","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAQN,YAAY,GACZ,MAAM,gDAAgD,CAAC;AAaxD,OAAO,EAGN,gBAAgB,EAChB,4BAA4B,EAC5B,sBAAsB,EACtB,4BAA4B,GAC5B,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AAElC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGjD,OAAO,EACN,gDAAgD,EAChD,6BAA6B,GAC7B,MAAM,YAAY,CAAC;AAEpB,SAAS,wBAAwB,CAChC,QAAkC;IAElC,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC5B,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;IACjD,CAAC;AACF,CAAC;AACD;;GAEG;AACH,MAAM,OAAO,cAAc;IAC1B,YACkB,SAAoB,EACpB,MAA2B;QAD3B,cAAS,GA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C;YACpC,MAAM,CAAC,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QAEzD,OAAO,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,eAAe,EAAE,iBAAiB,CAAC,CAAC;IACxE,CAAC;IAEO,KAAK,CAAC,aAAa,CAC1B,OAAiB,EACjB,WAAyB,EACzB,iBAA0C;QAE1C,OAAO,SAAS,CAAC,IAAI,CACpB;YACC,WAAW;YACX,mEAAmE;YACnE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,SAAS;YAC7D,mEAAmE;YACnE,QAAQ,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC;YAClD,iBAAiB;SACjB,EACD;YACC,mEAAmE;YACnE,YAAY,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,YAAY,CAAC,SAAS,CAAC;YACvD,mEAAmE;YACnE,qBAAqB,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,YAAY,CAAC,aAAa,CAAC;YACpE,GAAG,IAAI,CAAC,QAAQ;SAChB,CACD,CAAC;IACH,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tIContainer,\n\tIFluidCodeDetails,\n\tIFluidModule,\n\tIHostLoader,\n\tILoader,\n\tILoaderOptions,\n\tIProvideFluidCodeDetailsComparer,\n\tLoaderHeader,\n} from \"@fluidframework/container-definitions/internal\";\nimport {\n\tFluidObject,\n\tIConfigProviderBase,\n\tIRequest,\n\tITelemetryBaseLogger,\n} from \"@fluidframework/core-interfaces\";\nimport { IClientDetails } from \"@fluidframework/driver-definitions\";\nimport {\n\tIDocumentServiceFactory,\n\tIResolvedUrl,\n\tIUrlResolver,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tITelemetryLoggerExt,\n\tMonitoringContext,\n\tPerformanceEvent,\n\tcreateChildMonitoringContext,\n\tmixinMonitoringContext,\n\tsessionStorageConfigProvider,\n} from \"@fluidframework/telemetry-utils/internal\";\nimport { v4 as uuid } from \"uuid\";\n\nimport { Container } from \"./container.js\";\nimport { DebugLogger } from \"./debugLogger.js\";\nimport { pkgVersion } from \"./packageVersion.js\";\nimport { ProtocolHandlerBuilder } from \"./protocol.js\";\nimport type { IPendingContainerState } from \"./serializedStateManager.js\";\nimport {\n\tgetAttachedContainerStateFromSerializedContainer,\n\ttryParseCompatibleResolvedUrl,\n} from \"./utils.js\";\n\nfunction ensureResolvedUrlDefined(\n\tresolved: IResolvedUrl | undefined,\n): asserts resolved is IResolvedUrl {\n\tif (resolved === undefined) {\n\t\tthrow new Error(`Object is not a IResolveUrl.`);\n\t}\n}\n/**\n * @internal\n */\nexport class RelativeLoader implements ILoader {\n\tconstructor(\n\t\tprivate readonly container: Container,\n\t\tprivate readonly loader: ILoader | undefined,\n\t) {}\n\n\tpublic async resolve(request: IRequest): Promise<IContainer> {\n\t\tif (request.url.startsWith(\"/\")) {\n\t\t\tensureResolvedUrlDefined(this.container.resolvedUrl);\n\t\t\tconst container = await this.container.clone(\n\t\t\t\t{\n\t\t\t\t\tresolvedUrl: { ...this.container.resolvedUrl },\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\t\t\t\tversion: request.headers?.[LoaderHeader.version] ?? undefined,\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\t\t\t\tloadMode: request.headers?.[LoaderHeader.loadMode],\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\t\t\t\tcanReconnect: request.headers?.[LoaderHeader.reconnect],\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\t\t\t\tclientDetailsOverride: request.headers?.[LoaderHeader.clientDetails],\n\t\t\t\t},\n\t\t\t);\n\t\t\treturn container;\n\t\t}\n\n\t\tif (this.loader === undefined) {\n\t\t\tthrow new Error(\"Cannot resolve external containers\");\n\t\t}\n\t\treturn this.loader.resolve(request);\n\t}\n}\n\n/**\n * @deprecated IFluidModuleWithDetails interface is moved to\n * {@link @fluidframework/container-definitions#IFluidModuleWithDetails}\n * to have all the code loading modules in one package. #8193\n * Encapsulates a module entry point with corresponding code details.\n * @legacy\n * @alpha\n */\nexport interface IFluidModuleWithDetails {\n\t/**\n\t * Fluid code module that implements the runtime factory needed to instantiate the container runtime.\n\t */\n\tmodule: IFluidModule;\n\t/**\n\t * Code details associated with the module. Represents a document schema this module supports.\n\t * If the code loader implements the {@link @fluidframework/core-interfaces#IFluidCodeDetailsComparer} interface,\n\t * it'll be called to determine whether the module code details satisfy the new code proposal in the quorum.\n\t */\n\tdetails: IFluidCodeDetails;\n}\n\n/**\n * @deprecated ICodeDetailsLoader interface is moved to {@link @fluidframework/container-definitions#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 * @legacy\n * @alpha\n */\nexport interface ICodeDetailsLoader extends Partial<IProvideFluidCodeDetailsComparer> {\n\t/**\n\t * Load the code module (package) that is capable to interact with the document.\n\t *\n\t * @param source - Code proposal that articulates the current schema the document is written in.\n\t * @returns Code module entry point along with the code details associated with it.\n\t */\n\tload(source: IFluidCodeDetails): Promise<IFluidModuleWithDetails>;\n}\n\n/**\n * Services and properties necessary for creating a loader\n * @legacy\n * @alpha\n */\nexport interface ILoaderProps {\n\t/**\n\t * The url resolver used by the loader for resolving external urls\n\t * into Fluid urls such that the container specified by the\n\t * external url can be loaded.\n\t */\n\treadonly urlResolver: IUrlResolver;\n\t/**\n\t * The document service factory take the Fluid url provided\n\t * by the resolved url and constructs all the necessary services\n\t * for communication with the container's server.\n\t */\n\treadonly documentServiceFactory: IDocumentServiceFactory;\n\t/**\n\t * The code loader handles loading the necessary code\n\t * for running a container once it is loaded.\n\t */\n\treadonly codeLoader: ICodeDetailsLoader;\n\n\t/**\n\t * A property bag of options used by various layers\n\t * to control features\n\t */\n\treadonly options?: ILoaderOptions;\n\n\t/**\n\t * Scope is provided to all container and is a set of shared\n\t * services for container's to integrate with their host environment.\n\t */\n\treadonly scope?: FluidObject;\n\n\t/**\n\t * The logger that all telemetry should be pushed to.\n\t */\n\treadonly logger?: ITelemetryBaseLogger;\n\n\t/**\n\t * The configuration provider which may be used to control features.\n\t */\n\treadonly configProvider?: IConfigProviderBase;\n\n\t/**\n\t * Optional property for allowing the container to use a custom\n\t * protocol implementation for handling the quorum and/or the audience.\n\t */\n\treadonly protocolHandlerBuilder?: ProtocolHandlerBuilder;\n}\n\n/**\n * Services and properties used by and exposed by the loader\n * @legacy\n * @alpha\n */\nexport interface ILoaderServices {\n\t/**\n\t * The url resolver used by the loader for resolving external urls\n\t * into Fluid urls such that the container specified by the\n\t * external url can be loaded.\n\t */\n\treadonly urlResolver: IUrlResolver;\n\t/**\n\t * The document service factory take the Fluid url provided\n\t * by the resolved url and constructs all the necessary services\n\t * for communication with the container's server.\n\t */\n\treadonly documentServiceFactory: IDocumentServiceFactory;\n\t/**\n\t * The code loader handles loading the necessary code\n\t * for running a container once it is loaded.\n\t */\n\treadonly codeLoader: ICodeDetailsLoader;\n\n\t/**\n\t * A property bag of options used by various layers\n\t * to control features\n\t */\n\treadonly options: ILoaderOptions;\n\n\t/**\n\t * Scope is provided to all container and is a set of shared\n\t * services for container's to integrate with their host environment.\n\t */\n\treadonly scope: FluidObject;\n\n\t/**\n\t * The logger downstream consumers should construct their loggers from\n\t */\n\treadonly subLogger: ITelemetryLoggerExt;\n\n\t/**\n\t * Optional property for allowing the container to use a custom\n\t * protocol implementation for handling the quorum and/or the audience.\n\t */\n\treadonly protocolHandlerBuilder?: ProtocolHandlerBuilder;\n}\n\n/**\n * Manages Fluid resource loading\n * @legacy\n * @alpha\n *\n * @remarks The Loader class is deprecated and will be removed in a future release. Use the free-form functions instead (See issue #24450 for more details).\n */\nexport class Loader implements IHostLoader {\n\tpublic readonly services: ILoaderServices;\n\tprivate readonly mc: MonitoringContext;\n\n\tconstructor(loaderProps: ILoaderProps) {\n\t\tconst {\n\t\t\turlResolver,\n\t\t\tdocumentServiceFactory,\n\t\t\tcodeLoader,\n\t\t\toptions,\n\t\t\tscope,\n\t\t\tlogger,\n\t\t\tconfigProvider,\n\t\t\tprotocolHandlerBuilder,\n\t\t} = loaderProps;\n\n\t\tconst telemetryProps = {\n\t\t\tloaderId: uuid(),\n\t\t\tloaderVersion: pkgVersion,\n\t\t};\n\n\t\tconst subMc = mixinMonitoringContext(\n\t\t\tDebugLogger.mixinDebugLogger(\"fluid:telemetry\", logger, {\n\t\t\t\tall: telemetryProps,\n\t\t\t}),\n\t\t\tsessionStorageConfigProvider.value,\n\t\t\tconfigProvider,\n\t\t);\n\n\t\tthis.services = {\n\t\t\turlResolver,\n\t\t\tdocumentServiceFactory,\n\t\t\tcodeLoader,\n\t\t\toptions: options ?? {},\n\t\t\tscope:\n\t\t\t\toptions?.provideScopeLoader === false ? { ...scope } : { ...scope, ILoader: this },\n\t\t\tprotocolHandlerBuilder,\n\t\t\tsubLogger: subMc.logger,\n\t\t};\n\t\tthis.mc = createChildMonitoringContext({\n\t\t\tlogger: this.services.subLogger,\n\t\t\tnamespace: \"Loader\",\n\t\t});\n\t}\n\n\tpublic async createDetachedContainer(\n\t\tcodeDetails: IFluidCodeDetails,\n\t\tcreateDetachedProps?: {\n\t\t\tcanReconnect?: boolean;\n\t\t\tclientDetailsOverride?: IClientDetails;\n\t\t},\n\t): Promise<IContainer> {\n\t\treturn Container.createDetached(\n\t\t\t{\n\t\t\t\t...createDetachedProps,\n\t\t\t\t...this.services,\n\t\t\t},\n\t\t\tcodeDetails,\n\t\t);\n\t}\n\n\tpublic async rehydrateDetachedContainerFromSnapshot(\n\t\tsnapshot: string,\n\t\tcreateDetachedProps?: {\n\t\t\tcanReconnect?: boolean;\n\t\t\tclientDetailsOverride?: IClientDetails;\n\t\t},\n\t): Promise<IContainer> {\n\t\treturn Container.rehydrateDetachedFromSnapshot(\n\t\t\t{\n\t\t\t\t...createDetachedProps,\n\t\t\t\t...this.services,\n\t\t\t},\n\t\t\tsnapshot,\n\t\t);\n\t}\n\n\tpublic async resolve(request: IRequest, pendingLocalState?: string): Promise<IContainer> {\n\t\tconst eventName = pendingLocalState === undefined ? \"Resolve\" : \"ResolveWithPendingState\";\n\t\treturn PerformanceEvent.timedExecAsync(this.mc.logger, { eventName }, async () => {\n\t\t\treturn this.resolveCore(\n\t\t\t\trequest,\n\t\t\t\tgetAttachedContainerStateFromSerializedContainer(pendingLocalState),\n\t\t\t);\n\t\t});\n\t}\n\n\tprivate async resolveCore(\n\t\trequest: IRequest,\n\t\tpendingLocalState?: IPendingContainerState,\n\t): Promise<Container> {\n\t\tconst resolvedAsFluid = await this.services.urlResolver.resolve(request);\n\t\tensureResolvedUrlDefined(resolvedAsFluid);\n\n\t\t// Parse URL into data stores\n\t\tconst parsed = tryParseCompatibleResolvedUrl(resolvedAsFluid.url);\n\t\tif (parsed === undefined) {\n\t\t\tthrow new Error(`Invalid URL ${resolvedAsFluid.url}`);\n\t\t}\n\n\t\tif (pendingLocalState !== undefined) {\n\t\t\tconst parsedPendingUrl = tryParseCompatibleResolvedUrl(pendingLocalState.url);\n\t\t\tif (\n\t\t\t\tparsedPendingUrl?.id !== parsed.id ||\n\t\t\t\tparsedPendingUrl?.path.replace(/\\/$/, \"\") !== parsed.path.replace(/\\/$/, \"\")\n\t\t\t) {\n\t\t\t\tconst message = `URL ${resolvedAsFluid.url} does not match pending state URL ${pendingLocalState.url}`;\n\t\t\t\tthrow new Error(message);\n\t\t\t}\n\t\t}\n\n\t\trequest.headers ??= {};\n\t\t// If set in both query string and headers, use query string. Also write the value from the query string into the header either way.\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\trequest.headers[LoaderHeader.version] =\n\t\t\tparsed.version ?? request.headers[LoaderHeader.version];\n\n\t\treturn this.loadContainer(request, resolvedAsFluid, pendingLocalState);\n\t}\n\n\tprivate async loadContainer(\n\t\trequest: IRequest,\n\t\tresolvedUrl: IResolvedUrl,\n\t\tpendingLocalState?: IPendingContainerState,\n\t): Promise<Container> {\n\t\treturn Container.load(\n\t\t\t{\n\t\t\t\tresolvedUrl,\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\t\t\tversion: request.headers?.[LoaderHeader.version] ?? undefined,\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\t\t\tloadMode: request.headers?.[LoaderHeader.loadMode],\n\t\t\t\tpendingLocalState,\n\t\t\t},\n\t\t\t{\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\t\t\tcanReconnect: request.headers?.[LoaderHeader.reconnect],\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\t\t\tclientDetailsOverride: request.headers?.[LoaderHeader.clientDetails],\n\t\t\t\t...this.services,\n\t\t\t},\n\t\t);\n\t}\n}\n"]}
@@ -2,8 +2,34 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import type { IDetachedBlobStorage } from "./loader.js";
6
- export declare function serializeMemoryDetachedBlobStorage(detachedStorage: IDetachedBlobStorage | undefined): string | undefined;
7
- export declare function tryInitializeMemoryDetachedBlobStorage(detachedStorage: IDetachedBlobStorage | undefined, attachmentBlobs: string): void;
8
- export declare function createMemoryDetachedBlobStorage(): IDetachedBlobStorage;
5
+ import type { IDocumentStorageService } from "@fluidframework/driver-definitions/internal";
6
+ /**
7
+ * An interface used to manage blobs in memory for detached containers.
8
+ *
9
+ * @remarks
10
+ * On attach of the container the blobs are read, and uploaded to the server.
11
+ * The interface also supports serialization and initialization which is
12
+ * used when serializing and rehydrating a detached container with blobs.
13
+ */
14
+ export interface MemoryDetachedBlobStorage extends Pick<IDocumentStorageService, "createBlob" | "readBlob"> {
15
+ size: number;
16
+ /**
17
+ * Return an array of all blob IDs present in storage
18
+ */
19
+ getBlobIds(): string[];
20
+ /**
21
+ * After the container is attached, the detached blob storage is no longer needed and will be disposed.
22
+ */
23
+ dispose?(): void;
24
+ initialize(attachmentBlobs: string[]): void;
25
+ serialize(): string | undefined;
26
+ }
27
+ export declare function tryInitializeMemoryDetachedBlobStorage(detachedStorage: MemoryDetachedBlobStorage, attachmentBlobs: string): void;
28
+ /**
29
+ * Creates a new instance of `MemoryDetachedBlobStorage`.
30
+ * The returned storage allows for creating, reading, and managing blobs in memory.
31
+ * It also provides methods for serialization and initialization with attachment blobs.
32
+ * @returns A new `MemoryDetachedBlobStorage` instance.
33
+ */
34
+ export declare function createMemoryDetachedBlobStorage(): MemoryDetachedBlobStorage;
9
35
  //# sourceMappingURL=memoryBlobStorage.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"memoryBlobStorage.d.ts","sourceRoot":"","sources":["../src/memoryBlobStorage.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAuBxD,wBAAgB,kCAAkC,CAEjD,eAAe,EAAE,oBAAoB,GAAG,SAAS,GAC/C,MAAM,GAAG,SAAS,CAQpB;AAED,wBAAgB,sCAAsC,CAErD,eAAe,EAAE,oBAAoB,GAAG,SAAS,EACjD,eAAe,EAAE,MAAM,GACrB,IAAI,CAcN;AAGD,wBAAgB,+BAA+B,IAAI,oBAAoB,CAmBtE"}
1
+ {"version":3,"file":"memoryBlobStorage.d.ts","sourceRoot":"","sources":["../src/memoryBlobStorage.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAEX,uBAAuB,EACvB,MAAM,6CAA6C,CAAC;AAErD;;;;;;;GAOG;AACH,MAAM,WAAW,yBAChB,SAAQ,IAAI,CAAC,uBAAuB,EAAE,YAAY,GAAG,UAAU,CAAC;IAChE,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,UAAU,IAAI,MAAM,EAAE,CAAC;IAEvB;;OAEG;IACH,OAAO,CAAC,IAAI,IAAI,CAAC;IACjB,UAAU,CAAC,eAAe,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAC5C,SAAS,IAAI,MAAM,GAAG,SAAS,CAAC;CAChC;AAED,wBAAgB,sCAAsC,CACrD,eAAe,EAAE,yBAAyB,EAC1C,eAAe,EAAE,MAAM,GACrB,IAAI,CAQN;AAED;;;;;GAKG;AAEH,wBAAgB,+BAA+B,IAAI,yBAAyB,CAqB3E"}
@@ -3,31 +3,8 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { bufferToString, stringToBuffer } from "@fluid-internal/client-utils";
6
- import { assert, isObject } from "@fluidframework/core-utils/internal";
7
- const MemoryDetachedBlobStorageIdentifier = Symbol();
8
- function isMemoryDetachedBlobStorage(
9
- // eslint-disable-next-line import/no-deprecated
10
- detachedStorage) {
11
- return (isObject(detachedStorage) &&
12
- MemoryDetachedBlobStorageIdentifier in detachedStorage &&
13
- detachedStorage[MemoryDetachedBlobStorageIdentifier] ===
14
- MemoryDetachedBlobStorageIdentifier);
15
- }
16
- export function serializeMemoryDetachedBlobStorage(
17
- // eslint-disable-next-line import/no-deprecated
18
- detachedStorage) {
19
- if (detachedStorage !== undefined &&
20
- detachedStorage.size > 0 &&
21
- isMemoryDetachedBlobStorage(detachedStorage)) {
22
- return detachedStorage.serialize();
23
- }
24
- }
25
- export function tryInitializeMemoryDetachedBlobStorage(
26
- // eslint-disable-next-line import/no-deprecated
27
- detachedStorage, attachmentBlobs) {
28
- if (!isMemoryDetachedBlobStorage(detachedStorage)) {
29
- throw new Error("DetachedBlobStorage was not provided to the loader during serialize so cannot be provided during rehydrate.");
30
- }
6
+ import { assert } from "@fluidframework/core-utils/internal";
7
+ export function tryInitializeMemoryDetachedBlobStorage(detachedStorage, attachmentBlobs) {
31
8
  assert(detachedStorage.size === 0, 0x99e /* Blob storage already initialized */);
32
9
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
33
10
  const maybeAttachmentBlobs = JSON.parse(attachmentBlobs);
@@ -35,11 +12,16 @@ detachedStorage, attachmentBlobs) {
35
12
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
36
13
  detachedStorage.initialize(maybeAttachmentBlobs);
37
14
  }
15
+ /**
16
+ * Creates a new instance of `MemoryDetachedBlobStorage`.
17
+ * The returned storage allows for creating, reading, and managing blobs in memory.
18
+ * It also provides methods for serialization and initialization with attachment blobs.
19
+ * @returns A new `MemoryDetachedBlobStorage` instance.
20
+ */
38
21
  // eslint-disable-next-line import/no-deprecated
39
22
  export function createMemoryDetachedBlobStorage() {
40
23
  const blobs = [];
41
24
  const storage = {
42
- [MemoryDetachedBlobStorageIdentifier]: MemoryDetachedBlobStorageIdentifier,
43
25
  createBlob: async (file) => ({
44
26
  id: `${blobs.push(file) - 1}`,
45
27
  }),
@@ -49,7 +31,9 @@ export function createMemoryDetachedBlobStorage() {
49
31
  },
50
32
  getBlobIds: () => blobs.map((_, i) => `${i}`),
51
33
  dispose: () => blobs.splice(0),
52
- serialize: () => JSON.stringify(blobs.map((b) => bufferToString(b, "utf8"))),
34
+ serialize: () => blobs.length > 0
35
+ ? JSON.stringify(blobs.map((b) => bufferToString(b, "utf8")))
36
+ : undefined,
53
37
  initialize: (attachmentBlobs) => blobs.push(...attachmentBlobs.map((maybeBlob) => stringToBuffer(maybeBlob, "utf8"))),
54
38
  };
55
39
  return storage;
@@ -1 +1 @@
1
- {"version":3,"file":"memoryBlobStorage.js","sourceRoot":"","sources":["../src/memoryBlobStorage.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,qCAAqC,CAAC;AAMvE,MAAM,mCAAmC,GAAG,MAAM,EAAE,CAAC;AAS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AC7B,CAAC;QACF,QAAQ,EAAE,KAAK,EAAE,EAAU,EAA4B,EAAE,CACxD,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,mBAAmB,EAAE,EAAE,CAAC,CAAC;QACxE,IAAI,IAAI;YACP,OAAO,KAAK,CAAC,MAAM,CAAC;QACrB,CAAC;QACD,UAAU,EAAE,GAAa,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC;QACvD,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;QAC9B,SAAS,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,cAAc,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;QAC5E,UAAU,EAAE,CAAC,eAAyB,EAAE,EAAE,CACzC,KAAK,CAAC,IAAI,CAAC,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,cAAc,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;KACrF,CAAC;IACF,OAAO,OAAO,CAAC;AAChB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { bufferToString, stringToBuffer } from \"@fluid-internal/client-utils\";\nimport { assert, isObject } from \"@fluidframework/core-utils/internal\";\nimport type { ICreateBlobResponse } from \"@fluidframework/driver-definitions/internal\";\n\n// eslint-disable-next-line import/no-deprecated\nimport type { IDetachedBlobStorage } from \"./loader.js\";\n\nconst MemoryDetachedBlobStorageIdentifier = Symbol();\n\n// eslint-disable-next-line import/no-deprecated\ninterface MemoryDetachedBlobStorage extends IDetachedBlobStorage {\n\t[MemoryDetachedBlobStorageIdentifier]: typeof MemoryDetachedBlobStorageIdentifier;\n\tinitialize(attachmentBlobs: string[]): void;\n\tserialize(): string | undefined;\n}\n\nfunction isMemoryDetachedBlobStorage(\n\t// eslint-disable-next-line import/no-deprecated\n\tdetachedStorage: IDetachedBlobStorage | undefined,\n): detachedStorage is MemoryDetachedBlobStorage {\n\treturn (\n\t\tisObject(detachedStorage) &&\n\t\tMemoryDetachedBlobStorageIdentifier in detachedStorage &&\n\t\tdetachedStorage[MemoryDetachedBlobStorageIdentifier] ===\n\t\t\tMemoryDetachedBlobStorageIdentifier\n\t);\n}\n\nexport function serializeMemoryDetachedBlobStorage(\n\t// eslint-disable-next-line import/no-deprecated\n\tdetachedStorage: IDetachedBlobStorage | undefined,\n): string | undefined {\n\tif (\n\t\tdetachedStorage !== undefined &&\n\t\tdetachedStorage.size > 0 &&\n\t\tisMemoryDetachedBlobStorage(detachedStorage)\n\t) {\n\t\treturn detachedStorage.serialize();\n\t}\n}\n\nexport function tryInitializeMemoryDetachedBlobStorage(\n\t// eslint-disable-next-line import/no-deprecated\n\tdetachedStorage: IDetachedBlobStorage | undefined,\n\tattachmentBlobs: string,\n): void {\n\tif (!isMemoryDetachedBlobStorage(detachedStorage)) {\n\t\tthrow new Error(\n\t\t\t\"DetachedBlobStorage was not provided to the loader during serialize so cannot be provided during rehydrate.\",\n\t\t);\n\t}\n\n\tassert(detachedStorage.size === 0, 0x99e /* Blob storage already initialized */);\n\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\tconst maybeAttachmentBlobs = JSON.parse(attachmentBlobs);\n\tassert(Array.isArray(maybeAttachmentBlobs), 0x99f /* Invalid attachmentBlobs */);\n\n\t// eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n\tdetachedStorage.initialize(maybeAttachmentBlobs);\n}\n\n// eslint-disable-next-line import/no-deprecated\nexport function createMemoryDetachedBlobStorage(): IDetachedBlobStorage {\n\tconst blobs: ArrayBufferLike[] = [];\n\tconst storage: MemoryDetachedBlobStorage = {\n\t\t[MemoryDetachedBlobStorageIdentifier]: MemoryDetachedBlobStorageIdentifier,\n\t\tcreateBlob: async (file: ArrayBufferLike): Promise<ICreateBlobResponse> => ({\n\t\t\tid: `${blobs.push(file) - 1}`,\n\t\t}),\n\t\treadBlob: async (id: string): Promise<ArrayBufferLike> =>\n\t\t\tblobs[Number(id)] ?? Promise.reject(new Error(`Blob not found: ${id}`)),\n\t\tget size() {\n\t\t\treturn blobs.length;\n\t\t},\n\t\tgetBlobIds: (): string[] => blobs.map((_, i) => `${i}`),\n\t\tdispose: () => blobs.splice(0),\n\t\tserialize: () => JSON.stringify(blobs.map((b) => bufferToString(b, \"utf8\"))),\n\t\tinitialize: (attachmentBlobs: string[]) =>\n\t\t\tblobs.push(...attachmentBlobs.map((maybeBlob) => stringToBuffer(maybeBlob, \"utf8\"))),\n\t};\n\treturn storage;\n}\n"]}
1
+ {"version":3,"file":"memoryBlobStorage.js","sourceRoot":"","sources":["../src/memoryBlobStorage.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AA8B7D,MAAM,UAAU,sCAAsC,CACrD,eAA0C,EAC1C,eAAuB;IAEvB,MAAM,CAAC,eAAe,CAAC,IAAI,KAAK,CAAC,EAAE,KAAK,CAAC,sCAAsC,CAAC,CAAC;IACjF,mEAAmE;IACnE,MAAM,oBAAoB,GAAG,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;IACzD,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,oBAAoB,CAAC,EAAE,KAAK,CAAC,6BAA6B,CAAC,CAAC;IAEjF,iEAAiE;IACjE,eAAe,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;AAClD,CAAC;AAED;;;;;GAKG;AACH,gDAAgD;AAChD,MAAM,UAAU,+BAA+B;IAC9C,MAAM,KAAK,GAAsB,EAAE,CAAC;IACpC,MAAM,OAAO,GAA8B;QAC1C,UAAU,EAAE,KAAK,EAAE,IAAqB,EAAgC,EAAE,CAAC,CAAC;YAC3E,EAAE,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;SAC7B,CAAC;QACF,QAAQ,EAAE,KAAK,EAAE,EAAU,EAA4B,EAAE,CACxD,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,mBAAmB,EAAE,EAAE,CAAC,CAAC;QACxE,IAAI,IAAI;YACP,OAAO,KAAK,CAAC,MAAM,CAAC;QACrB,CAAC;QACD,UAAU,EAAE,GAAa,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC;QACvD,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;QAC9B,SAAS,EAAE,GAAG,EAAE,CACf,KAAK,CAAC,MAAM,GAAG,CAAC;YACf,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,cAAc,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;YAC7D,CAAC,CAAC,SAAS;QACb,UAAU,EAAE,CAAC,eAAyB,EAAE,EAAE,CACzC,KAAK,CAAC,IAAI,CAAC,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,cAAc,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;KACrF,CAAC;IACF,OAAO,OAAO,CAAC;AAChB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { bufferToString, stringToBuffer } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type {\n\tICreateBlobResponse,\n\tIDocumentStorageService,\n} from \"@fluidframework/driver-definitions/internal\";\n\n/**\n * An interface used to manage blobs in memory for detached containers.\n *\n * @remarks\n * On attach of the container the blobs are read, and uploaded to the server.\n * The interface also supports serialization and initialization which is\n * used when serializing and rehydrating a detached container with blobs.\n */\nexport interface MemoryDetachedBlobStorage\n\textends Pick<IDocumentStorageService, \"createBlob\" | \"readBlob\"> {\n\tsize: number;\n\t/**\n\t * Return an array of all blob IDs present in storage\n\t */\n\tgetBlobIds(): string[];\n\n\t/**\n\t * After the container is attached, the detached blob storage is no longer needed and will be disposed.\n\t */\n\tdispose?(): void;\n\tinitialize(attachmentBlobs: string[]): void;\n\tserialize(): string | undefined;\n}\n\nexport function tryInitializeMemoryDetachedBlobStorage(\n\tdetachedStorage: MemoryDetachedBlobStorage,\n\tattachmentBlobs: string,\n): void {\n\tassert(detachedStorage.size === 0, 0x99e /* Blob storage already initialized */);\n\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\tconst maybeAttachmentBlobs = JSON.parse(attachmentBlobs);\n\tassert(Array.isArray(maybeAttachmentBlobs), 0x99f /* Invalid attachmentBlobs */);\n\n\t// eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n\tdetachedStorage.initialize(maybeAttachmentBlobs);\n}\n\n/**\n * Creates a new instance of `MemoryDetachedBlobStorage`.\n * The returned storage allows for creating, reading, and managing blobs in memory.\n * It also provides methods for serialization and initialization with attachment blobs.\n * @returns A new `MemoryDetachedBlobStorage` instance.\n */\n// eslint-disable-next-line import/no-deprecated\nexport function createMemoryDetachedBlobStorage(): MemoryDetachedBlobStorage {\n\tconst blobs: ArrayBufferLike[] = [];\n\tconst storage: MemoryDetachedBlobStorage = {\n\t\tcreateBlob: async (file: ArrayBufferLike): Promise<ICreateBlobResponse> => ({\n\t\t\tid: `${blobs.push(file) - 1}`,\n\t\t}),\n\t\treadBlob: async (id: string): Promise<ArrayBufferLike> =>\n\t\t\tblobs[Number(id)] ?? Promise.reject(new Error(`Blob not found: ${id}`)),\n\t\tget size() {\n\t\t\treturn blobs.length;\n\t\t},\n\t\tgetBlobIds: (): string[] => blobs.map((_, i) => `${i}`),\n\t\tdispose: () => blobs.splice(0),\n\t\tserialize: () =>\n\t\t\tblobs.length > 0\n\t\t\t\t? JSON.stringify(blobs.map((b) => bufferToString(b, \"utf8\")))\n\t\t\t\t: undefined,\n\t\tinitialize: (attachmentBlobs: string[]) =>\n\t\t\tblobs.push(...attachmentBlobs.map((maybeBlob) => stringToBuffer(maybeBlob, \"utf8\"))),\n\t};\n\treturn storage;\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 = "2.33.2";
8
+ export declare const pkgVersion = "2.40.0";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export const pkgName = "@fluidframework/container-loader";
8
- export const pkgVersion = "2.33.2";
8
+ export const pkgVersion = "2.40.0";
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,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/container-loader\";\nexport const pkgVersion = \"2.33.2\";\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,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/container-loader\";\nexport const pkgVersion = \"2.40.0\";\n"]}