@azure/storage-file-share 12.24.1-alpha.20240807.2 → 12.25.0-beta.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.js +298 -73
- package/dist/index.js.map +1 -1
- package/dist-esm/storage-blob/src/BlobServiceClient.js +27 -1
- package/dist-esm/storage-blob/src/BlobServiceClient.js.map +1 -1
- package/dist-esm/storage-blob/src/Clients.js +19 -1
- package/dist-esm/storage-blob/src/Clients.js.map +1 -1
- package/dist-esm/storage-blob/src/ContainerClient.js +19 -1
- package/dist-esm/storage-blob/src/ContainerClient.js.map +1 -1
- package/dist-esm/storage-blob/src/generated/src/models/parameters.js +1 -1
- package/dist-esm/storage-blob/src/generated/src/models/parameters.js.map +1 -1
- package/dist-esm/storage-blob/src/generated/src/storageClient.js +2 -2
- package/dist-esm/storage-blob/src/generated/src/storageClient.js.map +1 -1
- package/dist-esm/storage-blob/src/index.js +2 -2
- package/dist-esm/storage-blob/src/index.js.map +1 -1
- package/dist-esm/storage-blob/src/sas/AccountSASSignatureValues.js +8 -1
- package/dist-esm/storage-blob/src/sas/AccountSASSignatureValues.js.map +1 -1
- package/dist-esm/storage-blob/src/sas/BlobSASSignatureValues.js +27 -6
- package/dist-esm/storage-blob/src/sas/BlobSASSignatureValues.js.map +1 -1
- package/dist-esm/storage-blob/src/utils/constants.js +2 -2
- package/dist-esm/storage-blob/src/utils/constants.js.map +1 -1
- package/dist-esm/storage-file-share/src/AccountSASSignatureValues.js +8 -1
- package/dist-esm/storage-file-share/src/AccountSASSignatureValues.js.map +1 -1
- package/dist-esm/storage-file-share/src/Clients.js +65 -20
- package/dist-esm/storage-file-share/src/Clients.js.map +1 -1
- package/dist-esm/storage-file-share/src/FileSASSignatureValues.js +8 -1
- package/dist-esm/storage-file-share/src/FileSASSignatureValues.js.map +1 -1
- package/dist-esm/storage-file-share/src/ShareServiceClient.js +31 -5
- package/dist-esm/storage-file-share/src/ShareServiceClient.js.map +1 -1
- package/dist-esm/storage-file-share/src/generated/src/models/index.js.map +1 -1
- package/dist-esm/storage-file-share/src/generated/src/models/mappers.js +50 -0
- package/dist-esm/storage-file-share/src/generated/src/models/mappers.js.map +1 -1
- package/dist-esm/storage-file-share/src/generated/src/models/parameters.js +52 -11
- package/dist-esm/storage-file-share/src/generated/src/models/parameters.js.map +1 -1
- package/dist-esm/storage-file-share/src/generated/src/operations/directory.js +12 -9
- package/dist-esm/storage-file-share/src/generated/src/operations/directory.js.map +1 -1
- package/dist-esm/storage-file-share/src/generated/src/operations/file.js +21 -18
- package/dist-esm/storage-file-share/src/generated/src/operations/file.js.map +1 -1
- package/dist-esm/storage-file-share/src/generated/src/operations/service.js +12 -3
- package/dist-esm/storage-file-share/src/generated/src/operations/service.js.map +1 -1
- package/dist-esm/storage-file-share/src/generated/src/operations/share.js +26 -4
- package/dist-esm/storage-file-share/src/generated/src/operations/share.js.map +1 -1
- package/dist-esm/storage-file-share/src/generated/src/storageClient.js +2 -2
- package/dist-esm/storage-file-share/src/generated/src/storageClient.js.map +1 -1
- package/dist-esm/storage-file-share/src/generatedModels.js.map +1 -1
- package/dist-esm/storage-file-share/src/index.js +2 -2
- package/dist-esm/storage-file-share/src/index.js.map +1 -1
- package/dist-esm/storage-file-share/src/models.js.map +1 -1
- package/dist-esm/storage-file-share/src/utils/constants.js +2 -2
- package/dist-esm/storage-file-share/src/utils/constants.js.map +1 -1
- package/dist-esm/storage-file-share/src/utils/utils.common.js +12 -0
- package/dist-esm/storage-file-share/src/utils/utils.common.js.map +1 -1
- package/package.json +3 -3
- package/types/latest/storage-file-share.d.ts +225 -41
@@ -5,7 +5,7 @@ import { isTokenCredential } from "@azure/core-auth";
|
|
5
5
|
import { isNode } from "@azure/core-util";
|
6
6
|
import { isPipelineLike, newPipeline } from "./Pipeline";
|
7
7
|
import { DEFAULT_MAX_DOWNLOAD_RETRY_REQUESTS, DEFAULT_HIGH_LEVEL_CONCURRENCY, FILE_MAX_SIZE_BYTES, FILE_RANGE_MAX_SIZE_BYTES, URLConstants, FileAttributesPreserve, FileAttributesNone, } from "./utils/constants";
|
8
|
-
import { appendToURLPath, setURLParameter, truncatedISO8061Date, extractConnectionStringParts, getShareNameAndPathFromUrl, appendToURLQuery, httpAuthorizationToString, setURLPath, setURLQueries, EscapePath, ConvertInternalResponseOfListFiles, ConvertInternalResponseOfListHandles, assertResponse, removeEmptyString, } from "./utils/utils.common";
|
8
|
+
import { appendToURLPath, setURLParameter, truncatedISO8061Date, extractConnectionStringParts, getShareNameAndPathFromUrl, appendToURLQuery, httpAuthorizationToString, setURLPath, setURLQueries, EscapePath, ConvertInternalResponseOfListFiles, ConvertInternalResponseOfListHandles, assertResponse, removeEmptyString, asSharePermission, } from "./utils/utils.common";
|
9
9
|
import { Credential } from "../../storage-blob/src/credentials/Credential";
|
10
10
|
import { StorageSharedKeyCredential } from "../../storage-blob/src/credentials/StorageSharedKeyCredential";
|
11
11
|
import { AnonymousCredential } from "../../storage-blob/src/credentials/AnonymousCredential";
|
@@ -19,7 +19,7 @@ import { Batch } from "./utils/Batch";
|
|
19
19
|
import { BufferScheduler } from "./utils/BufferScheduler";
|
20
20
|
import { fsStat, fsCreateReadStream, readStreamToLocalFile, streamToBuffer, } from "./utils/utils.node";
|
21
21
|
import { randomUUID } from "@azure/core-util";
|
22
|
-
import { generateFileSASQueryParameters } from "./FileSASSignatureValues";
|
22
|
+
import { generateFileSASQueryParameters, generateFileSASQueryParametersInternal, } from "./FileSASSignatureValues";
|
23
23
|
/**
|
24
24
|
* A ShareClient represents a URL to the Azure Storage share allowing you to manipulate its directories and files.
|
25
25
|
*/
|
@@ -105,7 +105,7 @@ export class ShareClient extends StorageClient {
|
|
105
105
|
*/
|
106
106
|
async create(options = {}) {
|
107
107
|
return tracingClient.withSpan("ShareClient-create", options, async (updatedOptions) => {
|
108
|
-
return assertResponse(await this.context.create(Object.assign(Object.assign({}, updatedOptions), { enabledProtocols: toShareProtocolsString(updatedOptions.protocols) })));
|
108
|
+
return assertResponse(await this.context.create(Object.assign(Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig), { enabledProtocols: toShareProtocolsString(updatedOptions.protocols) })));
|
109
109
|
});
|
110
110
|
}
|
111
111
|
/**
|
@@ -271,7 +271,7 @@ export class ShareClient extends StorageClient {
|
|
271
271
|
async getProperties(options = {}) {
|
272
272
|
return tracingClient.withSpan("ShareClient-getProperties", options, async (updatedOptions) => {
|
273
273
|
const res = assertResponse(await this.context.getProperties(updatedOptions));
|
274
|
-
return Object.assign(Object.assign({}, res), { protocols: toShareProtocols(res.enabledProtocols) });
|
274
|
+
return Object.assign(Object.assign(Object.assign({}, res), this.shareClientConfig), { protocols: toShareProtocols(res.enabledProtocols) });
|
275
275
|
});
|
276
276
|
}
|
277
277
|
/**
|
@@ -284,7 +284,7 @@ export class ShareClient extends StorageClient {
|
|
284
284
|
*/
|
285
285
|
async delete(options = {}) {
|
286
286
|
return tracingClient.withSpan("ShareClient-delete", options, async (updatedOptions) => {
|
287
|
-
return assertResponse(await this.context.delete(Object.assign({}, updatedOptions)));
|
287
|
+
return assertResponse(await this.context.delete(Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig)));
|
288
288
|
});
|
289
289
|
}
|
290
290
|
/**
|
@@ -322,7 +322,7 @@ export class ShareClient extends StorageClient {
|
|
322
322
|
*/
|
323
323
|
async setMetadata(metadata, options = {}) {
|
324
324
|
return tracingClient.withSpan("ShareClient-setMetadata", options, async (updatedOptions) => {
|
325
|
-
return assertResponse(await this.context.setMetadata(Object.assign(Object.assign({}, updatedOptions), { metadata })));
|
325
|
+
return assertResponse(await this.context.setMetadata(Object.assign(Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig), { metadata })));
|
326
326
|
});
|
327
327
|
}
|
328
328
|
/**
|
@@ -339,7 +339,7 @@ export class ShareClient extends StorageClient {
|
|
339
339
|
*/
|
340
340
|
async getAccessPolicy(options = {}) {
|
341
341
|
return tracingClient.withSpan("ShareClient-getAccessPolicy", options, async (updatedOptions) => {
|
342
|
-
const response = assertResponse(await this.context.getAccessPolicy(Object.assign({}, updatedOptions)));
|
342
|
+
const response = assertResponse(await this.context.getAccessPolicy(Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig)));
|
343
343
|
const res = {
|
344
344
|
_response: response._response,
|
345
345
|
date: response.date,
|
@@ -405,7 +405,7 @@ export class ShareClient extends StorageClient {
|
|
405
405
|
id: identifier.id,
|
406
406
|
});
|
407
407
|
}
|
408
|
-
return assertResponse(await this.context.setAccessPolicy(Object.assign(Object.assign({}, updatedOptions), { shareAcl: acl })));
|
408
|
+
return assertResponse(await this.context.setAccessPolicy(Object.assign(Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig), { shareAcl: acl })));
|
409
409
|
});
|
410
410
|
}
|
411
411
|
/**
|
@@ -416,7 +416,7 @@ export class ShareClient extends StorageClient {
|
|
416
416
|
*/
|
417
417
|
async createSnapshot(options = {}) {
|
418
418
|
return tracingClient.withSpan("ShareClient-createSnapshot", options, async (updatedOptions) => {
|
419
|
-
return assertResponse(await this.context.createSnapshot(updatedOptions));
|
419
|
+
return assertResponse(await this.context.createSnapshot(Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig)));
|
420
420
|
});
|
421
421
|
}
|
422
422
|
/**
|
@@ -430,7 +430,7 @@ export class ShareClient extends StorageClient {
|
|
430
430
|
*/
|
431
431
|
async setQuota(quotaInGB, options = {}) {
|
432
432
|
return tracingClient.withSpan("ShareClient-setQuota", options, async (updatedOptions) => {
|
433
|
-
return assertResponse(await this.context.setProperties(Object.assign(Object.assign({}, updatedOptions), { quota: quotaInGB })));
|
433
|
+
return assertResponse(await this.context.setProperties(Object.assign(Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig), { quota: quotaInGB })));
|
434
434
|
});
|
435
435
|
}
|
436
436
|
/**
|
@@ -441,7 +441,7 @@ export class ShareClient extends StorageClient {
|
|
441
441
|
*/
|
442
442
|
async setProperties(options = {}) {
|
443
443
|
return tracingClient.withSpan("ShareClient-setProperties", options, async (updatedOptions) => {
|
444
|
-
return assertResponse(await this.context.setProperties(Object.assign(Object.assign({}, options), { quota: options.quotaInGB, tracingOptions: updatedOptions.tracingOptions })));
|
444
|
+
return assertResponse(await this.context.setProperties(Object.assign(Object.assign(Object.assign({}, options), this.shareClientConfig), { quota: options.quotaInGB, tracingOptions: updatedOptions.tracingOptions })));
|
445
445
|
});
|
446
446
|
}
|
447
447
|
/**
|
@@ -452,7 +452,7 @@ export class ShareClient extends StorageClient {
|
|
452
452
|
*/
|
453
453
|
async getStatistics(options = {}) {
|
454
454
|
return tracingClient.withSpan("ShareClient-getStatistics", options, async (updatedOptions) => {
|
455
|
-
const response = assertResponse(await this.context.getStatistics(updatedOptions));
|
455
|
+
const response = assertResponse(await this.context.getStatistics(Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig)));
|
456
456
|
const GBBytes = 1024 * 1024 * 1024;
|
457
457
|
return Object.assign(Object.assign({}, response), { shareUsage: Math.ceil(response.shareUsageBytes / GBBytes) });
|
458
458
|
});
|
@@ -467,9 +467,7 @@ export class ShareClient extends StorageClient {
|
|
467
467
|
*/
|
468
468
|
async createPermission(filePermission, options = {}) {
|
469
469
|
return tracingClient.withSpan("ShareClient-createPermission", options, async (updatedOptions) => {
|
470
|
-
return assertResponse(await this.context.createPermission({
|
471
|
-
permission: filePermission,
|
472
|
-
}, Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig)));
|
470
|
+
return assertResponse(await this.context.createPermission(asSharePermission(filePermission), Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig)));
|
473
471
|
});
|
474
472
|
}
|
475
473
|
/**
|
@@ -485,6 +483,15 @@ export class ShareClient extends StorageClient {
|
|
485
483
|
return assertResponse(await this.context.getPermission(filePermissionKey, Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig)));
|
486
484
|
});
|
487
485
|
}
|
486
|
+
/**
|
487
|
+
* Get a {@link ShareLeaseClient} that manages leases on the file.
|
488
|
+
*
|
489
|
+
* @param proposeLeaseId - Initial proposed lease Id.
|
490
|
+
* @returns A new ShareLeaseClient object for managing leases on the file.
|
491
|
+
*/
|
492
|
+
getShareLeaseClient(proposeLeaseId) {
|
493
|
+
return new ShareLeaseClient(this, proposeLeaseId);
|
494
|
+
}
|
488
495
|
/**
|
489
496
|
* Only available for ShareClient constructed with a shared key credential.
|
490
497
|
*
|
@@ -503,6 +510,24 @@ export class ShareClient extends StorageClient {
|
|
503
510
|
const sas = generateFileSASQueryParameters(Object.assign({ shareName: this.name }, options), this.credential).toString();
|
504
511
|
return appendToURLQuery(this.url, sas);
|
505
512
|
}
|
513
|
+
/**
|
514
|
+
* Only available for ShareClient constructed with a shared key credential.
|
515
|
+
*
|
516
|
+
* Generates string to sign for a Service Shared Access Signature (SAS) URI based on the client properties
|
517
|
+
* and parameters passed in. The SAS is signed by the shared key credential of the client.
|
518
|
+
*
|
519
|
+
* @see https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas
|
520
|
+
*
|
521
|
+
* @param options - Optional parameters.
|
522
|
+
* @returns The SAS URI consisting of the URI to the resource represented by this client, followed by the generated SAS token.
|
523
|
+
*/
|
524
|
+
/* eslint-disable-next-line @azure/azure-sdk/ts-naming-options*/
|
525
|
+
generateSasStringToSign(options) {
|
526
|
+
if (!(this.credential instanceof StorageSharedKeyCredential)) {
|
527
|
+
throw RangeError("Can only generate the SAS when the client is initialized with a shared key credential");
|
528
|
+
}
|
529
|
+
return generateFileSASQueryParametersInternal(Object.assign({ shareName: this.name }, options), this.credential).stringToSign;
|
530
|
+
}
|
506
531
|
}
|
507
532
|
/**
|
508
533
|
* A ShareDirectoryClient represents a URL to the Azure Storage directory allowing you to manipulate its files and directories.
|
@@ -2349,6 +2374,24 @@ export class ShareFileClient extends StorageClient {
|
|
2349
2374
|
const sas = generateFileSASQueryParameters(Object.assign({ shareName: this.shareName, filePath: this.path }, options), this.credential).toString();
|
2350
2375
|
return appendToURLQuery(this.url, sas);
|
2351
2376
|
}
|
2377
|
+
/**
|
2378
|
+
* Only available for clients constructed with a shared key credential.
|
2379
|
+
*
|
2380
|
+
* Generates string to sign for a Service Shared Access Signature (SAS) URI based on the client properties
|
2381
|
+
* and parameters passed in. The SAS is signed by the shared key credential of the client.
|
2382
|
+
*
|
2383
|
+
* @see https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas
|
2384
|
+
*
|
2385
|
+
* @param options - Optional parameters.
|
2386
|
+
* @returns The SAS URI consisting of the URI to the resource represented by this client, followed by the generated SAS token.
|
2387
|
+
*/
|
2388
|
+
/* eslint-disable-next-line @azure/azure-sdk/ts-naming-options*/
|
2389
|
+
generateSasStringToSign(options) {
|
2390
|
+
if (!(this.credential instanceof StorageSharedKeyCredential)) {
|
2391
|
+
throw RangeError("Can only generate the SAS when the client is initialized with a shared key credential");
|
2392
|
+
}
|
2393
|
+
return generateFileSASQueryParametersInternal(Object.assign({ shareName: this.shareName, filePath: this.path }, options), this.credential).stringToSign;
|
2394
|
+
}
|
2352
2395
|
/**
|
2353
2396
|
* Renames a file.
|
2354
2397
|
* This API only supports renaming a file in the same share.
|
@@ -2437,9 +2480,11 @@ export class ShareLeaseClient {
|
|
2437
2480
|
const clientContext = client["storageClientContext"];
|
2438
2481
|
if (client instanceof ShareClient) {
|
2439
2482
|
this.fileOrShare = clientContext.share;
|
2483
|
+
this.shareClientConfig = client["shareClientConfig"];
|
2440
2484
|
}
|
2441
2485
|
else {
|
2442
2486
|
this.fileOrShare = clientContext.file;
|
2487
|
+
this.shareClientConfig = client["shareClientConfig"];
|
2443
2488
|
}
|
2444
2489
|
this._url = client.url;
|
2445
2490
|
if (!leaseId) {
|
@@ -2456,7 +2501,7 @@ export class ShareLeaseClient {
|
|
2456
2501
|
*/
|
2457
2502
|
async acquireLease(duration = -1, options = {}) {
|
2458
2503
|
return tracingClient.withSpan("ShareLeaseClient-acquireLease", options, async (updatedOptions) => {
|
2459
|
-
return assertResponse(await this.fileOrShare.acquireLease(Object.assign(Object.assign({}, updatedOptions), { duration, proposedLeaseId: this._leaseId })));
|
2504
|
+
return assertResponse(await this.fileOrShare.acquireLease(Object.assign(Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig), { duration, proposedLeaseId: this._leaseId })));
|
2460
2505
|
});
|
2461
2506
|
}
|
2462
2507
|
/**
|
@@ -2468,7 +2513,7 @@ export class ShareLeaseClient {
|
|
2468
2513
|
*/
|
2469
2514
|
async changeLease(proposedLeaseId, options = {}) {
|
2470
2515
|
return tracingClient.withSpan("ShareLeaseClient-changeLease", options, async (updatedOptions) => {
|
2471
|
-
const response = assertResponse(await this.fileOrShare.changeLease(this._leaseId, Object.assign(Object.assign({}, updatedOptions), { proposedLeaseId })));
|
2516
|
+
const response = assertResponse(await this.fileOrShare.changeLease(this._leaseId, Object.assign(Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig), { proposedLeaseId })));
|
2472
2517
|
this._leaseId = proposedLeaseId;
|
2473
2518
|
return response;
|
2474
2519
|
});
|
@@ -2482,7 +2527,7 @@ export class ShareLeaseClient {
|
|
2482
2527
|
*/
|
2483
2528
|
async releaseLease(options = {}) {
|
2484
2529
|
return tracingClient.withSpan("ShareLeaseClient-releaseLease", options, async (updatedOptions) => {
|
2485
|
-
return assertResponse(await this.fileOrShare.releaseLease(this._leaseId, updatedOptions));
|
2530
|
+
return assertResponse(await this.fileOrShare.releaseLease(this._leaseId, Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig)));
|
2486
2531
|
});
|
2487
2532
|
}
|
2488
2533
|
/**
|
@@ -2493,7 +2538,7 @@ export class ShareLeaseClient {
|
|
2493
2538
|
*/
|
2494
2539
|
async breakLease(options = {}) {
|
2495
2540
|
return tracingClient.withSpan("ShareLeaseClient-breakLease", options, async (updatedOptions) => {
|
2496
|
-
return assertResponse(await this.fileOrShare.breakLease(updatedOptions));
|
2541
|
+
return assertResponse(await this.fileOrShare.breakLease(Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig)));
|
2497
2542
|
});
|
2498
2543
|
}
|
2499
2544
|
/**
|
@@ -2509,7 +2554,7 @@ export class ShareLeaseClient {
|
|
2509
2554
|
if (isFile(this.fileOrShare)) {
|
2510
2555
|
throw new RangeError("The renewLease operation is not available for lease on file.");
|
2511
2556
|
}
|
2512
|
-
return assertResponse(await this.fileOrShare.renewLease(this._leaseId, updatedOptions));
|
2557
|
+
return assertResponse(await this.fileOrShare.renewLease(this._leaseId, Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig)));
|
2513
2558
|
});
|
2514
2559
|
}
|
2515
2560
|
}
|