- Source:
Members
(static, constant) DirectTypeManager :Object
A small suite of functions a getter that allows easy manipulation of the
the DIRECT_TYPES workaround needed for some types of complex class
wrapping allowed by the @Getters and @Properties decorators. Namely the
ability to do something like @Getters('name', String) which would wrap the
contents of whatever is in the objects model in a String call.
Direct types are those that need to be called without new
in order for the
desired behavior to present itself.
- Since:
- 2.7.0
- Source:
Type:
-
Object
Methods
(static) ⌾⠀extractBits(property) → {Object}
For each of the decorators, Getters, Setters, and Properties, we take a
list of property names used to create the appropriate accessor types. In
some cases, however, the instance of GQLBase's data model may have a
different name. Finally if the return type for the getter should be wrapped
in a another GQLBase class type, we will need a way to specify those things
too.
The extractBits()
takes a single argument value from the decorator as it
parses them and converts it into an object, properly sorted, into values that
allow the above described behavior.
Examples:
```
// Create a class with a name and age property that map directly to the
// underlying data model
- Since:
- 2.5
- Source:
Parameters:
Name | Type | Description |
---|---|---|
property |
String
|
Array.<(String|function())>
|
name of a property, or list |
Returns:
- Type:
-
Object
an object with the following format {
fieldName: name of root instance property to create
modelName: name of its associated internal model property
typeClass: an optional class to wrap around the results in a getter
}
(static) .🏷⠀AdjacentSchema(object, property, descriptor)
A decorator that does three things. First it defines the
module() static method that is required when using adjacent
schema files. Secondly, it defines a SCHEMA getter that
returns GQLBase.ADJACENT_FILE
. Finally it sets a static
getter with the Symbol
, @adjacentSchema
so that other
can determine whether or not the decorator was used.
- Since:
- 2.1.0
- Source:
Parameters:
Name | Type | Description |
---|---|---|
object |
mixed
|
the object on which to apply the decorator |
property |
String
|
the name of the object or property to |
descriptor |
Object
|
a standard Object.defineProperty style |
(static) .🏷⠀FileSchema(path, extension) → {mixed}
A decorator that does three things. First it defines the
module() static method that is required when using adjacent
schema files. Secondly, it defines a SCHEMA getter that
returns GQLBase.ADJACENT_FILE
. Finally it sets a static
getter with the Symbol
, @adjacentSchema
so that other
can determine whether or not the decorator was used.
- Since:
- 2.3.0
- Source:
Parameters:
Name | Type | Description |
---|---|---|
path |
String
|
a relative or absolute path to the file containing |
extension |
String
|
the extension of the graphql schema file pointed |
Returns:
- Type:
-
mixed
as per all class decorators, FileSchema
returns the
class object being modified
(static) .🏷⠀Getters(propertyNames) → {function}
When working with GQLBase
instances that expose properties
that have a 1:1 mapping to their own model property of the
same name, adding the getters manually can be annoying. This
takes an indeterminate amount of strings representing the
properties for which getters should be injected.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
propertyNames |
Array.<(String|Array.<String>)>
|
if the model has 'name' |
Returns:
- Type:
-
function
a class decorator method.s
(static) .🏷⠀Properties(propertyNames) → {function}
When working with GQLBase
instances that expose properties
that have a 1:1 mapping to their own model property of the
same name, adding the getters manually can be annoying. This
takes an indeterminate amount of strings representing the
properties for which getters should be injected.
This method creates both getters and setters
- Since:
- 2.1.0
- Source:
Parameters:
Name | Type | Description |
---|---|---|
propertyNames |
Array.<(String|Array.<String>)>
|
if the model has 'name' |
Returns:
- Type:
-
function
a class decorator method
(static) .🏷⠀Schema(schemaString)
This decorator allows you to specify the SCHEMA getter and associated
string as a parameter to the decorator itself. So, for example:
- Since:
- 2.2.0
- Source:
Parameters:
Name | Type | Description |
---|---|---|
schemaString |
string
|
a GraphQL IDL compliant string for defining a |
(static) .🏷⠀Setters(propertyNames) → {function}
When working with GQLBase
instances that expose properties
that have a 1:1 mapping to their own model property of the
same name, adding the setters manually can be annoying. This
takes an indeterminate amount of strings representing the
properties for which setters should be injected.
- Since:
- 2.1.0
- Source:
Parameters:
Name | Type | Description |
---|---|---|
propertyNames |
Array.<(String|Array.<String>)>
|
if the model has |
Returns:
- Type:
-
function
a class decorator method
(inner) decorate(metaProperty, target, key, descriptor)
Since the bulk functionality of @subscriptor, @mutator and
- Source:
Parameters:
Name | Type | Description |
---|---|---|
metaProperty |
string
|
the name of the meta sub key under which to |
target |
Object
|
function
|
either the Class itself, if defined |
key |
string
|
the property name of the function being decorated |
descriptor |
Object
|
a decorator descriptor; see |