Merge branch 'feat/schema-enums'

This commit is contained in:
2026-05-21 20:52:27 +00:00
3 changed files with 164 additions and 7 deletions

View File

@@ -1 +1,53 @@
export {};
import { Type, type Static, type TSchema } from "@alkdev/typebox";
/**
* Call lifecycle states.
*
* Transitions:
* - `pending → running`: Handler starts executing
* - `running → completed`: `call.responded` + `call.completed` received
* - `running → failed`: `call.error` received
* - `pending → aborted`: `call.aborted` received before handler started
* - `running → aborted`: `call.aborted` received during execution
*
* `completed`, `failed`, and `aborted` are terminal states.
*/
export const CallStatusEnum = Type.Union([
Type.Literal("pending"),
Type.Literal("running"),
Type.Literal("completed"),
Type.Literal("failed"),
Type.Literal("aborted"),
]);
export type CallStatus = Static<typeof CallStatusEnum>;
export const NodeStatusEnum = Type.Union([
Type.Literal("idle"),
Type.Literal("waiting"),
Type.Literal("ready"),
Type.Literal("running"),
Type.Literal("completed"),
Type.Literal("failed"),
Type.Literal("skipped"),
Type.Literal("aborted"),
]);
export type NodeStatus = Static<typeof NodeStatusEnum>;
export const OperationTypeEnum = Type.Union([
Type.Literal("query"),
Type.Literal("mutation"),
Type.Literal("subscription"),
]);
export type OperationType = Static<typeof OperationTypeEnum>;
export const EdgeTypeEnum = Type.Union([
Type.Literal("triggered"),
Type.Literal("depends_on"),
Type.Literal("typed"),
Type.Literal("sequential"),
Type.Literal("conditional"),
]);
export type EdgeType = Static<typeof EdgeTypeEnum>;
export const Nullable = <T extends TSchema>(schema: T) =>
Type.Union([schema, Type.Null()]);

View File

@@ -1 +1,11 @@
export {};
export {
CallStatusEnum,
type CallStatus,
NodeStatusEnum,
type NodeStatus,
OperationTypeEnum,
type OperationType,
EdgeTypeEnum,
type EdgeType,
Nullable,
} from "./enums.js";