@lunora/scheduler 1.0.0-alpha.5 → 1.0.0-alpha.7
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/LICENSE.md
CHANGED
|
@@ -103,3 +103,9 @@ Unless required by applicable law or agreed to in writing, software distributed
|
|
|
103
103
|
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
104
104
|
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
105
105
|
specific language governing permissions and limitations under the License.
|
|
106
|
+
|
|
107
|
+
<!-- DEPENDENCIES -->
|
|
108
|
+
<!-- /DEPENDENCIES -->
|
|
109
|
+
|
|
110
|
+
<!-- TYPE_DEPENDENCIES -->
|
|
111
|
+
<!-- /TYPE_DEPENDENCIES -->
|
package/dist/index.mjs
CHANGED
|
@@ -3,6 +3,6 @@ export { default as createWorkpool } from './packem_shared/createWorkpool-C28trh
|
|
|
3
3
|
export { createCronTrigger } from './packem_shared/createCronTrigger-Dh4VLxD9.mjs';
|
|
4
4
|
export { CRON_SCHEDULE_KINDS, compileCronSchedule, cronJobs } from './packem_shared/CRON_SCHEDULE_KINDS-BMVeCHOu.mjs';
|
|
5
5
|
export { createQueueConsumer, createQueueWorkpool, httpDispatcher } from './packem_shared/createQueueConsumer-Cy-Mp-El.mjs';
|
|
6
|
-
export { SchedulerDO } from './packem_shared/SchedulerDO-
|
|
6
|
+
export { SchedulerDO } from './packem_shared/SchedulerDO-DVeJrNbs.mjs';
|
|
7
7
|
export { isWorkflowReference } from './packem_shared/isWorkflowReference-C9mQkMXt.mjs';
|
|
8
8
|
export { assertValidCronExpression, isValidCronExpression } from './packem_shared/assertValidCronExpression-B9m75qU0.mjs';
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
const jsonResponse = (body, status = 200, headers) => Response.json(body, { headers: { "content-type": "application/json", ...headers }, status });
|
|
2
|
+
|
|
1
3
|
const HEADER_PREFIX = "id:";
|
|
2
4
|
const RETRY_PREFIX = "retry:";
|
|
3
5
|
const DEAD_PREFIX = "dead:";
|
|
@@ -21,7 +23,7 @@ class SchedulerDO {
|
|
|
21
23
|
return `t:${padTime(scheduledFor)}:${id}`;
|
|
22
24
|
}
|
|
23
25
|
static json(body, status = 200) {
|
|
24
|
-
return
|
|
26
|
+
return jsonResponse(body, status);
|
|
25
27
|
}
|
|
26
28
|
static error(status, code, message) {
|
|
27
29
|
return SchedulerDO.json({ error: { code, message } }, status);
|
|
@@ -143,13 +145,7 @@ class SchedulerDO {
|
|
|
143
145
|
return this.handleSchedule(request);
|
|
144
146
|
}
|
|
145
147
|
}
|
|
146
|
-
return
|
|
147
|
-
{ error: { code: "NOT_FOUND" } },
|
|
148
|
-
{
|
|
149
|
-
headers: { "content-type": "application/json" },
|
|
150
|
-
status: 404
|
|
151
|
-
}
|
|
152
|
-
);
|
|
148
|
+
return jsonResponse({ error: { code: "NOT_FOUND" } }, 404);
|
|
153
149
|
}
|
|
154
150
|
/** Called by the Workers runtime when the alarm previously set by `_rescheduleAlarm()` fires. */
|
|
155
151
|
async alarm() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/scheduler",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.7",
|
|
4
4
|
"description": "Scheduling for Lunora: runAfter / runAt and Cron Triggers via SchedulerDO",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"access": "public"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@lunora/errors": "1.0.0-alpha.
|
|
49
|
+
"@lunora/errors": "1.0.0-alpha.3",
|
|
50
50
|
"cron-parser": "5.6.1"
|
|
51
51
|
},
|
|
52
52
|
"engines": {
|