@fluidframework/driver-utils 2.0.0-internal.7.0.0 → 2.0.0-internal.7.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (188) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/api-extractor.json +1 -1
  3. package/api-report/driver-utils.api.md +401 -0
  4. package/dist/adapters/compression/compressionTypes.d.ts +6 -0
  5. package/dist/adapters/compression/compressionTypes.d.ts.map +1 -1
  6. package/dist/adapters/compression/compressionTypes.js +3 -0
  7. package/dist/adapters/compression/compressionTypes.js.map +1 -1
  8. package/dist/adapters/compression/documentServiceCompressionAdapter.d.ts.map +1 -1
  9. package/dist/adapters/compression/documentServiceCompressionAdapter.js.map +1 -1
  10. package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.ts +4 -0
  11. package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.ts.map +1 -1
  12. package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js +4 -0
  13. package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js.map +1 -1
  14. package/dist/adapters/predefinedAdapters.d.ts +1 -0
  15. package/dist/adapters/predefinedAdapters.d.ts.map +1 -1
  16. package/dist/adapters/predefinedAdapters.js +1 -0
  17. package/dist/adapters/predefinedAdapters.js.map +1 -1
  18. package/dist/blob.d.ts +3 -0
  19. package/dist/blob.d.ts.map +1 -1
  20. package/dist/blob.js +3 -0
  21. package/dist/blob.js.map +1 -1
  22. package/dist/buildSnapshotTree.d.ts +1 -0
  23. package/dist/buildSnapshotTree.d.ts.map +1 -1
  24. package/dist/buildSnapshotTree.js +1 -0
  25. package/dist/buildSnapshotTree.js.map +1 -1
  26. package/dist/documentStorageServiceProxy.d.ts +3 -0
  27. package/dist/documentStorageServiceProxy.d.ts.map +1 -1
  28. package/dist/documentStorageServiceProxy.js +3 -0
  29. package/dist/documentStorageServiceProxy.js.map +1 -1
  30. package/dist/error.d.ts +4 -1
  31. package/dist/error.d.ts.map +1 -1
  32. package/dist/error.js +4 -1
  33. package/dist/error.js.map +1 -1
  34. package/dist/index.d.ts +1 -1
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js +2 -1
  37. package/dist/index.js.map +1 -1
  38. package/dist/insecureUrlResolver.d.ts +1 -0
  39. package/dist/insecureUrlResolver.d.ts.map +1 -1
  40. package/dist/insecureUrlResolver.js +1 -0
  41. package/dist/insecureUrlResolver.js.map +1 -1
  42. package/dist/messageRecognition.d.ts +10 -0
  43. package/dist/messageRecognition.d.ts.map +1 -1
  44. package/dist/messageRecognition.js +10 -3
  45. package/dist/messageRecognition.js.map +1 -1
  46. package/dist/network.d.ts +49 -3
  47. package/dist/network.d.ts.map +1 -1
  48. package/dist/network.js +45 -5
  49. package/dist/network.js.map +1 -1
  50. package/dist/networkUtils.d.ts +3 -0
  51. package/dist/networkUtils.d.ts.map +1 -1
  52. package/dist/networkUtils.js +3 -0
  53. package/dist/networkUtils.js.map +1 -1
  54. package/dist/packageVersion.d.ts +1 -1
  55. package/dist/packageVersion.js +1 -1
  56. package/dist/packageVersion.js.map +1 -1
  57. package/dist/parallelRequests.d.ts +12 -0
  58. package/dist/parallelRequests.d.ts.map +1 -1
  59. package/dist/parallelRequests.js +12 -0
  60. package/dist/parallelRequests.js.map +1 -1
  61. package/dist/prefetchDocumentStorageService.d.ts +3 -0
  62. package/dist/prefetchDocumentStorageService.d.ts.map +1 -1
  63. package/dist/prefetchDocumentStorageService.js +3 -0
  64. package/dist/prefetchDocumentStorageService.js.map +1 -1
  65. package/dist/rateLimiter.d.ts +3 -0
  66. package/dist/rateLimiter.d.ts.map +1 -1
  67. package/dist/rateLimiter.js +3 -0
  68. package/dist/rateLimiter.js.map +1 -1
  69. package/dist/readAndParse.d.ts +1 -0
  70. package/dist/readAndParse.d.ts.map +1 -1
  71. package/dist/readAndParse.js +1 -0
  72. package/dist/readAndParse.js.map +1 -1
  73. package/dist/runWithRetry.d.ts +5 -0
  74. package/dist/runWithRetry.d.ts.map +1 -1
  75. package/dist/runWithRetry.js +4 -2
  76. package/dist/runWithRetry.js.map +1 -1
  77. package/dist/summaryForCreateNew.d.ts +3 -1
  78. package/dist/summaryForCreateNew.d.ts.map +1 -1
  79. package/dist/summaryForCreateNew.js +4 -2
  80. package/dist/summaryForCreateNew.js.map +1 -1
  81. package/dist/treeConversions.d.ts +1 -0
  82. package/dist/treeConversions.d.ts.map +1 -1
  83. package/dist/treeConversions.js +1 -0
  84. package/dist/treeConversions.js.map +1 -1
  85. package/dist/tsdoc-metadata.json +1 -1
  86. package/lib/adapters/compression/compressionTypes.d.ts +6 -0
  87. package/lib/adapters/compression/compressionTypes.d.ts.map +1 -1
  88. package/lib/adapters/compression/compressionTypes.js +3 -0
  89. package/lib/adapters/compression/compressionTypes.js.map +1 -1
  90. package/lib/adapters/compression/documentServiceCompressionAdapter.d.ts.map +1 -1
  91. package/lib/adapters/compression/documentServiceCompressionAdapter.js.map +1 -1
  92. package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.ts +4 -0
  93. package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.ts.map +1 -1
  94. package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js +4 -0
  95. package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js.map +1 -1
  96. package/lib/adapters/predefinedAdapters.d.ts +1 -0
  97. package/lib/adapters/predefinedAdapters.d.ts.map +1 -1
  98. package/lib/adapters/predefinedAdapters.js +1 -0
  99. package/lib/adapters/predefinedAdapters.js.map +1 -1
  100. package/lib/blob.d.ts +3 -0
  101. package/lib/blob.d.ts.map +1 -1
  102. package/lib/blob.js +3 -0
  103. package/lib/blob.js.map +1 -1
  104. package/lib/buildSnapshotTree.d.ts +1 -0
  105. package/lib/buildSnapshotTree.d.ts.map +1 -1
  106. package/lib/buildSnapshotTree.js +1 -0
  107. package/lib/buildSnapshotTree.js.map +1 -1
  108. package/lib/documentStorageServiceProxy.d.ts +3 -0
  109. package/lib/documentStorageServiceProxy.d.ts.map +1 -1
  110. package/lib/documentStorageServiceProxy.js +3 -0
  111. package/lib/documentStorageServiceProxy.js.map +1 -1
  112. package/lib/error.d.ts +4 -1
  113. package/lib/error.d.ts.map +1 -1
  114. package/lib/error.js +4 -1
  115. package/lib/error.js.map +1 -1
  116. package/lib/index.d.ts +1 -1
  117. package/lib/index.d.ts.map +1 -1
  118. package/lib/index.js +1 -1
  119. package/lib/index.js.map +1 -1
  120. package/lib/insecureUrlResolver.d.ts +1 -0
  121. package/lib/insecureUrlResolver.d.ts.map +1 -1
  122. package/lib/insecureUrlResolver.js +1 -0
  123. package/lib/insecureUrlResolver.js.map +1 -1
  124. package/lib/messageRecognition.d.ts +10 -0
  125. package/lib/messageRecognition.d.ts.map +1 -1
  126. package/lib/messageRecognition.js +10 -3
  127. package/lib/messageRecognition.js.map +1 -1
  128. package/lib/network.d.ts +49 -3
  129. package/lib/network.d.ts.map +1 -1
  130. package/lib/network.js +45 -5
  131. package/lib/network.js.map +1 -1
  132. package/lib/networkUtils.d.ts +3 -0
  133. package/lib/networkUtils.d.ts.map +1 -1
  134. package/lib/networkUtils.js +3 -0
  135. package/lib/networkUtils.js.map +1 -1
  136. package/lib/packageVersion.d.ts +1 -1
  137. package/lib/packageVersion.js +1 -1
  138. package/lib/packageVersion.js.map +1 -1
  139. package/lib/parallelRequests.d.ts +12 -0
  140. package/lib/parallelRequests.d.ts.map +1 -1
  141. package/lib/parallelRequests.js +12 -0
  142. package/lib/parallelRequests.js.map +1 -1
  143. package/lib/prefetchDocumentStorageService.d.ts +3 -0
  144. package/lib/prefetchDocumentStorageService.d.ts.map +1 -1
  145. package/lib/prefetchDocumentStorageService.js +3 -0
  146. package/lib/prefetchDocumentStorageService.js.map +1 -1
  147. package/lib/rateLimiter.d.ts +3 -0
  148. package/lib/rateLimiter.d.ts.map +1 -1
  149. package/lib/rateLimiter.js +3 -0
  150. package/lib/rateLimiter.js.map +1 -1
  151. package/lib/readAndParse.d.ts +1 -0
  152. package/lib/readAndParse.d.ts.map +1 -1
  153. package/lib/readAndParse.js +1 -0
  154. package/lib/readAndParse.js.map +1 -1
  155. package/lib/runWithRetry.d.ts +5 -0
  156. package/lib/runWithRetry.d.ts.map +1 -1
  157. package/lib/runWithRetry.js +4 -2
  158. package/lib/runWithRetry.js.map +1 -1
  159. package/lib/summaryForCreateNew.d.ts +3 -1
  160. package/lib/summaryForCreateNew.d.ts.map +1 -1
  161. package/lib/summaryForCreateNew.js +4 -2
  162. package/lib/summaryForCreateNew.js.map +1 -1
  163. package/lib/treeConversions.d.ts +1 -0
  164. package/lib/treeConversions.d.ts.map +1 -1
  165. package/lib/treeConversions.js +1 -0
  166. package/lib/treeConversions.js.map +1 -1
  167. package/package.json +17 -18
  168. package/src/adapters/compression/compressionTypes.ts +6 -0
  169. package/src/adapters/compression/documentServiceCompressionAdapter.ts +4 -1
  170. package/src/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.ts +4 -0
  171. package/src/adapters/predefinedAdapters.ts +1 -0
  172. package/src/blob.ts +11 -2
  173. package/src/buildSnapshotTree.ts +1 -0
  174. package/src/documentStorageServiceProxy.ts +3 -0
  175. package/src/error.ts +4 -1
  176. package/src/index.ts +1 -0
  177. package/src/insecureUrlResolver.ts +1 -0
  178. package/src/messageRecognition.ts +10 -3
  179. package/src/network.ts +64 -9
  180. package/src/networkUtils.ts +3 -0
  181. package/src/packageVersion.ts +1 -1
  182. package/src/parallelRequests.ts +12 -0
  183. package/src/prefetchDocumentStorageService.ts +3 -0
  184. package/src/rateLimiter.ts +3 -0
  185. package/src/readAndParse.ts +1 -0
  186. package/src/runWithRetry.ts +7 -4
  187. package/src/summaryForCreateNew.ts +4 -1
  188. package/src/treeConversions.ts +1 -0
