@azure/storage-file-share 12.27.0 → 12.28.0-beta.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 (998) hide show
  1. package/README.md +105 -155
  2. package/dist/browser/AccountSASPermissions.d.ts +61 -0
  3. package/dist/browser/AccountSASPermissions.d.ts.map +1 -0
  4. package/dist/browser/AccountSASPermissions.js.map +1 -0
  5. package/dist/browser/AccountSASResourceTypes.d.ts +38 -0
  6. package/dist/browser/AccountSASResourceTypes.d.ts.map +1 -0
  7. package/dist/browser/AccountSASResourceTypes.js.map +1 -0
  8. package/dist/browser/AccountSASServices.d.ts +40 -0
  9. package/dist/browser/AccountSASServices.d.ts.map +1 -0
  10. package/dist/browser/AccountSASServices.js.map +1 -0
  11. package/dist/browser/AccountSASSignatureValues.d.ts +73 -0
  12. package/dist/browser/AccountSASSignatureValues.d.ts.map +1 -0
  13. package/dist/browser/AccountSASSignatureValues.js +71 -0
  14. package/dist/browser/AccountSASSignatureValues.js.map +1 -0
  15. package/dist/browser/Clients.d.ts +3114 -0
  16. package/dist/browser/Clients.d.ts.map +1 -0
  17. package/dist/browser/Clients.js +2882 -0
  18. package/dist/browser/Clients.js.map +1 -0
  19. package/dist/browser/FileDownloadResponse-browser.d.mts.map +1 -0
  20. package/dist/browser/FileDownloadResponse-browser.mjs.map +1 -0
  21. package/dist/browser/FileDownloadResponse.d.ts +2 -0
  22. package/dist/browser/FileDownloadResponse.js +7 -0
  23. package/dist/browser/FileSASPermissions.d.ts +42 -0
  24. package/dist/browser/FileSASPermissions.d.ts.map +1 -0
  25. package/dist/browser/FileSASPermissions.js.map +1 -0
  26. package/dist/browser/FileSASSignatureValues.d.ts +95 -0
  27. package/dist/browser/FileSASSignatureValues.d.ts.map +1 -0
  28. package/dist/browser/FileSASSignatureValues.js +84 -0
  29. package/dist/browser/FileSASSignatureValues.js.map +1 -0
  30. package/dist/browser/FileSystemAttributes.d.ts +63 -0
  31. package/dist/browser/FileSystemAttributes.d.ts.map +1 -0
  32. package/dist/browser/FileSystemAttributes.js.map +1 -0
  33. package/dist/browser/Pipeline.d.ts +142 -0
  34. package/dist/browser/Pipeline.d.ts.map +1 -0
  35. package/dist/browser/Pipeline.js +261 -0
  36. package/dist/browser/Pipeline.js.map +1 -0
  37. package/dist/browser/Range.d.ts +25 -0
  38. package/dist/browser/Range.d.ts.map +1 -0
  39. package/dist/browser/Range.js.map +1 -0
  40. package/dist/browser/SASQueryParameters.d.ts +136 -0
  41. package/dist/browser/SASQueryParameters.d.ts.map +1 -0
  42. package/dist/browser/SASQueryParameters.js +177 -0
  43. package/dist/browser/SASQueryParameters.js.map +1 -0
  44. package/dist/browser/SasIPRange.d.ts +25 -0
  45. package/dist/browser/SasIPRange.d.ts.map +1 -0
  46. package/dist/browser/SasIPRange.js.map +1 -0
  47. package/dist/browser/ShareClientInternal.d.ts +12 -0
  48. package/dist/browser/ShareClientInternal.d.ts.map +1 -0
  49. package/dist/browser/ShareClientInternal.js +16 -0
  50. package/dist/browser/ShareClientInternal.js.map +1 -0
  51. package/dist/browser/ShareSASPermissions.d.ts +46 -0
  52. package/dist/browser/ShareSASPermissions.d.ts.map +1 -0
  53. package/dist/browser/ShareSASPermissions.js.map +1 -0
  54. package/dist/browser/ShareServiceClient.d.ts +427 -0
  55. package/dist/browser/ShareServiceClient.d.ts.map +1 -0
  56. package/dist/browser/ShareServiceClient.js +475 -0
  57. package/dist/browser/ShareServiceClient.js.map +1 -0
  58. package/dist/browser/StorageClient.d.ts +47 -0
  59. package/dist/browser/StorageClient.d.ts.map +1 -0
  60. package/dist/browser/StorageClient.js +30 -0
  61. package/dist/browser/StorageClient.js.map +1 -0
  62. package/dist/browser/StorageContextClient.d.ts +9 -0
  63. package/dist/browser/StorageContextClient.d.ts.map +1 -0
  64. package/dist/browser/StorageContextClient.js +18 -0
  65. package/dist/browser/StorageContextClient.js.map +1 -0
  66. package/dist/browser/StorageRetryPolicyFactory.d.ts +56 -0
  67. package/dist/browser/StorageRetryPolicyFactory.d.ts.map +1 -0
  68. package/dist/browser/StorageRetryPolicyFactory.js +26 -0
  69. package/dist/browser/StorageRetryPolicyFactory.js.map +1 -0
  70. package/dist/browser/generated/src/index.d.ts +4 -0
  71. package/dist/browser/generated/src/index.d.ts.map +1 -0
  72. package/dist/browser/generated/src/index.js +11 -0
  73. package/dist/browser/generated/src/index.js.map +1 -0
  74. package/dist/browser/generated/src/models/index.d.ts +2881 -0
  75. package/dist/browser/generated/src/models/index.d.ts.map +1 -0
  76. package/dist/browser/generated/src/models/index.js.map +1 -0
  77. package/dist/browser/generated/src/models/mappers.d.ts +128 -0
  78. package/dist/browser/generated/src/models/mappers.d.ts.map +1 -0
  79. package/dist/browser/generated/src/models/mappers.js.map +1 -0
  80. package/dist/browser/generated/src/models/parameters.d.ts +128 -0
  81. package/dist/browser/generated/src/models/parameters.d.ts.map +1 -0
  82. package/dist/browser/generated/src/models/parameters.js +1364 -0
  83. package/dist/browser/generated/src/models/parameters.js.map +1 -0
  84. package/dist/browser/generated/src/operations/directory.d.ts +65 -0
  85. package/dist/browser/generated/src/operations/directory.d.ts.map +1 -0
  86. package/dist/browser/generated/src/operations/directory.js +378 -0
  87. package/dist/browser/generated/src/operations/directory.js.map +1 -0
  88. package/dist/browser/generated/src/operations/file.d.ts +162 -0
  89. package/dist/browser/generated/src/operations/file.d.ts.map +1 -0
  90. package/dist/browser/generated/src/operations/file.js +866 -0
  91. package/dist/browser/generated/src/operations/file.js.map +1 -0
  92. package/dist/browser/generated/src/operations/index.d.ts +5 -0
  93. package/dist/browser/generated/src/operations/index.d.ts.map +1 -0
  94. package/dist/browser/generated/src/operations/index.js +12 -0
  95. package/dist/browser/generated/src/operations/index.js.map +1 -0
  96. package/dist/browser/generated/src/operations/service.d.ts +32 -0
  97. package/dist/browser/generated/src/operations/service.d.ts.map +1 -0
  98. package/dist/browser/generated/src/operations/service.js +135 -0
  99. package/dist/browser/generated/src/operations/service.js.map +1 -0
  100. package/dist/browser/generated/src/operations/share.d.ts +111 -0
  101. package/dist/browser/generated/src/operations/share.d.ts.map +1 -0
  102. package/dist/browser/generated/src/operations/share.js +671 -0
  103. package/dist/browser/generated/src/operations/share.js.map +1 -0
  104. package/dist/browser/generated/src/operationsInterfaces/directory.d.ts +57 -0
  105. package/dist/browser/generated/src/operationsInterfaces/directory.d.ts.map +1 -0
  106. package/dist/browser/generated/src/operationsInterfaces/directory.js.map +1 -0
  107. package/dist/browser/generated/src/operationsInterfaces/file.d.ts +154 -0
  108. package/dist/browser/generated/src/operationsInterfaces/file.d.ts.map +1 -0
  109. package/dist/browser/generated/src/operationsInterfaces/file.js.map +1 -0
  110. package/dist/browser/generated/src/operationsInterfaces/index.d.ts +5 -0
  111. package/dist/browser/generated/src/operationsInterfaces/index.d.ts.map +1 -0
  112. package/dist/browser/generated/src/operationsInterfaces/index.js +12 -0
  113. package/dist/browser/generated/src/operationsInterfaces/index.js.map +1 -0
  114. package/dist/browser/generated/src/operationsInterfaces/service.d.ts +24 -0
  115. package/dist/browser/generated/src/operationsInterfaces/service.d.ts.map +1 -0
  116. package/dist/browser/generated/src/operationsInterfaces/service.js.map +1 -0
  117. package/dist/browser/generated/src/operationsInterfaces/share.d.ts +103 -0
  118. package/dist/browser/generated/src/operationsInterfaces/share.d.ts.map +1 -0
  119. package/dist/browser/generated/src/operationsInterfaces/share.js.map +1 -0
  120. package/dist/browser/generated/src/storageClient.d.ts +20 -0
  121. package/dist/browser/generated/src/storageClient.d.ts.map +1 -0
  122. package/dist/browser/generated/src/storageClient.js +48 -0
  123. package/dist/browser/generated/src/storageClient.js.map +1 -0
  124. package/dist/browser/generatedModels.d.ts +492 -0
  125. package/dist/browser/generatedModels.d.ts.map +1 -0
  126. package/dist/browser/generatedModels.js.map +1 -0
  127. package/dist/browser/index-browser.d.mts.map +1 -0
  128. package/dist/browser/index-browser.mjs.map +1 -0
  129. package/dist/browser/index.d.ts +22 -0
  130. package/dist/browser/index.js +19 -0
  131. package/dist/browser/log.d.ts +5 -0
  132. package/dist/browser/log.d.ts.map +1 -0
  133. package/dist/browser/log.js.map +1 -0
  134. package/dist/browser/models.d.ts +373 -0
  135. package/dist/browser/models.d.ts.map +1 -0
  136. package/dist/browser/models.js +94 -0
  137. package/dist/browser/models.js.map +1 -0
  138. package/dist/browser/package.json +3 -0
  139. package/dist/browser/policies/StorageRetryPolicy.d.ts +75 -0
  140. package/dist/browser/policies/StorageRetryPolicy.d.ts.map +1 -0
  141. package/dist/browser/policies/StorageRetryPolicy.js +220 -0
  142. package/dist/browser/policies/StorageRetryPolicy.js.map +1 -0
  143. package/dist/browser/policies/StorageRetryPolicyV2.d.ts +24 -0
  144. package/dist/browser/policies/StorageRetryPolicyV2.d.ts.map +1 -0
  145. package/dist/browser/policies/StorageRetryPolicyV2.js +176 -0
  146. package/dist/browser/policies/StorageRetryPolicyV2.js.map +1 -0
  147. package/dist/browser/utils/Batch.d.ts +68 -0
  148. package/dist/browser/utils/Batch.d.ts.map +1 -0
  149. package/dist/browser/utils/Batch.js.map +1 -0
  150. package/dist/browser/utils/BufferScheduler.d.ts +157 -0
  151. package/dist/browser/utils/BufferScheduler.d.ts.map +1 -0
  152. package/dist/browser/utils/BufferScheduler.js.map +1 -0
  153. package/dist/browser/utils/RetriableReadableStream.d.ts +58 -0
  154. package/dist/browser/utils/RetriableReadableStream.d.ts.map +1 -0
  155. package/dist/browser/utils/RetriableReadableStream.js +119 -0
  156. package/dist/browser/utils/RetriableReadableStream.js.map +1 -0
  157. package/dist/browser/utils/constants.d.ts +55 -0
  158. package/dist/browser/utils/constants.d.ts.map +1 -0
  159. package/dist/browser/utils/constants.js +162 -0
  160. package/dist/browser/utils/constants.js.map +1 -0
  161. package/dist/browser/utils/tracing.d.ts +6 -0
  162. package/dist/browser/utils/tracing.d.ts.map +1 -0
  163. package/dist/browser/utils/tracing.js +14 -0
  164. package/dist/browser/utils/tracing.js.map +1 -0
  165. package/dist/browser/utils/utils-browser.d.mts.map +1 -0
  166. package/dist/browser/utils/utils-browser.mjs.map +1 -0
  167. package/dist/browser/utils/utils.common.d.ts +304 -0
  168. package/dist/browser/utils/utils.common.d.ts.map +1 -0
  169. package/dist/browser/utils/utils.common.js +778 -0
  170. package/dist/browser/utils/utils.common.js.map +1 -0
  171. package/dist/browser/utils/utils.d.ts +5 -0
  172. package/dist/browser/utils/utils.js +15 -0
  173. package/dist/commonjs/AccountSASPermissions.d.ts +61 -0
  174. package/dist/commonjs/AccountSASPermissions.d.ts.map +1 -0
  175. package/dist/commonjs/AccountSASPermissions.js +132 -0
  176. package/dist/commonjs/AccountSASPermissions.js.map +1 -0
  177. package/dist/commonjs/AccountSASResourceTypes.d.ts +38 -0
  178. package/dist/commonjs/AccountSASResourceTypes.d.ts.map +1 -0
  179. package/dist/commonjs/AccountSASResourceTypes.js +76 -0
  180. package/dist/commonjs/AccountSASResourceTypes.js.map +1 -0
  181. package/dist/commonjs/AccountSASServices.d.ts +40 -0
  182. package/dist/commonjs/AccountSASServices.d.ts.map +1 -0
  183. package/dist/commonjs/AccountSASServices.js +84 -0
  184. package/dist/commonjs/AccountSASServices.js.map +1 -0
  185. package/dist/commonjs/AccountSASSignatureValues.d.ts +73 -0
  186. package/dist/commonjs/AccountSASSignatureValues.d.ts.map +1 -0
  187. package/dist/commonjs/AccountSASSignatureValues.js +75 -0
  188. package/dist/commonjs/AccountSASSignatureValues.js.map +1 -0
  189. package/dist/commonjs/Clients.d.ts +3114 -0
  190. package/dist/commonjs/Clients.d.ts.map +1 -0
  191. package/dist/commonjs/Clients.js +2889 -0
  192. package/dist/commonjs/Clients.js.map +1 -0
  193. package/dist/commonjs/FileDownloadResponse.d.ts +291 -0
  194. package/dist/commonjs/FileDownloadResponse.d.ts.map +1 -0
  195. package/dist/commonjs/FileDownloadResponse.js +371 -0
  196. package/dist/commonjs/FileDownloadResponse.js.map +1 -0
  197. package/dist/commonjs/FileSASPermissions.d.ts +42 -0
  198. package/dist/commonjs/FileSASPermissions.d.ts.map +1 -0
  199. package/dist/commonjs/FileSASPermissions.js +86 -0
  200. package/dist/commonjs/FileSASPermissions.js.map +1 -0
  201. package/dist/commonjs/FileSASSignatureValues.d.ts +95 -0
  202. package/dist/commonjs/FileSASSignatureValues.d.ts.map +1 -0
  203. package/dist/commonjs/FileSASSignatureValues.js +88 -0
  204. package/dist/commonjs/FileSASSignatureValues.js.map +1 -0
  205. package/dist/commonjs/FileSystemAttributes.d.ts +63 -0
  206. package/dist/commonjs/FileSystemAttributes.d.ts.map +1 -0
  207. package/dist/commonjs/FileSystemAttributes.js +148 -0
  208. package/dist/commonjs/FileSystemAttributes.js.map +1 -0
  209. package/dist/commonjs/Pipeline.d.ts +142 -0
  210. package/dist/commonjs/Pipeline.d.ts.map +1 -0
  211. package/dist/commonjs/Pipeline.js +267 -0
  212. package/dist/commonjs/Pipeline.js.map +1 -0
  213. package/dist/commonjs/Range.d.ts +25 -0
  214. package/dist/commonjs/Range.d.ts.map +1 -0
  215. package/dist/commonjs/Range.js +25 -0
  216. package/dist/commonjs/Range.js.map +1 -0
  217. package/dist/commonjs/SASQueryParameters.d.ts +136 -0
  218. package/dist/commonjs/SASQueryParameters.d.ts.map +1 -0
  219. package/dist/commonjs/SASQueryParameters.js +181 -0
  220. package/dist/commonjs/SASQueryParameters.js.map +1 -0
  221. package/dist/commonjs/SasIPRange.d.ts +25 -0
  222. package/dist/commonjs/SasIPRange.d.ts.map +1 -0
  223. package/dist/commonjs/SasIPRange.js +17 -0
  224. package/dist/commonjs/SasIPRange.js.map +1 -0
  225. package/dist/commonjs/ShareClientInternal.d.ts +12 -0
  226. package/dist/commonjs/ShareClientInternal.d.ts.map +1 -0
  227. package/dist/commonjs/ShareClientInternal.js +20 -0
  228. package/dist/commonjs/ShareClientInternal.js.map +1 -0
  229. package/dist/commonjs/ShareSASPermissions.d.ts +46 -0
  230. package/dist/commonjs/ShareSASPermissions.d.ts.map +1 -0
  231. package/dist/commonjs/ShareSASPermissions.js +96 -0
  232. package/dist/commonjs/ShareSASPermissions.js.map +1 -0
  233. package/dist/commonjs/ShareServiceClient.d.ts +427 -0
  234. package/dist/commonjs/ShareServiceClient.d.ts.map +1 -0
  235. package/dist/commonjs/ShareServiceClient.js +479 -0
  236. package/dist/commonjs/ShareServiceClient.js.map +1 -0
  237. package/dist/commonjs/StorageClient.d.ts +47 -0
  238. package/dist/commonjs/StorageClient.d.ts.map +1 -0
  239. package/dist/commonjs/StorageClient.js +34 -0
  240. package/dist/commonjs/StorageClient.js.map +1 -0
  241. package/dist/commonjs/StorageContextClient.d.ts +9 -0
  242. package/dist/commonjs/StorageContextClient.d.ts.map +1 -0
  243. package/dist/commonjs/StorageContextClient.js +22 -0
  244. package/dist/commonjs/StorageContextClient.js.map +1 -0
  245. package/dist/commonjs/StorageRetryPolicyFactory.d.ts +56 -0
  246. package/dist/commonjs/StorageRetryPolicyFactory.d.ts.map +1 -0
  247. package/dist/commonjs/StorageRetryPolicyFactory.js +31 -0
  248. package/dist/commonjs/StorageRetryPolicyFactory.js.map +1 -0
  249. package/dist/commonjs/generated/src/index.d.ts +4 -0
  250. package/dist/commonjs/generated/src/index.d.ts.map +1 -0
  251. package/dist/commonjs/generated/src/index.js +16 -0
  252. package/dist/commonjs/generated/src/index.js.map +1 -0
  253. package/dist/commonjs/generated/src/models/index.d.ts +2881 -0
  254. package/dist/commonjs/generated/src/models/index.d.ts.map +1 -0
  255. package/dist/commonjs/generated/src/models/index.js +169 -0
  256. package/dist/commonjs/generated/src/models/index.js.map +1 -0
  257. package/dist/commonjs/generated/src/models/mappers.d.ts +128 -0
  258. package/dist/commonjs/generated/src/models/mappers.d.ts.map +1 -0
  259. package/dist/commonjs/generated/src/models/mappers.js +5992 -0
  260. package/dist/commonjs/generated/src/models/mappers.js.map +1 -0
  261. package/dist/commonjs/generated/src/models/parameters.d.ts +128 -0
  262. package/dist/commonjs/generated/src/models/parameters.d.ts.map +1 -0
  263. package/dist/commonjs/generated/src/models/parameters.js +1369 -0
  264. package/dist/commonjs/generated/src/models/parameters.js.map +1 -0
  265. package/dist/commonjs/generated/src/operations/directory.d.ts +65 -0
  266. package/dist/commonjs/generated/src/operations/directory.d.ts.map +1 -0
  267. package/dist/commonjs/generated/src/operations/directory.js +383 -0
  268. package/dist/commonjs/generated/src/operations/directory.js.map +1 -0
  269. package/dist/commonjs/generated/src/operations/file.d.ts +162 -0
  270. package/dist/commonjs/generated/src/operations/file.d.ts.map +1 -0
  271. package/dist/commonjs/generated/src/operations/file.js +871 -0
  272. package/dist/commonjs/generated/src/operations/file.js.map +1 -0
  273. package/dist/commonjs/generated/src/operations/index.d.ts +5 -0
  274. package/dist/commonjs/generated/src/operations/index.d.ts.map +1 -0
  275. package/dist/commonjs/generated/src/operations/index.js +15 -0
  276. package/dist/commonjs/generated/src/operations/index.js.map +1 -0
  277. package/dist/commonjs/generated/src/operations/service.d.ts +32 -0
  278. package/dist/commonjs/generated/src/operations/service.d.ts.map +1 -0
  279. package/dist/commonjs/generated/src/operations/service.js +140 -0
  280. package/dist/commonjs/generated/src/operations/service.js.map +1 -0
  281. package/dist/commonjs/generated/src/operations/share.d.ts +111 -0
  282. package/dist/commonjs/generated/src/operations/share.d.ts.map +1 -0
  283. package/dist/commonjs/generated/src/operations/share.js +676 -0
  284. package/dist/commonjs/generated/src/operations/share.js.map +1 -0
  285. package/dist/commonjs/generated/src/operationsInterfaces/directory.d.ts +57 -0
  286. package/dist/commonjs/generated/src/operationsInterfaces/directory.d.ts.map +1 -0
  287. package/dist/commonjs/generated/src/operationsInterfaces/directory.js +10 -0
  288. package/dist/commonjs/generated/src/operationsInterfaces/directory.js.map +1 -0
  289. package/dist/commonjs/generated/src/operationsInterfaces/file.d.ts +154 -0
  290. package/dist/commonjs/generated/src/operationsInterfaces/file.d.ts.map +1 -0
  291. package/dist/commonjs/generated/src/operationsInterfaces/file.js +10 -0
  292. package/dist/commonjs/generated/src/operationsInterfaces/file.js.map +1 -0
  293. package/dist/commonjs/generated/src/operationsInterfaces/index.d.ts +5 -0
  294. package/dist/commonjs/generated/src/operationsInterfaces/index.d.ts.map +1 -0
  295. package/dist/commonjs/generated/src/operationsInterfaces/index.js +15 -0
  296. package/dist/commonjs/generated/src/operationsInterfaces/index.js.map +1 -0
  297. package/dist/commonjs/generated/src/operationsInterfaces/service.d.ts +24 -0
  298. package/dist/commonjs/generated/src/operationsInterfaces/service.d.ts.map +1 -0
  299. package/dist/commonjs/generated/src/operationsInterfaces/service.js +10 -0
  300. package/dist/commonjs/generated/src/operationsInterfaces/service.js.map +1 -0
  301. package/dist/commonjs/generated/src/operationsInterfaces/share.d.ts +103 -0
  302. package/dist/commonjs/generated/src/operationsInterfaces/share.d.ts.map +1 -0
  303. package/dist/commonjs/generated/src/operationsInterfaces/share.js +10 -0
  304. package/dist/commonjs/generated/src/operationsInterfaces/share.js.map +1 -0
  305. package/dist/commonjs/generated/src/storageClient.d.ts +20 -0
  306. package/dist/commonjs/generated/src/storageClient.d.ts.map +1 -0
  307. package/dist/commonjs/generated/src/storageClient.js +53 -0
  308. package/dist/commonjs/generated/src/storageClient.js.map +1 -0
  309. package/dist/commonjs/generatedModels.d.ts +492 -0
  310. package/dist/commonjs/generatedModels.d.ts.map +1 -0
  311. package/dist/commonjs/generatedModels.js +11 -0
  312. package/dist/commonjs/generatedModels.js.map +1 -0
  313. package/dist/commonjs/index.d.ts +32 -0
  314. package/dist/commonjs/index.d.ts.map +1 -0
  315. package/dist/commonjs/index.js +55 -0
  316. package/dist/commonjs/index.js.map +1 -0
  317. package/dist/commonjs/log.d.ts +5 -0
  318. package/dist/commonjs/log.d.ts.map +1 -0
  319. package/dist/commonjs/log.js +11 -0
  320. package/dist/commonjs/log.js.map +1 -0
  321. package/dist/commonjs/models.d.ts +373 -0
  322. package/dist/commonjs/models.d.ts.map +1 -0
  323. package/dist/commonjs/models.js +107 -0
  324. package/dist/commonjs/models.js.map +1 -0
  325. package/dist/commonjs/package.json +3 -0
  326. package/dist/commonjs/policies/StorageRetryPolicy.d.ts +75 -0
  327. package/dist/commonjs/policies/StorageRetryPolicy.d.ts.map +1 -0
  328. package/dist/commonjs/policies/StorageRetryPolicy.js +225 -0
  329. package/dist/commonjs/policies/StorageRetryPolicy.js.map +1 -0
  330. package/dist/commonjs/policies/StorageRetryPolicyV2.d.ts +24 -0
  331. package/dist/commonjs/policies/StorageRetryPolicyV2.d.ts.map +1 -0
  332. package/dist/commonjs/policies/StorageRetryPolicyV2.js +180 -0
  333. package/dist/commonjs/policies/StorageRetryPolicyV2.js.map +1 -0
  334. package/dist/commonjs/tsdoc-metadata.json +11 -0
  335. package/dist/commonjs/utils/Batch.d.ts +68 -0
  336. package/dist/commonjs/utils/Batch.d.ts.map +1 -0
  337. package/dist/commonjs/utils/Batch.js +126 -0
  338. package/dist/commonjs/utils/Batch.js.map +1 -0
  339. package/dist/commonjs/utils/BufferScheduler.d.ts +157 -0
  340. package/dist/commonjs/utils/BufferScheduler.d.ts.map +1 -0
  341. package/dist/commonjs/utils/BufferScheduler.js +268 -0
  342. package/dist/commonjs/utils/BufferScheduler.js.map +1 -0
  343. package/dist/commonjs/utils/RetriableReadableStream.d.ts +58 -0
  344. package/dist/commonjs/utils/RetriableReadableStream.d.ts.map +1 -0
  345. package/dist/commonjs/utils/RetriableReadableStream.js +123 -0
  346. package/dist/commonjs/utils/RetriableReadableStream.js.map +1 -0
  347. package/dist/commonjs/utils/constants.d.ts +55 -0
  348. package/dist/commonjs/utils/constants.d.ts.map +1 -0
  349. package/dist/commonjs/utils/constants.js +165 -0
  350. package/dist/commonjs/utils/constants.js.map +1 -0
  351. package/dist/commonjs/utils/tracing.d.ts +6 -0
  352. package/dist/commonjs/utils/tracing.d.ts.map +1 -0
  353. package/dist/commonjs/utils/tracing.js +17 -0
  354. package/dist/commonjs/utils/tracing.js.map +1 -0
  355. package/dist/commonjs/utils/utils.common.d.ts +304 -0
  356. package/dist/commonjs/utils/utils.common.d.ts.map +1 -0
  357. package/dist/commonjs/utils/utils.common.js +816 -0
  358. package/dist/commonjs/utils/utils.common.js.map +1 -0
  359. package/dist/commonjs/utils/utils.d.ts +28 -0
  360. package/dist/commonjs/utils/utils.d.ts.map +1 -0
  361. package/dist/commonjs/utils/utils.js +85 -0
  362. package/dist/commonjs/utils/utils.js.map +1 -0
  363. package/dist/esm/AccountSASPermissions.d.ts +61 -0
  364. package/dist/esm/AccountSASPermissions.d.ts.map +1 -0
  365. package/dist/esm/AccountSASPermissions.js +128 -0
  366. package/dist/esm/AccountSASPermissions.js.map +1 -0
  367. package/dist/esm/AccountSASResourceTypes.d.ts +38 -0
  368. package/dist/esm/AccountSASResourceTypes.d.ts.map +1 -0
  369. package/dist/esm/AccountSASResourceTypes.js.map +1 -0
  370. package/dist/esm/AccountSASServices.d.ts +40 -0
  371. package/dist/esm/AccountSASServices.d.ts.map +1 -0
  372. package/dist/esm/AccountSASServices.js.map +1 -0
  373. package/dist/esm/AccountSASSignatureValues.d.ts +73 -0
  374. package/dist/esm/AccountSASSignatureValues.d.ts.map +1 -0
  375. package/dist/esm/AccountSASSignatureValues.js +71 -0
  376. package/dist/esm/AccountSASSignatureValues.js.map +1 -0
  377. package/dist/esm/Clients.d.ts +3114 -0
  378. package/dist/esm/Clients.d.ts.map +1 -0
  379. package/dist/esm/Clients.js +2882 -0
  380. package/dist/esm/Clients.js.map +1 -0
  381. package/dist/esm/FileDownloadResponse.d.ts +291 -0
  382. package/dist/esm/FileDownloadResponse.d.ts.map +1 -0
  383. package/dist/esm/FileDownloadResponse.js +367 -0
  384. package/dist/esm/FileDownloadResponse.js.map +1 -0
  385. package/dist/esm/FileSASPermissions.d.ts +42 -0
  386. package/dist/esm/FileSASPermissions.d.ts.map +1 -0
  387. package/dist/esm/FileSASPermissions.js +82 -0
  388. package/dist/esm/FileSASPermissions.js.map +1 -0
  389. package/dist/esm/FileSASSignatureValues.d.ts +95 -0
  390. package/dist/esm/FileSASSignatureValues.d.ts.map +1 -0
  391. package/dist/esm/FileSASSignatureValues.js +84 -0
  392. package/dist/esm/FileSASSignatureValues.js.map +1 -0
  393. package/dist/esm/FileSystemAttributes.d.ts +63 -0
  394. package/dist/esm/FileSystemAttributes.d.ts.map +1 -0
  395. package/dist/esm/FileSystemAttributes.js +144 -0
  396. package/dist/esm/FileSystemAttributes.js.map +1 -0
  397. package/dist/esm/Pipeline.d.ts +142 -0
  398. package/dist/esm/Pipeline.d.ts.map +1 -0
  399. package/dist/esm/Pipeline.js +261 -0
  400. package/dist/esm/Pipeline.js.map +1 -0
  401. package/dist/esm/Range.d.ts +25 -0
  402. package/dist/esm/Range.d.ts.map +1 -0
  403. package/dist/esm/Range.js +22 -0
  404. package/dist/esm/Range.js.map +1 -0
  405. package/dist/esm/SASQueryParameters.d.ts +136 -0
  406. package/dist/esm/SASQueryParameters.d.ts.map +1 -0
  407. package/dist/esm/SASQueryParameters.js +177 -0
  408. package/dist/esm/SASQueryParameters.js.map +1 -0
  409. package/dist/esm/SasIPRange.d.ts +25 -0
  410. package/dist/esm/SasIPRange.d.ts.map +1 -0
  411. package/dist/esm/SasIPRange.js +14 -0
  412. package/dist/esm/SasIPRange.js.map +1 -0
  413. package/dist/esm/ShareClientInternal.d.ts +12 -0
  414. package/dist/esm/ShareClientInternal.d.ts.map +1 -0
  415. package/dist/esm/ShareClientInternal.js +16 -0
  416. package/dist/esm/ShareClientInternal.js.map +1 -0
  417. package/dist/esm/ShareSASPermissions.d.ts +46 -0
  418. package/dist/esm/ShareSASPermissions.d.ts.map +1 -0
  419. package/dist/esm/ShareSASPermissions.js +92 -0
  420. package/dist/esm/ShareSASPermissions.js.map +1 -0
  421. package/dist/esm/ShareServiceClient.d.ts +427 -0
  422. package/dist/esm/ShareServiceClient.d.ts.map +1 -0
  423. package/dist/esm/ShareServiceClient.js +475 -0
  424. package/dist/esm/ShareServiceClient.js.map +1 -0
  425. package/dist/esm/StorageClient.d.ts +47 -0
  426. package/dist/esm/StorageClient.d.ts.map +1 -0
  427. package/dist/esm/StorageClient.js +30 -0
  428. package/dist/esm/StorageClient.js.map +1 -0
  429. package/dist/esm/StorageContextClient.d.ts +9 -0
  430. package/dist/esm/StorageContextClient.d.ts.map +1 -0
  431. package/dist/esm/StorageContextClient.js +18 -0
  432. package/dist/esm/StorageContextClient.js.map +1 -0
  433. package/dist/esm/StorageRetryPolicyFactory.d.ts +56 -0
  434. package/dist/esm/StorageRetryPolicyFactory.d.ts.map +1 -0
  435. package/dist/esm/StorageRetryPolicyFactory.js +26 -0
  436. package/dist/esm/StorageRetryPolicyFactory.js.map +1 -0
  437. package/dist/esm/generated/src/index.d.ts +4 -0
  438. package/dist/esm/generated/src/index.d.ts.map +1 -0
  439. package/dist/esm/generated/src/index.js +11 -0
  440. package/dist/esm/generated/src/index.js.map +1 -0
  441. package/dist/esm/generated/src/models/index.d.ts +2881 -0
  442. package/dist/esm/generated/src/models/index.d.ts.map +1 -0
  443. package/dist/esm/generated/src/models/index.js +166 -0
  444. package/dist/esm/generated/src/models/index.js.map +1 -0
  445. package/dist/esm/generated/src/models/mappers.d.ts +128 -0
  446. package/dist/esm/generated/src/models/mappers.d.ts.map +1 -0
  447. package/dist/esm/generated/src/models/mappers.js +5987 -0
  448. package/dist/esm/generated/src/models/mappers.js.map +1 -0
  449. package/dist/esm/generated/src/models/parameters.d.ts +128 -0
  450. package/dist/esm/generated/src/models/parameters.d.ts.map +1 -0
  451. package/dist/esm/generated/src/models/parameters.js +1364 -0
  452. package/dist/esm/generated/src/models/parameters.js.map +1 -0
  453. package/dist/esm/generated/src/operations/directory.d.ts +65 -0
  454. package/dist/esm/generated/src/operations/directory.d.ts.map +1 -0
  455. package/dist/esm/generated/src/operations/directory.js +378 -0
  456. package/dist/esm/generated/src/operations/directory.js.map +1 -0
  457. package/dist/esm/generated/src/operations/file.d.ts +162 -0
  458. package/dist/esm/generated/src/operations/file.d.ts.map +1 -0
  459. package/dist/esm/generated/src/operations/file.js +866 -0
  460. package/dist/esm/generated/src/operations/file.js.map +1 -0
  461. package/dist/esm/generated/src/operations/index.d.ts +5 -0
  462. package/dist/esm/generated/src/operations/index.d.ts.map +1 -0
  463. package/dist/esm/generated/src/operations/index.js +12 -0
  464. package/dist/esm/generated/src/operations/index.js.map +1 -0
  465. package/dist/esm/generated/src/operations/service.d.ts +32 -0
  466. package/dist/esm/generated/src/operations/service.d.ts.map +1 -0
  467. package/dist/esm/generated/src/operations/service.js +135 -0
  468. package/dist/esm/generated/src/operations/service.js.map +1 -0
  469. package/dist/esm/generated/src/operations/share.d.ts +111 -0
  470. package/dist/esm/generated/src/operations/share.d.ts.map +1 -0
  471. package/dist/esm/generated/src/operations/share.js +671 -0
  472. package/dist/esm/generated/src/operations/share.js.map +1 -0
  473. package/dist/esm/generated/src/operationsInterfaces/directory.d.ts +57 -0
  474. package/dist/esm/generated/src/operationsInterfaces/directory.d.ts.map +1 -0
  475. package/dist/esm/generated/src/operationsInterfaces/directory.js +9 -0
  476. package/dist/esm/generated/src/operationsInterfaces/directory.js.map +1 -0
  477. package/dist/esm/generated/src/operationsInterfaces/file.d.ts +154 -0
  478. package/dist/esm/generated/src/operationsInterfaces/file.d.ts.map +1 -0
  479. package/dist/esm/generated/src/operationsInterfaces/file.js +9 -0
  480. package/dist/esm/generated/src/operationsInterfaces/file.js.map +1 -0
  481. package/dist/esm/generated/src/operationsInterfaces/index.d.ts +5 -0
  482. package/dist/esm/generated/src/operationsInterfaces/index.d.ts.map +1 -0
  483. package/dist/esm/generated/src/operationsInterfaces/index.js +12 -0
  484. package/dist/esm/generated/src/operationsInterfaces/index.js.map +1 -0
  485. package/dist/esm/generated/src/operationsInterfaces/service.d.ts +24 -0
  486. package/dist/esm/generated/src/operationsInterfaces/service.d.ts.map +1 -0
  487. package/dist/esm/generated/src/operationsInterfaces/service.js.map +1 -0
  488. package/dist/esm/generated/src/operationsInterfaces/share.d.ts +103 -0
  489. package/dist/esm/generated/src/operationsInterfaces/share.d.ts.map +1 -0
  490. package/dist/esm/generated/src/operationsInterfaces/share.js +9 -0
  491. package/dist/esm/generated/src/operationsInterfaces/share.js.map +1 -0
  492. package/dist/esm/generated/src/storageClient.d.ts +20 -0
  493. package/dist/esm/generated/src/storageClient.d.ts.map +1 -0
  494. package/dist/esm/generated/src/storageClient.js +48 -0
  495. package/dist/esm/generated/src/storageClient.js.map +1 -0
  496. package/dist/esm/generatedModels.d.ts +492 -0
  497. package/dist/esm/generatedModels.d.ts.map +1 -0
  498. package/dist/esm/generatedModels.js +8 -0
  499. package/dist/esm/generatedModels.js.map +1 -0
  500. package/dist/esm/index.d.ts +32 -0
  501. package/dist/esm/index.d.ts.map +1 -0
  502. package/dist/esm/index.js +30 -0
  503. package/dist/esm/index.js.map +1 -0
  504. package/dist/esm/log.d.ts +5 -0
  505. package/dist/esm/log.d.ts.map +1 -0
  506. package/dist/esm/log.js +8 -0
  507. package/dist/esm/log.js.map +1 -0
  508. package/dist/esm/models.d.ts +373 -0
  509. package/dist/esm/models.d.ts.map +1 -0
  510. package/dist/esm/models.js +94 -0
  511. package/dist/esm/models.js.map +1 -0
  512. package/dist/esm/package.json +3 -0
  513. package/dist/esm/policies/StorageRetryPolicy.d.ts +75 -0
  514. package/dist/esm/policies/StorageRetryPolicy.d.ts.map +1 -0
  515. package/dist/esm/policies/StorageRetryPolicy.js +220 -0
  516. package/dist/esm/policies/StorageRetryPolicy.js.map +1 -0
  517. package/dist/esm/policies/StorageRetryPolicyV2.d.ts +24 -0
  518. package/dist/esm/policies/StorageRetryPolicyV2.d.ts.map +1 -0
  519. package/dist/esm/policies/StorageRetryPolicyV2.js +176 -0
  520. package/dist/esm/policies/StorageRetryPolicyV2.js.map +1 -0
  521. package/dist/esm/utils/Batch.d.ts +68 -0
  522. package/dist/esm/utils/Batch.d.ts.map +1 -0
  523. package/dist/esm/utils/Batch.js.map +1 -0
  524. package/dist/esm/utils/BufferScheduler.d.ts +157 -0
  525. package/dist/esm/utils/BufferScheduler.d.ts.map +1 -0
  526. package/dist/esm/utils/BufferScheduler.js +264 -0
  527. package/dist/esm/utils/BufferScheduler.js.map +1 -0
  528. package/dist/esm/utils/RetriableReadableStream.d.ts +58 -0
  529. package/dist/esm/utils/RetriableReadableStream.d.ts.map +1 -0
  530. package/dist/esm/utils/RetriableReadableStream.js +119 -0
  531. package/dist/esm/utils/RetriableReadableStream.js.map +1 -0
  532. package/dist/esm/utils/constants.d.ts +55 -0
  533. package/dist/esm/utils/constants.d.ts.map +1 -0
  534. package/dist/esm/utils/constants.js +162 -0
  535. package/dist/esm/utils/constants.js.map +1 -0
  536. package/dist/esm/utils/tracing.d.ts +6 -0
  537. package/dist/esm/utils/tracing.d.ts.map +1 -0
  538. package/dist/esm/utils/tracing.js +14 -0
  539. package/dist/esm/utils/tracing.js.map +1 -0
  540. package/dist/esm/utils/utils.common.d.ts +304 -0
  541. package/dist/esm/utils/utils.common.d.ts.map +1 -0
  542. package/dist/esm/utils/utils.common.js +778 -0
  543. package/dist/esm/utils/utils.common.js.map +1 -0
  544. package/dist/esm/utils/utils.d.ts +28 -0
  545. package/dist/esm/utils/utils.d.ts.map +1 -0
  546. package/dist/esm/utils/utils.js +79 -0
  547. package/dist/esm/utils/utils.js.map +1 -0
  548. package/dist/react-native/AccountSASPermissions.d.ts +61 -0
  549. package/dist/react-native/AccountSASPermissions.d.ts.map +1 -0
  550. package/dist/react-native/AccountSASPermissions.js +128 -0
  551. package/dist/react-native/AccountSASPermissions.js.map +1 -0
  552. package/dist/react-native/AccountSASResourceTypes.d.ts +38 -0
  553. package/dist/react-native/AccountSASResourceTypes.d.ts.map +1 -0
  554. package/dist/react-native/AccountSASResourceTypes.js +72 -0
  555. package/dist/react-native/AccountSASResourceTypes.js.map +1 -0
  556. package/dist/react-native/AccountSASServices.d.ts +40 -0
  557. package/dist/react-native/AccountSASServices.d.ts.map +1 -0
  558. package/dist/react-native/AccountSASServices.js +80 -0
  559. package/dist/react-native/AccountSASServices.js.map +1 -0
  560. package/dist/react-native/AccountSASSignatureValues.d.ts +73 -0
  561. package/dist/react-native/AccountSASSignatureValues.d.ts.map +1 -0
  562. package/dist/react-native/AccountSASSignatureValues.js +71 -0
  563. package/dist/react-native/AccountSASSignatureValues.js.map +1 -0
  564. package/dist/react-native/Clients.d.ts +3114 -0
  565. package/dist/react-native/Clients.d.ts.map +1 -0
  566. package/dist/react-native/Clients.js +2882 -0
  567. package/dist/react-native/Clients.js.map +1 -0
  568. package/dist/react-native/FileDownloadResponse.d.ts +291 -0
  569. package/dist/react-native/FileDownloadResponse.d.ts.map +1 -0
  570. package/dist/react-native/FileDownloadResponse.js +367 -0
  571. package/dist/react-native/FileDownloadResponse.js.map +1 -0
  572. package/dist/react-native/FileSASPermissions.d.ts +42 -0
  573. package/dist/react-native/FileSASPermissions.d.ts.map +1 -0
  574. package/dist/react-native/FileSASPermissions.js +82 -0
  575. package/dist/react-native/FileSASPermissions.js.map +1 -0
  576. package/dist/react-native/FileSASSignatureValues.d.ts +95 -0
  577. package/dist/react-native/FileSASSignatureValues.d.ts.map +1 -0
  578. package/dist/react-native/FileSASSignatureValues.js +84 -0
  579. package/dist/react-native/FileSASSignatureValues.js.map +1 -0
  580. package/dist/react-native/FileSystemAttributes.d.ts +63 -0
  581. package/dist/react-native/FileSystemAttributes.d.ts.map +1 -0
  582. package/dist/react-native/FileSystemAttributes.js +144 -0
  583. package/dist/react-native/FileSystemAttributes.js.map +1 -0
  584. package/dist/react-native/Pipeline.d.ts +142 -0
  585. package/dist/react-native/Pipeline.d.ts.map +1 -0
  586. package/dist/react-native/Pipeline.js +261 -0
  587. package/dist/react-native/Pipeline.js.map +1 -0
  588. package/dist/react-native/Range.d.ts +25 -0
  589. package/dist/react-native/Range.d.ts.map +1 -0
  590. package/dist/react-native/Range.js +22 -0
  591. package/dist/react-native/Range.js.map +1 -0
  592. package/dist/react-native/SASQueryParameters.d.ts +136 -0
  593. package/dist/react-native/SASQueryParameters.d.ts.map +1 -0
  594. package/dist/react-native/SASQueryParameters.js +177 -0
  595. package/dist/react-native/SASQueryParameters.js.map +1 -0
  596. package/dist/react-native/SasIPRange.d.ts +25 -0
  597. package/dist/react-native/SasIPRange.d.ts.map +1 -0
  598. package/dist/react-native/SasIPRange.js +14 -0
  599. package/dist/react-native/SasIPRange.js.map +1 -0
  600. package/dist/react-native/ShareClientInternal.d.ts +12 -0
  601. package/dist/react-native/ShareClientInternal.d.ts.map +1 -0
  602. package/dist/react-native/ShareClientInternal.js +16 -0
  603. package/dist/react-native/ShareClientInternal.js.map +1 -0
  604. package/dist/react-native/ShareSASPermissions.d.ts +46 -0
  605. package/dist/react-native/ShareSASPermissions.d.ts.map +1 -0
  606. package/dist/react-native/ShareSASPermissions.js +92 -0
  607. package/dist/react-native/ShareSASPermissions.js.map +1 -0
  608. package/dist/react-native/ShareServiceClient.d.ts +427 -0
  609. package/dist/react-native/ShareServiceClient.d.ts.map +1 -0
  610. package/dist/react-native/ShareServiceClient.js +475 -0
  611. package/dist/react-native/ShareServiceClient.js.map +1 -0
  612. package/dist/react-native/StorageClient.d.ts +47 -0
  613. package/dist/react-native/StorageClient.d.ts.map +1 -0
  614. package/dist/react-native/StorageClient.js +30 -0
  615. package/dist/react-native/StorageClient.js.map +1 -0
  616. package/dist/react-native/StorageContextClient.d.ts +9 -0
  617. package/dist/react-native/StorageContextClient.d.ts.map +1 -0
  618. package/dist/react-native/StorageContextClient.js +18 -0
  619. package/dist/react-native/StorageContextClient.js.map +1 -0
  620. package/dist/react-native/StorageRetryPolicyFactory.d.ts +56 -0
  621. package/dist/react-native/StorageRetryPolicyFactory.d.ts.map +1 -0
  622. package/dist/react-native/StorageRetryPolicyFactory.js +26 -0
  623. package/dist/react-native/StorageRetryPolicyFactory.js.map +1 -0
  624. package/dist/react-native/generated/src/index.d.ts +4 -0
  625. package/dist/react-native/generated/src/index.d.ts.map +1 -0
  626. package/dist/react-native/generated/src/index.js +11 -0
  627. package/dist/react-native/generated/src/index.js.map +1 -0
  628. package/dist/react-native/generated/src/models/index.d.ts +2881 -0
  629. package/dist/react-native/generated/src/models/index.d.ts.map +1 -0
  630. package/dist/react-native/generated/src/models/index.js +166 -0
  631. package/dist/react-native/generated/src/models/index.js.map +1 -0
  632. package/dist/react-native/generated/src/models/mappers.d.ts +128 -0
  633. package/dist/react-native/generated/src/models/mappers.d.ts.map +1 -0
  634. package/dist/react-native/generated/src/models/mappers.js +5987 -0
  635. package/dist/react-native/generated/src/models/mappers.js.map +1 -0
  636. package/dist/react-native/generated/src/models/parameters.d.ts +128 -0
  637. package/dist/react-native/generated/src/models/parameters.d.ts.map +1 -0
  638. package/dist/react-native/generated/src/models/parameters.js +1364 -0
  639. package/dist/react-native/generated/src/models/parameters.js.map +1 -0
  640. package/dist/react-native/generated/src/operations/directory.d.ts +65 -0
  641. package/dist/react-native/generated/src/operations/directory.d.ts.map +1 -0
  642. package/dist/react-native/generated/src/operations/directory.js +378 -0
  643. package/dist/react-native/generated/src/operations/directory.js.map +1 -0
  644. package/dist/react-native/generated/src/operations/file.d.ts +162 -0
  645. package/dist/react-native/generated/src/operations/file.d.ts.map +1 -0
  646. package/dist/react-native/generated/src/operations/file.js +866 -0
  647. package/dist/react-native/generated/src/operations/file.js.map +1 -0
  648. package/dist/react-native/generated/src/operations/index.d.ts +5 -0
  649. package/dist/react-native/generated/src/operations/index.d.ts.map +1 -0
  650. package/dist/react-native/generated/src/operations/index.js +12 -0
  651. package/dist/react-native/generated/src/operations/index.js.map +1 -0
  652. package/dist/react-native/generated/src/operations/service.d.ts +32 -0
  653. package/dist/react-native/generated/src/operations/service.d.ts.map +1 -0
  654. package/dist/react-native/generated/src/operations/service.js +135 -0
  655. package/dist/react-native/generated/src/operations/service.js.map +1 -0
  656. package/dist/react-native/generated/src/operations/share.d.ts +111 -0
  657. package/dist/react-native/generated/src/operations/share.d.ts.map +1 -0
  658. package/dist/react-native/generated/src/operations/share.js +671 -0
  659. package/dist/react-native/generated/src/operations/share.js.map +1 -0
  660. package/dist/react-native/generated/src/operationsInterfaces/directory.d.ts +57 -0
  661. package/dist/react-native/generated/src/operationsInterfaces/directory.d.ts.map +1 -0
  662. package/dist/react-native/generated/src/operationsInterfaces/directory.js +9 -0
  663. package/dist/react-native/generated/src/operationsInterfaces/directory.js.map +1 -0
  664. package/dist/react-native/generated/src/operationsInterfaces/file.d.ts +154 -0
  665. package/dist/react-native/generated/src/operationsInterfaces/file.d.ts.map +1 -0
  666. package/dist/react-native/generated/src/operationsInterfaces/file.js +9 -0
  667. package/dist/react-native/generated/src/operationsInterfaces/file.js.map +1 -0
  668. package/dist/react-native/generated/src/operationsInterfaces/index.d.ts +5 -0
  669. package/dist/react-native/generated/src/operationsInterfaces/index.d.ts.map +1 -0
  670. package/dist/react-native/generated/src/operationsInterfaces/index.js +12 -0
  671. package/dist/react-native/generated/src/operationsInterfaces/index.js.map +1 -0
  672. package/dist/react-native/generated/src/operationsInterfaces/service.d.ts +24 -0
  673. package/dist/react-native/generated/src/operationsInterfaces/service.d.ts.map +1 -0
  674. package/dist/react-native/generated/src/operationsInterfaces/service.js +9 -0
  675. package/dist/react-native/generated/src/operationsInterfaces/service.js.map +1 -0
  676. package/dist/react-native/generated/src/operationsInterfaces/share.d.ts +103 -0
  677. package/dist/react-native/generated/src/operationsInterfaces/share.d.ts.map +1 -0
  678. package/dist/react-native/generated/src/operationsInterfaces/share.js +9 -0
  679. package/dist/react-native/generated/src/operationsInterfaces/share.js.map +1 -0
  680. package/dist/react-native/generated/src/storageClient.d.ts +20 -0
  681. package/dist/react-native/generated/src/storageClient.d.ts.map +1 -0
  682. package/dist/react-native/generated/src/storageClient.js +48 -0
  683. package/dist/react-native/generated/src/storageClient.js.map +1 -0
  684. package/dist/react-native/generatedModels.d.ts +492 -0
  685. package/dist/react-native/generatedModels.d.ts.map +1 -0
  686. package/dist/react-native/generatedModels.js +8 -0
  687. package/dist/react-native/generatedModels.js.map +1 -0
  688. package/dist/react-native/index.d.ts +32 -0
  689. package/dist/react-native/index.d.ts.map +1 -0
  690. package/dist/react-native/index.js +30 -0
  691. package/dist/react-native/index.js.map +1 -0
  692. package/dist/react-native/log.d.ts +5 -0
  693. package/dist/react-native/log.d.ts.map +1 -0
  694. package/dist/react-native/log.js +8 -0
  695. package/dist/react-native/log.js.map +1 -0
  696. package/dist/react-native/models.d.ts +373 -0
  697. package/dist/react-native/models.d.ts.map +1 -0
  698. package/dist/react-native/models.js +94 -0
  699. package/dist/react-native/models.js.map +1 -0
  700. package/dist/react-native/package.json +3 -0
  701. package/dist/react-native/policies/StorageRetryPolicy.d.ts +75 -0
  702. package/dist/react-native/policies/StorageRetryPolicy.d.ts.map +1 -0
  703. package/dist/react-native/policies/StorageRetryPolicy.js +220 -0
  704. package/dist/react-native/policies/StorageRetryPolicy.js.map +1 -0
  705. package/dist/react-native/policies/StorageRetryPolicyV2.d.ts +24 -0
  706. package/dist/react-native/policies/StorageRetryPolicyV2.d.ts.map +1 -0
  707. package/dist/react-native/policies/StorageRetryPolicyV2.js +176 -0
  708. package/dist/react-native/policies/StorageRetryPolicyV2.js.map +1 -0
  709. package/dist/react-native/utils/Batch.d.ts +68 -0
  710. package/dist/react-native/utils/Batch.d.ts.map +1 -0
  711. package/dist/react-native/utils/Batch.js +122 -0
  712. package/dist/react-native/utils/Batch.js.map +1 -0
  713. package/dist/react-native/utils/BufferScheduler.d.ts +157 -0
  714. package/dist/react-native/utils/BufferScheduler.d.ts.map +1 -0
  715. package/dist/react-native/utils/BufferScheduler.js +264 -0
  716. package/dist/react-native/utils/BufferScheduler.js.map +1 -0
  717. package/dist/react-native/utils/RetriableReadableStream.d.ts +58 -0
  718. package/dist/react-native/utils/RetriableReadableStream.d.ts.map +1 -0
  719. package/dist/react-native/utils/RetriableReadableStream.js +119 -0
  720. package/dist/react-native/utils/RetriableReadableStream.js.map +1 -0
  721. package/dist/react-native/utils/constants.d.ts +55 -0
  722. package/dist/react-native/utils/constants.d.ts.map +1 -0
  723. package/dist/react-native/utils/constants.js +162 -0
  724. package/dist/react-native/utils/constants.js.map +1 -0
  725. package/dist/react-native/utils/tracing.d.ts +6 -0
  726. package/dist/react-native/utils/tracing.d.ts.map +1 -0
  727. package/dist/react-native/utils/tracing.js +14 -0
  728. package/dist/react-native/utils/tracing.js.map +1 -0
  729. package/dist/react-native/utils/utils.common.d.ts +304 -0
  730. package/dist/react-native/utils/utils.common.d.ts.map +1 -0
  731. package/dist/react-native/utils/utils.common.js +778 -0
  732. package/dist/react-native/utils/utils.common.js.map +1 -0
  733. package/dist/react-native/utils/utils.d.ts +28 -0
  734. package/dist/react-native/utils/utils.d.ts.map +1 -0
  735. package/dist/react-native/utils/utils.js +79 -0
  736. package/dist/react-native/utils/utils.js.map +1 -0
  737. package/package.json +69 -74
  738. package/dist/index.js +0 -16901
  739. package/dist/index.js.map +0 -1
  740. package/dist-esm/storage-blob/src/BatchResponse.js +0 -4
  741. package/dist-esm/storage-blob/src/BatchResponse.js.map +0 -1
  742. package/dist-esm/storage-blob/src/BatchResponseParser.js +0 -137
  743. package/dist-esm/storage-blob/src/BatchResponseParser.js.map +0 -1
  744. package/dist-esm/storage-blob/src/BatchUtils.js +0 -15
  745. package/dist-esm/storage-blob/src/BatchUtils.js.map +0 -1
  746. package/dist-esm/storage-blob/src/BlobBatch.js +0 -267
  747. package/dist-esm/storage-blob/src/BlobBatch.js.map +0 -1
  748. package/dist-esm/storage-blob/src/BlobBatchClient.js +0 -140
  749. package/dist-esm/storage-blob/src/BlobBatchClient.js.map +0 -1
  750. package/dist-esm/storage-blob/src/BlobDownloadResponse.js +0 -463
  751. package/dist-esm/storage-blob/src/BlobDownloadResponse.js.map +0 -1
  752. package/dist-esm/storage-blob/src/BlobLeaseClient.js +0 -192
  753. package/dist-esm/storage-blob/src/BlobLeaseClient.js.map +0 -1
  754. package/dist-esm/storage-blob/src/BlobQueryResponse.js +0 -367
  755. package/dist-esm/storage-blob/src/BlobQueryResponse.js.map +0 -1
  756. package/dist-esm/storage-blob/src/BlobServiceClient.js +0 -716
  757. package/dist-esm/storage-blob/src/BlobServiceClient.js.map +0 -1
  758. package/dist-esm/storage-blob/src/Clients.js +0 -2594
  759. package/dist-esm/storage-blob/src/Clients.js.map +0 -1
  760. package/dist-esm/storage-blob/src/ContainerClient.js +0 -1209
  761. package/dist-esm/storage-blob/src/ContainerClient.js.map +0 -1
  762. package/dist-esm/storage-blob/src/PageBlobRangeResponse.js +0 -24
  763. package/dist-esm/storage-blob/src/PageBlobRangeResponse.js.map +0 -1
  764. package/dist-esm/storage-blob/src/Pipeline.js +0 -261
  765. package/dist-esm/storage-blob/src/Pipeline.js.map +0 -1
  766. package/dist-esm/storage-blob/src/Range.js +0 -21
  767. package/dist-esm/storage-blob/src/Range.js.map +0 -1
  768. package/dist-esm/storage-blob/src/StorageBrowserPolicyFactory.js +0 -19
  769. package/dist-esm/storage-blob/src/StorageBrowserPolicyFactory.js.map +0 -1
  770. package/dist-esm/storage-blob/src/StorageClient.js +0 -29
  771. package/dist-esm/storage-blob/src/StorageClient.js.map +0 -1
  772. package/dist-esm/storage-blob/src/StorageContextClient.js +0 -17
  773. package/dist-esm/storage-blob/src/StorageContextClient.js.map +0 -1
  774. package/dist-esm/storage-blob/src/StorageRetryPolicyFactory.js +0 -26
  775. package/dist-esm/storage-blob/src/StorageRetryPolicyFactory.js.map +0 -1
  776. package/dist-esm/storage-blob/src/credentials/AnonymousCredential.js +0 -22
  777. package/dist-esm/storage-blob/src/credentials/AnonymousCredential.js.map +0 -1
  778. package/dist-esm/storage-blob/src/credentials/Credential.js +0 -18
  779. package/dist-esm/storage-blob/src/credentials/Credential.js.map +0 -1
  780. package/dist-esm/storage-blob/src/credentials/StorageSharedKeyCredential.browser.js +0 -5
  781. package/dist-esm/storage-blob/src/credentials/StorageSharedKeyCredential.browser.js.map +0 -1
  782. package/dist-esm/storage-blob/src/credentials/StorageSharedKeyCredential.js +0 -40
  783. package/dist-esm/storage-blob/src/credentials/StorageSharedKeyCredential.js.map +0 -1
  784. package/dist-esm/storage-blob/src/credentials/UserDelegationKeyCredential.browser.js +0 -5
  785. package/dist-esm/storage-blob/src/credentials/UserDelegationKeyCredential.browser.js.map +0 -1
  786. package/dist-esm/storage-blob/src/credentials/UserDelegationKeyCredential.js +0 -31
  787. package/dist-esm/storage-blob/src/credentials/UserDelegationKeyCredential.js.map +0 -1
  788. package/dist-esm/storage-blob/src/generated/src/index.js +0 -11
  789. package/dist-esm/storage-blob/src/generated/src/index.js.map +0 -1
  790. package/dist-esm/storage-blob/src/generated/src/models/index.js +0 -258
  791. package/dist-esm/storage-blob/src/generated/src/models/index.js.map +0 -1
  792. package/dist-esm/storage-blob/src/generated/src/models/mappers.js +0 -8225
  793. package/dist-esm/storage-blob/src/generated/src/models/mappers.js.map +0 -1
  794. package/dist-esm/storage-blob/src/generated/src/models/parameters.js +0 -1610
  795. package/dist-esm/storage-blob/src/generated/src/models/parameters.js.map +0 -1
  796. package/dist-esm/storage-blob/src/generated/src/operations/appendBlob.js +0 -221
  797. package/dist-esm/storage-blob/src/generated/src/operations/appendBlob.js.map +0 -1
  798. package/dist-esm/storage-blob/src/generated/src/operations/blob.js +0 -1020
  799. package/dist-esm/storage-blob/src/generated/src/operations/blob.js.map +0 -1
  800. package/dist-esm/storage-blob/src/generated/src/operations/blockBlob.js +0 -365
  801. package/dist-esm/storage-blob/src/generated/src/operations/blockBlob.js.map +0 -1
  802. package/dist-esm/storage-blob/src/generated/src/operations/container.js +0 -713
  803. package/dist-esm/storage-blob/src/generated/src/operations/container.js.map +0 -1
  804. package/dist-esm/storage-blob/src/generated/src/operations/index.js +0 -14
  805. package/dist-esm/storage-blob/src/generated/src/operations/index.js.map +0 -1
  806. package/dist-esm/storage-blob/src/generated/src/operations/pageBlob.js +0 -456
  807. package/dist-esm/storage-blob/src/generated/src/operations/pageBlob.js.map +0 -1
  808. package/dist-esm/storage-blob/src/generated/src/operations/service.js +0 -323
  809. package/dist-esm/storage-blob/src/generated/src/operations/service.js.map +0 -1
  810. package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/appendBlob.js +0 -9
  811. package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/appendBlob.js.map +0 -1
  812. package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/blob.js +0 -9
  813. package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/blob.js.map +0 -1
  814. package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/blockBlob.js +0 -9
  815. package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/blockBlob.js.map +0 -1
  816. package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/container.js +0 -9
  817. package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/container.js.map +0 -1
  818. package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/index.js +0 -14
  819. package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/index.js.map +0 -1
  820. package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/pageBlob.js +0 -9
  821. package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/pageBlob.js.map +0 -1
  822. package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/service.js.map +0 -1
  823. package/dist-esm/storage-blob/src/generated/src/storageClient.js +0 -49
  824. package/dist-esm/storage-blob/src/generated/src/storageClient.js.map +0 -1
  825. package/dist-esm/storage-blob/src/generatedModels.js +0 -8
  826. package/dist-esm/storage-blob/src/generatedModels.js.map +0 -1
  827. package/dist-esm/storage-blob/src/index.js +0 -33
  828. package/dist-esm/storage-blob/src/index.js.map +0 -1
  829. package/dist-esm/storage-blob/src/log.js +0 -8
  830. package/dist-esm/storage-blob/src/log.js.map +0 -1
  831. package/dist-esm/storage-blob/src/models.js +0 -115
  832. package/dist-esm/storage-blob/src/models.js.map +0 -1
  833. package/dist-esm/storage-blob/src/policies/AnonymousCredentialPolicy.js +0 -20
  834. package/dist-esm/storage-blob/src/policies/AnonymousCredentialPolicy.js.map +0 -1
  835. package/dist-esm/storage-blob/src/policies/CredentialPolicy.js +0 -29
  836. package/dist-esm/storage-blob/src/policies/CredentialPolicy.js.map +0 -1
  837. package/dist-esm/storage-blob/src/policies/RequestPolicy.js +0 -40
  838. package/dist-esm/storage-blob/src/policies/RequestPolicy.js.map +0 -1
  839. package/dist-esm/storage-blob/src/policies/StorageBrowserPolicy.js +0 -47
  840. package/dist-esm/storage-blob/src/policies/StorageBrowserPolicy.js.map +0 -1
  841. package/dist-esm/storage-blob/src/policies/StorageBrowserPolicyV2.js +0 -31
  842. package/dist-esm/storage-blob/src/policies/StorageBrowserPolicyV2.js.map +0 -1
  843. package/dist-esm/storage-blob/src/policies/StorageCorrectContentLengthPolicy.browser.js +0 -18
  844. package/dist-esm/storage-blob/src/policies/StorageCorrectContentLengthPolicy.browser.js.map +0 -1
  845. package/dist-esm/storage-blob/src/policies/StorageCorrectContentLengthPolicy.js +0 -27
  846. package/dist-esm/storage-blob/src/policies/StorageCorrectContentLengthPolicy.js.map +0 -1
  847. package/dist-esm/storage-blob/src/policies/StorageRetryPolicy.js +0 -229
  848. package/dist-esm/storage-blob/src/policies/StorageRetryPolicy.js.map +0 -1
  849. package/dist-esm/storage-blob/src/policies/StorageRetryPolicyV2.js +0 -180
  850. package/dist-esm/storage-blob/src/policies/StorageRetryPolicyV2.js.map +0 -1
  851. package/dist-esm/storage-blob/src/policies/StorageSharedKeyCredentialPolicy.js +0 -141
  852. package/dist-esm/storage-blob/src/policies/StorageSharedKeyCredentialPolicy.js.map +0 -1
  853. package/dist-esm/storage-blob/src/policies/StorageSharedKeyCredentialPolicyV2.browser.js +0 -18
  854. package/dist-esm/storage-blob/src/policies/StorageSharedKeyCredentialPolicyV2.browser.js.map +0 -1
  855. package/dist-esm/storage-blob/src/policies/StorageSharedKeyCredentialPolicyV2.js +0 -132
  856. package/dist-esm/storage-blob/src/policies/StorageSharedKeyCredentialPolicyV2.js.map +0 -1
  857. package/dist-esm/storage-blob/src/pollers/BlobStartCopyFromUrlPoller.js +0 -130
  858. package/dist-esm/storage-blob/src/pollers/BlobStartCopyFromUrlPoller.js.map +0 -1
  859. package/dist-esm/storage-blob/src/sas/AccountSASPermissions.js +0 -227
  860. package/dist-esm/storage-blob/src/sas/AccountSASPermissions.js.map +0 -1
  861. package/dist-esm/storage-blob/src/sas/AccountSASResourceTypes.js.map +0 -1
  862. package/dist-esm/storage-blob/src/sas/AccountSASServices.js.map +0 -1
  863. package/dist-esm/storage-blob/src/sas/AccountSASSignatureValues.js +0 -100
  864. package/dist-esm/storage-blob/src/sas/AccountSASSignatureValues.js.map +0 -1
  865. package/dist-esm/storage-blob/src/sas/BlobSASPermissions.js +0 -195
  866. package/dist-esm/storage-blob/src/sas/BlobSASPermissions.js.map +0 -1
  867. package/dist-esm/storage-blob/src/sas/BlobSASSignatureValues.js +0 -576
  868. package/dist-esm/storage-blob/src/sas/BlobSASSignatureValues.js.map +0 -1
  869. package/dist-esm/storage-blob/src/sas/ContainerSASPermissions.js +0 -221
  870. package/dist-esm/storage-blob/src/sas/ContainerSASPermissions.js.map +0 -1
  871. package/dist-esm/storage-blob/src/sas/SASQueryParameters.js +0 -234
  872. package/dist-esm/storage-blob/src/sas/SASQueryParameters.js.map +0 -1
  873. package/dist-esm/storage-blob/src/sas/SasIPRange.js +0 -13
  874. package/dist-esm/storage-blob/src/sas/SasIPRange.js.map +0 -1
  875. package/dist-esm/storage-blob/src/utils/Batch.js.map +0 -1
  876. package/dist-esm/storage-blob/src/utils/BlobQuickQueryStream.js +0 -111
  877. package/dist-esm/storage-blob/src/utils/BlobQuickQueryStream.js.map +0 -1
  878. package/dist-esm/storage-blob/src/utils/Mutex.js +0 -65
  879. package/dist-esm/storage-blob/src/utils/Mutex.js.map +0 -1
  880. package/dist-esm/storage-blob/src/utils/RetriableReadableStream.js +0 -119
  881. package/dist-esm/storage-blob/src/utils/RetriableReadableStream.js.map +0 -1
  882. package/dist-esm/storage-blob/src/utils/SharedKeyComparator.js +0 -73
  883. package/dist-esm/storage-blob/src/utils/SharedKeyComparator.js.map +0 -1
  884. package/dist-esm/storage-blob/src/utils/cache.js +0 -11
  885. package/dist-esm/storage-blob/src/utils/cache.js.map +0 -1
  886. package/dist-esm/storage-blob/src/utils/constants.js +0 -226
  887. package/dist-esm/storage-blob/src/utils/constants.js.map +0 -1
  888. package/dist-esm/storage-blob/src/utils/tracing.js +0 -14
  889. package/dist-esm/storage-blob/src/utils/tracing.js.map +0 -1
  890. package/dist-esm/storage-blob/src/utils/utils.common.js +0 -756
  891. package/dist-esm/storage-blob/src/utils/utils.common.js.map +0 -1
  892. package/dist-esm/storage-blob/src/utils/utils.node.js +0 -132
  893. package/dist-esm/storage-blob/src/utils/utils.node.js.map +0 -1
  894. package/dist-esm/storage-file-share/src/AccountSASPermissions.js.map +0 -1
  895. package/dist-esm/storage-file-share/src/AccountSASResourceTypes.js.map +0 -1
  896. package/dist-esm/storage-file-share/src/AccountSASServices.js.map +0 -1
  897. package/dist-esm/storage-file-share/src/AccountSASSignatureValues.js +0 -71
  898. package/dist-esm/storage-file-share/src/AccountSASSignatureValues.js.map +0 -1
  899. package/dist-esm/storage-file-share/src/Clients.js +0 -2642
  900. package/dist-esm/storage-file-share/src/Clients.js.map +0 -1
  901. package/dist-esm/storage-file-share/src/FileDownloadResponse.browser.js +0 -7
  902. package/dist-esm/storage-file-share/src/FileDownloadResponse.browser.js.map +0 -1
  903. package/dist-esm/storage-file-share/src/FileDownloadResponse.js +0 -367
  904. package/dist-esm/storage-file-share/src/FileDownloadResponse.js.map +0 -1
  905. package/dist-esm/storage-file-share/src/FileSASPermissions.js.map +0 -1
  906. package/dist-esm/storage-file-share/src/FileSASSignatureValues.js +0 -84
  907. package/dist-esm/storage-file-share/src/FileSASSignatureValues.js.map +0 -1
  908. package/dist-esm/storage-file-share/src/FileSystemAttributes.js.map +0 -1
  909. package/dist-esm/storage-file-share/src/Pipeline.js +0 -261
  910. package/dist-esm/storage-file-share/src/Pipeline.js.map +0 -1
  911. package/dist-esm/storage-file-share/src/Range.js.map +0 -1
  912. package/dist-esm/storage-file-share/src/SASQueryParameters.js +0 -177
  913. package/dist-esm/storage-file-share/src/SASQueryParameters.js.map +0 -1
  914. package/dist-esm/storage-file-share/src/SasIPRange.js.map +0 -1
  915. package/dist-esm/storage-file-share/src/ShareClientInternal.js +0 -16
  916. package/dist-esm/storage-file-share/src/ShareClientInternal.js.map +0 -1
  917. package/dist-esm/storage-file-share/src/ShareSASPermissions.js.map +0 -1
  918. package/dist-esm/storage-file-share/src/ShareServiceClient.js +0 -429
  919. package/dist-esm/storage-file-share/src/ShareServiceClient.js.map +0 -1
  920. package/dist-esm/storage-file-share/src/StorageClient.js +0 -30
  921. package/dist-esm/storage-file-share/src/StorageClient.js.map +0 -1
  922. package/dist-esm/storage-file-share/src/StorageContextClient.js +0 -18
  923. package/dist-esm/storage-file-share/src/StorageContextClient.js.map +0 -1
  924. package/dist-esm/storage-file-share/src/StorageRetryPolicyFactory.js +0 -26
  925. package/dist-esm/storage-file-share/src/StorageRetryPolicyFactory.js.map +0 -1
  926. package/dist-esm/storage-file-share/src/generated/src/index.js +0 -11
  927. package/dist-esm/storage-file-share/src/generated/src/index.js.map +0 -1
  928. package/dist-esm/storage-file-share/src/generated/src/models/index.js.map +0 -1
  929. package/dist-esm/storage-file-share/src/generated/src/models/mappers.js.map +0 -1
  930. package/dist-esm/storage-file-share/src/generated/src/models/parameters.js +0 -1364
  931. package/dist-esm/storage-file-share/src/generated/src/models/parameters.js.map +0 -1
  932. package/dist-esm/storage-file-share/src/generated/src/operations/directory.js +0 -378
  933. package/dist-esm/storage-file-share/src/generated/src/operations/directory.js.map +0 -1
  934. package/dist-esm/storage-file-share/src/generated/src/operations/file.js +0 -866
  935. package/dist-esm/storage-file-share/src/generated/src/operations/file.js.map +0 -1
  936. package/dist-esm/storage-file-share/src/generated/src/operations/index.js +0 -12
  937. package/dist-esm/storage-file-share/src/generated/src/operations/index.js.map +0 -1
  938. package/dist-esm/storage-file-share/src/generated/src/operations/service.js +0 -135
  939. package/dist-esm/storage-file-share/src/generated/src/operations/service.js.map +0 -1
  940. package/dist-esm/storage-file-share/src/generated/src/operations/share.js +0 -671
  941. package/dist-esm/storage-file-share/src/generated/src/operations/share.js.map +0 -1
  942. package/dist-esm/storage-file-share/src/generated/src/operationsInterfaces/directory.js.map +0 -1
  943. package/dist-esm/storage-file-share/src/generated/src/operationsInterfaces/file.js.map +0 -1
  944. package/dist-esm/storage-file-share/src/generated/src/operationsInterfaces/index.js +0 -12
  945. package/dist-esm/storage-file-share/src/generated/src/operationsInterfaces/index.js.map +0 -1
  946. package/dist-esm/storage-file-share/src/generated/src/operationsInterfaces/service.js.map +0 -1
  947. package/dist-esm/storage-file-share/src/generated/src/operationsInterfaces/share.js.map +0 -1
  948. package/dist-esm/storage-file-share/src/generated/src/storageClient.js +0 -48
  949. package/dist-esm/storage-file-share/src/generated/src/storageClient.js.map +0 -1
  950. package/dist-esm/storage-file-share/src/generatedModels.js.map +0 -1
  951. package/dist-esm/storage-file-share/src/index.browser.js +0 -19
  952. package/dist-esm/storage-file-share/src/index.browser.js.map +0 -1
  953. package/dist-esm/storage-file-share/src/index.js +0 -30
  954. package/dist-esm/storage-file-share/src/index.js.map +0 -1
  955. package/dist-esm/storage-file-share/src/log.js.map +0 -1
  956. package/dist-esm/storage-file-share/src/models.js +0 -94
  957. package/dist-esm/storage-file-share/src/models.js.map +0 -1
  958. package/dist-esm/storage-file-share/src/policies/StorageRetryPolicy.js +0 -220
  959. package/dist-esm/storage-file-share/src/policies/StorageRetryPolicy.js.map +0 -1
  960. package/dist-esm/storage-file-share/src/policies/StorageRetryPolicyV2.js +0 -176
  961. package/dist-esm/storage-file-share/src/policies/StorageRetryPolicyV2.js.map +0 -1
  962. package/dist-esm/storage-file-share/src/utils/Batch.js.map +0 -1
  963. package/dist-esm/storage-file-share/src/utils/BufferScheduler.js.map +0 -1
  964. package/dist-esm/storage-file-share/src/utils/RetriableReadableStream.js +0 -119
  965. package/dist-esm/storage-file-share/src/utils/RetriableReadableStream.js.map +0 -1
  966. package/dist-esm/storage-file-share/src/utils/constants.js +0 -162
  967. package/dist-esm/storage-file-share/src/utils/constants.js.map +0 -1
  968. package/dist-esm/storage-file-share/src/utils/tracing.js +0 -14
  969. package/dist-esm/storage-file-share/src/utils/tracing.js.map +0 -1
  970. package/dist-esm/storage-file-share/src/utils/utils.browser.js +0 -30
  971. package/dist-esm/storage-file-share/src/utils/utils.browser.js.map +0 -1
  972. package/dist-esm/storage-file-share/src/utils/utils.common.js +0 -777
  973. package/dist-esm/storage-file-share/src/utils/utils.common.js.map +0 -1
  974. package/dist-esm/storage-file-share/src/utils/utils.node.js +0 -79
  975. package/dist-esm/storage-file-share/src/utils/utils.node.js.map +0 -1
  976. package/types/latest/storage-file-share.d.ts +0 -8411
  977. /package/{dist-esm/storage-file-share/src → dist/browser}/AccountSASPermissions.js +0 -0
  978. /package/{dist-esm/storage-blob/src/sas → dist/browser}/AccountSASResourceTypes.js +0 -0
  979. /package/{dist-esm/storage-blob/src/sas → dist/browser}/AccountSASServices.js +0 -0
  980. /package/{dist-esm/storage-file-share/src → dist/browser}/FileSASPermissions.js +0 -0
  981. /package/{dist-esm/storage-file-share/src → dist/browser}/FileSystemAttributes.js +0 -0
  982. /package/{dist-esm/storage-file-share/src → dist/browser}/Range.js +0 -0
  983. /package/{dist-esm/storage-file-share/src → dist/browser}/SasIPRange.js +0 -0
  984. /package/{dist-esm/storage-file-share/src → dist/browser}/ShareSASPermissions.js +0 -0
  985. /package/{dist-esm/storage-file-share/src → dist/browser}/generated/src/models/index.js +0 -0
  986. /package/{dist-esm/storage-file-share/src → dist/browser}/generated/src/models/mappers.js +0 -0
  987. /package/{dist-esm/storage-file-share/src → dist/browser}/generated/src/operationsInterfaces/directory.js +0 -0
  988. /package/{dist-esm/storage-file-share/src → dist/browser}/generated/src/operationsInterfaces/file.js +0 -0
  989. /package/{dist-esm/storage-blob/src → dist/browser}/generated/src/operationsInterfaces/service.js +0 -0
  990. /package/{dist-esm/storage-file-share/src → dist/browser}/generated/src/operationsInterfaces/share.js +0 -0
  991. /package/{dist-esm/storage-file-share/src → dist/browser}/generatedModels.js +0 -0
  992. /package/{dist-esm/storage-file-share/src → dist/browser}/log.js +0 -0
  993. /package/{dist-esm/storage-blob/src → dist/browser}/utils/Batch.js +0 -0
  994. /package/{dist-esm/storage-file-share/src → dist/browser}/utils/BufferScheduler.js +0 -0
  995. /package/{dist-esm/storage-file-share/src → dist/esm}/AccountSASResourceTypes.js +0 -0
  996. /package/{dist-esm/storage-file-share/src → dist/esm}/AccountSASServices.js +0 -0
  997. /package/{dist-esm/storage-file-share/src → dist/esm}/generated/src/operationsInterfaces/service.js +0 -0
  998. /package/{dist-esm/storage-file-share/src → dist/esm}/utils/Batch.js +0 -0
