Skip to content

Releases: rtorcato/cf-common

@rtorcato/cf-common@1.9.0

Choose a tag to compare

@github-actions github-actions released this 30 Oct 22:43
8c9e583

Minor Changes

  • 0fb24e1: Add the @rtorcato/cf-common/access module with verifyAccessJwt, which checks the Cloudflare Access JWT against the team JWKS (signature, issuer, audience, expiry) and returns the typed identity, and accessJwt, which reads the Cf-Access-Jwt-Assertion header. A bad token throws a 401 with code ACCESS_JWT_INVALID.
  • 99bb1db: Add the @rtorcato/cf-common/ai-gateway module: createAiGateway sends provider calls through an AI Gateway endpoint (fetch returns the response, json posts and parses JSON), gatewayUrl builds the endpoint URL, and gatewayHeaders turns typed cache, metadata, logging and retry options into cf-aig-* headers. Failures throw a non-exposed 502 with code AI_GATEWAY_FAILED; a bad id, provider or path segment throws a non-exposed 500 AI_GATEWAY_INVALID.
  • 6467fca: Add the analytics subpath: writeDataPoint(dataset, point) writes to an Analytics Engine dataset and maps a rejected point to a non-exposed 500 CloudflareError with code ANALYTICS_WRITE_FAILED, and createDataset(dataset, schema) names the blob, double and index columns so you write by name and get the SQL API column for each.
  • 0f9c81e: Add the @rtorcato/cf-common/browser module over the Browser Rendering binding: withBrowser launches a browser, runs your callback and always closes it, and screenshot and pdf render a URL or HTML string in one call. @cloudflare/puppeteer is an optional peer dependency, needed only if you import this subpath. A failed launch or render throws a non-exposed 502 (BROWSER_LAUNCH_FAILED / BROWSER_RENDER_FAILED); a non-http(s) URL throws an exposed 400 BROWSER_INVALID_URL.
  • 85ea871: Add @rtorcato/cf-common/do: BaseDurableObject extends the runtime's DurableObject and adds a typed this.storage, and typedStorage wraps any DurableObjectStorage so get (with an optional fallback), put and delete are checked against a key → value schema.
  • b0264ba: Add the email subpath: sendEmail(binding, message) sends over a send_email binding, from fields or a raw-MIME EmailMessage, and maps a failed send to a non-exposed 502 CloudflareError with code EMAIL_SEND_FAILED.
  • 79ab9f4: Add the @rtorcato/cf-common/hyperdrive module with withHyperdrive, which opens a per-request client over a Hyperdrive binding and always closes it. The driver is yours to pass in through connect and close, so no driver is bundled. A failed connect throws a non-exposed 502 with code HYPERDRIVE_CONNECT_FAILED.
  • e28b067: Add the @rtorcato/cf-common/images module for Cloudflare Images: createImagesApi uploads a file or URL and reserves direct creator upload URLs, imageUrl and transformUrl build named-variant, flexible-variant and /cdn-cgi/image/ URLs from typed options, and signImageUrl signs a delivery URL with exp and an HMAC sig. API failures throw a non-exposed 502 with code IMAGES_API_ERROR; a bad id throws an exposed 400 IMAGES_INVALID_ID.
  • 18af2fe: Add the pipelines subpath: createPipelineProducer<T>(pipeline) wraps a Pipeline binding so send(record) and sendBatch(records, { chunkSize? }) take typed records (batches go out in order in chunks of 100 by default), and a rejected send becomes a non-exposed 502 CloudflareError with code PIPELINE_SEND_FAILED.
  • c57e688: Add the @rtorcato/cf-common/api module with createCloudflareApi, a small client for Cloudflare's v4 REST API. It covers zones, DNS records and cache purge, and its raw request/requestPage reach any other endpoint. It adds no dependencies, and any failure throws a non-exposed 502 with code CF_API_ERROR.
  • a8f4181: Add the @rtorcato/cf-common/rpc module with getService, a typed accessor for Service Bindings to a WorkerEntrypoint, and callService, which maps a failed RPC call to a non-exposed 502 with code RPC_CALL_FAILED.
  • 4de9fe5: Add the @rtorcato/cf-common/secrets module with getSecret, typed access to a Secrets Store binding by name: a missing binding is a non-exposed 500, and a failed read becomes a non-exposed 500 with code SECRET_GET_FAILED.
  • bed7bc4: Add the @rtorcato/cf-common/assets module over the Static Assets binding: serveAssets serves a request with an optional SPA fallback (for page navigations) and 404 page, and fetchAsset fetches the asset at another path with the request's headers.
  • e5ff16a: Add the @rtorcato/cf-common/vectorize module with createVectorStore<M>, a typed store over one Vectorize index. It adds caller-typed metadata, upsert split into chunks of 1000 with one mutationId per chunk, and failures mapped to a non-exposed 502 with code VECTORIZE_FAILED.
  • 6b9a389: Add the @rtorcato/cf-common/workflows module with createWorkflow, a typed client over a Workflow binding: create takes typed params, status returns a typed output, and any failure becomes a non-exposed 502 with code WORKFLOW_FAILED.
  • 071a62b: Add the @rtorcato/cf-common/ws module for Hibernatable WebSockets on a Durable Object: acceptWebSocket upgrades with ctx.acceptWebSocket (an exposed 426 WS_UPGRADE_REQUIRED without an Upgrade: websocket header), getAttachment/setAttachment type the per-socket state, parseMessage validates a JSON message (an exposed 400 WS_INVALID_MESSAGE on failure), and sendMessage/broadcast send JSON to one socket or to every socket, optionally by tag.

