Skip to content

Commit

Permalink
Update @graphql-ts/schema (#6312)
Browse files Browse the repository at this point in the history
  • Loading branch information
emmatown authored Aug 13, 2021
1 parent 0e5cbb7 commit 56044e2
Show file tree
Hide file tree
Showing 10 changed files with 300 additions and 294 deletions.
6 changes: 6 additions & 0 deletions .changeset/lucky-bears-kiss.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@keystone-next/keystone': major
'@keystone-next/types': major
---

Updated `@graphql-ts/schema`. The second type parameter of `schema.Arg` exported from `@keystone-next/types` is now a boolean that defines whether or not the arg has a default value to make it easier to define circular input objects.
2 changes: 1 addition & 1 deletion packages/keystone/src/lib/id-field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const nonCircularFields = {

type IDFilterType = schema.InputObjectType<
typeof nonCircularFields & {
not: schema.Arg<typeof IDFilter, undefined>;
not: schema.Arg<typeof IDFilter>;
}
>;

Expand Down
2 changes: 1 addition & 1 deletion packages/types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"dependencies": {
"@babel/runtime": "^7.14.8",
"@graphql-ts/schema": "0.1.2",
"@graphql-ts/schema": "0.2.0",
"@keystone-next/fields": "^13.0.0",
"apollo-server-types": "^0.9.0",
"cors": "^2.8.5",
Expand Down
4 changes: 2 additions & 2 deletions packages/types/src/filters/enum-filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ export type EnumNullableFilter<Enum extends schema.EnumType<any>> = schema.Input
// can be null
notIn: schema.Arg<schema.ListType<schema.NonNullType<Enum>>>;
// can be null
not: schema.Arg<EnumNullableFilter<Enum>, undefined>;
not: schema.Arg<EnumNullableFilter<Enum>>;
}>;

export type EnumFilter<Enum extends schema.EnumType<any>> = schema.InputObjectType<{
equals: schema.Arg<Enum>;
in: schema.Arg<schema.ListType<schema.NonNullType<Enum>>>;
notIn: schema.Arg<schema.ListType<schema.NonNullType<Enum>>>;
not: schema.Arg<EnumFilter<Enum>, undefined>;
not: schema.Arg<EnumFilter<Enum>>;
}>;

type EnumNullableListFilterType<Enum extends schema.EnumType<any>> = schema.InputObjectType<{
Expand Down
306 changes: 153 additions & 153 deletions packages/types/src/filters/providers/postgresql.ts

Large diffs are not rendered by default.

224 changes: 112 additions & 112 deletions packages/types/src/filters/providers/sqlite.ts

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions packages/types/src/json-field-type-polyfill-for-sqlite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ export function jsonFieldTypePolyfilledForSQLite<
ScalarDBField<'Json', 'optional'>,
CreateArg,
UpdateArg,
schema.Arg<schema.NullableInputType, undefined>,
schema.Arg<schema.NullableInputType, undefined>
schema.Arg<schema.NullableInputType, false>,
schema.Arg<schema.NullableInputType, false>
> & {
input?: {
uniqueWhere?: undefined;
Expand Down
36 changes: 18 additions & 18 deletions packages/types/src/next-fields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,17 @@ export type NextFieldType<
| schema.Arg<schema.InputType>
| undefined,
UpdateArg extends schema.Arg<schema.InputType> = schema.Arg<schema.InputType>,
UniqueWhereArg extends schema.Arg<schema.NullableInputType, undefined> = schema.Arg<
UniqueWhereArg extends schema.Arg<schema.NullableInputType, false> = schema.Arg<
schema.NullableInputType,
undefined
false
>,
OrderByArg extends schema.Arg<schema.NullableInputType, undefined> = schema.Arg<
OrderByArg extends schema.Arg<schema.NullableInputType, false> = schema.Arg<
schema.NullableInputType,
undefined
false
>,
FilterArg extends schema.Arg<schema.NullableInputType, undefined> = schema.Arg<
FilterArg extends schema.Arg<schema.NullableInputType, false> = schema.Arg<
schema.NullableInputType,
undefined
false
>
> = {
dbField: TDBField;
Expand Down Expand Up @@ -351,17 +351,17 @@ export type FieldTypeWithoutDBField<
| schema.Arg<schema.InputType>
| undefined,
UpdateArg extends schema.Arg<schema.InputType> = schema.Arg<schema.InputType>,
UniqueWhereArg extends schema.Arg<schema.NullableInputType, undefined> = schema.Arg<
UniqueWhereArg extends schema.Arg<schema.NullableInputType, false> = schema.Arg<
schema.NullableInputType,
undefined
false
>,
OrderByArg extends schema.Arg<schema.NullableInputType, undefined> = schema.Arg<
OrderByArg extends schema.Arg<schema.NullableInputType, false> = schema.Arg<
schema.NullableInputType,
undefined
false
>,
FilterArg extends schema.Arg<schema.NullableInputType, undefined> = schema.Arg<
FilterArg extends schema.Arg<schema.NullableInputType, false> = schema.Arg<
schema.NullableInputType,
undefined
false
>
> = {
input?: {
Expand Down Expand Up @@ -393,9 +393,9 @@ export function fieldType<TDBField extends DBField>(dbField: TDBField) {
return function <
CreateArg extends schema.Arg<schema.InputType> | undefined,
UpdateArg extends schema.Arg<schema.InputType>,
UniqueWhereArg extends schema.Arg<schema.NullableInputType, undefined>,
OrderByArg extends schema.Arg<schema.NullableInputType, undefined>,
FilterArg extends schema.Arg<schema.NullableInputType, undefined>
UniqueWhereArg extends schema.Arg<schema.NullableInputType, false>,
OrderByArg extends schema.Arg<schema.NullableInputType, false>,
FilterArg extends schema.Arg<schema.NullableInputType, false>
>(
stuff: FieldTypeWithoutDBField<
TDBField,
Expand Down Expand Up @@ -453,13 +453,13 @@ export type TypesForList = {
};

export type FindManyArgs = {
where: schema.Arg<schema.NonNullType<TypesForList['where']>, {}>;
where: schema.Arg<schema.NonNullType<TypesForList['where']>, true>;
orderBy: schema.Arg<
schema.NonNullType<schema.ListType<schema.NonNullType<TypesForList['orderBy']>>>,
Record<string, any>[]
true
>;
take: schema.Arg<typeof schema.Int>;
skip: schema.Arg<schema.NonNullType<typeof schema.Int>, number>;
skip: schema.Arg<schema.NonNullType<typeof schema.Int>, true>;
};

export type FindManyArgsValue = schema.InferValueFromArgs<FindManyArgs>;
2 changes: 1 addition & 1 deletion prisma-utils/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ function printInputTypeForGraphQLTS(
field.isList
? `schema.ListType<schema.NonNullType<typeof ${field.type}>>`
: `typeof ${field.type}`
}, undefined>`;
}>`;
})
.join(',\n')}
}>
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1535,10 +1535,10 @@
dependencies:
tslib "~2.3.0"

"@graphql-ts/schema@0.1.2":
version "0.1.2"
resolved "https://registry.yarnpkg.com/@graphql-ts/schema/-/schema-0.1.2.tgz#71b04cc88ff61f5c19a81ac70f878b1e36f617da"
integrity sha512-ZP4Nj70B18q1Y7B4WHeJR5gMyoH8oX9umnpmT9gu6kUD9rmTZfqHE9cGHRisw+ZOlWBnx6rPrx0BmUROFQFORA==
"@graphql-ts/schema@0.2.0":
version "0.2.0"
resolved "https://registry.yarnpkg.com/@graphql-ts/schema/-/schema-0.2.0.tgz#1fc11a985cd5b0534de6616abcf05b0b493b8252"
integrity sha512-4hLQW5RfJkSkqia3Tl/LRVjsIGziTN/fHsUEuSIg1quD0y3pPpQxisDAIt4nkevY53q+JuGSVG1isJz+v8Ym/g==
dependencies:
"@babel/runtime" "^7.9.2"

Expand Down

0 comments on commit 56044e2

Please sign in to comment.