@azure/arm-confidentialledger 1.1.1-alpha.20230201.1 → 1.2.0-alpha.20230202.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/CHANGELOG.md +8 -10
  2. package/LICENSE +1 -1
  3. package/dist/index.js +107 -42
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.min.js +1 -1
  6. package/dist/index.min.js.map +1 -1
  7. package/dist-esm/samples-dev/checkNameAvailabilitySample.js +10 -2
  8. package/dist-esm/samples-dev/checkNameAvailabilitySample.js.map +1 -1
  9. package/dist-esm/samples-dev/ledgerCreateSample.js +12 -3
  10. package/dist-esm/samples-dev/ledgerCreateSample.js.map +1 -1
  11. package/dist-esm/samples-dev/ledgerDeleteSample.js +12 -3
  12. package/dist-esm/samples-dev/ledgerDeleteSample.js.map +1 -1
  13. package/dist-esm/samples-dev/ledgerGetSample.js +12 -3
  14. package/dist-esm/samples-dev/ledgerGetSample.js.map +1 -1
  15. package/dist-esm/samples-dev/ledgerListByResourceGroupSample.js +12 -3
  16. package/dist-esm/samples-dev/ledgerListByResourceGroupSample.js.map +1 -1
  17. package/dist-esm/samples-dev/ledgerListBySubscriptionSample.js +10 -2
  18. package/dist-esm/samples-dev/ledgerListBySubscriptionSample.js.map +1 -1
  19. package/dist-esm/samples-dev/ledgerUpdateSample.js +12 -3
  20. package/dist-esm/samples-dev/ledgerUpdateSample.js.map +1 -1
  21. package/dist-esm/samples-dev/operationsListSample.js +10 -2
  22. package/dist-esm/samples-dev/operationsListSample.js.map +1 -1
  23. package/dist-esm/src/confidentialLedgerClient.d.ts.map +1 -1
  24. package/dist-esm/src/confidentialLedgerClient.js +20 -18
  25. package/dist-esm/src/confidentialLedgerClient.js.map +1 -1
  26. package/dist-esm/src/index.d.ts +1 -0
  27. package/dist-esm/src/index.d.ts.map +1 -1
  28. package/dist-esm/src/index.js +1 -0
  29. package/dist-esm/src/index.js.map +1 -1
  30. package/dist-esm/src/models/index.d.ts +0 -4
  31. package/dist-esm/src/models/index.d.ts.map +1 -1
  32. package/dist-esm/src/operations/ledger.d.ts.map +1 -1
  33. package/dist-esm/src/operations/ledger.js +37 -16
  34. package/dist-esm/src/operations/ledger.js.map +1 -1
  35. package/dist-esm/src/operations/operations.d.ts.map +1 -1
  36. package/dist-esm/src/operations/operations.js +19 -8
  37. package/dist-esm/src/operations/operations.js.map +1 -1
  38. package/dist-esm/src/pagingHelper.d.ts +13 -0
  39. package/dist-esm/src/pagingHelper.d.ts.map +1 -0
  40. package/dist-esm/src/pagingHelper.js +32 -0
  41. package/dist-esm/src/pagingHelper.js.map +1 -0
  42. package/package.json +6 -4
  43. package/review/arm-confidentialledger.api.md +3 -2
  44. package/src/confidentialLedgerClient.ts +26 -20
  45. package/src/index.ts +1 -0
  46. package/src/models/index.ts +2 -8
  47. package/src/operations/ledger.ts +46 -19
  48. package/src/operations/operations.ts +21 -9
  49. package/src/pagingHelper.ts +39 -0
  50. package/types/arm-confidentialledger.d.ts +9 -4
@@ -429,20 +429,14 @@ export type LedgerListBySubscriptionResponse = ConfidentialLedgerList;
429
429
 
430
430
  /** Optional parameters. */
431
431
  export interface LedgerListByResourceGroupNextOptionalParams
432
- extends coreClient.OperationOptions {
433
- /** The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public' */
434
- filter?: string;
435
- }
432
+ extends coreClient.OperationOptions {}
436
433
 
