@authyon/server 0.2.0-beta.29 → 0.2.0-beta.30
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 +27 -0
- package/dist/{authorization-C2XOBjmM.d.cts → authorization-DR079xKg.d.cts} +1 -1
- package/dist/{authorization-CjHIH0F8.d.ts → authorization-Dkawj1IN.d.ts} +1 -1
- package/dist/{authyonServerClient-CbHvFX-h.d.cts → authyonServerClient-C_iWckru.d.cts} +91 -9
- package/dist/{authyonServerClient-CbHvFX-h.d.ts → authyonServerClient-C_iWckru.d.ts} +91 -9
- package/dist/bff.d.cts +1 -1
- package/dist/bff.d.ts +1 -1
- package/dist/index.cjs +64 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +64 -1
- package/dist/next.d.cts +2 -2
- package/dist/next.d.ts +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -462,6 +462,33 @@ await authyon.environment.tenants.members.remove(tenantId, userId);
|
|
|
462
462
|
// Os métodos tenant(credentials).members.add/remove existentes continuam disponíveis.
|
|
463
463
|
```
|
|
464
464
|
|
|
465
|
+
Cada membro de `user(token).tenants.members.list()` traz `status` (`active`,
|
|
466
|
+
`suspended` ou `disabled`) e `emailConfirmed` (API de 2026-11-26 ou mais nova).
|
|
467
|
+
|
|
468
|
+
### Sub-tenants, agindo como o usuário
|
|
469
|
+
|
|
470
|
+
```ts
|
|
471
|
+
const user = authyon.user(() => getCurrentUserAccessToken());
|
|
472
|
+
|
|
473
|
+
// Os filhos diretos e ativos de um tenant, um nível por chamada.
|
|
474
|
+
const { data, total, hasNext } = await user.tenants.subTenants.list(tenantId, {
|
|
475
|
+
search: "sul",
|
|
476
|
+
filter: [tenantFilter.in("public.kind", ["loja", "quiosque"])],
|
|
477
|
+
orderBy: { field: "updatedAt", direction: "desc" },
|
|
478
|
+
skip: 0,
|
|
479
|
+
take: 50,
|
|
480
|
+
});
|
|
481
|
+
|
|
482
|
+
// O mesmo para o tenant ativo do token (tenant_id).
|
|
483
|
+
await user.tenants.subTenants.listCurrent({ orderBy: "name" });
|
|
484
|
+
```
|
|
485
|
+
|
|
486
|
+
Exige `subtenants:tree:read` no tenant ou num acima, inclusive no próprio tenant.
|
|
487
|
+
A diferença para `environment.tenants.children()` é o plano: lá a credencial do
|
|
488
|
+
ambiente vê tudo; aqui o usuário só vê o que lhe é mostrado — o `filter` aceita
|
|
489
|
+
apenas o escopo `public` e a busca não olha `privateMetadata` (o SDK recusa
|
|
490
|
+
`private.*` e `custom.*` com `RangeError`), e só os sub-tenants ativos aparecem.
|
|
491
|
+
|
|
465
492
|
Configure `envKey` para `user()`. `members.invite` associa um usuário já
|
|
466
493
|
cadastrado no ambiente pelo e-mail; não cria conta e não envia link por e-mail.
|
|
467
494
|
Para isso, use os convites abaixo.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { J as JwksTokenVerifier, A as AuthyonServerClient } from './authyonServerClient-
|
|
1
|
+
import { J as JwksTokenVerifier, A as AuthyonServerClient } from './authyonServerClient-C_iWckru.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-C_iWckru.js';
|
|
2
2
|
|
|
3
3
|
type AbilitySubject = string | Record<string, unknown>;
|
|
4
4
|
type AbilityConditions = Record<string, unknown>;
|
|
@@ -179,6 +179,66 @@ interface IntrospectResult {
|
|
|
179
179
|
jti?: string;
|
|
180
180
|
token_type?: string;
|
|
181
181
|
}
|
|
182
|
+
/** Fields a tenant listing can order by. */
|
|
183
|
+
type TenantOrderField = "name" | "createdAt" | "updatedAt";
|
|
184
|
+
/**
|
|
185
|
+
* A server-side order: a field as a bare name (ascending) or with a direction.
|
|
186
|
+
* Ties always break on the id, so a row cannot move across a page boundary
|
|
187
|
+
* between two calls.
|
|
188
|
+
*/
|
|
189
|
+
type TenantOrder = TenantOrderField | {
|
|
190
|
+
field: TenantOrderField;
|
|
191
|
+
direction?: "asc" | "desc";
|
|
192
|
+
};
|
|
193
|
+
/**
|
|
194
|
+
* Options for a sub-tenant listing on the end-user routes
|
|
195
|
+
* (`/auth/tenants/{id}/subtenants` and `/auth/tenants/subtenants`).
|
|
196
|
+
*
|
|
197
|
+
* The same knobs as the environment's tenant list, cut down to what a member
|
|
198
|
+
* is shown:
|
|
199
|
+
*
|
|
200
|
+
* - `search`: one substring, case-insensitive, over the name, the slug, the
|
|
201
|
+
* description and the public metadata. Never the private metadata. At most
|
|
202
|
+
* 100 characters; blank lists everything.
|
|
203
|
+
* - `filter`: structured conditions, ANDed, at most 10 — build them with
|
|
204
|
+
* `tenantFilter`. Only the `public` scope: a `private.*` or `custom.*`
|
|
205
|
+
* filter would let a member test values they cannot read, so it raises
|
|
206
|
+
* `RangeError` here (and is a 400 `tenant.filter.invalid` on the API).
|
|
207
|
+
* - `orderBy`: `name` (the default, ascending), `createdAt` or `updatedAt`.
|
|
208
|
+
*
|
|
209
|
+
* There is no `status`: only active sub-tenants are listed, since everything
|
|
210
|
+
* below a disabled one is closed to reads from above.
|
|
211
|
+
*/
|
|
212
|
+
interface SubTenantListOptions extends PaginationOptions {
|
|
213
|
+
search?: string;
|
|
214
|
+
filter?: string[];
|
|
215
|
+
orderBy?: TenantOrder;
|
|
216
|
+
}
|
|
217
|
+
/** The tenant another one hangs from: enough to name it in a breadcrumb. */
|
|
218
|
+
interface TenantParent {
|
|
219
|
+
id: string;
|
|
220
|
+
slug: string;
|
|
221
|
+
name: string;
|
|
222
|
+
}
|
|
223
|
+
/** One direct sub-tenant, as the end-user sub-tenant listings return it. */
|
|
224
|
+
interface SubTenant {
|
|
225
|
+
id: string;
|
|
226
|
+
slug: string;
|
|
227
|
+
name: string;
|
|
228
|
+
description: string | null;
|
|
229
|
+
/** Distance from the root: `1` for a child of a root. */
|
|
230
|
+
depth: number;
|
|
231
|
+
/** Its own direct sub-tenants. Ask for the next level only where this is above zero. */
|
|
232
|
+
childCount: number;
|
|
233
|
+
/** Whether the user also belongs to it directly. */
|
|
234
|
+
isMember: boolean;
|
|
235
|
+
createdAt: string;
|
|
236
|
+
updatedAt: string;
|
|
237
|
+
/** JSON-encoded metadata visible to members. */
|
|
238
|
+
publicMetadata: string;
|
|
239
|
+
/** The tenant it hangs from — the same on every row of a page, carried so a row stands on its own. */
|
|
240
|
+
parent: TenantParent;
|
|
241
|
+
}
|
|
182
242
|
|
|
183
243
|
/**
|
|
184
244
|
* Builders for the tenant list's structured filters.
|
|
@@ -265,14 +325,7 @@ interface TenantAncestor {
|
|
|
265
325
|
slug: string;
|
|
266
326
|
isDisabled: boolean;
|
|
267
327
|
}
|
|
268
|
-
|
|
269
|
-
* What `environment.tenants.list()` accepts. `search` is the free-text half
|
|
270
|
-
* (one substring, ORed across name, slug, description and both metadata
|
|
271
|
-
* documents); `filter` is the structured half, ANDed, one entry per condition
|
|
272
|
-
* — see `tenantFilter` for the builders and the wire format.
|
|
273
|
-
*/
|
|
274
|
-
/** What `environment.tenants.list()` can order by. */
|
|
275
|
-
type TenantOrderField = "name" | "createdAt" | "updatedAt";
|
|
328
|
+
|
|
276
329
|
interface TenantListOptions extends PaginationOptions {
|
|
277
330
|
search?: string;
|
|
278
331
|
filter?: TenantFilterExpression[];
|
|
@@ -703,6 +756,13 @@ interface TenantMember {
|
|
|
703
756
|
roles: string[];
|
|
704
757
|
createdAt: string;
|
|
705
758
|
lastLoginAt: string | null;
|
|
759
|
+
/**
|
|
760
|
+
* Account status: `"active"`, `"suspended"` (a temporary hold is in force) or
|
|
761
|
+
* `"disabled"`. Absent from an API older than 2026-11-26.
|
|
762
|
+
*/
|
|
763
|
+
status?: "active" | "suspended" | "disabled";
|
|
764
|
+
/** Whether the member confirmed their e-mail. Absent from an API older than 2026-11-26. */
|
|
765
|
+
emailConfirmed?: boolean;
|
|
706
766
|
}
|
|
707
767
|
type TenantMemberPage = Paged<TenantMember>;
|
|
708
768
|
/**
|
|
@@ -896,6 +956,28 @@ declare class UserScopedClient {
|
|
|
896
956
|
*/
|
|
897
957
|
readonly security: SubjectSecurity;
|
|
898
958
|
readonly tenants: {
|
|
959
|
+
/**
|
|
960
|
+
* The direct, active sub-tenants of a tenant, acting as the user. One level
|
|
961
|
+
* per call: each row's `childCount` says where the next call is worth
|
|
962
|
+
* making. Needs `subtenants:tree:read` on the tenant or on one above it —
|
|
963
|
+
* even on the user's own tenant, since listing the children is reading
|
|
964
|
+
* below it.
|
|
965
|
+
*
|
|
966
|
+
* Paged like every other `skip`/`take` listing, with `search`, `filter`
|
|
967
|
+
* (public scope only — build them with `tenantFilter`) and `orderBy`; see
|
|
968
|
+
* `SubTenantListOptions`. A bad option raises `RangeError` before any
|
|
969
|
+
* request. Requires the Authyon API of 2026-11-26 or newer.
|
|
970
|
+
*/
|
|
971
|
+
subTenants: {
|
|
972
|
+
/** GET /auth/tenants/{tenantId}/subtenants. */
|
|
973
|
+
list: (tenantId: string, options?: SubTenantListOptions) => Promise<Paged<SubTenant>>;
|
|
974
|
+
/**
|
|
975
|
+
* GET /auth/tenants/subtenants — the same, for the tenant the user's token
|
|
976
|
+
* is scoped to (its `tenant_id`). Same permission rule. Answers
|
|
977
|
+
* `tenant.no_active_tenant` when the session never switched into one.
|
|
978
|
+
*/
|
|
979
|
+
listCurrent: (options?: SubTenantListOptions) => Promise<Paged<SubTenant>>;
|
|
980
|
+
};
|
|
899
981
|
members: {
|
|
900
982
|
/** Newest first; `search` matches email, username or name (at most 100 characters). */
|
|
901
983
|
list: (tenantId: string, options?: MemberListOptions) => Promise<TenantMemberPage>;
|
|
@@ -1574,4 +1656,4 @@ declare class TenantScopedClient {
|
|
|
1574
1656
|
/** Convenience factory: `const authyon = createClient({ clientId, clientSecret })`. */
|
|
1575
1657
|
declare function createClient(options?: AuthyonServerClientOptions): AuthyonServerClient;
|
|
1576
1658
|
|
|
1577
|
-
export { type Permission as $, AuthyonServerClient as A, type BuiltInPermission as B, CLIENT_IP_HEADER as C, type CredentialPermissionsInput as D, type EnvironmentUser as E, FetchHttpAdapter as F, type HttpAdapterRequest as G, type HttpAdapter as H, type HttpLogEvent as I, JwksTokenVerifier as J, type HttpLogger as K, type IntrospectResult as L, type InviteTenantMemberInput as M, type IssuePasswordResetInput as N, type JsonWebKeySet as O, type JwksTokenVerifierOptions as P, LoggingHttpAdapter as Q, type LoginActivity as R, type MemberListOptions as S, type OpenIdConfiguration as T, type Organization as U, type OtpCheckResult as V, type Paged as W, type PaginationOptions as X, type PasswordResetCompleted as Y, type PasswordResetIssued as Z, type PasswordResetPreview as _, type HttpLoggerOptions as a, type PermissionsByRole as a0, type ReservedPermissions as a1, type Role as a2, type RoleGrant as a3, type RoleInput as a4, type RoleList as a5, type RolePermissions as a6, type SafeJwtAlgorithm as a7, type SecurityMethods as a8, type
|
|
1659
|
+
export { type Permission as $, AuthyonServerClient as A, type BuiltInPermission as B, CLIENT_IP_HEADER as C, type CredentialPermissionsInput as D, type EnvironmentUser as E, FetchHttpAdapter as F, type HttpAdapterRequest as G, type HttpAdapter as H, type HttpLogEvent as I, JwksTokenVerifier as J, type HttpLogger as K, type IntrospectResult as L, type InviteTenantMemberInput as M, type IssuePasswordResetInput as N, type JsonWebKeySet as O, type JwksTokenVerifierOptions as P, LoggingHttpAdapter as Q, type LoginActivity as R, type MemberListOptions as S, type OpenIdConfiguration as T, type Organization as U, type OtpCheckResult as V, type Paged as W, type PaginationOptions as X, type PasswordResetCompleted as Y, type PasswordResetIssued as Z, type PasswordResetPreview as _, type HttpLoggerOptions as a, type PermissionsByRole as a0, type ReservedPermissions as a1, type Role as a2, type RoleGrant as a3, type RoleInput as a4, type RoleList as a5, type RolePermissions as a6, type SafeJwtAlgorithm as a7, type SecurityMethods as a8, type SubTenant as a9, TenantScopedClient as aA, type TokenResult as aB, TokenVerificationError as aC, type TokenVerificationErrorCode as aD, type UpdateOrganizationInput as aE, type User as aF, UserScopedClient as aG, type ValidateResult as aH, type VerifiedAccessToken as aI, createClient as aJ, normalizeClientIp as aK, tenantFilter as aL, type SubTenantListOptions as aa, type SubjectApprovals as ab, type SubjectSecurity as ac, TENANT_FILTER_MAX_DEPTH as ad, TENANT_FILTER_MAX_VALUES as ae, TENANT_FILTER_MAX_VALUE_LENGTH as af, type TenantAncestor as ag, type TenantClientValidationResult as ah, type TenantCredentialIssued as ai, type TenantCredentialSummary as aj, type TenantFilterExpression as ak, type TenantFilterValue as al, type TenantInvite as am, type TenantInviteAccepted as an, type TenantInviteInput as ao, type TenantInviteIssued as ap, type TenantInviteListOptions as aq, type TenantInvitePreview as ar, type TenantInviteStatus as as, type TenantListOptions as at, type TenantMember as au, type TenantMemberPage as av, type TenantMembership as aw, type TenantOrder as ax, type TenantOrderField as ay, type TenantParent 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 };
|
|
@@ -179,6 +179,66 @@ interface IntrospectResult {
|
|
|
179
179
|
jti?: string;
|
|
180
180
|
token_type?: string;
|
|
181
181
|
}
|
|
182
|
+
/** Fields a tenant listing can order by. */
|
|
183
|
+
type TenantOrderField = "name" | "createdAt" | "updatedAt";
|
|
184
|
+
/**
|
|
185
|
+
* A server-side order: a field as a bare name (ascending) or with a direction.
|
|
186
|
+
* Ties always break on the id, so a row cannot move across a page boundary
|
|
187
|
+
* between two calls.
|
|
188
|
+
*/
|
|
189
|
+
type TenantOrder = TenantOrderField | {
|
|
190
|
+
field: TenantOrderField;
|
|
191
|
+
direction?: "asc" | "desc";
|
|
192
|
+
};
|
|
193
|
+
/**
|
|
194
|
+
* Options for a sub-tenant listing on the end-user routes
|
|
195
|
+
* (`/auth/tenants/{id}/subtenants` and `/auth/tenants/subtenants`).
|
|
196
|
+
*
|
|
197
|
+
* The same knobs as the environment's tenant list, cut down to what a member
|
|
198
|
+
* is shown:
|
|
199
|
+
*
|
|
200
|
+
* - `search`: one substring, case-insensitive, over the name, the slug, the
|
|
201
|
+
* description and the public metadata. Never the private metadata. At most
|
|
202
|
+
* 100 characters; blank lists everything.
|
|
203
|
+
* - `filter`: structured conditions, ANDed, at most 10 — build them with
|
|
204
|
+
* `tenantFilter`. Only the `public` scope: a `private.*` or `custom.*`
|
|
205
|
+
* filter would let a member test values they cannot read, so it raises
|
|
206
|
+
* `RangeError` here (and is a 400 `tenant.filter.invalid` on the API).
|
|
207
|
+
* - `orderBy`: `name` (the default, ascending), `createdAt` or `updatedAt`.
|
|
208
|
+
*
|
|
209
|
+
* There is no `status`: only active sub-tenants are listed, since everything
|
|
210
|
+
* below a disabled one is closed to reads from above.
|
|
211
|
+
*/
|
|
212
|
+
interface SubTenantListOptions extends PaginationOptions {
|
|
213
|
+
search?: string;
|
|
214
|
+
filter?: string[];
|
|
215
|
+
orderBy?: TenantOrder;
|
|
216
|
+
}
|
|
217
|
+
/** The tenant another one hangs from: enough to name it in a breadcrumb. */
|
|
218
|
+
interface TenantParent {
|
|
219
|
+
id: string;
|
|
220
|
+
slug: string;
|
|
221
|
+
name: string;
|
|
222
|
+
}
|
|
223
|
+
/** One direct sub-tenant, as the end-user sub-tenant listings return it. */
|
|
224
|
+
interface SubTenant {
|
|
225
|
+
id: string;
|
|
226
|
+
slug: string;
|
|
227
|
+
name: string;
|
|
228
|
+
description: string | null;
|
|
229
|
+
/** Distance from the root: `1` for a child of a root. */
|
|
230
|
+
depth: number;
|
|
231
|
+
/** Its own direct sub-tenants. Ask for the next level only where this is above zero. */
|
|
232
|
+
childCount: number;
|
|
233
|
+
/** Whether the user also belongs to it directly. */
|
|
234
|
+
isMember: boolean;
|
|
235
|
+
createdAt: string;
|
|
236
|
+
updatedAt: string;
|
|
237
|
+
/** JSON-encoded metadata visible to members. */
|
|
238
|
+
publicMetadata: string;
|
|
239
|
+
/** The tenant it hangs from — the same on every row of a page, carried so a row stands on its own. */
|
|
240
|
+
parent: TenantParent;
|
|
241
|
+
}
|
|
182
242
|
|
|
183
243
|
/**
|
|
184
244
|
* Builders for the tenant list's structured filters.
|
|
@@ -265,14 +325,7 @@ interface TenantAncestor {
|
|
|
265
325
|
slug: string;
|
|
266
326
|
isDisabled: boolean;
|
|
267
327
|
}
|
|
268
|
-
|
|
269
|
-
* What `environment.tenants.list()` accepts. `search` is the free-text half
|
|
270
|
-
* (one substring, ORed across name, slug, description and both metadata
|
|
271
|
-
* documents); `filter` is the structured half, ANDed, one entry per condition
|
|
272
|
-
* — see `tenantFilter` for the builders and the wire format.
|
|
273
|
-
*/
|
|
274
|
-
/** What `environment.tenants.list()` can order by. */
|
|
275
|
-
type TenantOrderField = "name" | "createdAt" | "updatedAt";
|
|
328
|
+
|
|
276
329
|
interface TenantListOptions extends PaginationOptions {
|
|
277
330
|
search?: string;
|
|
278
331
|
filter?: TenantFilterExpression[];
|
|
@@ -703,6 +756,13 @@ interface TenantMember {
|
|
|
703
756
|
roles: string[];
|
|
704
757
|
createdAt: string;
|
|
705
758
|
lastLoginAt: string | null;
|
|
759
|
+
/**
|
|
760
|
+
* Account status: `"active"`, `"suspended"` (a temporary hold is in force) or
|
|
761
|
+
* `"disabled"`. Absent from an API older than 2026-11-26.
|
|
762
|
+
*/
|
|
763
|
+
status?: "active" | "suspended" | "disabled";
|
|
764
|
+
/** Whether the member confirmed their e-mail. Absent from an API older than 2026-11-26. */
|
|
765
|
+
emailConfirmed?: boolean;
|
|
706
766
|
}
|
|
707
767
|
type TenantMemberPage = Paged<TenantMember>;
|
|
708
768
|
/**
|
|
@@ -896,6 +956,28 @@ declare class UserScopedClient {
|
|
|
896
956
|
*/
|
|
897
957
|
readonly security: SubjectSecurity;
|
|
898
958
|
readonly tenants: {
|
|
959
|
+
/**
|
|
960
|
+
* The direct, active sub-tenants of a tenant, acting as the user. One level
|
|
961
|
+
* per call: each row's `childCount` says where the next call is worth
|
|
962
|
+
* making. Needs `subtenants:tree:read` on the tenant or on one above it —
|
|
963
|
+
* even on the user's own tenant, since listing the children is reading
|
|
964
|
+
* below it.
|
|
965
|
+
*
|
|
966
|
+
* Paged like every other `skip`/`take` listing, with `search`, `filter`
|
|
967
|
+
* (public scope only — build them with `tenantFilter`) and `orderBy`; see
|
|
968
|
+
* `SubTenantListOptions`. A bad option raises `RangeError` before any
|
|
969
|
+
* request. Requires the Authyon API of 2026-11-26 or newer.
|
|
970
|
+
*/
|
|
971
|
+
subTenants: {
|
|
972
|
+
/** GET /auth/tenants/{tenantId}/subtenants. */
|
|
973
|
+
list: (tenantId: string, options?: SubTenantListOptions) => Promise<Paged<SubTenant>>;
|
|
974
|
+
/**
|
|
975
|
+
* GET /auth/tenants/subtenants — the same, for the tenant the user's token
|
|
976
|
+
* is scoped to (its `tenant_id`). Same permission rule. Answers
|
|
977
|
+
* `tenant.no_active_tenant` when the session never switched into one.
|
|
978
|
+
*/
|
|
979
|
+
listCurrent: (options?: SubTenantListOptions) => Promise<Paged<SubTenant>>;
|
|
980
|
+
};
|
|
899
981
|
members: {
|
|
900
982
|
/** Newest first; `search` matches email, username or name (at most 100 characters). */
|
|
901
983
|
list: (tenantId: string, options?: MemberListOptions) => Promise<TenantMemberPage>;
|
|
@@ -1574,4 +1656,4 @@ declare class TenantScopedClient {
|
|
|
1574
1656
|
/** Convenience factory: `const authyon = createClient({ clientId, clientSecret })`. */
|
|
1575
1657
|
declare function createClient(options?: AuthyonServerClientOptions): AuthyonServerClient;
|
|
1576
1658
|
|
|
1577
|
-
export { type Permission as $, AuthyonServerClient as A, type BuiltInPermission as B, CLIENT_IP_HEADER as C, type CredentialPermissionsInput as D, type EnvironmentUser as E, FetchHttpAdapter as F, type HttpAdapterRequest as G, type HttpAdapter as H, type HttpLogEvent as I, JwksTokenVerifier as J, type HttpLogger as K, type IntrospectResult as L, type InviteTenantMemberInput as M, type IssuePasswordResetInput as N, type JsonWebKeySet as O, type JwksTokenVerifierOptions as P, LoggingHttpAdapter as Q, type LoginActivity as R, type MemberListOptions as S, type OpenIdConfiguration as T, type Organization as U, type OtpCheckResult as V, type Paged as W, type PaginationOptions as X, type PasswordResetCompleted as Y, type PasswordResetIssued as Z, type PasswordResetPreview as _, type HttpLoggerOptions as a, type PermissionsByRole as a0, type ReservedPermissions as a1, type Role as a2, type RoleGrant as a3, type RoleInput as a4, type RoleList as a5, type RolePermissions as a6, type SafeJwtAlgorithm as a7, type SecurityMethods as a8, type
|
|
1659
|
+
export { type Permission as $, AuthyonServerClient as A, type BuiltInPermission as B, CLIENT_IP_HEADER as C, type CredentialPermissionsInput as D, type EnvironmentUser as E, FetchHttpAdapter as F, type HttpAdapterRequest as G, type HttpAdapter as H, type HttpLogEvent as I, JwksTokenVerifier as J, type HttpLogger as K, type IntrospectResult as L, type InviteTenantMemberInput as M, type IssuePasswordResetInput as N, type JsonWebKeySet as O, type JwksTokenVerifierOptions as P, LoggingHttpAdapter as Q, type LoginActivity as R, type MemberListOptions as S, type OpenIdConfiguration as T, type Organization as U, type OtpCheckResult as V, type Paged as W, type PaginationOptions as X, type PasswordResetCompleted as Y, type PasswordResetIssued as Z, type PasswordResetPreview as _, type HttpLoggerOptions as a, type PermissionsByRole as a0, type ReservedPermissions as a1, type Role as a2, type RoleGrant as a3, type RoleInput as a4, type RoleList as a5, type RolePermissions as a6, type SafeJwtAlgorithm as a7, type SecurityMethods as a8, type SubTenant as a9, TenantScopedClient as aA, type TokenResult as aB, TokenVerificationError as aC, type TokenVerificationErrorCode as aD, type UpdateOrganizationInput as aE, type User as aF, UserScopedClient as aG, type ValidateResult as aH, type VerifiedAccessToken as aI, createClient as aJ, normalizeClientIp as aK, tenantFilter as aL, type SubTenantListOptions as aa, type SubjectApprovals as ab, type SubjectSecurity as ac, TENANT_FILTER_MAX_DEPTH as ad, TENANT_FILTER_MAX_VALUES as ae, TENANT_FILTER_MAX_VALUE_LENGTH as af, type TenantAncestor as ag, type TenantClientValidationResult as ah, type TenantCredentialIssued as ai, type TenantCredentialSummary as aj, type TenantFilterExpression as ak, type TenantFilterValue as al, type TenantInvite as am, type TenantInviteAccepted as an, type TenantInviteInput as ao, type TenantInviteIssued as ap, type TenantInviteListOptions as aq, type TenantInvitePreview as ar, type TenantInviteStatus as as, type TenantListOptions as at, type TenantMember as au, type TenantMemberPage as av, type TenantMembership as aw, type TenantOrder as ax, type TenantOrderField as ay, type TenantParent 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-C_iWckru.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-C_iWckru.js';
|
|
2
2
|
import 'jose';
|
|
3
3
|
|
|
4
4
|
interface BffLoginInput {
|
package/dist/index.cjs
CHANGED
|
@@ -207,6 +207,45 @@ function memberQuery(options = {}) {
|
|
|
207
207
|
return { search: search?.trim() || void 0, skip, take };
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
+
// ../../internal/core/http/subTenantQuery.ts
|
|
211
|
+
var ORDER_FIELDS = ["name", "createdAt", "updatedAt"];
|
|
212
|
+
var MAX_FILTERS = 10;
|
|
213
|
+
var MAX_FILTER_LENGTH = 512;
|
|
214
|
+
function orderByParam(order) {
|
|
215
|
+
if (order === void 0) return void 0;
|
|
216
|
+
const field = typeof order === "string" ? order : order?.field;
|
|
217
|
+
const direction = typeof order === "string" ? "asc" : order.direction ?? "asc";
|
|
218
|
+
if (!ORDER_FIELDS.includes(field))
|
|
219
|
+
throw new RangeError(`Authyon: orderBy must be one of ${ORDER_FIELDS.join(", ")}.`);
|
|
220
|
+
if (direction !== "asc" && direction !== "desc")
|
|
221
|
+
throw new RangeError('Authyon: orderBy direction must be "asc" or "desc".');
|
|
222
|
+
return `${field}:${direction}`;
|
|
223
|
+
}
|
|
224
|
+
function subTenantQuery(options = {}) {
|
|
225
|
+
const { filter, orderBy, ...page } = options;
|
|
226
|
+
const query = { ...memberQuery(page) };
|
|
227
|
+
if (filter !== void 0) {
|
|
228
|
+
if (!Array.isArray(filter)) throw new RangeError("Authyon: filter must be an array.");
|
|
229
|
+
const present = filter.filter((f) => typeof f === "string" && f.trim().length > 0);
|
|
230
|
+
if (present.length !== filter.length)
|
|
231
|
+
throw new RangeError("Authyon: a filter may not be empty \u2014 build it with tenantFilter.");
|
|
232
|
+
if (present.length > MAX_FILTERS)
|
|
233
|
+
throw new RangeError(`Authyon: at most ${MAX_FILTERS} filters per request.`);
|
|
234
|
+
for (const f of present) {
|
|
235
|
+
if (f.length > MAX_FILTER_LENGTH)
|
|
236
|
+
throw new RangeError(`Authyon: a filter may hold at most ${MAX_FILTER_LENGTH} characters.`);
|
|
237
|
+
if (!f.startsWith("public."))
|
|
238
|
+
throw new RangeError(
|
|
239
|
+
`Authyon: sub-tenant listings only filter on the public scope (got "${f.split(":")[0]}").`
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
if (present.length > 0) query.filter = present;
|
|
243
|
+
}
|
|
244
|
+
const order = orderByParam(orderBy);
|
|
245
|
+
if (order !== void 0) query.orderBy = order;
|
|
246
|
+
return query;
|
|
247
|
+
}
|
|
248
|
+
|
|
210
249
|
// ../../internal/core/security/approvals.ts
|
|
211
250
|
function path(id, suffix = "") {
|
|
212
251
|
if (typeof id !== "string" || !id.trim())
|
|
@@ -256,6 +295,30 @@ var UserScopedClient = class {
|
|
|
256
295
|
constructor(request, token) {
|
|
257
296
|
__privateAdd(this, _request);
|
|
258
297
|
this.tenants = {
|
|
298
|
+
/**
|
|
299
|
+
* The direct, active sub-tenants of a tenant, acting as the user. One level
|
|
300
|
+
* per call: each row's `childCount` says where the next call is worth
|
|
301
|
+
* making. Needs `subtenants:tree:read` on the tenant or on one above it —
|
|
302
|
+
* even on the user's own tenant, since listing the children is reading
|
|
303
|
+
* below it.
|
|
304
|
+
*
|
|
305
|
+
* Paged like every other `skip`/`take` listing, with `search`, `filter`
|
|
306
|
+
* (public scope only — build them with `tenantFilter`) and `orderBy`; see
|
|
307
|
+
* `SubTenantListOptions`. A bad option raises `RangeError` before any
|
|
308
|
+
* request. Requires the Authyon API of 2026-11-26 or newer.
|
|
309
|
+
*/
|
|
310
|
+
subTenants: {
|
|
311
|
+
/** GET /auth/tenants/{tenantId}/subtenants. */
|
|
312
|
+
list: (tenantId, options = {}) => __privateGet(this, _request).call(this, `/auth/tenants/${segment(tenantId)}/subtenants`, {
|
|
313
|
+
query: subTenantQuery(options)
|
|
314
|
+
}),
|
|
315
|
+
/**
|
|
316
|
+
* GET /auth/tenants/subtenants — the same, for the tenant the user's token
|
|
317
|
+
* is scoped to (its `tenant_id`). Same permission rule. Answers
|
|
318
|
+
* `tenant.no_active_tenant` when the session never switched into one.
|
|
319
|
+
*/
|
|
320
|
+
listCurrent: (options = {}) => __privateGet(this, _request).call(this, "/auth/tenants/subtenants", { query: subTenantQuery(options) })
|
|
321
|
+
},
|
|
259
322
|
members: {
|
|
260
323
|
/** Newest first; `search` matches email, username or name (at most 100 characters). */
|
|
261
324
|
list: (tenantId, options = {}) => __privateGet(this, _request).call(this, `/auth/tenants/${segment(tenantId)}/members`, {
|
|
@@ -1751,7 +1814,7 @@ var AuthyonServerClientBuilder = class {
|
|
|
1751
1814
|
};
|
|
1752
1815
|
_options = new WeakMap();
|
|
1753
1816
|
|
|
1754
|
-
//
|
|
1817
|
+
// ../../internal/core/http/tenantFilters.ts
|
|
1755
1818
|
var TENANT_FILTER_MAX_VALUES = 25;
|
|
1756
1819
|
var TENANT_FILTER_MAX_VALUE_LENGTH = 200;
|
|
1757
1820
|
var TENANT_FILTER_MAX_DEPTH = 3;
|
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, B as BuiltInPermission, 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, D as CredentialPermissionsInput, E as EnvironmentUser, F as FetchHttpAdapter, G as HttpAdapterRequest, I as HttpLogEvent, K as HttpLogger, L as IntrospectResult, M as InviteTenantMemberInput, N as IssuePasswordResetInput, O as JsonWebKeySet, J as JwksTokenVerifier, P as JwksTokenVerifierOptions, Q as LoggingHttpAdapter, R as LoginActivity, S as MemberListOptions, T as OpenIdConfiguration, U as Organization, V as OtpCheckResult, W as Paged, X as PaginationOptions, Y as PasswordResetCompleted, Z as PasswordResetIssued, _ as PasswordResetPreview, $ as Permission, a0 as PermissionsByRole, a1 as ReservedPermissions, a2 as Role, a3 as RoleGrant, a4 as RoleInput, a5 as RoleList, a6 as RolePermissions, a7 as SafeJwtAlgorithm, a8 as SecurityMethods, a9 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-C_iWckru.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, B as BuiltInPermission, 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, D as CredentialPermissionsInput, E as EnvironmentUser, F as FetchHttpAdapter, G as HttpAdapterRequest, I as HttpLogEvent, K as HttpLogger, L as IntrospectResult, M as InviteTenantMemberInput, N as IssuePasswordResetInput, O as JsonWebKeySet, J as JwksTokenVerifier, P as JwksTokenVerifierOptions, Q as LoggingHttpAdapter, R as LoginActivity, S as MemberListOptions, T as OpenIdConfiguration, U as Organization, V as OtpCheckResult, W as Paged, X as PaginationOptions, Y as PasswordResetCompleted, Z as PasswordResetIssued, _ as PasswordResetPreview, $ as Permission, a0 as PermissionsByRole, a1 as ReservedPermissions, a2 as Role, a3 as RoleGrant, a4 as RoleInput, a5 as RoleList, a6 as RolePermissions, a7 as SafeJwtAlgorithm, a8 as SecurityMethods, a9 as SubTenant, aa as SubTenantListOptions, ab as SubjectApprovals, ac as SubjectSecurity, ad as TENANT_FILTER_MAX_DEPTH, ae as TENANT_FILTER_MAX_VALUES, af as TENANT_FILTER_MAX_VALUE_LENGTH, ag as TenantAncestor, ah as TenantClientValidationResult, ai as TenantCredentialIssued, aj as TenantCredentialSummary, ak as TenantFilterExpression, al as TenantFilterValue, am as TenantInvite, an as TenantInviteAccepted, ao as TenantInviteInput, ap as TenantInviteIssued, aq as TenantInviteListOptions, ar as TenantInvitePreview, as as TenantInviteStatus, at as TenantListOptions, au as TenantMember, av as TenantMemberPage, aw as TenantMembership, ax as TenantOrder, ay as TenantOrderField, az as TenantParent, aA as TenantScopedClient, aB as TokenResult, aC as TokenVerificationError, aD as TokenVerificationErrorCode, aE as UpdateOrganizationInput, aF as User, aG as UserScopedClient, aH as ValidateResult, aI as VerifiedAccessToken, aJ as createClient, aK as normalizeClientIp, aL as tenantFilter } from './authyonServerClient-C_iWckru.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-DR079xKg.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, B as BuiltInPermission, 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, D as CredentialPermissionsInput, E as EnvironmentUser, F as FetchHttpAdapter, G as HttpAdapterRequest, I as HttpLogEvent, K as HttpLogger, L as IntrospectResult, M as InviteTenantMemberInput, N as IssuePasswordResetInput, O as JsonWebKeySet, J as JwksTokenVerifier, P as JwksTokenVerifierOptions, Q as LoggingHttpAdapter, R as LoginActivity, S as MemberListOptions, T as OpenIdConfiguration, U as Organization, V as OtpCheckResult, W as Paged, X as PaginationOptions, Y as PasswordResetCompleted, Z as PasswordResetIssued, _ as PasswordResetPreview, $ as Permission, a0 as PermissionsByRole, a1 as ReservedPermissions, a2 as Role, a3 as RoleGrant, a4 as RoleInput, a5 as RoleList, a6 as RolePermissions, a7 as SafeJwtAlgorithm, a8 as SecurityMethods, a9 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-C_iWckru.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, B as BuiltInPermission, 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, D as CredentialPermissionsInput, E as EnvironmentUser, F as FetchHttpAdapter, G as HttpAdapterRequest, I as HttpLogEvent, K as HttpLogger, L as IntrospectResult, M as InviteTenantMemberInput, N as IssuePasswordResetInput, O as JsonWebKeySet, J as JwksTokenVerifier, P as JwksTokenVerifierOptions, Q as LoggingHttpAdapter, R as LoginActivity, S as MemberListOptions, T as OpenIdConfiguration, U as Organization, V as OtpCheckResult, W as Paged, X as PaginationOptions, Y as PasswordResetCompleted, Z as PasswordResetIssued, _ as PasswordResetPreview, $ as Permission, a0 as PermissionsByRole, a1 as ReservedPermissions, a2 as Role, a3 as RoleGrant, a4 as RoleInput, a5 as RoleList, a6 as RolePermissions, a7 as SafeJwtAlgorithm, a8 as SecurityMethods, a9 as SubTenant, aa as SubTenantListOptions, ab as SubjectApprovals, ac as SubjectSecurity, ad as TENANT_FILTER_MAX_DEPTH, ae as TENANT_FILTER_MAX_VALUES, af as TENANT_FILTER_MAX_VALUE_LENGTH, ag as TenantAncestor, ah as TenantClientValidationResult, ai as TenantCredentialIssued, aj as TenantCredentialSummary, ak as TenantFilterExpression, al as TenantFilterValue, am as TenantInvite, an as TenantInviteAccepted, ao as TenantInviteInput, ap as TenantInviteIssued, aq as TenantInviteListOptions, ar as TenantInvitePreview, as as TenantInviteStatus, at as TenantListOptions, au as TenantMember, av as TenantMemberPage, aw as TenantMembership, ax as TenantOrder, ay as TenantOrderField, az as TenantParent, aA as TenantScopedClient, aB as TokenResult, aC as TokenVerificationError, aD as TokenVerificationErrorCode, aE as UpdateOrganizationInput, aF as User, aG as UserScopedClient, aH as ValidateResult, aI as VerifiedAccessToken, aJ as createClient, aK as normalizeClientIp, aL as tenantFilter } from './authyonServerClient-C_iWckru.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-Dkawj1IN.js';
|
|
4
4
|
import 'jose';
|
|
5
5
|
|
|
6
6
|
declare const ErrorCodes: {
|
package/dist/index.js
CHANGED
|
@@ -179,6 +179,45 @@ function memberQuery(options = {}) {
|
|
|
179
179
|
return { search: search?.trim() || void 0, skip, take };
|
|
180
180
|
}
|
|
181
181
|
|
|
182
|
+
// ../../internal/core/http/subTenantQuery.ts
|
|
183
|
+
var ORDER_FIELDS = ["name", "createdAt", "updatedAt"];
|
|
184
|
+
var MAX_FILTERS = 10;
|
|
185
|
+
var MAX_FILTER_LENGTH = 512;
|
|
186
|
+
function orderByParam(order) {
|
|
187
|
+
if (order === void 0) return void 0;
|
|
188
|
+
const field = typeof order === "string" ? order : order?.field;
|
|
189
|
+
const direction = typeof order === "string" ? "asc" : order.direction ?? "asc";
|
|
190
|
+
if (!ORDER_FIELDS.includes(field))
|
|
191
|
+
throw new RangeError(`Authyon: orderBy must be one of ${ORDER_FIELDS.join(", ")}.`);
|
|
192
|
+
if (direction !== "asc" && direction !== "desc")
|
|
193
|
+
throw new RangeError('Authyon: orderBy direction must be "asc" or "desc".');
|
|
194
|
+
return `${field}:${direction}`;
|
|
195
|
+
}
|
|
196
|
+
function subTenantQuery(options = {}) {
|
|
197
|
+
const { filter, orderBy, ...page } = options;
|
|
198
|
+
const query = { ...memberQuery(page) };
|
|
199
|
+
if (filter !== void 0) {
|
|
200
|
+
if (!Array.isArray(filter)) throw new RangeError("Authyon: filter must be an array.");
|
|
201
|
+
const present = filter.filter((f) => typeof f === "string" && f.trim().length > 0);
|
|
202
|
+
if (present.length !== filter.length)
|
|
203
|
+
throw new RangeError("Authyon: a filter may not be empty \u2014 build it with tenantFilter.");
|
|
204
|
+
if (present.length > MAX_FILTERS)
|
|
205
|
+
throw new RangeError(`Authyon: at most ${MAX_FILTERS} filters per request.`);
|
|
206
|
+
for (const f of present) {
|
|
207
|
+
if (f.length > MAX_FILTER_LENGTH)
|
|
208
|
+
throw new RangeError(`Authyon: a filter may hold at most ${MAX_FILTER_LENGTH} characters.`);
|
|
209
|
+
if (!f.startsWith("public."))
|
|
210
|
+
throw new RangeError(
|
|
211
|
+
`Authyon: sub-tenant listings only filter on the public scope (got "${f.split(":")[0]}").`
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
if (present.length > 0) query.filter = present;
|
|
215
|
+
}
|
|
216
|
+
const order = orderByParam(orderBy);
|
|
217
|
+
if (order !== void 0) query.orderBy = order;
|
|
218
|
+
return query;
|
|
219
|
+
}
|
|
220
|
+
|
|
182
221
|
// ../../internal/core/security/approvals.ts
|
|
183
222
|
function path(id, suffix = "") {
|
|
184
223
|
if (typeof id !== "string" || !id.trim())
|
|
@@ -228,6 +267,30 @@ var UserScopedClient = class {
|
|
|
228
267
|
constructor(request, token) {
|
|
229
268
|
__privateAdd(this, _request);
|
|
230
269
|
this.tenants = {
|
|
270
|
+
/**
|
|
271
|
+
* The direct, active sub-tenants of a tenant, acting as the user. One level
|
|
272
|
+
* per call: each row's `childCount` says where the next call is worth
|
|
273
|
+
* making. Needs `subtenants:tree:read` on the tenant or on one above it —
|
|
274
|
+
* even on the user's own tenant, since listing the children is reading
|
|
275
|
+
* below it.
|
|
276
|
+
*
|
|
277
|
+
* Paged like every other `skip`/`take` listing, with `search`, `filter`
|
|
278
|
+
* (public scope only — build them with `tenantFilter`) and `orderBy`; see
|
|
279
|
+
* `SubTenantListOptions`. A bad option raises `RangeError` before any
|
|
280
|
+
* request. Requires the Authyon API of 2026-11-26 or newer.
|
|
281
|
+
*/
|
|
282
|
+
subTenants: {
|
|
283
|
+
/** GET /auth/tenants/{tenantId}/subtenants. */
|
|
284
|
+
list: (tenantId, options = {}) => __privateGet(this, _request).call(this, `/auth/tenants/${segment(tenantId)}/subtenants`, {
|
|
285
|
+
query: subTenantQuery(options)
|
|
286
|
+
}),
|
|
287
|
+
/**
|
|
288
|
+
* GET /auth/tenants/subtenants — the same, for the tenant the user's token
|
|
289
|
+
* is scoped to (its `tenant_id`). Same permission rule. Answers
|
|
290
|
+
* `tenant.no_active_tenant` when the session never switched into one.
|
|
291
|
+
*/
|
|
292
|
+
listCurrent: (options = {}) => __privateGet(this, _request).call(this, "/auth/tenants/subtenants", { query: subTenantQuery(options) })
|
|
293
|
+
},
|
|
231
294
|
members: {
|
|
232
295
|
/** Newest first; `search` matches email, username or name (at most 100 characters). */
|
|
233
296
|
list: (tenantId, options = {}) => __privateGet(this, _request).call(this, `/auth/tenants/${segment(tenantId)}/members`, {
|
|
@@ -1213,7 +1276,7 @@ var AuthyonServerClientBuilder = class {
|
|
|
1213
1276
|
};
|
|
1214
1277
|
_options = new WeakMap();
|
|
1215
1278
|
|
|
1216
|
-
//
|
|
1279
|
+
// ../../internal/core/http/tenantFilters.ts
|
|
1217
1280
|
var TENANT_FILTER_MAX_VALUES = 25;
|
|
1218
1281
|
var TENANT_FILTER_MAX_VALUE_LENGTH = 200;
|
|
1219
1282
|
var TENANT_FILTER_MAX_DEPTH = 3;
|
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-DR079xKg.cjs';
|
|
3
|
+
import { A as AuthyonServerClient } from './authyonServerClient-C_iWckru.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-Dkawj1IN.js';
|
|
3
|
+
import { A as AuthyonServerClient } from './authyonServerClient-C_iWckru.js';
|
|
4
4
|
import 'jose';
|
|
5
5
|
|
|
6
6
|
interface ServerPermissionGuardFallbackContext {
|
package/package.json
CHANGED