@saltcorn/data 1.3.1-beta.11 → 1.3.1-beta.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/base-plugin/index.d.ts +6 -4
- package/dist/base-plugin/index.d.ts.map +1 -1
- package/dist/base-plugin/types.d.ts +2 -1
- package/dist/base-plugin/types.d.ts.map +1 -1
- package/dist/base-plugin/viewtemplates/edit.d.ts +5 -3
- package/dist/base-plugin/viewtemplates/edit.d.ts.map +1 -1
- package/dist/base-plugin/viewtemplates/edit.js +53 -13
- package/dist/base-plugin/viewtemplates/edit.js.map +1 -1
- package/dist/base-plugin/viewtemplates/filter.js +1 -1
- package/dist/base-plugin/viewtemplates/filter.js.map +1 -1
- package/dist/base-plugin/viewtemplates/list.d.ts.map +1 -1
- package/dist/base-plugin/viewtemplates/list.js +1 -1
- package/dist/base-plugin/viewtemplates/list.js.map +1 -1
- package/dist/db/fixtures.d.ts.map +1 -1
- package/dist/db/fixtures.js +13 -0
- package/dist/db/fixtures.js.map +1 -1
- package/dist/db/state.d.ts +2 -0
- package/dist/db/state.d.ts.map +1 -1
- package/dist/db/state.js +18 -0
- package/dist/db/state.js.map +1 -1
- package/dist/models/config.d.ts.map +1 -1
- package/dist/models/config.js +7 -0
- package/dist/models/config.js.map +1 -1
- package/dist/models/discovery.d.ts +2 -2
- package/dist/models/discovery.d.ts.map +1 -1
- package/dist/models/discovery.js +10 -8
- package/dist/models/discovery.js.map +1 -1
- package/dist/models/index.d.ts +1 -1
- package/dist/models/index.d.ts.map +1 -1
- package/dist/models/internal/query.d.ts +19 -1
- package/dist/models/internal/query.d.ts.map +1 -1
- package/dist/models/internal/query.js +44 -1
- package/dist/models/internal/query.js.map +1 -1
- package/dist/models/table.d.ts.map +1 -1
- package/dist/models/table.js +2 -41
- package/dist/models/table.js.map +1 -1
- package/dist/models/trigger.d.ts.map +1 -1
- package/dist/models/trigger.js +4 -0
- package/dist/models/trigger.js.map +1 -1
- package/dist/plugin-helper.d.ts +8 -0
- package/dist/plugin-helper.d.ts.map +1 -1
- package/dist/plugin-helper.js +59 -5
- package/dist/plugin-helper.js.map +1 -1
- package/dist/tests/auxtest.test.js +12 -1
- package/dist/tests/auxtest.test.js.map +1 -1
- package/dist/tests/exact_views.test.js +172 -4
- package/dist/tests/exact_views.test.js.map +1 -1
- package/dist/tests/workflow.test.js +3 -0
- package/dist/tests/workflow.test.js.map +1 -1
- package/package.json +8 -8
|
@@ -935,7 +935,7 @@ export const types: ({
|
|
|
935
935
|
presets: {
|
|
936
936
|
Now: ({ field }: {
|
|
937
937
|
field: any;
|
|
938
|
-
}) =>
|
|
938
|
+
}) => Date | import("@saltcorn/plain-date");
|
|
939
939
|
};
|
|
940
940
|
read: (v0: any, attrs: object) => object;
|
|
941
941
|
validate: () => boolean;
|
|
@@ -1095,7 +1095,7 @@ export const viewtemplates: ({
|
|
|
1095
1095
|
}, { editQuery }: {
|
|
1096
1096
|
editQuery: any;
|
|
1097
1097
|
}) => Promise<import("../models/form")>;
|
|
1098
|
-
runMany: (table_id: number, viewname: string, { columns, layout, auto_save, split_paste, confirm_leave }: {
|
|
1098
|
+
runMany: (table_id: number, viewname: string, { columns, layout, auto_save, split_paste, confirm_leave, enable_realtime, update_events, }: {
|
|
1099
1099
|
columns: any;
|
|
1100
1100
|
layout: any;
|
|
1101
1101
|
}, state: State, extra: object, { editManyQuery, getRowQuery, optionsQuery }: {
|
|
@@ -1142,8 +1142,9 @@ export const viewtemplates: ({
|
|
|
1142
1142
|
}, { authorizePostQuery }: {
|
|
1143
1143
|
authorizePostQuery: any;
|
|
1144
1144
|
}) => Promise<boolean>;
|
|
1145
|
-
virtual_triggers: (table_id: any, viewname: any, { enable_realtime }: {
|
|
1145
|
+
virtual_triggers: (table_id: any, viewname: any, { enable_realtime, update_events }: {
|
|
1146
1146
|
enable_realtime: any;
|
|
1147
|
+
update_events: any;
|
|
1147
1148
|
}) => {
|
|
1148
1149
|
when_trigger: string;
|
|
1149
1150
|
table_id: any;
|
|
@@ -1161,7 +1162,7 @@ export const viewtemplates: ({
|
|
|
1161
1162
|
getStringsForI18n({ layout }: {
|
|
1162
1163
|
layout: Layout;
|
|
1163
1164
|
}): string[];
|
|
1164
|
-
queries: ({ table_id, name, configuration: { columns, default_state, layout, auto_save, split_paste, destination_type, fixed, confirm_leave, auto_create, delete_unchanged_auto_create, enable_realtime, }, req, res, }: {
|
|
1165
|
+
queries: ({ table_id, name, configuration: { columns, default_state, layout, auto_save, split_paste, destination_type, fixed, confirm_leave, auto_create, delete_unchanged_auto_create, enable_realtime, update_events, }, req, res, }: {
|
|
1165
1166
|
table_id: any;
|
|
1166
1167
|
name: any;
|
|
1167
1168
|
configuration: {
|
|
@@ -1176,6 +1177,7 @@ export const viewtemplates: ({
|
|
|
1176
1177
|
auto_create: any;
|
|
1177
1178
|
delete_unchanged_auto_create: any;
|
|
1178
1179
|
enable_realtime: any;
|
|
1180
|
+
update_events: any;
|
|
1179
1181
|
};
|
|
1180
1182
|
req: any;
|
|
1181
1183
|
res: any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../base-plugin/index.js"],"names":[],"mappings":"AAwCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KASE;;;;0CAGW,MAAM"}
|
|
@@ -789,7 +789,7 @@ export namespace date {
|
|
|
789
789
|
export namespace presets_1 {
|
|
790
790
|
function Now({ field }: {
|
|
791
791
|
field: any;
|
|
792
|
-
}):
|
|
792
|
+
}): Date | PlainDate;
|
|
793
793
|
}
|
|
794
794
|
export { presets_1 as presets };
|
|
795
795
|
export function read_3(v0: any, attrs: object): object;
|
|
@@ -1008,5 +1008,6 @@ declare namespace to_locale_string {
|
|
|
1008
1008
|
export function run_45(v: any, req: any, attrs?: {}): string;
|
|
1009
1009
|
export { run_45 as run };
|
|
1010
1010
|
}
|
|
1011
|
+
import PlainDate = require("@saltcorn/plain-date");
|
|
1011
1012
|
export {};
|
|
1012
1013
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../base-plugin/types.js"],"names":[],"mappings":";cA+tBa,MAAM;;kBAGN,MAAM;;IAQL,+CAsFX;IAMS;;gBAKiE;;;;;;YAelE,oCAAyB;;;;;;;YAKzB,sCACiE;;;;;;;;YAKjE,sCAA+C;;;;;;;;;;;;;;;;;;;YAc/C,4DA8CJ;;;;;;;;;;;;;;;YAcI,4DAIJ;;;;;;;;;;;;;;;;;;;;YAuBI,4DASG;;;;;;;;YAUH,4DAAmE;;;;;;;;YAWnE,sCAA6B;;;;;;;;;;YAapB;;;;;;;;;;;;;;;;;;;;;iBAmDb;;YACI,gGAqGO;;;;;;;;;;;;;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AOG,uDAiCL;;IAKS,sCAA2C;;IAO7C,gDAQP;;;gBAraU,MAAM;;;;oBAGN,MAAM;;;;IAUP;;;iBAAmD;;;;;;;;;;;;;;;;;YAkBpD,uCAAc;;;;;;;;;;;;;;;;;YAkBd,iGAoBD;;;;;;;;;;;;;;;;;;;YAl/CH,wHAaD;;;;;;;;;;sBAg/CO,MAAM,EAAE;;IAgBb,+DAYL;;IAMC,mEAKC;;IASK;;gBAEP;;;;gBAxNU,MAAM;;;;oBAGN,MAAM;;;;IAOP,uCAAY;;;;;;;;YAeb,uCAMG;;;;;;;;;;;;YAYH,iGAWD;;;;;;sBAGG,MAAM,EAAE;;IAMb,0CAOL;;IAIS,sCAET;;;;;;;;;;;;;;;;;;;IAvlDI,6DAUJ;;;;;;IAmSa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAoHb;;;;IAEI,6DAoBJ"}
|
|
@@ -31,7 +31,7 @@ export function run(table_id: number, viewname: string, cfg: any, state: string,
|
|
|
31
31
|
* @param {object} extra
|
|
32
32
|
* @returns {Promise<Form[]>}
|
|
33
33
|
*/
|
|
34
|
-
export function runMany(table_id: number, viewname: string, { columns, layout, auto_save, split_paste, confirm_leave }: {
|
|
34
|
+
export function runMany(table_id: number, viewname: string, { columns, layout, auto_save, split_paste, confirm_leave, enable_realtime, update_events, }: {
|
|
35
35
|
columns: any;
|
|
36
36
|
layout: any;
|
|
37
37
|
}, state: State, extra: object, { editManyQuery, getRowQuery, optionsQuery }: {
|
|
@@ -110,8 +110,9 @@ export function authorise_post({ body, table_id, req }: {
|
|
|
110
110
|
}, { authorizePostQuery }: {
|
|
111
111
|
authorizePostQuery: any;
|
|
112
112
|
}): Promise<boolean>;
|
|
113
|
-
export function virtual_triggers(table_id: any, viewname: any, { enable_realtime }: {
|
|
113
|
+
export function virtual_triggers(table_id: any, viewname: any, { enable_realtime, update_events }: {
|
|
114
114
|
enable_realtime: any;
|
|
115
|
+
update_events: any;
|
|
115
116
|
}): {
|
|
116
117
|
when_trigger: string;
|
|
117
118
|
table_id: any;
|
|
@@ -184,7 +185,7 @@ export declare function authorise_get({ query, table_id, req }: {
|
|
|
184
185
|
export declare function getStringsForI18n({ layout }: {
|
|
185
186
|
layout: Layout;
|
|
186
187
|
}): string[];
|
|
187
|
-
export declare function queries({ table_id, name, configuration: { columns, default_state, layout, auto_save, split_paste, destination_type, fixed, confirm_leave, auto_create, delete_unchanged_auto_create, enable_realtime, }, req, res, }: {
|
|
188
|
+
export declare function queries({ table_id, name, configuration: { columns, default_state, layout, auto_save, split_paste, destination_type, fixed, confirm_leave, auto_create, delete_unchanged_auto_create, enable_realtime, update_events, }, req, res, }: {
|
|
188
189
|
table_id: any;
|
|
189
190
|
name: any;
|
|
190
191
|
configuration: {
|
|
@@ -199,6 +200,7 @@ export declare function queries({ table_id, name, configuration: { columns, defa
|
|
|
199
200
|
auto_create: any;
|
|
200
201
|
delete_unchanged_auto_create: any;
|
|
201
202
|
enable_realtime: any;
|
|
203
|
+
update_events: any;
|
|
202
204
|
};
|
|
203
205
|
req: any;
|
|
204
206
|
res: any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../base-plugin/viewtemplates/edit.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../base-plugin/viewtemplates/edit.js"],"names":[],"mappings":"AA+FA;;;GAGG;AAEH,4CAJW,MAAM,GACJ,QAAQ,CA4YjB;AA+CJ;;;;;;;;;;;GAWG;AACH,8BAXW,MAAM,YACN,MAAM,mBAIN,MAAM;IAEU,GAAG,EAAnB,MAAM;IACU,GAAG,EAAnB,MAAM;;;IACJ,QAAQ,IAAI,CAAC,CAYzB;AAED;;;;;;;;;GASG;AACH,kCATW,MAAM,YACN,MAAM;IAEE,OAAO;IACP,MAAM;wBAEd,MAAM;;;;IACJ,QAAQ,IAAI,EAAE,CAAC,CAoD3B;AAwsBD;;;;;;;;;;;;;;;;GAgBG;AACH,kCAhBW,MAAM,YACN,MAAM;IAEY,OAAO,EAAzB,MAAM,EAAE;IACQ,MAAM;IACN,KAAK,EAArB,MAAM;IACW,cAAc,EAA/B,OAAO;IACW,oBAAoB,EAAtC,MAAM,EAAE;UACR,MAAM;IAGU,GAAG,EAAnB,MAAM;IACU,GAAG,EAAnB,MAAM;IACU,QAAQ,EAAxB,MAAM;;;;;;;;;iBACJ,QAAQ,IAAI,CAAC,CAmUzB;AA0FD,mKA6BC;AAGD,sHA6BC;AAlzCD;;;;;;GAMG;AACH;IAHmB,OAAO;IACb,QAAQ,MAAM,EAAE,CAAC,CAQ7B;AA6BD,uBAAuB;AACvB,sCAAuD;AA8uDvD;;;;;;iBAwGC;AA1pBD;;;;;;GAMG;AACH;IALwB,IAAI,EAAjB,MAAM;IACO,QAAQ,EAArB,MAAM;IACO,GAAG,EAAhB,MAAM;;;IACJ,QAAQ,OAAO,CAAC,CAO5B;AAgpBD;;;;;;;;;;IAmEC;;;;AAlpBD;;;;;;;;;;;GAWG;AACH,sCAXW,MAAM;IAGS,OAAO,EAAtB,MAAM,EAAE;IACA,MAAM;;IAGE,GAAG,EAAnB,MAAM;IACK,GAAG;;;IACZ,QAAQ,MAAM,CAAC,CAe3B;AAED;;;;;;;;;;;;;;;;;;;;;;kBA0GC;;yBAghBY,MAAM;gCAEN,MAAM;AAmBF;;;;;qBAEd;AACD;;;;GAIG;AACH;;aAEC;AACQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqcP;;;;;AAEF,yGAkBC;AACY;;;GA2DZ;AACiB,6HAEjB"}
|
|
@@ -23,7 +23,7 @@ const { get_expression_function, expressionChecker, eval_expression, freeVariabl
|
|
|
23
23
|
const { InvalidConfiguration, isNode, isWeb, isTest, mergeIntoWhere, dollarizeObject, getSessionId, interpolate, asyncMap, removeEmptyStrings, } = require("../../utils");
|
|
24
24
|
const Library = require("../../models/library");
|
|
25
25
|
const { check_view_columns } = require("../../plugin-testing");
|
|
26
|
-
const { initial_config_all_fields, calcfldViewOptions, calcfldViewConfig, get_parent_views, picked_fields_to_query, stateFieldsToWhere, stateFieldsToQuery, getActionConfigFields, run_action_column, add_free_variables_to_joinfields, readState, stateToQueryString, pathToState, displayType, } = require("../../plugin-helper");
|
|
26
|
+
const { initial_config_all_fields, calcfldViewOptions, calcfldViewConfig, get_parent_views, picked_fields_to_query, stateFieldsToWhere, stateFieldsToQuery, getActionConfigFields, run_action_column, add_free_variables_to_joinfields, readState, stateToQueryString, pathToState, displayType, runCollabEvents, } = require("../../plugin-helper");
|
|
27
27
|
const { splitUniques, getForm, fill_presets, parse_view_select, get_view_link_query, objToQueryString, action_url, action_link, view_linker, edit_build_in_actions, } = require("./viewable_fields");
|
|
28
28
|
const { traverse, getStringsForI18n, translateLayout, traverseSync, splitLayoutContainerFields, findLayoutBranchWith, } = require("../../models/layout");
|
|
29
29
|
const { extractFromLayout } = require("../../diagram/node_extract_utils");
|
|
@@ -239,6 +239,7 @@ const configuration_workflow = (req) => new Workflow({
|
|
|
239
239
|
}));
|
|
240
240
|
const pages = await Page.find();
|
|
241
241
|
const groups = await PageGroup.find();
|
|
242
|
+
const triggers = Trigger.find();
|
|
242
243
|
return new Form({
|
|
243
244
|
fields: [
|
|
244
245
|
{
|
|
@@ -280,6 +281,21 @@ const configuration_workflow = (req) => new Workflow({
|
|
|
280
281
|
type: "Bool",
|
|
281
282
|
default: false,
|
|
282
283
|
},
|
|
284
|
+
new FieldRepeat({
|
|
285
|
+
name: "update_events",
|
|
286
|
+
showIf: { enable_realtime: true },
|
|
287
|
+
fields: [
|
|
288
|
+
{
|
|
289
|
+
type: "String",
|
|
290
|
+
name: "event",
|
|
291
|
+
label: req.__("Update event"),
|
|
292
|
+
sublabel: req.__("Custom event for real-time updates"),
|
|
293
|
+
attributes: {
|
|
294
|
+
options: triggers.map((t) => t.name),
|
|
295
|
+
},
|
|
296
|
+
},
|
|
297
|
+
],
|
|
298
|
+
}),
|
|
283
299
|
{
|
|
284
300
|
name: "destination_type",
|
|
285
301
|
label: "Destination type",
|
|
@@ -432,7 +448,7 @@ const run = async (table_id, viewname, cfg, state, { res, req, isPreview, hidden
|
|
|
432
448
|
* @param {object} extra
|
|
433
449
|
* @returns {Promise<Form[]>}
|
|
434
450
|
*/
|
|
435
|
-
const runMany = async (table_id, viewname, { columns, layout, auto_save, split_paste, confirm_leave }, state, extra, { editManyQuery, getRowQuery, optionsQuery }) => {
|
|
451
|
+
const runMany = async (table_id, viewname, { columns, layout, auto_save, split_paste, confirm_leave, enable_realtime, update_events, }, state, extra, { editManyQuery, getRowQuery, optionsQuery }) => {
|
|
436
452
|
let { table, fields, rows } = await editManyQuery(state, {
|
|
437
453
|
limit: extra.limit,
|
|
438
454
|
offset: extra.offset,
|
|
@@ -462,6 +478,8 @@ const runMany = async (table_id, viewname, { columns, layout, auto_save, split_p
|
|
|
462
478
|
split_paste,
|
|
463
479
|
isRemote,
|
|
464
480
|
confirm_leave,
|
|
481
|
+
enable_realtime,
|
|
482
|
+
update_events,
|
|
465
483
|
});
|
|
466
484
|
return { html, row };
|
|
467
485
|
});
|
|
@@ -767,22 +785,33 @@ const transformForm = async ({ form, table, req, row, res, getRowQuery, viewname
|
|
|
767
785
|
form.xhrSubmit = true;
|
|
768
786
|
setDateLocales(form, req.getLocale());
|
|
769
787
|
};
|
|
770
|
-
const realTimeScript = (viewname, table_id, row) => {
|
|
788
|
+
const realTimeScript = (viewname, table_id, row, scriptId) => {
|
|
771
789
|
const view = View.findOne({ name: viewname });
|
|
772
790
|
const table = Table.findOne({ id: table_id });
|
|
773
791
|
const rowId = row[table.pk_name];
|
|
774
792
|
return `
|
|
775
793
|
const collabCfg = {
|
|
776
794
|
events: {
|
|
777
|
-
'${view.getRealTimeEventName(`UPDATE_EVENT?id=${rowId}`)}': (data) => {
|
|
795
|
+
'${view.getRealTimeEventName(`UPDATE_EVENT?id=${rowId}`)}': async (data) => {
|
|
778
796
|
console.log("Update event received for view ${viewname}", data);
|
|
797
|
+
const script = document.getElementById('${scriptId}');
|
|
798
|
+
const closestDiv = script?.closest(
|
|
799
|
+
'div[data-sc-embed-viewname="${viewname}"]'
|
|
800
|
+
);
|
|
779
801
|
if (data.updates) {
|
|
780
|
-
common_done({set_fields: data.updates, no_onchange: true},
|
|
802
|
+
if (closestDiv) await common_done({set_fields: data.updates, no_onchange: true}, closestDiv);
|
|
803
|
+
else await common_done({set_fields: data.updates, no_onchange: true}, "${viewname}");
|
|
804
|
+
}
|
|
805
|
+
if (data.actions) {
|
|
806
|
+
for (const action of data.actions) {
|
|
807
|
+
if (closestDiv) await common_done(action, closestDiv);
|
|
808
|
+
else await common_done(action, "${viewname}");
|
|
809
|
+
}
|
|
781
810
|
}
|
|
782
811
|
}
|
|
783
812
|
}
|
|
784
813
|
};
|
|
785
|
-
init_collab_room('${viewname}', collabCfg)
|
|
814
|
+
init_collab_room('${viewname}', collabCfg);`.trim();
|
|
786
815
|
};
|
|
787
816
|
/**
|
|
788
817
|
* @param {object} opts
|
|
@@ -943,12 +972,16 @@ const render = async ({ table, fields, viewname, columns, layout, row, req, stat
|
|
|
943
972
|
: `form${Math.floor(Math.random() * 16777215).toString(16)}`;
|
|
944
973
|
const identicalFieldsScript = script(domReady(`const editForm = document.getElementById('${formId}'); if (editForm) editForm.addEventListener("change", handle_identical_fields, true);`));
|
|
945
974
|
const dynamic_updates_enabled = getState().getConfig("enable_dynamic_updates", true);
|
|
975
|
+
const rndid = isTest()
|
|
976
|
+
? "test-script-id"
|
|
977
|
+
: Math.floor(Math.random() * 16777215).toString(16);
|
|
946
978
|
const realTimeCollabScript = enable_realtime && row && !(req.headers?.pjaxpageload === "true")
|
|
947
979
|
? (!dynamic_updates_enabled
|
|
948
980
|
? script({
|
|
949
981
|
src: `/static_assets/${db.connectObj.version_tag}/socket.io.min.js`,
|
|
950
982
|
})
|
|
951
|
-
: "") +
|
|
983
|
+
: "") +
|
|
984
|
+
script({ id: rndid }, domReady(realTimeScript(viewname, table.id, row, rndid)))
|
|
952
985
|
: "";
|
|
953
986
|
if (actually_auto_save) {
|
|
954
987
|
for (const field of form.fields) {
|
|
@@ -1763,7 +1796,7 @@ const createBasicView = async ({ table, viewname, template_view, template_table,
|
|
|
1763
1796
|
cfg.split_paste = template_view.configuration.split_paste;
|
|
1764
1797
|
return cfg;
|
|
1765
1798
|
};
|
|
1766
|
-
const virtual_triggers = (table_id, viewname, { enable_realtime }) => {
|
|
1799
|
+
const virtual_triggers = (table_id, viewname, { enable_realtime, update_events }) => {
|
|
1767
1800
|
if (!enable_realtime)
|
|
1768
1801
|
return [];
|
|
1769
1802
|
const table = Table.findOne({ id: table_id });
|
|
@@ -1799,15 +1832,21 @@ const virtual_triggers = (table_id, viewname, { enable_realtime }) => {
|
|
|
1799
1832
|
}
|
|
1800
1833
|
else {
|
|
1801
1834
|
// build and emit updates
|
|
1802
|
-
const
|
|
1835
|
+
const updates = {};
|
|
1803
1836
|
for (const fieldName of changedLayoutFields) {
|
|
1804
1837
|
const newVal = row[fieldName];
|
|
1805
|
-
|
|
1838
|
+
updates[fieldName] = newVal;
|
|
1806
1839
|
}
|
|
1807
1840
|
const rowId = row[table.pk_name];
|
|
1808
|
-
|
|
1841
|
+
const actionResults = await runCollabEvents(update_events, user, {
|
|
1842
|
+
new_row: row,
|
|
1843
|
+
old_row: old_row,
|
|
1844
|
+
updates: updates,
|
|
1845
|
+
});
|
|
1846
|
+
getState().log(6, "Emitting real-time update for row", rowId, updates);
|
|
1809
1847
|
view.emitRealTimeEvent(`UPDATE_EVENT?id=${rowId}`, {
|
|
1810
|
-
updates:
|
|
1848
|
+
updates: updates,
|
|
1849
|
+
actions: actionResults,
|
|
1811
1850
|
});
|
|
1812
1851
|
}
|
|
1813
1852
|
},
|
|
@@ -1847,7 +1886,7 @@ module.exports = {
|
|
|
1847
1886
|
getStringsForI18n({ layout }) {
|
|
1848
1887
|
return getStringsForI18n(layout);
|
|
1849
1888
|
},
|
|
1850
|
-
queries: ({ table_id, name, configuration: { columns, default_state, layout, auto_save, split_paste, destination_type, fixed, confirm_leave, auto_create, delete_unchanged_auto_create, enable_realtime, }, req, res, }) => ({
|
|
1889
|
+
queries: ({ table_id, name, configuration: { columns, default_state, layout, auto_save, split_paste, destination_type, fixed, confirm_leave, auto_create, delete_unchanged_auto_create, enable_realtime, update_events, }, req, res, }) => ({
|
|
1851
1890
|
async editQuery(state, mobileReferrer, isPreview, hiddenLoginDest) {
|
|
1852
1891
|
const table = Table.findOne({ id: table_id });
|
|
1853
1892
|
const fields = table.getFields();
|
|
@@ -1929,6 +1968,7 @@ module.exports = {
|
|
|
1929
1968
|
auto_created_row,
|
|
1930
1969
|
hiddenLoginDest,
|
|
1931
1970
|
enable_realtime,
|
|
1971
|
+
update_events,
|
|
1932
1972
|
});
|
|
1933
1973
|
},
|
|
1934
1974
|
async editManyQuery(state, { limit, offset, orderBy, orderDesc, where }) {
|