@jimhoyd/urlcode 0.3.0 → 0.4.0-alpha.2
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 +122 -0
- package/.claude/skills/urlcode-operations/SKILL.md +108 -0
- package/.claude-plugin/marketplace.json +18 -0
- package/CONTRIBUTING.md +30 -2
- package/README.md +195 -255
- package/ROADMAP.md +143 -15
- package/SECURITY.md +31 -9
- package/dist/BUILD-MANIFEST.json +72 -47
- 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/build-static.js +134 -0
- package/dist/bulk.js +37 -0
- package/dist/capabilities.js +262 -0
- package/dist/capability-query.js +71 -0
- package/dist/catalog.js +105 -0
- package/dist/cli.js +165 -34
- package/dist/client-address.js +1 -1
- package/dist/compliance-rules/baseline.js +9 -17
- package/dist/compliance-rules/privacy.js +7 -18
- package/dist/compliance-rules/shared.js +0 -2
- package/dist/compliance-rules/strict.js +5 -5
- package/dist/compliance.js +6 -8
- package/dist/conditions.js +88 -0
- package/dist/config.js +69 -6
- package/dist/context.js +155 -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 +131 -0
- package/dist/extensions.js +231 -0
- package/dist/function-sources.js +49 -5
- package/dist/function-worker.js +3 -1
- package/dist/functions.js +84 -13
- package/dist/guest-api.js +29 -3
- package/dist/index.js +40 -6
- package/dist/init-with.js +165 -0
- package/dist/interchange-cli.js +42 -0
- package/dist/interchange.js +189 -0
- package/dist/manifest.js +109 -0
- package/dist/match.js +2 -2
- package/dist/mcp-authoring.js +147 -0
- package/dist/mcp.js +97 -0
- package/dist/observability.js +7 -21
- package/dist/operator-host.js +29 -0
- package/dist/plugins.js +12 -0
- package/dist/policies/agents.js +2 -2
- package/dist/policies/cache.js +8 -3
- package/dist/policies/compression.js +2 -1
- package/dist/policies/security.js +0 -0
- package/dist/policies.js +1 -1
- package/dist/policy.js +56 -15
- 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 +34 -11
- package/dist/recipes.js +41 -0
- package/dist/route-diff.js +106 -0
- package/dist/router.js +45 -7
- package/dist/runtime.js +164 -64
- package/dist/sandbox.js +48 -0
- package/dist/scaffold.js +0 -0
- package/dist/schema-query.js +62 -0
- package/dist/scripts/operational-drills.js +12 -54
- package/dist/server.js +3 -29
- package/dist/signals.js +24 -0
- package/dist/site.js +0 -0
- package/dist/tooling.js +96 -0
- package/dist/trusted-functions.js +210 -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/build-static.d.ts +43 -0
- package/dist/types/bulk.d.ts +27 -0
- package/dist/types/capabilities.d.ts +64 -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/shared.d.ts +0 -2
- package/dist/types/compliance-rules/strict.d.ts +0 -5
- package/dist/types/compliance.d.ts +0 -3
- package/dist/types/conditions.d.ts +19 -0
- package/dist/types/config.d.ts +21 -2
- package/dist/types/context.d.ts +66 -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 +177 -0
- package/dist/types/function-sources.d.ts +9 -0
- package/dist/types/functions.d.ts +48 -5
- package/dist/types/guest-api.d.ts +1 -0
- package/dist/types/index.d.ts +36 -6
- 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/manifest.d.ts +79 -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 +3 -14
- 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 -2
- package/dist/types/provider-verification.d.ts +53 -0
- package/dist/types/proxy.d.ts +21 -0
- package/dist/types/readiness.d.ts +10 -3
- package/dist/types/recipes.d.ts +30 -0
- package/dist/types/route-diff.d.ts +27 -0
- package/dist/types/router.d.ts +2 -1
- package/dist/types/runtime.d.ts +11 -27
- package/dist/types/sandbox.d.ts +12 -0
- package/dist/types/scaffold.d.ts +0 -2
- package/dist/types/schema-query.d.ts +12 -0
- package/dist/types/server.d.ts +1 -4
- 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/trusted-functions.d.ts +29 -0
- package/dist/types/types.d.ts +71 -7
- 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 +37 -5
- package/dist/typescript-authoring.js +142 -0
- package/dist/vercel.js +4 -3
- package/dist/verify-deployment.js +270 -0
- package/docs/AI-AUTHORING.md +232 -15
- package/docs/AWS.md +4 -4
- package/docs/BEST-PRACTICES.md +3 -2
- package/docs/BULK.md +79 -0
- package/docs/CAPABILITIES.md +192 -0
- package/docs/CAPACITY.md +129 -32
- package/docs/CI.md +142 -0
- package/docs/CLOUDFLARE.md +1 -2
- package/docs/COMPLIANCE.md +6 -9
- package/docs/CONDITIONS.md +74 -0
- package/docs/DEPLOYMENT-CHECKS.md +108 -0
- package/docs/EGRESS.md +125 -0
- package/docs/EXTENSIONS.md +398 -0
- package/docs/FRAMEWORK.md +198 -0
- package/docs/FUNCTION-SECURITY.md +129 -32
- package/docs/INSTALL.md +45 -12
- package/docs/INTERCHANGE.md +134 -0
- package/docs/LOAD-TESTING.md +4 -4
- package/docs/MIDDLEWARE-EXAMPLES.md +75 -0
- package/docs/MIDDLEWARE.md +29 -16
- package/docs/MONITORING.md +2 -19
- package/docs/NEXT-PHASE-PLAN.md +98 -0
- package/docs/NEXT-STEPS.md +634 -0
- package/docs/OBSERVABILITY.md +11 -18
- package/docs/OPEN-DECISIONS.md +212 -0
- package/docs/OPERATIONAL-PROOF.md +30 -31
- package/docs/OPERATIONS.md +29 -35
- package/docs/PLUGINS.md +37 -0
- package/docs/POLICIES.md +23 -309
- package/docs/PRERENDER.md +41 -1
- package/docs/PROJECT-DIRECTION.md +75 -8
- package/docs/PROVIDER-VERIFICATION.md +84 -0
- package/docs/READINESS.md +21 -1
- package/docs/README.md +87 -34
- package/docs/RECIPES.md +99 -0
- package/docs/RELEASE-READINESS.md +57 -35
- package/docs/RELEASE-SECURITY.md +116 -7
- package/docs/RESILIENCE.md +16 -15
- package/docs/ROUTING.md +8 -10
- package/docs/SANDBOX-REVIEW.md +19 -6
- package/docs/SCAFFOLDING.md +0 -2
- package/docs/SECURITY-AUDIT.md +41 -1
- package/docs/SPECIFICATION.md +150 -29
- package/docs/SPIKE-AI-FRAMEWORK-BENCHMARK.md +287 -0
- package/docs/SPIKE-BUSINESS-SUITE.md +1021 -0
- package/docs/SPIKE-CORE-LAYERING.md +337 -0
- package/docs/SPIKE-DEFAULT-TRUST-MODEL.md +209 -0
- package/docs/SPIKE-EXTENSION-MODEL.md +419 -0
- package/docs/SPIKE-EXTENSIONS.md +6 -0
- package/docs/SPIKE-LAMBDA-COMPILE.md +201 -0
- package/docs/SPIKE-MONOREPO.md +322 -0
- package/docs/STANDARDS.md +150 -142
- package/docs/STARTERS.md +21 -1
- package/docs/STATIC.md +94 -0
- package/docs/TOOLING.md +295 -0
- package/docs/TUNNELS.md +0 -3
- package/docs/TYPESCRIPT-AUTHORING.md +82 -0
- package/docs/TYPESCRIPT.md +25 -4
- package/docs/USABILITY-REVIEW.md +129 -0
- package/docs/VERCEL.md +4 -5
- package/docs/VERSION-ALIGNMENT.md +205 -0
- package/docs/YAML-GUIDE.md +15 -479
- package/docs/YAML-REFERENCE.md +143 -22
- package/docs/policies/agents.md +1 -1
- package/docs/policies/cache.md +13 -0
- 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/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 +29 -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 +20 -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/monitoring/example.yaml +8 -0
- package/examples/prerender/README.md +2 -2
- 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 +3084 -0
- package/llms.txt +61 -21
- package/package.json +36 -7
- package/packaging/claude-plugin/.claude-plugin/plugin.json +19 -0
- package/packaging/claude-plugin/skills/urlcode-authoring/SKILL.md +122 -0
- package/packaging/claude-plugin/skills/urlcode-operations/SKILL.md +108 -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 +29 -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 +20 -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 +8 -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 +20 -0
- package/recipes/webhook-receiver/functions/receive.mjs +16 -0
- package/recipes/webhook-receiver/recipe.yaml +27 -0
- package/recipes/webhook-receiver/tests/requests.json +59 -0
- package/recipes/webhook-receiver/urlcode.yaml +23 -0
- package/schemas/recipe.schema.json +139 -0
- package/schemas/urlcode.schema.json +659 -110
- package/skills/urlcode/SKILL.md +119 -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/starters/default/urlcode.yaml +0 -1
- package/dist/link-api.js +0 -136
- package/dist/link-cli.js +0 -141
- package/dist/link-events.js +0 -76
- package/dist/link-records.js +0 -31
- package/dist/link-store-worker.js +0 -150
- package/dist/link-store.js +0 -250
- package/dist/management-policy.js +0 -41
- package/dist/sqlite-version.js +0 -6
- package/dist/types/link-api.d.ts +0 -30
- package/dist/types/link-cli.d.ts +0 -36
- package/dist/types/link-events.d.ts +0 -27
- package/dist/types/link-records.d.ts +0 -11
- package/dist/types/link-store-worker.d.ts +0 -1
- package/dist/types/link-store.d.ts +0 -130
- package/dist/types/management-policy.d.ts +0 -9
- package/dist/types/sqlite-version.d.ts +0 -1
- package/docs/DYNAMIC-LINKS.md +0 -561
- package/docs/MANAGEMENT-SECURITY.md +0 -82
- package/examples/live-links/README.md +0 -11
- package/examples/live-links/tests/requests.json +0 -6
- package/examples/live-links/urlcode.yaml +0 -16
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { RuntimeExtension } from './extensions.ts';
|
|
2
|
+
import type { CompiledRoute, CompiledRouteTable, LoadedDocument, PolicySupport, ProjectDocument, RouteConfig } from './types.ts';
|
|
3
|
+
export declare const capabilityTargets: readonly ["self-hosted", "cloudflare", "aws", "vercel", "static"];
|
|
4
|
+
export type CapabilityTarget = typeof capabilityTargets[number];
|
|
5
|
+
export type CapabilitySupport = PolicySupport | 'conditional' | 'unknown';
|
|
6
|
+
export declare const capabilityNames: readonly ["extension", "policies.extensions", "proxy", "signals", "conditional", "conditions", "redirect", "respond", "page", "static", "download", "function", "middleware", "parameters", "methods", "enabled", "expires", "request.body", "response.headers", "bindings", "policies.agents", "policies.security", "policies.cache", "policies.compression", "policies.throttle"];
|
|
7
|
+
export type CapabilityName = typeof capabilityNames[number];
|
|
8
|
+
/** The resolved operator registration set, when known (loaded via --host-file, same as `inspectExtensions`). Keyed by extension name. */
|
|
9
|
+
export type ExtensionRegistry = ReadonlyMap<string, RuntimeExtension>;
|
|
10
|
+
export interface CapabilityDecision {
|
|
11
|
+
support: CapabilitySupport;
|
|
12
|
+
reason: string;
|
|
13
|
+
}
|
|
14
|
+
export interface CapabilityRequirement extends CapabilityDecision {
|
|
15
|
+
path: string;
|
|
16
|
+
capability: CapabilityName;
|
|
17
|
+
}
|
|
18
|
+
export interface CompatibilityReport {
|
|
19
|
+
target: CapabilityTarget;
|
|
20
|
+
compatible: boolean;
|
|
21
|
+
requirements: CapabilityRequirement[];
|
|
22
|
+
issues: CapabilityRequirement[];
|
|
23
|
+
deployment: 'local-runtime' | 'unverified';
|
|
24
|
+
}
|
|
25
|
+
export interface CapabilityCatalog {
|
|
26
|
+
format: 1;
|
|
27
|
+
targets: {
|
|
28
|
+
target: CapabilityTarget;
|
|
29
|
+
deployment: CompatibilityReport['deployment'];
|
|
30
|
+
}[];
|
|
31
|
+
capabilities: {
|
|
32
|
+
capability: CapabilityName;
|
|
33
|
+
targets: Partial<Record<CapabilityTarget, CapabilityDecision>>;
|
|
34
|
+
}[];
|
|
35
|
+
}
|
|
36
|
+
export declare function normalizeCapabilityTarget(target: string): CapabilityTarget;
|
|
37
|
+
/** Catalog, not a claim that every configuration or provider deployment works. */
|
|
38
|
+
export declare function getCapabilities(target?: string): CapabilityCatalog;
|
|
39
|
+
/** A safe projection shared by declaration preflight and the existing compiled IR. No values escape. */
|
|
40
|
+
export declare function routeCapabilities(route: RouteConfig | CompiledRoute, document: ProjectDocument): CapabilityName[];
|
|
41
|
+
/**
|
|
42
|
+
* Preflight only: call after schema validation/site expansion, before resolving bindings.
|
|
43
|
+
* `registrations` is the resolved operator extension set, when known (the same
|
|
44
|
+
* shape --host-file loads for `inspectExtensions`); without it, `extension`/
|
|
45
|
+
* `policies.extensions` requirements report `conditional`/`unknown` rather
|
|
46
|
+
* than a blanket `native` that ignores the specific extension's own targets.
|
|
47
|
+
*/
|
|
48
|
+
export declare function analyzeProjectCapabilities(loaded: LoadedDocument, target: string, registrations?: readonly RuntimeExtension[]): CompatibilityReport;
|
|
49
|
+
/** Analyze normalized route semantics without exporting validators, resources or resolved secrets. */
|
|
50
|
+
export declare function analyzeCompiledCapabilities(document: ProjectDocument, compiled: CompiledRouteTable, target: string, registrations?: readonly RuntimeExtension[]): CompatibilityReport;
|
|
51
|
+
export declare function assertTargetCompatibility(report: CompatibilityReport): void;
|
|
52
|
+
export declare function formatCapabilities(catalog: CapabilityCatalog): string;
|
|
53
|
+
export type CapabilityKind = 'handler' | 'policy' | 'routing' | 'request' | 'binding' | 'egress' | 'middleware' | 'project';
|
|
54
|
+
export interface CapabilityDetail {
|
|
55
|
+
kind: CapabilityKind;
|
|
56
|
+
summary: string;
|
|
57
|
+
/** Dotted schema paths (`urlcode schema <path>`) whose fragments describe this capability's YAML. */
|
|
58
|
+
schema: string[];
|
|
59
|
+
constraints: string[];
|
|
60
|
+
/** Operator authority the capability needs at activation; never binding values. */
|
|
61
|
+
grants: string[];
|
|
62
|
+
}
|
|
63
|
+
/** Static facts about each catalog entry. Per-target support stays in `decision`; recipe and cookbook usage is scanned by `getCapability`. */
|
|
64
|
+
export declare const capabilityDetails: Record<CapabilityName, CapabilityDetail>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { formatCapabilities } from './capabilities.ts';
|
|
2
|
+
import type { CapabilityDecision, CapabilityDetail, CapabilityName, CapabilityTarget } from './capabilities.ts';
|
|
3
|
+
import type { SchemaFragment } from './schema-query.ts';
|
|
4
|
+
export interface CapabilityUsage {
|
|
5
|
+
file: string;
|
|
6
|
+
routes: string[];
|
|
7
|
+
}
|
|
8
|
+
export interface CapabilityEntry extends CapabilityDetail {
|
|
9
|
+
format: 1;
|
|
10
|
+
name: CapabilityName;
|
|
11
|
+
schemaFragments: SchemaFragment[];
|
|
12
|
+
targets: Record<CapabilityTarget, CapabilityDecision>;
|
|
13
|
+
refused: {
|
|
14
|
+
target: CapabilityTarget;
|
|
15
|
+
reason: string;
|
|
16
|
+
}[];
|
|
17
|
+
recipes: CapabilityUsage[];
|
|
18
|
+
cookbook: CapabilityUsage[];
|
|
19
|
+
}
|
|
20
|
+
export declare function capabilityNameList(): readonly CapabilityName[];
|
|
21
|
+
/** One catalog entry with its schema fragments and bundled usage. No project, credentials or network are read. */
|
|
22
|
+
export declare function getCapability(name: string): CapabilityEntry;
|
|
23
|
+
export declare function formatCapability(entry: CapabilityEntry): string;
|
|
24
|
+
export { formatCapabilities };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { CapabilityName, CapabilityTarget } from './capabilities.ts';
|
|
2
|
+
/**
|
|
3
|
+
* The metadata shape shared by recipes/NAME/recipe.yaml and examples/NAME/example.yaml
|
|
4
|
+
* (schemas/recipe.schema.json). The catalog entries are fixed package data: names
|
|
5
|
+
* come from a list in code, never from a directory scan, a registry or an argument.
|
|
6
|
+
*/
|
|
7
|
+
export type TargetVerdict = 'compatible' | 'conditional' | 'refused' | 'unknown';
|
|
8
|
+
export type Complexity = 'starter' | 'intermediate' | 'advanced';
|
|
9
|
+
export interface CatalogMetadata {
|
|
10
|
+
id: string;
|
|
11
|
+
description: string;
|
|
12
|
+
tags: string[];
|
|
13
|
+
complexity: Complexity;
|
|
14
|
+
runnable?: boolean;
|
|
15
|
+
capabilities?: string[];
|
|
16
|
+
targets?: Record<CapabilityTarget, TargetVerdict>;
|
|
17
|
+
routes?: number;
|
|
18
|
+
services?: {
|
|
19
|
+
name: string;
|
|
20
|
+
description: string;
|
|
21
|
+
}[];
|
|
22
|
+
grants?: {
|
|
23
|
+
kind: string;
|
|
24
|
+
description: string;
|
|
25
|
+
}[];
|
|
26
|
+
inputs?: {
|
|
27
|
+
name: string;
|
|
28
|
+
file: string;
|
|
29
|
+
description: string;
|
|
30
|
+
}[];
|
|
31
|
+
files: string[];
|
|
32
|
+
tests?: {
|
|
33
|
+
fixtures?: string;
|
|
34
|
+
commands: string[];
|
|
35
|
+
};
|
|
36
|
+
behavior?: string[];
|
|
37
|
+
}
|
|
38
|
+
/** The fields the capability preflight determines; `npm run check` refuses hand-written values that differ. */
|
|
39
|
+
export interface DerivedMetadata {
|
|
40
|
+
capabilities: CapabilityName[];
|
|
41
|
+
targets: Record<CapabilityTarget, TargetVerdict>;
|
|
42
|
+
routes: number;
|
|
43
|
+
}
|
|
44
|
+
export interface SearchHit<T extends CatalogMetadata> {
|
|
45
|
+
entry: T;
|
|
46
|
+
score: number;
|
|
47
|
+
matched: string[];
|
|
48
|
+
}
|
|
49
|
+
export declare const metadataFiles: {
|
|
50
|
+
readonly recipe: "recipe.yaml";
|
|
51
|
+
readonly example: "example.yaml";
|
|
52
|
+
};
|
|
53
|
+
/** Reads and schema-validates one metadata file; the id must equal the directory name, and file lists stay authoring-safe paths. */
|
|
54
|
+
export declare function readMetadata(root: string, id: string, file: 'recipe.yaml' | 'example.yaml'): Promise<CatalogMetadata>;
|
|
55
|
+
/** Preflight only: loads the project, expands site routes and asks the capability analysis for every target. No bindings, code or activation. */
|
|
56
|
+
export declare function deriveMetadata(root: string): Promise<DerivedMetadata>;
|
|
57
|
+
/** Reports where hand-written derived fields disagree with the preflight; empty means consistent. */
|
|
58
|
+
export declare function derivedDifferences(metadata: CatalogMetadata, derived: DerivedMetadata): string[];
|
|
59
|
+
export declare function searchTerms(text: string): string[];
|
|
60
|
+
/**
|
|
61
|
+
* Local search over id, description, tags and capabilities: every term must match
|
|
62
|
+
* somewhere; the score prefers whole-tag and id hits over description substrings.
|
|
63
|
+
* Ties keep catalog order, so the smallest entry wins when a caller sorts by size first.
|
|
64
|
+
*/
|
|
65
|
+
export declare function searchMetadata<T extends CatalogMetadata>(entries: readonly T[], text: string, extraText?: (entry: T) => string[]): SearchHit<T>[];
|
|
@@ -4,6 +4,5 @@ export interface Cidr {
|
|
|
4
4
|
}
|
|
5
5
|
export declare function parseCidr(text: string): Cidr;
|
|
6
6
|
export declare function compileTrustedProxies(list?: string | string[]): Cidr[];
|
|
7
|
-
export declare function isTrustedProxy(address: string, trusted: Cidr[]): boolean;
|
|
8
7
|
export declare function resolveClient(peer: string | undefined, forwarded: string | undefined, trusted: Cidr[]): string | undefined;
|
|
9
8
|
export declare function normalizeAddress(address: unknown): string | undefined;
|
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
import type { ComplianceRule, ProjectRule
|
|
1
|
+
import type { ComplianceRule, ProjectRule } from '../compliance.ts';
|
|
2
2
|
export declare const profile = "baseline";
|
|
3
|
-
export declare const securityHeaders: RouteRule;
|
|
4
|
-
export declare const hstsOrigin: ProjectRule;
|
|
5
|
-
export declare const secretsCompression: RouteRule;
|
|
6
|
-
export declare const secretsNoStore: RouteRule;
|
|
7
|
-
export declare const cacheControlDeclared: RouteRule;
|
|
8
|
-
export declare const throttleFunctions: RouteRule;
|
|
9
3
|
export declare const robots: ProjectRule;
|
|
10
|
-
export declare const expiredRoutes: ProjectRule;
|
|
11
|
-
export declare const managementPrivate: ProjectRule;
|
|
12
4
|
export declare const rules: readonly ComplianceRule[];
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import type { ComplianceRule
|
|
1
|
+
import type { ComplianceRule } from '../compliance.ts';
|
|
2
2
|
export declare const profile = "privacy";
|
|
3
|
-
export declare const requestLogMinimal: ProjectRule;
|
|
4
|
-
export declare const linkEventsOff: ProjectRule;
|
|
5
|
-
export declare const detailedParameters: RouteRule;
|
|
6
3
|
export declare const rules: readonly ComplianceRule[];
|
|
@@ -7,8 +7,6 @@ export declare const rfc6585: Standard;
|
|
|
7
7
|
export declare const rfc9309: Standard;
|
|
8
8
|
export declare const breach: Standard;
|
|
9
9
|
export declare const monitoring: Standard;
|
|
10
|
-
export declare const linkChannel: Standard;
|
|
11
|
-
export declare const management: Standard;
|
|
12
10
|
export declare const agentLists: Standard;
|
|
13
11
|
export declare const active: (route: PlanInventoryEntry) => boolean;
|
|
14
12
|
export declare const functionLike: (route: PlanInventoryEntry) => boolean;
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
import type { ComplianceRule, RouteRule } from '../compliance.ts';
|
|
2
2
|
export declare const profile = "strict";
|
|
3
|
-
export declare const headerBudgetBytes = 8192;
|
|
4
3
|
export declare const csp: RouteRule;
|
|
5
|
-
export declare const throttleAll: RouteRule;
|
|
6
|
-
export declare const listsPinned: RouteRule;
|
|
7
|
-
export declare const redirectHttps: RouteRule;
|
|
8
|
-
export declare const headerBudget: RouteRule;
|
|
9
4
|
export declare const rules: readonly ComplianceRule[];
|
|
@@ -27,8 +27,6 @@ export type RuleResult = RawFinding[] | RawFinding | null | undefined | false;
|
|
|
27
27
|
/** The host settings under review, null where the operator declared nothing. */
|
|
28
28
|
export interface HostSettings {
|
|
29
29
|
requestLog: 'minimal' | 'detailed' | null;
|
|
30
|
-
linkEvents: boolean | null;
|
|
31
|
-
includeCode: boolean | null;
|
|
32
30
|
}
|
|
33
31
|
export interface ProjectContext {
|
|
34
32
|
document: ProjectDocument;
|
|
@@ -92,7 +90,6 @@ export interface ComplianceReport {
|
|
|
92
90
|
evidence: {
|
|
93
91
|
routes: number;
|
|
94
92
|
active: number;
|
|
95
|
-
dynamicLinks: boolean;
|
|
96
93
|
policies: string[];
|
|
97
94
|
files: string[];
|
|
98
95
|
origin: string | null;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** Bounded conjunction of exact string comparisons; no regex or implicit detection. */
|
|
2
|
+
export interface RouteMatch {
|
|
3
|
+
query?: Record<string, string>;
|
|
4
|
+
headers?: Record<string, string>;
|
|
5
|
+
cookies?: Record<string, string>;
|
|
6
|
+
host?: string;
|
|
7
|
+
method?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface ConditionRequest {
|
|
10
|
+
query: URLSearchParams;
|
|
11
|
+
headers: Headers;
|
|
12
|
+
method: string;
|
|
13
|
+
origin: string;
|
|
14
|
+
headerCounts?: Record<string, number> | undefined;
|
|
15
|
+
}
|
|
16
|
+
export declare function normalizeMatch(match: RouteMatch): RouteMatch;
|
|
17
|
+
/** Cases must be disjoint: at least one shared fact must demand different values. */
|
|
18
|
+
export declare function assertDisjointMatches(matches: RouteMatch[]): void;
|
|
19
|
+
export declare function matchesRoute(match: RouteMatch, request: ConditionRequest): boolean;
|
package/dist/types/config.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { LoadedDocument, ProjectDocument } from './types.ts';
|
|
1
|
+
import type { AuthoredRouteConfig, LoadedDocument, ProjectDocument, RouteConfig } from './types.ts';
|
|
2
2
|
/** What config-worker.ts posts back: the loaded document, or the ConfigError message. */
|
|
3
3
|
export type ConfigWorkerResult = {
|
|
4
4
|
value: LoadedDocument;
|
|
@@ -11,11 +11,30 @@ export interface ConfigWorkerData {
|
|
|
11
11
|
export declare const MAX_CONFIG_BYTES: number;
|
|
12
12
|
export declare function parseYaml(text: string): unknown;
|
|
13
13
|
export declare function validateDocument(data: unknown): ProjectDocument;
|
|
14
|
+
/** The input declaration a short-form function gets for each `{param}` it does not declare itself. */
|
|
15
|
+
export declare const SHORT_FORM_PATH_SCHEMA: {
|
|
16
|
+
readonly type: "string";
|
|
17
|
+
readonly minLength: 1;
|
|
18
|
+
readonly maxLength: 128;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Expands the YAML short forms into the canonical long form. `function: functions/x.mjs`
|
|
22
|
+
* becomes `{source, args}` with an argument per `{param}` in the path, declaring any
|
|
23
|
+
* parameter the route does not declare itself; a string middleware entry becomes `{source}`;
|
|
24
|
+
* a route-level `cache` becomes `policies.cache` (refused alongside a direct `policies.cache`).
|
|
25
|
+
* Everything downstream (routes, audit, the compiled table) sees only the long form.
|
|
26
|
+
*/
|
|
27
|
+
export declare function normalizeRoute(pattern: string, route: AuthoredRouteConfig | RouteConfig): RouteConfig;
|
|
14
28
|
export declare function safeFile(root: string, file: unknown): Promise<string>;
|
|
15
|
-
export declare const MAX_PROJECT_CONFIG_BYTES: number;
|
|
16
29
|
export declare function loadDocument(project: string, { timeoutMs }?: {
|
|
17
30
|
timeoutMs?: number;
|
|
18
31
|
}): Promise<LoadedDocument>;
|
|
32
|
+
/**
|
|
33
|
+
* Expands the route-level `auth` short form into the canonical `policies.extensions.auth` requirement so every
|
|
34
|
+
* downstream consumer (compiler, routes, audit, explain, revision hash) sees one form. `auth: {required: false}`
|
|
35
|
+
* documents intent and emits nothing. Refuses routes that use both forms or lack an `extensions.auth` declaration.
|
|
36
|
+
*/
|
|
37
|
+
export declare function normalizeRouteAuth(document: Pick<ProjectDocument, 'extensions'>, routes: Record<string, RouteConfig>): void;
|
|
19
38
|
export declare function loadDocumentInWorker(project: string): Promise<LoadedDocument>;
|
|
20
39
|
export declare function loadBindings(root: string, local?: boolean, environment?: Record<string, string | undefined>): Promise<Record<string, string | undefined>>;
|
|
21
40
|
export declare function functionFile(root: string, file: string): Promise<string>;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
export interface ContextOptions {
|
|
2
|
+
/** Restrict the target table to one capability target. */
|
|
3
|
+
target?: string | undefined;
|
|
4
|
+
/** Absolute path to a trusted operator host module outside the project; its extensions and plugins are counted, never run. */
|
|
5
|
+
hostFile?: string | undefined;
|
|
6
|
+
/** Estimated token budget; sections are dropped in a fixed order until the YAML rendering fits. */
|
|
7
|
+
budget?: number | undefined;
|
|
8
|
+
/** What `--project` should say in the emitted commands; defaults to the project argument itself. */
|
|
9
|
+
projectFlag?: string | undefined;
|
|
10
|
+
}
|
|
11
|
+
export type ContextSection = 'routes' | 'targets' | 'constraintNotes' | 'files' | 'commands' | 'summary';
|
|
12
|
+
export interface ProjectContext {
|
|
13
|
+
urlcode: string;
|
|
14
|
+
schema: '1';
|
|
15
|
+
project: {
|
|
16
|
+
entry: string;
|
|
17
|
+
routes: number;
|
|
18
|
+
handlers: Record<string, number>;
|
|
19
|
+
extensions: string[];
|
|
20
|
+
policies: {
|
|
21
|
+
project: string[];
|
|
22
|
+
routes: Record<string, number>;
|
|
23
|
+
};
|
|
24
|
+
bindings: {
|
|
25
|
+
env: string[];
|
|
26
|
+
secrets: string[];
|
|
27
|
+
};
|
|
28
|
+
site: string[];
|
|
29
|
+
files?: {
|
|
30
|
+
includes: string[];
|
|
31
|
+
functions: string[];
|
|
32
|
+
middleware: string[];
|
|
33
|
+
};
|
|
34
|
+
host?: {
|
|
35
|
+
extensions: string[];
|
|
36
|
+
plugins: number;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
routes?: {
|
|
40
|
+
path: string;
|
|
41
|
+
methods: string[];
|
|
42
|
+
handler: string;
|
|
43
|
+
sandbox: boolean;
|
|
44
|
+
sandboxReason?: string;
|
|
45
|
+
}[];
|
|
46
|
+
constraints: Record<string, boolean | string | {
|
|
47
|
+
value: boolean | string;
|
|
48
|
+
note: string;
|
|
49
|
+
}>;
|
|
50
|
+
targets?: Record<string, {
|
|
51
|
+
deployment: string;
|
|
52
|
+
supported: string[];
|
|
53
|
+
conditional: string[];
|
|
54
|
+
refused: string[];
|
|
55
|
+
unknown: string[];
|
|
56
|
+
}>;
|
|
57
|
+
commands?: Record<string, string>;
|
|
58
|
+
omitted?: ContextSection[];
|
|
59
|
+
}
|
|
60
|
+
/** Characters divided by four, rounded up: an estimate, not a tokenizer. */
|
|
61
|
+
export declare function estimateTokens(text: string): number;
|
|
62
|
+
export declare function renderContext(context: ProjectContext): string;
|
|
63
|
+
/** Derived only from the compiled project and the capability catalog, never from prose. Key order is fixed. */
|
|
64
|
+
export declare function buildContext(project: string, options?: ContextOptions): Promise<ProjectContext>;
|
|
65
|
+
/** Estimated size of the shipped documentation (docs/*.md and llms.txt), for comparison with an emitted context. */
|
|
66
|
+
export declare function documentationTokens(): Promise<number>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
interface Options {
|
|
2
|
+
json?: boolean | undefined;
|
|
3
|
+
project: string;
|
|
4
|
+
out?: string | undefined;
|
|
5
|
+
format?: string | undefined;
|
|
6
|
+
input?: string | undefined;
|
|
7
|
+
target?: string | undefined;
|
|
8
|
+
origin?: string | undefined;
|
|
9
|
+
'dry-run'?: boolean | undefined;
|
|
10
|
+
'timeout-ms'?: string | undefined;
|
|
11
|
+
release?: string | undefined;
|
|
12
|
+
'git-commit'?: string | undefined;
|
|
13
|
+
'allow-authoring'?: boolean | undefined;
|
|
14
|
+
'host-file'?: string | undefined;
|
|
15
|
+
}
|
|
16
|
+
export declare function runEcosystemCommand(command: string, args: string[], options: Options, print: (value: unknown) => unknown): Promise<void>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { request } from 'node:https';
|
|
2
|
+
export declare const EGRESS_DNS_LIMIT = 64;
|
|
3
|
+
export interface EgressRequest {
|
|
4
|
+
url: string;
|
|
5
|
+
method: string;
|
|
6
|
+
headers?: Record<string, string>;
|
|
7
|
+
body?: Uint8Array;
|
|
8
|
+
signal?: AbortSignal;
|
|
9
|
+
}
|
|
10
|
+
export interface EgressResponse {
|
|
11
|
+
status: number;
|
|
12
|
+
headers: Record<string, string>;
|
|
13
|
+
body: Buffer;
|
|
14
|
+
}
|
|
15
|
+
export interface EgressOptions {
|
|
16
|
+
grantOrigins: string[];
|
|
17
|
+
timeoutMs?: number;
|
|
18
|
+
maxRequestBytes?: number;
|
|
19
|
+
maxResponseBytes?: number;
|
|
20
|
+
maxHeaderBytes?: number;
|
|
21
|
+
concurrency?: number;
|
|
22
|
+
}
|
|
23
|
+
type EgressErrorCode = 'denied' | 'busy' | 'closed' | 'aborted' | 'timeout' | 'limit' | 'upstream';
|
|
24
|
+
export declare class EgressError extends Error {
|
|
25
|
+
readonly code: EgressErrorCode;
|
|
26
|
+
constructor(code: EgressErrorCode);
|
|
27
|
+
}
|
|
28
|
+
/** Conservative public-unicast filter. IPv4-mapped IPv6 and transition mechanisms are denied. */
|
|
29
|
+
export declare function isPublicAddress(address: string): boolean;
|
|
30
|
+
export declare function egressUrl(value: string): URL;
|
|
31
|
+
export declare function safeEgressHeaders(headers: Record<string, string>, maxBytes?: number): Record<string, string>;
|
|
32
|
+
/** Operator-owned transport. Never exposed to guests. Each request has its own nonpooled socket. */
|
|
33
|
+
export interface EgressDependencies {
|
|
34
|
+
resolve?: (hostname: string) => Promise<{
|
|
35
|
+
address: string;
|
|
36
|
+
family: number;
|
|
37
|
+
}[]>;
|
|
38
|
+
request?: typeof request;
|
|
39
|
+
}
|
|
40
|
+
export declare class EgressClient {
|
|
41
|
+
#private;
|
|
42
|
+
constructor(options: EgressOptions, dependencies?: EgressDependencies);
|
|
43
|
+
request(input: EgressRequest): Promise<EgressResponse>;
|
|
44
|
+
close(): Promise<void>;
|
|
45
|
+
}
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { CatalogMetadata } from './catalog.ts';
|
|
2
|
+
/** example.yaml, the same schema as recipe.yaml; `name` repeats `id`. */
|
|
3
|
+
export interface ExampleSummary extends CatalogMetadata {
|
|
4
|
+
name: string;
|
|
5
|
+
}
|
|
6
|
+
/** One cookbook route in the generated tag index (examples/cookbook/route-index.json). */
|
|
7
|
+
export interface RouteIndexEntry {
|
|
8
|
+
path: string;
|
|
9
|
+
file: string;
|
|
10
|
+
handler: string;
|
|
11
|
+
methods: string[];
|
|
12
|
+
tags: string[];
|
|
13
|
+
description: string;
|
|
14
|
+
}
|
|
15
|
+
export interface RouteIndex {
|
|
16
|
+
format: 1;
|
|
17
|
+
project: string;
|
|
18
|
+
routes: number;
|
|
19
|
+
entries: RouteIndexEntry[];
|
|
20
|
+
}
|
|
21
|
+
export interface ExampleSearchResult {
|
|
22
|
+
query: string;
|
|
23
|
+
count: number;
|
|
24
|
+
/** The smallest matching runnable example, and its best matching cookbook route when the cookbook is that example. */
|
|
25
|
+
best: (ExampleSummary & {
|
|
26
|
+
route?: RouteIndexEntry;
|
|
27
|
+
}) | null;
|
|
28
|
+
results: (ExampleSummary & {
|
|
29
|
+
score: number;
|
|
30
|
+
matched: string[];
|
|
31
|
+
matchedRoutes: RouteIndexEntry[];
|
|
32
|
+
})[];
|
|
33
|
+
}
|
|
34
|
+
export declare const exampleNames: readonly ["assets", "aws", "cloudflare", "compliance", "conditions", "cookbook", "egress", "extensions", "monitoring", "prerender", "provider-conformance", "tunnel", "vercel"];
|
|
35
|
+
export declare const routeIndexFile = "route-index.json";
|
|
36
|
+
export declare function listExamples(): Promise<ExampleSummary[]>;
|
|
37
|
+
/**
|
|
38
|
+
* Derives the per-route tag index of one project from its loaded routes: handler,
|
|
39
|
+
* methods, capabilities, policy names and middleware module names. The file each
|
|
40
|
+
* route comes from is read from the entry and its includes; routes that neither
|
|
41
|
+
* declares were generated by `site`.
|
|
42
|
+
*/
|
|
43
|
+
export declare function buildRouteIndex(project: string, label: string): Promise<RouteIndex>;
|
|
44
|
+
export declare function readRouteIndex(name: string): Promise<RouteIndex>;
|
|
45
|
+
/**
|
|
46
|
+
* Searches example.yaml files and the cookbook's per-route index locally. Results
|
|
47
|
+
* are ordered smallest runnable example first, so `best` is the least code that
|
|
48
|
+
* demonstrates the match; cookbook hits carry their matching routes.
|
|
49
|
+
*/
|
|
50
|
+
export declare function searchExamples(text: string): Promise<ExampleSearchResult>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { RuntimeExtension } from './extensions.ts';
|
|
2
|
+
interface Options {
|
|
3
|
+
project: string;
|
|
4
|
+
target?: string | undefined;
|
|
5
|
+
origin?: string | undefined;
|
|
6
|
+
json?: boolean | undefined;
|
|
7
|
+
extensions?: RuntimeExtension[] | undefined;
|
|
8
|
+
}
|
|
9
|
+
/** Returns the process exit code: 1 when a requested route does not exist. */
|
|
10
|
+
export declare function runExplainCommand(command: 'explain' | 'manifest', route: string | undefined, options: Options, print: (value: unknown) => unknown): Promise<number>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type { CapabilityName, CapabilityTarget } from './capabilities.ts';
|
|
2
|
+
import type { RuntimeExtension } from './extensions.ts';
|
|
3
|
+
import type { CompiledRoute, LoadedDocument, PolicyChain, PolicyInventory, RouteState } from './types.ts';
|
|
4
|
+
import type { HandlerName } from './readiness.ts';
|
|
5
|
+
import type { ParameterSchema, ParameterLocation } from './match.ts';
|
|
6
|
+
import type { RequestBodyPolicy } from './http-policy.ts';
|
|
7
|
+
export interface ExplainedHandler {
|
|
8
|
+
kind: HandlerName | 'none';
|
|
9
|
+
[detail: string]: unknown;
|
|
10
|
+
}
|
|
11
|
+
export interface ExplainedParameter {
|
|
12
|
+
name: string;
|
|
13
|
+
in: ParameterLocation;
|
|
14
|
+
required: boolean;
|
|
15
|
+
schema: ParameterSchema;
|
|
16
|
+
}
|
|
17
|
+
export interface ExtensionProvider {
|
|
18
|
+
registered: boolean;
|
|
19
|
+
version?: string;
|
|
20
|
+
targets?: string[];
|
|
21
|
+
revisionMatch?: boolean;
|
|
22
|
+
requirementValid?: boolean | null;
|
|
23
|
+
}
|
|
24
|
+
export interface ExplainedExtensionRequirement {
|
|
25
|
+
requirement: Record<string, unknown>;
|
|
26
|
+
provider?: ExtensionProvider;
|
|
27
|
+
}
|
|
28
|
+
export interface ExplainedCache {
|
|
29
|
+
/** What a response from this route carries: the policy strategy, the header source or `none`. */
|
|
30
|
+
outcome: string;
|
|
31
|
+
cacheControl?: string;
|
|
32
|
+
forcedNoStore: boolean;
|
|
33
|
+
reason?: string;
|
|
34
|
+
}
|
|
35
|
+
export interface TargetSupport {
|
|
36
|
+
compatible: boolean;
|
|
37
|
+
issues: {
|
|
38
|
+
capability: CapabilityName;
|
|
39
|
+
support: string;
|
|
40
|
+
reason: string;
|
|
41
|
+
}[];
|
|
42
|
+
}
|
|
43
|
+
export interface RouteExplanation {
|
|
44
|
+
matched: true;
|
|
45
|
+
path: string;
|
|
46
|
+
description?: string;
|
|
47
|
+
generated?: string;
|
|
48
|
+
state: RouteState;
|
|
49
|
+
enabled: boolean;
|
|
50
|
+
expires?: string;
|
|
51
|
+
methods: string[];
|
|
52
|
+
conditional: boolean;
|
|
53
|
+
handler: ExplainedHandler;
|
|
54
|
+
middleware: {
|
|
55
|
+
source: string;
|
|
56
|
+
export: string;
|
|
57
|
+
}[];
|
|
58
|
+
inputs: {
|
|
59
|
+
parameters: ExplainedParameter[];
|
|
60
|
+
body?: RequestBodyPolicy;
|
|
61
|
+
};
|
|
62
|
+
policies: {
|
|
63
|
+
names: string[];
|
|
64
|
+
inventory: PolicyInventory;
|
|
65
|
+
extensions: Record<string, ExplainedExtensionRequirement>;
|
|
66
|
+
};
|
|
67
|
+
cache: ExplainedCache;
|
|
68
|
+
bindings: {
|
|
69
|
+
env: Record<string, {
|
|
70
|
+
env: string;
|
|
71
|
+
} | {
|
|
72
|
+
literal: true;
|
|
73
|
+
}>;
|
|
74
|
+
secrets: Record<string, {
|
|
75
|
+
secret: string;
|
|
76
|
+
}>;
|
|
77
|
+
};
|
|
78
|
+
egress: {
|
|
79
|
+
proxy?: string;
|
|
80
|
+
signals?: string[];
|
|
81
|
+
};
|
|
82
|
+
responseHeaders: [string, string][];
|
|
83
|
+
capabilities: CapabilityName[];
|
|
84
|
+
targets: Record<CapabilityTarget, TargetSupport>;
|
|
85
|
+
note: string;
|
|
86
|
+
}
|
|
87
|
+
export interface ExplainOptions {
|
|
88
|
+
extensions?: RuntimeExtension[] | undefined;
|
|
89
|
+
projectSha256?: string | undefined;
|
|
90
|
+
now?: number | undefined;
|
|
91
|
+
}
|
|
92
|
+
export declare function routeState(route: CompiledRoute, now: number): RouteState;
|
|
93
|
+
/** Describe one compiled route. `chain` is the policy chain compiled for it, when the project declares policies. */
|
|
94
|
+
export declare function explainCompiledRoute(loaded: LoadedDocument, route: CompiledRoute, chain: PolicyChain | undefined, options?: ExplainOptions): RouteExplanation;
|
|
95
|
+
export declare function nearestRoutes(target: string, patterns: Iterable<string>, limit?: number): string[];
|