@authyon/server 0.2.0-beta.30 → 0.2.0-beta.32
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 +4 -4
- package/dist/{authorization-DR079xKg.d.cts → authorization-CGex2N6O.d.cts} +1 -1
- package/dist/{authorization-Dkawj1IN.d.ts → authorization-TbK43K94.d.ts} +1 -1
- package/dist/{authyonServerClient-C_iWckru.d.cts → authyonServerClient-DqY5OtxL.d.cts} +86 -16
- package/dist/{authyonServerClient-C_iWckru.d.ts → authyonServerClient-DqY5OtxL.d.ts} +86 -16
- package/dist/bff.cjs +59 -31
- package/dist/bff.d.cts +37 -4
- package/dist/bff.d.ts +37 -4
- package/dist/bff.js +59 -31
- package/dist/index.cjs +55 -2
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +55 -2
- package/dist/next.d.cts +2 -2
- package/dist/next.d.ts +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -40,7 +40,7 @@ O client também aceita `httpLogger: { enabled, logger? }`. A configuração é
|
|
|
40
40
|
## Sessão web no BFF (código ainda não publicado)
|
|
41
41
|
|
|
42
42
|
O novo entrypoint `@authyon/server/bff` oferece login, 2FA, sessão HttpOnly,
|
|
43
|
-
renovação sob demanda, logout e troca de
|
|
43
|
+
renovação sob demanda, logout e troca de tenant. Os tokens ficam no servidor,
|
|
44
44
|
com adaptador Redis cifrado e compare-and-swap para concorrência entre instâncias.
|
|
45
45
|
Reutiliza os endpoints existentes e o cliente de validação server-side.
|
|
46
46
|
|
|
@@ -93,7 +93,7 @@ const authyon = createClient({
|
|
|
93
93
|
|
|
94
94
|
```ts
|
|
95
95
|
const { active, sub } = await authyon.introspect(token); // leve
|
|
96
|
-
const {
|
|
96
|
+
const { valid, user } = await authyon.validate(token); // recomendado — cross-checa revogação
|
|
97
97
|
```
|
|
98
98
|
|
|
99
99
|
Veja [`examples/tokenVerification.ts`](./examples/tokenVerification.ts) para um middleware completo.
|
|
@@ -118,7 +118,7 @@ await authyon.environment.roles.create({ name: "support", permissions: ["tickets
|
|
|
118
118
|
await authyon.environment.audit.list({ take: 50 });
|
|
119
119
|
```
|
|
120
120
|
|
|
121
|
-
Veja [`examples/
|
|
121
|
+
Veja [`examples/tenantMembership.ts`](./examples/tenantMembership.ts) para o fluxo completo, incluindo as rotas de backend que o `@authyon/auth` chamaria.
|
|
122
122
|
|
|
123
123
|
Namespaces disponíveis: `environment.users`, `environment.tenants` (com `.members` e `.roles` aninhados), `environment.roles`, `environment.permissions`, `environment.audit`. OTP e aprovações ficam em `security` (veja abaixo).
|
|
124
124
|
|
|
@@ -493,7 +493,7 @@ Configure `envKey` para `user()`. `members.invite` associa um usuário já
|
|
|
493
493
|
cadastrado no ambiente pelo e-mail; não cria conta e não envia link por e-mail.
|
|
494
494
|
Para isso, use os convites abaixo.
|
|
495
495
|
A API exige associação/permissões do usuário chamador. No browser, os métodos
|
|
496
|
-
existentes `@authyon/auth` → `
|
|
496
|
+
existentes `@authyon/auth` → `tenants.members.invite/remove` continuam
|
|
497
497
|
atendendo esse fluxo. Nunca importe `@authyon/server` no browser.
|
|
498
498
|
|
|
499
499
|
## Convites de tenant (e-mail ou link)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { J as JwksTokenVerifier, A as AuthyonServerClient } from './authyonServerClient-
|
|
1
|
+
import { J as JwksTokenVerifier, A as AuthyonServerClient } from './authyonServerClient-DqY5OtxL.cjs';
|
|
2
2
|
|
|
3
3
|
type AbilitySubject = string | Record<string, unknown>;
|
|
4
4
|
type AbilityConditions = Record<string, unknown>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { J as JwksTokenVerifier, A as AuthyonServerClient } from './authyonServerClient-
|
|
1
|
+
import { J as JwksTokenVerifier, A as AuthyonServerClient } from './authyonServerClient-DqY5OtxL.js';
|
|
2
2
|
|
|
3
3
|
type AbilitySubject = string | Record<string, unknown>;
|
|
4
4
|
type AbilityConditions = Record<string, unknown>;
|
|
@@ -209,11 +209,31 @@ type TenantOrder = TenantOrderField | {
|
|
|
209
209
|
* There is no `status`: only active sub-tenants are listed, since everything
|
|
210
210
|
* below a disabled one is closed to reads from above.
|
|
211
211
|
*/
|
|
212
|
-
interface SubTenantListOptions extends PaginationOptions {
|
|
212
|
+
interface SubTenantListOptions extends PaginationOptions, PermissionFilterOptions {
|
|
213
213
|
search?: string;
|
|
214
214
|
filter?: string[];
|
|
215
215
|
orderBy?: TenantOrder;
|
|
216
216
|
}
|
|
217
|
+
/**
|
|
218
|
+
* Keep only the tenants where the user holds these permissions.
|
|
219
|
+
*
|
|
220
|
+
* - `permission`: up to 10 concrete values (no wildcards). Custom permissions
|
|
221
|
+
* count as well as Authyon's own.
|
|
222
|
+
* - `permissionMatch`: `"all"` (the default) needs every value; `"any"` needs
|
|
223
|
+
* one.
|
|
224
|
+
*
|
|
225
|
+
* On a tenant the user belongs to, it is what that membership grants. On one
|
|
226
|
+
* reached from above, it is what switching into it would grant (the nearest
|
|
227
|
+
* ancestor membership holding `subtenants:tree:switch`) plus the
|
|
228
|
+
* `subtenants:tree:*` values held above — the same rules the routes apply, so
|
|
229
|
+
* the filter never offers an action that would then be refused. A grant of
|
|
230
|
+
* `tenants:**` holds `tenants:members:invite`. Needs the Authyon API of
|
|
231
|
+
* 2026-11-27 or newer; an older one ignores it.
|
|
232
|
+
*/
|
|
233
|
+
interface PermissionFilterOptions {
|
|
234
|
+
permission?: string[];
|
|
235
|
+
permissionMatch?: "all" | "any";
|
|
236
|
+
}
|
|
217
237
|
/** The tenant another one hangs from: enough to name it in a breadcrumb. */
|
|
218
238
|
interface TenantParent {
|
|
219
239
|
id: string;
|
|
@@ -239,6 +259,36 @@ interface SubTenant {
|
|
|
239
259
|
/** The tenant it hangs from — the same on every row of a page, carried so a row stands on its own. */
|
|
240
260
|
parent: TenantParent;
|
|
241
261
|
}
|
|
262
|
+
/**
|
|
263
|
+
* One tenant as the end-user routes return it (`GET /auth/tenants/{id}` and
|
|
264
|
+
* `/auth/tenants/by-slug/{slug}`): the user's own, or one below it read with
|
|
265
|
+
* `subtenants:tree:read` from an ancestor.
|
|
266
|
+
*/
|
|
267
|
+
interface MyTenant {
|
|
268
|
+
id: string;
|
|
269
|
+
slug: string;
|
|
270
|
+
name: string;
|
|
271
|
+
description?: string | null;
|
|
272
|
+
createdAt: string;
|
|
273
|
+
updatedAt?: string | null;
|
|
274
|
+
memberCount: number;
|
|
275
|
+
/** Roles the user holds in it; empty when they reach it from an ancestor. */
|
|
276
|
+
myRoles: string[];
|
|
277
|
+
/**
|
|
278
|
+
* The end-user-route permissions the user can use on it, as concrete values.
|
|
279
|
+
* This, not `myRoles`, is what decides which actions to offer.
|
|
280
|
+
*/
|
|
281
|
+
myPermissions?: string[];
|
|
282
|
+
/** JSON-encoded metadata visible to members. */
|
|
283
|
+
publicMetadata: string;
|
|
284
|
+
isDisabled: boolean;
|
|
285
|
+
/** Distance from the root: `0` at a root tenant. */
|
|
286
|
+
depth: number;
|
|
287
|
+
/** `true` when the user reaches it from an ancestor rather than as a member. */
|
|
288
|
+
inherited: boolean;
|
|
289
|
+
/** The tenant it hangs from, `null` for a root. */
|
|
290
|
+
parent: TenantParent | null;
|
|
291
|
+
}
|
|
242
292
|
|
|
243
293
|
/**
|
|
244
294
|
* Builders for the tenant list's structured filters.
|
|
@@ -278,7 +328,7 @@ declare const tenantFilter: {
|
|
|
278
328
|
};
|
|
279
329
|
|
|
280
330
|
/** GET/POST /env/tenants — confirmed against the live API. */
|
|
281
|
-
interface
|
|
331
|
+
interface Tenant {
|
|
282
332
|
id: string;
|
|
283
333
|
slug: string;
|
|
284
334
|
name?: string;
|
|
@@ -318,7 +368,7 @@ interface Organization {
|
|
|
318
368
|
*/
|
|
319
369
|
ancestors?: TenantAncestor[];
|
|
320
370
|
}
|
|
321
|
-
/** One step of the chain above a tenant, as `
|
|
371
|
+
/** One step of the chain above a tenant, as `Tenant.ancestors` carries it. */
|
|
322
372
|
interface TenantAncestor {
|
|
323
373
|
id: string;
|
|
324
374
|
name: string;
|
|
@@ -496,7 +546,7 @@ interface PermissionsByRole {
|
|
|
496
546
|
roles: RolePermissions[];
|
|
497
547
|
orphans: Permission[];
|
|
498
548
|
/**
|
|
499
|
-
* The permissions Authyon itself checks on the end-user
|
|
549
|
+
* The permissions Authyon itself checks on the end-user tenant routes
|
|
500
550
|
* (`tenants:settings:manage`, `tenants:members:invite`,
|
|
501
551
|
* `tenants:members:remove` and `subtenants:tree:*`), listed whether or not
|
|
502
552
|
* a role names them. Absent from an API older than 2026-11-25.
|
|
@@ -522,7 +572,7 @@ interface CreatePermissionInput {
|
|
|
522
572
|
/** Attach the new permission to this role immediately. */
|
|
523
573
|
attachToRoleId?: string;
|
|
524
574
|
}
|
|
525
|
-
interface
|
|
575
|
+
interface CreateTenantInput {
|
|
526
576
|
name: string;
|
|
527
577
|
slug: string;
|
|
528
578
|
description?: string;
|
|
@@ -541,7 +591,7 @@ interface CreateOrganizationInput {
|
|
|
541
591
|
*/
|
|
542
592
|
parentTenantId?: string;
|
|
543
593
|
}
|
|
544
|
-
interface
|
|
594
|
+
interface UpdateTenantInput {
|
|
545
595
|
name: string;
|
|
546
596
|
description?: string;
|
|
547
597
|
customFields?: Record<string, unknown>;
|
|
@@ -561,7 +611,7 @@ interface CreateUserInput {
|
|
|
561
611
|
customFields?: Record<string, unknown>;
|
|
562
612
|
emailConfirmed?: boolean;
|
|
563
613
|
roles?: string[];
|
|
564
|
-
/** Tenants
|
|
614
|
+
/** Tenants to add the user to on creation. */
|
|
565
615
|
tenantIds?: string[];
|
|
566
616
|
}
|
|
567
617
|
/** GET /env/audit — one audit-trail entry, confirmed against the live API. */
|
|
@@ -703,6 +753,13 @@ interface AuthyonServerClientOptions {
|
|
|
703
753
|
fetch?: typeof fetch;
|
|
704
754
|
}
|
|
705
755
|
|
|
756
|
+
/** @deprecated Use `Tenant`. */
|
|
757
|
+
type Organization = Tenant;
|
|
758
|
+
/** @deprecated Use `CreateTenantInput`. */
|
|
759
|
+
type CreateOrganizationInput = CreateTenantInput;
|
|
760
|
+
/** @deprecated Use `UpdateTenantInput`. */
|
|
761
|
+
type UpdateOrganizationInput = UpdateTenantInput;
|
|
762
|
+
|
|
706
763
|
/** A token of the requested authentication plane, or a provider called for each request. */
|
|
707
764
|
type AccessTokenSource = string | (() => string | Promise<string>);
|
|
708
765
|
interface CredentialListOptions extends PaginationOptions {
|
|
@@ -956,6 +1013,19 @@ declare class UserScopedClient {
|
|
|
956
1013
|
*/
|
|
957
1014
|
readonly security: SubjectSecurity;
|
|
958
1015
|
readonly tenants: {
|
|
1016
|
+
/**
|
|
1017
|
+
* GET /auth/tenants/{tenantId} — one tenant, acting as the user: their own,
|
|
1018
|
+
* or one below it with `subtenants:tree:read` on an ancestor.
|
|
1019
|
+
*/
|
|
1020
|
+
get: (tenantId: string) => Promise<MyTenant>;
|
|
1021
|
+
/**
|
|
1022
|
+
* One tenant by id **or** slug: a UUID goes to `GET /auth/tenants/{id}`,
|
|
1023
|
+
* anything else to `GET /auth/tenants/by-slug/{slug}`. Same rule and answer
|
|
1024
|
+
* as `get`; by slug every refusal is `tenant.not_found`. An empty value
|
|
1025
|
+
* raises `RangeError` before any request. The slug route needs the Authyon
|
|
1026
|
+
* API of 2026-11-26 or newer.
|
|
1027
|
+
*/
|
|
1028
|
+
find: (idOrSlug: string) => Promise<MyTenant>;
|
|
959
1029
|
/**
|
|
960
1030
|
* The direct, active sub-tenants of a tenant, acting as the user. One level
|
|
961
1031
|
* per call: each row's `childCount` says where the next call is worth
|
|
@@ -1327,7 +1397,7 @@ declare class AuthyonServerClient {
|
|
|
1327
1397
|
* 2026-10-22 ignores `filter` and one older than 2026-10-31 ignores
|
|
1328
1398
|
* `parentId`, which read as a page that is too wide rather than an error.
|
|
1329
1399
|
*/
|
|
1330
|
-
list: (params?: TenantListOptions) => Promise<Paged<
|
|
1400
|
+
list: (params?: TenantListOptions) => Promise<Paged<Tenant>>;
|
|
1331
1401
|
/**
|
|
1332
1402
|
* One page of a tenant's direct sub-tenants — `list()` with `parentId`.
|
|
1333
1403
|
*
|
|
@@ -1335,7 +1405,7 @@ declare class AuthyonServerClient {
|
|
|
1335
1405
|
* view asks again where that is above zero instead of reading the whole
|
|
1336
1406
|
* subtree to draw the first level of it.
|
|
1337
1407
|
*/
|
|
1338
|
-
children: (parentTenantId: string, params?: Omit<TenantListOptions, "parentId">) => Promise<Paged<
|
|
1408
|
+
children: (parentTenantId: string, params?: Omit<TenantListOptions, "parentId">) => Promise<Paged<Tenant>>;
|
|
1339
1409
|
/**
|
|
1340
1410
|
* One page of the environment's root tenants — `list()` with no parent.
|
|
1341
1411
|
*
|
|
@@ -1344,7 +1414,7 @@ declare class AuthyonServerClient {
|
|
|
1344
1414
|
* depth, which is what a flat picker wants and what a tree view must not
|
|
1345
1415
|
* start from.
|
|
1346
1416
|
*/
|
|
1347
|
-
roots: (params?: Omit<TenantListOptions, "parentId">) => Promise<Paged<
|
|
1417
|
+
roots: (params?: Omit<TenantListOptions, "parentId">) => Promise<Paged<Tenant>>;
|
|
1348
1418
|
/**
|
|
1349
1419
|
* Every sub-tenant in the environment, at any depth and under any
|
|
1350
1420
|
* parent — `list()` with `minDepth: 1`. This is the one page
|
|
@@ -1356,7 +1426,7 @@ declare class AuthyonServerClient {
|
|
|
1356
1426
|
* Against an Authyon API older than 2026-10-31 the floor is ignored and
|
|
1357
1427
|
* the roots come back too.
|
|
1358
1428
|
*/
|
|
1359
|
-
subTenants: (params?: Omit<TenantListOptions, "parentId" | "minDepth">) => Promise<Paged<
|
|
1429
|
+
subTenants: (params?: Omit<TenantListOptions, "parentId" | "minDepth">) => Promise<Paged<Tenant>>;
|
|
1360
1430
|
/**
|
|
1361
1431
|
* POST /env/tenants — create a tenant in the environment.
|
|
1362
1432
|
*
|
|
@@ -1365,18 +1435,18 @@ declare class AuthyonServerClient {
|
|
|
1365
1435
|
* so this answers `tenant.depth.not_allowed` until an operator raises it
|
|
1366
1436
|
* in the console.
|
|
1367
1437
|
*/
|
|
1368
|
-
create: (input:
|
|
1438
|
+
create: (input: CreateTenantInput) => Promise<Tenant>;
|
|
1369
1439
|
/**
|
|
1370
1440
|
* GET /env/tenants/{tenantId} — fetch a tenant by id.
|
|
1371
1441
|
*
|
|
1372
1442
|
* Returns `ancestors` as well, the chain above it root first, so a
|
|
1373
1443
|
* breadcrumb costs this one call rather than one per level.
|
|
1374
1444
|
*/
|
|
1375
|
-
get: (tenantId: string) => Promise<
|
|
1445
|
+
get: (tenantId: string) => Promise<Tenant>;
|
|
1376
1446
|
/** PUT /env/tenants/{tenantId} — update a tenant. */
|
|
1377
|
-
update: (tenantId: string, input:
|
|
1447
|
+
update: (tenantId: string, input: UpdateTenantInput) => Promise<Tenant>;
|
|
1378
1448
|
/** PUT /env/tenants/{tenantId}/metadata - replace public and private metadata. */
|
|
1379
|
-
updateMetadata: (tenantId: string, input: Pick<
|
|
1449
|
+
updateMetadata: (tenantId: string, input: Pick<CreateTenantInput, "publicMetadata" | "privateMetadata">) => Promise<void>;
|
|
1380
1450
|
/**
|
|
1381
1451
|
* POST /env/tenants/{tenantId}/disable — disable without removing tenant
|
|
1382
1452
|
* data.
|
|
@@ -1656,4 +1726,4 @@ declare class TenantScopedClient {
|
|
|
1656
1726
|
/** Convenience factory: `const authyon = createClient({ clientId, clientSecret })`. */
|
|
1657
1727
|
declare function createClient(options?: AuthyonServerClientOptions): AuthyonServerClient;
|
|
1658
1728
|
|
|
1659
|
-
export { type
|
|
1729
|
+
export { type PasswordResetIssued as $, AuthyonServerClient as A, type BuiltInPermission as B, CLIENT_IP_HEADER as C, type CredentialListOptions as D, type CredentialPermissionsInput as E, type EnvironmentUser as F, FetchHttpAdapter as G, type HttpAdapter as H, type HttpAdapterRequest as I, JwksTokenVerifier as J, type HttpLogEvent as K, type HttpLogger as L, type IntrospectResult as M, type InviteTenantMemberInput as N, type IssuePasswordResetInput as O, type JsonWebKeySet as P, type JwksTokenVerifierOptions as Q, LoggingHttpAdapter as R, type LoginActivity as S, type MemberListOptions as T, type MyTenant as U, type OpenIdConfiguration as V, type Organization as W, type OtpCheckResult as X, type Paged as Y, type PaginationOptions as Z, type PasswordResetCompleted as _, type HttpLoggerOptions as a, type PasswordResetPreview as a0, type Permission as a1, type PermissionFilterOptions as a2, type PermissionsByRole as a3, type ReservedPermissions as a4, type Role as a5, type RoleGrant as a6, type RoleInput as a7, type RoleList as a8, type RolePermissions as a9, type TenantMembership as aA, type TenantOrder as aB, type TenantOrderField as aC, type TenantParent as aD, TenantScopedClient as aE, type TokenResult as aF, TokenVerificationError as aG, type TokenVerificationErrorCode as aH, type UpdateOrganizationInput as aI, type UpdateTenantInput as aJ, type User as aK, UserScopedClient as aL, type ValidateResult as aM, type VerifiedAccessToken as aN, createClient as aO, normalizeClientIp as aP, tenantFilter as aQ, type SafeJwtAlgorithm as aa, type SecurityMethods as ab, type SubTenant as ac, type SubTenantListOptions as ad, type SubjectApprovals as ae, type SubjectSecurity as af, TENANT_FILTER_MAX_DEPTH as ag, TENANT_FILTER_MAX_VALUES as ah, TENANT_FILTER_MAX_VALUE_LENGTH as ai, type Tenant as aj, type TenantAncestor as ak, type TenantClientValidationResult as al, type TenantCredentialIssued as am, type TenantCredentialSummary as an, type TenantFilterExpression as ao, type TenantFilterValue as ap, type TenantInvite as aq, type TenantInviteAccepted as ar, type TenantInviteInput as as, type TenantInviteIssued as at, type TenantInviteListOptions as au, type TenantInvitePreview as av, type TenantInviteStatus as aw, type TenantListOptions as ax, type TenantMember as ay, type TenantMemberPage as az, type AcceptTenantInviteInput as b, type AccessTokenSource as c, type Approval as d, type ApprovalAssurance as e, type ApprovalPayload as f, type ApprovalStatus as g, type ApprovalWebAuthnOptions as h, type AuditEvent as i, type AuthyonJwksDiscoveryOptions as j, type AuthyonJwtClaims as k, type AuthyonServerClientOptions as l, type AuthyonTenantClaim as m, type ClientCredentials as n, type ClientRequestContext as o, type ConfirmApprovalInput as p, type ConsumedApproval as q, type CreateApprovalInput as r, type CreateCredentialInput as s, type CreateOrganizationInput as t, type CreatePermissionInput as u, type CreateTenantCredentialInput as v, type CreateTenantInput as w, type CreateUserInput as x, type CredentialCreator as y, type CredentialDetail as z };
|
|
@@ -209,11 +209,31 @@ type TenantOrder = TenantOrderField | {
|
|
|
209
209
|
* There is no `status`: only active sub-tenants are listed, since everything
|
|
210
210
|
* below a disabled one is closed to reads from above.
|
|
211
211
|
*/
|
|
212
|
-
interface SubTenantListOptions extends PaginationOptions {
|
|
212
|
+
interface SubTenantListOptions extends PaginationOptions, PermissionFilterOptions {
|
|
213
213
|
search?: string;
|
|
214
214
|
filter?: string[];
|
|
215
215
|
orderBy?: TenantOrder;
|
|
216
216
|
}
|
|
217
|
+
/**
|
|
218
|
+
* Keep only the tenants where the user holds these permissions.
|
|
219
|
+
*
|
|
220
|
+
* - `permission`: up to 10 concrete values (no wildcards). Custom permissions
|
|
221
|
+
* count as well as Authyon's own.
|
|
222
|
+
* - `permissionMatch`: `"all"` (the default) needs every value; `"any"` needs
|
|
223
|
+
* one.
|
|
224
|
+
*
|
|
225
|
+
* On a tenant the user belongs to, it is what that membership grants. On one
|
|
226
|
+
* reached from above, it is what switching into it would grant (the nearest
|
|
227
|
+
* ancestor membership holding `subtenants:tree:switch`) plus the
|
|
228
|
+
* `subtenants:tree:*` values held above — the same rules the routes apply, so
|
|
229
|
+
* the filter never offers an action that would then be refused. A grant of
|
|
230
|
+
* `tenants:**` holds `tenants:members:invite`. Needs the Authyon API of
|
|
231
|
+
* 2026-11-27 or newer; an older one ignores it.
|
|
232
|
+
*/
|
|
233
|
+
interface PermissionFilterOptions {
|
|
234
|
+
permission?: string[];
|
|
235
|
+
permissionMatch?: "all" | "any";
|
|
236
|
+
}
|
|
217
237
|
/** The tenant another one hangs from: enough to name it in a breadcrumb. */
|
|
218
238
|
interface TenantParent {
|
|
219
239
|
id: string;
|
|
@@ -239,6 +259,36 @@ interface SubTenant {
|
|
|
239
259
|
/** The tenant it hangs from — the same on every row of a page, carried so a row stands on its own. */
|
|
240
260
|
parent: TenantParent;
|
|
241
261
|
}
|
|
262
|
+
/**
|
|
263
|
+
* One tenant as the end-user routes return it (`GET /auth/tenants/{id}` and
|
|
264
|
+
* `/auth/tenants/by-slug/{slug}`): the user's own, or one below it read with
|
|
265
|
+
* `subtenants:tree:read` from an ancestor.
|
|
266
|
+
*/
|
|
267
|
+
interface MyTenant {
|
|
268
|
+
id: string;
|
|
269
|
+
slug: string;
|
|
270
|
+
name: string;
|
|
271
|
+
description?: string | null;
|
|
272
|
+
createdAt: string;
|
|
273
|
+
updatedAt?: string | null;
|
|
274
|
+
memberCount: number;
|
|
275
|
+
/** Roles the user holds in it; empty when they reach it from an ancestor. */
|
|
276
|
+
myRoles: string[];
|
|
277
|
+
/**
|
|
278
|
+
* The end-user-route permissions the user can use on it, as concrete values.
|
|
279
|
+
* This, not `myRoles`, is what decides which actions to offer.
|
|
280
|
+
*/
|
|
281
|
+
myPermissions?: string[];
|
|
282
|
+
/** JSON-encoded metadata visible to members. */
|
|
283
|
+
publicMetadata: string;
|
|
284
|
+
isDisabled: boolean;
|
|
285
|
+
/** Distance from the root: `0` at a root tenant. */
|
|
286
|
+
depth: number;
|
|
287
|
+
/** `true` when the user reaches it from an ancestor rather than as a member. */
|
|
288
|
+
inherited: boolean;
|
|
289
|
+
/** The tenant it hangs from, `null` for a root. */
|
|
290
|
+
parent: TenantParent | null;
|
|
291
|
+
}
|
|
242
292
|
|
|
243
293
|
/**
|
|
244
294
|
* Builders for the tenant list's structured filters.
|
|
@@ -278,7 +328,7 @@ declare const tenantFilter: {
|
|
|
278
328
|
};
|
|
279
329
|
|
|
280
330
|
/** GET/POST /env/tenants — confirmed against the live API. */
|
|
281
|
-
interface
|
|
331
|
+
interface Tenant {
|
|
282
332
|
id: string;
|
|
283
333
|
slug: string;
|
|
284
334
|
name?: string;
|
|
@@ -318,7 +368,7 @@ interface Organization {
|
|
|
318
368
|
*/
|
|
319
369
|
ancestors?: TenantAncestor[];
|
|
320
370
|
}
|
|
321
|
-
/** One step of the chain above a tenant, as `
|
|
371
|
+
/** One step of the chain above a tenant, as `Tenant.ancestors` carries it. */
|
|
322
372
|
interface TenantAncestor {
|
|
323
373
|
id: string;
|
|
324
374
|
name: string;
|
|
@@ -496,7 +546,7 @@ interface PermissionsByRole {
|
|
|
496
546
|
roles: RolePermissions[];
|
|
497
547
|
orphans: Permission[];
|
|
498
548
|
/**
|
|
499
|
-
* The permissions Authyon itself checks on the end-user
|
|
549
|
+
* The permissions Authyon itself checks on the end-user tenant routes
|
|
500
550
|
* (`tenants:settings:manage`, `tenants:members:invite`,
|
|
501
551
|
* `tenants:members:remove` and `subtenants:tree:*`), listed whether or not
|
|
502
552
|
* a role names them. Absent from an API older than 2026-11-25.
|
|
@@ -522,7 +572,7 @@ interface CreatePermissionInput {
|
|
|
522
572
|
/** Attach the new permission to this role immediately. */
|
|
523
573
|
attachToRoleId?: string;
|
|
524
574
|
}
|
|
525
|
-
interface
|
|
575
|
+
interface CreateTenantInput {
|
|
526
576
|
name: string;
|
|
527
577
|
slug: string;
|
|
528
578
|
description?: string;
|
|
@@ -541,7 +591,7 @@ interface CreateOrganizationInput {
|
|
|
541
591
|
*/
|
|
542
592
|
parentTenantId?: string;
|
|
543
593
|
}
|
|
544
|
-
interface
|
|
594
|
+
interface UpdateTenantInput {
|
|
545
595
|
name: string;
|
|
546
596
|
description?: string;
|
|
547
597
|
customFields?: Record<string, unknown>;
|
|
@@ -561,7 +611,7 @@ interface CreateUserInput {
|
|
|
561
611
|
customFields?: Record<string, unknown>;
|
|
562
612
|
emailConfirmed?: boolean;
|
|
563
613
|
roles?: string[];
|
|
564
|
-
/** Tenants
|
|
614
|
+
/** Tenants to add the user to on creation. */
|
|
565
615
|
tenantIds?: string[];
|
|
566
616
|
}
|
|
567
617
|
/** GET /env/audit — one audit-trail entry, confirmed against the live API. */
|
|
@@ -703,6 +753,13 @@ interface AuthyonServerClientOptions {
|
|
|
703
753
|
fetch?: typeof fetch;
|
|
704
754
|
}
|
|
705
755
|
|
|
756
|
+
/** @deprecated Use `Tenant`. */
|
|
757
|
+
type Organization = Tenant;
|
|
758
|
+
/** @deprecated Use `CreateTenantInput`. */
|
|
759
|
+
type CreateOrganizationInput = CreateTenantInput;
|
|
760
|
+
/** @deprecated Use `UpdateTenantInput`. */
|
|
761
|
+
type UpdateOrganizationInput = UpdateTenantInput;
|
|
762
|
+
|
|
706
763
|
/** A token of the requested authentication plane, or a provider called for each request. */
|
|
707
764
|
type AccessTokenSource = string | (() => string | Promise<string>);
|
|
708
765
|
interface CredentialListOptions extends PaginationOptions {
|
|
@@ -956,6 +1013,19 @@ declare class UserScopedClient {
|
|
|
956
1013
|
*/
|
|
957
1014
|
readonly security: SubjectSecurity;
|
|
958
1015
|
readonly tenants: {
|
|
1016
|
+
/**
|
|
1017
|
+
* GET /auth/tenants/{tenantId} — one tenant, acting as the user: their own,
|
|
1018
|
+
* or one below it with `subtenants:tree:read` on an ancestor.
|
|
1019
|
+
*/
|
|
1020
|
+
get: (tenantId: string) => Promise<MyTenant>;
|
|
1021
|
+
/**
|
|
1022
|
+
* One tenant by id **or** slug: a UUID goes to `GET /auth/tenants/{id}`,
|
|
1023
|
+
* anything else to `GET /auth/tenants/by-slug/{slug}`. Same rule and answer
|
|
1024
|
+
* as `get`; by slug every refusal is `tenant.not_found`. An empty value
|
|
1025
|
+
* raises `RangeError` before any request. The slug route needs the Authyon
|
|
1026
|
+
* API of 2026-11-26 or newer.
|
|
1027
|
+
*/
|
|
1028
|
+
find: (idOrSlug: string) => Promise<MyTenant>;
|
|
959
1029
|
/**
|
|
960
1030
|
* The direct, active sub-tenants of a tenant, acting as the user. One level
|
|
961
1031
|
* per call: each row's `childCount` says where the next call is worth
|
|
@@ -1327,7 +1397,7 @@ declare class AuthyonServerClient {
|
|
|
1327
1397
|
* 2026-10-22 ignores `filter` and one older than 2026-10-31 ignores
|
|
1328
1398
|
* `parentId`, which read as a page that is too wide rather than an error.
|
|
1329
1399
|
*/
|
|
1330
|
-
list: (params?: TenantListOptions) => Promise<Paged<
|
|
1400
|
+
list: (params?: TenantListOptions) => Promise<Paged<Tenant>>;
|
|
1331
1401
|
/**
|
|
1332
1402
|
* One page of a tenant's direct sub-tenants — `list()` with `parentId`.
|
|
1333
1403
|
*
|
|
@@ -1335,7 +1405,7 @@ declare class AuthyonServerClient {
|
|
|
1335
1405
|
* view asks again where that is above zero instead of reading the whole
|
|
1336
1406
|
* subtree to draw the first level of it.
|
|
1337
1407
|
*/
|
|
1338
|
-
children: (parentTenantId: string, params?: Omit<TenantListOptions, "parentId">) => Promise<Paged<
|
|
1408
|
+
children: (parentTenantId: string, params?: Omit<TenantListOptions, "parentId">) => Promise<Paged<Tenant>>;
|
|
1339
1409
|
/**
|
|
1340
1410
|
* One page of the environment's root tenants — `list()` with no parent.
|
|
1341
1411
|
*
|
|
@@ -1344,7 +1414,7 @@ declare class AuthyonServerClient {
|
|
|
1344
1414
|
* depth, which is what a flat picker wants and what a tree view must not
|
|
1345
1415
|
* start from.
|
|
1346
1416
|
*/
|
|
1347
|
-
roots: (params?: Omit<TenantListOptions, "parentId">) => Promise<Paged<
|
|
1417
|
+
roots: (params?: Omit<TenantListOptions, "parentId">) => Promise<Paged<Tenant>>;
|
|
1348
1418
|
/**
|
|
1349
1419
|
* Every sub-tenant in the environment, at any depth and under any
|
|
1350
1420
|
* parent — `list()` with `minDepth: 1`. This is the one page
|
|
@@ -1356,7 +1426,7 @@ declare class AuthyonServerClient {
|
|
|
1356
1426
|
* Against an Authyon API older than 2026-10-31 the floor is ignored and
|
|
1357
1427
|
* the roots come back too.
|
|
1358
1428
|
*/
|
|
1359
|
-
subTenants: (params?: Omit<TenantListOptions, "parentId" | "minDepth">) => Promise<Paged<
|
|
1429
|
+
subTenants: (params?: Omit<TenantListOptions, "parentId" | "minDepth">) => Promise<Paged<Tenant>>;
|
|
1360
1430
|
/**
|
|
1361
1431
|
* POST /env/tenants — create a tenant in the environment.
|
|
1362
1432
|
*
|
|
@@ -1365,18 +1435,18 @@ declare class AuthyonServerClient {
|
|
|
1365
1435
|
* so this answers `tenant.depth.not_allowed` until an operator raises it
|
|
1366
1436
|
* in the console.
|
|
1367
1437
|
*/
|
|
1368
|
-
create: (input:
|
|
1438
|
+
create: (input: CreateTenantInput) => Promise<Tenant>;
|
|
1369
1439
|
/**
|
|
1370
1440
|
* GET /env/tenants/{tenantId} — fetch a tenant by id.
|
|
1371
1441
|
*
|
|
1372
1442
|
* Returns `ancestors` as well, the chain above it root first, so a
|
|
1373
1443
|
* breadcrumb costs this one call rather than one per level.
|
|
1374
1444
|
*/
|
|
1375
|
-
get: (tenantId: string) => Promise<
|
|
1445
|
+
get: (tenantId: string) => Promise<Tenant>;
|
|
1376
1446
|
/** PUT /env/tenants/{tenantId} — update a tenant. */
|
|
1377
|
-
update: (tenantId: string, input:
|
|
1447
|
+
update: (tenantId: string, input: UpdateTenantInput) => Promise<Tenant>;
|
|
1378
1448
|
/** PUT /env/tenants/{tenantId}/metadata - replace public and private metadata. */
|
|
1379
|
-
updateMetadata: (tenantId: string, input: Pick<
|
|
1449
|
+
updateMetadata: (tenantId: string, input: Pick<CreateTenantInput, "publicMetadata" | "privateMetadata">) => Promise<void>;
|
|
1380
1450
|
/**
|
|
1381
1451
|
* POST /env/tenants/{tenantId}/disable — disable without removing tenant
|
|
1382
1452
|
* data.
|
|
@@ -1656,4 +1726,4 @@ declare class TenantScopedClient {
|
|
|
1656
1726
|
/** Convenience factory: `const authyon = createClient({ clientId, clientSecret })`. */
|
|
1657
1727
|
declare function createClient(options?: AuthyonServerClientOptions): AuthyonServerClient;
|
|
1658
1728
|
|
|
1659
|
-
export { type
|
|
1729
|
+
export { type PasswordResetIssued as $, AuthyonServerClient as A, type BuiltInPermission as B, CLIENT_IP_HEADER as C, type CredentialListOptions as D, type CredentialPermissionsInput as E, type EnvironmentUser as F, FetchHttpAdapter as G, type HttpAdapter as H, type HttpAdapterRequest as I, JwksTokenVerifier as J, type HttpLogEvent as K, type HttpLogger as L, type IntrospectResult as M, type InviteTenantMemberInput as N, type IssuePasswordResetInput as O, type JsonWebKeySet as P, type JwksTokenVerifierOptions as Q, LoggingHttpAdapter as R, type LoginActivity as S, type MemberListOptions as T, type MyTenant as U, type OpenIdConfiguration as V, type Organization as W, type OtpCheckResult as X, type Paged as Y, type PaginationOptions as Z, type PasswordResetCompleted as _, type HttpLoggerOptions as a, type PasswordResetPreview as a0, type Permission as a1, type PermissionFilterOptions as a2, type PermissionsByRole as a3, type ReservedPermissions as a4, type Role as a5, type RoleGrant as a6, type RoleInput as a7, type RoleList as a8, type RolePermissions as a9, type TenantMembership as aA, type TenantOrder as aB, type TenantOrderField as aC, type TenantParent as aD, TenantScopedClient as aE, type TokenResult as aF, TokenVerificationError as aG, type TokenVerificationErrorCode as aH, type UpdateOrganizationInput as aI, type UpdateTenantInput as aJ, type User as aK, UserScopedClient as aL, type ValidateResult as aM, type VerifiedAccessToken as aN, createClient as aO, normalizeClientIp as aP, tenantFilter as aQ, type SafeJwtAlgorithm as aa, type SecurityMethods as ab, type SubTenant as ac, type SubTenantListOptions as ad, type SubjectApprovals as ae, type SubjectSecurity as af, TENANT_FILTER_MAX_DEPTH as ag, TENANT_FILTER_MAX_VALUES as ah, TENANT_FILTER_MAX_VALUE_LENGTH as ai, type Tenant as aj, type TenantAncestor as ak, type TenantClientValidationResult as al, type TenantCredentialIssued as am, type TenantCredentialSummary as an, type TenantFilterExpression as ao, type TenantFilterValue as ap, type TenantInvite as aq, type TenantInviteAccepted as ar, type TenantInviteInput as as, type TenantInviteIssued as at, type TenantInviteListOptions as au, type TenantInvitePreview as av, type TenantInviteStatus as aw, type TenantListOptions as ax, type TenantMember as ay, type TenantMemberPage as az, type AcceptTenantInviteInput as b, type AccessTokenSource as c, type Approval as d, type ApprovalAssurance as e, type ApprovalPayload as f, type ApprovalStatus as g, type ApprovalWebAuthnOptions as h, type AuditEvent as i, type AuthyonJwksDiscoveryOptions as j, type AuthyonJwtClaims as k, type AuthyonServerClientOptions as l, type AuthyonTenantClaim as m, type ClientCredentials as n, type ClientRequestContext as o, type ConfirmApprovalInput as p, type ConsumedApproval as q, type CreateApprovalInput as r, type CreateCredentialInput as s, type CreateOrganizationInput as t, type CreatePermissionInput as u, type CreateTenantCredentialInput as v, type CreateTenantInput as w, type CreateUserInput as x, type CredentialCreator as y, type CredentialDetail as z };
|