dbm-graph-api 1.1.38 → 1.1.39

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.38",
3
+ "version": "1.1.39",
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.7",
16
+ "dbm": "^1.2.8",
17
17
  "mime": "^4.0.6",
18
18
  "sharp": "^0.33.5",
19
19
  "ws": "^8.18.0"
@@ -57,6 +57,12 @@ let fullSelectSetup = function() {
57
57
  let currentSelect = new DbmGraphApi.range.select.GlobalObjectRelationQuery();
58
58
  currentSelect.item.register(selectPrefix + name);
59
59
  }
60
+
61
+ {
62
+ let name = "withIdentifier";
63
+ let currentSelect = new DbmGraphApi.range.select.WithIdentifier();
64
+ currentSelect.item.register(selectPrefix + name);
65
+ }
60
66
  }
61
67
 
62
68
 
@@ -226,6 +232,10 @@ let fullEncodeSetup = function() {
226
232
  registerEncoding("language", DbmGraphApi.range.encode.SingleRelation.create("language", "in:for:language", "type"));
227
233
  registerEncodingClass(DbmGraphApi.range.encode.TranslatedName);
228
234
  registerEncoding("translationGroup", new DbmGraphApi.range.encode.TranslationGroup());
235
+
236
+ registerEncoding("menuLocation", new DbmGraphApi.range.encode.MenuLocation());
237
+ registerEncoding("menu", new DbmGraphApi.range.encode.Menu());
238
+ registerEncoding("menuItem", new DbmGraphApi.range.encode.MenuItem());
229
239
  }
230
240
 
231
241
  export {fullEncodeSetup};
@@ -0,0 +1,27 @@
1
+ import Dbm from "dbm";
2
+ import EncodeBaseObject from "./EncodeBaseObject.js";
3
+
4
+ export default class Menu 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, "language");
16
+
17
+ {
18
+ let relatedItems = await object.objectRelationQuery("in:in:menuItem");
19
+ returnObject["menuItems"] = await aEncodingSession.encodeObjects(relatedItems, "menuItem");
20
+ }
21
+
22
+ let fields = await object.getFields();
23
+ returnObject["order"] = fields["order"] ? fields["order"] : null;
24
+
25
+ return returnObject;
26
+ }
27
+ }
@@ -0,0 +1,21 @@
1
+ import Dbm from "dbm";
2
+ import EncodeBaseObject from "./EncodeBaseObject.js";
3
+
4
+ export default class MenuItem 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["label"] = fields["label"] ? fields["label"] : null;
17
+ returnObject["link"] = fields["link"] ? fields["link"] : null;
18
+
19
+ return returnObject;
20
+ }
21
+ }
@@ -0,0 +1,23 @@
1
+ import Dbm from "dbm";
2
+ import EncodeBaseObject from "./EncodeBaseObject.js";
3
+
4
+ export default class MenuLocation 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, "identifier");
16
+
17
+ let relatedItem = await object.singleObjectRelationQuery("in:at:menu");
18
+
19
+ returnObject["menu"] = await aEncodingSession.encodeObjectOrNull(relatedItem, "menu");
20
+
21
+ return returnObject;
22
+ }
23
+ }
@@ -26,5 +26,8 @@ export {default as SingleRelation} from "./SingleRelation.js";
26
26
  export {default as TranslatedTitle} from "./TranslatedTitle.js";
27
27
  export {default as TranslatedName} from "./TranslatedName.js";
28
28
  export {default as TranslationGroup} from "./TranslationGroup.js";
29
+ export {default as MenuLocation} from "./MenuLocation.js";
30
+ export {default as Menu} from "./Menu.js";
31
+ export {default as MenuItem} from "./MenuItem.js";
29
32
 
30
33
  export * as admin from "./admin/index.js";
@@ -0,0 +1,17 @@
1
+ import Dbm from "dbm";
2
+
3
+ import SelectBaseObject from "./SelectBaseObject.js";
4
+
5
+ export default class WithIdentifier extends SelectBaseObject {
6
+ _construct() {
7
+ super._construct();
8
+ }
9
+
10
+ async select(aQuery, aData, aRequest) {
11
+ aQuery.withIdentifier(aData["identifier"]);
12
+ }
13
+
14
+ async filter(aIds, aData, aRequest) {
15
+ return aIds;
16
+ }
17
+ }
@@ -4,4 +4,5 @@ export {default as ByObjectType} from "./ByObjectType.js";
4
4
  export {default as IncludePrivate} from "./IncludePrivate.js";
5
5
  export {default as IncludeDraft} from "./IncludeDraft.js";
6
6
  export {default as ObjectRelationQuery} from "./ObjectRelationQuery.js";
7
- export {default as GlobalObjectRelationQuery} from "./GlobalObjectRelationQuery.js";
7
+ export {default as GlobalObjectRelationQuery} from "./GlobalObjectRelationQuery.js";
8
+ export {default as WithIdentifier} from "./WithIdentifier.js";