sailpoint-api-client 1.6.7 → 1.6.9

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 (68) hide show
  1. package/beta/README.md +2 -2
  2. package/beta/api.ts +87 -577
  3. package/beta/common.ts +2 -2
  4. package/beta/package.json +1 -1
  5. package/dist/beta/api.d.ts +81 -452
  6. package/dist/beta/api.js +30 -300
  7. package/dist/beta/api.js.map +1 -1
  8. package/dist/beta/common.js +1 -1
  9. package/dist/generic/api.d.ts +386 -0
  10. package/dist/generic/api.js +689 -0
  11. package/dist/generic/api.js.map +1 -0
  12. package/dist/generic/base.d.ts +66 -0
  13. package/dist/generic/base.js +89 -0
  14. package/dist/generic/base.js.map +1 -0
  15. package/dist/generic/common.d.ts +65 -0
  16. package/dist/generic/common.js +260 -0
  17. package/dist/generic/common.js.map +1 -0
  18. package/dist/generic/configuration.d.ts +91 -0
  19. package/dist/generic/configuration.js +46 -0
  20. package/dist/generic/configuration.js.map +1 -0
  21. package/dist/generic/index.d.ts +13 -0
  22. package/dist/generic/index.js +32 -0
  23. package/dist/generic/index.js.map +1 -0
  24. package/dist/index.d.ts +5 -4
  25. package/dist/index.js +1 -0
  26. package/dist/index.js.map +1 -1
  27. package/dist/paginator.d.ts +3 -1
  28. package/dist/paginator.js +146 -0
  29. package/dist/paginator.js.map +1 -1
  30. package/dist/v2024/api.d.ts +1838 -575
  31. package/dist/v2024/api.js +1894 -593
  32. package/dist/v2024/api.js.map +1 -1
  33. package/dist/v2024/common.js +1 -1
  34. package/dist/v2025/api.d.ts +4368 -679
  35. package/dist/v2025/api.js +3866 -904
  36. package/dist/v2025/api.js.map +1 -1
  37. package/dist/v2025/common.js +1 -1
  38. package/dist/v3/api.d.ts +45 -83
  39. package/dist/v3/api.js +31 -30
  40. package/dist/v3/api.js.map +1 -1
  41. package/dist/v3/common.js +1 -1
  42. package/generic/.openapi-generator/FILES +11 -0
  43. package/generic/.openapi-generator/VERSION +1 -0
  44. package/generic/.openapi-generator-ignore +23 -0
  45. package/generic/README.md +46 -0
  46. package/generic/api.ts +681 -0
  47. package/generic/base.ts +86 -0
  48. package/generic/common.ts +159 -0
  49. package/generic/configuration.ts +110 -0
  50. package/generic/git_push.sh +57 -0
  51. package/generic/index.ts +18 -0
  52. package/generic/package.json +34 -0
  53. package/generic/tsconfig.json +21 -0
  54. package/index.ts +9 -7
  55. package/package.json +1 -1
  56. package/paginator.ts +137 -11
  57. package/v2024/README.md +2 -2
  58. package/v2024/api.ts +3049 -1208
  59. package/v2024/common.ts +2 -2
  60. package/v2024/package.json +1 -1
  61. package/v2025/README.md +2 -2
  62. package/v2025/api.ts +7717 -2573
  63. package/v2025/common.ts +2 -2
  64. package/v2025/package.json +1 -1
  65. package/v3/README.md +2 -2
  66. package/v3/api.ts +61 -97
  67. package/v3/common.ts +2 -2
  68. package/v3/package.json +1 -1
package/paginator.ts CHANGED
@@ -116,17 +116,60 @@ export class Paginator {
116
116
  }
117
117
  }
118
118
 
