@saltcorn/data 0.6.1-beta.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/base-plugin/actions.js +172 -1
- package/base-plugin/fieldviews.js +63 -0
- package/base-plugin/fileviews.js +41 -0
- package/base-plugin/index.js +35 -0
- package/base-plugin/types.js +345 -9
- package/base-plugin/viewtemplates/edit.js +107 -0
- package/base-plugin/viewtemplates/feed.js +46 -0
- package/base-plugin/viewtemplates/filter.js +43 -0
- package/base-plugin/viewtemplates/list.js +73 -1
- package/base-plugin/viewtemplates/listshowlist.js +54 -3
- package/base-plugin/viewtemplates/room.js +100 -0
- package/base-plugin/viewtemplates/show.js +86 -0
- package/base-plugin/viewtemplates/viewable_fields.js +124 -0
- package/contracts.js +58 -0
- package/db/connect.js +13 -5
- package/db/db.test.js +0 -154
- package/db/fixtures.js +13 -1
- package/db/index.js +42 -3
- package/db/reset_schema.js +11 -0
- package/db/state.js +105 -36
- package/index.js +13 -0
- package/migrate.js +4 -1
- package/models/backup.js +78 -0
- package/models/config.js +113 -22
- package/models/crash.js +44 -0
- package/models/discovery.js +13 -11
- package/models/email.js +17 -0
- package/models/eventlog.js +51 -0
- package/models/expression.js +49 -1
- package/models/field.js +88 -9
- package/models/fieldrepeat.js +33 -0
- package/models/file.js +23 -4
- package/models/form.js +34 -0
- package/models/index.js +42 -0
- package/models/layout.js +33 -0
- package/models/library.js +44 -0
- package/models/pack.js +88 -0
- package/models/page.js +13 -3
- package/models/plugin.js +9 -2
- package/models/random.js +36 -0
- package/models/role.js +36 -0
- package/models/scheduler.js +28 -0
- package/models/table.js +34 -15
- package/models/table_constraints.js +44 -0
- package/models/tenant.js +46 -9
- package/models/trigger.js +24 -11
- package/models/user.js +33 -8
- package/models/view.js +89 -8
- package/models/workflow.js +31 -0
- package/package.json +7 -5
- package/plugin-helper.js +102 -44
- package/plugin-testing.js +4 -0
- package/tests/exact_views.test.js +5 -5
- package/utils.js +4 -0
- package/db/internal.js +0 -229
- package/db/multi-tenant.js +0 -24
- package/db/pg.js +0 -374
- package/db/single-tenant.js +0 -8
- package/db/sqlite.js +0 -280
- package/db/tenants.js +0 -6
package/migrate.js
CHANGED
package/models/backup.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @category saltcorn-data
|
|
3
|
+
* @module models/backup
|
|
4
|
+
* @subcategory models
|
|
5
|
+
*/
|
|
1
6
|
const { contract, is } = require("contractis");
|
|
2
7
|
const { getState } = require("../db/state");
|
|
3
8
|
const db = require("../db");
|
|
@@ -30,6 +35,11 @@ const { asyncMap } = require("../utils");
|
|
|
30
35
|
const Trigger = require("./trigger");
|
|
31
36
|
const Library = require("./library");
|
|
32
37
|
|
|
38
|
+
/**
|
|
39
|
+
* @function
|
|
40
|
+
* @param {string} dirpath
|
|
41
|
+
* @returns {Promise<void>}
|
|
42
|
+
*/
|
|
33
43
|
const create_pack = contract(
|
|
34
44
|
is.fun(is.str, is.promise(is.undefined)),
|
|
35
45
|
async (dirpath) => {
|
|
@@ -58,6 +68,12 @@ const create_pack = contract(
|
|
|
58
68
|
}
|
|
59
69
|
);
|
|
60
70
|
|
|
71
|
+
/**
|
|
72
|
+
* @function
|
|
73
|
+
* @param {object[]} rows
|
|
74
|
+
* @param {string} fnm
|
|
75
|
+
* @returns {Promise<void>}
|
|
76
|
+
*/
|
|
61
77
|
const create_csv_from_rows = contract(
|
|
62
78
|
is.fun([is.array(is.obj()), is.str], is.promise(is.undefined)),
|
|
63
79
|
async (rows, fnm) => {
|
|
@@ -74,6 +90,12 @@ const create_csv_from_rows = contract(
|
|
|
74
90
|
}
|
|
75
91
|
);
|
|
76
92
|
|
|
93
|
+
/**
|
|
94
|
+
* @function
|
|
95
|
+
* @param {Table} table
|
|
96
|
+
* @param {string} dirpath
|
|
97
|
+
* @returns {Promise<void>}
|
|
98
|
+
*/
|
|
77
99
|
const create_table_json = contract(
|
|
78
100
|
is.fun([is.class("Table"), is.str], is.promise(is.undefined)),
|
|
79
101
|
async (table, dirpath) => {
|
|
@@ -85,6 +107,11 @@ const create_table_json = contract(
|
|
|
85
107
|
}
|
|
86
108
|
);
|
|
87
109
|
|
|
110
|
+
/**
|
|
111
|
+
* @function
|
|
112
|
+
* @param {string} root_dirpath
|
|
113
|
+
* @return {Promise<void>}
|
|
114
|
+
*/
|
|
88
115
|
const create_table_jsons = contract(
|
|
89
116
|
is.fun(is.str, is.promise(is.undefined)),
|
|
90
117
|
async (root_dirpath) => {
|
|
@@ -97,6 +124,11 @@ const create_table_jsons = contract(
|
|
|
97
124
|
}
|
|
98
125
|
);
|
|
99
126
|
|
|
127
|
+
/**
|
|
128
|
+
* @function
|
|
129
|
+
* @param {string} root_dirpath
|
|
130
|
+
* @returns {Promise<void>}
|
|
131
|
+
*/
|
|
100
132
|
const backup_files = contract(
|
|
101
133
|
is.fun(is.str, is.promise(is.undefined)),
|
|
102
134
|
async (root_dirpath) => {
|
|
@@ -113,6 +145,11 @@ const backup_files = contract(
|
|
|
113
145
|
}
|
|
114
146
|
);
|
|
115
147
|
|
|
148
|
+
/**
|
|
149
|
+
* @function
|
|
150
|
+
* @param {string} root_dirpath
|
|
151
|
+
* @returns {Promise<void>}
|
|
152
|
+
*/
|
|
116
153
|
const backup_config = contract(
|
|
117
154
|
is.fun(is.str, is.promise(is.undefined)),
|
|
118
155
|
async (root_dirpath) => {
|
|
@@ -129,6 +166,12 @@ const backup_config = contract(
|
|
|
129
166
|
}
|
|
130
167
|
}
|
|
131
168
|
);
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* @function
|
|
172
|
+
* @param {string} [fnm]
|
|
173
|
+
* @returns {Promise<string>}
|
|
174
|
+
*/
|
|
132
175
|
const create_backup = contract(
|
|
133
176
|
is.fun([is.maybe(is.str)], is.promise(is.str)),
|
|
134
177
|
async (fnm) => {
|
|
@@ -156,6 +199,12 @@ const create_backup = contract(
|
|
|
156
199
|
}
|
|
157
200
|
);
|
|
158
201
|
|
|
202
|
+
/**
|
|
203
|
+
* @function
|
|
204
|
+
* @param {string} fnm
|
|
205
|
+
* @param {string} dir
|
|
206
|
+
* @returns {Promise<void>}
|
|
207
|
+
*/
|
|
159
208
|
const extract = contract(
|
|
160
209
|
is.fun([is.str, is.str], is.promise(is.undefined)),
|
|
161
210
|
async (fnm, dir) => {
|
|
@@ -168,6 +217,12 @@ const extract = contract(
|
|
|
168
217
|
});
|
|
169
218
|
}
|
|
170
219
|
);
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* @function
|
|
223
|
+
* @param {string} dirpath
|
|
224
|
+
* @returns {Promise<object>}
|
|
225
|
+
*/
|
|
171
226
|
const restore_files = contract(
|
|
172
227
|
is.fun(is.str, is.promise(is.obj({}))),
|
|
173
228
|
async (dirpath) => {
|
|
@@ -191,6 +246,11 @@ const restore_files = contract(
|
|
|
191
246
|
}
|
|
192
247
|
);
|
|
193
248
|
|
|
249
|
+
/**
|
|
250
|
+
* @function
|
|
251
|
+
* @param {object} file_users
|
|
252
|
+
* @returns {Promise<void>}
|
|
253
|
+
*/
|
|
194
254
|
const restore_file_users = contract(
|
|
195
255
|
is.fun(is.obj({}), is.promise(is.undefined)),
|
|
196
256
|
async (file_users) => {
|
|
@@ -200,6 +260,12 @@ const restore_file_users = contract(
|
|
|
200
260
|
}
|
|
201
261
|
);
|
|
202
262
|
|
|
263
|
+
/**
|
|
264
|
+
* @function
|
|
265
|
+
* @param {string} file_users
|
|
266
|
+
* @param {boolean} [restore_first_user]
|
|
267
|
+
* @returns {Promise<string|undefined>}
|
|
268
|
+
*/
|
|
203
269
|
const restore_tables = contract(
|
|
204
270
|
is.fun([is.str, is.maybe(is.bool)], is.promise(is.maybe(is.str))),
|
|
205
271
|
async (dirpath, restore_first_user) => {
|
|
@@ -237,6 +303,11 @@ const restore_tables = contract(
|
|
|
237
303
|
}
|
|
238
304
|
);
|
|
239
305
|
|
|
306
|
+
/**
|
|
307
|
+
* @function
|
|
308
|
+
* @param {string} dirpath
|
|
309
|
+
* @returns {Promise<void>}
|
|
310
|
+
*/
|
|
240
311
|
const restore_config = contract(
|
|
241
312
|
is.fun(is.str, is.promise(is.undefined)),
|
|
242
313
|
async (dirpath) => {
|
|
@@ -250,6 +321,13 @@ const restore_config = contract(
|
|
|
250
321
|
}
|
|
251
322
|
);
|
|
252
323
|
|
|
324
|
+
/**
|
|
325
|
+
* @function
|
|
326
|
+
* @param {string} fnm
|
|
327
|
+
* @param {function} loadAndSaveNewPlugin
|
|
328
|
+
* @param {boolean} [restore_first_user]
|
|
329
|
+
* @returns {Promise<void>}
|
|
330
|
+
*/
|
|
253
331
|
const restore = contract(
|
|
254
332
|
is.fun(
|
|
255
333
|
[is.str, is.fun(is_plugin, is.undefined), is.maybe(is.bool)],
|