@plusscommunities/pluss-maintenance-aws-forms 2.1.32 → 2.1.33-beta.0
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/feature.config.js +8 -0
- package/jobTypesChanged.js +55 -0
- package/package.json +3 -3
- package/values.config.a.js +1 -0
- package/values.config.default.js +1 -0
- package/values.config.enquiry.js +1 -0
- package/values.config.feedback.js +1 -0
- package/values.config.food.js +1 -0
- package/values.config.forms.js +1 -0
- package/values.config.js +1 -0
- package/package-lock.json +0 -8051
package/feature.config.js
CHANGED
|
@@ -155,6 +155,14 @@ exports.serverless = {
|
|
|
155
155
|
timeout: 300,
|
|
156
156
|
table: values.tableKeyMaintenance,
|
|
157
157
|
},
|
|
158
|
+
{
|
|
159
|
+
name: "jobTypesChanged",
|
|
160
|
+
file: "jobTypesChanged",
|
|
161
|
+
function: "jobTypesChanged",
|
|
162
|
+
memorySize: 512,
|
|
163
|
+
timeout: 60,
|
|
164
|
+
table: values.tableKeyJobTypes,
|
|
165
|
+
},
|
|
158
166
|
],
|
|
159
167
|
schedules: [
|
|
160
168
|
{
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DynamoDB Stream Handler for JobTypes changes
|
|
3
|
+
*
|
|
4
|
+
* Republishes any templates using this site as source.
|
|
5
|
+
* Only notifies siteConfigs for variants with enableSiteConfigsPropagation: true
|
|
6
|
+
* (maintenance and maintenanceForms). Other variants (feedback, enquiry) are excluded.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
const { Marshaller } = require("@aws/dynamodb-auto-marshaller");
|
|
10
|
+
const marshaller = new Marshaller();
|
|
11
|
+
const { log } = require("@plusscommunities/pluss-core-aws/helper");
|
|
12
|
+
const notifySiteConfigs = require("@plusscommunities/pluss-core-aws/helper/notifySiteConfigs");
|
|
13
|
+
const { values } = require("./values.config");
|
|
14
|
+
|
|
15
|
+
module.exports.jobTypesChanged = async (event, context, callback) => {
|
|
16
|
+
const logId = log("jobTypesChanged", "Start", { recordCount: event.Records.length, serviceKey: values.serviceKey });
|
|
17
|
+
|
|
18
|
+
// Check if this variant supports siteConfigs propagation
|
|
19
|
+
if (!values.enableSiteConfigsPropagation) {
|
|
20
|
+
log("jobTypesChanged", "SkipPropagation", { serviceKey: values.serviceKey }, logId);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const promises = [];
|
|
25
|
+
|
|
26
|
+
event.Records.forEach((record) => {
|
|
27
|
+
log("jobTypesChanged", "Record", { eventName: record.eventName }, logId);
|
|
28
|
+
|
|
29
|
+
if (record.eventName === "INSERT") {
|
|
30
|
+
const data = marshaller.unmarshallItem(record.dynamodb.NewImage);
|
|
31
|
+
log("jobTypesChanged", "Insert", { id: data.id, site: data.site }, logId);
|
|
32
|
+
|
|
33
|
+
if (data.site) {
|
|
34
|
+
promises.push(notifySiteConfigs(data.site, logId));
|
|
35
|
+
}
|
|
36
|
+
} else if (record.eventName === "MODIFY") {
|
|
37
|
+
const data = marshaller.unmarshallItem(record.dynamodb.NewImage);
|
|
38
|
+
log("jobTypesChanged", "Modify", { id: data.id, site: data.site }, logId);
|
|
39
|
+
|
|
40
|
+
if (data.site) {
|
|
41
|
+
promises.push(notifySiteConfigs(data.site, logId));
|
|
42
|
+
}
|
|
43
|
+
} else if (record.eventName === "REMOVE") {
|
|
44
|
+
const previousData = marshaller.unmarshallItem(record.dynamodb.OldImage);
|
|
45
|
+
log("jobTypesChanged", "Remove", { id: previousData.id, site: previousData.site }, logId);
|
|
46
|
+
|
|
47
|
+
if (previousData.site) {
|
|
48
|
+
promises.push(notifySiteConfigs(previousData.site, logId));
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
await Promise.all(promises);
|
|
54
|
+
log("jobTypesChanged", "Complete", { promiseCount: promises.length }, logId);
|
|
55
|
+
};
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plusscommunities/pluss-maintenance-aws-forms",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.33-beta.0",
|
|
4
4
|
"description": "Extension package to enable maintenance on Pluss Communities Platform",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"gc": "node ../../tools/gc ./",
|
|
7
|
-
"gs": "node ../../tools/gs ./ ../../
|
|
7
|
+
"gs": "node ../../tools/gs ./ ../../strings/serverless.yml",
|
|
8
8
|
"betapatch": "npm version prepatch --preid=beta",
|
|
9
9
|
"patch": "npm version patch",
|
|
10
10
|
"deploy": "npm run gc && npm run gs && serverless deploy",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"license": "ISC",
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@aws/dynamodb-auto-marshaller": "^0.7.1",
|
|
27
|
-
"@plusscommunities/pluss-core-aws": "2.0.
|
|
27
|
+
"@plusscommunities/pluss-core-aws": "2.0.24-beta.0",
|
|
28
28
|
"amazon-cognito-identity-js": "^2.0.19",
|
|
29
29
|
"aws-sdk": "^2.1591.0",
|
|
30
30
|
"axios": "^1.6.8",
|
package/values.config.a.js
CHANGED
package/values.config.default.js
CHANGED
package/values.config.enquiry.js
CHANGED
package/values.config.food.js
CHANGED
package/values.config.forms.js
CHANGED