@aotter/mantle 0.2.0-alpha.1 → 0.2.0-alpha.10
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 +180 -45
- package/dist/auth/adapter.d.ts +32 -0
- package/dist/auth/adapter.js +288 -0
- package/dist/auth/admin.d.ts +3 -0
- package/dist/auth/admin.js +21 -0
- package/dist/auth/caller.d.ts +86 -0
- package/dist/auth/caller.js +155 -0
- package/dist/auth/hardening.d.ts +24 -0
- package/dist/auth/hardening.js +40 -0
- package/dist/auth/identity.d.ts +121 -0
- package/dist/auth/identity.js +203 -0
- package/dist/auth/oauth.d.ts +63 -0
- package/dist/auth/oauth.js +217 -0
- package/dist/auth/resource-seeds.js +10 -0
- package/dist/auth/routes.d.ts +32 -0
- package/dist/auth/routes.js +226 -0
- package/dist/build/compiler.d.ts +721 -0
- package/dist/build/compiler.js +7029 -0
- package/dist/{spec → build/spec}/domain/model/ManifestGrammar.d.ts +30 -43
- package/dist/{spec → build/spec}/domain/model/RuntimePlan.d.ts +77 -3
- package/dist/{spec → build/spec}/domain/model/SqlIr.d.ts +39 -6
- package/dist/build/spec/domain/model/UserFields.d.ts +21 -0
- package/dist/{spec → build/spec}/domain/service/PlanFingerprint.d.ts +4 -1
- package/dist/{spec → build/spec}/kernel/diagnostic.d.ts +1 -30
- package/dist/bun/assets.d.ts +2 -0
- package/dist/bun/assets.js +24 -0
- package/dist/domain/adminOrder.js +24 -0
- package/dist/domain/columns.js +57 -0
- package/dist/domain/describe/chunk-ZVXBGP7Y.js +424 -0
- package/dist/domain/describe/index.d.ts +58 -0
- package/dist/domain/describe/index.js +115 -0
- package/dist/domain/describe/target-hash.d.ts +8 -0
- package/dist/domain/describe/target-hash.js +12 -0
- package/dist/domain/describe/targets.d.ts +40 -0
- package/dist/domain/entry.js +33 -0
- package/dist/domain/generated-tools.js +19 -0
- package/dist/domain/generation.d.ts +16 -0
- package/dist/domain/generation.js +1 -0
- package/dist/domain/input.js +17 -0
- package/dist/domain/model.js +1 -0
- package/dist/domain/paging.js +230 -0
- package/dist/domain/recipes.js +24 -0
- package/dist/domain/userReferences.js +5 -0
- package/dist/domain/wireScalars.js +47 -0
- package/dist/infrastructure/adminEntries.js +153 -0
- package/dist/infrastructure/adminPaging.js +72 -0
- package/dist/infrastructure/artifacts.js +71 -0
- package/dist/infrastructure/authSchema.js +83 -0
- package/dist/infrastructure/bundle.js +188 -0
- package/dist/infrastructure/cli.js +118 -0
- package/dist/infrastructure/generate.d.ts +12 -0
- package/dist/infrastructure/generate.js +189 -0
- package/dist/infrastructure/generateAuth.d.ts +8 -0
- package/dist/infrastructure/generateAuth.js +74 -0
- package/dist/infrastructure/help.js +60 -0
- package/dist/infrastructure/init.js +54 -0
- package/dist/infrastructure/inputs.js +41 -0
- package/dist/infrastructure/mounts.js +25 -0
- package/dist/infrastructure/wrangler.js +109 -0
- package/dist/kernel/authorization.d.ts +4 -0
- package/dist/kernel/authorization.js +16 -0
- package/dist/kernel/binds.d.ts +60 -0
- package/dist/kernel/binds.js +49 -0
- package/dist/kernel/caller-identity.d.ts +24 -0
- package/dist/kernel/caller-identity.js +22 -0
- package/dist/kernel/contract-error.d.ts +12 -0
- package/dist/kernel/contract-error.js +14 -0
- package/dist/kernel/contracts.d.ts +143 -0
- package/dist/kernel/contracts.js +97 -0
- package/dist/{spec/domain/service/CloudflareCron.d.ts → kernel/cron.d.ts} +0 -1
- package/dist/{spec/domain/service/CloudflareCron.js → kernel/cron.js} +1 -6
- package/dist/kernel/dialect/common.d.ts +38 -0
- package/dist/kernel/dialect/common.js +6 -0
- package/dist/kernel/dialect/postgres.d.ts +16 -0
- package/dist/kernel/dialect/postgres.js +18 -0
- package/dist/kernel/dialect/sqlite.d.ts +20 -0
- package/dist/kernel/dialect/sqlite.js +34 -0
- package/dist/kernel/drain.d.ts +5 -0
- package/dist/kernel/drain.js +35 -0
- package/dist/kernel/driver/bun-sqlite.d.ts +19 -0
- package/dist/kernel/driver/bun-sqlite.js +77 -0
- package/dist/kernel/driver/d1.d.ts +24 -0
- package/dist/kernel/driver/d1.js +22 -0
- package/dist/kernel/driver/postgres.d.ts +25 -0
- package/dist/kernel/driver/postgres.js +99 -0
- package/dist/kernel/driver/transaction-context.d.ts +10 -0
- package/dist/kernel/driver/transaction-context.js +29 -0
- package/dist/kernel/email.d.ts +28 -0
- package/dist/{auth/emailTemplates.js → kernel/email.js} +13 -2
- package/dist/kernel/host-access.d.ts +10 -0
- package/dist/kernel/host-access.js +65 -0
- package/dist/kernel/host-caller.d.ts +39 -0
- package/dist/kernel/host-caller.js +56 -0
- package/dist/kernel/json-body.d.ts +4 -0
- package/dist/kernel/json-body.js +44 -0
- package/dist/kernel/mcp-apps.d.ts +69 -0
- package/dist/kernel/mcp-apps.js +40 -0
- package/dist/kernel/mcp-call.d.ts +5 -0
- package/dist/kernel/mcp-call.js +25 -0
- package/dist/kernel/mcp-handler.js +371 -0
- package/dist/kernel/mcp.d.ts +110 -0
- package/dist/kernel/mcp.js +50 -0
- package/dist/kernel/media.d.ts +27 -0
- package/dist/kernel/media.js +216 -0
- package/dist/kernel/paging.d.ts +55 -0
- package/dist/kernel/paging.js +95 -0
- package/dist/kernel/publishing.d.ts +4 -0
- package/dist/kernel/publishing.js +16 -0
- package/dist/{cloudflare/r2Media.d.ts → kernel/r2-media.d.ts} +4 -5
- package/dist/kernel/r2-media.js +78 -0
- package/dist/kernel/rest-dispatch.js +38 -0
- package/dist/kernel/rest-router.js +64 -0
- package/dist/kernel/rest.d.ts +58 -0
- package/dist/kernel/rest.js +41 -0
- package/dist/kernel/scalars.d.ts +6 -0
- package/dist/kernel/scalars.js +44 -0
- package/dist/kernel/search.js +5 -0
- package/dist/{core/site.d.ts → kernel/site-types.d.ts} +38 -9
- package/dist/kernel/site-types.js +1 -0
- package/dist/kernel/site.d.ts +39 -0
- package/dist/kernel/site.js +32 -0
- package/dist/kernel/store.d.ts +175 -0
- package/dist/kernel/store.js +269 -0
- package/dist/kernel/surface.d.ts +10 -0
- package/dist/kernel/surface.js +19 -0
- package/dist/kernel/sweep.d.ts +17 -0
- package/dist/kernel/sweep.js +27 -0
- package/dist/kernel/translations.d.ts +1 -0
- package/dist/kernel/translations.js +13 -0
- package/dist/kernel/user-caller.d.ts +31 -0
- package/dist/kernel/user-caller.js +67 -0
- package/dist/kernel/user-field-name.js +3 -0
- package/dist/kernel/user-fields.d.ts +35 -0
- package/dist/kernel/user-fields.js +81 -0
- package/dist/kernel/validation.d.ts +15 -0
- package/dist/kernel/validation.js +54 -0
- package/dist/kernel/web-gateway.js +68 -0
- package/dist/kernel/web-head.js +15 -0
- package/dist/kernel/web-index.js +40 -0
- package/dist/kernel/web-response.js +8 -0
- package/dist/kernel/web.d.ts +77 -0
- package/dist/kernel/web.js +124 -0
- package/dist/kernel/where.js +27 -0
- package/dist/testing/index.d.ts +1 -37
- package/dist/testing/index.js +1 -43
- package/dist/usecase/adminBindings.js +143 -0
- package/dist/usecase/adminClient.js +87 -0
- package/dist/usecase/adminDescriptors.js +107 -0
- package/dist/usecase/generate.js +166 -0
- package/dist/usecase/handlers.js +21 -0
- package/dist/usecase/mcp-media.js +17 -0
- package/dist/usecase/mcp.js +100 -0
- package/dist/usecase/paging.js +71 -0
- package/dist/usecase/publishing.js +63 -0
- package/dist/usecase/refusals.js +27 -0
- package/dist/usecase/rest.js +54 -0
- package/dist/usecase/search.js +7 -0
- package/dist/usecase/site.js +39 -0
- package/dist/usecase/stores.js +64 -0
- package/dist/usecase/tool-version.js +9 -0
- package/dist/usecase/translations.js +78 -0
- package/dist/usecase/ttl.js +20 -0
- package/dist/usecase/validation.js +241 -0
- package/dist/usecase/web.js +23 -0
- package/docs/examples/README.md +39 -16
- package/docs/examples/app-shell/README.md +121 -0
- package/docs/examples/app-shell/accept.mjs +91 -0
- package/docs/examples/app-shell/gitignore +7 -0
- package/docs/examples/app-shell/package.json +43 -0
- package/docs/examples/app-shell/pnpm-workspace.yaml +8 -0
- package/docs/examples/app-shell/smoke-kit.mjs +168 -0
- package/docs/examples/app-shell/src/auth.ts +58 -0
- package/docs/examples/app-shell/src/handlers.ts +5 -0
- package/docs/examples/app-shell/src/index.ts +4 -0
- package/docs/examples/app-shell/src/routes.ts +14 -0
- package/docs/examples/app-shell/src/schedule.ts +8 -0
- package/docs/examples/app-shell/src/service.ts +70 -0
- package/docs/examples/app-shell/src/sign-in.ts +41 -0
- package/docs/examples/app-shell/src/signup.ts +8 -0
- package/docs/examples/{reference-service → app-shell}/tsconfig.json +6 -2
- package/docs/examples/app-shell/worker-configuration.d.ts +22 -0
- package/docs/examples/app-shell/wrangler.jsonc +62 -0
- package/docs/examples/club-events/README.md +65 -0
- package/docs/examples/club-events/manifests/club-events.yaml +247 -0
- package/docs/examples/club-events/smoke.mjs +127 -0
- package/docs/examples/club-events/src/handlers.ts +25 -0
- package/docs/examples/club-events/src/signup.ts +9 -0
- package/docs/examples/generated-web/README.md +78 -0
- package/docs/examples/generated-web/posts.yaml +38 -0
- package/docs/examples/generated-web/seed.sql +6 -0
- package/docs/examples/generated-web/src/worker.ts +43 -0
- package/docs/examples/generated-web/tsconfig.json +8 -0
- package/docs/examples/generated-web/wrangler.jsonc +8 -0
- package/docs/examples/purchasing/.dev.vars.example +6 -0
- package/docs/examples/purchasing/README.md +99 -0
- package/docs/examples/purchasing/manifests/purchasing.yaml +374 -0
- package/docs/examples/purchasing/seed.sql +4 -0
- package/docs/examples/purchasing/smoke.mjs +191 -0
- package/docs/examples/purchasing/src/admin.tsx +13 -0
- package/docs/examples/purchasing/src/handlers.ts +33 -0
- package/docs/examples/purchasing/src/notify.ts +29 -0
- package/docs/examples/purchasing/src/requests-page.ts +57 -0
- package/docs/examples/purchasing/src/routes.ts +53 -0
- package/docs/examples/purchasing/src/schedule.ts +31 -0
- package/docs/examples/purchasing/src/signup.ts +5 -0
- package/docs/examples/purchasing/src/supplier.ts +32 -0
- package/docs/examples/purchasing/wrangler.jsonc +69 -0
- package/docs/examples/recipes/README.md +60 -0
- package/docs/examples/recipes/manifests/recipes.yaml +75 -0
- package/docs/examples/recipes/smoke.mjs +102 -0
- package/docs/examples/recipes/src/media.ts +13 -0
- package/docs/examples/recipes/src/pages.ts +99 -0
- package/docs/examples/recipes/src/routes.ts +71 -0
- package/docs/examples/recipes/src/site-config.ts +12 -0
- package/docs/examples/recipes/wrangler.jsonc +74 -0
- package/docs/handbook/cloudflare/authentication.md +186 -108
- package/docs/handbook/cloudflare/chatgpt-sites.md +5 -112
- package/docs/handbook/cloudflare/deploy-and-operate.md +59 -87
- package/docs/handbook/cloudflare/media-r2.md +61 -82
- package/docs/handbook/cloudflare/service-entry.md +220 -119
- package/docs/handbook/concepts/authorization.md +10 -117
- package/docs/handbook/concepts/four-atoms.md +9 -92
- package/docs/handbook/concepts/lifecycle-and-locales.md +9 -80
- package/docs/handbook/concepts/mcp-and-agents.md +24 -116
- package/docs/handbook/concepts/procedures-and-triggers.md +5 -162
- package/docs/handbook/concepts/runtime-and-adapters.md +15 -183
- package/docs/handbook/concepts/views.md +10 -109
- package/docs/handbook/examples/hub.md +2 -18
- package/docs/handbook/guides/adapter-guide.md +11 -0
- package/docs/handbook/guides/admin-ui.md +113 -136
- package/docs/handbook/guides/agent-setup.md +32 -27
- package/docs/handbook/guides/agent-workflow-acceptance.md +232 -0
- package/docs/handbook/guides/email.md +86 -0
- package/docs/handbook/guides/local-testing.md +40 -0
- package/docs/handbook/guides/mcp-apps.md +560 -0
- package/docs/handbook/guides/native-admin.md +566 -0
- package/docs/handbook/guides/native-execution.md +133 -0
- package/docs/handbook/guides/oauth.md +219 -0
- package/docs/handbook/guides/postgres-adapters.md +56 -0
- package/docs/handbook/guides/public-pages.md +87 -0
- package/docs/handbook/guides/size-and-startup.md +9 -0
- package/docs/handbook/guides/sql-patterns.md +266 -0
- package/docs/handbook/guides/typed-queries.md +210 -100
- package/docs/handbook/navigation.json +176 -30
- package/docs/handbook/reference/admin-descriptors.md +53 -0
- package/docs/handbook/reference/authorization.md +44 -52
- package/docs/handbook/reference/describe.md +56 -0
- package/docs/handbook/reference/diagnostics.md +19 -77
- package/docs/handbook/reference/features.md +45 -53
- package/docs/handbook/reference/manifest.md +6 -69
- package/docs/handbook/reference/procedure.md +11 -115
- package/docs/handbook/reference/schema.md +81 -172
- package/docs/handbook/reference/site-config.md +5 -65
- package/docs/handbook/reference/sql.md +64 -0
- package/docs/handbook/reference/surface.md +396 -93
- package/docs/handbook/reference/trigger.md +62 -89
- package/docs/handbook/reference/view.md +40 -158
- package/docs/handbook/releases/index.md +198 -12
- package/docs/handbook/start/agents.md +45 -0
- package/docs/handbook/start/overview.md +9 -56
- package/docs/handbook/start/project-and-cli.md +51 -131
- package/docs/handbook/start/quickstart-worker.md +38 -115
- package/docs/skills/develop/SKILL.md +77 -121
- package/docs/skills/integrate/SKILL.md +37 -84
- package/docs/skills/media-gc/SKILL.md +21 -8
- package/docs/skills/provision/SKILL.md +31 -87
- package/docs/skills/update/SKILL.md +20 -34
- package/docs/source/scripts/postgres-adapter.ts +101 -0
- package/docs/upgrade-0.1-to-0.2.md +26 -10
- package/package.json +120 -112
- package/skills/README.md +67 -0
- package/skills/mantle/SKILL.md +76 -0
- package/dist/admin/consent.d.ts +0 -17
- package/dist/admin/consent.d.ts.map +0 -1
- package/dist/admin/consent.js +0 -17
- package/dist/admin/consent.js.map +0 -1
- package/dist/admin/createAdminSurface.d.ts +0 -22
- package/dist/admin/createAdminSurface.d.ts.map +0 -1
- package/dist/admin/createAdminSurface.js +0 -589
- package/dist/admin/createAdminSurface.js.map +0 -1
- package/dist/admin/developerConsole.d.ts +0 -264
- package/dist/admin/developerConsole.d.ts.map +0 -1
- package/dist/admin/developerConsole.js +0 -136
- package/dist/admin/developerConsole.js.map +0 -1
- package/dist/admin/identity.d.ts +0 -62
- package/dist/admin/identity.d.ts.map +0 -1
- package/dist/admin/identity.js +0 -7
- package/dist/admin/identity.js.map +0 -1
- package/dist/admin/index.d.ts +0 -4
- package/dist/admin/index.d.ts.map +0 -1
- package/dist/admin/index.js +0 -4
- package/dist/admin/index.js.map +0 -1
- package/dist/admin/procedureFlow.d.ts +0 -25
- package/dist/admin/procedureFlow.d.ts.map +0 -1
- package/dist/admin/procedureFlow.js +0 -154
- package/dist/admin/procedureFlow.js.map +0 -1
- package/dist/auth/ConsoleEmailSender.d.ts +0 -15
- package/dist/auth/ConsoleEmailSender.d.ts.map +0 -1
- package/dist/auth/ConsoleEmailSender.js +0 -19
- package/dist/auth/ConsoleEmailSender.js.map +0 -1
- package/dist/auth/appleClientSecret.d.ts +0 -75
- package/dist/auth/appleClientSecret.d.ts.map +0 -1
- package/dist/auth/appleClientSecret.js +0 -116
- package/dist/auth/appleClientSecret.js.map +0 -1
- package/dist/auth/buildAuth.d.ts +0 -4565
- package/dist/auth/buildAuth.d.ts.map +0 -1
- package/dist/auth/buildAuth.js +0 -307
- package/dist/auth/buildAuth.js.map +0 -1
- package/dist/auth/callerResolver.d.ts +0 -48
- package/dist/auth/callerResolver.d.ts.map +0 -1
- package/dist/auth/callerResolver.js +0 -49
- package/dist/auth/callerResolver.js.map +0 -1
- package/dist/auth/createAuthRoutes.d.ts +0 -22
- package/dist/auth/createAuthRoutes.d.ts.map +0 -1
- package/dist/auth/createAuthRoutes.js +0 -128
- package/dist/auth/createAuthRoutes.js.map +0 -1
- package/dist/auth/createMantleAuth.d.ts +0 -3
- package/dist/auth/createMantleAuth.d.ts.map +0 -1
- package/dist/auth/createMantleAuth.js +0 -483
- package/dist/auth/createMantleAuth.js.map +0 -1
- package/dist/auth/db.d.ts +0 -17
- package/dist/auth/db.d.ts.map +0 -1
- package/dist/auth/db.js +0 -24
- package/dist/auth/db.js.map +0 -1
- package/dist/auth/emailTemplates.d.ts +0 -7
- package/dist/auth/emailTemplates.d.ts.map +0 -1
- package/dist/auth/emailTemplates.js.map +0 -1
- package/dist/auth/index.d.ts +0 -9
- package/dist/auth/index.d.ts.map +0 -1
- package/dist/auth/index.js +0 -7
- package/dist/auth/index.js.map +0 -1
- package/dist/auth/methods.d.ts +0 -717
- package/dist/auth/methods.d.ts.map +0 -1
- package/dist/auth/methods.js +0 -321
- package/dist/auth/methods.js.map +0 -1
- package/dist/auth/oauthTokens.d.ts +0 -24
- package/dist/auth/oauthTokens.d.ts.map +0 -1
- package/dist/auth/oauthTokens.js +0 -146
- package/dist/auth/oauthTokens.js.map +0 -1
- package/dist/auth/setupIncomplete.d.ts +0 -16
- package/dist/auth/setupIncomplete.d.ts.map +0 -1
- package/dist/auth/setupIncomplete.js +0 -50
- package/dist/auth/setupIncomplete.js.map +0 -1
- package/dist/auth/types.d.ts +0 -440
- package/dist/auth/types.d.ts.map +0 -1
- package/dist/auth/types.js +0 -10
- package/dist/auth/types.js.map +0 -1
- package/dist/bun/index.d.ts +0 -65
- package/dist/bun/index.d.ts.map +0 -1
- package/dist/bun/index.js +0 -130
- package/dist/bun/index.js.map +0 -1
- package/dist/cli/emitModule.d.ts +0 -7
- package/dist/cli/emitModule.d.ts.map +0 -1
- package/dist/cli/emitModule.js +0 -127
- package/dist/cli/emitModule.js.map +0 -1
- package/dist/cli/generate.d.ts +0 -8
- package/dist/cli/generate.d.ts.map +0 -1
- package/dist/cli/generate.js +0 -355
- package/dist/cli/generate.js.map +0 -1
- package/dist/cli/main.d.ts +0 -3
- package/dist/cli/main.d.ts.map +0 -1
- package/dist/cli/main.js +0 -21
- package/dist/cli/main.js.map +0 -1
- package/dist/cli/preset.d.ts +0 -18
- package/dist/cli/preset.d.ts.map +0 -1
- package/dist/cli/preset.js +0 -352
- package/dist/cli/preset.js.map +0 -1
- package/dist/cloudflare/index.d.ts +0 -21
- package/dist/cloudflare/index.d.ts.map +0 -1
- package/dist/cloudflare/index.js +0 -14
- package/dist/cloudflare/index.js.map +0 -1
- package/dist/cloudflare/r2Media.d.ts.map +0 -1
- package/dist/cloudflare/r2Media.js +0 -69
- package/dist/cloudflare/r2Media.js.map +0 -1
- package/dist/core/caller.d.ts +0 -35
- package/dist/core/caller.d.ts.map +0 -1
- package/dist/core/caller.js +0 -3
- package/dist/core/caller.js.map +0 -1
- package/dist/core/createMantle.d.ts +0 -22
- package/dist/core/createMantle.d.ts.map +0 -1
- package/dist/core/createMantle.js +0 -117
- package/dist/core/createMantle.js.map +0 -1
- package/dist/core/dialect.d.ts +0 -41
- package/dist/core/dialect.d.ts.map +0 -1
- package/dist/core/dialect.js +0 -7
- package/dist/core/dialect.js.map +0 -1
- package/dist/core/driver.d.ts +0 -17
- package/dist/core/driver.d.ts.map +0 -1
- package/dist/core/driver.js +0 -2
- package/dist/core/driver.js.map +0 -1
- package/dist/core/email.d.ts +0 -17
- package/dist/core/email.d.ts.map +0 -1
- package/dist/core/email.js +0 -2
- package/dist/core/email.js.map +0 -1
- package/dist/core/index.d.ts +0 -16
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/index.js +0 -16
- package/dist/core/index.js.map +0 -1
- package/dist/core/invocation.d.ts +0 -66
- package/dist/core/invocation.d.ts.map +0 -1
- package/dist/core/invocation.js +0 -3
- package/dist/core/invocation.js.map +0 -1
- package/dist/core/runtime/auth.d.ts +0 -9
- package/dist/core/runtime/auth.d.ts.map +0 -1
- package/dist/core/runtime/auth.js +0 -39
- package/dist/core/runtime/auth.js.map +0 -1
- package/dist/core/runtime/createRuntime.d.ts +0 -23
- package/dist/core/runtime/createRuntime.d.ts.map +0 -1
- package/dist/core/runtime/createRuntime.js +0 -214
- package/dist/core/runtime/createRuntime.js.map +0 -1
- package/dist/core/runtime/verifyPlan.d.ts +0 -34
- package/dist/core/runtime/verifyPlan.d.ts.map +0 -1
- package/dist/core/runtime/verifyPlan.js +0 -301
- package/dist/core/runtime/verifyPlan.js.map +0 -1
- package/dist/core/service.d.ts +0 -45
- package/dist/core/service.d.ts.map +0 -1
- package/dist/core/service.js +0 -2
- package/dist/core/service.js.map +0 -1
- package/dist/core/site.d.ts.map +0 -1
- package/dist/core/site.js +0 -2
- package/dist/core/site.js.map +0 -1
- package/dist/core/siteConfig.d.ts +0 -5
- package/dist/core/siteConfig.d.ts.map +0 -1
- package/dist/core/siteConfig.js +0 -24
- package/dist/core/siteConfig.js.map +0 -1
- package/dist/core/sql/allowlist.d.ts +0 -65
- package/dist/core/sql/allowlist.d.ts.map +0 -1
- package/dist/core/sql/allowlist.js +0 -705
- package/dist/core/sql/allowlist.js.map +0 -1
- package/dist/core/sql/ast.d.ts +0 -24
- package/dist/core/sql/ast.d.ts.map +0 -1
- package/dist/core/sql/ast.js +0 -32
- package/dist/core/sql/ast.js.map +0 -1
- package/dist/core/sql/compile.d.ts +0 -50
- package/dist/core/sql/compile.d.ts.map +0 -1
- package/dist/core/sql/compile.js +0 -48
- package/dist/core/sql/compile.js.map +0 -1
- package/dist/core/sql/policy.d.ts +0 -121
- package/dist/core/sql/policy.d.ts.map +0 -1
- package/dist/core/sql/policy.js +0 -379
- package/dist/core/sql/policy.js.map +0 -1
- package/dist/core/sql/positions.d.ts +0 -30
- package/dist/core/sql/positions.d.ts.map +0 -1
- package/dist/core/sql/positions.js +0 -22
- package/dist/core/sql/positions.js.map +0 -1
- package/dist/core/sql/run.d.ts +0 -76
- package/dist/core/sql/run.d.ts.map +0 -1
- package/dist/core/sql/run.js +0 -267
- package/dist/core/sql/run.js.map +0 -1
- package/dist/core/store/createStore.d.ts +0 -49
- package/dist/core/store/createStore.d.ts.map +0 -1
- package/dist/core/store/createStore.js +0 -227
- package/dist/core/store/createStore.js.map +0 -1
- package/dist/core/store/cursor.d.ts +0 -4
- package/dist/core/store/cursor.d.ts.map +0 -1
- package/dist/core/store/cursor.js +0 -22
- package/dist/core/store/cursor.js.map +0 -1
- package/dist/core/store/json.d.ts +0 -80
- package/dist/core/store/json.d.ts.map +0 -1
- package/dist/core/store/json.js +0 -342
- package/dist/core/store/json.js.map +0 -1
- package/dist/core/store.d.ts +0 -160
- package/dist/core/store.d.ts.map +0 -1
- package/dist/core/store.js +0 -2
- package/dist/core/store.js.map +0 -1
- package/dist/core/wire.d.ts +0 -20
- package/dist/core/wire.d.ts.map +0 -1
- package/dist/core/wire.js +0 -84
- package/dist/core/wire.js.map +0 -1
- package/dist/core/withCaller.d.ts +0 -16
- package/dist/core/withCaller.d.ts.map +0 -1
- package/dist/core/withCaller.js +0 -29
- package/dist/core/withCaller.js.map +0 -1
- package/dist/d1/adapter.d.ts +0 -12
- package/dist/d1/adapter.d.ts.map +0 -1
- package/dist/d1/adapter.js +0 -23
- package/dist/d1/adapter.js.map +0 -1
- package/dist/d1/codec.d.ts +0 -14
- package/dist/d1/codec.d.ts.map +0 -1
- package/dist/d1/codec.js +0 -136
- package/dist/d1/codec.js.map +0 -1
- package/dist/d1/compile/index.d.ts +0 -9
- package/dist/d1/compile/index.d.ts.map +0 -1
- package/dist/d1/compile/index.js +0 -9
- package/dist/d1/compile/index.js.map +0 -1
- package/dist/d1/dialect.d.ts +0 -4
- package/dist/d1/dialect.d.ts.map +0 -1
- package/dist/d1/dialect.js +0 -13
- package/dist/d1/dialect.js.map +0 -1
- package/dist/d1/executor.d.ts +0 -13
- package/dist/d1/executor.d.ts.map +0 -1
- package/dist/d1/executor.js +0 -91
- package/dist/d1/executor.js.map +0 -1
- package/dist/d1/index.d.ts +0 -6
- package/dist/d1/index.d.ts.map +0 -1
- package/dist/d1/index.js +0 -6
- package/dist/d1/index.js.map +0 -1
- package/dist/d1/lower.d.ts +0 -8
- package/dist/d1/lower.d.ts.map +0 -1
- package/dist/d1/lower.js +0 -167
- package/dist/d1/lower.js.map +0 -1
- package/dist/d1/media.d.ts +0 -5
- package/dist/d1/media.d.ts.map +0 -1
- package/dist/d1/media.js +0 -157
- package/dist/d1/media.js.map +0 -1
- package/dist/d1/migrations.d.ts +0 -12
- package/dist/d1/migrations.d.ts.map +0 -1
- package/dist/d1/migrations.js +0 -111
- package/dist/d1/migrations.js.map +0 -1
- package/dist/d1/print.d.ts +0 -28
- package/dist/d1/print.d.ts.map +0 -1
- package/dist/d1/print.js +0 -54
- package/dist/d1/print.js.map +0 -1
- package/dist/d1/site.d.ts +0 -17
- package/dist/d1/site.d.ts.map +0 -1
- package/dist/d1/site.js +0 -63
- package/dist/d1/site.js.map +0 -1
- package/dist/d1/storage.d.ts +0 -34
- package/dist/d1/storage.d.ts.map +0 -1
- package/dist/d1/storage.js +0 -288
- package/dist/d1/storage.js.map +0 -1
- package/dist/d1/tz.d.ts +0 -21
- package/dist/d1/tz.d.ts.map +0 -1
- package/dist/d1/tz.js +0 -54
- package/dist/d1/tz.js.map +0 -1
- package/dist/d1/validator.d.ts +0 -10
- package/dist/d1/validator.d.ts.map +0 -1
- package/dist/d1/validator.js +0 -33
- package/dist/d1/validator.js.map +0 -1
- package/dist/mcp/apps.d.ts +0 -43
- package/dist/mcp/apps.d.ts.map +0 -1
- package/dist/mcp/apps.js +0 -57
- package/dist/mcp/apps.js.map +0 -1
- package/dist/mcp/catalog.d.ts +0 -55
- package/dist/mcp/catalog.d.ts.map +0 -1
- package/dist/mcp/catalog.js +0 -81
- package/dist/mcp/catalog.js.map +0 -1
- package/dist/mcp/createMcpSurface.d.ts +0 -34
- package/dist/mcp/createMcpSurface.d.ts.map +0 -1
- package/dist/mcp/createMcpSurface.js +0 -150
- package/dist/mcp/createMcpSurface.js.map +0 -1
- package/dist/mcp/index.d.ts +0 -4
- package/dist/mcp/index.d.ts.map +0 -1
- package/dist/mcp/index.js +0 -4
- package/dist/mcp/index.js.map +0 -1
- package/dist/postgres/adapter.d.ts +0 -20
- package/dist/postgres/adapter.d.ts.map +0 -1
- package/dist/postgres/adapter.js +0 -44
- package/dist/postgres/adapter.js.map +0 -1
- package/dist/postgres/codec.d.ts +0 -13
- package/dist/postgres/codec.d.ts.map +0 -1
- package/dist/postgres/codec.js +0 -110
- package/dist/postgres/codec.js.map +0 -1
- package/dist/postgres/compile/index.d.ts +0 -9
- package/dist/postgres/compile/index.d.ts.map +0 -1
- package/dist/postgres/compile/index.js +0 -9
- package/dist/postgres/compile/index.js.map +0 -1
- package/dist/postgres/driver.d.ts +0 -92
- package/dist/postgres/driver.d.ts.map +0 -1
- package/dist/postgres/driver.js +0 -110
- package/dist/postgres/driver.js.map +0 -1
- package/dist/postgres/executor.d.ts +0 -20
- package/dist/postgres/executor.d.ts.map +0 -1
- package/dist/postgres/executor.js +0 -69
- package/dist/postgres/executor.js.map +0 -1
- package/dist/postgres/index.d.ts +0 -7
- package/dist/postgres/index.d.ts.map +0 -1
- package/dist/postgres/index.js +0 -7
- package/dist/postgres/index.js.map +0 -1
- package/dist/postgres/lower.d.ts +0 -6
- package/dist/postgres/lower.d.ts.map +0 -1
- package/dist/postgres/lower.js +0 -157
- package/dist/postgres/lower.js.map +0 -1
- package/dist/postgres/print.d.ts +0 -11
- package/dist/postgres/print.d.ts.map +0 -1
- package/dist/postgres/print.js +0 -121
- package/dist/postgres/print.js.map +0 -1
- package/dist/postgres/storage.d.ts +0 -19
- package/dist/postgres/storage.d.ts.map +0 -1
- package/dist/postgres/storage.js +0 -201
- package/dist/postgres/storage.js.map +0 -1
- package/dist/postgres/textRows.d.ts +0 -10
- package/dist/postgres/textRows.d.ts.map +0 -1
- package/dist/postgres/textRows.js +0 -44
- package/dist/postgres/textRows.js.map +0 -1
- package/dist/postgres/validator.d.ts +0 -12
- package/dist/postgres/validator.d.ts.map +0 -1
- package/dist/postgres/validator.js +0 -46
- package/dist/postgres/validator.js.map +0 -1
- package/dist/spec/domain/index.d.ts +0 -3
- package/dist/spec/domain/index.d.ts.map +0 -1
- package/dist/spec/domain/index.js +0 -3
- package/dist/spec/domain/index.js.map +0 -1
- package/dist/spec/domain/model/ContentState.d.ts +0 -8
- package/dist/spec/domain/model/ContentState.d.ts.map +0 -1
- package/dist/spec/domain/model/ContentState.js +0 -7
- package/dist/spec/domain/model/ContentState.js.map +0 -1
- package/dist/spec/domain/model/Entry.d.ts +0 -29
- package/dist/spec/domain/model/Entry.d.ts.map +0 -1
- package/dist/spec/domain/model/Entry.js +0 -16
- package/dist/spec/domain/model/Entry.js.map +0 -1
- package/dist/spec/domain/model/Locale.d.ts +0 -30
- package/dist/spec/domain/model/Locale.d.ts.map +0 -1
- package/dist/spec/domain/model/Locale.js +0 -33
- package/dist/spec/domain/model/Locale.js.map +0 -1
- package/dist/spec/domain/model/ManifestGrammar.d.ts.map +0 -1
- package/dist/spec/domain/model/ManifestGrammar.js +0 -149
- package/dist/spec/domain/model/ManifestGrammar.js.map +0 -1
- package/dist/spec/domain/model/MediaMimeAccept.d.ts +0 -55
- package/dist/spec/domain/model/MediaMimeAccept.d.ts.map +0 -1
- package/dist/spec/domain/model/MediaMimeAccept.js +0 -90
- package/dist/spec/domain/model/MediaMimeAccept.js.map +0 -1
- package/dist/spec/domain/model/RuntimePlan.d.ts.map +0 -1
- package/dist/spec/domain/model/RuntimePlan.js +0 -4
- package/dist/spec/domain/model/RuntimePlan.js.map +0 -1
- package/dist/spec/domain/model/SiteConfig.d.ts +0 -173
- package/dist/spec/domain/model/SiteConfig.d.ts.map +0 -1
- package/dist/spec/domain/model/SiteConfig.js +0 -13
- package/dist/spec/domain/model/SiteConfig.js.map +0 -1
- package/dist/spec/domain/model/SqlIr.d.ts.map +0 -1
- package/dist/spec/domain/model/SqlIr.js +0 -95
- package/dist/spec/domain/model/SqlIr.js.map +0 -1
- package/dist/spec/domain/model/index.d.ts +0 -14
- package/dist/spec/domain/model/index.d.ts.map +0 -1
- package/dist/spec/domain/model/index.js +0 -14
- package/dist/spec/domain/model/index.js.map +0 -1
- package/dist/spec/domain/service/CloudflareCron.d.ts.map +0 -1
- package/dist/spec/domain/service/CloudflareCron.js.map +0 -1
- package/dist/spec/domain/service/CrossSchemaChecker.d.ts +0 -34
- package/dist/spec/domain/service/CrossSchemaChecker.d.ts.map +0 -1
- package/dist/spec/domain/service/CrossSchemaChecker.js +0 -114
- package/dist/spec/domain/service/CrossSchemaChecker.js.map +0 -1
- package/dist/spec/domain/service/EntryDataValidator.d.ts +0 -56
- package/dist/spec/domain/service/EntryDataValidator.d.ts.map +0 -1
- package/dist/spec/domain/service/EntryDataValidator.js +0 -88
- package/dist/spec/domain/service/EntryDataValidator.js.map +0 -1
- package/dist/spec/domain/service/JsonSchemaToZod.d.ts +0 -29
- package/dist/spec/domain/service/JsonSchemaToZod.d.ts.map +0 -1
- package/dist/spec/domain/service/JsonSchemaToZod.js +0 -156
- package/dist/spec/domain/service/JsonSchemaToZod.js.map +0 -1
- package/dist/spec/domain/service/LifecycleStateMachine.d.ts +0 -75
- package/dist/spec/domain/service/LifecycleStateMachine.d.ts.map +0 -1
- package/dist/spec/domain/service/LifecycleStateMachine.js +0 -76
- package/dist/spec/domain/service/LifecycleStateMachine.js.map +0 -1
- package/dist/spec/domain/service/LocaleCanonicalizer.d.ts +0 -29
- package/dist/spec/domain/service/LocaleCanonicalizer.d.ts.map +0 -1
- package/dist/spec/domain/service/LocaleCanonicalizer.js +0 -96
- package/dist/spec/domain/service/LocaleCanonicalizer.js.map +0 -1
- package/dist/spec/domain/service/ManifestFieldChecks.d.ts +0 -60
- package/dist/spec/domain/service/ManifestFieldChecks.d.ts.map +0 -1
- package/dist/spec/domain/service/ManifestFieldChecks.js +0 -116
- package/dist/spec/domain/service/ManifestFieldChecks.js.map +0 -1
- package/dist/spec/domain/service/ManifestGraphValidator.d.ts +0 -15
- package/dist/spec/domain/service/ManifestGraphValidator.d.ts.map +0 -1
- package/dist/spec/domain/service/ManifestGraphValidator.js +0 -225
- package/dist/spec/domain/service/ManifestGraphValidator.js.map +0 -1
- package/dist/spec/domain/service/ManifestLinker.d.ts +0 -45
- package/dist/spec/domain/service/ManifestLinker.d.ts.map +0 -1
- package/dist/spec/domain/service/ManifestLinker.js +0 -92
- package/dist/spec/domain/service/ManifestLinker.js.map +0 -1
- package/dist/spec/domain/service/ManifestLocaleTrimmer.d.ts +0 -16
- package/dist/spec/domain/service/ManifestLocaleTrimmer.d.ts.map +0 -1
- package/dist/spec/domain/service/ManifestLocaleTrimmer.js +0 -76
- package/dist/spec/domain/service/ManifestLocaleTrimmer.js.map +0 -1
- package/dist/spec/domain/service/ManifestParser.d.ts +0 -49
- package/dist/spec/domain/service/ManifestParser.d.ts.map +0 -1
- package/dist/spec/domain/service/ManifestParser.js +0 -203
- package/dist/spec/domain/service/ManifestParser.js.map +0 -1
- package/dist/spec/domain/service/ManifestPartition.d.ts +0 -9
- package/dist/spec/domain/service/ManifestPartition.d.ts.map +0 -1
- package/dist/spec/domain/service/ManifestPartition.js +0 -19
- package/dist/spec/domain/service/ManifestPartition.js.map +0 -1
- package/dist/spec/domain/service/ManifestPathDiagnoser.d.ts +0 -33
- package/dist/spec/domain/service/ManifestPathDiagnoser.d.ts.map +0 -1
- package/dist/spec/domain/service/ManifestPathDiagnoser.js +0 -43
- package/dist/spec/domain/service/ManifestPathDiagnoser.js.map +0 -1
- package/dist/spec/domain/service/ManifestSourceSpans.d.ts +0 -10
- package/dist/spec/domain/service/ManifestSourceSpans.d.ts.map +0 -1
- package/dist/spec/domain/service/ManifestSourceSpans.js +0 -76
- package/dist/spec/domain/service/ManifestSourceSpans.js.map +0 -1
- package/dist/spec/domain/service/McpToolNaming.d.ts +0 -25
- package/dist/spec/domain/service/McpToolNaming.d.ts.map +0 -1
- package/dist/spec/domain/service/McpToolNaming.js +0 -50
- package/dist/spec/domain/service/McpToolNaming.js.map +0 -1
- package/dist/spec/domain/service/PlanFingerprint.d.ts.map +0 -1
- package/dist/spec/domain/service/PlanFingerprint.js +0 -14
- package/dist/spec/domain/service/PlanFingerprint.js.map +0 -1
- package/dist/spec/domain/service/ProcedureViewSpecChecks.d.ts +0 -4
- package/dist/spec/domain/service/ProcedureViewSpecChecks.d.ts.map +0 -1
- package/dist/spec/domain/service/ProcedureViewSpecChecks.js +0 -211
- package/dist/spec/domain/service/ProcedureViewSpecChecks.js.map +0 -1
- package/dist/spec/domain/service/SchemaAdminUiChecker.d.ts +0 -42
- package/dist/spec/domain/service/SchemaAdminUiChecker.d.ts.map +0 -1
- package/dist/spec/domain/service/SchemaAdminUiChecker.js +0 -289
- package/dist/spec/domain/service/SchemaAdminUiChecker.js.map +0 -1
- package/dist/spec/domain/service/SchemaIndexChecker.d.ts +0 -33
- package/dist/spec/domain/service/SchemaIndexChecker.d.ts.map +0 -1
- package/dist/spec/domain/service/SchemaIndexChecker.js +0 -256
- package/dist/spec/domain/service/SchemaIndexChecker.js.map +0 -1
- package/dist/spec/domain/service/SchemaSearchChecker.d.ts +0 -11
- package/dist/spec/domain/service/SchemaSearchChecker.d.ts.map +0 -1
- package/dist/spec/domain/service/SchemaSearchChecker.js +0 -78
- package/dist/spec/domain/service/SchemaSearchChecker.js.map +0 -1
- package/dist/spec/domain/service/SchemaSpecChecks.d.ts +0 -31
- package/dist/spec/domain/service/SchemaSpecChecks.d.ts.map +0 -1
- package/dist/spec/domain/service/SchemaSpecChecks.js +0 -445
- package/dist/spec/domain/service/SchemaSpecChecks.js.map +0 -1
- package/dist/spec/domain/service/SiteDefaultsValidator.d.ts +0 -39
- package/dist/spec/domain/service/SiteDefaultsValidator.d.ts.map +0 -1
- package/dist/spec/domain/service/SiteDefaultsValidator.js +0 -194
- package/dist/spec/domain/service/SiteDefaultsValidator.js.map +0 -1
- package/dist/spec/domain/service/SqlClassify.d.ts +0 -19
- package/dist/spec/domain/service/SqlClassify.d.ts.map +0 -1
- package/dist/spec/domain/service/SqlClassify.js +0 -42
- package/dist/spec/domain/service/SqlClassify.js.map +0 -1
- package/dist/spec/domain/service/SqlRefusal.d.ts +0 -16
- package/dist/spec/domain/service/SqlRefusal.d.ts.map +0 -1
- package/dist/spec/domain/service/SqlRefusal.js +0 -20
- package/dist/spec/domain/service/SqlRefusal.js.map +0 -1
- package/dist/spec/domain/service/SqlTypes.d.ts +0 -40
- package/dist/spec/domain/service/SqlTypes.d.ts.map +0 -1
- package/dist/spec/domain/service/SqlTypes.js +0 -110
- package/dist/spec/domain/service/SqlTypes.js.map +0 -1
- package/dist/spec/domain/service/StaffRoleHierarchy.d.ts +0 -3
- package/dist/spec/domain/service/StaffRoleHierarchy.d.ts.map +0 -1
- package/dist/spec/domain/service/StaffRoleHierarchy.js +0 -19
- package/dist/spec/domain/service/StaffRoleHierarchy.js.map +0 -1
- package/dist/spec/domain/service/TriggerGraphChecks.d.ts +0 -16
- package/dist/spec/domain/service/TriggerGraphChecks.d.ts.map +0 -1
- package/dist/spec/domain/service/TriggerGraphChecks.js +0 -337
- package/dist/spec/domain/service/TriggerGraphChecks.js.map +0 -1
- package/dist/spec/domain/service/TriggerSpecChecks.d.ts +0 -4
- package/dist/spec/domain/service/TriggerSpecChecks.d.ts.map +0 -1
- package/dist/spec/domain/service/TriggerSpecChecks.js +0 -89
- package/dist/spec/domain/service/TriggerSpecChecks.js.map +0 -1
- package/dist/spec/domain/service/ValidatedAdminUiProjection.d.ts +0 -11
- package/dist/spec/domain/service/ValidatedAdminUiProjection.d.ts.map +0 -1
- package/dist/spec/domain/service/ValidatedAdminUiProjection.js +0 -26
- package/dist/spec/domain/service/ValidatedAdminUiProjection.js.map +0 -1
- package/dist/spec/domain/service/ViewAdminUiChecker.d.ts +0 -14
- package/dist/spec/domain/service/ViewAdminUiChecker.d.ts.map +0 -1
- package/dist/spec/domain/service/ViewAdminUiChecker.js +0 -53
- package/dist/spec/domain/service/ViewAdminUiChecker.js.map +0 -1
- package/dist/spec/domain/service/index.d.ts +0 -24
- package/dist/spec/domain/service/index.d.ts.map +0 -1
- package/dist/spec/domain/service/index.js +0 -24
- package/dist/spec/domain/service/index.js.map +0 -1
- package/dist/spec/index.d.ts +0 -10
- package/dist/spec/index.d.ts.map +0 -1
- package/dist/spec/index.js +0 -12
- package/dist/spec/index.js.map +0 -1
- package/dist/spec/infrastructure/cli/parseArgsError.d.ts +0 -16
- package/dist/spec/infrastructure/cli/parseArgsError.d.ts.map +0 -1
- package/dist/spec/infrastructure/cli/parseArgsError.js +0 -34
- package/dist/spec/infrastructure/cli/parseArgsError.js.map +0 -1
- package/dist/spec/infrastructure/index.d.ts +0 -2
- package/dist/spec/infrastructure/index.d.ts.map +0 -1
- package/dist/spec/infrastructure/index.js +0 -2
- package/dist/spec/infrastructure/index.js.map +0 -1
- package/dist/spec/infrastructure/sql/PgQueryParser.d.ts +0 -18
- package/dist/spec/infrastructure/sql/PgQueryParser.d.ts.map +0 -1
- package/dist/spec/infrastructure/sql/PgQueryParser.js +0 -17
- package/dist/spec/infrastructure/sql/PgQueryParser.js.map +0 -1
- package/dist/spec/infrastructure/sql/compilePlan.d.ts +0 -37
- package/dist/spec/infrastructure/sql/compilePlan.d.ts.map +0 -1
- package/dist/spec/infrastructure/sql/compilePlan.js +0 -282
- package/dist/spec/infrastructure/sql/compilePlan.js.map +0 -1
- package/dist/spec/infrastructure/sql/compileSql.d.ts +0 -35
- package/dist/spec/infrastructure/sql/compileSql.d.ts.map +0 -1
- package/dist/spec/infrastructure/sql/compileSql.js +0 -92
- package/dist/spec/infrastructure/sql/compileSql.js.map +0 -1
- package/dist/spec/infrastructure/sql/frontEnd.d.ts +0 -8
- package/dist/spec/infrastructure/sql/frontEnd.d.ts.map +0 -1
- package/dist/spec/infrastructure/sql/frontEnd.js +0 -100
- package/dist/spec/infrastructure/sql/frontEnd.js.map +0 -1
- package/dist/spec/infrastructure/sql/index.d.ts +0 -4
- package/dist/spec/infrastructure/sql/index.d.ts.map +0 -1
- package/dist/spec/infrastructure/sql/index.js +0 -4
- package/dist/spec/infrastructure/sql/index.js.map +0 -1
- package/dist/spec/kernel/diagnostic.d.ts.map +0 -1
- package/dist/spec/kernel/diagnostic.js +0 -296
- package/dist/spec/kernel/diagnostic.js.map +0 -1
- package/dist/spec/kernel/index.d.ts +0 -8
- package/dist/spec/kernel/index.d.ts.map +0 -1
- package/dist/spec/kernel/index.js +0 -8
- package/dist/spec/kernel/index.js.map +0 -1
- package/dist/spec/usecase/EmitTypes.d.ts +0 -22
- package/dist/spec/usecase/EmitTypes.d.ts.map +0 -1
- package/dist/spec/usecase/EmitTypes.js +0 -182
- package/dist/spec/usecase/EmitTypes.js.map +0 -1
- package/dist/spec/usecase/ValidateManifestsUseCase.d.ts +0 -8
- package/dist/spec/usecase/ValidateManifestsUseCase.d.ts.map +0 -1
- package/dist/spec/usecase/ValidateManifestsUseCase.js +0 -101
- package/dist/spec/usecase/ValidateManifestsUseCase.js.map +0 -1
- package/dist/spec/usecase/dto/ValidateManifestsRequest.d.ts +0 -27
- package/dist/spec/usecase/dto/ValidateManifestsRequest.d.ts.map +0 -1
- package/dist/spec/usecase/dto/ValidateManifestsRequest.js +0 -2
- package/dist/spec/usecase/dto/ValidateManifestsRequest.js.map +0 -1
- package/dist/spec/usecase/dto/ValidateManifestsResponse.d.ts +0 -14
- package/dist/spec/usecase/dto/ValidateManifestsResponse.d.ts.map +0 -1
- package/dist/spec/usecase/dto/ValidateManifestsResponse.js +0 -2
- package/dist/spec/usecase/dto/ValidateManifestsResponse.js.map +0 -1
- package/dist/spec/usecase/dto/index.d.ts +0 -3
- package/dist/spec/usecase/dto/index.d.ts.map +0 -1
- package/dist/spec/usecase/dto/index.js +0 -3
- package/dist/spec/usecase/dto/index.js.map +0 -1
- package/dist/spec/usecase/index.d.ts +0 -10
- package/dist/spec/usecase/index.d.ts.map +0 -1
- package/dist/spec/usecase/index.js +0 -10
- package/dist/spec/usecase/index.js.map +0 -1
- package/dist/testing/cases/before-hook.d.ts +0 -4
- package/dist/testing/cases/before-hook.d.ts.map +0 -1
- package/dist/testing/cases/before-hook.js +0 -71
- package/dist/testing/cases/before-hook.js.map +0 -1
- package/dist/testing/cases/corpus.d.ts +0 -12
- package/dist/testing/cases/corpus.d.ts.map +0 -1
- package/dist/testing/cases/corpus.js +0 -91
- package/dist/testing/cases/corpus.js.map +0 -1
- package/dist/testing/cases/policy.d.ts +0 -74
- package/dist/testing/cases/policy.d.ts.map +0 -1
- package/dist/testing/cases/policy.js +0 -142
- package/dist/testing/cases/policy.js.map +0 -1
- package/dist/testing/cases/printer.d.ts +0 -4
- package/dist/testing/cases/printer.d.ts.map +0 -1
- package/dist/testing/cases/printer.js +0 -32
- package/dist/testing/cases/printer.js.map +0 -1
- package/dist/testing/cases/report-view.d.ts +0 -5
- package/dist/testing/cases/report-view.d.ts.map +0 -1
- package/dist/testing/cases/report-view.js +0 -33
- package/dist/testing/cases/report-view.js.map +0 -1
- package/dist/testing/cases/requisition.d.ts +0 -4
- package/dist/testing/cases/requisition.d.ts.map +0 -1
- package/dist/testing/cases/requisition.js +0 -38
- package/dist/testing/cases/requisition.js.map +0 -1
- package/dist/testing/cases/search-places.d.ts +0 -4
- package/dist/testing/cases/search-places.d.ts.map +0 -1
- package/dist/testing/cases/search-places.js +0 -60
- package/dist/testing/cases/search-places.js.map +0 -1
- package/dist/testing/cases/stock.d.ts +0 -4
- package/dist/testing/cases/stock.d.ts.map +0 -1
- package/dist/testing/cases/stock.js +0 -35
- package/dist/testing/cases/stock.js.map +0 -1
- package/dist/testing/cases/store.d.ts +0 -4
- package/dist/testing/cases/store.d.ts.map +0 -1
- package/dist/testing/cases/store.js +0 -100
- package/dist/testing/cases/store.js.map +0 -1
- package/dist/testing/harness.d.ts +0 -94
- package/dist/testing/harness.d.ts.map +0 -1
- package/dist/testing/harness.js +0 -168
- package/dist/testing/harness.js.map +0 -1
- package/dist/testing/index.d.ts.map +0 -1
- package/dist/testing/index.js.map +0 -1
- package/dist/testing/report.d.ts +0 -15
- package/dist/testing/report.d.ts.map +0 -1
- package/dist/testing/report.js +0 -22
- package/dist/testing/report.js.map +0 -1
- package/dist/web/createRestSurface.d.ts +0 -7
- package/dist/web/createRestSurface.d.ts.map +0 -1
- package/dist/web/createRestSurface.js +0 -39
- package/dist/web/createRestSurface.js.map +0 -1
- package/dist/web/index.d.ts +0 -2
- package/dist/web/index.d.ts.map +0 -1
- package/dist/web/index.js +0 -2
- package/dist/web/index.js.map +0 -1
- package/docs/adr/0001-four-atom-manifest-model.md +0 -440
- package/docs/adr/0002-closed-enums-for-bindings.md +0 -253
- package/docs/adr/0007-ai-as-primary-author.md +0 -473
- package/docs/adr/0008-structured-diagnostic-shape.md +0 -338
- package/docs/adr/0009-consumer-supplied-manifests.md +0 -149
- package/docs/adr/0010-locale-and-translates.md +0 -453
- package/docs/adr/0011-adapter-port-spec.md +0 -281
- package/docs/adr/0012-views-as-public-rest.md +0 -161
- package/docs/adr/0013-agent-provisioned-consumer-projects.md +0 -154
- package/docs/adr/0014-auth-better-auth-and-multi-tenant-mcp.md +0 -919
- package/docs/adr/0016-site-semantic-layer.md +0 -70
- package/docs/adr/0017-media-multi-variant-agent-side-optimization.md +0 -181
- package/docs/adr/0018-core-starters-repository-boundary.md +0 -179
- package/docs/adr/0019-sealed-manifest-runtime-pipeline.md +0 -244
- package/docs/adr/0020-builtin-handler-contracts-and-matched-upsert.md +0 -199
- package/docs/adr/0021-retire-starter-scaffolding.md +0 -30
- package/docs/adr/0022-caller-observed-version-occ.md +0 -212
- package/docs/adr/0023-port-failure-contract.md +0 -69
- package/docs/adr/0024-manifest-native-schema-tables.md +0 -264
- package/docs/adr/0025-reserved-native-columns-and-published-only-public-views.md +0 -105
- package/docs/adr/0026-progressive-generate.md +0 -36
- package/docs/adr/0027-scheduled-procedure-triggers.md +0 -31
- package/docs/adr/0028-schema-ttl-expiry.md +0 -33
- package/docs/adr/0029-mcp-apps-interaction-contracts.md +0 -324
- package/docs/adr/0030-store.md +0 -40
- package/docs/adr/0031-host-cloud-core-contract.md +0 -25
- package/docs/adr/0032-store-centric-core-and-service-contract.md +0 -361
- package/docs/adr/0033-storage-converges-to-the-plan.md +0 -92
- package/docs/adr/0034-store-is-authored-as-sql.md +0 -192
- package/docs/adr/0035-sql-dialects.md +0 -154
- package/docs/adr/0036-host-and-dialect.md +0 -65
- package/docs/adr/0037-postgresql-is-the-reference-dialect.md +0 -124
- package/docs/adr/0038-bun-native-host.md +0 -63
- package/docs/adr/README.md +0 -96
- package/docs/adr/adr-lite-803-request-diagnostics.md +0 -38
- package/docs/adr/adr-lite-808-route-readiness.md +0 -47
- package/docs/adr/adr-lite-809-bounded-public-content.md +0 -71
- package/docs/adr/adr-lite-812-native-parity.md +0 -150
- package/docs/adr/adr-lite-823-home-statistics.md +0 -64
- package/docs/adr/adr-lite-842-mcp-authoring.md +0 -30
- package/docs/adr/adr-lite-845-frontend-client.md +0 -38
- package/docs/adr/adr-lite-861-admin-webmcp.md +0 -48
- package/docs/adr/adr-lite-909-admin-ui-kit.md +0 -37
- package/docs/examples/commerce-inventory.md +0 -481
- package/docs/examples/commerce.md +0 -254
- package/docs/examples/guarded-api.md +0 -238
- package/docs/examples/intake-hooks.md +0 -237
- package/docs/examples/intake.md +0 -127
- package/docs/examples/legal-documents.md +0 -218
- package/docs/examples/procurement.md +0 -215
- package/docs/examples/publication.md +0 -211
- package/docs/examples/reference-service/.mantle/generated/mantle.ts +0 -174
- package/docs/examples/reference-service/.mantle/generated/plan.json +0 -1936
- package/docs/examples/reference-service/README.md +0 -33
- package/docs/examples/reference-service/manifests/catalog.yaml +0 -103
- package/docs/examples/reference-service/manifests/orders.yaml +0 -120
- package/docs/examples/reference-service/mantle.config.json +0 -1
- package/docs/examples/reference-service/package.json +0 -27
- package/docs/examples/reference-service/smoke.mjs +0 -156
- package/docs/examples/reference-service/src/handlers.ts +0 -36
- package/docs/examples/reference-service/src/index.ts +0 -33
- package/docs/examples/reference-service/src/service.ts +0 -78
- package/docs/examples/reference-service/wrangler.jsonc +0 -26
- package/docs/examples/reservation.md +0 -142
- package/docs/skills/develop/mcp-app.md +0 -79
- /package/docs/examples/{reference-service → app-shell}/.dev.vars.example +0 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# Purchasing
|
|
2
|
+
|
|
3
|
+
An internal purchase-request workflow. Any signed-in employee submits a request against a department budget. An admin
|
|
4
|
+
approves or rejects it, in Admin or through an AI agent on the admin MCP endpoint. Approval spends the budget and writes a
|
|
5
|
+
ledger row in one transaction. The app then orders from the supplier's API and waits for the supplier's signed callback
|
|
6
|
+
to mark the request confirmed. Requesters get an email on each decision, and a daily cron emails admins about requests
|
|
7
|
+
that have been waiting too long.
|
|
8
|
+
|
|
9
|
+
## Capabilities shown
|
|
10
|
+
|
|
11
|
+
- **Status workflow with guarded transitions**: the write Procedures use
|
|
12
|
+
`UPDATE requests SET requestStatus = 'approved' ... WHERE id = input.id AND requestStatus = 'submitted'`. A match on
|
|
13
|
+
0 rows is a `CONFLICT` (409). See `manifests/purchasing.yaml` (`approve-request-write`, `reject-request-write`,
|
|
14
|
+
`change-amount`, `mark-ordered`, `confirm-order`). The column is `requestStatus` because `status` is reserved for
|
|
15
|
+
publishing Schemas. `requests` and `ledger` set `readOnly: true`, so Admin's generic editor cannot bypass the state
|
|
16
|
+
machine (for example by moving an ordered request back to `submitted` and approving it again).
|
|
17
|
+
- **A status chosen at submission**: `submit-request` uses `CASE WHEN input.amount <= 100 THEN 'approved' ELSE
|
|
18
|
+
'submitted' END`. A small request also spends the budget and writes its ledger row in the same program, so
|
|
19
|
+
`remaining >= 0` refuses all three when it would overspend. Those two statements find the request by
|
|
20
|
+
`created_at = now()` (the instant of this program) and `NOT EXISTS` a ledger row, so the threshold is written only in
|
|
21
|
+
the `CASE`. Larger requests wait for an admin. An auto-approved request sends no approval email, and the daily cron
|
|
22
|
+
orders it from the supplier (it already retries every `approved` request); route small requests through a `ref`
|
|
23
|
+
handler like `approve-request` if they must be ordered and announced at once.
|
|
24
|
+
- **Admin-only operations**: `approve-request` and `reject-request` declare `requires: ctx.admin` and a `target`, so
|
|
25
|
+
Admin shows them as operations on a request. Their `kind: mcp, surface: admin` Triggers make them
|
|
26
|
+
`approve_request` / `reject_request` tools on `/mcp/admin`. They are not listed on `/mcp`.
|
|
27
|
+
- **Optimistic concurrency**: clients send `expectedVersion`, and the SQL matches `version = input.expectedVersion`.
|
|
28
|
+
If the requester changes the amount (`change-amount`, only their own request and only while it is `submitted`)
|
|
29
|
+
after an admin reviewed it, that admin's approval is a 409. When two admins approve the same version, one succeeds
|
|
30
|
+
and the other gets a 409.
|
|
31
|
+
- **Several writes in one transaction**: `approve-request-write` runs three statements as one program: the status
|
|
32
|
+
change, `UPDATE budgets SET remaining = remaining - ...` and `INSERT INTO ledger`. If the request would overspend,
|
|
33
|
+
`checks: ["remaining >= 0"]` on `budgets` rolls back all three. `src/handlers.ts` turns that failure into a 409.
|
|
34
|
+
- **External API + signed callback**: after the transaction commits, `src/supplier.ts` POSTs the order to
|
|
35
|
+
`env.SUPPLIER_API_URL` (request id as the idempotency key, 10 s timeout) and then sets the request to `ordered`.
|
|
36
|
+
If the supplier cannot be reached, the request stays `approved` and the daily cron retries it as a system caller
|
|
37
|
+
(`mark-ordered` has no `requires` for that reason, and no Trigger).
|
|
38
|
+
`src/routes.ts` serves `POST /callbacks/supplier`. It first checks an HMAC-SHA256 of the timestamp and the **raw**
|
|
39
|
+
body with `env.SUPPLIER_WEBHOOK_SECRET`, and only then parses the JSON. It then calls the generated `confirm-order`
|
|
40
|
+
Procedure as a `system` caller. No Trigger exposes that Procedure. The callback may arrive before `ordered` is
|
|
41
|
+
written, so `approved` is confirmed too. A replay of an applied callback answers 204 again.
|
|
42
|
+
- **Email + cron as app code**: `src/notify.ts` sends through an `EmailSender` from `@aotter/mantle/email`
|
|
43
|
+
(`ConsoleEmailSender` locally). `src/schedule.ts` uses `toCloudflareCron`, and its cron is listed in
|
|
44
|
+
`wrangler.jsonc`. The cron retries failed orders (internal View `approved-requests`) and sends the reminder
|
|
45
|
+
(internal View `stale-requests`) to admins who are not banned.
|
|
46
|
+
- Employees see only their own requests through `my-requests` (`restrict: { requests: "author_id = auth.uid()" }`).
|
|
47
|
+
- **Sidebar for the approver's day**: `src/admin.tsx` declares an Approvals group (`defineAdmin` `nav.groups`) above Admin's built-in
|
|
48
|
+
groups; `pending-requests` and `requests` move into it with `uiSchema.nav: { group, order }`.
|
|
49
|
+
- **A page only signed-in employees reach**: `src/requests-page.ts` serves `GET /requests`. An anonymous visitor gets a
|
|
50
|
+
303 to the shell's `/sign-in?return=/requests` (`src/sign-in.ts`, email code, then back). Signed in, the table reads
|
|
51
|
+
`my-requests` as the visitor's own caller. The form keeps `action="/api/requests" method="post"`; a small script sends
|
|
52
|
+
its fields as JSON to that REST Trigger, so the manifest's validation, `requires` and origin check apply and app code
|
|
53
|
+
never hands request data to a Procedure. Unstyled on purpose. `src/signup.ts` lets only `@EMPLOYEE_DOMAIN` emails
|
|
54
|
+
create an account (`vars` in `wrangler.jsonc`).
|
|
55
|
+
|
|
56
|
+
Search for `AGENT:` to find what a real app must still provide: an email sender, the supplier's real API and signature
|
|
57
|
+
scheme.
|
|
58
|
+
|
|
59
|
+
## Combine with
|
|
60
|
+
|
|
61
|
+
- Need members to own rows, prevent duplicates or cap capacity? Add club-events' `uniqueIndexes` and capacity `checks`.
|
|
62
|
+
- Need public pages, SEO or media for the approved items? Add recipes' publishing lifecycle and visitor pages.
|
|
63
|
+
- Need another approval flow? Copy the pattern: a ref Procedure (admin-only, side effects) that wraps a guarded SQL
|
|
64
|
+
write Procedure (one transaction).
|
|
65
|
+
|
|
66
|
+
## Run it
|
|
67
|
+
|
|
68
|
+
This runs the example by itself, to read and try. For your own app, run `mantle init` and take only the patterns you need into its manifests and `src/` (`mantle help examples`).
|
|
69
|
+
|
|
70
|
+
```sh
|
|
71
|
+
npx mantle init my-app
|
|
72
|
+
cp -R node_modules/@aotter/mantle/docs/examples/purchasing/. my-app/ # run the example as is
|
|
73
|
+
cd my-app && pnpm install && pnpm generate && pnpm types && pnpm check
|
|
74
|
+
cp .dev.vars.example .dev.vars # then set SUPPLIER_API_URL and SUPPLIER_WEBHOOK_SECRET
|
|
75
|
+
pnpm db:init && pnpm db:seed && pnpm dev
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## What `pnpm smoke` proves
|
|
79
|
+
|
|
80
|
+
`smoke.mjs` starts a stand-in supplier API on a local port (which it can switch to 503) and passes its URL and the
|
|
81
|
+
webhook secret through `smoke(scenario, { vars })`. It then checks the following:
|
|
82
|
+
|
|
83
|
+
1. Employees submit requests and see only their own. A department without a budget creates nothing.
|
|
84
|
+
2. An employee gets 403 on the Admin operation. The approve and reject tools exist only on `/mcp/admin`, and the
|
|
85
|
+
internal write Procedures are on neither MCP surface.
|
|
86
|
+
3. Rejecting through the admin MCP tool emails the requester. Approving that request afterwards, with its current
|
|
87
|
+
version, is a 409 because the `requestStatus` guard matches no row.
|
|
88
|
+
4. Approving more than the department has left is a 409. The request stays `submitted`, and the budget and ledger are
|
|
89
|
+
unchanged.
|
|
90
|
+
5. Admin's generic editor cannot change a request. Another employee cannot change its amount (409); the requester can,
|
|
91
|
+
and then approving the version the admin reviewed is a 409 that changes nothing.
|
|
92
|
+
6. Two admins approve the same version at the same time: one gets 200 and the other 409. The budget is deducted and
|
|
93
|
+
the ledger row written once.
|
|
94
|
+
7. Approval places exactly one supplier order, sets `ordered` and emails the requester.
|
|
95
|
+
8. The admin MCP tool approves too. With the supplier down, approvals still commit and stay `approved`.
|
|
96
|
+
9. A callback with a bad signature is a 401 and changes nothing. A correctly signed callback sets `confirmed`, also
|
|
97
|
+
while the request is still `approved`; a replay is 204; a wrong order id or a `submitted` request is 409.
|
|
98
|
+
10. The daily cron places the failed order (`ordered`) and emails every admin about requests pending more than 3
|
|
99
|
+
days, and only about those.
|
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
# Internal purchase requests: employees submit, admins approve or reject, approval spends a department budget.
|
|
2
|
+
# requestStatus: submitted -> approved -> ordered -> confirmed, or submitted -> rejected.
|
|
3
|
+
apiVersion: cms.mantle.aotter.net/v2
|
|
4
|
+
kind: Schema
|
|
5
|
+
metadata: { name: budgets }
|
|
6
|
+
spec:
|
|
7
|
+
title: Budgets
|
|
8
|
+
lifecycle: operational
|
|
9
|
+
uniqueIndexes: [[department]]
|
|
10
|
+
# An approval that would overspend fails this check and the whole approval rolls back.
|
|
11
|
+
checks: ["remaining >= 0"]
|
|
12
|
+
uiSchema: { list: { primaryField: department, columns: [remaining] } }
|
|
13
|
+
schema:
|
|
14
|
+
type: object
|
|
15
|
+
additionalProperties: false
|
|
16
|
+
required: [department, remaining]
|
|
17
|
+
properties:
|
|
18
|
+
department: { type: string }
|
|
19
|
+
remaining: { type: integer }
|
|
20
|
+
---
|
|
21
|
+
apiVersion: cms.mantle.aotter.net/v2
|
|
22
|
+
kind: Schema
|
|
23
|
+
metadata: { name: requests }
|
|
24
|
+
spec:
|
|
25
|
+
title: Purchase requests
|
|
26
|
+
lifecycle: operational
|
|
27
|
+
indexes: [[authorId, createdAt, id], [requestStatus, createdAt, id]]
|
|
28
|
+
# Sidebar: in the Approvals group (src/admin.tsx), after the queue of requests waiting for a decision.
|
|
29
|
+
uiSchema: { list: { primaryField: title, columns: [department, amount, requestStatus], filterField: requestStatus }, nav: { group: approvals, order: 2 } }
|
|
30
|
+
schema:
|
|
31
|
+
type: object
|
|
32
|
+
# Admin reads requests but cannot edit them generically: a generic edit could move requestStatus back to
|
|
33
|
+
# 'submitted' and spend the budget twice. Every change goes through the guarded Procedures below.
|
|
34
|
+
readOnly: true
|
|
35
|
+
additionalProperties: false
|
|
36
|
+
required: [title, amount, department, requestStatus]
|
|
37
|
+
properties:
|
|
38
|
+
title: { type: string, minLength: 1 }
|
|
39
|
+
amount: { type: integer, minimum: 1 }
|
|
40
|
+
department: { type: string }
|
|
41
|
+
requestStatus: { type: string, enum: [submitted, approved, rejected, ordered, confirmed] }
|
|
42
|
+
supplierOrderId: { type: string }
|
|
43
|
+
---
|
|
44
|
+
apiVersion: cms.mantle.aotter.net/v2
|
|
45
|
+
kind: Schema
|
|
46
|
+
metadata: { name: ledger }
|
|
47
|
+
spec:
|
|
48
|
+
title: Budget ledger
|
|
49
|
+
lifecycle: operational
|
|
50
|
+
indexes: [[createdAt, id]]
|
|
51
|
+
# One row per spending request.
|
|
52
|
+
uniqueIndexes: [[requestId]]
|
|
53
|
+
uiSchema: { list: { primaryField: department, columns: [amount, remainingAfter, requestId] } }
|
|
54
|
+
schema:
|
|
55
|
+
type: object
|
|
56
|
+
readOnly: true # written only by approve-request-write and submit-request
|
|
57
|
+
additionalProperties: false
|
|
58
|
+
required: [requestId, department, amount, remainingAfter]
|
|
59
|
+
properties:
|
|
60
|
+
requestId: { type: string }
|
|
61
|
+
department: { type: string }
|
|
62
|
+
amount: { type: integer }
|
|
63
|
+
remainingAfter: { type: integer }
|
|
64
|
+
---
|
|
65
|
+
# Employees see only the requests they submitted.
|
|
66
|
+
apiVersion: cms.mantle.aotter.net/v2
|
|
67
|
+
kind: View
|
|
68
|
+
metadata: { name: my-requests }
|
|
69
|
+
spec:
|
|
70
|
+
surface: public
|
|
71
|
+
requires: { auth: { all: [ctx.user] } }
|
|
72
|
+
restrict: { requests: "author_id = auth.uid()" }
|
|
73
|
+
sql: |
|
|
74
|
+
SELECT id, title, amount, department, requestStatus AS "requestStatus", version
|
|
75
|
+
FROM requests ORDER BY created_at DESC, id DESC
|
|
76
|
+
---
|
|
77
|
+
apiVersion: cms.mantle.aotter.net/v2
|
|
78
|
+
kind: View
|
|
79
|
+
metadata: { name: pending-requests }
|
|
80
|
+
spec:
|
|
81
|
+
title: Pending purchase requests
|
|
82
|
+
surface: admin
|
|
83
|
+
requires: { auth: { all: [ctx.admin] } }
|
|
84
|
+
uiSchema: { nav: { group: approvals, order: 1 } }
|
|
85
|
+
sql: |
|
|
86
|
+
SELECT id, title, amount, department, version
|
|
87
|
+
FROM requests WHERE requestStatus = 'submitted' ORDER BY created_at, id
|
|
88
|
+
---
|
|
89
|
+
# The daily reminder reads this from src/schedule.ts; no route or tool exposes it.
|
|
90
|
+
apiVersion: cms.mantle.aotter.net/v2
|
|
91
|
+
kind: View
|
|
92
|
+
metadata: { name: stale-requests }
|
|
93
|
+
spec:
|
|
94
|
+
surface: internal
|
|
95
|
+
input:
|
|
96
|
+
type: object
|
|
97
|
+
additionalProperties: false
|
|
98
|
+
required: [before]
|
|
99
|
+
properties:
|
|
100
|
+
before: { type: string, format: date-time }
|
|
101
|
+
sql: |
|
|
102
|
+
SELECT id, title, amount, department FROM requests
|
|
103
|
+
WHERE requestStatus = 'submitted' AND created_at < input.before
|
|
104
|
+
ORDER BY created_at, id LIMIT 100
|
|
105
|
+
---
|
|
106
|
+
# Approved but not yet ordered (the supplier call failed): the cron retries these.
|
|
107
|
+
apiVersion: cms.mantle.aotter.net/v2
|
|
108
|
+
kind: View
|
|
109
|
+
metadata: { name: approved-requests }
|
|
110
|
+
spec:
|
|
111
|
+
surface: internal
|
|
112
|
+
sql: |
|
|
113
|
+
SELECT id, title, amount FROM requests WHERE requestStatus = 'approved'
|
|
114
|
+
ORDER BY created_at, id LIMIT 20
|
|
115
|
+
---
|
|
116
|
+
# Selecting from budgets refuses a department that has no budget, so approval always has a budget row to deduct.
|
|
117
|
+
apiVersion: cms.mantle.aotter.net/v2
|
|
118
|
+
kind: Procedure
|
|
119
|
+
metadata: { name: submit-request }
|
|
120
|
+
spec:
|
|
121
|
+
title: Submit a purchase request
|
|
122
|
+
description: Submit a purchase request against an existing department budget; a request of 100 or less is approved at once and spends the budget.
|
|
123
|
+
requires: { auth: { all: [ctx.user] } }
|
|
124
|
+
input:
|
|
125
|
+
type: object
|
|
126
|
+
additionalProperties: false
|
|
127
|
+
required: [title, amount, department]
|
|
128
|
+
properties:
|
|
129
|
+
title: { type: string, minLength: 1 }
|
|
130
|
+
amount: { type: integer, minimum: 1 }
|
|
131
|
+
department: { type: string }
|
|
132
|
+
output: { type: object }
|
|
133
|
+
# One program. CASE picks the status: up to 100 is approved now, more waits for an admin. The budget and ledger
|
|
134
|
+
# statements then act only on "the request this program approved": the caller's, created by this program
|
|
135
|
+
# (created_at = now(), the same instant Mantle writes into created_at), approved, and with no ledger row yet. So the
|
|
136
|
+
# threshold lives only in the CASE, and remaining >= 0 refuses all three statements when a small request would
|
|
137
|
+
# overspend. A pending request matches nothing there, which a set form (IN (SELECT ...), INSERT ... SELECT) allows.
|
|
138
|
+
handler:
|
|
139
|
+
sql: |
|
|
140
|
+
INSERT INTO requests (title, amount, department, requestStatus)
|
|
141
|
+
SELECT input.title, input.amount, b.department, CASE WHEN input.amount <= 100 THEN 'approved' ELSE 'submitted' END
|
|
142
|
+
FROM budgets b WHERE b.department = input.department
|
|
143
|
+
RETURNING id, version, requestStatus AS "requestStatus";
|
|
144
|
+
UPDATE budgets SET remaining = remaining - (SELECT SUM(r.amount) FROM requests r WHERE r.department = budgets.department
|
|
145
|
+
AND r.author_id = auth.uid() AND r.created_at = now() AND r.requestStatus = 'approved'
|
|
146
|
+
AND NOT EXISTS (SELECT 1 FROM ledger l WHERE l.requestId = r.id))
|
|
147
|
+
WHERE department IN (SELECT r.department FROM requests r WHERE r.author_id = auth.uid() AND r.created_at = now()
|
|
148
|
+
AND r.requestStatus = 'approved' AND NOT EXISTS (SELECT 1 FROM ledger l WHERE l.requestId = r.id));
|
|
149
|
+
INSERT INTO ledger (requestId, department, amount, remainingAfter)
|
|
150
|
+
SELECT r.id, r.department, r.amount, b.remaining FROM requests r JOIN budgets b ON b.department = r.department
|
|
151
|
+
WHERE r.author_id = auth.uid() AND r.created_at = now() AND r.requestStatus = 'approved'
|
|
152
|
+
AND NOT EXISTS (SELECT 1 FROM ledger l WHERE l.requestId = r.id)
|
|
153
|
+
---
|
|
154
|
+
# The requester may change the amount while the request is still 'submitted'. The version moves on, so an admin
|
|
155
|
+
# approving the version they reviewed before the change gets a 409 and looks again.
|
|
156
|
+
apiVersion: cms.mantle.aotter.net/v2
|
|
157
|
+
kind: Procedure
|
|
158
|
+
metadata: { name: change-amount }
|
|
159
|
+
spec:
|
|
160
|
+
title: Change the amount of my request
|
|
161
|
+
description: Change the amount of the signed-in member's submitted purchase request.
|
|
162
|
+
requires: { auth: { all: [ctx.user] } }
|
|
163
|
+
restrict: { requests: "author_id = auth.uid()" }
|
|
164
|
+
input:
|
|
165
|
+
type: object
|
|
166
|
+
additionalProperties: false
|
|
167
|
+
required: [id, expectedVersion, amount]
|
|
168
|
+
properties:
|
|
169
|
+
id: { type: string }
|
|
170
|
+
expectedVersion: { type: integer }
|
|
171
|
+
amount: { type: integer, minimum: 1 }
|
|
172
|
+
output: { type: object }
|
|
173
|
+
handler:
|
|
174
|
+
sql: |
|
|
175
|
+
UPDATE requests SET amount = input.amount
|
|
176
|
+
WHERE id = input.id AND version = input.expectedVersion AND requestStatus = 'submitted'
|
|
177
|
+
RETURNING id, version
|
|
178
|
+
---
|
|
179
|
+
# Admin-only. The ref handler runs the write below, then places the supplier order and emails the requester.
|
|
180
|
+
apiVersion: cms.mantle.aotter.net/v2
|
|
181
|
+
kind: Procedure
|
|
182
|
+
metadata: { name: approve-request }
|
|
183
|
+
spec:
|
|
184
|
+
title: Approve a purchase request
|
|
185
|
+
description: Approve a submitted request; deducts the department budget, records a ledger row and places the supplier order.
|
|
186
|
+
requires: { auth: { all: [ctx.admin] } }
|
|
187
|
+
target: { schema: requests, id: id, version: expectedVersion }
|
|
188
|
+
input:
|
|
189
|
+
type: object
|
|
190
|
+
additionalProperties: false
|
|
191
|
+
required: [id, expectedVersion]
|
|
192
|
+
properties:
|
|
193
|
+
id: { type: string }
|
|
194
|
+
expectedVersion: { type: integer }
|
|
195
|
+
output: { type: object }
|
|
196
|
+
handler: { ref: approve-request }
|
|
197
|
+
---
|
|
198
|
+
# One program, one transaction. Statement 1 is the guarded transition: a stale version or a request that is no longer
|
|
199
|
+
# 'submitted' matches 0 rows -> CONFLICT (409). Statement 2 fails remaining >= 0 when over budget. Either failure rolls
|
|
200
|
+
# back all three statements.
|
|
201
|
+
apiVersion: cms.mantle.aotter.net/v2
|
|
202
|
+
kind: Procedure
|
|
203
|
+
metadata: { name: approve-request-write }
|
|
204
|
+
spec:
|
|
205
|
+
requires: { auth: { all: [ctx.admin] } }
|
|
206
|
+
input:
|
|
207
|
+
type: object
|
|
208
|
+
additionalProperties: false
|
|
209
|
+
required: [id, expectedVersion]
|
|
210
|
+
properties:
|
|
211
|
+
id: { type: string }
|
|
212
|
+
expectedVersion: { type: integer }
|
|
213
|
+
output: { type: object }
|
|
214
|
+
handler:
|
|
215
|
+
sql: |
|
|
216
|
+
UPDATE requests SET requestStatus = 'approved'
|
|
217
|
+
WHERE id = input.id AND version = input.expectedVersion AND requestStatus = 'submitted'
|
|
218
|
+
RETURNING id, title, amount, author_id AS "authorId";
|
|
219
|
+
UPDATE budgets SET remaining = remaining - (SELECT r.amount FROM requests r WHERE r.id = input.id)
|
|
220
|
+
WHERE department = (SELECT r.department FROM requests r WHERE r.id = input.id);
|
|
221
|
+
INSERT INTO ledger (requestId, department, amount, remainingAfter)
|
|
222
|
+
SELECT r.id, r.department, r.amount, b.remaining FROM requests r JOIN budgets b ON b.department = r.department
|
|
223
|
+
WHERE r.id = input.id
|
|
224
|
+
---
|
|
225
|
+
apiVersion: cms.mantle.aotter.net/v2
|
|
226
|
+
kind: Procedure
|
|
227
|
+
metadata: { name: reject-request }
|
|
228
|
+
spec:
|
|
229
|
+
title: Reject a purchase request
|
|
230
|
+
requires: { auth: { all: [ctx.admin] } }
|
|
231
|
+
target: { schema: requests, id: id, version: expectedVersion }
|
|
232
|
+
input:
|
|
233
|
+
type: object
|
|
234
|
+
additionalProperties: false
|
|
235
|
+
required: [id, expectedVersion]
|
|
236
|
+
properties:
|
|
237
|
+
id: { type: string }
|
|
238
|
+
expectedVersion: { type: integer }
|
|
239
|
+
output: { type: object }
|
|
240
|
+
handler: { ref: reject-request }
|
|
241
|
+
---
|
|
242
|
+
apiVersion: cms.mantle.aotter.net/v2
|
|
243
|
+
kind: Procedure
|
|
244
|
+
metadata: { name: reject-request-write }
|
|
245
|
+
spec:
|
|
246
|
+
requires: { auth: { all: [ctx.admin] } }
|
|
247
|
+
input:
|
|
248
|
+
type: object
|
|
249
|
+
additionalProperties: false
|
|
250
|
+
required: [id, expectedVersion]
|
|
251
|
+
properties:
|
|
252
|
+
id: { type: string }
|
|
253
|
+
expectedVersion: { type: integer }
|
|
254
|
+
output: { type: object }
|
|
255
|
+
handler:
|
|
256
|
+
sql: |
|
|
257
|
+
UPDATE requests SET requestStatus = 'rejected'
|
|
258
|
+
WHERE id = input.id AND version = input.expectedVersion AND requestStatus = 'submitted'
|
|
259
|
+
RETURNING id, title, author_id AS "authorId"
|
|
260
|
+
---
|
|
261
|
+
# Called after the supplier accepted the order: by the approve handler (admin caller) and by the cron retry (system
|
|
262
|
+
# caller). System callers satisfy no `requires` predicate, so it has none; no Trigger exposes it.
|
|
263
|
+
apiVersion: cms.mantle.aotter.net/v2
|
|
264
|
+
kind: Procedure
|
|
265
|
+
metadata: { name: mark-ordered }
|
|
266
|
+
spec:
|
|
267
|
+
input:
|
|
268
|
+
type: object
|
|
269
|
+
additionalProperties: false
|
|
270
|
+
required: [id, supplierOrderId]
|
|
271
|
+
properties:
|
|
272
|
+
id: { type: string }
|
|
273
|
+
supplierOrderId: { type: string }
|
|
274
|
+
output: { type: object }
|
|
275
|
+
handler:
|
|
276
|
+
sql: |
|
|
277
|
+
UPDATE requests SET requestStatus = 'ordered', supplierOrderId = input.supplierOrderId
|
|
278
|
+
WHERE id = input.id AND requestStatus = 'approved'
|
|
279
|
+
RETURNING id
|
|
280
|
+
---
|
|
281
|
+
# Called only by POST /callbacks/supplier (src/routes.ts) as a system caller after the signature checks out.
|
|
282
|
+
# The callback can arrive before mark-ordered ran, so 'approved' is accepted too.
|
|
283
|
+
# No Trigger exposes it; system callers satisfy no `requires` predicate, so it has none.
|
|
284
|
+
apiVersion: cms.mantle.aotter.net/v2
|
|
285
|
+
kind: Procedure
|
|
286
|
+
metadata: { name: confirm-order }
|
|
287
|
+
spec:
|
|
288
|
+
input:
|
|
289
|
+
type: object
|
|
290
|
+
additionalProperties: false
|
|
291
|
+
required: [id, supplierOrderId]
|
|
292
|
+
properties:
|
|
293
|
+
id: { type: string }
|
|
294
|
+
supplierOrderId: { type: string }
|
|
295
|
+
output: { type: object }
|
|
296
|
+
handler:
|
|
297
|
+
sql: |
|
|
298
|
+
UPDATE requests SET requestStatus = 'confirmed', supplierOrderId = input.supplierOrderId
|
|
299
|
+
WHERE id = input.id AND (
|
|
300
|
+
(requestStatus = 'ordered' AND supplierOrderId = input.supplierOrderId)
|
|
301
|
+
OR requestStatus = 'approved')
|
|
302
|
+
RETURNING id
|
|
303
|
+
---
|
|
304
|
+
apiVersion: cms.mantle.aotter.net/v2
|
|
305
|
+
kind: Trigger
|
|
306
|
+
metadata: { name: submit-request-http }
|
|
307
|
+
spec:
|
|
308
|
+
source: { kind: http, method: POST, path: /api/requests }
|
|
309
|
+
target: { procedure: submit-request }
|
|
310
|
+
---
|
|
311
|
+
apiVersion: cms.mantle.aotter.net/v2
|
|
312
|
+
kind: Trigger
|
|
313
|
+
metadata: { name: submit-request-mcp }
|
|
314
|
+
spec:
|
|
315
|
+
source: { kind: mcp, surface: public }
|
|
316
|
+
target: { procedure: submit-request }
|
|
317
|
+
---
|
|
318
|
+
apiVersion: cms.mantle.aotter.net/v2
|
|
319
|
+
kind: Trigger
|
|
320
|
+
metadata: { name: change-amount-http }
|
|
321
|
+
spec:
|
|
322
|
+
source: { kind: http, method: POST, path: '/api/requests/{id}/amount' }
|
|
323
|
+
target: { procedure: change-amount }
|
|
324
|
+
---
|
|
325
|
+
apiVersion: cms.mantle.aotter.net/v2
|
|
326
|
+
kind: Trigger
|
|
327
|
+
metadata: { name: change-amount-mcp }
|
|
328
|
+
spec:
|
|
329
|
+
source: { kind: mcp, surface: public }
|
|
330
|
+
target: { procedure: change-amount }
|
|
331
|
+
---
|
|
332
|
+
# Admin MCP tools: an AI agent connected to /mcp/admin can approve or reject.
|
|
333
|
+
apiVersion: cms.mantle.aotter.net/v2
|
|
334
|
+
kind: Trigger
|
|
335
|
+
metadata: { name: approve-request-mcp }
|
|
336
|
+
spec:
|
|
337
|
+
source: { kind: mcp, surface: admin }
|
|
338
|
+
target: { procedure: approve-request }
|
|
339
|
+
---
|
|
340
|
+
apiVersion: cms.mantle.aotter.net/v2
|
|
341
|
+
kind: Trigger
|
|
342
|
+
metadata: { name: reject-request-mcp }
|
|
343
|
+
spec:
|
|
344
|
+
source: { kind: mcp, surface: admin }
|
|
345
|
+
target: { procedure: reject-request }
|
|
346
|
+
---
|
|
347
|
+
# Admins open a department's budget from the Budgets list header (operational collections have no generic create);
|
|
348
|
+
# adjusting `remaining` later is an ordinary Admin edit.
|
|
349
|
+
apiVersion: cms.mantle.aotter.net/v2
|
|
350
|
+
kind: Procedure
|
|
351
|
+
metadata: { name: open-budget }
|
|
352
|
+
spec:
|
|
353
|
+
title: Open a budget
|
|
354
|
+
description: Give a department a purchasing budget.
|
|
355
|
+
requires: { auth: { all: [ctx.admin] } }
|
|
356
|
+
uiSchema: { collectionAction: budgets }
|
|
357
|
+
input:
|
|
358
|
+
type: object
|
|
359
|
+
required: [department, remaining]
|
|
360
|
+
additionalProperties: false
|
|
361
|
+
properties:
|
|
362
|
+
department: { type: string, minLength: 1, maxLength: 100, title: Department }
|
|
363
|
+
remaining: { type: integer, minimum: 0, title: Budget }
|
|
364
|
+
output: { type: object }
|
|
365
|
+
handler:
|
|
366
|
+
sql: |
|
|
367
|
+
INSERT INTO budgets (department, remaining) VALUES (input.department, input.remaining) RETURNING id
|
|
368
|
+
---
|
|
369
|
+
apiVersion: cms.mantle.aotter.net/v2
|
|
370
|
+
kind: Trigger
|
|
371
|
+
metadata: { name: open-budget-admin }
|
|
372
|
+
spec:
|
|
373
|
+
source: { kind: mcp, surface: admin }
|
|
374
|
+
target: { procedure: open-budget }
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
-- Department budgets (whole currency units). Admins edit them in Admin > Budgets.
|
|
2
|
+
INSERT INTO budgets (id, created_at, updated_at, department, remaining) VALUES
|
|
3
|
+
('budget-engineering', 1767225600000000, 1767225600000000, 'Engineering', 5000),
|
|
4
|
+
('budget-design', 1767225600000000, 1767225600000000, 'Design', 1000);
|