@heystack/otel 0.3.4 → 0.3.5
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 +1 -0
- package/dist/workers.d.ts +3 -3
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -157,6 +157,7 @@ As belt-and-suspenders the exporter also drops any span whose HTTP target points
|
|
|
157
157
|
|
|
158
158
|
## Migration / versioning
|
|
159
159
|
|
|
160
|
+
- **`0.3.5`** — **type-constraint fix (Workers).** A Worker whose `queue` consumer is typed with a concrete message body — `queue(batch: MessageBatch<MyJob>, …)`, the normal case — failed to compile against `instrument()` in 0.3.4 (`TS2345`: `MessageBatch<unknown>` not assignable to `MessageBatch<MyJob>`). The `WorkerHandler` constraint declared its entrypoints as arrow properties, whose parameters are checked **contravariantly** under `strictFunctionTypes`, so a narrowed handler wasn't assignable. 0.3.5 declares them with **method syntax** (bivariant parameters) and widens the batch to `MessageBatch<any>`, mirroring Cloudflare's own `ExportedHandler` — a typed-queue Worker now type-checks with a bare `instrument(handler, cfg)`. Runtime behaviour unchanged. Also adds a **consumer type-check gate** (`pnpm consumer-typecheck`, run in `check` and `prepublishOnly`) that compiles a fully-typed Worker against the built `dist` through the public `exports` map and asserts `satisfies ExportedHandler<Env>` — the regression that escaped in 0.3.3/0.3.4 now fails the build before publish.
|
|
160
161
|
- **`0.3.4`** — **type-inference fix (Workers).** Restores `instrument()`'s ability to infer the handler's concrete `Env` type. In 0.3.3 the signature was `instrument<E = unknown, H extends WorkerHandler<E>>`, so `E` defaulted to `unknown` and was never recovered from the handler — under `strictFunctionTypes` a Worker typed `fetch(req, env: Env, ctx)` then failed to compile (`TS2345: 'Env' is not assignable to 'unknown'`) unless the caller passed `instrument<Env>(...)` explicitly. 0.3.4 infers `E` from the handler argument (`instrument<H extends WorkerHandler<any>>(...): Instrumented<EnvOf<H>, H>`), so a bare `instrument(handler, cfg)` type-checks again. Runtime behaviour is unchanged; no `0.3.3` consumer needs the explicit type arg after upgrading.
|
|
161
162
|
- **`0.3.3`** — `/next` uses bare, exports-mapped dynamic imports so the OpenNext (Cloudflare Pages) build resolves the workers entry correctly (fixes a build break). Workers/Node paths unchanged.
|
|
162
163
|
- **`0.3.2`** — runtime-correctness fixes:
|
package/dist/workers.d.ts
CHANGED
|
@@ -197,9 +197,9 @@ export declare function __resetWarnings(): void;
|
|
|
197
197
|
* a Worker never drops a handler Cloudflare requires for deploy.
|
|
198
198
|
*/
|
|
199
199
|
interface WorkerHandler<E> {
|
|
200
|
-
fetch
|
|
201
|
-
queue
|
|
202
|
-
scheduled
|
|
200
|
+
fetch?(req: Request, env: E, ctx: ExecutionContext): Promise<Response> | Response;
|
|
201
|
+
queue?(batch: MessageBatch<any>, env: E, ctx: ExecutionContext): Promise<void> | void;
|
|
202
|
+
scheduled?(controller: ScheduledController, env: E, ctx: ExecutionContext): Promise<void> | void;
|
|
203
203
|
[key: string]: unknown;
|
|
204
204
|
}
|
|
205
205
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@heystack/otel",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.5",
|
|
4
4
|
"description": "Runtime-aware OpenTelemetry tracing that exports to Heystack (Node, Next.js, Workers).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -19,8 +19,9 @@
|
|
|
19
19
|
"test": "vitest run",
|
|
20
20
|
"typecheck": "tsc --noEmit",
|
|
21
21
|
"validate": "node scripts/validate-entries.mjs",
|
|
22
|
-
"
|
|
23
|
-
"
|
|
22
|
+
"consumer-typecheck": "node scripts/consumer-typecheck.mjs",
|
|
23
|
+
"check": "pnpm typecheck && pnpm build && pnpm validate && pnpm consumer-typecheck && pnpm test",
|
|
24
|
+
"prepublishOnly": "pnpm build && pnpm validate && pnpm consumer-typecheck"
|
|
24
25
|
},
|
|
25
26
|
"dependencies": {
|
|
26
27
|
"@opentelemetry/api": "^1.9.0",
|