Skip to content

upgrade to v17 #1348

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
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
5 changes: 4 additions & 1 deletion examples/complex-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,17 @@
"@pothos/plugin-simple-objects": "workspace:*",
"@pothos/plugin-zod": "workspace:*",
"@prisma/client": "^5.19.1",
"graphql": "^16.8.1",
"graphql": "canary-pr-4288",
"graphql-scalars": "^1.23.0",
"graphql-yoga": "5.7.0",
"prisma": "^5.19.1",
"react": "^18.3.1",
"urql": "^4.1.0",
"zod": "^3.23.8"
},
"overrides": {
"graphql": "canary-pr-4288"
},
"publishConfig": {
"access": "public"
},
Expand Down
2 changes: 1 addition & 1 deletion examples/envelope-helix-fastify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@faker-js/faker": "^9.0.0",
"@pothos/core": "workspace:*",
"fastify": "^4.28.1",
"graphql": "^16.8.1",
"graphql": "canary-pr-4288",
"graphql-helix": "^1.13.0"
},
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion examples/federation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@pothos/plugin-directives": "workspace:*",
"@pothos/plugin-federation": "workspace:*",
"@prisma/client": "^5.19.1",
"graphql": "^16.8.1",
"graphql": "canary-pr-4288",
"prisma": "^5.19.1"
},
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion examples/graphql-shield/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"dependencies": {
"@faker-js/faker": "^9.0.0",
"@pothos/core": "workspace:*",
"graphql": "^16.8.1",
"graphql": "canary-pr-4288",
"graphql-middleware": "^6.1.35",
"graphql-shield": "^7.6.5",
"graphql-yoga": "5.7.0"
Expand Down
2 changes: 1 addition & 1 deletion examples/helix/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"dependencies": {
"@faker-js/faker": "^9.0.0",
"@pothos/core": "workspace:*",
"graphql": "^16.8.1",
"graphql": "canary-pr-4288",
"graphql-helix": "^1.13.0"
},
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion examples/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@faker-js/faker": "^9.0.0",
"@pothos/core": "workspace:*",
"@tanstack/react-query": "^5.55.2",
"graphql": "^16.8.1",
"graphql": "canary-pr-4288",
"graphql-tag": "^2.12.6",
"graphql-yoga": "5.7.0",
"next": "14.2.8",
Expand Down
2 changes: 1 addition & 1 deletion examples/open-telemetry/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@pothos/plugin-tracing": "workspace:*",
"@pothos/tracing-opentelemetry": "workspace:*",
"bema": "^0.1.2",
"graphql": "^16.8.1",
"graphql": "canary-pr-4288",
"graphql-yoga": "5.7.0",
"tsm": "^2.3.0"
},
Expand Down
2 changes: 1 addition & 1 deletion examples/prisma-federation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"@pothos/plugin-prisma": "workspace:*",
"@pothos/plugin-relay": "workspace:*",
"@prisma/client": "^5.19.1",
"graphql": "^16.8.1",
"graphql": "canary-pr-4288",
"prisma": "^5.19.1"
},
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion examples/prisma-relay/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@pothos/plugin-prisma": "workspace:*",
"@pothos/plugin-relay": "workspace:*",
"@prisma/client": "^5.19.1",
"graphql": "^16.8.1",
"graphql": "canary-pr-4288",
"graphql-yoga": "5.7.0",
"prisma": "^5.19.1"
},
Expand Down
2 changes: 1 addition & 1 deletion examples/prisma-smart-subscriptions-apollo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"body-parser": "^1.20.2",
"cors": "^2.8.5",
"express": "^4.19.2",
"graphql": "^16.8.1",
"graphql": "canary-pr-4288",
"graphql-subscriptions": "^2.0.0",
"graphql-ws": "^5.16.0",
"prisma": "^5.19.1",
Expand Down
2 changes: 1 addition & 1 deletion examples/prisma-subscriptions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@pothos/core": "workspace:*",
"@pothos/plugin-prisma": "workspace:*",
"@prisma/client": "^5.19.1",
"graphql": "^16.8.1",
"graphql": "canary-pr-4288",
"graphql-subscriptions": "^2.0.0",
"graphql-yoga": "5.7.0",
"prisma": "^5.19.1"
Expand Down
2 changes: 1 addition & 1 deletion examples/prisma/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@pothos/core": "workspace:*",
"@pothos/plugin-prisma": "workspace:*",
"@prisma/client": "^5.19.1",
"graphql": "^16.8.1",
"graphql": "canary-pr-4288",
"graphql-yoga": "5.7.0",
"prisma": "^5.19.1"
},
Expand Down
2 changes: 1 addition & 1 deletion examples/relay-windowed-pagination/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@faker-js/faker": "^9.0.0",
"@pothos/core": "workspace:*",
"@pothos/plugin-relay": "workspace:*",
"graphql": "^16.8.1",
"graphql": "canary-pr-4288",
"graphql-yoga": "5.7.0",
"prisma": "^5.19.1"
},
Expand Down
2 changes: 1 addition & 1 deletion examples/simple-classes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"dependencies": {
"@faker-js/faker": "^9.0.0",
"@pothos/core": "workspace:*",
"graphql": "^16.8.1",
"graphql": "canary-pr-4288",
"graphql-yoga": "5.7.0"
},
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion examples/simple-interfaces/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"dependencies": {
"@faker-js/faker": "^9.0.0",
"@pothos/core": "workspace:*",
"graphql": "^16.8.1",
"graphql": "canary-pr-4288",
"graphql-yoga": "5.7.0"
},
"publishConfig": {
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"@types/node": "^22.5.4",
"@vitest/coverage-c8": "^0.33.0",
"globals": "^15.9.0",
"graphql": "^16.8.1",
"graphql": "canary-pr-4288",
"graphql-helix": "^1.13.0",
"graphql-tag": "^2.12.6",
"jest": "^29.7.0",
Expand All @@ -53,7 +53,7 @@
"pnpm": ">=9.0.0"
},
"resolutions": {
"graphql": "^16.8.1",
"graphql": "canary-pr-4288",
"@whatwg-node/fetch": "0.8.8"
},
"repository": {
Expand All @@ -72,7 +72,7 @@
"ignoreMissing": ["webpack", "@babel/*", "@types/node"],
"allowedVersions": {
"jest": "^28.1.0",
"graphql": "^16.5.0"
"graphql": "canary-pr-4288"
}
},

