@baseplate-dev/plugin-auth 0.1.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 +390 -0
- package/dist/auth/core/common.d.ts +7 -0
- package/dist/auth/core/common.d.ts.map +1 -0
- package/dist/auth/core/common.js +26 -0
- package/dist/auth/core/common.js.map +1 -0
- package/dist/auth/core/components/auth-definition-editor.d.ts +5 -0
- package/dist/auth/core/components/auth-definition-editor.d.ts.map +1 -0
- package/dist/auth/core/components/auth-definition-editor.js +57 -0
- package/dist/auth/core/components/auth-definition-editor.js.map +1 -0
- package/dist/auth/core/components/role-editor-form.d.ts +10 -0
- package/dist/auth/core/components/role-editor-form.d.ts.map +1 -0
- package/dist/auth/core/components/role-editor-form.js +27 -0
- package/dist/auth/core/components/role-editor-form.js.map +1 -0
- package/dist/auth/core/node.d.ts +5 -0
- package/dist/auth/core/node.d.ts.map +1 -0
- package/dist/auth/core/node.js +58 -0
- package/dist/auth/core/node.js.map +1 -0
- package/dist/auth/core/schema/models.d.ts +9 -0
- package/dist/auth/core/schema/models.d.ts.map +1 -0
- package/dist/auth/core/schema/models.js +187 -0
- package/dist/auth/core/schema/models.js.map +1 -0
- package/dist/auth/core/schema/plugin-definition.d.ts +88 -0
- package/dist/auth/core/schema/plugin-definition.d.ts.map +1 -0
- package/dist/auth/core/schema/plugin-definition.js +29 -0
- package/dist/auth/core/schema/plugin-definition.js.map +1 -0
- package/dist/auth/core/web.d.ts +6 -0
- package/dist/auth/core/web.d.ts.map +1 -0
- package/dist/auth/core/web.js +14 -0
- package/dist/auth/core/web.js.map +1 -0
- package/dist/auth/generators/fastify/auth-module/auth-module.generator.d.ts +65 -0
- package/dist/auth/generators/fastify/auth-module/auth-module.generator.d.ts.map +1 -0
- package/dist/auth/generators/fastify/auth-module/auth-module.generator.js +62 -0
- package/dist/auth/generators/fastify/auth-module/auth-module.generator.js.map +1 -0
- package/dist/auth/generators/fastify/auth-module/generated/ts-templates.d.ts +96 -0
- package/dist/auth/generators/fastify/auth-module/generated/ts-templates.d.ts.map +1 -0
- package/dist/auth/generators/fastify/auth-module/generated/ts-templates.js +94 -0
- package/dist/auth/generators/fastify/auth-module/generated/ts-templates.js.map +1 -0
- package/dist/auth/generators/fastify/auth-module/templates/management.ts +22 -0
- package/dist/auth/generators/fastify/auth-module/templates/schema/user-session-payload.object-type.ts +23 -0
- package/dist/auth/generators/fastify/auth-module/templates/schema/user-session.mutations.ts +22 -0
- package/dist/auth/generators/fastify/auth-module/templates/schema/user-session.queries.ts +20 -0
- package/dist/auth/generators/fastify/auth-module/templates/services/user-session.service.ts +251 -0
- package/dist/auth/generators/fastify/auth-module/templates/user-session.constants.ts +19 -0
- package/dist/auth/generators/fastify/auth-module/templates/user-session.service.ts +101 -0
- package/dist/auth/generators/fastify/auth-module/templates/utils/cookie-signer.ts +71 -0
- package/dist/auth/generators/fastify/auth-module/templates/utils/session-cookie.ts +42 -0
- package/dist/auth/generators/fastify/auth-module/templates/utils/verify-request-origin.ts +45 -0
- package/dist/auth/generators/fastify/index.d.ts +2 -0
- package/dist/auth/generators/fastify/index.d.ts.map +1 -0
- package/dist/auth/generators/fastify/index.js +2 -0
- package/dist/auth/generators/fastify/index.js.map +1 -0
- package/dist/auth/generators/index.d.ts +2 -0
- package/dist/auth/generators/index.d.ts.map +1 -0
- package/dist/auth/generators/index.js +2 -0
- package/dist/auth/generators/index.js.map +1 -0
- package/dist/auth/index.d.ts +2 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +2 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/metadata.json +8 -0
- package/dist/auth/static/icon.svg +1 -0
- package/dist/auth0/constants/packages.d.ts +6 -0
- package/dist/auth0/constants/packages.d.ts.map +1 -0
- package/dist/auth0/constants/packages.js +6 -0
- package/dist/auth0/constants/packages.js.map +1 -0
- package/dist/auth0/core/common.d.ts +7 -0
- package/dist/auth0/core/common.d.ts.map +1 -0
- package/dist/auth0/core/common.js +28 -0
- package/dist/auth0/core/common.js.map +1 -0
- package/dist/auth0/core/components/auth-definition-editor.d.ts +5 -0
- package/dist/auth0/core/components/auth-definition-editor.d.ts.map +1 -0
- package/dist/auth0/core/components/auth-definition-editor.js +57 -0
- package/dist/auth0/core/components/auth-definition-editor.js.map +1 -0
- package/dist/auth0/core/components/role-dialog.d.ts +14 -0
- package/dist/auth0/core/components/role-dialog.d.ts.map +1 -0
- package/dist/auth0/core/components/role-dialog.js +27 -0
- package/dist/auth0/core/components/role-dialog.js.map +1 -0
- package/dist/auth0/core/components/role-editor-form.d.ts +10 -0
- package/dist/auth0/core/components/role-editor-form.d.ts.map +1 -0
- package/dist/auth0/core/components/role-editor-form.js +52 -0
- package/dist/auth0/core/components/role-editor-form.js.map +1 -0
- package/dist/auth0/core/node.d.ts +5 -0
- package/dist/auth0/core/node.d.ts.map +1 -0
- package/dist/auth0/core/node.js +86 -0
- package/dist/auth0/core/node.js.map +1 -0
- package/dist/auth0/core/schema/migrations.d.ts +3 -0
- package/dist/auth0/core/schema/migrations.d.ts.map +1 -0
- package/dist/auth0/core/schema/migrations.js +17 -0
- package/dist/auth0/core/schema/migrations.js.map +1 -0
- package/dist/auth0/core/schema/models.d.ts +6 -0
- package/dist/auth0/core/schema/models.d.ts.map +1 -0
- package/dist/auth0/core/schema/models.js +33 -0
- package/dist/auth0/core/schema/models.js.map +1 -0
- package/dist/auth0/core/schema/plugin-definition.d.ts +73 -0
- package/dist/auth0/core/schema/plugin-definition.d.ts.map +1 -0
- package/dist/auth0/core/schema/plugin-definition.js +17 -0
- package/dist/auth0/core/schema/plugin-definition.js.map +1 -0
- package/dist/auth0/core/web.d.ts +6 -0
- package/dist/auth0/core/web.d.ts.map +1 -0
- package/dist/auth0/core/web.js +14 -0
- package/dist/auth0/core/web.js.map +1 -0
- package/dist/auth0/generators/fastify/auth0-module/auth0-module.generator.d.ts +67 -0
- package/dist/auth0/generators/fastify/auth0-module/auth0-module.generator.d.ts.map +1 -0
- package/dist/auth0/generators/fastify/auth0-module/auth0-module.generator.js +125 -0
- package/dist/auth0/generators/fastify/auth0-module/auth0-module.generator.js.map +1 -0
- package/dist/auth0/generators/fastify/auth0-module/generated/ts-import-maps.d.ts +3 -0
- package/dist/auth0/generators/fastify/auth0-module/generated/ts-import-maps.d.ts.map +1 -0
- package/dist/auth0/generators/fastify/auth0-module/generated/ts-import-maps.js +12 -0
- package/dist/auth0/generators/fastify/auth0-module/generated/ts-import-maps.js.map +1 -0
- package/dist/auth0/generators/fastify/auth0-module/generated/ts-templates.d.ts +43 -0
- package/dist/auth0/generators/fastify/auth0-module/generated/ts-templates.d.ts.map +1 -0
- package/dist/auth0/generators/fastify/auth0-module/generated/ts-templates.js +25 -0
- package/dist/auth0/generators/fastify/auth0-module/generated/ts-templates.js.map +1 -0
- package/dist/auth0/generators/fastify/auth0-module/templates/management.ts +22 -0
- package/dist/auth0/generators/fastify/auth0-module/templates/user-session.service.ts +101 -0
- package/dist/auth0/generators/fastify/index.d.ts +2 -0
- package/dist/auth0/generators/fastify/index.d.ts.map +1 -0
- package/dist/auth0/generators/fastify/index.js +2 -0
- package/dist/auth0/generators/fastify/index.js.map +1 -0
- package/dist/auth0/generators/index.d.ts +3 -0
- package/dist/auth0/generators/index.d.ts.map +1 -0
- package/dist/auth0/generators/index.js +3 -0
- package/dist/auth0/generators/index.js.map +1 -0
- package/dist/auth0/generators/react/auth0-apollo/auth0-apollo.generator.d.ts +10 -0
- package/dist/auth0/generators/react/auth0-apollo/auth0-apollo.generator.d.ts.map +1 -0
- package/dist/auth0/generators/react/auth0-apollo/auth0-apollo.generator.js +41 -0
- package/dist/auth0/generators/react/auth0-apollo/auth0-apollo.generator.js.map +1 -0
- package/dist/auth0/generators/react/auth0-apollo/templates/auth-link.ts +11 -0
- package/dist/auth0/generators/react/auth0-callback/auth0-callback.generator.d.ts +61 -0
- package/dist/auth0/generators/react/auth0-callback/auth0-callback.generator.d.ts.map +1 -0
- package/dist/auth0/generators/react/auth0-callback/auth0-callback.generator.js +59 -0
- package/dist/auth0/generators/react/auth0-callback/auth0-callback.generator.js.map +1 -0
- package/dist/auth0/generators/react/auth0-callback/generated/ts-templates.d.ts +106 -0
- package/dist/auth0/generators/react/auth0-callback/generated/ts-templates.d.ts.map +1 -0
- package/dist/auth0/generators/react/auth0-callback/generated/ts-templates.js +28 -0
- package/dist/auth0/generators/react/auth0-callback/generated/ts-templates.js.map +1 -0
- package/dist/auth0/generators/react/auth0-callback/templates/auth0-callback.page.tsx +61 -0
- package/dist/auth0/generators/react/auth0-callback/templates/signup.page.tsx +48 -0
- package/dist/auth0/generators/react/auth0-components/auth0-components.generator.d.ts +53 -0
- package/dist/auth0/generators/react/auth0-components/auth0-components.generator.d.ts.map +1 -0
- package/dist/auth0/generators/react/auth0-components/auth0-components.generator.js +44 -0
- package/dist/auth0/generators/react/auth0-components/auth0-components.generator.js.map +1 -0
- package/dist/auth0/generators/react/auth0-components/generated/ts-import-maps.d.ts +3 -0
- package/dist/auth0/generators/react/auth0-components/generated/ts-import-maps.d.ts.map +1 -0
- package/dist/auth0/generators/react/auth0-components/generated/ts-import-maps.js +12 -0
- package/dist/auth0/generators/react/auth0-components/generated/ts-import-maps.js.map +1 -0
- package/dist/auth0/generators/react/auth0-components/generated/ts-templates.d.ts +45 -0
- package/dist/auth0/generators/react/auth0-components/generated/ts-templates.d.ts.map +1 -0
- package/dist/auth0/generators/react/auth0-components/generated/ts-templates.js +13 -0
- package/dist/auth0/generators/react/auth0-components/generated/ts-templates.js.map +1 -0
- package/dist/auth0/generators/react/auth0-components/templates/RequireAuth.tsx +22 -0
- package/dist/auth0/generators/react/auth0-hooks/auth0-hooks.generator.d.ts +28 -0
- package/dist/auth0/generators/react/auth0-hooks/auth0-hooks.generator.d.ts.map +1 -0
- package/dist/auth0/generators/react/auth0-hooks/auth0-hooks.generator.js +65 -0
- package/dist/auth0/generators/react/auth0-hooks/auth0-hooks.generator.js.map +1 -0
- package/dist/auth0/generators/react/auth0-hooks/generated/text-templates.d.ts +8 -0
- package/dist/auth0/generators/react/auth0-hooks/generated/text-templates.d.ts.map +1 -0
- package/dist/auth0/generators/react/auth0-hooks/generated/text-templates.js +12 -0
- package/dist/auth0/generators/react/auth0-hooks/generated/text-templates.js.map +1 -0
- package/dist/auth0/generators/react/auth0-hooks/generated/ts-import-maps.d.ts +3 -0
- package/dist/auth0/generators/react/auth0-hooks/generated/ts-import-maps.d.ts.map +1 -0
- package/dist/auth0/generators/react/auth0-hooks/generated/ts-import-maps.js +16 -0
- package/dist/auth0/generators/react/auth0-hooks/generated/ts-import-maps.js.map +1 -0
- package/dist/auth0/generators/react/auth0-hooks/generated/ts-templates.d.ts +33 -0
- package/dist/auth0/generators/react/auth0-hooks/generated/ts-templates.d.ts.map +1 -0
- package/dist/auth0/generators/react/auth0-hooks/generated/ts-templates.js +50 -0
- package/dist/auth0/generators/react/auth0-hooks/generated/ts-templates.js.map +1 -0
- package/dist/auth0/generators/react/auth0-hooks/templates/useCurrentUser.gql +10 -0
- package/dist/auth0/generators/react/auth0-hooks/templates/useCurrentUser.ts +29 -0
- package/dist/auth0/generators/react/auth0-hooks/templates/useLogOut.ts +14 -0
- package/dist/auth0/generators/react/auth0-hooks/templates/useRequiredUserId.ts +11 -0
- package/dist/auth0/generators/react/auth0-hooks/templates/useSession.ts +23 -0
- package/dist/auth0/generators/react/index.d.ts +6 -0
- package/dist/auth0/generators/react/index.d.ts.map +1 -0
- package/dist/auth0/generators/react/index.js +6 -0
- package/dist/auth0/generators/react/index.js.map +1 -0
- package/dist/auth0/generators/react/react-auth0/react-auth0.generator.d.ts +23 -0
- package/dist/auth0/generators/react/react-auth0/react-auth0.generator.d.ts.map +1 -0
- package/dist/auth0/generators/react/react-auth0/react-auth0.generator.js +64 -0
- package/dist/auth0/generators/react/react-auth0/react-auth0.generator.js.map +1 -0
- package/dist/auth0/metadata.json +8 -0
- package/dist/auth0/static/icon.svg +7 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/roles/constants.d.ts +4 -0
- package/dist/roles/constants.d.ts.map +1 -0
- package/dist/roles/constants.js +25 -0
- package/dist/roles/constants.js.map +1 -0
- package/dist/roles/index.d.ts +3 -0
- package/dist/roles/index.d.ts.map +1 -0
- package/dist/roles/index.js +3 -0
- package/dist/roles/index.js.map +1 -0
- package/dist/roles/schema.d.ts +65 -0
- package/dist/roles/schema.d.ts.map +1 -0
- package/dist/roles/schema.js +43 -0
- package/dist/roles/schema.js.map +1 -0
- package/dist/utils/cn.d.ts +2 -0
- package/dist/utils/cn.d.ts.map +1 -0
- package/dist/utils/cn.js +2 -0
- package/dist/utils/cn.js.map +1 -0
- package/dist/web/assets/__federation_expose_auth0CoreCommon--n6esVYP.js +54 -0
- package/dist/web/assets/__federation_expose_auth0CoreCommon--n6esVYP.js.map +1 -0
- package/dist/web/assets/__federation_expose_auth0CoreWeb-Ql6gpX5q.js +377 -0
- package/dist/web/assets/__federation_expose_auth0CoreWeb-Ql6gpX5q.js.map +1 -0
- package/dist/web/assets/__federation_fn_import-BiwmVFwy.js +421 -0
- package/dist/web/assets/__federation_fn_import-BiwmVFwy.js.map +1 -0
- package/dist/web/assets/__federation_shared_@baseplate-dev/project-builder-lib/web-CY8oz43s.js +330 -0
- package/dist/web/assets/__federation_shared_@baseplate-dev/project-builder-lib/web-CY8oz43s.js.map +1 -0
- package/dist/web/assets/__federation_shared_@baseplate-dev/project-builder-lib-B62IPizQ.js +10559 -0
- package/dist/web/assets/__federation_shared_@baseplate-dev/project-builder-lib-B62IPizQ.js.map +1 -0
- package/dist/web/assets/__federation_shared_@baseplate-dev/ui-components-BU2QTWNs.js +12718 -0
- package/dist/web/assets/__federation_shared_@baseplate-dev/ui-components-BU2QTWNs.js.map +1 -0
- package/dist/web/assets/__federation_shared_react-dom-Bwq4pLax.js +250 -0
- package/dist/web/assets/__federation_shared_react-dom-Bwq4pLax.js.map +1 -0
- package/dist/web/assets/__federation_shared_react-uocnGSER.js +7 -0
- package/dist/web/assets/__federation_shared_react-uocnGSER.js.map +1 -0
- package/dist/web/assets/__federation_shared_zod-BK7IELHt.js +4380 -0
- package/dist/web/assets/__federation_shared_zod-BK7IELHt.js.map +1 -0
- package/dist/web/assets/index-B1hOKVPw.js +574 -0
- package/dist/web/assets/index-B1hOKVPw.js.map +1 -0
- package/dist/web/assets/index-CgJx-krK.js +95 -0
- package/dist/web/assets/index-CgJx-krK.js.map +1 -0
- package/dist/web/assets/index-l0sNRNKZ.js.map +1 -0
- package/dist/web/assets/index.esm-BcxPd7Ha.js +2584 -0
- package/dist/web/assets/index.esm-BcxPd7Ha.js.map +1 -0
- package/dist/web/assets/model-utils-CbQJy1wE.js +1263 -0
- package/dist/web/assets/model-utils-CbQJy1wE.js.map +1 -0
- package/dist/web/assets/plugin-definition-BQRupXoQ.js +78 -0
- package/dist/web/assets/plugin-definition-BQRupXoQ.js.map +1 -0
- package/dist/web/assets/react-2jQE8aG0.js +47 -0
- package/dist/web/assets/react-2jQE8aG0.js.map +1 -0
- package/dist/web/assets/remoteEntry.js +54 -0
- package/dist/web/assets/remoteEntry.js.map +1 -0
- package/dist/web/assets/style-BdgwWjAf.css +95 -0
- package/dist/web/index.html +24 -0
- package/dist/web-export.d.ts +2 -0
- package/dist/web-export.js +2 -0
- package/dist/web-export.js.map +1 -0
- package/manifest.json +4 -0
- package/package.json +80 -0
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
export function createAuthModels({ authFeatureRef, modelRefs, }) {
|
|
2
|
+
return {
|
|
3
|
+
user: {
|
|
4
|
+
name: modelRefs.user,
|
|
5
|
+
featureRef: authFeatureRef,
|
|
6
|
+
model: {
|
|
7
|
+
fields: [
|
|
8
|
+
{
|
|
9
|
+
name: 'id',
|
|
10
|
+
type: 'uuid',
|
|
11
|
+
options: { genUuid: true },
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
name: 'email',
|
|
15
|
+
type: 'string',
|
|
16
|
+
isOptional: true,
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
name: 'phone',
|
|
20
|
+
type: 'string',
|
|
21
|
+
isOptional: true,
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: 'updatedAt',
|
|
25
|
+
type: 'dateTime',
|
|
26
|
+
options: { defaultToNow: true, updatedAt: true },
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: 'createdAt',
|
|
30
|
+
type: 'dateTime',
|
|
31
|
+
options: { defaultToNow: true },
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
primaryKeyFieldRefs: ['id'],
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
userAccount: {
|
|
38
|
+
name: modelRefs.userAccount,
|
|
39
|
+
featureRef: authFeatureRef,
|
|
40
|
+
model: {
|
|
41
|
+
fields: [
|
|
42
|
+
{
|
|
43
|
+
name: 'id',
|
|
44
|
+
type: 'uuid',
|
|
45
|
+
options: { genUuid: true },
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: 'userId',
|
|
49
|
+
type: 'uuid',
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: 'providerType',
|
|
53
|
+
type: 'string',
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: 'providerId',
|
|
57
|
+
type: 'string',
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: 'providerSecret',
|
|
61
|
+
type: 'string',
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: 'createdAt',
|
|
65
|
+
type: 'dateTime',
|
|
66
|
+
options: { defaultToNow: true },
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: 'updatedAt',
|
|
70
|
+
type: 'dateTime',
|
|
71
|
+
options: { defaultToNow: true, updatedAt: true },
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
primaryKeyFieldRefs: ['id'],
|
|
75
|
+
uniqueConstraints: [
|
|
76
|
+
{
|
|
77
|
+
fields: [{ fieldRef: 'providerType' }, { fieldRef: 'providerId' }],
|
|
78
|
+
},
|
|
79
|
+
],
|
|
80
|
+
relations: [
|
|
81
|
+
{
|
|
82
|
+
name: 'user',
|
|
83
|
+
references: [{ localRef: 'userId', foreignRef: 'id' }],
|
|
84
|
+
modelRef: modelRefs.user,
|
|
85
|
+
foreignRelationName: 'authProviders',
|
|
86
|
+
onDelete: 'Cascade',
|
|
87
|
+
onUpdate: 'Restrict',
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
userRole: {
|
|
93
|
+
name: modelRefs.userRole,
|
|
94
|
+
featureRef: authFeatureRef,
|
|
95
|
+
model: {
|
|
96
|
+
fields: [
|
|
97
|
+
{
|
|
98
|
+
name: 'userId',
|
|
99
|
+
type: 'uuid',
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
name: 'role',
|
|
103
|
+
type: 'string',
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
name: 'updatedAt',
|
|
107
|
+
type: 'dateTime',
|
|
108
|
+
options: { defaultToNow: true, updatedAt: true },
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
name: 'createdAt',
|
|
112
|
+
type: 'dateTime',
|
|
113
|
+
options: { defaultToNow: true },
|
|
114
|
+
},
|
|
115
|
+
],
|
|
116
|
+
primaryKeyFieldRefs: ['userId', 'role'],
|
|
117
|
+
relations: [
|
|
118
|
+
{
|
|
119
|
+
name: 'user',
|
|
120
|
+
references: [{ localRef: 'userId', foreignRef: 'id' }],
|
|
121
|
+
modelRef: modelRefs.user,
|
|
122
|
+
foreignRelationName: 'roles',
|
|
123
|
+
onDelete: 'Cascade',
|
|
124
|
+
onUpdate: 'Restrict',
|
|
125
|
+
},
|
|
126
|
+
],
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
userSession: {
|
|
130
|
+
name: modelRefs.userSession,
|
|
131
|
+
featureRef: authFeatureRef,
|
|
132
|
+
model: {
|
|
133
|
+
fields: [
|
|
134
|
+
{
|
|
135
|
+
name: 'id',
|
|
136
|
+
type: 'uuid',
|
|
137
|
+
options: { genUuid: true },
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
name: 'token',
|
|
141
|
+
type: 'string',
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
name: 'userId',
|
|
145
|
+
type: 'uuid',
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
name: 'expiresAt',
|
|
149
|
+
type: 'dateTime',
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
name: 'renewedAt',
|
|
153
|
+
type: 'dateTime',
|
|
154
|
+
options: { defaultToNow: true },
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
name: 'createdAt',
|
|
158
|
+
type: 'dateTime',
|
|
159
|
+
options: { defaultToNow: true },
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
name: 'updatedAt',
|
|
163
|
+
type: 'dateTime',
|
|
164
|
+
options: { defaultToNow: true, updatedAt: true },
|
|
165
|
+
},
|
|
166
|
+
],
|
|
167
|
+
primaryKeyFieldRefs: ['id'],
|
|
168
|
+
uniqueConstraints: [
|
|
169
|
+
{
|
|
170
|
+
fields: [{ fieldRef: 'token' }],
|
|
171
|
+
},
|
|
172
|
+
],
|
|
173
|
+
relations: [
|
|
174
|
+
{
|
|
175
|
+
name: 'user',
|
|
176
|
+
references: [{ localRef: 'userId', foreignRef: 'id' }],
|
|
177
|
+
modelRef: modelRefs.user,
|
|
178
|
+
foreignRelationName: 'sessions',
|
|
179
|
+
onDelete: 'Cascade',
|
|
180
|
+
onUpdate: 'Restrict',
|
|
181
|
+
},
|
|
182
|
+
],
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
//# sourceMappingURL=models.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../../../src/auth/core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QAAQ,EAAE,OAAO,EAAE,CAAC;qBAChC;iBACF;gBACD,SAAS,EAAE;oBACT;wBACE,IAAI,EAAE,MAAM;wBACZ,UAAU,EAAE,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;wBACtD,QAAQ,EAAE,SAAS,CAAC,IAAI;wBACxB,mBAAmB,EAAE,UAAU;wBAC/B,QAAQ,EAAE,SAAS;wBACnB,QAAQ,EAAE,UAAU;qBACrB;iBACF;aACF;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const authPluginDefinitionSchema: z.ZodObject<{
|
|
3
|
+
modelRefs: z.ZodObject<{
|
|
4
|
+
user: import("@baseplate-dev/project-builder-lib").ZodRef<z.ZodString>;
|
|
5
|
+
userAccount: import("@baseplate-dev/project-builder-lib").ZodRef<z.ZodString>;
|
|
6
|
+
userRole: import("@baseplate-dev/project-builder-lib").ZodRef<z.ZodString>;
|
|
7
|
+
userSession: import("@baseplate-dev/project-builder-lib").ZodRef<z.ZodString>;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
user: string;
|
|
10
|
+
userAccount: string;
|
|
11
|
+
userRole: string;
|
|
12
|
+
userSession: string;
|
|
13
|
+
}, {
|
|
14
|
+
user: string;
|
|
15
|
+
userAccount: string;
|
|
16
|
+
userRole: string;
|
|
17
|
+
userSession: string;
|
|
18
|
+
}>;
|
|
19
|
+
authFeatureRef: import("@baseplate-dev/project-builder-lib").ZodRef<z.ZodString>;
|
|
20
|
+
roles: z.ZodEffects<z.ZodEffects<z.ZodArray<import("@baseplate-dev/project-builder-lib").ZodRef<z.ZodObject<{
|
|
21
|
+
name: z.ZodString;
|
|
22
|
+
comment: z.ZodString;
|
|
23
|
+
builtIn: z.ZodDefault<z.ZodBoolean>;
|
|
24
|
+
} & {
|
|
25
|
+
id: z.ZodType<string, z.ZodAnyDef, string>;
|
|
26
|
+
}, "strip", z.ZodTypeAny, {
|
|
27
|
+
id: string;
|
|
28
|
+
name: string;
|
|
29
|
+
comment: string;
|
|
30
|
+
builtIn: boolean;
|
|
31
|
+
}, {
|
|
32
|
+
id: string;
|
|
33
|
+
name: string;
|
|
34
|
+
comment: string;
|
|
35
|
+
builtIn?: boolean | undefined;
|
|
36
|
+
}>>, "many">, {
|
|
37
|
+
id: string;
|
|
38
|
+
name: string;
|
|
39
|
+
comment: string;
|
|
40
|
+
builtIn: boolean;
|
|
41
|
+
}[], {
|
|
42
|
+
id: string;
|
|
43
|
+
name: string;
|
|
44
|
+
comment: string;
|
|
45
|
+
builtIn?: boolean | undefined;
|
|
46
|
+
}[]>, {
|
|
47
|
+
id: string;
|
|
48
|
+
name: string;
|
|
49
|
+
comment: string;
|
|
50
|
+
builtIn: boolean;
|
|
51
|
+
}[], {
|
|
52
|
+
id: string;
|
|
53
|
+
name: string;
|
|
54
|
+
comment: string;
|
|
55
|
+
builtIn?: boolean | undefined;
|
|
56
|
+
}[]>;
|
|
57
|
+
}, "strip", z.ZodTypeAny, {
|
|
58
|
+
modelRefs: {
|
|
59
|
+
user: string;
|
|
60
|
+
userAccount: string;
|
|
61
|
+
userRole: string;
|
|
62
|
+
userSession: string;
|
|
63
|
+
};
|
|
64
|
+
authFeatureRef: string;
|
|
65
|
+
roles: {
|
|
66
|
+
id: string;
|
|
67
|
+
name: string;
|
|
68
|
+
comment: string;
|
|
69
|
+
builtIn: boolean;
|
|
70
|
+
}[];
|
|
71
|
+
}, {
|
|
72
|
+
modelRefs: {
|
|
73
|
+
user: string;
|
|
74
|
+
userAccount: string;
|
|
75
|
+
userRole: string;
|
|
76
|
+
userSession: string;
|
|
77
|
+
};
|
|
78
|
+
authFeatureRef: string;
|
|
79
|
+
roles: {
|
|
80
|
+
id: string;
|
|
81
|
+
name: string;
|
|
82
|
+
comment: string;
|
|
83
|
+
builtIn?: boolean | undefined;
|
|
84
|
+
}[];
|
|
85
|
+
}>;
|
|
86
|
+
export type AuthPluginDefinition = z.infer<typeof authPluginDefinitionSchema>;
|
|
87
|
+
export type AuthPluginDefinitionInput = z.input<typeof authPluginDefinitionSchema>;
|
|
88
|
+
//# sourceMappingURL=plugin-definition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-definition.d.ts","sourceRoot":"","sources":["../../../../src/auth/core/schema/plugin-definition.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;YA+B21b,EAAG,OAAO,SAAQ,EAAG,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAP95b,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE9E,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAC7C,OAAO,0BAA0B,CAClC,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { featureEntityType, modelEntityType, zRef, } from '@baseplate-dev/project-builder-lib';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { authRolesSchema } from '#src/roles/index.js';
|
|
4
|
+
export const authPluginDefinitionSchema = z.object({
|
|
5
|
+
modelRefs: z.object({
|
|
6
|
+
user: zRef(z.string().min(1), {
|
|
7
|
+
type: modelEntityType,
|
|
8
|
+
onDelete: 'RESTRICT',
|
|
9
|
+
}),
|
|
10
|
+
userAccount: zRef(z.string().min(1), {
|
|
11
|
+
type: modelEntityType,
|
|
12
|
+
onDelete: 'RESTRICT',
|
|
13
|
+
}),
|
|
14
|
+
userRole: zRef(z.string().min(1), {
|
|
15
|
+
type: modelEntityType,
|
|
16
|
+
onDelete: 'RESTRICT',
|
|
17
|
+
}),
|
|
18
|
+
userSession: zRef(z.string().min(1), {
|
|
19
|
+
type: modelEntityType,
|
|
20
|
+
onDelete: 'RESTRICT',
|
|
21
|
+
}),
|
|
22
|
+
}),
|
|
23
|
+
authFeatureRef: zRef(z.string().min(1), {
|
|
24
|
+
type: featureEntityType,
|
|
25
|
+
onDelete: 'RESTRICT',
|
|
26
|
+
}),
|
|
27
|
+
roles: authRolesSchema,
|
|
28
|
+
});
|
|
29
|
+
//# sourceMappingURL=plugin-definition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-definition.js","sourceRoot":"","sources":["../../../../src/auth/core/schema/plugin-definition.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,IAAI,GACL,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IACjD,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC;QAClB,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;YAC5B,IAAI,EAAE,eAAe;YACrB,QAAQ,EAAE,UAAU;SACrB,CAAC;QACF,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;YACnC,IAAI,EAAE,eAAe;YACrB,QAAQ,EAAE,UAAU;SACrB,CAAC;QACF,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;YAChC,IAAI,EAAE,eAAe;YACrB,QAAQ,EAAE,UAAU;SACrB,CAAC;QACF,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;YACnC,IAAI,EAAE,eAAe;YACrB,QAAQ,EAAE,UAAU;SACrB,CAAC;KACH,CAAC;IACF,cAAc,EAAE,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;QACtC,IAAI,EAAE,iBAAiB;QACvB,QAAQ,EAAE,UAAU;KACrB,CAAC;IACF,KAAK,EAAE,eAAe;CACvB,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import '../../styles.css';
|
|
2
|
+
declare const _default: import("@baseplate-dev/project-builder-lib").PluginPlatformModule<{
|
|
3
|
+
webConfig: import("@baseplate-dev/project-builder-lib").PluginSpecWithInitializer<import("@baseplate-dev/project-builder-lib").WebConfigSpec>;
|
|
4
|
+
}, {}>;
|
|
5
|
+
export default _default;
|
|
6
|
+
//# sourceMappingURL=web.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web.d.ts","sourceRoot":"","sources":["../../../src/auth/core/web.ts"],"names":[],"mappings":"AAOA,OAAO,kBAAkB,CAAC;;;;AAE1B,wBASG"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createPlatformPluginExport, webConfigSpec, } from '@baseplate-dev/project-builder-lib';
|
|
2
|
+
import { AuthDefinitionEditor } from './components/auth-definition-editor.js';
|
|
3
|
+
import '../../styles.css';
|
|
4
|
+
export default createPlatformPluginExport({
|
|
5
|
+
dependencies: {
|
|
6
|
+
webConfig: webConfigSpec,
|
|
7
|
+
},
|
|
8
|
+
exports: {},
|
|
9
|
+
initialize: ({ webConfig }, { pluginId }) => {
|
|
10
|
+
webConfig.registerWebConfigComponent(pluginId, AuthDefinitionEditor);
|
|
11
|
+
return {};
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
//# sourceMappingURL=web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../../src/auth/core/web.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAC1B,aAAa,GACd,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAE9E,OAAO,kBAAkB,CAAC;AAE1B,eAAe,0BAA0B,CAAC;IACxC,YAAY,EAAE;QACZ,SAAS,EAAE,aAAa;KACzB;IACD,OAAO,EAAE,EAAE;IACX,UAAU,EAAE,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;QAC1C,SAAS,CAAC,0BAA0B,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAC;QACrE,OAAO,EAAE,CAAC;IACZ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export declare const authModuleGenerator: import("@baseplate-dev/sync").GeneratorBundleCreator<{
|
|
2
|
+
userSessionModelName: string;
|
|
3
|
+
}, {
|
|
4
|
+
config: import("@baseplate-dev/sync").GeneratorTask<undefined, {
|
|
5
|
+
provider: import("@baseplate-dev/sync").ProviderType<Omit<import("@baseplate-dev/utils").FieldMap<{
|
|
6
|
+
configFields: import("@baseplate-dev/utils").MapContainer<string, import("@baseplate-dev/fastify-generators").ConfigServiceField>;
|
|
7
|
+
}>, "getValues">>;
|
|
8
|
+
}, undefined>;
|
|
9
|
+
main: import("@baseplate-dev/sync").GeneratorTask<any, {
|
|
10
|
+
typescriptFile: import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/core-generators").TypescriptFileProvider>;
|
|
11
|
+
authRolesImports: import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/core-generators").InferTsImportMapFromSchema<{
|
|
12
|
+
AuthRole: {
|
|
13
|
+
isTypeOnly: true;
|
|
14
|
+
};
|
|
15
|
+
DEFAULT_PUBLIC_ROLES: {};
|
|
16
|
+
DEFAULT_USER_ROLES: {};
|
|
17
|
+
RoleConfig: {
|
|
18
|
+
isTypeOnly: true;
|
|
19
|
+
};
|
|
20
|
+
}>>;
|
|
21
|
+
appModule: import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/fastify-generators").AppModuleProvider>;
|
|
22
|
+
configServiceImports: import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/core-generators").InferTsImportMapFromSchema<{
|
|
23
|
+
config: {};
|
|
24
|
+
}>>;
|
|
25
|
+
prismaOutput: import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/fastify-generators").PrismaOutputProvider>;
|
|
26
|
+
userSessionTypesImports: import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/core-generators").InferTsImportMapFromSchema<{
|
|
27
|
+
UserSessionPayload: {
|
|
28
|
+
isTypeOnly: true;
|
|
29
|
+
};
|
|
30
|
+
UserSessionService: {
|
|
31
|
+
isTypeOnly: true;
|
|
32
|
+
};
|
|
33
|
+
}>>;
|
|
34
|
+
authContextImports: import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/core-generators").InferTsImportMapFromSchema<{
|
|
35
|
+
AuthContext: {
|
|
36
|
+
isTypeOnly: true;
|
|
37
|
+
};
|
|
38
|
+
AuthSessionInfo: {
|
|
39
|
+
isTypeOnly: true;
|
|
40
|
+
};
|
|
41
|
+
AuthUserSessionInfo: {
|
|
42
|
+
isTypeOnly: true;
|
|
43
|
+
};
|
|
44
|
+
createAuthContextFromSessionInfo: {};
|
|
45
|
+
InvalidSessionError: {};
|
|
46
|
+
}>>;
|
|
47
|
+
errorHandlerServiceImports: import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/core-generators").InferTsImportMapFromSchema<{
|
|
48
|
+
BadRequestError: {};
|
|
49
|
+
ForbiddenError: {};
|
|
50
|
+
handleZodRequestValidationError: {};
|
|
51
|
+
HttpError: {};
|
|
52
|
+
InternalServerError: {};
|
|
53
|
+
logError: {};
|
|
54
|
+
NotFoundError: {};
|
|
55
|
+
UnauthorizedError: {};
|
|
56
|
+
}>>;
|
|
57
|
+
requestServiceContextImports: import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/core-generators").InferTsImportMapFromSchema<{
|
|
58
|
+
createContextFromRequest: {};
|
|
59
|
+
RequestServiceContext: {
|
|
60
|
+
isTypeOnly: true;
|
|
61
|
+
};
|
|
62
|
+
}>>;
|
|
63
|
+
}, any>;
|
|
64
|
+
}>;
|
|
65
|
+
//# sourceMappingURL=auth-module.generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-module.generator.d.ts","sourceRoot":"","sources":["../../../../../src/auth/generators/fastify/auth-module/auth-module.generator.ts"],"names":[],"mappings":"AA4BA,eAAO,MAAM,mBAAmB;;;;;iCAEpB,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmEhC,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { tsCodeFragment, typescriptFileProvider, } from '@baseplate-dev/core-generators';
|
|
2
|
+
import { appModuleProvider, authContextImportsProvider, authRolesImportsProvider, configServiceImportsProvider, configServiceProvider, errorHandlerServiceImportsProvider, prismaOutputProvider, requestServiceContextImportsProvider, userSessionTypesImportsProvider, } from '@baseplate-dev/fastify-generators';
|
|
3
|
+
import { createGenerator, createGeneratorTask, createProviderTask, } from '@baseplate-dev/sync';
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import { FASTIFY_AUTH_MODULE_TS_TEMPLATES } from './generated/ts-templates.js';
|
|
6
|
+
const descriptorSchema = z.object({
|
|
7
|
+
userSessionModelName: z.string().min(1),
|
|
8
|
+
});
|
|
9
|
+
export const authModuleGenerator = createGenerator({
|
|
10
|
+
name: 'auth/auth-module',
|
|
11
|
+
generatorFileUrl: import.meta.url,
|
|
12
|
+
descriptorSchema,
|
|
13
|
+
buildTasks: ({ userSessionModelName }) => ({
|
|
14
|
+
config: createProviderTask(configServiceProvider, (configService) => {
|
|
15
|
+
configService.configFields.set('AUTH_SECRET', {
|
|
16
|
+
validator: tsCodeFragment('z.string().regex(/^[a-zA-Z0-9-_+=/]{20,}$/)'),
|
|
17
|
+
comment: 'Secret key for signing auth cookie (at least 20 alphanumeric characters)',
|
|
18
|
+
seedValue: 'a-secret-key-1234567890',
|
|
19
|
+
exampleValue: '<AUTH_SECRET>',
|
|
20
|
+
});
|
|
21
|
+
}),
|
|
22
|
+
main: createGeneratorTask({
|
|
23
|
+
dependencies: {
|
|
24
|
+
typescriptFile: typescriptFileProvider,
|
|
25
|
+
authRolesImports: authRolesImportsProvider,
|
|
26
|
+
appModule: appModuleProvider,
|
|
27
|
+
configServiceImports: configServiceImportsProvider,
|
|
28
|
+
prismaOutput: prismaOutputProvider,
|
|
29
|
+
userSessionTypesImports: userSessionTypesImportsProvider,
|
|
30
|
+
authContextImports: authContextImportsProvider,
|
|
31
|
+
errorHandlerServiceImports: errorHandlerServiceImportsProvider,
|
|
32
|
+
requestServiceContextImports: requestServiceContextImportsProvider,
|
|
33
|
+
},
|
|
34
|
+
run({ typescriptFile, authRolesImports, prismaOutput, configServiceImports, appModule, userSessionTypesImports, authContextImports, errorHandlerServiceImports, requestServiceContextImports, }) {
|
|
35
|
+
const userSessionServicePath = `${appModule.getModuleFolder()}/services/user-session.service.ts`;
|
|
36
|
+
return {
|
|
37
|
+
providers: {
|
|
38
|
+
authModule: {},
|
|
39
|
+
},
|
|
40
|
+
build: async (builder) => {
|
|
41
|
+
await builder.apply(typescriptFile.renderTemplateFile({
|
|
42
|
+
template: FASTIFY_AUTH_MODULE_TS_TEMPLATES.servicesUserSessionService,
|
|
43
|
+
destination: userSessionServicePath,
|
|
44
|
+
variables: {
|
|
45
|
+
TPL_PRISMA_USER_SESSION: prismaOutput.getPrismaModelFragment(userSessionModelName),
|
|
46
|
+
},
|
|
47
|
+
importMapProviders: {
|
|
48
|
+
configServiceImports,
|
|
49
|
+
authContextImports,
|
|
50
|
+
authRolesImports,
|
|
51
|
+
userSessionTypesImports,
|
|
52
|
+
errorHandlerServiceImports,
|
|
53
|
+
requestServiceContextImports,
|
|
54
|
+
},
|
|
55
|
+
}));
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
},
|
|
59
|
+
}),
|
|
60
|
+
}),
|
|
61
|
+
});
|
|
62
|
+
//# sourceMappingURL=auth-module.generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-module.generator.js","sourceRoot":"","sources":["../../../../../src/auth/generators/fastify/auth-module/auth-module.generator.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,sBAAsB,GACvB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,iBAAiB,EACjB,0BAA0B,EAC1B,wBAAwB,EACxB,4BAA4B,EAC5B,qBAAqB,EACrB,kCAAkC,EAClC,oBAAoB,EACpB,oCAAoC,EACpC,+BAA+B,GAChC,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,gCAAgC,EAAE,MAAM,6BAA6B,CAAC;AAE/E,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChC,oBAAoB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACxC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG,eAAe,CAAC;IACjD,IAAI,EAAE,kBAAkB;IACxB,gBAAgB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG;IACjC,gBAAgB;IAChB,UAAU,EAAE,CAAC,EAAE,oBAAoB,EAAE,EAAE,EAAE,CAAC,CAAC;QACzC,MAAM,EAAE,kBAAkB,CAAC,qBAAqB,EAAE,CAAC,aAAa,EAAE,EAAE;YAClE,aAAa,CAAC,YAAY,CAAC,GAAG,CAAC,aAAa,EAAE;gBAC5C,SAAS,EAAE,cAAc,CACvB,6CAA6C,CAC9C;gBACD,OAA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|
1
|
+
export declare const FASTIFY_AUTH_MODULE_TS_TEMPLATES: {
|
|
2
|
+
schemaGroup: import("@baseplate-dev/core-generators").TsTemplateGroup<{
|
|
3
|
+
schemaUserSessionMutations: {
|
|
4
|
+
destination: string;
|
|
5
|
+
template: import("@baseplate-dev/core-generators").TsTemplateFile<{}, {
|
|
6
|
+
pothosImports: import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/core-generators").InferTsImportMapFromSchema<{
|
|
7
|
+
builder: {};
|
|
8
|
+
}>>;
|
|
9
|
+
}>;
|
|
10
|
+
};
|
|
11
|
+
schemaUserSessionQueries: {
|
|
12
|
+
destination: string;
|
|
13
|
+
template: import("@baseplate-dev/core-generators").TsTemplateFile<{
|
|
14
|
+
TPL_PRISMA_USER: {};
|
|
15
|
+
}, {
|
|
16
|
+
pothosImports: import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/core-generators").InferTsImportMapFromSchema<{
|
|
17
|
+
builder: {};
|
|
18
|
+
}>>;
|
|
19
|
+
}>;
|
|
20
|
+
};
|
|
21
|
+
userSessionPayloadObjectType: {
|
|
22
|
+
destination: string;
|
|
23
|
+
template: import("@baseplate-dev/core-generators").TsTemplateFile<{
|
|
24
|
+
TPL_PRISMA_USER: {};
|
|
25
|
+
TPL_USER_OBJECT_TYPE: {};
|
|
26
|
+
}, {
|
|
27
|
+
pothosImports: import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/core-generators").InferTsImportMapFromSchema<{
|
|
28
|
+
builder: {};
|
|
29
|
+
}>>;
|
|
30
|
+
}>;
|
|
31
|
+
};
|
|
32
|
+
}>;
|
|
33
|
+
servicesUserSessionService: import("@baseplate-dev/core-generators").TsTemplateFile<{
|
|
34
|
+
TPL_PRISMA_USER_SESSION: {};
|
|
35
|
+
}, {
|
|
36
|
+
authContextImports: import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/core-generators").InferTsImportMapFromSchema<{
|
|
37
|
+
AuthContext: {
|
|
38
|
+
isTypeOnly: true;
|
|
39
|
+
};
|
|
40
|
+
AuthSessionInfo: {
|
|
41
|
+
isTypeOnly: true;
|
|
42
|
+
};
|
|
43
|
+
AuthUserSessionInfo: {
|
|
44
|
+
isTypeOnly: true;
|
|
45
|
+
};
|
|
46
|
+
createAuthContextFromSessionInfo: {};
|
|
47
|
+
InvalidSessionError: {};
|
|
48
|
+
}>>;
|
|
49
|
+
authRolesImports: import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/core-generators").InferTsImportMapFromSchema<{
|
|
50
|
+
AuthRole: {
|
|
51
|
+
isTypeOnly: true;
|
|
52
|
+
};
|
|
53
|
+
DEFAULT_PUBLIC_ROLES: {};
|
|
54
|
+
DEFAULT_USER_ROLES: {};
|
|
55
|
+
RoleConfig: {
|
|
56
|
+
isTypeOnly: true;
|
|
57
|
+
};
|
|
58
|
+
}>>;
|
|
59
|
+
configServiceImports: import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/core-generators").InferTsImportMapFromSchema<{
|
|
60
|
+
config: {};
|
|
61
|
+
}>>;
|
|
62
|
+
errorHandlerServiceImports: import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/core-generators").InferTsImportMapFromSchema<{
|
|
63
|
+
BadRequestError: {};
|
|
64
|
+
ForbiddenError: {};
|
|
65
|
+
handleZodRequestValidationError: {};
|
|
66
|
+
HttpError: {};
|
|
67
|
+
InternalServerError: {};
|
|
68
|
+
logError: {};
|
|
69
|
+
NotFoundError: {};
|
|
70
|
+
UnauthorizedError: {};
|
|
71
|
+
}>>;
|
|
72
|
+
requestServiceContextImports: import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/core-generators").InferTsImportMapFromSchema<{
|
|
73
|
+
createContextFromRequest: {};
|
|
74
|
+
RequestServiceContext: {
|
|
75
|
+
isTypeOnly: true;
|
|
76
|
+
};
|
|
77
|
+
}>>;
|
|
78
|
+
userSessionTypesImports: import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/core-generators").InferTsImportMapFromSchema<{
|
|
79
|
+
UserSessionPayload: {
|
|
80
|
+
isTypeOnly: true;
|
|
81
|
+
};
|
|
82
|
+
UserSessionService: {
|
|
83
|
+
isTypeOnly: true;
|
|
84
|
+
};
|
|
85
|
+
}>>;
|
|
86
|
+
}>;
|
|
87
|
+
userSessionConstants: import("@baseplate-dev/core-generators").TsTemplateFile<{}, Record<never, import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/sync").Provider>>>;
|
|
88
|
+
utilsCookieSigner: import("@baseplate-dev/core-generators").TsTemplateFile<{}, Record<never, import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/sync").Provider>>>;
|
|
89
|
+
utilsSessionCookie: import("@baseplate-dev/core-generators").TsTemplateFile<{}, {
|
|
90
|
+
configServiceImports: import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/core-generators").InferTsImportMapFromSchema<{
|
|
91
|
+
config: {};
|
|
92
|
+
}>>;
|
|
93
|
+
}>;
|
|
94
|
+
utilsVerifyRequestOrigin: import("@baseplate-dev/core-generators").TsTemplateFile<{}, Record<never, import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/sync").Provider>>>;
|
|
95
|
+
};
|
|
96
|
+
//# sourceMappingURL=ts-templates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ts-templates.d.ts","sourceRoot":"","sources":["../../../../../../src/auth/generators/fastify/auth-module/generated/ts-templates.ts"],"names":[],"mappings":"AA0GA,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAO5C,CAAC"}
|