Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface ContextValue

Hierarchy

  • ContextValue

Index

Properties

e

e: NewExpression

Expressions and operations builder for .db(), used to create complex conditions, aggregators, and clauses. https://easybase.github.io/EasyQB/docs/operations.html

Methods

Frame

  • Frame(): Record<string, any>[]
  • Frame(index: number): Record<string, any>
  • DEPRECATED: Use .db instead - https://easybase.github.io/EasyQB/

    This function is how you access your current frame. This function does not get new data or push changes to Easybase. If you want to synchronize your frame and Easybase, call sync() then Frame().

    abstract

    Returns Record<string, any>[]

    Array of records corresponding to the current frame. Call sync() to push changes that you have made to this array.

  • DEPRECATED: Use .db instead - https://easybase.github.io/EasyQB/

    This function is how you access a single object your current frame. This function does not get new data or push changes to Easybase. If you want to synchronize your frame and Easybase, call sync() then Frame().

    abstract

    Parameters

    • index: number

    Returns Record<string, any>

    Single record corresponding to that object within the current frame. Call sync() to push changes that you have made to this object.

Query

  • Query(options: QueryOptions): Promise<Record<string, any>[]>
  • async

    View a query by name. This returns an isolated array that has no effect on your frame or frame configuration. sync() and Frame() have no relationship with a Query(). An edited Query cannot be synced with your database, use Frame() for realtime database array features.

    Parameters

    Returns Promise<Record<string, any>[]>

    Isolated array of records in the same form as Frame(). Editing this array has no effect and cannot be synced with your database. Use Frame() for realtime database features.

addRecord

  • Manually add a record to your collection regardless of your current frame. You must call sync() after this to see updated response.

    abstract
    async

    Parameters

    Returns Promise<StatusResponse>

    Promise

configureFrame

currentConfiguration

db

  • db(tableName?: string, userAssociatedRecordsOnly?: boolean): SQW

dbEventListener

  • dbEventListener(callback: (status?: DB_STATUS, queryType?: string, executeCount?: EXECUTE_COUNT, tableName?: null | string, returned?: any) => void): () => void
  • Subscribe to db events, invoked by calling .all or .one: https://easybase.github.io/EasyQB/

    Parameters

    • callback: (status?: DB_STATUS, queryType?: string, executeCount?: EXECUTE_COUNT, tableName?: null | string, returned?: any) => void
        • (status?: DB_STATUS, queryType?: string, executeCount?: EXECUTE_COUNT, tableName?: null | string, returned?: any): void
        • Parameters

          • Optional status: DB_STATUS
          • Optional queryType: string
          • Optional executeCount: EXECUTE_COUNT
          • Optional tableName: null | string
          • Optional returned: any

          Returns void

    Returns () => void

    Calling this function unsubscribes your callback function from events.

      • (): void
      • Returns void

deleteRecord

  • Manually delete a record from your collection regardless of your current frame. You must call sync() after this to see updated response.

    abstract
    async

    Parameters

    Returns Promise<StatusResponse>

    Promise

forgotPassword

  • async

    Trigger an email to the given username with a verification code to reset the user's password. This verification code is used in the forgotPasswordConfirm function, along with a new password. The username must be the user's email address.

    Parameters

    • username: string

      A username which must also be a valid email address

    • Optional emailTemplate: EmailTemplate

      Optional details for the formatting & content of the verification email

    Returns Promise<StatusResponse>

    A StatusResponse corresponding to the successful sending of a verification code email

forgotPasswordConfirm

  • forgotPasswordConfirm(code: string, username: string, newPassword: string): Promise<StatusResponse>
  • async

    Confirm the resetting of an unauthenticated users password. This function is invoked after forgotPassword is used to trigger an email containing a verification code to the given username [which must also be an email]. The user's randomly generated verification code from their email is passed in the first parameter.

    Parameters

    • code: string

      Verification code found in the email sent from the forgotPassword function

    • username: string

      The same username (email) used in the forgotPassword function

    • newPassword: string

      The new password for the corresponding verified user

    Returns Promise<StatusResponse>

    A StatusResponse corresponding to the successful setting of a new password

fullTableSize

  • fullTableSize(): Promise<number>
  • fullTableSize(tableName: string): Promise<number>
  • Gets the number of records in your table.

    async

    Returns Promise<number>

    The the number of records in your table.

  • Gets the number of records in your table.

    async

    Parameters

    • tableName: string

    Returns Promise<number>

    The the number of records in your table.

getUserAttributes

  • getUserAttributes(): Promise<Record<string, string>>
  • Retrieve the currently signed in users attribute object.

    async

    Returns Promise<Record<string, string>>

    Promise<Record<string, string>>

isUserSignedIn

  • isUserSignedIn(): boolean
  • Check if a user is currently signed in.

    Returns boolean

    Is a user signed in.

onSignIn

  • onSignIn(callback: () => void): void
  • Pass a callback function to run when a user signs in. This callback function will run after either successfully signing in with the signIn() function OR after a user is automatically signed in via valid tokens saved to the browser from a previous instance. This is best placed with useEffect(() => {}, []);

    Parameters

    • callback: () => void

      callback function to run on sign in event

        • (): void
        • Returns void

    Returns void

