sailpoint-api-client 1.0.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/beta/.openapi-generator/FILES +11 -0
- package/beta/.openapi-generator/VERSION +1 -0
- package/beta/.openapi-generator-ignore +23 -0
- package/beta/README.md +45 -0
- package/beta/api.ts +63833 -0
- package/beta/base.ts +71 -0
- package/beta/common.ts +141 -0
- package/beta/configuration.ts +101 -0
- package/beta/git_push.sh +57 -0
- package/beta/index.ts +17 -0
- package/beta/package.json +35 -0
- package/beta/tsconfig.json +21 -0
- package/cc/.openapi-generator/FILES +11 -0
- package/cc/.openapi-generator/VERSION +1 -0
- package/cc/.openapi-generator-ignore +23 -0
- package/cc/README.md +45 -0
- package/cc/api.ts +2028 -0
- package/cc/base.ts +71 -0
- package/cc/common.ts +141 -0
- package/cc/configuration.ts +101 -0
- package/cc/git_push.sh +57 -0
- package/cc/index.ts +17 -0
- package/cc/package.json +35 -0
- package/cc/tsconfig.json +21 -0
- package/configuration.ts +217 -0
- package/dist/beta/api.d.ts +44076 -0
- package/dist/beta/api.js +42294 -0
- package/dist/beta/api.js.map +1 -0
- package/dist/beta/base.d.ts +55 -0
- package/dist/beta/base.js +83 -0
- package/dist/beta/base.js.map +1 -0
- package/dist/beta/common.d.ts +65 -0
- package/dist/beta/common.js +247 -0
- package/dist/beta/common.js.map +1 -0
- package/dist/beta/configuration.d.ts +83 -0
- package/dist/beta/configuration.js +45 -0
- package/dist/beta/configuration.js.map +1 -0
- package/dist/beta/index.d.ts +12 -0
- package/dist/beta/index.js +31 -0
- package/dist/beta/index.js.map +1 -0
- package/dist/cc/api.d.ts +1163 -0
- package/dist/cc/api.js +2047 -0
- package/dist/cc/api.js.map +1 -0
- package/dist/cc/base.d.ts +55 -0
- package/dist/cc/base.js +83 -0
- package/dist/cc/base.js.map +1 -0
- package/dist/cc/common.d.ts +65 -0
- package/dist/cc/common.js +247 -0
- package/dist/cc/common.js.map +1 -0
- package/dist/cc/configuration.d.ts +83 -0
- package/dist/cc/configuration.js +45 -0
- package/dist/cc/configuration.js.map +1 -0
- package/dist/cc/index.d.ts +12 -0
- package/dist/cc/index.js +31 -0
- package/dist/cc/index.js.map +1 -0
- package/dist/configuration.d.ts +147 -0
- package/dist/configuration.js +126 -0
- package/dist/configuration.js.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +47 -0
- package/dist/index.js.map +1 -0
- package/dist/paginator.d.ts +41 -0
- package/dist/paginator.js +126 -0
- package/dist/paginator.js.map +1 -0
- package/dist/v2/api.d.ts +1359 -0
- package/dist/v2/api.js +1239 -0
- package/dist/v2/api.js.map +1 -0
- package/dist/v2/base.d.ts +55 -0
- package/dist/v2/base.js +83 -0
- package/dist/v2/base.js.map +1 -0
- package/dist/v2/common.d.ts +65 -0
- package/dist/v2/common.js +247 -0
- package/dist/v2/common.js.map +1 -0
- package/dist/v2/configuration.d.ts +83 -0
- package/dist/v2/configuration.js +45 -0
- package/dist/v2/configuration.js.map +1 -0
- package/dist/v2/index.d.ts +12 -0
- package/dist/v2/index.js +31 -0
- package/dist/v2/index.js.map +1 -0
- package/dist/v3/api.d.ts +23657 -0
- package/dist/v3/api.js +18302 -0
- package/dist/v3/api.js.map +1 -0
- package/dist/v3/base.d.ts +55 -0
- package/dist/v3/base.js +83 -0
- package/dist/v3/base.js.map +1 -0
- package/dist/v3/common.d.ts +65 -0
- package/dist/v3/common.js +247 -0
- package/dist/v3/common.js.map +1 -0
- package/dist/v3/configuration.d.ts +83 -0
- package/dist/v3/configuration.js +45 -0
- package/dist/v3/configuration.js.map +1 -0
- package/dist/v3/index.d.ts +12 -0
- package/dist/v3/index.js +31 -0
- package/dist/v3/index.js.map +1 -0
- package/index.ts +33 -0
- package/package.json +39 -0
- package/paginator.ts +99 -0
- package/readme.md +53 -0
- package/tsconfig.json +22 -0
- package/v2/.openapi-generator/FILES +11 -0
- package/v2/.openapi-generator/VERSION +1 -0
- package/v2/.openapi-generator-ignore +23 -0
- package/v2/README.md +45 -0
- package/v2/api.ts +1900 -0
- package/v2/base.ts +71 -0
- package/v2/common.ts +141 -0
- package/v2/configuration.ts +101 -0
- package/v2/git_push.sh +57 -0
- package/v2/index.ts +17 -0
- package/v2/package.json +35 -0
- package/v2/tsconfig.json +21 -0
- package/v3/.openapi-generator/FILES +11 -0
- package/v3/.openapi-generator/VERSION +1 -0
- package/v3/.openapi-generator-ignore +23 -0
- package/v3/README.md +45 -0
- package/v3/api.ts +32081 -0
- package/v3/base.ts +71 -0
- package/v3/common.ts +141 -0
- package/v3/configuration.ts +101 -0
- package/v3/git_push.sh +57 -0
- package/v3/index.ts +17 -0
- package/v3/package.json +35 -0
- package/v3/tsconfig.json +21 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
/**
|
|
5
|
+
* IdentityNow cc (private) APIs
|
|
6
|
+
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
*
|
|
8
|
+
* The version of the OpenAPI document: 1.0.0
|
|
9
|
+
*
|
|
10
|
+
*
|
|
11
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
12
|
+
* https://openapi-generator.tech
|
|
13
|
+
* Do not edit the class manually.
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.Configuration = void 0;
|
|
17
|
+
var Configuration = /** @class */ (function () {
|
|
18
|
+
function Configuration(param) {
|
|
19
|
+
if (param === void 0) { param = {}; }
|
|
20
|
+
this.apiKey = param.apiKey;
|
|
21
|
+
this.username = param.username;
|
|
22
|
+
this.password = param.password;
|
|
23
|
+
this.accessToken = param.accessToken;
|
|
24
|
+
this.basePath = param.basePath;
|
|
25
|
+
this.baseOptions = param.baseOptions;
|
|
26
|
+
this.formDataCtor = param.formDataCtor;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Check if the given MIME is a JSON MIME.
|
|
30
|
+
* JSON MIME examples:
|
|
31
|
+
* application/json
|
|
32
|
+
* application/json; charset=UTF8
|
|
33
|
+
* APPLICATION/JSON
|
|
34
|
+
* application/vnd.company+json
|
|
35
|
+
* @param mime - MIME (Multipurpose Internet Mail Extensions)
|
|
36
|
+
* @return True if the given MIME is JSON, false otherwise.
|
|
37
|
+
*/
|
|
38
|
+
Configuration.prototype.isJsonMime = function (mime) {
|
|
39
|
+
var jsonMime = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
|
|
40
|
+
return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
|
|
41
|
+
};
|
|
42
|
+
return Configuration;
|
|
43
|
+
}());
|
|
44
|
+
exports.Configuration = Configuration;
|
|
45
|
+
//# sourceMappingURL=configuration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configuration.js","sourceRoot":"","sources":["../../cc/configuration.ts"],"names":[],"mappings":";AAAA,oBAAoB;AACpB,oBAAoB;AACpB;;;;;;;;;;GAUG;;;AAaH;IAmDI,uBAAY,KAAmC;QAAnC,sBAAA,EAAA,UAAmC;QAC3C,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;QAC3B,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAC/B,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAC/B,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;QACrC,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAC/B,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;QACrC,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC;IAC3C,CAAC;IAED;;;;;;;;;OASG;IACI,kCAAU,GAAjB,UAAkB,IAAY;QAC1B,IAAM,QAAQ,GAAW,IAAI,MAAM,CAAC,+DAA+D,EAAE,GAAG,CAAC,CAAC;QAC1G,OAAO,IAAI,KAAK,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,WAAW,EAAE,KAAK,6BAA6B,CAAC,CAAC;IAC1G,CAAC;IACL,oBAAC;AAAD,CAAC,AA3ED,IA2EC;AA3EY,sCAAa"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IdentityNow cc (private) APIs
|
|
3
|
+
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 1.0.0
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
export * from "./api";
|
package/dist/cc/index.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
/**
|
|
5
|
+
* IdentityNow cc (private) APIs
|
|
6
|
+
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
*
|
|
8
|
+
* The version of the OpenAPI document: 1.0.0
|
|
9
|
+
*
|
|
10
|
+
*
|
|
11
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
12
|
+
* https://openapi-generator.tech
|
|
13
|
+
* Do not edit the class manually.
|
|
14
|
+
*/
|
|
15
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
18
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
19
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
20
|
+
}
|
|
21
|
+
Object.defineProperty(o, k2, desc);
|
|
22
|
+
}) : (function(o, m, k, k2) {
|
|
23
|
+
if (k2 === undefined) k2 = k;
|
|
24
|
+
o[k2] = m[k];
|
|
25
|
+
}));
|
|
26
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
27
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
28
|
+
};
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
__exportStar(require("./api"), exports);
|
|
31
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../cc/index.ts"],"names":[],"mappings":";AAAA,oBAAoB;AACpB,oBAAoB;AACpB;;;;;;;;;;GAUG;;;;;;;;;;;;;;;;AAGH,wCAAsB"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { IAxiosRetryConfig } from "axios-retry";
|
|
2
|
+
export interface ConfigurationParameters {
|
|
3
|
+
baseurl?: string;
|
|
4
|
+
clientId?: string;
|
|
5
|
+
clientSecret?: string;
|
|
6
|
+
accessToken?: string;
|
|
7
|
+
tokenUrl?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface Configuration {
|
|
10
|
+
activeenvironment?: string;
|
|
11
|
+
authtype?: string;
|
|
12
|
+
customexporttemplatespath?: string;
|
|
13
|
+
customsearchtemplatespath?: string;
|
|
14
|
+
debug?: boolean;
|
|
15
|
+
environments?: {
|
|
16
|
+
[key: string]: Environment;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export interface Environment {
|
|
20
|
+
baseurl: string;
|
|
21
|
+
pat: Pat;
|
|
22
|
+
tenanturl: string;
|
|
23
|
+
}
|
|
24
|
+
export interface Pat {
|
|
25
|
+
clientid: string;
|
|
26
|
+
clientsecret: string;
|
|
27
|
+
}
|
|
28
|
+
export declare class Configuration {
|
|
29
|
+
/**
|
|
30
|
+
* parameter for apiKey security
|
|
31
|
+
* @param name security name
|
|
32
|
+
* @memberof Configuration
|
|
33
|
+
*/
|
|
34
|
+
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
|
|
35
|
+
/**
|
|
36
|
+
* parameter for clientId
|
|
37
|
+
*
|
|
38
|
+
* @type {string}
|
|
39
|
+
* @memberof Configuration
|
|
40
|
+
*/
|
|
41
|
+
clientId?: string;
|
|
42
|
+
/**
|
|
43
|
+
* parameter for clientSecret
|
|
44
|
+
*
|
|
45
|
+
* @type {string}
|
|
46
|
+
* @memberof Configuration
|
|
47
|
+
*/
|
|
48
|
+
clientSecret?: string;
|
|
49
|
+
/**
|
|
50
|
+
* parameter for clientSecret
|
|
51
|
+
*
|
|
52
|
+
* @type {string}
|
|
53
|
+
* @memberof Configuration
|
|
54
|
+
*/
|
|
55
|
+
/**
|
|
56
|
+
* parameter for oauth2 security
|
|
57
|
+
* @param name security name
|
|
58
|
+
* @param scopes oauth2 scope
|
|
59
|
+
* @memberof Configuration
|
|
60
|
+
*/
|
|
61
|
+
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
|
|
62
|
+
/**
|
|
63
|
+
* parameter for clientId
|
|
64
|
+
*
|
|
65
|
+
* @type {string}
|
|
66
|
+
* @memberof Configuration
|
|
67
|
+
*/
|
|
68
|
+
tokenUrl?: string;
|
|
69
|
+
/**
|
|
70
|
+
* parameter for basic security
|
|
71
|
+
*
|
|
72
|
+
* @type {string}
|
|
73
|
+
* @memberof Configuration
|
|
74
|
+
*/
|
|
75
|
+
username?: string;
|
|
76
|
+
/**
|
|
77
|
+
* parameter for basic security
|
|
78
|
+
*
|
|
79
|
+
* @type {string}
|
|
80
|
+
* @memberof Configuration
|
|
81
|
+
*/
|
|
82
|
+
password?: string;
|
|
83
|
+
/**
|
|
84
|
+
* override base path
|
|
85
|
+
*
|
|
86
|
+
* @type {string}
|
|
87
|
+
* @memberof Configuration
|
|
88
|
+
*/
|
|
89
|
+
basePathBeta?: string;
|
|
90
|
+
/**
|
|
91
|
+
* override base path
|
|
92
|
+
*
|
|
93
|
+
* @type {string}
|
|
94
|
+
* @memberof Configuration
|
|
95
|
+
*/
|
|
96
|
+
basePathV3?: string;
|
|
97
|
+
/**
|
|
98
|
+
* override base path
|
|
99
|
+
*
|
|
100
|
+
* @type {string}
|
|
101
|
+
* @memberof Configuration
|
|
102
|
+
*/
|
|
103
|
+
basePathV2?: string;
|
|
104
|
+
/**
|
|
105
|
+
* override base path
|
|
106
|
+
*
|
|
107
|
+
* @type {string}
|
|
108
|
+
* @memberof Configuration
|
|
109
|
+
*/
|
|
110
|
+
basePathCC?: string;
|
|
111
|
+
/**
|
|
112
|
+
* base options for axios calls
|
|
113
|
+
*
|
|
114
|
+
* @type {any}
|
|
115
|
+
* @memberof Configuration
|
|
116
|
+
*/
|
|
117
|
+
baseOptions?: any;
|
|
118
|
+
/**
|
|
119
|
+
* The FormData constructor that will be used to create multipart form data
|
|
120
|
+
* requests. You can inject this here so that execution environments that
|
|
121
|
+
* do not support the FormData class can still run the generated client.
|
|
122
|
+
*
|
|
123
|
+
* @type {new () => FormData}
|
|
124
|
+
*/
|
|
125
|
+
formDataCtor?: new () => any;
|
|
126
|
+
/**
|
|
127
|
+
* axios retry configuration
|
|
128
|
+
*
|
|
129
|
+
* @type {IAxiosRetryConfig}
|
|
130
|
+
* @memberof Configuration
|
|
131
|
+
*/
|
|
132
|
+
retriesConfig?: IAxiosRetryConfig;
|
|
133
|
+
constructor(param?: ConfigurationParameters);
|
|
134
|
+
private getParams;
|
|
135
|
+
private getAccessToken;
|
|
136
|
+
/**
|
|
137
|
+
* Check if the given MIME is a JSON MIME.
|
|
138
|
+
* JSON MIME examples:
|
|
139
|
+
* application/json
|
|
140
|
+
* application/json; charset=UTF8
|
|
141
|
+
* APPLICATION/JSON
|
|
142
|
+
* application/vnd.company+json
|
|
143
|
+
* @param mime - MIME (Multipurpose Internet Mail Extensions)
|
|
144
|
+
* @return True if the given MIME is JSON, false otherwise.
|
|
145
|
+
*/
|
|
146
|
+
isJsonMime(mime: string): boolean;
|
|
147
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.Configuration = void 0;
|
|
40
|
+
var axios_1 = require("axios");
|
|
41
|
+
var os = require("os");
|
|
42
|
+
var path = require("path");
|
|
43
|
+
var yaml = require("js-yaml");
|
|
44
|
+
var fs = require("fs");
|
|
45
|
+
var Configuration = /** @class */ (function () {
|
|
46
|
+
function Configuration(param) {
|
|
47
|
+
if (!param) {
|
|
48
|
+
param = this.getParams();
|
|
49
|
+
}
|
|
50
|
+
this.basePathBeta = param.baseurl + "/beta";
|
|
51
|
+
this.basePathV3 = param.baseurl + "/v3";
|
|
52
|
+
this.basePathV2 = param.baseurl + "/v2";
|
|
53
|
+
this.basePathCC = param.baseurl;
|
|
54
|
+
this.tokenUrl = param.tokenUrl;
|
|
55
|
+
this.clientId = param.clientId;
|
|
56
|
+
this.clientSecret = param.clientSecret;
|
|
57
|
+
var url = "".concat(this.tokenUrl, "?grant_type=client_credentials&client_id=").concat(this.clientId, "&client_secret=").concat(this.clientSecret);
|
|
58
|
+
if (!this.accessToken) {
|
|
59
|
+
this.accessToken = this.getAccessToken(url);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
Configuration.prototype.getParams = function () {
|
|
63
|
+
var config = {};
|
|
64
|
+
try {
|
|
65
|
+
var homeDir = os.homedir();
|
|
66
|
+
var configPath = path.join(homeDir, '.sailpoint', 'config.yaml');
|
|
67
|
+
var doc = yaml.load(fs.readFileSync(configPath, 'utf8'));
|
|
68
|
+
if (doc.authtype && doc.authtype.toLowerCase() === 'pat') {
|
|
69
|
+
config.baseurl = doc.environments[doc.activeenvironment].baseurl;
|
|
70
|
+
config.clientId = doc.environments[doc.activeenvironment].pat.clientid;
|
|
71
|
+
config.clientSecret = doc.environments[doc.activeenvironment].pat.clientsecret;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
console.log('unable to find config file');
|
|
76
|
+
}
|
|
77
|
+
config.baseurl = process.env["SAIL_BASE_URL"] ? process.env["BASE_URL"] : config.baseurl;
|
|
78
|
+
config.clientId = process.env["SAIL_CLIENT_ID"] ? process.env["CLIENT_ID"] : config.clientId;
|
|
79
|
+
config.clientSecret = process.env["SAIL_CLIENT_SECRET"] ? process.env["CLIENT_SECRET"] : config.clientSecret;
|
|
80
|
+
config.tokenUrl = config.baseurl + '/oauth/token';
|
|
81
|
+
return config;
|
|
82
|
+
};
|
|
83
|
+
Configuration.prototype.getAccessToken = function (url) {
|
|
84
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
85
|
+
var _a, data, status_1, error_1;
|
|
86
|
+
return __generator(this, function (_b) {
|
|
87
|
+
switch (_b.label) {
|
|
88
|
+
case 0:
|
|
89
|
+
_b.trys.push([0, 2, , 3]);
|
|
90
|
+
return [4 /*yield*/, axios_1.default.post(url)];
|
|
91
|
+
case 1:
|
|
92
|
+
_a = _b.sent(), data = _a.data, status_1 = _a.status;
|
|
93
|
+
if (status_1 === 200) {
|
|
94
|
+
return [2 /*return*/, data.access_token];
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
throw new Error("Unauthorized");
|
|
98
|
+
}
|
|
99
|
+
return [3 /*break*/, 3];
|
|
100
|
+
case 2:
|
|
101
|
+
error_1 = _b.sent();
|
|
102
|
+
console.error("Unable to fetch access token. Aborting.");
|
|
103
|
+
throw new Error(error_1);
|
|
104
|
+
case 3: return [2 /*return*/];
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* Check if the given MIME is a JSON MIME.
|
|
111
|
+
* JSON MIME examples:
|
|
112
|
+
* application/json
|
|
113
|
+
* application/json; charset=UTF8
|
|
114
|
+
* APPLICATION/JSON
|
|
115
|
+
* application/vnd.company+json
|
|
116
|
+
* @param mime - MIME (Multipurpose Internet Mail Extensions)
|
|
117
|
+
* @return True if the given MIME is JSON, false otherwise.
|
|
118
|
+
*/
|
|
119
|
+
Configuration.prototype.isJsonMime = function (mime) {
|
|
120
|
+
var jsonMime = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
|
|
121
|
+
return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
|
|
122
|
+
};
|
|
123
|
+
return Configuration;
|
|
124
|
+
}());
|
|
125
|
+
exports.Configuration = Configuration;
|
|
126
|
+
//# sourceMappingURL=configuration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configuration.js","sourceRoot":"","sources":["../configuration.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAA0B;AAC1B,uBAAyB;AACzB,2BAA6B;AAC7B,8BAAgC;AAChC,uBAAyB;AA+BzB;IA6GI,uBAAY,KAA+B;QAEvC,IAAI,CAAC,KAAK,EAAE;YACR,KAAK,GAAG,I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AC,KAAK,CAAC,0CAA0C,CAAC,CAAC;wBAC1D,MAAM,IAAI,KAAK,CAAC,OAAK,CAAC,CAAC;;;;;KAE9B;IAGD;;;;;;;;;OASG;IACK,kCAAU,GAAjB,UAAkB,IAAY;QAC3B,IAAM,QAAQ,GAAW,IAAI,MAAM,CAAC,+DAA+D,EAAE,GAAG,CAAC,CAAC;QAC1G,OAAO,IAAI,KAAK,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,WAAW,EAAE,KAAK,6BAA6B,CAAC,CAAC;IAC1G,CAAC;IACL,oBAAC;AAAD,CAAC,AArLD,IAqLC;AArLY,sCAAa"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IdentityNow V3 API
|
|
3
|
+
* Use these APIs to interact with the IdentityNow platform to achieve repeatable, automated processes with greater scalability. We encourage you to join the SailPoint Developer Community forum at https://developer.sailpoint.com/discuss to connect with other developers using our APIs.
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 3.0.0
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
export * from "./beta/api";
|
|
13
|
+
export { Configuration as ConfigurationBeta, ConfigurationParameters as ConfigurationParametersBeta } from "./beta/configuration";
|
|
14
|
+
export * from "./v3/api";
|
|
15
|
+
export { Configuration as ConfigurationV3, ConfigurationParameters as ConfigurationParametersV3 } from "./v3/configuration";
|
|
16
|
+
export * from "./v2/api";
|
|
17
|
+
export { Configuration as ConfigurationV2, ConfigurationParameters as ConfigurationParametersV2 } from "./v2/configuration";
|
|
18
|
+
export * from "./cc/api";
|
|
19
|
+
export { Configuration as ConfigurationCC, ConfigurationParameters as ConfigurationParametersCC } from "./cc/configuration";
|
|
20
|
+
export { Configuration, ConfigurationParameters } from "./configuration";
|
|
21
|
+
export * from "./paginator";
|
|
22
|
+
export * as axiosRetry from "axios-retry";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
/**
|
|
5
|
+
* IdentityNow V3 API
|
|
6
|
+
* Use these APIs to interact with the IdentityNow platform to achieve repeatable, automated processes with greater scalability. We encourage you to join the SailPoint Developer Community forum at https://developer.sailpoint.com/discuss to connect with other developers using our APIs.
|
|
7
|
+
*
|
|
8
|
+
* The version of the OpenAPI document: 3.0.0
|
|
9
|
+
*
|
|
10
|
+
*
|
|
11
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
12
|
+
* https://openapi-generator.tech
|
|
13
|
+
* Do not edit the class manually.
|
|
14
|
+
*/
|
|
15
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
18
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
19
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
20
|
+
}
|
|
21
|
+
Object.defineProperty(o, k2, desc);
|
|
22
|
+
}) : (function(o, m, k, k2) {
|
|
23
|
+
if (k2 === undefined) k2 = k;
|
|
24
|
+
o[k2] = m[k];
|
|
25
|
+
}));
|
|
26
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
27
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
28
|
+
};
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
exports.axiosRetry = exports.Configuration = exports.ConfigurationCC = exports.ConfigurationV2 = exports.ConfigurationV3 = exports.ConfigurationBeta = void 0;
|
|
31
|
+
__exportStar(require("./beta/api"), exports);
|
|
32
|
+
var configuration_1 = require("./beta/configuration");
|
|
33
|
+
Object.defineProperty(exports, "ConfigurationBeta", { enumerable: true, get: function () { return configuration_1.Configuration; } });
|
|
34
|
+
__exportStar(require("./v3/api"), exports);
|
|
35
|
+
var configuration_2 = require("./v3/configuration");
|
|
36
|
+
Object.defineProperty(exports, "ConfigurationV3", { enumerable: true, get: function () { return configuration_2.Configuration; } });
|
|
37
|
+
__exportStar(require("./v2/api"), exports);
|
|
38
|
+
var configuration_3 = require("./v2/configuration");
|
|
39
|
+
Object.defineProperty(exports, "ConfigurationV2", { enumerable: true, get: function () { return configuration_3.Configuration; } });
|
|
40
|
+
__exportStar(require("./cc/api"), exports);
|
|
41
|
+
var configuration_4 = require("./cc/configuration");
|
|
42
|
+
Object.defineProperty(exports, "ConfigurationCC", { enumerable: true, get: function () { return configuration_4.Configuration; } });
|
|
43
|
+
var configuration_5 = require("./configuration");
|
|
44
|
+
Object.defineProperty(exports, "Configuration", { enumerable: true, get: function () { return configuration_5.Configuration; } });
|
|
45
|
+
__exportStar(require("./paginator"), exports);
|
|
46
|
+
exports.axiosRetry = require("axios-retry");
|
|
47
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";AAAA,oBAAoB;AACpB,oBAAoB;AACpB;;;;;;;;;;GAUG;;;;;;;;;;;;;;;;;AAIH,6CAA2B;AAC3B,sDAAgI;AAAxH,kHAAA,aAAa,OAAqB;AAE1C,2CAAyB;AACzB,oDAA0H;AAAlH,gHAAA,aAAa,OAAmB;AAExC,2CAAyB;AACzB,oDAA0H;AAAlH,gHAAA,aAAa,OAAmB;AAExC,2CAAyB;AACzB,oDAA0H;AAAlH,gHAAA,aAAa,OAAmB;AAExC,iDAAuE;AAA/D,8GAAA,aAAa,OAAA;AAErB,8CAA4B;AAE5B,4CAAyC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Search, SearchApi, SearchDocument } from "./v3";
|
|
2
|
+
export interface PaginationParams {
|
|
3
|
+
/**
|
|
4
|
+
* Max number of results to return. See [V3 API Standard Collection Parameters](https://developer.sailpoint.com/idn/api/standard-collection-parameters) for more information.
|
|
5
|
+
* @type {number}
|
|
6
|
+
* @memberof AccountsApiListAccounts
|
|
7
|
+
*/
|
|
8
|
+
limit?: number;
|
|
9
|
+
/**
|
|
10
|
+
* Offset into the full result set. Usually specified with *limit* to paginate through the results. See [V3 API Standard Collection Parameters](https://developer.sailpoint.com/idn/api/standard-collection-parameters) for more information.
|
|
11
|
+
* @type {number}
|
|
12
|
+
* @memberof AccountsApiListAccounts
|
|
13
|
+
*/
|
|
14
|
+
offset?: number;
|
|
15
|
+
/**
|
|
16
|
+
* If *true* it will populate the *X-Total-Count* response header with the number of results that would be returned if *limit* and *offset* were ignored. Since requesting a total count can have a performance impact, it is recommended not to send **count=true** if that value will not be used. See [V3 API Standard Collection Parameters](https://developer.sailpoint.com/idn/api/standard-collection-parameters) for more information.
|
|
17
|
+
* @type {boolean}
|
|
18
|
+
* @memberof AccountsApiListAccounts
|
|
19
|
+
*/
|
|
20
|
+
count?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Filter results using the standard syntax described in [V3 API Standard Collection Parameters](https://developer.sailpoint.com/idn/api/standard-collection-parameters#filtering-results) Filtering is supported for the following fields and operators: **id**: *eq, in* **identityId**: *eq* **name**: *eq, in* **nativeIdentity**: *eq, in* **sourceId**: *eq, in* **uncorrelated**: *eq*
|
|
23
|
+
* @type {string}
|
|
24
|
+
* @memberof AccountsApiListAccounts
|
|
25
|
+
*/
|
|
26
|
+
filters?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface AxiosResponse<T = any, D = any> {
|
|
29
|
+
data: T;
|
|
30
|
+
status: number;
|
|
31
|
+
statusText: string;
|
|
32
|
+
request?: any;
|
|
33
|
+
headers: AxiosResponseHeaders;
|
|
34
|
+
}
|
|
35
|
+
export declare type AxiosResponseHeaders = Record<string, string> & {
|
|
36
|
+
"set-cookie"?: string[];
|
|
37
|
+
};
|
|
38
|
+
export declare class Paginator {
|
|
39
|
+
static paginate<T, TResult, A extends PaginationParams>(thisArg: T, callbackFn: (this: T, args: A) => Promise<AxiosResponse<TResult[], any>>, args?: A, increment?: number): Promise<AxiosResponse<TResult[], any>>;
|
|
40
|
+
static paginateSearchApi(searchAPI: SearchApi, search: Search, increment?: number, limit?: number): Promise<AxiosResponse<SearchDocument[], any>>;
|
|
41
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.Paginator = void 0;
|
|
40
|
+
var Paginator = /** @class */ (function () {
|
|
41
|
+
function Paginator() {
|
|
42
|
+
}
|
|
43
|
+
Paginator.paginate = function (thisArg, callbackFn, args, increment) {
|
|
44
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
45
|
+
var params, maxLimit, modified, results;
|
|
46
|
+
return __generator(this, function (_a) {
|
|
47
|
+
switch (_a.label) {
|
|
48
|
+
case 0:
|
|
49
|
+
params = args ? args : { limit: 0, offset: 0 };
|
|
50
|
+
maxLimit = params && params.limit ? params.limit : 0;
|
|
51
|
+
if (!params.offset) {
|
|
52
|
+
params.offset = 0;
|
|
53
|
+
}
|
|
54
|
+
if (!increment) {
|
|
55
|
+
increment = 250;
|
|
56
|
+
}
|
|
57
|
+
params.limit = increment;
|
|
58
|
+
modified = [];
|
|
59
|
+
_a.label = 1;
|
|
60
|
+
case 1:
|
|
61
|
+
if (!true) return [3 /*break*/, 3];
|
|
62
|
+
console.log("Paginating call, offset = ".concat(params.offset));
|
|
63
|
+
return [4 /*yield*/, callbackFn.call(thisArg, params)];
|
|
64
|
+
case 2:
|
|
65
|
+
results = _a.sent();
|
|
66
|
+
modified.push.apply(modified, results.data);
|
|
67
|
+
if (results.data.length < increment || (params.offset >= maxLimit && maxLimit > 0)) {
|
|
68
|
+
results.data = modified;
|
|
69
|
+
return [2 /*return*/, results];
|
|
70
|
+
}
|
|
71
|
+
params.offset += increment;
|
|
72
|
+
return [3 /*break*/, 1];
|
|
73
|
+
case 3: return [2 /*return*/];
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
Paginator.paginateSearchApi = function (searchAPI, search, increment, limit) {
|
|
79
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
80
|
+
var searchParams, offset, maxLimit, modified, results, result;
|
|
81
|
+
return __generator(this, function (_a) {
|
|
82
|
+
switch (_a.label) {
|
|
83
|
+
case 0:
|
|
84
|
+
increment = increment ? increment : 250;
|
|
85
|
+
searchParams = {
|
|
86
|
+
search: search,
|
|
87
|
+
limit: increment
|
|
88
|
+
};
|
|
89
|
+
offset = 0;
|
|
90
|
+
maxLimit = limit ? limit : 0;
|
|
91
|
+
modified = [];
|
|
92
|
+
if (!search.sort || search.sort.length != 1) {
|
|
93
|
+
throw ("search must include exactly one sort parameter to paginate properly");
|
|
94
|
+
}
|
|
95
|
+
_a.label = 1;
|
|
96
|
+
case 1:
|
|
97
|
+
if (!true) return [3 /*break*/, 3];
|
|
98
|
+
console.log("Paginating call, offset = ".concat(offset));
|
|
99
|
+
return [4 /*yield*/, searchAPI.searchPost(searchParams)];
|
|
100
|
+
case 2:
|
|
101
|
+
results = _a.sent();
|
|
102
|
+
modified.push.apply(modified, results.data);
|
|
103
|
+
if (results.data.length < increment || (offset >= maxLimit && maxLimit > 0)) {
|
|
104
|
+
results.data = modified;
|
|
105
|
+
return [2 /*return*/, results];
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
result = results.data[results.data.length - 1];
|
|
109
|
+
if (searchParams.search.sort) {
|
|
110
|
+
searchParams.search.searchAfter = [result[searchParams.search.sort[0].replace("-", "")]];
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
throw ("search unexpectedly did not return a result we can search after!");
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
offset += increment;
|
|
117
|
+
return [3 /*break*/, 1];
|
|
118
|
+
case 3: return [2 /*return*/];
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
};
|
|
123
|
+
return Paginator;
|
|
124
|
+
}());
|
|
125
|
+
exports.Paginator = Paginator;
|
|
126
|
+
//# sourceMappingURL=paginator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paginator.js","sourceRoot":"","sources":["../paginator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA;IAAA;IA0DA,CAAC;IAxDuB,kBAAQ,GAA5B,UAAqE,OAAU,EAAE,UAAwE,EAAE,IAAQ,EAAE,SAAkB;;;;;;wBAC/K,MAAM,GAAqB,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAC,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAC,CAAA;wBAC5D,QAAQ,GAAG,MAAM,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;wBAC1D,IAAI,CAAC,MAAM,CAAC,MAAM,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