@absolutejs/auth 0.23.0 → 0.24.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.
@@ -0,0 +1,514 @@
1
+ import { Elysia } from 'elysia';
2
+ import type { AbsoluteAuthSessionStore } from './sessionTypes';
3
+ import type { AuthHtmxConfig, AuthHtmxUser } from './ui/types';
4
+ export declare const createAuthHtmxRoutes: <UserType extends AuthHtmxUser>(config: AuthHtmxConfig & {
5
+ authSessionStore?: AbsoluteAuthSessionStore<UserType>;
6
+ }) => Elysia<"", {
7
+ decorator: {};
8
+ store: {
9
+ session: import("./types").SessionRecord<UserType>;
10
+ unregisteredSession: import("./types").UnregisteredSessionRecord;
11
+ };
12
+ derive: {
13
+ readonly protectRoute: <AuthReturn, AuthFailReturn>(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>(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
+ 200: Response;
130
+ 400: "Cookies are missing";
131
+ 401: "User is not authenticated";
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
+ 200: Response;
155
+ 400: "Cookies are missing";
156
+ 401: "User is not authenticated";
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
+ 200: Response;
180
+ 400: "Cookies are missing";
181
+ 401: "User is not authenticated";
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
+ 200: {} | Response;
205
+ 400: "Cookies are missing";
206
+ 401: "User is not authenticated";
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
+ 200: {} | Response;
234
+ 400: "Cookies are missing";
235
+ 401: "User is not authenticated";
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
+ 200: {} | Response;
264
+ 400: "Cookies are missing";
265
+ 401: "User is not authenticated";
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
+ 200: {} | Response;
293
+ 400: "Cookies are missing";
294
+ 401: "User is not authenticated";
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
+ 200: {} | Response;
322
+ 400: "Cookies are missing";
323
+ 401: "User is not authenticated";
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
+ 200: Response;
348
+ 400: "Cookies are missing";
349
+ 401: "User is not authenticated";
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
+ 200: {} | Response;
377
+ 400: "Cookies are missing";
378
+ 401: "User is not authenticated";
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
+ 200: {} | Response;
408
+ 400: "Cookies are missing";
409
+ 401: "User is not authenticated";
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
+ 200: {} | Response;
458
+ 400: "Cookies are missing";
459
+ 401: "User is not authenticated";
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
+ }>;