polarity-integration-utils 3.1.7 → 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.
Files changed (113) hide show
  1. package/dist/dts/errors/integration-error.d.ts +11 -11
  2. package/dist/dts/errors/integration-error.d.ts.map +1 -1
  3. package/dist/dts/errors/parse-error-to-readable-json.d.ts +2 -2
  4. package/dist/dts/errors/parse-error-to-readable-json.d.ts.map +1 -1
  5. package/dist/dts/index.d.ts +1 -3
  6. package/dist/dts/index.d.ts.map +1 -1
  7. package/dist/dts/index.docs.d.ts +1 -1
  8. package/dist/dts/lib/errors/integration-error.d.ts +11 -11
  9. package/dist/dts/lib/errors/integration-error.d.ts.map +1 -1
  10. package/dist/dts/lib/errors/parse-error-to-readable-json.d.ts +2 -2
  11. package/dist/dts/lib/errors/parse-error-to-readable-json.d.ts.map +1 -1
  12. package/dist/dts/lib/index.d.ts +1 -3
  13. package/dist/dts/lib/index.d.ts.map +1 -1
  14. package/dist/dts/lib/index.docs.d.ts +1 -1
  15. package/dist/dts/lib/logging/logger.d.ts +1 -12
  16. package/dist/dts/lib/logging/logger.d.ts.map +1 -1
  17. package/dist/dts/lib/requests/polarity-request.d.ts +93 -68
  18. package/dist/dts/lib/requests/polarity-request.d.ts.map +1 -1
  19. package/dist/dts/lib/testing/enhanced-utils/create-entity.d.ts +17 -1
  20. package/dist/dts/lib/testing/enhanced-utils/create-entity.d.ts.map +1 -1
  21. package/dist/dts/lib/testing/enhanced-utils/create-mock-integration-context.d.ts +42 -2
  22. package/dist/dts/lib/testing/enhanced-utils/create-mock-integration-context.d.ts.map +1 -1
  23. package/dist/dts/lib/testing/index.d.ts +0 -3
  24. package/dist/dts/lib/testing/index.d.ts.map +1 -1
  25. package/dist/dts/lib/types.d.ts +89 -84
  26. package/dist/dts/lib/types.d.ts.map +1 -1
  27. package/dist/dts/logging/logger.d.ts +1 -12
  28. package/dist/dts/logging/logger.d.ts.map +1 -1
  29. package/dist/dts/requests/polarity-request.d.ts +93 -68
  30. package/dist/dts/requests/polarity-request.d.ts.map +1 -1
  31. package/dist/dts/testing/enhanced-utils/create-entity.d.ts +17 -1
  32. package/dist/dts/testing/enhanced-utils/create-entity.d.ts.map +1 -1
  33. package/dist/dts/testing/enhanced-utils/create-mock-integration-context.d.ts +42 -2
  34. package/dist/dts/testing/enhanced-utils/create-mock-integration-context.d.ts.map +1 -1
  35. package/dist/dts/testing/index.d.ts +0 -3
  36. package/dist/dts/testing/index.d.ts.map +1 -1
  37. package/dist/dts/tsdoc-metadata.json +1 -1
  38. package/dist/dts/types.d.ts +89 -84
  39. package/dist/dts/types.d.ts.map +1 -1
  40. package/dist/es/lib/errors/integration-error.js +7 -4
  41. package/dist/es/lib/index.docs.js +1 -1
  42. package/dist/es/lib/index.js +1 -5
  43. package/dist/es/lib/logging/logger.js +18 -7
  44. package/dist/es/lib/requests/polarity-request.js +103 -126
  45. package/dist/es/lib/testing/enhanced-utils/create-entity.js +31 -5
  46. package/dist/es/lib/testing/enhanced-utils/create-mock-integration-context.js +54 -27
  47. package/dist/es/lib/testing/index.js +0 -3
  48. package/dist/es/lib/types.js +2 -1
  49. package/dist/lib/errors/integration-error.js +7 -4
  50. package/dist/lib/index.docs.js +1 -1
  51. package/dist/lib/index.js +1 -5
  52. package/dist/lib/logging/logger.js +18 -7
  53. package/dist/lib/requests/polarity-request.js +103 -126
  54. package/dist/lib/testing/enhanced-utils/create-entity.js +31 -5
  55. package/dist/lib/testing/enhanced-utils/create-mock-integration-context.js +54 -27
  56. package/dist/lib/testing/index.js +0 -3
  57. package/dist/lib/types.js +2 -1
  58. package/dist/polarity-integration-utils.d.ts +264 -594
  59. package/package.json +8 -11
  60. package/dist/dts/context/cache.d.ts +0 -149
  61. package/dist/dts/context/cache.d.ts.map +0 -1
  62. package/dist/dts/context/index.d.ts +0 -3
  63. package/dist/dts/context/index.d.ts.map +0 -1
  64. package/dist/dts/context/integration-context.d.ts +0 -16
  65. package/dist/dts/context/integration-context.d.ts.map +0 -1
  66. package/dist/dts/lib/context/cache.d.ts +0 -149
  67. package/dist/dts/lib/context/cache.d.ts.map +0 -1
  68. package/dist/dts/lib/context/index.d.ts +0 -3
  69. package/dist/dts/lib/context/index.d.ts.map +0 -1
  70. package/dist/dts/lib/context/integration-context.d.ts +0 -16
  71. package/dist/dts/lib/context/integration-context.d.ts.map +0 -1
  72. package/dist/dts/lib/testing/enhanced-utils/mock-request.d.ts +0 -14
  73. package/dist/dts/lib/testing/enhanced-utils/mock-request.d.ts.map +0 -1
  74. package/dist/dts/lib/testing/enhanced-utils/validate-integration.d.ts +0 -8
  75. package/dist/dts/lib/testing/enhanced-utils/validate-integration.d.ts.map +0 -1
  76. package/dist/dts/lib/testing/test-factory/create-integration-tests.d.ts +0 -6
  77. package/dist/dts/lib/testing/test-factory/create-integration-tests.d.ts.map +0 -1
  78. package/dist/dts/lib/testing/test-factory/test-do-lookup.d.ts +0 -7
  79. package/dist/dts/lib/testing/test-factory/test-do-lookup.d.ts.map +0 -1
  80. package/dist/dts/lib/testing/test-factory/test-on-message.d.ts +0 -8
  81. package/dist/dts/lib/testing/test-factory/test-on-message.d.ts.map +0 -1
  82. package/dist/dts/lib/zod-types.d.ts +0 -278
  83. package/dist/dts/lib/zod-types.d.ts.map +0 -1
  84. package/dist/dts/testing/enhanced-utils/mock-request.d.ts +0 -14
  85. package/dist/dts/testing/enhanced-utils/mock-request.d.ts.map +0 -1
  86. package/dist/dts/testing/enhanced-utils/validate-integration.d.ts +0 -8
  87. package/dist/dts/testing/enhanced-utils/validate-integration.d.ts.map +0 -1
  88. package/dist/dts/testing/test-factory/create-integration-tests.d.ts +0 -6
  89. package/dist/dts/testing/test-factory/create-integration-tests.d.ts.map +0 -1
  90. package/dist/dts/testing/test-factory/test-do-lookup.d.ts +0 -7
  91. package/dist/dts/testing/test-factory/test-do-lookup.d.ts.map +0 -1
  92. package/dist/dts/testing/test-factory/test-on-message.d.ts +0 -8
  93. package/dist/dts/testing/test-factory/test-on-message.d.ts.map +0 -1
  94. package/dist/dts/zod-types.d.ts +0 -278
  95. package/dist/dts/zod-types.d.ts.map +0 -1
  96. package/dist/es/lib/context/cache.js +0 -2
  97. package/dist/es/lib/context/index.js +0 -18
  98. package/dist/es/lib/context/integration-context.js +0 -2
  99. package/dist/es/lib/testing/enhanced-utils/mock-request.js +0 -22
  100. package/dist/es/lib/testing/enhanced-utils/validate-integration.js +0 -159
  101. package/dist/es/lib/testing/test-factory/create-integration-tests.js +0 -53
  102. package/dist/es/lib/testing/test-factory/test-do-lookup.js +0 -24
  103. package/dist/es/lib/testing/test-factory/test-on-message.js +0 -24
  104. package/dist/es/lib/zod-types.js +0 -206
  105. package/dist/lib/context/cache.js +0 -2
  106. package/dist/lib/context/index.js +0 -18
  107. package/dist/lib/context/integration-context.js +0 -2
  108. package/dist/lib/testing/enhanced-utils/mock-request.js +0 -22
  109. package/dist/lib/testing/enhanced-utils/validate-integration.js +0 -159
  110. package/dist/lib/testing/test-factory/create-integration-tests.js +0 -53
  111. package/dist/lib/testing/test-factory/test-do-lookup.js +0 -24
  112. package/dist/lib/testing/test-factory/test-on-message.js +0 -24
  113. 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 Error {
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?: Error;
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?: Error;
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: ErrorMeta;
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: string;
153
+ readonly status?: string;
154
154
  /**
155
155
  * an application-specific error code, expressed as a string value.
156
156
  */
157
- readonly code: string;
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: Error;
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: string;
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,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,a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,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 { Error } from './integration-error';
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: Error) => any;
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,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAEjD;;;GAGG;AACH,eAAO,MAAM,wBAAwB,GAAI,OAAO,KAAK,QACiB,CAAC"}
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"}
@@ -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, context, types };
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;AACrC,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AAEjC,cAAc,SAAS,CAAC;AAExB,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,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"}
@@ -6,5 +6,5 @@ export * from './errors';
6
6
  export * from './requests';
