ls-deno/types.ts

40 lines
767 B
TypeScript
Raw Normal View History

2022-10-08 00:00:45 -05:00
export interface Identifiable {
2022-10-07 23:22:35 -05:00
id: string;
2022-10-08 00:00:45 -05:00
}
2022-10-08 02:01:48 -05:00
export interface Created {
2022-10-07 23:22:35 -05:00
createdAt: Date;
2022-10-08 00:00:45 -05:00
}
2022-10-08 02:01:48 -05:00
export interface Updated {
2022-10-08 00:00:45 -05:00
updatedAt: Date;
}
2022-10-08 02:01:48 -05:00
export type Timestamped = Created & Updated;
2022-10-08 00:00:45 -05:00
export interface Note extends Identifiable, Timestamped {
2022-10-07 23:22:35 -05:00
content: string;
}
2022-10-08 00:00:45 -05:00
2022-10-08 00:24:03 -05:00
export interface Team extends Identifiable, Timestamped {
displayName: string;
}
2022-10-08 00:00:45 -05:00
export interface User extends Identifiable, Timestamped {
username: string;
passwordDigest: string;
displayName?: string;
}
2022-10-08 02:01:48 -05:00
type IdentifierFor<T extends Identifiable> = T["id"];
export interface Token extends Created {
bytes?: Uint8Array;
digest: Uint8Array;
userId: IdentifierFor<User>;
data: Record<string, unknown> | null;
}
/** 32 bytes base64-encoded */
export type TokenDigest = string;