@saltcorn/server 0.8.6-beta.15 → 0.8.6-beta.16

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/load_plugins.js CHANGED
@@ -209,13 +209,14 @@ const loadAndSaveNewPlugin = async (plugin, force, noSignalOrDB) => {
209
209
  }
210
210
  }
211
211
  if (version) plugin.version = version;
212
- if (!noSignalOrDB) await plugin.upsert();
213
- if (!noSignalOrDB && process.send)
214
- process.send({
212
+ if (!noSignalOrDB) {
213
+ await plugin.upsert();
214
+ getState().processSend({
215
215
  installPlugin: plugin,
216
216
  tenant: db.getTenantSchema(),
217
217
  force,
218
218
  });
219
+ }
219
220
  };
220
221
 
221
222
  module.exports = {
package/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "@saltcorn/server",
3
- "version": "0.8.6-beta.15",
3
+ "version": "0.8.6-beta.16",
4
4
  "description": "Server app for Saltcorn, open-source no-code platform",
5
5
  "homepage": "https://saltcorn.com",
6
6
  "main": "index.js",
7
7
  "license": "MIT",
8
8
  "dependencies": {
9
- "@saltcorn/base-plugin": "0.8.6-beta.15",
10
- "@saltcorn/builder": "0.8.6-beta.15",
11
- "@saltcorn/data": "0.8.6-beta.15",
12
- "@saltcorn/admin-models": "0.8.6-beta.15",
13
- "@saltcorn/filemanager": "0.8.6-beta.15",
14
- "@saltcorn/markup": "0.8.6-beta.15",
15
- "@saltcorn/sbadmin2": "0.8.6-beta.15",
9
+ "@saltcorn/base-plugin": "0.8.6-beta.16",
10
+ "@saltcorn/builder": "0.8.6-beta.16",
11
+ "@saltcorn/data": "0.8.6-beta.16",
12
+ "@saltcorn/admin-models": "0.8.6-beta.16",
13
+ "@saltcorn/filemanager": "0.8.6-beta.16",
14
+ "@saltcorn/markup": "0.8.6-beta.16",
15
+ "@saltcorn/sbadmin2": "0.8.6-beta.16",
16
16
  "@socket.io/cluster-adapter": "^0.2.1",
17
17
  "@socket.io/sticky": "^1.0.1",
18
18
  "adm-zip": "0.5.10",
package/routes/actions.js CHANGED
@@ -171,6 +171,13 @@ const triggerForm = async (req, trigger) => {
171
171
  required: true,
172
172
  options: Trigger.when_options.map((t) => ({ value: t, label: t })),
173
173
  sublabel: req.__("Event type which runs the trigger"),
174
+ attributes: {
175
+ explainers: {
176
+ Often: "Every 5 minutes",
177
+ Never:
178
+ "Not scheduled but can be run as an action from a button click",
179
+ },
180
+ },
174
181
  },
175
182
  {
176
183
  name: "table_id",
package/routes/admin.js CHANGED
@@ -954,12 +954,14 @@ router.post(
954
954
  isAdmin,
955
955
  error_catcher(async (req, res) => {
956
956
  if (db.getTenantSchema() === db.connectObj.default_schema) {
957
- if (process.send) process.send("RestartServer");
957
+ if (process.send) getState().processSend("RestartServer");
958
958
  else process.exit(0);
959
959
  } else {
960
960
  await restart_tenant(loadAllPlugins);
961
- process.send &&
962
- process.send({ restart_tenant: true, tenant: db.getTenantSchema() });
961
+ getState().processSend({
962
+ restart_tenant: true,
963
+ tenant: db.getTenantSchema(),
964
+ });
963
965
  req.flash("success", req.__("Restart complete"));
964
966
  res.redirect("/admin");
965
967
  }
@@ -1000,7 +1002,7 @@ router.post(
1000
1002
  )
1001
1003
  );
1002
1004
  setTimeout(() => {
1003
- if (process.send) process.send("RestartServer");
1005
+ getState().processSend("RestartServer");
1004
1006
  process.exit(0);
1005
1007
  }, 100);
1006
1008
  });
package/routes/plugins.js CHANGED
@@ -669,11 +669,10 @@ router.post(
669
669
  const instore = await Plugin.store_plugins_available();
670
670
  const store_plugin = instore.find((p) => p.name === plugin.name);
671
671
  if (store_plugin && store_plugin.has_auth) flash_restart(req);
672
- process.send &&
673
- process.send({
674
- refresh_plugin_cfg: plugin.name,
675
- tenant: db.getTenantSchema(),
676
- });
672
+ getState().processSend({
673
+ refresh_plugin_cfg: plugin.name,
674
+ tenant: db.getTenantSchema(),
675
+ });
677
676
  if (module.layout) await sleep(500); // Allow other workers to reload this plugin
678
677
  res.redirect("/plugins");
679
678
  }
@@ -700,11 +699,10 @@ router.post(
700
699
  };
701
700
  await plugin.upsert();
702
701
  await load_plugins.loadPlugin(plugin);
703
- process.send &&
704
- process.send({
705
- refresh_plugin_cfg: plugin.name,
706
- tenant: db.getTenantSchema(),
707
- });
702
+ getState().processSend({
703
+ refresh_plugin_cfg: plugin.name,
704
+ tenant: db.getTenantSchema(),
705
+ });
708
706
  res.json({ success: "ok" });
709
707
  }
710
708
  }
@@ -955,8 +953,10 @@ router.get(
955
953
  }
956
954
  req.flash("success", req.__(`Modules up-to-date`));
957
955
  await restart_tenant(loadAllPlugins);
958
- process.send &&
959
- process.send({ restart_tenant: true, tenant: db.getTenantSchema() });
956
+ getState().processSend({
957
+ restart_tenant: true,
958
+ tenant: db.getTenantSchema(),
959
+ });
960
960
  }
961
961
  res.redirect(`/plugins`);
962
962
  })
