Skip to content

Commit

Permalink
feat(deps): support for GraphQL v15 (#689)
Browse files Browse the repository at this point in the history
  • Loading branch information
benjie committed Nov 11, 2020
1 parent 6b3c051 commit 3e7f98f
Show file tree
Hide file tree
Showing 52 changed files with 10,151 additions and 9,742 deletions.
5 changes: 4 additions & 1 deletion package.json
Expand Up @@ -46,7 +46,7 @@
"eslint_d": "^9.1.2",
"flow-bin": "^0.106.3",
"flow-copy-source": "^2.0.9",
"graphql": ">=0.6 <15",
"graphql": ">=0.6 <16",
"jest": "25.x",
"lerna": "^3.18.4",
"pg": ">=6.1.0 <9",
Expand All @@ -58,5 +58,8 @@
"engines": {
"node": ">=8.6",
"yarn": ">=1.3.2"
},
"resolutions": {
"graphql": "^15.4.0"
}
}
Expand Up @@ -19,8 +19,10 @@ export default (function PageInfoStartEndCursor(builder) {
({ addDataGenerator }) => {
addDataGenerator(() => ({ usesCursor: [true] }));
return {
description:
description: build.wrapDescription(
"When paginating backwards, the cursor to continue.",
"field"
),
type: Cursor,
};
},
Expand All @@ -33,8 +35,10 @@ export default (function PageInfoStartEndCursor(builder) {
({ addDataGenerator }) => {
addDataGenerator(() => ({ usesCursor: [true] }));
return {
description:
description: build.wrapDescription(
"When paginating forwards, the cursor to continue.",
"field"
),
type: Cursor,
};
},
Expand Down
9 changes: 6 additions & 3 deletions packages/graphile-build-pg/src/plugins/PgAllRows.js
Expand Up @@ -84,9 +84,12 @@ export default (async function PgAllRows(
fieldName,
({ getDataFromParsedResolveInfoFragment }) => {
return {
description: isConnection
? `Reads and enables pagination through a set of \`${tableTypeName}\`.`
: `Reads a set of \`${tableTypeName}\`.`,
description: build.wrapDescription(
isConnection
? `Reads and enables pagination through a set of \`${tableTypeName}\`.`
: `Reads a set of \`${tableTypeName}\`.`,
"field"
),
type: isConnection
? ConnectionType
: new GraphQLList(new GraphQLNonNull(TableType)),
Expand Down
Expand Up @@ -213,7 +213,10 @@ export default (function PgBackwardRelationPlugin(
return {
description:
constraint.tags.backwardDescription ||
`Reads a single \`${tableTypeName}\` that is related to this \`${foreignTableTypeName}\`.`,
build.wrapDescription(
`Reads a single \`${tableTypeName}\` that is related to this \`${foreignTableTypeName}\`.`,
"field"
),
type: gqlTableType,
args: {},
resolve: (data, _args, resolveContext, resolveInfo) => {
Expand Down Expand Up @@ -392,7 +395,10 @@ export default (function PgBackwardRelationPlugin(
return {
description:
constraint.tags.backwardDescription ||
`Reads and enables pagination through a set of \`${tableTypeName}\`.`,
build.wrapDescription(
`Reads and enables pagination through a set of \`${tableTypeName}\`.`,
"field"
),
type: isConnection
? new GraphQLNonNull(ConnectionType)
: new GraphQLNonNull(
Expand Down
Expand Up @@ -84,7 +84,10 @@ export default (function PgConditionComputedColumnPlugin(builder) {
[fieldName]: fieldWithHooks(
fieldName,
{
description: `Checks for equality with the object’s \`${fieldName}\` field.`,
description: build.wrapDescription(
`Checks for equality with the object’s \`${fieldName}\` field.`,
"field"
),
type: Type,
},
{
Expand Down
14 changes: 11 additions & 3 deletions packages/graphile-build-pg/src/plugins/PgConnectionArgCondition.js
Expand Up @@ -26,7 +26,10 @@ export default (function PgConnectionArgCondition(builder) {
newWithHooks(
GraphQLInputObjectType,
{
description: `A condition to be used against \`${tableTypeName}\` object types. All fields are tested for equality and combined with a logical ‘and.’`,
description: build.wrapDescription(
`A condition to be used against \`${tableTypeName}\` object types. All fields are tested for equality and combined with a logical ‘and.’`,
"type"
),
name: inflection.conditionType(inflection.tableType(table)),
fields: context => {
const { fieldWithHooks } = context;
Expand All @@ -42,7 +45,10 @@ export default (function PgConnectionArgCondition(builder) {
[fieldName]: fieldWithHooks(
fieldName,
{
description: `Checks for equality with the object’s \`${fieldName}\` field.`,
description: build.wrapDescription(
`Checks for equality with the object’s \`${fieldName}\` field.`,
"field"
),
type:
pgGetGqlInputTypeByTypeIdAndModifier(
attr.typeId,
Expand Down Expand Up @@ -181,8 +187,10 @@ export default (function PgConnectionArgCondition(builder) {
args,
{
condition: {
description:
description: build.wrapDescription(
"A condition to be used in determining which values should be returned by the collection.",
"arg"
),
type: TableConditionType,
},
},
Expand Down
Expand Up @@ -87,33 +87,46 @@ export default (function PgConnectionArgs(builder) {
args,
{
first: {
description: "Only read the first `n` values of the set.",
description: build.wrapDescription(
"Only read the first `n` values of the set.",
"arg"
),
type: GraphQLInt,
},
...(isPgFieldConnection
? {
last: {
description: "Only read the last `n` values of the set.",
description: build.wrapDescription(
"Only read the last `n` values of the set.",
"arg"
),
type: GraphQLInt,
},
}
: null),
offset: {
description: isPgFieldConnection
? "Skip the first `n` values from our `after` cursor, an alternative to cursor based pagination. May not be used with `last`."
: "Skip the first `n` values.",
description: build.wrapDescription(
isPgFieldConnection
? "Skip the first `n` values from our `after` cursor, an alternative to cursor based pagination. May not be used with `last`."
: "Skip the first `n` values.",
"arg"
),
type: GraphQLInt,
},
...(isPgFieldConnection
? {
before: {
description:
description: build.wrapDescription(
"Read all values in the set before (above) this cursor.",
"arg"
),
type: Cursor,
},
after: {
description:
description: build.wrapDescription(
"Read all values in the set after (below) this cursor.",
"arg"
),
type: Cursor,
},
}
Expand Down
10 changes: 8 additions & 2 deletions packages/graphile-build-pg/src/plugins/PgConnectionArgOrderBy.js
Expand Up @@ -26,7 +26,10 @@ export default (function PgConnectionArgOrderBy(builder, { orderByNullsLast }) {
GraphQLEnumType,
{
name: inflection.orderByType(tableTypeName),
description: `Methods to use when ordering \`${tableTypeName}\`.`,
description: build.wrapDescription(
`Methods to use when ordering \`${tableTypeName}\`.`,
"type"
),
values: {
NATURAL: {
value: {
Expand Down Expand Up @@ -174,7 +177,10 @@ export default (function PgConnectionArgOrderBy(builder, { orderByNullsLast }) {
args,
{
orderBy: {
description: `The method to use when ordering \`${tableTypeName}\`.`,
description: build.wrapDescription(
`The method to use when ordering \`${tableTypeName}\`.`,
"arg"
),
type: new GraphQLList(new GraphQLNonNull(TableOrderByType)),
},
},
Expand Down
Expand Up @@ -48,7 +48,10 @@ export default (function PgConnectionTotalCount(builder) {
};
});
return {
description: `The count of *all* \`${nodeTypeName}\` you could get from the connection.`,
description: build.wrapDescription(
`The count of *all* \`${nodeTypeName}\` you could get from the connection.`,
"field"
),
type: new GraphQLNonNull(GraphQLInt),
resolve(parent) {
return (
Expand Down
Expand Up @@ -178,7 +178,10 @@ export default (function PgForwardRelationPlugin(builder, { subscriptions }) {
return {
description:
constraint.tags.forwardDescription ||
`Reads a single \`${foreignTableTypeName}\` that is related to this \`${tableTypeName}\`.`,
build.wrapDescription(
`Reads a single \`${foreignTableTypeName}\` that is related to this \`${tableTypeName}\`.`,
"field"
),
type: gqlForeignTableType, // Nullable since RLS may forbid fetching
resolve: (rawData, _args, resolveContext, resolveInfo) => {
const data = isMutationPayload ? rawData.data : rawData;
Expand Down
4 changes: 3 additions & 1 deletion packages/graphile-build-pg/src/plugins/PgJWTPlugin.js
Expand Up @@ -66,8 +66,10 @@ export default (function PgJWTPlugin(
GraphQLScalarType,
{
name: compositeTypeName,
description:
description: build.wrapDescription(
"A JSON Web Token defined by [RFC 7519](https://tools.ietf.org/html/rfc7519) which securely represents claims between two parties.",
"type"
),
serialize(value) {
const token = attributes.reduce((memo, attr) => {
if (attr.name === "exp") {
Expand Down
33 changes: 26 additions & 7 deletions packages/graphile-build-pg/src/plugins/PgMutationCreatePlugin.js
Expand Up @@ -77,17 +77,25 @@ export default (function PgMutationCreatePlugin(
GraphQLInputObjectType,
{
name: inflection.createInputType(table),
description: `All input for the create \`${tableTypeName}\` mutation.`,
description: build.wrapDescription(
`All input for the create \`${tableTypeName}\` mutation.`,
"type"
),
fields: {
clientMutationId: {
description:
description: build.wrapDescription(
"An arbitrary string value with no semantic meaning. Will be included in the payload verbatim. May be used to track mutations by the client.",
"field"
),
type: GraphQLString,
},
...(TableInput
? {
[inflection.tableFieldName(table)]: {
description: `The \`${tableTypeName}\` to be created by this mutation.`,
description: build.wrapDescription(
`The \`${tableTypeName}\` to be created by this mutation.`,
"field"
),
type: new GraphQLNonNull(TableInput),
},
}
Expand All @@ -112,21 +120,29 @@ export default (function PgMutationCreatePlugin(
GraphQLObjectType,
{
name: inflection.createPayloadType(table),
description: `The output of our create \`${tableTypeName}\` mutation.`,
description: build.wrapDescription(
`The output of our create \`${tableTypeName}\` mutation.`,
"type"
),
fields: ({ fieldWithHooks }) => {
const tableName = inflection.tableFieldName(table);
return {
clientMutationId: {
description:
description: build.wrapDescription(
"The exact same `clientMutationId` that was provided in the mutation input, unchanged and unused. May be used by a client to track mutations.",
"field"
),
type: GraphQLString,
},
[tableName]: pgField(
build,
fieldWithHooks,
tableName,
{
description: `The \`${tableTypeName}\` that was created by this mutation.`,
description: build.wrapDescription(
`The \`${tableTypeName}\` that was created by this mutation.`,
"field"
),
type: Table,
},
{
Expand Down Expand Up @@ -168,7 +184,10 @@ export default (function PgMutationCreatePlugin(
!omit(attr, "create")
);
return {
description: `Creates a single \`${tableTypeName}\`.`,
description: build.wrapDescription(
`Creates a single \`${tableTypeName}\`.`,
"field"
),
type: PayloadType,
args: {
input: {
Expand Down
Expand Up @@ -80,12 +80,18 @@ export default (function PgMutationPayloadEdgePlugin(
fieldWithHooks,
fieldName,
{
description: `An edge for our \`${tableTypeName}\`. May be used by Relay 1.`,
description: build.wrapDescription(
`An edge for our \`${tableTypeName}\`. May be used by Relay 1.`,
"field"
),
type: TableEdgeType,
args: canOrderBy
? {
orderBy: {
description: `The method to use when ordering \`${tableTypeName}\`.`,
description: build.wrapDescription(
`The method to use when ordering \`${tableTypeName}\`.`,
"arg"
),
type: new GraphQLList(
new GraphQLNonNull(TableOrderByType)
),
Expand Down

0 comments on commit 3e7f98f

Please sign in to comment.