@spfn/auth 0.1.0-alpha.88 → 0.2.0-beta.10

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.
Files changed (152) hide show
  1. package/README.md +1385 -1199
  2. package/dist/config.d.ts +409 -0
  3. package/dist/config.js +244 -0
  4. package/dist/config.js.map +1 -0
  5. package/dist/dto-CRlgoCP5.d.ts +645 -0
  6. package/dist/errors.d.ts +196 -0
  7. package/dist/errors.js +173 -0
  8. package/dist/errors.js.map +1 -0
  9. package/dist/index.d.ts +287 -14
  10. package/dist/index.js +511 -6665
  11. package/dist/index.js.map +1 -1
  12. package/dist/nextjs/api.js +345 -0
  13. package/dist/nextjs/api.js.map +1 -0
  14. package/dist/{adapters/nextjs → nextjs}/server.d.ts +47 -65
  15. package/dist/nextjs/server.js +178 -0
  16. package/dist/nextjs/server.js.map +1 -0
  17. package/dist/server.d.ts +4444 -514
  18. package/dist/server.js +7977 -1210
  19. package/dist/server.js.map +1 -1
  20. package/migrations/0000_premium_famine.sql +292 -0
  21. package/migrations/meta/0000_snapshot.json +281 -46
  22. package/migrations/meta/_journal.json +2 -2
  23. package/package.json +37 -33
  24. package/dist/adapters/nextjs/api.d.ts +0 -446
  25. package/dist/adapters/nextjs/api.js +0 -3279
  26. package/dist/adapters/nextjs/api.js.map +0 -1
  27. package/dist/adapters/nextjs/server.js +0 -3645
  28. package/dist/adapters/nextjs/server.js.map +0 -1
  29. package/dist/lib/api/auth-codes-verify.d.ts +0 -37
  30. package/dist/lib/api/auth-codes-verify.js +0 -2949
  31. package/dist/lib/api/auth-codes-verify.js.map +0 -1
  32. package/dist/lib/api/auth-codes.d.ts +0 -37
  33. package/dist/lib/api/auth-codes.js +0 -2949
  34. package/dist/lib/api/auth-codes.js.map +0 -1
  35. package/dist/lib/api/auth-exists.d.ts +0 -38
  36. package/dist/lib/api/auth-exists.js +0 -2949
  37. package/dist/lib/api/auth-exists.js.map +0 -1
  38. package/dist/lib/api/auth-invitations-accept.d.ts +0 -38
  39. package/dist/lib/api/auth-invitations-accept.js +0 -2883
  40. package/dist/lib/api/auth-invitations-accept.js.map +0 -1
  41. package/dist/lib/api/auth-invitations-cancel.d.ts +0 -37
  42. package/dist/lib/api/auth-invitations-cancel.js +0 -2883
  43. package/dist/lib/api/auth-invitations-cancel.js.map +0 -1
  44. package/dist/lib/api/auth-invitations-delete.d.ts +0 -36
  45. package/dist/lib/api/auth-invitations-delete.js +0 -2883
  46. package/dist/lib/api/auth-invitations-delete.js.map +0 -1
  47. package/dist/lib/api/auth-invitations-resend.d.ts +0 -37
  48. package/dist/lib/api/auth-invitations-resend.js +0 -2883
  49. package/dist/lib/api/auth-invitations-resend.js.map +0 -1
  50. package/dist/lib/api/auth-invitations.d.ts +0 -109
  51. package/dist/lib/api/auth-invitations.js +0 -2887
  52. package/dist/lib/api/auth-invitations.js.map +0 -1
  53. package/dist/lib/api/auth-keys-rotate.d.ts +0 -37
  54. package/dist/lib/api/auth-keys-rotate.js +0 -2949
  55. package/dist/lib/api/auth-keys-rotate.js.map +0 -1
  56. package/dist/lib/api/auth-login.d.ts +0 -39
  57. package/dist/lib/api/auth-login.js +0 -2949
  58. package/dist/lib/api/auth-login.js.map +0 -1
  59. package/dist/lib/api/auth-logout.d.ts +0 -36
  60. package/dist/lib/api/auth-logout.js +0 -2949
  61. package/dist/lib/api/auth-logout.js.map +0 -1
  62. package/dist/lib/api/auth-me.d.ts +0 -50
  63. package/dist/lib/api/auth-me.js +0 -2949
  64. package/dist/lib/api/auth-me.js.map +0 -1
  65. package/dist/lib/api/auth-password.d.ts +0 -36
  66. package/dist/lib/api/auth-password.js +0 -2949
  67. package/dist/lib/api/auth-password.js.map +0 -1
  68. package/dist/lib/api/auth-register.d.ts +0 -38
  69. package/dist/lib/api/auth-register.js +0 -2949
  70. package/dist/lib/api/auth-register.js.map +0 -1
  71. package/dist/lib/api/index.d.ts +0 -356
  72. package/dist/lib/api/index.js +0 -3261
  73. package/dist/lib/api/index.js.map +0 -1
  74. package/dist/lib/config.d.ts +0 -70
  75. package/dist/lib/config.js +0 -64
  76. package/dist/lib/config.js.map +0 -1
  77. package/dist/lib/contracts/auth.d.ts +0 -302
  78. package/dist/lib/contracts/auth.js +0 -2951
  79. package/dist/lib/contracts/auth.js.map +0 -1
  80. package/dist/lib/contracts/index.d.ts +0 -3
  81. package/dist/lib/contracts/index.js +0 -3190
  82. package/dist/lib/contracts/index.js.map +0 -1
  83. package/dist/lib/contracts/invitation.d.ts +0 -243
  84. package/dist/lib/contracts/invitation.js +0 -2883
  85. package/dist/lib/contracts/invitation.js.map +0 -1
  86. package/dist/lib/crypto.d.ts +0 -76
  87. package/dist/lib/crypto.js +0 -127
  88. package/dist/lib/crypto.js.map +0 -1
  89. package/dist/lib/index.d.ts +0 -4
  90. package/dist/lib/index.js +0 -313
  91. package/dist/lib/index.js.map +0 -1
  92. package/dist/lib/session.d.ts +0 -68
  93. package/dist/lib/session.js +0 -126
  94. package/dist/lib/session.js.map +0 -1
  95. package/dist/lib/types/api.d.ts +0 -45
  96. package/dist/lib/types/api.js +0 -1
  97. package/dist/lib/types/api.js.map +0 -1
  98. package/dist/lib/types/index.d.ts +0 -3
  99. package/dist/lib/types/index.js +0 -2647
  100. package/dist/lib/types/index.js.map +0 -1
  101. package/dist/lib/types/schemas.d.ts +0 -45
  102. package/dist/lib/types/schemas.js +0 -2647
  103. package/dist/lib/types/schemas.js.map +0 -1
  104. package/dist/lib.js +0 -1
  105. package/dist/lib.js.map +0 -1
  106. package/dist/plugin.d.ts +0 -12
  107. package/dist/plugin.js +0 -9083
  108. package/dist/plugin.js.map +0 -1
  109. package/dist/server/entities/index.d.ts +0 -11
  110. package/dist/server/entities/index.js +0 -395
  111. package/dist/server/entities/index.js.map +0 -1
  112. package/dist/server/entities/invitations.d.ts +0 -241
  113. package/dist/server/entities/invitations.js +0 -184
  114. package/dist/server/entities/invitations.js.map +0 -1
  115. package/dist/server/entities/permissions.d.ts +0 -196
  116. package/dist/server/entities/permissions.js +0 -49
  117. package/dist/server/entities/permissions.js.map +0 -1
  118. package/dist/server/entities/role-permissions.d.ts +0 -107
  119. package/dist/server/entities/role-permissions.js +0 -115
  120. package/dist/server/entities/role-permissions.js.map +0 -1
  121. package/dist/server/entities/roles.d.ts +0 -196
  122. package/dist/server/entities/roles.js +0 -50
  123. package/dist/server/entities/roles.js.map +0 -1
  124. package/dist/server/entities/schema.d.ts +0 -14
  125. package/dist/server/entities/schema.js +0 -7
  126. package/dist/server/entities/schema.js.map +0 -1
  127. package/dist/server/entities/user-permissions.d.ts +0 -163
  128. package/dist/server/entities/user-permissions.js +0 -193
  129. package/dist/server/entities/user-permissions.js.map +0 -1
  130. package/dist/server/entities/user-public-keys.d.ts +0 -227
  131. package/dist/server/entities/user-public-keys.js +0 -156
  132. package/dist/server/entities/user-public-keys.js.map +0 -1
  133. package/dist/server/entities/user-social-accounts.d.ts +0 -189
  134. package/dist/server/entities/user-social-accounts.js +0 -149
  135. package/dist/server/entities/user-social-accounts.js.map +0 -1
  136. package/dist/server/entities/users.d.ts +0 -235
  137. package/dist/server/entities/users.js +0 -117
  138. package/dist/server/entities/users.js.map +0 -1
  139. package/dist/server/entities/verification-codes.d.ts +0 -191
  140. package/dist/server/entities/verification-codes.js +0 -49
  141. package/dist/server/entities/verification-codes.js.map +0 -1
  142. package/dist/server/routes/auth/index.d.ts +0 -10
  143. package/dist/server/routes/auth/index.js +0 -4460
  144. package/dist/server/routes/auth/index.js.map +0 -1
  145. package/dist/server/routes/index.d.ts +0 -6
  146. package/dist/server/routes/index.js +0 -6584
  147. package/dist/server/routes/index.js.map +0 -1
  148. package/dist/server/routes/invitations/index.d.ts +0 -10
  149. package/dist/server/routes/invitations/index.js +0 -4395
  150. package/dist/server/routes/invitations/index.js.map +0 -1
  151. package/migrations/0000_skinny_christian_walker.sql +0 -167
  152. /package/dist/{lib.d.ts → nextjs/api.d.ts} +0 -0
