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
package/README.md
CHANGED
|
@@ -2,8 +2,36 @@
|
|
|
2
2
|
|
|
3
3
|
This library is intended for use in development of Polarity Integrations.
|
|
4
4
|
|
|
5
|
+
## Documentation
|
|
5
6
|
|
|
7
|
+
Documentation for this library can be found at: https://polarityio.github.io/polarity-integration-utils/
|
|
6
8
|
|
|
7
|
-
##
|
|
9
|
+
## Building the Library
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
### Prerequisites
|
|
12
|
+
| Tool | Version | Notes |
|
|
13
|
+
| ---- | ------- | ----- |
|
|
14
|
+
| Node | 18.x | `nvm install 18 && nvm use 18` recommended |
|
|
15
|
+
| npm | 9.x | Ships with Node 18 |
|
|
16
|
+
|
|
17
|
+
### Install Dependencies
|
|
18
|
+
npm ci
|
|
19
|
+
|
|
20
|
+
### Build
|
|
21
|
+
npm run build
|
|
22
|
+
|
|
23
|
+
### Run Tests
|
|
24
|
+
npm test
|
|
25
|
+
|
|
26
|
+
### Linting / Formatting
|
|
27
|
+
npm run lint
|
|
28
|
+
npm run lint:fix
|
|
29
|
+
npm run format
|
|
30
|
+
npm run format:check
|
|
31
|
+
|
|
32
|
+
### Docs
|
|
33
|
+
npm run docs
|
|
34
|
+
|
|
35
|
+
### Continuous Integration
|
|
36
|
+
All pull-requests run the same **build → lint → test** pipeline in GitHub Actions.
|
|
37
|
+
Ensure local runs are green before opening a PR.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IntegrationError, type IntegrationErrorProperties } from './integration-error';
|
|
2
|
+
/**
|
|
3
|
+
* API error for REST requests
|
|
4
|
+
*
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export declare class ApiRequestError extends IntegrationError {
|
|
8
|
+
constructor(message: string, properties?: IntegrationErrorProperties);
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=api-request-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-request-error.d.ts","sourceRoot":"","sources":["../../../lib/errors/api-request-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,KAAK,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AAExF;;;;GAIG;AACH,qBAAa,eAAgB,SAAQ,gBAAgB;gBACvC,OAAO,EAAE,MAAM,EAAE,UAAU,GAAE,0BAA+B;CAGzE"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IntegrationError, type IntegrationErrorProperties } from './integration-error';
|
|
2
|
+
/**
|
|
3
|
+
* Thrown by generateAccessToken method if there is a failure to fetch a token
|
|
4
|
+
*
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export declare class AuthRequestError extends IntegrationError {
|
|
8
|
+
constructor(message: string, properties?: IntegrationErrorProperties);
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=auth-request-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-request-error.d.ts","sourceRoot":"","sources":["../../../lib/errors/auth-request-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,KAAK,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AAExF;;;;GAIG;AACH,qBAAa,gBAAiB,SAAQ,gBAAgB;gBACxC,OAAO,EAAE,MAAM,EAAE,UAAU,GAAE,0BAA+B;CAGzE"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './parse-error-to-readable-json';
|
|
2
|
+
export * from './integration-error';
|
|
3
|
+
export * from './api-request-error';
|
|
4
|
+
export * from './auth-request-error';
|
|
5
|
+
export * from './network-error';
|
|
6
|
+
export * from './retry-request-error';
|
|
7
|
+
export * from './library-usage-error';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/errors/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import type { HttpRequestOptions } from '../requests/polarity-request';
|
|
2
|
+
/**
|
|
3
|
+
* @public
|
|
4
|
+
*/
|
|
5
|
+
export interface Error {
|
|
6
|
+
name: string;
|
|
7
|
+
message: string;
|
|
8
|
+
stack?: string;
|
|
9
|
+
code?: number | string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
export type ErrorMeta = {
|
|
15
|
+
[otherMetadata: string]: unknown;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
20
|
+
export type MetaObject = {
|
|
21
|
+
[key: string]: unknown;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
26
|
+
export interface IntegrationErrorProperties {
|
|
27
|
+
/**
|
|
28
|
+
* a short, human-readable summary of the problem that SHOULD NOT change from occurrence to occurrence of
|
|
29
|
+
* the problem except for purposes of localization. If omitted, the title will default to the type
|
|
30
|
+
* of error (e.g., IntegrationError, or ApiRequestError)
|
|
31
|
+
*/
|
|
32
|
+
title?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Additional details related to the error that may help the user troubleshoot the issue. If set by the user
|
|
35
|
+
* via the Error constructor, the user provided value will override any automated help message set by the
|
|
36
|
+
* Error class.
|
|
37
|
+
*/
|
|
38
|
+
help?: string;
|
|
39
|
+
/**
|
|
40
|
+
* The `cause` property is used to specify the `cause` of the error. Typically,
|
|
41
|
+
* this property is used to pass through a related Error instance.
|
|
42
|
+
*/
|
|
43
|
+
cause?: Error;
|
|
44
|
+
/**
|
|
45
|
+
* The HTTP status code applicable to this error, expressed as a string value.
|
|
46
|
+
*/
|
|
47
|
+
status?: string;
|
|
48
|
+
/**
|
|
49
|
+
* an application-specific error code, expressed as a string value.
|
|
50
|
+
*/
|
|
51
|
+
code?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Relevant for integration errors involving a network call, the `requestOptions` property
|
|
54
|
+
* details the request options that resulted in the specified error. The `requestOptions` property will automatically
|
|
55
|
+
* have sensitive authentication headers stripped.
|
|
56
|
+
* By default, the following paths are sanitized:
|
|
57
|
+
*
|
|
58
|
+
* - auth.password
|
|
59
|
+
* - auth.bearer
|
|
60
|
+
* - body.password
|
|
61
|
+
* - form.client_secret
|
|
62
|
+
* - headers.authorization
|
|
63
|
+
* - headers.x-api-key
|
|
64
|
+
*
|
|
65
|
+
* Additional paths can be sanitized by using the `requestOptionsToSanitize` property.
|
|
66
|
+
*/
|
|
67
|
+
requestOptions?: HttpRequestOptions;
|
|
68
|
+
/**
|
|
69
|
+
* List of paths in JSON dot notation to sanitize in the requestOptions object
|
|
70
|
+
*/
|
|
71
|
+
requestOptionsToSanitize?: string[];
|
|
72
|
+
/**
|
|
73
|
+
* Any additional properties which will be appended to the Error's meta property
|
|
74
|
+
*/
|
|
75
|
+
meta?: MetaObject;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* @public
|
|
79
|
+
*/
|
|
80
|
+
export interface SerializedIntegrationError {
|
|
81
|
+
/**
|
|
82
|
+
* a short, human-readable summary of the problem that SHOULD NOT change from occurrence to occurrence of
|
|
83
|
+
* the problem except for purposes of localization. If omitted, the title will default to the type
|
|
84
|
+
* of error (e.g., IntegrationError, or ApiRequestError)
|
|
85
|
+
*/
|
|
86
|
+
title: string;
|
|
87
|
+
/**
|
|
88
|
+
* The name data property of IntegrationError.prototype is shared by all Error instances.
|
|
89
|
+
* It represents the name for the type of error. For IntegrationError.prototype.name,
|
|
90
|
+
* the initial value is "IntegrationError".
|
|
91
|
+
*/
|
|
92
|
+
name: string;
|
|
93
|
+
/**
|
|
94
|
+
* a human-readable explanation specific to this occurrence of the problem. Like title, this field’s value can be
|
|
95
|
+
* localized
|
|
96
|
+
*/
|
|
97
|
+
detail: string;
|
|
98
|
+
/**
|
|
99
|
+
* An optional HTTP status code applicable to this error, expressed as a string value.
|
|
100
|
+
*/
|
|
101
|
+
status?: string;
|
|
102
|
+
/**
|
|
103
|
+
* Additional details related to the error that may help the user troubleshoot the issue. If set by the user
|
|
104
|
+
* via the Error constructor, the user provided value will override any automated help message set by the
|
|
105
|
+
* Error class.
|
|
106
|
+
*/
|
|
107
|
+
help?: string;
|
|
108
|
+
/**
|
|
109
|
+
* An optional StackTrace of the error
|
|
110
|
+
*/
|
|
111
|
+
stack?: string;
|
|
112
|
+
/**
|
|
113
|
+
* An optional application-specific error code, expressed as a string value.
|
|
114
|
+
*/
|
|
115
|
+
code?: number | string;
|
|
116
|
+
/**
|
|
117
|
+
* The `cause` property is used to specify the `cause` of the error. Typically,
|
|
118
|
+
* this property is used to pass through a related Error instance.
|
|
119
|
+
*/
|
|
120
|
+
cause?: Error;
|
|
121
|
+
/**
|
|
122
|
+
* Relevant for integration errors involving a network call, the `requestOptions` property
|
|
123
|
+
* details the request options that resulted in the specified error. The `requestOptions` property will automatically
|
|
124
|
+
* have sensitive authentication headers stripped.
|
|
125
|
+
*/
|
|
126
|
+
requestOptions?: HttpRequestOptions;
|
|
127
|
+
/**
|
|
128
|
+
* an optional meta object containing non-standard meta-information about the error.
|
|
129
|
+
*/
|
|
130
|
+
meta?: ErrorMeta;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* @public
|
|
134
|
+
*/
|
|
135
|
+
export declare class IntegrationError extends Error {
|
|
136
|
+
/**
|
|
137
|
+
* a short, human-readable summary of the problem that SHOULD NOT change from occurrence to occurrence of
|
|
138
|
+
* the problem except for purposes of localization.
|
|
139
|
+
*/
|
|
140
|
+
readonly title: string;
|
|
141
|
+
/**
|
|
142
|
+
* a human-readable explanation specific to this occurrence of the problem. Like title, this field’s value can be
|
|
143
|
+
* localized
|
|
144
|
+
*/
|
|
145
|
+
readonly detail: string;
|
|
146
|
+
/**
|
|
147
|
+
* a meta object containing non-standard meta-information about the error.
|
|
148
|
+
*/
|
|
149
|
+
readonly meta: ErrorMeta;
|
|
150
|
+
/**
|
|
151
|
+
* The HTTP status code applicable to this error, expressed as a string value.
|
|
152
|
+
*/
|
|
153
|
+
readonly status: string;
|
|
154
|
+
/**
|
|
155
|
+
* an application-specific error code, expressed as a string value.
|
|
156
|
+
*/
|
|
157
|
+
readonly code: string;
|
|
158
|
+
/**
|
|
159
|
+
* The `cause` property is used to specify the `cause` of the error. Typically,
|
|
160
|
+
* this property is used to pass through a related Error instance.
|
|
161
|
+
*/
|
|
162
|
+
readonly cause: Error;
|
|
163
|
+
/**
|
|
164
|
+
* Additional details related to the error that may help the user troubleshoot the issue. If set by the user
|
|
165
|
+
* via the Error constructor, the user provided value will override any automated help message set by the
|
|
166
|
+
* Error class.
|
|
167
|
+
*/
|
|
168
|
+
readonly help: string;
|
|
169
|
+
/**
|
|
170
|
+
* Relevant for integration errors involving a network call, the `requestOptions` property
|
|
171
|
+
* details the request options that resulted in the specified error. The `requestOptions` property will automatically
|
|
172
|
+
* have sensitive authentication headers stripped.
|
|
173
|
+
*/
|
|
174
|
+
readonly requestOptions?: HttpRequestOptions;
|
|
175
|
+
/**
|
|
176
|
+
* Construct a new IntegrationError object.
|
|
177
|
+
* @param message - A string description of the error which is used as the `detail` property on the
|
|
178
|
+
* serialized error.
|
|
179
|
+
* @param properties - Optional properties for the error.
|
|
180
|
+
*/
|
|
181
|
+
constructor(message: string, properties?: IntegrationErrorProperties);
|
|
182
|
+
/**
|
|
183
|
+
* Serializes the error's properties into a POJO. The order of the
|
|
184
|
+
* properties is preserved when serialized.
|
|
185
|
+
* @returns JSON representation of the error
|
|
186
|
+
*/
|
|
187
|
+
toJSON(): SerializedIntegrationError;
|
|
188
|
+
}
|
|
189
|
+
//# sourceMappingURL=integration-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integration-error.d.ts","sourceRoot":"","sources":["../../../lib/errors/integration-error.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAGvE;;GAEG;AACH,MAAM,WAAW,KAAK;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG;IACtB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC;CAClC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG;IAEvB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;IACd;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;;;;;;;;;;OAcG;IACH,cAAc,CAAC,EAAE,kBAAkB,CAAC;IACpC;;OAEG;IACH,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAC;IACpC;;OAEG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB;;;OAGG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;IACd;;;;OAIG;IACH,cAAc,CAAC,EAAE,kBAAkB,CAAC;IACpC;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;AAED;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,KAAK;IACzC;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAEvB;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAEzB;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,kBAAkB,CAAC;IAE7C;;;;;OAKG;gBACS,OAAO,EAAE,MAAM,EAAE,UAAU,GAAE,0BAA+B;IAqCxE;;;;OAIG;IACH,MAAM;CAqCP"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IntegrationError, type IntegrationErrorProperties } from './integration-error';
|
|
2
|
+
/**
|
|
3
|
+
* Thrown when the polarity-integration-utils library is used incorrectly. For example,
|
|
4
|
+
* if a method is called with incorrect or missing parameters, or a required initialization
|
|
5
|
+
* method is not called. This Error class should not be used directly by integrations.
|
|
6
|
+
*
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export declare class LibraryUsageError extends IntegrationError {
|
|
10
|
+
constructor(message: string, properties?: IntegrationErrorProperties);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=library-usage-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"library-usage-error.d.ts","sourceRoot":"","sources":["../../../lib/errors/library-usage-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,KAAK,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AAExF;;;;;;GAMG;AACH,qBAAa,iBAAkB,SAAQ,gBAAgB;gBACzC,OAAO,EAAE,MAAM,EAAE,UAAU,GAAE,0BAA+B;CAGzE"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IntegrationError, type IntegrationErrorProperties } from './integration-error';
|
|
2
|
+
/**
|
|
3
|
+
* Generic network error for REST requests.
|
|
4
|
+
* https://betterstack.com/community/guides/scaling-nodejs/nodejs-errors/#4-econnrefused
|
|
5
|
+
*
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export declare class NetworkError extends IntegrationError {
|
|
9
|
+
constructor(message: string, properties?: IntegrationErrorProperties);
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=network-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"network-error.d.ts","sourceRoot":"","sources":["../../../lib/errors/network-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,KAAK,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AA+CxF;;;;;GAKG;AACH,qBAAa,YAAa,SAAQ,gBAAgB;gBACpC,OAAO,EAAE,MAAM,EAAE,UAAU,GAAE,0BAA+B;CAgCzE"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Error } from './integration-error';
|
|
2
|
+
/**
|
|
3
|
+
* @public
|
|
4
|
+
* @param error - Error instance to parse into a plain old javascript object
|
|
5
|
+
*/
|
|
6
|
+
export declare const parseErrorToReadableJson: (error: Error) => any;
|
|
7
|
+
//# sourceMappingURL=parse-error-to-readable-json.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-error-to-readable-json.d.ts","sourceRoot":"","sources":["../../../lib/errors/parse-error-to-readable-json.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAEjD;;;GAGG;AACH,eAAO,MAAM,wBAAwB,GAAI,OAAO,KAAK,QACiB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IntegrationError, type IntegrationErrorProperties } from './integration-error';
|
|
2
|
+
/**
|
|
3
|
+
* Thrown by authenticated request method for any HTTP status codes where we want to allow
|
|
4
|
+
* the user to retry their lookup.
|
|
5
|
+
*
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export declare class RetryRequestError extends IntegrationError {
|
|
9
|
+
constructor(message: string, properties?: IntegrationErrorProperties);
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=retry-request-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retry-request-error.d.ts","sourceRoot":"","sources":["../../../lib/errors/retry-request-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,KAAK,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AAExF;;;;;GAKG;AACH,qBAAa,iBAAkB,SAAQ,gBAAgB;gBACzC,OAAO,EAAE,MAAM,EAAE,UAAU,GAAE,0BAA+B;CAGzE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AAErC,OAAO,EACL,MAAM,EACN,QAAQ,EACR,OAAO,EACR,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API Docs index. This is used by api-extractor given our package.json exports.
|
|
3
|
+
* Monitoring: https://github.com/microsoft/rushstack/issues/3557
|
|
4
|
+
*/
|
|
5
|
+
export * from './errors';
|
|
6
|
+
export * from './requests';
|
|
7
|
+
export * from './logging';
|
|
8
|
+
export * from './types';
|
|
9
|
+
//# sourceMappingURL=index.docs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.docs.d.ts","sourceRoot":"","sources":["../../lib/index.docs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Execute an array of async tasks while ensuring that no more than `limit`
|
|
3
|
+
* tasks are running at the same time. Results preserve task order.
|
|
4
|
+
*
|
|
5
|
+
* @param tasks - Array of thunked async tasks (`() => Promise<T>`).
|
|
6
|
+
* @param limit - Maximum number of concurrent tasks (positive integer).
|
|
7
|
+
*/
|
|
8
|
+
export declare function parallelLimit<T>(tasks: Array<() => Promise<T>>, limit: number): Promise<T[]>;
|
|
9
|
+
//# sourceMappingURL=parallel-limit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parallel-limit.d.ts","sourceRoot":"","sources":["../../../../lib/internal/helpers/parallel-limit.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,wBAAsB,aAAa,CAAC,CAAC,EACnC,KAAK,EAAE,KAAK,CAAC,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC,EAC9B,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,CAAC,EAAE,CAAC,CAgCd"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sanitizes the specified paths in an object by setting their values to a mask.
|
|
3
|
+
* This function returns a **new** object (deep clone) and does **not** mutate the original.
|
|
4
|
+
*
|
|
5
|
+
* @param obj - An object to sanitize (or nullish, which is returned directly).
|
|
6
|
+
* @param paths - An array of dot/bracket-notation paths to mask.
|
|
7
|
+
* @param mask - A replacement string. Defaults to "******".
|
|
8
|
+
* @returns A new object that has specified paths overwritten by `mask`.
|
|
9
|
+
*/
|
|
10
|
+
export declare function sanitizeObject<T extends object>(obj: T | null | undefined, paths?: string[], mask?: string): T | null | undefined;
|
|
11
|
+
//# sourceMappingURL=sanitize-object.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sanitize-object.d.ts","sourceRoot":"","sources":["../../../../lib/internal/helpers/sanitize-object.ts"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,EAC7C,GAAG,EAAE,CAAC,GAAG,IAAI,GAAG,SAAS,EACzB,KAAK,GAAE,MAAM,EAAO,EACpB,IAAI,GAAE,MAAiB,GACtB,CAAC,GAAG,IAAI,GAAG,SAAS,CAsBtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/logging/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @public
|
|
3
|
+
*/
|
|
4
|
+
export type Logger = {
|
|
5
|
+
child?(arg: unknown): Logger;
|
|
6
|
+
info(...args: unknown[]): void;
|
|
7
|
+
debug(...args: unknown[]): void;
|
|
8
|
+
trace(...args: unknown[]): void;
|
|
9
|
+
warn(...args: unknown[]): void;
|
|
10
|
+
error(...args: unknown[]): void;
|
|
11
|
+
fatal(...args: unknown[]): void;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Set the logger object used by the integration.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* Example of setting the logger within the integration's startup method:
|
|
18
|
+
* ```js
|
|
19
|
+
* const { setLogger } = require('polarity-integration-utils/logger');
|
|
20
|
+
*
|
|
21
|
+
* function startup(logger){
|
|
22
|
+
* setLogger(logger);
|
|
23
|
+
* }
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* You can now use {@link getLogger} to get the logger object anywhere within your integration codebase.
|
|
27
|
+
*
|
|
28
|
+
* @public
|
|
29
|
+
* @param logger - the integration logger object passed into the `startup` method
|
|
30
|
+
*/
|
|
31
|
+
declare const setLogger: (logger: Logger) => void;
|
|
32
|
+
/**
|
|
33
|
+
* return the logger object set via the {@link setLogger} method.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* Example of using the integration's logging object:
|
|
37
|
+
* ```js
|
|
38
|
+
* const { getLogger } = require('polarity-integration-utils/logger');
|
|
39
|
+
*
|
|
40
|
+
* const logger = getLogger();
|
|
41
|
+
* logger.trace('this is a trace message');
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* @public
|
|
45
|
+
* @returns the integration's logger object
|
|
46
|
+
*/
|
|
47
|
+
declare const getLogger: () => Logger;
|
|
48
|
+
export { setLogger, getLogger };
|
|
49
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../lib/logging/logger.ts"],"names":[],"mappings":"AAsBA;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG;IACnB,KAAK,CAAC,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAAC;IAC7B,IAAI,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAC/B,KAAK,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAChC,KAAK,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAChC,IAAI,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAC/B,KAAK,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAChC,KAAK,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;CACjC,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,QAAA,MAAM,SAAS,GAAI,QAAQ,MAAM,SAEhC,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,QAAA,MAAM,SAAS,cAAgB,CAAC;AAEhC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/requests/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,4BAA4B,CAAC"}
|