ag-common 0.0.317 → 0.0.318
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/dist/api/helpers/dynamo.d.ts +2 -2
- package/dist/api/helpers/dynamo.js +6 -6
- package/dist/api/helpers/s3.d.ts +2 -2
- package/dist/api/helpers/s3.js +3 -3
- package/dist/api/helpers/ses.d.ts +2 -2
- package/dist/api/helpers/ses.js +3 -3
- package/dist/api/helpers/sqs.d.ts +2 -2
- package/dist/api/helpers/sqs.js +3 -3
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DYNAMOKEYS, IQueryDynamo, Key } from '../types';
|
|
2
|
-
import
|
|
3
|
-
export declare let dynamoDb:
|
|
2
|
+
import DynamoDB from 'aws-sdk/clients/dynamodb';
|
|
3
|
+
export declare let dynamoDb: DynamoDB.DocumentClient;
|
|
4
4
|
export declare const setDynamo: (region: string) => void;
|
|
5
5
|
export declare const putDynamo: <T>(item: T, tableName: string) => Promise<{
|
|
6
6
|
error?: string | undefined;
|
|
@@ -17,11 +17,11 @@ const log_1 = require("../../common/helpers/log");
|
|
|
17
17
|
const array_1 = require("../../common/helpers/array");
|
|
18
18
|
const sleep_1 = require("../../common/helpers/sleep");
|
|
19
19
|
const async_1 = require("../../common/helpers/async");
|
|
20
|
-
const
|
|
20
|
+
const dynamodb_1 = __importDefault(require("aws-sdk/clients/dynamodb"));
|
|
21
21
|
// eslint-disable-next-line import/no-mutable-exports
|
|
22
|
-
exports.dynamoDb = new
|
|
22
|
+
exports.dynamoDb = new dynamodb_1.default.DocumentClient();
|
|
23
23
|
const setDynamo = (region) => {
|
|
24
|
-
exports.dynamoDb = new
|
|
24
|
+
exports.dynamoDb = new dynamodb_1.default.DocumentClient({ region });
|
|
25
25
|
};
|
|
26
26
|
exports.setDynamo = setDynamo;
|
|
27
27
|
const putDynamo = (item, tableName) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -194,11 +194,11 @@ const getItemsDynamo = ({ tableName, items, }) => __awaiter(void 0, void 0, void
|
|
|
194
194
|
},
|
|
195
195
|
},
|
|
196
196
|
};
|
|
197
|
-
const dbRaw = new
|
|
197
|
+
const dbRaw = new dynamodb_1.default({ apiVersion: '2012-10-08' });
|
|
198
198
|
try {
|
|
199
199
|
const res = yield dbRaw.batchGetItem(params).promise();
|
|
200
200
|
(0, log_1.debug)(`got dynamo getitems=${JSON.stringify(res, null, 2)}`);
|
|
201
|
-
let ret = ((_f = (_e = res.Responses) === null || _e === void 0 ? void 0 : _e[tableName]) === null || _f === void 0 ? void 0 : _f.map((s) =>
|
|
201
|
+
let ret = ((_f = (_e = res.Responses) === null || _e === void 0 ? void 0 : _e[tableName]) === null || _f === void 0 ? void 0 : _f.map((s) => dynamodb_1.default.Converter.unmarshall(s))) || [];
|
|
202
202
|
return ret;
|
|
203
203
|
}
|
|
204
204
|
catch (e) {
|
|
@@ -312,7 +312,7 @@ const getDynamoTtl = (days) => Math.ceil(new Date().getTime() / 1000) + days * 8
|
|
|
312
312
|
exports.getDynamoTtl = getDynamoTtl;
|
|
313
313
|
const wipeTable = (tableName) => __awaiter(void 0, void 0, void 0, function* () {
|
|
314
314
|
var _j;
|
|
315
|
-
const dbRaw = new
|
|
315
|
+
const dbRaw = new dynamodb_1.default({ apiVersion: '2012-10-08' });
|
|
316
316
|
let infoV = yield dbRaw
|
|
317
317
|
.describeTable({
|
|
318
318
|
TableName: tableName,
|
package/dist/api/helpers/s3.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { Blob } from 'aws-sdk/lib/dynamodb/document_client';
|
|
3
|
-
import
|
|
3
|
+
import S3 from 'aws-sdk/clients/s3';
|
|
4
4
|
export declare const setS3: (region: string) => void;
|
|
5
5
|
export declare const getS3Object: ({ fileurl, }: {
|
|
6
6
|
fileurl: {
|
|
7
7
|
Bucket: string;
|
|
8
8
|
Key: string;
|
|
9
9
|
};
|
|
10
|
-
}) => Promise<import("aws-sdk/lib/request").PromiseResult<
|
|
10
|
+
}) => Promise<import("aws-sdk/lib/request").PromiseResult<S3.GetObjectOutput, import("aws-sdk/lib/error").AWSError>>;
|
|
11
11
|
export declare const putS3Object: ({ Body, Bucket, Key, ContentType, }: {
|
|
12
12
|
ContentType?: string | undefined;
|
|
13
13
|
Body: string | Blob;
|
package/dist/api/helpers/s3.js
CHANGED
|
@@ -13,10 +13,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.deleteFile = exports.uploadFile = exports.putS3Object = exports.getS3Object = exports.setS3 = void 0;
|
|
16
|
-
const
|
|
17
|
-
let s3 = new
|
|
16
|
+
const s3_1 = __importDefault(require("aws-sdk/clients/s3"));
|
|
17
|
+
let s3 = new s3_1.default();
|
|
18
18
|
const setS3 = (region) => {
|
|
19
|
-
s3 = new
|
|
19
|
+
s3 = new s3_1.default({ region });
|
|
20
20
|
};
|
|
21
21
|
exports.setS3 = setS3;
|
|
22
22
|
const getS3Object = ({ fileurl, }) => __awaiter(void 0, void 0, void 0, function* () {
|
package/dist/api/helpers/ses.js
CHANGED
|
@@ -13,10 +13,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.sendEmails = exports.sendEmail = exports.setSes = exports.ses = void 0;
|
|
16
|
-
const
|
|
17
|
-
exports.ses = new
|
|
16
|
+
const ses_1 = __importDefault(require("aws-sdk/clients/ses"));
|
|
17
|
+
exports.ses = new ses_1.default();
|
|
18
18
|
const setSes = (region) => {
|
|
19
|
-
exports.ses = new
|
|
19
|
+
exports.ses = new ses_1.default({ region });
|
|
20
20
|
};
|
|
21
21
|
exports.setSes = setSes;
|
|
22
22
|
const sendEmail = ({ to, message, subject, sourceArn, from, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
export declare let sqs:
|
|
1
|
+
import SQS from 'aws-sdk/clients/sqs';
|
|
2
|
+
export declare let sqs: SQS;
|
|
3
3
|
export declare const setSqs: (region: string) => void;
|
|
4
4
|
export declare const sendMessages: <T>(items: T[], queueUrl: string) => Promise<void>;
|
package/dist/api/helpers/sqs.js
CHANGED
|
@@ -14,11 +14,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.sendMessages = exports.setSqs = exports.sqs = void 0;
|
|
16
16
|
const common_1 = require("../../common");
|
|
17
|
-
const
|
|
17
|
+
const sqs_1 = __importDefault(require("aws-sdk/clients/sqs"));
|
|
18
18
|
// eslint-disable-next-line import/no-mutable-exports
|
|
19
|
-
exports.sqs = new
|
|
19
|
+
exports.sqs = new sqs_1.default();
|
|
20
20
|
const setSqs = (region) => {
|
|
21
|
-
exports.sqs = new
|
|
21
|
+
exports.sqs = new sqs_1.default({ region });
|
|
22
22
|
};
|
|
23
23
|
exports.setSqs = setSqs;
|
|
24
24
|
const sendMessages = (items, queueUrl) => __awaiter(void 0, void 0, void 0, function* () {
|