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

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 (151) hide show
  1. package/README.md +1385 -1199
  2. package/dist/config.d.ts +405 -0
  3. package/dist/config.js +240 -0
  4. package/dist/config.js.map +1 -0
  5. package/dist/dto-CLYtuAom.d.ts +630 -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 +273 -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 +179 -0
  16. package/dist/nextjs/server.js.map +1 -0
  17. package/dist/server.d.ts +4328 -529
  18. package/dist/server.js +7841 -1247
  19. package/dist/server.js.map +1 -1
  20. package/migrations/{0000_skinny_christian_walker.sql → 0000_marvelous_justice.sql} +53 -23
  21. package/migrations/meta/0000_snapshot.json +281 -46
  22. package/migrations/meta/_journal.json +2 -2
  23. package/package.json +31 -31
  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/dist/{lib.d.ts → nextjs/api.d.ts} +0 -0
@@ -1,356 +0,0 @@
1
- import { DeleteInvitationBody } from './auth-invitations-delete.js';
2
- export { DeleteInvitationResponse } from './auth-invitations-delete.js';
3
- import { ResendInvitationBody } from './auth-invitations-resend.js';
4
- export { ResendInvitationResponse } from './auth-invitations-resend.js';
5
- import { CancelInvitationBody } from './auth-invitations-cancel.js';
6
- export { CancelInvitationResponse } from './auth-invitations-cancel.js';
7
- import { AcceptInvitationBody } from './auth-invitations-accept.js';
8
- export { AcceptInvitationResponse } from './auth-invitations-accept.js';
9
- import { GetInvitationParams, CreateInvitationBody, ListInvitationsQuery } from './auth-invitations.js';
10
- export { CreateInvitationResponse, GetInvitationResponse, ListInvitationsResponse } from './auth-invitations.js';
11
- import { GetMeBody } from './auth-me.js';
12
- export { GetMeResponse } from './auth-me.js';
13
- import { ChangePasswordBody } from './auth-password.js';
14
- export { ChangePasswordResponse } from './auth-password.js';
15
- import { RotateKeyBody } from './auth-keys-rotate.js';
16
- export { RotateKeyResponse } from './auth-keys-rotate.js';
17
- import { LogoutBody } from './auth-logout.js';
18
- export { LogoutResponse } from './auth-logout.js';
19
- import { LoginBody } from './auth-login.js';
20
- export { LoginResponse } from './auth-login.js';
21
- import { RegisterBody } from './auth-register.js';
22
- export { RegisterResponse } from './auth-register.js';
23
- import { CheckAccountExistsBody } from './auth-exists.js';
24
- export { CheckAccountExistsResponse } from './auth-exists.js';
25
- import { VerifyCodeBody } from './auth-codes-verify.js';
26
- export { VerifyCodeResponse } from './auth-codes-verify.js';
27
- import { SendVerificationCodeBody } from './auth-codes.js';
28
- export { SendVerificationCodeResponse } from './auth-codes.js';
29
- export { client } from '@spfn/core/client';
30
- import '@spfn/core';
31
- import '../contracts/invitation.js';
32
- import '@sinclair/typebox';
33
- import '../contracts/auth.js';
34
-
35
- /**
36
- * Type-safe API client
37
- */
38
- declare const authApi: {
39
- readonly sendVerificationCode: (options: {
40
- body: SendVerificationCodeBody;
41
- }) => Promise<{
42
- success: false;
43
- error: {
44
- details?: any;
45
- message: string;
46
- code: string;
47
- };
48
- } | {
49
- message?: string | undefined;
50
- success: true;
51
- data: {
52
- success: boolean;
53
- expiresAt: string;
54
- };
55
- }>;
56
- readonly verifyCode: (options: {
57
- body: VerifyCodeBody;
58
- }) => Promise<{
59
- success: false;
60
- error: {
61
- details?: any;
62
- message: string;
63
- code: string;
64
- };
65
- } | {
66
- message?: string | undefined;
67
- success: true;
68
- data: {
69
- verificationToken?: string | undefined;
70
- valid: boolean;
71
- };
72
- }>;
73
- readonly checkAccountExists: (options: {
74
- body: CheckAccountExistsBody;
75
- }) => Promise<{
76
- success: false;
77
- error: {
78
- details?: any;
79
- message: string;
80
- code: string;
81
- };
82
- } | {
83
- message?: string | undefined;
84
- success: true;
85
- data: {
86
- exists: boolean;
87
- identifier: string;
88
- identifierType: "email" | "phone";
89
- };
90
- }>;
91
- readonly register: (options: {
92
- body: RegisterBody;
93
- }) => Promise<{
94
- success: false;
95
- error: {
96
- details?: any;
97
- message: string;
98
- code: string;
99
- };
100
- } | {
101
- message?: string | undefined;
102
- success: true;
103
- data: {
104
- email?: string | undefined;
105
- phone?: string | undefined;
106
- userId: string;
107
- };
108
- }>;
109
- readonly login: (options: {
110
- body: LoginBody;
111
- }) => Promise<{
112
- message?: string | undefined;
113
- success: true;
114
- data: {
115
- email?: string | undefined;
116
- phone?: string | undefined;
117
- userId: string;
118
- passwordChangeRequired: boolean;
119
- };
120
- } | {
121
- success: false;
122
- error: {
123
- details?: any;
124
- message: string;
125
- code: string;
126
- };
127
- }>;
128
- readonly logout: (options: {
129
- body: LogoutBody;
130
- }) => Promise<{
131
- success: false;
132
- error: {
133
- details?: any;
134
- message: string;
135
- code: string;
136
- };
137
- } | {
138
- message?: string | undefined;
139
- success: true;
140
- data: {
141
- success: boolean;
142
- };
143
- }>;
144
- readonly rotateKey: (options: {
145
- body: RotateKeyBody;
146
- }) => Promise<{
147
- success: false;
148
- error: {
149
- details?: any;
150
- message: string;
151
- code: string;
152
- };
153
- } | {
154
- message?: string | undefined;
155
- success: true;
156
- data: {
157
- success: boolean;
158
- keyId: string;
159
- };
160
- }>;
161
- readonly changePassword: (options: {
162
- body: ChangePasswordBody;
163
- }) => Promise<{
164
- success: false;
165
- error: {
166
- details?: any;
167
- message: string;
168
- code: string;
169
- };
170
- } | {
171
- message?: string | undefined;
172
- success: true;
173
- data: {
174
- success: boolean;
175
- };
176
- }>;
177
- readonly getMe: (options: {
178
- body: GetMeBody;
179
- }) => Promise<{
180
- success: false;
181
- error: {
182
- details?: any;
183
- message: string;
184
- code: string;
185
- };
186
- } | {
187
- message?: string | undefined;
188
- success: true;
189
- data: {
190
- email?: string | undefined;
191
- phone?: string | undefined;
192
- userId: string;
193
- role: {
194
- id: number;
195
- name: string;
196
- displayName: string;
197
- priority: number;
198
- };
199
- permissions: {
200
- category?: string | undefined;
201
- id: number;
202
- name: string;
203
- displayName: string;
204
- }[];
205
- };
206
- }>;
207
- readonly getInvitation: (options: {
208
- params: GetInvitationParams;
209
- }) => Promise<{
210
- success: false;
211
- error: {
212
- details?: any;
213
- message: string;
214
- code: string;
215
- };
216
- } | {
217
- message?: string | undefined;
218
- success: true;
219
- data: {
220
- metadata?: any;
221
- email: string;
222
- expiresAt: string;
223
- role: string;
224
- roleDisplayName: string;
225
- invitedBy: string;
226
- };
227
- }>;
228
- readonly createInvitation: (options: {
229
- body: CreateInvitationBody;
230
- }) => Promise<{
231
- success: false;
232
- error: {
233
- details?: any;
234
- message: string;
235
- code: string;
236
- };
237
- } | {
238
- message?: string | undefined;
239
- success: true;
240
- data: {
241
- email: string;
242
- expiresAt: string;
243
- id: number;
244
- token: string;
245
- roleId: number;
246
- invitationUrl: string;
247
- };
248
- }>;
249
- readonly listInvitations: (options: {
250
- query?: ListInvitationsQuery;
251
- }) => Promise<{
252
- success: false;
253
- error: {
254
- details?: any;
255
- message: string;
256
- code: string;
257
- };
258
- } | {
259
- message?: string | undefined;
260
- success: true;
261
- data: {
262
- page: number;
263
- limit: number;
264
- invitations: {
265
- acceptedAt?: string | undefined;
266
- cancelledAt?: string | undefined;
267
- email: string;
268
- expiresAt: string;
269
- role: {
270
- id: number;
271
- name: string;
272
- displayName: string;
273
- };
274
- id: number;
275
- status: string;
276
- inviter: {
277
- email: string;
278
- id: number;
279
- };
280
- createdAt: string;
281
- }[];
282
- total: number;
283
- totalPages: number;
284
- };
285
- }>;
286
- readonly acceptInvitation: (options: {
287
- body: AcceptInvitationBody;
288
- }) => Promise<{
289
- success: false;
290
- error: {
291
- details?: any;
292
- message: string;
293
- code: string;
294
- };
295
- } | {
296
- message?: string | undefined;
297
- success: true;
298
- data: {
299
- email: string;
300
- userId: number;
301
- role: string;
302
- };
303
- }>;
304
- readonly cancelInvitation: (options: {
305
- body: CancelInvitationBody;
306
- }) => Promise<{
307
- success: false;
308
- error: {
309
- details?: any;
310
- message: string;
311
- code: string;
312
- };
313
- } | {
314
- message?: string | undefined;
315
- success: true;
316
- data: {
317
- success: boolean;
318
- cancelledAt: string;
319
- };
320
- }>;
321
- readonly resendInvitation: (options: {
322
- body: ResendInvitationBody;
323
- }) => Promise<{
324
- success: false;
325
- error: {
326
- details?: any;
327
- message: string;
328
- code: string;
329
- };
330
- } | {
331
- message?: string | undefined;
332
- success: true;
333
- data: {
334
- success: boolean;
335
- expiresAt: string;
336
- };
337
- }>;
338
- readonly deleteInvitation: (options: {
339
- body: DeleteInvitationBody;
340
- }) => Promise<{
341
- success: false;
342
- error: {
343
- details?: any;
344
- message: string;
345
- code: string;
346
- };
347
- } | {
348
- message?: string | undefined;
349
- success: true;
350
- data: {
351
- success: boolean;
352
- };
353
- }>;
354
- };
355
-
356
- export { AcceptInvitationBody, CancelInvitationBody, ChangePasswordBody, CheckAccountExistsBody, CreateInvitationBody, DeleteInvitationBody, GetInvitationParams, GetMeBody, ListInvitationsQuery, LoginBody, LogoutBody, RegisterBody, ResendInvitationBody, RotateKeyBody, SendVerificationCodeBody, VerifyCodeBody, authApi };