@azure/storage-file-share 12.28.0-alpha.20250619.1 → 12.28.0-alpha.20250717.2

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 (161) hide show
  1. package/dist/browser/AccountSASSignatureValues.d.ts +1 -1
  2. package/dist/browser/AccountSASSignatureValues.d.ts.map +1 -1
  3. package/dist/browser/AccountSASSignatureValues.js.map +1 -1
  4. package/dist/browser/Clients.d.ts +1 -1
  5. package/dist/browser/Clients.d.ts.map +1 -1
  6. package/dist/browser/Clients.js +3 -3
  7. package/dist/browser/Clients.js.map +1 -1
  8. package/dist/browser/FileSASSignatureValues.d.ts +1 -1
  9. package/dist/browser/FileSASSignatureValues.d.ts.map +1 -1
  10. package/dist/browser/FileSASSignatureValues.js.map +1 -1
  11. package/dist/browser/Pipeline.d.ts +2 -4
  12. package/dist/browser/Pipeline.d.ts.map +1 -1
  13. package/dist/browser/Pipeline.js +1 -9
  14. package/dist/browser/Pipeline.js.map +1 -1
  15. package/dist/browser/ShareServiceClient.d.ts +1 -1
  16. package/dist/browser/ShareServiceClient.d.ts.map +1 -1
  17. package/dist/browser/ShareServiceClient.js +3 -3
  18. package/dist/browser/ShareServiceClient.js.map +1 -1
  19. package/dist/browser/StorageClient.d.ts +2 -2
  20. package/dist/browser/StorageClient.d.ts.map +1 -1
  21. package/dist/browser/StorageClient.js.map +1 -1
  22. package/dist/browser/index-browser.d.mts.map +1 -1
  23. package/dist/browser/index-browser.mjs.map +1 -1
  24. package/dist/browser/index.d.ts +1 -7
  25. package/dist/browser/index.js +1 -7
  26. package/dist/commonjs/AccountSASSignatureValues.d.ts +1 -1
  27. package/dist/commonjs/AccountSASSignatureValues.d.ts.map +1 -1
  28. package/dist/commonjs/AccountSASSignatureValues.js.map +1 -1
  29. package/dist/commonjs/Clients.d.ts +1 -1
  30. package/dist/commonjs/Clients.d.ts.map +1 -1
  31. package/dist/commonjs/Clients.js +15 -15
  32. package/dist/commonjs/Clients.js.map +1 -1
  33. package/dist/commonjs/FileSASSignatureValues.d.ts +1 -1
  34. package/dist/commonjs/FileSASSignatureValues.d.ts.map +1 -1
  35. package/dist/commonjs/FileSASSignatureValues.js.map +1 -1
  36. package/dist/commonjs/Pipeline.d.ts +2 -4
  37. package/dist/commonjs/Pipeline.d.ts.map +1 -1
  38. package/dist/commonjs/Pipeline.js +12 -20
  39. package/dist/commonjs/Pipeline.js.map +1 -1
  40. package/dist/commonjs/ShareServiceClient.d.ts +1 -1
  41. package/dist/commonjs/ShareServiceClient.d.ts.map +1 -1
  42. package/dist/commonjs/ShareServiceClient.js +9 -9
  43. package/dist/commonjs/ShareServiceClient.js.map +1 -1
  44. package/dist/commonjs/StorageClient.d.ts +2 -2
  45. package/dist/commonjs/StorageClient.d.ts.map +1 -1
  46. package/dist/commonjs/StorageClient.js.map +1 -1
  47. package/dist/commonjs/index.d.ts +1 -9
  48. package/dist/commonjs/index.d.ts.map +1 -1
  49. package/dist/commonjs/index.js +13 -18
  50. package/dist/commonjs/index.js.map +1 -1
  51. package/dist/commonjs/utils/utils.d.ts +1 -1
  52. package/dist/commonjs/utils/utils.d.ts.map +1 -1
  53. package/dist/commonjs/utils/utils.js +5 -5
  54. package/dist/commonjs/utils/utils.js.map +1 -1
  55. package/dist/esm/AccountSASSignatureValues.d.ts +1 -1
  56. package/dist/esm/AccountSASSignatureValues.d.ts.map +1 -1
  57. package/dist/esm/AccountSASSignatureValues.js.map +1 -1
  58. package/dist/esm/Clients.d.ts +1 -1
  59. package/dist/esm/Clients.d.ts.map +1 -1
  60. package/dist/esm/Clients.js +3 -3
  61. package/dist/esm/Clients.js.map +1 -1
  62. package/dist/esm/FileSASSignatureValues.d.ts +1 -1
  63. package/dist/esm/FileSASSignatureValues.d.ts.map +1 -1
  64. package/dist/esm/FileSASSignatureValues.js.map +1 -1
  65. package/dist/esm/Pipeline.d.ts +2 -4
  66. package/dist/esm/Pipeline.d.ts.map +1 -1
  67. package/dist/esm/Pipeline.js +1 -9
  68. package/dist/esm/Pipeline.js.map +1 -1
  69. package/dist/esm/ShareServiceClient.d.ts +1 -1
  70. package/dist/esm/ShareServiceClient.d.ts.map +1 -1
  71. package/dist/esm/ShareServiceClient.js +3 -3
  72. package/dist/esm/ShareServiceClient.js.map +1 -1
  73. package/dist/esm/StorageClient.d.ts +2 -2
  74. package/dist/esm/StorageClient.d.ts.map +1 -1
  75. package/dist/esm/StorageClient.js.map +1 -1
  76. package/dist/esm/index.d.ts +1 -9
  77. package/dist/esm/index.d.ts.map +1 -1
  78. package/dist/esm/index.js +1 -9
  79. package/dist/esm/index.js.map +1 -1
  80. package/dist/esm/utils/utils.d.ts +1 -1
  81. package/dist/esm/utils/utils.d.ts.map +1 -1
  82. package/dist/esm/utils/utils.js +2 -2
  83. package/dist/esm/utils/utils.js.map +1 -1
  84. package/dist/react-native/AccountSASSignatureValues.d.ts +1 -1
  85. package/dist/react-native/AccountSASSignatureValues.d.ts.map +1 -1
  86. package/dist/react-native/AccountSASSignatureValues.js.map +1 -1
  87. package/dist/react-native/Clients.d.ts +1 -1
  88. package/dist/react-native/Clients.d.ts.map +1 -1
  89. package/dist/react-native/Clients.js +3 -3
  90. package/dist/react-native/Clients.js.map +1 -1
  91. package/dist/react-native/FileSASSignatureValues.d.ts +1 -1
  92. package/dist/react-native/FileSASSignatureValues.d.ts.map +1 -1
  93. package/dist/react-native/FileSASSignatureValues.js.map +1 -1
  94. package/dist/react-native/Pipeline.d.ts +2 -4
  95. package/dist/react-native/Pipeline.d.ts.map +1 -1
  96. package/dist/react-native/Pipeline.js +1 -9
  97. package/dist/react-native/Pipeline.js.map +1 -1
  98. package/dist/react-native/ShareServiceClient.d.ts +1 -1
  99. package/dist/react-native/ShareServiceClient.d.ts.map +1 -1
  100. package/dist/react-native/ShareServiceClient.js +3 -3
  101. package/dist/react-native/ShareServiceClient.js.map +1 -1
  102. package/dist/react-native/StorageClient.d.ts +2 -2
  103. package/dist/react-native/StorageClient.d.ts.map +1 -1
  104. package/dist/react-native/StorageClient.js.map +1 -1
  105. package/dist/react-native/index.d.ts +1 -9
  106. package/dist/react-native/index.d.ts.map +1 -1
  107. package/dist/react-native/index.js +1 -9
  108. package/dist/react-native/index.js.map +1 -1
  109. package/dist/react-native/utils/utils.d.ts +1 -1
  110. package/dist/react-native/utils/utils.d.ts.map +1 -1
  111. package/dist/react-native/utils/utils.js +2 -2
  112. package/dist/react-native/utils/utils.js.map +1 -1
  113. package/package.json +2 -2
  114. package/dist/browser/StorageRetryPolicyFactory.d.ts +0 -56
  115. package/dist/browser/StorageRetryPolicyFactory.d.ts.map +0 -1
  116. package/dist/browser/StorageRetryPolicyFactory.js +0 -26
  117. package/dist/browser/StorageRetryPolicyFactory.js.map +0 -1
  118. package/dist/browser/policies/StorageRetryPolicy.d.ts +0 -75
  119. package/dist/browser/policies/StorageRetryPolicy.d.ts.map +0 -1
  120. package/dist/browser/policies/StorageRetryPolicy.js +0 -220
  121. package/dist/browser/policies/StorageRetryPolicy.js.map +0 -1
  122. package/dist/browser/policies/StorageRetryPolicyV2.d.ts +0 -24
  123. package/dist/browser/policies/StorageRetryPolicyV2.d.ts.map +0 -1
  124. package/dist/browser/policies/StorageRetryPolicyV2.js +0 -176
  125. package/dist/browser/policies/StorageRetryPolicyV2.js.map +0 -1
  126. package/dist/commonjs/StorageRetryPolicyFactory.d.ts +0 -56
  127. package/dist/commonjs/StorageRetryPolicyFactory.d.ts.map +0 -1
  128. package/dist/commonjs/StorageRetryPolicyFactory.js +0 -31
  129. package/dist/commonjs/StorageRetryPolicyFactory.js.map +0 -1
  130. package/dist/commonjs/policies/StorageRetryPolicy.d.ts +0 -75
  131. package/dist/commonjs/policies/StorageRetryPolicy.d.ts.map +0 -1
  132. package/dist/commonjs/policies/StorageRetryPolicy.js +0 -225
  133. package/dist/commonjs/policies/StorageRetryPolicy.js.map +0 -1
  134. package/dist/commonjs/policies/StorageRetryPolicyV2.d.ts +0 -24
  135. package/dist/commonjs/policies/StorageRetryPolicyV2.d.ts.map +0 -1
  136. package/dist/commonjs/policies/StorageRetryPolicyV2.js +0 -180
  137. package/dist/commonjs/policies/StorageRetryPolicyV2.js.map +0 -1
  138. package/dist/esm/StorageRetryPolicyFactory.d.ts +0 -56
  139. package/dist/esm/StorageRetryPolicyFactory.d.ts.map +0 -1
  140. package/dist/esm/StorageRetryPolicyFactory.js +0 -26
  141. package/dist/esm/StorageRetryPolicyFactory.js.map +0 -1
  142. package/dist/esm/policies/StorageRetryPolicy.d.ts +0 -75
  143. package/dist/esm/policies/StorageRetryPolicy.d.ts.map +0 -1
  144. package/dist/esm/policies/StorageRetryPolicy.js +0 -220
  145. package/dist/esm/policies/StorageRetryPolicy.js.map +0 -1
  146. package/dist/esm/policies/StorageRetryPolicyV2.d.ts +0 -24
  147. package/dist/esm/policies/StorageRetryPolicyV2.d.ts.map +0 -1
  148. package/dist/esm/policies/StorageRetryPolicyV2.js +0 -176
  149. package/dist/esm/policies/StorageRetryPolicyV2.js.map +0 -1
  150. package/dist/react-native/StorageRetryPolicyFactory.d.ts +0 -56
  151. package/dist/react-native/StorageRetryPolicyFactory.d.ts.map +0 -1
  152. package/dist/react-native/StorageRetryPolicyFactory.js +0 -26
  153. package/dist/react-native/StorageRetryPolicyFactory.js.map +0 -1
  154. package/dist/react-native/policies/StorageRetryPolicy.d.ts +0 -75
  155. package/dist/react-native/policies/StorageRetryPolicy.d.ts.map +0 -1
  156. package/dist/react-native/policies/StorageRetryPolicy.js +0 -220
  157. package/dist/react-native/policies/StorageRetryPolicy.js.map +0 -1
  158. package/dist/react-native/policies/StorageRetryPolicyV2.d.ts +0 -24
  159. package/dist/react-native/policies/StorageRetryPolicyV2.d.ts.map +0 -1
  160. package/dist/react-native/policies/StorageRetryPolicyV2.js +0 -176
  161. package/dist/react-native/policies/StorageRetryPolicyV2.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,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(c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { RestError } from \"@azure/core-rest-pipeline\";\n\nexport * from \"./AccountSASPermissions.js\";\nexport * from \"./AccountSASResourceTypes.js\";\nexport * from \"./AccountSASServices.js\";\nexport {\n AccountSASSignatureValues,\n generateAccountSASQueryParameters,\n} from \"./AccountSASSignatureValues.js\";\nexport * from \"./FileSASPermissions.js\";\nexport {\n parseOctalFileMode,\n toOctalFileMode,\n parseSymbolicFileMode,\n toSymbolicFileMode,\n} from \"./utils/utils.common.js\";\nexport {\n FileSASSignatureValues,\n generateFileSASQueryParameters,\n} from \"./FileSASSignatureValues.js\";\nexport * from \"./Clients.js\";\nexport * from \"./ShareSASPermissions.js\";\nexport { AnonymousCredential } from \"@azure/storage-blob\";\nexport { Credential } from \"@azure/storage-blob\";\nexport { StorageSharedKeyCredential } from \"@azure/storage-blob\";\nexport { SasIPRange } from \"./SasIPRange.js\";\nexport { Range } from \"./Range.js\";\nexport {\n FileAndDirectoryCreateCommonOptions,\n FileAndDirectorySetPropertiesCommonOptions,\n FileHttpHeaders,\n FilePermissionInheritType,\n FilePermissionPreserveType,\n PosixRolePermissions,\n NfsFileMode,\n FilePosixProperties,\n Metadata,\n TimeNowType,\n TimePreserveType,\n FileAttributesPreserveType,\n CloseHandlesInfo,\n ShareProtocols,\n HttpAuthorization,\n StorageFileAudience,\n getFileServiceAccountAudience,\n} from \"./models.js\";\nexport * from \"./FileSystemAttributes.js\";\nexport { BaseRequestPolicy } from \"@azure/storage-blob\";\nexport {\n Pipeline,\n PipelineLike,\n PipelineOptions,\n isPipelineLike,\n newPipeline,\n StoragePipelineOptions,\n RequestPolicyFactory,\n RequestPolicy,\n RequestPolicyOptions,\n WebResource,\n HttpOperationResponse,\n HttpHeaders,\n HttpRequestBody,\n IHttpClient,\n StorageOAuthScopes,\n ServiceClientOptions,\n} from \"./Pipeline.js\";\nexport { AnonymousCredentialPolicy } from \"@azure/storage-blob\";\nexport { CredentialPolicy } from \"@azure/storage-blob\";\nexport * from \"./StorageRetryPolicyFactory.js\";\nexport { StorageSharedKeyCredentialPolicy } from \"@azure/storage-blob\";\nexport { StorageBrowserPolicyFactory } from \"@azure/storage-blob\";\nexport * from \"./ShareServiceClient.js\";\nexport * from \"./SASQueryParameters.js\";\nexport { CommonOptions } from \"./StorageClient.js\";\nexport * from \"./generatedModels.js\";\nexport {\n WithResponse,\n ResponseLike,\n ResponseWithBody,\n ResponseWithHeaders,\n HttpResponse,\n} from \"./utils/utils.common.js\";\nexport { RestError };\nexport { logger } from \"./log.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAEtD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,OAAO,EAEL,iCAAiC,GAClC,MAAM,gCAAgC,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAEL,8BAA8B,GAC/B,MAAM,6BAA6B,CAAC;AACrC,cAAc,cAAc,CAAC;AAC7B,cAAc,0BAA0B,CAAC;AAEzC,OAAO,EACL,mBAAmB,EACnB,UAAU,EACV,0BAA0B,EAC1B,iBAAiB,EACjB,yBAAyB,EACzB,gBAAgB,EAEhB,sBAAsB,EACtB,kBAAkB,EAClB,yBAAyB,EACzB,gCAAgC,EAChC,2BAA2B,GAC5B,MAAM,uBAAuB,CAAC;AAI/B,OAAO,EAgBL,mBAAmB,EACnB,6BAA6B,GAC9B,MAAM,aAAa,CAAC;AACrB,cAAc,2BAA2B,CAAC;AAC1C,OAAO,EACL,QAAQ,EAGR,cAAc,EACd,WAAW,EAUX,kBAAkB,GAEnB,MAAM,eAAe,CAAC;AACvB,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AAExC,cAAc,sBAAsB,CAAC;AAQrC,OAAO,EAAE,SAAS,EAAE,CAAC;AACrB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { RestError } from \"@azure/core-rest-pipeline\";\n\nexport * from \"./AccountSASPermissions.js\";\nexport * from \"./AccountSASResourceTypes.js\";\nexport * from \"./AccountSASServices.js\";\nexport {\n AccountSASSignatureValues,\n generateAccountSASQueryParameters,\n} from \"./AccountSASSignatureValues.js\";\nexport * from \"./FileSASPermissions.js\";\nexport {\n parseOctalFileMode,\n toOctalFileMode,\n parseSymbolicFileMode,\n toSymbolicFileMode,\n} from \"./utils/utils.common.js\";\nexport {\n FileSASSignatureValues,\n generateFileSASQueryParameters,\n} from \"./FileSASSignatureValues.js\";\nexport * from \"./Clients.js\";\nexport * from \"./ShareSASPermissions.js\";\n\nexport {\n AnonymousCredential,\n Credential,\n StorageSharedKeyCredential,\n BaseRequestPolicy,\n AnonymousCredentialPolicy,\n CredentialPolicy,\n StorageRetryOptions,\n StorageRetryPolicyType,\n StorageRetryPolicy,\n StorageRetryPolicyFactory,\n StorageSharedKeyCredentialPolicy,\n StorageBrowserPolicyFactory,\n} from \"@azure/storage-common\";\n\nexport { SasIPRange } from \"./SasIPRange.js\";\nexport { Range } from \"./Range.js\";\nexport {\n FileAndDirectoryCreateCommonOptions,\n FileAndDirectorySetPropertiesCommonOptions,\n FileHttpHeaders,\n FilePermissionInheritType,\n FilePermissionPreserveType,\n PosixRolePermissions,\n NfsFileMode,\n FilePosixProperties,\n Metadata,\n TimeNowType,\n TimePreserveType,\n FileAttributesPreserveType,\n CloseHandlesInfo,\n ShareProtocols,\n HttpAuthorization,\n StorageFileAudience,\n getFileServiceAccountAudience,\n} from \"./models.js\";\nexport * from \"./FileSystemAttributes.js\";\nexport {\n Pipeline,\n PipelineLike,\n PipelineOptions,\n isPipelineLike,\n newPipeline,\n StoragePipelineOptions,\n RequestPolicyFactory,\n RequestPolicy,\n RequestPolicyOptions,\n WebResource,\n HttpOperationResponse,\n HttpHeaders,\n HttpRequestBody,\n IHttpClient,\n StorageOAuthScopes,\n ServiceClientOptions,\n} from \"./Pipeline.js\";\nexport * from \"./ShareServiceClient.js\";\nexport * from \"./SASQueryParameters.js\";\nexport { CommonOptions } from \"./StorageClient.js\";\nexport * from \"./generatedModels.js\";\nexport {\n WithResponse,\n ResponseLike,\n ResponseWithBody,\n ResponseWithHeaders,\n HttpResponse,\n} from \"./utils/utils.common.js\";\nexport { RestError };\nexport { logger } from \"./log.js\";\n"]}
