Skip to content

Commit 1a6e7d0

Browse files
authored
fix: add edgeTypeName param to ConnectionOpts
* feat: add edgeTypeName param to ConnectionOpts * chore: update graphql-compose-connection version * fix: allow upper version for graphql-compose-connection * fix: update package.json and yarn.lock
1 parent a880f3e commit 1a6e7d0

File tree

4 files changed

+18
-6
lines changed

4 files changed

+18
-6
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"object-path": "^0.11.4"
3232
},
3333
"optionalDependencies": {
34-
"graphql-compose-connection": "^6.0.4",
34+
"graphql-compose-connection": "^6.2.0",
3535
"graphql-compose-pagination": "^6.0.3"
3636
},
3737
"peerDependencies": {
@@ -61,7 +61,7 @@
6161
"flow-bin": "0.124.0",
6262
"graphql": "15.0.0",
6363
"graphql-compose": "7.14.4",
64-
"graphql-compose-connection": "^6.0.3",
64+
"graphql-compose-connection": "^6.2.0",
6565
"graphql-compose-pagination": "^6.0.3",
6666
"jest": "25.2.7",
6767
"mongodb-memory-server": "6.5.2",

src/resolvers/__tests__/connection-test.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,15 @@ describe('connection() resolver', () => {
178178
expect(resolver.hasArg('after')).toBe(true);
179179
});
180180

181+
it('should create custom edge type', () => {
182+
const resolver = connection(UserModel, UserTC, {
183+
// $FlowFixMe
184+
edgeTypeName: 'CustomEdge',
185+
});
186+
if (!resolver) throw new Error('Connection resolver is undefined');
187+
expect(schemaComposer.has('CustomEdge')).toBe(true);
188+
});
189+
181190
describe('Resolver.resolve():Promise', () => {
182191
it('should be fulfilled Promise', async () => {
183192
const resolver = connection(UserModel, UserTC);

src/resolvers/connection.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export type ConnectionOpts<TContext = any> = _ConnectionSortMapOpts & {
1919
connectionResolverName?: string,
2020
findResolverName?: string,
2121
countResolverName?: string,
22+
edgeTypeName?: string,
2223
};
2324

2425
export default function connection<TSource: MongooseDocument, TContext>(
@@ -70,6 +71,7 @@ export default function connection<TSource: MongooseDocument, TContext>(
7071
findResolverName = 'findMany',
7172
countResolverName = 'count',
7273
edgeFields,
74+
edgeTypeName,
7375
...sortOptions
7476
} = opts || {};
7577
return prepareConnectionResolver(tc, {
@@ -81,6 +83,7 @@ export default function connection<TSource: MongooseDocument, TContext>(
8183
...sortOptions,
8284
},
8385
edgeFields,
86+
edgeTypeName,
8487
});
8588
}
8689

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4238,10 +4238,10 @@ graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6
42384238
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.3.tgz#4a12ff1b60376ef09862c2093edd908328be8423"
42394239
integrity sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==
42404240

4241-
graphql-compose-connection@^6.0.4:
4242-
version "6.1.0"
4243-
resolved "https://registry.yarnpkg.com/graphql-compose-connection/-/graphql-compose-connection-6.1.0.tgz#58c3ed4d7b90928f11a8ee51cc814117db8efb42"
4244-
integrity sha512-8vLfm1P7Am2EdGU5trMOOrbVU117WRJCKF3GRg/biYhM/tfrozOFC/k3gSjpCwafXwIINX+g1HJDpgjZ/ywTMg==
4241+
graphql-compose-connection@^6.2.0:
4242+
version "6.2.0"
4243+
resolved "https://registry.yarnpkg.com/graphql-compose-connection/-/graphql-compose-connection-6.2.0.tgz#a251e829f99971a206294bf6b55e4328c2b73419"
4244+
integrity sha512-oXz0Tq6ttrAsnguLKlxO4TIN14CMMrphwsdAv7kQYDkr6tHzx17sNFgT/w0ovBix8Hnaa9X3Tq1M3O0C+0hydA==
42454245

42464246
graphql-compose-pagination@^6.0.3:
42474247
version "6.0.3"

0 commit comments

Comments
 (0)