You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* The Parameters utility provides an AppConfigProvider that allows to retrieve configuration profiles from AWS AppConfig.
19
-
*
20
-
* ## Getting started
20
+
* The Parameters utility provides an `AppConfigProvider` that allows to retrieve configuration profiles from AWS AppConfig.
21
21
*
22
22
* This utility supports AWS SDK v3 for JavaScript only (`@aws-sdk/client-appconfigdata`). This allows the utility to be modular, and you to install only
23
23
* the SDK packages you need and keep your bundle size small.
24
24
*
25
-
* ## Basic usage
25
+
* **Basic usage**
26
26
*
27
27
* @example
28
28
* ```typescript
@@ -41,9 +41,7 @@ import type {
41
41
* ```
42
42
* If you want to retrieve configs without customizing the provider, you can use the {@link getAppConfig} function instead.
43
43
*
44
-
* ## Advanced usage
45
-
*
46
-
* ### Caching
44
+
* **Caching**
47
45
*
48
46
* By default, the provider will cache parameters retrieved in-memory for 5 seconds.
49
47
* You can adjust how long values should be kept in cache by using the `maxAge` parameter.
@@ -82,7 +80,7 @@ import type {
82
80
* };
83
81
* ```
84
82
*
85
-
* ### Transformations
83
+
* **Transformations**
86
84
*
87
85
* For configurations stored as freeform JSON, Freature Flag, you can use the transform argument for deserialization. This will return a JavaScript object instead of a string.
88
86
*
@@ -118,7 +116,7 @@ import type {
118
116
* };
119
117
* ```
120
118
*
121
-
* ### Extra SDK options
119
+
* **Extra SDK options**
122
120
*
123
121
* When retrieving a configuration profile, you can pass extra options to the AWS SDK v3 for JavaScript client by using the `sdkOptions` parameter.
124
122
*
@@ -144,7 +142,7 @@ import type {
144
142
*
145
143
* This object accepts the same options as the [AWS SDK v3 for JavaScript AppConfigData client](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-appconfigdata/interfaces/startconfigurationsessioncommandinput.html).
146
144
*
147
-
* ### Customize AWS SDK v3 for JavaScript client
145
+
* **Customize AWS SDK v3 for JavaScript client**
148
146
*
149
147
* By default, the provider will create a new AppConfigData client using the default configuration.
150
148
*
@@ -193,9 +191,14 @@ class AppConfigProvider extends BaseProvider {
193
191
privatereadonlyenvironment: string;
194
192
195
193
/**
196
-
* It initializes the AppConfigProvider class.
197
-
* *
198
-
* @param {AppConfigProviderOptions} options - The configuration object.
194
+
* initializes an `AppConfigProvider` class instance.
195
+
*
196
+
* @param options - The configuration object.
197
+
* @param options.environment - The environment ID or the environment name.
198
+
* @param options.application - Optional application ID or the application name.
199
+
* @param options.clientConfig - Optional configuration to pass during client initialization, e.g. AWS region. Mutually exclusive with `awsSdkV3Client`. Accepts the same configuration object as the AWS SDK v3 client ({@link AppConfigDataClientConfig | `AppConfigDataClientConfig`}).
200
+
* @param options.awsSdkV3Client - Optional ({@link AppConfigDataClient | `AppConfigDataClient`}) instance to pass during `AppConfigProvider` class instantiation. Mutually exclusive with `clientConfig`.
* @param name - The name of the configuration profile or its ID
244
+
* @param options - Options to configure the provider
245
+
* @param options.maxAge - Maximum age of the value in the cache, in seconds.
246
+
* @param options.forceFetch - Force fetch the value from the parameter store, ignoring the cache.
247
+
* @param options.sdkOptions - Additional options to pass to the AWS SDK v3 client. Supports all options from {@link StartConfigurationSessionCommandInput | `StartConfigurationSessionCommandInput`} except `ApplicationIdentifier`, `EnvironmentIdentifier`, and `ConfigurationProfileIdentifier`.
248
+
* @param options.transform - Optional transform to be applied, can be 'json' or 'binary'.
249
249
*/
250
-
publicasyncget<
250
+
publicget<
251
251
ExplicitUserProvidedType=undefined,
252
252
InferredFromOptionsTypeextends
253
253
|AppConfigGetOptions
@@ -287,8 +287,12 @@ class AppConfigProvider extends BaseProvider {
287
287
* polls the configuration multiple times, we return the most recent value by returning the cached
288
288
* one if an empty response is returned by AppConfig.
289
289
*
290
-
* @param {string} name - Name of the configuration or its ID
291
-
* @param {AppConfigGetOptions} options - SDK options to propagate to `StartConfigurationSession` API call
290
+
* @param name - Name of the configuration or its ID
291
+
* @param options - SDK options to propagate to `StartConfigurationSession` API call
292
+
* @param options.maxAge - Maximum age of the value in the cache, in seconds.
293
+
* @param options.forceFetch - Force fetch the value from the parameter store, ignoring the cache.
294
+
* @param options.sdkOptions - Additional options to pass to the AWS SDK v3 client. Supports all options from {@link StartConfigurationSessionCommandInput | `StartConfigurationSessionCommandInput`} except `ApplicationIdentifier`, `EnvironmentIdentifier`, and `ConfigurationProfileIdentifier`.
295
+
* @param options.transform - Optional transform to be applied, can be 'json' or 'binary'.
292
296
*/
293
297
protectedasync_get(
294
298
name: string,
@@ -339,7 +343,7 @@ class AppConfigProvider extends BaseProvider {
339
343
/** When the response is not empty, stash the result locally before returning
Copy file name to clipboardExpand all lines: packages/parameters/src/dynamodb/DynamoDBProvider.ts
+45-41Lines changed: 45 additions & 41 deletions
Original file line number
Diff line number
Diff line change
@@ -18,15 +18,12 @@ import type {
18
18
}from'../types/DynamoDBProvider.js';
19
19
20
20
/**
21
-
* ## Intro
22
-
* The Parameters utility provides a DynamoDBProvider that allows to retrieve values from Amazon DynamoDB.
23
-
*
24
-
* ## Getting started
21
+
* The Parameters utility provides a `DynamoDBProvider` that allows to retrieve values from Amazon DynamoDB.
25
22
*
26
23
* This utility supports AWS SDK v3 for JavaScript only (`@aws-sdk/client-dynamodb` and `@aws-sdk/util-dynamodb`). This allows the utility to be modular, and you to install only
27
24
* the SDK packages you need and keep your bundle size small.
28
25
*
29
-
* ## Basic usage
26
+
* **Basic usage**
30
27
*
31
28
* Retrieve a value from DynamoDB:
32
29
*
@@ -60,9 +57,7 @@ import type {
60
57
* };
61
58
* ```
62
59
*
63
-
* ## Advanced usage
64
-
*
65
-
* ### Caching
60
+
* **Caching**
66
61
*
67
62
* By default, the provider will cache parameters retrieved in-memory for 5 seconds.
68
63
* You can adjust how long values should be kept in cache by using the `maxAge` parameter.
@@ -101,7 +96,7 @@ import type {
101
96
* };
102
97
* ```
103
98
*
104
-
* ### Transformations
99
+
* **Transformations**
105
100
*
106
101
* For values stored as JSON you can use the transform argument for deserialization. This will return a JavaScript object instead of a string.
107
102
*
@@ -157,7 +152,7 @@ import type {
157
152
* };
158
153
* ```
159
154
*
160
-
* ### Custom key names
155
+
* **Custom key names**
161
156
*
162
157
* By default, the provider will use the following key names: `id` for the partition key, `sk` for the sort key, and `value` for the value.
163
158
* You can adjust the key names by using the `keyAttr`, `sortAttr`, and `valueAttr` parameters.
@@ -174,7 +169,7 @@ import type {
174
169
* });
175
170
* ```
176
171
*
177
-
* ### Extra SDK options
172
+
* **Extra SDK options**
178
173
*
179
174
* When retrieving values, you can pass extra options to the AWS SDK v3 for JavaScript client by using the `sdkOptions` parameter.
180
175
*
@@ -198,7 +193,7 @@ import type {
198
193
*
199
194
* The objects accept the same options as respectively the [AWS SDK v3 for JavaScript PutItem command](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-dynamodb/classes/putitemcommand.html) and the [AWS SDK v3 for JavaScript DynamoDB client Query command](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-dynamodb/classes/querycommand.html).
200
195
*
201
-
* ### Customize AWS SDK v3 for JavaScript client
196
+
* **Customize AWS SDK v3 for JavaScript client**
202
197
*
203
198
* By default, the provider will create a new DynamoDB client using the default configuration.
204
199
*
@@ -240,9 +235,15 @@ class DynamoDBProvider extends BaseProvider {
240
235
protectedvalueAttr='value';
241
236
242
237
/**
243
-
* It initializes the DynamoDBProvider class.
238
+
* Initialize a DynamoDBProvider class instance.
244
239
*
245
-
* @param {DynamoDBProviderOptions} config - The configuration object.
240
+
* @param config - The configuration object.
241
+
* @param config.tableName - The DynamoDB table name.
* @param config.valueAttr - Optional DynamoDB table value attribute name. Defaults to 'value'.
245
+
* @param config.clientConfig - Optional configuration to pass during client initialization, e.g. AWS region. Mutually exclusive with `awsSdkV3Client`, accepts the same options as the AWS SDK v3 client ({@link DynamoDBClient | `DynamoDBClient`}).
246
+
* @param config.awsSdkV3Client - Optional AWS SDK v3 client to pass during DynamoDBProvider class instantiation. Mutually exclusive with `clientConfig`, should be an instance of {@link DynamoDBClient | `DynamoDBClient`}.
* @param name - The name of the value to retrieve (i.e. the partition key)
283
+
* @param options - Options to configure the provider
284
+
* @param options.maxAge - Maximum age of the value in the cache, in seconds.
285
+
* @param options.forceFetch - Force fetch the value from the parameter store, ignoring the cache.
286
+
* @param options.sdkOptions - Additional options to pass to the AWS SDK v3 client, supports all options from {@link GetItemCommandInput | `GetItemCommandInput`} except `Key`, `TableName`, and `ProjectionExpression`.
287
+
* @param options.transform - Transform to be applied, can be 'json' or 'binary'.
290
288
*/
291
-
publicasyncget<
289
+
publicget<
292
290
ExplicitUserProvidedType=undefined,
293
291
InferredFromOptionsTypeextends
294
292
|DynamoDBGetOptions
@@ -323,20 +321,17 @@ class DynamoDBProvider extends BaseProvider {
323
321
* };
324
322
* ```
325
323
*
326
-
* You can customize the retrieval of the values by passing options to the function:
327
-
* * `maxAge` - The maximum age of the value in cache before fetching a new one (in seconds) (default: 5)
328
-
* * `forceFetch` - Whether to always fetch a new value from the store regardless if already available in cache
329
-
* * `transform` - Whether to transform the value before returning it. Supported values: `json`, `binary`
330
-
* * `sdkOptions` - Extra options to pass to the AWS SDK v3 for JavaScript client
331
-
* * `throwOnTransformError` - Whether to throw an error if the transform fails (default: `true`)
332
-
*
333
-
* For usage examples check {@link DynamoDBProvider}.
334
-
*
335
-
* @param {string} path - The path of the values to retrieve (i.e. the partition key)
336
-
* @param {DynamoDBGetMultipleOptions} options - Options to configure the provider
* @param path - The path of the values to retrieve (i.e. the partition key)
327
+
* @param options - Options to configure the provider
328
+
* @param options.maxAge - Maximum age of the value in the cache, in seconds.
329
+
* @param options.forceFetch - Force fetch the value from the parameter store, ignoring the cache.
330
+
* @param options.sdkOptions - Additional options to pass to the AWS SDK v3 client, supports all options from {@link QueryCommandInput | `QueryCommandInput`} except `TableName` and `KeyConditionExpression`.
331
+
* @param options.transform - Transform to be applied, can be 'json' or 'binary'.
332
+
* @param options.throwOnTransformError - Whether to throw an error if the transform fails (default: `true`)
338
333
*/
339
-
publicasyncgetMultiple<
334
+
publicgetMultiple<
340
335
ExplicitUserProvidedType=undefined,
341
336
InferredFromOptionsTypeextends
342
337
|DynamoDBGetMultipleOptions
@@ -363,8 +358,12 @@ class DynamoDBProvider extends BaseProvider {
363
358
/**
364
359
* Retrieve an item from Amazon DynamoDB.
365
360
*
366
-
* @param {string} name - Key of the item to retrieve (i.e. the partition key)
367
-
* @param {DynamoDBGetOptions} options - Options to customize the retrieval
361
+
* @param name - Key of the item to retrieve (i.e. the partition key)
362
+
* @param options - Options to customize the retrieval
363
+
* @param options.maxAge - Maximum age of the value in the cache, in seconds.
364
+
* @param options.sdkOptions - Additional options to pass to the AWS SDK v3 client, supports all options from {@link GetItemCommandInput | `GetItemCommandInput`} except `Key`, `TableName`, and `ProjectionExpression`.
365
+
* @param params.forceFetch - Force fetch the value from the parameter store, ignoring the cache.
366
+
* @param options.transform - Transform to be applied, can be 'json' or 'binary'.
368
367
*/
369
368
protectedasync_get(
370
369
name: string,
@@ -387,8 +386,13 @@ class DynamoDBProvider extends BaseProvider {
387
386
/**
388
387
* Retrieve multiple items from Amazon DynamoDB.
389
388
*
390
-
* @param {string} path - The path of the values to retrieve (i.e. the partition key)
391
-
* @param {DynamoDBGetMultipleOptions} options - Options to customize the retrieval
389
+
* @param path - The path of the values to retrieve (i.e. the partition key)
390
+
* @param options - Options to customize the retrieval
391
+
* @param options.maxAge - Maximum age of the value in the cache, in seconds.
392
+
* @param options.forceFetch - Force fetch the value from the parameter store, ignoring the cache.
393
+
* @param options.sdkOptions - Additional options to pass to the AWS SDK v3 client, supports all options from {@link QueryCommandInput | `QueryCommandInput`} except `TableName` and `KeyConditionExpression`.
394
+
* @param options.transform - Transform to be applied, can be 'json' or 'binary'.
395
+
* @param options.throwOnTransformError - Whether to throw an error if the transform fails (default: `true`)
0 commit comments