authhero 8.23.1 → 8.24.0
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/dist/assets/u/widget/index.esm.js +1 -1
- package/dist/authhero.cjs +139 -142
- package/dist/authhero.d.ts +349 -145
- package/dist/authhero.mjs +19659 -15484
- package/dist/tsconfig.types.tsbuildinfo +1 -1
- package/dist/types/adapters/control-plane-custom-domains.d.ts +35 -0
- package/dist/types/authentication-flows/passwordless.d.ts +5 -5
- package/dist/types/helpers/control-plane-client.d.ts +46 -0
- package/dist/types/helpers/control-plane-sync-events.d.ts +12 -28
- package/dist/types/index.d.ts +174 -100
- package/dist/types/routes/auth-api/index.d.ts +24 -24
- package/dist/types/routes/auth-api/passwordless.d.ts +8 -8
- package/dist/types/routes/auth-api/revoke.d.ts +6 -6
- package/dist/types/routes/auth-api/token.d.ts +10 -10
- package/dist/types/routes/management-api/authentication-methods.d.ts +1 -1
- package/dist/types/routes/management-api/branding.d.ts +1 -1
- package/dist/types/routes/management-api/clients.d.ts +6 -6
- package/dist/types/routes/management-api/connections.d.ts +15 -15
- package/dist/types/routes/management-api/email-templates.d.ts +18 -18
- package/dist/types/routes/management-api/failed-events.d.ts +1 -1
- package/dist/types/routes/management-api/guardian.d.ts +5 -5
- package/dist/types/routes/management-api/helpers.d.ts +47 -0
- package/dist/types/routes/management-api/index.d.ts +140 -71
- package/dist/types/routes/management-api/logs.d.ts +4 -4
- package/dist/types/routes/management-api/migration-sources.d.ts +6 -6
- package/dist/types/routes/management-api/organizations.d.ts +2 -2
- package/dist/types/routes/management-api/prompts.d.ts +4 -4
- package/dist/types/routes/management-api/roles.d.ts +1 -1
- package/dist/types/routes/management-api/tenant-export-import.d.ts +5 -5
- package/dist/types/routes/management-api/tenants.d.ts +1 -1
- package/dist/types/routes/management-api/users.d.ts +71 -2
- package/dist/types/routes/proxy-control-plane/custom-domains.d.ts +45 -0
- package/dist/types/routes/proxy-control-plane/index.d.ts +24 -6
- package/dist/types/routes/proxy-control-plane/scopes.d.ts +13 -0
- package/dist/types/routes/proxy-control-plane/verify.d.ts +15 -4
- package/dist/types/routes/universal-login/common.d.ts +6 -6
- package/dist/types/routes/universal-login/identifier.d.ts +2 -2
- package/dist/types/routes/universal-login/index.d.ts +2 -2
- package/dist/types/routes/universal-login/u2-index.d.ts +3 -3
- package/dist/types/routes/universal-login/u2-routes.d.ts +3 -3
- package/dist/types/types/AuthHeroConfig.d.ts +22 -7
- package/dist/types/types/IdToken.d.ts +4 -4
- package/package.json +6 -6
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { CustomDomainsAdapter } from "@authhero/adapter-interfaces";
|
|
2
|
+
import { ControlPlaneClient } from "../helpers/control-plane-client";
|
|
3
|
+
export declare const CONTROL_PLANE_CUSTOM_DOMAINS_PATH = "/api/v2/proxy/control-plane/custom-domains";
|
|
4
|
+
export interface ControlPlaneCustomDomainsOptions {
|
|
5
|
+
/** Authed transport to the control plane. */
|
|
6
|
+
client: ControlPlaneClient;
|
|
7
|
+
/**
|
|
8
|
+
* Local read-cache for custom domains — normally the shard's own database
|
|
9
|
+
* adapter (`database.customDomains`). The control plane owns the row; this
|
|
10
|
+
* mirror exists so `getByDomain` (tenant resolution, a hot path) and `list`
|
|
11
|
+
* don't need a network hop.
|
|
12
|
+
*/
|
|
13
|
+
mirror: CustomDomainsAdapter;
|
|
14
|
+
/** Override the control-plane resource path (tests, custom mounts). */
|
|
15
|
+
basePath?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A `CustomDomainsAdapter` for a tenant shard that cannot register hostnames
|
|
19
|
+
* itself: a CF-for-SaaS custom hostname is an account-global resource in one
|
|
20
|
+
* shared zone, and only the control plane holds the account credentials — and
|
|
21
|
+
* only something above all shards can see that `login.acme.com` is already
|
|
22
|
+
* claimed by another tenant.
|
|
23
|
+
*
|
|
24
|
+
* So the control plane is authoritative: writes go there synchronously and the
|
|
25
|
+
* result is mirrored into the shard's own database as a read cache. On a
|
|
26
|
+
* conflict nothing is written locally, which is what prevents the
|
|
27
|
+
* half-provisioned, unroutable row this replaces.
|
|
28
|
+
*
|
|
29
|
+
* Reads trust the mirror once a domain is `ready`. A `pending` domain flips to
|
|
30
|
+
* `ready` on Cloudflare's timeline (after the customer adds the DV record) and
|
|
31
|
+
* that transition happens at the control plane, so a non-ready row is
|
|
32
|
+
* refreshed from upstream on read. `getByDomain` always reads the mirror — it
|
|
33
|
+
* is on the tenant-resolution path and must not take a network hop.
|
|
34
|
+
*/
|
|
35
|
+
export declare function createControlPlaneCustomDomainsAdapter(options: ControlPlaneCustomDomainsOptions): CustomDomainsAdapter;
|
|
@@ -367,7 +367,7 @@ export declare function passwordlessGrantUser(ctx: Context<{
|
|
|
367
367
|
active?: boolean | undefined;
|
|
368
368
|
} | undefined;
|
|
369
369
|
signup?: {
|
|
370
|
-
status?: "
|
|
370
|
+
status?: "optional" | "required" | "disabled" | undefined;
|
|
371
371
|
verification?: {
|
|
372
372
|
active?: boolean | undefined;
|
|
373
373
|
} | undefined;
|
|
@@ -384,7 +384,7 @@ export declare function passwordlessGrantUser(ctx: Context<{
|
|
|
384
384
|
active?: boolean | undefined;
|
|
385
385
|
} | undefined;
|
|
386
386
|
signup?: {
|
|
387
|
-
status?: "
|
|
387
|
+
status?: "optional" | "required" | "disabled" | undefined;
|
|
388
388
|
} | undefined;
|
|
389
389
|
validation?: {
|
|
390
390
|
max_length?: number | undefined;
|
|
@@ -401,7 +401,7 @@ export declare function passwordlessGrantUser(ctx: Context<{
|
|
|
401
401
|
active?: boolean | undefined;
|
|
402
402
|
} | undefined;
|
|
403
403
|
signup?: {
|
|
404
|
-
status?: "
|
|
404
|
+
status?: "optional" | "required" | "disabled" | undefined;
|
|
405
405
|
} | undefined;
|
|
406
406
|
} | undefined;
|
|
407
407
|
} | undefined;
|
|
@@ -549,8 +549,8 @@ export declare function passwordlessGrantUser(ctx: Context<{
|
|
|
549
549
|
} | undefined;
|
|
550
550
|
authenticated_at?: string | undefined;
|
|
551
551
|
};
|
|
552
|
-
connectionType: "
|
|
553
|
-
authConnection: "
|
|
552
|
+
connectionType: "sms" | "email" | "username";
|
|
553
|
+
authConnection: "sms" | "email" | "username";
|
|
554
554
|
session_id: string | undefined;
|
|
555
555
|
authParams: {
|
|
556
556
|
client_id: string;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mints a bearer token for a tenant against the control plane. On a tenant
|
|
3
|
+
* shard this is `createServiceTokenCore` bound to the shard's own tenants/keys
|
|
4
|
+
* adapters — the control plane verifies it against the shard's published JWKS,
|
|
5
|
+
* so no shared client secret is involved.
|
|
6
|
+
*/
|
|
7
|
+
export type GetControlPlaneToken = (tenantId: string, scope: string) => Promise<string>;
|
|
8
|
+
export interface ControlPlaneClientOptions {
|
|
9
|
+
/** Base URL of the control-plane authhero instance, no trailing slash required. */
|
|
10
|
+
baseUrl: string;
|
|
11
|
+
getServiceToken: GetControlPlaneToken;
|
|
12
|
+
/** Per-request timeout (default: 5s). */
|
|
13
|
+
timeoutMs?: number;
|
|
14
|
+
/** Refresh a cached token this many seconds before it expires (default: 60). */
|
|
15
|
+
tokenRefreshSkewSeconds?: number;
|
|
16
|
+
/** Override for tests, or to route over a Cloudflare service binding. */
|
|
17
|
+
fetchImpl?: typeof fetch;
|
|
18
|
+
}
|
|
19
|
+
export interface ControlPlaneRequest {
|
|
20
|
+
tenantId: string;
|
|
21
|
+
scope: string;
|
|
22
|
+
method: "GET" | "POST" | "PATCH" | "PUT" | "DELETE";
|
|
23
|
+
/** Path below the base URL, e.g. `/api/v2/proxy/control-plane/custom-domains`. */
|
|
24
|
+
path: string;
|
|
25
|
+
body?: unknown;
|
|
26
|
+
}
|
|
27
|
+
export interface ControlPlaneResponse {
|
|
28
|
+
status: number;
|
|
29
|
+
/** Parsed JSON body, or null for empty/non-JSON responses. */
|
|
30
|
+
data: unknown;
|
|
31
|
+
}
|
|
32
|
+
export interface ControlPlaneClient {
|
|
33
|
+
/**
|
|
34
|
+
* Perform an authed request. Returns the status and parsed body for ANY HTTP
|
|
35
|
+
* response — including 4xx/5xx — so callers can map status to domain
|
|
36
|
+
* semantics (409 → conflict, 404 → null). Throws only when the request never
|
|
37
|
+
* produced a response (network error, timeout, token minting failure).
|
|
38
|
+
*/
|
|
39
|
+
request(req: ControlPlaneRequest): Promise<ControlPlaneResponse>;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Authed transport to the control plane with an in-memory, per-(tenant, scope)
|
|
43
|
+
* token cache and single-flight minting. Shared by every control-plane-backed
|
|
44
|
+
* adapter so the token handling exists once.
|
|
45
|
+
*/
|
|
46
|
+
export declare function createControlPlaneClient(options: ControlPlaneClientOptions): ControlPlaneClient;
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import { Context } from "hono";
|
|
2
|
-
import {
|
|
2
|
+
import { ProxyRoute } from "@authhero/adapter-interfaces";
|
|
3
3
|
import { Bindings, Variables } from "../types";
|
|
4
4
|
export declare const CONTROL_PLANE_SYNC_EVENT_PREFIX = "controlplane.sync.";
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Only `proxy_route` replicates upward. Custom domains used to sync the same
|
|
7
|
+
* way, which is exactly what left them half-provisioned: the row reached the
|
|
8
|
+
* control plane but nothing ever registered the hostname in Cloudflare. They
|
|
9
|
+
* are now written through the control plane synchronously
|
|
10
|
+
* (`createControlPlaneCustomDomainsAdapter`), which owns the row and performs
|
|
11
|
+
* the account-level side effect.
|
|
12
|
+
*/
|
|
13
|
+
export type SyncEntity = "proxy_route";
|
|
6
14
|
export type SyncOp = "created" | "updated" | "deleted";
|
|
7
15
|
/**
|
|
8
16
|
* Wire shape posted from the tenant shard to the control plane. The destination
|
|
@@ -11,34 +19,10 @@ export type SyncOp = "created" | "updated" | "deleted";
|
|
|
11
19
|
* batched-delivery destination.
|
|
12
20
|
*/
|
|
13
21
|
export type SyncEvent = {
|
|
14
|
-
event_id: string;
|
|
15
|
-
tenant_id: string;
|
|
16
|
-
entity: "custom_domain";
|
|
17
|
-
op: "created" | "updated";
|
|
18
|
-
aggregate_id: string;
|
|
19
|
-
payload: CustomDomain;
|
|
20
|
-
occurred_at: string;
|
|
21
|
-
} | {
|
|
22
|
-
event_id: string;
|
|
23
|
-
tenant_id: string;
|
|
24
|
-
entity: "custom_domain";
|
|
25
|
-
op: "deleted";
|
|
26
|
-
aggregate_id: string;
|
|
27
|
-
payload: CustomDomain;
|
|
28
|
-
occurred_at: string;
|
|
29
|
-
} | {
|
|
30
22
|
event_id: string;
|
|
31
23
|
tenant_id: string;
|
|
32
24
|
entity: "proxy_route";
|
|
33
|
-
op:
|
|
34
|
-
aggregate_id: string;
|
|
35
|
-
payload: ProxyRoute;
|
|
36
|
-
occurred_at: string;
|
|
37
|
-
} | {
|
|
38
|
-
event_id: string;
|
|
39
|
-
tenant_id: string;
|
|
40
|
-
entity: "proxy_route";
|
|
41
|
-
op: "deleted";
|
|
25
|
+
op: SyncOp;
|
|
42
26
|
aggregate_id: string;
|
|
43
27
|
payload: ProxyRoute;
|
|
44
28
|
occurred_at: string;
|
|
@@ -48,7 +32,7 @@ interface EnqueueArgs {
|
|
|
48
32
|
entity: SyncEntity;
|
|
49
33
|
op: SyncOp;
|
|
50
34
|
aggregateId: string;
|
|
51
|
-
payload:
|
|
35
|
+
payload: ProxyRoute;
|
|
52
36
|
}
|
|
53
37
|
/**
|
|
54
38
|
* Enqueue a `controlplane.sync.*` event to the outbox so the
|