437
434
  /** Contains response data for the listByResourceGroupNext operation. */
438
435
  export type LedgerListByResourceGroupNextResponse = ConfidentialLedgerList;
439
436
 
440
437
  /** Optional parameters. */
441
438
  export interface LedgerListBySubscriptionNextOptionalParams
442
- extends coreClient.OperationOptions {
443
- /** The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public' */
444
- filter?: string;
445
- }
439
+ extends coreClient.OperationOptions {}
446
440
 
447
441
  /** Contains response data for the listBySubscriptionNext operation. */
448
442
  export type LedgerListBySubscriptionNextResponse = ConfidentialLedgerList;
@@ -6,7 +6,8 @@
6
6
  * Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
7
  */
8
8
 
9
- import { PagedAsyncIterableIterator } from "@azure/core-paging";
9
+ import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging";
10
+ import { setContinuationToken } from "../pagingHelper";
10
11
  import { Ledger } from "../operationsInterfaces";
11
12
  import * as coreClient from "@azure/core-client";
12
13
  import * as Mappers from "../models/mappers";
@@ -18,8 +19,10 @@ import {
18
19
  ConfidentialLedger,
19
20
  LedgerListByResourceGroupNextOptionalParams,
20
21
  LedgerListByResourceGroupOptionalParams,
22
+ LedgerListByResourceGroupResponse,
21
23
  LedgerListBySubscriptionNextOptionalParams,
22
24
  LedgerListBySubscriptionOptionalParams,
25
+ LedgerListBySubscriptionResponse,
23
26
  LedgerGetOptionalParams,
24
27
  LedgerGetResponse,
25
28
  LedgerDeleteOptionalParams,
@@ -27,8 +30,6 @@ import {
27
30
  LedgerCreateResponse,
28
31
  LedgerUpdateOptionalParams,
29
32
  LedgerUpdateResponse,
30
- LedgerListByResourceGroupResponse,
31
- LedgerListBySubscriptionResponse,
32
33
  LedgerListByResourceGroupNextResponse,
33
34
  LedgerListBySubscriptionNextResponse
34
35
  } from "../models";
@@ -63,19 +64,33 @@ export class LedgerImpl implements Ledger {
63
64
  [Symbol.asyncIterator]() {
64
65
  return this;
65
66
  },
66
- byPage: () => {
67
- return this.listByResourceGroupPagingPage(resourceGroupName, options);
67
+ byPage: (settings?: PageSettings) => {
68
+ if (settings?.maxPageSize) {
69
+ throw new Error("maxPageSize is not supported by this operation.");
70
+ }
71
+ return this.listByResourceGroupPagingPage(
72
+ resourceGroupName,
73
+ options,
74
+ settings
75
+ );
68
76
  }
69
77
  };
70
78
  }
71
79
 
72
80
  private async *listByResourceGroupPagingPage(
73
81
  resourceGroupName: string,
74
- options?: LedgerListByResourceGroupOptionalParams
82
+ options?: LedgerListByResourceGroupOptionalParams,
83
+ settings?: PageSettings
75
84
  ): AsyncIterableIterator<ConfidentialLedger[]> {
76
- let result = await this._listByResourceGroup(resourceGroupName, options);
77
- yield result.value || [];
78
- let continuationToken = result.nextLink;
85
+ let result: LedgerListByResourceGroupResponse;
86
+ let continuationToken = settings?.continuationToken;
87
+ if (!continuationToken) {
88
+ result = await this._listByResourceGroup(resourceGroupName, options);
89
+ let page = result.value || [];
90
+ continuationToken = result.nextLink;
91
+ setContinuationToken(page, continuationToken);
92
+ yield page;
93
+ }
79
94
  while (continuationToken) {
80
95
  result = await this._listByResourceGroupNext(
81
96
  resourceGroupName,
@@ -83,7 +98,9 @@ export class LedgerImpl implements Ledger {
83
98
  options
84
99
  );
85
100
  continuationToken = result.nextLink;
86
- yield result.value || [];
101
+ let page = result.value || [];
102
+ setContinuationToken(page, continuationToken);
103
+ yield page;
87
104
  }
88
105
  }
89
106
 
@@ -114,22 +131,34 @@ export class LedgerImpl implements Ledger {
114
131
  [Symbol.asyncIterator]() {
115
132
  return this;
116
133
  },
117
- byPage: () => {
118
- return this.listBySubscriptionPagingPage(options);
134
+ byPage: (settings?: PageSettings) => {
135
+ if (settings?.maxPageSize) {
136
+ throw new Error("maxPageSize is not supported by this operation.");
137
+ }
138
+ return this.listBySubscriptionPagingPage(options, settings);
119
139
  }
120
140
  };
121
141
  }
122
142
 
123
143
  private async *listBySubscriptionPagingPage(
124
- options?: LedgerListBySubscriptionOptionalParams
144
+ options?: LedgerListBySubscriptionOptionalParams,
145
+ settings?: PageSettings
125
146
  ): AsyncIterableIterator<ConfidentialLedger[]> {
126
- let result = await this._listBySubscription(options);
127
- yield result.value || [];
128
- let continuationToken = result.nextLink;
147
+ let result: LedgerListBySubscriptionResponse;
148
+ let continuationToken = settings?.continuationToken;
149
+ if (!continuationToken) {
150
+ result = await this._listBySubscription(options);
151
+ let page = result.value || [];
152
+ continuationToken = result.nextLink;
153
+ setContinuationToken(page, continuationToken);
154
+ yield page;
155
+ }
129
156
  while (continuationToken) {
130
157
  result = await this._listBySubscriptionNext(continuationToken, options);
131
158
  continuationToken = result.nextLink;
132
- yield result.value || [];
159
+ let page = result.value || [];
160
+ setContinuationToken(page, continuationToken);
161
+ yield page;
133
162
  }
134
163
  }
135
164
 
@@ -642,7 +671,6 @@ const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = {
642
671
  bodyMapper: Mappers.ErrorResponse
643
672
  }
644
673
  },
645
- queryParameters: [Parameters.apiVersion, Parameters.filter],
646
674
  urlParameters: [
647
675
  Parameters.$host,
648
676
  Parameters.nextLink,
@@ -663,7 +691,6 @@ const listBySubscriptionNextOperationSpec: coreClient.OperationSpec = {
663
691
  bodyMapper: Mappers.ErrorResponse
664
692
  }
665
693
  },
666
- queryParameters: [Parameters.apiVersion, Parameters.filter],
667
694
  urlParameters: [
668
695
  Parameters.$host,
669
696
  Parameters.nextLink,
@@ -6,7 +6,8 @@
6
6
  * Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
7
  */
8
8
 
9
- import { PagedAsyncIterableIterator } from "@azure/core-paging";
9
+ import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging";
10
+ import { setContinuationToken } from "../pagingHelper";
10
11
  import { Operations } from "../operationsInterfaces";
11
12
  import * as coreClient from "@azure/core-client";
12
13
  import * as Mappers from "../models/mappers";
@@ -48,22 +49,34 @@ export class OperationsImpl implements Operations {
48
49
  [Symbol.asyncIterator]() {
49
50
  return this;
50
51
  },
51
- byPage: () => {
52
- return this.listPagingPage(options);
52
+ byPage: (settings?: PageSettings) => {
53
+ if (settings?.maxPageSize) {
54
+ throw new Error("maxPageSize is not supported by this operation.");
55
+ }
56
+ return this.listPagingPage(options, settings);
53
57
  }
54
58
  };
55
59
  }
56
60
 
57
61
  private async *listPagingPage(
58
- options?: OperationsListOptionalParams
62
+ options?: OperationsListOptionalParams,
63
+ settings?: PageSettings
59
64
  ): AsyncIterableIterator<ResourceProviderOperationDefinition[]> {
60
- let result = await this._list(options);
61
- yield result.value || [];
62
- let continuationToken = result.nextLink;
65
+ let result: OperationsListResponse;
66
+ let continuationToken = settings?.continuationToken;
67
+ if (!continuationToken) {
68
+ result = await this._list(options);
69
+ let page = result.value || [];
70
+ continuationToken = result.nextLink;
71
+ setContinuationToken(page, continuationToken);
72
+ yield page;
73
+ }
63
74
  while (continuationToken) {
64
75
  result = await this._listNext(continuationToken, options);
65
76
  continuationToken = result.nextLink;
66
- yield result.value || [];
77
+ let page = result.value || [];
78
+ setContinuationToken(page, continuationToken);
79
+ yield page;
67
80
  }
68
81
  }
69
82
 
@@ -130,7 +143,6 @@ const listNextOperationSpec: coreClient.OperationSpec = {
130
143
  bodyMapper: Mappers.ErrorResponse
131
144
  }
132
145
  },
133
- queryParameters: [Parameters.apiVersion],
134
146
  urlParameters: [Parameters.$host, Parameters.nextLink],
135
147
  headerParameters: [Parameters.accept],
136
148
  serializer
@@ -0,0 +1,39 @@
1
+ /*
2
+ * Copyright (c) Microsoft Corporation.
3
+ * Licensed under the MIT License.
4
+ *
5
+ * Code generated by Microsoft (R) AutoRest Code Generator.
6
+ * Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
+ */
8
+
9
+ export interface PageInfo {
10
+ continuationToken?: string;
11
+ }
12
+
13
+ const pageMap = new WeakMap<object, PageInfo>();
14
+
15
+ /**
16
+ * Given the last `.value` produced by the `byPage` iterator,
17
+ * returns a continuation token that can be used to begin paging from
18
+ * that point later.
19
+ * @param page An object from accessing `value` on the IteratorResult from a `byPage` iterator.
20
+ * @returns The continuation token that can be passed into byPage() during future calls.
21
+ */
22
+ export function getContinuationToken(page: unknown): string | undefined {
23
+ if (typeof page !== "object" || page === null) {
24
+ return undefined;
25
+ }
26
+ return pageMap.get(page)?.continuationToken;
27
+ }
28
+
29
+ export function setContinuationToken(
30
+ page: unknown,
31
+ continuationToken: string | undefined
32
+ ): void {
33
+ if (typeof page !== "object" || page === null || !continuationToken) {
34
+ return;
35
+ }
36
+ const pageInfo = pageMap.get(page) ?? {};
37
+ pageInfo.continuationToken = continuationToken;
38
+ pageMap.set(page, pageInfo);
39
+ }
@@ -166,6 +166,15 @@ export declare interface ErrorResponse {
166
166
  error?: ErrorDetail;
167
167
  }
168
168
 
169
+ /**
170
+ * Given the last `.value` produced by the `byPage` iterator,
171
+ * returns a continuation token that can be used to begin paging from
172
+ * that point later.
173
+ * @param page An object from accessing `value` on the IteratorResult from a `byPage` iterator.
174
+ * @returns The continuation token that can be passed into byPage() during future calls.
175
+ */
176
+ export declare function getContinuationToken(page: unknown): string | undefined;
177
+
169
178
  /** Known values of {@link CheckNameAvailabilityReason} that the service accepts. */
170
179
  export declare enum KnownCheckNameAvailabilityReason {
171
180
  /** Invalid */
@@ -320,8 +329,6 @@ export declare type LedgerGetResponse = ConfidentialLedger;
320
329
 
321
330
  /** Optional parameters. */
322
331
  export declare interface LedgerListByResourceGroupNextOptionalParams extends coreClient.OperationOptions {
323
- /** The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public' */
324
- filter?: string;
325
332
  }
326
333
 
327
334
  /** Contains response data for the listByResourceGroupNext operation. */
@@ -338,8 +345,6 @@ export declare type LedgerListByResourceGroupResponse = ConfidentialLedgerList;
338
345
 
339
346
  /** Optional parameters. */
340
347
  export declare interface LedgerListBySubscriptionNextOptionalParams extends coreClient.OperationOptions {
341
- /** The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public' */
342
- filter?: string;
343
348
  }
344
349
 
345
350
  /** Contains response data for the listBySubscriptionNext operation. */