@azure/storage-blob 12.9.1-alpha.20220330.1 → 12.9.1-alpha.20220418.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.
Files changed (26) hide show
  1. package/CHANGELOG.md +3 -0
  2. package/dist/index.js +437 -5
  3. package/dist/index.js.map +1 -1
  4. package/dist-esm/storage-blob/src/Clients.js +372 -6
  5. package/dist-esm/storage-blob/src/Clients.js.map +1 -1
  6. package/dist-esm/storage-blob/src/ContainerClient.js.map +1 -1
  7. package/dist-esm/storage-blob/src/PageBlobRangeResponse.js.map +1 -1
  8. package/dist-esm/storage-blob/src/generated/src/models/index.js.map +1 -1
  9. package/dist-esm/storage-blob/src/generated/src/models/mappers.js +7 -0
  10. package/dist-esm/storage-blob/src/generated/src/models/mappers.js.map +1 -1
  11. package/dist-esm/storage-blob/src/generated/src/models/parameters.js +11 -0
  12. package/dist-esm/storage-blob/src/generated/src/models/parameters.js.map +1 -1
  13. package/dist-esm/storage-blob/src/generated/src/operations/blob.js +2 -1
  14. package/dist-esm/storage-blob/src/generated/src/operations/blob.js.map +1 -1
  15. package/dist-esm/storage-blob/src/generated/src/operations/blockBlob.js +1 -0
  16. package/dist-esm/storage-blob/src/generated/src/operations/blockBlob.js.map +1 -1
  17. package/dist-esm/storage-blob/src/generated/src/operations/pageBlob.js +4 -0
  18. package/dist-esm/storage-blob/src/generated/src/operations/pageBlob.js.map +1 -1
  19. package/dist-esm/storage-blob/src/generatedModels.js.map +1 -1
  20. package/dist-esm/storage-blob/src/utils/constants.js +1 -0
  21. package/dist-esm/storage-blob/src/utils/constants.js.map +1 -1
  22. package/dist-esm/storage-blob/src/utils/utils.common.js +42 -0
  23. package/dist-esm/storage-blob/src/utils/utils.common.js.map +1 -1
  24. package/package.json +5 -2
  25. package/types/3.1/storage-blob.d.ts +330 -1
  26. package/types/latest/storage-blob.d.ts +340 -1
package/CHANGELOG.md CHANGED
@@ -8,6 +8,9 @@
8
8
 
9
9
  ### Bugs Fixed
10
10
 
11
+ - Fix incorrect browser mapping path for BufferScheduler.js
12
+ - Add `react-native` mapping to ESM entrypoint
13
+
11
14
  ### Other Changes
12
15
 
13
16
  ## 12.9.0 (2022-03-11)
package/dist/index.js CHANGED
@@ -1693,6 +1693,13 @@ const PageList = {
1693
1693
  }
1694
1694
  }
1695
1695
  }
1696
+ },
1697
+ continuationToken: {
1698
+ serializedName: "NextMarker",
1699
+ xmlName: "NextMarker",
1700
+ type: {
1701
+ name: "String"
1702
+ }
1696
1703
  }
1697
1704
  }
1698
1705
  }
@@ -9505,6 +9512,17 @@ const copySourceAuthorization = {
9505
9512
  }
9506
9513
  }
9507
9514
  };
