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

feat: use object freeze for connection args #353

Merged
merged 1 commit into from
Aug 16, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 24 additions & 22 deletions src/connection/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,33 +20,35 @@ import type {
* Returns a GraphQLFieldConfigArgumentMap appropriate to include on a field
* whose return type is a connection type with forward pagination.
*/
export const forwardConnectionArgs: GraphQLFieldConfigArgumentMap = {
after: {
type: GraphQLString,
description:
'Returns the items in the list that come after the specified cursor.',
},
first: {
type: GraphQLInt,
description: 'Returns the first n items from the list.',
},
};
export const forwardConnectionArgs: GraphQLFieldConfigArgumentMap =
Object.freeze({
after: {
type: GraphQLString,
description:
'Returns the items in the list that come after the specified cursor.',
},
first: {
type: GraphQLInt,
description: 'Returns the first n items from the list.',
},
});

/**
* Returns a GraphQLFieldConfigArgumentMap appropriate to include on a field
* whose return type is a connection type with backward pagination.
*/
export const backwardConnectionArgs: GraphQLFieldConfigArgumentMap = {
before: {
type: GraphQLString,
description:
'Returns the items in the list that come before the specified cursor.',
},
last: {
type: GraphQLInt,
description: 'Returns the last n items from the list.',
},
};
export const backwardConnectionArgs: GraphQLFieldConfigArgumentMap =
Object.freeze({
before: {
type: GraphQLString,
description:
'Returns the items in the list that come before the specified cursor.',
},
last: {
type: GraphQLInt,
description: 'Returns the last n items from the list.',
},
});

/**
* Returns a GraphQLFieldConfigArgumentMap appropriate to include on a field
Expand Down