Skip to content
This repository was archived by the owner on Apr 9, 2024. It is now read-only.

Commit df1f6e1

Browse files
committed
minor fixes
1 parent e488a6b commit df1f6e1

File tree

10 files changed

+109
-20
lines changed

10 files changed

+109
-20
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "graphql-genie",
3-
"version": "0.4.20",
3+
"version": "0.4.21",
44
"description": "GraphQL Genie",
55
"browser": "./lib/browser.umd.js",
66
"jsnext:main": "./lib/module.js",

plugins/authentication/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "graphql-genie-authentication",
3-
"version": "1.1.5",
3+
"version": "1.1.6",
44
"description": "GraphQL Genie Authentication",
55
"browser": "./lib/browser.umd.js",
66
"jsnext:main": "./lib/module.js",
@@ -56,7 +56,8 @@
5656
"ts-jest": "^24.0.0",
5757
"tslint": "^5.13.1",
5858
"tslint-genie-rules": "^1.3.0",
59-
"typescript": "^3.3.3333"
59+
"typescript": "^3.3.3333",
60+
"graphql-genie": "^0.4.20"
6061
},
6162
"dependencies": {
6263
"graphql-fields": "^2.0.3"

plugins/authentication/src/authentication.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { GraphQLObjectType, GraphQLSchema, GraphQLType, defaultFieldResolver , getNamedType, isEnumType, isInterfaceType, isObjectType, isScalarType, isUnionType } from 'graphql';
2-
import { FindByUniqueError, GeniePlugin, GraphQLGenie, getRecordFromResolverReturn } from '../../../src/index';
2+
import { FindByUniqueError, GeniePlugin, GraphQLGenie, getRecordFromResolverReturn } from 'graphql-genie';
33
import { SchemaDirectiveVisitor } from 'graphql-tools';
44
import { flattenDeep, get, isArray, isEmpty, omit } from 'lodash';
55
import graphqlFields from 'graphql-fields';

plugins/authentication/tests/__tests__/authentication.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { GraphQLSchema, graphql, print } from 'graphql';
22
import gql from 'graphql-tag';
33
import authenticationPlugin from '../../src/authentication';
4-
import { GraphQLGenie } from '../../../../src/index';
4+
import { GraphQLGenie } from 'graphql-genie';
55
import { isArray, isEmpty } from 'lodash';
66

77
let schema: GraphQLSchema;

plugins/genie-persistence/tests/__tests__/genie-persistence.tests.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ describe('onlineTests', () => {
131131
}
132132
}
133133
});
134-
const postData = post.data.createPost.data;
134+
const postData = post.data['createPost'].data;
135135
testData.posts.push(postData);
136136
expect(postData.title).toBe(title);
137137
expect(postData.text).toBe(text);
@@ -171,7 +171,7 @@ describe('onlineTests', () => {
171171
}
172172
}
173173
});
174-
const postData = post.data.createPost.data;
174+
const postData = post.data['createPost'].data;
175175
testData.posts.push(postData);
176176
expect(postData.title).toBe(title);
177177
expect(postData.text).toBe(text);
@@ -392,7 +392,7 @@ describe('offlineTests', () => {
392392
}
393393
}
394394
});
395-
const postData = post.data.createPost.data;
395+
const postData = post.data['createPost'].data;
396396
testData.posts.push(postData);
397397
expect(postData.title).toBe(title);
398398
expect(postData.text).toBe(text);

plugins/subscriptions/LICENCE

Lines changed: 0 additions & 7 deletions
This file was deleted.

