va-claw 0.1.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.
Files changed (316) hide show
  1. package/CONTRIBUTING.md +36 -0
  2. package/LICENSE +21 -0
  3. package/README.md +337 -0
  4. package/bin/va-claw +3 -0
  5. package/bin/va-claw.mjs +3 -0
  6. package/docs/README.md +6 -0
  7. package/index.html +728 -0
  8. package/package.json +43 -0
  9. package/packages/channels/discord/dist/.tsbuildinfo +1 -0
  10. package/packages/channels/discord/dist/cli-runner.d.ts +18 -0
  11. package/packages/channels/discord/dist/cli-runner.d.ts.map +1 -0
  12. package/packages/channels/discord/dist/cli-runner.js +58 -0
  13. package/packages/channels/discord/dist/cli-runner.js.map +1 -0
  14. package/packages/channels/discord/dist/cli-runner.test.d.ts +2 -0
  15. package/packages/channels/discord/dist/cli-runner.test.d.ts.map +1 -0
  16. package/packages/channels/discord/dist/cli-runner.test.js +173 -0
  17. package/packages/channels/discord/dist/cli-runner.test.js.map +1 -0
  18. package/packages/channels/discord/dist/discord-client.d.ts +3 -0
  19. package/packages/channels/discord/dist/discord-client.d.ts.map +1 -0
  20. package/packages/channels/discord/dist/discord-client.js +49 -0
  21. package/packages/channels/discord/dist/discord-client.js.map +1 -0
  22. package/packages/channels/discord/dist/format.d.ts +6 -0
  23. package/packages/channels/discord/dist/format.d.ts.map +1 -0
  24. package/packages/channels/discord/dist/format.js +19 -0
  25. package/packages/channels/discord/dist/format.js.map +1 -0
  26. package/packages/channels/discord/dist/format.test.d.ts +2 -0
  27. package/packages/channels/discord/dist/format.test.d.ts.map +1 -0
  28. package/packages/channels/discord/dist/format.test.js +63 -0
  29. package/packages/channels/discord/dist/format.test.js.map +1 -0
  30. package/packages/channels/discord/dist/index.d.ts +3 -0
  31. package/packages/channels/discord/dist/index.d.ts.map +1 -0
  32. package/packages/channels/discord/dist/index.js +2 -0
  33. package/packages/channels/discord/dist/index.js.map +1 -0
  34. package/packages/channels/discord/dist/prompt.d.ts +4 -0
  35. package/packages/channels/discord/dist/prompt.d.ts.map +1 -0
  36. package/packages/channels/discord/dist/prompt.js +28 -0
  37. package/packages/channels/discord/dist/prompt.js.map +1 -0
  38. package/packages/channels/discord/dist/prompt.test.d.ts +2 -0
  39. package/packages/channels/discord/dist/prompt.test.d.ts.map +1 -0
  40. package/packages/channels/discord/dist/prompt.test.js +130 -0
  41. package/packages/channels/discord/dist/prompt.test.js.map +1 -0
  42. package/packages/channels/discord/dist/runtime.d.ts +11 -0
  43. package/packages/channels/discord/dist/runtime.d.ts.map +1 -0
  44. package/packages/channels/discord/dist/runtime.js +66 -0
  45. package/packages/channels/discord/dist/runtime.js.map +1 -0
  46. package/packages/channels/discord/dist/runtime.test.d.ts +2 -0
  47. package/packages/channels/discord/dist/runtime.test.d.ts.map +1 -0
  48. package/packages/channels/discord/dist/runtime.test.js +107 -0
  49. package/packages/channels/discord/dist/runtime.test.js.map +1 -0
  50. package/packages/channels/discord/dist/types.d.ts +30 -0
  51. package/packages/channels/discord/dist/types.d.ts.map +1 -0
  52. package/packages/channels/discord/dist/types.js +2 -0
  53. package/packages/channels/discord/dist/types.js.map +1 -0
  54. package/packages/channels/discord/package.json +21 -0
  55. package/packages/channels/dist/.tsbuildinfo +1 -0
  56. package/packages/channels/dist/index.d.ts +14 -0
  57. package/packages/channels/dist/index.d.ts.map +1 -0
  58. package/packages/channels/dist/index.js +25 -0
  59. package/packages/channels/dist/index.js.map +1 -0
  60. package/packages/channels/package.json +23 -0
  61. package/packages/channels/slack/dist/.tsbuildinfo +1 -0
  62. package/packages/channels/slack/dist/cli.d.ts +7 -0
  63. package/packages/channels/slack/dist/cli.d.ts.map +1 -0
  64. package/packages/channels/slack/dist/cli.js +53 -0
  65. package/packages/channels/slack/dist/cli.js.map +1 -0
  66. package/packages/channels/slack/dist/cli.test.d.ts +2 -0
  67. package/packages/channels/slack/dist/cli.test.d.ts.map +1 -0
  68. package/packages/channels/slack/dist/cli.test.js +43 -0
  69. package/packages/channels/slack/dist/cli.test.js.map +1 -0
  70. package/packages/channels/slack/dist/index.d.ts +7 -0
  71. package/packages/channels/slack/dist/index.d.ts.map +1 -0
  72. package/packages/channels/slack/dist/index.js +28 -0
  73. package/packages/channels/slack/dist/index.js.map +1 -0
  74. package/packages/channels/slack/dist/message.d.ts +15 -0
  75. package/packages/channels/slack/dist/message.d.ts.map +1 -0
  76. package/packages/channels/slack/dist/message.js +38 -0
  77. package/packages/channels/slack/dist/message.js.map +1 -0
  78. package/packages/channels/slack/dist/slack.test.d.ts +2 -0
  79. package/packages/channels/slack/dist/slack.test.d.ts.map +1 -0
  80. package/packages/channels/slack/dist/slack.test.js +23 -0
  81. package/packages/channels/slack/dist/slack.test.js.map +1 -0
  82. package/packages/channels/slack/dist/types.d.ts +22 -0
  83. package/packages/channels/slack/dist/types.d.ts.map +1 -0
  84. package/packages/channels/slack/dist/types.js +2 -0
  85. package/packages/channels/slack/dist/types.js.map +1 -0
  86. package/packages/channels/slack/package.json +21 -0
  87. package/packages/channels/telegram/dist/.tsbuildinfo +1 -0
  88. package/packages/channels/telegram/dist/cli.d.ts +13 -0
  89. package/packages/channels/telegram/dist/cli.d.ts.map +1 -0
  90. package/packages/channels/telegram/dist/cli.js +53 -0
  91. package/packages/channels/telegram/dist/cli.js.map +1 -0
  92. package/packages/channels/telegram/dist/cli.test.d.ts +2 -0
  93. package/packages/channels/telegram/dist/cli.test.d.ts.map +1 -0
  94. package/packages/channels/telegram/dist/cli.test.js +167 -0
  95. package/packages/channels/telegram/dist/cli.test.js.map +1 -0
  96. package/packages/channels/telegram/dist/index.d.ts +7 -0
  97. package/packages/channels/telegram/dist/index.d.ts.map +1 -0
  98. package/packages/channels/telegram/dist/index.js +21 -0
  99. package/packages/channels/telegram/dist/index.js.map +1 -0
  100. package/packages/channels/telegram/dist/message.d.ts +6 -0
  101. package/packages/channels/telegram/dist/message.d.ts.map +1 -0
  102. package/packages/channels/telegram/dist/message.js +33 -0
  103. package/packages/channels/telegram/dist/message.js.map +1 -0
  104. package/packages/channels/telegram/dist/telegram.test.d.ts +2 -0
  105. package/packages/channels/telegram/dist/telegram.test.d.ts.map +1 -0
  106. package/packages/channels/telegram/dist/telegram.test.js +25 -0
  107. package/packages/channels/telegram/dist/telegram.test.js.map +1 -0
  108. package/packages/channels/telegram/dist/types.d.ts +20 -0
  109. package/packages/channels/telegram/dist/types.d.ts.map +1 -0
  110. package/packages/channels/telegram/dist/types.js +2 -0
  111. package/packages/channels/telegram/dist/types.js.map +1 -0
  112. package/packages/channels/telegram/package.json +21 -0
  113. package/packages/cli/dist/.tsbuildinfo +1 -0
  114. package/packages/cli/dist/bin/va-claw.d.mts +3 -0
  115. package/packages/cli/dist/bin/va-claw.d.mts.map +1 -0
  116. package/packages/cli/dist/bin/va-claw.mjs +4 -0
  117. package/packages/cli/dist/bin/va-claw.mjs.map +1 -0
  118. package/packages/cli/dist/channel-handlers.d.ts +8 -0
  119. package/packages/cli/dist/channel-handlers.d.ts.map +1 -0
  120. package/packages/cli/dist/channel-handlers.js +80 -0
  121. package/packages/cli/dist/channel-handlers.js.map +1 -0
  122. package/packages/cli/dist/deps-exports.d.ts +3 -0
  123. package/packages/cli/dist/deps-exports.d.ts.map +1 -0
  124. package/packages/cli/dist/deps-exports.js +3 -0
  125. package/packages/cli/dist/deps-exports.js.map +1 -0
  126. package/packages/cli/dist/deps.d.ts +3 -0
  127. package/packages/cli/dist/deps.d.ts.map +1 -0
  128. package/packages/cli/dist/deps.js +81 -0
  129. package/packages/cli/dist/deps.js.map +1 -0
  130. package/packages/cli/dist/handlers.d.ts +33 -0
  131. package/packages/cli/dist/handlers.d.ts.map +1 -0
  132. package/packages/cli/dist/handlers.js +207 -0
  133. package/packages/cli/dist/handlers.js.map +1 -0
  134. package/packages/cli/dist/index.d.ts +10 -0
  135. package/packages/cli/dist/index.d.ts.map +1 -0
  136. package/packages/cli/dist/index.js +9 -0
  137. package/packages/cli/dist/index.js.map +1 -0
  138. package/packages/cli/dist/install-files.d.ts +11 -0
  139. package/packages/cli/dist/install-files.d.ts.map +1 -0
  140. package/packages/cli/dist/install-files.js +72 -0
  141. package/packages/cli/dist/install-files.js.map +1 -0
  142. package/packages/cli/dist/memory-status.d.ts +3 -0
  143. package/packages/cli/dist/memory-status.d.ts.map +1 -0
  144. package/packages/cli/dist/memory-status.js +45 -0
  145. package/packages/cli/dist/memory-status.js.map +1 -0
  146. package/packages/cli/dist/output.d.ts +8 -0
  147. package/packages/cli/dist/output.d.ts.map +1 -0
  148. package/packages/cli/dist/output.js +45 -0
  149. package/packages/cli/dist/output.js.map +1 -0
  150. package/packages/cli/dist/platform.d.ts +6 -0
  151. package/packages/cli/dist/platform.d.ts.map +1 -0
  152. package/packages/cli/dist/platform.js +31 -0
  153. package/packages/cli/dist/platform.js.map +1 -0
  154. package/packages/cli/dist/program.d.ts +5 -0
  155. package/packages/cli/dist/program.d.ts.map +1 -0
  156. package/packages/cli/dist/program.js +116 -0
  157. package/packages/cli/dist/program.js.map +1 -0
  158. package/packages/cli/dist/test-helpers.d.ts +7 -0
  159. package/packages/cli/dist/test-helpers.d.ts.map +1 -0
  160. package/packages/cli/dist/test-helpers.js +91 -0
  161. package/packages/cli/dist/test-helpers.js.map +1 -0
  162. package/packages/cli/dist/types.d.ts +82 -0
  163. package/packages/cli/dist/types.d.ts.map +1 -0
  164. package/packages/cli/dist/types.js +2 -0
  165. package/packages/cli/dist/types.js.map +1 -0
  166. package/packages/cli/dist/wait.d.ts +2 -0
  167. package/packages/cli/dist/wait.d.ts.map +1 -0
  168. package/packages/cli/dist/wait.js +25 -0
  169. package/packages/cli/dist/wait.js.map +1 -0
  170. package/packages/cli/package.json +29 -0
  171. package/packages/daemon/dist/.tsbuildinfo +1 -0
  172. package/packages/daemon/dist/cli-adapter.d.ts +14 -0
  173. package/packages/daemon/dist/cli-adapter.d.ts.map +1 -0
  174. package/packages/daemon/dist/cli-adapter.js +30 -0
  175. package/packages/daemon/dist/cli-adapter.js.map +1 -0
  176. package/packages/daemon/dist/index.d.ts +5 -0
  177. package/packages/daemon/dist/index.d.ts.map +1 -0
  178. package/packages/daemon/dist/index.js +4 -0
  179. package/packages/daemon/dist/index.js.map +1 -0
  180. package/packages/daemon/dist/runner.d.ts +2 -0
  181. package/packages/daemon/dist/runner.d.ts.map +1 -0
  182. package/packages/daemon/dist/runner.js +18 -0
  183. package/packages/daemon/dist/runner.js.map +1 -0
  184. package/packages/daemon/dist/runtime.d.ts +24 -0
  185. package/packages/daemon/dist/runtime.d.ts.map +1 -0
  186. package/packages/daemon/dist/runtime.js +83 -0
  187. package/packages/daemon/dist/runtime.js.map +1 -0
  188. package/packages/daemon/dist/service-files.d.ts +13 -0
  189. package/packages/daemon/dist/service-files.d.ts.map +1 -0
  190. package/packages/daemon/dist/service-files.js +84 -0
  191. package/packages/daemon/dist/service-files.js.map +1 -0
  192. package/packages/daemon/dist/service.d.ts +4 -0
  193. package/packages/daemon/dist/service.d.ts.map +1 -0
  194. package/packages/daemon/dist/service.js +31 -0
  195. package/packages/daemon/dist/service.js.map +1 -0
  196. package/packages/daemon/dist/types.d.ts +11 -0
  197. package/packages/daemon/dist/types.d.ts.map +1 -0
  198. package/packages/daemon/dist/types.js +2 -0
  199. package/packages/daemon/dist/types.js.map +1 -0
  200. package/packages/daemon/dist/wake-cycle.d.ts +17 -0
  201. package/packages/daemon/dist/wake-cycle.d.ts.map +1 -0
  202. package/packages/daemon/dist/wake-cycle.js +58 -0
  203. package/packages/daemon/dist/wake-cycle.js.map +1 -0
  204. package/packages/daemon/package.json +22 -0
  205. package/packages/identity/dist/.tsbuildinfo +1 -0
  206. package/packages/identity/dist/defaults.d.ts +5 -0
  207. package/packages/identity/dist/defaults.d.ts.map +1 -0
  208. package/packages/identity/dist/defaults.js +70 -0
  209. package/packages/identity/dist/defaults.js.map +1 -0
  210. package/packages/identity/dist/index.d.ts +6 -0
  211. package/packages/identity/dist/index.d.ts.map +1 -0
  212. package/packages/identity/dist/index.js +5 -0
  213. package/packages/identity/dist/index.js.map +1 -0
  214. package/packages/identity/dist/path.d.ts +3 -0
  215. package/packages/identity/dist/path.d.ts.map +1 -0
  216. package/packages/identity/dist/path.js +16 -0
  217. package/packages/identity/dist/path.js.map +1 -0
  218. package/packages/identity/dist/render.d.ts +4 -0
  219. package/packages/identity/dist/render.d.ts.map +1 -0
  220. package/packages/identity/dist/render.js +34 -0
  221. package/packages/identity/dist/render.js.map +1 -0
  222. package/packages/identity/dist/storage.d.ts +4 -0
  223. package/packages/identity/dist/storage.d.ts.map +1 -0
  224. package/packages/identity/dist/storage.js +27 -0
  225. package/packages/identity/dist/storage.js.map +1 -0
  226. package/packages/identity/dist/types.d.ts +29 -0
  227. package/packages/identity/dist/types.d.ts.map +1 -0
  228. package/packages/identity/dist/types.js +2 -0
  229. package/packages/identity/dist/types.js.map +1 -0
  230. package/packages/identity/dist/wizard.d.ts +3 -0
  231. package/packages/identity/dist/wizard.d.ts.map +1 -0
  232. package/packages/identity/dist/wizard.js +37 -0
  233. package/packages/identity/dist/wizard.js.map +1 -0
  234. package/packages/identity/package.json +21 -0
  235. package/packages/identity/test/identity.test.mjs +71 -0
  236. package/packages/identity/test/storage.test.mjs +91 -0
  237. package/packages/identity/vendor/clack-prompts/index.d.ts +10 -0
  238. package/packages/identity/vendor/clack-prompts/index.js +55 -0
  239. package/packages/identity/vendor/clack-prompts/package.json +11 -0
  240. package/packages/memory/dist/.tsbuildinfo +1 -0
  241. package/packages/memory/dist/default-store.d.ts +21 -0
  242. package/packages/memory/dist/default-store.d.ts.map +1 -0
  243. package/packages/memory/dist/default-store.js +52 -0
  244. package/packages/memory/dist/default-store.js.map +1 -0
  245. package/packages/memory/dist/embedding.d.ts +6 -0
  246. package/packages/memory/dist/embedding.d.ts.map +1 -0
  247. package/packages/memory/dist/embedding.js +56 -0
  248. package/packages/memory/dist/embedding.js.map +1 -0
  249. package/packages/memory/dist/forgetting-curve.d.ts +3 -0
  250. package/packages/memory/dist/forgetting-curve.d.ts.map +1 -0
  251. package/packages/memory/dist/forgetting-curve.js +21 -0
  252. package/packages/memory/dist/forgetting-curve.js.map +1 -0
  253. package/packages/memory/dist/index.d.ts +5 -0
  254. package/packages/memory/dist/index.d.ts.map +1 -0
  255. package/packages/memory/dist/index.js +4 -0
  256. package/packages/memory/dist/index.js.map +1 -0
  257. package/packages/memory/dist/memory-store.d.ts +39 -0
  258. package/packages/memory/dist/memory-store.d.ts.map +1 -0
  259. package/packages/memory/dist/memory-store.js +417 -0
  260. package/packages/memory/dist/memory-store.js.map +1 -0
  261. package/packages/memory/dist/sqlite.d.ts +19 -0
  262. package/packages/memory/dist/sqlite.d.ts.map +1 -0
  263. package/packages/memory/dist/sqlite.js +195 -0
  264. package/packages/memory/dist/sqlite.js.map +1 -0
  265. package/packages/memory/dist/types.d.ts +43 -0
  266. package/packages/memory/dist/types.d.ts.map +1 -0
  267. package/packages/memory/dist/types.js +2 -0
  268. package/packages/memory/dist/types.js.map +1 -0
  269. package/packages/memory/package.json +18 -0
  270. package/packages/skills/dist/.tsbuildinfo +1 -0
  271. package/packages/skills/dist/frontmatter.d.ts +3 -0
  272. package/packages/skills/dist/frontmatter.d.ts.map +1 -0
  273. package/packages/skills/dist/frontmatter.js +85 -0
  274. package/packages/skills/dist/frontmatter.js.map +1 -0
  275. package/packages/skills/dist/index.d.ts +6 -0
  276. package/packages/skills/dist/index.d.ts.map +1 -0
  277. package/packages/skills/dist/index.js +5 -0
  278. package/packages/skills/dist/index.js.map +1 -0
  279. package/packages/skills/dist/paths.d.ts +13 -0
  280. package/packages/skills/dist/paths.d.ts.map +1 -0
  281. package/packages/skills/dist/paths.js +43 -0
  282. package/packages/skills/dist/paths.js.map +1 -0
  283. package/packages/skills/dist/search.d.ts +3 -0
  284. package/packages/skills/dist/search.d.ts.map +1 -0
  285. package/packages/skills/dist/search.js +20 -0
  286. package/packages/skills/dist/search.js.map +1 -0
  287. package/packages/skills/dist/store.d.ts +8 -0
  288. package/packages/skills/dist/store.d.ts.map +1 -0
  289. package/packages/skills/dist/store.js +75 -0
  290. package/packages/skills/dist/store.js.map +1 -0
  291. package/packages/skills/dist/types.d.ts +9 -0
  292. package/packages/skills/dist/types.d.ts.map +1 -0
  293. package/packages/skills/dist/types.js +2 -0
  294. package/packages/skills/dist/types.js.map +1 -0
  295. package/packages/skills/package.json +18 -0
  296. package/skills/install-va-claw.md +180 -0
  297. package/vendor/commander/index.d.ts +16 -0
  298. package/vendor/commander/index.js +110 -0
  299. package/vendor/commander/package.json +11 -0
  300. package/vendor/croner/LICENSE +22 -0
  301. package/vendor/croner/README.md +339 -0
  302. package/vendor/croner/dist/croner.cjs +1 -0
  303. package/vendor/croner/dist/croner.d.cts +693 -0
  304. package/vendor/croner/dist/croner.d.ts +693 -0
  305. package/vendor/croner/dist/croner.js +1 -0
  306. package/vendor/croner/dist/croner.umd.js +1 -0
  307. package/vendor/croner/package.json +73 -0
  308. package/vendor/discord.js/index.d.ts +22 -0
  309. package/vendor/discord.js/index.js +37 -0
  310. package/vendor/discord.js/package.json +7 -0
  311. package/vendor/grammy/index.d.ts +43 -0
  312. package/vendor/grammy/index.js +89 -0
  313. package/vendor/grammy/package.json +7 -0
  314. package/vendor/slack-bolt/index.d.ts +29 -0
  315. package/vendor/slack-bolt/index.js +72 -0
  316. package/vendor/slack-bolt/package.json +7 -0