Expand Down
4 changes: 2 additions & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@
"provenance": true
},
"peerDependencies": {
"graphql": ">=16.6.0"
"graphql": "canary-pr-4288"
},
"devDependencies": {
"@pothos/test-utils": "workspace:*",
"graphql": ">=16.6.0",
"graphql": "canary-pr-4288",
"graphql-scalars": "^1.23.0",
"graphql-tag": "^2.12.6"
},
Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/fieldUtils/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ export class InputFieldBuilder<
description: opts.description,
deprecationReason: opts.deprecationReason,
defaultValue: opts.defaultValue,
defaultValueLiteral: opts.defaultValueLiteral,
extensions: opts.extensions ?? {},
};
})
Expand All @@ -162,6 +163,7 @@ export class InputFieldBuilder<
description: opts.description,
deprecationReason: opts.deprecationReason,
defaultValue: opts.defaultValue,
defaultValueLiteral: opts.defaultValueLiteral,
extensions: opts.extensions ?? {},
};
});
Expand Down
8 changes: 4 additions & 4 deletions packages/core/src/plugins/merge-plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,15 @@ export class MergedPlugins<Types extends SchemaTypes> extends BasePlugin<Types>
if (fieldConfig.argMappers.length) {
const argMappers = fieldConfig.argMappers;

return (parent, args, context, info) => {
return (parent, args, context, info, abortSignal) => {
const mappedArgs = argMappers.reduce(
(acc, argMapper) => {
return argMapper(acc, context, info);
},
args as Record<string, unknown>,
);

return wrapped(parent, mappedArgs, context, info);
return wrapped(parent, mappedArgs, context, info, abortSignal);
};
}

Expand All @@ -105,15 +105,15 @@ export class MergedPlugins<Types extends SchemaTypes> extends BasePlugin<Types>
}

const argMappers = fieldConfig.argMappers;
return (parent, args, context, info) => {
return (parent, args, context, info, abortSignal) => {
const mappedArgs = argMappers.reduce(
(acc, argMapper) => {
return argMapper(acc, context, info);
},
args as Record<string, unknown>,
);

return wrapped(parent, mappedArgs, context, info);
return wrapped(parent, mappedArgs, context, info, abortSignal);
};
}

Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/types/builder-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export type Resolver<Parent, Args, Context, Type, Return = unknown> = (
args: Args,
context: Context,
info: GraphQLResolveInfo,
abortSignal: AbortSignal | undefined,
) => [Type] extends [readonly (infer Item)[] | null | undefined]
? ListResolveValue<Type, Item, Return>
: MaybePromise<Type>;
Expand All @@ -68,6 +69,7 @@ export type Subscriber<Parent, Args, Context, Shape> = (
args: Args,
context: Context,
info: GraphQLResolveInfo,
abortSignal: AbortSignal | undefined,
) => MaybePromise<AsyncIterable<Shape>>;

