@aligent/microservice-util-lib 1.0.0 → 1.1.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/README.md +2 -2
- package/docs/classes/S3Dao.md +102 -107
- package/docs/functions/apiKeyAuthMiddleware.md +37 -0
- package/docs/functions/basicAuthMiddleware.md +37 -0
- package/docs/functions/chunkBy.md +43 -0
- package/docs/functions/fetchSsmParams.md +61 -0
- package/docs/functions/getAwsIdFromArn.md +37 -0
- package/docs/functions/hasDefinedProperties.md +57 -0
- package/docs/functions/oAuth10aAuthMiddleware.md +43 -0
- package/docs/functions/oAuth20AuthMiddleware.md +37 -0
- package/docs/functions/remap.md +71 -0
- package/docs/functions/retryWrapper.md +46 -0
- package/docs/interfaces/ApiKey.md +44 -0
- package/docs/interfaces/Basic.md +32 -0
- package/docs/interfaces/OAuth10a.md +93 -0
- package/docs/interfaces/OAuth20.md +44 -0
- package/docs/interfaces/RetryConfig.md +53 -42
- package/docs/modules.md +21 -302
- package/docs/type-aliases/ObjectMap.md +13 -0
- package/docs/type-aliases/Remap.md +21 -0
- package/package.json +15 -40
- package/{dist/chunkBy/chunkBy.js → src/chunk-by/chunk-by.js} +3 -4
- package/{dist/fetchSsmParams/fetchSsmParams.d.ts → src/fetch-ssm-params/fetch-ssm-params.d.ts} +2 -2
- package/src/fetch-ssm-params/fetch-ssm-params.js +28 -0
- package/{dist/getAwsIdFromArn/getAwsIdFromArn.js → src/get-aws-id-from-arn/get-aws-id-from-arn.js} +2 -3
- package/{dist/hasPropertiesDefined/hasPropertiesDefined.js → src/has-properties-defined/has-properties-defined.js} +2 -8
- package/src/index.d.ts +10 -0
- package/src/index.js +24 -0
- package/src/openapi-fetch-middlewares/authentications.d.ts +66 -0
- package/src/openapi-fetch-middlewares/authentications.js +96 -0
- package/src/openapi-fetch-middlewares/oauth10a/oauth10a.d.ts +12 -0
- package/src/openapi-fetch-middlewares/oauth10a/oauth10a.js +209 -0
- package/src/openapi-fetch-middlewares/types/authentications.d.ts +71 -0
- package/src/openapi-fetch-middlewares/types/authentications.js +2 -0
- package/{dist → src}/remap/remap.d.ts +6 -6
- package/src/remap/remap.js +97 -0
- package/{dist/retryWrapper/retryWrapper.d.ts → src/retry-wrapper/retry-wrapper.d.ts} +1 -1
- package/src/retry-wrapper/retry-wrapper.js +56 -0
- package/{dist → src}/s3/s3.d.ts +2 -2
- package/src/s3/s3.js +86 -0
- package/dist/chunkBy/chunkBy.js.map +0 -1
- package/dist/chunkBy/chunkBy.test.d.ts +0 -1
- package/dist/chunkBy/chunkBy.test.js +0 -17
- package/dist/chunkBy/chunkBy.test.js.map +0 -1
- package/dist/fetchSsmParams/fetchSsmParams.js +0 -80
- package/dist/fetchSsmParams/fetchSsmParams.js.map +0 -1
- package/dist/fetchSsmParams/fetchSsmParams.test.d.ts +0 -1
- package/dist/fetchSsmParams/fetchSsmParams.test.js +0 -110
- package/dist/fetchSsmParams/fetchSsmParams.test.js.map +0 -1
- package/dist/getAwsIdFromArn/getAwsIdFromArn.js.map +0 -1
- package/dist/getAwsIdFromArn/getAwsIdFromArn.test.d.ts +0 -1
- package/dist/getAwsIdFromArn/getAwsIdFromArn.test.js +0 -20
- package/dist/getAwsIdFromArn/getAwsIdFromArn.test.js.map +0 -1
- package/dist/hasPropertiesDefined/hasPropertiesDefined.js.map +0 -1
- package/dist/hasPropertiesDefined/hasPropertiesDefined.test.d.ts +0 -1
- package/dist/hasPropertiesDefined/hasPropertiesDefined.test.js +0 -37
- package/dist/hasPropertiesDefined/hasPropertiesDefined.test.js.map +0 -1
- package/dist/index.d.ts +0 -8
- package/dist/index.js +0 -21
- package/dist/index.js.map +0 -1
- package/dist/remap/remap.js +0 -50
- package/dist/remap/remap.js.map +0 -1
- package/dist/remap/remap.test.d.ts +0 -1
- package/dist/remap/remap.test.js +0 -65
- package/dist/remap/remap.test.js.map +0 -1
- package/dist/retryWrapper/retryWrapper.js +0 -121
- package/dist/retryWrapper/retryWrapper.js.map +0 -1
- package/dist/retryWrapper/retryWrapper.test.d.ts +0 -1
- package/dist/retryWrapper/retryWrapper.test.js +0 -234
- package/dist/retryWrapper/retryWrapper.test.js.map +0 -1
- package/dist/s3/s3.js +0 -190
- package/dist/s3/s3.js.map +0 -1
- package/dist/s3/s3.test.d.ts +0 -1
- package/dist/s3/s3.test.js +0 -126
- package/dist/s3/s3.test.js.map +0 -1
- /package/{dist/chunkBy/chunkBy.d.ts → src/chunk-by/chunk-by.d.ts} +0 -0
- /package/{dist/getAwsIdFromArn/getAwsIdFromArn.d.ts → src/get-aws-id-from-arn/get-aws-id-from-arn.d.ts} +0 -0
- /package/{dist/hasPropertiesDefined/hasPropertiesDefined.d.ts → src/has-properties-defined/has-properties-defined.d.ts} +0 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
[**@aligent/microservice-util-lib**](../modules.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@aligent/microservice-util-lib](../modules.md) / remap
|
|
6
|
+
|
|
7
|
+
# Function: remap()
|
|
8
|
+
|
|
9
|
+
> **remap**\<`Original`, `MapArray`\>(`object`, `map`): `SimplifyIntersection`\<`ConstructTypeFromProperties`\<`MapArray`, `Original`, `0`\>\>
|
|
10
|
+
|
|
11
|
+
Defined in: [remap/remap.ts:183](https://github.com/aligent/microservice-development-utilities/blob/e13483771966234032f5249dc36c2c31c71d7cf1/packages/microservice-util-lib/src/remap/remap.ts#L183)
|
|
12
|
+
|
|
13
|
+
Map one object's values to another structure
|
|
14
|
+
|
|
15
|
+
## Type Parameters
|
|
16
|
+
|
|
17
|
+
### Original
|
|
18
|
+
|
|
19
|
+
`Original` *extends* `object`
|
|
20
|
+
|
|
21
|
+
### MapArray
|
|
22
|
+
|
|
23
|
+
`MapArray` *extends* [`ObjectMap`](../type-aliases/ObjectMap.md)
|
|
24
|
+
|
|
25
|
+
## Parameters
|
|
26
|
+
|
|
27
|
+
### object
|
|
28
|
+
|
|
29
|
+
`Original`
|
|
30
|
+
|
|
31
|
+
the object to map from
|
|
32
|
+
|
|
33
|
+
### map
|
|
34
|
+
|
|
35
|
+
`MapArray`
|
|
36
|
+
|
|
37
|
+
the keys for the mapping
|
|
38
|
+
|
|
39
|
+
## Returns
|
|
40
|
+
|
|
41
|
+
`SimplifyIntersection`\<`ConstructTypeFromProperties`\<`MapArray`, `Original`, `0`\>\>
|
|
42
|
+
|
|
43
|
+
the remapped object
|
|
44
|
+
|
|
45
|
+
## Examples
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
const map = [
|
|
49
|
+
['foo', 'baz'],
|
|
50
|
+
['bar', 'qux.0']
|
|
51
|
+
] as const;
|
|
52
|
+
const obj = { foo: 'hi', bar: 7 }
|
|
53
|
+
remap(obj, map); // { baz: 'hi', qux: [7] }
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
const map = [
|
|
58
|
+
['foo', 'baz'],
|
|
59
|
+
['bar', 'qux.0', (x: number) => x + 1]
|
|
60
|
+
] as const;
|
|
61
|
+
const obj = { foo: 'hi', bar: 7 }
|
|
62
|
+
remap(obj, map); // { baz: 'hi', qux: [8] }
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
```ts
|
|
66
|
+
const map = [
|
|
67
|
+
['', 'baz', (x: { foo: number, bar: number }) => x.foo + x.bar]
|
|
68
|
+
]
|
|
69
|
+
const obj = { foo: 3, bar: 7 }
|
|
70
|
+
remap(obj, map); // { baz: 10 }
|
|
71
|
+
```
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
[**@aligent/microservice-util-lib**](../modules.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@aligent/microservice-util-lib](../modules.md) / retryWrapper
|
|
6
|
+
|
|
7
|
+
# Function: retryWrapper()
|
|
8
|
+
|
|
9
|
+
> **retryWrapper**\<`T`\>(`fn`, `config`): `Promise`\<`T`\>
|
|
10
|
+
|
|
11
|
+
Defined in: [retry-wrapper/retry-wrapper.ts:78](https://github.com/aligent/microservice-development-utilities/blob/e13483771966234032f5249dc36c2c31c71d7cf1/packages/microservice-util-lib/src/retry-wrapper/retry-wrapper.ts#L78)
|
|
12
|
+
|
|
13
|
+
Retry an async function if it fails
|
|
14
|
+
|
|
15
|
+
## Type Parameters
|
|
16
|
+
|
|
17
|
+
### T
|
|
18
|
+
|
|
19
|
+
`T`
|
|
20
|
+
|
|
21
|
+
## Parameters
|
|
22
|
+
|
|
23
|
+
### fn
|
|
24
|
+
|
|
25
|
+
() => `Promise`\<`T`\>
|
|
26
|
+
|
|
27
|
+
the function to be retried
|
|
28
|
+
|
|
29
|
+
### config
|
|
30
|
+
|
|
31
|
+
[`RetryConfig`](../interfaces/RetryConfig.md)
|
|
32
|
+
|
|
33
|
+
the configuration for retries
|
|
34
|
+
|
|
35
|
+
## Returns
|
|
36
|
+
|
|
37
|
+
`Promise`\<`T`\>
|
|
38
|
+
|
|
39
|
+
## Example
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
retryWrapper(someAsyncFunction, {
|
|
43
|
+
retries: 3,
|
|
44
|
+
onRetry: (_, error) => console.error(error)
|
|
45
|
+
});
|
|
46
|
+
```
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
[**@aligent/microservice-util-lib**](../modules.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@aligent/microservice-util-lib](../modules.md) / ApiKey
|
|
6
|
+
|
|
7
|
+
# Interface: ApiKey
|
|
8
|
+
|
|
9
|
+
Defined in: [openapi-fetch-middlewares/types/authentications.ts:11](https://github.com/aligent/microservice-development-utilities/blob/e13483771966234032f5249dc36c2c31c71d7cf1/packages/microservice-util-lib/src/openapi-fetch-middlewares/types/authentications.ts#L11)
|
|
10
|
+
|
|
11
|
+
Represents an API key authentication method.
|
|
12
|
+
|
|
13
|
+
This interface is used for API key-based authentication, where the key is sent
|
|
14
|
+
in a specific header. The value of the API key is retrieved asynchronously.
|
|
15
|
+
|
|
16
|
+
ApiKey
|
|
17
|
+
|
|
18
|
+
## Properties
|
|
19
|
+
|
|
20
|
+
<a id="header"></a>
|
|
21
|
+
|
|
22
|
+
### header
|
|
23
|
+
|
|
24
|
+
> **header**: `string`
|
|
25
|
+
|
|
26
|
+
Defined in: [openapi-fetch-middlewares/types/authentications.ts:12](https://github.com/aligent/microservice-development-utilities/blob/e13483771966234032f5249dc36c2c31c71d7cf1/packages/microservice-util-lib/src/openapi-fetch-middlewares/types/authentications.ts#L12)
|
|
27
|
+
|
|
28
|
+
The header name where the API key will be set.
|
|
29
|
+
|
|
30
|
+
***
|
|
31
|
+
|
|
32
|
+
<a id="value"></a>
|
|
33
|
+
|
|
34
|
+
### value()
|
|
35
|
+
|
|
36
|
+
> **value**: () => `Promise`\<`string`\>
|
|
37
|
+
|
|
38
|
+
Defined in: [openapi-fetch-middlewares/types/authentications.ts:13](https://github.com/aligent/microservice-development-utilities/blob/e13483771966234032f5249dc36c2c31c71d7cf1/packages/microservice-util-lib/src/openapi-fetch-middlewares/types/authentications.ts#L13)
|
|
39
|
+
|
|
40
|
+
A function that returns a promise resolving to the API key value.
|
|
41
|
+
|
|
42
|
+
#### Returns
|
|
43
|
+
|
|
44
|
+
`Promise`\<`string`\>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
[**@aligent/microservice-util-lib**](../modules.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@aligent/microservice-util-lib](../modules.md) / Basic
|
|
6
|
+
|
|
7
|
+
# Interface: Basic
|
|
8
|
+
|
|
9
|
+
Defined in: [openapi-fetch-middlewares/types/authentications.ts:25](https://github.com/aligent/microservice-development-utilities/blob/e13483771966234032f5249dc36c2c31c71d7cf1/packages/microservice-util-lib/src/openapi-fetch-middlewares/types/authentications.ts#L25)
|
|
10
|
+
|
|
11
|
+
Represents basic authentication credentials.
|
|
12
|
+
|
|
13
|
+
This interface is used for basic authentication, where the username and password
|
|
14
|
+
are retrieved asynchronously.
|
|
15
|
+
|
|
16
|
+
Basic
|
|
17
|
+
|
|
18
|
+
## Properties
|
|
19
|
+
|
|
20
|
+
<a id="credentials"></a>
|
|
21
|
+
|
|
22
|
+
### credentials()
|
|
23
|
+
|
|
24
|
+
> **credentials**: () => `Promise`\<\{ `password`: `string`; `username`: `string`; \}\>
|
|
25
|
+
|
|
26
|
+
Defined in: [openapi-fetch-middlewares/types/authentications.ts:26](https://github.com/aligent/microservice-development-utilities/blob/e13483771966234032f5249dc36c2c31c71d7cf1/packages/microservice-util-lib/src/openapi-fetch-middlewares/types/authentications.ts#L26)
|
|
27
|
+
|
|
28
|
+
A function that returns a promise resolving to the username and password.
|
|
29
|
+
|
|
30
|
+
#### Returns
|
|
31
|
+
|
|
32
|
+
`Promise`\<\{ `password`: `string`; `username`: `string`; \}\>
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
[**@aligent/microservice-util-lib**](../modules.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@aligent/microservice-util-lib](../modules.md) / OAuth10a
|
|
6
|
+
|
|
7
|
+
# Interface: OAuth10a
|
|
8
|
+
|
|
9
|
+
Defined in: [openapi-fetch-middlewares/types/authentications.ts:44](https://github.com/aligent/microservice-development-utilities/blob/e13483771966234032f5249dc36c2c31c71d7cf1/packages/microservice-util-lib/src/openapi-fetch-middlewares/types/authentications.ts#L44)
|
|
10
|
+
|
|
11
|
+
Represents OAuth 1.0a authentication credentials.
|
|
12
|
+
|
|
13
|
+
This interface is used for OAuth 1.0a authentication, where the consumer key, consumer secret,
|
|
14
|
+
token, and token secret are retrieved asynchronously. It also supports optional parameters
|
|
15
|
+
like body hash inclusion, realm, callback, and verifier.
|
|
16
|
+
|
|
17
|
+
OAuth10a
|
|
18
|
+
|
|
19
|
+
## Properties
|
|
20
|
+
|
|
21
|
+
<a id="algorithm"></a>
|
|
22
|
+
|
|
23
|
+
### algorithm
|
|
24
|
+
|
|
25
|
+
> **algorithm**: `"HMAC-SHA1"` \| `"HMAC-SHA256"`
|
|
26
|
+
|
|
27
|
+
Defined in: [openapi-fetch-middlewares/types/authentications.ts:45](https://github.com/aligent/microservice-development-utilities/blob/e13483771966234032f5249dc36c2c31c71d7cf1/packages/microservice-util-lib/src/openapi-fetch-middlewares/types/authentications.ts#L45)
|
|
28
|
+
|
|
29
|
+
The signing algorithm to use.
|
|
30
|
+
|
|
31
|
+
***
|
|
32
|
+
|
|
33
|
+
<a id="callback"></a>
|
|
34
|
+
|
|
35
|
+
### callback?
|
|
36
|
+
|
|
37
|
+
> `optional` **callback**: `string`
|
|
38
|
+
|
|
39
|
+
Defined in: [openapi-fetch-middlewares/types/authentications.ts:54](https://github.com/aligent/microservice-development-utilities/blob/e13483771966234032f5249dc36c2c31c71d7cf1/packages/microservice-util-lib/src/openapi-fetch-middlewares/types/authentications.ts#L54)
|
|
40
|
+
|
|
41
|
+
The callback URL for OAuth 1.0a.
|
|
42
|
+
|
|
43
|
+
***
|
|
44
|
+
|
|
45
|
+
<a id="credentials"></a>
|
|
46
|
+
|
|
47
|
+
### credentials()
|
|
48
|
+
|
|
49
|
+
> **credentials**: () => `Promise`\<\{ `consumerKey`: `string`; `consumerSecret`: `string`; `token`: `string`; `tokenSecret`: `string`; \}\>
|
|
50
|
+
|
|
51
|
+
Defined in: [openapi-fetch-middlewares/types/authentications.ts:46](https://github.com/aligent/microservice-development-utilities/blob/e13483771966234032f5249dc36c2c31c71d7cf1/packages/microservice-util-lib/src/openapi-fetch-middlewares/types/authentications.ts#L46)
|
|
52
|
+
|
|
53
|
+
A function that returns a promise resolving to the OAuth 1.0a credentials.
|
|
54
|
+
|
|
55
|
+
#### Returns
|
|
56
|
+
|
|
57
|
+
`Promise`\<\{ `consumerKey`: `string`; `consumerSecret`: `string`; `token`: `string`; `tokenSecret`: `string`; \}\>
|
|
58
|
+
|
|
59
|
+
***
|
|
60
|
+
|
|
61
|
+
<a id="includebodyhash"></a>
|
|
62
|
+
|
|
63
|
+
### includeBodyHash?
|
|
64
|
+
|
|
65
|
+
> `optional` **includeBodyHash**: `boolean` \| `"auto"`
|
|
66
|
+
|
|
67
|
+
Defined in: [openapi-fetch-middlewares/types/authentications.ts:52](https://github.com/aligent/microservice-development-utilities/blob/e13483771966234032f5249dc36c2c31c71d7cf1/packages/microservice-util-lib/src/openapi-fetch-middlewares/types/authentications.ts#L52)
|
|
68
|
+
|
|
69
|
+
Whether to include a body hash in the signature. Defaults to 'auto'.
|
|
70
|
+
|
|
71
|
+
***
|
|
72
|
+
|
|
73
|
+
<a id="realm"></a>
|
|
74
|
+
|
|
75
|
+
### realm?
|
|
76
|
+
|
|
77
|
+
> `optional` **realm**: `string`
|
|
78
|
+
|
|
79
|
+
Defined in: [openapi-fetch-middlewares/types/authentications.ts:53](https://github.com/aligent/microservice-development-utilities/blob/e13483771966234032f5249dc36c2c31c71d7cf1/packages/microservice-util-lib/src/openapi-fetch-middlewares/types/authentications.ts#L53)
|
|
80
|
+
|
|
81
|
+
The realm parameter for the Authorization header.
|
|
82
|
+
|
|
83
|
+
***
|
|
84
|
+
|
|
85
|
+
<a id="verifier"></a>
|
|
86
|
+
|
|
87
|
+
### verifier?
|
|
88
|
+
|
|
89
|
+
> `optional` **verifier**: `string`
|
|
90
|
+
|
|
91
|
+
Defined in: [openapi-fetch-middlewares/types/authentications.ts:55](https://github.com/aligent/microservice-development-utilities/blob/e13483771966234032f5249dc36c2c31c71d7cf1/packages/microservice-util-lib/src/openapi-fetch-middlewares/types/authentications.ts#L55)
|
|
92
|
+
|
|
93
|
+
The verifier for OAuth 1.0a.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
[**@aligent/microservice-util-lib**](../modules.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@aligent/microservice-util-lib](../modules.md) / OAuth20
|
|
6
|
+
|
|
7
|
+
# Interface: OAuth20
|
|
8
|
+
|
|
9
|
+
Defined in: [openapi-fetch-middlewares/types/authentications.ts:68](https://github.com/aligent/microservice-development-utilities/blob/e13483771966234032f5249dc36c2c31c71d7cf1/packages/microservice-util-lib/src/openapi-fetch-middlewares/types/authentications.ts#L68)
|
|
10
|
+
|
|
11
|
+
Represents OAuth 2.0 authentication credentials.
|
|
12
|
+
|
|
13
|
+
This interface is used for OAuth 2.0 authentication, where an access token is retrieved
|
|
14
|
+
asynchronously. It also supports an optional token type (e.g., 'Bearer').
|
|
15
|
+
|
|
16
|
+
OAuth20
|
|
17
|
+
|
|
18
|
+
## Properties
|
|
19
|
+
|
|
20
|
+
<a id="token"></a>
|
|
21
|
+
|
|
22
|
+
### token()
|
|
23
|
+
|
|
24
|
+
> **token**: () => `Promise`\<`string`\>
|
|
25
|
+
|
|
26
|
+
Defined in: [openapi-fetch-middlewares/types/authentications.ts:69](https://github.com/aligent/microservice-development-utilities/blob/e13483771966234032f5249dc36c2c31c71d7cf1/packages/microservice-util-lib/src/openapi-fetch-middlewares/types/authentications.ts#L69)
|
|
27
|
+
|
|
28
|
+
A function that returns a promise resolving to the access token.
|
|
29
|
+
|
|
30
|
+
#### Returns
|
|
31
|
+
|
|
32
|
+
`Promise`\<`string`\>
|
|
33
|
+
|
|
34
|
+
***
|
|
35
|
+
|
|
36
|
+
<a id="tokentype"></a>
|
|
37
|
+
|
|
38
|
+
### tokenType?
|
|
39
|
+
|
|
40
|
+
> `optional` **tokenType**: `string`
|
|
41
|
+
|
|
42
|
+
Defined in: [openapi-fetch-middlewares/types/authentications.ts:70](https://github.com/aligent/microservice-development-utilities/blob/e13483771966234032f5249dc36c2c31c71d7cf1/packages/microservice-util-lib/src/openapi-fetch-middlewares/types/authentications.ts#L70)
|
|
43
|
+
|
|
44
|
+
The type of the token (e.g., 'Bearer'). Defaults to 'Bearer' if not specified.
|
|
@@ -1,90 +1,101 @@
|
|
|
1
|
+
[**@aligent/microservice-util-lib**](../modules.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
1
5
|
[@aligent/microservice-util-lib](../modules.md) / RetryConfig
|
|
2
6
|
|
|
3
7
|
# Interface: RetryConfig
|
|
4
8
|
|
|
5
|
-
|
|
9
|
+
Defined in: [retry-wrapper/retry-wrapper.ts:2](https://github.com/aligent/microservice-development-utilities/blob/e13483771966234032f5249dc36c2c31c71d7cf1/packages/microservice-util-lib/src/retry-wrapper/retry-wrapper.ts#L2)
|
|
6
10
|
|
|
7
|
-
|
|
11
|
+
Configuration for the retryWrapper
|
|
8
12
|
|
|
9
|
-
|
|
13
|
+
## Properties
|
|
10
14
|
|
|
11
|
-
|
|
12
|
-
- [delay](RetryConfig.md#delay)
|
|
13
|
-
- [onRetry](RetryConfig.md#onretry)
|
|
14
|
-
- [retries](RetryConfig.md#retries)
|
|
15
|
+
<a id="backoffamount"></a>
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
### backoffAmount?
|
|
17
18
|
|
|
18
|
-
|
|
19
|
+
> `optional` **backoffAmount**: `number`
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
Defined in: [retry-wrapper/retry-wrapper.ts:17](https://github.com/aligent/microservice-development-utilities/blob/e13483771966234032f5249dc36c2c31c71d7cf1/packages/microservice-util-lib/src/retry-wrapper/retry-wrapper.ts#L17)
|
|
21
22
|
|
|
22
23
|
The amount to increase the delay by each retry (in ms)
|
|
23
24
|
|
|
24
|
-
|
|
25
|
+
#### Default
|
|
25
26
|
|
|
27
|
+
```ts
|
|
26
28
|
0
|
|
29
|
+
```
|
|
27
30
|
|
|
28
|
-
|
|
31
|
+
***
|
|
29
32
|
|
|
30
|
-
|
|
33
|
+
<a id="delay"></a>
|
|
31
34
|
|
|
32
|
-
|
|
35
|
+
### delay?
|
|
33
36
|
|
|
34
|
-
|
|
37
|
+
> `optional` **delay**: `number`
|
|
35
38
|
|
|
36
|
-
|
|
39
|
+
Defined in: [retry-wrapper/retry-wrapper.ts:12](https://github.com/aligent/microservice-development-utilities/blob/e13483771966234032f5249dc36c2c31c71d7cf1/packages/microservice-util-lib/src/retry-wrapper/retry-wrapper.ts#L12)
|
|
37
40
|
|
|
38
41
|
The base delay between retries (in ms)
|
|
39
42
|
|
|
40
|
-
|
|
43
|
+
#### Default
|
|
41
44
|
|
|
45
|
+
```ts
|
|
42
46
|
0
|
|
47
|
+
```
|
|
43
48
|
|
|
44
|
-
|
|
49
|
+
***
|
|
45
50
|
|
|
46
|
-
|
|
51
|
+
<a id="onretry"></a>
|
|
47
52
|
|
|
48
|
-
|
|
53
|
+
### onRetry()?
|
|
49
54
|
|
|
50
|
-
|
|
55
|
+
> `optional` **onRetry**: (`retries`, `error`, `config`) => `void`
|
|
51
56
|
|
|
52
|
-
|
|
57
|
+
Defined in: [retry-wrapper/retry-wrapper.ts:24](https://github.com/aligent/microservice-development-utilities/blob/e13483771966234032f5249dc36c2c31c71d7cf1/packages/microservice-util-lib/src/retry-wrapper/retry-wrapper.ts#L24)
|
|
53
58
|
|
|
54
|
-
|
|
59
|
+
A callback to run before each retry
|
|
55
60
|
|
|
56
|
-
|
|
61
|
+
#### Parameters
|
|
57
62
|
|
|
58
|
-
|
|
63
|
+
##### retries
|
|
59
64
|
|
|
60
|
-
|
|
65
|
+
`number`
|
|
61
66
|
|
|
62
|
-
|
|
63
|
-
| :------ | :------ | :------ |
|
|
64
|
-
| `retries` | `number` | the number of retries so far (will start at 1) |
|
|
65
|
-
| `error` | `Error` | the error from the last attempt |
|
|
66
|
-
| `config` | [`RetryConfig`](RetryConfig.md) | the configuration supplied to the retryWrapper |
|
|
67
|
+
the number of retries so far (will start at 1)
|
|
67
68
|
|
|
68
|
-
#####
|
|
69
|
+
##### error
|
|
70
|
+
|
|
71
|
+
`Error`
|
|
72
|
+
|
|
73
|
+
the error from the last attempt
|
|
74
|
+
|
|
75
|
+
##### config
|
|
76
|
+
|
|
77
|
+
`RetryConfig`
|
|
78
|
+
|
|
79
|
+
the configuration supplied to the retryWrapper
|
|
80
|
+
|
|
81
|
+
#### Returns
|
|
69
82
|
|
|
70
83
|
`void`
|
|
71
84
|
|
|
72
|
-
|
|
85
|
+
***
|
|
73
86
|
|
|
74
|
-
|
|
87
|
+
<a id="retries"></a>
|
|
75
88
|
|
|
76
|
-
|
|
89
|
+
### retries?
|
|
77
90
|
|
|
78
|
-
|
|
91
|
+
> `optional` **retries**: `number`
|
|
79
92
|
|
|
80
|
-
|
|
93
|
+
Defined in: [retry-wrapper/retry-wrapper.ts:7](https://github.com/aligent/microservice-development-utilities/blob/e13483771966234032f5249dc36c2c31c71d7cf1/packages/microservice-util-lib/src/retry-wrapper/retry-wrapper.ts#L7)
|
|
81
94
|
|
|
82
95
|
The number of retries to attempt after the first run
|
|
83
96
|
|
|
84
|
-
|
|
97
|
+
#### Default
|
|
85
98
|
|
|
99
|
+
```ts
|
|
86
100
|
1
|
|
87
|
-
|
|
88
|
-
#### Defined in
|
|
89
|
-
|
|
90
|
-
[retryWrapper/retryWrapper.ts:7](https://bitbucket.org/aligent/microservice-util-lib/src/5ba81bd/src/retryWrapper/retryWrapper.ts#lines-7)
|
|
101
|
+
```
|