@saltcorn/cli 1.0.0-beta.0 → 1.0.0-beta.10

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 (51) hide show
  1. package/README.md +394 -294
  2. package/bin/saltcorn +4 -4
  3. package/npm-shrinkwrap.json +11307 -23249
  4. package/oclif.manifest.json +1619 -1
  5. package/package.json +14 -25
  6. package/src/commands/add-schema.js +7 -8
  7. package/src/commands/backup.js +6 -6
  8. package/src/commands/build-app.js +26 -26
  9. package/src/commands/build-cordova-builder.js +3 -3
  10. package/src/commands/configuration-check-backups.js +7 -9
  11. package/src/commands/configuration-check.js +4 -5
  12. package/src/commands/create-tenant.js +11 -9
  13. package/src/commands/create-user.js +9 -10
  14. package/src/commands/delete-tenants.js +1 -1
  15. package/src/commands/delete-user.js +12 -10
  16. package/src/commands/dev/localize-plugin.js +12 -10
  17. package/src/commands/dev/make-migration.js +1 -1
  18. package/src/commands/dev/plugin-test.js +6 -6
  19. package/src/commands/dev/post-release.js +6 -7
  20. package/src/commands/dev/release.js +14 -7
  21. package/src/commands/dev/test-plugin.js +8 -5
  22. package/src/commands/fixtures.js +4 -4
  23. package/src/commands/get-cfg.js +14 -12
  24. package/src/commands/info.js +8 -8
  25. package/src/commands/inspect.js +9 -12
  26. package/src/commands/install-pack.js +5 -5
  27. package/src/commands/install-plugin.js +6 -6
  28. package/src/commands/list-tenants.js +27 -19
  29. package/src/commands/list-triggers.js +29 -18
  30. package/src/commands/list-users.js +9 -16
  31. package/src/commands/migrate.js +1 -1
  32. package/src/commands/modify-user.js +16 -15
  33. package/src/commands/plugins.js +24 -12
  34. package/src/commands/reset-schema.js +5 -6
  35. package/src/commands/restore.js +6 -6
  36. package/src/commands/rm-tenant.js +7 -9
  37. package/src/commands/run-benchmark.js +17 -14
  38. package/src/commands/run-js.js +5 -6
  39. package/src/commands/run-sql.js +5 -6
  40. package/src/commands/run-tests.js +15 -13
  41. package/src/commands/run-trigger.js +13 -8
  42. package/src/commands/scheduler.js +4 -4
  43. package/src/commands/serve.js +10 -10
  44. package/src/commands/set-cfg.js +14 -13
  45. package/src/commands/set-daily-time.js +7 -9
  46. package/src/commands/setup-benchmark.js +14 -7
  47. package/src/commands/setup.js +11 -12
  48. package/src/commands/sync-upload-data.js +6 -6
  49. package/src/commands/take-snapshot.js +5 -6
  50. package/src/commands/transform-field.js +9 -10
  51. package/src/index.js +1 -1
@@ -2,8 +2,7 @@
2
2
  * @category saltcorn-cli
3
3
  * @module commands/run-trigger
4
4
  */
5
- const { Command, flags } = require("@oclif/command");
6
- const { cli } = require("cli-ux");
5
+ const { Command, Flags, ux } = require("@oclif/core");
7
6
  const { maybe_as_tenant, init_some_tenants } = require("../common");
8
7
 
9
8
  /**
@@ -16,10 +15,10 @@ class ListUsersCommand extends Command {
16
15
  * @returns {Promise<void>}
17
16
  */
