@authyon/auth 0.2.0-beta.30 → 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 +40 -39
- package/dist/{ability-CmJEviJj.d.cts → ability-BPJ5VdSC.d.cts} +314 -98
- package/dist/{ability-CmJEviJj.d.ts → ability-BPJ5VdSC.d.ts} +314 -98
- package/dist/index.cjs +96 -63
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +96 -63
- package/dist/react/index.d.cts +2 -2
- package/dist/react/index.d.ts +2 -2
- package/package.json +1 -1
|
@@ -268,45 +268,46 @@ interface SubTenant {
|
|
|
268
268
|
}
|
|
269
269
|
|
|
270
270
|
/**
|
|
271
|
-
*
|
|
272
|
-
*
|
|
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.
|
|
273
274
|
*/
|
|
274
|
-
interface
|
|
275
|
+
interface Tenant {
|
|
275
276
|
id: string;
|
|
276
277
|
slug: string;
|
|
277
278
|
name?: string;
|
|
278
279
|
description?: string;
|
|
279
280
|
roles?: string[];
|
|
280
|
-
/** JSON-encoded values for the
|
|
281
|
+
/** JSON-encoded values for the tenant's configured custom fields. */
|
|
281
282
|
customFields?: string;
|
|
282
|
-
/** JSON-encoded metadata visible to members of the
|
|
283
|
+
/** JSON-encoded metadata visible to members of the tenant. */
|
|
283
284
|
publicMetadata?: string;
|
|
284
285
|
/**
|
|
285
|
-
* `false` for
|
|
286
|
+
* `false` for a tenant the user belongs to. `true` for one they may
|
|
286
287
|
* switch into from an ancestor without being a member — show it as borrowed
|
|
287
|
-
* rather than owned. Only `
|
|
288
|
+
* rather than owned. Only `tenants.list()` fills it.
|
|
288
289
|
*
|
|
289
|
-
* Ignoring the field still leaves you with a switchable
|
|
290
|
+
* Ignoring the field still leaves you with a switchable tenant, which
|
|
290
291
|
* is what it is. Absent on an API older than 2026-10-31.
|
|
291
292
|
*/
|
|
292
293
|
inherited?: boolean;
|
|
293
|
-
/** Distance from the root: `0` at a root
|
|
294
|
+
/** Distance from the root: `0` at a root tenant. Indent the switcher by it. */
|
|
294
295
|
depth?: number;
|
|
295
296
|
/**
|
|
296
|
-
* The parent's id, `null` for a root. Only `
|
|
297
|
+
* The parent's id, `null` for a root. Only `tenants.list()` fills it —
|
|
297
298
|
* with `depth`, it nests the switcher's flat list into a tree. `get`,
|
|
298
299
|
* `create` and `rename` send `parent` instead. Absent from an API older than
|
|
299
300
|
* 2026-11-26.
|
|
300
301
|
*/
|
|
301
302
|
parentTenantId?: string | null;
|
|
302
303
|
/**
|
|
303
|
-
* The
|
|
304
|
-
* sub-
|
|
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`;
|
|
305
306
|
* absent from an API older than 2026-11-26.
|
|
306
307
|
*/
|
|
307
308
|
parent?: TenantParent | null;
|
|
308
309
|
/**
|
|
309
|
-
* A disabled
|
|
310
|
+
* A disabled tenant still reads, but every change to it is refused
|
|
310
311
|
* with `tenant.disabled`. Filled by `get`, `create` and `rename`; absent from
|
|
311
312
|
* an API older than 2026-11-26.
|
|
312
313
|
*/
|
|
@@ -314,8 +315,8 @@ interface Organization {
|
|
|
314
315
|
/** Roles the user holds in it; empty when they reach it from an ancestor. Filled by `get`, `create` and `rename`. */
|
|
315
316
|
myRoles?: string[];
|
|
316
317
|
/**
|
|
317
|
-
* The
|
|
318
|
-
* values: `tenants:*` on their own
|
|
318
|
+
* The tenant-route permissions the user can use on it, as concrete
|
|
319
|
+
* values: `tenants:*` on their own tenant, `subtenants:tree:*` from
|
|
319
320
|
* above. This, not `myRoles`, is what decides which actions to offer — the
|
|
320
321
|
* creator holds direct grants and no role. Filled by `get`, `create` and
|
|
321
322
|
* `rename`; absent from an API older than 2026-11-26.
|
|
@@ -324,33 +325,25 @@ interface Organization {
|
|
|
324
325
|
/** How many members it has. Filled by `get`, `create` and `rename`. */
|
|
325
326
|
memberCount?: number;
|
|
326
327
|
}
|
|
327
|
-
/**
|
|
328
|
-
|
|
329
|
-
/**
|
|
330
|
-
* What `organization.subOrganizations` accepts — see `SubTenantListOptions`:
|
|
331
|
-
* `skip`/`take`, `search`, `filter` (public scope only, built with
|
|
332
|
-
* `tenantFilter`) and `orderBy`.
|
|
333
|
-
*/
|
|
334
|
-
type SubOrganizationListOptions = SubTenantListOptions;
|
|
335
|
-
/** POST /auth/tenants — creates an organization owned by the signed-in user. */
|
|
336
|
-
interface CreateOrganizationInput {
|
|
328
|
+
/** POST /auth/tenants — creates a tenant owned by the signed-in user. */
|
|
329
|
+
interface CreateTenantInput {
|
|
337
330
|
name?: string;
|
|
338
331
|
slug?: string;
|
|
339
332
|
description?: string;
|
|
340
333
|
customFields?: Record<string, unknown>;
|
|
341
334
|
/**
|
|
342
|
-
* Creates the
|
|
343
|
-
* root
|
|
335
|
+
* Creates the tenant underneath an existing one. Omitted creates a
|
|
336
|
+
* root tenant, which is all this endpoint could do before the
|
|
344
337
|
* hierarchy existed.
|
|
345
338
|
*
|
|
346
|
-
* 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)
|
|
347
340
|
* and hold `subtenants:tree:create` there, and the environment's
|
|
348
341
|
* `maxTenantDepth` has to allow the level — it ships as `1`, roots only.
|
|
349
342
|
*/
|
|
350
343
|
parentTenantId?: string;
|
|
351
344
|
}
|
|
352
|
-
/** GET /auth/tenants/{
|
|
353
|
-
interface
|
|
345
|
+
/** GET /auth/tenants/{tenantId}/members — confirmed against the live API. */
|
|
346
|
+
interface TenantMember {
|
|
354
347
|
userId: string;
|
|
355
348
|
email?: string;
|
|
356
349
|
username?: string;
|
|
@@ -374,11 +367,11 @@ interface InviteMemberInput {
|
|
|
374
367
|
roles: string[];
|
|
375
368
|
}
|
|
376
369
|
/**
|
|
377
|
-
* POST /auth/tenants/{
|
|
370
|
+
* POST /auth/tenants/{tenantId}/invites — invite an address that may not
|
|
378
371
|
* have an account yet; accepting creates it. `sendEmail` defaults to `true`;
|
|
379
372
|
* `false` only returns the link, for delivery through your own channel.
|
|
380
373
|
*/
|
|
381
|
-
interface
|
|
374
|
+
interface TenantInviteInput {
|
|
382
375
|
email: string;
|
|
383
376
|
roles?: string[];
|
|
384
377
|
sendEmail?: boolean;
|
|
@@ -391,7 +384,7 @@ interface OrganizationInviteInput {
|
|
|
391
384
|
}
|
|
392
385
|
/** Returned when an invite is created or re-issued. `acceptUrl` is only ever
|
|
393
386
|
* readable here — the API keeps a hash of the token, not the token. */
|
|
394
|
-
interface
|
|
387
|
+
interface TenantInviteIssued {
|
|
395
388
|
id: string;
|
|
396
389
|
tenantId: string;
|
|
397
390
|
email: string;
|
|
@@ -401,13 +394,13 @@ interface OrganizationInviteIssued {
|
|
|
401
394
|
emailSent: boolean;
|
|
402
395
|
redirectUri: string | null;
|
|
403
396
|
}
|
|
404
|
-
type
|
|
405
|
-
interface
|
|
397
|
+
type TenantInviteStatus = "pending" | "accepted" | "revoked" | "expired";
|
|
398
|
+
interface TenantInvite {
|
|
406
399
|
id: string;
|
|
407
400
|
tenantId: string;
|
|
408
401
|
email: string;
|
|
409
402
|
roles: string[];
|
|
410
|
-
status:
|
|
403
|
+
status: TenantInviteStatus;
|
|
411
404
|
createdAt: string;
|
|
412
405
|
expiresAt: string;
|
|
413
406
|
emailSentAt: string | null;
|
|
@@ -418,7 +411,7 @@ interface OrganizationInvite {
|
|
|
418
411
|
redirectUri: string | null;
|
|
419
412
|
}
|
|
420
413
|
/** POST /auth/tenant-invites/preview — what an accept page shows before the invitee commits. */
|
|
421
|
-
interface
|
|
414
|
+
interface TenantInvitePreview {
|
|
422
415
|
tenantId: string;
|
|
423
416
|
tenantName: string;
|
|
424
417
|
email: string;
|
|
@@ -454,7 +447,7 @@ interface PasswordResetCompleted {
|
|
|
454
447
|
redirectUri: string | null;
|
|
455
448
|
}
|
|
456
449
|
/** POST /auth/tenant-invites/accept — everything but `token` is ignored when the address already has an account. */
|
|
457
|
-
interface
|
|
450
|
+
interface AcceptTenantInviteInput {
|
|
458
451
|
token: string;
|
|
459
452
|
username?: string;
|
|
460
453
|
password?: string;
|
|
@@ -467,7 +460,7 @@ interface AcceptOrganizationInviteInput {
|
|
|
467
460
|
*/
|
|
468
461
|
customFields?: Record<string, unknown>;
|
|
469
462
|
}
|
|
470
|
-
interface
|
|
463
|
+
interface TenantInviteAccepted {
|
|
471
464
|
tenantId: string;
|
|
472
465
|
tenantName: string;
|
|
473
466
|
userId: string;
|
|
@@ -488,8 +481,13 @@ interface User {
|
|
|
488
481
|
permissions?: string[];
|
|
489
482
|
createdAt?: string;
|
|
490
483
|
lastLoginAt?: string;
|
|
491
|
-
|
|
492
|
-
|
|
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;
|
|
493
491
|
/** Actions the user must complete before continuing (e.g. confirm e-mail). */
|
|
494
492
|
pendencies?: string[];
|
|
495
493
|
/** Security methods active on the account (authenticator, email code, passkey, SSO…). */
|
|
@@ -529,7 +527,9 @@ interface LoginInput {
|
|
|
529
527
|
email?: string;
|
|
530
528
|
username?: string;
|
|
531
529
|
password: string;
|
|
532
|
-
/** Optional
|
|
530
|
+
/** Optional tenant to scope the session to. */
|
|
531
|
+
tenantSlug?: string;
|
|
532
|
+
/** @deprecated Use `tenantSlug`. */
|
|
533
533
|
organizationSlug?: string;
|
|
534
534
|
}
|
|
535
535
|
/** A completed WebAuthn ceremony, handed back to the server to finish login/registration. */
|
|
@@ -601,7 +601,7 @@ interface Activity {
|
|
|
601
601
|
/** JSON-encoded string — `JSON.parse` it for the event-specific payload. */
|
|
602
602
|
payloadJson?: string;
|
|
603
603
|
}
|
|
604
|
-
/** A role available within
|
|
604
|
+
/** A role available within a tenant. */
|
|
605
605
|
interface Role {
|
|
606
606
|
id: string;
|
|
607
607
|
name: string;
|
|
@@ -624,7 +624,7 @@ interface SessionInfo {
|
|
|
624
624
|
}
|
|
625
625
|
/**
|
|
626
626
|
* POST /auth/validate — confirmed against the live API. The wire shape is
|
|
627
|
-
* `{ valid, reason, profile }`, not `{ user,
|
|
627
|
+
* `{ valid, reason, profile }`, not `{ user, tenant }` as the
|
|
628
628
|
* OpenAPI schema (which didn't document response bodies) suggested.
|
|
629
629
|
* `profile` is `null` for machine tokens (there's no user behind them) and
|
|
630
630
|
* for tokens that fail validation.
|
|
@@ -690,6 +690,31 @@ interface AuthyonClientOptions {
|
|
|
690
690
|
fetch?: typeof fetch;
|
|
691
691
|
}
|
|
692
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
|
+
|
|
693
718
|
declare class AuthyonClient {
|
|
694
719
|
private readonly envKey;
|
|
695
720
|
private readonly clientIp?;
|
|
@@ -832,51 +857,66 @@ declare class AuthyonClient {
|
|
|
832
857
|
*/
|
|
833
858
|
confirmPasswordReset: (token: string, newPassword: string) => Promise<PasswordResetCompleted>;
|
|
834
859
|
};
|
|
835
|
-
readonly
|
|
860
|
+
readonly tenants: {
|
|
836
861
|
/**
|
|
837
|
-
* GET /auth/tenants — filterable list of
|
|
862
|
+
* GET /auth/tenants — filterable list of tenant memberships.
|
|
838
863
|
*
|
|
839
|
-
* Also lists the
|
|
864
|
+
* Also lists the tenants below them that the user may switch into
|
|
840
865
|
* without being a member, marked `inherited` — only the ones that actually
|
|
841
866
|
* carry `subtenants:tree:switch`, so the switcher never offers an
|
|
842
|
-
*
|
|
867
|
+
* tenant the switch would then refuse. `depth` indents the list into
|
|
843
868
|
* the tree it describes.
|
|
844
869
|
*/
|
|
845
870
|
list: (params?: {
|
|
846
871
|
search?: string;
|
|
847
|
-
} & PaginationOptions) => Promise<
|
|
872
|
+
} & PaginationOptions) => Promise<Tenant[]>;
|
|
848
873
|
/**
|
|
849
|
-
* POST /auth/tenants — creates
|
|
850
|
-
* user (only available when self-service
|
|
874
|
+
* POST /auth/tenants — creates a tenant owned by the signed-in
|
|
875
|
+
* user (only available when self-service tenant creation is
|
|
851
876
|
* enabled for the environment).
|
|
852
877
|
*
|
|
853
878
|
* `parentTenantId` nests it under one the user already belongs to, which
|
|
854
879
|
* needs `subtenants:tree:create` there. The creator lands as the effective
|
|
855
880
|
* owner either way, with `tenants:settings:manage`,
|
|
856
881
|
* `tenants:members:invite` and `tenants:members:remove` granted directly
|
|
857
|
-
* inside the new
|
|
882
|
+
* inside the new tenant.
|
|
858
883
|
*/
|
|
859
|
-
create: (params?:
|
|
860
|
-
/** GET /auth/tenants/{organizationId} — fetch one of the user's organizations by id. */
|
|
861
|
-
get: (organizationId: string) => Promise<Organization>;
|
|
884
|
+
create: (params?: CreateTenantInput) => Promise<Tenant>;
|
|
862
885
|
/**
|
|
863
|
-
*
|
|
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.
|
|
864
904
|
*
|
|
865
905
|
* Requires the `tenants:settings:manage` custom permission on it, or
|
|
866
|
-
* `subtenants:tree:manage` on
|
|
906
|
+
* `subtenants:tree:manage` on a tenant above it. The value was
|
|
867
907
|
* spelled `tenants:manage` before 2026-10-31 — two segments, which the API
|
|
868
908
|
* could not store, so the endpoint refused everyone who had been granted
|
|
869
909
|
* it.
|
|
870
910
|
*/
|
|
871
|
-
rename: (
|
|
911
|
+
rename: (tenantId: string, name: string) => Promise<Tenant>;
|
|
872
912
|
/**
|
|
873
913
|
* POST /auth/switch-tenant — issues a fresh token scoped to the new
|
|
874
|
-
*
|
|
914
|
+
* tenant.
|
|
875
915
|
*
|
|
876
|
-
* Membership is enough for one of the user's own
|
|
877
|
-
* into one below it takes `subtenants:tree:switch` at the
|
|
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
|
|
878
918
|
* belong to — deliberately not the same permission as administering a
|
|
879
|
-
* sub-
|
|
919
|
+
* sub-tenant from the outside, since operating AS it is the larger of
|
|
880
920
|
* the two powers. The grants then travel from the node the user belongs to,
|
|
881
921
|
* and the token says so in its `tenant.via`.
|
|
882
922
|
*
|
|
@@ -884,96 +924,272 @@ declare class AuthyonClient {
|
|
|
884
924
|
* `tenant.ancestor_disabled`, and `tenant.path_stale` when the tree moved
|
|
885
925
|
* under a session — sign-in again rather than retrying.
|
|
886
926
|
*/
|
|
887
|
-
switch: (
|
|
888
|
-
/** The
|
|
889
|
-
current: () =>
|
|
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;
|
|
890
930
|
members: {
|
|
891
931
|
/**
|
|
892
|
-
* GET /auth/tenants/{
|
|
893
|
-
*
|
|
932
|
+
* GET /auth/tenants/{tenantId}/members — paginated list of an
|
|
933
|
+
* tenant's members, newest first, in the `Paged<T>` envelope every
|
|
894
934
|
* other `skip`/`take` endpoint returns. `search` matches email, username
|
|
895
935
|
* or name; at most 100 characters, and `take` 1-100, checked before any
|
|
896
936
|
* request.
|
|
897
937
|
*/
|
|
898
|
-
list: (
|
|
938
|
+
list: (tenantId: string, params?: MemberListOptions) => Promise<Paged<TenantMember>>;
|
|
899
939
|
/**
|
|
900
|
-
* POST /auth/tenants/{
|
|
940
|
+
* POST /auth/tenants/{tenantId}/members — add an existing
|
|
901
941
|
* environment user by e-mail (no e-mail is sent). To invite an address
|
|
902
|
-
* that may not have an account yet, use `
|
|
942
|
+
* that may not have an account yet, use `tenants.invites.create`.
|
|
903
943
|
*/
|
|
904
|
-
invite: (
|
|
905
|
-
/** DELETE /auth/tenants/{
|
|
906
|
-
remove: (
|
|
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>;
|
|
907
947
|
};
|
|
908
948
|
/**
|
|
909
949
|
* Invites by e-mail or by link. Managing them requires the
|
|
910
|
-
* `tenants:members:invite` permission on the
|
|
950
|
+
* `tenants:members:invite` permission on the tenant; `preview` and
|
|
911
951
|
* `accept` are public — the token in the link is the credential.
|
|
912
952
|
*/
|
|
913
953
|
invites: {
|
|
914
|
-
/** GET /auth/tenants/{
|
|
915
|
-
list: (
|
|
954
|
+
/** GET /auth/tenants/{tenantId}/invites — every invite with its status, newest first. */
|
|
955
|
+
list: (tenantId: string) => Promise<TenantInvite[]>;
|
|
916
956
|
/**
|
|
917
|
-
* POST /auth/tenants/{
|
|
957
|
+
* POST /auth/tenants/{tenantId}/invites — invite an address.
|
|
918
958
|
* Always returns `acceptUrl`; with `sendEmail: false` Authyon does not
|
|
919
959
|
* mail it and you deliver the link yourself. The link is valid for 7
|
|
920
960
|
* days, once, and can't be read again later.
|
|
921
961
|
*/
|
|
922
|
-
create: (
|
|
962
|
+
create: (tenantId: string, params: TenantInviteInput) => Promise<TenantInviteIssued>;
|
|
923
963
|
/**
|
|
924
|
-
* POST /auth/tenants/{
|
|
964
|
+
* POST /auth/tenants/{tenantId}/invites/{inviteId}/resend — issue
|
|
925
965
|
* a new link (the previous one stops working), mailing it unless
|
|
926
966
|
* `sendEmail` is `false`.
|
|
927
967
|
*/
|
|
928
|
-
resend: (
|
|
968
|
+
resend: (tenantId: string, inviteId: string, params?: {
|
|
929
969
|
sendEmail?: boolean;
|
|
930
|
-
}) => Promise<
|
|
931
|
-
/** DELETE /auth/tenants/{
|
|
932
|
-
revoke: (
|
|
970
|
+
}) => Promise<TenantInviteIssued>;
|
|
971
|
+
/** DELETE /auth/tenants/{tenantId}/invites/{inviteId} — revoke a pending invite. */
|
|
972
|
+
revoke: (tenantId: string, inviteId: string) => Promise<void>;
|
|
933
973
|
/**
|
|
934
974
|
* POST /auth/tenant-invites/preview — public. Read the `token` query
|
|
935
975
|
* parameter of the invite link and pick the form: one click when
|
|
936
976
|
* `accountExists`, sign-up otherwise.
|
|
937
977
|
*/
|
|
938
|
-
preview: (token: string) => Promise<
|
|
978
|
+
preview: (token: string) => Promise<TenantInvitePreview>;
|
|
939
979
|
/**
|
|
940
|
-
* POST /auth/tenant-invites/accept — public. Joins the
|
|
980
|
+
* POST /auth/tenant-invites/accept — public. Joins the tenant; for
|
|
941
981
|
* an address with no account, also creates it (password required) with
|
|
942
982
|
* the e-mail already confirmed. Does not sign the user in.
|
|
943
983
|
*/
|
|
944
|
-
accept: (params:
|
|
984
|
+
accept: (params: AcceptTenantInviteInput) => Promise<TenantInviteAccepted>;
|
|
945
985
|
};
|
|
946
986
|
/**
|
|
947
|
-
* The direct, active sub-
|
|
987
|
+
* The direct, active sub-tenants of a tenant. One level per
|
|
948
988
|
* call: each row's `childCount` says where the next call is worth making,
|
|
949
989
|
* which is what a lazily expanded tree asks for.
|
|
950
990
|
*
|
|
951
|
-
* Needs `subtenants:tree:read` on the
|
|
952
|
-
* even on the user's own
|
|
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
|
|
953
993
|
* reading below it. Paged like every other `skip`/`take` listing, with
|
|
954
994
|
* `search` (name, slug, description and public metadata), `filter` (public
|
|
955
995
|
* scope only — build them with `tenantFilter`) and `orderBy`
|
|
956
996
|
* (`name` | `createdAt` | `updatedAt`, ascending or descending). A bad
|
|
957
997
|
* option raises `RangeError` before any request.
|
|
958
998
|
*
|
|
959
|
-
* Not the same list as `
|
|
999
|
+
* Not the same list as `tenants.list()`, which is the switcher's and
|
|
960
1000
|
* only brings what `subtenants:tree:switch` lets the user enter. Requires
|
|
961
1001
|
* the Authyon API of 2026-11-26 or newer.
|
|
962
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
|
+
*/
|
|
1025
|
+
readonly organization: {
|
|
963
1026
|
subOrganizations: {
|
|
964
|
-
/** GET /auth/tenants/{
|
|
965
|
-
list: (
|
|
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
|
+
};
|
|
1037
|
+
/**
|
|
1038
|
+
* GET /auth/tenants — filterable list of tenant memberships.
|
|
1039
|
+
*
|
|
1040
|
+
* Also lists the tenants below them that the user may switch into
|
|
1041
|
+
* without being a member, marked `inherited` — only the ones that actually
|
|
1042
|
+
* carry `subtenants:tree:switch`, so the switcher never offers an
|
|
1043
|
+
* tenant the switch would then refuse. `depth` indents the list into
|
|
1044
|
+
* the tree it describes.
|
|
1045
|
+
*/
|
|
1046
|
+
list: (params?: {
|
|
1047
|
+
search?: string;
|
|
1048
|
+
} & PaginationOptions) => Promise<Tenant[]>;
|
|
1049
|
+
/**
|
|
1050
|
+
* POST /auth/tenants — creates a tenant owned by the signed-in
|
|
1051
|
+
* user (only available when self-service tenant creation is
|
|
1052
|
+
* enabled for the environment).
|
|
1053
|
+
*
|
|
1054
|
+
* `parentTenantId` nests it under one the user already belongs to, which
|
|
1055
|
+
* needs `subtenants:tree:create` there. The creator lands as the effective
|
|
1056
|
+
* owner either way, with `tenants:settings:manage`,
|
|
1057
|
+
* `tenants:members:invite` and `tenants:members:remove` granted directly
|
|
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.
|
|
1076
|
+
*/
|
|
1077
|
+
find: (idOrSlug: string) => Promise<Tenant>;
|
|
1078
|
+
/**
|
|
1079
|
+
* PATCH /auth/tenants/{tenantId} — renames the tenant.
|
|
1080
|
+
*
|
|
1081
|
+
* Requires the `tenants:settings:manage` custom permission on it, or
|
|
1082
|
+
* `subtenants:tree:manage` on a tenant above it. The value was
|
|
1083
|
+
* spelled `tenants:manage` before 2026-10-31 — two segments, which the API
|
|
1084
|
+
* could not store, so the endpoint refused everyone who had been granted
|
|
1085
|
+
* it.
|
|
1086
|
+
*/
|
|
1087
|
+
rename: (tenantId: string, name: string) => Promise<Tenant>;
|
|
1088
|
+
/**
|
|
1089
|
+
* POST /auth/switch-tenant — issues a fresh token scoped to the new
|
|
1090
|
+
* tenant.
|
|
1091
|
+
*
|
|
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
|
|
1094
|
+
* belong to — deliberately not the same permission as administering a
|
|
1095
|
+
* sub-tenant from the outside, since operating AS it is the larger of
|
|
1096
|
+
* the two powers. The grants then travel from the node the user belongs to,
|
|
1097
|
+
* and the token says so in its `tenant.via`.
|
|
1098
|
+
*
|
|
1099
|
+
* Refusals: `tenant.outside_scope` (no path down to it),
|
|
1100
|
+
* `tenant.ancestor_disabled`, and `tenant.path_stale` when the tree moved
|
|
1101
|
+
* under a session — sign-in again rather than retrying.
|
|
1102
|
+
*/
|
|
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;
|
|
1106
|
+
members: {
|
|
1107
|
+
/**
|
|
1108
|
+
* GET /auth/tenants/{tenantId}/members — paginated list of an
|
|
1109
|
+
* tenant's members, newest first, in the `Paged<T>` envelope every
|
|
1110
|
+
* other `skip`/`take` endpoint returns. `search` matches email, username
|
|
1111
|
+
* or name; at most 100 characters, and `take` 1-100, checked before any
|
|
1112
|
+
* request.
|
|
1113
|
+
*/
|
|
1114
|
+
list: (tenantId: string, params?: MemberListOptions) => Promise<Paged<TenantMember>>;
|
|
1115
|
+
/**
|
|
1116
|
+
* POST /auth/tenants/{tenantId}/members — add an existing
|
|
1117
|
+
* environment user by e-mail (no e-mail is sent). To invite an address
|
|
1118
|
+
* that may not have an account yet, use `tenants.invites.create`.
|
|
1119
|
+
*/
|
|
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>;
|
|
1123
|
+
};
|
|
1124
|
+
/**
|
|
1125
|
+
* Invites by e-mail or by link. Managing them requires the
|
|
1126
|
+
* `tenants:members:invite` permission on the tenant; `preview` and
|
|
1127
|
+
* `accept` are public — the token in the link is the credential.
|
|
1128
|
+
*/
|
|
1129
|
+
invites: {
|
|
1130
|
+
/** GET /auth/tenants/{tenantId}/invites — every invite with its status, newest first. */
|
|
1131
|
+
list: (tenantId: string) => Promise<TenantInvite[]>;
|
|
1132
|
+
/**
|
|
1133
|
+
* POST /auth/tenants/{tenantId}/invites — invite an address.
|
|
1134
|
+
* Always returns `acceptUrl`; with `sendEmail: false` Authyon does not
|
|
1135
|
+
* mail it and you deliver the link yourself. The link is valid for 7
|
|
1136
|
+
* days, once, and can't be read again later.
|
|
1137
|
+
*/
|
|
1138
|
+
create: (tenantId: string, params: TenantInviteInput) => Promise<TenantInviteIssued>;
|
|
1139
|
+
/**
|
|
1140
|
+
* POST /auth/tenants/{tenantId}/invites/{inviteId}/resend — issue
|
|
1141
|
+
* a new link (the previous one stops working), mailing it unless
|
|
1142
|
+
* `sendEmail` is `false`.
|
|
1143
|
+
*/
|
|
1144
|
+
resend: (tenantId: string, inviteId: string, params?: {
|
|
1145
|
+
sendEmail?: boolean;
|
|
1146
|
+
}) => Promise<TenantInviteIssued>;
|
|
1147
|
+
/** DELETE /auth/tenants/{tenantId}/invites/{inviteId} — revoke a pending invite. */
|
|
1148
|
+
revoke: (tenantId: string, inviteId: string) => Promise<void>;
|
|
1149
|
+
/**
|
|
1150
|
+
* POST /auth/tenant-invites/preview — public. Read the `token` query
|
|
1151
|
+
* parameter of the invite link and pick the form: one click when
|
|
1152
|
+
* `accountExists`, sign-up otherwise.
|
|
1153
|
+
*/
|
|
1154
|
+
preview: (token: string) => Promise<TenantInvitePreview>;
|
|
1155
|
+
/**
|
|
1156
|
+
* POST /auth/tenant-invites/accept — public. Joins the tenant; for
|
|
1157
|
+
* an address with no account, also creates it (password required) with
|
|
1158
|
+
* the e-mail already confirmed. Does not sign the user in.
|
|
1159
|
+
*/
|
|
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>>;
|
|
966
1182
|
/**
|
|
967
|
-
* GET /auth/tenants/subtenants — the same, for the
|
|
968
|
-
* session is scoped to (`
|
|
1183
|
+
* GET /auth/tenants/subtenants — the same, for the tenant the
|
|
1184
|
+
* session is scoped to (`tenants.current()`, the token's
|
|
969
1185
|
* `tenant_id`). Same permission rule; answers `tenant.no_active_tenant`
|
|
970
1186
|
* when the session never switched into one.
|
|
971
1187
|
*/
|
|
972
|
-
listCurrent: (params?:
|
|
1188
|
+
listCurrent: (params?: SubTenantListOptions) => Promise<Paged<SubTenant>>;
|
|
973
1189
|
};
|
|
974
1190
|
roles: {
|
|
975
|
-
/** GET /auth/tenants/{
|
|
976
|
-
list: (
|
|
1191
|
+
/** GET /auth/tenants/{tenantId}/roles — roles available in the tenant. */
|
|
1192
|
+
list: (tenantId: string) => Promise<Role[]>;
|
|
977
1193
|
};
|
|
978
1194
|
};
|
|
979
1195
|
readonly twoFactor: {
|
|
@@ -1167,4 +1383,4 @@ declare function hasPermissionGroup(source: AuthyonPermissionSource | readonly s
|
|
|
1167
1383
|
/** Converts Authyon's `subject:action` permission strings to authorization rules. */
|
|
1168
1384
|
declare function createAuthyonRules(source?: AuthyonPermissionSource, options?: AuthyonAbilityOptions): AbilityRule[];
|
|
1169
1385
|
|
|
1170
|
-
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 };
|