@things-factory/integration-base 4.3.190 → 4.3.216
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-server/index.js +4 -2
- package/dist-server/index.js.map +1 -1
- package/dist-server/sqs-client.js +25 -0
- package/dist-server/sqs-client.js.map +1 -0
- package/dist-server/sqs-const.js +6 -0
- package/dist-server/sqs-const.js.map +1 -0
- package/dist-server/util/index.js +18 -0
- package/dist-server/util/index.js.map +1 -0
- package/dist-server/util/sqs-send-message.js +11 -0
- package/dist-server/util/sqs-send-message.js.map +1 -0
- package/package.json +3 -2
- package/server/index.ts +5 -3
- package/server/sqs-client.ts +31 -0
- package/server/sqs-const.ts +3 -0
- package/server/util/index.ts +1 -0
- package/server/util/sqs-send-message.ts +9 -0
package/dist-server/index.js
CHANGED
|
@@ -14,10 +14,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
require("./routes");
|
|
18
|
+
require("./restful"); /* APIs */
|
|
19
|
+
__exportStar(require("./sqs-const"), exports);
|
|
17
20
|
__exportStar(require("./migrations"), exports);
|
|
18
21
|
__exportStar(require("./engine"), exports);
|
|
19
22
|
__exportStar(require("./service"), exports);
|
|
20
|
-
require("./
|
|
21
|
-
require("./restful"); /* APIs */
|
|
23
|
+
__exportStar(require("./util"), exports);
|
|
22
24
|
process.on('bootstrap-module-start', async ({ app, config, schema }) => { });
|
|
23
25
|
//# sourceMappingURL=index.js.map
|
package/dist-server/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../server/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA4B;AAC5B,2CAAwB;AACxB,4CAAyB;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../server/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oBAAiB;AACjB,qBAAkB,CAAC,UAAU;AAE7B,8CAA2B;AAC3B,+CAA4B;AAC5B,2CAAwB;AACxB,4CAAyB;AACzB,yCAAsB;AAEtB,OAAO,CAAC,EAAE,CAAC,wBAA+B,EAAE,KAAK,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAO,EAAE,EAAE,GAAE,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const client_sqs_1 = require("@aws-sdk/client-sqs");
|
|
4
|
+
const sqs_const_1 = require("./sqs-const");
|
|
5
|
+
if (sqs_const_1.SQS) {
|
|
6
|
+
const client = new client_sqs_1.SQSClient({
|
|
7
|
+
region: sqs_const_1.SQS.region
|
|
8
|
+
});
|
|
9
|
+
/* send message to sqs */
|
|
10
|
+
sqs_const_1.SQS.sendMessage = async ({ event }) => {
|
|
11
|
+
const { body, deduplicationId, groupId, queueName } = event;
|
|
12
|
+
let messageBody = Object.assign(Object.assign({}, body), { configuration: sqs_const_1.SQS.configuration });
|
|
13
|
+
// Set the parameters
|
|
14
|
+
const params = {
|
|
15
|
+
MessageBody: JSON.stringify(messageBody),
|
|
16
|
+
MessageDeduplicationId: deduplicationId,
|
|
17
|
+
MessageGroupId: groupId,
|
|
18
|
+
QueueUrl: `https://sqs.ap-southeast-1.amazonaws.com/309536469266/${queueName}`
|
|
19
|
+
};
|
|
20
|
+
const data = await client.send(new client_sqs_1.SendMessageCommand(params));
|
|
21
|
+
console.log('Success, message sent. MessageID:', data.MessageId);
|
|
22
|
+
return data;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=sqs-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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;KACnB,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"}
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./sqs-send-message"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/util/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAkC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sqsSendMessage = void 0;
|
|
4
|
+
require("../sqs-client");
|
|
5
|
+
const sqs_const_1 = require("../sqs-const");
|
|
6
|
+
async function sqsSendMessage(param) {
|
|
7
|
+
let result = await sqs_const_1.SQS.sendMessage({ event: param });
|
|
8
|
+
return result;
|
|
9
|
+
}
|
|
10
|
+
exports.sqsSendMessage = sqsSendMessage;
|
|
11
|
+
//# sourceMappingURL=sqs-send-message.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sqs-send-message.js","sourceRoot":"","sources":["../../server/util/sqs-send-message.ts"],"names":[],"mappings":";;;AAAA,yBAAsB;AAEtB,4CAAkC;AAE3B,KAAK,UAAU,cAAc,CAAC,KAAU;IAC7C,IAAI,MAAM,GAAG,MAAM,eAAG,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAA;IAEpD,OAAO,MAAM,CAAA;AACf,CAAC;AAJD,wCAIC"}
|
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.216",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@apollo/client": "^3.5.6",
|
|
28
|
+
"@aws-sdk/client-sqs": "^3.46.0",
|
|
28
29
|
"@things-factory/api": "^4.3.190",
|
|
29
30
|
"@things-factory/auth-base": "^4.3.179",
|
|
30
31
|
"@things-factory/oauth2-client": "^4.3.179",
|
|
@@ -39,5 +40,5 @@
|
|
|
39
40
|
"promise-socket": "^7.0.0",
|
|
40
41
|
"vm2": "^3.9.2"
|
|
41
42
|
},
|
|
42
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "cc38341b8a9b9ef18d70eee81456fc90cf1ce785"
|
|
43
44
|
}
|
package/server/index.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import './routes'
|
|
2
|
+
import './restful' /* APIs */
|
|
3
|
+
|
|
4
|
+
export * from './sqs-const'
|
|
1
5
|
export * from './migrations'
|
|
2
6
|
export * from './engine'
|
|
3
7
|
export * from './service'
|
|
4
|
-
|
|
5
|
-
import './routes'
|
|
6
|
-
import './restful' /* APIs */
|
|
8
|
+
export * from './util'
|
|
7
9
|
|
|
8
10
|
process.on('bootstrap-module-start' as any, async ({ app, config, schema }: any) => {})
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { SendMessageCommand, SQSClient } from '@aws-sdk/client-sqs'
|
|
2
|
+
|
|
3
|
+
import { SQS } from './sqs-const'
|
|
4
|
+
|
|
5
|
+
if (SQS) {
|
|
6
|
+
const client = new SQSClient({
|
|
7
|
+
region: SQS.region
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
/* send message to sqs */
|
|
11
|
+
SQS.sendMessage = async ({ event }) => {
|
|
12
|
+
const { body, deduplicationId, groupId, queueName } = event
|
|
13
|
+
|
|
14
|
+
let messageBody = {
|
|
15
|
+
...body,
|
|
16
|
+
configuration: SQS.configuration
|
|
17
|
+
}
|
|
18
|
+
// Set the parameters
|
|
19
|
+
const params = {
|
|
20
|
+
MessageBody: JSON.stringify(messageBody),
|
|
21
|
+
MessageDeduplicationId: deduplicationId,
|
|
22
|
+
MessageGroupId: groupId,
|
|
23
|
+
QueueUrl: `https://sqs.ap-southeast-1.amazonaws.com/309536469266/${queueName}`
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const data = await client.send(new SendMessageCommand(params))
|
|
27
|
+
console.log('Success, message sent. MessageID:', data.MessageId)
|
|
28
|
+
|
|
29
|
+
return data
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './sqs-send-message'
|