t3-code-android-nightly/.repos/alchemy-effect/stacks/otel/IngestToken.ts
Julius Marminge e3c85ead63
chore(refs): sync Effect and Alchemy references to rc.115 and beta.78 (#12327)
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-09-17 23:21:25 -07:00

28 lines
934 B
TypeScript

import * as Alchemy from "alchemy";
import * as Axiom from "alchemy/Axiom";
import * as Output from "alchemy/Output";
import { Effect } from "effect";
import { Logs, Metrics, Traces } from "./Datasets.ts";
export const IngestToken = Axiom.ApiToken(
"IngestToken",
Effect.all([Alchemy.Stack, Traces, Logs, Metrics]).pipe(
Effect.map(([stack, traces, logs, metrics]) => ({
name: `${stack.stage}-otel-ingest`,
description: `Ingest-only token for ${stack.stage} OTEL datasets`,
// Reference dataset Outputs (rather than literal strings) so Alchemy
// sequences the token after the datasets exist.
datasetCapabilities: Output.all(
traces.name,
logs.name,
metrics.name,
).pipe(
Output.map(([t, l, m]) => ({
[t]: { ingest: ["create"] },
[l]: { ingest: ["create"] },
[m]: { ingest: ["create"] },
})),
),
})),
),
);