@saltcorn/data 1.6.0-alpha.6 → 1.6.0-alpha.7

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.
Files changed (67) hide show
  1. package/dist/base-plugin/actions.d.ts +3 -0
  2. package/dist/base-plugin/actions.d.ts.map +1 -1
  3. package/dist/base-plugin/actions.js +8 -0
  4. package/dist/base-plugin/actions.js.map +1 -1
  5. package/dist/base-plugin/index.d.ts +2 -8
  6. package/dist/base-plugin/index.d.ts.map +1 -1
  7. package/dist/base-plugin/viewtemplates/edit.d.ts.map +1 -1
  8. package/dist/base-plugin/viewtemplates/edit.js +15 -0
  9. package/dist/base-plugin/viewtemplates/edit.js.map +1 -1
  10. package/dist/base-plugin/viewtemplates/filter.d.ts.map +1 -1
  11. package/dist/base-plugin/viewtemplates/filter.js +15 -0
  12. package/dist/base-plugin/viewtemplates/filter.js.map +1 -1
  13. package/dist/base-plugin/viewtemplates/list.d.ts +1 -4
  14. package/dist/base-plugin/viewtemplates/list.d.ts.map +1 -1
  15. package/dist/base-plugin/viewtemplates/list.js +15 -0
  16. package/dist/base-plugin/viewtemplates/list.js.map +1 -1
  17. package/dist/base-plugin/viewtemplates/show.d.ts +1 -4
  18. package/dist/base-plugin/viewtemplates/show.d.ts.map +1 -1
  19. package/dist/base-plugin/viewtemplates/show.js +15 -0
  20. package/dist/base-plugin/viewtemplates/show.js.map +1 -1
  21. package/dist/db/fixtures.d.ts +2 -7
  22. package/dist/db/fixtures.d.ts.map +1 -1
  23. package/dist/db/fixtures.js +2349 -2352
  24. package/dist/db/fixtures.js.map +1 -1
  25. package/dist/db/reset_schema.d.ts +3 -3
  26. package/dist/db/reset_schema.d.ts.map +1 -1
  27. package/dist/db/reset_schema.js +10 -10
  28. package/dist/db/reset_schema.js.map +1 -1
  29. package/dist/index.d.ts +5 -1
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/index.js +1 -1
  32. package/dist/index.js.map +1 -1
  33. package/dist/migrate.d.ts +9 -3
  34. package/dist/migrate.d.ts.map +1 -1
  35. package/dist/migrate.js +26 -20
  36. package/dist/migrate.js.map +1 -1
  37. package/dist/model-helper.d.ts +30 -17
  38. package/dist/model-helper.d.ts.map +1 -1
  39. package/dist/model-helper.js +43 -26
  40. package/dist/model-helper.js.map +1 -1
  41. package/dist/models/trigger.d.ts +2 -1
  42. package/dist/models/trigger.d.ts.map +1 -1
  43. package/dist/models/trigger.js +3 -1
  44. package/dist/models/trigger.js.map +1 -1
  45. package/dist/models/view.js +4 -4
  46. package/dist/models/view.js.map +1 -1
  47. package/dist/plugin-helper.d.ts +218 -191
  48. package/dist/plugin-helper.d.ts.map +1 -1
  49. package/dist/plugin-helper.js +237 -185
  50. package/dist/plugin-helper.js.map +1 -1
  51. package/dist/plugin-testing.d.ts +64 -4
  52. package/dist/plugin-testing.d.ts.map +1 -1
  53. package/dist/plugin-testing.js +32 -16
  54. package/dist/plugin-testing.js.map +1 -1
  55. package/dist/standard-menu.d.ts +6 -1
  56. package/dist/standard-menu.d.ts.map +1 -1
  57. package/dist/standard-menu.js +5 -0
  58. package/dist/standard-menu.js.map +1 -1
  59. package/dist/viewable_fields.d.ts +150 -112
  60. package/dist/viewable_fields.d.ts.map +1 -1
  61. package/dist/viewable_fields.js +124 -107
  62. package/dist/viewable_fields.js.map +1 -1
  63. package/dist/web-mobile-commons.d.ts +1 -2
  64. package/dist/web-mobile-commons.d.ts.map +1 -1
  65. package/dist/web-mobile-commons.js +3 -4
  66. package/dist/web-mobile-commons.js.map +1 -1
  67. package/package.json +8 -8
@@ -1,4 +1,7 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  /**
3
6
  * init fixtures
4
7
  * @category saltcorn-data
@@ -7,559 +10,542 @@
7
10
  */
8
11
  const db = require(".");
9
12
  const { getState } = require("./state");
