File size: 1,604 Bytes
a1ab21c 879c715 a1ab21c 879c715 a1ab21c 879c715 a1ab21c 879c715 a1ab21c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | import { z } from "zod";
import type { LabelAssignment } from "./enrichment.js";
import type { PooledTweet } from "./tweet.js";
/** Stable read scopes granted to a machine consumer. */
export const serviceAccountScopeSchema = z.enum(["units:read", "taxonomy:read"]);
export type ServiceAccountScope = z.infer<typeof serviceAccountScopeSchema>;
/**
* One enriched conversation-author unit returned by `GET /api/units`.
* `preset_labels` and `free_labels` are evidence-bearing assignments; only
* approved free labels appear here.
*/
export type EnrichedUnit = {
id: string;
posts: readonly PooledTweet[];
contributors: readonly string[];
preset_labels: readonly LabelAssignment[];
free_labels: readonly LabelAssignment[];
};
/** A revision-consistent page of enriched units. */
export type UnitPage = {
revision: string;
cutoff?: string;
units: readonly EnrichedUnit[];
next_cursor?: string;
};
export type ServiceAccountKeySummary = {
id: string;
created_at: string;
expires_at?: string;
};
export type ServiceAccountSummary = {
id: string;
name: string;
scopes: readonly ServiceAccountScope[];
status: "active" | "revoked";
created_at: string;
updated_at: string;
keys: readonly ServiceAccountKeySummary[];
};
export type ServiceAccountsSnapshot = {
version: 1;
accounts: readonly ServiceAccountSummary[];
source: "dataset" | "empty";
config_error?: string;
};
/** One-time credential result. The raw token is never persisted by xtap-pool. */
export type IssuedServiceAccountCredential = {
account: ServiceAccountSummary;
token: string;
};
|