@@ -1,4 +1,4 @@
1
- import * as fs from "node:fs";
1
+ import fs from "node:fs";
2
2
  /**
3
3
  * Reads a readable stream into buffer. Fill the buffer from offset to end.
4
4
  *
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/utils/utils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAI9B;;;;;;;;GAQG;AACH,wBAAsB,cAAc,CAClC,MAAM,EAAE,MAAM,CAAC,cAAc,EAC7B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,QAAQ,CAAC,EAAE,cAAc,GACxB,OAAO,CAAC,IAAI,CAAC,CAgDf;AAED;;;;;;;GAOG;AACH,wBAAsB,qBAAqB,CACzC,EAAE,EAAE,MAAM,CAAC,cAAc,EACzB,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,IAAI,CAAC,CAgBf;AAED;;;;GAIG;AACH,eAAO,MAAM,MAAM,8BAA0B,CAAC;AAE9C,eAAO,MAAM,kBAAkB,4BAAsB,CAAC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/utils/utils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,SAAS,CAAC;AAIzB;;;;;;;;GAQG;AACH,wBAAsB,cAAc,CAClC,MAAM,EAAE,MAAM,CAAC,cAAc,EAC7B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,QAAQ,CAAC,EAAE,cAAc,GACxB,OAAO,CAAC,IAAI,CAAC,CAgDf;AAED;;;;;;;GAOG;AACH,wBAAsB,qBAAqB,CACzC,EAAE,EAAE,MAAM,CAAC,cAAc,EACzB,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,IAAI,CAAC,CAgBf;AAED;;;;GAIG;AACH,eAAO,MAAM,MAAM,8BAA0B,CAAC;AAE9C,eAAO,MAAM,kBAAkB,4BAAsB,CAAC"}
@@ -1,7 +1,7 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT License.
3
- import * as fs from "node:fs";
4
- import * as util from "node:util";
3
+ import fs from "node:fs";
4
+ import util from "node:util";
5
5
  import { REQUEST_TIMEOUT } from "./constants.js";
6
6
  /**
7
7
  * Reads a readable stream into buffer. Fill the buffer from offset to end.
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/utils/utils.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,MAA6B,EAC7B,MAAc,EACd,MAAc,EACd,GAAW,EACX,QAAyB;IAEzB,IAAI,GAAG,GAAG,CAAC,CAAC,CAAC,qBAAqB;IAClC,MAAM,KAAK,GAAG,GAAG,GAAG,MAAM,CAAC,CAAC,wCAAwC;IAEpE,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC3C,M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AAE,CAAC,GAAG,EAAE,EAAE;YACzB,YAAY,CAAC,OAAO,CAAC,CAAC;YACtB,MAAM,CAAC,GAAG,CAAC,CAAC;QACd,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,EAAyB,EACzB,IAAY;IAEZ,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC3C,MAAM,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;QAEtC,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAU,EAAE,EAAE;YAC5B,MAAM,CAAC,GAAG,CAAC,CAAC;QACd,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAU,EAAE,EAAE;YAC5B,MAAM,CAAC,GAAG,CAAC,CAAC;QACd,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAExB,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;AAE9C,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,CAAC,gBAAgB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport * as fs from \"node:fs\";\nimport * as util from \"node:util\";\nimport { REQUEST_TIMEOUT } from \"./constants.js\";\n\n/**\n * Reads a readable stream into buffer. Fill the buffer from offset to end.\n *\n * @param stream - A Node.js Readable stream\n * @param buffer - Buffer to be filled, length must greater than or equal to offset\n * @param offset - From which position in the buffer to be filled, inclusive\n * @param end - To which position in the buffer to be filled, exclusive\n * @param encoding - Encoding of the Readable stream\n */\nexport async function streamToBuffer(\n stream: NodeJS.ReadableStream,\n buffer: Buffer,\n offset: number,\n end: number,\n encoding?: BufferEncoding,\n): Promise<void> {\n let pos = 0; // Position in stream\n const count = end - offset; // Total amount of data needed in stream\n\n return new Promise<void>((resolve, reject) => {\n const timeout = setTimeout(\n () => reject(new Error(`The operation cannot be completed in timeout.`)),\n REQUEST_TIMEOUT,\n );\n stream.on(\"readable\", () => {\n if (pos >= count) {\n clearTimeout(timeout);\n resolve();\n return;\n }\n\n let chunk = stream.read();\n if (!chunk) {\n return;\n }\n if (typeof chunk === \"string\") {\n chunk = Buffer.from(chunk, encoding);\n }\n\n // How much data needed in this chunk\n const chunkLength = pos + chunk.length > count ? count - pos : chunk.length;\n\n buffer.fill(chunk.slice(0, chunkLength), offset + pos, offset + pos + chunkLength);\n pos += chunkLength;\n });\n\n stream.on(\"end\", () => {\n clearTimeout(timeout);\n if (pos < count) {\n reject(\n new Error(\n `Stream drains before getting enough data needed. Data read: ${pos}, data need: ${count}`,\n ),\n );\n }\n resolve();\n });\n\n stream.on(\"error\", (msg) => {\n clearTimeout(timeout);\n reject(msg);\n });\n });\n}\n\n/**\n * ONLY AVAILABLE IN NODE.JS RUNTIME.\n *\n * Writes the content of a readstream to a local file. Returns a Promise which is completed after the file handle is closed.\n *\n * @param rs - The read stream.\n * @param file - Destination file path.\n */\nexport async function readStreamToLocalFile(\n rs: NodeJS.ReadableStream,\n file: string,\n): Promise<void> {\n return new Promise<void>((resolve, reject) => {\n const ws = fs.createWriteStream(file);\n\n rs.on(\"error\", (err: Error) => {\n reject(err);\n });\n\n ws.on(\"error\", (err: Error) => {\n reject(err);\n });\n\n ws.on(\"close\", resolve);\n\n rs.pipe(ws);\n });\n}\n\n/**\n * ONLY AVAILABLE IN NODE.JS RUNTIME.\n *\n * Promisified version of fs.stat().\n */\nexport const fsStat = util.promisify(fs.stat);\n\nexport const fsCreateReadStream = fs.createReadStream;\n"]}
1
+ {"version":3,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AAC,EAAE,CAAC,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;AAE9C,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,CAAC,gBAAgB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport fs from \"node:fs\";\nimport util from \"node:util\";\nimport { REQUEST_TIMEOUT } from \"./constants.js\";\n\n/**\n * Reads a readable stream into buffer. Fill the buffer from offset to end.\n *\n * @param stream - A Node.js Readable stream\n * @param buffer - Buffer to be filled, length must greater than or equal to offset\n * @param offset - From which position in the buffer to be filled, inclusive\n * @param end - To which position in the buffer to be filled, exclusive\n * @param encoding - Encoding of the Readable stream\n */\nexport async function streamToBuffer(\n stream: NodeJS.ReadableStream,\n buffer: Buffer,\n offset: number,\n end: number,\n encoding?: BufferEncoding,\n): Promise<void> {\n let pos = 0; // Position in stream\n const count = end - offset; // Total amount of data needed in stream\n\n return new Promise<void>((resolve, reject) => {\n const timeout = setTimeout(\n () => reject(new Error(`The operation cannot be completed in timeout.`)),\n REQUEST_TIMEOUT,\n );\n stream.on(\"readable\", () => {\n if (pos >= count) {\n clearTimeout(timeout);\n resolve();\n return;\n }\n\n let chunk = stream.read();\n if (!chunk) {\n return;\n }\n if (typeof chunk === \"string\") {\n chunk = Buffer.from(chunk, encoding);\n }\n\n // How much data needed in this chunk\n const chunkLength = pos + chunk.length > count ? count - pos : chunk.length;\n\n buffer.fill(chunk.slice(0, chunkLength), offset + pos, offset + pos + chunkLength);\n pos += chunkLength;\n });\n\n stream.on(\"end\", () => {\n clearTimeout(timeout);\n if (pos < count) {\n reject(\n new Error(\n `Stream drains before getting enough data needed. Data read: ${pos}, data need: ${count}`,\n ),\n );\n }\n resolve();\n });\n\n stream.on(\"error\", (msg) => {\n clearTimeout(timeout);\n reject(msg);\n });\n });\n}\n\n/**\n * ONLY AVAILABLE IN NODE.JS RUNTIME.\n *\n * Writes the content of a readstream to a local file. Returns a Promise which is completed after the file handle is closed.\n *\n * @param rs - The read stream.\n * @param file - Destination file path.\n */\nexport async function readStreamToLocalFile(\n rs: NodeJS.ReadableStream,\n file: string,\n): Promise<void> {\n return new Promise<void>((resolve, reject) => {\n const ws = fs.createWriteStream(file);\n\n rs.on(\"error\", (err: Error) => {\n reject(err);\n });\n\n ws.on(\"error\", (err: Error) => {\n reject(err);\n });\n\n ws.on(\"close\", resolve);\n\n rs.pipe(ws);\n });\n}\n\n/**\n * ONLY AVAILABLE IN NODE.JS RUNTIME.\n *\n * Promisified version of fs.stat().\n */\nexport const fsStat = util.promisify(fs.stat);\n\nexport const fsCreateReadStream = fs.createReadStream;\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@azure/storage-file-share",
3
3
  "sdk-type": "client",
4
- "version": "12.28.0-alpha.20250619.1",
4
+ "version": "12.28.0-alpha.20250717.2",
5
5
  "description": "Microsoft Azure Storage SDK for JavaScript - File",
6
6
  "main": "./dist/commonjs/index.js",
7
7
  "module": "./dist/esm/index.js",
@@ -99,7 +99,6 @@
99
99
  "@azure/core-util": "^1.11.0",
100
100
  "@azure/core-xml": "^1.4.3",
101
101
  "@azure/logger": "^1.1.4",
102
- "@azure/storage-blob": ">=12.28.0-alpha <12.28.0-alphb",
103
102
  "@azure/storage-common": ">=12.0.0-alpha <12.0.0-alphb",
104
103
  "events": "^3.0.0",
105
104
  "tslib": "^2.8.1"
@@ -109,6 +108,7 @@
109
108
  "@azure-tools/test-perf": "^1.0.0",
110
109
  "@azure-tools/test-recorder": ">=4.1.0-alpha <4.1.0-alphb",
111
110
  "@azure-tools/test-utils-vitest": ">=1.0.0-alpha <1.0.0-alphb",
111
+ "@azure/storage-blob": ">=12.28.0-alpha <12.28.0-alphb",
112
112
  "@azure/dev-tool": ">=1.0.0-alpha <1.0.0-alphb",
113
113
  "@azure/eslint-plugin-azure-sdk": ">=3.0.0-alpha <3.0.0-alphb",
114
114
  "@azure/identity": "^4.7.0",
@@ -1,56 +0,0 @@
1
- import type { RequestPolicy, RequestPolicyOptionsLike as RequestPolicyOptions, RequestPolicyFactory } from "@azure/core-http-compat";
2
- import { StorageRetryPolicy, StorageRetryPolicyType } from "./policies/StorageRetryPolicy.js";
3
- export { StorageRetryPolicyType, StorageRetryPolicy };
4
- /**
5
- * Storage Blob retry options interface.
6
- */
7
- export interface StorageRetryOptions {
8
- /**
9
- * Optional. StorageRetryPolicyType, default is exponential retry policy.
10
- */
11
- readonly retryPolicyType?: StorageRetryPolicyType;
12
- /**
13
- * Optional. Max try number of attempts, default is 4.
14
- * A value of 1 means 1 try and no retries.
15
- * A value smaller than 1 means default retry number of attempts.
16
- */
17
- readonly maxTries?: number;
18
- /**
19
- * Optional. Indicates the maximum time in ms allowed for any single try of an HTTP request.
20
- * A value of zero or undefined means no default timeout on SDK client, Azure
21
- * Storage server's default timeout policy will be used.
22
- *
23
- * @see https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations
24
- */
25
- readonly tryTimeoutInMs?: number;
26
- /**
27
- * Optional. Specifies the amount of delay to use before retrying an operation (default is 4s or 4 * 1000ms).
28
- * The delay increases (exponentially or linearly) with each retry up to a maximum specified by
29
- * maxRetryDelayInMs. If you specify 0, then you must also specify 0 for maxRetryDelayInMs.
30
- */
31
- readonly retryDelayInMs?: number;
32
- /**
33
- * Optional. Specifies the maximum delay allowed before retrying an operation (default is 120s or 120 * 1000ms).
34
- * If you specify 0, then you must also specify 0 for retryDelayInMs.
35
- */
36
- readonly maxRetryDelayInMs?: number;
37
- }
38
- /**
39
- * StorageRetryPolicyFactory is a factory class helping generating {@link StorageRetryPolicy} objects.
40
- */
41
- export declare class StorageRetryPolicyFactory implements RequestPolicyFactory {
42
- private retryOptions?;
43
- /**
44
- * Creates an instance of StorageRetryPolicyFactory.
45
- * @param retryOptions -
46
- */
47
- constructor(retryOptions?: StorageRetryOptions);
48
- /**
49
- * Creates a StorageRetryPolicy object.
50
- *
51
- * @param nextPolicy -
52
- * @param options -
53
- */
54
- create(nextPolicy: RequestPolicy, options: RequestPolicyOptions): StorageRetryPolicy;
55
- }
56
- //# sourceMappingURL=StorageRetryPolicyFactory.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"StorageRetryPolicyFactory.d.ts","sourceRoot":"","sources":["../../src/StorageRetryPolicyFactory.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,aAAa,EACb,wBAAwB,IAAI,oBAAoB,EAChD,oBAAoB,EACrB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAE9F,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,CAAC;AAEtD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,sBAAsB,CAAC;IAElD;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAE3B;;;;;;OAMG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IAEjC;;;;OAIG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IAEjC;;;OAGG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;CACrC;AAED;;GAEG;AACH,qBAAa,yBAA0B,YAAW,oBAAoB;IACpE,OAAO,CAAC,YAAY,CAAC,CAAsB;IAE3C;;;OAGG;gBACS,YAAY,CAAC,EAAE,mBAAmB;IAI9C;;;;;OAKG;IACI,MAAM,CAAC,UAAU,EAAE,aAAa,EAAE,OAAO,EAAE,oBAAoB,GAAG,kBAAkB;CAG5F"}
@@ -1,26 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT License.
3
- import { StorageRetryPolicy, StorageRetryPolicyType } from "./policies/StorageRetryPolicy.js";
4
- export { StorageRetryPolicyType, StorageRetryPolicy };
5
- /**
6
- * StorageRetryPolicyFactory is a factory class helping generating {@link StorageRetryPolicy} objects.
7
- */
8
- export class StorageRetryPolicyFactory {
9
- /**
10
- * Creates an instance of StorageRetryPolicyFactory.
11
- * @param retryOptions -
12
- */
13
- constructor(retryOptions) {
14
- this.retryOptions = retryOptions;
15
- }
16
- /**
17
- * Creates a StorageRetryPolicy object.
18
- *
19
- * @param nextPolicy -
20
- * @param options -
21
- */
22
- create(nextPolicy, options) {
23
- return new StorageRetryPolicy(nextPolicy, options, this.retryOptions);
24
- }
25
- }
26
- //# sourceMappingURL=StorageRetryPolicyFactory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"StorageRetryPolicyFactory.js","sourceRoot":"","sources":["../../src/StorageRetryPolicyFactory.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAOlC,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAE9F,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,CAAC;AAyCtD;;GAEG;AACH,MAAM,OAAO,yBAAyB;IAGpC;;;OAGG;IACH,YAAY,YAAkC;QAC5C,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,UAAyB,EAAE,OAA6B;QACpE,OAAO,IAAI,kBAAkB,CAAC,UAAU,EAAE,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;IACxE,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n RequestPolicy,\n RequestPolicyOptionsLike as RequestPolicyOptions,\n RequestPolicyFactory,\n} from \"@azure/core-http-compat\";\nimport { StorageRetryPolicy, StorageRetryPolicyType } from \"./policies/StorageRetryPolicy.js\";\n\nexport { StorageRetryPolicyType, StorageRetryPolicy };\n\n/**\n * Storage Blob retry options interface.\n */\nexport interface StorageRetryOptions {\n /**\n * Optional. StorageRetryPolicyType, default is exponential retry policy.\n */\n readonly retryPolicyType?: StorageRetryPolicyType;\n\n /**\n * Optional. Max try number of attempts, default is 4.\n * A value of 1 means 1 try and no retries.\n * A value smaller than 1 means default retry number of attempts.\n */\n readonly maxTries?: number;\n\n /**\n * Optional. Indicates the maximum time in ms allowed for any single try of an HTTP request.\n * A value of zero or undefined means no default timeout on SDK client, Azure\n * Storage server's default timeout policy will be used.\n *\n * @see https://learn.microsoft.com/rest/api/storageservices/setting-timeouts-for-blob-service-operations\n */\n readonly tryTimeoutInMs?: number;\n\n /**\n * Optional. Specifies the amount of delay to use before retrying an operation (default is 4s or 4 * 1000ms).\n * The delay increases (exponentially or linearly) with each retry up to a maximum specified by\n * maxRetryDelayInMs. If you specify 0, then you must also specify 0 for maxRetryDelayInMs.\n */\n readonly retryDelayInMs?: number;\n\n /**\n * Optional. Specifies the maximum delay allowed before retrying an operation (default is 120s or 120 * 1000ms).\n * If you specify 0, then you must also specify 0 for retryDelayInMs.\n */\n readonly maxRetryDelayInMs?: number;\n}\n\n/**\n * StorageRetryPolicyFactory is a factory class helping generating {@link StorageRetryPolicy} objects.\n */\nexport class StorageRetryPolicyFactory implements RequestPolicyFactory {\n private retryOptions?: StorageRetryOptions;\n\n /**\n * Creates an instance of StorageRetryPolicyFactory.\n * @param retryOptions -\n */\n constructor(retryOptions?: StorageRetryOptions) {\n this.retryOptions = retryOptions;\n }\n\n /**\n * Creates a StorageRetryPolicy object.\n *\n * @param nextPolicy -\n * @param options -\n */\n public create(nextPolicy: RequestPolicy, options: RequestPolicyOptions): StorageRetryPolicy {\n return new StorageRetryPolicy(nextPolicy, options, this.retryOptions);\n }\n}\n"]}
@@ -1,75 +0,0 @@
1
- import type { RequestPolicy, RequestPolicyOptionsLike as RequestPolicyOptions, RequestPolicyFactory, WebResourceLike as WebResource, CompatResponse as HttpOperationResponse } from "@azure/core-http-compat";
2
- import { BaseRequestPolicy } from "@azure/storage-blob";
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
- * RetryPolicy types.
13
- */
14
- export declare enum StorageRetryPolicyType {
15
- /**
16
- * Exponential retry. Retry time delay grows exponentially.
17
- */
18
- EXPONENTIAL = 0,
19
- /**
20
- * Linear retry. Retry time delay grows linearly.
21
- */
22
- FIXED = 1
23
- }
24
- /**
25
- * Retry policy with exponential retry and linear retry implemented.
26
- */
27
- export declare class StorageRetryPolicy extends BaseRequestPolicy {
28
- /**
29
- * RetryOptions.
30
- */
31
- private readonly retryOptions;
32
- /**
33
- * Creates an instance of RetryPolicy.
34
- *
35
- * @param nextPolicy -
36
- * @param options -
37
- * @param retryOptions -
38
- */
39
- constructor(nextPolicy: RequestPolicy, options: RequestPolicyOptions, retryOptions?: StorageRetryOptions);
40
- /**
41
- * Sends request.
42
- *
43
- * @param request -
44
- */
45
- sendRequest(request: WebResource): Promise<HttpOperationResponse>;
46
- /**
47
- * Decide and perform next retry. Won't mutate request parameter.
48
- *
49
- * @param request -
50
- * @param secondaryHas404 - If attempt was against the secondary & it returned a StatusNotFound (404), then
51
- * the resource was not found. This may be due to replication delay. So, in this
52
- * case, we'll never try the secondary again for this operation.
53
- * @param attempt - How many retries has been attempted to performed, starting from 1, which includes
54
- * the attempt will be performed by this method call.
55
- */
56
- protected attemptSendRequest(request: WebResource, secondaryHas404: boolean, attempt: number): Promise<HttpOperationResponse>;
57
- /**
58
- * Decide whether to retry according to last HTTP response and retry counters.
59
- *
60
- * @param isPrimaryRetry -
61
- * @param attempt -
62
- * @param response -
63
- * @param err -
64
- */
65
- protected shouldRetry(isPrimaryRetry: boolean, attempt: number, response?: HttpOperationResponse, err?: RestError): boolean;
66
- /**
67
- * Delay a calculated time between retries.
68
- *
69
- * @param isPrimaryRetry -
70
- * @param attempt -
71
- * @param abortSignal -
72
- */
73
- private delay;
74
- }
75
- //# sourceMappingURL=StorageRetryPolicy.d.ts.map
@@ -1 +0,0 @@
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,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAE3D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAK3E;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,YAAY,CAAC,EAAE,mBAAmB,GAAG,oBAAoB,CAM9F;AAED;;GAEG;AACH,oBAAY,sBAAsB;IAChC;;OAEG;IACH,WAAW,IAAA;IACX;;OAEG;IACH,KAAK,IAAA;CACN;AAaD;;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;IAqC3D;;;;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;IAkCjC;;;;;;;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;IA+EV;;;;;;OAMG;YACW,KAAK;CA0BpB"}
@@ -1,220 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT License.
3
- import { AbortError } from "@azure/abort-controller";
4
- import { BaseRequestPolicy } from "@azure/storage-blob";
5
- import { URLConstants } from "../utils/constants.js";
6
- import { delay, setURLParameter } from "../utils/utils.common.js";
7
- import { logger } from "../log.js";
8
- /**
9
- * A factory method used to generated a RetryPolicy factory.
10
- *
11
- * @param retryOptions -
12
- */
13
- export function NewRetryPolicyFactory(retryOptions) {
14
- return {
15
- create: (nextPolicy, options) => {
16
- return new StorageRetryPolicy(nextPolicy, options, retryOptions);
17
- },
18
- };
19
- }
20
- /**
21
- * RetryPolicy types.
22
- */
23
- export var StorageRetryPolicyType;
24
- (function (StorageRetryPolicyType) {
25
- /**
26
- * Exponential retry. Retry time delay grows exponentially.
27
- */
28
- StorageRetryPolicyType[StorageRetryPolicyType["EXPONENTIAL"] = 0] = "EXPONENTIAL";
29
- /**
30
- * Linear retry. Retry time delay grows linearly.
31
- */
32
- StorageRetryPolicyType[StorageRetryPolicyType["FIXED"] = 1] = "FIXED";
33
- })(StorageRetryPolicyType || (StorageRetryPolicyType = {}));
34
- // Default values of StorageRetryOptions
35
- const DEFAULT_RETRY_OPTIONS = {
36
- maxRetryDelayInMs: 120 * 1000,
37
- maxTries: 4,
38
- retryDelayInMs: 4 * 1000,
39
- retryPolicyType: StorageRetryPolicyType.EXPONENTIAL,
40
- tryTimeoutInMs: undefined, // Use server side default timeout strategy
41
- };
42
- const RETRY_ABORT_ERROR = new AbortError("The operation was aborted.");
43
- /**
44
- * Retry policy with exponential retry and linear retry implemented.
45
- */
46
- export class StorageRetryPolicy extends BaseRequestPolicy {
47
- /**
48
- * Creates an instance of RetryPolicy.
49
- *
50
- * @param nextPolicy -
51
- * @param options -
52
- * @param retryOptions -
53
- */
54
- constructor(nextPolicy, options, retryOptions = DEFAULT_RETRY_OPTIONS) {
55
- super(nextPolicy, options);
56
- // Initialize retry options
57
- this.retryOptions = {
58
- retryPolicyType: retryOptions.retryPolicyType
59
- ? retryOptions.retryPolicyType
60
- : DEFAULT_RETRY_OPTIONS.retryPolicyType,
61
- maxTries: retryOptions.maxTries && retryOptions.maxTries >= 1
62
- ? Math.floor(retryOptions.maxTries)
63
- : DEFAULT_RETRY_OPTIONS.maxTries,
64
- tryTimeoutInMs: retryOptions.tryTimeoutInMs && retryOptions.tryTimeoutInMs >= 0
65
- ? retryOptions.tryTimeoutInMs
66
- : DEFAULT_RETRY_OPTIONS.tryTimeoutInMs,
67
- retryDelayInMs: retryOptions.retryDelayInMs && retryOptions.retryDelayInMs >= 0
68
- ? Math.min(retryOptions.retryDelayInMs, retryOptions.maxRetryDelayInMs
69
- ? retryOptions.maxRetryDelayInMs
70
- : DEFAULT_RETRY_OPTIONS.maxRetryDelayInMs)
71
- : DEFAULT_RETRY_OPTIONS.retryDelayInMs,
72
- maxRetryDelayInMs: retryOptions.maxRetryDelayInMs && retryOptions.maxRetryDelayInMs >= 0
73
- ? retryOptions.maxRetryDelayInMs
74
- : DEFAULT_RETRY_OPTIONS.maxRetryDelayInMs,
75
- };
76
- }
77
- /**
78
- * Sends request.
79
- *
80
- * @param request -
81
- */
82
- async sendRequest(request) {
83
- return this.attemptSendRequest(request, false, 1);
84
- }
85
- /**
86
- * Decide and perform next retry. Won't mutate request parameter.
87
- *
88
- * @param request -
89
- * @param secondaryHas404 - If attempt was against the secondary & it returned a StatusNotFound (404), then
90
- * the resource was not found. This may be due to replication delay. So, in this
91
- * case, we'll never try the secondary again for this operation.
92
- * @param attempt - How many retries has been attempted to performed, starting from 1, which includes
93
- * the attempt will be performed by this method call.
94
- */
95
- async attemptSendRequest(request, secondaryHas404, attempt) {
96
- const newRequest = request.clone();
97
- const isPrimaryRetry = true;
98
- // Set the server-side timeout query parameter "timeout=[seconds]"
99
- if (this.retryOptions.tryTimeoutInMs) {
100
- newRequest.url = setURLParameter(newRequest.url, URLConstants.Parameters.TIMEOUT, Math.floor(this.retryOptions.tryTimeoutInMs / 1000).toString());
101
- }
102
- let response;
103
- try {
104
- logger.info(`RetryPolicy: =====> Try=${attempt} ${isPrimaryRetry ? "Primary" : "Secondary"}`);
105
- response = await this._nextPolicy.sendRequest(newRequest);
106
- if (!this.shouldRetry(isPrimaryRetry, attempt, response)) {
107
- return response;
108
- }
109
- secondaryHas404 = secondaryHas404 || (!isPrimaryRetry && response.status === 404);
110
- }
111
- catch (err) {
112
- logger.error(`RetryPolicy: Caught error, message: ${err.message}, code: ${err.code}`);
113
- if (!this.shouldRetry(isPrimaryRetry, attempt, response, err)) {
114
- throw err;
115
- }
116
- }
117
- await this.delay(isPrimaryRetry, attempt, request.abortSignal);
118
- return this.attemptSendRequest(request, secondaryHas404, ++attempt);
119
- }
120
- /**
121
- * Decide whether to retry according to last HTTP response and retry counters.
122
- *
123
- * @param isPrimaryRetry -
124
- * @param attempt -
125
- * @param response -
126
- * @param err -
127
- */
128
- shouldRetry(isPrimaryRetry, attempt, response, err) {
129
- if (attempt >= this.retryOptions.maxTries) {
130
- logger.info(`RetryPolicy: Attempt(s) ${attempt} >= maxTries ${this.retryOptions
131
- .maxTries}, no further try.`);
132
- return false;
133
- }
134
- // Handle network failures, you may need to customize the list when you implement
135
- // your own http client
136
- const retriableErrors = [
137
- "ETIMEDOUT",
138
- "ESOCKETTIMEDOUT",
139
- "ECONNREFUSED",
140
- "ECONNRESET",
141
- "ENOENT",
142
- "ENOTFOUND",
143
- "TIMEOUT",
144
- "EPIPE",
145
- "REQUEST_SEND_ERROR", // For default xhr based http client provided in ms-rest-js
146
- ];
147
- if (err) {
148
- for (const retriableError of retriableErrors) {
149
- if (err.name.toUpperCase().includes(retriableError) ||
150
- err.message.toUpperCase().includes(retriableError) ||
151
- (err.code && err.code.toString().toUpperCase() === retriableError)) {
152
- logger.info(`RetryPolicy: Network error ${retriableError} found, will retry.`);
153
- return true;
154
- }
155
- }
156
- }
157
- // If attempt was against the secondary & it returned a StatusNotFound (404), then
158
- // the resource was not found. This may be due to replication delay. So, in this
159
- // case, we'll never try the secondary again for this operation.
160
- if (response || err) {
161
- const statusCode = response ? response.status : err ? err.statusCode : 0;
162
- if (!isPrimaryRetry && statusCode === 404) {
163
- logger.info(`RetryPolicy: Secondary access with 404, will retry.`);
164
- return true;
165
- }
166
- // Server internal error or server timeout
167
- if (statusCode === 503 || statusCode === 500) {
168
- logger.info(`RetryPolicy: Will retry for status code ${statusCode}.`);
169
- return true;
170
- }
171
- }
172
- // [Copy source error code] Feature is pending on service side, skip retry on copy source error for now.
173
- // if (response) {
174
- // // Retry select Copy Source Error Codes.
175
- // if (response?.status >= 400) {
176
- // const copySourceError = response.headers.get(HeaderConstants.X_MS_CopySourceErrorCode);
177
- // if (copySourceError !== undefined) {
178
- // switch (copySourceError)
179
- // {
180
- // case "InternalError":
181
- // case "OperationTimedOut":
182
- // case "ServerBusy":
183
- // return true;
184
- // }
185
- // }
186
- // }
187
- // }
188
- if ((err === null || err === void 0 ? void 0 : err.code) === "PARSE_ERROR" && (err === null || err === void 0 ? void 0 : 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
@@ -1 +0,0 @@
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,qBAAqB,CAAC;AAIxD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC;;;;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;;GAEG;AACH,MAAM,CAAN,IAAY,sBASX;AATD,WAAY,sBAAsB;IAChC;;OAEG;IACH,iFAAW,CAAA;IACX;;OAEG;IACH,qEAAK,CAAA;AACP,CAAC,EATW,sBAAsB,KAAtB,sBAAsB,QASjC;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,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ACjB,cAAuB,EACvB,OAAe,EACf,WAA6B;QAE7B,IAAI,aAAa,GAAW,CAAC,CAAC;QAE9B,IAAI,cAAc,EAAE,CAAC;YACnB,QAAQ,IAAI,CAAC,YAAY,CAAC,eAAe,EAAE,CAAC;gBAC1C,KAAK,sBAAsB,CAAC,WAAW;oBACrC,aAAa,GAAG,IAAI,CAAC,GAAG,CACtB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC,cAAe,EAClE,IAAI,CAAC,YAAY,CAAC,iBAAkB,CACrC,CAAC;oBACF,MAAM;gBACR,KAAK,sBAAsB,CAAC,KAAK;oBAC/B,aAAa,GAAG,IAAI,CAAC,YAAY,CAAC,cAAe,CAAC;oBAClD,MAAM;YACV,CAAC;QACH,CAAC;aAAM,CAAC;YACN,aAAa,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC;QACvC,CAAC;QAED,MAAM,CAAC,IAAI,CAAC,0BAA0B,aAAa,IAAI,CAAC,CAAC;QACzD,OAAO,KAAK,CAAC,aAAa,EAAE,WAAW,EAAE,iBAAiB,CAAC,CAAC;IAC9D,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// 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 \"@azure/storage-blob\";\nimport type { RestError } from \"@azure/core-rest-pipeline\";\n\nimport type { StorageRetryOptions } from \"../StorageRetryPolicyFactory.js\";\nimport { URLConstants } from \"../utils/constants.js\";\nimport { delay, setURLParameter } from \"../utils/utils.common.js\";\nimport { logger } from \"../log.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/**\n * RetryPolicy types.\n */\nexport enum StorageRetryPolicyType {\n /**\n * Exponential retry. Retry time delay grows exponentially.\n */\n EXPONENTIAL,\n /**\n * Linear retry. Retry time delay grows linearly.\n */\n FIXED,\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 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 }\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 = true;\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 // {\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"]}
@@ -1,24 +0,0 @@
1
- import type { PipelinePolicy } from "@azure/core-rest-pipeline";
2
- import type { StorageRetryOptions } from "../StorageRetryPolicyFactory.js";
3
- /**
4
- * Name of the {@link storageRetryPolicy}
5
- */
6
- export declare const storageRetryPolicyName = "storageRetryPolicy";
7
- /**
8
- * RetryPolicy types.
9
- */
10
- export declare enum StorageRetryPolicyType {
11
- /**
12
- * Exponential retry. Retry time delay grows exponentially.
13
- */
14
- EXPONENTIAL = 0,
15
- /**
16
- * Linear retry. Retry time delay grows linearly.
17
- */
18
- FIXED = 1
19
- }
20
- /**
21
- * Retry policy with exponential retry and linear retry implemented.
22
- */
23
- export declare function storageRetryPolicy(options?: StorageRetryOptions): PipelinePolicy;
24
- //# sourceMappingURL=StorageRetryPolicyV2.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"StorageRetryPolicyV2.d.ts","sourceRoot":"","sources":["../../../src/policies/StorageRetryPolicyV2.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,cAAc,EAIf,MAAM,2BAA2B,CAAC;AAGnC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAK3E;;GAEG;AACH,eAAO,MAAM,sBAAsB,uBAAuB,CAAC;AAE3D;;GAEG;AACH,oBAAY,sBAAsB;IAChC;;OAEG;IACH,WAAW,IAAA;IACX;;OAEG;IACH,KAAK,IAAA;CACN;AA0BD;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,GAAE,mBAAwB,GAAG,cAAc,CA0JpF"}