@azure/data-tables 13.0.1-alpha.20211112.1 → 13.0.1-alpha.20211217.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 (40) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/README.md +39 -8
  3. package/dist/index.js +309 -284
  4. package/dist/index.js.map +1 -1
  5. package/dist-esm/src/TableClient.js +15 -20
  6. package/dist-esm/src/TableClient.js.map +1 -1
  7. package/dist-esm/src/TablePolicies.js +2 -2
  8. package/dist-esm/src/TablePolicies.js.map +1 -1
  9. package/dist-esm/src/TableServiceClient.js +9 -14
  10. package/dist-esm/src/TableServiceClient.js.map +1 -1
  11. package/dist-esm/src/TableTransaction.js +9 -9
  12. package/dist-esm/src/TableTransaction.js.map +1 -1
  13. package/dist-esm/src/logger.js.map +1 -1
  14. package/dist-esm/src/models.js.map +1 -1
  15. package/dist-esm/src/sas/accountSasSignatureValues.js +5 -5
  16. package/dist-esm/src/sas/accountSasSignatureValues.js.map +1 -1
  17. package/dist-esm/src/sas/generateAccountSas.js +1 -1
  18. package/dist-esm/src/sas/generateAccountSas.js.map +1 -1
  19. package/dist-esm/src/sas/generateTableSas.js +14 -8
  20. package/dist-esm/src/sas/generateTableSas.js.map +1 -1
  21. package/dist-esm/src/sas/sasQueryParameters.js +1 -1
  22. package/dist-esm/src/sas/sasQueryParameters.js.map +1 -1
  23. package/dist-esm/src/sas/tableSasSignatureValues.js +9 -9
  24. package/dist-esm/src/sas/tableSasSignatureValues.js.map +1 -1
  25. package/dist-esm/src/serialization.js +2 -2
  26. package/dist-esm/src/serialization.js.map +1 -1
  27. package/dist-esm/src/tablesNamedCredentialPolicy.js.map +1 -1
  28. package/dist-esm/src/tablesSASTokenPolicy.js.map +1 -1
  29. package/dist-esm/src/utils/accountConnectionString.browser.js.map +1 -1
  30. package/dist-esm/src/utils/accountConnectionString.js.map +1 -1
  31. package/dist-esm/src/utils/connectionString.js.map +1 -1
  32. package/dist-esm/src/utils/continuationToken.js +1 -1
  33. package/dist-esm/src/utils/continuationToken.js.map +1 -1
  34. package/dist-esm/src/utils/errorHelpers.js +36 -0
  35. package/dist-esm/src/utils/errorHelpers.js.map +1 -0
  36. package/dist-esm/src/utils/internalModels.js.map +1 -1
  37. package/dist-esm/src/utils/isCredential.js.map +1 -1
  38. package/package.json +7 -9
  39. package/types/3.1/data-tables.d.ts +4 -3
  40. package/types/latest/data-tables.d.ts +4 -3
package/CHANGELOG.md CHANGED
@@ -8,6 +8,9 @@
8
8
 
9
9
  ### Bugs Fixed
10
10
 
