Skip to content

Commit

Permalink
fix: Adapted generator to Prisma 2.8
Browse files Browse the repository at this point in the history
BREAKING CHANGE:
Adapted generator to Prisma 2.8
  • Loading branch information
unlight committed Oct 4, 2020
1 parent 7deb4a7 commit 4ac4779
Show file tree
Hide file tree
Showing 109 changed files with 854 additions and 458 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ npx prisma generate
## Resources

- Todo - https://github.com/unlight/prisma-nestjs-graphql/issues/2
- https://github.com/prisma/prisma/blob/master/src/packages/client/src/generation/TSClient.ts
- https://ts-ast-viewer.com/
- https://github.com/unlight/nestjs-graphql-prisma-realworld-example-app
- https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-schema/data-model
Expand Down
41 changes: 21 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
"prisma:g": "node node_modules/@prisma/cli/build/index.js generate",
"prettier:format": "npx prettier src --write",
"regen": "rm -rf src/@generated && npm run prisma:g && npm run eslint:fix && npm run prettier:format",
"example": "ts-node-dev src/example/main.ts"
"example": "ts-node-dev src/example/main.ts",
"clean_cache": "rm -rf node_modules/.cache"
},
"husky": {
"hooks": {
Expand All @@ -48,49 +49,49 @@
}
},
"dependencies": {
"@prisma/generator-helper": "^2.7.1",
"@prisma/generator-helper": "^2.8.0",
"get-relative-path": "^1.0.2",
"pupa": "^2.0.1",
"to-kebab": "^1.0.7",
"ts-morph": "^8.1.0",
"ts-morph": "^8.1.1",
"typescript-equals": "^1.0.0"
},
"peerDependencies": {
"@prisma/client": ">=2.5"
"@prisma/client": ">=2.8"
},
"devDependencies": {
"@commitlint/cli": "^11.0.0",
"@commitlint/config-conventional": "^11.0.0",
"@nestjs/common": "^7.4.4",
"@nestjs/core": "^7.4.4",
"@nestjs/graphql": "^7.6.0",
"@nestjs/graphql": "^7.7.0",
"@nestjs/platform-express": "^7.4.4",
"@paljs/plugins": "^1.4.0",
"@prisma/cli": "^2.7.1",
"@prisma/client": ">=2.6",
"@paljs/plugins": "^2.2.0",
"@prisma/cli": "^2.8.0",
"@prisma/client": "^2.8.0",
"@semantic-release/changelog": "^5.0.1",
"@semantic-release/git": "^9.0.0",
"@types/mocha": "^8.0.3",
"@types/node": "^14.11.1",
"@typescript-eslint/eslint-plugin": "^4.1.1",
"@typescript-eslint/parser": "^4.1.1",
"apollo-server-express": "^2.17.0",
"c8": "^7.3.0",
"@types/node": "^14.11.2",
"@typescript-eslint/eslint-plugin": "^4.3.0",
"@typescript-eslint/parser": "^4.3.0",
"apollo-server-express": "^2.18.1",
"c8": "^7.3.1",
"class-transformer": "^0.3.1",
"class-validator": "^0.12.2",
"eslint": "^7.9.0",
"eslint": "^7.10.0",
"eslint-import-resolver-node": "^0.3.4",
"eslint-plugin-etc": "0.0.2-beta.45",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-etc": "0.0.3-beta.48",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-only-warn": "^1.0.2",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-regexp": "^0.1.1",
"eslint-plugin-simple-import-sort": "^5.0.3",
"eslint-plugin-sonarjs": "^0.5.0",
"eslint-plugin-sort-class-members": "^1.8.0",
"eslint-plugin-total-functions": "^3.3.0",
"eslint-plugin-unicorn": "^21.0.0",
"eslint-plugin-total-functions": "^4.4.0",
"eslint-plugin-unicorn": "^22.0.0",
"eslint-plugin-wix-editor": "^3.2.0",
"find-cache-dir": "^3.3.1",
"git-branch-is": "^4.0.0",
Expand All @@ -105,8 +106,8 @@
"semantic-release": "^17.1.2",
"simplytyped": "^3.3.0",
"ts-node": "^9.0.0",
"ts-node-dev": "^1.0.0-pre.62",
"typescript": "~4.0.2",
"ts-node-dev": "^1.0.0-pre.63",
"typescript": "~4.0.3",
"watchexec-bin": "^1.0.0"
}
}
12 changes: 6 additions & 6 deletions src/@generated/article/aggregate-article.args.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class AggregateArticleArgs {
nullable: true,
description: undefined,
})
orderBy?: Array<ArticleOrderByInput>;
orderBy?: Array<ArticleOrderByInput> | ArticleOrderByInput;

