Members
CHECK_API_DOCS
Peeks into the metadata storage area of a given GQLBase extended
class and fetches the factory checklist if one exists.
- Source:
CHECK_RESOLVERS :Symbol
The CHECK_API_DOCS Symbol is part of the CHECKLIST for a constructed
GQLBase extended class. It denotes that the class has had its api docs
defined, processed and setup on the class in a way that it will be
picked up in the build lifecycle.
- Source:
Type:
-
Symbol
CHECK_SCHEMA :Symbol
The CHECK_RESOLVERS Symbol is part of the CHECKLIST for a constructed
GQLBase extended class. It denotes that the class has had its instance
field resolvers as well as its static Query, Mutation and Subscription
resolvers injected and defined.
- Source:
Type:
-
Symbol
CHECKLIST :Symbol
The CHECK_SCHEMA Symbol is part of the CHECKLIST for a constructed
GQLBase extended class. It denotes that the class has had its SCHEMA
getter defined.
- Source:
Type:
-
Symbol
(constant) CHECKLIST :Symbol
The CHECKLIST Symbol is used as a storage key in the metadata staging
area for each of the GQLBase extended classes. In the LatticeFactory
it is used to determine where in the flow of construction the class
currently is.
- Source:
Type:
-
Symbol
isFactoryClass
var { LatticeFactory, getChecklist, hasChecklist, CHECKLIST, CHECK_SCHEMA, CHECK_RESOLVERS } = require('./dist/LatticeFactory'); var { GQLBase, META_KEY, joinLines, SyntaxTree, typeOf } = require('./dist/lattice'); var gql = joinLines, LF = LatticeFactory, TYPE = LF.TYPE;
var PersonDef = { name: 'Person', schema: gqlenum StatType { PHYSICAL, MENTAL } type Person { name: String stats(type:StatType): Stat } type Query { findPerson(id: ID): Person }
, resolvers: { Query: { findPerson({req, res, next}, {id}) { console.log('find person') } }, Person: { stats({type}) { let { req, res, next} = this.requestData } } }, docs: { StatType: { [TYPE]: A type of statistic associated with people
, PHYSICAL: Physical attributes
, MENTAL: Mental attributes
}, Person: { [TYPE]: Represents a person
, personId: Unique id of the person in question
, name: The name of the person
, stats: Allows you to query the stats of a person based on type
}, Query: { [TYPE]: 'Top level query desc.', findPerson: Searches the system for the specified user
} } };
var Person = LF.build(PersonDef), p = new Person({name: 'Brielle'})
Person.getProp('stats',true,{requestData:{req:1,res:2,next:3}})
var Broke = LF.build({name: 'Broke', schema: gqltype Broke {name: String}
, resolvers:{}, docs:{}})
var t = LF.validateTemplate({name: '', type: GQLBase, resolvers: {}, docs: {}, schema: ''});
- Source:
types :Array.<String>
A getter that retrieves the array of direct types
- Source:
Type:
-
Array.<String>
Methods
applyTags(Class, addTags, fieldName, descriptor)
When applying multiple property getters and setters, knowing some info
about what was applied elsewhere can be important. "Tags" can be applied
that store the fieldName and descriptor applied via one of these decorators.
Multiple "tags" are supported to allow for detecting the difference between
decorators applied by the developer using lattice and something auto
generated such as auto-props.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
Class |
GQLBase
|
an instance of GQLBase to apply the tags tp |
addTags |
Array.<(string|Symbol)>
|
an array of Symbols or strings to be |
fieldName |
string
|
the name of the field being decorated |
descriptor |
Object
|
the JavaScript descriptor object to associate |
hasChecklist(Class, …items) → {Boolean}
This function, when invoked with only a class will return true if the
Class has a defined checklist. If one ore more CHECKLIST symbols are
passed, the function will only return true if all the supplied symbols
are set to truthy values.
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
Class |
function
|
a reference to the GQLBase class to set |
|
items |
Array.<Symbol>
|
<repeatable> |
any of CHECK_SCHEMA, CHECK_RESOLVERS, or |
Returns:
- Type:
-
Boolean
true if the checklist and/or all items are true and
present.
newChecklist(Class)
Injects and creates a new CHECKLIST object on the supplied GQLBase
extended class. All items are installed and set to false.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
Class |
function
|
a reference to the GQLBase class to set |
setChecklist(Class, item, value)
Obtains the checklist from the supplied GQLBase extended class. If the
class has a checklist, its checklist item is set to true or the boolean
value specified.
- Source:
Parameters:
Name | Type | Default | Description |
---|---|---|---|
Class |
function
|
a reference to the GQLBase class to set |
|
item |
Symbol
|
one of CHECK_SCHEMA, CHECK_RESOLVERS, or |
|
value |
Boolean
|
true |
the value for the checklist item to set |