beanbagdb 0.6.8 → 0.7.0

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.8",
3
+ "version": "0.7.0",
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
@@ -739,6 +739,10 @@ export class BeanBagDB {
739
739
  })
740
740
  return schemas
741
741
  }
742
+ },
743
+ editable_meta_schema: async (criteria)=>{
744
+ let e = sys_sch.editable_metadata_schema
745
+ return e
742
746
  }
743
747
  }
744
748
  if(!input.type){throw new ValidationError("No type provided. Must be: "+Object.keys(fetch_docs).join(","))}
@@ -844,7 +848,7 @@ export class BeanBagDB {
844
848
  */
845
849
  async _create_edge(input){
846
850
  console.log(input)
847
- let {node1,node2,edge_name,note=""} = input
851
+ let {node1,node2,edge_name,note="",level_weight=1} = input
848
852
  this._check_ready_to_use();
849
853
  if(!edge_name){throw new ValidationError("edge_name required")}
850
854
  if(!node1|| Object.keys(node1).length==0){throw new ValidationError("node1 required")}
@@ -899,7 +903,7 @@ async _create_edge(input){
899
903
 
900
904
  if(errors.length==0){
901
905
  // let edge = await this.create({schema:"system_edge",data:})
902
- 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}
903
907
  }else{
904
908
  throw new RelationError(errors)
905
909
  }
@@ -908,7 +912,7 @@ async _create_edge(input){
908
912
  if(error instanceof DocNotFoundError){
909
913
  let doc = {node1:"*",node2:"*",name:edge_name,note:note}
910
914
  let new_doc = await this.create({schema:"system_edge_constraint",data:doc})
911
- 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}
912
916
  }else{
913
917
  throw error
914
918
  }
@@ -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
  },
@@ -363,10 +368,6 @@ export const default_app = {
363
368
  text: {
364
369
  type: "string",
365
370
  },
366
- data: {
367
- type: "object",
368
- additionalProperties: true,
369
- },
370
371
  app: {
371
372
  type: "string",
372
373
  }
@@ -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
  ]