polarity-integration-utils 0.1.0 → 2.0.8
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/README.md +30 -2
- package/dist/dts/errors/api-request-error.d.ts +10 -0
- package/dist/dts/errors/api-request-error.d.ts.map +1 -0
- package/dist/dts/errors/auth-request-error.d.ts +10 -0
- package/dist/dts/errors/auth-request-error.d.ts.map +1 -0
- package/dist/dts/errors/index.d.ts +8 -0
- package/dist/dts/errors/index.d.ts.map +1 -0
- package/dist/dts/errors/integration-error.d.ts +189 -0
- package/dist/dts/errors/integration-error.d.ts.map +1 -0
- package/dist/dts/errors/library-usage-error.d.ts +12 -0
- package/dist/dts/errors/library-usage-error.d.ts.map +1 -0
- package/dist/dts/errors/network-error.d.ts +11 -0
- package/dist/dts/errors/network-error.d.ts.map +1 -0
- package/dist/dts/errors/parse-error-to-readable-json.d.ts +7 -0
- package/dist/dts/errors/parse-error-to-readable-json.d.ts.map +1 -0
- package/dist/dts/errors/retry-request-error.d.ts +11 -0
- package/dist/dts/errors/retry-request-error.d.ts.map +1 -0
- package/dist/dts/index.d.ts +5 -0
- package/dist/dts/index.d.ts.map +1 -0
- package/dist/dts/index.docs.d.ts +9 -0
- package/dist/dts/index.docs.d.ts.map +1 -0
- package/dist/dts/internal/helpers/parallel-limit.d.ts +9 -0
- package/dist/dts/internal/helpers/parallel-limit.d.ts.map +1 -0
- package/dist/dts/internal/helpers/sanitize-object.d.ts +11 -0
- package/dist/dts/internal/helpers/sanitize-object.d.ts.map +1 -0
- package/dist/dts/logging/index.d.ts +2 -0
- package/dist/dts/logging/index.d.ts.map +1 -0
- package/dist/dts/logging/logger.d.ts +49 -0
- package/dist/dts/logging/logger.d.ts.map +1 -0
- package/dist/dts/requests/index.d.ts +3 -0
- package/dist/dts/requests/index.d.ts.map +1 -0
- package/dist/dts/requests/polarity-request.d.ts +411 -0
- package/dist/dts/requests/polarity-request.d.ts.map +1 -0
- package/dist/dts/requests/sanitize-request-options.d.ts +20 -0
- package/dist/dts/requests/sanitize-request-options.d.ts.map +1 -0
- package/dist/dts/types.d.ts +104 -0
- package/dist/dts/types.d.ts.map +1 -0
- package/dist/es/errors/api-request-error.js +15 -0
- package/dist/es/errors/auth-request-error.js +15 -0
- package/dist/es/errors/index.js +20 -8
- package/dist/es/errors/integration-error.js +116 -0
- package/dist/es/errors/library-usage-error.js +17 -0
- package/dist/es/errors/network-error.js +88 -0
- package/dist/es/errors/parse-error-to-readable-json.js +9 -0
- package/dist/es/errors/retry-request-error.js +16 -0
- package/dist/es/index.docs.js +24 -0
- package/dist/es/index.js +40 -14
- package/dist/es/internal/helpers/parallel-limit.js +36 -0
- package/dist/es/internal/helpers/sanitize-object.js +37 -0
- package/dist/es/logging/index.js +15 -2
- package/dist/es/logging/logger.js +41 -5
- package/dist/es/requests/index.js +15 -8
- package/dist/es/requests/polarity-request.js +426 -0
- package/dist/es/requests/sanitize-request-options.js +50 -0
- package/dist/lib/errors/api-request-error.js +15 -0
- package/dist/lib/errors/auth-request-error.js +15 -0
- package/dist/lib/errors/index.js +20 -8
- package/dist/lib/errors/integration-error.js +116 -0
- package/dist/lib/errors/library-usage-error.js +17 -0
- package/dist/lib/errors/network-error.js +88 -0
- package/dist/lib/errors/parse-error-to-readable-json.js +9 -0
- package/dist/lib/errors/retry-request-error.js +16 -0
- package/dist/lib/index.docs.js +24 -0
- package/dist/lib/index.js +40 -14
- package/dist/lib/internal/helpers/parallel-limit.js +36 -0
- package/dist/lib/internal/helpers/sanitize-object.js +37 -0
- package/dist/lib/logging/index.js +15 -2
- package/dist/lib/logging/logger.js +41 -5
- package/dist/lib/requests/index.js +15 -8
- package/dist/lib/requests/polarity-request.js +426 -0
- package/dist/lib/requests/sanitize-request-options.js +50 -0
- package/dist/polarity-integration-utils.d.ts +852 -0
- package/dist/tsdoc-metadata.json +11 -0
- package/package.json +59 -10
- package/dist/es/errors/RequestError.js +0 -12
- package/dist/es/errors/parseErrorToReadableJson.js +0 -4
- package/dist/es/helpers/async/index.js +0 -9
- package/dist/es/helpers/async/parallelLimit.js +0 -33
- package/dist/es/helpers/encodings/decodeBase64.js +0 -4
- package/dist/es/helpers/encodings/encodeBase64.js +0 -4
- package/dist/es/helpers/encodings/index.js +0 -11
- package/dist/es/helpers/index.js +0 -10
- package/dist/es/helpers/json/and.js +0 -4
- package/dist/es/helpers/json/filterObjectsContainingString.js +0 -10
- package/dist/es/helpers/json/index.js +0 -17
- package/dist/es/helpers/json/mapOverObject.js +0 -24
- package/dist/es/helpers/json/or.js +0 -4
- package/dist/es/helpers/json/transpose2dArray.js +0 -8
- package/dist/es/helpers/time/index.js +0 -11
- package/dist/es/helpers/time/millisecondsToHoursMinutesAndSeconds.js +0 -18
- package/dist/es/helpers/time/sleep.js +0 -13
- package/dist/es/requests/createRequestWithDefaults.js +0 -166
- package/dist/es/requests/createRequestsInParallel.js +0 -40
- package/dist/es/user-options/index.js +0 -9
- package/dist/es/user-options/validateUrlOption.js +0 -77
- package/dist/lib/errors/RequestError.js +0 -12
- package/dist/lib/errors/parseErrorToReadableJson.js +0 -4
- package/dist/lib/helpers/async/index.js +0 -9
- package/dist/lib/helpers/async/parallelLimit.js +0 -33
- package/dist/lib/helpers/encodings/decodeBase64.js +0 -4
- package/dist/lib/helpers/encodings/encodeBase64.js +0 -4
- package/dist/lib/helpers/encodings/index.js +0 -11
- package/dist/lib/helpers/index.js +0 -10
- package/dist/lib/helpers/json/and.js +0 -4
- package/dist/lib/helpers/json/filterObjectsContainingString.js +0 -10
- package/dist/lib/helpers/json/index.js +0 -17
- package/dist/lib/helpers/json/mapOverObject.js +0 -24
- package/dist/lib/helpers/json/or.js +0 -4
- package/dist/lib/helpers/json/transpose2dArray.js +0 -8
- package/dist/lib/helpers/time/index.js +0 -11
- package/dist/lib/helpers/time/millisecondsToHoursMinutesAndSeconds.js +0 -18
- package/dist/lib/helpers/time/sleep.js +0 -13
- package/dist/lib/requests/createRequestWithDefaults.js +0 -166
- package/dist/lib/requests/createRequestsInParallel.js +0 -40
- package/dist/lib/user-options/index.js +0 -9
- package/dist/lib/user-options/validateUrlOption.js +0 -77
- /package/dist/es/{requests/requestTypes.js → types.js} +0 -0
- /package/dist/lib/{requests/requestTypes.js → types.js} +0 -0
|
@@ -0,0 +1,852 @@
|
|
|
1
|
+
import Bottleneck from 'bottleneck';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* API error for REST requests
|
|
5
|
+
*
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export declare class ApiRequestError extends IntegrationError {
|
|
9
|
+
constructor(message: string, properties?: IntegrationErrorProperties);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Thrown by generateAccessToken method if there is a failure to fetch a token
|
|
14
|
+
*
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
export declare class AuthRequestError extends IntegrationError {
|
|
18
|
+
constructor(message: string, properties?: IntegrationErrorProperties);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @public
|
|
23
|
+
*/
|
|
24
|
+
export declare type ConfigRequestProxyOptions = {
|
|
25
|
+
ca?: undefined | string;
|
|
26
|
+
cert?: undefined | string;
|
|
27
|
+
key?: undefined | string;
|
|
28
|
+
passphrase?: undefined | string;
|
|
29
|
+
rejectUnauthorized?: undefined | boolean;
|
|
30
|
+
proxy?: undefined | string;
|
|
31
|
+
json?: undefined | boolean;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* User options object passed into the integration's `doLookup` method.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* Example of the user options object passed into `doLookup`
|
|
39
|
+
* ```js
|
|
40
|
+
* function doLookup(entities, options, cb){
|
|
41
|
+
* // options here is of type DoLookupUserOptions
|
|
42
|
+
* }
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* As an example, if your integration has a user option with a `key` value of
|
|
47
|
+
* `apiKey` within its `config.json`, the user options object passed into the `doLookup` method would look like:
|
|
48
|
+
* ```json
|
|
49
|
+
* {
|
|
50
|
+
* "apiKey": "XXXXXXXXXX"
|
|
51
|
+
* }
|
|
52
|
+
* ```
|
|
53
|
+
* @public
|
|
54
|
+
*/
|
|
55
|
+
export declare type DoLookupUserOptions = {
|
|
56
|
+
[key: string]: PossibleUserOptionValue;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* @public
|
|
61
|
+
*/
|
|
62
|
+
export declare type DropdownUserOptionValue = {
|
|
63
|
+
display: string;
|
|
64
|
+
value: string;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Represents a Polarity Entity object which is passed to an integration's
|
|
69
|
+
* doLookup method.
|
|
70
|
+
*
|
|
71
|
+
* @public
|
|
72
|
+
*/
|
|
73
|
+
export declare type Entity = {
|
|
74
|
+
value: string;
|
|
75
|
+
types: EntityType[];
|
|
76
|
+
type: EntityType;
|
|
77
|
+
requestContext: {
|
|
78
|
+
requestType: 'onDemand';
|
|
79
|
+
isUserInitiated: boolean;
|
|
80
|
+
};
|
|
81
|
+
longitude: number;
|
|
82
|
+
latitude: number;
|
|
83
|
+
isURL: boolean;
|
|
84
|
+
isSHA512: boolean;
|
|
85
|
+
isSHA256: boolean;
|
|
86
|
+
isSHA1: boolean;
|
|
87
|
+
isPrivateIP: boolean;
|
|
88
|
+
isMD5: boolean;
|
|
89
|
+
isIPv6: boolean;
|
|
90
|
+
isIPv4: boolean;
|
|
91
|
+
isIP: boolean;
|
|
92
|
+
isHex: boolean;
|
|
93
|
+
isHash: boolean;
|
|
94
|
+
isHTMLTag: boolean;
|
|
95
|
+
isEmail: boolean;
|
|
96
|
+
isDomain: boolean;
|
|
97
|
+
hashType: string;
|
|
98
|
+
displayValue: string;
|
|
99
|
+
channels: string[];
|
|
100
|
+
IPType: string;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Entity Types including custom types
|
|
105
|
+
* @public
|
|
106
|
+
*/
|
|
107
|
+
export declare type EntityType = StandardEntityType | '*' | 'custom' | `custom.${string}`;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* @public
|
|
111
|
+
*/
|
|
112
|
+
declare interface Error_2 {
|
|
113
|
+
name: string;
|
|
114
|
+
message: string;
|
|
115
|
+
stack?: string;
|
|
116
|
+
code?: number | string;
|
|
117
|
+
}
|
|
118
|
+
export { Error_2 as Error }
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* @public
|
|
122
|
+
*/
|
|
123
|
+
export declare type ErrorMeta = {
|
|
124
|
+
[otherMetadata: string]: unknown;
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* return the logger object set via the {@link setLogger} method.
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* Example of using the integration's logging object:
|
|
132
|
+
* ```js
|
|
133
|
+
* const { getLogger } = require('polarity-integration-utils/logger');
|
|
134
|
+
*
|
|
135
|
+
* const logger = getLogger();
|
|
136
|
+
* logger.trace('this is a trace message');
|
|
137
|
+
* ```
|
|
138
|
+
*
|
|
139
|
+
* @public
|
|
140
|
+
* @returns the integration's logger object
|
|
141
|
+
*/
|
|
142
|
+
export declare const getLogger: () => Logger;
|
|
143
|
+
|
|
144
|
+
export declare type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS';
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* @public
|
|
148
|
+
*/
|
|
149
|
+
export declare type HttpRequestOptions = {
|
|
150
|
+
/**
|
|
151
|
+
* The URL to make the request to.
|
|
152
|
+
*/
|
|
153
|
+
url?: string;
|
|
154
|
+
/**
|
|
155
|
+
* The HTTP method to use for the request.
|
|
156
|
+
*
|
|
157
|
+
* @defaultValue 'GET'
|
|
158
|
+
*/
|
|
159
|
+
method?: HttpMethod;
|
|
160
|
+
/**
|
|
161
|
+
* If true, sets body to JSON representation of value and adds Content-type: application/json header.
|
|
162
|
+
* Additionally, parses the response body as JSON.
|
|
163
|
+
*
|
|
164
|
+
* @defaultValue true
|
|
165
|
+
*/
|
|
166
|
+
json?: boolean;
|
|
167
|
+
/**
|
|
168
|
+
* An object containing the headers to include in the request.
|
|
169
|
+
* @example
|
|
170
|
+
* Here is an example of setting the "X-Api-Key" `headers` property:
|
|
171
|
+
* ```
|
|
172
|
+
* {
|
|
173
|
+
* headers: {
|
|
174
|
+
* 'X-Api-Key': '1234567890'
|
|
175
|
+
* }
|
|
176
|
+
* }
|
|
177
|
+
* ```
|
|
178
|
+
*/
|
|
179
|
+
headers?: object;
|
|
180
|
+
/**
|
|
181
|
+
* An object containing querystring parameters to include in the request.
|
|
182
|
+
* @example
|
|
183
|
+
* Here is an example of setting the `qs` property:
|
|
184
|
+
* ```
|
|
185
|
+
* {
|
|
186
|
+
* qs: {
|
|
187
|
+
* search: 'foo'
|
|
188
|
+
* }
|
|
189
|
+
* }
|
|
190
|
+
* ```
|
|
191
|
+
*/
|
|
192
|
+
qs?: object;
|
|
193
|
+
/**
|
|
194
|
+
* When passed an object or a querystring, this sets body to a querystring representation of value,
|
|
195
|
+
* and adds Content-type: application/x-www-form-urlencoded header.
|
|
196
|
+
*/
|
|
197
|
+
form?: object;
|
|
198
|
+
/**
|
|
199
|
+
* The body of the request.
|
|
200
|
+
*/
|
|
201
|
+
body?: object;
|
|
202
|
+
/**
|
|
203
|
+
* The authentication options to use for the request
|
|
204
|
+
*/
|
|
205
|
+
auth?: {
|
|
206
|
+
username: string;
|
|
207
|
+
password: string;
|
|
208
|
+
sendImmediately?: boolean;
|
|
209
|
+
} | {
|
|
210
|
+
bearer: string;
|
|
211
|
+
sendImmediately?: boolean;
|
|
212
|
+
};
|
|
213
|
+
[key: string]: unknown;
|
|
214
|
+
} & ({
|
|
215
|
+
entity: Entity;
|
|
216
|
+
entities?: never;
|
|
217
|
+
requestId?: never;
|
|
218
|
+
} | {
|
|
219
|
+
entities: Entity[];
|
|
220
|
+
entity?: never;
|
|
221
|
+
requestId?: never;
|
|
222
|
+
} | {
|
|
223
|
+
requestId: string | unknown;
|
|
224
|
+
entity?: never;
|
|
225
|
+
entities?: never;
|
|
226
|
+
} | {
|
|
227
|
+
entity?: never;
|
|
228
|
+
entities?: never;
|
|
229
|
+
requestId?: never;
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* @public
|
|
234
|
+
*/
|
|
235
|
+
export declare type HttpRequestResponse = {
|
|
236
|
+
/**
|
|
237
|
+
* The HTTP status code of the response.
|
|
238
|
+
*/
|
|
239
|
+
statusCode: number;
|
|
240
|
+
request: {
|
|
241
|
+
uri: unknown;
|
|
242
|
+
method: string;
|
|
243
|
+
headers: unknown;
|
|
244
|
+
[key: string]: unknown;
|
|
245
|
+
};
|
|
246
|
+
/**
|
|
247
|
+
* The body of the response.
|
|
248
|
+
*/
|
|
249
|
+
body: unknown;
|
|
250
|
+
/**
|
|
251
|
+
* The response headers
|
|
252
|
+
*/
|
|
253
|
+
headers: unknown;
|
|
254
|
+
/**
|
|
255
|
+
* The error object if an error occurred during the request.
|
|
256
|
+
*/
|
|
257
|
+
error?: ApiRequestError | NetworkError | RetryRequestError;
|
|
258
|
+
/**
|
|
259
|
+
* The entity that the request was made for. The `entity` property matches the
|
|
260
|
+
* `entity` property set on the {@link HttpRequestOptions} object associated with this HttpRequestResponse.
|
|
261
|
+
*/
|
|
262
|
+
entity?: Entity;
|
|
263
|
+
/**
|
|
264
|
+
* An array of entities that the request was made for. The `entities` property
|
|
265
|
+
* matches the `entities` property set on the {@link HttpRequestOptions} object associated
|
|
266
|
+
* with this HttpRequestResponse.
|
|
267
|
+
*/
|
|
268
|
+
entities?: Entity[];
|
|
269
|
+
/**
|
|
270
|
+
* A custom request id that can be used to identify the request. The `requestId` matches
|
|
271
|
+
* the `requestId` property set on the {@link HttpRequestOptions} object.
|
|
272
|
+
*/
|
|
273
|
+
requestId?: string | unknown;
|
|
274
|
+
[key: string]: unknown;
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* @public
|
|
279
|
+
*/
|
|
280
|
+
export declare class IntegrationError extends Error {
|
|
281
|
+
/**
|
|
282
|
+
* a short, human-readable summary of the problem that SHOULD NOT change from occurrence to occurrence of
|
|
283
|
+
* the problem except for purposes of localization.
|
|
284
|
+
*/
|
|
285
|
+
readonly title: string;
|
|
286
|
+
/**
|
|
287
|
+
* a human-readable explanation specific to this occurrence of the problem. Like title, this field’s value can be
|
|
288
|
+
* localized
|
|
289
|
+
*/
|
|
290
|
+
readonly detail: string;
|
|
291
|
+
/**
|
|
292
|
+
* a meta object containing non-standard meta-information about the error.
|
|
293
|
+
*/
|
|
294
|
+
readonly meta: ErrorMeta;
|
|
295
|
+
/**
|
|
296
|
+
* The HTTP status code applicable to this error, expressed as a string value.
|
|
297
|
+
*/
|
|
298
|
+
readonly status: string;
|
|
299
|
+
/**
|
|
300
|
+
* an application-specific error code, expressed as a string value.
|
|
301
|
+
*/
|
|
302
|
+
readonly code: string;
|
|
303
|
+
/**
|
|
304
|
+
* The `cause` property is used to specify the `cause` of the error. Typically,
|
|
305
|
+
* this property is used to pass through a related Error instance.
|
|
306
|
+
*/
|
|
307
|
+
readonly cause: Error_2;
|
|
308
|
+
/**
|
|
309
|
+
* Additional details related to the error that may help the user troubleshoot the issue. If set by the user
|
|
310
|
+
* via the Error constructor, the user provided value will override any automated help message set by the
|
|
311
|
+
* Error class.
|
|
312
|
+
*/
|
|
313
|
+
readonly help: string;
|
|
314
|
+
/**
|
|
315
|
+
* Relevant for integration errors involving a network call, the `requestOptions` property
|
|
316
|
+
* details the request options that resulted in the specified error. The `requestOptions` property will automatically
|
|
317
|
+
* have sensitive authentication headers stripped.
|
|
318
|
+
*/
|
|
319
|
+
readonly requestOptions?: HttpRequestOptions;
|
|
320
|
+
/**
|
|
321
|
+
* Construct a new IntegrationError object.
|
|
322
|
+
* @param message - A string description of the error which is used as the `detail` property on the
|
|
323
|
+
* serialized error.
|
|
324
|
+
* @param properties - Optional properties for the error.
|
|
325
|
+
*/
|
|
326
|
+
constructor(message: string, properties?: IntegrationErrorProperties);
|
|
327
|
+
/**
|
|
328
|
+
* Serializes the error's properties into a POJO. The order of the
|
|
329
|
+
* properties is preserved when serialized.
|
|
330
|
+
* @returns JSON representation of the error
|
|
331
|
+
*/
|
|
332
|
+
toJSON(): SerializedIntegrationError;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* @public
|
|
337
|
+
*/
|
|
338
|
+
export declare interface IntegrationErrorProperties {
|
|
339
|
+
/**
|
|
340
|
+
* a short, human-readable summary of the problem that SHOULD NOT change from occurrence to occurrence of
|
|
341
|
+
* the problem except for purposes of localization. If omitted, the title will default to the type
|
|
342
|
+
* of error (e.g., IntegrationError, or ApiRequestError)
|
|
343
|
+
*/
|
|
344
|
+
title?: string;
|
|
345
|
+
/**
|
|
346
|
+
* Additional details related to the error that may help the user troubleshoot the issue. If set by the user
|
|
347
|
+
* via the Error constructor, the user provided value will override any automated help message set by the
|
|
348
|
+
* Error class.
|
|
349
|
+
*/
|
|
350
|
+
help?: string;
|
|
351
|
+
/**
|
|
352
|
+
* The `cause` property is used to specify the `cause` of the error. Typically,
|
|
353
|
+
* this property is used to pass through a related Error instance.
|
|
354
|
+
*/
|
|
355
|
+
cause?: Error_2;
|
|
356
|
+
/**
|
|
357
|
+
* The HTTP status code applicable to this error, expressed as a string value.
|
|
358
|
+
*/
|
|
359
|
+
status?: string;
|
|
360
|
+
/**
|
|
361
|
+
* an application-specific error code, expressed as a string value.
|
|
362
|
+
*/
|
|
363
|
+
code?: string;
|
|
364
|
+
/**
|
|
365
|
+
* Relevant for integration errors involving a network call, the `requestOptions` property
|
|
366
|
+
* details the request options that resulted in the specified error. The `requestOptions` property will automatically
|
|
367
|
+
* have sensitive authentication headers stripped.
|
|
368
|
+
* By default, the following paths are sanitized:
|
|
369
|
+
*
|
|
370
|
+
* - auth.password
|
|
371
|
+
* - auth.bearer
|
|
372
|
+
* - body.password
|
|
373
|
+
* - form.client_secret
|
|
374
|
+
* - headers.authorization
|
|
375
|
+
* - headers.x-api-key
|
|
376
|
+
*
|
|
377
|
+
* Additional paths can be sanitized by using the `requestOptionsToSanitize` property.
|
|
378
|
+
*/
|
|
379
|
+
requestOptions?: HttpRequestOptions;
|
|
380
|
+
/**
|
|
381
|
+
* List of paths in JSON dot notation to sanitize in the requestOptions object
|
|
382
|
+
*/
|
|
383
|
+
requestOptionsToSanitize?: string[];
|
|
384
|
+
/**
|
|
385
|
+
* Any additional properties which will be appended to the Error's meta property
|
|
386
|
+
*/
|
|
387
|
+
meta?: MetaObject;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* @public
|
|
392
|
+
*/
|
|
393
|
+
export declare type IsApiErrorFunction = (response: HttpRequestResponse, requestOptions: HttpRequestOptions, userOptions: DoLookupUserOptions) => IsApiErrorResult;
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* @public
|
|
397
|
+
*/
|
|
398
|
+
export declare type IsApiErrorResult = {
|
|
399
|
+
/**
|
|
400
|
+
* Indicates whether the response is an API error.
|
|
401
|
+
*/
|
|
402
|
+
isApiError: boolean;
|
|
403
|
+
/**
|
|
404
|
+
* Optional message providing additional information about the API error. The
|
|
405
|
+
* returned `message` will be used as the `message` property on the {@link ApiRequestError} object
|
|
406
|
+
* thrown by the request.
|
|
407
|
+
*/
|
|
408
|
+
message?: string;
|
|
409
|
+
};
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* Thrown when the polarity-integration-utils library is used incorrectly. For example,
|
|
413
|
+
* if a method is called with incorrect or missing parameters, or a required initialization
|
|
414
|
+
* method is not called. This Error class should not be used directly by integrations.
|
|
415
|
+
*
|
|
416
|
+
* @public
|
|
417
|
+
*/
|
|
418
|
+
export declare class LibraryUsageError extends IntegrationError {
|
|
419
|
+
constructor(message: string, properties?: IntegrationErrorProperties);
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* @public
|
|
424
|
+
*/
|
|
425
|
+
export declare type Logger = {
|
|
426
|
+
child?(arg: unknown): Logger;
|
|
427
|
+
info(...args: unknown[]): void;
|
|
428
|
+
debug(...args: unknown[]): void;
|
|
429
|
+
trace(...args: unknown[]): void;
|
|
430
|
+
warn(...args: unknown[]): void;
|
|
431
|
+
error(...args: unknown[]): void;
|
|
432
|
+
fatal(...args: unknown[]): void;
|
|
433
|
+
};
|
|
434
|
+
|
|
435
|
+
/**
|
|
436
|
+
* @public
|
|
437
|
+
*/
|
|
438
|
+
export declare type MetaObject = {
|
|
439
|
+
[key: string]: unknown;
|
|
440
|
+
};
|
|
441
|
+
|
|
442
|
+
/**
|
|
443
|
+
* Generic network error for REST requests.
|
|
444
|
+
* https://betterstack.com/community/guides/scaling-nodejs/nodejs-errors/#4-econnrefused
|
|
445
|
+
*
|
|
446
|
+
* @public
|
|
447
|
+
*/
|
|
448
|
+
export declare class NetworkError extends IntegrationError {
|
|
449
|
+
constructor(message: string, properties?: IntegrationErrorProperties);
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* @public
|
|
454
|
+
* @param error - Error instance to parse into a plain old javascript object
|
|
455
|
+
*/
|
|
456
|
+
export declare const parseErrorToReadableJson: (error: Error_2) => any;
|
|
457
|
+
|
|
458
|
+
/**
|
|
459
|
+
* A utility class for making HTTP requests
|
|
460
|
+
* @public
|
|
461
|
+
*/
|
|
462
|
+
export declare class PolarityRequest {
|
|
463
|
+
private bottleneckLimiter;
|
|
464
|
+
/**
|
|
465
|
+
* Instance of a Bunyan logger
|
|
466
|
+
*/
|
|
467
|
+
private logger;
|
|
468
|
+
private internalThrottlingOptions;
|
|
469
|
+
/**
|
|
470
|
+
* postman-request library request object with default values set. Used internally for
|
|
471
|
+
* making HTTP requests directly via the postman-request library
|
|
472
|
+
*/
|
|
473
|
+
private readonly requestWithDefaults;
|
|
474
|
+
readonly roundedSuccessStatusCodes: number[];
|
|
475
|
+
/**
|
|
476
|
+
* One or more HTTP response properties specified using JSON dot notation. If the
|
|
477
|
+
* specified path exists within the `body` property of the HTTP Response, an
|
|
478
|
+
* ApiRequestError will be thrown.
|
|
479
|
+
*
|
|
480
|
+
* By default, this value is an empty array and response properties are not used to
|
|
481
|
+
* detect errors.
|
|
482
|
+
* @defaultValue []
|
|
483
|
+
*/
|
|
484
|
+
readonly httpResponseErrorProperties: string[];
|
|
485
|
+
/**
|
|
486
|
+
* One or more HTTP response properties specified using JSON dot notation that
|
|
487
|
+
* point to an error message that should be displayed to the user in the event
|
|
488
|
+
* of an API error.
|
|
489
|
+
*
|
|
490
|
+
* The property should be a string value. If the property does not exist or is not
|
|
491
|
+
* a string value, a default error message will be used instead.
|
|
492
|
+
*/
|
|
493
|
+
readonly httpResponseErrorMessageProperties: string[];
|
|
494
|
+
/**
|
|
495
|
+
* Optional method that can be implemented to determine if an API error
|
|
496
|
+
* was encountered after an HTTP request is made.
|
|
497
|
+
*
|
|
498
|
+
* If the `isApiError` method is implemented
|
|
499
|
+
* the property `roundedSuccessStatusCodes` and `httpResponseErrorProperties` are not
|
|
500
|
+
* used to determine API errors.
|
|
501
|
+
*
|
|
502
|
+
* @returns An object indicating whether an API error was encountered and an optional message.
|
|
503
|
+
*/
|
|
504
|
+
readonly isApiError: IsApiErrorFunction;
|
|
505
|
+
/**
|
|
506
|
+
* An array of JSON dot notation paths to omit from the request options when logging.
|
|
507
|
+
*
|
|
508
|
+
* This property can be used to sanitize sensitive request properties that should not
|
|
509
|
+
* appear in logging.
|
|
510
|
+
*
|
|
511
|
+
* Note that the `requestOptions` object is automatically sanitized to remove properties that
|
|
512
|
+
* typically contain sensitive API key and passwords. For a list of properties that are
|
|
513
|
+
* automatically sanitized, see the {@link sanitizeRequestOptions} method.
|
|
514
|
+
*/
|
|
515
|
+
readonly requestOptionsToSanitize: string[];
|
|
516
|
+
userOptions: DoLookupUserOptions;
|
|
517
|
+
/**
|
|
518
|
+
* Optional middleware method for modifying {@link HttpRequestOptions} before a request is made
|
|
519
|
+
* via the {@link PolarityRequest.run} method or {@link PolarityRequest.runInParallel} method.
|
|
520
|
+
* The returned `requestOptions` object will be used for the request. This method is passed
|
|
521
|
+
* a copy of the original `requestOptions` object so it can be modified without side effects.
|
|
522
|
+
*
|
|
523
|
+
* This method is typically used for adding authentication (e.g., auth headers, or basic auth) to every request.
|
|
524
|
+
* It can also be used to add headers that are required on every request or conditionally add headers based
|
|
525
|
+
* on the passed in `userOptions`.
|
|
526
|
+
*
|
|
527
|
+
* This method can be set as part of the {@link PolarityRequestOptions} when creating a new instance of the
|
|
528
|
+
* {@link PolarityRequest} class or can be set after the fact.
|
|
529
|
+
*
|
|
530
|
+
* @param requestOptions - A copy of the request options used for the request. This object can be modified
|
|
531
|
+
* without side effects.
|
|
532
|
+
* @param userOptions - The user options passed into the `doLookup` method.
|
|
533
|
+
* @returns The modified request options to use for the request.
|
|
534
|
+
*/
|
|
535
|
+
preprocessRequestOptions: PreprocessRequestOptions;
|
|
536
|
+
/**
|
|
537
|
+
* Optional middleware method for modifying the {@link HttpRequestResponse} after a successful request.
|
|
538
|
+
* The passed in {@link HttpRequestResponse} object is not a copy but can be safely modified without
|
|
539
|
+
* side effects. The returned `HttpRequestResponse` object will be used for the response.
|
|
540
|
+
*
|
|
541
|
+
* @param response - The HTTP response from the request.
|
|
542
|
+
* @param requestOptions - The request options used for the request.
|
|
543
|
+
* @param userOptions - The user options passed into the `doLookup` method.
|
|
544
|
+
*/
|
|
545
|
+
postprocessRequestSuccess: PostprocessRequestSuccess;
|
|
546
|
+
/**
|
|
547
|
+
* Method that can be implemented to post-process the HTTP response after a failed request.
|
|
548
|
+
* This method is typically used to inspect the error thrown and either alter the error
|
|
549
|
+
* object (e.g., to change the error message property to something more specific), to ignore
|
|
550
|
+
* the error (by not rethrowing it), or to take a specific action based on the error (e.g.,
|
|
551
|
+
* in the case of a RetryRequestError you may want to retry the request or return a special
|
|
552
|
+
* payload to the integration front end).
|
|
553
|
+
*
|
|
554
|
+
* @param error - The error thrown during the request.
|
|
555
|
+
* @param requestOptions - The request options used for the request.
|
|
556
|
+
* @param userOptions - The user options passed into the `doLookup` method.
|
|
557
|
+
*/
|
|
558
|
+
postprocessRequestFailure: PostprocessRequestFailure;
|
|
559
|
+
get throttlingOptions(): Bottleneck.ConstructorOptions;
|
|
560
|
+
set throttlingOptions(throttlingOptions: Bottleneck.ConstructorOptions);
|
|
561
|
+
constructor(options?: PolarityRequestOptions);
|
|
562
|
+
private configFieldIsValid;
|
|
563
|
+
/**
|
|
564
|
+
* Makes a single HTTP request and returns the response or throws an error
|
|
565
|
+
*
|
|
566
|
+
* @param requestOptions - request options used to make the HTTP request
|
|
567
|
+
* @returns The HTTP response
|
|
568
|
+
*/
|
|
569
|
+
run(requestOptions: HttpRequestOptions): Promise<HttpRequestResponse> | never;
|
|
570
|
+
/**
|
|
571
|
+
* Checks whether the HTTP response is an API error and throws an ApiRequestError if it is.
|
|
572
|
+
*
|
|
573
|
+
* @param httpResponse - The HTTP response from the Postman request.
|
|
574
|
+
* @param requestOptions - The options used for the request.
|
|
575
|
+
*
|
|
576
|
+
* @throws {@link ApiRequestError}
|
|
577
|
+
* Throws an error if the response indicates an API error.
|
|
578
|
+
*/
|
|
579
|
+
private maybeThrowApiRequestError;
|
|
580
|
+
/**
|
|
581
|
+
* Returns true if the `httpStatusCode` is not one of the rounded HTTP status codes
|
|
582
|
+
* specified in the PolarityRequest `roundedSuccessStatusCodes` property.
|
|
583
|
+
*
|
|
584
|
+
* @param httpStatusCode - A numeric HTTP Status Code
|
|
585
|
+
* @returns true if the provided `httpStatusCode` is an error code
|
|
586
|
+
*/
|
|
587
|
+
private isHttpStatusCodeError;
|
|
588
|
+
/**
|
|
589
|
+
* Returns true indicating that the API returned an error if the `httpBody` contains
|
|
590
|
+
* one of the paths specified by the PolarityRequest `httpResponseErrorProperties`
|
|
591
|
+
* property.
|
|
592
|
+
*
|
|
593
|
+
* @param httpBody - body property from the HttpRequestResponse
|
|
594
|
+
* @returns `true` if the httpBody property contains properties specified in `httpResponseErrorProperties`
|
|
595
|
+
*/
|
|
596
|
+
private hasHttpResponseErrorProperty;
|
|
597
|
+
/**
|
|
598
|
+
* Returns an error message based on the `httpResponseErrorMessageProperties` first. If no
|
|
599
|
+
* message is found, it then uses the `httpResponseErrorProperties` to attempt to find
|
|
600
|
+
* a suitable error message. If no message is still found, the `defaultMessage` is returned.
|
|
601
|
+
*
|
|
602
|
+
* @param httpBody - JSON Object returned by an HTTP Request
|
|
603
|
+
* @param defaultMessage - A default error message to use if no specific error messages are found
|
|
604
|
+
* @returns An error message
|
|
605
|
+
*/
|
|
606
|
+
private getErrorMessageFromHttpResponse;
|
|
607
|
+
/**
|
|
608
|
+
* Given a list of `properties` which are strings representing JSON dot notation, this
|
|
609
|
+
* method returns the first string property found at the given JSON path
|
|
610
|
+
* in the given `object`.
|
|
611
|
+
*
|
|
612
|
+
* @param object - An object to find properties in
|
|
613
|
+
* @param properties - a list of JSON dot notation properties to look for within `object`
|
|
614
|
+
* @returns A string value of the property found within the given object or undefined if no value is found
|
|
615
|
+
*/
|
|
616
|
+
private maybeGetStringPropertyValue;
|
|
617
|
+
/**
|
|
618
|
+
* Runs multiple requests in parallel with a limit on the maximum number of concurrent requests.
|
|
619
|
+
*
|
|
620
|
+
* When running multiple request at once it is often useful to be able to tie a specific request
|
|
621
|
+
* back to the entity the request is for. To support this, the `HttpRequestOptions` object accepts
|
|
622
|
+
* an optional `entity` property which can be assigned to the Entity the request is being made for.
|
|
623
|
+
* The `HttpRequestResponse` object returned by this method will include the same `entity` property
|
|
624
|
+
* making it easy to match the response to the entity.
|
|
625
|
+
*
|
|
626
|
+
* Alternatively, for requests that are made for multiple entities at once (e.g., a query that can
|
|
627
|
+
* search multiple entities at a time), the `HttpRequestOptions` object also has an `entities`
|
|
628
|
+
* property which accept an array of entity objects. Similar to the `entity`, the
|
|
629
|
+
* `entities` property will be set on the `HttpRequestResponse` object.
|
|
630
|
+
*
|
|
631
|
+
* Finally, if you are looking to pass through a custom request id you can do that using the
|
|
632
|
+
* `requestId` property.
|
|
633
|
+
*
|
|
634
|
+
* @param options - An array of request options for running requests in parallel.
|
|
635
|
+
* @returns A promise that resolves to an array of responses. If the `returnErrors` property is set to `true`
|
|
636
|
+
* then the response objects will have their `error` property set to the thrown error.
|
|
637
|
+
*/
|
|
638
|
+
runInParallel(options: RunInParallelOptions): Promise<HttpRequestResponse[]>;
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
/**
|
|
642
|
+
* @public
|
|
643
|
+
*/
|
|
644
|
+
export declare interface PolarityRequestOptions {
|
|
645
|
+
defaults?: ConfigRequestProxyOptions;
|
|
646
|
+
isApiError?: IsApiErrorFunction;
|
|
647
|
+
roundedSuccessStatusCodes?: number[];
|
|
648
|
+
httpResponseErrorProperties?: string[];
|
|
649
|
+
httpResponseErrorMessageProperties?: string[];
|
|
650
|
+
requestOptionsToSanitize?: string[];
|
|
651
|
+
preprocessRequestOptions?: PreprocessRequestOptions;
|
|
652
|
+
postprocessRequestSuccess?: PostprocessRequestSuccess;
|
|
653
|
+
postprocessRequestFailure?: PostprocessRequestFailure;
|
|
654
|
+
throttlingOptions?: Bottleneck.ConstructorOptions;
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
/**
|
|
658
|
+
* @public
|
|
659
|
+
*/
|
|
660
|
+
export declare type PossibleUserOptionValue = undefined | string | number | boolean | DropdownUserOptionValue | DropdownUserOptionValue[];
|
|
661
|
+
|
|
662
|
+
/**
|
|
663
|
+
* @public
|
|
664
|
+
*/
|
|
665
|
+
export declare type PostprocessRequestFailure = (error: Error, requestOptions: HttpRequestOptions, userOptions: DoLookupUserOptions) => Promise<unknown> | never;
|
|
666
|
+
|
|
667
|
+
/**
|
|
668
|
+
* Optional middleware method for modifying the {@link HttpRequestResponse} after a successful request.
|
|
669
|
+
* The passed in {@link HttpRequestResponse} object is not a copy but can be safely modified without
|
|
670
|
+
* side effects. The returned `HttpRequestResponse` object will be used for the response.
|
|
671
|
+
*
|
|
672
|
+
* @public
|
|
673
|
+
*/
|
|
674
|
+
export declare type PostprocessRequestSuccess = (response: HttpRequestResponse, requestOptions: HttpRequestOptions, userOptions: DoLookupUserOptions) => Promise<HttpRequestResponse> | never;
|
|
675
|
+
|
|
676
|
+
/**
|
|
677
|
+
* Optional middleware method for modifying {@link HttpRequestOptions} before a request is made
|
|
678
|
+
* via the {@link PolarityRequest.run} method or {@link PolarityRequest.runInParallel} method.
|
|
679
|
+
* The returned `requestOptions` object will be used for the request. This method is passed
|
|
680
|
+
* a copy of the original `requestOptions` object so it can be modified without side effects.
|
|
681
|
+
*
|
|
682
|
+
* This method is typically used for adding authentication (e.g., auth headers, or basic auth) to every request. It can also
|
|
683
|
+
* be used to add headers that are required on every request or conditionally add headers based
|
|
684
|
+
* on the passed in `userOptions`.
|
|
685
|
+
*
|
|
686
|
+
* @public
|
|
687
|
+
*/
|
|
688
|
+
export declare type PreprocessRequestOptions = (requestOptions: HttpRequestOptions, userOptions: DoLookupUserOptions) => Promise<HttpRequestOptions> | never | undefined;
|
|
689
|
+
|
|
690
|
+
/**
|
|
691
|
+
* Thrown by authenticated request method for any HTTP status codes where we want to allow
|
|
692
|
+
* the user to retry their lookup.
|
|
693
|
+
*
|
|
694
|
+
* @public
|
|
695
|
+
*/
|
|
696
|
+
export declare class RetryRequestError extends IntegrationError {
|
|
697
|
+
constructor(message: string, properties?: IntegrationErrorProperties);
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
/**
|
|
701
|
+
* @public
|
|
702
|
+
*/
|
|
703
|
+
export declare type RunInParallelOptions = {
|
|
704
|
+
/**
|
|
705
|
+
* Array of HttpRequestOptions that will be run in parallel as specified by
|
|
706
|
+
* the `maxConcurrentRequests` property.
|
|
707
|
+
*/
|
|
708
|
+
allRequestOptions: HttpRequestOptions[];
|
|
709
|
+
/**
|
|
710
|
+
* Maximum number of requests to run in parallel
|
|
711
|
+
*
|
|
712
|
+
* @defaultValue 5
|
|
713
|
+
*/
|
|
714
|
+
maxConcurrentRequests?: number;
|
|
715
|
+
/**
|
|
716
|
+
* If true, any errors thrown during the request will be returned in the response object on the `error` property
|
|
717
|
+
* of the returned `HttpRequestResponse` object. If false, any errors thrown will be thrown and should be handled by
|
|
718
|
+
*
|
|
719
|
+
*
|
|
720
|
+
* @defaultValue false
|
|
721
|
+
*/
|
|
722
|
+
returnErrors?: boolean;
|
|
723
|
+
};
|
|
724
|
+
|
|
725
|
+
/**
|
|
726
|
+
* Sanitizes the request options by removing sensitive information
|
|
727
|
+
* from the provided request options object.
|
|
728
|
+
*
|
|
729
|
+
* Default sanitized paths are:
|
|
730
|
+
*
|
|
731
|
+
* - auth.password
|
|
732
|
+
* - auth.bearer
|
|
733
|
+
* - body.password
|
|
734
|
+
* - form.client_secret
|
|
735
|
+
* - headers.authorization
|
|
736
|
+
* - headers.x-api-key
|
|
737
|
+
*
|
|
738
|
+
* @param requestOptions - request options to sanitize
|
|
739
|
+
* @param additionalPathsToSanitize - array of additional paths to sanitize in addition to the
|
|
740
|
+
* default paths.
|
|
741
|
+
*/
|
|
742
|
+
export declare function sanitizeRequestOptions(requestOptions: HttpRequestOptions, additionalPathsToSanitize?: string[]): HttpRequestOptions;
|
|
743
|
+
|
|
744
|
+
/**
|
|
745
|
+
* @public
|
|
746
|
+
*/
|
|
747
|
+
export declare interface SerializedIntegrationError {
|
|
748
|
+
/**
|
|
749
|
+
* a short, human-readable summary of the problem that SHOULD NOT change from occurrence to occurrence of
|
|
750
|
+
* the problem except for purposes of localization. If omitted, the title will default to the type
|
|
751
|
+
* of error (e.g., IntegrationError, or ApiRequestError)
|
|
752
|
+
*/
|
|
753
|
+
title: string;
|
|
754
|
+
/**
|
|
755
|
+
* The name data property of IntegrationError.prototype is shared by all Error instances.
|
|
756
|
+
* It represents the name for the type of error. For IntegrationError.prototype.name,
|
|
757
|
+
* the initial value is "IntegrationError".
|
|
758
|
+
*/
|
|
759
|
+
name: string;
|
|
760
|
+
/**
|
|
761
|
+
* a human-readable explanation specific to this occurrence of the problem. Like title, this field’s value can be
|
|
762
|
+
* localized
|
|
763
|
+
*/
|
|
764
|
+
detail: string;
|
|
765
|
+
/**
|
|
766
|
+
* An optional HTTP status code applicable to this error, expressed as a string value.
|
|
767
|
+
*/
|
|
768
|
+
status?: string;
|
|
769
|
+
/**
|
|
770
|
+
* Additional details related to the error that may help the user troubleshoot the issue. If set by the user
|
|
771
|
+
* via the Error constructor, the user provided value will override any automated help message set by the
|
|
772
|
+
* Error class.
|
|
773
|
+
*/
|
|
774
|
+
help?: string;
|
|
775
|
+
/**
|
|
776
|
+
* An optional StackTrace of the error
|
|
777
|
+
*/
|
|
778
|
+
stack?: string;
|
|
779
|
+
/**
|
|
780
|
+
* An optional application-specific error code, expressed as a string value.
|
|
781
|
+
*/
|
|
782
|
+
code?: number | string;
|
|
783
|
+
/**
|
|
784
|
+
* The `cause` property is used to specify the `cause` of the error. Typically,
|
|
785
|
+
* this property is used to pass through a related Error instance.
|
|
786
|
+
*/
|
|
787
|
+
cause?: Error_2;
|
|
788
|
+
/**
|
|
789
|
+
* Relevant for integration errors involving a network call, the `requestOptions` property
|
|
790
|
+
* details the request options that resulted in the specified error. The `requestOptions` property will automatically
|
|
791
|
+
* have sensitive authentication headers stripped.
|
|
792
|
+
*/
|
|
793
|
+
requestOptions?: HttpRequestOptions;
|
|
794
|
+
/**
|
|
795
|
+
* an optional meta object containing non-standard meta-information about the error.
|
|
796
|
+
*/
|
|
797
|
+
meta?: ErrorMeta;
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
/**
|
|
801
|
+
* Set the logger object used by the integration.
|
|
802
|
+
*
|
|
803
|
+
* @example
|
|
804
|
+
* Example of setting the logger within the integration's startup method:
|
|
805
|
+
* ```js
|
|
806
|
+
* const { setLogger } = require('polarity-integration-utils/logger');
|
|
807
|
+
*
|
|
808
|
+
* function startup(logger){
|
|
809
|
+
* setLogger(logger);
|
|
810
|
+
* }
|
|
811
|
+
* ```
|
|
812
|
+
*
|
|
813
|
+
* You can now use {@link getLogger} to get the logger object anywhere within your integration codebase.
|
|
814
|
+
*
|
|
815
|
+
* @public
|
|
816
|
+
* @param logger - the integration logger object passed into the `startup` method
|
|
817
|
+
*/
|
|
818
|
+
export declare const setLogger: (logger: Logger) => void;
|
|
819
|
+
|
|
820
|
+
/**
|
|
821
|
+
* List of supported entity type values
|
|
822
|
+
* @public
|
|
823
|
+
*/
|
|
824
|
+
export declare type StandardEntityType = 'IP' | 'IPv4' | 'IPv4CIDR' | 'IPv6' | 'MAC' | 'MD5' | 'SHA1' | 'SHA256' | 'cve' | 'domain' | 'email' | 'hash' | 'string' | 'url';
|
|
825
|
+
|
|
826
|
+
/**
|
|
827
|
+
* @public
|
|
828
|
+
*/
|
|
829
|
+
export declare type ValidateOptionsUserOption = {
|
|
830
|
+
integration_id?: string;
|
|
831
|
+
key: string;
|
|
832
|
+
value: PossibleUserOptionValue;
|
|
833
|
+
user_can_edit?: boolean;
|
|
834
|
+
admin_only?: boolean;
|
|
835
|
+
};
|
|
836
|
+
|
|
837
|
+
/**
|
|
838
|
+
* @public
|
|
839
|
+
*/
|
|
840
|
+
export declare type ValidateOptionsUserOptions = {
|
|
841
|
+
[key: string]: ValidateOptionsUserOption;
|
|
842
|
+
};
|
|
843
|
+
|
|
844
|
+
/**
|
|
845
|
+
* @public
|
|
846
|
+
*/
|
|
847
|
+
export declare type ValidationError = {
|
|
848
|
+
key: string;
|
|
849
|
+
message: string;
|
|
850
|
+
};
|
|
851
|
+
|
|
852
|
+
export { }
|