7
7
  export * from './logging';
8
8
  export * from './types';
9
- export * from './context';
9
+ export * from './testing';
10
10
  //# sourceMappingURL=index.docs.d.ts.map
@@ -2,7 +2,7 @@ import type { HttpRequestOptions } from '../requests/polarity-request';
2
2
  /**
3
3
  * @public
4
4
  */
5
- export interface Error {
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?: Error;
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?: Error;
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: ErrorMeta;
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: string;
153
+ readonly status?: string;
154
154
  /**
155
155
  * an application-specific error code, expressed as a string value.
156
156
  */
157
- readonly code: string;
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: Error;
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: string;
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,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;CACl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AM,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"}
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;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;OAEG;IACH,MAAM,CAAC,EAAE,MA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;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 { Error } from './integration-error';
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: Error) => any;
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,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAEjD;;;GAGG;AACH,eAAO,MAAM,wBAAwB,GAAI,OAAO,KAAK,QACiB,CAAC"}
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"}
@@ -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, context, types };
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;AACrC,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AAEjC,cAAc,SAAS,CAAC;AAExB,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,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"}
@@ -6,5 +6,5 @@ export * from './errors';
6
6
  export * from './requests';
7
7
  export * from './logging';
8
8
  export * from './types';
9
- export * from './context';
9
+ export * from './testing';
10
10
  //# sourceMappingURL=index.docs.d.ts.map
