@fluidframework/driver-utils 2.0.0-internal.7.3.0 → 2.0.0-internal.8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/api-extractor-lint.json +13 -0
- package/api-extractor.json +9 -1
- package/api-report/driver-utils.api.md +47 -47
- package/dist/adapters/compression/compressionTypes.d.ts +2 -2
- package/dist/adapters/compression/compressionTypes.js +1 -1
- package/dist/adapters/compression/compressionTypes.js.map +1 -1
- package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.ts +1 -1
- package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js +1 -1
- package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js.map +1 -1
- package/dist/adapters/predefinedAdapters.d.ts +1 -1
- package/dist/adapters/predefinedAdapters.js +1 -1
- package/dist/adapters/predefinedAdapters.js.map +1 -1
- package/dist/blob.d.ts +3 -3
- package/dist/blob.js +3 -3
- package/dist/blob.js.map +1 -1
- package/dist/buildSnapshotTree.d.ts +1 -1
- package/dist/buildSnapshotTree.js +1 -1
- package/dist/buildSnapshotTree.js.map +1 -1
- package/dist/documentStorageServiceProxy.d.ts +1 -1
- package/dist/documentStorageServiceProxy.js +1 -1
- package/dist/documentStorageServiceProxy.js.map +1 -1
- package/dist/driver-utils-alpha.d.ts +169 -0
- package/dist/driver-utils-beta.d.ts +176 -0
- package/dist/driver-utils-public.d.ts +176 -0
- package/dist/driver-utils-untrimmed.d.ts +590 -0
- package/dist/error.d.ts +1 -1
- package/dist/error.js +1 -1
- package/dist/error.js.map +1 -1
- package/dist/insecureUrlResolver.d.ts +1 -1
- package/dist/insecureUrlResolver.js +1 -1
- package/dist/insecureUrlResolver.js.map +1 -1
- package/dist/messageRecognition.d.ts +3 -3
- package/dist/messageRecognition.js +3 -3
- package/dist/messageRecognition.js.map +1 -1
- package/dist/network.d.ts +19 -19
- package/dist/network.d.ts.map +1 -1
- package/dist/network.js +18 -18
- package/dist/network.js.map +1 -1
- package/dist/networkUtils.d.ts +1 -1
- package/dist/networkUtils.js +1 -1
- package/dist/networkUtils.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/parallelRequests.d.ts +6 -6
- package/dist/parallelRequests.js +6 -6
- package/dist/parallelRequests.js.map +1 -1
- package/dist/prefetchDocumentStorageService.d.ts +1 -1
- package/dist/prefetchDocumentStorageService.js +1 -1
- package/dist/prefetchDocumentStorageService.js.map +1 -1
- package/dist/rateLimiter.d.ts +1 -1
- package/dist/rateLimiter.js +1 -1
- package/dist/rateLimiter.js.map +1 -1
- package/dist/readAndParse.d.ts +1 -1
- package/dist/readAndParse.js +1 -1
- package/dist/readAndParse.js.map +1 -1
- package/dist/runWithRetry.d.ts +3 -3
- package/dist/runWithRetry.js +2 -2
- package/dist/runWithRetry.js.map +1 -1
- package/dist/summaryForCreateNew.d.ts +2 -2
- package/dist/summaryForCreateNew.js +2 -2
- package/dist/summaryForCreateNew.js.map +1 -1
- package/dist/treeConversions.d.ts +1 -1
- package/dist/treeConversions.js +1 -1
- package/dist/treeConversions.js.map +1 -1
- package/lib/adapters/compression/compressionTypes.d.ts +2 -2
- package/lib/adapters/compression/compressionTypes.js +1 -1
- package/lib/adapters/compression/compressionTypes.js.map +1 -1
- package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.ts +1 -1
- package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js +1 -1
- package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js.map +1 -1
- package/lib/adapters/predefinedAdapters.d.ts +1 -1
- package/lib/adapters/predefinedAdapters.js +1 -1
- package/lib/adapters/predefinedAdapters.js.map +1 -1
- package/lib/blob.d.ts +3 -3
- package/lib/blob.js +3 -3
- package/lib/blob.js.map +1 -1
- package/lib/buildSnapshotTree.d.ts +1 -1
- package/lib/buildSnapshotTree.js +1 -1
- package/lib/buildSnapshotTree.js.map +1 -1
- package/lib/documentStorageServiceProxy.d.ts +1 -1
- package/lib/documentStorageServiceProxy.js +1 -1
- package/lib/documentStorageServiceProxy.js.map +1 -1
- package/lib/driver-utils-alpha.d.ts +169 -0
- package/lib/driver-utils-beta.d.ts +176 -0
- package/lib/driver-utils-public.d.ts +176 -0
- package/lib/driver-utils-untrimmed.d.ts +590 -0
- package/lib/error.d.ts +1 -1
- package/lib/error.js +1 -1
- package/lib/error.js.map +1 -1
- package/lib/insecureUrlResolver.d.ts +1 -1
- package/lib/insecureUrlResolver.js +1 -1
- package/lib/insecureUrlResolver.js.map +1 -1
- package/lib/messageRecognition.d.ts +3 -3
- package/lib/messageRecognition.js +3 -3
- package/lib/messageRecognition.js.map +1 -1
- package/lib/network.d.ts +19 -19
- package/lib/network.d.ts.map +1 -1
- package/lib/network.js +18 -18
- package/lib/network.js.map +1 -1
- package/lib/networkUtils.d.ts +1 -1
- package/lib/networkUtils.js +1 -1
- package/lib/networkUtils.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/parallelRequests.d.ts +6 -6
- package/lib/parallelRequests.js +6 -6
- package/lib/parallelRequests.js.map +1 -1
- package/lib/prefetchDocumentStorageService.d.ts +1 -1
- package/lib/prefetchDocumentStorageService.js +1 -1
- package/lib/prefetchDocumentStorageService.js.map +1 -1
- package/lib/rateLimiter.d.ts +1 -1
- package/lib/rateLimiter.js +1 -1
- package/lib/rateLimiter.js.map +1 -1
- package/lib/readAndParse.d.ts +1 -1
- package/lib/readAndParse.js +1 -1
- package/lib/readAndParse.js.map +1 -1
- package/lib/runWithRetry.d.ts +3 -3
- package/lib/runWithRetry.js +2 -2
- package/lib/runWithRetry.js.map +1 -1
- package/lib/summaryForCreateNew.d.ts +2 -2
- package/lib/summaryForCreateNew.js +2 -2
- package/lib/summaryForCreateNew.js.map +1 -1
- package/lib/treeConversions.d.ts +1 -1
- package/lib/treeConversions.js +1 -1
- package/lib/treeConversions.js.map +1 -1
- package/package.json +31 -12
- package/src/adapters/compression/compressionTypes.ts +2 -2
- package/src/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.ts +1 -1
- package/src/adapters/predefinedAdapters.ts +1 -1
- package/src/blob.ts +3 -3
- package/src/buildSnapshotTree.ts +1 -1
- package/src/documentStorageServiceProxy.ts +1 -1
- package/src/error.ts +1 -1
- package/src/insecureUrlResolver.ts +1 -1
- package/src/messageRecognition.ts +3 -3
- package/src/network.ts +19 -19
- package/src/networkUtils.ts +1 -1
- package/src/packageVersion.ts +1 -1
- package/src/parallelRequests.ts +6 -6
- package/src/prefetchDocumentStorageService.ts +1 -1
- package/src/rateLimiter.ts +1 -1
- package/src/readAndParse.ts +1 -1
- package/src/runWithRetry.ts +3 -3
- package/src/summaryForCreateNew.ts +2 -2
- package/src/treeConversions.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insecureUrlResolver.js","sourceRoot":"","sources":["../src/insecureUrlResolver.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,6BAA4B;AAC5B,2DAAoD;AAEpD,2EAA8F;AAC9F,kDAA0B;AAE1B;;;;;;;;;;;;;;GAcG;AACH,MAAa,mBAAmB;IAG/B,YACkB,OAAe,EACf,UAAkB,EAClB,UAAkB,EAClB,QAAgB,EAChB,MAAc,EACd,gBAAyB,KAAK;QAL9B,YAAO,GAAP,OAAO,CAAQ;QACf,eAAU,GAAV,UAAU,CAAQ;QAClB,eAAU,GAAV,UAAU,CAAQ;QAClB,aAAQ,GAAR,QAAQ,CAAQ;QAChB,WAAM,GAAN,MAAM,CAAQ;QACd,kBAAa,GAAb,aAAa,CAAiB;QAR/B,UAAK,GAAG,IAAI,GAAG,EAAiC,CAAC;IAS/D,CAAC;IAEG,KA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AU,CAAC,GAAG,CAAC,EAAE;YACxB,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;SACpB;QAED,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,kBAAkB,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,kBAAkB,CAChF,UAAU,CACV,IAAI,GAAG,EAAE,CAAC;IACZ,CAAC;IAEM,sBAAsB,CAAC,QAAiB;QAC9C,MAAM,gBAAgB,GAAa;YAClC,yEAAyE;YACzE,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO,aAAa,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO;YACrE,OAAO,EAAE;gBACR,CAAC,iCAAY,CAAC,SAAS,CAAC,EAAE,IAAI;aAC9B;SACD,CAAC;QACF,OAAO,gBAAgB,CAAC;IACzB,CAAC;CACD;AAtID,kDAsIC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { parse } from \"url\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport { IRequest } from \"@fluidframework/core-interfaces\";\nimport { IResolvedUrl, IUrlResolver, DriverHeader } from \"@fluidframework/driver-definitions\";\nimport Axios from \"axios\";\n\n/**\n * As the name implies this is not secure and should not be used in production. It simply makes the example easier\n * to get up and running.\n *\n * In our example we run a simple web server via webpack-dev-server. This defines a URL format of the form\n * http://localhost:8080/<documentId>/<path>.\n *\n * We then need to map that to a Fluid based URL. These are of the form\n * fluid://orderingUrl/<tenantId>/<documentId>/<path>.\n *\n * The tenantId/documentId pair defines the 'full' document ID the service makes use of. The path is then an optional\n * part of the URL that the document interprets and maps to a data store. It's exactly similar to how a web service\n * works or a router inside of a single page app framework.\n * @public\n */\nexport class InsecureUrlResolver implements IUrlResolver {\n\tprivate readonly cache = new Map<string, Promise<IResolvedUrl>>();\n\n\tconstructor(\n\t\tprivate readonly hostUrl: string,\n\t\tprivate readonly ordererUrl: string,\n\t\tprivate readonly storageUrl: string,\n\t\tprivate readonly tenantId: string,\n\t\tprivate readonly bearer: string,\n\t\tprivate readonly isForNodeTest: boolean = false,\n\t) {}\n\n\tpublic async resolve(request: IRequest): Promise<IResolvedUrl | undefined> {\n\t\t// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n\t\tif (request.headers?.[DriverHeader.createNew]) {\n\t\t\tconst [, queryString] = request.url.split(\"?\");\n\t\t\tconst searchParams = new URLSearchParams(queryString);\n\t\t\tconst fileName = searchParams.get(\"fileName\");\n\t\t\treturn this.resolveHelper(fileName);\n\t\t}\n\t\tconst parsedUrl = new URL(request.url);\n\t\t// If hosts match then we use the local tenant information. Otherwise we make a REST call out to the hosting\n\t\t// service using our bearer token.\n\t\tif (this.isForNodeTest) {\n\t\t\tconst [, documentId, tmpRelativePath] = parsedUrl.pathname.substr(1).split(\"/\");\n\t\t\tconst relativePath = tmpRelativePath ?? \"\";\n\t\t\treturn this.resolveHelper(documentId, relativePath, parsedUrl.search);\n\t\t} else if (parsedUrl.host === window.location.host) {\n\t\t\tconst fullPath = parsedUrl.pathname.substr(1);\n\t\t\tconst documentId = fullPath.split(\"/\")[0];\n\t\t\tconst documentRelativePath = fullPath.slice(documentId.length);\n\t\t\treturn this.resolveHelper(documentId, documentRelativePath);\n\t\t} else {\n\t\t\tconst maybeResolvedUrl = this.cache.get(request.url);\n\t\t\tif (maybeResolvedUrl) {\n\t\t\t\treturn maybeResolvedUrl;\n\t\t\t}\n\n\t\t\tconst headers = {\n\t\t\t\tAuthorization: `Bearer ${this.bearer}`,\n\t\t\t};\n\t\t\tconst resolvedP = Axios.post<IResolvedUrl>(\n\t\t\t\t`${this.hostUrl}/api/v1/load`,\n\t\t\t\t{\n\t\t\t\t\turl: request.url,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\theaders,\n\t\t\t\t},\n\t\t\t);\n\t\t\tthis.cache.set(\n\t\t\t\trequest.url,\n\t\t\t\tresolvedP.then((resolved) => resolved.data),\n\t\t\t);\n\n\t\t\treturn this.cache.get(request.url);\n\t\t}\n\t}\n\n\tprivate resolveHelper(\n\t\tdocumentId: string | null,\n\t\tdocumentRelativePath: string = \"\",\n\t\tqueryParams: string = \"\",\n\t) {\n\t\tconst encodedTenantId = encodeURIComponent(this.tenantId);\n\t\tconst host = new URL(this.ordererUrl).host;\n\t\t// when the document ID is not provided we need to resolve a special create new document URL.\n\t\t// the actual container ID will be generated by the driver.\n\t\t// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n\t\tif (!documentId) {\n\t\t\tconst createNewResponse: IResolvedUrl = {\n\t\t\t\tendpoints: {\n\t\t\t\t\tdeltaStorageUrl: `${this.ordererUrl}/deltas/${encodedTenantId}/new`,\n\t\t\t\t\tordererUrl: this.ordererUrl,\n\t\t\t\t\tstorageUrl: `${this.storageUrl}/repos/${encodedTenantId}`,\n\t\t\t\t},\n\t\t\t\t// document ID is ignored by the driver for new container requests\n\t\t\t\tid: \"\",\n\t\t\t\ttokens: {},\n\t\t\t\ttype: \"fluid\",\n\t\t\t\turl: `fluid://${host}/${encodedTenantId}/new`,\n\t\t\t};\n\t\t\treturn createNewResponse;\n\t\t}\n\t\tconst encodedDocId = encodeURIComponent(documentId);\n\t\tconst relativePath =\n\t\t\t!documentRelativePath || documentRelativePath.startsWith(\"/\")\n\t\t\t\t? documentRelativePath\n\t\t\t\t: `/${documentRelativePath}`;\n\t\tconst documentUrl = `fluid://${host}/${encodedTenantId}/${encodedDocId}${relativePath}${queryParams}`;\n\n\t\tconst deltaStorageUrl = `${this.ordererUrl}/deltas/${encodedTenantId}/${encodedDocId}`;\n\t\tconst storageUrl = `${this.storageUrl}/repos/${encodedTenantId}`;\n\n\t\tconst response: IResolvedUrl = {\n\t\t\tendpoints: {\n\t\t\t\tdeltaStorageUrl,\n\t\t\t\tordererUrl: this.ordererUrl,\n\t\t\t\tstorageUrl,\n\t\t\t},\n\t\t\tid: documentId,\n\t\t\ttokens: {},\n\t\t\ttype: \"fluid\",\n\t\t\turl: documentUrl,\n\t\t};\n\t\treturn response;\n\t}\n\n\tpublic async getAbsoluteUrl(resolvedUrl: IResolvedUrl, relativeUrl: string): Promise<string> {\n\t\tconst parsedUrl = parse(resolvedUrl.url);\n\t\tconst [, , documentId] = parsedUrl.pathname?.split(\"/\") ?? [];\n\t\t// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n\t\tassert(!!documentId, 0x273 /* \"Invalid document id from parsed URL\" */);\n\n\t\tlet url = relativeUrl;\n\t\tif (url.startsWith(\"/\")) {\n\t\t\turl = url.substr(1);\n\t\t}\n\n\t\treturn `${this.hostUrl}/${encodeURIComponent(this.tenantId)}/${encodeURIComponent(\n\t\t\tdocumentId,\n\t\t)}/${url}`;\n\t}\n\n\tpublic createCreateNewRequest(fileName?: string): IRequest {\n\t\tconst createNewRequest: IRequest = {\n\t\t\t// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n\t\t\turl: fileName ? `${this.hostUrl}?fileName=${fileName}` : this.hostUrl,\n\t\t\theaders: {\n\t\t\t\t[DriverHeader.createNew]: true,\n\t\t\t},\n\t\t};\n\t\treturn createNewRequest;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"insecureUrlResolver.js","sourceRoot":"","sources":["../src/insecureUrlResolver.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,6BAA4B;AAC5B,2DAAoD;AAEpD,2EAA8F;AAC9F,kDAA0B;AAE1B;;;;;;;;;;;;;;GAcG;AACH,MAAa,mBAAmB;IAG/B,YACkB,OAAe,EACf,UAAkB,EAClB,UAAkB,EAClB,QAAgB,EAChB,MAAc,EACd,gBAAyB,KAAK;QAL9B,YAAO,GAAP,OAAO,CAAQ;QACf,eAAU,GAAV,UAAU,CAAQ;QAClB,eAAU,GAAV,UAAU,CAAQ;QAClB,aAAQ,GAAR,QAAQ,CAAQ;QAChB,WAAM,GAAN,MAAM,CAAQ;QACd,kBAAa,GAAb,aA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C,CAAC,CAAC;QAExE,IAAI,GAAG,GAAG,WAAW,CAAC;QACtB,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;YACxB,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;SACpB;QAED,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,kBAAkB,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,kBAAkB,CAChF,UAAU,CACV,IAAI,GAAG,EAAE,CAAC;IACZ,CAAC;IAEM,sBAAsB,CAAC,QAAiB;QAC9C,MAAM,gBAAgB,GAAa;YAClC,yEAAyE;YACzE,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO,aAAa,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO;YACrE,OAAO,EAAE;gBACR,CAAC,iCAAY,CAAC,SAAS,CAAC,EAAE,IAAI;aAC9B;SACD,CAAC;QACF,OAAO,gBAAgB,CAAC;IACzB,CAAC;CACD;AAtID,kDAsIC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { parse } from \"url\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport { IRequest } from \"@fluidframework/core-interfaces\";\nimport { IResolvedUrl, IUrlResolver, DriverHeader } from \"@fluidframework/driver-definitions\";\nimport Axios from \"axios\";\n\n/**\n * As the name implies this is not secure and should not be used in production. It simply makes the example easier\n * to get up and running.\n *\n * In our example we run a simple web server via webpack-dev-server. This defines a URL format of the form\n * http://localhost:8080/<documentId>/<path>.\n *\n * We then need to map that to a Fluid based URL. These are of the form\n * fluid://orderingUrl/<tenantId>/<documentId>/<path>.\n *\n * The tenantId/documentId pair defines the 'full' document ID the service makes use of. The path is then an optional\n * part of the URL that the document interprets and maps to a data store. It's exactly similar to how a web service\n * works or a router inside of a single page app framework.\n * @internal\n */\nexport class InsecureUrlResolver implements IUrlResolver {\n\tprivate readonly cache = new Map<string, Promise<IResolvedUrl>>();\n\n\tconstructor(\n\t\tprivate readonly hostUrl: string,\n\t\tprivate readonly ordererUrl: string,\n\t\tprivate readonly storageUrl: string,\n\t\tprivate readonly tenantId: string,\n\t\tprivate readonly bearer: string,\n\t\tprivate readonly isForNodeTest: boolean = false,\n\t) {}\n\n\tpublic async resolve(request: IRequest): Promise<IResolvedUrl | undefined> {\n\t\t// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n\t\tif (request.headers?.[DriverHeader.createNew]) {\n\t\t\tconst [, queryString] = request.url.split(\"?\");\n\t\t\tconst searchParams = new URLSearchParams(queryString);\n\t\t\tconst fileName = searchParams.get(\"fileName\");\n\t\t\treturn this.resolveHelper(fileName);\n\t\t}\n\t\tconst parsedUrl = new URL(request.url);\n\t\t// If hosts match then we use the local tenant information. Otherwise we make a REST call out to the hosting\n\t\t// service using our bearer token.\n\t\tif (this.isForNodeTest) {\n\t\t\tconst [, documentId, tmpRelativePath] = parsedUrl.pathname.substr(1).split(\"/\");\n\t\t\tconst relativePath = tmpRelativePath ?? \"\";\n\t\t\treturn this.resolveHelper(documentId, relativePath, parsedUrl.search);\n\t\t} else if (parsedUrl.host === window.location.host) {\n\t\t\tconst fullPath = parsedUrl.pathname.substr(1);\n\t\t\tconst documentId = fullPath.split(\"/\")[0];\n\t\t\tconst documentRelativePath = fullPath.slice(documentId.length);\n\t\t\treturn this.resolveHelper(documentId, documentRelativePath);\n\t\t} else {\n\t\t\tconst maybeResolvedUrl = this.cache.get(request.url);\n\t\t\tif (maybeResolvedUrl) {\n\t\t\t\treturn maybeResolvedUrl;\n\t\t\t}\n\n\t\t\tconst headers = {\n\t\t\t\tAuthorization: `Bearer ${this.bearer}`,\n\t\t\t};\n\t\t\tconst resolvedP = Axios.post<IResolvedUrl>(\n\t\t\t\t`${this.hostUrl}/api/v1/load`,\n\t\t\t\t{\n\t\t\t\t\turl: request.url,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\theaders,\n\t\t\t\t},\n\t\t\t);\n\t\t\tthis.cache.set(\n\t\t\t\trequest.url,\n\t\t\t\tresolvedP.then((resolved) => resolved.data),\n\t\t\t);\n\n\t\t\treturn this.cache.get(request.url);\n\t\t}\n\t}\n\n\tprivate resolveHelper(\n\t\tdocumentId: string | null,\n\t\tdocumentRelativePath: string = \"\",\n\t\tqueryParams: string = \"\",\n\t) {\n\t\tconst encodedTenantId = encodeURIComponent(this.tenantId);\n\t\tconst host = new URL(this.ordererUrl).host;\n\t\t// when the document ID is not provided we need to resolve a special create new document URL.\n\t\t// the actual container ID will be generated by the driver.\n\t\t// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n\t\tif (!documentId) {\n\t\t\tconst createNewResponse: IResolvedUrl = {\n\t\t\t\tendpoints: {\n\t\t\t\t\tdeltaStorageUrl: `${this.ordererUrl}/deltas/${encodedTenantId}/new`,\n\t\t\t\t\tordererUrl: this.ordererUrl,\n\t\t\t\t\tstorageUrl: `${this.storageUrl}/repos/${encodedTenantId}`,\n\t\t\t\t},\n\t\t\t\t// document ID is ignored by the driver for new container requests\n\t\t\t\tid: \"\",\n\t\t\t\ttokens: {},\n\t\t\t\ttype: \"fluid\",\n\t\t\t\turl: `fluid://${host}/${encodedTenantId}/new`,\n\t\t\t};\n\t\t\treturn createNewResponse;\n\t\t}\n\t\tconst encodedDocId = encodeURIComponent(documentId);\n\t\tconst relativePath =\n\t\t\t!documentRelativePath || documentRelativePath.startsWith(\"/\")\n\t\t\t\t? documentRelativePath\n\t\t\t\t: `/${documentRelativePath}`;\n\t\tconst documentUrl = `fluid://${host}/${encodedTenantId}/${encodedDocId}${relativePath}${queryParams}`;\n\n\t\tconst deltaStorageUrl = `${this.ordererUrl}/deltas/${encodedTenantId}/${encodedDocId}`;\n\t\tconst storageUrl = `${this.storageUrl}/repos/${encodedTenantId}`;\n\n\t\tconst response: IResolvedUrl = {\n\t\t\tendpoints: {\n\t\t\t\tdeltaStorageUrl,\n\t\t\t\tordererUrl: this.ordererUrl,\n\t\t\t\tstorageUrl,\n\t\t\t},\n\t\t\tid: documentId,\n\t\t\ttokens: {},\n\t\t\ttype: \"fluid\",\n\t\t\turl: documentUrl,\n\t\t};\n\t\treturn response;\n\t}\n\n\tpublic async getAbsoluteUrl(resolvedUrl: IResolvedUrl, relativeUrl: string): Promise<string> {\n\t\tconst parsedUrl = parse(resolvedUrl.url);\n\t\tconst [, , documentId] = parsedUrl.pathname?.split(\"/\") ?? [];\n\t\t// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n\t\tassert(!!documentId, 0x273 /* \"Invalid document id from parsed URL\" */);\n\n\t\tlet url = relativeUrl;\n\t\tif (url.startsWith(\"/\")) {\n\t\t\turl = url.substr(1);\n\t\t}\n\n\t\treturn `${this.hostUrl}/${encodeURIComponent(this.tenantId)}/${encodeURIComponent(\n\t\t\tdocumentId,\n\t\t)}/${url}`;\n\t}\n\n\tpublic createCreateNewRequest(fileName?: string): IRequest {\n\t\tconst createNewRequest: IRequest = {\n\t\t\t// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n\t\t\turl: fileName ? `${this.hostUrl}?fileName=${fileName}` : this.hostUrl,\n\t\t\theaders: {\n\t\t\t\t[DriverHeader.createNew]: true,\n\t\t\t},\n\t\t};\n\t\treturn createNewRequest;\n\t}\n}\n"]}
|
|
@@ -7,7 +7,7 @@ import { IDocumentMessage, ISequencedDocumentMessage } from "@fluidframework/pro
|
|
|
7
7
|
* Tells if message was sent by container runtime
|
|
8
8
|
* @privateRemarks ADO #1385: To be moved to container-definitions
|
|
9
9
|
* @returns whether the message is a runtime message
|
|
10
|
-
* @
|
|
10
|
+
* @internal
|
|
11
11
|
*/
|
|
12
12
|
export declare function isRuntimeMessage(message: {
|
|
13
13
|
type: string;
|
|
@@ -15,14 +15,14 @@ export declare function isRuntimeMessage(message: {
|
|
|
15
15
|
/**
|
|
16
16
|
* @privateRemarks ADO #1385: staging code changes across layers.
|
|
17
17
|
* Eventually to be replaced by MessageType.accept
|
|
18
|
-
* @
|
|
18
|
+
* @internal
|
|
19
19
|
*/
|
|
20
20
|
export declare enum MessageType2 {
|
|
21
21
|
Accept = "accept"
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
24
|
* @privateRemarks ADO #1385: To be moved to packages/protocol-base/src/protocol.ts
|
|
25
|
-
* @
|
|
25
|
+
* @internal
|
|
26
26
|
*/
|
|
27
27
|
export declare function canBeCoalescedByService(message: ISequencedDocumentMessage | IDocumentMessage): boolean;
|
|
28
28
|
//# sourceMappingURL=messageRecognition.d.ts.map
|
|
@@ -10,7 +10,7 @@ const protocol_definitions_1 = require("@fluidframework/protocol-definitions");
|
|
|
10
10
|
* Tells if message was sent by container runtime
|
|
11
11
|
* @privateRemarks ADO #1385: To be moved to container-definitions
|
|
12
12
|
* @returns whether the message is a runtime message
|
|
13
|
-
* @
|
|
13
|
+
* @internal
|
|
14
14
|
*/
|
|
15
15
|
function isRuntimeMessage(message) {
|
|
16
16
|
return message.type === protocol_definitions_1.MessageType.Operation;
|
|
@@ -19,7 +19,7 @@ exports.isRuntimeMessage = isRuntimeMessage;
|
|
|
19
19
|
/**
|
|
20
20
|
* @privateRemarks ADO #1385: staging code changes across layers.
|
|
21
21
|
* Eventually to be replaced by MessageType.accept
|
|
22
|
-
* @
|
|
22
|
+
* @internal
|
|
23
23
|
*/
|
|
24
24
|
var MessageType2;
|
|
25
25
|
(function (MessageType2) {
|
|
@@ -27,7 +27,7 @@ var MessageType2;
|
|
|
27
27
|
})(MessageType2 || (exports.MessageType2 = MessageType2 = {}));
|
|
28
28
|
/**
|
|
29
29
|
* @privateRemarks ADO #1385: To be moved to packages/protocol-base/src/protocol.ts
|
|
30
|
-
* @
|
|
30
|
+
* @internal
|
|
31
31
|
*/
|
|
32
32
|
function canBeCoalescedByService(message) {
|
|
33
33
|
// This assumes that in the future relay service may implement coalescing of accept messages,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messageRecognition.js","sourceRoot":"","sources":["../src/messageRecognition.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,+EAI8C;AAE9C;;;;;GAKG;AACH,SAAgB,gBAAgB,CAAC,OAAyB;IACzD,OAAO,OAAO,CAAC,IAAI,KAAK,kCAAW,CAAC,SAAS,CAAC;AAC/C,CAAC;AAFD,4CAEC;AAED;;;;GAIG;AACH,IAAY,YAEX;AAFD,WAAY,YAAY;IACvB,iCAAiB,CAAA;AAClB,CAAC,EAFW,YAAY,4BAAZ,YAAY,QAEvB;AAED;;;GAGG;AACH,SAAgB,uBAAuB,CACtC,OAAqD;IAErD,6FAA6F;IAC7F,mEAAmE;IACnE,OAAO,OAAO,CAAC,IAAI,KAAK,kCAAW,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,KAAK,YAAY,CAAC,MAAM,CAAC;AAClF,CAAC;AAND,0DAMC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport {\n\tIDocumentMessage,\n\tISequencedDocumentMessage,\n\tMessageType,\n} from \"@fluidframework/protocol-definitions\";\n\n/**\n * Tells if message was sent by container runtime\n * @privateRemarks ADO #1385: To be moved to container-definitions\n * @returns whether the message is a runtime message\n * @
|
|
1
|
+
{"version":3,"file":"messageRecognition.js","sourceRoot":"","sources":["../src/messageRecognition.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,+EAI8C;AAE9C;;;;;GAKG;AACH,SAAgB,gBAAgB,CAAC,OAAyB;IACzD,OAAO,OAAO,CAAC,IAAI,KAAK,kCAAW,CAAC,SAAS,CAAC;AAC/C,CAAC;AAFD,4CAEC;AAED;;;;GAIG;AACH,IAAY,YAEX;AAFD,WAAY,YAAY;IACvB,iCAAiB,CAAA;AAClB,CAAC,EAFW,YAAY,4BAAZ,YAAY,QAEvB;AAED;;;GAGG;AACH,SAAgB,uBAAuB,CACtC,OAAqD;IAErD,6FAA6F;IAC7F,mEAAmE;IACnE,OAAO,OAAO,CAAC,IAAI,KAAK,kCAAW,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,KAAK,YAAY,CAAC,MAAM,CAAC;AAClF,CAAC;AAND,0DAMC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport {\n\tIDocumentMessage,\n\tISequencedDocumentMessage,\n\tMessageType,\n} from \"@fluidframework/protocol-definitions\";\n\n/**\n * Tells if message was sent by container runtime\n * @privateRemarks ADO #1385: To be moved to container-definitions\n * @returns whether the message is a runtime message\n * @internal\n */\nexport function isRuntimeMessage(message: { type: string }): boolean {\n\treturn message.type === MessageType.Operation;\n}\n\n/**\n * @privateRemarks ADO #1385: staging code changes across layers.\n * Eventually to be replaced by MessageType.accept\n * @internal\n */\nexport enum MessageType2 {\n\tAccept = \"accept\",\n}\n\n/**\n * @privateRemarks ADO #1385: To be moved to packages/protocol-base/src/protocol.ts\n * @internal\n */\nexport function canBeCoalescedByService(\n\tmessage: ISequencedDocumentMessage | IDocumentMessage,\n): boolean {\n\t// This assumes that in the future relay service may implement coalescing of accept messages,\n\t// same way it was doing coalescing of immediate noops in the past.\n\treturn message.type === MessageType.NoOp || message.type === MessageType2.Accept;\n}\n"]}
|
package/dist/network.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { IThrottlingWarning, IDriverErrorBase, IAuthorizationError, DriverErrorT
|
|
|
6
6
|
import { ITelemetryProperties } from "@fluidframework/core-interfaces";
|
|
7
7
|
import { IFluidErrorBase, LoggingError } from "@fluidframework/telemetry-utils";
|
|
8
8
|
/**
|
|
9
|
-
* @
|
|
9
|
+
* @internal
|
|
10
10
|
*/
|
|
11
11
|
export declare enum OnlineStatus {
|
|
12
12
|
Offline = 0,
|
|
@@ -17,19 +17,19 @@ export declare enum OnlineStatus {
|
|
|
17
17
|
* It tells if we have local connection only - we might not have connection to web.
|
|
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
|
+
* @internal
|
|
21
21
|
*/
|
|
22
22
|
export declare function isOnline(): OnlineStatus;
|
|
23
23
|
/**
|
|
24
24
|
* Telemetry props with driver-specific required properties
|
|
25
|
-
* @
|
|
25
|
+
* @internal
|
|
26
26
|
*/
|
|
27
27
|
export type DriverErrorTelemetryProps = ITelemetryProperties & {
|
|
28
28
|
driverVersion: string | undefined;
|
|
29
29
|
};
|
|
30
30
|
/**
|
|
31
31
|
* Generic network error class.
|
|
32
|
-
* @
|
|
32
|
+
* @internal
|
|
33
33
|
*/
|
|
34
34
|
export declare class GenericNetworkError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {
|
|
35
35
|
readonly canRetry: boolean;
|
|
@@ -38,7 +38,7 @@ export declare class GenericNetworkError extends LoggingError implements IDriver
|
|
|
38
38
|
}
|
|
39
39
|
/**
|
|
40
40
|
* FluidInvalidSchema error class.
|
|
41
|
-
* @
|
|
41
|
+
* @internal
|
|
42
42
|
*/
|
|
43
43
|
export declare class FluidInvalidSchemaError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {
|
|
44
44
|
readonly errorType = DriverErrorType.fluidInvalidSchema;
|
|
@@ -46,7 +46,7 @@ export declare class FluidInvalidSchemaError extends LoggingError implements IDr
|
|
|
46
46
|
constructor(message: string, props: DriverErrorTelemetryProps);
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
|
-
* @
|
|
49
|
+
* @internal
|
|
50
50
|
*/
|
|
51
51
|
export declare class DeltaStreamConnectionForbiddenError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {
|
|
52
52
|
static readonly errorType = DriverErrorType.deltaStreamConnectionForbidden;
|
|
@@ -56,7 +56,7 @@ export declare class DeltaStreamConnectionForbiddenError extends LoggingError im
|
|
|
56
56
|
constructor(message: string, props: DriverErrorTelemetryProps, storageOnlyReason?: string);
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
59
|
-
* @
|
|
59
|
+
* @internal
|
|
60
60
|
*/
|
|
61
61
|
export declare class AuthorizationError extends LoggingError implements IAuthorizationError, IFluidErrorBase {
|
|
62
62
|
readonly claims: string | undefined;
|
|
@@ -66,7 +66,7 @@ export declare class AuthorizationError extends LoggingError implements IAuthori
|
|
|
66
66
|
constructor(message: string, claims: string | undefined, tenantId: string | undefined, props: DriverErrorTelemetryProps);
|
|
67
67
|
}
|
|
68
68
|
/**
|
|
69
|
-
* @
|
|
69
|
+
* @internal
|
|
70
70
|
*/
|
|
71
71
|
export declare class LocationRedirectionError extends LoggingError implements ILocationRedirectionError, IFluidErrorBase {
|
|
72
72
|
readonly redirectUrl: IResolvedUrl;
|
|
@@ -75,7 +75,7 @@ export declare class LocationRedirectionError extends LoggingError implements IL
|
|
|
75
75
|
constructor(message: string, redirectUrl: IResolvedUrl, props: DriverErrorTelemetryProps);
|
|
76
76
|
}
|
|
77
77
|
/**
|
|
78
|
-
* @
|
|
78
|
+
* @internal
|
|
79
79
|
*/
|
|
80
80
|
export declare class NetworkErrorBasic<T extends string> extends LoggingError implements IFluidErrorBase {
|
|
81
81
|
readonly errorType: T;
|
|
@@ -83,14 +83,14 @@ export declare class NetworkErrorBasic<T extends string> extends LoggingError im
|
|
|
83
83
|
constructor(message: string, errorType: T, canRetry: boolean, props: DriverErrorTelemetryProps);
|
|
84
84
|
}
|
|
85
85
|
/**
|
|
86
|
-
* @
|
|
86
|
+
* @internal
|
|
87
87
|
*/
|
|
88
88
|
export declare class NonRetryableError<T extends string> extends NetworkErrorBasic<T> {
|
|
89
89
|
readonly errorType: T;
|
|
90
90
|
constructor(message: string, errorType: T, props: DriverErrorTelemetryProps);
|
|
91
91
|
}
|
|
92
92
|
/**
|
|
93
|
-
* @
|
|
93
|
+
* @internal
|
|
94
94
|
*/
|
|
95
95
|
export declare class RetryableError<T extends string> extends NetworkErrorBasic<T> {
|
|
96
96
|
readonly errorType: T;
|
|
@@ -98,7 +98,7 @@ export declare class RetryableError<T extends string> extends NetworkErrorBasic<
|
|
|
98
98
|
}
|
|
99
99
|
/**
|
|
100
100
|
* Throttling error class - used to communicate all throttling errors
|
|
101
|
-
* @
|
|
101
|
+
* @internal
|
|
102
102
|
*/
|
|
103
103
|
export declare class ThrottlingError extends LoggingError implements IThrottlingWarning, IFluidErrorBase {
|
|
104
104
|
readonly retryAfterSeconds: number;
|
|
@@ -107,11 +107,11 @@ export declare class ThrottlingError extends LoggingError implements IThrottling
|
|
|
107
107
|
constructor(message: string, retryAfterSeconds: number, props: DriverErrorTelemetryProps);
|
|
108
108
|
}
|
|
109
109
|
/**
|
|
110
|
-
* @
|
|
110
|
+
* @internal
|
|
111
111
|
*/
|
|
112
112
|
export declare const createWriteError: (message: string, props: DriverErrorTelemetryProps) => NonRetryableError<"writeError">;
|
|
113
113
|
/**
|
|
114
|
-
* @
|
|
114
|
+
* @internal
|
|
115
115
|
*/
|
|
116
116
|
export declare function createGenericNetworkError(message: string, retryInfo: {
|
|
117
117
|
canRetry: boolean;
|
|
@@ -121,17 +121,17 @@ export declare function createGenericNetworkError(message: string, retryInfo: {
|
|
|
121
121
|
* Check if a connection error can be retried. Unless explicitly allowed, retry is disallowed.
|
|
122
122
|
* I.e. asserts or unexpected exceptions in our code result in container failure.
|
|
123
123
|
* @param error - The error to inspect for ability to retry
|
|
124
|
-
* @
|
|
124
|
+
* @internal
|
|
125
125
|
*/
|
|
126
126
|
export declare const canRetryOnError: (error: any) => boolean;
|
|
127
127
|
/**
|
|
128
128
|
* Check retryAfterSeconds property on error
|
|
129
|
-
* @
|
|
130
|
-
|
|
129
|
+
* @internal
|
|
130
|
+
*/
|
|
131
131
|
export declare const getRetryDelaySecondsFromError: (error: any) => number | undefined;
|
|
132
132
|
/**
|
|
133
133
|
* Check retryAfterSeconds property on error and convert to ms
|
|
134
|
-
* @
|
|
135
|
-
|
|
134
|
+
* @internal
|
|
135
|
+
*/
|
|
136
136
|
export declare const getRetryDelayFromError: (error: any) => number | undefined;
|
|
137
137
|
//# sourceMappingURL=network.d.ts.map
|
package/dist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QAAQ,CAAC,SAAS,mCAAmC;IACrD,QAAQ,CAAC,QAAQ,QAAQ;gBAGxB,OAAO,EAAE,MAAM,EACN,iBAAiB,EAAE,MAAM,EAClC,KAAK,EAAE,yBAAyB;CAIjC;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB,YAAa,MAAM,SAAS,yBAAyB,oCACf,CAAC;AAEpE;;GAEG;AACH,wBAAgB,yBAAyB,CACxC,OAAO,EAAE,MAAM,EACf,SAAS,EAAE;IAAE,QAAQ,EAAE,OAAO,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,EACvD,KAAK,EAAE,yBAAyB,GAC9B,eAAe,GAAG,mBAAmB,CAKvC;AAED;;;;;GAKG;AACH,eAAO,MAAM,eAAe,UAAW,GAAG,KAAG,OAAmC,CAAC;AAEjF;;;GAGG;AACH,eAAO,MAAM,6BAA6B,UAAW,GAAG,KAAG,MAAM,GAAG,SACrB,CAAC;AAEhD;;;GAGG;AACH,eAAO,MAAM,sBAAsB,UAAW,GAAG,KAAG,MAAM,GAAG,SACuB,CAAC"}
|
package/dist/network.js
CHANGED
|
@@ -8,7 +8,7 @@ exports.getRetryDelayFromError = exports.getRetryDelaySecondsFromError = exports
|
|
|
8
8
|
const driver_definitions_1 = require("@fluidframework/driver-definitions");
|
|
9
9
|
const telemetry_utils_1 = require("@fluidframework/telemetry-utils");
|
|
10
10
|
/**
|
|
11
|
-
* @
|
|
11
|
+
* @internal
|
|
12
12
|
*/
|
|
13
13
|
var OnlineStatus;
|
|
14
14
|
(function (OnlineStatus) {
|
|
@@ -20,7 +20,7 @@ var OnlineStatus;
|
|
|
20
20
|
* It tells if we have local connection only - we might not have connection to web.
|
|
21
21
|
* No solution for node.js (other than resolve dns names / ping specific sites)
|
|
22
22
|
* Can also use window.addEventListener("online" / "offline")
|
|
23
|
-
* @
|
|
23
|
+
* @internal
|
|
24
24
|
*/
|
|
25
25
|
function isOnline() {
|
|
26
26
|
if (typeof navigator === "object" &&
|
|
@@ -33,7 +33,7 @@ function isOnline() {
|
|
|
33
33
|
exports.isOnline = isOnline;
|
|
34
34
|
/**
|
|
35
35
|
* Generic network error class.
|
|
36
|
-
* @
|
|
36
|
+
* @internal
|
|
37
37
|
*/
|
|
38
38
|
class GenericNetworkError extends telemetry_utils_1.LoggingError {
|
|
39
39
|
constructor(message, canRetry, props) {
|
|
@@ -46,7 +46,7 @@ class GenericNetworkError extends telemetry_utils_1.LoggingError {
|
|
|
46
46
|
exports.GenericNetworkError = GenericNetworkError;
|
|
47
47
|
/**
|
|
48
48
|
* FluidInvalidSchema error class.
|
|
49
|
-
* @
|
|
49
|
+
* @internal
|
|
50
50
|
*/
|
|
51
51
|
class FluidInvalidSchemaError extends telemetry_utils_1.LoggingError {
|
|
52
52
|
constructor(message, props) {
|
|
@@ -58,7 +58,7 @@ class FluidInvalidSchemaError extends telemetry_utils_1.LoggingError {
|
|
|
58
58
|
}
|
|
59
59
|
exports.FluidInvalidSchemaError = FluidInvalidSchemaError;
|
|
60
60
|
/**
|
|
61
|
-
* @
|
|
61
|
+
* @internal
|
|
62
62
|
*/
|
|
63
63
|
class DeltaStreamConnectionForbiddenError extends telemetry_utils_1.LoggingError {
|
|
64
64
|
constructor(message, props, storageOnlyReason) {
|
|
@@ -72,7 +72,7 @@ exports.DeltaStreamConnectionForbiddenError = DeltaStreamConnectionForbiddenErro
|
|
|
72
72
|
// eslint-disable-next-line import/no-deprecated
|
|
73
73
|
DeltaStreamConnectionForbiddenError.errorType = driver_definitions_1.DriverErrorType.deltaStreamConnectionForbidden;
|
|
74
74
|
/**
|
|
75
|
-
* @
|
|
75
|
+
* @internal
|
|
76
76
|
*/
|
|
77
77
|
class AuthorizationError extends telemetry_utils_1.LoggingError {
|
|
78
78
|
constructor(message, claims, tenantId, props) {
|
|
@@ -87,7 +87,7 @@ class AuthorizationError extends telemetry_utils_1.LoggingError {
|
|
|
87
87
|
}
|
|
88
88
|
exports.AuthorizationError = AuthorizationError;
|
|
89
89
|
/**
|
|
90
|
-
* @
|
|
90
|
+
* @internal
|
|
91
91
|
*/
|
|
92
92
|
class LocationRedirectionError extends telemetry_utils_1.LoggingError {
|
|
93
93
|
constructor(message, redirectUrl, props) {
|
|
@@ -101,7 +101,7 @@ class LocationRedirectionError extends telemetry_utils_1.LoggingError {
|
|
|
101
101
|
}
|
|
102
102
|
exports.LocationRedirectionError = LocationRedirectionError;
|
|
103
103
|
/**
|
|
104
|
-
* @
|
|
104
|
+
* @internal
|
|
105
105
|
*/
|
|
106
106
|
class NetworkErrorBasic extends telemetry_utils_1.LoggingError {
|
|
107
107
|
constructor(message, errorType, canRetry, props) {
|
|
@@ -112,7 +112,7 @@ class NetworkErrorBasic extends telemetry_utils_1.LoggingError {
|
|
|
112
112
|
}
|
|
113
113
|
exports.NetworkErrorBasic = NetworkErrorBasic;
|
|
114
114
|
/**
|
|
115
|
-
* @
|
|
115
|
+
* @internal
|
|
116
116
|
*/
|
|
117
117
|
class NonRetryableError extends NetworkErrorBasic {
|
|
118
118
|
constructor(message, errorType, props) {
|
|
@@ -122,7 +122,7 @@ class NonRetryableError extends NetworkErrorBasic {
|
|
|
122
122
|
}
|
|
123
123
|
exports.NonRetryableError = NonRetryableError;
|
|
124
124
|
/**
|
|
125
|
-
* @
|
|
125
|
+
* @internal
|
|
126
126
|
*/
|
|
127
127
|
class RetryableError extends NetworkErrorBasic {
|
|
128
128
|
constructor(message, errorType, props) {
|
|
@@ -133,7 +133,7 @@ class RetryableError extends NetworkErrorBasic {
|
|
|
133
133
|
exports.RetryableError = RetryableError;
|
|
134
134
|
/**
|
|
135
135
|
* Throttling error class - used to communicate all throttling errors
|
|
136
|
-
* @
|
|
136
|
+
* @internal
|
|
137
137
|
*/
|
|
138
138
|
class ThrottlingError extends telemetry_utils_1.LoggingError {
|
|
139
139
|
constructor(message, retryAfterSeconds, props) {
|
|
@@ -146,12 +146,12 @@ class ThrottlingError extends telemetry_utils_1.LoggingError {
|
|
|
146
146
|
}
|
|
147
147
|
exports.ThrottlingError = ThrottlingError;
|
|
148
148
|
/**
|
|
149
|
-
* @
|
|
149
|
+
* @internal
|
|
150
150
|
*/
|
|
151
151
|
const createWriteError = (message, props) => new NonRetryableError(message, driver_definitions_1.DriverErrorTypes.writeError, props);
|
|
152
152
|
exports.createWriteError = createWriteError;
|
|
153
153
|
/**
|
|
154
|
-
* @
|
|
154
|
+
* @internal
|
|
155
155
|
*/
|
|
156
156
|
function createGenericNetworkError(message, retryInfo, props) {
|
|
157
157
|
if (retryInfo.retryAfterMs !== undefined && retryInfo.canRetry) {
|
|
@@ -164,20 +164,20 @@ exports.createGenericNetworkError = createGenericNetworkError;
|
|
|
164
164
|
* Check if a connection error can be retried. Unless explicitly allowed, retry is disallowed.
|
|
165
165
|
* I.e. asserts or unexpected exceptions in our code result in container failure.
|
|
166
166
|
* @param error - The error to inspect for ability to retry
|
|
167
|
-
* @
|
|
167
|
+
* @internal
|
|
168
168
|
*/
|
|
169
169
|
const canRetryOnError = (error) => error?.canRetry === true;
|
|
170
170
|
exports.canRetryOnError = canRetryOnError;
|
|
171
171
|
/**
|
|
172
172
|
* Check retryAfterSeconds property on error
|
|
173
|
-
* @
|
|
174
|
-
|
|
173
|
+
* @internal
|
|
174
|
+
*/
|
|
175
175
|
const getRetryDelaySecondsFromError = (error) => error?.retryAfterSeconds;
|
|
176
176
|
exports.getRetryDelaySecondsFromError = getRetryDelaySecondsFromError;
|
|
177
177
|
/**
|
|
178
178
|
* Check retryAfterSeconds property on error and convert to ms
|
|
179
|
-
* @
|
|
180
|
-
|
|
179
|
+
* @internal
|
|
180
|
+
*/
|
|
181
181
|
const getRetryDelayFromError = (error) => error?.retryAfterSeconds !== undefined ? error.retryAfterSeconds * 1000 : undefined;
|
|
182
182
|
exports.getRetryDelayFromError = getRetryDelayFromError;
|
|
183
183
|
//# sourceMappingURL=network.js.map
|
package/dist/network.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"network.js","sourceRoot":"","sources":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AO,EAAE,SAAS,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;AACpE,CAAC;AATD,8DASC;AAED;;;;;GAKG;AACI,MAAM,eAAe,GAAG,CAAC,KAAU,EAAW,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,CAAC;AAApE,QAAA,eAAe,mBAAqD;AAEjF;;;KAGK;AACE,MAAM,6BAA6B,GAAG,CAAC,KAAU,EAAsB,EAAE,CAC/E,KAAK,EAAE,iBAAuC,CAAC;AADnC,QAAA,6BAA6B,iCACM;AAEhD;;;KAGK;AACE,MAAM,sBAAsB,GAAG,CAAC,KAAU,EAAsB,EAAE,CACxE,KAAK,EAAE,iBAAiB,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;AADxE,QAAA,sBAAsB,0BACkD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tIThrottlingWarning,\n\tIDriverErrorBase,\n\tIAuthorizationError,\n\t// eslint-disable-next-line import/no-deprecated\n\tDriverErrorType,\n\tILocationRedirectionError,\n\tIResolvedUrl,\n\tDriverErrorTypes,\n} from \"@fluidframework/driver-definitions\";\nimport { ITelemetryProperties } from \"@fluidframework/core-interfaces\";\nimport { IFluidErrorBase, LoggingError } from \"@fluidframework/telemetry-utils\";\n\n/**\n * @public\n */\nexport enum OnlineStatus {\n\tOffline,\n\tOnline,\n\tUnknown,\n}\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\")\n * @public\n */\nexport function isOnline(): OnlineStatus {\n\tif (\n\t\ttypeof navigator === \"object\" &&\n\t\tnavigator !== null &&\n\t\ttypeof navigator.onLine === \"boolean\"\n\t) {\n\t\treturn navigator.onLine ? OnlineStatus.Online : OnlineStatus.Offline;\n\t}\n\treturn OnlineStatus.Unknown;\n}\n\n/**\n * Telemetry props with driver-specific required properties\n * @public\n */\nexport type DriverErrorTelemetryProps = ITelemetryProperties & {\n\tdriverVersion: string | undefined;\n};\n\n/**\n * Generic network error class.\n * @public\n */\nexport class GenericNetworkError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {\n\t// eslint-disable-next-line import/no-deprecated\n\treadonly errorType = DriverErrorType.genericNetworkError;\n\n\tconstructor(\n\t\tmessage: string,\n\t\treadonly canRetry: boolean,\n\t\tprops: DriverErrorTelemetryProps,\n\t) {\n\t\tsuper(message, props);\n\t}\n}\n\n/**\n * FluidInvalidSchema error class.\n * @public\n */\nexport class FluidInvalidSchemaError\n\textends LoggingError\n\timplements IDriverErrorBase, IFluidErrorBase\n{\n\t// eslint-disable-next-line import/no-deprecated\n\treadonly errorType = DriverErrorType.fluidInvalidSchema;\n\treadonly canRetry = false;\n\n\tconstructor(message: string, props: DriverErrorTelemetryProps) {\n\t\tsuper(message, props);\n\t}\n}\n\n/**\n * @public\n */\nexport class DeltaStreamConnectionForbiddenError\n\textends LoggingError\n\timplements IDriverErrorBase, IFluidErrorBase\n{\n\t// eslint-disable-next-line import/no-deprecated\n\tstatic readonly errorType = DriverErrorType.deltaStreamConnectionForbidden;\n\treadonly errorType = DeltaStreamConnectionForbiddenError.errorType;\n\treadonly canRetry = false;\n\treadonly storageOnlyReason: string | undefined;\n\n\tconstructor(message: string, props: DriverErrorTelemetryProps, storageOnlyReason?: string) {\n\t\tsuper(message, { ...props, statusCode: 400 });\n\t\tthis.storageOnlyReason = storageOnlyReason;\n\t}\n}\n\n/**\n * @public\n */\nexport class AuthorizationError\n\textends LoggingError\n\timplements IAuthorizationError, IFluidErrorBase\n{\n\t// eslint-disable-next-line import/no-deprecated\n\treadonly errorType = DriverErrorType.authorizationError;\n\treadonly canRetry = false;\n\n\tconstructor(\n\t\tmessage: string,\n\t\treadonly claims: string | undefined,\n\t\treadonly tenantId: string | undefined,\n\t\tprops: DriverErrorTelemetryProps,\n\t) {\n\t\t// don't log claims or tenantId\n\t\tsuper(message, props, new Set([\"claims\", \"tenantId\"]));\n\t}\n}\n\n/**\n * @public\n */\nexport class LocationRedirectionError\n\textends LoggingError\n\timplements ILocationRedirectionError, IFluidErrorBase\n{\n\t// eslint-disable-next-line import/no-deprecated\n\treadonly errorType = DriverErrorType.locationRedirection;\n\treadonly canRetry = false;\n\n\tconstructor(\n\t\tmessage: string,\n\t\treadonly redirectUrl: IResolvedUrl,\n\t\tprops: DriverErrorTelemetryProps,\n\t) {\n\t\t// do not log redirectURL\n\t\tsuper(message, props, new Set([\"redirectUrl\"]));\n\t}\n}\n\n/**\n * @public\n */\nexport class NetworkErrorBasic<T extends string> extends LoggingError implements IFluidErrorBase {\n\tconstructor(\n\t\tmessage: string,\n\t\treadonly errorType: T,\n\t\treadonly canRetry: boolean,\n\t\tprops: DriverErrorTelemetryProps,\n\t) {\n\t\tsuper(message, props);\n\t}\n}\n\n/**\n * @public\n */\nexport class NonRetryableError<T extends string> extends NetworkErrorBasic<T> {\n\tconstructor(\n\t\tmessage: string,\n\t\treadonly errorType: T,\n\t\tprops: DriverErrorTelemetryProps,\n\t) {\n\t\tsuper(message, errorType, false, props);\n\t}\n}\n\n/**\n * @public\n */\nexport class RetryableError<T extends string> extends NetworkErrorBasic<T> {\n\tconstructor(\n\t\tmessage: string,\n\t\treadonly errorType: T,\n\t\tprops: DriverErrorTelemetryProps,\n\t) {\n\t\tsuper(message, errorType, true, props);\n\t}\n}\n\n/**\n * Throttling error class - used to communicate all throttling errors\n * @public\n */\nexport class ThrottlingError extends LoggingError implements IThrottlingWarning, IFluidErrorBase {\n\t// eslint-disable-next-line import/no-deprecated\n\treadonly errorType = DriverErrorType.throttlingError;\n\treadonly canRetry = true;\n\n\tconstructor(\n\t\tmessage: string,\n\t\treadonly retryAfterSeconds: number,\n\t\tprops: DriverErrorTelemetryProps,\n\t) {\n\t\tsuper(message, props);\n\t}\n}\n\n/**\n * @public\n */\nexport const createWriteError = (message: string, props: DriverErrorTelemetryProps) =>\n\tnew NonRetryableError(message, DriverErrorTypes.writeError, props);\n\n/**\n * @public\n */\nexport function createGenericNetworkError(\n\tmessage: string,\n\tretryInfo: { canRetry: boolean; retryAfterMs?: number },\n\tprops: DriverErrorTelemetryProps,\n): ThrottlingError | GenericNetworkError {\n\tif (retryInfo.retryAfterMs !== undefined && retryInfo.canRetry) {\n\t\treturn new ThrottlingError(message, retryInfo.retryAfterMs / 1000, props);\n\t}\n\treturn new GenericNetworkError(message, 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 * @public\n */\nexport const canRetryOnError = (error: any): boolean => error?.canRetry === true;\n\n/**\n * Check retryAfterSeconds property on error\n * @public\n * */\nexport const getRetryDelaySecondsFromError = (error: any): number | undefined =>\n\terror?.retryAfterSeconds as number | undefined;\n\n/**\n * Check retryAfterSeconds property on error and convert to ms\n * @public\n * */\nexport const getRetryDelayFromError = (error: any): number | undefined =>\n\terror?.retryAfterSeconds !== undefined ? error.retryAfterSeconds * 1000 : undefined;\n"]}
|
|
1
|
+
{"version":3,"file":"network.js","sourceRoot":"","sources":["../src/network.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2EAS4C;AAE5C,qEAAgF;AAEhF;;GAEG;AACH,IAAY,YAIX;AAJD,WAAY,YAAY;IACvB,qDAAO,CAAA;IACP,mDAAM,CAAA;IACN,qDAAO,CAAA;AACR,CAAC,EAJW,YAAY,4BAAZ,YAAY,QAIvB;AAED;;;;;GAKG;AACH,SAAgB,QAAQ;IACvB,IACC,OAAO,SAAS,KAAK,QAAQ;QAC7B,SAAS,KAAK,IAAI;QAClB,OAAO,SAAS,CAAC,MAAM,KAAK,SAAS,EACpC;QACD,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,YAA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AAC,KAAK,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;AADxE,QAAA,sBAAsB,0BACkD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tIThrottlingWarning,\n\tIDriverErrorBase,\n\tIAuthorizationError,\n\t// eslint-disable-next-line import/no-deprecated\n\tDriverErrorType,\n\tILocationRedirectionError,\n\tIResolvedUrl,\n\tDriverErrorTypes,\n} from \"@fluidframework/driver-definitions\";\nimport { ITelemetryProperties } from \"@fluidframework/core-interfaces\";\nimport { IFluidErrorBase, LoggingError } from \"@fluidframework/telemetry-utils\";\n\n/**\n * @internal\n */\nexport enum OnlineStatus {\n\tOffline,\n\tOnline,\n\tUnknown,\n}\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\")\n * @internal\n */\nexport function isOnline(): OnlineStatus {\n\tif (\n\t\ttypeof navigator === \"object\" &&\n\t\tnavigator !== null &&\n\t\ttypeof navigator.onLine === \"boolean\"\n\t) {\n\t\treturn navigator.onLine ? OnlineStatus.Online : OnlineStatus.Offline;\n\t}\n\treturn OnlineStatus.Unknown;\n}\n\n/**\n * Telemetry props with driver-specific required properties\n * @internal\n */\nexport type DriverErrorTelemetryProps = ITelemetryProperties & {\n\tdriverVersion: string | undefined;\n};\n\n/**\n * Generic network error class.\n * @internal\n */\nexport class GenericNetworkError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {\n\t// eslint-disable-next-line import/no-deprecated\n\treadonly errorType = DriverErrorType.genericNetworkError;\n\n\tconstructor(\n\t\tmessage: string,\n\t\treadonly canRetry: boolean,\n\t\tprops: DriverErrorTelemetryProps,\n\t) {\n\t\tsuper(message, props);\n\t}\n}\n\n/**\n * FluidInvalidSchema error class.\n * @internal\n */\nexport class FluidInvalidSchemaError\n\textends LoggingError\n\timplements IDriverErrorBase, IFluidErrorBase\n{\n\t// eslint-disable-next-line import/no-deprecated\n\treadonly errorType = DriverErrorType.fluidInvalidSchema;\n\treadonly canRetry = false;\n\n\tconstructor(message: string, props: DriverErrorTelemetryProps) {\n\t\tsuper(message, props);\n\t}\n}\n\n/**\n * @internal\n */\nexport class DeltaStreamConnectionForbiddenError\n\textends LoggingError\n\timplements IDriverErrorBase, IFluidErrorBase\n{\n\t// eslint-disable-next-line import/no-deprecated\n\tstatic readonly errorType = DriverErrorType.deltaStreamConnectionForbidden;\n\treadonly errorType = DeltaStreamConnectionForbiddenError.errorType;\n\treadonly canRetry = false;\n\treadonly storageOnlyReason: string | undefined;\n\n\tconstructor(message: string, props: DriverErrorTelemetryProps, storageOnlyReason?: string) {\n\t\tsuper(message, { ...props, statusCode: 400 });\n\t\tthis.storageOnlyReason = storageOnlyReason;\n\t}\n}\n\n/**\n * @internal\n */\nexport class AuthorizationError\n\textends LoggingError\n\timplements IAuthorizationError, IFluidErrorBase\n{\n\t// eslint-disable-next-line import/no-deprecated\n\treadonly errorType = DriverErrorType.authorizationError;\n\treadonly canRetry = false;\n\n\tconstructor(\n\t\tmessage: string,\n\t\treadonly claims: string | undefined,\n\t\treadonly tenantId: string | undefined,\n\t\tprops: DriverErrorTelemetryProps,\n\t) {\n\t\t// don't log claims or tenantId\n\t\tsuper(message, props, new Set([\"claims\", \"tenantId\"]));\n\t}\n}\n\n/**\n * @internal\n */\nexport class LocationRedirectionError\n\textends LoggingError\n\timplements ILocationRedirectionError, IFluidErrorBase\n{\n\t// eslint-disable-next-line import/no-deprecated\n\treadonly errorType = DriverErrorType.locationRedirection;\n\treadonly canRetry = false;\n\n\tconstructor(\n\t\tmessage: string,\n\t\treadonly redirectUrl: IResolvedUrl,\n\t\tprops: DriverErrorTelemetryProps,\n\t) {\n\t\t// do not log redirectURL\n\t\tsuper(message, props, new Set([\"redirectUrl\"]));\n\t}\n}\n\n/**\n * @internal\n */\nexport class NetworkErrorBasic<T extends string> extends LoggingError implements IFluidErrorBase {\n\tconstructor(\n\t\tmessage: string,\n\t\treadonly errorType: T,\n\t\treadonly canRetry: boolean,\n\t\tprops: DriverErrorTelemetryProps,\n\t) {\n\t\tsuper(message, props);\n\t}\n}\n\n/**\n * @internal\n */\nexport class NonRetryableError<T extends string> extends NetworkErrorBasic<T> {\n\tconstructor(\n\t\tmessage: string,\n\t\treadonly errorType: T,\n\t\tprops: DriverErrorTelemetryProps,\n\t) {\n\t\tsuper(message, errorType, false, props);\n\t}\n}\n\n/**\n * @internal\n */\nexport class RetryableError<T extends string> extends NetworkErrorBasic<T> {\n\tconstructor(\n\t\tmessage: string,\n\t\treadonly errorType: T,\n\t\tprops: DriverErrorTelemetryProps,\n\t) {\n\t\tsuper(message, errorType, true, props);\n\t}\n}\n\n/**\n * Throttling error class - used to communicate all throttling errors\n * @internal\n */\nexport class ThrottlingError extends LoggingError implements IThrottlingWarning, IFluidErrorBase {\n\t// eslint-disable-next-line import/no-deprecated\n\treadonly errorType = DriverErrorType.throttlingError;\n\treadonly canRetry = true;\n\n\tconstructor(\n\t\tmessage: string,\n\t\treadonly retryAfterSeconds: number,\n\t\tprops: DriverErrorTelemetryProps,\n\t) {\n\t\tsuper(message, props);\n\t}\n}\n\n/**\n * @internal\n */\nexport const createWriteError = (message: string, props: DriverErrorTelemetryProps) =>\n\tnew NonRetryableError(message, DriverErrorTypes.writeError, props);\n\n/**\n * @internal\n */\nexport function createGenericNetworkError(\n\tmessage: string,\n\tretryInfo: { canRetry: boolean; retryAfterMs?: number },\n\tprops: DriverErrorTelemetryProps,\n): ThrottlingError | GenericNetworkError {\n\tif (retryInfo.retryAfterMs !== undefined && retryInfo.canRetry) {\n\t\treturn new ThrottlingError(message, retryInfo.retryAfterMs / 1000, props);\n\t}\n\treturn new GenericNetworkError(message, 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 * @internal\n */\nexport const canRetryOnError = (error: any): boolean => error?.canRetry === true;\n\n/**\n * Check retryAfterSeconds property on error\n * @internal\n */\nexport const getRetryDelaySecondsFromError = (error: any): number | undefined =>\n\terror?.retryAfterSeconds as number | undefined;\n\n/**\n * Check retryAfterSeconds property on error and convert to ms\n * @internal\n */\nexport const getRetryDelayFromError = (error: any): number | undefined =>\n\terror?.retryAfterSeconds !== undefined ? error.retryAfterSeconds * 1000 : undefined;\n"]}
|
package/dist/networkUtils.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { ITelemetryErrorEvent } from "@fluidframework/core-interfaces";
|
|
6
6
|
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
|
|
7
7
|
/**
|
|
8
|
-
* @
|
|
8
|
+
* @internal
|
|
9
9
|
*/
|
|
10
10
|
export declare function logNetworkFailure(logger: ITelemetryLoggerExt, event: ITelemetryErrorEvent, error?: any): void;
|
|
11
11
|
//# sourceMappingURL=networkUtils.d.ts.map
|
package/dist/networkUtils.js
CHANGED
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
exports.logNetworkFailure = void 0;
|
|
8
8
|
const network_1 = require("./network");
|
|
9
9
|
/**
|
|
10
|
-
* @
|
|
10
|
+
* @internal
|
|
11
11
|
*/
|
|
12
12
|
function logNetworkFailure(logger, event, error) {
|
|
13
13
|
const newEvent = { ...event };
|
package/dist/networkUtils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"networkUtils.js","sourceRoot":"","sources":["../src/networkUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,uCAAoE;AAEpE;;GAEG;AACH,SAAgB,iBAAiB,CAChC,MAA2B,EAC3B,KAA2B,EAC3B,KAAW;IAEX,MAAM,QAAQ,GAAG,EAAE,GAAG,KAAK,EAAE,CAAC;IAE9B,MAAM,eAAe,GAAG,KAAK,EAAE,MAAM,CAAC;IACtC,QAAQ,CAAC,MAAM;QACd,OAAO,eAAe,KAAK,QAAQ,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,sBAAY,CAAC,IAAA,kBAAQ,GAAE,CAAC,CAAC;IAElF,IAAI,OAAO,SAAS,KAAK,QAAQ,IAAI,SAAS,KAAK,IAAI,EAAE;QACxD,MAAM,GAAG,GAAG,SAAgB,CAAC;QAC7B,MAAM,UAAU,GAAG,GAAG,CAAC,UAAU,IAAI,GAAG,CAAC,aAAa,IAAI,GAAG,CAAC,gBAAgB,CAAC;QAC/E,IAAI,UAAU,KAAK,IAAI,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE;YAC1D,QAAQ,CAAC,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC;SAC1C;KACD;IAED,gEAAgE;IAChE,QAAQ,CAAC,QAAQ,GAAG,IAAA,yBAAe,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC;IACjE,MAAM,CAAC,kBAAkB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;AAC5C,CAAC;AAtBD,8CAsBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryErrorEvent } from \"@fluidframework/core-interfaces\";\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils\";\nimport { isOnline, OnlineStatus, canRetryOnError } from \"./network\";\n\n/**\n * @
|
|
1
|
+
{"version":3,"file":"networkUtils.js","sourceRoot":"","sources":["../src/networkUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,uCAAoE;AAEpE;;GAEG;AACH,SAAgB,iBAAiB,CAChC,MAA2B,EAC3B,KAA2B,EAC3B,KAAW;IAEX,MAAM,QAAQ,GAAG,EAAE,GAAG,KAAK,EAAE,CAAC;IAE9B,MAAM,eAAe,GAAG,KAAK,EAAE,MAAM,CAAC;IACtC,QAAQ,CAAC,MAAM;QACd,OAAO,eAAe,KAAK,QAAQ,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,sBAAY,CAAC,IAAA,kBAAQ,GAAE,CAAC,CAAC;IAElF,IAAI,OAAO,SAAS,KAAK,QAAQ,IAAI,SAAS,KAAK,IAAI,EAAE;QACxD,MAAM,GAAG,GAAG,SAAgB,CAAC;QAC7B,MAAM,UAAU,GAAG,GAAG,CAAC,UAAU,IAAI,GAAG,CAAC,aAAa,IAAI,GAAG,CAAC,gBAAgB,CAAC;QAC/E,IAAI,UAAU,KAAK,IAAI,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE;YAC1D,QAAQ,CAAC,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC;SAC1C;KACD;IAED,gEAAgE;IAChE,QAAQ,CAAC,QAAQ,GAAG,IAAA,yBAAe,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC;IACjE,MAAM,CAAC,kBAAkB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;AAC5C,CAAC;AAtBD,8CAsBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryErrorEvent } from \"@fluidframework/core-interfaces\";\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils\";\nimport { isOnline, OnlineStatus, canRetryOnError } from \"./network\";\n\n/**\n * @internal\n */\nexport function logNetworkFailure(\n\tlogger: ITelemetryLoggerExt,\n\tevent: ITelemetryErrorEvent,\n\terror?: any,\n) {\n\tconst newEvent = { ...event };\n\n\tconst errorOnlineProp = error?.online;\n\tnewEvent.online =\n\t\ttypeof errorOnlineProp === \"string\" ? errorOnlineProp : OnlineStatus[isOnline()];\n\n\tif (typeof navigator === \"object\" && navigator !== null) {\n\t\tconst nav = navigator as any;\n\t\tconst connection = nav.connection ?? nav.mozConnection ?? nav.webkitConnection;\n\t\tif (connection !== null && typeof connection === \"object\") {\n\t\t\tnewEvent.connectionType = connection.type;\n\t\t}\n\t}\n\n\t// non-retryable errors are fatal and should be logged as errors\n\tnewEvent.category = canRetryOnError(error) ? \"generic\" : \"error\";\n\tlogger.sendTelemetryEvent(newEvent, error);\n}\n"]}
|
package/dist/packageVersion.d.ts
CHANGED
|
@@ -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 = "2.0.0-internal.
|
|
8
|
+
export declare const pkgVersion = "2.0.0-internal.8.0.0";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
package/dist/packageVersion.js
CHANGED
|
@@ -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 = "2.0.0-internal.
|
|
11
|
+
exports.pkgVersion = "2.0.0-internal.8.0.0";
|
|
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,sBAAsB,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 = \"2.0.0-internal.
|
|
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,sBAAsB,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 = \"2.0.0-internal.8.0.0\";\n"]}
|
|
@@ -13,7 +13,7 @@ import { IDeltasFetchResult, IStream, IStreamResult } from "@fluidframework/driv
|
|
|
13
13
|
* @param logger - logger to use
|
|
14
14
|
* @param requestCallback - callback to request batches
|
|
15
15
|
* @returns Queue that can be used to retrieve data
|
|
16
|
-
* @
|
|
16
|
+
* @internal
|
|
17
17
|
*/
|
|
18
18
|
export declare class ParallelRequests<T> {
|
|
19
19
|
private to;
|
|
@@ -48,7 +48,7 @@ export declare class ParallelRequests<T> {
|
|
|
48
48
|
/**
|
|
49
49
|
* Helper queue class to allow async push / pull
|
|
50
50
|
* It's essentially a pipe allowing multiple writers, and single reader
|
|
51
|
-
* @
|
|
51
|
+
* @internal
|
|
52
52
|
*/
|
|
53
53
|
export declare class Queue<T> implements IStream<T> {
|
|
54
54
|
private readonly queue;
|
|
@@ -71,19 +71,19 @@ export declare class Queue<T> implements IStream<T> {
|
|
|
71
71
|
* @param signal - Cancelation signal
|
|
72
72
|
* @param scenarioName - Reason for fetching ops
|
|
73
73
|
* @returns Messages fetched
|
|
74
|
-
* @
|
|
74
|
+
* @internal
|
|
75
75
|
*/
|
|
76
76
|
export declare function requestOps(get: (from: number, to: number, telemetryProps: ITelemetryProperties) => Promise<IDeltasFetchResult>, concurrency: number, fromTotal: number, toTotal: number | undefined, payloadSize: number, logger: ITelemetryLoggerExt, signal?: AbortSignal, scenarioName?: string): IStream<ISequencedDocumentMessage[]>;
|
|
77
77
|
/**
|
|
78
|
-
* @
|
|
78
|
+
* @internal
|
|
79
79
|
*/
|
|
80
80
|
export declare const emptyMessageStream: IStream<ISequencedDocumentMessage[]>;
|
|
81
81
|
/**
|
|
82
|
-
* @
|
|
82
|
+
* @internal
|
|
83
83
|
*/
|
|
84
84
|
export declare function streamFromMessages(messagesArg: Promise<ISequencedDocumentMessage[]>): IStream<ISequencedDocumentMessage[]>;
|
|
85
85
|
/**
|
|
86
|
-
* @
|
|
86
|
+
* @internal
|
|
87
87
|
*/
|
|
88
88
|
export declare function streamObserver<T>(stream: IStream<T>, handler: (value: IStreamResult<T>) => void): IStream<T>;
|
|
89
89
|
//# sourceMappingURL=parallelRequests.d.ts.map
|
package/dist/parallelRequests.js
CHANGED
|
@@ -26,7 +26,7 @@ const MissingFetchDelayInMs = 50;
|
|
|
26
26
|
* @param logger - logger to use
|
|
27
27
|
* @param requestCallback - callback to request batches
|
|
28
28
|
* @returns Queue that can be used to retrieve data
|
|
29
|
-
* @
|
|
29
|
+
* @internal
|
|
30
30
|
*/
|
|
31
31
|
class ParallelRequests {
|
|
32
32
|
get working() {
|
|
@@ -267,7 +267,7 @@ exports.ParallelRequests = ParallelRequests;
|
|
|
267
267
|
/**
|
|
268
268
|
* Helper queue class to allow async push / pull
|
|
269
269
|
* It's essentially a pipe allowing multiple writers, and single reader
|
|
270
|
-
* @
|
|
270
|
+
* @internal
|
|
271
271
|
*/
|
|
272
272
|
class Queue {
|
|
273
273
|
constructor() {
|
|
@@ -428,7 +428,7 @@ async function getSingleOpBatch(get, props, strongTo, logger, signal, scenarioNa
|
|
|
428
428
|
* @param signal - Cancelation signal
|
|
429
429
|
* @param scenarioName - Reason for fetching ops
|
|
430
430
|
* @returns Messages fetched
|
|
431
|
-
* @
|
|
431
|
+
* @internal
|
|
432
432
|
*/
|
|
433
433
|
function requestOps(get, concurrency, fromTotal, toTotal, payloadSize, logger, signal, scenarioName) {
|
|
434
434
|
let requests = 0;
|
|
@@ -504,7 +504,7 @@ function requestOps(get, concurrency, fromTotal, toTotal, payloadSize, logger, s
|
|
|
504
504
|
}
|
|
505
505
|
exports.requestOps = requestOps;
|
|
506
506
|
/**
|
|
507
|
-
* @
|
|
507
|
+
* @internal
|
|
508
508
|
*/
|
|
509
509
|
exports.emptyMessageStream = {
|
|
510
510
|
read: async () => {
|
|
@@ -512,7 +512,7 @@ exports.emptyMessageStream = {
|
|
|
512
512
|
},
|
|
513
513
|
};
|
|
514
514
|
/**
|
|
515
|
-
* @
|
|
515
|
+
* @internal
|
|
516
516
|
*/
|
|
517
517
|
function streamFromMessages(messagesArg) {
|
|
518
518
|
let messages = messagesArg;
|
|
@@ -529,7 +529,7 @@ function streamFromMessages(messagesArg) {
|
|
|
529
529
|
}
|
|
530
530
|
exports.streamFromMessages = streamFromMessages;
|
|
531
531
|
/**
|
|
532
|
-
* @
|
|
532
|
+
* @internal
|
|
533
533
|
*/
|
|
534
534
|
function streamObserver(stream, handler) {
|
|
535
535
|
return {
|