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