18
17
  async run() {
19
- const {flags, args} = this.parse(ListUsersCommand);
18
+ const { flags, args } = await this.parse(ListUsersCommand);
20
19
  await init_some_tenants(flags.tenant);
21
20
 
22
- const {mockReqRes} = require("@saltcorn/data/tests/mocks");
21
+ const { mockReqRes } = require("@saltcorn/data/tests/mocks");
23
22
  const User = require(`@saltcorn/data/models/user`);
24
23
  //const that = this;
25
24
  await maybe_as_tenant(flags.tenant, async () => {
@@ -29,17 +28,11 @@ class ListUsersCommand extends Command {
29
28
  this.exit(1);
30
29
  }
31
30
 
32
- if(!flags.verbose){
33
- console.table(users,
34
- ["email"]
35
- );
31
+ if (!flags.verbose) {
32
+ console.table(users, ["email"]);
33
+ } else {
34
+ console.table(users, ["id", "email", "language", "role_id"]);
36
35
  }
37
- else {
38
- console.table(users,
39
- ["id","email","language","role_id"]
40
- );
41
- }
42
-
43
36
  });
44
37
  this.exit(0);
45
38
  }
@@ -57,13 +50,13 @@ ListUsersCommand.help = `List users`;
57
50
  * @type {object}
58
51
  */
59
52
  ListUsersCommand.flags = {
60
- tenant: flags.string({
53
+ tenant: Flags.string({
61
54
  name: "tenant",
62
55
  char: "t",
63
56
  description: "tenant",
64
57
  required: false,
65
58
  }),
66
- verbose: flags.boolean({
59
+ verbose: Flags.boolean({
67
60
  name: "verbose",
68
61
  char: "v",
69
62
  description: "verbose output",
@@ -2,7 +2,7 @@
2
2
  * @category saltcorn-cli
3
3
  * @module commands/migrate
4
4
  */
5
- const { Command, flags } = require("@oclif/command");
5
+ const { Command, Flags } = require("@oclif/core");
6
6
  const db = require("@saltcorn/data/db");
7
7
  const { eachTenant } = require("@saltcorn/admin-models/models/tenant");
8
8
  // todo add dryrun mode
@@ -4,8 +4,7 @@
4
4
  */
5
5
 
6
6
  // todo support for users without emails (using user.id)
7
- const { Command, flags } = require("@oclif/command");
8
- const { cli } = require("cli-ux");
7
+ const { Command, Flags, Args, ux } = require("@oclif/core");
9
8
  const { maybe_as_tenant, init_some_tenants } = require("../common");
10
9
 
11
10
  /**
@@ -20,8 +19,7 @@ class ModifyUserCommand extends Command {
20
19
  async run() {
21
20
  const User = require("@saltcorn/data/models/user");
22
21
 
23
- const { args } = this.parse(ModifyUserCommand);
24
- const { flags } = this.parse(ModifyUserCommand);
22
+ const { args, flags } = await this.parse(ModifyUserCommand);
25
23
 
26
24
  if (flags.admin && flags.role && flags.role !== "admin") {
27
25
  console.error("Error: specify at most one of admin and role");
@@ -49,7 +47,7 @@ class ModifyUserCommand extends Command {
49
47
  let email;
50
48
  if (flags.email) email = flags.email;
51
49
  else if (flags.imode)
52
- email = await cli.prompt("New Email address", {
50
+ email = await ux.prompt("New Email address", {
53
51
  default: args.user_email,
54
52
  });
55
53
  if (email === args.user_email) email = undefined; // little trick - we won't update email if it already same
@@ -64,7 +62,7 @@ class ModifyUserCommand extends Command {
64
62
  let password;
65
63
  if (flags.password) password = flags.password;
66
64
  else if (flags.imode)
67
- password = await cli.prompt("New Password", { type: "hide" });
65
+ password = await ux.prompt("New Password", { type: "hide" });
68
66
  if (password)
69
67
  if (User.unacceptable_password_reason(password)) {
70
68
  console.error(
@@ -113,9 +111,12 @@ class ModifyUserCommand extends Command {
113
111
  /**
114
112
  * @type {object}
115
113
  */
116
- ModifyUserCommand.args = [
117
- { name: "user_email", required: true, description: "User to modify" },
118
- ];
114
+ ModifyUserCommand.args = {
115
+ user_email: Args.string({
116
+ required: true,
117
+ description: "User to modify",
118
+ }),
119
+ };
119
120
 
120
121
  /**
121
122
  * @type {string}
@@ -145,24 +146,24 @@ NOTE that -a and -r role (--role=role) can give conflict.
145
146
  * @type {object}
146
147
  */
147
148
  ModifyUserCommand.flags = {
148
- admin: flags.boolean({ char: "a", description: "make user be Admin" }),
149
- tenant: flags.string({
149
+ admin: Flags.boolean({ char: "a", description: "make user be Admin" }),
150
+ tenant: Flags.string({
150
151
  char: "t",
151
152
  description: "tenant",
152
153
  }),
153
- email: flags.string({
154
+ email: Flags.string({
154
155
  char: "e",
155
156
  description: "new email",
156
157
  }),
157
- role: flags.string({
158
+ role: Flags.string({
158
159
  char: "r",
159
160
  description: "new role (can conflict with -a option)",
160
161
  }),
161
- password: flags.string({
162
+ password: Flags.string({
162
163
  char: "p",
163
164
  description: "new password",
164
165
  }),
165
- imode: flags.boolean({ char: "i", description: "interactive mode" }),
166
+ imode: Flags.boolean({ char: "i", description: "interactive mode" }),
166
167
  };
167
168
 
168
169
  module.exports = ModifyUserCommand;
@@ -2,7 +2,7 @@
2
2
  * @category saltcorn-cli
3
3
  * @module commands/plugins
4
4
  */
5
- const { Command, flags } = require("@oclif/command");
5
+ const { Command, Flags } = require("@oclif/core");
6
6
 
7
7
  /**
8
8
  * Plugins list and update command
@@ -15,11 +15,14 @@ class PluginsCommand extends Command {
15
15
  */
16
16
  async run() {
17
17
  const db = require("@saltcorn/data/db");
18
- const { requirePlugin } = require("@saltcorn/server/load_plugins");
18
+ const {
19
+ requirePlugin,
20
+ ensurePluginSupport,
21
+ } = require("@saltcorn/server/load_plugins");
19
22
  const { getAllTenants } = require("@saltcorn/admin-models/models/tenant");
20
23
  const Plugin = require("@saltcorn/data/models/plugin");
21
24
  var plugins = [];
22
- const { flags } = this.parse(PluginsCommand);
25
+ const { flags } = await this.parse(PluginsCommand);
23
26
 
24
27
  const tenantList = [
25
28
  db.connectObj.default_schema,
@@ -57,10 +60,19 @@ class PluginsCommand extends Command {
57
60
  if (flags.upgrade || flags.dryRun) {
58
61
  var new_versions = {};
59
62
  for (let plugin of plugins) {
60
- plugin.version = "latest";
61
- const { version } = await requirePlugin(plugin, true);
62
- //console.log(plinfo)
63
- if (version) new_versions[plugin.location] = version;
63
+ const oldVersion = plugin.version;
64
+ try {
65
+ plugin.version = "latest";
66
+ await ensurePluginSupport(plugin);
67
+ const { version } = await requirePlugin(plugin, true);
68
+ //console.log(plinfo)
69
+ if (version) new_versions[plugin.location] = version;
70
+ } catch (e) {
71
+ plugin.version = oldVersion;
72
+ console.log(
73
+ `Unable to find a supported version for '${plugin.location}'`
74
+ );
75
+ }
64
76
  }
65
77
  console.log(new_versions);
66
78
  for (const domain of tenantList) {
@@ -109,19 +121,19 @@ class PluginsCommand extends Command {
109
121
  */
110
122
  PluginsCommand.flags = {
111
123
  //list: flags.boolean({ char: "l", description: "List" }),
112
- upgrade: flags.boolean({ char: "u", description: "Upgrade" }),
113
- dryRun: flags.boolean({ char: "d", description: "Upgrade dry-run" }),
114
- verbose: flags.boolean({
124
+ upgrade: Flags.boolean({ char: "u", description: "Upgrade" }),
125
+ dryRun: Flags.boolean({ char: "d", description: "Upgrade dry-run" }),
126
+ verbose: Flags.boolean({
115
127
  char: "v",
116
128
  description: "Verbose output",
117
129
  default: false,
118
130
  }),
119
- force: flags.boolean({
131
+ force: Flags.boolean({
120
132
  char: "f",
121
133
  description: "Force update",
122
134
  default: false,
123
135
  }),
124
- name: flags.string({
136
+ name: Flags.string({
125
137
  char: "n",
126
138
  description: "Plugin name",
127
139
  }),
@@ -2,8 +2,7 @@
2
2
  * @category saltcorn-cli
3
3
  * @module commands/reset-schema
4
4
  */
5
- const { Command, flags } = require("@oclif/command");
6
- const { cli } = require("cli-ux");
5
+ const { Command, Flags, ux } = require("@oclif/core");
7
6
  const { maybe_as_tenant } = require("../common");
8
7
 
9
8
  /**
@@ -18,13 +17,13 @@ class ResetCommand extends Command {
18
17
  async run() {
19
18
  const reset = require("@saltcorn/data/db/reset_schema");
20
19
  const db = require("@saltcorn/data/db");
21
- const { flags } = this.parse(ResetCommand);
20
+ const { flags } = await this.parse(ResetCommand);
22
21
  await maybe_as_tenant(flags.tenant, async () => {
23
22
  const schema = db.getTenantSchema();
24
23
  if (flags.force) {
25
24
  await reset(false, schema);
26
25
  } else {
27
- const ans = await cli.confirm(
26
+ const ans = await ux.confirm(
28
27
  `This will wipe all data from database "${
29
28
  db.isSQLite ? "SQLite" : db.connectObj.database + "." + schema
30
29
  }".\nContinue (y/n)?`
@@ -57,8 +56,8 @@ This will delete all existing information
57
56
  * @type {object}
58
57
  */
59
58
  ResetCommand.flags = {
60
- force: flags.boolean({ char: "f", description: "force command execution" }),
61
- tenant: flags.string({
59
+ force: Flags.boolean({ char: "f", description: "force command execution" }),
60
+ tenant: Flags.string({
62
61
  char: "t",
63
62
  description: "tenant",
64
63
  }),
@@ -2,7 +2,7 @@
2
2
  * @category saltcorn-cli
3
3
  * @module commands/restore
4
4
  */
5
- const { Command, flags } = require("@oclif/command");
5
+ const { Command, Flags, Args } = require("@oclif/core");
6
6
  const { spawnSync } = require("child_process");
7
7
  const path = require("path");
8
8
  const { maybe_as_tenant } = require("../common");
@@ -60,7 +60,7 @@ class RestoreCommand extends Command {
60
60
  * @returns {Promise<void>}
61
61
  */
62
62
  async run() {
63
- const { args, flags } = this.parse(RestoreCommand);
63
+ const { args, flags } = await this.parse(RestoreCommand);
64
64
  switch (path.extname(args.file)) {
65
65
  case ".sqlc":
66
66
  if (flags.tenant) {
@@ -82,9 +82,9 @@ class RestoreCommand extends Command {
82
82
  /**
83
83
  * @type {object}
84
84
  */
85
- RestoreCommand.args = [
86
- { name: "file", required: true, description: "backup file to restore" },
87
- ];
85
+ RestoreCommand.args = {
86
+ file: Args.string({ required: true, description: "backup file to restore" }),
87
+ };
88
88
 
89
89
  /**
90
90
  * @type {string}
@@ -100,7 +100,7 @@ RestoreCommand.help = `Restore a previously backed up database (zip or sqlc form
100
100
  * @type {object}
101
101
  */
102
102
  RestoreCommand.flags = {
103
- tenant: flags.string({
103
+ tenant: Flags.string({
104
104
  char: "t",
105
105
  description: "tenant",
106
106
  }),
@@ -2,8 +2,7 @@
2
2
  * @category saltcorn-cli
3
3
  * @module commands/rm-tenant
4
4
  */
5
- const { Command, flags } = require("@oclif/command");
6
- const {cli} = require("cli-ux");
5
+ const { Command, Flags, ux } = require("@oclif/core");
7
6
 
8
7
  /**
9
8
  * RmTenantCommand Class
@@ -15,15 +14,14 @@ class RmTenantCommand extends Command {
15
14
  * @returns {Promise<void>}
16
15
  */
17
16
  async run() {
18
-
19
-
20
- const { flags } = this.parse(RmTenantCommand);
17
+ const { flags } = await this.parse(RmTenantCommand);
21
18
 
22
19
  const { deleteTenant } = require("@saltcorn/admin-models/models/tenant");
23
20
 
24
21
  if (!flags.force) {
25
- const ans = await cli.confirm(
26
- `This will delete tenant ${flags.tenant}. Attention! All tenant data will be lost!\nContinue (y/n)?`);
22
+ const ans = await ux.confirm(
23
+ `This will delete tenant ${flags.tenant}. Attention! All tenant data will be lost!\nContinue (y/n)?`
24
+ );
27
25
  if (!ans) {
28
26
  console.log(`Success: Command execution canceled`);
29
27
  this.exit(1);
@@ -63,8 +61,8 @@ It recommended to make backup of tenant before perform this command.
63
61
  * @type {object}
64
62
  */
65
63
  RmTenantCommand.flags = {
66
- force: flags.boolean({ char: "f", description: "force command execution" }),
67
- tenant: flags.string({
64
+ force: Flags.boolean({ char: "f", description: "force command execution" }),
65
+ tenant: Flags.string({
68
66
  char: "t",
69
67
  description: "tenant",
70
68
  required: true,
@@ -2,7 +2,7 @@
2
2
  * @category saltcorn-cli
3
3
  * @module commands/run-benchmark
4
4
  */
5
- const { Command, flags } = require("@oclif/command");
5
+ const { Command, Flags, Args } = require("@oclif/core");
6
6
  const si = require("systeminformation");
7
7
  const fetch = require("node-fetch");
8
8
 
@@ -11,16 +11,16 @@ const { sleep } = require("../common");
11
11
  const packagejson = require("../../package.json");
12
12
 
13
13
  /**
14
- *
15
- * @param {string} s
14
+ *
15
+ * @param {string} s
16
16
  * @returns {number}
17
17
  */
18
18
  const parseMillisecs = (s) =>
19
19
  s.endsWith("ms") ? parseFloat(s) : parseFloat(s) * 1000;
20
20
 
21
21
  /**
22
- *
23
- * @param {*} args
22
+ *
23
+ * @param {*} args
24
24
  * @returns {Promise<object>}
25
25
  */
26
26
  const wrk = (args) =>
@@ -37,8 +37,8 @@ const wrk = (args) =>
37
37
  });
38
38
 
39
39
  /**
40
- *
41
- * @param {string} s
40
+ *
41
+ * @param {string} s
42
42
  * @returns {string}
43
43
  */
44
44
  const ensure_no_final_slash = (s) => (s.endsWith("/") ? s.slice(0, -1) : s);
@@ -56,7 +56,7 @@ class RunBenchmarkCommand extends Command {
56
56
  const {
57
57
  args: { baseurl },
58
58
  flags: { token, delay, benchmark },
59
- } = this.parse(RunBenchmarkCommand);
59
+ } = await this.parse(RunBenchmarkCommand);
60
60
  const File = require("@saltcorn/data/models/file");
61
61
  const file = await File.findOne({ filename: "rick.png" });
62
62
  if (!file) {
@@ -138,9 +138,12 @@ class RunBenchmarkCommand extends Command {
138
138
  /**
139
139
  * @type {object}
140
140
  */
141
- RunBenchmarkCommand.args = [
142
- { name: "baseurl", required: false, description: "Base URL" },
143
- ];
141
+ RunBenchmarkCommand.args = {
142
+ baseurl: Args.string({
143
+ required: false,
144
+ description: "Base URL",
145
+ }),
146
+ };
144
147
 
145
148
  /**
146
149
  * @type {string}
@@ -151,15 +154,15 @@ RunBenchmarkCommand.description = `Run benchmark`;
151
154
  * @type {object}
152
155
  */
153
156
  RunBenchmarkCommand.flags = {
154
- token: flags.string({
157
+ token: Flags.string({
155
158
  char: "t",
156
159
  description: "API Token for reporting results",
157
160
  }),
158
- benchmark: flags.string({
161
+ benchmark: Flags.string({
159
162
  char: "b",
160
163
  description: "Which benchmark to run",
161
164
  }),
162
- delay: flags.integer({
165
+ delay: Flags.integer({
163
166
  char: "d",
164
167
  description: "delay between runs (s)",
165
168
  default: 30,
@@ -2,8 +2,7 @@
2
2
  * @category saltcorn-cli
3
3
  * @module commands/run-js
4
4
  */
5
- const { Command, flags } = require("@oclif/command");
6
- const { cli } = require("cli-ux");
5
+ const { Command, Flags, ux } = require("@oclif/core");
7
6
  const {
8
7
  maybe_as_tenant,
9
8
  init_some_tenants,
@@ -24,7 +23,7 @@ class RunJSCommand extends Command {
24
23
  * @returns {Promise<void>}
25
24
  */
26
25
  async run() {
27
- const { flags, args } = this.parse(RunJSCommand);
26
+ const { flags, args } = await this.parse(RunJSCommand);
28
27
  await init_some_tenants(flags.tenant);
29
28
 
30
29
  const that = this;
@@ -58,17 +57,17 @@ RunJSCommand.description = `Run javascript code`;
58
57
  * @type {object}
59
58
  */
60
59
  RunJSCommand.flags = {
61
- tenant: flags.string({
60
+ tenant: Flags.string({
62
61
  name: "tenant",
63
62
  char: "t",
64
63
  description: "tenant name",
65
64
  }),
66
- code: flags.string({
65
+ code: Flags.string({
67
66
  name: "code",
68
67
  char: "c",
69
68
  description: "js code",
70
69
  }),
71
- file: flags.string({
70
+ file: Flags.string({
72
71
  name: "file",
73
72
  char: "f",
74
73
  description: "path to script file",
@@ -2,8 +2,7 @@
2
2
  * @category saltcorn-cli
3
3
  * @module commands/run-sql
4
4
  */
5
- const { Command, flags } = require("@oclif/command");
6
- const { cli } = require("cli-ux");
5
+ const { Command, Flags, ux } = require("@oclif/core");
7
6
  const {
8
7
  maybe_as_tenant,
9
8
  init_some_tenants,
@@ -21,7 +20,7 @@ class RunSQLCommand extends Command {
21
20
  * @returns {Promise<void>}
22
21
  */
23
22
  async run() {
24
- const { flags, args } = this.parse(RunSQLCommand);
23
+ const { flags, args } = await this.parse(RunSQLCommand);
25
24
 
26
25
  if (!flags.sql && !flags.file) {
27
26
  console.log(
@@ -79,17 +78,17 @@ RunSQLCommand.description = `Run sql expression`;
79
78
  * @type {object}
80
79
  */
81
80
  RunSQLCommand.flags = {
82
- tenant: flags.string({
81
+ tenant: Flags.string({
83
82
  name: "tenant",
84
83
  char: "t",
85
84
  description: "tenant name",
86
85
  }),
87
- sql: flags.string({
86
+ sql: Flags.string({
88
87
  name: "sql",
89
88
  char: "s",
90
89
  description: "sql statement",
91
90
  }),
92
- file: flags.string({
91
+ file: Flags.string({
93
92
  name: "file",
94
93
  char: "f",
95
94
  description: "path to sql file name",
@@ -4,7 +4,7 @@
4
4
  * @category saltcorn-cli
5
5
  * @module commands/run-tests
6
6
  */
7
- const { Command, flags } = require("@oclif/command");
7
+ const { Command, Flags, Args } = require("@oclif/core");
8
8
 
9
9
  const { spawnSync, spawn } = require("child_process");
10
10
  const path = require("path");
@@ -121,7 +121,7 @@ class RunTestsCommand extends Command {
121
121
  * @returns {Promise<void>}
122
122
  */
123
123
  async run() {
124
- const { args, flags } = this.parse(RunTestsCommand);
124
+ const { args, flags } = await this.parse(RunTestsCommand);
125
125
  this.validateCall(args, flags);
126
126
  let env;
127
127
 
@@ -195,9 +195,11 @@ class RunTestsCommand extends Command {
195
195
  /**
196
196
  * @type {object}
197
197
  */
198
- RunTestsCommand.args = [
199
- { name: "package", description: "which package to run tests for" },
200
- ];
198
+ RunTestsCommand.args = {
199
+ package: Args.string({
200
+ description: "which package to run tests for",
201
+ }),
202
+ };
201
203
 
202
204
  /**
203
205
  * @type {string}
@@ -208,27 +210,27 @@ RunTestsCommand.description = `Run test suites`;
208
210
  * @type {object}
209
211
  */
210
212
  RunTestsCommand.flags = {
211
- coverage: flags.boolean({ char: "c", description: "Coverage" }),
212
- listTests: flags.boolean({ char: "l", description: "List tests" }),
213
- verbose: flags.boolean({ char: "v", description: "Verbose" }),
214
- detectOpenHandles: flags.boolean({
213
+ coverage: Flags.boolean({ char: "c", description: "Coverage" }),
214
+ listTests: Flags.boolean({ char: "l", description: "List tests" }),
215
+ verbose: Flags.boolean({ char: "v", description: "Verbose" }),
216
+ detectOpenHandles: Flags.boolean({
215
217
  char: "d",
216
218
  description: "Detect Open Handles",
217
219
  }),
218
- testFilter: flags.string({
220
+ testFilter: Flags.string({
219
221
  char: "t",
220
222
  description: "Filter tests by suite or test name",
221
223
  }),
222
- watch: flags.boolean({
224
+ watch: Flags.boolean({
223
225
  string: "watch",
224
226
  description:
225
227
  "Watch files for changes and rerun tests related to changed files.",
226
228
  }),
227
- watchAll: flags.boolean({
229
+ watchAll: Flags.boolean({
228
230
  string: "watchAll",
229
231
  description: "Watch files for changes and rerun all tests.",
230
232
  }),
231
- database: flags.string({
233
+ database: Flags.string({
232
234
  string: "database",
233
235
  description: "Run on specified database. Default is saltcorn_test",
234
236
  }),
@@ -2,8 +2,7 @@
2
2
  * @category saltcorn-cli
3
3
  * @module commands/run-trigger
4
4
  */
5
- const { Command, flags } = require("@oclif/command");
6
- const { cli } = require("cli-ux");
5
+ const { Command, Flags, Args, ux } = require("@oclif/core");
7
6
  const { maybe_as_tenant, init_some_tenants } = require("../common");
8
7
 
9
8
  /**
@@ -16,7 +15,7 @@ class RunTriggerCommand extends Command {
16
15
  * @returns {Promise<void>}
17
16
  */
18
17
  async run() {
19
- const { flags, args } = this.parse(RunTriggerCommand);
18
+ const { flags, args } = await this.parse(RunTriggerCommand);
20
19
  await init_some_tenants(flags.tenant);
21
20
 
22
21
  const { mockReqRes } = require("@saltcorn/data/tests/mocks");
@@ -37,16 +36,22 @@ class RunTriggerCommand extends Command {
37
36
  */
38
37
  RunTriggerCommand.description = `Run a trigger`;
39
38
 
40
- RunTriggerCommand.args = [
41
- /* { name: "tenant", required: false, description: "tenant name" }, */
42
- { name: "trigger", required: true, description: "trigger name" },
43
- ];
39
+ RunTriggerCommand.args = {
40
+ trigger: Args.string({
41
+ required: true,
42
+ description: "trigger name",
43
+ }),
44
+ // tenant: Args.string({
45
+ // required: false,
46
+ // description: "tenant",
47
+ // }),
48
+ };
44
49
 
45
50
  /**
46
51
  * @type {object}
47
52
  */
48
53
  RunTriggerCommand.flags = {
49
- tenant: flags.string({
54
+ tenant: Flags.string({
50
55
  name: "tenant",
51
56
  char: "t",
52
57
  description: "tenant",
@@ -2,7 +2,7 @@
2
2
  * @category saltcorn-cli
3
3
  * @module commands/scheduler
4
4
  */
5
- const { Command, flags } = require("@oclif/command");
5
+ const { Command, Flags } = require("@oclif/core");
6
6
 
7
7
  /**
8
8
  * ScheduleCommand Class
@@ -14,12 +14,12 @@ class ScheduleCommand extends Command {
14
14
  * @returns {Promise<void>}
15
15
  */
16
16
  async run() {
17
- const { flags } = this.parse(ScheduleCommand);
17
+ const { flags } = await this.parse(ScheduleCommand);
18
18
  if (flags.verbose) {
19
19
  const db = require("@saltcorn/data/db");
20
20
  db.set_sql_logging();
21
21
  }
22
- const runScheduler = require("@saltcorn/data/models/scheduler");
22
+ const { runScheduler } = require("@saltcorn/data/models/scheduler");
23
23
  await runScheduler({});
24
24
  }
25
25
  }
@@ -33,7 +33,7 @@ ScheduleCommand.description = `Run the Saltcorn scheduler`;
33
33
  * @type {object}
34
34
  */
35
35
  ScheduleCommand.flags = {
36
- verbose: flags.boolean({ char: "v", description: "Verbose" }),
36
+ verbose: Flags.boolean({ char: "v", description: "Verbose" }),
37
37
  };
38
38
 
39
39
  module.exports = ScheduleCommand;