@fluidframework/driver-utils 0.56.3 → 0.57.0-51086

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 (68) hide show
  1. package/dist/blobAggregationStorage.js.map +1 -1
  2. package/dist/index.d.ts +1 -0
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +1 -0
  5. package/dist/index.js.map +1 -1
  6. package/dist/multiDocumentServiceFactory.d.ts.map +1 -1
  7. package/dist/multiDocumentServiceFactory.js +0 -2
  8. package/dist/multiDocumentServiceFactory.js.map +1 -1
  9. package/dist/network.d.ts +31 -9
  10. package/dist/network.d.ts.map +1 -1
  11. package/dist/network.js +7 -9
  12. package/dist/network.js.map +1 -1
  13. package/dist/networkUtils.d.ts.map +1 -1
  14. package/dist/networkUtils.js +0 -2
  15. package/dist/networkUtils.js.map +1 -1
  16. package/dist/packageVersion.d.ts +1 -1
  17. package/dist/packageVersion.d.ts.map +1 -1
  18. package/dist/packageVersion.js +1 -1
  19. package/dist/packageVersion.js.map +1 -1
  20. package/dist/parallelRequests.d.ts.map +1 -1
  21. package/dist/parallelRequests.js +4 -1
  22. package/dist/parallelRequests.js.map +1 -1
  23. package/dist/prefetchDocumentStorageService.d.ts.map +1 -1
  24. package/dist/prefetchDocumentStorageService.js +0 -1
  25. package/dist/prefetchDocumentStorageService.js.map +1 -1
  26. package/dist/treeConversions.d.ts +11 -0
  27. package/dist/treeConversions.d.ts.map +1 -0
  28. package/dist/treeConversions.js +66 -0
  29. package/dist/treeConversions.js.map +1 -0
  30. package/lib/blobAggregationStorage.js.map +1 -1
  31. package/lib/index.d.ts +1 -0
  32. package/lib/index.d.ts.map +1 -1
  33. package/lib/index.js +1 -0
  34. package/lib/index.js.map +1 -1
  35. package/lib/multiDocumentServiceFactory.d.ts.map +1 -1
  36. package/lib/multiDocumentServiceFactory.js +0 -2
  37. package/lib/multiDocumentServiceFactory.js.map +1 -1
  38. package/lib/network.d.ts +31 -9
  39. package/lib/network.d.ts.map +1 -1
  40. package/lib/network.js +7 -9
  41. package/lib/network.js.map +1 -1
  42. package/lib/networkUtils.d.ts.map +1 -1
  43. package/lib/networkUtils.js +0 -2
  44. package/lib/networkUtils.js.map +1 -1
  45. package/lib/packageVersion.d.ts +1 -1
  46. package/lib/packageVersion.d.ts.map +1 -1
  47. package/lib/packageVersion.js +1 -1
  48. package/lib/packageVersion.js.map +1 -1
  49. package/lib/parallelRequests.d.ts.map +1 -1
  50. package/lib/parallelRequests.js +4 -1
  51. package/lib/parallelRequests.js.map +1 -1
  52. package/lib/prefetchDocumentStorageService.d.ts.map +1 -1
  53. package/lib/prefetchDocumentStorageService.js +0 -1
  54. package/lib/prefetchDocumentStorageService.js.map +1 -1
  55. package/lib/treeConversions.d.ts +11 -0
  56. package/lib/treeConversions.d.ts.map +1 -0
  57. package/lib/treeConversions.js +62 -0
  58. package/lib/treeConversions.js.map +1 -0
  59. package/package.json +5 -5
  60. package/src/blobAggregationStorage.ts +2 -2
  61. package/src/index.ts +1 -0
  62. package/src/multiDocumentServiceFactory.ts +0 -2
  63. package/src/network.ts +35 -18
  64. package/src/networkUtils.ts +0 -3
  65. package/src/packageVersion.ts +1 -1
  66. package/src/parallelRequests.ts +4 -2
  67. package/src/prefetchDocumentStorageService.ts +0 -1
  68. package/src/treeConversions.ts +86 -0
