@authyon/server 0.2.0-beta.23 → 0.2.0-beta.25
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 +10 -0
- package/dist/{authorization-BLENxur8.d.cts → authorization-BLVSHGQu.d.cts} +1 -1
- package/dist/{authorization-Clf0Jx-U.d.ts → authorization-DPymgDb8.d.ts} +1 -1
- package/dist/{authyonServerClient-CW46xIRD.d.cts → authyonServerClient-6ezHxvwa.d.cts} +75 -1
- package/dist/{authyonServerClient-CW46xIRD.d.ts → authyonServerClient-6ezHxvwa.d.ts} +75 -1
- package/dist/bff.d.cts +1 -1
- package/dist/bff.d.ts +1 -1
- package/dist/index.cjs +76 -4
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +76 -4
- package/dist/next.d.cts +2 -2
- package/dist/next.d.ts +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -294,6 +294,10 @@ const page = await authyon.environment.tenants.credentials.listPage(tenantId, {
|
|
|
294
294
|
skip: 0,
|
|
295
295
|
take: 25,
|
|
296
296
|
});
|
|
297
|
+
// Só as credenciais que concedem TODAS estas permissões (curingas contam).
|
|
298
|
+
const readers = await authyon.environment.tenants.credentials.listPage(tenantId, {
|
|
299
|
+
permissions: ["authyon:users:read", "authyon:tenants:read"],
|
|
300
|
+
});
|
|
297
301
|
const detail = await authyon.environment.tenants.credentials.get(tenantId, credentialId);
|
|
298
302
|
```
|
|
299
303
|
|
|
@@ -303,6 +307,12 @@ limite por página), `total`, `pages`, `hasNext` e `hasPrev`. Até a API de
|
|
|
303
307
|
(limite), nessa ordem trocada. `take` aceita 1–100 (padrão da API: 25),
|
|
304
308
|
`skip` é um deslocamento a partir de zero e `search` aceita até 200 caracteres.
|
|
305
309
|
A API pesquisa clientId, descrição e permissões antes de paginar.
|
|
310
|
+
`permissions` é outro filtro: em vez de procurar texto, mantém só as credenciais
|
|
311
|
+
que **concedem** todas as permissões da lista, respeitando curingas — uma
|
|
312
|
+
credencial com `authyon:*:*` passa em qualquer filtro. Aceita até 20 entradas
|
|
313
|
+
no formato `namespace:resource:action` (até 5 segmentos), normalizadas e sem
|
|
314
|
+
repetição; combina com `search`. Exige uma API de 2026-11-08 ou mais nova; uma
|
|
315
|
+
anterior ignora o filtro.
|
|
306
316
|
|
|
307
317
|
O método existente `credentials.list(tenantId)` continua retornando um array:
|
|
308
318
|
aceita a resposta antiga e percorre todas as páginas da API atual. Prefira
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { J as JwksTokenVerifier, A as AuthyonServerClient } from './authyonServerClient-
|
|
1
|
+
import { J as JwksTokenVerifier, A as AuthyonServerClient } from './authyonServerClient-6ezHxvwa.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-6ezHxvwa.js';
|
|
2
2
|
|
|
3
3
|
type AbilitySubject = string | Record<string, unknown>;
|
|
4
4
|
type AbilityConditions = Record<string, unknown>;
|
|
@@ -262,6 +262,8 @@ interface TenantAncestor {
|
|
|
262
262
|
* documents); `filter` is the structured half, ANDed, one entry per condition
|
|
263
263
|
* — see `tenantFilter` for the builders and the wire format.
|
|
264
264
|
*/
|
|
265
|
+
/** What `environment.tenants.list()` can order by. */
|
|
266
|
+
type TenantOrderField = "name" | "createdAt" | "updatedAt";
|
|
265
267
|
interface TenantListOptions extends PaginationOptions {
|
|
266
268
|
search?: string;
|
|
267
269
|
filter?: TenantFilterExpression[];
|
|
@@ -275,6 +277,34 @@ interface TenantListOptions extends PaginationOptions {
|
|
|
275
277
|
* on describing what you asked for.
|
|
276
278
|
*/
|
|
277
279
|
parentId?: string | null;
|
|
280
|
+
/**
|
|
281
|
+
* Inclusive floor on how deep a tenant sits, roots being 0. `1` is every
|
|
282
|
+
* sub-tenant in the environment, at any depth and under any parent — which
|
|
283
|
+
* `parentId` cannot ask for, since it names one parent. `subTenants()` is
|
|
284
|
+
* this option set for you. Capped at 4, the API's hard ceiling.
|
|
285
|
+
*/
|
|
286
|
+
minDepth?: number;
|
|
287
|
+
/**
|
|
288
|
+
* Inclusive ceiling. Equal bounds pin one generation (`minDepth: 1,
|
|
289
|
+
* maxDepth: 1` is the first generation across the whole environment). A
|
|
290
|
+
* floor deeper than the ceiling, or a bound outside 0..4, is a 400 rather
|
|
291
|
+
* than an empty page.
|
|
292
|
+
*/
|
|
293
|
+
maxDepth?: number;
|
|
294
|
+
/** Keeps one side of the status. Omitted lists both. */
|
|
295
|
+
status?: "active" | "disabled";
|
|
296
|
+
/**
|
|
297
|
+
* Server-side order: a field, as a bare name (ascending) or with a
|
|
298
|
+
* direction. The default is the name, ascending. Ties always break on the
|
|
299
|
+
* id, so a row cannot move across a page boundary between two calls.
|
|
300
|
+
*
|
|
301
|
+
* Against an Authyon API older than 2026-11-03 both `status` and `orderBy`
|
|
302
|
+
* are ignored, which reads as a page that is too wide rather than an error.
|
|
303
|
+
*/
|
|
304
|
+
orderBy?: TenantOrderField | {
|
|
305
|
+
field: TenantOrderField;
|
|
306
|
+
direction?: "asc" | "desc";
|
|
307
|
+
};
|
|
278
308
|
}
|
|
279
309
|
/** One of a user's tenant memberships, as embedded in `EnvironmentUser.tenantMemberships`. */
|
|
280
310
|
interface TenantMembership {
|
|
@@ -600,6 +630,13 @@ interface AuthyonServerClientOptions {
|
|
|
600
630
|
type AccessTokenSource = string | (() => string | Promise<string>);
|
|
601
631
|
interface CredentialListOptions extends PaginationOptions {
|
|
602
632
|
search?: string;
|
|
633
|
+
/**
|
|
634
|
+
* Keep only credentials that grant EVERY one of these permissions. Matching is
|
|
635
|
+
* wildcard-aware on the server: a credential holding `authyon:*:*` passes any
|
|
636
|
+
* filter. Up to 20 entries; requires an API of 2026-11-08 or newer, and an
|
|
637
|
+
* older one ignores it.
|
|
638
|
+
*/
|
|
639
|
+
permissions?: readonly string[];
|
|
603
640
|
}
|
|
604
641
|
/** scopes is an alias for permissions. Always supply an explicit, nonempty set. */
|
|
605
642
|
type CredentialPermissionsInput = {
|
|
@@ -1189,6 +1226,18 @@ declare class AuthyonServerClient {
|
|
|
1189
1226
|
* start from.
|
|
1190
1227
|
*/
|
|
1191
1228
|
roots: (params?: Omit<TenantListOptions, "parentId">) => Promise<Paged<Organization>>;
|
|
1229
|
+
/**
|
|
1230
|
+
* Every sub-tenant in the environment, at any depth and under any
|
|
1231
|
+
* parent — `list()` with `minDepth: 1`. This is the one page
|
|
1232
|
+
* `children()` cannot produce, since it names a single parent, and the
|
|
1233
|
+
* one a flat "all sub-companies" screen wants: the envelope describes
|
|
1234
|
+
* the sub-tenants alone, so the pager stops where they do, and nobody
|
|
1235
|
+
* has to read the whole environment and drop the roots.
|
|
1236
|
+
*
|
|
1237
|
+
* Against an Authyon API older than 2026-10-31 the floor is ignored and
|
|
1238
|
+
* the roots come back too.
|
|
1239
|
+
*/
|
|
1240
|
+
subTenants: (params?: Omit<TenantListOptions, "parentId" | "minDepth">) => Promise<Paged<Organization>>;
|
|
1192
1241
|
/**
|
|
1193
1242
|
* POST /env/tenants — create a tenant in the environment.
|
|
1194
1243
|
*
|
|
@@ -1224,6 +1273,31 @@ declare class AuthyonServerClient {
|
|
|
1224
1273
|
* and the branch below it. Same handler as `disable()`.
|
|
1225
1274
|
*/
|
|
1226
1275
|
delete: (tenantId: string) => Promise<void>;
|
|
1276
|
+
/**
|
|
1277
|
+
* POST /env/tenants/{tenantId}/enable — the way back from `disable()`.
|
|
1278
|
+
*
|
|
1279
|
+
* Only this tenant comes back: a sub-tenant that went down with the
|
|
1280
|
+
* cascade stays off until enabled itself, and a tenant under a disabled
|
|
1281
|
+
* parent cannot come back before the parent does
|
|
1282
|
+
* (`tenant.ancestor_disabled`).
|
|
1283
|
+
*
|
|
1284
|
+
* Against an Authyon API older than 2026-11-03 this route does not exist.
|
|
1285
|
+
*/
|
|
1286
|
+
enable: (tenantId: string) => Promise<void>;
|
|
1287
|
+
/**
|
|
1288
|
+
* POST /env/tenants/{tenantId}/move — hang the tenant, with everything
|
|
1289
|
+
* below it, under another parent, or at the root with `null`.
|
|
1290
|
+
*
|
|
1291
|
+
* Refused into itself or one of its own descendants
|
|
1292
|
+
* (`tenant.parent.cycle`), into a switched-off branch, or where the
|
|
1293
|
+
* branch's deepest node would pass the environment's level cap
|
|
1294
|
+
* (`tenant.depth.not_allowed`). Every token minted at the old position
|
|
1295
|
+
* is retired (`tenant.path_stale`), so sessions inside the branch sign
|
|
1296
|
+
* in again.
|
|
1297
|
+
*
|
|
1298
|
+
* Against an Authyon API older than 2026-11-03 this route does not exist.
|
|
1299
|
+
*/
|
|
1300
|
+
move: (tenantId: string, parentTenantId: string | null) => Promise<void>;
|
|
1227
1301
|
members: {
|
|
1228
1302
|
/**
|
|
1229
1303
|
* GET /env/tenants/{tenantId}/members — a tenant's members as full
|
|
@@ -1451,4 +1525,4 @@ declare class TenantScopedClient {
|
|
|
1451
1525
|
/** Convenience factory: `const authyon = createClient({ clientId, clientSecret })`. */
|
|
1452
1526
|
declare function createClient(options?: AuthyonServerClientOptions): AuthyonServerClient;
|
|
1453
1527
|
|
|
1454
|
-
export { type ReservedPermissions as $, AuthyonServerClient as A, type CredentialPermissionsInput as B, CLIENT_IP_HEADER as C, type HttpAdapterRequest as D, type EnvironmentUser as E, FetchHttpAdapter as F, type HttpLogEvent as G, type HttpAdapter as H, type HttpLogger as I, JwksTokenVerifier as J, type IntrospectResult as K, type InviteTenantMemberInput as L, type IssuePasswordResetInput as M, type JsonWebKeySet as N, type JwksTokenVerifierOptions as O, LoggingHttpAdapter as P, type LoginActivity as Q, type OpenIdConfiguration as R, type Organization as S, type OtpCheckResult as T, type Paged as U, type PaginationOptions as V, type PasswordResetCompleted as W, type PasswordResetIssued as X, type PasswordResetPreview as Y, type Permission as Z, type PermissionsByRole as _, type HttpLoggerOptions as a, type Role as a0, type RoleGrant as a1, type RoleInput as a2, type RoleList as a3, type RolePermissions as a4, type SafeJwtAlgorithm as a5, type SecurityMethods as a6, type SubjectApprovals as a7, type SubjectSecurity as a8, TENANT_FILTER_MAX_DEPTH as a9, type
|
|
1528
|
+
export { type ReservedPermissions as $, AuthyonServerClient as A, type CredentialPermissionsInput as B, CLIENT_IP_HEADER as C, type HttpAdapterRequest as D, type EnvironmentUser as E, FetchHttpAdapter as F, type HttpLogEvent as G, type HttpAdapter as H, type HttpLogger as I, JwksTokenVerifier as J, type IntrospectResult as K, type InviteTenantMemberInput as L, type IssuePasswordResetInput as M, type JsonWebKeySet as N, type JwksTokenVerifierOptions as O, LoggingHttpAdapter as P, type LoginActivity as Q, type OpenIdConfiguration as R, type Organization as S, type OtpCheckResult as T, type Paged as U, type PaginationOptions as V, type PasswordResetCompleted as W, type PasswordResetIssued as X, type PasswordResetPreview as Y, type Permission as Z, type PermissionsByRole as _, type HttpLoggerOptions as a, type Role as a0, type RoleGrant as a1, type RoleInput as a2, type RoleList as a3, type RolePermissions as a4, type SafeJwtAlgorithm as a5, type SecurityMethods as a6, type SubjectApprovals as a7, type SubjectSecurity as a8, TENANT_FILTER_MAX_DEPTH as a9, type ValidateResult as aA, type VerifiedAccessToken as aB, createClient as aC, normalizeClientIp as aD, tenantFilter as aE, TENANT_FILTER_MAX_VALUES as aa, TENANT_FILTER_MAX_VALUE_LENGTH as ab, type TenantAncestor as ac, type TenantClientValidationResult as ad, type TenantCredentialIssued as ae, type TenantCredentialSummary as af, type TenantFilterExpression as ag, type TenantFilterValue as ah, type TenantInvite as ai, type TenantInviteAccepted as aj, type TenantInviteInput as ak, type TenantInviteIssued as al, type TenantInvitePreview as am, type TenantInviteStatus as an, type TenantListOptions as ao, type TenantMember as ap, type TenantMemberPage as aq, type TenantMembership as ar, type TenantOrderField as as, TenantScopedClient as at, type TokenResult as au, TokenVerificationError as av, type TokenVerificationErrorCode as aw, type UpdateOrganizationInput as ax, type User as ay, UserScopedClient 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 CreateUserInput as w, type CredentialCreator as x, type CredentialDetail as y, type CredentialListOptions as z };
|
|
@@ -262,6 +262,8 @@ interface TenantAncestor {
|
|
|
262
262
|
* documents); `filter` is the structured half, ANDed, one entry per condition
|
|
263
263
|
* — see `tenantFilter` for the builders and the wire format.
|
|
264
264
|
*/
|
|
265
|
+
/** What `environment.tenants.list()` can order by. */
|
|
266
|
+
type TenantOrderField = "name" | "createdAt" | "updatedAt";
|
|
265
267
|
interface TenantListOptions extends PaginationOptions {
|
|
266
268
|
search?: string;
|
|
267
269
|
filter?: TenantFilterExpression[];
|
|
@@ -275,6 +277,34 @@ interface TenantListOptions extends PaginationOptions {
|
|
|
275
277
|
* on describing what you asked for.
|
|
276
278
|
*/
|
|
277
279
|
parentId?: string | null;
|
|
280
|
+
/**
|
|
281
|
+
* Inclusive floor on how deep a tenant sits, roots being 0. `1` is every
|
|
282
|
+
* sub-tenant in the environment, at any depth and under any parent — which
|
|
283
|
+
* `parentId` cannot ask for, since it names one parent. `subTenants()` is
|
|
284
|
+
* this option set for you. Capped at 4, the API's hard ceiling.
|
|
285
|
+
*/
|
|
286
|
+
minDepth?: number;
|
|
287
|
+
/**
|
|
288
|
+
* Inclusive ceiling. Equal bounds pin one generation (`minDepth: 1,
|
|
289
|
+
* maxDepth: 1` is the first generation across the whole environment). A
|
|
290
|
+
* floor deeper than the ceiling, or a bound outside 0..4, is a 400 rather
|
|
291
|
+
* than an empty page.
|
|
292
|
+
*/
|
|
293
|
+
maxDepth?: number;
|
|
294
|
+
/** Keeps one side of the status. Omitted lists both. */
|
|
295
|
+
status?: "active" | "disabled";
|
|
296
|
+
/**
|
|
297
|
+
* Server-side order: a field, as a bare name (ascending) or with a
|
|
298
|
+
* direction. The default is the name, ascending. Ties always break on the
|
|
299
|
+
* id, so a row cannot move across a page boundary between two calls.
|
|
300
|
+
*
|
|
301
|
+
* Against an Authyon API older than 2026-11-03 both `status` and `orderBy`
|
|
302
|
+
* are ignored, which reads as a page that is too wide rather than an error.
|
|
303
|
+
*/
|
|
304
|
+
orderBy?: TenantOrderField | {
|
|
305
|
+
field: TenantOrderField;
|
|
306
|
+
direction?: "asc" | "desc";
|
|
307
|
+
};
|
|
278
308
|
}
|
|
279
309
|
/** One of a user's tenant memberships, as embedded in `EnvironmentUser.tenantMemberships`. */
|
|
280
310
|
interface TenantMembership {
|
|
@@ -600,6 +630,13 @@ interface AuthyonServerClientOptions {
|
|
|
600
630
|
type AccessTokenSource = string | (() => string | Promise<string>);
|
|
601
631
|
interface CredentialListOptions extends PaginationOptions {
|
|
602
632
|
search?: string;
|
|
633
|
+
/**
|
|
634
|
+
* Keep only credentials that grant EVERY one of these permissions. Matching is
|
|
635
|
+
* wildcard-aware on the server: a credential holding `authyon:*:*` passes any
|
|
636
|
+
* filter. Up to 20 entries; requires an API of 2026-11-08 or newer, and an
|
|
637
|
+
* older one ignores it.
|
|
638
|
+
*/
|
|
639
|
+
permissions?: readonly string[];
|
|
603
640
|
}
|
|
604
641
|
/** scopes is an alias for permissions. Always supply an explicit, nonempty set. */
|
|
605
642
|
type CredentialPermissionsInput = {
|
|
@@ -1189,6 +1226,18 @@ declare class AuthyonServerClient {
|
|
|
1189
1226
|
* start from.
|
|
1190
1227
|
*/
|
|
1191
1228
|
roots: (params?: Omit<TenantListOptions, "parentId">) => Promise<Paged<Organization>>;
|
|
1229
|
+
/**
|
|
1230
|
+
* Every sub-tenant in the environment, at any depth and under any
|
|
1231
|
+
* parent — `list()` with `minDepth: 1`. This is the one page
|
|
1232
|
+
* `children()` cannot produce, since it names a single parent, and the
|
|
1233
|
+
* one a flat "all sub-companies" screen wants: the envelope describes
|
|
1234
|
+
* the sub-tenants alone, so the pager stops where they do, and nobody
|
|
1235
|
+
* has to read the whole environment and drop the roots.
|
|
1236
|
+
*
|
|
1237
|
+
* Against an Authyon API older than 2026-10-31 the floor is ignored and
|
|
1238
|
+
* the roots come back too.
|
|
1239
|
+
*/
|
|
1240
|
+
subTenants: (params?: Omit<TenantListOptions, "parentId" | "minDepth">) => Promise<Paged<Organization>>;
|
|
1192
1241
|
/**
|
|
1193
1242
|
* POST /env/tenants — create a tenant in the environment.
|
|
1194
1243
|
*
|
|
@@ -1224,6 +1273,31 @@ declare class AuthyonServerClient {
|
|
|
1224
1273
|
* and the branch below it. Same handler as `disable()`.
|
|
1225
1274
|
*/
|
|
1226
1275
|
delete: (tenantId: string) => Promise<void>;
|
|
1276
|
+
/**
|
|
1277
|
+
* POST /env/tenants/{tenantId}/enable — the way back from `disable()`.
|
|
1278
|
+
*
|
|
1279
|
+
* Only this tenant comes back: a sub-tenant that went down with the
|
|
1280
|
+
* cascade stays off until enabled itself, and a tenant under a disabled
|
|
1281
|
+
* parent cannot come back before the parent does
|
|
1282
|
+
* (`tenant.ancestor_disabled`).
|
|
1283
|
+
*
|
|
1284
|
+
* Against an Authyon API older than 2026-11-03 this route does not exist.
|
|
1285
|
+
*/
|
|
1286
|
+
enable: (tenantId: string) => Promise<void>;
|
|
1287
|
+
/**
|
|
1288
|
+
* POST /env/tenants/{tenantId}/move — hang the tenant, with everything
|
|
1289
|
+
* below it, under another parent, or at the root with `null`.
|
|
1290
|
+
*
|
|
1291
|
+
* Refused into itself or one of its own descendants
|
|
1292
|
+
* (`tenant.parent.cycle`), into a switched-off branch, or where the
|
|
1293
|
+
* branch's deepest node would pass the environment's level cap
|
|
1294
|
+
* (`tenant.depth.not_allowed`). Every token minted at the old position
|
|
1295
|
+
* is retired (`tenant.path_stale`), so sessions inside the branch sign
|
|
1296
|
+
* in again.
|
|
1297
|
+
*
|
|
1298
|
+
* Against an Authyon API older than 2026-11-03 this route does not exist.
|
|
1299
|
+
*/
|
|
1300
|
+
move: (tenantId: string, parentTenantId: string | null) => Promise<void>;
|
|
1227
1301
|
members: {
|
|
1228
1302
|
/**
|
|
1229
1303
|
* GET /env/tenants/{tenantId}/members — a tenant's members as full
|
|
@@ -1451,4 +1525,4 @@ declare class TenantScopedClient {
|
|
|
1451
1525
|
/** Convenience factory: `const authyon = createClient({ clientId, clientSecret })`. */
|
|
1452
1526
|
declare function createClient(options?: AuthyonServerClientOptions): AuthyonServerClient;
|
|
1453
1527
|
|
|
1454
|
-
export { type ReservedPermissions as $, AuthyonServerClient as A, type CredentialPermissionsInput as B, CLIENT_IP_HEADER as C, type HttpAdapterRequest as D, type EnvironmentUser as E, FetchHttpAdapter as F, type HttpLogEvent as G, type HttpAdapter as H, type HttpLogger as I, JwksTokenVerifier as J, type IntrospectResult as K, type InviteTenantMemberInput as L, type IssuePasswordResetInput as M, type JsonWebKeySet as N, type JwksTokenVerifierOptions as O, LoggingHttpAdapter as P, type LoginActivity as Q, type OpenIdConfiguration as R, type Organization as S, type OtpCheckResult as T, type Paged as U, type PaginationOptions as V, type PasswordResetCompleted as W, type PasswordResetIssued as X, type PasswordResetPreview as Y, type Permission as Z, type PermissionsByRole as _, type HttpLoggerOptions as a, type Role as a0, type RoleGrant as a1, type RoleInput as a2, type RoleList as a3, type RolePermissions as a4, type SafeJwtAlgorithm as a5, type SecurityMethods as a6, type SubjectApprovals as a7, type SubjectSecurity as a8, TENANT_FILTER_MAX_DEPTH as a9, type
|
|
1528
|
+
export { type ReservedPermissions as $, AuthyonServerClient as A, type CredentialPermissionsInput as B, CLIENT_IP_HEADER as C, type HttpAdapterRequest as D, type EnvironmentUser as E, FetchHttpAdapter as F, type HttpLogEvent as G, type HttpAdapter as H, type HttpLogger as I, JwksTokenVerifier as J, type IntrospectResult as K, type InviteTenantMemberInput as L, type IssuePasswordResetInput as M, type JsonWebKeySet as N, type JwksTokenVerifierOptions as O, LoggingHttpAdapter as P, type LoginActivity as Q, type OpenIdConfiguration as R, type Organization as S, type OtpCheckResult as T, type Paged as U, type PaginationOptions as V, type PasswordResetCompleted as W, type PasswordResetIssued as X, type PasswordResetPreview as Y, type Permission as Z, type PermissionsByRole as _, type HttpLoggerOptions as a, type Role as a0, type RoleGrant as a1, type RoleInput as a2, type RoleList as a3, type RolePermissions as a4, type SafeJwtAlgorithm as a5, type SecurityMethods as a6, type SubjectApprovals as a7, type SubjectSecurity as a8, TENANT_FILTER_MAX_DEPTH as a9, type ValidateResult as aA, type VerifiedAccessToken as aB, createClient as aC, normalizeClientIp as aD, tenantFilter as aE, TENANT_FILTER_MAX_VALUES as aa, TENANT_FILTER_MAX_VALUE_LENGTH as ab, type TenantAncestor as ac, type TenantClientValidationResult as ad, type TenantCredentialIssued as ae, type TenantCredentialSummary as af, type TenantFilterExpression as ag, type TenantFilterValue as ah, type TenantInvite as ai, type TenantInviteAccepted as aj, type TenantInviteInput as ak, type TenantInviteIssued as al, type TenantInvitePreview as am, type TenantInviteStatus as an, type TenantListOptions as ao, type TenantMember as ap, type TenantMemberPage as aq, type TenantMembership as ar, type TenantOrderField as as, TenantScopedClient as at, type TokenResult as au, TokenVerificationError as av, type TokenVerificationErrorCode as aw, type UpdateOrganizationInput as ax, type User as ay, UserScopedClient 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 CreateUserInput as w, type CredentialCreator as x, type CredentialDetail as y, type CredentialListOptions as z };
|
package/dist/bff.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { H as HttpAdapter, a as HttpLoggerOptions, A as AuthyonServerClient } from './authyonServerClient-
|
|
1
|
+
import { H as HttpAdapter, a as HttpLoggerOptions, A as AuthyonServerClient } from './authyonServerClient-6ezHxvwa.cjs';
|
|
2
2
|
import 'jose';
|
|
3
3
|
|
|
4
4
|
interface BffLoginInput {
|
package/dist/bff.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { H as HttpAdapter, a as HttpLoggerOptions, A as AuthyonServerClient } from './authyonServerClient-
|
|
1
|
+
import { H as HttpAdapter, a as HttpLoggerOptions, A as AuthyonServerClient } from './authyonServerClient-6ezHxvwa.js';
|
|
2
2
|
import 'jose';
|
|
3
3
|
|
|
4
4
|
interface BffLoginInput {
|
package/dist/index.cjs
CHANGED
|
@@ -92,6 +92,25 @@ function lifetimeBody(input) {
|
|
|
92
92
|
}
|
|
93
93
|
return { lifetimeDays: input.lifetimeDays };
|
|
94
94
|
}
|
|
95
|
+
var MAX_PERMISSION_FILTERS = 20;
|
|
96
|
+
var PERMISSION_FILTER = /^(?:\*|[a-z][a-z0-9_-]*)(?::(?:\*|[a-z][a-z0-9_-]*)){2,4}$/u;
|
|
97
|
+
function permissionFilter(values) {
|
|
98
|
+
if (values === void 0) return void 0;
|
|
99
|
+
if (!Array.isArray(values)) throw new TypeError("Authyon: permissions must be an array.");
|
|
100
|
+
const normalized = values.map((value) => {
|
|
101
|
+
if (typeof value !== "string") throw new TypeError("Authyon: invalid permission.");
|
|
102
|
+
return value.trim().toLowerCase();
|
|
103
|
+
});
|
|
104
|
+
const unique = [...new Set(normalized.filter((value) => value.length > 0))];
|
|
105
|
+
if (unique.length > MAX_PERMISSION_FILTERS)
|
|
106
|
+
throw new RangeError(
|
|
107
|
+
`Authyon: at most ${MAX_PERMISSION_FILTERS} permissions can be filtered at once.`
|
|
108
|
+
);
|
|
109
|
+
for (const value of unique)
|
|
110
|
+
if (!PERMISSION_FILTER.test(value))
|
|
111
|
+
throw new TypeError("Authyon: permissions must have namespace:resource:action format.");
|
|
112
|
+
return unique.length > 0 ? unique : void 0;
|
|
113
|
+
}
|
|
95
114
|
function credentialQuery(options = {}) {
|
|
96
115
|
const { skip, take, search } = options;
|
|
97
116
|
if (skip !== void 0 && (!Number.isInteger(skip) || skip < 0 || skip > 2147483647))
|
|
@@ -100,7 +119,8 @@ function credentialQuery(options = {}) {
|
|
|
100
119
|
throw new RangeError("Authyon: take must be between 1 and 100.");
|
|
101
120
|
if (search !== void 0 && (typeof search !== "string" || search.trim().length > 200))
|
|
102
121
|
throw new RangeError("Authyon: search must contain at most 200 characters.");
|
|
103
|
-
|
|
122
|
+
const permission = permissionFilter(options.permissions);
|
|
123
|
+
return { search: search?.trim() || void 0, skip, take, permission };
|
|
104
124
|
}
|
|
105
125
|
function credentialSummary(value) {
|
|
106
126
|
return {
|
|
@@ -808,9 +828,17 @@ function isRecord(value) {
|
|
|
808
828
|
|
|
809
829
|
// src/client/authyonServerClient.ts
|
|
810
830
|
var ROOT_PARENT_ID = "00000000-0000-0000-0000-000000000000";
|
|
811
|
-
function tenantListQuery({
|
|
812
|
-
|
|
813
|
-
|
|
831
|
+
function tenantListQuery({
|
|
832
|
+
parentId,
|
|
833
|
+
orderBy,
|
|
834
|
+
...rest
|
|
835
|
+
}) {
|
|
836
|
+
const query = { ...rest };
|
|
837
|
+
if (parentId !== void 0) query.parentId = parentId === null ? ROOT_PARENT_ID : parentId;
|
|
838
|
+
if (orderBy !== void 0) {
|
|
839
|
+
query.orderBy = typeof orderBy === "string" ? orderBy : `${orderBy.field}:${orderBy.direction ?? "asc"}`;
|
|
840
|
+
}
|
|
841
|
+
return query;
|
|
814
842
|
}
|
|
815
843
|
var _clientSecret;
|
|
816
844
|
var AuthyonServerClient = class {
|
|
@@ -1080,6 +1108,18 @@ var AuthyonServerClient = class {
|
|
|
1080
1108
|
* start from.
|
|
1081
1109
|
*/
|
|
1082
1110
|
roots: (params = {}) => this.environment.tenants.list({ ...params, parentId: null }),
|
|
1111
|
+
/**
|
|
1112
|
+
* Every sub-tenant in the environment, at any depth and under any
|
|
1113
|
+
* parent — `list()` with `minDepth: 1`. This is the one page
|
|
1114
|
+
* `children()` cannot produce, since it names a single parent, and the
|
|
1115
|
+
* one a flat "all sub-companies" screen wants: the envelope describes
|
|
1116
|
+
* the sub-tenants alone, so the pager stops where they do, and nobody
|
|
1117
|
+
* has to read the whole environment and drop the roots.
|
|
1118
|
+
*
|
|
1119
|
+
* Against an Authyon API older than 2026-10-31 the floor is ignored and
|
|
1120
|
+
* the roots come back too.
|
|
1121
|
+
*/
|
|
1122
|
+
subTenants: (params = {}) => this.environment.tenants.list({ ...params, minDepth: 1 }),
|
|
1083
1123
|
/**
|
|
1084
1124
|
* POST /env/tenants — create a tenant in the environment.
|
|
1085
1125
|
*
|
|
@@ -1129,6 +1169,38 @@ var AuthyonServerClient = class {
|
|
|
1129
1169
|
method: "DELETE",
|
|
1130
1170
|
envBearer: true
|
|
1131
1171
|
}),
|
|
1172
|
+
/**
|
|
1173
|
+
* POST /env/tenants/{tenantId}/enable — the way back from `disable()`.
|
|
1174
|
+
*
|
|
1175
|
+
* Only this tenant comes back: a sub-tenant that went down with the
|
|
1176
|
+
* cascade stays off until enabled itself, and a tenant under a disabled
|
|
1177
|
+
* parent cannot come back before the parent does
|
|
1178
|
+
* (`tenant.ancestor_disabled`).
|
|
1179
|
+
*
|
|
1180
|
+
* Against an Authyon API older than 2026-11-03 this route does not exist.
|
|
1181
|
+
*/
|
|
1182
|
+
enable: (tenantId) => this.request(`/env/tenants/${encodeURIComponent(tenantId)}/enable`, {
|
|
1183
|
+
method: "POST",
|
|
1184
|
+
envBearer: true
|
|
1185
|
+
}),
|
|
1186
|
+
/**
|
|
1187
|
+
* POST /env/tenants/{tenantId}/move — hang the tenant, with everything
|
|
1188
|
+
* below it, under another parent, or at the root with `null`.
|
|
1189
|
+
*
|
|
1190
|
+
* Refused into itself or one of its own descendants
|
|
1191
|
+
* (`tenant.parent.cycle`), into a switched-off branch, or where the
|
|
1192
|
+
* branch's deepest node would pass the environment's level cap
|
|
1193
|
+
* (`tenant.depth.not_allowed`). Every token minted at the old position
|
|
1194
|
+
* is retired (`tenant.path_stale`), so sessions inside the branch sign
|
|
1195
|
+
* in again.
|
|
1196
|
+
*
|
|
1197
|
+
* Against an Authyon API older than 2026-11-03 this route does not exist.
|
|
1198
|
+
*/
|
|
1199
|
+
move: (tenantId, parentTenantId) => this.request(`/env/tenants/${encodeURIComponent(tenantId)}/move`, {
|
|
1200
|
+
method: "POST",
|
|
1201
|
+
envBearer: true,
|
|
1202
|
+
body: { parentTenantId }
|
|
1203
|
+
}),
|
|
1132
1204
|
members: {
|
|
1133
1205
|
/**
|
|
1134
1206
|
* GET /env/tenants/{tenantId}/members — a tenant's members as full
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { H as HttpAdapter, a as HttpLoggerOptions, A as AuthyonServerClient } from './authyonServerClient-
|
|
2
|
-
export { b as AcceptTenantInviteInput, c as AccessTokenSource, d as Approval, e as ApprovalAssurance, f as ApprovalPayload, g as ApprovalStatus, h as ApprovalWebAuthnOptions, i as AuditEvent, j as AuthyonJwksDiscoveryOptions, k as AuthyonJwtClaims, l as AuthyonServerClientOptions, m as AuthyonTenantClaim, C as CLIENT_IP_HEADER, n as ClientCredentials, o as ClientRequestContext, p as ConfirmApprovalInput, q as ConsumedApproval, r as CreateApprovalInput, s as CreateCredentialInput, t as CreateOrganizationInput, u as CreatePermissionInput, v as CreateTenantCredentialInput, w as CreateUserInput, x as CredentialCreator, y as CredentialDetail, z as CredentialListOptions, B as CredentialPermissionsInput, E as EnvironmentUser, F as FetchHttpAdapter, D as HttpAdapterRequest, G as HttpLogEvent, I as HttpLogger, K as IntrospectResult, L as InviteTenantMemberInput, M as IssuePasswordResetInput, N as JsonWebKeySet, J as JwksTokenVerifier, O as JwksTokenVerifierOptions, P as LoggingHttpAdapter, Q as LoginActivity, R as OpenIdConfiguration, S as Organization, T as OtpCheckResult, U as Paged, V as PaginationOptions, W as PasswordResetCompleted, X as PasswordResetIssued, Y as PasswordResetPreview, Z as Permission, _ as PermissionsByRole, $ as ReservedPermissions, a0 as Role, a1 as RoleGrant, a2 as RoleInput, a3 as RoleList, a4 as RolePermissions, a5 as SafeJwtAlgorithm, a6 as SecurityMethods, a7 as SubjectApprovals, a8 as SubjectSecurity, a9 as TENANT_FILTER_MAX_DEPTH, aa as TENANT_FILTER_MAX_VALUES, ab as TENANT_FILTER_MAX_VALUE_LENGTH, ac as TenantAncestor, ad as TenantClientValidationResult, ae as TenantCredentialIssued, af as TenantCredentialSummary, ag as TenantFilterExpression, ah as TenantFilterValue, ai as TenantInvite, aj as TenantInviteAccepted, ak as TenantInviteInput, al as TenantInviteIssued, am as TenantInvitePreview, an as TenantInviteStatus, ao as TenantListOptions, ap as TenantMember, aq as TenantMemberPage, ar as TenantMembership, as as
|
|
3
|
-
export { b as AbilityConditions, c as AbilityEvent, d as AbilityListener, e as AbilityRequirement, f as AbilityRule, A as AbilitySubject, g as AuthorizationContext, a as AuthorizationError, h as AuthorizationOptions, i as AuthyonAbility, j as AuthyonAbilityBuilder, k as AuthyonAbilityOptions, l as AuthyonPermissionSource, E as ExpressAuthorizationMiddlewareOptions, m as ExpressNext, n as ExpressRequestLike, o as ExpressResponseLike, P as PermissionGroup, R as RequestAuthorizationOptions, p as authorizeRequest, q as authorizeToken, r as createAuthorizationErrorResponse, s as createAuthyonAbility, t as createAuthyonRules, u as createExpressAuthorizationMiddleware, v as hasPermission, w as hasPermissionGroup } from './authorization-
|
|
1
|
+
import { H as HttpAdapter, a as HttpLoggerOptions, A as AuthyonServerClient } from './authyonServerClient-6ezHxvwa.cjs';
|
|
2
|
+
export { b as AcceptTenantInviteInput, c as AccessTokenSource, d as Approval, e as ApprovalAssurance, f as ApprovalPayload, g as ApprovalStatus, h as ApprovalWebAuthnOptions, i as AuditEvent, j as AuthyonJwksDiscoveryOptions, k as AuthyonJwtClaims, l as AuthyonServerClientOptions, m as AuthyonTenantClaim, C as CLIENT_IP_HEADER, n as ClientCredentials, o as ClientRequestContext, p as ConfirmApprovalInput, q as ConsumedApproval, r as CreateApprovalInput, s as CreateCredentialInput, t as CreateOrganizationInput, u as CreatePermissionInput, v as CreateTenantCredentialInput, w as CreateUserInput, x as CredentialCreator, y as CredentialDetail, z as CredentialListOptions, B as CredentialPermissionsInput, E as EnvironmentUser, F as FetchHttpAdapter, D as HttpAdapterRequest, G as HttpLogEvent, I as HttpLogger, K as IntrospectResult, L as InviteTenantMemberInput, M as IssuePasswordResetInput, N as JsonWebKeySet, J as JwksTokenVerifier, O as JwksTokenVerifierOptions, P as LoggingHttpAdapter, Q as LoginActivity, R as OpenIdConfiguration, S as Organization, T as OtpCheckResult, U as Paged, V as PaginationOptions, W as PasswordResetCompleted, X as PasswordResetIssued, Y as PasswordResetPreview, Z as Permission, _ as PermissionsByRole, $ as ReservedPermissions, a0 as Role, a1 as RoleGrant, a2 as RoleInput, a3 as RoleList, a4 as RolePermissions, a5 as SafeJwtAlgorithm, a6 as SecurityMethods, a7 as SubjectApprovals, a8 as SubjectSecurity, a9 as TENANT_FILTER_MAX_DEPTH, aa as TENANT_FILTER_MAX_VALUES, ab as TENANT_FILTER_MAX_VALUE_LENGTH, ac as TenantAncestor, ad as TenantClientValidationResult, ae as TenantCredentialIssued, af as TenantCredentialSummary, ag as TenantFilterExpression, ah as TenantFilterValue, ai as TenantInvite, aj as TenantInviteAccepted, ak as TenantInviteInput, al as TenantInviteIssued, am as TenantInvitePreview, an as TenantInviteStatus, ao as TenantListOptions, ap as TenantMember, aq as TenantMemberPage, ar as TenantMembership, as as TenantOrderField, at as TenantScopedClient, au as TokenResult, av as TokenVerificationError, aw as TokenVerificationErrorCode, ax as UpdateOrganizationInput, ay as User, az as UserScopedClient, aA as ValidateResult, aB as VerifiedAccessToken, aC as createClient, aD as normalizeClientIp, aE as tenantFilter } from './authyonServerClient-6ezHxvwa.cjs';
|
|
3
|
+
export { b as AbilityConditions, c as AbilityEvent, d as AbilityListener, e as AbilityRequirement, f as AbilityRule, A as AbilitySubject, g as AuthorizationContext, a as AuthorizationError, h as AuthorizationOptions, i as AuthyonAbility, j as AuthyonAbilityBuilder, k as AuthyonAbilityOptions, l as AuthyonPermissionSource, E as ExpressAuthorizationMiddlewareOptions, m as ExpressNext, n as ExpressRequestLike, o as ExpressResponseLike, P as PermissionGroup, R as RequestAuthorizationOptions, p as authorizeRequest, q as authorizeToken, r as createAuthorizationErrorResponse, s as createAuthyonAbility, t as createAuthyonRules, u as createExpressAuthorizationMiddleware, v as hasPermission, w as hasPermissionGroup } from './authorization-BLVSHGQu.cjs';
|
|
4
4
|
import 'jose';
|
|
5
5
|
|
|
6
6
|
declare const ErrorCodes: {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { H as HttpAdapter, a as HttpLoggerOptions, A as AuthyonServerClient } from './authyonServerClient-
|
|
2
|
-
export { b as AcceptTenantInviteInput, c as AccessTokenSource, d as Approval, e as ApprovalAssurance, f as ApprovalPayload, g as ApprovalStatus, h as ApprovalWebAuthnOptions, i as AuditEvent, j as AuthyonJwksDiscoveryOptions, k as AuthyonJwtClaims, l as AuthyonServerClientOptions, m as AuthyonTenantClaim, C as CLIENT_IP_HEADER, n as ClientCredentials, o as ClientRequestContext, p as ConfirmApprovalInput, q as ConsumedApproval, r as CreateApprovalInput, s as CreateCredentialInput, t as CreateOrganizationInput, u as CreatePermissionInput, v as CreateTenantCredentialInput, w as CreateUserInput, x as CredentialCreator, y as CredentialDetail, z as CredentialListOptions, B as CredentialPermissionsInput, E as EnvironmentUser, F as FetchHttpAdapter, D as HttpAdapterRequest, G as HttpLogEvent, I as HttpLogger, K as IntrospectResult, L as InviteTenantMemberInput, M as IssuePasswordResetInput, N as JsonWebKeySet, J as JwksTokenVerifier, O as JwksTokenVerifierOptions, P as LoggingHttpAdapter, Q as LoginActivity, R as OpenIdConfiguration, S as Organization, T as OtpCheckResult, U as Paged, V as PaginationOptions, W as PasswordResetCompleted, X as PasswordResetIssued, Y as PasswordResetPreview, Z as Permission, _ as PermissionsByRole, $ as ReservedPermissions, a0 as Role, a1 as RoleGrant, a2 as RoleInput, a3 as RoleList, a4 as RolePermissions, a5 as SafeJwtAlgorithm, a6 as SecurityMethods, a7 as SubjectApprovals, a8 as SubjectSecurity, a9 as TENANT_FILTER_MAX_DEPTH, aa as TENANT_FILTER_MAX_VALUES, ab as TENANT_FILTER_MAX_VALUE_LENGTH, ac as TenantAncestor, ad as TenantClientValidationResult, ae as TenantCredentialIssued, af as TenantCredentialSummary, ag as TenantFilterExpression, ah as TenantFilterValue, ai as TenantInvite, aj as TenantInviteAccepted, ak as TenantInviteInput, al as TenantInviteIssued, am as TenantInvitePreview, an as TenantInviteStatus, ao as TenantListOptions, ap as TenantMember, aq as TenantMemberPage, ar as TenantMembership, as as
|
|
3
|
-
export { b as AbilityConditions, c as AbilityEvent, d as AbilityListener, e as AbilityRequirement, f as AbilityRule, A as AbilitySubject, g as AuthorizationContext, a as AuthorizationError, h as AuthorizationOptions, i as AuthyonAbility, j as AuthyonAbilityBuilder, k as AuthyonAbilityOptions, l as AuthyonPermissionSource, E as ExpressAuthorizationMiddlewareOptions, m as ExpressNext, n as ExpressRequestLike, o as ExpressResponseLike, P as PermissionGroup, R as RequestAuthorizationOptions, p as authorizeRequest, q as authorizeToken, r as createAuthorizationErrorResponse, s as createAuthyonAbility, t as createAuthyonRules, u as createExpressAuthorizationMiddleware, v as hasPermission, w as hasPermissionGroup } from './authorization-
|
|
1
|
+
import { H as HttpAdapter, a as HttpLoggerOptions, A as AuthyonServerClient } from './authyonServerClient-6ezHxvwa.js';
|
|
2
|
+
export { b as AcceptTenantInviteInput, c as AccessTokenSource, d as Approval, e as ApprovalAssurance, f as ApprovalPayload, g as ApprovalStatus, h as ApprovalWebAuthnOptions, i as AuditEvent, j as AuthyonJwksDiscoveryOptions, k as AuthyonJwtClaims, l as AuthyonServerClientOptions, m as AuthyonTenantClaim, C as CLIENT_IP_HEADER, n as ClientCredentials, o as ClientRequestContext, p as ConfirmApprovalInput, q as ConsumedApproval, r as CreateApprovalInput, s as CreateCredentialInput, t as CreateOrganizationInput, u as CreatePermissionInput, v as CreateTenantCredentialInput, w as CreateUserInput, x as CredentialCreator, y as CredentialDetail, z as CredentialListOptions, B as CredentialPermissionsInput, E as EnvironmentUser, F as FetchHttpAdapter, D as HttpAdapterRequest, G as HttpLogEvent, I as HttpLogger, K as IntrospectResult, L as InviteTenantMemberInput, M as IssuePasswordResetInput, N as JsonWebKeySet, J as JwksTokenVerifier, O as JwksTokenVerifierOptions, P as LoggingHttpAdapter, Q as LoginActivity, R as OpenIdConfiguration, S as Organization, T as OtpCheckResult, U as Paged, V as PaginationOptions, W as PasswordResetCompleted, X as PasswordResetIssued, Y as PasswordResetPreview, Z as Permission, _ as PermissionsByRole, $ as ReservedPermissions, a0 as Role, a1 as RoleGrant, a2 as RoleInput, a3 as RoleList, a4 as RolePermissions, a5 as SafeJwtAlgorithm, a6 as SecurityMethods, a7 as SubjectApprovals, a8 as SubjectSecurity, a9 as TENANT_FILTER_MAX_DEPTH, aa as TENANT_FILTER_MAX_VALUES, ab as TENANT_FILTER_MAX_VALUE_LENGTH, ac as TenantAncestor, ad as TenantClientValidationResult, ae as TenantCredentialIssued, af as TenantCredentialSummary, ag as TenantFilterExpression, ah as TenantFilterValue, ai as TenantInvite, aj as TenantInviteAccepted, ak as TenantInviteInput, al as TenantInviteIssued, am as TenantInvitePreview, an as TenantInviteStatus, ao as TenantListOptions, ap as TenantMember, aq as TenantMemberPage, ar as TenantMembership, as as TenantOrderField, at as TenantScopedClient, au as TokenResult, av as TokenVerificationError, aw as TokenVerificationErrorCode, ax as UpdateOrganizationInput, ay as User, az as UserScopedClient, aA as ValidateResult, aB as VerifiedAccessToken, aC as createClient, aD as normalizeClientIp, aE as tenantFilter } from './authyonServerClient-6ezHxvwa.js';
|
|
3
|
+
export { b as AbilityConditions, c as AbilityEvent, d as AbilityListener, e as AbilityRequirement, f as AbilityRule, A as AbilitySubject, g as AuthorizationContext, a as AuthorizationError, h as AuthorizationOptions, i as AuthyonAbility, j as AuthyonAbilityBuilder, k as AuthyonAbilityOptions, l as AuthyonPermissionSource, E as ExpressAuthorizationMiddlewareOptions, m as ExpressNext, n as ExpressRequestLike, o as ExpressResponseLike, P as PermissionGroup, R as RequestAuthorizationOptions, p as authorizeRequest, q as authorizeToken, r as createAuthorizationErrorResponse, s as createAuthyonAbility, t as createAuthyonRules, u as createExpressAuthorizationMiddleware, v as hasPermission, w as hasPermissionGroup } from './authorization-DPymgDb8.js';
|
|
4
4
|
import 'jose';
|
|
5
5
|
|
|
6
6
|
declare const ErrorCodes: {
|
package/dist/index.js
CHANGED
|
@@ -64,6 +64,25 @@ function lifetimeBody(input) {
|
|
|
64
64
|
}
|
|
65
65
|
return { lifetimeDays: input.lifetimeDays };
|
|
66
66
|
}
|
|
67
|
+
var MAX_PERMISSION_FILTERS = 20;
|
|
68
|
+
var PERMISSION_FILTER = /^(?:\*|[a-z][a-z0-9_-]*)(?::(?:\*|[a-z][a-z0-9_-]*)){2,4}$/u;
|
|
69
|
+
function permissionFilter(values) {
|
|
70
|
+
if (values === void 0) return void 0;
|
|
71
|
+
if (!Array.isArray(values)) throw new TypeError("Authyon: permissions must be an array.");
|
|
72
|
+
const normalized = values.map((value) => {
|
|
73
|
+
if (typeof value !== "string") throw new TypeError("Authyon: invalid permission.");
|
|
74
|
+
return value.trim().toLowerCase();
|
|
75
|
+
});
|
|
76
|
+
const unique = [...new Set(normalized.filter((value) => value.length > 0))];
|
|
77
|
+
if (unique.length > MAX_PERMISSION_FILTERS)
|
|
78
|
+
throw new RangeError(
|
|
79
|
+
`Authyon: at most ${MAX_PERMISSION_FILTERS} permissions can be filtered at once.`
|
|
80
|
+
);
|
|
81
|
+
for (const value of unique)
|
|
82
|
+
if (!PERMISSION_FILTER.test(value))
|
|
83
|
+
throw new TypeError("Authyon: permissions must have namespace:resource:action format.");
|
|
84
|
+
return unique.length > 0 ? unique : void 0;
|
|
85
|
+
}
|
|
67
86
|
function credentialQuery(options = {}) {
|
|
68
87
|
const { skip, take, search } = options;
|
|
69
88
|
if (skip !== void 0 && (!Number.isInteger(skip) || skip < 0 || skip > 2147483647))
|
|
@@ -72,7 +91,8 @@ function credentialQuery(options = {}) {
|
|
|
72
91
|
throw new RangeError("Authyon: take must be between 1 and 100.");
|
|
73
92
|
if (search !== void 0 && (typeof search !== "string" || search.trim().length > 200))
|
|
74
93
|
throw new RangeError("Authyon: search must contain at most 200 characters.");
|
|
75
|
-
|
|
94
|
+
const permission = permissionFilter(options.permissions);
|
|
95
|
+
return { search: search?.trim() || void 0, skip, take, permission };
|
|
76
96
|
}
|
|
77
97
|
function credentialSummary(value) {
|
|
78
98
|
return {
|
|
@@ -270,9 +290,17 @@ _inFlight = new WeakMap();
|
|
|
270
290
|
|
|
271
291
|
// src/client/authyonServerClient.ts
|
|
272
292
|
var ROOT_PARENT_ID = "00000000-0000-0000-0000-000000000000";
|
|
273
|
-
function tenantListQuery({
|
|
274
|
-
|
|
275
|
-
|
|
293
|
+
function tenantListQuery({
|
|
294
|
+
parentId,
|
|
295
|
+
orderBy,
|
|
296
|
+
...rest
|
|
297
|
+
}) {
|
|
298
|
+
const query = { ...rest };
|
|
299
|
+
if (parentId !== void 0) query.parentId = parentId === null ? ROOT_PARENT_ID : parentId;
|
|
300
|
+
if (orderBy !== void 0) {
|
|
301
|
+
query.orderBy = typeof orderBy === "string" ? orderBy : `${orderBy.field}:${orderBy.direction ?? "asc"}`;
|
|
302
|
+
}
|
|
303
|
+
return query;
|
|
276
304
|
}
|
|
277
305
|
var _clientSecret;
|
|
278
306
|
var AuthyonServerClient = class {
|
|
@@ -542,6 +570,18 @@ var AuthyonServerClient = class {
|
|
|
542
570
|
* start from.
|
|
543
571
|
*/
|
|
544
572
|
roots: (params = {}) => this.environment.tenants.list({ ...params, parentId: null }),
|
|
573
|
+
/**
|
|
574
|
+
* Every sub-tenant in the environment, at any depth and under any
|
|
575
|
+
* parent — `list()` with `minDepth: 1`. This is the one page
|
|
576
|
+
* `children()` cannot produce, since it names a single parent, and the
|
|
577
|
+
* one a flat "all sub-companies" screen wants: the envelope describes
|
|
578
|
+
* the sub-tenants alone, so the pager stops where they do, and nobody
|
|
579
|
+
* has to read the whole environment and drop the roots.
|
|
580
|
+
*
|
|
581
|
+
* Against an Authyon API older than 2026-10-31 the floor is ignored and
|
|
582
|
+
* the roots come back too.
|
|
583
|
+
*/
|
|
584
|
+
subTenants: (params = {}) => this.environment.tenants.list({ ...params, minDepth: 1 }),
|
|
545
585
|
/**
|
|
546
586
|
* POST /env/tenants — create a tenant in the environment.
|
|
547
587
|
*
|
|
@@ -591,6 +631,38 @@ var AuthyonServerClient = class {
|
|
|
591
631
|
method: "DELETE",
|
|
592
632
|
envBearer: true
|
|
593
633
|
}),
|
|
634
|
+
/**
|
|
635
|
+
* POST /env/tenants/{tenantId}/enable — the way back from `disable()`.
|
|
636
|
+
*
|
|
637
|
+
* Only this tenant comes back: a sub-tenant that went down with the
|
|
638
|
+
* cascade stays off until enabled itself, and a tenant under a disabled
|
|
639
|
+
* parent cannot come back before the parent does
|
|
640
|
+
* (`tenant.ancestor_disabled`).
|
|
641
|
+
*
|
|
642
|
+
* Against an Authyon API older than 2026-11-03 this route does not exist.
|
|
643
|
+
*/
|
|
644
|
+
enable: (tenantId) => this.request(`/env/tenants/${encodeURIComponent(tenantId)}/enable`, {
|
|
645
|
+
method: "POST",
|
|
646
|
+
envBearer: true
|
|
647
|
+
}),
|
|
648
|
+
/**
|
|
649
|
+
* POST /env/tenants/{tenantId}/move — hang the tenant, with everything
|
|
650
|
+
* below it, under another parent, or at the root with `null`.
|
|
651
|
+
*
|
|
652
|
+
* Refused into itself or one of its own descendants
|
|
653
|
+
* (`tenant.parent.cycle`), into a switched-off branch, or where the
|
|
654
|
+
* branch's deepest node would pass the environment's level cap
|
|
655
|
+
* (`tenant.depth.not_allowed`). Every token minted at the old position
|
|
656
|
+
* is retired (`tenant.path_stale`), so sessions inside the branch sign
|
|
657
|
+
* in again.
|
|
658
|
+
*
|
|
659
|
+
* Against an Authyon API older than 2026-11-03 this route does not exist.
|
|
660
|
+
*/
|
|
661
|
+
move: (tenantId, parentTenantId) => this.request(`/env/tenants/${encodeURIComponent(tenantId)}/move`, {
|
|
662
|
+
method: "POST",
|
|
663
|
+
envBearer: true,
|
|
664
|
+
body: { parentTenantId }
|
|
665
|
+
}),
|
|
594
666
|
members: {
|
|
595
667
|
/**
|
|
596
668
|
* GET /env/tenants/{tenantId}/members — a tenant's members as full
|
package/dist/next.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { R as RequestAuthorizationOptions, A as AbilitySubject, a as AuthorizationError } from './authorization-
|
|
3
|
-
import { A as AuthyonServerClient } from './authyonServerClient-
|
|
2
|
+
import { R as RequestAuthorizationOptions, A as AbilitySubject, a as AuthorizationError } from './authorization-BLVSHGQu.cjs';
|
|
3
|
+
import { A as AuthyonServerClient } from './authyonServerClient-6ezHxvwa.cjs';
|
|
4
4
|
import 'jose';
|
|
5
5
|
|
|
6
6
|
interface ServerPermissionGuardFallbackContext {
|
package/dist/next.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { R as RequestAuthorizationOptions, A as AbilitySubject, a as AuthorizationError } from './authorization-
|
|
3
|
-
import { A as AuthyonServerClient } from './authyonServerClient-
|
|
2
|
+
import { R as RequestAuthorizationOptions, A as AbilitySubject, a as AuthorizationError } from './authorization-DPymgDb8.js';
|
|
3
|
+
import { A as AuthyonServerClient } from './authyonServerClient-6ezHxvwa.js';
|
|
4
4
|
import 'jose';
|
|
5
5
|
|
|
6
6
|
interface ServerPermissionGuardFallbackContext {
|
package/package.json
CHANGED