@Field(() => ArticleWhereUniqueInput, {
nullable: true,
Expand Down Expand Up @@ -51,29 +51,29 @@ export class AggregateArticleArgs {
nullable: true,
description: undefined,
})
count?: true | null;
count?: true;

@Field(() => ArticleAvgAggregateInput, {
nullable: true,
description: undefined,
})
avg?: ArticleAvgAggregateInput | null;
avg?: ArticleAvgAggregateInput;

@Field(() => ArticleSumAggregateInput, {
nullable: true,
description: undefined,
})
sum?: ArticleSumAggregateInput | null;
sum?: ArticleSumAggregateInput;

@Field(() => ArticleMinAggregateInput, {
nullable: true,
description: undefined,
})
min?: ArticleMinAggregateInput | null;
min?: ArticleMinAggregateInput;

@Field(() => ArticleMaxAggregateInput, {
nullable: true,
description: undefined,
})
max?: ArticleMaxAggregateInput | null;
max?: ArticleMaxAggregateInput;
}
10 changes: 5 additions & 5 deletions src/@generated/article/aggregate-article.output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,29 @@ export class AggregateArticle {
nullable: true,
description: undefined,
})
count?: number | null;
count?: number;

@Field(() => ArticleAvgAggregate, {
nullable: true,
description: undefined,
})
avg?: ArticleAvgAggregate | null;
avg?: ArticleAvgAggregate;

@Field(() => ArticleSumAggregate, {
nullable: true,
description: undefined,
})
sum?: ArticleSumAggregate | null;
sum?: ArticleSumAggregate;

@Field(() => ArticleMinAggregate, {
nullable: true,
description: undefined,
})
min?: ArticleMinAggregate | null;
min?: ArticleMinAggregate;

@Field(() => ArticleMaxAggregate, {
nullable: true,
description: undefined,
})
max?: ArticleMaxAggregate | null;
max?: ArticleMaxAggregate;
}
2 changes: 1 addition & 1 deletion src/@generated/article/article-avg-aggregate.output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ export class ArticleAvgAggregate {
nullable: true,
description: undefined,
})
favoritesCount?: number | null;
favoritesCount?: number;
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ export class ArticleCreateManyWithoutAuthorInput {
nullable: true,
description: undefined,
})
create?: Array<ArticleCreateWithoutAuthorInput>;
create?: ArticleCreateWithoutAuthorInput | Array<ArticleCreateWithoutAuthorInput>;

@Field(() => [ArticleWhereUniqueInput], {
nullable: true,
description: undefined,
})
connect?: Array<ArticleWhereUniqueInput>;
connect?: ArticleWhereUniqueInput | Array<ArticleWhereUniqueInput>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ export class ArticleCreateManyWithoutFavoritedByInput {
nullable: true,
description: undefined,
})
create?: Array<ArticleCreateWithoutFavoritedByInput>;
create?: ArticleCreateWithoutFavoritedByInput | Array<ArticleCreateWithoutFavoritedByInput>;

@Field(() => [ArticleWhereUniqueInput], {
nullable: true,
description: undefined,
})
connect?: Array<ArticleWhereUniqueInput>;
connect?: ArticleWhereUniqueInput | Array<ArticleWhereUniqueInput>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ export class ArticleCreateManyWithoutTagsInput {
nullable: true,
description: undefined,
})
create?: Array<ArticleCreateWithoutTagsInput>;
create?: ArticleCreateWithoutTagsInput | Array<ArticleCreateWithoutTagsInput>;