@@ -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":"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"}
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 '../types';
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
- * Optional middleware method for modifying {@link HttpRequestOptions} before a request is made
191
- * via the {@link PolarityRequest.run} method or {@link PolarityRequest.runInParallel} method.
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
- * This method is typically used for adding authentication (e.g., auth headers, or basic auth) to every request. It can also
196
- * be used to add headers that are required on every request or conditionally add headers based
197
- * on the passed in `userOptions`.
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 PreprocessRequestOptions = (requestOptions: HttpRequestOptions, userOptions: DoLookupUserOptions) => Promise<HttpRequestOptions> | never | undefined;
228
+ export type OnApiErrorHook = (error: ApiRequestError, response: HttpRequestResponse, requestOptions: HttpRequestOptions, userOptions: DoLookupUserOptions) => Promise<void>;
202
229
  /**
203
- * Optional middleware method for modifying the {@link HttpRequestResponse} after a successful request.
204
- * The passed in {@link HttpRequestResponse} object is not a copy but can be safely modified without
205
- * side effects. The returned `HttpRequestResponse` object will be used for the response.
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 PostprocessRequestSuccess = (response: HttpRequestResponse, requestOptions: HttpRequestOptions, userOptions: DoLookupUserOptions) => Promise<HttpRequestResponse> | never;
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 type PostprocessRequestFailure = (error: Error, requestOptions: HttpRequestOptions, userOptions: DoLookupUserOptions) => Promise<unknown> | never;
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
- preprocessRequestOptions?: PreprocessRequestOptions;
225
- postprocessRequestSuccess?: PostprocessRequestSuccess;
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
- * Optional middleware method for modifying {@link HttpRequestOptions} before a request is made
290
- * via the {@link PolarityRequest.run} method or {@link PolarityRequest.runInParallel} method.
291
- * The returned `requestOptions` object will be used for the request. This method is passed
292
- * a copy of the original `requestOptions` object so it can be modified without side effects.
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
- preprocessRequestOptions: PreprocessRequestOptions;
345
+ limiter: Limiter | null;
307
346
  /**
308
- * Optional middleware method for modifying the {@link HttpRequestResponse} after a successful request.
309
- * The passed in {@link HttpRequestResponse} object is not a copy but can be safely modified without
310
- * side effects. The returned `HttpRequestResponse` object will be used for the response.
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
- * @param error - The error thrown during the request.
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
- postprocessRequestFailure: PostprocessRequestFailure;
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 throws an ApiRequestError if it is.
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 ApiRequestError}
348
- * Throws an error if the response indicates an API error.
370
+ * @throws {@link LibraryUsageError}
371
+ * Throws if the `isApiError` function returns an invalid result.
349
372
  */
350
- private maybeThrowApiRequestError;
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. If the `returnErrors` property is set to `true`
407
- * then the response objects will have their `error` property set to the thrown error.
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":"AAEA,OAAO,UAAU,MAAM,YAAY,CAAC;AAMpC,OAAO,EACL,eAAe,EACf,YAAY,EACZ,iBAAiB,EAElB,MAAM,WAAW,CAAC;AAGnB,OAAO,KAAK,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAG5D;;GAEG;AACH,MAAM,MAAM,yBAAyB,GAAG;IACtC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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,EAAE,MAAM,aAAa,CAAC;AAEjD,eAAO,MAAM,YAAY,GAAI,MAAM,UAAU,EAAE,OAAO,MAAM,KAAG,MAmC9D,CAAC"}
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 '../../context';
2
- export declare const createMockIntegrationContext: () => IntegrationContext;
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,eAAe,CAAC;AAEnD,eAAO,MAAM,4BAA4B,QAAO,kBAgC/C,CAAC"}
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,yCAAyC,CAAC;AACxD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,kDAAkD,CAAC;AACjE,cAAc,+BAA+B,CAAC;AAC9C,cAAc,uCAAuC,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"}