@@ -1,446 +0,0 @@
1
- import { DeleteInvitationBody } from '../../lib/api/auth-invitations-delete.js';
2
- export { DeleteInvitationResponse } from '../../lib/api/auth-invitations-delete.js';
3
- import { ResendInvitationBody } from '../../lib/api/auth-invitations-resend.js';
4
- export { ResendInvitationResponse } from '../../lib/api/auth-invitations-resend.js';
5
- import { CancelInvitationBody } from '../../lib/api/auth-invitations-cancel.js';
6
- export { CancelInvitationResponse } from '../../lib/api/auth-invitations-cancel.js';
7
- import { AcceptInvitationBody } from '../../lib/api/auth-invitations-accept.js';
8
- export { AcceptInvitationResponse } from '../../lib/api/auth-invitations-accept.js';
9
- import { GetInvitationParams, CreateInvitationBody, ListInvitationsQuery } from '../../lib/api/auth-invitations.js';
10
- export { CreateInvitationResponse, GetInvitationResponse, ListInvitationsResponse } from '../../lib/api/auth-invitations.js';
11
- import { GetMeBody } from '../../lib/api/auth-me.js';
12
- import { ChangePasswordBody } from '../../lib/api/auth-password.js';
13
- export { ChangePasswordResponse } from '../../lib/api/auth-password.js';
14
- export { RotateKeyResponse } from '../../lib/api/auth-keys-rotate.js';
15
- export { LogoutResponse } from '../../lib/api/auth-logout.js';
16
- export { LoginResponse } from '../../lib/api/auth-login.js';
17
- export { RegisterResponse } from '../../lib/api/auth-register.js';
18
- import { CheckAccountExistsBody } from '../../lib/api/auth-exists.js';
19
- export { CheckAccountExistsResponse } from '../../lib/api/auth-exists.js';
20
- import { VerifyCodeBody } from '../../lib/api/auth-codes-verify.js';
21
- export { VerifyCodeResponse } from '../../lib/api/auth-codes-verify.js';
22
- import { SendVerificationCodeBody } from '../../lib/api/auth-codes.js';
23
- export { SendVerificationCodeResponse } from '../../lib/api/auth-codes.js';
24
- export { client } from '@spfn/core/client';
25
- import '@spfn/core';
26
- import '../../lib/contracts/invitation.js';
27
- import '@sinclair/typebox';
28
- import '../../lib/contracts/auth.js';
29
-
30
- /**
31
- * Client-side login types (without key fields)
32
- */
33
- type ClientLoginParams = {
34
- body: {
35
- email?: string;
36
- phone?: string;
37
- password: string;
38
- };
39
- };
40
- /**
41
- * Client-side register types (without key fields)
42
- */
43
- type ClientRegisterParams = {
44
- body: {
45
- email?: string;
46
- phone?: string;
47
- password: string;
48
- verificationToken: string;
49
- };
50
- };
51
- /**
52
- * Login with email/password
53
- *
54
- * Interceptor automatically generates and injects publicKey fields
55
- */
56
- declare const login: (params: ClientLoginParams) => Promise<{
57
- message?: string | undefined;
58
- success: true;
59
- data: {
60
- email?: string | undefined;
61
- phone?: string | undefined;
62
- userId: string;
63
- passwordChangeRequired: boolean;
64
- };
65
- } | {
66
- success: false;
67
- error: {
68
- details?: any;
69
- message: string;
70
- code: string;
71
- };
72
- }>;
73
- /**
74
- * Register new account
75
- *
76
- * Interceptor automatically generates and injects publicKey fields
77
- */
78
- declare const register: (params: ClientRegisterParams) => Promise<{
79
- success: false;
80
- error: {
81
- details?: any;
82
- message: string;
83
- code: string;
84
- };
85
- } | {
86
- message?: string | undefined;
87
- success: true;
88
- data: {
89
- email?: string | undefined;
90
- phone?: string | undefined;
91
- userId: string;
92
- };
93
- }>;
94
- /**
95
- * Logout current session
96
- *
97
- * Interceptor automatically adds JWT authentication
98
- */
99
- declare const logout: () => Promise<{
100
- success: false;
101
- error: {
102
- details?: any;
103
- message: string;
104
- code: string;
105
- };
106
- } | {
107
- message?: string | undefined;
108
- success: true;
109
- data: {
110
- success: boolean;
111
- };
112
- }>;
113
- /**
114
- * Rotate encryption keys
115
- *
116
- * Interceptor automatically generates new key pair and adds JWT authentication
117
- */
118
- declare const rotateKey: () => Promise<{
119
- success: false;
120
- error: {
121
- details?: any;
122
- message: string;
123
- code: string;
124
- };
125
- } | {
126
- message?: string | undefined;
127
- success: true;
128
- data: {
129
- success: boolean;
130
- keyId: string;
131
- };
132
- }>;
133
- /**
134
- * Auth API collection
135
- */
136
- declare const authApi: {
137
- readonly login: (params: ClientLoginParams) => Promise<{
138
- message?: string | undefined;
139
- success: true;
140
- data: {
141
- email?: string | undefined;
142
- phone?: string | undefined;
143
- userId: string;
144
- passwordChangeRequired: boolean;
145
- };
146
- } | {
147
- success: false;
148
- error: {
149
- details?: any;
150
- message: string;
151
- code: string;
152
- };
153
- }>;
154
- readonly register: (params: ClientRegisterParams) => Promise<{
155
- success: false;
156
- error: {
157
- details?: any;
158
- message: string;
159
- code: string;
160
- };
161
- } | {
162
- message?: string | undefined;
163
- success: true;
164
- data: {
165
- email?: string | undefined;
166
- phone?: string | undefined;
167
- userId: string;
168
- };
169
- }>;
170
- readonly logout: () => Promise<{
171
- success: false;
172
- error: {
173
- details?: any;
174
- message: string;
175
- code: string;
176
- };
177
- } | {
178
- message?: string | undefined;
179
- success: true;
180
- data: {
181
- success: boolean;
182
- };
183
- }>;
184
- readonly rotateKey: () => Promise<{
185
- success: false;
186
- error: {
187
- details?: any;
188
- message: string;
189
- code: string;
190
- };
191
- } | {
192
- message?: string | undefined;
193
- success: true;
194
- data: {
195
- success: boolean;
196
- keyId: string;
197
- };
198
- }>;
199
- readonly sendVerificationCode: (options: {
200
- body: SendVerificationCodeBody;
201
- }) => Promise<{
202
- success: false;
203
- error: {
204
- details?: any;
205
- message: string;
206
- code: string;
207
- };
208
- } | {
209
- message?: string | undefined;
210
- success: true;
211
- data: {
212
- success: boolean;
213
- expiresAt: string;
214
- };
215
- }>;
216
- readonly verifyCode: (options: {
217
- body: VerifyCodeBody;
218
- }) => Promise<{
219
- success: false;
220
- error: {
221
- details?: any;
222
- message: string;
223
- code: string;
224
- };
225
- } | {
226
- message?: string | undefined;
227
- success: true;
228
- data: {
229
- verificationToken?: string | undefined;
230
- valid: boolean;
231
- };
232
- }>;
233
- readonly checkAccountExists: (options: {
234
- body: CheckAccountExistsBody;
235
- }) => Promise<{
236
- success: false;
237
- error: {
238
- details?: any;
239
- message: string;
240
- code: string;
241
- };
242
- } | {
243
- message?: string | undefined;
244
- success: true;
245
- data: {
246
- exists: boolean;
247
- identifier: string;
248
- identifierType: "email" | "phone";
249
- };
250
- }>;
251
- readonly changePassword: (options: {
252
- body: ChangePasswordBody;
253
- }) => Promise<{
254
- success: false;
255
- error: {
256
- details?: any;
257
- message: string;
258
- code: string;
259
- };
260
- } | {
261
- message?: string | undefined;
262
- success: true;
263
- data: {
264
- success: boolean;
265
- };
266
- }>;
267
- readonly getMe: (options: {
268
- body: GetMeBody;
269
- }) => Promise<{
270
- success: false;
271
- error: {
272
- details?: any;
273
- message: string;
274
- code: string;
275
- };
276
- } | {
277
- message?: string | undefined;
278
- success: true;
279
- data: {
280
- email?: string | undefined;
281
- phone?: string | undefined;
282
- userId: string;
283
- role: {
284
- id: number;
285
- name: string;
286
- displayName: string;
287
- priority: number;
288
- };
289
- permissions: {
290
- category?: string | undefined;
291
- id: number;
292
- name: string;
293
- displayName: string;
294
- }[];
295
- };
296
- }>;
297
- readonly getInvitation: (options: {
298
- params: GetInvitationParams;
299
- }) => Promise<{
300
- success: false;
301
- error: {
302
- details?: any;
303
- message: string;
304
- code: string;
305
- };
306
- } | {
307
- message?: string | undefined;
308
- success: true;
309
- data: {
310
- metadata?: any;
311
- email: string;
312
- expiresAt: string;
313
- role: string;
314
- roleDisplayName: string;
315
- invitedBy: string;
316
- };
317
- }>;
318
- readonly createInvitation: (options: {
319
- body: CreateInvitationBody;
320
- }) => Promise<{
321
- success: false;
322
- error: {
323
- details?: any;
324
- message: string;
325
- code: string;
326
- };
327
- } | {
328
- message?: string | undefined;
329
- success: true;
330
- data: {
331
- email: string;
332
- expiresAt: string;
333
- id: number;
334
- token: string;
335
- roleId: number;
336
- invitationUrl: string;
337
- };
338
- }>;
339
- readonly listInvitations: (options: {
340
- query?: ListInvitationsQuery;
341
- }) => Promise<{
342
- success: false;
343
- error: {
344
- details?: any;
345
- message: string;
346
- code: string;
347
- };
348
- } | {
349
- message?: string | undefined;
350
- success: true;
351
- data: {
352
- page: number;
353
- limit: number;
354
- invitations: {
355
- acceptedAt?: string | undefined;
356
- cancelledAt?: string | undefined;
357
- email: string;
358
- expiresAt: string;
359
- role: {
360
- id: number;
361
- name: string;
362
- displayName: string;
363
- };
364
- id: number;
365
- status: string;
366
- inviter: {
367
- email: string;
368
- id: number;
369
- };
370
- createdAt: string;
371
- }[];
372
- total: number;
373
- totalPages: number;
374
- };
375
- }>;
376
- readonly acceptInvitation: (options: {
377
- body: AcceptInvitationBody;
378
- }) => Promise<{
379
- success: false;
380
- error: {
381
- details?: any;
382
- message: string;
383
- code: string;
384
- };
385
- } | {
386
- message?: string | undefined;
387
- success: true;
388
- data: {
389
- email: string;
390
- userId: number;
391
- role: string;
392
- };
393
- }>;
394
- readonly cancelInvitation: (options: {
395
- body: CancelInvitationBody;
396
- }) => Promise<{
397
- success: false;
398
- error: {
399
- details?: any;
400
- message: string;
401
- code: string;
402
- };
403
- } | {
404
- message?: string | undefined;
405
- success: true;
406
- data: {
407
- success: boolean;
408
- cancelledAt: string;
409
- };
410
- }>;
411
- readonly resendInvitation: (options: {
412
- body: ResendInvitationBody;
413
- }) => Promise<{
414
- success: false;
415
- error: {
416
- details?: any;
417
- message: string;
418
- code: string;
419
- };
420
- } | {
421
- message?: string | undefined;
422
- success: true;
423
- data: {
424
- success: boolean;
425
- expiresAt: string;
426
- };
427
- }>;
428
- readonly deleteInvitation: (options: {
429
- body: DeleteInvitationBody;
430
- }) => Promise<{
431
- success: false;
432
- error: {
433
- details?: any;
434
- message: string;
435
- code: string;
436
- };
437
- } | {
438
- message?: string | undefined;
439
- success: true;
440
- data: {
441
- success: boolean;
442
- };
443
- }>;
444
- };
445
-
446
- export { AcceptInvitationBody, CancelInvitationBody, ChangePasswordBody, CheckAccountExistsBody, type ClientLoginParams, type ClientRegisterParams, CreateInvitationBody, DeleteInvitationBody, GetInvitationParams, ListInvitationsQuery, ResendInvitationBody, SendVerificationCodeBody, VerifyCodeBody, authApi, login, logout, register, rotateKey };