@opensaas/keystone-nextjs-auth 18.0.1 → 19.0.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 +6 -0
- package/dist/declarations/src/gql/getBaseAuthSchema.d.ts +3 -3
- package/dist/declarations/src/index.d.ts +1 -1
- package/dist/declarations/src/lib/validateNextAuth.d.ts +1 -1
- package/dist/declarations/src/pages/NextAuthPage.d.ts +1 -1
- package/dist/declarations/src/schema.d.ts +1 -1
- package/dist/declarations/src/types.d.ts +2 -2
- package/dist/opensaas-keystone-nextjs-auth.cjs.dev.js +7 -7
- package/dist/opensaas-keystone-nextjs-auth.cjs.prod.js +7 -7
- package/dist/opensaas-keystone-nextjs-auth.esm.js +4 -4
- package/package.json +6 -7
- package/src/gql/getBaseAuthSchema.ts +3 -3
- package/src/gql/getInitFirstItemSchema.ts +1 -1
- package/src/index.ts +1 -1
- package/src/lib/validateNextAuth.ts +1 -1
- package/src/pages/NextAuthPage.tsx +1 -1
- package/src/schema.ts +2 -2
- package/src/templates/next-config.ts +3 -3
- package/src/types.ts +2 -5
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import type {
|
2
|
-
import { graphql } from '@keystone-
|
1
|
+
import type { BaseItem } from '@keystone-6/core/types';
|
2
|
+
import { graphql } from '@keystone-6/core';
|
3
3
|
import { AuthGqlNames } from '../types';
|
4
4
|
export declare function getBaseAuthSchema({ listKey, gqlNames, base, }: {
|
5
5
|
listKey: string;
|
@@ -8,7 +8,7 @@ export declare function getBaseAuthSchema({ listKey, gqlNames, base, }: {
|
|
8
8
|
}): {
|
9
9
|
extension: {
|
10
10
|
query: {
|
11
|
-
authenticatedItem: import("@graphql-ts/schema").Field<unknown, {}, import("@graphql-ts/schema").UnionType<
|
11
|
+
authenticatedItem: import("@graphql-ts/schema").Field<unknown, {}, import("@graphql-ts/schema").UnionType<BaseItem, graphql.Context>, string, graphql.Context>;
|
12
12
|
};
|
13
13
|
};
|
14
14
|
};
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { BaseGeneratedListTypes, KeystoneConfig } from '@keystone-
|
1
|
+
import { BaseGeneratedListTypes, KeystoneConfig } from '@keystone-6/core/types';
|
2
2
|
import { AuthConfig, KeystoneAuthConfig } from './types';
|
3
3
|
export declare const nextAuthProviders: import("next-auth/providers").BuiltInProviders;
|
4
4
|
/**
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import type { KeystoneListsAPI } from '@keystone-
|
1
|
+
import type { KeystoneListsAPI } from '@keystone-6/core/types';
|
2
2
|
import { NextAuthErrorCode } from '../types';
|
3
3
|
export declare function validateNextAuth(list: any, identityField: string, identity: string | number, protectIdentities: boolean, itemAPI: KeystoneListsAPI<any>[string]): Promise<{
|
4
4
|
success: false;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Provider } from 'next-auth/providers';
|
2
|
-
import type { KeystoneListsAPI } from '@keystone-
|
2
|
+
import type { KeystoneListsAPI } from '@keystone-6/core/types';
|
3
3
|
declare type NextAuthPageProps = {
|
4
4
|
identityField: string;
|
5
5
|
mutationName: string;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { ExtendGraphqlSchema } from '@keystone-
|
1
|
+
import { ExtendGraphqlSchema } from '@keystone-6/core/types';
|
2
2
|
import { AuthGqlNames } from './types';
|
3
3
|
export declare const getSchemaExtension: ({ identityField, listKey, gqlNames, }: {
|
4
4
|
identityField: string;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { BaseListTypeInfo, KeystoneConfig } from '@keystone-6/core/types';
|
2
2
|
import { Provider } from 'next-auth/providers';
|
3
3
|
export declare type AuthGqlNames = {
|
4
4
|
CreateInitialInput: string;
|
@@ -18,7 +18,7 @@ declare type KeytoneAuthProviders = {
|
|
18
18
|
providers: NextAuthProviders;
|
19
19
|
};
|
20
20
|
export declare type KeystoneAuthConfig = KeystoneConfig & KeytoneAuthProviders;
|
21
|
-
export declare type AuthConfig<GeneratedListTypes extends
|
21
|
+
export declare type AuthConfig<GeneratedListTypes extends BaseListTypeInfo> = {
|
22
22
|
/** The key of the list to authenticate users with */
|
23
23
|
listKey: GeneratedListTypes['key'];
|
24
24
|
/** The path of the field the identity is stored in; must be text-ish */
|
@@ -15,7 +15,7 @@ var cookie = require('cookie');
|
|
15
15
|
var ejs = require('ejs');
|
16
16
|
var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
|
17
17
|
var graphql = require('graphql');
|
18
|
-
var
|
18
|
+
var core = require('@keystone-6/core');
|
19
19
|
|
20
20
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
21
21
|
|
@@ -64,14 +64,14 @@ module.exports = withPreconstruct({
|
|
64
64
|
...config.resolve.alias,
|
65
65
|
react: Path.dirname(require.resolve('react/package.json')),
|
66
66
|
'react-dom': Path.dirname(require.resolve('react-dom/package.json')),
|
67
|
-
'@keystone-
|
68
|
-
require.resolve('@keystone-
|
67
|
+
'@keystone-6/core': Path.dirname(
|
68
|
+
require.resolve('@keystone-6/core/package.json')
|
69
69
|
),
|
70
70
|
};
|
71
71
|
if (isServer) {
|
72
72
|
config.externals = [
|
73
73
|
...config.externals,
|
74
|
-
/@keystone-
|
74
|
+
/@keystone-6\\/core(?!\\/___internal-do-not-use-will-break-in-patch\\/admin-ui\\/id-field-view|\\/fields\\/types\\/[^\\/]+\\/views)/,
|
75
75
|
/.prisma\\/client/
|
76
76
|
];
|
77
77
|
// we need to set these to true so that when __dirname/__filename is used
|
@@ -116,8 +116,8 @@ function getBaseAuthSchema({
|
|
116
116
|
}) {
|
117
117
|
const extension = {
|
118
118
|
query: {
|
119
|
-
authenticatedItem:
|
120
|
-
type:
|
119
|
+
authenticatedItem: core.graphql.field({
|
120
|
+
type: core.graphql.union({
|
121
121
|
name: 'AuthenticatedItem',
|
122
122
|
types: [base.object(listKey)],
|
123
123
|
resolveType: (root, context) => {
|
@@ -154,7 +154,7 @@ const getSchemaExtension = ({
|
|
154
154
|
identityField,
|
155
155
|
listKey,
|
156
156
|
gqlNames
|
157
|
-
}) =>
|
157
|
+
}) => core.graphql.extend(base => {
|
158
158
|
var _context;
|
159
159
|
|
160
160
|
const uniqueWhereInputType = graphql.assertInputObjectType(base.schema.getType(`${listKey}WhereUniqueInput`));
|
@@ -15,7 +15,7 @@ var cookie = require('cookie');
|
|
15
15
|
var ejs = require('ejs');
|
16
16
|
var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
|
17
17
|
var graphql = require('graphql');
|
18
|
-
var
|
18
|
+
var core = require('@keystone-6/core');
|
19
19
|
|
20
20
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
21
21
|
|
@@ -64,14 +64,14 @@ module.exports = withPreconstruct({
|
|
64
64
|
...config.resolve.alias,
|
65
65
|
react: Path.dirname(require.resolve('react/package.json')),
|
66
66
|
'react-dom': Path.dirname(require.resolve('react-dom/package.json')),
|
67
|
-
'@keystone-
|
68
|
-
require.resolve('@keystone-
|
67
|
+
'@keystone-6/core': Path.dirname(
|
68
|
+
require.resolve('@keystone-6/core/package.json')
|
69
69
|
),
|
70
70
|
};
|
71
71
|
if (isServer) {
|
72
72
|
config.externals = [
|
73
73
|
...config.externals,
|
74
|
-
/@keystone-
|
74
|
+
/@keystone-6\\/core(?!\\/___internal-do-not-use-will-break-in-patch\\/admin-ui\\/id-field-view|\\/fields\\/types\\/[^\\/]+\\/views)/,
|
75
75
|
/.prisma\\/client/
|
76
76
|
];
|
77
77
|
// we need to set these to true so that when __dirname/__filename is used
|
@@ -116,8 +116,8 @@ function getBaseAuthSchema({
|
|
116
116
|
}) {
|
117
117
|
const extension = {
|
118
118
|
query: {
|
119
|
-
authenticatedItem:
|
120
|
-
type:
|
119
|
+
authenticatedItem: core.graphql.field({
|
120
|
+
type: core.graphql.union({
|
121
121
|
name: 'AuthenticatedItem',
|
122
122
|
types: [base.object(listKey)],
|
123
123
|
resolveType: (root, context) => {
|
@@ -154,7 +154,7 @@ const getSchemaExtension = ({
|
|
154
154
|
identityField,
|
155
155
|
listKey,
|
156
156
|
gqlNames
|
157
|
-
}) =>
|
157
|
+
}) => core.graphql.extend(base => {
|
158
158
|
var _context;
|
159
159
|
|
160
160
|
const uniqueWhereInputType = graphql.assertInputObjectType(base.schema.getType(`${listKey}WhereUniqueInput`));
|
@@ -11,7 +11,7 @@ import * as cookie from 'cookie';
|
|
11
11
|
import ejs from 'ejs';
|
12
12
|
import _filterInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/filter';
|
13
13
|
import { assertInputObjectType, GraphQLString, GraphQLID } from 'graphql';
|
14
|
-
import { graphql } from '@keystone-
|
14
|
+
import { graphql } from '@keystone-6/core';
|
15
15
|
|
16
16
|
const template$1 = `
|
17
17
|
const Path = require('path');
|
@@ -30,14 +30,14 @@ module.exports = withPreconstruct({
|
|
30
30
|
...config.resolve.alias,
|
31
31
|
react: Path.dirname(require.resolve('react/package.json')),
|
32
32
|
'react-dom': Path.dirname(require.resolve('react-dom/package.json')),
|
33
|
-
'@keystone-
|
34
|
-
require.resolve('@keystone-
|
33
|
+
'@keystone-6/core': Path.dirname(
|
34
|
+
require.resolve('@keystone-6/core/package.json')
|
35
35
|
),
|
36
36
|
};
|
37
37
|
if (isServer) {
|
38
38
|
config.externals = [
|
39
39
|
...config.externals,
|
40
|
-
/@keystone-
|
40
|
+
/@keystone-6\\/core(?!\\/___internal-do-not-use-will-break-in-patch\\/admin-ui\\/id-field-view|\\/fields\\/types\\/[^\\/]+\\/views)/,
|
41
41
|
/.prisma\\/client/
|
42
42
|
];
|
43
43
|
// we need to set these to true so that when __dirname/__filename is used
|
package/package.json
CHANGED
@@ -1,28 +1,27 @@
|
|
1
1
|
{
|
2
2
|
"name": "@opensaas/keystone-nextjs-auth",
|
3
|
-
"version": "
|
3
|
+
"version": "19.0.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",
|
7
7
|
"module": "dist/opensaas-keystone-nextjs-auth.esm.js",
|
8
8
|
"dependencies": {
|
9
|
-
"@babel/runtime": "^7.
|
10
|
-
"@babel/runtime-corejs3": "^7.
|
11
|
-
"@keystone-next/admin-ui-utils": "^6.0.0",
|
9
|
+
"@babel/runtime": "^7.16.3",
|
10
|
+
"@babel/runtime-corejs3": "^7.16.3",
|
12
11
|
"@types/ejs": "^3.1.0",
|
13
12
|
"cookie": "^0.4.1",
|
14
13
|
"cross-fetch": "^3.1.4",
|
15
14
|
"ejs": "^3.1.6",
|
16
15
|
"fast-deep-equal": "^3.1.3",
|
17
|
-
"graphql": "^15.
|
16
|
+
"graphql": "^15.7.2",
|
18
17
|
"next-auth": "^3.29.0"
|
19
18
|
},
|
20
19
|
"devDependencies": {
|
21
|
-
"@keystone-
|
20
|
+
"@keystone-6/core": "^1.0.0",
|
22
21
|
"react": "^17.0.2"
|
23
22
|
},
|
24
23
|
"peerDependencies": {
|
25
|
-
"@keystone-
|
24
|
+
"@keystone-6/core": "^1.0.0",
|
26
25
|
"react": "^17.0.2"
|
27
26
|
},
|
28
27
|
"engines": {
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import type {
|
2
|
-
import { graphql } from '@keystone-
|
1
|
+
import type { BaseItem } from '@keystone-6/core/types';
|
2
|
+
import { graphql } from '@keystone-6/core';
|
3
3
|
|
4
4
|
import { AuthGqlNames } from '../types';
|
5
5
|
|
@@ -17,7 +17,7 @@ export function getBaseAuthSchema({
|
|
17
17
|
authenticatedItem: graphql.field({
|
18
18
|
type: graphql.union({
|
19
19
|
name: 'AuthenticatedItem',
|
20
|
-
types: [base.object(listKey) as graphql.ObjectType<
|
20
|
+
types: [base.object(listKey) as graphql.ObjectType<BaseItem>],
|
21
21
|
resolveType: (root, context) => context.session?.listKey,
|
22
22
|
}),
|
23
23
|
resolve(root, args, { session, db }) {
|
package/src/index.ts
CHANGED
@@ -6,7 +6,7 @@ import {
|
|
6
6
|
KeystoneContext,
|
7
7
|
AdminUIConfig,
|
8
8
|
SessionStrategy,
|
9
|
-
} from '@keystone-
|
9
|
+
} from '@keystone-6/core/types';
|
10
10
|
import { getSession } from 'next-auth/client';
|
11
11
|
import Providers from 'next-auth/providers';
|
12
12
|
import * as cookie from 'cookie';
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import NextAuth from 'next-auth';
|
2
2
|
import { Provider } from 'next-auth/providers';
|
3
|
-
import type { KeystoneListsAPI } from '@keystone-
|
3
|
+
import type { KeystoneListsAPI } from '@keystone-6/core/types';
|
4
4
|
import { validateNextAuth } from '../lib/validateNextAuth';
|
5
5
|
|
6
6
|
// Need to bring in correct props
|
package/src/schema.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
import { ExtendGraphqlSchema } from '@keystone-
|
1
|
+
import { ExtendGraphqlSchema } from '@keystone-6/core/types';
|
2
2
|
|
3
3
|
import { assertInputObjectType, GraphQLString, GraphQLID } from 'graphql';
|
4
|
-
import { graphql } from '@keystone-
|
4
|
+
import { graphql } from '@keystone-6/core';
|
5
5
|
import { AuthGqlNames } from './types';
|
6
6
|
import { getBaseAuthSchema } from './gql/getBaseAuthSchema';
|
7
7
|
|
@@ -17,14 +17,14 @@ module.exports = withPreconstruct({
|
|
17
17
|
...config.resolve.alias,
|
18
18
|
react: Path.dirname(require.resolve('react/package.json')),
|
19
19
|
'react-dom': Path.dirname(require.resolve('react-dom/package.json')),
|
20
|
-
'@keystone-
|
21
|
-
require.resolve('@keystone-
|
20
|
+
'@keystone-6/core': Path.dirname(
|
21
|
+
require.resolve('@keystone-6/core/package.json')
|
22
22
|
),
|
23
23
|
};
|
24
24
|
if (isServer) {
|
25
25
|
config.externals = [
|
26
26
|
...config.externals,
|
27
|
-
/@keystone-
|
27
|
+
/@keystone-6\\/core(?!\\/___internal-do-not-use-will-break-in-patch\\/admin-ui\\/id-field-view|\\/fields\\/types\\/[^\\/]+\\/views)/,
|
28
28
|
/.prisma\\/client/
|
29
29
|
];
|
30
30
|
// we need to set these to true so that when __dirname/__filename is used
|
package/src/types.ts
CHANGED
@@ -1,7 +1,4 @@
|
|
1
|
-
import {
|
2
|
-
BaseGeneratedListTypes,
|
3
|
-
KeystoneConfig,
|
4
|
-
} from '@keystone-next/keystone/types';
|
1
|
+
import { BaseListTypeInfo, KeystoneConfig } from '@keystone-6/core/types';
|
5
2
|
import { Provider } from 'next-auth/providers';
|
6
3
|
|
7
4
|
export type AuthGqlNames = {
|
@@ -23,7 +20,7 @@ type KeytoneAuthProviders = {
|
|
23
20
|
|
24
21
|
export type KeystoneAuthConfig = KeystoneConfig & KeytoneAuthProviders;
|
25
22
|
|
26
|
-
export type AuthConfig<GeneratedListTypes extends
|
23
|
+
export type AuthConfig<GeneratedListTypes extends BaseListTypeInfo> = {
|
27
24
|
/** The key of the list to authenticate users with */
|
28
25
|
listKey: GeneratedListTypes['key'];
|
29
26
|
/** The path of the field the identity is stored in; must be text-ish */
|