@azure/data-tables 13.3.1-alpha.20250109.1 → 13.3.1-alpha.20250113.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/README.md +17 -17
  2. package/dist/browser/sas/accountSasPermissions.d.ts +1 -1
  3. package/dist/browser/sas/accountSasPermissions.js +2 -2
  4. package/dist/browser/sas/accountSasPermissions.js.map +1 -1
  5. package/dist/browser/sas/accountSasResourceTypes.d.ts +1 -1
  6. package/dist/browser/sas/accountSasResourceTypes.js +1 -1
  7. package/dist/browser/sas/accountSasResourceTypes.js.map +1 -1
  8. package/dist/browser/sas/accountSasSignatureValues.d.ts +3 -3
  9. package/dist/browser/sas/accountSasSignatureValues.js +1 -1
  10. package/dist/browser/sas/accountSasSignatureValues.js.map +1 -1
  11. package/dist/browser/sas/generateAccountSas.d.ts +1 -1
  12. package/dist/browser/sas/generateAccountSas.js +1 -1
  13. package/dist/browser/sas/generateAccountSas.js.map +1 -1
  14. package/dist/browser/sas/generateTableSas.d.ts +1 -1
  15. package/dist/browser/sas/generateTableSas.js +1 -1
  16. package/dist/browser/sas/generateTableSas.js.map +1 -1
  17. package/dist/browser/sas/sasQueryParameters.d.ts +3 -3
  18. package/dist/browser/sas/sasQueryParameters.js.map +1 -1
  19. package/dist/browser/sas/tableSasSignatureValues.d.ts +1 -1
  20. package/dist/browser/sas/tableSasSignatureValues.js.map +1 -1
  21. package/dist/commonjs/sas/accountSasPermissions.d.ts +1 -1
  22. package/dist/commonjs/sas/accountSasPermissions.js +2 -2
  23. package/dist/commonjs/sas/accountSasPermissions.js.map +1 -1
  24. package/dist/commonjs/sas/accountSasResourceTypes.d.ts +1 -1
  25. package/dist/commonjs/sas/accountSasResourceTypes.js +1 -1
  26. package/dist/commonjs/sas/accountSasResourceTypes.js.map +1 -1
  27. package/dist/commonjs/sas/accountSasSignatureValues.d.ts +3 -3
  28. package/dist/commonjs/sas/accountSasSignatureValues.js +1 -1
  29. package/dist/commonjs/sas/accountSasSignatureValues.js.map +1 -1
  30. package/dist/commonjs/sas/generateAccountSas.d.ts +1 -1
  31. package/dist/commonjs/sas/generateAccountSas.js +1 -1
  32. package/dist/commonjs/sas/generateAccountSas.js.map +1 -1
  33. package/dist/commonjs/sas/generateTableSas.d.ts +1 -1
  34. package/dist/commonjs/sas/generateTableSas.js +1 -1
  35. package/dist/commonjs/sas/generateTableSas.js.map +1 -1
  36. package/dist/commonjs/sas/sasQueryParameters.d.ts +3 -3
  37. package/dist/commonjs/sas/sasQueryParameters.js.map +1 -1
  38. package/dist/commonjs/sas/tableSasSignatureValues.d.ts +1 -1
  39. package/dist/commonjs/sas/tableSasSignatureValues.js.map +1 -1
  40. package/dist/commonjs/tablesNamedCredentialPolicy.js +1 -1
  41. package/dist/commonjs/tablesNamedCredentialPolicy.js.map +1 -1
  42. package/dist/esm/sas/accountSasPermissions.d.ts +1 -1
  43. package/dist/esm/sas/accountSasPermissions.js +2 -2
  44. package/dist/esm/sas/accountSasPermissions.js.map +1 -1
  45. package/dist/esm/sas/accountSasResourceTypes.d.ts +1 -1
  46. package/dist/esm/sas/accountSasResourceTypes.js +1 -1
  47. package/dist/esm/sas/accountSasResourceTypes.js.map +1 -1
  48. package/dist/esm/sas/accountSasSignatureValues.d.ts +3 -3
  49. package/dist/esm/sas/accountSasSignatureValues.js +1 -1
  50. package/dist/esm/sas/accountSasSignatureValues.js.map +1 -1
  51. package/dist/esm/sas/generateAccountSas.d.ts +1 -1
  52. package/dist/esm/sas/generateAccountSas.js +1 -1
  53. package/dist/esm/sas/generateAccountSas.js.map +1 -1
  54. package/dist/esm/sas/generateTableSas.d.ts +1 -1
  55. package/dist/esm/sas/generateTableSas.js +1 -1
  56. package/dist/esm/sas/generateTableSas.js.map +1 -1
  57. package/dist/esm/sas/sasQueryParameters.d.ts +3 -3
  58. package/dist/esm/sas/sasQueryParameters.js.map +1 -1
  59. package/dist/esm/sas/tableSasSignatureValues.d.ts +1 -1
  60. package/dist/esm/sas/tableSasSignatureValues.js.map +1 -1
  61. package/dist/esm/tablesNamedCredentialPolicy.js +1 -1
  62. package/dist/esm/tablesNamedCredentialPolicy.js.map +1 -1
  63. package/dist/react-native/sas/accountSasPermissions.d.ts +1 -1
  64. package/dist/react-native/sas/accountSasPermissions.js +2 -2
  65. package/dist/react-native/sas/accountSasPermissions.js.map +1 -1
  66. package/dist/react-native/sas/accountSasResourceTypes.d.ts +1 -1
  67. package/dist/react-native/sas/accountSasResourceTypes.js +1 -1
  68. package/dist/react-native/sas/accountSasResourceTypes.js.map +1 -1
  69. package/dist/react-native/sas/accountSasSignatureValues.d.ts +3 -3
  70. package/dist/react-native/sas/accountSasSignatureValues.js +1 -1
  71. package/dist/react-native/sas/accountSasSignatureValues.js.map +1 -1
  72. package/dist/react-native/sas/generateAccountSas.d.ts +1 -1
  73. package/dist/react-native/sas/generateAccountSas.js +1 -1
  74. package/dist/react-native/sas/generateAccountSas.js.map +1 -1
  75. package/dist/react-native/sas/generateTableSas.d.ts +1 -1
  76. package/dist/react-native/sas/generateTableSas.js +1 -1
  77. package/dist/react-native/sas/generateTableSas.js.map +1 -1
  78. package/dist/react-native/sas/sasQueryParameters.d.ts +3 -3
  79. package/dist/react-native/sas/sasQueryParameters.js.map +1 -1
  80. package/dist/react-native/sas/tableSasSignatureValues.d.ts +1 -1
  81. package/dist/react-native/sas/tableSasSignatureValues.js.map +1 -1
  82. package/dist/react-native/tablesNamedCredentialPolicy.js +1 -1
  83. package/dist/react-native/tablesNamedCredentialPolicy.js.map +1 -1
  84. package/package.json +2 -2
