@authyon/server 0.2.0-beta.24 → 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 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-zNSLRCwj.cjs';
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-zNSLRCwj.js';
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>;
@@ -277,6 +277,20 @@ interface TenantListOptions extends PaginationOptions {
277
277
  * on describing what you asked for.
278
278
  */
279
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;
280
294
  /** Keeps one side of the status. Omitted lists both. */
281
295
  status?: "active" | "disabled";
282
296
  /**
@@ -616,6 +630,13 @@ interface AuthyonServerClientOptions {
616
630
  type AccessTokenSource = string | (() => string | Promise<string>);
617
631
  interface CredentialListOptions extends PaginationOptions {
618
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[];
619
640
  }
620
641
  /** scopes is an alias for permissions. Always supply an explicit, nonempty set. */
621
642
  type CredentialPermissionsInput = {
@@ -1205,6 +1226,18 @@ declare class AuthyonServerClient {
1205
1226
  * start from.
1206
1227
  */
1207
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>>;
1208
1241
  /**
1209
1242
  * POST /env/tenants — create a tenant in the environment.
1210
1243
  *
@@ -277,6 +277,20 @@ interface TenantListOptions extends PaginationOptions {
277
277
  * on describing what you asked for.
278
278
  */
279
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;
280
294
  /** Keeps one side of the status. Omitted lists both. */
281
295
  status?: "active" | "disabled";
282
296
  /**
@@ -616,6 +630,13 @@ interface AuthyonServerClientOptions {
616
630
  type AccessTokenSource = string | (() => string | Promise<string>);
617
631
  interface CredentialListOptions extends PaginationOptions {
618
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[];
619
640
  }
620
641
  /** scopes is an alias for permissions. Always supply an explicit, nonempty set. */
621
642
  type CredentialPermissionsInput = {
@@ -1205,6 +1226,18 @@ declare class AuthyonServerClient {
1205
1226
  * start from.
1206
1227
  */
1207
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>>;
1208
1241
  /**
1209
1242
  * POST /env/tenants — create a tenant in the environment.
1210
1243
  *
package/dist/bff.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { H as HttpAdapter, a as HttpLoggerOptions, A as AuthyonServerClient } from './authyonServerClient-zNSLRCwj.cjs';
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-zNSLRCwj.js';
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
- return { search: search?.trim() || void 0, skip, take };
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 {
@@ -1088,6 +1108,18 @@ var AuthyonServerClient = class {
1088
1108
  * start from.
1089
1109
  */
1090
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 }),
1091
1123
  /**
1092
1124
  * POST /env/tenants — create a tenant in the environment.
1093
1125
  *
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
- import { H as HttpAdapter, a as HttpLoggerOptions, A as AuthyonServerClient } from './authyonServerClient-zNSLRCwj.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-zNSLRCwj.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-B-kQhcBm.cjs';
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-zNSLRCwj.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-zNSLRCwj.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-CxBweecR.js';
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
- return { search: search?.trim() || void 0, skip, take };
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 {
@@ -550,6 +570,18 @@ var AuthyonServerClient = class {
550
570
  * start from.
551
571
  */
552
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 }),
553
585
  /**
554
586
  * POST /env/tenants — create a tenant in the environment.
555
587
  *
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-B-kQhcBm.cjs';
3
- import { A as AuthyonServerClient } from './authyonServerClient-zNSLRCwj.cjs';
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-CxBweecR.js';
3
- import { A as AuthyonServerClient } from './authyonServerClient-zNSLRCwj.js';
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@authyon/server",
3
- "version": "0.2.0-beta.24",
3
+ "version": "0.2.0-beta.25",
4
4
  "description": "Authyon SDK for backends — server-to-server organization/member management and access-token verification.",
5
5
  "license": "MIT",
6
6
  "type": "module",