@@ -0,0 +1,693 @@
1
+ // Generated by dts-bundle-generator v9.5.1
2
+
3
+ /**
4
+ * Cron pattern mode for controlling precision level
5
+ */
6
+ export type CronMode = "auto" | "5-part" | "6-part" | "7-part" | "5-or-6-parts" | "6-or-7-parts";
7
+ /**
8
+ * Create a CronPattern instance from pattern string ('* * * * * *')
9
+ * @constructor
10
+ * @param {string} pattern - Input pattern
11
+ * @param {string} timezone - Input timezone, used for '?'-substitution
12
+ * @param {object} options - Cron options including mode
13
+ */
14
+ export declare class CronPattern {
15
+ pattern: string;
16
+ timezone?: string;
17
+ mode: CronMode;
18
+ alternativeWeekdays: boolean;
19
+ sloppyRanges: boolean;
20
+ second: number[];
21
+ minute: number[];
22
+ hour: number[];
23
+ day: number[];
24
+ month: number[];
25
+ dayOfWeek: number[];
26
+ year: number[];
27
+ lastDayOfMonth: boolean;
28
+ lastWeekday: boolean;
29
+ nearestWeekdays: number[];
30
+ starDOM: boolean;
31
+ starDOW: boolean;
32
+ starYear: boolean;
33
+ useAndLogic: boolean;
34
+ constructor(pattern: string, timezone?: string, options?: {
35
+ mode?: CronMode;
36
+ alternativeWeekdays?: boolean;
37
+ sloppyRanges?: boolean;
38
+ });
39
+ /**
40
+ * Parse current pattern, will throw on any type of failure
41
+ * @private
42
+ */
43
+ private parse;
44
+ /**
45
+ * Convert current part (seconds/minutes etc) to an array of 1 or 0 depending on if the part is about to trigger a run or not.
46
+ */
47
+ private partToArray;
48
+ /**
49
+ * After converting JAN-DEC, SUN-SAT only 0-9 * , / - are allowed, throw if anything else pops up
50
+ * @throws On error
51
+ */
52
+ private throwAtIllegalCharacters;
53
+ /**
54
+ * Nothing but a number, potentially with a modifier, left - handle that
55
+ *
56
+ * @param conf Current part, expected to be a number, as a string
57
+ * @param type One of "seconds", "minutes" etc
58
+ * @param valueIndexOffset -1 for day of month, and month, as they start at 1. 0 for seconds, hours, minutes
59
+ */
60
+ private handleNumber;
61
+ /**
62
+ * Set a specific value for a specific part of the CronPattern.
63
+ *
64
+ * @param part The specific part of the CronPattern, e.g., "second", "minute", etc.
65
+ * @param index The index to modify.
66
+ * @param value The value to set, typically 0 or 1, in case of "nth weekday" it will be the weekday number used for further processing
67
+ */
68
+ private setPart;
69
+ /**
70
+ * Validates that a parsed number is not NaN.
71
+ * Throws a TypeError with a descriptive message if the value is NaN.
72
+ *
73
+ * @param value - The value to validate
74
+ * @param errorMessage - The error message to throw if validation fails
75
+ * @throws {TypeError} If the value is NaN
76
+ * @private
77
+ */
78
+ private validateNotNaN;
79
+ /**
80
+ * Validates that a range is valid (lower <= upper) and that steps are valid (> 0 and <= array length).
81
+ *
82
+ * @param lower - Lower bound of range
83
+ * @param upper - Upper bound of range
84
+ * @param steps - Optional step value to validate
85
+ * @param type - The type of pattern part being validated
86
+ * @param conf - The original configuration string for error messages
87
+ * @throws {TypeError} If validation fails
88
+ * @private
89
+ */
90
+ private validateRange;
91
+ /**
92
+ * Take care of ranges with stepping (e.g. 3-23/5)
93
+ *
94
+ * @param conf Current part, expected to be a string like 3-23/5
95
+ * @param type One of "seconds", "minutes" etc
96
+ * @param valueIndexOffset -1 for day of month, and month, as they start at 1. 0 for seconds, hours, minutes
97
+ */
98
+ private handleRangeWithStepping;
99
+ private extractNth;
100
+ /**
101
+ * Take care of ranges (e.g. 1-20)
102
+ *
103
+ * @param conf - Current part, expected to be a string like 1-20, can contain L for last
104
+ * @param type - One of "seconds", "minutes" etc
105
+ * @param valueIndexOffset - -1 for day of month, and month, as they start at 1. 0 for seconds, hours, minutes
106
+ */
107
+ private handleRange;
108
+ /**
109
+ * Handle stepping (e.g. * / 14)
110
+ *
111
+ * @param conf Current part, expected to be a string like * /20 (without the space)
112
+ * @param type One of "seconds", "minutes" etc
113
+ */
114
+ private handleStepping;
115
+ /**
116
+ * Replace day name with day numbers
117
+ *
118
+ * @param conf Current part, expected to be a string that might contain sun,mon etc.
119
+ *
120
+ * @returns Conf with 0 instead of sun etc.
121
+ */
122
+ private replaceAlphaDays;
123
+ /**
124
+ * Replace day name with day numbers (Quartz mode)
125
+ * In Quartz mode: Sunday=1, Monday=2, ..., Saturday=7
126
+ *
127
+ * @param conf Current part, expected to be a string that might contain sun,mon etc.
128
+ *
129
+ * @returns Conf with Quartz-style numbering
130
+ */
131
+ private replaceAlphaDaysQuartz;
132
+ /**
133
+ * Replace month name with month numbers
134
+ *
135
+ * @param conf Current part, expected to be a string that might contain jan,feb etc.
136
+ *
137
+ * @returns conf with 0 instead of sun etc.
138
+ */
139
+ private replaceAlphaMonths;
140
+ /**
141
+ * Replace nicknames with actual cron patterns
142
+ *
143
+ * @param pattern Pattern, may contain nicknames, or not
144
+ *
145
+ * @returns Pattern, with cron expression insted of nicknames
146
+ */
147
+ private handleNicknames;
148
+ /**
149
+ * Handle the nth weekday of the month logic using hash sign (e.g. FRI#2 for the second Friday of the month)
150
+ *
151
+ * @param index Weekday, example: 5 for friday
152
+ * @param nthWeekday bitmask, 2 (0x00010) for 2nd friday, 31 (ANY_OCCURRENCE, 0b100000) for any day
153
+ */
154
+ private setNthWeekdayOfMonth;
155
+ }
156
+ export type CatchCallbackFn = (e: unknown, job: Cron) => void;
157
+ export type ProtectCallbackFn = (job: Cron) => void;
158
+ /**
159
+ * Options for configuring cron jobs.
160
+ *
161
+ * @interface
162
+ */
163
+ export interface CronOptions<T = undefined> {
164
+ /**
165
+ * The name of the cron job. If provided, the job will be added to the
166
+ * `scheduledJobs` array, allowing it to be accessed by name.
167
+ */
168
+ name?: string;
169
+ /**
170
+ * If true, the job will be paused initially.
171
+ * @default false
172
+ */
173
+ paused?: boolean;
174
+ /**
175
+ * If true, the job will be stopped permanently.
176
+ * @default false
177
+ */
178
+ kill?: boolean;
179
+ /**
180
+ * If true, errors thrown by the job function will be caught.
181
+ * If a function is provided, it will be called with the error and the job instance.
182
+ * @default false
183
+ */
184
+ catch?: boolean | CatchCallbackFn;
185
+ /**
186
+ * If true, the underlying timer will be unreferenced, allowing the Node.js
187
+ * process to exit even if the job is still running.
188
+ * @default false
189
+ */
190
+ unref?: boolean;
191
+ /**
192
+ * The maximum number of times the job will run.
193
+ * @default Infinity
194
+ */
195
+ maxRuns?: number;
196
+ /**
197
+ * The minimum interval between job executions, in seconds.
198
+ * @default 1
199
+ */
200
+ interval?: number;
201
+ /**
202
+ * If true, prevents the job from running if the previous execution is still in progress.
203
+ * If a function is provided, it will be called if the job is blocked.
204
+ * @default false
205
+ */
206
+ protect?: boolean | ProtectCallbackFn;
207
+ /**
208
+ * The date and time at which the job should start running.
209
+ */
210
+ startAt?: string | Date | CronDate<T>;
211
+ /**
212
+ * The date and time at which the job should stop running.
213
+ */
214
+ stopAt?: string | Date | CronDate<T>;
215
+ /**
216
+ * The timezone for the cron job.
217
+ */
218
+ timezone?: string;
219
+ /**
220
+ * The UTC offset for the cron job, in minutes.
221
+ */
222
+ utcOffset?: number;
223
+ /**
224
+ * If true, uses AND logic when combining day-of-month and day-of-week.
225
+ * If false, uses OR logic for combining day-of-month and day-of-week (legacy behavior).
226
+ * @default false
227
+ */
228
+ domAndDow?: boolean;
229
+ /**
230
+ * @deprecated Use domAndDow instead. This option will be removed in a future version.
231
+ * If true, enables legacy mode (OR logic) for compatibility with older cron implementations.
232
+ * Offset the scheduled date by a number of days.
233
+ * Positive values shift the date forward, negative values shift it backward.
234
+ * For example, dayOffset: -1 schedules the job one day before the pattern match.
235
+ * @default 0
236
+ */
237
+ dayOffset?: number;
238
+ /**
239
+ * If true, enables legacy mode for compatibility with older cron implementations.
240
+ * @default true
241
+ */
242
+ legacyMode?: boolean;
243
+ /**
244
+ * Specifies the cron pattern mode to use for parsing and execution.
245
+ *
246
+ * - "auto": Automatically detect pattern format (default behavior)
247
+ * - "5-part": Traditional 5-field cron (minute-level precision, seconds forced to 0, years wildcarded)
248
+ * - "6-part": Extended 6-field cron (second-level precision, years wildcarded)
249
+ * - "7-part": Full 7-field cron (second-level and year-specific precision)
250
+ * - "5-or-6-parts": Accept 5 or 6 field patterns (years wildcarded)
251
+ * - "6-or-7-parts": Accept 6 or 7 field patterns (no additional constraints)
252
+ *
253
+ * @default "auto"
254
+ */
255
+ mode?: CronMode;
256
+ /**
257
+ * An optional context object that will be passed to the job function.
258
+ */
259
+ context?: T;
260
+ /**
261
+ * If true, enables alternative weekday numbering (Quartz mode).
262
+ * In standard mode (false): Sunday=0, Monday=1, ..., Saturday=6
263
+ * In Quartz mode (true): Sunday=1, Monday=2, ..., Saturday=7
264
+ * @default false
265
+ */
266
+ alternativeWeekdays?: boolean;
267
+ /**
268
+ * If true, allows non-standard stepping formats for backward compatibility.
269
+ * When false (default), only wildcard (*\/step) or range (min-max\/step) formats are allowed.
270
+ * When true, allows numeric prefix formats like /10, 5/5, 30/30.
271
+ * @default false
272
+ */
273
+ sloppyRanges?: boolean;
274
+ }
275
+ /**
276
+ * Converts date to CronDate
277
+ *
278
+ * @param d Input date, if using string representation ISO 8001 (2015-11-24T19:40:00) local timezone is expected
279
+ * @param tz String representation of target timezone in Europe/Stockholm format, or a number representing offset in minutes.
280
+ */
281
+ export declare class CronDate<T = undefined> {
282
+ tz: string | number | undefined;
283
+ /**
284
+ * Current milliseconds
285
+ * @type {number}
286
+ */
287
+ ms: number;
288
+ /**
289
+ * Current second (0-59), in local time or target timezone specified by `this.tz`
290
+ * @type {number}
291
+ */
292
+ second: number;
293
+ /**
294
+ * Current minute (0-59), in local time or target timezone specified by `this.tz`
295
+ * @type {number}
296
+ */
297
+ minute: number;
298
+ /**
299
+ * Current hour (0-23), in local time or target timezone specified by `this.tz`
300
+ * @type {number}
301
+ */
302
+ hour: number;
303
+ /**
304
+ * Current day (1-31), in local time or target timezone specified by `this.tz`
305
+ * @type {number}
306
+ */
307
+ day: number;
308
+ /**
309
+ * Current month (1-12), in local time or target timezone specified by `this.tz`
310
+ * @type {number}
311
+ */
312
+ month: number;
313
+ /**
314
+ * Current full year, in local time or target timezone specified by `this.tz`
315
+ */
316
+ year: number;
317
+ constructor(d?: CronDate<T> | Date | string | null, tz?: string | number);
318
+ /**
319
+ * Calculates the last day of a given month.
320
+ * Uses a performance optimization for months other than February.
321
+ *
322
+ * @param year The year
323
+ * @param month The month (0-11)
324
+ * @returns The last day of the month (1-31)
325
+ * @private
326
+ */
327
+ private getLastDayOfMonth;
328
+ /**
329
+ * Calculates the last weekday (Mon-Fri) of a given month.
330
+ *
331
+ * @param year The target year.
332
+ * @param month The target month (0-11).
333
+ * @returns The day of the month (1-31) that is the last weekday.
334
+ * @private
335
+ */
336
+ private getLastWeekday;
337
+ /**
338
+ * Calculates the nearest weekday (Mon-Fri) to a given day of the month.
339
+ * Handles month boundaries.
340
+ *
341
+ * @param year The target year.
342
+ * @param month The target month (0-11).
343
+ * @param day The target day (1-31).
344
+ * @returns The day of the month (1-31) that is the nearest weekday, or -1 if the day doesn't exist in the month.
345
+ */
346
+ private getNearestWeekday;
347
+ /**
348
+ * Check if the given date is the nth occurrence of a weekday in its month.
349
+ *
350
+ * @param year The year.
351
+ * @param month The month (0 for January, 11 for December).
352
+ * @param day The day of the month.
353
+ * @param nth The nth occurrence (bitmask).
354
+ *
355
+ * @return True if the date is the nth occurrence of its weekday, false otherwise.
356
+ */
357
+ private isNthWeekdayOfMonth;
358
+ /**
359
+ * Sets internals using a Date
360
+ */
361
+ private fromDate;
362
+ /**
363
+ * Sets internals by deep copying another CronDate
364
+ *
365
+ * @param {CronDate} d - Input date
366
+ */
367
+ private fromCronDate;
368
+ /**
369
+ * Reset internal parameters (seconds, minutes, hours) if any of them have exceeded (or could have exceeded) their normal ranges
370
+ *
371
+ * Will alway return true on february 29th, as that is a date that _could_ be out of bounds
372
+ */
373
+ private apply;
374
+ /**
375
+ * Sets internals by parsing a string
376
+ */
377
+ private fromString;
378
+ /**
379
+ * Find next match of current part
380
+ */
381
+ private findNext;
382
+ /**
383
+ * Internal unified method to find a matching time component in either direction.
384
+ * This method searches through the pattern to find the next or previous valid value
385
+ * for the specified target component (second, minute, hour, day, or month).
386
+ *
387
+ * @param options Cron options
388
+ * @param target Target property (second, minute, hour, day, month)
389
+ * @param pattern Pattern to use
390
+ * @param offset Offset to use
391
+ * @param direction 1 for forward (next), -1 for backward (previous)
392
+ * @returns Status code: 1 = same value matches, 2 = value changed, 3 = no match found
393
+ *
394
+ * @private
395
+ */
396
+ private _findMatch;
397
+ /**
398
+ * Increment to next run time recursively.
399
+ *
400
+ * This function traverses the date components (year, month, day, hour, minute, second)
401
+ * to find the next date and time that matches the cron pattern. It uses a recursive
402
+ * approach to handle the dependencies between different components. For example,
403
+ * if the day changes, the hour, minute, and second need to be reset.
404
+ *
405
+ * The recursion is limited to the year 10000 to prevent potential
406
+ * infinite loops or excessive stack depth, and to match the maximum supported
407
+ * year in OCPS 1.2 (years 1-9999).
408
+ *
409
+ * @param pattern The cron pattern used to determine the next run time.
410
+ * @param options The cron options that influence the incrementing behavior.
411
+ * @param doing The index of the `RecursionSteps` array indicating the current
412
+ * date component being processed. 0 represents "month", 1 represents "day", etc.
413
+ *
414
+ * @returns This `CronDate` instance for chaining, or null if incrementing
415
+ * was not possible (e.g., reached year 10000 limit or no matching date).
416
+ *
417
+ * @private
418
+ */
419
+ private recurse;
420
+ /**
421
+ * Increment to next run time
422
+ *
423
+ * @param pattern The pattern used to increment the current date.
424
+ * @param options Cron options used for incrementing.
425
+ * @param hasPreviousRun True if there was a previous run, false otherwise. This is used to determine whether to apply the minimum interval.
426
+ * @returns This CronDate instance for chaining, or null if incrementing was not possible (e.g., reached year 3000 limit).
427
+ */
428
+ increment(pattern: CronPattern, options: CronOptions<T>, hasPreviousRun: boolean): CronDate<T> | null;
429
+ /**
430
+ * Decrement to previous run time
431
+ *
432
+ * @param pattern The pattern used to decrement the current date.
433
+ * @param options Cron options used for decrementing.
434
+ * @returns This CronDate instance for chaining, or null if decrementing was not possible (e.g., reached year 0).
435
+ */
436
+ decrement(pattern: CronPattern, options: CronOptions<T>): CronDate<T> | null;
437
+ /**
438
+ * Find previous match by recursively checking pattern parts in reverse.
439
+ *
440
+ * This is the backward equivalent of the recurse() method. It searches backwards
441
+ * through time to find the previous date/time that matches the cron pattern.
442
+ *
443
+ * @param pattern The cron pattern used to determine the previous run time.
444
+ * @param options The cron options that influence the decrementing behavior.
445
+ * @param doing The index of the `RecursionSteps` array indicating the current
446
+ * date component being processed.
447
+ *
448
+ * @returns This `CronDate` instance for chaining, or null if decrementing
449
+ * was not possible (e.g., reached year 0 or no matching date).
450
+ *
451
+ * @private
452
+ */
453
+ private recurseBackward;
454
+ /**
455
+ * Get the maximum value in a pattern for a given target.
456
+ * Used when resetting components during backward recursion.
457
+ *
458
+ * @param target The target component (second, minute, hour, day, month)
459
+ * @param pattern The cron pattern
460
+ * @param offset The offset to apply
461
+ * @returns The maximum valid value for the target component
462
+ *
463
+ * @private
464
+ */
465
+ private getMaxPatternValue;
466
+ /**
467
+ * Find previous match for a specific component going backwards in time.
468
+ * This is the backward equivalent of the findNext() method.
469
+ *
470
+ * @param options Cron options
471
+ * @param target Target property (second, minute, hour, day, month)
472
+ * @param pattern Pattern to use
473
+ * @param offset Offset to use
474
+ * @returns Status code: 1 = same value matches, 2 = value changed to earlier value, 3 = no match found
475
+ *
476
+ * @private
477
+ */
478
+ private findPrevious;
479
+ /**
480
+ * Convert current state back to a javascript Date()
481
+ *
482
+ * @param internal If this is an internal call
483
+ */
484
+ getDate(internal?: boolean): Date;
485
+ /**
486
+ * Convert current state back to a javascript Date() and return UTC milliseconds
487
+ */
488
+ getTime(): number;
489
+ /**
490
+ * Check if the current CronDate matches a cron pattern
491
+ *
492
+ * @param pattern The cron pattern to match against
493
+ * @param options The cron options that influence matching
494
+ * @returns true if the date matches the pattern, false otherwise
495
+ */
496
+ match(pattern: CronPattern, options: CronOptions<T>): boolean;
497
+ }
498
+ /**
499
+ * An array containing all named cron jobs.
500
+ */
501
+ export declare const scheduledJobs: Cron<any>[];
502
+ /**
503
+ * Callback function type
504
+ *
505
+ * @param self - Reference to the Cron instance that triggered the callback
506
+ * @param context - Optional context value passed through options.context
507
+ *
508
+ * @returns void or Promise<void> for async callbacks
509
+ */
510
+ export type CronCallback<T = undefined> = (self: InstanceType<typeof Cron<T>>, context: T) => void | Promise<void>;
511
+ /**
512
+ * Cron entrypoint
513
+ *
514
+ * @constructor
515
+ * @param pattern - Input pattern, input date, or input ISO 8601 time string
516
+ * @param [fnOrOptions1] - Options or function to be run each iteration of pattern
517
+ * @param [fnOrOptions2] - Options or function to be run each iteration of pattern
518
+ */
519
+ export declare class Cron<T = undefined> {
520
+ name: string | undefined;
521
+ options: CronOptions<T>;
522
+ private _states;
523
+ private fn?;
524
+ /**
525
+ * Internal helper to get the timezone or UTC offset for date operations.
526
+ * Reduces duplication of `this.options.timezone || this.options.utcOffset` throughout the codebase.
527
+ *
528
+ * @returns The timezone string or UTC offset number
529
+ * @private
530
+ */
531
+ private getTz;
532
+ /**
533
+ * Internal helper to apply dayOffset to a date if configured.
534
+ * Reduces duplication of dayOffset calculation logic.
535
+ *
536
+ * @param date - The base date to apply offset to
537
+ * @returns The date with dayOffset applied, or the original date if no offset is configured
538
+ * @private
539
+ */
540
+ private applyDayOffset;
541
+ constructor(pattern: string | Date, fnOrOptions1?: CronOptions<T> | CronCallback<T>, fnOrOptions2?: CronOptions<T> | CronCallback<T>);
542
+ /**
543
+ * Find next runtime, based on supplied date. Strips milliseconds.
544
+ *
545
+ * @param prev - Optional. Date to start from. Can be a CronDate, Date object, or a string representing a date.
546
+ * @returns The next run time as a Date object, or null if there is no next run.
547
+ */
548
+ nextRun(prev?: CronDate<T> | Date | string | null): Date | null;
549
+ /**
550
+ * Find next n runs, based on supplied date. Strips milliseconds.
551
+ *
552
+ * @param n - Number of runs to enumerate
553
+ * @param previous - Date to start from
554
+ * @returns - Next n run times
555
+ */
556
+ nextRuns(n: number, previous?: Date | string): Date[];
557
+ /**
558
+ * Find previous n runs, based on supplied date. Strips milliseconds.
559
+ *
560
+ * @param n - Number of runs to enumerate
561
+ * @param reference - Date to start from (defaults to now)
562
+ * @returns - Previous n run times in reverse chronological order (most recent first)
563
+ */
564
+ previousRuns(n: number, reference?: Date | string): Date[];
565
+ /**
566
+ * Internal helper to enumerate runs in either direction.
567
+ *
568
+ * @param n - Number of runs to enumerate
569
+ * @param startDate - Date to start from
570
+ * @param direction - Direction to enumerate ("next" or "previous")
571
+ * @returns Array of run times with dayOffset applied
572
+ * @private
573
+ */
574
+ private _enumerateRuns;
575
+ /**
576
+ * Check if a given date matches the cron pattern
577
+ *
578
+ * @param date - Date to check. Can be a Date object or a string representing a date.
579
+ * @returns true if the date matches the pattern, false otherwise
580
+ */
581
+ match(date: Date | string): boolean;
582
+ /**
583
+ * Return the original pattern, if there was one.
584
+ * Returns undefined when the job was created with a Date or ISO 8601 string instead of a cron pattern.
585
+ *
586
+ * @returns Original cron pattern, or undefined for date-based jobs
587
+ */
588
+ getPattern(): string | undefined;
589
+ /**
590
+ * Return the original run-once date, if there was one
591
+ *
592
+ * @returns Original run-once date, or null if not a run-once job
593
+ */
594
+ getOnce(): Date | null;
595
+ /**
596
+ * Indicates whether or not the cron job is scheduled and running, e.g. awaiting next trigger
597
+ *
598
+ * @returns Running or not
599
+ */
600
+ isRunning(): boolean;
601
+ /**
602
+ * Indicates whether or not the cron job is permanently stopped
603
+ *
604
+ * @returns Running or not
605
+ */
606
+ isStopped(): boolean;
607
+ /**
608
+ * Indicates whether or not the cron job is currently working
609
+ *
610
+ * @returns Running or not
611
+ */
612
+ isBusy(): boolean;
613
+ /**
614
+ * Return current/previous run start time
615
+ *
616
+ * @returns Current (if running) or previous run time
617
+ */
618
+ currentRun(): Date | null;
619
+ /**
620
+ * Return previous run start time
621
+ *
622
+ * @returns Previous run time
623
+ */
624
+ previousRun(): Date | null;
625
+ /**
626
+ * Returns number of milliseconds to next run
627
+ *
628
+ * @param prev Starting date, defaults to now - minimum interval
629
+ */
630
+ msToNext(prev?: CronDate<T> | Date | string): number | null;
631
+ /**
632
+ * Stop execution
633
+ *
634
+ * Running this will forcefully stop the job, and prevent furter exection. `.resume()` will not work after stopping.
635
+ * It will also be removed from the scheduledJobs array if it were named.
636
+ */
637
+ stop(): void;
638
+ /**
639
+ * Pause execution
640
+ *
641
+ * @returns Wether pause was successful
642
+ */
643
+ pause(): boolean;
644
+ /**
645
+ * Resume execution
646
+ *
647
+ * @returns Wether resume was successful
648
+ */
649
+ resume(): boolean;
650
+ /**
651
+ * Schedule a new job
652
+ *
653
+ * @param func - Function to be run each iteration of pattern
654
+ */
655
+ schedule(func?: CronCallback<T>): Cron<T>;
656
+ /**
657
+ * Internal function to trigger a run, used by both scheduled and manual trigger
658
+ */
659
+ private _trigger;
660
+ /**
661
+ * Trigger a run manually
662
+ */
663
+ trigger(): Promise<void>;
664
+ /**
665
+ * Returns number of runs left, undefined = unlimited
666
+ */
667
+ runsLeft(): number | undefined;
668
+ /**
669
+ * Called when it's time to trigger.
670
+ * Checks if all conditions are currently met,
671
+ * then instantly triggers the scheduled function.
672
+ */
673
+ private _checkTrigger;
674
+ /**
675
+ * Internal version of next. Cron needs millseconds internally, hence _next.
676
+ */
677
+ private _next;
678
+ /**
679
+ * Internal version of previous. Finds the previous scheduled run time.
680
+ *
681
+ * @param referenceDate - Optional reference date to search backwards from (defaults to now)
682
+ * @returns Previous scheduled run time, or null if no previous run exists
683
+ */
684
+ private _previous;
685
+ /**
686
+ * Calculate the previous run if no previous run is supplied, but startAt and interval are set.
687
+ * This calculation is only necessary if the startAt time is before the current time.
688
+ * Should only be called from the _next function.
689
+ */
690
+ private _calculatePreviousRun;
691
+ }
692
+
693
+ export {};