0.1.4Updated 6 months ago
declare namespace Entity {
  interface Entity<EntityName extends string> {
    /**
     * Formats a key based on the formatting rules of the supply.
     * 
     * @param {string} key - The unique value referring to a user. Usually their `msisdn`
     */
    format_key(key: string): string

    /**
     * Validates a key based on the validation rules of the supply.
     * 
     * @param {string} key - The unique value referring to a user. Usually their `msisdn`
     */
    validate_key(key: string): KeyValidation

    /**
     * Used to set up the supply at the start of the application.
     * 
     * - Creates databases and indexes
     * - Creates SQL helper functions
     */
    Setup(): Promise<Entity.Entity<EntityName>>
  }
}