@azure/storage-common 12.0.0-beta.2 → 12.0.1

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 (378) hide show
  1. package/dist/browser/BuffersStream.js +14 -0
  2. package/dist/browser/BuffersStream.js.map +1 -1
  3. package/dist/browser/PooledBuffer.js +13 -5
  4. package/dist/browser/PooledBuffer.js.map +1 -1
  5. package/dist/browser/StorageBrowserPolicyFactory.d.ts +16 -0
  6. package/dist/browser/StorageBrowserPolicyFactory.d.ts.map +1 -0
  7. package/dist/browser/StorageBrowserPolicyFactory.js +19 -0
  8. package/dist/browser/StorageBrowserPolicyFactory.js.map +1 -0
  9. package/dist/browser/StorageRetryPolicyFactory.d.ts +66 -0
  10. package/dist/browser/StorageRetryPolicyFactory.d.ts.map +1 -0
  11. package/dist/browser/StorageRetryPolicyFactory.js +28 -0
  12. package/dist/browser/StorageRetryPolicyFactory.js.map +1 -0
  13. package/dist/browser/credentials/AnonymousCredential.d.ts +19 -0
  14. package/dist/browser/credentials/AnonymousCredential.d.ts.map +1 -0
  15. package/dist/browser/credentials/AnonymousCredential.js +22 -0
  16. package/dist/browser/credentials/AnonymousCredential.js.map +1 -0
  17. package/dist/browser/credentials/Credential.d.ts +20 -0
  18. package/dist/browser/credentials/Credential.d.ts.map +1 -0
  19. package/dist/browser/credentials/Credential.js +18 -0
  20. package/dist/browser/credentials/Credential.js.map +1 -0
  21. package/dist/browser/credentials/StorageSharedKeyCredential-browser.d.mts.map +1 -0
  22. package/dist/browser/credentials/StorageSharedKeyCredential-browser.mjs.map +1 -0
  23. package/dist/browser/credentials/StorageSharedKeyCredential.d.ts +3 -0
  24. package/dist/browser/credentials/StorageSharedKeyCredential.js +5 -0
  25. package/dist/browser/index-browser.d.mts.map +1 -0
  26. package/dist/browser/index-browser.mjs.map +1 -0
  27. package/dist/browser/index.d.ts +17 -1
  28. package/dist/browser/index.js +17 -1
  29. package/dist/browser/log.d.ts +5 -0
  30. package/dist/browser/log.d.ts.map +1 -0
  31. package/dist/browser/log.js +8 -0
  32. package/dist/browser/log.js.map +1 -0
  33. package/dist/browser/policies/AnonymousCredentialPolicy.d.ts +15 -0
  34. package/dist/browser/policies/AnonymousCredentialPolicy.d.ts.map +1 -0
  35. package/dist/browser/policies/AnonymousCredentialPolicy.js +20 -0
  36. package/dist/browser/policies/AnonymousCredentialPolicy.js.map +1 -0
  37. package/dist/browser/policies/CredentialPolicy.d.ts +22 -0
  38. package/dist/browser/policies/CredentialPolicy.d.ts.map +1 -0
  39. package/dist/browser/policies/CredentialPolicy.js +29 -0
  40. package/dist/browser/policies/CredentialPolicy.js.map +1 -0
  41. package/dist/browser/policies/RequestPolicy.d.ts +45 -0
  42. package/dist/browser/policies/RequestPolicy.d.ts.map +1 -0
  43. package/dist/browser/policies/RequestPolicy.js +42 -0
  44. package/dist/browser/policies/RequestPolicy.js.map +1 -0
  45. package/dist/browser/policies/StorageBrowserPolicy.d.ts +28 -0
  46. package/dist/browser/policies/StorageBrowserPolicy.d.ts.map +1 -0
  47. package/dist/browser/policies/StorageBrowserPolicy.js +47 -0
  48. package/dist/browser/policies/StorageBrowserPolicy.js.map +1 -0
  49. package/dist/browser/policies/StorageBrowserPolicyV2.d.ts +11 -0
  50. package/dist/browser/policies/StorageBrowserPolicyV2.d.ts.map +1 -0
  51. package/dist/browser/policies/StorageBrowserPolicyV2.js +31 -0
  52. package/dist/browser/policies/StorageBrowserPolicyV2.js.map +1 -0
  53. package/dist/browser/policies/StorageCorrectContentLengthPolicy-browser.d.mts.map +1 -0
  54. package/dist/browser/policies/StorageCorrectContentLengthPolicy-browser.mjs.map +1 -0
  55. package/dist/browser/policies/StorageCorrectContentLengthPolicy.d.ts +10 -0
  56. package/dist/browser/policies/StorageCorrectContentLengthPolicy.js +18 -0
  57. package/dist/browser/policies/StorageRetryPolicy.d.ts +62 -0
  58. package/dist/browser/policies/StorageRetryPolicy.d.ts.map +1 -0
  59. package/dist/browser/policies/StorageRetryPolicy.js +220 -0
  60. package/dist/browser/policies/StorageRetryPolicy.js.map +1 -0
  61. package/dist/browser/policies/StorageRetryPolicyType.d.ts +14 -0
  62. package/dist/browser/policies/StorageRetryPolicyType.d.ts.map +1 -0
  63. package/dist/browser/policies/StorageRetryPolicyType.js +17 -0
  64. package/dist/browser/policies/StorageRetryPolicyType.js.map +1 -0
  65. package/dist/browser/policies/StorageRetryPolicyV2.d.ts +11 -0
  66. package/dist/browser/policies/StorageRetryPolicyV2.d.ts.map +1 -0
  67. package/dist/browser/policies/StorageRetryPolicyV2.js +165 -0
  68. package/dist/browser/policies/StorageRetryPolicyV2.js.map +1 -0
  69. package/dist/browser/policies/StorageSharedKeyCredentialPolicy.d.ts +54 -0
  70. package/dist/browser/policies/StorageSharedKeyCredentialPolicy.d.ts.map +1 -0
  71. package/dist/browser/policies/StorageSharedKeyCredentialPolicy.js +145 -0
  72. package/dist/browser/policies/StorageSharedKeyCredentialPolicy.js.map +1 -0
  73. package/dist/browser/policies/StorageSharedKeyCredentialPolicyV2-browser.d.mts.map +1 -0
  74. package/dist/browser/policies/StorageSharedKeyCredentialPolicyV2-browser.mjs.map +1 -0
  75. package/dist/browser/policies/StorageSharedKeyCredentialPolicyV2.d.ts +17 -0
  76. package/dist/browser/policies/StorageSharedKeyCredentialPolicyV2.js +18 -0
  77. package/dist/browser/utils/SharedKeyComparator.d.ts +2 -0
  78. package/dist/browser/utils/SharedKeyComparator.d.ts.map +1 -0
  79. package/dist/browser/utils/SharedKeyComparator.js +73 -0
  80. package/dist/browser/utils/SharedKeyComparator.js.map +1 -0
  81. package/dist/browser/utils/constants.d.ts +39 -0
  82. package/dist/browser/utils/constants.d.ts.map +1 -0
  83. package/dist/browser/utils/constants.js +64 -0
  84. package/dist/browser/utils/constants.js.map +1 -0
  85. package/dist/browser/utils/tracing.d.ts +6 -0
  86. package/dist/browser/utils/tracing.d.ts.map +1 -0
  87. package/dist/browser/utils/tracing.js +14 -0
  88. package/dist/browser/utils/tracing.js.map +1 -0
  89. package/dist/browser/utils/utils.common.d.ts +305 -0
  90. package/dist/browser/utils/utils.common.d.ts.map +1 -0
  91. package/dist/browser/utils/utils.common.js +544 -0
  92. package/dist/browser/utils/utils.common.js.map +1 -0
  93. package/dist/commonjs/BufferScheduler.js +70 -44
  94. package/dist/commonjs/BufferScheduler.js.map +1 -1
  95. package/dist/commonjs/BuffersStream.js +14 -0
  96. package/dist/commonjs/BuffersStream.js.map +1 -1
  97. package/dist/commonjs/PooledBuffer.js +13 -5
  98. package/dist/commonjs/PooledBuffer.js.map +1 -1
  99. package/dist/commonjs/StorageBrowserPolicyFactory.d.ts +16 -0
  100. package/dist/commonjs/StorageBrowserPolicyFactory.d.ts.map +1 -0
  101. package/dist/commonjs/StorageBrowserPolicyFactory.js +23 -0
  102. package/dist/commonjs/StorageBrowserPolicyFactory.js.map +1 -0
  103. package/dist/commonjs/StorageRetryPolicyFactory.d.ts +66 -0
  104. package/dist/commonjs/StorageRetryPolicyFactory.d.ts.map +1 -0
  105. package/dist/commonjs/StorageRetryPolicyFactory.js +33 -0
  106. package/dist/commonjs/StorageRetryPolicyFactory.js.map +1 -0
  107. package/dist/commonjs/credentials/AnonymousCredential.d.ts +19 -0
  108. package/dist/commonjs/credentials/AnonymousCredential.d.ts.map +1 -0
  109. package/dist/commonjs/credentials/AnonymousCredential.js +26 -0
  110. package/dist/commonjs/credentials/AnonymousCredential.js.map +1 -0
  111. package/dist/commonjs/credentials/Credential.d.ts +20 -0
  112. package/dist/commonjs/credentials/Credential.d.ts.map +1 -0
  113. package/dist/commonjs/credentials/Credential.js +22 -0
  114. package/dist/commonjs/credentials/Credential.js.map +1 -0
  115. package/dist/commonjs/credentials/StorageSharedKeyCredential.d.ts +38 -0
  116. package/dist/commonjs/credentials/StorageSharedKeyCredential.d.ts.map +1 -0
  117. package/dist/commonjs/credentials/StorageSharedKeyCredential.js +52 -0
  118. package/dist/commonjs/credentials/StorageSharedKeyCredential.js.map +1 -0
  119. package/dist/commonjs/index.d.ts +17 -0
  120. package/dist/commonjs/index.d.ts.map +1 -1
  121. package/dist/commonjs/index.js +19 -1
  122. package/dist/commonjs/index.js.map +1 -1
  123. package/dist/commonjs/log.d.ts +5 -0
  124. package/dist/commonjs/log.d.ts.map +1 -0
  125. package/dist/commonjs/log.js +11 -0
  126. package/dist/commonjs/log.js.map +1 -0
  127. package/dist/commonjs/policies/AnonymousCredentialPolicy.d.ts +15 -0
  128. package/dist/commonjs/policies/AnonymousCredentialPolicy.d.ts.map +1 -0
  129. package/dist/commonjs/policies/AnonymousCredentialPolicy.js +24 -0
  130. package/dist/commonjs/policies/AnonymousCredentialPolicy.js.map +1 -0
  131. package/dist/commonjs/policies/CredentialPolicy.d.ts +22 -0
  132. package/dist/commonjs/policies/CredentialPolicy.d.ts.map +1 -0
  133. package/dist/commonjs/policies/CredentialPolicy.js +33 -0
  134. package/dist/commonjs/policies/CredentialPolicy.js.map +1 -0
  135. package/dist/commonjs/policies/RequestPolicy.d.ts +45 -0
  136. package/dist/commonjs/policies/RequestPolicy.d.ts.map +1 -0
  137. package/dist/commonjs/policies/RequestPolicy.js +46 -0
  138. package/dist/commonjs/policies/RequestPolicy.js.map +1 -0
  139. package/dist/commonjs/policies/StorageBrowserPolicy.d.ts +28 -0
  140. package/dist/commonjs/policies/StorageBrowserPolicy.d.ts.map +1 -0
  141. package/dist/commonjs/policies/StorageBrowserPolicy.js +51 -0
  142. package/dist/commonjs/policies/StorageBrowserPolicy.js.map +1 -0
  143. package/dist/commonjs/policies/StorageBrowserPolicyV2.d.ts +11 -0
  144. package/dist/commonjs/policies/StorageBrowserPolicyV2.d.ts.map +1 -0
  145. package/dist/commonjs/policies/StorageBrowserPolicyV2.js +35 -0
  146. package/dist/commonjs/policies/StorageBrowserPolicyV2.js.map +1 -0
  147. package/dist/commonjs/policies/StorageCorrectContentLengthPolicy.d.ts +10 -0
  148. package/dist/commonjs/policies/StorageCorrectContentLengthPolicy.d.ts.map +1 -0
  149. package/dist/commonjs/policies/StorageCorrectContentLengthPolicy.js +31 -0
  150. package/dist/commonjs/policies/StorageCorrectContentLengthPolicy.js.map +1 -0
  151. package/dist/commonjs/policies/StorageRetryPolicy.d.ts +62 -0
  152. package/dist/commonjs/policies/StorageRetryPolicy.d.ts.map +1 -0
  153. package/dist/commonjs/policies/StorageRetryPolicy.js +225 -0
  154. package/dist/commonjs/policies/StorageRetryPolicy.js.map +1 -0
  155. package/dist/commonjs/policies/StorageRetryPolicyType.d.ts +14 -0
  156. package/dist/commonjs/policies/StorageRetryPolicyType.d.ts.map +1 -0
  157. package/dist/commonjs/policies/StorageRetryPolicyType.js +20 -0
  158. package/dist/commonjs/policies/StorageRetryPolicyType.js.map +1 -0
  159. package/dist/commonjs/policies/StorageRetryPolicyV2.d.ts +11 -0
  160. package/dist/commonjs/policies/StorageRetryPolicyV2.d.ts.map +1 -0
  161. package/dist/commonjs/policies/StorageRetryPolicyV2.js +169 -0
  162. package/dist/commonjs/policies/StorageRetryPolicyV2.js.map +1 -0
  163. package/dist/commonjs/policies/StorageSharedKeyCredentialPolicy.d.ts +54 -0
  164. package/dist/commonjs/policies/StorageSharedKeyCredentialPolicy.d.ts.map +1 -0
  165. package/dist/commonjs/policies/StorageSharedKeyCredentialPolicy.js +149 -0
  166. package/dist/commonjs/policies/StorageSharedKeyCredentialPolicy.js.map +1 -0
  167. package/dist/commonjs/policies/StorageSharedKeyCredentialPolicyV2.d.ts +17 -0
  168. package/dist/commonjs/policies/StorageSharedKeyCredentialPolicyV2.d.ts.map +1 -0
  169. package/dist/commonjs/policies/StorageSharedKeyCredentialPolicyV2.js +136 -0
  170. package/dist/commonjs/policies/StorageSharedKeyCredentialPolicyV2.js.map +1 -0
  171. package/dist/commonjs/tsdoc-metadata.json +11 -11
  172. package/dist/commonjs/utils/SharedKeyComparator.d.ts +2 -0
  173. package/dist/commonjs/utils/SharedKeyComparator.d.ts.map +1 -0
  174. package/dist/commonjs/utils/SharedKeyComparator.js +76 -0
  175. package/dist/commonjs/utils/SharedKeyComparator.js.map +1 -0
  176. package/dist/commonjs/utils/constants.d.ts +39 -0
  177. package/dist/commonjs/utils/constants.d.ts.map +1 -0
  178. package/dist/commonjs/utils/constants.js +67 -0
  179. package/dist/commonjs/utils/constants.js.map +1 -0
  180. package/dist/commonjs/utils/tracing.d.ts +6 -0
  181. package/dist/commonjs/utils/tracing.d.ts.map +1 -0
  182. package/dist/commonjs/utils/tracing.js +17 -0
  183. package/dist/commonjs/utils/tracing.js.map +1 -0
  184. package/dist/commonjs/utils/utils.common.d.ts +305 -0
  185. package/dist/commonjs/utils/utils.common.d.ts.map +1 -0
  186. package/dist/commonjs/utils/utils.common.js +573 -0
  187. package/dist/commonjs/utils/utils.common.js.map +1 -0
  188. package/dist/esm/BufferScheduler.js +70 -44
  189. package/dist/esm/BufferScheduler.js.map +1 -1
  190. package/dist/esm/BuffersStream.js +14 -0
  191. package/dist/esm/BuffersStream.js.map +1 -1
  192. package/dist/esm/PooledBuffer.js +13 -5
  193. package/dist/esm/PooledBuffer.js.map +1 -1
  194. package/dist/esm/StorageBrowserPolicyFactory.d.ts +16 -0
  195. package/dist/esm/StorageBrowserPolicyFactory.d.ts.map +1 -0
  196. package/dist/esm/StorageBrowserPolicyFactory.js +19 -0
  197. package/dist/esm/StorageBrowserPolicyFactory.js.map +1 -0
  198. package/dist/esm/StorageRetryPolicyFactory.d.ts +66 -0
  199. package/dist/esm/StorageRetryPolicyFactory.d.ts.map +1 -0
  200. package/dist/esm/StorageRetryPolicyFactory.js +28 -0
  201. package/dist/esm/StorageRetryPolicyFactory.js.map +1 -0
  202. package/dist/esm/credentials/AnonymousCredential.d.ts +19 -0
  203. package/dist/esm/credentials/AnonymousCredential.d.ts.map +1 -0
  204. package/dist/esm/credentials/AnonymousCredential.js +22 -0
  205. package/dist/esm/credentials/AnonymousCredential.js.map +1 -0
  206. package/dist/esm/credentials/Credential.d.ts +20 -0
  207. package/dist/esm/credentials/Credential.d.ts.map +1 -0
  208. package/dist/esm/credentials/Credential.js +18 -0
  209. package/dist/esm/credentials/Credential.js.map +1 -0
  210. package/dist/esm/credentials/StorageSharedKeyCredential.d.ts +38 -0
  211. package/dist/esm/credentials/StorageSharedKeyCredential.d.ts.map +1 -0
  212. package/dist/esm/credentials/StorageSharedKeyCredential.js +48 -0
  213. package/dist/esm/credentials/StorageSharedKeyCredential.js.map +1 -0
  214. package/dist/esm/index.d.ts +17 -0
  215. package/dist/esm/index.d.ts.map +1 -1
  216. package/dist/esm/index.js +17 -0
  217. package/dist/esm/index.js.map +1 -1
  218. package/dist/esm/log.d.ts +5 -0
  219. package/dist/esm/log.d.ts.map +1 -0
  220. package/dist/esm/log.js +8 -0
  221. package/dist/esm/log.js.map +1 -0
  222. package/dist/esm/policies/AnonymousCredentialPolicy.d.ts +15 -0
  223. package/dist/esm/policies/AnonymousCredentialPolicy.d.ts.map +1 -0
  224. package/dist/esm/policies/AnonymousCredentialPolicy.js +20 -0
  225. package/dist/esm/policies/AnonymousCredentialPolicy.js.map +1 -0
  226. package/dist/esm/policies/CredentialPolicy.d.ts +22 -0
  227. package/dist/esm/policies/CredentialPolicy.d.ts.map +1 -0
  228. package/dist/esm/policies/CredentialPolicy.js +29 -0
  229. package/dist/esm/policies/CredentialPolicy.js.map +1 -0
  230. package/dist/esm/policies/RequestPolicy.d.ts +45 -0
  231. package/dist/esm/policies/RequestPolicy.d.ts.map +1 -0
  232. package/dist/esm/policies/RequestPolicy.js +42 -0
  233. package/dist/esm/policies/RequestPolicy.js.map +1 -0
  234. package/dist/esm/policies/StorageBrowserPolicy.d.ts +28 -0
  235. package/dist/esm/policies/StorageBrowserPolicy.d.ts.map +1 -0
  236. package/dist/esm/policies/StorageBrowserPolicy.js +47 -0
  237. package/dist/esm/policies/StorageBrowserPolicy.js.map +1 -0
  238. package/dist/esm/policies/StorageBrowserPolicyV2.d.ts +11 -0
  239. package/dist/esm/policies/StorageBrowserPolicyV2.d.ts.map +1 -0
  240. package/dist/esm/policies/StorageBrowserPolicyV2.js +31 -0
  241. package/dist/esm/policies/StorageBrowserPolicyV2.js.map +1 -0
  242. package/dist/esm/policies/StorageCorrectContentLengthPolicy.d.ts +10 -0
  243. package/dist/esm/policies/StorageCorrectContentLengthPolicy.d.ts.map +1 -0
  244. package/dist/esm/policies/StorageCorrectContentLengthPolicy.js +27 -0
  245. package/dist/esm/policies/StorageCorrectContentLengthPolicy.js.map +1 -0
  246. package/dist/esm/policies/StorageRetryPolicy.d.ts +62 -0
  247. package/dist/esm/policies/StorageRetryPolicy.d.ts.map +1 -0
  248. package/dist/esm/policies/StorageRetryPolicy.js +220 -0
  249. package/dist/esm/policies/StorageRetryPolicy.js.map +1 -0
  250. package/dist/esm/policies/StorageRetryPolicyType.d.ts +14 -0
  251. package/dist/esm/policies/StorageRetryPolicyType.d.ts.map +1 -0
  252. package/dist/esm/policies/StorageRetryPolicyType.js +17 -0
  253. package/dist/esm/policies/StorageRetryPolicyType.js.map +1 -0
  254. package/dist/esm/policies/StorageRetryPolicyV2.d.ts +11 -0
  255. package/dist/esm/policies/StorageRetryPolicyV2.d.ts.map +1 -0
  256. package/dist/esm/policies/StorageRetryPolicyV2.js +165 -0
  257. package/dist/esm/policies/StorageRetryPolicyV2.js.map +1 -0
  258. package/dist/esm/policies/StorageSharedKeyCredentialPolicy.d.ts +54 -0
  259. package/dist/esm/policies/StorageSharedKeyCredentialPolicy.d.ts.map +1 -0
  260. package/dist/esm/policies/StorageSharedKeyCredentialPolicy.js +145 -0
  261. package/dist/esm/policies/StorageSharedKeyCredentialPolicy.js.map +1 -0
  262. package/dist/esm/policies/StorageSharedKeyCredentialPolicyV2.d.ts +17 -0
  263. package/dist/esm/policies/StorageSharedKeyCredentialPolicyV2.d.ts.map +1 -0
  264. package/dist/esm/policies/StorageSharedKeyCredentialPolicyV2.js +132 -0
  265. package/dist/esm/policies/StorageSharedKeyCredentialPolicyV2.js.map +1 -0
  266. package/dist/esm/utils/SharedKeyComparator.d.ts +2 -0
  267. package/dist/esm/utils/SharedKeyComparator.d.ts.map +1 -0
  268. package/dist/esm/utils/SharedKeyComparator.js +73 -0
  269. package/dist/esm/utils/SharedKeyComparator.js.map +1 -0
  270. package/dist/esm/utils/constants.d.ts +39 -0
  271. package/dist/esm/utils/constants.d.ts.map +1 -0
  272. package/dist/esm/utils/constants.js +64 -0
  273. package/dist/esm/utils/constants.js.map +1 -0
  274. package/dist/esm/utils/tracing.d.ts +6 -0
  275. package/dist/esm/utils/tracing.d.ts.map +1 -0
  276. package/dist/esm/utils/tracing.js +14 -0
  277. package/dist/esm/utils/tracing.js.map +1 -0
  278. package/dist/esm/utils/utils.common.d.ts +305 -0
  279. package/dist/esm/utils/utils.common.d.ts.map +1 -0
  280. package/dist/esm/utils/utils.common.js +544 -0
  281. package/dist/esm/utils/utils.common.js.map +1 -0
  282. package/dist/react-native/BufferScheduler.js +70 -44
  283. package/dist/react-native/BufferScheduler.js.map +1 -1
  284. package/dist/react-native/BuffersStream.js +14 -0
  285. package/dist/react-native/BuffersStream.js.map +1 -1
  286. package/dist/react-native/PooledBuffer.js +13 -5
  287. package/dist/react-native/PooledBuffer.js.map +1 -1
  288. package/dist/react-native/StorageBrowserPolicyFactory.d.ts +16 -0
  289. package/dist/react-native/StorageBrowserPolicyFactory.d.ts.map +1 -0
  290. package/dist/react-native/StorageBrowserPolicyFactory.js +19 -0
  291. package/dist/react-native/StorageBrowserPolicyFactory.js.map +1 -0
  292. package/dist/react-native/StorageRetryPolicyFactory.d.ts +66 -0
  293. package/dist/react-native/StorageRetryPolicyFactory.d.ts.map +1 -0
  294. package/dist/react-native/StorageRetryPolicyFactory.js +28 -0
  295. package/dist/react-native/StorageRetryPolicyFactory.js.map +1 -0
  296. package/dist/react-native/credentials/AnonymousCredential.d.ts +19 -0
  297. package/dist/react-native/credentials/AnonymousCredential.d.ts.map +1 -0
  298. package/dist/react-native/credentials/AnonymousCredential.js +22 -0
  299. package/dist/react-native/credentials/AnonymousCredential.js.map +1 -0
  300. package/dist/react-native/credentials/Credential.d.ts +20 -0
  301. package/dist/react-native/credentials/Credential.d.ts.map +1 -0
  302. package/dist/react-native/credentials/Credential.js +18 -0
  303. package/dist/react-native/credentials/Credential.js.map +1 -0
  304. package/dist/react-native/credentials/StorageSharedKeyCredential.d.ts +38 -0
  305. package/dist/react-native/credentials/StorageSharedKeyCredential.d.ts.map +1 -0
  306. package/dist/react-native/credentials/StorageSharedKeyCredential.js +48 -0
  307. package/dist/react-native/credentials/StorageSharedKeyCredential.js.map +1 -0
  308. package/dist/react-native/index.d.ts +17 -0
  309. package/dist/react-native/index.d.ts.map +1 -1
  310. package/dist/react-native/index.js +17 -0
  311. package/dist/react-native/index.js.map +1 -1
  312. package/dist/react-native/log.d.ts +5 -0
  313. package/dist/react-native/log.d.ts.map +1 -0
  314. package/dist/react-native/log.js +8 -0
  315. package/dist/react-native/log.js.map +1 -0
  316. package/dist/react-native/policies/AnonymousCredentialPolicy.d.ts +15 -0
  317. package/dist/react-native/policies/AnonymousCredentialPolicy.d.ts.map +1 -0
  318. package/dist/react-native/policies/AnonymousCredentialPolicy.js +20 -0
  319. package/dist/react-native/policies/AnonymousCredentialPolicy.js.map +1 -0
  320. package/dist/react-native/policies/CredentialPolicy.d.ts +22 -0
  321. package/dist/react-native/policies/CredentialPolicy.d.ts.map +1 -0
  322. package/dist/react-native/policies/CredentialPolicy.js +29 -0
  323. package/dist/react-native/policies/CredentialPolicy.js.map +1 -0
  324. package/dist/react-native/policies/RequestPolicy.d.ts +45 -0
  325. package/dist/react-native/policies/RequestPolicy.d.ts.map +1 -0
  326. package/dist/react-native/policies/RequestPolicy.js +42 -0
  327. package/dist/react-native/policies/RequestPolicy.js.map +1 -0
  328. package/dist/react-native/policies/StorageBrowserPolicy.d.ts +28 -0
  329. package/dist/react-native/policies/StorageBrowserPolicy.d.ts.map +1 -0
  330. package/dist/react-native/policies/StorageBrowserPolicy.js +47 -0
  331. package/dist/react-native/policies/StorageBrowserPolicy.js.map +1 -0
  332. package/dist/react-native/policies/StorageBrowserPolicyV2.d.ts +11 -0
  333. package/dist/react-native/policies/StorageBrowserPolicyV2.d.ts.map +1 -0
  334. package/dist/react-native/policies/StorageBrowserPolicyV2.js +31 -0
  335. package/dist/react-native/policies/StorageBrowserPolicyV2.js.map +1 -0
  336. package/dist/react-native/policies/StorageCorrectContentLengthPolicy.d.ts +10 -0
  337. package/dist/react-native/policies/StorageCorrectContentLengthPolicy.d.ts.map +1 -0
  338. package/dist/react-native/policies/StorageCorrectContentLengthPolicy.js +27 -0
  339. package/dist/react-native/policies/StorageCorrectContentLengthPolicy.js.map +1 -0
  340. package/dist/react-native/policies/StorageRetryPolicy.d.ts +62 -0
  341. package/dist/react-native/policies/StorageRetryPolicy.d.ts.map +1 -0
  342. package/dist/react-native/policies/StorageRetryPolicy.js +220 -0
  343. package/dist/react-native/policies/StorageRetryPolicy.js.map +1 -0
  344. package/dist/react-native/policies/StorageRetryPolicyType.d.ts +14 -0
  345. package/dist/react-native/policies/StorageRetryPolicyType.d.ts.map +1 -0
  346. package/dist/react-native/policies/StorageRetryPolicyType.js +17 -0
  347. package/dist/react-native/policies/StorageRetryPolicyType.js.map +1 -0
  348. package/dist/react-native/policies/StorageRetryPolicyV2.d.ts +11 -0
  349. package/dist/react-native/policies/StorageRetryPolicyV2.d.ts.map +1 -0
  350. package/dist/react-native/policies/StorageRetryPolicyV2.js +165 -0
  351. package/dist/react-native/policies/StorageRetryPolicyV2.js.map +1 -0
  352. package/dist/react-native/policies/StorageSharedKeyCredentialPolicy.d.ts +54 -0
  353. package/dist/react-native/policies/StorageSharedKeyCredentialPolicy.d.ts.map +1 -0
  354. package/dist/react-native/policies/StorageSharedKeyCredentialPolicy.js +145 -0
  355. package/dist/react-native/policies/StorageSharedKeyCredentialPolicy.js.map +1 -0
  356. package/dist/react-native/policies/StorageSharedKeyCredentialPolicyV2.d.ts +17 -0
  357. package/dist/react-native/policies/StorageSharedKeyCredentialPolicyV2.d.ts.map +1 -0
  358. package/dist/react-native/policies/StorageSharedKeyCredentialPolicyV2.js +132 -0
  359. package/dist/react-native/policies/StorageSharedKeyCredentialPolicyV2.js.map +1 -0
  360. package/dist/react-native/utils/SharedKeyComparator.d.ts +2 -0
  361. package/dist/react-native/utils/SharedKeyComparator.d.ts.map +1 -0
  362. package/dist/react-native/utils/SharedKeyComparator.js +73 -0
  363. package/dist/react-native/utils/SharedKeyComparator.js.map +1 -0
  364. package/dist/react-native/utils/constants.d.ts +39 -0
  365. package/dist/react-native/utils/constants.d.ts.map +1 -0
  366. package/dist/react-native/utils/constants.js +64 -0
  367. package/dist/react-native/utils/constants.js.map +1 -0
  368. package/dist/react-native/utils/tracing.d.ts +6 -0
  369. package/dist/react-native/utils/tracing.d.ts.map +1 -0
  370. package/dist/react-native/utils/tracing.js +14 -0
  371. package/dist/react-native/utils/tracing.js.map +1 -0
  372. package/dist/react-native/utils/utils.common.d.ts +305 -0
  373. package/dist/react-native/utils/utils.common.d.ts.map +1 -0
  374. package/dist/react-native/utils/utils.common.js +544 -0
  375. package/dist/react-native/utils/utils.common.js.map +1 -0
  376. package/package.json +15 -9
  377. package/dist/browser/index.d.ts.map +0 -1
  378. package/dist/browser/index.js.map +0 -1