export type EnumValues<Types extends SchemaTypes> = EnumValueConfigMap<Types> | readonly string[];
Expand Down
7 changes: 5 additions & 2 deletions packages/core/src/types/global/field-options.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { GraphQLFieldExtensions } from 'graphql';
import type { ConstValueNode, GraphQLFieldExtensions } from 'graphql';
import type {
InferredFieldOptionsByKind,
InputFieldMap,
Expand All @@ -12,6 +12,7 @@ import type {
FieldRequiredness,
InputShapeFromTypeParam,
InputType,
OutputShape,
ShapeFromTypeParam,
TypeParam,
} from '../type-params';
Expand Down Expand Up @@ -259,7 +260,9 @@ declare global {
/** determines if this field can be omitted (or set as null) */
required?: Req;
/** default value if this field is not included in the query */
defaultValue?: InputShapeFromTypeParam<Types, Type, Req>;
defaultValue?: unknown;
/** default value if this field is not included in the query */
defaultValueLiteral?: ConstValueNode | undefined;
/** extensions for this field for use by directives, server plugins or other tools that depend on extensions */
extensions?: Readonly<Record<string, unknown>>;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin-add-graphql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@
},
"peerDependencies": {
"@pothos/core": "*",
"graphql": ">=16.6.0"
"graphql": "canary-pr-4288"
},
"devDependencies": {
"@pothos/core": "workspace:*",
"@pothos/test-utils": "workspace:*",
"graphql": "^16.8.1",
"graphql": "canary-pr-4288",
"graphql-tag": "^2.12.6"
}
}
9 changes: 6 additions & 3 deletions packages/plugin-add-graphql/src/schema-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ proto.addGraphQLObject = function addGraphQLObject<Shape>(
...input,
description: arg.description ?? undefined,
deprecationReason: arg.deprecationReason ?? undefined,
defaultValue: arg.defaultValue,
defaultValue: arg.defaultValue?.value,
defaultValueLiteral: arg.defaultValue?.literal,
extensions: arg.extensions,
});
}
Expand Down Expand Up @@ -210,7 +211,8 @@ proto.addGraphQLInterface = function addGraphQLInterface<Shape = unknown>(
...resolveInputType(this, arg.type),
description: arg.description ?? undefined,
deprecationReason: arg.deprecationReason ?? undefined,
defaultValue: arg.defaultValue,
defaultValue: arg.defaultValue?.value,
defaultValueLiteral: arg.defaultValue?.literal,
extensions: arg.extensions,
});
}
Expand Down Expand Up @@ -321,7 +323,8 @@ proto.addGraphQLInput = function addGraphQLInput<Shape extends {}>(
combinedFields[fieldName] = t.field({
...resolveInputType(this, field.type),
description: field.description ?? undefined,
defaultValue: field.defaultValue,
defaultValue: field.defaultValue?.value,
defaultValueLiteral: field.defaultValue?.literal,
extensions: field.extensions,
});
}
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin-complexity/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@
},
"peerDependencies": {
"@pothos/core": "*",
"graphql": ">=16.6.0"
"graphql": "canary-pr-4288"
},
"devDependencies": {
"@pothos/core": "workspace:*",
"@pothos/test-utils": "workspace:*",
"graphql": "^16.8.1",
"graphql": "canary-pr-4288",
"graphql-tag": "^2.12.6"
},
"gitHead": "9dfe52f1975f41a111e01bf96a20033a914e2acc"
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin-complexity/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ export class PothosComplexityPlugin<Types extends SchemaTypes> extends BasePlugi
return resolver;
}

return (parent, args, context, info) => {
return (parent, args, context, info, abortSignal) => {
this.checkComplexity(context, info);
return resolver(parent, args, context, info);
return resolver(parent, args, context, info, abortSignal);
};
}

Expand Down
7 changes: 4 additions & 3 deletions packages/plugin-complexity/src/util.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PothosValidationError } from '@pothos/core';
import { PartialResolveInfo, PothosValidationError } from '@pothos/core';
import {
type DocumentNode,
type GraphQLResolveInfo,
Expand Down Expand Up @@ -46,10 +46,11 @@ export function complexityFromQuery(
throw new PothosValidationError(`No root type found for operation ${operation.operation}`);
}

const info = {
const info: PartialResolveInfo = {
schema: options.schema,
fragments,
variableValues: options.variables ?? {},
// TODO: get sources!
variableValues: { sources: {}, coerced: options.variables ?? {} },
};

return complexityFromSelectionSet(options.ctx ?? {}, info, operation.selectionSet, rootType);
Expand Down
3 changes: 2 additions & 1 deletion packages/plugin-complexity/src/validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ export function createComplexityRule({
context,
{
fragments,
variableValues,
// TODO: add sources!
variableValues: { sources: {}, coerced: variableValues },
schema,
},
node.selectionSet,
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin-dataloader/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@
"peerDependencies": {
"@pothos/core": "*",
"dataloader": "2",
"graphql": ">=16.6.0"
"graphql": "canary-pr-4288"
},
"devDependencies": {
"@pothos/core": "workspace:*",
"@pothos/plugin-errors": "workspace:*",
"@pothos/plugin-relay": "workspace:*",
"@pothos/test-utils": "workspace:*",
"dataloader": "^2.2.2",
"graphql": "^16.8.1",
"graphql": "canary-pr-4288",
"graphql-tag": "^2.12.6"
},
"gitHead": "9dfe52f1975f41a111e01bf96a20033a914e2acc"
Expand Down
Loading
Loading