@nixxie-cms/auth 1.0.1
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/LICENSE +21 -0
- package/README.md +6 -0
- package/components/Navigation/dist/nixxie-cms-auth-components-Navigation.cjs.d.ts +3 -0
- package/components/Navigation/dist/nixxie-cms-auth-components-Navigation.cjs.js +147 -0
- package/components/Navigation/dist/nixxie-cms-auth-components-Navigation.esm.js +143 -0
- package/components/Navigation/package.json +4 -0
- package/dist/declarations/src/components/Navigation.d.ts +6 -0
- package/dist/declarations/src/components/Navigation.d.ts.map +1 -0
- package/dist/declarations/src/index.d.ts +15 -0
- package/dist/declarations/src/index.d.ts.map +1 -0
- package/dist/declarations/src/pages/InitPage.d.ts +9 -0
- package/dist/declarations/src/pages/InitPage.d.ts.map +1 -0
- package/dist/declarations/src/pages/SigninPage.d.ts +9 -0
- package/dist/declarations/src/pages/SigninPage.d.ts.map +1 -0
- package/dist/declarations/src/types.d.ts +49 -0
- package/dist/declarations/src/types.d.ts.map +1 -0
- package/dist/nixxie-cms-auth.cjs.d.ts +2 -0
- package/dist/nixxie-cms-auth.cjs.js +552 -0
- package/dist/nixxie-cms-auth.esm.js +548 -0
- package/dist/useFromRedirect-2de239a9.cjs.js +26 -0
- package/dist/useFromRedirect-b3deee00.esm.js +24 -0
- package/package.json +56 -0
- package/pages/InitPage/dist/nixxie-cms-auth-pages-InitPage.cjs.d.ts +3 -0
- package/pages/InitPage/dist/nixxie-cms-auth-pages-InitPage.cjs.js +274 -0
- package/pages/InitPage/dist/nixxie-cms-auth-pages-InitPage.esm.js +266 -0
- package/pages/InitPage/package.json +4 -0
- package/pages/SigninPage/dist/nixxie-cms-auth-pages-SigninPage.cjs.d.ts +3 -0
- package/pages/SigninPage/dist/nixxie-cms-auth-pages-SigninPage.cjs.js +319 -0
- package/pages/SigninPage/dist/nixxie-cms-auth-pages-SigninPage.esm.js +311 -0
- package/pages/SigninPage/package.json +4 -0
- package/src/components/Navigation.tsx +182 -0
- package/src/gql/getBaseAuthSchema.ts +129 -0
- package/src/gql/getInitFirstItemSchema.ts +87 -0
- package/src/index.ts +291 -0
- package/src/lib/useFromRedirect.ts +23 -0
- package/src/pages/InitPage.tsx +292 -0
- package/src/pages/SigninPage.tsx +331 -0
- package/src/schema.ts +84 -0
- package/src/templates/config.ts +9 -0
- package/src/templates/init.ts +22 -0
- package/src/templates/signin.ts +20 -0
- package/src/types.ts +57 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Nixxie International DMCC
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# @nixxie/auth
|
|
2
|
+
|
|
3
|
+
Nixxie-6 is the latest version of Nixxie.
|
|
4
|
+
To get help with this package join the conversation in [Slack](https://community.nixxieinternational.com/), or [Github](https://github.com/nixxiecms/nixxie/).
|
|
5
|
+
|
|
6
|
+
Visit <https://nixxieinternational.com/> for docs, and [follow @nixxiecms on Twitter](https://twitter.com/nixxiecms) for the latest updates.
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export * from "../../../dist/declarations/src/components/Navigation.js";
|
|
2
|
+
export { default } from "../../../dist/declarations/src/components/Navigation.js";
|
|
3
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibml4eGllLWNtcy1hdXRoLWNvbXBvbmVudHMtTmF2aWdhdGlvbi5janMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL2Rpc3QvZGVjbGFyYXRpb25zL3NyYy9jb21wb25lbnRzL05hdmlnYXRpb24uZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSJ9
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var react = require('react');
|
|
6
|
+
var layout = require('@keystar/ui/layout');
|
|
7
|
+
var style = require('@keystar/ui/style');
|
|
8
|
+
var apollo = require('@nixxie-cms/core/admin-ui/apollo');
|
|
9
|
+
var components = require('@nixxie-cms/core/admin-ui/components');
|
|
10
|
+
var router = require('@nixxie-cms/core/admin-ui/router');
|
|
11
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
12
|
+
|
|
13
|
+
var Navigation = ({
|
|
14
|
+
labelField
|
|
15
|
+
}) => props => /*#__PURE__*/jsxRuntime.jsx(Navigation$1, {
|
|
16
|
+
labelField: labelField,
|
|
17
|
+
...props
|
|
18
|
+
});
|
|
19
|
+
function Navigation$1({
|
|
20
|
+
labelField,
|
|
21
|
+
lists
|
|
22
|
+
}) {
|
|
23
|
+
const {
|
|
24
|
+
data
|
|
25
|
+
} = apollo.useQuery(react.useMemo(() => apollo.gql`
|
|
26
|
+
query NxAuthFetchSession {
|
|
27
|
+
authenticatedItem {
|
|
28
|
+
label: ${labelField}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
`, [labelField]));
|
|
32
|
+
return /*#__PURE__*/jsxRuntime.jsxs(components.NavContainer, {
|
|
33
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs(components.NavList, {
|
|
34
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(components.NavItem, {
|
|
35
|
+
href: "/",
|
|
36
|
+
children: "Dashboard"
|
|
37
|
+
}), /*#__PURE__*/jsxRuntime.jsx(layout.Divider, {}), lists.map(list => /*#__PURE__*/jsxRuntime.jsx(components.NavItem, {
|
|
38
|
+
href: components.getHrefFromList(list),
|
|
39
|
+
children: list.label
|
|
40
|
+
}, list.key))]
|
|
41
|
+
}), /*#__PURE__*/jsxRuntime.jsxs(components.NavFooter, {
|
|
42
|
+
children: [(data === null || data === void 0 ? void 0 : data.authenticatedItem) && /*#__PURE__*/jsxRuntime.jsx(UserFooter, {
|
|
43
|
+
authItemLabel: data.authenticatedItem.label
|
|
44
|
+
}), /*#__PURE__*/jsxRuntime.jsx(components.DeveloperResourcesMenu, {})]
|
|
45
|
+
})]
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
const END_SESSION = apollo.gql`
|
|
49
|
+
mutation NxAuthEndSession {
|
|
50
|
+
endSession
|
|
51
|
+
}
|
|
52
|
+
`;
|
|
53
|
+
function UserFooter({
|
|
54
|
+
authItemLabel
|
|
55
|
+
}) {
|
|
56
|
+
const router$1 = router.useRouter();
|
|
57
|
+
const [endSession, {
|
|
58
|
+
data
|
|
59
|
+
}] = apollo.useMutation(END_SESSION);
|
|
60
|
+
react.useEffect(() => {
|
|
61
|
+
if (data !== null && data !== void 0 && data.endSession) {
|
|
62
|
+
router$1.push('/signin');
|
|
63
|
+
}
|
|
64
|
+
}, [data]);
|
|
65
|
+
const initials = authItemLabel.split(' ').slice(0, 2).map(s => s.charAt(0).toUpperCase()).join('');
|
|
66
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
67
|
+
className: style.css({
|
|
68
|
+
display: 'flex',
|
|
69
|
+
alignItems: 'center',
|
|
70
|
+
gap: 8,
|
|
71
|
+
paddingInline: '4px',
|
|
72
|
+
paddingBlock: '2px'
|
|
73
|
+
}),
|
|
74
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("span", {
|
|
75
|
+
className: style.css({
|
|
76
|
+
display: 'inline-flex',
|
|
77
|
+
alignItems: 'center',
|
|
78
|
+
justifyContent: 'center',
|
|
79
|
+
width: 28,
|
|
80
|
+
height: 28,
|
|
81
|
+
borderRadius: '50%',
|
|
82
|
+
backgroundColor: '#0a0a0a',
|
|
83
|
+
color: '#ffffff',
|
|
84
|
+
fontSize: 10.5,
|
|
85
|
+
fontWeight: 600,
|
|
86
|
+
letterSpacing: '0.02em',
|
|
87
|
+
flexShrink: 0,
|
|
88
|
+
fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, sans-serif"
|
|
89
|
+
}),
|
|
90
|
+
children: initials
|
|
91
|
+
}), /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
92
|
+
className: style.css({
|
|
93
|
+
flex: 1,
|
|
94
|
+
fontSize: 12.5,
|
|
95
|
+
fontWeight: 500,
|
|
96
|
+
color: '#2a2a2a',
|
|
97
|
+
overflow: 'hidden',
|
|
98
|
+
textOverflow: 'ellipsis',
|
|
99
|
+
whiteSpace: 'nowrap',
|
|
100
|
+
lineHeight: 1.2
|
|
101
|
+
}),
|
|
102
|
+
children: authItemLabel
|
|
103
|
+
}), /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
104
|
+
onClick: () => endSession(),
|
|
105
|
+
title: "Sign out",
|
|
106
|
+
"aria-label": "Sign out",
|
|
107
|
+
className: style.css({
|
|
108
|
+
display: 'inline-flex',
|
|
109
|
+
alignItems: 'center',
|
|
110
|
+
justifyContent: 'center',
|
|
111
|
+
width: 26,
|
|
112
|
+
height: 26,
|
|
113
|
+
border: '1px solid #ebebeb',
|
|
114
|
+
borderRadius: 6,
|
|
115
|
+
background: 'transparent',
|
|
116
|
+
cursor: 'pointer',
|
|
117
|
+
color: '#a3a3a3',
|
|
118
|
+
flexShrink: 0,
|
|
119
|
+
transition: 'color 130ms, border-color 130ms, background 130ms',
|
|
120
|
+
'&:hover': {
|
|
121
|
+
color: '#0a0a0a',
|
|
122
|
+
borderColor: '#c8c8c8',
|
|
123
|
+
background: '#f5f5f5'
|
|
124
|
+
},
|
|
125
|
+
'&:focus-visible': {
|
|
126
|
+
outline: '2px solid #000',
|
|
127
|
+
outlineOffset: 2
|
|
128
|
+
}
|
|
129
|
+
}),
|
|
130
|
+
children: /*#__PURE__*/jsxRuntime.jsx("svg", {
|
|
131
|
+
width: "12",
|
|
132
|
+
height: "12",
|
|
133
|
+
viewBox: "0 0 12 12",
|
|
134
|
+
fill: "none",
|
|
135
|
+
children: /*#__PURE__*/jsxRuntime.jsx("path", {
|
|
136
|
+
d: "M4.5 2H2.5C2.22386 2 2 2.22386 2 2.5V9.5C2 9.77614 2.22386 10 2.5 10H4.5M8 4L10 6L8 8M10 6H4.5",
|
|
137
|
+
stroke: "currentColor",
|
|
138
|
+
strokeWidth: "1.25",
|
|
139
|
+
strokeLinecap: "round",
|
|
140
|
+
strokeLinejoin: "round"
|
|
141
|
+
})
|
|
142
|
+
})
|
|
143
|
+
})]
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
exports["default"] = Navigation;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { useMemo, useEffect } from 'react';
|
|
2
|
+
import { Divider } from '@keystar/ui/layout';
|
|
3
|
+
import { css } from '@keystar/ui/style';
|
|
4
|
+
import { gql, useQuery, useMutation } from '@nixxie-cms/core/admin-ui/apollo';
|
|
5
|
+
import { NavContainer, NavList, NavItem, getHrefFromList, NavFooter, DeveloperResourcesMenu } from '@nixxie-cms/core/admin-ui/components';
|
|
6
|
+
import { useRouter } from '@nixxie-cms/core/admin-ui/router';
|
|
7
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
8
|
+
|
|
9
|
+
var Navigation = ({
|
|
10
|
+
labelField
|
|
11
|
+
}) => props => /*#__PURE__*/jsx(Navigation$1, {
|
|
12
|
+
labelField: labelField,
|
|
13
|
+
...props
|
|
14
|
+
});
|
|
15
|
+
function Navigation$1({
|
|
16
|
+
labelField,
|
|
17
|
+
lists
|
|
18
|
+
}) {
|
|
19
|
+
const {
|
|
20
|
+
data
|
|
21
|
+
} = useQuery(useMemo(() => gql`
|
|
22
|
+
query NxAuthFetchSession {
|
|
23
|
+
authenticatedItem {
|
|
24
|
+
label: ${labelField}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
`, [labelField]));
|
|
28
|
+
return /*#__PURE__*/jsxs(NavContainer, {
|
|
29
|
+
children: [/*#__PURE__*/jsxs(NavList, {
|
|
30
|
+
children: [/*#__PURE__*/jsx(NavItem, {
|
|
31
|
+
href: "/",
|
|
32
|
+
children: "Dashboard"
|
|
33
|
+
}), /*#__PURE__*/jsx(Divider, {}), lists.map(list => /*#__PURE__*/jsx(NavItem, {
|
|
34
|
+
href: getHrefFromList(list),
|
|
35
|
+
children: list.label
|
|
36
|
+
}, list.key))]
|
|
37
|
+
}), /*#__PURE__*/jsxs(NavFooter, {
|
|
38
|
+
children: [(data === null || data === void 0 ? void 0 : data.authenticatedItem) && /*#__PURE__*/jsx(UserFooter, {
|
|
39
|
+
authItemLabel: data.authenticatedItem.label
|
|
40
|
+
}), /*#__PURE__*/jsx(DeveloperResourcesMenu, {})]
|
|
41
|
+
})]
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
const END_SESSION = gql`
|
|
45
|
+
mutation NxAuthEndSession {
|
|
46
|
+
endSession
|
|
47
|
+
}
|
|
48
|
+
`;
|
|
49
|
+
function UserFooter({
|
|
50
|
+
authItemLabel
|
|
51
|
+
}) {
|
|
52
|
+
const router = useRouter();
|
|
53
|
+
const [endSession, {
|
|
54
|
+
data
|
|
55
|
+
}] = useMutation(END_SESSION);
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
if (data !== null && data !== void 0 && data.endSession) {
|
|
58
|
+
router.push('/signin');
|
|
59
|
+
}
|
|
60
|
+
}, [data]);
|
|
61
|
+
const initials = authItemLabel.split(' ').slice(0, 2).map(s => s.charAt(0).toUpperCase()).join('');
|
|
62
|
+
return /*#__PURE__*/jsxs("div", {
|
|
63
|
+
className: css({
|
|
64
|
+
display: 'flex',
|
|
65
|
+
alignItems: 'center',
|
|
66
|
+
gap: 8,
|
|
67
|
+
paddingInline: '4px',
|
|
68
|
+
paddingBlock: '2px'
|
|
69
|
+
}),
|
|
70
|
+
children: [/*#__PURE__*/jsx("span", {
|
|
71
|
+
className: css({
|
|
72
|
+
display: 'inline-flex',
|
|
73
|
+
alignItems: 'center',
|
|
74
|
+
justifyContent: 'center',
|
|
75
|
+
width: 28,
|
|
76
|
+
height: 28,
|
|
77
|
+
borderRadius: '50%',
|
|
78
|
+
backgroundColor: '#0a0a0a',
|
|
79
|
+
color: '#ffffff',
|
|
80
|
+
fontSize: 10.5,
|
|
81
|
+
fontWeight: 600,
|
|
82
|
+
letterSpacing: '0.02em',
|
|
83
|
+
flexShrink: 0,
|
|
84
|
+
fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, sans-serif"
|
|
85
|
+
}),
|
|
86
|
+
children: initials
|
|
87
|
+
}), /*#__PURE__*/jsx("span", {
|
|
88
|
+
className: css({
|
|
89
|
+
flex: 1,
|
|
90
|
+
fontSize: 12.5,
|
|
91
|
+
fontWeight: 500,
|
|
92
|
+
color: '#2a2a2a',
|
|
93
|
+
overflow: 'hidden',
|
|
94
|
+
textOverflow: 'ellipsis',
|
|
95
|
+
whiteSpace: 'nowrap',
|
|
96
|
+
lineHeight: 1.2
|
|
97
|
+
}),
|
|
98
|
+
children: authItemLabel
|
|
99
|
+
}), /*#__PURE__*/jsx("button", {
|
|
100
|
+
onClick: () => endSession(),
|
|
101
|
+
title: "Sign out",
|
|
102
|
+
"aria-label": "Sign out",
|
|
103
|
+
className: css({
|
|
104
|
+
display: 'inline-flex',
|
|
105
|
+
alignItems: 'center',
|
|
106
|
+
justifyContent: 'center',
|
|
107
|
+
width: 26,
|
|
108
|
+
height: 26,
|
|
109
|
+
border: '1px solid #ebebeb',
|
|
110
|
+
borderRadius: 6,
|
|
111
|
+
background: 'transparent',
|
|
112
|
+
cursor: 'pointer',
|
|
113
|
+
color: '#a3a3a3',
|
|
114
|
+
flexShrink: 0,
|
|
115
|
+
transition: 'color 130ms, border-color 130ms, background 130ms',
|
|
116
|
+
'&:hover': {
|
|
117
|
+
color: '#0a0a0a',
|
|
118
|
+
borderColor: '#c8c8c8',
|
|
119
|
+
background: '#f5f5f5'
|
|
120
|
+
},
|
|
121
|
+
'&:focus-visible': {
|
|
122
|
+
outline: '2px solid #000',
|
|
123
|
+
outlineOffset: 2
|
|
124
|
+
}
|
|
125
|
+
}),
|
|
126
|
+
children: /*#__PURE__*/jsx("svg", {
|
|
127
|
+
width: "12",
|
|
128
|
+
height: "12",
|
|
129
|
+
viewBox: "0 0 12 12",
|
|
130
|
+
fill: "none",
|
|
131
|
+
children: /*#__PURE__*/jsx("path", {
|
|
132
|
+
d: "M4.5 2H2.5C2.22386 2 2 2.22386 2 2.5V9.5C2 9.77614 2.22386 10 2.5 10H4.5M8 4L10 6L8 8M10 6H4.5",
|
|
133
|
+
stroke: "currentColor",
|
|
134
|
+
strokeWidth: "1.25",
|
|
135
|
+
strokeLinecap: "round",
|
|
136
|
+
strokeLinejoin: "round"
|
|
137
|
+
})
|
|
138
|
+
})
|
|
139
|
+
})]
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export { Navigation as default };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { NavigationProps } from '@nixxie-cms/core/admin-ui/components';
|
|
2
|
+
declare const _default: ({ labelField }: {
|
|
3
|
+
labelField: string;
|
|
4
|
+
}) => (props: NavigationProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export default _default;
|
|
6
|
+
//# sourceMappingURL=Navigation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Navigation.d.ts","sourceRoot":"../../../../src/components","sources":["Navigation.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAA;yBAG3D,gBAAgB;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,MACnD,OAAO,eAAe;AADzB,wBAC+E"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { BaseListTypeInfo, BaseNixxieTypeInfo, NixxieConfig } from '@nixxie-cms/core/types';
|
|
2
|
+
import type { AuthConfig } from "./types.js";
|
|
3
|
+
export type AuthSession = {
|
|
4
|
+
itemId: string | number;
|
|
5
|
+
data: unknown;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* createAuth function
|
|
9
|
+
*
|
|
10
|
+
* Generates config for Nixxie to implement standard auth features.
|
|
11
|
+
*/
|
|
12
|
+
export declare function createAuth<ListTypeInfo extends BaseListTypeInfo>({ listKey, secretField, initFirstItem, identityField, sessionData, }: AuthConfig<ListTypeInfo>): {
|
|
13
|
+
withAuth: <TypeInfo extends BaseNixxieTypeInfo>(config: NixxieConfig<TypeInfo>) => NixxieConfig<TypeInfo>;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"../../../src","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,gBAAgB,EAGhB,kBAAkB,EAClB,YAAY,EACb,MAAM,wBAAwB,CAAA;AAC/B,OAAO,KAAK,EAAE,UAAU,EAAgB,mBAAe;AAOvD,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,MAAM,GAAG,MAAM,CAAA;IACvB,IAAI,EAAE,OAAO,CAAA;CACd,CAAA;AAmBD;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,YAAY,SAAS,gBAAgB,EAAE,EAChE,OAAO,EACP,WAAW,EACX,aAAa,EACb,aAAa,EACb,WAAkB,GACnB,EAAE,UAAU,CAAC,YAAY,CAAC;eAkKP,QAAQ,SAAS,kBAAkB,UAC3C,YAAY,CAAC,QAAQ,CAAC,KAC7B,YAAY,CAAC,QAAQ,CAAC;EA8E1B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AuthGqlNames } from "../types.js";
|
|
2
|
+
declare const _default: (props: Parameters<typeof InitPage>[0]) => () => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export default _default;
|
|
4
|
+
declare function InitPage({ authGqlNames, listKey, fieldPaths, }: {
|
|
5
|
+
authGqlNames: AuthGqlNames;
|
|
6
|
+
listKey: string;
|
|
7
|
+
fieldPaths: string[];
|
|
8
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=InitPage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InitPage.d.ts","sourceRoot":"../../../../src/pages","sources":["InitPage.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,YAAY,EAAE,oBAAgB;yBAE5B,OAAO,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC;AAArD,wBAAuF;AAEvF,iBAAS,QAAQ,CAAC,EAChB,YAAY,EACZ,OAAO,EACP,UAAU,GACX,EAAE;IACD,YAAY,EAAE,YAAY,CAAA;IAC1B,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,EAAE,MAAM,EAAE,CAAA;CACrB,2CA4QA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AuthGqlNames } from "../types.js";
|
|
2
|
+
declare const _default: (props: Parameters<typeof SigninPage>[0]) => () => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export default _default;
|
|
4
|
+
declare function SigninPage({ identityField, secretField, authGqlNames, }: {
|
|
5
|
+
identityField: string;
|
|
6
|
+
secretField: string;
|
|
7
|
+
authGqlNames: AuthGqlNames;
|
|
8
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=SigninPage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SigninPage.d.ts","sourceRoot":"../../../../src/pages","sources":["SigninPage.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,YAAY,EAAE,oBAAgB;yBAE5B,OAAO,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC,CAAC,CAAC;AAAvD,wBAA2F;AAE3F,iBAAS,UAAU,CAAC,EAClB,aAAa,EACb,WAAW,EACX,YAAY,GACb,EAAE;IACD,aAAa,EAAE,MAAM,CAAA;IACrB,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,EAAE,YAAY,CAAA;CAC3B,2CA4SA"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { BaseListTypeInfo, NixxieContext } from '@nixxie-cms/core/types';
|
|
2
|
+
export type AuthGqlNames = {
|
|
3
|
+
itemQueryName: string;
|
|
4
|
+
whereUniqueInputName: string;
|
|
5
|
+
authenticateItemWithPassword: string;
|
|
6
|
+
ItemAuthenticationWithPasswordResult: string;
|
|
7
|
+
ItemAuthenticationWithPasswordSuccess: string;
|
|
8
|
+
ItemAuthenticationWithPasswordFailure: string;
|
|
9
|
+
CreateInitialInput: string;
|
|
10
|
+
createInitialItem: string;
|
|
11
|
+
};
|
|
12
|
+
export type SendTokenFn = (args: {
|
|
13
|
+
itemId: string | number | bigint;
|
|
14
|
+
identity: string;
|
|
15
|
+
token: string;
|
|
16
|
+
context: NixxieContext;
|
|
17
|
+
}) => Promise<void> | void;
|
|
18
|
+
export type AuthTokenTypeConfig = {
|
|
19
|
+
/** Called when a user should be sent the magic signin token they requested */
|
|
20
|
+
sendToken: SendTokenFn;
|
|
21
|
+
/** How long do tokens stay valid for from time of issue, in minutes **/
|
|
22
|
+
tokensValidForMins?: number;
|
|
23
|
+
};
|
|
24
|
+
export type AuthConfig<ListTypeInfo extends BaseListTypeInfo> = {
|
|
25
|
+
/** The key of the list to authenticate users with */
|
|
26
|
+
listKey: ListTypeInfo['key'];
|
|
27
|
+
/** The path of the field the identity is stored in; must be text-ish */
|
|
28
|
+
identityField: ListTypeInfo['fields'];
|
|
29
|
+
/** The path of the field the secret is stored in; must be password-ish */
|
|
30
|
+
secretField: ListTypeInfo['fields'];
|
|
31
|
+
/** The initial user/db seeding functionality */
|
|
32
|
+
initFirstItem?: InitFirstItemConfig<ListTypeInfo>;
|
|
33
|
+
/** Session data population */
|
|
34
|
+
sessionData?: string;
|
|
35
|
+
};
|
|
36
|
+
export type InitFirstItemConfig<ListTypeInfo extends BaseListTypeInfo> = {
|
|
37
|
+
/** Array of fields to collect, e.g ['name', 'email', 'password'] */
|
|
38
|
+
fields: readonly ListTypeInfo['fields'][];
|
|
39
|
+
/** Suppresses the second screen where we ask people to subscribe and follow Nixxie */
|
|
40
|
+
skipNixxieWelcome?: boolean;
|
|
41
|
+
/** Extra input to add for the create mutation */
|
|
42
|
+
itemData?: Partial<ListTypeInfo['inputs']['create']>;
|
|
43
|
+
};
|
|
44
|
+
export type AuthTokenRedemptionErrorCode = 'FAILURE' | 'TOKEN_EXPIRED' | 'TOKEN_REDEEMED';
|
|
45
|
+
export type SecretFieldImpl = {
|
|
46
|
+
generateHash: (secret: string) => Promise<string>;
|
|
47
|
+
compare: (secret: string, hash: string) => Promise<boolean>;
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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