graphql-genie
Advanced tools
Comparing version 0.4.22 to 0.4.23
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
@@ -7,0 +8,0 @@ }); |
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
@@ -7,0 +8,0 @@ }); |
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
@@ -7,0 +8,0 @@ }); |
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
@@ -7,0 +8,0 @@ }); |
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
@@ -7,0 +8,0 @@ }); |
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
@@ -7,0 +8,0 @@ }); |
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
@@ -7,0 +8,0 @@ }); |
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
@@ -214,3 +215,3 @@ }); | ||
}; | ||
const resolveArgs = (args, returnType, mutation, dataResolver, currRecord, _args, _context, _info) => __awaiter(this, void 0, void 0, function* () { | ||
const resolveArgs = (args, returnType, mutation, dataResolver, currRecord, _args, _context, _info) => __awaiter(void 0, void 0, void 0, function* () { | ||
const promises = []; | ||
@@ -254,3 +255,3 @@ args.forEach((currArg, index) => { | ||
const mutateResolver = (mutation, dataResolver) => { | ||
return (currRecord, _args, _context, _info, index, key, returnType) => __awaiter(this, void 0, void 0, function* () { | ||
return (currRecord, _args, _context, _info, index, key, returnType) => __awaiter(void 0, void 0, void 0, function* () { | ||
yield dataResolver.beginTransaction(); | ||
@@ -330,3 +331,3 @@ // iterate over all the non-id arguments and recursively create new types | ||
if (!isEmpty(upsertArgs)) { | ||
yield Promise.all(upsertArgs.map((currArg) => __awaiter(this, void 0, void 0, function* () { | ||
yield Promise.all(upsertArgs.map((currArg) => __awaiter(void 0, void 0, void 0, function* () { | ||
const whereArg = currArg.where; | ||
@@ -581,3 +582,3 @@ let upsertRecord = currRecord; | ||
if (!isScalarType(schemaType) && !isEnumType(schemaType)) { | ||
resolver = (root, _args, _context, _info) => __awaiter(this, void 0, void 0, function* () { | ||
resolver = (root, _args, _context, _info) => __awaiter(void 0, void 0, void 0, function* () { | ||
const fortuneReturn = root && root.fortuneReturn ? root.fortuneReturn : root; | ||
@@ -686,3 +687,3 @@ if (!fortuneReturn) { | ||
else { | ||
resolver = (root, _args, _context, _info) => __awaiter(this, void 0, void 0, function* () { | ||
resolver = (root, _args, _context, _info) => __awaiter(void 0, void 0, void 0, function* () { | ||
const fortuneReturn = root && root.fortuneReturn ? root.fortuneReturn : root; | ||
@@ -696,3 +697,3 @@ const result = yield defaultFieldResolver.apply(this, [fortuneReturn, _args, _context, _info]); | ||
export const getAllResolver = (dataResolver, schema, type, returnConnection = false) => { | ||
return (_root, _args, _context, _info) => __awaiter(this, void 0, void 0, function* () { | ||
return (_root, _args, _context, _info) => __awaiter(void 0, void 0, void 0, function* () { | ||
let options = {}; | ||
@@ -805,3 +806,3 @@ let where = null; | ||
}; | ||
export const filterNested = (filter, orderBy, type, fortuneReturn, cache, dataResolver, _context, _info) => __awaiter(this, void 0, void 0, function* () { | ||
export const filterNested = (filter, orderBy, type, fortuneReturn, cache, dataResolver, _context, _info) => __awaiter(void 0, void 0, void 0, function* () { | ||
// if they have nested filters on types we need to get that data now so we can filter at this root query | ||
@@ -813,3 +814,3 @@ const pullIds = new Set(); | ||
if ((orderBy || filter) && (isObjectType(type) || isInterfaceType(type))) { | ||
yield Promise.all(map(type.getFields(), (field) => __awaiter(this, void 0, void 0, function* () { | ||
yield Promise.all(map(type.getFields(), (field) => __awaiter(void 0, void 0, void 0, function* () { | ||
const currFilter = filter && filter[field.name] ? filter[field.name] : filter && filter[`f_${field.name}`] ? filter[`f_${field.name}`] : null; | ||
@@ -820,3 +821,3 @@ const currOrderBy = orderBy && orderBy[field.name] ? orderBy[field.name] : orderBy && orderBy[`f_${field.name}`] ? orderBy[`f_${field.name}`] : null; | ||
const options = currFilter ? parseFilter(currFilter, childType) : {}; | ||
yield Promise.all(fortuneReturn.map((result) => __awaiter(this, void 0, void 0, function* () { | ||
yield Promise.all(fortuneReturn.map((result) => __awaiter(void 0, void 0, void 0, function* () { | ||
if (!result) { | ||
@@ -901,3 +902,3 @@ return result; | ||
}; | ||
export const meetsConditions = (conditionsArgs, returnTypeName, returnType, currRecord, dataResolver, _context, _info) => __awaiter(this, void 0, void 0, function* () { | ||
export const meetsConditions = (conditionsArgs, returnTypeName, returnType, currRecord, dataResolver, _context, _info) => __awaiter(void 0, void 0, void 0, function* () { | ||
let meetsConditions = true; | ||
@@ -904,0 +905,0 @@ if (conditionsArgs) { |
{ | ||
"name": "graphql-genie", | ||
"version": "0.4.22", | ||
"version": "0.4.23", | ||
"description": "GraphQL Genie", | ||
@@ -34,8 +34,9 @@ "browser": "./lib/browser.umd.js", | ||
"module": "rollup -c rollup.module.js", | ||
"prepublishOnly": "npm run testMutation && npm run testGenie && npm run lint && npm run build && npm run browser && npm run module", | ||
"prepublishOnly": "npm run test && npm run lint && npm run build && npm run browser && npm run module", | ||
"start": "rollup -c rollup.browser.js -w", | ||
"test": "jest", | ||
"testMutation": "jest ./tests/__tests__/mutationTests.test.ts", | ||
"test": "npm run testGenie && npm run testSubs && npm run testAuth && npm run testMutation && npm run testPersistence", | ||
"testPersistence": "jest ./plugins/genie-persistence/tests", | ||
"testMutation": "jest ./src/tests/__tests__/mutationTests.test.ts", | ||
"testGenie": "jest ./src/tests/__tests__/genie.test.ts", | ||
"testAuth": "jest ./plugins/authentication/tests/__tests__/authentication.test.ts", | ||
"testAuth": "jest ./plugins/authentication/tests", | ||
"testSubs": "jest subscriptions.test.ts", | ||
@@ -45,3 +46,4 @@ "lint": "tslint -c tslint.json -p linttsconfig.json --fix", | ||
"tag": "git tag -a v`npm v graphql-genie version` && git push origin --tags", | ||
"installPluginDevDependencies": "cd plugins/genie-persistence && npm install" | ||
"installPluginDevDependencies": "cd plugins/genie-persistence && npm install && cd ../authentication && npm install && cd ../subscriptions && npm install", | ||
"npmUpgradePlugins": "cd plugins/genie-persistence && npm upgrade && cd ../authentication && npm upgrade && cd ../subscriptions && npm upgrade" | ||
}, | ||
@@ -64,20 +66,19 @@ "jest": { | ||
"devDependencies": { | ||
"@types/graphql": "^14.0.7", | ||
"@types/jest": "^24.0.9", | ||
"@types/lodash": "^4.14.121", | ||
"@types/node": "^11.9.5", | ||
"apollo-cache-inmemory": "^1.5.0", | ||
"apollo-client": "^2.5.0", | ||
"apollo-link-schema": "^1.1.6", | ||
"@types/jest": "^24.0.18", | ||
"@types/lodash": "^4.14.141", | ||
"@types/node": "^11.13.21", | ||
"apollo-cache-inmemory": "^1.6.3", | ||
"apollo-client": "^2.6.4", | ||
"apollo-link-schema": "^1.2.4", | ||
"eslint": "^5.14.1", | ||
"eslint-config-google": "^0.12.0", | ||
"fortune": "^5.5.17", | ||
"graphql": "^14.1.1", | ||
"graphql": "^14.5.8", | ||
"graphql-fields": "^2.0.1", | ||
"graphql-subscriptions": "^1.0.0", | ||
"graphql-tag": "^2.10.1", | ||
"graphql-tools": "^4.0.0", | ||
"jest": "^24.1.0", | ||
"lodash": "^4.17.11", | ||
"rollup": "^1.3.0", | ||
"graphql-tools": "^4.0.5", | ||
"jest": "^24.9.0", | ||
"lodash": "^4.17.15", | ||
"rollup": "^1.22.0", | ||
"rollup-plugin-commonjs": "^9.2.1", | ||
@@ -87,10 +88,10 @@ "rollup-plugin-json": "^3.1.0", | ||
"rollup-plugin-node-globals": "^1.4.0", | ||
"rollup-plugin-node-resolve": "^4.0.0", | ||
"rollup-plugin-node-resolve": "^4.2.4", | ||
"rollup-plugin-replace": "^2.1.0", | ||
"rollup-plugin-typescript2": "^0.19.3", | ||
"ts-jest": "^24.0.0", | ||
"ts-node": "^8.0.0", | ||
"tslint": "^5.13.0", | ||
"rollup-plugin-typescript2": "^0.21.2", | ||
"ts-jest": "^24.1.0", | ||
"ts-node": "^8.4.1", | ||
"tslint": "^5.20.0", | ||
"tslint-genie-rules": "^1.3.0", | ||
"typescript": "^3.3.0" | ||
"typescript": "^3.6.3" | ||
}, | ||
@@ -104,3 +105,3 @@ "peerDependencies": { | ||
"dependencies": { | ||
"abab": "^2.0.0", | ||
"abab": "^2.0.2", | ||
"graphql-iso-date": "^3.6.1", | ||
@@ -107,0 +108,0 @@ "graphql-type-json": "^0.2.1", |
import { DocumentNode, GraphQLFieldResolver, GraphQLNonNull, GraphQLObjectType, GraphQLSchema, GraphQLType, getNamedType, isEnumType, isInputObjectType, isInputType, isInterfaceType, isListType, isNonNullType, isObjectType, isScalarType, isSpecifiedDirective, isUnionType, print } from 'graphql'; | ||
import { DocumentNode, GraphQLArgument, GraphQLFieldResolver, GraphQLInputType, GraphQLNonNull, GraphQLObjectType, GraphQLSchema, GraphQLType, getNamedType, isEnumType, isInputObjectType, isInputType, isInterfaceType, isListType, isNonNullType, isObjectType, isScalarType, isSpecifiedDirective, isUnionType, print } from 'graphql'; | ||
import { GraphQLDate, GraphQLDateTime, GraphQLTime } from 'graphql-iso-date'; | ||
@@ -218,5 +218,5 @@ import { IResolvers, SchemaDirectiveVisitor, addResolveFunctionsToSchema, buildSchemaFromTypeDefinitions, makeExecutableSchema } from 'graphql-tools'; | ||
if (isInterfaceType(returnType) || isUnionType(returnType)) { // can't grab args from existing query type | ||
const where = this.schema.getType(returnType.name + 'WhereInput'); | ||
const where = <GraphQLInputType> this.schema.getType(returnType.name + 'WhereInput'); | ||
if (typeIsList(graphQLfield.type)) { | ||
const orderBy = this.schema.getType(returnType.name + 'OrderByInput'); | ||
const orderBy = <GraphQLInputType> this.schema.getType(returnType.name + 'OrderByInput'); | ||
const queryField = queryTypeFields[Object.keys(queryTypeFields)[0]]; | ||
@@ -233,7 +233,7 @@ const fullArgs = queryField ? queryField.args : []; | ||
if (orderBy && isInputType(orderBy)) { | ||
graphQLfield.args.push({ name: 'orderBy', type: orderBy }); | ||
graphQLfield.args.push(<GraphQLArgument>{ name: 'orderBy', type: orderBy}); | ||
} | ||
} | ||
if (where && isInputObjectType(where)) { | ||
graphQLfield.args.push({ name: 'where', type: where }); | ||
graphQLfield.args.push(<GraphQLArgument>{ name: 'where', type: where }); | ||
const matchField = where.getFields()['match']; | ||
@@ -240,0 +240,0 @@ if (matchField && isInputObjectType(matchField.type)) { |
import { ApolloClient } from 'apollo-client'; | ||
import gql from 'graphql-tag'; | ||
import { genie, getClient } from '../setupTests'; | ||
import { GraphQLScalarType } from '../../../plugins/genie-persistence/node_modules/@types/graphql'; | ||
import { GraphQLScalarType } from 'graphql'; | ||
import { GraphQLGenie } from '../..'; | ||
@@ -6,0 +6,0 @@ let client: ApolloClient<any>; |
@@ -124,3 +124,2 @@ import { ApolloClient } from 'apollo-client'; | ||
}); | ||
console.log('post :', post); | ||
testData.posts.push(post.data.createPost.data); | ||
@@ -127,0 +126,0 @@ expect(post.data.createPost.data.title).toBe('Genie is great'); |
@@ -89,3 +89,2 @@ import { InMemoryCache, IntrospectionFragmentMatcher } from 'apollo-cache-inmemory'; | ||
}); | ||
client.initQueryManager(); | ||
if (!overRideGenie) { | ||
@@ -92,0 +91,0 @@ process['testSetup']['client'] = client; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
1039773
29
96
21254
Updatedabab@^2.0.2