dbm-graph-api 1.1.30 → 1.1.32

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.
Files changed (25) hide show
  1. package/package.json +2 -2
  2. package/src/dbm-graph-api/WebSocketConnection.js +10 -2
  3. package/src/dbm-graph-api/action/admin/AddAndProcessAction.js +3 -2
  4. package/src/dbm-graph-api/action/admin/AddUser.js +20 -24
  5. package/src/dbm-graph-api/action/admin/SetPassword.js +35 -0
  6. package/src/dbm-graph-api/action/admin/index.js +1 -0
  7. package/src/dbm-graph-api/admin/edit/AddAction.js +15 -0
  8. package/src/dbm-graph-api/admin/edit/ReplaceOutgoingRelation.js +1 -1
  9. package/src/dbm-graph-api/admin/edit/SetFieldTranslation.js +12 -0
  10. package/src/dbm-graph-api/admin/edit/index.js +14 -0
  11. package/src/dbm-graph-api/index.js +22 -1
  12. package/src/dbm-graph-api/processAction/index.js +2 -0
  13. package/src/dbm-graph-api/processAction/pageUpdates/UpdateCategoryListing.js +71 -0
  14. package/src/dbm-graph-api/processAction/pageUpdates/index.js +1 -0
  15. package/src/dbm-graph-api/range/encode/LinkPreview.js +38 -0
  16. package/src/dbm-graph-api/range/encode/PublishDate.js +21 -0
  17. package/src/dbm-graph-api/range/encode/SingleRelation.js +39 -0
  18. package/src/dbm-graph-api/range/encode/TranslatedName.js +25 -0
  19. package/src/dbm-graph-api/range/encode/TranslatedTitle.js +22 -0
  20. package/src/dbm-graph-api/range/encode/TranslationGroup.js +28 -0
  21. package/src/dbm-graph-api/range/encode/UrlRequest.js +8 -1
  22. package/src/dbm-graph-api/range/encode/admin/FieldTranslations.js +22 -0
  23. package/src/dbm-graph-api/range/encode/admin/index.js +2 -1
  24. package/src/dbm-graph-api/range/encode/index.js +6 -0
  25. package/src/dbm-graph-api/taskrunner/ExternalTaskRunner.js +17 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dbm-graph-api",
3
- "version": "1.1.30",
3
+ "version": "1.1.32",
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.2.0",
16
+ "dbm": "^1.2.2",
17
17
  "mime": "^4.0.6",
18
18
  "sharp": "^0.33.5",
19
19
  "ws": "^8.18.0"
@@ -162,11 +162,19 @@ export default class WebSocketConnection extends Dbm.core.BaseObject {
162
162
  let encodeSession = new DbmGraphApi.range.EncodeSession();
163
163
  encodeSession.outputController = this;
164
164
 
165
- await encodeSession.encodeSingleWithTypes(id, data.encode);
165
+ let logs = [];
166
+
167
+ try {
168
+ await encodeSession.encodeSingleWithTypes(id, data.encode);
169
+ }
170
+ catch(theError) {
171
+ logs.push(theError.message);
172
+ console.error(theError);
173
+ }
166
174
 
167
175
  encodeSession.destroy();
168
176
 
169
- this._webSocket.send(JSON.stringify({"type": "item/response", "id": id, "requestId": data["requestId"]}));
177
+ this._webSocket.send(JSON.stringify({"type": "item/response", "id": id, "requestId": data["requestId"], "logs": logs}));
170
178
  }
171
179
  break;
172
180
  case "url":
