beanbagdb 0.6.9 → 0.7.1
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 +1 -1
- package/src/index.js +3 -3
- package/src/system_schema.js +7 -2
- package/test/operations.test.js +1 -1
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -848,7 +848,7 @@ export class BeanBagDB {
|
|
|
848
848
|
*/
|
|
849
849
|
async _create_edge(input){
|
|
850
850
|
console.log(input)
|
|
851
|
-
let {node1,node2,edge_name,note=""} = input
|
|
851
|
+
let {node1,node2,edge_name,note="",level_weight=1} = input
|
|
852
852
|
this._check_ready_to_use();
|
|
853
853
|
if(!edge_name){throw new ValidationError("edge_name required")}
|
|
854
854
|
if(!node1|| Object.keys(node1).length==0){throw new ValidationError("node1 required")}
|
|
@@ -903,7 +903,7 @@ async _create_edge(input){
|
|
|
903
903
|
|
|
904
904
|
if(errors.length==0){
|
|
905
905
|
// let edge = await this.create({schema:"system_edge",data:})
|
|
906
|
-
return {node1: node1id , node2: node2id ,edge_name:edge_name ,note:note}
|
|
906
|
+
return {node1: node1id , node2: node2id ,edge_name:edge_name ,note:note,level_weight}
|
|
907
907
|
}else{
|
|
908
908
|
throw new RelationError(errors)
|
|
909
909
|
}
|
|
@@ -912,7 +912,7 @@ async _create_edge(input){
|
|
|
912
912
|
if(error instanceof DocNotFoundError){
|
|
913
913
|
let doc = {node1:"*",node2:"*",name:edge_name,note:note}
|
|
914
914
|
let new_doc = await this.create({schema:"system_edge_constraint",data:doc})
|
|
915
|
-
return {node1: n1.doc._id,node2: n2.doc._id,edge_name:edge_name ,note:note}
|
|
915
|
+
return {node1: n1.doc._id,node2: n2.doc._id,edge_name:edge_name ,note:note,level_weight}
|
|
916
916
|
}else{
|
|
917
917
|
throw error
|
|
918
918
|
}
|
package/src/system_schema.js
CHANGED
|
@@ -286,7 +286,7 @@ export const default_app = {
|
|
|
286
286
|
title: "Edge in the system graph",
|
|
287
287
|
active: true,
|
|
288
288
|
system_generated: true,
|
|
289
|
-
version: 1,
|
|
289
|
+
version: 1.5,
|
|
290
290
|
description: "To define edges in the simple directed graph of records.",
|
|
291
291
|
schema: {
|
|
292
292
|
type: "object",
|
|
@@ -305,12 +305,17 @@ export const default_app = {
|
|
|
305
305
|
note:{
|
|
306
306
|
type:"string",
|
|
307
307
|
default:" "
|
|
308
|
+
},
|
|
309
|
+
level_weight:{
|
|
310
|
+
type:"number",
|
|
311
|
+
default:1,
|
|
312
|
+
"description":"This helps order nodes at the same level in the graph. Nodes at the same level will be ordered in ascending order"
|
|
308
313
|
}
|
|
309
314
|
},
|
|
310
315
|
},
|
|
311
316
|
settings: {
|
|
312
317
|
primary_keys: ["node1", "node2", "edge_name"],
|
|
313
|
-
non_editable_fields: [
|
|
318
|
+
non_editable_fields: [],
|
|
314
319
|
encrypted_fields: [],
|
|
315
320
|
svg_icon25:`<svg xmlns="http://www.w3.org/2000/svg" width="25" height="25" fill="currentColor" class="bi bi-diagram-2-fill" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M6 3.5A1.5 1.5 0 0 1 7.5 2h1A1.5 1.5 0 0 1 10 3.5v1A1.5 1.5 0 0 1 8.5 6v1H11a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-1 0V8h-5v.5a.5.5 0 0 1-1 0v-1A.5.5 0 0 1 5 7h2.5V6A1.5 1.5 0 0 1 6 4.5zm-3 8A1.5 1.5 0 0 1 4.5 10h1A1.5 1.5 0 0 1 7 11.5v1A1.5 1.5 0 0 1 5.5 14h-1A1.5 1.5 0 0 1 3 12.5zm6 0a1.5 1.5 0 0 1 1.5-1.5h1a1.5 1.5 0 0 1 1.5 1.5v1a1.5 1.5 0 0 1-1.5 1.5h-1A1.5 1.5 0 0 1 9 12.5z"/></svg>`
|
|
316
321
|
},
|
package/test/operations.test.js
CHANGED