9515
+ const copySourceTags = {
9516
+ parameterPath: ["options", "copySourceTags"],
9517
+ mapper: {
9518
+ serializedName: "x-ms-copy-source-tag-option",
9519
+ xmlName: "x-ms-copy-source-tag-option",
9520
+ type: {
9521
+ name: "Enum",
9522
+ allowedValues: ["REPLACE", "COPY"]
9523
+ }
9524
+ }
9525
+ };
9508
9526
  const comp15 = {
9509
9527
  parameterPath: "comp",
9510
9528
  mapper: {
@@ -11985,7 +12003,8 @@ const copyFromURLOperationSpec = {
11985
12003
  legalHold1,
11986
12004
  xMsRequiresSync,
11987
12005
  sourceContentMD5,
11988
- copySourceAuthorization
12006
+ copySourceAuthorization,
12007
+ copySourceTags
11989
12008
  ],
11990
12009
  isXML: true,
11991
12010
  serializer: xmlSerializer$3
@@ -12525,6 +12544,8 @@ const getPageRangesOperationSpec = {
12525
12544
  },
12526
12545
  queryParameters: [
12527
12546
  timeoutInSeconds,
12547
+ marker,
12548
+ maxPageSize,
12528
12549
  snapshot,
12529
12550
  comp20
12530
12551
  ],
@@ -12559,6 +12580,8 @@ const getPageRangesDiffOperationSpec = {
12559
12580
  },
12560
12581
  queryParameters: [
12561
12582
  timeoutInSeconds,
12583
+ marker,
12584
+ maxPageSize,
12562
12585
  snapshot,
12563
12586
  comp20,
12564
12587
  prevsnapshot
@@ -13128,6 +13151,7 @@ const putBlobFromUrlOperationSpec = {
13128
13151
  blobTagsString,
13129
13152
  sourceContentMD5,
13130
13153
  copySourceAuthorization,
13154
+ copySourceTags,
13131
13155
  transactionalContentMD5,
13132
13156
  blobType2,
13133
13157
  copySourceBlobProperties
@@ -13495,6 +13519,7 @@ const StorageBlobLoggingAllowedQueryParameters = [
13495
13519
  "snapshot",
13496
13520
  ];
13497
13521
  const BlobUsesCustomerSpecifiedEncryptionMsg = "BlobUsesCustomerSpecifiedEncryption";
13522
+ const BlobDoesNotUseCustomerSpecifiedEncryption = "BlobDoesNotUseCustomerSpecifiedEncryption";
13498
13523
 
13499
13524
  // Copyright (c) Microsoft Corporation.
13500
13525
  /**
@@ -14287,6 +14312,48 @@ function ProcessBlobPrefixes(blobPrefixesInXML) {
14287
14312
  }
14288
14313
  return blobPrefixes;
14289
14314
  }
14315
+ function* ExtractPageRangeInfoItems(getPageRangesSegment) {
14316
+ let pageRange = [];
14317
+ let clearRange = [];
14318
+ if (getPageRangesSegment.pageRange)
14319
+ pageRange = getPageRangesSegment.pageRange;
14320
+ if (getPageRangesSegment.clearRange)
14321
+ clearRange = getPageRangesSegment.clearRange;
14322
+ let pageRangeIndex = 0;
14323
+ let clearRangeIndex = 0;
14324
+ while (pageRangeIndex < pageRange.length && clearRangeIndex < clearRange.length) {
14325
+ if (pageRange[pageRangeIndex].start < clearRange[clearRangeIndex].start) {
14326
+ yield {
14327
+ start: pageRange[pageRangeIndex].start,
14328
+ end: pageRange[pageRangeIndex].end,
14329
+ isClear: false,
14330
+ };
14331
+ ++pageRangeIndex;
14332
+ }
14333
+ else {
14334
+ yield {
14335
+ start: clearRange[clearRangeIndex].start,
14336
+ end: clearRange[clearRangeIndex].end,
14337
+ isClear: true,
14338
+ };
14339
+ ++clearRangeIndex;
14340
+ }
14341
+ }
14342
+ for (; pageRangeIndex < pageRange.length; ++pageRangeIndex) {
14343
+ yield {
14344
+ start: pageRange[pageRangeIndex].start,
14345
+ end: pageRange[pageRangeIndex].end,
14346
+ isClear: false,
14347
+ };
14348
+ }
14349
+ for (; clearRangeIndex < clearRange.length; ++clearRangeIndex) {
14350
+ yield {
14351
+ start: clearRange[clearRangeIndex].start,
14352
+ end: clearRange[clearRangeIndex].end,
14353
+ isClear: true,
14354
+ };
14355
+ }
14356
+ }
14290
14357
 
14291
14358
  // Copyright (c) Microsoft Corporation.
14292
14359
  /**
@@ -19530,7 +19597,8 @@ class BlobClient extends StorageClient {
19530
19597
  return false;
19531
19598
  }
19532
19599
  else if (e.statusCode === 409 &&
19533
- e.details.errorCode === BlobUsesCustomerSpecifiedEncryptionMsg) {
19600
+ (e.details.errorCode === BlobUsesCustomerSpecifiedEncryptionMsg ||
19601
+ e.details.errorCode === BlobDoesNotUseCustomerSpecifiedEncryption)) {
19534
19602
  // Expected exception when checking blob existence
19535
19603
  return true;
19536
19604
  }
@@ -19943,7 +20011,7 @@ class BlobClient extends StorageClient {
19943
20011
  sourceIfModifiedSince: options.sourceConditions.ifModifiedSince,
19944
20012
  sourceIfNoneMatch: options.sourceConditions.ifNoneMatch,
19945
20013
  sourceIfUnmodifiedSince: options.sourceConditions.ifUnmodifiedSince,
19946
- }, sourceContentMD5: options.sourceContentMD5, copySourceAuthorization: httpAuthorizationToString(options.sourceAuthorization), blobTagsString: toBlobTagsString(options.tags), immutabilityPolicyExpiry: (_b = options.immutabilityPolicy) === null || _b === void 0 ? void 0 : _b.expiriesOn, immutabilityPolicyMode: (_c = options.immutabilityPolicy) === null || _c === void 0 ? void 0 : _c.policyMode, legalHold: options.legalHold, encryptionScope: options.encryptionScope }, convertTracingToRequestOptionsBase(updatedOptions)));
20014
+ }, sourceContentMD5: options.sourceContentMD5, copySourceAuthorization: httpAuthorizationToString(options.sourceAuthorization), blobTagsString: toBlobTagsString(options.tags), immutabilityPolicyExpiry: (_b = options.immutabilityPolicy) === null || _b === void 0 ? void 0 : _b.expiriesOn, immutabilityPolicyMode: (_c = options.immutabilityPolicy) === null || _c === void 0 ? void 0 : _c.policyMode, legalHold: options.legalHold, encryptionScope: options.encryptionScope, copySourceTags: options.copySourceTags }, convertTracingToRequestOptionsBase(updatedOptions)));
19947
20015
  }
19948
20016
  catch (e) {
19949
20017
  span.setStatus({
@@ -20666,12 +20734,13 @@ class BlockBlobClient extends BlobClient {
20666
20734
  if (!coreHttp.isNode) {
20667
20735
  throw new Error("This operation currently is only supported in Node.js.");
20668
20736
  }
20737
+ ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps);
20669
20738
  const response = await this._blobContext.query(Object.assign({ abortSignal: options.abortSignal, queryRequest: {
20670
20739
  queryType: "SQL",
20671
20740
  expression: query,
20672
20741
  inputSerialization: toQuerySerialization(options.inputTextConfiguration),
20673
20742
  outputSerialization: toQuerySerialization(options.outputTextConfiguration),
20674
- }, leaseAccessConditions: options.conditions, modifiedAccessConditions: Object.assign(Object.assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }) }, convertTracingToRequestOptionsBase(updatedOptions)));
20743
+ }, leaseAccessConditions: options.conditions, modifiedAccessConditions: Object.assign(Object.assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), cpkInfo: options.customerProvidedKey }, convertTracingToRequestOptionsBase(updatedOptions)));
20675
20744
  return new BlobQueryResponse(response, {
20676
20745
  abortSignal: options.abortSignal,
20677
20746
  onProgress: options.onProgress,
@@ -20767,7 +20836,7 @@ class BlockBlobClient extends BlobClient {
20767
20836
  sourceIfNoneMatch: (_c = options.sourceConditions) === null || _c === void 0 ? void 0 : _c.ifNoneMatch,
20768
20837
  sourceIfUnmodifiedSince: (_d = options.sourceConditions) === null || _d === void 0 ? void 0 : _d.ifUnmodifiedSince,
20769
20838
  sourceIfTags: (_e = options.sourceConditions) === null || _e === void 0 ? void 0 : _e.tagConditions,
20770
- }, cpkInfo: options.customerProvidedKey, copySourceAuthorization: httpAuthorizationToString(options.sourceAuthorization), tier: toAccessTier(options.tier), blobTagsString: toBlobTagsString(options.tags) }), convertTracingToRequestOptionsBase(updatedOptions)));
20839
+ }, cpkInfo: options.customerProvidedKey, copySourceAuthorization: httpAuthorizationToString(options.sourceAuthorization), tier: toAccessTier(options.tier), blobTagsString: toBlobTagsString(options.tags), copySourceTags: options.copySourceTags }), convertTracingToRequestOptionsBase(updatedOptions)));
20771
20840
  }
20772
20841
  catch (e) {
20773
20842
  span.setStatus({
@@ -21463,6 +21532,183 @@ class PageBlobClient extends BlobClient {
21463
21532
  span.end();
21464
21533
  }
21465
21534
  }
21535
+ /**
21536
+ * getPageRangesSegment returns a single segment of page ranges starting from the
21537
+ * specified Marker. Use an empty Marker to start enumeration from the beginning.
21538
+ * After getting a segment, process it, and then call getPageRangesSegment again
21539
+ * (passing the the previously-returned Marker) to get the next segment.
21540
+ * @see https://docs.microsoft.com/rest/api/storageservices/get-page-ranges
21541
+ *
21542
+ * @param offset - Starting byte position of the page ranges.
21543
+ * @param count - Number of bytes to get.
21544
+ * @param marker - A string value that identifies the portion of the list to be returned with the next list operation.
21545
+ * @param options - Options to PageBlob Get Page Ranges Segment operation.
21546
+ */
21547
+ async listPageRangesSegment(offset = 0, count, marker, options = {}) {
21548
+ var _a;
21549
+ const { span, updatedOptions } = createSpan("PageBlobClient-getPageRangesSegment", options);
21550
+ try {
21551
+ return await this.pageBlobContext.getPageRanges(Object.assign({ abortSignal: options.abortSignal, leaseAccessConditions: options.conditions, modifiedAccessConditions: Object.assign(Object.assign({}, options.conditions), { ifTags: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), range: rangeToString({ offset, count }), marker: marker, maxPageSize: options.maxPageSize }, convertTracingToRequestOptionsBase(updatedOptions)));
21552
+ }
21553
+ catch (e) {
21554
+ span.setStatus({
21555
+ code: coreTracing.SpanStatusCode.ERROR,
21556
+ message: e.message,
21557
+ });
21558
+ throw e;
21559
+ }
21560
+ finally {
21561
+ span.end();
21562
+ }
21563
+ }
21564
+ /**
21565
+ * Returns an AsyncIterableIterator for {@link PageBlobGetPageRangesResponseModel}
21566
+ *
21567
+ * @param offset - Starting byte position of the page ranges.
21568
+ * @param count - Number of bytes to get.
21569
+ * @param marker - A string value that identifies the portion of
21570
+ * the get of page ranges to be returned with the next getting operation. The
21571
+ * operation returns the ContinuationToken value within the response body if the
21572
+ * getting operation did not return all page ranges remaining within the current page.
21573
+ * The ContinuationToken value can be used as the value for
21574
+ * the marker parameter in a subsequent call to request the next page of get
21575
+ * items. The marker value is opaque to the client.
21576
+ * @param options - Options to List Page Ranges operation.
21577
+ */
21578
+ listPageRangeItemSegments(offset = 0, count, marker, options = {}) {
21579
+ return tslib.__asyncGenerator(this, arguments, function* listPageRangeItemSegments_1() {
21580
+ let getPageRangeItemSegmentsResponse;
21581
+ if (!!marker || marker === undefined) {
21582
+ do {
21583
+ getPageRangeItemSegmentsResponse = yield tslib.__await(this.listPageRangesSegment(offset, count, marker, options));
21584
+ marker = getPageRangeItemSegmentsResponse.continuationToken;
21585
+ yield yield tslib.__await(yield tslib.__await(getPageRangeItemSegmentsResponse));
21586
+ } while (marker);
21587
+ }
21588
+ });
21589
+ }
21590
+ /**
21591
+ * Returns an AsyncIterableIterator of {@link PageRangeInfo} objects
21592
+ *
21593
+ * @param offset - Starting byte position of the page ranges.
21594
+ * @param count - Number of bytes to get.
21595
+ * @param options - Options to List Page Ranges operation.
21596
+ */
21597
+ listPageRangeItems(offset = 0, count, options = {}) {
21598
+ return tslib.__asyncGenerator(this, arguments, function* listPageRangeItems_1() {
21599
+ var e_1, _a;
21600
+ let marker;
21601
+ try {
21602
+ for (var _b = tslib.__asyncValues(this.listPageRangeItemSegments(offset, count, marker, options)), _c; _c = yield tslib.__await(_b.next()), !_c.done;) {
21603
+ const getPageRangesSegment = _c.value;
21604
+ yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(ExtractPageRangeInfoItems(getPageRangesSegment))));
21605
+ }
21606
+ }
21607
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
21608
+ finally {
21609
+ try {
21610
+ if (_c && !_c.done && (_a = _b.return)) yield tslib.__await(_a.call(_b));
21611
+ }
21612
+ finally { if (e_1) throw e_1.error; }
21613
+ }
21614
+ });
21615
+ }
21616
+ /**
21617
+ * Returns an async iterable iterator to list of page ranges for a page blob.
21618
+ * @see https://docs.microsoft.com/rest/api/storageservices/get-page-ranges
21619
+ *
21620
+ * .byPage() returns an async iterable iterator to list of page ranges for a page blob.
21621
+ *
21622
+ * Example using `for await` syntax:
21623
+ *
21624
+ * ```js
21625
+ * // Get the pageBlobClient before you run these snippets,
21626
+ * // Can be obtained from `blobServiceClient.getContainerClient("<your-container-name>").getPageBlobClient("<your-blob-name>");`
21627
+ * let i = 1;
21628
+ * for await (const pageRange of pageBlobClient.listPageRanges()) {
21629
+ * console.log(`Page range ${i++}: ${pageRange.start} - ${pageRange.end}`);
21630
+ * }
21631
+ * ```
21632
+ *
21633
+ * Example using `iter.next()`:
21634
+ *
21635
+ * ```js
21636
+ * let i = 1;
21637
+ * let iter = pageBlobClient.listPageRanges();
21638
+ * let pageRangeItem = await iter.next();
21639
+ * while (!pageRangeItem.done) {
21640
+ * console.log(`Page range ${i++}: ${pageRangeItem.value.start} - ${pageRangeItem.value.end}, IsClear: ${pageRangeItem.value.isClear}`);
21641
+ * pageRangeItem = await iter.next();
21642
+ * }
21643
+ * ```
21644
+ *
21645
+ * Example using `byPage()`:
21646
+ *
21647
+ * ```js
21648
+ * // passing optional maxPageSize in the page settings
21649
+ * let i = 1;
21650
+ * for await (const response of pageBlobClient.listPageRanges().byPage({ maxPageSize: 20 })) {
21651
+ * for (const pageRange of response) {
21652
+ * console.log(`Page range ${i++}: ${pageRange.start} - ${pageRange.end}`);
21653
+ * }
21654
+ * }
21655
+ * ```
21656
+ *
21657
+ * Example using paging with a marker:
21658
+ *
21659
+ * ```js
21660
+ * let i = 1;
21661
+ * let iterator = pageBlobClient.listPageRanges().byPage({ maxPageSize: 2 });
21662
+ * let response = (await iterator.next()).value;
21663
+ *
21664
+ * // Prints 2 page ranges
21665
+ * for (const pageRange of response) {
21666
+ * console.log(`Page range ${i++}: ${pageRange.start} - ${pageRange.end}`);
21667
+ * }
21668
+ *
21669
+ * // Gets next marker
21670
+ * let marker = response.continuationToken;
21671
+ *
21672
+ * // Passing next marker as continuationToken
21673
+ *
21674
+ * iterator = pageBlobClient.listPageRanges().byPage({ continuationToken: marker, maxPageSize: 10 });
21675
+ * response = (await iterator.next()).value;
21676
+ *
21677
+ * // Prints 10 page ranges
21678
+ * for (const blob of response) {
21679
+ * console.log(`Page range ${i++}: ${pageRange.start} - ${pageRange.end}`);
21680
+ * }
21681
+ * ```
21682
+ * @param offset - Starting byte position of the page ranges.
21683
+ * @param count - Number of bytes to get.
21684
+ * @param options - Options to the Page Blob Get Ranges operation.
21685
+ * @returns An asyncIterableIterator that supports paging.
21686
+ */
21687
+ listPageRanges(offset = 0, count, options = {}) {
21688
+ options.conditions = options.conditions || {};
21689
+ // AsyncIterableIterator to iterate over blobs
21690
+ const iter = this.listPageRangeItems(offset, count, options);
21691
+ return {
21692
+ /**
21693
+ * The next method, part of the iteration protocol
21694
+ */
21695
+ next() {
21696
+ return iter.next();
21697
+ },
21698
+ /**
21699
+ * The connection to the async iterator, part of the iteration protocol
21700
+ */
21701
+ [Symbol.asyncIterator]() {
21702
+ return this;
21703
+ },
21704
+ /**
21705
+ * Return an AsyncIterableIterator that works a page at a time
21706
+ */
21707
+ byPage: (settings = {}) => {
21708
+ return this.listPageRangeItemSegments(offset, count, settings.continuationToken, Object.assign({ maxPageSize: settings.maxPageSize }, options));
21709
+ },
21710
+ };
21711
+ }
21466
21712
  /**
21467
21713
  * Gets the collection of page ranges that differ between a specified snapshot and this page blob.
21468
21714
  * @see https://docs.microsoft.com/rest/api/storageservices/get-page-ranges
@@ -21493,6 +21739,192 @@ class PageBlobClient extends BlobClient {
21493
21739
  span.end();
21494
21740
  }
21495
21741
  }
21742
+ /**
21743
+ * getPageRangesDiffSegment returns a single segment of page ranges starting from the
21744
+ * specified Marker for difference between previous snapshot and the target page blob.
21745
+ * Use an empty Marker to start enumeration from the beginning.
21746
+ * After getting a segment, process it, and then call getPageRangesDiffSegment again
21747
+ * (passing the the previously-returned Marker) to get the next segment.
21748
+ * @see https://docs.microsoft.com/rest/api/storageservices/get-page-ranges
21749
+ *
21750
+ * @param offset - Starting byte position of the page ranges.
21751
+ * @param count - Number of bytes to get.
21752
+ * @param prevSnapshotOrUrl - Timestamp of snapshot to retrieve the difference or URL of snapshot to retrieve the difference.
21753
+ * @param marker - A string value that identifies the portion of the get to be returned with the next get operation.
21754
+ * @param options - Options to the Page Blob Get Page Ranges Diff operation.
21755
+ */
21756
+ async listPageRangesDiffSegment(offset, count, prevSnapshotOrUrl, marker, options) {
21757
+ var _a;
21758
+ const { span, updatedOptions } = createSpan("PageBlobClient-getPageRangesDiffSegment", options);
21759
+ try {
21760
+ return await this.pageBlobContext.getPageRangesDiff(Object.assign({ abortSignal: options === null || options === void 0 ? void 0 : options.abortSignal, leaseAccessConditions: options === null || options === void 0 ? void 0 : options.conditions, modifiedAccessConditions: Object.assign(Object.assign({}, options === null || options === void 0 ? void 0 : options.conditions), { ifTags: (_a = options === null || options === void 0 ? void 0 : options.conditions) === null || _a === void 0 ? void 0 : _a.tagConditions }), prevsnapshot: prevSnapshotOrUrl, range: rangeToString({
21761
+ offset: offset,
21762
+ count: count,
21763
+ }), marker: marker, maxPageSize: options === null || options === void 0 ? void 0 : options.maxPageSize }, convertTracingToRequestOptionsBase(updatedOptions)));
21764
+ }
21765
+ catch (e) {
21766
+ span.setStatus({
21767
+ code: coreTracing.SpanStatusCode.ERROR,
21768
+ message: e.message,
21769
+ });
21770
+ throw e;
21771
+ }
21772
+ finally {
21773
+ span.end();
21774
+ }
21775
+ }
21776
+ /**
21777
+ * Returns an AsyncIterableIterator for {@link PageBlobGetPageRangesDiffResponseModel}
21778
+ *
21779
+ *
21780
+ * @param offset - Starting byte position of the page ranges.
21781
+ * @param count - Number of bytes to get.
21782
+ * @param prevSnapshotOrUrl - Timestamp of snapshot to retrieve the difference or URL of snapshot to retrieve the difference.
21783
+ * @param marker - A string value that identifies the portion of
21784
+ * the get of page ranges to be returned with the next getting operation. The
21785
+ * operation returns the ContinuationToken value within the response body if the
21786
+ * getting operation did not return all page ranges remaining within the current page.
21787
+ * The ContinuationToken value can be used as the value for
21788
+ * the marker parameter in a subsequent call to request the next page of get
21789
+ * items. The marker value is opaque to the client.
21790
+ * @param options - Options to the Page Blob Get Page Ranges Diff operation.
21791
+ */
21792
+ listPageRangeDiffItemSegments(offset, count, prevSnapshotOrUrl, marker, options) {
21793
+ return tslib.__asyncGenerator(this, arguments, function* listPageRangeDiffItemSegments_1() {
21794
+ let getPageRangeItemSegmentsResponse;
21795
+ if (!!marker || marker === undefined) {
21796
+ do {
21797
+ getPageRangeItemSegmentsResponse = yield tslib.__await(this.listPageRangesDiffSegment(offset, count, prevSnapshotOrUrl, marker, options));
21798
+ marker = getPageRangeItemSegmentsResponse.continuationToken;
21799
+ yield yield tslib.__await(yield tslib.__await(getPageRangeItemSegmentsResponse));
21800
+ } while (marker);
21801
+ }
21802
+ });
21803
+ }
21804
+ /**
21805
+ * Returns an AsyncIterableIterator of {@link PageRangeInfo} objects
21806
+ *
21807
+ * @param offset - Starting byte position of the page ranges.
21808
+ * @param count - Number of bytes to get.
21809
+ * @param prevSnapshotOrUrl - Timestamp of snapshot to retrieve the difference or URL of snapshot to retrieve the difference.
21810
+ * @param options - Options to the Page Blob Get Page Ranges Diff operation.
21811
+ */
21812
+ listPageRangeDiffItems(offset, count, prevSnapshotOrUrl, options) {
21813
+ return tslib.__asyncGenerator(this, arguments, function* listPageRangeDiffItems_1() {
21814
+ var e_2, _a;
21815
+ let marker;
21816
+ try {
21817
+ for (var _b = tslib.__asyncValues(this.listPageRangeDiffItemSegments(offset, count, prevSnapshotOrUrl, marker, options)), _c; _c = yield tslib.__await(_b.next()), !_c.done;) {
21818
+ const getPageRangesSegment = _c.value;
21819
+ yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(ExtractPageRangeInfoItems(getPageRangesSegment))));
21820
+ }
21821
+ }
21822
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
21823
+ finally {
21824
+ try {
21825
+ if (_c && !_c.done && (_a = _b.return)) yield tslib.__await(_a.call(_b));
21826
+ }
21827
+ finally { if (e_2) throw e_2.error; }
21828
+ }
21829
+ });
21830
+ }
21831
+ /**
21832
+ * Returns an async iterable iterator to list of page ranges that differ between a specified snapshot and this page blob.
21833
+ * @see https://docs.microsoft.com/rest/api/storageservices/get-page-ranges
21834
+ *
21835
+ * .byPage() returns an async iterable iterator to list of page ranges that differ between a specified snapshot and this page blob.
21836
+ *
21837
+ * Example using `for await` syntax:
21838
+ *
21839
+ * ```js
21840
+ * // Get the pageBlobClient before you run these snippets,
21841
+ * // Can be obtained from `blobServiceClient.getContainerClient("<your-container-name>").getPageBlobClient("<your-blob-name>");`
21842
+ * let i = 1;
21843
+ * for await (const pageRange of pageBlobClient.listPageRangesDiff()) {
21844
+ * console.log(`Page range ${i++}: ${pageRange.start} - ${pageRange.end}`);
21845
+ * }
21846
+ * ```
21847
+ *
21848
+ * Example using `iter.next()`:
21849
+ *
21850
+ * ```js
21851
+ * let i = 1;
21852
+ * let iter = pageBlobClient.listPageRangesDiff();
21853
+ * let pageRangeItem = await iter.next();
21854
+ * while (!pageRangeItem.done) {
21855
+ * console.log(`Page range ${i++}: ${pageRangeItem.value.start} - ${pageRangeItem.value.end}, IsClear: ${pageRangeItem.value.isClear}`);
21856
+ * pageRangeItem = await iter.next();
21857
+ * }
21858
+ * ```
21859
+ *
21860
+ * Example using `byPage()`:
21861
+ *
21862
+ * ```js
21863
+ * // passing optional maxPageSize in the page settings
21864
+ * let i = 1;
21865
+ * for await (const response of pageBlobClient.listPageRangesDiff().byPage({ maxPageSize: 20 })) {
21866
+ * for (const pageRange of response) {
21867
+ * console.log(`Page range ${i++}: ${pageRange.start} - ${pageRange.end}`);
21868
+ * }
21869
+ * }
21870
+ * ```
21871
+ *
21872
+ * Example using paging with a marker:
21873
+ *
21874
+ * ```js
21875
+ * let i = 1;
21876
+ * let iterator = pageBlobClient.listPageRangesDiff().byPage({ maxPageSize: 2 });
21877
+ * let response = (await iterator.next()).value;
21878
+ *
21879
+ * // Prints 2 page ranges
21880
+ * for (const pageRange of response) {
21881
+ * console.log(`Page range ${i++}: ${pageRange.start} - ${pageRange.end}`);
21882
+ * }
21883
+ *
21884
+ * // Gets next marker
21885
+ * let marker = response.continuationToken;
21886
+ *
21887
+ * // Passing next marker as continuationToken
21888
+ *
21889
+ * iterator = pageBlobClient.listPageRangesDiff().byPage({ continuationToken: marker, maxPageSize: 10 });
21890
+ * response = (await iterator.next()).value;
21891
+ *
21892
+ * // Prints 10 page ranges
21893
+ * for (const blob of response) {
21894
+ * console.log(`Page range ${i++}: ${pageRange.start} - ${pageRange.end}`);
21895
+ * }
21896
+ * ```
21897
+ * @param offset - Starting byte position of the page ranges.
21898
+ * @param count - Number of bytes to get.
21899
+ * @param prevSnapshot - Timestamp of snapshot to retrieve the difference.
21900
+ * @param options - Options to the Page Blob Get Ranges operation.
21901
+ * @returns An asyncIterableIterator that supports paging.
21902
+ */
21903
+ listPageRangesDiff(offset, count, prevSnapshot, options = {}) {
21904
+ options.conditions = options.conditions || {};
21905
+ // AsyncIterableIterator to iterate over blobs
21906
+ const iter = this.listPageRangeDiffItems(offset, count, prevSnapshot, Object.assign({}, options));
21907
+ return {
21908
+ /**
21909
+ * The next method, part of the iteration protocol
21910
+ */
21911
+ next() {
21912
+ return iter.next();
21913
+ },
21914
+ /**
21915
+ * The connection to the async iterator, part of the iteration protocol
21916
+ */
21917
+ [Symbol.asyncIterator]() {
21918
+ return this;
21919
+ },
21920
+ /**
21921
+ * Return an AsyncIterableIterator that works a page at a time
21922
+ */
21923
+ byPage: (settings = {}) => {
21924
+ return this.listPageRangeDiffItemSegments(offset, count, prevSnapshot, settings.continuationToken, Object.assign({ maxPageSize: settings.maxPageSize }, options));
21925
+ },
21926
+ };
21927
+ }
21496
21928
  /**
21497
21929
  * Gets the collection of page ranges that differ between a specified snapshot and this page blob for managed disks.
21498
21930
  * @see https://docs.microsoft.com/rest/api/storageservices/get-page-ranges