@authyon/server 0.2.0-beta.17 → 0.2.0-beta.19

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
@@ -295,8 +295,10 @@ const page = await authyon.environment.tenants.credentials.listPage(tenantId, {
295
295
  const detail = await authyon.environment.tenants.credentials.get(tenantId, credentialId);
296
296
  ```
297
297
 
298
- `page` contém `data`, `perPage` (número da página, começando em 1), `pageSize`,
299
- `total`, `pages`, `hasNext` e `hasPrev`. `take` aceita 1–100 (padrão da API: 25),
298
+ `page` contém `data`, `page` (a página atual, começando em 1), `perPage` (o
299
+ limite por página), `total`, `pages`, `hasNext` e `hasPrev`. Até a API de
300
+ 2026-10-21 os dois campos se chamavam `perPage` (página) e `pageSize`
301
+ (limite), nessa ordem trocada. `take` aceita 1–100 (padrão da API: 25),
300
302
  `skip` é um deslocamento a partir de zero e `search` aceita até 200 caracteres.
301
303
  A API pesquisa clientId, descrição e permissões antes de paginar.
302
304
 
@@ -426,6 +428,34 @@ Por padrão o link aponta para a página do Authyon; configure a _URL do convite
426
428
  tenant_ nas configurações do ambiente para usar a sua (ela recebe `token` e `env`).
427
429
  Aceitar não faz login.
428
430
 
431
+ ## Redefinição de senha pelo seu próprio e-mail
432
+
433
+ Para a sua aplicação disparar o e-mail de redefinição em vez do Authyon, emita o token no
434
+ backend (escopo `authyon:users:password`) e entregue você mesmo:
435
+
436
+ ```ts
437
+ const reset = await authyon.environment.users.issuePasswordReset({
438
+ email: "pessoa@example.com",
439
+ // Opcional: para onde mandar a pessoa depois de trocar a senha. Precisa estar
440
+ // cadastrado (match exato) nos redirect URIs do ambiente.
441
+ redirectUri: "https://app.example.com/login",
442
+ // sendEmail: true faria o Authyon enviar também; o padrão é false.
443
+ });
444
+ reset.token; // só aparece aqui — a API guarda apenas o hash
445
+ reset.resetUrl; // o link que o e-mail do Authyon levaria
446
+ reset.expiresAt; // 30 minutos
447
+
448
+ // Página de redefinição no seu backend: públicas, usam só o envKey.
449
+ const preview = await authyon.environment.users.validatePasswordReset(token); // não gasta o token
450
+ const done = await authyon.environment.users.confirmPasswordReset(token, newPassword);
451
+ if (done.redirectUri) redirect(done.redirectUri); // o redirect fica por sua conta
452
+ ```
453
+
454
+ Quem tem o token consegue definir a senha: envie somente para o endereço da própria conta e
455
+ não registre em log. Emitir um token novo invalida o anterior da mesma conta. Um endereço
456
+ sem conta responde `404 user.not_found`; token desconhecido, usado ou expirado responde
457
+ `401 user.password_reset.invalid`.
458
+
429
459
  ## Compatibilidade e segurança do transporte
430
460
 
431
461
  As chamadas exigem os endpoints externos atuais da API e a migração
@@ -1,4 +1,4 @@
1
- import { K as JwksTokenVerifier, A as AuthyonServerClient } from './authyonServerClient-1_1qNRDa.js';
1
+ import { L as JwksTokenVerifier, A as AuthyonServerClient } from './authyonServerClient-D1IeZFrS.js';
2
2
 
3
3
  type AbilitySubject = string | Record<string, unknown>;
4
4
  type AbilityConditions = Record<string, unknown>;
@@ -1,4 +1,4 @@
1
- import { K as JwksTokenVerifier, A as AuthyonServerClient } from './authyonServerClient-1_1qNRDa.cjs';
1
+ import { L as JwksTokenVerifier, A as AuthyonServerClient } from './authyonServerClient-D1IeZFrS.cjs';
2
2
 
3
3
  type AbilitySubject = string | Record<string, unknown>;
4
4
  type AbilityConditions = Record<string, unknown>;
@@ -137,10 +137,20 @@ interface PaginationOptions {
137
137
  skip?: number;
138
138
  take?: number;
139
139
  }
140
+ /**
141
+ * The envelope every paged endpoint answers with.
142
+ *
143
+ * `page` is the 1-based current page and `perPage` is how many items a page
144
+ * holds — the same sense `take` has on the way in. Up to Authyon API
145
+ * 2026-10-21 the two were named `perPage` (holding the page number) and
146
+ * `pageSize` (holding the limit), so reading them by their names gave the
147
+ * wrong value without failing. Clients on the older API see `page` undefined
148
+ * and `perPage` holding a page number.
149
+ */
140
150
  interface Paged<T> {
141
151
  data: T[];
142
- perPage?: number;
143
- pageSize: number;
152
+ page: number;
153
+ perPage: number;
144
154
  total: number;
145
155
  pages: number;
146
156
  hasNext: boolean;
@@ -233,8 +243,13 @@ interface EnvironmentUser {
233
243
  refreshTokens?: unknown[];
234
244
  tenantIds: string[];
235
245
  tenantMemberships?: TenantMembership[];
236
- /** Flattened role names across all tenant memberships (list() only). */
246
+ /** Flattened role names across all tenant memberships (list() only).
247
+ * On `tenants.members.list()` it is scoped to that one tenant. */
237
248
  tenantRoles?: string[];
249
+ /** Permissions granted to this member directly inside the tenant, beside
250
+ * whatever their tenant roles carry. Only `tenants.members.list()` fills
251
+ * it; absent on an API older than 2026-10-21. */
252
+ tenantPermissions?: string[];
238
253
  twoFactorMethods: string[];
239
254
  totpConfirmedAt?: string | null;
240
255
  emailOtpEnabledAt?: string | null;
@@ -530,6 +545,45 @@ interface TenantInviteInput {
530
545
  */
531
546
  redirectUri?: string;
532
547
  }
548
+ /** POST /env/password-resets — issue a reset for an account of the environment. */
549
+ interface IssuePasswordResetInput {
550
+ email: string;
551
+ /**
552
+ * Where to send the person after they change the password. Must be
553
+ * registered exactly in the environment's redirect URIs; otherwise the API
554
+ * rejects with `user.password_reset.redirect_uri.not_allowed`.
555
+ */
556
+ redirectUri?: string;
557
+ /**
558
+ * `true` has Authyon mail the link as well. Defaults to `false`: the point
559
+ * of this call is to deliver the token through your own e-mail.
560
+ */
561
+ sendEmail?: boolean;
562
+ }
563
+ /** Returned when a reset is issued. `token` is only ever readable here — the
564
+ * API keeps its hash. Whoever holds it can set the password: send it only to
565
+ * the account's own address and never log it. */
566
+ interface PasswordResetIssued {
567
+ userId: string;
568
+ email: string;
569
+ token: string;
570
+ /** The link Authyon's own e-mail would carry: the environment's reset page
571
+ * when it has one, the hosted page otherwise. */
572
+ resetUrl: string;
573
+ expiresAt: string;
574
+ emailSent: boolean;
575
+ redirectUri: string | null;
576
+ }
577
+ /** What a live reset token is for. */
578
+ interface PasswordResetPreview {
579
+ email: string;
580
+ expiresAt: string;
581
+ redirectUri: string | null;
582
+ }
583
+ /** The password is changed. Following `redirectUri` is up to you. */
584
+ interface PasswordResetCompleted {
585
+ redirectUri: string | null;
586
+ }
533
587
  /** Returned when an invite is created or re-issued. `acceptUrl` is only ever
534
588
  * readable here — the API keeps a hash of the token, not the token. */
535
589
  interface TenantInviteIssued {
@@ -866,6 +920,29 @@ declare class AuthyonServerClient {
866
920
  unlock: (userId: string, reason?: string) => Promise<void>;
867
921
  /** POST /env/users/{userId}/password — sets a new password for the user. */
868
922
  setPassword: (userId: string, newPassword: string, reason?: string) => Promise<void>;
923
+ /**
924
+ * POST /env/password-resets — issues a password-reset token for the
925
+ * account with this address and returns it, so your application can
926
+ * deliver it in its own e-mail instead of Authyon's. Needs the
927
+ * `authyon:users:password` scope. Unlike the public forgot-password
928
+ * request, an unknown address rejects with `user.not_found` (404).
929
+ * A previous live token for the same account stops working.
930
+ */
931
+ issuePasswordReset: (input: IssuePasswordResetInput) => Promise<PasswordResetIssued>;
932
+ /**
933
+ * POST /auth/password-reset/validate — for a backend hosting the reset
934
+ * page: checks a token without spending it. Public, needs only the
935
+ * `envKey`. Rejects with `user.password_reset.invalid` (401) when the
936
+ * token is unknown, used or expired.
937
+ */
938
+ validatePasswordReset: (token: string) => Promise<PasswordResetPreview>;
939
+ /**
940
+ * POST /auth/password-reset/confirm — redeems the token and sets the new
941
+ * password (every session of the account is signed out). Public, needs
942
+ * only the `envKey`. Resolves with the `redirectUri` the reset was issued
943
+ * with, or `null`.
944
+ */
945
+ confirmPasswordReset: (token: string, newPassword: string) => Promise<PasswordResetCompleted>;
869
946
  /** POST /env/users/{userId}/sessions/revoke-all — revokes every session the user has. */
870
947
  revokeSessions: (userId: string, reason?: string) => Promise<void>;
871
948
  /** DELETE /env/users/{userId}/sessions/{sessionId} — revokes a single session. */
@@ -898,7 +975,18 @@ declare class AuthyonServerClient {
898
975
  updateScopes: (tenantId: string, credentialId: string, scopes: readonly string[]) => Promise<void>;
899
976
  revoke: (tenantId: string, credentialId: string) => Promise<void>;
900
977
  };
901
- /** GET /env/tenants — paginated, searchable list of tenants in the environment. */
978
+ /**
979
+ * GET /env/tenants — one page of the environment's tenants.
980
+ *
981
+ * `search` matches, case-insensitively and anywhere in the value, the
982
+ * name, the slug, the description and the raw text of both metadata
983
+ * documents — so a tenant filed with `{"cnpj":"00.000.000/0001-00"}`
984
+ * is found by the number, and `cnpj` alone finds every tenant carrying
985
+ * that key. `take` defaults to 25 and is capped at 100.
986
+ *
987
+ * Against an Authyon API older than 2026-10-21 this route ignored
988
+ * skip/take/search and answered with a bare array.
989
+ */
902
990
  list: (params?: {
903
991
  search?: string;
904
992
  } & PaginationOptions) => Promise<Paged<Organization>>;
@@ -917,10 +1005,14 @@ declare class AuthyonServerClient {
917
1005
  members: {
918
1006
  /**
919
1007
  * GET /env/tenants/{tenantId}/members — a tenant's members as full
920
- * user records. Confirmed live: a bare array (unlike
921
- * `environment.users.list()`, this one does NOT paginate despite
922
- * accepting `skip`/`take`), with the same shape
923
- * `environment.users.list()` items have.
1008
+ * user records, with the same shape `environment.users.list()` items
1009
+ * have, plus `tenantRoles` and `tenantPermissions` scoped to this
1010
+ * tenant.
1011
+ *
1012
+ * Confirmed live: the response is a bare array, with no envelope and
1013
+ * no total — but `skip`/`take` DO apply, and `take` defaults to 50.
1014
+ * A tenant with more than 50 members gives you 50 and says nothing,
1015
+ * so page it yourself until a short page comes back.
924
1016
  */
925
1017
  list: (tenantId: string, params?: PaginationOptions) => Promise<EnvironmentUser[]>;
926
1018
  /** POST /env/tenants/{tenantId}/members — add a member to a tenant. */
@@ -1136,4 +1228,4 @@ declare class TenantScopedClient {
1136
1228
  /** Convenience factory: `const authyon = createClient({ clientId, clientSecret })`. */
1137
1229
  declare function createClient(options?: AuthyonServerClientOptions): AuthyonServerClient;
1138
1230
 
1139
- export { type SafeJwtAlgorithm as $, AuthyonServerClient as A, type HttpLogEvent as B, type ClientCredentials as C, type HttpLogger as D, type EnvironmentUser as E, FetchHttpAdapter as F, type InviteTenantMemberInput as G, type HttpAdapter as H, type IntrospectResult as I, type JsonWebKeySet as J, JwksTokenVerifier as K, type JwksTokenVerifierOptions as L, LoggingHttpAdapter as M, type LoginActivity as N, type OpenIdConfiguration as O, type Organization as P, type OtpCheckResult as Q, type Paged as R, type PaginationOptions as S, type Permission as T, type PermissionsByRole as U, type ReservedPermissions as V, type Role as W, type RoleGrant as X, type RoleInput as Y, type RoleList as Z, type RolePermissions as _, type HttpLoggerOptions as a, type SecurityMethods as a0, type SubjectApprovals as a1, type SubjectSecurity as a2, type TenantClientValidationResult as a3, type TenantCredentialIssued as a4, type TenantCredentialSummary as a5, type TenantInvite as a6, type TenantInviteAccepted as a7, type TenantInviteInput as a8, type TenantInviteIssued as a9, type TenantInvitePreview as aa, type TenantInviteStatus as ab, type TenantMember as ac, type TenantMemberPage as ad, type TenantMembership as ae, TenantScopedClient as af, type TokenResult as ag, TokenVerificationError as ah, type TokenVerificationErrorCode as ai, type UpdateOrganizationInput as aj, type User as ak, UserScopedClient as al, type ValidateResult as am, type VerifiedAccessToken as an, createClient as ao, normalizeClientIp as ap, 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 ClientRequestContext as m, type ConfirmApprovalInput as n, type ConsumedApproval as o, type CreateApprovalInput as p, type CreateCredentialInput as q, type CreateOrganizationInput as r, type CreatePermissionInput as s, type CreateTenantCredentialInput as t, type CreateUserInput as u, type CredentialCreator as v, type CredentialDetail as w, type CredentialListOptions as x, type CredentialPermissionsInput as y, type HttpAdapterRequest as z };
1231
+ export { type RoleGrant as $, AuthyonServerClient as A, type HttpLogEvent as B, type ClientCredentials as C, type HttpLogger as D, type EnvironmentUser as E, FetchHttpAdapter as F, type InviteTenantMemberInput as G, type HttpAdapter as H, type IntrospectResult as I, type IssuePasswordResetInput as J, type JsonWebKeySet as K, JwksTokenVerifier as L, type JwksTokenVerifierOptions as M, LoggingHttpAdapter as N, type LoginActivity as O, type OpenIdConfiguration as P, type Organization as Q, type OtpCheckResult as R, type Paged as S, type PaginationOptions as T, type PasswordResetCompleted as U, type PasswordResetIssued as V, type PasswordResetPreview as W, type Permission as X, type PermissionsByRole as Y, type ReservedPermissions as Z, type Role as _, type HttpLoggerOptions as a, type RoleInput as a0, type RoleList as a1, type RolePermissions as a2, type SafeJwtAlgorithm as a3, type SecurityMethods as a4, type SubjectApprovals as a5, type SubjectSecurity as a6, type TenantClientValidationResult as a7, type TenantCredentialIssued as a8, type TenantCredentialSummary as a9, type TenantInvite as aa, type TenantInviteAccepted as ab, type TenantInviteInput as ac, type TenantInviteIssued as ad, type TenantInvitePreview as ae, type TenantInviteStatus as af, type TenantMember as ag, type TenantMemberPage as ah, type TenantMembership as ai, TenantScopedClient as aj, type TokenResult as ak, TokenVerificationError as al, type TokenVerificationErrorCode as am, type UpdateOrganizationInput as an, type User as ao, UserScopedClient as ap, type ValidateResult as aq, type VerifiedAccessToken as ar, createClient as as, normalizeClientIp as at, 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 ClientRequestContext as m, type ConfirmApprovalInput as n, type ConsumedApproval as o, type CreateApprovalInput as p, type CreateCredentialInput as q, type CreateOrganizationInput as r, type CreatePermissionInput as s, type CreateTenantCredentialInput as t, type CreateUserInput as u, type CredentialCreator as v, type CredentialDetail as w, type CredentialListOptions as x, type CredentialPermissionsInput as y, type HttpAdapterRequest as z };
@@ -137,10 +137,20 @@ interface PaginationOptions {
137
137
  skip?: number;
138
138
  take?: number;
139
139
  }
140
+ /**
141
+ * The envelope every paged endpoint answers with.
142
+ *
143
+ * `page` is the 1-based current page and `perPage` is how many items a page
144
+ * holds — the same sense `take` has on the way in. Up to Authyon API
145
+ * 2026-10-21 the two were named `perPage` (holding the page number) and
146
+ * `pageSize` (holding the limit), so reading them by their names gave the
147
+ * wrong value without failing. Clients on the older API see `page` undefined
148
+ * and `perPage` holding a page number.
149
+ */
140
150
  interface Paged<T> {
141
151
  data: T[];
142
- perPage?: number;
143
- pageSize: number;
152
+ page: number;
153
+ perPage: number;
144
154
  total: number;
145
155
  pages: number;
146
156
  hasNext: boolean;
@@ -233,8 +243,13 @@ interface EnvironmentUser {
233
243
  refreshTokens?: unknown[];
234
244
  tenantIds: string[];
235
245
  tenantMemberships?: TenantMembership[];
236
- /** Flattened role names across all tenant memberships (list() only). */
246
+ /** Flattened role names across all tenant memberships (list() only).
247
+ * On `tenants.members.list()` it is scoped to that one tenant. */
237
248
  tenantRoles?: string[];
249
+ /** Permissions granted to this member directly inside the tenant, beside
250
+ * whatever their tenant roles carry. Only `tenants.members.list()` fills
251
+ * it; absent on an API older than 2026-10-21. */
252
+ tenantPermissions?: string[];
238
253
  twoFactorMethods: string[];
239
254
  totpConfirmedAt?: string | null;
240
255
  emailOtpEnabledAt?: string | null;
@@ -530,6 +545,45 @@ interface TenantInviteInput {
530
545
  */
531
546
  redirectUri?: string;
532
547
  }
548
+ /** POST /env/password-resets — issue a reset for an account of the environment. */
549
+ interface IssuePasswordResetInput {
550
+ email: string;
551
+ /**
552
+ * Where to send the person after they change the password. Must be
553
+ * registered exactly in the environment's redirect URIs; otherwise the API
554
+ * rejects with `user.password_reset.redirect_uri.not_allowed`.
555
+ */
556
+ redirectUri?: string;
557
+ /**
558
+ * `true` has Authyon mail the link as well. Defaults to `false`: the point
559
+ * of this call is to deliver the token through your own e-mail.
560
+ */
561
+ sendEmail?: boolean;
562
+ }
563
+ /** Returned when a reset is issued. `token` is only ever readable here — the
564
+ * API keeps its hash. Whoever holds it can set the password: send it only to
565
+ * the account's own address and never log it. */
566
+ interface PasswordResetIssued {
567
+ userId: string;
568
+ email: string;
569
+ token: string;
570
+ /** The link Authyon's own e-mail would carry: the environment's reset page
571
+ * when it has one, the hosted page otherwise. */
572
+ resetUrl: string;
573
+ expiresAt: string;
574
+ emailSent: boolean;
575
+ redirectUri: string | null;
576
+ }
577
+ /** What a live reset token is for. */
578
+ interface PasswordResetPreview {
579
+ email: string;
580
+ expiresAt: string;
581
+ redirectUri: string | null;
582
+ }
583
+ /** The password is changed. Following `redirectUri` is up to you. */
584
+ interface PasswordResetCompleted {
585
+ redirectUri: string | null;
586
+ }
533
587
  /** Returned when an invite is created or re-issued. `acceptUrl` is only ever
534
588
  * readable here — the API keeps a hash of the token, not the token. */
535
589
  interface TenantInviteIssued {
@@ -866,6 +920,29 @@ declare class AuthyonServerClient {
866
920
  unlock: (userId: string, reason?: string) => Promise<void>;
867
921
  /** POST /env/users/{userId}/password — sets a new password for the user. */
868
922
  setPassword: (userId: string, newPassword: string, reason?: string) => Promise<void>;
923
+ /**
924
+ * POST /env/password-resets — issues a password-reset token for the
925
+ * account with this address and returns it, so your application can
926
+ * deliver it in its own e-mail instead of Authyon's. Needs the
927
+ * `authyon:users:password` scope. Unlike the public forgot-password
928
+ * request, an unknown address rejects with `user.not_found` (404).
929
+ * A previous live token for the same account stops working.
930
+ */
931
+ issuePasswordReset: (input: IssuePasswordResetInput) => Promise<PasswordResetIssued>;
932
+ /**
933
+ * POST /auth/password-reset/validate — for a backend hosting the reset
934
+ * page: checks a token without spending it. Public, needs only the
935
+ * `envKey`. Rejects with `user.password_reset.invalid` (401) when the
936
+ * token is unknown, used or expired.
937
+ */
938
+ validatePasswordReset: (token: string) => Promise<PasswordResetPreview>;
939
+ /**
940
+ * POST /auth/password-reset/confirm — redeems the token and sets the new
941
+ * password (every session of the account is signed out). Public, needs
942
+ * only the `envKey`. Resolves with the `redirectUri` the reset was issued
943
+ * with, or `null`.
944
+ */
945
+ confirmPasswordReset: (token: string, newPassword: string) => Promise<PasswordResetCompleted>;
869
946
  /** POST /env/users/{userId}/sessions/revoke-all — revokes every session the user has. */
870
947
  revokeSessions: (userId: string, reason?: string) => Promise<void>;
871
948
  /** DELETE /env/users/{userId}/sessions/{sessionId} — revokes a single session. */
@@ -898,7 +975,18 @@ declare class AuthyonServerClient {
898
975
  updateScopes: (tenantId: string, credentialId: string, scopes: readonly string[]) => Promise<void>;
899
976
  revoke: (tenantId: string, credentialId: string) => Promise<void>;
900
977
  };
901
- /** GET /env/tenants — paginated, searchable list of tenants in the environment. */
978
+ /**
979
+ * GET /env/tenants — one page of the environment's tenants.
980
+ *
981
+ * `search` matches, case-insensitively and anywhere in the value, the
982
+ * name, the slug, the description and the raw text of both metadata
983
+ * documents — so a tenant filed with `{"cnpj":"00.000.000/0001-00"}`
984
+ * is found by the number, and `cnpj` alone finds every tenant carrying
985
+ * that key. `take` defaults to 25 and is capped at 100.
986
+ *
987
+ * Against an Authyon API older than 2026-10-21 this route ignored
988
+ * skip/take/search and answered with a bare array.
989
+ */
902
990
  list: (params?: {
903
991
  search?: string;
904
992
  } & PaginationOptions) => Promise<Paged<Organization>>;
@@ -917,10 +1005,14 @@ declare class AuthyonServerClient {
917
1005
  members: {
918
1006
  /**
919
1007
  * GET /env/tenants/{tenantId}/members — a tenant's members as full
920
- * user records. Confirmed live: a bare array (unlike
921
- * `environment.users.list()`, this one does NOT paginate despite
922
- * accepting `skip`/`take`), with the same shape
923
- * `environment.users.list()` items have.
1008
+ * user records, with the same shape `environment.users.list()` items
1009
+ * have, plus `tenantRoles` and `tenantPermissions` scoped to this
1010
+ * tenant.
1011
+ *
1012
+ * Confirmed live: the response is a bare array, with no envelope and
1013
+ * no total — but `skip`/`take` DO apply, and `take` defaults to 50.
1014
+ * A tenant with more than 50 members gives you 50 and says nothing,
1015
+ * so page it yourself until a short page comes back.
924
1016
  */
925
1017
  list: (tenantId: string, params?: PaginationOptions) => Promise<EnvironmentUser[]>;
926
1018
  /** POST /env/tenants/{tenantId}/members — add a member to a tenant. */
@@ -1136,4 +1228,4 @@ declare class TenantScopedClient {
1136
1228
  /** Convenience factory: `const authyon = createClient({ clientId, clientSecret })`. */
1137
1229
  declare function createClient(options?: AuthyonServerClientOptions): AuthyonServerClient;
1138
1230
 
1139
- export { type SafeJwtAlgorithm as $, AuthyonServerClient as A, type HttpLogEvent as B, type ClientCredentials as C, type HttpLogger as D, type EnvironmentUser as E, FetchHttpAdapter as F, type InviteTenantMemberInput as G, type HttpAdapter as H, type IntrospectResult as I, type JsonWebKeySet as J, JwksTokenVerifier as K, type JwksTokenVerifierOptions as L, LoggingHttpAdapter as M, type LoginActivity as N, type OpenIdConfiguration as O, type Organization as P, type OtpCheckResult as Q, type Paged as R, type PaginationOptions as S, type Permission as T, type PermissionsByRole as U, type ReservedPermissions as V, type Role as W, type RoleGrant as X, type RoleInput as Y, type RoleList as Z, type RolePermissions as _, type HttpLoggerOptions as a, type SecurityMethods as a0, type SubjectApprovals as a1, type SubjectSecurity as a2, type TenantClientValidationResult as a3, type TenantCredentialIssued as a4, type TenantCredentialSummary as a5, type TenantInvite as a6, type TenantInviteAccepted as a7, type TenantInviteInput as a8, type TenantInviteIssued as a9, type TenantInvitePreview as aa, type TenantInviteStatus as ab, type TenantMember as ac, type TenantMemberPage as ad, type TenantMembership as ae, TenantScopedClient as af, type TokenResult as ag, TokenVerificationError as ah, type TokenVerificationErrorCode as ai, type UpdateOrganizationInput as aj, type User as ak, UserScopedClient as al, type ValidateResult as am, type VerifiedAccessToken as an, createClient as ao, normalizeClientIp as ap, 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 ClientRequestContext as m, type ConfirmApprovalInput as n, type ConsumedApproval as o, type CreateApprovalInput as p, type CreateCredentialInput as q, type CreateOrganizationInput as r, type CreatePermissionInput as s, type CreateTenantCredentialInput as t, type CreateUserInput as u, type CredentialCreator as v, type CredentialDetail as w, type CredentialListOptions as x, type CredentialPermissionsInput as y, type HttpAdapterRequest as z };
1231
+ export { type RoleGrant as $, AuthyonServerClient as A, type HttpLogEvent as B, type ClientCredentials as C, type HttpLogger as D, type EnvironmentUser as E, FetchHttpAdapter as F, type InviteTenantMemberInput as G, type HttpAdapter as H, type IntrospectResult as I, type IssuePasswordResetInput as J, type JsonWebKeySet as K, JwksTokenVerifier as L, type JwksTokenVerifierOptions as M, LoggingHttpAdapter as N, type LoginActivity as O, type OpenIdConfiguration as P, type Organization as Q, type OtpCheckResult as R, type Paged as S, type PaginationOptions as T, type PasswordResetCompleted as U, type PasswordResetIssued as V, type PasswordResetPreview as W, type Permission as X, type PermissionsByRole as Y, type ReservedPermissions as Z, type Role as _, type HttpLoggerOptions as a, type RoleInput as a0, type RoleList as a1, type RolePermissions as a2, type SafeJwtAlgorithm as a3, type SecurityMethods as a4, type SubjectApprovals as a5, type SubjectSecurity as a6, type TenantClientValidationResult as a7, type TenantCredentialIssued as a8, type TenantCredentialSummary as a9, type TenantInvite as aa, type TenantInviteAccepted as ab, type TenantInviteInput as ac, type TenantInviteIssued as ad, type TenantInvitePreview as ae, type TenantInviteStatus as af, type TenantMember as ag, type TenantMemberPage as ah, type TenantMembership as ai, TenantScopedClient as aj, type TokenResult as ak, TokenVerificationError as al, type TokenVerificationErrorCode as am, type UpdateOrganizationInput as an, type User as ao, UserScopedClient as ap, type ValidateResult as aq, type VerifiedAccessToken as ar, createClient as as, normalizeClientIp as at, 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 ClientRequestContext as m, type ConfirmApprovalInput as n, type ConsumedApproval as o, type CreateApprovalInput as p, type CreateCredentialInput as q, type CreateOrganizationInput as r, type CreatePermissionInput as s, type CreateTenantCredentialInput as t, type CreateUserInput as u, type CredentialCreator as v, type CredentialDetail as w, type CredentialListOptions as x, type CredentialPermissionsInput as y, type HttpAdapterRequest 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_1qNRDa.cjs';
1
+ import { H as HttpAdapter, a as HttpLoggerOptions, A as AuthyonServerClient } from './authyonServerClient-D1IeZFrS.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_1qNRDa.js';
1
+ import { H as HttpAdapter, a as HttpLoggerOptions, A as AuthyonServerClient } from './authyonServerClient-D1IeZFrS.js';
2
2
  import 'jose';
3
3
 
4
4
  interface BffLoginInput {
package/dist/index.cjs CHANGED
@@ -131,8 +131,8 @@ async function credentialPage(request, path2, options = {}) {
131
131
  throw new TypeError("Authyon: expected a paginated credential response.");
132
132
  return {
133
133
  data: page.data.map(credentialSummary),
134
- ...page.perPage === void 0 ? {} : { perPage: page.perPage },
135
- pageSize: page.pageSize,
134
+ page: page.page,
135
+ perPage: page.perPage,
136
136
  total: page.total,
137
137
  pages: page.pages,
138
138
  hasNext: page.hasNext,
@@ -881,6 +881,39 @@ var AuthyonServerClient = class {
881
881
  envBearer: true,
882
882
  body: { newPassword, reason }
883
883
  }),
884
+ /**
885
+ * POST /env/password-resets — issues a password-reset token for the
886
+ * account with this address and returns it, so your application can
887
+ * deliver it in its own e-mail instead of Authyon's. Needs the
888
+ * `authyon:users:password` scope. Unlike the public forgot-password
889
+ * request, an unknown address rejects with `user.not_found` (404).
890
+ * A previous live token for the same account stops working.
891
+ */
892
+ issuePasswordReset: (input) => this.request("/env/password-resets", {
893
+ method: "POST",
894
+ envBearer: true,
895
+ body: { ...input, sendEmail: input.sendEmail ?? false }
896
+ }),
897
+ /**
898
+ * POST /auth/password-reset/validate — for a backend hosting the reset
899
+ * page: checks a token without spending it. Public, needs only the
900
+ * `envKey`. Rejects with `user.password_reset.invalid` (401) when the
901
+ * token is unknown, used or expired.
902
+ */
903
+ validatePasswordReset: (token) => this.request("/auth/password-reset/validate", { method: "POST", body: { token } }),
904
+ /**
905
+ * POST /auth/password-reset/confirm — redeems the token and sets the new
906
+ * password (every session of the account is signed out). Public, needs
907
+ * only the `envKey`. Resolves with the `redirectUri` the reset was issued
908
+ * with, or `null`.
909
+ */
910
+ confirmPasswordReset: async (token, newPassword) => {
911
+ const done = await this.request(
912
+ "/auth/password-reset/confirm",
913
+ { method: "POST", body: { token, newPassword } }
914
+ );
915
+ return { redirectUri: done?.redirectUri ?? null };
916
+ },
884
917
  /** POST /env/users/{userId}/sessions/revoke-all — revokes every session the user has. */
885
918
  revokeSessions: (userId, reason) => this.request(`/env/users/${encodeURIComponent(userId)}/sessions/revoke-all`, {
886
919
  method: "POST",
@@ -974,7 +1007,18 @@ var AuthyonServerClient = class {
974
1007
  envBearer: true
975
1008
  })
976
1009
  },
977
- /** GET /env/tenants — paginated, searchable list of tenants in the environment. */
1010
+ /**
1011
+ * GET /env/tenants — one page of the environment's tenants.
1012
+ *
1013
+ * `search` matches, case-insensitively and anywhere in the value, the
1014
+ * name, the slug, the description and the raw text of both metadata
1015
+ * documents — so a tenant filed with `{"cnpj":"00.000.000/0001-00"}`
1016
+ * is found by the number, and `cnpj` alone finds every tenant carrying
1017
+ * that key. `take` defaults to 25 and is capped at 100.
1018
+ *
1019
+ * Against an Authyon API older than 2026-10-21 this route ignored
1020
+ * skip/take/search and answered with a bare array.
1021
+ */
978
1022
  list: (params = {}) => this.request("/env/tenants", { envBearer: true, query: params }),
979
1023
  /** POST /env/tenants — create a tenant in the environment. */
980
1024
  create: (input) => this.request("/env/tenants", { method: "POST", envBearer: true, body: input }),
@@ -1005,10 +1049,14 @@ var AuthyonServerClient = class {
1005
1049
  members: {
1006
1050
  /**
1007
1051
  * GET /env/tenants/{tenantId}/members — a tenant's members as full
1008
- * user records. Confirmed live: a bare array (unlike
1009
- * `environment.users.list()`, this one does NOT paginate despite
1010
- * accepting `skip`/`take`), with the same shape
1011
- * `environment.users.list()` items have.
1052
+ * user records, with the same shape `environment.users.list()` items
1053
+ * have, plus `tenantRoles` and `tenantPermissions` scoped to this
1054
+ * tenant.
1055
+ *
1056
+ * Confirmed live: the response is a bare array, with no envelope and
1057
+ * no total — but `skip`/`take` DO apply, and `take` defaults to 50.
1058
+ * A tenant with more than 50 members gives you 50 and says nothing,
1059
+ * so page it yourself until a short page comes back.
1012
1060
  */
1013
1061
  list: (tenantId, params = {}) => this.request(`/env/tenants/${encodeURIComponent(tenantId)}/members`, {
1014
1062
  envBearer: true,
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
- import { H as HttpAdapter, a as HttpLoggerOptions, A as AuthyonServerClient } from './authyonServerClient-1_1qNRDa.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, C as ClientCredentials, m as ClientRequestContext, n as ConfirmApprovalInput, o as ConsumedApproval, p as CreateApprovalInput, q as CreateCredentialInput, r as CreateOrganizationInput, s as CreatePermissionInput, t as CreateTenantCredentialInput, u as CreateUserInput, v as CredentialCreator, w as CredentialDetail, x as CredentialListOptions, y as CredentialPermissionsInput, E as EnvironmentUser, F as FetchHttpAdapter, z as HttpAdapterRequest, B as HttpLogEvent, D as HttpLogger, I as IntrospectResult, G as InviteTenantMemberInput, J as JsonWebKeySet, K as JwksTokenVerifier, L as JwksTokenVerifierOptions, M as LoggingHttpAdapter, N as LoginActivity, O as OpenIdConfiguration, P as Organization, Q as OtpCheckResult, R as Paged, S as PaginationOptions, T as Permission, U as PermissionsByRole, V as ReservedPermissions, W as Role, X as RoleGrant, Y as RoleInput, Z as RoleList, _ as RolePermissions, $ as SafeJwtAlgorithm, a0 as SecurityMethods, a1 as SubjectApprovals, a2 as SubjectSecurity, a3 as TenantClientValidationResult, a4 as TenantCredentialIssued, a5 as TenantCredentialSummary, a6 as TenantInvite, a7 as TenantInviteAccepted, a8 as TenantInviteInput, a9 as TenantInviteIssued, aa as TenantInvitePreview, ab as TenantInviteStatus, ac as TenantMember, ad as TenantMemberPage, ae as TenantMembership, af as TenantScopedClient, ag as TokenResult, ah as TokenVerificationError, ai as TokenVerificationErrorCode, aj as UpdateOrganizationInput, ak as User, al as UserScopedClient, am as ValidateResult, an as VerifiedAccessToken, ao as createClient, ap as normalizeClientIp } from './authyonServerClient-1_1qNRDa.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-C0Mg5gUv.cjs';
1
+ import { H as HttpAdapter, a as HttpLoggerOptions, A as AuthyonServerClient } from './authyonServerClient-D1IeZFrS.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, C as ClientCredentials, m as ClientRequestContext, n as ConfirmApprovalInput, o as ConsumedApproval, p as CreateApprovalInput, q as CreateCredentialInput, r as CreateOrganizationInput, s as CreatePermissionInput, t as CreateTenantCredentialInput, u as CreateUserInput, v as CredentialCreator, w as CredentialDetail, x as CredentialListOptions, y as CredentialPermissionsInput, E as EnvironmentUser, F as FetchHttpAdapter, z as HttpAdapterRequest, B as HttpLogEvent, D as HttpLogger, I as IntrospectResult, G as InviteTenantMemberInput, J as IssuePasswordResetInput, K as JsonWebKeySet, L as JwksTokenVerifier, M as JwksTokenVerifierOptions, N as LoggingHttpAdapter, O as LoginActivity, P as OpenIdConfiguration, Q as Organization, R as OtpCheckResult, S as Paged, T as PaginationOptions, U as PasswordResetCompleted, V as PasswordResetIssued, W as PasswordResetPreview, X as Permission, Y as PermissionsByRole, Z as ReservedPermissions, _ as Role, $ as RoleGrant, a0 as RoleInput, a1 as RoleList, a2 as RolePermissions, a3 as SafeJwtAlgorithm, a4 as SecurityMethods, a5 as SubjectApprovals, a6 as SubjectSecurity, a7 as TenantClientValidationResult, a8 as TenantCredentialIssued, a9 as TenantCredentialSummary, aa as TenantInvite, ab as TenantInviteAccepted, ac as TenantInviteInput, ad as TenantInviteIssued, ae as TenantInvitePreview, af as TenantInviteStatus, ag as TenantMember, ah as TenantMemberPage, ai as TenantMembership, aj as TenantScopedClient, ak as TokenResult, al as TokenVerificationError, am as TokenVerificationErrorCode, an as UpdateOrganizationInput, ao as User, ap as UserScopedClient, aq as ValidateResult, ar as VerifiedAccessToken, as as createClient, at as normalizeClientIp } from './authyonServerClient-D1IeZFrS.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-EEV7lntD.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-1_1qNRDa.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, C as ClientCredentials, m as ClientRequestContext, n as ConfirmApprovalInput, o as ConsumedApproval, p as CreateApprovalInput, q as CreateCredentialInput, r as CreateOrganizationInput, s as CreatePermissionInput, t as CreateTenantCredentialInput, u as CreateUserInput, v as CredentialCreator, w as CredentialDetail, x as CredentialListOptions, y as CredentialPermissionsInput, E as EnvironmentUser, F as FetchHttpAdapter, z as HttpAdapterRequest, B as HttpLogEvent, D as HttpLogger, I as IntrospectResult, G as InviteTenantMemberInput, J as JsonWebKeySet, K as JwksTokenVerifier, L as JwksTokenVerifierOptions, M as LoggingHttpAdapter, N as LoginActivity, O as OpenIdConfiguration, P as Organization, Q as OtpCheckResult, R as Paged, S as PaginationOptions, T as Permission, U as PermissionsByRole, V as ReservedPermissions, W as Role, X as RoleGrant, Y as RoleInput, Z as RoleList, _ as RolePermissions, $ as SafeJwtAlgorithm, a0 as SecurityMethods, a1 as SubjectApprovals, a2 as SubjectSecurity, a3 as TenantClientValidationResult, a4 as TenantCredentialIssued, a5 as TenantCredentialSummary, a6 as TenantInvite, a7 as TenantInviteAccepted, a8 as TenantInviteInput, a9 as TenantInviteIssued, aa as TenantInvitePreview, ab as TenantInviteStatus, ac as TenantMember, ad as TenantMemberPage, ae as TenantMembership, af as TenantScopedClient, ag as TokenResult, ah as TokenVerificationError, ai as TokenVerificationErrorCode, aj as UpdateOrganizationInput, ak as User, al as UserScopedClient, am as ValidateResult, an as VerifiedAccessToken, ao as createClient, ap as normalizeClientIp } from './authyonServerClient-1_1qNRDa.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-BvjIWPcU.js';
1
+ import { H as HttpAdapter, a as HttpLoggerOptions, A as AuthyonServerClient } from './authyonServerClient-D1IeZFrS.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, C as ClientCredentials, m as ClientRequestContext, n as ConfirmApprovalInput, o as ConsumedApproval, p as CreateApprovalInput, q as CreateCredentialInput, r as CreateOrganizationInput, s as CreatePermissionInput, t as CreateTenantCredentialInput, u as CreateUserInput, v as CredentialCreator, w as CredentialDetail, x as CredentialListOptions, y as CredentialPermissionsInput, E as EnvironmentUser, F as FetchHttpAdapter, z as HttpAdapterRequest, B as HttpLogEvent, D as HttpLogger, I as IntrospectResult, G as InviteTenantMemberInput, J as IssuePasswordResetInput, K as JsonWebKeySet, L as JwksTokenVerifier, M as JwksTokenVerifierOptions, N as LoggingHttpAdapter, O as LoginActivity, P as OpenIdConfiguration, Q as Organization, R as OtpCheckResult, S as Paged, T as PaginationOptions, U as PasswordResetCompleted, V as PasswordResetIssued, W as PasswordResetPreview, X as Permission, Y as PermissionsByRole, Z as ReservedPermissions, _ as Role, $ as RoleGrant, a0 as RoleInput, a1 as RoleList, a2 as RolePermissions, a3 as SafeJwtAlgorithm, a4 as SecurityMethods, a5 as SubjectApprovals, a6 as SubjectSecurity, a7 as TenantClientValidationResult, a8 as TenantCredentialIssued, a9 as TenantCredentialSummary, aa as TenantInvite, ab as TenantInviteAccepted, ac as TenantInviteInput, ad as TenantInviteIssued, ae as TenantInvitePreview, af as TenantInviteStatus, ag as TenantMember, ah as TenantMemberPage, ai as TenantMembership, aj as TenantScopedClient, ak as TokenResult, al as TokenVerificationError, am as TokenVerificationErrorCode, an as UpdateOrganizationInput, ao as User, ap as UserScopedClient, aq as ValidateResult, ar as VerifiedAccessToken, as as createClient, at as normalizeClientIp } from './authyonServerClient-D1IeZFrS.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-7g-KNTTk.js';
4
4
  import 'jose';
5
5
 
6
6
  declare const ErrorCodes: {
package/dist/index.js CHANGED
@@ -109,8 +109,8 @@ async function credentialPage(request, path2, options = {}) {
109
109
  throw new TypeError("Authyon: expected a paginated credential response.");
110
110
  return {
111
111
  data: page.data.map(credentialSummary),
112
- ...page.perPage === void 0 ? {} : { perPage: page.perPage },
113
- pageSize: page.pageSize,
112
+ page: page.page,
113
+ perPage: page.perPage,
114
114
  total: page.total,
115
115
  pages: page.pages,
116
116
  hasNext: page.hasNext,
@@ -358,6 +358,39 @@ var AuthyonServerClient = class {
358
358
  envBearer: true,
359
359
  body: { newPassword, reason }
360
360
  }),
361
+ /**
362
+ * POST /env/password-resets — issues a password-reset token for the
363
+ * account with this address and returns it, so your application can
364
+ * deliver it in its own e-mail instead of Authyon's. Needs the
365
+ * `authyon:users:password` scope. Unlike the public forgot-password
366
+ * request, an unknown address rejects with `user.not_found` (404).
367
+ * A previous live token for the same account stops working.
368
+ */
369
+ issuePasswordReset: (input) => this.request("/env/password-resets", {
370
+ method: "POST",
371
+ envBearer: true,
372
+ body: { ...input, sendEmail: input.sendEmail ?? false }
373
+ }),
374
+ /**
375
+ * POST /auth/password-reset/validate — for a backend hosting the reset
376
+ * page: checks a token without spending it. Public, needs only the
377
+ * `envKey`. Rejects with `user.password_reset.invalid` (401) when the
378
+ * token is unknown, used or expired.
379
+ */
380
+ validatePasswordReset: (token) => this.request("/auth/password-reset/validate", { method: "POST", body: { token } }),
381
+ /**
382
+ * POST /auth/password-reset/confirm — redeems the token and sets the new
383
+ * password (every session of the account is signed out). Public, needs
384
+ * only the `envKey`. Resolves with the `redirectUri` the reset was issued
385
+ * with, or `null`.
386
+ */
387
+ confirmPasswordReset: async (token, newPassword) => {
388
+ const done = await this.request(
389
+ "/auth/password-reset/confirm",
390
+ { method: "POST", body: { token, newPassword } }
391
+ );
392
+ return { redirectUri: done?.redirectUri ?? null };
393
+ },
361
394
  /** POST /env/users/{userId}/sessions/revoke-all — revokes every session the user has. */
362
395
  revokeSessions: (userId, reason) => this.request(`/env/users/${encodeURIComponent(userId)}/sessions/revoke-all`, {
363
396
  method: "POST",
@@ -451,7 +484,18 @@ var AuthyonServerClient = class {
451
484
  envBearer: true
452
485
  })
453
486
  },
454
- /** GET /env/tenants — paginated, searchable list of tenants in the environment. */
487
+ /**
488
+ * GET /env/tenants — one page of the environment's tenants.
489
+ *
490
+ * `search` matches, case-insensitively and anywhere in the value, the
491
+ * name, the slug, the description and the raw text of both metadata
492
+ * documents — so a tenant filed with `{"cnpj":"00.000.000/0001-00"}`
493
+ * is found by the number, and `cnpj` alone finds every tenant carrying
494
+ * that key. `take` defaults to 25 and is capped at 100.
495
+ *
496
+ * Against an Authyon API older than 2026-10-21 this route ignored
497
+ * skip/take/search and answered with a bare array.
498
+ */
455
499
  list: (params = {}) => this.request("/env/tenants", { envBearer: true, query: params }),
456
500
  /** POST /env/tenants — create a tenant in the environment. */
457
501
  create: (input) => this.request("/env/tenants", { method: "POST", envBearer: true, body: input }),
@@ -482,10 +526,14 @@ var AuthyonServerClient = class {
482
526
  members: {
483
527
  /**
484
528
  * GET /env/tenants/{tenantId}/members — a tenant's members as full
485
- * user records. Confirmed live: a bare array (unlike
486
- * `environment.users.list()`, this one does NOT paginate despite
487
- * accepting `skip`/`take`), with the same shape
488
- * `environment.users.list()` items have.
529
+ * user records, with the same shape `environment.users.list()` items
530
+ * have, plus `tenantRoles` and `tenantPermissions` scoped to this
531
+ * tenant.
532
+ *
533
+ * Confirmed live: the response is a bare array, with no envelope and
534
+ * no total — but `skip`/`take` DO apply, and `take` defaults to 50.
535
+ * A tenant with more than 50 members gives you 50 and says nothing,
536
+ * so page it yourself until a short page comes back.
489
537
  */
490
538
  list: (tenantId, params = {}) => this.request(`/env/tenants/${encodeURIComponent(tenantId)}/members`, {
491
539
  envBearer: true,
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-C0Mg5gUv.cjs';
3
- import { A as AuthyonServerClient } from './authyonServerClient-1_1qNRDa.cjs';
2
+ import { R as RequestAuthorizationOptions, A as AbilitySubject, a as AuthorizationError } from './authorization-EEV7lntD.cjs';
3
+ import { A as AuthyonServerClient } from './authyonServerClient-D1IeZFrS.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-BvjIWPcU.js';
3
- import { A as AuthyonServerClient } from './authyonServerClient-1_1qNRDa.js';
2
+ import { R as RequestAuthorizationOptions, A as AbilitySubject, a as AuthorizationError } from './authorization-7g-KNTTk.js';
3
+ import { A as AuthyonServerClient } from './authyonServerClient-D1IeZFrS.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.17",
3
+ "version": "0.2.0-beta.19",
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",