@azure/arm-maps 3.1.0-beta.1 → 3.1.0
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/CHANGELOG.md +42 -27
- package/LICENSE +1 -1
- package/README.md +2 -2
- package/dist/index.js +399 -113
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist-esm/samples-dev/accountsCreateOrUpdateSample.js +63 -12
- package/dist-esm/samples-dev/accountsCreateOrUpdateSample.js.map +1 -1
- package/dist-esm/samples-dev/accountsDeleteSample.js +12 -4
- package/dist-esm/samples-dev/accountsDeleteSample.js.map +1 -1
- package/dist-esm/samples-dev/accountsGetSample.js +12 -4
- package/dist-esm/samples-dev/accountsGetSample.js.map +1 -1
- package/dist-esm/samples-dev/accountsListByResourceGroupSample.js +24 -9
- package/dist-esm/samples-dev/accountsListByResourceGroupSample.js.map +1 -1
- package/dist-esm/samples-dev/accountsListBySubscriptionSample.js +23 -8
- package/dist-esm/samples-dev/accountsListBySubscriptionSample.js.map +1 -1
- package/dist-esm/samples-dev/accountsListKeysSample.js +12 -4
- package/dist-esm/samples-dev/accountsListKeysSample.js.map +1 -1
- package/dist-esm/samples-dev/accountsListSasSample.js +12 -4
- package/dist-esm/samples-dev/accountsListSasSample.js.map +1 -1
- package/dist-esm/samples-dev/accountsRegenerateKeysSample.js +12 -4
- package/dist-esm/samples-dev/accountsRegenerateKeysSample.js.map +1 -1
- package/dist-esm/samples-dev/accountsUpdateSample.js +63 -16
- package/dist-esm/samples-dev/accountsUpdateSample.js.map +1 -1
- package/dist-esm/samples-dev/creatorsCreateOrUpdateSample.js +12 -4
- package/dist-esm/samples-dev/creatorsCreateOrUpdateSample.js.map +1 -1
- package/dist-esm/samples-dev/creatorsDeleteSample.js +12 -4
- package/dist-esm/samples-dev/creatorsDeleteSample.js.map +1 -1
- package/dist-esm/samples-dev/creatorsGetSample.js +12 -4
- package/dist-esm/samples-dev/creatorsGetSample.js.map +1 -1
- package/dist-esm/samples-dev/creatorsListByAccountSample.js +24 -9
- package/dist-esm/samples-dev/creatorsListByAccountSample.js.map +1 -1
- package/dist-esm/samples-dev/creatorsUpdateSample.js +12 -4
- package/dist-esm/samples-dev/creatorsUpdateSample.js.map +1 -1
- package/dist-esm/samples-dev/mapsListOperationsSample.js +22 -9
- package/dist-esm/samples-dev/mapsListOperationsSample.js.map +1 -1
- package/dist-esm/samples-dev/mapsListSubscriptionOperationsSample.js +23 -8
- package/dist-esm/samples-dev/mapsListSubscriptionOperationsSample.js.map +1 -1
- package/dist-esm/src/azureMapsManagementClient.d.ts +4 -1
- package/dist-esm/src/azureMapsManagementClient.d.ts.map +1 -1
- package/dist-esm/src/azureMapsManagementClient.js +57 -28
- package/dist-esm/src/azureMapsManagementClient.js.map +1 -1
- package/dist-esm/src/index.d.ts +1 -0
- package/dist-esm/src/index.d.ts.map +1 -1
- package/dist-esm/src/index.js +1 -0
- package/dist-esm/src/index.js.map +1 -1
- package/dist-esm/src/models/index.d.ts +161 -56
- package/dist-esm/src/models/index.d.ts.map +1 -1
- package/dist-esm/src/models/index.js +45 -0
- package/dist-esm/src/models/index.js.map +1 -1
- package/dist-esm/src/models/mappers.d.ts +4 -1
- package/dist-esm/src/models/mappers.d.ts.map +1 -1
- package/dist-esm/src/models/mappers.js +109 -17
- package/dist-esm/src/models/mappers.js.map +1 -1
- package/dist-esm/src/models/parameters.js +1 -1
- package/dist-esm/src/models/parameters.js.map +1 -1
- package/dist-esm/src/operations/accounts.d.ts.map +1 -1
- package/dist-esm/src/operations/accounts.js +61 -26
- package/dist-esm/src/operations/accounts.js.map +1 -1
- package/dist-esm/src/operations/creators.d.ts.map +1 -1
- package/dist-esm/src/operations/creators.js +31 -13
- package/dist-esm/src/operations/creators.js.map +1 -1
- package/dist-esm/src/operations/maps.d.ts.map +1 -1
- package/dist-esm/src/operations/maps.js +61 -26
- package/dist-esm/src/operations/maps.js.map +1 -1
- package/dist-esm/src/pagingHelper.d.ts +13 -0
- package/dist-esm/src/pagingHelper.d.ts.map +1 -0
- package/dist-esm/src/pagingHelper.js +32 -0
- package/dist-esm/src/pagingHelper.js.map +1 -0
- package/dist-esm/test/maps_operations_test.spec.d.ts +4 -0
- package/dist-esm/test/maps_operations_test.spec.d.ts.map +1 -0
- package/dist-esm/test/maps_operations_test.spec.js +140 -0
- package/dist-esm/test/maps_operations_test.spec.js.map +1 -0
- package/package.json +20 -15
- package/review/arm-maps.api.md +78 -35
- package/src/azureMapsManagementClient.ts +78 -24
- package/src/index.ts +1 -0
- package/src/models/index.ts +146 -38
- package/src/models/mappers.ts +112 -19
- package/src/models/parameters.ts +1 -1
- package/src/operations/accounts.ts +46 -19
- package/src/operations/creators.ts +26 -13
- package/src/operations/maps.ts +41 -18
- package/src/pagingHelper.ts +39 -0
- package/types/arm-maps.d.ts +169 -44
- package/types/tsdoc-metadata.json +1 -1
- package/dist-esm/test/sampleTest.d.ts +0 -2
- package/dist-esm/test/sampleTest.d.ts.map +0 -1
- package/dist-esm/test/sampleTest.js +0 -40
- package/dist-esm/test/sampleTest.js.map +0 -1
|
@@ -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 { Accounts } from "../operationsInterfaces";
|
|
11
12
|
import * as coreClient from "@azure/core-client";
|
|
12
13
|
import * as Mappers from "../models/mappers";
|
|
@@ -16,8 +17,10 @@ import {
|
|
|
16
17
|
MapsAccount,
|
|
17
18
|
AccountsListByResourceGroupNextOptionalParams,
|
|
18
19
|
AccountsListByResourceGroupOptionalParams,
|
|
20
|
+
AccountsListByResourceGroupResponse,
|
|
19
21
|
AccountsListBySubscriptionNextOptionalParams,
|
|
20
22
|
AccountsListBySubscriptionOptionalParams,
|
|
23
|
+
AccountsListBySubscriptionResponse,
|
|
21
24
|
AccountsCreateOrUpdateOptionalParams,
|
|
22
25
|
AccountsCreateOrUpdateResponse,
|
|
23
26
|
MapsAccountUpdateParameters,
|
|
@@ -26,8 +29,6 @@ import {
|
|
|
26
29
|
AccountsDeleteOptionalParams,
|
|
27
30
|
AccountsGetOptionalParams,
|
|
28
31
|
AccountsGetResponse,
|
|
29
|
-
AccountsListByResourceGroupResponse,
|
|
30
|
-
AccountsListBySubscriptionResponse,
|
|
31
32
|
AccountSasParameters,
|
|
32
33
|
AccountsListSasOptionalParams,
|
|
33
34
|
AccountsListSasResponse,
|
|
@@ -70,19 +71,33 @@ export class AccountsImpl implements Accounts {
|
|
|
70
71
|
[Symbol.asyncIterator]() {
|
|
71
72
|
return this;
|
|
72
73
|
},
|
|
73
|
-
byPage: () => {
|
|
74
|
-
|
|
74
|
+
byPage: (settings?: PageSettings) => {
|
|
75
|
+
if (settings?.maxPageSize) {
|
|
76
|
+
throw new Error("maxPageSize is not supported by this operation.");
|
|
77
|
+
}
|
|
78
|
+
return this.listByResourceGroupPagingPage(
|
|
79
|
+
resourceGroupName,
|
|
80
|
+
options,
|
|
81
|
+
settings
|
|
82
|
+
);
|
|
75
83
|
}
|
|
76
84
|
};
|
|
77
85
|
}
|
|
78
86
|
|
|
79
87
|
private async *listByResourceGroupPagingPage(
|
|
80
88
|
resourceGroupName: string,
|
|
81
|
-
options?: AccountsListByResourceGroupOptionalParams
|
|
89
|
+
options?: AccountsListByResourceGroupOptionalParams,
|
|
90
|
+
settings?: PageSettings
|
|
82
91
|
): AsyncIterableIterator<MapsAccount[]> {
|
|
83
|
-
let result
|
|
84
|
-
|
|
85
|
-
|
|
92
|
+
let result: AccountsListByResourceGroupResponse;
|
|
93
|
+
let continuationToken = settings?.continuationToken;
|
|
94
|
+
if (!continuationToken) {
|
|
95
|
+
result = await this._listByResourceGroup(resourceGroupName, options);
|
|
96
|
+
let page = result.value || [];
|
|
97
|
+
continuationToken = result.nextLink;
|
|
98
|
+
setContinuationToken(page, continuationToken);
|
|
99
|
+
yield page;
|
|
100
|
+
}
|
|
86
101
|
while (continuationToken) {
|
|
87
102
|
result = await this._listByResourceGroupNext(
|
|
88
103
|
resourceGroupName,
|
|
@@ -90,7 +105,9 @@ export class AccountsImpl implements Accounts {
|
|
|
90
105
|
options
|
|
91
106
|
);
|
|
92
107
|
continuationToken = result.nextLink;
|
|
93
|
-
|
|
108
|
+
let page = result.value || [];
|
|
109
|
+
setContinuationToken(page, continuationToken);
|
|
110
|
+
yield page;
|
|
94
111
|
}
|
|
95
112
|
}
|
|
96
113
|
|
|
@@ -121,22 +138,34 @@ export class AccountsImpl implements Accounts {
|
|
|
121
138
|
[Symbol.asyncIterator]() {
|
|
122
139
|
return this;
|
|
123
140
|
},
|
|
124
|
-
byPage: () => {
|
|
125
|
-
|
|
141
|
+
byPage: (settings?: PageSettings) => {
|
|
142
|
+
if (settings?.maxPageSize) {
|
|
143
|
+
throw new Error("maxPageSize is not supported by this operation.");
|
|
144
|
+
}
|
|
145
|
+
return this.listBySubscriptionPagingPage(options, settings);
|
|
126
146
|
}
|
|
127
147
|
};
|
|
128
148
|
}
|
|
129
149
|
|
|
130
150
|
private async *listBySubscriptionPagingPage(
|
|
131
|
-
options?: AccountsListBySubscriptionOptionalParams
|
|
151
|
+
options?: AccountsListBySubscriptionOptionalParams,
|
|
152
|
+
settings?: PageSettings
|
|
132
153
|
): AsyncIterableIterator<MapsAccount[]> {
|
|
133
|
-
let result
|
|
134
|
-
|
|
135
|
-
|
|
154
|
+
let result: AccountsListBySubscriptionResponse;
|
|
155
|
+
let continuationToken = settings?.continuationToken;
|
|
156
|
+
if (!continuationToken) {
|
|
157
|
+
result = await this._listBySubscription(options);
|
|
158
|
+
let page = result.value || [];
|
|
159
|
+
continuationToken = result.nextLink;
|
|
160
|
+
setContinuationToken(page, continuationToken);
|
|
161
|
+
yield page;
|
|
162
|
+
}
|
|
136
163
|
while (continuationToken) {
|
|
137
164
|
result = await this._listBySubscriptionNext(continuationToken, options);
|
|
138
165
|
continuationToken = result.nextLink;
|
|
139
|
-
|
|
166
|
+
let page = result.value || [];
|
|
167
|
+
setContinuationToken(page, continuationToken);
|
|
168
|
+
yield page;
|
|
140
169
|
}
|
|
141
170
|
}
|
|
142
171
|
|
|
@@ -562,7 +591,6 @@ const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = {
|
|
|
562
591
|
bodyMapper: Mappers.ErrorResponse
|
|
563
592
|
}
|
|
564
593
|
},
|
|
565
|
-
queryParameters: [Parameters.apiVersion],
|
|
566
594
|
urlParameters: [
|
|
567
595
|
Parameters.$host,
|
|
568
596
|
Parameters.subscriptionId,
|
|
@@ -583,7 +611,6 @@ const listBySubscriptionNextOperationSpec: coreClient.OperationSpec = {
|
|
|
583
611
|
bodyMapper: Mappers.ErrorResponse
|
|
584
612
|
}
|
|
585
613
|
},
|
|
586
|
-
queryParameters: [Parameters.apiVersion],
|
|
587
614
|
urlParameters: [
|
|
588
615
|
Parameters.$host,
|
|
589
616
|
Parameters.subscriptionId,
|
|
@@ -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 { Creators } from "../operationsInterfaces";
|
|
11
12
|
import * as coreClient from "@azure/core-client";
|
|
12
13
|
import * as Mappers from "../models/mappers";
|
|
@@ -64,11 +65,15 @@ export class CreatorsImpl implements Creators {
|
|
|
64
65
|
[Symbol.asyncIterator]() {
|
|
65
66
|
return this;
|
|
66
67
|
},
|
|
67
|
-
byPage: () => {
|
|
68
|
+
byPage: (settings?: PageSettings) => {
|
|
69
|
+
if (settings?.maxPageSize) {
|
|
70
|
+
throw new Error("maxPageSize is not supported by this operation.");
|
|
71
|
+
}
|
|
68
72
|
return this.listByAccountPagingPage(
|
|
69
73
|
resourceGroupName,
|
|
70
74
|
accountName,
|
|
71
|
-
options
|
|
75
|
+
options,
|
|
76
|
+
settings
|
|
72
77
|
);
|
|
73
78
|
}
|
|
74
79
|
};
|
|
@@ -77,15 +82,22 @@ export class CreatorsImpl implements Creators {
|
|
|
77
82
|
private async *listByAccountPagingPage(
|
|
78
83
|
resourceGroupName: string,
|
|
79
84
|
accountName: string,
|
|
80
|
-
options?: CreatorsListByAccountOptionalParams
|
|
85
|
+
options?: CreatorsListByAccountOptionalParams,
|
|
86
|
+
settings?: PageSettings
|
|
81
87
|
): AsyncIterableIterator<Creator[]> {
|
|
82
|
-
let result
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
88
|
+
let result: CreatorsListByAccountResponse;
|
|
89
|
+
let continuationToken = settings?.continuationToken;
|
|
90
|
+
if (!continuationToken) {
|
|
91
|
+
result = await this._listByAccount(
|
|
92
|
+
resourceGroupName,
|
|
93
|
+
accountName,
|
|
94
|
+
options
|
|
95
|
+
);
|
|
96
|
+
let page = result.value || [];
|
|
97
|
+
continuationToken = result.nextLink;
|
|
98
|
+
setContinuationToken(page, continuationToken);
|
|
99
|
+
yield page;
|
|
100
|
+
}
|
|
89
101
|
while (continuationToken) {
|
|
90
102
|
result = await this._listByAccountNext(
|
|
91
103
|
resourceGroupName,
|
|
@@ -94,7 +106,9 @@ export class CreatorsImpl implements Creators {
|
|
|
94
106
|
options
|
|
95
107
|
);
|
|
96
108
|
continuationToken = result.nextLink;
|
|
97
|
-
|
|
109
|
+
let page = result.value || [];
|
|
110
|
+
setContinuationToken(page, continuationToken);
|
|
111
|
+
yield page;
|
|
98
112
|
}
|
|
99
113
|
}
|
|
100
114
|
|
|
@@ -370,7 +384,6 @@ const listByAccountNextOperationSpec: coreClient.OperationSpec = {
|
|
|
370
384
|
bodyMapper: Mappers.ErrorResponse
|
|
371
385
|
}
|
|
372
386
|
},
|
|
373
|
-
queryParameters: [Parameters.apiVersion],
|
|
374
387
|
urlParameters: [
|
|
375
388
|
Parameters.$host,
|
|
376
389
|
Parameters.subscriptionId,
|
package/src/operations/maps.ts
CHANGED
|
@@ -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 { Maps } from "../operationsInterfaces";
|
|
11
12
|
import * as coreClient from "@azure/core-client";
|
|
12
13
|
import * as Mappers from "../models/mappers";
|
|
@@ -16,9 +17,9 @@ import {
|
|
|
16
17
|
OperationDetail,
|
|
17
18
|
MapsListOperationsNextOptionalParams,
|
|
18
19
|
MapsListOperationsOptionalParams,
|
|
20
|
+
MapsListOperationsResponse,
|
|
19
21
|
MapsListSubscriptionOperationsNextOptionalParams,
|
|
20
22
|
MapsListSubscriptionOperationsOptionalParams,
|
|
21
|
-
MapsListOperationsResponse,
|
|
22
23
|
MapsListSubscriptionOperationsResponse,
|
|
23
24
|
MapsListOperationsNextResponse,
|
|
24
25
|
MapsListSubscriptionOperationsNextResponse
|
|
@@ -52,22 +53,34 @@ export class MapsImpl implements Maps {
|
|
|
52
53
|
[Symbol.asyncIterator]() {
|
|
53
54
|
return this;
|
|
54
55
|
},
|
|
55
|
-
byPage: () => {
|
|
56
|
-
|
|
56
|
+
byPage: (settings?: PageSettings) => {
|
|
57
|
+
if (settings?.maxPageSize) {
|
|
58
|
+
throw new Error("maxPageSize is not supported by this operation.");
|
|
59
|
+
}
|
|
60
|
+
return this.listOperationsPagingPage(options, settings);
|
|
57
61
|
}
|
|
58
62
|
};
|
|
59
63
|
}
|
|
60
64
|
|
|
61
65
|
private async *listOperationsPagingPage(
|
|
62
|
-
options?: MapsListOperationsOptionalParams
|
|
66
|
+
options?: MapsListOperationsOptionalParams,
|
|
67
|
+
settings?: PageSettings
|
|
63
68
|
): AsyncIterableIterator<OperationDetail[]> {
|
|
64
|
-
let result
|
|
65
|
-
|
|
66
|
-
|
|
69
|
+
let result: MapsListOperationsResponse;
|
|
70
|
+
let continuationToken = settings?.continuationToken;
|
|
71
|
+
if (!continuationToken) {
|
|
72
|
+
result = await this._listOperations(options);
|
|
73
|
+
let page = result.value || [];
|
|
74
|
+
continuationToken = result.nextLink;
|
|
75
|
+
setContinuationToken(page, continuationToken);
|
|
76
|
+
yield page;
|
|
77
|
+
}
|
|
67
78
|
while (continuationToken) {
|
|
68
79
|
result = await this._listOperationsNext(continuationToken, options);
|
|
69
80
|
continuationToken = result.nextLink;
|
|
70
|
-
|
|
81
|
+
let page = result.value || [];
|
|
82
|
+
setContinuationToken(page, continuationToken);
|
|
83
|
+
yield page;
|
|
71
84
|
}
|
|
72
85
|
}
|
|
73
86
|
|
|
@@ -94,25 +107,37 @@ export class MapsImpl implements Maps {
|
|
|
94
107
|
[Symbol.asyncIterator]() {
|
|
95
108
|
return this;
|
|
96
109
|
},
|
|
97
|
-
byPage: () => {
|
|
98
|
-
|
|
110
|
+
byPage: (settings?: PageSettings) => {
|
|
111
|
+
if (settings?.maxPageSize) {
|
|
112
|
+
throw new Error("maxPageSize is not supported by this operation.");
|
|
113
|
+
}
|
|
114
|
+
return this.listSubscriptionOperationsPagingPage(options, settings);
|
|
99
115
|
}
|
|
100
116
|
};
|
|
101
117
|
}
|
|
102
118
|
|
|
103
119
|
private async *listSubscriptionOperationsPagingPage(
|
|
104
|
-
options?: MapsListSubscriptionOperationsOptionalParams
|
|
120
|
+
options?: MapsListSubscriptionOperationsOptionalParams,
|
|
121
|
+
settings?: PageSettings
|
|
105
122
|
): AsyncIterableIterator<OperationDetail[]> {
|
|
106
|
-
let result
|
|
107
|
-
|
|
108
|
-
|
|
123
|
+
let result: MapsListSubscriptionOperationsResponse;
|
|
124
|
+
let continuationToken = settings?.continuationToken;
|
|
125
|
+
if (!continuationToken) {
|
|
126
|
+
result = await this._listSubscriptionOperations(options);
|
|
127
|
+
let page = result.value || [];
|
|
128
|
+
continuationToken = result.nextLink;
|
|
129
|
+
setContinuationToken(page, continuationToken);
|
|
130
|
+
yield page;
|
|
131
|
+
}
|
|
109
132
|
while (continuationToken) {
|
|
110
133
|
result = await this._listSubscriptionOperationsNext(
|
|
111
134
|
continuationToken,
|
|
112
135
|
options
|
|
113
136
|
);
|
|
114
137
|
continuationToken = result.nextLink;
|
|
115
|
-
|
|
138
|
+
let page = result.value || [];
|
|
139
|
+
setContinuationToken(page, continuationToken);
|
|
140
|
+
yield page;
|
|
116
141
|
}
|
|
117
142
|
}
|
|
118
143
|
|
|
@@ -229,7 +254,6 @@ const listOperationsNextOperationSpec: coreClient.OperationSpec = {
|
|
|
229
254
|
bodyMapper: Mappers.ErrorResponse
|
|
230
255
|
}
|
|
231
256
|
},
|
|
232
|
-
queryParameters: [Parameters.apiVersion],
|
|
233
257
|
urlParameters: [Parameters.$host, Parameters.nextLink],
|
|
234
258
|
headerParameters: [Parameters.accept],
|
|
235
259
|
serializer
|
|
@@ -245,7 +269,6 @@ const listSubscriptionOperationsNextOperationSpec: coreClient.OperationSpec = {
|
|
|
245
269
|
bodyMapper: Mappers.ErrorResponse
|
|
246
270
|
}
|
|
247
271
|
},
|
|
248
|
-
queryParameters: [Parameters.apiVersion],
|
|
249
272
|
urlParameters: [
|
|
250
273
|
Parameters.$host,
|
|
251
274
|
Parameters.subscriptionId,
|
|
@@ -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
|
+
}
|