polarity-integration-utils 3.1.8 → 4.0.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/errors/integration-error.d.ts +11 -11
- package/dist/dts/errors/integration-error.d.ts.map +1 -1
- package/dist/dts/errors/parse-error-to-readable-json.d.ts +2 -2
- package/dist/dts/errors/parse-error-to-readable-json.d.ts.map +1 -1
- package/dist/dts/index.d.ts +1 -3
- package/dist/dts/index.d.ts.map +1 -1
- package/dist/dts/index.docs.d.ts +1 -1
- package/dist/dts/lib/errors/integration-error.d.ts +11 -11
- package/dist/dts/lib/errors/integration-error.d.ts.map +1 -1
- package/dist/dts/lib/errors/parse-error-to-readable-json.d.ts +2 -2
- package/dist/dts/lib/errors/parse-error-to-readable-json.d.ts.map +1 -1
- package/dist/dts/lib/index.d.ts +1 -3
- package/dist/dts/lib/index.d.ts.map +1 -1
- package/dist/dts/lib/index.docs.d.ts +1 -1
- package/dist/dts/lib/logging/logger.d.ts +1 -12
- package/dist/dts/lib/logging/logger.d.ts.map +1 -1
- package/dist/dts/lib/requests/polarity-request.d.ts +93 -68
- package/dist/dts/lib/requests/polarity-request.d.ts.map +1 -1
- package/dist/dts/lib/testing/enhanced-utils/create-entity.d.ts +17 -1
- package/dist/dts/lib/testing/enhanced-utils/create-entity.d.ts.map +1 -1
- package/dist/dts/lib/testing/enhanced-utils/create-mock-integration-context.d.ts +42 -2
- package/dist/dts/lib/testing/enhanced-utils/create-mock-integration-context.d.ts.map +1 -1
- package/dist/dts/lib/testing/index.d.ts +0 -3
- package/dist/dts/lib/testing/index.d.ts.map +1 -1
- package/dist/dts/lib/types.d.ts +89 -84
- package/dist/dts/lib/types.d.ts.map +1 -1
- package/dist/dts/logging/logger.d.ts +1 -12
- package/dist/dts/logging/logger.d.ts.map +1 -1
- package/dist/dts/requests/polarity-request.d.ts +93 -68
- package/dist/dts/requests/polarity-request.d.ts.map +1 -1
- package/dist/dts/testing/enhanced-utils/create-entity.d.ts +17 -1
- 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 +42 -2
- package/dist/dts/testing/enhanced-utils/create-mock-integration-context.d.ts.map +1 -1
- package/dist/dts/testing/index.d.ts +0 -3
- package/dist/dts/testing/index.d.ts.map +1 -1
- package/dist/dts/tsdoc-metadata.json +1 -1
- package/dist/dts/types.d.ts +89 -84
- package/dist/dts/types.d.ts.map +1 -1
- package/dist/es/lib/errors/integration-error.js +7 -4
- package/dist/es/lib/index.docs.js +1 -1
- package/dist/es/lib/index.js +1 -5
- package/dist/es/lib/logging/logger.js +18 -7
- package/dist/es/lib/requests/polarity-request.js +103 -126
- package/dist/es/lib/testing/enhanced-utils/create-entity.js +31 -5
- package/dist/es/lib/testing/enhanced-utils/create-mock-integration-context.js +54 -27
- package/dist/es/lib/testing/index.js +0 -3
- package/dist/es/lib/types.js +2 -1
- package/dist/lib/errors/integration-error.js +7 -4
- package/dist/lib/index.docs.js +1 -1
- package/dist/lib/index.js +1 -5
- package/dist/lib/logging/logger.js +18 -7
- package/dist/lib/requests/polarity-request.js +103 -126
- package/dist/lib/testing/enhanced-utils/create-entity.js +31 -5
- package/dist/lib/testing/enhanced-utils/create-mock-integration-context.js +54 -27
- package/dist/lib/testing/index.js +0 -3
- package/dist/lib/types.js +2 -1
- package/dist/polarity-integration-utils.d.ts +264 -594
- package/package.json +6 -9
- package/dist/dts/context/cache.d.ts +0 -149
- package/dist/dts/context/cache.d.ts.map +0 -1
- package/dist/dts/context/index.d.ts +0 -3
- package/dist/dts/context/index.d.ts.map +0 -1
- package/dist/dts/context/integration-context.d.ts +0 -16
- package/dist/dts/context/integration-context.d.ts.map +0 -1
- package/dist/dts/lib/context/cache.d.ts +0 -149
- package/dist/dts/lib/context/cache.d.ts.map +0 -1
- package/dist/dts/lib/context/index.d.ts +0 -3
- package/dist/dts/lib/context/index.d.ts.map +0 -1
- package/dist/dts/lib/context/integration-context.d.ts +0 -16
- package/dist/dts/lib/context/integration-context.d.ts.map +0 -1
- package/dist/dts/lib/testing/enhanced-utils/mock-request.d.ts +0 -14
- package/dist/dts/lib/testing/enhanced-utils/mock-request.d.ts.map +0 -1
- package/dist/dts/lib/testing/enhanced-utils/validate-integration.d.ts +0 -8
- package/dist/dts/lib/testing/enhanced-utils/validate-integration.d.ts.map +0 -1
- package/dist/dts/lib/testing/test-factory/create-integration-tests.d.ts +0 -6
- package/dist/dts/lib/testing/test-factory/create-integration-tests.d.ts.map +0 -1
- package/dist/dts/lib/testing/test-factory/test-do-lookup.d.ts +0 -7
- package/dist/dts/lib/testing/test-factory/test-do-lookup.d.ts.map +0 -1
- package/dist/dts/lib/testing/test-factory/test-on-message.d.ts +0 -8
- package/dist/dts/lib/testing/test-factory/test-on-message.d.ts.map +0 -1
- package/dist/dts/lib/zod-types.d.ts +0 -278
- package/dist/dts/lib/zod-types.d.ts.map +0 -1
- package/dist/dts/testing/enhanced-utils/mock-request.d.ts +0 -14
- package/dist/dts/testing/enhanced-utils/mock-request.d.ts.map +0 -1
- package/dist/dts/testing/enhanced-utils/validate-integration.d.ts +0 -8
- package/dist/dts/testing/enhanced-utils/validate-integration.d.ts.map +0 -1
- package/dist/dts/testing/test-factory/create-integration-tests.d.ts +0 -6
- package/dist/dts/testing/test-factory/create-integration-tests.d.ts.map +0 -1
- package/dist/dts/testing/test-factory/test-do-lookup.d.ts +0 -7
- package/dist/dts/testing/test-factory/test-do-lookup.d.ts.map +0 -1
- package/dist/dts/testing/test-factory/test-on-message.d.ts +0 -8
- package/dist/dts/testing/test-factory/test-on-message.d.ts.map +0 -1
- package/dist/dts/zod-types.d.ts +0 -278
- package/dist/dts/zod-types.d.ts.map +0 -1
- package/dist/es/lib/context/cache.js +0 -2
- package/dist/es/lib/context/index.js +0 -18
- package/dist/es/lib/context/integration-context.js +0 -2
- package/dist/es/lib/testing/enhanced-utils/mock-request.js +0 -22
- package/dist/es/lib/testing/enhanced-utils/validate-integration.js +0 -159
- package/dist/es/lib/testing/test-factory/create-integration-tests.js +0 -53
- package/dist/es/lib/testing/test-factory/test-do-lookup.js +0 -24
- package/dist/es/lib/testing/test-factory/test-on-message.js +0 -24
- package/dist/es/lib/zod-types.js +0 -206
- package/dist/lib/context/cache.js +0 -2
- package/dist/lib/context/index.js +0 -18
- package/dist/lib/context/integration-context.js +0 -2
- package/dist/lib/testing/enhanced-utils/mock-request.js +0 -22
- package/dist/lib/testing/enhanced-utils/validate-integration.js +0 -159
- package/dist/lib/testing/test-factory/create-integration-tests.js +0 -53
- package/dist/lib/testing/test-factory/test-do-lookup.js +0 -24
- package/dist/lib/testing/test-factory/test-on-message.js +0 -24
- package/dist/lib/zod-types.js +0 -206
|
@@ -2,7 +2,7 @@ import type { HttpRequestOptions } from '../requests/polarity-request';
|
|
|
2
2
|
/**
|
|
3
3
|
* @public
|
|
4
4
|
*/
|
|
5
|
-
export interface
|
|
5
|
+
export interface ResponseError {
|
|
6
6
|
name: string;
|
|
7
7
|
message: string;
|
|
8
8
|
stack?: string;
|
|
@@ -38,9 +38,9 @@ export interface IntegrationErrorProperties {
|
|
|
38
38
|
help?: string;
|
|
39
39
|
/**
|
|
40
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.
|
|
41
|
+
* this property is used to pass through a related Error instance but can be any value.
|
|
42
42
|
*/
|
|
43
|
-
cause?:
|
|
43
|
+
cause?: unknown;
|
|
44
44
|
/**
|
|
45
45
|
* The HTTP status code applicable to this error, expressed as a string value.
|
|
46
46
|
*/
|
|
@@ -115,9 +115,9 @@ export interface SerializedIntegrationError {
|
|
|
115
115
|
code?: number | string;
|
|
116
116
|
/**
|
|
117
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.
|
|
118
|
+
* this property is used to pass through a related Error instance but can be any value.
|
|
119
119
|
*/
|
|
120
|
-
cause?:
|
|
120
|
+
cause?: unknown;
|
|
121
121
|
/**
|
|
122
122
|
* Relevant for integration errors involving a network call, the `requestOptions` property
|
|
123
123
|
* details the request options that resulted in the specified error. The `requestOptions` property will automatically
|
|
@@ -146,26 +146,26 @@ export declare class IntegrationError extends Error {
|
|
|
146
146
|
/**
|
|
147
147
|
* a meta object containing non-standard meta-information about the error.
|
|
148
148
|
*/
|
|
149
|
-
readonly meta
|
|
149
|
+
readonly meta?: ErrorMeta;
|
|
150
150
|
/**
|
|
151
151
|
* The HTTP status code applicable to this error, expressed as a string value.
|
|
152
152
|
*/
|
|
153
|
-
readonly status
|
|
153
|
+
readonly status?: string;
|
|
154
154
|
/**
|
|
155
155
|
* an application-specific error code, expressed as a string value.
|
|
156
156
|
*/
|
|
157
|
-
readonly code
|
|
157
|
+
readonly code?: string;
|
|
158
158
|
/**
|
|
159
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.
|
|
160
|
+
* this property is used to pass through a related Error instance but can be any value.
|
|
161
161
|
*/
|
|
162
|
-
readonly cause
|
|
162
|
+
readonly cause?: unknown;
|
|
163
163
|
/**
|
|
164
164
|
* Additional details related to the error that may help the user troubleshoot the issue. If set by the user
|
|
165
165
|
* via the Error constructor, the user provided value will override any automated help message set by the
|
|
166
166
|
* Error class.
|
|
167
167
|
*/
|
|
168
|
-
readonly help
|
|
168
|
+
readonly help?: string;
|
|
169
169
|
/**
|
|
170
170
|
* Relevant for integration errors involving a network call, the `requestOptions` property
|
|
171
171
|
* details the request options that resulted in the specified error. The `requestOptions` property will automatically
|
|
@@ -1 +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,
|
|
1
|
+
{"version":3,"file":"integration-error.d.ts","sourceRoot":"","sources":["../../../lib/errors/integ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M,CAAC;IACf;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;;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,CAAC,EAAE,SAAS,CAAC;IAE1B;;OAEG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAEvB;;;OAGG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACzB;;;;OAIG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,kBAAkB,CAAC;IAE7C;;;;;OAKG;gBACS,OAAO,EAAE,MAAM,EAAE,UAAU,GAAE,0BAA+B;IAqCxE;;;;OAIG;IACH,MAAM;CAwCP"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ResponseError } from './integration-error';
|
|
2
2
|
/**
|
|
3
3
|
* @public
|
|
4
4
|
* @param error - Error instance to parse into a plain old javascript object
|
|
5
5
|
*/
|
|
6
|
-
export declare const parseErrorToReadableJson: (error:
|
|
6
|
+
export declare const parseErrorToReadableJson: (error: ResponseError) => any;
|
|
7
7
|
//# sourceMappingURL=parse-error-to-readable-json.d.ts.map
|
|
@@ -1 +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,
|
|
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,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD;;;GAGG;AACH,eAAO,MAAM,wBAAwB,GAAI,OAAO,aAAa,QACS,CAAC"}
|
package/dist/dts/index.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import * as errors from './errors';
|
|
2
2
|
import * as requests from './requests';
|
|
3
3
|
import * as logging from './logging';
|
|
4
|
-
import * as context from './context';
|
|
5
|
-
import * as types from './types';
|
|
6
4
|
export * from './types';
|
|
7
|
-
export { errors, requests, logging
|
|
5
|
+
export { errors, requests, logging };
|
|
8
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/dts/index.d.ts.map
CHANGED
|
@@ -1 +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;
|
|
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,cAAc,SAAS,CAAC;AAExB,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC"}
|
package/dist/dts/index.docs.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { HttpRequestOptions } from '../requests/polarity-request';
|
|
|
2
2
|
/**
|
|
3
3
|
* @public
|
|
4
4
|
*/
|
|
5
|
-
export interface
|
|
5
|
+
export interface ResponseError {
|
|
6
6
|
name: string;
|
|
7
7
|
message: string;
|
|
8
8
|
stack?: string;
|
|
@@ -38,9 +38,9 @@ export interface IntegrationErrorProperties {
|
|
|
38
38
|
help?: string;
|
|
39
39
|
/**
|
|
40
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.
|
|
41
|
+
* this property is used to pass through a related Error instance but can be any value.
|
|
42
42
|
*/
|
|
43
|
-
cause?:
|
|
43
|
+
cause?: unknown;
|
|
44
44
|
/**
|
|
45
45
|
* The HTTP status code applicable to this error, expressed as a string value.
|
|
46
46
|
*/
|
|
@@ -115,9 +115,9 @@ export interface SerializedIntegrationError {
|
|
|
115
115
|
code?: number | string;
|
|
116
116
|
/**
|
|
117
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.
|
|
118
|
+
* this property is used to pass through a related Error instance but can be any value.
|
|
119
119
|
*/
|
|
120
|
-
cause?:
|
|
120
|
+
cause?: unknown;
|
|
121
121
|
/**
|
|
122
122
|
* Relevant for integration errors involving a network call, the `requestOptions` property
|
|
123
123
|
* details the request options that resulted in the specified error. The `requestOptions` property will automatically
|
|
@@ -146,26 +146,26 @@ export declare class IntegrationError extends Error {
|
|
|
146
146
|
/**
|
|
147
147
|
* a meta object containing non-standard meta-information about the error.
|
|
148
148
|
*/
|
|
149
|
-
readonly meta
|
|
149
|
+
readonly meta?: ErrorMeta;
|
|
150
150
|
/**
|
|
151
151
|
* The HTTP status code applicable to this error, expressed as a string value.
|
|
152
152
|
*/
|
|
153
|
-
readonly status
|
|
153
|
+
readonly status?: string;
|
|
154
154
|
/**
|
|
155
155
|
* an application-specific error code, expressed as a string value.
|
|
156
156
|
*/
|
|
157
|
-
readonly code
|
|
157
|
+
readonly code?: string;
|
|
158
158
|
/**
|
|
159
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.
|
|
160
|
+
* this property is used to pass through a related Error instance but can be any value.
|
|
161
161
|
*/
|
|
162
|
-
readonly cause
|
|
162
|
+
readonly cause?: unknown;
|
|
163
163
|
/**
|
|
164
164
|
* Additional details related to the error that may help the user troubleshoot the issue. If set by the user
|
|
165
165
|
* via the Error constructor, the user provided value will override any automated help message set by the
|
|
166
166
|
* Error class.
|
|
167
167
|
*/
|
|
168
|
-
readonly help
|
|
168
|
+
readonly help?: string;
|
|
169
169
|
/**
|
|
170
170
|
* Relevant for integration errors involving a network call, the `requestOptions` property
|
|
171
171
|
* details the request options that resulted in the specified error. The `requestOptions` property will automatically
|
|
@@ -1 +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,
|
|
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,aAAa;IAC5B,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;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OAEG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAEvB;;;OAGG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACzB;;;;OAIG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,kBAAkB,CAAC;IAE7C;;;;;OAKG;gBACS,OAAO,EAAE,MAAM,EAAE,UAAU,GAAE,0BAA+B;IAqCxE;;;;OAIG;IACH,MAAM;CAwCP"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ResponseError } from './integration-error';
|
|
2
2
|
/**
|
|
3
3
|
* @public
|
|
4
4
|
* @param error - Error instance to parse into a plain old javascript object
|
|
5
5
|
*/
|
|
6
|
-
export declare const parseErrorToReadableJson: (error:
|
|
6
|
+
export declare const parseErrorToReadableJson: (error: ResponseError) => any;
|
|
7
7
|
//# sourceMappingURL=parse-error-to-readable-json.d.ts.map
|
|
@@ -1 +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,
|
|
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,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD;;;GAGG;AACH,eAAO,MAAM,wBAAwB,GAAI,OAAO,aAAa,QACS,CAAC"}
|
package/dist/dts/lib/index.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import * as errors from './errors';
|
|
2
2
|
import * as requests from './requests';
|
|
3
3
|
import * as logging from './logging';
|
|
4
|
-
import * as context from './context';
|
|
5
|
-
import * as types from './types';
|
|
6
4
|
export * from './types';
|
|
7
|
-
export { errors, requests, logging
|
|
5
|
+
export { errors, requests, logging };
|
|
8
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +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;
|
|
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,cAAc,SAAS,CAAC;AAExB,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -1,15 +1,4 @@
|
|
|
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
|
-
};
|
|
1
|
+
import type { Logger } from '@polarityio/integration-types';
|
|
13
2
|
/**
|
|
14
3
|
* Set the logger object used by the integration.
|
|
15
4
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../../lib/logging/logger.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../../lib/logging/logger.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AA2B5D;;;;;;;;;;;;;;;;;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"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import Bottleneck from 'bottleneck';
|
|
2
1
|
import { ApiRequestError, NetworkError, RetryRequestError } from '../errors';
|
|
3
|
-
import type { Entity, DoLookupUserOptions } from '
|
|
2
|
+
import type { Entity, DoLookupUserOptions } from '@polarityio/integration-types';
|
|
4
3
|
/**
|
|
5
4
|
* @public
|
|
6
5
|
*/
|
|
@@ -187,30 +186,86 @@ export type IsApiErrorResult = {
|
|
|
187
186
|
*/
|
|
188
187
|
export type IsApiErrorFunction = (response: HttpRequestResponse, requestOptions: HttpRequestOptions, userOptions: DoLookupUserOptions) => IsApiErrorResult;
|
|
189
188
|
/**
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
* The returned `requestOptions` object will be used for the request. This method is passed
|
|
193
|
-
* a copy of the original `requestOptions` object so it can be modified without side effects.
|
|
189
|
+
* Minimal interface for a rate limiter compatible with PolarityRequest.
|
|
190
|
+
* The Polarity server provides a Bottleneck instance that satisfies this interface.
|
|
194
191
|
*
|
|
195
|
-
*
|
|
196
|
-
|
|
197
|
-
|
|
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.
|
|
198
225
|
*
|
|
199
226
|
* @public
|
|
200
227
|
*/
|
|
201
|
-
export type
|
|
228
|
+
export type OnApiErrorHook = (error: ApiRequestError, response: HttpRequestResponse, requestOptions: HttpRequestOptions, userOptions: DoLookupUserOptions) => Promise<void>;
|
|
202
229
|
/**
|
|
203
|
-
*
|
|
204
|
-
*
|
|
205
|
-
*
|
|
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.
|
|
206
234
|
*
|
|
207
235
|
* @public
|
|
208
236
|
*/
|
|
209
|
-
export type
|
|
237
|
+
export type OnNetworkErrorHook = (error: NetworkError | RetryRequestError, requestOptions: HttpRequestOptions, userOptions: DoLookupUserOptions) => Promise<void>;
|
|
210
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
|
+
*
|
|
211
244
|
* @public
|
|
212
245
|
*/
|
|
213
|
-
export
|
|
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
|
+
}
|
|
214
269
|
/**
|
|
215
270
|
* @public
|
|
216
271
|
*/
|
|
@@ -221,22 +276,18 @@ export interface PolarityRequestOptions {
|
|
|
221
276
|
httpResponseErrorProperties?: string[];
|
|
222
277
|
httpResponseErrorMessageProperties?: string[];
|
|
223
278
|
requestOptionsToSanitize?: string[];
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
postprocessRequestFailure?: PostprocessRequestFailure;
|
|
227
|
-
throttlingOptions?: Bottleneck.ConstructorOptions;
|
|
279
|
+
hooks?: PolarityRequestHooks;
|
|
280
|
+
limiter?: Limiter;
|
|
228
281
|
}
|
|
229
282
|
/**
|
|
230
283
|
* A utility class for making HTTP requests
|
|
231
284
|
* @public
|
|
232
285
|
*/
|
|
233
286
|
export declare class PolarityRequest {
|
|
234
|
-
private bottleneckLimiter;
|
|
235
287
|
/**
|
|
236
288
|
* Instance of a Bunyan logger
|
|
237
289
|
*/
|
|
238
290
|
private logger;
|
|
239
|
-
private internalThrottlingOptions;
|
|
240
291
|
/**
|
|
241
292
|
* postman-request library request object with default values set. Used internally for
|
|
242
293
|
* making HTTP requests directly via the postman-request library
|
|
@@ -286,49 +337,20 @@ export declare class PolarityRequest {
|
|
|
286
337
|
readonly requestOptionsToSanitize: string[];
|
|
287
338
|
userOptions: DoLookupUserOptions;
|
|
288
339
|
/**
|
|
289
|
-
*
|
|
290
|
-
*
|
|
291
|
-
*
|
|
292
|
-
*
|
|
293
|
-
*
|
|
294
|
-
* This method is typically used for adding authentication (e.g., auth headers, or basic auth) to every request.
|
|
295
|
-
* It can also be used to add headers that are required on every request or conditionally add headers based
|
|
296
|
-
* on the passed in `userOptions`.
|
|
297
|
-
*
|
|
298
|
-
* This method can be set as part of the {@link PolarityRequestOptions} when creating a new instance of the
|
|
299
|
-
* {@link PolarityRequest} class or can be set after the fact.
|
|
300
|
-
*
|
|
301
|
-
* @param requestOptions - A copy of the request options used for the request. This object can be modified
|
|
302
|
-
* without side effects.
|
|
303
|
-
* @param userOptions - The user options passed into the `doLookup` method.
|
|
304
|
-
* @returns The modified request options to use for the request.
|
|
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.
|
|
305
344
|
*/
|
|
306
|
-
|
|
345
|
+
limiter: Limiter | null;
|
|
307
346
|
/**
|
|
308
|
-
*
|
|
309
|
-
*
|
|
310
|
-
*
|
|
311
|
-
*
|
|
312
|
-
* @param response - The HTTP response from the request.
|
|
313
|
-
* @param requestOptions - The request options used for the request.
|
|
314
|
-
* @param userOptions - The user options passed into the `doLookup` method.
|
|
315
|
-
*/
|
|
316
|
-
postprocessRequestSuccess: PostprocessRequestSuccess;
|
|
317
|
-
/**
|
|
318
|
-
* Method that can be implemented to post-process the HTTP response after a failed request.
|
|
319
|
-
* This method is typically used to inspect the error thrown and either alter the error
|
|
320
|
-
* object (e.g., to change the error message property to something more specific), to ignore
|
|
321
|
-
* the error (by not rethrowing it), or to take a specific action based on the error (e.g.,
|
|
322
|
-
* in the case of a RetryRequestError you may want to retry the request or return a special
|
|
323
|
-
* payload to the integration front end).
|
|
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.
|
|
324
350
|
*
|
|
325
|
-
* @
|
|
326
|
-
* @param requestOptions - The request options used for the request.
|
|
327
|
-
* @param userOptions - The user options passed into the `doLookup` method.
|
|
351
|
+
* @see {@link PolarityRequestHooks} for hook type details.
|
|
328
352
|
*/
|
|
329
|
-
|
|
330
|
-
get throttlingOptions(): Bottleneck.ConstructorOptions;
|
|
331
|
-
set throttlingOptions(throttlingOptions: Bottleneck.ConstructorOptions);
|
|
353
|
+
readonly hooks: Required<PolarityRequestHooks>;
|
|
332
354
|
constructor(options?: PolarityRequestOptions);
|
|
333
355
|
private configFieldIsValid;
|
|
334
356
|
/**
|
|
@@ -337,17 +359,18 @@ export declare class PolarityRequest {
|
|
|
337
359
|
* @param requestOptions - request options used to make the HTTP request
|
|
338
360
|
* @returns The HTTP response
|
|
339
361
|
*/
|
|
340
|
-
run(requestOptions: HttpRequestOptions): Promise<HttpRequestResponse> | never;
|
|
362
|
+
run(requestOptions: HttpRequestOptions): Promise<HttpRequestResponse | undefined> | never;
|
|
341
363
|
/**
|
|
342
|
-
* Checks whether the HTTP response is an API error and
|
|
364
|
+
* Checks whether the HTTP response is an API error and returns an ApiRequestError if it is.
|
|
343
365
|
*
|
|
344
366
|
* @param httpResponse - The HTTP response from the Postman request.
|
|
345
367
|
* @param requestOptions - The options used for the request.
|
|
368
|
+
* @returns An ApiRequestError if the response indicates an API error, undefined otherwise.
|
|
346
369
|
*
|
|
347
|
-
* @throws {@link
|
|
348
|
-
* Throws
|
|
370
|
+
* @throws {@link LibraryUsageError}
|
|
371
|
+
* Throws if the `isApiError` function returns an invalid result.
|
|
349
372
|
*/
|
|
350
|
-
private
|
|
373
|
+
private detectApiError;
|
|
351
374
|
/**
|
|
352
375
|
* Returns true if the `httpStatusCode` is not one of the rounded HTTP status codes
|
|
353
376
|
* specified in the PolarityRequest `roundedSuccessStatusCodes` property.
|
|
@@ -403,9 +426,11 @@ export declare class PolarityRequest {
|
|
|
403
426
|
* `requestId` property.
|
|
404
427
|
*
|
|
405
428
|
* @param options - An array of request options for running requests in parallel.
|
|
406
|
-
* @returns A promise that resolves to an array of responses
|
|
407
|
-
*
|
|
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`.
|
|
408
433
|
*/
|
|
409
|
-
runInParallel(options: RunInParallelOptions): Promise<HttpRequestResponse[]>;
|
|
434
|
+
runInParallel(options: RunInParallelOptions): Promise<(HttpRequestResponse | undefined)[]>;
|
|
410
435
|
}
|
|
411
436
|
//# sourceMappingURL=polarity-request.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"polarity-request.d.ts","sourceRoot":"","sources":["../../../../lib/requests/polarity-request.ts"],"names":[],"mappings":"
|
|
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,E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;IACH,SAAgB,wBAAwB,EAAE,MAAM,EAAE,CAAM;IACjD,WAAW,EAAE,mBAAmB,CAAQ;IAE/C;;;;;OAKG;IACI,OAAO,EAAE,OAAO,GAAG,IAAI,CAAQ;IAEtC;;;;;;OAMG;IACH,SAAgB,KAAK,EAAE,QAAQ,CAAC,oBAAoB,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,3 +1,19 @@
|
|
|
1
|
-
import { Entity, EntityType } from '
|
|
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
|
+
*/
|
|
2
18
|
export declare const createEntity: (type: EntityType, value: string) => Entity;
|
|
3
19
|
//# sourceMappingURL=create-entity.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-entity.d.ts","sourceRoot":"","sources":["../../../../../lib/testing/enhanced-utils/create-entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,
|
|
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,3 +1,43 @@
|
|
|
1
|
-
import { IntegrationContext } from '
|
|
2
|
-
|
|
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;
|
|
3
43
|
//# sourceMappingURL=create-mock-integration-context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
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,EAAE,kBAAkB,EAAE,MAAM,
|
|
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,6 +1,3 @@
|
|
|
1
|
-
export * from './test-factory/create-integration-tests';
|
|
2
1
|
export * from './enhanced-utils/create-entity';
|
|
3
2
|
export * from './enhanced-utils/create-mock-integration-context';
|
|
4
|
-
export * from './enhanced-utils/mock-request';
|
|
5
|
-
export * from './enhanced-utils/validate-integration';
|
|
6
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../lib/testing/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../lib/testing/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,kDAAkD,CAAC"}
|