@authhero/cloudflare-adapter 3.4.0 → 4.1.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.
@@ -0,0 +1,20 @@
1
+ import { type ActionCodeGenerator, type ActionGenerationModel } from "@authhero/adapter-interfaces";
2
+ export interface CloudflareActionCodeGeneratorConfig {
3
+ accountId: string;
4
+ gatewayId: string;
5
+ apiToken: string;
6
+ /** Override model IDs without changing core or the admin UI. */
7
+ models?: Partial<Record<ActionGenerationModel, string>>;
8
+ timeoutMs?: number;
9
+ /** Optional transport for platform integrations and local HTTP simulations. */
10
+ fetch?: typeof globalThis.fetch;
11
+ }
12
+ /** Cloudflare AI Gateway REST API; no provider SDK required. */
13
+ export declare class CloudflareActionCodeGenerator implements ActionCodeGenerator {
14
+ private readonly config;
15
+ readonly models: readonly ["glm", "deepseek", "qwen"];
16
+ constructor(config: CloudflareActionCodeGeneratorConfig);
17
+ generate(params: Parameters<ActionCodeGenerator["generate"]>[0]): Promise<{
18
+ code: string;
19
+ }>;
20
+ }
@@ -4,6 +4,8 @@ import { type AnalyticsEngineLogsAdapterConfig, type AnalyticsEngineDataset } fr
4
4
  import { type AnalyticsEngineActionExecutionsAdapterConfig } from "./analytics-engine-action-executions";
5
5
  import { type CloudflareRateLimitBinding, type CloudflareRateLimitBindings } from "./rate-limit";
6
6
  import { CloudflareConfig } from "./types/CloudflareConfig";
7
+ export { CloudflareActionCodeGenerator } from "./action-code-generator";
8
+ export type { CloudflareActionCodeGeneratorConfig } from "./action-code-generator";
7
9
  export type { R2SQLLogsAdapterConfig };
8
10
  export type { AnalyticsEngineLogsAdapterConfig, AnalyticsEngineDataset };
9
11
  export type { AnalyticsEngineActionExecutionsAdapterConfig };
@@ -23,7 +25,7 @@ export { createAnalyticsEngineOutboxMetricsSink } from "./analytics-engine-outbo
23
25
  export type { AnalyticsEngineOutboxMetricsConfig, OutboxMetricRecord, } from "./analytics-engine-outbox-metrics";
24
26
  export { createR2SQLLogsAdapter } from "./r2-sql-logs";
25
27
  export { createR2SQLStatsAdapter } from "./r2-sql-logs";
26
- export { createCloudflareWfpD1Provisioner, createWfpProvisionerSteps, createWfpTenantProvisioningHook, createWfpForwardMiddleware, CloudflareApiClient, CloudflareApiError, } from "./wfp-provisioner";
28
+ export { createCloudflareWfpD1Provisioner, createWfpProvisionerSteps, createWfpTenantProvisioningHook, createWfpForwardMiddleware, DEFAULT_LOCAL_PATHS, CloudflareApiClient, CloudflareApiError, } from "./wfp-provisioner";
27
29
  export type { CloudflareWfpD1Provisioner, CloudflareWfpD1ProvisionerOptions, TenantProvisionerSteps, TenantProvisionNames, WfpProvisionerSteps, ProvisionResult, ProvisionerMigration, TenantSecretsResolver, WfpTenantProvisioningHook, WfpTenantProvisioningHookOptions, CfApiClientOptions, D1Database, D1QueryResult, ScriptBinding, ScriptUploadOptions, WfpForwardOptions, } from "./wfp-provisioner";
28
30
  export interface CloudflareAdapters {
29
31
  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. Defaults to
33
- * `["/u/widget/"]` (the universal-login widget bundle); pass `[]` to disable
34
- * the carve-out entirely, or extend the list for other shared assets.
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 `localPaths` (default `["/u/widget/"]`) are also
53
- * never dispatched — they are shared static assets that only the control plane
54
- * can serve, so a per-tenant worker would 404 them. See `DEFAULT_LOCAL_PATHS`.
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": "3.4.0",
14
+ "version": "4.1.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.0"
51
+ "authhero": "9.28.0"
52
52
  },
53
53
  "peerDependencies": {
54
54
  "@authhero/multi-tenancy": "^14.0.0",
@@ -67,8 +67,8 @@
67
67
  "dependencies": {
68
68
  "nanoid": "^5.1.11",
69
69
  "wretch": "^3.0.8",
70
- "@authhero/adapter-interfaces": "4.24.0",
71
- "@authhero/kysely-adapter": "12.18.0"
70
+ "@authhero/adapter-interfaces": "4.25.0",
71
+ "@authhero/kysely-adapter": "12.18.1"
72
72
  },
73
73
  "license": "AGPL-3.0-only",
74
74
  "scripts": {