@digipair/skill-cron 0.95.7 → 0.97.0

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/index.cjs.js CHANGED
@@ -10443,8 +10443,8 @@ let CronService = class CronService {
10443
10443
  const lines = content.split('\n').filter((line)=>line !== '');
10444
10444
  const planning = lines.map((line)=>JSON.parse(line));
10445
10445
  for (const plan of planning){
10446
- if (plan.time === '@startup') {
10447
- if (plan.enabled) {
10446
+ if (plan.time === '@startup' || plan.time === '@never') {
10447
+ if (plan.time === '@startup' && plan.enabled) {
10448
10448
  await this.startTask(path, plan.digipair, plan.reasoning);
10449
10449
  }
10450
10450
  continue;
@@ -10459,6 +10459,9 @@ let CronService = class CronService {
10459
10459
  }
10460
10460
  }
10461
10461
  addJob(path, id, digipair, reasoning, time, utcOffset) {
10462
+ if (time === '@never') {
10463
+ return;
10464
+ }
10462
10465
  if (time === '@startup') {
10463
10466
  this.startTask(path, digipair, reasoning);
10464
10467
  return;
@@ -10539,8 +10542,11 @@ let CronService = class CronService {
10539
10542
  cron.enabled = true;
10540
10543
  const ndjson = crons.map((line)=>JSON.stringify(line)).join('\n');
10541
10544
  await fs.promises.writeFile(`${path}/planning.jsonl`, ndjson, 'utf8');
10545
+ if (cron.time === '@never') {
10546
+ return cron;
10547
+ }
10542
10548
  if (cron.time === '@startup') {
10543
- this.startTask(path, cron.digipair, cron.reasoning);
10549
+ await this.startTask(path, cron.digipair, cron.reasoning);
10544
10550
  } else {
10545
10551
  this.enableJob(id);
10546
10552
  }
package/index.esm.js CHANGED
@@ -10435,8 +10435,8 @@ let CronService = class CronService {
10435
10435
  const lines = content.split('\n').filter((line)=>line !== '');
10436
10436
  const planning = lines.map((line)=>JSON.parse(line));
10437
10437
  for (const plan of planning){
10438
- if (plan.time === '@startup') {
10439
- if (plan.enabled) {
10438
+ if (plan.time === '@startup' || plan.time === '@never') {
10439
+ if (plan.time === '@startup' && plan.enabled) {
10440
10440
  await this.startTask(path, plan.digipair, plan.reasoning);
10441
10441
  }
10442
10442
  continue;
@@ -10451,6 +10451,9 @@ let CronService = class CronService {
10451
10451
  }
10452
10452
  }
10453
10453
  addJob(path, id, digipair, reasoning, time, utcOffset) {
10454
+ if (time === '@never') {
10455
+ return;
10456
+ }
10454
10457
  if (time === '@startup') {
10455
10458
  this.startTask(path, digipair, reasoning);
10456
10459
  return;
@@ -10531,8 +10534,11 @@ let CronService = class CronService {
10531
10534
  cron.enabled = true;
10532
10535
  const ndjson = crons.map((line)=>JSON.stringify(line)).join('\n');
10533
10536
  await promises.writeFile(`${path}/planning.jsonl`, ndjson, 'utf8');
10537
+ if (cron.time === '@never') {
10538
+ return cron;
10539
+ }
10534
10540
  if (cron.time === '@startup') {
10535
- this.startTask(path, cron.digipair, cron.reasoning);
10541
+ await this.startTask(path, cron.digipair, cron.reasoning);
10536
10542
  } else {
10537
10543
  this.enableJob(id);
10538
10544
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digipair/skill-cron",
3
- "version": "0.95.7",
3
+ "version": "0.97.0",
4
4
  "keywords": [
5
5
  "digipair",
6
6
  "service",
package/schema.fr.json CHANGED
@@ -10,7 +10,9 @@
10
10
  "paths": {
11
11
  "/crons": {
12
12
  "post": {
13
- "tags": ["service"],
13
+ "tags": [
14
+ "service"
15
+ ],
14
16
  "summary": "Liste des taches planifiées",
15
17
  "parameters": [
16
18
  {
@@ -23,12 +25,58 @@
23
25
  }
24
26
  }
25
27
  ],
28
+ "responses": {
29
+ "200": {
30
+ "description": "Liste des tâches cron planifiées",
31
+ "content": {
32
+ "application/json": {
33
+ "schema": {
34
+ "type": "array",
35
+ "items": {
36
+ "type": "object",
37
+ "properties": {
38
+ "id": {
39
+ "type": "string",
40
+ "description": "Unique identifier for the cron task"
41
+ },
42
+ "time": {
43
+ "type": "string",
44
+ "description": "Cron schedule expression"
45
+ },
46
+ "digipair": {
47
+ "type": "string",
48
+ "description": "Name of the digipair"
49
+ },
50
+ "reasoning": {
51
+ "type": "string",
52
+ "description": "Name of the reasoning to execute"
53
+ },
54
+ "enabled": {
55
+ "type": "boolean",
56
+ "description": "Whether the cron task is enabled"
57
+ }
58
+ },
59
+ "required": [
60
+ "id",
61
+ "time",
62
+ "digipair",
63
+ "reasoning",
64
+ "enabled"
65
+ ]
66
+ }
67
+ }
68
+ }
69
+ }
70
+ }
71
+ },
26
72
  "x-events": []
27
73
  }
28
74
  },
29
75
  "/addCron": {
30
76
  "post": {
31
- "tags": ["service"],
77
+ "tags": [
78
+ "service"
79
+ ],
32
80
  "summary": "Ajoute une plannification",
33
81
  "parameters": [
34
82
  {
@@ -82,7 +130,9 @@
82
130
  },
83
131
  "/deleteCron": {
84
132
  "post": {
85
- "tags": ["service"],
133
+ "tags": [
134
+ "service"
135
+ ],
86
136
  "summary": "Supprime une plannification",
87
137
  "parameters": [
88
138
  {
@@ -109,7 +159,9 @@
109
159
  },
110
160
  "/enableCron": {
111
161
  "post": {
112
- "tags": ["service"],
162
+ "tags": [
163
+ "service"
164
+ ],
113
165
  "summary": "Active une plannification",
114
166
  "parameters": [
115
167
  {
@@ -136,7 +188,9 @@
136
188
  },
137
189
  "/disableCron": {
138
190
  "post": {
139
- "tags": ["service"],
191
+ "tags": [
192
+ "service"
193
+ ],
140
194
  "summary": "Désactive une plannification",
141
195
  "parameters": [
142
196
  {
@@ -166,4 +220,4 @@
166
220
  "schemas": {}
167
221
  },
168
222
  "x-scene-blocks": {}
169
- }
223
+ }
package/schema.json CHANGED
@@ -10,7 +10,9 @@
10
10
  "paths": {
11
11
  "/crons": {
12
12
  "post": {
13
- "tags": ["service"],
13
+ "tags": [
14
+ "service"
15
+ ],
14
16
  "summary": "List of Scheduled Tasks",
15
17
  "parameters": [
16
18
  {
@@ -23,12 +25,58 @@
23
25
  }
24
26
  }
25
27
  ],
28
+ "responses": {
29
+ "200": {
30
+ "description": "List of scheduled cron tasks",
31
+ "content": {
32
+ "application/json": {
33
+ "schema": {
34
+ "type": "array",
35
+ "items": {
36
+ "type": "object",
37
+ "properties": {
38
+ "id": {
39
+ "type": "string",
40
+ "description": "Unique identifier for the cron task"
41
+ },
42
+ "time": {
43
+ "type": "string",
44
+ "description": "Cron schedule expression"
45
+ },
46
+ "digipair": {
47
+ "type": "string",
48
+ "description": "Name of the digipair"
49
+ },
50
+ "reasoning": {
51
+ "type": "string",
52
+ "description": "Name of the reasoning to execute"
53
+ },
54
+ "enabled": {
55
+ "type": "boolean",
56
+ "description": "Whether the cron task is enabled"
57
+ }
58
+ },
59
+ "required": [
60
+ "id",
61
+ "time",
62
+ "digipair",
63
+ "reasoning",
64
+ "enabled"
65
+ ]
66
+ }
67
+ }
68
+ }
69
+ }
70
+ }
71
+ },
26
72
  "x-events": []
27
73
  }
28
74
  },
29
75
  "/addCron": {
30
76
  "post": {
31
- "tags": ["service"],
77
+ "tags": [
78
+ "service"
79
+ ],
32
80
  "summary": "Adds a Schedule",
33
81
  "parameters": [
34
82
  {
@@ -82,7 +130,9 @@
82
130
  },
83
131
  "/deleteCron": {
84
132
  "post": {
85
- "tags": ["service"],
133
+ "tags": [
134
+ "service"
135
+ ],
86
136
  "summary": "Deletes a Schedule",
87
137
  "parameters": [
88
138
  {
@@ -109,7 +159,9 @@
109
159
  },
110
160
  "/enableCron": {
111
161
  "post": {
112
- "tags": ["service"],
162
+ "tags": [
163
+ "service"
164
+ ],
113
165
  "summary": "Enables a Schedule",
114
166
  "parameters": [
115
167
  {
@@ -136,7 +188,9 @@
136
188
  },
137
189
  "/disableCron": {
138
190
  "post": {
139
- "tags": ["service"],
191
+ "tags": [
192
+ "service"
193
+ ],
140
194
  "summary": "Disables a Schedule",
141
195
  "parameters": [
142
196
  {