@absolutejs/auth 0.24.0 → 0.24.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/dist/index.d.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  import { Elysia } from 'elysia';
2
2
  import { AbsoluteAuthProps } from './types';
3
3
  import type { AuthHtmxUser } from './ui/types';
4
- export declare const absoluteAuth: <UserType extends AuthHtmxUser>({ providersConfiguration, authorizeRoute, callbackRoute, profileRoute, signoutRoute, statusRoute, refreshRoute, revokeRoute, cleanupIntervalMs, maxSessions, sessionDurationMs, authSessionStore, htmx, resolveAuthIntent, onAuthorizeSuccess, onAuthorizeError, onProfileSuccess, onProfileError, onCallbackSuccess, onLinkIdentity, onLinkIdentityConflict, onLinkConnector, onCallbackError, onStatus, onRefreshSuccess, onRefreshError, onSignOut, onRevocationSuccess, onRevocationError, onSessionCleanup }: AbsoluteAuthProps<UserType>) => Promise<Elysia<"", {
4
+ export declare const absoluteAuth: <UserType>({ providersConfiguration, authorizeRoute, callbackRoute, profileRoute, signoutRoute, statusRoute, refreshRoute, revokeRoute, cleanupIntervalMs, maxSessions, sessionDurationMs, authSessionStore, htmx, resolveAuthIntent, onAuthorizeSuccess, onAuthorizeError, onProfileSuccess, onProfileError, onCallbackSuccess, onLinkIdentity, onLinkIdentityConflict, onLinkConnector, onCallbackError, onStatus, onRefreshSuccess, onRefreshError, onSignOut, onRevocationSuccess, onRevocationError, onSessionCleanup }: AbsoluteAuthProps<UserType>) => Promise<Elysia<"", {
5
5
  decorator: {};
6
6
  store: {
7
7
  session: import("./types").SessionRecord<UserType> & import("./types").SessionRecord<unknown>;
8
8
  unregisteredSession: import("./types").UnregisteredSessionRecord;
9
9
  } | {
10
- session: import("./types").SessionRecord<UserType> & import("./types").SessionRecord<unknown>;
10
+ session: import("./types").SessionRecord<UserType> & import("./types").SessionRecord<unknown> & import("./types").SessionRecord<UserType & AuthHtmxUser>;
11
11
  unregisteredSession: import("./types").UnregisteredSessionRecord;
12
12
  };
13
13
  derive: {
@@ -20,7 +20,15 @@ export declare const absoluteAuth: <UserType extends AuthHtmxUser>({ providersCo
20
20
  readonly code: "Unauthorized";
21
21
  readonly message: "User is not authenticated";
22
22
  }) => AuthFailReturn) | undefined) => Promise<import("elysia").ElysiaCustomStatusResponse<"Bad Request", "Cookies are missing", 400> | import("elysia").ElysiaCustomStatusResponse<"Unauthorized", "User is not authenticated", 401> | AuthReturn | NonNullable<AuthFailReturn>>;
23
- };
23
+ } & ({} | {
24
+ readonly protectRoute: <AuthReturn, AuthFailReturn>(handleAuth: (user: UserType & AuthHtmxUser) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: ((error: {
25
+ readonly code: "Bad Request";
26
+ readonly message: "Cookies are missing";
27
+ } | {
28
+ readonly code: "Unauthorized";
29
+ readonly message: "User is not authenticated";
30
+ }) => AuthFailReturn) | undefined) => Promise<import("elysia").ElysiaCustomStatusResponse<"Bad Request", "Cookies are missing", 400> | import("elysia").ElysiaCustomStatusResponse<"Unauthorized", "User is not authenticated", 401> | AuthReturn | NonNullable<AuthFailReturn>>;
31
+ });
24
32
  resolve: {};
