@stacksjs/scheduler 0.57.4 โ†’ 0.58.19

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 CHANGED
@@ -9,7 +9,7 @@ Stacks SMS is driver system for sending SMS messages.
9
9
  ## ๐Ÿค– Usage
10
10
 
11
11
  ```bash
12
- pnpm i -D @stacksjs/sms
12
+ bun install -d @stacksjs/sms
13
13
  ```
14
14
 
15
15
  You may now use it in your project:
@@ -101,7 +101,7 @@ Learn more in the docs.
101
101
  ## ๐Ÿงช Testing
102
102
 
103
103
  ```bash
104
- pnpm test
104
+ bun test
105
105
  ```
106
106
 
107
107
  ## ๐Ÿ“ˆ Changelog
@@ -120,7 +120,7 @@ For help, discussion about best practices, or any other conversation that would
120
120
 
121
121
  For casual chit-chat with others using this package:
122
122
 
123
- [Join the Stacks Discord Server](https://discord.ow3.org)
123
+ [Join the Stacks Discord Server](https://discord.gg/stacksjs)
124
124
 
125
125
  ## ๐Ÿ™๐Ÿผ Credits
126
126
 
@@ -134,4 +134,4 @@ Many thanks to the following core technologies & people who have contributed to
134
134
 
135
135
  The MIT License (MIT). Please see [LICENSE](https://github.com/stacksjs/stacks/tree/main/LICENSE.md) for more information.
136
136
 
137
- Made with โค๏ธ
137
+ Made with ๐Ÿ’™
@@ -1,5 +1,7 @@
1
+ // @bun
2
+ // src/index.ts
1
3
  import cron from "node-cron";
2
- function run(callback) {
4
+ var run = function(callback) {
3
5
  return {
4
6
  everySecond: () => {
5
7
  cron.schedule("* * * * * *", callback);
@@ -80,9 +82,127 @@ function run(callback) {
80
82
  timezone ? cron.schedule(interval, callback, { scheduled: true, timezone }) : cron.schedule(interval, callback);
81
83
  }
82
84
  };
83
- }
84
- export function useScheduler() {
85
+ };
86
+ function useScheduler() {
85
87
  return {
86
88
  run
87
89
  };
88
90
  }
91
+
92
+ class ScheduleImpl {
93
+ actionName = "";
94
+ commandName = "";
95
+ jobName = "";
96
+ execName = "";
97
+ callback = () => {
98
+ };
99
+ whenCallback = () => true;
100
+ startTime = "";
101
+ endTime = "";
102
+ timezoneName = "";
103
+ time = "";
104
+ action(action) {
105
+ this.actionName = action;
106
+ return this;
107
+ }
108
+ command(cmd) {
109
+ this.commandName = cmd;
110
+ return this;
111
+ }
112
+ job(job) {
113
+ this.jobName = job;
114
+ return this;
115
+ }
116
+ exec(cmd) {
117
+ this.execName = cmd;
118
+ return this;
119
+ }
120
+ call(callback) {
121
+ this.callback = callback;
122
+ return this;
123
+ }
124
+ everyMinute() {
125
+ return this;
126
+ }
127
+ everySecond() {
128
+ return this;
129
+ }
130
+ everyFiveMinutes() {
131
+ return this;
132
+ }
133
+ everyTenMinutes() {
134
+ return this;
135
+ }
136
+ everyThirtyMinutes() {
137
+ return this;
138
+ }
139
+ hourly() {
140
+ return this;
141
+ }
142
+ daily() {
143
+ return this;
144
+ }
145
+ twiceDaily(_hour1, _hour2) {
146
+ return this;
147
+ }
148
+ weekly() {
149
+ return this;
150
+ }
151
+ monthly() {
152
+ return this;
153
+ }
154
+ quarterly() {
155
+ return this;
156
+ }
157
+ yearly() {
158
+ return this;
159
+ }
160
+ weekdays() {
161
+ return this;
162
+ }
163
+ weekends() {
164
+ return this;
165
+ }
166
+ mondays() {
167
+ return this;
168
+ }
169
+ tuesdays() {
170
+ return this;
171
+ }
172
+ wednesdays() {
173
+ return this;
174
+ }
175
+ thursdays() {
176
+ return this;
177
+ }
178
+ fridays() {
179
+ return this;
180
+ }
181
+ saturdays() {
182
+ return this;
183
+ }
184
+ sundays() {
185
+ return this;
186
+ }
187
+ between(startTime, endTime) {
188
+ this.startTime = startTime;
189
+ this.endTime = endTime;
190
+ return this;
191
+ }
192
+ timezone(timezone) {
193
+ this.timezoneName = timezone;
194
+ return this;
195
+ }
196
+ when(callback) {
197
+ this.whenCallback = callback;
198
+ return this;
199
+ }
200
+ at(time) {
201
+ this.time = time;
202
+ return this;
203
+ }
204
+ }
205
+ export {
206
+ useScheduler,
207
+ ScheduleImpl
208
+ };
package/package.json CHANGED
@@ -1,17 +1,16 @@
1
1
  {
2
2
  "name": "@stacksjs/scheduler",
3
3
  "type": "module",
4
- "version": "0.57.4",
5
- "packageManager": "pnpm@8.6.6",
4
+ "version": "0.58.19",
6
5
  "description": "The Stacks scheduler.",
7
6
  "author": "Chris Breuer",
8
7
  "license": "MIT",
9
8
  "funding": "https://github.com/sponsors/chrisbbreuer",
10
- "homepage": "https://github.com/stacksjs/stacks/tree/main/.stacks/core/scheduler#readme",
9
+ "homepage": "https://github.com/stacksjs/stacks/tree/main/storage/framework/core/src/scheduler#readme",
11
10
  "repository": {
12
11
  "type": "git",
13
12
  "url": "git+https://github.com/stacksjs/stacks.git",
14
- "directory": "./.stacks/core/scheduler"
13
+ "directory": "./storage/framework/core/src/scheduler"
15
14
  },
16
15
  "bugs": {
17
16
  "url": "https://github.com/stacksjs/stacks/issues"
@@ -22,29 +21,36 @@
22
21
  ],
23
22
  "exports": {
24
23
  ".": {
25
- "types": "./dist/index.d.ts",
26
- "import": "./dist/index.mjs"
24
+ "bun": "./src/index.ts",
25
+ "import": "./dist/index.js"
26
+ },
27
+ "./*": {
28
+ "bun": "./src/*",
29
+ "import": "./dist/*"
27
30
  }
28
31
  },
29
- "module": "dist/index.mjs",
32
+ "module": "dist/index.js",
30
33
  "types": "dist/index.d.ts",
31
34
  "contributors": [
32
- "Chris Breuer <chris@ow3.org>"
35
+ "Chris Breuer <chris@stacksjs.org>"
33
36
  ],
34
37
  "files": [
35
- "dist",
36
- "README.md"
38
+ "README.md",
39
+ "dist"
37
40
  ],
41
+ "scripts": {
42
+ "build": "bun --bun build.ts",
43
+ "typecheck": "bun --bun tsc --noEmit",
44
+ "prepublishOnly": "bun --bun run build"
45
+ },
38
46
  "peerDependencies": {
39
- "node-cron": "3.0.2"
47
+ "node-cron": "3.0.3"
40
48
  },
41
- "devDependencies": {
42
- "@types/node-cron": "^3.0.8",
43
- "@stacksjs/development": "0.57.4"
49
+ "dependencies": {
50
+ "node-cron": "3.0.3"
44
51
  },
45
- "scripts": {
46
- "build": "unbuild",
47
- "dev": "unbuild --stub",
48
- "typecheck": "tsc --noEmit"
52
+ "devDependencies": {
53
+ "@stacksjs/development": "workspace:*",
54
+ "@types/node-cron": "^3.0.11"
49
55
  }
50
- }
56
+ }
package/LICENSE.md DELETED
@@ -1,21 +0,0 @@
1
- # MIT License
2
-
3
- Copyright (c) 2022 Open Web Foundation
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
package/dist/index.d.ts DELETED
@@ -1,33 +0,0 @@
1
- export interface Scheduler {
2
- everySecond: () => void;
3
- everySeconds: (seconds: number) => void;
4
- everyMinute: () => void;
5
- everyMinutes: (minutes: number) => void;
6
- everyTwoMinutes: () => void;
7
- everyThreeMinutes: () => void;
8
- everyFourMinutes: () => void;
9
- everyFiveMinutes: () => void;
10
- everyTenMinutes: () => void;
11
- everyFifteenMinutes: () => void;
12
- everyThirtyMinutes: () => void;
13
- hourly: () => void;
14
- hourlyAt: (minute: number) => void;
15
- everyOddHour: () => void;
16
- everyHours: (hours: number) => void;
17
- everyTwoHours: () => void;
18
- everyThreeHours: () => void;
19
- everyFourHours: () => void;
20
- everySixHours: () => void;
21
- daily: () => void;
22
- dailyAt: (hour: number, minute: number) => void;
23
- everyDays: (days: number) => void;
24
- weekly: () => void;
25
- quarterly: () => void;
26
- yearly: () => void;
27
- cron: (interval: string, timezone?: string) => void;
28
- }
29
- declare function run(callback: ((now: Date | 'manual' | 'init') => void) | string): Scheduler;
30
- export declare function useScheduler(): {
31
- run: typeof run;
32
- };
33
- export {};