@things-factory/integration-base 4.3.424 → 4.3.425
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,42 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const client_secrets_manager_1 = require("@aws-sdk/client-secrets-manager");
|
|
4
3
|
const client_sqs_1 = require("@aws-sdk/client-sqs");
|
|
5
4
|
const sqs_const_1 = require("./sqs-const");
|
|
6
5
|
if (sqs_const_1.SQS) {
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
13
|
-
const command = new client_secrets_manager_1.GetSecretValueCommand(secretManagerParams);
|
|
14
|
-
try {
|
|
15
|
-
const data = await secretManager.send(command);
|
|
16
|
-
const dataSecretString = data.SecretString;
|
|
17
|
-
if (dataSecretString) {
|
|
18
|
-
const secretString = JSON.parse(dataSecretString);
|
|
19
|
-
return { accessKeyId: secretString.accessKeyId, secretAccessKey: secretString.secretAccessKey };
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
catch (error) {
|
|
26
|
-
console.log(`[SFTP Get Secret]: ${error}`);
|
|
6
|
+
const client = new client_sqs_1.SQSClient({
|
|
7
|
+
region: sqs_const_1.SQS.region,
|
|
8
|
+
credentials: {
|
|
9
|
+
accessKeyId: sqs_const_1.SQS.accessKeyId,
|
|
10
|
+
secretAccessKey: sqs_const_1.SQS.secretAccessKey
|
|
27
11
|
}
|
|
28
|
-
};
|
|
12
|
+
});
|
|
29
13
|
/* send message to sqs */
|
|
30
14
|
sqs_const_1.SQS.sendMessage = async ({ event }) => {
|
|
31
15
|
const { body, deduplicationId, groupId, queueName } = event;
|
|
32
|
-
const { accessKeyId, secretAccessKey } = await getAWSSecret();
|
|
33
|
-
const client = new client_sqs_1.SQSClient({
|
|
34
|
-
region: sqs_const_1.AWSCREDENTIAL.region,
|
|
35
|
-
credentials: {
|
|
36
|
-
accessKeyId: accessKeyId,
|
|
37
|
-
secretAccessKey: secretAccessKey
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
16
|
let messageBody = Object.assign(Object.assign({}, body), { configuration: sqs_const_1.SQS.configuration });
|
|
41
17
|
// Set the parameters
|
|
42
18
|
const params = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqs-client.js","sourceRoot":"","sources":["../server/sqs-client.ts"],"names":[],"mappings":";;AAAA,
|
|
1
|
+
{"version":3,"file":"sqs-client.js","sourceRoot":"","sources":["../server/sqs-client.ts"],"names":[],"mappings":";;AAAA,oDAAmE;AAEnE,2CAAiC;AAEjC,IAAI,eAAG,EAAE;IACP,MAAM,MAAM,GAAG,IAAI,sBAAS,CAAC;QAC3B,MAAM,EAAE,eAAG,CAAC,MAAM;QAClB,WAAW,EAAE;YACX,WAAW,EAAE,eAAG,CAAC,WAAW;YAC5B,eAAe,EAAE,eAAG,CAAC,eAAe;SACrC;KACF,CAAC,CAAA;IAEF,yBAAyB;IACzB,eAAG,CAAC,WAAW,GAAG,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE;QACpC,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,KAAK,CAAA;QAE3D,IAAI,WAAW,mCACV,IAAI,KACP,aAAa,EAAE,eAAG,CAAC,aAAa,GACjC,CAAA;QACD,qBAAqB;QACrB,MAAM,MAAM,GAAG;YACb,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC;YACxC,sBAAsB,EAAE,eAAe;YACvC,cAAc,EAAE,OAAO;YACvB,QAAQ,EAAE,yDAAyD,SAAS,EAAE;SAC/E,CAAA;QAED,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,IAAI,+BAAkB,CAAC,MAAM,CAAC,CAAC,CAAA;QAC9D,OAAO,CAAC,GAAG,CAAC,mCAAmC,EAAE,IAAI,CAAC,SAAS,CAAC,CAAA;QAEhE,OAAO,IAAI,CAAA;IACb,CAAC,CAAA;CACF"}
|
package/dist-server/sqs-const.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.SQS = void 0;
|
|
4
4
|
const env_1 = require("@things-factory/env");
|
|
5
5
|
exports.SQS = env_1.config.get('awsSqs');
|
|
6
|
-
exports.AWSCREDENTIAL = env_1.config.get('awsCredential');
|
|
7
6
|
//# sourceMappingURL=sqs-const.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqs-const.js","sourceRoot":"","sources":["../server/sqs-const.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAEjC,QAAA,GAAG,GAAQ,YAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA
|
|
1
|
+
{"version":3,"file":"sqs-const.js","sourceRoot":"","sources":["../server/sqs-const.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAEjC,QAAA,GAAG,GAAQ,YAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/integration-base",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.425",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -26,11 +26,10 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@apollo/client": "^3.5.6",
|
|
28
28
|
"@aws-sdk/client-lambda": "3.513.0",
|
|
29
|
-
"@aws-sdk/client-secrets-manager": "^3.46.0",
|
|
30
29
|
"@aws-sdk/client-sqs": "^3.46.0",
|
|
31
|
-
"@things-factory/api": "^4.3.
|
|
32
|
-
"@things-factory/auth-base": "^4.3.
|
|
33
|
-
"@things-factory/oauth2-client": "^4.3.
|
|
30
|
+
"@things-factory/api": "^4.3.425",
|
|
31
|
+
"@things-factory/auth-base": "^4.3.425",
|
|
32
|
+
"@things-factory/oauth2-client": "^4.3.425",
|
|
34
33
|
"@things-factory/shell": "^4.3.381",
|
|
35
34
|
"async-mqtt": "^2.5.0",
|
|
36
35
|
"cron": "^1.7.2",
|
|
@@ -42,5 +41,5 @@
|
|
|
42
41
|
"promise-socket": "^7.0.0",
|
|
43
42
|
"vm2": "^3.9.2"
|
|
44
43
|
},
|
|
45
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "43a4d63f2d8411e2f7446c3627dbf8acafbd3c44"
|
|
46
45
|
}
|
package/server/sqs-client.ts
CHANGED
|
@@ -1,43 +1,19 @@
|
|
|
1
|
-
import { GetSecretValueCommand, SecretsManagerClient } from '@aws-sdk/client-secrets-manager'
|
|
2
1
|
import { SendMessageCommand, SQSClient } from '@aws-sdk/client-sqs'
|
|
3
2
|
|
|
4
|
-
import {
|
|
3
|
+
import { SQS } from './sqs-const'
|
|
5
4
|
|
|
6
5
|
if (SQS) {
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
const client = new SQSClient({
|
|
7
|
+
region: SQS.region,
|
|
8
|
+
credentials: {
|
|
9
|
+
accessKeyId: SQS.accessKeyId,
|
|
10
|
+
secretAccessKey: SQS.secretAccessKey
|
|
12
11
|
}
|
|
13
|
-
|
|
14
|
-
try {
|
|
15
|
-
const data: any = await secretManager.send(command)
|
|
16
|
-
const dataSecretString: any = data.SecretString
|
|
17
|
-
if (dataSecretString) {
|
|
18
|
-
const secretString = JSON.parse(dataSecretString)
|
|
19
|
-
|
|
20
|
-
return { accessKeyId: secretString.accessKeyId, secretAccessKey: secretString.secretAccessKey }
|
|
21
|
-
} else {
|
|
22
|
-
return null
|
|
23
|
-
}
|
|
24
|
-
} catch (error) {
|
|
25
|
-
console.log(`[SFTP Get Secret]: ${error}`)
|
|
26
|
-
}
|
|
27
|
-
}
|
|
12
|
+
})
|
|
28
13
|
|
|
29
14
|
/* send message to sqs */
|
|
30
15
|
SQS.sendMessage = async ({ event }) => {
|
|
31
16
|
const { body, deduplicationId, groupId, queueName } = event
|
|
32
|
-
const { accessKeyId, secretAccessKey } = await getAWSSecret()
|
|
33
|
-
|
|
34
|
-
const client = new SQSClient({
|
|
35
|
-
region: AWSCREDENTIAL.region,
|
|
36
|
-
credentials: {
|
|
37
|
-
accessKeyId: accessKeyId,
|
|
38
|
-
secretAccessKey: secretAccessKey
|
|
39
|
-
}
|
|
40
|
-
})
|
|
41
17
|
|
|
42
18
|
let messageBody = {
|
|
43
19
|
...body,
|
package/server/sqs-const.ts
CHANGED