@altostra/core
Version:
Core library for shared types and logic
34 lines (33 loc) • 1.47 kB
TypeScript
import type { EmailAddress } from "../../CustomTypes/EmailAddress";
import type { FullName } from "../../CustomTypes/FullName";
import type { ISODate } from "../../CustomTypes/ISODate";
import type { NonEmptyString } from "../../CustomTypes/NonEmptyString";
import type { Maybe } from "../../Maybe";
import type { OrganizationId } from "../Organization";
import type { AltostraAccountId } from "./AltostraAccountId";
import type { AltostraRoleId } from "./AltostraRoleId";
/**
* Organization id cannot be used as index, therefore, we are using string instead
*/
export declare type RawOrganizationId = string;
export interface UserAccount {
userId: AltostraAccountId;
email: EmailAddress;
name: FullName;
image: Maybe<NonEmptyString>;
lastLogin: ISODate;
authProvider: NonEmptyString;
role: UserRole;
organizationId: OrganizationId;
membership: Record<RawOrganizationId, UserRole>;
}
export declare type OwnerRoleName = 'Owner';
export declare type AdminRoleName = 'Admin';
export declare type UserRoleName = AdminRoleName | OwnerRoleName;
export declare const isUserRoleName: import("@altostra/type-validations").TypeValidation<string>;
export interface UserRole {
roleId: AltostraRoleId;
name: UserRoleName;
}
export declare const isUserRole: import("@altostra/type-validations").ObjectOfTypeValidation<UserRole>;
export declare const isUserAccount: import("@altostra/type-validations").ObjectOfTypeValidation<UserAccount>;