@lunora/scheduler 1.0.0-alpha.26 → 1.0.0-alpha.28
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/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as o}from"./packem_shared/createScheduler-w8KwN6aR.mjs";import{default as a}from"./packem_shared/createWorkpool-CqhYmK3r.mjs";import{createCronTrigger as c}from"./packem_shared/createCronTrigger-C4iUW_zz.mjs";import{CRON_SCHEDULE_KINDS as f,compileCronSchedule as l,cronJobs as n}from"./packem_shared/CRON_SCHEDULE_KINDS-Bi-0IEbF.mjs";import{createQueueConsumer as u,createQueueWorkpool as x,httpDispatcher as d}from"./packem_shared/createQueueConsumer-
|
|
1
|
+
import{default as o}from"./packem_shared/createScheduler-w8KwN6aR.mjs";import{default as a}from"./packem_shared/createWorkpool-CqhYmK3r.mjs";import{createCronTrigger as c}from"./packem_shared/createCronTrigger-C4iUW_zz.mjs";import{CRON_SCHEDULE_KINDS as f,compileCronSchedule as l,cronJobs as n}from"./packem_shared/CRON_SCHEDULE_KINDS-Bi-0IEbF.mjs";import{createQueueConsumer as u,createQueueWorkpool as x,httpDispatcher as d}from"./packem_shared/createQueueConsumer-CGFKlYj_.mjs";import{SchedulerDO as C}from"./packem_shared/SchedulerDO-UqT2X44b.mjs";import{createSchedulerHost as h}from"./packem_shared/createSchedulerHost-yZW681fB.mjs";import{isWorkflowReference as E}from"./packem_shared/isWorkflowReference-CT3tdefh.mjs";import{assertValidCronExpression as k,isValidCronExpression as W,warnIfSecondsLeading as w}from"./packem_shared/assertValidCronExpression-B2lN8n3O.mjs";export{f as CRON_SCHEDULE_KINDS,C as SchedulerDO,k as assertValidCronExpression,l as compileCronSchedule,c as createCronTrigger,u as createQueueConsumer,x as createQueueWorkpool,o as createScheduler,h as createSchedulerHost,a as createWorkpool,n as cronJobs,d as httpDispatcher,W as isValidCronExpression,E as isWorkflowReference,w as warnIfSecondsLeading};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{LunoraError as o}from"@lunora/errors";const s=100,i=e=>{let a=e.length;for(;a>0&&e[a-1]==="/";)a-=1;return e.slice(0,a)},l=e=>{if(!e.queue)throw new o("INTERNAL","@lunora/scheduler: `queue` (a Cloudflare Queue binding) is required");return{enqueue:async(a,t,n={})=>{const r={args:t,functionPath:a.__lunoraRef,shardKey:n.shardKey},u=n.delaySeconds===void 0?void 0:{delaySeconds:n.delaySeconds};await e.queue.send(r,u)},enqueueBatch:async(a,t)=>{if(a.length>s)throw new o("VALIDATION_ERROR",`@lunora/scheduler: enqueueBatch exceeds ${String(s)} (got ${String(a.length)}) — split across calls`);const n=a.map(r=>({body:{args:r.args,functionPath:r.ref.__lunoraRef,shardKey:r.shardKey}}));await e.queue.sendBatch(n,t)}}},c=e=>typeof e=="object"&&e!==null&&typeof e.functionPath=="string",d=e=>async a=>{await Promise.all(a.messages.map(async t=>{try{if(!c(t.body))throw new o("INTERNAL","@lunora/scheduler: queue message body is not a QueueJob (missing functionPath)");await e.dispatch(t.body),t.ack()}catch{t.retry()}}))},f=e=>{const a=e.fetchImpl??globalThis.fetch;if(typeof a!="function")throw new TypeError("@lunora/scheduler: no fetch implementation available — pass fetchImpl or run on a platform with global fetch");const t=`${i(e.originUrl)}/_lunora/scheduler/dispatch`;return async n=>{const r=await a(t,{body:JSON.stringify({args:n.args??{},functionPath:n.functionPath,shardKey:n.shardKey}),headers:{authorization:`Bearer ${e.adminToken}`,"content-type":"application/json"},method:"POST"});if(!r.ok)throw new o("INTERNAL",`@lunora/scheduler: queue dispatch failed (${r.status.toString()}): ${await r.text()}`)}};export{d as createQueueConsumer,l as createQueueWorkpool,f as httpDispatcher};
|
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.28",
|
|
4
4
|
"description": "Scheduling for Lunora: runAfter / runAt and Cron Triggers via SchedulerDO",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
"access": "public"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@lunora/errors": "1.0.0-alpha.
|
|
50
|
-
"@lunora/platform": "1.0.0-alpha.
|
|
49
|
+
"@lunora/errors": "1.0.0-alpha.20",
|
|
50
|
+
"@lunora/platform": "1.0.0-alpha.9",
|
|
51
51
|
"cron-parser": "5.6.2"
|
|
52
52
|
},
|
|
53
53
|
"engines": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{LunoraError as o}from"@lunora/errors";const s=100,i=e=>{let a=e.length;for(;a>0&&e[a-1]==="/";)a-=1;return e.slice(0,a)},l=e=>{if(!e.queue)throw new o("INTERNAL","@lunora/scheduler: `queue` (a Cloudflare Queue binding) is required");return{enqueue:async(a,t,n={})=>{const r={args:t,functionPath:a.__lunoraRef,shardKey:n.shardKey},u=n.delaySeconds===void 0?void 0:{delaySeconds:n.delaySeconds};await e.queue.send(r,u)},enqueueBatch:async(a,t)=>{if(a.length>s)throw new o("INTERNAL",`@lunora/scheduler: enqueueBatch exceeds ${String(s)} (got ${String(a.length)}) — split across calls`);const n=a.map(r=>({body:{args:r.args,functionPath:r.ref.__lunoraRef,shardKey:r.shardKey}}));await e.queue.sendBatch(n,t)}}},c=e=>typeof e=="object"&&e!==null&&typeof e.functionPath=="string",d=e=>async a=>{await Promise.all(a.messages.map(async t=>{try{if(!c(t.body))throw new o("INTERNAL","@lunora/scheduler: queue message body is not a QueueJob (missing functionPath)");await e.dispatch(t.body),t.ack()}catch{t.retry()}}))},f=e=>{const a=e.fetchImpl??globalThis.fetch;if(typeof a!="function")throw new TypeError("@lunora/scheduler: no fetch implementation available — pass fetchImpl or run on a platform with global fetch");const t=`${i(e.originUrl)}/_lunora/scheduler/dispatch`;return async n=>{const r=await a(t,{body:JSON.stringify({args:n.args??{},functionPath:n.functionPath,shardKey:n.shardKey}),headers:{authorization:`Bearer ${e.adminToken}`,"content-type":"application/json"},method:"POST"});if(!r.ok)throw new o("INTERNAL",`@lunora/scheduler: queue dispatch failed (${r.status.toString()}): ${await r.text()}`)}};export{d as createQueueConsumer,l as createQueueWorkpool,f as httpDispatcher};
|