sailpoint-api-client 1.6.2 → 1.6.3
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/beta/README.md +2 -2
- package/beta/api.ts +20 -12
- package/beta/common.ts +2 -2
- package/beta/package.json +1 -1
- package/dist/beta/api.d.ts +20 -12
- package/dist/beta/api.js +16 -9
- package/dist/beta/api.js.map +1 -1
- package/dist/beta/common.js +1 -1
- package/dist/index.spec.js +67 -16
- package/dist/index.spec.js.map +1 -1
- package/dist/paginator.d.ts +28 -2
- package/dist/paginator.js +39 -11
- package/dist/paginator.js.map +1 -1
- package/dist/v2024/api.d.ts +136 -189
- package/dist/v2024/api.js +222 -249
- package/dist/v2024/api.js.map +1 -1
- package/dist/v2024/common.js +1 -1
- package/dist/v2025/api.d.ts +1098 -183
- package/dist/v2025/api.js +1564 -273
- package/dist/v2025/api.js.map +1 -1
- package/dist/v2025/common.js +1 -1
- package/dist/v3/api.d.ts +20 -12
- package/dist/v3/api.js +18 -11
- package/dist/v3/api.js.map +1 -1
- package/dist/v3/common.js +1 -1
- package/index.spec.ts +44 -2
- package/package.json +1 -1
- package/paginator.ts +77 -13
- package/v2024/README.md +2 -2
- package/v2024/api.ts +251 -390
- package/v2024/common.ts +2 -2
- package/v2024/package.json +1 -1
- package/v2025/README.md +2 -2
- package/v2025/api.ts +2048 -622
- package/v2025/common.ts +2 -2
- package/v2025/package.json +1 -1
- package/v3/README.md +2 -2
- package/v3/api.ts +22 -14
- package/v3/common.ts +2 -2
- package/v3/package.json +1 -1
package/dist/v3/common.js
CHANGED
|
@@ -250,7 +250,7 @@ var createRequestFunction = function (axiosArgs, globalAxios, BASE_PATH, configu
|
|
|
250
250
|
if (axios === void 0) { axios = globalAxios; }
|
|
251
251
|
if (basePath === void 0) { basePath = BASE_PATH; }
|
|
252
252
|
(0, axios_retry_1.default)(axios, configuration.retriesConfig);
|
|
253
|
-
var headers = __assign(__assign({ 'User-Agent': 'OpenAPI-Generator/1.6.
|
|
253
|
+
var headers = __assign(__assign({ 'User-Agent': 'OpenAPI-Generator/1.6.3/ts' }, axiosArgs.axiosOptions.headers), { 'X-SailPoint-SDK': 'typescript-1.6.3' });
|
|
254
254
|
if (!configuration.experimental && ("X-SailPoint-Experimental" in headers)) {
|
|
255
255
|
throw new Error("You are using Experimental APIs. Set configuration.experimental = True to enable these APIs in the SDK.");
|
|
256
256
|
}
|
package/index.spec.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { AccountsBetaApi, ConnectorsBetaApi, IdentityProfilesBetaApi, Paginator, Search,
|
|
2
|
-
import { AccountsApi, Configuration, SearchApi } from "./index"
|
|
1
|
+
import { AccountsApi, AccountsBetaApi, AccountsV2024Api, Configuration, ConnectorsBetaApi, IdentitiesV2024Api, IdentityProfilesBetaApi, Paginator, Search, SearchApi, SearchV2024, SearchV2024Api, SearchV2025, SearchV2025Api, SourcesBetaApi, TransformsApi, TransformsV2024Api } from "./index"
|
|
3
2
|
|
|
4
3
|
describe('Test_v3', () => {
|
|
5
4
|
it('Test List Accounts', async () => {
|
|
@@ -136,4 +135,47 @@ describe('Test_v2024', () => {
|
|
|
136
135
|
expect(resp.data.length).toStrictEqual(10)
|
|
137
136
|
expect(resp.status).toStrictEqual(200)
|
|
138
137
|
}, 30000)
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
it('Test paginate search API with V2024', async () => {
|
|
141
|
+
let apiConfig = new Configuration()
|
|
142
|
+
let api = new SearchV2024Api(apiConfig)
|
|
143
|
+
|
|
144
|
+
let search: SearchV2024 = {
|
|
145
|
+
indices: [
|
|
146
|
+
"identities"
|
|
147
|
+
],
|
|
148
|
+
query: {
|
|
149
|
+
query: "*"
|
|
150
|
+
},
|
|
151
|
+
sort: ["-name"]
|
|
152
|
+
}
|
|
153
|
+
const resp = await Paginator.paginateSearchApi(api, search, 10, 100)
|
|
154
|
+
|
|
155
|
+
expect(resp.data.length).toStrictEqual(100)
|
|
156
|
+
expect(resp.status).toStrictEqual(200)
|
|
157
|
+
}, 30000)
|
|
139
158
|
})
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
describe('Test_v2025', () => {
|
|
162
|
+
|
|
163
|
+
it('Test paginate search API with V2025', async () => {
|
|
164
|
+
let apiConfig = new Configuration()
|
|
165
|
+
let api = new SearchV2025Api(apiConfig)
|
|
166
|
+
|
|
167
|
+
let search: SearchV2025 = {
|
|
168
|
+
indices: [
|
|
169
|
+
"identities"
|
|
170
|
+
],
|
|
171
|
+
query: {
|
|
172
|
+
query: "*"
|
|
173
|
+
},
|
|
174
|
+
sort: ["-name"]
|
|
175
|
+
}
|
|
176
|
+
const resp = await Paginator.paginateSearchApi(api, search, 10, 100)
|
|
177
|
+
|
|
178
|
+
expect(resp.data.length).toStrictEqual(100)
|
|
179
|
+
expect(resp.status).toStrictEqual(200)
|
|
180
|
+
}, 30000)
|
|
181
|
+
})
|
package/package.json
CHANGED
package/paginator.ts
CHANGED
|
@@ -6,6 +6,20 @@ import {
|
|
|
6
6
|
SearchDocument,
|
|
7
7
|
} from "./v3";
|
|
8
8
|
|
|
9
|
+
import {
|
|
10
|
+
SearchDocumentV2024,
|
|
11
|
+
SearchV2024,
|
|
12
|
+
SearchV2024Api,
|
|
13
|
+
SearchV2024ApiSearchPostRequest,
|
|
14
|
+
} from "./v2024/api";
|
|
15
|
+
|
|
16
|
+
import {
|
|
17
|
+
SearchDocumentV2025,
|
|
18
|
+
SearchV2025,
|
|
19
|
+
SearchV2025Api,
|
|
20
|
+
SearchV2025ApiSearchPostRequest,
|
|
21
|
+
} from "./v2025/api";
|
|
22
|
+
|
|
9
23
|
export interface PaginationParams {
|
|
10
24
|
/**
|
|
11
25
|
* Max number of results to return. See [V3 API Standard Collection Parameters](https://developer.sailpoint.com/idn/api/standard-collection-parameters) for more information.
|
|
@@ -38,6 +52,34 @@ export interface ExtraParams {
|
|
|
38
52
|
[key: string]: any;
|
|
39
53
|
}
|
|
40
54
|
|
|
55
|
+
interface SearchApiTypeMap {
|
|
56
|
+
SearchApi: {
|
|
57
|
+
search: Search;
|
|
58
|
+
searchParams: SearchApiSearchPostRequest;
|
|
59
|
+
document: SearchDocument;
|
|
60
|
+
};
|
|
61
|
+
SearchV2024Api: {
|
|
62
|
+
search: SearchV2024;
|
|
63
|
+
searchParams: SearchV2024ApiSearchPostRequest;
|
|
64
|
+
document: SearchDocumentV2024;
|
|
65
|
+
};
|
|
66
|
+
SearchV2025Api: {
|
|
67
|
+
search: SearchV2025;
|
|
68
|
+
searchParams: SearchV2025ApiSearchPostRequest;
|
|
69
|
+
document: SearchDocumentV2025;
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Create a union type for all possible API types
|
|
74
|
+
type ApiType = keyof SearchApiTypeMap;
|
|
75
|
+
|
|
76
|
+
// Define the actual API instances mapping
|
|
77
|
+
type ApiInstanceMap = {
|
|
78
|
+
SearchApi: SearchApi;
|
|
79
|
+
SearchV2024Api: SearchV2024Api;
|
|
80
|
+
SearchV2025Api: SearchV2025Api;
|
|
81
|
+
};
|
|
82
|
+
|
|
41
83
|
export class Paginator {
|
|
42
84
|
public static async paginate<
|
|
43
85
|
T,
|
|
@@ -75,20 +117,17 @@ export class Paginator {
|
|
|
75
117
|
}
|
|
76
118
|
}
|
|
77
119
|
|
|
78
|
-
public static async paginateSearchApi(
|
|
79
|
-
searchAPI:
|
|
80
|
-
search:
|
|
120
|
+
public static async paginateSearchApi<T extends ApiType>(
|
|
121
|
+
searchAPI: ApiInstanceMap[T],
|
|
122
|
+
search: SearchApiTypeMap[T]['search'],
|
|
81
123
|
increment?: number,
|
|
82
124
|
limit?: number
|
|
83
|
-
): Promise<AxiosResponse<
|
|
125
|
+
): Promise<AxiosResponse<SearchApiTypeMap[T]['document'][], any>> {
|
|
84
126
|
increment = increment ? increment : 250;
|
|
85
|
-
|
|
86
|
-
search: search,
|
|
87
|
-
limit: increment,
|
|
88
|
-
};
|
|
127
|
+
|
|
89
128
|
let offset = 0;
|
|
90
129
|
const maxLimit = limit ? limit : 0;
|
|
91
|
-
let modified:
|
|
130
|
+
let modified: SearchApiTypeMap[T]['document'][] = [];
|
|
92
131
|
|
|
93
132
|
if (!search.sort || search.sort.length != 1) {
|
|
94
133
|
throw "search must include exactly one sort parameter to paginate properly";
|
|
@@ -96,8 +135,33 @@ export class Paginator {
|
|
|
96
135
|
|
|
97
136
|
while (true) {
|
|
98
137
|
console.log(`Paginating call, offset = ${offset}`);
|
|
99
|
-
let results
|
|
138
|
+
let results: AxiosResponse<SearchApiTypeMap[T]['document'][], any>;
|
|
139
|
+
|
|
140
|
+
// Handle each API type separately to avoid type conflicts
|
|
141
|
+
if (searchAPI instanceof SearchApi) {
|
|
142
|
+
const searchParams: SearchApiSearchPostRequest = {
|
|
143
|
+
search: search as Search,
|
|
144
|
+
limit: increment,
|
|
145
|
+
};
|
|
146
|
+
results = await (searchAPI as SearchApi).searchPost(searchParams) as AxiosResponse<SearchApiTypeMap[T]['document'][], any>;
|
|
147
|
+
} else if (searchAPI instanceof SearchV2024Api) {
|
|
148
|
+
const searchParams: SearchV2024ApiSearchPostRequest = {
|
|
149
|
+
searchV2024: search as SearchV2024,
|
|
150
|
+
limit: increment,
|
|
151
|
+
};
|
|
152
|
+
results = await (searchAPI as SearchV2024Api).searchPost(searchParams) as AxiosResponse<SearchApiTypeMap[T]['document'][], any>;
|
|
153
|
+
} else if (searchAPI instanceof SearchV2025Api) {
|
|
154
|
+
const searchParams: SearchV2025ApiSearchPostRequest = {
|
|
155
|
+
searchV2025: search as SearchV2025,
|
|
156
|
+
limit: increment,
|
|
157
|
+
};
|
|
158
|
+
results = await (searchAPI as SearchV2025Api).searchPost(searchParams) as AxiosResponse<SearchApiTypeMap[T]['document'][], any>;
|
|
159
|
+
} else {
|
|
160
|
+
throw new Error("Unsupported API type");
|
|
161
|
+
}
|
|
162
|
+
|
|
100
163
|
modified.push.apply(modified, results.data);
|
|
164
|
+
|
|
101
165
|
if (
|
|
102
166
|
results.data.length < increment ||
|
|
103
167
|
(modified.length >= maxLimit && maxLimit > 0)
|
|
@@ -106,9 +170,9 @@ export class Paginator {
|
|
|
106
170
|
return results;
|
|
107
171
|
} else {
|
|
108
172
|
const result = <any>results.data[results.data.length - 1];
|
|
109
|
-
if (
|
|
110
|
-
|
|
111
|
-
result[
|
|
173
|
+
if (search.sort) {
|
|
174
|
+
(search as any).searchAfter = [
|
|
175
|
+
result[search.sort[0].replace("-", "")],
|
|
112
176
|
];
|
|
113
177
|
} else {
|
|
114
178
|
throw "search unexpectedly did not return a result we can search after!";
|
package/v2024/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
## sailpoint-sdk@1.6.
|
|
1
|
+
## sailpoint-sdk@1.6.3
|
|
2
2
|
|
|
3
3
|
This generator creates TypeScript/JavaScript client that utilizes [axios](https://github.com/axios/axios). The generated Node module can be used in the following environments:
|
|
4
4
|
|
|
@@ -36,7 +36,7 @@ navigate to the folder of your consuming project and run one of the following co
|
|
|
36
36
|
_published:_
|
|
37
37
|
|
|
38
38
|
```
|
|
39
|
-
npm install sailpoint-sdk@1.6.
|
|
39
|
+
npm install sailpoint-sdk@1.6.3 --save
|
|
40
40
|
```
|
|
41
41
|
|
|
42
42
|
_unPublished (not recommended):_
|