@authhero/cloudflare-adapter 3.4.0 → 4.0.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/cloudflare-adapter.cjs +1 -1
- package/dist/cloudflare-adapter.d.ts +25 -7
- package/dist/cloudflare-adapter.mjs +212 -212
- package/dist/tsconfig.types.tsbuildinfo +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/wfp-provisioner/index.d.ts +1 -1
- package/dist/types/wfp-provisioner/wfp-forward.d.ts +24 -6
- package/package.json +2 -2
package/dist/types/index.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export { createAnalyticsEngineOutboxMetricsSink } from "./analytics-engine-outbo
|
|
|
23
23
|
export type { AnalyticsEngineOutboxMetricsConfig, OutboxMetricRecord, } from "./analytics-engine-outbox-metrics";
|
|
24
24
|
export { createR2SQLLogsAdapter } from "./r2-sql-logs";
|
|
25
25
|
export { createR2SQLStatsAdapter } from "./r2-sql-logs";
|
|
26
|
-
export { createCloudflareWfpD1Provisioner, createWfpProvisionerSteps, createWfpTenantProvisioningHook, createWfpForwardMiddleware, CloudflareApiClient, CloudflareApiError, } from "./wfp-provisioner";
|
|
26
|
+
export { createCloudflareWfpD1Provisioner, createWfpProvisionerSteps, createWfpTenantProvisioningHook, createWfpForwardMiddleware, DEFAULT_LOCAL_PATHS, CloudflareApiClient, CloudflareApiError, } from "./wfp-provisioner";
|
|
27
27
|
export type { CloudflareWfpD1Provisioner, CloudflareWfpD1ProvisionerOptions, TenantProvisionerSteps, TenantProvisionNames, WfpProvisionerSteps, ProvisionResult, ProvisionerMigration, TenantSecretsResolver, WfpTenantProvisioningHook, WfpTenantProvisioningHookOptions, CfApiClientOptions, D1Database, D1QueryResult, ScriptBinding, ScriptUploadOptions, WfpForwardOptions, } from "./wfp-provisioner";
|
|
28
28
|
export interface CloudflareAdapters {
|
|
29
29
|
customDomains: CustomDomainsAdapter;
|
|
@@ -5,7 +5,7 @@ export { collectSyncDefaultsErrors } from "./sync-defaults-errors";
|
|
|
5
5
|
export type { CloudflareWfpD1Provisioner, CloudflareWfpD1ProvisionerOptions, ProvisionResult, ProvisionerMigration, TenantSecretsResolver, } from "./types";
|
|
6
6
|
export { createWfpTenantProvisioningHook } from "./tenant-hook";
|
|
7
7
|
export type { WfpTenantProvisioningHook, WfpTenantProvisioningHookOptions, } from "./tenant-hook";
|
|
8
|
-
export { createWfpForwardMiddleware } from "./wfp-forward";
|
|
8
|
+
export { createWfpForwardMiddleware, DEFAULT_LOCAL_PATHS } from "./wfp-forward";
|
|
9
9
|
export type { WfpForwardOptions } from "./wfp-forward";
|
|
10
10
|
export { CloudflareApiClient, CloudflareApiError } from "./cf-api";
|
|
11
11
|
export type { CfApiClientOptions, D1Database, D1QueryResult, ScriptBinding, ScriptUploadOptions, } from "./cf-api";
|
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
import type { Context, MiddlewareHandler } from "hono";
|
|
2
2
|
import type { TenantsDataAdapter } from "@authhero/adapter-interfaces";
|
|
3
|
+
/**
|
|
4
|
+
* Path prefixes served from the control plane rather than dispatched to a
|
|
5
|
+
* tenant worker. These are shared static assets that are byte-identical across
|
|
6
|
+
* tenants and only exist on the control plane's deployment.
|
|
7
|
+
*
|
|
8
|
+
* `/u/widget/` is the universal-login (u2) widget bundle. It's a multi-file
|
|
9
|
+
* Stencil bundle the SSR'd pages load as an ES module to hydrate the form. A
|
|
10
|
+
* per-tenant dispatch worker has no static-assets binding and no configured
|
|
11
|
+
* `widgetHandler`, so forwarding these requests 404s and the u2 buttons render
|
|
12
|
+
* inert. Serving them from the control plane — where the assets live — keeps
|
|
13
|
+
* zero per-tenant weight.
|
|
14
|
+
*/
|
|
15
|
+
export declare const DEFAULT_LOCAL_PATHS: readonly string[];
|
|
3
16
|
export interface WfpForwardOptions {
|
|
4
17
|
/** Tenants adapter, used to look up the resolved tenant's `deployment_type`. */
|
|
5
18
|
tenants: TenantsDataAdapter;
|
|
@@ -29,11 +42,16 @@ export interface WfpForwardOptions {
|
|
|
29
42
|
* handlers.
|
|
30
43
|
*
|
|
31
44
|
* Use this for shared static assets that only the control plane can serve —
|
|
32
|
-
* a per-tenant dispatch worker has no static-assets binding.
|
|
33
|
-
* `
|
|
34
|
-
*
|
|
45
|
+
* a per-tenant dispatch worker has no static-assets binding. These are added
|
|
46
|
+
* to `DEFAULT_LOCAL_PATHS` (the universal-login widget bundle), so a default
|
|
47
|
+
* added later is not lost by anyone who passes their own list.
|
|
35
48
|
*/
|
|
36
49
|
localPaths?: string[];
|
|
50
|
+
/**
|
|
51
|
+
* Whether `DEFAULT_LOCAL_PATHS` apply. Defaults to `true`; pass `false` to
|
|
52
|
+
* dispatch even the default paths and carve out only `localPaths`.
|
|
53
|
+
*/
|
|
54
|
+
includeDefaultLocalPaths?: boolean;
|
|
37
55
|
}
|
|
38
56
|
/**
|
|
39
57
|
* Hono middleware that forwards a request to its tenant's WFP worker over a
|
|
@@ -49,8 +67,8 @@ export interface WfpForwardOptions {
|
|
|
49
67
|
* The tenant worker receives the original request verbatim and owns the full
|
|
50
68
|
* response.
|
|
51
69
|
*
|
|
52
|
-
* Requests whose path matches `
|
|
53
|
-
* never dispatched — they are shared static assets
|
|
54
|
-
* can serve, so a per-tenant worker would 404 them.
|
|
70
|
+
* Requests whose path matches `DEFAULT_LOCAL_PATHS` (`["/u/widget/"]`) or the
|
|
71
|
+
* extra `localPaths` are also never dispatched — they are shared static assets
|
|
72
|
+
* that only the control plane can serve, so a per-tenant worker would 404 them.
|
|
55
73
|
*/
|
|
56
74
|
export declare function createWfpForwardMiddleware(options: WfpForwardOptions): MiddlewareHandler;
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"type": "git",
|
|
12
12
|
"url": "https://github.com/sesamyab/authhero"
|
|
13
13
|
},
|
|
14
|
-
"version": "
|
|
14
|
+
"version": "4.0.0",
|
|
15
15
|
"files": [
|
|
16
16
|
"dist"
|
|
17
17
|
],
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"vite": "^8.0.14",
|
|
49
49
|
"vitest": "^4.1.7",
|
|
50
50
|
"@authhero/multi-tenancy": "15.4.0",
|
|
51
|
-
"authhero": "9.27.
|
|
51
|
+
"authhero": "9.27.1"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
54
|
"@authhero/multi-tenancy": "^14.0.0",
|