@opensaas/keystone-nextjs-auth 24.0.0 → 24.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @opensaas-keystone/nextjs-auth
2
2
 
3
+ ## 24.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - ae15a2c: Update dependency @keystone-6/core to ^2.2.0
8
+ - b730bff: Update react monorepo (minor)
9
+
10
+ ### Patch Changes
11
+
12
+ - 0a7d339: Update patch dependencies (patch)
13
+ - 7d40c8b: Fix keystone `onConnect` running on next-auth initialisation
14
+
3
15
  ## 24.0.0
4
16
 
5
17
  ### Major Changes
@@ -101,19 +101,21 @@ module.exports = withPreconstruct({
101
101
  <% } %>
102
102
  });
103
103
  `;
104
- const nextConfigTemplate = ({
105
- keystonePath
106
- }) => {
104
+ const nextConfigTemplate = _ref => {
105
+ let {
106
+ keystonePath
107
+ } = _ref;
107
108
  const nextConfigOut = ejs__default["default"].render(template$1, {
108
109
  keystonePath
109
110
  });
110
111
  return nextConfigOut;
111
112
  };
112
113
 
113
- function getBaseAuthSchema({
114
- listKey,
115
- base
116
- }) {
114
+ function getBaseAuthSchema(_ref) {
115
+ let {
116
+ listKey,
117
+ base
118
+ } = _ref;
117
119
  const extension = {
118
120
  query: {
119
121
  authenticatedItem: core.graphql.field({
@@ -127,10 +129,12 @@ function getBaseAuthSchema({
127
129
  }
128
130
  }),
129
131
 
130
- resolve(root, args, {
131
- session,
132
- db
133
- }) {
132
+ resolve(root, args, _ref2) {
133
+ let {
134
+ session,
135
+ db
136
+ } = _ref2;
137
+
134
138
  if (typeof (session === null || session === void 0 ? void 0 : session.itemId) === 'string' && typeof session.listKey === 'string') {
135
139
  return db[session.listKey].findOne({
136
140
  where: {
@@ -150,17 +154,20 @@ function getBaseAuthSchema({
150
154
  };
151
155
  }
152
156
 
153
- const getSchemaExtension = ({
154
- listKey
155
- }) => core.graphql.extend(base => {
156
- var _context;
157
+ const getSchemaExtension = _ref => {
158
+ let {
159
+ listKey
160
+ } = _ref;
161
+ return core.graphql.extend(base => {
162
+ var _context;
157
163
 
158
- const baseSchema = getBaseAuthSchema({
159
- listKey,
160
- base
164
+ const baseSchema = getBaseAuthSchema({
165
+ listKey,
166
+ base
167
+ });
168
+ return _filterInstanceProperty__default["default"](_context = [baseSchema.extension]).call(_context, x => x !== undefined);
161
169
  });
162
- return _filterInstanceProperty__default["default"](_context = [baseSchema.extension]).call(_context, x => x !== undefined);
163
- });
170
+ };
164
171
 
165
172
  const template = `
166
173
  import getNextAuthPage from '@opensaas/keystone-nextjs-auth/pages/NextAuthPage';
@@ -168,7 +175,16 @@ import keystoneConfig from '../../../../../keystone';
168
175
  import { PrismaClient } from '.prisma/client';
169
176
  import { createQueryAPI } from '@keystone-6/core/___internal-do-not-use-will-break-in-patch/node-api';
170
177
 
171
- const keystoneQueryAPI = global.keystoneQueryAPI || createQueryAPI(keystoneConfig, PrismaClient);
178
+ const cleanConfig = (config) => {
179
+ const { db, ...rest } = config;
180
+ if (db) {
181
+ const { onConnect, ...restDB } = db;
182
+ return { ...rest, db: restDB };
183
+ }
184
+ return rest;
185
+ };
186
+
187
+ const keystoneQueryAPI = global.keystoneQueryAPI || createQueryAPI(cleanConfig(keystoneConfig), PrismaClient);
172
188
 
