@azure/data-tables 13.3.1 → 13.3.3-alpha.20251117.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (204) hide show
  1. package/dist/browser/TableClient.js +105 -61
  2. package/dist/browser/TableClient.js.map +1 -1
  3. package/dist/browser/TableServiceClient.js +59 -48
  4. package/dist/browser/TableServiceClient.js.map +1 -1
  5. package/dist/browser/TableTransaction.js +34 -9
  6. package/dist/browser/TableTransaction.js.map +1 -1
  7. package/dist/browser/generated/generatedClient.js +11 -3
  8. package/dist/browser/generated/generatedClient.js.map +1 -1
  9. package/dist/browser/generated/generatedClientContext.js +10 -3
  10. package/dist/browser/generated/generatedClientContext.js.map +1 -1
  11. package/dist/browser/generated/models/mappers.js +5 -2
  12. package/dist/browser/generated/models/mappers.js.map +1 -1
  13. package/dist/browser/generated/operations/service.js +1 -0
  14. package/dist/browser/generated/operations/service.js.map +1 -1
  15. package/dist/browser/generated/operations/table.js +1 -0
  16. package/dist/browser/generated/operations/table.js.map +1 -1
  17. package/dist/browser/sas/accountSasPermissions.d.ts +1 -1
  18. package/dist/browser/sas/accountSasPermissions.js +2 -2
  19. package/dist/browser/sas/accountSasPermissions.js.map +1 -1
  20. package/dist/browser/sas/accountSasResourceTypes.d.ts +1 -1
  21. package/dist/browser/sas/accountSasResourceTypes.js +1 -1
  22. package/dist/browser/sas/accountSasResourceTypes.js.map +1 -1
  23. package/dist/browser/sas/accountSasSignatureValues.d.ts +1 -1
  24. package/dist/browser/sas/accountSasSignatureValues.js +1 -1
  25. package/dist/browser/sas/accountSasSignatureValues.js.map +1 -1
  26. package/dist/browser/sas/generateAccountSas.d.ts +1 -1
  27. package/dist/browser/sas/generateAccountSas.js +9 -4
  28. package/dist/browser/sas/generateAccountSas.js.map +1 -1
  29. package/dist/browser/sas/generateTableSas.d.ts +1 -1
  30. package/dist/browser/sas/generateTableSas.js +6 -3
  31. package/dist/browser/sas/generateTableSas.js.map +1 -1
  32. package/dist/browser/sas/sasQueryParameters.d.ts +1 -1
  33. package/dist/browser/sas/sasQueryParameters.js +112 -0
  34. package/dist/browser/sas/sasQueryParameters.js.map +1 -1
  35. package/dist/browser/sas/tableSasSignatureValues.d.ts +1 -1
  36. package/dist/browser/sas/tableSasSignatureValues.js +6 -7
  37. package/dist/browser/sas/tableSasSignatureValues.js.map +1 -1
  38. package/dist/browser/secondaryEndpointPolicy.js +10 -2
  39. package/dist/browser/secondaryEndpointPolicy.js.map +1 -1
  40. package/dist/browser/serialization.js +16 -10
  41. package/dist/browser/serialization.js.map +1 -1
  42. package/dist/browser/utils/continuationToken.js +5 -1
  43. package/dist/browser/utils/continuationToken.js.map +1 -1
  44. package/dist/browser/utils/errorHelpers.js +3 -4
  45. package/dist/browser/utils/errorHelpers.js.map +1 -1
  46. package/dist/browser/utils/isCosmosEndpoint.js +2 -3
  47. package/dist/browser/utils/isCosmosEndpoint.js.map +1 -1
  48. package/dist/browser/utils/tracing.js +1 -1
  49. package/dist/browser/utils/tracing.js.map +1 -1
  50. package/dist/commonjs/TableClient.js +105 -61
  51. package/dist/commonjs/TableClient.js.map +1 -1
  52. package/dist/commonjs/TableServiceClient.js +59 -48
  53. package/dist/commonjs/TableServiceClient.js.map +1 -1
  54. package/dist/commonjs/TableTransaction.js +34 -9
  55. package/dist/commonjs/TableTransaction.js.map +1 -1
  56. package/dist/commonjs/generated/generatedClient.js +11 -3
  57. package/dist/commonjs/generated/generatedClient.js.map +1 -1
  58. package/dist/commonjs/generated/generatedClientContext.js +10 -3
  59. package/dist/commonjs/generated/generatedClientContext.js.map +1 -1
  60. package/dist/commonjs/generated/models/mappers.js +5 -2
  61. package/dist/commonjs/generated/models/mappers.js.map +1 -1
  62. package/dist/commonjs/generated/operations/service.js +1 -0
  63. package/dist/commonjs/generated/operations/service.js.map +1 -1
  64. package/dist/commonjs/generated/operations/table.js +1 -0
  65. package/dist/commonjs/generated/operations/table.js.map +1 -1
  66. package/dist/commonjs/sas/accountSasPermissions.d.ts +1 -1
  67. package/dist/commonjs/sas/accountSasPermissions.js +2 -2
  68. package/dist/commonjs/sas/accountSasPermissions.js.map +1 -1
  69. package/dist/commonjs/sas/accountSasResourceTypes.d.ts +1 -1
  70. package/dist/commonjs/sas/accountSasResourceTypes.js +1 -1
  71. package/dist/commonjs/sas/accountSasResourceTypes.js.map +1 -1
  72. package/dist/commonjs/sas/accountSasSignatureValues.d.ts +1 -1
  73. package/dist/commonjs/sas/accountSasSignatureValues.js +1 -1
  74. package/dist/commonjs/sas/accountSasSignatureValues.js.map +1 -1
  75. package/dist/commonjs/sas/generateAccountSas.d.ts +1 -1
  76. package/dist/commonjs/sas/generateAccountSas.js +9 -4
  77. package/dist/commonjs/sas/generateAccountSas.js.map +1 -1
  78. package/dist/commonjs/sas/generateTableSas.d.ts +1 -1
  79. package/dist/commonjs/sas/generateTableSas.js +6 -3
  80. package/dist/commonjs/sas/generateTableSas.js.map +1 -1
  81. package/dist/commonjs/sas/sasQueryParameters.d.ts +1 -1
  82. package/dist/commonjs/sas/sasQueryParameters.js +112 -0
  83. package/dist/commonjs/sas/sasQueryParameters.js.map +1 -1
  84. package/dist/commonjs/sas/tableSasSignatureValues.d.ts +1 -1
  85. package/dist/commonjs/sas/tableSasSignatureValues.js +6 -7
  86. package/dist/commonjs/sas/tableSasSignatureValues.js.map +1 -1
  87. package/dist/commonjs/secondaryEndpointPolicy.js +10 -2
  88. package/dist/commonjs/secondaryEndpointPolicy.js.map +1 -1
  89. package/dist/commonjs/serialization.js +16 -10
  90. package/dist/commonjs/serialization.js.map +1 -1
  91. package/dist/commonjs/tsdoc-metadata.json +11 -11
  92. package/dist/commonjs/utils/continuationToken.js +5 -1
  93. package/dist/commonjs/utils/continuationToken.js.map +1 -1
  94. package/dist/commonjs/utils/errorHelpers.js +3 -4
  95. package/dist/commonjs/utils/errorHelpers.js.map +1 -1
  96. package/dist/commonjs/utils/isCosmosEndpoint.js +2 -3
  97. package/dist/commonjs/utils/isCosmosEndpoint.js.map +1 -1
  98. package/dist/commonjs/utils/tracing.js +1 -1
  99. package/dist/commonjs/utils/tracing.js.map +1 -1
  100. package/dist/commonjs/utils/transactionHeaders.js +5 -2
  101. package/dist/commonjs/utils/transactionHeaders.js.map +1 -1
  102. package/dist/esm/TableClient.js +105 -61
  103. package/dist/esm/TableClient.js.map +1 -1
  104. package/dist/esm/TableServiceClient.js +59 -48
  105. package/dist/esm/TableServiceClient.js.map +1 -1
  106. package/dist/esm/TableTransaction.js +34 -9
  107. package/dist/esm/TableTransaction.js.map +1 -1
  108. package/dist/esm/generated/generatedClient.js +11 -3
  109. package/dist/esm/generated/generatedClient.js.map +1 -1
  110. package/dist/esm/generated/generatedClientContext.js +10 -3
  111. package/dist/esm/generated/generatedClientContext.js.map +1 -1
  112. package/dist/esm/generated/models/mappers.js +5 -2
  113. package/dist/esm/generated/models/mappers.js.map +1 -1
  114. package/dist/esm/generated/operations/service.js +1 -0
  115. package/dist/esm/generated/operations/service.js.map +1 -1
  116. package/dist/esm/generated/operations/table.js +1 -0
  117. package/dist/esm/generated/operations/table.js.map +1 -1
  118. package/dist/esm/sas/accountSasPermissions.d.ts +1 -1
  119. package/dist/esm/sas/accountSasPermissions.js +2 -2
  120. package/dist/esm/sas/accountSasPermissions.js.map +1 -1
  121. package/dist/esm/sas/accountSasResourceTypes.d.ts +1 -1
  122. package/dist/esm/sas/accountSasResourceTypes.js +1 -1
  123. package/dist/esm/sas/accountSasResourceTypes.js.map +1 -1
  124. package/dist/esm/sas/accountSasSignatureValues.d.ts +1 -1
  125. package/dist/esm/sas/accountSasSignatureValues.js +1 -1
  126. package/dist/esm/sas/accountSasSignatureValues.js.map +1 -1
  127. package/dist/esm/sas/generateAccountSas.d.ts +1 -1
  128. package/dist/esm/sas/generateAccountSas.js +9 -4
  129. package/dist/esm/sas/generateAccountSas.js.map +1 -1
  130. package/dist/esm/sas/generateTableSas.d.ts +1 -1
  131. package/dist/esm/sas/generateTableSas.js +6 -3
  132. package/dist/esm/sas/generateTableSas.js.map +1 -1
  133. package/dist/esm/sas/sasQueryParameters.d.ts +1 -1
  134. package/dist/esm/sas/sasQueryParameters.js +112 -0
  135. package/dist/esm/sas/sasQueryParameters.js.map +1 -1
  136. package/dist/esm/sas/tableSasSignatureValues.d.ts +1 -1
  137. package/dist/esm/sas/tableSasSignatureValues.js +6 -7
  138. package/dist/esm/sas/tableSasSignatureValues.js.map +1 -1
  139. package/dist/esm/secondaryEndpointPolicy.js +10 -2
  140. package/dist/esm/secondaryEndpointPolicy.js.map +1 -1
  141. package/dist/esm/serialization.js +16 -10
  142. package/dist/esm/serialization.js.map +1 -1
  143. package/dist/esm/utils/continuationToken.js +5 -1
  144. package/dist/esm/utils/continuationToken.js.map +1 -1
  145. package/dist/esm/utils/errorHelpers.js +3 -4
  146. package/dist/esm/utils/errorHelpers.js.map +1 -1
  147. package/dist/esm/utils/isCosmosEndpoint.js +2 -3
  148. package/dist/esm/utils/isCosmosEndpoint.js.map +1 -1
  149. package/dist/esm/utils/tracing.js +1 -1
  150. package/dist/esm/utils/tracing.js.map +1 -1
  151. package/dist/esm/utils/transactionHeaders.js +5 -2
  152. package/dist/esm/utils/transactionHeaders.js.map +1 -1
  153. package/dist/react-native/TableClient.js +105 -61
  154. package/dist/react-native/TableClient.js.map +1 -1
  155. package/dist/react-native/TableServiceClient.js +59 -48
  156. package/dist/react-native/TableServiceClient.js.map +1 -1
  157. package/dist/react-native/TableTransaction.js +34 -9
  158. package/dist/react-native/TableTransaction.js.map +1 -1
  159. package/dist/react-native/generated/generatedClient.js +11 -3
  160. package/dist/react-native/generated/generatedClient.js.map +1 -1
  161. package/dist/react-native/generated/generatedClientContext.js +10 -3
  162. package/dist/react-native/generated/generatedClientContext.js.map +1 -1
  163. package/dist/react-native/generated/models/mappers.js +5 -2
  164. package/dist/react-native/generated/models/mappers.js.map +1 -1
  165. package/dist/react-native/generated/operations/service.js +1 -0
  166. package/dist/react-native/generated/operations/service.js.map +1 -1
  167. package/dist/react-native/generated/operations/table.js +1 -0
  168. package/dist/react-native/generated/operations/table.js.map +1 -1
  169. package/dist/react-native/sas/accountSasPermissions.d.ts +1 -1
  170. package/dist/react-native/sas/accountSasPermissions.js +2 -2
  171. package/dist/react-native/sas/accountSasPermissions.js.map +1 -1
  172. package/dist/react-native/sas/accountSasResourceTypes.d.ts +1 -1
  173. package/dist/react-native/sas/accountSasResourceTypes.js +1 -1
  174. package/dist/react-native/sas/accountSasResourceTypes.js.map +1 -1
  175. package/dist/react-native/sas/accountSasSignatureValues.d.ts +1 -1
  176. package/dist/react-native/sas/accountSasSignatureValues.js +1 -1
  177. package/dist/react-native/sas/accountSasSignatureValues.js.map +1 -1
  178. package/dist/react-native/sas/generateAccountSas.d.ts +1 -1
  179. package/dist/react-native/sas/generateAccountSas.js +9 -4
  180. package/dist/react-native/sas/generateAccountSas.js.map +1 -1
  181. package/dist/react-native/sas/generateTableSas.d.ts +1 -1
  182. package/dist/react-native/sas/generateTableSas.js +6 -3
  183. package/dist/react-native/sas/generateTableSas.js.map +1 -1
  184. package/dist/react-native/sas/sasQueryParameters.d.ts +1 -1
  185. package/dist/react-native/sas/sasQueryParameters.js +112 -0
  186. package/dist/react-native/sas/sasQueryParameters.js.map +1 -1
  187. package/dist/react-native/sas/tableSasSignatureValues.d.ts +1 -1
  188. package/dist/react-native/sas/tableSasSignatureValues.js +6 -7
  189. package/dist/react-native/sas/tableSasSignatureValues.js.map +1 -1
  190. package/dist/react-native/secondaryEndpointPolicy.js +10 -2
  191. package/dist/react-native/secondaryEndpointPolicy.js.map +1 -1
  192. package/dist/react-native/serialization.js +16 -10
  193. package/dist/react-native/serialization.js.map +1 -1
  194. package/dist/react-native/utils/continuationToken.js +5 -1
  195. package/dist/react-native/utils/continuationToken.js.map +1 -1
  196. package/dist/react-native/utils/errorHelpers.js +3 -4
  197. package/dist/react-native/utils/errorHelpers.js.map +1 -1
  198. package/dist/react-native/utils/isCosmosEndpoint.js +2 -3
  199. package/dist/react-native/utils/isCosmosEndpoint.js.map +1 -1
  200. package/dist/react-native/utils/tracing.js +1 -1
  201. package/dist/react-native/utils/tracing.js.map +1 -1
  202. package/dist/react-native/utils/transactionHeaders.js +5 -2
  203. package/dist/react-native/utils/transactionHeaders.js.map +1 -1
  204. package/package.json +36 -33