@@ -1 +1 @@
1
- {"version":3,"file":"insecureUrlRes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soft 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 */\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,OAAO,EAAE,KAAK,EAAE,MAAM,KAAK,CAAC;AAC5B,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAEpD,OAAO,EAA8B,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAC9F,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,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,KAAK,CAAC,OAAO,CAAC,OAAiB;QACrC,yEAAyE;QACzE,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC,YAAY,CAAC,SAAS,CAAC,EAAE;YAC9C,MAAM,CAAC,EAAE,WAAW,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC/C,MAAM,YAAY,GAAG,IAAI,eAAe,CAAC,WAAW,CAAC,CAAC;YACtD,MAAM,QAAQ,GAAG,YAAY,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;YAC9C,OAAO,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;SACpC;QACD,MA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C,OAAO;YACrE,OAAO,EAAE;gBACR,CAAC,YAAY,CAAC,SAAS,CAAC,EAAE,IAAI;aAC9B;SACD,CAAC;QACF,OAAO,gBAAgB,CAAC;IACzB,CAAC;CACD","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"]}
@@ -7,12 +7,22 @@ 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
+ * @public
10
11
  */
11
12
  export declare function isRuntimeMessage(message: {
12
13
  type: string;
13
14
  }): boolean;
15
+ /**
16
+ * @privateRemarks ADO #1385: staging code changes across layers.
17
+ * Eventually to be replaced by MessageType.accept
18
+ * @public
19
+ */
14
20
  export declare enum MessageType2 {
15
21
  Accept = "accept"
16
22
  }
