@cyklang/cli 0.9.0 → 0.9.3
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/build/CronCommand.js +5 -2
- package/build/index.js +1 -1
- package/package.json +2 -2
- package/src/CronCommand.ts +5 -2
- package/src/index.ts +1 -1
- package/test/db/t10.xml +7 -4
- package/test/db/t13.xml +6 -4
- package/test/t01.output +47 -0
- package/test/t01.xml +19 -0
package/build/CronCommand.js
CHANGED
|
@@ -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(
|
|
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.
|
|
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.
|
|
3
|
+
"version": "0.9.3",
|
|
4
4
|
"description": "cyklang CLI",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"author": "",
|
|
18
18
|
"license": "ISC",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@cyklang/core": "^0.6.
|
|
20
|
+
"@cyklang/core": "^0.6.6",
|
|
21
21
|
"commander": "^9.4.0",
|
|
22
22
|
"dotenv": "^16.0.1",
|
|
23
23
|
"form-data": "^4.0.0",
|
package/src/CronCommand.ts
CHANGED
|
@@ -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(
|
|
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.
|
|
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'))
|
package/test/db/t10.xml
CHANGED
|
@@ -27,10 +27,13 @@
|
|
|
27
27
|
</db.table>
|
|
28
28
|
|
|
29
29
|
<query name="t_films_actors">
|
|
30
|
-
<
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
<object name="params">
|
|
31
|
+
<number name="length_from">0</number>
|
|
32
|
+
<number name="length_to">999</number>
|
|
33
|
+
</object>
|
|
34
|
+
|
|
35
|
+
<string name="entities">"t_actor t_film"</string>
|
|
36
|
+
<string name="sql" literal="">
|
|
34
37
|
SELECT * FROM public.t_actor
|
|
35
38
|
join t_film_actor on t_film_actor.actor_id = t_actor.actor_id
|
|
36
39
|
join t_film on t_film_actor.film_id = t_film.film_id
|
package/test/db/t13.xml
CHANGED
|
@@ -11,10 +11,12 @@
|
|
|
11
11
|
<number name="length_to">60</number>
|
|
12
12
|
</db.execute> -->
|
|
13
13
|
<query name="t_films_actors">
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
<object name="params">
|
|
15
|
+
<number name="length_from">0</number>
|
|
16
|
+
<number name="length_to">999</number>
|
|
17
|
+
</object>
|
|
18
|
+
<string name="entities">"t_actor t_film"</string>
|
|
19
|
+
<string name="sql" literal="">
|
|
18
20
|
SELECT * FROM public.t_actor
|
|
19
21
|
join t_film_actor on t_film_actor.actor_id = t_actor.actor_id
|
|
20
22
|
join t_film on t_film_actor.film_id = t_film.film_id
|
package/test/t01.output
CHANGED
|
@@ -44,3 +44,50 @@ Vidage de l'object pst1 :
|
|
|
44
44
|
name id, value 100
|
|
45
45
|
name libelle, value Prestation 2
|
|
46
46
|
v_obj.nested.member = 888
|
|
47
|
+
list: <object type="dossier">
|
|
48
|
+
<number name="id">1</number>
|
|
49
|
+
<string name="libelle" literal="">Dossier DUPONT</string>
|
|
50
|
+
<object name="prestation" type="prestation">
|
|
51
|
+
<number name="id">100</number>
|
|
52
|
+
<string name="libelle" literal="">Prestation 2</string>
|
|
53
|
+
</object>
|
|
54
|
+
</object>
|
|
55
|
+
<object type="dossier_remorquage">
|
|
56
|
+
<number name="id">2</number>
|
|
57
|
+
<string name="libelle" literal="">DURAND</string>
|
|
58
|
+
<object name="prestation" type="prestation">
|
|
59
|
+
<number name="id">
|
|
60
|
+
</number>
|
|
61
|
+
<string name="libelle">
|
|
62
|
+
</string>
|
|
63
|
+
</object>
|
|
64
|
+
<string name="lieu" literal="">Saint-Denis</string>
|
|
65
|
+
</object>
|
|
66
|
+
<object type="dossier">
|
|
67
|
+
<number name="id">300</number>
|
|
68
|
+
<string name="libelle" literal="">dossier 300</string>
|
|
69
|
+
<object name="prestation" type="prestation">
|
|
70
|
+
<number name="id">
|
|
71
|
+
</number>
|
|
72
|
+
<string name="libelle">
|
|
73
|
+
</string>
|
|
74
|
+
</object>
|
|
75
|
+
</object>
|
|
76
|
+
<object name="dossier_vide" type="dossier">
|
|
77
|
+
<number name="id">
|
|
78
|
+
</number>
|
|
79
|
+
<string name="libelle">
|
|
80
|
+
</string>
|
|
81
|
+
<object name="prestation" type="prestation">
|
|
82
|
+
<number name="id">
|
|
83
|
+
</number>
|
|
84
|
+
<string name="libelle">
|
|
85
|
+
</string>
|
|
86
|
+
</object>
|
|
87
|
+
</object>
|
|
88
|
+
list.at(0): <number name="id">1</number>
|
|
89
|
+
<string name="libelle" literal="">Dossier DUPONT</string>
|
|
90
|
+
<object name="prestation" type="prestation">
|
|
91
|
+
<number name="id">100</number>
|
|
92
|
+
<string name="libelle" literal="">Prestation 2</string>
|
|
93
|
+
</object>
|
package/test/t01.xml
CHANGED
|
@@ -220,4 +220,23 @@
|
|
|
220
220
|
|
|
221
221
|
<call function="caller"/>
|
|
222
222
|
|
|
223
|
+
<object name="list">
|
|
224
|
+
<object type="dossier">dos1</object>
|
|
225
|
+
<!-- <object>dos2</object>
|
|
226
|
+
<object>dos3</object> -->
|
|
227
|
+
</object>
|
|
228
|
+
<call object="list" method="push">
|
|
229
|
+
<object type="dossier_remorquage">dos2</object>
|
|
230
|
+
</call>
|
|
231
|
+
<call object="list" method="push">
|
|
232
|
+
<object type="dossier">dos3</object>
|
|
233
|
+
</call>
|
|
234
|
+
<call object="list" method="push">
|
|
235
|
+
<object name="dossier_vide" type="dossier"></object>
|
|
236
|
+
</call>
|
|
237
|
+
<print>"list: " + string(list)</print>
|
|
238
|
+
<print>"list.at(0): " + string(list.at(0))</print>
|
|
239
|
+
|
|
240
|
+
<print>"meta(dossier): " +meta("dossier")</print>
|
|
241
|
+
<print>"meta(dossier_remorquage): " + meta("dossier_remorquage")</print>
|
|
223
242
|
</module>
|