@@ -1 +1 @@
1
- {"version":3,"file":"accountSasSignatureValues.js","sourceRoot":"","sources":["../../../src/sas/accountSasSignatureValues.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,6BAA6B,EAAE,MAAM,4BAA4B,CAAC;AAE3E,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EACL,iCAAiC,EACjC,+BAA+B,GAChC,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,4BAA4B,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAEnG,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AA8DvE;;;;;;;;;;GAUG;AACH,MAAM,UAAU,iCAAiC,CAC/C,yBAAoD,EACpD,UAA8B;IAE9B,MAAM,OAAO,GAAG,yBAAyB,CAAC,OAAO;QAC/C,CAAC,CAAC,yBAAyB,CAAC,OAAO;QACnC,CAAC,CAAC,eAAe,CAAC;IAEpB,MAAM,iBAAiB,GAAG,6BAA6B,CAAC,yBAAyB,CAAC,WAAW,CAAC,CAAC;IAC/F,MAAM,cAAc,GAAG,0BAA0B,CAC/C,4BAA4B,CAAC,yBAAyB,CAAC,QAAQ,CAAC,CACjE,CAAC;IACF,mFAAmF;IACnF,MAAM,mBAAmB,GAAG,+BAA+B,CACzD,iCAAiC,CAAC,yBAAyB,CAAC,aAAa,CAAC,CAC3E,CAAC;IAEF,MAAM,YAAY,GAAG;QACnB,UAAU,CAAC,IAAI;QACf,iBAAiB;QACjB,cAAc;QACd,mBAAmB;QACnB,yBAAyB,CAAC,QAAQ;YAChC,CAAC,CAAC,oBAAoB,CAAC,yBAAyB,CAAC,QAAQ,EAAE,KAAK,CAAC;YACjE,CAAC,CAAC,EAAE;QACN,oBAAoB,CAAC,yBAAyB,CAAC,SAAS,EAAE,KAAK,CAAC;QAChE,yBAAyB,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC,yBAAyB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE;QAC3F,yBAAyB,CAAC,QAAQ,CAAC,CAAC,CAAC,yBAAyB,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE;QAC5E,OAAO;QACP,EAAE,EAAE,uDAAuD;KAC5D,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEb,MAAM,SAAS,GAAW,iBAAiB,CAAC,YAAY,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC;IAE1E,OAAO,IAAI,kBAAkB,CAAC,OAAO,EAAE,SAAS,EAAE;QAChD,WAAW,EAAE,iBAAiB,CAAC,QAAQ,EAAE;QACzC,QAAQ,EAAE,cAAc;QACxB,aAAa,EAAE,mBAAmB;QAClC,QAAQ,EAAE,yBAAyB,CAAC,QAAQ;QAC5C,QAAQ,EAAE,yBAAyB,CAAC,QAAQ;QAC5C,SAAS,EAAE,yBAAyB,CAAC,SAAS;QAC9C,OAAO,EAAE,yBAAyB,CAAC,OAAO;KAC3C,CAAC,CAAC;AACL,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AccountSasPermissions } from \"./accountSasPermissions.js\";\nimport { accountSasPermissionsToString } from \"./accountSasPermissions.js\";\nimport type { SasIPRange } from \"./sasIPRange.js\";\nimport { ipRangeToString } from \"./sasIPRange.js\";\nimport type { SasProtocol } from \"./sasQueryParameters.js\";\nimport { SasQueryParameters } from \"./sasQueryParameters.js\";\nimport {\n accountSasResourceTypesFromString,\n accountSasResourceTypesToString,\n} from \"./accountSasResourceTypes.js\";\nimport { accountSasServicesFromString, accountSasServicesToString } from \"./accountSasServices.js\";\nimport type { NamedKeyCredential } from \"@azure/core-auth\";\nimport { SERVICE_VERSION } from \"../utils/constants.js\";\nimport { computeHMACSHA256 } from \"../utils/computeHMACSHA256.js\";\nimport { truncatedISO8061Date } from \"../utils/truncateISO8061Date.js\";\n\n/**\n * ONLY AVAILABLE IN NODE.JS RUNTIME.\n *\n * AccountSASSignatureValues is used to generate a Shared Access Signature (SAS) for an Azure Storage account. Once\n * all the values here are set appropriately, call {@link generateAccountSasQueryParameters} to obtain a representation\n * of the SAS which can actually be applied to table urls. Note: that both this class and {@link SasQueryParameters}\n * exist because the former is mutable and a logical representation while the latter is immutable and used to generate\n * actual REST requests.\n *\n * @see https://learn.microsoft.com/azure/storage/common/storage-dotnet-shared-access-signature-part-1\n * for more conceptual information on SAS\n *\n * @see https://learn.microsoft.com/rest/api/storageservices/constructing-an-account-sas\n * for descriptions of the parameters, including which are required\n */\nexport interface AccountSasSignatureValues {\n /**\n * If not provided, this defaults to the service version targeted by this version of the library.\n */\n version?: string;\n\n /**\n * Optional. SAS protocols allowed.\n */\n protocol?: SasProtocol;\n\n /**\n * Optional. When the SAS will take effect.\n */\n startsOn?: Date;\n\n /**\n * The time after which the SAS will no longer work.\n */\n expiresOn: Date;\n\n /**\n * Specifies which operations the SAS user may perform. Please refer to {@link AccountSasPermissions} for help\n * constructing the permissions string.\n */\n permissions: AccountSasPermissions;\n\n /**\n * Optional. IP range allowed.\n */\n ipRange?: SasIPRange;\n\n /**\n * The values that indicate the services accessible with this SAS. Please refer to {@link AccountSasServices} to\n * construct this value.\n */\n services: string;\n\n /**\n * The values that indicate the resource types accessible with this SAS. Please refer\n * to {@link AccountSasResourceTypes} to construct this value.\n */\n resourceTypes: string;\n}\n\n/**\n * ONLY AVAILABLE IN NODE.JS RUNTIME.\n *\n * Generates a {@link SasQueryParameters} object which contains all SAS query parameters needed to make an actual\n * REST request.\n *\n * @see https://learn.microsoft.com/en-us/rest/api/storageservices/constructing-an-account-sas\n *\n * @param accountSasSignatureValues -\n * @param sharedKeyCredential -\n */\nexport function generateAccountSasQueryParameters(\n accountSasSignatureValues: AccountSasSignatureValues,\n credential: NamedKeyCredential,\n): SasQueryParameters {\n const version = accountSasSignatureValues.version\n ? accountSasSignatureValues.version\n : SERVICE_VERSION;\n\n const parsedPermissions = accountSasPermissionsToString(accountSasSignatureValues.permissions);\n const parsedServices = accountSasServicesToString(\n accountSasServicesFromString(accountSasSignatureValues.services),\n );\n // to and from string to guarantee the correct order of resoruce types is generated\n const parsedResourceTypes = accountSasResourceTypesToString(\n accountSasResourceTypesFromString(accountSasSignatureValues.resourceTypes),\n );\n\n const stringToSign = [\n credential.name,\n parsedPermissions,\n parsedServices,\n parsedResourceTypes,\n accountSasSignatureValues.startsOn\n ? truncatedISO8061Date(accountSasSignatureValues.startsOn, false)\n : \"\",\n truncatedISO8061Date(accountSasSignatureValues.expiresOn, false),\n accountSasSignatureValues.ipRange ? ipRangeToString(accountSasSignatureValues.ipRange) : \"\",\n accountSasSignatureValues.protocol ? accountSasSignatureValues.protocol : \"\",\n version,\n \"\", // Account SAS requires an additional newline character\n ].join(\"\\n\");\n\n const signature: string = computeHMACSHA256(stringToSign, credential.key);\n\n return new SasQueryParameters(version, signature, {\n permissions: parsedPermissions.toString(),\n services: parsedServices,\n resourceTypes: parsedResourceTypes,\n protocol: accountSasSignatureValues.protocol,\n startsOn: accountSasSignatureValues.startsOn,\n expiresOn: accountSasSignatureValues.expiresOn,\n ipRange: accountSasSignatureValues.ipRange,\n });\n}\n"]}
1
+ {"version":3,"file":"accountSasSignatureValues.js","sourceRoot":"","sources":["../../../src/sas/accountSasSignatureValues.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,6BAA6B,EAAE,MAAM,4BAA4B,CAAC;AAE3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C,EAAE;QAC3F,yBAAyB,CAAC,QAAQ,CAAC,CAAC,CAAC,yBAAyB,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE;QAC5E,OAAO;QACP,EAAE,EAAE,uDAAuD;KAC5D,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEb,MAAM,SAAS,GAAW,iBAAiB,CAAC,YAAY,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC;IAE1E,OAAO,IAAI,kBAAkB,CAAC,OAAO,EAAE,SAAS,EAAE;QAChD,WAAW,EAAE,iBAAiB,CAAC,QAAQ,EAAE;QACzC,QAAQ,EAAE,cAAc;QACxB,aAAa,EAAE,mBAAmB;QAClC,QAAQ,EAAE,yBAAyB,CAAC,QAAQ;QAC5C,QAAQ,EAAE,yBAAyB,CAAC,QAAQ;QAC5C,SAAS,EAAE,yBAAyB,CAAC,SAAS;QAC9C,OAAO,EAAE,yBAAyB,CAAC,OAAO;KAC3C,CAAC,CAAC;AACL,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AccountSasPermissions } from \"./accountSasPermissions.js\";\nimport { accountSasPermissionsToString } from \"./accountSasPermissions.js\";\nimport type { SasIPRange } from \"./sasIPRange.js\";\nimport { ipRangeToString } from \"./sasIPRange.js\";\nimport type { SasProtocol } from \"./sasQueryParameters.js\";\nimport { SasQueryParameters } from \"./sasQueryParameters.js\";\nimport {\n accountSasResourceTypesFromString,\n accountSasResourceTypesToString,\n} from \"./accountSasResourceTypes.js\";\nimport { accountSasServicesFromString, accountSasServicesToString } from \"./accountSasServices.js\";\nimport type { NamedKeyCredential } from \"@azure/core-auth\";\nimport { SERVICE_VERSION } from \"../utils/constants.js\";\nimport { computeHMACSHA256 } from \"../utils/computeHMACSHA256.js\";\nimport { truncatedISO8061Date } from \"../utils/truncateISO8061Date.js\";\n\n/**\n * ONLY AVAILABLE IN NODE.JS RUNTIME.\n *\n * AccountSASSignatureValues is used to generate a Shared Access Signature (SAS) for an Azure Storage account. Once\n * all the values here are set appropriately, call {@link generateAccountSasQueryParameters} to obtain a representation\n * of the SAS which can actually be applied to table urls. Note: that both this class and {@link SasQueryParameters}\n * exist because the former is mutable and a logical representation while the latter is immutable and used to generate\n * actual REST requests.\n *\n * @see https://learn.microsoft.com/azure/storage/common/storage-dotnet-shared-access-signature-part-1\n * for more conceptual information on SAS\n *\n * @see https://learn.microsoft.com/rest/api/storageservices/constructing-an-account-sas\n * for descriptions of the parameters, including which are required\n */\nexport interface AccountSasSignatureValues {\n /**\n * If not provided, this defaults to the service version targeted by this version of the library.\n */\n version?: string;\n\n /**\n * Optional. SAS protocols allowed.\n */\n protocol?: SasProtocol;\n\n /**\n * Optional. When the SAS will take effect.\n */\n startsOn?: Date;\n\n /**\n * The time after which the SAS will no longer work.\n */\n expiresOn: Date;\n\n /**\n * Specifies which operations the SAS user may perform. Please refer to {@link AccountSasPermissions} for help\n * constructing the permissions string.\n */\n permissions: AccountSasPermissions;\n\n /**\n * Optional. IP range allowed.\n */\n ipRange?: SasIPRange;\n\n /**\n * The values that indicate the services accessible with this SAS. Please refer to {@link AccountSasServices} to\n * construct this value.\n */\n services: string;\n\n /**\n * The values that indicate the resource types accessible with this SAS. Please refer\n * to {@link AccountSasResourceTypes} to construct this value.\n */\n resourceTypes: string;\n}\n\n/**\n * ONLY AVAILABLE IN NODE.JS RUNTIME.\n *\n * Generates a {@link SasQueryParameters} object which contains all SAS query parameters needed to make an actual\n * REST request.\n *\n * @see https://learn.microsoft.com/rest/api/storageservices/constructing-an-account-sas\n *\n * @param accountSasSignatureValues -\n * @param sharedKeyCredential -\n */\nexport function generateAccountSasQueryParameters(\n accountSasSignatureValues: AccountSasSignatureValues,\n credential: NamedKeyCredential,\n): SasQueryParameters {\n const version = accountSasSignatureValues.version\n ? accountSasSignatureValues.version\n : SERVICE_VERSION;\n\n const parsedPermissions = accountSasPermissionsToString(accountSasSignatureValues.permissions);\n const parsedServices = accountSasServicesToString(\n accountSasServicesFromString(accountSasSignatureValues.services),\n );\n // to and from string to guarantee the correct order of resoruce types is generated\n const parsedResourceTypes = accountSasResourceTypesToString(\n accountSasResourceTypesFromString(accountSasSignatureValues.resourceTypes),\n );\n\n const stringToSign = [\n credential.name,\n parsedPermissions,\n parsedServices,\n parsedResourceTypes,\n accountSasSignatureValues.startsOn\n ? truncatedISO8061Date(accountSasSignatureValues.startsOn, false)\n : \"\",\n truncatedISO8061Date(accountSasSignatureValues.expiresOn, false),\n accountSasSignatureValues.ipRange ? ipRangeToString(accountSasSignatureValues.ipRange) : \"\",\n accountSasSignatureValues.protocol ? accountSasSignatureValues.protocol : \"\",\n version,\n \"\", // Account SAS requires an additional newline character\n ].join(\"\\n\");\n\n const signature: string = computeHMACSHA256(stringToSign, credential.key);\n\n return new SasQueryParameters(version, signature, {\n permissions: parsedPermissions.toString(),\n services: parsedServices,\n resourceTypes: parsedResourceTypes,\n protocol: accountSasSignatureValues.protocol,\n startsOn: accountSasSignatureValues.startsOn,\n expiresOn: accountSasSignatureValues.expiresOn,\n ipRange: accountSasSignatureValues.ipRange,\n });\n}\n"]}
@@ -7,7 +7,7 @@ import type { SasProtocol } from "./sasQueryParameters.js";
7
7
  * Generates a Table Account Shared Access Signature (SAS) URI based on the client properties
