@azure/data-tables 13.0.1-alpha.20211206.1 → 13.0.1-alpha.20211220.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.
- package/CHANGELOG.md +5 -0
- package/dist/index.js +305 -302
- package/dist/index.js.map +1 -1
- package/dist-esm/src/TableClient.js +12 -12
- package/dist-esm/src/TableClient.js.map +1 -1
- package/dist-esm/src/TablePolicies.js +2 -2
- package/dist-esm/src/TablePolicies.js.map +1 -1
- package/dist-esm/src/TableServiceClient.js +7 -7
- package/dist-esm/src/TableServiceClient.js.map +1 -1
- package/dist-esm/src/TableTransaction.js +9 -9
- package/dist-esm/src/TableTransaction.js.map +1 -1
- package/dist-esm/src/models.js.map +1 -1
- package/dist-esm/src/sas/accountSasSignatureValues.js +5 -5
- package/dist-esm/src/sas/accountSasSignatureValues.js.map +1 -1
- package/dist-esm/src/sas/generateAccountSas.js +1 -1
- package/dist-esm/src/sas/generateAccountSas.js.map +1 -1
- package/dist-esm/src/sas/generateTableSas.js +14 -8
- package/dist-esm/src/sas/generateTableSas.js.map +1 -1
- package/dist-esm/src/sas/sasQueryParameters.js +1 -1
- package/dist-esm/src/sas/sasQueryParameters.js.map +1 -1
- package/dist-esm/src/sas/tableSasSignatureValues.js +9 -9
- package/dist-esm/src/sas/tableSasSignatureValues.js.map +1 -1
- package/dist-esm/src/serialization.js +1 -1
- package/dist-esm/src/serialization.js.map +1 -1
- package/dist-esm/src/tablesNamedCredentialPolicy.js.map +1 -1
- package/dist-esm/src/tablesSASTokenPolicy.js.map +1 -1
- package/dist-esm/src/utils/accountConnectionString.browser.js.map +1 -1
- package/dist-esm/src/utils/accountConnectionString.js.map +1 -1
- package/dist-esm/src/utils/connectionString.js.map +1 -1
- package/dist-esm/src/utils/errorHelpers.js.map +1 -1
- package/dist-esm/src/utils/internalModels.js.map +1 -1
- package/package.json +7 -9
- package/types/3.1/data-tables.d.ts +3 -2
- package/types/latest/data-tables.d.ts +3 -2
- package/types/latest/tsdoc-metadata.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5,12 +5,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var tslib = require('tslib');
|
|
6
6
|
var coreAuth = require('@azure/core-auth');
|
|
7
7
|
var crypto = require('crypto');
|
|
8
|
+
require('@azure/core-paging');
|
|
9
|
+
var coreXml = require('@azure/core-xml');
|
|
8
10
|
var coreClient = require('@azure/core-client');
|
|
11
|
+
var coreTracing = require('@azure/core-tracing');
|
|
9
12
|
var url$1 = require('url');
|
|
10
|
-
require('@azure/core-paging');
|
|
11
13
|
var logger$1 = require('@azure/logger');
|
|
12
|
-
var coreTracing = require('@azure/core-tracing');
|
|
13
|
-
var coreXml = require('@azure/core-xml');
|
|
14
14
|
var coreRestPipeline = require('@azure/core-rest-pipeline');
|
|
15
15
|
var uuid = require('uuid');
|
|
16
16
|
|
|
@@ -162,113 +162,21 @@ function accountSasServicesToString(services = { table: true }) {
|
|
|
162
162
|
return servicesString.join("");
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
-
// Copyright (c) Microsoft Corporation.
|
|
166
|
-
function computeHMACSHA256(stringToSign, accountKey) {
|
|
167
|
-
const key = Buffer.from(accountKey, "base64");
|
|
168
|
-
return crypto.createHmac("sha256", key)
|
|
169
|
-
.update(stringToSign, "utf8")
|
|
170
|
-
.digest("base64");
|
|
171
|
-
}
|
|
172
|
-
|
|
173
165
|
// Copyright (c) Microsoft Corporation.
|
|
174
166
|
// Licensed under the MIT license.
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
};
|
|
189
|
-
const TablesLoggingAllowedHeaderNames = [
|
|
190
|
-
"Access-Control-Allow-Origin",
|
|
191
|
-
"Cache-Control",
|
|
192
|
-
"Content-Length",
|
|
193
|
-
"Content-Type",
|
|
194
|
-
"Date",
|
|
195
|
-
"Prefer",
|
|
196
|
-
"Preference-Applied",
|
|
197
|
-
"Request-Id",
|
|
198
|
-
"traceparent",
|
|
199
|
-
"Transfer-Encoding",
|
|
200
|
-
"User-Agent",
|
|
201
|
-
"x-ms-client-request-id",
|
|
202
|
-
"x-ms-user-agent",
|
|
203
|
-
"x-ms-date",
|
|
204
|
-
"x-ms-error-code",
|
|
205
|
-
"x-ms-request-id",
|
|
206
|
-
"x-ms-return-client-request-id",
|
|
207
|
-
"x-ms-version",
|
|
208
|
-
"Accept-Ranges",
|
|
209
|
-
"Accept",
|
|
210
|
-
"Content-Disposition",
|
|
211
|
-
"Content-Encoding",
|
|
212
|
-
"Content-Language",
|
|
213
|
-
"Content-MD5",
|
|
214
|
-
"Content-Range",
|
|
215
|
-
"ETag",
|
|
216
|
-
"Last-Modified",
|
|
217
|
-
"Server",
|
|
218
|
-
"Vary",
|
|
219
|
-
"x-ms-content-crc64",
|
|
220
|
-
"x-ms-copy-action",
|
|
221
|
-
"x-ms-copy-completion-time",
|
|
222
|
-
"x-ms-copy-id",
|
|
223
|
-
"x-ms-copy-progress",
|
|
224
|
-
"x-ms-copy-status",
|
|
225
|
-
"x-ms-continuation-NextTableName",
|
|
226
|
-
"x-ms-continuation-NextPartitionKey",
|
|
227
|
-
"x-ms-continuation-NextRowKey",
|
|
228
|
-
"x-ms-has-immutability-policy",
|
|
229
|
-
"x-ms-has-legal-hold",
|
|
230
|
-
"x-ms-lease-state",
|
|
231
|
-
"x-ms-lease-status",
|
|
232
|
-
"x-ms-range",
|
|
233
|
-
"x-ms-request-server-encrypted",
|
|
234
|
-
"x-ms-server-encrypted",
|
|
235
|
-
"x-ms-snapshot",
|
|
236
|
-
"x-ms-source-range",
|
|
237
|
-
"If-Match",
|
|
238
|
-
"If-Modified-Since",
|
|
239
|
-
"If-None-Match",
|
|
240
|
-
"If-Unmodified-Since",
|
|
241
|
-
"x-ms-access-tier",
|
|
242
|
-
"x-ms-access-tier-change-time",
|
|
243
|
-
"x-ms-access-tier-inferred",
|
|
244
|
-
"x-ms-account-kind",
|
|
245
|
-
"x-ms-archive-status",
|
|
246
|
-
"x-ms-copy-destination-snapshot",
|
|
247
|
-
"x-ms-creation-time",
|
|
248
|
-
"x-ms-default-encryption-scope",
|
|
249
|
-
"x-ms-delete-type-permanent",
|
|
250
|
-
"x-ms-deny-encryption-scope-override",
|
|
251
|
-
"x-ms-encryption-algorithm",
|
|
252
|
-
"x-ms-incremental-copy",
|
|
253
|
-
"x-ms-lease-action",
|
|
254
|
-
"x-ms-lease-break-period",
|
|
255
|
-
"x-ms-lease-duration",
|
|
256
|
-
"x-ms-lease-id",
|
|
257
|
-
"x-ms-lease-time",
|
|
258
|
-
"x-ms-page-write",
|
|
259
|
-
"x-ms-proposed-lease-id",
|
|
260
|
-
"x-ms-range-get-content-md5",
|
|
261
|
-
"x-ms-rehydrate-priority",
|
|
262
|
-
"x-ms-sequence-number-action",
|
|
263
|
-
"x-ms-sku-name",
|
|
264
|
-
"x-ms-source-content-md5",
|
|
265
|
-
"x-ms-source-if-match",
|
|
266
|
-
"x-ms-source-if-modified-since",
|
|
267
|
-
"x-ms-source-if-none-match",
|
|
268
|
-
"x-ms-source-if-unmodified-since",
|
|
269
|
-
"x-ms-tag-count",
|
|
270
|
-
"x-ms-encryption-key-sha256"
|
|
271
|
-
];
|
|
167
|
+
/**
|
|
168
|
+
* Generate SasIPRange format string. For example:
|
|
169
|
+
*
|
|
170
|
+
* "8.8.8.8" or "1.1.1.1-255.255.255.255"
|
|
171
|
+
*
|
|
172
|
+
* @param ipRange -
|
|
173
|
+
*/
|
|
174
|
+
function ipRangeToString(ipRange) {
|
|
175
|
+
if (!ipRange) {
|
|
176
|
+
return "";
|
|
177
|
+
}
|
|
178
|
+
return ipRange.end ? `${ipRange.start}-${ipRange.end}` : ipRange.start;
|
|
179
|
+
}
|
|
272
180
|
|
|
273
181
|
// Copyright (c) Microsoft Corporation.
|
|
274
182
|
// Licensed under the MIT license.
|
|
@@ -288,69 +196,6 @@ function truncatedISO8061Date(date, withMilliseconds = true) {
|
|
|
288
196
|
: dateString.substring(0, dateString.length - 5) + "Z";
|
|
289
197
|
}
|
|
290
198
|
|
|
291
|
-
// Copyright (c) Microsoft Corporation.
|
|
292
|
-
// Licensed under the MIT license.
|
|
293
|
-
/**
|
|
294
|
-
* Creates an {@link accountSasResourceTypesFromString} from the specified resource types string. This method will throw an
|
|
295
|
-
* Error if it encounters a character that does not correspond to a valid resource type.
|
|
296
|
-
*
|
|
297
|
-
* @param resourceTypes -
|
|
298
|
-
*/
|
|
299
|
-
function accountSasResourceTypesFromString(resourceTypes) {
|
|
300
|
-
const accountSasResourceTypes = {};
|
|
301
|
-
for (const c of resourceTypes) {
|
|
302
|
-
switch (c) {
|
|
303
|
-
case "s":
|
|
304
|
-
accountSasResourceTypes.service = true;
|
|
305
|
-
break;
|
|
306
|
-
case "c":
|
|
307
|
-
accountSasResourceTypes.container = true;
|
|
308
|
-
break;
|
|
309
|
-
case "o":
|
|
310
|
-
accountSasResourceTypes.object = true;
|
|
311
|
-
break;
|
|
312
|
-
default:
|
|
313
|
-
throw new RangeError(`Invalid resource type: ${c}`);
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
return accountSasResourceTypes;
|
|
317
|
-
}
|
|
318
|
-
/**
|
|
319
|
-
* Converts the given resource types to a string.
|
|
320
|
-
*
|
|
321
|
-
* @see https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-an-account-sas
|
|
322
|
-
*
|
|
323
|
-
*/
|
|
324
|
-
function accountSasResourceTypesToString(resourceTypes) {
|
|
325
|
-
const resourceTypesString = [];
|
|
326
|
-
if (resourceTypes.service) {
|
|
327
|
-
resourceTypesString.push("s");
|
|
328
|
-
}
|
|
329
|
-
if (resourceTypes.container) {
|
|
330
|
-
resourceTypesString.push("c");
|
|
331
|
-
}
|
|
332
|
-
if (resourceTypes.object) {
|
|
333
|
-
resourceTypesString.push("o");
|
|
334
|
-
}
|
|
335
|
-
return resourceTypesString.join("");
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
// Copyright (c) Microsoft Corporation.
|
|
339
|
-
// Licensed under the MIT license.
|
|
340
|
-
/**
|
|
341
|
-
* Generate SasIPRange format string. For example:
|
|
342
|
-
*
|
|
343
|
-
* "8.8.8.8" or "1.1.1.1-255.255.255.255"
|
|
344
|
-
*
|
|
345
|
-
* @param ipRange -
|
|
346
|
-
*/
|
|
347
|
-
function ipRangeToString(ipRange) {
|
|
348
|
-
if (!ipRange) {
|
|
349
|
-
return "";
|
|
350
|
-
}
|
|
351
|
-
return ipRange.end ? `${ipRange.start}-${ipRange.end}` : ipRange.start;
|
|
352
|
-
}
|
|
353
|
-
|
|
354
199
|
// Copyright (c) Microsoft Corporation.
|
|
355
200
|
/**
|
|
356
201
|
* Represents the components that make up an Azure SAS' query parameters. This type is not constructed directly
|
|
@@ -521,6 +366,161 @@ class SasQueryParameters {
|
|
|
521
366
|
}
|
|
522
367
|
}
|
|
523
368
|
|
|
369
|
+
// Copyright (c) Microsoft Corporation.
|
|
370
|
+
// Licensed under the MIT license.
|
|
371
|
+
/**
|
|
372
|
+
* Creates an {@link accountSasResourceTypesFromString} from the specified resource types string. This method will throw an
|
|
373
|
+
* Error if it encounters a character that does not correspond to a valid resource type.
|
|
374
|
+
*
|
|
375
|
+
* @param resourceTypes -
|
|
376
|
+
*/
|
|
377
|
+
function accountSasResourceTypesFromString(resourceTypes) {
|
|
378
|
+
const accountSasResourceTypes = {};
|
|
379
|
+
for (const c of resourceTypes) {
|
|
380
|
+
switch (c) {
|
|
381
|
+
case "s":
|
|
382
|
+
accountSasResourceTypes.service = true;
|
|
383
|
+
break;
|
|
384
|
+
case "c":
|
|
385
|
+
accountSasResourceTypes.container = true;
|
|
386
|
+
break;
|
|
387
|
+
case "o":
|
|
388
|
+
accountSasResourceTypes.object = true;
|
|
389
|
+
break;
|
|
390
|
+
default:
|
|
391
|
+
throw new RangeError(`Invalid resource type: ${c}`);
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
return accountSasResourceTypes;
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* Converts the given resource types to a string.
|
|
398
|
+
*
|
|
399
|
+
* @see https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-an-account-sas
|
|
400
|
+
*
|
|
401
|
+
*/
|
|
402
|
+
function accountSasResourceTypesToString(resourceTypes) {
|
|
403
|
+
const resourceTypesString = [];
|
|
404
|
+
if (resourceTypes.service) {
|
|
405
|
+
resourceTypesString.push("s");
|
|
406
|
+
}
|
|
407
|
+
if (resourceTypes.container) {
|
|
408
|
+
resourceTypesString.push("c");
|
|
409
|
+
}
|
|
410
|
+
if (resourceTypes.object) {
|
|
411
|
+
resourceTypesString.push("o");
|
|
412
|
+
}
|
|
413
|
+
return resourceTypesString.join("");
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
// Copyright (c) Microsoft Corporation.
|
|
417
|
+
// Licensed under the MIT license.
|
|
418
|
+
const SERVICE_VERSION = "2019-02-02";
|
|
419
|
+
const TRANSACTION_HTTP_VERSION_1_1 = "HTTP/1.1";
|
|
420
|
+
const TRANSACTION_HTTP_LINE_ENDING = "\r\n";
|
|
421
|
+
const STORAGE_SCOPE = "https://storage.azure.com/.default";
|
|
422
|
+
const HeaderConstants = {
|
|
423
|
+
AUTHORIZATION: "authorization",
|
|
424
|
+
CONTENT_LENGTH: "content-length",
|
|
425
|
+
CONTENT_MD5: "content-md5",
|
|
426
|
+
CONTENT_TYPE: "content-type",
|
|
427
|
+
CONTENT_TRANSFER_ENCODING: "content-transfer-encoding",
|
|
428
|
+
DATE: "date",
|
|
429
|
+
X_MS_DATE: "x-ms-date",
|
|
430
|
+
X_MS_VERSION: "x-ms-version"
|
|
431
|
+
};
|
|
432
|
+
const TablesLoggingAllowedHeaderNames = [
|
|
433
|
+
"Access-Control-Allow-Origin",
|
|
434
|
+
"Cache-Control",
|
|
435
|
+
"Content-Length",
|
|
436
|
+
"Content-Type",
|
|
437
|
+
"Date",
|
|
438
|
+
"Prefer",
|
|
439
|
+
"Preference-Applied",
|
|
440
|
+
"Request-Id",
|
|
441
|
+
"traceparent",
|
|
442
|
+
"Transfer-Encoding",
|
|
443
|
+
"User-Agent",
|
|
444
|
+
"x-ms-client-request-id",
|
|
445
|
+
"x-ms-user-agent",
|
|
446
|
+
"x-ms-date",
|
|
447
|
+
"x-ms-error-code",
|
|
448
|
+
"x-ms-request-id",
|
|
449
|
+
"x-ms-return-client-request-id",
|
|
450
|
+
"x-ms-version",
|
|
451
|
+
"Accept-Ranges",
|
|
452
|
+
"Accept",
|
|
453
|
+
"Content-Disposition",
|
|
454
|
+
"Content-Encoding",
|
|
455
|
+
"Content-Language",
|
|
456
|
+
"Content-MD5",
|
|
457
|
+
"Content-Range",
|
|
458
|
+
"ETag",
|
|
459
|
+
"Last-Modified",
|
|
460
|
+
"Server",
|
|
461
|
+
"Vary",
|
|
462
|
+
"x-ms-content-crc64",
|
|
463
|
+
"x-ms-copy-action",
|
|
464
|
+
"x-ms-copy-completion-time",
|
|
465
|
+
"x-ms-copy-id",
|
|
466
|
+
"x-ms-copy-progress",
|
|
467
|
+
"x-ms-copy-status",
|
|
468
|
+
"x-ms-continuation-NextTableName",
|
|
469
|
+
"x-ms-continuation-NextPartitionKey",
|
|
470
|
+
"x-ms-continuation-NextRowKey",
|
|
471
|
+
"x-ms-has-immutability-policy",
|
|
472
|
+
"x-ms-has-legal-hold",
|
|
473
|
+
"x-ms-lease-state",
|
|
474
|
+
"x-ms-lease-status",
|
|
475
|
+
"x-ms-range",
|
|
476
|
+
"x-ms-request-server-encrypted",
|
|
477
|
+
"x-ms-server-encrypted",
|
|
478
|
+
"x-ms-snapshot",
|
|
479
|
+
"x-ms-source-range",
|
|
480
|
+
"If-Match",
|
|
481
|
+
"If-Modified-Since",
|
|
482
|
+
"If-None-Match",
|
|
483
|
+
"If-Unmodified-Since",
|
|
484
|
+
"x-ms-access-tier",
|
|
485
|
+
"x-ms-access-tier-change-time",
|
|
486
|
+
"x-ms-access-tier-inferred",
|
|
487
|
+
"x-ms-account-kind",
|
|
488
|
+
"x-ms-archive-status",
|
|
489
|
+
"x-ms-copy-destination-snapshot",
|
|
490
|
+
"x-ms-creation-time",
|
|
491
|
+
"x-ms-default-encryption-scope",
|
|
492
|
+
"x-ms-delete-type-permanent",
|
|
493
|
+
"x-ms-deny-encryption-scope-override",
|
|
494
|
+
"x-ms-encryption-algorithm",
|
|
495
|
+
"x-ms-incremental-copy",
|
|
496
|
+
"x-ms-lease-action",
|
|
497
|
+
"x-ms-lease-break-period",
|
|
498
|
+
"x-ms-lease-duration",
|
|
499
|
+
"x-ms-lease-id",
|
|
500
|
+
"x-ms-lease-time",
|
|
501
|
+
"x-ms-page-write",
|
|
502
|
+
"x-ms-proposed-lease-id",
|
|
503
|
+
"x-ms-range-get-content-md5",
|
|
504
|
+
"x-ms-rehydrate-priority",
|
|
505
|
+
"x-ms-sequence-number-action",
|
|
506
|
+
"x-ms-sku-name",
|
|
507
|
+
"x-ms-source-content-md5",
|
|
508
|
+
"x-ms-source-if-match",
|
|
509
|
+
"x-ms-source-if-modified-since",
|
|
510
|
+
"x-ms-source-if-none-match",
|
|
511
|
+
"x-ms-source-if-unmodified-since",
|
|
512
|
+
"x-ms-tag-count",
|
|
513
|
+
"x-ms-encryption-key-sha256"
|
|
514
|
+
];
|
|
515
|
+
|
|
516
|
+
// Copyright (c) Microsoft Corporation.
|
|
517
|
+
function computeHMACSHA256(stringToSign, accountKey) {
|
|
518
|
+
const key = Buffer.from(accountKey, "base64");
|
|
519
|
+
return crypto.createHmac("sha256", key)
|
|
520
|
+
.update(stringToSign, "utf8")
|
|
521
|
+
.digest("base64");
|
|
522
|
+
}
|
|
523
|
+
|
|
524
524
|
// Copyright (c) Microsoft Corporation.
|
|
525
525
|
/**
|
|
526
526
|
* ONLY AVAILABLE IN NODE.JS RUNTIME.
|
|
@@ -653,12 +653,7 @@ function tableSasPermissionsToString(permissions) {
|
|
|
653
653
|
*
|
|
654
654
|
* Creates an instance of SASQueryParameters.
|
|
655
655
|
*
|
|
656
|
-
*
|
|
657
|
-
* set corresponding properties directly, such as permissions, startsOn and identifier.
|
|
658
|
-
*
|
|
659
|
-
* WARNING: When identifier is not provided, permissions and expiresOn are required.
|
|
660
|
-
* You MUST assign value to identifier or expiresOn & permissions manually if you initial with
|
|
661
|
-
* this constructor.
|
|
656
|
+
* **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.
|
|
662
657
|
*/
|
|
663
658
|
function generateTableSasQueryParameters(tableName, credential, tableSasSignatureValues) {
|
|
664
659
|
var _a, _b, _c, _d, _e, _f;
|
|
@@ -726,16 +721,23 @@ function getCanonicalName(accountName, tableName) {
|
|
|
726
721
|
* @returns The SAS URI consisting of the URI to the resource represented by this client, followed by the generated SAS token.
|
|
727
722
|
*/
|
|
728
723
|
function generateTableSas(tableName, credential, options = {}) {
|
|
729
|
-
|
|
724
|
+
let { expiresOn, permissions } = options;
|
|
730
725
|
if (!coreAuth.isNamedKeyCredential(credential)) {
|
|
731
726
|
throw RangeError("Can only generate the account SAS when the client is initialized with a shared key credential");
|
|
732
727
|
}
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
728
|
+
// expiresOn and permissions are optional if an identifier is provided
|
|
729
|
+
// set defaults when no identifier and no values were provided
|
|
730
|
+
if (!options.identifier) {
|
|
731
|
+
if (!permissions) {
|
|
732
|
+
permissions = tableSasPermissionsFromString("r");
|
|
733
|
+
}
|
|
734
|
+
if (expiresOn === undefined) {
|
|
735
|
+
const now = new Date();
|
|
736
|
+
expiresOn = new Date(now.getTime() + 3600 * 1000);
|
|
737
|
+
}
|
|
737
738
|
}
|
|
738
|
-
const sas = generateTableSasQueryParameters(tableName, credential, Object.assign({
|
|
739
|
+
const sas = generateTableSasQueryParameters(tableName, credential, Object.assign(Object.assign({}, options), { expiresOn,
|
|
740
|
+
permissions })).toString();
|
|
739
741
|
return sas;
|
|
740
742
|
}
|
|
741
743
|
|
|
@@ -3104,6 +3106,16 @@ class GeneratedClient extends GeneratedClientContext {
|
|
|
3104
3106
|
}
|
|
3105
3107
|
}
|
|
3106
3108
|
|
|
3109
|
+
// Copyright (c) Microsoft Corporation.
|
|
3110
|
+
/**
|
|
3111
|
+
* Creates a span using the global tracer.
|
|
3112
|
+
* @internal
|
|
3113
|
+
*/
|
|
3114
|
+
const createSpan = coreTracing.createSpanFunction({
|
|
3115
|
+
packagePrefix: "Azure.Data.Tables",
|
|
3116
|
+
namespace: "Microsoft.Data.Tables"
|
|
3117
|
+
});
|
|
3118
|
+
|
|
3107
3119
|
// Copyright (c) Microsoft Corporation.
|
|
3108
3120
|
/**
|
|
3109
3121
|
* Gets client parameters from an Account Connection String
|
|
@@ -3276,20 +3288,49 @@ function getAccountNameFromUrl(url) {
|
|
|
3276
3288
|
}
|
|
3277
3289
|
|
|
3278
3290
|
// Copyright (c) Microsoft Corporation.
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3291
|
+
function handleTableAlreadyExists(error, options = {}) {
|
|
3292
|
+
var _a, _b, _c;
|
|
3293
|
+
const responseError = getErrorResponse(error);
|
|
3294
|
+
if (responseError &&
|
|
3295
|
+
responseError.status === 409 &&
|
|
3296
|
+
((_a = responseError.parsedBody.odataError) === null || _a === void 0 ? void 0 : _a.code) === "TableAlreadyExists") {
|
|
3297
|
+
(_b = options.logger) === null || _b === void 0 ? void 0 : _b.info(`Table ${options.tableName} already Exists`);
|
|
3298
|
+
if (options.onResponse) {
|
|
3299
|
+
options.onResponse(responseError, {});
|
|
3300
|
+
}
|
|
3301
|
+
}
|
|
3302
|
+
else {
|
|
3303
|
+
options === null || options === void 0 ? void 0 : options.span.setStatus({ code: coreTracing.SpanStatusCode.ERROR, message: (_c = error) === null || _c === void 0 ? void 0 : _c.message });
|
|
3304
|
+
throw error;
|
|
3305
|
+
}
|
|
3306
|
+
}
|
|
3307
|
+
function getErrorResponse(error) {
|
|
3308
|
+
if (!isRestError(error)) {
|
|
3309
|
+
return undefined;
|
|
3310
|
+
}
|
|
3311
|
+
const errorResponse = error.response;
|
|
3312
|
+
if (!errorResponse || !isTableServiceErrorResponse(errorResponse.parsedBody)) {
|
|
3313
|
+
return undefined;
|
|
3314
|
+
}
|
|
3315
|
+
return errorResponse;
|
|
3316
|
+
}
|
|
3317
|
+
function isRestError(error) {
|
|
3318
|
+
return error.name === "RestError";
|
|
3319
|
+
}
|
|
3320
|
+
function isTableServiceErrorResponse(errorResponseBody) {
|
|
3321
|
+
return Boolean(errorResponseBody === null || errorResponseBody === void 0 ? void 0 : errorResponseBody.odataError);
|
|
3322
|
+
}
|
|
3323
|
+
|
|
3324
|
+
// Copyright (c) Microsoft Corporation.
|
|
3325
|
+
function isCredential(credential) {
|
|
3326
|
+
return (coreAuth.isSASCredential(credential) || coreAuth.isNamedKeyCredential(credential) || coreAuth.isTokenCredential(credential));
|
|
3327
|
+
}
|
|
3283
3328
|
|
|
3284
3329
|
// Copyright (c) Microsoft Corporation.
|
|
3285
3330
|
/**
|
|
3286
|
-
*
|
|
3287
|
-
* @internal
|
|
3331
|
+
* The \@azure/logger configuration for this package.
|
|
3288
3332
|
*/
|
|
3289
|
-
const
|
|
3290
|
-
packagePrefix: "Azure.Data.Tables",
|
|
3291
|
-
namespace: "Microsoft.Data.Tables"
|
|
3292
|
-
});
|
|
3333
|
+
const logger = logger$1.createClientLogger("data-tables");
|
|
3293
3334
|
|
|
3294
3335
|
// Copyright (c) Microsoft Corporation.
|
|
3295
3336
|
/**
|
|
@@ -3351,11 +3392,6 @@ function getCanonicalizedResourceString(request, credential) {
|
|
|
3351
3392
|
return canonicalizedResourceString;
|
|
3352
3393
|
}
|
|
3353
3394
|
|
|
3354
|
-
// Copyright (c) Microsoft Corporation.
|
|
3355
|
-
function isCredential(credential) {
|
|
3356
|
-
return (coreAuth.isSASCredential(credential) || coreAuth.isNamedKeyCredential(credential) || coreAuth.isTokenCredential(credential));
|
|
3357
|
-
}
|
|
3358
|
-
|
|
3359
3395
|
// Copyright (c) Microsoft Corporation.
|
|
3360
3396
|
/**
|
|
3361
3397
|
* The programmatic identifier of the tablesSASTokenPolicy.
|
|
@@ -3382,40 +3418,6 @@ function signURLWithSAS(request, credential) {
|
|
|
3382
3418
|
request.url = url.toString();
|
|
3383
3419
|
}
|
|
3384
3420
|
|
|
3385
|
-
// Copyright (c) Microsoft Corporation.
|
|
3386
|
-
function handleTableAlreadyExists(error, options = {}) {
|
|
3387
|
-
var _a, _b, _c;
|
|
3388
|
-
const responseError = getErrorResponse(error);
|
|
3389
|
-
if (responseError &&
|
|
3390
|
-
responseError.status === 409 &&
|
|
3391
|
-
((_a = responseError.parsedBody.odataError) === null || _a === void 0 ? void 0 : _a.code) === "TableAlreadyExists") {
|
|
3392
|
-
(_b = options.logger) === null || _b === void 0 ? void 0 : _b.info(`Table ${options.tableName} already Exists`);
|
|
3393
|
-
if (options.onResponse) {
|
|
3394
|
-
options.onResponse(responseError, {});
|
|
3395
|
-
}
|
|
3396
|
-
}
|
|
3397
|
-
else {
|
|
3398
|
-
options === null || options === void 0 ? void 0 : options.span.setStatus({ code: coreTracing.SpanStatusCode.ERROR, message: (_c = error) === null || _c === void 0 ? void 0 : _c.message });
|
|
3399
|
-
throw error;
|
|
3400
|
-
}
|
|
3401
|
-
}
|
|
3402
|
-
function getErrorResponse(error) {
|
|
3403
|
-
if (!isRestError(error)) {
|
|
3404
|
-
return undefined;
|
|
3405
|
-
}
|
|
3406
|
-
const errorResponse = error.response;
|
|
3407
|
-
if (!errorResponse || !isTableServiceErrorResponse(errorResponse.parsedBody)) {
|
|
3408
|
-
return undefined;
|
|
3409
|
-
}
|
|
3410
|
-
return errorResponse;
|
|
3411
|
-
}
|
|
3412
|
-
function isRestError(error) {
|
|
3413
|
-
return error.name === "RestError";
|
|
3414
|
-
}
|
|
3415
|
-
function isTableServiceErrorResponse(errorResponseBody) {
|
|
3416
|
-
return Boolean(errorResponseBody === null || errorResponseBody === void 0 ? void 0 : errorResponseBody.odataError);
|
|
3417
|
-
}
|
|
3418
|
-
|
|
3419
3421
|
// Copyright (c) Microsoft Corporation.
|
|
3420
3422
|
/**
|
|
3421
3423
|
* A TableServiceClient represents a Client to the Azure Tables service allowing you
|
|
@@ -3645,34 +3647,6 @@ class TableServiceClient {
|
|
|
3645
3647
|
}
|
|
3646
3648
|
}
|
|
3647
3649
|
|
|
3648
|
-
// Copyright (c) Microsoft Corporation.
|
|
3649
|
-
// Licensed under the MIT license.
|
|
3650
|
-
/**
|
|
3651
|
-
* @internal
|
|
3652
|
-
* Builds an object with the required headers for a Transaction request. For both Node and Browser
|
|
3653
|
-
*/
|
|
3654
|
-
function getBaseTransactionHeaders(transactionGuid) {
|
|
3655
|
-
return {
|
|
3656
|
-
accept: "application/json",
|
|
3657
|
-
"x-ms-version": "2019-02-02",
|
|
3658
|
-
DataServiceVersion: "3.0;",
|
|
3659
|
-
MaxDataServiceVersion: "3.0;NetFx",
|
|
3660
|
-
"Content-Type": `multipart/mixed; boundary=batch_${transactionGuid}`
|
|
3661
|
-
};
|
|
3662
|
-
}
|
|
3663
|
-
|
|
3664
|
-
// Copyright (c) Microsoft Corporation.
|
|
3665
|
-
/**
|
|
3666
|
-
* @internal
|
|
3667
|
-
* Builds an object with the required headers for a Transaction request. For Node
|
|
3668
|
-
*/
|
|
3669
|
-
function getTransactionHeaders(transactionGuid) {
|
|
3670
|
-
const baseHeaders = getBaseTransactionHeaders(transactionGuid);
|
|
3671
|
-
return Object.assign(Object.assign({}, baseHeaders), {
|
|
3672
|
-
// The below headers are not supported in the browser as they are flagged as "unsafe headers"
|
|
3673
|
-
"Accept-Charset": "UTF-8", Connection: "Keep-Alive" });
|
|
3674
|
-
}
|
|
3675
|
-
|
|
3676
3650
|
// Copyright (c) Microsoft Corporation.
|
|
3677
3651
|
/**
|
|
3678
3652
|
* Builds a transaction change set boundary to be added to the transaction request body
|
|
@@ -3772,21 +3746,6 @@ function getNextSubrequestBodyPart(request, changesetId) {
|
|
|
3772
3746
|
return subRequest.join(TRANSACTION_HTTP_LINE_ENDING);
|
|
3773
3747
|
}
|
|
3774
3748
|
|
|
3775
|
-
// Copyright (c) Microsoft Corporation.
|
|
3776
|
-
function isCosmosEndpoint(url) {
|
|
3777
|
-
const parsedURL = new url$1.URL(url);
|
|
3778
|
-
if (parsedURL.hostname.indexOf(".table.cosmosdb.") !== -1) {
|
|
3779
|
-
return true;
|
|
3780
|
-
}
|
|
3781
|
-
if (parsedURL.hostname.indexOf(".table.cosmos.") !== -1) {
|
|
3782
|
-
return true;
|
|
3783
|
-
}
|
|
3784
|
-
if (parsedURL.hostname === "localhost" && parsedURL.port !== "10002") {
|
|
3785
|
-
return true;
|
|
3786
|
-
}
|
|
3787
|
-
return false;
|
|
3788
|
-
}
|
|
3789
|
-
|
|
3790
3749
|
// Copyright (c) Microsoft Corporation.
|
|
3791
3750
|
// Licensed under the MIT license.
|
|
3792
3751
|
const cosmosPatchPolicyName = "cosmosPatchPolicy";
|
|
@@ -3803,6 +3762,49 @@ function cosmosPatchPolicy() {
|
|
|
3803
3762
|
};
|
|
3804
3763
|
}
|
|
3805
3764
|
|
|
3765
|
+
// Copyright (c) Microsoft Corporation.
|
|
3766
|
+
// Licensed under the MIT license.
|
|
3767
|
+
/**
|
|
3768
|
+
* @internal
|
|
3769
|
+
* Builds an object with the required headers for a Transaction request. For both Node and Browser
|
|
3770
|
+
*/
|
|
3771
|
+
function getBaseTransactionHeaders(transactionGuid) {
|
|
3772
|
+
return {
|
|
3773
|
+
accept: "application/json",
|
|
3774
|
+
"x-ms-version": "2019-02-02",
|
|
3775
|
+
DataServiceVersion: "3.0;",
|
|
3776
|
+
MaxDataServiceVersion: "3.0;NetFx",
|
|
3777
|
+
"Content-Type": `multipart/mixed; boundary=batch_${transactionGuid}`
|
|
3778
|
+
};
|
|
3779
|
+
}
|
|
3780
|
+
|
|
3781
|
+
// Copyright (c) Microsoft Corporation.
|
|
3782
|
+
/**
|
|
3783
|
+
* @internal
|
|
3784
|
+
* Builds an object with the required headers for a Transaction request. For Node
|
|
3785
|
+
*/
|
|
3786
|
+
function getTransactionHeaders(transactionGuid) {
|
|
3787
|
+
const baseHeaders = getBaseTransactionHeaders(transactionGuid);
|
|
3788
|
+
return Object.assign(Object.assign({}, baseHeaders), {
|
|
3789
|
+
// The below headers are not supported in the browser as they are flagged as "unsafe headers"
|
|
3790
|
+
"Accept-Charset": "UTF-8", Connection: "Keep-Alive" });
|
|
3791
|
+
}
|
|
3792
|
+
|
|
3793
|
+
// Copyright (c) Microsoft Corporation.
|
|
3794
|
+
function isCosmosEndpoint(url) {
|
|
3795
|
+
const parsedURL = new url$1.URL(url);
|
|
3796
|
+
if (parsedURL.hostname.indexOf(".table.cosmosdb.") !== -1) {
|
|
3797
|
+
return true;
|
|
3798
|
+
}
|
|
3799
|
+
if (parsedURL.hostname.indexOf(".table.cosmos.") !== -1) {
|
|
3800
|
+
return true;
|
|
3801
|
+
}
|
|
3802
|
+
if (parsedURL.hostname === "localhost" && parsedURL.port !== "10002") {
|
|
3803
|
+
return true;
|
|
3804
|
+
}
|
|
3805
|
+
return false;
|
|
3806
|
+
}
|
|
3807
|
+
|
|
3806
3808
|
// Copyright (c) Microsoft Corporation.
|
|
3807
3809
|
/**
|
|
3808
3810
|
* Helper to build a list of transaction actions
|
|
@@ -4102,6 +4104,34 @@ function base64Decode(value) {
|
|
|
4102
4104
|
return Buffer.from(value, "base64");
|
|
4103
4105
|
}
|
|
4104
4106
|
|
|
4107
|
+
// Copyright (c) Microsoft Corporation.
|
|
4108
|
+
/**
|
|
4109
|
+
* Encodes the nextPartitionKey and nextRowKey into a single continuation token
|
|
4110
|
+
*/
|
|
4111
|
+
function encodeContinuationToken(nextPartitionKey = "", nextRowKey = "") {
|
|
4112
|
+
if (!nextPartitionKey && !nextRowKey) {
|
|
4113
|
+
return undefined;
|
|
4114
|
+
}
|
|
4115
|
+
const continuationToken = JSON.stringify({
|
|
4116
|
+
nextPartitionKey,
|
|
4117
|
+
nextRowKey
|
|
4118
|
+
});
|
|
4119
|
+
return base64Encode(continuationToken);
|
|
4120
|
+
}
|
|
4121
|
+
/**
|
|
4122
|
+
* Decodes a continuationToken into an object containing a nextPartitionKey and nextRowKey
|
|
4123
|
+
*/
|
|
4124
|
+
function decodeContinuationToken(encodedToken) {
|
|
4125
|
+
const decodedToken = base64Decode(encodedToken);
|
|
4126
|
+
let tokenStr = "";
|
|
4127
|
+
for (const byte of decodedToken) {
|
|
4128
|
+
tokenStr += String.fromCharCode(byte);
|
|
4129
|
+
}
|
|
4130
|
+
const continuationToken = JSON.parse(tokenStr);
|
|
4131
|
+
return continuationToken;
|
|
4132
|
+
}
|
|
4133
|
+
|
|
4134
|
+
// Copyright (c) Microsoft Corporation.
|
|
4105
4135
|
const propertyCaseMap = new Map([
|
|
4106
4136
|
["PartitionKey", "partitionKey"],
|
|
4107
4137
|
["RowKey", "rowKey"],
|
|
@@ -4321,33 +4351,6 @@ class Uuid {
|
|
|
4321
4351
|
}
|
|
4322
4352
|
}
|
|
4323
4353
|
|
|
4324
|
-
// Copyright (c) Microsoft Corporation.
|
|
4325
|
-
/**
|
|
4326
|
-
* Encodes the nextPartitionKey and nextRowKey into a single continuation token
|
|
4327
|
-
*/
|
|
4328
|
-
function encodeContinuationToken(nextPartitionKey = "", nextRowKey = "") {
|
|
4329
|
-
if (!nextPartitionKey && !nextRowKey) {
|
|
4330
|
-
return undefined;
|
|
4331
|
-
}
|
|
4332
|
-
const continuationToken = JSON.stringify({
|
|
4333
|
-
nextPartitionKey,
|
|
4334
|
-
nextRowKey
|
|
4335
|
-
});
|
|
4336
|
-
return base64Encode(continuationToken);
|
|
4337
|
-
}
|
|
4338
|
-
/**
|
|
4339
|
-
* Decodes a continuationToken into an object containing a nextPartitionKey and nextRowKey
|
|
4340
|
-
*/
|
|
4341
|
-
function decodeContinuationToken(encodedToken) {
|
|
4342
|
-
const decodedToken = base64Decode(encodedToken);
|
|
4343
|
-
let tokenStr = "";
|
|
4344
|
-
for (const byte of decodedToken) {
|
|
4345
|
-
tokenStr += String.fromCharCode(byte);
|
|
4346
|
-
}
|
|
4347
|
-
const continuationToken = JSON.parse(tokenStr);
|
|
4348
|
-
return continuationToken;
|
|
4349
|
-
}
|
|
4350
|
-
|
|
4351
4354
|
// Copyright (c) Microsoft Corporation.
|
|
4352
4355
|
// Licensed under the MIT license.
|
|
4353
4356
|
function escapeQuotesIfString(input, previous) {
|