@8ms/helpers 1.1.81 → 1.1.82
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/aws/lambda/initClient.js +2 -2
- package/google/keywordPlanner/request.d.ts +1 -1
- package/initClients.d.ts +1 -1
- package/initClients.js +25 -19
- package/package.json +1 -1
package/aws/lambda/initClient.js
CHANGED
|
@@ -11,9 +11,9 @@ global.awsLambdaClient = null;
|
|
|
11
11
|
*/
|
|
12
12
|
const initClient = ({ config }) => {
|
|
13
13
|
if (!global.awsLambdaClient) {
|
|
14
|
-
const {
|
|
14
|
+
const { LambdaClient } = require('@aws-sdk/client-lambda');
|
|
15
15
|
const formattedConfig = (0, getConfig_1.default)({ config });
|
|
16
|
-
global.awsLambdaClient = new
|
|
16
|
+
global.awsLambdaClient = new LambdaClient(formattedConfig);
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
19
|
exports.default = initClient;
|
package/initClients.d.ts
CHANGED
|
@@ -33,5 +33,5 @@ declare type InitClients = {
|
|
|
33
33
|
/**
|
|
34
34
|
* Function to simplify initialising the clients.
|
|
35
35
|
*/
|
|
36
|
-
declare const initClients: ({ athenaExpress, awsConfig, awsGlue, awsS3, awsSes, awsSsm, deepCrawl, googleAds, googleConfig, googleBigQuery, googleSheets, googleStorage, prisma, }: InitClients) => Promise<void>;
|
|
36
|
+
declare const initClients: ({ athenaExpress, awsConfig, awsGlue, awsLambda, awsS3, awsSes, awsSsm, deepCrawl, googleAds, googleConfig, googleBigQuery, googleSheets, googleStorage, prisma, }: InitClients) => Promise<void>;
|
|
37
37
|
export default initClients;
|
package/initClients.js
CHANGED
|
@@ -5,20 +5,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const initClient_1 = __importDefault(require("./aws/athenaExpress/initClient"));
|
|
7
7
|
const initClient_2 = __importDefault(require("./aws/glue/initClient"));
|
|
8
|
-
const initClient_3 = __importDefault(require("./aws/
|
|
9
|
-
const initClient_4 = __importDefault(require("./aws/
|
|
8
|
+
const initClient_3 = __importDefault(require("./aws/lambda/initClient"));
|
|
9
|
+
const initClient_4 = __importDefault(require("./aws/s3/initClient"));
|
|
10
|
+
const initClient_5 = __importDefault(require("./aws/ses/initClient"));
|
|
10
11
|
const getParameter_1 = __importDefault(require("./aws/ssm/getParameter"));
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
12
|
+
const initClient_6 = __importDefault(require("./aws/ssm/initClient"));
|
|
13
|
+
const initClient_7 = __importDefault(require("./deepCrawl/initClient"));
|
|
14
|
+
const initClient_8 = __importDefault(require("./google/bigQuery/initClient"));
|
|
15
|
+
const initClient_9 = __importDefault(require("./google/sheets/initClient"));
|
|
16
|
+
const initClient_10 = __importDefault(require("./google/storage/initClient"));
|
|
17
|
+
const initClient_11 = __importDefault(require("./googleAds/initClient"));
|
|
18
|
+
const initClient_12 = __importDefault(require("./prisma/initClient"));
|
|
18
19
|
/**
|
|
19
20
|
* Function to simplify initialising the clients.
|
|
20
21
|
*/
|
|
21
|
-
const initClients = async ({ athenaExpress, awsConfig, awsGlue, awsS3, awsSes, awsSsm, deepCrawl, googleAds, googleConfig, googleBigQuery, googleSheets, googleStorage, prisma, }) => {
|
|
22
|
+
const initClients = async ({ athenaExpress, awsConfig, awsGlue, awsLambda, awsS3, awsSes, awsSsm, deepCrawl, googleAds, googleConfig, googleBigQuery, googleSheets, googleStorage, prisma, }) => {
|
|
22
23
|
if (athenaExpress) {
|
|
23
24
|
(0, initClient_1.default)({
|
|
24
25
|
config: awsConfig,
|
|
@@ -32,27 +33,32 @@ const initClients = async ({ athenaExpress, awsConfig, awsGlue, awsS3, awsSes, a
|
|
|
32
33
|
config: awsConfig,
|
|
33
34
|
});
|
|
34
35
|
}
|
|
35
|
-
if (
|
|
36
|
+
if (awsLambda) {
|
|
36
37
|
(0, initClient_3.default)({
|
|
37
38
|
config: awsConfig,
|
|
38
39
|
});
|
|
39
40
|
}
|
|
40
|
-
if (
|
|
41
|
+
if (awsS3) {
|
|
41
42
|
(0, initClient_4.default)({
|
|
42
43
|
config: awsConfig,
|
|
43
44
|
});
|
|
44
45
|
}
|
|
45
|
-
if (
|
|
46
|
+
if (awsSes) {
|
|
46
47
|
(0, initClient_5.default)({
|
|
47
48
|
config: awsConfig,
|
|
48
49
|
});
|
|
49
50
|
}
|
|
51
|
+
if (awsSsm || deepCrawl || googleAds || googleConfig) {
|
|
52
|
+
(0, initClient_6.default)({
|
|
53
|
+
config: awsConfig,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
50
56
|
// Deepcrawl authentication using SSM Parameter
|
|
51
57
|
if (deepCrawl) {
|
|
52
58
|
const deepcrawlParameter = await (0, getParameter_1.default)({
|
|
53
59
|
name: deepCrawl.parameterName,
|
|
54
60
|
});
|
|
55
|
-
await (0,
|
|
61
|
+
await (0, initClient_7.default)({ auth: deepcrawlParameter });
|
|
56
62
|
}
|
|
57
63
|
// Google authentication using SSM
|
|
58
64
|
if (googleConfig) {
|
|
@@ -62,20 +68,20 @@ const initClients = async ({ athenaExpress, awsConfig, awsGlue, awsS3, awsSes, a
|
|
|
62
68
|
});
|
|
63
69
|
// BigQuery
|
|
64
70
|
if (googleBigQuery && googleConfig.projectId) {
|
|
65
|
-
(0,
|
|
71
|
+
(0, initClient_8.default)({
|
|
66
72
|
parameter: googleParameter,
|
|
67
73
|
projectId: googleConfig.projectId,
|
|
68
74
|
});
|
|
69
75
|
}
|
|
70
76
|
// Google Sheets
|
|
71
77
|
if (googleSheets) {
|
|
72
|
-
(0,
|
|
78
|
+
(0, initClient_9.default)({
|
|
73
79
|
parameter: googleParameter,
|
|
74
80
|
});
|
|
75
81
|
}
|
|
76
82
|
// Google Storage
|
|
77
83
|
if (googleStorage && googleConfig.projectId) {
|
|
78
|
-
(0,
|
|
84
|
+
(0, initClient_10.default)({
|
|
79
85
|
parameter: googleParameter,
|
|
80
86
|
projectId: googleConfig.projectId,
|
|
81
87
|
});
|
|
@@ -86,13 +92,13 @@ const initClients = async ({ athenaExpress, awsConfig, awsGlue, awsS3, awsSes, a
|
|
|
86
92
|
const googleAdsParameter = await (0, getParameter_1.default)({
|
|
87
93
|
name: googleAds.parameterName,
|
|
88
94
|
});
|
|
89
|
-
await (0,
|
|
95
|
+
await (0, initClient_11.default)({
|
|
90
96
|
parameter: googleAdsParameter,
|
|
91
97
|
});
|
|
92
98
|
}
|
|
93
99
|
// Initialise Prisma
|
|
94
100
|
if (prisma) {
|
|
95
|
-
(0,
|
|
101
|
+
(0, initClient_12.default)({
|
|
96
102
|
debug: prisma ? false : prisma.debug || false,
|
|
97
103
|
});
|
|
98
104
|
}
|