Skip to content

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.

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" },
],
},
});
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 token
const pipeline = yield* Cloudflare.Pipeline("etl", {
sql: Output.interpolate`INSERT INTO ${sink.name} SELECT * FROM ${stream.name}`,
});