8
8
  * and parameters passed in. The SAS is signed by the shared key credential of the client.
9
9
  *
10
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/create-account-sas
10
+ * @see https://learn.microsoft.com/rest/api/storageservices/create-account-sas
11
11
  *
12
12
  * @param options - Optional parameters.
13
13
  * @returns An account SAS token
@@ -1,6 +1,5 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT License.
3
- import { __rest } from "tslib";
4
3
  import { accountSasPermissionsFromString } from "./accountSasPermissions.js";
5
4
  import { accountSasServicesFromString, accountSasServicesToString } from "./accountSasServices.js";
6
5
  import { isNamedKeyCredential } from "@azure/core-auth";
@@ -9,13 +8,13 @@ import { generateAccountSasQueryParameters } from "./accountSasSignatureValues.j
9
8
  * Generates a Table Account Shared Access Signature (SAS) URI based on the client properties
10
9
  * and parameters passed in. The SAS is signed by the shared key credential of the client.
11
10
  *
12
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/create-account-sas
11
+ * @see https://learn.microsoft.com/rest/api/storageservices/create-account-sas
13
12
  *
14
13
  * @param options - Optional parameters.
15
14
  * @returns An account SAS token
16
15
  */
17
16
  export function generateAccountSas(credential, options = {}) {
18
- const { expiresOn, permissions = accountSasPermissionsFromString("rl"), resourceTypes = "sco", services = accountSasServicesFromString("t") } = options, rest = __rest(options, ["expiresOn", "permissions", "resourceTypes", "services"]);
17
+ const { expiresOn, permissions = accountSasPermissionsFromString("rl"), resourceTypes = "sco", services = accountSasServicesFromString("t"), ...rest } = options;
19
18
  if (!isNamedKeyCredential(credential)) {
20
19
  throw RangeError("Can only generate the account SAS when the client is initialized with a shared key credential");
21
20
  }
@@ -24,7 +23,13 @@ export function generateAccountSas(credential, options = {}) {
24
23
  const now = new Date();
25
24
  expiry = new Date(now.getTime() + 3600 * 1000);
26
25
  }
27
- const sas = generateAccountSasQueryParameters(Object.assign({ permissions, expiresOn: expiry, resourceTypes, services: accountSasServicesToString(services) }, rest), credential).toString();
26
+ const sas = generateAccountSasQueryParameters({
27
+ permissions,
28
+ expiresOn: expiry,
29
+ resourceTypes,
30
+ services: accountSasServicesToString(services),
31
+ ...rest,
32
+ }, credential).toString();
28
33
  return sas;
29
34
  }
30
35
  //# sourceMappingURL=generateAccountSas.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"generateAccountSas.js","sourceRoot":"","sources":["../../../src/sas/generateAccountSas.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAGlC,OAAO,EAAE,+BAA+B,EAAE,MAAM,4BAA4B,CAAC;AAE7E,OAAO,EAAE,4BAA4B,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAEnG,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAGxD,OAAO,EAAE,iCAAiC,EAAE,MAAM,gCAAgC,CAAC;AAEnF;;;;;;;;GAQG;AACH,MAAM,UAAU,kBAAkB,CAChC,UAA8B,EAC9B,UAA6B,EAAE;IAE/B,MAAM,EACJ,SAAS,EACT,WAAW,GAAG,+BAA+B,CAAC,IAAI,CAAC,EACnD,aAAa,GAAG,KAAK,EACrB,QAAQ,GAAG,4BAA4B,CAAC,GAAG,CAAC,KAE1C,OAAO,EADN,IAAI,UACL,OAAO,EANL,yDAML,CAAU,CAAC;IACZ,IAAI,CAAC,oBAAoB,CAAC,UAAU,CAAC,EAAE,CAAC;QACtC,MAAM,UAAU,CACd,+FAA+F,CAChG,CAAC;IACJ,CAAC;IAED,IAAI,MAAM,GAAG,SAAS,CAAC;IAEvB,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,MAAM,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC;IACjD,CAAC;IAED,MAAM,GAAG,GAAG,iCAAiC,iBAEzC,WAAW,EACX,SAAS,EAAE,MAAM,EACjB,aAAa,EACb,QAAQ,EAAE,0BAA0B,CAAC,QAAQ,CAAC,IAC3C,IAAI,GAET,UAAU,CACX,CAAC,QAAQ,EAAE,CAAC;IAEb,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AccountSasPermissions } from \"./accountSasPermissions.js\";\nimport { accountSasPermissionsFromString } from \"./accountSasPermissions.js\";\nimport type { AccountSasServices } from \"./accountSasServices.js\";\nimport { accountSasServicesFromString, accountSasServicesToString } from \"./accountSasServices.js\";\nimport type { NamedKeyCredential } from \"@azure/core-auth\";\nimport { isNamedKeyCredential } from \"@azure/core-auth\";\nimport type { SasIPRange } from \"./sasIPRange.js\";\nimport type { SasProtocol } from \"./sasQueryParameters.js\";\nimport { generateAccountSasQueryParameters } from \"./accountSasSignatureValues.js\";\n\n/**\n * Generates a Table Account Shared Access Signature (SAS) URI based on the client properties\n * and parameters passed in. The SAS is signed by the shared key credential of the client.\n *\n * @see https://learn.microsoft.com/en-us/rest/api/storageservices/create-account-sas\n *\n * @param options - Optional parameters.\n * @returns An account SAS token\n */\nexport function generateAccountSas(\n credential: NamedKeyCredential,\n options: AccountSasOptions = {},\n): string {\n const {\n expiresOn,\n permissions = accountSasPermissionsFromString(\"rl\"),\n resourceTypes = \"sco\",\n services = accountSasServicesFromString(\"t\"),\n ...rest\n } = options;\n if (!isNamedKeyCredential(credential)) {\n throw RangeError(\n \"Can only generate the account SAS when the client is initialized with a shared key credential\",\n );\n }\n\n let expiry = expiresOn;\n\n if (expiry === undefined) {\n const now = new Date();\n expiry = new Date(now.getTime() + 3600 * 1000);\n }\n\n const sas = generateAccountSasQueryParameters(\n {\n permissions,\n expiresOn: expiry,\n resourceTypes,\n services: accountSasServicesToString(services),\n ...rest,\n },\n credential,\n ).toString();\n\n return sas;\n}\n\n/**\n * Options to configure {@link generateAccountSas} operation.\n */\nexport interface AccountSasOptions {\n /**\n * The time at which the shared access signature becomes invalid. Default to an hour later if not provided.\n */\n expiresOn?: Date;\n /**\n * Specifies the list of permissions to be associated with the SAS.\n */\n permissions?: AccountSasPermissions;\n /**\n * Specifies the resource types associated with the shared access signature.\n */\n resourceTypes?: string;\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 * SAS protocols allowed.\n */\n protocol?: SasProtocol;\n\n /**\n * When the SAS will take effect.\n */\n startsOn?: Date;\n /**\n * IP range allowed.\n */\n ipRange?: SasIPRange;\n /**\n * Account services\n */\n services?: AccountSasServices;\n}\n"]}
1
+ {"version":3,"file":"generateAccountSas.js","sourceRoot":"","sources":["../../../src/sas/generateAccountSas.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,+BAA+B,EAAE,MAAM,4BAA4B,CAAC;AAE7E,OAAO,EAAE,4BAA4B,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAEnG,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAGxD,OAAO,EAAE,iCAAiC,EAAE,MAAM,gCAAgC,CAAC;AAEnF;;;;;;;;GAQG;AACH,MAAM,UAAU,kBAAkB,CAChC,UAA8B,EAC9B,UAA6B,EAAE;IAE/B,MAAM,EACJ,SAAS,EACT,WAAW,GAAG,+BAA+B,CAAC,IAAI,CAAC,EACnD,aAAa,GAAG,KAAK,EACrB,QAAQ,GAAG,4BAA4B,CAAC,GAAG,CAAC,EAC5C,GAAG,IAAI,EACR,GAAG,OAAO,CAAC;IACZ,IAAI,CAAC,oBAAoB,CAAC,UAAU,CAAC,EAAE,CAAC;QACtC,MAAM,UAAU,CACd,+FAA+F,CAChG,CAAC;IACJ,CAAC;IAED,IAAI,MAAM,GAAG,SAAS,CAAC;IAEvB,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,MAAM,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC;IACjD,CAAC;IAED,MAAM,GAAG,GAAG,iCAAiC,CAC3C;QACE,WAAW;QACX,SAAS,EAAE,MAAM;QACjB,aAAa;QACb,QAAQ,EAAE,0BAA0B,CAAC,QAAQ,CAAC;QAC9C,GAAG,IAAI;KACR,EACD,UAAU,CACX,CAAC,QAAQ,EAAE,CAAC;IAEb,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AccountSasPermissions } from \"./accountSasPermissions.js\";\nimport { accountSasPermissionsFromString } from \"./accountSasPermissions.js\";\nimport type { AccountSasServices } from \"./accountSasServices.js\";\nimport { accountSasServicesFromString, accountSasServicesToString } from \"./accountSasServices.js\";\nimport type { NamedKeyCredential } from \"@azure/core-auth\";\nimport { isNamedKeyCredential } from \"@azure/core-auth\";\nimport type { SasIPRange } from \"./sasIPRange.js\";\nimport type { SasProtocol } from \"./sasQueryParameters.js\";\nimport { generateAccountSasQueryParameters } from \"./accountSasSignatureValues.js\";\n\n/**\n * Generates a Table Account Shared Access Signature (SAS) URI based on the client properties\n * and parameters passed in. The SAS is signed by the shared key credential of the client.\n *\n * @see https://learn.microsoft.com/rest/api/storageservices/create-account-sas\n *\n * @param options - Optional parameters.\n * @returns An account SAS token\n */\nexport function generateAccountSas(\n credential: NamedKeyCredential,\n options: AccountSasOptions = {},\n): string {\n const {\n expiresOn,\n permissions = accountSasPermissionsFromString(\"rl\"),\n resourceTypes = \"sco\",\n services = accountSasServicesFromString(\"t\"),\n ...rest\n } = options;\n if (!isNamedKeyCredential(credential)) {\n throw RangeError(\n \"Can only generate the account SAS when the client is initialized with a shared key credential\",\n );\n }\n\n let expiry = expiresOn;\n\n if (expiry === undefined) {\n const now = new Date();\n expiry = new Date(now.getTime() + 3600 * 1000);\n }\n\n const sas = generateAccountSasQueryParameters(\n {\n permissions,\n expiresOn: expiry,\n resourceTypes,\n services: accountSasServicesToString(services),\n ...rest,\n },\n credential,\n ).toString();\n\n return sas;\n}\n\n/**\n * Options to configure {@link generateAccountSas} operation.\n */\nexport interface AccountSasOptions {\n /**\n * The time at which the shared access signature becomes invalid. Default to an hour later if not provided.\n */\n expiresOn?: Date;\n /**\n * Specifies the list of permissions to be associated with the SAS.\n */\n permissions?: AccountSasPermissions;\n /**\n * Specifies the resource types associated with the shared access signature.\n */\n resourceTypes?: string;\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 * SAS protocols allowed.\n */\n protocol?: SasProtocol;\n\n /**\n * When the SAS will take effect.\n */\n startsOn?: Date;\n /**\n * IP range allowed.\n */\n ipRange?: SasIPRange;\n /**\n * Account services\n */\n services?: AccountSasServices;\n}\n"]}
@@ -4,7 +4,7 @@ import type { TableSasSignatureValues } from "./tableSasSignatureValues.js";
4
4
  * Generates a Table Service Shared Access Signature (SAS) URI based on the client properties
5
5
  * and parameters passed in. The SAS is signed by the shared key credential of the client.
6
6
  *
7
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas
7
+ * @see https://learn.microsoft.com/rest/api/storageservices/constructing-a-service-sas
8
8
  *
9
9
  * @param options - Optional parameters.
10
10
  * @returns The SAS URI consisting of the URI to the resource represented by this client, followed by the generated SAS token.
@@ -7,7 +7,7 @@ import { tableSasPermissionsFromString } from "./tableSasPermisions.js";
7
7
  * Generates a Table Service Shared Access Signature (SAS) URI based on the client properties
8
8
  * and parameters passed in. The SAS is signed by the shared key credential of the client.
9
9
  *
10
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas
10
+ * @see https://learn.microsoft.com/rest/api/storageservices/constructing-a-service-sas
11
11
  *
12
12
  * @param options - Optional parameters.
13
13
  * @returns The SAS URI consisting of the URI to the resource represented by this client, followed by the generated SAS token.
