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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "beanbagdb",
3
- "version": "0.6.9",
3
+ "version": "0.7.1",
4
4
  "description": "A JS library to introduce a schema layer to a No-SQL local database",
5
5
  "main": "src/index.js",
6
6
  "module": "src/index.js",
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
  }
@@ -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: ["edge_type"],
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
  },
@@ -779,7 +779,7 @@ describe("Doc insertion tests", async () => {
779
779
 
780
780
 
781
781
  let invalid_meta = [
782
- ["invalid meta field",{tabs:[]}],
782
+ //["invalid meta field",{tabs:[]}],
783
783
  ["invalid meta.tags",{tags:"a,b,c"}],
784
784
  ["invalid meta.link",{link:{'1':1}}],
785
785
  ]