authhero 0.0.1 → 1.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/.changeset/README.md +8 -0
- package/.changeset/config.json +11 -0
- package/.github/workflows/release.yml +34 -0
- package/.prettierignore +3 -0
- package/.prettierrc.json +1 -0
- package/README.md +9 -4
- package/apps/react-admin/.eslintrc.js +21 -0
- package/apps/react-admin/README.md +50 -0
- package/apps/react-admin/index.html +125 -0
- package/apps/react-admin/package.json +45 -0
- package/apps/react-admin/prettier.config.js +1 -0
- package/apps/react-admin/public/favicon.ico +0 -0
- package/apps/react-admin/public/manifest.json +15 -0
- package/apps/react-admin/src/App.spec.tsx +39 -0
- package/apps/react-admin/src/App.tsx +75 -0
- package/apps/react-admin/src/Layout.tsx +12 -0
- package/apps/react-admin/src/TenantsApp.tsx +21 -0
- package/apps/react-admin/src/auth0DataProvider.ts +220 -0
- package/apps/react-admin/src/authProvider.ts +42 -0
- package/apps/react-admin/src/components/TenantAppBar.tsx +46 -0
- package/apps/react-admin/src/components/TenantLayout.tsx +17 -0
- package/apps/react-admin/src/components/applications/create.tsx +29 -0
- package/apps/react-admin/src/components/applications/edit.tsx +40 -0
- package/apps/react-admin/src/components/applications/index.ts +3 -0
- package/apps/react-admin/src/components/applications/list.tsx +37 -0
- package/apps/react-admin/src/components/common/DateAgo.tsx +6 -0
- package/apps/react-admin/src/components/common/JsonOutput.tsx +3 -0
- package/apps/react-admin/src/components/common/index.ts +1 -0
- package/apps/react-admin/src/components/connections/create.tsx +11 -0
- package/apps/react-admin/src/components/connections/edit.tsx +66 -0
- package/apps/react-admin/src/components/connections/index.ts +3 -0
- package/apps/react-admin/src/components/connections/list.tsx +15 -0
- package/apps/react-admin/src/components/domains/create.tsx +11 -0
- package/apps/react-admin/src/components/domains/edit.tsx +49 -0
- package/apps/react-admin/src/components/domains/index.ts +3 -0
- package/apps/react-admin/src/components/domains/list.tsx +15 -0
- package/apps/react-admin/src/components/listActions/PostListActions.tsx +10 -0
- package/apps/react-admin/src/components/tenants/create.tsx +15 -0
- package/apps/react-admin/src/components/tenants/edit.tsx +51 -0
- package/apps/react-admin/src/components/tenants/index.ts +2 -0
- package/apps/react-admin/src/components/tenants/list.tsx +48 -0
- package/apps/react-admin/src/components/users/create.tsx +15 -0
- package/apps/react-admin/src/components/users/edit.tsx +108 -0
- package/apps/react-admin/src/components/users/index.ts +3 -0
- package/apps/react-admin/src/components/users/list.tsx +30 -0
- package/apps/react-admin/src/data.json +121 -0
- package/apps/react-admin/src/dataProvider.ts +48 -0
- package/apps/react-admin/src/index.tsx +30 -0
- package/apps/react-admin/src/lib/logs.ts +19 -0
- package/apps/react-admin/tsconfig.json +9 -0
- package/apps/react-admin/tsconfig.node.json +4 -0
- package/apps/react-admin/vercel.json +20 -0
- package/apps/react-admin/vite.config.ts +19 -0
- package/eslint.config.mjs +25 -0
- package/package.json +22 -16
- package/packages/authhero/CHANGELOG.md +7 -0
- package/packages/authhero/README.md +9 -0
- package/packages/authhero/package.json +25 -0
- package/packages/authhero/src/bun.ts +16 -0
- package/packages/authhero/src/index.ts +34 -0
- package/packages/authhero/src/routes/oauth2/index.ts +1 -0
- package/packages/authhero/src/routes/oauth2/well-known.ts +179 -0
- package/{src → packages/authhero/src}/types/Bindings.ts +3 -0
- package/packages/authhero/src/types/JWKS.ts +37 -0
- package/packages/authhero/src/types/Variables.ts +1 -0
- package/packages/authhero/src/types/index.ts +3 -0
- package/packages/authhero/src/vite-env.d.ts +1 -0
- package/packages/authhero/tsconfig.json +11 -0
- package/packages/authhero/tsconfig.node.json +4 -0
- package/packages/create-authhero/package.json +22 -0
- package/packages/create-authhero/src/index.ts +72 -0
- package/packages/create-authhero/src/vite-env.d.ts +1 -0
- package/packages/create-authhero/templates/sqlite/package.json +17 -0
- package/packages/create-authhero/templates/sqlite/src/index.ts +19 -0
- package/packages/create-authhero/templates/sqlite/yarn.lock +48 -0
- package/packages/create-authhero/tsconfig.json +9 -0
- package/packages/create-authhero/tsconfig.node.json +4 -0
- package/packages/create-authhero/vite.config.ts +14 -0
- package/pnpm-workspace.yaml +3 -0
- package/tsconfig.json +28 -8
- package/tsconfig.node.json +7 -2
- package/dist/authhero.js +0 -4912
- package/dist/index.d.ts +0 -4
- package/dist/index.d.ts.map +0 -1
- package/dist/types/Bindings.d.ts +0 -5
- package/dist/types/Bindings.d.ts.map +0 -1
- package/src/index.ts +0 -13
- /package/{src → apps/react-admin/src}/vite-env.d.ts +0 -0
- /package/{vite.config.ts → packages/authhero/vite.config.ts} +0 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DateField,
|
|
3
|
+
Edit,
|
|
4
|
+
FieldTitle,
|
|
5
|
+
Labeled,
|
|
6
|
+
SelectInput,
|
|
7
|
+
TabbedForm,
|
|
8
|
+
TextInput,
|
|
9
|
+
} from "react-admin";
|
|
10
|
+
import { ColorInput } from "react-admin-color-picker";
|
|
11
|
+
|
|
12
|
+
export function TenantsEdit() {
|
|
13
|
+
return (
|
|
14
|
+
<Edit>
|
|
15
|
+
<TabbedForm>
|
|
16
|
+
<TabbedForm.Tab label="Info">
|
|
17
|
+
<TextInput source="id" />
|
|
18
|
+
<TextInput source="name" />
|
|
19
|
+
<TextInput source="audience" label="Audience" />
|
|
20
|
+
<TextInput source="support_url" label="Support Url" />
|
|
21
|
+
<Labeled label={<FieldTitle source="created_at" />}>
|
|
22
|
+
<DateField source="created_at" showTime={true} />
|
|
23
|
+
</Labeled>
|
|
24
|
+
<Labeled label={<FieldTitle source="updated_at" />}>
|
|
25
|
+
<DateField source="updated_at" showTime={true} />
|
|
26
|
+
</Labeled>
|
|
27
|
+
</TabbedForm.Tab>
|
|
28
|
+
<TabbedForm.Tab label="Communication">
|
|
29
|
+
<TextInput source="sender_email" />
|
|
30
|
+
<TextInput source="sender_name" />
|
|
31
|
+
</TabbedForm.Tab>
|
|
32
|
+
<TabbedForm.Tab label="Style">
|
|
33
|
+
<SelectInput
|
|
34
|
+
source="language"
|
|
35
|
+
label="Languages"
|
|
36
|
+
choices={[
|
|
37
|
+
{ id: "en", name: "English" },
|
|
38
|
+
{ id: "nb", name: "Norwegian" },
|
|
39
|
+
{ id: "sv", name: "Swedish" },
|
|
40
|
+
{ id: "it", name: "Italian" },
|
|
41
|
+
{ id: "pl", name: "Polish" },
|
|
42
|
+
]}
|
|
43
|
+
/>
|
|
44
|
+
<ColorInput source="primary_color" label="Primary Color" />
|
|
45
|
+
<ColorInput source="secondary_color" label="Secondary Color" />
|
|
46
|
+
<TextInput source="logo" label="Logo" />
|
|
47
|
+
</TabbedForm.Tab>
|
|
48
|
+
</TabbedForm>
|
|
49
|
+
</Edit>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import {
|
|
2
|
+
List,
|
|
3
|
+
Datagrid,
|
|
4
|
+
TextField,
|
|
5
|
+
DateField,
|
|
6
|
+
UrlField,
|
|
7
|
+
SimpleList,
|
|
8
|
+
TextInput,
|
|
9
|
+
} from "react-admin";
|
|
10
|
+
import { useMediaQuery } from "@mui/material";
|
|
11
|
+
import { PostListActions } from "../listActions/PostListActions";
|
|
12
|
+
|
|
13
|
+
export function TenantsList() {
|
|
14
|
+
const isSmall = useMediaQuery((theme: any) => theme.breakpoints.down("sm"));
|
|
15
|
+
|
|
16
|
+
const postFilters = [
|
|
17
|
+
<TextInput key="search" label="Search" source="q" alwaysOn />,
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<List actions={<PostListActions />} filters={postFilters}>
|
|
22
|
+
{isSmall ? (
|
|
23
|
+
<SimpleList
|
|
24
|
+
primaryText={(record) => record.name}
|
|
25
|
+
secondaryText={(record) => record.id}
|
|
26
|
+
linkType={(record) => `/${record.id}`}
|
|
27
|
+
/>
|
|
28
|
+
) : (
|
|
29
|
+
<Datagrid
|
|
30
|
+
rowClick="edit"
|
|
31
|
+
bulkActionButtons={false}
|
|
32
|
+
rowSx={(tenant) => ({
|
|
33
|
+
...(tenant.id === "DEFAULT_SETTINGS" && {
|
|
34
|
+
backgroundColor: "#f0f0f0",
|
|
35
|
+
}),
|
|
36
|
+
})}
|
|
37
|
+
>
|
|
38
|
+
<TextField source="name" />
|
|
39
|
+
<UrlField source="id" />
|
|
40
|
+
<TextField source="audience" />
|
|
41
|
+
<DateField source="created_at" showTime={true} />
|
|
42
|
+
<DateField source="updated_at" showTime={true} />
|
|
43
|
+
<TextField source="support_url" label="Support Url" />
|
|
44
|
+
</Datagrid>
|
|
45
|
+
)}
|
|
46
|
+
</List>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Create, SimpleForm, TextInput, required } from "react-admin";
|
|
2
|
+
|
|
3
|
+
export function UserCreate() {
|
|
4
|
+
return (
|
|
5
|
+
<Create>
|
|
6
|
+
<SimpleForm>
|
|
7
|
+
<TextInput source="email" type="email" validate={[required()]} />
|
|
8
|
+
<TextInput source="name" />
|
|
9
|
+
<TextInput source="given_name" />
|
|
10
|
+
<TextInput source="family_name" />
|
|
11
|
+
<TextInput source="picture" />
|
|
12
|
+
</SimpleForm>
|
|
13
|
+
</Create>
|
|
14
|
+
);
|
|
15
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Datagrid,
|
|
3
|
+
DateField,
|
|
4
|
+
Edit,
|
|
5
|
+
FieldTitle,
|
|
6
|
+
Labeled,
|
|
7
|
+
Pagination,
|
|
8
|
+
ReferenceManyField,
|
|
9
|
+
TabbedForm,
|
|
10
|
+
TextField,
|
|
11
|
+
TextInput,
|
|
12
|
+
FunctionField,
|
|
13
|
+
BooleanField,
|
|
14
|
+
ArrayField,
|
|
15
|
+
SimpleShowLayout,
|
|
16
|
+
} from "react-admin";
|
|
17
|
+
import { LogType, LogIcon } from "../logs";
|
|
18
|
+
import { DateAgo } from "../common";
|
|
19
|
+
import { Stack } from "@mui/material";
|
|
20
|
+
import { JsonOutput } from "../common/JsonOutput";
|
|
21
|
+
|
|
22
|
+
export function UserEdit() {
|
|
23
|
+
return (
|
|
24
|
+
<Edit>
|
|
25
|
+
<SimpleShowLayout>
|
|
26
|
+
<TextField source="email" />
|
|
27
|
+
<TextField source="id" />
|
|
28
|
+
</SimpleShowLayout>
|
|
29
|
+
<TabbedForm>
|
|
30
|
+
<TabbedForm.Tab label="details">
|
|
31
|
+
<Stack spacing={2} direction="row">
|
|
32
|
+
<Labeled label={<FieldTitle source="email" />}>
|
|
33
|
+
<TextField source="email" sx={{ mb: 4 }} />
|
|
34
|
+
</Labeled>
|
|
35
|
+
<Labeled label={<FieldTitle source="name" />}>
|
|
36
|
+
<TextField source="name" sx={{ mb: 4 }} />
|
|
37
|
+
</Labeled>
|
|
38
|
+
<Labeled label={<FieldTitle source="id" />}>
|
|
39
|
+
<TextField source="id" sx={{ mb: 4 }} />
|
|
40
|
+
</Labeled>
|
|
41
|
+
</Stack>
|
|
42
|
+
<Stack spacing={2} direction="row">
|
|
43
|
+
<TextInput source="given_name" />
|
|
44
|
+
<TextInput source="family_name" />
|
|
45
|
+
<TextInput source="nickname" />
|
|
46
|
+
</Stack>
|
|
47
|
+
<TextInput source="picture" />
|
|
48
|
+
<ArrayField source="identities">
|
|
49
|
+
<Datagrid bulkActionButtons={false} sx={{ my: 4 }}>
|
|
50
|
+
<TextField source="connection" />
|
|
51
|
+
<TextField source="provider" />
|
|
52
|
+
<TextField source="user_id" />
|
|
53
|
+
<BooleanField source="isSocial" />
|
|
54
|
+
</Datagrid>
|
|
55
|
+
</ArrayField>
|
|
56
|
+
|
|
57
|
+
<Labeled label={<FieldTitle source="created_at" />}>
|
|
58
|
+
<DateField source="created_at" showTime={true} />
|
|
59
|
+
</Labeled>
|
|
60
|
+
<Labeled label={<FieldTitle source="updated_at" />}>
|
|
61
|
+
<DateField source="updated_at" showTime={true} />
|
|
62
|
+
</Labeled>
|
|
63
|
+
</TabbedForm.Tab>
|
|
64
|
+
<TabbedForm.Tab label="logs">
|
|
65
|
+
<ReferenceManyField
|
|
66
|
+
reference="logs"
|
|
67
|
+
target="userId"
|
|
68
|
+
pagination={<Pagination />}
|
|
69
|
+
>
|
|
70
|
+
<Datagrid
|
|
71
|
+
sx={{
|
|
72
|
+
width: "100%",
|
|
73
|
+
"& .column-comment": {
|
|
74
|
+
maxWidth: "20em",
|
|
75
|
+
overflow: "hidden",
|
|
76
|
+
textOverflow: "ellipsis",
|
|
77
|
+
whiteSpace: "nowrap",
|
|
78
|
+
},
|
|
79
|
+
}}
|
|
80
|
+
sort={{ field: "timestamp", order: "DESC" }}
|
|
81
|
+
rowClick="show"
|
|
82
|
+
>
|
|
83
|
+
<FunctionField
|
|
84
|
+
source="success"
|
|
85
|
+
render={(record: any) => <LogIcon type={record.type} />}
|
|
86
|
+
/>
|
|
87
|
+
<FunctionField
|
|
88
|
+
source="type"
|
|
89
|
+
render={(record: any) => <LogType type={record.type} />}
|
|
90
|
+
/>
|
|
91
|
+
<FunctionField
|
|
92
|
+
source="date"
|
|
93
|
+
render={(record: any) => <DateAgo date={record.date} />}
|
|
94
|
+
/>
|
|
95
|
+
<TextField source="description" />
|
|
96
|
+
</Datagrid>
|
|
97
|
+
</ReferenceManyField>
|
|
98
|
+
</TabbedForm.Tab>
|
|
99
|
+
<TabbedForm.Tab label="Raw JSON">
|
|
100
|
+
<FunctionField
|
|
101
|
+
source="date"
|
|
102
|
+
render={(record: any) => <JsonOutput data={record} />}
|
|
103
|
+
/>
|
|
104
|
+
</TabbedForm.Tab>
|
|
105
|
+
</TabbedForm>
|
|
106
|
+
</Edit>
|
|
107
|
+
);
|
|
108
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {
|
|
2
|
+
List,
|
|
3
|
+
Datagrid,
|
|
4
|
+
TextField,
|
|
5
|
+
EmailField,
|
|
6
|
+
TextInput,
|
|
7
|
+
FunctionField,
|
|
8
|
+
} from "react-admin";
|
|
9
|
+
import { PostListActions } from "../listActions/PostListActions";
|
|
10
|
+
import { DateAgo } from "../common";
|
|
11
|
+
|
|
12
|
+
export function UsersList() {
|
|
13
|
+
const postFilters = [
|
|
14
|
+
<TextInput key="search" label="Search" source="q" alwaysOn />,
|
|
15
|
+
];
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<List actions={<PostListActions />} filters={postFilters}>
|
|
19
|
+
<Datagrid rowClick="edit" bulkActionButtons={false}>
|
|
20
|
+
<EmailField source="email" />
|
|
21
|
+
<TextField source="connection" />
|
|
22
|
+
<TextField source="login_count" />
|
|
23
|
+
<FunctionField
|
|
24
|
+
label="Last login"
|
|
25
|
+
render={(record: any) => <DateAgo date={record.last_login} />}
|
|
26
|
+
/>
|
|
27
|
+
</Datagrid>
|
|
28
|
+
</List>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
{
|
|
2
|
+
"posts": [
|
|
3
|
+
{
|
|
4
|
+
"id": 0,
|
|
5
|
+
"title": "Post 1",
|
|
6
|
+
"content": "Content 1"
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
"id": 1,
|
|
10
|
+
"title": "Post 2",
|
|
11
|
+
"content": "Content 2"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"id": 2,
|
|
15
|
+
"title": "Post 3",
|
|
16
|
+
"content": "Content 3"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"id": 3,
|
|
20
|
+
"title": "Post 4",
|
|
21
|
+
"content": "Content 4"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"id": 4,
|
|
25
|
+
"title": "Post 5",
|
|
26
|
+
"content": "Content 5"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"id": 5,
|
|
30
|
+
"title": "Post 6",
|
|
31
|
+
"content": "Content 6"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"id": 6,
|
|
35
|
+
"title": "Post 7",
|
|
36
|
+
"content": "Content 7"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"id": 7,
|
|
40
|
+
"title": "Post 8",
|
|
41
|
+
"content": "Content 8"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"id": 8,
|
|
45
|
+
"title": "Post 9",
|
|
46
|
+
"content": "Content 9"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"id": 9,
|
|
50
|
+
"title": "Post 10",
|
|
51
|
+
"content": "Content 10"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"id": 10,
|
|
55
|
+
"title": "Post 11",
|
|
56
|
+
"content": "Content 11"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"id": 11,
|
|
60
|
+
"title": "Post 12",
|
|
61
|
+
"content": "Content 12"
|
|
62
|
+
}
|
|
63
|
+
],
|
|
64
|
+
"comments": [
|
|
65
|
+
{
|
|
66
|
+
"id": 0,
|
|
67
|
+
"postId": 0,
|
|
68
|
+
"content": "Comment 1"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"id": 1,
|
|
72
|
+
"postId": 0,
|
|
73
|
+
"content": "Comment 2"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"id": 2,
|
|
77
|
+
"postId": 1,
|
|
78
|
+
"content": "Comment 3"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"id": 3,
|
|
82
|
+
"postId": 1,
|
|
83
|
+
"content": "Comment 4"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"id": 4,
|
|
87
|
+
"postId": 2,
|
|
88
|
+
"content": "Comment 5"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"id": 5,
|
|
92
|
+
"postId": 2,
|
|
93
|
+
"content": "Comment 6"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"id": 6,
|
|
97
|
+
"postId": 3,
|
|
98
|
+
"content": "Comment 7"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"id": 7,
|
|
102
|
+
"postId": 3,
|
|
103
|
+
"content": "Comment 8"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"id": 8,
|
|
107
|
+
"postId": 3,
|
|
108
|
+
"content": "Comment 9"
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"id": 9,
|
|
112
|
+
"postId": 4,
|
|
113
|
+
"content": "Comment 10"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"id": 10,
|
|
117
|
+
"postId": 4,
|
|
118
|
+
"content": "Comment 11"
|
|
119
|
+
}
|
|
120
|
+
]
|
|
121
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { UpdateParams, withLifecycleCallbacks } from "react-admin";
|
|
2
|
+
import { authorizedHttpClient } from "./authProvider";
|
|
3
|
+
import auth0DataProvider from "./auth0DataProvider";
|
|
4
|
+
|
|
5
|
+
async function removeExtraFields(params: UpdateParams) {
|
|
6
|
+
delete params.data?.id;
|
|
7
|
+
delete params.data?.tenant_id;
|
|
8
|
+
delete params.data?.updated_at;
|
|
9
|
+
delete params.data?.created_at;
|
|
10
|
+
|
|
11
|
+
// Remove empty properties
|
|
12
|
+
Object.keys(params.data).forEach((key) => {
|
|
13
|
+
if (params.data[key] === undefined) {
|
|
14
|
+
delete params.data[key];
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
return params;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function getDataprovider() {
|
|
22
|
+
// TODO - duplicate auth0DataProvider to tenantsDataProvider
|
|
23
|
+
// we are introducing non-auth0 endpoints AND we odn't require the tenants-id header
|
|
24
|
+
const provider = auth0DataProvider(
|
|
25
|
+
import.meta.env.VITE_SIMPLE_REST_URL,
|
|
26
|
+
authorizedHttpClient,
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
return withLifecycleCallbacks(provider, [
|
|
30
|
+
{
|
|
31
|
+
resource: "tenants",
|
|
32
|
+
beforeUpdate: removeExtraFields,
|
|
33
|
+
},
|
|
34
|
+
]);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function getDataproviderForTenant(tenantId: string) {
|
|
38
|
+
const restUrl = new URL(import.meta.env.VITE_SIMPLE_REST_URL);
|
|
39
|
+
restUrl.pathname = `tenants/${tenantId}`;
|
|
40
|
+
|
|
41
|
+
const auth0Provider = auth0DataProvider(
|
|
42
|
+
import.meta.env.VITE_SIMPLE_REST_URL,
|
|
43
|
+
authorizedHttpClient,
|
|
44
|
+
tenantId,
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
return auth0Provider;
|
|
48
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import ReactDOM from "react-dom/client";
|
|
3
|
+
import { BrowserRouter } from "react-router-dom";
|
|
4
|
+
import { App } from "./App";
|
|
5
|
+
import { TenantsApp } from "./TenantsApp";
|
|
6
|
+
|
|
7
|
+
function Root() {
|
|
8
|
+
const pathSegments = location.pathname.split("/").filter(Boolean); // Splits path into segments and filters out any empty segments
|
|
9
|
+
const tenantId = pathSegments[0];
|
|
10
|
+
|
|
11
|
+
if (!tenantId || ["tenants", "auth-callback"].includes(tenantId)) {
|
|
12
|
+
return (
|
|
13
|
+
<React.StrictMode>
|
|
14
|
+
<BrowserRouter>
|
|
15
|
+
<TenantsApp />
|
|
16
|
+
</BrowserRouter>
|
|
17
|
+
</React.StrictMode>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<React.StrictMode>
|
|
23
|
+
<BrowserRouter basename={tenantId}>
|
|
24
|
+
<App tenantId={tenantId} />
|
|
25
|
+
</BrowserRouter>
|
|
26
|
+
</React.StrictMode>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
ReactDOM.createRoot(document.getElementById("root")!).render(<Root />);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// why are we using vanilla JS linting? it doesn't understand this...
|
|
2
|
+
// AND typescript can much better stop unused vars in tsconfig
|
|
3
|
+
/* eslint-disable no-unused-vars */
|
|
4
|
+
export enum LogTypes {
|
|
5
|
+
SUCCESS_API_OPERATION = "sapi",
|
|
6
|
+
SUCCESS_SILENT_AUTH = "ssa",
|
|
7
|
+
FAILED_SILENT_AUTH = "fsa",
|
|
8
|
+
SUCCESS_SIGNUP = "ss",
|
|
9
|
+
FAILED_SIGNUP = "fs",
|
|
10
|
+
SUCCESS_LOGIN = "s",
|
|
11
|
+
FAILED_LOGIN_INCORRECT_PASSWORD = "fp",
|
|
12
|
+
FAILED_LOGIN_INVALID_EMAIL_USERNAME = "fu",
|
|
13
|
+
SUCCESS_LOGOUT = "slo",
|
|
14
|
+
SUCCESS_CROSS_ORIGIN_AUTHENTICATION = "scoa",
|
|
15
|
+
FAILED_CROSS_ORIGIN_AUTHENTICATION = "fcoa",
|
|
16
|
+
CODE_LINK_EMAIL_SENT = "cls",
|
|
17
|
+
FAILED_LOGIN = "f",
|
|
18
|
+
SUCCESS_EXCHANGE_AUTHORIZATION_CODE_FOR_ACCESS_TOKEN = "seacft",
|
|
19
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"rewrites": [
|
|
3
|
+
{
|
|
4
|
+
"source": "/(.*)manifest.json",
|
|
5
|
+
"destination": "/manifest.json"
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
"source": "/favicon.ico",
|
|
9
|
+
"destination": "/favicon.ico"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"source": "/favicon.ico",
|
|
13
|
+
"destination": "/favicon.ico"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"source": "/(.*)",
|
|
17
|
+
"destination": "/index.html"
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/// <reference types="vitest" />
|
|
2
|
+
import { defineConfig } from 'vite';
|
|
3
|
+
import react from '@vitejs/plugin-react';
|
|
4
|
+
|
|
5
|
+
// https://vitejs.dev/config/
|
|
6
|
+
export default defineConfig({
|
|
7
|
+
plugins: [react()],
|
|
8
|
+
define: {
|
|
9
|
+
'process.env': process.env,
|
|
10
|
+
},
|
|
11
|
+
server: {
|
|
12
|
+
host: true,
|
|
13
|
+
},
|
|
14
|
+
base: './',
|
|
15
|
+
test: {
|
|
16
|
+
globals: true,
|
|
17
|
+
environment: 'jsdom'
|
|
18
|
+
}
|
|
19
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import globals from "globals";
|
|
2
|
+
import pluginJs from "@eslint/js";
|
|
3
|
+
import tseslint from "typescript-eslint";
|
|
4
|
+
import pluginReactConfig from "eslint-plugin-react/configs/recommended.js";
|
|
5
|
+
import { fixupConfigRules } from "@eslint/compat";
|
|
6
|
+
import { configs, rules as reactRules } from "eslint-plugin-react";
|
|
7
|
+
|
|
8
|
+
export default [
|
|
9
|
+
{ files: ["**/*.{js,mjs,cjs,ts,jsx,tsx}"] },
|
|
10
|
+
{ languageOptions: { parserOptions: { ecmaFeatures: { jsx: true } } } },
|
|
11
|
+
{ languageOptions: { globals: { ...globals.browser, ...globals.node } } },
|
|
12
|
+
pluginJs.configs.recommended,
|
|
13
|
+
...tseslint.configs.recommended,
|
|
14
|
+
...fixupConfigRules(pluginReactConfig),
|
|
15
|
+
{
|
|
16
|
+
settings: {
|
|
17
|
+
react: {
|
|
18
|
+
version: "detect", // Automatically detect the react version
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
rules: {
|
|
22
|
+
"react/react-in-jsx-scope": "off", // Turn off the rule for requiring React in scope
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
];
|
package/package.json
CHANGED
|
@@ -1,24 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "authhero",
|
|
3
|
-
"version": "0.0
|
|
4
|
-
"
|
|
5
|
-
"main": "
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
},
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"keywords": [],
|
|
7
|
+
"author": "",
|
|
8
|
+
"license": "ISC",
|
|
10
9
|
"devDependencies": {
|
|
11
|
-
"@
|
|
10
|
+
"@changesets/cli": "^2.27.7",
|
|
11
|
+
"@eslint/compat": "^1.1.0",
|
|
12
|
+
"@eslint/js": "^9.5.0",
|
|
13
|
+
"eslint": "9.x",
|
|
14
|
+
"eslint-plugin-react": "^7.34.3",
|
|
15
|
+
"globals": "^15.6.0",
|
|
16
|
+
"prettier": "^3.3.2",
|
|
17
|
+
"prettier-plugin-tailwindcss": "^0.6.5",
|
|
12
18
|
"typescript": "^5.5.2",
|
|
13
|
-
"
|
|
14
|
-
"vite-plugin-dts": "^3.9.1"
|
|
15
|
-
},
|
|
16
|
-
"dependencies": {
|
|
17
|
-
"@hono/zod-openapi": "^0.14.5",
|
|
18
|
-
"hono": "^4.4.10"
|
|
19
|
+
"typescript-eslint": "^7.14.1"
|
|
19
20
|
},
|
|
20
21
|
"scripts": {
|
|
21
|
-
"
|
|
22
|
-
"
|
|
22
|
+
"dev": "pnpm --recursive --parallel --stream run dev",
|
|
23
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
24
|
+
"format": "prettier --write \"./**/*.{js,jsx,ts,tsx,json}\"",
|
|
25
|
+
"manage": "pnpm --filter @authhero/manage",
|
|
26
|
+
"react-admin": "pnpm --filter @authhero/react-admin",
|
|
27
|
+
"authhero": "pnpm --filter authhero",
|
|
28
|
+
"create-authhero": "pnpm --filter @authhero/create-authhero"
|
|
23
29
|
}
|
|
24
30
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "authhero",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"bin": {
|
|
8
|
+
"authhero": "dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"dev": "bun --watch src/bun.ts",
|
|
12
|
+
"build": "vite build",
|
|
13
|
+
"start": "pnpm build && node dist/index.js"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@types/node": "^20.14.9",
|
|
17
|
+
"typescript": "^5.5.2",
|
|
18
|
+
"vite": "^5.3.2",
|
|
19
|
+
"vite-plugin-dts": "^3.9.1"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@hono/zod-openapi": "^0.14.5",
|
|
23
|
+
"hono": "^4.4.10"
|
|
24
|
+
}
|
|
25
|
+
}
|