@geekapps/auth-nextjs 0.13.0 → 0.14.0
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/dist/connections.js +84 -22
- package/dist/connections.js.map +1 -1
- package/package.json +3 -2
- package/dist/actions.d.ts +0 -15
- package/dist/client.d.ts +0 -610
- package/dist/connections.d.ts +0 -114
- package/dist/middleware.d.ts +0 -22
- package/dist/server.d.ts +0 -138
package/dist/actions.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ConnectedAccount, User, Organization } from './client.js';
|
|
2
|
-
import 'react';
|
|
3
|
-
|
|
4
|
-
declare function getMe(): Promise<{
|
|
5
|
-
user: User | null;
|
|
6
|
-
}>;
|
|
7
|
-
declare function getAccounts(): Promise<{
|
|
8
|
-
accounts: ConnectedAccount[];
|
|
9
|
-
}>;
|
|
10
|
-
declare function getOrganizations(): Promise<{
|
|
11
|
-
organizations: Organization[];
|
|
12
|
-
currentOrgId?: string | null;
|
|
13
|
-
}>;
|
|
14
|
-
|
|
15
|
-
export { getAccounts, getMe, getOrganizations };
|
package/dist/client.d.ts
DELETED
|
@@ -1,610 +0,0 @@
|
|
|
1
|
-
import { MouseEvent, ReactNode, ReactElement } from 'react';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* A sessão não vale mais: expirou ou foi revogada. O estado local já foi
|
|
5
|
-
* limpo quando este erro é lançado — o tratamento normal é levar ao login.
|
|
6
|
-
*/
|
|
7
|
-
declare class GeekappsSessionExpiredError extends Error {
|
|
8
|
-
readonly code: "session_expired";
|
|
9
|
-
constructor(message?: string);
|
|
10
|
-
}
|
|
11
|
-
type UserStatus = "active" | "inactive" | "suspended";
|
|
12
|
-
type OrganizationStatus = "active" | "inactive" | "suspended";
|
|
13
|
-
type OAuthClientType = "public" | "confidential";
|
|
14
|
-
type AuthResult<T = unknown> = {
|
|
15
|
-
success: true;
|
|
16
|
-
data: T;
|
|
17
|
-
} | {
|
|
18
|
-
success: false;
|
|
19
|
-
error: string;
|
|
20
|
-
status?: number;
|
|
21
|
-
};
|
|
22
|
-
type User = {
|
|
23
|
-
id: string;
|
|
24
|
-
email: string;
|
|
25
|
-
name: string | null;
|
|
26
|
-
phone: string | null;
|
|
27
|
-
imageUrl: string | null;
|
|
28
|
-
status?: UserStatus;
|
|
29
|
-
createdAt?: string | Date;
|
|
30
|
-
updatedAt?: string | Date;
|
|
31
|
-
};
|
|
32
|
-
type ConnectedAccount = {
|
|
33
|
-
id: string;
|
|
34
|
-
sessionId?: string;
|
|
35
|
-
isActive: boolean;
|
|
36
|
-
user: User;
|
|
37
|
-
};
|
|
38
|
-
type Permission = {
|
|
39
|
-
id: string;
|
|
40
|
-
applicationId?: string | null;
|
|
41
|
-
key: string;
|
|
42
|
-
name: string;
|
|
43
|
-
description: string | null;
|
|
44
|
-
category: string | null;
|
|
45
|
-
isSystem: boolean;
|
|
46
|
-
isActive: boolean;
|
|
47
|
-
createdAt?: string | Date;
|
|
48
|
-
updatedAt?: string | Date;
|
|
49
|
-
};
|
|
50
|
-
type RolePermission = {
|
|
51
|
-
permissionDefinition: Permission;
|
|
52
|
-
};
|
|
53
|
-
type Role = {
|
|
54
|
-
id: string;
|
|
55
|
-
applicationId?: string | null;
|
|
56
|
-
/** Present only on custom roles */
|
|
57
|
-
organizationId?: string | null;
|
|
58
|
-
/** "system" | "custom" */
|
|
59
|
-
type?: string;
|
|
60
|
-
key: string;
|
|
61
|
-
name: string;
|
|
62
|
-
description: string | null;
|
|
63
|
-
isSystem?: boolean;
|
|
64
|
-
isDefault?: boolean;
|
|
65
|
-
isActive: boolean;
|
|
66
|
-
permissions: RolePermission[];
|
|
67
|
-
createdAt?: string | Date;
|
|
68
|
-
updatedAt?: string | Date;
|
|
69
|
-
};
|
|
70
|
-
type RoleAssignment = {
|
|
71
|
-
id: string;
|
|
72
|
-
roleDefinitionId?: string | null;
|
|
73
|
-
customRoleId?: string | null;
|
|
74
|
-
roleDefinition?: Role | null;
|
|
75
|
-
customRole?: Role | null;
|
|
76
|
-
};
|
|
77
|
-
type OrganizationMember = {
|
|
78
|
-
id: string;
|
|
79
|
-
organizationId?: string;
|
|
80
|
-
userId?: string;
|
|
81
|
-
createdAt?: string | Date;
|
|
82
|
-
user: User;
|
|
83
|
-
roleAssignments?: RoleAssignment[];
|
|
84
|
-
};
|
|
85
|
-
type OrganizationInvite = {
|
|
86
|
-
id: string;
|
|
87
|
-
organizationId: string;
|
|
88
|
-
email: string;
|
|
89
|
-
/**
|
|
90
|
-
* Role que o convidado assume ao aceitar. Vem aninhada do auth-server (não
|
|
91
|
-
* como roleId solto) — null quando o convite não fixa nenhuma e o membro
|
|
92
|
-
* cai na role default da organização.
|
|
93
|
-
*/
|
|
94
|
-
role: {
|
|
95
|
-
id: string;
|
|
96
|
-
key: string;
|
|
97
|
-
name: string;
|
|
98
|
-
} | null;
|
|
99
|
-
/** @deprecated use `role.id` — o auth-server não devolve este campo. */
|
|
100
|
-
roleId?: string | null;
|
|
101
|
-
status: "pending" | "accepted" | "expired" | "revoked";
|
|
102
|
-
expiresAt: string | Date;
|
|
103
|
-
acceptedAt?: string | Date | null;
|
|
104
|
-
createdAt?: string | Date;
|
|
105
|
-
redirectUri?: string | null;
|
|
106
|
-
emailTitle?: string | null;
|
|
107
|
-
emailSubtitle?: string | null;
|
|
108
|
-
emailMessage?: string | null;
|
|
109
|
-
};
|
|
110
|
-
type MemberInviteInput = {
|
|
111
|
-
email: string;
|
|
112
|
-
roleId?: string;
|
|
113
|
-
/**
|
|
114
|
-
* URI pra onde o link do e-mail manda o usuário — precisa estar cadastrada
|
|
115
|
-
* em Application.redirectUris (mesma validação do /authorize). Este app
|
|
116
|
-
* deve expor uma rota nessa URI que trata o `?invite_token=` anexado (ver
|
|
117
|
-
* useJoinRequests/inviteApi.preview|accept|reject abaixo).
|
|
118
|
-
*/
|
|
119
|
-
redirectUri: string;
|
|
120
|
-
emailTitle?: string;
|
|
121
|
-
emailSubtitle?: string;
|
|
122
|
-
emailMessage?: string;
|
|
123
|
-
};
|
|
124
|
-
type AddMemberInput = {
|
|
125
|
-
userId: string;
|
|
126
|
-
roleId?: string;
|
|
127
|
-
};
|
|
128
|
-
type UpdateMemberInput = {
|
|
129
|
-
status?: "active" | "inactive" | "suspended";
|
|
130
|
-
roleId?: string | null;
|
|
131
|
-
};
|
|
132
|
-
/** @deprecated use UpdateMemberInput */
|
|
133
|
-
type UpdateMemberRoleInput = {
|
|
134
|
-
roleId: string;
|
|
135
|
-
};
|
|
136
|
-
type PublicOrganization = {
|
|
137
|
-
id: string;
|
|
138
|
-
name: string;
|
|
139
|
-
slug: string;
|
|
140
|
-
description: string | null;
|
|
141
|
-
imageUrl: string | null;
|
|
142
|
-
createdAt: string | Date;
|
|
143
|
-
};
|
|
144
|
-
type OrganizationInvitePreview = {
|
|
145
|
-
alreadyAccepted: true;
|
|
146
|
-
organizationId: string;
|
|
147
|
-
organizationName: string;
|
|
148
|
-
applicationName: string;
|
|
149
|
-
applicationImageUrl: string | null;
|
|
150
|
-
applicationImageFileId: string | null;
|
|
151
|
-
organizationImageUrl: string | null;
|
|
152
|
-
organizationImageFileId: string | null;
|
|
153
|
-
websiteUrl: string | null;
|
|
154
|
-
} | {
|
|
155
|
-
alreadyAccepted?: false;
|
|
156
|
-
email: string;
|
|
157
|
-
organizationId: string;
|
|
158
|
-
organizationName: string;
|
|
159
|
-
applicationName: string;
|
|
160
|
-
applicationId: string;
|
|
161
|
-
applicationImageUrl: string | null;
|
|
162
|
-
applicationImageFileId: string | null;
|
|
163
|
-
organizationImageUrl: string | null;
|
|
164
|
-
organizationImageFileId: string | null;
|
|
165
|
-
websiteUrl: string | null;
|
|
166
|
-
redirectUri: string | null;
|
|
167
|
-
appStoreUrl: string | null;
|
|
168
|
-
playStoreUrl: string | null;
|
|
169
|
-
currentAccount: {
|
|
170
|
-
email: string;
|
|
171
|
-
name: string | null;
|
|
172
|
-
} | null;
|
|
173
|
-
};
|
|
174
|
-
type AcceptInviteResult = {
|
|
175
|
-
success: true;
|
|
176
|
-
organizationId: string;
|
|
177
|
-
organizationName: string;
|
|
178
|
-
websiteUrl: string | null;
|
|
179
|
-
} | {
|
|
180
|
-
success: false;
|
|
181
|
-
wrongAccount: true;
|
|
182
|
-
currentEmail: string;
|
|
183
|
-
invitedEmail: string;
|
|
184
|
-
} | {
|
|
185
|
-
success: false;
|
|
186
|
-
wrongAccount: false;
|
|
187
|
-
loginRequired: true;
|
|
188
|
-
} | {
|
|
189
|
-
success: false;
|
|
190
|
-
wrongAccount: false;
|
|
191
|
-
loginRequired: false;
|
|
192
|
-
error: string;
|
|
193
|
-
};
|
|
194
|
-
type JoinRequestStatus = "pending" | "approved" | "rejected" | "cancelled";
|
|
195
|
-
type OrganizationJoinRequest = {
|
|
196
|
-
id: string;
|
|
197
|
-
organizationId: string;
|
|
198
|
-
userId: string;
|
|
199
|
-
status: JoinRequestStatus;
|
|
200
|
-
message: string | null;
|
|
201
|
-
reviewedByUserId: string | null;
|
|
202
|
-
reviewedAt: string | null;
|
|
203
|
-
createdAt: string | Date;
|
|
204
|
-
updatedAt: string | Date;
|
|
205
|
-
};
|
|
206
|
-
type OrganizationOwnedApplication = {
|
|
207
|
-
id: string;
|
|
208
|
-
name: string;
|
|
209
|
-
description: string | null;
|
|
210
|
-
imageUrl: string | null;
|
|
211
|
-
type?: OAuthClientType;
|
|
212
|
-
organizationId: string;
|
|
213
|
-
isFirstParty: boolean;
|
|
214
|
-
ssoEnabled: boolean;
|
|
215
|
-
status?: "active" | "inactive" | "suspended";
|
|
216
|
-
createdAt?: string | Date;
|
|
217
|
-
updatedAt?: string | Date;
|
|
218
|
-
};
|
|
219
|
-
type Organization = {
|
|
220
|
-
id: string;
|
|
221
|
-
name: string;
|
|
222
|
-
description: string | null;
|
|
223
|
-
slug: string;
|
|
224
|
-
domain: string | null;
|
|
225
|
-
imageUrl: string | null;
|
|
226
|
-
faviconUrl: string | null;
|
|
227
|
-
status: OrganizationStatus;
|
|
228
|
-
/** "private" (padrão) nunca sai em listPublicOrganizations(); "public" sai, e aceita join requests. */
|
|
229
|
-
visibility?: "public" | "private";
|
|
230
|
-
members?: OrganizationMember[];
|
|
231
|
-
ownedApplications?: OrganizationOwnedApplication[];
|
|
232
|
-
applicationLinks?: Array<{
|
|
233
|
-
id: string;
|
|
234
|
-
status: OrganizationStatus;
|
|
235
|
-
createdAt?: string | Date;
|
|
236
|
-
application: OrganizationOwnedApplication;
|
|
237
|
-
}>;
|
|
238
|
-
createdAt: string | Date;
|
|
239
|
-
updatedAt: string | Date;
|
|
240
|
-
};
|
|
241
|
-
type SessionApplication = {
|
|
242
|
-
id: string;
|
|
243
|
-
createdAt: string | Date;
|
|
244
|
-
expiresAt: string | Date;
|
|
245
|
-
application: {
|
|
246
|
-
id: string;
|
|
247
|
-
name: string;
|
|
248
|
-
organizationId: string;
|
|
249
|
-
};
|
|
250
|
-
};
|
|
251
|
-
type UserSession = {
|
|
252
|
-
id: string;
|
|
253
|
-
userId: string;
|
|
254
|
-
organizationId: string | null;
|
|
255
|
-
deviceAgent: string | null;
|
|
256
|
-
deviceId: string | null;
|
|
257
|
-
deviceName: string | null;
|
|
258
|
-
ip: string | null;
|
|
259
|
-
authState?: unknown;
|
|
260
|
-
authTime?: string | Date;
|
|
261
|
-
expiresAt: string | Date;
|
|
262
|
-
createdAt: string | Date;
|
|
263
|
-
updatedAt: string | Date;
|
|
264
|
-
user?: User;
|
|
265
|
-
applicationSessions?: SessionApplication[];
|
|
266
|
-
};
|
|
267
|
-
type UserInput = {
|
|
268
|
-
name?: string | null;
|
|
269
|
-
email?: string;
|
|
270
|
-
phone?: string | null;
|
|
271
|
-
imageUrl?: string | null;
|
|
272
|
-
password?: string;
|
|
273
|
-
organizationId?: string | null;
|
|
274
|
-
status?: UserStatus;
|
|
275
|
-
};
|
|
276
|
-
type OrganizationInput = {
|
|
277
|
-
name: string;
|
|
278
|
-
description?: string | null;
|
|
279
|
-
slug: string;
|
|
280
|
-
domain?: string | null;
|
|
281
|
-
imageUrl?: string | null;
|
|
282
|
-
faviconUrl?: string | null;
|
|
283
|
-
};
|
|
284
|
-
type OrganizationUpdateInput = Partial<OrganizationInput> & {
|
|
285
|
-
status?: OrganizationStatus;
|
|
286
|
-
};
|
|
287
|
-
type RoleInput = {
|
|
288
|
-
/** Opcional: sem ele, usa a organização ativa. */
|
|
289
|
-
organizationId?: string;
|
|
290
|
-
applicationId?: string | null;
|
|
291
|
-
key: string;
|
|
292
|
-
name: string;
|
|
293
|
-
description?: string | null;
|
|
294
|
-
permissionDefinitionIds?: string[];
|
|
295
|
-
};
|
|
296
|
-
type RoleUpdateInput = {
|
|
297
|
-
name?: string;
|
|
298
|
-
description?: string | null;
|
|
299
|
-
isActive?: boolean;
|
|
300
|
-
permissionDefinitionIds?: string[];
|
|
301
|
-
};
|
|
302
|
-
type PermissionInput = {
|
|
303
|
-
applicationId?: string | null;
|
|
304
|
-
key: string;
|
|
305
|
-
name: string;
|
|
306
|
-
description?: string | null;
|
|
307
|
-
category?: string | null;
|
|
308
|
-
};
|
|
309
|
-
type PermissionUpdateInput = {
|
|
310
|
-
name?: string;
|
|
311
|
-
description?: string | null;
|
|
312
|
-
category?: string | null;
|
|
313
|
-
isActive?: boolean;
|
|
314
|
-
};
|
|
315
|
-
/**
|
|
316
|
-
* OIDC `prompt` values understood by the Geekapps Auth Server. These control
|
|
317
|
-
* whether — and how — the IDP shows UI during `signIn()`/`signUp()`/`addAccount()`.
|
|
318
|
-
*
|
|
319
|
-
* - `"login"` — Forces the login screen, even if the user already has an active
|
|
320
|
-
* session. Use this for a fresh login, unrelated to whatever session already
|
|
321
|
-
* exists (equivalent to the old `silentLogin: false`).
|
|
322
|
-
* - `"select_account"` — Shows the account picker so the user can choose among
|
|
323
|
-
* their connected accounts, or add a new one. Use this when you want to let
|
|
324
|
-
* the user switch accounts explicitly.
|
|
325
|
-
* - `"none"` — Never shows any UI. The IDP authenticates silently if there is
|
|
326
|
-
* exactly one active session (and no other interaction — like consent or a
|
|
327
|
-
* security check — is pending); otherwise it fails immediately with an OIDC
|
|
328
|
-
* error (`login_required`, `account_selection_required`, `consent_required`,
|
|
329
|
-
* or `interaction_required`) instead of prompting the user. Use this for
|
|
330
|
-
* silent-auth checks (e.g. "is the user still logged in?") where you don't
|
|
331
|
-
* want to interrupt them with a screen.
|
|
332
|
-
* - `"consent"` — Forces the consent screen even if the user already granted
|
|
333
|
-
* the requested scopes before.
|
|
334
|
-
*
|
|
335
|
-
* Omitting `prompt` entirely runs the IDP's default flow: reuse a single
|
|
336
|
-
* existing session silently, ask the user to pick when there are multiple
|
|
337
|
-
* connected accounts, or show the login screen when there's none.
|
|
338
|
-
*/
|
|
339
|
-
type OidcPrompt = "login" | "select_account" | "none" | "consent";
|
|
340
|
-
type SignInOptions = {
|
|
341
|
-
redirectTo?: string;
|
|
342
|
-
authorizationFlowId?: string;
|
|
343
|
-
/**
|
|
344
|
-
* Controls whether the IDP shows UI, and which screen, during sign-in. See
|
|
345
|
-
* {@link OidcPrompt} for what each value does. Omit it to run the default flow.
|
|
346
|
-
*/
|
|
347
|
-
prompt?: OidcPrompt;
|
|
348
|
-
/**
|
|
349
|
-
* @deprecated Use `prompt: "login"` instead. Kept for backwards compatibility —
|
|
350
|
-
* `silentLogin: false` is equivalent to `prompt: "login"`.
|
|
351
|
-
*/
|
|
352
|
-
silentLogin?: boolean;
|
|
353
|
-
};
|
|
354
|
-
type SignInInput = SignInOptions | MouseEvent<HTMLElement>;
|
|
355
|
-
type CallbackUrlOptions = SignInOptions & {
|
|
356
|
-
callbackUrl?: string;
|
|
357
|
-
};
|
|
358
|
-
type PermissionCheckOptions = {
|
|
359
|
-
permission: string;
|
|
360
|
-
organizationId?: string | null;
|
|
361
|
-
applicationId?: string | null;
|
|
362
|
-
resourceId?: string | null;
|
|
363
|
-
};
|
|
364
|
-
type LoginResponse = {
|
|
365
|
-
user: User;
|
|
366
|
-
redirectTo?: string | null;
|
|
367
|
-
};
|
|
368
|
-
type RegisterResponse = User;
|
|
369
|
-
type GeekappsAuthProviderProps = {
|
|
370
|
-
children: ReactNode;
|
|
371
|
-
basePath?: string;
|
|
372
|
-
initialUser?: User | null;
|
|
373
|
-
initialOrganizations?: Organization[];
|
|
374
|
-
initialCurrentOrgId?: string | null;
|
|
375
|
-
};
|
|
376
|
-
type RequestOptions = {
|
|
377
|
-
body?: unknown;
|
|
378
|
-
method?: "GET" | "POST" | "PATCH" | "DELETE";
|
|
379
|
-
};
|
|
380
|
-
type ClientActionOptions = {
|
|
381
|
-
basePath?: string;
|
|
382
|
-
};
|
|
383
|
-
declare function loginWithPassword(params: {
|
|
384
|
-
identifier?: string;
|
|
385
|
-
email?: string;
|
|
386
|
-
phone?: string;
|
|
387
|
-
password: string;
|
|
388
|
-
authorizationFlowId?: string;
|
|
389
|
-
redirectTo?: string;
|
|
390
|
-
}, options?: ClientActionOptions): Promise<AuthResult<LoginResponse>>;
|
|
391
|
-
declare function registerWithPassword(params: {
|
|
392
|
-
name: string;
|
|
393
|
-
email: string;
|
|
394
|
-
phone?: string;
|
|
395
|
-
imageUrl?: string;
|
|
396
|
-
address?: Record<string, unknown>;
|
|
397
|
-
password: string;
|
|
398
|
-
redirectTo?: string;
|
|
399
|
-
}, options?: ClientActionOptions): Promise<AuthResult<RegisterResponse>>;
|
|
400
|
-
declare function startGoogleLogin(params?: CallbackUrlOptions, options?: ClientActionOptions): void;
|
|
401
|
-
declare function requestPasswordlessLink(params: {
|
|
402
|
-
email: string;
|
|
403
|
-
authorizationFlowId?: string;
|
|
404
|
-
redirectTo?: string;
|
|
405
|
-
callbackUrl?: string;
|
|
406
|
-
}, options?: ClientActionOptions): Promise<AuthResult>;
|
|
407
|
-
type GeekappsAuthContextValue = {
|
|
408
|
-
basePath: string;
|
|
409
|
-
user: User | null;
|
|
410
|
-
isAuthenticated: boolean;
|
|
411
|
-
isLoading: boolean;
|
|
412
|
-
accounts: ConnectedAccount[];
|
|
413
|
-
isLoadingAccounts: boolean;
|
|
414
|
-
organizations: Organization[];
|
|
415
|
-
currentOrg: Organization | null;
|
|
416
|
-
currentOrgId: string | null;
|
|
417
|
-
isLoadingOrganizations: boolean;
|
|
418
|
-
request: <T>(path: string, options?: RequestOptions) => Promise<T>;
|
|
419
|
-
signIn: (options?: SignInInput) => Promise<void>;
|
|
420
|
-
signUp: (options?: SignInInput) => Promise<void>;
|
|
421
|
-
addAccount: (options?: SignInInput) => Promise<void>;
|
|
422
|
-
signOut: () => Promise<void>;
|
|
423
|
-
signOutAll: () => Promise<void>;
|
|
424
|
-
refreshUser: () => Promise<void>;
|
|
425
|
-
refreshAccounts: () => Promise<void>;
|
|
426
|
-
switchAccount: (sessionId: string, options?: SignInOptions) => Promise<void>;
|
|
427
|
-
loginWithPassword: (params: {
|
|
428
|
-
identifier?: string;
|
|
429
|
-
email?: string;
|
|
430
|
-
phone?: string;
|
|
431
|
-
password: string;
|
|
432
|
-
authorizationFlowId?: string;
|
|
433
|
-
redirectTo?: string;
|
|
434
|
-
}) => Promise<AuthResult<LoginResponse>>;
|
|
435
|
-
registerWithPassword: (params: {
|
|
436
|
-
name: string;
|
|
437
|
-
email: string;
|
|
438
|
-
phone?: string;
|
|
439
|
-
imageUrl?: string;
|
|
440
|
-
address?: Record<string, unknown>;
|
|
441
|
-
password: string;
|
|
442
|
-
redirectTo?: string;
|
|
443
|
-
}) => Promise<AuthResult<RegisterResponse>>;
|
|
444
|
-
startGoogleLogin: (params?: CallbackUrlOptions) => void;
|
|
445
|
-
requestPasswordlessLink: (params: {
|
|
446
|
-
email: string;
|
|
447
|
-
authorizationFlowId?: string;
|
|
448
|
-
redirectTo?: string;
|
|
449
|
-
callbackUrl?: string;
|
|
450
|
-
}) => Promise<AuthResult>;
|
|
451
|
-
refreshOrganizations: () => Promise<void>;
|
|
452
|
-
setCurrentOrg: (organizationId: string | null) => Promise<void>;
|
|
453
|
-
createOrganization: (input: OrganizationInput) => Promise<AuthResult<Organization>>;
|
|
454
|
-
updateOrganization: (id: string, input: OrganizationUpdateInput) => Promise<AuthResult<Organization>>;
|
|
455
|
-
deleteOrganization: (id: string) => Promise<AuthResult<null>>;
|
|
456
|
-
hasPermission: (options: PermissionCheckOptions) => Promise<boolean>;
|
|
457
|
-
/** Organizações públicas e ativas deste app — nunca inclui privadas, não exige membership. Separado de `organizations` (só as do próprio usuário). */
|
|
458
|
-
listPublicOrganizations: () => Promise<PublicOrganization[]>;
|
|
459
|
-
requestToJoin: (organizationId: string, input?: {
|
|
460
|
-
message?: string | null;
|
|
461
|
-
}) => Promise<AuthResult<OrganizationJoinRequest>>;
|
|
462
|
-
getMyJoinRequest: (organizationId: string) => Promise<OrganizationJoinRequest | null>;
|
|
463
|
-
cancelJoinRequest: (organizationId: string) => Promise<AuthResult<null>>;
|
|
464
|
-
listJoinRequests: (organizationId: string) => Promise<OrganizationJoinRequest[]>;
|
|
465
|
-
approveJoinRequest: (organizationId: string, requestId: string) => Promise<AuthResult<OrganizationJoinRequest>>;
|
|
466
|
-
rejectJoinRequest: (organizationId: string, requestId: string) => Promise<AuthResult<OrganizationJoinRequest>>;
|
|
467
|
-
/** Preview do convite por token — funciona com ou sem sessão (currentAccount vem null se deslogado). */
|
|
468
|
-
getInvitePreview: (token: string) => Promise<OrganizationInvitePreview>;
|
|
469
|
-
/** Aceita o convite. loginRequired:true significa que signIn() precisa rodar antes. */
|
|
470
|
-
acceptInvite: (token: string) => Promise<AcceptInviteResult>;
|
|
471
|
-
/** Recusa o convite — não exige estar logado. */
|
|
472
|
-
rejectInvite: (token: string) => Promise<{
|
|
473
|
-
success: true;
|
|
474
|
-
} | {
|
|
475
|
-
success: false;
|
|
476
|
-
error: string;
|
|
477
|
-
}>;
|
|
478
|
-
listUsers: (params?: {
|
|
479
|
-
organizationId?: string | null;
|
|
480
|
-
}) => Promise<User[]>;
|
|
481
|
-
getUser: (id: string) => Promise<User>;
|
|
482
|
-
createUser: (input: UserInput) => Promise<AuthResult<User>>;
|
|
483
|
-
updateUser: (id: string, input: UserInput) => Promise<AuthResult<User>>;
|
|
484
|
-
deleteUser: (id: string) => Promise<AuthResult<null>>;
|
|
485
|
-
/**
|
|
486
|
-
* Roles da organização. `organizationId` é opcional: sem ele, usa a
|
|
487
|
-
* organização ativa. `applicationId`/`type` são aceitos por
|
|
488
|
-
* compatibilidade e não filtram nada — a separação system/custom vem no
|
|
489
|
-
* próprio retorno.
|
|
490
|
-
*/
|
|
491
|
-
listRoles: (params?: {
|
|
492
|
-
organizationId?: string;
|
|
493
|
-
applicationId?: string;
|
|
494
|
-
type?: "system" | "custom" | "all";
|
|
495
|
-
}) => Promise<{
|
|
496
|
-
systemRoles: Role[];
|
|
497
|
-
customRoles: Role[];
|
|
498
|
-
}>;
|
|
499
|
-
getRole: (id: string, type?: "system" | "custom", organizationId?: string) => Promise<Role>;
|
|
500
|
-
createRole: (input: RoleInput) => Promise<AuthResult<Role>>;
|
|
501
|
-
updateRole: (id: string, input: RoleUpdateInput, organizationId?: string) => Promise<AuthResult<Role>>;
|
|
502
|
-
deleteRole: (id: string, organizationId?: string) => Promise<AuthResult<null>>;
|
|
503
|
-
listPermissions: (params?: {
|
|
504
|
-
applicationId?: string;
|
|
505
|
-
roleId?: string | null;
|
|
506
|
-
}) => Promise<Permission[]>;
|
|
507
|
-
createPermission: (input: PermissionInput) => Promise<AuthResult<Permission>>;
|
|
508
|
-
updatePermission: (id: string, input: PermissionUpdateInput) => Promise<AuthResult<Permission>>;
|
|
509
|
-
deletePermission: (id: string) => Promise<AuthResult<null>>;
|
|
510
|
-
listUserSessions: (params?: {
|
|
511
|
-
userId?: string;
|
|
512
|
-
organizationId?: string | null;
|
|
513
|
-
}) => Promise<UserSession[]>;
|
|
514
|
-
revokeUserSession: (sessionId: string) => Promise<AuthResult<null>>;
|
|
515
|
-
listMembers: (organizationId: string) => Promise<OrganizationMember[]>;
|
|
516
|
-
getMember: (organizationId: string, memberId: string) => Promise<OrganizationMember>;
|
|
517
|
-
addMember: (organizationId: string, input: AddMemberInput) => Promise<AuthResult<OrganizationMember>>;
|
|
518
|
-
updateMember: (organizationId: string, memberId: string, input: UpdateMemberInput) => Promise<AuthResult<OrganizationMember>>;
|
|
519
|
-
/** @deprecated use updateMember */
|
|
520
|
-
updateMemberRole: (organizationId: string, memberId: string, input: UpdateMemberRoleInput) => Promise<AuthResult<OrganizationMember>>;
|
|
521
|
-
removeMember: (organizationId: string, memberId: string) => Promise<AuthResult<null>>;
|
|
522
|
-
inviteMember: (organizationId: string, input: MemberInviteInput) => Promise<AuthResult<OrganizationInvite>>;
|
|
523
|
-
listInvites: (organizationId: string) => Promise<OrganizationInvite[]>;
|
|
524
|
-
revokeInvite: (organizationId: string, inviteId: string) => Promise<AuthResult<null>>;
|
|
525
|
-
};
|
|
526
|
-
type UseOrgResult = Pick<GeekappsAuthContextValue, "organizations" | "currentOrg" | "currentOrgId" | "isLoadingOrganizations" | "refreshOrganizations" | "setCurrentOrg" | "createOrganization" | "updateOrganization" | "deleteOrganization" | "hasPermission">;
|
|
527
|
-
type UseAccountsResult = Pick<GeekappsAuthContextValue, "accounts" | "addAccount" | "isLoadingAccounts" | "refreshAccounts" | "switchAccount">;
|
|
528
|
-
type UseUsersResult = Pick<GeekappsAuthContextValue, "listUsers" | "getUser" | "createUser" | "updateUser" | "deleteUser">;
|
|
529
|
-
type UseRolesResult = Pick<GeekappsAuthContextValue, "listRoles" | "getRole" | "createRole" | "updateRole" | "deleteRole">;
|
|
530
|
-
type UsePermissionsResult = Pick<GeekappsAuthContextValue, "listPermissions" | "createPermission" | "updatePermission" | "deletePermission">;
|
|
531
|
-
type UseSessionsResult = Pick<GeekappsAuthContextValue, "listUserSessions" | "revokeUserSession">;
|
|
532
|
-
type UseMembersResult = Pick<GeekappsAuthContextValue, "listMembers" | "getMember" | "addMember" | "updateMember" | "updateMemberRole" | "removeMember" | "inviteMember" | "listInvites" | "revokeInvite">;
|
|
533
|
-
type UsePublicOrganizationsResult = Pick<GeekappsAuthContextValue, "listPublicOrganizations">;
|
|
534
|
-
type UseJoinRequestsResult = Pick<GeekappsAuthContextValue, "requestToJoin" | "getMyJoinRequest" | "cancelJoinRequest" | "listJoinRequests" | "approveJoinRequest" | "rejectJoinRequest">;
|
|
535
|
-
type UseInvitesResult = Pick<GeekappsAuthContextValue, "getInvitePreview" | "acceptInvite" | "rejectInvite">;
|
|
536
|
-
declare function GeekappsAuthProvider({ children, basePath, initialUser, initialOrganizations, initialCurrentOrgId, }: GeekappsAuthProviderProps): ReactElement;
|
|
537
|
-
declare function useAuth(): GeekappsAuthContextValue;
|
|
538
|
-
declare function useOrg(): UseOrgResult;
|
|
539
|
-
declare function useAccounts(): UseAccountsResult;
|
|
540
|
-
declare function useUsers(): UseUsersResult;
|
|
541
|
-
declare function useRoles(): UseRolesResult;
|
|
542
|
-
declare function usePermissions(): UsePermissionsResult;
|
|
543
|
-
declare function useSessions(): UseSessionsResult;
|
|
544
|
-
declare function useMembers(): UseMembersResult;
|
|
545
|
-
/**
|
|
546
|
-
* Descoberta de organizações PÚBLICAS do app — bem separado de `useOrg()`,
|
|
547
|
-
* que lida com as organizações do próprio usuário (as que ele já é
|
|
548
|
-
* membro/dono). `usePublicOrganizations()` nunca retorna organizações
|
|
549
|
-
* privadas, e não exige que o usuário já pertença a elas.
|
|
550
|
-
*/
|
|
551
|
-
declare function usePublicOrganizations(): UsePublicOrganizationsResult;
|
|
552
|
-
/**
|
|
553
|
-
* Solicitações de entrada em organizações públicas: um usuário pede pra
|
|
554
|
-
* entrar (requestToJoin) e um admin da organização aprova/rejeita
|
|
555
|
-
* (approveJoinRequest/rejectJoinRequest, exigem permissão org:members:add).
|
|
556
|
-
*/
|
|
557
|
-
declare function useJoinRequests(): UseJoinRequestsResult;
|
|
558
|
-
/**
|
|
559
|
-
* Aceite/recusa de convite por email — chamadas a partir do ?invite_token=
|
|
560
|
-
* que este app recebe na sua própria redirectUri (a que foi passada em
|
|
561
|
-
* useMembers().inviteMember). getInvitePreview funciona sem sessão
|
|
562
|
-
* (currentAccount vem null); rejectInvite não exige login; acceptInvite
|
|
563
|
-
* retorna loginRequired:true se não houver sessão.
|
|
564
|
-
*/
|
|
565
|
-
declare function useInvites(): UseInvitesResult;
|
|
566
|
-
type ServiceAccount = {
|
|
567
|
-
id: string;
|
|
568
|
-
membershipId: string;
|
|
569
|
-
organizationId: string;
|
|
570
|
-
applicationId: string | null;
|
|
571
|
-
name: string;
|
|
572
|
-
status: "active" | "inactive" | "suspended";
|
|
573
|
-
serviceId: string | null;
|
|
574
|
-
roleAssignment: {
|
|
575
|
-
role: {
|
|
576
|
-
id: string;
|
|
577
|
-
key: string;
|
|
578
|
-
name: string;
|
|
579
|
-
};
|
|
580
|
-
} | null;
|
|
581
|
-
createdAt: string;
|
|
582
|
-
updatedAt: string;
|
|
583
|
-
};
|
|
584
|
-
type ServiceAccountWithSecret = ServiceAccount & {
|
|
585
|
-
serviceSecret: string;
|
|
586
|
-
};
|
|
587
|
-
type CreateServiceAccountInput = {
|
|
588
|
-
organizationId: string;
|
|
589
|
-
applicationId?: string;
|
|
590
|
-
name: string;
|
|
591
|
-
description?: string;
|
|
592
|
-
roleId?: string;
|
|
593
|
-
};
|
|
594
|
-
type UseServiceAccountResult = {
|
|
595
|
-
listServiceAccounts: (params: {
|
|
596
|
-
organizationId: string;
|
|
597
|
-
applicationId?: string;
|
|
598
|
-
}) => Promise<ServiceAccount[]>;
|
|
599
|
-
createServiceAccount: (input: CreateServiceAccountInput) => Promise<ServiceAccountWithSecret>;
|
|
600
|
-
updateServiceAccountRole: (id: string, roleId: string | null) => Promise<void>;
|
|
601
|
-
revokeServiceAccount: (id: string) => Promise<void>;
|
|
602
|
-
rotateServiceAccountSecret: (id: string) => Promise<{
|
|
603
|
-
serviceId: string;
|
|
604
|
-
serviceSecret: string;
|
|
605
|
-
}>;
|
|
606
|
-
deleteServiceAccount: (id: string) => Promise<void>;
|
|
607
|
-
};
|
|
608
|
-
declare function useServiceAccount(): UseServiceAccountResult;
|
|
609
|
-
|
|
610
|
-
export { type AcceptInviteResult, type AddMemberInput, type AuthResult, type CallbackUrlOptions, type ConnectedAccount, type CreateServiceAccountInput, type GeekappsAuthContextValue, GeekappsAuthProvider, type GeekappsAuthProviderProps, GeekappsSessionExpiredError, type JoinRequestStatus, type LoginResponse, type MemberInviteInput, type OAuthClientType, type OidcPrompt, type Organization, type OrganizationInput, type OrganizationInvite, type OrganizationInvitePreview, type OrganizationJoinRequest, type OrganizationMember, type OrganizationOwnedApplication, type OrganizationStatus, type OrganizationUpdateInput, type Permission, type PermissionCheckOptions, type PermissionInput, type PermissionUpdateInput, type PublicOrganization, type RegisterResponse, type Role, type RoleAssignment, type RoleInput, type RolePermission, type RoleUpdateInput, type ServiceAccount, type ServiceAccountWithSecret, type SessionApplication, type SignInInput, type SignInOptions, type UpdateMemberInput, type UpdateMemberRoleInput, type UseAccountsResult, type UseInvitesResult, type UseJoinRequestsResult, type UseMembersResult, type UseOrgResult, type UsePermissionsResult, type UsePublicOrganizationsResult, type UseRolesResult, type UseServiceAccountResult, type UseSessionsResult, type UseUsersResult, type User, type UserInput, type UserSession, type UserStatus, loginWithPassword, registerWithPassword, requestPasswordlessLink, startGoogleLogin, useAccounts, useAuth, useInvites, useJoinRequests, useMembers, useOrg, usePermissions, usePublicOrganizations, useRoles, useServiceAccount, useSessions, useUsers };
|