10
- const Table = require("../models/table");
11
- const Field = require("../models/field");
12
- const File = require("../models/file");
13
- const Trigger = require("../models/trigger");
14
- const View = require("../models/view");
15
- const User = require("../models/user");
16
- const Page = require("../models/page");
17
- const PageGroup = require("../models/page_group");
18
- const PageGroupMember = require("../models/page_group_member");
19
- const Tag = require("../models/tag");
20
- const Model = require("../models/model");
21
- const ModelInstance = require("../models/model_instance");
22
- const fs = require("fs").promises;
23
- module.exports =
24
- /**
25
- * @function
26
- * @name "module.exports function"
27
- * @returns {Promise<void>}
28
- */
29
- async () => {
30
- getState().registerPlugin("base", require("../base-plugin"));
31
- const table = await Table.create("books", {
32
- min_role_read: 100,
33
- min_role_write: 1,
34
- });
35
- await Field.create({
36
- table,
37
- name: "author",
38
- label: "Author",
39
- type: "String",
40
- required: true,
41
- });
42
- await Field.create({
43
- table,
44
- name: "pages",
45
- label: "Pages",
46
- type: "Integer",
47
- required: true,
48
- attributes: { min: 0 },
49
- });
50
- const patients = await Table.create("patients", {
51
- min_role_read: 40,
52
- });
53
- await Field.create({
54
- table: patients,
55
- name: "name",
56
- label: "Name",
57
- type: "String",
58
- required: true,
59
- });
60
- await Field.create({
61
- table: patients,
62
- name: "favbook",
63
- label: "Favourite book",
64
- type: "Key",
65
- reftable: table,
66
- required: false,
67
- attributes: { summary_field: "author", include_fts: true },
68
- });
69
- await Field.create({
70
- table: patients,
71
- name: "parent",
72
- label: "Parent",
73
- type: "Key",
74
- reftable: patients,
75
- required: false,
76
- attributes: { summary_field: "name" },
77
- });
78
- const authorList = await View.create({
79
- table_id: table.id,
80
- name: "authorlist",
81
- viewtemplate: "List",
82
- configuration: {
83
- columns: [
84
- { type: "Field", field_name: "author", state_field: "on" },
85
- { type: "ViewLink", view: "Own:authorshow" },
86
- { type: "Action", action_name: "Delete" },
13
+ const table_1 = __importDefault(require("../models/table"));
14
+ const field_1 = __importDefault(require("../models/field"));
15
+ const file_1 = __importDefault(require("../models/file"));
16
+ const trigger_1 = __importDefault(require("../models/trigger"));
17
+ const view_1 = __importDefault(require("../models/view"));
18
+ const user_1 = __importDefault(require("../models/user"));
19
+ const page_1 = __importDefault(require("../models/page"));
20
+ const page_group_1 = __importDefault(require("../models/page_group"));
21
+ const tag_1 = __importDefault(require("../models/tag"));
22
+ const model_1 = __importDefault(require("../models/model"));
23
+ const model_instance_1 = __importDefault(require("../models/model_instance"));
24
+ const fs_1 = __importDefault(require("fs"));
25
+ const fsp = fs_1.default.promises;
26
+ module.exports = async () => {
27
+ getState().registerPlugin("base", require("../base-plugin"));
28
+ const table = await table_1.default.create("books", {
29
+ min_role_read: 100,
30
+ min_role_write: 1,
31
+ });
32
+ await field_1.default.create({
33
+ table,
34
+ name: "author",
35
+ label: "Author",
36
+ type: "String",
37
+ required: true,
38
+ });
39
+ await field_1.default.create({
40
+ table,
41
+ name: "pages",
42
+ label: "Pages",
43
+ type: "Integer",
44
+ required: true,
45
+ attributes: { min: 0 },
46
+ });
47
+ const patients = await table_1.default.create("patients", {
48
+ min_role_read: 40,
49
+ });
50
+ await field_1.default.create({
51
+ table: patients,
52
+ name: "name",
53
+ label: "Name",
54
+ type: "String",
55
+ required: true,
56
+ });
57
+ await field_1.default.create({
58
+ table: patients,
59
+ name: "favbook",
60
+ label: "Favourite book",
61
+ type: "Key",
62
+ reftable: table,
63
+ required: false,
64
+ attributes: { summary_field: "author", include_fts: true },
65
+ });
66
+ await field_1.default.create({
67
+ table: patients,
68
+ name: "parent",
69
+ label: "Parent",
70
+ type: "Key",
71
+ reftable: patients,
72
+ required: false,
73
+ attributes: { summary_field: "name" },
74
+ });
75
+ const authorList = await view_1.default.create({
76
+ table_id: table.id,
77
+ name: "authorlist",
78
+ viewtemplate: "List",
79
+ configuration: {
80
+ columns: [
81
+ { type: "Field", field_name: "author", state_field: "on" },
82
+ { type: "ViewLink", view: "Own:authorshow" },
83
+ { type: "Action", action_name: "Delete" },
84
+ {
85
+ type: "Aggregation",
86
+ agg_relation: "patients.favbook",
87
+ agg_field: "name",
88
+ stat: "Count",
89
+ },
90
+ ],
91
+ },
92
+ min_role: 100,
93
+ });
94
+ const authorShow = await view_1.default.create({
95
+ table_id: table.id,
96
+ name: "authorshow",
97
+ viewtemplate: "Show",
98
+ configuration: {
99
+ columns: [
100
+ { type: "Field", field_name: "author", state_field: "on" },
101
+ { type: "ViewLink", view: "Own:authorshow" },
102
+ { type: "Action", action_name: "Delete" },
103
+ {
104
+ type: "Aggregation",
105
+ agg_relation: "patients.favbook",
106
+ agg_field: "name",
107
+ stat: "Count",
108
+ },
109
+ ],
110
+ layout: {
111
+ above: [{ type: "field", fieldview: "show", field_name: "author" }],
112
+ },
113
+ },
114
+ min_role: 100,
115
+ });
116
+ await view_1.default.create({
117
+ table_id: table.id,
118
+ name: "authorshow_with_list_legacy",
119
+ viewtemplate: "Show",
120
+ configuration: {
121
+ columns: [{ type: "Field", field_name: "author", state_field: "on" }],
122
+ layout: {
123
+ above: [
124
+ { type: "field", fieldview: "show", field_name: "author" },
87
125
  {
88
- type: "Aggregation",
89
- agg_relation: "patients.favbook",
90
- agg_field: "name",
91
- stat: "Count",
126
+ name: "1512ef",
127
+ type: "view",
128
+ view: "Independent:authorlist",
129
+ state: "shared",
92
130
  },
93
131
  ],
94
132
  },
95
- min_role: 100,
96
- });
97
- const authorShow = await View.create({
98
- table_id: table.id,
99
- name: "authorshow",
100
- viewtemplate: "Show",
101
- configuration: {
102
- columns: [
103
- { type: "Field", field_name: "author", state_field: "on" },
104
- { type: "ViewLink", view: "Own:authorshow" },
105
- { type: "Action", action_name: "Delete" },
106
- {
107
- type: "Aggregation",
108
- agg_relation: "patients.favbook",
109
- agg_field: "name",
110
- stat: "Count",
111
- },
133
+ },
134
+ min_role: 100,
135
+ });
136
+ const authorEdit = await view_1.default.create({
137
+ table_id: table.id,
138
+ name: "authoredit",
139
+ viewtemplate: "Edit",
140
+ configuration: {
141
+ columns: [{ type: "Field", field_name: "author" }],
142
+ layout: {
143
+ above: [{ type: "field", fieldview: "edit", field_name: "author" }],
144
+ },
145
+ fixed: {
146
+ pages: 678,
147
+ },
148
+ view_when_done: "authorlist",
149
+ enable_realtime: true,
150
+ update_events: [{ event: "custom_update_event" }],
151
+ },
152
+ min_role: 100,
153
+ });
154
+ await view_1.default.create({
155
+ table_id: table.id,
156
+ name: "authoredit_identicals",
157
+ viewtemplate: "Edit",
158
+ configuration: {
159
+ columns: [
160
+ { type: "Field", field_name: "author" },
161
+ { type: "Field", field_name: "author" },
162
+ ],
163
+ layout: {
164
+ above: [
165
+ { type: "field", fieldview: "edit", field_name: "author" },
166
+ { type: "field", fieldview: "edit", field_name: "author" },
112
167
  ],
113
- layout: {
114
- above: [{ type: "field", fieldview: "show", field_name: "author" }],
115
- },
116
168
  },
117
- min_role: 100,
118
- });
119
- await View.create({
120
- table_id: table.id,
121
- name: "authorshow_with_list_legacy",
122
- viewtemplate: "Show",
123
- configuration: {
124
- columns: [{ type: "Field", field_name: "author", state_field: "on" }],
125
- layout: {
126
- above: [
127
- { type: "field", fieldview: "show", field_name: "author" },
128
- {
129
- name: "1512ef",
130
- type: "view",
131
- view: "Independent:authorlist",
132
- state: "shared",
133
- },
134
- ],
135
- },
169
+ fixed: {
170
+ pages: 678,
136
171
  },
137
- min_role: 100,
138
- });
139
- const authorEdit = await View.create({
140
- table_id: table.id,
141
- name: "authoredit",
142
- viewtemplate: "Edit",
143
- configuration: {
144
- columns: [{ type: "Field", field_name: "author" }],
145
- layout: {
146
- above: [{ type: "field", fieldview: "edit", field_name: "author" }],
147
- },
148
- fixed: {
149
- pages: 678,
150
- },
151
- view_when_done: "authorlist",
152
- enable_realtime: true,
153
- update_events: [{ event: "custom_update_event" }],
172
+ view_when_done: "authorlist",
173
+ },
174
+ min_role: 100,
175
+ });
176
+ const authoreditCfg = {
177
+ columns: [
178
+ {
179
+ type: "Field",
180
+ field_name: "author",
154
181
  },
155
- min_role: 100,
156
- });
157
- await View.create({
158
- table_id: table.id,
159
- name: "authoredit_identicals",
160
- viewtemplate: "Edit",
161
- configuration: {
162
- columns: [
163
- { type: "Field", field_name: "author" },
164
- { type: "Field", field_name: "author" },
165
- ],
166
- layout: {
167
- above: [
168
- { type: "field", fieldview: "edit", field_name: "author" },
169
- { type: "field", fieldview: "edit", field_name: "author" },
170
- ],
171
- },
172
- fixed: {
173
- pages: 678,
174
- },
175
- view_when_done: "authorlist",
182
+ {
183
+ type: "Field",
184
+ field_name: "pages",
176
185
  },
177
- min_role: 100,
178
- });
179
- const authoreditCfg = {
186
+ {
187
+ type: "Field",
188
+ field_name: "publisher",
189
+ },
190
+ ],
191
+ layout: {
192
+ above: [
193
+ { type: "field", fieldview: "edit", field_name: "author" },
194
+ { type: "field", fieldview: "edit", field_name: "pages" },
195
+ { type: "field", select: "edit", field_name: "publisher" },
196
+ ],
197
+ },
198
+ };
199
+ const withShowCfg = JSON.parse(JSON.stringify(authoreditCfg));
200
+ withShowCfg.layout.above.push({
201
+ name: "9512df",
202
+ type: "view",
203
+ view: "authorshow",
204
+ state: "shared",
205
+ relation: ".books",
206
+ });
207
+ await view_1.default.create({
208
+ table_id: table.id,
209
+ name: "authoredit_with_show",
210
+ viewtemplate: "Edit",
211
+ configuration: withShowCfg,
212
+ min_role: 100,
213
+ });
214
+ const withShowCfgLegacy = JSON.parse(JSON.stringify(authoreditCfg));
215
+ withShowCfgLegacy.layout.above.push({
216
+ name: "9512df",
217
+ type: "view",
218
+ view: "Own:authorshow",
219
+ state: "shared",
220
+ });
221
+ await view_1.default.create({
222
+ table_id: table.id,
223
+ name: "authoredit_with_show_legacy",
224
+ viewtemplate: "Edit",
225
+ configuration: withShowCfgLegacy,
226
+ min_role: 100,
227
+ });
228
+ const withListCfg = JSON.parse(JSON.stringify(authoreditCfg));
229
+ withListCfg.layout.above.push({
230
+ name: "1512ef",
231
+ type: "view",
232
+ view: "authorlist",
233
+ state: "shared",
234
+ relation: ".",
235
+ });
236
+ await view_1.default.create({
237
+ table_id: table.id,
238
+ name: "authoredit_with_independent_list",
239
+ viewtemplate: "Edit",
240
+ configuration: withListCfg,
241
+ min_role: 100,
242
+ });
243
+ const withListCfgLegacy = JSON.parse(JSON.stringify(authoreditCfg));
244
+ withListCfgLegacy.layout.above.push({
245
+ name: "1512ef",
246
+ type: "view",
247
+ view: "Independent:authorlist",
248
+ state: "shared",
249
+ });
250
+ await view_1.default.create({
251
+ table_id: table.id,
252
+ name: "authoredit_with_independent_list_legacy",
253
+ viewtemplate: "Edit",
254
+ configuration: withListCfgLegacy,
255
+ min_role: 100,
256
+ });
257
+ await view_1.default.create({
258
+ table_id: patients.id,
259
+ name: "patientlist",
260
+ viewtemplate: "List",
261
+ configuration: {
180
262
  columns: [
263
+ { type: "Field", field_name: "name" },
264
+ { type: "Field", field_name: "favbook" },
265
+ { type: "Field", field_name: "parent" },
266
+ { type: "Field", field_name: "favbook" },
267
+ { type: "JoinField", join_field: "favbook.author" },
268
+ { type: "JoinField", join_field: "favbook.pages" },
269
+ ],
270
+ },
271
+ min_role: 80,
272
+ });
273
+ const readings = await table_1.default.create("readings");
274
+ await field_1.default.create({
275
+ table: readings,
276
+ name: "temperature",
277
+ label: "Temperature",
278
+ type: "Integer",
279
+ required: true,
280
+ });
281
+ await field_1.default.create({
282
+ table: readings,
283
+ name: "patient_id",
284
+ label: "Patient",
285
+ type: "Key",
286
+ reftable: patients,
287
+ attributes: { summary_field: "name" },
288
+ required: true,
289
+ });
290
+ await field_1.default.create({
291
+ table: readings,
292
+ name: "normalised",
293
+ label: "Normalised",
294
+ type: "Bool",
295
+ });
296
+ await field_1.default.create({
297
+ table: readings,
298
+ name: "date",
299
+ label: "Date",
300
+ type: "Date",
301
+ });
302
+ const disc_books = await table_1.default.create("discusses_books", {
303
+ min_role_read: 40,
304
+ });
305
+ await field_1.default.create({
306
+ table: disc_books,
307
+ name: "book",
308
+ label: "book",
309
+ type: "Key",
310
+ reftable: table,
311
+ required: false,
312
+ attributes: { summary_field: "author" },
313
+ });
314
+ await field_1.default.create({
315
+ table: disc_books,
316
+ name: "discussant",
317
+ label: "discussant",
318
+ type: "Key",
319
+ reftable_name: "users",
320
+ attributes: { summary_field: "email" },
321
+ required: false,
322
+ });
323
+ const publisher = await table_1.default.create("publisher");
324
+ await field_1.default.create({
325
+ table: publisher,
326
+ name: "name",
327
+ label: "Name",
328
+ type: "String",
329
+ required: true,
330
+ });
331
+ await field_1.default.create({
332
+ table: table, // ie books
333
+ name: "publisher",
334
+ label: "Publisher",
335
+ type: "Key",
336
+ attributes: { summary_field: "name" },
337
+ reftable: publisher,
338
+ required: false,
339
+ });
340
+ const ak_id = await db.insert("publisher", { name: "AK Press" });
341
+ await db.insert("publisher", { name: "No starch" });
342
+ await db.insert("books", { author: "Herman Melville", pages: 967 });
343
+ await db.insert("books", {
344
+ author: "Leo Tolstoy",
345
+ pages: 728,
346
+ publisher: ak_id,
347
+ });
348
+ const kirk_id = await db.insert("patients", {
349
+ name: "Kirk Douglas",
350
+ favbook: 1,
351
+ });
352
+ const michael_id = await db.insert("patients", {
353
+ name: "Michael Douglas",
354
+ favbook: 2,
355
+ parent: kirk_id,
356
+ });
357
+ const date = new Date("2019-11-11T10:34:00.000Z");
358
+ await db.insert("readings", {
359
+ temperature: 37,
360
+ patient_id: kirk_id,
361
+ normalised: true,
362
+ date: db.isSQLite ? date.toString() : date,
363
+ });
364
+ await db.insert("readings", {
365
+ temperature: 39,
366
+ patient_id: kirk_id,
367
+ normalised: false,
368
+ });
369
+ await db.insert("readings", {
370
+ temperature: 37,
371
+ patient_id: michael_id,
372
+ normalised: false,
373
+ });
374
+ const now = new Date();
375
+ await user_1.default.create({
376
+ email: "admin@foo.com",
377
+ password: "AhGGr6rhu45",
378
+ role_id: 1,
379
+ last_mobile_login: db.isSQLite ? now.valueOf() : now,
380
+ });
381
+ await user_1.default.create({
382
+ email: "staff@foo.com",
383
+ password: "ghrarhr54hg",
384
+ role_id: 40,
385
+ last_mobile_login: db.isSQLite ? now.valueOf() : now,
386
+ });
387
+ await user_1.default.create({
388
+ email: "user@foo.com",
389
+ password: "GFeggwrwq45fjn",
390
+ role_id: 80,
391
+ last_mobile_login: db.isSQLite ? now.valueOf() : now,
392
+ });
393
+ await file_1.default.ensure_file_store();
394
+ const mv = async (fnm) => {
395
+ await fsp.writeFile(fnm, "cecinestpasunpng");
396
+ };
397
+ await file_1.default.from_req_files({ mimetype: "image/png", name: "magrite.png", mv, size: 245752 }, 1, 100);
398
+ await page_1.default.create({
399
+ name: "a_page",
400
+ title: "grgw",
401
+ description: "rgerg",
402
+ min_role: 100,
403
+ layout: {
404
+ above: [
181
405
  {
182
- type: "Field",
183
- field_name: "author",
406
+ type: "blank",
407
+ block: false,
408
+ contents: "Hello world",
409
+ textStyle: "",
184
410
  },
411
+ { type: "line_break" },
412
+ { type: "blank", isHTML: true, contents: "<h1> foo</h1>" },
185
413
  {
186
- type: "Field",
187
- field_name: "pages",
414
+ url: "https://saltcorn.com/",
415
+ text: "Click here",
416
+ type: "link",
417
+ block: false,
418
+ textStyle: "",
188
419
  },
189
420
  {
190
- type: "Field",
191
- field_name: "publisher",
421
+ type: "card",
422
+ title: "header",
423
+ contents: {
424
+ above: [
425
+ null,
426
+ {
427
+ aligns: ["left", "left"],
428
+ widths: [6, 6],
429
+ besides: [
430
+ {
431
+ above: [
432
+ null,
433
+ {
434
+ type: "blank",
435
+ block: false,
436
+ contents: "Hello world",
437
+ textStyle: "",
438
+ },
439
+ ],
440
+ },
441
+ {
442
+ above: [
443
+ null,
444
+ {
445
+ type: "blank",
446
+ block: false,
447
+ contents: "Bye bye",
448
+ textStyle: "",
449
+ },
450
+ ],
451
+ },
452
+ ],
453
+ },
454
+ ],
455
+ },
456
+ },
457
+ ],
458
+ },
459
+ fixed_states: {},
460
+ });
461
+ await page_1.default.create({
462
+ name: "page_with_html_file",
463
+ title: "page with html file",
464
+ description: "This page uses a fixed HTML file",
465
+ min_role: 100,
466
+ layout: {
467
+ html_file: "test.html",
468
+ },
469
+ fixed_states: {},
470
+ });
471
+ await page_1.default.create({
472
+ name: "page_with embedded_html_page",
473
+ title: "page with embedded html page",
474
+ description: "This page embeds another page with fixed HTML",
475
+ min_role: 100,
476
+ layout: {
477
+ above: [
478
+ {
479
+ type: "page",
480
+ page: "page_with_html_file",
481
+ },
482
+ ],
483
+ },
484
+ fixed_states: {},
485
+ });
486
+ await view_1.default.create({
487
+ table_id: patients.id,
488
+ name: "show_patient_with_publisher",
489
+ viewtemplate: "Show",
490
+ configuration: {
491
+ columns: [
492
+ { type: "Field", field_name: "name", state_field: "on" },
493
+ {
494
+ type: "ViewLink",
495
+ view: "show_publisher",
496
+ block: false,
497
+ label: "",
498
+ minRole: 100,
499
+ relation: ".patients.favbook.publisher",
500
+ link_icon: "",
192
501
  },
193
502
  ],
194
503
  layout: {
195
504
  above: [
196
- { type: "field", fieldview: "edit", field_name: "author" },
197
- { type: "field", fieldview: "edit", field_name: "pages" },
198
- { type: "field", select: "edit", field_name: "publisher" },
199
- ],
200
- },
201
- };
202
- const withShowCfg = JSON.parse(JSON.stringify(authoreditCfg));
203
- withShowCfg.layout.above.push({
204
- name: "9512df",
205
- type: "view",
206
- view: "authorshow",
207
- state: "shared",
208
- relation: ".books",
209
- });
210
- await View.create({
211
- table_id: table.id,
212
- name: "authoredit_with_show",
213
- viewtemplate: "Edit",
214
- configuration: withShowCfg,
215
- min_role: 100,
216
- });
217
- const withShowCfgLegacy = JSON.parse(JSON.stringify(authoreditCfg));
218
- withShowCfgLegacy.layout.above.push({
219
- name: "9512df",
220
- type: "view",
221
- view: "Own:authorshow",
222
- state: "shared",
223
- });
224
- await View.create({
225
- table_id: table.id,
226
- name: "authoredit_with_show_legacy",
227
- viewtemplate: "Edit",
228
- configuration: withShowCfgLegacy,
229
- min_role: 100,
230
- });
231
- const withListCfg = JSON.parse(JSON.stringify(authoreditCfg));
232
- withListCfg.layout.above.push({
233
- name: "1512ef",
234
- type: "view",
235
- view: "authorlist",
236
- state: "shared",
237
- relation: ".",
238
- });
239
- await View.create({
240
- table_id: table.id,
241
- name: "authoredit_with_independent_list",
242
- viewtemplate: "Edit",
243
- configuration: withListCfg,
244
- min_role: 100,
245
- });
246
- const withListCfgLegacy = JSON.parse(JSON.stringify(authoreditCfg));
247
- withListCfgLegacy.layout.above.push({
248
- name: "1512ef",
249
- type: "view",
250
- view: "Independent:authorlist",
251
- state: "shared",
252
- });
253
- await View.create({
254
- table_id: table.id,
255
- name: "authoredit_with_independent_list_legacy",
256
- viewtemplate: "Edit",
257
- configuration: withListCfgLegacy,
258
- min_role: 100,
259
- });
260
- await View.create({
261
- table_id: patients.id,
262
- name: "patientlist",
263
- viewtemplate: "List",
264
- configuration: {
265
- columns: [
266
- { type: "Field", field_name: "name" },
267
- { type: "Field", field_name: "favbook" },
268
- { type: "Field", field_name: "parent" },
269
- { type: "Field", field_name: "favbook" },
270
- { type: "JoinField", join_field: "favbook.author" },
271
- { type: "JoinField", join_field: "favbook.pages" },
272
- ],
273
- },
274
- min_role: 80,
275
- });
276
- const readings = await Table.create("readings");
277
- await Field.create({
278
- table: readings,
279
- name: "temperature",
280
- label: "Temperature",
281
- type: "Integer",
282
- required: true,
283
- });
284
- await Field.create({
285
- table: readings,
286
- name: "patient_id",
287
- label: "Patient",
288
- type: "Key",
289
- reftable: patients,
290
- attributes: { summary_field: "name" },
291
- required: true,
292
- });
293
- await Field.create({
294
- table: readings,
295
- name: "normalised",
296
- label: "Normalised",
297
- type: "Bool",
298
- });
299
- await Field.create({
300
- table: readings,
301
- name: "date",
302
- label: "Date",
303
- type: "Date",
304
- });
305
- const disc_books = await Table.create("discusses_books", {
306
- min_role_read: 40,
307
- });
308
- await Field.create({
309
- table: disc_books,
310
- name: "book",
311
- label: "book",
312
- type: "Key",
313
- reftable: table,
314
- required: false,
315
- attributes: { summary_field: "author" },
316
- });
317
- await Field.create({
318
- table: disc_books,
319
- name: "discussant",
320
- label: "discussant",
321
- type: "Key",
322
- reftable_name: "users",
323
- attributes: { summary_field: "email" },
324
- required: false,
325
- });
326
- const publisher = await Table.create("publisher");
327
- await Field.create({
328
- table: publisher,
329
- name: "name",
330
- label: "Name",
331
- type: "String",
332
- required: true,
333
- });
334
- await Field.create({
335
- table: table, // ie books
336
- name: "publisher",
337
- label: "Publisher",
338
- type: "Key",
339
- attributes: { summary_field: "name" },
340
- reftable: publisher,
341
- required: false,
342
- });
343
- const ak_id = await db.insert("publisher", { name: "AK Press" });
344
- await db.insert("publisher", { name: "No starch" });
345
- await db.insert("books", { author: "Herman Melville", pages: 967 });
346
- await db.insert("books", {
347
- author: "Leo Tolstoy",
348
- pages: 728,
349
- publisher: ak_id,
350
- });
351
- const kirk_id = await db.insert("patients", {
352
- name: "Kirk Douglas",
353
- favbook: 1,
354
- });
355
- const michael_id = await db.insert("patients", {
356
- name: "Michael Douglas",
357
- favbook: 2,
358
- parent: kirk_id,
359
- });
360
- const date = new Date("2019-11-11T10:34:00.000Z");
361
- await db.insert("readings", {
362
- temperature: 37,
363
- patient_id: kirk_id,
364
- normalised: true,
365
- date: db.isSQLite ? date.toString() : date,
366
- });
367
- await db.insert("readings", {
368
- temperature: 39,
369
- patient_id: kirk_id,
370
- normalised: false,
371
- });
372
- await db.insert("readings", {
373
- temperature: 37,
374
- patient_id: michael_id,
375
- normalised: false,
376
- });
377
- const now = new Date();
378
- await User.create({
379
- email: "admin@foo.com",
380
- password: "AhGGr6rhu45",
381
- role_id: 1,
382
- last_mobile_login: db.isSQLite ? now.valueOf() : now,
383
- });
384
- await User.create({
385
- email: "staff@foo.com",
386
- password: "ghrarhr54hg",
387
- role_id: 40,
388
- last_mobile_login: db.isSQLite ? now.valueOf() : now,
389
- });
390
- await User.create({
391
- email: "user@foo.com",
392
- password: "GFeggwrwq45fjn",
393
- role_id: 80,
394
- last_mobile_login: db.isSQLite ? now.valueOf() : now,
395
- });
396
- await File.ensure_file_store();
397
- const mv = async (fnm) => {
398
- await fs.writeFile(fnm, "cecinestpasunpng");
399
- };
400
- await File.from_req_files({ mimetype: "image/png", name: "magrite.png", mv, size: 245752 }, 1, 100);
401
- await Page.create({
402
- name: "a_page",
403
- title: "grgw",
404
- description: "rgerg",
405
- min_role: 100,
406
- layout: {
407
- above: [
408
- {
409
- type: "blank",
410
- block: false,
411
- contents: "Hello world",
412
- textStyle: "",
413
- },
414
- { type: "line_break" },
415
- { type: "blank", isHTML: true, contents: "<h1> foo</h1>" },
416
- {
417
- url: "https://saltcorn.com/",
418
- text: "Click here",
419
- type: "link",
420
- block: false,
421
- textStyle: "",
422
- },
423
- {
424
- type: "card",
425
- title: "header",
426
- contents: {
427
- above: [
428
- null,
429
- {
430
- aligns: ["left", "left"],
431
- widths: [6, 6],
432
- besides: [
433
- {
434
- above: [
435
- null,
436
- {
437
- type: "blank",
438
- block: false,
439
- contents: "Hello world",
440
- textStyle: "",
441
- },
442
- ],
443
- },
444
- {
445
- above: [
446
- null,
447
- {
448
- type: "blank",
449
- block: false,
450
- contents: "Bye bye",
451
- textStyle: "",
452
- },
453
- ],
454
- },
455
- ],
456
- },
457
- ],
458
- },
459
- },
460
- ],
461
- },
462
- fixed_states: {},
463
- });
464
- await Page.create({
465
- name: "page_with_html_file",
466
- title: "page with html file",
467
- description: "This page uses a fixed HTML file",
468
- min_role: 100,
469
- layout: {
470
- html_file: "test.html",
471
- },
472
- fixed_states: {},
473
- });
474
- await Page.create({
475
- name: "page_with embedded_html_page",
476
- title: "page with embedded html page",
477
- description: "This page embeds another page with fixed HTML",
478
- min_role: 100,
479
- layout: {
480
- above: [
505
+ { type: "field", field_name: "name", fieldview: "show" },
481
506
  {
482
- type: "page",
483
- page: "page_with_html_file",
507
+ type: "view",
508
+ view: "show_publisher",
509
+ name: "7b17af",
510
+ state: "shared",
511
+ relation: ".patients.favbook.publisher",
484
512
  },
485
- ],
486
- },
487
- fixed_states: {},
488
- });
489
- await View.create({
490
- table_id: patients.id,
491
- name: "show_patient_with_publisher",
492
- viewtemplate: "Show",
493
- configuration: {
494
- columns: [
495
- { type: "Field", field_name: "name", state_field: "on" },
496
513
  {
497
- type: "ViewLink",
514
+ type: "view_link",
498
515
  view: "show_publisher",
499
516
  block: false,
500
- label: "",
501
517
  minRole: 100,
502
518
  relation: ".patients.favbook.publisher",
519
+ isFormula: {},
503
520
  link_icon: "",
521
+ view_label: "",
504
522
  },
505
523
  ],
506
- layout: {
507
- above: [
508
- { type: "field", field_name: "name", fieldview: "show" },
509
- {
510
- type: "view",
511
- view: "show_publisher",
512
- name: "7b17af",
513
- state: "shared",
514
- relation: ".patients.favbook.publisher",
515
- },
516
- {
517
- type: "view_link",
518
- view: "show_publisher",
519
- block: false,
520
- minRole: 100,
521
- relation: ".patients.favbook.publisher",
522
- isFormula: {},
523
- link_icon: "",
524
- view_label: "",
525
- },
526
- ],
527
- },
528
- },
529
- min_role: 100,
530
- });
531
- await View.create({
532
- table_id: publisher.id,
533
- name: "show_publisher",
534
- viewtemplate: "Show",
535
- configuration: {
536
- columns: [{ type: "Field", field_name: "name", state_field: "on" }],
537
- layout: {
538
- above: [{ type: "field", field_name: "name", fieldview: "show" }],
539
- },
540
524
  },
541
- min_role: 100,
542
- });
543
- await View.create({
544
- table_id: disc_books.id,
545
- name: "disc_books_edit-in-edit",
546
- viewtemplate: "Edit",
547
- configuration: {
548
- layout: {
549
- above: [
550
- {
551
- type: "field",
552
- block: false,
553
- fieldview: "select",
554
- textStyle: "",
555
- field_name: "discussant",
556
- configuration: {},
557
- },
558
- ],
559
- },
560
- columns: [
525
+ },
526
+ min_role: 100,
527
+ });
528
+ await view_1.default.create({
529
+ table_id: publisher.id,
530
+ name: "show_publisher",
531
+ viewtemplate: "Show",
532
+ configuration: {
533
+ columns: [{ type: "Field", field_name: "name", state_field: "on" }],
534
+ layout: {
535
+ above: [{ type: "field", field_name: "name", fieldview: "show" }],
536
+ },
537
+ },
538
+ min_role: 100,
539
+ });
540
+ await view_1.default.create({
541
+ table_id: disc_books.id,
542
+ name: "disc_books_edit-in-edit",
543
+ viewtemplate: "Edit",
544
+ configuration: {
545
+ layout: {
546
+ above: [
561
547
  {
562
- type: "Field",
548
+ type: "field",
563
549
  block: false,
564
550
  fieldview: "select",
565
551
  textStyle: "",
@@ -568,67 +554,96 @@ module.exports =
568
554
  },
569
555
  ],
570
556
  },
571
- min_role: 100,
572
- });
573
- await View.create({
574
- table_id: disc_books.id,
575
- name: "disc_books_list",
576
- viewtemplate: "List",
577
- configuration: {
578
- columns: [
579
- { type: "Field", field_name: "book", state_field: "on" },
580
- { type: "Field", field_name: "discussant", state_field: "on" },
581
- ],
582
- },
583
- min_role: 100,
584
- });
585
- await View.create({
586
- table_id: table.id,
587
- name: "show_author_with_disc_books_list",
588
- viewtemplate: "Show",
589
- configuration: {
590
- columns: [
591
- { type: "Field", field_name: "author", state_field: "on" },
557
+ columns: [
558
+ {
559
+ type: "Field",
560
+ block: false,
561
+ fieldview: "select",
562
+ textStyle: "",
563
+ field_name: "discussant",
564
+ configuration: {},
565
+ },
566
+ ],
567
+ },
568
+ min_role: 100,
569
+ });
570
+ await view_1.default.create({
571
+ table_id: disc_books.id,
572
+ name: "disc_books_list",
573
+ viewtemplate: "List",
574
+ configuration: {
575
+ columns: [
576
+ { type: "Field", field_name: "book", state_field: "on" },
577
+ { type: "Field", field_name: "discussant", state_field: "on" },
578
+ ],
579
+ },
580
+ min_role: 100,
581
+ });
582
+ await view_1.default.create({
583
+ table_id: table.id,
584
+ name: "show_author_with_disc_books_list",
585
+ viewtemplate: "Show",
586
+ configuration: {
587
+ columns: [
588
+ { type: "Field", field_name: "author", state_field: "on" },
589
+ {
590
+ type: "ViewLink",
591
+ view: "disc_books_list",
592
+ block: false,
593
+ label: "",
594
+ minRole: 100,
595
+ link_icon: "",
596
+ },
597
+ ],
598
+ layout: {
599
+ above: [
600
+ { type: "field", field_name: "author", fieldview: "show" },
601
+ {
602
+ type: "view",
603
+ view: "ChildList:disc_books_list.discusses_books.book",
604
+ name: "7b17af",
605
+ state: "shared",
606
+ },
592
607
  {
593
- type: "ViewLink",
594
- view: "disc_books_list",
608
+ type: "view_link",
609
+ view: "ChildList:disc_books_list.discusses_books.book",
595
610
  block: false,
596
- label: "",
597
611
  minRole: 100,
612
+ isFormula: {},
598
613
  link_icon: "",
614
+ view_label: "",
599
615
  },
600
616
  ],
601
- layout: {
602
- above: [
603
- { type: "field", field_name: "author", fieldview: "show" },
604
- {
605
- type: "view",
606
- view: "ChildList:disc_books_list.discusses_books.book",
607
- name: "7b17af",
608
- state: "shared",
609
- },
610
- {
611
- type: "view_link",
612
- view: "ChildList:disc_books_list.discusses_books.book",
613
- block: false,
614
- minRole: 100,
615
- isFormula: {},
616
- link_icon: "",
617
- view_label: "",
618
- },
619
- ],
620
- },
621
617
  },
622
- min_role: 100,
623
- });
624
- await View.create({
625
- table_id: table.id,
626
- name: "author_multi_edit",
627
- viewtemplate: "Edit",
628
- configuration: {
629
- columns: [
630
- { type: "Field", field_name: "author" },
631
- { type: "Field", field_name: "publisher", fieldview: "select" },
618
+ },
619
+ min_role: 100,
620
+ });
621
+ await view_1.default.create({
622
+ table_id: table.id,
623
+ name: "author_multi_edit",
624
+ viewtemplate: "Edit",
625
+ configuration: {
626
+ columns: [
627
+ { type: "Field", field_name: "author" },
628
+ { type: "Field", field_name: "publisher", fieldview: "select" },
629
+ {
630
+ type: "action",
631
+ block: false,
632
+ configuration: {},
633
+ action_name: "UpdateMatchingRows",
634
+ action_style: "btn-primary",
635
+ minRole: 100,
636
+ rndid: "f7c2cd",
637
+ },
638
+ ],
639
+ layout: {
640
+ above: [
641
+ { type: "field", fieldview: "edit", field_name: "author" },
642
+ {
643
+ type: "field",
644
+ field_name: "publisher",
645
+ fieldview: "select",
646
+ },
632
647
  {
633
648
  type: "action",
634
649
  block: false,
@@ -638,1282 +653,1284 @@ module.exports =
638
653
  minRole: 100,
639
654
  rndid: "f7c2cd",
640
655
  },
656
+ {
657
+ name: "7b17af",
658
+ type: "view",
659
+ view: "ChildList:disc_books_edit-in-edit.discusses_books.book",
660
+ state: "shared",
661
+ },
641
662
  ],
642
- layout: {
643
- above: [
644
- { type: "field", fieldview: "edit", field_name: "author" },
645
- {
646
- type: "field",
647
- field_name: "publisher",
648
- fieldview: "select",
649
- },
650
- {
651
- type: "action",
652
- block: false,
653
- configuration: {},
654
- action_name: "UpdateMatchingRows",
655
- action_style: "btn-primary",
656
- minRole: 100,
657
- rndid: "f7c2cd",
658
- },
659
- {
660
- name: "7b17af",
661
- type: "view",
662
- view: "ChildList:disc_books_edit-in-edit.discusses_books.book",
663
- state: "shared",
664
- },
665
- ],
666
- },
667
663
  },
668
- min_role: 100,
669
- });
670
- const rooms = await Table.create("rooms", {
671
- min_role_read: 80,
672
- min_role_write: 80,
673
- });
674
- await Field.create({
675
- table: rooms,
676
- name: "name",
677
- label: "Name",
678
- type: "String",
679
- required: true,
680
- });
681
- await db.insert("rooms", {
682
- name: "Room A",
683
- });
684
- await db.insert("rooms", {
685
- name: "Room B",
686
- });
687
- const messages = await Table.create("messages", {
688
- min_role_read: 80,
689
- min_role_write: 80,
690
- });
691
- await Field.create({
692
- table: messages,
693
- name: "content",
694
- label: "Content",
695
- type: "String",
696
- required: true,
697
- });
698
- await Field.create({
699
- table: messages,
700
- name: "user",
701
- label: "User",
702
- type: "Key",
703
- reftable_name: "users",
704
- attributes: { summary_field: "email" },
705
- required: false,
706
- });
707
- await Field.create({
708
- table: messages,
709
- name: "room",
710
- label: "Room",
711
- type: "Key",
712
- reftable: rooms,
713
- required: false,
714
- attributes: { summary_field: "name" },
715
- });
716
- await db.insert("messages", {
717
- content: "first message content for room A",
718
- user: 1,
719
- room: 1,
720
- });
721
- await db.insert("messages", {
722
- content: "second message content for room A",
723
- user: 1,
724
- room: 1,
725
- });
726
- const participants = await Table.create("participants", {
727
- min_role_read: 80,
728
- min_role_write: 80,
729
- });
730
- await Field.create({
731
- table: participants,
732
- name: "user",
733
- label: "User",
734
- type: "Key",
735
- reftable_name: "users",
736
- attributes: { summary_field: "email" },
737
- required: false,
738
- });
739
- await Field.create({
740
- table: participants,
741
- name: "room",
742
- label: "Room",
743
- type: "Key",
744
- reftable: rooms,
745
- required: false,
746
- attributes: { summary_field: "name" },
747
- });
748
- await View.create({
749
- table_id: participants.id,
750
- name: "participants_edit",
751
- viewtemplate: "Edit",
752
- configuration: {
753
- columns: [
664
+ },
665
+ min_role: 100,
666
+ });
667
+ const rooms = await table_1.default.create("rooms", {
668
+ min_role_read: 80,
669
+ min_role_write: 80,
670
+ });
671
+ await field_1.default.create({
672
+ table: rooms,
673
+ name: "name",
674
+ label: "Name",
675
+ type: "String",
676
+ required: true,
677
+ });
678
+ await db.insert("rooms", {
679
+ name: "Room A",
680
+ });
681
+ await db.insert("rooms", {
682
+ name: "Room B",
683
+ });
684
+ const messages = await table_1.default.create("messages", {
685
+ min_role_read: 80,
686
+ min_role_write: 80,
687
+ });
688
+ await field_1.default.create({
689
+ table: messages,
690
+ name: "content",
691
+ label: "Content",
692
+ type: "String",
693
+ required: true,
694
+ });
695
+ await field_1.default.create({
696
+ table: messages,
697
+ name: "user",
698
+ label: "User",
699
+ type: "Key",
700
+ reftable_name: "users",
701
+ attributes: { summary_field: "email" },
702
+ required: false,
703
+ });
704
+ await field_1.default.create({
705
+ table: messages,
706
+ name: "room",
707
+ label: "Room",
708
+ type: "Key",
709
+ reftable: rooms,
710
+ required: false,
711
+ attributes: { summary_field: "name" },
712
+ });
713
+ await db.insert("messages", {
714
+ content: "first message content for room A",
715
+ user: 1,
716
+ room: 1,
717
+ });
718
+ await db.insert("messages", {
719
+ content: "second message content for room A",
720
+ user: 1,
721
+ room: 1,
722
+ });
723
+ const participants = await table_1.default.create("participants", {
724
+ min_role_read: 80,
725
+ min_role_write: 80,
726
+ });
727
+ await field_1.default.create({
728
+ table: participants,
729
+ name: "user",
730
+ label: "User",
731
+ type: "Key",
732
+ reftable_name: "users",
733
+ attributes: { summary_field: "email" },
734
+ required: false,
735
+ });
736
+ await field_1.default.create({
737
+ table: participants,
738
+ name: "room",
739
+ label: "Room",
740
+ type: "Key",
741
+ reftable: rooms,
742
+ required: false,
743
+ attributes: { summary_field: "name" },
744
+ });
745
+ await view_1.default.create({
746
+ table_id: participants.id,
747
+ name: "participants_edit",
748
+ viewtemplate: "Edit",
749
+ configuration: {
750
+ columns: [
751
+ {
752
+ type: "Field",
753
+ field_name: "user",
754
+ fieldview: "select",
755
+ textStyle: "",
756
+ block: false,
757
+ configuration: {},
758
+ },
759
+ {
760
+ type: "Field",
761
+ field_name: "room",
762
+ fieldview: "select",
763
+ textStyle: "",
764
+ block: false,
765
+ configuration: {},
766
+ },
767
+ ],
768
+ },
769
+ min_role: 100,
770
+ });
771
+ await db.insert("participants", {
772
+ user: 1,
773
+ room: 1,
774
+ });
775
+ await db.insert("participants", {
776
+ user: 2,
777
+ room: 1,
778
+ });
779
+ await db.insert("participants", {
780
+ user: 3,
781
+ room: 1,
782
+ });
783
+ const roomsViewCfg = {
784
+ exttable_name: null,
785
+ viewname: "room",
786
+ msg_relation: "messages.room",
787
+ msgsender_field: "user",
788
+ msgview: "show_message",
789
+ msgform: "edit_message",
790
+ participant_field: "participants.room.user",
791
+ participant_maxread_field: "",
792
+ };
793
+ await view_1.default.create({
794
+ table_id: rooms.id,
795
+ name: "rooms_view",
796
+ viewtemplate: "Room",
797
+ configuration: roomsViewCfg,
798
+ min_role: 80,
799
+ });
800
+ await view_1.default.create({
801
+ table_id: rooms.id,
802
+ name: "admin_rooms_view",
803
+ viewtemplate: "Room",
804
+ configuration: roomsViewCfg,
805
+ min_role: 1,
806
+ });
807
+ await view_1.default.create({
808
+ table_id: messages.id,
809
+ name: "edit_message",
810
+ viewtemplate: "Edit",
811
+ configuration: {
812
+ columns: [
813
+ {
814
+ type: "Field",
815
+ field_name: "content",
816
+ fieldview: "edit",
817
+ textStyle: "",
818
+ block: false,
819
+ configuration: {},
820
+ },
821
+ ],
822
+ layout: {
823
+ above: [
754
824
  {
755
- type: "Field",
756
- field_name: "user",
757
- fieldview: "select",
825
+ type: "field",
826
+ field_name: "content",
827
+ fieldview: "edit",
758
828
  textStyle: "",
759
829
  block: false,
760
830
  configuration: {},
761
831
  },
832
+ ],
833
+ },
834
+ },
835
+ min_role: 80,
836
+ });
837
+ await view_1.default.create({
838
+ table_id: messages.id,
839
+ name: "show_message",
840
+ viewtemplate: "Show",
841
+ configuration: {
842
+ columns: [{ field_name: "content", type: "Field", fieldview: "as_text" }],
843
+ layout: {
844
+ above: [
762
845
  {
763
- type: "Field",
764
- field_name: "room",
765
- fieldview: "select",
766
- textStyle: "",
846
+ type: "field",
767
847
  block: false,
768
- configuration: {},
848
+ fieldview: "as_text",
849
+ textStyle: "",
850
+ field_name: "content",
769
851
  },
770
852
  ],
771
853
  },
772
- min_role: 100,
773
- });
774
- await db.insert("participants", {
775
- user: 1,
776
- room: 1,
777
- });
778
- await db.insert("participants", {
779
- user: 2,
780
- room: 1,
781
- });
782
- await db.insert("participants", {
783
- user: 3,
784
- room: 1,
785
- });
786
- const roomsViewCfg = {
787
- exttable_name: null,
788
- viewname: "room",
789
- msg_relation: "messages.room",
790
- msgsender_field: "user",
791
- msgview: "show_message",
792
- msgform: "edit_message",
793
- participant_field: "participants.room.user",
794
- participant_maxread_field: "",
795
- };
796
- await View.create({
797
- table_id: rooms.id,
798
- name: "rooms_view",
799
- viewtemplate: "Room",
800
- configuration: roomsViewCfg,
801
- min_role: 80,
802
- });
803
- await View.create({
804
- table_id: rooms.id,
805
- name: "admin_rooms_view",
806
- viewtemplate: "Room",
807
- configuration: roomsViewCfg,
808
- min_role: 1,
809
- });
810
- await View.create({
811
- table_id: messages.id,
812
- name: "edit_message",
813
- viewtemplate: "Edit",
814
- configuration: {
815
- columns: [
854
+ },
855
+ min_role: 80,
856
+ });
857
+ const topics = await table_1.default.create("topics");
858
+ await field_1.default.create({
859
+ table: topics,
860
+ name: "name",
861
+ label: "Name",
862
+ type: "String",
863
+ required: true,
864
+ });
865
+ await db.insert("topics", {
866
+ name: "Topic A",
867
+ });
868
+ await db.insert("topics", {
869
+ name: "Topic B",
870
+ });
871
+ await db.insert("topics", {
872
+ name: "Topic C",
873
+ });
874
+ const uiit = await table_1.default.create("user_interested_in_topic");
875
+ await field_1.default.create({
876
+ table: uiit,
877
+ name: "topic",
878
+ label: "Topic",
879
+ type: "Key",
880
+ reftable: topics,
881
+ required: false,
882
+ attributes: { summary_field: "name" },
883
+ });
884
+ await field_1.default.create({
885
+ table: uiit,
886
+ name: "user",
887
+ label: "User",
888
+ type: "Key",
889
+ reftable_name: "users",
890
+ required: false,
891
+ attributes: { summary_field: "email" },
892
+ });
893
+ await db.insert("user_interested_in_topic", {
894
+ topic: 1,
895
+ user: 1,
896
+ });
897
+ await db.insert("user_interested_in_topic", {
898
+ topic: 2,
899
+ user: 2,
900
+ });
901
+ await db.insert("user_interested_in_topic", {
902
+ topic: 1,
903
+ user: 3,
904
+ });
905
+ await db.insert("user_interested_in_topic", {
906
+ topic: 2,
907
+ user: 3,
908
+ });
909
+ const bp = await table_1.default.create("blog_posts");
910
+ await field_1.default.create({
911
+ table: bp,
912
+ name: "content",
913
+ label: "Content",
914
+ type: "String",
915
+ required: true,
916
+ });
917
+ await field_1.default.create({
918
+ table: bp,
919
+ name: "title",
920
+ label: "Title",
921
+ type: "String",
922
+ required: true,
923
+ });
924
+ await db.insert("blog_posts", {
925
+ content: "Content of post A",
926
+ title: "Post A",
927
+ });
928
+ await db.insert("blog_posts", {
929
+ content: "Content of post B",
930
+ title: "Post B",
931
+ });
932
+ await db.insert("blog_posts", {
933
+ content: "Content of post C",
934
+ title: "Post C",
935
+ });
936
+ const bit = await table_1.default.create("blog_in_topic");
937
+ await field_1.default.create({
938
+ table: bit,
939
+ name: "topic",
940
+ label: "Topic",
941
+ type: "Key",
942
+ reftable: topics,
943
+ required: true,
944
+ attributes: { summary_field: "name" },
945
+ });
946
+ await field_1.default.create({
947
+ table: bit,
948
+ name: "post",
949
+ label: "Post",
950
+ type: "Key",
951
+ reftable: bp,
952
+ required: true,
953
+ attributes: { summary_field: "title" },
954
+ });
955
+ await db.insert("blog_in_topic", {
956
+ topic: 1,
957
+ post: 1,
958
+ });
959
+ await db.insert("blog_in_topic", {
960
+ topic: 1,
961
+ post: 2,
962
+ });
963
+ await db.insert("blog_in_topic", {
964
+ topic: 1,
965
+ post: 3,
966
+ });
967
+ await db.insert("blog_in_topic", {
968
+ topic: 2,
969
+ post: 2,
970
+ });
971
+ await db.insert("blog_in_topic", {
972
+ topic: 3,
973
+ post: 3,
974
+ });
975
+ const users = table_1.default.findOne({ name: "users" });
976
+ if (!users)
977
+ throw new Error("users table not found");
978
+ // blog_in_topic_feed in show user views
979
+ await view_1.default.create({
980
+ table_id: bit.id,
981
+ name: "show_blog_in_topic",
982
+ viewtemplate: "Show",
983
+ configuration: {
984
+ columns: [
985
+ { type: "JoinField", join_field: "post.title" },
986
+ { type: "JoinField", join_field: "topic.name" },
987
+ ],
988
+ layout: {
989
+ above: [
816
990
  {
817
- type: "Field",
818
- field_name: "content",
819
- fieldview: "edit",
820
- textStyle: "",
991
+ type: "join_field",
821
992
  block: false,
822
- configuration: {},
993
+ textStyle: "",
994
+ join_field: "post.title",
995
+ },
996
+ {
997
+ type: "join_field",
998
+ block: false,
999
+ textStyle: "",
1000
+ join_field: "topic.name",
823
1001
  },
824
1002
  ],
825
- layout: {
826
- above: [
827
- {
828
- type: "field",
829
- field_name: "content",
830
- fieldview: "edit",
831
- textStyle: "",
832
- block: false,
833
- configuration: {},
834
- },
835
- ],
836
- },
837
1003
  },
838
- min_role: 80,
839
- });
840
- await View.create({
841
- table_id: messages.id,
842
- name: "show_message",
843
- viewtemplate: "Show",
844
- configuration: {
845
- columns: [
846
- { field_name: "content", type: "Field", fieldview: "as_text" },
1004
+ },
1005
+ min_role: 100,
1006
+ });
1007
+ await view_1.default.create({
1008
+ table_id: bit.id,
1009
+ name: "edit_blog_in_topic",
1010
+ viewtemplate: "Edit",
1011
+ configuration: {
1012
+ columns: [
1013
+ { type: "JoinField", join_field: "post.title" },
1014
+ { type: "JoinField", join_field: "topic.name" },
1015
+ ],
1016
+ layout: {
1017
+ above: [
1018
+ {
1019
+ type: "join_field",
1020
+ block: false,
1021
+ textStyle: "",
1022
+ join_field: "post.title",
1023
+ },
1024
+ {
1025
+ type: "join_field",
1026
+ block: false,
1027
+ textStyle: "",
1028
+ join_field: "topic.name",
1029
+ },
847
1030
  ],
848
- layout: {
849
- above: [
850
- {
851
- type: "field",
852
- block: false,
853
- fieldview: "as_text",
854
- textStyle: "",
855
- field_name: "content",
856
- },
857
- ],
858
- },
859
1031
  },
860
- min_role: 80,
861
- });
862
- const topics = await Table.create("topics");
863
- await Field.create({
864
- table: topics,
865
- name: "name",
866
- label: "Name",
867
- type: "String",
868
- required: true,
869
- });
870
- await db.insert("topics", {
871
- name: "Topic A",
872
- });
873
- await db.insert("topics", {
874
- name: "Topic B",
875
- });
876
- await db.insert("topics", {
877
- name: "Topic C",
878
- });
879
- const uiit = await Table.create("user_interested_in_topic");
880
- await Field.create({
881
- table: uiit,
882
- name: "topic",
883
- label: "Topic",
884
- type: "Key",
885
- reftable: topics,
886
- required: false,
887
- attributes: { summary_field: "name" },
888
- });
889
- await Field.create({
890
- table: uiit,
891
- name: "user",
892
- label: "User",
893
- type: "Key",
894
- reftable_name: "users",
895
- required: false,
896
- attributes: { summary_field: "email" },
897
- });
898
- await db.insert("user_interested_in_topic", {
899
- topic: 1,
900
- user: 1,
901
- });
902
- await db.insert("user_interested_in_topic", {
903
- topic: 2,
904
- user: 2,
905
- });
906
- await db.insert("user_interested_in_topic", {
907
- topic: 1,
908
- user: 3,
909
- });
910
- await db.insert("user_interested_in_topic", {
911
- topic: 2,
912
- user: 3,
913
- });
914
- const bp = await Table.create("blog_posts");
915
- await Field.create({
916
- table: bp,
917
- name: "content",
918
- label: "Content",
919
- type: "String",
920
- required: true,
921
- });
922
- await Field.create({
923
- table: bp,
924
- name: "title",
925
- label: "Title",
926
- type: "String",
927
- required: true,
928
- });
929
- await db.insert("blog_posts", {
930
- content: "Content of post A",
931
- title: "Post A",
932
- });
933
- await db.insert("blog_posts", {
934
- content: "Content of post B",
935
- title: "Post B",
936
- });
937
- await db.insert("blog_posts", {
938
- content: "Content of post C",
939
- title: "Post C",
940
- });
941
- const bit = await Table.create("blog_in_topic");
942
- await Field.create({
943
- table: bit,
944
- name: "topic",
945
- label: "Topic",
946
- type: "Key",
947
- reftable: topics,
948
- required: true,
949
- attributes: { summary_field: "name" },
950
- });
951
- await Field.create({
952
- table: bit,
953
- name: "post",
954
- label: "Post",
955
- type: "Key",
956
- reftable: bp,
957
- required: true,
958
- attributes: { summary_field: "title" },
959
- });
960
- await db.insert("blog_in_topic", {
961
- topic: 1,
962
- post: 1,
963
- });
964
- await db.insert("blog_in_topic", {
965
- topic: 1,
966
- post: 2,
967
- });
968
- await db.insert("blog_in_topic", {
969
- topic: 1,
970
- post: 3,
971
- });
972
- await db.insert("blog_in_topic", {
973
- topic: 2,
974
- post: 2,
975
- });
976
- await db.insert("blog_in_topic", {
977
- topic: 3,
978
- post: 3,
979
- });
980
- const users = Table.findOne({ name: "users" });
981
- // blog_in_topic_feed in show user views
982
- await View.create({
983
- table_id: bit.id,
984
- name: "show_blog_in_topic",
985
- viewtemplate: "Show",
986
- configuration: {
987
- columns: [
988
- { type: "JoinField", join_field: "post.title" },
989
- { type: "JoinField", join_field: "topic.name" },
1032
+ },
1033
+ min_role: 100,
1034
+ });
1035
+ await view_1.default.create({
1036
+ table_id: bit.id,
1037
+ name: "blog_in_topic_feed",
1038
+ viewtemplate: "Feed",
1039
+ configuration: {
1040
+ cols_lg: 1,
1041
+ cols_md: 1,
1042
+ cols_sm: 1,
1043
+ cols_xl: 1,
1044
+ in_card: false,
1045
+ viewname: "blog_in_topic_feed",
1046
+ show_view: "show_blog_in_topic",
1047
+ descending: false,
1048
+ view_to_create: "edit_blog_in_topic",
1049
+ create_view_display: "Link",
1050
+ },
1051
+ min_role: 100,
1052
+ });
1053
+ await view_1.default.create({
1054
+ table_id: users.id,
1055
+ name: "show_user_with_blog_in_topic_feed",
1056
+ viewtemplate: "Show",
1057
+ configuration: {
1058
+ columns: [],
1059
+ layout: {
1060
+ above: [
1061
+ {
1062
+ type: "view",
1063
+ view: "blog_in_topic_feed",
1064
+ relation: ".users.user_interested_in_topic$user.topic.blog_in_topic$topic",
1065
+ name: "fc3fc3",
1066
+ state: "shared",
1067
+ },
1068
+ {
1069
+ type: "view_link",
1070
+ view: "blog_in_topic_feed",
1071
+ block: false,
1072
+ minRole: 100,
1073
+ relation: ".users.user_interested_in_topic$user.topic.blog_in_topic$topic",
1074
+ isFormula: {},
1075
+ link_icon: "",
1076
+ view_label: "",
1077
+ },
990
1078
  ],
991
- layout: {
992
- above: [
993
- {
994
- type: "join_field",
995
- block: false,
996
- textStyle: "",
997
- join_field: "post.title",
998
- },
999
- {
1000
- type: "join_field",
1001
- block: false,
1002
- textStyle: "",
1003
- join_field: "topic.name",
1004
- },
1005
- ],
1006
- },
1007
1079
  },
1008
- min_role: 100,
1009
- });
1010
- await View.create({
1011
- table_id: bit.id,
1012
- name: "edit_blog_in_topic",
1013
- viewtemplate: "Edit",
1014
- configuration: {
1015
- columns: [
1016
- { type: "JoinField", join_field: "post.title" },
1017
- { type: "JoinField", join_field: "topic.name" },
1080
+ },
1081
+ min_role: 100,
1082
+ });
1083
+ // blog_post feed in show user views
1084
+ await view_1.default.create({
1085
+ table_id: bp.id,
1086
+ name: "show_blog_post",
1087
+ viewtemplate: "Show",
1088
+ configuration: {
1089
+ columns: [
1090
+ { field_name: "content", type: "Field", fieldview: "as_text" },
1091
+ { field_name: "title", type: "Field", fieldview: "as_text" },
1092
+ ],
1093
+ layout: {
1094
+ above: [
1095
+ {
1096
+ type: "field",
1097
+ block: false,
1098
+ fieldview: "as_text",
1099
+ textStyle: "",
1100
+ field_name: "content",
1101
+ },
1102
+ {
1103
+ type: "field",
1104
+ block: false,
1105
+ fieldview: "as_text",
1106
+ textStyle: "",
1107
+ field_name: "title",
1108
+ },
1018
1109
  ],
1019
- layout: {
1020
- above: [
1021
- {
1022
- type: "join_field",
1023
- block: false,
1024
- textStyle: "",
1025
- join_field: "post.title",
1026
- },
1027
- {
1028
- type: "join_field",
1029
- block: false,
1030
- textStyle: "",
1031
- join_field: "topic.name",
1032
- },
1033
- ],
1034
- },
1035
- },
1036
- min_role: 100,
1037
- });
1038
- await View.create({
1039
- table_id: bit.id,
1040
- name: "blog_in_topic_feed",
1041
- viewtemplate: "Feed",
1042
- configuration: {
1043
- cols_lg: 1,
1044
- cols_md: 1,
1045
- cols_sm: 1,
1046
- cols_xl: 1,
1047
- in_card: false,
1048
- viewname: "blog_in_topic_feed",
1049
- show_view: "show_blog_in_topic",
1050
- descending: false,
1051
- view_to_create: "edit_blog_in_topic",
1052
- create_view_display: "Link",
1053
1110
  },
1054
- min_role: 100,
1055
- });
1056
- await View.create({
1057
- table_id: users.id,
1058
- name: "show_user_with_blog_in_topic_feed",
1059
- viewtemplate: "Show",
1060
- configuration: {
1061
- columns: [],
1062
- layout: {
1063
- above: [
1064
- {
1065
- type: "view",
1066
- view: "blog_in_topic_feed",
1067
- relation: ".users.user_interested_in_topic$user.topic.blog_in_topic$topic",
1068
- name: "fc3fc3",
1069
- state: "shared",
1070
- },
1071
- {
1072
- type: "view_link",
1073
- view: "blog_in_topic_feed",
1074
- block: false,
1075
- minRole: 100,
1076
- relation: ".users.user_interested_in_topic$user.topic.blog_in_topic$topic",
1077
- isFormula: {},
1078
- link_icon: "",
1079
- view_label: "",
1080
- },
1081
- ],
1111
+ },
1112
+ min_role: 100,
1113
+ });
1114
+ await view_1.default.create({
1115
+ table_id: bp.id,
1116
+ name: "edit_blog_post",
1117
+ viewtemplate: "Edit",
1118
+ configuration: {
1119
+ columns: [
1120
+ {
1121
+ type: "Field",
1122
+ field_name: "content",
1123
+ fieldview: "edit",
1082
1124
  },
1083
- },
1084
- min_role: 100,
1085
- });
1086
- // blog_post feed in show user views
1087
- await View.create({
1088
- table_id: bp.id,
1089
- name: "show_blog_post",
1090
- viewtemplate: "Show",
1091
- configuration: {
1092
- columns: [
1093
- { field_name: "content", type: "Field", fieldview: "as_text" },
1094
- { field_name: "title", type: "Field", fieldview: "as_text" },
1095
- ],
1096
- layout: {
1097
- above: [
1098
- {
1099
- type: "field",
1100
- block: false,
1101
- fieldview: "as_text",
1102
- textStyle: "",
1103
- field_name: "content",
1104
- },
1105
- {
1106
- type: "field",
1107
- block: false,
1108
- fieldview: "as_text",
1109
- textStyle: "",
1110
- field_name: "title",
1111
- },
1112
- ],
1125
+ {
1126
+ type: "Field",
1127
+ field_name: "title",
1128
+ fieldview: "edit",
1113
1129
  },
1114
- },
1115
- min_role: 100,
1116
- });
1117
- await View.create({
1118
- table_id: bp.id,
1119
- name: "edit_blog_post",
1120
- viewtemplate: "Edit",
1121
- configuration: {
1122
- columns: [
1130
+ ],
1131
+ layout: {
1132
+ above: [
1123
1133
  {
1124
- type: "Field",
1134
+ type: "field",
1125
1135
  field_name: "content",
1126
1136
  fieldview: "edit",
1137
+ textStyle: "",
1138
+ block: false,
1139
+ configuration: {},
1127
1140
  },
1128
1141
  {
1129
- type: "Field",
1142
+ type: "field",
1130
1143
  field_name: "title",
1131
1144
  fieldview: "edit",
1145
+ textStyle: "",
1146
+ block: false,
1147
+ configuration: {},
1132
1148
  },
1133
1149
  ],
1134
- layout: {
1135
- above: [
1136
- {
1137
- type: "field",
1138
- field_name: "content",
1139
- fieldview: "edit",
1140
- textStyle: "",
1141
- block: false,
1142
- configuration: {},
1143
- },
1144
- {
1145
- type: "field",
1146
- field_name: "title",
1147
- fieldview: "edit",
1148
- textStyle: "",
1149
- block: false,
1150
- configuration: {},
1151
- },
1152
- ],
1153
- },
1154
- },
1155
- min_role: 100,
1156
- });
1157
- await View.create({
1158
- table_id: bp.id,
1159
- name: "blog_posts_feed",
1160
- viewtemplate: "Feed",
1161
- configuration: {
1162
- cols_lg: 1,
1163
- cols_md: 1,
1164
- cols_sm: 1,
1165
- cols_xl: 1,
1166
- in_card: false,
1167
- viewname: "blog_posts_feed",
1168
- show_view: "show_blog_post",
1169
- descending: false,
1170
- view_to_create: "edit_blog_post",
1171
- create_view_display: "Link",
1172
- },
1173
- min_role: 100,
1174
- });
1175
- await View.create({
1176
- table_id: users.id,
1177
- name: "show_user_with_blog_posts_feed",
1178
- viewtemplate: "Show",
1179
- configuration: {
1180
- columns: [],
1181
- layout: {
1182
- above: [
1183
- {
1184
- type: "view",
1185
- view: "blog_posts_feed",
1186
- relation: ".users.user_interested_in_topic$user.topic.blog_in_topic$topic.post",
1187
- name: "bc653",
1188
- state: "shared",
1189
- },
1190
- ],
1191
- },
1192
- },
1193
- min_role: 100,
1194
- });
1195
- await View.create({
1196
- table_id: users.id,
1197
- name: "show_user_with_independent_feed",
1198
- viewtemplate: "Show",
1199
- configuration: {
1200
- columns: [],
1201
- layout: {
1202
- above: [
1203
- {
1204
- type: "view",
1205
- view: "Independent:blog_posts_feed",
1206
- name: "bc653",
1207
- state: "shared",
1208
- },
1209
- {
1210
- type: "view_link",
1211
- view: "blog_posts_feed",
1212
- relation: ".",
1213
- view_label: "",
1214
- block: false,
1215
- minRole: 100,
1216
- link_icon: "",
1217
- isFormula: {},
1218
- },
1219
- ],
1220
- },
1221
- },
1222
- min_role: 100,
1223
- });
1224
- const bpInbound = await Table.create("blog_post_inbound");
1225
- await Field.create({
1226
- table: bpInbound,
1227
- name: "post",
1228
- label: "Post",
1229
- type: "Key",
1230
- reftable: bp,
1231
- attributes: { summary_field: "title" },
1232
- });
1233
- const inboundInbound = await Table.create("inbound_inbound");
1234
- await Field.create({
1235
- table: inboundInbound,
1236
- name: "bp_inbound",
1237
- label: "BP Inbound",
1238
- type: "Key",
1239
- reftable: bpInbound,
1240
- attributes: { summary_field: "post" },
1241
- });
1242
- await Field.create({
1243
- table: inboundInbound,
1244
- name: "topic",
1245
- label: "Topic",
1246
- type: "Key",
1247
- reftable: topics,
1248
- attributes: { summary_field: "name" },
1249
- });
1250
- await db.insert("blog_post_inbound", {
1251
- post: 1,
1252
- });
1253
- await db.insert("blog_post_inbound", {
1254
- post: 3,
1255
- });
1256
- await db.insert("inbound_inbound", {
1257
- bp_inbound: 1,
1258
- topic: 1,
1259
- });
1260
- await db.insert("inbound_inbound", {
1261
- bp_inbound: 2,
1262
- topic: 1,
1263
- });
1264
- await View.create({
1265
- table_id: users.id,
1266
- name: "show_user_with_blog_posts_feed_two_levels",
1267
- viewtemplate: "Show",
1268
- configuration: {
1269
- columns: [],
1270
- layout: {
1271
- above: [
1272
- {
1273
- type: "view",
1274
- view: "blog_posts_feed",
1275
- relation: ".users.user_interested_in_topic$user.topic.inbound_inbound$topic.bp_inbound.post",
1276
- name: "bc653",
1277
- state: "shared",
1278
- },
1279
- ],
1280
- },
1281
- },
1282
- min_role: 100,
1283
- });
1284
- await Tag.create({
1285
- name: "tag1",
1286
- entries: [
1287
- { table_id: table.id },
1288
- { view_id: authorList.id },
1289
- { view_id: authorShow.id },
1290
- { view_id: authorEdit.id },
1291
- ],
1292
- });
1293
- const mdl = await Model.create({
1294
- name: "regression_model",
1295
- table_id: table.id,
1296
- modelpattern: "regression",
1297
- configuration: { numcluster: 2 },
1298
- });
1299
- await ModelInstance.create({
1300
- name: "regression_model_instance",
1301
- model_id: mdl.id,
1302
- fit_object: Buffer.from("foo"),
1303
- hyperparameters: { numcluster: 2 },
1304
- trained_on: new Date("2019-11-11T10:34:00.000Z"),
1305
- is_default: false,
1306
- metric_values: {},
1307
- parameters: {},
1308
- state: {},
1309
- report: "report",
1310
- });
1311
- const artists = await Table.create("artists");
1312
- const covers = await Table.create("covers");
1313
- const albums = await Table.create("albums");
1314
- const artistPlaysOnAlbum = await Table.create("artist_plays_on_album");
1315
- const pressing_job = await Table.create("pressing_job");
1316
- const fan_club = await Table.create("fan_club");
1317
- const tracksOnAlbum = await Table.create("tracks_on_album");
1318
- await Field.create({
1319
- table: artists,
1320
- name: "name",
1321
- label: "Name",
1322
- type: "String",
1323
- required: true,
1324
- });
1325
- await Field.create({
1326
- table: artists,
1327
- name: "birth_data",
1328
- label: "Birth data",
1329
- type: "Date",
1330
- required: true,
1331
- });
1332
- await Field.create({
1333
- table: covers,
1334
- name: "name",
1335
- label: "Name",
1336
- type: "String",
1337
- required: true,
1338
- });
1339
- await Field.create({
1340
- table: albums,
1341
- name: "name",
1342
- label: "Name",
1343
- type: "String",
1344
- required: true,
1345
- });
1346
- await Field.create({
1347
- table: albums,
1348
- name: "release_date",
1349
- label: "Release date",
1350
- type: "Date",
1351
- required: true,
1352
- });
1353
- await Field.create({
1354
- table: albums,
1355
- name: "cover",
1356
- reftable: covers,
1357
- label: "Cover",
1358
- type: "Key",
1359
- is_unique: true,
1360
- attributes: { summary_field: "name" },
1361
- });
1362
- await Field.create({
1363
- table: artistPlaysOnAlbum,
1364
- name: "artist",
1365
- reftable: artists,
1366
- label: "Artist",
1367
- type: "Key",
1368
- attributes: { summary_field: "name" },
1369
- });
1370
- await Field.create({
1371
- table: artistPlaysOnAlbum,
1372
- name: "album",
1373
- reftable: albums,
1374
- label: "Album",
1375
- type: "Key",
1376
- attributes: { summary_field: "name" },
1377
- });
1378
- await Field.create({
1379
- table: tracksOnAlbum,
1380
- name: "album",
1381
- reftable: albums,
1382
- label: "Album",
1383
- type: "Key",
1384
- attributes: { summary_field: "name" },
1385
- });
1386
- await Field.create({
1387
- table: tracksOnAlbum,
1388
- name: "track",
1389
- label: "Name",
1390
- type: "String",
1391
- required: true,
1392
- });
1393
- await Field.create({
1394
- table: pressing_job,
1395
- name: "album",
1396
- reftable: albums,
1397
- label: "Album",
1398
- type: "Key",
1399
- attributes: { summary_field: "name" },
1400
- });
1401
- await Field.create({
1402
- table: pressing_job,
1403
- name: "pressing_date",
1404
- label: "Pressing date",
1405
- type: "Date",
1406
- required: true,
1407
- });
1408
- await Field.create({
1409
- table: fan_club,
1410
- name: "name",
1411
- label: "Name",
1412
- type: "String",
1413
- required: true,
1414
- });
1415
- await Field.create({
1416
- table: fan_club,
1417
- name: "artist",
1418
- reftable: artists,
1419
- label: "Artis",
1420
- type: "Key",
1421
- attributes: { summary_field: "name" },
1422
- });
1423
- await db.insert("artists", {
1424
- name: "artist A",
1425
- birth_data: new Date("2000-11-11T10:34:00.000Z"),
1426
- });
1427
- await db.insert("artists", {
1428
- name: "artist B",
1429
- birth_data: new Date("2000-11-11T10:34:00.000Z"),
1430
- });
1431
- await db.insert("covers", {
1432
- name: "green cover",
1433
- });
1434
- await db.insert("covers", {
1435
- name: "blue cover",
1436
- });
1437
- await db.insert("covers", {
1438
- name: "red cover",
1439
- });
1440
- await db.insert("albums", {
1441
- name: "album A",
1442
- release_date: new Date("2010-11-11T10:34:00.000Z"),
1443
- cover: 1,
1444
- });
1445
- await db.insert("albums", {
1446
- name: "album B",
1447
- release_date: new Date("2010-11-11T10:34:00.000Z"),
1448
- cover: 2,
1449
- });
1450
- await db.insert("artist_plays_on_album", {
1451
- artist: 1,
1452
- album: 1,
1453
- });
1454
- await db.insert("artist_plays_on_album", {
1455
- artist: 1,
1456
- album: 2,
1457
- });
1458
- await db.insert("artist_plays_on_album", {
1459
- artist: 2,
1460
- album: 1,
1461
- });
1462
- await db.insert("pressing_job", {
1463
- album: 1,
1464
- pressing_date: new Date("2010-11-11T10:34:00.000Z"),
1465
- });
1466
- await db.insert("pressing_job", {
1467
- album: 2,
1468
- pressing_date: new Date("2010-11-11T10:34:00.000Z"),
1469
- });
1470
- await db.insert("fan_club", {
1471
- name: "crazy fan club",
1472
- artist: 1,
1473
- });
1474
- await db.insert("fan_club", {
1475
- name: "fan club",
1476
- artist: 1,
1477
- });
1478
- await db.insert("fan_club", {
1479
- name: "fan club official",
1480
- artist: 1,
1481
- });
1482
- await db.insert("fan_club", {
1483
- name: "another club",
1484
- artist: 2,
1485
- });
1486
- await db.insert("tracks_on_album", {
1487
- album: 1,
1488
- track: "track one on album A",
1489
- });
1490
- await db.insert("tracks_on_album", {
1491
- album: 2,
1492
- track: "track one on album B",
1493
- });
1494
- await View.create({
1495
- table_id: albums.id,
1496
- name: "edit_album",
1497
- viewtemplate: "Edit",
1498
- configuration: {
1499
- columns: [{ type: "Field", field_name: "name", state_field: "on" }],
1500
- layout: {
1501
- above: [{ type: "field", fieldview: "show", field_name: "name" }],
1502
- },
1503
- },
1504
- min_role: 100,
1505
- });
1506
- await View.create({
1507
- table_id: albums.id,
1508
- name: "show_album",
1509
- viewtemplate: "Show",
1510
- configuration: {
1511
- columns: [{ type: "Field", field_name: "name", state_field: "on" }],
1512
- layout: {
1513
- above: [{ type: "field", fieldview: "show", field_name: "name" }],
1514
- },
1515
- },
1516
- min_role: 100,
1517
- });
1518
- await View.create({
1519
- table_id: albums.id,
1520
- name: "show_album_with_subview",
1521
- viewtemplate: "Show",
1522
- configuration: {
1523
- columns: [{ type: "Field", field_name: "name", state_field: "on" }],
1524
- layout: {
1525
- above: [
1526
- { type: "field", fieldview: "show", field_name: "name" },
1527
- {
1528
- name: "d7603a",
1529
- type: "view",
1530
- view: "Own:show_album",
1531
- state: "shared",
1532
- configuration: {},
1533
- },
1534
- ],
1535
- },
1536
1150
  },
1537
- min_role: 100,
1538
- });
1539
- await View.create({
1540
- table_id: albums.id,
1541
- name: "show_album_with_subview_new_relation_path",
1542
- viewtemplate: "Show",
1543
- configuration: {
1544
- columns: [],
1545
- layout: {
1546
- above: [
1547
- {
1548
- name: "d7603a",
1549
- type: "view",
1550
- view: "show_album",
1551
- state: "shared",
1552
- relation: ".albums",
1553
- configuration: {},
1554
- },
1555
- ],
1556
- },
1151
+ },
1152
+ min_role: 100,
1153
+ });
1154
+ await view_1.default.create({
1155
+ table_id: bp.id,
1156
+ name: "blog_posts_feed",
1157
+ viewtemplate: "Feed",
1158
+ configuration: {
1159
+ cols_lg: 1,
1160
+ cols_md: 1,
1161
+ cols_sm: 1,
1162
+ cols_xl: 1,
1163
+ in_card: false,
1164
+ viewname: "blog_posts_feed",
1165
+ show_view: "show_blog_post",
1166
+ descending: false,
1167
+ view_to_create: "edit_blog_post",
1168
+ create_view_display: "Link",
1169
+ },
1170
+ min_role: 100,
1171
+ });
1172
+ await view_1.default.create({
1173
+ table_id: users.id,
1174
+ name: "show_user_with_blog_posts_feed",
1175
+ viewtemplate: "Show",
1176
+ configuration: {
1177
+ columns: [],
1178
+ layout: {
1179
+ above: [
1180
+ {
1181
+ type: "view",
1182
+ view: "blog_posts_feed",
1183
+ relation: ".users.user_interested_in_topic$user.topic.blog_in_topic$topic.post",
1184
+ name: "bc653",
1185
+ state: "shared",
1186
+ },
1187
+ ],
1557
1188
  },
1558
- min_role: 100,
1559
- });
1560
- await View.create({
1561
- table_id: albums.id,
1562
- name: "albums_feed",
1563
- viewtemplate: "Feed",
1564
- configuration: {
1565
- cols_lg: 1,
1566
- cols_md: 1,
1567
- cols_sm: 1,
1568
- cols_xl: 1,
1569
- in_card: false,
1570
- viewname: "albums_feed",
1571
- show_view: "edit_album",
1572
- descending: false,
1573
- view_to_create: "edit_album",
1574
- create_view_display: "Link",
1189
+ },
1190
+ min_role: 100,
1191
+ });
1192
+ await view_1.default.create({
1193
+ table_id: users.id,
1194
+ name: "show_user_with_independent_feed",
1195
+ viewtemplate: "Show",
1196
+ configuration: {
1197
+ columns: [],
1198
+ layout: {
1199
+ above: [
1200
+ {
1201
+ type: "view",
1202
+ view: "Independent:blog_posts_feed",
1203
+ name: "bc653",
1204
+ state: "shared",
1205
+ },
1206
+ {
1207
+ type: "view_link",
1208
+ view: "blog_posts_feed",
1209
+ relation: ".",
1210
+ view_label: "",
1211
+ block: false,
1212
+ minRole: 100,
1213
+ link_icon: "",
1214
+ isFormula: {},
1215
+ },
1216
+ ],
1575
1217
  },
1576
- min_role: 100,
1577
- });
1578
- await View.create({
1579
- table_id: tracksOnAlbum.id,
1580
- name: "edit_tracks_on_album",
1581
- viewtemplate: "Edit",
1582
- configuration: {
1583
- columns: [{ type: "Field", field_name: "album", state_field: "on" }],
1584
- layout: {
1585
- above: [{ type: "field", fieldview: "show", field_name: "album" }],
1586
- },
1218
+ },
1219
+ min_role: 100,
1220
+ });
1221
+ const bpInbound = await table_1.default.create("blog_post_inbound");
1222
+ await field_1.default.create({
1223
+ table: bpInbound,
1224
+ name: "post",
1225
+ label: "Post",
1226
+ type: "Key",
1227
+ reftable: bp,
1228
+ attributes: { summary_field: "title" },
1229
+ });
1230
+ const inboundInbound = await table_1.default.create("inbound_inbound");
1231
+ await field_1.default.create({
1232
+ table: inboundInbound,
1233
+ name: "bp_inbound",
1234
+ label: "BP Inbound",
1235
+ type: "Key",
1236
+ reftable: bpInbound,
1237
+ attributes: { summary_field: "post" },
1238
+ });
1239
+ await field_1.default.create({
1240
+ table: inboundInbound,
1241
+ name: "topic",
1242
+ label: "Topic",
1243
+ type: "Key",
1244
+ reftable: topics,
1245
+ attributes: { summary_field: "name" },
1246
+ });
1247
+ await db.insert("blog_post_inbound", {
1248
+ post: 1,
1249
+ });
1250
+ await db.insert("blog_post_inbound", {
1251
+ post: 3,
1252
+ });
1253
+ await db.insert("inbound_inbound", {
1254
+ bp_inbound: 1,
1255
+ topic: 1,
1256
+ });
1257
+ await db.insert("inbound_inbound", {
1258
+ bp_inbound: 2,
1259
+ topic: 1,
1260
+ });
1261
+ await view_1.default.create({
1262
+ table_id: users.id,
1263
+ name: "show_user_with_blog_posts_feed_two_levels",
1264
+ viewtemplate: "Show",
1265
+ configuration: {
1266
+ columns: [],
1267
+ layout: {
1268
+ above: [
1269
+ {
1270
+ type: "view",
1271
+ view: "blog_posts_feed",
1272
+ relation: ".users.user_interested_in_topic$user.topic.inbound_inbound$topic.bp_inbound.post",
1273
+ name: "bc653",
1274
+ state: "shared",
1275
+ },
1276
+ ],
1587
1277
  },
1588
- min_role: 100,
1589
- });
1590
- await View.create({
1591
- table_id: tracksOnAlbum.id,
1592
- name: "tracks_on_album_feed",
1593
- viewtemplate: "Feed",
1594
- configuration: {
1595
- cols_lg: 1,
1596
- cols_md: 1,
1597
- cols_sm: 1,
1598
- cols_xl: 1,
1599
- in_card: false,
1600
- viewname: "tracks_on_album_feed",
1601
- show_view: "edit_tracks_on_album",
1602
- descending: false,
1603
- view_to_create: "edit_tracks_on_album",
1604
- create_view_display: "Link",
1278
+ },
1279
+ min_role: 100,
1280
+ });
1281
+ await tag_1.default.create({
1282
+ name: "tag1",
1283
+ entries: [
1284
+ { table_id: table.id },
1285
+ { view_id: authorList.id },
1286
+ { view_id: authorShow.id },
1287
+ { view_id: authorEdit.id },
1288
+ ],
1289
+ });
1290
+ const mdl = await model_1.default.create({
1291
+ name: "regression_model",
1292
+ table_id: table.id,
1293
+ modelpattern: "regression",
1294
+ configuration: { numcluster: 2 },
1295
+ });
1296
+ await model_instance_1.default.create({
1297
+ name: "regression_model_instance",
1298
+ model_id: mdl.id,
1299
+ fit_object: Buffer.from("foo"),
1300
+ hyperparameters: { numcluster: 2 },
1301
+ trained_on: new Date("2019-11-11T10:34:00.000Z"),
1302
+ is_default: false,
1303
+ metric_values: {},
1304
+ parameters: {},
1305
+ state: {},
1306
+ report: "report",
1307
+ });
1308
+ const artists = await table_1.default.create("artists");
1309
+ const covers = await table_1.default.create("covers");
1310
+ const albums = await table_1.default.create("albums");
1311
+ const artistPlaysOnAlbum = await table_1.default.create("artist_plays_on_album");
1312
+ const pressing_job = await table_1.default.create("pressing_job");
1313
+ const fan_club = await table_1.default.create("fan_club");
1314
+ const tracksOnAlbum = await table_1.default.create("tracks_on_album");
1315
+ await field_1.default.create({
1316
+ table: artists,
1317
+ name: "name",
1318
+ label: "Name",
1319
+ type: "String",
1320
+ required: true,
1321
+ });
1322
+ await field_1.default.create({
1323
+ table: artists,
1324
+ name: "birth_data",
1325
+ label: "Birth data",
1326
+ type: "Date",
1327
+ required: true,
1328
+ });
1329
+ await field_1.default.create({
1330
+ table: covers,
1331
+ name: "name",
1332
+ label: "Name",
1333
+ type: "String",
1334
+ required: true,
1335
+ });
1336
+ await field_1.default.create({
1337
+ table: albums,
1338
+ name: "name",
1339
+ label: "Name",
1340
+ type: "String",
1341
+ required: true,
1342
+ });
1343
+ await field_1.default.create({
1344
+ table: albums,
1345
+ name: "release_date",
1346
+ label: "Release date",
1347
+ type: "Date",
1348
+ required: true,
1349
+ });
1350
+ await field_1.default.create({
1351
+ table: albums,
1352
+ name: "cover",
1353
+ reftable: covers,
1354
+ label: "Cover",
1355
+ type: "Key",
1356
+ is_unique: true,
1357
+ attributes: { summary_field: "name" },
1358
+ });
1359
+ await field_1.default.create({
1360
+ table: artistPlaysOnAlbum,
1361
+ name: "artist",
1362
+ reftable: artists,
1363
+ label: "Artist",
1364
+ type: "Key",
1365
+ attributes: { summary_field: "name" },
1366
+ });
1367
+ await field_1.default.create({
1368
+ table: artistPlaysOnAlbum,
1369
+ name: "album",
1370
+ reftable: albums,
1371
+ label: "Album",
1372
+ type: "Key",
1373
+ attributes: { summary_field: "name" },
1374
+ });
1375
+ await field_1.default.create({
1376
+ table: tracksOnAlbum,
1377
+ name: "album",
1378
+ reftable: albums,
1379
+ label: "Album",
1380
+ type: "Key",
1381
+ attributes: { summary_field: "name" },
1382
+ });
1383
+ await field_1.default.create({
1384
+ table: tracksOnAlbum,
1385
+ name: "track",
1386
+ label: "Name",
1387
+ type: "String",
1388
+ required: true,
1389
+ });
1390
+ await field_1.default.create({
1391
+ table: pressing_job,
1392
+ name: "album",
1393
+ reftable: albums,
1394
+ label: "Album",
1395
+ type: "Key",
1396
+ attributes: { summary_field: "name" },
1397
+ });
1398
+ await field_1.default.create({
1399
+ table: pressing_job,
1400
+ name: "pressing_date",
1401
+ label: "Pressing date",
1402
+ type: "Date",
1403
+ required: true,
1404
+ });
1405
+ await field_1.default.create({
1406
+ table: fan_club,
1407
+ name: "name",
1408
+ label: "Name",
1409
+ type: "String",
1410
+ required: true,
1411
+ });
1412
+ await field_1.default.create({
1413
+ table: fan_club,
1414
+ name: "artist",
1415
+ reftable: artists,
1416
+ label: "Artis",
1417
+ type: "Key",
1418
+ attributes: { summary_field: "name" },
1419
+ });
1420
+ await db.insert("artists", {
1421
+ name: "artist A",
1422
+ birth_data: new Date("2000-11-11T10:34:00.000Z"),
1423
+ });
1424
+ await db.insert("artists", {
1425
+ name: "artist B",
1426
+ birth_data: new Date("2000-11-11T10:34:00.000Z"),
1427
+ });
1428
+ await db.insert("covers", {
1429
+ name: "green cover",
1430
+ });
1431
+ await db.insert("covers", {
1432
+ name: "blue cover",
1433
+ });
1434
+ await db.insert("covers", {
1435
+ name: "red cover",
1436
+ });
1437
+ await db.insert("albums", {
1438
+ name: "album A",
1439
+ release_date: new Date("2010-11-11T10:34:00.000Z"),
1440
+ cover: 1,
1441
+ });
1442
+ await db.insert("albums", {
1443
+ name: "album B",
1444
+ release_date: new Date("2010-11-11T10:34:00.000Z"),
1445
+ cover: 2,
1446
+ });
1447
+ await db.insert("artist_plays_on_album", {
1448
+ artist: 1,
1449
+ album: 1,
1450
+ });
1451
+ await db.insert("artist_plays_on_album", {
1452
+ artist: 1,
1453
+ album: 2,
1454
+ });
1455
+ await db.insert("artist_plays_on_album", {
1456
+ artist: 2,
1457
+ album: 1,
1458
+ });
1459
+ await db.insert("pressing_job", {
1460
+ album: 1,
1461
+ pressing_date: new Date("2010-11-11T10:34:00.000Z"),
1462
+ });
1463
+ await db.insert("pressing_job", {
1464
+ album: 2,
1465
+ pressing_date: new Date("2010-11-11T10:34:00.000Z"),
1466
+ });
1467
+ await db.insert("fan_club", {
1468
+ name: "crazy fan club",
1469
+ artist: 1,
1470
+ });
1471
+ await db.insert("fan_club", {
1472
+ name: "fan club",
1473
+ artist: 1,
1474
+ });
1475
+ await db.insert("fan_club", {
1476
+ name: "fan club official",
1477
+ artist: 1,
1478
+ });
1479
+ await db.insert("fan_club", {
1480
+ name: "another club",
1481
+ artist: 2,
1482
+ });
1483
+ await db.insert("tracks_on_album", {
1484
+ album: 1,
1485
+ track: "track one on album A",
1486
+ });
1487
+ await db.insert("tracks_on_album", {
1488
+ album: 2,
1489
+ track: "track one on album B",
1490
+ });
1491
+ await view_1.default.create({
1492
+ table_id: albums.id,
1493
+ name: "edit_album",
1494
+ viewtemplate: "Edit",
1495
+ configuration: {
1496
+ columns: [{ type: "Field", field_name: "name", state_field: "on" }],
1497
+ layout: {
1498
+ above: [{ type: "field", fieldview: "show", field_name: "name" }],
1499
+ },
1500
+ },
1501
+ min_role: 100,
1502
+ });
1503
+ await view_1.default.create({
1504
+ table_id: albums.id,
1505
+ name: "show_album",
1506
+ viewtemplate: "Show",
1507
+ configuration: {
1508
+ columns: [{ type: "Field", field_name: "name", state_field: "on" }],
1509
+ layout: {
1510
+ above: [{ type: "field", fieldview: "show", field_name: "name" }],
1511
+ },
1512
+ },
1513
+ min_role: 100,
1514
+ });
1515
+ await view_1.default.create({
1516
+ table_id: albums.id,
1517
+ name: "show_album_with_subview",
1518
+ viewtemplate: "Show",
1519
+ configuration: {
1520
+ columns: [{ type: "Field", field_name: "name", state_field: "on" }],
1521
+ layout: {
1522
+ above: [
1523
+ { type: "field", fieldview: "show", field_name: "name" },
1524
+ {
1525
+ name: "d7603a",
1526
+ type: "view",
1527
+ view: "Own:show_album",
1528
+ state: "shared",
1529
+ configuration: {},
1530
+ },
1531
+ ],
1605
1532
  },
1606
- min_role: 100,
1607
- });
1608
- await View.create({
1609
- table_id: artists.id,
1610
- name: "show_artist",
1611
- viewtemplate: "Show",
1612
- configuration: {
1613
- columns: [{ type: "Field", field_name: "name", state_field: "on" }],
1614
- layout: {
1615
- above: [
1616
- { type: "field", fieldview: "show", field_name: "name" },
1617
- {
1618
- name: "d7603a",
1619
- type: "view",
1620
- view: "albums_feed",
1621
- state: "shared",
1622
- relation: ".artists.artist_plays_on_album$artist.album",
1623
- configuration: {},
1624
- },
1625
- ],
1626
- },
1533
+ },
1534
+ min_role: 100,
1535
+ });
1536
+ await view_1.default.create({
1537
+ table_id: albums.id,
1538
+ name: "show_album_with_subview_new_relation_path",
1539
+ viewtemplate: "Show",
1540
+ configuration: {
1541
+ columns: [],
1542
+ layout: {
1543
+ above: [
1544
+ {
1545
+ name: "d7603a",
1546
+ type: "view",
1547
+ view: "show_album",
1548
+ state: "shared",
1549
+ relation: ".albums",
1550
+ configuration: {},
1551
+ },
1552
+ ],
1627
1553
  },
1628
- min_role: 100,
1629
- });
1630
- await View.create({
1631
- table_id: artists.id,
1632
- name: "edit_artist",
1633
- viewtemplate: "Edit",
1634
- configuration: {
1635
- layout: {
1636
- above: [
1637
- { type: "field", fieldview: "edit", field_name: "name" },
1638
- {
1639
- type: "field",
1640
- fieldview: "edit",
1641
- field_name: "birth_data",
1642
- },
1643
- ],
1644
- },
1645
- columns: [
1554
+ },
1555
+ min_role: 100,
1556
+ });
1557
+ await view_1.default.create({
1558
+ table_id: albums.id,
1559
+ name: "albums_feed",
1560
+ viewtemplate: "Feed",
1561
+ configuration: {
1562
+ cols_lg: 1,
1563
+ cols_md: 1,
1564
+ cols_sm: 1,
1565
+ cols_xl: 1,
1566
+ in_card: false,
1567
+ viewname: "albums_feed",
1568
+ show_view: "edit_album",
1569
+ descending: false,
1570
+ view_to_create: "edit_album",
1571
+ create_view_display: "Link",
1572
+ },
1573
+ min_role: 100,
1574
+ });
1575
+ await view_1.default.create({
1576
+ table_id: tracksOnAlbum.id,
1577
+ name: "edit_tracks_on_album",
1578
+ viewtemplate: "Edit",
1579
+ configuration: {
1580
+ columns: [{ type: "Field", field_name: "album", state_field: "on" }],
1581
+ layout: {
1582
+ above: [{ type: "field", fieldview: "show", field_name: "album" }],
1583
+ },
1584
+ },
1585
+ min_role: 100,
1586
+ });
1587
+ await view_1.default.create({
1588
+ table_id: tracksOnAlbum.id,
1589
+ name: "tracks_on_album_feed",
1590
+ viewtemplate: "Feed",
1591
+ configuration: {
1592
+ cols_lg: 1,
1593
+ cols_md: 1,
1594
+ cols_sm: 1,
1595
+ cols_xl: 1,
1596
+ in_card: false,
1597
+ viewname: "tracks_on_album_feed",
1598
+ show_view: "edit_tracks_on_album",
1599
+ descending: false,
1600
+ view_to_create: "edit_tracks_on_album",
1601
+ create_view_display: "Link",
1602
+ },
1603
+ min_role: 100,
1604
+ });
1605
+ await view_1.default.create({
1606
+ table_id: artists.id,
1607
+ name: "show_artist",
1608
+ viewtemplate: "Show",
1609
+ configuration: {
1610
+ columns: [{ type: "Field", field_name: "name", state_field: "on" }],
1611
+ layout: {
1612
+ above: [
1613
+ { type: "field", fieldview: "show", field_name: "name" },
1646
1614
  {
1647
- type: "Field",
1648
- block: false,
1649
- fieldview: "edit",
1650
- textStyle: "",
1651
- field_name: "birth_data",
1615
+ name: "d7603a",
1616
+ type: "view",
1617
+ view: "albums_feed",
1618
+ state: "shared",
1619
+ relation: ".artists.artist_plays_on_album$artist.album",
1652
1620
  configuration: {},
1653
1621
  },
1622
+ ],
1623
+ },
1624
+ },
1625
+ min_role: 100,
1626
+ });
1627
+ await view_1.default.create({
1628
+ table_id: artists.id,
1629
+ name: "edit_artist",
1630
+ viewtemplate: "Edit",
1631
+ configuration: {
1632
+ layout: {
1633
+ above: [
1634
+ { type: "field", fieldview: "edit", field_name: "name" },
1654
1635
  {
1655
- type: "Field",
1656
- block: false,
1636
+ type: "field",
1657
1637
  fieldview: "edit",
1658
- textStyle: "",
1659
- field_name: "name",
1660
- configuration: {},
1638
+ field_name: "birth_data",
1661
1639
  },
1662
1640
  ],
1663
1641
  },
1664
- min_role: 100,
1665
- });
1666
- await View.create({
1667
- table_id: artists.id,
1668
- name: "show_artist_with_edit_artist",
1669
- viewtemplate: "Show",
1670
- configuration: {
1671
- columns: [
1672
- { type: "Field", field_name: "name", state_field: "on" },
1642
+ columns: [
1643
+ {
1644
+ type: "Field",
1645
+ block: false,
1646
+ fieldview: "edit",
1647
+ textStyle: "",
1648
+ field_name: "birth_data",
1649
+ configuration: {},
1650
+ },
1651
+ {
1652
+ type: "Field",
1653
+ block: false,
1654
+ fieldview: "edit",
1655
+ textStyle: "",
1656
+ field_name: "name",
1657
+ configuration: {},
1658
+ },
1659
+ ],
1660
+ },
1661
+ min_role: 100,
1662
+ });
1663
+ await view_1.default.create({
1664
+ table_id: artists.id,
1665
+ name: "show_artist_with_edit_artist",
1666
+ viewtemplate: "Show",
1667
+ configuration: {
1668
+ columns: [
1669
+ { type: "Field", field_name: "name", state_field: "on" },
1670
+ {
1671
+ type: "ViewLink",
1672
+ view: "edit_artist",
1673
+ block: false,
1674
+ label: "",
1675
+ minRole: 100,
1676
+ relation: ".artists",
1677
+ link_icon: "",
1678
+ },
1679
+ ],
1680
+ layout: {
1681
+ above: [
1682
+ { type: "field", fieldview: "show", field_name: "name" },
1673
1683
  {
1674
- type: "ViewLink",
1684
+ name: "d7603a",
1685
+ type: "view",
1686
+ view: "edit_artist",
1687
+ state: "shared",
1688
+ relation: ".artists",
1689
+ configuration: {},
1690
+ },
1691
+ {
1692
+ type: "view_link",
1675
1693
  view: "edit_artist",
1676
1694
  block: false,
1677
- label: "",
1678
1695
  minRole: 100,
1679
1696
  relation: ".artists",
1697
+ isFormula: {},
1680
1698
  link_icon: "",
1699
+ view_label: "",
1681
1700
  },
1682
1701
  ],
1683
- layout: {
1684
- above: [
1685
- { type: "field", fieldview: "show", field_name: "name" },
1686
- {
1687
- name: "d7603a",
1688
- type: "view",
1689
- view: "edit_artist",
1690
- state: "shared",
1691
- relation: ".artists",
1692
- configuration: {},
1693
- },
1694
- {
1695
- type: "view_link",
1696
- view: "edit_artist",
1697
- block: false,
1698
- minRole: 100,
1699
- relation: ".artists",
1700
- isFormula: {},
1701
- link_icon: "",
1702
- view_label: "",
1703
- },
1704
- ],
1705
- },
1706
- },
1707
- min_role: 100,
1708
- });
1709
- await View.create({
1710
- table_id: artistPlaysOnAlbum.id,
1711
- name: "artist_plays_on_album_list",
1712
- viewtemplate: "List",
1713
- configuration: {
1714
- columns: [
1715
- { type: "JoinField", join_field: "artist.name" },
1716
- { type: "JoinField", join_field: "album.name" },
1717
- ],
1718
1702
  },
1719
- min_role: 100,
1720
- });
1721
- await View.create({
1722
- table_id: artistPlaysOnAlbum.id,
1723
- name: "edit_artist_on_album",
1724
- viewtemplate: "Edit",
1725
- configuration: {
1726
- layout: {
1727
- above: [
1728
- {
1729
- type: "field",
1730
- block: false,
1731
- fieldview: "select",
1732
- field_name: "album",
1733
- },
1734
- {
1735
- type: "field",
1736
- block: false,
1737
- fieldview: "select",
1738
- field_name: "artist",
1739
- },
1740
- ],
1741
- },
1742
- columns: [
1703
+ },
1704
+ min_role: 100,
1705
+ });
1706
+ await view_1.default.create({
1707
+ table_id: artistPlaysOnAlbum.id,
1708
+ name: "artist_plays_on_album_list",
1709
+ viewtemplate: "List",
1710
+ configuration: {
1711
+ columns: [
1712
+ { type: "JoinField", join_field: "artist.name" },
1713
+ { type: "JoinField", join_field: "album.name" },
1714
+ ],
1715
+ },
1716
+ min_role: 100,
1717
+ });
1718
+ await view_1.default.create({
1719
+ table_id: artistPlaysOnAlbum.id,
1720
+ name: "edit_artist_on_album",
1721
+ viewtemplate: "Edit",
1722
+ configuration: {
1723
+ layout: {
1724
+ above: [
1743
1725
  {
1744
- type: "Field",
1726
+ type: "field",
1727
+ block: false,
1745
1728
  fieldview: "select",
1746
1729
  field_name: "album",
1747
1730
  },
1748
1731
  {
1749
- type: "Field",
1732
+ type: "field",
1733
+ block: false,
1750
1734
  fieldview: "select",
1751
1735
  field_name: "artist",
1752
1736
  },
1753
1737
  ],
1754
1738
  },
1755
- min_role: 100,
1756
- });
1757
- await View.create({
1758
- table_id: covers.id,
1759
- name: "show_cover",
1760
- viewtemplate: "Show",
1761
- configuration: {
1762
- columns: [{ type: "Field", field_name: "name", state_field: "on" }],
1763
- layout: {
1764
- above: [{ type: "field", fieldview: "show", field_name: "name" }],
1739
+ columns: [
1740
+ {
1741
+ type: "Field",
1742
+ fieldview: "select",
1743
+ field_name: "album",
1765
1744
  },
1766
- },
1767
- min_role: 100,
1768
- });
1769
- // ChildList two layers
1770
- await View.create({
1771
- table_id: covers.id,
1772
- name: "show_cover_with_artist_on_album",
1773
- viewtemplate: "Show",
1774
- configuration: {
1775
- columns: [
1776
- { type: "Field", field_name: "name", state_field: "on" },
1745
+ {
1746
+ type: "Field",
1747
+ fieldview: "select",
1748
+ field_name: "artist",
1749
+ },
1750
+ ],
1751
+ },
1752
+ min_role: 100,
1753
+ });
1754
+ await view_1.default.create({
1755
+ table_id: covers.id,
1756
+ name: "show_cover",
1757
+ viewtemplate: "Show",
1758
+ configuration: {
1759
+ columns: [{ type: "Field", field_name: "name", state_field: "on" }],
1760
+ layout: {
1761
+ above: [{ type: "field", fieldview: "show", field_name: "name" }],
1762
+ },
1763
+ },
1764
+ min_role: 100,
1765
+ });
1766
+ // ChildList two layers
1767
+ await view_1.default.create({
1768
+ table_id: covers.id,
1769
+ name: "show_cover_with_artist_on_album",
1770
+ viewtemplate: "Show",
1771
+ configuration: {
1772
+ columns: [
1773
+ { type: "Field", field_name: "name", state_field: "on" },
1774
+ {
1775
+ type: "ViewLink",
1776
+ view: "artist_plays_on_album_list",
1777
+ block: false,
1778
+ label: "",
1779
+ minRole: 100,
1780
+ relation: ".covers.albums$cover.artist_plays_on_album$album",
1781
+ link_icon: "",
1782
+ },
1783
+ ],
1784
+ layout: {
1785
+ above: [
1786
+ { type: "field", fieldview: "show", field_name: "name" },
1777
1787
  {
1778
- type: "ViewLink",
1788
+ name: "f10873",
1789
+ type: "view",
1790
+ view: "artist_plays_on_album_list",
1791
+ state: "shared",
1792
+ relation: ".covers.albums$cover.artist_plays_on_album$album",
1793
+ },
1794
+ {
1795
+ type: "view_link",
1779
1796
  view: "artist_plays_on_album_list",
1780
1797
  block: false,
1781
- label: "",
1782
1798
  minRole: 100,
1783
1799
  relation: ".covers.albums$cover.artist_plays_on_album$album",
1800
+ isFormula: {},
1784
1801
  link_icon: "",
1802
+ view_label: "",
1785
1803
  },
1786
1804
  ],
1787
- layout: {
1788
- above: [
1789
- { type: "field", fieldview: "show", field_name: "name" },
1790
- {
1791
- name: "f10873",
1792
- type: "view",
1793
- view: "artist_plays_on_album_list",
1794
- state: "shared",
1795
- relation: ".covers.albums$cover.artist_plays_on_album$album",
1796
- },
1797
- {
1798
- type: "view_link",
1799
- view: "artist_plays_on_album_list",
1800
- block: false,
1801
- minRole: 100,
1802
- relation: ".covers.albums$cover.artist_plays_on_album$album",
1803
- isFormula: {},
1804
- link_icon: "",
1805
- view_label: "",
1806
- },
1807
- ],
1808
- },
1809
1805
  },
1810
- min_role: 100,
1811
- });
1812
- // OneToOne test
1813
- await View.create({
1814
- table_id: covers.id,
1815
- name: "show_cover_with_album",
1816
- viewtemplate: "Show",
1817
- configuration: {
1818
- columns: [
1819
- { type: "Field", field_name: "name", state_field: "on" },
1806
+ },
1807
+ min_role: 100,
1808
+ });
1809
+ // OneToOne test
1810
+ await view_1.default.create({
1811
+ table_id: covers.id,
1812
+ name: "show_cover_with_album",
1813
+ viewtemplate: "Show",
1814
+ configuration: {
1815
+ columns: [
1816
+ { type: "Field", field_name: "name", state_field: "on" },
1817
+ {
1818
+ type: "ViewLink",
1819
+ view: "show_album",
1820
+ block: false,
1821
+ label: "",
1822
+ minRole: 100,
1823
+ relation: ".covers.albums$cover",
1824
+ link_icon: "",
1825
+ },
1826
+ ],
1827
+ layout: {
1828
+ above: [
1829
+ { type: "field", fieldview: "show", field_name: "name" },
1820
1830
  {
1821
- type: "ViewLink",
1831
+ name: "f10873",
1832
+ type: "view",
1833
+ view: "show_album",
1834
+ state: "shared",
1835
+ relation: ".covers.albums$cover",
1836
+ },
1837
+ {
1838
+ type: "view_link",
1822
1839
  view: "show_album",
1823
1840
  block: false,
1824
- label: "",
1825
1841
  minRole: 100,
1826
1842
  relation: ".covers.albums$cover",
1843
+ isFormula: {},
1827
1844
  link_icon: "",
1845
+ view_label: "",
1828
1846
  },
1829
1847
  ],
1830
- layout: {
1831
- above: [
1832
- { type: "field", fieldview: "show", field_name: "name" },
1833
- {
1834
- name: "f10873",
1835
- type: "view",
1836
- view: "show_album",
1837
- state: "shared",
1838
- relation: ".covers.albums$cover",
1839
- },
1840
- {
1841
- type: "view_link",
1842
- view: "show_album",
1843
- block: false,
1844
- minRole: 100,
1845
- relation: ".covers.albums$cover",
1846
- isFormula: {},
1847
- link_icon: "",
1848
- view_label: "",
1849
- },
1850
- ],
1851
- },
1852
1848
  },
1853
- min_role: 100,
1854
- });
1855
- // Parent test
1856
- await View.create({
1857
- table_id: albums.id,
1858
- name: "show_album_with_cover",
1859
- viewtemplate: "Show",
1860
- configuration: {
1861
- columns: [
1849
+ },
1850
+ min_role: 100,
1851
+ });
1852
+ // Parent test
1853
+ await view_1.default.create({
1854
+ table_id: albums.id,
1855
+ name: "show_album_with_cover",
1856
+ viewtemplate: "Show",
1857
+ configuration: {
1858
+ columns: [
1859
+ {
1860
+ type: "ViewLink",
1861
+ view: "show_cover",
1862
+ block: false,
1863
+ label: "",
1864
+ minRole: 100,
1865
+ relation: ".albums.cover",
1866
+ link_icon: "",
1867
+ },
1868
+ ],
1869
+ layout: {
1870
+ above: [
1862
1871
  {
1863
- type: "ViewLink",
1872
+ name: "f10873",
1873
+ type: "view",
1864
1874
  view: "show_cover",
1865
- block: false,
1866
- label: "",
1867
- minRole: 100,
1875
+ state: "shared",
1868
1876
  relation: ".albums.cover",
1869
- link_icon: "",
1870
1877
  },
1871
- ],
1872
- layout: {
1873
- above: [
1874
- {
1875
- name: "f10873",
1876
- type: "view",
1877
- view: "show_cover",
1878
- state: "shared",
1879
- relation: ".albums.cover",
1880
- },
1881
- {
1882
- type: "view_link",
1883
- view: "show_cover",
1884
- block: false,
1885
- minRole: 100,
1886
- relation: ".albums.cover",
1887
- isFormula: {},
1888
- link_icon: "",
1889
- view_label: "",
1890
- },
1891
- ],
1892
- },
1893
- },
1894
- min_role: 100,
1895
- });
1896
- // RelationPath test
1897
- await View.create({
1898
- table_id: tracksOnAlbum.id,
1899
- name: "track_on_album_with_artists_on_album",
1900
- viewtemplate: "Show",
1901
- configuration: {
1902
- columns: [
1903
1878
  {
1904
- type: "JoinField",
1879
+ type: "view_link",
1880
+ view: "show_cover",
1905
1881
  block: false,
1906
- textStyle: "",
1907
- join_field: "album.name",
1908
- configuration: {},
1882
+ minRole: 100,
1883
+ relation: ".albums.cover",
1884
+ isFormula: {},
1885
+ link_icon: "",
1886
+ view_label: "",
1909
1887
  },
1888
+ ],
1889
+ },
1890
+ },
1891
+ min_role: 100,
1892
+ });
1893
+ // RelationPath test
1894
+ await view_1.default.create({
1895
+ table_id: tracksOnAlbum.id,
1896
+ name: "track_on_album_with_artists_on_album",
1897
+ viewtemplate: "Show",
1898
+ configuration: {
1899
+ columns: [
1900
+ {
1901
+ type: "JoinField",
1902
+ block: false,
1903
+ textStyle: "",
1904
+ join_field: "album.name",
1905
+ configuration: {},
1906
+ },
1907
+ {
1908
+ type: "Field",
1909
+ block: false,
1910
+ fieldview: "as_text",
1911
+ textStyle: "",
1912
+ field_name: "track",
1913
+ configuration: {},
1914
+ },
1915
+ {
1916
+ type: "view_link",
1917
+ view: "artist_plays_on_album_list",
1918
+ block: false,
1919
+ minRole: 100,
1920
+ relation: ".tracks_on_album.album.artist_plays_on_album$album",
1921
+ isFormula: {},
1922
+ link_icon: "",
1923
+ view_label: "",
1924
+ },
1925
+ ],
1926
+ layout: {
1927
+ above: [
1910
1928
  {
1911
- type: "Field",
1912
- block: false,
1913
- fieldview: "as_text",
1914
- textStyle: "",
1915
- field_name: "track",
1916
- configuration: {},
1929
+ name: "1034b",
1930
+ type: "view",
1931
+ view: "artist_plays_on_album_list",
1932
+ state: "shared",
1933
+ relation: ".tracks_on_album.album.artist_plays_on_album$album",
1917
1934
  },
1918
1935
  {
1919
1936
  type: "view_link",
@@ -1926,407 +1943,360 @@ module.exports =
1926
1943
  view_label: "",
1927
1944
  },
1928
1945
  ],
1929
- layout: {
1930
- above: [
1931
- {
1932
- name: "1034b",
1933
- type: "view",
1934
- view: "artist_plays_on_album_list",
1935
- state: "shared",
1936
- relation: ".tracks_on_album.album.artist_plays_on_album$album",
1937
- },
1938
- {
1939
- type: "view_link",
1940
- view: "artist_plays_on_album_list",
1941
- block: false,
1942
- minRole: 100,
1943
- relation: ".tracks_on_album.album.artist_plays_on_album$album",
1944
- isFormula: {},
1945
- link_icon: "",
1946
- view_label: "",
1947
- },
1948
- ],
1949
- },
1950
1946
  },
1951
- min_role: 100,
1952
- });
1953
- await View.create({
1954
- table_id: fan_club.id,
1955
- name: "edit_fan_club",
1956
- viewtemplate: "Edit",
1957
- configuration: {
1958
- columns: [{ type: "Field", field_name: "name", state_field: "on" }],
1959
- layout: {
1960
- above: [{ type: "field", fieldview: "show", field_name: "name" }],
1961
- },
1962
- },
1963
- min_role: 100,
1964
- });
1965
- await View.create({
1966
- table_id: fan_club.id,
1967
- name: "show_fan_club",
1968
- viewtemplate: "Show",
1969
- configuration: {
1970
- columns: [{ type: "Field", field_name: "name", state_field: "on" }],
1971
- layout: {
1972
- above: [{ type: "field", fieldview: "show", field_name: "name" }],
1973
- },
1947
+ },
1948
+ min_role: 100,
1949
+ });
1950
+ await view_1.default.create({
1951
+ table_id: fan_club.id,
1952
+ name: "edit_fan_club",
1953
+ viewtemplate: "Edit",
1954
+ configuration: {
1955
+ columns: [{ type: "Field", field_name: "name", state_field: "on" }],
1956
+ layout: {
1957
+ above: [{ type: "field", fieldview: "show", field_name: "name" }],
1958
+ },
1959
+ },
1960
+ min_role: 100,
1961
+ });
1962
+ await view_1.default.create({
1963
+ table_id: fan_club.id,
1964
+ name: "show_fan_club",
1965
+ viewtemplate: "Show",
1966
+ configuration: {
1967
+ columns: [{ type: "Field", field_name: "name", state_field: "on" }],
1968
+ layout: {
1969
+ above: [{ type: "field", fieldview: "show", field_name: "name" }],
1970
+ },
1971
+ },
1972
+ min_role: 100,
1973
+ });
1974
+ await view_1.default.create({
1975
+ table_id: fan_club.id,
1976
+ name: "fan_club_feed",
1977
+ viewtemplate: "Feed",
1978
+ configuration: {
1979
+ cols_lg: 1,
1980
+ cols_md: 1,
1981
+ cols_sm: 1,
1982
+ cols_xl: 1,
1983
+ in_card: false,
1984
+ viewname: "fan_club_feed",
1985
+ show_view: "edit_fan_club",
1986
+ descending: false,
1987
+ view_to_create: "edit_fan_club",
1988
+ create_view_display: "Link",
1989
+ },
1990
+ min_role: 100,
1991
+ });
1992
+ await view_1.default.create({
1993
+ table_id: pressing_job.id,
1994
+ name: "show_pressing_job",
1995
+ viewtemplate: "Show",
1996
+ configuration: {
1997
+ columns: [{ type: "Field", field_name: "name", state_field: "on" }],
1998
+ layout: {
1999
+ above: [
2000
+ { type: "field", fieldview: "show", field_name: "name" },
2001
+ {
2002
+ name: "d7603a",
2003
+ type: "view",
2004
+ view: "Independent:fan_club_feed",
2005
+ state: "shared",
2006
+ relation: undefined,
2007
+ configuration: {},
2008
+ },
2009
+ ],
1974
2010
  },
1975
- min_role: 100,
1976
- });
1977
- await View.create({
1978
- table_id: fan_club.id,
1979
- name: "fan_club_feed",
1980
- viewtemplate: "Feed",
1981
- configuration: {
1982
- cols_lg: 1,
1983
- cols_md: 1,
1984
- cols_sm: 1,
1985
- cols_xl: 1,
1986
- in_card: false,
1987
- viewname: "fan_club_feed",
1988
- show_view: "edit_fan_club",
1989
- descending: false,
1990
- view_to_create: "edit_fan_club",
1991
- create_view_display: "Link",
2011
+ },
2012
+ min_role: 100,
2013
+ });
2014
+ await view_1.default.create({
2015
+ table_id: pressing_job.id,
2016
+ name: "show_pressing_job_with_new_indenpendent_relation_path",
2017
+ viewtemplate: "Show",
2018
+ configuration: {
2019
+ columns: [{ type: "Field", field_name: "name", state_field: "on" }],
2020
+ layout: {
2021
+ above: [
2022
+ { type: "field", fieldview: "show", field_name: "name" },
2023
+ {
2024
+ name: "a7603e",
2025
+ type: "view",
2026
+ view: "fan_club_feed",
2027
+ relation: ".",
2028
+ state: "shared",
2029
+ configuration: {},
2030
+ },
2031
+ ],
1992
2032
  },
1993
- min_role: 100,
1994
- });
1995
- await View.create({
1996
- table_id: pressing_job.id,
1997
- name: "show_pressing_job",
1998
- viewtemplate: "Show",
1999
- configuration: {
2000
- columns: [{ type: "Field", field_name: "name", state_field: "on" }],
2001
- layout: {
2002
- above: [
2003
- { type: "field", fieldview: "show", field_name: "name" },
2004
- {
2005
- name: "d7603a",
2006
- type: "view",
2007
- view: "Independent:fan_club_feed",
2008
- state: "shared",
2009
- relation: undefined,
2010
- configuration: {},
2011
- },
2012
- ],
2013
- },
2033
+ },
2034
+ min_role: 100,
2035
+ });
2036
+ const department = await table_1.default.create("department");
2037
+ const employee = await table_1.default.create("employee");
2038
+ const company = await table_1.default.create("company");
2039
+ await field_1.default.create({
2040
+ table: company,
2041
+ name: "name",
2042
+ label: "Name",
2043
+ type: "String",
2044
+ required: true,
2045
+ });
2046
+ await field_1.default.create({
2047
+ table: department,
2048
+ name: "company",
2049
+ reftable: company,
2050
+ label: "Company",
2051
+ type: "Key",
2052
+ attributes: { summary_field: "name" },
2053
+ });
2054
+ await field_1.default.create({
2055
+ table: department,
2056
+ name: "manager",
2057
+ reftable: employee,
2058
+ label: "Manager",
2059
+ type: "Key",
2060
+ is_unique: true,
2061
+ attributes: { summary_field: "name" },
2062
+ });
2063
+ await field_1.default.create({
2064
+ table: department,
2065
+ name: "name",
2066
+ label: "Name",
2067
+ type: "String",
2068
+ required: true,
2069
+ });
2070
+ await field_1.default.create({
2071
+ table: employee,
2072
+ name: "name",
2073
+ label: "Name",
2074
+ type: "String",
2075
+ required: true,
2076
+ });
2077
+ await field_1.default.create({
2078
+ table: employee,
2079
+ name: "department",
2080
+ reftable: department,
2081
+ label: "Department",
2082
+ type: "Key",
2083
+ attributes: { summary_field: "name" },
2084
+ });
2085
+ await db.insert("company", {
2086
+ name: "my_company",
2087
+ });
2088
+ await db.insert("department", {
2089
+ name: "my_department",
2090
+ company: 1,
2091
+ });
2092
+ await db.insert("department", {
2093
+ name: "department_without_employees",
2094
+ company: 1,
2095
+ });
2096
+ await db.insert("employee", {
2097
+ name: "manager",
2098
+ department: 1,
2099
+ });
2100
+ await db.insert("employee", {
2101
+ name: "my_employee",
2102
+ department: 1,
2103
+ });
2104
+ await db.update("department", {
2105
+ manager: 1,
2106
+ }, 1);
2107
+ await view_1.default.create({
2108
+ table_id: employee.id,
2109
+ name: "show_manager",
2110
+ viewtemplate: "Show",
2111
+ configuration: {
2112
+ columns: [{ type: "Field", field_name: "name", state_field: "on" }],
2113
+ layout: {
2114
+ above: [{ type: "field", fieldview: "show", field_name: "name" }],
2115
+ },
2116
+ },
2117
+ min_role: 100,
2118
+ });
2119
+ await view_1.default.create({
2120
+ table_id: employee.id,
2121
+ name: "show_employee",
2122
+ viewtemplate: "Show",
2123
+ configuration: {
2124
+ columns: [{ type: "Field", field_name: "name", state_field: "on" }],
2125
+ layout: {
2126
+ above: [
2127
+ { type: "field", fieldview: "show", field_name: "name" },
2128
+ {
2129
+ type: "view",
2130
+ view: "show_manager",
2131
+ relation: ".employee.department.manager",
2132
+ name: "bc653",
2133
+ state: "shared",
2134
+ },
2135
+ ],
2014
2136
  },
2015
- min_role: 100,
2016
- });
2017
- await View.create({
2018
- table_id: pressing_job.id,
2019
- name: "show_pressing_job_with_new_indenpendent_relation_path",
2020
- viewtemplate: "Show",
2021
- configuration: {
2022
- columns: [{ type: "Field", field_name: "name", state_field: "on" }],
2023
- layout: {
2024
- above: [
2025
- { type: "field", fieldview: "show", field_name: "name" },
2026
- {
2027
- name: "a7603e",
2028
- type: "view",
2029
- view: "fan_club_feed",
2030
- relation: ".",
2031
- state: "shared",
2032
- configuration: {},
2033
- },
2034
- ],
2035
- },
2137
+ },
2138
+ min_role: 100,
2139
+ });
2140
+ await view_1.default.create({
2141
+ table_id: employee.id,
2142
+ name: "create_employee",
2143
+ viewtemplate: "Edit",
2144
+ configuration: {
2145
+ columns: [
2146
+ { type: "Field", field_name: "name", state_field: "on" },
2147
+ { type: "Field", field_name: "department", state_field: "on" },
2148
+ ],
2149
+ layout: {
2150
+ above: [
2151
+ { type: "field", fieldview: "edit", field_name: "name" },
2152
+ { type: "field", fieldview: "edit", field_name: "department" },
2153
+ ],
2036
2154
  },
2037
- min_role: 100,
2038
- });
2039
- const department = await Table.create("department");
2040
- const employee = await Table.create("employee");
2041
- const company = await Table.create("company");
2042
- await Field.create({
2043
- table: company,
2044
- name: "name",
2045
- label: "Name",
2046
- type: "String",
2047
- required: true,
2048
- });
2049
- await Field.create({
2050
- table: department,
2051
- name: "company",
2052
- reftable: company,
2053
- label: "Company",
2054
- type: "Key",
2055
- attributes: { summary_field: "name" },
2056
- });
2057
- await Field.create({
2058
- table: department,
2059
- name: "manager",
2060
- reftable: employee,
2061
- label: "Manager",
2062
- type: "Key",
2063
- is_unique: true,
2064
- attributes: { summary_field: "name" },
2065
- });
2066
- await Field.create({
2067
- table: department,
2068
- name: "name",
2069
- label: "Name",
2070
- type: "String",
2071
- required: true,
2072
- });
2073
- await Field.create({
2074
- table: employee,
2075
- name: "name",
2076
- label: "Name",
2077
- type: "String",
2078
- required: true,
2079
- });
2080
- await Field.create({
2081
- table: employee,
2082
- name: "department",
2083
- reftable: department,
2084
- label: "Department",
2085
- type: "Key",
2086
- attributes: { summary_field: "name" },
2087
- });
2088
- await db.insert("company", {
2089
- name: "my_company",
2090
- });
2091
- await db.insert("department", {
2092
- name: "my_department",
2093
- company: 1,
2094
- });
2095
- await db.insert("department", {
2096
- name: "department_without_employees",
2097
- company: 1,
2098
- });
2099
- await db.insert("employee", {
2100
- name: "manager",
2101
- department: 1,
2102
- });
2103
- await db.insert("employee", {
2104
- name: "my_employee",
2105
- department: 1,
2106
- });
2107
- await db.update("department", {
2108
- manager: 1,
2109
- }, 1);
2110
- await View.create({
2111
- table_id: employee.id,
2112
- name: "show_manager",
2113
- viewtemplate: "Show",
2114
- configuration: {
2115
- columns: [{ type: "Field", field_name: "name", state_field: "on" }],
2116
- layout: {
2117
- above: [{ type: "field", fieldview: "show", field_name: "name" }],
2155
+ },
2156
+ min_role: 100,
2157
+ });
2158
+ await view_1.default.create({
2159
+ table_id: employee.id,
2160
+ name: "list_employees",
2161
+ viewtemplate: "List",
2162
+ configuration: {
2163
+ columns: [
2164
+ {
2165
+ type: "JoinField",
2166
+ join_field: "department.name",
2118
2167
  },
2119
- },
2120
- min_role: 100,
2121
- });
2122
- await View.create({
2123
- table_id: employee.id,
2124
- name: "show_employee",
2125
- viewtemplate: "Show",
2126
- configuration: {
2127
- columns: [{ type: "Field", field_name: "name", state_field: "on" }],
2128
- layout: {
2129
- above: [
2130
- { type: "field", fieldview: "show", field_name: "name" },
2131
- {
2132
- type: "view",
2133
- view: "show_manager",
2134
- relation: ".employee.department.manager",
2135
- name: "bc653",
2136
- state: "shared",
2137
- },
2138
- ],
2168
+ {
2169
+ type: "Field",
2170
+ fieldview: "as_text",
2171
+ field_name: "name",
2139
2172
  },
2140
- },
2141
- min_role: 100,
2142
- });
2143
- await View.create({
2144
- table_id: employee.id,
2145
- name: "create_employee",
2146
- viewtemplate: "Edit",
2147
- configuration: {
2148
- columns: [
2149
- { type: "Field", field_name: "name", state_field: "on" },
2150
- { type: "Field", field_name: "department", state_field: "on" },
2151
- ],
2152
- layout: {
2153
- above: [
2154
- { type: "field", fieldview: "edit", field_name: "name" },
2155
- { type: "field", fieldview: "edit", field_name: "department" },
2156
- ],
2173
+ ],
2174
+ view_to_create: "create_employee",
2175
+ },
2176
+ min_role: 100,
2177
+ });
2178
+ await view_1.default.create({
2179
+ table_id: department.id,
2180
+ name: "show_department_with_employee_list",
2181
+ viewtemplate: "Show",
2182
+ configuration: {
2183
+ columns: [
2184
+ {
2185
+ type: "ViewLink",
2186
+ view: "list_employees",
2187
+ relation: ".department.employee$department",
2157
2188
  },
2158
- },
2159
- min_role: 100,
2160
- });
2161
- await View.create({
2162
- table_id: employee.id,
2163
- name: "list_employees",
2164
- viewtemplate: "List",
2165
- configuration: {
2166
- columns: [
2167
- {
2168
- type: "JoinField",
2169
- join_field: "department.name",
2170
- },
2189
+ ],
2190
+ layout: {
2191
+ above: [
2171
2192
  {
2172
- type: "Field",
2173
- fieldview: "as_text",
2174
- field_name: "name",
2193
+ type: "view_link",
2194
+ view: "list_employees",
2195
+ block: false,
2196
+ minRole: 100,
2197
+ relation: ".department.employee$department",
2198
+ isFormula: {},
2199
+ link_icon: "",
2200
+ view_label: "",
2175
2201
  },
2176
- ],
2177
- view_to_create: "create_employee",
2178
- },
2179
- min_role: 100,
2180
- });
2181
- await View.create({
2182
- table_id: department.id,
2183
- name: "show_department_with_employee_list",
2184
- viewtemplate: "Show",
2185
- configuration: {
2186
- columns: [
2187
2202
  {
2188
- type: "ViewLink",
2203
+ name: "af624e",
2204
+ type: "view",
2189
2205
  view: "list_employees",
2206
+ state: "shared",
2190
2207
  relation: ".department.employee$department",
2191
2208
  },
2192
2209
  ],
2193
- layout: {
2194
- above: [
2195
- {
2196
- type: "view_link",
2197
- view: "list_employees",
2198
- block: false,
2199
- minRole: 100,
2200
- relation: ".department.employee$department",
2201
- isFormula: {},
2202
- link_icon: "",
2203
- view_label: "",
2204
- },
2205
- {
2206
- name: "af624e",
2207
- type: "view",
2208
- view: "list_employees",
2209
- state: "shared",
2210
- relation: ".department.employee$department",
2211
- },
2212
- ],
2213
- },
2214
2210
  },
2215
- min_role: 100,
2216
- });
2217
- // edit in edit one layer
2218
- await View.create({
2219
- table_id: department.id,
2220
- name: "edit_department_with_edit_in_edit_legacy",
2221
- viewtemplate: "Edit",
2222
- configuration: {
2223
- columns: [
2211
+ },
2212
+ min_role: 100,
2213
+ });
2214
+ // edit in edit one layer
2215
+ await view_1.default.create({
2216
+ table_id: department.id,
2217
+ name: "edit_department_with_edit_in_edit_legacy",
2218
+ viewtemplate: "Edit",
2219
+ configuration: {
2220
+ columns: [
2221
+ {
2222
+ type: "Field",
2223
+ block: false,
2224
+ fieldview: "edit",
2225
+ textStyle: "",
2226
+ field_name: "name",
2227
+ configuration: {},
2228
+ },
2229
+ ],
2230
+ layout: {
2231
+ above: [
2224
2232
  {
2225
- type: "Field",
2233
+ type: "field",
2226
2234
  block: false,
2227
2235
  fieldview: "edit",
2228
2236
  textStyle: "",
2229
2237
  field_name: "name",
2230
2238
  configuration: {},
2231
2239
  },
2240
+ {
2241
+ name: "99fef8",
2242
+ type: "view",
2243
+ view: "ChildList:create_employee.employee.department",
2244
+ state: "shared",
2245
+ configuration: {},
2246
+ },
2232
2247
  ],
2233
- layout: {
2234
- above: [
2235
- {
2236
- type: "field",
2237
- block: false,
2238
- fieldview: "edit",
2239
- textStyle: "",
2240
- field_name: "name",
2241
- configuration: {},
2242
- },
2243
- {
2244
- name: "99fef8",
2245
- type: "view",
2246
- view: "ChildList:create_employee.employee.department",
2247
- state: "shared",
2248
- configuration: {},
2249
- },
2250
- ],
2251
- },
2252
2248
  },
2253
- min_role: 100,
2254
- });
2255
- await View.create({
2256
- table_id: department.id,
2257
- name: "edit_department_with_edit_in_edit_relation_path",
2258
- viewtemplate: "Edit",
2259
- configuration: {
2260
- columns: [
2249
+ },
2250
+ min_role: 100,
2251
+ });
2252
+ await view_1.default.create({
2253
+ table_id: department.id,
2254
+ name: "edit_department_with_edit_in_edit_relation_path",
2255
+ viewtemplate: "Edit",
2256
+ configuration: {
2257
+ columns: [
2258
+ {
2259
+ type: "Field",
2260
+ block: false,
2261
+ fieldview: "edit",
2262
+ textStyle: "",
2263
+ field_name: "name",
2264
+ configuration: {},
2265
+ },
2266
+ ],
2267
+ layout: {
2268
+ above: [
2261
2269
  {
2262
- type: "Field",
2270
+ type: "field",
2263
2271
  block: false,
2264
2272
  fieldview: "edit",
2265
2273
  textStyle: "",
2266
2274
  field_name: "name",
2267
2275
  configuration: {},
2268
2276
  },
2277
+ {
2278
+ name: "99fef8",
2279
+ type: "view",
2280
+ view: "create_employee",
2281
+ state: "shared",
2282
+ relation: ".department.employee$department",
2283
+ configuration: {},
2284
+ },
2269
2285
  ],
2270
- layout: {
2271
- above: [
2272
- {
2273
- type: "field",
2274
- block: false,
2275
- fieldview: "edit",
2276
- textStyle: "",
2277
- field_name: "name",
2278
- configuration: {},
2279
- },
2280
- {
2281
- name: "99fef8",
2282
- type: "view",
2283
- view: "create_employee",
2284
- state: "shared",
2285
- relation: ".department.employee$department",
2286
- configuration: {},
2287
- },
2288
- ],
2289
- },
2290
2286
  },
2291
- min_role: 100,
2292
- });
2293
- // two layers
2294
- await View.create({
2295
- table_id: covers.id,
2296
- name: "edit_cover_with_edit_artist_on_album_rel_path",
2297
- viewtemplate: "Edit",
2298
- configuration: {
2299
- layout: {
2300
- above: [
2301
- {
2302
- type: "field",
2303
- block: false,
2304
- fieldview: "edit",
2305
- textStyle: "",
2306
- field_name: "name",
2307
- configuration: {},
2308
- },
2309
- {
2310
- name: "dd8ee4",
2311
- type: "view",
2312
- view: "edit_artist_on_album",
2313
- state: "shared",
2314
- relation: ".covers.albums$cover.artist_plays_on_album$album",
2315
- },
2316
- {
2317
- type: "action",
2318
- block: false,
2319
- rndid: "55ac5b",
2320
- minRole: 100,
2321
- action_name: "Save",
2322
- action_style: "btn-primary",
2323
- configuration: {},
2324
- },
2325
- ],
2326
- },
2327
- columns: [
2287
+ },
2288
+ min_role: 100,
2289
+ });
2290
+ // two layers
2291
+ await view_1.default.create({
2292
+ table_id: covers.id,
2293
+ name: "edit_cover_with_edit_artist_on_album_rel_path",
2294
+ viewtemplate: "Edit",
2295
+ configuration: {
2296
+ layout: {
2297
+ above: [
2328
2298
  {
2329
- type: "Field",
2299
+ type: "field",
2330
2300
  block: false,
2331
2301
  fieldview: "edit",
2332
2302
  textStyle: "",
@@ -2334,7 +2304,15 @@ module.exports =
2334
2304
  configuration: {},
2335
2305
  },
2336
2306
  {
2337
- type: "Action",
2307
+ name: "dd8ee4",
2308
+ type: "view",
2309
+ view: "edit_artist_on_album",
2310
+ state: "shared",
2311
+ relation: ".covers.albums$cover.artist_plays_on_album$album",
2312
+ },
2313
+ {
2314
+ type: "action",
2315
+ block: false,
2338
2316
  rndid: "55ac5b",
2339
2317
  minRole: 100,
2340
2318
  action_name: "Save",
@@ -2343,43 +2321,36 @@ module.exports =
2343
2321
  },
2344
2322
  ],
2345
2323
  },
2346
- min_role: 100,
2347
- });
2348
- await View.create({
2349
- table_id: covers.id,
2350
- name: "edit_cover_with_edit_artist_on_album_legacy",
2351
- viewtemplate: "Edit",
2352
- configuration: {
2353
- layout: {
2354
- above: [
2355
- {
2356
- type: "field",
2357
- block: false,
2358
- fieldview: "edit",
2359
- textStyle: "",
2360
- field_name: "name",
2361
- configuration: {},
2362
- },
2363
- {
2364
- name: "dd8ee4",
2365
- type: "view",
2366
- view: "ChildList:edit_artist_on_album.artist_plays_on_album.album.albums.cover",
2367
- state: "shared",
2368
- },
2369
- {
2370
- type: "action",
2371
- block: false,
2372
- rndid: "55ac5b",
2373
- minRole: 100,
2374
- action_name: "Save",
2375
- action_style: "btn-primary",
2376
- configuration: {},
2377
- },
2378
- ],
2324
+ columns: [
2325
+ {
2326
+ type: "Field",
2327
+ block: false,
2328
+ fieldview: "edit",
2329
+ textStyle: "",
2330
+ field_name: "name",
2331
+ configuration: {},
2332
+ },
2333
+ {
2334
+ type: "Action",
2335
+ rndid: "55ac5b",
2336
+ minRole: 100,
2337
+ action_name: "Save",
2338
+ action_style: "btn-primary",
2339
+ configuration: {},
2379
2340
  },
2380
- columns: [
2341
+ ],
2342
+ },
2343
+ min_role: 100,
2344
+ });
2345
+ await view_1.default.create({
2346
+ table_id: covers.id,
2347
+ name: "edit_cover_with_edit_artist_on_album_legacy",
2348
+ viewtemplate: "Edit",
2349
+ configuration: {
2350
+ layout: {
2351
+ above: [
2381
2352
  {
2382
- type: "Field",
2353
+ type: "field",
2383
2354
  block: false,
2384
2355
  fieldview: "edit",
2385
2356
  textStyle: "",
@@ -2387,7 +2358,14 @@ module.exports =
2387
2358
  configuration: {},
2388
2359
  },
2389
2360
  {
2390
- type: "Action",
2361
+ name: "dd8ee4",
2362
+ type: "view",
2363
+ view: "ChildList:edit_artist_on_album.artist_plays_on_album.album.albums.cover",
2364
+ state: "shared",
2365
+ },
2366
+ {
2367
+ type: "action",
2368
+ block: false,
2391
2369
  rndid: "55ac5b",
2392
2370
  minRole: 100,
2393
2371
  action_name: "Save",
@@ -2396,205 +2374,211 @@ module.exports =
2396
2374
  },
2397
2375
  ],
2398
2376
  },
2399
- min_role: 100,
2400
- });
2401
- const group = await PageGroup.create({
2402
- name: "page_group",
2403
- min_role: 100,
2404
- });
2405
- for (const { pageName, eligible_formula } of [
2406
- {
2407
- pageName: "iPhone SE",
2408
- eligible_formula: "width < 380 && height < 670 && user.id === 1 && locale === 'en'",
2409
- },
2410
- {
2411
- pageName: "iPhone XR",
2412
- eligible_formula: "width < 415 && height < 900 && user.id === 1 && locale === 'en'",
2413
- },
2414
- {
2415
- pageName: "Surface Pro 7",
2416
- eligible_formula: "width < 915 && height < 1370 && user.id === 1 && locale === 'en'",
2417
- },
2418
- {
2419
- pageName: "Laptop",
2420
- eligible_formula: "width <= 1920 && height <= 1000 && user.id === 1 && locale === 'en'",
2421
- },
2422
- ]) {
2423
- const page = await Page.create({
2424
- name: pageName,
2425
- title: pageName,
2426
- description: `This is ${pageName}`,
2427
- min_role: 100,
2428
- layout: {
2429
- above: [
2430
- {
2431
- type: "blank",
2432
- block: false,
2433
- contents: `Hello I am ${pageName}`,
2434
- textStyle: "",
2435
- },
2436
- ],
2377
+ columns: [
2378
+ {
2379
+ type: "Field",
2380
+ block: false,
2381
+ fieldview: "edit",
2382
+ textStyle: "",
2383
+ field_name: "name",
2384
+ configuration: {},
2437
2385
  },
2438
- fixed_states: {},
2439
- });
2440
- await group.addMember({
2441
- page_id: page.id,
2442
- eligible_formula: eligible_formula,
2443
- });
2444
- }
2445
- await View.create({
2446
- table_id: employee.id,
2447
- name: "view_with_group_link",
2448
- viewtemplate: "Show",
2449
- configuration: {
2450
- columns: [],
2451
- layout: {
2452
- above: [
2453
- {
2454
- type: "link",
2455
- link_src: "Page Group",
2456
- url: "page/page_group",
2457
- text: "Page Group link",
2458
- block: false,
2459
- minRole: 100,
2460
- isFormula: {
2461
- url: false,
2462
- },
2463
- link_icon: "",
2464
- },
2465
- ],
2386
+ {
2387
+ type: "Action",
2388
+ rndid: "55ac5b",
2389
+ minRole: 100,
2390
+ action_name: "Save",
2391
+ action_style: "btn-primary",
2392
+ configuration: {},
2466
2393
  },
2467
- },
2394
+ ],
2395
+ },
2396
+ min_role: 100,
2397
+ });
2398
+ const group = await page_group_1.default.create({
2399
+ name: "page_group",
2400
+ min_role: 100,
2401
+ });
2402
+ for (const { pageName, eligible_formula } of [
2403
+ {
2404
+ pageName: "iPhone SE",
2405
+ eligible_formula: "width < 380 && height < 670 && user.id === 1 && locale === 'en'",
2406
+ },
2407
+ {
2408
+ pageName: "iPhone XR",
2409
+ eligible_formula: "width < 415 && height < 900 && user.id === 1 && locale === 'en'",
2410
+ },
2411
+ {
2412
+ pageName: "Surface Pro 7",
2413
+ eligible_formula: "width < 915 && height < 1370 && user.id === 1 && locale === 'en'",
2414
+ },
2415
+ {
2416
+ pageName: "Laptop",
2417
+ eligible_formula: "width <= 1920 && height <= 1000 && user.id === 1 && locale === 'en'",
2418
+ },
2419
+ ]) {
2420
+ const page = await page_1.default.create({
2421
+ name: pageName,
2422
+ title: pageName,
2423
+ description: `This is ${pageName}`,
2468
2424
  min_role: 100,
2469
- });
2470
- await Trigger.create({
2471
- name: "emit_to_admin",
2472
- action: "run_js_code",
2473
- description: "",
2474
- table_id: null,
2475
- run_where: "Server",
2476
- when_trigger: "API call",
2477
- configuration: {
2478
- code: `emit_to_client({notify: "hello admin"}, 1);`,
2479
- },
2480
- min_role: null,
2481
- });
2482
- await Trigger.create({
2483
- name: "emit_to_staff",
2484
- action: "run_js_code",
2485
- description: "",
2486
- table_id: null,
2487
- run_where: "Server",
2488
- when_trigger: "API call",
2489
- configuration: {
2490
- code: `emit_to_client({notify: "hello admin"}, 2);`,
2491
- },
2492
- min_role: null,
2493
- });
2494
- await Trigger.create({
2495
- name: "emit_to_admin_and_staff",
2496
- action: "run_js_code",
2497
- description: "",
2498
- table_id: null,
2499
- run_where: "Server",
2500
- when_trigger: "API call",
2501
- configuration: {
2502
- code: `emit_to_client({notify: "hello admin and staff"}, [1, 2]);`,
2503
- },
2504
- min_role: null,
2505
- });
2506
- await Trigger.create({
2507
- name: "emit_tenant_wide",
2508
- action: "run_js_code",
2509
- description: "",
2510
- table_id: null,
2511
- run_where: "Server",
2512
- when_trigger: "API call",
2513
- configuration: {
2514
- code: `emit_to_client({notify: "hello public"});`,
2515
- },
2516
- min_role: null,
2517
- });
2518
- await Trigger.create({
2519
- name: "custom_update_event",
2520
- action: "run_js_code",
2521
- description: "",
2522
- table_id: null,
2523
- when_trigger: "Never",
2524
- configuration: {
2525
- code: `console.log("Custom update event triggered");`,
2526
- run_where: "Client page",
2527
- },
2528
- min_role: null,
2529
- });
2530
- await Trigger.create({
2531
- name: "MySteps",
2532
- action: "Multi-step action",
2533
- description: "",
2534
- table_id: null,
2535
- when_trigger: "Never",
2536
- configuration: {
2537
- steps: [
2538
- {
2539
- step_only_if: "",
2540
- step_action_name: "Toast1",
2541
- },
2542
- {
2543
- code: "1;",
2544
- run_where: "Server",
2545
- step_only_if: "",
2546
- step_action_name: "run_js_code",
2547
- },
2548
- {
2549
- text: "note",
2550
- notify_type: "Notify",
2551
- step_only_if: "",
2552
- step_action_name: "toast",
2553
- },
2425
+ layout: {
2426
+ above: [
2554
2427
  {
2555
- text: "errrr",
2556
- notify_type: "Error",
2557
- step_only_if: "",
2558
- step_action_name: "toast",
2428
+ type: "blank",
2429
+ block: false,
2430
+ contents: `Hello I am ${pageName}`,
2431
+ textStyle: "",
2559
2432
  },
2560
2433
  ],
2561
2434
  },
2562
- min_role: null,
2563
- });
2564
- await Trigger.create({
2565
- name: "Toast1",
2566
- action: "toast",
2567
- description: "",
2568
- table_id: null,
2569
- when_trigger: "Never",
2570
- configuration: {
2571
- text: "fooo",
2572
- notify_type: "Success",
2573
- },
2574
- min_role: null,
2435
+ fixed_states: {},
2575
2436
  });
2576
- await View.create({
2577
- table_id: tracksOnAlbum.id,
2578
- name: "view_with_two_level_select",
2579
- viewtemplate: "Edit",
2580
- configuration: {
2581
- layout: {
2582
- above: [
2583
- {
2584
- type: "field",
2585
- block: false,
2586
- fieldview: "two_level_select",
2587
- textStyle: "",
2588
- field_name: "album",
2589
- configuration: {
2590
- relation: "cover",
2591
- },
2437
+ await group.addMember({
2438
+ page_id: page.id,
2439
+ eligible_formula: eligible_formula,
2440
+ });
2441
+ }
2442
+ await view_1.default.create({
2443
+ table_id: employee.id,
2444
+ name: "view_with_group_link",
2445
+ viewtemplate: "Show",
2446
+ configuration: {
2447
+ columns: [],
2448
+ layout: {
2449
+ above: [
2450
+ {
2451
+ type: "link",
2452
+ link_src: "Page Group",
2453
+ url: "page/page_group",
2454
+ text: "Page Group link",
2455
+ block: false,
2456
+ minRole: 100,
2457
+ isFormula: {
2458
+ url: false,
2592
2459
  },
2593
- ],
2460
+ link_icon: "",
2461
+ },
2462
+ ],
2463
+ },
2464
+ },
2465
+ min_role: 100,
2466
+ });
2467
+ await trigger_1.default.create({
2468
+ name: "emit_to_admin",
2469
+ action: "run_js_code",
2470
+ description: "",
2471
+ table_id: undefined,
2472
+ run_where: "Server",
2473
+ when_trigger: "API call",
2474
+ configuration: {
2475
+ code: `emit_to_client({notify: "hello admin"}, 1);`,
2476
+ },
2477
+ min_role: undefined,
2478
+ });
2479
+ await trigger_1.default.create({
2480
+ name: "emit_to_staff",
2481
+ action: "run_js_code",
2482
+ description: "",
2483
+ table_id: undefined,
2484
+ run_where: "Server",
2485
+ when_trigger: "API call",
2486
+ configuration: {
2487
+ code: `emit_to_client({notify: "hello admin"}, 2);`,
2488
+ },
2489
+ min_role: undefined,
2490
+ });
2491
+ await trigger_1.default.create({
2492
+ name: "emit_to_admin_and_staff",
2493
+ action: "run_js_code",
2494
+ description: "",
2495
+ table_id: undefined,
2496
+ run_where: "Server",
2497
+ when_trigger: "API call",
2498
+ configuration: {
2499
+ code: `emit_to_client({notify: "hello admin and staff"}, [1, 2]);`,
2500
+ },
2501
+ min_role: undefined,
2502
+ });
2503
+ await trigger_1.default.create({
2504
+ name: "emit_tenant_wide",
2505
+ action: "run_js_code",
2506
+ description: "",
2507
+ table_id: undefined,
2508
+ run_where: "Server",
2509
+ when_trigger: "API call",
2510
+ configuration: {
2511
+ code: `emit_to_client({notify: "hello public"});`,
2512
+ },
2513
+ min_role: undefined,
2514
+ });
2515
+ await trigger_1.default.create({
2516
+ name: "custom_update_event",
2517
+ action: "run_js_code",
2518
+ description: "",
2519
+ table_id: undefined,
2520
+ when_trigger: "Never",
2521
+ configuration: {
2522
+ code: `console.log("Custom update event triggered");`,
2523
+ run_where: "Client page",
2524
+ },
2525
+ min_role: undefined,
2526
+ });
2527
+ await trigger_1.default.create({
2528
+ name: "MySteps",
2529
+ action: "Multi-step action",
2530
+ description: "",
2531
+ table_id: undefined,
2532
+ when_trigger: "Never",
2533
+ configuration: {
2534
+ steps: [
2535
+ {
2536
+ step_only_if: "",
2537
+ step_action_name: "Toast1",
2538
+ },
2539
+ {
2540
+ code: "1;",
2541
+ run_where: "Server",
2542
+ step_only_if: "",
2543
+ step_action_name: "run_js_code",
2594
2544
  },
2595
- columns: [
2545
+ {
2546
+ text: "note",
2547
+ notify_type: "Notify",
2548
+ step_only_if: "",
2549
+ step_action_name: "toast",
2550
+ },
2551
+ {
2552
+ text: "errrr",
2553
+ notify_type: "Error",
2554
+ step_only_if: "",
2555
+ step_action_name: "toast",
2556
+ },
2557
+ ],
2558
+ },
2559
+ min_role: undefined,
2560
+ });
2561
+ await trigger_1.default.create({
2562
+ name: "Toast1",
2563
+ action: "toast",
2564
+ description: "",
2565
+ table_id: undefined,
2566
+ when_trigger: "Never",
2567
+ configuration: {
2568
+ text: "fooo",
2569
+ notify_type: "Success",
2570
+ },
2571
+ min_role: undefined,
2572
+ });
2573
+ await view_1.default.create({
2574
+ table_id: tracksOnAlbum.id,
2575
+ name: "view_with_two_level_select",
2576
+ viewtemplate: "Edit",
2577
+ configuration: {
2578
+ layout: {
2579
+ above: [
2596
2580
  {
2597
- type: "Field",
2581
+ type: "field",
2598
2582
  block: false,
2599
2583
  fieldview: "two_level_select",
2600
2584
  textStyle: "",
@@ -2605,7 +2589,20 @@ module.exports =
2605
2589
  },
2606
2590
  ],
2607
2591
  },
2608
- min_role: 100,
2609
- });
2610
- };
2592
+ columns: [
2593
+ {
2594
+ type: "Field",
2595
+ block: false,
2596
+ fieldview: "two_level_select",
2597
+ textStyle: "",
2598
+ field_name: "album",
2599
+ configuration: {
2600
+ relation: "cover",
2601
+ },
2602
+ },
2603
+ ],
2604
+ },
2605
+ min_role: 100,
2606
+ });
2607
+ };
2611
2608
  //# sourceMappingURL=fixtures.js.map