@@ -11,6 +11,7 @@ export default class AddAndProcessAction extends Dbm.core.BaseObject {
11
11
  await aEncodeSession.outputController.requireRole("admin");
12
12
  let user = await aEncodeSession.outputController.getUser();
13
13
 
14
+ //METODO: check role
14
15
  if(user) {
15
16
  let type = aData["type"];
16
17
 
@@ -23,8 +24,8 @@ export default class AddAndProcessAction extends Dbm.core.BaseObject {
23
24
  await action.addIncomingRelation(actionType, "for");
24
25
 
25
26
  if(aData["from"]) {
26
- let fromItem = database.getItem(1*aData["from"]);
27
- await action.addIncomingRelation(fromItem, "from");
27
+ let fromItem = database.getObject(1*aData["from"]);
28
+ await action.addOutgoingRelation(fromItem, "from");
28
29
  }
29
30
 
30
31
  let processingActionStatus = await database.getTypeObject("status/actionStatus", "processing");
@@ -6,44 +6,40 @@ export default class AddUser extends Dbm.core.BaseObject {
6
6
  }
7
7
 
8
8
  async performAction(aData, aEncodeSession) {
9
- console.log("AddUser");
9
+ //console.log("AddUser");
10
10
  let returnObject = {};
11
11
 
12
12
  await aEncodeSession.outputController.requireRole("admin");
13
- let user = await aEncodeSession.outputController.getUser();
14
13
 
15
14
  let database = Dbm.getInstance().repository.getItem("graphDatabase").controller;
16
15
 
17
- if(user) {
18
- let username = aData["username"];
16
+ let username = aData["username"];
19
17
 
20
- if(username) {
21
- let user = await database.getUserByUsername(username);
18
+ if(username) {
19
+ let user = await database.getUserByUsername(username);
22
20
 
23
- if(!user) {
24
- user = await database.createUser();
25
- returnObject["created"] = true;
21
+ if(!user) {
22
+ user = await database.createUser();
23
+ returnObject["created"] = true;
26
24
 
27
- await user.setUsername(username);
28
- if(aData["password"]) {
29
- await user.setPassword(aData["password"]);
30
- }
31
-
32
- if(aData["role"]) {
33
- let role = await database.getIdentifiableObject("type/userRole", aData["role"]);
34
- await user.addIncomingRelation(role, "for");
35
- }
36
- }
37
- else {
38
- returnObject["created"] = false;
25
+ await user.setUsername(username);
26
+ if(aData["password"]) {
27
+ await user.setPassword(aData["password"]);
39
28
  }
40
29
 
41
- returnObject["id"] = user.id;
30
+ if(aData["role"]) {
31
+ let role = await database.getIdentifiableObject("type/userRole", aData["role"]);
32
+ await user.addIncomingRelation(role, "for");
33
+ }
42
34
  }
43
35
  else {
44
- throw("No username");
36
+ returnObject["created"] = false;
45
37
  }
46
-
38
+
39
+ returnObject["id"] = user.id;
40
+ }
41
+ else {
42
+ throw("No username");
47
43
  }
48
44
 
49
45
  return returnObject;
@@ -0,0 +1,35 @@
1
+ import Dbm from "dbm";
2
+
3
+ export default class SetPassword extends Dbm.core.BaseObject {
4
+ _construct() {
5
+ super._construct();
6
+ }
7
+
8
+ async performAction(aData, aEncodeSession) {
9
+ //console.log("SetPassword");
10
+ let returnObject = {};
11
+
12
+ await aEncodeSession.outputController.requireRole("admin");
13
+
14
+ let database = Dbm.getInstance().repository.getItem("graphDatabase").controller;
15
+
16
+ let id = aData["id"];
17
+
18
+ if(id) {
19
+ let user = await database.getUser(id);
20
+
21
+ if(user) {
22
+ await user.setPassword(aData["password"]);
23
+ returnObject["updated"] = true;
24
+ }
25
+ else {
26
+ throw("No user");
27
+ }
28
+ }
29
+ else {
30
+ throw("No id");
31
+ }
32
+
33
+ return returnObject;
34
+ }
35
+ }
@@ -1,4 +1,5 @@
1
1
  export {default as AddAndProcessAction} from "./AddAndProcessAction.js";
2
2
  export {default as AddUser} from "./AddUser.js";
3
+ export {default as SetPassword} from "./SetPassword.js";
3
4
 
4
5
  export * as setup from "./setup/index.js";
@@ -0,0 +1,15 @@
1
+ import Dbm from "dbm";
2
+ import EditBaseObject from "./EditBaseObject.js";
3
+
4
+ export default class AddAction extends EditBaseObject {
5
+ _construct() {
6
+ super._construct();
7
+ }
8
+
9
+ async performChange(aObject, aData, aRequest) {
10
+ let database = Dbm.getInstance().repository.getItem("graphDatabase").controller;
11
+
12
+ console.log(aData["type"], aObject);
13
+ await database.addActionToProcess(aData["type"], [aObject]);
14
+ }
15
+ }
@@ -7,6 +7,6 @@ export default class ReplaceOutgoingRelation extends EditBaseObject {
7
7
  }
8
8
 
9
9
  async performChange(aObject, aData, aRequest) {
10
- await aObject.replaceOutgoingRelation(aData["value"], aData["type"]), aData["objectType"];
10
+ await aObject.replaceOutgoingRelation(aData["value"], aData["type"], aData["objectType"]);
11
11
  }
12
12
  }
@@ -0,0 +1,12 @@
1
+ import Dbm from "dbm";
2
+ import EditBaseObject from "./EditBaseObject.js";
3
+
4
+ export default class SetFieldTranslation extends EditBaseObject {
5
+ _construct() {
6
+ super._construct();
7
+ }
8
+
9
+ async performChange(aObject, aData, aRequest) {
10
+ await aObject.updateFieldTranslation(aData["field"], aData["language"], aData["value"]);
11
+ }
12
+ }
@@ -14,6 +14,8 @@ export {default as ReplaceMultipleIncomingRelations} from "./ReplaceMultipleInco
14
14
  export {default as ReplaceMultipleOutgoingRelations} from "./ReplaceMultipleOutgoingRelations.js";
15
15
  export {default as AddObjectType} from "./AddObjectType.js";
16
16
  export {default as RemoveObjectType} from "./RemoveObjectType.js";
17
+ export {default as AddAction} from "./AddAction.js";
18
+ export {default as SetFieldTranslation} from "./SetFieldTranslation.js";
17
19
 
18
20
 
19
21
  export const fullSetup = function() {
@@ -95,4 +97,16 @@ export const fullSetup = function() {
95
97
  let currentSelect = new DbmGraphApi.admin.edit.RemoveObjectType();
96
98
  currentSelect.item.register(prefix + name);
97
99
  }
100
+
101
+ {
102
+ let name = "addAction";
103
+ let currentSelect = new DbmGraphApi.admin.edit.AddAction();
104
+ currentSelect.item.register(prefix + name);
105
+ }
106
+
107
+ {
108
+ let name = "setFieldTranslation";
109
+ let currentSelect = new DbmGraphApi.admin.edit.SetFieldTranslation();
110
+ currentSelect.item.register(prefix + name);
111
+ }
98
112
  }
@@ -73,6 +73,12 @@ let registerEncoding = function(aName, aEncoder) {
73
73
 
74
74
  export {registerEncoding};
75
75
 
76
+ let registerEncodingClass = function(aEncoderClass) {
77
+ return registerEncoding(aEncoderClass.DEFAULT_ENCODING_NAME, new aEncoderClass());
78
+ }
79
+
80
+ export {registerEncodingClass};
81
+
76
82
  let fullEncodeSetup = function() {
77
83
  let encodePrefix = "graphApi/range/encode/";
78
84
  {
@@ -211,6 +217,15 @@ let fullEncodeSetup = function() {
211
217
  registerEncoding("atLocation", new DbmGraphApi.range.encode.AtLocation());
212
218
  registerEncoding("location", new DbmGraphApi.range.encode.Location());
213
219
  registerEncoding("mainImage", new DbmGraphApi.range.encode.MainImage());
220
+ registerEncoding("linkPreview", new DbmGraphApi.range.encode.LinkPreview());
221
+ registerEncoding("publishDate", new DbmGraphApi.range.encode.PublishDate());
222
+
223
+ registerEncoding("title_translations", new DbmGraphApi.range.encode.TranslatedTitle());
224
+ registerEncoding("admin_fieldTranslations", new DbmGraphApi.range.encode.admin.FieldTranslations());
225
+
226
+ registerEncoding("language", DbmGraphApi.range.encode.SingleRelation.create("language", "in:for:language", "type"));
227
+ registerEncodingClass(DbmGraphApi.range.encode.TranslatedName);
228
+ registerEncoding("translationGroup", new DbmGraphApi.range.encode.TranslationGroup());
214
229
  }
215
230
 
216
231
  export {fullEncodeSetup};
@@ -254,6 +269,7 @@ let fullActionSetup = function() {
254
269
  registerActionFunction("cron/processActions", new DbmGraphApi.action.cron.ProcessActions());
255
270
  registerActionFunction("admin/addAndProcessAction", new DbmGraphApi.action.admin.AddAndProcessAction());
256
271
  registerActionFunction("admin/addUser", new DbmGraphApi.action.admin.AddUser());
272
+ registerActionFunction("admin/user/setPassword", new DbmGraphApi.action.admin.SetPassword());
257
273
 
258
274
  registerActionFunction("admin/setup/setupWebsite", new DbmGraphApi.action.admin.setup.SetupWebsite());
259
275
  registerActionFunction("admin/setup/setupOrganization", new DbmGraphApi.action.admin.setup.SetupOrganization());
@@ -276,6 +292,8 @@ let fullProcessActionSetup = function() {
276
292
  registerProcessActionFunction("example", new DbmGraphApi.processAction.Example());
277
293
 
278
294
  registerProcessActionFunction("handleFormSubmission", new DbmGraphApi.processAction.HandleFormSubmission());
295
+
296
+ registerProcessActionFunction("pageUpdates/updateCategoryListing", new DbmGraphApi.processAction.pageUpdates.UpdateCategoryListing());
279
297
  }
280
298
 
281
299
  export {fullProcessActionSetup};
@@ -389,7 +407,6 @@ export const setupEndpoints = function(aServer) {
389
407
  url += "/";
390
408
  }
391
409
 
392
- console.log(url);
393
410
  //METODO: check visibility in database
394
411
  let request = new UrlRequest();
395
412
  request.setup(aRequest, aReply);
@@ -703,6 +720,10 @@ export const setupSite = function(aServer) {
703
720
  reply.type('text/html');
704
721
 
705
722
  let fields = await urlObject.getFields();
723
+ let languageItem = await urlObject.singleObjectRelationQuery("in:for:language");
724
+ if(languageItem) {
725
+ language = await languageItem.getIdentifier();
726
+ }
706
727
 
707
728
  let baseUrl = request.protocol + "://" + request.hostname;
708
729
  if(request.port && request.port !== 80 && request.port !== 443) {
@@ -1,2 +1,4 @@
1
+ export * as pageUpdates from "./pageUpdates/index.js";
2
+
1
3
  export {default as Example} from "./Example.js";
2
4
  export {default as HandleFormSubmission} from "./HandleFormSubmission.js";
@@ -0,0 +1,71 @@
1
+ import Dbm from "dbm";
2
+
3
+ export default class UpdateCategoryListing extends Dbm.core.BaseObject {
4
+ _construct() {
5
+ super._construct();
6
+ }
7
+
8
+ async process(aAction) {
9
+ console.log("UpdateCategoryListing:process");
10
+ console.log(aAction);
11
+
12
+ let database = Dbm.getInstance().repository.getItem("graphDatabase").controller;
13
+ let page = await aAction.singleObjectRelationQuery("out:from:page");
14
+
15
+ let categories = await page.objectRelationQuery("out:in:group/pageCategory");
16
+ let links = await page.objectRelationQuery("in:for:linkPreview");
17
+
18
+ let defaultLinks = [];
19
+ {
20
+ let currentArray = links;
21
+ let currentArrayLength = currentArray.length;
22
+ for(let i = 0; i < currentArrayLength; i++) {
23
+ let currentLink = currentArray[i];
24
+
25
+ let mode = await currentLink.getSingleLinkedType("type/listUpdateMode");
26
+
27
+ if(mode === "byCategories") {
28
+ defaultLinks.push(currentLink);
29
+ }
30
+ }
31
+
32
+ if(defaultLinks.length === 0) {
33
+ let link = await database.createObject("public", ["linkPreview"]);
34
+ await link.addLinkedType("type/listUpdateMode", "byCategories");
35
+ await link.addOutgoingRelation(page, "for");
36
+
37
+ defaultLinks.push(link);
38
+ }
39
+ }
40
+
41
+ let categoryListIds = [];
42
+ {
43
+ let currentArray = categories;
44
+ let currentArrayLength = currentArray.length;
45
+ for(let i = 0; i < currentArrayLength; i++) {
46
+ let currentCategory = currentArray[i];
47
+
48
+ let list = await currentCategory.singleObjectRelationQuery("out:for:linkList");
49
+
50
+ if(!list) {
51
+ list = await database.createObject("public", ["linkList"]);
52
+ let fields = await currentCategory.getFields();
53
+ await list.updateField("name", fields["name"] + " (page category list)");
54
+ await currentCategory.addOutgoingRelation(list, "for");
55
+ }
56
+
57
+ categoryListIds.push(list.id);
58
+ }
59
+ }
60
+
61
+ {
62
+ let currentArray = defaultLinks;
63
+ let currentArrayLength = currentArray.length;
64
+ for(let i = 0; i < currentArrayLength; i++) {
65
+ let currentLink = currentArray[i];
66
+
67
+ await currentLink.replaceMultipleOutgoingRelations(categoryListIds, "in", "linkList");
68
+ }
69
+ }
70
+ }
71
+ }
@@ -0,0 +1 @@
1
+ export {default as UpdateCategoryListing} from "./UpdateCategoryListing.js";
@@ -0,0 +1,38 @@
1
+ import Dbm from "dbm";
2
+ import EncodeBaseObject from "./EncodeBaseObject.js";
3
+
4
+ export default class LinkPreview extends EncodeBaseObject {
5
+ _construct() {
6
+ super._construct();
7
+ }
8
+
9
+ async getEncodedData(aId, aEncodingSession) {
10
+
11
+ let returnObject = {};
12
+
13
+ let object = Dbm.getInstance().repository.getItem("graphDatabase").controller.getObject(aId);
14
+
15
+ let fields = await object.getFields();
16
+ returnObject["title"] = fields["title"] !== undefined ? fields["title"] : null;
17
+ returnObject["description"] = fields["description"] !== undefined ? fields["description"] : null;
18
+ returnObject["linkText"] = fields["linkText"] !== undefined ? fields["linkText"] : null;
19
+
20
+ await aEncodingSession.encodeObjectOrNull(object, "mainImage");
21
+
22
+ {
23
+ let relatedItem = await object.singleObjectRelationQuery("out:for:page");
24
+
25
+ if(relatedItem) {
26
+ returnObject["page"] = await aEncodingSession.encodeObjectOrNull(relatedItem, "url");
27
+ await aEncodingSession.encodeObjectOrNull(relatedItem, "title");
28
+ await aEncodingSession.encodeObjectOrNull(relatedItem, "mainImage");
29
+ await aEncodingSession.encodeObjectOrNull(relatedItem, "publishDate");
30
+ }
31
+ else {
32
+ returnObject["link"] = fields["link"] !== undefined ? fields["link"] : null;
33
+ }
34
+ }
35
+
36
+ return returnObject;
37
+ }
38
+ }
@@ -0,0 +1,21 @@
1
+ import Dbm from "dbm";
2
+ import EncodeBaseObject from "./EncodeBaseObject.js";
3
+
4
+ export default class PublishDate extends EncodeBaseObject {
5
+ _construct() {
6
+ super._construct();
7
+ }
8
+
9
+ async getEncodedData(aId, aEncodingSession) {
10
+
11
+ let returnObject = {};
12
+
13
+ let object = Dbm.getInstance().repository.getItem("graphDatabase").controller.getObject(aId);
14
+
15
+ let fields = await object.getFields();
16
+
17
+ returnObject["publishDate"] = fields["publishDate"] ? fields["publishDate"] : null;
18
+
19
+ return returnObject;
20
+ }
21
+ }
@@ -0,0 +1,39 @@
1
+ import Dbm from "dbm";
2
+ import EncodeBaseObject from "./EncodeBaseObject.js";
3
+
4
+ export default class Language extends EncodeBaseObject {
5
+ _construct() {
6
+ super._construct();
7
+
8
+ this.outputFieldName = "language";
9
+ this.relationPath = "in:for:language";
10
+ this.encodeType = "type";
11
+ }
12
+
13
+ setup(aOutputFieldName, aRelationPath, aEncodeType) {
14
+
15
+ this.outputFieldName = aOutputFieldName;
16
+ this.relationPath = aRelationPath;
17
+ this.encodeType = aEncodeType;
18
+
19
+ return this;
20
+ }
21
+
22
+ async getEncodedData(aId, aEncodingSession) {
23
+
24
+ let returnObject = {};
25
+
26
+ let object = Dbm.getRepositoryItem("graphDatabase").controller.getObject(aId);
27
+
28
+ returnObject[this.outputFieldName] = await aEncodingSession.encodeObjectOrNull(await object.singleObjectRelationQuery(this.relationPath), this.encodeType);
29
+
30
+ return returnObject;
31
+ }
32
+
33
+ static create(aOutputFieldName, aRelationPath, aEncodeType) {
34
+ let newEncoder = new Language();
35
+ newEncoder.setup(aOutputFieldName, aRelationPath, aEncodeType);
36
+
37
+ return newEncoder;
38
+ }
39
+ }
@@ -0,0 +1,25 @@
1
+ import Dbm from "dbm";
2
+ import EncodeBaseObject from "./EncodeBaseObject.js";
3
+
4
+ export default class TranslatedName extends EncodeBaseObject {
5
+
6
+ static DEFAULT_ENCODING_NAME = "name_translations";
7
+
8
+ _construct() {
9
+ super._construct();
10
+ }
11
+
12
+ async getEncodedData(aId, aEncodingSession) {
13
+
14
+ let returnObject = {};
15
+
16
+ let object = Dbm.getInstance().repository.getItem("graphDatabase").controller.getObject(aId);
17
+
18
+ await aEncodingSession.encodeSingle(aId, "name");
19
+
20
+ let fieldTranslations = await object.getFieldTranslation("name");
21
+ returnObject["name/translations"] = fieldTranslations;
22
+
23
+ return returnObject;
24
+ }
25
+ }
@@ -0,0 +1,22 @@
1
+ import Dbm from "dbm";
2
+ import EncodeBaseObject from "./EncodeBaseObject.js";
3
+
4
+ export default class TranslatedTitle extends EncodeBaseObject {
5
+ _construct() {
6
+ super._construct();
7
+ }
8
+
9
+ async getEncodedData(aId, aEncodingSession) {
10
+
11
+ let returnObject = {};
12
+
13
+ let object = Dbm.getInstance().repository.getItem("graphDatabase").controller.getObject(aId);
14
+
15
+ await aEncodingSession.encodeSingle(aId, "title");
16
+
17
+ let fieldTranslations = await object.getFieldTranslation("title");
18
+ returnObject["title/translations"] = fieldTranslations;
19
+
20
+ return returnObject;
21
+ }
22
+ }
@@ -0,0 +1,28 @@
1
+ import Dbm from "dbm";
2
+ import EncodeBaseObject from "./EncodeBaseObject.js";
3
+
4
+ export default class TranslationGroup extends EncodeBaseObject {
5
+
6
+ static DEFAULT_ENCODING_NAME = "translationGroup";
7
+
8
+ _construct() {
9
+ super._construct();
10
+ }
11
+
12
+ async getEncodedData(aId, aEncodingSession) {
13
+ //console.log("TranslationGroup::getEncodedData");
14
+
15
+ let returnObject = {};
16
+
17
+ let object = Dbm.getInstance().repository.getItem("graphDatabase").controller.getObject(aId);
18
+
19
+
20
+ {
21
+ let relatedItems = await object.objectRelationQuery("in:in:page");
22
+ returnObject["pages"] = await aEncodingSession.encodeObjects(relatedItems, "language");
23
+ await aEncodingSession.encodeObjects(relatedItems, "url");
24
+ }
25
+
26
+ return returnObject;
27
+ }
28
+ }
@@ -7,7 +7,7 @@ export default class UrlRequest extends EncodeBaseObject {
7
7
  }
8
8
 
9
9
  async getEncodedData(aId, aEncodingSession) {
10
- console.log("UrlRequest::getEncodedData");
10
+ //console.log("UrlRequest::getEncodedData");
11
11
 
12
12
  let returnObject = {};
13
13
 
@@ -18,6 +18,7 @@ export default class UrlRequest extends EncodeBaseObject {
18
18
  await aEncodingSession.encodeSingle(aId, "url");
19
19
  await aEncodingSession.encodeSingle(aId, "navigationName");
20
20
  await aEncodingSession.encodeSingle(aId, "pageRepresentation");
21
+ await aEncodingSession.encodeSingle(aId, "language");
21
22
 
22
23
  let fields = await object.getFields();
23
24
 
@@ -38,6 +39,12 @@ export default class UrlRequest extends EncodeBaseObject {
38
39
  returnObject["category"] = await aEncodingSession.encodeObjectOrNull(relatedItem, "type");
39
40
  }
40
41
 
42
+ {
43
+ let relatedItem = await object.singleObjectRelationQuery("out:in:group/translationGroup");
44
+
45
+ returnObject["translations"] = await aEncodingSession.encodeObjectOrNull(relatedItem, "translationGroup");
46
+ }
47
+
41
48
  return returnObject;
42
49
  }
43
50
  }
@@ -0,0 +1,22 @@
1
+ import Dbm from "dbm";
2
+ import EncodeBaseObject from "../EncodeBaseObject.js";
3
+
4
+ export default class Fields extends EncodeBaseObject {
5
+ _construct() {
6
+ super._construct();
7
+ }
8
+
9
+ async getEncodedData(aId, aEncodingSession) {
10
+
11
+ let returnObject = {};
12
+
13
+ await aEncodingSession.outputController.requireRole("admin");
14
+
15
+ let object = Dbm.getInstance().repository.getItem("graphDatabase").controller.getObject(aId);
16
+
17
+ let fields = await object.getAllFieldTranslations();
18
+ returnObject["fields/translations"] = fields;
19
+
20
+ return returnObject;
21
+ }
22
+ }
@@ -1,2 +1,3 @@
1
1
  export {default as Fields} from "./Fields.js";
2
- export {default as User} from "./User.js";
2
+ export {default as User} from "./User.js";
3
+ export {default as FieldTranslations} from "./FieldTranslations.js";
@@ -20,5 +20,11 @@ export {default as HelpSection} from "./HelpSection.js";
20
20
  export {default as MainImage} from "./MainImage.js";
21
21
  export {default as Location} from "./Location.js";
22
22
  export {default as AtLocation} from "./AtLocation.js";
23
+ export {default as LinkPreview} from "./LinkPreview.js";
24
+ export {default as PublishDate} from "./PublishDate.js";
25
+ export {default as SingleRelation} from "./SingleRelation.js";
26
+ export {default as TranslatedTitle} from "./TranslatedTitle.js";
27
+ export {default as TranslatedName} from "./TranslatedName.js";
28
+ export {default as TranslationGroup} from "./TranslationGroup.js";
23
29
 
24
30
  export * as admin from "./admin/index.js";
@@ -45,14 +45,26 @@ export default class ExternalTaskRunner extends Dbm.core.BaseObject {
45
45
 
46
46
  let response = await fetch(this.item.url, requestData);
47
47
 
48
- let data = await response.json();
48
+ let responseText = await response.text();
49
49
 
50
- let continueData = Dbm.objectPath(data, this.item.continueField);
51
- console.log(this.item.name + " " + continueData);
50
+ let data = null;
51
+ try {
52
+ data = JSON.parse(responseText);
53
+ }
54
+ catch(theError) {
55
+ console.error(theError);
56
+ console.log(responseText);
57
+ }
58
+
59
+ if(data) {
60
+ let continueData = Dbm.objectPath(data, this.item.continueField);
61
+ console.log(this.item.name + " " + continueData);
52
62
 
53
- if(continueData > 0) {
54
- runDirect = true;
63
+ if(continueData > 0) {
64
+ runDirect = true;
65
+ }
55
66
  }
67
+
56
68
  }
57
69
  catch(theError) {
58
70
  console.log(theError);