0.1.3Updated 10 days ago
declare namespace Draco {
  export interface Options {
    /** The URI where Draco API calls should be sent
     * 
     * *Example:* https://draco.galaxi.online
     * 
     * **AUTO** If not set here, will attempt to read either `DRACO_HOST` or `DRACO_URL` from the environment
     * 
     */
    host?: string

    /** The API key for this applet. Can be found on the Draco dashboard for the applet.
     * 
     * **AUTO** If not set here, will attempt to read `DRACO_API_KEY` from the environment
     */
    api_key?: string

    /** 
     * A [string enum](https://www.typescriptlang.org/docs/handbook/enums.html#string-enums) works the best for this.
     * 
     * *Example:*
     * 
     * Create a `permissions.enum.ts` file somewhere you prefer. That way, you can execute `user.can(Permissions.VIEW_USERS)` to easily and cleanly check permissions.
     * ```ts
     * export enum Permissions {
     *   VIEW_USERS = "view_users",
     *   // etc
     * }
     * ```
     * 
     * Then pass it to this function:
     * ```ts
     * await Draco.Configure({ permissions: Permissions });
     * ```
     */
    permissions: Record<string, string>

    /**
     * The name that will be used to send and read cookies for user sessions
     * 
     * **AUTO** If not set here, will attempt to read `DRACO_COOKIE` from the environment
     * 
     * *Default:* "draco_uuid"
     */
    cookie_name?: string
  }
}