dbm-graph-api 1.1.39 → 1.1.41
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 +6 -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/index.js +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dbm-graph-api",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.41",
|
|
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.
|
|
16
|
+
"dbm": "^1.3.0",
|
|
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;
|
|
@@ -236,6 +236,8 @@ let fullEncodeSetup = function() {
|
|
|
236
236
|
registerEncoding("menuLocation", new DbmGraphApi.range.encode.MenuLocation());
|
|
237
237
|
registerEncoding("menu", new DbmGraphApi.range.encode.Menu());
|
|
238
238
|
registerEncoding("menuItem", new DbmGraphApi.range.encode.MenuItem());
|
|
239
|
+
|
|
240
|
+
registerEncoding("action", new DbmGraphApi.range.encode.Action());
|
|
239
241
|
}
|
|
240
242
|
|
|
241
243
|
export {fullEncodeSetup};
|
|
@@ -313,14 +315,14 @@ let fullProcessActionSetup = function() {
|
|
|
313
315
|
export {fullProcessActionSetup};
|
|
314
316
|
|
|
315
317
|
let setupInternalTaskRunner = function() {
|
|
316
|
-
Dbm.
|
|
318
|
+
Dbm.getRepositoryItem("taskRunner").requireProperty("runners", []);
|
|
317
319
|
|
|
318
320
|
let runner = new DbmGraphApi.taskrunner.InternalTaskRunner();
|
|
319
321
|
runner.startAtStartup();
|
|
320
322
|
|
|
321
|
-
let runners = [].concat(Dbm.
|
|
323
|
+
let runners = [].concat(Dbm.getRepositoryItem("taskRunner").runners);
|
|
322
324
|
runners.push(runner);
|
|
323
|
-
Dbm.
|
|
325
|
+
Dbm.getRepositoryItem("taskRunner").runners = runners;
|
|
324
326
|
|
|
325
327
|
}
|
|
326
328
|
|
|
@@ -346,7 +348,7 @@ export const setupEndpoints = function(aServer) {
|
|
|
346
348
|
|
|
347
349
|
let username = aRequest.body['username'];
|
|
348
350
|
|
|
349
|
-
let user = await Dbm.
|
|
351
|
+
let user = await Dbm.getRepositoryItem("graphDatabase").controller.getUserByUsername(username);
|
|
350
352
|
|
|
351
353
|
if(!user) {
|
|
352
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
|
+
}
|
|
@@ -29,5 +29,6 @@ export {default as TranslationGroup} from "./TranslationGroup.js";
|
|
|
29
29
|
export {default as MenuLocation} from "./MenuLocation.js";
|
|
30
30
|
export {default as Menu} from "./Menu.js";
|
|
31
31
|
export {default as MenuItem} from "./MenuItem.js";
|
|
32
|
+
export {default as Action} from "./Action.js";
|
|
32
33
|
|
|
33
34
|
export * as admin from "./admin/index.js";
|