polarity-integration-utils 0.1.0 → 3.1.3
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/context/cache.d.ts +149 -0
- package/dist/dts/context/cache.d.ts.map +1 -0
- package/dist/dts/context/index.d.ts +3 -0
- package/dist/dts/context/index.d.ts.map +1 -0
- package/dist/dts/context/integration-context.d.ts +16 -0
- package/dist/dts/context/integration-context.d.ts.map +1 -0
- 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 +8 -0
- package/dist/dts/index.d.ts.map +1 -0
- package/dist/dts/index.docs.d.ts +10 -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/lib/context/cache.d.ts +149 -0
- package/dist/dts/lib/context/cache.d.ts.map +1 -0
- package/dist/dts/lib/context/index.d.ts +3 -0
- package/dist/dts/lib/context/index.d.ts.map +1 -0
- package/dist/dts/lib/context/integration-context.d.ts +16 -0
- package/dist/dts/lib/context/integration-context.d.ts.map +1 -0
- package/dist/dts/lib/errors/api-request-error.d.ts +10 -0
- package/dist/dts/lib/errors/api-request-error.d.ts.map +1 -0
- package/dist/dts/lib/errors/auth-request-error.d.ts +10 -0
- package/dist/dts/lib/errors/auth-request-error.d.ts.map +1 -0
- package/dist/dts/lib/errors/index.d.ts +8 -0
- package/dist/dts/lib/errors/index.d.ts.map +1 -0
- package/dist/dts/lib/errors/integration-error.d.ts +189 -0
- package/dist/dts/lib/errors/integration-error.d.ts.map +1 -0
- package/dist/dts/lib/errors/library-usage-error.d.ts +12 -0
- package/dist/dts/lib/errors/library-usage-error.d.ts.map +1 -0
- package/dist/dts/lib/errors/network-error.d.ts +11 -0
- package/dist/dts/lib/errors/network-error.d.ts.map +1 -0
- package/dist/dts/lib/errors/parse-error-to-readable-json.d.ts +7 -0
- package/dist/dts/lib/errors/parse-error-to-readable-json.d.ts.map +1 -0
- package/dist/dts/lib/errors/retry-request-error.d.ts +11 -0
- package/dist/dts/lib/errors/retry-request-error.d.ts.map +1 -0
- package/dist/dts/lib/index.d.ts +8 -0
- package/dist/dts/lib/index.d.ts.map +1 -0
- package/dist/dts/lib/index.docs.d.ts +10 -0
- package/dist/dts/lib/index.docs.d.ts.map +1 -0
- package/dist/dts/lib/internal/helpers/parallel-limit.d.ts +9 -0
- package/dist/dts/lib/internal/helpers/parallel-limit.d.ts.map +1 -0
- package/dist/dts/lib/internal/helpers/sanitize-object.d.ts +11 -0
- package/dist/dts/lib/internal/helpers/sanitize-object.d.ts.map +1 -0
- package/dist/dts/lib/logging/index.d.ts +2 -0
- package/dist/dts/lib/logging/index.d.ts.map +1 -0
- package/dist/dts/lib/logging/logger.d.ts +49 -0
- package/dist/dts/lib/logging/logger.d.ts.map +1 -0
- package/dist/dts/lib/requests/index.d.ts +3 -0
- package/dist/dts/lib/requests/index.d.ts.map +1 -0
- package/dist/dts/lib/requests/polarity-request.d.ts +411 -0
- package/dist/dts/lib/requests/polarity-request.d.ts.map +1 -0
- package/dist/dts/lib/requests/sanitize-request-options.d.ts +20 -0
- package/dist/dts/lib/requests/sanitize-request-options.d.ts.map +1 -0
- package/dist/dts/lib/testing/enhanced-utils/create-entity.d.ts +3 -0
- package/dist/dts/lib/testing/enhanced-utils/create-entity.d.ts.map +1 -0
- package/dist/dts/lib/testing/enhanced-utils/create-mock-integration-context.d.ts +3 -0
- package/dist/dts/lib/testing/enhanced-utils/create-mock-integration-context.d.ts.map +1 -0
- package/dist/dts/lib/testing/enhanced-utils/mock-request.d.ts +14 -0
- package/dist/dts/lib/testing/enhanced-utils/mock-request.d.ts.map +1 -0
- package/dist/dts/lib/testing/enhanced-utils/validate-integration.d.ts +8 -0
- package/dist/dts/lib/testing/enhanced-utils/validate-integration.d.ts.map +1 -0
- package/dist/dts/lib/testing/index.d.ts +6 -0
- package/dist/dts/lib/testing/index.d.ts.map +1 -0
- package/dist/dts/lib/testing/test-factory/create-integration-tests.d.ts +6 -0
- package/dist/dts/lib/testing/test-factory/create-integration-tests.d.ts.map +1 -0
- package/dist/dts/lib/testing/test-factory/test-do-lookup.d.ts +7 -0
- package/dist/dts/lib/testing/test-factory/test-do-lookup.d.ts.map +1 -0
- package/dist/dts/lib/testing/test-factory/test-on-message.d.ts +8 -0
- package/dist/dts/lib/testing/test-factory/test-on-message.d.ts.map +1 -0
- package/dist/dts/lib/types.d.ts +101 -0
- package/dist/dts/lib/types.d.ts.map +1 -0
- package/dist/dts/lib/zod-types.d.ts +278 -0
- package/dist/dts/lib/zod-types.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/testing/enhanced-utils/create-entity.d.ts +3 -0
- package/dist/dts/testing/enhanced-utils/create-entity.d.ts.map +1 -0
- package/dist/dts/testing/enhanced-utils/create-mock-integration-context.d.ts +3 -0
- package/dist/dts/testing/enhanced-utils/create-mock-integration-context.d.ts.map +1 -0
- package/dist/dts/testing/enhanced-utils/mock-request.d.ts +14 -0
- package/dist/dts/testing/enhanced-utils/mock-request.d.ts.map +1 -0
- package/dist/dts/testing/enhanced-utils/validate-integration.d.ts +8 -0
- package/dist/dts/testing/enhanced-utils/validate-integration.d.ts.map +1 -0
- package/dist/dts/testing/index.d.ts +6 -0
- package/dist/dts/testing/index.d.ts.map +1 -0
- package/dist/dts/testing/test-factory/create-integration-tests.d.ts +6 -0
- package/dist/dts/testing/test-factory/create-integration-tests.d.ts.map +1 -0
- package/dist/dts/testing/test-factory/test-do-lookup.d.ts +7 -0
- package/dist/dts/testing/test-factory/test-do-lookup.d.ts.map +1 -0
- package/dist/dts/testing/test-factory/test-on-message.d.ts +8 -0
- package/dist/dts/testing/test-factory/test-on-message.d.ts.map +1 -0
- package/dist/dts/tsdoc-metadata.json +11 -0
- package/dist/dts/types.d.ts +101 -0
- package/dist/dts/types.d.ts.map +1 -0
- package/dist/dts/zod-types.d.ts +278 -0
- package/dist/dts/zod-types.d.ts.map +1 -0
- package/dist/es/lib/context/index.js +18 -0
- package/dist/es/lib/errors/api-request-error.js +15 -0
- package/dist/es/lib/errors/auth-request-error.js +15 -0
- package/dist/es/lib/errors/index.js +23 -0
- package/dist/es/lib/errors/integration-error.js +116 -0
- package/dist/es/lib/errors/library-usage-error.js +17 -0
- package/dist/es/lib/errors/network-error.js +88 -0
- package/dist/es/lib/errors/parse-error-to-readable-json.js +9 -0
- package/dist/es/lib/errors/retry-request-error.js +16 -0
- package/dist/es/lib/index.docs.js +25 -0
- package/dist/es/lib/index.js +50 -0
- package/dist/es/lib/internal/helpers/parallel-limit.js +36 -0
- package/dist/es/lib/internal/helpers/sanitize-object.js +37 -0
- package/dist/es/lib/logging/index.js +17 -0
- package/dist/es/lib/logging/logger.js +53 -0
- package/dist/es/lib/requests/index.js +18 -0
- package/dist/es/lib/requests/polarity-request.js +426 -0
- package/dist/es/lib/requests/sanitize-request-options.js +50 -0
- package/dist/es/lib/testing/enhanced-utils/create-entity.js +37 -0
- package/dist/es/lib/testing/enhanced-utils/create-mock-integration-context.js +36 -0
- package/dist/es/lib/testing/enhanced-utils/mock-request.js +22 -0
- package/dist/es/lib/testing/enhanced-utils/validate-integration.js +159 -0
- package/dist/es/lib/testing/index.js +21 -0
- package/dist/es/lib/testing/test-factory/create-integration-tests.js +53 -0
- package/dist/es/lib/testing/test-factory/test-do-lookup.js +24 -0
- package/dist/es/lib/testing/test-factory/test-on-message.js +24 -0
- package/dist/es/lib/types.js +5 -0
- package/dist/es/lib/zod-types.js +206 -0
- package/dist/lib/context/cache.js +2 -0
- package/dist/lib/context/index.js +18 -0
- package/dist/lib/context/integration-context.js +2 -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 +25 -0
- package/dist/lib/index.js +47 -13
- 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/lib/testing/enhanced-utils/create-entity.js +37 -0
- package/dist/lib/testing/enhanced-utils/create-mock-integration-context.js +36 -0
- package/dist/lib/testing/enhanced-utils/mock-request.js +22 -0
- package/dist/lib/testing/enhanced-utils/validate-integration.js +159 -0
- package/dist/lib/testing/index.js +21 -0
- package/dist/lib/testing/test-factory/create-integration-tests.js +53 -0
- package/dist/lib/testing/test-factory/test-do-lookup.js +24 -0
- package/dist/lib/testing/test-factory/test-on-message.js +24 -0
- package/dist/lib/types.js +5 -0
- package/dist/lib/zod-types.js +206 -0
- package/dist/polarity-integration-utils.d.ts +1259 -0
- package/package.json +81 -11
- package/dist/es/errors/RequestError.js +0 -12
- package/dist/es/errors/index.js +0 -11
- 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/index.js +0 -16
- package/dist/es/logging/index.js +0 -4
- package/dist/es/logging/logger.js +0 -17
- package/dist/es/requests/createRequestWithDefaults.js +0 -166
- package/dist/es/requests/createRequestsInParallel.js +0 -40
- package/dist/es/requests/index.js +0 -11
- 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 → lib/context/cache.js} +0 -0
- /package/dist/{lib/requests/requestTypes.js → es/lib/context/integration-context.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,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cache operation options
|
|
3
|
+
*/
|
|
4
|
+
export interface CacheOptions {
|
|
5
|
+
/** Time-to-live in seconds. If not specified, uses default TTL */
|
|
6
|
+
ttl?: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Global cache operations - shared across all integrations and users
|
|
10
|
+
* Use for system-wide statistics, feature flags, or shared configuration
|
|
11
|
+
*/
|
|
12
|
+
export interface GlobalCache {
|
|
13
|
+
/**
|
|
14
|
+
* Get a value from global cache
|
|
15
|
+
* @param key - The cache key
|
|
16
|
+
* @returns Promise that resolves to the cached value or null if not found
|
|
17
|
+
* @example
|
|
18
|
+
* const totalLookups = await cache.global.get('total_lookups') || 0;
|
|
19
|
+
*/
|
|
20
|
+
get(key: string): Promise<unknown>;
|
|
21
|
+
/**
|
|
22
|
+
* Set a value in global cache
|
|
23
|
+
* @param key - The cache key
|
|
24
|
+
* @param value - The value to cache (must be JSON serializable)
|
|
25
|
+
* @param options - Cache options including TTL
|
|
26
|
+
* @returns Promise that resolves when the operation completes
|
|
27
|
+
* @example
|
|
28
|
+
* await cache.global.set('total_lookups', count + 1, \{ ttl: 86400 \});
|
|
29
|
+
*/
|
|
30
|
+
set(key: string, value: unknown, options?: CacheOptions): Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* Delete a value from global cache
|
|
33
|
+
* @param key - The cache key to delete
|
|
34
|
+
* @returns Promise that resolves when the operation completes
|
|
35
|
+
* @example
|
|
36
|
+
* await cache.global.delete('feature_flags');
|
|
37
|
+
*/
|
|
38
|
+
delete(key: string): Promise<void>;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Integration-scoped cache operations - shared across all users of a specific integration
|
|
42
|
+
* Use for API responses, configuration, or data that's the same for all users
|
|
43
|
+
*/
|
|
44
|
+
export interface IntegrationCache {
|
|
45
|
+
/**
|
|
46
|
+
* Get a value from integration cache
|
|
47
|
+
* @param key - The cache key
|
|
48
|
+
* @returns Promise that resolves to the cached value or null if not found
|
|
49
|
+
* @example
|
|
50
|
+
* const config = await cache.integration.get('api_config');
|
|
51
|
+
*/
|
|
52
|
+
get(key: string): Promise<unknown>;
|
|
53
|
+
/**
|
|
54
|
+
* Set a value in integration cache
|
|
55
|
+
* @param key - The cache key
|
|
56
|
+
* @param value - The value to cache (must be JSON serializable)
|
|
57
|
+
* @param options - Cache options including TTL
|
|
58
|
+
* @returns Promise that resolves when the operation completes
|
|
59
|
+
* @example
|
|
60
|
+
* await cache.integration.set('lookup_ip_1.1.1.1', result, \{ ttl: 300 \});
|
|
61
|
+
*/
|
|
62
|
+
set(key: string, value: unknown, options?: CacheOptions): Promise<void>;
|
|
63
|
+
/**
|
|
64
|
+
* Delete a value from integration cache
|
|
65
|
+
* @param key - The cache key to delete
|
|
66
|
+
* @returns Promise that resolves when the operation completes
|
|
67
|
+
* @example
|
|
68
|
+
* await cache.integration.delete('expired_config');
|
|
69
|
+
*/
|
|
70
|
+
delete(key: string): Promise<void>;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* User-scoped cache operations - specific to individual users
|
|
74
|
+
* Use for user preferences, recent activity, or personalized data
|
|
75
|
+
*/
|
|
76
|
+
export interface UserCache {
|
|
77
|
+
/**
|
|
78
|
+
* Get a value from user cache
|
|
79
|
+
* @param key - The cache key
|
|
80
|
+
* @returns Promise that resolves to the cached value or null if not found
|
|
81
|
+
* @example
|
|
82
|
+
* const preferences = await cache.user.get('preferences');
|
|
83
|
+
*/
|
|
84
|
+
get(key: string): Promise<unknown>;
|
|
85
|
+
/**
|
|
86
|
+
* Set a value in user cache
|
|
87
|
+
* @param key - The cache key
|
|
88
|
+
* @param value - The value to cache (must be JSON serializable)
|
|
89
|
+
* @param options - Cache options including TTL
|
|
90
|
+
* @returns Promise that resolves when the operation completes
|
|
91
|
+
* @example
|
|
92
|
+
* await cache.user.set('recent_lookups', lookups, \{ ttl: 3600 \});
|
|
93
|
+
*/
|
|
94
|
+
set(key: string, value: unknown, options?: CacheOptions): Promise<void>;
|
|
95
|
+
/**
|
|
96
|
+
* Delete a value from user cache
|
|
97
|
+
* @param key - The cache key to delete
|
|
98
|
+
* @returns Promise that resolves when the operation completes
|
|
99
|
+
* @example
|
|
100
|
+
* await cache.user.delete('preferences');
|
|
101
|
+
*/
|
|
102
|
+
delete(key: string): Promise<void>;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Main cache interface providing hierarchical caching with three scopes
|
|
106
|
+
*
|
|
107
|
+
* Cache Hierarchy:
|
|
108
|
+
* - Global: System-wide data shared across all integrations
|
|
109
|
+
* - Integration: Data shared among all users of a specific integration
|
|
110
|
+
* - User: User-specific data within an integration context
|
|
111
|
+
*
|
|
112
|
+
* Best Practices:
|
|
113
|
+
* - Use appropriate TTL values to prevent stale data
|
|
114
|
+
* - Handle cache misses gracefully (operations may return null)
|
|
115
|
+
* - Wrap cache operations in try/catch blocks
|
|
116
|
+
* - Use descriptive keys that won't conflict with other data
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* ```javascript
|
|
120
|
+
* // In your integration functions:
|
|
121
|
+
* async function doLookup(entities, options, context) {
|
|
122
|
+
* const cache = context?.cache;
|
|
123
|
+
* if (!cache) return generateFreshData();
|
|
124
|
+
*
|
|
125
|
+
* try {
|
|
126
|
+
* // Check integration cache first
|
|
127
|
+
* const cached = await cache.integration.get(`lookup_${entity.value}`);
|
|
128
|
+
* if (cached) return cached;
|
|
129
|
+
*
|
|
130
|
+
* // Generate and cache new data
|
|
131
|
+
* const result = await apiCall(entity);
|
|
132
|
+
* await cache.integration.set(`lookup_${entity.value}`, result, { ttl: 300 });
|
|
133
|
+
* return result;
|
|
134
|
+
* } catch (error) {
|
|
135
|
+
* console.error('Cache error:', error);
|
|
136
|
+
* return generateFreshData(); // Fallback
|
|
137
|
+
* }
|
|
138
|
+
* }
|
|
139
|
+
* ```
|
|
140
|
+
*/
|
|
141
|
+
export interface PolarityCache {
|
|
142
|
+
/** Global cache operations - shared across all integrations and users */
|
|
143
|
+
global: GlobalCache;
|
|
144
|
+
/** Integration-scoped cache operations - shared across all users of a specific integration */
|
|
145
|
+
integration: IntegrationCache;
|
|
146
|
+
/** User-scoped cache operations - specific to individual users */
|
|
147
|
+
user: UserCache;
|
|
148
|
+
}
|
|
149
|
+
//# sourceMappingURL=cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../../lib/context/cache.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,kEAAkE;IAClE,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B;;;;;;OAMG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEnC;;;;;;;;OAQG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAExE;;;;;;OAMG;IACH,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACpC;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;;;OAMG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEnC;;;;;;;;OAQG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAExE;;;;;;OAMG;IACH,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACpC;AAED;;;GAGG;AACH,MAAM,WAAW,SAAS;IACxB;;;;;;OAMG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEnC;;;;;;;;OAQG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAExE;;;;;;OAMG;IACH,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACpC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,MAAM,WAAW,aAAa;IAC5B,yEAAyE;IACzE,MAAM,EAAE,WAAW,CAAC;IAEpB,8FAA8F;IAC9F,WAAW,EAAE,gBAAgB,CAAC;IAE9B,kEAAkE;IAClE,IAAI,EAAE,SAAS,CAAC;CACjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/context/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Logger } from '../logging';
|
|
2
|
+
import { PolarityCache } from './cache';
|
|
3
|
+
/**
|
|
4
|
+
* Integration context provided to integration functions
|
|
5
|
+
*/
|
|
6
|
+
export interface IntegrationContext {
|
|
7
|
+
/** Cache client for hierarchical caching operations */
|
|
8
|
+
cache: PolarityCache;
|
|
9
|
+
/** Integration identifier */
|
|
10
|
+
integrationId: string;
|
|
11
|
+
/** User identifier */
|
|
12
|
+
userId?: string;
|
|
13
|
+
/** Logger instance */
|
|
14
|
+
logger: Logger;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=integration-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integration-context.d.ts","sourceRoot":"","sources":["../../../lib/context/integration-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,uDAAuD;IACvD,KAAK,EAAE,aAAa,CAAC;IAErB,6BAA6B;IAC7B,aAAa,EAAE,MAAM,CAAC;IAEtB,sBAAsB;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,sBAAsB;IACtB,MAAM,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -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,8 @@
|
|
|
1
|
+
import * as errors from './errors';
|
|
2
|
+
import * as requests from './requests';
|
|
3
|
+
import * as logging from './logging';
|
|
4
|
+
import * as context from './context';
|
|
5
|
+
import * as types from './types';
|
|
6
|
+
export * from './types';
|
|
7
|
+
export { errors, requests, logging, context, types };
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -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;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"}
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
export * from './context';
|
|
10
|
+
//# 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;AACxB,cAAc,WAAW,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"}
|