The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import * as Axiom from "@alchemy.run/axiom"; |
| 2 | import * as Alchemy from "alchemy"; |
| 3 | import * as Output from "alchemy/Output"; |
| 4 | import { Effect } from "effect"; |
| 5 | import { Logs, Metrics, Traces } from "./Datasets.ts"; |
| 6 | |
| 7 | export const IngestToken = Axiom.ApiToken( |
| 8 | "IngestToken", |
| 9 | Effect.all([Alchemy.Stack, Traces, Logs, Metrics]).pipe( |
| 10 | Effect.map(([stack, traces, logs, metrics]) => ({ |
| 11 | name: `${stack.stage}-otel-ingest`, |
| 12 | description: `Ingest-only token for ${stack.stage} OTEL datasets`, |
| 13 | // Reference dataset Outputs (rather than literal strings) so Alchemy |
| 14 | // sequences the token after the datasets exist. |
| 15 | datasetCapabilities: Output.all(traces.name, logs.name, metrics.name).pipe( |
| 16 | Output.map(([t, l, m]) => ({ |
| 17 | [t]: { ingest: ["create"] }, |
| 18 | [l]: { ingest: ["create"] }, |
| 19 | [m]: { ingest: ["create"] }, |
| 20 | })), |
| 21 | ), |
| 22 | })), |
| 23 | ), |
| 24 | ); |