25
33
  }, {
26
34
  typebox: {};
@@ -41,7 +49,7 @@ export declare const absoluteAuth: <UserType extends AuthHtmxUser>({ providersCo
41
49
  response: import("elysia").ExtractErrorFromHandle<{
42
50
  readonly cleanupSessions: () => Promise<void>;
43
51
  }>;
44
- } & {
52
+ } & ({
45
53
  schema: import("elysia").UnwrapRoute<{
46
54
  cookie: import("@sinclair/typebox").TObject<{
47
55
  user_session_id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TTemplateLiteralSyntax<"${string}-${string}-${string}-${string}-${string}">>;
@@ -60,7 +68,40 @@ export declare const absoluteAuth: <UserType extends AuthHtmxUser>({ providersCo
60
68
  readonly message: "User is not authenticated";
61
69
  }) => AuthFailReturn) | undefined) => Promise<import("elysia").ElysiaCustomStatusResponse<"Bad Request", "Cookies are missing", 400> | import("elysia").ElysiaCustomStatusResponse<"Unauthorized", "User is not authenticated", 401> | AuthReturn | NonNullable<AuthFailReturn>>;
62
70
  }>;
63
- }, (((({
71
+ } & ({
72
+ schema: {};
73
+ standaloneSchema: {};
74
+ macro: {};
75
+ macroFn: {};
76
+ parser: {};
77
+ response: {};
78
+ } | ({
79
+ schema: {};
80
+ standaloneSchema: {};
81
+ macro: {};
82
+ macroFn: {};
83
+ parser: {};
84
+ response: {};
85
+ } & {
86
+ schema: import("elysia").UnwrapRoute<{
87
+ cookie: import("@sinclair/typebox").TObject<{
88
+ user_session_id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TTemplateLiteralSyntax<"${string}-${string}-${string}-${string}-${string}">>;
89
+ }>;
90
+ }, {}, "">;
91
+ standaloneSchema: {};
92
+ macro: {};
93
+ macroFn: {};
94
+ parser: {};
95
+ response: import("elysia").ExtractErrorFromHandle<{
96
+ readonly protectRoute: <AuthReturn, AuthFailReturn>(handleAuth: (user: UserType & AuthHtmxUser) => AuthReturn | Promise<AuthReturn>, handleAuthFail?: ((error: {
97
+ readonly code: "Bad Request";
98
+ readonly message: "Cookies are missing";
99
+ } | {
100
+ readonly code: "Unauthorized";
101
+ readonly message: "User is not authenticated";
102
+ }) => AuthFailReturn) | undefined) => Promise<import("elysia").ElysiaCustomStatusResponse<"Bad Request", "Cookies are missing", 400> | import("elysia").ElysiaCustomStatusResponse<"Unauthorized", "User is not authenticated", 401> | AuthReturn | NonNullable<AuthFailReturn>>;
103
+ }>;
104
+ }))), (((({
64
105
  [x: string]: {
65
106
  delete: {
66
107
  body: unknown;
package/dist/index.js CHANGED
@@ -13985,18 +13985,21 @@ var absoluteAuth = async ({
13985
13985
  authSessionStore,
13986
13986
  callbackRoute,
13987
13987
  clientProviders,
13988
- resolveAuthIntent,
13989
13988
  onCallbackError,
13990
13989
  onCallbackSuccess,
13990
+ onLinkConnector,
13991
13991
  onLinkIdentity,
13992
13992
  onLinkIdentityConflict,
13993
- onLinkConnector
13993
+ resolveAuthIntent
13994
13994
  })).use(profile({
13995
13995
  clientProviders,
13996
13996
  onProfileError,
13997
13997
  onProfileSuccess,
13998
13998
  profileRoute
13999
- })).use(protectRoutePlugin({ authSessionStore })).use(htmx ? createAuthHtmxRoutes({ ...htmx, authSessionStore }) : new Elysia12);
13999
+ })).use(protectRoutePlugin({ authSessionStore })).use(htmx ? createAuthHtmxRoutes({
14000
+ ...htmx,
14001
+ authSessionStore
14002
+ }) : new Elysia12);
14000
14003
  };
14001
14004
  export {
14002
14005
  validateSession,
@@ -14049,5 +14052,5 @@ export {
14049
14052
  AbsoluteAuthIdentityConflictError
14050
14053
  };
14051
14054
 
14052
- //# debugId=D6887201B1B4B2A864756E2164756E21
14055
+ //# debugId=B7CC84AD56EB9F2C64756E2164756E21
14053
14056
  //# sourceMappingURL=index.js.map