@azure/storage-file-share 12.28.0-alpha.20250717.2 → 12.28.0-alpha.20250718.2
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/browser/AccountSASPermissions.js +32 -34
- package/dist/browser/AccountSASPermissions.js.map +1 -1
- package/dist/browser/AccountSASResourceTypes.js +12 -14
- package/dist/browser/AccountSASResourceTypes.js.map +1 -1
- package/dist/browser/AccountSASServices.js +16 -18
- package/dist/browser/AccountSASServices.js.map +1 -1
- package/dist/browser/Clients.js +551 -238
- package/dist/browser/Clients.js.map +1 -1
- package/dist/browser/FileSASPermissions.js +16 -18
- package/dist/browser/FileSASPermissions.js.map +1 -1
- package/dist/browser/FileSystemAttributes.js +43 -45
- package/dist/browser/FileSystemAttributes.js.map +1 -1
- package/dist/browser/Pipeline.js +27 -10
- package/dist/browser/Pipeline.js.map +1 -1
- package/dist/browser/SASQueryParameters.js +70 -0
- package/dist/browser/SASQueryParameters.js.map +1 -1
- package/dist/browser/ShareClientInternal.js +1 -0
- package/dist/browser/ShareClientInternal.js.map +1 -1
- package/dist/browser/ShareSASPermissions.js +20 -22
- package/dist/browser/ShareSASPermissions.js.map +1 -1
- package/dist/browser/ShareServiceClient.js +63 -47
- package/dist/browser/ShareServiceClient.js.map +1 -1
- package/dist/browser/StorageClient.js +23 -0
- package/dist/browser/StorageClient.js.map +1 -1
- package/dist/browser/StorageContextClient.js +1 -1
- package/dist/browser/StorageContextClient.js.map +1 -1
- package/dist/browser/generated/src/operations/directory.js +1 -0
- package/dist/browser/generated/src/operations/directory.js.map +1 -1
- package/dist/browser/generated/src/operations/file.js +1 -0
- package/dist/browser/generated/src/operations/file.js.map +1 -1
- package/dist/browser/generated/src/operations/service.js +1 -0
- package/dist/browser/generated/src/operations/service.js.map +1 -1
- package/dist/browser/generated/src/operations/share.js +1 -0
- package/dist/browser/generated/src/operations/share.js.map +1 -1
- package/dist/browser/generated/src/storageClient.js +14 -3
- package/dist/browser/generated/src/storageClient.js.map +1 -1
- package/dist/browser/utils/Batch.js +29 -21
- package/dist/browser/utils/Batch.js.map +1 -1
- package/dist/browser/utils/BufferScheduler.js +70 -44
- package/dist/browser/utils/BufferScheduler.js.map +1 -1
- package/dist/browser/utils/RetriableReadableStream.js +70 -62
- package/dist/browser/utils/RetriableReadableStream.js.map +1 -1
- package/dist/browser/utils/utils.common.js +31 -15
- package/dist/browser/utils/utils.common.js.map +1 -1
- package/dist/commonjs/AccountSASPermissions.js +32 -34
- package/dist/commonjs/AccountSASPermissions.js.map +1 -1
- package/dist/commonjs/AccountSASResourceTypes.js +12 -14
- package/dist/commonjs/AccountSASResourceTypes.js.map +1 -1
- package/dist/commonjs/AccountSASServices.js +16 -18
- package/dist/commonjs/AccountSASServices.js.map +1 -1
- package/dist/commonjs/Clients.js +551 -238
- package/dist/commonjs/Clients.js.map +1 -1
- package/dist/commonjs/FileDownloadResponse.js +2 -0
- package/dist/commonjs/FileDownloadResponse.js.map +1 -1
- package/dist/commonjs/FileSASPermissions.js +16 -18
- package/dist/commonjs/FileSASPermissions.js.map +1 -1
- package/dist/commonjs/FileSystemAttributes.js +43 -45
- package/dist/commonjs/FileSystemAttributes.js.map +1 -1
- package/dist/commonjs/Pipeline.js +27 -10
- package/dist/commonjs/Pipeline.js.map +1 -1
- package/dist/commonjs/SASQueryParameters.js +70 -0
- package/dist/commonjs/SASQueryParameters.js.map +1 -1
- package/dist/commonjs/ShareClientInternal.js +1 -0
- package/dist/commonjs/ShareClientInternal.js.map +1 -1
- package/dist/commonjs/ShareSASPermissions.js +20 -22
- package/dist/commonjs/ShareSASPermissions.js.map +1 -1
- package/dist/commonjs/ShareServiceClient.js +63 -47
- package/dist/commonjs/ShareServiceClient.js.map +1 -1
- package/dist/commonjs/StorageClient.js +23 -0
- package/dist/commonjs/StorageClient.js.map +1 -1
- package/dist/commonjs/StorageContextClient.js +1 -1
- package/dist/commonjs/StorageContextClient.js.map +1 -1
- package/dist/commonjs/generated/src/operations/directory.js +1 -0
- package/dist/commonjs/generated/src/operations/directory.js.map +1 -1
- package/dist/commonjs/generated/src/operations/file.js +1 -0
- package/dist/commonjs/generated/src/operations/file.js.map +1 -1
- package/dist/commonjs/generated/src/operations/service.js +1 -0
- package/dist/commonjs/generated/src/operations/service.js.map +1 -1
- package/dist/commonjs/generated/src/operations/share.js +1 -0
- package/dist/commonjs/generated/src/operations/share.js.map +1 -1
- package/dist/commonjs/generated/src/storageClient.js +14 -3
- package/dist/commonjs/generated/src/storageClient.js.map +1 -1
- package/dist/commonjs/tsdoc-metadata.json +11 -11
- package/dist/commonjs/utils/Batch.js +29 -21
- package/dist/commonjs/utils/Batch.js.map +1 -1
- package/dist/commonjs/utils/BufferScheduler.js +70 -44
- package/dist/commonjs/utils/BufferScheduler.js.map +1 -1
- package/dist/commonjs/utils/RetriableReadableStream.js +70 -62
- package/dist/commonjs/utils/RetriableReadableStream.js.map +1 -1
- package/dist/commonjs/utils/utils.common.js +31 -15
- package/dist/commonjs/utils/utils.common.js.map +1 -1
- package/dist/esm/AccountSASPermissions.js +32 -34
- package/dist/esm/AccountSASPermissions.js.map +1 -1
- package/dist/esm/AccountSASResourceTypes.js +12 -14
- package/dist/esm/AccountSASResourceTypes.js.map +1 -1
- package/dist/esm/AccountSASServices.js +16 -18
- package/dist/esm/AccountSASServices.js.map +1 -1
- package/dist/esm/Clients.js +551 -238
- package/dist/esm/Clients.js.map +1 -1
- package/dist/esm/FileDownloadResponse.js +2 -0
- package/dist/esm/FileDownloadResponse.js.map +1 -1
- package/dist/esm/FileSASPermissions.js +16 -18
- package/dist/esm/FileSASPermissions.js.map +1 -1
- package/dist/esm/FileSystemAttributes.js +43 -45
- package/dist/esm/FileSystemAttributes.js.map +1 -1
- package/dist/esm/Pipeline.js +27 -10
- package/dist/esm/Pipeline.js.map +1 -1
- package/dist/esm/SASQueryParameters.js +70 -0
- package/dist/esm/SASQueryParameters.js.map +1 -1
- package/dist/esm/ShareClientInternal.js +1 -0
- package/dist/esm/ShareClientInternal.js.map +1 -1
- package/dist/esm/ShareSASPermissions.js +20 -22
- package/dist/esm/ShareSASPermissions.js.map +1 -1
- package/dist/esm/ShareServiceClient.js +63 -47
- package/dist/esm/ShareServiceClient.js.map +1 -1
- package/dist/esm/StorageClient.js +23 -0
- package/dist/esm/StorageClient.js.map +1 -1
- package/dist/esm/StorageContextClient.js +1 -1
- package/dist/esm/StorageContextClient.js.map +1 -1
- package/dist/esm/generated/src/operations/directory.js +1 -0
- package/dist/esm/generated/src/operations/directory.js.map +1 -1
- package/dist/esm/generated/src/operations/file.js +1 -0
- package/dist/esm/generated/src/operations/file.js.map +1 -1
- package/dist/esm/generated/src/operations/service.js +1 -0
- package/dist/esm/generated/src/operations/service.js.map +1 -1
- package/dist/esm/generated/src/operations/share.js +1 -0
- package/dist/esm/generated/src/operations/share.js.map +1 -1
- package/dist/esm/generated/src/storageClient.js +14 -3
- package/dist/esm/generated/src/storageClient.js.map +1 -1
- package/dist/esm/utils/Batch.js +29 -21
- package/dist/esm/utils/Batch.js.map +1 -1
- package/dist/esm/utils/BufferScheduler.js +70 -44
- package/dist/esm/utils/BufferScheduler.js.map +1 -1
- package/dist/esm/utils/RetriableReadableStream.js +70 -62
- package/dist/esm/utils/RetriableReadableStream.js.map +1 -1
- package/dist/esm/utils/utils.common.js +31 -15
- package/dist/esm/utils/utils.common.js.map +1 -1
- package/dist/react-native/AccountSASPermissions.js +32 -34
- package/dist/react-native/AccountSASPermissions.js.map +1 -1
- package/dist/react-native/AccountSASResourceTypes.js +12 -14
- package/dist/react-native/AccountSASResourceTypes.js.map +1 -1
- package/dist/react-native/AccountSASServices.js +16 -18
- package/dist/react-native/AccountSASServices.js.map +1 -1
- package/dist/react-native/Clients.js +551 -238
- package/dist/react-native/Clients.js.map +1 -1
- package/dist/react-native/FileDownloadResponse.js +2 -0
- package/dist/react-native/FileDownloadResponse.js.map +1 -1
- package/dist/react-native/FileSASPermissions.js +16 -18
- package/dist/react-native/FileSASPermissions.js.map +1 -1
- package/dist/react-native/FileSystemAttributes.js +43 -45
- package/dist/react-native/FileSystemAttributes.js.map +1 -1
- package/dist/react-native/Pipeline.js +27 -10
- package/dist/react-native/Pipeline.js.map +1 -1
- package/dist/react-native/SASQueryParameters.js +70 -0
- package/dist/react-native/SASQueryParameters.js.map +1 -1
- package/dist/react-native/ShareClientInternal.js +1 -0
- package/dist/react-native/ShareClientInternal.js.map +1 -1
- package/dist/react-native/ShareSASPermissions.js +20 -22
- package/dist/react-native/ShareSASPermissions.js.map +1 -1
- package/dist/react-native/ShareServiceClient.js +63 -47
- package/dist/react-native/ShareServiceClient.js.map +1 -1
- package/dist/react-native/StorageClient.js +23 -0
- package/dist/react-native/StorageClient.js.map +1 -1
- package/dist/react-native/StorageContextClient.js +1 -1
- package/dist/react-native/StorageContextClient.js.map +1 -1
- package/dist/react-native/generated/src/operations/directory.js +1 -0
- package/dist/react-native/generated/src/operations/directory.js.map +1 -1
- package/dist/react-native/generated/src/operations/file.js +1 -0
- package/dist/react-native/generated/src/operations/file.js.map +1 -1
- package/dist/react-native/generated/src/operations/service.js +1 -0
- package/dist/react-native/generated/src/operations/service.js.map +1 -1
- package/dist/react-native/generated/src/operations/share.js +1 -0
- package/dist/react-native/generated/src/operations/share.js.map +1 -1
- package/dist/react-native/generated/src/storageClient.js +14 -3
- package/dist/react-native/generated/src/storageClient.js.map +1 -1
- package/dist/react-native/utils/Batch.js +29 -21
- package/dist/react-native/utils/Batch.js.map +1 -1
- package/dist/react-native/utils/BufferScheduler.js +70 -44
- package/dist/react-native/utils/BufferScheduler.js.map +1 -1
- package/dist/react-native/utils/RetriableReadableStream.js +70 -62
- package/dist/react-native/utils/RetriableReadableStream.js.map +1 -1
- package/dist/react-native/utils/utils.common.js +31 -15
- package/dist/react-native/utils/utils.common.js.map +1 -1
- package/package.json +2 -2
package/dist/browser/Clients.js
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
2
2
|
// Licensed under the MIT License.
|
3
|
-
import { __asyncGenerator, __asyncValues, __await } from "tslib";
|
4
3
|
import { isTokenCredential } from "@azure/core-auth";
|
5
4
|
import { isNodeLike } from "@azure/core-util";
|
6
5
|
import { isPipelineLike, newPipeline } from "./Pipeline.js";
|
@@ -23,6 +22,12 @@ import { generateFileSASQueryParameters, generateFileSASQueryParametersInternal,
|
|
23
22
|
* A ShareClient represents a URL to the Azure Storage share allowing you to manipulate its directories and files.
|
24
23
|
*/
|
25
24
|
export class ShareClient extends StorageClient {
|
25
|
+
/**
|
26
|
+
* Share operation context provided by protocol layer.
|
27
|
+
*/
|
28
|
+
context;
|
29
|
+
_name;
|
30
|
+
shareClientConfig;
|
26
31
|
/**
|
27
32
|
* The name of the share
|
28
33
|
*/
|
@@ -103,7 +108,11 @@ export class ShareClient extends StorageClient {
|
|
103
108
|
*/
|
104
109
|
async create(options = {}) {
|
105
110
|
return tracingClient.withSpan("ShareClient-create", options, async (updatedOptions) => {
|
106
|
-
return assertResponse(await this.context.create(
|
111
|
+
return assertResponse(await this.context.create({
|
112
|
+
...updatedOptions,
|
113
|
+
...this.shareClientConfig,
|
114
|
+
enabledProtocols: toShareProtocolsString(updatedOptions.protocols),
|
115
|
+
}));
|
107
116
|
});
|
108
117
|
}
|
109
118
|
/**
|
@@ -115,14 +124,20 @@ export class ShareClient extends StorageClient {
|
|
115
124
|
*/
|
116
125
|
async createIfNotExists(options = {}) {
|
117
126
|
return tracingClient.withSpan("ShareClient-createIfNotExists", options, async (updatedOptions) => {
|
118
|
-
var _a, _b;
|
119
127
|
try {
|
120
128
|
const res = await this.create(updatedOptions);
|
121
|
-
return
|
129
|
+
return {
|
130
|
+
succeeded: true,
|
131
|
+
...res,
|
132
|
+
};
|
122
133
|
}
|
123
134
|
catch (e) {
|
124
|
-
if (
|
125
|
-
return
|
135
|
+
if (e.details?.errorCode === "ShareAlreadyExists") {
|
136
|
+
return {
|
137
|
+
succeeded: false,
|
138
|
+
...e.response?.parsedHeaders,
|
139
|
+
_response: e.response,
|
140
|
+
};
|
126
141
|
}
|
127
142
|
throw e;
|
128
143
|
}
|
@@ -269,7 +284,11 @@ export class ShareClient extends StorageClient {
|
|
269
284
|
async getProperties(options = {}) {
|
270
285
|
return tracingClient.withSpan("ShareClient-getProperties", options, async (updatedOptions) => {
|
271
286
|
const res = assertResponse(await this.context.getProperties(updatedOptions));
|
272
|
-
return
|
287
|
+
return {
|
288
|
+
...res,
|
289
|
+
...this.shareClientConfig,
|
290
|
+
protocols: toShareProtocols(res.enabledProtocols),
|
291
|
+
};
|
273
292
|
});
|
274
293
|
}
|
275
294
|
/**
|
@@ -282,7 +301,10 @@ export class ShareClient extends StorageClient {
|
|
282
301
|
*/
|
283
302
|
async delete(options = {}) {
|
284
303
|
return tracingClient.withSpan("ShareClient-delete", options, async (updatedOptions) => {
|
285
|
-
return assertResponse(await this.context.delete(
|
304
|
+
return assertResponse(await this.context.delete({
|
305
|
+
...updatedOptions,
|
306
|
+
...this.shareClientConfig,
|
307
|
+
}));
|
286
308
|
});
|
287
309
|
}
|
288
310
|
/**
|
@@ -294,14 +316,20 @@ export class ShareClient extends StorageClient {
|
|
294
316
|
*/
|
295
317
|
async deleteIfExists(options = {}) {
|
296
318
|
return tracingClient.withSpan("ShareClient-deleteIfExists", options, async (updatedOptions) => {
|
297
|
-
var _a, _b;
|
298
319
|
try {
|
299
320
|
const res = await this.delete(updatedOptions);
|
300
|
-
return
|
321
|
+
return {
|
322
|
+
succeeded: true,
|
323
|
+
...res,
|
324
|
+
};
|
301
325
|
}
|
302
326
|
catch (e) {
|
303
|
-
if (
|
304
|
-
return
|
327
|
+
if (e.details?.errorCode === "ShareNotFound") {
|
328
|
+
return {
|
329
|
+
succeeded: false,
|
330
|
+
...e.response?.parsedHeaders,
|
331
|
+
_response: e.response,
|
332
|
+
};
|
305
333
|
}
|
306
334
|
throw e;
|
307
335
|
}
|
@@ -320,7 +348,11 @@ export class ShareClient extends StorageClient {
|
|
320
348
|
*/
|
321
349
|
async setMetadata(metadata, options = {}) {
|
322
350
|
return tracingClient.withSpan("ShareClient-setMetadata", options, async (updatedOptions) => {
|
323
|
-
return assertResponse(await this.context.setMetadata(
|
351
|
+
return assertResponse(await this.context.setMetadata({
|
352
|
+
...updatedOptions,
|
353
|
+
...this.shareClientConfig,
|
354
|
+
metadata,
|
355
|
+
}));
|
324
356
|
});
|
325
357
|
}
|
326
358
|
/**
|
@@ -337,7 +369,10 @@ export class ShareClient extends StorageClient {
|
|
337
369
|
*/
|
338
370
|
async getAccessPolicy(options = {}) {
|
339
371
|
return tracingClient.withSpan("ShareClient-getAccessPolicy", options, async (updatedOptions) => {
|
340
|
-
const response = assertResponse(await this.context.getAccessPolicy(
|
372
|
+
const response = assertResponse(await this.context.getAccessPolicy({
|
373
|
+
...updatedOptions,
|
374
|
+
...this.shareClientConfig,
|
375
|
+
}));
|
341
376
|
const res = {
|
342
377
|
_response: response._response,
|
343
378
|
date: response.date,
|
@@ -387,23 +422,26 @@ export class ShareClient extends StorageClient {
|
|
387
422
|
*/
|
388
423
|
async setAccessPolicy(shareAcl, options = {}) {
|
389
424
|
return tracingClient.withSpan("ShareClient-setAccessPolicy", options, async (updatedOptions) => {
|
390
|
-
var _a, _b, _c;
|
391
425
|
const acl = [];
|
392
426
|
for (const identifier of shareAcl || []) {
|
393
427
|
acl.push({
|
394
428
|
accessPolicy: {
|
395
|
-
expiresOn:
|
429
|
+
expiresOn: identifier.accessPolicy?.expiresOn
|
396
430
|
? truncatedISO8061Date(identifier.accessPolicy.expiresOn)
|
397
431
|
: undefined,
|
398
|
-
permissions:
|
399
|
-
startsOn:
|
432
|
+
permissions: identifier.accessPolicy?.permissions,
|
433
|
+
startsOn: identifier.accessPolicy?.startsOn
|
400
434
|
? truncatedISO8061Date(identifier.accessPolicy.startsOn)
|
401
435
|
: undefined,
|
402
436
|
},
|
403
437
|
id: identifier.id,
|
404
438
|
});
|
405
439
|
}
|
406
|
-
return assertResponse(await this.context.setAccessPolicy(
|
440
|
+
return assertResponse(await this.context.setAccessPolicy({
|
441
|
+
...updatedOptions,
|
442
|
+
...this.shareClientConfig,
|
443
|
+
shareAcl: acl,
|
444
|
+
}));
|
407
445
|
});
|
408
446
|
}
|
409
447
|
/**
|
@@ -414,7 +452,10 @@ export class ShareClient extends StorageClient {
|
|
414
452
|
*/
|
415
453
|
async createSnapshot(options = {}) {
|
416
454
|
return tracingClient.withSpan("ShareClient-createSnapshot", options, async (updatedOptions) => {
|
417
|
-
return assertResponse(await this.context.createSnapshot(
|
455
|
+
return assertResponse(await this.context.createSnapshot({
|
456
|
+
...updatedOptions,
|
457
|
+
...this.shareClientConfig,
|
458
|
+
}));
|
418
459
|
});
|
419
460
|
}
|
420
461
|
/**
|
@@ -428,7 +469,11 @@ export class ShareClient extends StorageClient {
|
|
428
469
|
*/
|
429
470
|
async setQuota(quotaInGB, options = {}) {
|
430
471
|
return tracingClient.withSpan("ShareClient-setQuota", options, async (updatedOptions) => {
|
431
|
-
return assertResponse(await this.context.setProperties(
|
472
|
+
return assertResponse(await this.context.setProperties({
|
473
|
+
...updatedOptions,
|
474
|
+
...this.shareClientConfig,
|
475
|
+
quota: quotaInGB,
|
476
|
+
}));
|
432
477
|
});
|
433
478
|
}
|
434
479
|
/**
|
@@ -439,7 +484,12 @@ export class ShareClient extends StorageClient {
|
|
439
484
|
*/
|
440
485
|
async setProperties(options = {}) {
|
441
486
|
return tracingClient.withSpan("ShareClient-setProperties", options, async (updatedOptions) => {
|
442
|
-
return assertResponse(await this.context.setProperties(
|
487
|
+
return assertResponse(await this.context.setProperties({
|
488
|
+
...options,
|
489
|
+
...this.shareClientConfig,
|
490
|
+
quota: options.quotaInGB,
|
491
|
+
tracingOptions: updatedOptions.tracingOptions,
|
492
|
+
}));
|
443
493
|
});
|
444
494
|
}
|
445
495
|
/**
|
@@ -450,9 +500,12 @@ export class ShareClient extends StorageClient {
|
|
450
500
|
*/
|
451
501
|
async getStatistics(options = {}) {
|
452
502
|
return tracingClient.withSpan("ShareClient-getStatistics", options, async (updatedOptions) => {
|
453
|
-
const response = assertResponse(await this.context.getStatistics(
|
503
|
+
const response = assertResponse(await this.context.getStatistics({
|
504
|
+
...updatedOptions,
|
505
|
+
...this.shareClientConfig,
|
506
|
+
}));
|
454
507
|
const GBBytes = 1024 * 1024 * 1024;
|
455
|
-
return
|
508
|
+
return { ...response, shareUsage: Math.ceil(response.shareUsageBytes / GBBytes) };
|
456
509
|
});
|
457
510
|
}
|
458
511
|
/**
|
@@ -465,7 +518,10 @@ export class ShareClient extends StorageClient {
|
|
465
518
|
*/
|
466
519
|
async createPermission(filePermission, options = {}) {
|
467
520
|
return tracingClient.withSpan("ShareClient-createPermission", options, async (updatedOptions) => {
|
468
|
-
return assertResponse(await this.context.createPermission(asSharePermission(filePermission),
|
521
|
+
return assertResponse(await this.context.createPermission(asSharePermission(filePermission), {
|
522
|
+
...updatedOptions,
|
523
|
+
...this.shareClientConfig,
|
524
|
+
}));
|
469
525
|
});
|
470
526
|
}
|
471
527
|
/**
|
@@ -478,7 +534,10 @@ export class ShareClient extends StorageClient {
|
|
478
534
|
*/
|
479
535
|
async getPermission(filePermissionKey, options = {}) {
|
480
536
|
return tracingClient.withSpan("ShareClient-getPermission", options, async (updatedOptions) => {
|
481
|
-
return assertResponse(await this.context.getPermission(filePermissionKey,
|
537
|
+
return assertResponse(await this.context.getPermission(filePermissionKey, {
|
538
|
+
...updatedOptions,
|
539
|
+
...this.shareClientConfig,
|
540
|
+
}));
|
482
541
|
});
|
483
542
|
}
|
484
543
|
/**
|
@@ -505,7 +564,10 @@ export class ShareClient extends StorageClient {
|
|
505
564
|
if (!(this.credential instanceof StorageSharedKeyCredential)) {
|
506
565
|
throw RangeError("Can only generate the SAS when the client is initialized with a shared key credential");
|
507
566
|
}
|
508
|
-
const sas = generateFileSASQueryParameters(
|
567
|
+
const sas = generateFileSASQueryParameters({
|
568
|
+
shareName: this.name,
|
569
|
+
...options,
|
570
|
+
}, this.credential).toString();
|
509
571
|
return appendToURLQuery(this.url, sas);
|
510
572
|
}
|
511
573
|
/**
|
@@ -524,13 +586,24 @@ export class ShareClient extends StorageClient {
|
|
524
586
|
if (!(this.credential instanceof StorageSharedKeyCredential)) {
|
525
587
|
throw RangeError("Can only generate the SAS when the client is initialized with a shared key credential");
|
526
588
|
}
|
527
|
-
return generateFileSASQueryParametersInternal(
|
589
|
+
return generateFileSASQueryParametersInternal({
|
590
|
+
shareName: this.name,
|
591
|
+
...options,
|
592
|
+
}, this.credential).stringToSign;
|
528
593
|
}
|
529
594
|
}
|
530
595
|
/**
|
531
596
|
* A ShareDirectoryClient represents a URL to the Azure Storage directory allowing you to manipulate its files and directories.
|
532
597
|
*/
|
533
598
|
export class ShareDirectoryClient extends StorageClient {
|
599
|
+
/**
|
600
|
+
* context provided by protocol layer.
|
601
|
+
*/
|
602
|
+
context;
|
603
|
+
_shareName;
|
604
|
+
_path;
|
605
|
+
_name;
|
606
|
+
shareClientConfig;
|
534
607
|
/**
|
535
608
|
* The share name corresponding to this directory client
|
536
609
|
*/
|
@@ -586,16 +659,29 @@ export class ShareDirectoryClient extends StorageClient {
|
|
586
659
|
options = validateAndSetDefaultsForFileAndDirectoryCreateCommonOptions(options);
|
587
660
|
}
|
588
661
|
return tracingClient.withSpan("ShareDirectoryClient-create", options, async (updatedOptions) => {
|
589
|
-
|
590
|
-
|
662
|
+
const rawResponse = await this.context.create({
|
663
|
+
...updatedOptions,
|
664
|
+
fileChangeOn: fileChangeTimeToString(updatedOptions.changeTime),
|
665
|
+
fileCreatedOn: fileCreationTimeToString(updatedOptions.creationTime),
|
666
|
+
fileLastWriteOn: fileLastWriteTimeToString(updatedOptions.lastWriteTime),
|
667
|
+
fileAttributes: updatedOptions.fileAttributes
|
591
668
|
? fileAttributesToString(updatedOptions.fileAttributes)
|
592
|
-
: undefined,
|
593
|
-
|
669
|
+
: undefined,
|
670
|
+
owner: updatedOptions.posixProperties?.owner,
|
671
|
+
group: updatedOptions.posixProperties?.group,
|
672
|
+
fileMode: toOctalFileMode(updatedOptions.posixProperties?.fileMode),
|
673
|
+
...this.shareClientConfig,
|
674
|
+
});
|
675
|
+
const wrappedRes = {
|
676
|
+
...rawResponse,
|
677
|
+
_response: rawResponse._response, // _response is made non-enumerable,
|
678
|
+
posixProperties: {
|
594
679
|
fileMode: parseOctalFileMode(rawResponse.fileMode),
|
595
680
|
fileType: rawResponse.nfsFileType,
|
596
681
|
owner: rawResponse.owner,
|
597
682
|
group: rawResponse.group,
|
598
|
-
}
|
683
|
+
},
|
684
|
+
};
|
599
685
|
return assertResponse(wrappedRes);
|
600
686
|
});
|
601
687
|
}
|
@@ -608,14 +694,20 @@ export class ShareDirectoryClient extends StorageClient {
|
|
608
694
|
*/
|
609
695
|
async createIfNotExists(options = {}) {
|
610
696
|
return tracingClient.withSpan("ShareDirectoryClient-createIfNotExists", options, async (updatedOptions) => {
|
611
|
-
var _a, _b;
|
612
697
|
try {
|
613
698
|
const res = await this.create(updatedOptions);
|
614
|
-
return
|
699
|
+
return {
|
700
|
+
succeeded: true,
|
701
|
+
...res,
|
702
|
+
};
|
615
703
|
}
|
616
704
|
catch (e) {
|
617
|
-
if (
|
618
|
-
return
|
705
|
+
if (e.details?.errorCode === "ResourceAlreadyExists") {
|
706
|
+
return {
|
707
|
+
succeeded: false,
|
708
|
+
...e.response?.parsedHeaders,
|
709
|
+
_response: e.response,
|
710
|
+
};
|
619
711
|
}
|
620
712
|
throw e;
|
621
713
|
}
|
@@ -631,15 +723,28 @@ export class ShareDirectoryClient extends StorageClient {
|
|
631
723
|
async setProperties(properties = {}) {
|
632
724
|
properties = validateAndSetDefaultsForFileAndDirectorySetPropertiesCommonOptions(properties);
|
633
725
|
return tracingClient.withSpan("ShareDirectoryClient-setProperties", properties, async (updatedOptions) => {
|
634
|
-
|
635
|
-
|
726
|
+
const rawResponse = await this.context.setProperties({
|
727
|
+
...updatedOptions,
|
728
|
+
fileChangeOn: fileChangeTimeToString(updatedOptions.changeTime),
|
729
|
+
fileCreatedOn: fileCreationTimeToString(updatedOptions.creationTime),
|
730
|
+
fileLastWriteOn: fileLastWriteTimeToString(updatedOptions.lastWriteTime),
|
731
|
+
fileAttributes: updatedOptions.fileAttributes
|
636
732
|
? fileAttributesToString(updatedOptions.fileAttributes)
|
637
|
-
: undefined,
|
638
|
-
|
733
|
+
: undefined,
|
734
|
+
owner: updatedOptions.posixProperties?.owner,
|
735
|
+
group: updatedOptions.posixProperties?.group,
|
736
|
+
fileMode: toOctalFileMode(updatedOptions.posixProperties?.fileMode),
|
737
|
+
...this.shareClientConfig,
|
738
|
+
});
|
739
|
+
return assertResponse({
|
740
|
+
...rawResponse,
|
741
|
+
_response: rawResponse._response,
|
742
|
+
posixProperties: {
|
639
743
|
fileMode: parseOctalFileMode(rawResponse.fileMode),
|
640
744
|
owner: rawResponse.owner,
|
641
745
|
group: rawResponse.group,
|
642
|
-
}
|
746
|
+
},
|
747
|
+
});
|
643
748
|
});
|
644
749
|
}
|
645
750
|
/**
|
@@ -800,7 +905,7 @@ export class ShareDirectoryClient extends StorageClient {
|
|
800
905
|
async exists(options = {}) {
|
801
906
|
return tracingClient.withSpan("ShareDirectoryClient-exists", options, async (updatedOptions) => {
|
802
907
|
try {
|
803
|
-
await this.getProperties(
|
908
|
+
await this.getProperties({ ...updatedOptions, ...this.shareClientConfig });
|
804
909
|
return true;
|
805
910
|
}
|
806
911
|
catch (e) {
|
@@ -822,13 +927,20 @@ export class ShareDirectoryClient extends StorageClient {
|
|
822
927
|
*/
|
823
928
|
async getProperties(options = {}) {
|
824
929
|
return tracingClient.withSpan("ShareDirectoryClient-getProperties", options, async (updatedOptions) => {
|
825
|
-
const rawResponse = await this.context.getProperties(
|
826
|
-
|
930
|
+
const rawResponse = await this.context.getProperties({
|
931
|
+
...updatedOptions,
|
932
|
+
...this.shareClientConfig,
|
933
|
+
});
|
934
|
+
return assertResponse({
|
935
|
+
...rawResponse,
|
936
|
+
_response: rawResponse._response,
|
937
|
+
posixProperties: {
|
827
938
|
fileMode: parseOctalFileMode(rawResponse.fileMode),
|
828
939
|
owner: rawResponse.owner,
|
829
940
|
group: rawResponse.group,
|
830
941
|
fileType: rawResponse.nfsFileType,
|
831
|
-
}
|
942
|
+
},
|
943
|
+
});
|
832
944
|
});
|
833
945
|
}
|
834
946
|
/**
|
@@ -841,7 +953,7 @@ export class ShareDirectoryClient extends StorageClient {
|
|
841
953
|
*/
|
842
954
|
async delete(options = {}) {
|
843
955
|
return tracingClient.withSpan("ShareDirectoryClient-delete", options, async (updatedOptions) => {
|
844
|
-
return assertResponse(await this.context.delete(
|
956
|
+
return assertResponse(await this.context.delete({ ...updatedOptions, ...this.shareClientConfig }));
|
845
957
|
});
|
846
958
|
}
|
847
959
|
/**
|
@@ -853,15 +965,21 @@ export class ShareDirectoryClient extends StorageClient {
|
|
853
965
|
*/
|
854
966
|
async deleteIfExists(options = {}) {
|
855
967
|
return tracingClient.withSpan("ShareDirectoryClient-deleteIfExists", options, async (updatedOptions) => {
|
856
|
-
var _a, _b, _c;
|
857
968
|
try {
|
858
969
|
const res = await this.delete(updatedOptions);
|
859
|
-
return
|
970
|
+
return {
|
971
|
+
succeeded: true,
|
972
|
+
...res,
|
973
|
+
};
|
860
974
|
}
|
861
975
|
catch (e) {
|
862
|
-
if (
|
863
|
-
|
864
|
-
return
|
976
|
+
if (e.details?.errorCode === "ResourceNotFound" ||
|
977
|
+
e.details?.errorCode === "ParentNotFound") {
|
978
|
+
return {
|
979
|
+
succeeded: false,
|
980
|
+
...e.response?.parsedHeaders,
|
981
|
+
_response: e.response,
|
982
|
+
};
|
865
983
|
}
|
866
984
|
throw e;
|
867
985
|
}
|
@@ -877,7 +995,11 @@ export class ShareDirectoryClient extends StorageClient {
|
|
877
995
|
*/
|
878
996
|
async setMetadata(metadata, options = {}) {
|
879
997
|
return tracingClient.withSpan("ShareDirectoryClient-setMetadata", options, async (updatedOptions) => {
|
880
|
-
return assertResponse(await this.context.setMetadata(
|
998
|
+
return assertResponse(await this.context.setMetadata({
|
999
|
+
...updatedOptions,
|
1000
|
+
metadata,
|
1001
|
+
...this.shareClientConfig,
|
1002
|
+
}));
|
881
1003
|
});
|
882
1004
|
}
|
883
1005
|
/**
|
@@ -892,52 +1014,35 @@ export class ShareDirectoryClient extends StorageClient {
|
|
892
1014
|
* items. The marker value is opaque to the client.
|
893
1015
|
* @param options - Options to list files and directories operation.
|
894
1016
|
*/
|
895
|
-
iterateFilesAndDirectoriesSegments(
|
896
|
-
|
897
|
-
|
898
|
-
|
899
|
-
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
|
904
|
-
|
905
|
-
} while (marker);
|
906
|
-
});
|
1017
|
+
async *iterateFilesAndDirectoriesSegments(marker, options = {}) {
|
1018
|
+
if (options.prefix === "") {
|
1019
|
+
options.prefix = undefined;
|
1020
|
+
}
|
1021
|
+
let listFilesAndDirectoriesResponse;
|
1022
|
+
do {
|
1023
|
+
listFilesAndDirectoriesResponse = await this.listFilesAndDirectoriesSegment(marker, options);
|
1024
|
+
marker = listFilesAndDirectoriesResponse.continuationToken;
|
1025
|
+
yield await listFilesAndDirectoriesResponse;
|
1026
|
+
} while (marker);
|
907
1027
|
}
|
908
1028
|
/**
|
909
1029
|
* Returns an AsyncIterableIterator for file and directory items
|
910
1030
|
*
|
911
1031
|
* @param options - Options to list files and directories operation.
|
912
1032
|
*/
|
913
|
-
listFilesAndDirectoriesItems() {
|
914
|
-
|
915
|
-
|
916
|
-
|
917
|
-
|
918
|
-
|
919
|
-
|
920
|
-
|
921
|
-
for (var _d = true, _e = __asyncValues(this.iterateFilesAndDirectoriesSegments(marker, options)), _f; _f = yield __await(_e.next()), _a = _f.done, !_a; _d = true) {
|
922
|
-
_c = _f.value;
|
923
|
-
_d = false;
|
924
|
-
const listFilesAndDirectoriesResponse = _c;
|
925
|
-
for (const file of listFilesAndDirectoriesResponse.segment.fileItems) {
|
926
|
-
yield yield __await(Object.assign({ kind: "file" }, file));
|
927
|
-
}
|
928
|
-
for (const directory of listFilesAndDirectoriesResponse.segment.directoryItems) {
|
929
|
-
yield yield __await(Object.assign({ kind: "directory" }, directory));
|
930
|
-
}
|
931
|
-
}
|
1033
|
+
async *listFilesAndDirectoriesItems(options = {}) {
|
1034
|
+
if (options.prefix === "") {
|
1035
|
+
options.prefix = undefined;
|
1036
|
+
}
|
1037
|
+
let marker;
|
1038
|
+
for await (const listFilesAndDirectoriesResponse of this.iterateFilesAndDirectoriesSegments(marker, options)) {
|
1039
|
+
for (const file of listFilesAndDirectoriesResponse.segment.fileItems) {
|
1040
|
+
yield { kind: "file", ...file };
|
932
1041
|
}
|
933
|
-
|
934
|
-
|
935
|
-
try {
|
936
|
-
if (!_d && !_a && (_b = _e.return)) yield __await(_b.call(_e));
|
937
|
-
}
|
938
|
-
finally { if (e_1) throw e_1.error; }
|
1042
|
+
for (const directory of listFilesAndDirectoriesResponse.segment.directoryItems) {
|
1043
|
+
yield { kind: "directory", ...directory };
|
939
1044
|
}
|
940
|
-
}
|
1045
|
+
}
|
941
1046
|
}
|
942
1047
|
/**
|
943
1048
|
* Returns an async iterable iterator to list all the files and directories
|
@@ -1105,7 +1210,10 @@ export class ShareDirectoryClient extends StorageClient {
|
|
1105
1210
|
if (options.prefix === "") {
|
1106
1211
|
options.prefix = undefined;
|
1107
1212
|
}
|
1108
|
-
const updatedOptions =
|
1213
|
+
const updatedOptions = {
|
1214
|
+
...options,
|
1215
|
+
...(include.length > 0 ? { include: include } : {}),
|
1216
|
+
};
|
1109
1217
|
// AsyncIterableIterator to iterate over files and directories
|
1110
1218
|
const iter = this.listFilesAndDirectoriesItems(updatedOptions);
|
1111
1219
|
return {
|
@@ -1125,7 +1233,10 @@ export class ShareDirectoryClient extends StorageClient {
|
|
1125
1233
|
* Return an AsyncIterableIterator that works a page at a time
|
1126
1234
|
*/
|
1127
1235
|
byPage: (settings = {}) => {
|
1128
|
-
return this.iterateFilesAndDirectoriesSegments(removeEmptyString(settings.continuationToken),
|
1236
|
+
return this.iterateFilesAndDirectoriesSegments(removeEmptyString(settings.continuationToken), {
|
1237
|
+
maxResults: settings.maxPageSize,
|
1238
|
+
...updatedOptions,
|
1239
|
+
});
|
1129
1240
|
},
|
1130
1241
|
};
|
1131
1242
|
}
|
@@ -1143,8 +1254,18 @@ export class ShareDirectoryClient extends StorageClient {
|
|
1143
1254
|
options.prefix = undefined;
|
1144
1255
|
}
|
1145
1256
|
return tracingClient.withSpan("ShareDirectoryClient-listFilesAndDirectoriesSegment", options, async (updatedOptions) => {
|
1146
|
-
const rawResponse = assertResponse(await this.context.listFilesAndDirectoriesSegment(
|
1147
|
-
|
1257
|
+
const rawResponse = assertResponse(await this.context.listFilesAndDirectoriesSegment({
|
1258
|
+
...updatedOptions,
|
1259
|
+
marker,
|
1260
|
+
...this.shareClientConfig,
|
1261
|
+
}));
|
1262
|
+
const wrappedResponse = {
|
1263
|
+
...ConvertInternalResponseOfListFiles(rawResponse),
|
1264
|
+
_response: {
|
1265
|
+
...rawResponse._response,
|
1266
|
+
parsedBody: ConvertInternalResponseOfListFiles(rawResponse._response.parsedBody),
|
1267
|
+
}, // _response is made non-enumerable
|
1268
|
+
};
|
1148
1269
|
return wrappedResponse;
|
1149
1270
|
});
|
1150
1271
|
}
|
@@ -1158,47 +1279,30 @@ export class ShareDirectoryClient extends StorageClient {
|
|
1158
1279
|
* set of list items.
|
1159
1280
|
* @param options - Options to list handles operation.
|
1160
1281
|
*/
|
1161
|
-
iterateHandleSegments(
|
1162
|
-
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1167
|
-
|
1168
|
-
|
1169
|
-
|
1170
|
-
}
|
1171
|
-
});
|
1282
|
+
async *iterateHandleSegments(marker, options = {}) {
|
1283
|
+
let listHandlesResponse;
|
1284
|
+
if (!!marker || marker === undefined) {
|
1285
|
+
do {
|
1286
|
+
listHandlesResponse = await this.listHandlesSegment(marker, options);
|
1287
|
+
marker = listHandlesResponse.continuationToken;
|
1288
|
+
yield await listHandlesResponse;
|
1289
|
+
} while (marker);
|
1290
|
+
}
|
1172
1291
|
}
|
1173
1292
|
/**
|
1174
1293
|
* Returns an AsyncIterableIterator for handles
|
1175
1294
|
*
|
1176
1295
|
* @param options - Options to list handles operation.
|
1177
1296
|
*/
|
1178
|
-
listHandleItems() {
|
1179
|
-
|
1180
|
-
|
1181
|
-
|
1182
|
-
|
1183
|
-
|
1184
|
-
_c = _f.value;
|
1185
|
-
_d = false;
|
1186
|
-
const listHandlesResponse = _c;
|
1187
|
-
if (listHandlesResponse.handleList) {
|
1188
|
-
for (const handle of listHandlesResponse.handleList) {
|
1189
|
-
yield yield __await(handle);
|
1190
|
-
}
|
1191
|
-
}
|
1297
|
+
async *listHandleItems(options = {}) {
|
1298
|
+
let marker;
|
1299
|
+
for await (const listHandlesResponse of this.iterateHandleSegments(marker, options)) {
|
1300
|
+
if (listHandlesResponse.handleList) {
|
1301
|
+
for (const handle of listHandlesResponse.handleList) {
|
1302
|
+
yield handle;
|
1192
1303
|
}
|
1193
1304
|
}
|
1194
|
-
|
1195
|
-
finally {
|
1196
|
-
try {
|
1197
|
-
if (!_d && !_a && (_b = _e.return)) yield __await(_b.call(_e));
|
1198
|
-
}
|
1199
|
-
finally { if (e_2) throw e_2.error; }
|
1200
|
-
}
|
1201
|
-
});
|
1305
|
+
}
|
1202
1306
|
}
|
1203
1307
|
/**
|
1204
1308
|
* Returns an async iterable iterator to list all the handles.
|
@@ -1343,7 +1447,10 @@ export class ShareDirectoryClient extends StorageClient {
|
|
1343
1447
|
* Return an AsyncIterableIterator that works a page at a time
|
1344
1448
|
*/
|
1345
1449
|
byPage: (settings = {}) => {
|
1346
|
-
return this.iterateHandleSegments(removeEmptyString(settings.continuationToken),
|
1450
|
+
return this.iterateHandleSegments(removeEmptyString(settings.continuationToken), {
|
1451
|
+
maxResults: settings.maxPageSize,
|
1452
|
+
...options,
|
1453
|
+
});
|
1347
1454
|
},
|
1348
1455
|
};
|
1349
1456
|
}
|
@@ -1361,13 +1468,23 @@ export class ShareDirectoryClient extends StorageClient {
|
|
1361
1468
|
async listHandlesSegment(marker, options = {}) {
|
1362
1469
|
return tracingClient.withSpan("ShareDirectoryClient-listHandlesSegment", options, async (updatedOptions) => {
|
1363
1470
|
marker = marker === "" ? undefined : marker;
|
1364
|
-
const response = assertResponse(await this.context.listHandles(
|
1471
|
+
const response = assertResponse(await this.context.listHandles({
|
1472
|
+
...updatedOptions,
|
1473
|
+
marker,
|
1474
|
+
...this.shareClientConfig,
|
1475
|
+
}));
|
1365
1476
|
// TODO: Protocol layer issue that when handle list is in returned XML
|
1366
1477
|
// response.handleList is an empty string
|
1367
1478
|
if (response.handleList === "") {
|
1368
1479
|
response.handleList = undefined;
|
1369
1480
|
}
|
1370
|
-
const wrappedResponse =
|
1481
|
+
const wrappedResponse = {
|
1482
|
+
...ConvertInternalResponseOfListHandles(response),
|
1483
|
+
_response: {
|
1484
|
+
...response._response,
|
1485
|
+
parsedBody: ConvertInternalResponseOfListHandles(response._response.parsedBody),
|
1486
|
+
},
|
1487
|
+
};
|
1371
1488
|
return wrappedResponse;
|
1372
1489
|
});
|
1373
1490
|
}
|
@@ -1384,12 +1501,19 @@ export class ShareDirectoryClient extends StorageClient {
|
|
1384
1501
|
*/
|
1385
1502
|
async forceCloseHandlesSegment(marker, options = {}) {
|
1386
1503
|
return tracingClient.withSpan("ShareDirectoryClient-forceCloseHandlesSegment", options, async (updatedOptions) => {
|
1387
|
-
var _a, _b;
|
1388
1504
|
if (marker === "") {
|
1389
1505
|
marker = undefined;
|
1390
1506
|
}
|
1391
|
-
const rawResponse = assertResponse(await this.context.forceCloseHandles("*",
|
1392
|
-
|
1507
|
+
const rawResponse = assertResponse(await this.context.forceCloseHandles("*", {
|
1508
|
+
...updatedOptions,
|
1509
|
+
marker,
|
1510
|
+
...this.shareClientConfig,
|
1511
|
+
}));
|
1512
|
+
return {
|
1513
|
+
...rawResponse,
|
1514
|
+
closedHandlesCount: rawResponse.numberOfHandlesClosed ?? 0,
|
1515
|
+
closeFailureCount: rawResponse.numberOfHandlesFailedToClose ?? 0,
|
1516
|
+
};
|
1393
1517
|
});
|
1394
1518
|
}
|
1395
1519
|
/**
|
@@ -1434,7 +1558,10 @@ export class ShareDirectoryClient extends StorageClient {
|
|
1434
1558
|
if (handleId === "*") {
|
1435
1559
|
throw new RangeError(`Parameter handleID should be a specified handle ID. Use forceCloseHandlesSegment() to close all handles.`);
|
1436
1560
|
}
|
1437
|
-
const rawResponse = await this.context.forceCloseHandles(handleId,
|
1561
|
+
const rawResponse = await this.context.forceCloseHandles(handleId, {
|
1562
|
+
...updatedOptions,
|
1563
|
+
...this.shareClientConfig,
|
1564
|
+
});
|
1438
1565
|
const response = rawResponse;
|
1439
1566
|
response.closedHandlesCount = rawResponse.numberOfHandlesClosed || 0;
|
1440
1567
|
response.closeFailureCount = rawResponse.numberOfHandlesFailedToClose || 0;
|
@@ -1490,15 +1617,20 @@ export class ShareDirectoryClient extends StorageClient {
|
|
1490
1617
|
}
|
1491
1618
|
const destDirectory = new ShareDirectoryClient(destinationUrl, this.pipeline, this.shareClientConfig);
|
1492
1619
|
return tracingClient.withSpan("ShareDirectoryClient-rename", options, async (updatedOptions) => {
|
1493
|
-
const response = assertResponse(await destDirectory.context.rename(this.url,
|
1620
|
+
const response = assertResponse(await destDirectory.context.rename(this.url, {
|
1621
|
+
...updatedOptions,
|
1622
|
+
sourceLeaseAccessConditions: updatedOptions.sourceLeaseAccessConditions
|
1494
1623
|
? {
|
1495
1624
|
sourceLeaseId: updatedOptions.sourceLeaseAccessConditions.leaseId,
|
1496
1625
|
}
|
1497
|
-
: undefined,
|
1626
|
+
: undefined,
|
1627
|
+
destinationLeaseAccessConditions: updatedOptions.destinationLeaseAccessConditions
|
1498
1628
|
? {
|
1499
1629
|
destinationLeaseId: updatedOptions.destinationLeaseAccessConditions.leaseId,
|
1500
1630
|
}
|
1501
|
-
: undefined
|
1631
|
+
: undefined,
|
1632
|
+
...this.shareClientConfig,
|
1633
|
+
}));
|
1502
1634
|
return {
|
1503
1635
|
destinationDirectoryClient: destDirectory,
|
1504
1636
|
directoryRenameResponse: response,
|
@@ -1510,6 +1642,14 @@ export class ShareDirectoryClient extends StorageClient {
|
|
1510
1642
|
* A ShareFileClient represents a URL to an Azure Storage file.
|
1511
1643
|
*/
|
1512
1644
|
export class ShareFileClient extends StorageClient {
|
1645
|
+
/**
|
1646
|
+
* context provided by protocol layer.
|
1647
|
+
*/
|
1648
|
+
context;
|
1649
|
+
_shareName;
|
1650
|
+
_path;
|
1651
|
+
_name;
|
1652
|
+
shareClientConfig;
|
1513
1653
|
/**
|
1514
1654
|
* The share name corresponding to this file client
|
1515
1655
|
*/
|
@@ -1607,16 +1747,30 @@ export class ShareFileClient extends StorageClient {
|
|
1607
1747
|
options = validateAndSetDefaultsForFileAndDirectoryCreateCommonOptions(options);
|
1608
1748
|
options.fileHttpHeaders = options.fileHttpHeaders || {};
|
1609
1749
|
return tracingClient.withSpan("ShareFileClient-create", options, async (updatedOptions) => {
|
1610
|
-
|
1611
|
-
|
1750
|
+
const rawResponse = await this.context.create(size, {
|
1751
|
+
...updatedOptions,
|
1752
|
+
fileChangeOn: fileChangeTimeToString(updatedOptions.changeTime),
|
1753
|
+
fileCreatedOn: fileCreationTimeToString(updatedOptions.creationTime),
|
1754
|
+
fileLastWriteOn: fileLastWriteTimeToString(updatedOptions.lastWriteTime),
|
1755
|
+
fileAttributes: updatedOptions.fileAttributes
|
1612
1756
|
? fileAttributesToString(updatedOptions.fileAttributes)
|
1613
|
-
: undefined,
|
1614
|
-
|
1757
|
+
: undefined,
|
1758
|
+
owner: updatedOptions.posixProperties?.owner,
|
1759
|
+
group: updatedOptions.posixProperties?.group,
|
1760
|
+
fileMode: toOctalFileMode(updatedOptions.posixProperties?.fileMode),
|
1761
|
+
nfsFileType: updatedOptions.posixProperties?.fileType,
|
1762
|
+
...this.shareClientConfig,
|
1763
|
+
});
|
1764
|
+
const wrappedRes = {
|
1765
|
+
...rawResponse,
|
1766
|
+
_response: rawResponse._response, // _response is made non-enumerable,
|
1767
|
+
posixProperties: {
|
1615
1768
|
fileMode: parseOctalFileMode(rawResponse.fileMode),
|
1616
1769
|
fileType: rawResponse.nfsFileType,
|
1617
1770
|
owner: rawResponse.owner,
|
1618
1771
|
group: rawResponse.group,
|
1619
|
-
}
|
1772
|
+
},
|
1773
|
+
};
|
1620
1774
|
return assertResponse(wrappedRes);
|
1621
1775
|
});
|
1622
1776
|
}
|
@@ -1706,15 +1860,24 @@ export class ShareFileClient extends StorageClient {
|
|
1706
1860
|
throw new RangeError(`rangeGetContentMD5 only works with partial data downloading`);
|
1707
1861
|
}
|
1708
1862
|
const downloadFullFile = offset === 0 && !count;
|
1709
|
-
const rawResponse = await this.context.download(
|
1863
|
+
const rawResponse = await this.context.download({
|
1864
|
+
...updatedOptions,
|
1865
|
+
requestOptions: {
|
1710
1866
|
onDownloadProgress: isNodeLike ? undefined : updatedOptions.onProgress, // for Node.js, progress is reported by RetriableReadableStream
|
1711
|
-
},
|
1712
|
-
|
1867
|
+
},
|
1868
|
+
range: downloadFullFile ? undefined : rangeToString({ offset, count }),
|
1869
|
+
...this.shareClientConfig,
|
1870
|
+
});
|
1871
|
+
const res = assertResponse({
|
1872
|
+
...rawResponse,
|
1873
|
+
_response: rawResponse._response, // _response is made non-enumerable,
|
1874
|
+
posixProperties: {
|
1713
1875
|
fileMode: parseOctalFileMode(rawResponse.fileMode),
|
1714
1876
|
owner: rawResponse.owner,
|
1715
1877
|
group: rawResponse.group,
|
1716
1878
|
linkCount: rawResponse.linkCount,
|
1717
|
-
}
|
1879
|
+
},
|
1880
|
+
});
|
1718
1881
|
// Return browser response immediately
|
1719
1882
|
if (!isNodeLike) {
|
1720
1883
|
return res;
|
@@ -1744,7 +1907,11 @@ export class ShareFileClient extends StorageClient {
|
|
1744
1907
|
// chunkDownloadOptions.range
|
1745
1908
|
// }, options: ${JSON.stringify(chunkDownloadOptions)}`
|
1746
1909
|
// );
|
1747
|
-
const downloadRes = await this.context.download(
|
1910
|
+
const downloadRes = await this.context.download({
|
1911
|
+
...updatedOptions,
|
1912
|
+
...updatedDownloadOptions,
|
1913
|
+
...this.shareClientConfig, // TODO: confirm whether this is needed
|
1914
|
+
});
|
1748
1915
|
if (!(downloadRes.etag === res.etag)) {
|
1749
1916
|
throw new Error("File has been modified concurrently");
|
1750
1917
|
}
|
@@ -1788,14 +1955,21 @@ export class ShareFileClient extends StorageClient {
|
|
1788
1955
|
*/
|
1789
1956
|
async getProperties(options = {}) {
|
1790
1957
|
return tracingClient.withSpan("ShareFileClient-getProperties", options, async (updatedOptions) => {
|
1791
|
-
const rawResponse = await this.context.getProperties(
|
1792
|
-
|
1958
|
+
const rawResponse = await this.context.getProperties({
|
1959
|
+
...updatedOptions,
|
1960
|
+
...this.shareClientConfig,
|
1961
|
+
});
|
1962
|
+
return assertResponse({
|
1963
|
+
...rawResponse,
|
1964
|
+
_response: rawResponse._response, // _response is made non-enumerable,
|
1965
|
+
posixProperties: {
|
1793
1966
|
fileMode: parseOctalFileMode(rawResponse.fileMode),
|
1794
1967
|
fileType: rawResponse.nfsFileType,
|
1795
1968
|
owner: rawResponse.owner,
|
1796
1969
|
group: rawResponse.group,
|
1797
1970
|
linkCount: rawResponse.linkCount,
|
1798
|
-
}
|
1971
|
+
},
|
1972
|
+
});
|
1799
1973
|
});
|
1800
1974
|
}
|
1801
1975
|
/**
|
@@ -1811,16 +1985,29 @@ export class ShareFileClient extends StorageClient {
|
|
1811
1985
|
properties = validateAndSetDefaultsForFileAndDirectorySetPropertiesCommonOptions(properties);
|
1812
1986
|
properties.fileHttpHeaders = properties.fileHttpHeaders || {};
|
1813
1987
|
return tracingClient.withSpan("ShareFileClient-setProperties", properties, async (updatedOptions) => {
|
1814
|
-
|
1815
|
-
|
1988
|
+
const rawResponse = await this.context.setHttpHeaders({
|
1989
|
+
...updatedOptions,
|
1990
|
+
fileChangeOn: fileChangeTimeToString(updatedOptions.changeTime),
|
1991
|
+
fileCreatedOn: fileCreationTimeToString(updatedOptions.creationTime),
|
1992
|
+
fileLastWriteOn: fileLastWriteTimeToString(updatedOptions.lastWriteTime),
|
1993
|
+
fileAttributes: updatedOptions.fileAttributes
|
1816
1994
|
? fileAttributesToString(updatedOptions.fileAttributes)
|
1817
|
-
: undefined,
|
1818
|
-
|
1995
|
+
: undefined,
|
1996
|
+
owner: updatedOptions.posixProperties?.owner,
|
1997
|
+
group: updatedOptions.posixProperties?.group,
|
1998
|
+
fileMode: toOctalFileMode(updatedOptions.posixProperties?.fileMode),
|
1999
|
+
...this.shareClientConfig,
|
2000
|
+
});
|
2001
|
+
return assertResponse({
|
2002
|
+
...rawResponse,
|
2003
|
+
_response: rawResponse._response, // _response is made non-enumerable,
|
2004
|
+
posixProperties: {
|
1819
2005
|
fileMode: parseOctalFileMode(rawResponse.fileMode),
|
1820
2006
|
owner: rawResponse.owner,
|
1821
2007
|
group: rawResponse.group,
|
1822
2008
|
linkCount: rawResponse.linkCount,
|
1823
|
-
}
|
2009
|
+
},
|
2010
|
+
});
|
1824
2011
|
});
|
1825
2012
|
}
|
1826
2013
|
/**
|
@@ -1842,7 +2029,7 @@ export class ShareFileClient extends StorageClient {
|
|
1842
2029
|
*/
|
1843
2030
|
async delete(options = {}) {
|
1844
2031
|
return tracingClient.withSpan("ShareFileClient-delete", options, async (updatedOptions) => {
|
1845
|
-
return assertResponse(await this.context.delete(
|
2032
|
+
return assertResponse(await this.context.delete({ ...updatedOptions, ...this.shareClientConfig }));
|
1846
2033
|
});
|
1847
2034
|
}
|
1848
2035
|
/**
|
@@ -1863,15 +2050,21 @@ export class ShareFileClient extends StorageClient {
|
|
1863
2050
|
*/
|
1864
2051
|
async deleteIfExists(options = {}) {
|
1865
2052
|
return tracingClient.withSpan("ShareFileClient-deleteIfExists", options, async (updatedOptions) => {
|
1866
|
-
var _a, _b, _c;
|
1867
2053
|
try {
|
1868
2054
|
const res = await this.delete(updatedOptions);
|
1869
|
-
return
|
2055
|
+
return {
|
2056
|
+
succeeded: true,
|
2057
|
+
...res,
|
2058
|
+
};
|
1870
2059
|
}
|
1871
2060
|
catch (e) {
|
1872
|
-
if (
|
1873
|
-
|
1874
|
-
return
|
2061
|
+
if (e.details?.errorCode === "ResourceNotFound" ||
|
2062
|
+
e.details?.errorCode === "ParentNotFound") {
|
2063
|
+
return {
|
2064
|
+
succeeded: false,
|
2065
|
+
...e.response?.parsedHeaders,
|
2066
|
+
_response: e.response,
|
2067
|
+
};
|
1875
2068
|
}
|
1876
2069
|
throw e;
|
1877
2070
|
}
|
@@ -1893,16 +2086,30 @@ export class ShareFileClient extends StorageClient {
|
|
1893
2086
|
// FileAttributes, filePermission, createTime, lastWriteTime will all be preserved
|
1894
2087
|
options = validateAndSetDefaultsForFileAndDirectorySetPropertiesCommonOptions(options);
|
1895
2088
|
return tracingClient.withSpan("ShareFileClient-setHTTPHeaders", options, async (updatedOptions) => {
|
1896
|
-
|
1897
|
-
|
2089
|
+
const rawResponse = await this.context.setHttpHeaders({
|
2090
|
+
...updatedOptions,
|
2091
|
+
fileHttpHeaders,
|
2092
|
+
fileCreatedOn: fileCreationTimeToString(updatedOptions.creationTime),
|
2093
|
+
fileLastWriteOn: fileLastWriteTimeToString(updatedOptions.lastWriteTime),
|
2094
|
+
fileChangeOn: fileChangeTimeToString(updatedOptions.changeTime),
|
2095
|
+
fileAttributes: updatedOptions.fileAttributes
|
1898
2096
|
? fileAttributesToString(updatedOptions.fileAttributes)
|
1899
|
-
: undefined,
|
1900
|
-
|
2097
|
+
: undefined,
|
2098
|
+
owner: updatedOptions.posixProperties?.owner,
|
2099
|
+
group: updatedOptions.posixProperties?.group,
|
2100
|
+
fileMode: toOctalFileMode(updatedOptions.posixProperties?.fileMode),
|
2101
|
+
...this.shareClientConfig,
|
2102
|
+
});
|
2103
|
+
return assertResponse({
|
2104
|
+
...rawResponse,
|
2105
|
+
_response: rawResponse._response, // _response is made non-enumerable,
|
2106
|
+
posixProperties: {
|
1901
2107
|
fileMode: parseOctalFileMode(rawResponse.fileMode),
|
1902
2108
|
owner: rawResponse.owner,
|
1903
2109
|
group: rawResponse.group,
|
1904
2110
|
linkCount: rawResponse.linkCount,
|
1905
|
-
}
|
2111
|
+
},
|
2112
|
+
});
|
1906
2113
|
});
|
1907
2114
|
}
|
1908
2115
|
/**
|
@@ -1923,14 +2130,28 @@ export class ShareFileClient extends StorageClient {
|
|
1923
2130
|
// FileAttributes, filePermission, createTime, lastWriteTime will all be preserved.
|
1924
2131
|
options = validateAndSetDefaultsForFileAndDirectorySetPropertiesCommonOptions(options);
|
1925
2132
|
return tracingClient.withSpan("ShareFileClient-resize", options, async (updatedOptions) => {
|
1926
|
-
|
1927
|
-
|
1928
|
-
|
2133
|
+
const rawResponse = await this.context.setHttpHeaders({
|
2134
|
+
...updatedOptions,
|
2135
|
+
fileContentLength: length,
|
2136
|
+
fileChangeOn: fileChangeTimeToString(options.changeTime),
|
2137
|
+
fileCreatedOn: fileCreationTimeToString(options.creationTime),
|
2138
|
+
fileLastWriteOn: fileLastWriteTimeToString(options.lastWriteTime),
|
2139
|
+
fileAttributes: fileAttributesToString(updatedOptions.fileAttributes),
|
2140
|
+
owner: updatedOptions.posixProperties?.owner,
|
2141
|
+
group: updatedOptions.posixProperties?.group,
|
2142
|
+
fileMode: toOctalFileMode(options.posixProperties?.fileMode),
|
2143
|
+
...this.shareClientConfig,
|
2144
|
+
});
|
2145
|
+
return assertResponse({
|
2146
|
+
...rawResponse,
|
2147
|
+
_response: rawResponse._response,
|
2148
|
+
posixProperties: {
|
1929
2149
|
fileMode: parseOctalFileMode(rawResponse.fileMode),
|
1930
2150
|
owner: rawResponse.owner,
|
1931
2151
|
group: rawResponse.group,
|
1932
2152
|
linkCount: rawResponse.linkCount,
|
1933
|
-
}
|
2153
|
+
},
|
2154
|
+
});
|
1934
2155
|
});
|
1935
2156
|
}
|
1936
2157
|
/**
|
@@ -1946,7 +2167,11 @@ export class ShareFileClient extends StorageClient {
|
|
1946
2167
|
*/
|
1947
2168
|
async setMetadata(metadata = {}, options = {}) {
|
1948
2169
|
return tracingClient.withSpan("ShareFileClient-setMetadata", options, async (updatedOptions) => {
|
1949
|
-
return assertResponse(await this.context.setMetadata(
|
2170
|
+
return assertResponse(await this.context.setMetadata({
|
2171
|
+
...updatedOptions,
|
2172
|
+
metadata,
|
2173
|
+
...this.shareClientConfig,
|
2174
|
+
}));
|
1950
2175
|
});
|
1951
2176
|
}
|
1952
2177
|
/**
|
@@ -2002,9 +2227,14 @@ export class ShareFileClient extends StorageClient {
|
|
2002
2227
|
if (contentLength > FILE_RANGE_MAX_SIZE_BYTES) {
|
2003
2228
|
throw new RangeError(`offset must be < ${FILE_RANGE_MAX_SIZE_BYTES} bytes`);
|
2004
2229
|
}
|
2005
|
-
return assertResponse(await this.context.uploadRange(rangeToString({ count: contentLength, offset }), "update", contentLength,
|
2230
|
+
return assertResponse(await this.context.uploadRange(rangeToString({ count: contentLength, offset }), "update", contentLength, {
|
2231
|
+
...updatedOptions,
|
2232
|
+
requestOptions: {
|
2006
2233
|
onUploadProgress: updatedOptions.onProgress,
|
2007
|
-
},
|
2234
|
+
},
|
2235
|
+
body,
|
2236
|
+
...this.shareClientConfig,
|
2237
|
+
}));
|
2008
2238
|
});
|
2009
2239
|
}
|
2010
2240
|
/**
|
@@ -2025,7 +2255,13 @@ export class ShareFileClient extends StorageClient {
|
|
2025
2255
|
if (count <= 0 || count > FILE_RANGE_MAX_SIZE_BYTES) {
|
2026
2256
|
throw new RangeError(`count must be > 0 and <= ${FILE_RANGE_MAX_SIZE_BYTES} bytes`);
|
2027
2257
|
}
|
2028
|
-
return assertResponse(await this.context.uploadRangeFromURL(rangeToString({ offset: destOffset, count }), sourceURL, 0,
|
2258
|
+
return assertResponse(await this.context.uploadRangeFromURL(rangeToString({ offset: destOffset, count }), sourceURL, 0, {
|
2259
|
+
...updatedOptions,
|
2260
|
+
sourceRange: rangeToString({ offset: sourceOffset, count }),
|
2261
|
+
sourceModifiedAccessConditions: updatedOptions.sourceConditions,
|
2262
|
+
copySourceAuthorization: httpAuthorizationToString(updatedOptions.sourceAuthorization),
|
2263
|
+
...this.shareClientConfig,
|
2264
|
+
}));
|
2029
2265
|
});
|
2030
2266
|
}
|
2031
2267
|
/**
|
@@ -2041,7 +2277,7 @@ export class ShareFileClient extends StorageClient {
|
|
2041
2277
|
if (offset < 0 || contentLength <= 0) {
|
2042
2278
|
throw new RangeError(`offset must >= 0 and contentLength must be > 0`);
|
2043
2279
|
}
|
2044
|
-
return assertResponse(await this.context.uploadRange(rangeToString({ count: contentLength, offset }), "clear", 0,
|
2280
|
+
return assertResponse(await this.context.uploadRange(rangeToString({ count: contentLength, offset }), "clear", 0, { ...updatedOptions, ...this.shareClientConfig }));
|
2045
2281
|
});
|
2046
2282
|
}
|
2047
2283
|
/**
|
@@ -2051,12 +2287,20 @@ export class ShareFileClient extends StorageClient {
|
|
2051
2287
|
*/
|
2052
2288
|
async getRangeList(options = {}) {
|
2053
2289
|
return tracingClient.withSpan("ShareFileClient-getRangeList", options, async (updatedOptions) => {
|
2054
|
-
const originalResponse = assertResponse(await this.context.getRangeList(
|
2290
|
+
const originalResponse = assertResponse(await this.context.getRangeList({
|
2291
|
+
...updatedOptions,
|
2292
|
+
range: updatedOptions.range ? rangeToString(updatedOptions.range) : undefined,
|
2293
|
+
...this.shareClientConfig,
|
2294
|
+
}));
|
2055
2295
|
// Only returns ranges, ignoring clearRanges.
|
2056
2296
|
const parsedBody = originalResponse._response.parsedBody.ranges
|
2057
2297
|
? originalResponse._response.parsedBody.ranges
|
2058
2298
|
: [];
|
2059
|
-
return
|
2299
|
+
return {
|
2300
|
+
...originalResponse,
|
2301
|
+
_response: { ...originalResponse._response, parsedBody },
|
2302
|
+
rangeList: originalResponse.ranges ? originalResponse.ranges : [],
|
2303
|
+
};
|
2060
2304
|
});
|
2061
2305
|
}
|
2062
2306
|
/**
|
@@ -2067,7 +2311,13 @@ export class ShareFileClient extends StorageClient {
|
|
2067
2311
|
*/
|
2068
2312
|
async getRangeListDiff(prevShareSnapshot, options = {}) {
|
2069
2313
|
return tracingClient.withSpan("ShareFileClient-getRangeListDiff", options, async (updatedOptions) => {
|
2070
|
-
return assertResponse(await this.context.getRangeList(
|
2314
|
+
return assertResponse(await this.context.getRangeList({
|
2315
|
+
...updatedOptions,
|
2316
|
+
prevsharesnapshot: prevShareSnapshot,
|
2317
|
+
supportRename: options.includeRenames,
|
2318
|
+
range: updatedOptions.range ? rangeToString(updatedOptions.range) : undefined,
|
2319
|
+
...this.shareClientConfig,
|
2320
|
+
}));
|
2071
2321
|
});
|
2072
2322
|
}
|
2073
2323
|
/**
|
@@ -2084,8 +2334,15 @@ export class ShareFileClient extends StorageClient {
|
|
2084
2334
|
*/
|
2085
2335
|
async startCopyFromURL(copySource, options = {}) {
|
2086
2336
|
return tracingClient.withSpan("ShareFileClient-startCopyFromURL", options, async (updatedOptions) => {
|
2087
|
-
|
2088
|
-
|
2337
|
+
return assertResponse(await this.context.startCopy(copySource, {
|
2338
|
+
...updatedOptions,
|
2339
|
+
...this.shareClientConfig,
|
2340
|
+
owner: updatedOptions.posixProperties?.owner,
|
2341
|
+
group: updatedOptions.posixProperties?.group,
|
2342
|
+
fileMode: toOctalFileMode(updatedOptions.posixProperties?.fileMode),
|
2343
|
+
fileModeCopyMode: updatedOptions.fileModeCopyMode,
|
2344
|
+
fileOwnerCopyMode: updatedOptions.fileOwnerCopyMode,
|
2345
|
+
}));
|
2089
2346
|
});
|
2090
2347
|
}
|
2091
2348
|
/**
|
@@ -2098,7 +2355,7 @@ export class ShareFileClient extends StorageClient {
|
|
2098
2355
|
*/
|
2099
2356
|
async abortCopyFromURL(copyId, options = {}) {
|
2100
2357
|
return tracingClient.withSpan("ShareFileClient-abortCopyFromURL", options, async (updatedOptions) => {
|
2101
|
-
return assertResponse(await this.context.abortCopy(copyId,
|
2358
|
+
return assertResponse(await this.context.abortCopy(copyId, { ...updatedOptions, ...this.shareClientConfig }));
|
2102
2359
|
});
|
2103
2360
|
}
|
2104
2361
|
// High Level functions
|
@@ -2436,13 +2693,23 @@ export class ShareFileClient extends StorageClient {
|
|
2436
2693
|
async listHandlesSegment(marker, options = {}) {
|
2437
2694
|
return tracingClient.withSpan("ShareFileClient-listHandlesSegment", options, async (updatedOptions) => {
|
2438
2695
|
marker = marker === "" ? undefined : marker;
|
2439
|
-
const response = assertResponse(await this.context.listHandles(
|
2696
|
+
const response = assertResponse(await this.context.listHandles({
|
2697
|
+
...updatedOptions,
|
2698
|
+
...this.shareClientConfig,
|
2699
|
+
marker,
|
2700
|
+
}));
|
2440
2701
|
// TODO: Protocol layer issue that when handle list is in returned XML
|
2441
2702
|
// response.handleList is an empty string
|
2442
2703
|
if (response.handleList === "") {
|
2443
2704
|
response.handleList = undefined;
|
2444
2705
|
}
|
2445
|
-
const wrappedResponse =
|
2706
|
+
const wrappedResponse = {
|
2707
|
+
...ConvertInternalResponseOfListHandles(response),
|
2708
|
+
_response: {
|
2709
|
+
...response._response,
|
2710
|
+
parsedBody: ConvertInternalResponseOfListHandles(response._response.parsedBody),
|
2711
|
+
},
|
2712
|
+
};
|
2446
2713
|
return wrappedResponse;
|
2447
2714
|
});
|
2448
2715
|
}
|
@@ -2456,47 +2723,30 @@ export class ShareFileClient extends StorageClient {
|
|
2456
2723
|
* set of list items.
|
2457
2724
|
* @param options - Options to list handles operation.
|
2458
2725
|
*/
|
2459
|
-
iterateHandleSegments(
|
2460
|
-
|
2461
|
-
|
2462
|
-
|
2463
|
-
|
2464
|
-
|
2465
|
-
|
2466
|
-
|
2467
|
-
|
2468
|
-
}
|
2469
|
-
});
|
2726
|
+
async *iterateHandleSegments(marker, options = {}) {
|
2727
|
+
let listHandlesResponse;
|
2728
|
+
if (!!marker || marker === undefined) {
|
2729
|
+
do {
|
2730
|
+
listHandlesResponse = await this.listHandlesSegment(marker, options);
|
2731
|
+
marker = listHandlesResponse.continuationToken;
|
2732
|
+
yield listHandlesResponse;
|
2733
|
+
} while (marker);
|
2734
|
+
}
|
2470
2735
|
}
|
2471
2736
|
/**
|
2472
2737
|
* Returns an AsyncIterableIterator for handles
|
2473
2738
|
*
|
2474
2739
|
* @param options - Options to list handles operation.
|
2475
2740
|
*/
|
2476
|
-
listHandleItems() {
|
2477
|
-
|
2478
|
-
|
2479
|
-
|
2480
|
-
|
2481
|
-
|
2482
|
-
_c = _f.value;
|
2483
|
-
_d = false;
|
2484
|
-
const listHandlesResponse = _c;
|
2485
|
-
if (listHandlesResponse.handleList) {
|
2486
|
-
for (const handle of listHandlesResponse.handleList) {
|
2487
|
-
yield yield __await(handle);
|
2488
|
-
}
|
2489
|
-
}
|
2741
|
+
async *listHandleItems(options = {}) {
|
2742
|
+
let marker;
|
2743
|
+
for await (const listHandlesResponse of this.iterateHandleSegments(marker, options)) {
|
2744
|
+
if (listHandlesResponse.handleList) {
|
2745
|
+
for (const handle of listHandlesResponse.handleList) {
|
2746
|
+
yield handle;
|
2490
2747
|
}
|
2491
2748
|
}
|
2492
|
-
|
2493
|
-
finally {
|
2494
|
-
try {
|
2495
|
-
if (!_d && !_a && (_b = _e.return)) yield __await(_b.call(_e));
|
2496
|
-
}
|
2497
|
-
finally { if (e_3) throw e_3.error; }
|
2498
|
-
}
|
2499
|
-
});
|
2749
|
+
}
|
2500
2750
|
}
|
2501
2751
|
/**
|
2502
2752
|
* Returns an async iterable iterator to list all the handles.
|
@@ -2528,7 +2778,10 @@ export class ShareFileClient extends StorageClient {
|
|
2528
2778
|
* Return an AsyncIterableIterator that works a page at a time
|
2529
2779
|
*/
|
2530
2780
|
byPage: (settings = {}) => {
|
2531
|
-
return this.iterateHandleSegments(removeEmptyString(settings.continuationToken),
|
2781
|
+
return this.iterateHandleSegments(removeEmptyString(settings.continuationToken), {
|
2782
|
+
maxPageSize: settings.maxPageSize,
|
2783
|
+
...options,
|
2784
|
+
});
|
2532
2785
|
},
|
2533
2786
|
};
|
2534
2787
|
}
|
@@ -2546,7 +2799,11 @@ export class ShareFileClient extends StorageClient {
|
|
2546
2799
|
async forceCloseHandlesSegment(marker, options = {}) {
|
2547
2800
|
return tracingClient.withSpan("ShareFileClient-forceCloseHandlesSegment", options, async (updatedOptions) => {
|
2548
2801
|
marker = marker === "" ? undefined : marker;
|
2549
|
-
const rawResponse = await this.context.forceCloseHandles("*",
|
2802
|
+
const rawResponse = await this.context.forceCloseHandles("*", {
|
2803
|
+
...updatedOptions,
|
2804
|
+
...this.shareClientConfig,
|
2805
|
+
marker,
|
2806
|
+
});
|
2550
2807
|
const response = rawResponse;
|
2551
2808
|
response.closedHandlesCount = rawResponse.numberOfHandlesClosed || 0;
|
2552
2809
|
response.closeFailureCount = rawResponse.numberOfHandlesFailedToClose || 0;
|
@@ -2593,7 +2850,10 @@ export class ShareFileClient extends StorageClient {
|
|
2593
2850
|
if (handleId === "*") {
|
2594
2851
|
throw new RangeError(`Parameter handleID should be a specified handle ID. Use forceCloseHandlesSegment() to close all handles.`);
|
2595
2852
|
}
|
2596
|
-
const rawResponse = await this.context.forceCloseHandles(handleId,
|
2853
|
+
const rawResponse = await this.context.forceCloseHandles(handleId, {
|
2854
|
+
...updatedOptions,
|
2855
|
+
...this.shareClientConfig,
|
2856
|
+
});
|
2597
2857
|
const response = rawResponse;
|
2598
2858
|
response.closedHandlesCount = rawResponse.numberOfHandlesClosed || 0;
|
2599
2859
|
response.closeFailureCount = rawResponse.numberOfHandlesFailedToClose || 0;
|
@@ -2608,14 +2868,21 @@ export class ShareFileClient extends StorageClient {
|
|
2608
2868
|
*/
|
2609
2869
|
async createHardLink(targetFile, options = {}) {
|
2610
2870
|
return tracingClient.withSpan("ShareFileClient-createHardLink", options, async (updatedOptions) => {
|
2611
|
-
const rawResponse = await this.context.createHardLink(targetFile,
|
2612
|
-
|
2871
|
+
const rawResponse = await this.context.createHardLink(targetFile, {
|
2872
|
+
...updatedOptions,
|
2873
|
+
...this.shareClientConfig,
|
2874
|
+
});
|
2875
|
+
return assertResponse({
|
2876
|
+
...rawResponse,
|
2877
|
+
_response: rawResponse._response, // _response is made non-enumerable,
|
2878
|
+
posixProperties: {
|
2613
2879
|
fileMode: parseOctalFileMode(rawResponse.fileMode),
|
2614
2880
|
fileType: rawResponse.nfsFileType,
|
2615
2881
|
owner: rawResponse.owner,
|
2616
2882
|
group: rawResponse.group,
|
2617
2883
|
linkCount: rawResponse.linkCount,
|
2618
|
-
}
|
2884
|
+
},
|
2885
|
+
});
|
2619
2886
|
});
|
2620
2887
|
}
|
2621
2888
|
/**
|
@@ -2627,13 +2894,20 @@ export class ShareFileClient extends StorageClient {
|
|
2627
2894
|
*/
|
2628
2895
|
async createSymbolicLink(linkText, options = {}) {
|
2629
2896
|
return tracingClient.withSpan("ShareFileClient-createSymbolicLink", options, async (updatedOptions) => {
|
2630
|
-
const rawResponse = await this.context.createSymbolicLink(linkText,
|
2631
|
-
|
2897
|
+
const rawResponse = await this.context.createSymbolicLink(linkText, {
|
2898
|
+
...updatedOptions,
|
2899
|
+
...this.shareClientConfig,
|
2900
|
+
});
|
2901
|
+
return assertResponse({
|
2902
|
+
...rawResponse,
|
2903
|
+
_response: rawResponse._response, // _response is made non-enumerable,
|
2904
|
+
posixProperties: {
|
2632
2905
|
fileMode: parseOctalFileMode(rawResponse.fileMode),
|
2633
2906
|
owner: rawResponse.owner,
|
2634
2907
|
group: rawResponse.group,
|
2635
2908
|
fileType: rawResponse.nfsFileType,
|
2636
|
-
}
|
2909
|
+
},
|
2910
|
+
});
|
2637
2911
|
});
|
2638
2912
|
}
|
2639
2913
|
/**
|
@@ -2642,7 +2916,10 @@ export class ShareFileClient extends StorageClient {
|
|
2642
2916
|
*/
|
2643
2917
|
async getSymbolicLink(options = {}) {
|
2644
2918
|
return tracingClient.withSpan("ShareFileClient-getSymbolicLink", options, async (updatedOptions) => {
|
2645
|
-
return assertResponse(await this.context.getSymbolicLink(
|
2919
|
+
return assertResponse(await this.context.getSymbolicLink({
|
2920
|
+
...updatedOptions,
|
2921
|
+
...this.shareClientConfig,
|
2922
|
+
}));
|
2646
2923
|
});
|
2647
2924
|
}
|
2648
2925
|
/**
|
@@ -2669,7 +2946,11 @@ export class ShareFileClient extends StorageClient {
|
|
2669
2946
|
if (!(this.credential instanceof StorageSharedKeyCredential)) {
|
2670
2947
|
throw RangeError("Can only generate the SAS when the client is initialized with a shared key credential");
|
2671
2948
|
}
|
2672
|
-
const sas = generateFileSASQueryParameters(
|
2949
|
+
const sas = generateFileSASQueryParameters({
|
2950
|
+
shareName: this.shareName,
|
2951
|
+
filePath: this.path,
|
2952
|
+
...options,
|
2953
|
+
}, this.credential).toString();
|
2673
2954
|
return appendToURLQuery(this.url, sas);
|
2674
2955
|
}
|
2675
2956
|
/**
|
@@ -2688,7 +2969,11 @@ export class ShareFileClient extends StorageClient {
|
|
2688
2969
|
if (!(this.credential instanceof StorageSharedKeyCredential)) {
|
2689
2970
|
throw RangeError("Can only generate the SAS when the client is initialized with a shared key credential");
|
2690
2971
|
}
|
2691
|
-
return generateFileSASQueryParametersInternal(
|
2972
|
+
return generateFileSASQueryParametersInternal({
|
2973
|
+
shareName: this.shareName,
|
2974
|
+
filePath: this.path,
|
2975
|
+
...options,
|
2976
|
+
}, this.credential).stringToSign;
|
2692
2977
|
}
|
2693
2978
|
/**
|
2694
2979
|
* Renames a file.
|
@@ -2743,19 +3028,25 @@ export class ShareFileClient extends StorageClient {
|
|
2743
3028
|
}
|
2744
3029
|
const destFile = new ShareFileClient(destinationUrl, this.pipeline, this.shareClientConfig);
|
2745
3030
|
return tracingClient.withSpan("ShareFileClient-rename", options, async (updatedOptions) => {
|
2746
|
-
const response = assertResponse(await destFile.context.rename(this.url,
|
3031
|
+
const response = assertResponse(await destFile.context.rename(this.url, {
|
3032
|
+
...updatedOptions,
|
3033
|
+
sourceLeaseAccessConditions: updatedOptions.sourceLeaseAccessConditions
|
2747
3034
|
? {
|
2748
3035
|
sourceLeaseId: updatedOptions.sourceLeaseAccessConditions.leaseId,
|
2749
3036
|
}
|
2750
|
-
: undefined,
|
3037
|
+
: undefined,
|
3038
|
+
destinationLeaseAccessConditions: updatedOptions.destinationLeaseAccessConditions
|
2751
3039
|
? {
|
2752
3040
|
destinationLeaseId: updatedOptions.destinationLeaseAccessConditions.leaseId,
|
2753
3041
|
}
|
2754
|
-
: undefined,
|
3042
|
+
: undefined,
|
3043
|
+
fileHttpHeaders: options.contentType
|
2755
3044
|
? {
|
2756
3045
|
fileContentType: options.contentType,
|
2757
3046
|
}
|
2758
|
-
: undefined
|
3047
|
+
: undefined,
|
3048
|
+
...this.shareClientConfig,
|
3049
|
+
}));
|
2759
3050
|
return {
|
2760
3051
|
destinationFileClient: destFile,
|
2761
3052
|
fileRenameResponse: response,
|
@@ -2770,6 +3061,10 @@ export class ShareFileClient extends StorageClient {
|
|
2770
3061
|
* @see https://learn.microsoft.com/rest/api/storageservices/lease-share
|
2771
3062
|
*/
|
2772
3063
|
export class ShareLeaseClient {
|
3064
|
+
_leaseId;
|
3065
|
+
_url;
|
3066
|
+
fileOrShare;
|
3067
|
+
shareClientConfig;
|
2773
3068
|
/**
|
2774
3069
|
* Gets the lease Id.
|
2775
3070
|
*
|
@@ -2816,7 +3111,12 @@ export class ShareLeaseClient {
|
|
2816
3111
|
*/
|
2817
3112
|
async acquireLease(duration = -1, options = {}) {
|
2818
3113
|
return tracingClient.withSpan("ShareLeaseClient-acquireLease", options, async (updatedOptions) => {
|
2819
|
-
return assertResponse(await this.fileOrShare.acquireLease(
|
3114
|
+
return assertResponse(await this.fileOrShare.acquireLease({
|
3115
|
+
...updatedOptions,
|
3116
|
+
...this.shareClientConfig,
|
3117
|
+
duration,
|
3118
|
+
proposedLeaseId: this._leaseId,
|
3119
|
+
}));
|
2820
3120
|
});
|
2821
3121
|
}
|
2822
3122
|
/**
|
@@ -2828,7 +3128,11 @@ export class ShareLeaseClient {
|
|
2828
3128
|
*/
|
2829
3129
|
async changeLease(proposedLeaseId, options = {}) {
|
2830
3130
|
return tracingClient.withSpan("ShareLeaseClient-changeLease", options, async (updatedOptions) => {
|
2831
|
-
const response = assertResponse(await this.fileOrShare.changeLease(this._leaseId,
|
3131
|
+
const response = assertResponse(await this.fileOrShare.changeLease(this._leaseId, {
|
3132
|
+
...updatedOptions,
|
3133
|
+
...this.shareClientConfig,
|
3134
|
+
proposedLeaseId,
|
3135
|
+
}));
|
2832
3136
|
this._leaseId = proposedLeaseId;
|
2833
3137
|
return response;
|
2834
3138
|
});
|
@@ -2842,7 +3146,10 @@ export class ShareLeaseClient {
|
|
2842
3146
|
*/
|
2843
3147
|
async releaseLease(options = {}) {
|
2844
3148
|
return tracingClient.withSpan("ShareLeaseClient-releaseLease", options, async (updatedOptions) => {
|
2845
|
-
return assertResponse(await this.fileOrShare.releaseLease(this._leaseId,
|
3149
|
+
return assertResponse(await this.fileOrShare.releaseLease(this._leaseId, {
|
3150
|
+
...updatedOptions,
|
3151
|
+
...this.shareClientConfig,
|
3152
|
+
}));
|
2846
3153
|
});
|
2847
3154
|
}
|
2848
3155
|
/**
|
@@ -2853,7 +3160,10 @@ export class ShareLeaseClient {
|
|
2853
3160
|
*/
|
2854
3161
|
async breakLease(options = {}) {
|
2855
3162
|
return tracingClient.withSpan("ShareLeaseClient-breakLease", options, async (updatedOptions) => {
|
2856
|
-
return assertResponse(await this.fileOrShare.breakLease(
|
3163
|
+
return assertResponse(await this.fileOrShare.breakLease({
|
3164
|
+
...updatedOptions,
|
3165
|
+
...this.shareClientConfig,
|
3166
|
+
}));
|
2857
3167
|
});
|
2858
3168
|
}
|
2859
3169
|
/**
|
@@ -2869,7 +3179,10 @@ export class ShareLeaseClient {
|
|
2869
3179
|
if (isFile(this.fileOrShare)) {
|
2870
3180
|
throw new RangeError("The renewLease operation is not available for lease on file.");
|
2871
3181
|
}
|
2872
|
-
return assertResponse(await this.fileOrShare.renewLease(this._leaseId,
|
3182
|
+
return assertResponse(await this.fileOrShare.renewLease(this._leaseId, {
|
3183
|
+
...updatedOptions,
|
3184
|
+
...this.shareClientConfig,
|
3185
|
+
}));
|
2873
3186
|
});
|
2874
3187
|
}
|
2875
3188
|
}
|