@Field(() => [ArticleWhereUniqueInput], {
nullable: true,
description: undefined,
})
connect?: Array<ArticleWhereUniqueInput>;
connect?: ArticleWhereUniqueInput | Array<ArticleWhereUniqueInput>;
}
6 changes: 3 additions & 3 deletions src/@generated/article/article-create-without-author.input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,17 @@ export class ArticleCreateWithoutAuthorInput {
nullable: true,
description: undefined,
})
tags?: TagCreateManyWithoutArticlesInput | null;
tags?: TagCreateManyWithoutArticlesInput;

@Field(() => UserCreateManyWithoutFavoriteArticlesInput, {
nullable: true,
description: undefined,
})
favoritedBy?: UserCreateManyWithoutFavoriteArticlesInput | null;
favoritedBy?: UserCreateManyWithoutFavoriteArticlesInput;

@Field(() => CommentCreateManyWithoutArticleInput, {
nullable: true,
description: undefined,
})
comments?: CommentCreateManyWithoutArticleInput | null;
comments?: CommentCreateManyWithoutArticleInput;
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export class ArticleCreateWithoutCommentsInput {
nullable: true,
description: undefined,
})
tags?: TagCreateManyWithoutArticlesInput | null;
tags?: TagCreateManyWithoutArticlesInput;

@Field(() => UserCreateOneWithoutArticlesInput, {
nullable: true,
Expand All @@ -76,5 +76,5 @@ export class ArticleCreateWithoutCommentsInput {
nullable: true,
description: undefined,
})
favoritedBy?: UserCreateManyWithoutFavoriteArticlesInput | null;
favoritedBy?: UserCreateManyWithoutFavoriteArticlesInput;
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export class ArticleCreateWithoutFavoritedByInput {
nullable: true,
description: undefined,
})
tags?: TagCreateManyWithoutArticlesInput | null;
tags?: TagCreateManyWithoutArticlesInput;

@Field(() => UserCreateOneWithoutArticlesInput, {
nullable: true,
Expand All @@ -76,5 +76,5 @@ export class ArticleCreateWithoutFavoritedByInput {
nullable: true,
description: undefined,
})
comments?: CommentCreateManyWithoutArticleInput | null;
comments?: CommentCreateManyWithoutArticleInput;
}
4 changes: 2 additions & 2 deletions src/@generated/article/article-create-without-tags.input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ export class ArticleCreateWithoutTagsInput {
nullable: true,
description: undefined,
})
favoritedBy?: UserCreateManyWithoutFavoriteArticlesInput | null;
favoritedBy?: UserCreateManyWithoutFavoriteArticlesInput;

@Field(() => CommentCreateManyWithoutArticleInput, {
nullable: true,
description: undefined,
})
comments?: CommentCreateManyWithoutArticleInput | null;
comments?: CommentCreateManyWithoutArticleInput;
}
6 changes: 3 additions & 3 deletions src/@generated/article/article-create.input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export class ArticleCreateInput {
nullable: true,
description: undefined,
})
tags?: TagCreateManyWithoutArticlesInput | null;
tags?: TagCreateManyWithoutArticlesInput;

@Field(() => UserCreateOneWithoutArticlesInput, {
nullable: true,
Expand All @@ -77,11 +77,11 @@ export class ArticleCreateInput {
nullable: true,
description: undefined,
})
favoritedBy?: UserCreateManyWithoutFavoriteArticlesInput | null;
favoritedBy?: UserCreateManyWithoutFavoriteArticlesInput;

@Field(() => CommentCreateManyWithoutArticleInput, {
nullable: true,
description: undefined,
})
comments?: CommentCreateManyWithoutArticleInput | null;
comments?: CommentCreateManyWithoutArticleInput;
}
2 changes: 1 addition & 1 deletion src/@generated/article/article-max-aggregate.output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ export class ArticleMaxAggregate {
nullable: true,
description: undefined,
})
favoritesCount?: number | null;
favoritesCount?: number;
}
2 changes: 1 addition & 1 deletion src/@generated/article/article-min-aggregate.output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ export class ArticleMinAggregate {
nullable: true,
description: undefined,
})
favoritesCount?: number | null;
favoritesCount?: number;
}
2 changes: 1 addition & 1 deletion src/@generated/article/article-order-by.input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,5 @@ export class ArticleOrderByInput {
nullable: true,
description: undefined,
})
active?: SortOrder | null;
active?: SortOrder;
}
Loading

0 comments on commit 4ac4779

Please sign in to comment.