@@ -0,0 +1,45 @@
1
+ import type { HttpPipelineLogLevel, RequestPolicy, RequestPolicyOptionsLike, WebResourceLike, CompatResponse as HttpOperationResponse } from "@azure/core-http-compat";
2
+ /**
3
+ * The base class from which all request policies derive.
4
+ */
5
+ export declare abstract class BaseRequestPolicy implements RequestPolicy {
6
+ /**
7
+ * The next policy in the pipeline. Each policy is responsible for executing the next one if the request is to continue through the pipeline.
8
+ */
9
+ readonly _nextPolicy: RequestPolicy;
10
+ /**
11
+ * The options that can be passed to a given request policy.
12
+ */
13
+ readonly _options: RequestPolicyOptionsLike;
14
+ /**
15
+ * The main method to implement that manipulates a request/response.
16
+ */
17
+ protected constructor(
18
+ /**
19
+ * The next policy in the pipeline. Each policy is responsible for executing the next one if the request is to continue through the pipeline.
20
+ */
21
+ _nextPolicy: RequestPolicy,
22
+ /**
23
+ * The options that can be passed to a given request policy.
24
+ */
25
+ _options: RequestPolicyOptionsLike);
26
+ /**
27
+ * Sends a network request based on the given web resource.
28
+ * @param webResource - A {@link WebResourceLike} that describes a HTTP request to be made.
29
+ */
30
+ abstract sendRequest(webResource: WebResourceLike): Promise<HttpOperationResponse>;
31
+ /**
32
+ * Get whether or not a log with the provided log level should be logged.
33
+ * @param logLevel - The log level of the log that will be logged.
34
+ * @returns Whether or not a log with the provided log level should be logged.
35
+ */
36
+ shouldLog(logLevel: HttpPipelineLogLevel): boolean;
37
+ /**
38
+ * Attempt to log the provided message to the provided logger. If no logger was provided or if
39
+ * the log level does not meat the logger's threshold, then nothing will be logged.
40
+ * @param logLevel - The log level of this log.
41
+ * @param message - The message of this log.
42
+ */
43
+ log(logLevel: HttpPipelineLogLevel, message: string): void;
44
+ }
45
+ //# sourceMappingURL=RequestPolicy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RequestPolicy.d.ts","sourceRoot":"","sources":["../../../src/policies/RequestPolicy.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,oBAAoB,EACpB,aAAa,EACb,wBAAwB,EACxB,eAAe,EACf,cAAc,IAAI,qBAAqB,EACxC,MAAM,yBAAyB,CAAC;AAEjC;;GAEG;AACH,8BAAsB,iBAAkB,YAAW,aAAa;IAK5D;;OAEG;IACH,QAAQ,CAAC,WAAW,EAAE,aAAa;IACnC;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,wBAAwB;IAX7C;;OAEG;IACH,SAAS;IACP;;OAEG;IACM,WAAW,EAAE,aAAa;IACnC;;OAEG;IACM,QAAQ,EAAE,wBAAwB;IAG7C;;;OAGG;aACa,WAAW,CAAC,WAAW,EAAE,eAAe,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAEzF;;;;OAIG;IACI,SAAS,CAAC,QAAQ,EAAE,oBAAoB,GAAG,OAAO;IAIzD;;;;;OAKG;IACI,GAAG,CAAC,QAAQ,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;CAGlE"}
@@ -0,0 +1,42 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ /**
4
+ * The base class from which all request policies derive.
5
+ */
6
+ export class BaseRequestPolicy {
7
+ _nextPolicy;
8
+ _options;
9
+ /**
10
+ * The main method to implement that manipulates a request/response.
11
+ */
12
+ constructor(
13
+ /**
14
+ * The next policy in the pipeline. Each policy is responsible for executing the next one if the request is to continue through the pipeline.
15
+ */
16
+ _nextPolicy,
17
+ /**
18
+ * The options that can be passed to a given request policy.
19
+ */
20
+ _options) {
21
+ this._nextPolicy = _nextPolicy;
22
+ this._options = _options;
23
+ }
24
+ /**
25
+ * Get whether or not a log with the provided log level should be logged.
26
+ * @param logLevel - The log level of the log that will be logged.
27
+ * @returns Whether or not a log with the provided log level should be logged.
28
+ */
29
+ shouldLog(logLevel) {
30
+ return this._options.shouldLog(logLevel);
31
+ }
32
+ /**
33
+ * Attempt to log the provided message to the provided logger. If no logger was provided or if
34
+ * the log level does not meat the logger's threshold, then nothing will be logged.
35
+ * @param logLevel - The log level of this log.
36
+ * @param message - The message of this log.
37
+ */
38
+ log(logLevel, message) {
39
+ this._options.log(logLevel, message);
40
+ }
41
+ }
42
+ //# sourceMappingURL=RequestPolicy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RequestPolicy.js","sourceRoot":"","sources":["../../../src/policies/RequestPolicy.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAUlC;;GAEG;AACH,MAAM,OAAgB,iBAAiB;IAQ1B;IAIA;IAXX;;OAEG;IACH;IACE;;OAEG;IACM,WAA0B;IACnC;;OAEG;IACM,QAAkC;QAJlC,gBAAW,GAAX,WAAW,CAAe;QAI1B,aAAQ,GAAR,QAAQ,CAA0B;IAC1C,CAAC;IAQJ;;;;OAIG;IACI,SAAS,CAAC,QAA8B;QAC7C,OAAO,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IAC3C,CAAC;IAED;;;;;OAKG;IACI,GAAG,CAAC,QAA8B,EAAE,OAAe;QACxD,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACvC,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n HttpPipelineLogLevel,\n RequestPolicy,\n RequestPolicyOptionsLike,\n WebResourceLike,\n CompatResponse as HttpOperationResponse,\n} from \"@azure/core-http-compat\";\n\n/**\n * The base class from which all request policies derive.\n */\nexport abstract class BaseRequestPolicy implements RequestPolicy {\n /**\n * The main method to implement that manipulates a request/response.\n */\n protected constructor(\n /**\n * The next policy in the pipeline. Each policy is responsible for executing the next one if the request is to continue through the pipeline.\n */\n readonly _nextPolicy: RequestPolicy,\n /**\n * The options that can be passed to a given request policy.\n */\n readonly _options: RequestPolicyOptionsLike,\n ) {}\n\n /**\n * Sends a network request based on the given web resource.\n * @param webResource - A {@link WebResourceLike} that describes a HTTP request to be made.\n */\n public abstract sendRequest(webResource: WebResourceLike): Promise<HttpOperationResponse>;\n\n /**\n * Get whether or not a log with the provided log level should be logged.\n * @param logLevel - The log level of the log that will be logged.\n * @returns Whether or not a log with the provided log level should be logged.\n */\n public shouldLog(logLevel: HttpPipelineLogLevel): boolean {\n return this._options.shouldLog(logLevel);\n }\n\n /**\n * Attempt to log the provided message to the provided logger. If no logger was provided or if\n * the log level does not meat the logger's threshold, then nothing will be logged.\n * @param logLevel - The log level of this log.\n * @param message - The message of this log.\n */\n public log(logLevel: HttpPipelineLogLevel, message: string): void {\n this._options.log(logLevel, message);\n }\n}\n"]}
@@ -0,0 +1,28 @@
1
+ import type { RequestPolicy, RequestPolicyOptionsLike as RequestPolicyOptions, WebResourceLike as WebResource, CompatResponse as HttpOperationResponse } from "@azure/core-http-compat";
2
+ import { BaseRequestPolicy } from "./RequestPolicy.js";
3
+ /**
4
+ * StorageBrowserPolicy will handle differences between Node.js and browser runtime, including:
5
+ *
6
+ * 1. Browsers cache GET/HEAD requests by adding conditional headers such as 'IF_MODIFIED_SINCE'.
7
+ * StorageBrowserPolicy is a policy used to add a timestamp query to GET/HEAD request URL
8
+ * thus avoid the browser cache.
9
+ *
10
+ * 2. Remove cookie header for security
11
+ *
12
+ * 3. Remove content-length header to avoid browsers warning
13
+ */
14
+ export declare class StorageBrowserPolicy extends BaseRequestPolicy {
15
+ /**
16
+ * Creates an instance of StorageBrowserPolicy.
17
+ * @param nextPolicy -
18
+ * @param options -
19
+ */
20
+ constructor(nextPolicy: RequestPolicy, options: RequestPolicyOptions);
21
+ /**
22
+ * Sends out request.
23
+ *
24
+ * @param request -
25
+ */
26
+ sendRequest(request: WebResource): Promise<HttpOperationResponse>;
27
+ }
28
+ //# sourceMappingURL=StorageBrowserPolicy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StorageBrowserPolicy.d.ts","sourceRoot":"","sources":["../../../src/policies/StorageBrowserPolicy.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,aAAa,EACb,wBAAwB,IAAI,oBAAoB,EAChD,eAAe,IAAI,WAAW,EAC9B,cAAc,IAAI,qBAAqB,EACxC,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAKvD;;;;;;;;;;GAUG;AACH,qBAAa,oBAAqB,SAAQ,iBAAiB;IACzD;;;;OAIG;gBAGS,UAAU,EAAE,aAAa,EAAE,OAAO,EAAE,oBAAoB;IAIpE;;;;OAIG;IACU,WAAW,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,qBAAqB,CAAC;CAoB/E"}
@@ -0,0 +1,47 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ import { BaseRequestPolicy } from "./RequestPolicy.js";
4
+ import { isNodeLike } from "@azure/core-util";
5
+ import { HeaderConstants, URLConstants } from "../utils/constants.js";
6
+ import { setURLParameter } from "../utils/utils.common.js";
7
+ /**
8
+ * StorageBrowserPolicy will handle differences between Node.js and browser runtime, including:
9
+ *
10
+ * 1. Browsers cache GET/HEAD requests by adding conditional headers such as 'IF_MODIFIED_SINCE'.
11
+ * StorageBrowserPolicy is a policy used to add a timestamp query to GET/HEAD request URL
12
+ * thus avoid the browser cache.
13
+ *
14
+ * 2. Remove cookie header for security
15
+ *
16
+ * 3. Remove content-length header to avoid browsers warning
17
+ */
18
+ export class StorageBrowserPolicy extends BaseRequestPolicy {
19
+ /**
20
+ * Creates an instance of StorageBrowserPolicy.
21
+ * @param nextPolicy -
22
+ * @param options -
23
+ */
24
+ // The base class has a protected constructor. Adding a public one to enable constructing of this class.
25
+ /* eslint-disable-next-line @typescript-eslint/no-useless-constructor*/
26
+ constructor(nextPolicy, options) {
27
+ super(nextPolicy, options);
28
+ }
29
+ /**
30
+ * Sends out request.
31
+ *
32
+ * @param request -
33
+ */
34
+ async sendRequest(request) {
35
+ if (isNodeLike) {
36
+ return this._nextPolicy.sendRequest(request);
37
+ }
38
+ if (request.method.toUpperCase() === "GET" || request.method.toUpperCase() === "HEAD") {
39
+ request.url = setURLParameter(request.url, URLConstants.Parameters.FORCE_BROWSER_NO_CACHE, new Date().getTime().toString());
40
+ }
41
+ request.headers.remove(HeaderConstants.COOKIE);
42
+ // According to XHR standards, content-length should be fully controlled by browsers
43
+ request.headers.remove(HeaderConstants.CONTENT_LENGTH);
44
+ return this._nextPolicy.sendRequest(request);
45
+ }
46
+ }
47
+ //# sourceMappingURL=StorageBrowserPolicy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StorageBrowserPolicy.js","sourceRoot":"","sources":["../../../src/policies/StorageBrowserPolicy.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAQlC,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3D;;;;;;;;;;GAUG;AACH,MAAM,OAAO,oBAAqB,SAAQ,iBAAiB;IACzD;;;;OAIG;IACH,wGAAwG;IACxG,uEAAuE;IACvE,YAAY,UAAyB,EAAE,OAA6B;QAClE,KAAK,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IAC7B,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,WAAW,CAAC,OAAoB;QAC3C,IAAI,UAAU,EAAE,CAAC;YACf,OAAO,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QAC/C,CAAC;QAED,IAAI,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,MAAM,EAAE,CAAC;YACtF,OAAO,CAAC,GAAG,GAAG,eAAe,CAC3B,OAAO,CAAC,GAAG,EACX,YAAY,CAAC,UAAU,CAAC,sBAAsB,EAC9C,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAChC,CAAC;QACJ,CAAC;QAED,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;QAE/C,oFAAoF;QACpF,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,eAAe,CAAC,cAAc,CAAC,CAAC;QAEvD,OAAO,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAC/C,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n RequestPolicy,\n RequestPolicyOptionsLike as RequestPolicyOptions,\n WebResourceLike as WebResource,\n CompatResponse as HttpOperationResponse,\n} from \"@azure/core-http-compat\";\nimport { BaseRequestPolicy } from \"./RequestPolicy.js\";\nimport { isNodeLike } from \"@azure/core-util\";\nimport { HeaderConstants, URLConstants } from \"../utils/constants.js\";\nimport { setURLParameter } from \"../utils/utils.common.js\";\n\n/**\n * StorageBrowserPolicy will handle differences between Node.js and browser runtime, including:\n *\n * 1. Browsers cache GET/HEAD requests by adding conditional headers such as 'IF_MODIFIED_SINCE'.\n * StorageBrowserPolicy is a policy used to add a timestamp query to GET/HEAD request URL\n * thus avoid the browser cache.\n *\n * 2. Remove cookie header for security\n *\n * 3. Remove content-length header to avoid browsers warning\n */\nexport class StorageBrowserPolicy extends BaseRequestPolicy {\n /**\n * Creates an instance of StorageBrowserPolicy.\n * @param nextPolicy -\n * @param options -\n */\n // The base class has a protected constructor. Adding a public one to enable constructing of this class.\n /* eslint-disable-next-line @typescript-eslint/no-useless-constructor*/\n constructor(nextPolicy: RequestPolicy, options: RequestPolicyOptions) {\n super(nextPolicy, options);\n }\n\n /**\n * Sends out request.\n *\n * @param request -\n */\n public async sendRequest(request: WebResource): Promise<HttpOperationResponse> {\n if (isNodeLike) {\n return this._nextPolicy.sendRequest(request);\n }\n\n if (request.method.toUpperCase() === \"GET\" || request.method.toUpperCase() === \"HEAD\") {\n request.url = setURLParameter(\n request.url,\n URLConstants.Parameters.FORCE_BROWSER_NO_CACHE,\n new Date().getTime().toString(),\n );\n }\n\n request.headers.remove(HeaderConstants.COOKIE);\n\n // According to XHR standards, content-length should be fully controlled by browsers\n request.headers.remove(HeaderConstants.CONTENT_LENGTH);\n\n return this._nextPolicy.sendRequest(request);\n }\n}\n"]}
@@ -0,0 +1,11 @@
1
+ import type { PipelinePolicy } from "@azure/core-rest-pipeline";
2
+ /**
3
+ * The programmatic identifier of the StorageBrowserPolicy.
4
+ */
5
+ export declare const storageBrowserPolicyName = "storageBrowserPolicy";
6
+ /**
7
+ * storageBrowserPolicy is a policy used to prevent browsers from caching requests
8
+ * and to remove cookies and explicit content-length headers.
9
+ */
10
+ export declare function storageBrowserPolicy(): PipelinePolicy;
11
+ //# sourceMappingURL=StorageBrowserPolicyV2.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StorageBrowserPolicyV2.d.ts","sourceRoot":"","sources":["../../../src/policies/StorageBrowserPolicyV2.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAIV,cAAc,EACf,MAAM,2BAA2B,CAAC;AAKnC;;GAEG;AACH,eAAO,MAAM,wBAAwB,yBAAyB,CAAC;AAE/D;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,cAAc,CAuBrD"}
@@ -0,0 +1,31 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ import { isNodeLike } from "@azure/core-util";
4
+ import { HeaderConstants, URLConstants } from "../utils/constants.js";
5
+ import { setURLParameter } from "../utils/utils.common.js";
6
+ /**
7
+ * The programmatic identifier of the StorageBrowserPolicy.
8
+ */
9
+ export const storageBrowserPolicyName = "storageBrowserPolicy";
10
+ /**
11
+ * storageBrowserPolicy is a policy used to prevent browsers from caching requests
12
+ * and to remove cookies and explicit content-length headers.
13
+ */
14
+ export function storageBrowserPolicy() {
15
+ return {
16
+ name: storageBrowserPolicyName,
17
+ async sendRequest(request, next) {
18
+ if (isNodeLike) {
19
+ return next(request);
20
+ }
21
+ if (request.method === "GET" || request.method === "HEAD") {
22
+ request.url = setURLParameter(request.url, URLConstants.Parameters.FORCE_BROWSER_NO_CACHE, new Date().getTime().toString());
23
+ }
24
+ request.headers.delete(HeaderConstants.COOKIE);
25
+ // According to XHR standards, content-length should be fully controlled by browsers
26
+ request.headers.delete(HeaderConstants.CONTENT_LENGTH);
27
+ return next(request);
28
+ },
29
+ };
30
+ }
31
+ //# sourceMappingURL=StorageBrowserPolicyV2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StorageBrowserPolicyV2.js","sourceRoot":"","sources":["../../../src/policies/StorageBrowserPolicyV2.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAQlC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3D;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,sBAAsB,CAAC;AAE/D;;;GAGG;AACH,MAAM,UAAU,oBAAoB;IAClC,OAAO;QACL,IAAI,EAAE,wBAAwB;QAC9B,KAAK,CAAC,WAAW,CAAC,OAAwB,EAAE,IAAiB;YAC3D,IAAI,UAAU,EAAE,CAAC;gBACf,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;YACvB,CAAC;YAED,IAAI,OAAO,CAAC,MAAM,KAAK,KAAK,IAAI,OAAO,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;gBAC1D,OAAO,CAAC,GAAG,GAAG,eAAe,CAC3B,OAAO,CAAC,GAAG,EACX,YAAY,CAAC,UAAU,CAAC,sBAAsB,EAC9C,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAChC,CAAC;YACJ,CAAC;YAED,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;YAE/C,oFAAoF;YACpF,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,eAAe,CAAC,cAAc,CAAC,CAAC;YACvD,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;QACvB,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n PipelineRequest,\n PipelineResponse,\n SendRequest,\n PipelinePolicy,\n} from \"@azure/core-rest-pipeline\";\nimport { isNodeLike } from \"@azure/core-util\";\nimport { HeaderConstants, URLConstants } from \"../utils/constants.js\";\nimport { setURLParameter } from \"../utils/utils.common.js\";\n\n/**\n * The programmatic identifier of the StorageBrowserPolicy.\n */\nexport const storageBrowserPolicyName = \"storageBrowserPolicy\";\n\n/**\n * storageBrowserPolicy is a policy used to prevent browsers from caching requests\n * and to remove cookies and explicit content-length headers.\n */\nexport function storageBrowserPolicy(): PipelinePolicy {\n return {\n name: storageBrowserPolicyName,\n async sendRequest(request: PipelineRequest, next: SendRequest): Promise<PipelineResponse> {\n if (isNodeLike) {\n return next(request);\n }\n\n if (request.method === \"GET\" || request.method === \"HEAD\") {\n request.url = setURLParameter(\n request.url,\n URLConstants.Parameters.FORCE_BROWSER_NO_CACHE,\n new Date().getTime().toString(),\n );\n }\n\n request.headers.delete(HeaderConstants.COOKIE);\n\n // According to XHR standards, content-length should be fully controlled by browsers\n request.headers.delete(HeaderConstants.CONTENT_LENGTH);\n return next(request);\n },\n };\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StorageCorrectContentLengthPolicy-browser.d.mts","sourceRoot":"","sources":["../../../src/policies/StorageCorrectContentLengthPolicy-browser.mts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAIV,cAAc,EACf,MAAM,2BAA2B,CAAC;AAEnC;;GAEG;AACH,eAAO,MAAM,qCAAqC,sCAAsC,CAAC;AAEzF;;GAEG;AACH,wBAAgB,iCAAiC,IAAI,cAAc,CAOlE"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StorageCorrectContentLengthPolicy-browser.mjs","sourceRoot":"","sources":["../../../src/policies/StorageCorrectContentLengthPolicy-browser.mts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AASlC;;GAEG;AACH,MAAM,CAAC,MAAM,qCAAqC,GAAG,mCAAmC,CAAC;AAEzF;;GAEG;AACH,MAAM,UAAU,iCAAiC;IAC/C,OAAO;QACL,IAAI,EAAE,qCAAqC;QAC3C,KAAK,CAAC,WAAW,CAAC,OAAwB,EAAE,IAAiB;YAC3D,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;QACvB,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n PipelineRequest,\n PipelineResponse,\n SendRequest,\n PipelinePolicy,\n} from \"@azure/core-rest-pipeline\";\n\n/**\n * The programmatic identifier of the storageCorrectContentLengthPolicy.\n */\nexport const storageCorrectContentLengthPolicyName = \"StorageCorrectContentLengthPolicy\";\n\n/**\n * storageCorrectContentLengthPolicy to correctly set Content-Length header with request body length.\n */\nexport function storageCorrectContentLengthPolicy(): PipelinePolicy {\n return {\n name: storageCorrectContentLengthPolicyName,\n async sendRequest(request: PipelineRequest, next: SendRequest): Promise<PipelineResponse> {\n return next(request);\n },\n };\n}\n"]}
@@ -0,0 +1,10 @@
1
+ import type { PipelinePolicy } from "@azure/core-rest-pipeline";
2
+ /**
3
+ * The programmatic identifier of the storageCorrectContentLengthPolicy.
4
+ */
5
+ export declare const storageCorrectContentLengthPolicyName = "StorageCorrectContentLengthPolicy";
6
+ /**
7
+ * storageCorrectContentLengthPolicy to correctly set Content-Length header with request body length.
8
+ */
9
+ export declare function storageCorrectContentLengthPolicy(): PipelinePolicy;
10
+ //# sourceMappingURL=StorageCorrectContentLengthPolicy-browser.d.mts.map
@@ -0,0 +1,18 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ /**
4
+ * The programmatic identifier of the storageCorrectContentLengthPolicy.
5
+ */
6
+ export const storageCorrectContentLengthPolicyName = "StorageCorrectContentLengthPolicy";
7
+ /**
8
+ * storageCorrectContentLengthPolicy to correctly set Content-Length header with request body length.
9
+ */
10
+ export function storageCorrectContentLengthPolicy() {
11
+ return {
12
+ name: storageCorrectContentLengthPolicyName,
13
+ async sendRequest(request, next) {
14
+ return next(request);
15
+ },
16
+ };
17
+ }
18
+ //# sourceMappingURL=StorageCorrectContentLengthPolicy-browser.mjs.map
@@ -0,0 +1,62 @@
1
+ import type { RequestPolicy, RequestPolicyOptionsLike as RequestPolicyOptions, RequestPolicyFactory, WebResourceLike as WebResource, CompatResponse as HttpOperationResponse } from "@azure/core-http-compat";
2
+ import { BaseRequestPolicy } from "./RequestPolicy.js";
3
+ import type { RestError } from "@azure/core-rest-pipeline";
4
+ import { type StorageRetryOptions } from "../StorageRetryPolicyFactory.js";
5
+ /**
6
+ * A factory method used to generated a RetryPolicy factory.
7
+ *
8
+ * @param retryOptions -
9
+ */
10
+ export declare function NewRetryPolicyFactory(retryOptions?: StorageRetryOptions): RequestPolicyFactory;
11
+ /**
12
+ * Retry policy with exponential retry and linear retry implemented.
13
+ */
14
+ export declare class StorageRetryPolicy extends BaseRequestPolicy {
15
+ /**
16
+ * RetryOptions.
17
+ */
18
+ private readonly retryOptions;
19
+ /**
20
+ * Creates an instance of RetryPolicy.
21
+ *
22
+ * @param nextPolicy -
23
+ * @param options -
24
+ * @param retryOptions -
25
+ */
26
+ constructor(nextPolicy: RequestPolicy, options: RequestPolicyOptions, retryOptions?: StorageRetryOptions);
27
+ /**
28
+ * Sends request.
29
+ *
30
+ * @param request -
31
+ */
32
+ sendRequest(request: WebResource): Promise<HttpOperationResponse>;
33
+ /**
34
+ * Decide and perform next retry. Won't mutate request parameter.
35
+ *
36
+ * @param request -
37
+ * @param secondaryHas404 - If attempt was against the secondary & it returned a StatusNotFound (404), then
38
+ * the resource was not found. This may be due to replication delay. So, in this
39
+ * case, we'll never try the secondary again for this operation.
40
+ * @param attempt - How many retries has been attempted to performed, starting from 1, which includes
41
+ * the attempt will be performed by this method call.
42
+ */
43
+ protected attemptSendRequest(request: WebResource, secondaryHas404: boolean, attempt: number): Promise<HttpOperationResponse>;
44
+ /**
45
+ * Decide whether to retry according to last HTTP response and retry counters.
46
+ *
47
+ * @param isPrimaryRetry -
48
+ * @param attempt -
49
+ * @param response -
50
+ * @param err -
51
+ */
52
+ protected shouldRetry(isPrimaryRetry: boolean, attempt: number, response?: HttpOperationResponse, err?: RestError): boolean;
53
+ /**
54
+ * Delay a calculated time between retries.
55
+ *
56
+ * @param isPrimaryRetry -
57
+ * @param attempt -
58
+ * @param abortSignal -
59
+ */
60
+ private delay;
61
+ }
62
+ //# sourceMappingURL=StorageRetryPolicy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StorageRetryPolicy.d.ts","sourceRoot":"","sources":["../../../src/policies/StorageRetryPolicy.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,aAAa,EACb,wBAAwB,IAAI,oBAAoB,EAChD,oBAAoB,EACpB,eAAe,IAAI,WAAW,EAC9B,cAAc,IAAI,qBAAqB,EACxC,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAM3E;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,YAAY,CAAC,EAAE,mBAAmB,GAAG,oBAAoB,CAM9F;AAcD;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,iBAAiB;IACvD;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAsB;IAEnD;;;;;;OAMG;gBAED,UAAU,EAAE,aAAa,EACzB,OAAO,EAAE,oBAAoB,EAC7B,YAAY,GAAE,mBAA2C;IAyC3D;;;;OAIG;IACU,WAAW,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAI9E;;;;;;;;;OASG;cACa,kBAAkB,CAChC,OAAO,EAAE,WAAW,EACpB,eAAe,EAAE,OAAO,EACxB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,qBAAqB,CAAC;IA0CjC;;;;;;;OAOG;IACH,SAAS,CAAC,WAAW,CACnB,cAAc,EAAE,OAAO,EACvB,OAAO,EAAE,MAAM,EACf,QAAQ,CAAC,EAAE,qBAAqB,EAChC,GAAG,CAAC,EAAE,SAAS,GACd,OAAO;IA8EV;;;;;;OAMG;YACW,KAAK;CA0BpB"}
@@ -0,0 +1,220 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ import { AbortError } from "@azure/abort-controller";
4
+ import { BaseRequestPolicy } from "./RequestPolicy.js";
5
+ import { URLConstants } from "../utils/constants.js";
6
+ import { delay, setURLHost, setURLParameter } from "../utils/utils.common.js";
7
+ import { logger } from "../log.js";
8
+ import { StorageRetryPolicyType } from "./StorageRetryPolicyType.js";
9
+ /**
10
+ * A factory method used to generated a RetryPolicy factory.
11
+ *
12
+ * @param retryOptions -
13
+ */
14
+ export function NewRetryPolicyFactory(retryOptions) {
15
+ return {
16
+ create: (nextPolicy, options) => {
17
+ return new StorageRetryPolicy(nextPolicy, options, retryOptions);
18
+ },
19
+ };
20
+ }
21
+ // Default values of StorageRetryOptions
22
+ const DEFAULT_RETRY_OPTIONS = {
23
+ maxRetryDelayInMs: 120 * 1000,
24
+ maxTries: 4,
25
+ retryDelayInMs: 4 * 1000,
26
+ retryPolicyType: StorageRetryPolicyType.EXPONENTIAL,
27
+ secondaryHost: "",
28
+ tryTimeoutInMs: undefined, // Use server side default timeout strategy
29
+ };
30
+ const RETRY_ABORT_ERROR = new AbortError("The operation was aborted.");
31
+ /**
32
+ * Retry policy with exponential retry and linear retry implemented.
33
+ */
34
+ export class StorageRetryPolicy extends BaseRequestPolicy {
35
+ /**
36
+ * RetryOptions.
37
+ */
38
+ retryOptions;
39
+ /**
40
+ * Creates an instance of RetryPolicy.
41
+ *
42
+ * @param nextPolicy -
43
+ * @param options -
44
+ * @param retryOptions -
45
+ */
46
+ constructor(nextPolicy, options, retryOptions = DEFAULT_RETRY_OPTIONS) {
47
+ super(nextPolicy, options);
48
+ // Initialize retry options
49
+ this.retryOptions = {
50
+ retryPolicyType: retryOptions.retryPolicyType
51
+ ? retryOptions.retryPolicyType
52
+ : DEFAULT_RETRY_OPTIONS.retryPolicyType,
53
+ maxTries: retryOptions.maxTries && retryOptions.maxTries >= 1
54
+ ? Math.floor(retryOptions.maxTries)
55
+ : DEFAULT_RETRY_OPTIONS.maxTries,
56
+ tryTimeoutInMs: retryOptions.tryTimeoutInMs && retryOptions.tryTimeoutInMs >= 0
57
+ ? retryOptions.tryTimeoutInMs
58
+ : DEFAULT_RETRY_OPTIONS.tryTimeoutInMs,
59
+ retryDelayInMs: retryOptions.retryDelayInMs && retryOptions.retryDelayInMs >= 0
60
+ ? Math.min(retryOptions.retryDelayInMs, retryOptions.maxRetryDelayInMs
61
+ ? retryOptions.maxRetryDelayInMs
62
+ : DEFAULT_RETRY_OPTIONS.maxRetryDelayInMs)
63
+ : DEFAULT_RETRY_OPTIONS.retryDelayInMs,
64
+ maxRetryDelayInMs: retryOptions.maxRetryDelayInMs && retryOptions.maxRetryDelayInMs >= 0
65
+ ? retryOptions.maxRetryDelayInMs
66
+ : DEFAULT_RETRY_OPTIONS.maxRetryDelayInMs,
67
+ secondaryHost: retryOptions.secondaryHost
68
+ ? retryOptions.secondaryHost
69
+ : DEFAULT_RETRY_OPTIONS.secondaryHost,
70
+ };
71
+ }
72
+ /**
73
+ * Sends request.
74
+ *
75
+ * @param request -
76
+ */
77
+ async sendRequest(request) {
78
+ return this.attemptSendRequest(request, false, 1);
79
+ }
80
+ /**
81
+ * Decide and perform next retry. Won't mutate request parameter.
82
+ *
83
+ * @param request -
84
+ * @param secondaryHas404 - If attempt was against the secondary & it returned a StatusNotFound (404), then
85
+ * the resource was not found. This may be due to replication delay. So, in this
86
+ * case, we'll never try the secondary again for this operation.
87
+ * @param attempt - How many retries has been attempted to performed, starting from 1, which includes
88
+ * the attempt will be performed by this method call.
89
+ */
90
+ async attemptSendRequest(request, secondaryHas404, attempt) {
91
+ const newRequest = request.clone();
92
+ const isPrimaryRetry = secondaryHas404 ||
93
+ !this.retryOptions.secondaryHost ||
94
+ !(request.method === "GET" || request.method === "HEAD" || request.method === "OPTIONS") ||
95
+ attempt % 2 === 1;
96
+ if (!isPrimaryRetry) {
97
+ newRequest.url = setURLHost(newRequest.url, this.retryOptions.secondaryHost);
98
+ }
99
+ // Set the server-side timeout query parameter "timeout=[seconds]"
100
+ if (this.retryOptions.tryTimeoutInMs) {
101
+ newRequest.url = setURLParameter(newRequest.url, URLConstants.Parameters.TIMEOUT, Math.floor(this.retryOptions.tryTimeoutInMs / 1000).toString());
102
+ }
103
+ let response;
104
+ try {
105
+ logger.info(`RetryPolicy: =====> Try=${attempt} ${isPrimaryRetry ? "Primary" : "Secondary"}`);
106
+ response = await this._nextPolicy.sendRequest(newRequest);
107
+ if (!this.shouldRetry(isPrimaryRetry, attempt, response)) {
108
+ return response;
109
+ }
110
+ secondaryHas404 = secondaryHas404 || (!isPrimaryRetry && response.status === 404);
111
+ }
112
+ catch (err) {
113
+ logger.error(`RetryPolicy: Caught error, message: ${err.message}, code: ${err.code}`);
114
+ if (!this.shouldRetry(isPrimaryRetry, attempt, response, err)) {
115
+ throw err;
116
+ }
117
+ }
118
+ await this.delay(isPrimaryRetry, attempt, request.abortSignal);
119
+ return this.attemptSendRequest(request, secondaryHas404, ++attempt);
120
+ }
121
+ /**
122
+ * Decide whether to retry according to last HTTP response and retry counters.
123
+ *
124
+ * @param isPrimaryRetry -
125
+ * @param attempt -
126
+ * @param response -
127
+ * @param err -
128
+ */
129
+ shouldRetry(isPrimaryRetry, attempt, response, err) {
130
+ if (attempt >= this.retryOptions.maxTries) {
131
+ logger.info(`RetryPolicy: Attempt(s) ${attempt} >= maxTries ${this.retryOptions
132
+ .maxTries}, no further try.`);
133
+ return false;
134
+ }
135
+ // Handle network failures, you may need to customize the list when you implement
136
+ // your own http client
137
+ const retriableErrors = [
138
+ "ETIMEDOUT",
139
+ "ESOCKETTIMEDOUT",
140
+ "ECONNREFUSED",
141
+ "ECONNRESET",
142
+ "ENOENT",
143
+ "ENOTFOUND",
144
+ "TIMEOUT",
145
+ "EPIPE",
146
+ "REQUEST_SEND_ERROR", // For default xhr based http client provided in ms-rest-js
147
+ ];
148
+ if (err) {
149
+ for (const retriableError of retriableErrors) {
150
+ if (err.name.toUpperCase().includes(retriableError) ||
151
+ err.message.toUpperCase().includes(retriableError) ||
152
+ (err.code && err.code.toString().toUpperCase() === retriableError)) {
153
+ logger.info(`RetryPolicy: Network error ${retriableError} found, will retry.`);
154
+ return true;
155
+ }
156
+ }
157
+ }
158
+ // If attempt was against the secondary & it returned a StatusNotFound (404), then
159
+ // the resource was not found. This may be due to replication delay. So, in this
160
+ // case, we'll never try the secondary again for this operation.
161
+ if (response || err) {
162
+ const statusCode = response ? response.status : err ? err.statusCode : 0;
163
+ if (!isPrimaryRetry && statusCode === 404) {
164
+ logger.info(`RetryPolicy: Secondary access with 404, will retry.`);
165
+ return true;
166
+ }
167
+ // Server internal error or server timeout
168
+ if (statusCode === 503 || statusCode === 500) {
169
+ logger.info(`RetryPolicy: Will retry for status code ${statusCode}.`);
170
+ return true;
171
+ }
172
+ }
173
+ // [Copy source error code] Feature is pending on service side, skip retry on copy source error for now.
174
+ // if (response) {
175
+ // // Retry select Copy Source Error Codes.
176
+ // if (response?.status >= 400) {
177
+ // const copySourceError = response.headers.get(HeaderConstants.X_MS_CopySourceErrorCode);
178
+ // if (copySourceError !== undefined) {
179
+ // switch (copySourceError) {
180
+ // case "InternalError":
181
+ // case "OperationTimedOut":
182
+ // case "ServerBusy":
183
+ // return true;
184
+ // }
185
+ // }
186
+ // }
187
+ // }
188
+ if (err?.code === "PARSE_ERROR" && err?.message.startsWith(`Error "Error: Unclosed root tag`)) {
189
+ logger.info("RetryPolicy: Incomplete XML response likely due to service timeout, will retry.");
190
+ return true;
191
+ }
192
+ return false;
193
+ }
194
+ /**
195
+ * Delay a calculated time between retries.
196
+ *
197
+ * @param isPrimaryRetry -
198
+ * @param attempt -
199
+ * @param abortSignal -
200
+ */
201
+ async delay(isPrimaryRetry, attempt, abortSignal) {
202
+ let delayTimeInMs = 0;
203
+ if (isPrimaryRetry) {
204
+ switch (this.retryOptions.retryPolicyType) {
205
+ case StorageRetryPolicyType.EXPONENTIAL:
206
+ delayTimeInMs = Math.min((Math.pow(2, attempt - 1) - 1) * this.retryOptions.retryDelayInMs, this.retryOptions.maxRetryDelayInMs);
207
+ break;
208
+ case StorageRetryPolicyType.FIXED:
209
+ delayTimeInMs = this.retryOptions.retryDelayInMs;
210
+ break;
211
+ }
212
+ }
213
+ else {
214
+ delayTimeInMs = Math.random() * 1000;
215
+ }
216
+ logger.info(`RetryPolicy: Delay for ${delayTimeInMs}ms`);
217
+ return delay(delayTimeInMs, abortSignal, RETRY_ABORT_ERROR);
218
+ }
219
+ }
220
+ //# sourceMappingURL=StorageRetryPolicy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StorageRetryPolicy.js","sourceRoot":"","sources":["../../../src/policies/StorageRetryPolicy.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAQrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAGvD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAErE;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,YAAkC;IACtE,OAAO;QACL,MAAM,EAAE,CAAC,UAAyB,EAAE,OAA6B,EAAsB,EAAE;YACvF,OAAO,IAAI,kBAAkB,CAAC,UAAU,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC;QACnE,CAAC;KACF,CAAC;AACJ,CAAC;AAED,wCAAwC;AACxC,MAAM,qBAAqB,GAAwB;IACjD,iBAAiB,EAAE,GAAG,GAAG,IAAI;IAC7B,QAAQ,EAAE,CAAC;IACX,cAAc,EAAE,CAAC,GAAG,IAAI;IACxB,eAAe,EAAE,sBAAsB,CAAC,WAAW;IACnD,aAAa,EAAE,EAAE;I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// Licensed under the MIT License.\n\nimport type { AbortSignalLike } from \"@azure/abort-controller\";\nimport { AbortError } from \"@azure/abort-controller\";\nimport type {\n RequestPolicy,\n RequestPolicyOptionsLike as RequestPolicyOptions,\n RequestPolicyFactory,\n WebResourceLike as WebResource,\n CompatResponse as HttpOperationResponse,\n} from \"@azure/core-http-compat\";\nimport { BaseRequestPolicy } from \"./RequestPolicy.js\";\nimport type { RestError } from \"@azure/core-rest-pipeline\";\nimport { type StorageRetryOptions } from \"../StorageRetryPolicyFactory.js\";\nimport { URLConstants } from \"../utils/constants.js\";\nimport { delay, setURLHost, setURLParameter } from \"../utils/utils.common.js\";\nimport { logger } from \"../log.js\";\nimport { StorageRetryPolicyType } from \"./StorageRetryPolicyType.js\";\n\n/**\n * A factory method used to generated a RetryPolicy factory.\n *\n * @param retryOptions -\n */\nexport function NewRetryPolicyFactory(retryOptions?: StorageRetryOptions): RequestPolicyFactory {\n return {\n create: (nextPolicy: RequestPolicy, options: RequestPolicyOptions): StorageRetryPolicy => {\n return new StorageRetryPolicy(nextPolicy, options, retryOptions);\n },\n };\n}\n\n// Default values of StorageRetryOptions\nconst DEFAULT_RETRY_OPTIONS: StorageRetryOptions = {\n maxRetryDelayInMs: 120 * 1000,\n maxTries: 4,\n retryDelayInMs: 4 * 1000,\n retryPolicyType: StorageRetryPolicyType.EXPONENTIAL,\n secondaryHost: \"\",\n tryTimeoutInMs: undefined, // Use server side default timeout strategy\n};\n\nconst RETRY_ABORT_ERROR = new AbortError(\"The operation was aborted.\");\n\n/**\n * Retry policy with exponential retry and linear retry implemented.\n */\nexport class StorageRetryPolicy extends BaseRequestPolicy {\n /**\n * RetryOptions.\n */\n private readonly retryOptions: StorageRetryOptions;\n\n /**\n * Creates an instance of RetryPolicy.\n *\n * @param nextPolicy -\n * @param options -\n * @param retryOptions -\n */\n constructor(\n nextPolicy: RequestPolicy,\n options: RequestPolicyOptions,\n retryOptions: StorageRetryOptions = DEFAULT_RETRY_OPTIONS,\n ) {\n super(nextPolicy, options);\n\n // Initialize retry options\n this.retryOptions = {\n retryPolicyType: retryOptions.retryPolicyType\n ? retryOptions.retryPolicyType\n : DEFAULT_RETRY_OPTIONS.retryPolicyType,\n\n maxTries:\n retryOptions.maxTries && retryOptions.maxTries >= 1\n ? Math.floor(retryOptions.maxTries)\n : DEFAULT_RETRY_OPTIONS.maxTries,\n\n tryTimeoutInMs:\n retryOptions.tryTimeoutInMs && retryOptions.tryTimeoutInMs >= 0\n ? retryOptions.tryTimeoutInMs\n : DEFAULT_RETRY_OPTIONS.tryTimeoutInMs,\n\n retryDelayInMs:\n retryOptions.retryDelayInMs && retryOptions.retryDelayInMs >= 0\n ? Math.min(\n retryOptions.retryDelayInMs,\n retryOptions.maxRetryDelayInMs\n ? retryOptions.maxRetryDelayInMs\n : DEFAULT_RETRY_OPTIONS.maxRetryDelayInMs!,\n )\n : DEFAULT_RETRY_OPTIONS.retryDelayInMs,\n\n maxRetryDelayInMs:\n retryOptions.maxRetryDelayInMs && retryOptions.maxRetryDelayInMs >= 0\n ? retryOptions.maxRetryDelayInMs\n : DEFAULT_RETRY_OPTIONS.maxRetryDelayInMs,\n\n secondaryHost: retryOptions.secondaryHost\n ? retryOptions.secondaryHost\n : DEFAULT_RETRY_OPTIONS.secondaryHost,\n };\n }\n\n /**\n * Sends request.\n *\n * @param request -\n */\n public async sendRequest(request: WebResource): Promise<HttpOperationResponse> {\n return this.attemptSendRequest(request, false, 1);\n }\n\n /**\n * Decide and perform next retry. Won't mutate request parameter.\n *\n * @param request -\n * @param secondaryHas404 - If attempt was against the secondary & it returned a StatusNotFound (404), then\n * the resource was not found. This may be due to replication delay. So, in this\n * case, we'll never try the secondary again for this operation.\n * @param attempt - How many retries has been attempted to performed, starting from 1, which includes\n * the attempt will be performed by this method call.\n */\n protected async attemptSendRequest(\n request: WebResource,\n secondaryHas404: boolean,\n attempt: number,\n ): Promise<HttpOperationResponse> {\n const newRequest: WebResource = request.clone();\n\n const isPrimaryRetry =\n secondaryHas404 ||\n !this.retryOptions.secondaryHost ||\n !(request.method === \"GET\" || request.method === \"HEAD\" || request.method === \"OPTIONS\") ||\n attempt % 2 === 1;\n\n if (!isPrimaryRetry) {\n newRequest.url = setURLHost(newRequest.url, this.retryOptions.secondaryHost!);\n }\n\n // Set the server-side timeout query parameter \"timeout=[seconds]\"\n if (this.retryOptions.tryTimeoutInMs) {\n newRequest.url = setURLParameter(\n newRequest.url,\n URLConstants.Parameters.TIMEOUT,\n Math.floor(this.retryOptions.tryTimeoutInMs! / 1000).toString(),\n );\n }\n\n let response: HttpOperationResponse | undefined;\n try {\n logger.info(`RetryPolicy: =====> Try=${attempt} ${isPrimaryRetry ? \"Primary\" : \"Secondary\"}`);\n response = await this._nextPolicy.sendRequest(newRequest);\n if (!this.shouldRetry(isPrimaryRetry, attempt, response)) {\n return response;\n }\n\n secondaryHas404 = secondaryHas404 || (!isPrimaryRetry && response.status === 404);\n } catch (err: any) {\n logger.error(`RetryPolicy: Caught error, message: ${err.message}, code: ${err.code}`);\n if (!this.shouldRetry(isPrimaryRetry, attempt, response, err)) {\n throw err;\n }\n }\n\n await this.delay(isPrimaryRetry, attempt, request.abortSignal);\n return this.attemptSendRequest(request, secondaryHas404, ++attempt);\n }\n\n /**\n * Decide whether to retry according to last HTTP response and retry counters.\n *\n * @param isPrimaryRetry -\n * @param attempt -\n * @param response -\n * @param err -\n */\n protected shouldRetry(\n isPrimaryRetry: boolean,\n attempt: number,\n response?: HttpOperationResponse,\n err?: RestError,\n ): boolean {\n if (attempt >= this.retryOptions.maxTries!) {\n logger.info(\n `RetryPolicy: Attempt(s) ${attempt} >= maxTries ${this.retryOptions\n .maxTries!}, no further try.`,\n );\n return false;\n }\n\n // Handle network failures, you may need to customize the list when you implement\n // your own http client\n const retriableErrors = [\n \"ETIMEDOUT\",\n \"ESOCKETTIMEDOUT\",\n \"ECONNREFUSED\",\n \"ECONNRESET\",\n \"ENOENT\",\n \"ENOTFOUND\",\n \"TIMEOUT\",\n \"EPIPE\",\n \"REQUEST_SEND_ERROR\", // For default xhr based http client provided in ms-rest-js\n ];\n if (err) {\n for (const retriableError of retriableErrors) {\n if (\n err.name.toUpperCase().includes(retriableError) ||\n err.message.toUpperCase().includes(retriableError) ||\n (err.code && err.code.toString().toUpperCase() === retriableError)\n ) {\n logger.info(`RetryPolicy: Network error ${retriableError} found, will retry.`);\n return true;\n }\n }\n }\n\n // If attempt was against the secondary & it returned a StatusNotFound (404), then\n // the resource was not found. This may be due to replication delay. So, in this\n // case, we'll never try the secondary again for this operation.\n if (response || err) {\n const statusCode = response ? response.status : err ? err.statusCode : 0;\n if (!isPrimaryRetry && statusCode === 404) {\n logger.info(`RetryPolicy: Secondary access with 404, will retry.`);\n return true;\n }\n\n // Server internal error or server timeout\n if (statusCode === 503 || statusCode === 500) {\n logger.info(`RetryPolicy: Will retry for status code ${statusCode}.`);\n return true;\n }\n }\n\n // [Copy source error code] Feature is pending on service side, skip retry on copy source error for now.\n // if (response) {\n // // Retry select Copy Source Error Codes.\n // if (response?.status >= 400) {\n // const copySourceError = response.headers.get(HeaderConstants.X_MS_CopySourceErrorCode);\n // if (copySourceError !== undefined) {\n // switch (copySourceError) {\n // case \"InternalError\":\n // case \"OperationTimedOut\":\n // case \"ServerBusy\":\n // return true;\n // }\n // }\n // }\n // }\n\n if (err?.code === \"PARSE_ERROR\" && err?.message.startsWith(`Error \"Error: Unclosed root tag`)) {\n logger.info(\n \"RetryPolicy: Incomplete XML response likely due to service timeout, will retry.\",\n );\n return true;\n }\n\n return false;\n }\n\n /**\n * Delay a calculated time between retries.\n *\n * @param isPrimaryRetry -\n * @param attempt -\n * @param abortSignal -\n */\n private async delay(\n isPrimaryRetry: boolean,\n attempt: number,\n abortSignal?: AbortSignalLike,\n ): Promise<void> {\n let delayTimeInMs: number = 0;\n\n if (isPrimaryRetry) {\n switch (this.retryOptions.retryPolicyType) {\n case StorageRetryPolicyType.EXPONENTIAL:\n delayTimeInMs = Math.min(\n (Math.pow(2, attempt - 1) - 1) * this.retryOptions.retryDelayInMs!,\n this.retryOptions.maxRetryDelayInMs!,\n );\n break;\n case StorageRetryPolicyType.FIXED:\n delayTimeInMs = this.retryOptions.retryDelayInMs!;\n break;\n }\n } else {\n delayTimeInMs = Math.random() * 1000;\n }\n\n logger.info(`RetryPolicy: Delay for ${delayTimeInMs}ms`);\n return delay(delayTimeInMs, abortSignal, RETRY_ABORT_ERROR);\n }\n}\n"]}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * RetryPolicy types.
3
+ */
4
+ export declare enum StorageRetryPolicyType {
5
+ /**
6
+ * Exponential retry. Retry time delay grows exponentially.
7
+ */
8
+ EXPONENTIAL = 0,
9
+ /**
10
+ * Linear retry. Retry time delay grows linearly.
11
+ */
12
+ FIXED = 1
13
+ }
14
+ //# sourceMappingURL=StorageRetryPolicyType.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StorageRetryPolicyType.d.ts","sourceRoot":"","sources":["../../../src/policies/StorageRetryPolicyType.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,oBAAY,sBAAsB;IAChC;;OAEG;IACH,WAAW,IAAA;IACX;;OAEG;IACH,KAAK,IAAA;CACN"}