@digipair/skill-cron 0.38.6 → 0.39.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.
- package/index.cjs.js +14 -6
- package/index.esm.js +14 -6
- package/package.json +1 -1
- package/schema.fr.json +9 -0
- package/schema.json +9 -0
package/index.cjs.js
CHANGED
|
@@ -9957,24 +9957,32 @@ let CronService = class CronService {
|
|
|
9957
9957
|
async initialize(startTask) {
|
|
9958
9958
|
this.startTask = startTask;
|
|
9959
9959
|
}
|
|
9960
|
-
async start(path) {
|
|
9960
|
+
async start(path, utcOffset = 'Europe/Paris') {
|
|
9961
9961
|
const content = await fs.promises.readFile(`${path}/planning.jsonl`, 'utf8');
|
|
9962
9962
|
const lines = content.split('\n').filter((line)=>line !== '');
|
|
9963
9963
|
const planning = lines.map((line)=>JSON.parse(line));
|
|
9964
9964
|
for (const plan of planning){
|
|
9965
|
+
if (plan.time === '@startup' && plan.enabled) {
|
|
9966
|
+
await this.startTask(path, plan.digipair, plan.reasoning);
|
|
9967
|
+
continue;
|
|
9968
|
+
}
|
|
9965
9969
|
const job = new dist.CronJob(plan.time, async ()=>{
|
|
9966
9970
|
await this.startTask(path, plan.digipair, plan.reasoning);
|
|
9967
|
-
}, null, !!plan.enabled,
|
|
9971
|
+
}, null, !!plan.enabled, utcOffset);
|
|
9968
9972
|
if (this.jobs[plan.id]) {
|
|
9969
9973
|
this.jobs[plan.id].stop();
|
|
9970
9974
|
}
|
|
9971
9975
|
this.jobs[plan.id] = job;
|
|
9972
9976
|
}
|
|
9973
9977
|
}
|
|
9974
|
-
addJob(path, id, digipair, reasoning, time) {
|
|
9978
|
+
addJob(path, id, digipair, reasoning, time, utcOffset) {
|
|
9979
|
+
if (time === '@startup') {
|
|
9980
|
+
this.startTask(path, digipair, reasoning);
|
|
9981
|
+
return;
|
|
9982
|
+
}
|
|
9975
9983
|
const job = new dist.CronJob(time, async ()=>{
|
|
9976
9984
|
await this.startTask(path, digipair, reasoning);
|
|
9977
|
-
}, null, true,
|
|
9985
|
+
}, null, true, utcOffset);
|
|
9978
9986
|
if (this.jobs[id]) {
|
|
9979
9987
|
this.jobs[id].stop();
|
|
9980
9988
|
}
|
|
@@ -10011,7 +10019,7 @@ let CronService = class CronService {
|
|
|
10011
10019
|
async addCron(params, _pinsSettingsList, context) {
|
|
10012
10020
|
var _context_privates;
|
|
10013
10021
|
var _context_privates_EDITOR_PATH;
|
|
10014
|
-
const { path = (_context_privates_EDITOR_PATH = (_context_privates = context.privates) == null ? void 0 : _context_privates.EDITOR_PATH) != null ? _context_privates_EDITOR_PATH : process.env['DIGIPAIR_FACTORY_PATH'] ? `${process.env['DIGIPAIR_FACTORY_PATH']}/digipairs` : './factory/digipairs', time, digipair, reasoning } = params;
|
|
10022
|
+
const { path = (_context_privates_EDITOR_PATH = (_context_privates = context.privates) == null ? void 0 : _context_privates.EDITOR_PATH) != null ? _context_privates_EDITOR_PATH : process.env['DIGIPAIR_FACTORY_PATH'] ? `${process.env['DIGIPAIR_FACTORY_PATH']}/digipairs` : './factory/digipairs', utcOffset = 'Europe/Paris', time, digipair, reasoning } = params;
|
|
10015
10023
|
const cron = {
|
|
10016
10024
|
id: v4(),
|
|
10017
10025
|
time,
|
|
@@ -10020,7 +10028,7 @@ let CronService = class CronService {
|
|
|
10020
10028
|
enabled: true
|
|
10021
10029
|
};
|
|
10022
10030
|
await fs.promises.appendFile(`${path}/planning.jsonl`, '\n' + JSON.stringify(cron), 'utf8');
|
|
10023
|
-
this.addJob(path, cron.id, digipair, reasoning, time);
|
|
10031
|
+
this.addJob(path, cron.id, digipair, reasoning, time, utcOffset);
|
|
10024
10032
|
return cron;
|
|
10025
10033
|
}
|
|
10026
10034
|
async deleteCron(params, _pinsSettingsList, context) {
|
package/index.esm.js
CHANGED
|
@@ -9949,24 +9949,32 @@ let CronService = class CronService {
|
|
|
9949
9949
|
async initialize(startTask) {
|
|
9950
9950
|
this.startTask = startTask;
|
|
9951
9951
|
}
|
|
9952
|
-
async start(path) {
|
|
9952
|
+
async start(path, utcOffset = 'Europe/Paris') {
|
|
9953
9953
|
const content = await promises.readFile(`${path}/planning.jsonl`, 'utf8');
|
|
9954
9954
|
const lines = content.split('\n').filter((line)=>line !== '');
|
|
9955
9955
|
const planning = lines.map((line)=>JSON.parse(line));
|
|
9956
9956
|
for (const plan of planning){
|
|
9957
|
+
if (plan.time === '@startup' && plan.enabled) {
|
|
9958
|
+
await this.startTask(path, plan.digipair, plan.reasoning);
|
|
9959
|
+
continue;
|
|
9960
|
+
}
|
|
9957
9961
|
const job = new dist.CronJob(plan.time, async ()=>{
|
|
9958
9962
|
await this.startTask(path, plan.digipair, plan.reasoning);
|
|
9959
|
-
}, null, !!plan.enabled,
|
|
9963
|
+
}, null, !!plan.enabled, utcOffset);
|
|
9960
9964
|
if (this.jobs[plan.id]) {
|
|
9961
9965
|
this.jobs[plan.id].stop();
|
|
9962
9966
|
}
|
|
9963
9967
|
this.jobs[plan.id] = job;
|
|
9964
9968
|
}
|
|
9965
9969
|
}
|
|
9966
|
-
addJob(path, id, digipair, reasoning, time) {
|
|
9970
|
+
addJob(path, id, digipair, reasoning, time, utcOffset) {
|
|
9971
|
+
if (time === '@startup') {
|
|
9972
|
+
this.startTask(path, digipair, reasoning);
|
|
9973
|
+
return;
|
|
9974
|
+
}
|
|
9967
9975
|
const job = new dist.CronJob(time, async ()=>{
|
|
9968
9976
|
await this.startTask(path, digipair, reasoning);
|
|
9969
|
-
}, null, true,
|
|
9977
|
+
}, null, true, utcOffset);
|
|
9970
9978
|
if (this.jobs[id]) {
|
|
9971
9979
|
this.jobs[id].stop();
|
|
9972
9980
|
}
|
|
@@ -10003,7 +10011,7 @@ let CronService = class CronService {
|
|
|
10003
10011
|
async addCron(params, _pinsSettingsList, context) {
|
|
10004
10012
|
var _context_privates;
|
|
10005
10013
|
var _context_privates_EDITOR_PATH;
|
|
10006
|
-
const { path = (_context_privates_EDITOR_PATH = (_context_privates = context.privates) == null ? void 0 : _context_privates.EDITOR_PATH) != null ? _context_privates_EDITOR_PATH : process.env['DIGIPAIR_FACTORY_PATH'] ? `${process.env['DIGIPAIR_FACTORY_PATH']}/digipairs` : './factory/digipairs', time, digipair, reasoning } = params;
|
|
10014
|
+
const { path = (_context_privates_EDITOR_PATH = (_context_privates = context.privates) == null ? void 0 : _context_privates.EDITOR_PATH) != null ? _context_privates_EDITOR_PATH : process.env['DIGIPAIR_FACTORY_PATH'] ? `${process.env['DIGIPAIR_FACTORY_PATH']}/digipairs` : './factory/digipairs', utcOffset = 'Europe/Paris', time, digipair, reasoning } = params;
|
|
10007
10015
|
const cron = {
|
|
10008
10016
|
id: v4(),
|
|
10009
10017
|
time,
|
|
@@ -10012,7 +10020,7 @@ let CronService = class CronService {
|
|
|
10012
10020
|
enabled: true
|
|
10013
10021
|
};
|
|
10014
10022
|
await promises.appendFile(`${path}/planning.jsonl`, '\n' + JSON.stringify(cron), 'utf8');
|
|
10015
|
-
this.addJob(path, cron.id, digipair, reasoning, time);
|
|
10023
|
+
this.addJob(path, cron.id, digipair, reasoning, time, utcOffset);
|
|
10016
10024
|
return cron;
|
|
10017
10025
|
}
|
|
10018
10026
|
async deleteCron(params, _pinsSettingsList, context) {
|
package/package.json
CHANGED
package/schema.fr.json
CHANGED
package/schema.json
CHANGED