package/routes/tables.js CHANGED
@@ -563,9 +563,9 @@ router.get(
563
563
  const { idorname } = req.params;
564
564
  let id = parseInt(idorname);
565
565
  let table;
566
- if (id) table = Table.findOne({ id });
566
+ if (id) [table] = await Table.find({ id });
567
567
  else {
568
- table = Table.findOne({ name: idorname });
568
+ [table] = await Table.find({ name: idorname });
569
569
  }
570
570
 
571
571
  if (!table) {
@@ -911,12 +911,10 @@ router.post(
911
911
  rest.provider_name !== "Database table"
912
912
  ) {
913
913
  const table = await Table.create(name, rest);
914
- await sleep(500); // Allow other workers to load this view
915
914
  res.redirect(`/table/provider-cfg/${table.id}`);
916
915
  } else {
917
916
  delete rest.provider_name;
918
917
  const table = await Table.create(name, rest);
919
- await sleep(500); // Allow other workers to load this view
920
918
  req.flash("success", req.__(`Table %s created`, name));
921
919
  res.redirect(`/table/${table.id}`);
922
920
  }
package/routes/view.js CHANGED
@@ -117,7 +117,7 @@ router.post(
117
117
  error_catcher(async (req, res) => {
118
118
  const { viewname } = req.params;
119
119
 
120
- const view = await View.findOne({ name: viewname });
120
+ const [view] = await View.find({ name: viewname });
121
121
  if (!view) {
122
122
  res.send("");
123
123
  return;
@@ -470,7 +470,6 @@ router.post(
470
470
  else v.configuration = {};
471
471
  //console.log(v);
472
472
  await View.create(v);
473
- await sleep(500); // Allow other workers to load this view
474
473
  }
475
474
  res.redirect(
476
475
  addOnDoneRedirect(
@@ -583,7 +582,7 @@ router.get(
583
582
  error_catcher(async (req, res) => {
584
583
  const { name } = req.params;
585
584
  const { step } = req.query;
586
- const view = await View.findOne({ name });
585
+ const [view] = await View.find({ name });
587
586
  if (!view) {
588
587
  req.flash("error", `View not found: ${text(name)}`);
589
588
  res.redirect("/viewedit");
package/serve.js CHANGED
@@ -263,7 +263,7 @@ module.exports =
263
263
  httpsServer.setTimeout(timeout * 1000);
264
264
  process.on("message", workerDispatchMsg);
265
265
  glx.serveApp(app);
266
- process.send && process.send("Start");
266
+ getState().processSend("Start");
267
267
  })
268
268
  .master(() => {
269
269
  initMaster(appargs).then(initMasterListeners);
@@ -349,7 +349,7 @@ const nonGreenlockWorkerSetup = async (appargs, port) => {
349
349
  console.log(`Saltcorn listening on http://localhost:${port}/`);
350
350
  });
351
351
  }
352
- process.send && process.send("Start");
352
+ getState().processSend("Start");
353
353
  };
354
354
 
355
355
  /**