beanbagdb 0.6.1 → 0.6.2
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 -4
- package/src/system_schema.js +7 -1
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -257,7 +257,7 @@ export class BeanBagDB {
|
|
|
257
257
|
|
|
258
258
|
// check if app setting record exists
|
|
259
259
|
let version_search = await this.db_api.search({
|
|
260
|
-
selector: { schema: "system_setting", "data.name": app_data.
|
|
260
|
+
selector: { schema: "system_setting", "data.name": app_data.app_id },
|
|
261
261
|
})
|
|
262
262
|
|
|
263
263
|
let update_required = true
|
|
@@ -275,7 +275,7 @@ export class BeanBagDB {
|
|
|
275
275
|
// if version is latest no additional steps required
|
|
276
276
|
// version mismatch => update all docs
|
|
277
277
|
|
|
278
|
-
let text = `Initializing ${app_data.
|
|
278
|
+
let text = `Initializing ${app_data.app_id} app to v.${latest_version}`
|
|
279
279
|
let steps = ["update started"]
|
|
280
280
|
|
|
281
281
|
for (let index = 0; index < app_data.schemas.length; index++) {
|
|
@@ -301,7 +301,7 @@ export class BeanBagDB {
|
|
|
301
301
|
// console.log(error);
|
|
302
302
|
if (error instanceof DocNotFoundError) {
|
|
303
303
|
// inserting new schema doc
|
|
304
|
-
if(schema_name=="schema"&& app_data.
|
|
304
|
+
if(schema_name=="schema"&& app_data.app_id=="beanbagdb_system"){
|
|
305
305
|
// this is to initialize the system schema
|
|
306
306
|
let schema_schema_doc = this._get_blank_doc("schema");
|
|
307
307
|
schema_schema_doc.data = schema_data;
|
|
@@ -346,7 +346,7 @@ export class BeanBagDB {
|
|
|
346
346
|
|
|
347
347
|
// add a new log
|
|
348
348
|
let new_log_doc = this._get_blank_doc("system_log")
|
|
349
|
-
new_log_doc.data = {text,data:{steps},time:this.util_get_now_unix_timestamp(),app:app_data.
|
|
349
|
+
new_log_doc.data = {text,data:{steps},time:this.util_get_now_unix_timestamp(),app:app_data.app_id}
|
|
350
350
|
await this.db_api.insert(new_log_doc);
|
|
351
351
|
console.log("init logged")
|
|
352
352
|
|
package/src/system_schema.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export const default_app = {
|
|
2
2
|
app_id: "beanbagdb_system",
|
|
3
3
|
meta: {
|
|
4
|
+
name: "beanbagdb_system",
|
|
4
5
|
description:
|
|
5
6
|
"This is the default system app required for proper functioning of the database",
|
|
6
7
|
},
|
|
@@ -379,6 +380,11 @@ export const default_app = {
|
|
|
379
380
|
type: "string",
|
|
380
381
|
default:"JS"
|
|
381
382
|
},
|
|
383
|
+
name: {
|
|
384
|
+
type: "string",
|
|
385
|
+
default:"script-name",
|
|
386
|
+
pattern: "^[a-zA-Z0-9\\-]+$"
|
|
387
|
+
},
|
|
382
388
|
script: {
|
|
383
389
|
type: "string",
|
|
384
390
|
description:"The script",
|
|
@@ -400,7 +406,7 @@ export const default_app = {
|
|
|
400
406
|
},
|
|
401
407
|
},
|
|
402
408
|
settings: {
|
|
403
|
-
primary_keys: [],
|
|
409
|
+
primary_keys: ["name"],
|
|
404
410
|
non_editable_fields: [],
|
|
405
411
|
encrypted_fields: [],
|
|
406
412
|
},
|