/
JSON.ts
329 lines (299 loc) · 8.83 KB
/
JSON.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
import type { SamlAccountJSON } from '@clerk/types';
import type {
InvitationStatus,
OrganizationInvitationStatus,
OrganizationMembershipRole,
SignInStatus,
SignUpStatus,
} from './Enums';
export const ObjectType = {
AllowlistIdentifier: 'allowlist_identifier',
Client: 'client',
Email: 'email',
EmailAddress: 'email_address',
ExternalAccount: 'external_account',
FacebookAccount: 'facebook_account',
GoogleAccount: 'google_account',
Invitation: 'invitation',
OauthAccessToken: 'oauth_access_token',
Organization: 'organization',
OrganizationInvitation: 'organization_invitation',
OrganizationMembership: 'organization_membership',
PhoneNumber: 'phone_number',
RedirectUrl: 'redirect_url',
Session: 'session',
SignInAttempt: 'sign_in_attempt',
SignInToken: 'sign_in_token',
SignUpAttempt: 'sign_up_attempt',
SmsMessage: 'sms_message',
User: 'user',
Web3Wallet: 'web3_wallet',
Token: 'token',
TotalCount: 'total_count',
} as const;
export type ObjectType = (typeof ObjectType)[keyof typeof ObjectType];
export interface ClerkResourceJSON {
object: ObjectType;
id: string;
}
export interface TokenJSON {
object: typeof ObjectType.Token;
jwt: string;
}
export interface AllowlistIdentifierJSON extends ClerkResourceJSON {
object: typeof ObjectType.AllowlistIdentifier;
identifier: string;
created_at: number;
updated_at: number;
invitation_id?: string;
}
export interface ClientJSON extends ClerkResourceJSON {
object: typeof ObjectType.Client;
session_ids: string[];
sessions: SessionJSON[];
sign_in_id: string | null;
sign_up_id: string | null;
last_active_session_id: string | null;
created_at: number;
updated_at: number;
}
export interface EmailJSON extends ClerkResourceJSON {
object: typeof ObjectType.Email;
slug?: string | null;
from_email_name: string;
to_email_address?: string;
email_address_id: string | null;
user_id?: string | null;
subject?: string;
body?: string;
body_plain?: string | null;
status?: string;
data?: Record<string, any> | null;
delivered_by_clerk: boolean;
}
export interface EmailAddressJSON extends ClerkResourceJSON {
object: typeof ObjectType.EmailAddress;
email_address: string;
verification: VerificationJSON | null;
linked_to: IdentificationLinkJSON[];
}
export interface ExternalAccountJSON extends ClerkResourceJSON {
object: typeof ObjectType.ExternalAccount;
provider: string;
identification_id: string;
provider_user_id: string;
approved_scopes: string;
email_address: string;
first_name: string;
last_name: string;
image_url?: string;
username: string | null;
public_metadata?: Record<string, unknown> | null;
label: string | null;
verification: VerificationJSON | null;
}
export interface IdentificationLinkJSON extends ClerkResourceJSON {
type: string;
}
export interface InvitationJSON extends ClerkResourceJSON {
object: typeof ObjectType.Invitation;
email_address: string;
public_metadata: Record<string, unknown> | null;
revoked?: boolean;
status: InvitationStatus;
url?: string;
created_at: number;
updated_at: number;
}
export interface OauthAccessTokenJSON {
external_account_id: string;
object: typeof ObjectType.OauthAccessToken;
token: string;
provider: string;
public_metadata: Record<string, unknown>;
label: string | null;
// Only set in OAuth 2.0 tokens
scopes?: string[];
// Only set in OAuth 1.0 tokens
token_secret?: string;
}
export interface OrganizationJSON extends ClerkResourceJSON {
object: typeof ObjectType.Organization;
name: string;
slug: string;
image_url?: string;
has_image: boolean;
members_count?: number;
pending_invitations_count?: number;
max_allowed_memberships: number;
admin_delete_enabled: boolean;
public_metadata: OrganizationPublicMetadata | null;
private_metadata?: OrganizationPrivateMetadata;
created_by: string;
created_at: number;
updated_at: number;
}
export interface OrganizationInvitationJSON extends ClerkResourceJSON {
email_address: string;
role: OrganizationMembershipRole;
organization_id: string;
public_organization_data?: PublicOrganizationDataJSON | null;
status?: OrganizationInvitationStatus;
public_metadata: OrganizationInvitationPublicMetadata;
private_metadata: OrganizationInvitationPrivateMetadata;
created_at: number;
updated_at: number;
}
export interface PublicOrganizationDataJSON extends ClerkResourceJSON {
name: string;
slug: string;
image_url?: string;
has_image: boolean;
}
export interface OrganizationMembershipJSON extends ClerkResourceJSON {
object: typeof ObjectType.OrganizationMembership;
public_metadata: OrganizationMembershipPublicMetadata;
private_metadata?: OrganizationMembershipPrivateMetadata;
role: OrganizationMembershipRole;
permissions: string[];
created_at: number;
updated_at: number;
organization: OrganizationJSON;
public_user_data: OrganizationMembershipPublicUserDataJSON;
}
export interface OrganizationMembershipPublicUserDataJSON {
identifier: string;
first_name: string | null;
last_name: string | null;
image_url: string;
has_image: boolean;
user_id: string;
}
export interface PhoneNumberJSON extends ClerkResourceJSON {
object: typeof ObjectType.PhoneNumber;
phone_number: string;
reserved_for_second_factor: boolean;
default_second_factor: boolean;
reserved: boolean;
verification: VerificationJSON | null;
linked_to: IdentificationLinkJSON[];
backup_codes: string[];
}
export interface RedirectUrlJSON extends ClerkResourceJSON {
object: typeof ObjectType.RedirectUrl;
url: string;
created_at: number;
updated_at: number;
}
export interface SessionJSON extends ClerkResourceJSON {
object: typeof ObjectType.Session;
client_id: string;
user_id: string;
status: string;
last_active_organization_id?: string;
actor?: Record<string, unknown>;
last_active_at: number;
expire_at: number;
abandon_at: number;
created_at: number;
updated_at: number;
}
export interface SignInJSON extends ClerkResourceJSON {
object: typeof ObjectType.SignInToken;
status: SignInStatus;
identifier: string;
created_session_id: string | null;
}
export interface SignInTokenJSON extends ClerkResourceJSON {
user_id: string;
token: string;
status: 'pending' | 'accepted' | 'revoked';
url: string;
created_at: number;
updated_at: number;
}
export interface SignUpJSON extends ClerkResourceJSON {
object: typeof ObjectType.SignUpAttempt;
status: SignUpStatus;
username: string | null;
email_address: string | null;
phone_number: string | null;
web3_wallet: string | null;
web3_wallet_verification: VerificationJSON | null;
external_account: any;
has_password: boolean;
name_full: string | null;
created_session_id: string | null;
created_user_id: string | null;
abandon_at: number | null;
}
export interface SMSMessageJSON extends ClerkResourceJSON {
object: typeof ObjectType.SmsMessage;
from_phone_number: string;
to_phone_number: string;
phone_number_id: string | null;
user_id?: string;
message: string;
status: string;
data?: Record<string, any> | null;
delivered_by_clerk: boolean;
}
export interface UserJSON extends ClerkResourceJSON {
object: typeof ObjectType.User;
username: string | null;
first_name: string | null;
last_name: string | null;
image_url: string;
has_image: boolean;
primary_email_address_id: string | null;
primary_phone_number_id: string | null;
primary_web3_wallet_id: string | null;
password_enabled: boolean;
two_factor_enabled: boolean;
totp_enabled: boolean;
backup_code_enabled: boolean;
email_addresses: EmailAddressJSON[];
phone_numbers: PhoneNumberJSON[];
web3_wallets: Web3WalletJSON[];
organization_memberships: OrganizationMembershipJSON[] | null;
external_accounts: ExternalAccountJSON[];
saml_accounts: SamlAccountJSON[];
password_last_updated_at: number | null;
public_metadata: UserPublicMetadata;
private_metadata: UserPrivateMetadata;
unsafe_metadata: UserUnsafeMetadata;
external_id: string | null;
last_sign_in_at: number | null;
banned: boolean;
locked: boolean;
lockout_expires_in_seconds: number | null;
verification_attempts_remaining: number | null;
created_at: number;
updated_at: number;
last_active_at: number | null;
create_organization_enabled: boolean;
}
export interface VerificationJSON extends ClerkResourceJSON {
status: string;
strategy: string;
attempts: number | null;
expire_at: number | null;
verified_at_client?: string;
external_verification_redirect_url?: string | null;
nonce?: string | null;
}
export interface Web3WalletJSON extends ClerkResourceJSON {
object: typeof ObjectType.Web3Wallet;
web3_wallet: string;
verification: VerificationJSON | null;
}
export interface DeletedObjectJSON {
object: string;
id?: string;
slug?: string;
deleted: boolean;
}
export interface PaginatedResponseJSON {
data: object[];
total_count?: number;
}