@rexezuge/runtime 1.5.2 → 1.6.1
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 +21 -1
- package/dist/base/AbstractDurableObjectWorker.d.ts +6 -0
- package/dist/base/AbstractDurableObjectWorker.d.ts.map +1 -1
- package/dist/base/AbstractDurableObjectWorker.js +1 -1
- package/dist/base/AbstractDurableObjectWorker.js.map +3 -3
- package/dist/base/AbstractEntrypointWorker.d.ts +10 -0
- package/dist/base/AbstractEntrypointWorker.d.ts.map +1 -1
- package/dist/base/AbstractEntrypointWorker.js +1 -1
- package/dist/base/AbstractEntrypointWorker.js.map +3 -3
- package/dist/base/AbstractQueueWorker.d.ts +21 -10
- package/dist/base/AbstractQueueWorker.d.ts.map +1 -1
- package/dist/base/AbstractQueueWorker.js +1 -1
- package/dist/base/AbstractQueueWorker.js.map +3 -3
- package/dist/base/AbstractWorkflowWorker.d.ts +23 -16
- package/dist/base/AbstractWorkflowWorker.d.ts.map +1 -1
- package/dist/base/AbstractWorkflowWorker.js +1 -1
- package/dist/base/AbstractWorkflowWorker.js.map +3 -3
- package/dist/base/baseWorkerError.d.ts +34 -0
- package/dist/base/baseWorkerError.d.ts.map +1 -0
- package/dist/base/baseWorkerError.js +1 -0
- package/dist/base/baseWorkerError.js.map +7 -0
- package/dist/base/index.d.ts +2 -2
- package/dist/base/index.d.ts.map +1 -1
- package/dist/base/index.js +1 -1
- package/dist/base/index.js.map +3 -3
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -37,7 +37,7 @@ import { AppConfiguration, EnvParser } from '@rexezuge/runtime';
|
|
|
37
37
|
|
|
38
38
|
class MyConfig extends AppConfiguration {
|
|
39
39
|
public getPageSize(): number {
|
|
40
|
-
return EnvParser.
|
|
40
|
+
return EnvParser.positiveInt(this.raw(), 'PAGE_SIZE', '50');
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
|
|
@@ -58,6 +58,26 @@ for (const warning of config.validate()) console.warn(warning); // warnings, nev
|
|
|
58
58
|
|
|
59
59
|
`fetch()` / `scheduled()` log-and-contain: an unhandled throw is a 500 response or a logged cron failure, never a platform crash. There is deliberately no `/__scheduled` HTTP branch — cron runs through the wrangler `triggers.crons` binding. The structural `WorkerExecutionContext` / `WorkerScheduledController` types mean this package typechecks without `@cloudflare/workers-types`.
|
|
60
60
|
|
|
61
|
+
`AbstractQueueWorker` and `AbstractWorkflowWorker` use the platform's own `MessageBatch` / `WorkflowEntrypoint` types rather than structural stand-ins, so a handler gets `batch.queue`, `message.ack()` / `retry()`, `this.env` and three-argument `step.do(name, { retries, timeout }, fn)` without a cast. Pass your platform batch as the type parameter:
|
|
62
|
+
|
|
63
|
+
```ts
|
|
64
|
+
class DispatcherWorker extends AbstractQueueWorker<MessageBatch<EmailQueueMessage>> {
|
|
65
|
+
protected async onQueue(batch: MessageBatch<EmailQueueMessage>): Promise<void> {
|
|
66
|
+
for (const message of batch.messages) message.ack();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**Redacting the error log.** Every base's catch reports through a `reportUnhandled(message, error)` hook that defaults to `console.error`. That default hands the caught value to the log verbatim, which is only safe when nothing in the call path can carry a secret. Override it where that is not true — the message stays a literal from `BASE_WORKER_MESSAGES`, so the override never has to interpolate untrusted text into a log line:
|
|
72
|
+
|
|
73
|
+
```ts
|
|
74
|
+
class TokenRefresher extends AbstractDurableObjectWorker<Env> {
|
|
75
|
+
protected override reportUnhandled(message: string, error: unknown): void {
|
|
76
|
+
logTokenAdjacentError('error', message); // never interpolates `error`
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
61
81
|
## 4. Logger and KV cache
|
|
62
82
|
|
|
63
83
|
```ts
|
|
@@ -15,6 +15,12 @@ import { DurableObject } from 'cloudflare:workers';
|
|
|
15
15
|
*/
|
|
16
16
|
declare abstract class AbstractDurableObjectWorker<TEnv = Env> extends DurableObject<TEnv> {
|
|
17
17
|
fetch(request: Request): Promise<Response>;
|
|
18
|
+
/**
|
|
19
|
+
* The sink for an unhandled rejection at this base's boundary. See
|
|
20
|
+
* `AbstractEntrypointWorker.reportUnhandled` — the base owns the static
|
|
21
|
+
* message, the consumer owns whether the caught value may be logged as-is.
|
|
22
|
+
*/
|
|
23
|
+
protected reportUnhandled(message: string, error: unknown): void;
|
|
18
24
|
/**
|
|
19
25
|
* The platform `ExecutionContext` shape, forwards `waitUntil` into the DO's
|
|
20
26
|
* own `ctx` so a handler can keep a task alive past the response.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AbstractDurableObjectWorker.d.ts","sourceRoot":"","sources":["../../src/base/AbstractDurableObjectWorker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"AbstractDurableObjectWorker.d.ts","sourceRoot":"","sources":["../../src/base/AbstractDurableObjectWorker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD;;;;;;;;;;;;;GAaG;AACH,uBAAe,2BAA2B,CAAC,IAAI,GAAG,GAAG,CAAE,SAAQ,aAAa,CAAC,IAAI,CAAC;IACnE,KAAK,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC;IASvD;;;;OAIG;IACH,SAAS,CAAC,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI;IAIhE;;;OAGG;IACH,SAAS,CAAC,sBAAsB,IAAI,gBAAgB;IAOpD,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC;CAClE;AAED,OAAO,EAAE,2BAA2B,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var o=Object.defineProperty;var
|
|
1
|
+
var o=Object.defineProperty;var t=(n,r)=>o(n,"name",{value:r,configurable:!0});import{DurableObject as a}from"cloudflare:workers";import{BASE_WORKER_MESSAGES as s}from"./baseWorkerError.js";class c extends a{static{t(this,"AbstractDurableObjectWorker")}async fetch(r){try{return await this.onRequest(r)}catch(e){return this.reportUnhandled(s.durableObjectFetch,e),Response.json({error:"Internal Error"},{status:500})}}reportUnhandled(r,e){console.error(r,e)}createExecutionContext(){return{waitUntil:t(r=>this.ctx.waitUntil(r),"waitUntil"),passThroughOnException:t(()=>{},"passThroughOnException")}}}export{c as AbstractDurableObjectWorker};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/base/AbstractDurableObjectWorker.ts"],
|
|
4
|
-
"sourcesContent": ["import { DurableObject } from 'cloudflare:workers';\n\n/**\n * The Durable Object base: one `fetch` entry, error containment inside it.\n *\n * Converged from the `AbstractDurableObjectWorker` copies in AWS-AccessBridge,\n * CalDAV-Bridge, ChordDHT-Tracker, Edge-Git, Mail-Meow and Mail-Otter (the\n * union is exactly Mail-Meow's shape: the fetch wrapper plus\n * `createExecutionContext` for handlers that need to forward `waitUntil`).\n * Durable-DAV's DO writes more context per handler, but the *base* is the same.\n *\n * A DO has no routing layer, so an unhandled rejection here would surface as a\n * raw 500 with no JSON body and no log. The catch is the boundary: it logs the\n * sanitized error and answers `{ error: 'Internal Error' }` so a caller always\n * gets a parseable response.\n */\nabstract class AbstractDurableObjectWorker<TEnv = Env> extends DurableObject<TEnv> {\n public async fetch(request: Request): Promise<Response> {\n try {\n return await this.onRequest(request);\n } catch (err: unknown) {\n
|
|
5
|
-
"mappings": "+EAAA,OAAS,iBAAAA,MAAqB,
|
|
6
|
-
"names": ["DurableObject", "AbstractDurableObjectWorker", "__name", "request", "err", "promise"]
|
|
4
|
+
"sourcesContent": ["import { DurableObject } from 'cloudflare:workers';\nimport { BASE_WORKER_MESSAGES } from './baseWorkerError.ts';\n\n/**\n * The Durable Object base: one `fetch` entry, error containment inside it.\n *\n * Converged from the `AbstractDurableObjectWorker` copies in AWS-AccessBridge,\n * CalDAV-Bridge, ChordDHT-Tracker, Edge-Git, Mail-Meow and Mail-Otter (the\n * union is exactly Mail-Meow's shape: the fetch wrapper plus\n * `createExecutionContext` for handlers that need to forward `waitUntil`).\n * Durable-DAV's DO writes more context per handler, but the *base* is the same.\n *\n * A DO has no routing layer, so an unhandled rejection here would surface as a\n * raw 500 with no JSON body and no log. The catch is the boundary: it logs the\n * sanitized error and answers `{ error: 'Internal Error' }` so a caller always\n * gets a parseable response.\n */\nabstract class AbstractDurableObjectWorker<TEnv = Env> extends DurableObject<TEnv> {\n public async fetch(request: Request): Promise<Response> {\n try {\n return await this.onRequest(request);\n } catch (err: unknown) {\n this.reportUnhandled(BASE_WORKER_MESSAGES.durableObjectFetch, err);\n return Response.json({ error: 'Internal Error' }, { status: 500 });\n }\n }\n\n /**\n * The sink for an unhandled rejection at this base's boundary. See\n * `AbstractEntrypointWorker.reportUnhandled` — the base owns the static\n * message, the consumer owns whether the caught value may be logged as-is.\n */\n protected reportUnhandled(message: string, error: unknown): void {\n console.error(message, error);\n }\n\n /**\n * The platform `ExecutionContext` shape, forwards `waitUntil` into the DO's\n * own `ctx` so a handler can keep a task alive past the response.\n */\n protected createExecutionContext(): ExecutionContext {\n return {\n waitUntil: (promise: Promise<unknown>): void => this.ctx.waitUntil(promise),\n passThroughOnException: (): void => undefined,\n };\n }\n\n protected abstract onRequest(request: Request): Promise<Response>;\n}\n\nexport { AbstractDurableObjectWorker };\n"],
|
|
5
|
+
"mappings": "+EAAA,OAAS,iBAAAA,MAAqB,qBAC9B,OAAS,wBAAAC,MAA4B,uBAgBrC,MAAeC,UAAgDF,CAAmB,CAjBlF,MAiBkF,CAAAG,EAAA,oCACzE,MAAM,MAAMC,EAAgB,CACjC,GAAI,CACF,OAAO,MAAM,KAAK,UAAUA,CAAO,CACrC,OAASC,EAAc,CACrB,YAAK,gBAAgBJ,EAAqB,mBAAoBI,CAAG,EAC1D,SAAS,KAAK,CAAE,MAAO,gBAAgB,EAAI,CAAE,OAAQ,GAAG,CAAE,CACnE,CACF,CAOU,gBAAgBC,EAAiBC,EAAc,CACvD,QAAQ,MAAMD,EAASC,CAAK,CAC9B,CAMU,wBAAsB,CAC9B,MAAO,CACL,UAAWJ,EAACK,GAAoC,KAAK,IAAI,UAAUA,CAAO,EAA/D,aACX,uBAAwBL,EAAA,IAAS,GAAT,0BAE5B",
|
|
6
|
+
"names": ["DurableObject", "BASE_WORKER_MESSAGES", "AbstractDurableObjectWorker", "__name", "request", "err", "message", "error", "promise"]
|
|
7
7
|
}
|
|
@@ -32,6 +32,16 @@ declare abstract class AbstractEntrypointWorker {
|
|
|
32
32
|
*/
|
|
33
33
|
fetch(request: Request, env: Env, ctx: WorkerExecutionContext): Promise<Response>;
|
|
34
34
|
scheduled(event: WorkerScheduledController, env: Env, ctx: WorkerExecutionContext): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* The sink for an unhandled rejection at this base's boundaries.
|
|
37
|
+
*
|
|
38
|
+
* Overridable because the default hands the caught value to `console.error`
|
|
39
|
+
* verbatim, which is only safe when nothing in the call path can carry a
|
|
40
|
+
* secret. A consumer whose entrypoint can transitively carry one overrides
|
|
41
|
+
* this to a redacting sink, and keeps the static message as the argument, so
|
|
42
|
+
* the redaction decision stays in the consumer where the threat model lives.
|
|
43
|
+
*/
|
|
44
|
+
protected reportUnhandled(message: string, error: unknown): void;
|
|
35
45
|
protected abstract onRequest(request: Request, env: Env, ctx: WorkerExecutionContext): Promise<Response>;
|
|
36
46
|
protected abstract onScheduled(event: WorkerScheduledController, env: Env, ctx: WorkerExecutionContext): Promise<void>;
|
|
37
47
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AbstractEntrypointWorker.d.ts","sourceRoot":"","sources":["../../src/base/AbstractEntrypointWorker.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AbstractEntrypointWorker.d.ts","sourceRoot":"","sources":["../../src/base/AbstractEntrypointWorker.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,UAAU,sBAAsB;IAC9B,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;IAC3C,sBAAsB,IAAI,IAAI,CAAC;CAChC;AAED,UAAU,yBAAyB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,uBAAe,wBAAwB;IACrC;;;;;;;;;;;;;OAaG;IACU,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,sBAAsB,GAAG,OAAO,CAAC,QAAQ,CAAC;IASjF,SAAS,CAAC,KAAK,EAAE,yBAAyB,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ9G;;;;;;;;OAQG;IACH,SAAS,CAAC,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI;IAIhE,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,sBAAsB,GAAG,OAAO,CAAC,QAAQ,CAAC;IAExG,SAAS,CAAC,QAAQ,CAAC,WAAW,CAAC,KAAK,EAAE,yBAAyB,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;CACvH;AAED,OAAO,EAAE,wBAAwB,EAAE,CAAC;AACpC,YAAY,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var c=Object.defineProperty;var a=(s,r)=>c(s,"name",{value:r,configurable:!0});import{BASE_WORKER_MESSAGES as o}from"./baseWorkerError.js";class h{static{a(this,"AbstractEntrypointWorker")}async fetch(r,e,t){try{return await this.onRequest(r,e,t)}catch(n){return this.reportUnhandled(o.fetch,n),new Response("Internal Error",{status:500})}}async scheduled(r,e,t){try{await this.onScheduled(r,e,t)}catch(n){this.reportUnhandled(o.scheduled,n)}}reportUnhandled(r,e){console.error(r,e)}}export{h as AbstractEntrypointWorker};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/base/AbstractEntrypointWorker.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Minimal Workers-compatible context types so backend-runtime typechecks\n * without @cloudflare/workers-types. Apps pass the real ExecutionContext /\n * ScheduledController which satisfy these structurally.\n *\n * Converged verbatim from `backend-runtime/src/base/AbstractEntrypointWorker.ts`\n * (identical in all nine repos).\n */\ninterface WorkerExecutionContext {\n waitUntil(promise: Promise<unknown>): void;\n passThroughOnException(): void;\n}\n\ninterface WorkerScheduledController {\n cron: string;\n scheduledTime: number;\n noRetry(): void;\n}\n\nabstract class AbstractEntrypointWorker {\n /**\n * The HTTP request path.\n *\n * There is deliberately no `/__scheduled` branch here. It used to run before\n * `onRequest`, which made `GET /__scheduled` an unauthenticated, un-rated\n * trigger for the scheduled work: it bypassed the app's security headers, its\n * request scope, and its rate limits, and any caller could fire the cron\n * Durable Object on demand. `noRetry` was a `(): void => undefined` stub, so\n * the retry semantics were lost too.\n *\n * Nothing needed it — `scheduled()` is wired through the platform by the\n * `triggers.crons` entry in the wrangler config, which is how the cron\n * actually runs.\n */\n public async fetch(request: Request, env: Env, ctx: WorkerExecutionContext): Promise<Response> {\n try {\n return await this.onRequest(request, env, ctx);\n } catch (err: unknown) {\n
|
|
5
|
-
"mappings": "+
|
|
6
|
-
"names": ["AbstractEntrypointWorker", "__name", "request", "env", "ctx", "err", "event"]
|
|
4
|
+
"sourcesContent": ["import { BASE_WORKER_MESSAGES } from './baseWorkerError.ts';\n\n/**\n * Minimal Workers-compatible context types so backend-runtime typechecks\n * without @cloudflare/workers-types. Apps pass the real ExecutionContext /\n * ScheduledController which satisfy these structurally.\n *\n * Converged verbatim from `backend-runtime/src/base/AbstractEntrypointWorker.ts`\n * (identical in all nine repos).\n */\ninterface WorkerExecutionContext {\n waitUntil(promise: Promise<unknown>): void;\n passThroughOnException(): void;\n}\n\ninterface WorkerScheduledController {\n cron: string;\n scheduledTime: number;\n noRetry(): void;\n}\n\nabstract class AbstractEntrypointWorker {\n /**\n * The HTTP request path.\n *\n * There is deliberately no `/__scheduled` branch here. It used to run before\n * `onRequest`, which made `GET /__scheduled` an unauthenticated, un-rated\n * trigger for the scheduled work: it bypassed the app's security headers, its\n * request scope, and its rate limits, and any caller could fire the cron\n * Durable Object on demand. `noRetry` was a `(): void => undefined` stub, so\n * the retry semantics were lost too.\n *\n * Nothing needed it — `scheduled()` is wired through the platform by the\n * `triggers.crons` entry in the wrangler config, which is how the cron\n * actually runs.\n */\n public async fetch(request: Request, env: Env, ctx: WorkerExecutionContext): Promise<Response> {\n try {\n return await this.onRequest(request, env, ctx);\n } catch (err: unknown) {\n this.reportUnhandled(BASE_WORKER_MESSAGES.fetch, err);\n return new Response('Internal Error', { status: 500 });\n }\n }\n\n public async scheduled(event: WorkerScheduledController, env: Env, ctx: WorkerExecutionContext): Promise<void> {\n try {\n await this.onScheduled(event, env, ctx);\n } catch (err: unknown) {\n this.reportUnhandled(BASE_WORKER_MESSAGES.scheduled, err);\n }\n }\n\n /**\n * The sink for an unhandled rejection at this base's boundaries.\n *\n * Overridable because the default hands the caught value to `console.error`\n * verbatim, which is only safe when nothing in the call path can carry a\n * secret. A consumer whose entrypoint can transitively carry one overrides\n * this to a redacting sink, and keeps the static message as the argument, so\n * the redaction decision stays in the consumer where the threat model lives.\n */\n protected reportUnhandled(message: string, error: unknown): void {\n console.error(message, error);\n }\n\n protected abstract onRequest(request: Request, env: Env, ctx: WorkerExecutionContext): Promise<Response>;\n\n protected abstract onScheduled(event: WorkerScheduledController, env: Env, ctx: WorkerExecutionContext): Promise<void>;\n}\n\nexport { AbstractEntrypointWorker };\nexport type { WorkerExecutionContext, WorkerScheduledController };\n"],
|
|
5
|
+
"mappings": "+EAAA,OAAS,wBAAAA,MAA4B,uBAqBrC,MAAeC,CAAwB,CArBvC,MAqBuC,CAAAC,EAAA,iCAe9B,MAAM,MAAMC,EAAkBC,EAAUC,EAA2B,CACxE,GAAI,CACF,OAAO,MAAM,KAAK,UAAUF,EAASC,EAAKC,CAAG,CAC/C,OAASC,EAAc,CACrB,YAAK,gBAAgBN,EAAqB,MAAOM,CAAG,EAC7C,IAAI,SAAS,iBAAkB,CAAE,OAAQ,GAAG,CAAE,CACvD,CACF,CAEO,MAAM,UAAUC,EAAkCH,EAAUC,EAA2B,CAC5F,GAAI,CACF,MAAM,KAAK,YAAYE,EAAOH,EAAKC,CAAG,CACxC,OAASC,EAAc,CACrB,KAAK,gBAAgBN,EAAqB,UAAWM,CAAG,CAC1D,CACF,CAWU,gBAAgBE,EAAiBC,EAAc,CACvD,QAAQ,MAAMD,EAASC,CAAK,CAC9B",
|
|
6
|
+
"names": ["BASE_WORKER_MESSAGES", "AbstractEntrypointWorker", "__name", "request", "env", "ctx", "err", "event", "message", "error"]
|
|
7
7
|
}
|
|
@@ -1,20 +1,31 @@
|
|
|
1
1
|
import type { WorkerExecutionContext } from './AbstractEntrypointWorker.ts';
|
|
2
2
|
/**
|
|
3
|
-
* The queue consumer base, converged
|
|
4
|
-
*
|
|
5
|
-
* consumers).
|
|
3
|
+
* The queue consumer base, converged from the `AbstractQueueWorker` copies in
|
|
4
|
+
* Edge-Git and Mail-Otter (the only two repos with queue consumers).
|
|
6
5
|
*
|
|
7
6
|
* It rethrows after logging: a queue message that failed must be *retried* by
|
|
8
7
|
* the platform, and a base that swallowed the rejection would turn a transient
|
|
9
8
|
* handler failure into an acked, dropped message.
|
|
9
|
+
*
|
|
10
|
+
* **The batch is a type parameter, not a modelled shape.** This base never
|
|
11
|
+
* reads the batch — it forwards it — so declaring a structural stand-in for it
|
|
12
|
+
* bought nothing and cost correctness: the old `WorkerMessageBatch<T>` modelled
|
|
13
|
+
* `messages: T[]`, which is wrong twice over (the platform's elements are
|
|
14
|
+
* `Message<T>`, and a real batch also carries `queue`, `metadata`, `ackAll` and
|
|
15
|
+
* `retryAll`). A consumer subclassing against that type lost `batch.queue` and
|
|
16
|
+
* every `message.ack()`/`message.retry()`, and had to cast to get them back.
|
|
17
|
+
*
|
|
18
|
+
* Passing the platform `MessageBatch<Body>` as `TBatch` gives the handler the
|
|
19
|
+
* full surface with no cast and no duplication of the platform's own types.
|
|
10
20
|
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
21
|
+
declare abstract class AbstractQueueWorker<TBatch = unknown> {
|
|
22
|
+
queue(batch: TBatch, env: Env, ctx: WorkerExecutionContext): Promise<void>;
|
|
23
|
+
/**
|
|
24
|
+
* The sink for an unhandled rejection at this base's boundary. See
|
|
25
|
+
* `AbstractEntrypointWorker.reportUnhandled`.
|
|
26
|
+
*/
|
|
27
|
+
protected reportUnhandled(message: string, error: unknown): void;
|
|
28
|
+
protected abstract onQueue(batch: TBatch, env: Env, ctx: WorkerExecutionContext): Promise<void>;
|
|
17
29
|
}
|
|
18
30
|
export { AbstractQueueWorker };
|
|
19
|
-
export type { WorkerMessageBatch };
|
|
20
31
|
//# sourceMappingURL=AbstractQueueWorker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AbstractQueueWorker.d.ts","sourceRoot":"","sources":["../../src/base/AbstractQueueWorker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"AbstractQueueWorker.d.ts","sourceRoot":"","sources":["../../src/base/AbstractQueueWorker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAG5E;;;;;;;;;;;;;;;;;;GAkBG;AACH,uBAAe,mBAAmB,CAAC,MAAM,GAAG,OAAO;IACpC,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;IASvF;;;OAGG;IACH,SAAS,CAAC,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI;IAIhE,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;CAChG;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var n=Object.defineProperty;var a=(t,e)=>n(t,"name",{value:e,configurable:!0});import{BASE_WORKER_MESSAGES as s}from"./baseWorkerError.js";class c{static{a(this,"AbstractQueueWorker")}async queue(e,r,u){try{await this.onQueue(e,r,u)}catch(o){throw this.reportUnhandled(s.queue,o),o}}reportUnhandled(e,r){console.error(e,r)}}export{c as AbstractQueueWorker};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/base/AbstractQueueWorker.ts"],
|
|
4
|
-
"sourcesContent": ["import type { WorkerExecutionContext } from './AbstractEntrypointWorker.ts';\n\n/**\n * The queue consumer base, converged
|
|
5
|
-
"mappings": "+
|
|
6
|
-
"names": ["AbstractQueueWorker", "__name", "batch", "env", "ctx", "err"]
|
|
4
|
+
"sourcesContent": ["import type { WorkerExecutionContext } from './AbstractEntrypointWorker.ts';\nimport { BASE_WORKER_MESSAGES } from './baseWorkerError.ts';\n\n/**\n * The queue consumer base, converged from the `AbstractQueueWorker` copies in\n * Edge-Git and Mail-Otter (the only two repos with queue consumers).\n *\n * It rethrows after logging: a queue message that failed must be *retried* by\n * the platform, and a base that swallowed the rejection would turn a transient\n * handler failure into an acked, dropped message.\n *\n * **The batch is a type parameter, not a modelled shape.** This base never\n * reads the batch — it forwards it — so declaring a structural stand-in for it\n * bought nothing and cost correctness: the old `WorkerMessageBatch<T>` modelled\n * `messages: T[]`, which is wrong twice over (the platform's elements are\n * `Message<T>`, and a real batch also carries `queue`, `metadata`, `ackAll` and\n * `retryAll`). A consumer subclassing against that type lost `batch.queue` and\n * every `message.ack()`/`message.retry()`, and had to cast to get them back.\n *\n * Passing the platform `MessageBatch<Body>` as `TBatch` gives the handler the\n * full surface with no cast and no duplication of the platform's own types.\n */\nabstract class AbstractQueueWorker<TBatch = unknown> {\n public async queue(batch: TBatch, env: Env, ctx: WorkerExecutionContext): Promise<void> {\n try {\n await this.onQueue(batch, env, ctx);\n } catch (err: unknown) {\n this.reportUnhandled(BASE_WORKER_MESSAGES.queue, err);\n throw err;\n }\n }\n\n /**\n * The sink for an unhandled rejection at this base's boundary. See\n * `AbstractEntrypointWorker.reportUnhandled`.\n */\n protected reportUnhandled(message: string, error: unknown): void {\n console.error(message, error);\n }\n\n protected abstract onQueue(batch: TBatch, env: Env, ctx: WorkerExecutionContext): Promise<void>;\n}\n\nexport { AbstractQueueWorker };\n"],
|
|
5
|
+
"mappings": "+EACA,OAAS,wBAAAA,MAA4B,uBAqBrC,MAAeC,CAAmB,CArBlC,MAqBkC,CAAAC,EAAA,4BACzB,MAAM,MAAMC,EAAeC,EAAUC,EAA2B,CACrE,GAAI,CACF,MAAM,KAAK,QAAQF,EAAOC,EAAKC,CAAG,CACpC,OAASC,EAAc,CACrB,WAAK,gBAAgBN,EAAqB,MAAOM,CAAG,EAC9CA,CACR,CACF,CAMU,gBAAgBC,EAAiBC,EAAc,CACvD,QAAQ,MAAMD,EAASC,CAAK,CAC9B",
|
|
6
|
+
"names": ["BASE_WORKER_MESSAGES", "AbstractQueueWorker", "__name", "batch", "env", "ctx", "err", "message", "error"]
|
|
7
7
|
}
|
|
@@ -1,22 +1,29 @@
|
|
|
1
|
+
import { WorkflowEntrypoint } from 'cloudflare:workers';
|
|
2
|
+
import type { WorkflowEvent, WorkflowStep } from 'cloudflare:workers';
|
|
1
3
|
/**
|
|
2
|
-
* The Workflow base, converged
|
|
3
|
-
*
|
|
4
|
-
*
|
|
4
|
+
* The Workflow base, converged from the `AbstractWorkflowWorker` copies in
|
|
5
|
+
* Edge-Git and Mail-Otter (Edge-Sonic ships the same shape as `runWorkflow.ts`
|
|
6
|
+
* with a `WorkflowEntrypoint` wrapper around it).
|
|
5
7
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
8
|
+
* It extends the platform `WorkflowEntrypoint` because a workflow handler needs
|
|
9
|
+
* `this.env` — it is where the bindings come from, and every step in a real
|
|
10
|
+
* workflow builds a request scope from it. An earlier version of this file
|
|
11
|
+
* modelled `WorkflowEventLike`/`WorkflowStepLike` as standalone structural
|
|
12
|
+
* types and dropped the parent class, which removed `this.env` and reduced
|
|
13
|
+
* `step.do` to `(name, callback)`. That is not a stricter shape, it is a lossy
|
|
14
|
+
* one: it took away the per-step `retries`/`timeout` config that makes a step
|
|
15
|
+
* retryable under the platform rather than a bare coroutine call. Both are
|
|
16
|
+
* restored here, and the structural types are gone with them — the platform
|
|
17
|
+
* types are the ones that were correct all along.
|
|
9
18
|
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
protected abstract onWorkflow(event: Readonly<WorkflowEventLike<TPayload>>, step: WorkflowStepLike): Promise<TResult>;
|
|
19
|
+
declare abstract class AbstractWorkflowWorker<TEnv = Env, TPayload = unknown, TResult = unknown> extends WorkflowEntrypoint<TEnv, TPayload> {
|
|
20
|
+
run(event: Readonly<WorkflowEvent<TPayload>>, step: WorkflowStep): Promise<TResult>;
|
|
21
|
+
/**
|
|
22
|
+
* The sink for an unhandled rejection at this base's boundary. See
|
|
23
|
+
* `AbstractEntrypointWorker.reportUnhandled`.
|
|
24
|
+
*/
|
|
25
|
+
protected reportUnhandled(message: string, error: unknown): void;
|
|
26
|
+
protected abstract onWorkflow(event: Readonly<WorkflowEvent<TPayload>>, step: WorkflowStep): Promise<TResult>;
|
|
19
27
|
}
|
|
20
28
|
export { AbstractWorkflowWorker };
|
|
21
|
-
export type { WorkflowEventLike, WorkflowStepLike };
|
|
22
29
|
//# sourceMappingURL=AbstractWorkflowWorker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AbstractWorkflowWorker.d.ts","sourceRoot":"","sources":["../../src/base/AbstractWorkflowWorker.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"AbstractWorkflowWorker.d.ts","sourceRoot":"","sources":["../../src/base/AbstractWorkflowWorker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGtE;;;;;;;;;;;;;;;GAeG;AACH,uBAAe,sBAAsB,CAAC,IAAI,GAAG,GAAG,EAAE,QAAQ,GAAG,OAAO,EAAE,OAAO,GAAG,OAAO,CAAE,SAAQ,kBAAkB,CAAC,IAAI,EAAE,QAAQ,CAAC;IACpH,GAAG,CAAC,KAAK,EAAE,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC;IAShG;;;OAGG;IACH,SAAS,CAAC,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI;IAIhE,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC,KAAK,EAAE,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC;CAC9G;AAED,OAAO,EAAE,sBAAsB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var a=Object.defineProperty;var
|
|
1
|
+
var a=Object.defineProperty;var n=(t,r)=>a(t,"name",{value:r,configurable:!0});import{WorkflowEntrypoint as l}from"cloudflare:workers";import{BASE_WORKER_MESSAGES as s}from"./baseWorkerError.js";class w extends l{static{n(this,"AbstractWorkflowWorker")}async run(r,o){try{return await this.onWorkflow(r,o)}catch(e){throw this.reportUnhandled(s.workflow,e),e}}reportUnhandled(r,o){console.error(r,o)}}export{w as AbstractWorkflowWorker};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/base/AbstractWorkflowWorker.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * The Workflow base, converged
|
|
5
|
-
"mappings": "+
|
|
6
|
-
"names": ["AbstractWorkflowWorker", "__name", "event", "step", "err"]
|
|
4
|
+
"sourcesContent": ["import { WorkflowEntrypoint } from 'cloudflare:workers';\nimport type { WorkflowEvent, WorkflowStep } from 'cloudflare:workers';\nimport { BASE_WORKER_MESSAGES } from './baseWorkerError.ts';\n\n/**\n * The Workflow base, converged from the `AbstractWorkflowWorker` copies in\n * Edge-Git and Mail-Otter (Edge-Sonic ships the same shape as `runWorkflow.ts`\n * with a `WorkflowEntrypoint` wrapper around it).\n *\n * It extends the platform `WorkflowEntrypoint` because a workflow handler needs\n * `this.env` — it is where the bindings come from, and every step in a real\n * workflow builds a request scope from it. An earlier version of this file\n * modelled `WorkflowEventLike`/`WorkflowStepLike` as standalone structural\n * types and dropped the parent class, which removed `this.env` and reduced\n * `step.do` to `(name, callback)`. That is not a stricter shape, it is a lossy\n * one: it took away the per-step `retries`/`timeout` config that makes a step\n * retryable under the platform rather than a bare coroutine call. Both are\n * restored here, and the structural types are gone with them — the platform\n * types are the ones that were correct all along.\n */\nabstract class AbstractWorkflowWorker<TEnv = Env, TPayload = unknown, TResult = unknown> extends WorkflowEntrypoint<TEnv, TPayload> {\n public async run(event: Readonly<WorkflowEvent<TPayload>>, step: WorkflowStep): Promise<TResult> {\n try {\n return await this.onWorkflow(event, step);\n } catch (err: unknown) {\n this.reportUnhandled(BASE_WORKER_MESSAGES.workflow, err);\n throw err;\n }\n }\n\n /**\n * The sink for an unhandled rejection at this base's boundary. See\n * `AbstractEntrypointWorker.reportUnhandled`.\n */\n protected reportUnhandled(message: string, error: unknown): void {\n console.error(message, error);\n }\n\n protected abstract onWorkflow(event: Readonly<WorkflowEvent<TPayload>>, step: WorkflowStep): Promise<TResult>;\n}\n\nexport { AbstractWorkflowWorker };\n"],
|
|
5
|
+
"mappings": "+EAAA,OAAS,sBAAAA,MAA0B,qBAEnC,OAAS,wBAAAC,MAA4B,uBAkBrC,MAAeC,UAAkFF,CAAkC,CApBnI,MAoBmI,CAAAG,EAAA,+BAC1H,MAAM,IAAIC,EAA0CC,EAAkB,CAC3E,GAAI,CACF,OAAO,MAAM,KAAK,WAAWD,EAAOC,CAAI,CAC1C,OAASC,EAAc,CACrB,WAAK,gBAAgBL,EAAqB,SAAUK,CAAG,EACjDA,CACR,CACF,CAMU,gBAAgBC,EAAiBC,EAAc,CACvD,QAAQ,MAAMD,EAASC,CAAK,CAC9B",
|
|
6
|
+
"names": ["WorkflowEntrypoint", "BASE_WORKER_MESSAGES", "AbstractWorkflowWorker", "__name", "event", "step", "err", "message", "error"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The error-reporting seam shared by every worker base.
|
|
3
|
+
*
|
|
4
|
+
* Each base catches an unhandled rejection, reports it, and (for the
|
|
5
|
+
* request-shaped ones) answers 500. What it must *not* do is decide what the
|
|
6
|
+
* caught value is safe to write, because that is not the base's knowledge: the
|
|
7
|
+
* base cannot know whether the value transitively carries a credential, and
|
|
8
|
+
* every consumer's token-adjacent boundaries redact differently.
|
|
9
|
+
*
|
|
10
|
+
* So the base owns the message and the consumer owns the sink. `message` is
|
|
11
|
+
* always one of the literals in `BASE_WORKER_MESSAGES` — never an interpolated
|
|
12
|
+
* value — so an override can forward it without itself becoming a place where
|
|
13
|
+
* untrusted text reaches a log line.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Every boundary that reports an unhandled rejection.
|
|
17
|
+
*
|
|
18
|
+
* A member per base rather than a free-form string, because the message table
|
|
19
|
+
* is keyed on it: a base that grows a new entry point cannot pick a message the
|
|
20
|
+
* table does not have.
|
|
21
|
+
*/
|
|
22
|
+
type BaseWorkerOperation = 'fetch' | 'scheduled' | 'queue' | 'workflow' | 'durableObjectFetch';
|
|
23
|
+
/**
|
|
24
|
+
* Operator-facing text per boundary, in the shape a log line wants: a constant
|
|
25
|
+
* prefix, with the caught value following it.
|
|
26
|
+
*
|
|
27
|
+
* Static by construction. A base interpolating anything into these is the exact
|
|
28
|
+
* pattern consumer codebases are told to avoid, and it would be the kit
|
|
29
|
+
* introducing it.
|
|
30
|
+
*/
|
|
31
|
+
declare const BASE_WORKER_MESSAGES: Readonly<Record<BaseWorkerOperation, string>>;
|
|
32
|
+
export { BASE_WORKER_MESSAGES };
|
|
33
|
+
export type { BaseWorkerOperation };
|
|
34
|
+
//# sourceMappingURL=baseWorkerError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"baseWorkerError.d.ts","sourceRoot":"","sources":["../../src/base/baseWorkerError.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;;;;GAMG;AACH,KAAK,mBAAmB,GAAG,OAAO,GAAG,WAAW,GAAG,OAAO,GAAG,UAAU,GAAG,oBAAoB,CAAC;AAE/F;;;;;;;GAOG;AACH,QAAA,MAAM,oBAAoB,EAAE,QAAQ,CAAC,MAAM,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAMvE,CAAC;AAEF,OAAO,EAAE,oBAAoB,EAAE,CAAC;AAChC,YAAY,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e={fetch:"Unhandled error in fetch():",scheduled:"Unhandled error in scheduled():",queue:"Unhandled error in queue():",workflow:"Unhandled error in workflow run():",durableObjectFetch:"Unhandled error in durable object fetch():"};export{e as BASE_WORKER_MESSAGES};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/base/baseWorkerError.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * The error-reporting seam shared by every worker base.\n *\n * Each base catches an unhandled rejection, reports it, and (for the\n * request-shaped ones) answers 500. What it must *not* do is decide what the\n * caught value is safe to write, because that is not the base's knowledge: the\n * base cannot know whether the value transitively carries a credential, and\n * every consumer's token-adjacent boundaries redact differently.\n *\n * So the base owns the message and the consumer owns the sink. `message` is\n * always one of the literals in `BASE_WORKER_MESSAGES` — never an interpolated\n * value — so an override can forward it without itself becoming a place where\n * untrusted text reaches a log line.\n */\n\n/**\n * Every boundary that reports an unhandled rejection.\n *\n * A member per base rather than a free-form string, because the message table\n * is keyed on it: a base that grows a new entry point cannot pick a message the\n * table does not have.\n */\ntype BaseWorkerOperation = 'fetch' | 'scheduled' | 'queue' | 'workflow' | 'durableObjectFetch';\n\n/**\n * Operator-facing text per boundary, in the shape a log line wants: a constant\n * prefix, with the caught value following it.\n *\n * Static by construction. A base interpolating anything into these is the exact\n * pattern consumer codebases are told to avoid, and it would be the kit\n * introducing it.\n */\nconst BASE_WORKER_MESSAGES: Readonly<Record<BaseWorkerOperation, string>> = {\n fetch: 'Unhandled error in fetch():',\n scheduled: 'Unhandled error in scheduled():',\n queue: 'Unhandled error in queue():',\n workflow: 'Unhandled error in workflow run():',\n durableObjectFetch: 'Unhandled error in durable object fetch():',\n};\n\nexport { BASE_WORKER_MESSAGES };\nexport type { BaseWorkerOperation };\n"],
|
|
5
|
+
"mappings": "AAgCA,MAAMA,EAAsE,CAC1E,MAAO,8BACP,UAAW,kCACX,MAAO,8BACP,SAAU,qCACV,mBAAoB",
|
|
6
|
+
"names": ["BASE_WORKER_MESSAGES"]
|
|
7
|
+
}
|
package/dist/base/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { AbstractEntrypointWorker } from './AbstractEntrypointWorker.ts';
|
|
|
2
2
|
export type { WorkerExecutionContext, WorkerScheduledController } from './AbstractEntrypointWorker.ts';
|
|
3
3
|
export { AbstractDurableObjectWorker } from './AbstractDurableObjectWorker.ts';
|
|
4
4
|
export { AbstractQueueWorker } from './AbstractQueueWorker.ts';
|
|
5
|
-
export type { WorkerMessageBatch } from './AbstractQueueWorker.ts';
|
|
6
5
|
export { AbstractWorkflowWorker } from './AbstractWorkflowWorker.ts';
|
|
7
|
-
export
|
|
6
|
+
export { BASE_WORKER_MESSAGES } from './baseWorkerError.ts';
|
|
7
|
+
export type { BaseWorkerOperation } from './baseWorkerError.ts';
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/base/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/base/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,YAAY,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AACvG,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/base/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,YAAY,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AACvG,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,YAAY,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC"}
|
package/dist/base/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{AbstractEntrypointWorker as t}from"./AbstractEntrypointWorker.js";import{AbstractDurableObjectWorker as b}from"./AbstractDurableObjectWorker.js";import{AbstractQueueWorker as
|
|
1
|
+
import{AbstractEntrypointWorker as t}from"./AbstractEntrypointWorker.js";import{AbstractDurableObjectWorker as b}from"./AbstractDurableObjectWorker.js";import{AbstractQueueWorker as p}from"./AbstractQueueWorker.js";import{AbstractWorkflowWorker as W}from"./AbstractWorkflowWorker.js";import{BASE_WORKER_MESSAGES as c}from"./baseWorkerError.js";export{b as AbstractDurableObjectWorker,t as AbstractEntrypointWorker,p as AbstractQueueWorker,W as AbstractWorkflowWorker,c as BASE_WORKER_MESSAGES};
|
package/dist/base/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/base/index.ts"],
|
|
4
|
-
"sourcesContent": ["export { AbstractEntrypointWorker } from './AbstractEntrypointWorker.ts';\nexport type { WorkerExecutionContext, WorkerScheduledController } from './AbstractEntrypointWorker.ts';\nexport { AbstractDurableObjectWorker } from './AbstractDurableObjectWorker.ts';\nexport { AbstractQueueWorker } from './AbstractQueueWorker.ts';\nexport
|
|
5
|
-
"mappings": "AAAA,OAAS,4BAAAA,MAAgC,gCAEzC,OAAS,+BAAAC,MAAmC,mCAC5C,OAAS,uBAAAC,MAA2B,
|
|
6
|
-
"names": ["AbstractEntrypointWorker", "AbstractDurableObjectWorker", "AbstractQueueWorker", "AbstractWorkflowWorker"]
|
|
4
|
+
"sourcesContent": ["export { AbstractEntrypointWorker } from './AbstractEntrypointWorker.ts';\nexport type { WorkerExecutionContext, WorkerScheduledController } from './AbstractEntrypointWorker.ts';\nexport { AbstractDurableObjectWorker } from './AbstractDurableObjectWorker.ts';\nexport { AbstractQueueWorker } from './AbstractQueueWorker.ts';\nexport { AbstractWorkflowWorker } from './AbstractWorkflowWorker.ts';\nexport { BASE_WORKER_MESSAGES } from './baseWorkerError.ts';\nexport type { BaseWorkerOperation } from './baseWorkerError.ts';\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,4BAAAA,MAAgC,gCAEzC,OAAS,+BAAAC,MAAmC,mCAC5C,OAAS,uBAAAC,MAA2B,2BACpC,OAAS,0BAAAC,MAA8B,8BACvC,OAAS,wBAAAC,MAA4B",
|
|
6
|
+
"names": ["AbstractEntrypointWorker", "AbstractDurableObjectWorker", "AbstractQueueWorker", "AbstractWorkflowWorker", "BASE_WORKER_MESSAGES"]
|
|
7
7
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -14,9 +14,9 @@ export { AbstractEntrypointWorker } from './base/AbstractEntrypointWorker.ts';
|
|
|
14
14
|
export type { WorkerExecutionContext, WorkerScheduledController } from './base/AbstractEntrypointWorker.ts';
|
|
15
15
|
export { AbstractDurableObjectWorker } from './base/AbstractDurableObjectWorker.ts';
|
|
16
16
|
export { AbstractQueueWorker } from './base/AbstractQueueWorker.ts';
|
|
17
|
-
export type { WorkerMessageBatch } from './base/AbstractQueueWorker.ts';
|
|
18
17
|
export { AbstractWorkflowWorker } from './base/AbstractWorkflowWorker.ts';
|
|
19
|
-
export
|
|
18
|
+
export { BASE_WORKER_MESSAGES } from './base/baseWorkerError.ts';
|
|
19
|
+
export type { BaseWorkerOperation } from './base/baseWorkerError.ts';
|
|
20
20
|
export { createLogger, isLogLevel, resolveLogLevel } from './logger.ts';
|
|
21
21
|
export type { LogLevel, Logger } from './logger.ts';
|
|
22
22
|
export { KvCache, KV_DOMAINS, buildKvKey, clampTtl, digest128 } from './kv/index.ts';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,YAAY,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACzF,YAAY,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,YAAY,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAC5G,OAAO,EAAE,2BAA2B,EAAE,MAAM,uCAAuC,CAAC;AACpF,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,YAAY,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACzF,YAAY,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,YAAY,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAC5G,OAAO,EAAE,2BAA2B,EAAE,MAAM,uCAAuC,CAAC;AACpF,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,YAAY,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACxE,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACrF,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC3E,YAAY,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,UAAU,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Container as o}from"./di/Container.js";import{asScopedContext as p,getRequestScope as s,setRequestScope as a}from"./di/RequestScope.js";import{AppConfiguration as
|
|
1
|
+
import{Container as o}from"./di/Container.js";import{asScopedContext as p,getRequestScope as s,setRequestScope as a}from"./di/RequestScope.js";import{AppConfiguration as m}from"./config/AppConfiguration.js";import{EnvParser as c}from"./config/EnvParser.js";import{DEFAULT_SITE_URL as S}from"./config/ConfigurationDefaults.js";import{AbstractEntrypointWorker as b}from"./base/AbstractEntrypointWorker.js";import{AbstractDurableObjectWorker as i}from"./base/AbstractDurableObjectWorker.js";import{AbstractQueueWorker as u}from"./base/AbstractQueueWorker.js";import{AbstractWorkflowWorker as k}from"./base/AbstractWorkflowWorker.js";import{BASE_WORKER_MESSAGES as v}from"./base/baseWorkerError.js";import{createLogger as W,isLogLevel as d,resolveLogLevel as K}from"./logger.js";import{KvCache as _,KV_DOMAINS as C,buildKvKey as y,clampTtl as D,digest128 as O}from"./kv/index.js";import{AbstractScheduledTask as q,TaskRegistry as I}from"./scheduled/index.js";export{i as AbstractDurableObjectWorker,b as AbstractEntrypointWorker,u as AbstractQueueWorker,q as AbstractScheduledTask,k as AbstractWorkflowWorker,m as AppConfiguration,v as BASE_WORKER_MESSAGES,o as Container,S as DEFAULT_SITE_URL,c as EnvParser,C as KV_DOMAINS,_ as KvCache,I as TaskRegistry,p as asScopedContext,y as buildKvKey,D as clampTtl,W as createLogger,O as digest128,s as getRequestScope,d as isLogLevel,K as resolveLogLevel,a as setRequestScope};
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * `@rexezuge/runtime` — the platform foundation layer: DI, configuration,\n * worker bases, logger, KV cache. Zero dependencies (the one platform import\n * is type-only, resolved through each consumer's generated wrangler types).\n */\n\nexport { Container } from './di/Container.ts';\nexport type { Factory, Token } from './di/Container.ts';\nexport { asScopedContext, getRequestScope, setRequestScope } from './di/RequestScope.ts';\nexport type { ScopedContext } from './di/RequestScope.ts';\nexport { AppConfiguration } from './config/AppConfiguration.ts';\nexport { EnvParser } from './config/EnvParser.ts';\nexport { DEFAULT_SITE_URL } from './config/ConfigurationDefaults.ts';\nexport { AbstractEntrypointWorker } from './base/AbstractEntrypointWorker.ts';\nexport type { WorkerExecutionContext, WorkerScheduledController } from './base/AbstractEntrypointWorker.ts';\nexport { AbstractDurableObjectWorker } from './base/AbstractDurableObjectWorker.ts';\nexport { AbstractQueueWorker } from './base/AbstractQueueWorker.ts';\nexport
|
|
5
|
-
"mappings": "AAMA,OAAS,aAAAA,MAAiB,oBAE1B,OAAS,mBAAAC,EAAiB,mBAAAC,EAAiB,mBAAAC,MAAuB,uBAElE,OAAS,oBAAAC,MAAwB,+BACjC,OAAS,aAAAC,MAAiB,wBAC1B,OAAS,oBAAAC,MAAwB,oCACjC,OAAS,4BAAAC,MAAgC,qCAEzC,OAAS,+BAAAC,MAAmC,wCAC5C,OAAS,uBAAAC,MAA2B,
|
|
6
|
-
"names": ["Container", "asScopedContext", "getRequestScope", "setRequestScope", "AppConfiguration", "EnvParser", "DEFAULT_SITE_URL", "AbstractEntrypointWorker", "AbstractDurableObjectWorker", "AbstractQueueWorker", "AbstractWorkflowWorker", "createLogger", "isLogLevel", "resolveLogLevel", "KvCache", "KV_DOMAINS", "buildKvKey", "clampTtl", "digest128", "AbstractScheduledTask", "TaskRegistry"]
|
|
4
|
+
"sourcesContent": ["/**\n * `@rexezuge/runtime` — the platform foundation layer: DI, configuration,\n * worker bases, logger, KV cache. Zero dependencies (the one platform import\n * is type-only, resolved through each consumer's generated wrangler types).\n */\n\nexport { Container } from './di/Container.ts';\nexport type { Factory, Token } from './di/Container.ts';\nexport { asScopedContext, getRequestScope, setRequestScope } from './di/RequestScope.ts';\nexport type { ScopedContext } from './di/RequestScope.ts';\nexport { AppConfiguration } from './config/AppConfiguration.ts';\nexport { EnvParser } from './config/EnvParser.ts';\nexport { DEFAULT_SITE_URL } from './config/ConfigurationDefaults.ts';\nexport { AbstractEntrypointWorker } from './base/AbstractEntrypointWorker.ts';\nexport type { WorkerExecutionContext, WorkerScheduledController } from './base/AbstractEntrypointWorker.ts';\nexport { AbstractDurableObjectWorker } from './base/AbstractDurableObjectWorker.ts';\nexport { AbstractQueueWorker } from './base/AbstractQueueWorker.ts';\nexport { AbstractWorkflowWorker } from './base/AbstractWorkflowWorker.ts';\nexport { BASE_WORKER_MESSAGES } from './base/baseWorkerError.ts';\nexport type { BaseWorkerOperation } from './base/baseWorkerError.ts';\nexport { createLogger, isLogLevel, resolveLogLevel } from './logger.ts';\nexport type { LogLevel, Logger } from './logger.ts';\nexport { KvCache, KV_DOMAINS, buildKvKey, clampTtl, digest128 } from './kv/index.ts';\nexport type { KvDomainDef, KvDomainName, KvNamespaceLike } from './kv/index.ts';\nexport { AbstractScheduledTask, TaskRegistry } from './scheduled/index.ts';\nexport type { ApplicationRunHandle, ScheduledTaskEnv, TaskLogger, TaskRunRecorder, TaskRunSummary } from './scheduled/index.ts';\n"],
|
|
5
|
+
"mappings": "AAMA,OAAS,aAAAA,MAAiB,oBAE1B,OAAS,mBAAAC,EAAiB,mBAAAC,EAAiB,mBAAAC,MAAuB,uBAElE,OAAS,oBAAAC,MAAwB,+BACjC,OAAS,aAAAC,MAAiB,wBAC1B,OAAS,oBAAAC,MAAwB,oCACjC,OAAS,4BAAAC,MAAgC,qCAEzC,OAAS,+BAAAC,MAAmC,wCAC5C,OAAS,uBAAAC,MAA2B,gCACpC,OAAS,0BAAAC,MAA8B,mCACvC,OAAS,wBAAAC,MAA4B,4BAErC,OAAS,gBAAAC,EAAc,cAAAC,EAAY,mBAAAC,MAAuB,cAE1D,OAAS,WAAAC,EAAS,cAAAC,EAAY,cAAAC,EAAY,YAAAC,EAAU,aAAAC,MAAiB,gBAErE,OAAS,yBAAAC,EAAuB,gBAAAC,MAAoB",
|
|
6
|
+
"names": ["Container", "asScopedContext", "getRequestScope", "setRequestScope", "AppConfiguration", "EnvParser", "DEFAULT_SITE_URL", "AbstractEntrypointWorker", "AbstractDurableObjectWorker", "AbstractQueueWorker", "AbstractWorkflowWorker", "BASE_WORKER_MESSAGES", "createLogger", "isLogLevel", "resolveLogLevel", "KvCache", "KV_DOMAINS", "buildKvKey", "clampTtl", "digest128", "AbstractScheduledTask", "TaskRegistry"]
|
|
7
7
|
}
|