@absolutejs/auth 0.81.0 → 0.82.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.
@@ -5,7 +5,198 @@ type SignOutProps<UserType> = {
5
5
  signoutRoute?: RouteString;
6
6
  onSignOut: OnSignOut<UserType>;
7
7
  };
8
- export declare const signout: <UserType>({ authSessionStore, signoutRoute, onSignOut }: SignOutProps<UserType>) => import("elysia/types").AddRoute<"", "local", {
8
+ /** Fixed path for directly typed Eden clients; the same session revocation and
9
+ * cookie-clearing implementation as auth's configurable sign-out route. */
10
+ export declare const createSignoutApi: <UserType>(configuration: {
11
+ authSessionStore: AuthSessionStore<UserType>;
12
+ onSignOut?: OnSignOut<UserType>;
13
+ }) => import("elysia/types").AddRoute<"", "local", {
14
+ decorator: {};
15
+ store: {
16
+ session: SessionRecord<UserType>;
17
+ unregisteredSession: import("..").UnregisteredSessionRecord;
18
+ };
19
+ derive: {};
20
+ }, {
21
+ typebox: {};
22
+ error: [];
23
+ }, import("elysia/types").DefaultMetadata, {}, import("elysia/types").DefaultEphemeral, {
24
+ derive: {};
25
+ schema: {};
26
+ schemas: {};
27
+ response: {};
28
+ error: [];
29
+ }, "delete", "/oauth2/signout", import("elysia/types").IntersectIfObjectSchema<import("elysia").UnwrapRoute<{
30
+ cookie: import("elysia").TCookieObject<{
31
+ auth_provider: import("typebox").TOptional<import("typebox").TString>;
32
+ user_session_id: import("typebox").TOptional<import("typebox").TTemplateLiteral<"^.*-.*-.*-.*-.*$">>;
33
+ }>;
34
+ }, {}, "/oauth2/signout">, import("elysia/types").MergeScopedSchemas<{}, {}, {}>>, {}, ({ status, store: { session }, cookie: { user_session_id, auth_provider } }: {
35
+ body: unknown;
36
+ query: Record<string, string | undefined>;
37
+ params: {};
38
+ headers: Record<string, string | undefined>;
39
+ cookie: Record<string, import("elysia").Cookie<unknown>> & {
40
+ user_session_id: import("elysia").Cookie<`${string}-${string}-${string}-${string}-${string}` | undefined>;
41
+ auth_provider: import("elysia").Cookie<string | undefined>;
42
+ };
43
+ server: import("elysia").Server | null;
44
+ redirect: import("elysia").redirect;
45
+ set: {
46
+ headers: import("elysia").HTTPHeaders;
47
+ status?: number | keyof import("elysia").StatusMap;
48
+ cookie?: Record<string, import("elysia").BaseCookie>;
49
+ };
50
+ status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 400 | 401 | 403 | 501 | 204 | 404 | 200 | 301 | 302 | 303 | 307 | 308 | 409 | 100 | 101 | 102 | 103 | 201 | 202 | 203 | 205 | 206 | 207 | 208 | 300 | 304 | 402 | 405 | 406 | 407 | 408 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 451 | 500 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511 ? {
51
+ readonly 100: "Continue";
52
+ readonly 101: "Switching Protocols";
53
+ readonly 102: "Processing";
54
+ readonly 103: "Early Hints";
55
+ readonly 200: "OK";
56
+ readonly 201: "Created";
57
+ readonly 202: "Accepted";
58
+ readonly 203: "Non-Authoritative Information";
59
+ readonly 204: "No Content";
60
+ readonly 205: "Reset Content";
61
+ readonly 206: "Partial Content";
62
+ readonly 207: "Multi-Status";
63
+ readonly 208: "Already Reported";
64
+ readonly 300: "Multiple Choices";
65
+ readonly 301: "Moved Permanently";
66
+ readonly 302: "Found";
67
+ readonly 303: "See Other";
68
+ readonly 304: "Not Modified";
69
+ readonly 307: "Temporary Redirect";
70
+ readonly 308: "Permanent Redirect";
71
+ readonly 400: "Bad Request";
72
+ readonly 401: "Unauthorized";
73
+ readonly 402: "Payment Required";
74
+ readonly 403: "Forbidden";
75
+ readonly 404: "Not Found";
76
+ readonly 405: "Method Not Allowed";
77
+ readonly 406: "Not Acceptable";
78
+ readonly 407: "Proxy Authentication Required";
79
+ readonly 408: "Request Timeout";
80
+ readonly 409: "Conflict";
81
+ readonly 410: "Gone";
82
+ readonly 411: "Length Required";
83
+ readonly 412: "Precondition Failed";
84
+ readonly 413: "Payload Too Large";
85
+ readonly 414: "URI Too Long";
86
+ readonly 415: "Unsupported Media Type";
87
+ readonly 416: "Range Not Satisfiable";
88
+ readonly 417: "Expectation Failed";
89
+ readonly 418: "I'm a teapot";
90
+ readonly 420: "Enhance Your Calm";
91
+ readonly 421: "Misdirected Request";
92
+ readonly 422: "Unprocessable Content";
93
+ readonly 423: "Locked";
94
+ readonly 424: "Failed Dependency";
95
+ readonly 425: "Too Early";
96
+ readonly 426: "Upgrade Required";
97
+ readonly 428: "Precondition Required";
98
+ readonly 429: "Too Many Requests";
99
+ readonly 431: "Request Header Fields Too Large";
100
+ readonly 451: "Unavailable For Legal Reasons";
101
+ readonly 500: "Internal Server Error";
102
+ readonly 501: "Not Implemented";
103
+ readonly 502: "Bad Gateway";
104
+ readonly 503: "Service Unavailable";
105
+ readonly 504: "Gateway Timeout";
106
+ readonly 505: "HTTP Version Not Supported";
107
+ readonly 506: "Variant Also Negotiates";
108
+ readonly 507: "Insufficient Storage";
109
+ readonly 508: "Loop Detected";
110
+ readonly 510: "Not Extended";
111
+ readonly 511: "Network Authentication Required";
112
+ }[Code] : Code>(code: Code, response?: T) => import("elysia").ElysiaStatus<Code, T, Code extends "Continue" | "Switching Protocols" | "Processing" | "Early Hints" | "OK" | "Created" | "Accepted" | "Non-Authoritative Information" | "No Content" | "Reset Content" | "Partial Content" | "Multi-Status" | "Already Reported" | "Multiple Choices" | "Moved Permanently" | "Found" | "See Other" | "Not Modified" | "Temporary Redirect" | "Permanent Redirect" | "Bad Request" | "Unauthorized" | "Payment Required" | "Forbidden" | "Not Found" | "Method Not Allowed" | "Not Acceptable" | "Proxy Authentication Required" | "Request Timeout" | "Conflict" | "Gone" | "Length Required" | "Precondition Failed" | "Payload Too Large" | "URI Too Long" | "Unsupported Media Type" | "Range Not Satisfiable" | "Expectation Failed" | "I'm a teapot" | "Enhance Your Calm" | "Misdirected Request" | "Unprocessable Content" | "Locked" | "Failed Dependency" | "Too Early" | "Upgrade Required" | "Precondition Required" | "Too Many Requests" | "Request Header Fields Too Large" | "Unavailable For Legal Reasons" | "Internal Server Error" | "Not Implemented" | "Bad Gateway" | "Service Unavailable" | "Gateway Timeout" | "HTTP Version Not Supported" | "Variant Also Negotiates" | "Insufficient Storage" | "Loop Detected" | "Not Extended" | "Network Authentication Required" ? {
113
+ readonly Continue: 100;
114
+ readonly "Switching Protocols": 101;
115
+ readonly Processing: 102;
116
+ readonly "Early Hints": 103;
117
+ readonly OK: 200;
118
+ readonly Created: 201;
119
+ readonly Accepted: 202;
120
+ readonly "Non-Authoritative Information": 203;
121
+ readonly "No Content": 204;
122
+ readonly "Reset Content": 205;
123
+ readonly "Partial Content": 206;
124
+ readonly "Multi-Status": 207;
125
+ readonly "Already Reported": 208;
126
+ readonly "Multiple Choices": 300;
127
+ readonly "Moved Permanently": 301;
128
+ readonly Found: 302;
129
+ readonly "See Other": 303;
130
+ readonly "Not Modified": 304;
131
+ readonly "Temporary Redirect": 307;
132
+ readonly "Permanent Redirect": 308;
133
+ readonly "Bad Request": 400;
134
+ readonly Unauthorized: 401;
135
+ readonly "Payment Required": 402;
136
+ readonly Forbidden: 403;
137
+ readonly "Not Found": 404;
138
+ readonly "Method Not Allowed": 405;
139
+ readonly "Not Acceptable": 406;
140
+ readonly "Proxy Authentication Required": 407;
141
+ readonly "Request Timeout": 408;
142
+ readonly Conflict: 409;
143
+ readonly Gone: 410;
144
+ readonly "Length Required": 411;
145
+ readonly "Precondition Failed": 412;
146
+ readonly "Payload Too Large": 413;
147
+ readonly "URI Too Long": 414;
148
+ readonly "Unsupported Media Type": 415;
149
+ readonly "Range Not Satisfiable": 416;
150
+ readonly "Expectation Failed": 417;
151
+ readonly "I'm a teapot": 418;
152
+ readonly "Enhance Your Calm": 420;
153
+ readonly "Misdirected Request": 421;
154
+ readonly "Unprocessable Content": 422;
155
+ readonly Locked: 423;
156
+ readonly "Failed Dependency": 424;
157
+ readonly "Too Early": 425;
158
+ readonly "Upgrade Required": 426;
159
+ readonly "Precondition Required": 428;
160
+ readonly "Too Many Requests": 429;
161
+ readonly "Request Header Fields Too Large": 431;
162
+ readonly "Unavailable For Legal Reasons": 451;
163
+ readonly "Internal Server Error": 500;
164
+ readonly "Not Implemented": 501;
165
+ readonly "Bad Gateway": 502;
166
+ readonly "Service Unavailable": 503;
167
+ readonly "Gateway Timeout": 504;
168
+ readonly "HTTP Version Not Supported": 505;
169
+ readonly "Variant Also Negotiates": 506;
170
+ readonly "Insufficient Storage": 507;
171
+ readonly "Loop Detected": 508;
172
+ readonly "Not Extended": 510;
173
+ readonly "Network Authentication Required": 511;
174
+ }[Code] : Code>;
175
+ defer: (fn: import("elysia/types").AfterResponseHandler<NoInfer<import("elysia/types").IntersectIfObjectSchema<import("elysia").UnwrapRoute<{
176
+ cookie: import("elysia").TCookieObject<{
177
+ auth_provider: import("typebox").TOptional<import("typebox").TString>;
178
+ user_session_id: import("typebox").TOptional<import("typebox").TTemplateLiteral<"^.*-.*-.*-.*-.*$">>;
179
+ }>;
180
+ }, {}, "/oauth2/signout">, import("elysia/types").MergeScopedSchemas<{}, {}, {}>>>, NoInfer<{
181
+ decorator: {};
182
+ store: {
183
+ session: SessionRecord<UserType>;
184
+ unregisteredSession: import("..").UnregisteredSessionRecord;
185
+ };
186
+ derive: {};
187
+ } & {
188
+ derive: {};
189
+ }>>) => import("elysia/types").MaybePromise<void>;
190
+ readonly path: string;
191
+ route?: string | undefined;
192
+ rid?: string | undefined;
193
+ request: Request;
194
+ store: {
195
+ session: SessionRecord<UserType>;
196
+ unregisteredSession: import("..").UnregisteredSessionRecord;
197
+ };
198
+ }) => Promise<Response | import("elysia").ElysiaStatus<"Bad Request", "Cookies are missing", 400> | import("elysia").ElysiaStatus<"Unauthorized", "No user session id found", 401> | import("elysia").ElysiaStatus<"Internal Server Error", "Sign out operation failed", 500>>>;
199
+ export declare const signout: <UserType>(configuration: SignOutProps<UserType>) => import("elysia/types").AddRoute<"", "local", {
9
200
  decorator: {};
10
201
  store: {
11
202
  session: SessionRecord<UserType>;
package/dist/server.d.ts CHANGED
@@ -35,3 +35,4 @@ export { instantiateUserSession } from './utils';
35
35
  export type { OAuth2TokenResponse, ProviderOption } from 'citra';
36
36
  export { extractPropFromIdentity, isValidProviderOption, providers } from 'citra';
37
37
  export { createCredentialsApi } from './credentials/api';
38
+ export { createSignoutApi } from './routes/signout';
package/dist/server.js CHANGED
@@ -12866,9 +12866,18 @@ var runSignOut = async (onSignOut, args) => {
12866
12866
  return false;
12867
12867
  }
12868
12868
  };
12869
- var signout = ({
12869
+ var createSignoutApi = (configuration) => createSignoutRoute({
12870
+ ...configuration,
12871
+ onSignOut: configuration.onSignOut,
12872
+ signoutRoute: "/oauth2/signout"
12873
+ });
12874
+ var signout = (configuration) => createSignoutRoute({
12875
+ ...configuration,
12876
+ signoutRoute: configuration.signoutRoute ?? "/oauth2/signout"
12877
+ });
12878
+ var createSignoutRoute = ({
12870
12879
  authSessionStore,
12871
- signoutRoute = "/oauth2/signout",
12880
+ signoutRoute,
12872
12881
  onSignOut
12873
12882
  }) => new Elysia35().use(sessionStore()).delete(signoutRoute, {
12874
12883
  cookie: t28.Cookie({
@@ -42164,6 +42173,7 @@ export {
42164
42173
  createPostgresSetupSessionStore,
42165
42174
  createPostgresSsoConnectionStore,
42166
42175
  createSetupSession,
42176
+ createSignoutApi,
42167
42177
  deriveAuthSyncNamespace,
42168
42178
  extractPropFromIdentity,
42169
42179
  instantiateUserSession,
@@ -42176,5 +42186,5 @@ export {
42176
42186
  userSessionIdTypebox
42177
42187
  };
42178
42188
 
42179
- //# debugId=57C7A1ECE15922C664756E2164756E21
42189
+ //# debugId=B801BF9A602847F164756E2164756E21
42180
42190
  //# sourceMappingURL=server.js.map