23
+ /**
24
+ * @privateRemarks ADO #1385: To be moved to packages/protocol-base/src/protocol.ts
25
+ * @public
26
+ */
17
27
  export declare function canBeCoalescedByService(message: ISequencedDocumentMessage | IDocumentMessage): boolean;
18
28
  //# sourceMappingURL=messageRecognition.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"messageRecognition.d.ts","sourceRoot":"","sources":["../src/messageRecognition.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACN,gBAAgB,EAChB,yBAAyB,EAEzB,MAAM,sCAAsC,CAAC;AAE9C;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAEnE;AAID,oBAAY,YAAY;IACvB,MAAM,WAAW;CACjB;AAGD,wBAAgB,uBAAuB,CACtC,OAAO,EAAE,yBAAyB,GAAG,gBAAgB,GACnD,OAAO,CAIT"}
1
+ {"version":3,"file":"messageRecognition.d.ts","sourceRoot":"","sources":["../src/messageRecognition.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACN,gBAAgB,EAChB,yBAAyB,EAEzB,MAAM,sCAAsC,CAAC;AAE9C;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAEnE;AAED;;;;GAIG;AACH,oBAAY,YAAY;IACvB,MAAM,WAAW;CACjB;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CACtC,OAAO,EAAE,yBAAyB,GAAG,gBAAgB,GACnD,OAAO,CAIT"}
@@ -7,17 +7,24 @@ import { MessageType, } from "@fluidframework/protocol-definitions";
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
+ * @public
10
11
  */
11
12
  export function isRuntimeMessage(message) {
12
13
  return message.type === MessageType.Operation;
13
14
  }
14
- // ADO #1385: staging code changes across layers.
15
- // Eventually to be replaced by MessageType.accept
15
+ /**
16
+ * @privateRemarks ADO #1385: staging code changes across layers.
17
+ * Eventually to be replaced by MessageType.accept
18
+ * @public
19
+ */
16
20
  export var MessageType2;
17
21
  (function (MessageType2) {
18
22
  MessageType2["Accept"] = "accept";
19
23
  })(MessageType2 || (MessageType2 = {}));
20
- // ADO #1385: To be moved to packages/protocol-base/src/protocol.ts
24
+ /**
25
+ * @privateRemarks ADO #1385: To be moved to packages/protocol-base/src/protocol.ts
26
+ * @public
27
+ */
21
28
  export function canBeCoalescedByService(message) {
22
29
  // This assumes that in the future relay service may implement coalescing of accept messages,
23
30
  // same way it was doing coalescing of immediate noops in the past.
@@ -1 +1 @@
1
- {"version":3,"file":"messageRecognition.js","sourceRoot":"","sources":["../src/messageRecognition.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAGN,WAAW,GACX,MAAM,sCAAsC,CAAC;AAE9C;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAyB;IACzD,OAAO,OAAO,CAAC,IAAI,KAAK,WAAW,CAAC,SAAS,CAAC;AAC/C,CAAC;AAED,iDAAiD;AACjD,kDAAkD;AAClD,MAAM,CAAN,IAAY,YAEX;AAFD,WAAY,YAAY;IACvB,iCAAiB,CAAA;AAClB,CAAC,EAFW,YAAY,KAAZ,YAAY,QAEvB;AAED,mEAAmE;AACnE,MAAM,UAAU,uBAAuB,CACtC,OAAqD;IAErD,6FAA6F;IAC7F,mEAAmE;IACnE,OAAO,OAAO,CAAC,IAAI,KAAK,WAAW,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,KAAK,YAAY,CAAC,MAAM,CAAC;AAClF,CAAC","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 */\nexport function isRuntimeMessage(message: { type: string }): boolean {\n\treturn message.type === MessageType.Operation;\n}\n\n// ADO #1385: staging code changes across layers.\n// Eventually to be replaced by MessageType.accept\nexport enum MessageType2 {\n\tAccept = \"accept\",\n}\n\n// ADO #1385: To be moved to packages/protocol-base/src/protocol.ts\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"]}
1
+ {"version":3,"file":"messageRecognition.js","sourceRoot":"","sources":["../src/messageRecognition.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAGN,WAAW,GACX,MAAM,sCAAsC,CAAC;AAE9C;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAyB;IACzD,OAAO,OAAO,CAAC,IAAI,KAAK,WAAW,CAAC,SAAS,CAAC;AAC/C,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAN,IAAY,YAEX;AAFD,WAAY,YAAY;IACvB,iCAAiB,CAAA;AAClB,CAAC,EAFW,YAAY,KAAZ,YAAY,QAEvB;AAED;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CACtC,OAAqD;IAErD,6FAA6F;IAC7F,mEAAmE;IACnE,OAAO,OAAO,CAAC,IAAI,KAAK,WAAW,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,KAAK,YAAY,CAAC,MAAM,CAAC;AAClF,CAAC","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 * @public\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 * @public\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 * @public\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/lib/network.d.ts CHANGED
@@ -5,18 +5,31 @@
5
5
  import { IThrottlingWarning, IDriverErrorBase, IAuthorizationError, DriverErrorType, ILocationRedirectionError, IResolvedUrl } from "@fluidframework/driver-definitions";
6
6
  import { ITelemetryProperties } from "@fluidframework/core-interfaces";
7
7
  import { IFluidErrorBase, LoggingError } from "@fluidframework/telemetry-utils";
8
+ /**
9
+ * @public
10
+ */
8
11
  export declare enum OnlineStatus {
9
12
  Offline = 0,
10
13
  Online = 1,
11
14
  Unknown = 2
12
15
  }
16
+ /**
17
+ * It tells if we have local connection only - we might not have connection to web.
18
+ * No solution for node.js (other than resolve dns names / ping specific sites)
19
+ * Can also use window.addEventListener("online" / "offline")
20
+ * @public
21
+ */
13
22
  export declare function isOnline(): OnlineStatus;
14
- /** Telemetry props with driver-specific required properties */
23
+ /**
24
+ * Telemetry props with driver-specific required properties
25
+ * @public
26
+ */
15
27
  export type DriverErrorTelemetryProps = ITelemetryProperties & {
16
28
  driverVersion: string | undefined;
17
29
  };
18
30
  /**
19
31
  * Generic network error class.
32
+ * @public
20
33
  */
21
34
  export declare class GenericNetworkError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {
22
35
  readonly canRetry: boolean;
@@ -25,12 +38,16 @@ export declare class GenericNetworkError extends LoggingError implements IDriver
25
38
  }
26
39
  /**
27
40
  * FluidInvalidSchema error class.
41
+ * @public
28
42
  */
29
43
  export declare class FluidInvalidSchemaError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {
30
44
  readonly errorType = DriverErrorType.fluidInvalidSchema;
31
45
  readonly canRetry = false;
32
46
  constructor(message: string, props: DriverErrorTelemetryProps);
33
47
  }
48
+ /**
49
+ * @public
50
+ */
34
51
  export declare class DeltaStreamConnectionForbiddenError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {
35
52
  static readonly errorType = DriverErrorType.deltaStreamConnectionForbidden;
36
53
  readonly errorType = DriverErrorType.deltaStreamConnectionForbidden;
@@ -38,6 +55,9 @@ export declare class DeltaStreamConnectionForbiddenError extends LoggingError im
38
55
  readonly storageOnlyReason: string | undefined;
39
56
  constructor(message: string, props: DriverErrorTelemetryProps, storageOnlyReason?: string);
40
57
  }
58
+ /**
59
+ * @public
60
+ */
41
61
  export declare class AuthorizationError extends LoggingError implements IAuthorizationError, IFluidErrorBase {
42
62
  readonly claims: string | undefined;
43
63
  readonly tenantId: string | undefined;
@@ -45,27 +65,40 @@ export declare class AuthorizationError extends LoggingError implements IAuthori
45
65
  readonly canRetry = false;
46
66
  constructor(message: string, claims: string | undefined, tenantId: string | undefined, props: DriverErrorTelemetryProps);
47
67
  }
68
+ /**
69
+ * @public
70
+ */
48
71
  export declare class LocationRedirectionError extends LoggingError implements ILocationRedirectionError, IFluidErrorBase {
49
72
  readonly redirectUrl: IResolvedUrl;
50
73
  readonly errorType = DriverErrorType.locationRedirection;
51
74
  readonly canRetry = false;
52
75
  constructor(message: string, redirectUrl: IResolvedUrl, props: DriverErrorTelemetryProps);
53
76
  }
77
+ /**
78
+ * @public
79
+ */
54
80
  export declare class NetworkErrorBasic<T extends string> extends LoggingError implements IFluidErrorBase {
55
81
  readonly errorType: T;
56
82
  readonly canRetry: boolean;
57
83
  constructor(message: string, errorType: T, canRetry: boolean, props: DriverErrorTelemetryProps);
58
84
  }
85
+ /**
86
+ * @public
87
+ */
59
88
  export declare class NonRetryableError<T extends string> extends NetworkErrorBasic<T> {
60
89
  readonly errorType: T;
61
90
  constructor(message: string, errorType: T, props: DriverErrorTelemetryProps);
62
91
  }
92
+ /**
93
+ * @public
94
+ */
63
95
  export declare class RetryableError<T extends string> extends NetworkErrorBasic<T> {
64
96
  readonly errorType: T;
65
97
  constructor(message: string, errorType: T, props: DriverErrorTelemetryProps);
66
98
  }
67
99
  /**
68
100
  * Throttling error class - used to communicate all throttling errors
101
+ * @public
69
102
  */
70
103
  export declare class ThrottlingError extends LoggingError implements IThrottlingWarning, IFluidErrorBase {
71
104
  readonly retryAfterSeconds: number;
@@ -73,7 +106,13 @@ export declare class ThrottlingError extends LoggingError implements IThrottling
73
106
  readonly canRetry = true;
74
107
  constructor(message: string, retryAfterSeconds: number, props: DriverErrorTelemetryProps);
75
108
  }
109
+ /**
110
+ * @public
111
+ */
76
112
  export declare const createWriteError: (message: string, props: DriverErrorTelemetryProps) => NonRetryableError<"writeError">;
113
+ /**
114
+ * @public
115
+ */
77
116
  export declare function createGenericNetworkError(message: string, retryInfo: {
78
117
  canRetry: boolean;
79
118
  retryAfterMs?: number;
@@ -82,10 +121,17 @@ export declare function createGenericNetworkError(message: string, retryInfo: {
82
121
  * Check if a connection error can be retried. Unless explicitly allowed, retry is disallowed.
83
122
  * I.e. asserts or unexpected exceptions in our code result in container failure.
84
123
  * @param error - The error to inspect for ability to retry
124
+ * @public
85
125
  */
86
126
  export declare const canRetryOnError: (error: any) => boolean;
87
- /** Check retryAfterSeconds property on error */
127
+ /**
128
+ * Check retryAfterSeconds property on error
129
+ * @public
130
+ * */
88
131
  export declare const getRetryDelaySecondsFromError: (error: any) => number | undefined;
89
- /** Check retryAfterSeconds property on error and convert to ms */
132
+ /**
133
+ * Check retryAfterSeconds property on error and convert to ms
134
+ * @public
135
+ * */
90
136
  export declare const getRetryDelayFromError: (error: any) => number | undefined;
91
137
  //# sourceMappingURL=network.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"network.d.ts","sourceRoot":"","sources":["../src/network.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,EAEnB,eAAe,EACf,yBAAyB,EACzB,YAAY,EAEZ,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAEhF,oBAAY,YAAY;IACvB,OAAO,IAAA;IACP,MAAM,IAAA;IACN,OAAO,IAAA;CACP;AAKD,wBAAgB,QAAQ,IAAI,YAAY,CASvC;AAED,+DAA+D;AAC/D,MAAM,MAAM,yBAAyB,GAAG,oBAAoB,GAAG;IAC9D,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;CAClC,CAAC;AAEF;;GAEG;AACH,qBA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;AAEhD;;;KAGK;AACL,eAAO,MAAM,sBAAsB,UAAW,GAAG,KAAG,MAAM,GAAG,SACuB,CAAC"}
package/lib/network.js CHANGED
@@ -6,15 +6,21 @@ import {
6
6
  // eslint-disable-next-line import/no-deprecated
7
7
  DriverErrorType, DriverErrorTypes, } from "@fluidframework/driver-definitions";
8
8
  import { LoggingError } from "@fluidframework/telemetry-utils";
9
+ /**
10
+ * @public
11
+ */
9
12
  export var OnlineStatus;
10
13
  (function (OnlineStatus) {
11
14
  OnlineStatus[OnlineStatus["Offline"] = 0] = "Offline";
12
15
  OnlineStatus[OnlineStatus["Online"] = 1] = "Online";
13
16
  OnlineStatus[OnlineStatus["Unknown"] = 2] = "Unknown";
14
17
  })(OnlineStatus || (OnlineStatus = {}));
15
- // It tells if we have local connection only - we might not have connection to web.
16
- // No solution for node.js (other than resolve dns names / ping specific sites)
17
- // Can also use window.addEventListener("online" / "offline")
18
+ /**
19
+ * It tells if we have local connection only - we might not have connection to web.
20
+ * No solution for node.js (other than resolve dns names / ping specific sites)
21
+ * Can also use window.addEventListener("online" / "offline")
22
+ * @public
23
+ */
18
24
  export function isOnline() {
19
25
  if (typeof navigator === "object" &&
20
26
  navigator !== null &&
@@ -25,6 +31,7 @@ export function isOnline() {
25
31
  }
26
32
  /**
27
33
  * Generic network error class.
34
+ * @public
28
35
  */
29
36
  export class GenericNetworkError extends LoggingError {
30
37
  constructor(message, canRetry, props) {
@@ -36,6 +43,7 @@ export class GenericNetworkError extends LoggingError {
36
43
  }
37
44
  /**
38
45
  * FluidInvalidSchema error class.
46
+ * @public
39
47
  */
40
48
  export class FluidInvalidSchemaError extends LoggingError {
41
49
  constructor(message, props) {
@@ -45,6 +53,9 @@ export class FluidInvalidSchemaError extends LoggingError {
45
53
  this.canRetry = false;
46
54
  }
47
55
  }
56
+ /**
57
+ * @public
58
+ */
48
59
  export class DeltaStreamConnectionForbiddenError extends LoggingError {
49
60
  constructor(message, props, storageOnlyReason) {
50
61
  super(message, { ...props, statusCode: 400 });
@@ -55,6 +66,9 @@ export class DeltaStreamConnectionForbiddenError extends LoggingError {
55
66
  }
56
67
  // eslint-disable-next-line import/no-deprecated
57
68
  DeltaStreamConnectionForbiddenError.errorType = DriverErrorType.deltaStreamConnectionForbidden;
69
+ /**
70
+ * @public
71
+ */
58
72
  export class AuthorizationError extends LoggingError {
59
73
  constructor(message, claims, tenantId, props) {
60
74
  // don't log claims or tenantId
@@ -66,6 +80,9 @@ export class AuthorizationError extends LoggingError {
66
80
  this.canRetry = false;
67
81
  }
68
82
  }
83
+ /**
84
+ * @public
85
+ */
69
86
  export class LocationRedirectionError extends LoggingError {
70
87
  constructor(message, redirectUrl, props) {
71
88
  // do not log redirectURL
@@ -76,6 +93,9 @@ export class LocationRedirectionError extends LoggingError {
76
93
  this.canRetry = false;
77
94
  }
78
95
  }
96
+ /**
97
+ * @public
98
+ */
79
99
  export class NetworkErrorBasic extends LoggingError {
80
100
  constructor(message, errorType, canRetry, props) {
81
101
  super(message, props);
@@ -83,12 +103,18 @@ export class NetworkErrorBasic extends LoggingError {
83
103
  this.canRetry = canRetry;
84
104
  }
85
105
  }
106
+ /**
107
+ * @public
108
+ */
86
109
  export class NonRetryableError extends NetworkErrorBasic {
87
110
  constructor(message, errorType, props) {
88
111
  super(message, errorType, false, props);
89
112
  this.errorType = errorType;
90
113
  }
91
114
  }
115
+ /**
116
+ * @public
117
+ */
92
118
  export class RetryableError extends NetworkErrorBasic {
93
119
  constructor(message, errorType, props) {
94
120
  super(message, errorType, true, props);
@@ -97,6 +123,7 @@ export class RetryableError extends NetworkErrorBasic {
97
123
  }
98
124
  /**
99
125
  * Throttling error class - used to communicate all throttling errors
126
+ * @public
100
127
  */
101
128
  export class ThrottlingError extends LoggingError {
102
129
  constructor(message, retryAfterSeconds, props) {
@@ -107,7 +134,13 @@ export class ThrottlingError extends LoggingError {
107
134
  this.canRetry = true;
108
135
  }
109
136
  }
137
+ /**
138
+ * @public
139
+ */
110
140
  export const createWriteError = (message, props) => new NonRetryableError(message, DriverErrorTypes.writeError, props);
141
+ /**
142
+ * @public
143
+ */
111
144
  export function createGenericNetworkError(message, retryInfo, props) {
112
145
  if (retryInfo.retryAfterMs !== undefined && retryInfo.canRetry) {
113
146
  return new ThrottlingError(message, retryInfo.retryAfterMs / 1000, props);
@@ -118,10 +151,17 @@ export function createGenericNetworkError(message, retryInfo, props) {
118
151
  * Check if a connection error can be retried. Unless explicitly allowed, retry is disallowed.
119
152
  * I.e. asserts or unexpected exceptions in our code result in container failure.
120
153
  * @param error - The error to inspect for ability to retry
154
+ * @public
121
155
  */
122
156
  export const canRetryOnError = (error) => error?.canRetry === true;
123
- /** Check retryAfterSeconds property on error */
157
+ /**
158
+ * Check retryAfterSeconds property on error
159
+ * @public
160
+ * */
124
161
  export const getRetryDelaySecondsFromError = (error) => error?.retryAfterSeconds;
125
- /** Check retryAfterSeconds property on error and convert to ms */
162
+ /**
163
+ * Check retryAfterSeconds property on error and convert to ms
164
+ * @public
165
+ * */
126
166
  export const getRetryDelayFromError = (error) => error?.retryAfterSeconds !== undefined ? error.retryAfterSeconds * 1000 : undefined;
127
167
  //# sourceMappingURL=network.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"network.js","sourceRoot":"","sources":["../src/network.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO;AAIN,gDAAgD;AAChD,eAAe,EAGf,gBAAgB,GAChB,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAmB,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAEhF,MAAM,CAAN,IAAY,YAIX;AAJD,WAAY,YAAY;IACvB,qDAAO,CAAA;IACP,mDAAM,CAAA;IACN,qDAAO,CAAA;AACR,CAAC,EAJW,YAAY,KAAZ,YAAY,QAIvB;AAED,mFAAmF;AACnF,+EAA+E;AAC/E,6DAA6D;AAC7D,MAAM,UAAU,QAAQ;IACvB,IACC,OAAO,SAAS,KAAK,QAAQ;QAC7B,SAAS,KAAK,IAAI;QAClB,OAA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. 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\nexport enum OnlineStatus {\n\tOffline,\n\tOnline,\n\tUnknown,\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\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/** Telemetry props with driver-specific required properties */\nexport type DriverErrorTelemetryProps = ITelemetryProperties & {\n\tdriverVersion: string | undefined;\n};\n\n/**\n * Generic network error class.\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(message: string, readonly canRetry: boolean, props: DriverErrorTelemetryProps) {\n\t\tsuper(message, props);\n\t}\n}\n\n/**\n * FluidInvalidSchema error class.\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\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\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\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\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\nexport class NonRetryableError<T extends string> extends NetworkErrorBasic<T> {\n\tconstructor(message: string, readonly errorType: T, props: DriverErrorTelemetryProps) {\n\t\tsuper(message, errorType, false, props);\n\t}\n}\n\nexport class RetryableError<T extends string> extends NetworkErrorBasic<T> {\n\tconstructor(message: string, readonly errorType: T, props: DriverErrorTelemetryProps) {\n\t\tsuper(message, errorType, true, props);\n\t}\n}\n\n/**\n * Throttling error class - used to communicate all throttling errors\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\nexport const createWriteError = (message: string, props: DriverErrorTelemetryProps) =>\n\tnew NonRetryableError(message, DriverErrorTypes.writeError, props);\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 */\nexport const canRetryOnError = (error: any): boolean => error?.canRetry === true;\n\n/** Check retryAfterSeconds property on error */\nexport const getRetryDelaySecondsFromError = (error: any): number | undefined =>\n\terror?.retryAfterSeconds as number | undefined;\n\n/** Check retryAfterSeconds property on error and convert to ms */\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,OAAO;AAIN,gDAAgD;AAChD,eAAe,EAGf,gBAAgB,GAChB,MAAM,oCAAoC,CAA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AAe,GAAG,CAAC,KAAU,EAAW,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,CAAC;AAEjF;;;KAGK;AACL,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,KAAU,EAAsB,EAAE,CAC/E,KAAK,EAAE,iBAAuC,CAAC;AAEhD;;;KAGK;AACL,MAAM,CAAC,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","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"]}
@@ -4,5 +4,8 @@
4
4
  */
5
5
  import { ITelemetryErrorEvent } from "@fluidframework/core-interfaces";
6
6
  import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
7
+ /**
8
+ * @public
9
+ */
7
10
  export declare function logNetworkFailure(logger: ITelemetryLoggerExt, event: ITelemetryErrorEvent, error?: any): void;
8
11
  //# sourceMappingURL=networkUtils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"networkUtils.d.ts","sourceRoot":"","sources":["../src/networkUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAGtE,wBAAgB,iBAAiB,CAChC,MAAM,EAAE,mBAAmB,EAC3B,KAAK,EAAE,oBAAoB,EAC3B,KAAK,CAAC,EAAE,GAAG,QAmBX"}
1
+ {"version":3,"file":"networkUtils.d.ts","sourceRoot":"","sources":["../src/networkUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAGtE;;GAEG;AACH,wBAAgB,iBAAiB,CAChC,MAAM,EAAE,mBAAmB,EAC3B,KAAK,EAAE,oBAAoB,EAC3B,KAAK,CAAC,EAAE,GAAG,QAmBX"}
@@ -3,6 +3,9 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { isOnline, OnlineStatus, canRetryOnError } from "./network";
6
+ /**
7
+ * @public
8
+ */
6
9
  export function logNetworkFailure(logger, event, error) {
7
10
  const newEvent = { ...event };
8
11
  const errorOnlineProp = error?.online;
@@ -1 +1 @@
1
- {"version":3,"file":"networkUtils.js","sourceRoot":"","sources":["../src/networkUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAEpE,MAAM,UAAU,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,YAAY,CAAC,QAAQ,EAAE,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,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC;IACjE,MAAM,CAAC,kBAAkB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;AAC5C,CAAC","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\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"]}
1
+ {"version":3,"file":"networkUtils.js","sourceRoot":"","sources":["../src/networkUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAEpE;;GAEG;AACH,MAAM,UAAU,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,YAAY,CAAC,QAAQ,EAAE,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,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC;IACjE,MAAM,CAAC,kBAAkB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;AAC5C,CAAC","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 * @public\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"]}
@@ -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.7.0.0";
8
+ export declare const pkgVersion = "2.0.0-internal.7.2.0";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export const pkgName = "@fluidframework/driver-utils";
8
- export const pkgVersion = "2.0.0-internal.7.0.0";
8
+ export const pkgVersion = "2.0.0-internal.7.2.0";
9
9
  //# sourceMappingURL=packageVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,8BAA8B,CAAC;AACtD,MAAM,CAAC,MAAM,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.7.0.0\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,8BAA8B,CAAC;AACtD,MAAM,CAAC,MAAM,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.7.2.0\";\n"]}
@@ -13,6 +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
+ * @public
16
17
  */
17
18
  export declare class ParallelRequests<T> {
18
19
  private to;
@@ -47,6 +48,7 @@ export declare class ParallelRequests<T> {
47
48
  /**
48
49
  * Helper queue class to allow async push / pull
49
50
  * It's essentially a pipe allowing multiple writers, and single reader
51
+ * @public
50
52
  */
51
53
  export declare class Queue<T> implements IStream<T> {
52
54
  private readonly queue;
@@ -69,9 +71,19 @@ export declare class Queue<T> implements IStream<T> {
69
71
  * @param signal - Cancelation signal
70
72
  * @param scenarioName - Reason for fetching ops
71
73
  * @returns Messages fetched
74
+ * @public
72
75
  */
73
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
+ /**
78
+ * @public
79
+ */
74
80
  export declare const emptyMessageStream: IStream<ISequencedDocumentMessage[]>;
81
+ /**
82
+ * @public
83
+ */
75
84
  export declare function streamFromMessages(messagesArg: Promise<ISequencedDocumentMessage[]>): IStream<ISequencedDocumentMessage[]>;
85
+ /**
86
+ * @public
87
+ */
76
88
  export declare function streamObserver<T>(stream: IStream<T>, handler: (value: IStreamResult<T>) => void): IStream<T>;
77
89
  //# sourceMappingURL=parallelRequests.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"parallelRequ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EACjB,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,mBAAmB,EAC3B,MAAM,CAAC,EAAE,WAAW,EACpB,YAAY,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,yBAAyB,EAAE,CAAC,CAwGtC;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,OAAO,CAAC,yBAAyB,EAAE,CAInE,CAAC;AAEF;;GAEG;AACH,wBAAgB,kBAAkB,CACjC,WAAW,EAAE,OAAO,CAAC,yBAAyB,EAAE,CAAC,GAC/C,OAAO,CAAC,yBAAyB,EAAE,CAAC,CAYtC;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAC/B,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,EAClB,OAAO,EAAE,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,IAAI,GACxC,OAAO,CAAC,CAAC,CAAC,CAQZ"}
@@ -22,6 +22,7 @@ const MissingFetchDelayInMs = 100;
22
22
  * @param logger - logger to use
23
23
  * @param requestCallback - callback to request batches
24
24
  * @returns Queue that can be used to retrieve data
25
+ * @public
25
26
  */
26
27
  export class ParallelRequests {
27
28
  get working() {
@@ -261,6 +262,7 @@ export class ParallelRequests {
261
262
  /**
262
263
  * Helper queue class to allow async push / pull
263
264
  * It's essentially a pipe allowing multiple writers, and single reader
265
+ * @public
264
266
  */
265
267
  export class Queue {
266
268
  constructor() {
@@ -421,6 +423,7 @@ async function getSingleOpBatch(get, props, strongTo, logger, signal, scenarioNa
421
423
  * @param signal - Cancelation signal
422
424
  * @param scenarioName - Reason for fetching ops
423
425
  * @returns Messages fetched
426
+ * @public
424
427
  */
425
428
  export function requestOps(get, concurrency, fromTotal, toTotal, payloadSize, logger, signal, scenarioName) {
426
429
  let requests = 0;
@@ -494,11 +497,17 @@ export function requestOps(get, concurrency, fromTotal, toTotal, payloadSize, lo
494
497
  });
495
498
  return queue;
496
499
  }
500
+ /**
501
+ * @public
502
+ */
497
503
  export const emptyMessageStream = {
498
504
  read: async () => {
499
505
  return { done: true };
500
506
  },
501
507
  };
508
+ /**
509
+ * @public
510
+ */
502
511
  export function streamFromMessages(messagesArg) {
503
512
  let messages = messagesArg;
504
513
  return {
@@ -512,6 +521,9 @@ export function streamFromMessages(messagesArg) {
512
521
  },
513
522
  };
514
523
  }
524
+ /**
525
+ * @public
526
+ */
515
527
  export function streamObserver(stream, handler) {
516
528
  return {
517
529
  read: async () => {