@aligent/microservice-util-lib 0.2.2 → 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.
Files changed (71) hide show
  1. package/README.md +2 -2
  2. package/docs/classes/S3Dao.md +102 -107
  3. package/docs/functions/apiKeyAuthMiddleware.md +37 -0
  4. package/docs/functions/basicAuthMiddleware.md +37 -0
  5. package/docs/functions/chunkBy.md +43 -0
  6. package/docs/functions/fetchSsmParams.md +61 -0
  7. package/docs/functions/getAwsIdFromArn.md +37 -0
  8. package/docs/functions/hasDefinedProperties.md +57 -0
  9. package/docs/functions/oAuth10aAuthMiddleware.md +43 -0
  10. package/docs/functions/oAuth20AuthMiddleware.md +37 -0
  11. package/docs/functions/remap.md +71 -0
  12. package/docs/functions/retryWrapper.md +46 -0
  13. package/docs/interfaces/ApiKey.md +44 -0
  14. package/docs/interfaces/Basic.md +32 -0
  15. package/docs/interfaces/OAuth10a.md +93 -0
  16. package/docs/interfaces/OAuth20.md +44 -0
  17. package/docs/interfaces/RetryConfig.md +53 -42
  18. package/docs/modules.md +21 -267
  19. package/docs/type-aliases/ObjectMap.md +13 -0
  20. package/docs/type-aliases/Remap.md +21 -0
  21. package/package.json +15 -40
  22. package/{dist/chunkBy/chunkBy.js → src/chunk-by/chunk-by.js} +3 -4
  23. package/{dist/fetchSsmParams/fetchSsmParams.d.ts → src/fetch-ssm-params/fetch-ssm-params.d.ts} +2 -2
  24. package/src/fetch-ssm-params/fetch-ssm-params.js +28 -0
  25. package/src/get-aws-id-from-arn/get-aws-id-from-arn.d.ts +12 -0
  26. package/src/get-aws-id-from-arn/get-aws-id-from-arn.js +20 -0
  27. package/{dist/hasPropertiesDefined/hasPropertiesDefined.js → src/has-properties-defined/has-properties-defined.js} +2 -8
  28. package/src/index.d.ts +10 -0
  29. package/src/index.js +24 -0
  30. package/src/openapi-fetch-middlewares/authentications.d.ts +66 -0
  31. package/src/openapi-fetch-middlewares/authentications.js +96 -0
  32. package/src/openapi-fetch-middlewares/oauth10a/oauth10a.d.ts +12 -0
  33. package/src/openapi-fetch-middlewares/oauth10a/oauth10a.js +209 -0
  34. package/src/openapi-fetch-middlewares/types/authentications.d.ts +71 -0
  35. package/src/openapi-fetch-middlewares/types/authentications.js +2 -0
  36. package/{dist → src}/remap/remap.d.ts +6 -6
  37. package/src/remap/remap.js +97 -0
  38. package/{dist/retryWrapper/retryWrapper.d.ts → src/retry-wrapper/retry-wrapper.d.ts} +1 -1
  39. package/src/retry-wrapper/retry-wrapper.js +56 -0
  40. package/{dist → src}/s3/s3.d.ts +3 -6
  41. package/src/s3/s3.js +86 -0
  42. package/dist/chunkBy/chunkBy.js.map +0 -1
  43. package/dist/chunkBy/chunkBy.test.d.ts +0 -1
  44. package/dist/chunkBy/chunkBy.test.js +0 -17
  45. package/dist/chunkBy/chunkBy.test.js.map +0 -1
  46. package/dist/fetchSsmParams/fetchSsmParams.js +0 -80
  47. package/dist/fetchSsmParams/fetchSsmParams.js.map +0 -1
  48. package/dist/fetchSsmParams/fetchSsmParams.test.d.ts +0 -1
  49. package/dist/fetchSsmParams/fetchSsmParams.test.js +0 -110
  50. package/dist/fetchSsmParams/fetchSsmParams.test.js.map +0 -1
  51. package/dist/hasPropertiesDefined/hasPropertiesDefined.js.map +0 -1
  52. package/dist/hasPropertiesDefined/hasPropertiesDefined.test.d.ts +0 -1
  53. package/dist/hasPropertiesDefined/hasPropertiesDefined.test.js +0 -37
  54. package/dist/hasPropertiesDefined/hasPropertiesDefined.test.js.map +0 -1
  55. package/dist/index.d.ts +0 -7
  56. package/dist/index.js +0 -19
  57. package/dist/index.js.map +0 -1
  58. package/dist/remap/remap.js +0 -50
  59. package/dist/remap/remap.js.map +0 -1
  60. package/dist/remap/remap.test.d.ts +0 -1
  61. package/dist/remap/remap.test.js +0 -65
  62. package/dist/remap/remap.test.js.map +0 -1
  63. package/dist/retryWrapper/retryWrapper.js +0 -121
  64. package/dist/retryWrapper/retryWrapper.js.map +0 -1
  65. package/dist/retryWrapper/retryWrapper.test.d.ts +0 -1
  66. package/dist/retryWrapper/retryWrapper.test.js +0 -234
  67. package/dist/retryWrapper/retryWrapper.test.js.map +0 -1
  68. package/dist/s3/s3.js +0 -192
  69. package/dist/s3/s3.js.map +0 -1
  70. /package/{dist/chunkBy/chunkBy.d.ts → src/chunk-by/chunk-by.d.ts} +0 -0
  71. /package/{dist/hasPropertiesDefined/hasPropertiesDefined.d.ts → src/has-properties-defined/has-properties-defined.d.ts} +0 -0
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Microservices Utilities Library
2
2
 
