@absolutejs/auth 0.65.1 → 0.65.3
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/dist/abuse/captcha.d.ts +11 -0
- package/dist/abuse/config.d.ts +29 -0
- package/dist/actions.d.ts +27 -0
- package/dist/adaptive/config.d.ts +34 -0
- package/dist/adaptive/fingerprint.d.ts +2 -0
- package/dist/adaptive/inMemoryStores.d.ts +3 -0
- package/dist/adaptive/postgresStores.d.ts +245 -0
- package/dist/adaptive/types.d.ts +62 -0
- package/dist/agents/config.d.ts +49 -0
- package/dist/agents/context.d.ts +46 -0
- package/dist/agents/idJag.d.ts +49 -0
- package/dist/agents/inMemoryStores.d.ts +4 -0
- package/dist/agents/index.d.ts +13 -0
- package/dist/agents/oauthGuide.d.ts +18 -0
- package/dist/agents/oidcAdapter.d.ts +20 -0
- package/dist/agents/postgresStores.d.ts +1176 -0
- package/dist/agents/principal.d.ts +4 -0
- package/dist/agents/registration.d.ts +162 -0
- package/dist/agents/registrationClient.d.ts +50 -0
- package/dist/agents/routes.d.ts +256 -0
- package/dist/agents/types.d.ts +129 -0
- package/dist/apikeys/config.d.ts +64 -0
- package/dist/apikeys/inMemoryStores.d.ts +4 -0
- package/dist/apikeys/postgresStores.d.ts +359 -0
- package/dist/apikeys/routes.d.ts +83 -0
- package/dist/apikeys/types.d.ts +53 -0
- package/dist/audit/config.d.ts +9 -0
- package/dist/audit/export.d.ts +2 -0
- package/dist/audit/inMemoryAuditStore.d.ts +2 -0
- package/dist/audit/integrity.d.ts +19 -0
- package/dist/audit/postgresAuditStore.d.ts +116 -0
- package/dist/audit/siem.d.ts +11 -0
- package/dist/audit/types.d.ts +21 -0
- package/dist/audit/wrap.d.ts +11 -0
- package/dist/authContext.d.ts +193 -0
- package/dist/authorization/config.d.ts +19 -0
- package/dist/authorization/protectPermission.d.ts +52 -0
- package/dist/cli/import/auth0.d.ts +2 -0
- package/dist/cli/import/clerk.d.ts +2 -0
- package/dist/cli/import/index.d.ts +10 -0
- package/dist/cli/import/lucia.d.ts +2 -0
- package/dist/cli/import/nextauth.d.ts +2 -0
- package/dist/cli/import/supabase.d.ts +2 -0
- package/dist/cli/import/types.d.ts +27 -0
- package/dist/cli/migrate.d.ts +2 -0
- package/dist/cli/migrate.js.map +2 -2
- package/dist/client/components/react/SignIn.d.ts +32 -0
- package/dist/client/components/react/SignUp.d.ts +29 -0
- package/dist/client/components/react/UserButton.d.ts +36 -0
- package/dist/client/createAuthClient.d.ts +285 -0
- package/dist/client/index.d.ts +4 -0
- package/dist/client/passkeyHelpers.d.ts +19 -0
- package/dist/client/react.d.ts +87 -0
- package/dist/client/sessionExpiry.d.ts +37 -0
- package/dist/client/solid.d.ts +86 -0
- package/dist/client/svelte.d.ts +86 -0
- package/dist/client/vue.d.ts +88 -0
- package/dist/compliance/cipher.d.ts +11 -0
- package/dist/compliance/config.d.ts +18 -0
- package/dist/compliance/redaction.d.ts +8 -0
- package/dist/compliance/routes.d.ts +89 -0
- package/dist/constants.d.ts +10 -0
- package/dist/credentials/backgroundOps.d.ts +45 -0
- package/dist/credentials/config.d.ts +94 -0
- package/dist/credentials/emailValidation.d.ts +9 -0
- package/dist/credentials/emailVerification.d.ts +83 -0
- package/dist/credentials/import.d.ts +49 -0
- package/dist/credentials/inMemoryCredentialStore.d.ts +2 -0
- package/dist/credentials/legacyHashers.d.ts +3 -0
- package/dist/credentials/login.d.ts +76 -0
- package/dist/credentials/passwordPolicy.d.ts +15 -0
- package/dist/credentials/passwordReset.d.ts +87 -0
- package/dist/credentials/postgresCredentialStore.d.ts +235 -0
- package/dist/credentials/register.d.ts +54 -0
- package/dist/credentials/routes.d.ts +201 -0
- package/dist/credentials/types.d.ts +26 -0
- package/dist/crypto.d.ts +32 -0
- package/dist/csrf.d.ts +10 -0
- package/dist/errors.d.ts +12 -0
- package/dist/federation/tokenStore.d.ts +29 -0
- package/dist/fga/config.d.ts +53 -0
- package/dist/fga/inMemoryStores.d.ts +3 -0
- package/dist/fga/postgresStores.d.ts +116 -0
- package/dist/fga/redisCheckCache.d.ts +11 -0
- package/dist/fga/schema.d.ts +2 -0
- package/dist/fga/types.d.ts +28 -0
- package/dist/fingerprint-client/index.d.ts +26 -0
- package/dist/htmx/configuredRoutes.d.ts +542 -0
- package/dist/htmx/index.d.ts +2 -0
- package/dist/htmx/renderers.d.ts +8 -0
- package/dist/htmx/routes.d.ts +514 -0
- package/dist/htmx/types.d.ts +129 -0
- package/dist/index.d.ts +3647 -0
- package/dist/index.js +34 -4
- package/dist/index.js.map +7 -6
- package/dist/linkedProviders/inMemoryStores.d.ts +9 -0
- package/dist/linkedProviders/index.d.ts +3 -0
- package/dist/linkedProviders/neonStores.d.ts +484 -0
- package/dist/linkedProviders/oauthAccountResolver.d.ts +28 -0
- package/dist/linkedProviders/oauthResolver.d.ts +9 -0
- package/dist/linkedProviders/resolver.d.ts +22 -0
- package/dist/lockout/config.d.ts +17 -0
- package/dist/lockout/inMemoryLockoutStore.d.ts +2 -0
- package/dist/lockout/postgresLockoutStore.d.ts +71 -0
- package/dist/lockout/redisLockoutStore.d.ts +3 -0
- package/dist/lockout/types.d.ts +12 -0
- package/dist/manifest.d.ts +18 -0
- package/dist/manifest.json +373 -0
- package/dist/mfa/backupCodes.d.ts +5 -0
- package/dist/mfa/challenge.d.ts +72 -0
- package/dist/mfa/config.d.ts +59 -0
- package/dist/mfa/gate.d.ts +2 -0
- package/dist/mfa/inMemoryMfaStore.d.ts +2 -0
- package/dist/mfa/management.d.ts +106 -0
- package/dist/mfa/postgresMfaStore.d.ts +266 -0
- package/dist/mfa/recentAuth.d.ts +2 -0
- package/dist/mfa/rotation.d.ts +17 -0
- package/dist/mfa/routes.d.ts +239 -0
- package/dist/mfa/secret.d.ts +2 -0
- package/dist/mfa/sms.d.ts +143 -0
- package/dist/mfa/totp.d.ts +91 -0
- package/dist/mfa/types.d.ts +58 -0
- package/dist/migrations/generate.d.ts +2 -0
- package/dist/migrations/index.d.ts +6 -0
- package/dist/migrations/runner.d.ts +22 -0
- package/dist/migrations/types.d.ts +14 -0
- package/dist/oidc/clientAuth.d.ts +19 -0
- package/dist/oidc/clientIdMetadata.d.ts +28 -0
- package/dist/oidc/config.d.ts +307 -0
- package/dist/oidc/dpop.d.ts +23 -0
- package/dist/oidc/inMemoryStores.d.ts +11 -0
- package/dist/oidc/inMemoryVciStores.d.ts +3 -0
- package/dist/oidc/index.d.ts +12 -0
- package/dist/oidc/jar.d.ts +14 -0
- package/dist/oidc/keys.d.ts +50 -0
- package/dist/oidc/logout.d.ts +38 -0
- package/dist/oidc/mtls.d.ts +11 -0
- package/dist/oidc/operator.d.ts +14 -0
- package/dist/oidc/par.d.ts +28 -0
- package/dist/oidc/postgresStores.d.ts +1217 -0
- package/dist/oidc/registration.d.ts +138 -0
- package/dist/oidc/routes.d.ts +569 -0
- package/dist/oidc/types.d.ts +157 -0
- package/dist/oidc/userinfo.d.ts +21 -0
- package/dist/oidc/vci.d.ts +159 -0
- package/dist/oidc/vciRoutes.d.ts +92 -0
- package/dist/organizations/config.d.ts +46 -0
- package/dist/organizations/inMemoryOrganizationStore.d.ts +2 -0
- package/dist/organizations/operations.d.ts +39 -0
- package/dist/organizations/postgresOrganizationStore.d.ts +340 -0
- package/dist/organizations/routes.d.ts +299 -0
- package/dist/organizations/types.d.ts +45 -0
- package/dist/passwordless/config.d.ts +43 -0
- package/dist/passwordless/inMemoryPasswordlessTokenStore.d.ts +2 -0
- package/dist/passwordless/postgresPasswordlessTokenStore.d.ts +56 -0
- package/dist/passwordless/routes.d.ts +163 -0
- package/dist/passwordless/types.d.ts +9 -0
- package/dist/pluginIdentity.d.ts +2 -0
- package/dist/plugins/denyDisposableEmail.d.ts +7 -0
- package/dist/plugins/discordAlert.d.ts +7 -0
- package/dist/plugins/geoBlock.d.ts +8 -0
- package/dist/plugins/index.d.ts +12 -0
- package/dist/plugins/pagerdutyAlert.d.ts +9 -0
- package/dist/plugins/posthogIdentify.d.ts +7 -0
- package/dist/plugins/slackAlert.d.ts +7 -0
- package/dist/portal/config.d.ts +34 -0
- package/dist/portal/inMemorySetupSessionStore.d.ts +2 -0
- package/dist/portal/operations.d.ts +10 -0
- package/dist/portal/postgresSetupSessionStore.d.ts +116 -0
- package/dist/portal/routes.d.ts +160 -0
- package/dist/portal/types.d.ts +16 -0
- package/dist/providers/clients.d.ts +1831 -0
- package/dist/providers/index.d.ts +2 -0
- package/dist/providersFromEnv.d.ts +19 -0
- package/dist/redirect.d.ts +2 -0
- package/dist/roles/config.d.ts +27 -0
- package/dist/roles/inMemoryRoleStore.d.ts +2 -0
- package/dist/roles/operations.d.ts +8 -0
- package/dist/roles/postgresRoleStore.d.ts +86 -0
- package/dist/roles/resolver.d.ts +17 -0
- package/dist/roles/routes.d.ts +106 -0
- package/dist/roles/types.d.ts +14 -0
- package/dist/routes/authorize.d.ts +102 -0
- package/dist/routes/callback.d.ts +64 -0
- package/dist/routes/profile.d.ts +73 -0
- package/dist/routes/protectRoute.d.ts +51 -0
- package/dist/routes/refresh.d.ts +74 -0
- package/dist/routes/requireAuth.d.ts +43 -0
- package/dist/routes/revoke.d.ts +73 -0
- package/dist/routes/sessions.d.ts +103 -0
- package/dist/routes/signout.d.ts +70 -0
- package/dist/routes/stepUp.d.ts +48 -0
- package/dist/routes/userStatus.d.ts +72 -0
- package/dist/saml.d.ts +1 -0
- package/dist/scim/config.d.ts +57 -0
- package/dist/scim/extensions.d.ts +30 -0
- package/dist/scim/inMemoryScimTokenStore.d.ts +2 -0
- package/dist/scim/postgresScimTokenStore.d.ts +86 -0
- package/dist/scim/routes.d.ts +366 -0
- package/dist/scim/serialize.d.ts +83 -0
- package/dist/scim/types.d.ts +54 -0
- package/dist/server.d.ts +34 -0
- package/dist/server.js +32 -4
- package/dist/server.js.map +7 -6
- package/dist/session/access.d.ts +33 -0
- package/dist/session/anonymous.d.ts +12 -0
- package/dist/session/cleanup.d.ts +45 -0
- package/dist/session/cookieReader.d.ts +10 -0
- package/dist/session/impersonation.d.ts +34 -0
- package/dist/session/inMemoryStore.d.ts +7 -0
- package/dist/session/multiSession.d.ts +27 -0
- package/dist/session/neonStore.d.ts +574 -0
- package/dist/session/promote.d.ts +23 -0
- package/dist/session/redisStore.d.ts +6 -0
- package/dist/session/sessionsConfig.d.ts +9 -0
- package/dist/session/state.d.ts +33 -0
- package/dist/session/types.d.ts +23 -0
- package/dist/session/userSessions.d.ts +19 -0
- package/dist/sso/config.d.ts +149 -0
- package/dist/sso/discoveryRoute.d.ts +63 -0
- package/dist/sso/inMemorySamlServiceProviderStore.d.ts +2 -0
- package/dist/sso/inMemorySsoConnectionStore.d.ts +2 -0
- package/dist/sso/nodeSamlAdapter.d.ts +8 -0
- package/dist/sso/oidcRoutes.d.ts +98 -0
- package/dist/sso/postgresSamlServiceProviderStore.d.ts +101 -0
- package/dist/sso/postgresSsoConnectionStore.d.ts +117 -0
- package/dist/sso/samlIdpRoutes.d.ts +139 -0
- package/dist/sso/samlRoutes.d.ts +179 -0
- package/dist/sso/types.d.ts +53 -0
- package/dist/stores/postgres.d.ts +5 -0
- package/dist/stores/redis.d.ts +5 -0
- package/dist/telemetry/tracing.d.ts +15 -0
- package/dist/tenancy.d.ts +9 -0
- package/dist/typeGuards.d.ts +6 -0
- package/dist/typebox.d.ts +4 -0
- package/dist/types.d.ts +438 -0
- package/dist/utils.d.ts +45 -0
- package/dist/vault/config.d.ts +20 -0
- package/dist/vault/inMemoryVaultStore.d.ts +2 -0
- package/dist/vault/index.d.ts +5 -0
- package/dist/vault/postgresVaultStore.d.ts +86 -0
- package/dist/vault/types.d.ts +14 -0
- package/dist/vc/inMemoryVpStores.d.ts +2 -0
- package/dist/vc/openid4vp.d.ts +82 -0
- package/dist/vc/postgresVcStores.d.ts +300 -0
- package/dist/vc/sdJwt.d.ts +37 -0
- package/dist/vc/statusList.d.ts +29 -0
- package/dist/vc/statusListRoutes.d.ts +63 -0
- package/dist/vc/vpRoutes.d.ts +120 -0
- package/dist/verification/types.d.ts +58 -0
- package/dist/webauthn/adapter.d.ts +59 -0
- package/dist/webauthn/config.d.ts +36 -0
- package/dist/webauthn/inMemoryWebAuthnCredentialStore.d.ts +2 -0
- package/dist/webauthn/postgresWebAuthnCredentialStore.d.ts +146 -0
- package/dist/webauthn/routes.d.ts +155 -0
- package/dist/webauthn/simpleWebAuthnAdapter.d.ts +3 -0
- package/dist/webauthn/types.d.ts +17 -0
- package/dist/webauthn.d.ts +1 -0
- package/dist/webhooks/config.d.ts +34 -0
- package/dist/webhooks/dispatcher.d.ts +3 -0
- package/dist/webhooks/inMemoryStore.d.ts +2 -0
- package/dist/webhooks/postgresStore.d.ts +116 -0
- package/dist/webhooks/sign.d.ts +11 -0
- package/dist/webhooks/types.d.ts +25 -0
- package/package.json +1 -1
|
@@ -0,0 +1,514 @@
|
|
|
1
|
+
import { Elysia } from 'elysia';
|
|
2
|
+
import type { AuthSessionSource } from '../session/types';
|
|
3
|
+
import type { AuthHtmxConfig, AuthHtmxUser } from './types';
|
|
4
|
+
export declare const createAuthHtmxRoutes: <UserType extends AuthHtmxUser>(config: AuthHtmxConfig & {
|
|
5
|
+
authSessionStore?: AuthSessionSource<UserType>;
|
|
6
|
+
}) => Elysia<"", {
|
|
7
|
+
decorator: {};
|
|
8
|
+
store: {
|
|
9
|
+
session: import("..").SessionRecord<UserType>;
|
|
10
|
+
unregisteredSession: import("..").UnregisteredSessionRecord;
|
|
11
|
+
};
|
|
12
|
+
derive: {
|
|
13
|
+
readonly protectRoute: <AuthReturn, AuthFailReturn = never>(handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: ((error: {
|
|
14
|
+
readonly code: "Bad Request";
|
|
15
|
+
readonly message: "Cookies are missing";
|
|
16
|
+
} | {
|
|
17
|
+
readonly code: "Unauthorized";
|
|
18
|
+
readonly message: "User is not authenticated";
|
|
19
|
+
}) => AuthFailReturn) | undefined) => Promise<import("elysia").ElysiaCustomStatusResponse<"Bad Request", "Cookies are missing", 400> | import("elysia").ElysiaCustomStatusResponse<"Unauthorized", "User is not authenticated", 401> | AuthReturn | NonNullable<AuthFailReturn>>;
|
|
20
|
+
};
|
|
21
|
+
resolve: {};
|
|
22
|
+
}, {
|
|
23
|
+
typebox: {};
|
|
24
|
+
error: {};
|
|
25
|
+
}, {
|
|
26
|
+
schema: {};
|
|
27
|
+
standaloneSchema: {};
|
|
28
|
+
macro: {};
|
|
29
|
+
macroFn: {};
|
|
30
|
+
parser: {};
|
|
31
|
+
response: {};
|
|
32
|
+
} & {
|
|
33
|
+
schema: import("elysia").UnwrapRoute<{
|
|
34
|
+
cookie: import("@sinclair/typebox").TObject<{
|
|
35
|
+
user_session_id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TTemplateLiteralSyntax<"${string}-${string}-${string}-${string}-${string}">>;
|
|
36
|
+
}>;
|
|
37
|
+
}, {}, "">;
|
|
38
|
+
standaloneSchema: {};
|
|
39
|
+
macro: {};
|
|
40
|
+
macroFn: {};
|
|
41
|
+
parser: {};
|
|
42
|
+
response: import("elysia").ExtractErrorFromHandle<{
|
|
43
|
+
readonly protectRoute: <AuthReturn, AuthFailReturn = never>(handleAuth: (user: UserType) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: ((error: {
|
|
44
|
+
readonly code: "Bad Request";
|
|
45
|
+
readonly message: "Cookies are missing";
|
|
46
|
+
} | {
|
|
47
|
+
readonly code: "Unauthorized";
|
|
48
|
+
readonly message: "User is not authenticated";
|
|
49
|
+
}) => AuthFailReturn) | undefined) => Promise<import("elysia").ElysiaCustomStatusResponse<"Bad Request", "Cookies are missing", 400> | import("elysia").ElysiaCustomStatusResponse<"Unauthorized", "User is not authenticated", 401> | AuthReturn | NonNullable<AuthFailReturn>>;
|
|
50
|
+
}>;
|
|
51
|
+
}, {
|
|
52
|
+
htmx: {
|
|
53
|
+
login: {
|
|
54
|
+
get: {
|
|
55
|
+
body: unknown;
|
|
56
|
+
params: {};
|
|
57
|
+
query: unknown;
|
|
58
|
+
headers: unknown;
|
|
59
|
+
response: {
|
|
60
|
+
200: Response;
|
|
61
|
+
422: {
|
|
62
|
+
type: "validation";
|
|
63
|
+
on: string;
|
|
64
|
+
summary?: string;
|
|
65
|
+
message?: string;
|
|
66
|
+
found?: unknown;
|
|
67
|
+
property?: string;
|
|
68
|
+
expected?: string;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
} & {
|
|
75
|
+
htmx: {
|
|
76
|
+
link: {
|
|
77
|
+
get: {
|
|
78
|
+
body: unknown;
|
|
79
|
+
params: {};
|
|
80
|
+
query: unknown;
|
|
81
|
+
headers: unknown;
|
|
82
|
+
response: {
|
|
83
|
+
200: Response;
|
|
84
|
+
422: {
|
|
85
|
+
type: "validation";
|
|
86
|
+
on: string;
|
|
87
|
+
summary?: string;
|
|
88
|
+
message?: string;
|
|
89
|
+
found?: unknown;
|
|
90
|
+
property?: string;
|
|
91
|
+
expected?: string;
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
} & {
|
|
98
|
+
htmx: {
|
|
99
|
+
"connector-links": {
|
|
100
|
+
get: {
|
|
101
|
+
body: unknown;
|
|
102
|
+
params: {};
|
|
103
|
+
query: unknown;
|
|
104
|
+
headers: unknown;
|
|
105
|
+
response: {
|
|
106
|
+
200: Response;
|
|
107
|
+
422: {
|
|
108
|
+
type: "validation";
|
|
109
|
+
on: string;
|
|
110
|
+
summary?: string;
|
|
111
|
+
message?: string;
|
|
112
|
+
found?: unknown;
|
|
113
|
+
property?: string;
|
|
114
|
+
expected?: string;
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
} & {
|
|
121
|
+
htmx: {
|
|
122
|
+
"auth-menu": {
|
|
123
|
+
get: {
|
|
124
|
+
body: unknown;
|
|
125
|
+
params: {};
|
|
126
|
+
query: unknown;
|
|
127
|
+
headers: unknown;
|
|
128
|
+
response: {
|
|
129
|
+
400: "Cookies are missing";
|
|
130
|
+
401: "User is not authenticated";
|
|
131
|
+
200: Response;
|
|
132
|
+
422: {
|
|
133
|
+
type: "validation";
|
|
134
|
+
on: string;
|
|
135
|
+
summary?: string;
|
|
136
|
+
message?: string;
|
|
137
|
+
found?: unknown;
|
|
138
|
+
property?: string;
|
|
139
|
+
expected?: string;
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
} & {
|
|
146
|
+
htmx: {
|
|
147
|
+
me: {
|
|
148
|
+
get: {
|
|
149
|
+
body: unknown;
|
|
150
|
+
params: {};
|
|
151
|
+
query: unknown;
|
|
152
|
+
headers: unknown;
|
|
153
|
+
response: {
|
|
154
|
+
400: "Cookies are missing";
|
|
155
|
+
401: "User is not authenticated";
|
|
156
|
+
200: Response;
|
|
157
|
+
422: {
|
|
158
|
+
type: "validation";
|
|
159
|
+
on: string;
|
|
160
|
+
summary?: string;
|
|
161
|
+
message?: string;
|
|
162
|
+
found?: unknown;
|
|
163
|
+
property?: string;
|
|
164
|
+
expected?: string;
|
|
165
|
+
};
|
|
166
|
+
};
|
|
167
|
+
};
|
|
168
|
+
};
|
|
169
|
+
};
|
|
170
|
+
} & {
|
|
171
|
+
htmx: {
|
|
172
|
+
account: {
|
|
173
|
+
get: {
|
|
174
|
+
body: unknown;
|
|
175
|
+
params: {};
|
|
176
|
+
query: unknown;
|
|
177
|
+
headers: unknown;
|
|
178
|
+
response: {
|
|
179
|
+
400: "Cookies are missing";
|
|
180
|
+
401: "User is not authenticated";
|
|
181
|
+
200: Response;
|
|
182
|
+
422: {
|
|
183
|
+
type: "validation";
|
|
184
|
+
on: string;
|
|
185
|
+
summary?: string;
|
|
186
|
+
message?: string;
|
|
187
|
+
found?: unknown;
|
|
188
|
+
property?: string;
|
|
189
|
+
expected?: string;
|
|
190
|
+
};
|
|
191
|
+
};
|
|
192
|
+
};
|
|
193
|
+
};
|
|
194
|
+
};
|
|
195
|
+
} & {
|
|
196
|
+
htmx: {
|
|
197
|
+
identities: {
|
|
198
|
+
get: {
|
|
199
|
+
body: unknown;
|
|
200
|
+
params: {};
|
|
201
|
+
query: unknown;
|
|
202
|
+
headers: unknown;
|
|
203
|
+
response: {
|
|
204
|
+
400: "Cookies are missing";
|
|
205
|
+
401: "User is not authenticated";
|
|
206
|
+
200: Response;
|
|
207
|
+
422: {
|
|
208
|
+
type: "validation";
|
|
209
|
+
on: string;
|
|
210
|
+
summary?: string;
|
|
211
|
+
message?: string;
|
|
212
|
+
found?: unknown;
|
|
213
|
+
property?: string;
|
|
214
|
+
expected?: string;
|
|
215
|
+
};
|
|
216
|
+
};
|
|
217
|
+
};
|
|
218
|
+
};
|
|
219
|
+
};
|
|
220
|
+
} & {
|
|
221
|
+
htmx: {
|
|
222
|
+
identities: {
|
|
223
|
+
":id": {
|
|
224
|
+
primary: {
|
|
225
|
+
post: {
|
|
226
|
+
body: unknown;
|
|
227
|
+
params: {
|
|
228
|
+
id: string;
|
|
229
|
+
} & {};
|
|
230
|
+
query: unknown;
|
|
231
|
+
headers: unknown;
|
|
232
|
+
response: {
|
|
233
|
+
400: "Cookies are missing";
|
|
234
|
+
401: "User is not authenticated";
|
|
235
|
+
200: Response;
|
|
236
|
+
422: {
|
|
237
|
+
type: "validation";
|
|
238
|
+
on: string;
|
|
239
|
+
summary?: string;
|
|
240
|
+
message?: string;
|
|
241
|
+
found?: unknown;
|
|
242
|
+
property?: string;
|
|
243
|
+
expected?: string;
|
|
244
|
+
};
|
|
245
|
+
};
|
|
246
|
+
};
|
|
247
|
+
};
|
|
248
|
+
};
|
|
249
|
+
};
|
|
250
|
+
};
|
|
251
|
+
} & {
|
|
252
|
+
htmx: {
|
|
253
|
+
identities: {
|
|
254
|
+
":id": {
|
|
255
|
+
delete: {
|
|
256
|
+
body: unknown;
|
|
257
|
+
params: {
|
|
258
|
+
id: string;
|
|
259
|
+
} & {};
|
|
260
|
+
query: unknown;
|
|
261
|
+
headers: unknown;
|
|
262
|
+
response: {
|
|
263
|
+
400: "Cookies are missing";
|
|
264
|
+
401: "User is not authenticated";
|
|
265
|
+
200: Response;
|
|
266
|
+
422: {
|
|
267
|
+
type: "validation";
|
|
268
|
+
on: string;
|
|
269
|
+
summary?: string;
|
|
270
|
+
message?: string;
|
|
271
|
+
found?: unknown;
|
|
272
|
+
property?: string;
|
|
273
|
+
expected?: string;
|
|
274
|
+
};
|
|
275
|
+
};
|
|
276
|
+
};
|
|
277
|
+
};
|
|
278
|
+
};
|
|
279
|
+
};
|
|
280
|
+
} & {
|
|
281
|
+
htmx: {
|
|
282
|
+
merge: {
|
|
283
|
+
":id": {
|
|
284
|
+
post: {
|
|
285
|
+
body: unknown;
|
|
286
|
+
params: {
|
|
287
|
+
id: string;
|
|
288
|
+
} & {};
|
|
289
|
+
query: unknown;
|
|
290
|
+
headers: unknown;
|
|
291
|
+
response: {
|
|
292
|
+
400: "Cookies are missing";
|
|
293
|
+
401: "User is not authenticated";
|
|
294
|
+
200: Response;
|
|
295
|
+
422: {
|
|
296
|
+
type: "validation";
|
|
297
|
+
on: string;
|
|
298
|
+
summary?: string;
|
|
299
|
+
message?: string;
|
|
300
|
+
found?: unknown;
|
|
301
|
+
property?: string;
|
|
302
|
+
expected?: string;
|
|
303
|
+
};
|
|
304
|
+
};
|
|
305
|
+
};
|
|
306
|
+
};
|
|
307
|
+
};
|
|
308
|
+
};
|
|
309
|
+
} & {
|
|
310
|
+
htmx: {
|
|
311
|
+
merge: {
|
|
312
|
+
":id": {
|
|
313
|
+
delete: {
|
|
314
|
+
body: unknown;
|
|
315
|
+
params: {
|
|
316
|
+
id: string;
|
|
317
|
+
} & {};
|
|
318
|
+
query: unknown;
|
|
319
|
+
headers: unknown;
|
|
320
|
+
response: {
|
|
321
|
+
400: "Cookies are missing";
|
|
322
|
+
401: "User is not authenticated";
|
|
323
|
+
200: Response;
|
|
324
|
+
422: {
|
|
325
|
+
type: "validation";
|
|
326
|
+
on: string;
|
|
327
|
+
summary?: string;
|
|
328
|
+
message?: string;
|
|
329
|
+
found?: unknown;
|
|
330
|
+
property?: string;
|
|
331
|
+
expected?: string;
|
|
332
|
+
};
|
|
333
|
+
};
|
|
334
|
+
};
|
|
335
|
+
};
|
|
336
|
+
};
|
|
337
|
+
};
|
|
338
|
+
} & {
|
|
339
|
+
htmx: {
|
|
340
|
+
"connector-list": {
|
|
341
|
+
get: {
|
|
342
|
+
body: unknown;
|
|
343
|
+
params: {};
|
|
344
|
+
query: unknown;
|
|
345
|
+
headers: unknown;
|
|
346
|
+
response: {
|
|
347
|
+
400: "Cookies are missing";
|
|
348
|
+
401: "User is not authenticated";
|
|
349
|
+
200: Response;
|
|
350
|
+
422: {
|
|
351
|
+
type: "validation";
|
|
352
|
+
on: string;
|
|
353
|
+
summary?: string;
|
|
354
|
+
message?: string;
|
|
355
|
+
found?: unknown;
|
|
356
|
+
property?: string;
|
|
357
|
+
expected?: string;
|
|
358
|
+
};
|
|
359
|
+
};
|
|
360
|
+
};
|
|
361
|
+
};
|
|
362
|
+
};
|
|
363
|
+
} & {
|
|
364
|
+
htmx: {
|
|
365
|
+
connectors: {
|
|
366
|
+
grants: {
|
|
367
|
+
":id": {
|
|
368
|
+
delete: {
|
|
369
|
+
body: unknown;
|
|
370
|
+
params: {
|
|
371
|
+
id: string;
|
|
372
|
+
} & {};
|
|
373
|
+
query: unknown;
|
|
374
|
+
headers: unknown;
|
|
375
|
+
response: {
|
|
376
|
+
400: "Cookies are missing";
|
|
377
|
+
401: "User is not authenticated";
|
|
378
|
+
200: Response;
|
|
379
|
+
422: {
|
|
380
|
+
type: "validation";
|
|
381
|
+
on: string;
|
|
382
|
+
summary?: string;
|
|
383
|
+
message?: string;
|
|
384
|
+
found?: unknown;
|
|
385
|
+
property?: string;
|
|
386
|
+
expected?: string;
|
|
387
|
+
};
|
|
388
|
+
};
|
|
389
|
+
};
|
|
390
|
+
};
|
|
391
|
+
};
|
|
392
|
+
};
|
|
393
|
+
};
|
|
394
|
+
} & {
|
|
395
|
+
htmx: {
|
|
396
|
+
connectors: {
|
|
397
|
+
bindings: {
|
|
398
|
+
":id": {
|
|
399
|
+
delete: {
|
|
400
|
+
body: unknown;
|
|
401
|
+
params: {
|
|
402
|
+
id: string;
|
|
403
|
+
} & {};
|
|
404
|
+
query: unknown;
|
|
405
|
+
headers: unknown;
|
|
406
|
+
response: {
|
|
407
|
+
400: "Cookies are missing";
|
|
408
|
+
401: "User is not authenticated";
|
|
409
|
+
200: Response;
|
|
410
|
+
422: {
|
|
411
|
+
type: "validation";
|
|
412
|
+
on: string;
|
|
413
|
+
summary?: string;
|
|
414
|
+
message?: string;
|
|
415
|
+
found?: unknown;
|
|
416
|
+
property?: string;
|
|
417
|
+
expected?: string;
|
|
418
|
+
};
|
|
419
|
+
};
|
|
420
|
+
};
|
|
421
|
+
};
|
|
422
|
+
};
|
|
423
|
+
};
|
|
424
|
+
};
|
|
425
|
+
} & {
|
|
426
|
+
htmx: {
|
|
427
|
+
"login-redirect": {
|
|
428
|
+
get: {
|
|
429
|
+
body: unknown;
|
|
430
|
+
params: {};
|
|
431
|
+
query: unknown;
|
|
432
|
+
headers: unknown;
|
|
433
|
+
response: {
|
|
434
|
+
200: Response;
|
|
435
|
+
422: {
|
|
436
|
+
type: "validation";
|
|
437
|
+
on: string;
|
|
438
|
+
summary?: string;
|
|
439
|
+
message?: string;
|
|
440
|
+
found?: unknown;
|
|
441
|
+
property?: string;
|
|
442
|
+
expected?: string;
|
|
443
|
+
};
|
|
444
|
+
};
|
|
445
|
+
};
|
|
446
|
+
};
|
|
447
|
+
};
|
|
448
|
+
} & {
|
|
449
|
+
htmx: {
|
|
450
|
+
"delete-account": {
|
|
451
|
+
post: {
|
|
452
|
+
body: unknown;
|
|
453
|
+
params: {};
|
|
454
|
+
query: unknown;
|
|
455
|
+
headers: unknown;
|
|
456
|
+
response: {
|
|
457
|
+
400: "Cookies are missing";
|
|
458
|
+
401: "User is not authenticated";
|
|
459
|
+
200: Response;
|
|
460
|
+
422: {
|
|
461
|
+
type: "validation";
|
|
462
|
+
on: string;
|
|
463
|
+
summary?: string;
|
|
464
|
+
message?: string;
|
|
465
|
+
found?: unknown;
|
|
466
|
+
property?: string;
|
|
467
|
+
expected?: string;
|
|
468
|
+
};
|
|
469
|
+
};
|
|
470
|
+
};
|
|
471
|
+
};
|
|
472
|
+
};
|
|
473
|
+
} & {
|
|
474
|
+
htmx: {
|
|
475
|
+
signout: {
|
|
476
|
+
get: {
|
|
477
|
+
body: unknown;
|
|
478
|
+
params: {};
|
|
479
|
+
query: unknown;
|
|
480
|
+
headers: unknown;
|
|
481
|
+
response: {
|
|
482
|
+
200: Response;
|
|
483
|
+
422: {
|
|
484
|
+
type: "validation";
|
|
485
|
+
on: string;
|
|
486
|
+
summary?: string;
|
|
487
|
+
message?: string;
|
|
488
|
+
found?: unknown;
|
|
489
|
+
property?: string;
|
|
490
|
+
expected?: string;
|
|
491
|
+
};
|
|
492
|
+
};
|
|
493
|
+
};
|
|
494
|
+
};
|
|
495
|
+
};
|
|
496
|
+
}, {
|
|
497
|
+
derive: {};
|
|
498
|
+
resolve: {};
|
|
499
|
+
schema: {};
|
|
500
|
+
standaloneSchema: {};
|
|
501
|
+
response: {};
|
|
502
|
+
}, {
|
|
503
|
+
derive: {};
|
|
504
|
+
resolve: {};
|
|
505
|
+
schema: {};
|
|
506
|
+
standaloneSchema: {};
|
|
507
|
+
response: {};
|
|
508
|
+
} & {
|
|
509
|
+
derive: {};
|
|
510
|
+
resolve: {};
|
|
511
|
+
schema: {};
|
|
512
|
+
standaloneSchema: {};
|
|
513
|
+
response: {};
|
|
514
|
+
}>;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/** Minimal shape the account/menu/protected fragments read off the resolved
|
|
2
|
+
* user. The consumer's full user record is structurally assignable. */
|
|
3
|
+
export type AuthHtmxUser = {
|
|
4
|
+
sub: string;
|
|
5
|
+
email?: string | null;
|
|
6
|
+
first_name?: string | null;
|
|
7
|
+
last_name?: string | null;
|
|
8
|
+
primary_auth_identity_id?: string | null;
|
|
9
|
+
};
|
|
10
|
+
export type AuthHtmxProviderInfo = {
|
|
11
|
+
name: string;
|
|
12
|
+
logoUrl: string;
|
|
13
|
+
};
|
|
14
|
+
/** Per-provider display data (name + logo) keyed by provider option. */
|
|
15
|
+
export type AuthHtmxProviderData = Record<string, AuthHtmxProviderInfo>;
|
|
16
|
+
export type AuthHtmxConnectorTarget = {
|
|
17
|
+
provider: string;
|
|
18
|
+
label: string;
|
|
19
|
+
description: string;
|
|
20
|
+
};
|
|
21
|
+
/** OAuth client a provider authorization URL targets. Providers configured
|
|
22
|
+
* with separate login/connector clients use this to disambiguate. */
|
|
23
|
+
export type AuthHtmxClient = 'login' | 'connector';
|
|
24
|
+
export type AuthIdentitySummary = {
|
|
25
|
+
id: string;
|
|
26
|
+
provider_subject: string;
|
|
27
|
+
isPrimary?: boolean;
|
|
28
|
+
};
|
|
29
|
+
export type AuthIdentityMergeRequestSummary = {
|
|
30
|
+
id: string;
|
|
31
|
+
status: string;
|
|
32
|
+
conflicting_auth_provider: string;
|
|
33
|
+
conflicting_provider_subject: string;
|
|
34
|
+
};
|
|
35
|
+
export type AuthIdentityPayload = {
|
|
36
|
+
identities: Record<string, AuthIdentitySummary[]>;
|
|
37
|
+
mergeRequests: AuthIdentityMergeRequestSummary[];
|
|
38
|
+
};
|
|
39
|
+
export type LinkedProviderBindingSummary = {
|
|
40
|
+
id: string;
|
|
41
|
+
label?: string | null;
|
|
42
|
+
externalAccountId: string;
|
|
43
|
+
connectorProvider: string;
|
|
44
|
+
externalAccountType: string;
|
|
45
|
+
status: string;
|
|
46
|
+
availableScopes: string[];
|
|
47
|
+
};
|
|
48
|
+
export type LinkedProviderGrantSummary = {
|
|
49
|
+
id: string;
|
|
50
|
+
authProviderKey: string;
|
|
51
|
+
status: string;
|
|
52
|
+
providerSubject: string;
|
|
53
|
+
grantedScopes: string[];
|
|
54
|
+
};
|
|
55
|
+
export type LinkedProviderPayload = {
|
|
56
|
+
bindings: LinkedProviderBindingSummary[];
|
|
57
|
+
grants: LinkedProviderGrantSummary[];
|
|
58
|
+
};
|
|
59
|
+
/** Per-fragment overrides. Any renderer left unset uses the package default. */
|
|
60
|
+
export type AuthHtmxRenderOverrides = {
|
|
61
|
+
account?: (user: AuthHtmxUser) => string;
|
|
62
|
+
authMenu?: (user: AuthHtmxUser | null) => string;
|
|
63
|
+
connectorLinks?: () => string;
|
|
64
|
+
connectors?: (payload: LinkedProviderPayload) => string;
|
|
65
|
+
identities?: (payload: AuthIdentityPayload, query: string) => string;
|
|
66
|
+
protected?: (user: AuthHtmxUser) => string;
|
|
67
|
+
providerLogin?: (verb: string, includeDropdown: boolean) => string;
|
|
68
|
+
};
|
|
69
|
+
export type AuthHtmxRenderersConfig = {
|
|
70
|
+
/** Display data (name + logo) for every provider the UI references. */
|
|
71
|
+
providerData: AuthHtmxProviderData;
|
|
72
|
+
/** Providers shown as one-tap login buttons, in order. */
|
|
73
|
+
featuredLoginProviders: string[];
|
|
74
|
+
/** Connector targets shown on the connectors page. */
|
|
75
|
+
connectorTargets: AuthHtmxConnectorTarget[];
|
|
76
|
+
/** Builds the OAuth2 authorization URL for a provider. Defaults to
|
|
77
|
+
* `/oauth2/<provider>/authorization` (with `?client=<client>` when a
|
|
78
|
+
* client is given). Override to add per-provider client routing. */
|
|
79
|
+
authorizationHref?: (provider: string, client?: AuthHtmxClient) => string;
|
|
80
|
+
/** Per-fragment overrides. */
|
|
81
|
+
render?: AuthHtmxRenderOverrides;
|
|
82
|
+
};
|
|
83
|
+
export type ResolvedAuthHtmxRenderers = Required<AuthHtmxRenderOverrides> & {
|
|
84
|
+
escapeHtml: (value: string) => string;
|
|
85
|
+
};
|
|
86
|
+
/** Config for the `htmx` option on `auth`. Extends the renderers
|
|
87
|
+
* config with the data actions the fragment routes call — keeping the auth
|
|
88
|
+
* package agnostic of your identity schema while it owns the route wiring
|
|
89
|
+
* (protectRoute gating, payload re-rendering, signout, delete-account flow). */
|
|
90
|
+
export type AuthHtmxConfig = AuthHtmxRenderersConfig & {
|
|
91
|
+
/** Load the current user's grouped identities + pending merge requests. */
|
|
92
|
+
loadAuthIdentities: (userSub: string) => AuthIdentityPayload | Promise<AuthIdentityPayload>;
|
|
93
|
+
/** Load the current user's connector grants + external-account bindings. */
|
|
94
|
+
loadLinkedProviders: (userSub: string) => LinkedProviderPayload | Promise<LinkedProviderPayload>;
|
|
95
|
+
/** Promote an identity to the user's primary. */
|
|
96
|
+
setPrimaryIdentity: (input: {
|
|
97
|
+
identityId: string;
|
|
98
|
+
userSub: string;
|
|
99
|
+
}) => void | Promise<unknown>;
|
|
100
|
+
/** Remove an identity (the route already guards last-identity + primary). */
|
|
101
|
+
removeIdentity: (input: {
|
|
102
|
+
identityId: string;
|
|
103
|
+
userSub: string;
|
|
104
|
+
}) => void | Promise<unknown>;
|
|
105
|
+
/** Accept a pending merge request into the current user. */
|
|
106
|
+
mergeIdentity: (input: {
|
|
107
|
+
mergeRequestId: string;
|
|
108
|
+
userSub: string;
|
|
109
|
+
}) => void | Promise<unknown>;
|
|
110
|
+
/** Dismiss a pending merge request. */
|
|
111
|
+
dismissMergeRequest: (input: {
|
|
112
|
+
mergeRequestId: string;
|
|
113
|
+
userSub: string;
|
|
114
|
+
}) => void | Promise<unknown>;
|
|
115
|
+
/** Revoke a connector grant the user owns. */
|
|
116
|
+
removeGrant: (input: {
|
|
117
|
+
grantId: string;
|
|
118
|
+
userSub: string;
|
|
119
|
+
}) => void | Promise<unknown>;
|
|
120
|
+
/** Remove an external-account binding the user owns. */
|
|
121
|
+
removeBinding: (input: {
|
|
122
|
+
bindingId: string;
|
|
123
|
+
userSub: string;
|
|
124
|
+
}) => void | Promise<unknown>;
|
|
125
|
+
/** Delete the user's account and all linked data. */
|
|
126
|
+
deleteAccount: (input: {
|
|
127
|
+
userSub: string;
|
|
128
|
+
}) => void | Promise<unknown>;
|
|
129
|
+
};
|