resetUserPassword

  • resetUserPassword(currentPassword: string, newPassword: string): Promise<StatusResponse>
  • Reset the currently signed-in user's password to a new string.

    async

    Parameters

    • currentPassword: string

      Signed-in user's current password

    • newPassword: string

      New password for user's account

    Returns Promise<StatusResponse>

    Promise

setUserAttribute

  • setUserAttribute(key: string, value: string): Promise<StatusResponse>
  • Set a single attribute of the currently signed in user. Can also be updated visually in the Easybase 'Users' tab.

    async
    abstract

    Parameters

    • key: string

      Object key. Can be a new key or existing key.

    • value: string

      attribute value.

    Returns Promise<StatusResponse>

    Promise

signIn

  • Sign in a user that already exists for a project. This will save authentication tokens to a user's browser so that they will be automatically authenticated when they return to the application. These authentication tokens will become invalid when a user signs out or after 24 hours.

    abstract
    async

    Parameters

    • userID: string

      unique identifier for new user. Usually an email or phone number.

    • password: string

      user password.

    Returns Promise<StatusResponse>

    Promise

signOut

  • signOut(): void
  • Sign out the current user and invalidate their cached tokens.

    Returns void

signUp

  • signUp(newUserID: string, password: string, userAttributes?: Record<string, string>): Promise<StatusResponse>
  • Create a new user for your project. You must still call signIn() after signing up.

    abstract
    async

    Parameters

    • newUserID: string

      unique identifier for new user. Usually an email or phone number.

    • password: string

      user password. Must be at least 8 characters long.

    • Optional userAttributes: Record<string, string>

      Optional object to store user attributes. Can also be edited visually in the Easybase 'Users' tab.

    Returns Promise<StatusResponse>

    Promise

sync

  • DEPRECATED: Use .db instead - https://easybase.github.io/EasyQB/

    Call this method to synchronize your current changes with your database. Deletions, additions, and changes will all be reflected by your backend after calling this method. Call Frame() after this to get a normalized array of the freshest data.

    abstract
    async

    Returns Promise<StatusResponse>

    Promise

tableTypes

  • tableTypes(): Promise<Record<string, any>>
  • tableTypes(tableName: string): Promise<Record<string, any>>
  • Retrieve an object detailing the columns in your table mapped to their corresponding type.

    async

    Returns Promise<Record<string, any>>

    Object detailing the columns in your table mapped to their corresponding type.

  • Retrieve an object detailing the columns in your table mapped to their corresponding type.

    async

    Parameters

    • tableName: string

    Returns Promise<Record<string, any>>

    Object detailing the columns in your table mapped to their corresponding type.

updateRecordFile

  • Upload a file to your backend and attach it to a specific record. columnName must reference a column of type 'file'. Call sync() for fresh data with proper attachment links to cloud hosting.

    abstract
    async

    Parameters

    Returns Promise<StatusResponse>

    Promise

updateRecordImage

  • Upload an image to your backend and attach it to a specific record. columnName must reference a column of type 'image'. The file must have an extension of an image. Call sync() for fresh data with proper attachment links to cloud hosting.

    abstract
    async

    Parameters

    Returns Promise<StatusResponse>

    Promise

updateRecordVideo

  • Upload a video to your backend and attach it to a specific record. columnName must reference a column of type 'video'. The file must have an extension of a video. Call sync() for fresh data with proper attachment links to cloud hosting.

    abstract
    async

    Parameters

    Returns Promise<StatusResponse>

    Promise

useFrameEffect

  • useFrameEffect(effect: EffectCallback): void
  • DEPRECATED: Use .db instead - https://easybase.github.io/EasyQB/

    This hook runs when the Frame changes. This can be triggered by calling sync().

    abstract

    Parameters

    • effect: EffectCallback

      Callback function that executes when Frame changes.

    Returns void

useReturn

  • useReturn(dbInstance: () => SQW, deps?: DependencyList): UseReturnValue
  • Custom stateful hook to an instance of db().return. Other local changes will automatically re-fetch the query as detailed in the passed-in db.

    ```jsx const { frame } = useReturn(db('MYTABLE').return().where(e.gt('rating', 15)).limit(10))

    const onButtonClick = (_key) => { db('MYTABLE').delete().where({ _key }).all(); }

    // Stays fresh after call to .delete() return (

    { frame.map(ele => <Card {...ele} />) }
    ) ```

    Parameters

    • dbInstance: () => SQW

      Function returning an instance of db().return without having called .all or .one

        • (): SQW
        • Returns SQW

    • Optional deps: DependencyList

      If present, instance will be reloaded if the values in the list change.

    Returns UseReturnValue

    Object with the required values to statefully access an array that is subscribed to local executions to the corresponding db instance.

userID

  • userID(): undefined | string
  • Retrieve the currently signed-in user's ID.

    Returns undefined | string

    The currently signed-in user's ID (username), otherwise undefined.

Generated using TypeDoc