3
- This library includes utility functions to simplify & standardise common
3
+ This library includes utility functions to simplify & standardise common
4
4
  MicroServices tasks.
5
5
 
6
6
  ## Documentation
@@ -29,7 +29,7 @@ from your project root.
29
29
 
30
30
  ## Testing & Linting
31
31
 
32
- Jest tests, linting & type-checking can be run with
32
+ Vitest tests, linting & type-checking can be run with
33
33
 
34
34
  ```sh
35
35
  npm run test
@@ -1,206 +1,201 @@
1
- [@aligent/microservice-util-lib](../modules.md) / S3Dao
2
-
3
- # Class: S3Dao
4
-
5
- A data access object for an S3 bucket
6
-
7
- ## Table of contents
1
+ [**@aligent/microservice-util-lib**](../modules.md)
8
2
 
9
- ### Constructors
3
+ ***
10
4
 
11
- - [constructor](S3Dao.md#constructor)
12
-
13
- ### Properties
5
+ [@aligent/microservice-util-lib](../modules.md) / S3Dao
14
6
 
15
- - [bucket](S3Dao.md#bucket)
16
- - [s3](S3Dao.md#s3)
7
+ # Class: S3Dao
17
8
 
18
- ### Methods
9
+ Defined in: [s3/s3.ts:12](https://github.com/aligent/microservice-development-utilities/blob/e13483771966234032f5249dc36c2c31c71d7cf1/packages/microservice-util-lib/src/s3/s3.ts#L12)
19
10
 
20
- - [deleteData](S3Dao.md#deletedata)
21
- - [fetchChunks](S3Dao.md#fetchchunks)
22
- - [fetchData](S3Dao.md#fetchdata)
23
- - [storeChunked](S3Dao.md#storechunked)
24
- - [storeData](S3Dao.md#storedata)
11
+ A data access object for an S3 bucket
25
12
 
26
13
  ## Constructors
27
14
 
28
- ### <a id="constructor" name="constructor"></a> constructor
15
+ <a id="constructor"></a>
29
16
 
30
- **new S3Dao**(`bucket`)
17
+ ### Constructor
31
18
 
32
- #### Parameters
19
+ > **new S3Dao**(`bucket`): `S3Dao`
33
20
 
34
- | Name | Type | Description |
35
- | :------ | :------ | :------ |
36
- | `bucket` | `string` | the location of the bucket that objects should be stored in |
21
+ Defined in: [s3/s3.ts:19](https://github.com/aligent/microservice-development-utilities/blob/e13483771966234032f5249dc36c2c31c71d7cf1/packages/microservice-util-lib/src/s3/s3.ts#L19)
37
22
 
38
- #### Defined in
39
-
40
- [s3/s3.ts:19](https://bitbucket.org/aligent/microservice-util-lib/src/c978f6c/src/s3/s3.ts#lines-19)
41
-
42
- ## Properties
43
-
44
- ### <a id="bucket" name="bucket"></a> bucket
45
-
46
- • `Private` **bucket**: `string`
23
+ #### Parameters
47
24
 
48
- #### Defined in
25
+ ##### bucket
49
26
 
50
- [s3/s3.ts:14](https://bitbucket.org/aligent/microservice-util-lib/src/c978f6c/src/s3/s3.ts#lines-14)
27
+ `string`
51
28
 
52
- ___
29
+ the location of the bucket that objects should be stored in
53
30
 
54
- ### <a id="s3" name="s3"></a> s3
31
+ #### Returns
55
32
 
56
- `Private` **s3**: `S3Client`
33
+ `S3Dao`
57
34
 
58
- #### Defined in
35
+ ## Methods
59
36
 
60
- [s3/s3.ts:13](https://bitbucket.org/aligent/microservice-util-lib/src/c978f6c/src/s3/s3.ts#lines-13)
37
+ <a id="deletedata"></a>
61
38
 
62
- ## Methods
39
+ ### deleteData()
63
40
 
64
- ### <a id="deletedata" name="deletedata"></a> deleteData
41
+ > **deleteData**(`objectDetails`): `Promise`\<`DeleteObjectCommandOutput`\>
65
42
 
66
- **deleteData**(`objectDetails`): `Promise`<`DeleteObjectCommandOutput`\>
43
+ Defined in: [s3/s3.ts:100](https://github.com/aligent/microservice-development-utilities/blob/e13483771966234032f5249dc36c2c31c71d7cf1/packages/microservice-util-lib/src/s3/s3.ts#L100)
67
44
 
68
45
  Delete an object from the S3 bucket
69
46
 
70
47
  #### Parameters
71
48
 
72
- | Name | Type | Description |
73
- | :------ | :------ | :------ |
74
- | `objectDetails` | `GetObjectCommandInput` | the object to delete |
49
+ ##### objectDetails
50
+
51
+ `GetObjectCommandInput`
52
+
53
+ the object to delete
75
54
 
76
55
  #### Returns
77
56
 
78
- `Promise`<`DeleteObjectCommandOutput`\>
57
+ `Promise`\<`DeleteObjectCommandOutput`\>
79
58
 
80
- #### Defined in
59
+ ***
81
60
 
82
- [s3/s3.ts:97](https://bitbucket.org/aligent/microservice-util-lib/src/c978f6c/src/s3/s3.ts#lines-97)
61
+ <a id="fetchchunks"></a>
83
62
 
84
- ___
63
+ ### fetchChunks()
85
64
 
86
- ### <a id="fetchchunks" name="fetchchunks"></a> fetchChunks
65
+ > **fetchChunks**\<`T`\>(`chunks`): `AsyncGenerator`\<\{ `chunk`: `T`; `s3Object`: `undefined` \| `GetObjectCommandInput`; \}, `Awaited`\<`T`\>, `unknown`\>
87
66
 
88
- **fetchChunks**<`T`\>(`chunks`): `AsyncGenerator`<{ `chunk`: `T` ; `s3Object`: `GetObjectCommandInput` }, { `chunk`: `T` ; `s3Object`: `GetObjectCommandInput` }, `unknown`\>
67
+ Defined in: [s3/s3.ts:81](https://github.com/aligent/microservice-development-utilities/blob/e13483771966234032f5249dc36c2c31c71d7cf1/packages/microservice-util-lib/src/s3/s3.ts#L81)
89
68
 
90
69
  Generator to fetch chunked data, chunk by chunk
91
70
 
92
- #### Type parameters
71
+ #### Type Parameters
93
72
 
94
- | Name |
95
- | :------ |
96
- | `T` |
73
+ ##### T
74
+
75
+ `T`
97
76
 
98
77
  #### Parameters
99
78
 
100
- | Name | Type | Description |
101
- | :------ | :------ | :------ |
102
- | `chunks` | `GetObjectCommandInput`[] | the list of object chunks |
79
+ ##### chunks
80
+
81
+ `GetObjectCommandInput`[]
82
+
83
+ the list of object chunks
103
84
 
104
85
  #### Returns
105
86
 
106
- `AsyncGenerator`<{ `chunk`: `T` ; `s3Object`: `GetObjectCommandInput` }, { `chunk`: `T` ; `s3Object`: `GetObjectCommandInput` }, `unknown`\>
87
+ `AsyncGenerator`\<\{ `chunk`: `T`; `s3Object`: `undefined` \| `GetObjectCommandInput`; \}, `Awaited`\<`T`\>, `unknown`\>
107
88
 
108
- #### Defined in
89
+ ***
109
90
 
110
- [s3/s3.ts:77](https://bitbucket.org/aligent/microservice-util-lib/src/c978f6c/src/s3/s3.ts#lines-77)
91
+ <a id="fetchdata"></a>
111
92
 
112
- ___
93
+ ### fetchData()
113
94
 
114
- ### <a id="fetchdata" name="fetchdata"></a> fetchData
95
+ > **fetchData**\<`T`\>(`objectDetails`): `Promise`\<`T`\>
115
96
 
116
- **fetchData**<`T`\>(`objectDetails`): `Promise`<`T`\>
97
+ Defined in: [s3/s3.ts:66](https://github.com/aligent/microservice-development-utilities/blob/e13483771966234032f5249dc36c2c31c71d7cf1/packages/microservice-util-lib/src/s3/s3.ts#L66)
117
98
 
118
99
  Fetch an object from the S3 bucket
119
100
 
120
- #### Type parameters
101
+ #### Type Parameters
121
102
 
122
- | Name |
123
- | :------ |
124
- | `T` |
103
+ ##### T
104
+
105
+ `T`
125
106
 
126
107
  #### Parameters
127
108
 
128
- | Name | Type | Description |
129
- | :------ | :------ | :------ |
130
- | `objectDetails` | `GetObjectCommandInput` | the object which describes the location of the object |
109
+ ##### objectDetails
110
+
111
+ `GetObjectCommandInput`
112
+
113
+ the object which describes the location of the object
131
114
 
132
115
  #### Returns
133
116
 
134
- `Promise`<`T`\>
117
+ `Promise`\<`T`\>
135
118
 
136
119
  the body of the object
137
120
 
138
- #### Defined in
121
+ ***
139
122
 
140
- [s3/s3.ts:67](https://bitbucket.org/aligent/microservice-util-lib/src/c978f6c/src/s3/s3.ts#lines-67)
123
+ <a id="storechunked"></a>
141
124
 
142
- ___
125
+ ### storeChunked()
143
126
 
144
- ### <a id="storechunked" name="storechunked"></a> storeChunked
127
+ > **storeChunked**\<`T`\>(`data`, `chunkSize`): `Promise`\<`GetObjectCommandInput`[]\>
145
128
 
146
- **storeChunked**<`T`\>(`data`, `chunkSize`): `Promise`<`GetObjectCommandInput`[]\>
129
+ Defined in: [s3/s3.ts:56](https://github.com/aligent/microservice-development-utilities/blob/e13483771966234032f5249dc36c2c31c71d7cf1/packages/microservice-util-lib/src/s3/s3.ts#L56)
147
130
 
148
131
  Store an array of object as individual chunks in S3
149
132
 
150
- #### Type parameters
133
+ #### Type Parameters
134
+
135
+ ##### T
151
136
 
152
- | Name | Type |
153
- | :------ | :------ |
154
- | `T` | extends `any`[] |
137
+ `T` *extends* `unknown`[]
155
138
 
156
139
  #### Parameters
157
140
 
158
- | Name | Type | Description |
159
- | :------ | :------ | :------ |
160
- | `data` | `T` | the data to store |
161
- | `chunkSize` | `number` | the number of entries that should be in each chunk |
141
+ ##### data
142
+
143
+ `T`
144
+
145
+ the data to store
146
+
147
+ ##### chunkSize
148
+
149
+ `number`
150
+
151
+ the number of entries that should be in each chunk
162
152
 
163
153
  #### Returns
164
154
 
165
- `Promise`<`GetObjectCommandInput`[]\>
155
+ `Promise`\<`GetObjectCommandInput`[]\>
166
156
 
167
157
  an array of objects which can be used to fetch the chunks
168
158
 
169
- #### Defined in
159
+ ***
170
160
 
171
- [s3/s3.ts:57](https://bitbucket.org/aligent/microservice-util-lib/src/c978f6c/src/s3/s3.ts#lines-57)
161
+ <a id="storedata"></a>
172
162
 
173
- ___
163
+ ### storeData()
174
164
 
175
- ### <a id="storedata" name="storedata"></a> storeData
165
+ > **storeData**\<`T`\>(`data`, `name`?): `Promise`\<`GetObjectCommandInput`\>
176
166
 
177
- **storeData**<`T`\>(`data`, `name?`): `Promise`<`GetObjectCommandInput`\>
167
+ Defined in: [s3/s3.ts:30](https://github.com/aligent/microservice-development-utilities/blob/e13483771966234032f5249dc36c2c31c71d7cf1/packages/microservice-util-lib/src/s3/s3.ts#L30)
178
168
 
179
169
  Store data in an S3 bucket
180
170
 
181
- **`Default`**
171
+ #### Type Parameters
182
172
 
183
- the hash of the data
173
+ ##### T
184
174
 
185
- #### Type parameters
186
-
187
- | Name |
188
- | :------ |
189
- | `T` |
175
+ `T`
190
176
 
191
177
  #### Parameters
192
178
 
193
- | Name | Type | Description |
194
- | :------ | :------ | :------ |
195
- | `data` | `T` | the data to store |
196
- | `name?` | `string` | the name to call the object in S3 |
179
+ ##### data
180
+
181
+ `T`
182
+
183
+ the data to store
184
+
185
+ ##### name?
186
+
187
+ `string`
188
+
189
+ the name to call the object in S3
197
190
 
198
191
  #### Returns
199
192
 
200
- `Promise`<`GetObjectCommandInput`\>
193
+ `Promise`\<`GetObjectCommandInput`\>
201
194
 
202
195
  an object which can be used to fetch the data
203
196
 
204
- #### Defined in
197
+ #### Default
205
198
 
206
- [s3/s3.ts:30](https://bitbucket.org/aligent/microservice-util-lib/src/c978f6c/src/s3/s3.ts#lines-30)
199
+ ```ts
200
+ the hash of the data
201
+ ```
@@ -0,0 +1,37 @@
1
+ [**@aligent/microservice-util-lib**](../modules.md)
2
+
3
+ ***
4
+
5
+ [@aligent/microservice-util-lib](../modules.md) / apiKeyAuthMiddleware
6
+
7
+ # Function: apiKeyAuthMiddleware()
8
+
9
+ > **apiKeyAuthMiddleware**(`config`): `Middleware`
10
+
11
+ Defined in: [openapi-fetch-middlewares/authentications.ts:18](https://github.com/aligent/microservice-development-utilities/blob/e13483771966234032f5249dc36c2c31c71d7cf1/packages/microservice-util-lib/src/openapi-fetch-middlewares/authentications.ts#L18)
12
+
13
+ Creates an openapi-fetch middleware for API key authentication.
14
+ This middleware sets the API key in the specified header for each request.
15
+
16
+ ## Parameters
17
+
18
+ ### config
19
+
20
+ [`ApiKey`](../interfaces/ApiKey.md)
21
+
22
+ The configuration for API key authentication.
23
+
24
+ ## Returns
25
+
26
+ `Middleware`
27
+
28
+ The middleware for API key authentication.
29
+
30
+ ## Example
31
+
32
+ ```ts
33
+ const middleware = apiKeyAuthMiddleware({
34
+ header: 'x-api-key',
35
+ value: async () => 'your-api-key',
36
+ });
37
+ ```
@@ -0,0 +1,37 @@
1
+ [**@aligent/microservice-util-lib**](../modules.md)
2
+
3
+ ***
4
+
5
+ [@aligent/microservice-util-lib](../modules.md) / basicAuthMiddleware
6
+
7
+ # Function: basicAuthMiddleware()
8
+
9
+ > **basicAuthMiddleware**(`config`): `Middleware`
10
+
11
+ Defined in: [openapi-fetch-middlewares/authentications.ts:39](https://github.com/aligent/microservice-development-utilities/blob/e13483771966234032f5249dc36c2c31c71d7cf1/packages/microservice-util-lib/src/openapi-fetch-middlewares/authentications.ts#L39)
12
+
13
+ Creates an openapi-fetch middleware for Basic authentication.
14
+ This middleware sets the `Authorization` header with the Basic authentication credentials
15
+ (username and password) for each request.
16
+
17
+ ## Parameters
18
+
19
+ ### config
20
+
21
+ [`Basic`](../interfaces/Basic.md)
22
+
23
+ The configuration for Basic authentication.
24
+
25
+ ## Returns
26
+
27
+ `Middleware`
28
+
29
+ The middleware for Basic authentication.
30
+
31
+ ## Example
32
+
33
+ ```ts
34
+ const middleware = basicAuthMiddleware({
35
+ credentials: async () => ({ username: 'user', password: 'pass' }),
36
+ });
37
+ ```
@@ -0,0 +1,43 @@
1
+ [**@aligent/microservice-util-lib**](../modules.md)
2
+
3
+ ***
4
+
5
+ [@aligent/microservice-util-lib](../modules.md) / chunkBy
6
+
7
+ # Function: chunkBy()
8
+
9
+ > **chunkBy**\<`ArrayItem`\>(`source`, `chunkSize`): `ArrayItem`[][]
10
+
11
+ Defined in: [chunk-by/chunk-by.ts:10](https://github.com/aligent/microservice-development-utilities/blob/e13483771966234032f5249dc36c2c31c71d7cf1/packages/microservice-util-lib/src/chunk-by/chunk-by.ts#L10)
12
+
13
+ Split an array into chunks of a certain size
14
+
15
+ ## Type Parameters
16
+
17
+ ### ArrayItem
18
+
19
+ `ArrayItem`
20
+
21
+ ## Parameters
22
+
23
+ ### source
24
+
25
+ `ArrayItem`[]
26
+
27
+ the array to split up
28
+
29
+ ### chunkSize
30
+
31
+ `number`
32
+
33
+ the size of each chunk. (The final chunk will be whatever is remaining)
34
+
35
+ ## Returns
36
+
37
+ `ArrayItem`[][]
38
+
39
+ ## Example
40
+
41
+ ```ts
42
+ chunkBy([1, 2, 3, 4, 5, 6, 7], 2) // [[1, 2], [3, 4], [5, 6], [7]]
43
+ ```
@@ -0,0 +1,61 @@
1
+ [**@aligent/microservice-util-lib**](../modules.md)
2
+
3
+ ***
4
+
5
+ [@aligent/microservice-util-lib](../modules.md) / fetchSsmParams
6
+
7
+ # Function: fetchSsmParams()
8
+
9
+ Fetch SSM Parameters
10
+
11
+ ## Param
12
+
13
+ the keys of the parameters to fetch
14
+
15
+ ## Call Signature
16
+
17
+ > **fetchSsmParams**(`param`): `Promise`\<`undefined` \| `Parameter`\>
18
+
19
+ Defined in: [fetch-ssm-params/fetch-ssm-params.ts:14](https://github.com/aligent/microservice-development-utilities/blob/e13483771966234032f5249dc36c2c31c71d7cf1/packages/microservice-util-lib/src/fetch-ssm-params/fetch-ssm-params.ts#L14)
20
+
21
+ Fetch one SSM parameter
22
+
23
+ ### Parameters
24
+
25
+ #### param
26
+
27
+ `string`
28
+
29
+ key of the parameter to fetch
30
+
31
+ ### Returns
32
+
33
+ `Promise`\<`undefined` \| `Parameter`\>
34
+
35
+ ### Param
36
+
37
+ the keys of the parameters to fetch
38
+
39
+ ## Call Signature
40
+
41
+ > **fetchSsmParams**(...`params`): `Promise`\<(`undefined` \| `Parameter`)[]\>
42
+
43
+ Defined in: [fetch-ssm-params/fetch-ssm-params.ts:20](https://github.com/aligent/microservice-development-utilities/blob/e13483771966234032f5249dc36c2c31c71d7cf1/packages/microservice-util-lib/src/fetch-ssm-params/fetch-ssm-params.ts#L20)
44
+
45
+ Fetch a list of SSM parameters
46
+
47
+ ### Parameters
48
+
49
+ #### params
50
+
51
+ ...`string`[]
52
+
53
+ list of parameter keys to fetch
54
+
55
+ ### Returns
56
+
57
+ `Promise`\<(`undefined` \| `Parameter`)[]\>
58
+
59
+ ### Param
60
+
61
+ the keys of the parameters to fetch
@@ -0,0 +1,37 @@
1
+ [**@aligent/microservice-util-lib**](../modules.md)
2
+
3
+ ***
4
+
5
+ [@aligent/microservice-util-lib](../modules.md) / getAwsIdFromArn
6
+
7
+ # Function: getAwsIdFromArn()
8
+
9
+ > **getAwsIdFromArn**(`resourceArn`): `string`
10
+
11
+ Defined in: [get-aws-id-from-arn/get-aws-id-from-arn.ts:11](https://github.com/aligent/microservice-development-utilities/blob/e13483771966234032f5249dc36c2c31c71d7cf1/packages/microservice-util-lib/src/get-aws-id-from-arn/get-aws-id-from-arn.ts#L11)
12
+
13
+ Get the AWS ID from its resource ARN
14
+
15
+ ## Parameters
16
+
17
+ ### resourceArn
18
+
19
+ `string`
20
+
21
+ the ARN of the AWS resource
22
+
23
+ ## Returns
24
+
25
+ `string`
26
+
27
+ the ID (if present in the ARN) of the AWS resource/execution
28
+
29
+ ## Throws
30
+
31
+ when the provided ARN is empty
32
+
33
+ ## Example
34
+
35
+ ```ts
36
+ getAwsIdFromArn('arn:aws:states:ap-southeast-2:123123123:execution:prj-int-entity-ac-dc-dev-machine-name:this-is-the-id')
37
+ ```
@@ -0,0 +1,57 @@
1
+ [**@aligent/microservice-util-lib**](../modules.md)
2
+
3
+ ***
4
+
5
+ [@aligent/microservice-util-lib](../modules.md) / hasDefinedProperties
6
+
7
+ # Function: hasDefinedProperties()
8
+
9
+ > **hasDefinedProperties**\<`T`, `K`\>(`obj`, ...`keys`): `obj is SimplifyIntersection<Required<Pick<T, K>> & Omit<T, K>>`
10
+
11
+ Defined in: [has-properties-defined/has-properties-defined.ts:23](https://github.com/aligent/microservice-development-utilities/blob/e13483771966234032f5249dc36c2c31c71d7cf1/packages/microservice-util-lib/src/has-properties-defined/has-properties-defined.ts#L23)
12
+
13
+ Ensure that the given properties are defined on the object.
14
+
15
+ ## Type Parameters
16
+
17
+ ### T
18
+
19
+ `T` *extends* `object`
20
+
21
+ ### K
22
+
23
+ `K` *extends* `string` \| `number` \| `symbol`
24
+
25
+ ## Parameters
26
+
27
+ ### obj
28
+
29
+ The object to check.
30
+
31
+ `object` | `T`
32
+
33
+ ### keys
34
+
35
+ ...`K`[]
36
+
37
+ The keys to check.
38
+
39
+ ## Returns
40
+
41
+ `obj is SimplifyIntersection<Required<Pick<T, K>> & Omit<T, K>>`
42
+
43
+ `true` if the object has the given properties defined, `false` otherwise.
44
+
45
+ ## Example
46
+
47
+ ```ts
48
+ type Foo = { a?: number; b?: number };
49
+ const foo: Foo = { a: 1, b: 2 };
50
+ if (hasDefinedProperties(foo, 'a')) {
51
+ console.log(foo);
52
+ // ^? const bar: {
53
+ // a: number;
54
+ // b?: number;
55
+ // }
56
+ }
57
+ ```
@@ -0,0 +1,43 @@
1
+ [**@aligent/microservice-util-lib**](../modules.md)
2
+
3
+ ***
4
+
5
+ [@aligent/microservice-util-lib](../modules.md) / oAuth10aAuthMiddleware
6
+
7
+ # Function: oAuth10aAuthMiddleware()
8
+
9
+ > **oAuth10aAuthMiddleware**(`config`): `Middleware`
10
+
11
+ Defined in: [openapi-fetch-middlewares/authentications.ts:71](https://github.com/aligent/microservice-development-utilities/blob/e13483771966234032f5249dc36c2c31c71d7cf1/packages/microservice-util-lib/src/openapi-fetch-middlewares/authentications.ts#L71)
12
+
13
+ Creates an openapi-fetch middleware for OAuth 1.0a authentication.
14
+ This middleware generates OAuth 1.0a parameters and sets the `Authorization` header
15
+ for each request.
16
+
17
+ ## Parameters
18
+
19
+ ### config
20
+
21
+ [`OAuth10a`](../interfaces/OAuth10a.md)
22
+
23
+ The configuration for OAuth 1.0a authentication.
24
+
25
+ ## Returns
26
+
27
+ `Middleware`
28
+
29
+ The middleware for OAuth 1.0a authentication.
30
+
31
+ ## Example
32
+
33
+ ```ts
34
+ const middleware = oAuth10aAuthMiddleware({
35
+ algorithm: 'HMAC-SHA256',
36
+ credentials: async () => ({
37
+ consumerKey: 'key',
38
+ consumerSecret: 'secret',
39
+ token: 'token',
40
+ tokenSecret: 'tokenSecret',
41
+ }),
42
+ });
43
+ ```
@@ -0,0 +1,37 @@
1
+ [**@aligent/microservice-util-lib**](../modules.md)
2
+
3
+ ***
4
+
5
+ [@aligent/microservice-util-lib](../modules.md) / oAuth20AuthMiddleware
6
+
7
+ # Function: oAuth20AuthMiddleware()
8
+
9
+ > **oAuth20AuthMiddleware**(`options`): `Middleware`
10
+
11
+ Defined in: [openapi-fetch-middlewares/authentications.ts:94](https://github.com/aligent/microservice-development-utilities/blob/e13483771966234032f5249dc36c2c31c71d7cf1/packages/microservice-util-lib/src/openapi-fetch-middlewares/authentications.ts#L94)
12
+
13
+ Creates an openapi-fetch middleware for OAuth 2.0 authentication.
14
+ This middleware sets the `Authorization` header with the OAuth 2.0 token for each request.
15
+
16
+ ## Parameters
17
+
18
+ ### options
19
+
20
+ [`OAuth20`](../interfaces/OAuth20.md)
21
+
22
+ The configuration for OAuth 2.0 authentication.
23
+
24
+ ## Returns
25
+
26
+ `Middleware`
27
+
28
+ The middleware for OAuth 2.0 authentication.
29
+
30
+ ## Example
31
+
32
+ ```ts
33
+ const middleware = oAuth20AuthMiddleware({
34
+ token: async () => 'your-access-token',
35
+ tokenType: 'Bearer',
36
+ });
37
+ ```