Open History to see the last commit
1import { Schema } from "effect";
2
3export const TrimmedString = Schema.Trim;
4export const TrimmedNonEmptyString = TrimmedString.check(Schema.isNonEmpty());
5
6export const NonNegativeInt = Schema.Int.check(Schema.isGreaterThanOrEqualTo(0));
7export const PositiveInt = Schema.Int.check(Schema.isGreaterThanOrEqualTo(1));
8
9export const IsoDateTime = Schema.String;
10export type IsoDateTime = typeof IsoDateTime.Type;
11
12/**
13 * Construct a branded identifier. Enforces non-empty trimmed strings
14 */
15const makeEntityId = <Brand extends string>(brand: Brand) =>
16 TrimmedNonEmptyString.pipe(Schema.brand(brand));
17
18export const ThreadId = makeEntityId("ThreadId");
19export type ThreadId = typeof ThreadId.Type;
20export const ProjectId = makeEntityId("ProjectId");
21export type ProjectId = typeof ProjectId.Type;
22export const EnvironmentId = makeEntityId("EnvironmentId");
23export type EnvironmentId = typeof EnvironmentId.Type;
24export const CommandId = makeEntityId("CommandId");
25export type CommandId = typeof CommandId.Type;
26export const EventId = makeEntityId("EventId");
27export type EventId = typeof EventId.Type;
28export const MessageId = makeEntityId("MessageId");
29export type MessageId = typeof MessageId.Type;
30export const TurnId = makeEntityId("TurnId");
31export type TurnId = typeof TurnId.Type;
32export const AuthSessionId = makeEntityId("AuthSessionId");
33export type AuthSessionId = typeof AuthSessionId.Type;
34
35export const ProviderItemId = makeEntityId("ProviderItemId");
36export type ProviderItemId = typeof ProviderItemId.Type;
37export const RuntimeSessionId = makeEntityId("RuntimeSessionId");
38export type RuntimeSessionId = typeof RuntimeSessionId.Type;
39export const RuntimeItemId = makeEntityId("RuntimeItemId");
40export type RuntimeItemId = typeof RuntimeItemId.Type;
41export const RuntimeRequestId = makeEntityId("RuntimeRequestId");
42export type RuntimeRequestId = typeof RuntimeRequestId.Type;
43export const RuntimeTaskId = makeEntityId("RuntimeTaskId");
44export type RuntimeTaskId = typeof RuntimeTaskId.Type;
45export const ApprovalRequestId = makeEntityId("ApprovalRequestId");
46export type ApprovalRequestId = typeof ApprovalRequestId.Type;
47export const CheckpointRef = makeEntityId("CheckpointRef");
48export type CheckpointRef = typeof CheckpointRef.Type;