Skip to content
This repository has been archived by the owner on Oct 8, 2023. It is now read-only.

Commit

Permalink
Update dependency @keystone-6/core to v5 (#288)
Browse files Browse the repository at this point in the history
* Update dependency @keystone-6/core to v5

* update schemas

* update to wasAccessAllowed

* add changeset

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Josh Calder <[email protected]>
  • Loading branch information
renovate[bot] and borisno2 authored Feb 26, 2023
1 parent c787ffc commit ec29144
Show file tree
Hide file tree
Showing 7 changed files with 348 additions and 511 deletions.
5 changes: 5 additions & 0 deletions .changeset/brown-scissors-sin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@opensaas/keystone-nextjs-auth": major
---

Update dependency @keystone-6/core to v5
2 changes: 1 addition & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"start": "keystone prisma migrate deploy && keystone start"
},
"dependencies": {
"@keystone-6/core": "4.0.1",
"@keystone-6/core": "5.0.0",
"@keystone-6/fields-document": "7.0.0",
"@keystone-ui/button": "7.0.2",
"@keystone-ui/core": "5.0.2",
Expand Down
13 changes: 10 additions & 3 deletions backend/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type Role {
canManageRoles: Boolean
canManageCart: Boolean
canManageOrgs: Boolean
assignedTo(where: UserWhereInput! = {}, orderBy: [UserOrderByInput!]! = [], take: Int, skip: Int! = 0): [User!]
assignedTo(where: UserWhereInput! = {}, orderBy: [UserOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: UserWhereUniqueInput): [User!]
assignedToCount(where: UserWhereInput! = {}): Int
}

Expand Down Expand Up @@ -227,10 +227,10 @@ type Mutation {
}

type Query {
roles(where: RoleWhereInput! = {}, orderBy: [RoleOrderByInput!]! = [], take: Int, skip: Int! = 0): [Role!]
roles(where: RoleWhereInput! = {}, orderBy: [RoleOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: RoleWhereUniqueInput): [Role!]
role(where: RoleWhereUniqueInput!): Role
rolesCount(where: RoleWhereInput! = {}): Int
users(where: UserWhereInput! = {}, orderBy: [UserOrderByInput!]! = [], take: Int, skip: Int! = 0): [User!]
users(where: UserWhereInput! = {}, orderBy: [UserOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: UserWhereUniqueInput): [User!]
user(where: UserWhereUniqueInput!): User
usersCount(where: UserWhereInput! = {}): Int
keystone: KeystoneMeta!
Expand Down Expand Up @@ -275,6 +275,7 @@ type KeystoneAdminUIFieldMeta {
description: String
isOrderable: Boolean!
isFilterable: Boolean!
isNonNull: [KeystoneAdminUIFieldMetaIsNonNull!]
fieldMeta: JSON
viewsIndex: Int!
customViewsIndex: Int
Expand All @@ -284,6 +285,12 @@ type KeystoneAdminUIFieldMeta {
search: QueryMode
}

enum KeystoneAdminUIFieldMetaIsNonNull {
read
create
update
}

type KeystoneAdminUIFieldMetaCreateView {
fieldMode: KeystoneAdminUIFieldMetaCreateViewFieldMode!
}
Expand Down
1 change: 0 additions & 1 deletion backend/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ datasource postgresql {

generator client {
provider = "prisma-client-js"
output = "node_modules/.prisma/client"
}

model Role {
Expand Down
4 changes: 2 additions & 2 deletions packages/keystone-nextjs-auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
"next-auth": "^4.19.2"
},
"devDependencies": {
"@keystone-6/core": "4.0.1",
"@keystone-6/core": "5.0.0",
"react": "^18.2.0"
},
"peerDependencies": {
"@keystone-6/core": "4.0.1",
"@keystone-6/core": "5.0.0",
"react": "^18.2.0"
},
"publishConfig": {
Expand Down
4 changes: 2 additions & 2 deletions packages/keystone-nextjs-auth/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ export function createAuth<GeneratedListTypes extends BaseListTypeInfo>({
*/
const authMiddleware: AdminUIConfig<BaseKeystoneTypeInfo>['pageMiddleware'] = async ({
context,
isValidSession,
wasAccessAllowed,
}) => {
const { req, session } = context;
const pathname = url.parse(req?.url!).pathname!;

if (isValidSession) {
if (wasAccessAllowed) {
if (customPath !== '' && pathname === '/') {
return { kind: 'redirect', to: `${customPath}` };
}
Expand Down
Loading

0 comments on commit ec29144

Please sign in to comment.