vibez-core
Version:
Utilities, types and common dependencies.
64 lines (63 loc) • 2.19 kB
TypeScript
import { IndexableCollection, Indexable, Describable } from "../common";
import { Auditable } from "../auditory";
export declare const VERSION_FORMAT: RegExp;
export declare const DEFAULT_EXPIRATION_SECONDS = 172800;
export declare const DEFAULT_MODULE = "*";
export declare const MIN_PASSWORD_LENGTH = 6;
export declare type CredentialProvider = "Local" | "Facebook";
export declare type Collections = "Identities" | "Roles" | "Components" | "Users";
export interface SecurityCollection<T extends Collections> extends IndexableCollection<T> {
}
export interface Credential extends Indexable {
issuer: CredentialProvider;
token?: string;
password?: string;
expiration: number;
issuedOn: Date;
validatedOn: Date;
}
export declare type UserKind = "END_USER" | "CORPORATE" | "COMPONENT";
export interface User<T extends UserKind> extends Auditable, SecurityCollection<"Users"> {
readonly kind: T;
readonly identity: IndexableCollection<"Identities">;
role: IndexableCollection<"Roles">;
credentials?: Array<Credential>;
validatedOn?: Date;
resetRequest?: {
id: string;
ipAddress: string;
date: Date;
};
}
export interface Role extends Auditable, Describable, SecurityCollection<"Roles"> {
profile?: Profile;
}
export interface Authorization {
canRead: boolean;
canWrite: boolean;
canDelete: boolean;
}
export declare type ComponentKind = "SERVICE" | "PRODUCT" | "RESOURCE";
export interface Component<T extends ComponentKind> extends Auditable, Describable, SecurityCollection<"Components"> {
kind: T;
parent?: IndexableCollection<"Components">;
children?: Array<IndexableCollection<"Components">>;
enabled: boolean;
version: {
major: number;
minor: number;
patch: number;
};
}
export interface Permit {
component: IndexableCollection<"Components">;
authorization: Authorization;
issuedOn: Date;
validity: number;
}
export interface Profile extends Auditable, Describable {
permits: Array<Permit>;
}
export interface Identity extends Auditable, SecurityCollection<"Identities"> {
contact: IndexableCollection<"Contacts">;
}