173
189
  if (process.env.NODE_ENV !== 'production') globalThis.keystoneQueryAPI = keystoneQueryAPI
174
190
 
@@ -184,13 +200,14 @@ export default getNextAuthPage({
184
200
  sessionSecret: '<%= sessionSecret %>',
185
201
  });
186
202
  `;
187
- const authTemplate = ({
188
- autoCreate,
189
- identityField,
190
- listKey,
191
- sessionData,
192
- sessionSecret
193
- }) => {
203
+ const authTemplate = _ref => {
204
+ let {
205
+ autoCreate,
206
+ identityField,
207
+ listKey,
208
+ sessionData,
209
+ sessionSecret
210
+ } = _ref;
194
211
  const authOut = ejs__default["default"].render(template, {
195
212
  identityField,
196
213
  sessionData,
@@ -208,18 +225,19 @@ const _excluded = ["get", "end"];
208
225
  * Generates config for Keystone to implement standard auth features.
209
226
  */
210
227
 
211
- function createAuth({
212
- autoCreate,
213
- cookies,
214
- identityField,
215
- listKey,
216
- keystonePath,
217
- pages,
218
- resolver,
219
- providers,
220
- sessionData,
221
- sessionSecret
222
- }) {
228
+ function createAuth(_ref) {
229
+ let {
230
+ autoCreate,
231
+ cookies,
232
+ identityField,
233
+ listKey,
234
+ keystonePath,
235
+ pages,
236
+ resolver,
237
+ providers,
238
+ sessionData,
239
+ sessionSecret
240
+ } = _ref;
223
241
  // The protectIdentities flag is currently under review to see whether it should be
224
242
  // part of the createAuth API (in which case its use cases need to be documented and tested)
225
243
  // or whether always being true is what we want, in which case we can refactor our code
@@ -236,10 +254,11 @@ function createAuth({
236
254
  * - to the signin page when no valid session is present
237
255
  */
238
256
 
239
- const pageMiddleware = async ({
240
- context,
241
- isValidSession
242
- }) => {
257
+ const pageMiddleware = async _ref2 => {
258
+ let {
259
+ context,
260
+ isValidSession
261
+ } = _ref2;
243
262
  const {
244
263
  req,
245
264
  session
@@ -380,12 +399,13 @@ function createAuth({
380
399
  sessionStrategy = _objectWithoutProperties(_sessionStrategy, _excluded);
381
400
 
382
401
  return _objectSpread(_objectSpread({}, sessionStrategy), {}, {
383
- get: async ({
384
- req,
385
- createContext
386
- }) => {
402
+ get: async _ref3 => {
387
403
  var _req$headers, _req$headers$authoriz;
388
404
 
405
+ let {
406
+ req,
407
+ createContext
408
+ } = _ref3;
389
409
  const pathname = url__default["default"].parse(req === null || req === void 0 ? void 0 : req.url).pathname;
390
410
  let nextSession;
391
411
 
@@ -428,11 +448,12 @@ function createAuth({
428
448
  itemId: nextSession.itemId
429
449
  });
430
450
  },
431
- end: async ({
432
- res,
433
- req,
434
- createContext
435
- }) => {
451
+ end: async _ref4 => {
452
+ let {
453
+ res,
454
+ req,
455
+ createContext
456
+ } = _ref4;
436
457
  await end({
437
458
  res,
438
459
  req,
@@ -100,19 +100,21 @@ module.exports = withPreconstruct({
100
100
  <% } %>
101
101
  });
102
102
  `;