@@ -0,0 +1,2882 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ import { __asyncGenerator, __asyncValues, __await } from "tslib";
4
+ import { isTokenCredential } from "@azure/core-auth";
5
+ import { isNodeLike } from "@azure/core-util";
6
+ import { isPipelineLike, newPipeline } from "./Pipeline.js";
7
+ import { DEFAULT_MAX_DOWNLOAD_RETRY_REQUESTS, DEFAULT_HIGH_LEVEL_CONCURRENCY, FILE_MAX_SIZE_BYTES, FILE_RANGE_MAX_SIZE_BYTES, URLConstants, } from "./utils/constants.js";
8
+ import { appendToURLPath, setURLParameter, truncatedISO8061Date, extractConnectionStringParts, getShareNameAndPathFromUrl, appendToURLQuery, httpAuthorizationToString, setURLPath, setURLQueries, EscapePath, ConvertInternalResponseOfListFiles, ConvertInternalResponseOfListHandles, assertResponse, removeEmptyString, asSharePermission, parseOctalFileMode, toOctalFileMode, } from "./utils/utils.common.js";
9
+ import { Credential } from "@azure/storage-blob";
10
+ import { StorageSharedKeyCredential } from "@azure/storage-blob";
11
+ import { AnonymousCredential } from "@azure/storage-blob";
12
+ import { tracingClient } from "./utils/tracing.js";
13
+ import { StorageClient } from "./StorageClient.js";
14
+ import { FileDownloadResponse } from "./FileDownloadResponse.js";
15
+ import { rangeToString } from "./Range.js";
16
+ import { fileAttributesToString, fileCreationTimeToString, fileLastWriteTimeToString, validateAndSetDefaultsForFileAndDirectoryCreateCommonOptions, validateAndSetDefaultsForFileAndDirectorySetPropertiesCommonOptions, toShareProtocolsString, toShareProtocols, fileChangeTimeToString, } from "./models.js";
17
+ import { Batch } from "./utils/Batch.js";
18
+ import { BufferScheduler } from "./utils/BufferScheduler.js";
19
+ import { fsStat, fsCreateReadStream, readStreamToLocalFile, streamToBuffer, } from "./utils/utils.js";
20
+ import { randomUUID } from "@azure/core-util";
21
+ import { generateFileSASQueryParameters, generateFileSASQueryParametersInternal, } from "./FileSASSignatureValues.js";
22
+ /**
23
+ * A ShareClient represents a URL to the Azure Storage share allowing you to manipulate its directories and files.
24
+ */
25
+ export class ShareClient extends StorageClient {
26
+ /**
27
+ * The name of the share
28
+ */
29
+ get name() {
30
+ return this._name;
31
+ }
32
+ constructor(urlOrConnectionString, credentialOrPipelineOrShareName,
33
+ // Legacy, no way to fix the eslint error without breaking. Disable the rule for this line.
34
+ options) {
35
+ let pipeline;
36
+ let url;
37
+ if (isPipelineLike(credentialOrPipelineOrShareName)) {
38
+ // (url: string, pipeline: Pipeline)
39
+ url = urlOrConnectionString;
40
+ pipeline = credentialOrPipelineOrShareName;
41
+ }
42
+ else if (credentialOrPipelineOrShareName instanceof Credential ||
43
+ isTokenCredential(credentialOrPipelineOrShareName)) {
44
+ // (url: string, credential?: Credential, options?: ShareClientOptions)
45
+ url = urlOrConnectionString;
46
+ pipeline = newPipeline(credentialOrPipelineOrShareName, options);
47
+ }
48
+ else if (!credentialOrPipelineOrShareName &&
49
+ typeof credentialOrPipelineOrShareName !== "string") {
50
+ // (url: string, credential?: Credential, options?: ShareClientOptions)
51
+ // The second parameter is undefined. Use anonymous credential.
52
+ url = urlOrConnectionString;
53
+ pipeline = newPipeline(new AnonymousCredential(), options);
54
+ }
55
+ else if (credentialOrPipelineOrShareName &&
56
+ typeof credentialOrPipelineOrShareName === "string") {
57
+ // (connectionString: string, name: string, options?: ShareClientOptions)
58
+ const extractedCreds = extractConnectionStringParts(urlOrConnectionString);
59
+ const name = credentialOrPipelineOrShareName;
60
+ if (extractedCreds.kind === "AccountConnString") {
61
+ if (isNodeLike) {
62
+ const sharedKeyCredential = new StorageSharedKeyCredential(extractedCreds.accountName, extractedCreds.accountKey);
63
+ url = appendToURLPath(extractedCreds.url, name);
64
+ pipeline = newPipeline(sharedKeyCredential, options);
65
+ }
66
+ else {
67
+ throw new Error("Account connection string is only supported in Node.js environment");
68
+ }
69
+ }
70
+ else if (extractedCreds.kind === "SASConnString") {
71
+ url = appendToURLPath(extractedCreds.url, name) + "?" + extractedCreds.accountSas;
72
+ pipeline = newPipeline(new AnonymousCredential(), options);
73
+ }
74
+ else {
75
+ throw new Error("Connection string must be either an Account connection string or a SAS connection string");
76
+ }
77
+ }
78
+ else {
79
+ throw new Error("Expecting non-empty strings for name parameter");
80
+ }
81
+ super(url, pipeline);
82
+ this._name = getShareNameAndPathFromUrl(this.url).shareName;
83
+ this.shareClientConfig = options;
84
+ this.context = this.storageClientContext.share;
85
+ }
86
+ /**
87
+ * Creates a new ShareClient object identical to the source but with the specified snapshot timestamp.
88
+ * Provide "" will remove the snapshot and return a URL to the base share.
89
+ *
90
+ * @param snapshot - The snapshot timestamp.
91
+ * @returns A new ShareClient object identical to the source but with the specified snapshot timestamp
92
+ */
93
+ withSnapshot(snapshot) {
94
+ return new ShareClient(setURLParameter(this.url, URLConstants.Parameters.SHARE_SNAPSHOT, snapshot.length === 0 ? undefined : snapshot), this.pipeline, this.shareClientConfig);
95
+ }
96
+ /**
97
+ * Creates a new share under the specified account. If the share with
98
+ * the same name already exists, the operation fails.
99
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/create-share
100
+ *
101
+ * @param options - Options to Share Create operation.
102
+ * @returns Response data for the Share Create operation.
103
+ */
104
+ async create(options = {}) {
105
+ return tracingClient.withSpan("ShareClient-create", options, async (updatedOptions) => {
106
+ return assertResponse(await this.context.create(Object.assign(Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig), { enabledProtocols: toShareProtocolsString(updatedOptions.protocols) })));
107
+ });
108
+ }
109
+ /**
110
+ * Creates a new share under the specified account. If the share with
111
+ * the same name already exists, it is not changed.
112
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/create-share
113
+ *
114
+ * @param options -
115
+ */
116
+ async createIfNotExists(options = {}) {
117
+ return tracingClient.withSpan("ShareClient-createIfNotExists", options, async (updatedOptions) => {
118
+ var _a, _b;
119
+ try {
120
+ const res = await this.create(updatedOptions);
121
+ return Object.assign({ succeeded: true }, res);
122
+ }
123
+ catch (e) {
124
+ if (((_a = e.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "ShareAlreadyExists") {
125
+ return Object.assign(Object.assign({ succeeded: false }, (_b = e.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e.response });
126
+ }
127
+ throw e;
128
+ }
129
+ });
130
+ }
131
+ /**
132
+ * Creates a {@link ShareDirectoryClient} object.
133
+ *
134
+ * @param directoryName - A directory name
135
+ * @returns The ShareDirectoryClient object for the given directory name.
136
+ */
137
+ // Legacy, no way to fix the eslint error without breaking. Disable the rule for this line.
138
+ /* eslint-disable-next-line @azure/azure-sdk/ts-naming-subclients */
139
+ getDirectoryClient(directoryName) {
140
+ return new ShareDirectoryClient(appendToURLPath(this.url, EscapePath(directoryName)), this.pipeline, this.shareClientConfig);
141
+ }
142
+ /**
143
+ * Gets the directory client for the root directory of this share.
144
+ * Note that the root directory always exists and cannot be deleted.
145
+ *
146
+ * @readonly A new ShareDirectoryClient object for the root directory.
147
+ */
148
+ // Legacy, no way to fix the eslint error without breaking. Disable the rule for this line.
149
+ /* eslint-disable-next-line @azure/azure-sdk/ts-naming-subclients */
150
+ get rootDirectoryClient() {
151
+ return this.getDirectoryClient("");
152
+ }
153
+ /**
154
+ * Creates a new subdirectory under this share.
155
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/create-directory
156
+ *
157
+ * @param directoryName -
158
+ * @param options - Options to Directory Create operation.
159
+ * @returns Directory creation response data and the corresponding directory client.
160
+ */
161
+ async createDirectory(directoryName, options = {}) {
162
+ return tracingClient.withSpan("ShareClient-createDirectory", options, async (updatedOptions) => {
163
+ const directoryClient = this.getDirectoryClient(directoryName);
164
+ const directoryCreateResponse = await directoryClient.create(updatedOptions);
165
+ return {
166
+ directoryClient,
167
+ directoryCreateResponse,
168
+ };
169
+ });
170
+ }
171
+ /**
172
+ * Removes the specified empty sub directory under this share.
173
+ * Note that the directory must be empty before it can be deleted.
174
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/delete-directory
175
+ *
176
+ * @param directoryName -
177
+ * @param options - Options to Directory Delete operation.
178
+ * @returns Directory deletion response data.
179
+ */
180
+ async deleteDirectory(directoryName, options = {}) {
181
+ return tracingClient.withSpan("ShareClient-deleteDirectory", options, async (updatedOptions) => {
182
+ const directoryClient = this.getDirectoryClient(directoryName);
183
+ return directoryClient.delete(updatedOptions);
184
+ });
185
+ }
186
+ /**
187
+ * Creates a new file or replaces a file under the root directory of this share.
188
+ * Note it only initializes the file with no content.
189
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/create-file
190
+ *
191
+ * @param fileName -
192
+ * @param size - Specifies the maximum size in bytes for the file, up to 4 TB.
193
+ * @param options - Options to File Create operation.
194
+ * @returns File creation response data and the corresponding file client.
195
+ */
196
+ async createFile(fileName, size, options = {}) {
197
+ return tracingClient.withSpan("ShareClient-createFile", options, async (updatedOptions) => {
198
+ const directoryClient = this.rootDirectoryClient;
199
+ const fileClient = directoryClient.getFileClient(fileName);
200
+ const fileCreateResponse = await fileClient.create(size, updatedOptions);
201
+ return {
202
+ fileClient,
203
+ fileCreateResponse,
204
+ };
205
+ });
206
+ }
207
+ /**
208
+ * Removes a file under the root directory of this share from the storage account.
209
+ * When a file is successfully deleted, it is immediately removed from the storage
210
+ * account's index and is no longer accessible to clients. The file's data is later
211
+ * removed from the service during garbage collection.
212
+ *
213
+ * Delete File will fail with status code 409 (Conflict) and error code `SharingViolation`
214
+ * if the file is open on an SMB client.
215
+ *
216
+ * Delete File is not supported on a share snapshot, which is a read-only copy of
217
+ * a share. An attempt to perform this operation on a share snapshot will fail with 400
218
+ * (`InvalidQueryParameterValue`)
219
+ *
220
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/delete-file2
221
+ *
222
+ * @param directoryName -
223
+ * @param fileName -
224
+ * @param options - Options to File Delete operation.
225
+ * @returns Promise<FileDeleteResponse> File Delete response data.
226
+ */
227
+ async deleteFile(fileName, options = {}) {
228
+ return tracingClient.withSpan("ShareClient-deleteFile", options, async (updatedOptions) => {
229
+ const directoryClient = this.rootDirectoryClient;
230
+ const fileClient = directoryClient.getFileClient(fileName);
231
+ return fileClient.delete(updatedOptions);
232
+ });
233
+ }
234
+ /**
235
+ * Returns true if the Azrue share resource represented by this client exists; false otherwise.
236
+ *
237
+ * NOTE: use this function with care since an existing share might be deleted by other clients or
238
+ * applications. Vice versa new shares might be added by other clients or applications after this
239
+ * function completes.
240
+ *
241
+ * @param options - options to Exists operation.
242
+ */
243
+ async exists(options = {}) {
244
+ return tracingClient.withSpan("ShareClient-exists", options, async (updatedOptions) => {
245
+ try {
246
+ await this.getProperties(updatedOptions);
247
+ return true;
248
+ }
249
+ catch (e) {
250
+ if (e.statusCode === 404) {
251
+ return false;
252
+ }
253
+ throw e;
254
+ }
255
+ });
256
+ }
257
+ /**
258
+ * Returns all user-defined metadata and system properties for the specified
259
+ * share.
260
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/get-share-properties
261
+ *
262
+ * WARNING: The `metadata` object returned in the response will have its keys in lowercase, even if
263
+ * they originally contained uppercase characters. This differs from the metadata keys returned by
264
+ * the `listShares` method of {@link ShareServiceClient} using the `includeMetadata` option, which
265
+ * will retain their original casing.
266
+ *
267
+ * @returns Response data for the Share Get Properties operation.
268
+ */
269
+ async getProperties(options = {}) {
270
+ return tracingClient.withSpan("ShareClient-getProperties", options, async (updatedOptions) => {
271
+ const res = assertResponse(await this.context.getProperties(updatedOptions));
272
+ return Object.assign(Object.assign(Object.assign({}, res), this.shareClientConfig), { protocols: toShareProtocols(res.enabledProtocols) });
273
+ });
274
+ }
275
+ /**
276
+ * Marks the specified share for deletion. The share and any directories or files
277
+ * contained within it are later deleted during garbage collection.
278
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/delete-share
279
+ *
280
+ * @param options - Options to Share Delete operation.
281
+ * @returns Response data for the Share Delete operation.
282
+ */
283
+ async delete(options = {}) {
284
+ return tracingClient.withSpan("ShareClient-delete", options, async (updatedOptions) => {
285
+ return assertResponse(await this.context.delete(Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig)));
286
+ });
287
+ }
288
+ /**
289
+ * Marks the specified share for deletion if it exists. The share and any directories or files
290
+ * contained within it are later deleted during garbage collection.
291
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/delete-share
292
+ *
293
+ * @param options -
294
+ */
295
+ async deleteIfExists(options = {}) {
296
+ return tracingClient.withSpan("ShareClient-deleteIfExists", options, async (updatedOptions) => {
297
+ var _a, _b;
298
+ try {
299
+ const res = await this.delete(updatedOptions);
300
+ return Object.assign({ succeeded: true }, res);
301
+ }
302
+ catch (e) {
303
+ if (((_a = e.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "ShareNotFound") {
304
+ return Object.assign(Object.assign({ succeeded: false }, (_b = e.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e.response });
305
+ }
306
+ throw e;
307
+ }
308
+ });
309
+ }
310
+ /**
311
+ * Sets one or more user-defined name-value pairs for the specified share.
312
+ *
313
+ * If no option provided, or no metadata defined in the option parameter, the share
314
+ * metadata will be removed.
315
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/set-share-metadata
316
+ *
317
+ * @param metadata - If no metadata provided, all existing directory metadata will be removed.
318
+ * @param option - Options to Share Set Metadata operation.
319
+ * @returns Response data for the Share Set Metadata operation.
320
+ */
321
+ async setMetadata(metadata, options = {}) {
322
+ return tracingClient.withSpan("ShareClient-setMetadata", options, async (updatedOptions) => {
323
+ return assertResponse(await this.context.setMetadata(Object.assign(Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig), { metadata })));
324
+ });
325
+ }
326
+ /**
327
+ * Gets the permissions for the specified share. The permissions indicate
328
+ * whether share data may be accessed publicly.
329
+ *
330
+ * WARNING: JavaScript Date will potential lost precision when parsing start and expiry string.
331
+ * For example, new Date("2018-12-31T03:44:23.8827891Z").toISOString() will get "2018-12-31T03:44:23.882Z".
332
+ *
333
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/get-share-acl
334
+ *
335
+ * @param option - Options to Share Get Access Policy operation.
336
+ * @returns Response data for the Share Get Access Policy operation.
337
+ */
338
+ async getAccessPolicy(options = {}) {
339
+ return tracingClient.withSpan("ShareClient-getAccessPolicy", options, async (updatedOptions) => {
340
+ const response = assertResponse(await this.context.getAccessPolicy(Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig)));
341
+ const res = {
342
+ _response: response._response,
343
+ date: response.date,
344
+ etag: response.etag,
345
+ lastModified: response.lastModified,
346
+ requestId: response.requestId,
347
+ signedIdentifiers: [],
348
+ version: response.version,
349
+ };
350
+ for (const identifier of response) {
351
+ let accessPolicy = undefined;
352
+ if (identifier.accessPolicy) {
353
+ accessPolicy = {
354
+ permissions: identifier.accessPolicy.permissions,
355
+ };
356
+ if (identifier.accessPolicy.expiresOn) {
357
+ accessPolicy.expiresOn = new Date(identifier.accessPolicy.expiresOn);
358
+ }
359
+ if (identifier.accessPolicy.startsOn) {
360
+ accessPolicy.startsOn = new Date(identifier.accessPolicy.startsOn);
361
+ }
362
+ }
363
+ res.signedIdentifiers.push({
364
+ accessPolicy,
365
+ id: identifier.id,
366
+ });
367
+ }
368
+ return res;
369
+ });
370
+ }
371
+ /**
372
+ * Sets the permissions for the specified share. The permissions indicate
373
+ * whether directories or files in a share may be accessed publicly.
374
+ *
375
+ * When you set permissions for a share, the existing permissions are replaced.
376
+ * If no shareAcl provided, the existing share ACL will be
377
+ * removed.
378
+ *
379
+ * When you establish a stored access policy on a share, it may take up to 30 seconds to take effect.
380
+ * During this interval, a shared access signature that is associated with the stored access policy will
381
+ * fail with status code 403 (Forbidden), until the access policy becomes active.
382
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/set-share-acl
383
+ *
384
+ * @param shareAcl - Array of signed identifiers, each having a unique Id and details of access policy.
385
+ * @param option - Options to Share Set Access Policy operation.
386
+ * @returns Response data for the Share Set Access Policy operation.
387
+ */
388
+ async setAccessPolicy(shareAcl, options = {}) {
389
+ return tracingClient.withSpan("ShareClient-setAccessPolicy", options, async (updatedOptions) => {
390
+ var _a, _b, _c;
391
+ const acl = [];
392
+ for (const identifier of shareAcl || []) {
393
+ acl.push({
394
+ accessPolicy: {
395
+ expiresOn: ((_a = identifier.accessPolicy) === null || _a === void 0 ? void 0 : _a.expiresOn)
396
+ ? truncatedISO8061Date(identifier.accessPolicy.expiresOn)
397
+ : undefined,
398
+ permissions: (_b = identifier.accessPolicy) === null || _b === void 0 ? void 0 : _b.permissions,
399
+ startsOn: ((_c = identifier.accessPolicy) === null || _c === void 0 ? void 0 : _c.startsOn)
400
+ ? truncatedISO8061Date(identifier.accessPolicy.startsOn)
401
+ : undefined,
402
+ },
403
+ id: identifier.id,
404
+ });
405
+ }
406
+ return assertResponse(await this.context.setAccessPolicy(Object.assign(Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig), { shareAcl: acl })));
407
+ });
408
+ }
409
+ /**
410
+ * Creates a read-only snapshot of a share.
411
+ *
412
+ * @param options - Options to Share Create Snapshot operation.
413
+ * @returns Response data for the Share Create Snapshot operation.
414
+ */
415
+ async createSnapshot(options = {}) {
416
+ return tracingClient.withSpan("ShareClient-createSnapshot", options, async (updatedOptions) => {
417
+ return assertResponse(await this.context.createSnapshot(Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig)));
418
+ });
419
+ }
420
+ /**
421
+ * Sets quota for the specified share.
422
+ *
423
+ * @deprecated Use {@link ShareClient.setProperties} instead.
424
+ *
425
+ * @param quotaInGB - Specifies the maximum size of the share in gigabytes
426
+ * @param option - Options to Share Set Quota operation.
427
+ * @returns Response data for the Share Get Quota operation.
428
+ */
429
+ async setQuota(quotaInGB, options = {}) {
430
+ return tracingClient.withSpan("ShareClient-setQuota", options, async (updatedOptions) => {
431
+ return assertResponse(await this.context.setProperties(Object.assign(Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig), { quota: quotaInGB })));
432
+ });
433
+ }
434
+ /**
435
+ * Sets properties of the share.
436
+ *
437
+ * @param option - Options to Share Set Properties operation.
438
+ * @returns Response data for the Share Set Properties operation.
439
+ */
440
+ async setProperties(options = {}) {
441
+ return tracingClient.withSpan("ShareClient-setProperties", options, async (updatedOptions) => {
442
+ return assertResponse(await this.context.setProperties(Object.assign(Object.assign(Object.assign({}, options), this.shareClientConfig), { quota: options.quotaInGB, tracingOptions: updatedOptions.tracingOptions })));
443
+ });
444
+ }
445
+ /**
446
+ * Retrieves statistics related to the share.
447
+ *
448
+ * @param option - Options to Share Get Statistics operation.
449
+ * @returns Response data for the Share Get Statistics operation.
450
+ */
451
+ async getStatistics(options = {}) {
452
+ return tracingClient.withSpan("ShareClient-getStatistics", options, async (updatedOptions) => {
453
+ const response = assertResponse(await this.context.getStatistics(Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig)));
454
+ const GBBytes = 1024 * 1024 * 1024;
455
+ return Object.assign(Object.assign({}, response), { shareUsage: Math.ceil(response.shareUsageBytes / GBBytes) });
456
+ });
457
+ }
458
+ /**
459
+ * Creates a file permission (a security descriptor) at the share level.
460
+ * The created security descriptor can be used for the files/directories in the share.
461
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/create-permission
462
+ *
463
+ * @param options - Options to Share Create Permission operation.
464
+ * @param filePermission - File permission described in the SDDL
465
+ */
466
+ async createPermission(filePermission, options = {}) {
467
+ return tracingClient.withSpan("ShareClient-createPermission", options, async (updatedOptions) => {
468
+ return assertResponse(await this.context.createPermission(asSharePermission(filePermission), Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig)));
469
+ });
470
+ }
471
+ /**
472
+ * Gets the Security Descriptor Definition Language (SDDL) for a given file permission key
473
+ * which indicates a security descriptor.
474
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/get-permission
475
+ *
476
+ * @param options - Options to Share Create Permission operation.
477
+ * @param filePermissionKey - File permission key which indicates the security descriptor of the permission.
478
+ */
479
+ async getPermission(filePermissionKey, options = {}) {
480
+ return tracingClient.withSpan("ShareClient-getPermission", options, async (updatedOptions) => {
481
+ return assertResponse(await this.context.getPermission(filePermissionKey, Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig)));
482
+ });
483
+ }
484
+ /**
485
+ * Get a {@link ShareLeaseClient} that manages leases on the file.
486
+ *
487
+ * @param proposeLeaseId - Initial proposed lease Id.
488
+ * @returns A new ShareLeaseClient object for managing leases on the file.
489
+ */
490
+ getShareLeaseClient(proposeLeaseId) {
491
+ return new ShareLeaseClient(this, proposeLeaseId);
492
+ }
493
+ /**
494
+ * Only available for ShareClient constructed with a shared key credential.
495
+ *
496
+ * Generates a Service Shared Access Signature (SAS) URI based on the client properties
497
+ * and parameters passed in. The SAS is signed by the shared key credential of the client.
498
+ *
499
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas
500
+ *
501
+ * @param options - Optional parameters.
502
+ * @returns The SAS URI consisting of the URI to the resource represented by this client, followed by the generated SAS token.
503
+ */
504
+ generateSasUrl(options) {
505
+ if (!(this.credential instanceof StorageSharedKeyCredential)) {
506
+ throw RangeError("Can only generate the SAS when the client is initialized with a shared key credential");
507
+ }
508
+ const sas = generateFileSASQueryParameters(Object.assign({ shareName: this.name }, options), this.credential).toString();
509
+ return appendToURLQuery(this.url, sas);
510
+ }
511
+ /**
512
+ * Only available for ShareClient constructed with a shared key credential.
513
+ *
514
+ * Generates string to sign for a Service Shared Access Signature (SAS) URI based on the client properties
515
+ * and parameters passed in. The SAS is signed by the shared key credential of the client.
516
+ *
517
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas
518
+ *
519
+ * @param options - Optional parameters.
520
+ * @returns The SAS URI consisting of the URI to the resource represented by this client, followed by the generated SAS token.
521
+ */
522
+ /* eslint-disable-next-line @azure/azure-sdk/ts-naming-options*/
523
+ generateSasStringToSign(options) {
524
+ if (!(this.credential instanceof StorageSharedKeyCredential)) {
525
+ throw RangeError("Can only generate the SAS when the client is initialized with a shared key credential");
526
+ }
527
+ return generateFileSASQueryParametersInternal(Object.assign({ shareName: this.name }, options), this.credential).stringToSign;
528
+ }
529
+ }
530
+ /**
531
+ * A ShareDirectoryClient represents a URL to the Azure Storage directory allowing you to manipulate its files and directories.
532
+ */
533
+ export class ShareDirectoryClient extends StorageClient {
534
+ /**
535
+ * The share name corresponding to this directory client
536
+ */
537
+ get shareName() {
538
+ return this._shareName;
539
+ }
540
+ /**
541
+ * The full path of the directory
542
+ */
543
+ get path() {
544
+ return this._path;
545
+ }
546
+ /**
547
+ * The name of the directory
548
+ */
549
+ get name() {
550
+ return this._name;
551
+ }
552
+ constructor(url, credentialOrPipeline,
553
+ // Legacy, no way to fix the eslint error without breaking. Disable the rule for this line.
554
+ /* eslint-disable-next-line @azure/azure-sdk/ts-naming-options */
555
+ options = {}) {
556
+ let pipeline;
557
+ if (isPipelineLike(credentialOrPipeline)) {
558
+ pipeline = credentialOrPipeline;
559
+ }
560
+ else if (credentialOrPipeline instanceof Credential ||
561
+ isTokenCredential(credentialOrPipeline)) {
562
+ pipeline = newPipeline(credentialOrPipeline, options);
563
+ }
564
+ else {
565
+ // The second parameter is undefined. Use anonymous credential.
566
+ pipeline = newPipeline(new AnonymousCredential(), options);
567
+ }
568
+ super(url, pipeline);
569
+ ({
570
+ baseName: this._name,
571
+ shareName: this._shareName,
572
+ path: this._path,
573
+ } = getShareNameAndPathFromUrl(this.url));
574
+ this.shareClientConfig = options;
575
+ this.context = this.storageClientContext.directory;
576
+ }
577
+ /**
578
+ * Creates a new directory under the specified share or parent directory.
579
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/create-directory
580
+ *
581
+ * @param options - Options to Directory Create operation.
582
+ * @returns Response data for the Directory operation.
583
+ */
584
+ async create(options = {}) {
585
+ if (!options.fileAttributes) {
586
+ options = validateAndSetDefaultsForFileAndDirectoryCreateCommonOptions(options);
587
+ }
588
+ return tracingClient.withSpan("ShareDirectoryClient-create", options, async (updatedOptions) => {
589
+ var _a, _b, _c;
590
+ const rawResponse = await this.context.create(Object.assign(Object.assign(Object.assign({}, updatedOptions), { fileChangeOn: fileChangeTimeToString(updatedOptions.changeTime), fileCreatedOn: fileCreationTimeToString(updatedOptions.creationTime), fileLastWriteOn: fileLastWriteTimeToString(updatedOptions.lastWriteTime), fileAttributes: updatedOptions.fileAttributes
591
+ ? fileAttributesToString(updatedOptions.fileAttributes)
592
+ : undefined, owner: (_a = updatedOptions.posixProperties) === null || _a === void 0 ? void 0 : _a.owner, group: (_b = updatedOptions.posixProperties) === null || _b === void 0 ? void 0 : _b.group, fileMode: toOctalFileMode((_c = updatedOptions.posixProperties) === null || _c === void 0 ? void 0 : _c.fileMode) }), this.shareClientConfig));
593
+ const wrappedRes = Object.assign(Object.assign({}, rawResponse), { _response: rawResponse._response, posixProperties: {
594
+ fileMode: parseOctalFileMode(rawResponse.fileMode),
595
+ fileType: rawResponse.nfsFileType,
596
+ owner: rawResponse.owner,
597
+ group: rawResponse.group,
598
+ } });
599
+ return assertResponse(wrappedRes);
600
+ });
601
+ }
602
+ /**
603
+ * Creates a new directory under the specified share or parent directory if it does not already exists.
604
+ * If the directory already exists, it is not modified.
605
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/create-directory
606
+ *
607
+ * @param options -
608
+ */
609
+ async createIfNotExists(options = {}) {
610
+ return tracingClient.withSpan("ShareDirectoryClient-createIfNotExists", options, async (updatedOptions) => {
611
+ var _a, _b;
612
+ try {
613
+ const res = await this.create(updatedOptions);
614
+ return Object.assign({ succeeded: true }, res);
615
+ }
616
+ catch (e) {
617
+ if (((_a = e.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "ResourceAlreadyExists") {
618
+ return Object.assign(Object.assign({ succeeded: false }, (_b = e.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e.response });
619
+ }
620
+ throw e;
621
+ }
622
+ });
623
+ }
624
+ /**
625
+ * Sets properties on the directory.
626
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/set-directory-properties
627
+ *
628
+ * @param DirectoryProperties - Directory properties. If no values are provided,
629
+ * existing values will be preserved.
630
+ */
631
+ async setProperties(properties = {}) {
632
+ properties = validateAndSetDefaultsForFileAndDirectorySetPropertiesCommonOptions(properties);
633
+ return tracingClient.withSpan("ShareDirectoryClient-setProperties", properties, async (updatedOptions) => {
634
+ var _a, _b, _c;
635
+ const rawResponse = await this.context.setProperties(Object.assign(Object.assign(Object.assign({}, updatedOptions), { fileChangeOn: fileChangeTimeToString(updatedOptions.changeTime), fileCreatedOn: fileCreationTimeToString(updatedOptions.creationTime), fileLastWriteOn: fileLastWriteTimeToString(updatedOptions.lastWriteTime), fileAttributes: updatedOptions.fileAttributes
636
+ ? fileAttributesToString(updatedOptions.fileAttributes)
637
+ : undefined, owner: (_a = updatedOptions.posixProperties) === null || _a === void 0 ? void 0 : _a.owner, group: (_b = updatedOptions.posixProperties) === null || _b === void 0 ? void 0 : _b.group, fileMode: toOctalFileMode((_c = updatedOptions.posixProperties) === null || _c === void 0 ? void 0 : _c.fileMode) }), this.shareClientConfig));
638
+ return assertResponse(Object.assign(Object.assign({}, rawResponse), { _response: rawResponse._response, posixProperties: {
639
+ fileMode: parseOctalFileMode(rawResponse.fileMode),
640
+ owner: rawResponse.owner,
641
+ group: rawResponse.group,
642
+ } }));
643
+ });
644
+ }
645
+ /**
646
+ * Creates a ShareDirectoryClient object for a sub directory.
647
+ *
648
+ * @param subDirectoryName - A subdirectory name
649
+ * @returns The ShareDirectoryClient object for the given subdirectory name.
650
+ *
651
+ * Example usage:
652
+ *
653
+ * ```ts snippet:ReadmeSampleGetDirectoryClient
654
+ * import { StorageSharedKeyCredential, ShareServiceClient } from "@azure/storage-file-share";
655
+ *
656
+ * const account = "<account>";
657
+ * const accountKey = "<accountkey>";
658
+ *
659
+ * const credential = new StorageSharedKeyCredential(account, accountKey);
660
+ * const serviceClient = new ShareServiceClient(
661
+ * `https://${account}.file.core.windows.net`,
662
+ * credential,
663
+ * );
664
+ *
665
+ * const shareName = "<share name>";
666
+ * const directoryName = "<directory name>";
667
+ * const shareClient = serviceClient.getShareClient(shareName);
668
+ * const directoryClient = shareClient.getDirectoryClient(directoryName);
669
+ * await directoryClient.create();
670
+ * ```
671
+ */
672
+ getDirectoryClient(subDirectoryName) {
673
+ return new ShareDirectoryClient(appendToURLPath(this.url, EscapePath(subDirectoryName)), this.pipeline, this.shareClientConfig);
674
+ }
675
+ /**
676
+ * Creates a new subdirectory under this directory.
677
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/create-directory
678
+ *
679
+ * @param directoryName -
680
+ * @param options - Options to Directory Create operation.
681
+ * @returns Directory create response data and the corresponding DirectoryClient instance.
682
+ */
683
+ async createSubdirectory(directoryName, options = {}) {
684
+ return tracingClient.withSpan("ShareDirectoryClient-createSubdirectory", options, async (updatedOptions) => {
685
+ const directoryClient = this.getDirectoryClient(directoryName);
686
+ const directoryCreateResponse = await directoryClient.create(updatedOptions);
687
+ return {
688
+ directoryClient,
689
+ directoryCreateResponse,
690
+ };
691
+ });
692
+ }
693
+ /**
694
+ * Removes the specified empty sub directory under this directory.
695
+ * Note that the directory must be empty before it can be deleted.
696
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/delete-directory
697
+ *
698
+ * @param directoryName -
699
+ * @param options - Options to Directory Delete operation.
700
+ * @returns Directory deletion response data.
701
+ */
702
+ async deleteSubdirectory(directoryName, options = {}) {
703
+ return tracingClient.withSpan("ShareDirectoryClient-deleteSubdirectory", options, async (updatedOptions) => {
704
+ const directoryClient = this.getDirectoryClient(directoryName);
705
+ return directoryClient.delete(updatedOptions);
706
+ });
707
+ }
708
+ /**
709
+ * Creates a new file or replaces a file under this directory. Note it only initializes the file with no content.
710
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/create-file
711
+ *
712
+ * @param fileName -
713
+ * @param size - Specifies the maximum size in bytes for the file, up to 4 TB.
714
+ * @param options - Options to File Create operation.
715
+ * @returns File creation response data and the corresponding file client.
716
+ */
717
+ async createFile(fileName, size, options = {}) {
718
+ return tracingClient.withSpan("ShareDirectoryClient-createFile", options, async (updatedOptions) => {
719
+ const fileClient = this.getFileClient(fileName);
720
+ const fileCreateResponse = await fileClient.create(size, updatedOptions);
721
+ return {
722
+ fileClient,
723
+ fileCreateResponse,
724
+ };
725
+ });
726
+ }
727
+ /**
728
+ * Removes the specified file under this directory from the storage account.
729
+ * When a file is successfully deleted, it is immediately removed from the storage
730
+ * account's index and is no longer accessible to clients. The file's data is later
731
+ * removed from the service during garbage collection.
732
+ *
733
+ * Delete File will fail with status code 409 (Conflict) and error code SharingViolation
734
+ * if the file is open on an SMB client.
735
+ *
736
+ * Delete File is not supported on a share snapshot, which is a read-only copy of
737
+ * a share. An attempt to perform this operation on a share snapshot will fail with 400 (InvalidQueryParameterValue)
738
+ *
739
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/delete-file2
740
+ *
741
+ * @param fileName - Name of the file to delete
742
+ * @param options - Options to File Delete operation.
743
+ * @returns File deletion response data.
744
+ */
745
+ async deleteFile(fileName, options = {}) {
746
+ return tracingClient.withSpan("ShareDirectoryClient-deleteFile", options, async (updatedOptions) => {
747
+ const fileClient = this.getFileClient(fileName);
748
+ return fileClient.delete(updatedOptions);
749
+ });
750
+ }
751
+ /**
752
+ * Creates a {@link ShareFileClient} object.
753
+ *
754
+ * @param fileName - A file name.
755
+ * @returns A new ShareFileClient object for the given file name.
756
+ *
757
+ * Example usage:
758
+ *
759
+ * ```ts snippet:ReadmeSampleCreateFileAndUpload
760
+ * import { StorageSharedKeyCredential, ShareServiceClient } from "@azure/storage-file-share";
761
+ *
762
+ * const account = "<account>";
763
+ * const accountKey = "<accountkey>";
764
+ *
765
+ * const credential = new StorageSharedKeyCredential(account, accountKey);
766
+ * const serviceClient = new ShareServiceClient(
767
+ * `https://${account}.file.core.windows.net`,
768
+ * credential,
769
+ * );
770
+ *
771
+ * const shareName = "<share name>";
772
+ * const directoryName = "<directory name>";
773
+ * const directoryClient = serviceClient.getShareClient(shareName).getDirectoryClient(directoryName);
774
+ *
775
+ * const content = "Hello World!";
776
+ * const fileName = `newdirectory${+new Date()}`;
777
+ * const fileClient = directoryClient.getFileClient(fileName);
778
+ * await fileClient.create(content.length);
779
+ * console.log(`Create file ${fileName} successfully`);
780
+ *
781
+ * // Upload file range
782
+ * await fileClient.uploadRange(content, 0, content.length);
783
+ * console.log(`Upload file range "${content}" to ${fileName} successfully`);
784
+ * ```
785
+ */
786
+ // Legacy, no way to fix the eslint error without breaking. Disable the rule for this line.
787
+ /* eslint-disable-next-line @azure/azure-sdk/ts-naming-subclients */
788
+ getFileClient(fileName) {
789
+ return new ShareFileClient(appendToURLPath(this.url, EscapePath(fileName)), this.pipeline, this.shareClientConfig);
790
+ }
791
+ /**
792
+ * Returns true if the specified directory exists; false otherwise.
793
+ *
794
+ * NOTE: use this function with care since an existing directory might be deleted by other clients or
795
+ * applications. Vice versa new directories might be added by other clients or applications after this
796
+ * function completes.
797
+ *
798
+ * @param options - options to Exists operation.
799
+ */
800
+ async exists(options = {}) {
801
+ return tracingClient.withSpan("ShareDirectoryClient-exists", options, async (updatedOptions) => {
802
+ try {
803
+ await this.getProperties(Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig));
804
+ return true;
805
+ }
806
+ catch (e) {
807
+ if (e.statusCode === 404) {
808
+ return false;
809
+ }
810
+ throw e;
811
+ }
812
+ });
813
+ }
814
+ /**
815
+ * Returns all system properties for the specified directory, and can also be used to check the
816
+ * existence of a directory. The data returned does not include the files in the directory or any
817
+ * subdirectories.
818
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/get-directory-properties
819
+ *
820
+ * @param options - Options to Directory Get Properties operation.
821
+ * @returns Response data for the Directory Get Properties operation.
822
+ */
823
+ async getProperties(options = {}) {
824
+ return tracingClient.withSpan("ShareDirectoryClient-getProperties", options, async (updatedOptions) => {
825
+ const rawResponse = await this.context.getProperties(Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig));
826
+ return assertResponse(Object.assign(Object.assign({}, rawResponse), { _response: rawResponse._response, posixProperties: {
827
+ fileMode: parseOctalFileMode(rawResponse.fileMode),
828
+ owner: rawResponse.owner,
829
+ group: rawResponse.group,
830
+ fileType: rawResponse.nfsFileType,
831
+ } }));
832
+ });
833
+ }
834
+ /**
835
+ * Removes the specified empty directory. Note that the directory must be empty before it can be
836
+ * deleted.
837
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/delete-directory
838
+ *
839
+ * @param options - Options to Directory Delete operation.
840
+ * @returns Response data for the Directory Delete operation.
841
+ */
842
+ async delete(options = {}) {
843
+ return tracingClient.withSpan("ShareDirectoryClient-delete", options, async (updatedOptions) => {
844
+ return assertResponse(await this.context.delete(Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig)));
845
+ });
846
+ }
847
+ /**
848
+ * Removes the specified empty directory if it exists. Note that the directory must be empty before it can be
849
+ * deleted.
850
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/delete-directory
851
+ *
852
+ * @param options -
853
+ */
854
+ async deleteIfExists(options = {}) {
855
+ return tracingClient.withSpan("ShareDirectoryClient-deleteIfExists", options, async (updatedOptions) => {
856
+ var _a, _b, _c;
857
+ try {
858
+ const res = await this.delete(updatedOptions);
859
+ return Object.assign({ succeeded: true }, res);
860
+ }
861
+ catch (e) {
862
+ if (((_a = e.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "ResourceNotFound" ||
863
+ ((_b = e.details) === null || _b === void 0 ? void 0 : _b.errorCode) === "ParentNotFound") {
864
+ return Object.assign(Object.assign({ succeeded: false }, (_c = e.response) === null || _c === void 0 ? void 0 : _c.parsedHeaders), { _response: e.response });
865
+ }
866
+ throw e;
867
+ }
868
+ });
869
+ }
870
+ /**
871
+ * Updates user defined metadata for the specified directory.
872
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/set-directory-metadata
873
+ *
874
+ * @param metadata - If no metadata provided, all existing directory metadata will be removed
875
+ * @param options - Options to Directory Set Metadata operation.
876
+ * @returns Response data for the Directory Set Metadata operation.
877
+ */
878
+ async setMetadata(metadata, options = {}) {
879
+ return tracingClient.withSpan("ShareDirectoryClient-setMetadata", options, async (updatedOptions) => {
880
+ return assertResponse(await this.context.setMetadata(Object.assign(Object.assign(Object.assign({}, updatedOptions), { metadata }), this.shareClientConfig)));
881
+ });
882
+ }
883
+ /**
884
+ * Returns an AsyncIterableIterator for {@link DirectoryListFilesAndDirectoriesSegmentResponse} objects
885
+ *
886
+ * @param marker - A string value that identifies the portion of
887
+ * the list of files and directories to be returned with the next listing operation. The
888
+ * operation returns the ContinuationToken value within the response body if the
889
+ * listing operation did not return all files and directories remaining to be listed
890
+ * with the current page. The ContinuationToken value can be used as the value for
891
+ * the marker parameter in a subsequent call to request the next page of list
892
+ * items. The marker value is opaque to the client.
893
+ * @param options - Options to list files and directories operation.
894
+ */
895
+ iterateFilesAndDirectoriesSegments(marker_1) {
896
+ return __asyncGenerator(this, arguments, function* iterateFilesAndDirectoriesSegments_1(marker, options = {}) {
897
+ if (options.prefix === "") {
898
+ options.prefix = undefined;
899
+ }
900
+ let listFilesAndDirectoriesResponse;
901
+ do {
902
+ listFilesAndDirectoriesResponse = yield __await(this.listFilesAndDirectoriesSegment(marker, options));
903
+ marker = listFilesAndDirectoriesResponse.continuationToken;
904
+ yield yield __await(yield __await(listFilesAndDirectoriesResponse));
905
+ } while (marker);
906
+ });
907
+ }
908
+ /**
909
+ * Returns an AsyncIterableIterator for file and directory items
910
+ *
911
+ * @param options - Options to list files and directories operation.
912
+ */
913
+ listFilesAndDirectoriesItems() {
914
+ return __asyncGenerator(this, arguments, function* listFilesAndDirectoriesItems_1(options = {}) {
915
+ var _a, e_1, _b, _c;
916
+ if (options.prefix === "") {
917
+ options.prefix = undefined;
918
+ }
919
+ let marker;
920
+ try {
921
+ for (var _d = true, _e = __asyncValues(this.iterateFilesAndDirectoriesSegments(marker, options)), _f; _f = yield __await(_e.next()), _a = _f.done, !_a; _d = true) {
922
+ _c = _f.value;
923
+ _d = false;
924
+ const listFilesAndDirectoriesResponse = _c;
925
+ for (const file of listFilesAndDirectoriesResponse.segment.fileItems) {
926
+ yield yield __await(Object.assign({ kind: "file" }, file));
927
+ }
928
+ for (const directory of listFilesAndDirectoriesResponse.segment.directoryItems) {
929
+ yield yield __await(Object.assign({ kind: "directory" }, directory));
930
+ }
931
+ }
932
+ }
933
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
934
+ finally {
935
+ try {
936
+ if (!_d && !_a && (_b = _e.return)) yield __await(_b.call(_e));
937
+ }
938
+ finally { if (e_1) throw e_1.error; }
939
+ }
940
+ });
941
+ }
942
+ /**
943
+ * Returns an async iterable iterator to list all the files and directories
944
+ * under the specified account.
945
+ *
946
+ * .byPage() returns an async iterable iterator to list the files and directories in pages.
947
+ *
948
+ * Example using `for await` syntax:
949
+ *
950
+ * ```ts snippet:ReadmeSampleListFilesAndDirectories
951
+ * import { StorageSharedKeyCredential, ShareServiceClient } from "@azure/storage-file-share";
952
+ *
953
+ * const account = "<account>";
954
+ * const accountKey = "<accountkey>";
955
+ *
956
+ * const credential = new StorageSharedKeyCredential(account, accountKey);
957
+ * const serviceClient = new ShareServiceClient(
958
+ * `https://${account}.file.core.windows.net`,
959
+ * credential,
960
+ * );
961
+ *
962
+ * const shareName = "<share name>";
963
+ * const directoryName = "<directory name>";
964
+ * const directoryClient = serviceClient.getShareClient(shareName).getDirectoryClient(directoryName);
965
+ *
966
+ * let i = 1;
967
+ * for await (const item of directoryClient.listFilesAndDirectories()) {
968
+ * if (item.kind === "directory") {
969
+ * console.log(`${i} - directory\t: ${item.name}`);
970
+ * } else {
971
+ * console.log(`${i} - file\t: ${item.name}`);
972
+ * }
973
+ * i++;
974
+ * }
975
+ * ```
976
+ *
977
+ * Example using `iter.next()`:
978
+ *
979
+ * ```ts snippet:ReadmeSampleListFilesAndDirectories_Iterator
980
+ * import { StorageSharedKeyCredential, ShareServiceClient } from "@azure/storage-file-share";
981
+ *
982
+ * const account = "<account>";
983
+ * const accountKey = "<accountkey>";
984
+ *
985
+ * const credential = new StorageSharedKeyCredential(account, accountKey);
986
+ * const serviceClient = new ShareServiceClient(
987
+ * `https://${account}.file.core.windows.net`,
988
+ * credential,
989
+ * );
990
+ *
991
+ * const shareName = "<share name>";
992
+ * const directoryName = "<directory name>";
993
+ * const directoryClient = serviceClient.getShareClient(shareName).getDirectoryClient(directoryName);
994
+ *
995
+ * let i = 1;
996
+ * const iter = directoryClient.listFilesAndDirectories();
997
+ * let { value, done } = await iter.next();
998
+ * while (!done) {
999
+ * if (value.kind === "directory") {
1000
+ * console.log(`${i} - directory\t: ${value.name}`);
1001
+ * } else {
1002
+ * console.log(`${i} - file\t: ${value.name}`);
1003
+ * }
1004
+ * ({ value, done } = await iter.next());
1005
+ * i++;
1006
+ * }
1007
+ * ```
1008
+ *
1009
+ * Example using `byPage()`:
1010
+ *
1011
+ * ```ts snippet:ReadmeSampleListFilesAndDirectories_ByPage
1012
+ * import { StorageSharedKeyCredential, ShareServiceClient } from "@azure/storage-file-share";
1013
+ *
1014
+ * const account = "<account>";
1015
+ * const accountKey = "<accountkey>";
1016
+ *
1017
+ * const credential = new StorageSharedKeyCredential(account, accountKey);
1018
+ * const serviceClient = new ShareServiceClient(
1019
+ * `https://${account}.file.core.windows.net`,
1020
+ * credential,
1021
+ * );
1022
+ *
1023
+ * const shareName = "<share name>";
1024
+ * const directoryName = "<directory name>";
1025
+ * const directoryClient = serviceClient.getShareClient(shareName).getDirectoryClient(directoryName);
1026
+ *
1027
+ * let i = 1;
1028
+ * for await (const response of directoryClient
1029
+ * .listFilesAndDirectories()
1030
+ * .byPage({ maxPageSize: 20 })) {
1031
+ * console.log(`Page ${i++}:`);
1032
+ * for (const item of response.segment.directoryItems) {
1033
+ * console.log(`\tdirectory: ${item.name}`);
1034
+ * }
1035
+ * for (const item of response.segment.fileItems) {
1036
+ * console.log(`\tfile: ${item.name}`);
1037
+ * }
1038
+ * }
1039
+ * ```
1040
+ *
1041
+ * Example using paging with a marker:
1042
+ *
1043
+ * ```ts snippet:ReadmeSampleListFilesAndDirectories_Continuation
1044
+ * import { StorageSharedKeyCredential, ShareServiceClient } from "@azure/storage-file-share";
1045
+ *
1046
+ * const account = "<account>";
1047
+ * const accountKey = "<accountkey>";
1048
+ *
1049
+ * const credential = new StorageSharedKeyCredential(account, accountKey);
1050
+ * const serviceClient = new ShareServiceClient(
1051
+ * `https://${account}.file.core.windows.net`,
1052
+ * credential,
1053
+ * );
1054
+ *
1055
+ * const shareName = "<share name>";
1056
+ * const directoryName = "<directory name>";
1057
+ * const directoryClient = serviceClient.getShareClient(shareName).getDirectoryClient(directoryName);
1058
+ *
1059
+ * let iterator = directoryClient.listFilesAndDirectories().byPage({ maxPageSize: 2 });
1060
+ * let response = (await iterator.next()).value;
1061
+ *
1062
+ * for await (const item of response.segment.directoryItems) {
1063
+ * console.log(`\tdirectory: ${item.name}`);
1064
+ * }
1065
+ *
1066
+ * for await (const item of response.segment.fileItems) {
1067
+ * console.log(`\tfile: ${item.name}`);
1068
+ * }
1069
+ *
1070
+ * // Gets next marker
1071
+ * let marker = response.continuationToken;
1072
+ *
1073
+ * // Passing next marker as continuationToken
1074
+ * iterator = directoryClient
1075
+ * .listFilesAndDirectories()
1076
+ * .byPage({ continuationToken: marker, maxPageSize: 10 });
1077
+ * response = (await iterator.next()).value;
1078
+ *
1079
+ * for await (const item of response.segment.directoryItems) {
1080
+ * console.log(`\tdirectory: ${item.name}`);
1081
+ * }
1082
+ *
1083
+ * for await (const item of response.segment.fileItems) {
1084
+ * console.log(`\tfile: ${item.name}`);
1085
+ * }
1086
+ * ```
1087
+ *
1088
+ * @param options - Options to list files and directories operation.
1089
+ * @returns An asyncIterableIterator that supports paging.
1090
+ */
1091
+ listFilesAndDirectories(options = {}) {
1092
+ const include = [];
1093
+ if (options.includeTimestamps) {
1094
+ include.push("Timestamps");
1095
+ }
1096
+ if (options.includeEtag) {
1097
+ include.push("Etag");
1098
+ }
1099
+ if (options.includeAttributes) {
1100
+ include.push("Attributes");
1101
+ }
1102
+ if (options.includePermissionKey) {
1103
+ include.push("PermissionKey");
1104
+ }
1105
+ if (options.prefix === "") {
1106
+ options.prefix = undefined;
1107
+ }
1108
+ const updatedOptions = Object.assign(Object.assign({}, options), (include.length > 0 ? { include: include } : {}));
1109
+ // AsyncIterableIterator to iterate over files and directories
1110
+ const iter = this.listFilesAndDirectoriesItems(updatedOptions);
1111
+ return {
1112
+ /**
1113
+ * The next method, part of the iteration protocol
1114
+ */
1115
+ async next() {
1116
+ return iter.next();
1117
+ },
1118
+ /**
1119
+ * The connection to the async iterator, part of the iteration protocol
1120
+ */
1121
+ [Symbol.asyncIterator]() {
1122
+ return this;
1123
+ },
1124
+ /**
1125
+ * Return an AsyncIterableIterator that works a page at a time
1126
+ */
1127
+ byPage: (settings = {}) => {
1128
+ return this.iterateFilesAndDirectoriesSegments(removeEmptyString(settings.continuationToken), Object.assign({ maxResults: settings.maxPageSize }, updatedOptions));
1129
+ },
1130
+ };
1131
+ }
1132
+ /**
1133
+ * Returns a list of files or directories under the specified share or directory. It lists the
1134
+ * contents only for a single level of the directory hierarchy.
1135
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/list-directories-and-files
1136
+ *
1137
+ * @param marker - A string value that identifies the portion of the list to be returned with the next list operation.
1138
+ * @param options - Options to Directory List Files and Directories Segment operation.
1139
+ * @returns Response data for the Directory List Files and Directories operation.
1140
+ */
1141
+ async listFilesAndDirectoriesSegment(marker, options = {}) {
1142
+ if (options.prefix === "") {
1143
+ options.prefix = undefined;
1144
+ }
1145
+ return tracingClient.withSpan("ShareDirectoryClient-listFilesAndDirectoriesSegment", options, async (updatedOptions) => {
1146
+ const rawResponse = assertResponse(await this.context.listFilesAndDirectoriesSegment(Object.assign(Object.assign(Object.assign({}, updatedOptions), { marker }), this.shareClientConfig)));
1147
+ const wrappedResponse = Object.assign(Object.assign({}, ConvertInternalResponseOfListFiles(rawResponse)), { _response: Object.assign(Object.assign({}, rawResponse._response), { parsedBody: ConvertInternalResponseOfListFiles(rawResponse._response.parsedBody) }) });
1148
+ return wrappedResponse;
1149
+ });
1150
+ }
1151
+ /**
1152
+ * Returns an AsyncIterableIterator for {@link DirectoryListHandlesResponse}
1153
+ *
1154
+ * @param marker - A string value that identifies the portion of the list to be
1155
+ * returned with the next list handles operation. The operation returns a
1156
+ * marker value within the response body if the list returned was not complete.
1157
+ * The marker value may then be used in a subsequent call to request the next
1158
+ * set of list items.
1159
+ * @param options - Options to list handles operation.
1160
+ */
1161
+ iterateHandleSegments(marker_1) {
1162
+ return __asyncGenerator(this, arguments, function* iterateHandleSegments_1(marker, options = {}) {
1163
+ let listHandlesResponse;
1164
+ if (!!marker || marker === undefined) {
1165
+ do {
1166
+ listHandlesResponse = yield __await(this.listHandlesSegment(marker, options));
1167
+ marker = listHandlesResponse.continuationToken;
1168
+ yield yield __await(yield __await(listHandlesResponse));
1169
+ } while (marker);
1170
+ }
1171
+ });
1172
+ }
1173
+ /**
1174
+ * Returns an AsyncIterableIterator for handles
1175
+ *
1176
+ * @param options - Options to list handles operation.
1177
+ */
1178
+ listHandleItems() {
1179
+ return __asyncGenerator(this, arguments, function* listHandleItems_1(options = {}) {
1180
+ var _a, e_2, _b, _c;
1181
+ let marker;
1182
+ try {
1183
+ for (var _d = true, _e = __asyncValues(this.iterateHandleSegments(marker, options)), _f; _f = yield __await(_e.next()), _a = _f.done, !_a; _d = true) {
1184
+ _c = _f.value;
1185
+ _d = false;
1186
+ const listHandlesResponse = _c;
1187
+ if (listHandlesResponse.handleList) {
1188
+ for (const handle of listHandlesResponse.handleList) {
1189
+ yield yield __await(handle);
1190
+ }
1191
+ }
1192
+ }
1193
+ }
1194
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
1195
+ finally {
1196
+ try {
1197
+ if (!_d && !_a && (_b = _e.return)) yield __await(_b.call(_e));
1198
+ }
1199
+ finally { if (e_2) throw e_2.error; }
1200
+ }
1201
+ });
1202
+ }
1203
+ /**
1204
+ * Returns an async iterable iterator to list all the handles.
1205
+ * under the specified account.
1206
+ *
1207
+ * .byPage() returns an async iterable iterator to list the handles in pages.
1208
+ *
1209
+ * Example using `for await` syntax:
1210
+ *
1211
+ * ```ts snippet:ReadmeSampleListHandles
1212
+ * import { StorageSharedKeyCredential, ShareServiceClient } from "@azure/storage-file-share";
1213
+ *
1214
+ * const account = "<account>";
1215
+ * const accountKey = "<accountkey>";
1216
+ *
1217
+ * const credential = new StorageSharedKeyCredential(account, accountKey);
1218
+ * const serviceClient = new ShareServiceClient(
1219
+ * `https://${account}.file.core.windows.net`,
1220
+ * credential,
1221
+ * );
1222
+ *
1223
+ * const shareName = "<share name>";
1224
+ * const directoryName = "<directory name>";
1225
+ * const directoryClient = serviceClient.getShareClient(shareName).getDirectoryClient(directoryName);
1226
+ *
1227
+ * for await (const handle of directoryClient.listHandles()) {
1228
+ * console.log(`Handle: ${handle.handleId}`);
1229
+ * }
1230
+ * ```
1231
+ *
1232
+ * Example using `iter.next()`:
1233
+ *
1234
+ * ```ts snippet:ReadmeSampleListHandles_Iterator
1235
+ * import { StorageSharedKeyCredential, ShareServiceClient } from "@azure/storage-file-share";
1236
+ *
1237
+ * const account = "<account>";
1238
+ * const accountKey = "<accountkey>";
1239
+ *
1240
+ * const credential = new StorageSharedKeyCredential(account, accountKey);
1241
+ * const serviceClient = new ShareServiceClient(
1242
+ * `https://${account}.file.core.windows.net`,
1243
+ * credential,
1244
+ * );
1245
+ *
1246
+ * const shareName = "<share name>";
1247
+ * const directoryName = "<directory name>";
1248
+ * const directoryClient = serviceClient.getShareClient(shareName).getDirectoryClient(directoryName);
1249
+ *
1250
+ * const handleIter = directoryClient.listHandles();
1251
+ * let { value, done } = await handleIter.next();
1252
+ * while (!done) {
1253
+ * console.log(`Handle: ${value.handleId}`);
1254
+ * ({ value, done } = await handleIter.next());
1255
+ * }
1256
+ * ```
1257
+ *
1258
+ * Example using `byPage()`:
1259
+ *
1260
+ * ```ts snippet:ReadmeSampleListHandles_ByPage
1261
+ * import { StorageSharedKeyCredential, ShareServiceClient } from "@azure/storage-file-share";
1262
+ *
1263
+ * const account = "<account>";
1264
+ * const accountKey = "<accountkey>";
1265
+ *
1266
+ * const credential = new StorageSharedKeyCredential(account, accountKey);
1267
+ * const serviceClient = new ShareServiceClient(
1268
+ * `https://${account}.file.core.windows.net`,
1269
+ * credential,
1270
+ * );
1271
+ *
1272
+ * const shareName = "<share name>";
1273
+ * const directoryName = "<directory name>";
1274
+ * const directoryClient = serviceClient.getShareClient(shareName).getDirectoryClient(directoryName);
1275
+ *
1276
+ * let i = 1;
1277
+ * for await (const response of directoryClient.listHandles().byPage({ maxPageSize: 20 })) {
1278
+ * console.log(`Page ${i++}:`);
1279
+ * for (const handle of response.handleList || []) {
1280
+ * console.log(`\thandle: ${handle.handleId}`);
1281
+ * }
1282
+ * }
1283
+ * ```
1284
+ *
1285
+ * Example using paging with a marker:
1286
+ *
1287
+ * ```ts snippet:ReadmeSampleListHandles_Continuation
1288
+ * import { StorageSharedKeyCredential, ShareServiceClient } from "@azure/storage-file-share";
1289
+ *
1290
+ * const account = "<account>";
1291
+ * const accountKey = "<accountkey>";
1292
+ *
1293
+ * const credential = new StorageSharedKeyCredential(account, accountKey);
1294
+ * const serviceClient = new ShareServiceClient(
1295
+ * `https://${account}.file.core.windows.net`,
1296
+ * credential,
1297
+ * );
1298
+ *
1299
+ * const shareName = "<share name>";
1300
+ * const directoryName = "<directory name>";
1301
+ * const directoryClient = serviceClient.getShareClient(shareName).getDirectoryClient(directoryName);
1302
+ *
1303
+ * let iterator = directoryClient.listHandles().byPage({ maxPageSize: 2 });
1304
+ * let response = (await iterator.next()).value;
1305
+ *
1306
+ * for await (const handle of response.handleList || []) {
1307
+ * console.log(`\thandle: ${handle.handleId}`);
1308
+ * }
1309
+ *
1310
+ * // Gets next marker
1311
+ * let marker = response.continuationToken;
1312
+ *
1313
+ * // Passing next marker as continuationToken
1314
+ * iterator = directoryClient.listHandles().byPage({ continuationToken: marker, maxPageSize: 10 });
1315
+ * response = (await iterator.next()).value;
1316
+ *
1317
+ * for await (const handle of response.handleList || []) {
1318
+ * console.log(`\thandle: ${handle.handleId}`);
1319
+ * }
1320
+ * ```
1321
+ *
1322
+ * @param options - Options to list handles operation.
1323
+ *
1324
+ * An asyncIterableIterator that supports paging.
1325
+ */
1326
+ listHandles(options = {}) {
1327
+ // an AsyncIterableIterator to iterate over handles
1328
+ const iter = this.listHandleItems(options);
1329
+ return {
1330
+ /**
1331
+ * The next method, part of the iteration protocol
1332
+ */
1333
+ async next() {
1334
+ return iter.next();
1335
+ },
1336
+ /**
1337
+ * The connection to the async iterator, part of the iteration protocol
1338
+ */
1339
+ [Symbol.asyncIterator]() {
1340
+ return this;
1341
+ },
1342
+ /**
1343
+ * Return an AsyncIterableIterator that works a page at a time
1344
+ */
1345
+ byPage: (settings = {}) => {
1346
+ return this.iterateHandleSegments(removeEmptyString(settings.continuationToken), Object.assign({ maxResults: settings.maxPageSize }, options));
1347
+ },
1348
+ };
1349
+ }
1350
+ /**
1351
+ * Lists handles for a directory.
1352
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/list-handles
1353
+ *
1354
+ * @param marker - Optional. A string value that identifies the portion of the list to be
1355
+ * returned with the next list handles operation. The operation returns a
1356
+ * marker value within the response body if the list returned was not complete.
1357
+ * The marker value may then be used in a subsequent call to request the next
1358
+ * set of list items.
1359
+ * @param options -
1360
+ */
1361
+ async listHandlesSegment(marker, options = {}) {
1362
+ return tracingClient.withSpan("ShareDirectoryClient-listHandlesSegment", options, async (updatedOptions) => {
1363
+ marker = marker === "" ? undefined : marker;
1364
+ const response = assertResponse(await this.context.listHandles(Object.assign(Object.assign(Object.assign({}, updatedOptions), { marker }), this.shareClientConfig)));
1365
+ // TODO: Protocol layer issue that when handle list is in returned XML
1366
+ // response.handleList is an empty string
1367
+ if (response.handleList === "") {
1368
+ response.handleList = undefined;
1369
+ }
1370
+ const wrappedResponse = Object.assign(Object.assign({}, ConvertInternalResponseOfListHandles(response)), { _response: Object.assign(Object.assign({}, response._response), { parsedBody: ConvertInternalResponseOfListHandles(response._response.parsedBody) }) });
1371
+ return wrappedResponse;
1372
+ });
1373
+ }
1374
+ /**
1375
+ * Force close all handles for a directory.
1376
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/force-close-handles
1377
+ *
1378
+ * @param marker - Optional. A string value that identifies the position of handles that will
1379
+ * be closed with the next force close handles operation.
1380
+ * The operation returns a marker value within the response
1381
+ * body if there are more handles to close. The marker value
1382
+ * may then be used in a subsequent call to close the next set of handles.
1383
+ * @param options -
1384
+ */
1385
+ async forceCloseHandlesSegment(marker, options = {}) {
1386
+ return tracingClient.withSpan("ShareDirectoryClient-forceCloseHandlesSegment", options, async (updatedOptions) => {
1387
+ var _a, _b;
1388
+ if (marker === "") {
1389
+ marker = undefined;
1390
+ }
1391
+ const rawResponse = assertResponse(await this.context.forceCloseHandles("*", Object.assign(Object.assign(Object.assign({}, updatedOptions), { marker }), this.shareClientConfig)));
1392
+ return Object.assign(Object.assign({}, rawResponse), { closedHandlesCount: (_a = rawResponse.numberOfHandlesClosed) !== null && _a !== void 0 ? _a : 0, closeFailureCount: (_b = rawResponse.numberOfHandlesFailedToClose) !== null && _b !== void 0 ? _b : 0 });
1393
+ });
1394
+ }
1395
+ /**
1396
+ * Force close all handles for a directory.
1397
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/force-close-handles
1398
+ *
1399
+ * @param options -
1400
+ */
1401
+ async forceCloseAllHandles(options = {}) {
1402
+ return tracingClient.withSpan("ShareDirectoryClient-forceCloseAllHandles", options, async (updatedOptions) => {
1403
+ let handlesClosed = 0;
1404
+ let numberOfHandlesFailedToClose = 0;
1405
+ let marker = "";
1406
+ do {
1407
+ const response = await this.forceCloseHandlesSegment(marker, updatedOptions);
1408
+ marker = response.marker;
1409
+ if (response.closedHandlesCount) {
1410
+ handlesClosed += response.closedHandlesCount;
1411
+ }
1412
+ if (response.closeFailureCount) {
1413
+ numberOfHandlesFailedToClose += response.closeFailureCount;
1414
+ }
1415
+ } while (marker);
1416
+ return {
1417
+ closedHandlesCount: handlesClosed,
1418
+ closeFailureCount: numberOfHandlesFailedToClose,
1419
+ };
1420
+ });
1421
+ }
1422
+ /**
1423
+ * Force close a specific handle for a directory.
1424
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/force-close-handles
1425
+ *
1426
+ * @param aborter - Create a new Aborter instance with Aborter.none or Aborter.timeout(),
1427
+ * goto documents of Aborter for more examples about request cancellation
1428
+ * @param handleId - Specific handle ID, cannot be asterisk "*".
1429
+ * Use forceCloseHandlesSegment() to close all handles.
1430
+ * @param options -
1431
+ */
1432
+ async forceCloseHandle(handleId, options = {}) {
1433
+ return tracingClient.withSpan("ShareDirectoryClient-forceCloseHandle", options, async (updatedOptions) => {
1434
+ if (handleId === "*") {
1435
+ throw new RangeError(`Parameter handleID should be a specified handle ID. Use forceCloseHandlesSegment() to close all handles.`);
1436
+ }
1437
+ const rawResponse = await this.context.forceCloseHandles(handleId, Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig));
1438
+ const response = rawResponse;
1439
+ response.closedHandlesCount = rawResponse.numberOfHandlesClosed || 0;
1440
+ response.closeFailureCount = rawResponse.numberOfHandlesFailedToClose || 0;
1441
+ return response;
1442
+ });
1443
+ }
1444
+ /**
1445
+ * Renames a directory.
1446
+ * This API only supports renaming a directory in the same share.
1447
+ *
1448
+ * @param destinationPath - Specifies the destination path to rename to. The path will be encoded to put into a URL to specify the destination.
1449
+ * @param options - Options for the renaming operation.
1450
+ * @returns Response data for the file renaming operation.
1451
+ *
1452
+ * Example usage:
1453
+ *
1454
+ * ```ts snippet:ReadmeSampleRenameDirectory
1455
+ * import { StorageSharedKeyCredential, ShareServiceClient } from "@azure/storage-file-share";
1456
+ *
1457
+ * const account = "<account>";
1458
+ * const accountKey = "<accountkey>";
1459
+ *
1460
+ * const credential = new StorageSharedKeyCredential(account, accountKey);
1461
+ * const serviceClient = new ShareServiceClient(
1462
+ * `https://${account}.file.core.windows.net`,
1463
+ * credential,
1464
+ * );
1465
+ *
1466
+ * const shareName = "<share name>";
1467
+ * const directoryName = "<directory name>";
1468
+ * const destinationPath = "<destination path>";
1469
+ * const directoryClient = serviceClient.getShareClient(shareName).getDirectoryClient(directoryName);
1470
+ *
1471
+ * await directoryClient.rename(destinationPath);
1472
+ * ```
1473
+ */
1474
+ async rename(destinationPath, options = {}) {
1475
+ const split = destinationPath.split("?");
1476
+ let destinationUrl;
1477
+ if (split.length === 2) {
1478
+ const pathOnly = EscapePath(split[0]);
1479
+ const renameDestination = `/${this.shareName}/${pathOnly}`;
1480
+ destinationUrl = setURLPath(this.url, renameDestination);
1481
+ destinationUrl = setURLQueries(destinationUrl, split[1]);
1482
+ }
1483
+ else if (split.length === 1) {
1484
+ const pathOnly = EscapePath(destinationPath);
1485
+ const renameDestination = `/${this.shareName}/${pathOnly}`;
1486
+ destinationUrl = setURLPath(this.url, renameDestination);
1487
+ }
1488
+ else {
1489
+ throw new RangeError("Destination path should not contain more than one query string");
1490
+ }
1491
+ const destDirectory = new ShareDirectoryClient(destinationUrl, this.pipeline, this.shareClientConfig);
1492
+ return tracingClient.withSpan("ShareDirectoryClient-rename", options, async (updatedOptions) => {
1493
+ const response = assertResponse(await destDirectory.context.rename(this.url, Object.assign(Object.assign(Object.assign({}, updatedOptions), { sourceLeaseAccessConditions: updatedOptions.sourceLeaseAccessConditions
1494
+ ? {
1495
+ sourceLeaseId: updatedOptions.sourceLeaseAccessConditions.leaseId,
1496
+ }
1497
+ : undefined, destinationLeaseAccessConditions: updatedOptions.destinationLeaseAccessConditions
1498
+ ? {
1499
+ destinationLeaseId: updatedOptions.destinationLeaseAccessConditions.leaseId,
1500
+ }
1501
+ : undefined }), this.shareClientConfig)));
1502
+ return {
1503
+ destinationDirectoryClient: destDirectory,
1504
+ directoryRenameResponse: response,
1505
+ };
1506
+ });
1507
+ }
1508
+ }
1509
+ /**
1510
+ * A ShareFileClient represents a URL to an Azure Storage file.
1511
+ */
1512
+ export class ShareFileClient extends StorageClient {
1513
+ /**
1514
+ * The share name corresponding to this file client
1515
+ */
1516
+ get shareName() {
1517
+ return this._shareName;
1518
+ }
1519
+ /**
1520
+ * The full path of the file
1521
+ */
1522
+ get path() {
1523
+ return this._path;
1524
+ }
1525
+ /**
1526
+ * The name of the file
1527
+ */
1528
+ get name() {
1529
+ return this._name;
1530
+ }
1531
+ constructor(url, credentialOrPipeline,
1532
+ // Legacy, no way to fix the eslint error without breaking. Disable the rule for this line.
1533
+ /* eslint-disable-next-line @azure/azure-sdk/ts-naming-options */
1534
+ options) {
1535
+ let pipeline;
1536
+ if (isPipelineLike(credentialOrPipeline)) {
1537
+ pipeline = credentialOrPipeline;
1538
+ }
1539
+ else if (credentialOrPipeline instanceof Credential ||
1540
+ isTokenCredential(credentialOrPipeline)) {
1541
+ pipeline = newPipeline(credentialOrPipeline, options);
1542
+ }
1543
+ else {
1544
+ // The second parameter is undefined. Use anonymous credential.
1545
+ pipeline = newPipeline(new AnonymousCredential(), options);
1546
+ }
1547
+ super(url, pipeline);
1548
+ ({
1549
+ baseName: this._name,
1550
+ shareName: this._shareName,
1551
+ path: this._path,
1552
+ } = getShareNameAndPathFromUrl(this.url));
1553
+ this.shareClientConfig = options;
1554
+ this.context = this.storageClientContext.file;
1555
+ }
1556
+ /**
1557
+ * Creates a new ShareFileClient object identical to the source but with the specified share snapshot timestamp.
1558
+ * Provide "" will remove the snapshot and return a URL to the base ShareFileClient.
1559
+ *
1560
+ * @param shareSnapshot - The share snapshot timestamp.
1561
+ * @returns A new ShareFileClient object identical to the source but with the specified share snapshot timestamp.
1562
+ */
1563
+ withShareSnapshot(shareSnapshot) {
1564
+ return new ShareFileClient(setURLParameter(this.url, URLConstants.Parameters.SHARE_SNAPSHOT, shareSnapshot.length === 0 ? undefined : shareSnapshot), this.pipeline, this.shareClientConfig);
1565
+ }
1566
+ /**
1567
+ * Creates a new file or replaces a file. Note it only initializes the file with no content.
1568
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/create-file
1569
+ *
1570
+ * @param size - Specifies the maximum size in bytes for the file, up to 4 TB.
1571
+ * @param options - Options to File Create operation.
1572
+ * @returns Response data for the File Create operation.
1573
+ *
1574
+ * Example usage:
1575
+ *
1576
+ * ```ts snippet:ReadmeSampleCreateFileAndUpload
1577
+ * import { StorageSharedKeyCredential, ShareServiceClient } from "@azure/storage-file-share";
1578
+ *
1579
+ * const account = "<account>";
1580
+ * const accountKey = "<accountkey>";
1581
+ *
1582
+ * const credential = new StorageSharedKeyCredential(account, accountKey);
1583
+ * const serviceClient = new ShareServiceClient(
1584
+ * `https://${account}.file.core.windows.net`,
1585
+ * credential,
1586
+ * );
1587
+ *
1588
+ * const shareName = "<share name>";
1589
+ * const directoryName = "<directory name>";
1590
+ * const directoryClient = serviceClient.getShareClient(shareName).getDirectoryClient(directoryName);
1591
+ *
1592
+ * const content = "Hello World!";
1593
+ * const fileName = `newdirectory${+new Date()}`;
1594
+ * const fileClient = directoryClient.getFileClient(fileName);
1595
+ * await fileClient.create(content.length);
1596
+ * console.log(`Create file ${fileName} successfully`);
1597
+ *
1598
+ * // Upload file range
1599
+ * await fileClient.uploadRange(content, 0, content.length);
1600
+ * console.log(`Upload file range "${content}" to ${fileName} successfully`);
1601
+ * ```
1602
+ */
1603
+ async create(size, options = {}) {
1604
+ if (size < 0 || size > FILE_MAX_SIZE_BYTES) {
1605
+ throw new RangeError(`File size must >= 0 and < ${FILE_MAX_SIZE_BYTES}.`);
1606
+ }
1607
+ options = validateAndSetDefaultsForFileAndDirectoryCreateCommonOptions(options);
1608
+ options.fileHttpHeaders = options.fileHttpHeaders || {};
1609
+ return tracingClient.withSpan("ShareFileClient-create", options, async (updatedOptions) => {
1610
+ var _a, _b, _c, _d;
1611
+ const rawResponse = await this.context.create(size, Object.assign(Object.assign(Object.assign({}, updatedOptions), { fileChangeOn: fileChangeTimeToString(updatedOptions.changeTime), fileCreatedOn: fileCreationTimeToString(updatedOptions.creationTime), fileLastWriteOn: fileLastWriteTimeToString(updatedOptions.lastWriteTime), fileAttributes: updatedOptions.fileAttributes
1612
+ ? fileAttributesToString(updatedOptions.fileAttributes)
1613
+ : undefined, owner: (_a = updatedOptions.posixProperties) === null || _a === void 0 ? void 0 : _a.owner, group: (_b = updatedOptions.posixProperties) === null || _b === void 0 ? void 0 : _b.group, fileMode: toOctalFileMode((_c = updatedOptions.posixProperties) === null || _c === void 0 ? void 0 : _c.fileMode), nfsFileType: (_d = updatedOptions.posixProperties) === null || _d === void 0 ? void 0 : _d.fileType }), this.shareClientConfig));
1614
+ const wrappedRes = Object.assign(Object.assign({}, rawResponse), { _response: rawResponse._response, posixProperties: {
1615
+ fileMode: parseOctalFileMode(rawResponse.fileMode),
1616
+ fileType: rawResponse.nfsFileType,
1617
+ owner: rawResponse.owner,
1618
+ group: rawResponse.group,
1619
+ } });
1620
+ return assertResponse(wrappedRes);
1621
+ });
1622
+ }
1623
+ /**
1624
+ * Reads or downloads a file from the system, including its metadata and properties.
1625
+ *
1626
+ * * In Node.js, data returns in a Readable stream `readableStreamBody`
1627
+ * * In browsers, data returns in a promise `contentAsBlob`
1628
+ *
1629
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/get-file
1630
+ *
1631
+ * @param offset - From which position of the file to download, greater than or equal to 0
1632
+ * @param count - How much data to be downloaded, greater than 0. Will download to the end when undefined
1633
+ * @param options - Options to File Download operation.
1634
+ * @returns Response data for the File Download operation.
1635
+ *
1636
+ * Example usage (Node.js):
1637
+ *
1638
+ * ```ts snippet:ReadmeSampleDownloadFileAndConvertToString_Node
1639
+ * import { StorageSharedKeyCredential, ShareServiceClient } from "@azure/storage-file-share";
1640
+ *
1641
+ * const account = "<account>";
1642
+ * const accountKey = "<accountkey>";
1643
+ *
1644
+ * const credential = new StorageSharedKeyCredential(account, accountKey);
1645
+ * const serviceClient = new ShareServiceClient(
1646
+ * `https://${account}.file.core.windows.net`,
1647
+ * credential,
1648
+ * );
1649
+ *
1650
+ * const shareName = "<share name>";
1651
+ * const fileName = "<file name>";
1652
+ * const fileClient = serviceClient
1653
+ * .getShareClient(shareName)
1654
+ * .rootDirectoryClient.getFileClient(fileName);
1655
+ *
1656
+ * // Get file content from position 0 to the end
1657
+ * // In Node.js, get downloaded data by accessing downloadFileResponse.readableStreamBody
1658
+ * const downloadFileResponse = await fileClient.download();
1659
+ * if (downloadFileResponse.readableStreamBody) {
1660
+ * const buffer = await streamToBuffer(downloadFileResponse.readableStreamBody);
1661
+ * console.log(`Downloaded file content: ${buffer.toString()}`);
1662
+ * }
1663
+ *
1664
+ * // [Node.js only] A helper method used to read a Node.js readable stream into a Buffer
1665
+ * async function streamToBuffer(readableStream: NodeJS.ReadableStream): Promise<Buffer> {
1666
+ * return new Promise((resolve, reject) => {
1667
+ * const chunks: Buffer[] = [];
1668
+ * readableStream.on("data", (data) => {
1669
+ * chunks.push(data instanceof Buffer ? data : Buffer.from(data));
1670
+ * });
1671
+ * readableStream.on("end", () => {
1672
+ * resolve(Buffer.concat(chunks));
1673
+ * });
1674
+ * readableStream.on("error", reject);
1675
+ * });
1676
+ * }
1677
+ * ```
1678
+ *
1679
+ * Example usage (browsers):
1680
+ *
1681
+ * ```ts snippet:ReadmeSampleDownloadFileAndConvertToString_Browser
1682
+ * import { ShareServiceClient } from "@azure/storage-file-share";
1683
+ *
1684
+ * const account = "<account name>";
1685
+ * const sas = "<service Shared Access Signature Token>";
1686
+ *
1687
+ * const serviceClient = new ShareServiceClient(`https://${account}.file.core.windows.net?${sas}`);
1688
+ *
1689
+ * const shareName = "<share name>";
1690
+ * const fileName = "<file name>";
1691
+ * const fileClient = serviceClient
1692
+ * .getShareClient(shareName)
1693
+ * .rootDirectoryClient.getFileClient(fileName);
1694
+ *
1695
+ * // Get file content from position 0 to the end
1696
+ * // In browsers, get downloaded data by accessing downloadFileResponse.blobBody
1697
+ * const downloadFileResponse = await fileClient.download(0);
1698
+ * if (downloadFileResponse.blobBody) {
1699
+ * console.log(`Downloaded file content: ${(await downloadFileResponse.blobBody).text()}`);
1700
+ * }
1701
+ * ```
1702
+ */
1703
+ async download(offset = 0, count, options = {}) {
1704
+ return tracingClient.withSpan("ShareFileClient-download", options, async (updatedOptions) => {
1705
+ if (updatedOptions.rangeGetContentMD5 && offset === 0 && count === undefined) {
1706
+ throw new RangeError(`rangeGetContentMD5 only works with partial data downloading`);
1707
+ }
1708
+ const downloadFullFile = offset === 0 && !count;
1709
+ const rawResponse = await this.context.download(Object.assign(Object.assign(Object.assign({}, updatedOptions), { requestOptions: {
1710
+ onDownloadProgress: isNodeLike ? undefined : updatedOptions.onProgress, // for Node.js, progress is reported by RetriableReadableStream
1711
+ }, range: downloadFullFile ? undefined : rangeToString({ offset, count }) }), this.shareClientConfig));
1712
+ const res = assertResponse(Object.assign(Object.assign({}, rawResponse), { _response: rawResponse._response, posixProperties: {
1713
+ fileMode: parseOctalFileMode(rawResponse.fileMode),
1714
+ owner: rawResponse.owner,
1715
+ group: rawResponse.group,
1716
+ linkCount: rawResponse.linkCount,
1717
+ } }));
1718
+ // Return browser response immediately
1719
+ if (!isNodeLike) {
1720
+ return res;
1721
+ }
1722
+ // We support retrying when download stream unexpected ends in Node.js runtime
1723
+ // Following code shouldn't be bundled into browser build, however some
1724
+ // bundlers may try to bundle following code and "FileReadResponse.ts".
1725
+ // In this case, "FileDownloadResponse.browser.ts" will be used as a shim of "FileDownloadResponse.ts"
1726
+ // The config is in package.json "browser" field
1727
+ if (updatedOptions.maxRetryRequests === undefined || updatedOptions.maxRetryRequests < 0) {
1728
+ // TODO: Default value or make it a required parameter?
1729
+ updatedOptions.maxRetryRequests = DEFAULT_MAX_DOWNLOAD_RETRY_REQUESTS;
1730
+ }
1731
+ if (res.contentLength === undefined) {
1732
+ throw new RangeError(`File download response doesn't contain valid content length header`);
1733
+ }
1734
+ return new FileDownloadResponse(res, async (start) => {
1735
+ const updatedDownloadOptions = {
1736
+ range: rangeToString({
1737
+ count: offset + res.contentLength - start,
1738
+ offset: start,
1739
+ }),
1740
+ };
1741
+ // Debug purpose only
1742
+ // console.log(
1743
+ // `Read from internal stream, range: ${
1744
+ // chunkDownloadOptions.range
1745
+ // }, options: ${JSON.stringify(chunkDownloadOptions)}`
1746
+ // );
1747
+ const downloadRes = await this.context.download(Object.assign(Object.assign(Object.assign({}, updatedOptions), updatedDownloadOptions), this.shareClientConfig));
1748
+ if (!(downloadRes.etag === res.etag)) {
1749
+ throw new Error("File has been modified concurrently");
1750
+ }
1751
+ return downloadRes.readableStreamBody;
1752
+ }, offset, res.contentLength, {
1753
+ maxRetryRequests: updatedOptions.maxRetryRequests,
1754
+ onProgress: updatedOptions.onProgress,
1755
+ });
1756
+ });
1757
+ }
1758
+ /**
1759
+ * Returns true if the specified file exists; false otherwise.
1760
+ *
1761
+ * NOTE: use this function with care since an existing file might be deleted by other clients or
1762
+ * applications. Vice versa new files might be added by other clients or applications after this
1763
+ * function completes.
1764
+ *
1765
+ * @param options - options to Exists operation.
1766
+ */
1767
+ async exists(options = {}) {
1768
+ return tracingClient.withSpan("ShareFileClient-exists", options, async (updatedOptions) => {
1769
+ try {
1770
+ await this.getProperties(updatedOptions);
1771
+ return true;
1772
+ }
1773
+ catch (e) {
1774
+ if (e.statusCode === 404) {
1775
+ return false;
1776
+ }
1777
+ throw e;
1778
+ }
1779
+ });
1780
+ }
1781
+ /**
1782
+ * Returns all user-defined metadata, standard HTTP properties, and system properties
1783
+ * for the file. It does not return the content of the file.
1784
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/get-file-properties
1785
+ *
1786
+ * @param options - Options to File Get Properties operation.
1787
+ * @returns Response data for the File Get Properties operation.
1788
+ */
1789
+ async getProperties(options = {}) {
1790
+ return tracingClient.withSpan("ShareFileClient-getProperties", options, async (updatedOptions) => {
1791
+ const rawResponse = await this.context.getProperties(Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig));
1792
+ return assertResponse(Object.assign(Object.assign({}, rawResponse), { _response: rawResponse._response, posixProperties: {
1793
+ fileMode: parseOctalFileMode(rawResponse.fileMode),
1794
+ fileType: rawResponse.nfsFileType,
1795
+ owner: rawResponse.owner,
1796
+ group: rawResponse.group,
1797
+ linkCount: rawResponse.linkCount,
1798
+ } }));
1799
+ });
1800
+ }
1801
+ /**
1802
+ * Sets properties on the file.
1803
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/set-file-properties
1804
+ *
1805
+ * @param properties - File properties. For file HTTP headers(e.g. Content-Type),
1806
+ * if no values are provided, existing HTTP headers will be removed.
1807
+ * For other file properties(e.g. fileAttributes), if no values are provided,
1808
+ * existing values will be preserved.
1809
+ */
1810
+ async setProperties(properties = {}) {
1811
+ properties = validateAndSetDefaultsForFileAndDirectorySetPropertiesCommonOptions(properties);
1812
+ properties.fileHttpHeaders = properties.fileHttpHeaders || {};
1813
+ return tracingClient.withSpan("ShareFileClient-setProperties", properties, async (updatedOptions) => {
1814
+ var _a, _b, _c;
1815
+ const rawResponse = await this.context.setHttpHeaders(Object.assign(Object.assign(Object.assign({}, updatedOptions), { fileChangeOn: fileChangeTimeToString(updatedOptions.changeTime), fileCreatedOn: fileCreationTimeToString(updatedOptions.creationTime), fileLastWriteOn: fileLastWriteTimeToString(updatedOptions.lastWriteTime), fileAttributes: updatedOptions.fileAttributes
1816
+ ? fileAttributesToString(updatedOptions.fileAttributes)
1817
+ : undefined, owner: (_a = updatedOptions.posixProperties) === null || _a === void 0 ? void 0 : _a.owner, group: (_b = updatedOptions.posixProperties) === null || _b === void 0 ? void 0 : _b.group, fileMode: toOctalFileMode((_c = updatedOptions.posixProperties) === null || _c === void 0 ? void 0 : _c.fileMode) }), this.shareClientConfig));
1818
+ return assertResponse(Object.assign(Object.assign({}, rawResponse), { _response: rawResponse._response, posixProperties: {
1819
+ fileMode: parseOctalFileMode(rawResponse.fileMode),
1820
+ owner: rawResponse.owner,
1821
+ group: rawResponse.group,
1822
+ linkCount: rawResponse.linkCount,
1823
+ } }));
1824
+ });
1825
+ }
1826
+ /**
1827
+ * Removes the file from the storage account.
1828
+ * When a file is successfully deleted, it is immediately removed from the storage
1829
+ * account's index and is no longer accessible to clients. The file's data is later
1830
+ * removed from the service during garbage collection.
1831
+ *
1832
+ * Delete File will fail with status code 409 (Conflict) and error code SharingViolation
1833
+ * if the file is open on an SMB client.
1834
+ *
1835
+ * Delete File is not supported on a share snapshot, which is a read-only copy of
1836
+ * a share. An attempt to perform this operation on a share snapshot will fail with 400 (InvalidQueryParameterValue)
1837
+ *
1838
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/delete-file2
1839
+ *
1840
+ * @param options - Options to File Delete operation.
1841
+ * @returns Response data for the File Delete operation.
1842
+ */
1843
+ async delete(options = {}) {
1844
+ return tracingClient.withSpan("ShareFileClient-delete", options, async (updatedOptions) => {
1845
+ return assertResponse(await this.context.delete(Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig)));
1846
+ });
1847
+ }
1848
+ /**
1849
+ * Removes the file from the storage account if it exists.
1850
+ * When a file is successfully deleted, it is immediately removed from the storage
1851
+ * account's index and is no longer accessible to clients. The file's data is later
1852
+ * removed from the service during garbage collection.
1853
+ *
1854
+ * Delete File will fail with status code 409 (Conflict) and error code SharingViolation
1855
+ * if the file is open on an SMB client.
1856
+ *
1857
+ * Delete File is not supported on a share snapshot, which is a read-only copy of
1858
+ * a share. An attempt to perform this operation on a share snapshot will fail with 400 (InvalidQueryParameterValue)
1859
+ *
1860
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/delete-file2
1861
+ *
1862
+ * @param options -
1863
+ */
1864
+ async deleteIfExists(options = {}) {
1865
+ return tracingClient.withSpan("ShareFileClient-deleteIfExists", options, async (updatedOptions) => {
1866
+ var _a, _b, _c;
1867
+ try {
1868
+ const res = await this.delete(updatedOptions);
1869
+ return Object.assign({ succeeded: true }, res);
1870
+ }
1871
+ catch (e) {
1872
+ if (((_a = e.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "ResourceNotFound" ||
1873
+ ((_b = e.details) === null || _b === void 0 ? void 0 : _b.errorCode) === "ParentNotFound") {
1874
+ return Object.assign(Object.assign({ succeeded: false }, (_c = e.response) === null || _c === void 0 ? void 0 : _c.parsedHeaders), { _response: e.response });
1875
+ }
1876
+ throw e;
1877
+ }
1878
+ });
1879
+ }
1880
+ /**
1881
+ * Sets HTTP headers on the file.
1882
+ *
1883
+ * If no option provided, or no value provided for the file HTTP headers in the options,
1884
+ * these file HTTP headers without a value will be cleared.
1885
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/set-file-properties
1886
+ *
1887
+ * @param FileHttpHeaders - File HTTP headers like Content-Type.
1888
+ * Provide undefined will remove existing HTTP headers.
1889
+ * @param options - Options to File Set HTTP Headers operation.
1890
+ * @returns Response data for the File Set HTTP Headers operation.
1891
+ */
1892
+ async setHttpHeaders(fileHttpHeaders = {}, options = {}) {
1893
+ // FileAttributes, filePermission, createTime, lastWriteTime will all be preserved
1894
+ options = validateAndSetDefaultsForFileAndDirectorySetPropertiesCommonOptions(options);
1895
+ return tracingClient.withSpan("ShareFileClient-setHTTPHeaders", options, async (updatedOptions) => {
1896
+ var _a, _b, _c;
1897
+ const rawResponse = await this.context.setHttpHeaders(Object.assign(Object.assign(Object.assign({}, updatedOptions), { fileHttpHeaders, fileCreatedOn: fileCreationTimeToString(updatedOptions.creationTime), fileLastWriteOn: fileLastWriteTimeToString(updatedOptions.lastWriteTime), fileChangeOn: fileChangeTimeToString(updatedOptions.changeTime), fileAttributes: updatedOptions.fileAttributes
1898
+ ? fileAttributesToString(updatedOptions.fileAttributes)
1899
+ : undefined, owner: (_a = updatedOptions.posixProperties) === null || _a === void 0 ? void 0 : _a.owner, group: (_b = updatedOptions.posixProperties) === null || _b === void 0 ? void 0 : _b.group, fileMode: toOctalFileMode((_c = updatedOptions.posixProperties) === null || _c === void 0 ? void 0 : _c.fileMode) }), this.shareClientConfig));
1900
+ return assertResponse(Object.assign(Object.assign({}, rawResponse), { _response: rawResponse._response, posixProperties: {
1901
+ fileMode: parseOctalFileMode(rawResponse.fileMode),
1902
+ owner: rawResponse.owner,
1903
+ group: rawResponse.group,
1904
+ linkCount: rawResponse.linkCount,
1905
+ } }));
1906
+ });
1907
+ }
1908
+ /**
1909
+ * Resize file.
1910
+ *
1911
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/set-file-properties
1912
+ *
1913
+ * @param length - Resizes a file to the specified size in bytes.
1914
+ * If the specified byte value is less than the current size of the file,
1915
+ * then all ranges above the specified byte value are cleared.
1916
+ * @param options - Options to File Resize operation.
1917
+ * @returns Response data for the File Set HTTP Headers operation.
1918
+ */
1919
+ async resize(length, options = {}) {
1920
+ if (length < 0) {
1921
+ throw new RangeError(`Size cannot less than 0 when resizing file.`);
1922
+ }
1923
+ // FileAttributes, filePermission, createTime, lastWriteTime will all be preserved.
1924
+ options = validateAndSetDefaultsForFileAndDirectorySetPropertiesCommonOptions(options);
1925
+ return tracingClient.withSpan("ShareFileClient-resize", options, async (updatedOptions) => {
1926
+ var _a, _b, _c;
1927
+ const rawResponse = await this.context.setHttpHeaders(Object.assign(Object.assign(Object.assign({}, updatedOptions), { fileContentLength: length, fileChangeOn: fileChangeTimeToString(options.changeTime), fileCreatedOn: fileCreationTimeToString(options.creationTime), fileLastWriteOn: fileLastWriteTimeToString(options.lastWriteTime), fileAttributes: fileAttributesToString(updatedOptions.fileAttributes), owner: (_a = updatedOptions.posixProperties) === null || _a === void 0 ? void 0 : _a.owner, group: (_b = updatedOptions.posixProperties) === null || _b === void 0 ? void 0 : _b.group, fileMode: toOctalFileMode((_c = options.posixProperties) === null || _c === void 0 ? void 0 : _c.fileMode) }), this.shareClientConfig));
1928
+ return assertResponse(Object.assign(Object.assign({}, rawResponse), { _response: rawResponse._response, posixProperties: {
1929
+ fileMode: parseOctalFileMode(rawResponse.fileMode),
1930
+ owner: rawResponse.owner,
1931
+ group: rawResponse.group,
1932
+ linkCount: rawResponse.linkCount,
1933
+ } }));
1934
+ });
1935
+ }
1936
+ /**
1937
+ * Updates user-defined metadata for the specified file.
1938
+ *
1939
+ * If no metadata defined in the option parameter, the file
1940
+ * metadata will be removed.
1941
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/set-file-metadata
1942
+ *
1943
+ * @param metadata - If no metadata provided, all existing directory metadata will be removed
1944
+ * @param options - Options to File Set Metadata operation.
1945
+ * @returns Response data for the File Set Metadata operation.
1946
+ */
1947
+ async setMetadata(metadata = {}, options = {}) {
1948
+ return tracingClient.withSpan("ShareFileClient-setMetadata", options, async (updatedOptions) => {
1949
+ return assertResponse(await this.context.setMetadata(Object.assign(Object.assign(Object.assign({}, updatedOptions), { metadata }), this.shareClientConfig)));
1950
+ });
1951
+ }
1952
+ /**
1953
+ * Upload a range of bytes to a file. This operation can only be called on an existing file.
1954
+ * It won't change the size, properties or metadata of the file.
1955
+ * Both the start and count of the range must be specified. The range can be up to 4 MB in size.
1956
+ *
1957
+ * @param body - Blob, string, ArrayBuffer, ArrayBufferView or a function
1958
+ * which returns a new Readable stream whose offset is from data source beginning.
1959
+ * @param offset - Offset position of the destination Azure File to upload.
1960
+ * @param contentLength - Length of body in bytes. Use Buffer.byteLength() to calculate body length for a
1961
+ * string including non non-Base64/Hex-encoded characters.
1962
+ * @param options - Options to File Upload Range operation.
1963
+ * @returns Response data for the File Upload Range operation.
1964
+ *
1965
+ * Example usage:
1966
+ *
1967
+ * ```ts snippet:ReadmeSampleCreateFileAndUpload
1968
+ * import { StorageSharedKeyCredential, ShareServiceClient } from "@azure/storage-file-share";
1969
+ *
1970
+ * const account = "<account>";
1971
+ * const accountKey = "<accountkey>";
1972
+ *
1973
+ * const credential = new StorageSharedKeyCredential(account, accountKey);
1974
+ * const serviceClient = new ShareServiceClient(
1975
+ * `https://${account}.file.core.windows.net`,
1976
+ * credential,
1977
+ * );
1978
+ *
1979
+ * const shareName = "<share name>";
1980
+ * const directoryName = "<directory name>";
1981
+ * const directoryClient = serviceClient.getShareClient(shareName).getDirectoryClient(directoryName);
1982
+ *
1983
+ * const content = "Hello World!";
1984
+ * const fileName = `newdirectory${+new Date()}`;
1985
+ * const fileClient = directoryClient.getFileClient(fileName);
1986
+ * await fileClient.create(content.length);
1987
+ * console.log(`Create file ${fileName} successfully`);
1988
+ *
1989
+ * // Upload file range
1990
+ * await fileClient.uploadRange(content, 0, content.length);
1991
+ * console.log(`Upload file range "${content}" to ${fileName} successfully`);
1992
+ * ```
1993
+ */
1994
+ async uploadRange(body, offset, contentLength, options = {}) {
1995
+ return tracingClient.withSpan("ShareFileClient-uploadRange", options, async (updatedOptions) => {
1996
+ if (offset < 0) {
1997
+ throw new RangeError(`offset must be >= 0`);
1998
+ }
1999
+ if (contentLength <= 0 || contentLength > FILE_RANGE_MAX_SIZE_BYTES) {
2000
+ throw new RangeError(`contentLength must be > 0 and <= ${FILE_RANGE_MAX_SIZE_BYTES} bytes`);
2001
+ }
2002
+ if (contentLength > FILE_RANGE_MAX_SIZE_BYTES) {
2003
+ throw new RangeError(`offset must be < ${FILE_RANGE_MAX_SIZE_BYTES} bytes`);
2004
+ }
2005
+ return assertResponse(await this.context.uploadRange(rangeToString({ count: contentLength, offset }), "update", contentLength, Object.assign(Object.assign(Object.assign({}, updatedOptions), { requestOptions: {
2006
+ onUploadProgress: updatedOptions.onProgress,
2007
+ }, body }), this.shareClientConfig)));
2008
+ });
2009
+ }
2010
+ /**
2011
+ * Upload a range of bytes to a file where the contents are read from a another file's URL.
2012
+ * The range can be up to 4 MB in size.
2013
+ *
2014
+ * @param sourceURL - Specify a URL to the copy source, Shared Access Signature(SAS) maybe needed for authentication.
2015
+ * @param sourceOffset - The source offset to copy from. Pass 0 to copy from the beginning of source file.
2016
+ * @param destOffset - Offset of destination file.
2017
+ * @param count - Number of bytes to be uploaded from source file.
2018
+ * @param options - Options to configure File - Upload Range from URL operation.
2019
+ */
2020
+ async uploadRangeFromURL(sourceURL, sourceOffset, destOffset, count, options = {}) {
2021
+ return tracingClient.withSpan("ShareFileClient-uploadRangeFromURL", options, async (updatedOptions) => {
2022
+ if (sourceOffset < 0 || destOffset < 0) {
2023
+ throw new RangeError(`sourceOffset and destOffset must be >= 0`);
2024
+ }
2025
+ if (count <= 0 || count > FILE_RANGE_MAX_SIZE_BYTES) {
2026
+ throw new RangeError(`count must be > 0 and <= ${FILE_RANGE_MAX_SIZE_BYTES} bytes`);
2027
+ }
2028
+ return assertResponse(await this.context.uploadRangeFromURL(rangeToString({ offset: destOffset, count }), sourceURL, 0, Object.assign(Object.assign(Object.assign({}, updatedOptions), { sourceRange: rangeToString({ offset: sourceOffset, count }), sourceModifiedAccessConditions: updatedOptions.sourceConditions, copySourceAuthorization: httpAuthorizationToString(updatedOptions.sourceAuthorization) }), this.shareClientConfig)));
2029
+ });
2030
+ }
2031
+ /**
2032
+ * Clears the specified range and
2033
+ * releases the space used in storage for that range.
2034
+ *
2035
+ * @param offset -
2036
+ * @param contentLength -
2037
+ * @param options - Options to File Clear Range operation.
2038
+ */
2039
+ async clearRange(offset, contentLength, options = {}) {
2040
+ return tracingClient.withSpan("ShareFileClient-clearRange", options, async (updatedOptions) => {
2041
+ if (offset < 0 || contentLength <= 0) {
2042
+ throw new RangeError(`offset must >= 0 and contentLength must be > 0`);
2043
+ }
2044
+ return assertResponse(await this.context.uploadRange(rangeToString({ count: contentLength, offset }), "clear", 0, Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig)));
2045
+ });
2046
+ }
2047
+ /**
2048
+ * Returns the list of valid ranges for a file.
2049
+ *
2050
+ * @param options - Options to File Get range List operation.
2051
+ */
2052
+ async getRangeList(options = {}) {
2053
+ return tracingClient.withSpan("ShareFileClient-getRangeList", options, async (updatedOptions) => {
2054
+ const originalResponse = assertResponse(await this.context.getRangeList(Object.assign(Object.assign(Object.assign({}, updatedOptions), { range: updatedOptions.range ? rangeToString(updatedOptions.range) : undefined }), this.shareClientConfig)));
2055
+ // Only returns ranges, ignoring clearRanges.
2056
+ const parsedBody = originalResponse._response.parsedBody.ranges
2057
+ ? originalResponse._response.parsedBody.ranges
2058
+ : [];
2059
+ return Object.assign(Object.assign({}, originalResponse), { _response: Object.assign(Object.assign({}, originalResponse._response), { parsedBody }), rangeList: originalResponse.ranges ? originalResponse.ranges : [] });
2060
+ });
2061
+ }
2062
+ /**
2063
+ * Returns the list of ranges that differ between a previous share snapshot and this file.
2064
+ *
2065
+ * @param prevShareSnapshot - The previous snapshot parameter is an opaque DateTime value that specifies the previous share snapshot to compare with.
2066
+ * @param options -
2067
+ */
2068
+ async getRangeListDiff(prevShareSnapshot, options = {}) {
2069
+ return tracingClient.withSpan("ShareFileClient-getRangeListDiff", options, async (updatedOptions) => {
2070
+ return assertResponse(await this.context.getRangeList(Object.assign(Object.assign(Object.assign({}, updatedOptions), { prevsharesnapshot: prevShareSnapshot, supportRename: options.includeRenames, range: updatedOptions.range ? rangeToString(updatedOptions.range) : undefined }), this.shareClientConfig)));
2071
+ });
2072
+ }
2073
+ /**
2074
+ * Copies a blob or file to a destination file within the storage account.
2075
+ *
2076
+ * @param copySource - Specifies the URL of the source file or blob, up to 2 KB in length.
2077
+ * To copy a file to another file within the same storage account, you may use Shared Key to
2078
+ * authenticate the source file. If you are copying a file from another storage account, or if you
2079
+ * are copying a blob from the same storage account or another storage account, then you must
2080
+ * authenticate the source file or blob using a shared access signature. If the source is a public
2081
+ * blob, no authentication is required to perform the copy operation. A file in a share snapshot
2082
+ * can also be specified as a copy source.
2083
+ * @param options - Options to File Start Copy operation.
2084
+ */
2085
+ async startCopyFromURL(copySource, options = {}) {
2086
+ return tracingClient.withSpan("ShareFileClient-startCopyFromURL", options, async (updatedOptions) => {
2087
+ var _a, _b, _c;
2088
+ return assertResponse(await this.context.startCopy(copySource, Object.assign(Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig), { owner: (_a = updatedOptions.posixProperties) === null || _a === void 0 ? void 0 : _a.owner, group: (_b = updatedOptions.posixProperties) === null || _b === void 0 ? void 0 : _b.group, fileMode: toOctalFileMode((_c = updatedOptions.posixProperties) === null || _c === void 0 ? void 0 : _c.fileMode), fileModeCopyMode: updatedOptions.fileModeCopyMode, fileOwnerCopyMode: updatedOptions.fileOwnerCopyMode })));
2089
+ });
2090
+ }
2091
+ /**
2092
+ * Aborts a pending Copy File operation, and leaves a destination file with zero length and full
2093
+ * metadata.
2094
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/abort-copy-file
2095
+ *
2096
+ * @param copyId - Id of the Copy File operation to abort.
2097
+ * @param options - Options to File Abort Copy From URL operation.
2098
+ */
2099
+ async abortCopyFromURL(copyId, options = {}) {
2100
+ return tracingClient.withSpan("ShareFileClient-abortCopyFromURL", options, async (updatedOptions) => {
2101
+ return assertResponse(await this.context.abortCopy(copyId, Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig)));
2102
+ });
2103
+ }
2104
+ // High Level functions
2105
+ /**
2106
+ * Creates a new Azure File or replaces an existing Azure File, and then uploads a Buffer(Node)/Blob/ArrayBuffer/ArrayBufferView to it.
2107
+ *
2108
+ * @param data - Buffer(Node), Blob, ArrayBuffer or ArrayBufferView
2109
+ * @param options -
2110
+ */
2111
+ async uploadData(data, options = {}) {
2112
+ return tracingClient.withSpan("ShareFileClient-uploadData", options, async (updatedOptions) => {
2113
+ if (isNodeLike) {
2114
+ let buffer;
2115
+ if (data instanceof Buffer) {
2116
+ buffer = data;
2117
+ }
2118
+ else if (data instanceof ArrayBuffer) {
2119
+ buffer = Buffer.from(data);
2120
+ }
2121
+ else {
2122
+ data = data;
2123
+ buffer = Buffer.from(data.buffer, data.byteOffset, data.byteLength);
2124
+ }
2125
+ return this.uploadSeekableInternal((offset, size) => buffer.slice(offset, offset + size), buffer.byteLength, updatedOptions);
2126
+ }
2127
+ else {
2128
+ const browserBlob = new Blob([data]);
2129
+ return this.uploadSeekableInternal((offset, size) => browserBlob.slice(offset, offset + size), browserBlob.size, updatedOptions);
2130
+ }
2131
+ });
2132
+ }
2133
+ /**
2134
+ * ONLY AVAILABLE IN BROWSERS.
2135
+ *
2136
+ * Uploads a browser Blob object to an Azure file. Requires a blobFactory as the data source,
2137
+ * which need to return a Blob object with the offset and size provided.
2138
+ *
2139
+ * @param blobFactory -
2140
+ * @param size -
2141
+ * @param options -
2142
+ */
2143
+ async uploadSeekableBlob(blobFactory, size, options = {}) {
2144
+ return tracingClient.withSpan("ShareFileClient-UploadSeekableBlob", options, async (updatedOptions) => {
2145
+ return this.uploadSeekableInternal(blobFactory, size, updatedOptions);
2146
+ });
2147
+ }
2148
+ /**
2149
+ * ONLY AVAILABLE IN NODE.JS RUNTIME.
2150
+ *
2151
+ * Creates a new Azure File or replaces an existing Azure File, and then uploads a local file to it.
2152
+ *
2153
+ * @param filePath - Full path of local file
2154
+ * @param fileClient - ShareFileClient
2155
+ * @param options -
2156
+ */
2157
+ async uploadFile(filePath, options = {}) {
2158
+ return tracingClient.withSpan("ShareFileClient-uploadFile", options, async (updatedOptions) => {
2159
+ const size = (await fsStat(filePath)).size;
2160
+ return this.uploadSeekableInternal((offset, count) => {
2161
+ return () => fsCreateReadStream(filePath, {
2162
+ autoClose: true,
2163
+ end: count ? offset + count - 1 : Infinity,
2164
+ start: offset,
2165
+ });
2166
+ }, size, updatedOptions);
2167
+ });
2168
+ }
2169
+ /**
2170
+ * ONLY AVAILABLE IN NODE.JS RUNTIME.
2171
+ *
2172
+ * Accepts a Node.js Readable stream factory, and uploads in blocks to an Azure File.
2173
+ * The Readable stream factory must returns a Node.js Readable stream starting from the offset defined. The offset
2174
+ * is the offset in the Azure file to be uploaded.
2175
+ *
2176
+ * @param streamFactory - Returns a Node.js Readable stream starting
2177
+ * from the offset defined
2178
+ * @param size - Size of the Azure file
2179
+ * @param fileClient - ShareFileClient
2180
+ * @param options -
2181
+ */
2182
+ async uploadResetableStream(streamFactory, size, options = {}) {
2183
+ return tracingClient.withSpan("ShareFileClient-uploadResetableStream", options, async (updatedOptions) => {
2184
+ return this.uploadSeekableInternal((offset, count) => {
2185
+ return () => streamFactory(offset, count);
2186
+ }, size, updatedOptions);
2187
+ });
2188
+ }
2189
+ /**
2190
+ *
2191
+ * @param bodyFactory -
2192
+ * @param size - Size of the Azure file
2193
+ * @param fileClient - ShareFileClient
2194
+ * @param options -
2195
+ */
2196
+ async uploadSeekableInternal(bodyFactory, size, options = {}) {
2197
+ return tracingClient.withSpan("ShareFileClient-uploadSeekableInternal", options, async (updatedOptions) => {
2198
+ if (!options.rangeSize) {
2199
+ options.rangeSize = FILE_RANGE_MAX_SIZE_BYTES;
2200
+ }
2201
+ if (options.rangeSize < 0 || options.rangeSize > FILE_RANGE_MAX_SIZE_BYTES) {
2202
+ throw new RangeError(`options.rangeSize must be > 0 and <= ${FILE_RANGE_MAX_SIZE_BYTES}`);
2203
+ }
2204
+ if (!options.fileHttpHeaders) {
2205
+ options.fileHttpHeaders = {};
2206
+ }
2207
+ if (!options.concurrency) {
2208
+ options.concurrency = DEFAULT_HIGH_LEVEL_CONCURRENCY;
2209
+ }
2210
+ if (options.concurrency < 0) {
2211
+ throw new RangeError(`options.concurrency cannot less than 0.`);
2212
+ }
2213
+ // Create the file
2214
+ await this.create(size, {
2215
+ abortSignal: options.abortSignal,
2216
+ fileHttpHeaders: options.fileHttpHeaders,
2217
+ metadata: options.metadata,
2218
+ leaseAccessConditions: options.leaseAccessConditions,
2219
+ tracingOptions: updatedOptions.tracingOptions,
2220
+ });
2221
+ const numBlocks = Math.floor((size - 1) / options.rangeSize) + 1;
2222
+ let transferProgress = 0;
2223
+ const batch = new Batch(options.concurrency);
2224
+ for (let i = 0; i < numBlocks; i++) {
2225
+ batch.addOperation(async () => {
2226
+ const start = options.rangeSize * i;
2227
+ const end = i === numBlocks - 1 ? size : start + options.rangeSize;
2228
+ const contentLength = end - start;
2229
+ await this.uploadRange(bodyFactory(start, contentLength), start, contentLength, {
2230
+ abortSignal: options.abortSignal,
2231
+ leaseAccessConditions: options.leaseAccessConditions,
2232
+ tracingOptions: updatedOptions.tracingOptions,
2233
+ });
2234
+ // Update progress after block is successfully uploaded to server, in case of block trying
2235
+ transferProgress += contentLength;
2236
+ if (options.onProgress) {
2237
+ options.onProgress({ loadedBytes: transferProgress });
2238
+ }
2239
+ });
2240
+ }
2241
+ return batch.do();
2242
+ });
2243
+ }
2244
+ async downloadToBuffer(bufferOrOffset, offsetOrCount, countOrOptions, optOptions = {}) {
2245
+ let buffer = undefined;
2246
+ let offset;
2247
+ let count;
2248
+ let options = optOptions;
2249
+ if (bufferOrOffset instanceof Buffer) {
2250
+ buffer = bufferOrOffset;
2251
+ offset = offsetOrCount || 0;
2252
+ count = typeof countOrOptions === "number" ? countOrOptions : 0;
2253
+ }
2254
+ else {
2255
+ offset = typeof bufferOrOffset === "number" ? bufferOrOffset : 0;
2256
+ count = typeof offsetOrCount === "number" ? offsetOrCount : 0;
2257
+ options = countOrOptions || {};
2258
+ }
2259
+ return tracingClient.withSpan("ShareFileClient-downloadToBuffer", options, async (updatedOptions) => {
2260
+ if (!options.rangeSize) {
2261
+ options.rangeSize = FILE_RANGE_MAX_SIZE_BYTES;
2262
+ }
2263
+ if (options.rangeSize < 0) {
2264
+ throw new RangeError("rangeSize option must be > 0");
2265
+ }
2266
+ if (offset < 0) {
2267
+ throw new RangeError("offset option must be >= 0");
2268
+ }
2269
+ if (count && count <= 0) {
2270
+ throw new RangeError("count option must be > 0");
2271
+ }
2272
+ if (!options.concurrency) {
2273
+ options.concurrency = DEFAULT_HIGH_LEVEL_CONCURRENCY;
2274
+ }
2275
+ if (options.concurrency < 0) {
2276
+ throw new RangeError(`options.concurrency cannot less than 0.`);
2277
+ }
2278
+ // Customer doesn't specify length, get it
2279
+ if (!count) {
2280
+ const response = await this.getProperties({
2281
+ abortSignal: options.abortSignal,
2282
+ leaseAccessConditions: options.leaseAccessConditions,
2283
+ tracingOptions: updatedOptions.tracingOptions,
2284
+ });
2285
+ count = response.contentLength - offset;
2286
+ if (count < 0) {
2287
+ throw new RangeError(`offset ${offset} shouldn't be larger than file size ${response.contentLength}`);
2288
+ }
2289
+ }
2290
+ if (!buffer) {
2291
+ try {
2292
+ buffer = Buffer.alloc(count);
2293
+ }
2294
+ catch (error) {
2295
+ throw new Error(`Unable to allocate a buffer of size: ${count} bytes. Please try passing your own Buffer to ` +
2296
+ 'the "downloadToBuffer method or try using other methods like "download" or "downloadToFile".' +
2297
+ `\t ${error.message}`);
2298
+ }
2299
+ }
2300
+ if (buffer.length < count) {
2301
+ throw new RangeError(`The buffer's size should be equal to or larger than the request count of bytes: ${count}`);
2302
+ }
2303
+ let transferProgress = 0;
2304
+ const batch = new Batch(options.concurrency);
2305
+ for (let off = offset; off < offset + count; off = off + options.rangeSize) {
2306
+ batch.addOperation(async () => {
2307
+ // Exclusive chunk end position
2308
+ let chunkEnd = offset + count;
2309
+ if (off + options.rangeSize < chunkEnd) {
2310
+ chunkEnd = off + options.rangeSize;
2311
+ }
2312
+ const response = await this.download(off, chunkEnd - off, {
2313
+ abortSignal: options.abortSignal,
2314
+ maxRetryRequests: options.maxRetryRequestsPerRange,
2315
+ leaseAccessConditions: options.leaseAccessConditions,
2316
+ tracingOptions: updatedOptions.tracingOptions,
2317
+ });
2318
+ const stream = response.readableStreamBody;
2319
+ await streamToBuffer(stream, buffer, off - offset, chunkEnd - offset);
2320
+ // Update progress after block is downloaded, in case of block trying
2321
+ // Could provide finer grained progress updating inside HTTP requests,
2322
+ // only if convenience layer download try is enabled
2323
+ transferProgress += chunkEnd - off;
2324
+ if (options.onProgress) {
2325
+ options.onProgress({ loadedBytes: transferProgress });
2326
+ }
2327
+ });
2328
+ }
2329
+ await batch.do();
2330
+ return buffer;
2331
+ });
2332
+ }
2333
+ /**
2334
+ * ONLY AVAILABLE IN NODE.JS RUNTIME.
2335
+ *
2336
+ * Creates a new Azure File or replaces an existing Azure File, and then uploads a Node.js Readable stream into it.
2337
+ * This method will try to create an Azure File, then starts uploading chunk by chunk.
2338
+ * Size of chunk is defined by `bufferSize` parameter.
2339
+ * Please make sure potential size of stream doesn't exceed file size.
2340
+ *
2341
+ * PERFORMANCE IMPROVEMENT TIPS:
2342
+ * * Input stream highWaterMark is better to set a same value with bufferSize
2343
+ * parameter, which will avoid Buffer.concat() operations.
2344
+ *
2345
+ * @param stream - Node.js Readable stream. Must be less or equal than file size.
2346
+ * @param size - Size of file to be created. Maximum size allowed is 4 TB.
2347
+ * If this value is larger than stream size, there will be empty bytes in file tail.
2348
+ * @param bufferSize - Size of every buffer allocated in bytes, also the chunk/range size during
2349
+ * the uploaded file. Size must be greater than 0 and lesser than or equal to 4 * 1024 * 1024 (4MB)
2350
+ * @param maxBuffers - Max buffers will allocate during uploading, positive correlation
2351
+ * with max uploading concurrency
2352
+ * @param options -
2353
+ */
2354
+ async uploadStream(stream, size, bufferSize, maxBuffers, options = {}) {
2355
+ return tracingClient.withSpan("ShareFileClient-uploadStream", options, async (updatedOptions) => {
2356
+ if (!options.fileHttpHeaders) {
2357
+ options.fileHttpHeaders = {};
2358
+ }
2359
+ if (bufferSize <= 0 || bufferSize > FILE_RANGE_MAX_SIZE_BYTES) {
2360
+ throw new RangeError(`bufferSize must be > 0 and <= ${FILE_RANGE_MAX_SIZE_BYTES}`);
2361
+ }
2362
+ if (maxBuffers < 0) {
2363
+ throw new RangeError(`maxBuffers must be > 0.`);
2364
+ }
2365
+ // Create the file
2366
+ await this.create(size, {
2367
+ abortSignal: options.abortSignal,
2368
+ fileHttpHeaders: options.fileHttpHeaders,
2369
+ metadata: options.metadata,
2370
+ leaseAccessConditions: options.leaseAccessConditions,
2371
+ tracingOptions: updatedOptions.tracingOptions,
2372
+ });
2373
+ let transferProgress = 0;
2374
+ const scheduler = new BufferScheduler(stream, bufferSize, maxBuffers, async (buffer, offset) => {
2375
+ if (transferProgress + buffer.length > size) {
2376
+ throw new RangeError(`Stream size is larger than file size ${size} bytes, uploading failed. ` +
2377
+ `Please make sure stream length is less or equal than file size.`);
2378
+ }
2379
+ await this.uploadRange(buffer, offset, buffer.length, {
2380
+ abortSignal: options.abortSignal,
2381
+ leaseAccessConditions: options.leaseAccessConditions,
2382
+ tracingOptions: updatedOptions.tracingOptions,
2383
+ });
2384
+ // Update progress after block is successfully uploaded to server, in case of block trying
2385
+ transferProgress += buffer.length;
2386
+ if (options.onProgress) {
2387
+ options.onProgress({ loadedBytes: transferProgress });
2388
+ }
2389
+ },
2390
+ // Concurrency should set a smaller value than maxBuffers, which is helpful to
2391
+ // reduce the possibility when a outgoing handler waits for stream data, in
2392
+ // this situation, outgoing handlers are blocked.
2393
+ // Outgoing queue shouldn't be empty.
2394
+ Math.ceil((maxBuffers / 4) * 3));
2395
+ return scheduler.do();
2396
+ });
2397
+ }
2398
+ /**
2399
+ * ONLY AVAILABLE IN NODE.JS RUNTIME.
2400
+ *
2401
+ * Downloads an Azure Blob to a local file.
2402
+ * Fails if the the given file path already exits.
2403
+ * Offset and count are optional, pass 0 and undefined respectively to download the entire blob.
2404
+ *
2405
+ * @param filePath -
2406
+ * @param offset - From which position of the block blob to download.
2407
+ * @param count - How much data to be downloaded. Will download to the end when passing undefined.
2408
+ * @param options - Options to Blob download options.
2409
+ * @returns The response data for blob download operation,
2410
+ * but with readableStreamBody set to undefined since its
2411
+ * content is already read and written into a local file
2412
+ * at the specified path.
2413
+ */
2414
+ async downloadToFile(filePath, offset = 0, count, options = {}) {
2415
+ return tracingClient.withSpan("ShareFileClient-downloadToFile", options, async (updatedOptions) => {
2416
+ const response = await this.download(offset, count, updatedOptions);
2417
+ if (response.readableStreamBody) {
2418
+ await readStreamToLocalFile(response.readableStreamBody, filePath);
2419
+ }
2420
+ // The stream is no longer accessible so setting it to undefined.
2421
+ response.fileDownloadStream = undefined;
2422
+ return response;
2423
+ });
2424
+ }
2425
+ /**
2426
+ * Lists handles for a file.
2427
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/list-handles
2428
+ *
2429
+ * @param marker - Optional. A string value that identifies the portion of the list to be
2430
+ * returned with the next list handles operation. The operation returns a
2431
+ * marker value within the response body if the list returned was not complete.
2432
+ * The marker value may then be used in a subsequent call to request the next
2433
+ * set of list items.
2434
+ * @param options -
2435
+ */
2436
+ async listHandlesSegment(marker, options = {}) {
2437
+ return tracingClient.withSpan("ShareFileClient-listHandlesSegment", options, async (updatedOptions) => {
2438
+ marker = marker === "" ? undefined : marker;
2439
+ const response = assertResponse(await this.context.listHandles(Object.assign(Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig), { marker })));
2440
+ // TODO: Protocol layer issue that when handle list is in returned XML
2441
+ // response.handleList is an empty string
2442
+ if (response.handleList === "") {
2443
+ response.handleList = undefined;
2444
+ }
2445
+ const wrappedResponse = Object.assign(Object.assign({}, ConvertInternalResponseOfListHandles(response)), { _response: Object.assign(Object.assign({}, response._response), { parsedBody: ConvertInternalResponseOfListHandles(response._response.parsedBody) }) });
2446
+ return wrappedResponse;
2447
+ });
2448
+ }
2449
+ /**
2450
+ * Returns an AsyncIterableIterator for FileListHandlesResponse
2451
+ *
2452
+ * @param marker - A string value that identifies the portion of the list to be
2453
+ * returned with the next list handles operation. The operation returns a
2454
+ * marker value within the response body if the list returned was not complete.
2455
+ * The marker value may then be used in a subsequent call to request the next
2456
+ * set of list items.
2457
+ * @param options - Options to list handles operation.
2458
+ */
2459
+ iterateHandleSegments(marker_1) {
2460
+ return __asyncGenerator(this, arguments, function* iterateHandleSegments_2(marker, options = {}) {
2461
+ let listHandlesResponse;
2462
+ if (!!marker || marker === undefined) {
2463
+ do {
2464
+ listHandlesResponse = yield __await(this.listHandlesSegment(marker, options));
2465
+ marker = listHandlesResponse.continuationToken;
2466
+ yield yield __await(listHandlesResponse);
2467
+ } while (marker);
2468
+ }
2469
+ });
2470
+ }
2471
+ /**
2472
+ * Returns an AsyncIterableIterator for handles
2473
+ *
2474
+ * @param options - Options to list handles operation.
2475
+ */
2476
+ listHandleItems() {
2477
+ return __asyncGenerator(this, arguments, function* listHandleItems_2(options = {}) {
2478
+ var _a, e_3, _b, _c;
2479
+ let marker;
2480
+ try {
2481
+ for (var _d = true, _e = __asyncValues(this.iterateHandleSegments(marker, options)), _f; _f = yield __await(_e.next()), _a = _f.done, !_a; _d = true) {
2482
+ _c = _f.value;
2483
+ _d = false;
2484
+ const listHandlesResponse = _c;
2485
+ if (listHandlesResponse.handleList) {
2486
+ for (const handle of listHandlesResponse.handleList) {
2487
+ yield yield __await(handle);
2488
+ }
2489
+ }
2490
+ }
2491
+ }
2492
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
2493
+ finally {
2494
+ try {
2495
+ if (!_d && !_a && (_b = _e.return)) yield __await(_b.call(_e));
2496
+ }
2497
+ finally { if (e_3) throw e_3.error; }
2498
+ }
2499
+ });
2500
+ }
2501
+ /**
2502
+ * Returns an async iterable iterator to list all the handles.
2503
+ * under the specified account.
2504
+ *
2505
+ * .byPage() returns an async iterable iterator to list the handles in pages.
2506
+ *
2507
+ * @param options - Options to list handles operation.
2508
+ *
2509
+ * An asyncIterableIterator that supports paging.
2510
+ */
2511
+ listHandles(options = {}) {
2512
+ // an AsyncIterableIterator to iterate over handles
2513
+ const iter = this.listHandleItems(options);
2514
+ return {
2515
+ /**
2516
+ * The next method, part of the iteration protocol
2517
+ */
2518
+ async next() {
2519
+ return iter.next();
2520
+ },
2521
+ /**
2522
+ * The connection to the async iterator, part of the iteration protocol
2523
+ */
2524
+ [Symbol.asyncIterator]() {
2525
+ return this;
2526
+ },
2527
+ /**
2528
+ * Return an AsyncIterableIterator that works a page at a time
2529
+ */
2530
+ byPage: (settings = {}) => {
2531
+ return this.iterateHandleSegments(removeEmptyString(settings.continuationToken), Object.assign({ maxPageSize: settings.maxPageSize }, options));
2532
+ },
2533
+ };
2534
+ }
2535
+ /**
2536
+ * Force close all handles for a file.
2537
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/force-close-handles
2538
+ *
2539
+ * @param marker - Optional. A string value that identifies the position of handles that will
2540
+ * be closed with the next force close handles operation.
2541
+ * The operation returns a marker value within the response
2542
+ * body if there are more handles to close. The marker value
2543
+ * may then be used in a subsequent call to close the next set of handles.
2544
+ * @param options - Options to force close handles operation.
2545
+ */
2546
+ async forceCloseHandlesSegment(marker, options = {}) {
2547
+ return tracingClient.withSpan("ShareFileClient-forceCloseHandlesSegment", options, async (updatedOptions) => {
2548
+ marker = marker === "" ? undefined : marker;
2549
+ const rawResponse = await this.context.forceCloseHandles("*", Object.assign(Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig), { marker }));
2550
+ const response = rawResponse;
2551
+ response.closedHandlesCount = rawResponse.numberOfHandlesClosed || 0;
2552
+ response.closeFailureCount = rawResponse.numberOfHandlesFailedToClose || 0;
2553
+ return response;
2554
+ });
2555
+ }
2556
+ /**
2557
+ * Force close all handles for a file.
2558
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/force-close-handles
2559
+ *
2560
+ * @param options - Options to force close handles operation.
2561
+ */
2562
+ async forceCloseAllHandles(options = {}) {
2563
+ return tracingClient.withSpan("ShareFileClient-forceCloseAllHandles", options, async (updatedOptions) => {
2564
+ let handlesClosed = 0;
2565
+ let numberOfHandlesFailedToClose = 0;
2566
+ let marker = "";
2567
+ do {
2568
+ const response = await this.forceCloseHandlesSegment(marker, { tracingOptions: updatedOptions.tracingOptions });
2569
+ marker = response.marker;
2570
+ if (response.closedHandlesCount) {
2571
+ handlesClosed += response.closedHandlesCount;
2572
+ }
2573
+ if (response.closeFailureCount) {
2574
+ numberOfHandlesFailedToClose += response.closeFailureCount;
2575
+ }
2576
+ } while (marker);
2577
+ return {
2578
+ closedHandlesCount: handlesClosed,
2579
+ closeFailureCount: numberOfHandlesFailedToClose,
2580
+ };
2581
+ });
2582
+ }
2583
+ /**
2584
+ * Force close a specific handle for a file.
2585
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/force-close-handles
2586
+ *
2587
+ * @param handleId - Specific handle ID, cannot be asterisk "*".
2588
+ * Use forceCloseAllHandles() to close all handles.
2589
+ * @param FileForceCloseHandlesOptions - Options to force close handles operation.
2590
+ */
2591
+ async forceCloseHandle(handleId, options = {}) {
2592
+ return tracingClient.withSpan("ShareFileClient-forceCloseHandle", options, async (updatedOptions) => {
2593
+ if (handleId === "*") {
2594
+ throw new RangeError(`Parameter handleID should be a specified handle ID. Use forceCloseHandlesSegment() to close all handles.`);
2595
+ }
2596
+ const rawResponse = await this.context.forceCloseHandles(handleId, Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig));
2597
+ const response = rawResponse;
2598
+ response.closedHandlesCount = rawResponse.numberOfHandlesClosed || 0;
2599
+ response.closeFailureCount = rawResponse.numberOfHandlesFailedToClose || 0;
2600
+ return response;
2601
+ });
2602
+ }
2603
+ /**
2604
+ * NFS only. Creates a hard link to the file file specified by path.
2605
+ * @param targetFile - Path of the file to create the hard link to, not including the share.
2606
+ * For example: "targetDirectory/targetSubDirectory/.../targetFile"
2607
+ * @param options - Options to create hard link operation.
2608
+ */
2609
+ async createHardLink(targetFile, options = {}) {
2610
+ return tracingClient.withSpan("ShareFileClient-createHardLink", options, async (updatedOptions) => {
2611
+ const rawResponse = await this.context.createHardLink(targetFile, Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig));
2612
+ return assertResponse(Object.assign(Object.assign({}, rawResponse), { _response: rawResponse._response, posixProperties: {
2613
+ fileMode: parseOctalFileMode(rawResponse.fileMode),
2614
+ fileType: rawResponse.nfsFileType,
2615
+ owner: rawResponse.owner,
2616
+ group: rawResponse.group,
2617
+ linkCount: rawResponse.linkCount,
2618
+ } }));
2619
+ });
2620
+ }
2621
+ /**
2622
+ * NFS only. Creates a symbolic link.
2623
+ * @param linkText - The path to the original file, the symbolic link is pointing to.
2624
+ * The path is of type string which is not resolved and is stored as is. The path can be absolute path
2625
+ * or the relative path depending on the content stored in the symbolic link file.
2626
+ * @param options - Options to create hard link operation.
2627
+ */
2628
+ async createSymbolicLink(linkText, options = {}) {
2629
+ return tracingClient.withSpan("ShareFileClient-createSymbolicLink", options, async (updatedOptions) => {
2630
+ const rawResponse = await this.context.createSymbolicLink(linkText, Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig));
2631
+ return assertResponse(Object.assign(Object.assign({}, rawResponse), { _response: rawResponse._response, posixProperties: {
2632
+ fileMode: parseOctalFileMode(rawResponse.fileMode),
2633
+ owner: rawResponse.owner,
2634
+ group: rawResponse.group,
2635
+ fileType: rawResponse.nfsFileType,
2636
+ } }));
2637
+ });
2638
+ }
2639
+ /**
2640
+ * NFS only. Gets content of a symbolic link.
2641
+ * @param options - Options to get symbolic link operation.
2642
+ */
2643
+ async getSymbolicLink(options = {}) {
2644
+ return tracingClient.withSpan("ShareFileClient-getSymbolicLink", options, async (updatedOptions) => {
2645
+ return assertResponse(await this.context.getSymbolicLink(Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig)));
2646
+ });
2647
+ }
2648
+ /**
2649
+ * Get a {@link ShareLeaseClient} that manages leases on the file.
2650
+ *
2651
+ * @param proposeLeaseId - Initial proposed lease Id.
2652
+ * @returns A new ShareLeaseClient object for managing leases on the file.
2653
+ */
2654
+ getShareLeaseClient(proposeLeaseId) {
2655
+ return new ShareLeaseClient(this, proposeLeaseId);
2656
+ }
2657
+ /**
2658
+ * Only available for clients constructed with a shared key credential.
2659
+ *
2660
+ * Generates a Service Shared Access Signature (SAS) URI based on the client properties
2661
+ * and parameters passed in. The SAS is signed by the shared key credential of the client.
2662
+ *
2663
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas
2664
+ *
2665
+ * @param options - Optional parameters.
2666
+ * @returns The SAS URI consisting of the URI to the resource represented by this client, followed by the generated SAS token.
2667
+ */
2668
+ generateSasUrl(options) {
2669
+ if (!(this.credential instanceof StorageSharedKeyCredential)) {
2670
+ throw RangeError("Can only generate the SAS when the client is initialized with a shared key credential");
2671
+ }
2672
+ const sas = generateFileSASQueryParameters(Object.assign({ shareName: this.shareName, filePath: this.path }, options), this.credential).toString();
2673
+ return appendToURLQuery(this.url, sas);
2674
+ }
2675
+ /**
2676
+ * Only available for clients constructed with a shared key credential.
2677
+ *
2678
+ * Generates string to sign for a Service Shared Access Signature (SAS) URI based on the client properties
2679
+ * and parameters passed in. The SAS is signed by the shared key credential of the client.
2680
+ *
2681
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas
2682
+ *
2683
+ * @param options - Optional parameters.
2684
+ * @returns The SAS URI consisting of the URI to the resource represented by this client, followed by the generated SAS token.
2685
+ */
2686
+ /* eslint-disable-next-line @azure/azure-sdk/ts-naming-options*/
2687
+ generateSasStringToSign(options) {
2688
+ if (!(this.credential instanceof StorageSharedKeyCredential)) {
2689
+ throw RangeError("Can only generate the SAS when the client is initialized with a shared key credential");
2690
+ }
2691
+ return generateFileSASQueryParametersInternal(Object.assign({ shareName: this.shareName, filePath: this.path }, options), this.credential).stringToSign;
2692
+ }
2693
+ /**
2694
+ * Renames a file.
2695
+ * This API only supports renaming a file in the same share.
2696
+ *
2697
+ * @param destinationPath - Specifies the destination path to rename to. The path will be encoded to put into a URL to specify the destination.
2698
+ * @param options - Options for the renaming operation.
2699
+ * @returns Response data for the file renaming operation.
2700
+ *
2701
+ * Example usage:
2702
+ *
2703
+ * ```ts snippet:ReadmeSampleRenameFile
2704
+ * import { StorageSharedKeyCredential, ShareServiceClient } from "@azure/storage-file-share";
2705
+ *
2706
+ * const account = "<account>";
2707
+ * const accountKey = "<accountkey>";
2708
+ *
2709
+ * const credential = new StorageSharedKeyCredential(account, accountKey);
2710
+ * const serviceClient = new ShareServiceClient(
2711
+ * `https://${account}.file.core.windows.net`,
2712
+ * credential,
2713
+ * );
2714
+ *
2715
+ * const shareName = "<share name>";
2716
+ * const directoryName = "<directory name>";
2717
+ * const fileName = "<file name>";
2718
+ * const destinationPath = "<destination path>";
2719
+ * const fileClient = serviceClient
2720
+ * .getShareClient(shareName)
2721
+ * .getDirectoryClient(directoryName)
2722
+ * .getFileClient(fileName);
2723
+ *
2724
+ * await fileClient.rename(destinationPath);
2725
+ * ```
2726
+ */
2727
+ async rename(destinationPath, options = {}) {
2728
+ const split = destinationPath.split("?");
2729
+ let destinationUrl;
2730
+ if (split.length === 2) {
2731
+ const pathOnly = EscapePath(split[0]);
2732
+ const renameDestination = `/${this.shareName}/${pathOnly}`;
2733
+ destinationUrl = setURLPath(this.url, renameDestination);
2734
+ destinationUrl = setURLQueries(destinationUrl, split[1]);
2735
+ }
2736
+ else if (split.length === 1) {
2737
+ const pathOnly = EscapePath(destinationPath);
2738
+ const renameDestination = `/${this.shareName}/${pathOnly}`;
2739
+ destinationUrl = setURLPath(this.url, renameDestination);
2740
+ }
2741
+ else {
2742
+ throw new RangeError("Destination path should not contain more than one query string");
2743
+ }
2744
+ const destFile = new ShareFileClient(destinationUrl, this.pipeline, this.shareClientConfig);
2745
+ return tracingClient.withSpan("ShareFileClient-rename", options, async (updatedOptions) => {
2746
+ const response = assertResponse(await destFile.context.rename(this.url, Object.assign(Object.assign(Object.assign({}, updatedOptions), { sourceLeaseAccessConditions: updatedOptions.sourceLeaseAccessConditions
2747
+ ? {
2748
+ sourceLeaseId: updatedOptions.sourceLeaseAccessConditions.leaseId,
2749
+ }
2750
+ : undefined, destinationLeaseAccessConditions: updatedOptions.destinationLeaseAccessConditions
2751
+ ? {
2752
+ destinationLeaseId: updatedOptions.destinationLeaseAccessConditions.leaseId,
2753
+ }
2754
+ : undefined, fileHttpHeaders: options.contentType
2755
+ ? {
2756
+ fileContentType: options.contentType,
2757
+ }
2758
+ : undefined }), this.shareClientConfig)));
2759
+ return {
2760
+ destinationFileClient: destFile,
2761
+ fileRenameResponse: response,
2762
+ };
2763
+ });
2764
+ }
2765
+ }
2766
+ /**
2767
+ * A client that manages leases for a {@link ShareFileClient} or {@link ShareClient}.
2768
+ * @see https://learn.microsoft.com/rest/api/storageservices/lease-file
2769
+ * and
2770
+ * @see https://learn.microsoft.com/rest/api/storageservices/lease-share
2771
+ */
2772
+ export class ShareLeaseClient {
2773
+ /**
2774
+ * Gets the lease Id.
2775
+ *
2776
+ * @readonly
2777
+ */
2778
+ get leaseId() {
2779
+ return this._leaseId;
2780
+ }
2781
+ /**
2782
+ * Gets the url.
2783
+ *
2784
+ * @readonly
2785
+ */
2786
+ get url() {
2787
+ return this._url;
2788
+ }
2789
+ /**
2790
+ * Creates an instance of ShareLeaseClient.
2791
+ * @param client - The client to make the lease operation requests.
2792
+ * @param leaseId - Initial proposed lease id.
2793
+ */
2794
+ constructor(client, leaseId) {
2795
+ const clientContext = client["storageClientContext"];
2796
+ if (client instanceof ShareClient) {
2797
+ this.fileOrShare = clientContext.share;
2798
+ this.shareClientConfig = client["shareClientConfig"];
2799
+ }
2800
+ else {
2801
+ this.fileOrShare = clientContext.file;
2802
+ this.shareClientConfig = client["shareClientConfig"];
2803
+ }
2804
+ this._url = client.url;
2805
+ if (!leaseId) {
2806
+ leaseId = randomUUID();
2807
+ }
2808
+ this._leaseId = leaseId;
2809
+ }
2810
+ /**
2811
+ * Establishes and manages a lock on a file, share or share snapshot for write and delete operations.
2812
+ *
2813
+ * @param duration - Specifies the duration of lease in seconds. For file, the only allowed value is -1 for a lease that never expires. For share, must be -1 or between 15 to 60.
2814
+ * @param options - Options for the lease management operation.
2815
+ * @returns Response data for acquire lease operation.
2816
+ */
2817
+ async acquireLease(duration = -1, options = {}) {
2818
+ return tracingClient.withSpan("ShareLeaseClient-acquireLease", options, async (updatedOptions) => {
2819
+ return assertResponse(await this.fileOrShare.acquireLease(Object.assign(Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig), { duration, proposedLeaseId: this._leaseId })));
2820
+ });
2821
+ }
2822
+ /**
2823
+ * To change the ID of an existing lease.
2824
+ *
2825
+ * @param proposedLeaseId - the proposed new lease Id.
2826
+ * @param options - Options for the lease management operation.
2827
+ * @returns Response data for change lease operation.
2828
+ */
2829
+ async changeLease(proposedLeaseId, options = {}) {
2830
+ return tracingClient.withSpan("ShareLeaseClient-changeLease", options, async (updatedOptions) => {
2831
+ const response = assertResponse(await this.fileOrShare.changeLease(this._leaseId, Object.assign(Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig), { proposedLeaseId })));
2832
+ this._leaseId = proposedLeaseId;
2833
+ return response;
2834
+ });
2835
+ }
2836
+ /**
2837
+ * To free the lease if it is no longer needed so that another client may
2838
+ * immediately acquire a lease.
2839
+ *
2840
+ * @param options - Options for the lease management operation.
2841
+ * @returns Response data for release lease operation.
2842
+ */
2843
+ async releaseLease(options = {}) {
2844
+ return tracingClient.withSpan("ShareLeaseClient-releaseLease", options, async (updatedOptions) => {
2845
+ return assertResponse(await this.fileOrShare.releaseLease(this._leaseId, Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig)));
2846
+ });
2847
+ }
2848
+ /**
2849
+ * To force end the lease.
2850
+ *
2851
+ * @param options - Options for the lease management operation.
2852
+ * @returns Response data for break lease operation.
2853
+ */
2854
+ async breakLease(options = {}) {
2855
+ return tracingClient.withSpan("ShareLeaseClient-breakLease", options, async (updatedOptions) => {
2856
+ return assertResponse(await this.fileOrShare.breakLease(Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig)));
2857
+ });
2858
+ }
2859
+ /**
2860
+ * To renew the lease. Only available for lease on share or share snapshot.
2861
+ * Note that the lease may be renewed even if it has expired as long as the share has not been leased again since the expiration of that lease.
2862
+ * When you renew a lease, the lease duration clock resets.
2863
+ *
2864
+ * @param options - Options for the lease management operation.
2865
+ * @returns Response data for renew lease operation.
2866
+ */
2867
+ async renewLease(options = {}) {
2868
+ return tracingClient.withSpan("ShareLeaseClient-renewLease", options, async (updatedOptions) => {
2869
+ if (isFile(this.fileOrShare)) {
2870
+ throw new RangeError("The renewLease operation is not available for lease on file.");
2871
+ }
2872
+ return assertResponse(await this.fileOrShare.renewLease(this._leaseId, Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig)));
2873
+ });
2874
+ }
2875
+ }
2876
+ /**
2877
+ * @internal
2878
+ */
2879
+ function isFile(fileOrShare) {
2880
+ return "renewLease" in fileOrShare;
2881
+ }
2882
+ //# sourceMappingURL=Clients.js.map