@azure/storage-file-share 12.23.0-beta.1 → 12.23.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (149) hide show
  1. package/dist/index.js +328 -377
  2. package/dist/index.js.map +1 -1
  3. package/dist-esm/storage-blob/src/BatchResponseParser.js.map +1 -1
  4. package/dist-esm/storage-blob/src/BatchUtils.js.map +1 -1
  5. package/dist-esm/storage-blob/src/BlobBatch.js +5 -5
  6. package/dist-esm/storage-blob/src/BlobBatch.js.map +1 -1
  7. package/dist-esm/storage-blob/src/BlobBatchClient.js.map +1 -1
  8. package/dist-esm/storage-blob/src/BlobDownloadResponse.js.map +1 -1
  9. package/dist-esm/storage-blob/src/BlobLeaseClient.js +2 -2
  10. package/dist-esm/storage-blob/src/BlobLeaseClient.js.map +1 -1
  11. package/dist-esm/storage-blob/src/BlobQueryResponse.js.map +1 -1
  12. package/dist-esm/storage-blob/src/BlobServiceClient.js +8 -8
  13. package/dist-esm/storage-blob/src/BlobServiceClient.js.map +1 -1
  14. package/dist-esm/storage-blob/src/Clients.js +9 -7
  15. package/dist-esm/storage-blob/src/Clients.js.map +1 -1
  16. package/dist-esm/storage-blob/src/ContainerClient.js +12 -12
  17. package/dist-esm/storage-blob/src/ContainerClient.js.map +1 -1
  18. package/dist-esm/storage-blob/src/PageBlobRangeResponse.js.map +1 -1
  19. package/dist-esm/storage-blob/src/Pipeline.js +1 -1
  20. package/dist-esm/storage-blob/src/Pipeline.js.map +1 -1
  21. package/dist-esm/storage-blob/src/Range.js.map +1 -1
  22. package/dist-esm/storage-blob/src/StorageContextClient.js.map +1 -1
  23. package/dist-esm/storage-blob/src/credentials/AnonymousCredential.js.map +1 -1
  24. package/dist-esm/storage-blob/src/credentials/Credential.js.map +1 -1
  25. package/dist-esm/storage-blob/src/credentials/StorageSharedKeyCredential.js.map +1 -1
  26. package/dist-esm/storage-blob/src/generated/src/models/index.js.map +1 -1
  27. package/dist-esm/storage-blob/src/generated/src/models/mappers.js +2356 -2356
  28. package/dist-esm/storage-blob/src/generated/src/models/mappers.js.map +1 -1
  29. package/dist-esm/storage-blob/src/generated/src/models/parameters.js +444 -444
  30. package/dist-esm/storage-blob/src/generated/src/models/parameters.js.map +1 -1
  31. package/dist-esm/storage-blob/src/generated/src/operations/appendBlob.js +20 -20
  32. package/dist-esm/storage-blob/src/generated/src/operations/appendBlob.js.map +1 -1
  33. package/dist-esm/storage-blob/src/generated/src/operations/blob.js +134 -134
  34. package/dist-esm/storage-blob/src/generated/src/operations/blob.js.map +1 -1
  35. package/dist-esm/storage-blob/src/generated/src/operations/blockBlob.js +33 -33
  36. package/dist-esm/storage-blob/src/generated/src/operations/blockBlob.js.map +1 -1
  37. package/dist-esm/storage-blob/src/generated/src/operations/container.js +107 -107
  38. package/dist-esm/storage-blob/src/generated/src/operations/container.js.map +1 -1
  39. package/dist-esm/storage-blob/src/generated/src/operations/pageBlob.js +47 -47
  40. package/dist-esm/storage-blob/src/generated/src/operations/pageBlob.js.map +1 -1
  41. package/dist-esm/storage-blob/src/generated/src/operations/service.js +46 -46
  42. package/dist-esm/storage-blob/src/generated/src/operations/service.js.map +1 -1
  43. package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/appendBlob.js.map +1 -1
  44. package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/blob.js.map +1 -1
  45. package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/blockBlob.js.map +1 -1
  46. package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/container.js.map +1 -1
  47. package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/pageBlob.js.map +1 -1
  48. package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/service.js.map +1 -1
  49. package/dist-esm/storage-blob/src/generated/src/storageClient.js +5 -5
  50. package/dist-esm/storage-blob/src/generated/src/storageClient.js.map +1 -1
  51. package/dist-esm/storage-blob/src/generatedModels.js.map +1 -1
  52. package/dist-esm/storage-blob/src/index.js +1 -1
  53. package/dist-esm/storage-blob/src/index.js.map +1 -1
  54. package/dist-esm/storage-blob/src/models.js +7 -0
  55. package/dist-esm/storage-blob/src/models.js.map +1 -1
  56. package/dist-esm/storage-blob/src/policies/RequestPolicy.js.map +1 -1
  57. package/dist-esm/storage-blob/src/policies/StorageBrowserPolicy.js.map +1 -1
  58. package/dist-esm/storage-blob/src/policies/StorageBrowserPolicyV2.js.map +1 -1
  59. package/dist-esm/storage-blob/src/policies/StorageRetryPolicy.js.map +1 -1
  60. package/dist-esm/storage-blob/src/policies/StorageRetryPolicyV2.js.map +1 -1
  61. package/dist-esm/storage-blob/src/policies/StorageSharedKeyCredentialPolicy.js.map +1 -1
  62. package/dist-esm/storage-blob/src/policies/StorageSharedKeyCredentialPolicyV2.browser.js.map +1 -1
  63. package/dist-esm/storage-blob/src/policies/StorageSharedKeyCredentialPolicyV2.js.map +1 -1
  64. package/dist-esm/storage-blob/src/pollers/BlobStartCopyFromUrlPoller.js.map +1 -1
  65. package/dist-esm/storage-blob/src/sas/AccountSASPermissions.js +1 -1
  66. package/dist-esm/storage-blob/src/sas/AccountSASPermissions.js.map +1 -1
  67. package/dist-esm/storage-blob/src/sas/AccountSASResourceTypes.js.map +1 -1
  68. package/dist-esm/storage-blob/src/sas/AccountSASServices.js.map +1 -1
  69. package/dist-esm/storage-blob/src/sas/AccountSASSignatureValues.js.map +1 -1
  70. package/dist-esm/storage-blob/src/sas/BlobSASPermissions.js.map +1 -1
  71. package/dist-esm/storage-blob/src/sas/BlobSASSignatureValues.js +2 -2
  72. package/dist-esm/storage-blob/src/sas/BlobSASSignatureValues.js.map +1 -1
  73. package/dist-esm/storage-blob/src/sas/ContainerSASPermissions.js.map +1 -1
  74. package/dist-esm/storage-blob/src/sas/SASQueryParameters.js +6 -6
  75. package/dist-esm/storage-blob/src/sas/SASQueryParameters.js.map +1 -1
  76. package/dist-esm/storage-blob/src/utils/Batch.js.map +1 -1
  77. package/dist-esm/storage-blob/src/utils/BlobQuickQueryStream.js.map +1 -1
  78. package/dist-esm/storage-blob/src/utils/Mutex.js.map +1 -1
  79. package/dist-esm/storage-blob/src/utils/RetriableReadableStream.js.map +1 -1
  80. package/dist-esm/storage-blob/src/utils/cache.js.map +1 -1
  81. package/dist-esm/storage-blob/src/utils/constants.js +2 -2
  82. package/dist-esm/storage-blob/src/utils/constants.js.map +1 -1
  83. package/dist-esm/storage-blob/src/utils/utils.common.js.map +1 -1
  84. package/dist-esm/storage-blob/src/utils/utils.node.js.map +1 -1
  85. package/dist-esm/storage-file-share/src/AccountSASPermissions.js.map +1 -1
  86. package/dist-esm/storage-file-share/src/AccountSASResourceTypes.js.map +1 -1
  87. package/dist-esm/storage-file-share/src/AccountSASServices.js.map +1 -1
  88. package/dist-esm/storage-file-share/src/AccountSASSignatureValues.js +1 -1
  89. package/dist-esm/storage-file-share/src/AccountSASSignatureValues.js.map +1 -1
  90. package/dist-esm/storage-file-share/src/Clients.js +19 -20
  91. package/dist-esm/storage-file-share/src/Clients.js.map +1 -1
  92. package/dist-esm/storage-file-share/src/FileDownloadResponse.js.map +1 -1
  93. package/dist-esm/storage-file-share/src/FileSASPermissions.js.map +1 -1
  94. package/dist-esm/storage-file-share/src/FileSASSignatureValues.js.map +1 -1
  95. package/dist-esm/storage-file-share/src/FileSystemAttributes.js.map +1 -1
  96. package/dist-esm/storage-file-share/src/Pipeline.js +259 -0
  97. package/dist-esm/storage-file-share/src/Pipeline.js.map +1 -0
  98. package/dist-esm/storage-file-share/src/Range.js.map +1 -1
  99. package/dist-esm/storage-file-share/src/SASQueryParameters.js.map +1 -1
  100. package/dist-esm/storage-file-share/src/ShareClientInternal.js.map +1 -1
  101. package/dist-esm/storage-file-share/src/ShareSASPermissions.js.map +1 -1
  102. package/dist-esm/storage-file-share/src/ShareServiceClient.js +6 -7
  103. package/dist-esm/storage-file-share/src/ShareServiceClient.js.map +1 -1
  104. package/dist-esm/storage-file-share/src/StorageClient.js +1 -1
  105. package/dist-esm/storage-file-share/src/StorageClient.js.map +1 -1
  106. package/dist-esm/storage-file-share/src/StorageContextClient.js.map +1 -1
  107. package/dist-esm/storage-file-share/src/StorageRetryPolicyFactory.js +26 -0
  108. package/dist-esm/storage-file-share/src/StorageRetryPolicyFactory.js.map +1 -0
  109. package/dist-esm/storage-file-share/src/generated/src/models/index.js +2 -0
  110. package/dist-esm/storage-file-share/src/generated/src/models/index.js.map +1 -1
  111. package/dist-esm/storage-file-share/src/generated/src/models/mappers.js +8 -0
  112. package/dist-esm/storage-file-share/src/generated/src/models/mappers.js.map +1 -1
  113. package/dist-esm/storage-file-share/src/generated/src/models/parameters.js +11 -1
  114. package/dist-esm/storage-file-share/src/generated/src/models/parameters.js.map +1 -1
  115. package/dist-esm/storage-file-share/src/generated/src/operations/file.js +3 -1
  116. package/dist-esm/storage-file-share/src/generated/src/operations/file.js.map +1 -1
  117. package/dist-esm/storage-file-share/src/generated/src/storageClient.js +2 -2
  118. package/dist-esm/storage-file-share/src/generated/src/storageClient.js.map +1 -1
  119. package/dist-esm/storage-file-share/src/generatedModels.js.map +1 -1
  120. package/dist-esm/storage-file-share/src/index.browser.js +2 -2
  121. package/dist-esm/storage-file-share/src/index.browser.js.map +1 -1
  122. package/dist-esm/storage-file-share/src/index.js +3 -2
  123. package/dist-esm/storage-file-share/src/index.js.map +1 -1
  124. package/dist-esm/storage-file-share/src/models.js +16 -0
  125. package/dist-esm/storage-file-share/src/models.js.map +1 -1
  126. package/dist-esm/storage-file-share/src/policies/StorageRetryPolicy.js +204 -0
  127. package/dist-esm/storage-file-share/src/policies/StorageRetryPolicy.js.map +1 -0
  128. package/dist-esm/storage-file-share/src/policies/StorageRetryPolicyV2.js +160 -0
  129. package/dist-esm/storage-file-share/src/policies/StorageRetryPolicyV2.js.map +1 -0
  130. package/dist-esm/storage-file-share/src/utils/Batch.js.map +1 -1
  131. package/dist-esm/storage-file-share/src/utils/BufferScheduler.js.map +1 -1
  132. package/dist-esm/storage-file-share/src/utils/RetriableReadableStream.js.map +1 -1
  133. package/dist-esm/storage-file-share/src/utils/constants.js +6 -2
  134. package/dist-esm/storage-file-share/src/utils/constants.js.map +1 -1
  135. package/dist-esm/storage-file-share/src/utils/utils.common.js.map +1 -1
  136. package/dist-esm/storage-file-share/src/utils/utils.node.js.map +1 -1
  137. package/package.json +18 -33
  138. package/types/latest/storage-file-share.d.ts +42 -17
  139. package/dist-esm/storage-blob/src/BatchUtils.browser.js +0 -11
  140. package/dist-esm/storage-blob/src/BatchUtils.browser.js.map +0 -1
  141. package/dist-esm/storage-blob/src/BlobDownloadResponse.browser.js +0 -7
  142. package/dist-esm/storage-blob/src/BlobDownloadResponse.browser.js.map +0 -1
  143. package/dist-esm/storage-blob/src/BlobQueryResponse.browser.js +0 -362
  144. package/dist-esm/storage-blob/src/BlobQueryResponse.browser.js.map +0 -1
  145. package/dist-esm/storage-blob/src/index.browser.js +0 -23
  146. package/dist-esm/storage-blob/src/index.browser.js.map +0 -1
  147. package/dist-esm/storage-blob/src/utils/utils.browser.js +0 -48
  148. package/dist-esm/storage-blob/src/utils/utils.browser.js.map +0 -1
  149. package/types/3.1/storage-file-share.d.ts +0 -6941
