@spfn/auth 0.1.0-alpha.0 → 0.1.0-alpha.86

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 (144) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +320 -12
  3. package/dist/adapters/nextjs/api.d.ts +446 -0
  4. package/dist/adapters/nextjs/api.js +3279 -0
  5. package/dist/adapters/nextjs/api.js.map +1 -0
  6. package/dist/adapters/nextjs/server.d.ts +246 -0
  7. package/dist/adapters/nextjs/server.js +3645 -0
  8. package/dist/adapters/nextjs/server.js.map +1 -0
  9. package/dist/client.d.ts +2 -0
  10. package/dist/client.js +1 -0
  11. package/dist/client.js.map +1 -0
  12. package/dist/index.d.ts +14 -0
  13. package/dist/index.js +9098 -0
  14. package/dist/index.js.map +1 -0
  15. package/dist/lib/api/auth-codes-verify.d.ts +37 -0
  16. package/dist/lib/api/auth-codes-verify.js +2949 -0
  17. package/dist/lib/api/auth-codes-verify.js.map +1 -0
  18. package/dist/lib/api/auth-codes.d.ts +37 -0
  19. package/dist/lib/api/auth-codes.js +2949 -0
  20. package/dist/lib/api/auth-codes.js.map +1 -0
  21. package/dist/lib/api/auth-exists.d.ts +38 -0
  22. package/dist/lib/api/auth-exists.js +2949 -0
  23. package/dist/lib/api/auth-exists.js.map +1 -0
  24. package/dist/lib/api/auth-invitations-accept.d.ts +38 -0
  25. package/dist/lib/api/auth-invitations-accept.js +2883 -0
  26. package/dist/lib/api/auth-invitations-accept.js.map +1 -0
  27. package/dist/lib/api/auth-invitations-cancel.d.ts +37 -0
  28. package/dist/lib/api/auth-invitations-cancel.js +2883 -0
  29. package/dist/lib/api/auth-invitations-cancel.js.map +1 -0
  30. package/dist/lib/api/auth-invitations-delete.d.ts +36 -0
  31. package/dist/lib/api/auth-invitations-delete.js +2883 -0
  32. package/dist/lib/api/auth-invitations-delete.js.map +1 -0
  33. package/dist/lib/api/auth-invitations-resend.d.ts +37 -0
  34. package/dist/lib/api/auth-invitations-resend.js +2883 -0
  35. package/dist/lib/api/auth-invitations-resend.js.map +1 -0
  36. package/dist/lib/api/auth-invitations.d.ts +109 -0
  37. package/dist/lib/api/auth-invitations.js +2887 -0
  38. package/dist/lib/api/auth-invitations.js.map +1 -0
  39. package/dist/lib/api/auth-keys-rotate.d.ts +37 -0
  40. package/dist/lib/api/auth-keys-rotate.js +2949 -0
  41. package/dist/lib/api/auth-keys-rotate.js.map +1 -0
  42. package/dist/lib/api/auth-login.d.ts +39 -0
  43. package/dist/lib/api/auth-login.js +2949 -0
  44. package/dist/lib/api/auth-login.js.map +1 -0
  45. package/dist/lib/api/auth-logout.d.ts +36 -0
  46. package/dist/lib/api/auth-logout.js +2949 -0
  47. package/dist/lib/api/auth-logout.js.map +1 -0
  48. package/dist/lib/api/auth-me.d.ts +50 -0
  49. package/dist/lib/api/auth-me.js +2949 -0
  50. package/dist/lib/api/auth-me.js.map +1 -0
  51. package/dist/lib/api/auth-password.d.ts +36 -0
  52. package/dist/lib/api/auth-password.js +2949 -0
  53. package/dist/lib/api/auth-password.js.map +1 -0
  54. package/dist/lib/api/auth-register.d.ts +38 -0
  55. package/dist/lib/api/auth-register.js +2949 -0
  56. package/dist/lib/api/auth-register.js.map +1 -0
  57. package/dist/lib/api/index.d.ts +356 -0
  58. package/dist/lib/api/index.js +3261 -0
  59. package/dist/lib/api/index.js.map +1 -0
  60. package/dist/lib/config.d.ts +70 -0
  61. package/dist/lib/config.js +64 -0
  62. package/dist/lib/config.js.map +1 -0
  63. package/dist/lib/contracts/auth.d.ts +302 -0
  64. package/dist/lib/contracts/auth.js +2951 -0
  65. package/dist/lib/contracts/auth.js.map +1 -0
  66. package/dist/lib/contracts/index.d.ts +3 -0
  67. package/dist/lib/contracts/index.js +3190 -0
  68. package/dist/lib/contracts/index.js.map +1 -0
  69. package/dist/lib/contracts/invitation.d.ts +243 -0
  70. package/dist/lib/contracts/invitation.js +2883 -0
  71. package/dist/lib/contracts/invitation.js.map +1 -0
  72. package/dist/lib/crypto.d.ts +76 -0
  73. package/dist/lib/crypto.js +127 -0
  74. package/dist/lib/crypto.js.map +1 -0
  75. package/dist/lib/index.d.ts +4 -0
  76. package/dist/lib/index.js +313 -0
  77. package/dist/lib/index.js.map +1 -0
  78. package/dist/lib/session.d.ts +68 -0
  79. package/dist/lib/session.js +126 -0
  80. package/dist/lib/session.js.map +1 -0
  81. package/dist/lib/types/api.d.ts +45 -0
  82. package/dist/lib/types/api.js +1 -0
  83. package/dist/lib/types/api.js.map +1 -0
  84. package/dist/lib/types/index.d.ts +3 -0
  85. package/dist/lib/types/index.js +2647 -0
  86. package/dist/lib/types/index.js.map +1 -0
  87. package/dist/lib/types/schemas.d.ts +45 -0
  88. package/dist/lib/types/schemas.js +2647 -0
  89. package/dist/lib/types/schemas.js.map +1 -0
  90. package/dist/lib.d.ts +2 -0
  91. package/dist/lib.js +1 -0
  92. package/dist/lib.js.map +1 -0
  93. package/dist/plugin.d.ts +12 -0
  94. package/dist/plugin.js +9081 -0
  95. package/dist/plugin.js.map +1 -0
  96. package/dist/server/entities/index.d.ts +11 -0
  97. package/dist/server/entities/index.js +395 -0
  98. package/dist/server/entities/index.js.map +1 -0
  99. package/dist/server/entities/invitations.d.ts +241 -0
  100. package/dist/server/entities/invitations.js +184 -0
  101. package/dist/server/entities/invitations.js.map +1 -0
  102. package/dist/server/entities/permissions.d.ts +196 -0
  103. package/dist/server/entities/permissions.js +49 -0
  104. package/dist/server/entities/permissions.js.map +1 -0
  105. package/dist/server/entities/role-permissions.d.ts +107 -0
  106. package/dist/server/entities/role-permissions.js +115 -0
  107. package/dist/server/entities/role-permissions.js.map +1 -0
  108. package/dist/server/entities/roles.d.ts +196 -0
  109. package/dist/server/entities/roles.js +50 -0
  110. package/dist/server/entities/roles.js.map +1 -0
  111. package/dist/server/entities/schema.d.ts +14 -0
  112. package/dist/server/entities/schema.js +7 -0
  113. package/dist/server/entities/schema.js.map +1 -0
  114. package/dist/server/entities/user-permissions.d.ts +163 -0
  115. package/dist/server/entities/user-permissions.js +193 -0
  116. package/dist/server/entities/user-permissions.js.map +1 -0
  117. package/dist/server/entities/user-public-keys.d.ts +227 -0
  118. package/dist/server/entities/user-public-keys.js +156 -0
  119. package/dist/server/entities/user-public-keys.js.map +1 -0
  120. package/dist/server/entities/user-social-accounts.d.ts +189 -0
  121. package/dist/server/entities/user-social-accounts.js +149 -0
  122. package/dist/server/entities/user-social-accounts.js.map +1 -0
  123. package/dist/server/entities/users.d.ts +235 -0
  124. package/dist/server/entities/users.js +117 -0
  125. package/dist/server/entities/users.js.map +1 -0
  126. package/dist/server/entities/verification-codes.d.ts +191 -0
  127. package/dist/server/entities/verification-codes.js +49 -0
  128. package/dist/server/entities/verification-codes.js.map +1 -0
  129. package/dist/server/routes/auth/index.d.ts +10 -0
  130. package/dist/server/routes/auth/index.js +4458 -0
  131. package/dist/server/routes/auth/index.js.map +1 -0
  132. package/dist/server/routes/index.d.ts +6 -0
  133. package/dist/server/routes/index.js +6582 -0
  134. package/dist/server/routes/index.js.map +1 -0
  135. package/dist/server/routes/invitations/index.d.ts +10 -0
  136. package/dist/server/routes/invitations/index.js +4395 -0
  137. package/dist/server/routes/invitations/index.js.map +1 -0
  138. package/dist/server.d.ts +1272 -0
  139. package/dist/server.js +2274 -0
  140. package/dist/server.js.map +1 -0
  141. package/migrations/0000_complex_swordsman.sql +167 -0
  142. package/migrations/meta/0000_snapshot.json +1397 -0
  143. package/migrations/meta/_journal.json +13 -0
  144. package/package.json +59 -24
@@ -0,0 +1,356 @@
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 };