@azure/arm-selfhelp 1.0.0-alpha.20230428.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/LICENSE +21 -0
- package/README.md +108 -0
- package/dist/index.js +1434 -0
- package/dist/index.js.map +1 -0
- package/dist/index.min.js +1 -0
- package/dist/index.min.js.map +1 -0
- package/dist-esm/samples-dev/diagnosticsCheckNameAvailabilitySample.d.ts +2 -0
- package/dist-esm/samples-dev/diagnosticsCheckNameAvailabilitySample.d.ts.map +1 -0
- package/dist-esm/samples-dev/diagnosticsCheckNameAvailabilitySample.js +66 -0
- package/dist-esm/samples-dev/diagnosticsCheckNameAvailabilitySample.js.map +1 -0
- package/dist-esm/samples-dev/diagnosticsCreateSample.d.ts +2 -0
- package/dist-esm/samples-dev/diagnosticsCreateSample.d.ts.map +1 -0
- package/dist-esm/samples-dev/diagnosticsCreateSample.js +37 -0
- package/dist-esm/samples-dev/diagnosticsCreateSample.js.map +1 -0
- package/dist-esm/samples-dev/diagnosticsGetSample.d.ts +2 -0
- package/dist-esm/samples-dev/diagnosticsGetSample.d.ts.map +1 -0
- package/dist-esm/samples-dev/diagnosticsGetSample.js +37 -0
- package/dist-esm/samples-dev/diagnosticsGetSample.js.map +1 -0
- package/dist-esm/samples-dev/discoverySolutionListSample.d.ts +2 -0
- package/dist-esm/samples-dev/discoverySolutionListSample.d.ts.map +1 -0
- package/dist-esm/samples-dev/discoverySolutionListSample.js +57 -0
- package/dist-esm/samples-dev/discoverySolutionListSample.js.map +1 -0
- package/dist-esm/samples-dev/operationsListSample.d.ts +2 -0
- package/dist-esm/samples-dev/operationsListSample.d.ts.map +1 -0
- package/dist-esm/samples-dev/operationsListSample.js +56 -0
- package/dist-esm/samples-dev/operationsListSample.js.map +1 -0
- package/dist-esm/src/helpRP.d.ts +20 -0
- package/dist-esm/src/helpRP.d.ts.map +1 -0
- package/dist-esm/src/helpRP.js +96 -0
- package/dist-esm/src/helpRP.js.map +1 -0
- package/dist-esm/src/index.d.ts +6 -0
- package/dist-esm/src/index.d.ts.map +1 -0
- package/dist-esm/src/index.js +13 -0
- package/dist-esm/src/index.js.map +1 -0
- package/dist-esm/src/lroImpl.d.ts +11 -0
- package/dist-esm/src/lroImpl.d.ts.map +1 -0
- package/dist-esm/src/lroImpl.js +21 -0
- package/dist-esm/src/lroImpl.js.map +1 -0
- package/dist-esm/src/models/index.d.ts +435 -0
- package/dist-esm/src/models/index.d.ts.map +1 -0
- package/dist-esm/src/models/index.js +72 -0
- package/dist-esm/src/models/index.js.map +1 -0
- package/dist-esm/src/models/mappers.d.ts +20 -0
- package/dist-esm/src/models/mappers.d.ts.map +1 -0
- package/dist-esm/src/models/mappers.js +585 -0
- package/dist-esm/src/models/mappers.js.map +1 -0
- package/dist-esm/src/models/parameters.d.ts +13 -0
- package/dist-esm/src/models/parameters.d.ts.map +1 -0
- package/dist-esm/src/models/parameters.js +117 -0
- package/dist-esm/src/models/parameters.js.map +1 -0
- package/dist-esm/src/operations/diagnostics.d.ts +53 -0
- package/dist-esm/src/operations/diagnostics.d.ts.map +1 -0
- package/dist-esm/src/operations/diagnostics.js +180 -0
- package/dist-esm/src/operations/diagnostics.js.map +1 -0
- package/dist-esm/src/operations/discoverySolution.d.ts +50 -0
- package/dist-esm/src/operations/discoverySolution.d.ts.map +1 -0
- package/dist-esm/src/operations/discoverySolution.js +160 -0
- package/dist-esm/src/operations/discoverySolution.js.map +1 -0
- package/dist-esm/src/operations/index.d.ts +4 -0
- package/dist-esm/src/operations/index.d.ts.map +1 -0
- package/dist-esm/src/operations/index.js +11 -0
- package/dist-esm/src/operations/index.js.map +1 -0
- package/dist-esm/src/operations/operations.d.ts +32 -0
- package/dist-esm/src/operations/operations.d.ts.map +1 -0
- package/dist-esm/src/operations/operations.js +138 -0
- package/dist-esm/src/operations/operations.js.map +1 -0
- package/dist-esm/src/operationsInterfaces/diagnostics.d.ts +45 -0
- package/dist-esm/src/operationsInterfaces/diagnostics.d.ts.map +1 -0
- package/dist-esm/src/operationsInterfaces/diagnostics.js +9 -0
- package/dist-esm/src/operationsInterfaces/diagnostics.js.map +1 -0
- package/dist-esm/src/operationsInterfaces/discoverySolution.d.ts +19 -0
- package/dist-esm/src/operationsInterfaces/discoverySolution.d.ts.map +1 -0
- package/dist-esm/src/operationsInterfaces/discoverySolution.js +9 -0
- package/dist-esm/src/operationsInterfaces/discoverySolution.js.map +1 -0
- package/dist-esm/src/operationsInterfaces/index.d.ts +4 -0
- package/dist-esm/src/operationsInterfaces/index.d.ts.map +1 -0
- package/dist-esm/src/operationsInterfaces/index.js +11 -0
- package/dist-esm/src/operationsInterfaces/index.js.map +1 -0
- package/dist-esm/src/operationsInterfaces/operations.d.ts +11 -0
- package/dist-esm/src/operationsInterfaces/operations.d.ts.map +1 -0
- package/dist-esm/src/operationsInterfaces/operations.js +9 -0
- package/dist-esm/src/operationsInterfaces/operations.js.map +1 -0
- 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/selfhelp_operations_test.spec.d.ts +4 -0
- package/dist-esm/test/selfhelp_operations_test.spec.d.ts.map +1 -0
- package/dist-esm/test/selfhelp_operations_test.spec.js +62 -0
- package/dist-esm/test/selfhelp_operations_test.spec.js.map +1 -0
- package/package.json +123 -0
- package/review/arm-selfhelp.api.md +310 -0
- package/rollup.config.js +122 -0
- package/src/helpRP.ts +144 -0
- package/src/index.ts +13 -0
- package/src/lroImpl.ts +42 -0
- package/src/models/index.ts +485 -0
- package/src/models/mappers.ts +619 -0
- package/src/models/parameters.ts +136 -0
- package/src/operations/diagnostics.ts +249 -0
- package/src/operations/discoverySolution.ts +179 -0
- package/src/operations/index.ts +11 -0
- package/src/operations/operations.ts +149 -0
- package/src/operationsInterfaces/diagnostics.ts +80 -0
- package/src/operationsInterfaces/discoverySolution.ts +34 -0
- package/src/operationsInterfaces/index.ts +11 -0
- package/src/operationsInterfaces/operations.ts +22 -0
- package/src/pagingHelper.ts +39 -0
- package/tsconfig.json +33 -0
- package/types/arm-selfhelp.d.ts +579 -0
- package/types/tsdoc-metadata.json +11 -0
|
@@ -0,0 +1,149 @@
|
|
|
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
|
+
import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging";
|
|
10
|
+
import { setContinuationToken } from "../pagingHelper";
|
|
11
|
+
import { Operations } from "../operationsInterfaces";
|
|
12
|
+
import * as coreClient from "@azure/core-client";
|
|
13
|
+
import * as Mappers from "../models/mappers";
|
|
14
|
+
import * as Parameters from "../models/parameters";
|
|
15
|
+
import { HelpRP } from "../helpRP";
|
|
16
|
+
import {
|
|
17
|
+
Operation,
|
|
18
|
+
OperationsListNextOptionalParams,
|
|
19
|
+
OperationsListOptionalParams,
|
|
20
|
+
OperationsListResponse,
|
|
21
|
+
OperationsListNextResponse
|
|
22
|
+
} from "../models";
|
|
23
|
+
|
|
24
|
+
/// <reference lib="esnext.asynciterable" />
|
|
25
|
+
/** Class containing Operations operations. */
|
|
26
|
+
export class OperationsImpl implements Operations {
|
|
27
|
+
private readonly client: HelpRP;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Initialize a new instance of the class Operations class.
|
|
31
|
+
* @param client Reference to the service client
|
|
32
|
+
*/
|
|
33
|
+
constructor(client: HelpRP) {
|
|
34
|
+
this.client = client;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Returns list of operations.
|
|
39
|
+
* @param options The options parameters.
|
|
40
|
+
*/
|
|
41
|
+
public list(
|
|
42
|
+
options?: OperationsListOptionalParams
|
|
43
|
+
): PagedAsyncIterableIterator<Operation> {
|
|
44
|
+
const iter = this.listPagingAll(options);
|
|
45
|
+
return {
|
|
46
|
+
next() {
|
|
47
|
+
return iter.next();
|
|
48
|
+
},
|
|
49
|
+
[Symbol.asyncIterator]() {
|
|
50
|
+
return this;
|
|
51
|
+
},
|
|
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);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
private async *listPagingPage(
|
|
62
|
+
options?: OperationsListOptionalParams,
|
|
63
|
+
settings?: PageSettings
|
|
64
|
+
): AsyncIterableIterator<Operation[]> {
|
|
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
|
+
}
|
|
74
|
+
while (continuationToken) {
|
|
75
|
+
result = await this._listNext(continuationToken, options);
|
|
76
|
+
continuationToken = result.nextLink;
|
|
77
|
+
let page = result.value || [];
|
|
78
|
+
setContinuationToken(page, continuationToken);
|
|
79
|
+
yield page;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
private async *listPagingAll(
|
|
84
|
+
options?: OperationsListOptionalParams
|
|
85
|
+
): AsyncIterableIterator<Operation> {
|
|
86
|
+
for await (const page of this.listPagingPage(options)) {
|
|
87
|
+
yield* page;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Returns list of operations.
|
|
93
|
+
* @param options The options parameters.
|
|
94
|
+
*/
|
|
95
|
+
private _list(
|
|
96
|
+
options?: OperationsListOptionalParams
|
|
97
|
+
): Promise<OperationsListResponse> {
|
|
98
|
+
return this.client.sendOperationRequest({ options }, listOperationSpec);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* ListNext
|
|
103
|
+
* @param nextLink The nextLink from the previous successful call to the List method.
|
|
104
|
+
* @param options The options parameters.
|
|
105
|
+
*/
|
|
106
|
+
private _listNext(
|
|
107
|
+
nextLink: string,
|
|
108
|
+
options?: OperationsListNextOptionalParams
|
|
109
|
+
): Promise<OperationsListNextResponse> {
|
|
110
|
+
return this.client.sendOperationRequest(
|
|
111
|
+
{ nextLink, options },
|
|
112
|
+
listNextOperationSpec
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
// Operation Specifications
|
|
117
|
+
const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
|
|
118
|
+
|
|
119
|
+
const listOperationSpec: coreClient.OperationSpec = {
|
|
120
|
+
path: "/providers/Microsoft.Help/operations",
|
|
121
|
+
httpMethod: "GET",
|
|
122
|
+
responses: {
|
|
123
|
+
200: {
|
|
124
|
+
bodyMapper: Mappers.OperationListResult
|
|
125
|
+
},
|
|
126
|
+
default: {
|
|
127
|
+
bodyMapper: Mappers.ErrorResponse
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
queryParameters: [Parameters.apiVersion],
|
|
131
|
+
urlParameters: [Parameters.$host],
|
|
132
|
+
headerParameters: [Parameters.accept],
|
|
133
|
+
serializer
|
|
134
|
+
};
|
|
135
|
+
const listNextOperationSpec: coreClient.OperationSpec = {
|
|
136
|
+
path: "{nextLink}",
|
|
137
|
+
httpMethod: "GET",
|
|
138
|
+
responses: {
|
|
139
|
+
200: {
|
|
140
|
+
bodyMapper: Mappers.OperationListResult
|
|
141
|
+
},
|
|
142
|
+
default: {
|
|
143
|
+
bodyMapper: Mappers.ErrorResponse
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
urlParameters: [Parameters.$host, Parameters.nextLink],
|
|
147
|
+
headerParameters: [Parameters.accept],
|
|
148
|
+
serializer
|
|
149
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
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
|
+
import { SimplePollerLike, OperationState } from "@azure/core-lro";
|
|
10
|
+
import {
|
|
11
|
+
DiagnosticsCheckNameAvailabilityOptionalParams,
|
|
12
|
+
DiagnosticsCheckNameAvailabilityResponse,
|
|
13
|
+
DiagnosticsCreateOptionalParams,
|
|
14
|
+
DiagnosticsCreateResponse,
|
|
15
|
+
DiagnosticsGetOptionalParams,
|
|
16
|
+
DiagnosticsGetResponse
|
|
17
|
+
} from "../models";
|
|
18
|
+
|
|
19
|
+
/** Interface representing a Diagnostics. */
|
|
20
|
+
export interface Diagnostics {
|
|
21
|
+
/**
|
|
22
|
+
* This API is used to check the uniqueness of a resource name used for a diagnostic check.
|
|
23
|
+
* @param scope This is an extension resource provider and only resource level extension is supported
|
|
24
|
+
* at the moment.
|
|
25
|
+
* @param options The options parameters.
|
|
26
|
+
*/
|
|
27
|
+
checkNameAvailability(
|
|
28
|
+
scope: string,
|
|
29
|
+
options?: DiagnosticsCheckNameAvailabilityOptionalParams
|
|
30
|
+
): Promise<DiagnosticsCheckNameAvailabilityResponse>;
|
|
31
|
+
/**
|
|
32
|
+
* Diagnostics tells you precisely the root cause of the issue and how to address it. You can get
|
|
33
|
+
* diagnostics once you discover and identify the relevant solution for your Azure issue.<br/><br/> You
|
|
34
|
+
* can create diagnostics using the ‘solutionId’ from Solution Discovery API response and
|
|
35
|
+
* ‘additionalParameters’ <br/><br/> <b>Note: </b>‘requiredParameterSets’ from Solutions Discovery API
|
|
36
|
+
* response must be passed via ‘additionalParameters’ as an input to Diagnostics API
|
|
37
|
+
* @param scope This is an extension resource provider and only resource level extension is supported
|
|
38
|
+
* at the moment.
|
|
39
|
+
* @param diagnosticsResourceName Unique resource name for insight resources
|
|
40
|
+
* @param options The options parameters.
|
|
41
|
+
*/
|
|
42
|
+
beginCreate(
|
|
43
|
+
scope: string,
|
|
44
|
+
diagnosticsResourceName: string,
|
|
45
|
+
options?: DiagnosticsCreateOptionalParams
|
|
46
|
+
): Promise<
|
|
47
|
+
SimplePollerLike<
|
|
48
|
+
OperationState<DiagnosticsCreateResponse>,
|
|
49
|
+
DiagnosticsCreateResponse
|
|
50
|
+
>
|
|
51
|
+
>;
|
|
52
|
+
/**
|
|
53
|
+
* Diagnostics tells you precisely the root cause of the issue and how to address it. You can get
|
|
54
|
+
* diagnostics once you discover and identify the relevant solution for your Azure issue.<br/><br/> You
|
|
55
|
+
* can create diagnostics using the ‘solutionId’ from Solution Discovery API response and
|
|
56
|
+
* ‘additionalParameters’ <br/><br/> <b>Note: </b>‘requiredParameterSets’ from Solutions Discovery API
|
|
57
|
+
* response must be passed via ‘additionalParameters’ as an input to Diagnostics API
|
|
58
|
+
* @param scope This is an extension resource provider and only resource level extension is supported
|
|
59
|
+
* at the moment.
|
|
60
|
+
* @param diagnosticsResourceName Unique resource name for insight resources
|
|
61
|
+
* @param options The options parameters.
|
|
62
|
+
*/
|
|
63
|
+
beginCreateAndWait(
|
|
64
|
+
scope: string,
|
|
65
|
+
diagnosticsResourceName: string,
|
|
66
|
+
options?: DiagnosticsCreateOptionalParams
|
|
67
|
+
): Promise<DiagnosticsCreateResponse>;
|
|
68
|
+
/**
|
|
69
|
+
* Get the diagnostics using the 'diagnosticsResourceName' you chose while creating the diagnostic.
|
|
70
|
+
* @param scope This is an extension resource provider and only resource level extension is supported
|
|
71
|
+
* at the moment.
|
|
72
|
+
* @param diagnosticsResourceName Unique resource name for insight resources
|
|
73
|
+
* @param options The options parameters.
|
|
74
|
+
*/
|
|
75
|
+
get(
|
|
76
|
+
scope: string,
|
|
77
|
+
diagnosticsResourceName: string,
|
|
78
|
+
options?: DiagnosticsGetOptionalParams
|
|
79
|
+
): Promise<DiagnosticsGetResponse>;
|
|
80
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
import { PagedAsyncIterableIterator } from "@azure/core-paging";
|
|
10
|
+
import {
|
|
11
|
+
SolutionMetadataResource,
|
|
12
|
+
DiscoverySolutionListOptionalParams
|
|
13
|
+
} from "../models";
|
|
14
|
+
|
|
15
|
+
/// <reference lib="esnext.asynciterable" />
|
|
16
|
+
/** Interface representing a DiscoverySolution. */
|
|
17
|
+
export interface DiscoverySolution {
|
|
18
|
+
/**
|
|
19
|
+
* Solutions Discovery is the initial point of entry within Help API, which helps you identify the
|
|
20
|
+
* relevant solutions for your Azure issue.<br/><br/> You can discover solutions using resourceUri OR
|
|
21
|
+
* resourceUri + problemClassificationId.<br/><br/>We will do our best in returning relevant
|
|
22
|
+
* diagnostics for your Azure issue.<br/><br/> Get the problemClassificationId(s) using this
|
|
23
|
+
* [reference](https://learn.microsoft.com/rest/api/support/problem-classifications/list?tabs=HTTP).<br/><br/>
|
|
24
|
+
* <b>Note: </b> ‘requiredParameterSets’ from Solutions Discovery API response must be passed via
|
|
25
|
+
* ‘additionalParameters’ as an input to Diagnostics API.
|
|
26
|
+
* @param scope This is an extension resource provider and only resource level extension is supported
|
|
27
|
+
* at the moment.
|
|
28
|
+
* @param options The options parameters.
|
|
29
|
+
*/
|
|
30
|
+
list(
|
|
31
|
+
scope: string,
|
|
32
|
+
options?: DiscoverySolutionListOptionalParams
|
|
33
|
+
): PagedAsyncIterableIterator<SolutionMetadataResource>;
|
|
34
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
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 * from "./operations";
|
|
10
|
+
export * from "./diagnostics";
|
|
11
|
+
export * from "./discoverySolution";
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
import { PagedAsyncIterableIterator } from "@azure/core-paging";
|
|
10
|
+
import { Operation, OperationsListOptionalParams } from "../models";
|
|
11
|
+
|
|
12
|
+
/// <reference lib="esnext.asynciterable" />
|
|
13
|
+
/** Interface representing a Operations. */
|
|
14
|
+
export interface Operations {
|
|
15
|
+
/**
|
|
16
|
+
* Returns list of operations.
|
|
17
|
+
* @param options The options parameters.
|
|
18
|
+
*/
|
|
19
|
+
list(
|
|
20
|
+
options?: OperationsListOptionalParams
|
|
21
|
+
): PagedAsyncIterableIterator<Operation>;
|
|
22
|
+
}
|
|
@@ -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
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"module": "es6",
|
|
4
|
+
"moduleResolution": "node",
|
|
5
|
+
"strict": true,
|
|
6
|
+
"target": "es6",
|
|
7
|
+
"sourceMap": true,
|
|
8
|
+
"declarationMap": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"allowSyntheticDefaultImports": true,
|
|
11
|
+
"forceConsistentCasingInFileNames": true,
|
|
12
|
+
"lib": [
|
|
13
|
+
"es6",
|
|
14
|
+
"dom"
|
|
15
|
+
],
|
|
16
|
+
"declaration": true,
|
|
17
|
+
"outDir": "./dist-esm",
|
|
18
|
+
"importHelpers": true,
|
|
19
|
+
"paths": {
|
|
20
|
+
"@azure/arm-selfhelp": [
|
|
21
|
+
"./src/index"
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"include": [
|
|
26
|
+
"./src/**/*.ts",
|
|
27
|
+
"./test/**/*.ts",
|
|
28
|
+
"samples-dev/**/*.ts"
|
|
29
|
+
],
|
|
30
|
+
"exclude": [
|
|
31
|
+
"node_modules"
|
|
32
|
+
]
|
|
33
|
+
}
|