plugins/subscriptions/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "graphql-genie-subscriptions",
3-
"version": "1.0.10",
3+
"version": "1.0.11",
44
"description": "GraphQL Genie Subscriptions",
55
"browser": "./lib/browser.umd.js",
66
"jsnext:main": "./lib/subscriptions.js",
@@ -30,7 +30,7 @@
3030
]
3131
},
3232
"peerDependencies": {
33-
"graphql-genie": "^0.4.19",
33+
"graphql-genie": "^0.4.20",
3434
"graphql-subscriptions": "^0.5.0",
3535
"graphql-tools": "^4.0.4",
3636
"lodash": ">=4.0.0"
@@ -41,7 +41,7 @@
4141
"@types/lodash": "^4.14.122",
4242
"@types/node": "^11.10.5",
4343
"fortune": "^5.5.17",
44-
"graphql-genie": "^0.4.19",
44+
"graphql-genie": "^0.4.20",
4545
"graphql-subscriptions": "^1.0.0",
4646
"graphql-tools": "^4.0.4",
4747
"jest": "^24.3.0",

plugins/subscriptions/tests/__tests__/subscriptions.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { ApolloClient } from 'apollo-client';
22
import { GraphQLSchema, execute, subscribe } from 'graphql';
33
import { PubSub } from 'graphql-subscriptions';
44
import gql from 'graphql-tag';
5-
import { genie, getClient } from '../../../../src/tests/setupTests';
5+
import { genie, getClient } from '../setupTests';
66
import subscriptionPlugin from '../../src/subscriptions';
77

88
let client: ApolloClient<any>;
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
import { InMemoryCache, IntrospectionFragmentMatcher } from 'apollo-cache-inmemory';
2+
import { ApolloClient } from 'apollo-client';
3+
import { SchemaLink } from 'apollo-link-schema';
4+
import { GraphQLGenie } from 'graphql-genie';
5+
6+
const typeDefs = `
7+
8+
interface Submission {
9+
id: ID! @unique
10+
title: String!
11+
text: String
12+
created: DateTime @createdTimestamp
13+
updated: DateTime @updatedTimestamp
14+
}
15+
16+
type Post implements Submission {
17+
id: ID! @unique
18+
title: String!
19+
text: String
20+
tags: [String]
21+
author: User @relation(name: "WrittenSubmissions")
22+
likedBy: [User!] @relation(name: "LikedPosts") @connection
23+
comments: [Comment] @relation(name: "CommentsOnPost")
24+
published: Boolean @default(value: "true")
25+
created: DateTime @createdTimestamp
26+
updated: DateTime @updatedTimestamp
27+
createdManual: DateTime @createdTimestamp(allowManual: true)
28+
updatedManual: DateTime @updatedTimestamp(allowManual: true)
29+
}
30+
31+
type Comment implements Submission {
32+
id: ID! @unique
33+
title: String!
34+
text: String
35+
author: User @relation(name: "WrittenSubmissions")
36+
post: Post @relation(name: "CommentsOnPost")
37+
approved: Boolean @default(value: "true")
38+
created: DateTime @createdTimestamp
39+
updated: DateTime @updatedTimestamp
40+
}
41+
42+
43+
type User {
44+
id: ID! @unique
45+
email: String! @unique
46+
name : String!
47+
address: Address
48+
writtenSubmissions: [Submission] @relation(name: "WrittenSubmissions")
49+
age: Int
50+
birthday: Date
51+
likedPosts: [Post!] @relation(name: "LikedPosts") @connection
52+
family: [User]
53+
match: User
54+
orderBy: String
55+
starred: [Star]
56+
}
57+
58+
type Address {
59+
id: ID! @unique
60+
city: String!
61+
user: User
62+
}
63+
64+
union Star = Address | User | Comment | Post
65+
66+
`;
67+
process['testSetup'] = {};
68+
const fortuneOptions = { settings: { enforceLinks: true } };
69+
70+
export const genie = new GraphQLGenie({ typeDefs, fortuneOptions});
71+
72+
export const getClient = (overRideGenie?: GraphQLGenie) => {
73+
let client: ApolloClient<any>;
74+
if (!process['testSetup']['client'] || overRideGenie) {
75+
const genieToCreateClient = overRideGenie || genie;
76+
const schema = genieToCreateClient.getSchema();
77+
const introspectionQueryResultData = <any> genieToCreateClient.getFragmentTypes();
78+
const fragmentMatcher = new IntrospectionFragmentMatcher({
79+
introspectionQueryResultData
80+
});
81+
client = new ApolloClient({
82+
link: new SchemaLink({ schema: schema }),
83+
cache: new InMemoryCache({fragmentMatcher}),
84+
defaultOptions: {
85+
query: {fetchPolicy: 'no-cache'},
86+
watchQuery: {fetchPolicy: 'no-cache'}
87+
}
88+
});
89+
client.initQueryManager();
90+
if (!overRideGenie) {
91+
process['testSetup']['client'] = client;
92+
}
93+
}
94+
return client;
95+
};

src/GraphQLGenie.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
import { atob } from 'abab';
22
import { GenerateUpsert } from './GenerateUpsert';
33
import { GenerateUpdate } from './GenerateUpdate';
44
import FortuneGraph from './FortuneGraph';

0 commit comments

Comments
 (0)