Options
All
  • Public
  • Public/Protected
  • All
Menu
     

Class QueryGN<R>

A request-method configurator for RouteAU/DB requests-paths.

Type parameters

  • R: function | function

    The type of Method this Route-Query pertains to.

Hierarchy

Implements

Index

Constructors

constructor

  • Creates a new QueryGN method for a RouteAU/DB request.

    Parameters

    • __namedParameters: Method
      • Scheme: String
      • Merge: false | true | "GET" | "POST" | "PUT" | "DELETE" | "MIDDLEWARE"
      • Limits: String[]
      • Doc: Doc
      • Query: function | String[]
      • Proc: CLProcs
      • Params: CLParams
      • Parse: Parse
      • Key: String
      • Private: boolean

    Returns QueryGN<R>

Properties

Scheme

Scheme: String

A RegexP, string-representation of the Route Path.

Merge

Merge: boolean | TPRouteMerge<R>

A flag the specifies whether or not, and if so, how to prepend the path-parameters of the last parent-Endpoint referenced in Sub (along with the merge of its own parent; if applicable) to the path-name/parameters of this Endpoint:

  • If true, the Scheme from the parent-Endpoint will be prepended to this Scheme of this Endpoint.
  • If set as an HMETHOD, then the system will use the Scheme defined in the parent-Endpoint's CBRouteAU/CBRouteDB definition of the same HMETHOD. Otherwise, it choose the first Scheme found within each parent.
  • Defined in a method (see: Uses below), and set to true, then the system will look for that method deinition within the parent and choose that Scheme. Otherwise, the first Scheme found is chosen.

Example:

({
  User: {
    Actions: {
      Password: new RouteDB({
        Merge: true,
        Subs: ['settings','privacy'], // Child of "Settings"
        GET: () => ({ ... }), // Merge to "Privacy.GET"
        // ^ Resolves to "/user/:uid/settings/privacy/:prv_id/password"
      }),
      Email: new RouteDB({
        Merge: 'POST', // Merge to "Privacy.POST"
        Subs: ['settings','privacy'], // Child of "Settings"
        GET: () => ({ ... }),
        // ^ Resolves to "/user/:uid/settings/privacy/email"
      }),
      Privacy: new RouteDB({
        Scheme: '/:prv_id/', // Defult for any Method defined within
        Subs: ['settings'], // Child of "Settings".
        Merge: true,
        GET: () => ({ ... }),
        // ^ Merge to "Settings.GET",
        // ^ Resolves to "/user/:uid/settings/privacy/:prv_id"
        POST: () => ({ Scheme: '/' })
        // ^ Merge to "Settings.GET", Scheme redefined to "/"
        // ^ Resolves to "/user/:uid/settings/privacy"
      }),
      Settings: new RouteDB({
        Merge: true,
        GET: () => ({ ... }),
        // ^ Sub not defined, is child of "/"
        // ^ Resolves to "/user/:uid/settings"
      }),
      "/": new RouteDB({
        Scheme: '/:uid/',
        GET: () => ({ ... }),
        // ^ Resolves to "/user/:uid"
      }),
    }
  }
});

Uses:

Limits

Limits: String[]

A list of Limits to subscribe to.

Doc

Doc: Doc

The documentation for Methods in this Route.

Proc

Proc: CLProcs

The collection of handlers for an Auth.Method.

Query

Query: CBQYHandle | String[]

Either an Array of Strings that form a SQL query, or A callback that retrieves/updates backned data for an Data.Method.

Private

Private: boolean

true, if this Endpoint is restricted to Admins.

Accessors

Private Base

  • get Base(): string
  • set Base(val: string): void
  • The base path of the GNRoute.

    Returns string

  • The base path of the GNRoute.

    Parameters

    • val: string

    Returns void

Private Path

  • get Path(): string
  • set Path(val: string): void
  • The full path of the GNRoute.

    Returns string

  • The full path of the GNRoute.

    Parameters

    • val: string

    Returns void

Private PathTemplate

  • get PathTemplate(): string
  • A digestible scheme pattern.

    Returns string

Private PathMatcher

  • get PathMatcher(): RegExp
  • A RegExp pattern to match this scheme.

    Returns RegExp

Methods

Static Private GetParamScheme

  • GetParamScheme(path: string | RegExp): string
  • Creates a digestible scheme pattern given the path argument. This used internally within the Path setter.

    Parameters

    • path: string | RegExp

      The path pattern to convert.

    Returns string

    A scheme pattern.