dbm-graph-api 1.1.38 → 1.1.40
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 +2 -2
- package/src/dbm-graph-api/Api.js +1 -1
- package/src/dbm-graph-api/action/cron/ProcessActions.js +5 -11
- package/src/dbm-graph-api/index.js +16 -4
- package/src/dbm-graph-api/range/encode/Action.js +36 -0
- package/src/dbm-graph-api/range/encode/Breadcrumb.js +1 -1
- package/src/dbm-graph-api/range/encode/Menu.js +27 -0
- package/src/dbm-graph-api/range/encode/MenuItem.js +21 -0
- package/src/dbm-graph-api/range/encode/MenuLocation.js +23 -0
- package/src/dbm-graph-api/range/encode/index.js +4 -0
- package/src/dbm-graph-api/range/select/WithIdentifier.js +17 -0
- package/src/dbm-graph-api/range/select/index.js +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dbm-graph-api",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.40",
|
|
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.
|
|
16
|
+
"dbm": "^1.2.9",
|
|
17
17
|
"mime": "^4.0.6",
|
|
18
18
|
"sharp": "^0.33.5",
|
|
19
19
|
"ws": "^8.18.0"
|
package/src/dbm-graph-api/Api.js
CHANGED
|
@@ -46,7 +46,7 @@ export default class Api extends Dbm.core.BaseObject {
|
|
|
46
46
|
let [key, value] = currentArray[i].split("=");
|
|
47
47
|
if(key === "dbm_session" || key === " dbm_session") {
|
|
48
48
|
let userId = 1*value.split(":")[1];
|
|
49
|
-
let user = Dbm.
|
|
49
|
+
let user = Dbm.getRepositoryItem("graphDatabase").controller.getUser(userId);
|
|
50
50
|
|
|
51
51
|
user.verifySession(value).then(function(aIsValidSession) {
|
|
52
52
|
//console.log("verifySession", aIsValidSession);
|
|
@@ -8,7 +8,7 @@ export default class ProcessActions extends Dbm.core.BaseObject {
|
|
|
8
8
|
async performAction(aData, aEncodeSession) {
|
|
9
9
|
let returnObject = {};
|
|
10
10
|
|
|
11
|
-
let database = Dbm.
|
|
11
|
+
let database = Dbm.getRepositoryItem("graphDatabase").controller;
|
|
12
12
|
|
|
13
13
|
let actionStatus = await database.getTypeObject("status/actionStatus", "readyToProcess");
|
|
14
14
|
let actions = await actionStatus.objectRelationQuery("out:for:action");
|
|
@@ -17,24 +17,18 @@ export default class ProcessActions extends Dbm.core.BaseObject {
|
|
|
17
17
|
let action = actions[0];
|
|
18
18
|
returnObject["processed"] = action.id;
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
await action.replaceIncomingRelation(processingActionStatus, "for", "status/actionStatus");
|
|
20
|
+
await action.changeLinkedType("status/actionStatus", "processing");
|
|
22
21
|
|
|
23
|
-
let actionType = await
|
|
24
|
-
console.log(actionType);
|
|
22
|
+
let actionType = await action.getSingleLinkedType("type/actionType");
|
|
25
23
|
|
|
26
24
|
let processActionItem = Dbm.getInstance().repository.getItemIfExists("graphApi/processAction/" + actionType);
|
|
27
25
|
|
|
28
26
|
if(processActionItem) {
|
|
29
|
-
|
|
30
27
|
await processActionItem.controller.process(action);
|
|
31
|
-
|
|
32
|
-
let doneActionStatus = await database.getTypeObject("status/actionStatus", "done");
|
|
33
|
-
await action.replaceIncomingRelation(doneActionStatus, "for", "status/actionStatus");
|
|
28
|
+
await action.changeLinkedType("status/actionStatus", "done");
|
|
34
29
|
}
|
|
35
30
|
else {
|
|
36
|
-
|
|
37
|
-
await action.replaceIncomingRelation(doneActionStatus, "for", "status/actionStatus");
|
|
31
|
+
await action.changeLinkedType("status/actionStatus", "noAction");
|
|
38
32
|
}
|
|
39
33
|
|
|
40
34
|
returnObject["remaining"] = actions.length-1;
|
|
@@ -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,12 @@ 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());
|
|
239
|
+
|
|
240
|
+
registerEncoding("action", new DbmGraphApi.range.encode.Action());
|
|
229
241
|
}
|
|
230
242
|
|
|
231
243
|
export {fullEncodeSetup};
|
|
@@ -303,14 +315,14 @@ let fullProcessActionSetup = function() {
|
|
|
303
315
|
export {fullProcessActionSetup};
|
|
304
316
|
|
|
305
317
|
let setupInternalTaskRunner = function() {
|
|
306
|
-
Dbm.
|
|
318
|
+
Dbm.getRepositoryItem("taskRunner").requireProperty("runners", []);
|
|
307
319
|
|
|
308
320
|
let runner = new DbmGraphApi.taskrunner.InternalTaskRunner();
|
|
309
321
|
runner.startAtStartup();
|
|
310
322
|
|
|
311
|
-
let runners = [].concat(Dbm.
|
|
323
|
+
let runners = [].concat(Dbm.getRepositoryItem("taskRunner").runners);
|
|
312
324
|
runners.push(runner);
|
|
313
|
-
Dbm.
|
|
325
|
+
Dbm.getRepositoryItem("taskRunner").runners = runners;
|
|
314
326
|
|
|
315
327
|
}
|
|
316
328
|
|
|
@@ -336,7 +348,7 @@ export const setupEndpoints = function(aServer) {
|
|
|
336
348
|
|
|
337
349
|
let username = aRequest.body['username'];
|
|
338
350
|
|
|
339
|
-
let user = await Dbm.
|
|
351
|
+
let user = await Dbm.getRepositoryItem("graphDatabase").controller.getUserByUsername(username);
|
|
340
352
|
|
|
341
353
|
if(!user) {
|
|
342
354
|
//METODO: get user by email
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import Dbm from "dbm";
|
|
2
|
+
import EncodeBaseObject from "./EncodeBaseObject.js";
|
|
3
|
+
|
|
4
|
+
export default class Action extends EncodeBaseObject {
|
|
5
|
+
_construct() {
|
|
6
|
+
super._construct();
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
async getEncodedData(aId, aEncodingSession) {
|
|
10
|
+
|
|
11
|
+
let returnObject = {};
|
|
12
|
+
|
|
13
|
+
let object = Dbm.getRepositoryItem("graphDatabase").controller.getObject(aId);
|
|
14
|
+
|
|
15
|
+
let fields = await object.getFields();
|
|
16
|
+
returnObject["data"] = fields["data"] ? fields["data"] : null;
|
|
17
|
+
|
|
18
|
+
{
|
|
19
|
+
let relatedItems = await object.objectRelationQuery("out:from:*");
|
|
20
|
+
returnObject["from"] = await aEncodingSession.encodeObjects(relatedItems, "id");
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
{
|
|
24
|
+
let relatedObject = await object.singleObjectRelationQuery("in:for:type/actionType");
|
|
25
|
+
returnObject["type"] = await aEncodingSession.encodeObjectOrNull(relatedObject, "type");
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
{
|
|
29
|
+
let relatedObject = await object.singleObjectRelationQuery("in:for:status/actionStatus");
|
|
30
|
+
returnObject["status"] = await aEncodingSession.encodeObjectOrNull(relatedObject, "type");
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
return returnObject;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -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,9 @@ 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";
|
|
32
|
+
export {default as Action} from "./Action.js";
|
|
29
33
|
|
|
30
34
|
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";
|