PipelineStream
Source:
src/Cloudflare/Pipelines/Stream.ts
A Cloudflare Pipelines stream — the ingestion endpoint of the Pipelines product. Events are sent to a stream over HTTP (and/or from Workers via a binding), transformed by a SQL {@link Pipeline}, and written to a {@link PipelineSink}.
The stream’s schema and format are fixed at creation (changing them
triggers a replacement); the HTTP endpoint and Worker-binding toggles
are mutable in place.
Creating a Stream
Section titled “Creating a Stream”Unstructured stream with default settings
const stream = yield* Cloudflare.PipelineStream("events", {});Structured stream with a typed schema
const stream = yield* Cloudflare.PipelineStream("clicks", { schema: { fields: [ { type: "string", name: "url", required: true }, { type: "timestamp", name: "ts", unit: "millisecond" }, ], },});HTTP ingestion
Section titled “HTTP ingestion”const stream = yield* Cloudflare.PipelineStream("events", { http: { enabled: true, authentication: true, cors: { origins: ["https://app.example.com"] }, },});// POST events to stream.endpoint with an API tokenWiring into a Pipeline
Section titled “Wiring into a Pipeline”const pipeline = yield* Cloudflare.Pipeline("etl", { sql: Output.interpolate`INSERT INTO ${sink.name} SELECT * FROM ${stream.name}`,});