dbm-graph-api 1.1.25 → 1.1.27
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dbm-graph-api",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.27",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@aws-sdk/client-s3": "^3.741.0",
|
|
15
15
|
"@aws-sdk/s3-request-presigner": "^3.741.0",
|
|
16
|
-
"dbm": "^1.1.
|
|
16
|
+
"dbm": "^1.1.22",
|
|
17
17
|
"mime": "^4.0.6",
|
|
18
18
|
"sharp": "^0.33.5",
|
|
19
19
|
"ws": "^8.18.0"
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import Dbm from "dbm";
|
|
2
|
+
|
|
3
|
+
export default class SubmitForm extends Dbm.core.BaseObject {
|
|
4
|
+
_construct() {
|
|
5
|
+
super._construct();
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
async performAction(aData, aEncodeSession) {
|
|
9
|
+
let returnObject = {};
|
|
10
|
+
|
|
11
|
+
let database = Dbm.getInstance().repository.getItem("graphDatabase").controller;
|
|
12
|
+
|
|
13
|
+
let typeName = aData["type"];
|
|
14
|
+
|
|
15
|
+
let formSubmission = await database.createObject("private", ["formSubmission"]);
|
|
16
|
+
|
|
17
|
+
await formSubmission.updateField("data", aData["data"]);
|
|
18
|
+
await formSubmission.updateField("submissionTime", (new Date()).toISOString());
|
|
19
|
+
|
|
20
|
+
let form = await database.getIdentifiableObject("form", typeName);
|
|
21
|
+
await formSubmission.addIncomingRelation(form, "for");
|
|
22
|
+
|
|
23
|
+
let actionType = await database.getTypeObject("type/actionType", "handleFormSubmission");
|
|
24
|
+
|
|
25
|
+
let actionStatus = await database.getTypeObject("status/actionStatus", "readyToProcess");
|
|
26
|
+
let action = await database.createObject("private", ["action"]);
|
|
27
|
+
|
|
28
|
+
await action.addOutgoingRelation(formSubmission, "from");
|
|
29
|
+
await action.addIncomingRelation(actionType, "for");
|
|
30
|
+
await action.addIncomingRelation(actionStatus, "for");
|
|
31
|
+
|
|
32
|
+
returnObject["id"] = formSubmission.id;
|
|
33
|
+
|
|
34
|
+
return returnObject;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -249,6 +249,7 @@ export let registerActionFunction = function(aName, aDataFunction) {
|
|
|
249
249
|
|
|
250
250
|
let fullActionSetup = function() {
|
|
251
251
|
registerActionFunction("example", new DbmGraphApi.action.Example());
|
|
252
|
+
registerActionFunction("submitForm", new DbmGraphApi.action.SubmitForm());
|
|
252
253
|
registerActionFunction("incomingWebhook", new DbmGraphApi.action.IncomingWebhook());
|
|
253
254
|
registerActionFunction("cron/processActions", new DbmGraphApi.action.cron.ProcessActions());
|
|
254
255
|
registerActionFunction("admin/addAndProcessAction", new DbmGraphApi.action.admin.AddAndProcessAction());
|
|
@@ -273,6 +274,8 @@ export let registerProcessActionFunction = function(aName, aDataFunction) {
|
|
|
273
274
|
|
|
274
275
|
let fullProcessActionSetup = function() {
|
|
275
276
|
registerProcessActionFunction("example", new DbmGraphApi.processAction.Example());
|
|
277
|
+
|
|
278
|
+
registerProcessActionFunction("handleFormSubmission", new DbmGraphApi.processAction.HandleFormSubmission());
|
|
276
279
|
}
|
|
277
280
|
|
|
278
281
|
export {fullProcessActionSetup};
|
|
@@ -720,6 +723,14 @@ export const setupSite = function(aServer) {
|
|
|
720
723
|
}
|
|
721
724
|
}
|
|
722
725
|
|
|
726
|
+
if(fields["contentPreloadTags"]){
|
|
727
|
+
let currentArray = fields["contentPreloadTags"];
|
|
728
|
+
let currentArrayLength = currentArray.length;
|
|
729
|
+
for(let i = 0; i < currentArrayLength; i++) {
|
|
730
|
+
returnString += currentArray[i];
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
|
|
723
734
|
if(site.disableSearchEngines) {
|
|
724
735
|
returnString += `<meta name="robots" content="noindex, nofollow" />`;
|
|
725
736
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import Dbm from "dbm";
|
|
2
|
+
|
|
3
|
+
export default class HandleFormSubmission extends Dbm.core.BaseObject {
|
|
4
|
+
_construct() {
|
|
5
|
+
super._construct();
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
async process(aAction) {
|
|
9
|
+
console.log("HandleFormSubmission:process");
|
|
10
|
+
console.log(aAction);
|
|
11
|
+
|
|
12
|
+
let formSubmission = await aAction.singleObjectRelationQuery("out:from:formSubmission");
|
|
13
|
+
let form = await formSubmission.singleObjectRelationQuery("in:for:form");
|
|
14
|
+
let formName = await form.getIdentifier();
|
|
15
|
+
console.log(formSubmission);
|
|
16
|
+
|
|
17
|
+
let formHandler = Dbm.getInstance().repository.getItem("formHandlers/" + formName);
|
|
18
|
+
console.log(formHandler);
|
|
19
|
+
|
|
20
|
+
if(formHandler.handle) {
|
|
21
|
+
formHandler.handle(formSubmission);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
//METODO: add logs
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export {default as Example} from "./Example.js";
|
|
1
|
+
export {default as Example} from "./Example.js";
|
|
2
|
+
export {default as HandleFormSubmission} from "./HandleFormSubmission.js";
|