sails-hook-quest 0.0.1 → 0.0.2

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.
@@ -135,8 +135,9 @@ function addJobDefinition(jobDef, jobs = new Map(), config = {}) {
135
135
  interval: jobDef.interval,
136
136
  timeout: jobDef.timeout,
137
137
  cron: jobDef.cron,
138
- cronValidate: jobDef.cronValidate,
138
+ cronOptions: jobDef.cronOptions,
139
139
  date: jobDef.date,
140
+ timezone: jobDef.timezone,
140
141
 
141
142
  // Input data to pass to the script
142
143
  inputs: jobDef.inputs || {},
@@ -16,15 +16,22 @@ const { CronExpressionParser } = require('cron-parser')
16
16
  */
17
17
  function getNextRunTime(job, config = {}) {
18
18
  const now = new Date()
19
- const timezone = config.timezone
19
+ const timezone = job.timezone || config.timezone
20
+
21
+ // Validate: cannot combine date and timeout
22
+ if (job.date && job.timeout !== undefined && job.timeout !== false) {
23
+ throw new Error(
24
+ `Job "${job.name}": Cannot combine 'date' and 'timeout'. Use one or the other.`
25
+ )
26
+ }
20
27
 
21
28
  // Handle cron expressions
22
29
  if (job.cron) {
23
30
  try {
24
31
  const options = { tz: timezone }
25
- // Merge any cronValidate options
26
- if (job.cronValidate) {
27
- Object.assign(options, job.cronValidate)
32
+ // Merge any cron-parser options (currentDate, startDate, endDate, etc.)
33
+ if (job.cronOptions) {
34
+ Object.assign(options, job.cronOptions)
28
35
  }
29
36
  const interval = CronExpressionParser.parse(job.cron, options)
30
37
  return interval.next().toDate()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sails-hook-quest",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "Elegant job scheduling for Sails.js applications with human-readable intervals, cron expressions, and full Sails context",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {