@jimhoyd/urlcode 0.3.0 → 0.4.0-alpha.1
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/.claude/skills/urlcode-authoring/SKILL.md +106 -0
- package/.claude/skills/urlcode-operations/SKILL.md +114 -0
- package/.claude-plugin/marketplace.json +18 -0
- package/CONTRIBUTING.md +30 -2
- package/README.md +157 -230
- package/ROADMAP.md +85 -2
- package/SECURITY.md +8 -1
- package/dist/BUILD-MANIFEST.json +62 -32
- package/dist/adapters.js +4 -23
- package/dist/agent-lists.js +1 -1
- package/dist/agents-guide.js +113 -0
- package/dist/authoring-files.js +60 -0
- package/dist/authoring.js +11 -1
- package/dist/aws.js +4 -3
- package/dist/build-cloudflare.js +11 -24
- package/dist/bulk.js +37 -0
- package/dist/capabilities.js +208 -0
- package/dist/capability-query.js +72 -0
- package/dist/catalog.js +105 -0
- package/dist/cli.js +154 -15
- package/dist/client-address.js +1 -1
- package/dist/compliance-rules/baseline.js +8 -8
- package/dist/compliance-rules/privacy.js +3 -3
- package/dist/compliance-rules/strict.js +5 -5
- package/dist/conditions.js +88 -0
- package/dist/config.js +60 -4
- package/dist/context.js +156 -0
- package/dist/ecosystem-cli.js +88 -0
- package/dist/egress.js +98 -0
- package/dist/examples.js +92 -0
- package/dist/explain-cli.js +64 -0
- package/dist/explain.js +132 -0
- package/dist/extensions.js +172 -0
- package/dist/function-sources.js +15 -3
- package/dist/index.js +37 -0
- package/dist/init-with.js +165 -0
- package/dist/interchange-cli.js +42 -0
- package/dist/interchange.js +189 -0
- package/dist/link-cli.js +1 -1
- package/dist/management-policy.js +0 -1
- package/dist/manifest.js +111 -0
- package/dist/match.js +2 -2
- package/dist/mcp-authoring.js +147 -0
- package/dist/mcp.js +97 -0
- package/dist/observability.js +6 -0
- package/dist/operator-host.js +29 -0
- package/dist/plugins.js +12 -0
- package/dist/policies/agents.js +2 -2
- package/dist/policies/compression.js +2 -1
- package/dist/policies/security.js +0 -0
- package/dist/policies.js +1 -1
- package/dist/policy.js +29 -7
- package/dist/prerender.js +100 -41
- package/dist/project-tests.js +3 -3
- package/dist/provider-verification.js +92 -0
- package/dist/proxy.js +44 -0
- package/dist/readiness.js +5 -5
- package/dist/recipes.js +41 -0
- package/dist/route-diff.js +106 -0
- package/dist/router.js +42 -2
- package/dist/runtime.js +95 -14
- package/dist/schema-query.js +62 -0
- package/dist/signals.js +24 -0
- package/dist/site.js +0 -0
- package/dist/tooling.js +96 -0
- package/dist/types/adapters.d.ts +7 -4
- package/dist/types/agent-lists.d.ts +0 -1
- package/dist/types/agents-guide.d.ts +17 -0
- package/dist/types/authoring-files.d.ts +10 -0
- package/dist/types/aws.d.ts +3 -1
- package/dist/types/build-cloudflare.d.ts +1 -0
- package/dist/types/bulk.d.ts +27 -0
- package/dist/types/capabilities.d.ts +55 -0
- package/dist/types/capability-query.d.ts +24 -0
- package/dist/types/catalog.d.ts +65 -0
- package/dist/types/client-address.d.ts +0 -1
- package/dist/types/compliance-rules/baseline.d.ts +1 -9
- package/dist/types/compliance-rules/privacy.d.ts +1 -4
- package/dist/types/compliance-rules/strict.d.ts +0 -5
- package/dist/types/conditions.d.ts +19 -0
- package/dist/types/config.d.ts +20 -2
- package/dist/types/context.d.ts +65 -0
- package/dist/types/ecosystem-cli.d.ts +17 -0
- package/dist/types/egress.d.ts +46 -0
- package/dist/types/examples.d.ts +50 -0
- package/dist/types/explain-cli.d.ts +11 -0
- package/dist/types/explain.d.ts +95 -0
- package/dist/types/extensions.d.ts +122 -0
- package/dist/types/function-sources.d.ts +5 -0
- package/dist/types/index.d.ts +33 -0
- package/dist/types/init-with.d.ts +30 -0
- package/dist/types/interchange-cli.d.ts +16 -0
- package/dist/types/interchange.d.ts +42 -0
- package/dist/types/link-cli.d.ts +2 -1
- package/dist/types/management-policy.d.ts +0 -1
- package/dist/types/manifest.d.ts +81 -0
- package/dist/types/match.d.ts +1 -0
- package/dist/types/mcp-authoring.d.ts +92 -0
- package/dist/types/mcp.d.ts +12 -0
- package/dist/types/observability.d.ts +2 -0
- package/dist/types/operator-host.d.ts +8 -0
- package/dist/types/plugins.d.ts +2 -0
- package/dist/types/policies/agents.d.ts +0 -2
- package/dist/types/policies/compression.d.ts +2 -0
- package/dist/types/policies/security.d.ts +0 -1
- package/dist/types/policy.d.ts +15 -4
- package/dist/types/project-tests.d.ts +3 -1
- package/dist/types/provider-verification.d.ts +53 -0
- package/dist/types/proxy.d.ts +21 -0
- package/dist/types/readiness.d.ts +1 -1
- package/dist/types/recipes.d.ts +30 -0
- package/dist/types/route-diff.d.ts +27 -0
- package/dist/types/runtime.d.ts +11 -0
- package/dist/types/schema-query.d.ts +12 -0
- package/dist/types/signals.d.ts +25 -0
- package/dist/types/site.d.ts +0 -1
- package/dist/types/tooling.d.ts +115 -0
- package/dist/types/types.d.ts +57 -0
- package/dist/types/typescript-authoring.d.ts +12 -0
- package/dist/types/vercel.d.ts +3 -1
- package/dist/types/verify-deployment.d.ts +47 -0
- package/dist/types.js +21 -2
- package/dist/typescript-authoring.js +104 -0
- package/dist/vercel.js +4 -3
- package/dist/verify-deployment.js +270 -0
- package/docs/AI-AUTHORING.md +130 -8
- package/docs/BULK.md +79 -0
- package/docs/CAPABILITIES.md +179 -0
- package/docs/CAPACITY.md +1 -1
- package/docs/CI.md +142 -0
- package/docs/CONDITIONS.md +74 -0
- package/docs/DEPLOYMENT-CHECKS.md +108 -0
- package/docs/DYNAMIC-LINKS.md +18 -518
- package/docs/EGRESS.md +125 -0
- package/docs/EXTENSIONS.md +226 -0
- package/docs/FRAMEWORK.md +182 -0
- package/docs/INSTALL.md +45 -7
- package/docs/INTERCHANGE.md +134 -0
- package/docs/MIDDLEWARE-EXAMPLES.md +75 -0
- package/docs/MIDDLEWARE.md +2 -0
- package/docs/NEXT-PHASE-PLAN.md +90 -0
- package/docs/NEXT-STEPS.md +415 -0
- package/docs/OBSERVABILITY.md +4 -2
- package/docs/OPERATIONAL-PROOF.md +4 -1
- package/docs/OPERATIONS.md +6 -3
- package/docs/PLUGINS.md +37 -0
- package/docs/POLICIES.md +12 -309
- package/docs/PRERENDER.md +40 -0
- package/docs/PROJECT-DIRECTION.md +42 -0
- package/docs/PROVIDER-VERIFICATION.md +84 -0
- package/docs/READINESS.md +21 -1
- package/docs/README.md +82 -31
- package/docs/RECIPES.md +99 -0
- package/docs/RELEASE-READINESS.md +11 -9
- package/docs/RELEASE-SECURITY.md +27 -4
- package/docs/SECURITY-AUDIT.md +1 -1
- package/docs/SPECIFICATION.md +95 -8
- package/docs/SPIKE-BUSINESS-SUITE.md +1013 -0
- package/docs/SPIKE-EXTENSION-MODEL.md +419 -0
- package/docs/SPIKE-EXTENSIONS.md +1 -0
- package/docs/SPIKE-LAMBDA-COMPILE.md +199 -0
- package/docs/STANDARDS.md +150 -142
- package/docs/STARTERS.md +21 -1
- package/docs/TOOLING.md +291 -0
- package/docs/TYPESCRIPT-AUTHORING.md +67 -0
- package/docs/TYPESCRIPT.md +1 -1
- package/docs/USABILITY-REVIEW.md +123 -0
- package/docs/YAML-GUIDE.md +18 -479
- package/docs/YAML-REFERENCE.md +127 -16
- package/docs/links/cli.md +110 -0
- package/docs/links/limits.md +175 -0
- package/docs/links/management-api.md +80 -0
- package/docs/links/pools.md +75 -0
- package/docs/links/setup.md +135 -0
- package/docs/policies/agents.md +1 -1
- package/docs/policies/contract.md +52 -0
- package/docs/policies/hardened.md +56 -0
- package/docs/policies/interoperability.md +169 -0
- package/docs/policies/operations.md +45 -0
- package/docs/yaml/assets.md +36 -0
- package/docs/yaml/conditions.md +20 -0
- package/docs/yaml/functions.md +160 -0
- package/docs/yaml/links.md +30 -0
- package/docs/yaml/middleware.md +29 -0
- package/docs/yaml/organization.md +74 -0
- package/docs/yaml/policies.md +37 -0
- package/docs/yaml/redirects.md +64 -0
- package/docs/yaml/responses.md +57 -0
- package/docs/yaml/site.md +24 -0
- package/examples/assets/example.yaml +17 -0
- package/examples/aws/example.yaml +20 -0
- package/examples/cloudflare/example.yaml +19 -0
- package/examples/compliance/example.yaml +11 -0
- package/examples/conditions/README.md +12 -0
- package/examples/conditions/example.yaml +19 -0
- package/examples/conditions/tests/requests.json +13 -0
- package/examples/conditions/urlcode.yaml +24 -0
- package/examples/cookbook/README.md +8 -4
- package/examples/cookbook/example.yaml +17 -0
- package/examples/cookbook/functions/catalog.mjs +3 -0
- package/examples/cookbook/functions/fail.mjs +4 -0
- package/examples/cookbook/functions/items.mjs +3 -0
- package/examples/cookbook/functions/profile.mjs +3 -0
- package/examples/cookbook/functions/resource.mjs +3 -0
- package/examples/cookbook/functions/status.mjs +3 -0
- package/examples/cookbook/middleware/auth.mjs +48 -0
- package/examples/cookbook/middleware/body.mjs +15 -0
- package/examples/cookbook/middleware/bucket.mjs +19 -0
- package/examples/cookbook/middleware/cors.mjs +21 -0
- package/examples/cookbook/middleware/debug.mjs +13 -0
- package/examples/cookbook/middleware/envelope.mjs +11 -0
- package/examples/cookbook/middleware/errors.mjs +11 -0
- package/examples/cookbook/middleware/etag.mjs +18 -0
- package/examples/cookbook/middleware/locale.mjs +16 -0
- package/examples/cookbook/middleware/maintenance.mjs +10 -0
- package/examples/cookbook/middleware/methods.mjs +15 -0
- package/examples/cookbook/middleware/negotiate.mjs +20 -0
- package/examples/cookbook/middleware/referer.mjs +12 -0
- package/examples/cookbook/middleware/request-id.mjs +16 -0
- package/examples/cookbook/route-index.json +676 -0
- package/examples/cookbook/routes/middleware.yaml +126 -0
- package/examples/cookbook/tests/requests.json +526 -0
- package/examples/cookbook/urlcode.yaml +1 -0
- package/examples/egress/README.md +22 -0
- package/examples/egress/example.yaml +19 -0
- package/examples/egress/urlcode.yaml +19 -0
- package/examples/extensions/README.md +7 -0
- package/examples/extensions/example.yaml +21 -0
- package/examples/extensions/urlcode.yaml +25 -0
- package/examples/live-links/example.yaml +21 -0
- package/examples/monitoring/example.yaml +8 -0
- package/examples/prerender/example.yaml +16 -0
- package/examples/provider-conformance/README.md +12 -0
- package/examples/provider-conformance/example.yaml +14 -0
- package/examples/provider-conformance/urlcode.yaml +34 -0
- package/examples/tunnel/example.yaml +8 -0
- package/examples/vercel/example.yaml +19 -0
- package/llms-full.txt +2709 -0
- package/llms.txt +48 -19
- package/package.json +29 -7
- package/packaging/claude-plugin/.claude-plugin/plugin.json +19 -0
- package/packaging/claude-plugin/skills/urlcode-authoring/SKILL.md +106 -0
- package/packaging/claude-plugin/skills/urlcode-operations/SKILL.md +114 -0
- package/recipes/authenticated-json-api/README.md +51 -0
- package/recipes/authenticated-json-api/functions/profile.mjs +5 -0
- package/recipes/authenticated-json-api/recipe.yaml +34 -0
- package/recipes/authenticated-json-api/tests/requests.json +39 -0
- package/recipes/authenticated-json-api/urlcode.yaml +12 -0
- package/recipes/contact-form/README.md +25 -0
- package/recipes/contact-form/functions/contact.mjs +17 -0
- package/recipes/contact-form/recipe.yaml +33 -0
- package/recipes/contact-form/tests/requests.json +47 -0
- package/recipes/contact-form/urlcode.yaml +18 -0
- package/recipes/cors-api/README.md +16 -0
- package/recipes/cors-api/functions/items.mjs +3 -0
- package/recipes/cors-api/middleware/cors.mjs +21 -0
- package/recipes/cors-api/recipe.yaml +26 -0
- package/recipes/cors-api/tests/requests.json +65 -0
- package/recipes/cors-api/urlcode.yaml +12 -0
- package/recipes/health-page/README.md +13 -0
- package/recipes/health-page/recipe.yaml +23 -0
- package/recipes/health-page/tests/requests.json +36 -0
- package/recipes/health-page/urlcode.yaml +19 -0
- package/recipes/json-api/README.md +6 -0
- package/recipes/json-api/functions/echo.mjs +3 -0
- package/recipes/json-api/recipe.yaml +25 -0
- package/recipes/json-api/tests/requests.json +34 -0
- package/recipes/json-api/urlcode.yaml +12 -0
- package/recipes/middleware/README.md +34 -0
- package/recipes/middleware/functions/catalog.mjs +3 -0
- package/recipes/middleware/functions/fail.mjs +4 -0
- package/recipes/middleware/functions/items.mjs +3 -0
- package/recipes/middleware/functions/profile.mjs +3 -0
- package/recipes/middleware/functions/resource.mjs +3 -0
- package/recipes/middleware/functions/status.mjs +3 -0
- package/recipes/middleware/middleware/auth.mjs +48 -0
- package/recipes/middleware/middleware/body.mjs +15 -0
- package/recipes/middleware/middleware/bucket.mjs +19 -0
- package/recipes/middleware/middleware/cors.mjs +21 -0
- package/recipes/middleware/middleware/debug.mjs +13 -0
- package/recipes/middleware/middleware/envelope.mjs +11 -0
- package/recipes/middleware/middleware/errors.mjs +11 -0
- package/recipes/middleware/middleware/etag.mjs +18 -0
- package/recipes/middleware/middleware/locale.mjs +16 -0
- package/recipes/middleware/middleware/maintenance.mjs +10 -0
- package/recipes/middleware/middleware/methods.mjs +15 -0
- package/recipes/middleware/middleware/negotiate.mjs +20 -0
- package/recipes/middleware/middleware/referer.mjs +12 -0
- package/recipes/middleware/middleware/request-id.mjs +16 -0
- package/recipes/middleware/public/guide.txt +1 -0
- package/recipes/middleware/recipe.yaml +50 -0
- package/recipes/middleware/tests/requests.json +528 -0
- package/recipes/middleware/urlcode.yaml +127 -0
- package/recipes/protected-download/README.md +22 -0
- package/recipes/protected-download/files/report.txt +1 -0
- package/recipes/protected-download/recipe.yaml +31 -0
- package/recipes/protected-download/tests/requests.json +32 -0
- package/recipes/protected-download/urlcode.yaml +15 -0
- package/recipes/redirect/README.md +7 -0
- package/recipes/redirect/recipe.yaml +25 -0
- package/recipes/redirect/tests/requests.json +19 -0
- package/recipes/redirect/urlcode.yaml +9 -0
- package/recipes/static-plus-api/README.md +15 -0
- package/recipes/static-plus-api/functions/info.mjs +3 -0
- package/recipes/static-plus-api/public/assets/index.html +3 -0
- package/recipes/static-plus-api/public/assets/site.css +1 -0
- package/recipes/static-plus-api/public/index.html +8 -0
- package/recipes/static-plus-api/recipe.yaml +29 -0
- package/recipes/static-plus-api/tests/requests.json +56 -0
- package/recipes/static-plus-api/urlcode.yaml +23 -0
- package/recipes/typescript/README.md +7 -0
- package/recipes/typescript/functions/hello.ts +5 -0
- package/recipes/typescript/recipe.yaml +23 -0
- package/recipes/typescript/tests/requests.json +18 -0
- package/recipes/typescript/urlcode.yaml +5 -0
- package/recipes/webhook-receiver/README.md +16 -0
- package/recipes/webhook-receiver/functions/receive.mjs +16 -0
- package/recipes/webhook-receiver/recipe.yaml +26 -0
- package/recipes/webhook-receiver/tests/requests.json +59 -0
- package/recipes/webhook-receiver/urlcode.yaml +16 -0
- package/schemas/recipe.schema.json +138 -0
- package/schemas/urlcode.schema.json +656 -80
- package/skills/urlcode/SKILL.md +98 -0
- package/starters/default/.github/workflows/urlcode.yml +23 -0
- package/starters/default/.mcp.json +12 -0
- package/starters/default/AGENTS.md +79 -0
package/dist/types/policy.d.ts
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
import type { FunctionSources } from './function-sources.ts';
|
|
2
2
|
import type { LoadedDocument } from './types.ts';
|
|
3
|
+
export interface EgressGrants {
|
|
4
|
+
proxy?: string[];
|
|
5
|
+
signals?: string[];
|
|
6
|
+
}
|
|
7
|
+
export interface RouteGrant {
|
|
8
|
+
env?: string[];
|
|
9
|
+
secrets?: string[];
|
|
10
|
+
egress?: EgressGrants;
|
|
11
|
+
}
|
|
3
12
|
/** The operator's binding grants: which env and secret names each route may read, pinned to a project hash. */
|
|
4
13
|
export interface OperatorPolicy {
|
|
5
14
|
version: 1;
|
|
6
15
|
projectSha256: string;
|
|
7
|
-
routes: Record<string,
|
|
8
|
-
env?: string[];
|
|
9
|
-
secrets?: string[];
|
|
10
|
-
}>;
|
|
16
|
+
routes: Record<string, RouteGrant>;
|
|
11
17
|
}
|
|
12
18
|
/** The function snapshot plus the hash operator grants are pinned to. */
|
|
13
19
|
export interface FunctionSnapshot extends FunctionSources {
|
|
@@ -19,3 +25,8 @@ export declare function loadOperatorPolicy(file: string | undefined, project: st
|
|
|
19
25
|
export declare function requestedPermissions(loaded: LoadedDocument, snapshot: {
|
|
20
26
|
projectSha256: string;
|
|
21
27
|
}): OperatorPolicy;
|
|
28
|
+
/** Called before resources or credentials are activated. Grants never come from YAML. */
|
|
29
|
+
export declare function authorizeEgress(loaded: LoadedDocument, projectSha256: string, policy: OperatorPolicy | undefined): {
|
|
30
|
+
proxy: string[];
|
|
31
|
+
signals: string[];
|
|
32
|
+
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { ServerOptions } from './server.ts';
|
|
2
2
|
import type { LogFn } from './types.ts';
|
|
3
3
|
export interface ProjectTestOptions {
|
|
4
|
+
extensions?: ServerOptions['extensions'];
|
|
5
|
+
plugins?: ServerOptions['plugins'];
|
|
4
6
|
log?: LogFn | undefined;
|
|
5
7
|
permissions?: ServerOptions['permissions'];
|
|
6
8
|
linkStore?: ServerOptions['linkStore'];
|
|
@@ -10,4 +12,4 @@ export interface ProjectTestResult {
|
|
|
10
12
|
total: number;
|
|
11
13
|
failed: number;
|
|
12
14
|
}
|
|
13
|
-
export declare function runProjectTests(project: string, { log, permissions, linkStore, origin }?: ProjectTestOptions): Promise<ProjectTestResult>;
|
|
15
|
+
export declare function runProjectTests(project: string, { log, permissions, linkStore, origin, extensions, plugins }?: ProjectTestOptions): Promise<ProjectTestResult>;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export type VerificationTarget = 'self-hosted' | 'aws' | 'vercel' | 'cloudflare';
|
|
2
|
+
export interface ProviderProbe {
|
|
3
|
+
id: string;
|
|
4
|
+
path: string;
|
|
5
|
+
method: string;
|
|
6
|
+
headers: Record<string, string>;
|
|
7
|
+
body?: string;
|
|
8
|
+
expected: {
|
|
9
|
+
status: number;
|
|
10
|
+
headers?: Record<string, string>;
|
|
11
|
+
body?: string;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export interface ProviderAnswer {
|
|
15
|
+
status: number;
|
|
16
|
+
headers: Record<string, string>;
|
|
17
|
+
body: string;
|
|
18
|
+
}
|
|
19
|
+
export type ProviderTransport = (probe: ProviderProbe, signal: AbortSignal) => Promise<ProviderAnswer>;
|
|
20
|
+
export interface ProviderVerificationOptions {
|
|
21
|
+
timeoutMs?: number;
|
|
22
|
+
release?: string;
|
|
23
|
+
gitCommit?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface ProviderFinding {
|
|
26
|
+
case: string;
|
|
27
|
+
pass: boolean;
|
|
28
|
+
expectedStatus: number;
|
|
29
|
+
observedStatus: number | null;
|
|
30
|
+
failures: string[];
|
|
31
|
+
}
|
|
32
|
+
export interface ProviderVerificationReport {
|
|
33
|
+
schemaVersion: 1;
|
|
34
|
+
fixtureVersion: 1;
|
|
35
|
+
target: VerificationTarget;
|
|
36
|
+
origin: string | null;
|
|
37
|
+
evidence: 'local-adapter' | 'deployment-http';
|
|
38
|
+
providerVerification: 'unverified' | 'observed';
|
|
39
|
+
timestamp: string;
|
|
40
|
+
release: string | null;
|
|
41
|
+
gitCommit: string | null;
|
|
42
|
+
fixtureSha256: string;
|
|
43
|
+
pass: boolean;
|
|
44
|
+
requests: number;
|
|
45
|
+
findings: ProviderFinding[];
|
|
46
|
+
notes: string[];
|
|
47
|
+
}
|
|
48
|
+
/** Synthetic read-only routes, except a POST to a declared constant response. */
|
|
49
|
+
export declare function providerConformanceCases(): ProviderProbe[];
|
|
50
|
+
/** Replay against a caller-supplied local adapter; never label this a provider deployment. */
|
|
51
|
+
export declare function runProviderConformance(target: VerificationTarget, transport: ProviderTransport, options?: ProviderVerificationOptions): Promise<ProviderVerificationReport>;
|
|
52
|
+
/** Probe only an explicitly supplied, operator-owned deployment of the fixture. Redirects are never followed. */
|
|
53
|
+
export declare function verifyProviderDeployment(target: VerificationTarget, origin: string, options?: ProviderVerificationOptions): Promise<ProviderVerificationReport>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { EgressRequest, EgressResponse } from './egress.ts';
|
|
2
|
+
export interface ProxyDefinition {
|
|
3
|
+
url: string;
|
|
4
|
+
query?: string[];
|
|
5
|
+
requestHeaders?: string[];
|
|
6
|
+
responseHeaders?: string[];
|
|
7
|
+
headers?: Record<string, string>;
|
|
8
|
+
}
|
|
9
|
+
export interface ProxyInput {
|
|
10
|
+
method: string;
|
|
11
|
+
url: string | URL;
|
|
12
|
+
params: Record<string, unknown>;
|
|
13
|
+
headers: Record<string, string | undefined>;
|
|
14
|
+
body?: Uint8Array;
|
|
15
|
+
signal?: AbortSignal;
|
|
16
|
+
}
|
|
17
|
+
export interface EgressTransport {
|
|
18
|
+
request(input: EgressRequest): Promise<EgressResponse>;
|
|
19
|
+
}
|
|
20
|
+
export declare function validateProxy(definition: ProxyDefinition): void;
|
|
21
|
+
export declare function executeProxy(client: EgressTransport, definition: ProxyDefinition, input: ProxyInput): Promise<EgressResponse>;
|
|
@@ -4,7 +4,7 @@ import type { CompiledRedirect, CompiledRoute, LogFn, PlanInventoryEntry, Policy
|
|
|
4
4
|
import type { ComplianceOptions, ComplianceReport } from './compliance.ts';
|
|
5
5
|
import type { CompiledRoutes } from './match.ts';
|
|
6
6
|
export type { RouteState } from './types.ts';
|
|
7
|
-
export type HandlerName = 'redirect' | 'function' | 'page' | 'static' | 'download' | 'respond' | 'link';
|
|
7
|
+
export type HandlerName = 'extension' | 'proxy' | 'conditional' | 'redirect' | 'function' | 'page' | 'static' | 'download' | 'respond' | 'link';
|
|
8
8
|
/** One configured route as the inventory reports it: a PlanInventoryEntry with the handler kind named. */
|
|
9
9
|
export interface RouteInventory extends PlanInventoryEntry {
|
|
10
10
|
handler: HandlerName | undefined;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { CatalogMetadata } from './catalog.ts';
|
|
2
|
+
/** recipe.yaml, validated against schemas/recipe.schema.json; `name` repeats `id` and `files` is the copy list. */
|
|
3
|
+
export interface RecipeSummary extends CatalogMetadata {
|
|
4
|
+
name: string;
|
|
5
|
+
}
|
|
6
|
+
export interface Recipe extends RecipeSummary {
|
|
7
|
+
content: Record<string, string>;
|
|
8
|
+
}
|
|
9
|
+
export interface RecipeAddReport {
|
|
10
|
+
name: string;
|
|
11
|
+
output: string;
|
|
12
|
+
dryRun: boolean;
|
|
13
|
+
files: string[];
|
|
14
|
+
}
|
|
15
|
+
export interface RecipeSearchResult {
|
|
16
|
+
query: string;
|
|
17
|
+
count: number;
|
|
18
|
+
results: (RecipeSummary & {
|
|
19
|
+
score: number;
|
|
20
|
+
matched: string[];
|
|
21
|
+
})[];
|
|
22
|
+
}
|
|
23
|
+
export declare const recipeNames: readonly ["redirect", "json-api", "typescript", "middleware", "health-page", "static-plus-api", "cors-api", "webhook-receiver", "contact-form", "authenticated-json-api", "protected-download"];
|
|
24
|
+
export declare function listRecipes(): Promise<RecipeSummary[]>;
|
|
25
|
+
/** Matches id, description, tags and capabilities locally; no service is consulted. */
|
|
26
|
+
export declare function searchRecipes(text: string): Promise<RecipeSearchResult>;
|
|
27
|
+
export declare function showRecipe(name: string): Promise<Recipe>;
|
|
28
|
+
export declare function addRecipe(name: string, output: string, { dryRun }?: {
|
|
29
|
+
dryRun?: boolean | undefined;
|
|
30
|
+
}): Promise<RecipeAddReport>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { PlanInventoryEntry } from './types.ts';
|
|
2
|
+
/** One route as the diff sees it: the inventory entry plus its policy description from the `policies` map. */
|
|
3
|
+
export interface RouteRecord extends PlanInventoryEntry {
|
|
4
|
+
policy?: Record<string, unknown>;
|
|
5
|
+
}
|
|
6
|
+
/** The parts of a `urlcode routes` report the diff reads. */
|
|
7
|
+
export interface RouteSnapshot {
|
|
8
|
+
inventory: PlanInventoryEntry[];
|
|
9
|
+
policies?: Record<string, Record<string, unknown>> | undefined;
|
|
10
|
+
}
|
|
11
|
+
export interface RouteChange {
|
|
12
|
+
path: string;
|
|
13
|
+
before: RouteRecord;
|
|
14
|
+
after: RouteRecord;
|
|
15
|
+
}
|
|
16
|
+
export interface RouteDiff {
|
|
17
|
+
added: RouteRecord[];
|
|
18
|
+
removed: RouteRecord[];
|
|
19
|
+
changed: RouteChange[];
|
|
20
|
+
}
|
|
21
|
+
/** Validates a parsed `urlcode routes` JSON report (a child-process or file boundary) into a snapshot. */
|
|
22
|
+
export declare function parseRouteSnapshot(value: unknown): RouteSnapshot;
|
|
23
|
+
/** Compares two route reports. Paths are sorted; an entry changes when any inventory field or its policy description differs. */
|
|
24
|
+
export declare function diffRoutes(before: RouteSnapshot, after: RouteSnapshot): RouteDiff;
|
|
25
|
+
export declare const hasRouteChanges: (diff: RouteDiff) => boolean;
|
|
26
|
+
/** Renders a diff as Markdown: one table per nonempty section, or "No route changes". */
|
|
27
|
+
export declare function renderRouteDiff(diff: RouteDiff): string;
|
package/dist/types/runtime.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { RuntimeExtension } from './extensions.ts';
|
|
2
|
+
import type { EgressDependencies } from './egress.ts';
|
|
1
3
|
import type { ProjectPlan } from './readiness.ts';
|
|
2
4
|
import type { OperatorPolicy } from './policy.ts';
|
|
3
5
|
import type { LinkStoreOptions } from './link-store.ts';
|
|
@@ -31,6 +33,9 @@ export interface TestPlan extends ProjectPlan {
|
|
|
31
33
|
policies: Record<string, PolicyInventory>;
|
|
32
34
|
}
|
|
33
35
|
export interface RuntimeOptions {
|
|
36
|
+
extensions?: RuntimeExtension[] | undefined;
|
|
37
|
+
/** Trusted host transport injection; never supplied by project YAML or guest code. */
|
|
38
|
+
egressDependencies?: EgressDependencies;
|
|
34
39
|
observers?: Observer[] | undefined;
|
|
35
40
|
log?: LogFn | undefined;
|
|
36
41
|
origin?: string | undefined;
|
|
@@ -44,6 +49,12 @@ export interface RuntimeOptions {
|
|
|
44
49
|
workers?: number | undefined;
|
|
45
50
|
timeoutMs?: number | undefined;
|
|
46
51
|
maxBytes?: number | undefined;
|
|
52
|
+
/** Build tooling only: compile just these route patterns, after site conventions
|
|
53
|
+
* have been expanded. It can only remove routes, never add or alter one, and the
|
|
54
|
+
* smaller route set changes the project hash, so an operator policy pinned to the
|
|
55
|
+
* whole project denies every binding it grants. Prerendering uses it to render a
|
|
56
|
+
* project too large for one function snapshot in passes (docs/PRERENDER.md). */
|
|
57
|
+
only?: readonly string[] | undefined;
|
|
47
58
|
}
|
|
48
59
|
/** Per-request facts the host may read after handle() settles; never request text. */
|
|
49
60
|
export interface LinkTrace {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
type Json = Record<string, unknown>;
|
|
2
|
+
export interface SchemaFragment {
|
|
3
|
+
format: 1;
|
|
4
|
+
path: string;
|
|
5
|
+
pointer: string;
|
|
6
|
+
schema: Json;
|
|
7
|
+
}
|
|
8
|
+
/** Top-level document keys first, then `route` itself and every route property (`redirect`, `function`, `middleware`, ...). */
|
|
9
|
+
export declare function schemaPathNames(): string[];
|
|
10
|
+
/** Only the fragment for a dotted path, with references resolved inline. No validation, defaults or authority. */
|
|
11
|
+
export declare function getSchemaFragment(path: string): SchemaFragment;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { EgressTransport } from './proxy.ts';
|
|
2
|
+
export interface SignalDefinition {
|
|
3
|
+
url: string;
|
|
4
|
+
headers?: Record<string, string>;
|
|
5
|
+
}
|
|
6
|
+
export interface SignalEvent {
|
|
7
|
+
route: string;
|
|
8
|
+
status: number;
|
|
9
|
+
method: string;
|
|
10
|
+
}
|
|
11
|
+
export interface SignalStats {
|
|
12
|
+
accepted: number;
|
|
13
|
+
delivered: number;
|
|
14
|
+
failed: number;
|
|
15
|
+
dropped: number;
|
|
16
|
+
}
|
|
17
|
+
export declare function validateSignal(definition: SignalDefinition): void;
|
|
18
|
+
/** No queue, retries, ordering promise, or durable delivery. Counters contain no URL/header data. */
|
|
19
|
+
export declare class SignalBroker {
|
|
20
|
+
#private;
|
|
21
|
+
constructor(client: EgressTransport, concurrency?: number, onStats?: (stats: SignalStats) => void);
|
|
22
|
+
get stats(): SignalStats;
|
|
23
|
+
emit(definition: SignalDefinition, event: SignalEvent): boolean;
|
|
24
|
+
close(): Promise<void>;
|
|
25
|
+
}
|
package/dist/types/site.d.ts
CHANGED
|
@@ -6,7 +6,6 @@ export interface SiteOptions {
|
|
|
6
6
|
}
|
|
7
7
|
type SiteKey = keyof SiteConfig;
|
|
8
8
|
export declare const generatedPaths: Readonly<Record<SiteKey, string>>;
|
|
9
|
-
export declare const MAX_SITEMAP_URLS = 50000;
|
|
10
9
|
export declare function expandSite(document: ProjectDocument, root: string, { origin, log, routes }?: SiteOptions): Promise<Record<string, RouteConfig>>;
|
|
11
10
|
export declare function applySite(loaded: LoadedDocument, options?: SiteOptions): Promise<Record<string, RouteConfig>>;
|
|
12
11
|
export {};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import type { ImportRoutesOptions, InterchangeFormat } from './interchange.ts';
|
|
2
|
+
import { listRecipes, showRecipe, searchRecipes } from './recipes.ts';
|
|
3
|
+
import { listExamples, searchExamples } from './examples.ts';
|
|
4
|
+
import type { CompiledRoute, PolicyChain } from './types.ts';
|
|
5
|
+
import type { RuntimeExtension } from './extensions.ts';
|
|
6
|
+
import type { RouteExplanation } from './explain.ts';
|
|
7
|
+
export { getCapabilities } from './capabilities.ts';
|
|
8
|
+
export { getCapability } from './capability-query.ts';
|
|
9
|
+
export type { CapabilityEntry, CapabilityUsage } from './capability-query.ts';
|
|
10
|
+
export { getSchemaFragment, schemaPathNames } from './schema-query.ts';
|
|
11
|
+
export type { SchemaFragment } from './schema-query.ts';
|
|
12
|
+
export { listRecipes, showRecipe, searchRecipes, listExamples, searchExamples };
|
|
13
|
+
export { buildContext, renderContext, estimateTokens, documentationTokens } from './context.ts';
|
|
14
|
+
export type { ContextOptions, ProjectContext, ContextSection } from './context.ts';
|
|
15
|
+
export type { RouteExplanation, ExplainedHandler, ExplainedCache, ExplainedExtensionRequirement, ExtensionProvider, TargetSupport } from './explain.ts';
|
|
16
|
+
/** `extensions` are operator registrations from a host file; explain reports whether each requirement has a provider. Nothing is activated. */
|
|
17
|
+
export interface InspectOptions {
|
|
18
|
+
origin?: string;
|
|
19
|
+
target?: string;
|
|
20
|
+
offset?: number;
|
|
21
|
+
limit?: number;
|
|
22
|
+
extensions?: RuntimeExtension[] | undefined;
|
|
23
|
+
}
|
|
24
|
+
export declare function prepare(project: string, options?: InspectOptions): Promise<{
|
|
25
|
+
loaded: import("./types.ts").LoadedDocument;
|
|
26
|
+
compiled: import("./types.ts").CompiledRouteTable;
|
|
27
|
+
routes: CompiledRoute[];
|
|
28
|
+
chains: Map<string, PolicyChain>;
|
|
29
|
+
projectSha256: string;
|
|
30
|
+
}>;
|
|
31
|
+
/** Semantic authoring inspection; no binding reads, sandbox execution or runtime activation. */
|
|
32
|
+
export declare function inspectProject(project: string, options?: InspectOptions): Promise<{
|
|
33
|
+
format: number;
|
|
34
|
+
projectSha256: string;
|
|
35
|
+
routeCount: number;
|
|
36
|
+
offset: number;
|
|
37
|
+
limit: number;
|
|
38
|
+
routes: {
|
|
39
|
+
path: string;
|
|
40
|
+
methods: string[];
|
|
41
|
+
enabled: boolean;
|
|
42
|
+
capabilities: ("function" | "link" | "expires" | "middleware" | "extension" | "proxy" | "signals" | "conditional" | "methods" | "enabled" | "parameters" | "redirect" | "page" | "download" | "static" | "respond" | "dynamicLinks" | "policies.extensions" | "conditions" | "request.body" | "response.headers" | "bindings" | "policies.agents" | "policies.security" | "policies.cache" | "policies.compression" | "policies.throttle")[];
|
|
43
|
+
}[];
|
|
44
|
+
compatibility: {
|
|
45
|
+
offset: number;
|
|
46
|
+
limit: number;
|
|
47
|
+
hasMore: boolean;
|
|
48
|
+
issues: import("./capabilities.ts").CapabilityRequirement[];
|
|
49
|
+
target: "vercel" | "aws" | "cloudflare" | "self-hosted";
|
|
50
|
+
compatible: boolean;
|
|
51
|
+
deployment: "local-runtime" | "unverified";
|
|
52
|
+
requirementCount: number;
|
|
53
|
+
issueCount: number;
|
|
54
|
+
};
|
|
55
|
+
}>;
|
|
56
|
+
export declare function validateProject(project: string, options?: InspectOptions): Promise<{
|
|
57
|
+
valid: boolean;
|
|
58
|
+
projectSha256: string;
|
|
59
|
+
routeCount: number;
|
|
60
|
+
compatibility: {
|
|
61
|
+
target: "vercel" | "aws" | "cloudflare" | "self-hosted";
|
|
62
|
+
compatible: boolean;
|
|
63
|
+
deployment: "local-runtime" | "unverified";
|
|
64
|
+
requirementCount: number;
|
|
65
|
+
issueCount: number;
|
|
66
|
+
firstIssue: import("./capabilities.ts").CapabilityRequirement | null;
|
|
67
|
+
};
|
|
68
|
+
}>;
|
|
69
|
+
export interface RouteMiss {
|
|
70
|
+
matched: false;
|
|
71
|
+
nearest: string[];
|
|
72
|
+
note: string;
|
|
73
|
+
}
|
|
74
|
+
/** Explain the route a path selects from the compiled IR: effective methods, handler, middleware, inputs, policies, cache outcome, bindings and target support. Nothing executes and no binding is read. */
|
|
75
|
+
export declare function explainRoute(project: string, target: string, options?: InspectOptions): Promise<RouteExplanation | RouteMiss>;
|
|
76
|
+
/** Every route's explanation, in the router's precedence order. */
|
|
77
|
+
export declare function explainProject(project: string, options?: InspectOptions): Promise<{
|
|
78
|
+
projectSha256: string;
|
|
79
|
+
routeCount: number;
|
|
80
|
+
routes: RouteExplanation[];
|
|
81
|
+
}>;
|
|
82
|
+
export declare function previewImport(options: ImportRoutesOptions): Promise<import("./interchange.ts").ConversionReport>;
|
|
83
|
+
export declare function previewExport(project: string, format: InterchangeFormat, acceptProviderDifferences?: boolean): Promise<import("./interchange.ts").ConversionReport>;
|
|
84
|
+
export interface ExtensionInspection {
|
|
85
|
+
format: 1;
|
|
86
|
+
projectSha256: string;
|
|
87
|
+
hostLoaded: boolean;
|
|
88
|
+
note: string;
|
|
89
|
+
extensions: {
|
|
90
|
+
name: string;
|
|
91
|
+
version: string;
|
|
92
|
+
targets: string[];
|
|
93
|
+
credentialHeaders: string[];
|
|
94
|
+
schema: object;
|
|
95
|
+
policySchema: object | null;
|
|
96
|
+
declared: boolean;
|
|
97
|
+
revisionPinned: boolean;
|
|
98
|
+
mounts: string[];
|
|
99
|
+
policyRoutes: string[];
|
|
100
|
+
}[];
|
|
101
|
+
declared: {
|
|
102
|
+
name: string;
|
|
103
|
+
version: string;
|
|
104
|
+
registered: boolean;
|
|
105
|
+
mounts: string[];
|
|
106
|
+
policyRoutes: string[];
|
|
107
|
+
}[];
|
|
108
|
+
}
|
|
109
|
+
/** Reports registered extension contracts against the project's declarations. Never activates an extension. */
|
|
110
|
+
export declare function describeExtensions(project: string, registrations: RuntimeExtension[] | undefined): Promise<ExtensionInspection>;
|
|
111
|
+
/** Executes the trusted operator host file to read its registrations, then releases it. */
|
|
112
|
+
export declare function inspectExtensions(options: {
|
|
113
|
+
project: string;
|
|
114
|
+
hostFile?: string;
|
|
115
|
+
}): Promise<ExtensionInspection>;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import type { ExtensionDeclaration, ExtensionPolicies } from './extensions.ts';
|
|
2
|
+
import type { ProxyDefinition } from './proxy.ts';
|
|
3
|
+
import type { SignalDefinition } from './signals.ts';
|
|
4
|
+
import type { RouteMatch } from './conditions.ts';
|
|
1
5
|
import type { HandlerResult, HeaderPair } from './http-response.ts';
|
|
2
6
|
import type { CompiledParameter, MatchableRoute, ParameterLocation, ParameterSchema, RedirectSpec, Scalar, ValueRef } from './match.ts';
|
|
3
7
|
import type { HttpRoute, Reply, RequestBodyPolicy, RespondSpec } from './http-policy.ts';
|
|
@@ -33,6 +37,11 @@ export interface MiddlewareConfig {
|
|
|
33
37
|
source: string;
|
|
34
38
|
export?: string;
|
|
35
39
|
}
|
|
40
|
+
/** A route as YAML may spell it before normalization: `function` and middleware entries may be short-form module paths. */
|
|
41
|
+
export type AuthoredRouteConfig = Omit<RouteConfig, 'function' | 'middleware'> & {
|
|
42
|
+
function?: string | FunctionConfig;
|
|
43
|
+
middleware?: (string | MiddlewareConfig)[];
|
|
44
|
+
};
|
|
36
45
|
export interface LinkConfig {
|
|
37
46
|
collection: string;
|
|
38
47
|
code: ValueRef;
|
|
@@ -73,6 +82,8 @@ export interface PolicyConfigs {
|
|
|
73
82
|
/** One layer of policy configuration (profile, project or route); a layer may declare part of a policy, the merge supplies the rest. */
|
|
74
83
|
export type PolicyLayer = {
|
|
75
84
|
[K in PolicyName]?: Partial<PolicyConfigs[K]> | false;
|
|
85
|
+
} & {
|
|
86
|
+
extensions?: ExtensionPolicies | false;
|
|
76
87
|
};
|
|
77
88
|
export interface PoliciesConfig extends PolicyLayer {
|
|
78
89
|
profile?: string;
|
|
@@ -108,7 +119,42 @@ export interface SiteConfig {
|
|
|
108
119
|
llms?: string;
|
|
109
120
|
}
|
|
110
121
|
/** One route as declared in YAML (plus `generated`, which site.ts stamps on the routes it adds). */
|
|
122
|
+
export interface ConditionalReply {
|
|
123
|
+
redirect?: RedirectConfig;
|
|
124
|
+
respond?: RespondSpec;
|
|
125
|
+
}
|
|
126
|
+
export interface ConditionalConfig {
|
|
127
|
+
cases: (ConditionalReply & {
|
|
128
|
+
match: RouteMatch;
|
|
129
|
+
})[];
|
|
130
|
+
fallback?: ConditionalReply;
|
|
131
|
+
}
|
|
132
|
+
export type EgressHeaders = Record<string, string | {
|
|
133
|
+
secret: string;
|
|
134
|
+
}>;
|
|
135
|
+
export interface ProxyConfig extends Omit<ProxyDefinition, 'headers'> {
|
|
136
|
+
headers?: EgressHeaders;
|
|
137
|
+
}
|
|
138
|
+
export interface SignalConfig {
|
|
139
|
+
url: string;
|
|
140
|
+
headers?: EgressHeaders;
|
|
141
|
+
}
|
|
142
|
+
/** Route-level `auth` short form. Keys other than `required` mirror the auth extension's policy schema and expand to `policies.extensions.auth`. */
|
|
143
|
+
export interface RouteAuthConfig {
|
|
144
|
+
required?: boolean;
|
|
145
|
+
role?: string;
|
|
146
|
+
permission?: string;
|
|
147
|
+
verified?: boolean;
|
|
148
|
+
freshWithinSeconds?: number;
|
|
149
|
+
onDeny?: 401 | 403 | 404 | 'sign-in';
|
|
150
|
+
}
|
|
111
151
|
export interface RouteConfig {
|
|
152
|
+
extension?: string;
|
|
153
|
+
auth?: true | RouteAuthConfig;
|
|
154
|
+
proxy?: ProxyConfig;
|
|
155
|
+
signals?: SignalConfig[];
|
|
156
|
+
match?: RouteMatch;
|
|
157
|
+
conditional?: ConditionalConfig;
|
|
112
158
|
methods?: string[];
|
|
113
159
|
enabled?: boolean;
|
|
114
160
|
expires?: string;
|
|
@@ -136,6 +182,7 @@ export interface RouteConfig {
|
|
|
136
182
|
}
|
|
137
183
|
export interface ProjectDocument {
|
|
138
184
|
version: '1';
|
|
185
|
+
extensions?: Record<string, ExtensionDeclaration>;
|
|
139
186
|
routes: Record<string, RouteConfig>;
|
|
140
187
|
includes?: string[];
|
|
141
188
|
dynamicLinks?: boolean;
|
|
@@ -210,6 +257,16 @@ export interface CompiledRoute extends Omit<RouteConfig, 'methods' | 'parameters
|
|
|
210
257
|
policy?: PolicyChain | null;
|
|
211
258
|
/** Attached by build-cloudflare: the compiled policy states shipped in the Worker artifact. */
|
|
212
259
|
compiledPolicies?: Record<string, unknown>;
|
|
260
|
+
extensionPolicyNames?: string[];
|
|
261
|
+
compiledProxy?: ProxyDefinition;
|
|
262
|
+
compiledSignals?: SignalDefinition[];
|
|
263
|
+
conditionalRoutes?: {
|
|
264
|
+
cases: {
|
|
265
|
+
match: RouteMatch;
|
|
266
|
+
route: CompiledRoute;
|
|
267
|
+
}[];
|
|
268
|
+
fallback?: CompiledRoute;
|
|
269
|
+
};
|
|
213
270
|
}
|
|
214
271
|
export interface CompiledRouteTable {
|
|
215
272
|
exact: Map<string, CompiledRoute>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface TypeScriptBuildReport {
|
|
2
|
+
output: string;
|
|
3
|
+
dryRun: boolean;
|
|
4
|
+
modules: string[];
|
|
5
|
+
files: string[];
|
|
6
|
+
typeChecked: false;
|
|
7
|
+
}
|
|
8
|
+
/** Transpile a project snapshot ahead of runtime. No project compiler settings,
|
|
9
|
+
* plugins, package resolution, subprocesses or guest code execution are used. */
|
|
10
|
+
export declare function buildTypeScriptProject(project: string, output: string, { dryRun }?: {
|
|
11
|
+
dryRun?: boolean | undefined;
|
|
12
|
+
}): Promise<TypeScriptBuildReport>;
|
package/dist/types/vercel.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { RuntimeExtension } from './extensions.ts';
|
|
1
2
|
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
2
3
|
import type { Environment } from './adapters.ts';
|
|
3
4
|
import type { HostPlugin } from './runtime.ts';
|
|
@@ -7,6 +8,7 @@ export interface VercelHandlerOptions {
|
|
|
7
8
|
environment?: Environment | undefined;
|
|
8
9
|
maxBodyBytes?: number | undefined;
|
|
9
10
|
plugins?: HostPlugin[] | undefined;
|
|
11
|
+
extensions?: RuntimeExtension[] | undefined;
|
|
10
12
|
}
|
|
11
13
|
export type VercelHandler = (req: IncomingMessage, res: ServerResponse) => Promise<void>;
|
|
12
|
-
export declare function createVercelHandler({ project, origin, environment, maxBodyBytes, plugins }?: VercelHandlerOptions): VercelHandler;
|
|
14
|
+
export declare function createVercelHandler({ project, origin, environment, maxBodyBytes, plugins, extensions }?: VercelHandlerOptions): VercelHandler;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { RuntimeOptions } from './runtime.ts';
|
|
2
|
+
import type { ComplianceOptions, ComplianceReport, Severity } from './compliance.ts';
|
|
3
|
+
import type { LogFn } from './types.ts';
|
|
4
|
+
export type { Severity } from './compliance.ts';
|
|
5
|
+
export type FailOn = Severity | 'none';
|
|
6
|
+
export type CheckName = 'probes' | 'fixtures' | 'security' | 'cache' | 'compression' | 'agents' | 'throttle' | 'site' | 'methods' | 'errors' | 'head' | 'transport';
|
|
7
|
+
export interface VerifyFinding {
|
|
8
|
+
check: CheckName;
|
|
9
|
+
severity: Severity;
|
|
10
|
+
route?: string;
|
|
11
|
+
message: string;
|
|
12
|
+
expected?: string;
|
|
13
|
+
observed?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface VerifyOptions extends Pick<RuntimeOptions, 'permissions' | 'linkStore'> {
|
|
16
|
+
target: string;
|
|
17
|
+
origin?: string | undefined;
|
|
18
|
+
expectRoutes?: number | undefined;
|
|
19
|
+
timeoutMs?: number | undefined;
|
|
20
|
+
expectMetrics?: boolean | undefined;
|
|
21
|
+
failOn?: FailOn | undefined;
|
|
22
|
+
compliance?: ComplianceOptions | undefined;
|
|
23
|
+
complianceWarn?: boolean | undefined;
|
|
24
|
+
log?: LogFn | undefined;
|
|
25
|
+
}
|
|
26
|
+
export interface VerifyReport {
|
|
27
|
+
target: string;
|
|
28
|
+
version: {
|
|
29
|
+
local: string;
|
|
30
|
+
observed: string | null;
|
|
31
|
+
};
|
|
32
|
+
routes: {
|
|
33
|
+
local: number;
|
|
34
|
+
observed: number | null;
|
|
35
|
+
expected: number | null;
|
|
36
|
+
};
|
|
37
|
+
requests: number;
|
|
38
|
+
checks: number;
|
|
39
|
+
findings: VerifyFinding[];
|
|
40
|
+
counts: Record<Severity, number>;
|
|
41
|
+
notes: string[];
|
|
42
|
+
failOn: FailOn;
|
|
43
|
+
pass: boolean;
|
|
44
|
+
compliance: ComplianceReport | null;
|
|
45
|
+
}
|
|
46
|
+
export declare const failLevels: readonly FailOn[];
|
|
47
|
+
export declare function verifyDeployment(project: string, { target, origin, expectRoutes, timeoutMs, expectMetrics, failOn, compliance, complianceWarn, log, permissions, linkStore }: VerifyOptions): Promise<VerifyReport>;
|
package/dist/types.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
1
5
|
// Types shared across modules: the validated YAML document, the compiled
|
|
2
6
|
// route the router produces from it, and the host-side policy contract.
|
|
3
7
|
// This file is type-only (nothing here exists at run time) and append-only:
|
|
@@ -28,6 +32,8 @@
|
|
|
28
32
|
|
|
29
33
|
|
|
30
34
|
|
|
35
|
+
/** A route as YAML may spell it before normalization: `function` and middleware entries may be short-form module paths. */
|
|
36
|
+
|
|
31
37
|
|
|
32
38
|
|
|
33
39
|
|
|
@@ -39,7 +45,7 @@
|
|
|
39
45
|
|
|
40
46
|
/** One `policies` block or profile layer: every policy optional, `false` disables it. */
|
|
41
47
|
/** One layer of policy configuration (profile, project or route); a layer may declare part of a policy, the merge supplies the rest. */
|
|
42
|
-
|
|
48
|
+
|
|
43
49
|
|
|
44
50
|
/** The result of layering profiles and route keys: what compiles, per policy. */
|
|
45
51
|
|
|
@@ -52,7 +58,17 @@
|
|
|
52
58
|
|
|
53
59
|
|
|
54
60
|
/** One route as declared in YAML (plus `generated`, which site.ts stamps on the routes it adds). */
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
/** Route-level `auth` short form. Keys other than `required` mirror the auth extension's policy schema and expand to `policies.extensions.auth`. */
|
|
67
|
+
|
|
55
68
|
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
56
72
|
|
|
57
73
|
|
|
58
74
|
|
|
@@ -63,7 +79,7 @@
|
|
|
63
79
|
|
|
64
80
|
|
|
65
81
|
|
|
66
|
-
|
|
82
|
+
|
|
67
83
|
|
|
68
84
|
|
|
69
85
|
/** What config.ts returns: the entry document, the merged route table and the files it came from. */
|
|
@@ -101,6 +117,9 @@
|
|
|
101
117
|
|
|
102
118
|
|
|
103
119
|
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
104
123
|
|
|
105
124
|
|
|
106
125
|
|