@rexezuge/runtime 1.7.0 → 1.7.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.
@@ -15,8 +15,14 @@ import type { WorkflowEvent, WorkflowStep } from 'cloudflare:workers';
15
15
  * retryable under the platform rather than a bare coroutine call. Both are
16
16
  * restored here, and the structural types are gone with them — the platform
17
17
  * types are the ones that were correct all along.
18
+ *
19
+ * `TEnv` is last and defaulted rather than first: every consumer in the family
20
+ * writes `AbstractWorkflowWorker<TPayload, TResult>`, so leading with the env
21
+ * type would silently reinterpret their payload as the environment. The default
22
+ * is the ambient `Env`, which is what a handler wants unless it has narrowed its
23
+ * bindings deliberately.
18
24
  */
19
- declare abstract class AbstractWorkflowWorker<TEnv = Env, TPayload = unknown, TResult = unknown> extends WorkflowEntrypoint<TEnv, TPayload> {
25
+ declare abstract class AbstractWorkflowWorker<TPayload = unknown, TResult = unknown, TEnv = Env> extends WorkflowEntrypoint<TEnv, TPayload> {
20
26
  run(event: Readonly<WorkflowEvent<TPayload>>, step: WorkflowStep): Promise<TResult>;
21
27
  /**
22
28
  * The sink for an unhandled rejection at this base's boundary. See
@@ -1 +1 @@
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,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owWorker.ts"],
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",
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 *\n * `TEnv` is last and defaulted rather than first: every consumer in the family\n * writes `AbstractWorkflowWorker<TPayload, TResult>`, so leading with the env\n * type would silently reinterpret their payload as the environment. The default\n * is the ambient `Env`, which is what a handler wants unless it has narrowed its\n * bindings deliberately.\n */\nabstract class AbstractWorkflowWorker<TPayload = unknown, TResult = unknown, TEnv = Env> 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,uBAwBrC,MAAeC,UAAkFF,CAAkC,CA1BnI,MA0BmI,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
6
  "names": ["WorkflowEntrypoint", "BASE_WORKER_MESSAGES", "AbstractWorkflowWorker", "__name", "event", "step", "err", "message", "error"]
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rexezuge/runtime",
3
- "version": "1.7.0",
3
+ "version": "1.7.1",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "repository": {