@cyklang/cli 0.9.0 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -34,7 +34,7 @@ class CronList extends Cmd_1.Cmd {
34
34
  try {
35
35
  await this.prologue(options);
36
36
  const json = await this.dbRemote?.apiServer.get('/api/admin/cron');
37
- console.log(json);
37
+ console.log(JSON.stringify(json));
38
38
  }
39
39
  catch (err) {
40
40
  logger.error(err);
@@ -80,6 +80,7 @@ class CronDeleteCmd extends Cmd_1.Cmd {
80
80
  constructor(name) {
81
81
  super(name);
82
82
  this.description('delete a batch scheduling with cron')
83
+ .option('-i --id <cron_id>', 'id of the cron to delete (mandatory)')
83
84
  .option('-s --schedule <schedule>', 'schedule in crontab format')
84
85
  .option('-m --module <module_name>', 'module name')
85
86
  .option('-f --function <function>', 'function called in the module')
@@ -97,13 +98,15 @@ class CronDeleteCmd extends Cmd_1.Cmd {
97
98
  await this.prologue(options);
98
99
  if (!this.dbRemote)
99
100
  throw 'dbRemote undefined';
101
+ if (!options.id)
102
+ throw 'id is missing';
100
103
  const payload = {
101
104
  schedule: options.schedule,
102
105
  module: options.module,
103
106
  function: options.function,
104
107
  params: options.params
105
108
  };
106
- const response = await this.dbRemote.apiServer.delete('/api/admin/cron', payload);
109
+ const response = await this.dbRemote.apiServer.delete(`/api/admin/cron/${options.id}`, payload);
107
110
  logger.debug(response);
108
111
  }
109
112
  catch (err) {
package/build/index.js CHANGED
@@ -182,7 +182,7 @@ class StopCommand extends commander_1.Command {
182
182
  */
183
183
  const program = new commander_1.Command();
184
184
  program.name('cyk').description('cyklang CLI')
185
- .version('0.8.3');
185
+ .version('0.9.1');
186
186
  program.addCommand(new StartCommand('start'));
187
187
  program.addCommand(new StopCommand('stop'));
188
188
  program.addCommand(new InstallCommand_1.InstallCommand('install'));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cyklang/cli",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
4
4
  "description": "cyklang CLI",
5
5
  "main": "build/index.js",
6
6
  "scripts": {
@@ -31,7 +31,7 @@ class CronList extends Cmd {
31
31
  await this.prologue(options)
32
32
 
33
33
  const json = await this.dbRemote?.apiServer.get('/api/admin/cron')
34
- console.log(json)
34
+ console.log(JSON.stringify(json))
35
35
  }
36
36
  catch (err) {
37
37
  logger.error(err)
@@ -80,11 +80,13 @@ class CronDeleteCmd extends Cmd {
80
80
  constructor(name: string) {
81
81
  super(name)
82
82
  this.description('delete a batch scheduling with cron')
83
+ .option('-i --id <cron_id>', 'id of the cron to delete (mandatory)')
83
84
  .option('-s --schedule <schedule>', 'schedule in crontab format')
84
85
  .option('-m --module <module_name>', 'module name')
85
86
  .option('-f --function <function>', 'function called in the module')
86
87
  .option('-p --params <name_value_pairs>', 'URL encoded form without ? (question mark) ie "p1=val1&p2=val2"')
87
88
  .action(async (options: any) => {
89
+
88
90
  await this.commandDelete(options)
89
91
  })
90
92
  }
@@ -97,13 +99,14 @@ class CronDeleteCmd extends Cmd {
97
99
 
98
100
  await this.prologue(options)
99
101
  if (! this.dbRemote) throw 'dbRemote undefined'
102
+ if (! options.id) throw 'id is missing'
100
103
  const payload: any = {
101
104
  schedule: options.schedule,
102
105
  module: options.module,
103
106
  function: options.function,
104
107
  params: options.params
105
108
  }
106
- const response = await this.dbRemote.apiServer.delete('/api/admin/cron', payload)
109
+ const response = await this.dbRemote.apiServer.delete(`/api/admin/cron/${options.id}`, payload)
107
110
  logger.debug(response)
108
111
  }
109
112
  catch (err) {
package/src/index.ts CHANGED
@@ -176,7 +176,7 @@ class StopCommand extends Command {
176
176
  */
177
177
  const program = new Command()
178
178
  program.name('cyk').description('cyklang CLI')
179
- .version('0.8.3')
179
+ .version('0.9.1')
180
180
  program.addCommand(new StartCommand('start'))
181
181
  program.addCommand(new StopCommand('stop'))
182
182
  program.addCommand(new InstallCommand('install'))