# GQLBase

#### new GQLBase()

All GraphQL Type objects used in this system are assumed to have extended
from this class. An instance of this class can be used to wrap an existing
structure if you have one.

Source:
  GQLBase.js, line 81

### Classes

⎆⠀constructor

### Members

#### (static, constant) ⬇︎⠀ADJACENT_FILE

Source:
  GQLBase.js, line 335
See:
  `GQLBase#SCHEMA`

#### (static, constant) ⬇︎⠀module

Returns the module object where your class is created. This needs to be
defined on your class, as a static getter, in the FILE where you are
defining your Class definition.

Source:
  GQLBase.js, line 409
See:
  https://nodejs.org/api/modules.html

### Methods

#### (static) ⌾⠀IDLFilePath(path, [extension='.graphql'])

Creates an appropriate Symbol crafted with the right data for use by
the IDLFileHandler class below.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`path` | string |  |  | a path to the IDL containing file
`[extension='.graphql']` | String | optional | '.graphql' | an extension, including the prefixed period, that will be added to the supplied path should it not already exist.

##### Returns:

Symbol

Source:
  GQLBase.js, line 352
See:
  `GQLBase#SCHEMA`

#### (static) ⬇︎⠀handler() → {IDLFileHandler}

A file handler for fetching the IDL schema string from the file system
for those `GQLBase` extended classes that have indicated to do so by
returning a `Symbol` for their `SCHEMA` property.

##### Returns:

`( IDLFileHandler )`

instance of IDLFileHandler, created if one does
not already exist, for fetching the contents from disk.

Source:
  GQLBase.js, line 374

#### (static) ⬇︎⠀MUTATORS(requestData) → {Promise}

This method should return a promise that resolves to an object of
functions matching the names of the mutation operations. These are to be
injected into the root object when used by `GQLExpressMiddleware`.

##### Parameters:

Name | Type | Description
--- | --- | ---
`requestData` | Object | typically an object containing three properties; {req, res, gql}

##### Returns:

`( Promise )`

a promise that resolves to an object; see above for more
information.

Deprecated:
  Place all resolvers in RESOLVERS()
Source:
  GQLBase.js, line 253

#### (static) ⬇︎⠀RESOLVERS(requestData) → {Promise}

This method should return a promise that resolves to an object of
functions matching the names of the query operations. These are to be
injected into the root object when used by `GQLExpressMiddleware`.

##### Parameters:

Name | Type | Description
--- | --- | ---
`requestData` | Object | typically an object containing three properties; {req, res, gql}

##### Returns:

`( Promise )`

a promise that resolves to an object; see above for more
information.

Source:
  GQLBase.js, line 293

#### (static) ⬇︎⠀SCHEMA() → {string|Symbol}

Defined in a base class, this getter should return either a String
detailing the full IDL schema of a GraphQL handler or one of two
types of Symbols.

The first Symbol type is the constant `ADJACENT_FILE`. If this Symbol is
returned, the system assumes that next to the source file in question is
a file of the same name with a .graphql extension. This file should be
made of the GraphQL IDL schema definitions for the object types being
created.

Example:

      static get SCHEMA(): String | Symbol {
        return GQLBase.ADJACENT_FILE
      }

The primary advantage of this approach is allowing an outside editor that
provides syntax highlighting rather than returning a string from the
SCHEMA getter.

Alternatively, the static method IDLFilePath can be used to point to an
alternate location where the GraphQL IDL file resides. The extension can
also be changed from .graphql to something else if need be using this
method.

Example:

      static get SCHEMA(): String | Symbol {
        return GQLBase.IDLFilePath('/path/to/file', '.idl')
      }

NOTE - Important!
When not returning a direct string based IDL schema, the call to super()
from a child class must include `module` as the second parameter or an
error will be thrown upon object creation.

##### Returns:

`( string | Symbol )`

a valid IDL string or one of the Symbols
described above.

Source:
  GQLBase.js, line 197
See:
  `GQLBase#ADJACENT_FILE`
  `GQLBase#IDLFilePath`

#### ⬆︎⠀model(value)

Setter for the internally stored model data. The contents of this
object are abstracted away behind a `Symbol` key to prevent collision
between the underlying model and any GraphQL Object Definition properties.

##### Parameters:

Name | Type | Description
--- | --- | ---
`value` | Object | any object you wish to use as a data store

Source:
  GQLBase.js, line 149

#### ⬆︎⠀requestData(value)

A setter that assigns a value to the inner request data object. When
used with GQLExpressMiddleware, this is an object matching {req, res, gql}.

##### Parameters:

Name | Type | Description
--- | --- | ---
`value` | Object | an object, usually matching { req, res, gql }

Source:
  GQLBase.js, line 182

#### ⬇︎⠀model(value)

Getter for the internally stored model data. The contents of this
object are abstracted away behind a `Symbol` key to prevent collision
between the underlying model and any GraphQL Object Definition properties.

##### Parameters:

Name | Type | Description
--- | --- | ---
`value` | Object | any object you wish to use as a data store

Source:
  GQLBase.js, line 130

#### ⬇︎⠀requestData() → {Object}

A getter that retrieves the inner request data object. When used with
GQLExpressMiddleware, this is an object matching {req, res, gql}.

##### Returns:

`( Object )`

an object, usually matching { req, res, gql }

Source:
  GQLBase.js, line 165