beanbagdb 0.5.80 → 0.6.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.
@@ -1,138 +1,160 @@
1
1
  export const default_app = {
2
- meta :{
3
- name:"beanbagdb_system",
4
- description:"This is the default system app required for proper functioning of the database"
2
+ app_id: "beanbagdb_system",
3
+ meta: {
4
+ description:
5
+ "This is the default system app required for proper functioning of the database",
5
6
  },
6
- schemas:[
7
+ schemas: [
7
8
  {
8
9
  name: "schema",
9
- active:true,
10
- description:"Meta-schema or the schema for defining other schemas",
11
- system_generated:true,
12
- version:0.87,
13
- title:"Schema document",
10
+ active: true,
11
+ description: "Meta-schema or the schema for defining other schemas",
12
+ system_generated: true,
13
+ version: 0.88,
14
+ title: "Schema document",
14
15
  schema: {
15
16
  type: "object",
16
17
  additionalProperties: false,
17
18
  properties: {
18
- system_generated:{
19
- title:"System generated schema",
20
- type:"boolean",
21
- default:false
19
+ system_generated: {
20
+ title: "System generated schema",
21
+ type: "boolean",
22
+ default: false,
22
23
  },
23
- active:{
24
- title:"This indicates where new documents can be created using this schema or not. Old documents can still be edited",
25
- type:"boolean",
26
- default:false
24
+ active: {
25
+ title:"Active",
26
+ description: "This indicates where new documents can be created using this schema or not. Old documents can still be edited",
27
+ type: "boolean",
28
+ default: false,
27
29
  },
28
30
  version: {
29
31
  type: "number",
30
- title:"Version",
32
+ title: "Version",
31
33
  minimum: 0,
32
34
  default: 1,
33
- description:"This is an optional field.To be used primarily for system schemas"
34
- },
35
+ description:
36
+ "This is an optional field.To be used primarily for system schemas",
37
+ },
35
38
  name: {
36
39
  type: "string",
37
- title:"Name",
40
+ title: "Name",
38
41
  minLength: 4,
39
42
  maxLength: 50,
40
43
  pattern: "^[a-zA-Z][a-zA-Z0-9_]*$",
41
- description:"This is the name of the schema.It cannot be changed later"
44
+ description:
45
+ "This is the name of the schema.It cannot be changed later",
42
46
  },
43
- title:{
44
- type:"string",
45
- title:"Title",
46
- minLength:0,
47
- maxLength:1000,
48
- description:"A title to display with records."
47
+ title: {
48
+ type: "string",
49
+ title: "Title",
50
+ minLength: 0,
51
+ maxLength: 1000,
52
+ description: "A title to display with records.",
49
53
  },
50
- description:{
51
- type:"string",
52
- title:"About",
53
- minLength:0,
54
- maxLength:1000,
55
- description:"A small description of what data in this schema stores."
54
+ description: {
55
+ type: "string",
56
+ title: "About",
57
+ minLength: 0,
58
+ maxLength: 1000,
59
+ description:
60
+ "A small description of what data in this schema stores.",
56
61
  },
57
62
  schema: {
58
63
  type: "object",
59
- title:"JSON Schema specification",
64
+ title: "JSON Schema specification",
60
65
  additionalProperties: true,
61
66
  minProperties: 1,
62
67
  maxProperties: 50,
63
- description:"This must be a valid JSON Schema which will be used to validate documents created with this schema.See this https://tour.json-schema.org/",
64
- default:{}
68
+ description:
69
+ "This must be a valid JSON Schema which will be used to validate documents created with this schema.See this https://tour.json-schema.org/",
70
+ default: {},
65
71
  },
66
72
  settings: {
67
73
  type: "object",
68
- title:"Additional Settings",
74
+ title: "Additional Settings",
69
75
  additionalProperties: true,
70
76
  properties: {
71
77
  primary_keys: {
72
- title:"Primary key",
78
+ title: "Primary key",
73
79
  type: "array",
74
80
  default: [],
75
81
  items: {
76
82
  type: "string",
77
83
  },
78
84
  maxItems: 10,
79
- description:"Fields that makes each document unique in the schema.Leave it blank if you do not need it. You can still be able to distinguish documents using the link field and the document id."
85
+ description:
86
+ "Fields that makes each document unique in the schema.Leave it blank if you do not need it. You can still be able to distinguish documents using the link field and the document id.",
80
87
  },
81
88
  non_editable_fields: {
82
89
  type: "array",
83
- title:"Non editable fields",
90
+ title: "Non editable fields",
84
91
  default: [],
85
92
  items: {
86
93
  type: "string",
87
94
  },
88
95
  maxItems: 50,
89
- minItems:0,
90
- description:"The list of fields whose values are added when the document is created but cannot be edited later in future."
96
+ minItems: 0,
97
+ description:
98
+ "The list of fields whose values are added when the document is created but cannot be edited later in future.",
91
99
  },
92
100
  encrypted_fields: {
93
101
  type: "array",
94
- title:"List of fields encrypted",
102
+ title: "List of fields encrypted",
95
103
  default: [],
96
104
  items: {
97
105
  type: "string",
98
106
  },
99
107
  maxItems: 50,
100
- description:"Once set, all the data in this field will be encrypted before storing it in the database. Encryption key must be provided during the time of BeanBagDB initialization and must be managed by the user as it is NOT stored in the database"
108
+ description:
109
+ "Once set, all the data in this field will be encrypted before storing it in the database. Encryption key must be provided during the time of BeanBagDB initialization and must be managed by the user as it is NOT stored in the database",
101
110
  },
102
111
  display_fields: {
103
112
  type: "array",
104
- title:"List of fields to show in short view",
113
+ title: "List of fields to show in short view",
105
114
  default: [],
106
115
  items: {
107
116
  type: "string",
108
117
  },
109
118
  maxItems: 50,
110
- description:"These fields will be used when a record is displayed in short"
111
- }
119
+ description:
120
+ "These fields will be used when a record is displayed in short",
121
+ },
122
+ install_source: {
123
+ type: "string",
124
+ title: "Installation source",
125
+ default: "human",
126
+ description:
127
+ "Describes how this schema was installed in database. This is determined by the system. By default the value is human. Possible value: name of the app , where it was cloned from etc...",
128
+ },
112
129
  },
113
- required :["primary_keys","non_editable_fields","encrypted_fields"]
130
+ required: [
131
+ "primary_keys",
132
+ "non_editable_fields",
133
+ "encrypted_fields",
134
+ ],
114
135
  },
115
136
  },
116
- required: ["name","description","schema", "settings","title"],
137
+ required: ["name", "description", "schema", "settings", "title"],
117
138
  },
118
139
  settings: {
119
140
  primary_keys: ["name"],
120
- non_editable_fields:["system_generated"],
121
- encrypted_fields:[],
122
- display_fields:["name","version","description","title","active"]
141
+ non_editable_fields: ["system_generated"],
142
+ encrypted_fields: [],
143
+ display_fields: ["name", "version", "description", "title", "active"],
123
144
  },
124
145
  },
125
146
  {
126
- system_generated:true,
127
- version:0.63,
128
- description:"To store user defined key. this can include anything like API tokens etc. There is a special method to fetch this. The values are encrypted",
147
+ system_generated: true,
148
+ version: 0.63,
149
+ description:
150
+ "To store user defined key. this can include anything like API tokens etc. There is a special method to fetch this. The values are encrypted",
129
151
  name: "system_key",
130
- title:"System key",
131
- active:true,
152
+ title: "System key",
153
+ active: true,
132
154
  schema: {
133
155
  type: "object",
134
156
  additionalProperties: true,
135
- required:["name","value"],
157
+ required: ["name", "value"],
136
158
  properties: {
137
159
  name: {
138
160
  type: "string",
@@ -145,7 +167,7 @@ export const default_app = {
145
167
  minLength: 5,
146
168
  maxLength: 5000,
147
169
  pattern: "^[^\n\r]*$",
148
- description:"Must be a single line string"
170
+ description: "Must be a single line string",
149
171
  },
150
172
  note: {
151
173
  type: "string",
@@ -156,19 +178,20 @@ export const default_app = {
156
178
  },
157
179
  settings: {
158
180
  primary_keys: ["name"],
159
- encrypted_fields:["value"],
160
- non_editable_fields:[]
181
+ encrypted_fields: ["value"],
182
+ non_editable_fields: [],
161
183
  },
162
184
  },
163
185
  {
164
- version:0.67,
165
- system_generated:true,
166
- description:"The system relies on these settings for proper functioning or enabling optional features.",
186
+ version: 0.67,
187
+ system_generated: true,
188
+ description:
189
+ "The system relies on these settings for proper functioning or enabling optional features.",
167
190
  name: "system_setting",
168
- title:"System Setting",
169
- active:true,
191
+ title: "System Setting",
192
+ active: true,
170
193
  schema: {
171
- required:["name","value"],
194
+ required: ["name", "value"],
172
195
  type: "object",
173
196
  additionalProperties: true,
174
197
  properties: {
@@ -179,81 +202,84 @@ export const default_app = {
179
202
  pattern: "^[a-zA-Z][a-zA-Z0-9_]*$",
180
203
  },
181
204
  value: {
182
- type: ["array","object"]
183
- }
205
+ type: ["array", "object"],
206
+ },
184
207
  },
185
208
  },
186
209
  settings: {
187
210
  primary_keys: ["name"],
188
211
  non_editable_fields: ["name"],
189
- encrypted_fields:[]
212
+ encrypted_fields: [],
190
213
  },
191
214
  },
192
215
  {
193
- name:"system_edge_constraint",
194
- title:"Edge constraint",
195
- system_generated:true,
196
- active:true,
197
- version:0.52,
198
- description: "To define edge constraints for simple directed graph of records.",
199
- schema:{
216
+ name: "system_edge_constraint",
217
+ title: "Edge constraint",
218
+ system_generated: true,
219
+ active: true,
220
+ version: 0.52,
221
+ description:
222
+ "To define edge constraints for simple directed graph of records.",
223
+ schema: {
200
224
  type: "object",
201
225
  additionalProperties: true,
202
- required:["node1","node2","edge_type"],
226
+ required: ["node1", "node2", "edge_type"],
203
227
  properties: {
204
228
  node1: {
205
229
  type: "string",
206
230
  minLength: 1,
207
231
  maxLength: 500,
208
- pattern: "^(\\*|(\\*-[a-zA-Z0-9_-]+)(,[a-zA-Z0-9_-]+)*|[a-zA-Z0-9_-]+(,[a-zA-Z0-9_-]+)*)$"
232
+ pattern:
233
+ "^(\\*|(\\*-[a-zA-Z0-9_-]+)(,[a-zA-Z0-9_-]+)*|[a-zA-Z0-9_-]+(,[a-zA-Z0-9_-]+)*)$",
209
234
  },
210
235
  node2: {
211
236
  type: "string",
212
237
  minLength: 1,
213
238
  maxLength: 500,
214
- pattern: "^(\\*|(\\*-[a-zA-Z0-9_-]+)(,[a-zA-Z0-9_-]+)*|[a-zA-Z0-9_-]+(,[a-zA-Z0-9_-]+)*)$"
239
+ pattern:
240
+ "^(\\*|(\\*-[a-zA-Z0-9_-]+)(,[a-zA-Z0-9_-]+)*|[a-zA-Z0-9_-]+(,[a-zA-Z0-9_-]+)*)$",
215
241
  },
216
- name:{
242
+ name: {
217
243
  type: "string",
218
244
  minLength: 1,
219
245
  maxLength: 500,
220
246
  pattern: "^[a-zA-Z][a-zA-Z0-9_]*$",
221
247
  },
222
- label:{
248
+ label: {
223
249
  type: "string",
224
250
  maxLength: 500,
225
251
  },
226
- note:{
252
+ note: {
227
253
  type: "string",
228
254
  maxLength: 5000,
229
255
  },
230
- max_from_node1:{
231
- type:"number",
256
+ max_from_node1: {
257
+ type: "number",
232
258
  default: -1,
233
259
  },
234
- max_to_node2:{
235
- type:"number",
260
+ max_to_node2: {
261
+ type: "number",
236
262
  default: -1,
237
- }
238
- }
263
+ },
264
+ },
239
265
  },
240
266
  settings: {
241
267
  primary_keys: ["name"],
242
- non_editable_fields:["name"],
243
- encrypted_fields:[]
268
+ non_editable_fields: ["name"],
269
+ encrypted_fields: [],
244
270
  },
245
271
  },
246
272
  {
247
- name:"system_edge",
248
- title:"Edge in the system graph",
249
- active:true,
250
- system_generated:true,
251
- version:0.52,
273
+ name: "system_edge",
274
+ title: "Edge in the system graph",
275
+ active: true,
276
+ system_generated: true,
277
+ version: 0.52,
252
278
  description: "To define edges in the simple directed graph of records.",
253
- schema:{
279
+ schema: {
254
280
  type: "object",
255
281
  additionalProperties: true,
256
- required:["node1","node2","edge_type"],
282
+ required: ["node1", "node2", "edge_type"],
257
283
  properties: {
258
284
  node1: {
259
285
  type: "string",
@@ -261,60 +287,60 @@ export const default_app = {
261
287
  node2: {
262
288
  type: "string",
263
289
  },
264
- edge_name:{
290
+ edge_name: {
265
291
  type: "string",
266
- }
267
- }
292
+ },
293
+ },
268
294
  },
269
295
  settings: {
270
- primary_keys: ["node1","node2","edge_type"],
271
- non_editable_fields:["edge_type"],
272
- encrypted_fields:[]
296
+ primary_keys: ["node1", "node2", "edge_type"],
297
+ non_editable_fields: ["edge_type"],
298
+ encrypted_fields: [],
273
299
  },
274
300
  },
275
301
  {
276
- name:"system_media",
277
- title:"Media content",
278
- active:true,
279
- system_generated:true,
280
- version:0.62,
302
+ name: "system_media",
303
+ title: "Media content",
304
+ active: true,
305
+ system_generated: true,
306
+ version: 0.62,
281
307
  description: "To store images as Base64",
282
- schema:{
308
+ schema: {
283
309
  type: "object",
284
310
  additionalProperties: true,
285
- required:["imageBase64","caption","source"],
311
+ required: ["imageBase64", "caption", "source"],
286
312
  properties: {
287
313
  imageBase64: {
288
314
  type: "string",
289
- "media": {
290
- "binaryEncoding": "base64"
291
- }
315
+ media: {
316
+ binaryEncoding: "base64",
317
+ },
292
318
  },
293
319
  caption: {
294
320
  type: "string",
295
321
  },
296
- source:{
322
+ source: {
297
323
  type: "string",
298
- }
299
- }
324
+ },
325
+ },
300
326
  },
301
327
  settings: {
302
328
  primary_keys: ["caption"],
303
- non_editable_fields:[],
304
- encrypted_fields:[]
329
+ non_editable_fields: [],
330
+ encrypted_fields: [],
305
331
  },
306
332
  },
307
333
  {
308
- name:"system_log",
309
- system_generated:true,
310
- title:"System log",
311
- active:true,
312
- version:0.52,
334
+ name: "system_log",
335
+ system_generated: true,
336
+ title: "System log",
337
+ active: true,
338
+ version: 0.52,
313
339
  description: "To define edges in the simple directed graph of records.",
314
- schema:{
340
+ schema: {
315
341
  type: "object",
316
342
  additionalProperties: true,
317
- required:["text"],
343
+ required: ["text"],
318
344
  properties: {
319
345
  text: {
320
346
  type: "string",
@@ -323,42 +349,70 @@ export const default_app = {
323
349
  type: "object",
324
350
  additionalProperties: true,
325
351
  },
326
- app:{
352
+ app: {
353
+ type: "string",
354
+ },
355
+ time: {
327
356
  type: "string",
328
357
  },
329
- time:{
330
- type:"string"
331
- }
332
- }
358
+ },
333
359
  },
334
360
  settings: {
335
361
  primary_keys: [],
336
- non_editable_fields:[],
337
- encrypted_fields:[]
362
+ non_editable_fields: [],
363
+ encrypted_fields: [],
338
364
  },
339
- }
340
- ],
341
- records:[]
342
- }
343
-
344
-
365
+ },
366
+ ],
367
+ records: [],
368
+ };
345
369
 
346
370
  // this is not stored in the DB. only for validating the metadata during doc update
347
371
  export const editable_metadata_schema = {
348
372
  additionalProperties: false,
349
- type:"object",
350
- properties:{
351
- tags:{
352
- type:"array",
353
- items:{type:"string"},
354
- default:[],
373
+ type: "object",
374
+ properties: {
375
+ tags: {
376
+ type: "array",
377
+ items: { type: "string" },
378
+ default: [],
355
379
  maxItems: 40,
356
380
  },
357
- link:{
358
- type:"string",
359
- minLength:2,
360
- maxLength:2000,
361
- pattern: "^[a-zA-Z0-9-]+$"
381
+ link: {
382
+ type: "string",
383
+ minLength: 2,
384
+ maxLength: 2000,
385
+ pattern: "^[a-zA-Z0-9-]+$",
386
+ },
387
+ },
388
+ };
389
+
390
+ export const app_data_schema = {
391
+ additionalProperties: true,
392
+ type: "object",
393
+ required: ["app_id"],
394
+ properties: {
395
+ app_id: {
396
+ type: "string",
397
+ },
398
+ meta: {
399
+ type: "object",
400
+ additionalProperties: true,
401
+ },
402
+ schemas: {
403
+ type: "array",
404
+ minItems: 1,
405
+ // each schema must have a version
406
+ },
407
+ records: {
408
+ type: "array",
409
+ // each record must have a version
410
+ default:[]
411
+ },
412
+ default_setting:{
413
+ type: "object",
414
+ additionalProperties:true,
415
+ default : {}
362
416
  }
363
- }
364
- }
417
+ },
418
+ };