@rtorcato/cf-common@1.8.0

Choose a tag to compare

@github-actions github-actions released this 29 Oct 16:01
54e19b8

Minor Changes

  • 597d6b9: Add @rtorcato/cf-common/r2-presign: presignR2Url signs presigned GET/PUT URLs for an R2 object over the S3-compatible API with an R2 API token (AWS SigV4 via Web Crypto, no dependency).
  • dc5f548: Add @rtorcato/cf-common/queues: createProducer wraps a Queue binding (typed send, sendBatch split into chunks of 100, failures as QUEUE_SEND_FAILED), and defineQueue builds a queue handler that acks or retries each message individually, with an optional retryDelay backoff.
  • 5feadcd: Add the @rtorcato/cf-common/ai module with runAi, a typed wrapper over the Workers AI binding's run(). The input and output types follow the model name, and a failed call throws a non-exposed 502 with code AI_RUN_FAILED.

Patch Changes

  • 51791ef: Add the cache, ratelimit and ai modules to the bundled AGENTS.md (the subpath list and module map left them out).

v1.7.0

Choose a tag to compare

@github-actions github-actions released this 08 Oct 21:44
47c52f6

1.7.0 (2026-10-08)

Features

  • ratelimit: add Rate Limiting binding wrapper (#186) (47c52f6), closes #25

v1.6.0

Choose a tag to compare

@github-actions github-actions released this 08 Oct 20:28
b2cc1ee

1.6.0 (2026-10-08)

Features

v1.5.2

Choose a tag to compare

@rtorcato rtorcato released this 01 Oct 15:15
9e3e8d6

1.5.2 (2026-10-01)

Bug Fixes

  • add repository, license, and homepage metadata (#144) (eb15d6a)
  • deps: rename @rtorcato/js-tooling to @rtorcato/repo-tooling (#121) (4a62ac0)

v1.5.1

Choose a tag to compare

@rtorcato rtorcato released this 23 Jul 18:57

1.5.1 (2026-07-23)

Bug Fixes

  • release: upgrade npm for OIDC trusted publishing (#108) (9e3080f)

v1.5.0

Choose a tag to compare

@rtorcato rtorcato released this 17 Jul 14:38

1.5.0 (2026-07-17)

Bug Fixes

  • errors: detect CloudflareError across bundle boundaries (#101) (315a6ce), closes #67

Features

  • request: typed request.cf + JSON body/auth parsing (#99) (eab049b), closes #34

v1.4.0

Choose a tag to compare

@rtorcato rtorcato released this 08 Jul 13:48

1.4.0 (2026-07-08)

Features

v1.3.0

Choose a tag to compare

@rtorcato rtorcato released this 07 Jul 15:04

1.3.0 (2026-07-07)

Features

  • example: add runnable sample Worker + docs (#74) (beac102)

v1.2.0

Choose a tag to compare

@rtorcato rtorcato released this 06 Jul 20:33

1.2.0 (2026-07-06)

Features

  • docs: auto-generated API reference + release-triggered deploy (#44) (742fcf0)