103
- const nextConfigTemplate = ({
104
- keystonePath
105
- }) => {
103
+ const nextConfigTemplate = _ref => {
104
+ let {
105
+ keystonePath
106
+ } = _ref;
106
107
  const nextConfigOut = ejs__default["default"].render(template$1, {
107
108
  keystonePath
108
109
  });
109
110
  return nextConfigOut;
110
111
  };
111
112
 
112
- function getBaseAuthSchema({
113
- listKey,
114
- base
115
- }) {
113
+ function getBaseAuthSchema(_ref) {
114
+ let {
115
+ listKey,
116
+ base
117
+ } = _ref;
116
118
  const extension = {
117
119
  query: {
118
120
  authenticatedItem: core.graphql.field({
@@ -126,10 +128,12 @@ function getBaseAuthSchema({
126
128
  }
127
129
  }),
128
130
 
129
- resolve(root, args, {
130
- session,
131
- db
132
- }) {
131
+ resolve(root, args, _ref2) {
132
+ let {
133
+ session,
134
+ db
135
+ } = _ref2;
136
+
133
137
  if (typeof (session === null || session === void 0 ? void 0 : session.itemId) === 'string' && typeof session.listKey === 'string') {
134
138
  return db[session.listKey].findOne({
135
139
  where: {
@@ -149,17 +153,20 @@ function getBaseAuthSchema({
149
153
  };
150
154
  }
151
155
 
152
- const getSchemaExtension = ({
153
- listKey
154
- }) => core.graphql.extend(base => {
155
- var _context;
156
+ const getSchemaExtension = _ref => {
157
+ let {
158
+ listKey
159
+ } = _ref;
160
+ return core.graphql.extend(base => {
161
+ var _context;
156
162
 
157
- const baseSchema = getBaseAuthSchema({
158
- listKey,
159
- base
163
+ const baseSchema = getBaseAuthSchema({
164
+ listKey,
165
+ base
166
+ });
167
+ return _filterInstanceProperty__default["default"](_context = [baseSchema.extension]).call(_context, x => x !== undefined);
160
168
  });
161
- return _filterInstanceProperty__default["default"](_context = [baseSchema.extension]).call(_context, x => x !== undefined);
162
- });
169
+ };
163
170
 
164
171
  const template = `
165
172
  import getNextAuthPage from '@opensaas/keystone-nextjs-auth/pages/NextAuthPage';
@@ -167,7 +174,16 @@ import keystoneConfig from '../../../../../keystone';
167
174
  import { PrismaClient } from '.prisma/client';
168
175
  import { createQueryAPI } from '@keystone-6/core/___internal-do-not-use-will-break-in-patch/node-api';
169
176
 
170
- const keystoneQueryAPI = global.keystoneQueryAPI || createQueryAPI(keystoneConfig, PrismaClient);
177
+ const cleanConfig = (config) => {
178
+ const { db, ...rest } = config;
179
+ if (db) {
180
+ const { onConnect, ...restDB } = db;
181
+ return { ...rest, db: restDB };
182
+ }
183
+ return rest;
184
+ };
185
+
186
+ const keystoneQueryAPI = global.keystoneQueryAPI || createQueryAPI(cleanConfig(keystoneConfig), PrismaClient);
171
187
 
172
188
  if (process.env.NODE_ENV !== 'production') globalThis.keystoneQueryAPI = keystoneQueryAPI
173
189
 
@@ -183,13 +199,14 @@ export default getNextAuthPage({
183
199
  sessionSecret: '<%= sessionSecret %>',
184
200
  });
185
201
  `;
186
- const authTemplate = ({
187
- autoCreate,
188
- identityField,
189
- listKey,
190
- sessionData,
191
- sessionSecret
192
- }) => {
202
+ const authTemplate = _ref => {
203
+ let {
204
+ autoCreate,
205
+ identityField,
206
+ listKey,
207
+ sessionData,
208
+ sessionSecret
209
+ } = _ref;
193
210
  const authOut = ejs__default["default"].render(template, {
194
211
  identityField,
195
212
  sessionData,
@@ -207,18 +224,19 @@ const _excluded = ["get", "end"];
207
224
  * Generates config for Keystone to implement standard auth features.
208
225
  */
209
226
 
210
- function createAuth({
211
- autoCreate,
212
- cookies,
213
- identityField,
214
- listKey,
215
- keystonePath,
216
- pages,
217
- resolver,
218
- providers,
219
- sessionData,
220
- sessionSecret
221
- }) {
227
+ function createAuth(_ref) {
228
+ let {
229
+ autoCreate,
230
+ cookies,
231
+ identityField,
232
+ listKey,
233
+ keystonePath,
234
+ pages,
235
+ resolver,
236
+ providers,
237
+ sessionData,
238
+ sessionSecret
239
+ } = _ref;
222
240
  // The protectIdentities flag is currently under review to see whether it should be
223
241
  // part of the createAuth API (in which case its use cases need to be documented and tested)
224
242
  // or whether always being true is what we want, in which case we can refactor our code
@@ -235,10 +253,11 @@ function createAuth({
235
253
  * - to the signin page when no valid session is present
236
254
  */
237
255
 
238
- const pageMiddleware = async ({
239
- context,
240
- isValidSession
241
- }) => {
256
+ const pageMiddleware = async _ref2 => {
257
+ let {
258
+ context,
259
+ isValidSession
260
+ } = _ref2;
242
261
  const {
243
262
  req,
244
263
  session
@@ -379,12 +398,13 @@ function createAuth({
379
398
  sessionStrategy = _objectWithoutProperties(_sessionStrategy, _excluded);
380
399
 
381
400
  return _objectSpread(_objectSpread({}, sessionStrategy), {}, {
382
- get: async ({
383
- req,
384
- createContext
385
- }) => {
401
+ get: async _ref3 => {
386
402
  var _req$headers, _req$headers$authoriz;
387
403
 
404
+ let {
405
+ req,
406
+ createContext
407
+ } = _ref3;
388
408
  const pathname = url__default["default"].parse(req === null || req === void 0 ? void 0 : req.url).pathname;
389
409
  let nextSession;
390
410
 
@@ -427,11 +447,12 @@ function createAuth({
427
447
  itemId: nextSession.itemId
428
448
  });
429
449
  },
430
- end: async ({
431
- res,
432
- req,
433
- createContext
434
- }) => {
450
+ end: async _ref4 => {
451
+ let {
452
+ res,
453
+ req,
454
+ createContext
455
+ } = _ref4;
435
456
  await end({
436
457
  res,
437
458
  req,
@@ -68,19 +68,21 @@ module.exports = withPreconstruct({
68
68
  <% } %>
69
69
  });
70
70
  `;
71
- const nextConfigTemplate = ({
72
- keystonePath
73
- }) => {
71
+ const nextConfigTemplate = _ref => {
72
+ let {
73
+ keystonePath
74
+ } = _ref;
74
75
  const nextConfigOut = ejs.render(template$1, {
75
76
  keystonePath
76
77
  });
77
78
  return nextConfigOut;
78
79
  };
79
80
 
80
- function getBaseAuthSchema({
81
- listKey,
82
- base
83
- }) {
81
+ function getBaseAuthSchema(_ref) {
82
+ let {
83
+ listKey,
84
+ base
85
+ } = _ref;
84
86
  const extension = {
85
87
  query: {
86
88
  authenticatedItem: graphql.field({
@@ -94,10 +96,12 @@ function getBaseAuthSchema({
94
96
  }
95
97
  }),
96
98
 
97
- resolve(root, args, {
98
- session,
99
- db
100
- }) {
99
+ resolve(root, args, _ref2) {
100
+ let {
101
+ session,
102
+ db
103
+ } = _ref2;
104
+
101
105
  if (typeof (session === null || session === void 0 ? void 0 : session.itemId) === 'string' && typeof session.listKey === 'string') {
102
106
  return db[session.listKey].findOne({
103
107
  where: {
@@ -117,17 +121,20 @@ function getBaseAuthSchema({
117
121
  };
118
122
  }
119
123
 
120
- const getSchemaExtension = ({
121
- listKey
122
- }) => graphql.extend(base => {
123
- var _context;
124
+ const getSchemaExtension = _ref => {
125
+ let {
126
+ listKey
127
+ } = _ref;
128
+ return graphql.extend(base => {
129
+ var _context;
124
130
 
125
- const baseSchema = getBaseAuthSchema({
126
- listKey,
127
- base
131
+ const baseSchema = getBaseAuthSchema({
132
+ listKey,
133
+ base
134
+ });
135
+ return _filterInstanceProperty(_context = [baseSchema.extension]).call(_context, x => x !== undefined);
128
136
  });
129
- return _filterInstanceProperty(_context = [baseSchema.extension]).call(_context, x => x !== undefined);
130
- });
137
+ };
131
138
 
132
139
  const template = `
133
140
  import getNextAuthPage from '@opensaas/keystone-nextjs-auth/pages/NextAuthPage';
@@ -135,7 +142,16 @@ import keystoneConfig from '../../../../../keystone';
135
142
  import { PrismaClient } from '.prisma/client';
136
143
  import { createQueryAPI } from '@keystone-6/core/___internal-do-not-use-will-break-in-patch/node-api';
137
144
 
138
- const keystoneQueryAPI = global.keystoneQueryAPI || createQueryAPI(keystoneConfig, PrismaClient);
145
+ const cleanConfig = (config) => {
146
+ const { db, ...rest } = config;
147
+ if (db) {
148
+ const { onConnect, ...restDB } = db;
149
+ return { ...rest, db: restDB };
150
+ }
151
+ return rest;
152
+ };
153
+
154
+ const keystoneQueryAPI = global.keystoneQueryAPI || createQueryAPI(cleanConfig(keystoneConfig), PrismaClient);
139
155
 
140
156
  if (process.env.NODE_ENV !== 'production') globalThis.keystoneQueryAPI = keystoneQueryAPI
141
157
 
@@ -151,13 +167,14 @@ export default getNextAuthPage({
151
167
  sessionSecret: '<%= sessionSecret %>',
152
168
  });
153
169
  `;
154
- const authTemplate = ({
155
- autoCreate,
156
- identityField,
157
- listKey,
158
- sessionData,
159
- sessionSecret
160
- }) => {
170
+ const authTemplate = _ref => {
171
+ let {
172
+ autoCreate,
173
+ identityField,
174
+ listKey,
175
+ sessionData,
176
+ sessionSecret
177
+ } = _ref;
161
178
  const authOut = ejs.render(template, {
162
179
  identityField,
163
180
  sessionData,
@@ -175,18 +192,19 @@ const _excluded = ["get", "end"];
175
192
  * Generates config for Keystone to implement standard auth features.
176
193
  */
177
194
 
178
- function createAuth({
179
- autoCreate,
180
- cookies,
181
- identityField,
182
- listKey,
183
- keystonePath,
184
- pages,
185
- resolver,
186
- providers,
187
- sessionData,
188
- sessionSecret
189
- }) {
195
+ function createAuth(_ref) {
196
+ let {
197
+ autoCreate,
198
+ cookies,
199
+ identityField,
200
+ listKey,
201
+ keystonePath,
202
+ pages,
203
+ resolver,
204
+ providers,
205
+ sessionData,
206
+ sessionSecret
207
+ } = _ref;
190
208
  // The protectIdentities flag is currently under review to see whether it should be
191
209
  // part of the createAuth API (in which case its use cases need to be documented and tested)
192
210
  // or whether always being true is what we want, in which case we can refactor our code
@@ -203,10 +221,11 @@ function createAuth({
203
221
  * - to the signin page when no valid session is present
204
222
  */
205
223
 
206
- const pageMiddleware = async ({
207
- context,
208
- isValidSession
209
- }) => {
224
+ const pageMiddleware = async _ref2 => {
225
+ let {
226
+ context,
227
+ isValidSession
228
+ } = _ref2;
210
229
  const {
211
230
  req,
212
231
  session
@@ -347,12 +366,13 @@ function createAuth({
347
366
  sessionStrategy = _objectWithoutProperties(_sessionStrategy, _excluded);
348
367
 
349
368
  return _objectSpread(_objectSpread({}, sessionStrategy), {}, {
350
- get: async ({
351
- req,
352
- createContext
353
- }) => {
369
+ get: async _ref3 => {
354
370
  var _req$headers, _req$headers$authoriz;
355
371
 
372
+ let {
373
+ req,
374
+ createContext
375
+ } = _ref3;
356
376
  const pathname = url.parse(req === null || req === void 0 ? void 0 : req.url).pathname;
357
377
  let nextSession;
358
378
 
@@ -395,11 +415,12 @@ function createAuth({
395
415
  itemId: nextSession.itemId
396
416
  });
397
417
  },
398
- end: async ({
399
- res,
400
- req,
401
- createContext
402
- }) => {
418
+ end: async _ref4 => {
419
+ let {
420
+ res,
421
+ req,
422
+ createContext
423
+ } = _ref4;
403
424
  await end({
404
425
  res,
405
426
  req,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opensaas/keystone-nextjs-auth",
3
- "version": "24.0.0",
3
+ "version": "24.1.0",
4
4
  "repository": "https://github.com/opensaasau/keystone-nextjs-auth",
5
5
  "license": "MIT",
6
6
  "main": "dist/opensaas-keystone-nextjs-auth.cjs.js",
@@ -13,15 +13,15 @@
13
13
  "cross-fetch": "^3.1.5",
14
14
  "ejs": "^3.1.8",
15
15
  "fast-deep-equal": "^3.1.3",
16
- "next-auth": "^4.10.2"
16
+ "next-auth": "^4.10.3"
17
17
  },
18
18
  "devDependencies": {
19
- "@keystone-6/core": "^2.1.0",
20
- "react": "^18.1.0"
19
+ "@keystone-6/core": "^2.2.0",
20
+ "react": "^18.2.0"
21
21
  },
22
22
  "peerDependencies": {
23
- "@keystone-6/core": "^2.1.0",
24
- "react": "^18.1.0"
23
+ "@keystone-6/core": "^2.2.0",
24
+ "react": "^18.2.0"
25
25
  },
26
26
  "engines": {
27
27
  "node": "^14.13 || >= 16.13"
@@ -90,11 +90,12 @@ function NextAuthPage(props) {
90
90
  jwt: jwt || {},
91
91
  secret: sessionSecret,
92
92
  callbacks: {
93
- async signIn({
94
- user,
95
- account,
96
- profile
97
- }) {
93
+ async signIn(_ref) {
94
+ let {
95
+ user,
96
+ account,
97
+ profile
98
+ } = _ref;
98
99
  let identity;
99
100
 
100
101
  if (typeof user.id === 'string') {
@@ -152,16 +153,18 @@ function NextAuthPage(props) {
152
153
  return updateUser.success;
153
154
  },
154
155
 
155
- async redirect({
156
- url
157
- }) {
156
+ async redirect(_ref2) {
157
+ let {
158
+ url
159
+ } = _ref2;
158
160
  return url;
159
161
  },
160
162
 
161
- async session({
162
- session,
163
- token
164
- }) {
163
+ async session(_ref3) {
164
+ let {
165
+ session,
166
+ token
167
+ } = _ref3;
165
168
  let returnSession = session;
166
169
 
167
170
  if (!token.itemId) {
@@ -180,9 +183,10 @@ function NextAuthPage(props) {
180
183
  return returnSession;
181
184
  },
182
185
 
183
- async jwt({
184
- token
185
- }) {
186
+ async jwt(_ref4) {
187
+ let {
188
+ token
189
+ } = _ref4;
186
190
  const identity = token.sub;
187
191
  const result = await validateNextAuth(identityField, identity, protectIdentities, list);
188
192
 
@@ -90,11 +90,12 @@ function NextAuthPage(props) {
90
90
  jwt: jwt || {},
91
91
  secret: sessionSecret,
92
92
  callbacks: {
93
- async signIn({
94
- user,
95
- account,
96
- profile
97
- }) {
93
+ async signIn(_ref) {
94
+ let {
95
+ user,
96
+ account,
97
+ profile
98
+ } = _ref;
98
99
  let identity;
99
100
 
100
101
  if (typeof user.id === 'string') {
@@ -152,16 +153,18 @@ function NextAuthPage(props) {
152
153
  return updateUser.success;
153
154
  },
154
155
 
155
- async redirect({
156
- url
157
- }) {
156
+ async redirect(_ref2) {
157
+ let {
158
+ url
159
+ } = _ref2;
158
160
  return url;
159
161
  },
160
162
 
161
- async session({
162
- session,
163
- token
164
- }) {
163
+ async session(_ref3) {
164
+ let {
165
+ session,
166
+ token
167
+ } = _ref3;
165
168
  let returnSession = session;
166
169
 
167
170
  if (!token.itemId) {
@@ -180,9 +183,10 @@ function NextAuthPage(props) {
180
183
  return returnSession;
181
184
  },
182
185
 
183
- async jwt({
184
- token
185
- }) {
186
+ async jwt(_ref4) {
187
+ let {
188
+ token
189
+ } = _ref4;
186
190
  const identity = token.sub;
187
191
  const result = await validateNextAuth(identityField, identity, protectIdentities, list);
188
192
 
@@ -82,11 +82,12 @@ function NextAuthPage(props) {
82
82
  jwt: jwt || {},
83
83
  secret: sessionSecret,
84
84
  callbacks: {
85
- async signIn({
86
- user,
87
- account,
88
- profile
89
- }) {
85
+ async signIn(_ref) {
86
+ let {
87
+ user,
88
+ account,
89
+ profile
90
+ } = _ref;
90
91
  let identity;
91
92
 
92
93
  if (typeof user.id === 'string') {
@@ -144,16 +145,18 @@ function NextAuthPage(props) {
144
145
  return updateUser.success;
145
146
  },
146
147
 
147
- async redirect({
148
- url
149
- }) {
148
+ async redirect(_ref2) {
149
+ let {
150
+ url
151
+ } = _ref2;
150
152
  return url;
151
153
  },
152
154
 
153
- async session({
154
- session,
155
- token
156
- }) {
155
+ async session(_ref3) {
156
+ let {
157
+ session,
158
+ token
159
+ } = _ref3;
157
160
  let returnSession = session;
158
161
 
159
162
  if (!token.itemId) {
@@ -172,9 +175,10 @@ function NextAuthPage(props) {
172
175
  return returnSession;
173
176
  },
174
177
 
175
- async jwt({
176
- token
177
- }) {
178
+ async jwt(_ref4) {
179
+ let {
180
+ token
181
+ } = _ref4;
178
182
  const identity = token.sub;
179
183
  const result = await validateNextAuth(identityField, identity, protectIdentities, list);
180
184
 
@@ -7,7 +7,16 @@ import keystoneConfig from '../../../../../keystone';
7
7
  import { PrismaClient } from '.prisma/client';
8
8
  import { createQueryAPI } from '@keystone-6/core/___internal-do-not-use-will-break-in-patch/node-api';
9
9
 
10
- const keystoneQueryAPI = global.keystoneQueryAPI || createQueryAPI(keystoneConfig, PrismaClient);
10
+ const cleanConfig = (config) => {
11
+ const { db, ...rest } = config;
12
+ if (db) {
13
+ const { onConnect, ...restDB } = db;
14
+ return { ...rest, db: restDB };
15
+ }
16
+ return rest;
17
+ };
18
+
19
+ const keystoneQueryAPI = global.keystoneQueryAPI || createQueryAPI(cleanConfig(keystoneConfig), PrismaClient);
11
20
 
12
21
  if (process.env.NODE_ENV !== 'production') globalThis.keystoneQueryAPI = keystoneQueryAPI
13
22