119
+ public static async *paginateGenerator<
120
+ T,
121
+ TResult,
122
+ A extends PaginationParams & ExtraParams
123
+ >(
124
+ thisArg: T,
125
+ callbackFn: (this: T, args: A) => Promise<AxiosResponse<TResult[], any>>,
126
+ args?: A,
127
+ increment?: number
128
+ ) {
129
+ let params: PaginationParams = args ? args : { limit: 0, offset: 0 };
130
+ const maxLimit = params && params.limit ? params.limit : 0;
131
+ if (!params.offset) {
132
+ params.offset = 0;
133
+ }
134
+ if (!increment) {
135
+ increment = 250;
136
+ }
137
+ params.limit = increment;
138
+
139
+ let totalYielded = 0;
140
+ while (true) {
141
+ const results = await callbackFn.call(thisArg, params);
142
+
143
+ for (const item of results.data) {
144
+ yield item;
145
+ totalYielded++;
146
+
147
+ // Stop if we've reached the max limit
148
+ if (maxLimit > 0 && totalYielded >= maxLimit) {
149
+ return;
150
+ }
151
+ }
152
+
153
+ // Stop if we got fewer results than requested
154
+ if (results.data.length < increment) {
155
+ return;
156
+ }
157
+
158
+ params.offset += increment;
159
+ }
160
+ }
161
+
119
162
  public static async paginateSearchApi<T extends ApiType>(
120
163
  searchAPI: ApiInstanceMap[T],
121
- search: SearchApiTypeMap[T]['search'],
164
+ search: SearchApiTypeMap[T]["search"],
122
165
  increment?: number,
123
166
  limit?: number
124
- ): Promise<AxiosResponse<SearchApiTypeMap[T]['document'][], any>> {
167
+ ): Promise<AxiosResponse<SearchApiTypeMap[T]["document"][], any>> {
125
168
  increment = increment ? increment : 250;
126
-
169
+
127
170
  let offset = 0;
128
171
  const maxLimit = limit ? limit : 0;
129
- let modified: SearchApiTypeMap[T]['document'][] = [];
172
+ let modified: SearchApiTypeMap[T]["document"][] = [];
130
173
 
131
174
  if (!search.sort || search.sort.length != 1) {
132
175
  throw "search must include exactly one sort parameter to paginate properly";
@@ -134,33 +177,39 @@ export class Paginator {
134
177
 
135
178
  while (true) {
136
179
  console.log(`Paginating call, offset = ${offset}`);
137
- let results: AxiosResponse<SearchApiTypeMap[T]['document'][], any>;
138
-
180
+ let results: AxiosResponse<SearchApiTypeMap[T]["document"][], any>;
181
+
139
182
  // Handle each API type separately to avoid type conflicts
140
183
  if (searchAPI instanceof SearchApi) {
141
184
  const searchParams: SearchApiSearchPostRequest = {
142
185
  search: search as Search,
143
186
  limit: increment,
144
187
  };
145
- results = await (searchAPI as SearchApi).searchPost(searchParams) as AxiosResponse<SearchApiTypeMap[T]['document'][], any>;
188
+ results = (await (searchAPI as SearchApi).searchPost(
189
+ searchParams
190
+ )) as AxiosResponse<SearchApiTypeMap[T]["document"][], any>;
146
191
  } else if (searchAPI instanceof SearchV2024Api) {
147
192
  const searchParams: SearchV2024ApiSearchPostRequest = {
148
193
  searchV2024: search as SearchV2024,
149
194
  limit: increment,
150
195
  };
151
- results = await (searchAPI as SearchV2024Api).searchPost(searchParams) as AxiosResponse<SearchApiTypeMap[T]['document'][], any>;
196
+ results = (await (searchAPI as SearchV2024Api).searchPost(
197
+ searchParams
198
+ )) as AxiosResponse<SearchApiTypeMap[T]["document"][], any>;
152
199
  } else if (searchAPI instanceof SearchV2025Api) {
153
200
  const searchParams: SearchV2025ApiSearchPostRequest = {
154
201
  searchV2025: search as SearchV2025,
155
202
  limit: increment,
156
203
  };
157
- results = await (searchAPI as SearchV2025Api).searchPost(searchParams) as AxiosResponse<SearchApiTypeMap[T]['document'][], any>;
204
+ results = (await (searchAPI as SearchV2025Api).searchPost(
205
+ searchParams
206
+ )) as AxiosResponse<SearchApiTypeMap[T]["document"][], any>;
158
207
  } else {
159
208
  throw new Error("Unsupported API type");
160
209
  }
161
-
210
+
162
211
  modified.push.apply(modified, results.data);
163
-
212
+
164
213
  if (
165
214
  results.data.length < increment ||
166
215
  (modified.length >= maxLimit && maxLimit > 0)
@@ -180,4 +229,81 @@ export class Paginator {
180
229
  offset += increment;
181
230
  }
182
231
  }
232
+
233
+ public static async *paginateSearchApiGenerator<T extends ApiType>(
234
+ searchAPI: ApiInstanceMap[T],
235
+ search: SearchApiTypeMap[T]["search"],
236
+ increment?: number,
237
+ limit?: number
238
+ ) {
239
+ increment = increment ? increment : 250;
240
+
241
+ let offset = 0;
242
+ const maxLimit = limit ? limit : 0;
243
+ let totalYielded = 0;
244
+
245
+ if (!search.sort || search.sort.length != 1) {
246
+ throw "search must include exactly one sort parameter to paginate properly";
247
+ }
248
+
249
+ while (true) {
250
+ console.log(`Paginating call, offset = ${offset}`);
251
+ let results: AxiosResponse<SearchApiTypeMap[T]["document"][], any>;
252
+
253
+ // Handle each API type separately to avoid type conflicts
254
+ if (searchAPI instanceof SearchApi) {
255
+ const searchParams: SearchApiSearchPostRequest = {
256
+ search: search as Search,
257
+ limit: increment,
258
+ };
259
+ results = (await (searchAPI as SearchApi).searchPost(
260
+ searchParams
261
+ )) as AxiosResponse<SearchApiTypeMap[T]["document"][], any>;
262
+ } else if (searchAPI instanceof SearchV2024Api) {
263
+ const searchParams: SearchV2024ApiSearchPostRequest = {
264
+ searchV2024: search as SearchV2024,
265
+ limit: increment,
266
+ };
267
+ results = (await (searchAPI as SearchV2024Api).searchPost(
268
+ searchParams
269
+ )) as AxiosResponse<SearchApiTypeMap[T]["document"][], any>;
270
+ } else if (searchAPI instanceof SearchV2025Api) {
271
+ const searchParams: SearchV2025ApiSearchPostRequest = {
272
+ searchV2025: search as SearchV2025,
273
+ limit: increment,
274
+ };
275
+ results = (await (searchAPI as SearchV2025Api).searchPost(
276
+ searchParams
277
+ )) as AxiosResponse<SearchApiTypeMap[T]["document"][], any>;
278
+ } else {
279
+ throw new Error("Unsupported API type");
280
+ }
281
+
282
+ // Yield each document as it arrives
283
+ for (const doc of results.data) {
284
+ yield doc;
285
+ totalYielded++;
286
+
287
+ // Stop if we've reached the max limit
288
+ if (maxLimit > 0 && totalYielded >= maxLimit) {
289
+ return;
290
+ }
291
+ }
292
+
293
+ // Stop if we got fewer results than requested
294
+ if (results.data.length < increment) {
295
+ return;
296
+ }
297
+
298
+ // Update search after for next iteration
299
+ const result = <any>results.data[results.data.length - 1];
300
+ if (search.sort) {
301
+ (search as any).searchAfter = [result[search.sort[0].replace("-", "")]];
302
+ } else {
303
+ throw "search unexpectedly did not return a result we can search after!";
304
+ }
305
+
306
+ offset += increment;
307
+ }
308
+ }
183
309
  }
package/v2024/README.md CHANGED
@@ -1,4 +1,4 @@
1
- ## sailpoint-sdk@1.6.7
1
+ ## sailpoint-sdk@1.6.9
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.7 --save
39
+ npm install sailpoint-sdk@1.6.9 --save
40
40
  ```
41
41
 
42
42
  _unPublished (not recommended):_