11
+ - Fix issue where optionality of expiresOn and permissions is not respected when signedIdentifier is provided.
12
+ - Fix `createTable` not calling `onResponse` callback when the service returns `TableAlreadyExists`. [#18914](https://github.com/Azure/azure-sdk-for-js/pull/18914)
13
+
11
14
  ### Other Changes
12
15
 
13
16
  ## 13.0.0 (2021-11-11)
@@ -37,7 +40,9 @@ Thank you to our developer community members who helped to make the Azure Tables
37
40
  - Issue #18521 - `upsertEntity` doesn't work with "" for partition or row keys. [#18586](https://github.com/Azure/azure-sdk-for-js/pull/18586)
38
41
 
39
42
  ### Other Changes
43
+
40
44
  - Export RestError [#18635](https://github.com/Azure/azure-sdk-for-js/pull/18635). (A community contribution, courtesy of _[dhensby](https://github.com/dhensby))_
45
+
41
46
  ## 12.1.2 (2021-09-07)
42
47
 
43
48
  ### Bugs Fixed
package/README.md CHANGED
@@ -17,6 +17,7 @@ Azure Cosmos DB provides a Table API for applications that are written for Azure
17
17
  - The Azure Tables client library can seamlessly target either Azure table storage or Azure Cosmos DB table service endpoints with no code changes.
18
18
 
19
19
  Key links:
20
+
20
21
  - [Source code](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/tables/data-tables/)
21
22
  - [Package (NPM)](https://www.npmjs.com/package/@azure/data-tables)
22
23
  - [API reference documentation](https://docs.microsoft.com/javascript/api/@azure/data-tables)
@@ -123,6 +124,7 @@ const { TableServiceClient, AzureNamedKeyCredential } = require("@azure/data-tab
123
124
  The `TableServiceClient` requires a URL to the table service and an access credential. It also optionally accepts some settings in the `options` parameter.
124
125
 
125
126
  #### `TableServiceClient` with TokenCredential (AAD)
127
+
126
128
  Azure Tables provides integration with Azure Active Directory (Azure AD) for identity-based authentication of requests
127
129
  to the Table service when targeting a Storage endpoint. With Azure AD, you can use role-based access control (RBAC) to
128
130
  grant access to your Azure Table resources to users, groups, or applications.
@@ -202,6 +204,7 @@ main();
202
204
  #### Create a new table
203
205
 
204
206
  You can create a table through a `TableServiceClient` instance calling the `createTable` function. This function takes the name of the table to create as a parameter.
207
+ Note that `createTable` won't throw an error when the table already exists.
205
208
 
206
209
  ```javascript
207
210
  const { TableServiceClient, AzureNamedKeyCredential } = require("@azure/data-tables");
@@ -216,13 +219,42 @@ const serviceClient = new TableServiceClient(
216
219
  );
217
220
 
218
221
  async function main() {
219
- const tableName = `newtable${new Date().getTime()}`;
222
+ const tableName = `newtable`;
223
+ // If the table 'newTable' already exists, createTable doesn' throw
220
224
  await serviceClient.createTable(tableName);
221
225
  }
222
226
 
223
227
  main();
224
228
  ```
225
229
 
230
+ Here is a sample that demonstrates how to test if the table already exists when attempting to create it:
231
+
232
+ ```javascript
233
+ const { TableServiceClient, AzureNamedKeyCredential } = require("@azure/data-tables");
234
+
235
+ const account = "<account>";
236
+ const accountKey = "<accountkey>";
237
+
238
+ const credential = new AzureNamedKeyCredential(account, accountKey);
239
+ const serviceClient = new TableServiceClient(
240
+ `https://${account}.table.core.windows.net`,
241
+ credential
242
+ );
243
+
244
+ async function main() {
245
+ const tableName = `newtable${new Date().getTime()}`;
246
+ await serviceClient.createTable(tableName, {
247
+ onResponse: (response) => {
248
+ if (response.status === 409) {
249
+ console.log(`Table ${tableName} already exists`);
250
+ }
251
+ }
252
+ });
253
+ }
254
+
255
+ main();
256
+ ```
257
+
226
258
  ### Create the table client
227
259
 
228
260
  The `TableClient` is created in a similar way as the `TableServiceClient` with the difference that `TableClient` takes a table name as a parameter
@@ -247,6 +279,7 @@ const client = new TableClient(`https://${account}.table.core.windows.net`, tabl
247
279
  ```
248
280
 
249
281
  #### `TableClient` with `TokenCredential` (Azure Active Directory)
282
+
250
283
  Azure Tables provides integration with Azure Active Directory (Azure AD) for identity-based authentication of requests
251
284
  to the Table service when targeting a Storage endpoint. With Azure AD, you can use role-based access control (RBAC) to
252
285
  grant access to your Azure Table resources to users, groups, or applications.
@@ -356,33 +389,31 @@ main();
356
389
  The Azure Tables Client SDK also works with Azurite, an Azure Storage and Tables API compatible server emulator. Please refer to the ([Azurite repository](https://github.com/Azure/Azurite#azurite-v3)) on how to get started using it.
357
390
 
358
391
  ### Connecting to Azurite with Connection String shortcut
392
+
359
393
  The easiest way to connect to Azurite from your application is to configure a connection string that references the shortcut `UseDevelopmentStorage=true`. The shortcut is equivalent to the full connection string for the emulator, which specifies the account name, the account key, and the emulator endpoints for each of the Azure Storage services: ([see more](https://github.com/Azure/Azurite#http-connection-strings)). Using this shortcut, the Azure Tables Client SDK would setup the default connection string and `allowInsecureConnection` in the client options.
360
394
 
361
395
  ```typescript
362
- import { TableClient } from "@azure/data-tables"
396
+ import { TableClient } from "@azure/data-tables";
363
397
 
364
398
  const connectionString = "UseDevelopmentStorage=true";
365
399
  const client = TableClient.fromConnectionString(connectionString, "myTable");
366
400
  ```
367
401
 
368
402
  ### Connecting to Azurite without Connection String shortcut
403
+
369
404
  You can connect to azurite manually without using the connection string shortcut by specifying the service URL and `AzureNamedKeyCredential` or a custom connection string. However, `allowInsecureConnection` will need to be set manually in case Azurite runs in an `http` endpoint.
370
405
 
371
406
  ```typescript
372
- import { TableClient, AzureNamedKeyCredential } from "@azure/data-tables"
407
+ import { TableClient, AzureNamedKeyCredential } from "@azure/data-tables";
373
408
 
374
409
  const client = new TableClient(
375
410
  "<Azurite-http-table-endpoint>",
376
411
  "myTable",
377
- new AzureNamedKeyCredential(
378
- "<Azurite-account-name>",
379
- "<Azurite-account-key>"
380
- ),
412
+ new AzureNamedKeyCredential("<Azurite-account-name>", "<Azurite-account-key>"),
381
413
  { allowInsecureConnection: true }
382
414
  );
383
415
  ```
384
416
 
385
-
386
417
  ## Troubleshooting
387
418
 
388
419
  ### General