@aotter/mantle 0.1.5-alpha.1 → 0.2.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/README.md +39 -306
- package/dist/admin/consent.d.ts +17 -0
- package/dist/admin/consent.d.ts.map +1 -0
- package/dist/admin/consent.js +17 -0
- package/dist/admin/consent.js.map +1 -0
- package/dist/admin/createAdminSurface.d.ts +22 -0
- package/dist/admin/createAdminSurface.d.ts.map +1 -0
- package/dist/admin/createAdminSurface.js +589 -0
- package/dist/admin/createAdminSurface.js.map +1 -0
- package/dist/admin/developerConsole.d.ts +264 -0
- package/dist/admin/developerConsole.d.ts.map +1 -0
- package/dist/admin/developerConsole.js +136 -0
- package/dist/admin/developerConsole.js.map +1 -0
- package/dist/admin/identity.d.ts +62 -0
- package/dist/admin/identity.d.ts.map +1 -0
- package/dist/admin/identity.js +7 -0
- package/dist/admin/identity.js.map +1 -0
- package/dist/admin/index.d.ts +4 -0
- package/dist/admin/index.d.ts.map +1 -0
- package/dist/admin/index.js +4 -0
- package/dist/admin/index.js.map +1 -0
- package/dist/admin/procedureFlow.d.ts +25 -0
- package/dist/admin/procedureFlow.d.ts.map +1 -0
- package/dist/admin/procedureFlow.js +154 -0
- package/dist/admin/procedureFlow.js.map +1 -0
- package/dist/auth/ConsoleEmailSender.d.ts +15 -0
- package/dist/auth/ConsoleEmailSender.d.ts.map +1 -0
- package/dist/auth/ConsoleEmailSender.js +19 -0
- package/dist/auth/ConsoleEmailSender.js.map +1 -0
- package/dist/auth/appleClientSecret.d.ts +75 -0
- package/dist/auth/appleClientSecret.d.ts.map +1 -0
- package/dist/auth/appleClientSecret.js +116 -0
- package/dist/auth/appleClientSecret.js.map +1 -0
- package/dist/auth/buildAuth.d.ts +4565 -0
- package/dist/auth/buildAuth.d.ts.map +1 -0
- package/dist/auth/buildAuth.js +307 -0
- package/dist/auth/buildAuth.js.map +1 -0
- package/dist/auth/callerResolver.d.ts +48 -0
- package/dist/auth/callerResolver.d.ts.map +1 -0
- package/dist/auth/callerResolver.js +49 -0
- package/dist/auth/callerResolver.js.map +1 -0
- package/dist/auth/createAuthRoutes.d.ts +22 -0
- package/dist/auth/createAuthRoutes.d.ts.map +1 -0
- package/dist/auth/createAuthRoutes.js +128 -0
- package/dist/auth/createAuthRoutes.js.map +1 -0
- package/dist/auth/createMantleAuth.d.ts +3 -0
- package/dist/auth/createMantleAuth.d.ts.map +1 -0
- package/dist/auth/createMantleAuth.js +483 -0
- package/dist/auth/createMantleAuth.js.map +1 -0
- package/dist/auth/db.d.ts +17 -0
- package/dist/auth/db.d.ts.map +1 -0
- package/dist/auth/db.js +24 -0
- package/dist/auth/db.js.map +1 -0
- package/dist/auth/emailTemplates.d.ts +7 -0
- package/dist/auth/emailTemplates.d.ts.map +1 -0
- package/dist/auth/emailTemplates.js +27 -0
- package/dist/auth/emailTemplates.js.map +1 -0
- package/dist/auth/index.d.ts +9 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +7 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/methods.d.ts +717 -0
- package/dist/auth/methods.d.ts.map +1 -0
- package/dist/auth/methods.js +321 -0
- package/dist/auth/methods.js.map +1 -0
- package/dist/auth/oauthTokens.d.ts +24 -0
- package/dist/auth/oauthTokens.d.ts.map +1 -0
- package/dist/auth/oauthTokens.js +146 -0
- package/dist/auth/oauthTokens.js.map +1 -0
- package/dist/auth/setupIncomplete.d.ts +16 -0
- package/dist/auth/setupIncomplete.d.ts.map +1 -0
- package/dist/auth/setupIncomplete.js +50 -0
- package/dist/auth/setupIncomplete.js.map +1 -0
- package/dist/auth/types.d.ts +440 -0
- package/dist/auth/types.d.ts.map +1 -0
- package/dist/auth/types.js +10 -0
- package/dist/auth/types.js.map +1 -0
- package/dist/bun/index.d.ts +65 -0
- package/dist/bun/index.d.ts.map +1 -0
- package/dist/bun/index.js +130 -0
- package/dist/bun/index.js.map +1 -0
- package/dist/cli/emitModule.d.ts +7 -0
- package/dist/cli/emitModule.d.ts.map +1 -0
- package/dist/cli/emitModule.js +127 -0
- package/dist/cli/emitModule.js.map +1 -0
- package/dist/cli/generate.d.ts +4 -16
- package/dist/cli/generate.d.ts.map +1 -1
- package/dist/cli/generate.js +318 -262
- package/dist/cli/generate.js.map +1 -1
- package/dist/cli/main.d.ts +1 -1
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +15 -71
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/preset.d.ts +18 -0
- package/dist/cli/preset.d.ts.map +1 -0
- package/dist/cli/preset.js +352 -0
- package/dist/cli/preset.js.map +1 -0
- package/dist/cloudflare/index.d.ts +21 -0
- package/dist/cloudflare/index.d.ts.map +1 -0
- package/dist/cloudflare/index.js +14 -0
- package/dist/cloudflare/index.js.map +1 -0
- package/dist/cloudflare/r2Media.d.ts +43 -0
- package/dist/cloudflare/r2Media.d.ts.map +1 -0
- package/dist/cloudflare/r2Media.js +69 -0
- package/dist/cloudflare/r2Media.js.map +1 -0
- package/dist/core/caller.d.ts +35 -0
- package/dist/core/caller.d.ts.map +1 -0
- package/dist/core/caller.js +3 -0
- package/dist/core/caller.js.map +1 -0
- package/dist/core/createMantle.d.ts +22 -0
- package/dist/core/createMantle.d.ts.map +1 -0
- package/dist/core/createMantle.js +117 -0
- package/dist/core/createMantle.js.map +1 -0
- package/dist/core/dialect.d.ts +41 -0
- package/dist/core/dialect.d.ts.map +1 -0
- package/dist/core/dialect.js +7 -0
- package/dist/core/dialect.js.map +1 -0
- package/dist/core/driver.d.ts +17 -0
- package/dist/core/driver.d.ts.map +1 -0
- package/dist/core/driver.js +2 -0
- package/dist/core/driver.js.map +1 -0
- package/dist/core/email.d.ts +17 -0
- package/dist/core/email.d.ts.map +1 -0
- package/dist/core/email.js +2 -0
- package/dist/core/email.js.map +1 -0
- package/dist/core/index.d.ts +16 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +16 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/invocation.d.ts +66 -0
- package/dist/core/invocation.d.ts.map +1 -0
- package/dist/core/invocation.js +3 -0
- package/dist/core/invocation.js.map +1 -0
- package/dist/core/runtime/auth.d.ts +9 -0
- package/dist/core/runtime/auth.d.ts.map +1 -0
- package/dist/core/runtime/auth.js +39 -0
- package/dist/core/runtime/auth.js.map +1 -0
- package/dist/core/runtime/createRuntime.d.ts +23 -0
- package/dist/core/runtime/createRuntime.d.ts.map +1 -0
- package/dist/core/runtime/createRuntime.js +214 -0
- package/dist/core/runtime/createRuntime.js.map +1 -0
- package/dist/core/runtime/verifyPlan.d.ts +34 -0
- package/dist/core/runtime/verifyPlan.d.ts.map +1 -0
- package/dist/core/runtime/verifyPlan.js +301 -0
- package/dist/core/runtime/verifyPlan.js.map +1 -0
- package/dist/core/service.d.ts +45 -0
- package/dist/core/service.d.ts.map +1 -0
- package/dist/core/service.js +2 -0
- package/dist/core/service.js.map +1 -0
- package/dist/core/site.d.ts +117 -0
- package/dist/core/site.d.ts.map +1 -0
- package/dist/core/site.js +2 -0
- package/dist/core/site.js.map +1 -0
- package/dist/core/siteConfig.d.ts +5 -0
- package/dist/core/siteConfig.d.ts.map +1 -0
- package/dist/core/siteConfig.js +24 -0
- package/dist/core/siteConfig.js.map +1 -0
- package/dist/core/sql/allowlist.d.ts +65 -0
- package/dist/core/sql/allowlist.d.ts.map +1 -0
- package/dist/core/sql/allowlist.js +705 -0
- package/dist/core/sql/allowlist.js.map +1 -0
- package/dist/core/sql/ast.d.ts +24 -0
- package/dist/core/sql/ast.d.ts.map +1 -0
- package/dist/core/sql/ast.js +32 -0
- package/dist/core/sql/ast.js.map +1 -0
- package/dist/core/sql/compile.d.ts +50 -0
- package/dist/core/sql/compile.d.ts.map +1 -0
- package/dist/core/sql/compile.js +48 -0
- package/dist/core/sql/compile.js.map +1 -0
- package/dist/core/sql/policy.d.ts +121 -0
- package/dist/core/sql/policy.d.ts.map +1 -0
- package/dist/core/sql/policy.js +379 -0
- package/dist/core/sql/policy.js.map +1 -0
- package/dist/core/sql/positions.d.ts +30 -0
- package/dist/core/sql/positions.d.ts.map +1 -0
- package/dist/core/sql/positions.js +22 -0
- package/dist/core/sql/positions.js.map +1 -0
- package/dist/core/sql/run.d.ts +76 -0
- package/dist/core/sql/run.d.ts.map +1 -0
- package/dist/core/sql/run.js +267 -0
- package/dist/core/sql/run.js.map +1 -0
- package/dist/core/store/createStore.d.ts +49 -0
- package/dist/core/store/createStore.d.ts.map +1 -0
- package/dist/core/store/createStore.js +227 -0
- package/dist/core/store/createStore.js.map +1 -0
- package/dist/core/store/cursor.d.ts +4 -0
- package/dist/core/store/cursor.d.ts.map +1 -0
- package/dist/core/store/cursor.js +22 -0
- package/dist/core/store/cursor.js.map +1 -0
- package/dist/core/store/json.d.ts +80 -0
- package/dist/core/store/json.d.ts.map +1 -0
- package/dist/core/store/json.js +342 -0
- package/dist/core/store/json.js.map +1 -0
- package/dist/core/store.d.ts +160 -0
- package/dist/core/store.d.ts.map +1 -0
- package/dist/core/store.js +2 -0
- package/dist/core/store.js.map +1 -0
- package/dist/core/wire.d.ts +20 -0
- package/dist/core/wire.d.ts.map +1 -0
- package/dist/core/wire.js +84 -0
- package/dist/core/wire.js.map +1 -0
- package/dist/core/withCaller.d.ts +16 -0
- package/dist/core/withCaller.d.ts.map +1 -0
- package/dist/core/withCaller.js +29 -0
- package/dist/core/withCaller.js.map +1 -0
- package/dist/d1/adapter.d.ts +12 -0
- package/dist/d1/adapter.d.ts.map +1 -0
- package/dist/d1/adapter.js +23 -0
- package/dist/d1/adapter.js.map +1 -0
- package/dist/d1/codec.d.ts +14 -0
- package/dist/d1/codec.d.ts.map +1 -0
- package/dist/d1/codec.js +136 -0
- package/dist/d1/codec.js.map +1 -0
- package/dist/d1/compile/index.d.ts +9 -0
- package/dist/d1/compile/index.d.ts.map +1 -0
- package/dist/d1/compile/index.js +9 -0
- package/dist/d1/compile/index.js.map +1 -0
- package/dist/d1/dialect.d.ts +4 -0
- package/dist/d1/dialect.d.ts.map +1 -0
- package/dist/d1/dialect.js +13 -0
- package/dist/d1/dialect.js.map +1 -0
- package/dist/d1/executor.d.ts +13 -0
- package/dist/d1/executor.d.ts.map +1 -0
- package/dist/d1/executor.js +91 -0
- package/dist/d1/executor.js.map +1 -0
- package/dist/d1/index.d.ts +6 -0
- package/dist/d1/index.d.ts.map +1 -0
- package/dist/d1/index.js +6 -0
- package/dist/d1/index.js.map +1 -0
- package/dist/d1/lower.d.ts +8 -0
- package/dist/d1/lower.d.ts.map +1 -0
- package/dist/d1/lower.js +167 -0
- package/dist/d1/lower.js.map +1 -0
- package/dist/d1/media.d.ts +5 -0
- package/dist/d1/media.d.ts.map +1 -0
- package/dist/d1/media.js +157 -0
- package/dist/d1/media.js.map +1 -0
- package/dist/d1/migrations.d.ts +12 -0
- package/dist/d1/migrations.d.ts.map +1 -0
- package/dist/d1/migrations.js +111 -0
- package/dist/d1/migrations.js.map +1 -0
- package/dist/d1/print.d.ts +28 -0
- package/dist/d1/print.d.ts.map +1 -0
- package/dist/d1/print.js +54 -0
- package/dist/d1/print.js.map +1 -0
- package/dist/d1/site.d.ts +17 -0
- package/dist/d1/site.d.ts.map +1 -0
- package/dist/d1/site.js +63 -0
- package/dist/d1/site.js.map +1 -0
- package/dist/d1/storage.d.ts +34 -0
- package/dist/d1/storage.d.ts.map +1 -0
- package/dist/d1/storage.js +288 -0
- package/dist/d1/storage.js.map +1 -0
- package/dist/d1/tz.d.ts +21 -0
- package/dist/d1/tz.d.ts.map +1 -0
- package/dist/d1/tz.js +54 -0
- package/dist/d1/tz.js.map +1 -0
- package/dist/d1/validator.d.ts +10 -0
- package/dist/d1/validator.d.ts.map +1 -0
- package/dist/d1/validator.js +33 -0
- package/dist/d1/validator.js.map +1 -0
- package/dist/mcp/apps.d.ts +43 -0
- package/dist/mcp/apps.d.ts.map +1 -0
- package/dist/mcp/apps.js +57 -0
- package/dist/mcp/apps.js.map +1 -0
- package/dist/mcp/catalog.d.ts +55 -0
- package/dist/mcp/catalog.d.ts.map +1 -0
- package/dist/mcp/catalog.js +81 -0
- package/dist/mcp/catalog.js.map +1 -0
- package/dist/mcp/createMcpSurface.d.ts +34 -0
- package/dist/mcp/createMcpSurface.d.ts.map +1 -0
- package/dist/mcp/createMcpSurface.js +150 -0
- package/dist/mcp/createMcpSurface.js.map +1 -0
- package/dist/mcp/index.d.ts +4 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +4 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/postgres/adapter.d.ts +20 -0
- package/dist/postgres/adapter.d.ts.map +1 -0
- package/dist/postgres/adapter.js +44 -0
- package/dist/postgres/adapter.js.map +1 -0
- package/dist/postgres/codec.d.ts +13 -0
- package/dist/postgres/codec.d.ts.map +1 -0
- package/dist/postgres/codec.js +110 -0
- package/dist/postgres/codec.js.map +1 -0
- package/dist/postgres/compile/index.d.ts +9 -0
- package/dist/postgres/compile/index.d.ts.map +1 -0
- package/dist/postgres/compile/index.js +9 -0
- package/dist/postgres/compile/index.js.map +1 -0
- package/dist/postgres/driver.d.ts +92 -0
- package/dist/postgres/driver.d.ts.map +1 -0
- package/dist/postgres/driver.js +110 -0
- package/dist/postgres/driver.js.map +1 -0
- package/dist/postgres/executor.d.ts +20 -0
- package/dist/postgres/executor.d.ts.map +1 -0
- package/dist/postgres/executor.js +69 -0
- package/dist/postgres/executor.js.map +1 -0
- package/dist/postgres/index.d.ts +7 -0
- package/dist/postgres/index.d.ts.map +1 -0
- package/dist/postgres/index.js +7 -0
- package/dist/postgres/index.js.map +1 -0
- package/dist/postgres/lower.d.ts +6 -0
- package/dist/postgres/lower.d.ts.map +1 -0
- package/dist/postgres/lower.js +157 -0
- package/dist/postgres/lower.js.map +1 -0
- package/dist/postgres/print.d.ts +11 -0
- package/dist/postgres/print.d.ts.map +1 -0
- package/dist/postgres/print.js +121 -0
- package/dist/postgres/print.js.map +1 -0
- package/dist/postgres/storage.d.ts +19 -0
- package/dist/postgres/storage.d.ts.map +1 -0
- package/dist/postgres/storage.js +201 -0
- package/dist/postgres/storage.js.map +1 -0
- package/dist/postgres/textRows.d.ts +10 -0
- package/dist/postgres/textRows.d.ts.map +1 -0
- package/dist/postgres/textRows.js +44 -0
- package/dist/postgres/textRows.js.map +1 -0
- package/dist/postgres/validator.d.ts +12 -0
- package/dist/postgres/validator.d.ts.map +1 -0
- package/dist/postgres/validator.js +46 -0
- package/dist/postgres/validator.js.map +1 -0
- package/dist/spec/domain/index.d.ts +3 -0
- package/dist/spec/domain/index.d.ts.map +1 -0
- package/dist/spec/domain/index.js +3 -0
- package/dist/spec/domain/index.js.map +1 -0
- package/dist/spec/domain/model/ContentState.d.ts +8 -0
- package/dist/spec/domain/model/ContentState.d.ts.map +1 -0
- package/dist/spec/domain/model/ContentState.js +7 -0
- package/dist/spec/domain/model/ContentState.js.map +1 -0
- package/dist/spec/domain/model/Entry.d.ts +29 -0
- package/dist/spec/domain/model/Entry.d.ts.map +1 -0
- package/dist/spec/domain/model/Entry.js +16 -0
- package/dist/spec/domain/model/Entry.js.map +1 -0
- package/dist/spec/domain/model/Locale.d.ts +30 -0
- package/dist/spec/domain/model/Locale.d.ts.map +1 -0
- package/dist/spec/domain/model/Locale.js +33 -0
- package/dist/spec/domain/model/Locale.js.map +1 -0
- package/dist/spec/domain/model/ManifestGrammar.d.ts +452 -0
- package/dist/spec/domain/model/ManifestGrammar.d.ts.map +1 -0
- package/dist/spec/domain/model/ManifestGrammar.js +149 -0
- package/dist/spec/domain/model/ManifestGrammar.js.map +1 -0
- package/dist/spec/domain/model/MediaMimeAccept.d.ts +55 -0
- package/dist/spec/domain/model/MediaMimeAccept.d.ts.map +1 -0
- package/dist/spec/domain/model/MediaMimeAccept.js +90 -0
- package/dist/spec/domain/model/MediaMimeAccept.js.map +1 -0
- package/dist/spec/domain/model/RuntimePlan.d.ts +94 -0
- package/dist/spec/domain/model/RuntimePlan.d.ts.map +1 -0
- package/dist/spec/domain/model/RuntimePlan.js +4 -0
- package/dist/spec/domain/model/RuntimePlan.js.map +1 -0
- package/dist/spec/domain/model/SiteConfig.d.ts +173 -0
- package/dist/spec/domain/model/SiteConfig.d.ts.map +1 -0
- package/dist/spec/domain/model/SiteConfig.js +13 -0
- package/dist/spec/domain/model/SiteConfig.js.map +1 -0
- package/dist/spec/domain/model/SqlIr.d.ts +96 -0
- package/dist/spec/domain/model/SqlIr.d.ts.map +1 -0
- package/dist/spec/domain/model/SqlIr.js +95 -0
- package/dist/spec/domain/model/SqlIr.js.map +1 -0
- package/dist/spec/domain/model/index.d.ts +14 -0
- package/dist/spec/domain/model/index.d.ts.map +1 -0
- package/dist/spec/domain/model/index.js +14 -0
- package/dist/spec/domain/model/index.js.map +1 -0
- package/dist/spec/domain/service/CloudflareCron.d.ts +2 -0
- package/dist/spec/domain/service/CloudflareCron.d.ts.map +1 -0
- package/dist/spec/domain/service/CloudflareCron.js +63 -0
- package/dist/spec/domain/service/CloudflareCron.js.map +1 -0
- package/dist/spec/domain/service/CrossSchemaChecker.d.ts +34 -0
- package/dist/spec/domain/service/CrossSchemaChecker.d.ts.map +1 -0
- package/dist/spec/domain/service/CrossSchemaChecker.js +114 -0
- package/dist/spec/domain/service/CrossSchemaChecker.js.map +1 -0
- package/dist/spec/domain/service/EntryDataValidator.d.ts +56 -0
- package/dist/spec/domain/service/EntryDataValidator.d.ts.map +1 -0
- package/dist/spec/domain/service/EntryDataValidator.js +88 -0
- package/dist/spec/domain/service/EntryDataValidator.js.map +1 -0
- package/dist/spec/domain/service/JsonSchemaToZod.d.ts +29 -0
- package/dist/spec/domain/service/JsonSchemaToZod.d.ts.map +1 -0
- package/dist/spec/domain/service/JsonSchemaToZod.js +156 -0
- package/dist/spec/domain/service/JsonSchemaToZod.js.map +1 -0
- package/dist/spec/domain/service/LifecycleStateMachine.d.ts +75 -0
- package/dist/spec/domain/service/LifecycleStateMachine.d.ts.map +1 -0
- package/dist/spec/domain/service/LifecycleStateMachine.js +76 -0
- package/dist/spec/domain/service/LifecycleStateMachine.js.map +1 -0
- package/dist/spec/domain/service/LocaleCanonicalizer.d.ts +29 -0
- package/dist/spec/domain/service/LocaleCanonicalizer.d.ts.map +1 -0
- package/dist/spec/domain/service/LocaleCanonicalizer.js +96 -0
- package/dist/spec/domain/service/LocaleCanonicalizer.js.map +1 -0
- package/dist/spec/domain/service/ManifestFieldChecks.d.ts +60 -0
- package/dist/spec/domain/service/ManifestFieldChecks.d.ts.map +1 -0
- package/dist/spec/domain/service/ManifestFieldChecks.js +116 -0
- package/dist/spec/domain/service/ManifestFieldChecks.js.map +1 -0
- package/dist/spec/domain/service/ManifestGraphValidator.d.ts +15 -0
- package/dist/spec/domain/service/ManifestGraphValidator.d.ts.map +1 -0
- package/dist/spec/domain/service/ManifestGraphValidator.js +225 -0
- package/dist/spec/domain/service/ManifestGraphValidator.js.map +1 -0
- package/dist/spec/domain/service/ManifestLinker.d.ts +45 -0
- package/dist/spec/domain/service/ManifestLinker.d.ts.map +1 -0
- package/dist/spec/domain/service/ManifestLinker.js +92 -0
- package/dist/spec/domain/service/ManifestLinker.js.map +1 -0
- package/dist/spec/domain/service/ManifestLocaleTrimmer.d.ts +16 -0
- package/dist/spec/domain/service/ManifestLocaleTrimmer.d.ts.map +1 -0
- package/dist/spec/domain/service/ManifestLocaleTrimmer.js +76 -0
- package/dist/spec/domain/service/ManifestLocaleTrimmer.js.map +1 -0
- package/dist/spec/domain/service/ManifestParser.d.ts +49 -0
- package/dist/spec/domain/service/ManifestParser.d.ts.map +1 -0
- package/dist/spec/domain/service/ManifestParser.js +203 -0
- package/dist/spec/domain/service/ManifestParser.js.map +1 -0
- package/dist/spec/domain/service/ManifestPartition.d.ts +9 -0
- package/dist/spec/domain/service/ManifestPartition.d.ts.map +1 -0
- package/dist/spec/domain/service/ManifestPartition.js +19 -0
- package/dist/spec/domain/service/ManifestPartition.js.map +1 -0
- package/dist/spec/domain/service/ManifestPathDiagnoser.d.ts +33 -0
- package/dist/spec/domain/service/ManifestPathDiagnoser.d.ts.map +1 -0
- package/dist/spec/domain/service/ManifestPathDiagnoser.js +43 -0
- package/dist/spec/domain/service/ManifestPathDiagnoser.js.map +1 -0
- package/dist/spec/domain/service/ManifestSourceSpans.d.ts +10 -0
- package/dist/spec/domain/service/ManifestSourceSpans.d.ts.map +1 -0
- package/dist/spec/domain/service/ManifestSourceSpans.js +76 -0
- package/dist/spec/domain/service/ManifestSourceSpans.js.map +1 -0
- package/dist/spec/domain/service/McpToolNaming.d.ts +25 -0
- package/dist/spec/domain/service/McpToolNaming.d.ts.map +1 -0
- package/dist/spec/domain/service/McpToolNaming.js +50 -0
- package/dist/spec/domain/service/McpToolNaming.js.map +1 -0
- package/dist/spec/domain/service/PlanFingerprint.d.ts +4 -0
- package/dist/spec/domain/service/PlanFingerprint.d.ts.map +1 -0
- package/dist/spec/domain/service/PlanFingerprint.js +14 -0
- package/dist/spec/domain/service/PlanFingerprint.js.map +1 -0
- package/dist/spec/domain/service/ProcedureViewSpecChecks.d.ts +4 -0
- package/dist/spec/domain/service/ProcedureViewSpecChecks.d.ts.map +1 -0
- package/dist/spec/domain/service/ProcedureViewSpecChecks.js +211 -0
- package/dist/spec/domain/service/ProcedureViewSpecChecks.js.map +1 -0
- package/dist/spec/domain/service/SchemaAdminUiChecker.d.ts +42 -0
- package/dist/spec/domain/service/SchemaAdminUiChecker.d.ts.map +1 -0
- package/dist/spec/domain/service/SchemaAdminUiChecker.js +289 -0
- package/dist/spec/domain/service/SchemaAdminUiChecker.js.map +1 -0
- package/dist/spec/domain/service/SchemaIndexChecker.d.ts +33 -0
- package/dist/spec/domain/service/SchemaIndexChecker.d.ts.map +1 -0
- package/dist/spec/domain/service/SchemaIndexChecker.js +256 -0
- package/dist/spec/domain/service/SchemaIndexChecker.js.map +1 -0
- package/dist/spec/domain/service/SchemaSearchChecker.d.ts +11 -0
- package/dist/spec/domain/service/SchemaSearchChecker.d.ts.map +1 -0
- package/dist/spec/domain/service/SchemaSearchChecker.js +78 -0
- package/dist/spec/domain/service/SchemaSearchChecker.js.map +1 -0
- package/dist/spec/domain/service/SchemaSpecChecks.d.ts +31 -0
- package/dist/spec/domain/service/SchemaSpecChecks.d.ts.map +1 -0
- package/dist/spec/domain/service/SchemaSpecChecks.js +445 -0
- package/dist/spec/domain/service/SchemaSpecChecks.js.map +1 -0
- package/dist/spec/domain/service/SiteDefaultsValidator.d.ts +39 -0
- package/dist/spec/domain/service/SiteDefaultsValidator.d.ts.map +1 -0
- package/dist/spec/domain/service/SiteDefaultsValidator.js +194 -0
- package/dist/spec/domain/service/SiteDefaultsValidator.js.map +1 -0
- package/dist/spec/domain/service/SqlClassify.d.ts +19 -0
- package/dist/spec/domain/service/SqlClassify.d.ts.map +1 -0
- package/dist/spec/domain/service/SqlClassify.js +42 -0
- package/dist/spec/domain/service/SqlClassify.js.map +1 -0
- package/dist/spec/domain/service/SqlRefusal.d.ts +16 -0
- package/dist/spec/domain/service/SqlRefusal.d.ts.map +1 -0
- package/dist/spec/domain/service/SqlRefusal.js +20 -0
- package/dist/spec/domain/service/SqlRefusal.js.map +1 -0
- package/dist/spec/domain/service/SqlTypes.d.ts +40 -0
- package/dist/spec/domain/service/SqlTypes.d.ts.map +1 -0
- package/dist/spec/domain/service/SqlTypes.js +110 -0
- package/dist/spec/domain/service/SqlTypes.js.map +1 -0
- package/dist/spec/domain/service/StaffRoleHierarchy.d.ts +3 -0
- package/dist/spec/domain/service/StaffRoleHierarchy.d.ts.map +1 -0
- package/dist/spec/domain/service/StaffRoleHierarchy.js +19 -0
- package/dist/spec/domain/service/StaffRoleHierarchy.js.map +1 -0
- package/dist/spec/domain/service/TriggerGraphChecks.d.ts +16 -0
- package/dist/spec/domain/service/TriggerGraphChecks.d.ts.map +1 -0
- package/dist/spec/domain/service/TriggerGraphChecks.js +337 -0
- package/dist/spec/domain/service/TriggerGraphChecks.js.map +1 -0
- package/dist/spec/domain/service/TriggerSpecChecks.d.ts +4 -0
- package/dist/spec/domain/service/TriggerSpecChecks.d.ts.map +1 -0
- package/dist/spec/domain/service/TriggerSpecChecks.js +89 -0
- package/dist/spec/domain/service/TriggerSpecChecks.js.map +1 -0
- package/dist/spec/domain/service/ValidatedAdminUiProjection.d.ts +11 -0
- package/dist/spec/domain/service/ValidatedAdminUiProjection.d.ts.map +1 -0
- package/dist/spec/domain/service/ValidatedAdminUiProjection.js +26 -0
- package/dist/spec/domain/service/ValidatedAdminUiProjection.js.map +1 -0
- package/dist/spec/domain/service/ViewAdminUiChecker.d.ts +14 -0
- package/dist/spec/domain/service/ViewAdminUiChecker.d.ts.map +1 -0
- package/dist/spec/domain/service/ViewAdminUiChecker.js +53 -0
- package/dist/spec/domain/service/ViewAdminUiChecker.js.map +1 -0
- package/dist/spec/domain/service/index.d.ts +24 -0
- package/dist/spec/domain/service/index.d.ts.map +1 -0
- package/dist/spec/domain/service/index.js +24 -0
- package/dist/spec/domain/service/index.js.map +1 -0
- package/dist/spec/index.d.ts +10 -0
- package/dist/spec/index.d.ts.map +1 -0
- package/dist/spec/index.js +12 -0
- package/dist/spec/index.js.map +1 -0
- package/dist/spec/infrastructure/cli/parseArgsError.d.ts +16 -0
- package/dist/spec/infrastructure/cli/parseArgsError.d.ts.map +1 -0
- package/dist/spec/infrastructure/cli/parseArgsError.js +34 -0
- package/dist/spec/infrastructure/cli/parseArgsError.js.map +1 -0
- package/dist/spec/infrastructure/index.d.ts +2 -0
- package/dist/spec/infrastructure/index.d.ts.map +1 -0
- package/dist/spec/infrastructure/index.js +2 -0
- package/dist/spec/infrastructure/index.js.map +1 -0
- package/dist/spec/infrastructure/sql/PgQueryParser.d.ts +18 -0
- package/dist/spec/infrastructure/sql/PgQueryParser.d.ts.map +1 -0
- package/dist/spec/infrastructure/sql/PgQueryParser.js +17 -0
- package/dist/spec/infrastructure/sql/PgQueryParser.js.map +1 -0
- package/dist/spec/infrastructure/sql/compilePlan.d.ts +37 -0
- package/dist/spec/infrastructure/sql/compilePlan.d.ts.map +1 -0
- package/dist/spec/infrastructure/sql/compilePlan.js +282 -0
- package/dist/spec/infrastructure/sql/compilePlan.js.map +1 -0
- package/dist/spec/infrastructure/sql/compileSql.d.ts +35 -0
- package/dist/spec/infrastructure/sql/compileSql.d.ts.map +1 -0
- package/dist/spec/infrastructure/sql/compileSql.js +92 -0
- package/dist/spec/infrastructure/sql/compileSql.js.map +1 -0
- package/dist/spec/infrastructure/sql/frontEnd.d.ts +8 -0
- package/dist/spec/infrastructure/sql/frontEnd.d.ts.map +1 -0
- package/dist/spec/infrastructure/sql/frontEnd.js +100 -0
- package/dist/spec/infrastructure/sql/frontEnd.js.map +1 -0
- package/dist/spec/infrastructure/sql/index.d.ts +4 -0
- package/dist/spec/infrastructure/sql/index.d.ts.map +1 -0
- package/dist/spec/infrastructure/sql/index.js +4 -0
- package/dist/spec/infrastructure/sql/index.js.map +1 -0
- package/dist/spec/kernel/diagnostic.d.ts +137 -0
- package/dist/spec/kernel/diagnostic.d.ts.map +1 -0
- package/dist/spec/kernel/diagnostic.js +296 -0
- package/dist/spec/kernel/diagnostic.js.map +1 -0
- package/dist/spec/kernel/index.d.ts +8 -0
- package/dist/spec/kernel/index.d.ts.map +1 -0
- package/dist/spec/kernel/index.js +8 -0
- package/dist/spec/kernel/index.js.map +1 -0
- package/dist/spec/usecase/EmitTypes.d.ts +22 -0
- package/dist/spec/usecase/EmitTypes.d.ts.map +1 -0
- package/dist/spec/usecase/EmitTypes.js +182 -0
- package/dist/spec/usecase/EmitTypes.js.map +1 -0
- package/dist/spec/usecase/ValidateManifestsUseCase.d.ts +8 -0
- package/dist/spec/usecase/ValidateManifestsUseCase.d.ts.map +1 -0
- package/dist/spec/usecase/ValidateManifestsUseCase.js +101 -0
- package/dist/spec/usecase/ValidateManifestsUseCase.js.map +1 -0
- package/dist/spec/usecase/dto/ValidateManifestsRequest.d.ts +27 -0
- package/dist/spec/usecase/dto/ValidateManifestsRequest.d.ts.map +1 -0
- package/dist/spec/usecase/dto/ValidateManifestsRequest.js +2 -0
- package/dist/spec/usecase/dto/ValidateManifestsRequest.js.map +1 -0
- package/dist/spec/usecase/dto/ValidateManifestsResponse.d.ts +14 -0
- package/dist/spec/usecase/dto/ValidateManifestsResponse.d.ts.map +1 -0
- package/dist/spec/usecase/dto/ValidateManifestsResponse.js +2 -0
- package/dist/spec/usecase/dto/ValidateManifestsResponse.js.map +1 -0
- package/dist/spec/usecase/dto/index.d.ts +3 -0
- package/dist/spec/usecase/dto/index.d.ts.map +1 -0
- package/dist/spec/usecase/dto/index.js +3 -0
- package/dist/spec/usecase/dto/index.js.map +1 -0
- package/dist/spec/usecase/index.d.ts +10 -0
- package/dist/spec/usecase/index.d.ts.map +1 -0
- package/dist/spec/usecase/index.js +10 -0
- package/dist/spec/usecase/index.js.map +1 -0
- package/dist/testing/cases/before-hook.d.ts +4 -0
- package/dist/testing/cases/before-hook.d.ts.map +1 -0
- package/dist/testing/cases/before-hook.js +71 -0
- package/dist/testing/cases/before-hook.js.map +1 -0
- package/dist/testing/cases/corpus.d.ts +12 -0
- package/dist/testing/cases/corpus.d.ts.map +1 -0
- package/dist/testing/cases/corpus.js +91 -0
- package/dist/testing/cases/corpus.js.map +1 -0
- package/dist/testing/cases/policy.d.ts +74 -0
- package/dist/testing/cases/policy.d.ts.map +1 -0
- package/dist/testing/cases/policy.js +142 -0
- package/dist/testing/cases/policy.js.map +1 -0
- package/dist/testing/cases/printer.d.ts +4 -0
- package/dist/testing/cases/printer.d.ts.map +1 -0
- package/dist/testing/cases/printer.js +32 -0
- package/dist/testing/cases/printer.js.map +1 -0
- package/dist/testing/cases/report-view.d.ts +5 -0
- package/dist/testing/cases/report-view.d.ts.map +1 -0
- package/dist/testing/cases/report-view.js +33 -0
- package/dist/testing/cases/report-view.js.map +1 -0
- package/dist/testing/cases/requisition.d.ts +4 -0
- package/dist/testing/cases/requisition.d.ts.map +1 -0
- package/dist/testing/cases/requisition.js +38 -0
- package/dist/testing/cases/requisition.js.map +1 -0
- package/dist/testing/cases/search-places.d.ts +4 -0
- package/dist/testing/cases/search-places.d.ts.map +1 -0
- package/dist/testing/cases/search-places.js +60 -0
- package/dist/testing/cases/search-places.js.map +1 -0
- package/dist/testing/cases/stock.d.ts +4 -0
- package/dist/testing/cases/stock.d.ts.map +1 -0
- package/dist/testing/cases/stock.js +35 -0
- package/dist/testing/cases/stock.js.map +1 -0
- package/dist/testing/cases/store.d.ts +4 -0
- package/dist/testing/cases/store.d.ts.map +1 -0
- package/dist/testing/cases/store.js +100 -0
- package/dist/testing/cases/store.js.map +1 -0
- package/dist/testing/harness.d.ts +94 -0
- package/dist/testing/harness.d.ts.map +1 -0
- package/dist/testing/harness.js +168 -0
- package/dist/testing/harness.js.map +1 -0
- package/dist/testing/index.d.ts +37 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +43 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/report.d.ts +15 -0
- package/dist/testing/report.d.ts.map +1 -0
- package/dist/testing/report.js +22 -0
- package/dist/testing/report.js.map +1 -0
- package/dist/web/createRestSurface.d.ts +7 -0
- package/dist/web/createRestSurface.d.ts.map +1 -0
- package/dist/web/createRestSurface.js +39 -0
- package/dist/web/createRestSurface.js.map +1 -0
- package/dist/web/index.d.ts +2 -0
- package/dist/web/index.d.ts.map +1 -0
- package/dist/web/index.js +2 -0
- package/dist/web/index.js.map +1 -0
- package/docs/adr/0008-structured-diagnostic-shape.md +2 -2
- package/docs/adr/0011-adapter-port-spec.md +2 -2
- package/docs/adr/0014-auth-better-auth-and-multi-tenant-mcp.md +21 -2
- package/docs/adr/0019-sealed-manifest-runtime-pipeline.md +5 -1
- package/docs/adr/0022-caller-observed-version-occ.md +1 -1
- package/docs/adr/0024-manifest-native-schema-tables.md +2 -2
- package/docs/adr/0027-scheduled-procedure-triggers.md +1 -1
- package/docs/adr/0028-schema-ttl-expiry.md +3 -3
- package/docs/adr/0029-mcp-apps-interaction-contracts.md +324 -0
- package/docs/adr/0030-store.md +40 -0
- package/docs/adr/0031-host-cloud-core-contract.md +25 -0
- package/docs/adr/0032-store-centric-core-and-service-contract.md +361 -0
- package/docs/adr/0033-storage-converges-to-the-plan.md +92 -0
- package/docs/adr/0034-store-is-authored-as-sql.md +192 -0
- package/docs/adr/0035-sql-dialects.md +154 -0
- package/docs/adr/0036-host-and-dialect.md +65 -0
- package/docs/adr/0037-postgresql-is-the-reference-dialect.md +124 -0
- package/docs/adr/0038-bun-native-host.md +63 -0
- package/docs/adr/README.md +23 -8
- package/docs/adr/adr-lite-861-admin-webmcp.md +6 -0
- package/docs/adr/adr-lite-909-admin-ui-kit.md +1 -1
- package/docs/examples/README.md +16 -18
- package/docs/examples/commerce-inventory.md +481 -0
- package/docs/examples/commerce.md +254 -0
- package/docs/examples/guarded-api.md +238 -0
- package/docs/examples/intake-hooks.md +237 -0
- package/docs/examples/intake.md +127 -0
- package/docs/examples/legal-documents.md +218 -0
- package/docs/examples/procurement.md +215 -0
- package/docs/examples/publication.md +211 -0
- package/docs/examples/reference-service/.dev.vars.example +4 -0
- package/docs/examples/reference-service/.mantle/generated/mantle.ts +174 -0
- package/docs/examples/reference-service/.mantle/generated/plan.json +1936 -0
- package/docs/examples/reference-service/README.md +33 -0
- package/docs/examples/reference-service/manifests/catalog.yaml +103 -0
- package/docs/examples/reference-service/manifests/orders.yaml +120 -0
- package/docs/examples/reference-service/mantle.config.json +1 -0
- package/docs/examples/reference-service/package.json +27 -0
- package/docs/examples/reference-service/smoke.mjs +156 -0
- package/docs/examples/reference-service/src/handlers.ts +36 -0
- package/docs/examples/reference-service/src/index.ts +33 -0
- package/docs/examples/reference-service/src/service.ts +78 -0
- package/docs/examples/{host-minimal-worker → reference-service}/tsconfig.json +7 -2
- package/docs/examples/reference-service/wrangler.jsonc +26 -0
- package/docs/examples/reservation.md +142 -0
- package/docs/handbook/cloudflare/authentication.md +96 -316
- package/docs/handbook/cloudflare/chatgpt-sites.md +104 -15
- package/docs/handbook/cloudflare/deploy-and-operate.md +77 -71
- package/docs/handbook/cloudflare/media-r2.md +64 -187
- package/docs/handbook/cloudflare/service-entry.md +138 -0
- package/docs/handbook/concepts/authorization.md +104 -94
- package/docs/handbook/concepts/four-atoms.md +68 -144
- package/docs/handbook/concepts/lifecycle-and-locales.md +62 -114
- package/docs/handbook/concepts/mcp-and-agents.md +112 -117
- package/docs/handbook/concepts/procedures-and-triggers.md +126 -181
- package/docs/handbook/concepts/runtime-and-adapters.md +177 -163
- package/docs/handbook/concepts/views.md +97 -173
- package/docs/handbook/examples/hub.md +17 -6
- package/docs/handbook/guides/admin-ui.md +101 -96
- package/docs/handbook/guides/agent-setup.md +56 -71
- package/docs/handbook/guides/typed-queries.md +105 -111
- package/docs/handbook/navigation.json +8 -33
- package/docs/handbook/reference/authorization.md +52 -271
- package/docs/handbook/reference/diagnostics.md +69 -178
- package/docs/handbook/reference/features.md +48 -50
- package/docs/handbook/reference/manifest.md +56 -116
- package/docs/handbook/reference/procedure.md +91 -279
- package/docs/handbook/reference/schema.md +154 -239
- package/docs/handbook/reference/site-config.md +58 -211
- package/docs/handbook/reference/surface.md +69 -181
- package/docs/handbook/reference/trigger.md +72 -181
- package/docs/handbook/reference/view.md +140 -241
- package/docs/handbook/releases/index.md +58 -77
- package/docs/handbook/start/overview.md +59 -51
- package/docs/handbook/start/project-and-cli.md +132 -105
- package/docs/handbook/start/quickstart-worker.md +102 -160
- package/docs/skills/develop/SKILL.md +114 -240
- package/docs/skills/develop/mcp-app.md +79 -0
- package/docs/skills/integrate/SKILL.md +83 -47
- package/docs/skills/media-gc/SKILL.md +21 -10
- package/docs/skills/provision/SKILL.md +68 -162
- package/docs/skills/update/SKILL.md +33 -34
- package/docs/upgrade-0.1-to-0.2.md +211 -0
- package/package.json +87 -106
- package/dist/admin-ui.d.ts +0 -2
- package/dist/admin-ui.d.ts.map +0 -1
- package/dist/admin-ui.js +0 -2
- package/dist/admin-ui.js.map +0 -1
- package/dist/admin.d.ts +0 -2
- package/dist/admin.d.ts.map +0 -1
- package/dist/admin.js +0 -2
- package/dist/admin.js.map +0 -1
- package/dist/auth.d.ts +0 -2
- package/dist/auth.d.ts.map +0 -1
- package/dist/auth.js +0 -2
- package/dist/auth.js.map +0 -1
- package/dist/bun.d.ts +0 -2
- package/dist/bun.d.ts.map +0 -1
- package/dist/bun.js +0 -2
- package/dist/bun.js.map +0 -1
- package/dist/cli/generate-cloudflare.d.ts +0 -7
- package/dist/cli/generate-cloudflare.d.ts.map +0 -1
- package/dist/cli/generate-cloudflare.js +0 -123
- package/dist/cli/generate-cloudflare.js.map +0 -1
- package/dist/cli/generate-project.d.ts +0 -25
- package/dist/cli/generate-project.d.ts.map +0 -1
- package/dist/cli/generate-project.js +0 -282
- package/dist/cli/generate-project.js.map +0 -1
- package/dist/cli/generate-sites.d.ts +0 -8
- package/dist/cli/generate-sites.d.ts.map +0 -1
- package/dist/cli/generate-sites.js +0 -273
- package/dist/cli/generate-sites.js.map +0 -1
- package/dist/cli/harness.d.ts +0 -3
- package/dist/cli/harness.d.ts.map +0 -1
- package/dist/cli/harness.js +0 -214
- package/dist/cli/harness.js.map +0 -1
- package/dist/cli/skills.d.ts +0 -3
- package/dist/cli/skills.d.ts.map +0 -1
- package/dist/cli/skills.js +0 -128
- package/dist/cli/skills.js.map +0 -1
- package/dist/cloudflare.d.ts +0 -2
- package/dist/cloudflare.d.ts.map +0 -1
- package/dist/cloudflare.js +0 -2
- package/dist/cloudflare.js.map +0 -1
- package/dist/codegen/emitMantleModule.d.ts +0 -22
- package/dist/codegen/emitMantleModule.d.ts.map +0 -1
- package/dist/codegen/emitMantleModule.js +0 -291
- package/dist/codegen/emitMantleModule.js.map +0 -1
- package/dist/codegen.d.ts +0 -2
- package/dist/codegen.d.ts.map +0 -1
- package/dist/codegen.js +0 -2
- package/dist/codegen.js.map +0 -1
- package/dist/runtime-testing.d.ts +0 -2
- package/dist/runtime-testing.d.ts.map +0 -1
- package/dist/runtime-testing.js +0 -2
- package/dist/runtime-testing.js.map +0 -1
- package/dist/runtime.d.ts +0 -2
- package/dist/runtime.d.ts.map +0 -1
- package/dist/runtime.js +0 -2
- package/dist/runtime.js.map +0 -1
- package/dist/spec.d.ts +0 -2
- package/dist/spec.d.ts.map +0 -1
- package/dist/spec.js +0 -2
- package/dist/spec.js.map +0 -1
- package/dist/vercel-libsql.d.ts +0 -2
- package/dist/vercel-libsql.d.ts.map +0 -1
- package/dist/vercel-libsql.js +0 -2
- package/dist/vercel-libsql.js.map +0 -1
- package/dist/vercel.d.ts +0 -2
- package/dist/vercel.d.ts.map +0 -1
- package/dist/vercel.js +0 -2
- package/dist/vercel.js.map +0 -1
- package/dist/web.d.ts +0 -2
- package/dist/web.d.ts.map +0 -1
- package/dist/web.js +0 -2
- package/dist/web.js.map +0 -1
- package/docs/adapter-guide.md +0 -222
- package/docs/agent-prompts.md +0 -64
- package/docs/api-mcp-authorization.md +0 -5
- package/docs/assets/mantle-admin-developer.png +0 -0
- package/docs/assets/mantle-admin-operations.png +0 -0
- package/docs/assets/mantle-hero.jpg +0 -0
- package/docs/auth-hosting-model.md +0 -166
- package/docs/cloudflare-low-level-composition.md +0 -5
- package/docs/consumer-onboarding-audit.md +0 -65
- package/docs/deferred-lifecycle-queues.md +0 -5
- package/docs/design-atoms.md +0 -16
- package/docs/design-references/editorial-blog-2026-05-05.md +0 -218
- package/docs/direct-authoring.md +0 -5
- package/docs/examples/builtin-commerce.md +0 -269
- package/docs/examples/builtin-intake.md +0 -143
- package/docs/examples/builtin-legal-documents.md +0 -189
- package/docs/examples/builtin-procurement.md +0 -241
- package/docs/examples/builtin-publication.md +0 -241
- package/docs/examples/builtin-reservation.md +0 -149
- package/docs/examples/cf-primitives-commerce-inventory.md +0 -809
- package/docs/examples/cf-primitives-guarded-api.md +0 -429
- package/docs/examples/cf-primitives-intake-hooks.md +0 -319
- package/docs/examples/host-chatgpt-sites/.openai/hosting.json +0 -1
- package/docs/examples/host-chatgpt-sites/README.md +0 -70
- package/docs/examples/host-chatgpt-sites/drizzle/0000_sites_users.sql +0 -8
- package/docs/examples/host-chatgpt-sites/drizzle/0001_mantle.sql +0 -294
- package/docs/examples/host-chatgpt-sites/drizzle/0002_article_cover.sql +0 -5
- package/docs/examples/host-chatgpt-sites/drizzle/0003_store_instance_id.sql +0 -1
- package/docs/examples/host-chatgpt-sites/drizzle/0004_mantle.sql +0 -10
- package/docs/examples/host-chatgpt-sites/drizzle/0005_mantle.sql +0 -24
- package/docs/examples/host-chatgpt-sites/drizzle/meta/_journal.json +0 -1
- package/docs/examples/host-chatgpt-sites/drizzle/meta/mantle-state.json +0 -60
- package/docs/examples/host-chatgpt-sites/manifests/site.yaml +0 -27
- package/docs/examples/host-chatgpt-sites/package.json +0 -1
- package/docs/examples/host-chatgpt-sites/public/site.css +0 -1
- package/docs/examples/host-chatgpt-sites/scripts/build.mjs +0 -13
- package/docs/examples/host-chatgpt-sites/scripts/check.mjs +0 -101
- package/docs/examples/host-chatgpt-sites/scripts/migration.mjs +0 -43
- package/docs/examples/host-chatgpt-sites/src/chatgpt-auth.ts +0 -66
- package/docs/examples/host-chatgpt-sites/src/index.ts +0 -46
- package/docs/examples/host-chatgpt-sites/src/mcp.ts +0 -49
- package/docs/examples/host-chatgpt-sites/src/media.ts +0 -109
- package/docs/examples/host-chatgpt-sites/src/r2-lab.ts +0 -38
- package/docs/examples/host-chatgpt-sites/src/storage-fingerprint.json +0 -1
- package/docs/examples/host-chatgpt-sites/src/web.ts +0 -35
- package/docs/examples/host-chatgpt-sites/tsconfig.json +0 -1
- package/docs/examples/host-chatgpt-sites/wrangler.jsonc +0 -10
- package/docs/examples/host-local-admin-otp/.dev.vars.example +0 -3
- package/docs/examples/host-local-admin-otp/README.md +0 -80
- package/docs/examples/host-local-admin-otp/ensure-dev-vars.mjs +0 -5
- package/docs/examples/host-local-admin-otp/manifests/site.yaml +0 -25
- package/docs/examples/host-local-admin-otp/package.json +0 -29
- package/docs/examples/host-local-admin-otp/public/.gitkeep +0 -1
- package/docs/examples/host-local-admin-otp/smoke.mjs +0 -141
- package/docs/examples/host-local-admin-otp/src/index.ts +0 -54
- package/docs/examples/host-local-admin-otp/tsconfig.json +0 -17
- package/docs/examples/host-local-admin-otp/wrangler.jsonc +0 -23
- package/docs/examples/host-minimal-worker/README.md +0 -41
- package/docs/examples/host-minimal-worker/manifests/site.yaml +0 -25
- package/docs/examples/host-minimal-worker/package.json +0 -26
- package/docs/examples/host-minimal-worker/smoke.mjs +0 -23
- package/docs/examples/host-minimal-worker/src/index.ts +0 -4
- package/docs/examples/host-minimal-worker/wrangler.jsonc +0 -22
- package/docs/handbook/chatgpt-sites/equipment-checkout.md +0 -231
- package/docs/handbook/chatgpt-sites/generated-app.md +0 -84
- package/docs/handbook/chatgpt-sites/host-reference.md +0 -113
- package/docs/handbook/chatgpt-sites/index.md +0 -133
- package/docs/handbook/cloudflare/bindings.md +0 -291
- package/docs/handbook/cloudflare/conventional-worker.md +0 -166
- package/docs/handbook/cloudflare/deferred-hooks-queues.md +0 -170
- package/docs/handbook/cloudflare/low-level-composition.md +0 -169
- package/docs/handbook/cloudflare/public-web.md +0 -144
- package/docs/handbook/cloudflare/site-chrome.md +0 -75
- package/docs/handbook/examples/commerce-transaction.md +0 -11
- package/docs/handbook/examples/commerce.md +0 -11
- package/docs/handbook/examples/guarded-api.md +0 -10
- package/docs/handbook/examples/intake-form.md +0 -12
- package/docs/handbook/examples/intake-hooks.md +0 -11
- package/docs/handbook/examples/legal-documents.md +0 -10
- package/docs/handbook/examples/procurement-approvals.md +0 -10
- package/docs/handbook/examples/publication.md +0 -10
- package/docs/handbook/examples/reservation.md +0 -10
- package/docs/handbook/start/quickstart-admin.md +0 -52
- package/docs/labels.md +0 -71
- package/docs/media-uploads.md +0 -5
- package/docs/migration-0.1.2.md +0 -13
- package/docs/performance-harness.md +0 -228
- package/docs/release-process.md +0 -244
- package/docs/schema-indexes.md +0 -5
- package/docs/sealed-pipeline-ownership.md +0 -101
- package/docs/skills/plugin/SKILL.md +0 -132
- package/docs/skills/theme/SKILL.md +0 -77
- package/docs/spec-only-host-adoption.md +0 -157
- package/docs/transaction-patterns.md +0 -5
- package/skills/README.md +0 -127
- package/skills/develop/SKILL.md +0 -258
- package/skills/install/SKILL.md +0 -112
- package/skills/integrate/SKILL.md +0 -60
- package/skills/media-gc/SKILL.md +0 -85
- package/skills/plugin/SKILL.md +0 -132
- package/skills/provision/SKILL.md +0 -194
- package/skills/theme/SKILL.md +0 -77
- package/skills/update/SKILL.md +0 -51
- package/templates/chatgpt-sites/auth.ts +0 -66
- package/templates/chatgpt-sites/build.mjs +0 -14
- package/templates/chatgpt-sites/env.ts +0 -1
- package/templates/chatgpt-sites/mcp.ts +0 -48
- package/templates/chatgpt-sites/public-mcp.ts +0 -29
- package/templates/chatgpt-sites/smoke-local.mjs +0 -20
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Assemble a Mantle Worker with createMantleWorker, add handlers and routes through extend, and respect Core-owned paths.
|
|
3
|
-
---
|
|
4
|
-
# The conventional Worker
|
|
5
|
-
|
|
6
|
-
New applications can start with `mantle generate --host cf`, which writes a
|
|
7
|
-
blank home, Worker entry and selected Admin/API/MCP wiring. This page covers
|
|
8
|
-
the lower-level `createMantleWorker` facade for applications that author their
|
|
9
|
-
own Worker entry: its options, extension seam, readiness and reserved paths.
|
|
10
|
-
|
|
11
|
-
## Minimal entry
|
|
12
|
-
|
|
13
|
-
```ts
|
|
14
|
-
import { createMantleWorker } from "@aotter/mantle/cloudflare";
|
|
15
|
-
import { plan } from "../.mantle/generated/mantle.js";
|
|
16
|
-
|
|
17
|
-
export default createMantleWorker({ plan, cacheScope: "my-site-production" });
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
`plan` is the sealed plan that `mantle generate` writes to `.mantle/generated/mantle.ts`. With only `plan`, this manually assembled Worker serves public View REST, HTTP Triggers, Admin, Auth, OAuth and MCP. It renders no public pages and `/` is a 404; see [Public web](./public-web.md). A newly generated full CF project wires a separate editable blank home. Local Admin with email OTP replaces Auth construction; see [Quickstart: local Admin](../start/quickstart-admin.md). Admin still requires the `ASSETS` binding.
|
|
21
|
-
|
|
22
|
-
## Options
|
|
23
|
-
|
|
24
|
-
| Option | Type | Purpose |
|
|
25
|
-
|---|---|---|
|
|
26
|
-
| `plan` | `RuntimePlan` | Required. Generated plan; a fingerprint or version mismatch fails immediately and asks you to regenerate. |
|
|
27
|
-
| `handlers` | `Record<string, AnyHandler>` | Implementations for `handler.kind: ref` Procedures. Merged with `extend().handlers`; a name registered twice throws. |
|
|
28
|
-
| `siteDefaults` | `SiteDefaults \| (env) => SiteDefaults` | Brand, title, description, origin, locales, icons, media purposes. Use the function form to read `env.PUBLIC_ORIGIN`. See [Site config](../reference/site-config.md). |
|
|
29
|
-
| `cacheScope` | `string \| (env) => string` | Stable deployment/site identifier for public cache tags and optional `MANTLE_KV` keys. Lowercase letters, digits, `_` and `-`, up to 64 characters. Shared caching is disabled when absent or invalid. |
|
|
30
|
-
| `templates` | `TemplateRegistry` | Entry and list templates for public HTML. |
|
|
31
|
-
| `publicPathResolver` | `PublicPathResolver` | Collection-to-URL mapping used for canonical URLs, sitemap and hreflang. |
|
|
32
|
-
| `mediaAllowSvg` | `boolean \| (env) => boolean` | Accept SVG uploads. Default `false`. |
|
|
33
|
-
| `auth` | `(env) => Auth` | Replace Auth construction only. Core still owns the Auth routes. |
|
|
34
|
-
| `bindings` | `(env, conventional) => MantleWorkerBindings` | Augment the conventional adapters, for example `mediaStorage` or `deferredHookDispatcher`. |
|
|
35
|
-
| `extend` | `(ctx) => MantleWorkerExtension \| void` | The one seam for handlers, credential resolution, JWT bearer verification and new Hono routes. |
|
|
36
|
-
|
|
37
|
-
`extend` receives `{ env, auth, bindings, getRuntime }` and may return:
|
|
38
|
-
|
|
39
|
-
```ts
|
|
40
|
-
{
|
|
41
|
-
handlers?: Record<string, AnyHandler>;
|
|
42
|
-
credentialResolver?: ConsumerCredentialResolver; // site-owned API keys and personal tokens
|
|
43
|
-
jwtBearer?: { audience: string; scopes?: readonly string[] };
|
|
44
|
-
mount?: ({ app, ref, env, auth, bindings, getRuntime }) => void;
|
|
45
|
-
}
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
`extend` may run again after a failed initialization. Keep external side effects out of it.
|
|
49
|
-
|
|
50
|
-
## What the facade owns
|
|
51
|
-
|
|
52
|
-
Once per isolate, `createMantleWorker` assembles and memoizes:
|
|
53
|
-
|
|
54
|
-
- Conventional bindings: `DB` becomes the D1 driver, `ASSETS` serves the Admin bundle, `MANTLE_KV` (when bound) becomes the MCP catalog projection. See [Bindings](./bindings.md).
|
|
55
|
-
- Conventional Auth chosen by `MANTLE_AUTH_MODE`, or your `auth` factory. See [Authentication](./authentication.md).
|
|
56
|
-
- Runtime endpoints: manifest HTTP Triggers, `GET /api/views` and `GET /api/views/<name>` for public Views.
|
|
57
|
-
- Admin at `/admin` when Admin assets are present, OAuth consent and discovery, and MCP at `/mcp` and `/mcp/staff`. The MCP transport is Streamable HTTP, POST-only: no session header, no server-initiated stream (`GET` answers `405`), and `tools/call` answers `401` with an OAuth challenge so a client can authenticate mid-session and retry. Verified against the official TypeScript client SDK `@modelcontextprotocol/client` 2.0.0 in the adapter's conformance test; that pin is the gate when the SDK is upgraded.
|
|
58
|
-
- A `/favicon.ico` route derived from `siteDefaults.icons`. This is a convention, not a reserved path; an existing host route wins.
|
|
59
|
-
- The final cache policy on every response, and best-effort purge of the deployment-scoped public tag after publishing-content and site-setting writes.
|
|
60
|
-
- A redacted error boundary: an unexpected failure returns `500` with `{ "ok": false, "error": "internal_error" }` and `private, no-store`.
|
|
61
|
-
|
|
62
|
-
If `auth.ready` rejects, the memoized assembly is evicted so the next request rebuilds instead of reusing a poisoned isolate.
|
|
63
|
-
|
|
64
|
-
## The returned handler
|
|
65
|
-
|
|
66
|
-
```ts
|
|
67
|
-
const worker = createMantleWorker<Env>({ plan });
|
|
68
|
-
worker.fetch(request, env, ctx); // HTTP entry
|
|
69
|
-
worker.getRuntime(env); // the runtime fetch uses, resolved after auth.ready
|
|
70
|
-
worker.scheduled(controller, env, ctx); // declared scheduled Procedure Triggers
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
Queue handlers call `worker.getRuntime(env)` and then generated `bindMantle(runtime)` so they reuse the assembled runtime. Scheduled Procedure Triggers use `worker.scheduled` with expressions registered in Wrangler. See [Bindings](./bindings.md#cron-triggers), [Trigger](../reference/trigger.md#schedule-source), and [Deferred hooks](./deferred-hooks-queues.md).
|
|
74
|
-
|
|
75
|
-
## Readiness rule
|
|
76
|
-
|
|
77
|
-
Standard protected routes establish readiness themselves: the facade awaits `getRuntime()` before Auth, `/oauth`, `/mcp`, `/admin/api` and `/.well-known/oauth*` requests. Extension routes do not. Before an extension route reads or writes Mantle data, or relies on database-backed Auth, it must `await ref.get()` (inside `mount`) or `await getRuntime()`.
|
|
78
|
-
|
|
79
|
-
`getRuntime` rejects when called synchronously inside `extend` before it returns. Retain the function and call it later, for example inside a request handler.
|
|
80
|
-
|
|
81
|
-
## Reserved paths
|
|
82
|
-
|
|
83
|
-
Extensions add routes; they never replace Core surfaces. These registrations are rejected:
|
|
84
|
-
|
|
85
|
-
- `/admin`, `/_mantle`, `/api/auth`, `/api/views`, `/oauth`, `/mcp`, and anything beneath them
|
|
86
|
-
- `/.well-known/oauth*`
|
|
87
|
-
- the custom Auth factory's `basePath`
|
|
88
|
-
- global `*` and `/*` handlers
|
|
89
|
-
- any exact method and path pair that a manifest HTTP Trigger already owns
|
|
90
|
-
|
|
91
|
-
Static literals fail TypeScript during your build (`MantleExtensionPath`). Computed paths cannot be proven statically, so after `mount` returns the facade inspects Hono's assembled route table and throws before serving any request. There is no override option. The `app` passed to `mount` exposes `get`, `post`, `put`, `patch`, `delete`, `options`, `all`, `on`, `use` and `route`; it omits global error and not-found hooks.
|
|
92
|
-
|
|
93
|
-
## Handlers and routes
|
|
94
|
-
|
|
95
|
-
```ts
|
|
96
|
-
import { createMantleWorker, type MantleCloudflareEnv } from "@aotter/mantle/cloudflare";
|
|
97
|
-
import { plan } from "../.mantle/generated/mantle.js";
|
|
98
|
-
import { notifyIntake } from "./handlers/notifyIntake.js";
|
|
99
|
-
|
|
100
|
-
interface Env extends MantleCloudflareEnv {
|
|
101
|
-
readonly PUBLIC_ORIGIN: string;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export default createMantleWorker<Env>({
|
|
105
|
-
plan,
|
|
106
|
-
siteDefaults: (env) => ({
|
|
107
|
-
brand: "Example",
|
|
108
|
-
title: "Example",
|
|
109
|
-
description: "Example site.",
|
|
110
|
-
origin: env.PUBLIC_ORIGIN,
|
|
111
|
-
locales: ["en"],
|
|
112
|
-
icons: [
|
|
113
|
-
{ src: "/site-icon.png", mimeType: "image/png", sizes: ["64x64"] },
|
|
114
|
-
{ src: "/site-icon.svg", mimeType: "image/svg+xml", sizes: ["any"] },
|
|
115
|
-
],
|
|
116
|
-
}),
|
|
117
|
-
extend: () => ({
|
|
118
|
-
handlers: { "notify-intake": notifyIntake },
|
|
119
|
-
mount({ app, ref }) {
|
|
120
|
-
app.get("/api/health", (c) => c.json({ ok: true }));
|
|
121
|
-
app.get("/api/locales", async (c) => {
|
|
122
|
-
const runtime = await ref.get(); // readiness before data
|
|
123
|
-
const site = await runtime.siteConfig.load();
|
|
124
|
-
return c.json({ locales: site.locales });
|
|
125
|
-
});
|
|
126
|
-
},
|
|
127
|
-
}),
|
|
128
|
-
});
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
Handler keys match `spec.handler.ref` in Procedure manifests; see [Procedures and Triggers](../concepts/procedures-and-triggers.md).
|
|
132
|
-
|
|
133
|
-
## A `bindings` hook
|
|
134
|
-
|
|
135
|
-
`bindings` receives the conventional set and returns the set the runtime uses. Spread the conventional bindings, then add capability adapters:
|
|
136
|
-
|
|
137
|
-
```ts
|
|
138
|
-
import {
|
|
139
|
-
createMantleWorker,
|
|
140
|
-
WorkersQueueHookDispatcher,
|
|
141
|
-
} from "@aotter/mantle/cloudflare";
|
|
142
|
-
|
|
143
|
-
export default createMantleWorker<Env>({
|
|
144
|
-
plan,
|
|
145
|
-
bindings: (env, conventional) => ({
|
|
146
|
-
...conventional,
|
|
147
|
-
mediaStorage: buildMediaStorage(env), // see media-r2.md
|
|
148
|
-
deferredHookDispatcher: new WorkersQueueHookDispatcher(env.MANTLE_INTERNAL_QUEUE),
|
|
149
|
-
}),
|
|
150
|
-
});
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
The conventional set is `{ db, adminAssets, mcpCatalogKv? }`. Never drop `db`.
|
|
154
|
-
|
|
155
|
-
## Site identity
|
|
156
|
-
|
|
157
|
-
`siteDefaults.icons` is one identity reused by browser favicons, Admin chrome and MCP `serverInfo.icons`. Keep the SVG as the editable source and add a PNG rendition for MCP clients that need raster formats. Both files live in `public/`.
|
|
158
|
-
|
|
159
|
-
## Source
|
|
160
|
-
- [`packages/mantle/README.md`](../../../packages/mantle/README.md)
|
|
161
|
-
- [`packages/adapters/cloudflare/README.md`](../../../packages/adapters/cloudflare/README.md)
|
|
162
|
-
- [`packages/adapters/cloudflare/src/worker/createMantleWorker.ts`](../../../packages/adapters/cloudflare/src/worker/createMantleWorker.ts)
|
|
163
|
-
- [`packages/adapters/cloudflare/src/bindings/conventionalBindings.ts`](../../../packages/adapters/cloudflare/src/bindings/conventionalBindings.ts)
|
|
164
|
-
- [`packages/adapters/cloudflare/src/mount/cmsConfig.ts`](../../../packages/adapters/cloudflare/src/mount/cmsConfig.ts)
|
|
165
|
-
- [`docs/examples/host-local-admin-otp/src/index.ts`](../../../docs/examples/host-local-admin-otp/src/index.ts)
|
|
166
|
-
- [`docs/examples/host-minimal-worker/src/index.ts`](../../../docs/examples/host-minimal-worker/src/index.ts)
|
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Move after_* lifecycle Triggers onto Cloudflare Queues with at-least-once delivery, idempotent handlers and a DLQ.
|
|
3
|
-
---
|
|
4
|
-
# Deferred hooks with Queues
|
|
5
|
-
|
|
6
|
-
`after_create`, `after_update`, `after_delete` and `after_publish` lifecycle Triggers run inline by default. Binding a Cloudflare Queue moves them off the request path. This page covers the guarantees, the setup, the Worker wiring and how to write handlers that survive replay.
|
|
7
|
-
|
|
8
|
-
## When to defer
|
|
9
|
-
|
|
10
|
-
Defer hooks that must not add request latency and that tolerate a short delay: notifications, projections, upstream API calls. Keep synchronous `before_*` hooks for validation and abuse prevention; they may read request-only input such as a CAPTCHA token, which deferred envelopes never retain.
|
|
11
|
-
|
|
12
|
-
## Guarantees
|
|
13
|
-
|
|
14
|
-
- The entry write commits first. D1 and the Queue do not share a transaction, so a Worker failure between them can lose the enqueue.
|
|
15
|
-
- Delivery is at-least-once. A message can run more than once.
|
|
16
|
-
- A rejected or ambiguous `Queue.send()` falls back to `ctx.waitUntil` (or inline when unavailable) with the same event identity. That fallback is best-effort.
|
|
17
|
-
- A consumer runs every captured Trigger before acknowledging; a later failure can replay an earlier success.
|
|
18
|
-
- Malformed, oversized, removed-Trigger and persistently failing messages are retried and then land in the dead-letter queue. Without a DLQ, Cloudflare discards them after `max_retries`.
|
|
19
|
-
|
|
20
|
-
Handlers must therefore be idempotent. Mantle does not promise exactly-once execution.
|
|
21
|
-
|
|
22
|
-
## The v1 envelope
|
|
23
|
-
|
|
24
|
-
```ts
|
|
25
|
-
interface DeferredHookEnvelope {
|
|
26
|
-
version: 1;
|
|
27
|
-
eventId: string;
|
|
28
|
-
triggerNames: readonly string[];
|
|
29
|
-
hook: "after_create" | "after_update" | "after_delete" | "after_publish";
|
|
30
|
-
schema: string;
|
|
31
|
-
entry: EntryRow;
|
|
32
|
-
ctxSnapshot: CtxSnapshot | null;
|
|
33
|
-
}
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
Each handler receives the persisted `entry.data` as input and `ctx.event = { id, trigger, hook, schema, entry }`. Use `${ctx.event.id}:${ctx.event.trigger}` as the idempotency key; it is stable across fallback, retries and replay. `ctxSnapshot` holds normalized actor and credential metadata, never cookies, tokens or API keys.
|
|
37
|
-
|
|
38
|
-
Cloudflare's 128 KB message limit is decimal and includes platform metadata. The dispatcher rejects non-JSON-safe envelopes and any encoded envelope of 127,000 bytes or more before calling `Queue.send`. Keep entry payloads well below that.
|
|
39
|
-
|
|
40
|
-
## Setup
|
|
41
|
-
|
|
42
|
-
```sh
|
|
43
|
-
pnpm wrangler queues create mantle-internal
|
|
44
|
-
pnpm wrangler queues create mantle-internal-dlq
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
```jsonc
|
|
48
|
-
"queues": {
|
|
49
|
-
"producers": [{ "binding": "MANTLE_INTERNAL_QUEUE", "queue": "mantle-internal" }],
|
|
50
|
-
"consumers": [{
|
|
51
|
-
"queue": "mantle-internal",
|
|
52
|
-
"max_batch_size": 10,
|
|
53
|
-
"max_batch_timeout": 5,
|
|
54
|
-
"max_retries": 5,
|
|
55
|
-
"retry_delay": 60,
|
|
56
|
-
"dead_letter_queue": "mantle-internal-dlq"
|
|
57
|
-
}]
|
|
58
|
-
}
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
These are adapter settings, not manifest grammar. See [Trigger](../reference/trigger.md) for the `lifecycle` source shape.
|
|
62
|
-
|
|
63
|
-
## Worker wiring
|
|
64
|
-
|
|
65
|
-
```ts
|
|
66
|
-
import type { DeferredHookEnvelope } from "@aotter/mantle/runtime";
|
|
67
|
-
import {
|
|
68
|
-
WorkersQueueHookDispatcher,
|
|
69
|
-
createMantleWorker,
|
|
70
|
-
createQueueHandler,
|
|
71
|
-
type MantleCloudflareEnv,
|
|
72
|
-
} from "@aotter/mantle/cloudflare";
|
|
73
|
-
import { plan } from "../.mantle/generated/mantle.js";
|
|
74
|
-
|
|
75
|
-
interface Env extends MantleCloudflareEnv {
|
|
76
|
-
readonly MANTLE_INTERNAL_QUEUE: Queue<DeferredHookEnvelope>;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
const worker = createMantleWorker<Env>({
|
|
80
|
-
plan,
|
|
81
|
-
handlers,
|
|
82
|
-
bindings: (env, conventional) => ({
|
|
83
|
-
...conventional,
|
|
84
|
-
deferredHookDispatcher: new WorkersQueueHookDispatcher(env.MANTLE_INTERNAL_QUEUE),
|
|
85
|
-
}),
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
export default {
|
|
89
|
-
fetch: worker.fetch,
|
|
90
|
-
queue(batch, env) {
|
|
91
|
-
return createQueueHandler<Env>({ get: () => worker.getRuntime(env) })(batch, env);
|
|
92
|
-
},
|
|
93
|
-
} satisfies ExportedHandler<Env>;
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
The same Worker is producer and consumer. Opt-in adds only the dispatcher binding and the `queue` export; Auth, MCP, cache and runtime assembly stay on the standard path.
|
|
97
|
-
|
|
98
|
-
## Multiplexing application queues
|
|
99
|
-
|
|
100
|
-
Route on `batch.queue` when the Worker also consumes its own queues:
|
|
101
|
-
|
|
102
|
-
```ts
|
|
103
|
-
queue(batch, env, ctx) {
|
|
104
|
-
const mantleQueue = createQueueHandler<Env>({ get: () => worker.getRuntime(env) });
|
|
105
|
-
switch (batch.queue) {
|
|
106
|
-
case "mantle-internal": return mantleQueue(batch, env);
|
|
107
|
-
case "billing-jobs": return consumeBilling(batch, env, ctx);
|
|
108
|
-
default:
|
|
109
|
-
batch.retryAll();
|
|
110
|
-
console.error(`No consumer for queue '${batch.queue}'`);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
Application consumers own their own acknowledgement. A common pattern is to `bindMantle(await worker.getRuntime(env))` and call a Procedure, then `ack()` on success, `retry()` on `INTERNAL_ERROR` or `CONFLICT`, and `ack()` on other diagnostics so a poison message does not loop. See [Bindings](./bindings.md#queues).
|
|
116
|
-
|
|
117
|
-
## Consumer semantics
|
|
118
|
-
|
|
119
|
-
- At most five messages run concurrently within a delivered batch, even if `max_batch_size` is higher.
|
|
120
|
-
- Runtime boot failure calls `batch.retryAll()` so per-message attempt counters advance and `max_retries` and the DLQ apply.
|
|
121
|
-
- Each message is acknowledged exactly once after every captured Trigger succeeds; any failure calls `retry()` on that message only.
|
|
122
|
-
|
|
123
|
-
## An idempotent D1 handler
|
|
124
|
-
|
|
125
|
-
Make the event key a unique database key:
|
|
126
|
-
|
|
127
|
-
```sql
|
|
128
|
-
CREATE TABLE notification_jobs (
|
|
129
|
-
idempotency_key TEXT PRIMARY KEY,
|
|
130
|
-
entry_id TEXT NOT NULL,
|
|
131
|
-
payload TEXT NOT NULL,
|
|
132
|
-
created_at INTEGER NOT NULL
|
|
133
|
-
);
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
```ts
|
|
137
|
-
import type { HandlerContext } from "@aotter/mantle/runtime";
|
|
138
|
-
|
|
139
|
-
export async function enqueueNotification(input: Record<string, unknown>, ctx: HandlerContext) {
|
|
140
|
-
if (!ctx.event?.entry) throw new Error("lifecycle entry event required");
|
|
141
|
-
const key = `${ctx.event.id}:${ctx.event.trigger}`;
|
|
142
|
-
await (ctx.env as Env).DB.prepare(
|
|
143
|
-
`INSERT OR IGNORE INTO notification_jobs (idempotency_key, entry_id, payload, created_at)
|
|
144
|
-
VALUES (?, ?, ?, ?)`,
|
|
145
|
-
).bind(key, ctx.event.entry.id, JSON.stringify(input), Date.now()).run();
|
|
146
|
-
return { ok: true };
|
|
147
|
-
}
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
For an upstream API, send the same key as `Idempotency-Key` and throw on a non-OK response so the Queue retries. Core adds no outbox, job registry or provider retry wrapper; those remain application-owned.
|
|
151
|
-
|
|
152
|
-
## The removed-Trigger footgun
|
|
153
|
-
|
|
154
|
-
`triggerNames` is captured when the mutation runs. Renaming or removing a captured Trigger makes every older message fail validation at dispatch and eventually reach the DLQ; it never silently changes meaning. Drain the queue before removing a deferred Trigger, and inspect the DLQ before raising `max_retries`.
|
|
155
|
-
|
|
156
|
-
## Verify
|
|
157
|
-
|
|
158
|
-
In the SDK checkout the contract test is:
|
|
159
|
-
|
|
160
|
-
```sh
|
|
161
|
-
pnpm --filter @aotter/mantle-cloudflare test -- mantle-internal-queue.test.ts
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
For a site, run `wrangler dev`, submit a mutation that has an `after_*` Trigger, and read the consumer log. Make one handler fail once and confirm the replay carries the same `ctx.event.id` and `ctx.event.trigger`.
|
|
165
|
-
|
|
166
|
-
## Source
|
|
167
|
-
- [`docs/deferred-lifecycle-queues.md`](../../../docs/deferred-lifecycle-queues.md)
|
|
168
|
-
- [`packages/adapters/cloudflare/src/bindings/WorkersQueueHookDispatcher.ts`](../../../packages/adapters/cloudflare/src/bindings/WorkersQueueHookDispatcher.ts)
|
|
169
|
-
- [`packages/adapters/cloudflare/src/mount/cmsConfig.ts`](../../../packages/adapters/cloudflare/src/mount/cmsConfig.ts)
|
|
170
|
-
- [`packages/adapters/cloudflare/README.md`](../../../packages/adapters/cloudflare/README.md)
|
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Own the top-level Hono assembly with the same public primitives createMantleWorker uses, and the invariants you must keep.
|
|
3
|
-
---
|
|
4
|
-
# Low-level composition
|
|
5
|
-
|
|
6
|
-
Use `createMantleWorker` unless the deployment must own its top-level Worker lifecycle. This page covers when that is true, what it costs, the exported building blocks, the assembly order, and the invariants a hand-assembled Worker must preserve.
|
|
7
|
-
|
|
8
|
-
## When you need it
|
|
9
|
-
|
|
10
|
-
You need low-level composition when the Worker entry must do something the facade's single `extend` seam cannot: run logic around every response (an audit queue, custom telemetry), select bindings or Auth per request, or interleave Mantle with another framework's router. Custom handlers, routes, credential resolvers and capability bindings do not require it; see [The conventional Worker](./conventional-worker.md).
|
|
11
|
-
|
|
12
|
-
The cost is ownership. The Worker entry, error boundary, readiness handling and cache boundary become application code, and there is no automatic merge path back to `createMantleWorker`. Mantle still owns the imported adapters and standard route behavior; update them through the package version and never copy their source.
|
|
13
|
-
|
|
14
|
-
## Building blocks
|
|
15
|
-
|
|
16
|
-
All of these are exported from `@aotter/mantle/cloudflare` unless noted:
|
|
17
|
-
|
|
18
|
-
| Export | Role |
|
|
19
|
-
|---|---|
|
|
20
|
-
| `createConventionalBindings(env, cacheScope?)` | `DB` to D1 driver, `ASSETS` to Admin assets, optional deployment-scoped `MANTLE_KV` |
|
|
21
|
-
| `createConventionalAuth(env)`, `createAuth(config)` | Mode-driven Auth, or a curated custom factory |
|
|
22
|
-
| `conventionalMcpResource(env)`, `conventionalAuthBaseURL(env)` | `<PUBLIC_ORIGIN>/mcp` and the canonical base URL |
|
|
23
|
-
| `setupIncompleteAuthResponse(request, auth)` | The `503 setup_incomplete` guard for Auth-owned paths |
|
|
24
|
-
| `createMantleRuntimeRef(config)` | Per-isolate runtime singleton with `get()`, `web()`, `auth`, `plan` |
|
|
25
|
-
| `mountRuntimeEndpoints(app, ref)` | HTTP Triggers, `GET /api/views`, `GET /api/views/<name>` |
|
|
26
|
-
| `mountAdmin(app, ref, assets)` | Admin routes and SPA |
|
|
27
|
-
| `mountMantleOAuth(app, { auth, assets })` | OAuth consent and discovery, from `@aotter/mantle/admin` |
|
|
28
|
-
| `createMcpApiHandler({ ref, surface, resource })` | `/mcp` (`"public"`) and `/mcp/staff` (`"staff"`) handlers |
|
|
29
|
-
| `mountPublicRoutes(app, ref, options)` | Public HTML, `.md`, `llms.txt`, sitemap |
|
|
30
|
-
| `applyCachePolicy(request, response, cacheTag?)` | The final cache decision |
|
|
31
|
-
| `runMantleWorkerRequest(fn)` | Redacted `500 internal_error` boundary |
|
|
32
|
-
| `D1DatabaseDriver`, `AssetsAssetServer`, `R2MediaStorage`, `WorkersQueueHookDispatcher`, `createQueueHandler`, `KvSiteConfigRepository`, `cloudflareTurnstileCheck`, `resolveCaller` | Individual adapters and helpers |
|
|
33
|
-
| `MANTLE_RESERVED_PATH_PREFIXES`, `MANTLE_RESERVED_WELL_KNOWN_PREFIX`, `MANTLE_RESERVED_EXACT_PATHS` | Core-owned path constants |
|
|
34
|
-
|
|
35
|
-
## Assembly
|
|
36
|
-
|
|
37
|
-
The order is bindings, Auth, runtime ref, Hono app, runtime endpoints, Admin, OAuth, MCP handlers, then the cache policy on every response. This example adds one application-owned audit message after each request:
|
|
38
|
-
|
|
39
|
-
```ts
|
|
40
|
-
import { Hono } from "hono";
|
|
41
|
-
import {
|
|
42
|
-
applyCachePolicy,
|
|
43
|
-
conventionalMcpResource,
|
|
44
|
-
createMantleRuntimeRef,
|
|
45
|
-
createConventionalAuth,
|
|
46
|
-
createConventionalBindings,
|
|
47
|
-
createMcpApiHandler,
|
|
48
|
-
mountAdmin,
|
|
49
|
-
mountRuntimeEndpoints,
|
|
50
|
-
runMantleWorkerRequest,
|
|
51
|
-
scopedPublicCacheTag,
|
|
52
|
-
setupIncompleteAuthResponse,
|
|
53
|
-
type MantleCloudflareEnv,
|
|
54
|
-
} from "@aotter/mantle/cloudflare";
|
|
55
|
-
import { mountMantleOAuth } from "@aotter/mantle/admin";
|
|
56
|
-
import { plan } from "../.mantle/generated/mantle.js";
|
|
57
|
-
|
|
58
|
-
interface Env extends MantleCloudflareEnv {
|
|
59
|
-
readonly AUDIT_QUEUE: Queue<{ kind: "request-complete"; path: string; status: number }>;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
let assembled: ReturnType<typeof assemble> | undefined;
|
|
63
|
-
const CACHE_SCOPE = "my-site-production";
|
|
64
|
-
const CACHE_TAG = scopedPublicCacheTag(CACHE_SCOPE)!;
|
|
65
|
-
|
|
66
|
-
export default {
|
|
67
|
-
fetch(request: Request, env: Env, ctx: ExecutionContext): Promise<Response> {
|
|
68
|
-
return runMantleWorkerRequest(async () => {
|
|
69
|
-
const worker = assembled ??= assemble(env);
|
|
70
|
-
if (worker.auth.ready) ctx.waitUntil(worker.auth.ready.catch((error) => {
|
|
71
|
-
if (assembled === worker) assembled = undefined; // evict a failed assembly
|
|
72
|
-
throw error;
|
|
73
|
-
}));
|
|
74
|
-
const incomplete = await setupIncompleteAuthResponse(request, worker.auth);
|
|
75
|
-
const response = incomplete ?? await worker.fetch(request, env, ctx);
|
|
76
|
-
ctx.waitUntil(env.AUDIT_QUEUE.send({
|
|
77
|
-
kind: "request-complete",
|
|
78
|
-
path: new URL(request.url).pathname,
|
|
79
|
-
status: response.status,
|
|
80
|
-
}));
|
|
81
|
-
return response;
|
|
82
|
-
});
|
|
83
|
-
},
|
|
84
|
-
} satisfies ExportedHandler<Env>;
|
|
85
|
-
|
|
86
|
-
function assemble(env: Env) {
|
|
87
|
-
const bindings = createConventionalBindings(env, CACHE_SCOPE);
|
|
88
|
-
const auth = createConventionalAuth(env);
|
|
89
|
-
const ref = createMantleRuntimeRef({
|
|
90
|
-
plan,
|
|
91
|
-
bindings,
|
|
92
|
-
auth,
|
|
93
|
-
cacheScope: CACHE_SCOPE,
|
|
94
|
-
onPublicChange: purgePublicCache,
|
|
95
|
-
});
|
|
96
|
-
const app = new Hono<{ Bindings: Env }>();
|
|
97
|
-
|
|
98
|
-
mountRuntimeEndpoints(app, ref);
|
|
99
|
-
if (bindings.adminAssets) mountAdmin(app, ref, bindings.adminAssets);
|
|
100
|
-
mountMantleOAuth(app, { auth, assets: bindings.adminAssets });
|
|
101
|
-
app.get("/cache-probe", () => new Response("public", {
|
|
102
|
-
headers: { "cache-control": "public, s-maxage=60" },
|
|
103
|
-
}));
|
|
104
|
-
|
|
105
|
-
const resource = conventionalMcpResource(env);
|
|
106
|
-
const mcp = new Map([
|
|
107
|
-
["/mcp/staff", createMcpApiHandler<Env>({ ref, surface: "staff", resource })],
|
|
108
|
-
["/mcp", createMcpApiHandler<Env>({ ref, surface: "public", resource })],
|
|
109
|
-
]);
|
|
110
|
-
|
|
111
|
-
return {
|
|
112
|
-
auth,
|
|
113
|
-
async fetch(request: Request, workerEnv: Env, ctx: ExecutionContext) {
|
|
114
|
-
// Prepare the canonical D1 schema before Better Auth handles a
|
|
115
|
-
// token, client, consent or CIMD request.
|
|
116
|
-
await ref.get();
|
|
117
|
-
const handler = mcp.get(new URL(request.url).pathname);
|
|
118
|
-
const response = handler?.fetch
|
|
119
|
-
? await handler.fetch(request, workerEnv, ctx)
|
|
120
|
-
: await app.fetch(request, workerEnv, ctx);
|
|
121
|
-
return applyCachePolicy(request, response, CACHE_TAG);
|
|
122
|
-
},
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
async function purgePublicCache() {
|
|
127
|
-
try {
|
|
128
|
-
const { cache } = await import("cloudflare:workers");
|
|
129
|
-
const result = await cache.purge({ tags: [CACHE_TAG] });
|
|
130
|
-
if (!result.success) console.error("public cache purge failed", result.errors);
|
|
131
|
-
} catch (error) {
|
|
132
|
-
console.error("public cache purge failed", error);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
```jsonc
|
|
138
|
-
{
|
|
139
|
-
"compatibility_flags": ["nodejs_compat", "global_fetch_strictly_public"],
|
|
140
|
-
"queues": { "producers": [{ "binding": "AUDIT_QUEUE", "queue": "my-site-audit" }] }
|
|
141
|
-
}
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
## Invariants to keep
|
|
145
|
-
|
|
146
|
-
- Await `ref.get()` before Better Auth handles a token, client, consent or CIMD request. The facade does this for Auth, `/oauth`, `/mcp`, `/admin/api` and `/.well-known/oauth*`; the example awaits before every request.
|
|
147
|
-
- Evict the memoized assembly when `auth.ready` rejects, so a transient D1 failure during boot does not poison the isolate.
|
|
148
|
-
- Pass every response through `applyCachePolicy`, after Admin, Auth, API, OAuth, MCP, application routes, redirects and errors. It marks private surfaces `private, no-store`, strips CDN override headers, and keeps only anonymous `200` `GET`/`HEAD` responses with explicit `public` freshness.
|
|
149
|
-
- Return `setupIncompleteAuthResponse` before dispatch so misconfigured Auth fails closed on Auth-owned paths only.
|
|
150
|
-
- Keep the conventional `DB` binding, both compatibility flags, and the optional `MANTLE_KV` binding. Low-level bindings may instead set `mcpCatalogKv: { namespace, scope }` with a stable deployment-owned scope, never one derived from a request.
|
|
151
|
-
- Pass `reservedHttpPathPrefixes` (the exported constants plus `auth.basePath`) to `createMantleRuntimeRef` so a manifest HTTP Trigger cannot claim a Core path.
|
|
152
|
-
- If you mount public routes, provide a stable `cacheScope`, pass `onPublicChange` to `createMantleRuntimeRef`, and purge the resulting scoped tag there with the Workers cache API. The facade wires this purge itself; a bare `createMantleRuntimeRef` does not.
|
|
153
|
-
- Do not replace Auth, MCP or cache handling with local copies.
|
|
154
|
-
|
|
155
|
-
## Adding an application queue producer
|
|
156
|
-
|
|
157
|
-
The audit queue above is the pattern: declare the binding in `Env` and `wrangler.jsonc`, send from `ctx.waitUntil` after the response is decided, and keep the message contract application-owned. Consume it in the same Worker by switching on `batch.queue`; see [Deferred hooks with Queues](./deferred-hooks-queues.md#multiplexing-application-queues). For the runtime pipeline these pieces sit on, see [Runtime and adapters](../concepts/runtime-and-adapters.md).
|
|
158
|
-
|
|
159
|
-
## Source
|
|
160
|
-
- [`docs/cloudflare-low-level-composition.md`](../../../docs/cloudflare-low-level-composition.md)
|
|
161
|
-
- [`packages/adapters/cloudflare/README.md`](../../../packages/adapters/cloudflare/README.md)
|
|
162
|
-
- [`packages/adapters/cloudflare/src/worker/createMantleWorker.ts`](../../../packages/adapters/cloudflare/src/worker/createMantleWorker.ts)
|
|
163
|
-
- [`packages/adapters/cloudflare/src/mount/bootRuntimeOnce.ts`](../../../packages/adapters/cloudflare/src/mount/bootRuntimeOnce.ts)
|
|
164
|
-
- [`packages/adapters/cloudflare/src/mount/cmsConfig.ts`](../../../packages/adapters/cloudflare/src/mount/cmsConfig.ts)
|
|
165
|
-
- [`packages/adapters/cloudflare/src/oauth/cachePolicy.ts`](../../../packages/adapters/cloudflare/src/oauth/cachePolicy.ts)
|
|
166
|
-
- [`packages/adapters/cloudflare/src/index.ts`](../../../packages/adapters/cloudflare/src/index.ts)
|
|
167
|
-
- [`packages/adapters/cloudflare/src/bindings/index.ts`](../../../packages/adapters/cloudflare/src/bindings/index.ts)
|
|
168
|
-
- [`packages/adapters/cloudflare/src/mount/index.ts`](../../../packages/adapters/cloudflare/src/mount/index.ts)
|
|
169
|
-
- [`packages/adapters/cloudflare/src/worker/index.ts`](../../../packages/adapters/cloudflare/src/worker/index.ts)
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Opt a Worker into public HTML, Markdown mirrors, llms.txt and sitemap with mountPublicRoutes, templates and a path resolver.
|
|
3
|
-
---
|
|
4
|
-
# Public web, SEO and cache
|
|
5
|
-
|
|
6
|
-
Public rendering is opt-in. A headless Worker serves Views and Triggers only; this page shows how to add server-rendered pages, their agent-readable mirrors and discovery files, and what the cache contract guarantees.
|
|
7
|
-
|
|
8
|
-
## Three inputs that must agree
|
|
9
|
-
|
|
10
|
-
1. `mountPublicRoutes(app, ref, { collectionRoutes, ... })` inside `extend.mount` declares which collections have URLs.
|
|
11
|
-
2. A `TemplateRegistry` with an entry template (and optionally a list template) for each of those collections, passed as `templates`.
|
|
12
|
-
3. A `PublicPathResolver` from `createPublicPathResolver({ collectionRoutes })`, passed as `publicPathResolver`, so canonical URLs, sitemap entries and hreflang siblings match the mounted routes.
|
|
13
|
-
|
|
14
|
-
Mounting every Schema automatically is not supported: some collections are private even when they carry a slug. Without a `publicPathResolver`, `/sitemap.xml` returns `500`.
|
|
15
|
-
|
|
16
|
-
## Worked example: a blog
|
|
17
|
-
|
|
18
|
-
```ts
|
|
19
|
-
// src/web/templates.ts
|
|
20
|
-
import { createPublicPathResolver, TemplateRegistry, renderSeoTagsHtml } from "@aotter/mantle-web";
|
|
21
|
-
|
|
22
|
-
export const publicPathResolver = createPublicPathResolver({
|
|
23
|
-
collectionRoutes: { posts: { segment: "posts" } },
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
export const collectionRoutes = [
|
|
27
|
-
{ collection: "posts", segment: "posts", listRoute: true },
|
|
28
|
-
] as const;
|
|
29
|
-
|
|
30
|
-
export function createBlogTemplates(): TemplateRegistry {
|
|
31
|
-
const templates = new TemplateRegistry();
|
|
32
|
-
|
|
33
|
-
templates.registerEntryTemplate("posts", ({ entry, site, seo }) => {
|
|
34
|
-
const title = String(entry.data.title ?? site.title);
|
|
35
|
-
const meta = seo && {
|
|
36
|
-
...seo,
|
|
37
|
-
jsonLd: { "@context": "https://schema.org", "@type": "BlogPosting", headline: title, url: seo.canonical },
|
|
38
|
-
};
|
|
39
|
-
return `<html lang="${entry.locale ?? "en"}"><head><title>${escape(title)}</title>
|
|
40
|
-
${meta ? renderSeoTagsHtml(meta) : ""}<link rel="stylesheet" href="/blog.css"></head>
|
|
41
|
-
<body><article><h1>${escape(title)}</h1>
|
|
42
|
-
${seo?.alternateMarkdown ? `<a href="${seo.alternateMarkdown}">Read as Markdown</a>` : ""}
|
|
43
|
-
${renderMarkdown(String(entry.data.body ?? ""))}</article></body></html>`;
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
templates.registerListTemplate("posts", ({ entries, locale, site, seo }) => {
|
|
47
|
-
const items = entries.map((entry) => {
|
|
48
|
-
const href = publicPathResolver.forEntry(entry) ?? `/${locale}/posts/${entry.id}`;
|
|
49
|
-
return `<li><a href="${href}">${escape(String(entry.data.title ?? entry.id))}</a></li>`;
|
|
50
|
-
}).join("");
|
|
51
|
-
return `<html lang="${locale}"><head><title>Blog · ${escape(site.brand)}</title>
|
|
52
|
-
${seo ? renderSeoTagsHtml(seo) : ""}</head><body><ul>${items}</ul></body></html>`;
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
return templates;
|
|
56
|
-
}
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
```ts
|
|
60
|
-
// worker entry
|
|
61
|
-
export default createMantleWorker<Env>({
|
|
62
|
-
plan,
|
|
63
|
-
templates: createBlogTemplates(),
|
|
64
|
-
publicPathResolver,
|
|
65
|
-
siteDefaults: (env) => ({ /* ... */ origin: env.PUBLIC_ORIGIN, locales: ["en", "zh-TW"] }),
|
|
66
|
-
extend: ({ env }) => ({
|
|
67
|
-
mount({ app, ref }) {
|
|
68
|
-
mountPublicRoutes(app as never, ref, {
|
|
69
|
-
collectionRoutes: [...collectionRoutes],
|
|
70
|
-
notFoundRenderer: async () => htmlNotFound(),
|
|
71
|
-
liveDev: new URL(env.PUBLIC_ORIGIN).hostname === "localhost",
|
|
72
|
-
});
|
|
73
|
-
},
|
|
74
|
-
}),
|
|
75
|
-
});
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
Templates return complete HTML strings; the renderer prepends the doctype. Escape every value you interpolate. Analytics, pixels and verification tags are host chrome — add them in the template or on Cloudflare. See [Site chrome](./site-chrome.md).
|
|
79
|
-
|
|
80
|
-
## Template signatures
|
|
81
|
-
|
|
82
|
-
```ts
|
|
83
|
-
templates.registerEntryTemplate(collection, ({ entry, site, mediaAssets?, seo? }) => string);
|
|
84
|
-
templates.registerListTemplate(collection, ({ collection, locale, entries, site, mediaAssets?, seo? }) => string);
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
`seo` is a composed `SeoMeta`:
|
|
88
|
-
|
|
89
|
-
| Field | Content |
|
|
90
|
-
|---|---|
|
|
91
|
-
| `canonical` | Absolute canonical URL from `site.origin` and the resolved path |
|
|
92
|
-
| `alternateMarkdown` | Absolute `.md` mirror URL, or `null` when the entry has no Markdown body |
|
|
93
|
-
| `hreflangs` | One row per locale plus `x-default` on multi-locale sites |
|
|
94
|
-
| `description`, `og`, `twitter` | Description, Open Graph and Twitter card blocks |
|
|
95
|
-
| `jsonLd` | A default object; replace it before rendering, as the example does |
|
|
96
|
-
|
|
97
|
-
`renderSeoTagsHtml(seo)` emits the corresponding tags. Entry pages also get `<link rel="alternate" type="text/markdown">` so crawlers and agents can fetch clean Markdown.
|
|
98
|
-
|
|
99
|
-
## Routes produced
|
|
100
|
-
|
|
101
|
-
| Route | Condition |
|
|
102
|
-
|---|---|
|
|
103
|
-
| `GET /` → `302` to `/<canonicalLocale>` | `homeRenderer` set |
|
|
104
|
-
| `GET /:locale`, `GET /:locale.md` | `homeRenderer` set; body from `homeMarkdown` or the `homeSlug` entry |
|
|
105
|
-
| `GET /:locale/<segment>`, `GET /:locale/<segment>.md` | `listRoute: true` |
|
|
106
|
-
| `GET /:locale/<segment>/:slug` | always |
|
|
107
|
-
| `GET /:locale/<segment>/:slug.md` | `markdownMirror` not `false` (default on) |
|
|
108
|
-
| `GET /:locale/<segment>/:slug?preview=1` | staff session; renders live, `private, no-store` |
|
|
109
|
-
| `GET /llms.txt`, `GET /:locale/llms.txt` | always |
|
|
110
|
-
| `GET /sitemap.xml` | always; a urlset, or a sitemap index linking `/sitemap.xml?part=1&cursor=...` parts |
|
|
111
|
-
| `GET /robots.txt` | always; `Allow: /` plus the sitemap URL |
|
|
112
|
-
|
|
113
|
-
`CollectionRouteConfig` fields: `collection`, `segment` (empty string mounts entries directly under `/:locale/`), `listRoute` (default `false`), `markdownMirror` (default `true`), `homeSlug` (collapse one slug to `/:locale`). `slugOverrides` serve one `(collection, slug)` pair from your own renderer and take precedence over preview and standard rendering. `notFoundRenderer` is required; every miss falls through it. `liveDev` switches entry and list responses to `private, no-store` for local work.
|
|
114
|
-
|
|
115
|
-
Only entries with `status: published` render. Drafts never appear on pages, mirrors, `llms.txt` or the sitemap; preview needs a staff session and answers `401` or `403` otherwise.
|
|
116
|
-
|
|
117
|
-
## Pagination
|
|
118
|
-
|
|
119
|
-
Lists and `llms.txt` return 50 entries per page, ordered `updatedAt DESC, id DESC`, with a forward `cursor`. A continuation adds `Link: <...?cursor=...>; rel="next"`; HTML lists also get a visible `<nav aria-label="Pagination">` Next link, and `llms.txt` appends a `## Continue` section. Sitemap parts hold up to 2,000 URLs divided by the locale count. See [Views](../concepts/views.md) for View-level paging.
|
|
120
|
-
|
|
121
|
-
## Cache contract
|
|
122
|
-
|
|
123
|
-
With a valid `cacheScope`, public responses carry `Cache-Control: public, max-age=0, s-maxage=300` and a deployment-scoped cache tag. The facade's final policy keeps that only for anonymous `200` `GET`/`HEAD` responses with no request `Cookie` or `Authorization` and no `Set-Cookie`, and adds `Vary: Cookie, Authorization`. Everything else becomes `private, no-store`, and CDN override headers are removed.
|
|
124
|
-
|
|
125
|
-
Publishing-content and site-setting writes purge the scoped tag through the native Workers cache API. Purge is best effort after the canonical write. Operational records and static assets are outside that boundary. Enable the cache with `"cache": { "enabled": true }`; see [Bindings](./bindings.md#workers-cache).
|
|
126
|
-
|
|
127
|
-
> **Warning**
|
|
128
|
-
> The local emulator does not simulate the entrypoint Workers Cache or its purge API. Verify `cf-cache-status` and post-publish invalidation on a deployed environment, not with `wrangler dev`.
|
|
129
|
-
|
|
130
|
-
## Static assets for templates
|
|
131
|
-
|
|
132
|
-
Reference CSS, JS and icons by root path (`/blog.css`, `/site-icon.svg`); the `ASSETS` binding serves them from `public/`. Keep public content prefixes in `run_worker_first` so a static file never shadows a rendered route, and leave asset paths out of it so they bypass the Worker.
|
|
133
|
-
|
|
134
|
-
## Source
|
|
135
|
-
- [`packages/adapters/cloudflare/src/mount/mountPublicRoutes.ts`](../../../packages/adapters/cloudflare/src/mount/mountPublicRoutes.ts)
|
|
136
|
-
- [`packages/adapters/cloudflare/src/oauth/cachePolicy.ts`](../../../packages/adapters/cloudflare/src/oauth/cachePolicy.ts)
|
|
137
|
-
- [`packages/adapters/cloudflare/src/worker/createMantleWorker.ts`](../../../packages/adapters/cloudflare/src/worker/createMantleWorker.ts)
|
|
138
|
-
- [`packages/mantle-web/README.md`](../../../packages/mantle-web/README.md)
|
|
139
|
-
- [`packages/mantle-web/src/model/TemplateRegistry.ts`](../../../packages/mantle-web/src/model/TemplateRegistry.ts)
|
|
140
|
-
- [`packages/mantle-web/src/model/SeoMeta.ts`](../../../packages/mantle-web/src/model/SeoMeta.ts)
|
|
141
|
-
- [`packages/mantle-web/src/service/SeoMetaComposer.ts`](../../../packages/mantle-web/src/service/SeoMetaComposer.ts)
|
|
142
|
-
- [`packages/mantle-web/src/service/PublicPathResolver.ts`](../../../packages/mantle-web/src/service/PublicPathResolver.ts)
|
|
143
|
-
- [`docs/adapter-guide.md`](../../../docs/adapter-guide.md)
|
|
144
|
-
- [`docs/performance-harness.md`](../../../docs/performance-harness.md)
|