@@ -28,8 +28,11 @@ export function generateTableSas(tableName, credential, options = {}) {
28
28
  expiresOn = new Date(now.getTime() + 3600 * 1000);
29
29
  }
30
30
  }
31
- const sas = generateTableSasQueryParameters(tableName, credential, Object.assign(Object.assign({}, options), { expiresOn,
32
- permissions })).toString();
31
+ const sas = generateTableSasQueryParameters(tableName, credential, {
32
+ ...options,
33
+ expiresOn,
34
+ permissions,
35
+ }).toString();
33
36
  return sas;
34
37
  }
35
38
  //# sourceMappingURL=generateTableSas.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"generateTableSas.js","sourceRoot":"","sources":["../../../src/sas/generateTableSas.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAExD,OAAO,EAAE,+BAA+B,EAAE,MAAM,8BAA8B,CAAC;AAC/E,OAAO,EAAE,6BAA6B,EAAE,MAAM,yBAAyB,CAAC;AAExE;;;;;;;;GAQG;AACH,MAAM,UAAU,gBAAgB,CAC9B,SAAiB,EACjB,UAA8B,EAC9B,UAAmC,EAAE;IAErC,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;IAEzC,IAAI,CAAC,oBAAoB,CAAC,UAAU,CAAC,EAAE,CAAC;QACtC,MAAM,UAAU,CACd,+FAA+F,CAChG,CAAC;IACJ,CAAC;IAED,sEAAsE;IACtE,8DAA8D;IAC9D,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;QACxB,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,WAAW,GAAG,6BAA6B,CAAC,GAAG,CAAC,CAAC;QACnD,CAAC;QAED,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;YAC5B,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;YACvB,SAAS,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC;QACpD,CAAC;IACH,CAAC;IAED,MAAM,GAAG,GAAG,+BAA+B,CAAC,SAAS,EAAE,UAAU,kCAC5D,OAAO,KACV,SAAS;QACT,WAAW,IACX,CAAC,QAAQ,EAAE,CAAC;IAEd,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { NamedKeyCredential } from \"@azure/core-auth\";\nimport { isNamedKeyCredential } from \"@azure/core-auth\";\nimport type { TableSasSignatureValues } from \"./tableSasSignatureValues.js\";\nimport { generateTableSasQueryParameters } from \"./tableSasSignatureValues.js\";\nimport { tableSasPermissionsFromString } from \"./tableSasPermisions.js\";\n\n/**\n * Generates a Table Service Shared Access Signature (SAS) URI based on the client properties\n * and parameters passed in. The SAS is signed by the shared key credential of the client.\n *\n * @see https://learn.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas\n *\n * @param options - Optional parameters.\n * @returns The SAS URI consisting of the URI to the resource represented by this client, followed by the generated SAS token.\n */\nexport function generateTableSas(\n tableName: string,\n credential: NamedKeyCredential,\n options: TableSasSignatureValues = {},\n): string {\n let { expiresOn, permissions } = options;\n\n if (!isNamedKeyCredential(credential)) {\n throw RangeError(\n \"Can only generate the account SAS when the client is initialized with a shared key credential\",\n );\n }\n\n // expiresOn and permissions are optional if an identifier is provided\n // set defaults when no identifier and no values were provided\n if (!options.identifier) {\n if (!permissions) {\n permissions = tableSasPermissionsFromString(\"r\");\n }\n\n if (expiresOn === undefined) {\n const now = new Date();\n expiresOn = new Date(now.getTime() + 3600 * 1000);\n }\n }\n\n const sas = generateTableSasQueryParameters(tableName, credential, {\n ...options,\n expiresOn,\n permissions,\n }).toString();\n\n return sas;\n}\n"]}