package/README.md CHANGED
@@ -20,8 +20,8 @@ Key links:
20
20
 
21
21
  - [Source code](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/tables/data-tables/)
22
22
  - [Package (NPM)](https://www.npmjs.com/package/@azure/data-tables)
23
- - [API reference documentation](https://docs.microsoft.com/javascript/api/@azure/data-tables)
24
- - [Product documentation](https://docs.microsoft.com/azure/storage/tables/table-storage-overview/)
23
+ - [API reference documentation](https://learn.microsoft.com/javascript/api/@azure/data-tables)
24
+ - [Product documentation](https://learn.microsoft.com/azure/storage/tables/table-storage-overview/)
25
25
  - [Samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/tables/data-tables/samples)
26
26
 
27
27
  ## Getting started
@@ -33,7 +33,7 @@ Currently supported environments:
33
33
  - LTS versions of Node.js
34
34
  - Latest versions of Safari, Chrome, Edge and Firefox
35
35
 
36
- You must have an [Azure subscription](https://azure.microsoft.com/free/) and a [Storage Account](https://docs.microsoft.com/azure/storage/tables/table-storage-quickstart-portal) or an [Azure CosmosDB database](https://docs.microsoft.com/azure/cosmos-db/create-cosmosdb-resources-portal) to use this package.
36
+ You must have an [Azure subscription](https://azure.microsoft.com/free/) and a [Storage Account](https://learn.microsoft.com/azure/storage/tables/table-storage-quickstart-portal) or an [Azure CosmosDB database](https://learn.microsoft.com/azure/cosmos-db/create-cosmosdb-resources-portal) to use this package.
37
37
 
38
38
  ### Install the `@azure/data-tables` package
39
39
 
@@ -68,7 +68,7 @@ To use this client library in the browser, first you need to use a bundler. For
68
68
 
69
69
  #### CORS
70
70
 
71
- You need to set up [Cross-Origin Resource Sharing (CORS)](https://docs.microsoft.com/rest/api/storageservices/cross-origin-resource-sharing--cors--support-for-the-azure-storage-services) rules for your storage account if you need to develop for browsers. Go to Azure portal and Azure Storage Explorer, find your storage account, create new CORS rules for blob/queue/file/table service(s).
71
+ You need to set up [Cross-Origin Resource Sharing (CORS)](https://learn.microsoft.com/rest/api/storageservices/cross-origin-resource-sharing--cors--support-for-the-azure-storage-services) rules for your storage account if you need to develop for browsers. Go to Azure portal and Azure Storage Explorer, find your storage account, create new CORS rules for blob/queue/file/table service(s).
72
72
 
73
73
  For example, you can create following CORS settings for debugging. But please customize the settings carefully according to your requirements in production environment.
74
74
 
@@ -137,7 +137,7 @@ const accountKey = "<accountkey>";
137
137
  const credential = new AzureNamedKeyCredential(account, accountKey);
138
138
  const serviceClient = new TableServiceClient(
139
139
  `https://${account}.table.core.windows.net`,
140
- credential
140
+ credential,
141
141
  );
142
142
  ```
143
143
 
@@ -165,7 +165,7 @@ const account = "<account name>";
165
165
 
166
166
  const clientWithAAD = new TableServiceClient(
167
167
  `https://${account}.table.core.windows.net`,
168
- credential
168
+ credential,
169
169
  );
170
170
  ```
171
171
 
@@ -181,7 +181,7 @@ const sas = "<service Shared Access Signature Token>";
181
181
 
182
182
  const serviceClientWithSAS = new TableServiceClient(
183
183
  `https://${account}.table.core.windows.net`,
184
- new AzureSASCredential(sas)
184
+ new AzureSASCredential(sas),
185
185
  );
186
186
  ```
187
187
 
@@ -198,7 +198,7 @@ const accountKey = "<accountkey>";
198
198
  const credential = new AzureNamedKeyCredential(account, accountKey);
199
199
  const serviceClient = new TableServiceClient(
200
200
  `https://${account}.table.core.windows.net`,
201
- credential
201
+ credential,
202
202
  );
203
203
 
204
204
  async function main() {
@@ -233,7 +233,7 @@ const accountKey = "<accountkey>";
233
233
  const credential = new AzureNamedKeyCredential(account, accountKey);
234
234
  const serviceClient = new TableServiceClient(
235
235
  `https://${account}.table.core.windows.net`,
236
- credential
236
+ credential,
237
237
  );
238
238
 
239
239
  async function main() {
@@ -256,7 +256,7 @@ const accountKey = "<accountkey>";
256
256
  const credential = new AzureNamedKeyCredential(account, accountKey);
257
257
  const serviceClient = new TableServiceClient(
258
258
  `https://${account}.table.core.windows.net`,
259
- credential
259
+ credential,
260
260
  );
261
261
 
262
262
  async function main() {
@@ -266,7 +266,7 @@ async function main() {
266
266
  if (response.status === 409) {
267
267
  console.log(`Table ${tableName} already exists`);
268
268
  }
269
- }
269
+ },
270
270
  });
271
271
  }
272
272
 
@@ -322,7 +322,7 @@ const tableName = "<tableName>";
322
322
  const clientWithAAD = new TableClient(
323
323
  `https://${account}.table.core.windows.net`,
324
324
  tableName,
325
- credential
325
+ credential,
326
326
  );
327
327
  ```
328
328
 
@@ -340,7 +340,7 @@ const tableName = "<tableName>";
340
340
  const clientWithSAS = new TableClient(
341
341
  `https://${account}.table.core.windows.net`,
342
342
  tableName,
343
- new AzureSASCredential(sas)
343
+ new AzureSASCredential(sas),
344
344
  );
345
345
  ```
346
346
 
@@ -370,7 +370,7 @@ const tableName = "<tableName>";
370
370
  const clientWithAAD = new TableClient(
371
371
  `https://${account}.table.core.windows.net`,
372
372
  tableName,
373
- credential
373
+ credential,
374
374
  );
375
375
  ```
376
376
 
@@ -424,7 +424,7 @@ async function main() {
424
424
  partitionKey: "P1",
425
425
  rowKey: "R1",
426
426
  foo: "foo",
427
- bar: 123
427
+ bar: 123,
428
428
  };
429
429
  await client.createEntity(testEntity);
430
430
  }
@@ -458,7 +458,7 @@ const client = new TableClient(
458
458
  "<Azurite-http-table-endpoint>",
459
459
  "myTable",
460
460
  new AzureNamedKeyCredential("<Azurite-account-name>", "<Azurite-account-key>"),
461
- { allowInsecureConnection: true }
461
+ { allowInsecureConnection: true },
462
462
  );
463
463
  ```
464
464
 
@@ -467,7 +467,7 @@ const client = new TableClient(
467
467
  ### General
468
468
 
469
469
  When you interact with Tables service using the Javascript/Typescript SDK, errors returned by the service correspond to the same HTTP status codes returned for REST API requests:
470
- [Storage Table Service Error Codes](https://docs.microsoft.com/rest/api/storageservices/table-service-error-codes)
470
+ [Storage Table Service Error Codes](https://learn.microsoft.com/rest/api/storageservices/table-service-error-codes)
471
471
 
472
472
  ### Logging
473
473
 
@@ -11,7 +11,7 @@ export declare function accountSasPermissionsFromString(permissions: string): Ac
11
11
  * Using this method will guarantee the resource types are in
12
12
  * an order accepted by the service.
13
13
  *
14
- * @see https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-an-account-sas
14
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/constructing-an-account-sas
15
15
  *
16
16
  */
17
17
  export declare function accountSasPermissionsToString(permissions: AccountSasPermissions): string;
@@ -40,12 +40,12 @@ export function accountSasPermissionsFromString(permissions) {
40
40
  * Using this method will guarantee the resource types are in
41
41
  * an order accepted by the service.
42
42
  *
43
- * @see https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-an-account-sas
43
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/constructing-an-account-sas
44
44
  *
45
45
  */
46
46
  export function accountSasPermissionsToString(permissions) {
47
47
  // The order of the characters should be as specified here to ensure correctness:
48
- // https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-an-account-sas
48
+ // https://learn.microsoft.com/en-us/rest/api/storageservices/constructing-an-account-sas
49
49
  // Use a string array instead of string concatenating += operator for performance
50
50
  const permissionString = [];
51
51
  if (permissions.query) {
@@ -1 +1 @@
1
- {"version":3,"file":"accountSasPermissions.js","sourceRoot":"","sources":["../../../src/sas/accountSasPermissions.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;;;GAIG;AACH,MAAM,UAAU,+BAA+B,CAAC,WAAmB;IACjE,MAAM,qBAAqB,GAA0B,EAAE,CAAC;IAExD,KAAK,MAAM,CAAC,IAAI,WAAW,EAAE,CAAC;QAC5B,QAAQ,CAAC,EAAE,CAAC;YACV,KAAK,GAAG;gBACN,qBAAqB,CAAC,KAAK,GAAG,IAAI,CAAC;gBACnC,MAAM;YACR,KAAK,GAAG;gBACN,qBAAqB,CAAC,KAAK,GAAG,IAAI,CAAC;gBACnC,MAAM;YACR,KAAK,GAAG;gBACN,qBAAqB,CAAC,MAAM,GAAG,IAAI,CAAC;gBACpC,MAAM;YACR,KAAK,GAAG;gBACN,qBAAqB,CAAC,IAAI,GAAG,IAAI,CAAC;gBAClC,MAAM;YACR,KAAK,GAAG;gBACN,qBAAqB,CAAC,GAAG,GAAG,IAAI,CAAC;gBACjC,MAAM;YACR,KAAK,GAAG;gBACN,qBAAqB,CAAC,MAAM,GAAG,IAAI,CAAC;gBACpC,MAAM;YAER;gBACE,MAAM,IAAI,UAAU,CAAC,iCAAiC,CAAC,EAAE,CAAC,CAAC;QAC/D,CAAC;IACH,CAAC;IAED,OAAO,qBAAqB,CAAC;AAC/B,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,6BAA6B,CAAC,WAAkC;IAC9E,iFAAiF;IACjF,wFAAwF;IACxF,iFAAiF;IACjF,MAAM,gBAAgB,GAAa,EAAE,CAAC;IACtC,IAAI,WAAW,CAAC,KAAK,EAAE,CAAC;QACtB,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;IACD,IAAI,WAAW,CAAC,KAAK,EAAE,CAAC;QACtB,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;IACD,IAAI,WAAW,CAAC,MAAM,EAAE,CAAC;QACvB,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;IACD,IAAI,WAAW,CAAC,IAAI,EAAE,CAAC;QACrB,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;IACD,IAAI,WAAW,CAAC,GAAG,EAAE,CAAC;QACpB,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;IACD,IAAI,WAAW,CAAC,MAAM,EAAE,CAAC;QACvB,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;IAED,OAAO,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACnC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * Parse initializes the AccountSASPermissions fields from a string.\n *\n * @param permissions -\n */\nexport function accountSasPermissionsFromString(permissions: string): AccountSasPermissions {\n const accountSasPermissions: AccountSasPermissions = {};\n\n for (const c of permissions) {\n switch (c) {\n case \"r\":\n accountSasPermissions.query = true;\n break;\n case \"w\":\n accountSasPermissions.write = true;\n break;\n case \"d\":\n accountSasPermissions.delete = true;\n break;\n case \"l\":\n accountSasPermissions.list = true;\n break;\n case \"a\":\n accountSasPermissions.add = true;\n break;\n case \"u\":\n accountSasPermissions.update = true;\n break;\n\n default:\n throw new RangeError(`Invalid permission character: ${c}`);\n }\n }\n\n return accountSasPermissions;\n}\n\n/**\n * Produces the SAS permissions string for an Azure Storage account.\n * Call this method to set AccountSASSignatureValues Permissions field.\n *\n * Using this method will guarantee the resource types are in\n * an order accepted by the service.\n *\n * @see https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-an-account-sas\n *\n */\nexport function accountSasPermissionsToString(permissions: AccountSasPermissions): string {\n // The order of the characters should be as specified here to ensure correctness:\n // https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-an-account-sas\n // Use a string array instead of string concatenating += operator for performance\n const permissionString: string[] = [];\n if (permissions.query) {\n permissionString.push(\"r\");\n }\n if (permissions.write) {\n permissionString.push(\"w\");\n }\n if (permissions.delete) {\n permissionString.push(\"d\");\n }\n if (permissions.list) {\n permissionString.push(\"l\");\n }\n if (permissions.add) {\n permissionString.push(\"a\");\n }\n if (permissions.update) {\n permissionString.push(\"u\");\n }\n\n return permissionString.join(\"\");\n}\n\n/**\n * A type that looks like an account SAS permission.\n * Used in {@link AccountSasPermissions} to parse SAS permissions from raw objects.\n */\nexport interface AccountSasPermissions {\n /**\n * Grants permission to list entities.\n */\n query?: boolean;\n\n /**\n * Grants permission to create tables\n */\n write?: boolean;\n\n /**\n * Grants permission to delete tables and entities\n */\n delete?: boolean;\n\n /**\n * Grants permission to list tables\n */\n list?: boolean;\n\n /**\n * Grants permission to create entities\n */\n add?: boolean;\n\n /**\n * Permissions to update messages and table entities granted.\n */\n update?: boolean;\n}\n"]}
1
+ {"version":3,"file":"accountSasPermissions.js","sourceRoot":"","sources":["../../../src/sas/accountSasPermissions.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;;;GAIG;AACH,MAAM,UAAU,+BAA+B,CAAC,WAAmB;IACjE,MAAM,qBAAqB,GAA0B,EAAE,CAAC;IAExD,KAAK,MAAM,CAAC,IAAI,WAAW,EAAE,CAAC;QAC5B,QAAQ,CAAC,EAAE,CAAC;YACV,K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AAC;IACD,IAAI,WAAW,CAAC,MAAM,EAAE,CAAC;QACvB,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;IAED,OAAO,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACnC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * Parse initializes the AccountSASPermissions fields from a string.\n *\n * @param permissions -\n */\nexport function accountSasPermissionsFromString(permissions: string): AccountSasPermissions {\n const accountSasPermissions: AccountSasPermissions = {};\n\n for (const c of permissions) {\n switch (c) {\n case \"r\":\n accountSasPermissions.query = true;\n break;\n case \"w\":\n accountSasPermissions.write = true;\n break;\n case \"d\":\n accountSasPermissions.delete = true;\n break;\n case \"l\":\n accountSasPermissions.list = true;\n break;\n case \"a\":\n accountSasPermissions.add = true;\n break;\n case \"u\":\n accountSasPermissions.update = true;\n break;\n\n default:\n throw new RangeError(`Invalid permission character: ${c}`);\n }\n }\n\n return accountSasPermissions;\n}\n\n/**\n * Produces the SAS permissions string for an Azure Storage account.\n * Call this method to set AccountSASSignatureValues Permissions field.\n *\n * Using this method will guarantee the resource types are in\n * an order accepted by the service.\n *\n * @see https://learn.microsoft.com/en-us/rest/api/storageservices/constructing-an-account-sas\n *\n */\nexport function accountSasPermissionsToString(permissions: AccountSasPermissions): string {\n // The order of the characters should be as specified here to ensure correctness:\n // https://learn.microsoft.com/en-us/rest/api/storageservices/constructing-an-account-sas\n // Use a string array instead of string concatenating += operator for performance\n const permissionString: string[] = [];\n if (permissions.query) {\n permissionString.push(\"r\");\n }\n if (permissions.write) {\n permissionString.push(\"w\");\n }\n if (permissions.delete) {\n permissionString.push(\"d\");\n }\n if (permissions.list) {\n permissionString.push(\"l\");\n }\n if (permissions.add) {\n permissionString.push(\"a\");\n }\n if (permissions.update) {\n permissionString.push(\"u\");\n }\n\n return permissionString.join(\"\");\n}\n\n/**\n * A type that looks like an account SAS permission.\n * Used in {@link AccountSasPermissions} to parse SAS permissions from raw objects.\n */\nexport interface AccountSasPermissions {\n /**\n * Grants permission to list entities.\n */\n query?: boolean;\n\n /**\n * Grants permission to create tables\n */\n write?: boolean;\n\n /**\n * Grants permission to delete tables and entities\n */\n delete?: boolean;\n\n /**\n * Grants permission to list tables\n */\n list?: boolean;\n\n /**\n * Grants permission to create entities\n */\n add?: boolean;\n\n /**\n * Permissions to update messages and table entities granted.\n */\n update?: boolean;\n}\n"]}
@@ -8,7 +8,7 @@ export declare function accountSasResourceTypesFromString(resourceTypes: string)
8
8
  /**
9
9
  * Converts the given resource types to a string.
10
10
  *
11
- * @see https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-an-account-sas
11
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/constructing-an-account-sas
12
12
  *
13
13
  */
14
14
  export declare function accountSasResourceTypesToString(resourceTypes: AccountSasResourceTypes): string;
@@ -28,7 +28,7 @@ export function accountSasResourceTypesFromString(resourceTypes) {
28
28
  /**
29
29
  * Converts the given resource types to a string.
30
30
  *
31
- * @see https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-an-account-sas
31
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/constructing-an-account-sas
32
32
  *
33
33
  */
34
34
  export function accountSasResourceTypesToString(resourceTypes) {
@@ -1 +1 @@
1
- {"version":3,"file":"accountSasResourceTypes.js","sourceRoot":"","sources":["../../../src/sas/accountSasResourceTypes.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;;;;GAKG;AACH,MAAM,UAAU,iCAAiC,CAAC,aAAqB;IACrE,MAAM,uBAAuB,GAA4B,EAAE,CAAC;IAE5D,KAAK,MAAM,CAAC,IAAI,aAAa,EAAE,CAAC;QAC9B,QAAQ,CAAC,EAAE,CAAC;YACV,KAAK,GAAG;gBACN,uBAAuB,CAAC,OAAO,GAAG,IAAI,CAAC;gBACvC,MAAM;YACR,KAAK,GAAG;gBACN,uBAAuB,CAAC,SAAS,GAAG,IAAI,CAAC;gBACzC,MAAM;YACR,KAAK,GAAG;gBACN,uBAAuB,CAAC,MAAM,GAAG,IAAI,CAAC;gBACtC,MAAM;YACR;gBACE,MAAM,IAAI,UAAU,CAAC,0BAA0B,CAAC,EAAE,CAAC,CAAC;QACxD,CAAC;IACH,CAAC;IAED,OAAO,uBAAuB,CAAC;AACjC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,+BAA+B,CAAC,aAAsC;IACpF,MAAM,mBAAmB,GAAa,EAAE,CAAC;IACzC,IAAI,aAAa,CAAC,OAAO,EAAE,CAAC;QAC1B,mBAAmB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAChC,CAAC;IACD,IAAI,aAAa,CAAC,SAAS,EAAE,CAAC;QAC5B,mBAAmB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAChC,CAAC;IACD,IAAI,aAAa,CAAC,MAAM,EAAE,CAAC;QACzB,mBAAmB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAChC,CAAC;IACD,OAAO,mBAAmB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACtC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * Creates an {@link accountSasResourceTypesFromString} from the specified resource types string. This method will throw an\n * Error if it encounters a character that does not correspond to a valid resource type.\n *\n * @param resourceTypes -\n */\nexport function accountSasResourceTypesFromString(resourceTypes: string): AccountSasResourceTypes {\n const accountSasResourceTypes: AccountSasResourceTypes = {};\n\n for (const c of resourceTypes) {\n switch (c) {\n case \"s\":\n accountSasResourceTypes.service = true;\n break;\n case \"c\":\n accountSasResourceTypes.container = true;\n break;\n case \"o\":\n accountSasResourceTypes.object = true;\n break;\n default:\n throw new RangeError(`Invalid resource type: ${c}`);\n }\n }\n\n return accountSasResourceTypes;\n}\n\n/**\n * Converts the given resource types to a string.\n *\n * @see https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-an-account-sas\n *\n */\nexport function accountSasResourceTypesToString(resourceTypes: AccountSasResourceTypes): string {\n const resourceTypesString: string[] = [];\n if (resourceTypes.service) {\n resourceTypesString.push(\"s\");\n }\n if (resourceTypes.container) {\n resourceTypesString.push(\"c\");\n }\n if (resourceTypes.object) {\n resourceTypesString.push(\"o\");\n }\n return resourceTypesString.join(\"\");\n}\n\n/**\n * Represents the Resources that are accessible by the SAS token\n */\nexport interface AccountSasResourceTypes {\n /**\n * Permission to access service level APIs granted.\n */\n service?: boolean;\n\n /**\n * Permission to access container level APIs (Blob Containers, Tables, Queues, File Shares) granted.\n */\n container?: boolean;\n\n /**\n * Permission to access object level APIs (Blobs, Table Entities, Queue Messages, Files) granted.\n */\n object?: boolean;\n}\n"]}
1
+ {"version":3,"file":"accountSasResourceTypes.js","sourceRoot":"","sources":["../../../src/sas/accountSasResourceTypes.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;;;;GAKG;AACH,MAAM,UAAU,iCAAiC,CAAC,aAAqB;IACrE,MAAM,uBAAuB,GAA4B,EAAE,CAAC;IAE5D,KAAK,MAAM,CAAC,IAAI,aAAa,EAAE,CAAC;QAC9B,QAAQ,CAAC,EAAE,CAAC;YACV,KAAK,GAAG;gBACN,uBAAuB,CAAC,OAAO,GAAG,IAAI,CAAC;gBACvC,MAAM;YACR,KAAK,GAAG;gBACN,uBAAuB,CAAC,SAAS,GAAG,IAAI,CAAC;gBACzC,MAAM;YACR,KAAK,GAAG;gBACN,uBAAuB,CAAC,MAAM,GAAG,IAAI,CAAC;gBACtC,MAAM;YACR;gBACE,MAAM,IAAI,UAAU,CAAC,0BAA0B,CAAC,EAAE,CAAC,CAAC;QACxD,CAAC;IACH,CAAC;IAED,OAAO,uBAAuB,CAAC;AACjC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,+BAA+B,CAAC,aAAsC;IACpF,MAAM,mBAAmB,GAAa,EAAE,CAAC;IACzC,IAAI,aAAa,CAAC,OAAO,EAAE,CAAC;QAC1B,mBAAmB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAChC,CAAC;IACD,IAAI,aAAa,CAAC,SAAS,EAAE,CAAC;QAC5B,mBAAmB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAChC,CAAC;IACD,IAAI,aAAa,CAAC,MAAM,EAAE,CAAC;QACzB,mBAAmB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAChC,CAAC;IACD,OAAO,mBAAmB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACtC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * Creates an {@link accountSasResourceTypesFromString} from the specified resource types string. This method will throw an\n * Error if it encounters a character that does not correspond to a valid resource type.\n *\n * @param resourceTypes -\n */\nexport function accountSasResourceTypesFromString(resourceTypes: string): AccountSasResourceTypes {\n const accountSasResourceTypes: AccountSasResourceTypes = {};\n\n for (const c of resourceTypes) {\n switch (c) {\n case \"s\":\n accountSasResourceTypes.service = true;\n break;\n case \"c\":\n accountSasResourceTypes.container = true;\n break;\n case \"o\":\n accountSasResourceTypes.object = true;\n break;\n default:\n throw new RangeError(`Invalid resource type: ${c}`);\n }\n }\n\n return accountSasResourceTypes;\n}\n\n/**\n * Converts the given resource types to a string.\n *\n * @see https://learn.microsoft.com/en-us/rest/api/storageservices/constructing-an-account-sas\n *\n */\nexport function accountSasResourceTypesToString(resourceTypes: AccountSasResourceTypes): string {\n const resourceTypesString: string[] = [];\n if (resourceTypes.service) {\n resourceTypesString.push(\"s\");\n }\n if (resourceTypes.container) {\n resourceTypesString.push(\"c\");\n }\n if (resourceTypes.object) {\n resourceTypesString.push(\"o\");\n }\n return resourceTypesString.join(\"\");\n}\n\n/**\n * Represents the Resources that are accessible by the SAS token\n */\nexport interface AccountSasResourceTypes {\n /**\n * Permission to access service level APIs granted.\n */\n service?: boolean;\n\n /**\n * Permission to access container level APIs (Blob Containers, Tables, Queues, File Shares) granted.\n */\n container?: boolean;\n\n /**\n * Permission to access object level APIs (Blobs, Table Entities, Queue Messages, Files) granted.\n */\n object?: boolean;\n}\n"]}
@@ -12,10 +12,10 @@ import type { NamedKeyCredential } from "@azure/core-auth";
12
12
  * exist because the former is mutable and a logical representation while the latter is immutable and used to generate
13
13
  * actual REST requests.
14
14
  *
15
- * @see https://docs.microsoft.com/azure/storage/common/storage-dotnet-shared-access-signature-part-1
15
+ * @see https://learn.microsoft.com/azure/storage/common/storage-dotnet-shared-access-signature-part-1
16
16
  * for more conceptual information on SAS
17
17
  *
18
- * @see https://docs.microsoft.com/rest/api/storageservices/constructing-an-account-sas
18
+ * @see https://learn.microsoft.com/rest/api/storageservices/constructing-an-account-sas
19
19
  * for descriptions of the parameters, including which are required
20
20
  */
21
21
  export interface AccountSasSignatureValues {
@@ -61,7 +61,7 @@ export interface AccountSasSignatureValues {
61
61
  * Generates a {@link SasQueryParameters} object which contains all SAS query parameters needed to make an actual
62
62
  * REST request.
63
63
  *
64
- * @see https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-an-account-sas
64
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/constructing-an-account-sas
65
65
  *
66
66
  * @param accountSasSignatureValues -
67
67
  * @param sharedKeyCredential -
@@ -14,7 +14,7 @@ import { truncatedISO8061Date } from "../utils/truncateISO8061Date.js";
14
14
  * Generates a {@link SasQueryParameters} object which contains all SAS query parameters needed to make an actual
15
15
  * REST request.
16
16
  *
17
- * @see https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-an-account-sas
17
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/constructing-an-account-sas
18
18
  *
19
19
  * @param accountSasSignatureValues -
20
20
  * @param sharedKeyCredential -
@@ -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,4BAA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AAC,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://docs.microsoft.com/azure/storage/common/storage-dotnet-shared-access-signature-part-1\n * for more conceptual information on SAS\n *\n * @see https://docs.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://docs.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;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,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C,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"]}
@@ -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://docs.microsoft.com/en-us/rest/api/storageservices/create-account-sas
10
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/create-account-sas
11
11
  *
12
12
  * @param options - Optional parameters.
13
13
  * @returns An account SAS token
@@ -9,7 +9,7 @@ import { generateAccountSasQueryParameters } from "./accountSasSignatureValues.j
9
9
  * Generates a Table Account Shared Access Signature (SAS) URI based on the client properties
10
10
  * and parameters passed in. The SAS is signed by the shared key credential of the client.
11
11
  *
12
- * @see https://docs.microsoft.com/en-us/rest/api/storageservices/create-account-sas
12
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/create-account-sas
13
13
  *
14
14
  * @param options - Optional parameters.
15
15
  * @returns An account SAS token
@@ -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://docs.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,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"]}
@@ -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://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas
7
+ * @see https://learn.microsoft.com/en-us/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://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas
10
+ * @see https://learn.microsoft.com/en-us/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.
@@ -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://docs.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,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"]}
@@ -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://docs.microsoft.com/en-us/rest/api/storageservices/establishing-a-stored-access-policy
56
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/establishing-a-stored-access-policy
57
57
  */
58
58
  readonly identifier?: string;
59
59
  /**
@@ -197,12 +197,12 @@ export interface SasQueryParametersOptions {
197
197
  /**
198
198
  * Optional. The signed identifier for access policy
199
199
  *
200
- * @see https://docs.microsoft.com/rest/api/storageservices/establishing-a-stored-access-policy
200
+ * @see https://learn.microsoft.com/rest/api/storageservices/establishing-a-stored-access-policy
201
201
  */
202
202
  identifier?: string;
203
203
  /**
204
204
  * Optional. Specifies which resources are accessible via the SAS (only for {@link AccountSasSignatureValues}).
205
- * @see https://docs.microsoft.com/rest/api/storageservices/create-service-sas#specifying-the-signed-resource-blob-service-only
205
+ * @see https://learn.microsoft.com/rest/api/storageservices/create-service-sas#specifying-the-signed-resource-blob-service-only
206
206
  */
207
207
  resource?: string;
208
208
  /**
@@ -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,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;oBACR,IAAI,CAAC,uBAAuB,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC;oBACrE,MAAM;gBACR,KAAK,KAAK;oBACR,IAAI,CAAC,uBAAuB,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;oBAC/D,MAAM;gBACR,KAAK,KAAK;oBACR,IAAI,CAAC,uBAAuB,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,eAAe,CAAC,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://docs.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://docs.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://docs.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;IAwI7B;;;;OAIG;IACH,IAAW,OAAO;QAChB,IAAI,IAAI,CAAC,YAAY,EAAE,CA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AC,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"]}
@@ -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://docs.microsoft.com/en-us/rest/api/storageservices/establishing-a-stored-access-policy
48
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/establishing-a-stored-access-policy
49
49
  */
50
50
  identifier?: string;
51
51
  /**
@@ -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,CAC7C,SAAiB,EACjB,UAA8B,EAC9B,uBAAgD;;IAEhD,MAAM,OAAO,GAAG,MAAA,uBAAuB,CAAC,OAAO,mCAAI,eAAe,CAAC;IAEnE,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC7B,MAAM,SAAS,CAAC,4BAA4B,CAAC,CAAC;IAChD,CAAC;IAED,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;IAChD,CAAC;IAED,MAAM,iBAAiB,GAAG,2BAA2B,CAAC,uBAAuB,CAAC,WAAW,CA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B,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://docs.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,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AA8EvE;;;;;;GAMG;AACH,MAAM,UAAU,+BAA+B,CAC7C,SAAiB,EACjB,UAA8B,EAC9B,uBAAgD;;IAEhD,MAAM,OAAO,GAAG,MAAA,uBAAuB,CAAC,OAAO,mCAAI,eAAe,CAAC;IAEnE,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC7B,MAAM,SAAS,CAAC,4BAA4B,CAAC,CAAC;IAChD,CAAC;IAED,IAAI,CAAC,SAAS,EAAE,CAAC;QAC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AAI,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"]}
@@ -11,7 +11,7 @@ export declare function accountSasPermissionsFromString(permissions: string): Ac
11
11
  * Using this method will guarantee the resource types are in
12
12
  * an order accepted by the service.
13
13
  *
14
- * @see https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-an-account-sas
14
+ * @see https://learn.microsoft.com/en-us/rest/api/storageservices/constructing-an-account-sas
15
15
  *
16
16
  */
17
17
  export declare function accountSasPermissionsToString(permissions: AccountSasPermissions): string;