@authyon/auth 0.2.0-beta.29 → 0.2.0-beta.31
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/README.md +60 -32
- package/dist/{ability-D47fzavh.d.cts → ability-BPJ5VdSC.d.cts} +426 -74
- package/dist/{ability-D47fzavh.d.ts → ability-BPJ5VdSC.d.ts} +426 -74
- package/dist/index.cjs +251 -55
- package/dist/index.d.cts +40 -3
- package/dist/index.d.ts +40 -3
- package/dist/index.js +246 -54
- package/dist/react/index.d.cts +2 -2
- package/dist/react/index.d.ts +2 -2
- package/package.json +1 -1
|
@@ -206,52 +206,144 @@ interface IntrospectResult {
|
|
|
206
206
|
jti?: string;
|
|
207
207
|
token_type?: string;
|
|
208
208
|
}
|
|
209
|
+
/** Fields a tenant listing can order by. */
|
|
210
|
+
type TenantOrderField = "name" | "createdAt" | "updatedAt";
|
|
211
|
+
/**
|
|
212
|
+
* A server-side order: a field as a bare name (ascending) or with a direction.
|
|
213
|
+
* Ties always break on the id, so a row cannot move across a page boundary
|
|
214
|
+
* between two calls.
|
|
215
|
+
*/
|
|
216
|
+
type TenantOrder = TenantOrderField | {
|
|
217
|
+
field: TenantOrderField;
|
|
218
|
+
direction?: "asc" | "desc";
|
|
219
|
+
};
|
|
220
|
+
/**
|
|
221
|
+
* Options for a sub-tenant listing on the end-user routes
|
|
222
|
+
* (`/auth/tenants/{id}/subtenants` and `/auth/tenants/subtenants`).
|
|
223
|
+
*
|
|
224
|
+
* The same knobs as the environment's tenant list, cut down to what a member
|
|
225
|
+
* is shown:
|
|
226
|
+
*
|
|
227
|
+
* - `search`: one substring, case-insensitive, over the name, the slug, the
|
|
228
|
+
* description and the public metadata. Never the private metadata. At most
|
|
229
|
+
* 100 characters; blank lists everything.
|
|
230
|
+
* - `filter`: structured conditions, ANDed, at most 10 — build them with
|
|
231
|
+
* `tenantFilter`. Only the `public` scope: a `private.*` or `custom.*`
|
|
232
|
+
* filter would let a member test values they cannot read, so it raises
|
|
233
|
+
* `RangeError` here (and is a 400 `tenant.filter.invalid` on the API).
|
|
234
|
+
* - `orderBy`: `name` (the default, ascending), `createdAt` or `updatedAt`.
|
|
235
|
+
*
|
|
236
|
+
* There is no `status`: only active sub-tenants are listed, since everything
|
|
237
|
+
* below a disabled one is closed to reads from above.
|
|
238
|
+
*/
|
|
239
|
+
interface SubTenantListOptions extends PaginationOptions {
|
|
240
|
+
search?: string;
|
|
241
|
+
filter?: string[];
|
|
242
|
+
orderBy?: TenantOrder;
|
|
243
|
+
}
|
|
244
|
+
/** The tenant another one hangs from: enough to name it in a breadcrumb. */
|
|
245
|
+
interface TenantParent {
|
|
246
|
+
id: string;
|
|
247
|
+
slug: string;
|
|
248
|
+
name: string;
|
|
249
|
+
}
|
|
250
|
+
/** One direct sub-tenant, as the end-user sub-tenant listings return it. */
|
|
251
|
+
interface SubTenant {
|
|
252
|
+
id: string;
|
|
253
|
+
slug: string;
|
|
254
|
+
name: string;
|
|
255
|
+
description: string | null;
|
|
256
|
+
/** Distance from the root: `1` for a child of a root. */
|
|
257
|
+
depth: number;
|
|
258
|
+
/** Its own direct sub-tenants. Ask for the next level only where this is above zero. */
|
|
259
|
+
childCount: number;
|
|
260
|
+
/** Whether the user also belongs to it directly. */
|
|
261
|
+
isMember: boolean;
|
|
262
|
+
createdAt: string;
|
|
263
|
+
updatedAt: string;
|
|
264
|
+
/** JSON-encoded metadata visible to members. */
|
|
265
|
+
publicMetadata: string;
|
|
266
|
+
/** The tenant it hangs from — the same on every row of a page, carried so a row stands on its own. */
|
|
267
|
+
parent: TenantParent;
|
|
268
|
+
}
|
|
209
269
|
|
|
210
270
|
/**
|
|
211
|
-
*
|
|
212
|
-
*
|
|
271
|
+
* A tenant the user can reach: one they belong to, or one below it. The SDK
|
|
272
|
+
* uses the API's own vocabulary — tenant and sub-tenant — on every route,
|
|
273
|
+
* type and field.
|
|
213
274
|
*/
|
|
214
|
-
interface
|
|
275
|
+
interface Tenant {
|
|
215
276
|
id: string;
|
|
216
277
|
slug: string;
|
|
217
278
|
name?: string;
|
|
218
279
|
description?: string;
|
|
219
280
|
roles?: string[];
|
|
220
|
-
/** JSON-encoded values for the
|
|
281
|
+
/** JSON-encoded values for the tenant's configured custom fields. */
|
|
221
282
|
customFields?: string;
|
|
222
|
-
/** JSON-encoded metadata visible to members of the
|
|
283
|
+
/** JSON-encoded metadata visible to members of the tenant. */
|
|
223
284
|
publicMetadata?: string;
|
|
224
285
|
/**
|
|
225
|
-
* `false` for
|
|
286
|
+
* `false` for a tenant the user belongs to. `true` for one they may
|
|
226
287
|
* switch into from an ancestor without being a member — show it as borrowed
|
|
227
|
-
* rather than owned. Only `
|
|
288
|
+
* rather than owned. Only `tenants.list()` fills it.
|
|
228
289
|
*
|
|
229
|
-
* Ignoring the field still leaves you with a switchable
|
|
290
|
+
* Ignoring the field still leaves you with a switchable tenant, which
|
|
230
291
|
* is what it is. Absent on an API older than 2026-10-31.
|
|
231
292
|
*/
|
|
232
293
|
inherited?: boolean;
|
|
233
|
-
/** Distance from the root: `0` at a root
|
|
294
|
+
/** Distance from the root: `0` at a root tenant. Indent the switcher by it. */
|
|
234
295
|
depth?: number;
|
|
296
|
+
/**
|
|
297
|
+
* The parent's id, `null` for a root. Only `tenants.list()` fills it —
|
|
298
|
+
* with `depth`, it nests the switcher's flat list into a tree. `get`,
|
|
299
|
+
* `create` and `rename` send `parent` instead. Absent from an API older than
|
|
300
|
+
* 2026-11-26.
|
|
301
|
+
*/
|
|
302
|
+
parentTenantId?: string | null;
|
|
303
|
+
/**
|
|
304
|
+
* The tenant it hangs from, `null` for a root — the same shape the
|
|
305
|
+
* sub-tenant listing uses. Filled by `get`, `create` and `rename`;
|
|
306
|
+
* absent from an API older than 2026-11-26.
|
|
307
|
+
*/
|
|
308
|
+
parent?: TenantParent | null;
|
|
309
|
+
/**
|
|
310
|
+
* A disabled tenant still reads, but every change to it is refused
|
|
311
|
+
* with `tenant.disabled`. Filled by `get`, `create` and `rename`; absent from
|
|
312
|
+
* an API older than 2026-11-26.
|
|
313
|
+
*/
|
|
314
|
+
isDisabled?: boolean;
|
|
315
|
+
/** Roles the user holds in it; empty when they reach it from an ancestor. Filled by `get`, `create` and `rename`. */
|
|
316
|
+
myRoles?: string[];
|
|
317
|
+
/**
|
|
318
|
+
* The tenant-route permissions the user can use on it, as concrete
|
|
319
|
+
* values: `tenants:*` on their own tenant, `subtenants:tree:*` from
|
|
320
|
+
* above. This, not `myRoles`, is what decides which actions to offer — the
|
|
321
|
+
* creator holds direct grants and no role. Filled by `get`, `create` and
|
|
322
|
+
* `rename`; absent from an API older than 2026-11-26.
|
|
323
|
+
*/
|
|
324
|
+
myPermissions?: string[];
|
|
325
|
+
/** How many members it has. Filled by `get`, `create` and `rename`. */
|
|
326
|
+
memberCount?: number;
|
|
235
327
|
}
|
|
236
|
-
/** POST /auth/tenants — creates
|
|
237
|
-
interface
|
|
328
|
+
/** POST /auth/tenants — creates a tenant owned by the signed-in user. */
|
|
329
|
+
interface CreateTenantInput {
|
|
238
330
|
name?: string;
|
|
239
331
|
slug?: string;
|
|
240
332
|
description?: string;
|
|
241
333
|
customFields?: Record<string, unknown>;
|
|
242
334
|
/**
|
|
243
|
-
* Creates the
|
|
244
|
-
* root
|
|
335
|
+
* Creates the tenant underneath an existing one. Omitted creates a
|
|
336
|
+
* root tenant, which is all this endpoint could do before the
|
|
245
337
|
* hierarchy existed.
|
|
246
338
|
*
|
|
247
|
-
* The caller has to belong to the parent (or to
|
|
339
|
+
* The caller has to belong to the parent (or to a tenant above it)
|
|
248
340
|
* and hold `subtenants:tree:create` there, and the environment's
|
|
249
341
|
* `maxTenantDepth` has to allow the level — it ships as `1`, roots only.
|
|
250
342
|
*/
|
|
251
343
|
parentTenantId?: string;
|
|
252
344
|
}
|
|
253
|
-
/** GET /auth/tenants/{
|
|
254
|
-
interface
|
|
345
|
+
/** GET /auth/tenants/{tenantId}/members — confirmed against the live API. */
|
|
346
|
+
interface TenantMember {
|
|
255
347
|
userId: string;
|
|
256
348
|
email?: string;
|
|
257
349
|
username?: string;
|
|
@@ -261,6 +353,13 @@ interface OrganizationMember {
|
|
|
261
353
|
roles?: string[];
|
|
262
354
|
createdAt?: string;
|
|
263
355
|
lastLoginAt?: string | null;
|
|
356
|
+
/**
|
|
357
|
+
* Account status: `"active"`, `"suspended"` (a temporary hold is in force) or
|
|
358
|
+
* `"disabled"`. Absent from an API older than 2026-11-26.
|
|
359
|
+
*/
|
|
360
|
+
status?: "active" | "suspended" | "disabled";
|
|
361
|
+
/** Whether the member confirmed their e-mail. Absent from an API older than 2026-11-26. */
|
|
362
|
+
emailConfirmed?: boolean;
|
|
264
363
|
}
|
|
265
364
|
/** POST /auth/tenants/{tenantId}/members — invites a member by e-mail. */
|
|
266
365
|
interface InviteMemberInput {
|
|
@@ -268,11 +367,11 @@ interface InviteMemberInput {
|
|
|
268
367
|
roles: string[];
|
|
269
368
|
}
|
|
270
369
|
/**
|
|
271
|
-
* POST /auth/tenants/{
|
|
370
|
+
* POST /auth/tenants/{tenantId}/invites — invite an address that may not
|
|
272
371
|
* have an account yet; accepting creates it. `sendEmail` defaults to `true`;
|
|
273
372
|
* `false` only returns the link, for delivery through your own channel.
|
|
274
373
|
*/
|
|
275
|
-
interface
|
|
374
|
+
interface TenantInviteInput {
|
|
276
375
|
email: string;
|
|
277
376
|
roles?: string[];
|
|
278
377
|
sendEmail?: boolean;
|
|
@@ -285,7 +384,7 @@ interface OrganizationInviteInput {
|
|
|
285
384
|
}
|
|
286
385
|
/** Returned when an invite is created or re-issued. `acceptUrl` is only ever
|
|
287
386
|
* readable here — the API keeps a hash of the token, not the token. */
|
|
288
|
-
interface
|
|
387
|
+
interface TenantInviteIssued {
|
|
289
388
|
id: string;
|
|
290
389
|
tenantId: string;
|
|
291
390
|
email: string;
|
|
@@ -295,13 +394,13 @@ interface OrganizationInviteIssued {
|
|
|
295
394
|
emailSent: boolean;
|
|
296
395
|
redirectUri: string | null;
|
|
297
396
|
}
|
|
298
|
-
type
|
|
299
|
-
interface
|
|
397
|
+
type TenantInviteStatus = "pending" | "accepted" | "revoked" | "expired";
|
|
398
|
+
interface TenantInvite {
|
|
300
399
|
id: string;
|
|
301
400
|
tenantId: string;
|
|
302
401
|
email: string;
|
|
303
402
|
roles: string[];
|
|
304
|
-
status:
|
|
403
|
+
status: TenantInviteStatus;
|
|
305
404
|
createdAt: string;
|
|
306
405
|
expiresAt: string;
|
|
307
406
|
emailSentAt: string | null;
|
|
@@ -312,7 +411,7 @@ interface OrganizationInvite {
|
|
|
312
411
|
redirectUri: string | null;
|
|
313
412
|
}
|
|
314
413
|
/** POST /auth/tenant-invites/preview — what an accept page shows before the invitee commits. */
|
|
315
|
-
interface
|
|
414
|
+
interface TenantInvitePreview {
|
|
316
415
|
tenantId: string;
|
|
317
416
|
tenantName: string;
|
|
318
417
|
email: string;
|
|
@@ -348,7 +447,7 @@ interface PasswordResetCompleted {
|
|
|
348
447
|
redirectUri: string | null;
|
|
349
448
|
}
|
|
350
449
|
/** POST /auth/tenant-invites/accept — everything but `token` is ignored when the address already has an account. */
|
|
351
|
-
interface
|
|
450
|
+
interface AcceptTenantInviteInput {
|
|
352
451
|
token: string;
|
|
353
452
|
username?: string;
|
|
354
453
|
password?: string;
|
|
@@ -361,7 +460,7 @@ interface AcceptOrganizationInviteInput {
|
|
|
361
460
|
*/
|
|
362
461
|
customFields?: Record<string, unknown>;
|
|
363
462
|
}
|
|
364
|
-
interface
|
|
463
|
+
interface TenantInviteAccepted {
|
|
365
464
|
tenantId: string;
|
|
366
465
|
tenantName: string;
|
|
367
466
|
userId: string;
|
|
@@ -382,8 +481,13 @@ interface User {
|
|
|
382
481
|
permissions?: string[];
|
|
383
482
|
createdAt?: string;
|
|
384
483
|
lastLoginAt?: string;
|
|
385
|
-
|
|
386
|
-
|
|
484
|
+
tenants?: Tenant[];
|
|
485
|
+
/** The tenant the session is scoped to (the token's `tenant_id`), or `null`. */
|
|
486
|
+
activeTenant?: Tenant | null;
|
|
487
|
+
/** @deprecated Use `tenants`. Same value; removed in a later release. */
|
|
488
|
+
organizations?: Tenant[];
|
|
489
|
+
/** @deprecated Use `activeTenant`. Same value; removed in a later release. */
|
|
490
|
+
activeOrganization?: Tenant | null;
|
|
387
491
|
/** Actions the user must complete before continuing (e.g. confirm e-mail). */
|
|
388
492
|
pendencies?: string[];
|
|
389
493
|
/** Security methods active on the account (authenticator, email code, passkey, SSO…). */
|
|
@@ -423,7 +527,9 @@ interface LoginInput {
|
|
|
423
527
|
email?: string;
|
|
424
528
|
username?: string;
|
|
425
529
|
password: string;
|
|
426
|
-
/** Optional
|
|
530
|
+
/** Optional tenant to scope the session to. */
|
|
531
|
+
tenantSlug?: string;
|
|
532
|
+
/** @deprecated Use `tenantSlug`. */
|
|
427
533
|
organizationSlug?: string;
|
|
428
534
|
}
|
|
429
535
|
/** A completed WebAuthn ceremony, handed back to the server to finish login/registration. */
|
|
@@ -495,10 +601,12 @@ interface Activity {
|
|
|
495
601
|
/** JSON-encoded string — `JSON.parse` it for the event-specific payload. */
|
|
496
602
|
payloadJson?: string;
|
|
497
603
|
}
|
|
498
|
-
/** A role available within
|
|
604
|
+
/** A role available within a tenant. */
|
|
499
605
|
interface Role {
|
|
500
606
|
id: string;
|
|
501
607
|
name: string;
|
|
608
|
+
/** Label to show instead of `name`, when the operator set one. Absent from an API older than 2026-11-26. */
|
|
609
|
+
displayName?: string | null;
|
|
502
610
|
description?: string;
|
|
503
611
|
permissions?: string[];
|
|
504
612
|
}
|
|
@@ -516,7 +624,7 @@ interface SessionInfo {
|
|
|
516
624
|
}
|
|
517
625
|
/**
|
|
518
626
|
* POST /auth/validate — confirmed against the live API. The wire shape is
|
|
519
|
-
* `{ valid, reason, profile }`, not `{ user,
|
|
627
|
+
* `{ valid, reason, profile }`, not `{ user, tenant }` as the
|
|
520
628
|
* OpenAPI schema (which didn't document response bodies) suggested.
|
|
521
629
|
* `profile` is `null` for machine tokens (there's no user behind them) and
|
|
522
630
|
* for tokens that fail validation.
|
|
@@ -582,6 +690,31 @@ interface AuthyonClientOptions {
|
|
|
582
690
|
fetch?: typeof fetch;
|
|
583
691
|
}
|
|
584
692
|
|
|
693
|
+
/** @deprecated Use `Tenant`. */
|
|
694
|
+
type Organization = Tenant;
|
|
695
|
+
/** @deprecated Use `SubTenant`. */
|
|
696
|
+
type SubOrganization = SubTenant;
|
|
697
|
+
/** @deprecated Use `SubTenantListOptions`. */
|
|
698
|
+
type SubOrganizationListOptions = SubTenantListOptions;
|
|
699
|
+
/** @deprecated Use `CreateTenantInput`. */
|
|
700
|
+
type CreateOrganizationInput = CreateTenantInput;
|
|
701
|
+
/** @deprecated Use `TenantMember`. */
|
|
702
|
+
type OrganizationMember = TenantMember;
|
|
703
|
+
/** @deprecated Use `TenantInviteInput`. */
|
|
704
|
+
type OrganizationInviteInput = TenantInviteInput;
|
|
705
|
+
/** @deprecated Use `TenantInviteIssued`. */
|
|
706
|
+
type OrganizationInviteIssued = TenantInviteIssued;
|
|
707
|
+
/** @deprecated Use `TenantInviteStatus`. */
|
|
708
|
+
type OrganizationInviteStatus = TenantInviteStatus;
|
|
709
|
+
/** @deprecated Use `TenantInvite`. */
|
|
710
|
+
type OrganizationInvite = TenantInvite;
|
|
711
|
+
/** @deprecated Use `TenantInvitePreview`. */
|
|
712
|
+
type OrganizationInvitePreview = TenantInvitePreview;
|
|
713
|
+
/** @deprecated Use `AcceptTenantInviteInput`. */
|
|
714
|
+
type AcceptOrganizationInviteInput = AcceptTenantInviteInput;
|
|
715
|
+
/** @deprecated Use `TenantInviteAccepted`. */
|
|
716
|
+
type OrganizationInviteAccepted = TenantInviteAccepted;
|
|
717
|
+
|
|
585
718
|
declare class AuthyonClient {
|
|
586
719
|
private readonly envKey;
|
|
587
720
|
private readonly clientIp?;
|
|
@@ -724,51 +857,242 @@ declare class AuthyonClient {
|
|
|
724
857
|
*/
|
|
725
858
|
confirmPasswordReset: (token: string, newPassword: string) => Promise<PasswordResetCompleted>;
|
|
726
859
|
};
|
|
860
|
+
readonly tenants: {
|
|
861
|
+
/**
|
|
862
|
+
* GET /auth/tenants — filterable list of tenant memberships.
|
|
863
|
+
*
|
|
864
|
+
* Also lists the tenants below them that the user may switch into
|
|
865
|
+
* without being a member, marked `inherited` — only the ones that actually
|
|
866
|
+
* carry `subtenants:tree:switch`, so the switcher never offers an
|
|
867
|
+
* tenant the switch would then refuse. `depth` indents the list into
|
|
868
|
+
* the tree it describes.
|
|
869
|
+
*/
|
|
870
|
+
list: (params?: {
|
|
871
|
+
search?: string;
|
|
872
|
+
} & PaginationOptions) => Promise<Tenant[]>;
|
|
873
|
+
/**
|
|
874
|
+
* POST /auth/tenants — creates a tenant owned by the signed-in
|
|
875
|
+
* user (only available when self-service tenant creation is
|
|
876
|
+
* enabled for the environment).
|
|
877
|
+
*
|
|
878
|
+
* `parentTenantId` nests it under one the user already belongs to, which
|
|
879
|
+
* needs `subtenants:tree:create` there. The creator lands as the effective
|
|
880
|
+
* owner either way, with `tenants:settings:manage`,
|
|
881
|
+
* `tenants:members:invite` and `tenants:members:remove` granted directly
|
|
882
|
+
* inside the new tenant.
|
|
883
|
+
*/
|
|
884
|
+
create: (params?: CreateTenantInput) => Promise<Tenant>;
|
|
885
|
+
/**
|
|
886
|
+
* GET /auth/tenants/{tenantId} — one tenant by id: the user's own,
|
|
887
|
+
* or one below it with `subtenants:tree:read` on an ancestor.
|
|
888
|
+
*/
|
|
889
|
+
get: (tenantId: string) => Promise<Tenant>;
|
|
890
|
+
/**
|
|
891
|
+
* One tenant by id **or** slug — a UUID goes to `GET /auth/tenants/{id}`,
|
|
892
|
+
* anything else to `GET /auth/tenants/by-slug/{slug}`. Same access rule and
|
|
893
|
+
* same answer as `get`, so a page that only has the slug from its URL
|
|
894
|
+
* doesn't have to page `subTenants.list` to find it.
|
|
895
|
+
*
|
|
896
|
+
* By slug, every refusal answers `tenant.not_found` (a slug is guessable,
|
|
897
|
+
* so "exists, not yours" is never told apart from "doesn't exist"). An
|
|
898
|
+
* empty value raises `RangeError` before any request. The slug route needs
|
|
899
|
+
* the Authyon API of 2026-11-26 or newer.
|
|
900
|
+
*/
|
|
901
|
+
find: (idOrSlug: string) => Promise<Tenant>;
|
|
902
|
+
/**
|
|
903
|
+
* PATCH /auth/tenants/{tenantId} — renames the tenant.
|
|
904
|
+
*
|
|
905
|
+
* Requires the `tenants:settings:manage` custom permission on it, or
|
|
906
|
+
* `subtenants:tree:manage` on a tenant above it. The value was
|
|
907
|
+
* spelled `tenants:manage` before 2026-10-31 — two segments, which the API
|
|
908
|
+
* could not store, so the endpoint refused everyone who had been granted
|
|
909
|
+
* it.
|
|
910
|
+
*/
|
|
911
|
+
rename: (tenantId: string, name: string) => Promise<Tenant>;
|
|
912
|
+
/**
|
|
913
|
+
* POST /auth/switch-tenant — issues a fresh token scoped to the new
|
|
914
|
+
* tenant.
|
|
915
|
+
*
|
|
916
|
+
* Membership is enough for one of the user's own tenants. Descending
|
|
917
|
+
* into one below it takes `subtenants:tree:switch` at the tenant they
|
|
918
|
+
* belong to — deliberately not the same permission as administering a
|
|
919
|
+
* sub-tenant from the outside, since operating AS it is the larger of
|
|
920
|
+
* the two powers. The grants then travel from the node the user belongs to,
|
|
921
|
+
* and the token says so in its `tenant.via`.
|
|
922
|
+
*
|
|
923
|
+
* Refusals: `tenant.outside_scope` (no path down to it),
|
|
924
|
+
* `tenant.ancestor_disabled`, and `tenant.path_stale` when the tree moved
|
|
925
|
+
* under a session — sign-in again rather than retrying.
|
|
926
|
+
*/
|
|
927
|
+
switch: (tenantSlug: string) => Promise<Session>;
|
|
928
|
+
/** The tenant the current session is scoped to, from the cached session — no network call. */
|
|
929
|
+
current: () => Tenant | null;
|
|
930
|
+
members: {
|
|
931
|
+
/**
|
|
932
|
+
* GET /auth/tenants/{tenantId}/members — paginated list of an
|
|
933
|
+
* tenant's members, newest first, in the `Paged<T>` envelope every
|
|
934
|
+
* other `skip`/`take` endpoint returns. `search` matches email, username
|
|
935
|
+
* or name; at most 100 characters, and `take` 1-100, checked before any
|
|
936
|
+
* request.
|
|
937
|
+
*/
|
|
938
|
+
list: (tenantId: string, params?: MemberListOptions) => Promise<Paged<TenantMember>>;
|
|
939
|
+
/**
|
|
940
|
+
* POST /auth/tenants/{tenantId}/members — add an existing
|
|
941
|
+
* environment user by e-mail (no e-mail is sent). To invite an address
|
|
942
|
+
* that may not have an account yet, use `tenants.invites.create`.
|
|
943
|
+
*/
|
|
944
|
+
invite: (tenantId: string, params: InviteMemberInput) => Promise<void>;
|
|
945
|
+
/** DELETE /auth/tenants/{tenantId}/members/{userId} — remove a member. */
|
|
946
|
+
remove: (tenantId: string, userId: string) => Promise<void>;
|
|
947
|
+
};
|
|
948
|
+
/**
|
|
949
|
+
* Invites by e-mail or by link. Managing them requires the
|
|
950
|
+
* `tenants:members:invite` permission on the tenant; `preview` and
|
|
951
|
+
* `accept` are public — the token in the link is the credential.
|
|
952
|
+
*/
|
|
953
|
+
invites: {
|
|
954
|
+
/** GET /auth/tenants/{tenantId}/invites — every invite with its status, newest first. */
|
|
955
|
+
list: (tenantId: string) => Promise<TenantInvite[]>;
|
|
956
|
+
/**
|
|
957
|
+
* POST /auth/tenants/{tenantId}/invites — invite an address.
|
|
958
|
+
* Always returns `acceptUrl`; with `sendEmail: false` Authyon does not
|
|
959
|
+
* mail it and you deliver the link yourself. The link is valid for 7
|
|
960
|
+
* days, once, and can't be read again later.
|
|
961
|
+
*/
|
|
962
|
+
create: (tenantId: string, params: TenantInviteInput) => Promise<TenantInviteIssued>;
|
|
963
|
+
/**
|
|
964
|
+
* POST /auth/tenants/{tenantId}/invites/{inviteId}/resend — issue
|
|
965
|
+
* a new link (the previous one stops working), mailing it unless
|
|
966
|
+
* `sendEmail` is `false`.
|
|
967
|
+
*/
|
|
968
|
+
resend: (tenantId: string, inviteId: string, params?: {
|
|
969
|
+
sendEmail?: boolean;
|
|
970
|
+
}) => Promise<TenantInviteIssued>;
|
|
971
|
+
/** DELETE /auth/tenants/{tenantId}/invites/{inviteId} — revoke a pending invite. */
|
|
972
|
+
revoke: (tenantId: string, inviteId: string) => Promise<void>;
|
|
973
|
+
/**
|
|
974
|
+
* POST /auth/tenant-invites/preview — public. Read the `token` query
|
|
975
|
+
* parameter of the invite link and pick the form: one click when
|
|
976
|
+
* `accountExists`, sign-up otherwise.
|
|
977
|
+
*/
|
|
978
|
+
preview: (token: string) => Promise<TenantInvitePreview>;
|
|
979
|
+
/**
|
|
980
|
+
* POST /auth/tenant-invites/accept — public. Joins the tenant; for
|
|
981
|
+
* an address with no account, also creates it (password required) with
|
|
982
|
+
* the e-mail already confirmed. Does not sign the user in.
|
|
983
|
+
*/
|
|
984
|
+
accept: (params: AcceptTenantInviteInput) => Promise<TenantInviteAccepted>;
|
|
985
|
+
};
|
|
986
|
+
/**
|
|
987
|
+
* The direct, active sub-tenants of a tenant. One level per
|
|
988
|
+
* call: each row's `childCount` says where the next call is worth making,
|
|
989
|
+
* which is what a lazily expanded tree asks for.
|
|
990
|
+
*
|
|
991
|
+
* Needs `subtenants:tree:read` on the tenant or on one above it —
|
|
992
|
+
* even on the user's own tenant, since listing the children is
|
|
993
|
+
* reading below it. Paged like every other `skip`/`take` listing, with
|
|
994
|
+
* `search` (name, slug, description and public metadata), `filter` (public
|
|
995
|
+
* scope only — build them with `tenantFilter`) and `orderBy`
|
|
996
|
+
* (`name` | `createdAt` | `updatedAt`, ascending or descending). A bad
|
|
997
|
+
* option raises `RangeError` before any request.
|
|
998
|
+
*
|
|
999
|
+
* Not the same list as `tenants.list()`, which is the switcher's and
|
|
1000
|
+
* only brings what `subtenants:tree:switch` lets the user enter. Requires
|
|
1001
|
+
* the Authyon API of 2026-11-26 or newer.
|
|
1002
|
+
*/
|
|
1003
|
+
subTenants: {
|
|
1004
|
+
/** GET /auth/tenants/{tenantId}/subtenants. */
|
|
1005
|
+
list: (tenantId: string, params?: SubTenantListOptions) => Promise<Paged<SubTenant>>;
|
|
1006
|
+
/**
|
|
1007
|
+
* GET /auth/tenants/subtenants — the same, for the tenant the
|
|
1008
|
+
* session is scoped to (`tenants.current()`, the token's
|
|
1009
|
+
* `tenant_id`). Same permission rule; answers `tenant.no_active_tenant`
|
|
1010
|
+
* when the session never switched into one.
|
|
1011
|
+
*/
|
|
1012
|
+
listCurrent: (params?: SubTenantListOptions) => Promise<Paged<SubTenant>>;
|
|
1013
|
+
};
|
|
1014
|
+
roles: {
|
|
1015
|
+
/** GET /auth/tenants/{tenantId}/roles — roles available in the tenant. */
|
|
1016
|
+
list: (tenantId: string) => Promise<Role[]>;
|
|
1017
|
+
};
|
|
1018
|
+
};
|
|
1019
|
+
/**
|
|
1020
|
+
* @deprecated Use `tenants` — the same methods, named after the API's own
|
|
1021
|
+
* vocabulary (`tenants.subTenants` instead of `subOrganizations`). Kept so
|
|
1022
|
+
* code written against 0.2.0-beta.30 and earlier keeps working; removed in a
|
|
1023
|
+
* later release.
|
|
1024
|
+
*/
|
|
727
1025
|
readonly organization: {
|
|
1026
|
+
subOrganizations: {
|
|
1027
|
+
/** GET /auth/tenants/{tenantId}/subtenants. */
|
|
1028
|
+
list: (tenantId: string, params?: SubTenantListOptions) => Promise<Paged<SubTenant>>;
|
|
1029
|
+
/**
|
|
1030
|
+
* GET /auth/tenants/subtenants — the same, for the tenant the
|
|
1031
|
+
* session is scoped to (`tenants.current()`, the token's
|
|
1032
|
+
* `tenant_id`). Same permission rule; answers `tenant.no_active_tenant`
|
|
1033
|
+
* when the session never switched into one.
|
|
1034
|
+
*/
|
|
1035
|
+
listCurrent: (params?: SubTenantListOptions) => Promise<Paged<SubTenant>>;
|
|
1036
|
+
};
|
|
728
1037
|
/**
|
|
729
|
-
* GET /auth/tenants — filterable list of
|
|
1038
|
+
* GET /auth/tenants — filterable list of tenant memberships.
|
|
730
1039
|
*
|
|
731
|
-
* Also lists the
|
|
1040
|
+
* Also lists the tenants below them that the user may switch into
|
|
732
1041
|
* without being a member, marked `inherited` — only the ones that actually
|
|
733
1042
|
* carry `subtenants:tree:switch`, so the switcher never offers an
|
|
734
|
-
*
|
|
1043
|
+
* tenant the switch would then refuse. `depth` indents the list into
|
|
735
1044
|
* the tree it describes.
|
|
736
1045
|
*/
|
|
737
1046
|
list: (params?: {
|
|
738
1047
|
search?: string;
|
|
739
|
-
} & PaginationOptions) => Promise<
|
|
1048
|
+
} & PaginationOptions) => Promise<Tenant[]>;
|
|
740
1049
|
/**
|
|
741
|
-
* POST /auth/tenants — creates
|
|
742
|
-
* user (only available when self-service
|
|
1050
|
+
* POST /auth/tenants — creates a tenant owned by the signed-in
|
|
1051
|
+
* user (only available when self-service tenant creation is
|
|
743
1052
|
* enabled for the environment).
|
|
744
1053
|
*
|
|
745
1054
|
* `parentTenantId` nests it under one the user already belongs to, which
|
|
746
1055
|
* needs `subtenants:tree:create` there. The creator lands as the effective
|
|
747
1056
|
* owner either way, with `tenants:settings:manage`,
|
|
748
1057
|
* `tenants:members:invite` and `tenants:members:remove` granted directly
|
|
749
|
-
* inside the new
|
|
1058
|
+
* inside the new tenant.
|
|
1059
|
+
*/
|
|
1060
|
+
create: (params?: CreateTenantInput) => Promise<Tenant>;
|
|
1061
|
+
/**
|
|
1062
|
+
* GET /auth/tenants/{tenantId} — one tenant by id: the user's own,
|
|
1063
|
+
* or one below it with `subtenants:tree:read` on an ancestor.
|
|
1064
|
+
*/
|
|
1065
|
+
get: (tenantId: string) => Promise<Tenant>;
|
|
1066
|
+
/**
|
|
1067
|
+
* One tenant by id **or** slug — a UUID goes to `GET /auth/tenants/{id}`,
|
|
1068
|
+
* anything else to `GET /auth/tenants/by-slug/{slug}`. Same access rule and
|
|
1069
|
+
* same answer as `get`, so a page that only has the slug from its URL
|
|
1070
|
+
* doesn't have to page `subTenants.list` to find it.
|
|
1071
|
+
*
|
|
1072
|
+
* By slug, every refusal answers `tenant.not_found` (a slug is guessable,
|
|
1073
|
+
* so "exists, not yours" is never told apart from "doesn't exist"). An
|
|
1074
|
+
* empty value raises `RangeError` before any request. The slug route needs
|
|
1075
|
+
* the Authyon API of 2026-11-26 or newer.
|
|
750
1076
|
*/
|
|
751
|
-
|
|
752
|
-
/** GET /auth/tenants/{organizationId} — fetch one of the user's organizations by id. */
|
|
753
|
-
get: (organizationId: string) => Promise<Organization>;
|
|
1077
|
+
find: (idOrSlug: string) => Promise<Tenant>;
|
|
754
1078
|
/**
|
|
755
|
-
* PATCH /auth/tenants/{
|
|
1079
|
+
* PATCH /auth/tenants/{tenantId} — renames the tenant.
|
|
756
1080
|
*
|
|
757
1081
|
* Requires the `tenants:settings:manage` custom permission on it, or
|
|
758
|
-
* `subtenants:tree:manage` on
|
|
1082
|
+
* `subtenants:tree:manage` on a tenant above it. The value was
|
|
759
1083
|
* spelled `tenants:manage` before 2026-10-31 — two segments, which the API
|
|
760
1084
|
* could not store, so the endpoint refused everyone who had been granted
|
|
761
1085
|
* it.
|
|
762
1086
|
*/
|
|
763
|
-
rename: (
|
|
1087
|
+
rename: (tenantId: string, name: string) => Promise<Tenant>;
|
|
764
1088
|
/**
|
|
765
1089
|
* POST /auth/switch-tenant — issues a fresh token scoped to the new
|
|
766
|
-
*
|
|
1090
|
+
* tenant.
|
|
767
1091
|
*
|
|
768
|
-
* Membership is enough for one of the user's own
|
|
769
|
-
* into one below it takes `subtenants:tree:switch` at the
|
|
1092
|
+
* Membership is enough for one of the user's own tenants. Descending
|
|
1093
|
+
* into one below it takes `subtenants:tree:switch` at the tenant they
|
|
770
1094
|
* belong to — deliberately not the same permission as administering a
|
|
771
|
-
* sub-
|
|
1095
|
+
* sub-tenant from the outside, since operating AS it is the larger of
|
|
772
1096
|
* the two powers. The grants then travel from the node the user belongs to,
|
|
773
1097
|
* and the token says so in its `tenant.via`.
|
|
774
1098
|
*
|
|
@@ -776,68 +1100,96 @@ declare class AuthyonClient {
|
|
|
776
1100
|
* `tenant.ancestor_disabled`, and `tenant.path_stale` when the tree moved
|
|
777
1101
|
* under a session — sign-in again rather than retrying.
|
|
778
1102
|
*/
|
|
779
|
-
switch: (
|
|
780
|
-
/** The
|
|
781
|
-
current: () =>
|
|
1103
|
+
switch: (tenantSlug: string) => Promise<Session>;
|
|
1104
|
+
/** The tenant the current session is scoped to, from the cached session — no network call. */
|
|
1105
|
+
current: () => Tenant | null;
|
|
782
1106
|
members: {
|
|
783
1107
|
/**
|
|
784
|
-
* GET /auth/tenants/{
|
|
785
|
-
*
|
|
1108
|
+
* GET /auth/tenants/{tenantId}/members — paginated list of an
|
|
1109
|
+
* tenant's members, newest first, in the `Paged<T>` envelope every
|
|
786
1110
|
* other `skip`/`take` endpoint returns. `search` matches email, username
|
|
787
1111
|
* or name; at most 100 characters, and `take` 1-100, checked before any
|
|
788
1112
|
* request.
|
|
789
1113
|
*/
|
|
790
|
-
list: (
|
|
1114
|
+
list: (tenantId: string, params?: MemberListOptions) => Promise<Paged<TenantMember>>;
|
|
791
1115
|
/**
|
|
792
|
-
* POST /auth/tenants/{
|
|
1116
|
+
* POST /auth/tenants/{tenantId}/members — add an existing
|
|
793
1117
|
* environment user by e-mail (no e-mail is sent). To invite an address
|
|
794
|
-
* that may not have an account yet, use `
|
|
1118
|
+
* that may not have an account yet, use `tenants.invites.create`.
|
|
795
1119
|
*/
|
|
796
|
-
invite: (
|
|
797
|
-
/** DELETE /auth/tenants/{
|
|
798
|
-
remove: (
|
|
1120
|
+
invite: (tenantId: string, params: InviteMemberInput) => Promise<void>;
|
|
1121
|
+
/** DELETE /auth/tenants/{tenantId}/members/{userId} — remove a member. */
|
|
1122
|
+
remove: (tenantId: string, userId: string) => Promise<void>;
|
|
799
1123
|
};
|
|
800
1124
|
/**
|
|
801
1125
|
* Invites by e-mail or by link. Managing them requires the
|
|
802
|
-
* `tenants:members:invite` permission on the
|
|
1126
|
+
* `tenants:members:invite` permission on the tenant; `preview` and
|
|
803
1127
|
* `accept` are public — the token in the link is the credential.
|
|
804
1128
|
*/
|
|
805
1129
|
invites: {
|
|
806
|
-
/** GET /auth/tenants/{
|
|
807
|
-
list: (
|
|
1130
|
+
/** GET /auth/tenants/{tenantId}/invites — every invite with its status, newest first. */
|
|
1131
|
+
list: (tenantId: string) => Promise<TenantInvite[]>;
|
|
808
1132
|
/**
|
|
809
|
-
* POST /auth/tenants/{
|
|
1133
|
+
* POST /auth/tenants/{tenantId}/invites — invite an address.
|
|
810
1134
|
* Always returns `acceptUrl`; with `sendEmail: false` Authyon does not
|
|
811
1135
|
* mail it and you deliver the link yourself. The link is valid for 7
|
|
812
1136
|
* days, once, and can't be read again later.
|
|
813
1137
|
*/
|
|
814
|
-
create: (
|
|
1138
|
+
create: (tenantId: string, params: TenantInviteInput) => Promise<TenantInviteIssued>;
|
|
815
1139
|
/**
|
|
816
|
-
* POST /auth/tenants/{
|
|
1140
|
+
* POST /auth/tenants/{tenantId}/invites/{inviteId}/resend — issue
|
|
817
1141
|
* a new link (the previous one stops working), mailing it unless
|
|
818
1142
|
* `sendEmail` is `false`.
|
|
819
1143
|
*/
|
|
820
|
-
resend: (
|
|
1144
|
+
resend: (tenantId: string, inviteId: string, params?: {
|
|
821
1145
|
sendEmail?: boolean;
|
|
822
|
-
}) => Promise<
|
|
823
|
-
/** DELETE /auth/tenants/{
|
|
824
|
-
revoke: (
|
|
1146
|
+
}) => Promise<TenantInviteIssued>;
|
|
1147
|
+
/** DELETE /auth/tenants/{tenantId}/invites/{inviteId} — revoke a pending invite. */
|
|
1148
|
+
revoke: (tenantId: string, inviteId: string) => Promise<void>;
|
|
825
1149
|
/**
|
|
826
1150
|
* POST /auth/tenant-invites/preview — public. Read the `token` query
|
|
827
1151
|
* parameter of the invite link and pick the form: one click when
|
|
828
1152
|
* `accountExists`, sign-up otherwise.
|
|
829
1153
|
*/
|
|
830
|
-
preview: (token: string) => Promise<
|
|
1154
|
+
preview: (token: string) => Promise<TenantInvitePreview>;
|
|
831
1155
|
/**
|
|
832
|
-
* POST /auth/tenant-invites/accept — public. Joins the
|
|
1156
|
+
* POST /auth/tenant-invites/accept — public. Joins the tenant; for
|
|
833
1157
|
* an address with no account, also creates it (password required) with
|
|
834
1158
|
* the e-mail already confirmed. Does not sign the user in.
|
|
835
1159
|
*/
|
|
836
|
-
accept: (params:
|
|
1160
|
+
accept: (params: AcceptTenantInviteInput) => Promise<TenantInviteAccepted>;
|
|
1161
|
+
};
|
|
1162
|
+
/**
|
|
1163
|
+
* The direct, active sub-tenants of a tenant. One level per
|
|
1164
|
+
* call: each row's `childCount` says where the next call is worth making,
|
|
1165
|
+
* which is what a lazily expanded tree asks for.
|
|
1166
|
+
*
|
|
1167
|
+
* Needs `subtenants:tree:read` on the tenant or on one above it —
|
|
1168
|
+
* even on the user's own tenant, since listing the children is
|
|
1169
|
+
* reading below it. Paged like every other `skip`/`take` listing, with
|
|
1170
|
+
* `search` (name, slug, description and public metadata), `filter` (public
|
|
1171
|
+
* scope only — build them with `tenantFilter`) and `orderBy`
|
|
1172
|
+
* (`name` | `createdAt` | `updatedAt`, ascending or descending). A bad
|
|
1173
|
+
* option raises `RangeError` before any request.
|
|
1174
|
+
*
|
|
1175
|
+
* Not the same list as `tenants.list()`, which is the switcher's and
|
|
1176
|
+
* only brings what `subtenants:tree:switch` lets the user enter. Requires
|
|
1177
|
+
* the Authyon API of 2026-11-26 or newer.
|
|
1178
|
+
*/
|
|
1179
|
+
subTenants: {
|
|
1180
|
+
/** GET /auth/tenants/{tenantId}/subtenants. */
|
|
1181
|
+
list: (tenantId: string, params?: SubTenantListOptions) => Promise<Paged<SubTenant>>;
|
|
1182
|
+
/**
|
|
1183
|
+
* GET /auth/tenants/subtenants — the same, for the tenant the
|
|
1184
|
+
* session is scoped to (`tenants.current()`, the token's
|
|
1185
|
+
* `tenant_id`). Same permission rule; answers `tenant.no_active_tenant`
|
|
1186
|
+
* when the session never switched into one.
|
|
1187
|
+
*/
|
|
1188
|
+
listCurrent: (params?: SubTenantListOptions) => Promise<Paged<SubTenant>>;
|
|
837
1189
|
};
|
|
838
1190
|
roles: {
|
|
839
|
-
/** GET /auth/tenants/{
|
|
840
|
-
list: (
|
|
1191
|
+
/** GET /auth/tenants/{tenantId}/roles — roles available in the tenant. */
|
|
1192
|
+
list: (tenantId: string) => Promise<Role[]>;
|
|
841
1193
|
};
|
|
842
1194
|
};
|
|
843
1195
|
readonly twoFactor: {
|
|
@@ -1031,4 +1383,4 @@ declare function hasPermissionGroup(source: AuthyonPermissionSource | readonly s
|
|
|
1031
1383
|
/** Converts Authyon's `subject:action` permission strings to authorization rules. */
|
|
1032
1384
|
declare function createAuthyonRules(source?: AuthyonPermissionSource, options?: AuthyonAbilityOptions): AbilityRule[];
|
|
1033
1385
|
|
|
1034
|
-
export { type
|
|
1386
|
+
export { type PermissionGroup as $, AuthyonClient as A, type HttpAdapterRequest as B, type ConfirmApprovalInput as C, type HttpLogEvent as D, type HttpLogger as E, FetchHttpAdapter as F, type InviteMemberInput as G, type HttpAdapter as H, type IntrospectResult as I, type LoginInput as J, type LoginResult as K, LoggingHttpAdapter as L, type MemberListOptions as M, type OrganizationInvite as N, type Organization as O, type OrganizationInviteAccepted as P, type OrganizationInviteInput as Q, type OrganizationInviteIssued as R, type OrganizationInvitePreview as S, type TokenStorage as T, type OrganizationInviteStatus as U, type OrganizationMember as V, type Paged as W, type PaginationOptions as X, type PasswordResetCompleted as Y, type PasswordResetPreview as Z, type PasswordResetRequestOptions as _, type HttpLoggerOptions as a, type RegisterInput as a0, type Role as a1, type SecurityMethods as a2, type Session as a3, type SessionControllerOptions as a4, type SessionInfo as a5, type SessionSnapshot as a6, type SessionSnapshotListener as a7, type SessionStatus as a8, type SsoProvider as a9, createAuthyonAbility as aA, createAuthyonRules as aB, createClient as aC, hasPermission as aD, hasPermissionGroup as aE, type SubOrganization as aa, type SubOrganizationListOptions as ab, type SubTenant as ac, type SubTenantListOptions as ad, type SubjectApprovals as ae, type SubjectSecurity as af, type Tenant as ag, type TenantInvite as ah, type TenantInviteAccepted as ai, type TenantInviteInput as aj, type TenantInviteIssued as ak, type TenantInvitePreview as al, type TenantInviteStatus as am, type TenantMember as an, type TenantOrder as ao, type TenantOrderField as ap, type TenantParent as aq, type TwoFactorChallenge as ar, type TwoFactorMethod as as, type TwoFactorStatus as at, type User as au, type ValidateResult as av, type VerifyTwoFactorInput as aw, type WebAuthnAssertion as ax, type WebAuthnCeremonyStart as ay, type WebAuthnCredential as az, type AbilityConditions as b, type AbilityEvent as c, type AbilityListener as d, type AbilityRule as e, type AbilitySubject as f, type AcceptOrganizationInviteInput as g, type AcceptTenantInviteInput as h, type Activity as i, type Approval as j, type ApprovalAssurance as k, type ApprovalPayload as l, type ApprovalStatus as m, type ApprovalWebAuthnOptions as n, type AuthEvent as o, type AuthState as p, type AuthStateListener as q, type AuthenticatorSetup as r, AuthyonAbility as s, AuthyonAbilityBuilder as t, type AuthyonAbilityOptions as u, type AuthyonClientOptions as v, type AuthyonPermissionSource as w, AuthyonSessionController as x, type CreateOrganizationInput as y, type CreateTenantInput as z };
|