@stonyx/cron 0.2.1-alpha.3 → 0.2.1-alpha.5
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/README.md +4 -0
- package/dist/cron-parser.d.ts +30 -0
- package/dist/cron-parser.js +200 -0
- package/dist/job.d.ts +72 -0
- package/dist/job.js +172 -0
- package/dist/locked.d.ts +13 -0
- package/dist/locked.js +27 -0
- package/dist/main.d.ts +20 -0
- package/dist/main.js +101 -0
- package/dist/min-heap.d.ts +13 -0
- package/dist/min-heap.js +67 -0
- package/dist/normalize.d.ts +49 -0
- package/dist/normalize.js +148 -0
- package/dist/run-log.d.ts +44 -0
- package/dist/run-log.js +60 -0
- package/dist/schedule.d.ts +23 -0
- package/dist/schedule.js +65 -0
- package/dist/service.d.ts +85 -0
- package/dist/service.js +271 -0
- package/package.json +49 -15
- package/.claude/architecture.md +0 -215
- package/.claude/extension-guide.md +0 -291
- package/.claude/improvements.md +0 -53
- package/.claude/project-structure.md +0 -139
- package/.claude/testing.md +0 -85
- package/.github/workflows/ci.yml +0 -16
- package/.github/workflows/publish.yml +0 -51
- package/.gitignore +0 -16
- package/.npmignore +0 -7
- package/logs/error.log +0 -4
- package/pnpm-lock.yaml +0 -370
- package/src/cron-parser.js +0 -246
- package/src/job.js +0 -200
- package/src/locked.js +0 -34
- package/src/main.js +0 -112
- package/src/min-heap.js +0 -73
- package/src/normalize.js +0 -163
- package/src/run-log.js +0 -79
- package/src/schedule.js +0 -81
- package/src/service.js +0 -303
- package/stonyx-bootstrap.cjs +0 -9
package/pnpm-lock.yaml
DELETED
|
@@ -1,370 +0,0 @@
|
|
|
1
|
-
lockfileVersion: '9.0'
|
|
2
|
-
|
|
3
|
-
settings:
|
|
4
|
-
autoInstallPeers: true
|
|
5
|
-
excludeLinksFromLockfile: false
|
|
6
|
-
|
|
7
|
-
importers:
|
|
8
|
-
|
|
9
|
-
.:
|
|
10
|
-
dependencies:
|
|
11
|
-
stonyx:
|
|
12
|
-
specifier: 0.2.3-beta.11
|
|
13
|
-
version: 0.2.3-beta.11
|
|
14
|
-
devDependencies:
|
|
15
|
-
'@stonyx/utils':
|
|
16
|
-
specifier: 0.2.3-beta.7
|
|
17
|
-
version: 0.2.3-beta.7
|
|
18
|
-
qunit:
|
|
19
|
-
specifier: ^2.24.1
|
|
20
|
-
version: 2.25.0
|
|
21
|
-
sinon:
|
|
22
|
-
specifier: ^21.0.0
|
|
23
|
-
version: 21.0.1
|
|
24
|
-
|
|
25
|
-
packages:
|
|
26
|
-
|
|
27
|
-
'@sinonjs/commons@3.0.1':
|
|
28
|
-
resolution: {integrity: sha512-K3mCHKQ9sVh8o1C9cxkwxaOmXoAMlDxC1mYyHrjqOWEcBjYr76t96zL2zlj5dUGZ3HSw240X1qgH3Mjf1yJWpQ==}
|
|
29
|
-
|
|
30
|
-
'@sinonjs/fake-timers@15.1.0':
|
|
31
|
-
resolution: {integrity: sha512-cqfapCxwTGsrR80FEgOoPsTonoefMBY7dnUEbQ+GRcved0jvkJLzvX6F4WtN+HBqbPX/SiFsIRUp+IrCW/2I2w==}
|
|
32
|
-
|
|
33
|
-
'@sinonjs/samsam@8.0.3':
|
|
34
|
-
resolution: {integrity: sha512-hw6HbX+GyVZzmaYNh82Ecj1vdGZrqVIn/keDTg63IgAwiQPO+xCz99uG6Woqgb4tM0mUiFENKZ4cqd7IX94AXQ==}
|
|
35
|
-
|
|
36
|
-
'@stonyx/utils@0.2.3-beta.7':
|
|
37
|
-
resolution: {integrity: sha512-SF6ZZZJ/f1n/+SJJDj8BJdlgvv+WDLGWGUMIkwTpruA5jv/AYJqSoVIgTpYfuMTnYDIsp3KoruaIKy/qd2ETPQ==}
|
|
38
|
-
|
|
39
|
-
call-bind-apply-helpers@1.0.2:
|
|
40
|
-
resolution: {integrity: sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==}
|
|
41
|
-
engines: {node: '>= 0.4'}
|
|
42
|
-
|
|
43
|
-
call-bound@1.0.4:
|
|
44
|
-
resolution: {integrity: sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==}
|
|
45
|
-
engines: {node: '>= 0.4'}
|
|
46
|
-
|
|
47
|
-
chalk@5.6.2:
|
|
48
|
-
resolution: {integrity: sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA==}
|
|
49
|
-
engines: {node: ^12.17.0 || ^14.13 || >=16.0.0}
|
|
50
|
-
|
|
51
|
-
commander@7.2.0:
|
|
52
|
-
resolution: {integrity: sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==}
|
|
53
|
-
engines: {node: '>= 10'}
|
|
54
|
-
|
|
55
|
-
diff@8.0.3:
|
|
56
|
-
resolution: {integrity: sha512-qejHi7bcSD4hQAZE0tNAawRK1ZtafHDmMTMkrrIGgSLl7hTnQHmKCeB45xAcbfTqK2zowkM3j3bHt/4b/ARbYQ==}
|
|
57
|
-
engines: {node: '>=0.3.1'}
|
|
58
|
-
|
|
59
|
-
dunder-proto@1.0.1:
|
|
60
|
-
resolution: {integrity: sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==}
|
|
61
|
-
engines: {node: '>= 0.4'}
|
|
62
|
-
|
|
63
|
-
es-define-property@1.0.1:
|
|
64
|
-
resolution: {integrity: sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==}
|
|
65
|
-
engines: {node: '>= 0.4'}
|
|
66
|
-
|
|
67
|
-
es-errors@1.3.0:
|
|
68
|
-
resolution: {integrity: sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==}
|
|
69
|
-
engines: {node: '>= 0.4'}
|
|
70
|
-
|
|
71
|
-
es-object-atoms@1.1.1:
|
|
72
|
-
resolution: {integrity: sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==}
|
|
73
|
-
engines: {node: '>= 0.4'}
|
|
74
|
-
|
|
75
|
-
fs@0.0.1-security:
|
|
76
|
-
resolution: {integrity: sha512-3XY9e1pP0CVEUCdj5BmfIZxRBTSDycnbqhIOGec9QYtmVH2fbLpj86CFWkrNOkt/Fvty4KZG5lTglL9j/gJ87w==}
|
|
77
|
-
|
|
78
|
-
function-bind@1.1.2:
|
|
79
|
-
resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==}
|
|
80
|
-
|
|
81
|
-
get-intrinsic@1.3.0:
|
|
82
|
-
resolution: {integrity: sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==}
|
|
83
|
-
engines: {node: '>= 0.4'}
|
|
84
|
-
|
|
85
|
-
get-proto@1.0.1:
|
|
86
|
-
resolution: {integrity: sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==}
|
|
87
|
-
engines: {node: '>= 0.4'}
|
|
88
|
-
|
|
89
|
-
globalyzer@0.1.0:
|
|
90
|
-
resolution: {integrity: sha512-40oNTM9UfG6aBmuKxk/giHn5nQ8RVz/SS4Ir6zgzOv9/qC3kKZ9v4etGTcJbEl/NyVQH7FGU7d+X1egr57Md2Q==}
|
|
91
|
-
|
|
92
|
-
globrex@0.1.2:
|
|
93
|
-
resolution: {integrity: sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==}
|
|
94
|
-
|
|
95
|
-
gopd@1.2.0:
|
|
96
|
-
resolution: {integrity: sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==}
|
|
97
|
-
engines: {node: '>= 0.4'}
|
|
98
|
-
|
|
99
|
-
has-flag@4.0.0:
|
|
100
|
-
resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==}
|
|
101
|
-
engines: {node: '>=8'}
|
|
102
|
-
|
|
103
|
-
has-symbols@1.1.0:
|
|
104
|
-
resolution: {integrity: sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==}
|
|
105
|
-
engines: {node: '>= 0.4'}
|
|
106
|
-
|
|
107
|
-
hasown@2.0.2:
|
|
108
|
-
resolution: {integrity: sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==}
|
|
109
|
-
engines: {node: '>= 0.4'}
|
|
110
|
-
|
|
111
|
-
inherits@2.0.3:
|
|
112
|
-
resolution: {integrity: sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw==}
|
|
113
|
-
|
|
114
|
-
math-intrinsics@1.1.0:
|
|
115
|
-
resolution: {integrity: sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==}
|
|
116
|
-
engines: {node: '>= 0.4'}
|
|
117
|
-
|
|
118
|
-
node-chronicle@0.2.0:
|
|
119
|
-
resolution: {integrity: sha512-se9NsW67UZqDFbK/+Rbml9KdCVTwzaadIgL4NDBcDpLMhOf1qerRxXicE+/dBsoyhDqWCwAFbBjR3iytF3gepA==}
|
|
120
|
-
|
|
121
|
-
node-watch@0.7.3:
|
|
122
|
-
resolution: {integrity: sha512-3l4E8uMPY1HdMMryPRUAl+oIHtXtyiTlIiESNSVSNxcPfzAFzeTbXFQkZfAwBbo0B1qMSG8nUABx+Gd+YrbKrQ==}
|
|
123
|
-
engines: {node: '>=6'}
|
|
124
|
-
|
|
125
|
-
object-inspect@1.13.4:
|
|
126
|
-
resolution: {integrity: sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==}
|
|
127
|
-
engines: {node: '>= 0.4'}
|
|
128
|
-
|
|
129
|
-
path@0.12.7:
|
|
130
|
-
resolution: {integrity: sha512-aXXC6s+1w7otVF9UletFkFcDsJeO7lSZBPUQhtb5O0xJe8LtYhj/GxldoL09bBj9+ZmE2hNoHqQSFMN5fikh4Q==}
|
|
131
|
-
|
|
132
|
-
process@0.11.10:
|
|
133
|
-
resolution: {integrity: sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==}
|
|
134
|
-
engines: {node: '>= 0.6.0'}
|
|
135
|
-
|
|
136
|
-
punycode@1.4.1:
|
|
137
|
-
resolution: {integrity: sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ==}
|
|
138
|
-
|
|
139
|
-
qs@6.14.1:
|
|
140
|
-
resolution: {integrity: sha512-4EK3+xJl8Ts67nLYNwqw/dsFVnCf+qR7RgXSK9jEEm9unao3njwMDdmsdvoKBKHzxd7tCYz5e5M+SnMjdtXGQQ==}
|
|
141
|
-
engines: {node: '>=0.6'}
|
|
142
|
-
|
|
143
|
-
qunit@2.25.0:
|
|
144
|
-
resolution: {integrity: sha512-MONPKgjavgTqArCwZOEz8nEMbA19zNXIp5ZOW9rPYj5cbgQp0fiI36c9dPTSzTRRzx+KcfB5eggYB/ENqxi0+w==}
|
|
145
|
-
engines: {node: '>=10'}
|
|
146
|
-
hasBin: true
|
|
147
|
-
|
|
148
|
-
side-channel-list@1.0.0:
|
|
149
|
-
resolution: {integrity: sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==}
|
|
150
|
-
engines: {node: '>= 0.4'}
|
|
151
|
-
|
|
152
|
-
side-channel-map@1.0.1:
|
|
153
|
-
resolution: {integrity: sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==}
|
|
154
|
-
engines: {node: '>= 0.4'}
|
|
155
|
-
|
|
156
|
-
side-channel-weakmap@1.0.2:
|
|
157
|
-
resolution: {integrity: sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==}
|
|
158
|
-
engines: {node: '>= 0.4'}
|
|
159
|
-
|
|
160
|
-
side-channel@1.1.0:
|
|
161
|
-
resolution: {integrity: sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==}
|
|
162
|
-
engines: {node: '>= 0.4'}
|
|
163
|
-
|
|
164
|
-
sinon@21.0.1:
|
|
165
|
-
resolution: {integrity: sha512-Z0NVCW45W8Mg5oC/27/+fCqIHFnW8kpkFOq0j9XJIev4Ld0mKmERaZv5DMLAb9fGCevjKwaEeIQz5+MBXfZcDw==}
|
|
166
|
-
|
|
167
|
-
stonyx@0.2.3-beta.11:
|
|
168
|
-
resolution: {integrity: sha512-HqDH7/8q7JeuTOdlekY8BGAM8FGHWTLKPWhd3xC6dAYBvK1zQWJrzINbIIymemReBxy/sDw3cs7PG8kcoOK1dg==}
|
|
169
|
-
hasBin: true
|
|
170
|
-
|
|
171
|
-
supports-color@7.2.0:
|
|
172
|
-
resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==}
|
|
173
|
-
engines: {node: '>=8'}
|
|
174
|
-
|
|
175
|
-
tiny-glob@0.2.9:
|
|
176
|
-
resolution: {integrity: sha512-g/55ssRPUjShh+xkfx9UPDXqhckHEsHr4Vd9zX55oSdGZc/MD0m3sferOkwWtp98bv+kcVfEHtRJgBVJzelrzg==}
|
|
177
|
-
|
|
178
|
-
type-detect@4.0.8:
|
|
179
|
-
resolution: {integrity: sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==}
|
|
180
|
-
engines: {node: '>=4'}
|
|
181
|
-
|
|
182
|
-
type-detect@4.1.0:
|
|
183
|
-
resolution: {integrity: sha512-Acylog8/luQ8L7il+geoSxhEkazvkslg7PSNKOX59mbB9cOveP5aq9h74Y7YU8yDpJwetzQQrfIwtf4Wp4LKcw==}
|
|
184
|
-
engines: {node: '>=4'}
|
|
185
|
-
|
|
186
|
-
url@0.11.4:
|
|
187
|
-
resolution: {integrity: sha512-oCwdVC7mTuWiPyjLUz/COz5TLk6wgp0RCsN+wHZ2Ekneac9w8uuV0njcbbie2ME+Vs+d6duwmYuR3HgQXs1fOg==}
|
|
188
|
-
engines: {node: '>= 0.4'}
|
|
189
|
-
|
|
190
|
-
util@0.10.4:
|
|
191
|
-
resolution: {integrity: sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==}
|
|
192
|
-
|
|
193
|
-
snapshots:
|
|
194
|
-
|
|
195
|
-
'@sinonjs/commons@3.0.1':
|
|
196
|
-
dependencies:
|
|
197
|
-
type-detect: 4.0.8
|
|
198
|
-
|
|
199
|
-
'@sinonjs/fake-timers@15.1.0':
|
|
200
|
-
dependencies:
|
|
201
|
-
'@sinonjs/commons': 3.0.1
|
|
202
|
-
|
|
203
|
-
'@sinonjs/samsam@8.0.3':
|
|
204
|
-
dependencies:
|
|
205
|
-
'@sinonjs/commons': 3.0.1
|
|
206
|
-
type-detect: 4.1.0
|
|
207
|
-
|
|
208
|
-
'@stonyx/utils@0.2.3-beta.7': {}
|
|
209
|
-
|
|
210
|
-
call-bind-apply-helpers@1.0.2:
|
|
211
|
-
dependencies:
|
|
212
|
-
es-errors: 1.3.0
|
|
213
|
-
function-bind: 1.1.2
|
|
214
|
-
|
|
215
|
-
call-bound@1.0.4:
|
|
216
|
-
dependencies:
|
|
217
|
-
call-bind-apply-helpers: 1.0.2
|
|
218
|
-
get-intrinsic: 1.3.0
|
|
219
|
-
|
|
220
|
-
chalk@5.6.2: {}
|
|
221
|
-
|
|
222
|
-
commander@7.2.0: {}
|
|
223
|
-
|
|
224
|
-
diff@8.0.3: {}
|
|
225
|
-
|
|
226
|
-
dunder-proto@1.0.1:
|
|
227
|
-
dependencies:
|
|
228
|
-
call-bind-apply-helpers: 1.0.2
|
|
229
|
-
es-errors: 1.3.0
|
|
230
|
-
gopd: 1.2.0
|
|
231
|
-
|
|
232
|
-
es-define-property@1.0.1: {}
|
|
233
|
-
|
|
234
|
-
es-errors@1.3.0: {}
|
|
235
|
-
|
|
236
|
-
es-object-atoms@1.1.1:
|
|
237
|
-
dependencies:
|
|
238
|
-
es-errors: 1.3.0
|
|
239
|
-
|
|
240
|
-
fs@0.0.1-security: {}
|
|
241
|
-
|
|
242
|
-
function-bind@1.1.2: {}
|
|
243
|
-
|
|
244
|
-
get-intrinsic@1.3.0:
|
|
245
|
-
dependencies:
|
|
246
|
-
call-bind-apply-helpers: 1.0.2
|
|
247
|
-
es-define-property: 1.0.1
|
|
248
|
-
es-errors: 1.3.0
|
|
249
|
-
es-object-atoms: 1.1.1
|
|
250
|
-
function-bind: 1.1.2
|
|
251
|
-
get-proto: 1.0.1
|
|
252
|
-
gopd: 1.2.0
|
|
253
|
-
has-symbols: 1.1.0
|
|
254
|
-
hasown: 2.0.2
|
|
255
|
-
math-intrinsics: 1.1.0
|
|
256
|
-
|
|
257
|
-
get-proto@1.0.1:
|
|
258
|
-
dependencies:
|
|
259
|
-
dunder-proto: 1.0.1
|
|
260
|
-
es-object-atoms: 1.1.1
|
|
261
|
-
|
|
262
|
-
globalyzer@0.1.0: {}
|
|
263
|
-
|
|
264
|
-
globrex@0.1.2: {}
|
|
265
|
-
|
|
266
|
-
gopd@1.2.0: {}
|
|
267
|
-
|
|
268
|
-
has-flag@4.0.0: {}
|
|
269
|
-
|
|
270
|
-
has-symbols@1.1.0: {}
|
|
271
|
-
|
|
272
|
-
hasown@2.0.2:
|
|
273
|
-
dependencies:
|
|
274
|
-
function-bind: 1.1.2
|
|
275
|
-
|
|
276
|
-
inherits@2.0.3: {}
|
|
277
|
-
|
|
278
|
-
math-intrinsics@1.1.0: {}
|
|
279
|
-
|
|
280
|
-
node-chronicle@0.2.0:
|
|
281
|
-
dependencies:
|
|
282
|
-
chalk: 5.6.2
|
|
283
|
-
fs: 0.0.1-security
|
|
284
|
-
path: 0.12.7
|
|
285
|
-
url: 0.11.4
|
|
286
|
-
|
|
287
|
-
node-watch@0.7.3: {}
|
|
288
|
-
|
|
289
|
-
object-inspect@1.13.4: {}
|
|
290
|
-
|
|
291
|
-
path@0.12.7:
|
|
292
|
-
dependencies:
|
|
293
|
-
process: 0.11.10
|
|
294
|
-
util: 0.10.4
|
|
295
|
-
|
|
296
|
-
process@0.11.10: {}
|
|
297
|
-
|
|
298
|
-
punycode@1.4.1: {}
|
|
299
|
-
|
|
300
|
-
qs@6.14.1:
|
|
301
|
-
dependencies:
|
|
302
|
-
side-channel: 1.1.0
|
|
303
|
-
|
|
304
|
-
qunit@2.25.0:
|
|
305
|
-
dependencies:
|
|
306
|
-
commander: 7.2.0
|
|
307
|
-
node-watch: 0.7.3
|
|
308
|
-
tiny-glob: 0.2.9
|
|
309
|
-
|
|
310
|
-
side-channel-list@1.0.0:
|
|
311
|
-
dependencies:
|
|
312
|
-
es-errors: 1.3.0
|
|
313
|
-
object-inspect: 1.13.4
|
|
314
|
-
|
|
315
|
-
side-channel-map@1.0.1:
|
|
316
|
-
dependencies:
|
|
317
|
-
call-bound: 1.0.4
|
|
318
|
-
es-errors: 1.3.0
|
|
319
|
-
get-intrinsic: 1.3.0
|
|
320
|
-
object-inspect: 1.13.4
|
|
321
|
-
|
|
322
|
-
side-channel-weakmap@1.0.2:
|
|
323
|
-
dependencies:
|
|
324
|
-
call-bound: 1.0.4
|
|
325
|
-
es-errors: 1.3.0
|
|
326
|
-
get-intrinsic: 1.3.0
|
|
327
|
-
object-inspect: 1.13.4
|
|
328
|
-
side-channel-map: 1.0.1
|
|
329
|
-
|
|
330
|
-
side-channel@1.1.0:
|
|
331
|
-
dependencies:
|
|
332
|
-
es-errors: 1.3.0
|
|
333
|
-
object-inspect: 1.13.4
|
|
334
|
-
side-channel-list: 1.0.0
|
|
335
|
-
side-channel-map: 1.0.1
|
|
336
|
-
side-channel-weakmap: 1.0.2
|
|
337
|
-
|
|
338
|
-
sinon@21.0.1:
|
|
339
|
-
dependencies:
|
|
340
|
-
'@sinonjs/commons': 3.0.1
|
|
341
|
-
'@sinonjs/fake-timers': 15.1.0
|
|
342
|
-
'@sinonjs/samsam': 8.0.3
|
|
343
|
-
diff: 8.0.3
|
|
344
|
-
supports-color: 7.2.0
|
|
345
|
-
|
|
346
|
-
stonyx@0.2.3-beta.11:
|
|
347
|
-
dependencies:
|
|
348
|
-
node-chronicle: 0.2.0
|
|
349
|
-
|
|
350
|
-
supports-color@7.2.0:
|
|
351
|
-
dependencies:
|
|
352
|
-
has-flag: 4.0.0
|
|
353
|
-
|
|
354
|
-
tiny-glob@0.2.9:
|
|
355
|
-
dependencies:
|
|
356
|
-
globalyzer: 0.1.0
|
|
357
|
-
globrex: 0.1.2
|
|
358
|
-
|
|
359
|
-
type-detect@4.0.8: {}
|
|
360
|
-
|
|
361
|
-
type-detect@4.1.0: {}
|
|
362
|
-
|
|
363
|
-
url@0.11.4:
|
|
364
|
-
dependencies:
|
|
365
|
-
punycode: 1.4.1
|
|
366
|
-
qs: 6.14.1
|
|
367
|
-
|
|
368
|
-
util@0.10.4:
|
|
369
|
-
dependencies:
|
|
370
|
-
inherits: 2.0.3
|
package/src/cron-parser.js
DELETED
|
@@ -1,246 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 5-field cron expression parser with next-occurrence computation.
|
|
3
|
-
* No external dependencies — built for stonyx-cron.
|
|
4
|
-
*
|
|
5
|
-
* Fields: minute(0-59) hour(0-23) day-of-month(1-31) month(1-12) day-of-week(0-6)
|
|
6
|
-
* Supports: wildcards(*), ranges(1-5), steps(* /5), lists(1,3,5), names(jan-dec, sun-sat)
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
const MONTH_NAMES = { jan: 1, feb: 2, mar: 3, apr: 4, may: 5, jun: 6, jul: 7, aug: 8, sep: 9, oct: 10, nov: 11, dec: 12 };
|
|
10
|
-
const DAY_NAMES = { sun: 0, mon: 1, tue: 2, wed: 3, thu: 4, fri: 5, sat: 6 };
|
|
11
|
-
|
|
12
|
-
const FIELD_RANGES = [
|
|
13
|
-
{ min: 0, max: 59 }, // minute
|
|
14
|
-
{ min: 0, max: 23 }, // hour
|
|
15
|
-
{ min: 1, max: 31 }, // day of month
|
|
16
|
-
{ min: 1, max: 12 }, // month
|
|
17
|
-
{ min: 0, max: 6 }, // day of week
|
|
18
|
-
];
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Parse a single cron field into a sorted array of allowed values.
|
|
22
|
-
* @param {string} field - The field string (e.g., "1-5", "* /15", "mon,wed,fri")
|
|
23
|
-
* @param {number} fieldIndex - Index (0=minute, 1=hour, 2=dom, 3=month, 4=dow)
|
|
24
|
-
* @returns {number[]} Sorted array of allowed integer values
|
|
25
|
-
*/
|
|
26
|
-
export function parseField(field, fieldIndex) {
|
|
27
|
-
const { min, max } = FIELD_RANGES[fieldIndex];
|
|
28
|
-
const names = fieldIndex === 3 ? MONTH_NAMES : fieldIndex === 4 ? DAY_NAMES : null;
|
|
29
|
-
|
|
30
|
-
const resolveToken = (token) => {
|
|
31
|
-
if (names) {
|
|
32
|
-
const lower = token.toLowerCase();
|
|
33
|
-
if (lower in names) return names[lower];
|
|
34
|
-
}
|
|
35
|
-
const n = Number(token);
|
|
36
|
-
if (!Number.isInteger(n)) throw new Error(`Invalid cron value: "${token}" in field ${fieldIndex}`);
|
|
37
|
-
// Normalize day-of-week 7 → 0 (both mean Sunday)
|
|
38
|
-
if (fieldIndex === 4 && n === 7) return 0;
|
|
39
|
-
return n;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
const results = new Set();
|
|
43
|
-
|
|
44
|
-
for (const part of field.split(',')) {
|
|
45
|
-
const trimmed = part.trim();
|
|
46
|
-
const [rangeStr, stepStr] = trimmed.split('/');
|
|
47
|
-
const step = stepStr !== undefined ? Number(stepStr) : 1;
|
|
48
|
-
|
|
49
|
-
if (!Number.isInteger(step) || step < 1) {
|
|
50
|
-
throw new Error(`Invalid step "${stepStr}" in cron field ${fieldIndex}`);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
let start, end;
|
|
54
|
-
|
|
55
|
-
if (rangeStr === '*') {
|
|
56
|
-
start = min;
|
|
57
|
-
end = max;
|
|
58
|
-
} else if (rangeStr.includes('-')) {
|
|
59
|
-
const [lo, hi] = rangeStr.split('-');
|
|
60
|
-
start = resolveToken(lo);
|
|
61
|
-
end = resolveToken(hi);
|
|
62
|
-
} else {
|
|
63
|
-
start = resolveToken(rangeStr);
|
|
64
|
-
end = stepStr !== undefined ? max : start;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
if (start < min || start > max || end < min || end > max) {
|
|
68
|
-
throw new Error(`Value out of range [${min}-${max}] in cron field ${fieldIndex}: "${trimmed}"`);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
for (let v = start; v <= end; v += step) {
|
|
72
|
-
results.add(v);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
return [...results].sort((a, b) => a - b);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Parse a 5-field cron expression into field arrays.
|
|
81
|
-
* @param {string} expr - Cron expression (e.g., "0 9 * * 1-5")
|
|
82
|
-
* @returns {{ minutes: number[], hours: number[], daysOfMonth: number[], months: number[], daysOfWeek: number[] }}
|
|
83
|
-
*/
|
|
84
|
-
export function parseCronExpression(expr) {
|
|
85
|
-
const fields = expr.trim().split(/\s+/);
|
|
86
|
-
if (fields.length !== 5) {
|
|
87
|
-
throw new Error(`Cron expression must have exactly 5 fields, got ${fields.length}: "${expr}"`);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
return {
|
|
91
|
-
minutes: parseField(fields[0], 0),
|
|
92
|
-
hours: parseField(fields[1], 1),
|
|
93
|
-
daysOfMonth: parseField(fields[2], 2),
|
|
94
|
-
months: parseField(fields[3], 3),
|
|
95
|
-
daysOfWeek: parseField(fields[4], 4),
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Get the number of days in a given month/year.
|
|
101
|
-
*/
|
|
102
|
-
function daysInMonth(year, month) {
|
|
103
|
-
return new Date(year, month, 0).getDate();
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Check if a day-of-month + day-of-week pair matches the parsed expression.
|
|
108
|
-
*
|
|
109
|
-
* Standard cron behavior: if BOTH dom and dow are restricted (not *),
|
|
110
|
-
* then EITHER matching is sufficient (OR logic).
|
|
111
|
-
* If only one is restricted, it acts as the sole filter.
|
|
112
|
-
*/
|
|
113
|
-
function dayMatches(parsed, domWild, dowWild, dayOfMonth, dayOfWeek) {
|
|
114
|
-
const domMatch = parsed.daysOfMonth.includes(dayOfMonth);
|
|
115
|
-
const dowMatch = parsed.daysOfWeek.includes(dayOfWeek);
|
|
116
|
-
|
|
117
|
-
if (domWild && dowWild) return true;
|
|
118
|
-
if (domWild) return dowMatch;
|
|
119
|
-
if (dowWild) return domMatch;
|
|
120
|
-
return domMatch || dowMatch; // Both restricted → OR
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* Compute the next occurrence of a cron expression after a given timestamp.
|
|
125
|
-
*
|
|
126
|
-
* @param {string} expr - 5-field cron expression
|
|
127
|
-
* @param {number} afterMs - Timestamp in milliseconds (exclusive — finds strictly after this)
|
|
128
|
-
* @param {string} [tz] - IANA timezone (defaults to system timezone)
|
|
129
|
-
* @returns {number|undefined} Next occurrence in milliseconds, or undefined if none within 4 years
|
|
130
|
-
*/
|
|
131
|
-
export function nextOccurrence(expr, afterMs, tz) {
|
|
132
|
-
const parsed = parseCronExpression(expr);
|
|
133
|
-
const exprFields = expr.trim().split(/\s+/);
|
|
134
|
-
const domWild = exprFields[2] === '*';
|
|
135
|
-
const dowWild = exprFields[4] === '*';
|
|
136
|
-
|
|
137
|
-
// Start from the next whole minute after afterMs
|
|
138
|
-
const startDate = new Date(afterMs);
|
|
139
|
-
startDate.setSeconds(0, 0);
|
|
140
|
-
startDate.setMinutes(startDate.getMinutes() + 1);
|
|
141
|
-
|
|
142
|
-
// Convert to target timezone for field matching
|
|
143
|
-
const formatter = new Intl.DateTimeFormat('en-US', {
|
|
144
|
-
timeZone: tz || undefined,
|
|
145
|
-
year: 'numeric', month: 'numeric', day: 'numeric',
|
|
146
|
-
hour: 'numeric', minute: 'numeric', hour12: false,
|
|
147
|
-
weekday: 'short',
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
const dayMap = { Sun: 0, Mon: 1, Tue: 2, Wed: 3, Thu: 4, Fri: 5, Sat: 6 };
|
|
151
|
-
|
|
152
|
-
// Parse formatted date parts in the target timezone
|
|
153
|
-
function getLocalParts(date) {
|
|
154
|
-
const parts = {};
|
|
155
|
-
for (const { type, value } of formatter.formatToParts(date)) {
|
|
156
|
-
parts[type] = value;
|
|
157
|
-
}
|
|
158
|
-
return {
|
|
159
|
-
year: Number(parts.year),
|
|
160
|
-
month: Number(parts.month),
|
|
161
|
-
day: Number(parts.day),
|
|
162
|
-
hour: Number(parts.hour === '24' ? 0 : parts.hour),
|
|
163
|
-
minute: Number(parts.minute),
|
|
164
|
-
weekday: dayMap[parts.weekday] ?? 0,
|
|
165
|
-
};
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
// Search limit: 4 years of minutes (≈ 2.1M iterations max)
|
|
169
|
-
const maxMs = afterMs + 4 * 365.25 * 24 * 60 * 60 * 1000;
|
|
170
|
-
let candidate = new Date(startDate);
|
|
171
|
-
|
|
172
|
-
while (candidate.getTime() <= maxMs) {
|
|
173
|
-
const p = getLocalParts(candidate);
|
|
174
|
-
|
|
175
|
-
// Check month
|
|
176
|
-
if (!parsed.months.includes(p.month)) {
|
|
177
|
-
// Advance to next matching month
|
|
178
|
-
const nextMonth = parsed.months.find(m => m > p.month);
|
|
179
|
-
if (nextMonth) {
|
|
180
|
-
// Stay in same year, advance to first day of nextMonth
|
|
181
|
-
candidate = advanceToMonth(candidate, p.year, nextMonth, tz, formatter, dayMap);
|
|
182
|
-
} else {
|
|
183
|
-
// Wrap to next year, first matching month
|
|
184
|
-
candidate = advanceToMonth(candidate, p.year + 1, parsed.months[0], tz, formatter, dayMap);
|
|
185
|
-
}
|
|
186
|
-
continue;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
// Check day (dom + dow)
|
|
190
|
-
if (!dayMatches(parsed, domWild, dowWild, p.day, p.weekday)) {
|
|
191
|
-
candidate.setMinutes(candidate.getMinutes() + (24 * 60 - p.hour * 60 - p.minute));
|
|
192
|
-
continue;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
// Check hour
|
|
196
|
-
if (!parsed.hours.includes(p.hour)) {
|
|
197
|
-
const nextHour = parsed.hours.find(h => h > p.hour);
|
|
198
|
-
if (nextHour) {
|
|
199
|
-
candidate.setMinutes(candidate.getMinutes() + ((nextHour - p.hour) * 60 - p.minute));
|
|
200
|
-
} else {
|
|
201
|
-
// Advance to next day
|
|
202
|
-
candidate.setMinutes(candidate.getMinutes() + ((24 - p.hour) * 60 - p.minute));
|
|
203
|
-
}
|
|
204
|
-
continue;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
// Check minute
|
|
208
|
-
if (!parsed.minutes.includes(p.minute)) {
|
|
209
|
-
const nextMin = parsed.minutes.find(m => m > p.minute);
|
|
210
|
-
if (nextMin) {
|
|
211
|
-
candidate.setMinutes(candidate.getMinutes() + (nextMin - p.minute));
|
|
212
|
-
} else {
|
|
213
|
-
// Advance to next hour
|
|
214
|
-
candidate.setMinutes(candidate.getMinutes() + (60 - p.minute));
|
|
215
|
-
}
|
|
216
|
-
continue;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
// All fields match
|
|
220
|
-
return candidate.getTime();
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
return undefined;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
/**
|
|
227
|
-
* Create a Date advanced to the start of a specific month in a specific year,
|
|
228
|
-
* using the target timezone's midnight.
|
|
229
|
-
*/
|
|
230
|
-
function advanceToMonth(current, year, month, tz, formatter, dayMap) {
|
|
231
|
-
// Create a new date at ~start of the target month in UTC, then adjust
|
|
232
|
-
const d = new Date(current);
|
|
233
|
-
// Jump to approximately the right time
|
|
234
|
-
d.setFullYear(year, month - 1, 1);
|
|
235
|
-
d.setHours(0, 0, 0, 0);
|
|
236
|
-
return d;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
/**
|
|
240
|
-
* Validate a cron expression without computing next occurrence.
|
|
241
|
-
* @param {string} expr - 5-field cron expression
|
|
242
|
-
* @throws {Error} if the expression is invalid
|
|
243
|
-
*/
|
|
244
|
-
export function validateCronExpression(expr) {
|
|
245
|
-
parseCronExpression(expr);
|
|
246
|
-
}
|