polarity-integration-utils 4.1.1 → 4.2.0
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/dist/dts/cache/create-cache-key.d.ts +23 -0
- package/dist/dts/cache/create-cache-key.d.ts.map +1 -0
- package/dist/dts/cache/index.d.ts +2 -0
- package/dist/dts/cache/index.d.ts.map +1 -0
- package/dist/dts/errors/integration-error.d.ts +1 -0
- package/dist/dts/errors/integration-error.d.ts.map +1 -1
- package/dist/dts/errors/parse-error-to-readable-json.d.ts +2 -0
- package/dist/dts/errors/parse-error-to-readable-json.d.ts.map +1 -1
- package/dist/dts/index.d.ts +3 -1
- package/dist/dts/index.d.ts.map +1 -1
- package/dist/dts/index.docs.d.ts +1 -0
- package/dist/dts/index.docs.d.ts.map +1 -1
- package/dist/dts/logging/logger.d.ts +2 -0
- package/dist/dts/logging/logger.d.ts.map +1 -1
- package/dist/dts/requests/polarity-request.d.ts +1 -0
- package/dist/dts/requests/polarity-request.d.ts.map +1 -1
- package/dist/dts/requests/sanitize-request-options.d.ts +2 -0
- package/dist/dts/requests/sanitize-request-options.d.ts.map +1 -1
- package/dist/dts/testing/enhanced-utils/create-entity.d.ts +3 -0
- package/dist/dts/testing/enhanced-utils/create-entity.d.ts.map +1 -1
- package/dist/dts/testing/enhanced-utils/create-mock-integration-context.d.ts +4 -0
- package/dist/dts/testing/enhanced-utils/create-mock-integration-context.d.ts.map +1 -1
- package/dist/es/cache/create-cache-key.js +56 -0
- package/dist/es/cache/index.js +5 -0
- package/dist/es/{lib/errors → errors}/parse-error-to-readable-json.js +2 -0
- package/dist/es/{lib/index.docs.js → index.docs.js} +1 -0
- package/dist/es/{lib/index.js → index.js} +4 -1
- package/dist/es/{lib/logging → logging}/logger.js +2 -0
- package/dist/es/{lib/requests → requests}/polarity-request.js +1 -0
- package/dist/es/{lib/requests → requests}/sanitize-request-options.js +2 -0
- package/dist/es/{lib/testing → testing}/enhanced-utils/create-entity.js +3 -0
- package/dist/es/{lib/testing → testing}/enhanced-utils/create-mock-integration-context.js +3 -0
- package/dist/lib/cache/create-cache-key.js +56 -0
- package/dist/lib/cache/index.js +5 -0
- package/dist/lib/errors/parse-error-to-readable-json.js +2 -0
- package/dist/lib/index.docs.js +1 -0
- package/dist/lib/index.js +4 -1
- package/dist/lib/logging/logger.js +2 -0
- package/dist/lib/requests/polarity-request.js +1 -0
- package/dist/lib/requests/sanitize-request-options.js +2 -0
- package/dist/lib/testing/enhanced-utils/create-entity.js +3 -0
- package/dist/lib/testing/enhanced-utils/create-mock-integration-context.js +3 -0
- package/dist/polarity-integration-utils.d.ts +880 -842
- package/package.json +6 -1
- package/dist/dts/lib/errors/api-request-error.d.ts +0 -10
- package/dist/dts/lib/errors/api-request-error.d.ts.map +0 -1
- package/dist/dts/lib/errors/auth-request-error.d.ts +0 -10
- package/dist/dts/lib/errors/auth-request-error.d.ts.map +0 -1
- package/dist/dts/lib/errors/index.d.ts +0 -8
- package/dist/dts/lib/errors/index.d.ts.map +0 -1
- package/dist/dts/lib/errors/integration-error.d.ts +0 -189
- package/dist/dts/lib/errors/integration-error.d.ts.map +0 -1
- package/dist/dts/lib/errors/library-usage-error.d.ts +0 -12
- package/dist/dts/lib/errors/library-usage-error.d.ts.map +0 -1
- package/dist/dts/lib/errors/network-error.d.ts +0 -11
- package/dist/dts/lib/errors/network-error.d.ts.map +0 -1
- package/dist/dts/lib/errors/parse-error-to-readable-json.d.ts +0 -7
- package/dist/dts/lib/errors/parse-error-to-readable-json.d.ts.map +0 -1
- package/dist/dts/lib/errors/retry-request-error.d.ts +0 -11
- package/dist/dts/lib/errors/retry-request-error.d.ts.map +0 -1
- package/dist/dts/lib/index.d.ts +0 -9
- package/dist/dts/lib/index.d.ts.map +0 -1
- package/dist/dts/lib/index.docs.d.ts +0 -14
- package/dist/dts/lib/index.docs.d.ts.map +0 -1
- package/dist/dts/lib/internal/helpers/parallel-limit.d.ts +0 -9
- package/dist/dts/lib/internal/helpers/parallel-limit.d.ts.map +0 -1
- package/dist/dts/lib/internal/helpers/sanitize-object.d.ts +0 -11
- package/dist/dts/lib/internal/helpers/sanitize-object.d.ts.map +0 -1
- package/dist/dts/lib/logging/index.d.ts +0 -2
- package/dist/dts/lib/logging/index.d.ts.map +0 -1
- package/dist/dts/lib/logging/logger.d.ts +0 -38
- package/dist/dts/lib/logging/logger.d.ts.map +0 -1
- package/dist/dts/lib/requests/index.d.ts +0 -3
- package/dist/dts/lib/requests/index.d.ts.map +0 -1
- package/dist/dts/lib/requests/polarity-request.d.ts +0 -436
- package/dist/dts/lib/requests/polarity-request.d.ts.map +0 -1
- package/dist/dts/lib/requests/sanitize-request-options.d.ts +0 -20
- package/dist/dts/lib/requests/sanitize-request-options.d.ts.map +0 -1
- package/dist/dts/lib/testing/enhanced-utils/create-entity.d.ts +0 -19
- package/dist/dts/lib/testing/enhanced-utils/create-entity.d.ts.map +0 -1
- package/dist/dts/lib/testing/enhanced-utils/create-mock-integration-context.d.ts +0 -43
- package/dist/dts/lib/testing/enhanced-utils/create-mock-integration-context.d.ts.map +0 -1
- package/dist/dts/lib/testing/index.d.ts +0 -3
- package/dist/dts/lib/testing/index.d.ts.map +0 -1
- package/dist/dts/lib/types.d.ts +0 -105
- package/dist/dts/lib/types.d.ts.map +0 -1
- /package/dist/es/{lib/errors → errors}/api-request-error.js +0 -0
- /package/dist/es/{lib/errors → errors}/auth-request-error.js +0 -0
- /package/dist/es/{lib/errors → errors}/index.js +0 -0
- /package/dist/es/{lib/errors → errors}/integration-error.js +0 -0
- /package/dist/es/{lib/errors → errors}/library-usage-error.js +0 -0
- /package/dist/es/{lib/errors → errors}/network-error.js +0 -0
- /package/dist/es/{lib/errors → errors}/retry-request-error.js +0 -0
- /package/dist/es/{lib/internal → internal}/helpers/parallel-limit.js +0 -0
- /package/dist/es/{lib/internal → internal}/helpers/sanitize-object.js +0 -0
- /package/dist/es/{lib/logging → logging}/index.js +0 -0
- /package/dist/es/{lib/requests → requests}/index.js +0 -0
- /package/dist/es/{lib/testing → testing}/index.js +0 -0
- /package/dist/es/{lib/types.js → types.js} +0 -0
|
@@ -1,436 +0,0 @@
|
|
|
1
|
-
import { ApiRequestError, NetworkError, RetryRequestError } from '../errors';
|
|
2
|
-
import type { Entity, DoLookupUserOptions } from '@polarityio/integration-types';
|
|
3
|
-
/**
|
|
4
|
-
* @public
|
|
5
|
-
*/
|
|
6
|
-
export type ConfigRequestProxyOptions = {
|
|
7
|
-
ca?: undefined | string;
|
|
8
|
-
cert?: undefined | string;
|
|
9
|
-
key?: undefined | string;
|
|
10
|
-
passphrase?: undefined | string;
|
|
11
|
-
rejectUnauthorized?: undefined | boolean;
|
|
12
|
-
proxy?: undefined | string;
|
|
13
|
-
json?: undefined | boolean;
|
|
14
|
-
};
|
|
15
|
-
export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS';
|
|
16
|
-
/**
|
|
17
|
-
* @public
|
|
18
|
-
*/
|
|
19
|
-
export type HttpRequestOptions = {
|
|
20
|
-
/**
|
|
21
|
-
* The URL to make the request to.
|
|
22
|
-
*/
|
|
23
|
-
url?: string;
|
|
24
|
-
/**
|
|
25
|
-
* The HTTP method to use for the request.
|
|
26
|
-
*
|
|
27
|
-
* @defaultValue 'GET'
|
|
28
|
-
*/
|
|
29
|
-
method?: HttpMethod;
|
|
30
|
-
/**
|
|
31
|
-
* If true, sets body to JSON representation of value and adds Content-type: application/json header.
|
|
32
|
-
* Additionally, parses the response body as JSON.
|
|
33
|
-
*
|
|
34
|
-
* @defaultValue true
|
|
35
|
-
*/
|
|
36
|
-
json?: boolean;
|
|
37
|
-
/**
|
|
38
|
-
* An object containing the headers to include in the request.
|
|
39
|
-
* @example
|
|
40
|
-
* Here is an example of setting the "X-Api-Key" `headers` property:
|
|
41
|
-
* ```
|
|
42
|
-
* {
|
|
43
|
-
* headers: {
|
|
44
|
-
* 'X-Api-Key': '1234567890'
|
|
45
|
-
* }
|
|
46
|
-
* }
|
|
47
|
-
* ```
|
|
48
|
-
*/
|
|
49
|
-
headers?: object;
|
|
50
|
-
/**
|
|
51
|
-
* An object containing querystring parameters to include in the request.
|
|
52
|
-
* @example
|
|
53
|
-
* Here is an example of setting the `qs` property:
|
|
54
|
-
* ```
|
|
55
|
-
* {
|
|
56
|
-
* qs: {
|
|
57
|
-
* search: 'foo'
|
|
58
|
-
* }
|
|
59
|
-
* }
|
|
60
|
-
* ```
|
|
61
|
-
*/
|
|
62
|
-
qs?: object;
|
|
63
|
-
/**
|
|
64
|
-
* When passed an object or a querystring, this sets body to a querystring representation of value,
|
|
65
|
-
* and adds Content-type: application/x-www-form-urlencoded header.
|
|
66
|
-
*/
|
|
67
|
-
form?: object;
|
|
68
|
-
/**
|
|
69
|
-
* The body of the request.
|
|
70
|
-
*/
|
|
71
|
-
body?: object;
|
|
72
|
-
/**
|
|
73
|
-
* The authentication options to use for the request
|
|
74
|
-
*/
|
|
75
|
-
auth?: {
|
|
76
|
-
username: string;
|
|
77
|
-
password: string;
|
|
78
|
-
sendImmediately?: boolean;
|
|
79
|
-
} | {
|
|
80
|
-
bearer: string;
|
|
81
|
-
sendImmediately?: boolean;
|
|
82
|
-
};
|
|
83
|
-
[key: string]: unknown;
|
|
84
|
-
} & ({
|
|
85
|
-
entity: Entity;
|
|
86
|
-
entities?: never;
|
|
87
|
-
requestId?: never;
|
|
88
|
-
} | {
|
|
89
|
-
entities: Entity[];
|
|
90
|
-
entity?: never;
|
|
91
|
-
requestId?: never;
|
|
92
|
-
} | {
|
|
93
|
-
requestId: string | unknown;
|
|
94
|
-
entity?: never;
|
|
95
|
-
entities?: never;
|
|
96
|
-
} | {
|
|
97
|
-
entity?: never;
|
|
98
|
-
entities?: never;
|
|
99
|
-
requestId?: never;
|
|
100
|
-
});
|
|
101
|
-
/**
|
|
102
|
-
* @public
|
|
103
|
-
*/
|
|
104
|
-
export type RunInParallelOptions = {
|
|
105
|
-
/**
|
|
106
|
-
* Array of HttpRequestOptions that will be run in parallel as specified by
|
|
107
|
-
* the `maxConcurrentRequests` property.
|
|
108
|
-
*/
|
|
109
|
-
allRequestOptions: HttpRequestOptions[];
|
|
110
|
-
/**
|
|
111
|
-
* Maximum number of requests to run in parallel
|
|
112
|
-
*
|
|
113
|
-
* @defaultValue 5
|
|
114
|
-
*/
|
|
115
|
-
maxConcurrentRequests?: number;
|
|
116
|
-
/**
|
|
117
|
-
* If true, any errors thrown during the request will be returned in the response object on the `error` property
|
|
118
|
-
* of the returned `HttpRequestResponse` object. If false, any errors thrown will be thrown and should be handled by
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
* @defaultValue false
|
|
122
|
-
*/
|
|
123
|
-
returnErrors?: boolean;
|
|
124
|
-
};
|
|
125
|
-
/**
|
|
126
|
-
* @public
|
|
127
|
-
*/
|
|
128
|
-
export type HttpRequestResponse = {
|
|
129
|
-
/**
|
|
130
|
-
* The HTTP status code of the response.
|
|
131
|
-
*/
|
|
132
|
-
statusCode: number;
|
|
133
|
-
request: {
|
|
134
|
-
uri: unknown;
|
|
135
|
-
method: string;
|
|
136
|
-
headers: unknown;
|
|
137
|
-
[key: string]: unknown;
|
|
138
|
-
};
|
|
139
|
-
/**
|
|
140
|
-
* The body of the response.
|
|
141
|
-
*/
|
|
142
|
-
body: unknown;
|
|
143
|
-
/**
|
|
144
|
-
* The response headers
|
|
145
|
-
*/
|
|
146
|
-
headers: unknown;
|
|
147
|
-
/**
|
|
148
|
-
* The error object if an error occurred during the request.
|
|
149
|
-
*/
|
|
150
|
-
error?: ApiRequestError | NetworkError | RetryRequestError;
|
|
151
|
-
/**
|
|
152
|
-
* The entity that the request was made for. The `entity` property matches the
|
|
153
|
-
* `entity` property set on the {@link HttpRequestOptions} object associated with this HttpRequestResponse.
|
|
154
|
-
*/
|
|
155
|
-
entity?: Entity;
|
|
156
|
-
/**
|
|
157
|
-
* An array of entities that the request was made for. The `entities` property
|
|
158
|
-
* matches the `entities` property set on the {@link HttpRequestOptions} object associated
|
|
159
|
-
* with this HttpRequestResponse.
|
|
160
|
-
*/
|
|
161
|
-
entities?: Entity[];
|
|
162
|
-
/**
|
|
163
|
-
* A custom request id that can be used to identify the request. The `requestId` matches
|
|
164
|
-
* the `requestId` property set on the {@link HttpRequestOptions} object.
|
|
165
|
-
*/
|
|
166
|
-
requestId?: string | unknown;
|
|
167
|
-
[key: string]: unknown;
|
|
168
|
-
};
|
|
169
|
-
/**
|
|
170
|
-
* @public
|
|
171
|
-
*/
|
|
172
|
-
export type IsApiErrorResult = {
|
|
173
|
-
/**
|
|
174
|
-
* Indicates whether the response is an API error.
|
|
175
|
-
*/
|
|
176
|
-
isApiError: boolean;
|
|
177
|
-
/**
|
|
178
|
-
* Optional message providing additional information about the API error. The
|
|
179
|
-
* returned `message` will be used as the `message` property on the {@link ApiRequestError} object
|
|
180
|
-
* thrown by the request.
|
|
181
|
-
*/
|
|
182
|
-
message?: string;
|
|
183
|
-
};
|
|
184
|
-
/**
|
|
185
|
-
* @public
|
|
186
|
-
*/
|
|
187
|
-
export type IsApiErrorFunction = (response: HttpRequestResponse, requestOptions: HttpRequestOptions, userOptions: DoLookupUserOptions) => IsApiErrorResult;
|
|
188
|
-
/**
|
|
189
|
-
* Minimal interface for a rate limiter compatible with PolarityRequest.
|
|
190
|
-
* The Polarity server provides a Bottleneck instance that satisfies this interface.
|
|
191
|
-
*
|
|
192
|
-
* @public
|
|
193
|
-
*/
|
|
194
|
-
export interface Limiter {
|
|
195
|
-
schedule<T>(fn: (...args: unknown[]) => PromiseLike<T>, ...args: unknown[]): Promise<T>;
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
* Hook that runs before an HTTP request is made. Each hook receives the output
|
|
199
|
-
* of the previous hook, allowing request options to be modified in a chain.
|
|
200
|
-
*
|
|
201
|
-
* Typically used for adding authentication headers or conditionally modifying
|
|
202
|
-
* request options based on user options.
|
|
203
|
-
*
|
|
204
|
-
* @public
|
|
205
|
-
*/
|
|
206
|
-
export type BeforeRequestHook = (requestOptions: HttpRequestOptions, userOptions: DoLookupUserOptions) => Promise<HttpRequestOptions>;
|
|
207
|
-
/**
|
|
208
|
-
* Hook that runs after a successful HTTP response. Each hook receives the output
|
|
209
|
-
* of the previous hook, allowing the response to be modified in a chain.
|
|
210
|
-
*
|
|
211
|
-
* Typically used to extract specific fields from the response body or to
|
|
212
|
-
* transform the response into a more useful shape.
|
|
213
|
-
*
|
|
214
|
-
* @public
|
|
215
|
-
*/
|
|
216
|
-
export type AfterResponseHook = (response: HttpRequestResponse, requestOptions: HttpRequestOptions, userOptions: DoLookupUserOptions) => Promise<HttpRequestResponse>;
|
|
217
|
-
/**
|
|
218
|
-
* Hook that runs when an API error is detected (non-success status code or error
|
|
219
|
-
* properties found in the response body). Receives the full HTTP response so the
|
|
220
|
-
* hook can inspect status codes, headers, and body.
|
|
221
|
-
*
|
|
222
|
-
* If all registered hooks return without throwing, the error is suppressed and
|
|
223
|
-
* the HTTP response is returned to the caller. To propagate or replace the error,
|
|
224
|
-
* throw from within the hook.
|
|
225
|
-
*
|
|
226
|
-
* @public
|
|
227
|
-
*/
|
|
228
|
-
export type OnApiErrorHook = (error: ApiRequestError, response: HttpRequestResponse, requestOptions: HttpRequestOptions, userOptions: DoLookupUserOptions) => Promise<void>;
|
|
229
|
-
/**
|
|
230
|
-
* Hook that runs when a network error or rate-limiting error occurs during a request.
|
|
231
|
-
*
|
|
232
|
-
* If all registered hooks return without throwing, the error is suppressed.
|
|
233
|
-
* To propagate or replace the error, throw from within the hook.
|
|
234
|
-
*
|
|
235
|
-
* @public
|
|
236
|
-
*/
|
|
237
|
-
export type OnNetworkErrorHook = (error: NetworkError | RetryRequestError, requestOptions: HttpRequestOptions, userOptions: DoLookupUserOptions) => Promise<void>;
|
|
238
|
-
/**
|
|
239
|
-
* Hooks for customizing the {@link PolarityRequest} lifecycle. All hook arrays
|
|
240
|
-
* execute in order. `beforeRequest` and `afterResponse` hooks chain their output,
|
|
241
|
-
* while error hooks run sequentially and can suppress errors by returning without
|
|
242
|
-
* throwing.
|
|
243
|
-
*
|
|
244
|
-
* @public
|
|
245
|
-
*/
|
|
246
|
-
export interface PolarityRequestHooks {
|
|
247
|
-
/**
|
|
248
|
-
* Hooks that run before each HTTP request. Each hook receives a copy of the request
|
|
249
|
-
* options and the return value is passed to the next hook (or used for the request).
|
|
250
|
-
*/
|
|
251
|
-
beforeRequest?: BeforeRequestHook[];
|
|
252
|
-
/**
|
|
253
|
-
* Hooks that run after a successful HTTP response. Each hook receives the response
|
|
254
|
-
* from the previous hook and the return value is passed to the next hook (or returned
|
|
255
|
-
* to the caller).
|
|
256
|
-
*/
|
|
257
|
-
afterResponse?: AfterResponseHook[];
|
|
258
|
-
/**
|
|
259
|
-
* Hooks that run when an API error is detected. Each hook receives the error and the
|
|
260
|
-
* full HTTP response. If all hooks return without throwing, the error is suppressed.
|
|
261
|
-
*/
|
|
262
|
-
onApiError?: OnApiErrorHook[];
|
|
263
|
-
/**
|
|
264
|
-
* Hooks that run when a network or rate-limiting error occurs. If all hooks return
|
|
265
|
-
* without throwing, the error is suppressed.
|
|
266
|
-
*/
|
|
267
|
-
onNetworkError?: OnNetworkErrorHook[];
|
|
268
|
-
}
|
|
269
|
-
/**
|
|
270
|
-
* @public
|
|
271
|
-
*/
|
|
272
|
-
export interface PolarityRequestOptions {
|
|
273
|
-
defaults?: ConfigRequestProxyOptions;
|
|
274
|
-
isApiError?: IsApiErrorFunction;
|
|
275
|
-
roundedSuccessStatusCodes?: number[];
|
|
276
|
-
httpResponseErrorProperties?: string[];
|
|
277
|
-
httpResponseErrorMessageProperties?: string[];
|
|
278
|
-
requestOptionsToSanitize?: string[];
|
|
279
|
-
hooks?: PolarityRequestHooks;
|
|
280
|
-
limiter?: Limiter;
|
|
281
|
-
}
|
|
282
|
-
/**
|
|
283
|
-
* A utility class for making HTTP requests
|
|
284
|
-
* @public
|
|
285
|
-
*/
|
|
286
|
-
export declare class PolarityRequest {
|
|
287
|
-
/**
|
|
288
|
-
* Instance of a Bunyan logger
|
|
289
|
-
*/
|
|
290
|
-
private logger;
|
|
291
|
-
/**
|
|
292
|
-
* postman-request library request object with default values set. Used internally for
|
|
293
|
-
* making HTTP requests directly via the postman-request library
|
|
294
|
-
*/
|
|
295
|
-
private readonly requestWithDefaults;
|
|
296
|
-
readonly roundedSuccessStatusCodes: number[];
|
|
297
|
-
/**
|
|
298
|
-
* One or more HTTP response properties specified using JSON dot notation. If the
|
|
299
|
-
* specified path exists within the `body` property of the HTTP Response, an
|
|
300
|
-
* ApiRequestError will be thrown.
|
|
301
|
-
*
|
|
302
|
-
* By default, this value is an empty array and response properties are not used to
|
|
303
|
-
* detect errors.
|
|
304
|
-
* @defaultValue []
|
|
305
|
-
*/
|
|
306
|
-
readonly httpResponseErrorProperties: string[];
|
|
307
|
-
/**
|
|
308
|
-
* One or more HTTP response properties specified using JSON dot notation that
|
|
309
|
-
* point to an error message that should be displayed to the user in the event
|
|
310
|
-
* of an API error.
|
|
311
|
-
*
|
|
312
|
-
* The property should be a string value. If the property does not exist or is not
|
|
313
|
-
* a string value, a default error message will be used instead.
|
|
314
|
-
*/
|
|
315
|
-
readonly httpResponseErrorMessageProperties: string[];
|
|
316
|
-
/**
|
|
317
|
-
* Optional method that can be implemented to determine if an API error
|
|
318
|
-
* was encountered after an HTTP request is made.
|
|
319
|
-
*
|
|
320
|
-
* If the `isApiError` method is implemented
|
|
321
|
-
* the property `roundedSuccessStatusCodes` and `httpResponseErrorProperties` are not
|
|
322
|
-
* used to determine API errors.
|
|
323
|
-
*
|
|
324
|
-
* @returns An object indicating whether an API error was encountered and an optional message.
|
|
325
|
-
*/
|
|
326
|
-
readonly isApiError: IsApiErrorFunction;
|
|
327
|
-
/**
|
|
328
|
-
* An array of JSON dot notation paths to omit from the request options when logging.
|
|
329
|
-
*
|
|
330
|
-
* This property can be used to sanitize sensitive request properties that should not
|
|
331
|
-
* appear in logging.
|
|
332
|
-
*
|
|
333
|
-
* Note that the `requestOptions` object is automatically sanitized to remove properties that
|
|
334
|
-
* typically contain sensitive API key and passwords. For a list of properties that are
|
|
335
|
-
* automatically sanitized, see the {@link sanitizeRequestOptions} method.
|
|
336
|
-
*/
|
|
337
|
-
readonly requestOptionsToSanitize: string[];
|
|
338
|
-
userOptions: DoLookupUserOptions;
|
|
339
|
-
/**
|
|
340
|
-
* An optional rate limiter instance used to throttle HTTP requests.
|
|
341
|
-
* When set, all requests made via {@link PolarityRequest.run} are scheduled
|
|
342
|
-
* through this limiter. Typically provided by the Polarity server via the
|
|
343
|
-
* integration context.
|
|
344
|
-
*/
|
|
345
|
-
limiter: Limiter | null;
|
|
346
|
-
/**
|
|
347
|
-
* Lifecycle hooks for customizing request behavior. Hooks are configured via the
|
|
348
|
-
* {@link PolarityRequestOptions.hooks} property when creating a new instance of the
|
|
349
|
-
* {@link PolarityRequest} class.
|
|
350
|
-
*
|
|
351
|
-
* @see {@link PolarityRequestHooks} for hook type details.
|
|
352
|
-
*/
|
|
353
|
-
readonly hooks: Required<PolarityRequestHooks>;
|
|
354
|
-
constructor(options?: PolarityRequestOptions);
|
|
355
|
-
private configFieldIsValid;
|
|
356
|
-
/**
|
|
357
|
-
* Makes a single HTTP request and returns the response or throws an error
|
|
358
|
-
*
|
|
359
|
-
* @param requestOptions - request options used to make the HTTP request
|
|
360
|
-
* @returns The HTTP response
|
|
361
|
-
*/
|
|
362
|
-
run(requestOptions: HttpRequestOptions): Promise<HttpRequestResponse | undefined> | never;
|
|
363
|
-
/**
|
|
364
|
-
* Checks whether the HTTP response is an API error and returns an ApiRequestError if it is.
|
|
365
|
-
*
|
|
366
|
-
* @param httpResponse - The HTTP response from the Postman request.
|
|
367
|
-
* @param requestOptions - The options used for the request.
|
|
368
|
-
* @returns An ApiRequestError if the response indicates an API error, undefined otherwise.
|
|
369
|
-
*
|
|
370
|
-
* @throws {@link LibraryUsageError}
|
|
371
|
-
* Throws if the `isApiError` function returns an invalid result.
|
|
372
|
-
*/
|
|
373
|
-
private detectApiError;
|
|
374
|
-
/**
|
|
375
|
-
* Returns true if the `httpStatusCode` is not one of the rounded HTTP status codes
|
|
376
|
-
* specified in the PolarityRequest `roundedSuccessStatusCodes` property.
|
|
377
|
-
*
|
|
378
|
-
* @param httpStatusCode - A numeric HTTP Status Code
|
|
379
|
-
* @returns true if the provided `httpStatusCode` is an error code
|
|
380
|
-
*/
|
|
381
|
-
private isHttpStatusCodeError;
|
|
382
|
-
/**
|
|
383
|
-
* Returns true indicating that the API returned an error if the `httpBody` contains
|
|
384
|
-
* one of the paths specified by the PolarityRequest `httpResponseErrorProperties`
|
|
385
|
-
* property.
|
|
386
|
-
*
|
|
387
|
-
* @param httpBody - body property from the HttpRequestResponse
|
|
388
|
-
* @returns `true` if the httpBody property contains properties specified in `httpResponseErrorProperties`
|
|
389
|
-
*/
|
|
390
|
-
private hasHttpResponseErrorProperty;
|
|
391
|
-
/**
|
|
392
|
-
* Returns an error message based on the `httpResponseErrorMessageProperties` first. If no
|
|
393
|
-
* message is found, it then uses the `httpResponseErrorProperties` to attempt to find
|
|
394
|
-
* a suitable error message. If no message is still found, the `defaultMessage` is returned.
|
|
395
|
-
*
|
|
396
|
-
* @param httpBody - JSON Object returned by an HTTP Request
|
|
397
|
-
* @param defaultMessage - A default error message to use if no specific error messages are found
|
|
398
|
-
* @returns An error message
|
|
399
|
-
*/
|
|
400
|
-
private getErrorMessageFromHttpResponse;
|
|
401
|
-
/**
|
|
402
|
-
* Given a list of `properties` which are strings representing JSON dot notation, this
|
|
403
|
-
* method returns the first string property found at the given JSON path
|
|
404
|
-
* in the given `object`.
|
|
405
|
-
*
|
|
406
|
-
* @param object - An object to find properties in
|
|
407
|
-
* @param properties - a list of JSON dot notation properties to look for within `object`
|
|
408
|
-
* @returns A string value of the property found within the given object or undefined if no value is found
|
|
409
|
-
*/
|
|
410
|
-
private maybeGetStringPropertyValue;
|
|
411
|
-
/**
|
|
412
|
-
* Runs multiple requests in parallel with a limit on the maximum number of concurrent requests.
|
|
413
|
-
*
|
|
414
|
-
* When running multiple request at once it is often useful to be able to tie a specific request
|
|
415
|
-
* back to the entity the request is for. To support this, the `HttpRequestOptions` object accepts
|
|
416
|
-
* an optional `entity` property which can be assigned to the Entity the request is being made for.
|
|
417
|
-
* The `HttpRequestResponse` object returned by this method will include the same `entity` property
|
|
418
|
-
* making it easy to match the response to the entity.
|
|
419
|
-
*
|
|
420
|
-
* Alternatively, for requests that are made for multiple entities at once (e.g., a query that can
|
|
421
|
-
* search multiple entities at a time), the `HttpRequestOptions` object also has an `entities`
|
|
422
|
-
* property which accept an array of entity objects. Similar to the `entity`, the
|
|
423
|
-
* `entities` property will be set on the `HttpRequestResponse` object.
|
|
424
|
-
*
|
|
425
|
-
* Finally, if you are looking to pass through a custom request id you can do that using the
|
|
426
|
-
* `requestId` property.
|
|
427
|
-
*
|
|
428
|
-
* @param options - An array of request options for running requests in parallel.
|
|
429
|
-
* @returns A promise that resolves to an array of responses in the same order as the input
|
|
430
|
-
* request options. If the `returnErrors` property is set to `true`, the response objects will
|
|
431
|
-
* have their `error` property set to the thrown error. If `onNetworkError` hooks are configured
|
|
432
|
-
* and suppress an error (return without throwing), the corresponding entry will be `undefined`.
|
|
433
|
-
*/
|
|
434
|
-
runInParallel(options: RunInParallelOptions): Promise<(HttpRequestResponse | undefined)[]>;
|
|
435
|
-
}
|
|
436
|
-
//# sourceMappingURL=polarity-request.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"polarity-request.d.ts","sourceRoot":"","sources":["../../../../lib/requests/polarity-request.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,eAAe,EACf,YAAY,EACZ,iBAAiB,EAElB,MAAM,WAAW,CAAC;AAGnB,OAAO,KAAK,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAGjF;;GAEG;AACH,MAAM,MAAM,yBAAyB,GAAG;IACtC,EAAE,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IACxB,IAAI,CAA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CAAC,CAKnD;gBAEU,OAAO,GAAE,sBAA2B;IAmEhD,OAAO,CAAC,kBAAkB,CACsB;IAEhD;;;;;OAKG;IACU,GAAG,CACd,cAAc,EAAE,kBAAkB,GACjC,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAAC,GAAG,KAAK;IAkGnD;;;;;;;;;OASG;IACH,OAAO,CAAC,cAAc;IAoEtB;;;;;;OAMG;IACH,OAAO,CAAC,qBAAqB;IAO7B;;;;;;;OAOG;IACH,OAAO,CAAC,4BAA4B;IAIpC;;;;;;;;OAQG;IACH,OAAO,CAAC,+BAA+B;IAkBvC;;;;;;;;OAQG;IACH,OAAO,CAAC,2BAA2B;IAiBnC;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACU,aAAa,CACxB,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,CAAC,mBAAmB,GAAG,SAAS,CAAC,EAAE,CAAC;CA8ChD"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { HttpRequestOptions } from './polarity-request';
|
|
2
|
-
/**
|
|
3
|
-
* Sanitizes the request options by removing sensitive information
|
|
4
|
-
* from the provided request options object.
|
|
5
|
-
*
|
|
6
|
-
* Default sanitized paths are:
|
|
7
|
-
*
|
|
8
|
-
* - auth.password
|
|
9
|
-
* - auth.bearer
|
|
10
|
-
* - body.password
|
|
11
|
-
* - form.client_secret
|
|
12
|
-
* - headers.authorization
|
|
13
|
-
* - headers.x-api-key
|
|
14
|
-
*
|
|
15
|
-
* @param requestOptions - request options to sanitize
|
|
16
|
-
* @param additionalPathsToSanitize - array of additional paths to sanitize in addition to the
|
|
17
|
-
* default paths.
|
|
18
|
-
*/
|
|
19
|
-
export declare function sanitizeRequestOptions(requestOptions: HttpRequestOptions, additionalPathsToSanitize?: string[]): HttpRequestOptions;
|
|
20
|
-
//# sourceMappingURL=sanitize-request-options.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sanitize-request-options.d.ts","sourceRoot":"","sources":["../../../../lib/requests/sanitize-request-options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAU7D;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,sBAAsB,CACpC,cAAc,EAAE,kBAAkB,EAClC,yBAAyB,GAAE,MAAM,EAAO,GACvC,kBAAkB,CA0BpB"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { Entity, EntityType } from '@polarityio/integration-types';
|
|
2
|
-
/**
|
|
3
|
-
* Creates a mock `Entity` for use in tests.
|
|
4
|
-
*
|
|
5
|
-
* Automatically detects whether the value is a domain or IPv4 address and sets
|
|
6
|
-
* the corresponding boolean flags. All other flags default to `false`.
|
|
7
|
-
*
|
|
8
|
-
* @param type - An `EntityType` string (e.g., `'IPv4'`, `'domain'`, `'MD5'`)
|
|
9
|
-
* @param value - The entity value string
|
|
10
|
-
* @returns A fully populated `Entity` object
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```typescript
|
|
14
|
-
* const ip = createEntity('IPv4', '8.8.8.8');
|
|
15
|
-
* const domain = createEntity('domain', 'example.com');
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
export declare const createEntity: (type: EntityType, value: string) => Entity;
|
|
19
|
-
//# sourceMappingURL=create-entity.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-entity.d.ts","sourceRoot":"","sources":["../../../../../lib/testing/enhanced-utils/create-entity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAwB,MAAM,+BAA+B,CAAC;AAQ9F;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,YAAY,GAAI,MAAM,UAAU,EAAE,OAAO,MAAM,KAAG,MAsC9D,CAAC"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import type { IntegrationContext } from '@polarityio/integration-types';
|
|
2
|
-
/**
|
|
3
|
-
* Factory function that creates mock functions. Pass `vi.fn` (Vitest)
|
|
4
|
-
* or `jest.fn` (Jest) to get spy capabilities. When omitted, plain
|
|
5
|
-
* no-op functions are used.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```typescript
|
|
9
|
-
* // Vitest — enables toHaveBeenCalledWith() assertions
|
|
10
|
-
* const ctx = createMockIntegrationContext(vi.fn);
|
|
11
|
-
*
|
|
12
|
-
* // Jest
|
|
13
|
-
* const ctx = createMockIntegrationContext(jest.fn);
|
|
14
|
-
*
|
|
15
|
-
* // No framework — plain no-ops
|
|
16
|
-
* const ctx = createMockIntegrationContext();
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
19
|
-
export type MockFnFactory = () => (...args: any[]) => any;
|
|
20
|
-
/**
|
|
21
|
-
* Creates a mock `IntegrationContext`
|
|
22
|
-
* with stubbed logger, cache, and polling methods.
|
|
23
|
-
*
|
|
24
|
-
* Pass your testing framework's mock function factory to enable spy capabilities
|
|
25
|
-
* (e.g., `toHaveBeenCalledWith()`). When omitted, plain no-op stubs are used.
|
|
26
|
-
*
|
|
27
|
-
* @param createMockFn - A factory that creates mock functions (e.g., `vi.fn` or `jest.fn`)
|
|
28
|
-
* @returns A fully populated `IntegrationContext` with stubbed methods
|
|
29
|
-
*
|
|
30
|
-
* @example
|
|
31
|
-
* ```typescript
|
|
32
|
-
* // Vitest
|
|
33
|
-
* const ctx = createMockIntegrationContext(vi.fn);
|
|
34
|
-
*
|
|
35
|
-
* // Jest
|
|
36
|
-
* const ctx = createMockIntegrationContext(jest.fn);
|
|
37
|
-
*
|
|
38
|
-
* // No framework — plain no-ops
|
|
39
|
-
* const ctx = createMockIntegrationContext();
|
|
40
|
-
* ```
|
|
41
|
-
*/
|
|
42
|
-
export declare const createMockIntegrationContext: (createMockFn?: MockFnFactory) => IntegrationContext;
|
|
43
|
-
//# sourceMappingURL=create-mock-integration-context.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-mock-integration-context.d.ts","sourceRoot":"","sources":["../../../../../lib/testing/enhanced-utils/create-mock-integration-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAExE;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC;AAI1D;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,4BAA4B,GACvC,eAAc,aAAoB,KACjC,kBAqCF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../lib/testing/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,kDAAkD,CAAC"}
|
package/dist/dts/lib/types.d.ts
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Integration config.json type
|
|
3
|
-
* @public
|
|
4
|
-
*/
|
|
5
|
-
export interface IntegrationConfig {
|
|
6
|
-
polarityIntegrationUuid: string;
|
|
7
|
-
name: string;
|
|
8
|
-
acronym: string;
|
|
9
|
-
description?: string;
|
|
10
|
-
defaultColor?: string;
|
|
11
|
-
entityTypes?: string[];
|
|
12
|
-
dataTypes?: (string | CustomType)[];
|
|
13
|
-
customTypes?: CustomType[];
|
|
14
|
-
supportsAdditionalCustomTypes?: boolean;
|
|
15
|
-
styles?: string[];
|
|
16
|
-
block: ViewComponent;
|
|
17
|
-
summary?: ViewComponent;
|
|
18
|
-
onDemandOnly?: boolean;
|
|
19
|
-
copyOnDemand?: boolean;
|
|
20
|
-
logging?: {
|
|
21
|
-
level: 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal';
|
|
22
|
-
};
|
|
23
|
-
request?: {
|
|
24
|
-
cert?: string;
|
|
25
|
-
key?: string;
|
|
26
|
-
passphrase?: string;
|
|
27
|
-
ca?: string;
|
|
28
|
-
proxy?: string;
|
|
29
|
-
rejectUnauthorized?: boolean;
|
|
30
|
-
};
|
|
31
|
-
options?: IntegrationOption[];
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Custom entity type definition for config.json
|
|
35
|
-
* @public
|
|
36
|
-
*/
|
|
37
|
-
export interface CustomType {
|
|
38
|
-
type?: 'custom';
|
|
39
|
-
name?: string;
|
|
40
|
-
description?: string;
|
|
41
|
-
key: string;
|
|
42
|
-
regex: string;
|
|
43
|
-
editable?: boolean;
|
|
44
|
-
enabled?: boolean;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* View component reference in config.json
|
|
48
|
-
* @public
|
|
49
|
-
*/
|
|
50
|
-
export interface ViewComponent {
|
|
51
|
-
component: {
|
|
52
|
-
file: string;
|
|
53
|
-
};
|
|
54
|
-
template: {
|
|
55
|
-
file: string;
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* A select option item with display label and value
|
|
60
|
-
* @public
|
|
61
|
-
*/
|
|
62
|
-
export interface SelectOptionItem {
|
|
63
|
-
value: string;
|
|
64
|
-
display: string;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Integration option definition for config.json
|
|
68
|
-
* @public
|
|
69
|
-
*/
|
|
70
|
-
export type IntegrationOption = {
|
|
71
|
-
type: 'text' | 'password';
|
|
72
|
-
key: string;
|
|
73
|
-
name: string;
|
|
74
|
-
description?: string;
|
|
75
|
-
default: string | null;
|
|
76
|
-
userCanEdit?: boolean;
|
|
77
|
-
adminOnly?: boolean;
|
|
78
|
-
} | {
|
|
79
|
-
type: 'boolean';
|
|
80
|
-
key: string;
|
|
81
|
-
name: string;
|
|
82
|
-
description?: string;
|
|
83
|
-
default: boolean | null;
|
|
84
|
-
userCanEdit?: boolean;
|
|
85
|
-
adminOnly?: boolean;
|
|
86
|
-
} | {
|
|
87
|
-
type: 'number';
|
|
88
|
-
key: string;
|
|
89
|
-
name: string;
|
|
90
|
-
description?: string;
|
|
91
|
-
default: number | null;
|
|
92
|
-
userCanEdit?: boolean;
|
|
93
|
-
adminOnly?: boolean;
|
|
94
|
-
} | {
|
|
95
|
-
type: 'select';
|
|
96
|
-
key: string;
|
|
97
|
-
name: string;
|
|
98
|
-
description?: string;
|
|
99
|
-
default: SelectOptionItem | SelectOptionItem[] | string | null;
|
|
100
|
-
options: SelectOptionItem[];
|
|
101
|
-
multiple?: boolean;
|
|
102
|
-
userCanEdit: boolean;
|
|
103
|
-
adminOnly: boolean;
|
|
104
|
-
};
|
|
105
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../lib/types.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,uBAAuB,EAAE,MAAM,CAAC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,SAAS,CAAC,EAAE,CAAC,MAAM,GAAG,UAAU,CAAC,EAAE,CAAC;IACpC,WAAW,CAAC,EAAE,UAAU,EAAE,CAAC;IAC3B,6BAA6B,CAAC,EAAE,OAAO,CAAC;IACxC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,KAAK,EAAE,aAAa,CAAC;IACrB,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,OAAO,CAAC,EAAE;QACR,KAAK,EAAE,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;KAChE,CAAC;IACF,OAAO,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M,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,GACD;IACE,IAAI,EAAE,QAAQ,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,GACD;IACE,IAAI,EAAE,QAAQ,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,gBAAgB,GAAG,gBAAgB,EAAE,GAAG,MAAM,GAAG,IAAI,CAAC;IAC/D,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAC5B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|