beanbagdb 0.6.1 → 0.6.3

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.1",
3
+ "version": "0.6.3",
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
@@ -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.meta.name },
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.meta.name} app to v.${latest_version}`
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.meta.name=="beanbagdb_system"){
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.meta.name}
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
 
@@ -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
  },
@@ -368,7 +369,7 @@ export const default_app = {
368
369
  system_generated: true,
369
370
  title: "Executable script",
370
371
  active: true,
371
- version: 0.1,
372
+ version: 0.2,
372
373
  description: "To create scripts that implement some logic. Can run both on browser and client.",
373
374
  schema: {
374
375
  type: "object",
@@ -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
  },