beanbagdb 0.6.0 → 0.6.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 +4 -2
- package/src/system_schema.js +46 -0
- package/test/operations.test.js +2 -2
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -1043,13 +1043,16 @@ async _upgrade_schema_in_bulk(schemas,log_upgrade=false,log_message="Schema Upgr
|
|
|
1043
1043
|
if (!schema_name) {
|
|
1044
1044
|
throw new Error("Schema name not provided for the blank doc");
|
|
1045
1045
|
}
|
|
1046
|
+
let dt = this.util_get_now_unix_timestamp()
|
|
1047
|
+
let title = `${schema_name} document - ${dt}`
|
|
1046
1048
|
let doc = {
|
|
1047
1049
|
data: {},
|
|
1048
1050
|
meta: {
|
|
1049
|
-
created_on:
|
|
1051
|
+
created_on: dt,
|
|
1050
1052
|
tags: [],
|
|
1051
1053
|
app: {},
|
|
1052
1054
|
link: this.util_generate_random_link(), // there is a link by default. overwrite this if user provided one but only before checking if it is unique
|
|
1055
|
+
title: title
|
|
1053
1056
|
},
|
|
1054
1057
|
schema: schema_name,
|
|
1055
1058
|
};
|
|
@@ -1088,7 +1091,6 @@ async _upgrade_schema_in_bulk(schemas,log_upgrade=false,log_message="Schema Upgr
|
|
|
1088
1091
|
console.log(error)
|
|
1089
1092
|
throw new EncryptionError([{message:error.message}])
|
|
1090
1093
|
}
|
|
1091
|
-
|
|
1092
1094
|
}
|
|
1093
1095
|
|
|
1094
1096
|
/**
|
package/src/system_schema.js
CHANGED
|
@@ -363,6 +363,48 @@ export const default_app = {
|
|
|
363
363
|
encrypted_fields: [],
|
|
364
364
|
},
|
|
365
365
|
},
|
|
366
|
+
{
|
|
367
|
+
name: "system_script",
|
|
368
|
+
system_generated: true,
|
|
369
|
+
title: "Executable script",
|
|
370
|
+
active: true,
|
|
371
|
+
version: 0.1,
|
|
372
|
+
description: "To create scripts that implement some logic. Can run both on browser and client.",
|
|
373
|
+
schema: {
|
|
374
|
+
type: "object",
|
|
375
|
+
additionalProperties: true,
|
|
376
|
+
required: ["script","type","version"],
|
|
377
|
+
properties: {
|
|
378
|
+
type: {
|
|
379
|
+
type: "string",
|
|
380
|
+
default:"JS"
|
|
381
|
+
},
|
|
382
|
+
script: {
|
|
383
|
+
type: "string",
|
|
384
|
+
description:"The script",
|
|
385
|
+
default:""
|
|
386
|
+
},
|
|
387
|
+
usage:{
|
|
388
|
+
type:"string",
|
|
389
|
+
description:"Documentation",
|
|
390
|
+
default:" "
|
|
391
|
+
},
|
|
392
|
+
version :{
|
|
393
|
+
type:"number",
|
|
394
|
+
default:0.1
|
|
395
|
+
},
|
|
396
|
+
log_execution:{
|
|
397
|
+
type:"boolean",
|
|
398
|
+
default:false
|
|
399
|
+
}
|
|
400
|
+
},
|
|
401
|
+
},
|
|
402
|
+
settings: {
|
|
403
|
+
primary_keys: [],
|
|
404
|
+
non_editable_fields: [],
|
|
405
|
+
encrypted_fields: [],
|
|
406
|
+
},
|
|
407
|
+
},
|
|
366
408
|
],
|
|
367
409
|
records: [],
|
|
368
410
|
};
|
|
@@ -384,6 +426,10 @@ export const editable_metadata_schema = {
|
|
|
384
426
|
maxLength: 2000,
|
|
385
427
|
pattern: "^[a-zA-Z0-9-]+$",
|
|
386
428
|
},
|
|
429
|
+
title:{
|
|
430
|
+
type:"string",
|
|
431
|
+
maxLength:10000
|
|
432
|
+
}
|
|
387
433
|
},
|
|
388
434
|
};
|
|
389
435
|
|
package/test/operations.test.js
CHANGED
|
@@ -1371,7 +1371,7 @@ describe("Doc search tests", async () => {
|
|
|
1371
1371
|
it('all docs', async () => {
|
|
1372
1372
|
try {
|
|
1373
1373
|
let udata = await database3.search({selector:{}})
|
|
1374
|
-
assert(udata.docs.length==
|
|
1374
|
+
assert(udata.docs.length==13)
|
|
1375
1375
|
} catch (error) {
|
|
1376
1376
|
//console.log(error)
|
|
1377
1377
|
throw error
|
|
@@ -1391,7 +1391,7 @@ describe("Doc search tests", async () => {
|
|
|
1391
1391
|
it('read docs 2', async () => {
|
|
1392
1392
|
try {
|
|
1393
1393
|
let udata = await database3.search({selector:{"schema":"schema"}})
|
|
1394
|
-
assert(udata.docs.length==
|
|
1394
|
+
assert(udata.docs.length==9) // schema,book,setting,key,edge,edge_constraints
|
|
1395
1395
|
} catch (error) {
|
|
1396
1396
|
//console.log(error)
|
|
1397
1397
|
throw error
|