1
+ {"version":3,"file":"generateTableSas.js","sourceRoot":"","sources":["../../../src/sas/generateTableSas.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAExD,OAAO,EAAE,+BAA+B,EAAE,MAAM,8BAA8B,CAAC;AAC/E,OAAO,EAAE,6BAA6B,EAAE,MAAM,yBAAyB,CAAC;AAExE;;;;;;;;GAQG;AACH,MAAM,UAAU,gBAAgB,CAC9B,SAAiB,EACjB,UAA8B,EAC9B,UAAmC,EAAE;IAErC,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;IAEzC,IAAI,CAAC,oBAAoB,CAAC,UAAU,CAAC,EAAE,CAAC;QACtC,MAAM,UAAU,CACd,+FAA+F,CAChG,CAAC;IACJ,CAAC;IAED,sEAAsE;IACtE,8DAA8D;IAC9D,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;QACxB,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,WAAW,GAAG,6BAA6B,CAAC,GAAG,CAAC,CAAC;QACnD,CAAC;QAED,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;YAC5B,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;YACvB,SAAS,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC;QACpD,CAAC;IACH,CAAC;IAED,MAAM,GAAG,GAAG,+BAA+B,CAAC,SAAS,EAAE,UAAU,EAAE;QACjE,GAAG,OAAO;QACV,SAAS;QACT,WAAW;KACZ,CAAC,CAAC,QAAQ,EAAE,CAAC;IAEd,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { NamedKeyCredential } from \"@azure/core-auth\";\nimport { isNamedKeyCredential } from \"@azure/core-auth\";\nimport type { TableSasSignatureValues } from \"./tableSasSignatureValues.js\";\nimport { generateTableSasQueryParameters } from \"./tableSasSignatureValues.js\";\nimport { tableSasPermissionsFromString } from \"./tableSasPermisions.js\";\n\n/**\n * Generates a Table Service Shared Access Signature (SAS) URI based on the client properties\n * and parameters passed in. The SAS is signed by the shared key credential of the client.\n *\n * @see https://learn.microsoft.com/rest/api/storageservices/constructing-a-service-sas\n *\n * @param options - Optional parameters.\n * @returns The SAS URI consisting of the URI to the resource represented by this client, followed by the generated SAS token.\n */\nexport function generateTableSas(\n tableName: string,\n credential: NamedKeyCredential,\n options: TableSasSignatureValues = {},\n): string {\n let { expiresOn, permissions } = options;\n\n if (!isNamedKeyCredential(credential)) {\n throw RangeError(\n \"Can only generate the account SAS when the client is initialized with a shared key credential\",\n );\n }\n\n // expiresOn and permissions are optional if an identifier is provided\n // set defaults when no identifier and no values were provided\n if (!options.identifier) {\n if (!permissions) {\n permissions = tableSasPermissionsFromString(\"r\");\n }\n\n if (expiresOn === undefined) {\n const now = new Date();\n expiresOn = new Date(now.getTime() + 3600 * 1000);\n }\n }\n\n const sas = generateTableSasQueryParameters(tableName, credential, {\n ...options,\n expiresOn,\n permissions,\n }).toString();\n\n return sas;\n}\n"]}
@@ -53,7 +53,7 @@ export declare class SasQueryParameters {
53
53
  /**
54
54
  * Optional. The signed identifier (only for {@link TableSasSignatureValues}).
55
55
  *
56
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/establishing-a-stored-access-policy
56
+ * @see https://learn.microsoft.com/rest/api/storageservices/establishing-a-stored-access-policy
57
57
  */
58
58
  readonly identifier?: string;
59
59
  /**
@@ -12,6 +12,118 @@ import { truncatedISO8061Date } from "../utils/truncateISO8061Date.js";
12
12
  * NOTE: Instances of this class are immutable.
13
13
  */
14
14
  export class SasQueryParameters {
15
+ /**
16
+ * The Tables API version.
17
+ */
18
+ version;
19
+ /**
20
+ * Optional. Table name to generate the SAS for
21
+ */
22
+ tableName;
23
+ /**
24
+ * Optional. The allowed HTTP protocol(s).
25
+ */
26
+ protocol;
27
+ /**
28
+ * Optional. The start time for this SAS token.
29
+ */
30
+ startsOn;
31
+ /**
32
+ * Optional only when identifier is provided. The expiry time for this SAS token.
33
+ */
34
+ expiresOn;
35
+ /**
36
+ * Optional only when identifier is provided.
37
+ * Please refer to {@link AccountSasPermissions}, or {@link TableSasPermissions} for
38
+ * more details.
39
+ */
40
+ permissions;
41
+ /**
42
+ * Optional. The table services being accessed (only for Account SAS). Please refer to {@link AccountSasServices}
43
+ * for more details.
44
+ */
45
+ services;
46
+ /**
47
+ * Optional. The table resource types being accessed (only for Account SAS). Please refer to
48
+ * {@link AccountSasResourceTypes} for more details.
49
+ */
50
+ resourceTypes;
51
+ /**
52
+ * Optional. The signed identifier (only for {@link TableSasSignatureValues}).
53
+ *
54
+ * @see https://learn.microsoft.com/rest/api/storageservices/establishing-a-stored-access-policy
55
+ */
56
+ identifier;
57
+ /**
58
+ * The signature for the SAS token.
59
+ */
60
+ signature;
61
+ /**
62
+ * Inner value of getter ipRange.
63
+ */
64
+ ipRangeInner;
65
+ /**
66
+ * The Azure Active Directory object ID in GUID format.
67
+ * Property of user delegation key.
68
+ */
69
+ signedOid;
70
+ /**
71
+ * The Azure Active Directory tenant ID in GUID format.
72
+ * Property of user delegation key.
73
+ */
74
+ signedTenantId;
75
+ /**
76
+ * The date-time the key is active.
77
+ * Property of user delegation key.
78
+ */
79
+ signedStartsOn;
80
+ /**
81
+ * The date-time the key expires.
82
+ * Property of user delegation key.
83
+ */
84
+ signedExpiresOn;
85
+ /**
86
+ * Abbreviation of the Azure Table service that accepts the user delegation key.
87
+ * Property of user delegation key.
88
+ */
89
+ signedService;
90
+ /**
91
+ * The service version that created the user delegation key.
92
+ * Property of user delegation key.
93
+ */
94
+ signedVersion;
95
+ /**
96
+ * Authorized AAD Object ID in GUID format. The AAD Object ID of a user authorized by the owner of the User Delegation Key
97
+ * to perform the action granted by the SAS. The Azure Table service will ensure that the owner of the user delegation key
98
+ * has the required permissions before granting access but no additional permission check for the user specified in
99
+ * this value will be performed. This is only used for User Delegation SAS.
100
+ */
101
+ preauthorizedAgentObjectId;
102
+ /**
103
+ * A GUID value that will be logged in the table diagnostic logs and can be used to correlate SAS generation with table resource access.
104
+ * This is only used for User Delegation SAS.
105
+ */
106
+ correlationId;
107
+ /**
108
+ * Optional, but startPartitionKey must accompany startRowKey. The minimum partition and row keys that are accessible with this shared access signature.
109
+ * Key values are inclusive. If they're omitted, there's no lower bound on the table entities that can be accessed.
110
+ */
111
+ startPartitionKey;
112
+ /**
113
+ * Optional, but startPartitionKey must accompany startRowKey. The minimum partition and row keys that are accessible with this shared access signature.
114
+ * Key values are inclusive. If they're omitted, there's no lower bound on the table entities that can be accessed.
115
+ */
116
+ startRowKey;
117
+ /**
118
+ * Optional, but endPartitionKey must accompany endRowKey. The maximum partition and row keys that are accessible with this shared access signature.
119
+ * Key values are inclusive. If they're omitted, there's no upper bound on the table entities that can be accessed.
120
+ */
121
+ endPartitionKey;
122
+ /**
123
+ * Optional, but endPartitionKey must accompany endRowKey. The maximum partition and row keys that are accessible with this shared access signature.
124
+ * Key values are inclusive. If they're omitted, there's no upper bound on the table entities that can be accessed.
125
+ */
126
+ endRowKey;
15
127
  /**
16
128
  * Optional. IP range allowed for this SAS.
17
129
  *
@@ -1 +1 @@
1
- {"version":3,"file":"sasQueryParameters.js","sourceRoot":"","sources":["../../../src/sas/sasQueryParameters.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAOvE;;;;;;;;GAQG;AACH,MAAM,OAAO,kBAAkB;IAwI7B;;;;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;;;;;;OAMG;IACH,YAAY,OAAe,EAAE,SAAiB,EAAE,UAAqC,EAAE;QACrF,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAE3B,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;QACvC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;QACjC,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;QAC3C,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;QACjC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;QACjC,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;QACnC,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC;QACpC,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;QACrC,IAAI,CAAC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AC,CAAC;oBACnE,MAAM;gBACR,KAAK,KAAK;oBACR,IAAI,CAAC,uBAAuB,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;oBAC7D,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 type { SasIPRange } from \"./sasIPRange.js\";\nimport { ipRangeToString } from \"./sasIPRange.js\";\nimport type { UserDelegationKey } from \"./models.js\";\nimport { truncatedISO8061Date } from \"../utils/truncateISO8061Date.js\";\n\n/**\n * Protocols for generated SAS.\n */\nexport type SasProtocol = \"https\" | \"https,http\";\n\n/**\n * Represents the components that make up an Azure SAS' query parameters. This type is not constructed directly\n * by the user; it is only generated by the {@link AccountSasSignatureValues} and {@link TableSasSignatureValues}\n * types. Once generated, it can be encoded into a `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 Tables API version.\n */\n public readonly version: string;\n\n /**\n * Optional. Table name to generate the SAS for\n */\n public readonly tableName?: 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}, or {@link TableSasPermissions} for\n * more details.\n */\n public readonly permissions?: string;\n\n /**\n * Optional. The table 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 table 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 TableSasSignatureValues}).\n *\n * @see https://learn.microsoft.com/en-us/rest/api/storageservices/establishing-a-stored-access-policy\n */\n public readonly identifier?: string;\n\n /**\n * The signature for the SAS token.\n */\n public readonly signature: string;\n\n /**\n * Inner value of getter ipRange.\n */\n private readonly ipRangeInner?: SasIPRange;\n\n /**\n * The Azure Active Directory object ID in GUID format.\n * Property of user delegation key.\n */\n private readonly signedOid?: string;\n\n /**\n * The Azure Active Directory tenant ID in GUID format.\n * Property of user delegation key.\n */\n private readonly signedTenantId?: string;\n\n /**\n * The date-time the key is active.\n * Property of user delegation key.\n */\n private readonly signedStartsOn?: Date;\n\n /**\n * The date-time the key expires.\n * Property of user delegation key.\n */\n private readonly signedExpiresOn?: Date;\n\n /**\n * Abbreviation of the Azure Table service that accepts the user delegation key.\n * Property of user delegation key.\n */\n private readonly signedService?: string;\n\n /**\n * The service version that created the user delegation key.\n * Property of user delegation key.\n */\n private readonly signedVersion?: string;\n\n /**\n * Authorized AAD Object ID in GUID format. The AAD Object ID of a user authorized by the owner of the User Delegation Key\n * to perform the action granted by the SAS. The Azure Table service will ensure that the owner of the user delegation key\n * has the required permissions before granting access but no additional permission check for the user specified in\n * this value will be performed. This is only used for User Delegation SAS.\n */\n public readonly preauthorizedAgentObjectId?: string;\n\n /**\n * A GUID value that will be logged in the table diagnostic logs and can be used to correlate SAS generation with table resource access.\n * This is only used for User Delegation SAS.\n */\n public readonly correlationId?: string;\n\n /**\n * Optional, but startPartitionKey must accompany startRowKey. The minimum partition and row keys that are accessible with this shared access signature.\n * Key values are inclusive. If they're omitted, there's no lower bound on the table entities that can be accessed.\n */\n public readonly startPartitionKey?: string;\n\n /**\n * Optional, but startPartitionKey must accompany startRowKey. The minimum partition and row keys that are accessible with this shared access signature.\n * Key values are inclusive. If they're omitted, there's no lower bound on the table entities that can be accessed.\n */\n public readonly startRowKey?: string;\n\n /**\n * Optional, but endPartitionKey must accompany endRowKey. The maximum partition and row keys that are accessible with this shared access signature.\n * Key values are inclusive. If they're omitted, there's no upper bound on the table entities that can be accessed.\n */\n public readonly endPartitionKey?: string;\n\n /**\n * Optional, but endPartitionKey must accompany endRowKey. The maximum partition and row keys that are accessible with this shared access signature.\n * Key values are inclusive. If they're omitted, there's no upper bound on the table entities that can be accessed.\n */\n public readonly endRowKey?: string;\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 table service version\n * @param signature - Representing the signature for the SAS token\n * @param options - Optional. Options to construct the SASQueryParameters.\n */\n constructor(version: string, signature: string, options: SasQueryParametersOptions = {}) {\n this.version = version;\n this.signature = signature;\n\n this.permissions = options.permissions;\n this.services = options.services;\n this.resourceTypes = options.resourceTypes;\n this.protocol = options.protocol;\n this.startsOn = options.startsOn;\n this.expiresOn = options.expiresOn;\n this.ipRangeInner = options.ipRange;\n this.identifier = options.identifier;\n this.tableName = options.tableName;\n this.endPartitionKey = options.endPartitionKey;\n this.endRowKey = options.endRowKey;\n this.startPartitionKey = options.startPartitionKey;\n this.startRowKey = options.startRowKey;\n\n if (options.userDelegationKey) {\n this.signedOid = options.userDelegationKey.signedObjectId;\n this.signedTenantId = options.userDelegationKey.signedTenantId;\n this.signedStartsOn = options.userDelegationKey.signedStartsOn;\n this.signedExpiresOn = options.userDelegationKey.signedExpiresOn;\n this.signedService = options.userDelegationKey.signedService;\n this.signedVersion = options.userDelegationKey.signedVersion;\n\n this.preauthorizedAgentObjectId = options.preauthorizedAgentObjectId;\n this.correlationId = options.correlationId;\n }\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\", // SignedVersion\n \"ss\", // SignedServices\n \"srt\", // SignedResourceTypes\n \"spr\", // SignedProtocol\n \"st\", // SignedStart\n \"se\", // SignedExpiry\n \"sip\", // SignedIP\n \"si\", // SignedIdentifier\n \"skoid\", // Signed object ID\n \"sktid\", // Signed tenant ID\n \"skt\", // Signed key start time\n \"ske\", // Signed key expiry time\n \"sks\", // Signed key service\n \"skv\", // Signed key version\n \"sr\", // signedResource\n \"sp\", // SignedPermission\n \"sig\", // Signature\n \"rscc\", // Cache-Control\n \"rscd\", // Content-Disposition\n \"rsce\", // Content-Encoding\n \"rscl\", // Content-Language\n \"rsct\", // Content-Type\n \"saoid\", // signedAuthorizedObjectId\n \"scid\", // signedCorrelationId\n \"tn\", // TableName,\n \"srk\", // StartRowKey\n \"spk\", // StartPartitionKey\n \"epk\", // EndPartitionKey\n \"erk\", // EndRowKey\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 \"skoid\": // Signed object ID\n this.tryAppendQueryParameter(queries, param, this.signedOid);\n break;\n case \"sktid\": // Signed tenant ID\n this.tryAppendQueryParameter(queries, param, this.signedTenantId);\n break;\n case \"skt\": // Signed key start time\n this.tryAppendQueryParameter(\n queries,\n param,\n this.signedStartsOn ? truncatedISO8061Date(this.signedStartsOn, false) : undefined,\n );\n break;\n case \"ske\": // Signed key expiry time\n this.tryAppendQueryParameter(\n queries,\n param,\n this.signedExpiresOn ? truncatedISO8061Date(this.signedExpiresOn, false) : undefined,\n );\n break;\n case \"sks\": // Signed key service\n this.tryAppendQueryParameter(queries, param, this.signedService);\n break;\n case \"skv\": // Signed key version\n this.tryAppendQueryParameter(queries, param, this.signedVersion);\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 \"saoid\":\n this.tryAppendQueryParameter(queries, param, this.preauthorizedAgentObjectId);\n break;\n case \"scid\":\n this.tryAppendQueryParameter(queries, param, this.correlationId);\n break;\n case \"tn\":\n this.tryAppendQueryParameter(queries, param, this.tableName);\n break;\n case \"spk\":\n this.tryAppendQueryParameter(queries, param, this.startPartitionKey);\n break;\n case \"srk\":\n this.tryAppendQueryParameter(queries, param, this.startRowKey);\n break;\n case \"epk\":\n this.tryAppendQueryParameter(queries, param, this.endPartitionKey);\n break;\n case \"erk\":\n this.tryAppendQueryParameter(queries, param, this.endRowKey);\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\n/**\n * Options to construct {@link SasQueryParameters}.\n */\nexport interface SasQueryParametersOptions {\n /**\n * Optional only when identifier is provided.\n * Please refer to {@link AccountSasPermissions}, or {@link TableSasPermissions} for\n * more details.\n */\n permissions?: string;\n /**\n * Optional. Table name to generate the SAS for\n */\n tableName?: string;\n /**\n * Optional. The storage services being accessed (only for Account SAS). Please refer to {@link AccountSasServices}\n * for more details.\n */\n services?: string;\n /**\n * Optional. The storage resource types being accessed (only for Account SAS). Please refer to\n * {@link AccountSasResourceTypes} for more details.\n */\n resourceTypes?: string;\n /**\n * Optional. The allowed HTTP protocol(s).\n */\n protocol?: SasProtocol;\n /**\n * Optional. The start time for this SAS token.\n */\n startsOn?: Date;\n /**\n * Optional only when identifier is provided. The expiry time for this SAS token.\n */\n expiresOn?: Date;\n /**\n * Optional. IP ranges allowed in this SAS.\n */\n ipRange?: SasIPRange;\n /**\n * Optional. The signed identifier for access policy\n *\n * @see https://learn.microsoft.com/rest/api/storageservices/establishing-a-stored-access-policy\n */\n identifier?: string;\n /**\n * Optional. Specifies which resources are accessible via the SAS (only for {@link AccountSasSignatureValues}).\n * @see https://learn.microsoft.com/rest/api/storageservices/create-service-sas#specifying-the-signed-resource-blob-service-only\n */\n resource?: string;\n /**\n * User delegation key properties.\n */\n userDelegationKey?: UserDelegationKey;\n /**\n * Authorized AAD Object ID in GUID format. The AAD Object ID of a user authorized by the owner of the User Delegation Key\n * to perform the action granted by the SAS. The Azure Table service will ensure that the owner of the user delegation key\n * has the required permissions before granting access but no additional permission check for the user specified in\n * this value will be performed. This cannot be used in conjuction with {@link signedUnauthorizedUserObjectId}.\n * This is only used for User Delegation SAS.\n */\n preauthorizedAgentObjectId?: string;\n /**\n * A GUID value that will be logged in the storage diagnostic logs and can be used to correlate SAS generation with storage resource access.\n * This is only used for User Delegation SAS.\n */\n correlationId?: string;\n\n /**\n * Optional, but startPartitionKey must accompany startRowKey. The minimum partition and row keys that are accessible with this shared access signature.\n * Key values are inclusive. If they're omitted, there's no lower bound on the table entities that can be accessed.\n */\n startPartitionKey?: string;\n\n /**\n * Optional, but startPartitionKey must accompany startRowKey. The minimum partition and row keys that are accessible with this shared access signature.\n * Key values are inclusive. If they're omitted, there's no lower bound on the table entities that can be accessed.\n */\n startRowKey?: string;\n\n /**\n * Optional, but endPartitionKey must accompany endRowKey. The maximum partition and row keys that are accessible with this shared access signature.\n * Key values are inclusive. If they're omitted, there's no upper bound on the table entities that can be accessed.\n */\n endPartitionKey?: string;\n\n /**\n * Optional, but endPartitionKey must accompany endRowKey. The maximum partition and row keys that are accessible with this shared access signature.\n * Key values are inclusive. If they're omitted, there's no upper bound on the table entities that can be accessed.\n */\n endRowKey?: string;\n}\n"]}
1
+ {"version":3,"file":"sasQueryParameters.js","sourceRoot":"","sources":["../../../src/sas/sasQueryParameters.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAOvE;;;;;;;;GAQG;AACH,MAAM,OAAO,kBAAkB;IAC7B;;OAEG;IACa,OAAO,CAAS;IAEhC;;OAEG;IACa,SAAS,CAAU;IAEnC;;OAEG;IACa,QAAQ,CAAe;IAEvC;;OAEG;IACa,QAAQ,CAAQ;IAEhC;;OAEG;IACa,SAAS,CAAQ;IAEjC;;;;OAIG;IACa,WAAW,CAAU;IAErC;;;OAGG;IACa,QAAQ,CAAU;IAElC;;;OAGG;IACa,aAAa,CAAU;IAEvC;;;;OAIG;IACa,UAAU,CAAU;IAEpC;;OAEG;IACa,SAAS,CAAS;IAElC;;OAEG;IACc,YAAY,CAAc;IAE3C;;;OAGG;IACc,SAAS,CAAU;IAEp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AAM;gBACR,KAAK,KAAK;oBACR,IAAI,CAAC,uBAAuB,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;oBAC7D,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 type { SasIPRange } from \"./sasIPRange.js\";\nimport { ipRangeToString } from \"./sasIPRange.js\";\nimport type { UserDelegationKey } from \"./models.js\";\nimport { truncatedISO8061Date } from \"../utils/truncateISO8061Date.js\";\n\n/**\n * Protocols for generated SAS.\n */\nexport type SasProtocol = \"https\" | \"https,http\";\n\n/**\n * Represents the components that make up an Azure SAS' query parameters. This type is not constructed directly\n * by the user; it is only generated by the {@link AccountSasSignatureValues} and {@link TableSasSignatureValues}\n * types. Once generated, it can be encoded into a `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 Tables API version.\n */\n public readonly version: string;\n\n /**\n * Optional. Table name to generate the SAS for\n */\n public readonly tableName?: 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}, or {@link TableSasPermissions} for\n * more details.\n */\n public readonly permissions?: string;\n\n /**\n * Optional. The table 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 table 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 TableSasSignatureValues}).\n *\n * @see https://learn.microsoft.com/rest/api/storageservices/establishing-a-stored-access-policy\n */\n public readonly identifier?: string;\n\n /**\n * The signature for the SAS token.\n */\n public readonly signature: string;\n\n /**\n * Inner value of getter ipRange.\n */\n private readonly ipRangeInner?: SasIPRange;\n\n /**\n * The Azure Active Directory object ID in GUID format.\n * Property of user delegation key.\n */\n private readonly signedOid?: string;\n\n /**\n * The Azure Active Directory tenant ID in GUID format.\n * Property of user delegation key.\n */\n private readonly signedTenantId?: string;\n\n /**\n * The date-time the key is active.\n * Property of user delegation key.\n */\n private readonly signedStartsOn?: Date;\n\n /**\n * The date-time the key expires.\n * Property of user delegation key.\n */\n private readonly signedExpiresOn?: Date;\n\n /**\n * Abbreviation of the Azure Table service that accepts the user delegation key.\n * Property of user delegation key.\n */\n private readonly signedService?: string;\n\n /**\n * The service version that created the user delegation key.\n * Property of user delegation key.\n */\n private readonly signedVersion?: string;\n\n /**\n * Authorized AAD Object ID in GUID format. The AAD Object ID of a user authorized by the owner of the User Delegation Key\n * to perform the action granted by the SAS. The Azure Table service will ensure that the owner of the user delegation key\n * has the required permissions before granting access but no additional permission check for the user specified in\n * this value will be performed. This is only used for User Delegation SAS.\n */\n public readonly preauthorizedAgentObjectId?: string;\n\n /**\n * A GUID value that will be logged in the table diagnostic logs and can be used to correlate SAS generation with table resource access.\n * This is only used for User Delegation SAS.\n */\n public readonly correlationId?: string;\n\n /**\n * Optional, but startPartitionKey must accompany startRowKey. The minimum partition and row keys that are accessible with this shared access signature.\n * Key values are inclusive. If they're omitted, there's no lower bound on the table entities that can be accessed.\n */\n public readonly startPartitionKey?: string;\n\n /**\n * Optional, but startPartitionKey must accompany startRowKey. The minimum partition and row keys that are accessible with this shared access signature.\n * Key values are inclusive. If they're omitted, there's no lower bound on the table entities that can be accessed.\n */\n public readonly startRowKey?: string;\n\n /**\n * Optional, but endPartitionKey must accompany endRowKey. The maximum partition and row keys that are accessible with this shared access signature.\n * Key values are inclusive. If they're omitted, there's no upper bound on the table entities that can be accessed.\n */\n public readonly endPartitionKey?: string;\n\n /**\n * Optional, but endPartitionKey must accompany endRowKey. The maximum partition and row keys that are accessible with this shared access signature.\n * Key values are inclusive. If they're omitted, there's no upper bound on the table entities that can be accessed.\n */\n public readonly endRowKey?: string;\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 table service version\n * @param signature - Representing the signature for the SAS token\n * @param options - Optional. Options to construct the SASQueryParameters.\n */\n constructor(version: string, signature: string, options: SasQueryParametersOptions = {}) {\n this.version = version;\n this.signature = signature;\n\n this.permissions = options.permissions;\n this.services = options.services;\n this.resourceTypes = options.resourceTypes;\n this.protocol = options.protocol;\n this.startsOn = options.startsOn;\n this.expiresOn = options.expiresOn;\n this.ipRangeInner = options.ipRange;\n this.identifier = options.identifier;\n this.tableName = options.tableName;\n this.endPartitionKey = options.endPartitionKey;\n this.endRowKey = options.endRowKey;\n this.startPartitionKey = options.startPartitionKey;\n this.startRowKey = options.startRowKey;\n\n if (options.userDelegationKey) {\n this.signedOid = options.userDelegationKey.signedObjectId;\n this.signedTenantId = options.userDelegationKey.signedTenantId;\n this.signedStartsOn = options.userDelegationKey.signedStartsOn;\n this.signedExpiresOn = options.userDelegationKey.signedExpiresOn;\n this.signedService = options.userDelegationKey.signedService;\n this.signedVersion = options.userDelegationKey.signedVersion;\n\n this.preauthorizedAgentObjectId = options.preauthorizedAgentObjectId;\n this.correlationId = options.correlationId;\n }\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\", // SignedVersion\n \"ss\", // SignedServices\n \"srt\", // SignedResourceTypes\n \"spr\", // SignedProtocol\n \"st\", // SignedStart\n \"se\", // SignedExpiry\n \"sip\", // SignedIP\n \"si\", // SignedIdentifier\n \"skoid\", // Signed object ID\n \"sktid\", // Signed tenant ID\n \"skt\", // Signed key start time\n \"ske\", // Signed key expiry time\n \"sks\", // Signed key service\n \"skv\", // Signed key version\n \"sr\", // signedResource\n \"sp\", // SignedPermission\n \"sig\", // Signature\n \"rscc\", // Cache-Control\n \"rscd\", // Content-Disposition\n \"rsce\", // Content-Encoding\n \"rscl\", // Content-Language\n \"rsct\", // Content-Type\n \"saoid\", // signedAuthorizedObjectId\n \"scid\", // signedCorrelationId\n \"tn\", // TableName,\n \"srk\", // StartRowKey\n \"spk\", // StartPartitionKey\n \"epk\", // EndPartitionKey\n \"erk\", // EndRowKey\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 \"skoid\": // Signed object ID\n this.tryAppendQueryParameter(queries, param, this.signedOid);\n break;\n case \"sktid\": // Signed tenant ID\n this.tryAppendQueryParameter(queries, param, this.signedTenantId);\n break;\n case \"skt\": // Signed key start time\n this.tryAppendQueryParameter(\n queries,\n param,\n this.signedStartsOn ? truncatedISO8061Date(this.signedStartsOn, false) : undefined,\n );\n break;\n case \"ske\": // Signed key expiry time\n this.tryAppendQueryParameter(\n queries,\n param,\n this.signedExpiresOn ? truncatedISO8061Date(this.signedExpiresOn, false) : undefined,\n );\n break;\n case \"sks\": // Signed key service\n this.tryAppendQueryParameter(queries, param, this.signedService);\n break;\n case \"skv\": // Signed key version\n this.tryAppendQueryParameter(queries, param, this.signedVersion);\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 \"saoid\":\n this.tryAppendQueryParameter(queries, param, this.preauthorizedAgentObjectId);\n break;\n case \"scid\":\n this.tryAppendQueryParameter(queries, param, this.correlationId);\n break;\n case \"tn\":\n this.tryAppendQueryParameter(queries, param, this.tableName);\n break;\n case \"spk\":\n this.tryAppendQueryParameter(queries, param, this.startPartitionKey);\n break;\n case \"srk\":\n this.tryAppendQueryParameter(queries, param, this.startRowKey);\n break;\n case \"epk\":\n this.tryAppendQueryParameter(queries, param, this.endPartitionKey);\n break;\n case \"erk\":\n this.tryAppendQueryParameter(queries, param, this.endRowKey);\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\n/**\n * Options to construct {@link SasQueryParameters}.\n */\nexport interface SasQueryParametersOptions {\n /**\n * Optional only when identifier is provided.\n * Please refer to {@link AccountSasPermissions}, or {@link TableSasPermissions} for\n * more details.\n */\n permissions?: string;\n /**\n * Optional. Table name to generate the SAS for\n */\n tableName?: string;\n /**\n * Optional. The storage services being accessed (only for Account SAS). Please refer to {@link AccountSasServices}\n * for more details.\n */\n services?: string;\n /**\n * Optional. The storage resource types being accessed (only for Account SAS). Please refer to\n * {@link AccountSasResourceTypes} for more details.\n */\n resourceTypes?: string;\n /**\n * Optional. The allowed HTTP protocol(s).\n */\n protocol?: SasProtocol;\n /**\n * Optional. The start time for this SAS token.\n */\n startsOn?: Date;\n /**\n * Optional only when identifier is provided. The expiry time for this SAS token.\n */\n expiresOn?: Date;\n /**\n * Optional. IP ranges allowed in this SAS.\n */\n ipRange?: SasIPRange;\n /**\n * Optional. The signed identifier for access policy\n *\n * @see https://learn.microsoft.com/rest/api/storageservices/establishing-a-stored-access-policy\n */\n identifier?: string;\n /**\n * Optional. Specifies which resources are accessible via the SAS (only for {@link AccountSasSignatureValues}).\n * @see https://learn.microsoft.com/rest/api/storageservices/create-service-sas#specifying-the-signed-resource-blob-service-only\n */\n resource?: string;\n /**\n * User delegation key properties.\n */\n userDelegationKey?: UserDelegationKey;\n /**\n * Authorized AAD Object ID in GUID format. The AAD Object ID of a user authorized by the owner of the User Delegation Key\n * to perform the action granted by the SAS. The Azure Table service will ensure that the owner of the user delegation key\n * has the required permissions before granting access but no additional permission check for the user specified in\n * this value will be performed. This cannot be used in conjuction with {@link signedUnauthorizedUserObjectId}.\n * This is only used for User Delegation SAS.\n */\n preauthorizedAgentObjectId?: string;\n /**\n * A GUID value that will be logged in the storage diagnostic logs and can be used to correlate SAS generation with storage resource access.\n * This is only used for User Delegation SAS.\n */\n correlationId?: string;\n\n /**\n * Optional, but startPartitionKey must accompany startRowKey. The minimum partition and row keys that are accessible with this shared access signature.\n * Key values are inclusive. If they're omitted, there's no lower bound on the table entities that can be accessed.\n */\n startPartitionKey?: string;\n\n /**\n * Optional, but startPartitionKey must accompany startRowKey. The minimum partition and row keys that are accessible with this shared access signature.\n * Key values are inclusive. If they're omitted, there's no lower bound on the table entities that can be accessed.\n */\n startRowKey?: string;\n\n /**\n * Optional, but endPartitionKey must accompany endRowKey. The maximum partition and row keys that are accessible with this shared access signature.\n * Key values are inclusive. If they're omitted, there's no upper bound on the table entities that can be accessed.\n */\n endPartitionKey?: string;\n\n /**\n * Optional, but endPartitionKey must accompany endRowKey. The maximum partition and row keys that are accessible with this shared access signature.\n * Key values are inclusive. If they're omitted, there's no upper bound on the table entities that can be accessed.\n */\n endRowKey?: string;\n}\n"]}
@@ -45,7 +45,7 @@ export interface TableSasSignatureValues {
45
45
  /**
46
46
  * Optional. The name of the access policy on the container this SAS references if any.
47
47
  *
48
- * @see https://learn.microsoft.com/en-us/rest/api/storageservices/establishing-a-stored-access-policy
48
+ * @see https://learn.microsoft.com/rest/api/storageservices/establishing-a-stored-access-policy
49
49
  */
50
50
  identifier?: string;
51
51
  /**
@@ -14,8 +14,7 @@ import { truncatedISO8061Date } from "../utils/truncateISO8061Date.js";
14
14
  * **Note**: When identifier is not provided, permissions has a default value of "read" and expiresOn of one hour from the time the token is generated.
15
15
  */
16
16
  export function generateTableSasQueryParameters(tableName, credential, tableSasSignatureValues) {
17
- var _a, _b, _c, _d, _e, _f;
18
- const version = (_a = tableSasSignatureValues.version) !== null && _a !== void 0 ? _a : SERVICE_VERSION;
17
+ const version = tableSasSignatureValues.version ?? SERVICE_VERSION;
19
18
  if (credential === undefined) {
20
19
  throw TypeError("Invalid NamedKeyCredential");
21
20
  }
@@ -30,13 +29,13 @@ export function generateTableSasQueryParameters(tableName, credential, tableSasS
30
29
  ? truncatedISO8061Date(tableSasSignatureValues.expiresOn, false /** withMilliseconds */)
31
30
  : "";
32
31
  const canonicalizedResource = getCanonicalName(credential.name, tableName);
33
- const signedIdentifier = (_b = tableSasSignatureValues.identifier) !== null && _b !== void 0 ? _b : "";
32
+ const signedIdentifier = tableSasSignatureValues.identifier ?? "";
34
33
  const signedIP = ipRangeToString(tableSasSignatureValues.ipRange);
35
34
  const signedProtocol = tableSasSignatureValues.protocol || "";
36
- const startingPartitionKey = (_c = tableSasSignatureValues.startPartitionKey) !== null && _c !== void 0 ? _c : "";
37
- const startingRowKey = (_d = tableSasSignatureValues.startRowKey) !== null && _d !== void 0 ? _d : "";
38
- const endingPartitionKey = (_e = tableSasSignatureValues.endPartitionKey) !== null && _e !== void 0 ? _e : "";
39
- const endingRowKey = (_f = tableSasSignatureValues.endRowKey) !== null && _f !== void 0 ? _f : "";
35
+ const startingPartitionKey = tableSasSignatureValues.startPartitionKey ?? "";
36
+ const startingRowKey = tableSasSignatureValues.startRowKey ?? "";
37
+ const endingPartitionKey = tableSasSignatureValues.endPartitionKey ?? "";
38
+ const endingRowKey = tableSasSignatureValues.endRowKey ?? "";
40
39
  const stringToSign = [
41
40
  signedPermissions,
42
41
  signedStart,
@@ -1 +1 @@
1
- {"version":3,"file":"tableSasSignatureValues.js","sourceRoot":"","sources":["../../../src/sas/tableSasSignatureValues.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AASlC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,OAAO,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AAEtE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AA8EvE;;;;;;GAMG;AACH,MAAM,UAAU,+BAA+B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Y,GAAG,MAAA,uBAAuB,CAAC,SAAS,mCAAI,EAAE,CAAC;IAE7D,MAAM,YAAY,GAAG;QACnB,iBAAiB;QACjB,WAAW;QACX,YAAY;QACZ,qBAAqB;QACrB,gBAAgB;QAChB,QAAQ;QACR,cAAc;QACd,OAAO;QACP,oBAAoB;QACpB,cAAc;QACd,kBAAkB;QAClB,YAAY;KACb,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEb,MAAM,SAAS,GAAG,iBAAiB,CAAC,YAAY,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC;IAElE,OAAO,IAAI,kBAAkB,CAAC,OAAO,EAAE,SAAS,EAAE;QAChD,WAAW,EAAE,iBAAiB;QAC9B,QAAQ,EAAE,uBAAuB,CAAC,QAAQ;QAC1C,QAAQ,EAAE,uBAAuB,CAAC,QAAQ;QAC1C,SAAS,EAAE,uBAAuB,CAAC,SAAS;QAC5C,OAAO,EAAE,uBAAuB,CAAC,OAAO;QACxC,UAAU,EAAE,uBAAuB,CAAC,UAAU;QAC9C,SAAS;QACT,iBAAiB,EAAE,uBAAuB,CAAC,iBAAiB;QAC5D,WAAW,EAAE,uBAAuB,CAAC,WAAW;QAChD,eAAe,EAAE,uBAAuB,CAAC,eAAe;QACxD,SAAS,EAAE,uBAAuB,CAAC,SAAS;KAC7C,CAAC,CAAC;AACL,CAAC;AAED,SAAS,gBAAgB,CAAC,WAAmB,EAAE,SAAiB;IAC9D,yHAAyH;IACzH,yDAAyD;IACzD,OAAO,UAAU,WAAW,IAAI,SAAS,CAAC,WAAW,EAAE,EAAE,CAAC;AAC5D,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * ONLY AVAILABLE IN NODE.JS RUNTIME.\n *\n * TableSASSignatureValues is used to help generating SAS tokens for tables.\n */\n\nimport type { SasIPRange } from \"./sasIPRange.js\";\nimport { ipRangeToString } from \"./sasIPRange.js\";\nimport type { SasProtocol } from \"./sasQueryParameters.js\";\nimport { SasQueryParameters } from \"./sasQueryParameters.js\";\nimport type { TableSasPermissions } from \"./tableSasPermisions.js\";\nimport { tableSasPermissionsToString } from \"./tableSasPermisions.js\";\nimport type { NamedKeyCredential } from \"@azure/core-auth\";\nimport { SERVICE_VERSION } from \"../utils/constants.js\";\nimport { computeHMACSHA256 } from \"../utils/computeHMACSHA256.js\";\nimport { truncatedISO8061Date } from \"../utils/truncateISO8061Date.js\";\n\n/**\n * ONLY AVAILABLE IN NODE.JS RUNTIME.\n *\n * TableSASSignatureValues is used to help generating Table service SAS tokens for tables\n */\nexport interface TableSasSignatureValues {\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. If identifier is not provided has a default value of one hour from the time the token is generated.\n * The time after which the SAS will no longer work.\n */\n expiresOn?: Date;\n\n /**\n * Optional. If identifier is not provided has a default value of \"read\"\n * Please refer to {@link TableSasPermissions} depending on the resource\n * being accessed for help constructing the permissions string.\n */\n permissions?: TableSasPermissions;\n /**\n * Optional. IP ranges allowed in this SAS.\n */\n ipRange?: SasIPRange;\n\n /**\n * Optional. The name of the access policy on the container this SAS references if any.\n *\n * @see https://learn.microsoft.com/en-us/rest/api/storageservices/establishing-a-stored-access-policy\n */\n identifier?: string;\n\n /**\n * Define the start of a Partition Key range\n * Table queries will only return results that are within the range, and attempts to use the shared access signature to add, update, or delete entities outside this range will fail.\n * If startPartitionKey equals endPartitionKey the shared access signature only authorizes access to entities in one partition in the table.\n * If startPartitionKey equals endPartitionKey and startRowKey equals endRowKey, the shared access signature can only access one entity in one partition\n */\n startPartitionKey?: string;\n /**\n * Define the end of a Partition Key range\n * Table queries will only return results that are within the range, and attempts to use the shared access signature to add, update, or delete entities outside this range will fail.\n * If startPartitionKey equals endPartitionKey the shared access signature only authorizes access to entities in one partition in the table.\n * If startPartitionKey equals endPartitionKey and startRowKey equals endRowKey, the shared access signature can only access one entity in one partition\n */\n endPartitionKey?: string;\n /**\n * Define the start of a Row Key range\n * Table queries will only return results that are within the range, and attempts to use the shared access signature to add, update, or delete entities outside this range will fail.\n * If startPartitionKey equals endPartitionKey the shared access signature only authorizes access to entities in one partition in the table.\n * If startPartitionKey equals endPartitionKey and startRowKey equals endRowKey, the shared access signature can only access one entity in one partition\n */\n startRowKey?: string;\n /**\n * Define the end of a Row Key range\n * Table queries will only return results that are within the range, and attempts to use the shared access signature to add, update, or delete entities outside this range will fail.\n * If startPartitionKey equals endPartitionKey the shared access signature only authorizes access to entities in one partition in the table.\n * If startPartitionKey equals endPartitionKey and startRowKey equals endRowKey, the shared access signature can only access one entity in one partition\n */\n endRowKey?: string;\n}\n\n/**\n * ONLY AVAILABLE IN NODE.JS RUNTIME.\n *\n * Creates an instance of SASQueryParameters.\n *\n * **Note**: When identifier is not provided, permissions has a default value of \"read\" and expiresOn of one hour from the time the token is generated.\n */\nexport function generateTableSasQueryParameters(\n tableName: string,\n credential: NamedKeyCredential,\n tableSasSignatureValues: TableSasSignatureValues,\n): SasQueryParameters {\n const version = tableSasSignatureValues.version ?? SERVICE_VERSION;\n\n if (credential === undefined) {\n throw TypeError(\"Invalid NamedKeyCredential\");\n }\n\n if (!tableName) {\n throw new Error(\"Must provide a 'tableName'\");\n }\n\n const signedPermissions = tableSasPermissionsToString(tableSasSignatureValues.permissions);\n const signedStart = tableSasSignatureValues.startsOn\n ? truncatedISO8061Date(tableSasSignatureValues.startsOn, false /** withMilliseconds */)\n : \"\";\n const signedExpiry = tableSasSignatureValues.expiresOn\n ? truncatedISO8061Date(tableSasSignatureValues.expiresOn, false /** withMilliseconds */)\n : \"\";\n const canonicalizedResource = getCanonicalName(credential.name, tableName);\n const signedIdentifier = tableSasSignatureValues.identifier ?? \"\";\n const signedIP = ipRangeToString(tableSasSignatureValues.ipRange);\n const signedProtocol = tableSasSignatureValues.protocol || \"\";\n const startingPartitionKey = tableSasSignatureValues.startPartitionKey ?? \"\";\n const startingRowKey = tableSasSignatureValues.startRowKey ?? \"\";\n const endingPartitionKey = tableSasSignatureValues.endPartitionKey ?? \"\";\n const endingRowKey = tableSasSignatureValues.endRowKey ?? \"\";\n\n const stringToSign = [\n signedPermissions,\n signedStart,\n signedExpiry,\n canonicalizedResource,\n signedIdentifier,\n signedIP,\n signedProtocol,\n version,\n startingPartitionKey,\n startingRowKey,\n endingPartitionKey,\n endingRowKey,\n ].join(\"\\n\");\n\n const signature = computeHMACSHA256(stringToSign, credential.key);\n\n return new SasQueryParameters(version, signature, {\n permissions: signedPermissions,\n protocol: tableSasSignatureValues.protocol,\n startsOn: tableSasSignatureValues.startsOn,\n expiresOn: tableSasSignatureValues.expiresOn,\n ipRange: tableSasSignatureValues.ipRange,\n identifier: tableSasSignatureValues.identifier,\n tableName,\n startPartitionKey: tableSasSignatureValues.startPartitionKey,\n startRowKey: tableSasSignatureValues.startRowKey,\n endPartitionKey: tableSasSignatureValues.endPartitionKey,\n endRowKey: tableSasSignatureValues.endRowKey,\n });\n}\n\nfunction getCanonicalName(accountName: string, tableName: string): string {\n // Sample CanonicalName for URL = https://myaccount.table.core.windows.net/Employees(PartitionKey='Jeff',RowKey='Price'):\n // canonicalizedResource = \"/table/myaccount/employees\"\n return `/table/${accountName}/${tableName.toLowerCase()}`;\n}\n"]}
1
+ {"version":3,"file":"tableSasSignatureValues.js","sourceRoot":"","sources":["../../../src/sas/tableSasSignatureValues.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AASlC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,OAAO,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AAEtE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EA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AC;IACjE,MAAM,kBAAkB,GAAG,uBAAuB,CAAC,eAAe,IAAI,EAAE,CAAC;IACzE,MAAM,YAAY,GAAG,uBAAuB,CAAC,SAAS,IAAI,EAAE,CAAC;IAE7D,MAAM,YAAY,GAAG;QACnB,iBAAiB;QACjB,WAAW;QACX,YAAY;QACZ,qBAAqB;QACrB,gBAAgB;QAChB,QAAQ;QACR,cAAc;QACd,OAAO;QACP,oBAAoB;QACpB,cAAc;QACd,kBAAkB;QAClB,YAAY;KACb,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEb,MAAM,SAAS,GAAG,iBAAiB,CAAC,YAAY,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC;IAElE,OAAO,IAAI,kBAAkB,CAAC,OAAO,EAAE,SAAS,EAAE;QAChD,WAAW,EAAE,iBAAiB;QAC9B,QAAQ,EAAE,uBAAuB,CAAC,QAAQ;QAC1C,QAAQ,EAAE,uBAAuB,CAAC,QAAQ;QAC1C,SAAS,EAAE,uBAAuB,CAAC,SAAS;QAC5C,OAAO,EAAE,uBAAuB,CAAC,OAAO;QACxC,UAAU,EAAE,uBAAuB,CAAC,UAAU;QAC9C,SAAS;QACT,iBAAiB,EAAE,uBAAuB,CAAC,iBAAiB;QAC5D,WAAW,EAAE,uBAAuB,CAAC,WAAW;QAChD,eAAe,EAAE,uBAAuB,CAAC,eAAe;QACxD,SAAS,EAAE,uBAAuB,CAAC,SAAS;KAC7C,CAAC,CAAC;AACL,CAAC;AAED,SAAS,gBAAgB,CAAC,WAAmB,EAAE,SAAiB;IAC9D,yHAAyH;IACzH,yDAAyD;IACzD,OAAO,UAAU,WAAW,IAAI,SAAS,CAAC,WAAW,EAAE,EAAE,CAAC;AAC5D,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * ONLY AVAILABLE IN NODE.JS RUNTIME.\n *\n * TableSASSignatureValues is used to help generating SAS tokens for tables.\n */\n\nimport type { SasIPRange } from \"./sasIPRange.js\";\nimport { ipRangeToString } from \"./sasIPRange.js\";\nimport type { SasProtocol } from \"./sasQueryParameters.js\";\nimport { SasQueryParameters } from \"./sasQueryParameters.js\";\nimport type { TableSasPermissions } from \"./tableSasPermisions.js\";\nimport { tableSasPermissionsToString } from \"./tableSasPermisions.js\";\nimport type { NamedKeyCredential } from \"@azure/core-auth\";\nimport { SERVICE_VERSION } from \"../utils/constants.js\";\nimport { computeHMACSHA256 } from \"../utils/computeHMACSHA256.js\";\nimport { truncatedISO8061Date } from \"../utils/truncateISO8061Date.js\";\n\n/**\n * ONLY AVAILABLE IN NODE.JS RUNTIME.\n *\n * TableSASSignatureValues is used to help generating Table service SAS tokens for tables\n */\nexport interface TableSasSignatureValues {\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. If identifier is not provided has a default value of one hour from the time the token is generated.\n * The time after which the SAS will no longer work.\n */\n expiresOn?: Date;\n\n /**\n * Optional. If identifier is not provided has a default value of \"read\"\n * Please refer to {@link TableSasPermissions} depending on the resource\n * being accessed for help constructing the permissions string.\n */\n permissions?: TableSasPermissions;\n /**\n * Optional. IP ranges allowed in this SAS.\n */\n ipRange?: SasIPRange;\n\n /**\n * Optional. The name of the access policy on the container this SAS references if any.\n *\n * @see https://learn.microsoft.com/rest/api/storageservices/establishing-a-stored-access-policy\n */\n identifier?: string;\n\n /**\n * Define the start of a Partition Key range\n * Table queries will only return results that are within the range, and attempts to use the shared access signature to add, update, or delete entities outside this range will fail.\n * If startPartitionKey equals endPartitionKey the shared access signature only authorizes access to entities in one partition in the table.\n * If startPartitionKey equals endPartitionKey and startRowKey equals endRowKey, the shared access signature can only access one entity in one partition\n */\n startPartitionKey?: string;\n /**\n * Define the end of a Partition Key range\n * Table queries will only return results that are within the range, and attempts to use the shared access signature to add, update, or delete entities outside this range will fail.\n * If startPartitionKey equals endPartitionKey the shared access signature only authorizes access to entities in one partition in the table.\n * If startPartitionKey equals endPartitionKey and startRowKey equals endRowKey, the shared access signature can only access one entity in one partition\n */\n endPartitionKey?: string;\n /**\n * Define the start of a Row Key range\n * Table queries will only return results that are within the range, and attempts to use the shared access signature to add, update, or delete entities outside this range will fail.\n * If startPartitionKey equals endPartitionKey the shared access signature only authorizes access to entities in one partition in the table.\n * If startPartitionKey equals endPartitionKey and startRowKey equals endRowKey, the shared access signature can only access one entity in one partition\n */\n startRowKey?: string;\n /**\n * Define the end of a Row Key range\n * Table queries will only return results that are within the range, and attempts to use the shared access signature to add, update, or delete entities outside this range will fail.\n * If startPartitionKey equals endPartitionKey the shared access signature only authorizes access to entities in one partition in the table.\n * If startPartitionKey equals endPartitionKey and startRowKey equals endRowKey, the shared access signature can only access one entity in one partition\n */\n endRowKey?: string;\n}\n\n/**\n * ONLY AVAILABLE IN NODE.JS RUNTIME.\n *\n * Creates an instance of SASQueryParameters.\n *\n * **Note**: When identifier is not provided, permissions has a default value of \"read\" and expiresOn of one hour from the time the token is generated.\n */\nexport function generateTableSasQueryParameters(\n tableName: string,\n credential: NamedKeyCredential,\n tableSasSignatureValues: TableSasSignatureValues,\n): SasQueryParameters {\n const version = tableSasSignatureValues.version ?? SERVICE_VERSION;\n\n if (credential === undefined) {\n throw TypeError(\"Invalid NamedKeyCredential\");\n }\n\n if (!tableName) {\n throw new Error(\"Must provide a 'tableName'\");\n }\n\n const signedPermissions = tableSasPermissionsToString(tableSasSignatureValues.permissions);\n const signedStart = tableSasSignatureValues.startsOn\n ? truncatedISO8061Date(tableSasSignatureValues.startsOn, false /** withMilliseconds */)\n : \"\";\n const signedExpiry = tableSasSignatureValues.expiresOn\n ? truncatedISO8061Date(tableSasSignatureValues.expiresOn, false /** withMilliseconds */)\n : \"\";\n const canonicalizedResource = getCanonicalName(credential.name, tableName);\n const signedIdentifier = tableSasSignatureValues.identifier ?? \"\";\n const signedIP = ipRangeToString(tableSasSignatureValues.ipRange);\n const signedProtocol = tableSasSignatureValues.protocol || \"\";\n const startingPartitionKey = tableSasSignatureValues.startPartitionKey ?? \"\";\n const startingRowKey = tableSasSignatureValues.startRowKey ?? \"\";\n const endingPartitionKey = tableSasSignatureValues.endPartitionKey ?? \"\";\n const endingRowKey = tableSasSignatureValues.endRowKey ?? \"\";\n\n const stringToSign = [\n signedPermissions,\n signedStart,\n signedExpiry,\n canonicalizedResource,\n signedIdentifier,\n signedIP,\n signedProtocol,\n version,\n startingPartitionKey,\n startingRowKey,\n endingPartitionKey,\n endingRowKey,\n ].join(\"\\n\");\n\n const signature = computeHMACSHA256(stringToSign, credential.key);\n\n return new SasQueryParameters(version, signature, {\n permissions: signedPermissions,\n protocol: tableSasSignatureValues.protocol,\n startsOn: tableSasSignatureValues.startsOn,\n expiresOn: tableSasSignatureValues.expiresOn,\n ipRange: tableSasSignatureValues.ipRange,\n identifier: tableSasSignatureValues.identifier,\n tableName,\n startPartitionKey: tableSasSignatureValues.startPartitionKey,\n startRowKey: tableSasSignatureValues.startRowKey,\n endPartitionKey: tableSasSignatureValues.endPartitionKey,\n endRowKey: tableSasSignatureValues.endRowKey,\n });\n}\n\nfunction getCanonicalName(accountName: string, tableName: string): string {\n // Sample CanonicalName for URL = https://myaccount.table.core.windows.net/Employees(PartitionKey='Jeff',RowKey='Price'):\n // canonicalizedResource = \"/table/myaccount/employees\"\n return `/table/${accountName}/${tableName.toLowerCase()}`;\n}\n"]}
@@ -27,9 +27,17 @@ export const tablesSecondaryEndpointPolicy = {
27
27
  * Utility function that injects the SecondaryEndpointHeader into an operation options
28
28
  */
29
29
  export function injectSecondaryEndpointHeader(options) {
30
- var _a;
31
30
  const headerToInject = { [SecondaryLocationHeaderName]: "true" };
32
- return Object.assign(Object.assign({}, options), { requestOptions: Object.assign(Object.assign({}, options.requestOptions), { customHeaders: Object.assign(Object.assign({}, (_a = options.requestOptions) === null || _a === void 0 ? void 0 : _a.customHeaders), headerToInject) }) });
31
+ return {
32
+ ...options,
33
+ requestOptions: {
34
+ ...options.requestOptions,
35
+ customHeaders: {
36
+ ...options.requestOptions?.customHeaders,
37
+ ...headerToInject,
38
+ },
39
+ },
40
+ };
33
41
  }
34
42
  /**
35
43
  * Utility function that calculates the secondary URL for a table instance given the primary URL.
@@ -1 +1 @@
1
- {"version":3,"file":"secondaryEndpointPolicy.js","sourceRoot":"","sources":["../../src/secondaryEndpointPolicy.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAKlC;;GAEG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG,+BAA+B,CAAC;AACjF,MAAM,CAAC,MAAM,2BAA2B,GAAG,2BAA2B,CAAC;AACvE,MAAM,8BAA8B,GAAG,YAAY,CAAC;AAEpD;;;GAGG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAmB;IAC3D,IAAI,EAAE,iCAAiC;IACvC,WAAW,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;QAC/B,6DAA6D;QAC7D,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC,EAAE,CAAC;YACjD,0DAA0D;YAC1D,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,2BAA2B,CAAC,CAAC;YAChD,yCAAyC;YACzC,GAAG,CAAC,GAAG,GAAG,0BAA0B,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAChD,CAAC;QAED,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;IACnB,CAAC;CACF,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,6BAA6B,CAAC,OAAyB;;IACrE,MAAM,cAAc,GAAG,EAAE,CAAC,2BAA2B,CAAC,EAAE,MAAM,EAAE,CAAC;IACjE,uCACK,OAAO,KACV,cAAc,kCACT,OAAO,CAAC,cAAc,KACzB,aAAa,kCACR,MAAA,OAAO,CAAC,cAAc,0CAAE,aAAa,GACrC,cAAc,QAGrB;AACJ,CAAC;AAED;;GAEG;AACH,SAAS,0BAA0B,CAAC,UAAkB;IACpD,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC;IAC7C,MAAM,IAAI,GAAG,gBAAgB,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAClD,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpB,IAAI,CAAC,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,8BAA8B,EAAE,CAAC;IAC1D,CAAC;IACD,gBAAgB,CAAC,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAE3C,OAAO,gBAAgB,CAAC,QAAQ,EAAE,CAAC;AACrC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { OperationOptions } from \"@azure/core-client\";\nimport type { PipelinePolicy } from \"@azure/core-rest-pipeline\";\n\n/**\n * The programmatic identifier of the tablesSecondaryEndpointPolicy.\n */\nexport const tablesSecondaryEndpointPolicyName = \"tablesSecondaryEndpointPolicy\";\nexport const SecondaryLocationHeaderName = \"tables-secondary-endpoint\";\nconst SecondaryLocationAccountSuffix = \"-secondary\";\n\n/**\n * Policy that would replace the Primary Endpoint with the secondary endpoint\n * when the `tables-secondary-endpoint` is set in the request\n */\nexport const tablesSecondaryEndpointPolicy: PipelinePolicy = {\n name: tablesSecondaryEndpointPolicyName,\n sendRequest: async (req, next) => {\n // Only replace the URL if the SecondaryLocationHeader is set\n if (req.headers.get(SecondaryLocationHeaderName)) {\n // Since the header is for internal use only, clean it up.\n req.headers.delete(SecondaryLocationHeaderName);\n // Calculate and update the secondary url\n req.url = getSecondaryUrlFromPrimary(req.url);\n }\n\n return next(req);\n },\n};\n\n/**\n * Utility function that injects the SecondaryEndpointHeader into an operation options\n */\nexport function injectSecondaryEndpointHeader(options: OperationOptions): OperationOptions {\n const headerToInject = { [SecondaryLocationHeaderName]: \"true\" };\n return {\n ...options,\n requestOptions: {\n ...options.requestOptions,\n customHeaders: {\n ...options.requestOptions?.customHeaders,\n ...headerToInject,\n },\n },\n };\n}\n\n/**\n * Utility function that calculates the secondary URL for a table instance given the primary URL.\n */\nfunction getSecondaryUrlFromPrimary(primaryUrl: string): string {\n const parsedPrimaryUrl = new URL(primaryUrl);\n const host = parsedPrimaryUrl.hostname.split(\".\");\n if (host.length > 1) {\n host[0] = `${host[0]}${SecondaryLocationAccountSuffix}`;\n }\n parsedPrimaryUrl.hostname = host.join(\".\");\n\n return parsedPrimaryUrl.toString();\n}\n"]}
1
+ {"version":3,"file":"secondaryEndpointPolicy.js","sourceRoot":"","sources":["../../src/secondaryEndpointPolicy.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAKlC;;GAEG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG,+BAA+B,CAAC;AACjF,MAAM,CAAC,MAAM,2BAA2B,GAAG,2BAA2B,CAAC;AACvE,MAAM,8BAA8B,GAAG,YAAY,CAAC;AAEpD;;;GAGG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAmB;IAC3D,IAAI,EAAE,iCAAiC;IACvC,WAAW,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;QAC/B,6DAA6D;QAC7D,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC,EAAE,CAAC;YACjD,0DAA0D;YAC1D,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,2BAA2B,CAAC,CAAC;YAChD,yCAAyC;YACzC,GAAG,CAAC,GAAG,GAAG,0BAA0B,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAChD,CAAC;QAED,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;IACnB,CAAC;CACF,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,6BAA6B,CAAC,OAAyB;IACrE,MAAM,cAAc,GAAG,EAAE,CAAC,2BAA2B,CAAC,EAAE,MAAM,EAAE,CAAC;IACjE,OAAO;QACL,GAAG,OAAO;QACV,cAAc,EAAE;YACd,GAAG,OAAO,CAAC,cAAc;YACzB,aAAa,EAAE;gBACb,GAAG,OAAO,CAAC,cAAc,EAAE,aAAa;gBACxC,GAAG,cAAc;aAClB;SACF;KACF,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAS,0BAA0B,CAAC,UAAkB;IACpD,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC;IAC7C,MAAM,IAAI,GAAG,gBAAgB,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAClD,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpB,IAAI,CAAC,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,8BAA8B,EAAE,CAAC;IAC1D,CAAC;IACD,gBAAgB,CAAC,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAE3C,OAAO,gBAAgB,CAAC,QAAQ,EAAE,CAAC;AACrC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { OperationOptions } from \"@azure/core-client\";\nimport type { PipelinePolicy } from \"@azure/core-rest-pipeline\";\n\n/**\n * The programmatic identifier of the tablesSecondaryEndpointPolicy.\n */\nexport const tablesSecondaryEndpointPolicyName = \"tablesSecondaryEndpointPolicy\";\nexport const SecondaryLocationHeaderName = \"tables-secondary-endpoint\";\nconst SecondaryLocationAccountSuffix = \"-secondary\";\n\n/**\n * Policy that would replace the Primary Endpoint with the secondary endpoint\n * when the `tables-secondary-endpoint` is set in the request\n */\nexport const tablesSecondaryEndpointPolicy: PipelinePolicy = {\n name: tablesSecondaryEndpointPolicyName,\n sendRequest: async (req, next) => {\n // Only replace the URL if the SecondaryLocationHeader is set\n if (req.headers.get(SecondaryLocationHeaderName)) {\n // Since the header is for internal use only, clean it up.\n req.headers.delete(SecondaryLocationHeaderName);\n // Calculate and update the secondary url\n req.url = getSecondaryUrlFromPrimary(req.url);\n }\n\n return next(req);\n },\n};\n\n/**\n * Utility function that injects the SecondaryEndpointHeader into an operation options\n */\nexport function injectSecondaryEndpointHeader(options: OperationOptions): OperationOptions {\n const headerToInject = { [SecondaryLocationHeaderName]: \"true\" };\n return {\n ...options,\n requestOptions: {\n ...options.requestOptions,\n customHeaders: {\n ...options.requestOptions?.customHeaders,\n ...headerToInject,\n },\n },\n };\n}\n\n/**\n * Utility function that calculates the secondary URL for a table instance given the primary URL.\n */\nfunction getSecondaryUrlFromPrimary(primaryUrl: string): string {\n const parsedPrimaryUrl = new URL(primaryUrl);\n const host = parsedPrimaryUrl.hostname.split(\".\");\n if (host.length > 1) {\n host[0] = `${host[0]}${SecondaryLocationAccountSuffix}`;\n }\n parsedPrimaryUrl.hostname = host.join(\".\");\n\n return parsedPrimaryUrl.toString();\n}\n"]}
@@ -1,6 +1,5 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT License.
3
- import { __rest } from "tslib";
4
3
  import { base64Decode, base64Encode } from "./utils/bufferSerializer.js";
5
4
  import { truncatedISO8061Date } from "./utils/truncateISO8061Date.js";
6
5
  const propertyCaseMap = new Map([
@@ -64,7 +63,7 @@ function serializeObject(obj) {
64
63
  return serializedValue;
65
64
  }
66
65
  function getSerializedValue(value) {
67
- if (typeof value === "object" && (value === null || value === void 0 ? void 0 : value.value) !== undefined && (value === null || value === void 0 ? void 0 : value.type) !== undefined) {
66
+ if (typeof value === "object" && value?.value !== undefined && value?.type !== undefined) {
68
67
  return serializeObject(value);
69
68
  }
70
69
  else {
@@ -114,11 +113,10 @@ function getTypedObject(value, type, disableTypeConversion) {
114
113
  }
115
114
  }
116
115
  export function deserialize(obj, disableTypeConversion = false) {
117
- var _a;
118
116
  const deserialized = {};
119
117
  for (const [key, value] of Object.entries(obj)) {
120
118
  if (key.indexOf("@odata.type") === -1) {
121
- const transformedKey = (_a = propertyCaseMap.get(key)) !== null && _a !== void 0 ? _a : key;
119
+ const transformedKey = propertyCaseMap.get(key) ?? key;
122
120
  let typedValue = value;
123
121
  if (`${key}@odata.type` in obj) {
124
122
  const type = obj[`${key}@odata.type`];
@@ -174,7 +172,7 @@ export function deserializeObjectsArray(objArray, disableTypeConversion) {
174
172
  export function serializeSignedIdentifiers(signedIdentifiers) {
175
173
  return signedIdentifiers.map((acl) => {
176
174
  const { id, accessPolicy } = acl;
177
- const _a = accessPolicy !== null && accessPolicy !== void 0 ? accessPolicy : {}, { start, expiry } = _a, rest = __rest(_a, ["start", "expiry"]);
175
+ const { start, expiry, ...rest } = accessPolicy ?? {};
178
176
  const serializedStart = start
179
177
  ? truncatedISO8061Date(start, false /** withMilliseconds */)
180
178
  : undefined;
@@ -183,25 +181,33 @@ export function serializeSignedIdentifiers(signedIdentifiers) {
183
181
  : undefined;
184
182
  return {
185
183
  id,
186
- accessPolicy: Object.assign(Object.assign(Object.assign({}, (serializedExpiry && { expiry: serializedExpiry })), (serializedStart && { start: serializedStart })), rest),
184
+ accessPolicy: {
185
+ ...(serializedExpiry && { expiry: serializedExpiry }),
186
+ ...(serializedStart && { start: serializedStart }),
187
+ ...rest,
188
+ },
187
189
  };
188
190
  });
189
191
  }
190
192
  export function deserializeSignedIdentifier(signedIdentifiers) {
191
193
  return signedIdentifiers.map((si) => {
192
194
  const { id, accessPolicy } = si;
193
- const _a = accessPolicy !== null && accessPolicy !== void 0 ? accessPolicy : {}, { start, expiry } = _a, restAcl = __rest(_a, ["start", "expiry"]);
195
+ const { start, expiry, ...restAcl } = accessPolicy ?? {};
194
196
  const deserializedStart = start ? new Date(start) : undefined;
195
197
  const deserializedExpiry = expiry ? new Date(expiry) : undefined;
196
198
  return {
197
199
  id,
198
- accessPolicy: Object.assign(Object.assign(Object.assign({}, (deserializedExpiry && { expiry: deserializedExpiry })), (deserializedStart && { start: deserializedStart })), restAcl),
200
+ accessPolicy: {
201
+ ...(deserializedExpiry && { expiry: deserializedExpiry }),
202
+ ...(deserializedStart && { start: deserializedStart }),
203
+ ...restAcl,
204
+ },
199
205
  };
200
206
  });
201
207
  }
202
208
  export function serializeQueryOptions(query) {
203
- const { select } = query, queryOptions = __rest(query, ["select"]);
204
- const mappedQuery = Object.assign({}, queryOptions);
209
+ const { select, ...queryOptions } = query;
210
+ const mappedQuery = { ...queryOptions };
205
211
  // Properties that are always returned by the service but are not allowed in select
206
212
  const excludeFromSelect = ["etag", "odata.etag"];
207
213
  if (select) {