Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/v1.0.0 beta #27

Merged
merged 12 commits into from
Jul 17, 2018
21 changes: 1 addition & 20 deletions connectors/local.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,5 @@
let comments = [
{
id: "0",
content: "Hello world",
author: "Louis Bertrand"
},
{
id: "1",
content: "Lymeo",
author: "Cortney Knorr"
},
{
id: "2",
content: "brhibhribir",
author: "vebiveivhei"
}
];

module.exports = async function() {

return {
comments

};
};
38 changes: 0 additions & 38 deletions dao/comments.js

This file was deleted.

72 changes: 0 additions & 72 deletions directives/auth.js

This file was deleted.

42 changes: 42 additions & 0 deletions directives/trigger.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/**
*
* the name of the file is the name of the directive
*
*/

let {
SchemaDirectiveVisitor
} = require("graphql-tools");
let {
defaultFieldResolver
} = require("graphql");

class TriggerDirective extends SchemaDirectiveVisitor {

visitFieldDefinition(field, {objectType}) {

let subName = this.args.name

const { resolve = defaultFieldResolver } = field;

field.resolve = async function(root, params, context) {

let resolverResult = await this::resolve(root, params, context);

if (subName && subName != '') {
const {pubsub} = context

pubsub.publish(subName, {
[subName]: resolverResult
});
}

return resolverResult;
};

}

}


module.exports = TriggerDirective;
7 changes: 4 additions & 3 deletions other/authentication.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
* @returns {async function} Asynchronous authentication middleware
*/
function authenticator(context) {
return async function authenticate(request, accept, reject) {
return accept();
};
return async function authenticate(request, accept, reject) {
context.logger.debug('Authentication challenge');
return accept();
};
}

module.exports = authenticator;
Loading