Base class for all backends.

Hierarchy (view full)

Constructors

  • Parameters

    • source: string

      URL string describing the data location

    • o: any = {}

      Options

    Returns Backend

Properties

data: any
options: any
permissions: any
rawData: string
ref: any
source: string
_all: any[] = []
authProvider: string = "https://auth.madata.dev"

Auth Provider to use. This is only relevant for OAuthBackend, but specifying here as Backend is the only class users import.

capabilities: {} = {}

Type declaration

    defaultFormat: string = "JSON"
    hooks: Hooks = hooks

    Accessors

    • get authProviderServices(): Promise<any>
    • services.json from the auth provider will be cached here. You could also set this manually to avoid the network request.

      Returns Promise<any>

      Member

    • get host(): any
    • Return the hostname of the first URL pattern in the urls array, if not variable. This is used to facilitate relative URLs when constructing Backends directly. Subclasses with variable hostnames can override this.

      Returns any

    Methods

    • Parameters

      • backend: any

      Returns boolean

    • Low-level method to fetch data from the backend. Subclasses should override this method. Clients should not call this method directly, but use load() instead.

      Parameters

      • ref: any = ...

        reference to data to fetch, if different from that provided in the constructor

      Returns string

      • Data from the backend as a string, null if not found
    • Higher-level method for reading data from the backend. Subclasses should usually NOT override this method.

      Parameters

      • url: string

        URL to fetch, if different from that provided in the constructor

      • Rest ...args: any[]

      Returns any

      • Data from the backend as a JSON object, null if not found
    • Parameters

      • data: any
      • __namedParameters: {
            ref: any;
        } = {}
        • ref: any

      Returns Promise<any>

    • Parameters

      • ref: any = ...

      Returns Promise<any>

    • Higher-level method for writing data to the backend. Subclasses should usually NOT override this method.

      Parameters

      • data: any

        Data to write to the backend

      • Optional o: any = {}

        Options object

      Returns any

      • If successful, info about the stored data
    • Parameters

      • data: any
      • __namedParameters: {
            ref: any;
        } = {}
        • ref: any

      Returns Promise<any>

    • Update an existing backend instance with new parameters

      Parameters

      • source: string

        Same as constructor

      • o: any = {}

        Same as constructor

      Returns void

    • Return the appropriate backend(s) for this url

      Parameters

      • url: string

        URL describing the storage location

      • Optional o: {
            existing: Backend | Backend[];
        } = {}

        Options object to be passed to the backend

        • existing: Backend | Backend[]

          Existing backend object(s) to re-use if possible

      Returns any

    • Parameters

      • url: any
      • o: any

      Returns Promise<any>

    • Parameters

      • id: any
      • Rest ...args: any[]

      Returns string

    Generated using TypeDoc