@azure/storage-file-share 12.20.0-alpha.20230720.6 → 12.20.0-alpha.20230721.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/dist/index.js +185 -74
- package/dist/index.js.map +1 -1
- package/dist-esm/storage-file-share/src/Clients.js +58 -51
- package/dist-esm/storage-file-share/src/Clients.js.map +1 -1
- package/dist-esm/storage-file-share/src/ShareServiceClient.js +7 -4
- package/dist-esm/storage-file-share/src/ShareServiceClient.js.map +1 -1
- package/dist-esm/storage-file-share/src/StorageClient.js +0 -4
- package/dist-esm/storage-file-share/src/StorageClient.js.map +1 -1
- package/dist-esm/storage-file-share/src/generated/src/models/index.js +6 -0
- 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/parameters.js +31 -1
- 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 +29 -4
- 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 +49 -8
- 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/share.js +3 -1
- 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 +1 -1
- package/dist-esm/storage-file-share/src/generated/src/storageClient.js.map +1 -1
- package/dist-esm/storage-file-share/src/generatedModels.js +5 -1
- package/dist-esm/storage-file-share/src/generatedModels.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 +1 -1
- package/dist-esm/storage-file-share/src/utils/constants.js.map +1 -1
- package/package.json +2 -1
- package/types/3.1/storage-file-share.d.ts +166 -12
- package/types/latest/storage-file-share.d.ts +170 -12
@@ -1,8 +1,9 @@
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
2
2
|
// Licensed under the MIT license.
|
3
3
|
import { __asyncGenerator, __asyncValues, __await } from "tslib";
|
4
|
+
import { isTokenCredential } from "@azure/core-auth";
|
4
5
|
import { isNode } from "@azure/core-util";
|
5
|
-
import { newPipeline, Pipeline
|
6
|
+
import { newPipeline, Pipeline } from "../../storage-blob/src/Pipeline";
|
6
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";
|
7
8
|
import { appendToURLPath, setURLParameter, truncatedISO8061Date, extractConnectionStringParts, getShareNameAndPathFromUrl, appendToURLQuery, httpAuthorizationToString, setURLPath, setURLQueries, EscapePath, ConvertInternalResponseOfListFiles, ConvertInternalResponseOfListHandles, assertResponse, } from "./utils/utils.common";
|
8
9
|
import { Credential } from "../../storage-blob/src/credentials/Credential";
|
@@ -41,21 +42,22 @@ export class ShareClient extends StorageClient {
|
|
41
42
|
url = urlOrConnectionString;
|
42
43
|
pipeline = credentialOrPipelineOrShareName;
|
43
44
|
}
|
44
|
-
else if (credentialOrPipelineOrShareName instanceof Credential
|
45
|
-
|
45
|
+
else if (credentialOrPipelineOrShareName instanceof Credential ||
|
46
|
+
isTokenCredential(credentialOrPipelineOrShareName)) {
|
47
|
+
// (url: string, credential?: Credential, options?: ShareClientOptions)
|
46
48
|
url = urlOrConnectionString;
|
47
49
|
pipeline = newPipeline(credentialOrPipelineOrShareName, options);
|
48
50
|
}
|
49
51
|
else if (!credentialOrPipelineOrShareName &&
|
50
52
|
typeof credentialOrPipelineOrShareName !== "string") {
|
51
|
-
// (url: string, credential?: Credential, options?:
|
53
|
+
// (url: string, credential?: Credential, options?: ShareClientOptions)
|
52
54
|
// The second parameter is undefined. Use anonymous credential.
|
53
55
|
url = urlOrConnectionString;
|
54
56
|
pipeline = newPipeline(new AnonymousCredential(), options);
|
55
57
|
}
|
56
58
|
else if (credentialOrPipelineOrShareName &&
|
57
59
|
typeof credentialOrPipelineOrShareName === "string") {
|
58
|
-
// (connectionString: string, name: string, options?:
|
60
|
+
// (connectionString: string, name: string, options?: ShareClientOptions)
|
59
61
|
const extractedCreds = extractConnectionStringParts(urlOrConnectionString);
|
60
62
|
const name = credentialOrPipelineOrShareName;
|
61
63
|
if (extractedCreds.kind === "AccountConnString") {
|
@@ -81,6 +83,7 @@ export class ShareClient extends StorageClient {
|
|
81
83
|
}
|
82
84
|
super(url, pipeline);
|
83
85
|
this._name = getShareNameAndPathFromUrl(this.url).shareName;
|
86
|
+
this.shareClientConfig = options;
|
84
87
|
this.context = this.storageClientContext.share;
|
85
88
|
}
|
86
89
|
/**
|
@@ -91,7 +94,7 @@ export class ShareClient extends StorageClient {
|
|
91
94
|
* @returns A new ShareClient object identical to the source but with the specified snapshot timestamp
|
92
95
|
*/
|
93
96
|
withSnapshot(snapshot) {
|
94
|
-
return new ShareClient(setURLParameter(this.url, URLConstants.Parameters.SHARE_SNAPSHOT, snapshot.length === 0 ? undefined : snapshot), this.pipeline);
|
97
|
+
return new ShareClient(setURLParameter(this.url, URLConstants.Parameters.SHARE_SNAPSHOT, snapshot.length === 0 ? undefined : snapshot), this.pipeline, this.shareClientConfig);
|
95
98
|
}
|
96
99
|
/**
|
97
100
|
* Creates a new share under the specified account. If the share with
|
@@ -137,7 +140,7 @@ export class ShareClient extends StorageClient {
|
|
137
140
|
// Legacy, no way to fix the eslint error without breaking. Disable the rule for this line.
|
138
141
|
/* eslint-disable-next-line @azure/azure-sdk/ts-naming-subclients */
|
139
142
|
getDirectoryClient(directoryName) {
|
140
|
-
return new ShareDirectoryClient(appendToURLPath(this.url, EscapePath(directoryName)), this.pipeline);
|
143
|
+
return new ShareDirectoryClient(appendToURLPath(this.url, EscapePath(directoryName)), this.pipeline, this.shareClientConfig);
|
141
144
|
}
|
142
145
|
/**
|
143
146
|
* Gets the directory client for the root directory of this share.
|
@@ -467,7 +470,7 @@ export class ShareClient extends StorageClient {
|
|
467
470
|
return tracingClient.withSpan("ShareClient-createPermission", options, async (updatedOptions) => {
|
468
471
|
return assertResponse(await this.context.createPermission({
|
469
472
|
permission: filePermission,
|
470
|
-
}, updatedOptions));
|
473
|
+
}, Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig)));
|
471
474
|
});
|
472
475
|
}
|
473
476
|
/**
|
@@ -480,7 +483,7 @@ export class ShareClient extends StorageClient {
|
|
480
483
|
*/
|
481
484
|
async getPermission(filePermissionKey, options = {}) {
|
482
485
|
return tracingClient.withSpan("ShareClient-getPermission", options, async (updatedOptions) => {
|
483
|
-
return assertResponse(await this.context.getPermission(filePermissionKey, updatedOptions));
|
486
|
+
return assertResponse(await this.context.getPermission(filePermissionKey, Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig)));
|
484
487
|
});
|
485
488
|
}
|
486
489
|
/**
|
@@ -532,7 +535,8 @@ export class ShareDirectoryClient extends StorageClient {
|
|
532
535
|
if (credentialOrPipeline instanceof Pipeline) {
|
533
536
|
pipeline = credentialOrPipeline;
|
534
537
|
}
|
535
|
-
else if (credentialOrPipeline instanceof Credential
|
538
|
+
else if (credentialOrPipeline instanceof Credential ||
|
539
|
+
isTokenCredential(credentialOrPipeline)) {
|
536
540
|
pipeline = newPipeline(credentialOrPipeline, options);
|
537
541
|
}
|
538
542
|
else {
|
@@ -545,6 +549,7 @@ export class ShareDirectoryClient extends StorageClient {
|
|
545
549
|
shareName: this._shareName,
|
546
550
|
path: this._path,
|
547
551
|
} = getShareNameAndPathFromUrl(this.url));
|
552
|
+
this.shareClientConfig = options;
|
548
553
|
this.context = this.storageClientContext.directory;
|
549
554
|
}
|
550
555
|
/**
|
@@ -565,7 +570,7 @@ export class ShareDirectoryClient extends StorageClient {
|
|
565
570
|
return tracingClient.withSpan("ShareDirectoryClient-create", options, async (updatedOptions) => {
|
566
571
|
return assertResponse(await this.context.create(updatedOptions.fileAttributes
|
567
572
|
? fileAttributesToString(updatedOptions.fileAttributes)
|
568
|
-
: FileAttributesNone, Object.assign(Object.assign({}, updatedOptions), { fileChangeOn: fileChangeTimeToString(updatedOptions.changeTime), fileCreatedOn: fileCreationTimeToString(updatedOptions.creationTime), fileLastWriteOn: fileLastWriteTimeToString(updatedOptions.lastWriteTime) })));
|
573
|
+
: FileAttributesNone, Object.assign(Object.assign(Object.assign({}, updatedOptions), { fileChangeOn: fileChangeTimeToString(updatedOptions.changeTime), fileCreatedOn: fileCreationTimeToString(updatedOptions.creationTime), fileLastWriteOn: fileLastWriteTimeToString(updatedOptions.lastWriteTime) }), this.shareClientConfig)));
|
569
574
|
});
|
570
575
|
}
|
571
576
|
/**
|
@@ -602,7 +607,7 @@ export class ShareDirectoryClient extends StorageClient {
|
|
602
607
|
return tracingClient.withSpan("ShareDirectoryClient-setProperties", properties, async (updatedOptions) => {
|
603
608
|
return assertResponse(await this.context.setProperties(updatedOptions.fileAttributes
|
604
609
|
? fileAttributesToString(updatedOptions.fileAttributes)
|
605
|
-
: FileAttributesPreserve, Object.assign(Object.assign({}, updatedOptions), { fileChangeOn: fileChangeTimeToString(updatedOptions.changeTime), fileCreatedOn: fileCreationTimeToString(updatedOptions.creationTime), fileLastWriteOn: fileLastWriteTimeToString(updatedOptions.lastWriteTime) })));
|
610
|
+
: FileAttributesPreserve, Object.assign(Object.assign(Object.assign({}, updatedOptions), { fileChangeOn: fileChangeTimeToString(updatedOptions.changeTime), fileCreatedOn: fileCreationTimeToString(updatedOptions.creationTime), fileLastWriteOn: fileLastWriteTimeToString(updatedOptions.lastWriteTime) }), this.shareClientConfig)));
|
606
611
|
});
|
607
612
|
}
|
608
613
|
/**
|
@@ -620,7 +625,7 @@ export class ShareDirectoryClient extends StorageClient {
|
|
620
625
|
* ```
|
621
626
|
*/
|
622
627
|
getDirectoryClient(subDirectoryName) {
|
623
|
-
return new ShareDirectoryClient(appendToURLPath(this.url, EscapePath(subDirectoryName)), this.pipeline);
|
628
|
+
return new ShareDirectoryClient(appendToURLPath(this.url, EscapePath(subDirectoryName)), this.pipeline, this.shareClientConfig);
|
624
629
|
}
|
625
630
|
/**
|
626
631
|
* Creates a new subdirectory under this directory.
|
@@ -721,7 +726,7 @@ export class ShareDirectoryClient extends StorageClient {
|
|
721
726
|
// Legacy, no way to fix the eslint error without breaking. Disable the rule for this line.
|
722
727
|
/* eslint-disable-next-line @azure/azure-sdk/ts-naming-subclients */
|
723
728
|
getFileClient(fileName) {
|
724
|
-
return new ShareFileClient(appendToURLPath(this.url, EscapePath(fileName)), this.pipeline);
|
729
|
+
return new ShareFileClient(appendToURLPath(this.url, EscapePath(fileName)), this.pipeline, this.shareClientConfig);
|
725
730
|
}
|
726
731
|
/**
|
727
732
|
* Returns true if the specified directory exists; false otherwise.
|
@@ -735,7 +740,7 @@ export class ShareDirectoryClient extends StorageClient {
|
|
735
740
|
async exists(options = {}) {
|
736
741
|
return tracingClient.withSpan("ShareDirectoryClient-exists", options, async (updatedOptions) => {
|
737
742
|
try {
|
738
|
-
await this.getProperties(updatedOptions);
|
743
|
+
await this.getProperties(Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig));
|
739
744
|
return true;
|
740
745
|
}
|
741
746
|
catch (e) {
|
@@ -757,7 +762,7 @@ export class ShareDirectoryClient extends StorageClient {
|
|
757
762
|
*/
|
758
763
|
async getProperties(options = {}) {
|
759
764
|
return tracingClient.withSpan("ShareDirectoryClient-getProperties", options, async (updatedOptions) => {
|
760
|
-
return assertResponse(await this.context.getProperties(updatedOptions));
|
765
|
+
return assertResponse(await this.context.getProperties(Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig)));
|
761
766
|
});
|
762
767
|
}
|
763
768
|
/**
|
@@ -770,7 +775,7 @@ export class ShareDirectoryClient extends StorageClient {
|
|
770
775
|
*/
|
771
776
|
async delete(options = {}) {
|
772
777
|
return tracingClient.withSpan("ShareDirectoryClient-delete", options, async (updatedOptions) => {
|
773
|
-
return assertResponse(await this.context.delete(updatedOptions));
|
778
|
+
return assertResponse(await this.context.delete(Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig)));
|
774
779
|
});
|
775
780
|
}
|
776
781
|
/**
|
@@ -806,7 +811,7 @@ export class ShareDirectoryClient extends StorageClient {
|
|
806
811
|
*/
|
807
812
|
async setMetadata(metadata, options = {}) {
|
808
813
|
return tracingClient.withSpan("ShareDirectoryClient-setMetadata", options, async (updatedOptions) => {
|
809
|
-
return assertResponse(await this.context.setMetadata(Object.assign(Object.assign({}, updatedOptions), { metadata })));
|
814
|
+
return assertResponse(await this.context.setMetadata(Object.assign(Object.assign(Object.assign({}, updatedOptions), { metadata }), this.shareClientConfig)));
|
810
815
|
});
|
811
816
|
}
|
812
817
|
/**
|
@@ -1018,7 +1023,7 @@ export class ShareDirectoryClient extends StorageClient {
|
|
1018
1023
|
options.prefix = undefined;
|
1019
1024
|
}
|
1020
1025
|
return tracingClient.withSpan("ShareDirectoryClient-listFilesAndDirectoriesSegment", options, async (updatedOptions) => {
|
1021
|
-
const rawResponse = assertResponse(await this.context.listFilesAndDirectoriesSegment(Object.assign(Object.assign({}, updatedOptions), { marker })));
|
1026
|
+
const rawResponse = assertResponse(await this.context.listFilesAndDirectoriesSegment(Object.assign(Object.assign(Object.assign({}, updatedOptions), { marker }), this.shareClientConfig)));
|
1022
1027
|
const wrappedResponse = Object.assign(Object.assign({}, ConvertInternalResponseOfListFiles(rawResponse)), { _response: Object.assign(Object.assign({}, rawResponse._response), { parsedBody: ConvertInternalResponseOfListFiles(rawResponse._response.parsedBody) }) });
|
1023
1028
|
return wrappedResponse;
|
1024
1029
|
});
|
@@ -1194,7 +1199,7 @@ export class ShareDirectoryClient extends StorageClient {
|
|
1194
1199
|
async listHandlesSegment(marker, options = {}) {
|
1195
1200
|
return tracingClient.withSpan("ShareDirectoryClient-listHandlesSegment", options, async (updatedOptions) => {
|
1196
1201
|
marker = marker === "" ? undefined : marker;
|
1197
|
-
const response = assertResponse(await this.context.listHandles(Object.assign(Object.assign({}, updatedOptions), { marker })));
|
1202
|
+
const response = assertResponse(await this.context.listHandles(Object.assign(Object.assign(Object.assign({}, updatedOptions), { marker }), this.shareClientConfig)));
|
1198
1203
|
// TODO: Protocol layer issue that when handle list is in returned XML
|
1199
1204
|
// response.handleList is an empty string
|
1200
1205
|
if (response.handleList === "") {
|
@@ -1221,7 +1226,7 @@ export class ShareDirectoryClient extends StorageClient {
|
|
1221
1226
|
if (marker === "") {
|
1222
1227
|
marker = undefined;
|
1223
1228
|
}
|
1224
|
-
const rawResponse = assertResponse(await this.context.forceCloseHandles("*", Object.assign(Object.assign({}, updatedOptions), { marker })));
|
1229
|
+
const rawResponse = assertResponse(await this.context.forceCloseHandles("*", Object.assign(Object.assign(Object.assign({}, updatedOptions), { marker }), this.shareClientConfig)));
|
1225
1230
|
return Object.assign(Object.assign({}, rawResponse), { closedHandlesCount: (_a = rawResponse.numberOfHandlesClosed) !== null && _a !== void 0 ? _a : 0, closeFailureCount: (_b = rawResponse.numberOfHandlesFailedToClose) !== null && _b !== void 0 ? _b : 0 });
|
1226
1231
|
});
|
1227
1232
|
}
|
@@ -1267,7 +1272,7 @@ export class ShareDirectoryClient extends StorageClient {
|
|
1267
1272
|
if (handleId === "*") {
|
1268
1273
|
throw new RangeError(`Parameter handleID should be a specified handle ID. Use forceCloseHandlesSegment() to close all handles.`);
|
1269
1274
|
}
|
1270
|
-
const rawResponse = await this.context.forceCloseHandles(handleId, updatedOptions);
|
1275
|
+
const rawResponse = await this.context.forceCloseHandles(handleId, Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig));
|
1271
1276
|
const response = rawResponse;
|
1272
1277
|
response.closedHandlesCount = rawResponse.numberOfHandlesClosed || 0;
|
1273
1278
|
response.closeFailureCount = rawResponse.numberOfHandlesFailedToClose || 0;
|
@@ -1308,9 +1313,9 @@ export class ShareDirectoryClient extends StorageClient {
|
|
1308
1313
|
else {
|
1309
1314
|
throw new RangeError("Destination path should not contain more than one query string");
|
1310
1315
|
}
|
1311
|
-
const destDirectory = new ShareDirectoryClient(destinationUrl, this.pipeline);
|
1316
|
+
const destDirectory = new ShareDirectoryClient(destinationUrl, this.pipeline, this.shareClientConfig);
|
1312
1317
|
return tracingClient.withSpan("ShareDirectoryClient-rename", options, async (updatedOptions) => {
|
1313
|
-
const response = assertResponse(await destDirectory.context.rename(this.url, Object.assign(Object.assign({}, updatedOptions), { sourceLeaseAccessConditions: updatedOptions.sourceLeaseAccessConditions
|
1318
|
+
const response = assertResponse(await destDirectory.context.rename(this.url, Object.assign(Object.assign(Object.assign({}, updatedOptions), { sourceLeaseAccessConditions: updatedOptions.sourceLeaseAccessConditions
|
1314
1319
|
? {
|
1315
1320
|
sourceLeaseId: updatedOptions.sourceLeaseAccessConditions.leaseId,
|
1316
1321
|
}
|
@@ -1318,7 +1323,7 @@ export class ShareDirectoryClient extends StorageClient {
|
|
1318
1323
|
? {
|
1319
1324
|
destinationLeaseId: updatedOptions.destinationLeaseAccessConditions.leaseId,
|
1320
1325
|
}
|
1321
|
-
: undefined })));
|
1326
|
+
: undefined }), this.shareClientConfig)));
|
1322
1327
|
return {
|
1323
1328
|
destinationDirectoryClient: destDirectory,
|
1324
1329
|
directoryRenameResponse: response,
|
@@ -1356,7 +1361,8 @@ export class ShareFileClient extends StorageClient {
|
|
1356
1361
|
if (credentialOrPipeline instanceof Pipeline) {
|
1357
1362
|
pipeline = credentialOrPipeline;
|
1358
1363
|
}
|
1359
|
-
else if (credentialOrPipeline instanceof Credential
|
1364
|
+
else if (credentialOrPipeline instanceof Credential ||
|
1365
|
+
isTokenCredential(credentialOrPipeline)) {
|
1360
1366
|
pipeline = newPipeline(credentialOrPipeline, options);
|
1361
1367
|
}
|
1362
1368
|
else {
|
@@ -1369,6 +1375,7 @@ export class ShareFileClient extends StorageClient {
|
|
1369
1375
|
shareName: this._shareName,
|
1370
1376
|
path: this._path,
|
1371
1377
|
} = getShareNameAndPathFromUrl(this.url));
|
1378
|
+
this.shareClientConfig = options;
|
1372
1379
|
this.context = this.storageClientContext.file;
|
1373
1380
|
}
|
1374
1381
|
/**
|
@@ -1379,7 +1386,7 @@ export class ShareFileClient extends StorageClient {
|
|
1379
1386
|
* @returns A new ShareFileClient object identical to the source but with the specified share snapshot timestamp.
|
1380
1387
|
*/
|
1381
1388
|
withShareSnapshot(shareSnapshot) {
|
1382
|
-
return new ShareFileClient(setURLParameter(this.url, URLConstants.Parameters.SHARE_SNAPSHOT, shareSnapshot.length === 0 ? undefined : shareSnapshot), this.pipeline);
|
1389
|
+
return new ShareFileClient(setURLParameter(this.url, URLConstants.Parameters.SHARE_SNAPSHOT, shareSnapshot.length === 0 ? undefined : shareSnapshot), this.pipeline, this.shareClientConfig);
|
1383
1390
|
}
|
1384
1391
|
/**
|
1385
1392
|
* Creates a new file or replaces a file. Note it only initializes the file with no content.
|
@@ -1412,7 +1419,7 @@ export class ShareFileClient extends StorageClient {
|
|
1412
1419
|
return tracingClient.withSpan("ShareFileClient-create", options, async (updatedOptions) => {
|
1413
1420
|
return assertResponse(await this.context.create(size, updatedOptions.fileAttributes
|
1414
1421
|
? fileAttributesToString(updatedOptions.fileAttributes)
|
1415
|
-
: FileAttributesNone, Object.assign(Object.assign({}, updatedOptions), { fileChangeOn: fileChangeTimeToString(updatedOptions.changeTime), fileCreatedOn: fileCreationTimeToString(updatedOptions.creationTime), fileLastWriteOn: fileLastWriteTimeToString(updatedOptions.lastWriteTime) })));
|
1422
|
+
: FileAttributesNone, Object.assign(Object.assign(Object.assign({}, updatedOptions), { fileChangeOn: fileChangeTimeToString(updatedOptions.changeTime), fileCreatedOn: fileCreationTimeToString(updatedOptions.creationTime), fileLastWriteOn: fileLastWriteTimeToString(updatedOptions.lastWriteTime) }), this.shareClientConfig)));
|
1416
1423
|
});
|
1417
1424
|
}
|
1418
1425
|
/**
|
@@ -1482,9 +1489,9 @@ export class ShareFileClient extends StorageClient {
|
|
1482
1489
|
throw new RangeError(`rangeGetContentMD5 only works with partial data downloading`);
|
1483
1490
|
}
|
1484
1491
|
const downloadFullFile = offset === 0 && !count;
|
1485
|
-
const res = assertResponse(await this.context.download(Object.assign(Object.assign({}, updatedOptions), { requestOptions: {
|
1492
|
+
const res = assertResponse(await this.context.download(Object.assign(Object.assign(Object.assign({}, updatedOptions), { requestOptions: {
|
1486
1493
|
onDownloadProgress: isNode ? undefined : updatedOptions.onProgress, // for Node.js, progress is reported by RetriableReadableStream
|
1487
|
-
}, range: downloadFullFile ? undefined : rangeToString({ offset, count }) })));
|
1494
|
+
}, range: downloadFullFile ? undefined : rangeToString({ offset, count }) }), this.shareClientConfig)));
|
1488
1495
|
// Return browser response immediately
|
1489
1496
|
if (!isNode) {
|
1490
1497
|
return res;
|
@@ -1514,7 +1521,7 @@ export class ShareFileClient extends StorageClient {
|
|
1514
1521
|
// chunkDownloadOptions.range
|
1515
1522
|
// }, options: ${JSON.stringify(chunkDownloadOptions)}`
|
1516
1523
|
// );
|
1517
|
-
const downloadRes = await this.context.download(Object.assign(Object.assign({}, updatedOptions), updatedDownloadOptions));
|
1524
|
+
const downloadRes = await this.context.download(Object.assign(Object.assign(Object.assign({}, updatedOptions), updatedDownloadOptions), this.shareClientConfig));
|
1518
1525
|
if (!(downloadRes.etag === res.etag)) {
|
1519
1526
|
throw new Error("File has been modified concurrently");
|
1520
1527
|
}
|
@@ -1558,7 +1565,7 @@ export class ShareFileClient extends StorageClient {
|
|
1558
1565
|
*/
|
1559
1566
|
async getProperties(options = {}) {
|
1560
1567
|
return tracingClient.withSpan("ShareFileClient-getProperties", options, async (updatedOptions) => {
|
1561
|
-
return assertResponse(await this.context.getProperties(updatedOptions));
|
1568
|
+
return assertResponse(await this.context.getProperties(Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig)));
|
1562
1569
|
});
|
1563
1570
|
}
|
1564
1571
|
/**
|
@@ -1576,7 +1583,7 @@ export class ShareFileClient extends StorageClient {
|
|
1576
1583
|
return tracingClient.withSpan("ShareFileClient-setProperties", properties, async (updatedOptions) => {
|
1577
1584
|
return assertResponse(await this.context.setHttpHeaders(updatedOptions.fileAttributes
|
1578
1585
|
? fileAttributesToString(updatedOptions.fileAttributes)
|
1579
|
-
: FileAttributesPreserve, Object.assign(Object.assign({}, updatedOptions), { fileChangeOn: fileChangeTimeToString(updatedOptions.changeTime), fileCreatedOn: fileCreationTimeToString(updatedOptions.creationTime), fileLastWriteOn: fileLastWriteTimeToString(updatedOptions.lastWriteTime) })));
|
1586
|
+
: FileAttributesPreserve, Object.assign(Object.assign(Object.assign({}, updatedOptions), { fileChangeOn: fileChangeTimeToString(updatedOptions.changeTime), fileCreatedOn: fileCreationTimeToString(updatedOptions.creationTime), fileLastWriteOn: fileLastWriteTimeToString(updatedOptions.lastWriteTime) }), this.shareClientConfig)));
|
1580
1587
|
});
|
1581
1588
|
}
|
1582
1589
|
/**
|
@@ -1598,7 +1605,7 @@ export class ShareFileClient extends StorageClient {
|
|
1598
1605
|
*/
|
1599
1606
|
async delete(options = {}) {
|
1600
1607
|
return tracingClient.withSpan("ShareFileClient-delete", options, async (updatedOptions) => {
|
1601
|
-
return assertResponse(await this.context.delete(updatedOptions));
|
1608
|
+
return assertResponse(await this.context.delete(Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig)));
|
1602
1609
|
});
|
1603
1610
|
}
|
1604
1611
|
/**
|
@@ -1651,7 +1658,7 @@ export class ShareFileClient extends StorageClient {
|
|
1651
1658
|
return tracingClient.withSpan("ShareFileClient-setHTTPHeaders", options, async (updatedOptions) => {
|
1652
1659
|
return assertResponse(await this.context.setHttpHeaders(updatedOptions.fileAttributes
|
1653
1660
|
? fileAttributesToString(updatedOptions.fileAttributes)
|
1654
|
-
: FileAttributesPreserve, Object.assign(Object.assign({}, updatedOptions), { fileHttpHeaders, fileCreatedOn: fileCreationTimeToString(updatedOptions.creationTime), fileLastWriteOn: fileLastWriteTimeToString(updatedOptions.lastWriteTime), fileChangeOn: fileChangeTimeToString(updatedOptions.changeTime) })));
|
1661
|
+
: FileAttributesPreserve, Object.assign(Object.assign(Object.assign({}, updatedOptions), { fileHttpHeaders, fileCreatedOn: fileCreationTimeToString(updatedOptions.creationTime), fileLastWriteOn: fileLastWriteTimeToString(updatedOptions.lastWriteTime), fileChangeOn: fileChangeTimeToString(updatedOptions.changeTime) }), this.shareClientConfig)));
|
1655
1662
|
});
|
1656
1663
|
}
|
1657
1664
|
/**
|
@@ -1672,7 +1679,7 @@ export class ShareFileClient extends StorageClient {
|
|
1672
1679
|
// FileAttributes, filePermission, createTime, lastWriteTime will all be preserved.
|
1673
1680
|
options = validateAndSetDefaultsForFileAndDirectorySetPropertiesCommonOptions(options);
|
1674
1681
|
return tracingClient.withSpan("ShareFileClient-resize", options, async (updatedOptions) => {
|
1675
|
-
return assertResponse(await this.context.setHttpHeaders(fileAttributesToString(updatedOptions.fileAttributes), Object.assign(Object.assign({}, updatedOptions), { fileContentLength: length, fileChangeOn: fileChangeTimeToString(options.changeTime), fileCreatedOn: fileCreationTimeToString(options.creationTime), fileLastWriteOn: fileLastWriteTimeToString(options.lastWriteTime) })));
|
1682
|
+
return assertResponse(await this.context.setHttpHeaders(fileAttributesToString(updatedOptions.fileAttributes), Object.assign(Object.assign(Object.assign({}, updatedOptions), { fileContentLength: length, fileChangeOn: fileChangeTimeToString(options.changeTime), fileCreatedOn: fileCreationTimeToString(options.creationTime), fileLastWriteOn: fileLastWriteTimeToString(options.lastWriteTime) }), this.shareClientConfig)));
|
1676
1683
|
});
|
1677
1684
|
}
|
1678
1685
|
/**
|
@@ -1688,7 +1695,7 @@ export class ShareFileClient extends StorageClient {
|
|
1688
1695
|
*/
|
1689
1696
|
async setMetadata(metadata = {}, options = {}) {
|
1690
1697
|
return tracingClient.withSpan("ShareFileClient-setMetadata", options, async (updatedOptions) => {
|
1691
|
-
return assertResponse(await this.context.setMetadata(Object.assign(Object.assign({}, updatedOptions), { metadata })));
|
1698
|
+
return assertResponse(await this.context.setMetadata(Object.assign(Object.assign(Object.assign({}, updatedOptions), { metadata }), this.shareClientConfig)));
|
1692
1699
|
});
|
1693
1700
|
}
|
1694
1701
|
/**
|
@@ -1729,9 +1736,9 @@ export class ShareFileClient extends StorageClient {
|
|
1729
1736
|
if (contentLength > FILE_RANGE_MAX_SIZE_BYTES) {
|
1730
1737
|
throw new RangeError(`offset must be < ${FILE_RANGE_MAX_SIZE_BYTES} bytes`);
|
1731
1738
|
}
|
1732
|
-
return assertResponse(await this.context.uploadRange(rangeToString({ count: contentLength, offset }), "update", contentLength, Object.assign(Object.assign({}, updatedOptions), { requestOptions: {
|
1739
|
+
return assertResponse(await this.context.uploadRange(rangeToString({ count: contentLength, offset }), "update", contentLength, Object.assign(Object.assign(Object.assign({}, updatedOptions), { requestOptions: {
|
1733
1740
|
onUploadProgress: updatedOptions.onProgress,
|
1734
|
-
}, body })));
|
1741
|
+
}, body }), this.shareClientConfig)));
|
1735
1742
|
});
|
1736
1743
|
}
|
1737
1744
|
/**
|
@@ -1752,7 +1759,7 @@ export class ShareFileClient extends StorageClient {
|
|
1752
1759
|
if (count <= 0 || count > FILE_RANGE_MAX_SIZE_BYTES) {
|
1753
1760
|
throw new RangeError(`count must be > 0 and <= ${FILE_RANGE_MAX_SIZE_BYTES} bytes`);
|
1754
1761
|
}
|
1755
|
-
return assertResponse(await this.context.uploadRangeFromURL(rangeToString({ offset: destOffset, count }), sourceURL, 0, Object.assign(Object.assign({}, updatedOptions), { sourceRange: rangeToString({ offset: sourceOffset, count }), sourceModifiedAccessConditions: updatedOptions.sourceConditions, copySourceAuthorization: httpAuthorizationToString(updatedOptions.sourceAuthorization) })));
|
1762
|
+
return assertResponse(await this.context.uploadRangeFromURL(rangeToString({ offset: destOffset, count }), sourceURL, 0, Object.assign(Object.assign(Object.assign({}, updatedOptions), { sourceRange: rangeToString({ offset: sourceOffset, count }), sourceModifiedAccessConditions: updatedOptions.sourceConditions, copySourceAuthorization: httpAuthorizationToString(updatedOptions.sourceAuthorization) }), this.shareClientConfig)));
|
1756
1763
|
});
|
1757
1764
|
}
|
1758
1765
|
/**
|
@@ -1768,7 +1775,7 @@ export class ShareFileClient extends StorageClient {
|
|
1768
1775
|
if (offset < 0 || contentLength <= 0) {
|
1769
1776
|
throw new RangeError(`offset must >= 0 and contentLength must be > 0`);
|
1770
1777
|
}
|
1771
|
-
return assertResponse(await this.context.uploadRange(rangeToString({ count: contentLength, offset }), "clear", 0, updatedOptions));
|
1778
|
+
return assertResponse(await this.context.uploadRange(rangeToString({ count: contentLength, offset }), "clear", 0, Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig)));
|
1772
1779
|
});
|
1773
1780
|
}
|
1774
1781
|
/**
|
@@ -1778,7 +1785,7 @@ export class ShareFileClient extends StorageClient {
|
|
1778
1785
|
*/
|
1779
1786
|
async getRangeList(options = {}) {
|
1780
1787
|
return tracingClient.withSpan("ShareFileClient-getRangeList", options, async (updatedOptions) => {
|
1781
|
-
const originalResponse = assertResponse(await this.context.getRangeList(Object.assign(Object.assign({}, updatedOptions), { range: updatedOptions.range ? rangeToString(updatedOptions.range) : undefined })));
|
1788
|
+
const originalResponse = assertResponse(await this.context.getRangeList(Object.assign(Object.assign(Object.assign({}, updatedOptions), { range: updatedOptions.range ? rangeToString(updatedOptions.range) : undefined }), this.shareClientConfig)));
|
1782
1789
|
// Only returns ranges, ignoring clearRanges.
|
1783
1790
|
const parsedBody = originalResponse._response.parsedBody.ranges
|
1784
1791
|
? originalResponse._response.parsedBody.ranges
|
@@ -1794,7 +1801,7 @@ export class ShareFileClient extends StorageClient {
|
|
1794
1801
|
*/
|
1795
1802
|
async getRangeListDiff(prevShareSnapshot, options = {}) {
|
1796
1803
|
return tracingClient.withSpan("ShareFileClient-getRangeListDiff", options, async (updatedOptions) => {
|
1797
|
-
return assertResponse(await this.context.getRangeList(Object.assign(Object.assign({}, updatedOptions), { prevsharesnapshot: prevShareSnapshot, range: updatedOptions.range ? rangeToString(updatedOptions.range) : undefined })));
|
1804
|
+
return assertResponse(await this.context.getRangeList(Object.assign(Object.assign(Object.assign({}, updatedOptions), { prevsharesnapshot: prevShareSnapshot, range: updatedOptions.range ? rangeToString(updatedOptions.range) : undefined }), this.shareClientConfig)));
|
1798
1805
|
});
|
1799
1806
|
}
|
1800
1807
|
/**
|
@@ -1811,7 +1818,7 @@ export class ShareFileClient extends StorageClient {
|
|
1811
1818
|
*/
|
1812
1819
|
async startCopyFromURL(copySource, options = {}) {
|
1813
1820
|
return tracingClient.withSpan("ShareFileClient-startCopyFromURL", options, async (updatedOptions) => {
|
1814
|
-
return assertResponse(await this.context.startCopy(copySource, updatedOptions));
|
1821
|
+
return assertResponse(await this.context.startCopy(copySource, Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig)));
|
1815
1822
|
});
|
1816
1823
|
}
|
1817
1824
|
/**
|
@@ -1824,7 +1831,7 @@ export class ShareFileClient extends StorageClient {
|
|
1824
1831
|
*/
|
1825
1832
|
async abortCopyFromURL(copyId, options = {}) {
|
1826
1833
|
return tracingClient.withSpan("ShareFileClient-abortCopyFromURL", options, async (updatedOptions) => {
|
1827
|
-
return assertResponse(await this.context.abortCopy(copyId, updatedOptions));
|
1834
|
+
return assertResponse(await this.context.abortCopy(copyId, Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig)));
|
1828
1835
|
});
|
1829
1836
|
}
|
1830
1837
|
// High Level functions
|
@@ -2162,7 +2169,7 @@ export class ShareFileClient extends StorageClient {
|
|
2162
2169
|
async listHandlesSegment(marker, options = {}) {
|
2163
2170
|
return tracingClient.withSpan("ShareFileClient-listHandlesSegment", options, async (updatedOptions) => {
|
2164
2171
|
marker = marker === "" ? undefined : marker;
|
2165
|
-
const response = assertResponse(await this.context.listHandles(Object.assign(Object.assign({}, updatedOptions), { marker })));
|
2172
|
+
const response = assertResponse(await this.context.listHandles(Object.assign(Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig), { marker })));
|
2166
2173
|
// TODO: Protocol layer issue that when handle list is in returned XML
|
2167
2174
|
// response.handleList is an empty string
|
2168
2175
|
if (response.handleList === "") {
|
@@ -2277,7 +2284,7 @@ export class ShareFileClient extends StorageClient {
|
|
2277
2284
|
async forceCloseHandlesSegment(marker, options = {}) {
|
2278
2285
|
return tracingClient.withSpan("ShareFileClient-forceCloseHandlesSegment", options, async (updatedOptions) => {
|
2279
2286
|
marker = marker === "" ? undefined : marker;
|
2280
|
-
const rawResponse = await this.context.forceCloseHandles("*", Object.assign(Object.assign({}, updatedOptions), { marker }));
|
2287
|
+
const rawResponse = await this.context.forceCloseHandles("*", Object.assign(Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig), { marker }));
|
2281
2288
|
const response = rawResponse;
|
2282
2289
|
response.closedHandlesCount = rawResponse.numberOfHandlesClosed || 0;
|
2283
2290
|
response.closeFailureCount = rawResponse.numberOfHandlesFailedToClose || 0;
|
@@ -2324,7 +2331,7 @@ export class ShareFileClient extends StorageClient {
|
|
2324
2331
|
if (handleId === "*") {
|
2325
2332
|
throw new RangeError(`Parameter handleID should be a specified handle ID. Use forceCloseHandlesSegment() to close all handles.`);
|
2326
2333
|
}
|
2327
|
-
const rawResponse = await this.context.forceCloseHandles(handleId, updatedOptions);
|
2334
|
+
const rawResponse = await this.context.forceCloseHandles(handleId, Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig));
|
2328
2335
|
const response = rawResponse;
|
2329
2336
|
response.closedHandlesCount = rawResponse.numberOfHandlesClosed || 0;
|
2330
2337
|
response.closeFailureCount = rawResponse.numberOfHandlesFailedToClose || 0;
|
@@ -2392,9 +2399,9 @@ export class ShareFileClient extends StorageClient {
|
|
2392
2399
|
else {
|
2393
2400
|
throw new RangeError("Destination path should not contain more than one query string");
|
2394
2401
|
}
|
2395
|
-
const destFile = new ShareFileClient(destinationUrl, this.pipeline);
|
2402
|
+
const destFile = new ShareFileClient(destinationUrl, this.pipeline, this.shareClientConfig);
|
2396
2403
|
return tracingClient.withSpan("ShareFileClient-rename", options, async (updatedOptions) => {
|
2397
|
-
const response = assertResponse(await destFile.context.rename(this.url, Object.assign(Object.assign({}, updatedOptions), { sourceLeaseAccessConditions: updatedOptions.sourceLeaseAccessConditions
|
2404
|
+
const response = assertResponse(await destFile.context.rename(this.url, Object.assign(Object.assign(Object.assign({}, updatedOptions), { sourceLeaseAccessConditions: updatedOptions.sourceLeaseAccessConditions
|
2398
2405
|
? {
|
2399
2406
|
sourceLeaseId: updatedOptions.sourceLeaseAccessConditions.leaseId,
|
2400
2407
|
}
|
@@ -2406,7 +2413,7 @@ export class ShareFileClient extends StorageClient {
|
|
2406
2413
|
? {
|
2407
2414
|
fileContentType: options.contentType,
|
2408
2415
|
}
|
2409
|
-
: undefined })));
|
2416
|
+
: undefined }), this.shareClientConfig)));
|
2410
2417
|
return {
|
2411
2418
|
destinationFileClient: destFile,
|
2412
2419
|
fileRenameResponse: response,
|