Files
dm-companion/src/lib/types.ts

41 lines
717 B
TypeScript

export type Id<T extends string> = string & { __type: T };
export type UserId = Id<"User">;
export type CampaignId = Id<"Campaign">;
export type DocumentId = Id<"Document">;
export type Campaign = {
id: CampaignId;
name: string;
owner: UserId;
};
export type Document = {
id: DocumentId;
campaign: Campaign;
data: {};
};
export type DocumentData<K extends string, V> = {
data: Record<K, V>;
};
export type Session = Document &
DocumentData<
"session",
{
strongStart: string;
}
>;
export type ISO8601Date = string & { __type: "iso8601date" };
export type Secret = Document &
DocumentData<
"secret",
{
text: string;
discoveredOn: ISO8601Date;
}
>;