Options
All
  • Public
  • Public/Protected
  • All
Menu
     

Interface Space

A plain-object, describing a NameSpace (or simply, Space) that can be used to serve webpages, handle data-reqests, or authenitcate.

Hierarchy

  • Space

Index

Properties

Properties

Optional type

type: "auth" | "rest" | "page"

The type of Space this configuration represents.

Type Description
auth The Space will handle authentication.
rest The Space will handle data reqests.
page The Space will handle a page rendering.
null _Only allow for the readOnly, CFG.Spaces.Global.

config

config: object

The central configurations of the Space.

Type declaration

  • name: string

    An arbitrary name for the Space.

  • Optional scheme?: string

    The RegexP-string representation of the Space Path.

  • title: string

    An arbitrary title used in logging.

  • description: string

    The description of the Space.

  • Optional accessor?: boolean

    If true; treat this Space as an authenticator. (false; UNLESS YOU KNOW WHAT YOU ARE DOING!)

  • Optional restrict?: object

    If authentication is being used, this determines a Page to redirect to if the authenticator determines that User logged-in (true) or not (false).

    • Optional true?: string

      The path of a page that the App will redirect to if a user-session is valid.

      This can be exploited, for example, in a Space that repesents a login page. If the a user-session is already established, the user in question should not be able to navigate to this page. So one can set this property as something like "home", so that said user will be redirected to /home in the event that they attempt to navigate to /login.

    • Optional false?: string

      The path of a page that the App will redirect to if a user-session is invalid.

      This can be exploited, for example, in a Space that repesents a profile page. If the a user-session is has not been established, the user in question should not be able to navigate to this page. So one can set this property as something like "login", so that said user will be redirected to /login in the event that they attempt to navigate to /profile/1234.

  • Optional page?: Page

    A plain-object, describing a Page that this Space represents; if applicable.

  • errorIF: function
    • errorIF(payload: any): boolean
    • A callback one can use to check the payload of a Page for any potential errors. If said errors resolve to being true, this is passed to Space.config.restrict, which will redirect as specified.

      Parameters

      • payload: any

        The page payload-object; if applicable.

      Returns boolean

      A boolean that resolves to true if an error is detected.

Optional expose

expose: ["accessor", "rest", Array]

A list of auth/rest Spaces to expose to other instances of dffrnt.api. This can only be modified in the the Global Space.