@@ -1 +1 @@
1
- {"version":3,"file":"FileDownloadResponse.js","sourceRoot":"","sources":["../../../src/FileDownloadResponse.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAU1C,OAAO,EAEL,uBAAuB,GAExB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAA8B,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAElF;;;;;;;;;GASG;AACH,MAAM,OAAO,oBAAoB;IAC/B;;;;;OAKG;IACH,IAAW,YAAY;QACrB,OAAO,IAAI,CAAC,gBAAgB,CAAC,YAAY,CAAC;IAC5C,CAAC;IAED;;;;;OAKG;IACH,IAAW,YAAY;QACrB,OAAO,IAAI,CAAC,gBAAgB,CAAC,YAAY,CAAC;IAC5C,CAAC;IAED;;;;;;OAMG;IACH,IAAW,kBAAkB;QAC3B,OAAO,IAAI,CAAC,gBAAgB,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nimport { isNode } from \"@azure/core-util\";\nimport {\n CopyStatusType,\n FileDownloadHeaders,\n FileDownloadResponseModel,\n LeaseDurationType,\n LeaseStateType,\n LeaseStatusType,\n} from \"./generatedModels\";\nimport { Metadata } from \"./models\";\nimport {\n ReadableStreamGetter,\n RetriableReadableStream,\n RetriableReadableStreamOptions,\n} from \"./utils/RetriableReadableStream\";\nimport { HttpResponse, WithResponse, assertResponse } from \"./utils/utils.common\";\n\n/**\n * ONLY AVAILABLE IN NODE.JS RUNTIME.\n *\n * FileDownloadResponse implements the `FileDownloadResponseModel` interface, and in a Node.js runtime it will\n * automatically retry when its internal read stream unexpectedly ends. (This kind of unexpected end cannot\n * trigger retries defined in the pipeline retry policy.)\n *\n * The {@link readableStreamBody} stream will retry beneath the `ReadableStream` layer, so you can just use it as\n * a normal Node.js Readable stream.\n */\nexport class FileDownloadResponse implements FileDownloadResponseModel {\n /**\n * Indicates that the service supports\n * requests for partial file content.\n *\n * @readonly\n */\n public get acceptRanges(): string | undefined {\n return this.originalResponse.acceptRanges;\n }\n\n /**\n * Returnes if it was previously specified\n * for the file.\n *\n * @readonly\n */\n public get cacheControl(): string | undefined {\n return this.originalResponse.cacheControl;\n }\n\n /**\n * Returns the value that was specified\n * for the 'x-ms-content-disposition' header and specifies how to process the\n * response.\n *\n * @readonly\n */\n public get contentDisposition(): string | undefined {\n return this.originalResponse.contentDisposition;\n }\n\n /**\n * Returns the value that was specified\n * for the Content-Encoding request header.\n *\n * @readonly\n */\n public get contentEncoding(): string | undefined {\n return this.originalResponse.contentEncoding;\n }\n\n /**\n * Returns the value that was specified\n * for the Content-Language request header.\n *\n * @readonly\n */\n public get contentLanguage(): string | undefined {\n return this.originalResponse.contentLanguage;\n }\n\n /**\n * The number of bytes present in the\n * response body.\n *\n * @readonly\n */\n public get contentLength(): number | undefined {\n return this.originalResponse.contentLength;\n }\n\n /**\n * If the file has an MD5 hash and the\n * request is to read the full file, this response header is returned so that\n * the client can check for message content integrity. If the request is to\n * read a specified range and the 'x-ms-range-get-content-md5' is set to\n * true, then the request returns an MD5 hash for the range, as long as the\n * range size is less than or equal to 4 MB. If neither of these sets of\n * conditions is true, then no value is returned for the 'Content-MD5'\n * header.\n *\n * @readonly\n */\n public get contentMD5(): Uint8Array | undefined {\n return this.originalResponse.contentMD5;\n }\n\n /**\n * Indicates the range of bytes returned if\n * the client requested a subset of the file by setting the Range request\n * header.\n *\n * @readonly\n */\n public get contentRange(): string | undefined {\n return this.originalResponse.contentRange;\n }\n\n /**\n * The content type specified for the file.\n * The default content type is 'application/octet-stream'\n *\n * @readonly\n */\n public get contentType(): string | undefined {\n return this.originalResponse.contentType;\n }\n\n /**\n * Conclusion time of the last attempted\n * Copy File operation where this file was the destination file. This value\n * can specify the time of a completed, aborted, or failed copy attempt.\n *\n * @readonly\n */\n public get copyCompletedOn(): Date | undefined {\n return this.originalResponse.copyCompletedOn;\n }\n\n /**\n * String identifier for the last attempted Copy\n * File operation where this file was the destination file.\n *\n * @readonly\n */\n public get copyId(): string | undefined {\n return this.originalResponse.copyId;\n }\n\n /**\n * Contains the number of bytes copied and\n * the total bytes in the source in the last attempted Copy File operation\n * where this file was the destination file. Can show between 0 and\n * Content-Length bytes copied.\n *\n * @readonly\n */\n public get copyProgress(): string | undefined {\n return this.originalResponse.copyProgress;\n }\n\n /**\n * URL up to 2KB in length that specifies the\n * source file used in the last attempted Copy File operation where this file\n * was the destination file.\n *\n * @readonly\n */\n public get copySource(): string | undefined {\n return this.originalResponse.copySource;\n }\n\n /**\n * State of the copy operation\n * identified by 'x-ms-copy-id'. Possible values include: 'pending',\n * 'success', 'aborted', 'failed'\n *\n * @readonly\n */\n public get copyStatus(): CopyStatusType | undefined {\n return this.originalResponse.copyStatus;\n }\n\n /**\n * Only appears when\n * x-ms-copy-status is failed or pending. Describes cause of fatal or\n * non-fatal copy operation failure.\n *\n * @readonly\n */\n public get copyStatusDescription(): string | undefined {\n return this.originalResponse.copyStatusDescription;\n }\n\n /**\n * A UTC date/time value generated by the service that\n * indicates the time at which the response was initiated.\n *\n * @readonly\n */\n public get date(): Date | undefined {\n return this.originalResponse.date;\n }\n\n /**\n * The ETag contains a value that you can use to\n * perform operations conditionally, in quotes.\n *\n * @readonly\n */\n public get etag(): string | undefined {\n return this.originalResponse.etag;\n }\n\n public get errorCode(): string | undefined {\n return this.originalResponse.errorCode;\n }\n\n /**\n * If the file has a MD5 hash, and if\n * request contains range header (Range or x-ms-range), this response header\n * is returned with the value of the whole file's MD5 value. This value may\n * or may not be equal to the value returned in Content-MD5 header, with the\n * latter calculated from the requested range.\n *\n * @readonly\n */\n public get fileContentMD5(): Uint8Array | undefined {\n return this.originalResponse.fileContentMD5;\n }\n\n /**\n * The value of this header is set to\n * true if the file data and application metadata are completely encrypted\n * using the specified algorithm. Otherwise, the value is set to false (when\n * the file is unencrypted, or if only parts of the file/application metadata\n * are encrypted).\n *\n * @readonly\n */\n public get isServerEncrypted(): boolean | undefined {\n return this.originalResponse.isServerEncrypted;\n }\n\n /**\n * Returns the date and time the file was last\n * modified. Any operation that modifies the file or its properties updates\n * the last modified time.\n *\n * @readonly\n */\n public get lastModified(): Date | undefined {\n return this.originalResponse.lastModified;\n }\n\n /**\n * A name-value pair\n * to associate with a file storage object.\n *\n * @readonly\n */\n public get metadata(): Metadata | undefined {\n return this.originalResponse.metadata;\n }\n\n /**\n * This header uniquely identifies the request\n * that was made and can be used for troubleshooting the request.\n *\n * @readonly\n */\n public get requestId(): string | undefined {\n return this.originalResponse.requestId;\n }\n\n /**\n * Indicates the version of the File service used\n * to execute the request.\n *\n * @readonly\n */\n public get version(): string | undefined {\n return this.originalResponse.version;\n }\n\n /**\n * Attributes set for the file.\n *\n * @readonly\n */\n public get fileAttributes(): string | undefined {\n return this.originalResponse.fileAttributes;\n }\n\n /**\n * Creation time for the file.\n *\n * @readonly\n */\n public get fileCreatedOn(): Date | undefined {\n return this.originalResponse.fileCreatedOn;\n }\n\n /**\n * Last write time for the file.\n *\n * @readonly\n */\n public get fileLastWriteOn(): Date | undefined {\n return this.originalResponse.fileLastWriteOn;\n }\n\n /**\n * Change time for the file.\n *\n * @readonly\n */\n public get fileChangeOn(): Date | undefined {\n return this.originalResponse.fileChangeOn;\n }\n\n /**\n * Key of the permission set for the file.\n *\n * @readonly\n */\n public get filePermissionKey(): string | undefined {\n return this.originalResponse.filePermissionKey;\n }\n\n /**\n * The fileId of the file.\n *\n * @readonly\n */\n public get fileId(): string | undefined {\n return this.originalResponse.fileId;\n }\n\n /**\n * The parent fileId of the file.\n *\n * @readonly\n */\n public get fileParentId(): string | undefined {\n return this.originalResponse.fileParentId;\n }\n\n /**\n * The response body as a browser Blob.\n * Always undefined in node.js.\n *\n * @readonly\n */\n public get contentAsBlob(): Promise<Blob> | undefined {\n return this.originalResponse.blobBody;\n }\n\n /**\n * When a file is leased, specifies whether the lease is of infinite or fixed duration. Possible\n * values include: 'infinite', 'fixed'\n */\n public get leaseDuration(): LeaseDurationType | undefined {\n return this.originalResponse.leaseDuration;\n }\n\n /**\n * Lease state of the file. Possible values include: 'available', 'leased', 'expired',\n * 'breaking', 'broken'\n */\n public get leaseState(): LeaseStateType | undefined {\n return this.originalResponse.leaseState;\n }\n\n /**\n * The current lease status of the file. Possible values include: 'locked', 'unlocked'\n */\n public get leaseStatus(): LeaseStatusType | undefined {\n return this.originalResponse.leaseStatus;\n }\n\n /**\n * The response body as a node.js Readable stream.\n * Always undefined in the browser.\n *\n * It will automatically retry when internal read stream unexpected ends.\n *\n * @readonly\n */\n public get readableStreamBody(): NodeJS.ReadableStream | undefined {\n return isNode ? this.fileDownloadStream : undefined;\n }\n\n public get _response(): HttpResponse & {\n parsedHeaders: FileDownloadHeaders;\n } {\n return this.originalResponse._response;\n }\n\n private originalResponse: WithResponse<FileDownloadResponseModel, FileDownloadHeaders>;\n private fileDownloadStream?: RetriableReadableStream;\n\n /**\n * Creates an instance of FileDownloadResponse.\n *\n * @param originalResponse -\n * @param getter -\n * @param offset -\n * @param count -\n * @param options -\n */\n public constructor(\n originalResponse: FileDownloadResponseModel,\n getter: ReadableStreamGetter,\n offset: number,\n count: number,\n options: RetriableReadableStreamOptions = {}\n ) {\n this.originalResponse = assertResponse<FileDownloadResponseModel, FileDownloadHeaders>(\n originalResponse\n );\n this.fileDownloadStream = new RetriableReadableStream(\n this.originalResponse.readableStreamBody!,\n getter,\n offset,\n count,\n options\n );\n }\n}\n"]}
1
+ {"version":3,"file":"FileDownloadResponse.js","sourceRoot":"","sources":["../../../src/FileDownloadResponse.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAU1C,OAAO,EAEL,uBAAuB,GAExB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAA8B,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAElF;;;;;;;;;GASG;AACH,MAAM,OAAO,oBAAoB;IAC/B;;;;;OAKG;IACH,IAAW,YAAY;QACrB,OAAO,IAAI,CAAC,gBAAgB,CAAC,YAAY,CAAC;IAC5C,CAAC;IAED;;;;;OAKG;IACH,IAAW,YAAY;QACrB,OAAO,IAAI,CAAC,gBAAgB,CAAC,YAAY,CAAC;IAC5C,CAAC;IAED;;;;;;OAMG;IACH,IAAW,kBAAkB;QAC3B,OAAO,IAAI,CAAC,gBAAgB,CAAC,kBAAkB,CAAC;IAClD,CAAC;IAED;;;;;OAKG;IACH,IAAW,eAAe;QACxB,OAAO,IAAI,CAAC,gBAAgB,CAAC,eAAe,CAAC;IAC/C,CAAC;IAED;;;;;OAKG;IACH,IAAW,eAAe;QACxB,OAAO,IAAI,CAAC,gBAAgB,CAAC,eAAe,CAAC;IAC/C,CAAC;IAED;;;;;OAKG;IACH,IAAW,aAAa;QACtB,OAAO,IAAI,CAAC,gBAAgB,CAAC,aAAa,CAAC;IAC7C,CAAC;IAED;;;;;;;;;;;OAWG;IACH,IAAW,UAAU;QACnB,OAAO,IAAI,CAAC,gBAAgB,CAAC,UAAU,CAAC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CAAC,gBAAgB,CAAC,aAAa,CAAC;IAC7C,CAAC;IAED;;;OAGG;IACH,IAAW,UAAU;QACnB,OAAO,IAAI,CAAC,gBAAgB,CAAC,UAAU,CAAC;IAC1C,CAAC;IAED;;OAEG;IACH,IAAW,WAAW;QACpB,OAAO,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC;IAC3C,CAAC;IAED;;;;;;;OAOG;IACH,IAAW,kBAAkB;QAC3B,OAAO,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,SAAS,CAAC;IACtD,CAAC;IAED,IAAW,SAAS;QAGlB,OAAO,IAAI,CAAC,gBAAgB,CAAC,SAAS,CAAC;IACzC,CAAC;IAKD;;;;;;;;OAQG;IACH,YACE,gBAA2C,EAC3C,MAA4B,EAC5B,MAAc,EACd,KAAa,EACb,UAA0C,EAAE;QAE5C,IAAI,CAAC,gBAAgB,GAAG,cAAc,CACpC,gBAAgB,CACjB,CAAC;QACF,IAAI,CAAC,kBAAkB,GAAG,IAAI,uBAAuB,CACnD,IAAI,CAAC,gBAAgB,CAAC,kBAAmB,EACzC,MAAM,EACN,MAAM,EACN,KAAK,EACL,OAAO,CACR,CAAC;IACJ,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { isNode } from \"@azure/core-util\";\nimport {\n CopyStatusType,\n FileDownloadHeaders,\n FileDownloadResponseModel,\n LeaseDurationType,\n LeaseStateType,\n LeaseStatusType,\n} from \"./generatedModels\";\nimport { Metadata } from \"./models\";\nimport {\n ReadableStreamGetter,\n RetriableReadableStream,\n RetriableReadableStreamOptions,\n} from \"./utils/RetriableReadableStream\";\nimport { HttpResponse, WithResponse, assertResponse } from \"./utils/utils.common\";\n\n/**\n * ONLY AVAILABLE IN NODE.JS RUNTIME.\n *\n * FileDownloadResponse implements the `FileDownloadResponseModel` interface, and in a Node.js runtime it will\n * automatically retry when its internal read stream unexpectedly ends. (This kind of unexpected end cannot\n * trigger retries defined in the pipeline retry policy.)\n *\n * The {@link readableStreamBody} stream will retry beneath the `ReadableStream` layer, so you can just use it as\n * a normal Node.js Readable stream.\n */\nexport class FileDownloadResponse implements FileDownloadResponseModel {\n /**\n * Indicates that the service supports\n * requests for partial file content.\n *\n * @readonly\n */\n public get acceptRanges(): string | undefined {\n return this.originalResponse.acceptRanges;\n }\n\n /**\n * Returnes if it was previously specified\n * for the file.\n *\n * @readonly\n */\n public get cacheControl(): string | undefined {\n return this.originalResponse.cacheControl;\n }\n\n /**\n * Returns the value that was specified\n * for the 'x-ms-content-disposition' header and specifies how to process the\n * response.\n *\n * @readonly\n */\n public get contentDisposition(): string | undefined {\n return this.originalResponse.contentDisposition;\n }\n\n /**\n * Returns the value that was specified\n * for the Content-Encoding request header.\n *\n * @readonly\n */\n public get contentEncoding(): string | undefined {\n return this.originalResponse.contentEncoding;\n }\n\n /**\n * Returns the value that was specified\n * for the Content-Language request header.\n *\n * @readonly\n */\n public get contentLanguage(): string | undefined {\n return this.originalResponse.contentLanguage;\n }\n\n /**\n * The number of bytes present in the\n * response body.\n *\n * @readonly\n */\n public get contentLength(): number | undefined {\n return this.originalResponse.contentLength;\n }\n\n /**\n * If the file has an MD5 hash and the\n * request is to read the full file, this response header is returned so that\n * the client can check for message content integrity. If the request is to\n * read a specified range and the 'x-ms-range-get-content-md5' is set to\n * true, then the request returns an MD5 hash for the range, as long as the\n * range size is less than or equal to 4 MB. If neither of these sets of\n * conditions is true, then no value is returned for the 'Content-MD5'\n * header.\n *\n * @readonly\n */\n public get contentMD5(): Uint8Array | undefined {\n return this.originalResponse.contentMD5;\n }\n\n /**\n * Indicates the range of bytes returned if\n * the client requested a subset of the file by setting the Range request\n * header.\n *\n * @readonly\n */\n public get contentRange(): string | undefined {\n return this.originalResponse.contentRange;\n }\n\n /**\n * The content type specified for the file.\n * The default content type is 'application/octet-stream'\n *\n * @readonly\n */\n public get contentType(): string | undefined {\n return this.originalResponse.contentType;\n }\n\n /**\n * Conclusion time of the last attempted\n * Copy File operation where this file was the destination file. This value\n * can specify the time of a completed, aborted, or failed copy attempt.\n *\n * @readonly\n */\n public get copyCompletedOn(): Date | undefined {\n return this.originalResponse.copyCompletedOn;\n }\n\n /**\n * String identifier for the last attempted Copy\n * File operation where this file was the destination file.\n *\n * @readonly\n */\n public get copyId(): string | undefined {\n return this.originalResponse.copyId;\n }\n\n /**\n * Contains the number of bytes copied and\n * the total bytes in the source in the last attempted Copy File operation\n * where this file was the destination file. Can show between 0 and\n * Content-Length bytes copied.\n *\n * @readonly\n */\n public get copyProgress(): string | undefined {\n return this.originalResponse.copyProgress;\n }\n\n /**\n * URL up to 2KB in length that specifies the\n * source file used in the last attempted Copy File operation where this file\n * was the destination file.\n *\n * @readonly\n */\n public get copySource(): string | undefined {\n return this.originalResponse.copySource;\n }\n\n /**\n * State of the copy operation\n * identified by 'x-ms-copy-id'. Possible values include: 'pending',\n * 'success', 'aborted', 'failed'\n *\n * @readonly\n */\n public get copyStatus(): CopyStatusType | undefined {\n return this.originalResponse.copyStatus;\n }\n\n /**\n * Only appears when\n * x-ms-copy-status is failed or pending. Describes cause of fatal or\n * non-fatal copy operation failure.\n *\n * @readonly\n */\n public get copyStatusDescription(): string | undefined {\n return this.originalResponse.copyStatusDescription;\n }\n\n /**\n * A UTC date/time value generated by the service that\n * indicates the time at which the response was initiated.\n *\n * @readonly\n */\n public get date(): Date | undefined {\n return this.originalResponse.date;\n }\n\n /**\n * The ETag contains a value that you can use to\n * perform operations conditionally, in quotes.\n *\n * @readonly\n */\n public get etag(): string | undefined {\n return this.originalResponse.etag;\n }\n\n public get errorCode(): string | undefined {\n return this.originalResponse.errorCode;\n }\n\n /**\n * If the file has a MD5 hash, and if\n * request contains range header (Range or x-ms-range), this response header\n * is returned with the value of the whole file's MD5 value. This value may\n * or may not be equal to the value returned in Content-MD5 header, with the\n * latter calculated from the requested range.\n *\n * @readonly\n */\n public get fileContentMD5(): Uint8Array | undefined {\n return this.originalResponse.fileContentMD5;\n }\n\n /**\n * The value of this header is set to\n * true if the file data and application metadata are completely encrypted\n * using the specified algorithm. Otherwise, the value is set to false (when\n * the file is unencrypted, or if only parts of the file/application metadata\n * are encrypted).\n *\n * @readonly\n */\n public get isServerEncrypted(): boolean | undefined {\n return this.originalResponse.isServerEncrypted;\n }\n\n /**\n * Returns the date and time the file was last\n * modified. Any operation that modifies the file or its properties updates\n * the last modified time.\n *\n * @readonly\n */\n public get lastModified(): Date | undefined {\n return this.originalResponse.lastModified;\n }\n\n /**\n * A name-value pair\n * to associate with a file storage object.\n *\n * @readonly\n */\n public get metadata(): Metadata | undefined {\n return this.originalResponse.metadata;\n }\n\n /**\n * This header uniquely identifies the request\n * that was made and can be used for troubleshooting the request.\n *\n * @readonly\n */\n public get requestId(): string | undefined {\n return this.originalResponse.requestId;\n }\n\n /**\n * Indicates the version of the File service used\n * to execute the request.\n *\n * @readonly\n */\n public get version(): string | undefined {\n return this.originalResponse.version;\n }\n\n /**\n * Attributes set for the file.\n *\n * @readonly\n */\n public get fileAttributes(): string | undefined {\n return this.originalResponse.fileAttributes;\n }\n\n /**\n * Creation time for the file.\n *\n * @readonly\n */\n public get fileCreatedOn(): Date | undefined {\n return this.originalResponse.fileCreatedOn;\n }\n\n /**\n * Last write time for the file.\n *\n * @readonly\n */\n public get fileLastWriteOn(): Date | undefined {\n return this.originalResponse.fileLastWriteOn;\n }\n\n /**\n * Change time for the file.\n *\n * @readonly\n */\n public get fileChangeOn(): Date | undefined {\n return this.originalResponse.fileChangeOn;\n }\n\n /**\n * Key of the permission set for the file.\n *\n * @readonly\n */\n public get filePermissionKey(): string | undefined {\n return this.originalResponse.filePermissionKey;\n }\n\n /**\n * The fileId of the file.\n *\n * @readonly\n */\n public get fileId(): string | undefined {\n return this.originalResponse.fileId;\n }\n\n /**\n * The parent fileId of the file.\n *\n * @readonly\n */\n public get fileParentId(): string | undefined {\n return this.originalResponse.fileParentId;\n }\n\n /**\n * The response body as a browser Blob.\n * Always undefined in node.js.\n *\n * @readonly\n */\n public get contentAsBlob(): Promise<Blob> | undefined {\n return this.originalResponse.blobBody;\n }\n\n /**\n * When a file is leased, specifies whether the lease is of infinite or fixed duration. Possible\n * values include: 'infinite', 'fixed'\n */\n public get leaseDuration(): LeaseDurationType | undefined {\n return this.originalResponse.leaseDuration;\n }\n\n /**\n * Lease state of the file. Possible values include: 'available', 'leased', 'expired',\n * 'breaking', 'broken'\n */\n public get leaseState(): LeaseStateType | undefined {\n return this.originalResponse.leaseState;\n }\n\n /**\n * The current lease status of the file. Possible values include: 'locked', 'unlocked'\n */\n public get leaseStatus(): LeaseStatusType | undefined {\n return this.originalResponse.leaseStatus;\n }\n\n /**\n * The response body as a node.js Readable stream.\n * Always undefined in the browser.\n *\n * It will automatically retry when internal read stream unexpected ends.\n *\n * @readonly\n */\n public get readableStreamBody(): NodeJS.ReadableStream | undefined {\n return isNode ? this.fileDownloadStream : undefined;\n }\n\n public get _response(): HttpResponse & {\n parsedHeaders: FileDownloadHeaders;\n } {\n return this.originalResponse._response;\n }\n\n private originalResponse: WithResponse<FileDownloadResponseModel, FileDownloadHeaders>;\n private fileDownloadStream?: RetriableReadableStream;\n\n /**\n * Creates an instance of FileDownloadResponse.\n *\n * @param originalResponse -\n * @param getter -\n * @param offset -\n * @param count -\n * @param options -\n */\n public constructor(\n originalResponse: FileDownloadResponseModel,\n getter: ReadableStreamGetter,\n offset: number,\n count: number,\n options: RetriableReadableStreamOptions = {},\n ) {\n this.originalResponse = assertResponse<FileDownloadResponseModel, FileDownloadHeaders>(\n originalResponse,\n );\n this.fileDownloadStream = new RetriableReadableStream(\n this.originalResponse.readableStreamBody!,\n getter,\n offset,\n count,\n options,\n );\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"FileSASPermissions.js","sourceRoot":"","sources":["../../../src/FileSASPermissions.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;;;;;;;GAQG;AACH,MAAM,OAAO,kBAA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,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC9B,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * ONLY AVAILABLE IN NODE.JS RUNTIME.\n *\n * This is a helper class to construct a string representing the permissions granted by a ServiceSAS to a file. Setting\n * a value to true means that any SAS which uses these permissions will grant permissions for that operation. Once all\n * the values are set, this should be serialized with toString and set as the permissions field on a\n * {@link FileSASSignatureValues} object. It is possible to construct the permissions string without this class, but\n * the order of the permissions is particular and this class guarantees correctness.\n */\nexport class FileSASPermissions {\n /**\n * Creates a FileSASPermissions from the specified permissions string. This method will throw an\n * Error if it encounters a character that does not correspond to a valid permission.\n *\n * @param permissions -\n */\n public static parse(permissions: string): FileSASPermissions {\n const fileSASPermissions = new FileSASPermissions();\n\n for (const char of permissions) {\n switch (char) {\n case \"r\":\n fileSASPermissions.read = true;\n break;\n case \"c\":\n fileSASPermissions.create = true;\n break;\n case \"w\":\n fileSASPermissions.write = true;\n break;\n case \"d\":\n fileSASPermissions.delete = true;\n break;\n default:\n throw new RangeError(`Invalid permission: ${char}`);\n }\n }\n\n return fileSASPermissions;\n }\n\n /**\n * Specifies Read access granted.\n */\n public read: boolean = false;\n\n /**\n * Specifies Create access granted.\n */\n public create: boolean = false;\n\n /**\n * Specifies Write access granted.\n */\n public write: boolean = false;\n\n /**\n * Specifies Delete access granted.\n */\n public delete: boolean = false;\n\n /**\n * Converts the given permissions to a string. Using this method will guarantee the permissions are in an\n * order accepted by the service.\n *\n * @returns A string which represents the FileSASPermissions\n */\n public toString(): string {\n const permissions: string[] = [];\n if (this.read) {\n permissions.push(\"r\");\n }\n if (this.create) {\n permissions.push(\"c\");\n }\n if (this.write) {\n permissions.push(\"w\");\n }\n if (this.delete) {\n permissions.push(\"d\");\n }\n return permissions.join(\"\");\n }\n}\n"]}
1
+ {"version":3,"file":"FileSASPermissions.js","sourceRoot":"","sources":["../../../src/FileSASPermissions.ts"],"names":[],"mappings":"A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G,CAAC,CAAC;QACxB,CAAC;QACD,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACxB,CAAC;QACD,OAAO,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC9B,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * ONLY AVAILABLE IN NODE.JS RUNTIME.\n *\n * This is a helper class to construct a string representing the permissions granted by a ServiceSAS to a file. Setting\n * a value to true means that any SAS which uses these permissions will grant permissions for that operation. Once all\n * the values are set, this should be serialized with toString and set as the permissions field on a\n * {@link FileSASSignatureValues} object. It is possible to construct the permissions string without this class, but\n * the order of the permissions is particular and this class guarantees correctness.\n */\nexport class FileSASPermissions {\n /**\n * Creates a FileSASPermissions from the specified permissions string. This method will throw an\n * Error if it encounters a character that does not correspond to a valid permission.\n *\n * @param permissions -\n */\n public static parse(permissions: string): FileSASPermissions {\n const fileSASPermissions = new FileSASPermissions();\n\n for (const char of permissions) {\n switch (char) {\n case \"r\":\n fileSASPermissions.read = true;\n break;\n case \"c\":\n fileSASPermissions.create = true;\n break;\n case \"w\":\n fileSASPermissions.write = true;\n break;\n case \"d\":\n fileSASPermissions.delete = true;\n break;\n default:\n throw new RangeError(`Invalid permission: ${char}`);\n }\n }\n\n return fileSASPermissions;\n }\n\n /**\n * Specifies Read access granted.\n */\n public read: boolean = false;\n\n /**\n * Specifies Create access granted.\n */\n public create: boolean = false;\n\n /**\n * Specifies Write access granted.\n */\n public write: boolean = false;\n\n /**\n * Specifies Delete access granted.\n */\n public delete: boolean = false;\n\n /**\n * Converts the given permissions to a string. Using this method will guarantee the permissions are in an\n * order accepted by the service.\n *\n * @returns A string which represents the FileSASPermissions\n */\n public toString(): string {\n const permissions: string[] = [];\n if (this.read) {\n permissions.push(\"r\");\n }\n if (this.create) {\n permissions.push(\"c\");\n }\n if (this.write) {\n permissions.push(\"w\");\n }\n if (this.delete) {\n permissions.push(\"d\");\n }\n return permissions.join(\"\");\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"FileSASSignatureValues.js","sourceRoot":"","sources":["../../../src/FileSASSignatureValues.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAc,eAAe,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAe,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAqF5D;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,8BAA8B,CAC5C,sBAA8C,EAC9C,mBAA+C;IAE/C,IACE,CAAC,sBAAsB,CAAC,UAAU;QAClC,CAAC,CAAC,sBAAsB,CAAC,WAAW,IAAI,sBAAsB,CAAC,SAAS,CAAC,EACzE;QACA,MAAM,IAAI,UAAU,CAClB,uGAAuG,CACxG,CAAC;KACH;IAED,MAAM,OAAO,GAAG,sBAAsB,CAAC,OAAO,CAAC,CAAC,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC;IAClG,IAAI,QAAQ,GAAW,GAAG,CAAC;IAC3B,IAAI,sBAAsB,CAAC,QAAQ,EAAE;QACnC,QAAQ,GAAG,GAAG,CAAC;KAChB;IAED,IAAI,mBAAuC,CAAC;IAC5C,8FAA8F;IAC9F,IAAI,sBAAsB,CAAC,WAAW,EAAE;QACtC,IAAI,sBAAsB,CAAC,QAAQ,EAAE;YACnC,mBAAmB,GAAG,kBAAkB,CAAC,KAAK,CAC5C,sBAAsB,CAAC,WAAW,CAAC,QAAQ,EAAE,CAC9C,CAAC,QAAQ,EAAE,CAAC;SACd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B,CAAC,kBAAkB,EACzC,sBAAsB,CAAC,eAAe,EACtC,sBAAsB,CAAC,eAAe,EACtC,sBAAsB,CAAC,WAAW,CACnC,CAAC;AACJ,CAAC;AAED,SAAS,gBAAgB,CAAC,WAAmB,EAAE,SAAiB,EAAE,QAAiB;IACjF,mCAAmC;IACnC,4CAA4C;IAC5C,0DAA0D;IAC1D,MAAM,QAAQ,GAAa,CAAC,SAAS,WAAW,IAAI,SAAS,EAAE,CAAC,CAAC;IACjE,IAAI,QAAQ,EAAE;QACZ,QAAQ,CAAC,IAAI,CAAC,IAAI,QAAQ,EAAE,CAAC,CAAC;KAC/B;IACD,OAAO,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC3B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { StorageSharedKeyCredential } from \"../../storage-blob/src/credentials/StorageSharedKeyCredential\";\nimport { FileSASPermissions } from \"./FileSASPermissions\";\nimport { SasIPRange, ipRangeToString } from \"./SasIPRange\";\nimport { SASProtocol, SASQueryParameters } from \"./SASQueryParameters\";\nimport { ShareSASPermissions } from \"./ShareSASPermissions\";\nimport { SERVICE_VERSION } from \"./utils/constants\";\nimport { truncatedISO8061Date } from \"./utils/utils.common\";\n\n/**\n * ONLY AVAILABLE IN NODE.JS RUNTIME.\n *\n * FileSASSignatureValues is used to help generating File service SAS tokens for shares or files.\n */\n\nexport interface FileSASSignatureValues {\n /**\n * The version of the service this SAS will target. If not specified, it will default to the version targeted by the\n * library.\n */\n version?: string;\n\n /**\n * Optional. SAS protocols, HTTPS only or HTTPSandHTTP\n */\n protocol?: SASProtocol;\n\n /**\n * Optional. When the SAS will take effect.\n */\n startsOn?: Date;\n\n /**\n * Optional only when identifier is provided. The time after which the SAS will no longer work.\n */\n expiresOn?: Date;\n\n /**\n * Optional only when identifier is provided.\n * Please refer to either {@link ShareSASPermissions} or {@link FileSASPermissions} depending on the resource\n * being accessed for help constructing the permissions string.\n */\n permissions?: FileSASPermissions | ShareSASPermissions;\n\n /**\n * Optional. IP ranges allowed in this SAS.\n */\n ipRange?: SasIPRange;\n\n /**\n * The name of the share the SAS user may access.\n */\n shareName: string;\n\n /**\n * Optional. The path of the file like, \"directory/FileName\" or \"FileName\".\n */\n filePath?: string;\n\n /**\n * Optional. The name of the access policy on the share this SAS references if any.\n *\n * @see https://docs.microsoft.com/en-us/rest/api/storageservices/establishing-a-stored-access-policy\n */\n identifier?: string;\n\n /**\n * Optional. The cache-control header for the SAS.\n */\n cacheControl?: string;\n\n /**\n * Optional. The content-disposition header for the SAS.\n */\n contentDisposition?: string;\n\n /**\n * Optional. The content-encoding header for the SAS.\n */\n contentEncoding?: string;\n\n /**\n * Optional. The content-language header for the SAS.\n */\n contentLanguage?: string;\n\n /**\n * Optional. The content-type header for the SAS.\n */\n contentType?: string;\n}\n\n/**\n * ONLY AVAILABLE IN NODE.JS RUNTIME.\n *\n * Creates an instance of SASQueryParameters.\n *\n * Only accepts required settings needed to create a SAS. For optional settings please\n * set corresponding properties directly, such as permissions, startsOn and identifier.\n *\n * WARNING: When identifier is not provided, permissions and expiresOn are required.\n * You MUST assign value to identifier or expiresOn & permissions manually if you initial with\n * this constructor.\n *\n * @param fileSASSignatureValues -\n * @param sharedKeyCredential -\n */\nexport function generateFileSASQueryParameters(\n fileSASSignatureValues: FileSASSignatureValues,\n sharedKeyCredential: StorageSharedKeyCredential\n): SASQueryParameters {\n if (\n !fileSASSignatureValues.identifier &&\n !(fileSASSignatureValues.permissions && fileSASSignatureValues.expiresOn)\n ) {\n throw new RangeError(\n \"Must provide 'permissions' and 'expiresOn' for File SAS generation when 'identifier' is not provided.\"\n );\n }\n\n const version = fileSASSignatureValues.version ? fileSASSignatureValues.version : SERVICE_VERSION;\n let resource: string = \"s\";\n if (fileSASSignatureValues.filePath) {\n resource = \"f\";\n }\n\n let verifiedPermissions: string | undefined;\n // Calling parse and toString guarantees the proper ordering and throws on invalid characters.\n if (fileSASSignatureValues.permissions) {\n if (fileSASSignatureValues.filePath) {\n verifiedPermissions = FileSASPermissions.parse(\n fileSASSignatureValues.permissions.toString()\n ).toString();\n } else {\n verifiedPermissions = ShareSASPermissions.parse(\n fileSASSignatureValues.permissions.toString()\n ).toString();\n }\n }\n\n // Signature is generated on the un-url-encoded values.\n const stringToSign = [\n verifiedPermissions,\n fileSASSignatureValues.startsOn\n ? truncatedISO8061Date(fileSASSignatureValues.startsOn, false)\n : \"\",\n fileSASSignatureValues.expiresOn\n ? truncatedISO8061Date(fileSASSignatureValues.expiresOn, false)\n : \"\",\n getCanonicalName(\n sharedKeyCredential.accountName,\n fileSASSignatureValues.shareName,\n fileSASSignatureValues.filePath\n ),\n fileSASSignatureValues.identifier,\n fileSASSignatureValues.ipRange ? ipRangeToString(fileSASSignatureValues.ipRange) : \"\",\n fileSASSignatureValues.protocol,\n version,\n fileSASSignatureValues.cacheControl,\n fileSASSignatureValues.contentDisposition,\n fileSASSignatureValues.contentEncoding,\n fileSASSignatureValues.contentLanguage,\n fileSASSignatureValues.contentType,\n ].join(\"\\n\");\n\n const signature = sharedKeyCredential.computeHMACSHA256(stringToSign);\n\n return new SASQueryParameters(\n version,\n signature,\n verifiedPermissions,\n undefined,\n undefined,\n fileSASSignatureValues.protocol,\n fileSASSignatureValues.startsOn,\n fileSASSignatureValues.expiresOn,\n fileSASSignatureValues.ipRange,\n fileSASSignatureValues.identifier,\n resource,\n fileSASSignatureValues.cacheControl,\n fileSASSignatureValues.contentDisposition,\n fileSASSignatureValues.contentEncoding,\n fileSASSignatureValues.contentLanguage,\n fileSASSignatureValues.contentType\n );\n}\n\nfunction getCanonicalName(accountName: string, shareName: string, filePath?: string): string {\n // Share: \"/file/account/sharename\"\n // File: \"/file/account/sharename/filename\"\n // File: \"/file/account/sharename/directoryname/filename\"\n const elements: string[] = [`/file/${accountName}/${shareName}`];\n if (filePath) {\n elements.push(`/${filePath}`);\n }\n return elements.join(\"\");\n}\n"]}
1
+ {"version":3,"file":"FileSASSign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eAAe,EACtC,sBAAsB,CAAC,eAAe,EACtC,sBAAsB,CAAC,WAAW,CACnC,CAAC;AACJ,CAAC;AAED,SAAS,gBAAgB,CAAC,WAAmB,EAAE,SAAiB,EAAE,QAAiB;IACjF,mCAAmC;IACnC,4CAA4C;IAC5C,0DAA0D;IAC1D,MAAM,QAAQ,GAAa,CAAC,SAAS,WAAW,IAAI,SAAS,EAAE,CAAC,CAAC;IACjE,IAAI,QAAQ,EAAE,CAAC;QACb,QAAQ,CAAC,IAAI,CAAC,IAAI,QAAQ,EAAE,CAAC,CAAC;IAChC,CAAC;IACD,OAAO,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC3B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { StorageSharedKeyCredential } from \"../../storage-blob/src/credentials/StorageSharedKeyCredential\";\nimport { FileSASPermissions } from \"./FileSASPermissions\";\nimport { SasIPRange, ipRangeToString } from \"./SasIPRange\";\nimport { SASProtocol, SASQueryParameters } from \"./SASQueryParameters\";\nimport { ShareSASPermissions } from \"./ShareSASPermissions\";\nimport { SERVICE_VERSION } from \"./utils/constants\";\nimport { truncatedISO8061Date } from \"./utils/utils.common\";\n\n/**\n * ONLY AVAILABLE IN NODE.JS RUNTIME.\n *\n * FileSASSignatureValues is used to help generating File service SAS tokens for shares or files.\n */\n\nexport interface FileSASSignatureValues {\n /**\n * The version of the service this SAS will target. If not specified, it will default to the version targeted by the\n * library.\n */\n version?: string;\n\n /**\n * Optional. SAS protocols, HTTPS only or HTTPSandHTTP\n */\n protocol?: SASProtocol;\n\n /**\n * Optional. When the SAS will take effect.\n */\n startsOn?: Date;\n\n /**\n * Optional only when identifier is provided. The time after which the SAS will no longer work.\n */\n expiresOn?: Date;\n\n /**\n * Optional only when identifier is provided.\n * Please refer to either {@link ShareSASPermissions} or {@link FileSASPermissions} depending on the resource\n * being accessed for help constructing the permissions string.\n */\n permissions?: FileSASPermissions | ShareSASPermissions;\n\n /**\n * Optional. IP ranges allowed in this SAS.\n */\n ipRange?: SasIPRange;\n\n /**\n * The name of the share the SAS user may access.\n */\n shareName: string;\n\n /**\n * Optional. The path of the file like, \"directory/FileName\" or \"FileName\".\n */\n filePath?: string;\n\n /**\n * Optional. The name of the access policy on the share this SAS references if any.\n *\n * @see https://docs.microsoft.com/en-us/rest/api/storageservices/establishing-a-stored-access-policy\n */\n identifier?: string;\n\n /**\n * Optional. The cache-control header for the SAS.\n */\n cacheControl?: string;\n\n /**\n * Optional. The content-disposition header for the SAS.\n */\n contentDisposition?: string;\n\n /**\n * Optional. The content-encoding header for the SAS.\n */\n contentEncoding?: string;\n\n /**\n * Optional. The content-language header for the SAS.\n */\n contentLanguage?: string;\n\n /**\n * Optional. The content-type header for the SAS.\n */\n contentType?: string;\n}\n\n/**\n * ONLY AVAILABLE IN NODE.JS RUNTIME.\n *\n * Creates an instance of SASQueryParameters.\n *\n * Only accepts required settings needed to create a SAS. For optional settings please\n * set corresponding properties directly, such as permissions, startsOn and identifier.\n *\n * WARNING: When identifier is not provided, permissions and expiresOn are required.\n * You MUST assign value to identifier or expiresOn & permissions manually if you initial with\n * this constructor.\n *\n * @param fileSASSignatureValues -\n * @param sharedKeyCredential -\n */\nexport function generateFileSASQueryParameters(\n fileSASSignatureValues: FileSASSignatureValues,\n sharedKeyCredential: StorageSharedKeyCredential,\n): SASQueryParameters {\n if (\n !fileSASSignatureValues.identifier &&\n !(fileSASSignatureValues.permissions && fileSASSignatureValues.expiresOn)\n ) {\n throw new RangeError(\n \"Must provide 'permissions' and 'expiresOn' for File SAS generation when 'identifier' is not provided.\",\n );\n }\n\n const version = fileSASSignatureValues.version ? fileSASSignatureValues.version : SERVICE_VERSION;\n let resource: string = \"s\";\n if (fileSASSignatureValues.filePath) {\n resource = \"f\";\n }\n\n let verifiedPermissions: string | undefined;\n // Calling parse and toString guarantees the proper ordering and throws on invalid characters.\n if (fileSASSignatureValues.permissions) {\n if (fileSASSignatureValues.filePath) {\n verifiedPermissions = FileSASPermissions.parse(\n fileSASSignatureValues.permissions.toString(),\n ).toString();\n } else {\n verifiedPermissions = ShareSASPermissions.parse(\n fileSASSignatureValues.permissions.toString(),\n ).toString();\n }\n }\n\n // Signature is generated on the un-url-encoded values.\n const stringToSign = [\n verifiedPermissions,\n fileSASSignatureValues.startsOn\n ? truncatedISO8061Date(fileSASSignatureValues.startsOn, false)\n : \"\",\n fileSASSignatureValues.expiresOn\n ? truncatedISO8061Date(fileSASSignatureValues.expiresOn, false)\n : \"\",\n getCanonicalName(\n sharedKeyCredential.accountName,\n fileSASSignatureValues.shareName,\n fileSASSignatureValues.filePath,\n ),\n fileSASSignatureValues.identifier,\n fileSASSignatureValues.ipRange ? ipRangeToString(fileSASSignatureValues.ipRange) : \"\",\n fileSASSignatureValues.protocol,\n version,\n fileSASSignatureValues.cacheControl,\n fileSASSignatureValues.contentDisposition,\n fileSASSignatureValues.contentEncoding,\n fileSASSignatureValues.contentLanguage,\n fileSASSignatureValues.contentType,\n ].join(\"\\n\");\n\n const signature = sharedKeyCredential.computeHMACSHA256(stringToSign);\n\n return new SASQueryParameters(\n version,\n signature,\n verifiedPermissions,\n undefined,\n undefined,\n fileSASSignatureValues.protocol,\n fileSASSignatureValues.startsOn,\n fileSASSignatureValues.expiresOn,\n fileSASSignatureValues.ipRange,\n fileSASSignatureValues.identifier,\n resource,\n fileSASSignatureValues.cacheControl,\n fileSASSignatureValues.contentDisposition,\n fileSASSignatureValues.contentEncoding,\n fileSASSignatureValues.contentLanguage,\n fileSASSignatureValues.contentType,\n );\n}\n\nfunction getCanonicalName(accountName: string, shareName: string, filePath?: string): string {\n // Share: \"/file/account/sharename\"\n // File: \"/file/account/sharename/filename\"\n // File: \"/file/account/sharename/directoryname/filename\"\n const elements: string[] = [`/file/${accountName}/${shareName}`];\n if (filePath) {\n elements.push(`/${filePath}`);\n }\n return elements.join(\"\");\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"FileSystemAttributes.js","s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AC,CAAC;SAC9B;QACD,IAAI,IAAI,CAAC,OAAO,EAAE;YAChB,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;SAC5B;QACD,IAAI,IAAI,CAAC,OAAO,EAAE;YAChB,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;SAC5B;QACD,IAAI,IAAI,CAAC,iBAAiB,EAAE;YAC1B,UAAU,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;SACtC;QACD,IAAI,IAAI,CAAC,WAAW,EAAE;YACpB,UAAU,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;SAChC;QACD,OAAO,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC9B,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * This is a helper class to construct a string representing the NTFS attributes to a file or directory.\n * @see https://docs.microsoft.com/en-us/rest/api/storageservices/create-file#file-system-attributes\n */\nexport class FileSystemAttributes {\n /**\n * Creates a FileSystemAttributes from the specified attributes string. This method will throw an\n * Error if it encounters a string that does not correspond to a valid attributes.\n *\n * @param fileAttributes - The value of header x-ms-file-attributes.\n */\n public static parse(fileAttributes: string): FileSystemAttributes {\n if (!fileAttributes) {\n throw new RangeError(`Invalid fileAttributes: '${fileAttributes}'.`);\n }\n\n const fileSystemAttributes = new FileSystemAttributes();\n\n const attributes = fileAttributes.trim().split(\"|\");\n\n for (let str of attributes) {\n str = str.trim();\n switch (str) {\n case \"ReadOnly\":\n fileSystemAttributes.readonly = true;\n break;\n case \"Hidden\":\n fileSystemAttributes.hidden = true;\n break;\n case \"System\":\n fileSystemAttributes.system = true;\n break;\n case \"None\":\n fileSystemAttributes.none = true;\n break;\n case \"Temporary\":\n fileSystemAttributes.temporary = true;\n break;\n case \"Offline\":\n fileSystemAttributes.offline = true;\n break;\n case \"Directory\":\n fileSystemAttributes.directory = true;\n break;\n case \"Archive\":\n fileSystemAttributes.archive = true;\n break;\n case \"NotContentIndexed\":\n fileSystemAttributes.notContentIndexed = true;\n break;\n case \"NoScrubData\":\n fileSystemAttributes.noScrubData = true;\n break;\n default:\n throw new RangeError(`Invalid attribute: ${str}`);\n }\n }\n\n return fileSystemAttributes;\n }\n\n /**\n * Specifies a directory or file that is read-only.\n */\n public readonly: boolean = false;\n\n /**\n * Specifies a directory or file is hidden.\n */\n public hidden: boolean = false;\n\n /**\n * Specifies a directory or file that the operating system uses a part of, or uses exclusively.\n */\n public system: boolean = false;\n\n /**\n * Specifies a directory or file that does not have other attributes set. This attribute is valid only when used alone.\n */\n public none: boolean = false;\n\n /**\n * Specifies the handle identifies a directory.\n */\n public directory: boolean = false;\n\n /**\n * Specifies a directory or file is an archive. Applications typically use this attribute to mark files for backup or removal.\n */\n public archive: boolean = false;\n\n /**\n * Specifies if a file is temporary.\n */\n public temporary: boolean = false;\n\n /**\n * Specifies the data of a directory or file is not available immediately.\n * This file system attribute is presented primarily to provide compatibility with Windows - Azure Files does not support with offline storage options.\n */\n public offline: boolean = false;\n\n /**\n * Specifies the directory or file is not to be indexed by the content indexing service.\n */\n public notContentIndexed: boolean = false;\n\n /**\n * Specifies the user data stream not to be read by the background data integrity scanner.\n * This file system attribute is presented primarily to provide compatibility with Windows.\n * Applicable to directory or file.\n */\n public noScrubData: boolean = false;\n\n /**\n * Converts the given attributes to a string.\n *\n * @returns A string which represents the FileSystemAttributes\n */\n public toString(): string {\n const attributes: string[] = [];\n if (this.readonly) {\n attributes.push(\"ReadOnly\");\n }\n if (this.hidden) {\n attributes.push(\"Hidden\");\n }\n if (this.system) {\n attributes.push(\"System\");\n }\n if (this.none) {\n attributes.push(\"None\");\n }\n if (this.temporary) {\n attributes.push(\"Temporary\");\n }\n if (this.directory) {\n attributes.push(\"Directory\");\n }\n if (this.archive) {\n attributes.push(\"Archive\");\n }\n if (this.offline) {\n attributes.push(\"Offline\");\n }\n if (this.notContentIndexed) {\n attributes.push(\"NotContentIndexed\");\n }\n if (this.noScrubData) {\n attributes.push(\"NoScrubData\");\n }\n return attributes.join(\"|\");\n }\n}\n"]}
1
+ {"version":3,"file":"FileSystemAttributes.js","sourceRoot":"","sources":["../../../src/FileSystemAttributes.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;;GAGG;AACH,MAAM,OAAO,oBAAoB;IAAjC;QAyDE;;WAEG;QACI,aAAQ,GAAY,KAAK,CAAC;QAEjC;;WAEG;QACI,WAAM,GAAY,KAAK,CAAC;QAE/B;;WAEG;QACI,WAAM,GAAY,KAAK,CAAC;QAE/B;;WAEG;QACI,SAAI,GAAY,KAAK,CAAC;QAE7B;;WAEG;QACI,cAAS,GAAY,KAAK,CAAC;QAElC;;WAEG;QACI,YAAO,GAAY,KAAK,CAAC;QAEhC;;WAEG;QACI,cAAS,GAAY,KAAK,CAAC;QAElC;;;WAGG;QACI,YAAO,GAAY,KAAK,CAAC;QAEhC;;WAEG;QACI,sBAAiB,GAAY,KAAK,CAAC;QAE1C;;;;WAIG;QACI,gBAAW,GAAY,KAAK,CAAC;IAyCtC,CAAC;IApJC;;;;;OAKG;IACI,MAAM,CAAC,KAAK,CAAC,cAAsB;QACxC,IAAI,CAAC,cAAc,EAAE,CAAC;YACpB,MAAM,IAAI,UAAU,CAAC,4BAA4B,cAAc,IAAI,CAAC,CAAC;QACvE,CAAC;QAED,MAAM,oBAAoB,GAAG,IAAI,oBAAoB,EAAE,CAAC;QAExD,MAAM,UAAU,GAAG,cAAc,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAEpD,KAAK,IAAI,GAAG,IAAI,UAAU,EAAE,CAAC;YAC3B,GAAG,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;YACjB,QAAQ,GAAG,EAAE,CAAC;gBACZ,KAAK,UAAU;oBACb,oBAAoB,CAAC,QAAQ,GAAG,IAAI,CAAC;oBACrC,MAAM;gBACR,KAAK,QAAQ;oBACX,oBAAoB,CAAC,MAAM,GAAG,IAAI,CAA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B,CAAC;QACD,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACnB,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC/B,CAAC;QACD,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACnB,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC/B,CAAC;QACD,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC7B,CAAC;QACD,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC7B,CAAC;QACD,IAAI,IAAI,CAAC,iBAAiB,EAAE,CAAC;YAC3B,UAAU,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;QACvC,CAAC;QACD,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACrB,UAAU,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QACjC,CAAC;QACD,OAAO,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC9B,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * This is a helper class to construct a string representing the NTFS attributes to a file or directory.\n * @see https://docs.microsoft.com/en-us/rest/api/storageservices/create-file#file-system-attributes\n */\nexport class FileSystemAttributes {\n /**\n * Creates a FileSystemAttributes from the specified attributes string. This method will throw an\n * Error if it encounters a string that does not correspond to a valid attributes.\n *\n * @param fileAttributes - The value of header x-ms-file-attributes.\n */\n public static parse(fileAttributes: string): FileSystemAttributes {\n if (!fileAttributes) {\n throw new RangeError(`Invalid fileAttributes: '${fileAttributes}'.`);\n }\n\n const fileSystemAttributes = new FileSystemAttributes();\n\n const attributes = fileAttributes.trim().split(\"|\");\n\n for (let str of attributes) {\n str = str.trim();\n switch (str) {\n case \"ReadOnly\":\n fileSystemAttributes.readonly = true;\n break;\n case \"Hidden\":\n fileSystemAttributes.hidden = true;\n break;\n case \"System\":\n fileSystemAttributes.system = true;\n break;\n case \"None\":\n fileSystemAttributes.none = true;\n break;\n case \"Temporary\":\n fileSystemAttributes.temporary = true;\n break;\n case \"Offline\":\n fileSystemAttributes.offline = true;\n break;\n case \"Directory\":\n fileSystemAttributes.directory = true;\n break;\n case \"Archive\":\n fileSystemAttributes.archive = true;\n break;\n case \"NotContentIndexed\":\n fileSystemAttributes.notContentIndexed = true;\n break;\n case \"NoScrubData\":\n fileSystemAttributes.noScrubData = true;\n break;\n default:\n throw new RangeError(`Invalid attribute: ${str}`);\n }\n }\n\n return fileSystemAttributes;\n }\n\n /**\n * Specifies a directory or file that is read-only.\n */\n public readonly: boolean = false;\n\n /**\n * Specifies a directory or file is hidden.\n */\n public hidden: boolean = false;\n\n /**\n * Specifies a directory or file that the operating system uses a part of, or uses exclusively.\n */\n public system: boolean = false;\n\n /**\n * Specifies a directory or file that does not have other attributes set. This attribute is valid only when used alone.\n */\n public none: boolean = false;\n\n /**\n * Specifies the handle identifies a directory.\n */\n public directory: boolean = false;\n\n /**\n * Specifies a directory or file is an archive. Applications typically use this attribute to mark files for backup or removal.\n */\n public archive: boolean = false;\n\n /**\n * Specifies if a file is temporary.\n */\n public temporary: boolean = false;\n\n /**\n * Specifies the data of a directory or file is not available immediately.\n * This file system attribute is presented primarily to provide compatibility with Windows - Azure Files does not support with offline storage options.\n */\n public offline: boolean = false;\n\n /**\n * Specifies the directory or file is not to be indexed by the content indexing service.\n */\n public notContentIndexed: boolean = false;\n\n /**\n * Specifies the user data stream not to be read by the background data integrity scanner.\n * This file system attribute is presented primarily to provide compatibility with Windows.\n * Applicable to directory or file.\n */\n public noScrubData: boolean = false;\n\n /**\n * Converts the given attributes to a string.\n *\n * @returns A string which represents the FileSystemAttributes\n */\n public toString(): string {\n const attributes: string[] = [];\n if (this.readonly) {\n attributes.push(\"ReadOnly\");\n }\n if (this.hidden) {\n attributes.push(\"Hidden\");\n }\n if (this.system) {\n attributes.push(\"System\");\n }\n if (this.none) {\n attributes.push(\"None\");\n }\n if (this.temporary) {\n attributes.push(\"Temporary\");\n }\n if (this.directory) {\n attributes.push(\"Directory\");\n }\n if (this.archive) {\n attributes.push(\"Archive\");\n }\n if (this.offline) {\n attributes.push(\"Offline\");\n }\n if (this.notContentIndexed) {\n attributes.push(\"NotContentIndexed\");\n }\n if (this.noScrubData) {\n attributes.push(\"NoScrubData\");\n }\n return attributes.join(\"|\");\n }\n}\n"]}
@@ -0,0 +1,259 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+ import { __rest } from "tslib";
4
+ import { convertHttpClient, createRequestPolicyFactoryPolicy, } from "@azure/core-http-compat";
5
+ import { bearerTokenAuthenticationPolicy, decompressResponsePolicyName, } from "@azure/core-rest-pipeline";
6
+ import { authorizeRequestOnTenantChallenge, createClientPipeline } from "@azure/core-client";
7
+ import { parseXML, stringifyXML } from "@azure/core-xml";
8
+ import { isTokenCredential } from "@azure/core-auth";
9
+ import { logger } from "./log";
10
+ import { StorageRetryPolicyFactory } from "./StorageRetryPolicyFactory";
11
+ import { StorageSharedKeyCredential } from "../../storage-blob/src/credentials/StorageSharedKeyCredential";
12
+ import { AnonymousCredential } from "../../storage-blob/src/credentials/AnonymousCredential";
13
+ import { StorageOAuthScopes, StorageFileLoggingAllowedHeaderNames, StorageFileLoggingAllowedQueryParameters, SDK_VERSION, } from "./utils/constants";
14
+ import { getCachedDefaultHttpClient } from "../../storage-blob/src/utils/cache";
15
+ import { storageBrowserPolicy } from "../../storage-blob/src/policies/StorageBrowserPolicyV2";
16
+ import { storageRetryPolicy } from "./policies/StorageRetryPolicyV2";
17
+ import { storageSharedKeyCredentialPolicy } from "../../storage-blob/src/policies/StorageSharedKeyCredentialPolicyV2";
18
+ import { StorageBrowserPolicyFactory } from "../../storage-blob/src/StorageBrowserPolicyFactory";
19
+ // Export following interfaces and types for customers who want to implement their
20
+ // own RequestPolicy or HTTPClient
21
+ export { StorageOAuthScopes, };
22
+ /**
23
+ * A helper to decide if a given argument satisfies the Pipeline contract
24
+ * @param pipeline - An argument that may be a Pipeline
25
+ * @returns true when the argument satisfies the Pipeline contract
26
+ */
27
+ export function isPipelineLike(pipeline) {
28
+ if (!pipeline || typeof pipeline !== "object") {
29
+ return false;
30
+ }
31
+ const castPipeline = pipeline;
32
+ return (Array.isArray(castPipeline.factories) &&
33
+ typeof castPipeline.options === "object" &&
34
+ typeof castPipeline.toServiceClientOptions === "function");
35
+ }
36
+ /**
37
+ * A Pipeline class containing HTTP request policies.
38
+ * You can create a default Pipeline by calling {@link newPipeline}.
39
+ * Or you can create a Pipeline with your own policies by the constructor of Pipeline.
40
+ *
41
+ * Refer to {@link newPipeline} and provided policies before implementing your
42
+ * customized Pipeline.
43
+ */
44
+ export class Pipeline {
45
+ /**
46
+ * Creates an instance of Pipeline. Customize HTTPClient by implementing IHttpClient interface.
47
+ *
48
+ * @param factories -
49
+ * @param options -
50
+ */
51
+ constructor(factories, options = {}) {
52
+ this.factories = factories;
53
+ this.options = options;
54
+ }
55
+ /**
56
+ * Transfer Pipeline object to ServiceClientOptions object which is required by
57
+ * ServiceClient constructor.
58
+ *
59
+ * @returns The ServiceClientOptions object from this Pipeline.
60
+ */
61
+ toServiceClientOptions() {
62
+ return {
63
+ httpClient: this.options.httpClient,
64
+ requestPolicyFactories: this.factories,
65
+ };
66
+ }
67
+ }
68
+ /**
69
+ * Creates a new Pipeline object with Credential provided.
70
+ *
71
+ * @param credential - Such as AnonymousCredential, StorageSharedKeyCredential or any credential from the `@azure/identity` package to authenticate requests to the service. You can also provide an object that implements the TokenCredential interface. If not specified, AnonymousCredential is used.
72
+ * @param pipelineOptions - Optional. Options.
73
+ * @returns A new Pipeline object.
74
+ */
75
+ export function newPipeline(credential, pipelineOptions = {}) {
76
+ if (!credential) {
77
+ credential = new AnonymousCredential();
78
+ }
79
+ const pipeline = new Pipeline([], pipelineOptions);
80
+ pipeline._credential = credential;
81
+ return pipeline;
82
+ }
83
+ function processDownlevelPipeline(pipeline) {
84
+ const knownFactoryFunctions = [
85
+ isAnonymousCredential,
86
+ isStorageSharedKeyCredential,
87
+ isCoreHttpBearerTokenFactory,
88
+ isStorageBrowserPolicyFactory,
89
+ isStorageRetryPolicyFactory,
90
+ isStorageTelemetryPolicyFactory,
91
+ isCoreHttpPolicyFactory,
92
+ ];
93
+ if (pipeline.factories.length) {
94
+ const novelFactories = pipeline.factories.filter((factory) => {
95
+ return !knownFactoryFunctions.some((knownFactory) => knownFactory(factory));
96
+ });
97
+ if (novelFactories.length) {
98
+ const hasInjector = novelFactories.some((factory) => isInjectorPolicyFactory(factory));
99
+ // if there are any left over, wrap in a requestPolicyFactoryPolicy
100
+ return {
101
+ wrappedPolicies: createRequestPolicyFactoryPolicy(novelFactories),
102
+ afterRetry: hasInjector,
103
+ };
104
+ }
105
+ }
106
+ return undefined;
107
+ }
108
+ export function getCoreClientOptions(pipeline) {
109
+ var _a;
110
+ const _b = pipeline.options, { httpClient: v1Client } = _b, restOptions = __rest(_b, ["httpClient"]);
111
+ let httpClient = pipeline._coreHttpClient;
112
+ if (!httpClient) {
113
+ httpClient = v1Client ? convertHttpClient(v1Client) : getCachedDefaultHttpClient();
114
+ pipeline._coreHttpClient = httpClient;
115
+ }
116
+ let corePipeline = pipeline._corePipeline;
117
+ if (!corePipeline) {
118
+ const packageDetails = `azsdk-js-azure-storage-blob/${SDK_VERSION}`;
119
+ const userAgentPrefix = restOptions.userAgentOptions && restOptions.userAgentOptions.userAgentPrefix
120
+ ? `${restOptions.userAgentOptions.userAgentPrefix} ${packageDetails}`
121
+ : `${packageDetails}`;
122
+ corePipeline = createClientPipeline(Object.assign(Object.assign({}, restOptions), { loggingOptions: {
123
+ additionalAllowedHeaderNames: StorageFileLoggingAllowedHeaderNames,
124
+ additionalAllowedQueryParameters: StorageFileLoggingAllowedQueryParameters,
125
+ logger: logger.info,
126
+ }, userAgentOptions: {
127
+ userAgentPrefix,
128
+ }, serializationOptions: {
129
+ stringifyXML,
130
+ serializerOptions: {
131
+ xml: {
132
+ // Use customized XML char key of "#" so we can deserialize metadata
133
+ // with "_" key
134
+ xmlCharKey: "#",
135
+ },
136
+ },
137
+ }, deserializationOptions: {
138
+ parseXML,
139
+ serializerOptions: {
140
+ xml: {
141
+ // Use customized XML char key of "#" so we can deserialize metadata
142
+ // with "_" key
143
+ xmlCharKey: "#",
144
+ },
145
+ },
146
+ } }));
147
+ corePipeline.removePolicy({ phase: "Retry" });
148
+ corePipeline.removePolicy({ name: decompressResponsePolicyName });
149
+ corePipeline.addPolicy(storageRetryPolicy(restOptions.retryOptions), { phase: "Retry" });
150
+ corePipeline.addPolicy(storageBrowserPolicy());
151
+ const downlevelResults = processDownlevelPipeline(pipeline);
152
+ if (downlevelResults) {
153
+ corePipeline.addPolicy(downlevelResults.wrappedPolicies, downlevelResults.afterRetry ? { afterPhase: "Retry" } : undefined);
154
+ }
155
+ const credential = getCredentialFromPipeline(pipeline);
156
+ if (isTokenCredential(credential)) {
157
+ corePipeline.addPolicy(bearerTokenAuthenticationPolicy({
158
+ credential,
159
+ scopes: (_a = restOptions.audience) !== null && _a !== void 0 ? _a : StorageOAuthScopes,
160
+ challengeCallbacks: { authorizeRequestOnChallenge: authorizeRequestOnTenantChallenge },
161
+ }), { phase: "Sign" });
162
+ }
163
+ else if (credential instanceof StorageSharedKeyCredential) {
164
+ corePipeline.addPolicy(storageSharedKeyCredentialPolicy({
165
+ accountName: credential.accountName,
166
+ accountKey: credential.accountKey,
167
+ }), { phase: "Sign" });
168
+ }
169
+ pipeline._corePipeline = corePipeline;
170
+ }
171
+ return Object.assign(Object.assign({}, restOptions), { allowInsecureConnection: true, httpClient, pipeline: corePipeline });
172
+ }
173
+ export function getCredentialFromPipeline(pipeline) {
174
+ // see if we squirreled one away on the type itself
175
+ if (pipeline._credential) {
176
+ return pipeline._credential;
177
+ }
178
+ // if it came from another package, loop over the factories and look for one like before
179
+ let credential = new AnonymousCredential();
180
+ for (const factory of pipeline.factories) {
181
+ if (isTokenCredential(factory.credential)) {
182
+ // Only works if the factory has been attached a "credential" property.
183
+ // We do that in newPipeline() when using TokenCredential.
184
+ credential = factory.credential;
185
+ }
186
+ else if (isStorageSharedKeyCredential(factory)) {
187
+ return factory;
188
+ }
189
+ }
190
+ return credential;
191
+ }
192
+ function isStorageSharedKeyCredential(factory) {
193
+ if (factory instanceof StorageSharedKeyCredential) {
194
+ return true;
195
+ }
196
+ return factory.constructor.name === "StorageSharedKeyCredential";
197
+ }
198
+ function isAnonymousCredential(factory) {
199
+ if (factory instanceof AnonymousCredential) {
200
+ return true;
201
+ }
202
+ return factory.constructor.name === "AnonymousCredential";
203
+ }
204
+ function isCoreHttpBearerTokenFactory(factory) {
205
+ return isTokenCredential(factory.credential);
206
+ }
207
+ function isStorageBrowserPolicyFactory(factory) {
208
+ if (factory instanceof StorageBrowserPolicyFactory) {
209
+ return true;
210
+ }
211
+ return factory.constructor.name === "StorageBrowserPolicyFactory";
212
+ }
213
+ function isStorageRetryPolicyFactory(factory) {
214
+ if (factory instanceof StorageRetryPolicyFactory) {
215
+ return true;
216
+ }
217
+ return factory.constructor.name === "StorageRetryPolicyFactory";
218
+ }
219
+ function isStorageTelemetryPolicyFactory(factory) {
220
+ return factory.constructor.name === "TelemetryPolicyFactory";
221
+ }
222
+ function isInjectorPolicyFactory(factory) {
223
+ return factory.constructor.name === "InjectorPolicyFactory";
224
+ }
225
+ function isCoreHttpPolicyFactory(factory) {
226
+ const knownPolicies = [
227
+ "GenerateClientRequestIdPolicy",
228
+ "TracingPolicy",
229
+ "LogPolicy",
230
+ "ProxyPolicy",
231
+ "DisableResponseDecompressionPolicy",
232
+ "KeepAlivePolicy",
233
+ "DeserializationPolicy",
234
+ ];
235
+ const mockHttpClient = {
236
+ sendRequest: async (request) => {
237
+ return {
238
+ request,
239
+ headers: request.headers.clone(),
240
+ status: 500,
241
+ };
242
+ },
243
+ };
244
+ const mockRequestPolicyOptions = {
245
+ log(_logLevel, _message) {
246
+ /* do nothing */
247
+ },
248
+ shouldLog(_logLevel) {
249
+ return false;
250
+ },
251
+ };
252
+ const policyInstance = factory.create(mockHttpClient, mockRequestPolicyOptions);
253
+ const policyName = policyInstance.constructor.name;
254
+ // bundlers sometimes add a custom suffix to the class name to make it unique
255
+ return knownPolicies.some((knownPolicyName) => {
256
+ return policyName.startsWith(knownPolicyName);
257
+ });
258
+ }
259
+ //# sourceMappingURL=Pipeline.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Pipeline.js","sourceRoot":"","sources":["../../../src/Pipeline.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAElC,OAAO,EAUL,iBAAiB,EACjB,gCAAgC,GAEjC,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAIL,+BAA+B,EAE/B,4BAA4B,GAG7B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,iCAAiC,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC7F,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAmB,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAEtE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAuB,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAC7F,OAAO,EAAE,0BAA0B,EAAE,MAAM,+DAA+D,CAAC;AAC3G,OAAO,EAAE,mBAAmB,EAAE,MAAM,wDAAwD,CAAC;AAE7F,OAAO,EACL,kBAAkB,EAClB,oCAAoC,EACpC,wCAAwC,EACxC,WAAW,GACZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,EAAE,oBAAoB,EAAE,MAAM,wDAAwD,CAAC;AAC9F,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,gCAAgC,EAAE,MAAM,oEAAo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,CAAC;AAED,SAAS,uBAAuB,CAAC,OAA6B;IAC5D,MAAM,aAAa,GAAG;QACpB,+BAA+B;QAC/B,eAAe;QACf,WAAW;QACX,aAAa;QACb,oCAAoC;QACpC,iBAAiB;QACjB,uBAAuB;KACxB,CAAC;IAEF,MAAM,cAAc,GAAgB;QAClC,WAAW,EAAE,KAAK,EAAE,OAAoB,EAAE,EAAE;YAC1C,OAAO;gBACL,OAAO;gBACP,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE;gBAChC,MAAM,EAAE,GAAG;aACZ,CAAC;QACJ,CAAC;KACF,CAAC;IACF,MAAM,wBAAwB,GAAyB;QACrD,GAAG,CAAC,SAA+B,EAAE,QAAgB;YACnD,gBAAgB;QAClB,CAAC;QACD,SAAS,CAAC,SAA+B;YACvC,OAAO,KAAK,CAAC;QACf,CAAC;KACF,CAAC;IACF,MAAM,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,wBAAwB,CAAC,CAAC;IAChF,MAAM,UAAU,GAAG,cAAc,CAAC,WAAW,CAAC,IAAI,CAAC;IACnD,6EAA6E;IAC7E,OAAO,aAAa,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,EAAE;QAC5C,OAAO,UAAU,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n CompatResponse as HttpOperationResponse,\n RequestPolicy as IHttpClient,\n HttpHeadersLike as HttpHeaders,\n RequestPolicy,\n RequestPolicyFactory,\n RequestPolicyOptionsLike as RequestPolicyOptions,\n WebResourceLike as WebResource,\n KeepAliveOptions,\n ExtendedServiceClientOptions,\n convertHttpClient,\n createRequestPolicyFactoryPolicy,\n HttpPipelineLogLevel,\n} from \"@azure/core-http-compat\";\nimport {\n RequestBodyType as HttpRequestBody,\n ProxySettings as ProxyOptions,\n UserAgentPolicyOptions as UserAgentOptions,\n bearerTokenAuthenticationPolicy,\n Pipeline as CorePipeline,\n decompressResponsePolicyName,\n PipelinePolicy,\n HttpClient,\n} from \"@azure/core-rest-pipeline\";\nimport { authorizeRequestOnTenantChallenge, createClientPipeline } from \"@azure/core-client\";\nimport { parseXML, stringifyXML } from \"@azure/core-xml\";\nimport { TokenCredential, isTokenCredential } from \"@azure/core-auth\";\n\nimport { logger } from \"./log\";\nimport { StorageRetryOptions, StorageRetryPolicyFactory } from \"./StorageRetryPolicyFactory\";\nimport { StorageSharedKeyCredential } from \"../../storage-blob/src/credentials/StorageSharedKeyCredential\";\nimport { AnonymousCredential } from \"../../storage-blob/src/credentials/AnonymousCredential\";\nimport { Credential } from \"../../storage-blob/src/credentials/Credential\";\nimport {\n StorageOAuthScopes,\n StorageFileLoggingAllowedHeaderNames,\n StorageFileLoggingAllowedQueryParameters,\n SDK_VERSION,\n} from \"./utils/constants\";\nimport { getCachedDefaultHttpClient } from \"../../storage-blob/src/utils/cache\";\nimport { storageBrowserPolicy } from \"../../storage-blob/src/policies/StorageBrowserPolicyV2\";\nimport { storageRetryPolicy } from \"./policies/StorageRetryPolicyV2\";\nimport { storageSharedKeyCredentialPolicy } from \"../../storage-blob/src/policies/StorageSharedKeyCredentialPolicyV2\";\nimport { StorageBrowserPolicyFactory } from \"../../storage-blob/src/StorageBrowserPolicyFactory\";\nimport { ShareTokenIntent } from \"./generatedModels\";\n\n// Export following interfaces and types for customers who want to implement their\n// own RequestPolicy or HTTPClient\nexport {\n StorageOAuthScopes,\n IHttpClient,\n HttpHeaders,\n HttpRequestBody,\n HttpOperationResponse,\n WebResource,\n RequestPolicyFactory,\n RequestPolicy,\n RequestPolicyOptions,\n};\n\n/**\n * A subset of `@azure/core-http` ServiceClientOptions\n */\nexport interface ServiceClientOptions {\n /**\n * Optional. Configures the HTTP client to send requests and receive responses.\n */\n httpClient?: IHttpClient;\n /**\n * Optional. Overrides the default policy factories.\n */\n requestPolicyFactories?:\n | RequestPolicyFactory[]\n | ((defaultRequestPolicyFactories: RequestPolicyFactory[]) => void | RequestPolicyFactory[]);\n}\n\n/**\n * Option interface for Pipeline constructor.\n */\nexport interface PipelineOptions {\n /**\n * Optional. Configures the HTTP client to send requests and receive responses.\n */\n httpClient?: IHttpClient;\n /**\n * Intent of using TokenCredential in file requests.\n */\n shareTokenIntent?: ShareTokenIntent;\n}\n\n/**\n * An interface for the {@link Pipeline} class containing HTTP request policies.\n * You can create a default Pipeline by calling {@link newPipeline}.\n * Or you can create a Pipeline with your own policies by the constructor of Pipeline.\n *\n * Refer to {@link newPipeline} and provided policies before implementing your\n * customized Pipeline.\n */\nexport interface PipelineLike {\n /**\n * A list of chained request policy factories.\n */\n readonly factories: RequestPolicyFactory[];\n /**\n * Configures pipeline logger and HTTP client.\n */\n readonly options: PipelineOptions;\n /**\n * Transfer Pipeline object to ServiceClientOptions object which is required by\n * ServiceClient constructor.\n *\n * @returns The ServiceClientOptions object from this Pipeline.\n */\n toServiceClientOptions(): ServiceClientOptions;\n}\n\n/**\n * A helper to decide if a given argument satisfies the Pipeline contract\n * @param pipeline - An argument that may be a Pipeline\n * @returns true when the argument satisfies the Pipeline contract\n */\nexport function isPipelineLike(pipeline: unknown): pipeline is PipelineLike {\n if (!pipeline || typeof pipeline !== \"object\") {\n return false;\n }\n\n const castPipeline = pipeline as PipelineLike;\n\n return (\n Array.isArray(castPipeline.factories) &&\n typeof castPipeline.options === \"object\" &&\n typeof castPipeline.toServiceClientOptions === \"function\"\n );\n}\n\n/**\n * A Pipeline class containing HTTP request policies.\n * You can create a default Pipeline by calling {@link newPipeline}.\n * Or you can create a Pipeline with your own policies by the constructor of Pipeline.\n *\n * Refer to {@link newPipeline} and provided policies before implementing your\n * customized Pipeline.\n */\nexport class Pipeline implements PipelineLike {\n /**\n * A list of chained request policy factories.\n */\n public readonly factories: RequestPolicyFactory[];\n /**\n * Configures pipeline logger and HTTP client.\n */\n public readonly options: PipelineOptions;\n\n /**\n * Creates an instance of Pipeline. Customize HTTPClient by implementing IHttpClient interface.\n *\n * @param factories -\n * @param options -\n */\n constructor(factories: RequestPolicyFactory[], options: PipelineOptions = {}) {\n this.factories = factories;\n this.options = options;\n }\n\n /**\n * Transfer Pipeline object to ServiceClientOptions object which is required by\n * ServiceClient constructor.\n *\n * @returns The ServiceClientOptions object from this Pipeline.\n */\n public toServiceClientOptions(): ServiceClientOptions {\n return {\n httpClient: this.options.httpClient,\n requestPolicyFactories: this.factories,\n };\n }\n}\n\n/**\n * Options interface for the {@link newPipeline} function.\n */\nexport interface StoragePipelineOptions {\n /**\n * Options to configure a proxy for outgoing requests.\n */\n proxyOptions?: ProxyOptions;\n /**\n * Options for adding user agent details to outgoing requests.\n */\n userAgentOptions?: UserAgentOptions;\n /**\n * Configures the built-in retry policy behavior.\n */\n retryOptions?: StorageRetryOptions;\n /**\n * Keep alive configurations. Default keep-alive is enabled.\n */\n keepAliveOptions?: KeepAliveOptions;\n /**\n * Configures the HTTP client to send requests and receive responses.\n */\n httpClient?: IHttpClient;\n /**\n * The audience used to retrieve an AAD token.\n * By default, audience 'https://storage.azure.com/.default' will be used.\n */\n audience?: string;\n}\n\n/**\n * Creates a new Pipeline object with Credential provided.\n *\n * @param credential - Such as AnonymousCredential, StorageSharedKeyCredential or any credential from the `@azure/identity` package to authenticate requests to the service. You can also provide an object that implements the TokenCredential interface. If not specified, AnonymousCredential is used.\n * @param pipelineOptions - Optional. Options.\n * @returns A new Pipeline object.\n */\nexport function newPipeline(\n credential?: Credential | TokenCredential,\n pipelineOptions: StoragePipelineOptions = {},\n): Pipeline {\n if (!credential) {\n credential = new AnonymousCredential();\n }\n const pipeline = new Pipeline([], pipelineOptions);\n (pipeline as any)._credential = credential;\n return pipeline;\n}\n\nfunction processDownlevelPipeline(\n pipeline: PipelineLike,\n): { wrappedPolicies: PipelinePolicy; afterRetry: boolean } | undefined {\n const knownFactoryFunctions = [\n isAnonymousCredential,\n isStorageSharedKeyCredential,\n isCoreHttpBearerTokenFactory,\n isStorageBrowserPolicyFactory,\n isStorageRetryPolicyFactory,\n isStorageTelemetryPolicyFactory,\n isCoreHttpPolicyFactory,\n ];\n if (pipeline.factories.length) {\n const novelFactories = pipeline.factories.filter((factory) => {\n return !knownFactoryFunctions.some((knownFactory) => knownFactory(factory));\n });\n if (novelFactories.length) {\n const hasInjector = novelFactories.some((factory) => isInjectorPolicyFactory(factory));\n // if there are any left over, wrap in a requestPolicyFactoryPolicy\n return {\n wrappedPolicies: createRequestPolicyFactoryPolicy(novelFactories),\n afterRetry: hasInjector,\n };\n }\n }\n return undefined;\n}\n\nexport function getCoreClientOptions(pipeline: PipelineLike): ExtendedServiceClientOptions {\n const { httpClient: v1Client, ...restOptions } = pipeline.options as StoragePipelineOptions;\n\n let httpClient: HttpClient = (pipeline as any)._coreHttpClient;\n if (!httpClient) {\n httpClient = v1Client ? convertHttpClient(v1Client) : getCachedDefaultHttpClient();\n (pipeline as any)._coreHttpClient = httpClient;\n }\n\n let corePipeline: CorePipeline = (pipeline as any)._corePipeline;\n if (!corePipeline) {\n const packageDetails = `azsdk-js-azure-storage-blob/${SDK_VERSION}`;\n const userAgentPrefix =\n restOptions.userAgentOptions && restOptions.userAgentOptions.userAgentPrefix\n ? `${restOptions.userAgentOptions.userAgentPrefix} ${packageDetails}`\n : `${packageDetails}`;\n corePipeline = createClientPipeline({\n ...restOptions,\n loggingOptions: {\n additionalAllowedHeaderNames: StorageFileLoggingAllowedHeaderNames,\n additionalAllowedQueryParameters: StorageFileLoggingAllowedQueryParameters,\n logger: logger.info,\n },\n userAgentOptions: {\n userAgentPrefix,\n },\n serializationOptions: {\n stringifyXML,\n serializerOptions: {\n xml: {\n // Use customized XML char key of \"#\" so we can deserialize metadata\n // with \"_\" key\n xmlCharKey: \"#\",\n },\n },\n },\n deserializationOptions: {\n parseXML,\n serializerOptions: {\n xml: {\n // Use customized XML char key of \"#\" so we can deserialize metadata\n // with \"_\" key\n xmlCharKey: \"#\",\n },\n },\n },\n });\n corePipeline.removePolicy({ phase: \"Retry\" });\n corePipeline.removePolicy({ name: decompressResponsePolicyName });\n corePipeline.addPolicy(storageRetryPolicy(restOptions.retryOptions), { phase: \"Retry\" });\n corePipeline.addPolicy(storageBrowserPolicy());\n const downlevelResults = processDownlevelPipeline(pipeline);\n if (downlevelResults) {\n corePipeline.addPolicy(\n downlevelResults.wrappedPolicies,\n downlevelResults.afterRetry ? { afterPhase: \"Retry\" } : undefined,\n );\n }\n const credential = getCredentialFromPipeline(pipeline);\n if (isTokenCredential(credential)) {\n corePipeline.addPolicy(\n bearerTokenAuthenticationPolicy({\n credential,\n scopes: restOptions.audience ?? StorageOAuthScopes,\n challengeCallbacks: { authorizeRequestOnChallenge: authorizeRequestOnTenantChallenge },\n }),\n { phase: \"Sign\" },\n );\n } else if (credential instanceof StorageSharedKeyCredential) {\n corePipeline.addPolicy(\n storageSharedKeyCredentialPolicy({\n accountName: credential.accountName,\n accountKey: (credential as any).accountKey,\n }),\n { phase: \"Sign\" },\n );\n }\n (pipeline as any)._corePipeline = corePipeline;\n }\n return {\n ...restOptions,\n allowInsecureConnection: true,\n httpClient,\n pipeline: corePipeline,\n };\n}\n\nexport function getCredentialFromPipeline(\n pipeline: PipelineLike,\n): StorageSharedKeyCredential | AnonymousCredential | TokenCredential {\n // see if we squirreled one away on the type itself\n if ((pipeline as any)._credential) {\n return (pipeline as any)._credential;\n }\n // if it came from another package, loop over the factories and look for one like before\n let credential = new AnonymousCredential();\n for (const factory of pipeline.factories) {\n if (isTokenCredential((factory as any).credential)) {\n // Only works if the factory has been attached a \"credential\" property.\n // We do that in newPipeline() when using TokenCredential.\n credential = (factory as any).credential;\n } else if (isStorageSharedKeyCredential(factory)) {\n return factory;\n }\n }\n return credential;\n}\n\nfunction isStorageSharedKeyCredential(\n factory: RequestPolicyFactory,\n): factory is StorageSharedKeyCredential {\n if (factory instanceof StorageSharedKeyCredential) {\n return true;\n }\n return factory.constructor.name === \"StorageSharedKeyCredential\";\n}\n\nfunction isAnonymousCredential(factory: RequestPolicyFactory): factory is AnonymousCredential {\n if (factory instanceof AnonymousCredential) {\n return true;\n }\n return factory.constructor.name === \"AnonymousCredential\";\n}\n\nfunction isCoreHttpBearerTokenFactory(factory: RequestPolicyFactory): boolean {\n return isTokenCredential((factory as any).credential);\n}\n\nfunction isStorageBrowserPolicyFactory(\n factory: RequestPolicyFactory,\n): factory is StorageBrowserPolicyFactory {\n if (factory instanceof StorageBrowserPolicyFactory) {\n return true;\n }\n return factory.constructor.name === \"StorageBrowserPolicyFactory\";\n}\n\nfunction isStorageRetryPolicyFactory(\n factory: RequestPolicyFactory,\n): factory is StorageRetryPolicyFactory {\n if (factory instanceof StorageRetryPolicyFactory) {\n return true;\n }\n return factory.constructor.name === \"StorageRetryPolicyFactory\";\n}\n\nfunction isStorageTelemetryPolicyFactory(factory: RequestPolicyFactory): boolean {\n return factory.constructor.name === \"TelemetryPolicyFactory\";\n}\n\nfunction isInjectorPolicyFactory(factory: RequestPolicyFactory): boolean {\n return factory.constructor.name === \"InjectorPolicyFactory\";\n}\n\nfunction isCoreHttpPolicyFactory(factory: RequestPolicyFactory): boolean {\n const knownPolicies = [\n \"GenerateClientRequestIdPolicy\",\n \"TracingPolicy\",\n \"LogPolicy\",\n \"ProxyPolicy\",\n \"DisableResponseDecompressionPolicy\",\n \"KeepAlivePolicy\",\n \"DeserializationPolicy\",\n ];\n\n const mockHttpClient: IHttpClient = {\n sendRequest: async (request: WebResource) => {\n return {\n request,\n headers: request.headers.clone(),\n status: 500,\n };\n },\n };\n const mockRequestPolicyOptions: RequestPolicyOptions = {\n log(_logLevel: HttpPipelineLogLevel, _message: string): void {\n /* do nothing */\n },\n shouldLog(_logLevel: HttpPipelineLogLevel): boolean {\n return false;\n },\n };\n const policyInstance = factory.create(mockHttpClient, mockRequestPolicyOptions);\n const policyName = policyInstance.constructor.name;\n // bundlers sometimes add a custom suffix to the class name to make it unique\n return knownPolicies.some((knownPolicyName) => {\n return policyName.startsWith(knownPolicyName);\n });\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Range.js","sourceRoot":"","sources":["../../../src/Range.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAkBlC;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAAC,KAAY;IACxC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;QACpB,MAAM,IAAI,UAAU,CAAC,wCAAwC,CAAC,CAAC;KAChE;IACD,IAAI,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,KAAK,IAAI,CAAC,EAAE;QACnC,MAAM,IAAI,UAAU,CAClB,mGAAmG,CACpG,CAAC;KACH;IACD,OAAO,KAAK,CAAC,KAAK;QAChB,CAAC,CAAC,SAAS,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,KAAK,GAAG,CAAC,EAAE;QAC3D,CAAC,CAAC,SAAS,KAAK,CAAC,MAAM,GAAG,CAAC;AAC/B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * Range for Service Operations.\n * @see https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-the-range-header-for-file-service-operations\n */\nexport interface Range {\n /**\n * StartByte, larger than or equal 0.\n */\n offset: number;\n /**\n * Optional. Count of bytes, larger than 0.\n * If not provided, will return bytes from offset to the end.\n */\n count?: number;\n}\n\n/**\n * Generate a range string. For example:\n *\n * \"bytes=255-\" or \"bytes=0-511\"\n *\n * @param range - A range of byte positions.\n * @returns The string representation for the byte range.\n */\nexport function rangeToString(range: Range): string {\n if (range.offset < 0) {\n throw new RangeError(`Range.offset cannot be smaller than 0.`);\n }\n if (range.count && range.count <= 0) {\n throw new RangeError(\n `Range.count must be larger than 0. Leave it undefined if you want a range from offset to the end.`\n );\n }\n return range.count\n ? `bytes=${range.offset}-${range.offset + range.count - 1}`\n : `bytes=${range.offset}-`;\n}\n"]}
1
+ {"version":3,"file":"Range.js","sourceRoot":"","sources":["../../../src/Range.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAkBlC;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAAC,KAAY;IACxC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACrB,MAAM,IAAI,UAAU,CAAC,wCAAwC,CAAC,CAAC;IACjE,CAAC;IACD,IAAI,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,KAAK,IAAI,CAAC,EAAE,CAAC;QACpC,MAAM,IAAI,UAAU,CAClB,mGAAmG,CACpG,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC,KAAK;QAChB,CAAC,CAAC,SAAS,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,KAAK,GAAG,CAAC,EAAE;QAC3D,CAAC,CAAC,SAAS,KAAK,CAAC,MAAM,GAAG,CAAC;AAC/B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * Range for Service Operations.\n * @see https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-the-range-header-for-file-service-operations\n */\nexport interface Range {\n /**\n * StartByte, larger than or equal 0.\n */\n offset: number;\n /**\n * Optional. Count of bytes, larger than 0.\n * If not provided, will return bytes from offset to the end.\n */\n count?: number;\n}\n\n/**\n * Generate a range string. For example:\n *\n * \"bytes=255-\" or \"bytes=0-511\"\n *\n * @param range - A range of byte positions.\n * @returns The string representation for the byte range.\n */\nexport function rangeToString(range: Range): string {\n if (range.offset < 0) {\n throw new RangeError(`Range.offset cannot be smaller than 0.`);\n }\n if (range.count && range.count <= 0) {\n throw new RangeError(\n `Range.count must be larger than 0. Leave it undefined if you want a range from offset to the end.`,\n );\n }\n return range.count\n ? `bytes=${range.offset}-${range.offset + range.count - 1}`\n : `bytes=${range.offset}-`;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"SASQueryParameters.js","sourceRoot":"","sources":["../../../src/SASQueryParameters.ts"],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AAM;gBACR,KAAK,MAAM;oBACT,IAAI,CAAC,uBAAuB,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;oBACnE,MAAM;gBACR,KAAK,MAAM;oBACT,IAAI,CAAC,uBAAuB,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;oBACnE,MAAM;gBACR,KAAK,MAAM;oBACT,IAAI,CAAC,uBAAuB,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;oBAC/D,MAAM;aACT;SACF;QACD,OAAO,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;IAED;;;;;;OAMG;IACK,uBAAuB,CAAC,OAAiB,EAAE,GAAW,EAAE,KAAc;QAC5E,IAAI,CAAC,KAAK,EAAE;YACV,OAAO;SACR;QAED,GAAG,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC;QAC9B,KAAK,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;QAClC,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;YACtC,OAAO,CAAC,IAAI,CAAC,GAAG,GAAG,IAAI,KAAK,EAAE,CAAC,CAAC;SACjC;IACH,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { SasIPRange, ipRangeToString } from \"./SasIPRange\";\nimport { truncatedISO8061Date } from \"./utils/utils.common\";\n\n/**\n * Protocols for generated SAS.\n */\nexport enum SASProtocol {\n /**\n * Protocol that allows HTTPS only\n */\n Https = \"https\",\n\n /**\n * Protocol that allows both HTTPS and HTTP\n */\n HttpsAndHttp = \"https,http\",\n}\n\n/**\n * Represents the components that make up an Azure Storage SAS' query parameters. This type is not constructed directly\n * by the user; it is only generated by the {@link AccountSASSignatureValues} and {@link FileSASSignatureValues}\n * types. Once generated, it can be encoded into a {@link String} and appended to a URL directly (though caution should\n * be taken here in case there are existing query parameters, which might affect the appropriate means of appending\n * these query parameters).\n *\n * NOTE: Instances of this class are immutable.\n */\nexport class SASQueryParameters {\n /**\n * The storage API version.\n */\n public readonly version: string;\n\n /**\n * Optional. The allowed HTTP protocol(s).\n */\n public readonly protocol?: SASProtocol;\n\n /**\n * Optional. The start time for this SAS token.\n */\n public readonly startsOn?: Date;\n\n /**\n * Optional only when identifier is provided. The expiry time for this SAS token.\n */\n public readonly expiresOn?: Date;\n\n /**\n * Optional only when identifier is provided.\n * Please refer to {@link AccountSASPermissions}, {@link FileSASPermissions}, or {@link ShareSASPermissions} for\n * more details.\n */\n public readonly permissions?: string;\n\n /**\n * Optional. The storage services being accessed (only for Account SAS). Please refer to {@link AccountSASServices}\n * for more details.\n */\n public readonly services?: string;\n\n /**\n * Optional. The storage resource types being accessed (only for Account SAS). Please refer to\n * {@link AccountSASResourceTypes} for more details.\n */\n public readonly resourceTypes?: string;\n\n /**\n * Optional. The signed identifier (only for {@link FileSASSignatureValues}).\n *\n * @see https://docs.microsoft.com/en-us/rest/api/storageservices/establishing-a-stored-access-policy\n */\n public readonly identifier?: string;\n\n /**\n * Optional. The storage share or file path (only for {@link FileSASSignatureValues}).\n */\n public readonly resource?: string;\n\n /**\n * The signature for the SAS token.\n */\n public readonly signature: string;\n\n /**\n * Value for cache-control header in Blob/File Service SAS.\n */\n public readonly cacheControl?: string;\n\n /**\n * Value for content-disposition header in Blob/File Service SAS.\n */\n public readonly contentDisposition?: string;\n\n /**\n * Value for content-encoding header in Blob/File Service SAS.\n */\n public readonly contentEncoding?: string;\n\n /**\n * Value for content-length header in Blob/File Service SAS.\n */\n public readonly contentLanguage?: string;\n\n /**\n * Value for content-type header in Blob/File Service SAS.\n */\n public readonly contentType?: string;\n\n /**\n * Inner value of getter ipRange.\n */\n private readonly ipRangeInner?: SasIPRange;\n\n /**\n * Optional. IP range allowed for this SAS.\n *\n * @readonly\n */\n public get ipRange(): SasIPRange | undefined {\n if (this.ipRangeInner) {\n return {\n end: this.ipRangeInner.end,\n start: this.ipRangeInner.start,\n };\n }\n return undefined;\n }\n\n /**\n * Creates an instance of SASQueryParameters.\n *\n * @param version - Representing the storage version\n * @param signature - Representing the signature for the SAS token\n * @param permissions - Representing the storage permissions\n * @param services - Representing the storage services being accessed (only for Account SAS)\n * @param resourceTypes - Representing the storage resource types being accessed (only for Account SAS)\n * @param protocol - Representing the allowed HTTP protocol(s)\n * @param startsOn - Representing the start time for this SAS token\n * @param expiresOn - Representing the expiry time for this SAS token\n * @param ipRange - Representing the range of valid IP addresses for this SAS token\n * @param identifier - Representing the signed identifier (only for Service SAS)\n * @param resource - Representing the storage container or blob (only for Service SAS)\n * @param cacheControl - Representing the cache-control header (only for Blob/File Service SAS)\n * @param contentDisposition - Representing the content-disposition header (only for Blob/File Service SAS)\n * @param contentEncoding - Representing the content-encoding header (only for Blob/File Service SAS)\n * @param contentLanguage - Representing the content-language header (only for Blob/File Service SAS)\n * @param contentType - Representing the content-type header (only for Blob/File Service SAS)\n */\n constructor(\n version: string,\n signature: string,\n permissions?: string,\n services?: string,\n resourceTypes?: string,\n protocol?: SASProtocol,\n startsOn?: Date,\n expiresOn?: Date,\n ipRange?: SasIPRange,\n identifier?: string,\n resource?: string,\n cacheControl?: string,\n contentDisposition?: string,\n contentEncoding?: string,\n contentLanguage?: string,\n contentType?: string\n ) {\n this.version = version;\n this.services = services;\n this.resourceTypes = resourceTypes;\n this.expiresOn = expiresOn;\n this.permissions = permissions;\n this.protocol = protocol;\n this.startsOn = startsOn;\n this.ipRangeInner = ipRange;\n this.identifier = identifier;\n this.resource = resource;\n this.signature = signature;\n this.cacheControl = cacheControl;\n this.contentDisposition = contentDisposition;\n this.contentEncoding = contentEncoding;\n this.contentLanguage = contentLanguage;\n this.contentType = contentType;\n }\n\n /**\n * Encodes all SAS query parameters into a string that can be appended to a URL.\n *\n */\n public toString(): string {\n const params: string[] = [\n \"sv\",\n \"ss\",\n \"srt\",\n \"spr\",\n \"st\",\n \"se\",\n \"sip\",\n \"si\",\n \"sr\",\n \"sp\",\n \"sig\",\n \"rscc\",\n \"rscd\",\n \"rsce\",\n \"rscl\",\n \"rsct\",\n ];\n const queries: string[] = [];\n\n for (const param of params) {\n switch (param) {\n case \"sv\":\n this.tryAppendQueryParameter(queries, param, this.version);\n break;\n case \"ss\":\n this.tryAppendQueryParameter(queries, param, this.services);\n break;\n case \"srt\":\n this.tryAppendQueryParameter(queries, param, this.resourceTypes);\n break;\n case \"spr\":\n this.tryAppendQueryParameter(queries, param, this.protocol);\n break;\n case \"st\":\n this.tryAppendQueryParameter(\n queries,\n param,\n this.startsOn ? truncatedISO8061Date(this.startsOn, false) : undefined\n );\n break;\n case \"se\":\n this.tryAppendQueryParameter(\n queries,\n param,\n this.expiresOn ? truncatedISO8061Date(this.expiresOn, false) : undefined\n );\n break;\n case \"sip\":\n this.tryAppendQueryParameter(\n queries,\n param,\n this.ipRange ? ipRangeToString(this.ipRange) : undefined\n );\n break;\n case \"si\":\n this.tryAppendQueryParameter(queries, param, this.identifier);\n break;\n case \"sr\":\n this.tryAppendQueryParameter(queries, param, this.resource);\n break;\n case \"sp\":\n this.tryAppendQueryParameter(queries, param, this.permissions);\n break;\n case \"sig\":\n this.tryAppendQueryParameter(queries, param, this.signature);\n break;\n case \"rscc\":\n this.tryAppendQueryParameter(queries, param, this.cacheControl);\n break;\n case \"rscd\":\n this.tryAppendQueryParameter(queries, param, this.contentDisposition);\n break;\n case \"rsce\":\n this.tryAppendQueryParameter(queries, param, this.contentEncoding);\n break;\n case \"rscl\":\n this.tryAppendQueryParameter(queries, param, this.contentLanguage);\n break;\n case \"rsct\":\n this.tryAppendQueryParameter(queries, param, this.contentType);\n break;\n }\n }\n return queries.join(\"&\");\n }\n\n /**\n * A private helper method used to filter and append query key/value pairs into an array.\n *\n * @param queries -\n * @param key -\n * @param value -\n */\n private tryAppendQueryParameter(queries: string[], key: string, value?: string): void {\n if (!value) {\n return;\n }\n\n key = encodeURIComponent(key);\n value = encodeURIComponent(value);\n if (key.length > 0 && value.length > 0) {\n queries.push(`${key}=${value}`);\n }\n }\n}\n"]}
1
+ {"version":3,"file":"SASQueryParameters.js","sourceRoot":"","sources":["../../../src/SASQueryParameters.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAc,eAAe,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAE5D;;GAEG;AACH,MAAM,CAAN,IAAY,WAUX;AAVD,WAAY,WAAW;IACrB;;OAEG;IACH,8BAAe,CAAA;IAEf;;OAEG;IACH,0CAA2B,CAAA;AAC7B,CAAC,EAVW,WAAW,KAAX,WAAW,QAUtB;AAED;;;;;;;;GAQG;AACH,MAAM,OAAO,kBAAkB;IAuF7B;;;;OAIG;IACH,IAAW,OAAO;QAChB,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACtB,OAAO;gBACL,GAAG,EAAE,IAAI,CAAC,YAAY,CAAC,GAAG;gBAC1B,KAAK,EAAE,IAAI,CAAC,YAAY,CAAC,KAAK;aAC/B,CAAC;QACJ,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,YACE,OAAe,EACf,SAAiB,EACjB,WAAoB,EACpB,QAAiB,EACjB,aAAsB,EACtB,QAAsB,EACtB,QAAe,EACf,SAAgB,EAChB,OAAoB,EACpB,UAAmB,EACnB,QAAiB,EACjB,YAAqB,EACrB,kBAA2B,EAC3B,eAAwB,EACxB,eAAwB,EACxB,WAAoB;QAEpB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/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,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;oBAChE,MAAM;gBACR,KAAK,MAAM;oBACT,IAAI,CAAC,uBAAuB,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC;oBACtE,MAAM;gBACR,KAAK,MAAM;oBACT,IAAI,CAAC,uBAAuB,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;oBACnE,MAAM;gBACR,KAAK,MAAM;oBACT,IAAI,CAAC,uBAAuB,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;oBACnE,MAAM;gBACR,KAAK,MAAM;oBACT,IAAI,CAAC,uBAAuB,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;oBAC/D,MAAM;YACV,CAAC;QACH,CAAC;QACD,OAAO,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;IAED;;;;;;OAMG;IACK,uBAAuB,CAAC,OAAiB,EAAE,GAAW,EAAE,KAAc;QAC5E,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,OAAO;QACT,CAAC;QAED,GAAG,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC;QAC9B,KAAK,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;QAClC,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACvC,OAAO,CAAC,IAAI,CAAC,GAAG,GAAG,IAAI,KAAK,EAAE,CAAC,CAAC;QAClC,CAAC;IACH,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { SasIPRange, ipRangeToString } from \"./SasIPRange\";\nimport { truncatedISO8061Date } from \"./utils/utils.common\";\n\n/**\n * Protocols for generated SAS.\n */\nexport enum SASProtocol {\n /**\n * Protocol that allows HTTPS only\n */\n Https = \"https\",\n\n /**\n * Protocol that allows both HTTPS and HTTP\n */\n HttpsAndHttp = \"https,http\",\n}\n\n/**\n * Represents the components that make up an Azure Storage SAS' query parameters. This type is not constructed directly\n * by the user; it is only generated by the {@link AccountSASSignatureValues} and {@link FileSASSignatureValues}\n * types. Once generated, it can be encoded into a {@link String} and appended to a URL directly (though caution should\n * be taken here in case there are existing query parameters, which might affect the appropriate means of appending\n * these query parameters).\n *\n * NOTE: Instances of this class are immutable.\n */\nexport class SASQueryParameters {\n /**\n * The storage API version.\n */\n public readonly version: string;\n\n /**\n * Optional. The allowed HTTP protocol(s).\n */\n public readonly protocol?: SASProtocol;\n\n /**\n * Optional. The start time for this SAS token.\n */\n public readonly startsOn?: Date;\n\n /**\n * Optional only when identifier is provided. The expiry time for this SAS token.\n */\n public readonly expiresOn?: Date;\n\n /**\n * Optional only when identifier is provided.\n * Please refer to {@link AccountSASPermissions}, {@link FileSASPermissions}, or {@link ShareSASPermissions} for\n * more details.\n */\n public readonly permissions?: string;\n\n /**\n * Optional. The storage services being accessed (only for Account SAS). Please refer to {@link AccountSASServices}\n * for more details.\n */\n public readonly services?: string;\n\n /**\n * Optional. The storage resource types being accessed (only for Account SAS). Please refer to\n * {@link AccountSASResourceTypes} for more details.\n */\n public readonly resourceTypes?: string;\n\n /**\n * Optional. The signed identifier (only for {@link FileSASSignatureValues}).\n *\n * @see https://docs.microsoft.com/en-us/rest/api/storageservices/establishing-a-stored-access-policy\n */\n public readonly identifier?: string;\n\n /**\n * Optional. The storage share or file path (only for {@link FileSASSignatureValues}).\n */\n public readonly resource?: string;\n\n /**\n * The signature for the SAS token.\n */\n public readonly signature: string;\n\n /**\n * Value for cache-control header in Blob/File Service SAS.\n */\n public readonly cacheControl?: string;\n\n /**\n * Value for content-disposition header in Blob/File Service SAS.\n */\n public readonly contentDisposition?: string;\n\n /**\n * Value for content-encoding header in Blob/File Service SAS.\n */\n public readonly contentEncoding?: string;\n\n /**\n * Value for content-length header in Blob/File Service SAS.\n */\n public readonly contentLanguage?: string;\n\n /**\n * Value for content-type header in Blob/File Service SAS.\n */\n public readonly contentType?: string;\n\n /**\n * Inner value of getter ipRange.\n */\n private readonly ipRangeInner?: SasIPRange;\n\n /**\n * Optional. IP range allowed for this SAS.\n *\n * @readonly\n */\n public get ipRange(): SasIPRange | undefined {\n if (this.ipRangeInner) {\n return {\n end: this.ipRangeInner.end,\n start: this.ipRangeInner.start,\n };\n }\n return undefined;\n }\n\n /**\n * Creates an instance of SASQueryParameters.\n *\n * @param version - Representing the storage version\n * @param signature - Representing the signature for the SAS token\n * @param permissions - Representing the storage permissions\n * @param services - Representing the storage services being accessed (only for Account SAS)\n * @param resourceTypes - Representing the storage resource types being accessed (only for Account SAS)\n * @param protocol - Representing the allowed HTTP protocol(s)\n * @param startsOn - Representing the start time for this SAS token\n * @param expiresOn - Representing the expiry time for this SAS token\n * @param ipRange - Representing the range of valid IP addresses for this SAS token\n * @param identifier - Representing the signed identifier (only for Service SAS)\n * @param resource - Representing the storage container or blob (only for Service SAS)\n * @param cacheControl - Representing the cache-control header (only for Blob/File Service SAS)\n * @param contentDisposition - Representing the content-disposition header (only for Blob/File Service SAS)\n * @param contentEncoding - Representing the content-encoding header (only for Blob/File Service SAS)\n * @param contentLanguage - Representing the content-language header (only for Blob/File Service SAS)\n * @param contentType - Representing the content-type header (only for Blob/File Service SAS)\n */\n constructor(\n version: string,\n signature: string,\n permissions?: string,\n services?: string,\n resourceTypes?: string,\n protocol?: SASProtocol,\n startsOn?: Date,\n expiresOn?: Date,\n ipRange?: SasIPRange,\n identifier?: string,\n resource?: string,\n cacheControl?: string,\n contentDisposition?: string,\n contentEncoding?: string,\n contentLanguage?: string,\n contentType?: string,\n ) {\n this.version = version;\n this.services = services;\n this.resourceTypes = resourceTypes;\n this.expiresOn = expiresOn;\n this.permissions = permissions;\n this.protocol = protocol;\n this.startsOn = startsOn;\n this.ipRangeInner = ipRange;\n this.identifier = identifier;\n this.resource = resource;\n this.signature = signature;\n this.cacheControl = cacheControl;\n this.contentDisposition = contentDisposition;\n this.contentEncoding = contentEncoding;\n this.contentLanguage = contentLanguage;\n this.contentType = contentType;\n }\n\n /**\n * Encodes all SAS query parameters into a string that can be appended to a URL.\n *\n */\n public toString(): string {\n const params: string[] = [\n \"sv\",\n \"ss\",\n \"srt\",\n \"spr\",\n \"st\",\n \"se\",\n \"sip\",\n \"si\",\n \"sr\",\n \"sp\",\n \"sig\",\n \"rscc\",\n \"rscd\",\n \"rsce\",\n \"rscl\",\n \"rsct\",\n ];\n const queries: string[] = [];\n\n for (const param of params) {\n switch (param) {\n case \"sv\":\n this.tryAppendQueryParameter(queries, param, this.version);\n break;\n case \"ss\":\n this.tryAppendQueryParameter(queries, param, this.services);\n break;\n case \"srt\":\n this.tryAppendQueryParameter(queries, param, this.resourceTypes);\n break;\n case \"spr\":\n this.tryAppendQueryParameter(queries, param, this.protocol);\n break;\n case \"st\":\n this.tryAppendQueryParameter(\n queries,\n param,\n this.startsOn ? truncatedISO8061Date(this.startsOn, false) : undefined,\n );\n break;\n case \"se\":\n this.tryAppendQueryParameter(\n queries,\n param,\n this.expiresOn ? truncatedISO8061Date(this.expiresOn, false) : undefined,\n );\n break;\n case \"sip\":\n this.tryAppendQueryParameter(\n queries,\n param,\n this.ipRange ? ipRangeToString(this.ipRange) : undefined,\n );\n break;\n case \"si\":\n this.tryAppendQueryParameter(queries, param, this.identifier);\n break;\n case \"sr\":\n this.tryAppendQueryParameter(queries, param, this.resource);\n break;\n case \"sp\":\n this.tryAppendQueryParameter(queries, param, this.permissions);\n break;\n case \"sig\":\n this.tryAppendQueryParameter(queries, param, this.signature);\n break;\n case \"rscc\":\n this.tryAppendQueryParameter(queries, param, this.cacheControl);\n break;\n case \"rscd\":\n this.tryAppendQueryParameter(queries, param, this.contentDisposition);\n break;\n case \"rsce\":\n this.tryAppendQueryParameter(queries, param, this.contentEncoding);\n break;\n case \"rscl\":\n this.tryAppendQueryParameter(queries, param, this.contentLanguage);\n break;\n case \"rsct\":\n this.tryAppendQueryParameter(queries, param, this.contentType);\n break;\n }\n }\n return queries.join(\"&\");\n }\n\n /**\n * A private helper method used to filter and append query key/value pairs into an array.\n *\n * @param queries -\n * @param key -\n * @param value -\n */\n private tryAppendQueryParameter(queries: string[], key: string, value?: string): void {\n if (!value) {\n return;\n }\n\n key = encodeURIComponent(key);\n value = encodeURIComponent(value);\n if (key.length > 0 && value.length > 0) {\n queries.push(`${key}=${value}`);\n }\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ShareClientInternal.js","sourceRoot":"","sources":["../../../src/ShareClientInternal.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAIhD;;GAEG;AACH,MAAM,OAAO,mBAAoB,SAAQ,aAAa;IAGpD,YAAY,GAAW,EAAE,QAAkB;QACzC,KAAK,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC;IACjD,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,UAAsC,EAAE;QAC3D,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACvC,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { Pipeline } from \"../../storage-blob/src/Pipeline\";\nimport { StorageClient } from \"./StorageClient\";\nimport { ShareRestoreOptionalParams, ShareRestoreResponse } from \"./generated/src/models\";\nimport { Share } from \"./generated/src/operationsInterfaces\";\n\n/**\n * ShareClientInternal is the thin wrapper for Share which contains internal helper methods.\n */\nexport class ShareClientInternal extends StorageClient {\n private context: Share;\n\n constructor(url: string, pipeline: Pipeline) {\n super(url, pipeline);\n this.context = this.storageClientContext.share;\n }\n\n public async restore(options: ShareRestoreOptionalParams = {}): Promise<ShareRestoreResponse> {\n return this.context.restore(options);\n }\n}\n"]}
1
+ {"version":3,"file":"ShareClientInternal.js","sourceRoot":"","sources":["../../../src/ShareClientInternal.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAIhD;;GAEG;AACH,MAAM,OAAO,mBAAoB,SAAQ,aAAa;IAGpD,YAAY,GAAW,EAAE,QAAkB;QACzC,KAAK,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC;IACjD,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,UAAsC,EAAE;QAC3D,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACvC,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { Pipeline } from \"./Pipeline\";\nimport { StorageClient } from \"./StorageClient\";\nimport { ShareRestoreOptionalParams, ShareRestoreResponse } from \"./generated/src/models\";\nimport { Share } from \"./generated/src/operationsInterfaces\";\n\n/**\n * ShareClientInternal is the thin wrapper for Share which contains internal helper methods.\n */\nexport class ShareClientInternal extends StorageClient {\n private context: Share;\n\n constructor(url: string, pipeline: Pipeline) {\n super(url, pipeline);\n this.context = this.storageClientContext.share;\n }\n\n public async restore(options: ShareRestoreOptionalParams = {}): Promise<ShareRestoreResponse> {\n return this.context.restore(options);\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ShareSASPermissions.js","sourceRoot":"","sources":["../../../src/ShareSASPermissions.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;;;;;GAMG;AACH,MAAM,OAAO,mBAAmB;IAAhC;QAmCE;;WAEG;QACI,SAAI,GAAY,KAAK,CAAC;QAE7B;;WAEG;QACI,WAAM,GAAY,KAAK,CAAC;QAE/B;;WAEG;Q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I,IAAI,CAAC,IAAI,EAAE;YACb,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SACvB;QACD,OAAO,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC9B,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * This is a helper class to construct a string representing the permissions granted by a ServiceSAS to a share.\n * Setting a value to true means that any SAS which uses these permissions will grant permissions for that operation.\n * Once all the values are set, this should be serialized with toString and set as the permissions field on a\n * {@link FileSASSignatureValues} object. It is possible to construct the permissions string without this class, but\n * the order of the permissions is particular and this class guarantees correctness.\n */\nexport class ShareSASPermissions {\n /**\n * Creates an {@link ShareSASPermissions} from the specified permissions string. This method will throw an\n * Error if it encounters a character that does not correspond to a valid permission.\n *\n * @param permissions -\n */\n public static parse(permissions: string): ShareSASPermissions {\n const shareSASPermissions = new ShareSASPermissions();\n\n for (const char of permissions) {\n switch (char) {\n case \"r\":\n shareSASPermissions.read = true;\n break;\n case \"c\":\n shareSASPermissions.create = true;\n break;\n case \"w\":\n shareSASPermissions.write = true;\n break;\n case \"d\":\n shareSASPermissions.delete = true;\n break;\n case \"l\":\n shareSASPermissions.list = true;\n break;\n default:\n throw new RangeError(`Invalid permission ${char}`);\n }\n }\n\n return shareSASPermissions;\n }\n\n /**\n * Specifies Read access granted.\n */\n public read: boolean = false;\n\n /**\n * Specifies Create access granted.\n */\n public create: boolean = false;\n\n /**\n * Specifies Write access granted.\n */\n public write: boolean = false;\n\n /**\n * Specifies Delete access granted.\n */\n public delete: boolean = false;\n\n /**\n * Specifies List access granted.\n */\n public list: boolean = false;\n\n /**\n * Converts the given permissions to a string. Using this method will guarantee the permissions are in an\n * order accepted by the service.\n *\n * The order of the characters should be as specified here to ensure correctness.\n * @see https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas\n *\n */\n public toString(): string {\n const permissions: string[] = [];\n if (this.read) {\n permissions.push(\"r\");\n }\n if (this.create) {\n permissions.push(\"c\");\n }\n if (this.write) {\n permissions.push(\"w\");\n }\n if (this.delete) {\n permissions.push(\"d\");\n }\n if (this.list) {\n permissions.push(\"l\");\n }\n return permissions.join(\"\");\n }\n}\n"]}
1
+ {"version":3,"file":"ShareSASPermissions.js","sourceRoot":"","sources":["../../../src/ShareSASPermissions.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;;;;;GAMG;AACH,MAAM,OAAO,mBAAmB;IAAhC;QAmCE;;WAEG;QACI,SAAI,GAAY,KAAK,CAAC;QAE7B;;WAEG;QACI,WAAM,GAAY,KAAK,CAAC;QAE/B;;WAEG;QACI,UAAK,GAAY,KAAK,CAAC;QAE9B;;WAEG;QACI,WAAM,GAAY,KAAK,CAAC;QAE/B;;WAEG;QACI,SAAI,GAAY,KAAK,CAAC;IA6B/B,CAAC;IAtFC;;;;;OAKG;IACI,MAAM,CAAC,KAAK,CAAC,WAAmB;QACrC,MAAM,mBAAmB,GAAG,IAAI,mBAAmB,EAAE,CAAC;QAEtD,KAAK,MAAM,IAAI,IAAI,WAAW,EAAE,CAAC;YAC/B,QAAQ,IAAI,EAAE,CAAC;gBACb,KAAK,GAAG;oBACN,mBAAmB,CAAC,IAAI,GAAG,IAAI,CAAC;oBAChC,MAAM;gBACR,KAAK,GAAG;oBACN,mBAAmB,CAAC,MAAM,GAAG,IAAI,CAAC;oBAClC,MAAM;gBACR,KAAK,GAAG;oBACN,mBAAmB,CAAC,KAAK,GAAG,IAAI,CAAC;oBACjC,MAAM;gBACR,KAAK,GAAG;oBACN,mBAAmB,CAAC,MAAM,GAAG,IAAI,CAAC;oBAClC,MAAM;gBACR,KAAK,GAAG;oBACN,mBAAmB,CAAC,IAAI,GAAG,IAAI,CAAC;oBAChC,MAAM;gBACR;oBACE,MAAM,IAAI,UAAU,CAAC,sBAAsB,IAAI,EAAE,CAAC,CAAC;YACvD,CAAC;QACH,CAAC;QAED,OAAO,mBAAmB,CAAC;IAC7B,CAAC;IA2BD;;;;;;;OAOG;IACI,QAAQ;QACb,MAAM,WAAW,GAAa,EAAE,CAAC;QACjC,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACd,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACxB,CAAC;QACD,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACxB,CAAC;QACD,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACxB,CAAC;QACD,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACxB,CAAC;QACD,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACd,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACxB,CAAC;QACD,OAAO,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC9B,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/**\n * This is a helper class to construct a string representing the permissions granted by a ServiceSAS to a share.\n * Setting a value to true means that any SAS which uses these permissions will grant permissions for that operation.\n * Once all the values are set, this should be serialized with toString and set as the permissions field on a\n * {@link FileSASSignatureValues} object. It is possible to construct the permissions string without this class, but\n * the order of the permissions is particular and this class guarantees correctness.\n */\nexport class ShareSASPermissions {\n /**\n * Creates an {@link ShareSASPermissions} from the specified permissions string. This method will throw an\n * Error if it encounters a character that does not correspond to a valid permission.\n *\n * @param permissions -\n */\n public static parse(permissions: string): ShareSASPermissions {\n const shareSASPermissions = new ShareSASPermissions();\n\n for (const char of permissions) {\n switch (char) {\n case \"r\":\n shareSASPermissions.read = true;\n break;\n case \"c\":\n shareSASPermissions.create = true;\n break;\n case \"w\":\n shareSASPermissions.write = true;\n break;\n case \"d\":\n shareSASPermissions.delete = true;\n break;\n case \"l\":\n shareSASPermissions.list = true;\n break;\n default:\n throw new RangeError(`Invalid permission ${char}`);\n }\n }\n\n return shareSASPermissions;\n }\n\n /**\n * Specifies Read access granted.\n */\n public read: boolean = false;\n\n /**\n * Specifies Create access granted.\n */\n public create: boolean = false;\n\n /**\n * Specifies Write access granted.\n */\n public write: boolean = false;\n\n /**\n * Specifies Delete access granted.\n */\n public delete: boolean = false;\n\n /**\n * Specifies List access granted.\n */\n public list: boolean = false;\n\n /**\n * Converts the given permissions to a string. Using this method will guarantee the permissions are in an\n * order accepted by the service.\n *\n * The order of the characters should be as specified here to ensure correctness.\n * @see https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas\n *\n */\n public toString(): string {\n const permissions: string[] = [];\n if (this.read) {\n permissions.push(\"r\");\n }\n if (this.create) {\n permissions.push(\"c\");\n }\n if (this.write) {\n permissions.push(\"w\");\n }\n if (this.delete) {\n permissions.push(\"d\");\n }\n if (this.list) {\n permissions.push(\"l\");\n }\n return permissions.join(\"\");\n }\n}\n"]}