Skip to content

Commit

Permalink
feat: upgrade Prisma to v2.4.0 (#775)
Browse files Browse the repository at this point in the history
Co-authored-by: Jason Kuhrt <jasonkuhrt@me.com>
  • Loading branch information
Weakky and jasonkuhrt authored Aug 4, 2020
1 parent 1a6db99 commit b1a7bdb
Show file tree
Hide file tree
Showing 9 changed files with 1,140 additions and 828 deletions.
19 changes: 10 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"release:stable": "dripip stable",
"release:pr": "dripip pr",
"clean": "rm -rf dist",
"build": "yarn clean && yarn build:module-facades && tsc && ts-node scripts/post-build",
"build": "yarn clean && yarn build:deps-sync && yarn build:module-facades && tsc && ts-node scripts/post-build",
"build:deps-sync": "node scripts/ensure-deps-sync",
"build:module-facades": "node scripts/build-module-facades",
"build:ci": "tsc",
"dev": "yarn -s build:module-facades && tsc --watch",
Expand All @@ -38,9 +39,9 @@
"test:db:setup": "docker-compose down && rm -rf .mysql-data && rm -rf .postgres-data && docker-compose up -d"
},
"dependencies": {
"@prisma/cli": "2.3.0",
"@prisma/client": "2.3.0",
"@prisma/sdk": "2.3.0",
"@prisma/cli": "^2.4.0",
"@prisma/client": "^2.4.0",
"@prisma/sdk": "^2.4.0",
"camelcase": "^6.0.0",
"chalk": "^4.0.0",
"common-tags": "^1.8.0",
Expand All @@ -53,11 +54,11 @@
"stacktrace-parser": "^0.1.10"
},
"devDependencies": {
"@nexus/schema": "0.14.0",
"@nexus/schema": "^0.15.0",
"@prisma-labs/prettier-config": "0.1.0",
"@prisma/fetch-engine": "2.2.0",
"@prisma/get-platform": "2.2.0",
"@prisma/migrate": "2.2.0",
"@prisma/fetch-engine": "^2.4.0",
"@prisma/get-platform": "^2.4.0",
"@prisma/migrate": "^2.4.0",
"@types/common-tags": "1.8.0",
"@types/jest": "25.2.3",
"@types/lodash": "4.14.157",
Expand All @@ -76,7 +77,7 @@
"graphql-yoga": "1.18.3",
"jest": "25.5.4",
"jest-watch-typeahead": "0.6.0",
"nexus": "0.24.2",
"nexus": "0.26.0",
"node-fetch": "2.6.0",
"node-pty": "0.9.0",
"prettier": "2.0.5",
Expand Down
16 changes: 16 additions & 0 deletions scripts/ensure-deps-sync.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const packageJson = require('../package.json')

const prismaDeps = [
...Object.entries(packageJson.dependencies),
...Object.entries(packageJson.devDependencies),
].filter(([depName]) => depName.startsWith('@prisma/'))
const versionReference = prismaDeps[0][1]

const invalidDeps = prismaDeps.filter(([, version]) => version !== versionReference)

if (invalidDeps.length > 0) {
console.log('Some of your prisma dependencies are not in sync. ', invalid.join(', '))
process.exit(1);
} else {
console.log('All prisma deps are in sync')
}
2 changes: 1 addition & 1 deletion src/framework/worktime/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,5 @@ export async function getGenerators(nexus: WorktimeLens, schemaPath: string): Pr
* Check if the thrown error is of NoModelsDefined type.
*/
function isNoModelsDefinedError(e: Error): boolean {
return Boolean(stripAnsi(e.message).match(/.*You don't have defined any model.*/))
return Boolean(stripAnsi(e.message).match(/.*You don't have any models defined.*/))
}
2 changes: 1 addition & 1 deletion src/schema/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,12 +323,12 @@ export class SchemaBuilder {

const originalResolve: GraphQLFieldResolver<any, any, any> = (_root, args, ctx, info) => {
const prismaClient = this.getPrismaClient(ctx)
args = transformNullsToUndefined(args, schemaArgsIndex, this.dmmf)
if (
typeName === 'Mutation' &&
(!isEmptyObject(publisherConfig.locallyComputedInputs) ||
!isEmptyObject(this.globallyComputedInputs))
) {
args = transformNullsToUndefined(args, schemaArgsIndex, this.dmmf)
args = addComputedInputs({
inputType,
dmmf: this.dmmf,
Expand Down
82 changes: 46 additions & 36 deletions tests/schema/__app/generated/nexus-typegen.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ export interface NexusGenInputs {
create?: NexusGenInputs['BubbleCreateWithoutMembersInput'] | null; // BubbleCreateWithoutMembersInput
}
BubbleCreateWithoutMembersInput: { // input type
createdAt?: any | null; // DateTime
createdAt?: NexusGenScalars['DateTime'] | null; // DateTime
id?: string | null; // String
}
BubbleMembersOrderByInput: { // input type
firstName?: NexusGenEnums['OrderByArg'] | null; // OrderByArg
firstName?: NexusGenEnums['SortOrder'] | null; // SortOrder
}
BubbleMembersWhereInput: { // input type
id?: NexusGenInputs['StringFilter'] | null; // StringFilter
Expand All @@ -45,14 +45,14 @@ export interface NexusGenInputs {
id?: string | null; // String
}
DateTimeFilter: { // input type
equals?: any | null; // DateTime
gt?: any | null; // DateTime
gte?: any | null; // DateTime
in?: any[] | null; // [DateTime!]
lt?: any | null; // DateTime
lte?: any | null; // DateTime
not?: any | null; // DateTime
notIn?: any[] | null; // [DateTime!]
equals?: NexusGenScalars['DateTime'] | null; // DateTime
gt?: NexusGenScalars['DateTime'] | null; // DateTime
gte?: NexusGenScalars['DateTime'] | null; // DateTime
in?: NexusGenScalars['DateTime'][] | null; // [DateTime!]
lt?: NexusGenScalars['DateTime'] | null; // DateTime
lte?: NexusGenScalars['DateTime'] | null; // DateTime
not?: NexusGenScalars['DateTime'] | null; // DateTime
notIn?: NexusGenScalars['DateTime'][] | null; // [DateTime!]
}
FloatFilter: { // input type
equals?: number | null; // Float
Expand Down Expand Up @@ -98,9 +98,9 @@ export interface NexusGenInputs {
some?: NexusGenInputs['PostWhereInput'] | null; // PostWhereInput
}
PostOrderByInput: { // input type
id?: NexusGenEnums['OrderByArg'] | null; // OrderByArg
rating?: NexusGenEnums['OrderByArg'] | null; // OrderByArg
status?: NexusGenEnums['OrderByArg'] | null; // OrderByArg
id?: NexusGenEnums['SortOrder'] | null; // SortOrder
rating?: NexusGenEnums['SortOrder'] | null; // SortOrder
status?: NexusGenEnums['SortOrder'] | null; // SortOrder
}
PostUpdateManyMutationInput: { // input type
rating?: number | null; // Float
Expand Down Expand Up @@ -132,17 +132,17 @@ export interface NexusGenInputs {
startsWith?: string | null; // String
}
UUIDFilter: { // input type
contains?: any | null; // UUID
endsWith?: any | null; // UUID
equals?: any | null; // UUID
gt?: any | null; // UUID
gte?: any | null; // UUID
in?: any[] | null; // [UUID!]
lt?: any | null; // UUID
lte?: any | null; // UUID
not?: any | null; // UUID
notIn?: any[] | null; // [UUID!]
startsWith?: any | null; // UUID
contains?: NexusGenScalars['UUID'] | null; // UUID
endsWith?: NexusGenScalars['UUID'] | null; // UUID
equals?: NexusGenScalars['UUID'] | null; // UUID
gt?: NexusGenScalars['UUID'] | null; // UUID
gte?: NexusGenScalars['UUID'] | null; // UUID
in?: NexusGenScalars['UUID'][] | null; // [UUID!]
lt?: NexusGenScalars['UUID'] | null; // UUID
lte?: NexusGenScalars['UUID'] | null; // UUID
not?: NexusGenScalars['UUID'] | null; // UUID
notIn?: NexusGenScalars['UUID'][] | null; // [UUID!]
startsWith?: NexusGenScalars['UUID'] | null; // UUID
}
UserCreateManyWithoutPostsInput: { // input type
connect?: NexusGenInputs['UserWhereUniqueInput'][] | null; // [UserWhereUniqueInput!]
Expand Down Expand Up @@ -176,16 +176,26 @@ export interface NexusGenInputs {
}

export interface NexusGenEnums {
OrderByArg: "asc" | "desc"
PostStatus: "DRAFT" | "PUBLISHED"
SortOrder: "asc" | "desc"
}

export interface NexusGenScalars {
String: string
Int: number
Float: number
Boolean: boolean
ID: string
DateTime: any
UUID: any
}

export interface NexusGenRootTypes {
BatchPayload: { // root type
count: number; // Int!
}
Bubble: { // root type
createdAt: any; // DateTime!
createdAt: NexusGenScalars['DateTime']; // DateTime!
id: string; // String!
}
Mutation: {};
Expand All @@ -197,13 +207,6 @@ export interface NexusGenRootTypes {
firstName: string; // String!
id: string; // String!
}
String: string;
Int: number;
Float: number;
Boolean: boolean;
ID: string;
DateTime: any;
UUID: any;
}

export interface NexusGenAllTypes extends NexusGenRootTypes {
Expand All @@ -230,16 +233,23 @@ export interface NexusGenAllTypes extends NexusGenRootTypes {
UserFilter: NexusGenInputs['UserFilter'];
UserWhereInput: NexusGenInputs['UserWhereInput'];
UserWhereUniqueInput: NexusGenInputs['UserWhereUniqueInput'];
OrderByArg: NexusGenEnums['OrderByArg'];
PostStatus: NexusGenEnums['PostStatus'];
SortOrder: NexusGenEnums['SortOrder'];
String: NexusGenScalars['String'];
Int: NexusGenScalars['Int'];
Float: NexusGenScalars['Float'];
Boolean: NexusGenScalars['Boolean'];
ID: NexusGenScalars['ID'];
DateTime: NexusGenScalars['DateTime'];
UUID: NexusGenScalars['UUID'];
}

export interface NexusGenFieldTypes {
BatchPayload: { // field return type
count: number; // Int!
}
Bubble: { // field return type
createdAt: any; // DateTime!
createdAt: NexusGenScalars['DateTime']; // DateTime!
id: string; // String!
members: NexusGenRootTypes['User'][]; // [User!]!
}
Expand Down Expand Up @@ -311,7 +321,7 @@ export type NexusGenObjectNames = "BatchPayload" | "Bubble" | "Mutation" | "Post

export type NexusGenInputNames = "BubbleCreateOneWithoutMembersInput" | "BubbleCreateWithoutMembersInput" | "BubbleMembersOrderByInput" | "BubbleMembersWhereInput" | "BubbleWhereInput" | "BubbleWhereUniqueInput" | "DateTimeFilter" | "FloatFilter" | "IntFilter" | "NullableStringFilter" | "PostCreateInput" | "PostFilter" | "PostOrderByInput" | "PostUpdateManyMutationInput" | "PostWhereInput" | "PostWhereUniqueInput" | "StringFilter" | "UUIDFilter" | "UserCreateManyWithoutPostsInput" | "UserCreateWithoutPostsInput" | "UserFilter" | "UserWhereInput" | "UserWhereUniqueInput";

export type NexusGenEnumNames = "OrderByArg" | "PostStatus";
export type NexusGenEnumNames = "PostStatus" | "SortOrder";

export type NexusGenInterfaceNames = never;

Expand Down
18 changes: 9 additions & 9 deletions tests/schema/__app/generated/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ input BubbleCreateWithoutMembersInput {
}

input BubbleMembersOrderByInput {
firstName: OrderByArg
firstName: SortOrder
}

input BubbleMembersWhereInput {
Expand Down Expand Up @@ -97,11 +97,6 @@ input NullableStringFilter {
startsWith: String
}

enum OrderByArg {
asc
desc
}

type Post {
authors: [User!]!
status: PostStatus!
Expand All @@ -120,9 +115,9 @@ input PostFilter {
}

input PostOrderByInput {
id: OrderByArg
rating: OrderByArg
status: OrderByArg
id: SortOrder
rating: SortOrder
status: SortOrder
}

enum PostStatus {
Expand Down Expand Up @@ -154,6 +149,11 @@ type Query {
users(after: UserWhereUniqueInput, before: UserWhereUniqueInput, first: Int, last: Int): [User!]!
}

enum SortOrder {
asc
desc
}

input StringFilter {
contains: String
endsWith: String
Expand Down
Loading

0 comments on commit b1a7bdb

Please sign in to comment.