The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import * as Cloudflare from "@alchemy.run/cloudflare"; |
| 2 | import * as Schema from "effect/Schema"; |
| 3 | |
| 4 | /** Record schema shared by the Pipelines stream fixtures and tests. */ |
| 5 | export class PageView extends Schema.Class<PageView>("PageView")({ |
| 6 | url: Schema.String, |
| 7 | at: Schema.Date, |
| 8 | tags: Schema.Array(Schema.String), |
| 9 | user: Schema.optional(Schema.Struct({ id: Schema.String })), |
| 10 | }) {} |
| 11 | |
| 12 | /** The field list `PageView` converts to — equivalent spelling. */ |
| 13 | export const pageViewFields: Cloudflare.Pipelines.StreamField[] = [ |
| 14 | { type: "string", name: "url", required: true }, |
| 15 | { type: "timestamp", name: "at", required: true }, |
| 16 | { type: "list", name: "tags", required: true, items: { type: "string" } }, |
| 17 | { |
| 18 | type: "struct", |
| 19 | name: "user", |
| 20 | required: false, |
| 21 | fields: [{ type: "string", name: "id", required: true }], |
| 22 | }, |
| 23 | ]; |
| 24 | |
| 25 | /** Typed, authenticated-HTTP stream used by the producer fixtures. */ |
| 26 | export const PageViews = Cloudflare.Basin.Stream("PageViews", { |
| 27 | schema: PageView, |
| 28 | http: true, |
| 29 | }); |