@spfn/auth 0.1.0-alpha.0 → 0.1.0-alpha.1
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.
- package/LICENSE +21 -0
- package/README.md +70 -12
- package/dist/api-BcQM4WKb.d.ts +45 -0
- package/dist/client.d.ts +2 -0
- package/dist/client.js +1 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +57 -0
- package/dist/index.js +8966 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/contracts/auth.d.ts +262 -0
- package/dist/lib/contracts/auth.js +2923 -0
- package/dist/lib/contracts/auth.js.map +1 -0
- package/dist/lib/contracts/index.d.ts +3 -0
- package/dist/lib/contracts/index.js +3162 -0
- package/dist/lib/contracts/index.js.map +1 -0
- package/dist/lib/contracts/invitation.d.ts +243 -0
- package/dist/lib/contracts/invitation.js +2883 -0
- package/dist/lib/contracts/invitation.js.map +1 -0
- package/dist/plugin.d.ts +12 -0
- package/dist/plugin.js +8949 -0
- package/dist/plugin.js.map +1 -0
- package/dist/server/entities/index.d.ts +10 -0
- package/dist/server/entities/index.js +399 -0
- package/dist/server/entities/index.js.map +1 -0
- package/dist/server/entities/invitations.d.ts +241 -0
- package/dist/server/entities/invitations.js +181 -0
- package/dist/server/entities/invitations.js.map +1 -0
- package/dist/server/entities/permissions.d.ts +196 -0
- package/dist/server/entities/permissions.js +44 -0
- package/dist/server/entities/permissions.js.map +1 -0
- package/dist/server/entities/role-permissions.d.ts +107 -0
- package/dist/server/entities/role-permissions.js +112 -0
- package/dist/server/entities/role-permissions.js.map +1 -0
- package/dist/server/entities/roles.d.ts +196 -0
- package/dist/server/entities/roles.js +45 -0
- package/dist/server/entities/roles.js.map +1 -0
- package/dist/server/entities/user-permissions.d.ts +163 -0
- package/dist/server/entities/user-permissions.js +191 -0
- package/dist/server/entities/user-permissions.js.map +1 -0
- package/dist/server/entities/user-public-keys.d.ts +227 -0
- package/dist/server/entities/user-public-keys.js +153 -0
- package/dist/server/entities/user-public-keys.js.map +1 -0
- package/dist/server/entities/user-social-accounts.d.ts +189 -0
- package/dist/server/entities/user-social-accounts.js +146 -0
- package/dist/server/entities/user-social-accounts.js.map +1 -0
- package/dist/server/entities/users.d.ts +235 -0
- package/dist/server/entities/users.js +113 -0
- package/dist/server/entities/users.js.map +1 -0
- package/dist/server/entities/verification-codes.d.ts +191 -0
- package/dist/server/entities/verification-codes.js +44 -0
- package/dist/server/entities/verification-codes.js.map +1 -0
- package/dist/server/routes/auth/index.d.ts +10 -0
- package/dist/server/routes/auth/index.js +4475 -0
- package/dist/server/routes/auth/index.js.map +1 -0
- package/dist/server/routes/index.d.ts +6 -0
- package/dist/server/routes/index.js +6352 -0
- package/dist/server/routes/index.js.map +1 -0
- package/dist/server/routes/invitations/index.d.ts +10 -0
- package/dist/server/routes/invitations/index.js +4209 -0
- package/dist/server/routes/invitations/index.js.map +1 -0
- package/dist/server.d.ts +1243 -0
- package/dist/server.js +2281 -0
- package/dist/server.js.map +1 -0
- package/migrations/0000_tired_gambit.sql +165 -0
- package/migrations/meta/0000_snapshot.json +1395 -0
- package/migrations/meta/_journal.json +13 -0
- package/package.json +32 -24
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import * as _sinclair_typebox from '@sinclair/typebox';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @spfn/auth - Invitation API Contracts
|
|
5
|
+
*
|
|
6
|
+
* Type-safe API contracts for user invitation operations
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* GET /_auth/invitations/:token - Get invitation details (public)
|
|
10
|
+
*
|
|
11
|
+
* Retrieves invitation information for acceptance page
|
|
12
|
+
*/
|
|
13
|
+
declare const getInvitationContract: {
|
|
14
|
+
readonly method: "GET";
|
|
15
|
+
readonly path: "/_auth/invitations/:token";
|
|
16
|
+
readonly params: _sinclair_typebox.TObject<{
|
|
17
|
+
token: _sinclair_typebox.TString;
|
|
18
|
+
}>;
|
|
19
|
+
readonly response: _sinclair_typebox.TUnion<[_sinclair_typebox.TObject<{
|
|
20
|
+
success: _sinclair_typebox.TLiteral<true>;
|
|
21
|
+
data: _sinclair_typebox.TObject<{
|
|
22
|
+
email: _sinclair_typebox.TString;
|
|
23
|
+
role: _sinclair_typebox.TString;
|
|
24
|
+
roleDisplayName: _sinclair_typebox.TString;
|
|
25
|
+
invitedBy: _sinclair_typebox.TString;
|
|
26
|
+
expiresAt: _sinclair_typebox.TString;
|
|
27
|
+
metadata: _sinclair_typebox.TOptional<_sinclair_typebox.TAny>;
|
|
28
|
+
}>;
|
|
29
|
+
message: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
30
|
+
}>, _sinclair_typebox.TObject<{
|
|
31
|
+
success: _sinclair_typebox.TLiteral<false>;
|
|
32
|
+
error: _sinclair_typebox.TObject<{
|
|
33
|
+
code: _sinclair_typebox.TString;
|
|
34
|
+
message: _sinclair_typebox.TString;
|
|
35
|
+
details: _sinclair_typebox.TOptional<_sinclair_typebox.TAny>;
|
|
36
|
+
}>;
|
|
37
|
+
}>]>;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* POST /_auth/invitations/accept - Accept invitation (public)
|
|
41
|
+
*
|
|
42
|
+
* Accepts invitation and creates user account with provided credentials
|
|
43
|
+
*/
|
|
44
|
+
declare const acceptInvitationContract: {
|
|
45
|
+
readonly method: "POST";
|
|
46
|
+
readonly path: "/_auth/invitations/accept";
|
|
47
|
+
readonly body: _sinclair_typebox.TObject<{
|
|
48
|
+
token: _sinclair_typebox.TString;
|
|
49
|
+
password: _sinclair_typebox.TString;
|
|
50
|
+
publicKey: _sinclair_typebox.TString;
|
|
51
|
+
keyId: _sinclair_typebox.TString;
|
|
52
|
+
fingerprint: _sinclair_typebox.TString;
|
|
53
|
+
algorithm: _sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"ES256">, _sinclair_typebox.TLiteral<"RS256">]>;
|
|
54
|
+
}>;
|
|
55
|
+
readonly response: _sinclair_typebox.TUnion<[_sinclair_typebox.TObject<{
|
|
56
|
+
success: _sinclair_typebox.TLiteral<true>;
|
|
57
|
+
data: _sinclair_typebox.TObject<{
|
|
58
|
+
userId: _sinclair_typebox.TNumber;
|
|
59
|
+
email: _sinclair_typebox.TString;
|
|
60
|
+
role: _sinclair_typebox.TString;
|
|
61
|
+
}>;
|
|
62
|
+
message: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
63
|
+
}>, _sinclair_typebox.TObject<{
|
|
64
|
+
success: _sinclair_typebox.TLiteral<false>;
|
|
65
|
+
error: _sinclair_typebox.TObject<{
|
|
66
|
+
code: _sinclair_typebox.TString;
|
|
67
|
+
message: _sinclair_typebox.TString;
|
|
68
|
+
details: _sinclair_typebox.TOptional<_sinclair_typebox.TAny>;
|
|
69
|
+
}>;
|
|
70
|
+
}>]>;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* POST /_auth/invitations - Create new invitation (admin)
|
|
74
|
+
*
|
|
75
|
+
* Creates and sends invitation to new user
|
|
76
|
+
* Requires: admin role or user:invite permission
|
|
77
|
+
*/
|
|
78
|
+
declare const createInvitationContract: {
|
|
79
|
+
readonly method: "POST";
|
|
80
|
+
readonly path: "/_auth/invitations";
|
|
81
|
+
readonly body: _sinclair_typebox.TObject<{
|
|
82
|
+
email: _sinclair_typebox.TString;
|
|
83
|
+
roleId: _sinclair_typebox.TNumber;
|
|
84
|
+
expiresInDays: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
|
|
85
|
+
metadata: _sinclair_typebox.TOptional<_sinclair_typebox.TAny>;
|
|
86
|
+
}>;
|
|
87
|
+
readonly response: _sinclair_typebox.TUnion<[_sinclair_typebox.TObject<{
|
|
88
|
+
success: _sinclair_typebox.TLiteral<true>;
|
|
89
|
+
data: _sinclair_typebox.TObject<{
|
|
90
|
+
id: _sinclair_typebox.TNumber;
|
|
91
|
+
email: _sinclair_typebox.TString;
|
|
92
|
+
token: _sinclair_typebox.TString;
|
|
93
|
+
roleId: _sinclair_typebox.TNumber;
|
|
94
|
+
expiresAt: _sinclair_typebox.TString;
|
|
95
|
+
invitationUrl: _sinclair_typebox.TString;
|
|
96
|
+
}>;
|
|
97
|
+
message: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
98
|
+
}>, _sinclair_typebox.TObject<{
|
|
99
|
+
success: _sinclair_typebox.TLiteral<false>;
|
|
100
|
+
error: _sinclair_typebox.TObject<{
|
|
101
|
+
code: _sinclair_typebox.TString;
|
|
102
|
+
message: _sinclair_typebox.TString;
|
|
103
|
+
details: _sinclair_typebox.TOptional<_sinclair_typebox.TAny>;
|
|
104
|
+
}>;
|
|
105
|
+
}>]>;
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* GET /_auth/invitations - List invitations (admin)
|
|
109
|
+
*
|
|
110
|
+
* Retrieves paginated list of invitations with filtering
|
|
111
|
+
* Requires: admin role
|
|
112
|
+
*/
|
|
113
|
+
declare const listInvitationsContract: {
|
|
114
|
+
readonly method: "GET";
|
|
115
|
+
readonly path: "/_auth/invitations";
|
|
116
|
+
readonly query: _sinclair_typebox.TObject<{
|
|
117
|
+
status: _sinclair_typebox.TOptional<_sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"pending">, _sinclair_typebox.TLiteral<"accepted">, _sinclair_typebox.TLiteral<"expired">, _sinclair_typebox.TLiteral<"cancelled">]>>;
|
|
118
|
+
page: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
|
|
119
|
+
limit: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
|
|
120
|
+
}>;
|
|
121
|
+
readonly response: _sinclair_typebox.TUnion<[_sinclair_typebox.TObject<{
|
|
122
|
+
success: _sinclair_typebox.TLiteral<true>;
|
|
123
|
+
data: _sinclair_typebox.TObject<{
|
|
124
|
+
invitations: _sinclair_typebox.TArray<_sinclair_typebox.TObject<{
|
|
125
|
+
id: _sinclair_typebox.TNumber;
|
|
126
|
+
email: _sinclair_typebox.TString;
|
|
127
|
+
status: _sinclair_typebox.TString;
|
|
128
|
+
role: _sinclair_typebox.TObject<{
|
|
129
|
+
id: _sinclair_typebox.TNumber;
|
|
130
|
+
name: _sinclair_typebox.TString;
|
|
131
|
+
displayName: _sinclair_typebox.TString;
|
|
132
|
+
}>;
|
|
133
|
+
inviter: _sinclair_typebox.TObject<{
|
|
134
|
+
id: _sinclair_typebox.TNumber;
|
|
135
|
+
email: _sinclair_typebox.TString;
|
|
136
|
+
}>;
|
|
137
|
+
createdAt: _sinclair_typebox.TString;
|
|
138
|
+
expiresAt: _sinclair_typebox.TString;
|
|
139
|
+
acceptedAt: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
140
|
+
cancelledAt: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
141
|
+
}>>;
|
|
142
|
+
total: _sinclair_typebox.TNumber;
|
|
143
|
+
page: _sinclair_typebox.TNumber;
|
|
144
|
+
limit: _sinclair_typebox.TNumber;
|
|
145
|
+
totalPages: _sinclair_typebox.TNumber;
|
|
146
|
+
}>;
|
|
147
|
+
message: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
148
|
+
}>, _sinclair_typebox.TObject<{
|
|
149
|
+
success: _sinclair_typebox.TLiteral<false>;
|
|
150
|
+
error: _sinclair_typebox.TObject<{
|
|
151
|
+
code: _sinclair_typebox.TString;
|
|
152
|
+
message: _sinclair_typebox.TString;
|
|
153
|
+
details: _sinclair_typebox.TOptional<_sinclair_typebox.TAny>;
|
|
154
|
+
}>;
|
|
155
|
+
}>]>;
|
|
156
|
+
};
|
|
157
|
+
/**
|
|
158
|
+
* POST /_auth/invitations/cancel - Cancel invitation (admin)
|
|
159
|
+
*
|
|
160
|
+
* Cancels pending invitation
|
|
161
|
+
* Requires: admin role or invitation owner
|
|
162
|
+
*/
|
|
163
|
+
declare const cancelInvitationContract: {
|
|
164
|
+
readonly method: "POST";
|
|
165
|
+
readonly path: "/_auth/invitations/cancel";
|
|
166
|
+
readonly body: _sinclair_typebox.TObject<{
|
|
167
|
+
id: _sinclair_typebox.TNumber;
|
|
168
|
+
reason: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
169
|
+
}>;
|
|
170
|
+
readonly response: _sinclair_typebox.TUnion<[_sinclair_typebox.TObject<{
|
|
171
|
+
success: _sinclair_typebox.TLiteral<true>;
|
|
172
|
+
data: _sinclair_typebox.TObject<{
|
|
173
|
+
success: _sinclair_typebox.TBoolean;
|
|
174
|
+
cancelledAt: _sinclair_typebox.TString;
|
|
175
|
+
}>;
|
|
176
|
+
message: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
177
|
+
}>, _sinclair_typebox.TObject<{
|
|
178
|
+
success: _sinclair_typebox.TLiteral<false>;
|
|
179
|
+
error: _sinclair_typebox.TObject<{
|
|
180
|
+
code: _sinclair_typebox.TString;
|
|
181
|
+
message: _sinclair_typebox.TString;
|
|
182
|
+
details: _sinclair_typebox.TOptional<_sinclair_typebox.TAny>;
|
|
183
|
+
}>;
|
|
184
|
+
}>]>;
|
|
185
|
+
};
|
|
186
|
+
/**
|
|
187
|
+
* POST /_auth/invitations/resend - Resend invitation (admin)
|
|
188
|
+
*
|
|
189
|
+
* Resends invitation email and extends expiration
|
|
190
|
+
* Requires: admin role
|
|
191
|
+
*/
|
|
192
|
+
declare const resendInvitationContract: {
|
|
193
|
+
readonly method: "POST";
|
|
194
|
+
readonly path: "/_auth/invitations/resend";
|
|
195
|
+
readonly body: _sinclair_typebox.TObject<{
|
|
196
|
+
id: _sinclair_typebox.TNumber;
|
|
197
|
+
expiresInDays: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
|
|
198
|
+
}>;
|
|
199
|
+
readonly response: _sinclair_typebox.TUnion<[_sinclair_typebox.TObject<{
|
|
200
|
+
success: _sinclair_typebox.TLiteral<true>;
|
|
201
|
+
data: _sinclair_typebox.TObject<{
|
|
202
|
+
success: _sinclair_typebox.TBoolean;
|
|
203
|
+
expiresAt: _sinclair_typebox.TString;
|
|
204
|
+
}>;
|
|
205
|
+
message: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
206
|
+
}>, _sinclair_typebox.TObject<{
|
|
207
|
+
success: _sinclair_typebox.TLiteral<false>;
|
|
208
|
+
error: _sinclair_typebox.TObject<{
|
|
209
|
+
code: _sinclair_typebox.TString;
|
|
210
|
+
message: _sinclair_typebox.TString;
|
|
211
|
+
details: _sinclair_typebox.TOptional<_sinclair_typebox.TAny>;
|
|
212
|
+
}>;
|
|
213
|
+
}>]>;
|
|
214
|
+
};
|
|
215
|
+
/**
|
|
216
|
+
* DELETE /_auth/invitations/delete - Delete invitation (superadmin)
|
|
217
|
+
*
|
|
218
|
+
* Permanently deletes invitation record
|
|
219
|
+
* Requires: superadmin role
|
|
220
|
+
*/
|
|
221
|
+
declare const deleteInvitationContract: {
|
|
222
|
+
readonly method: "POST";
|
|
223
|
+
readonly path: "/_auth/invitations/delete";
|
|
224
|
+
readonly body: _sinclair_typebox.TObject<{
|
|
225
|
+
id: _sinclair_typebox.TNumber;
|
|
226
|
+
}>;
|
|
227
|
+
readonly response: _sinclair_typebox.TUnion<[_sinclair_typebox.TObject<{
|
|
228
|
+
success: _sinclair_typebox.TLiteral<true>;
|
|
229
|
+
data: _sinclair_typebox.TObject<{
|
|
230
|
+
success: _sinclair_typebox.TBoolean;
|
|
231
|
+
}>;
|
|
232
|
+
message: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
233
|
+
}>, _sinclair_typebox.TObject<{
|
|
234
|
+
success: _sinclair_typebox.TLiteral<false>;
|
|
235
|
+
error: _sinclair_typebox.TObject<{
|
|
236
|
+
code: _sinclair_typebox.TString;
|
|
237
|
+
message: _sinclair_typebox.TString;
|
|
238
|
+
details: _sinclair_typebox.TOptional<_sinclair_typebox.TAny>;
|
|
239
|
+
}>;
|
|
240
|
+
}>]>;
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
export { acceptInvitationContract, cancelInvitationContract, createInvitationContract, deleteInvitationContract, getInvitationContract, listInvitationsContract, resendInvitationContract };
|