ag-common 0.0.674 → 0.0.675
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.
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { DynamoDBDocument } from '@aws-sdk/lib-dynamodb';
|
|
2
|
+
import type { AwsCredentialIdentity } from '@smithy/types';
|
|
2
3
|
import type { IQueryDynamo, Key } from '../types';
|
|
3
|
-
export declare const setDynamo: (region: string) => DynamoDBDocument;
|
|
4
|
+
export declare const setDynamo: (region: string, credentials?: AwsCredentialIdentity) => DynamoDBDocument;
|
|
4
5
|
export declare let dynamoDb: DynamoDBDocument;
|
|
5
6
|
export declare const putDynamo: <T extends Record<string, any>>(item: T, tableName: string, opt?: {
|
|
6
7
|
/** if provided, will assert this PK value doesnt already exist */
|
|
@@ -22,11 +22,12 @@ const async_1 = require("../../common/helpers/async");
|
|
|
22
22
|
const log_1 = require("../../common/helpers/log");
|
|
23
23
|
const sleep_1 = require("../../common/helpers/sleep");
|
|
24
24
|
const trim_1 = require("../../common/helpers/string/trim");
|
|
25
|
-
const setDynamo = (region) => {
|
|
26
|
-
let raw = new client_dynamodb_1.DynamoDBClient({ region });
|
|
25
|
+
const setDynamo = (region, credentials) => {
|
|
26
|
+
let raw = new client_dynamodb_1.DynamoDBClient({ region, credentials });
|
|
27
27
|
const ddbDocClient = lib_dynamodb_1.DynamoDBDocument.from(raw, {
|
|
28
28
|
marshallOptions: { removeUndefinedValues: true },
|
|
29
29
|
});
|
|
30
|
+
exports.dynamoDb = ddbDocClient;
|
|
30
31
|
return ddbDocClient;
|
|
31
32
|
};
|
|
32
33
|
exports.setDynamo = setDynamo;
|
package/package.json
CHANGED