@@ -1 +1 @@
1
- {"version":3,"file":"blobAggregationStorage.js","sourceRoot":"","sources":["../src/blobAggregationStorage.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAOH,+EAQ8C;AAC9C,+DAOuC;AAEvC,qEAA4E;AAE5E;;;EAGE;AACF,SAAS,eAAe,CAAC,IAAqB,EAAE,QAA4B;IACxE,IAAI,IAAI,YAAY,UAAU,EAAE,EAAE,8DAA8D;QAC5F,OAAO,iCAAkB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;KAC7C;IACD,OAAO,6BAAc,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AAC1C,CAA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AI,CAAC,kBAAkB,CAAC,KAAK,SAAS,EAAE,KAAK,CAAC,gCAAgC,CAAC,CAAC;QACvG,IAAI,cAAc,EAAE;YAChB,yFAAyF;YACzF,4FAA4F;YAC5F,qGAAqG;YACrG,iEAAiE;YACjE,+CAA+C;YAC/C,qBAAM,CAAC,UAAU,KAAK,SAAS,EAAE,KAAK,CAAC,mBAAmB,CAAC,CAAC;YAC5D,MAAM,OAAO,GAAG,UAAU,CAAC,wBAAwB,EAAE,CAAC;YACtD,IAAI,OAAO,KAAK,SAAS,EAAE;gBACvB,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,GAAG;oBACvC,IAAI,EAAE,kCAAW,CAAC,IAAI;oBACtB,OAAO;iBACV,CAAC;aACL;SACJ;QACD,OAAO,UAAU,CAAC;IACtB,CAAC;IAES,eAAe,CAAC,EAAU;QAChC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAChD,CAAC;;AAzOL,wDA0OC;AAzOG,4FAA4F;AAC5F,8BAA8B;AAC9B,uGAAuG;AACvG,yGAAyG;AACzG,4FAA4F;AAC5F,qGAAqG;AACrG,oGAAoG;AACpG,mCAAmC;AACnC,yGAAyG;AACzG,mFAAmF;AACnE,6CAAsB,GAAG,IAAI,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n IDocumentStorageService,\n IDocumentStorageServicePolicies,\n ISummaryContext,\n} from \"@fluidframework/driver-definitions\";\nimport {\n ICreateBlobResponse,\n ISnapshotTree,\n ISummaryHandle,\n ISummaryTree,\n IVersion,\n SummaryType,\n ITree,\n} from \"@fluidframework/protocol-definitions\";\nimport {\n assert,\n bufferToString,\n stringToBuffer,\n unreachableCase,\n fromUtf8ToBase64,\n Uint8ArrayToString,\n } from \"@fluidframework/common-utils\";\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { loggerToMonitoringContext } from \"@fluidframework/telemetry-utils\";\n\n/*\n * Work around for bufferToString having a bug - it can't consume IsoBuffer!\n * To be removed once bufferToString is fixed!\n*/\nfunction bufferToString2(blob: ArrayBufferLike, encoding: \"utf-8\" | \"base64\"): string {\n if (blob instanceof Uint8Array) { // IsoBuffer does not have ctor, so it's not in proto chain :(\n return Uint8ArrayToString(blob, encoding);\n }\n return bufferToString(blob, encoding);\n}\n\n /**\n * Class responsible for aggregating smaller blobs into one and unpacking it later on.\n */\nclass BlobAggregator {\n private readonly content: [string, string][]= [];\n\n public addBlob(key: string, content: string) {\n this.content.push([key, content]);\n }\n\n public getAggregatedBlobContent() {\n if (this.content.length === 0) {\n return undefined;\n }\n return JSON.stringify(this.content);\n }\n\n static load(input: ArrayBufferLike) {\n const data = bufferToString2(input, \"utf-8\");\n return JSON.parse(data) as [string, string][];\n }\n}\n\n/*\n * Base class that deals with unpacking snapshots (in place) containing aggregated blobs\n * It relies on abstract methods for reads and storing unpacked blobs.\n */\nexport abstract class SnapshotExtractor {\n protected readonly aggregatedBlobName = \"__big\";\n protected readonly virtualIdPrefix = \"__\";\n\n // counter for generation of virtual storage IDs\n protected virtualIdCounter = 0;\n protected getNextVirtualId() {\n return `${this.virtualIdPrefix}${++this.virtualIdCounter}`;\n }\n\n abstract getBlob(id: string, tree: ISnapshotTree): Promise<ArrayBufferLike>;\n abstract setBlob(id: string, tree: ISnapshotTree, content: string);\n\n public async unpackSnapshotCore(snapshot: ISnapshotTree, level = 0): Promise<void> {\n for (const key of Object.keys(snapshot.trees)) {\n const obj = snapshot.trees[key];\n await this.unpackSnapshotCore(obj, level + 1);\n }\n\n // For future proof, we will support multiple aggregated blobs with any name\n // that starts with this.aggregatedBlobName\n for (const key of Object.keys(snapshot.blobs)) {\n if (!key.startsWith(this.aggregatedBlobName)) { continue; }\n const blobId = snapshot.blobs[key];\n if (blobId !== undefined) {\n const blob = await this.getBlob(blobId, snapshot);\n for (const [path, value] of BlobAggregator.load(blob)) {\n const id = this.getNextVirtualId();\n this.setBlob(id, snapshot, value);\n const pathSplit = path.split(\"/\");\n let subTree = snapshot;\n for (const subPath of pathSplit.slice(0, pathSplit.length - 1)) {\n if (subTree.trees[subPath] === undefined) {\n subTree.trees[subPath] = { blobs: {}, commits: {}, trees: {}};\n }\n subTree = subTree.trees[subPath];\n }\n const blobName = pathSplit[pathSplit.length - 1];\n assert(subTree.blobs[blobName] === undefined, 0x0f6 /* \"real blob ID exists\" */);\n subTree.blobs[blobName] = id;\n }\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete snapshot.blobs[this.aggregatedBlobName];\n }\n }\n }\n}\n\n/*\n * Snapshot extractor class that works in place, i.e. patches snapshot that has\n * blob content in ISnapshotTree.blobs itself, not in storage.\n * As result, it implements reading and writing of blobs to/from snapshot itself.\n * It follows existing pattern that mixes concerns - ISnapshotTree.blobs is used for two\n * purposes:\n * 1. map path name to blob ID\n * 2. map blob ID to blob content\n * #2 is what storage (IDocumentStorageService) is for, but in places where we do not have it\n * (like loading serialized earlier draft content), blob content is put directly into snapshot.\n * Ideally this should be fixed by using BlobCacheStorageService or something similar and\n * fixing existing flows to allow switching of storage.\n */\nclass SnapshotExtractorInPlace extends SnapshotExtractor {\n public async getBlob(id: string, tree: ISnapshotTree): Promise<ArrayBufferLike> {\n const blob = tree.blobs[id];\n assert(blob !== undefined, 0x0f7 /* \"aggregate blob missing\" */);\n return stringToBuffer(blob, \"base64\");\n }\n\n public setBlob(id: string, tree: ISnapshotTree, content: string) {\n assert(tree.blobs[id] === undefined, 0x0f8 /* \"blob from aggregate blob exists on its own\" */);\n tree.blobs[id] = fromUtf8ToBase64(content);\n }\n}\n\n/*\n * Snapshot packer and extractor.\n * When summary is written it will find and aggregate small blobs into bigger blobs\n * When snapshot is read, it will unpack aggregated blobs and provide them transparently to caller.\n */\nexport class BlobAggregationStorage extends SnapshotExtractor implements IDocumentStorageService {\n // Tells data store if it can use incremental summary (i.e. reuse DDSs from previous summary\n // when only one DDS changed).\n // The answer has to be know long before we enable actual packing. The reason for the is the following:\n // A the moment when we enable packing, we should assume that all clients out there wil already have bits\n // that can unpack properly (i.e. enough time passed since we deployed bits that can unpack)\n // But we can still have clients where some of them already pack, and some do not. If one summary was\n // using packing, then it relies on non-incremental summaries going forward, even if next client who\n // produced summary is not packing!\n // This can have slight improvement by enabling it per file (based on \"did summary we loaded from contain\n // aggregated blobs\"), but that's harder to make reliable, so going for simplicity.\n static readonly fullDataStoreSummaries = true;\n\n protected loadedFromSummary = false;\n\n protected virtualBlobs = new Map<string, ArrayBufferLike>();\n\n static wrap(\n storage: IDocumentStorageService,\n logger: ITelemetryLogger,\n allowPacking?: boolean,\n packingLevel = 2,\n ) {\n if (storage instanceof BlobAggregationStorage) {\n return storage;\n }\n const mc = loggerToMonitoringContext(logger);\n const realAllowPackaging = mc.config.getBoolean(\"FluidAggregateBlobs\") ?? allowPacking ?? false;\n\n // Always create BlobAggregationStorage even if storage is not asking for packing.\n // This is mostly to avoid cases where future changes in policy would result in inability to\n // load old files that were created with aggregation on.\n const minBlobSize = storage.policies?.minBlobSize;\n return new BlobAggregationStorage(storage, logger, realAllowPackaging, packingLevel, minBlobSize);\n }\n\n static async unpackSnapshot(snapshot: ISnapshotTree) {\n const converter = new SnapshotExtractorInPlace();\n await converter.unpackSnapshotCore(snapshot);\n }\n\n public get policies(): IDocumentStorageServicePolicies | undefined {\n const policies = this.storage.policies;\n if (policies) {\n return { ...policies, minBlobSize: undefined };\n }\n }\n\n public async unpackSnapshot(snapshot: ISnapshotTree) {\n // SummarizerNodeWithGC.refreshLatestSummary can call it when this.loadedFromSummary === false\n // (I assumed after file was created)\n // assert(!this.loadedFromSummary, \"unpack without summary\");\n\n this.loadedFromSummary = true;\n await this.unpackSnapshotCore(snapshot);\n }\n\n protected constructor(\n private readonly storage: IDocumentStorageService,\n private readonly logger: ITelemetryLogger,\n private readonly allowPacking: boolean,\n private readonly packingLevel: number,\n private readonly blobCutOffSize?: number)\n {\n super();\n }\n\n public setBlob(id: string, tree: ISnapshotTree, content: string) {\n this.virtualBlobs.set(id, stringToBuffer(content, \"utf-8\"));\n }\n\n public async getBlob(id: string, tree: ISnapshotTree): Promise<ArrayBufferLike> {\n return this.readBlob(id).catch((error) => {\n this.logger.sendErrorEvent({ eventName: \"BlobDedupNoAggregateBlob\" }, error);\n throw error;\n });\n }\n\n public get repositoryUrl() { return this.storage.repositoryUrl; }\n public async getVersions(versionId: string | null, count: number) {\n return this.storage.getVersions(versionId, count);\n }\n\n public async downloadSummary(handle: ISummaryHandle): Promise<ISummaryTree> {\n throw new Error(\"NYI\");\n }\n\n // This is only used through Container.snapshot() for testing purposes\n public async write(root: ITree, parents: string[], message: string, ref: string) {\n return this.storage.write(root, parents, message, ref);\n }\n\n // for now we are not optimizing these blobs, with assumption that this API is used only\n // for big blobs (images)\n public async createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse> {\n return this.storage.createBlob(file);\n }\n\n public async getSnapshotTree(version?: IVersion): Promise<ISnapshotTree | null> {\n const tree = await this.storage.getSnapshotTree(version);\n if (tree) {\n await this.unpackSnapshot(tree);\n }\n return tree;\n }\n\n public async readBlob(id: string): Promise<ArrayBufferLike> {\n if (this.isRealStorageId(id)) {\n return this.storage.readBlob(id);\n }\n // We support only reading blobs from the summary we loaded from.\n // This may need to be extended to any general summary in the future as runtime usage pattern\n // of storage changes (for example, data stores start to load from recent summary, not from original\n // summary whole container loaded from)\n\n // are there other ways we can get here? createFile is one flow, but we should not be reading blobs\n // in such flow\n assert(this.loadedFromSummary, 0x0f9 /* \"never read summary\" */);\n const blob = this.virtualBlobs.get(id);\n assert(blob !== undefined, 0x0fa /* \"virtual blob not found\" */);\n return blob;\n }\n\n public async uploadSummaryWithContext(summary: ISummaryTree, context: ISummaryContext): Promise<string> {\n const summaryNew = this.allowPacking ? await this.compressSmallBlobs(summary) : summary;\n return this.storage.uploadSummaryWithContext(summaryNew, context);\n }\n\n // For simplification, we assume that\n // - blob aggregation is done at data store level only for now\n // - data store either reuses previous summary, or generates full summary, i.e. there is no partial (some DDS)\n // summary produced by data stores.\n // These simplifications allow us not to touch handles, as they are self-contained (either do not use aggregated\n // blob Or contain aggregated blob that stays relevant for that sub-tree)\n // Note:\n // From perf perspective, it makes sense to place aggregated blobs one level up in the tree not to create extra\n // tree nodes (i.e. have shallow tree with less edges). But that creates problems with reusability of trees at\n // incremental summary time - we would need to understand handles and parse them. In current design we can skip\n // that step because if data store is reused, the hole sub-tree is reused included aggregated blob embedded into it\n // and that means we can do nothing and be correct!\n private async compressSmallBlobs(\n summary: ISummaryTree,\n path = \"\",\n level = 0,\n aggregatorArg?: BlobAggregator): Promise<ISummaryTree>\n {\n if (this.blobCutOffSize === undefined || this.blobCutOffSize < 0) {\n return summary;\n }\n\n let shouldCompress: boolean = false;\n\n let aggregator = aggregatorArg;\n // checking if this is a dataStore tree, since we only pack at data store level\n if (Object.keys(summary.tree).includes(\".component\")) {\n assert(aggregator === undefined, 0x0fb /* \"logic err with aggregator\" */);\n assert(level === this.packingLevel, 0x23b /* \"we are not packing at the right level\" */);\n aggregator = new BlobAggregator();\n shouldCompress = true;\n } else {\n assert(level !== this.packingLevel, 0x23c /* \"we are not packing at the right level\" */);\n }\n\n const newSummary: ISummaryTree = {...summary};\n newSummary.tree = { ...newSummary.tree};\n for (const key of Object.keys(summary.tree)) {\n const obj = summary.tree[key];\n // Get path relative to root of data store (where we do aggregation)\n const newPath = shouldCompress ? key : `${path}/${key}`;\n switch (obj.type) {\n case SummaryType.Tree:\n // If client created empty tree, keep it as is\n // Also do not package search blobs - they are part of storage contract\n if (obj.tree !== {} && key !== \"__search\") {\n const tree = await this.compressSmallBlobs(obj, newPath, level + 1, aggregator);\n newSummary.tree[key] = tree;\n if (tree.tree === {}) {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete newSummary.tree[key];\n }\n }\n break;\n case SummaryType.Blob:\n if (aggregator && typeof obj.content == \"string\" && obj.content.length < this.blobCutOffSize) {\n aggregator.addBlob(newPath, obj.content);\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete newSummary.tree[key];\n }\n break;\n case SummaryType.Handle: {\n // Would be nice to:\n // Trees: expand the tree\n // Blobs: parse handle and ensure it points to real blob, not virtual blob.\n // We can avoid it for now given data store is the granularity of incremental summaries.\n let handlePath = obj.handle;\n if (handlePath.startsWith(\"/\")) {\n handlePath = handlePath.substr(1);\n }\n // Ensure only whole data stores can be reused, no reusing at deeper level!\n assert(level === 0, 0x0fc /* \"tree reuse at lower level\" */);\n assert(handlePath.indexOf(\"/\") === -1,\n 0x0fd /* \"data stores are writing incremental summaries!\" */);\n break;\n }\n case SummaryType.Attachment:\n assert(this.isRealStorageId(obj.id), 0x0fe /* \"attachment is aggregate blob\" */);\n break;\n default:\n unreachableCase(obj, `Unknown type: ${(obj as any).type}`);\n }\n }\n\n assert(newSummary.tree[this.aggregatedBlobName] === undefined, 0x0ff /* \"duplicate aggregate blob\" */);\n if (shouldCompress) {\n // Note: It would be great to add code here to unpack aggregate blob back to normal blobs\n // If only one blob made it into aggregate. Currently that does not happen as we always have\n // at least one .component blob and at least one DDS that has .attributes blob, so it's not an issue.\n // But it's possible that in future that would be great addition!\n // Good news - it's backward compatible change.\n assert(aggregator !== undefined, 0x100 /* \"logic error\" */);\n const content = aggregator.getAggregatedBlobContent();\n if (content !== undefined) {\n newSummary.tree[this.aggregatedBlobName] = {\n type: SummaryType.Blob,\n content,\n };\n }\n }\n return newSummary;\n }\n\n protected isRealStorageId(id: string): boolean {\n return !id.startsWith(this.virtualIdPrefix);\n }\n}\n"]}
1
+ {"version":3,"file":"blobAggregationStorage.js","sourceRoot":"","sources":["../src/blobAggregationStorage.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAOH,+EAQ8C;AAC9C,+DAOuC;AAEvC,qEAA4E;AAE5E;;;EAGE;AACF,SAAS,eAAe,CAAC,IAAqB,EAAE,QAA4B;IACxE,IAAI,IAAI,YAAY,UAAU,EAAE,EAAE,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M;gBACV;oBACI,8BAAe,CAAC,GAAG,EAAE,iBAAkB,GAAW,CAAC,IAAI,EAAE,CAAC,CAAC;aAClE;SACJ;QAED,qBAAM,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,KAAK,SAAS,EAAE,KAAK,CAAC,gCAAgC,CAAC,CAAC;QACvG,IAAI,cAAc,EAAE;YAChB,yFAAyF;YACzF,4FAA4F;YAC5F,qGAAqG;YACrG,iEAAiE;YACjE,+CAA+C;YAC/C,qBAAM,CAAC,UAAU,KAAK,SAAS,EAAE,KAAK,CAAC,mBAAmB,CAAC,CAAC;YAC5D,MAAM,OAAO,GAAG,UAAU,CAAC,wBAAwB,EAAE,CAAC;YACtD,IAAI,OAAO,KAAK,SAAS,EAAE;gBACvB,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,GAAG;oBACvC,IAAI,EAAE,kCAAW,CAAC,IAAI;oBACtB,OAAO;iBACV,CAAC;aACL;SACJ;QACD,OAAO,UAAU,CAAC;IACtB,CAAC;IAES,eAAe,CAAC,EAAU;QAChC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAChD,CAAC;;AAzOL,wDA0OC;AAzOG,4FAA4F;AAC5F,8BAA8B;AAC9B,uGAAuG;AACvG,yGAAyG;AACzG,4FAA4F;AAC5F,qGAAqG;AACrG,oGAAoG;AACpG,mCAAmC;AACnC,yGAAyG;AACzG,mFAAmF;AACnE,6CAAsB,GAAG,IAAI,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n IDocumentStorageService,\n IDocumentStorageServicePolicies,\n ISummaryContext,\n} from \"@fluidframework/driver-definitions\";\nimport {\n ICreateBlobResponse,\n ISnapshotTree,\n ISummaryHandle,\n ISummaryTree,\n IVersion,\n SummaryType,\n ITree,\n} from \"@fluidframework/protocol-definitions\";\nimport {\n assert,\n bufferToString,\n stringToBuffer,\n unreachableCase,\n fromUtf8ToBase64,\n Uint8ArrayToString,\n } from \"@fluidframework/common-utils\";\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { loggerToMonitoringContext } from \"@fluidframework/telemetry-utils\";\n\n/*\n * Work around for bufferToString having a bug - it can't consume IsoBuffer!\n * To be removed once bufferToString is fixed!\n*/\nfunction bufferToString2(blob: ArrayBufferLike, encoding: \"utf-8\" | \"base64\"): string {\n if (blob instanceof Uint8Array) { // IsoBuffer does not have ctor, so it's not in proto chain :(\n return Uint8ArrayToString(blob, encoding);\n }\n return bufferToString(blob, encoding);\n}\n\n /**\n * Class responsible for aggregating smaller blobs into one and unpacking it later on.\n */\nclass BlobAggregator {\n private readonly content: [string, string][] = [];\n\n public addBlob(key: string, content: string) {\n this.content.push([key, content]);\n }\n\n public getAggregatedBlobContent() {\n if (this.content.length === 0) {\n return undefined;\n }\n return JSON.stringify(this.content);\n }\n\n static load(input: ArrayBufferLike) {\n const data = bufferToString2(input, \"utf-8\");\n return JSON.parse(data) as [string, string][];\n }\n}\n\n/*\n * Base class that deals with unpacking snapshots (in place) containing aggregated blobs\n * It relies on abstract methods for reads and storing unpacked blobs.\n */\nexport abstract class SnapshotExtractor {\n protected readonly aggregatedBlobName = \"__big\";\n protected readonly virtualIdPrefix = \"__\";\n\n // counter for generation of virtual storage IDs\n protected virtualIdCounter = 0;\n protected getNextVirtualId() {\n return `${this.virtualIdPrefix}${++this.virtualIdCounter}`;\n }\n\n abstract getBlob(id: string, tree: ISnapshotTree): Promise<ArrayBufferLike>;\n abstract setBlob(id: string, tree: ISnapshotTree, content: string);\n\n public async unpackSnapshotCore(snapshot: ISnapshotTree, level = 0): Promise<void> {\n for (const key of Object.keys(snapshot.trees)) {\n const obj = snapshot.trees[key];\n await this.unpackSnapshotCore(obj, level + 1);\n }\n\n // For future proof, we will support multiple aggregated blobs with any name\n // that starts with this.aggregatedBlobName\n for (const key of Object.keys(snapshot.blobs)) {\n if (!key.startsWith(this.aggregatedBlobName)) { continue; }\n const blobId = snapshot.blobs[key];\n if (blobId !== undefined) {\n const blob = await this.getBlob(blobId, snapshot);\n for (const [path, value] of BlobAggregator.load(blob)) {\n const id = this.getNextVirtualId();\n this.setBlob(id, snapshot, value);\n const pathSplit = path.split(\"/\");\n let subTree = snapshot;\n for (const subPath of pathSplit.slice(0, pathSplit.length - 1)) {\n if (subTree.trees[subPath] === undefined) {\n subTree.trees[subPath] = { blobs: {}, commits: {}, trees: {}};\n }\n subTree = subTree.trees[subPath];\n }\n const blobName = pathSplit[pathSplit.length - 1];\n assert(subTree.blobs[blobName] === undefined, 0x0f6 /* \"real blob ID exists\" */);\n subTree.blobs[blobName] = id;\n }\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete snapshot.blobs[this.aggregatedBlobName];\n }\n }\n }\n}\n\n/*\n * Snapshot extractor class that works in place, i.e. patches snapshot that has\n * blob content in ISnapshotTree.blobs itself, not in storage.\n * As result, it implements reading and writing of blobs to/from snapshot itself.\n * It follows existing pattern that mixes concerns - ISnapshotTree.blobs is used for two\n * purposes:\n * 1. map path name to blob ID\n * 2. map blob ID to blob content\n * #2 is what storage (IDocumentStorageService) is for, but in places where we do not have it\n * (like loading serialized earlier draft content), blob content is put directly into snapshot.\n * Ideally this should be fixed by using BlobCacheStorageService or something similar and\n * fixing existing flows to allow switching of storage.\n */\nclass SnapshotExtractorInPlace extends SnapshotExtractor {\n public async getBlob(id: string, tree: ISnapshotTree): Promise<ArrayBufferLike> {\n const blob = tree.blobs[id];\n assert(blob !== undefined, 0x0f7 /* \"aggregate blob missing\" */);\n return stringToBuffer(blob, \"base64\");\n }\n\n public setBlob(id: string, tree: ISnapshotTree, content: string) {\n assert(tree.blobs[id] === undefined, 0x0f8 /* \"blob from aggregate blob exists on its own\" */);\n tree.blobs[id] = fromUtf8ToBase64(content);\n }\n}\n\n/*\n * Snapshot packer and extractor.\n * When summary is written it will find and aggregate small blobs into bigger blobs\n * When snapshot is read, it will unpack aggregated blobs and provide them transparently to caller.\n */\nexport class BlobAggregationStorage extends SnapshotExtractor implements IDocumentStorageService {\n // Tells data store if it can use incremental summary (i.e. reuse DDSs from previous summary\n // when only one DDS changed).\n // The answer has to be know long before we enable actual packing. The reason for the is the following:\n // A the moment when we enable packing, we should assume that all clients out there wil already have bits\n // that can unpack properly (i.e. enough time passed since we deployed bits that can unpack)\n // But we can still have clients where some of them already pack, and some do not. If one summary was\n // using packing, then it relies on non-incremental summaries going forward, even if next client who\n // produced summary is not packing!\n // This can have slight improvement by enabling it per file (based on \"did summary we loaded from contain\n // aggregated blobs\"), but that's harder to make reliable, so going for simplicity.\n static readonly fullDataStoreSummaries = true;\n\n protected loadedFromSummary = false;\n\n protected virtualBlobs = new Map<string, ArrayBufferLike>();\n\n static wrap(\n storage: IDocumentStorageService,\n logger: ITelemetryLogger,\n allowPacking?: boolean,\n packingLevel = 2,\n ) {\n if (storage instanceof BlobAggregationStorage) {\n return storage;\n }\n const mc = loggerToMonitoringContext(logger);\n const realAllowPackaging = mc.config.getBoolean(\"FluidAggregateBlobs\") ?? allowPacking ?? false;\n\n // Always create BlobAggregationStorage even if storage is not asking for packing.\n // This is mostly to avoid cases where future changes in policy would result in inability to\n // load old files that were created with aggregation on.\n const minBlobSize = storage.policies?.minBlobSize;\n return new BlobAggregationStorage(storage, logger, realAllowPackaging, packingLevel, minBlobSize);\n }\n\n static async unpackSnapshot(snapshot: ISnapshotTree) {\n const converter = new SnapshotExtractorInPlace();\n await converter.unpackSnapshotCore(snapshot);\n }\n\n public get policies(): IDocumentStorageServicePolicies | undefined {\n const policies = this.storage.policies;\n if (policies) {\n return { ...policies, minBlobSize: undefined };\n }\n }\n\n public async unpackSnapshot(snapshot: ISnapshotTree) {\n // SummarizerNodeWithGC.refreshLatestSummary can call it when this.loadedFromSummary === false\n // (I assumed after file was created)\n // assert(!this.loadedFromSummary, \"unpack without summary\");\n\n this.loadedFromSummary = true;\n await this.unpackSnapshotCore(snapshot);\n }\n\n protected constructor(\n private readonly storage: IDocumentStorageService,\n private readonly logger: ITelemetryLogger,\n private readonly allowPacking: boolean,\n private readonly packingLevel: number,\n private readonly blobCutOffSize?: number)\n {\n super();\n }\n\n public setBlob(id: string, tree: ISnapshotTree, content: string) {\n this.virtualBlobs.set(id, stringToBuffer(content, \"utf-8\"));\n }\n\n public async getBlob(id: string, tree: ISnapshotTree): Promise<ArrayBufferLike> {\n return this.readBlob(id).catch((error) => {\n this.logger.sendErrorEvent({ eventName: \"BlobDedupNoAggregateBlob\" }, error);\n throw error;\n });\n }\n\n public get repositoryUrl() { return this.storage.repositoryUrl; }\n public async getVersions(versionId: string | null, count: number) {\n return this.storage.getVersions(versionId, count);\n }\n\n public async downloadSummary(handle: ISummaryHandle): Promise<ISummaryTree> {\n throw new Error(\"NYI\");\n }\n\n // This is only used through Container.snapshot() for testing purposes\n public async write(root: ITree, parents: string[], message: string, ref: string) {\n return this.storage.write(root, parents, message, ref);\n }\n\n // for now we are not optimizing these blobs, with assumption that this API is used only\n // for big blobs (images)\n public async createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse> {\n return this.storage.createBlob(file);\n }\n\n public async getSnapshotTree(version?: IVersion): Promise<ISnapshotTree | null> {\n const tree = await this.storage.getSnapshotTree(version);\n if (tree) {\n await this.unpackSnapshot(tree);\n }\n return tree;\n }\n\n public async readBlob(id: string): Promise<ArrayBufferLike> {\n if (this.isRealStorageId(id)) {\n return this.storage.readBlob(id);\n }\n // We support only reading blobs from the summary we loaded from.\n // This may need to be extended to any general summary in the future as runtime usage pattern\n // of storage changes (for example, data stores start to load from recent summary, not from original\n // summary whole container loaded from)\n\n // are there other ways we can get here? createFile is one flow, but we should not be reading blobs\n // in such flow\n assert(this.loadedFromSummary, 0x0f9 /* \"never read summary\" */);\n const blob = this.virtualBlobs.get(id);\n assert(blob !== undefined, 0x0fa /* \"virtual blob not found\" */);\n return blob;\n }\n\n public async uploadSummaryWithContext(summary: ISummaryTree, context: ISummaryContext): Promise<string> {\n const summaryNew = this.allowPacking ? await this.compressSmallBlobs(summary) : summary;\n return this.storage.uploadSummaryWithContext(summaryNew, context);\n }\n\n // For simplification, we assume that\n // - blob aggregation is done at data store level only for now\n // - data store either reuses previous summary, or generates full summary, i.e. there is no partial (some DDS)\n // summary produced by data stores.\n // These simplifications allow us not to touch handles, as they are self-contained (either do not use aggregated\n // blob Or contain aggregated blob that stays relevant for that sub-tree)\n // Note:\n // From perf perspective, it makes sense to place aggregated blobs one level up in the tree not to create extra\n // tree nodes (i.e. have shallow tree with less edges). But that creates problems with reusability of trees at\n // incremental summary time - we would need to understand handles and parse them. In current design we can skip\n // that step because if data store is reused, the hole sub-tree is reused included aggregated blob embedded into it\n // and that means we can do nothing and be correct!\n private async compressSmallBlobs(\n summary: ISummaryTree,\n path = \"\",\n level = 0,\n aggregatorArg?: BlobAggregator): Promise<ISummaryTree>\n {\n if (this.blobCutOffSize === undefined || this.blobCutOffSize < 0) {\n return summary;\n }\n\n let shouldCompress: boolean = false;\n\n let aggregator = aggregatorArg;\n // checking if this is a dataStore tree, since we only pack at data store level\n if (Object.keys(summary.tree).includes(\".component\")) {\n assert(aggregator === undefined, 0x0fb /* \"logic err with aggregator\" */);\n assert(level === this.packingLevel, 0x23b /* \"we are not packing at the right level\" */);\n aggregator = new BlobAggregator();\n shouldCompress = true;\n } else {\n assert(level !== this.packingLevel, 0x23c /* \"we are not packing at the right level\" */);\n }\n\n const newSummary: ISummaryTree = {...summary};\n newSummary.tree = { ...newSummary.tree};\n for (const key of Object.keys(summary.tree)) {\n const obj = summary.tree[key];\n // Get path relative to root of data store (where we do aggregation)\n const newPath = shouldCompress ? key : `${path}/${key}`;\n switch (obj.type) {\n case SummaryType.Tree:\n // If client created empty tree, keep it as is\n // Also do not package search blobs - they are part of storage contract\n if (obj.tree !== {} && key !== \"__search\") {\n const tree = await this.compressSmallBlobs(obj, newPath, level + 1, aggregator);\n newSummary.tree[key] = tree;\n if (tree.tree === {}) {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete newSummary.tree[key];\n }\n }\n break;\n case SummaryType.Blob:\n if (aggregator && typeof obj.content == \"string\" && obj.content.length < this.blobCutOffSize) {\n aggregator.addBlob(newPath, obj.content);\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete newSummary.tree[key];\n }\n break;\n case SummaryType.Handle: {\n // Would be nice to:\n // Trees: expand the tree\n // Blobs: parse handle and ensure it points to real blob, not virtual blob.\n // We can avoid it for now given data store is the granularity of incremental summaries.\n let handlePath = obj.handle;\n if (handlePath.startsWith(\"/\")) {\n handlePath = handlePath.substr(1);\n }\n // Ensure only whole data stores can be reused, no reusing at deeper level!\n assert(level === 0, 0x0fc /* \"tree reuse at lower level\" */);\n assert(handlePath.indexOf(\"/\") === -1,\n 0x0fd /* \"data stores are writing incremental summaries!\" */);\n break;\n }\n case SummaryType.Attachment:\n assert(this.isRealStorageId(obj.id), 0x0fe /* \"attachment is aggregate blob\" */);\n break;\n default:\n unreachableCase(obj, `Unknown type: ${(obj as any).type}`);\n }\n }\n\n assert(newSummary.tree[this.aggregatedBlobName] === undefined, 0x0ff /* \"duplicate aggregate blob\" */);\n if (shouldCompress) {\n // Note: It would be great to add code here to unpack aggregate blob back to normal blobs\n // If only one blob made it into aggregate. Currently that does not happen as we always have\n // at least one .component blob and at least one DDS that has .attributes blob, so it's not an issue.\n // But it's possible that in future that would be great addition!\n // Good news - it's backward compatible change.\n assert(aggregator !== undefined, 0x100 /* \"logic error\" */);\n const content = aggregator.getAggregatedBlobContent();\n if (content !== undefined) {\n newSummary.tree[this.aggregatedBlobName] = {\n type: SummaryType.Blob,\n content,\n };\n }\n }\n return newSummary;\n }\n\n protected isRealStorageId(id: string): boolean {\n return !id.startsWith(this.virtualIdPrefix);\n }\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -18,4 +18,5 @@ export * from "./prefetchDocumentStorageService";
18
18
  export * from "./networkUtils";
19
19
  export * from "./rateLimiter";
20
20
  export * from "./runWithRetry";
21
+ export * from "./treeConversions";
21
22
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,uBAAuB,CAAC;AACtC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,oBAAoB,CAAC;AACnC,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kCAAkC,CAAC;AACjD,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,uBAAuB,CAAC;AACtC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,oBAAoB,CAAC;AACnC,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kCAAkC,CAAC;AACjD,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC"}
package/dist/index.js CHANGED
@@ -30,4 +30,5 @@ __exportStar(require("./prefetchDocumentStorageService"), exports);
30
30
  __exportStar(require("./networkUtils"), exports);
31
31
  __exportStar(require("./rateLimiter"), exports);
32
32
  __exportStar(require("./runWithRetry"), exports);
33
+ __exportStar(require("./treeConversions"), exports);
33
34
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;AAEH,4DAA0C;AAC1C,2DAAyC;AACzC,sDAAoC;AACpC,gEAA8C;AAC9C,wDAAsC;AACtC,gEAA8C;AAC9C,qDAAmC;AACnC,4CAA0B;AAC1B,iDAA+B;AAC/B,qDAAmC;AACnC,wDAAsC;AACtC,qDAAmC;AACnC,mEAAiD;AACjD,iDAA+B;AAC/B,gDAA8B;AAC9B,iDAA+B","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport * from \"./blobCacheStorageService\";\nexport * from \"./blobAggregationStorage\";\nexport * from \"./buildSnapshotTree\";\nexport * from \"./documentStorageServiceProxy\";\nexport * from \"./insecureUrlResolver\";\nexport * from \"./multiDocumentServiceFactory\";\nexport * from \"./multiUrlResolver\";\nexport * from \"./network\";\nexport * from \"./readAndParse\";\nexport * from \"./fluidResolvedUrl\";\nexport * from \"./summaryForCreateNew\";\nexport * from \"./parallelRequests\";\nexport * from \"./prefetchDocumentStorageService\";\nexport * from \"./networkUtils\";\nexport * from \"./rateLimiter\";\nexport * from \"./runWithRetry\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;AAEH,4DAA0C;AAC1C,2DAAyC;AACzC,sDAAoC;AACpC,gEAA8C;AAC9C,wDAAsC;AACtC,gEAA8C;AAC9C,qDAAmC;AACnC,4CAA0B;AAC1B,iDAA+B;AAC/B,qDAAmC;AACnC,wDAAsC;AACtC,qDAAmC;AACnC,mEAAiD;AACjD,iDAA+B;AAC/B,gDAA8B;AAC9B,iDAA+B;AAC/B,oDAAkC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport * from \"./blobCacheStorageService\";\nexport * from \"./blobAggregationStorage\";\nexport * from \"./buildSnapshotTree\";\nexport * from \"./documentStorageServiceProxy\";\nexport * from \"./insecureUrlResolver\";\nexport * from \"./multiDocumentServiceFactory\";\nexport * from \"./multiUrlResolver\";\nexport * from \"./network\";\nexport * from \"./readAndParse\";\nexport * from \"./fluidResolvedUrl\";\nexport * from \"./summaryForCreateNew\";\nexport * from \"./parallelRequests\";\nexport * from \"./prefetchDocumentStorageService\";\nexport * from \"./networkUtils\";\nexport * from \"./rateLimiter\";\nexport * from \"./runWithRetry\";\nexport * from \"./treeConversions\";\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"multiDocumentServiceFactory.d.ts","sourceRoot":"","sources":["../src/multiDocumentServiceFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACH,uBAAuB,EACvB,YAAY,EACZ,gBAAgB,EACnB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAG1E,qBAAa,2BAA4B,YAAW,uBAAuB;WACzD,MAAM,CAAC,sBAAsB,EAAE,uBAAuB,GAAG,uBAAuB,EAAE;IAmBhG,OAAO,CAAC,QAAQ,CAAC,4BAA4B,CAAuC;gBAExE,wBAAwB,EAAE,uBAAuB,EAAE;IAM/D,SAAgB,YAAY,WAAW;IACjC,qBAAqB,CAAC,WAAW,EAAE,YAAY,EAAE,MAAM,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAenG,eAAe,CACxB,gBAAgB,EAAE,YAAY,EAC9B,oBAAoB,EAAE,YAAY,EAClC,MAAM,CAAC,EAAE,oBAAoB,GAC9B,OAAO,CAAC,gBAAgB,CAAC;CAa/B"}
1
+ {"version":3,"file":"multiDocumentServiceFactory.d.ts","sourceRoot":"","sources":["../src/multiDocumentServiceFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACH,uBAAuB,EACvB,YAAY,EACZ,gBAAgB,EACnB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAG1E,qBAAa,2BAA4B,YAAW,uBAAuB;WACzD,MAAM,CAAC,sBAAsB,EAAE,uBAAuB,GAAG,uBAAuB,EAAE;IAmBhG,OAAO,CAAC,QAAQ,CAAC,4BAA4B,CAAuC;gBAExE,wBAAwB,EAAE,uBAAuB,EAAE;IAM/D,SAAgB,YAAY,WAAW;IACjC,qBAAqB,CAAC,WAAW,EAAE,YAAY,EAAE,MAAM,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAcnG,eAAe,CACxB,gBAAgB,EAAE,YAAY,EAC9B,oBAAoB,EAAE,YAAY,EAClC,MAAM,CAAC,EAAE,oBAAoB,GAC9B,OAAO,CAAC,gBAAgB,CAAC;CAY/B"}
@@ -37,7 +37,6 @@ class MultiDocumentServiceFactory {
37
37
  async createDocumentService(resolvedUrl, logger) {
38
38
  fluidResolvedUrl_1.ensureFluidResolvedUrl(resolvedUrl);
39
39
  const urlObj = url_1.parse(resolvedUrl.url);
40
- // eslint-disable-next-line no-null/no-null
41
40
  if (urlObj.protocol === undefined || urlObj.protocol === null) {
42
41
  throw new Error("No protocol provided");
43
42
  }
@@ -50,7 +49,6 @@ class MultiDocumentServiceFactory {
50
49
  async createContainer(createNewSummary, createNewResolvedUrl, logger) {
51
50
  fluidResolvedUrl_1.ensureFluidResolvedUrl(createNewResolvedUrl);
52
51
  const urlObj = url_1.parse(createNewResolvedUrl.url);
53
- // eslint-disable-next-line no-null/no-null
54
52
  if (urlObj.protocol === undefined || urlObj.protocol === null) {
55
53
  throw new Error("No protocol provided");
56
54
  }
@@ -1 +1 @@
1
- {"version":3,"file":"multiDocumentServiceFactory.js","sourceRoot":"","sources":["../src/multiDocumentServiceFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,6BAA4B;AAQ5B,yDAA4D;AAE5D,MAAa,2BAA2B;IAsBpC,YAAY,wBAAmD;QAM/C,iBAAY,GAAG,OAAO,CAAC;QALnC,IAAI,CAAC,4BAA4B,GAAG,IAAI,GAAG,EAAE,CAAC;QAC9C,wBAAwB,CAAC,OAAO,CAAC,CAAC,OAAgC,EAAE,EAAE;YAClE,IAAI,CAAC,4BAA4B,CAAC,GAAG,CAAC,OAAO,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QACzE,CAAC,CAAC,CAAC;IACP,CAAC;IA1BM,MAAM,CAAC,MAAM,CAAC,sBAA2E;QAC5F,IAAI,KAAK,CAAC,OAAO,CAAC,sBAAsB,CAAC,EAAE;YACvC,MAAM,SAAS,GAA8B,EAAE,CAAC;YAChD,sBAAsB,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;gBACvC,MAAM,UAAU,GAAG,OAAsC,CAAC;gBAC1D,IAAI,UAAU,CAAC,4BAA4B,KAAK,SAAS,EAAE;oBACvD,SAAS,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC,4BAA4B,CAAC,MAAM,EAAE,CAAC,CAAC;iBACvE;qBAAM;oBACH,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;iBAC3B;YACL,CAAC,CAAC,CAAC;YACH,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE;gBACxB,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC;aACvB;YACD,OAAO,IAAI,2BAA2B,CAAC,SAAS,CAAC,CAAC;SACrD;QACD,OAAO,sBAAsB,CAAC;IAClC,CAAC;IAWD,KAAK,CAAC,qBAAqB,CAAC,WAAyB,EAAE,MAA6B;QAChF,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ensed under the MIT License.\n */\n\nimport { parse } from \"url\";\nimport {\n IDocumentServiceFactory,\n IResolvedUrl,\n IDocumentService,\n} from \"@fluidframework/driver-definitions\";\nimport { ISummaryTree } from \"@fluidframework/protocol-definitions\";\nimport { ITelemetryBaseLogger } from \"@fluidframework/common-definitions\";\nimport { ensureFluidResolvedUrl } from \"./fluidResolvedUrl\";\n\nexport class MultiDocumentServiceFactory implements IDocumentServiceFactory {\n public static create(documentServiceFactory: IDocumentServiceFactory | IDocumentServiceFactory[]) {\n if (Array.isArray(documentServiceFactory)) {\n const factories: IDocumentServiceFactory[] = [];\n documentServiceFactory.forEach((factory) => {\n const maybeMulti = factory as MultiDocumentServiceFactory;\n if (maybeMulti.protocolToDocumentFactoryMap !== undefined) {\n factories.push(...maybeMulti.protocolToDocumentFactoryMap.values());\n } else {\n factories.push(factory);\n }\n });\n if (factories.length === 1) {\n return factories[0];\n }\n return new MultiDocumentServiceFactory(factories);\n }\n return documentServiceFactory;\n }\n\n private readonly protocolToDocumentFactoryMap: Map<string, IDocumentServiceFactory>;\n\n constructor(documentServiceFactories: IDocumentServiceFactory[]) {\n this.protocolToDocumentFactoryMap = new Map();\n documentServiceFactories.forEach((factory: IDocumentServiceFactory) => {\n this.protocolToDocumentFactoryMap.set(factory.protocolName, factory);\n });\n }\n public readonly protocolName = \"none:\";\n async createDocumentService(resolvedUrl: IResolvedUrl, logger?: ITelemetryBaseLogger): Promise<IDocumentService> {\n ensureFluidResolvedUrl(resolvedUrl);\n const urlObj = parse(resolvedUrl.url);\n // eslint-disable-next-line no-null/no-null\n if (urlObj.protocol === undefined || urlObj.protocol === null) {\n throw new Error(\"No protocol provided\");\n }\n const factory: IDocumentServiceFactory | undefined = this.protocolToDocumentFactoryMap.get(urlObj.protocol);\n if (factory === undefined) {\n throw new Error(\"Unknown Fluid protocol\");\n }\n\n return factory.createDocumentService(resolvedUrl, logger);\n }\n\n public async createContainer(\n createNewSummary: ISummaryTree,\n createNewResolvedUrl: IResolvedUrl,\n logger?: ITelemetryBaseLogger,\n ): Promise<IDocumentService> {\n ensureFluidResolvedUrl(createNewResolvedUrl);\n const urlObj = parse(createNewResolvedUrl.url);\n // eslint-disable-next-line no-null/no-null\n if (urlObj.protocol === undefined || urlObj.protocol === null) {\n throw new Error(\"No protocol provided\");\n }\n const factory: IDocumentServiceFactory | undefined = this.protocolToDocumentFactoryMap.get(urlObj.protocol);\n if (factory === undefined) {\n throw new Error(\"Unknown Fluid protocol\");\n }\n return factory.createContainer(createNewSummary, createNewResolvedUrl, logger);\n }\n}\n"]}
1
+ {"version":3,"file":"multiDocumentServiceFactory.js","sourceRoot":"","sources":["../src/multiDocumentServiceFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,6BAA4B;AAQ5B,yDAA4D;AAE5D,MAAa,2BAA2B;IAsBpC,YAAY,wBAAmD;QAM/C,iBAAY,GAAG,OAAO,CAAC;QALnC,IAAI,CAAC,4BAA4B,GAAG,IAAI,GAAG,EAAE,CAAC;QAC9C,wBAAwB,CAAC,OAAO,CAAC,CAAC,OAAgC,EAAE,EAAE;YAClE,IAAI,CAAC,4BAA4B,CAAC,GAAG,CAAC,OAAO,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QACzE,CAAC,CAAC,CAAC;IACP,CAAC;IA1BM,MAAM,CAAC,MAAM,CAAC,sBAA2E;QAC5F,IAAI,KAAK,CAAC,OAAO,CAAC,sBAAsB,CAAC,EAAE;YACvC,MAAM,SAAS,GAA8B,EAAE,CAAC;YAChD,sBAAsB,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;gBACvC,MAAM,UAAU,GAAG,OAAsC,CAAC;gBAC1D,IAAI,UAAU,CAAC,4BAA4B,KAAK,SAAS,EAAE;oBACvD,SAAS,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC,4BAA4B,CAAC,MAAM,EAAE,CAAC,CAAC;iBACvE;qBAAM;oBACH,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;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KAAK,SAAS,EAAE;YACvB,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;SAC7C;QACD,OAAO,OAAO,CAAC,eAAe,CAAC,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,CAAC,CAAC;IACnF,CAAC;CACJ;AA3DD,kEA2DC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { parse } from \"url\";\nimport {\n IDocumentServiceFactory,\n IResolvedUrl,\n IDocumentService,\n} from \"@fluidframework/driver-definitions\";\nimport { ISummaryTree } from \"@fluidframework/protocol-definitions\";\nimport { ITelemetryBaseLogger } from \"@fluidframework/common-definitions\";\nimport { ensureFluidResolvedUrl } from \"./fluidResolvedUrl\";\n\nexport class MultiDocumentServiceFactory implements IDocumentServiceFactory {\n public static create(documentServiceFactory: IDocumentServiceFactory | IDocumentServiceFactory[]) {\n if (Array.isArray(documentServiceFactory)) {\n const factories: IDocumentServiceFactory[] = [];\n documentServiceFactory.forEach((factory) => {\n const maybeMulti = factory as MultiDocumentServiceFactory;\n if (maybeMulti.protocolToDocumentFactoryMap !== undefined) {\n factories.push(...maybeMulti.protocolToDocumentFactoryMap.values());\n } else {\n factories.push(factory);\n }\n });\n if (factories.length === 1) {\n return factories[0];\n }\n return new MultiDocumentServiceFactory(factories);\n }\n return documentServiceFactory;\n }\n\n private readonly protocolToDocumentFactoryMap: Map<string, IDocumentServiceFactory>;\n\n constructor(documentServiceFactories: IDocumentServiceFactory[]) {\n this.protocolToDocumentFactoryMap = new Map();\n documentServiceFactories.forEach((factory: IDocumentServiceFactory) => {\n this.protocolToDocumentFactoryMap.set(factory.protocolName, factory);\n });\n }\n public readonly protocolName = \"none:\";\n async createDocumentService(resolvedUrl: IResolvedUrl, logger?: ITelemetryBaseLogger): Promise<IDocumentService> {\n ensureFluidResolvedUrl(resolvedUrl);\n const urlObj = parse(resolvedUrl.url);\n if (urlObj.protocol === undefined || urlObj.protocol === null) {\n throw new Error(\"No protocol provided\");\n }\n const factory: IDocumentServiceFactory | undefined = this.protocolToDocumentFactoryMap.get(urlObj.protocol);\n if (factory === undefined) {\n throw new Error(\"Unknown Fluid protocol\");\n }\n\n return factory.createDocumentService(resolvedUrl, logger);\n }\n\n public async createContainer(\n createNewSummary: ISummaryTree,\n createNewResolvedUrl: IResolvedUrl,\n logger?: ITelemetryBaseLogger,\n ): Promise<IDocumentService> {\n ensureFluidResolvedUrl(createNewResolvedUrl);\n const urlObj = parse(createNewResolvedUrl.url);\n if (urlObj.protocol === undefined || urlObj.protocol === null) {\n throw new Error(\"No protocol provided\");\n }\n const factory: IDocumentServiceFactory | undefined = this.protocolToDocumentFactoryMap.get(urlObj.protocol);\n if (factory === undefined) {\n throw new Error(\"Unknown Fluid protocol\");\n }\n return factory.createContainer(createNewSummary, createNewResolvedUrl, logger);\n }\n}\n"]}
package/dist/network.d.ts CHANGED
@@ -11,6 +11,25 @@ export declare enum OnlineStatus {
11
11
  Unknown = 2
12
12
  }
13
13
  export declare function isOnline(): OnlineStatus;
14
+ /**
15
+ * Interface describing errors and warnings raised by any driver code.
16
+ * Not expected to be implemented by a class or an object literal, but rather used in place of
17
+ * any or unknown in various function signatures that pass errors around.
18
+ *
19
+ * "Any" in the interface name is a nod to the fact that errorType has lost its type constraint.
20
+ * It will be either DriverErrorType or the specific driver's specialized error type enum,
21
+ * but we can't reference a specific driver's error type enum in this code.
22
+ */
23
+ export interface IAnyDriverError {
24
+ readonly errorType: string;
25
+ readonly message: string;
26
+ canRetry: boolean;
27
+ online?: string;
28
+ }
29
+ /** Telemetry props with driver-specific required properties */
30
+ export declare type DriverErrorTelemetryProps = ITelemetryProperties & {
31
+ driverVersion: string | undefined;
32
+ };
14
33
  /**
15
34
  * Generic network error class.
16
35
  */
@@ -18,14 +37,14 @@ export declare class GenericNetworkError extends LoggingError implements IDriver
18
37
  readonly fluidErrorCode: string;
19
38
  readonly canRetry: boolean;
20
39
  readonly errorType = DriverErrorType.genericNetworkError;
21
- constructor(fluidErrorCode: string, message: string, canRetry: boolean, props?: ITelemetryProperties);
40
+ constructor(fluidErrorCode: string, message: string, canRetry: boolean, props: DriverErrorTelemetryProps);
22
41
  }
23
42
  export declare class DeltaStreamConnectionForbiddenError extends LoggingError implements IFluidErrorBase {
24
43
  readonly fluidErrorCode: string;
25
44
  static readonly errorType: string;
26
45
  readonly errorType: string;
27
46
  readonly canRetry = false;
28
- constructor(fluidErrorCode: string);
47
+ constructor(fluidErrorCode: string, props: DriverErrorTelemetryProps);
29
48
  }
30
49
  export declare class AuthorizationError extends LoggingError implements IAuthorizationError, IFluidErrorBase {
31
50
  readonly fluidErrorCode: string;
@@ -33,21 +52,21 @@ export declare class AuthorizationError extends LoggingError implements IAuthori
33
52
  readonly tenantId: string | undefined;
34
53
  readonly errorType = DriverErrorType.authorizationError;
35
54
  readonly canRetry = false;
36
- constructor(fluidErrorCode: string, message: string, claims: string | undefined, tenantId: string | undefined, props?: ITelemetryProperties);
55
+ constructor(fluidErrorCode: string, message: string, claims: string | undefined, tenantId: string | undefined, props: DriverErrorTelemetryProps);
37
56
  }
38
57
  export declare class NetworkErrorBasic<T extends string> extends LoggingError implements IFluidErrorBase {
39
58
  readonly fluidErrorCode: string;
40
59
  readonly errorType: T;
41
60
  readonly canRetry: boolean;
42
- constructor(fluidErrorCode: string, message: string, errorType: T, canRetry: boolean, props?: ITelemetryProperties);
61
+ constructor(fluidErrorCode: string, message: string, errorType: T, canRetry: boolean, props: DriverErrorTelemetryProps);
43
62
  }
44
63
  export declare class NonRetryableError<T extends string> extends NetworkErrorBasic<T> {
45
64
  readonly errorType: T;
46
- constructor(fluidErrorCode: string, message: string | undefined, errorType: T, props?: ITelemetryProperties);
65
+ constructor(fluidErrorCode: string, message: string | undefined, errorType: T, props: DriverErrorTelemetryProps);
47
66
  }
48
67
  export declare class RetryableError<T extends string> extends NetworkErrorBasic<T> {
49
68
  readonly errorType: T;
50
- constructor(fluidErrorCode: string, message: string | undefined, errorType: T, props?: ITelemetryProperties);
69
+ constructor(fluidErrorCode: string, message: string | undefined, errorType: T, props: DriverErrorTelemetryProps);
51
70
  }
52
71
  /**
53
72
  * Throttling error class - used to communicate all throttling errors
@@ -57,10 +76,13 @@ export declare class ThrottlingError extends LoggingError implements IThrottling
57
76
  readonly retryAfterSeconds: number;
58
77
  readonly errorType = DriverErrorType.throttlingError;
59
78
  readonly canRetry = true;
60
- constructor(fluidErrorCode: string, message: string, retryAfterSeconds: number, props?: ITelemetryProperties);
79
+ constructor(fluidErrorCode: string, message: string, retryAfterSeconds: number, props: DriverErrorTelemetryProps);
61
80
  }
62
- export declare const createWriteError: (fluidErrorCode: string) => NonRetryableError<DriverErrorType.writeError>;
63
- export declare function createGenericNetworkError(fluidErrorCode: string, message: string | undefined, canRetry: boolean, retryAfterMs?: number, props?: ITelemetryProperties): ThrottlingError | GenericNetworkError;
81
+ export declare const createWriteError: (fluidErrorCode: string, props: DriverErrorTelemetryProps) => NonRetryableError<DriverErrorType.writeError>;
82
+ export declare function createGenericNetworkError(fluidErrorCode: string, message: string | undefined, retryInfo: {
83
+ canRetry: boolean;
84
+ retryAfterMs?: number;
85
+ }, props: DriverErrorTelemetryProps): ThrottlingError | GenericNetworkError;
64
86
  /**
65
87
  * Check if a connection error can be retried. Unless explicitly allowed, retry is disallowed.
66
88
  * I.e. asserts or unexpected exceptions in our code result in container failure.
@@ -1 +1 @@
1
- {"version":3,"file":"network.d.ts","sourceRoot":"","sources":["../src/network.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EAClB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAEhF,oBAAY,YAAY;IACpB,OAAO,IAAA;IACP,MAAM,IAAA;IACN,OAAO,IAA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,KAAK,EAAE,yBAAyB;CAIvC;AAED,qBAAa,cAAc,CAAC,CAAC,SAAS,MAAM,CAAE,SAAQ,iBAAiB,CAAC,CAAC,CAAC;IAIlE,QAAQ,CAAC,SAAS,EAAE,CAAC;gBAFrB,cAAc,EAAE,MAAM,EACtB,OAAO,EAAE,MAAM,GAAG,SAAS,EAClB,SAAS,EAAE,CAAC,EACrB,KAAK,EAAE,yBAAyB;CAIvC;AAED;;GAEG;AACH,qBAAa,eAAgB,SAAQ,YAAa,YAAW,kBAAkB,EAAE,eAAe;IAKxF,QAAQ,CAAC,cAAc,EAAE,MAAM;IAE/B,QAAQ,CAAC,iBAAiB,EAAE,MAAM;IANtC,QAAQ,CAAC,SAAS,mCAAmC;IACrD,QAAQ,CAAC,QAAQ,QAAQ;gBAGZ,cAAc,EAAE,MAAM,EAC/B,OAAO,EAAE,MAAM,EACN,iBAAiB,EAAE,MAAM,EAClC,KAAK,EAAE,yBAAyB;CAIvC;AAED,eAAO,MAAM,gBAAgB,mBAAoB,MAAM,SAAS,yBAAyB,kDACF,CAAC;AAExF,wBAAgB,yBAAyB,CACrC,cAAc,EAAE,MAAM,EACtB,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,SAAS,EAAE;IAAC,QAAQ,EAAE,OAAO,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,EACtD,KAAK,EAAE,yBAAyB,GACjC,eAAe,GAAG,mBAAmB,CAMvC;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,UAAW,GAAG,KAAG,OAAmC,CAAC;AAEjF,eAAO,MAAM,6BAA6B,UAAW,GAAG,KAAG,MAAM,GAAG,SAClB,CAAC;AAEnD,eAAO,MAAM,sBAAsB,UAAW,GAAG,KAAG,MAAM,GAAG,SACf,CAAC"}
package/dist/network.js CHANGED
@@ -18,7 +18,6 @@ var OnlineStatus;
18
18
  // No solution for node.js (other than resolve dns names / ping specific sites)
19
19
  // Can also use window.addEventListener("online" / "offline")
20
20
  function isOnline() {
21
- // eslint-disable-next-line no-null/no-null
22
21
  if (typeof navigator === "object" && navigator !== null && typeof navigator.onLine === "boolean") {
23
22
  return navigator.onLine ? OnlineStatus.Online : OnlineStatus.Offline;
24
23
  }
@@ -44,8 +43,8 @@ exports.GenericNetworkError = GenericNetworkError;
44
43
  // value.
45
44
  const deltaStreamConnectionForbiddenStr = "deltaStreamConnectionForbidden";
46
45
  class DeltaStreamConnectionForbiddenError extends telemetry_utils_1.LoggingError {
47
- constructor(fluidErrorCode) {
48
- super(fluidErrorCode, { statusCode: 400 });
46
+ constructor(fluidErrorCode, props) {
47
+ super(fluidErrorCode, Object.assign(Object.assign({}, props), { statusCode: 400 }));
49
48
  this.fluidErrorCode = fluidErrorCode;
50
49
  this.errorType = DeltaStreamConnectionForbiddenError.errorType;
51
50
  this.canRetry = false;
@@ -88,7 +87,6 @@ class RetryableError extends NetworkErrorBasic {
88
87
  }
89
88
  }
90
89
  exports.RetryableError = RetryableError;
91
- //* Check
92
90
  /**
93
91
  * Throttling error class - used to communicate all throttling errors
94
92
  */
@@ -102,13 +100,13 @@ class ThrottlingError extends telemetry_utils_1.LoggingError {
102
100
  }
103
101
  }
104
102
  exports.ThrottlingError = ThrottlingError;
105
- const createWriteError = (fluidErrorCode) => new NonRetryableError(fluidErrorCode, undefined, driver_definitions_1.DriverErrorType.writeError);
103
+ const createWriteError = (fluidErrorCode, props) => new NonRetryableError(fluidErrorCode, undefined, driver_definitions_1.DriverErrorType.writeError, props);
106
104
  exports.createWriteError = createWriteError;
107
- function createGenericNetworkError(fluidErrorCode, message, canRetry, retryAfterMs, props) {
108
- if (retryAfterMs !== undefined && canRetry) {
109
- return new ThrottlingError(fluidErrorCode, message !== null && message !== void 0 ? message : fluidErrorCode, retryAfterMs / 1000, props);
105
+ function createGenericNetworkError(fluidErrorCode, message, retryInfo, props) {
106
+ if (retryInfo.retryAfterMs !== undefined && retryInfo.canRetry) {
107
+ return new ThrottlingError(fluidErrorCode, message !== null && message !== void 0 ? message : fluidErrorCode, retryInfo.retryAfterMs / 1000, props);
110
108
  }
111
- return new GenericNetworkError(fluidErrorCode, message !== null && message !== void 0 ? message : fluidErrorCode, canRetry, props);
109
+ return new GenericNetworkError(fluidErrorCode, message !== null && message !== void 0 ? message : fluidErrorCode, retryInfo.canRetry, props);
112
110
  }
113
111
  exports.createGenericNetworkError = createGenericNetworkError;
114
112
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"network.js","sourceRoot":"","sources":["../src/network.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAEH,2EAK4C;AAE5C,qEAAgF;AAEhF,IAAY,YAIX;AAJD,WAAY,YAAY;IACpB,qDAAO,CAAA;IACP,mDAAM,CAAA;IACN,qDAAO,CAAA;AACX,CAAC,EAJW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAIvB;AAED,mFAAmF;AACnF,+EAA+E;AAC/E,6DAA6D;AAC7D,SAAgB,QAAQ;IACpB,2CAA2C;IAC3C,IAAI,OAAO,SAAS,KAAK,QAAQ,IAAI,SAAS,KAAK,IAAI,IAAI,OAAO,SAAS,CAAC,MAAM,KAAK,SAAS,EAAE;QAC9F,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC;KACxE;IACD,OAAO,YAAY,CAAC,OAAO,CAAC;AAChC,CAAC;AAND,4BAMC;AAED;;GAEG;AACH,MAAa,mBAAoB,SAAQ,8BAAY;IAGjD,YACa,cAAsB,EAC/B,OAAe,EACN,QAAiB,EAC1B,KAA4B;QAE5B,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QALb,mBAAc,GAAd,cAAc,CAAQ;QAEtB,aAAQ,GAAR,QAAQ,CAAS;QALrB,cAAS,GAAG,oCAAe,CAAC,mBAAmB,CAAC;IASzD,CAAC;CACJ;AAXD,kDAWC;AAED,oFAAoF;AACpF,yEAAyE;AACzE,qEAAqE;AACrE,u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I,mBAAmB,CAAC,cAAc,EAAE,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,cAAc,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;AAC/F,CAAC;AAXD,8DAWC;AAED;;;;GAIG;AACI,MAAM,eAAe,GAAG,CAAC,KAAU,EAAW,EAAE,CAAC,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,QAAQ,MAAK,IAAI,CAAC;AAApE,QAAA,eAAe,mBAAqD;AAE1E,MAAM,6BAA6B,GAAG,CAAC,KAAU,EAAsB,EAAE,CAC5E,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,iBAAuC,CAAC;AADtC,QAAA,6BAA6B,iCACS;AAE5C,MAAM,sBAAsB,GAAG,CAAC,KAAU,EAAsB,EAAE,CAAC,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,iBAAiB,MAAK,SAAS,CAAC,CAAC;IAC9G,KAAK,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;AADlC,QAAA,sBAAsB,0BACY","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n IThrottlingWarning,\n IDriverErrorBase,\n IAuthorizationError,\n DriverErrorType,\n} from \"@fluidframework/driver-definitions\";\nimport { ITelemetryProperties } from \"@fluidframework/common-definitions\";\nimport { IFluidErrorBase, LoggingError } from \"@fluidframework/telemetry-utils\";\n\nexport enum OnlineStatus {\n Offline,\n Online,\n Unknown,\n}\n\n// It tells if we have local connection only - we might not have connection to web.\n// No solution for node.js (other than resolve dns names / ping specific sites)\n// Can also use window.addEventListener(\"online\" / \"offline\")\nexport function isOnline(): OnlineStatus {\n // eslint-disable-next-line no-null/no-null\n if (typeof navigator === \"object\" && navigator !== null && typeof navigator.onLine === \"boolean\") {\n return navigator.onLine ? OnlineStatus.Online : OnlineStatus.Offline;\n }\n return OnlineStatus.Unknown;\n}\n\n/**\n * Generic network error class.\n */\nexport class GenericNetworkError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {\n readonly errorType = DriverErrorType.genericNetworkError;\n\n constructor(\n readonly fluidErrorCode: string,\n message: string,\n readonly canRetry: boolean,\n props?: ITelemetryProperties,\n ) {\n super(message, props);\n }\n}\n\n// Todo GH #6214: Remove after next drive def bump. This is necessary as there is no\n// compatible way to augment an enum, as it can't be optional. So for now\n// we need to duplicate the value here. We likely need to rethink our\n// DriverErrorType strategy so that it supports extension with optional\n// value.\nconst deltaStreamConnectionForbiddenStr = \"deltaStreamConnectionForbidden\";\nexport class DeltaStreamConnectionForbiddenError extends LoggingError implements IFluidErrorBase {\n static readonly errorType: string =\n DriverErrorType[deltaStreamConnectionForbiddenStr] ?? deltaStreamConnectionForbiddenStr;\n readonly errorType: string = DeltaStreamConnectionForbiddenError.errorType;\n readonly canRetry = false;\n\n constructor(readonly fluidErrorCode: string) {\n super(fluidErrorCode, { statusCode: 400 });\n }\n}\n\nexport class AuthorizationError extends LoggingError implements IAuthorizationError, IFluidErrorBase {\n readonly errorType = DriverErrorType.authorizationError;\n readonly canRetry = false;\n\n constructor(\n readonly fluidErrorCode: string,\n message: string,\n readonly claims: string | undefined,\n readonly tenantId: string | undefined,\n props?: ITelemetryProperties,\n ) {\n // don't log claims or tenantId\n super(message, props, new Set([\"claims\", \"tenantId\"]));\n }\n}\n\nexport class NetworkErrorBasic<T extends string> extends LoggingError implements IFluidErrorBase {\n constructor(\n readonly fluidErrorCode: string,\n message: string,\n readonly errorType: T,\n readonly canRetry: boolean,\n props?: ITelemetryProperties,\n ) {\n super(message, props);\n }\n}\n\nexport class NonRetryableError<T extends string> extends NetworkErrorBasic<T> {\n constructor(\n fluidErrorCode: string,\n message: string | undefined,\n readonly errorType: T,\n props?: ITelemetryProperties,\n ) {\n super(fluidErrorCode, message ?? fluidErrorCode, errorType, false, props);\n }\n}\n\nexport class RetryableError<T extends string> extends NetworkErrorBasic<T> {\n constructor(\n fluidErrorCode: string,\n message: string | undefined,\n readonly errorType: T,\n props?: ITelemetryProperties,\n ) {\n super(fluidErrorCode, message ?? fluidErrorCode, errorType, true, props);\n }\n}\n\n//* Check\n/**\n * Throttling error class - used to communicate all throttling errors\n */\nexport class ThrottlingError extends LoggingError implements IThrottlingWarning, IFluidErrorBase {\n readonly errorType = DriverErrorType.throttlingError;\n readonly canRetry = true;\n\n constructor(\n readonly fluidErrorCode: string,\n message: string,\n readonly retryAfterSeconds: number,\n props?: ITelemetryProperties,\n ) {\n super(message, props);\n }\n}\n\nexport const createWriteError = (fluidErrorCode: string) =>\n new NonRetryableError(fluidErrorCode, undefined, DriverErrorType.writeError);\n\nexport function createGenericNetworkError(\n fluidErrorCode: string,\n message: string | undefined,\n canRetry: boolean,\n retryAfterMs?: number,\n props?: ITelemetryProperties,\n): ThrottlingError | GenericNetworkError {\n if (retryAfterMs !== undefined && canRetry) {\n return new ThrottlingError(fluidErrorCode, message ?? fluidErrorCode, retryAfterMs / 1000, props);\n }\n return new GenericNetworkError(fluidErrorCode, message ?? fluidErrorCode, canRetry, props);\n}\n\n/**\n * Check if a connection error can be retried. Unless explicitly allowed, retry is disallowed.\n * I.e. asserts or unexpected exceptions in our code result in container failure.\n * @param error - The error to inspect for ability to retry\n */\nexport const canRetryOnError = (error: any): boolean => error?.canRetry === true;\n\nexport const getRetryDelaySecondsFromError = (error: any): number | undefined =>\n error?.retryAfterSeconds as number | undefined;\n\nexport const getRetryDelayFromError = (error: any): number | undefined => error?.retryAfterSeconds !== undefined ?\n error.retryAfterSeconds * 1000 : undefined;\n"]}
1
+ {"version":3,"file":"network.js","sourceRoot":"","sources":["../src/network.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAEH,2EAK4C;AAE5C,qEAAgF;AAEhF,IAAY,YAIX;AAJD,WAAY,YAAY;IACpB,qDAAO,CAAA;IACP,mDAAM,CAAA;IACN,qDAAO,CAAA;AACX,CAAC,EAJW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAIv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KAAU,EAAsB,EAAE,CAAC,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,iBAAiB,MAAK,SAAS,CAAC,CAAC;IAC9G,KAAK,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;AADlC,QAAA,sBAAsB,0BACY","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n IThrottlingWarning,\n IDriverErrorBase,\n IAuthorizationError,\n DriverErrorType,\n} from \"@fluidframework/driver-definitions\";\nimport { ITelemetryProperties } from \"@fluidframework/common-definitions\";\nimport { IFluidErrorBase, LoggingError } from \"@fluidframework/telemetry-utils\";\n\nexport enum OnlineStatus {\n Offline,\n Online,\n Unknown,\n}\n\n// It tells if we have local connection only - we might not have connection to web.\n// No solution for node.js (other than resolve dns names / ping specific sites)\n// Can also use window.addEventListener(\"online\" / \"offline\")\nexport function isOnline(): OnlineStatus {\n if (typeof navigator === \"object\" && navigator !== null && typeof navigator.onLine === \"boolean\") {\n return navigator.onLine ? OnlineStatus.Online : OnlineStatus.Offline;\n }\n return OnlineStatus.Unknown;\n}\n\n/**\n * Interface describing errors and warnings raised by any driver code.\n * Not expected to be implemented by a class or an object literal, but rather used in place of\n * any or unknown in various function signatures that pass errors around.\n *\n * \"Any\" in the interface name is a nod to the fact that errorType has lost its type constraint.\n * It will be either DriverErrorType or the specific driver's specialized error type enum,\n * but we can't reference a specific driver's error type enum in this code.\n */\n export interface IAnyDriverError {\n readonly errorType: string;\n readonly message: string;\n canRetry: boolean;\n online?: string;\n}\n\n/** Telemetry props with driver-specific required properties */\nexport type DriverErrorTelemetryProps = ITelemetryProperties & { driverVersion: string | undefined };\n\n/**\n * Generic network error class.\n */\nexport class GenericNetworkError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {\n readonly errorType = DriverErrorType.genericNetworkError;\n\n constructor(\n readonly fluidErrorCode: string,\n message: string,\n readonly canRetry: boolean,\n props: DriverErrorTelemetryProps,\n ) {\n super(message, props);\n }\n}\n\n// Todo GH #6214: Remove after next drive def bump. This is necessary as there is no\n// compatible way to augment an enum, as it can't be optional. So for now\n// we need to duplicate the value here. We likely need to rethink our\n// DriverErrorType strategy so that it supports extension with optional\n// value.\nconst deltaStreamConnectionForbiddenStr = \"deltaStreamConnectionForbidden\";\nexport class DeltaStreamConnectionForbiddenError extends LoggingError implements IFluidErrorBase {\n static readonly errorType: string =\n DriverErrorType[deltaStreamConnectionForbiddenStr] ?? deltaStreamConnectionForbiddenStr;\n readonly errorType: string = DeltaStreamConnectionForbiddenError.errorType;\n readonly canRetry = false;\n\n constructor(readonly fluidErrorCode: string, props: DriverErrorTelemetryProps) {\n super(fluidErrorCode, { ...props, statusCode: 400 });\n }\n}\n\nexport class AuthorizationError extends LoggingError implements IAuthorizationError, IFluidErrorBase {\n readonly errorType = DriverErrorType.authorizationError;\n readonly canRetry = false;\n\n constructor(\n readonly fluidErrorCode: string,\n message: string,\n readonly claims: string | undefined,\n readonly tenantId: string | undefined,\n props: DriverErrorTelemetryProps,\n ) {\n // don't log claims or tenantId\n super(message, props, new Set([\"claims\", \"tenantId\"]));\n }\n}\n\nexport class NetworkErrorBasic<T extends string> extends LoggingError implements IFluidErrorBase {\n constructor(\n readonly fluidErrorCode: string,\n message: string,\n readonly errorType: T,\n readonly canRetry: boolean,\n props: DriverErrorTelemetryProps,\n ) {\n super(message, props);\n }\n}\n\nexport class NonRetryableError<T extends string> extends NetworkErrorBasic<T> {\n constructor(\n fluidErrorCode: string,\n message: string | undefined,\n readonly errorType: T,\n props: DriverErrorTelemetryProps,\n ) {\n super(fluidErrorCode, message ?? fluidErrorCode, errorType, false, props);\n }\n}\n\nexport class RetryableError<T extends string> extends NetworkErrorBasic<T> {\n constructor(\n fluidErrorCode: string,\n message: string | undefined,\n readonly errorType: T,\n props: DriverErrorTelemetryProps,\n ) {\n super(fluidErrorCode, message ?? fluidErrorCode, errorType, true, props);\n }\n}\n\n/**\n * Throttling error class - used to communicate all throttling errors\n */\nexport class ThrottlingError extends LoggingError implements IThrottlingWarning, IFluidErrorBase {\n readonly errorType = DriverErrorType.throttlingError;\n readonly canRetry = true;\n\n constructor(\n readonly fluidErrorCode: string,\n message: string,\n readonly retryAfterSeconds: number,\n props: DriverErrorTelemetryProps,\n ) {\n super(message, props);\n }\n}\n\nexport const createWriteError = (fluidErrorCode: string, props: DriverErrorTelemetryProps) =>\n new NonRetryableError(fluidErrorCode, undefined, DriverErrorType.writeError, props);\n\nexport function createGenericNetworkError(\n fluidErrorCode: string,\n message: string | undefined,\n retryInfo: {canRetry: boolean, retryAfterMs?: number },\n props: DriverErrorTelemetryProps,\n): ThrottlingError | GenericNetworkError {\n if (retryInfo.retryAfterMs !== undefined && retryInfo.canRetry) {\n return new ThrottlingError(\n fluidErrorCode, message ?? fluidErrorCode, retryInfo.retryAfterMs / 1000, props);\n }\n return new GenericNetworkError(fluidErrorCode, message ?? fluidErrorCode, retryInfo.canRetry, props);\n}\n\n/**\n * Check if a connection error can be retried. Unless explicitly allowed, retry is disallowed.\n * I.e. asserts or unexpected exceptions in our code result in container failure.\n * @param error - The error to inspect for ability to retry\n */\nexport const canRetryOnError = (error: any): boolean => error?.canRetry === true;\n\nexport const getRetryDelaySecondsFromError = (error: any): number | undefined =>\n error?.retryAfterSeconds as number | undefined;\n\nexport const getRetryDelayFromError = (error: any): number | undefined => error?.retryAfterSeconds !== undefined ?\n error.retryAfterSeconds * 1000 : undefined;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"networkUtils.d.ts","sourceRoot":"","sources":["../src/networkUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAG5F,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,gBAAgB,EAAE,KAAK,EAAE,oBAAoB,EAAE,KAAK,CAAC,EAAE,GAAG,QAuBnG;AAED;;;;;;;;GAQG;AAEH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAoBrE"}
1
+ {"version":3,"file":"networkUtils.d.ts","sourceRoot":"","sources":["../src/networkUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAG5F,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,gBAAgB,EAAE,KAAK,EAAE,oBAAoB,EAAE,KAAK,CAAC,EAAE,GAAG,QAoBnG;AAED;;;;;;;;GAQG;AAEH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAoBrE"}
@@ -13,11 +13,9 @@ function logNetworkFailure(logger, event, error) {
13
13
  if ((error === null || error === void 0 ? void 0 : error.online) !== undefined) {
14
14
  newEvent.online = error.online;
15
15
  }
16
- // eslint-disable-next-line no-null/no-null
17
16
  if (typeof navigator === "object" && navigator !== null) {
18
17
  const nav = navigator;
19
18
  const connection = (_b = (_a = nav.connection) !== null && _a !== void 0 ? _a : nav.mozConnection) !== null && _b !== void 0 ? _b : nav.webkitConnection;
20
- // eslint-disable-next-line no-null/no-null
21
19
  if (connection !== null && typeof connection === "object") {
22
20
  newEvent.connectionType = connection.type;
23
21
  }
@@ -1 +1 @@
1
- {"version":3,"file":"networkUtils.js","sourceRoot":"","sources":["../src/networkUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,uCAAoE;AAEpE,SAAgB,iBAAiB,CAAC,MAAwB,EAAE,KAA2B,EAAE,KAAW;;IAChG,MAAM,QAAQ,qBAAQ,KAAK,CAAE,CAAC;IAC9B,QAAQ,CAAC,MAAM,GAAG,kBAAQ,EAAE,CAAC;IAC7B,IAAI,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,MAAM,MAAK,SAAS,EAAE;QAC7B,QAAQ,CAAC,MAAM,GAAG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CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;gBACnD,CAAC,CAAC;gBACF,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;gBACnD,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAC;aACpD;SACJ;QACD,UAAU,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IAChC,CAAC,CAAC,CAAC;AACP,CAAC;AApBD,sDAoBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryErrorEvent, ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { isOnline, OnlineStatus, canRetryOnError } from \"./network\";\n\nexport function logNetworkFailure(logger: ITelemetryLogger, event: ITelemetryErrorEvent, error?: any) {\n const newEvent = { ...event };\n newEvent.online = isOnline();\n if (error?.online !== undefined) {\n newEvent.online = error.online as string;\n }\n\n // eslint-disable-next-line no-null/no-null\n if (typeof navigator === \"object\" && navigator !== null) {\n const nav = navigator as any;\n const connection = nav.connection ?? nav.mozConnection ?? nav.webkitConnection;\n // eslint-disable-next-line no-null/no-null\n if (connection !== null && typeof connection === \"object\") {\n newEvent.connectionType = connection.type;\n }\n }\n\n // If we are online, log it as an error, such that we look at it ASAP.\n // But if we are offline, log non-error event - we will remove\n // it in the future once confident it's right thing to do.\n // Note: Unfortunately false positives happen in here (i.e. cable disconnected, but it reports true)!\n newEvent.category = (newEvent.online === OnlineStatus.Online || !canRetryOnError(error)) ? \"error\" : \"generic\";\n logger.sendTelemetryEvent(newEvent, error);\n}\n\n/**\n * Wait for browser to get to connected state.\n * If connected, waits minimum of minDelay anyway (between network retries)\n * If disconnected, polls every 30 seconds anyway, to make sure we are not getting stuck because of wrong signal\n * Note that browsers will have false positives (like having Hyper-V adapter on machine,\n * or machine connected to router that is not connected to internet)\n * But there should be no false negatives.\n * The only exception - Opera returns false when user enters \"Work Offline\" mode, regardless of actual connectivity.\n */\n// eslint-disable-next-line @typescript-eslint/promise-function-async\nexport function waitForConnectedState(minDelay: number): Promise<void> {\n // Use this frequency to poll even when we are offline and able to setup online/offline listener\n // This is mostly safety net\n const offlinePollFrequency = 30000;\n\n return new Promise((resolve) => {\n let listener: () => void = resolve;\n let delay = minDelay;\n if (isOnline() === OnlineStatus.Offline) {\n if (window?.addEventListener !== undefined) {\n listener = () => {\n resolve();\n window.removeEventListener(\"online\", listener);\n };\n window.addEventListener(\"online\", listener, false);\n delay = Math.max(minDelay, offlinePollFrequency);\n }\n }\n setTimeout(listener, delay);\n });\n}\n"]}
1
+ {"version":3,"file":"networkUtils.js","sourceRoot":"","sources":["../src/networkUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,uCAAoE;AAEpE,SAAgB,iBAAiB,CAAC,MAAwB,EAAE,KAA2B,EAAE,KAAW;;IAChG,MAAM,QAAQ,qBAAQ,KAAK,CAAE,CAAC;IAC9B,QAAQ,CAAC,MAAM,GAAG,kBAAQ,EAAE,CAAC;IAC7B,IAAI,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,MAAM,MAAK,SAAS,EAAE;QAC7B,QAAQ,CAAC,MAAM,GAAG,KAAK,CAAC,MAAgB,CAAC;KAC5C;IACD,IAAI,OAAO,SAAS,KAAK,QAAQ,IAAI,SAAS,KAAK,IAAI,EAAE;QACrD,MAAM,GAAG,GAAG,SAAgB,CAAC;QAC7B,MAAM,UAAU,eAAG,GAAG,CAAC,UAAU,mCAAI,GAAG,CAAC,aAAa,mCAAI,GAAG,CAAC,gBAAgB,CAAC;QAC/E,IAAI,UAAU,KAAK,IAAI,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE;YACvD,QAAQ,CAAC,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC;SAC7C;KACJ;IAED,sEAAsE;IACtE,8DAA8D;IAC9D,0DAA0D;IAC1D,qGAAqG;IACrG,QAAQ,CAAC,QAAQ,GAAG,CAAC,QAAQ,CAAC,MAAM,KAAK,sBAAY,CAAC,MAAM,IAAI,CAAC,yBAAe,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;IAC/G,MAAM,CAAC,kBAAkB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;AAC/C,CAAC;AApBD,8CAoBC;AAED;;;;;;;;GAQG;AACH,qEAAqE;AACrE,SAAgB,qBAAqB,CAAC,QAAgB;IAClD,gGAAgG;IAChG,4BAA4B;IAC5B,MAAM,oBAAoB,GAAG,KAAK,CAAC;IAEnC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC3B,IAAI,QAAQ,GAAe,OAAO,CAAC;QACnC,IAAI,KAAK,GAAG,QAAQ,CAAC;QACrB,IAAI,kBAAQ,EAAE,KAAK,sBAAY,CAAC,OAAO,EAAE;YACrC,IAAI,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,gBAAgB,MAAK,SAAS,EAAE;gBACxC,QAAQ,GAAG,GAAG,EAAE;oBACZ,OAAO,EAAE,CAAC;oBACV,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;gBACnD,CAAC,CAAC;gBACF,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;gBACnD,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAC;aACpD;SACJ;QACD,UAAU,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IAChC,CAAC,CAAC,CAAC;AACP,CAAC;AApBD,sDAoBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryErrorEvent, ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { isOnline, OnlineStatus, canRetryOnError } from \"./network\";\n\nexport function logNetworkFailure(logger: ITelemetryLogger, event: ITelemetryErrorEvent, error?: any) {\n const newEvent = { ...event };\n newEvent.online = isOnline();\n if (error?.online !== undefined) {\n newEvent.online = error.online as string;\n }\n if (typeof navigator === \"object\" && navigator !== null) {\n const nav = navigator as any;\n const connection = nav.connection ?? nav.mozConnection ?? nav.webkitConnection;\n if (connection !== null && typeof connection === \"object\") {\n newEvent.connectionType = connection.type;\n }\n }\n\n // If we are online, log it as an error, such that we look at it ASAP.\n // But if we are offline, log non-error event - we will remove\n // it in the future once confident it's right thing to do.\n // Note: Unfortunately false positives happen in here (i.e. cable disconnected, but it reports true)!\n newEvent.category = (newEvent.online === OnlineStatus.Online || !canRetryOnError(error)) ? \"error\" : \"generic\";\n logger.sendTelemetryEvent(newEvent, error);\n}\n\n/**\n * Wait for browser to get to connected state.\n * If connected, waits minimum of minDelay anyway (between network retries)\n * If disconnected, polls every 30 seconds anyway, to make sure we are not getting stuck because of wrong signal\n * Note that browsers will have false positives (like having Hyper-V adapter on machine,\n * or machine connected to router that is not connected to internet)\n * But there should be no false negatives.\n * The only exception - Opera returns false when user enters \"Work Offline\" mode, regardless of actual connectivity.\n */\n// eslint-disable-next-line @typescript-eslint/promise-function-async\nexport function waitForConnectedState(minDelay: number): Promise<void> {\n // Use this frequency to poll even when we are offline and able to setup online/offline listener\n // This is mostly safety net\n const offlinePollFrequency = 30000;\n\n return new Promise((resolve) => {\n let listener: () => void = resolve;\n let delay = minDelay;\n if (isOnline() === OnlineStatus.Offline) {\n if (window?.addEventListener !== undefined) {\n listener = () => {\n resolve();\n window.removeEventListener(\"online\", listener);\n };\n window.addEventListener(\"online\", listener, false);\n delay = Math.max(minDelay, offlinePollFrequency);\n }\n }\n setTimeout(listener, delay);\n });\n}\n"]}
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export declare const pkgName = "@fluidframework/driver-utils";
8
- export declare const pkgVersion = "0.56.3";
8
+ export declare const pkgVersion = "0.57.0-51086";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,iCAAiC,CAAC;AACtD,eAAO,MAAM,UAAU,WAAW,CAAC"}
1
+ {"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,iCAAiC,CAAC;AACtD,eAAO,MAAM,UAAU,iBAAiB,CAAC"}
@@ -8,5 +8,5 @@
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.pkgVersion = exports.pkgName = void 0;
10
10
  exports.pkgName = "@fluidframework/driver-utils";
11
- exports.pkgVersion = "0.56.3";
11
+ exports.pkgVersion = "0.57.0-51086";
12
12
  //# sourceMappingURL=packageVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,8BAA8B,CAAC;AACzC,QAAA,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/driver-utils\";\nexport const pkgVersion = \"0.56.3\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,8BAA8B,CAAC;AACzC,QAAA,UAAU,GAAG,cAAc,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/driver-utils\";\nexport const pkgVersion = \"0.57.0-51086\";\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"parallelRequests.d.ts","sourceRoot":"","sources":["../src/parallelRequests.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAE5F,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EAAE,kBAAkB,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AAShG;;;;;;;;;;;GAWG;AACH,qBAAa,gBAAgB,CAAC,CAAC;IAevB,OAAO,CAAC,EAAE;IACV,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,eAAe;IAMhC,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IAvBrC,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA+B;IACvD,OAAO,CAAC,YAAY,CAA2B;IAC/C,OAAO,CAAC,gBAAgB,CAAK;IAC7B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAwB;IACjD,OAAO,CAAC,QAAQ,CAAK;IACrB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAU;IAEjC,OAAO,KAAK,OAAO,GAA8C;IACjE,IAAW,QAAQ,YAA+C;gBAG9D,IAAI,EAAE,MAAM,EACJ,EAAE,EAAE,MAAM,GAAG,SAAS,EACb,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,gBAAgB,EACxB,eAAe,EAAE,CAC9B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,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AAC,kBAAkB,CAAC,EACpG,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,gBAAgB,EACxB,MAAM,CAAC,EAAE,WAAW,EACpB,WAAW,CAAC,EAAE,MAAM,GACrB,OAAO,CAAC,yBAAyB,EAAE,CAAC,CAsFtC;AAED,eAAO,MAAM,kBAAkB,EAAE,OAAO,CAAC,yBAAyB,EAAE,CAEnE,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,OAAO,CAAC,yBAAyB,EAAE,CAAC,GAChF,OAAO,CAAC,yBAAyB,EAAE,CAAC,CAavC;AAED,wBAAgB,cAAc,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,CAQ5G"}
@@ -9,6 +9,8 @@ const common_utils_1 = require("@fluidframework/common-utils");
9
9
  const telemetry_utils_1 = require("@fluidframework/telemetry-utils");
10
10
  const network_1 = require("./network");
11
11
  const networkUtils_1 = require("./networkUtils");
12
+ // For now, this package is versioned and released in unison with the specific drivers
13
+ const packageVersion_1 = require("./packageVersion");
12
14
  const MaxFetchDelayInMs = 10000;
13
15
  const MissingFetchDelayInMs = 100;
14
16
  /**
@@ -336,7 +338,8 @@ async function getSingleOpBatch(get, props, strongTo, logger, signal, fetchReaso
336
338
  // then give up after some time. This likely indicates the issue with ordering service not flushing
337
339
  // ops to storage quick enough, and possibly waiting for summaries, while summarizer can't get
338
340
  // current as it can't get ops.
339
- throw network_1.createGenericNetworkError("failedToRetrieveOpsFromStorage:TooManyRetries", undefined, false /* canRetry */, undefined /* retryAfterSeconds */, Object.assign({ retry }, props));
341
+ throw network_1.createGenericNetworkError("failedToRetrieveOpsFromStorage:TooManyRetries", undefined, { canRetry: false }, Object.assign({ retry,
342
+ driverVersion: packageVersion_1.pkgVersion }, props));
340
343
  }
341
344
  }
342
345
  catch (error) {