@toa.io/extensions.exposition 1.0.0-alpha.282 → 1.0.0-alpha.284
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/CHANGELOG.md +56 -0
- package/components/exposition.octets/manifest.toa.yaml +11 -0
- package/components/exposition.octets/types/index.d.ts +3 -0
- package/components/exposition.octets/types/toa.d.ts +41 -0
- package/components/identity.bans/operations/transit.js +1 -1
- package/components/identity.bans/tsconfig.json +1 -1
- package/components/identity.bans/tsconfig.tsbuildinfo +1 -1
- package/components/identity.bans/types/index.d.ts +3 -0
- package/components/identity.bans/types/toa.d.ts +34 -0
- package/components/identity.basic/manifest.toa.yaml +13 -2
- package/components/identity.basic/operations/add.js +1 -1
- package/components/identity.basic/operations/authenticate.js +1 -1
- package/components/identity.basic/operations/check.js +1 -1
- package/components/identity.basic/operations/delete.js +1 -1
- package/components/identity.basic/operations/incept.js +18 -2
- package/components/identity.basic/operations/info.js +1 -1
- package/components/identity.basic/operations/lib/credentials.js +1 -1
- package/components/identity.basic/operations/transit.js +3 -2
- package/components/identity.basic/source/add.ts +3 -3
- package/components/identity.basic/source/authenticate.ts +2 -2
- package/components/identity.basic/source/check.ts +1 -1
- package/components/identity.basic/source/delete.ts +2 -2
- package/components/identity.basic/source/incept.ts +31 -3
- package/components/identity.basic/source/info.ts +1 -1
- package/components/identity.basic/source/transit.ts +6 -4
- package/components/identity.basic/tsconfig.json +1 -1
- package/components/identity.basic/tsconfig.tsbuildinfo +1 -1
- package/components/identity.basic/types/index.d.ts +22 -0
- package/components/identity.basic/types/toa.d.ts +121 -0
- package/components/identity.clients/manifest.toa.yaml +243 -0
- package/components/identity.clients/operations/describe.js +44 -0
- package/components/identity.clients/operations/lib/Context.js +2 -0
- package/components/identity.clients/operations/lib/Entity.js +2 -0
- package/components/identity.clients/operations/lib/canonical.js +24 -0
- package/components/identity.clients/operations/lib/cimd.js +86 -0
- package/components/identity.clients/operations/lib/errors.js +5 -0
- package/components/identity.clients/operations/lib/index.js +7 -0
- package/components/identity.clients/operations/lib/redirect.js +32 -0
- package/components/identity.clients/operations/register.js +84 -0
- package/components/identity.clients/source/describe.ts +65 -0
- package/components/identity.clients/source/lib/Context.ts +38 -0
- package/components/identity.clients/source/lib/Entity.ts +31 -0
- package/components/identity.clients/source/lib/canonical.test.ts +43 -0
- package/components/identity.clients/source/lib/canonical.ts +27 -0
- package/components/identity.clients/source/lib/cimd.test.ts +120 -0
- package/components/identity.clients/source/lib/cimd.ts +107 -0
- package/components/identity.clients/source/lib/errors.ts +4 -0
- package/components/identity.clients/source/lib/index.ts +6 -0
- package/components/identity.clients/source/lib/redirect.test.ts +41 -0
- package/components/identity.clients/source/lib/redirect.ts +35 -0
- package/components/identity.clients/source/register.ts +125 -0
- package/components/identity.clients/tsconfig.json +10 -0
- package/components/identity.clients/tsconfig.tsbuildinfo +1 -0
- package/components/identity.clients/types/index.d.ts +3 -0
- package/components/identity.clients/types/toa.d.ts +109 -0
- package/components/identity.credentials/operations/list.js +1 -1
- package/components/identity.credentials/source/list.ts +2 -1
- package/components/identity.credentials/tsconfig.json +4 -2
- package/components/identity.credentials/tsconfig.tsbuildinfo +1 -1
- package/components/identity.credentials/types/index.d.ts +3 -0
- package/components/identity.credentials/types/toa.d.ts +30 -0
- package/components/identity.federation/manifest.toa.yaml +37 -1
- package/components/identity.federation/operations/authenticate.js +7 -3
- package/components/identity.federation/operations/create.js +1 -1
- package/components/identity.federation/operations/decode.js +1 -1
- package/components/identity.federation/operations/delete.js +1 -1
- package/components/identity.federation/operations/incept.js +6 -2
- package/components/identity.federation/operations/lib/Configuration.js +1 -1
- package/components/identity.federation/operations/lib/Ctx.js +1 -1
- package/components/identity.federation/operations/lib/Payload.js +1 -1
- package/components/identity.federation/operations/lib/decode.js +23 -9
- package/components/identity.federation/operations/lib/discovery.js +1 -1
- package/components/identity.federation/operations/lib/errors.js +5 -1
- package/components/identity.federation/operations/lib/exchange.js +12 -7
- package/components/identity.federation/operations/lib/index.js +2 -1
- package/components/identity.federation/operations/lib/jose.js +1 -1
- package/components/identity.federation/operations/lib/principal.js +14 -0
- package/components/identity.federation/operations/lib/resolve.js +1 -1
- package/components/identity.federation/operations/list.js +1 -1
- package/components/identity.federation/operations/types/Scheme.js +1 -1
- package/components/identity.federation/operations/types/configuration.js +1 -1
- package/components/identity.federation/operations/types/context.js +1 -1
- package/components/identity.federation/operations/types/entity.js +1 -1
- package/components/identity.federation/operations/types/index.js +1 -1
- package/components/identity.federation/source/authenticate.ts +9 -3
- package/components/identity.federation/source/incept.ts +7 -1
- package/components/identity.federation/source/lib/Ctx.ts +2 -2
- package/components/identity.federation/source/lib/decode.ts +25 -9
- package/components/identity.federation/source/lib/errors.ts +5 -0
- package/components/identity.federation/source/lib/exchange.ts +11 -7
- package/components/identity.federation/source/lib/index.ts +1 -0
- package/components/identity.federation/source/lib/principal.ts +17 -0
- package/components/identity.federation/source/types/configuration.ts +1 -1
- package/components/identity.federation/source/types/context.ts +6 -2
- package/components/identity.federation/tsconfig.json +4 -2
- package/components/identity.federation/tsconfig.tsbuildinfo +1 -1
- package/components/identity.federation/types/index.d.ts +3 -0
- package/components/identity.federation/types/toa.d.ts +127 -0
- package/components/identity.grants/manifest.toa.yaml +245 -0
- package/components/identity.grants/operations/authorize.js +54 -0
- package/components/identity.grants/operations/exchange.js +89 -0
- package/components/identity.grants/operations/lib/code.js +30 -0
- package/components/identity.grants/operations/lib/identify.js +15 -0
- package/components/identity.grants/operations/lib/index.js +3 -0
- package/components/identity.grants/operations/list.js +18 -0
- package/components/identity.grants/operations/revoke.js +25 -0
- package/components/identity.grants/source/authorize.ts +90 -0
- package/components/identity.grants/source/exchange.ts +130 -0
- package/components/identity.grants/source/lib/code.ts +39 -0
- package/components/identity.grants/source/lib/identify.ts +16 -0
- package/components/identity.grants/source/lib/index.ts +3 -0
- package/components/identity.grants/source/list.ts +28 -0
- package/components/identity.grants/source/revoke.ts +38 -0
- package/components/identity.grants/tsconfig.json +10 -0
- package/components/identity.grants/tsconfig.tsbuildinfo +1 -0
- package/components/identity.grants/types/index.d.ts +60 -0
- package/components/identity.grants/types/toa.d.ts +108 -0
- package/components/identity.keys/manifest.toa.yaml +1 -0
- package/components/identity.keys/operations/create.js +1 -1
- package/components/identity.keys/operations/disable.js +1 -1
- package/components/identity.keys/operations/revoke.js +1 -1
- package/components/identity.keys/source/create.ts +1 -1
- package/components/identity.keys/source/revoke.ts +1 -1
- package/components/identity.keys/tsconfig.json +1 -1
- package/components/identity.keys/tsconfig.tsbuildinfo +1 -1
- package/components/identity.keys/types/index.d.ts +3 -0
- package/components/identity.keys/types/toa.d.ts +47 -0
- package/components/identity.otp/operations/authenticate.js +1 -1
- package/components/identity.otp/operations/issue.js +1 -1
- package/components/identity.otp/operations/lib/Context.js +1 -1
- package/components/identity.otp/operations/lib/Entity.js +1 -1
- package/components/identity.otp/operations/lib/index.js +1 -1
- package/components/identity.otp/source/lib/Context.ts +4 -2
- package/components/identity.otp/tsconfig.json +1 -1
- package/components/identity.otp/tsconfig.tsbuildinfo +1 -1
- package/components/identity.otp/types/index.d.ts +3 -0
- package/components/identity.otp/types/toa.d.ts +56 -0
- package/components/identity.passkeys/manifest.toa.yaml +3 -0
- package/components/identity.passkeys/operations/authenticate.js +1 -1
- package/components/identity.passkeys/operations/challenge.js +1 -1
- package/components/identity.passkeys/operations/create.js +1 -1
- package/components/identity.passkeys/operations/delete.js +1 -1
- package/components/identity.passkeys/operations/lib/const.js +1 -1
- package/components/identity.passkeys/operations/list.js +1 -1
- package/components/identity.passkeys/operations/types/Configuration.js +1 -1
- package/components/identity.passkeys/operations/types/Context.js +1 -1
- package/components/identity.passkeys/operations/types/Passkey.js +1 -1
- package/components/identity.passkeys/operations/types/index.js +1 -1
- package/components/identity.passkeys/operations/use.js +1 -1
- package/components/identity.passkeys/source/authenticate.ts +1 -1
- package/components/identity.passkeys/source/challenge.ts +1 -1
- package/components/identity.passkeys/source/create.ts +1 -1
- package/components/identity.passkeys/source/types/Context.ts +2 -1
- package/components/identity.passkeys/source/use.ts +1 -1
- package/components/identity.passkeys/tsconfig.json +1 -1
- package/components/identity.passkeys/tsconfig.tsbuildinfo +1 -1
- package/components/identity.passkeys/types/index.d.ts +3 -0
- package/components/identity.passkeys/types/toa.d.ts +120 -0
- package/components/identity.roles/operations/grant.js +1 -1
- package/components/identity.roles/operations/lib/Entity.js +1 -1
- package/components/identity.roles/operations/list.js +1 -1
- package/components/identity.roles/operations/principal.js +29 -5
- package/components/identity.roles/source/principal.ts +33 -5
- package/components/identity.roles/tsconfig.json +1 -1
- package/components/identity.roles/tsconfig.tsbuildinfo +1 -1
- package/components/identity.roles/types/index.d.ts +3 -0
- package/components/identity.roles/types/toa.d.ts +43 -0
- package/components/identity.tokens/manifest.toa.yaml +34 -3
- package/components/identity.tokens/operations/authenticate.js +9 -1
- package/components/identity.tokens/operations/decrypt.js +3 -3
- package/components/identity.tokens/operations/encrypt.js +1 -1
- package/components/identity.tokens/operations/issue.js +3 -2
- package/components/identity.tokens/operations/lib/form.js +24 -0
- package/components/identity.tokens/operations/lib/index.js +2 -2
- package/components/identity.tokens/operations/lib/jose.js +1 -1
- package/components/identity.tokens/operations/lib/key.js +1 -1
- package/components/identity.tokens/operations/lib/pad.js +1 -1
- package/components/identity.tokens/operations/revoke.js +1 -1
- package/components/identity.tokens/source/authenticate.test.ts +8 -5
- package/components/identity.tokens/source/authenticate.ts +12 -1
- package/components/identity.tokens/source/decrypt.test.ts +1 -1
- package/components/identity.tokens/source/decrypt.ts +4 -3
- package/components/identity.tokens/source/encrypt.test.ts +1 -1
- package/components/identity.tokens/source/encrypt.ts +2 -1
- package/components/identity.tokens/source/issue.test.ts +71 -0
- package/components/identity.tokens/source/issue.ts +4 -2
- package/components/identity.tokens/source/lib/form.test.ts +25 -0
- package/components/identity.tokens/source/lib/form.ts +31 -0
- package/components/identity.tokens/source/lib/index.ts +2 -1
- package/components/identity.tokens/tsconfig.json +1 -1
- package/components/identity.tokens/tsconfig.tsbuildinfo +1 -1
- package/components/identity.tokens/types/index.d.ts +61 -0
- package/components/identity.tokens/types/toa.d.ts +113 -0
- package/documentation/access.md +13 -0
- package/documentation/cache.md +10 -1
- package/documentation/components.md +3 -0
- package/documentation/consent.md +101 -0
- package/documentation/identity.md +3 -1
- package/documentation/introspection.md +13 -5
- package/documentation/io.md +42 -2
- package/documentation/map.md +8 -0
- package/documentation/mcp.md +180 -0
- package/documentation/oauth.md +180 -0
- package/documentation/protocol.md +4 -0
- package/documentation/rpc.md +140 -0
- package/documentation/tree.md +3 -0
- package/features/auth.bearer.feature +120 -0
- package/features/cache.feature +46 -0
- package/features/identity.basic.feature +44 -0
- package/features/identity.federation.feature +2 -5
- package/features/introspection.feature +333 -0
- package/features/mcp.feature +687 -0
- package/features/oauth.clients.feature +195 -0
- package/features/oauth.discovery.feature +164 -0
- package/features/oauth.grants.feature +299 -0
- package/features/octets.cloudinary.feature +1 -0
- package/features/rpc.feature +429 -0
- package/features/steps/Cloudinary.ts +13 -0
- package/features/steps/Components.ts +0 -4
- package/features/steps/Gateway.ts +23 -2
- package/features/steps/Parameters.ts +22 -7
- package/features/steps/Realtime.ts +3 -0
- package/features/steps/components/echo/manifest.toa.yaml +3 -0
- package/features/steps/components/octets.tester/manifest.toa.yaml +2 -0
- package/features/steps/components/octets.tester/operations/redirect.js +6 -1
- package/features/steps/components/pots/manifest.toa.yaml +2 -0
- package/features/steps/components/users/manifest.toa.yaml +1 -0
- package/package.json +8 -6
- package/readme.md +6 -0
- package/schemas/annotation.cos.yaml +63 -0
- package/schemas/call.cos.yaml +18 -0
- package/source/Annotation.ts +54 -0
- package/source/Directive.test.ts +15 -15
- package/source/Directive.ts +77 -9
- package/source/Endpoint.test.ts +67 -0
- package/source/Endpoint.ts +31 -11
- package/source/Factory.ts +6 -2
- package/source/Gateway.ts +73 -11
- package/source/HTTP/Context.ts +7 -0
- package/source/HTTP/Server.ts +15 -5
- package/source/HTTP/exceptions.ts +2 -2
- package/source/HTTP/formats/form.ts +21 -0
- package/source/HTTP/formats/index.ts +17 -2
- package/source/HTTP/messages.test.ts +25 -1
- package/source/HTTP/messages.ts +20 -4
- package/source/Interception.ts +8 -2
- package/source/Introspection.ts +102 -0
- package/source/MCP/Server.ts +275 -0
- package/source/MCP/discover.ts +52 -0
- package/source/MCP/errors.ts +81 -0
- package/source/MCP/index.ts +1 -0
- package/source/MCP/schema.test.ts +85 -0
- package/source/MCP/schema.ts +87 -0
- package/source/MCP/tools.ts +156 -0
- package/source/MCP/types.ts +81 -0
- package/source/Query.ts +48 -8
- package/source/RPC/Context.ts +78 -0
- package/source/RPC/Dispatcher.ts +130 -0
- package/source/RPC/errors.test.ts +52 -0
- package/source/RPC/errors.ts +83 -0
- package/source/RPC/index.ts +1 -0
- package/source/RPC/names.test.ts +122 -0
- package/source/RPC/names.ts +182 -0
- package/source/RPC/types.ts +34 -0
- package/source/RTD/Directives.ts +52 -2
- package/source/RTD/Endpoint.ts +2 -1
- package/source/RTD/Method.ts +14 -11
- package/source/RTD/Node.ts +38 -7
- package/source/RTD/Route.ts +30 -3
- package/source/RTD/Tree.ts +37 -1
- package/source/RTD/expiration.test.ts +1 -1
- package/source/RTD/walk.test.ts +110 -0
- package/source/const.ts +15 -0
- package/source/deployment.ts +11 -1
- package/source/directives/auth/Anonymous.test.ts +38 -0
- package/source/directives/auth/Anonymous.ts +12 -0
- package/source/directives/auth/Anyone.ts +4 -0
- package/source/directives/auth/Authorization.ts +108 -22
- package/source/directives/auth/Delegate.test.ts +36 -0
- package/source/directives/auth/Delegate.ts +14 -0
- package/source/directives/auth/Echo.ts +5 -0
- package/source/directives/auth/Incept.ts +16 -10
- package/source/directives/auth/Role.ts +13 -0
- package/source/directives/auth/Rule.ts +29 -0
- package/source/directives/auth/Scheme.ts +5 -0
- package/source/directives/auth/schemes.test.ts +8 -4
- package/source/directives/auth/schemes.ts +22 -9
- package/source/directives/auth/types.ts +26 -2
- package/source/directives/cache/Cache.ts +14 -5
- package/source/directives/cache/Control.ts +0 -3
- package/source/directives/dev/Development.ts +1 -1
- package/source/directives/flow/Fetch.ts +1 -1
- package/source/directives/flow/Flow.ts +1 -1
- package/source/directives/index.ts +5 -2
- package/source/directives/io/Directive.ts +1 -1
- package/source/directives/io/IO.ts +34 -3
- package/source/directives/io/Input.ts +3 -2
- package/source/directives/io/Output.ts +10 -4
- package/source/directives/io/Status.test.ts +84 -0
- package/source/directives/io/Status.ts +46 -0
- package/source/directives/io/Throttle.ts +1 -1
- package/source/directives/io/lib/throttle/Quotas.ts +2 -2
- package/source/directives/map/Headers.ts +11 -0
- package/source/directives/map/Map.ts +10 -1
- package/source/directives/map/Mapping.ts +23 -0
- package/source/directives/map/Segments.ts +12 -0
- package/source/directives/mcp/MCP.ts +33 -0
- package/source/directives/mcp/Tool.test.ts +66 -0
- package/source/directives/mcp/Tool.ts +28 -0
- package/source/directives/mcp/index.ts +6 -0
- package/source/directives/oauth/Discovery.ts +70 -0
- package/source/directives/oauth/documents.ts +113 -0
- package/source/directives/oauth/index.ts +3 -0
- package/source/directives/octets/Delete.ts +1 -1
- package/source/directives/octets/Get.ts +1 -1
- package/source/directives/octets/Octets.ts +1 -1
- package/source/directives/octets/Workflow.ts +1 -1
- package/source/directives/octets/workflows/Execution.ts +1 -1
- package/source/directives/require/Directive.ts +1 -1
- package/source/directives/require/Headers.ts +1 -1
- package/source/directives/require/Require.ts +2 -2
- package/source/index.ts +6 -0
- package/source/octets.d.ts +17 -0
- package/source/schemas.ts +2 -0
- package/source/userland.ts +47 -0
- package/transpiled/Annotation.d.ts +41 -0
- package/transpiled/Directive.d.ts +18 -1
- package/transpiled/Directive.js +50 -6
- package/transpiled/Directive.js.map +1 -1
- package/transpiled/Endpoint.d.ts +9 -0
- package/transpiled/Endpoint.js +27 -11
- package/transpiled/Endpoint.js.map +1 -1
- package/transpiled/Factory.js +6 -2
- package/transpiled/Factory.js.map +1 -1
- package/transpiled/Gateway.d.ts +19 -2
- package/transpiled/Gateway.js +51 -9
- package/transpiled/Gateway.js.map +1 -1
- package/transpiled/HTTP/Context.d.ts +6 -0
- package/transpiled/HTTP/Context.js +6 -0
- package/transpiled/HTTP/Context.js.map +1 -1
- package/transpiled/HTTP/Server.d.ts +8 -1
- package/transpiled/HTTP/Server.js +4 -3
- package/transpiled/HTTP/Server.js.map +1 -1
- package/transpiled/HTTP/exceptions.d.ts +1 -1
- package/transpiled/HTTP/exceptions.js +2 -2
- package/transpiled/HTTP/exceptions.js.map +1 -1
- package/transpiled/HTTP/formats/form.d.ts +9 -0
- package/transpiled/HTTP/formats/form.js +18 -0
- package/transpiled/HTTP/formats/form.js.map +1 -0
- package/transpiled/HTTP/formats/index.d.ts +10 -2
- package/transpiled/HTTP/formats/index.js +10 -0
- package/transpiled/HTTP/formats/index.js.map +1 -1
- package/transpiled/HTTP/messages.d.ts +12 -0
- package/transpiled/HTTP/messages.js +12 -4
- package/transpiled/HTTP/messages.js.map +1 -1
- package/transpiled/Interception.d.ts +4 -1
- package/transpiled/Interception.js +4 -2
- package/transpiled/Interception.js.map +1 -1
- package/transpiled/Introspection.d.ts +40 -0
- package/transpiled/Introspection.js +50 -1
- package/transpiled/Introspection.js.map +1 -1
- package/transpiled/MCP/Server.d.ts +41 -0
- package/transpiled/MCP/Server.js +180 -0
- package/transpiled/MCP/Server.js.map +1 -0
- package/transpiled/MCP/discover.d.ts +13 -0
- package/transpiled/MCP/discover.js +29 -0
- package/transpiled/MCP/discover.js.map +1 -0
- package/transpiled/MCP/errors.d.ts +24 -0
- package/transpiled/MCP/errors.js +67 -0
- package/transpiled/MCP/errors.js.map +1 -0
- package/transpiled/MCP/index.d.ts +1 -0
- package/transpiled/MCP/index.js +2 -0
- package/transpiled/MCP/index.js.map +1 -0
- package/transpiled/MCP/schema.d.ts +18 -0
- package/transpiled/MCP/schema.js +64 -0
- package/transpiled/MCP/schema.js.map +1 -0
- package/transpiled/MCP/tools.d.ts +31 -0
- package/transpiled/MCP/tools.js +121 -0
- package/transpiled/MCP/tools.js.map +1 -0
- package/transpiled/MCP/types.d.ts +64 -0
- package/transpiled/MCP/types.js +13 -0
- package/transpiled/MCP/types.js.map +1 -0
- package/transpiled/Query.d.ts +7 -0
- package/transpiled/Query.js +38 -7
- package/transpiled/Query.js.map +1 -1
- package/transpiled/RPC/Context.d.ts +11 -0
- package/transpiled/RPC/Context.js +63 -0
- package/transpiled/RPC/Context.js.map +1 -0
- package/transpiled/RPC/Dispatcher.d.ts +19 -0
- package/transpiled/RPC/Dispatcher.js +100 -0
- package/transpiled/RPC/Dispatcher.js.map +1 -0
- package/transpiled/RPC/errors.d.ts +18 -0
- package/transpiled/RPC/errors.js +67 -0
- package/transpiled/RPC/errors.js.map +1 -0
- package/transpiled/RPC/index.d.ts +1 -0
- package/transpiled/RPC/index.js +2 -0
- package/transpiled/RPC/index.js.map +1 -0
- package/transpiled/RPC/names.d.ts +30 -0
- package/transpiled/RPC/names.js +121 -0
- package/transpiled/RPC/names.js.map +1 -0
- package/transpiled/RPC/types.d.ts +27 -0
- package/transpiled/RPC/types.js +8 -0
- package/transpiled/RPC/types.js.map +1 -0
- package/transpiled/RTD/Directives.d.ts +41 -2
- package/transpiled/RTD/Endpoint.d.ts +2 -1
- package/transpiled/RTD/Method.d.ts +8 -3
- package/transpiled/RTD/Method.js +12 -10
- package/transpiled/RTD/Method.js.map +1 -1
- package/transpiled/RTD/Node.d.ts +20 -2
- package/transpiled/RTD/Node.js +22 -4
- package/transpiled/RTD/Node.js.map +1 -1
- package/transpiled/RTD/Route.d.ts +2 -1
- package/transpiled/RTD/Route.js +27 -2
- package/transpiled/RTD/Route.js.map +1 -1
- package/transpiled/RTD/Tree.d.ts +3 -1
- package/transpiled/RTD/Tree.js +26 -0
- package/transpiled/RTD/Tree.js.map +1 -1
- package/transpiled/const.d.ts +12 -0
- package/transpiled/const.js +12 -0
- package/transpiled/const.js.map +1 -1
- package/transpiled/deployment.js +6 -0
- package/transpiled/deployment.js.map +1 -1
- package/transpiled/directives/auth/Anonymous.d.ts +6 -0
- package/transpiled/directives/auth/Anonymous.js +10 -0
- package/transpiled/directives/auth/Anonymous.js.map +1 -1
- package/transpiled/directives/auth/Anyone.d.ts +1 -0
- package/transpiled/directives/auth/Anyone.js +3 -0
- package/transpiled/directives/auth/Anyone.js.map +1 -1
- package/transpiled/directives/auth/Authorization.d.ts +28 -2
- package/transpiled/directives/auth/Authorization.js +87 -19
- package/transpiled/directives/auth/Authorization.js.map +1 -1
- package/transpiled/directives/auth/Delegate.d.ts +5 -0
- package/transpiled/directives/auth/Delegate.js +10 -0
- package/transpiled/directives/auth/Delegate.js.map +1 -1
- package/transpiled/directives/auth/Echo.d.ts +2 -0
- package/transpiled/directives/auth/Echo.js +4 -0
- package/transpiled/directives/auth/Echo.js.map +1 -1
- package/transpiled/directives/auth/Incept.d.ts +1 -1
- package/transpiled/directives/auth/Incept.js +13 -8
- package/transpiled/directives/auth/Incept.js.map +1 -1
- package/transpiled/directives/auth/Role.d.ts +2 -0
- package/transpiled/directives/auth/Role.js +9 -0
- package/transpiled/directives/auth/Role.js.map +1 -1
- package/transpiled/directives/auth/Rule.d.ts +5 -0
- package/transpiled/directives/auth/Rule.js +20 -0
- package/transpiled/directives/auth/Rule.js.map +1 -1
- package/transpiled/directives/auth/Scheme.d.ts +2 -0
- package/transpiled/directives/auth/Scheme.js +4 -0
- package/transpiled/directives/auth/Scheme.js.map +1 -1
- package/transpiled/directives/auth/schemes.d.ts +16 -4
- package/transpiled/directives/auth/schemes.js +20 -8
- package/transpiled/directives/auth/schemes.js.map +1 -1
- package/transpiled/directives/auth/types.d.ts +20 -2
- package/transpiled/directives/cache/Cache.d.ts +1 -1
- package/transpiled/directives/cache/Cache.js +10 -3
- package/transpiled/directives/cache/Cache.js.map +1 -1
- package/transpiled/directives/cache/Control.js +0 -2
- package/transpiled/directives/cache/Control.js.map +1 -1
- package/transpiled/directives/dev/Development.d.ts +1 -1
- package/transpiled/directives/dev/Development.js +1 -1
- package/transpiled/directives/dev/Development.js.map +1 -1
- package/transpiled/directives/flow/Flow.d.ts +1 -1
- package/transpiled/directives/flow/Flow.js +1 -1
- package/transpiled/directives/flow/Flow.js.map +1 -1
- package/transpiled/directives/index.js +4 -2
- package/transpiled/directives/index.js.map +1 -1
- package/transpiled/directives/io/Directive.d.ts +1 -1
- package/transpiled/directives/io/IO.d.ts +7 -1
- package/transpiled/directives/io/IO.js +25 -3
- package/transpiled/directives/io/IO.js.map +1 -1
- package/transpiled/directives/io/Input.d.ts +3 -2
- package/transpiled/directives/io/Input.js +2 -1
- package/transpiled/directives/io/Input.js.map +1 -1
- package/transpiled/directives/io/Output.d.ts +5 -3
- package/transpiled/directives/io/Output.js +8 -3
- package/transpiled/directives/io/Output.js.map +1 -1
- package/transpiled/directives/io/Status.d.ts +19 -0
- package/transpiled/directives/io/Status.js +34 -0
- package/transpiled/directives/io/Status.js.map +1 -0
- package/transpiled/directives/io/Throttle.d.ts +1 -1
- package/transpiled/directives/io/Throttle.js +1 -1
- package/transpiled/directives/io/Throttle.js.map +1 -1
- package/transpiled/directives/io/lib/throttle/Quotas.d.ts +1 -1
- package/transpiled/directives/io/lib/throttle/Quotas.js +2 -2
- package/transpiled/directives/io/lib/throttle/Quotas.js.map +1 -1
- package/transpiled/directives/map/Headers.d.ts +2 -0
- package/transpiled/directives/map/Headers.js +8 -0
- package/transpiled/directives/map/Headers.js.map +1 -1
- package/transpiled/directives/map/Map.d.ts +3 -1
- package/transpiled/directives/map/Map.js +7 -1
- package/transpiled/directives/map/Map.js.map +1 -1
- package/transpiled/directives/map/Mapping.d.ts +13 -0
- package/transpiled/directives/map/Mapping.js +20 -0
- package/transpiled/directives/map/Mapping.js.map +1 -1
- package/transpiled/directives/map/Segments.d.ts +3 -0
- package/transpiled/directives/map/Segments.js +9 -0
- package/transpiled/directives/map/Segments.js.map +1 -1
- package/transpiled/directives/mcp/MCP.d.ts +15 -0
- package/transpiled/directives/mcp/MCP.js +23 -0
- package/transpiled/directives/mcp/MCP.js.map +1 -0
- package/transpiled/directives/mcp/Tool.d.ts +13 -0
- package/transpiled/directives/mcp/Tool.js +23 -0
- package/transpiled/directives/mcp/Tool.js.map +1 -0
- package/transpiled/directives/mcp/index.d.ts +4 -0
- package/transpiled/directives/mcp/index.js +4 -0
- package/transpiled/directives/mcp/index.js.map +1 -0
- package/transpiled/directives/oauth/Discovery.d.ts +23 -0
- package/transpiled/directives/oauth/Discovery.js +55 -0
- package/transpiled/directives/oauth/Discovery.js.map +1 -0
- package/transpiled/directives/oauth/documents.d.ts +9 -0
- package/transpiled/directives/oauth/documents.js +82 -0
- package/transpiled/directives/oauth/documents.js.map +1 -0
- package/transpiled/directives/oauth/index.d.ts +2 -0
- package/transpiled/directives/oauth/index.js +3 -0
- package/transpiled/directives/oauth/index.js.map +1 -0
- package/transpiled/directives/octets/Octets.d.ts +1 -1
- package/transpiled/directives/octets/Octets.js +1 -1
- package/transpiled/directives/octets/Octets.js.map +1 -1
- package/transpiled/directives/require/Directive.d.ts +1 -1
- package/transpiled/directives/require/Headers.d.ts +1 -1
- package/transpiled/directives/require/Headers.js +1 -1
- package/transpiled/directives/require/Headers.js.map +1 -1
- package/transpiled/directives/require/Require.d.ts +1 -1
- package/transpiled/directives/require/Require.js +2 -2
- package/transpiled/directives/require/Require.js.map +1 -1
- package/transpiled/index.d.ts +2 -0
- package/transpiled/schemas.d.ts +2 -0
- package/transpiled/schemas.js +1 -0
- package/transpiled/schemas.js.map +1 -1
- package/transpiled/userland.d.ts +39 -0
- package/transpiled/userland.js +7 -0
- package/transpiled/userland.js.map +1 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/components/identity.bans/operations/transit.d.ts +0 -14
- package/components/identity.bans/operations/transit.js.map +0 -1
- package/components/identity.basic/operations/add.d.ts +0 -3
- package/components/identity.basic/operations/add.js.map +0 -1
- package/components/identity.basic/operations/authenticate.d.ts +0 -13
- package/components/identity.basic/operations/authenticate.js.map +0 -1
- package/components/identity.basic/operations/check.d.ts +0 -7
- package/components/identity.basic/operations/check.js.map +0 -1
- package/components/identity.basic/operations/delete.d.ts +0 -7
- package/components/identity.basic/operations/delete.js.map +0 -1
- package/components/identity.basic/operations/incept.d.ts +0 -12
- package/components/identity.basic/operations/incept.js.map +0 -1
- package/components/identity.basic/operations/info.d.ts +0 -10
- package/components/identity.basic/operations/info.js.map +0 -1
- package/components/identity.basic/operations/lib/credentials.d.ts +0 -5
- package/components/identity.basic/operations/lib/credentials.js.map +0 -1
- package/components/identity.basic/operations/transit.d.ts +0 -14
- package/components/identity.basic/operations/transit.js.map +0 -1
- package/components/identity.basic/operations/types.d.ts +0 -61
- package/components/identity.basic/operations/types.js +0 -2
- package/components/identity.basic/operations/types.js.map +0 -1
- package/components/identity.basic/source/types.ts +0 -69
- package/components/identity.credentials/operations/list.d.ts +0 -51
- package/components/identity.credentials/operations/list.js.map +0 -1
- package/components/identity.federation/operations/authenticate.d.ts +0 -16
- package/components/identity.federation/operations/authenticate.js.map +0 -1
- package/components/identity.federation/operations/create.d.ts +0 -8
- package/components/identity.federation/operations/create.js.map +0 -1
- package/components/identity.federation/operations/decode.d.ts +0 -3
- package/components/identity.federation/operations/decode.js.map +0 -1
- package/components/identity.federation/operations/delete.d.ts +0 -8
- package/components/identity.federation/operations/delete.js.map +0 -1
- package/components/identity.federation/operations/incept.d.ts +0 -11
- package/components/identity.federation/operations/incept.js.map +0 -1
- package/components/identity.federation/operations/lib/Configuration.d.ts +0 -39
- package/components/identity.federation/operations/lib/Configuration.js.map +0 -1
- package/components/identity.federation/operations/lib/Ctx.d.ts +0 -8
- package/components/identity.federation/operations/lib/Ctx.js.map +0 -1
- package/components/identity.federation/operations/lib/Payload.d.ts +0 -5
- package/components/identity.federation/operations/lib/Payload.js.map +0 -1
- package/components/identity.federation/operations/lib/decode.d.ts +0 -3
- package/components/identity.federation/operations/lib/decode.js.map +0 -1
- package/components/identity.federation/operations/lib/discovery.d.ts +0 -5
- package/components/identity.federation/operations/lib/discovery.js.map +0 -1
- package/components/identity.federation/operations/lib/errors.d.ts +0 -70
- package/components/identity.federation/operations/lib/errors.js.map +0 -1
- package/components/identity.federation/operations/lib/exchange.d.ts +0 -3
- package/components/identity.federation/operations/lib/exchange.js.map +0 -1
- package/components/identity.federation/operations/lib/index.d.ts +0 -4
- package/components/identity.federation/operations/lib/index.js.map +0 -1
- package/components/identity.federation/operations/lib/jose.d.ts +0 -1
- package/components/identity.federation/operations/lib/jose.js.map +0 -1
- package/components/identity.federation/operations/lib/resolve.d.ts +0 -3
- package/components/identity.federation/operations/lib/resolve.js.map +0 -1
- package/components/identity.federation/operations/list.d.ts +0 -7
- package/components/identity.federation/operations/list.js.map +0 -1
- package/components/identity.federation/operations/types/Scheme.d.ts +0 -1
- package/components/identity.federation/operations/types/Scheme.js.map +0 -1
- package/components/identity.federation/operations/types/configuration.d.ts +0 -22
- package/components/identity.federation/operations/types/configuration.js.map +0 -1
- package/components/identity.federation/operations/types/context.d.ts +0 -35
- package/components/identity.federation/operations/types/context.js.map +0 -1
- package/components/identity.federation/operations/types/entity.d.ts +0 -9
- package/components/identity.federation/operations/types/entity.js.map +0 -1
- package/components/identity.federation/operations/types/index.d.ts +0 -4
- package/components/identity.federation/operations/types/index.js.map +0 -1
- package/components/identity.keys/operations/create.d.ts +0 -22
- package/components/identity.keys/operations/create.js.map +0 -1
- package/components/identity.keys/operations/disable.d.ts +0 -5
- package/components/identity.keys/operations/disable.js.map +0 -1
- package/components/identity.keys/operations/revoke.d.ts +0 -15
- package/components/identity.keys/operations/revoke.js.map +0 -1
- package/components/identity.otp/operations/authenticate.d.ts +0 -12
- package/components/identity.otp/operations/authenticate.js.map +0 -1
- package/components/identity.otp/operations/issue.d.ts +0 -12
- package/components/identity.otp/operations/issue.js.map +0 -1
- package/components/identity.otp/operations/lib/Context.d.ts +0 -14
- package/components/identity.otp/operations/lib/Context.js.map +0 -1
- package/components/identity.otp/operations/lib/Entity.d.ts +0 -6
- package/components/identity.otp/operations/lib/Entity.js.map +0 -1
- package/components/identity.otp/operations/lib/index.d.ts +0 -1
- package/components/identity.otp/operations/lib/index.js.map +0 -1
- package/components/identity.passkeys/operations/authenticate.d.ts +0 -16
- package/components/identity.passkeys/operations/authenticate.js.map +0 -1
- package/components/identity.passkeys/operations/challenge.d.ts +0 -35
- package/components/identity.passkeys/operations/challenge.js.map +0 -1
- package/components/identity.passkeys/operations/create.d.ts +0 -19
- package/components/identity.passkeys/operations/create.js.map +0 -1
- package/components/identity.passkeys/operations/delete.d.ts +0 -8
- package/components/identity.passkeys/operations/delete.js.map +0 -1
- package/components/identity.passkeys/operations/lib/const.d.ts +0 -1
- package/components/identity.passkeys/operations/lib/const.js.map +0 -1
- package/components/identity.passkeys/operations/list.d.ts +0 -7
- package/components/identity.passkeys/operations/list.js.map +0 -1
- package/components/identity.passkeys/operations/types/Configuration.d.ts +0 -6
- package/components/identity.passkeys/operations/types/Configuration.js.map +0 -1
- package/components/identity.passkeys/operations/types/Context.d.ts +0 -15
- package/components/identity.passkeys/operations/types/Context.js.map +0 -1
- package/components/identity.passkeys/operations/types/Passkey.d.ts +0 -12
- package/components/identity.passkeys/operations/types/Passkey.js.map +0 -1
- package/components/identity.passkeys/operations/types/index.d.ts +0 -2
- package/components/identity.passkeys/operations/types/index.js.map +0 -1
- package/components/identity.passkeys/operations/use.d.ts +0 -16
- package/components/identity.passkeys/operations/use.js.map +0 -1
- package/components/identity.roles/operations/grant.d.ts +0 -10
- package/components/identity.roles/operations/grant.js.map +0 -1
- package/components/identity.roles/operations/lib/Entity.d.ts +0 -5
- package/components/identity.roles/operations/lib/Entity.js.map +0 -1
- package/components/identity.roles/operations/list.d.ts +0 -2
- package/components/identity.roles/operations/list.js.map +0 -1
- package/components/identity.roles/operations/principal.d.ts +0 -13
- package/components/identity.roles/operations/principal.js.map +0 -1
- package/components/identity.tokens/operations/authenticate.d.ts +0 -9
- package/components/identity.tokens/operations/authenticate.js.map +0 -1
- package/components/identity.tokens/operations/decrypt.d.ts +0 -15
- package/components/identity.tokens/operations/decrypt.js.map +0 -1
- package/components/identity.tokens/operations/encrypt.d.ts +0 -8
- package/components/identity.tokens/operations/encrypt.js.map +0 -1
- package/components/identity.tokens/operations/issue.d.ts +0 -24
- package/components/identity.tokens/operations/issue.js.map +0 -1
- package/components/identity.tokens/operations/lib/index.d.ts +0 -3
- package/components/identity.tokens/operations/lib/index.js.map +0 -1
- package/components/identity.tokens/operations/lib/jose.d.ts +0 -1
- package/components/identity.tokens/operations/lib/jose.js.map +0 -1
- package/components/identity.tokens/operations/lib/key.d.ts +0 -1
- package/components/identity.tokens/operations/lib/key.js.map +0 -1
- package/components/identity.tokens/operations/lib/pad.d.ts +0 -1
- package/components/identity.tokens/operations/lib/pad.js.map +0 -1
- package/components/identity.tokens/operations/lib/types.d.ts +0 -88
- package/components/identity.tokens/operations/lib/types.js +0 -2
- package/components/identity.tokens/operations/lib/types.js.map +0 -1
- package/components/identity.tokens/operations/revoke.d.ts +0 -2
- package/components/identity.tokens/operations/revoke.js.map +0 -1
- package/components/identity.tokens/source/lib/types.ts +0 -102
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import assert from 'node:assert'
|
|
2
|
+
import { describe, it } from 'node:test'
|
|
3
|
+
import { Tool } from './Tool.js'
|
|
4
|
+
import { MCP } from './MCP.js'
|
|
5
|
+
|
|
6
|
+
describe('mcp:tool', () => {
|
|
7
|
+
it('should take what the route states the tool is', () => {
|
|
8
|
+
assert.strictEqual(new Tool('The pots that are hot.', '/pots/hot').description,
|
|
9
|
+
'The pots that are hot.')
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
it('should not accept an empty description', () => {
|
|
13
|
+
assert.throws(() => new Tool(' ', '/pots'), /cannot be empty/)
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
it('should not accept a value that is not one', () => {
|
|
17
|
+
// `true` published a tool that stated nothing, back when an operation stated it instead
|
|
18
|
+
assert.throws(() => new Tool(true, '/pots'), /the value is what the tool is/)
|
|
19
|
+
assert.throws(() => new Tool(false, '/pots'), /the value is what the tool is/)
|
|
20
|
+
assert.throws(() => new Tool(1, '/pots'), /the value is what the tool is/)
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
it('should refuse a route no name can spell', () => {
|
|
24
|
+
assert.throws(() => new Tool('A pot.', '/pots/a.b'), /no tool name can spell/)
|
|
25
|
+
assert.throws(() => new Tool('A pot.', '/pots/:a.b'), /no tool name can spell/)
|
|
26
|
+
|
|
27
|
+
// an underscore is what the convention keeps for itself
|
|
28
|
+
assert.throws(() => new Tool('A pot.', '/pots/a_b'), /no tool name can spell/)
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
it('should name the route it refuses', () => {
|
|
32
|
+
assert.throws(() => new Tool('A pot.', '/pots/a.b'), /'\/pots\/a\.b'/)
|
|
33
|
+
})
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
describe('mcp:tool inheritance', () => {
|
|
37
|
+
const family = new MCP()
|
|
38
|
+
|
|
39
|
+
it('should take the nearest declaration', () => {
|
|
40
|
+
const own = new Tool('Nearest.', '/pots')
|
|
41
|
+
const inherited = new Tool('Furthest.', '/pots')
|
|
42
|
+
|
|
43
|
+
assert.strictEqual(MCP.published([own, inherited])?.description, 'Nearest.')
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
it('should publish nothing where nothing is declared', () => {
|
|
47
|
+
assert.strictEqual(MCP.published(undefined), null)
|
|
48
|
+
assert.strictEqual(MCP.published([]), null)
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
it('should describe a method with what the route states', () => {
|
|
52
|
+
const described = family.explain([new Tool('What the route is.', '/pots')], null as never,
|
|
53
|
+
{ description: 'What the operation is.' })
|
|
54
|
+
|
|
55
|
+
assert.strictEqual(described.description, 'What the route is.')
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
it('should state nothing where nothing is declared', () => {
|
|
59
|
+
assert.strictEqual(family.explain([], null as never, {}).description, undefined)
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
it('should refuse a directive it does not know', () => {
|
|
63
|
+
assert.throws(() => family.create('resource', 'A pot.', null, '/pots'),
|
|
64
|
+
/Unknown directive: mcp:resource/)
|
|
65
|
+
})
|
|
66
|
+
})
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import assert from 'node:assert'
|
|
2
|
+
import { refusal } from '../../RPC/names.js'
|
|
3
|
+
import { segment } from '../../RTD/segment.js'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* What one method is, published to a model. Declaring it is what publishes it, and what it
|
|
7
|
+
* says is what it says it is: a tool a model cannot read the purpose of is one it cannot
|
|
8
|
+
* choose, so there is no way to publish one that states nothing.
|
|
9
|
+
*
|
|
10
|
+
* The operation states what it is too, and that is not this. An operation is written without
|
|
11
|
+
* knowledge of any route, and a tool is an operation and a route together — the same
|
|
12
|
+
* operation mounted twice is two tools, and one sentence cannot be true of both.
|
|
13
|
+
*/
|
|
14
|
+
export class Tool {
|
|
15
|
+
public readonly description: string
|
|
16
|
+
|
|
17
|
+
public constructor (value: unknown, route: string) {
|
|
18
|
+
assert.ok(typeof value === 'string' && value.trim().length > 0,
|
|
19
|
+
'Directive mcp:tool: the value is what the tool is, which cannot be empty')
|
|
20
|
+
|
|
21
|
+
// a tool is called by name, so a route that cannot be named cannot be one — said where
|
|
22
|
+
// the mistake is, rather than as a tool that is quietly never listed
|
|
23
|
+
assert.ok(refusal(segment(route)) === null,
|
|
24
|
+
`Directive mcp:tool: '${route}' holds a segment no tool name can spell`)
|
|
25
|
+
|
|
26
|
+
this.description = value
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { documents, type Documents } from './documents.js'
|
|
2
|
+
import type * as http from '../../HTTP/index.js'
|
|
3
|
+
import type { Input, Output } from '../../io.js'
|
|
4
|
+
import type { Interceptor } from '../../Interception.js'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* What a client reads before it can authenticate: where the authorization server is, and
|
|
8
|
+
* what this resource expects. Both are fixed paths a specification names, both must be
|
|
9
|
+
* answered to anyone, and both are a function of the annotation alone — nothing is read to
|
|
10
|
+
* build them, so they are built once per authority and served as they are.
|
|
11
|
+
*
|
|
12
|
+
* An interceptor rather than a route because `auth` runs before any directive: a client
|
|
13
|
+
* re-reading discovery while holding a stale token would have it verified, and then be
|
|
14
|
+
* refused a document that has to be public.
|
|
15
|
+
*/
|
|
16
|
+
export class Discovery implements Interceptor {
|
|
17
|
+
/**
|
|
18
|
+
* A map, because the key is the request's authority and an unconfigured host is passed
|
|
19
|
+
* through as itself: `Host: constructor` names something a plain object answers on its own.
|
|
20
|
+
*/
|
|
21
|
+
private readonly authorities = new Map<string, Documents>()
|
|
22
|
+
|
|
23
|
+
public mount (options: http.Options): void {
|
|
24
|
+
this.authorities.clear()
|
|
25
|
+
|
|
26
|
+
if (options.oauth === undefined)
|
|
27
|
+
return
|
|
28
|
+
|
|
29
|
+
/*
|
|
30
|
+
* `https` always: RFC 8414 has an issuer be one, and OAuth 2.1 has every endpoint of an
|
|
31
|
+
* authorization server be one — the loopback exception is a client's redirect URI, not
|
|
32
|
+
* a server's address. A gateway served without TLS has no authorization server a client
|
|
33
|
+
* may use, and naming it `http` would hide that behind documents none should accept.
|
|
34
|
+
*
|
|
35
|
+
* The host is the configured one, not the request's, which is the client's to write: a
|
|
36
|
+
* forged one would have these documents name someone else's token endpoint.
|
|
37
|
+
*/
|
|
38
|
+
for (const [authority, host] of Object.entries(options.authorities))
|
|
39
|
+
this.authorities.set(authority, documents(`https://${host}`, options.oauth))
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
public reset (): void {
|
|
43
|
+
this.authorities.clear()
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
public intercept (input: Input): Output {
|
|
47
|
+
const known = this.authorities.get(input.authority)
|
|
48
|
+
|
|
49
|
+
if (known === undefined)
|
|
50
|
+
return null
|
|
51
|
+
|
|
52
|
+
// every reply, not just a document's: the challenge is what points a client here
|
|
53
|
+
input.pipelines.response.push((response) => {
|
|
54
|
+
if (response.status !== UNAUTHORIZED)
|
|
55
|
+
return
|
|
56
|
+
|
|
57
|
+
response.headers ??= new Headers()
|
|
58
|
+
response.headers.set('www-authenticate', known.challenge(input.url.pathname))
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
const body = known.read(input.url.pathname)
|
|
62
|
+
|
|
63
|
+
if (body === undefined)
|
|
64
|
+
return null
|
|
65
|
+
|
|
66
|
+
return { body, headers: new Headers({ 'cache-control': 'public, max-age=3600' }) }
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const UNAUTHORIZED = 401
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import type { OAuth } from '../../Annotation.js'
|
|
2
|
+
|
|
3
|
+
/** The discovery documents of one authority, and the challenge that points at them. */
|
|
4
|
+
export interface Documents {
|
|
5
|
+
/** The document a path names, or nothing when it names none. */
|
|
6
|
+
read: (pathname: string) => object | undefined
|
|
7
|
+
|
|
8
|
+
/** `WWW-Authenticate` for a request to this path, which names the resource it failed at. */
|
|
9
|
+
challenge: (pathname: string) => string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function documents (issuer: string, oauth: OAuth): Documents {
|
|
13
|
+
const server = authorizationServer(issuer, oauth)
|
|
14
|
+
const resources = protectedResources(issuer, oauth)
|
|
15
|
+
const scope = oauth.scopes === undefined ? '' : `, scope="${oauth.scopes.join(' ')}"`
|
|
16
|
+
|
|
17
|
+
function read (pathname: string): object | undefined {
|
|
18
|
+
if (pathname === AUTHORIZATION_SERVER || pathname === OPENID_CONFIGURATION)
|
|
19
|
+
return server
|
|
20
|
+
|
|
21
|
+
if (pathname.startsWith(PROTECTED_RESOURCE))
|
|
22
|
+
return resources.get(pathname.slice(PROTECTED_RESOURCE.length))
|
|
23
|
+
|
|
24
|
+
return undefined
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function challenge (pathname: string): string {
|
|
28
|
+
return `Bearer resource_metadata="${issuer}${PROTECTED_RESOURCE}${suffix(oauth, pathname)}"${scope}`
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return { read, challenge }
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* RFC 8414. `authorization_endpoint` is the application's own page and may be anywhere;
|
|
36
|
+
* everything else this extension serves. Both flags are load-bearing for a client that
|
|
37
|
+
* prefers Client ID Metadata Documents: without either it falls back to registration.
|
|
38
|
+
*/
|
|
39
|
+
function authorizationServer (issuer: string, oauth: OAuth): object {
|
|
40
|
+
const metadata: Record<string, unknown> = {
|
|
41
|
+
issuer,
|
|
42
|
+
authorization_endpoint: oauth.authorize,
|
|
43
|
+
token_endpoint: `${issuer}${TOKEN}`,
|
|
44
|
+
response_types_supported: ['code'],
|
|
45
|
+
grant_types_supported: ['authorization_code'],
|
|
46
|
+
code_challenge_methods_supported: ['S256'],
|
|
47
|
+
token_endpoint_auth_methods_supported: ['none'],
|
|
48
|
+
client_id_metadata_document_supported: true,
|
|
49
|
+
authorization_response_iss_parameter_supported: true
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (oauth.registration === 'open')
|
|
53
|
+
metadata.registration_endpoint = `${issuer}${REGISTRATION}`
|
|
54
|
+
|
|
55
|
+
if (oauth.scopes !== undefined)
|
|
56
|
+
metadata.scopes_supported = oauth.scopes
|
|
57
|
+
|
|
58
|
+
return metadata
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* RFC 9728, keyed by the path the well-known segment is followed by: a client resolving
|
|
63
|
+
* `https://host/mcp` reads `/.well-known/oauth-protected-resource/mcp`, and one that names
|
|
64
|
+
* no path reads the document at the origin.
|
|
65
|
+
*/
|
|
66
|
+
function protectedResources (issuer: string, oauth: OAuth): Map<string, object> {
|
|
67
|
+
const map = new Map<string, object>()
|
|
68
|
+
|
|
69
|
+
for (const path of oauth.resources ?? [])
|
|
70
|
+
map.set(canonical(path), resource(issuer, canonical(path), oauth))
|
|
71
|
+
|
|
72
|
+
map.set('', resource(issuer, '', oauth))
|
|
73
|
+
|
|
74
|
+
return map
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function resource (issuer: string, path: string, oauth: OAuth): object {
|
|
78
|
+
const metadata: Record<string, unknown> = {
|
|
79
|
+
resource: issuer + path,
|
|
80
|
+
authorization_servers: [issuer],
|
|
81
|
+
bearer_methods_supported: ['header']
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (oauth.scopes !== undefined)
|
|
85
|
+
metadata.scopes_supported = oauth.scopes
|
|
86
|
+
|
|
87
|
+
return metadata
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** The document a request to this path was refused against: the longest resource holding it. */
|
|
91
|
+
function suffix (oauth: OAuth, pathname: string): string {
|
|
92
|
+
let longest = ''
|
|
93
|
+
|
|
94
|
+
for (const path of oauth.resources ?? [])
|
|
95
|
+
if (pathname.startsWith(path) && path.length > longest.length)
|
|
96
|
+
longest = path
|
|
97
|
+
|
|
98
|
+
return canonical(longest)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* A resource is identified without its trailing slash — the form MCP asks for — while a
|
|
103
|
+
* route is declared with one, so `/mcp/` identifies `…/mcp`.
|
|
104
|
+
*/
|
|
105
|
+
function canonical (path: string): string {
|
|
106
|
+
return path.endsWith('/') ? path.slice(0, -1) : path
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const AUTHORIZATION_SERVER = '/.well-known/oauth-authorization-server'
|
|
110
|
+
const PROTECTED_RESOURCE = '/.well-known/oauth-protected-resource'
|
|
111
|
+
const OPENID_CONFIGURATION = '/.well-known/openid-configuration'
|
|
112
|
+
const TOKEN = '/identity/grants/'
|
|
113
|
+
const REGISTRATION = '/identity/clients/'
|
|
@@ -5,7 +5,7 @@ import { Workflow } from './workflows/index.js'
|
|
|
5
5
|
import { Directive } from './Directive.js'
|
|
6
6
|
import type { Parameter } from '../../RTD/index.js'
|
|
7
7
|
import type { Unit, Location } from './workflows/index.js'
|
|
8
|
-
import type { Maybe } from '@toa.io/
|
|
8
|
+
import type { Maybe } from '@toa.io/core'
|
|
9
9
|
import type { Component } from '@toa.io/core'
|
|
10
10
|
import type { Output } from '../../io.js'
|
|
11
11
|
import type { Input } from './types.js'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Forbidden, NotFound } from '../../HTTP/index.js'
|
|
2
2
|
import * as schemas from './schemas.js'
|
|
3
3
|
import { Directive } from './Directive.js'
|
|
4
|
-
import type { Maybe } from '@toa.io/
|
|
4
|
+
import type { Maybe } from '@toa.io/core'
|
|
5
5
|
import type { Entry, Stream } from '@toa.io/extensions.storages'
|
|
6
6
|
import type { Component } from '@toa.io/core'
|
|
7
7
|
import type { Output } from '../../io.js'
|
|
@@ -28,7 +28,7 @@ export class Octets implements DirectiveFamily<Directive> {
|
|
|
28
28
|
return new Class(value, this.discovery, remotes)
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
public async
|
|
31
|
+
public async precall (directives: Directive[], input: Input, parameters: Parameter[]): Promise<Output> {
|
|
32
32
|
let context: Context | null = null
|
|
33
33
|
let action: Directive | null = null
|
|
34
34
|
|
|
@@ -7,7 +7,7 @@ import type { Input } from './types.js'
|
|
|
7
7
|
import type { Component } from '@toa.io/core'
|
|
8
8
|
import type { Output } from '../../io.js'
|
|
9
9
|
import type { Remotes } from '../../Remotes.js'
|
|
10
|
-
import type { Maybe } from '@toa.io/
|
|
10
|
+
import type { Maybe } from '@toa.io/core'
|
|
11
11
|
import type { Entry } from '@toa.io/extensions.storages'
|
|
12
12
|
import type { Parameter } from '../../RTD/index.js'
|
|
13
13
|
|
|
@@ -3,7 +3,7 @@ import { console } from 'openspan'
|
|
|
3
3
|
import type { Unit } from './Workflow.js'
|
|
4
4
|
import type { Remotes } from '../../../Remotes.js'
|
|
5
5
|
import type { Component } from '@toa.io/core'
|
|
6
|
-
import type { Maybe } from '@toa.io/
|
|
6
|
+
import type { Maybe } from '@toa.io/core'
|
|
7
7
|
import type { Entry } from '@toa.io/extensions.storages'
|
|
8
8
|
|
|
9
9
|
export class Execution extends Readable {
|
|
@@ -12,7 +12,7 @@ export class Headers implements Directive {
|
|
|
12
12
|
this.headers = headers
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
public
|
|
15
|
+
public precall (context: Input): void {
|
|
16
16
|
for (const header of this.headers)
|
|
17
17
|
if (context.request.headers[header] === undefined)
|
|
18
18
|
throw new BadRequest(`Header required: ${header}`)
|
|
@@ -14,9 +14,9 @@ export class Require implements DirectiveFamily {
|
|
|
14
14
|
return new directives[name](value)
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
public
|
|
17
|
+
public precall (instances: Directive[], context: Input): null {
|
|
18
18
|
for (const instance of instances)
|
|
19
|
-
instance.
|
|
19
|
+
instance.precall(context)
|
|
20
20
|
|
|
21
21
|
return null
|
|
22
22
|
}
|
package/source/index.ts
CHANGED
|
@@ -4,3 +4,9 @@ export { components } from './Composition.js'
|
|
|
4
4
|
export { Factory } from './Factory.js'
|
|
5
5
|
|
|
6
6
|
export type { Remotes } from './Remotes.js'
|
|
7
|
+
|
|
8
|
+
// what an operation is written against, rather than the gateway's own
|
|
9
|
+
export type { Claims, Identity } from './userland.js'
|
|
10
|
+
|
|
11
|
+
// what an octets workflow is given
|
|
12
|
+
export type * as octets from './octets.js'
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface WorkflowInput<
|
|
2
|
+
TParameters extends Record<string, string> = Record<string, string>,
|
|
3
|
+
TSteps extends Record<string, unknown> = Record<string, unknown>,
|
|
4
|
+
> {
|
|
5
|
+
authority: string
|
|
6
|
+
identity?: string
|
|
7
|
+
storage: string
|
|
8
|
+
path: string
|
|
9
|
+
entry: {
|
|
10
|
+
id: string
|
|
11
|
+
type: string
|
|
12
|
+
size: number
|
|
13
|
+
meta: Record<string, unknown>
|
|
14
|
+
}
|
|
15
|
+
parameters: TParameters
|
|
16
|
+
steps: TSteps
|
|
17
|
+
}
|
package/source/schemas.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { resolve } from 'node:path'
|
|
|
2
2
|
import * as schemas from '@toa.io/schemas'
|
|
3
3
|
import type { Query } from './HTTP/index.js'
|
|
4
4
|
import type { Node } from './RTD/index.js'
|
|
5
|
+
import type { Call } from './RPC/types.js'
|
|
5
6
|
import type { Schema } from '@toa.io/schemas'
|
|
6
7
|
import type { Annotation } from './Annotation.js'
|
|
7
8
|
|
|
@@ -11,3 +12,4 @@ const namespace = schemas.namespace(path)
|
|
|
11
12
|
export const querystring: Schema<Query> = namespace.schema('querystring')
|
|
12
13
|
export const annotation: Schema<Annotation> = namespace.schema('annotation')
|
|
13
14
|
export const node: Schema<Node> = namespace.schema('node')
|
|
15
|
+
export const call: Schema<Call> = namespace.schema('call')
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What Exposition puts into an operation's input, for the operation to be written against.
|
|
3
|
+
*
|
|
4
|
+
* The gateway's own types are its business; these are the application's.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The identity behind the call, as `auth:delegate` embeds it:
|
|
9
|
+
*
|
|
10
|
+
* ```yaml
|
|
11
|
+
* /echo:
|
|
12
|
+
* GET:
|
|
13
|
+
* auth:assert: true
|
|
14
|
+
* auth:delegate: identity
|
|
15
|
+
* endpoint: echo
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* ```javascript
|
|
19
|
+
* export async function computation ({ identity }, context) { }
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export interface Identity {
|
|
23
|
+
readonly id: string
|
|
24
|
+
|
|
25
|
+
/** What the identity holds. Delegation resolves them, so they are always here. */
|
|
26
|
+
roles: string[]
|
|
27
|
+
|
|
28
|
+
permissions?: Record<string, string[]>
|
|
29
|
+
|
|
30
|
+
/** How the identity was authenticated; `null` for a transient one. */
|
|
31
|
+
scheme: string | null
|
|
32
|
+
|
|
33
|
+
/** Whether the credentials presented are due to be exchanged. */
|
|
34
|
+
refresh: boolean
|
|
35
|
+
|
|
36
|
+
/** The token's claims, where the identity was federated. */
|
|
37
|
+
claims?: Claims
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** A federated token's payload: what it must carry, and whatever else the issuer put there. */
|
|
41
|
+
export interface Claims {
|
|
42
|
+
iss: string
|
|
43
|
+
sub: string
|
|
44
|
+
aud?: string | string[]
|
|
45
|
+
|
|
46
|
+
[claim: string]: unknown
|
|
47
|
+
}
|
|
@@ -19,8 +19,49 @@ export interface Annotation {
|
|
|
19
19
|
ip?: string;
|
|
20
20
|
/** Failed authentications an address may make; none are metered unless set. See `identity.md`. */
|
|
21
21
|
bouncer?: Bouncer;
|
|
22
|
+
/** The authorization server this context exposes; none is exposed without it. */
|
|
23
|
+
oauth?: OAuth;
|
|
24
|
+
/** JSON-RPC at `/.rpc`; none is served without it. See `documentation/rpc.md`. */
|
|
25
|
+
rpc?: RPC;
|
|
26
|
+
/** MCP at `/.mcp`; none is served without it. See `documentation/mcp.md`. */
|
|
27
|
+
mcp?: MCP;
|
|
22
28
|
'/'?: object;
|
|
23
29
|
}
|
|
30
|
+
export interface OAuth {
|
|
31
|
+
/**
|
|
32
|
+
* Where a client sends the user to consent. The one endpoint of the flow that needs a
|
|
33
|
+
* person, and so the one this extension does not serve: an application builds it.
|
|
34
|
+
*/
|
|
35
|
+
authorize: string;
|
|
36
|
+
/** Paths a token may be restricted to, each advertised as a protected resource. */
|
|
37
|
+
resources?: string[];
|
|
38
|
+
/** What a client may ask for. Each is a role, or a scope within one. */
|
|
39
|
+
scopes?: string[];
|
|
40
|
+
/** Origins whose Client ID Metadata Documents may be read. None are without it. */
|
|
41
|
+
trust?: string[];
|
|
42
|
+
/** Dynamic Client Registration, off unless opened. */
|
|
43
|
+
registration?: 'open' | 'closed';
|
|
44
|
+
}
|
|
45
|
+
export interface RPC {
|
|
46
|
+
/**
|
|
47
|
+
* Calls one request may carry, 32 by default. One request is one authentication and one
|
|
48
|
+
* reply however many calls it makes, so what a caller may ask for at once is bounded.
|
|
49
|
+
*/
|
|
50
|
+
batch?: number;
|
|
51
|
+
}
|
|
52
|
+
export interface MCP {
|
|
53
|
+
/** What the server calls itself, which a client shows a user. */
|
|
54
|
+
name: string;
|
|
55
|
+
/** What a model is told before it calls anything here. */
|
|
56
|
+
instructions?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Browser origins the endpoint answers, which the revision requires against DNS rebinding.
|
|
59
|
+
* None are admitted without it; a request carrying no `Origin` is not a browser's.
|
|
60
|
+
*/
|
|
61
|
+
origins?: string[];
|
|
62
|
+
/** Whether the endpoint answers without a credential. It does not unless it says so. */
|
|
63
|
+
anonymous?: boolean;
|
|
64
|
+
}
|
|
24
65
|
export interface Bouncer {
|
|
25
66
|
/** what an address may fail at once, 20 by default */
|
|
26
67
|
attempts?: number;
|
|
@@ -2,13 +2,21 @@ import type { Context, OutgoingMessage, Options } from './HTTP/index.js';
|
|
|
2
2
|
import type { Remotes } from './Remotes.js';
|
|
3
3
|
import type { Host } from './Factory.js';
|
|
4
4
|
import type { Output } from './io.js';
|
|
5
|
+
import type { Introspection } from './Introspection.js';
|
|
5
6
|
import type * as RTD from './RTD/index.js';
|
|
6
7
|
export declare class Directives implements RTD.Directives {
|
|
7
8
|
private readonly sets;
|
|
8
9
|
/** the span of a stage depends only on the set, so it is built once per route */
|
|
9
10
|
private readonly spans;
|
|
10
11
|
constructor(sets: RTD.DirectiveSet[]);
|
|
11
|
-
|
|
12
|
+
declared<T>(family: string): T[] | undefined;
|
|
13
|
+
precall(context: Context, parameters: RTD.Parameter[]): Promise<Output>;
|
|
14
|
+
/**
|
|
15
|
+
* What the method says about itself, as its directives leave it. Each family is given
|
|
16
|
+
* what the one before it returned, and the first to refuse ends it: a method this caller
|
|
17
|
+
* cannot reach is not described at all.
|
|
18
|
+
*/
|
|
19
|
+
explain(context: Context, introspection: Introspection): Promise<Introspection | null>;
|
|
12
20
|
settle(context: Context, response: OutgoingMessage): Promise<void>;
|
|
13
21
|
dispose(): void;
|
|
14
22
|
}
|
|
@@ -17,7 +25,16 @@ export declare class DirectivesFactory implements RTD.DirectiveFactory {
|
|
|
17
25
|
private readonly families;
|
|
18
26
|
private readonly mandatory;
|
|
19
27
|
private readonly instances;
|
|
28
|
+
/** The request-scoped stages, in registration order, with the spans they run in. */
|
|
29
|
+
private readonly stages;
|
|
20
30
|
constructor(families: RTD.DirectiveFamily[], remotes: Remotes, host: Host, options: Options);
|
|
31
|
+
/**
|
|
32
|
+
* Request-scoped, before anything is routed, so no directives are passed: a family
|
|
33
|
+
* answers here only for what it does on its own behalf.
|
|
34
|
+
*/
|
|
35
|
+
preflight(context: Context): Promise<void>;
|
|
36
|
+
/** Request-scoped, on the message going back. */
|
|
37
|
+
depart(context: Context, response: OutgoingMessage): Promise<void>;
|
|
21
38
|
create(declarations: RTD.syntax.Directive[], route?: string): Directives;
|
|
22
39
|
dispose(): void;
|
|
23
40
|
/** Mandatory families first, in their own order; everything else keeps its own. */
|
package/transpiled/Directive.js
CHANGED
|
@@ -6,26 +6,48 @@ export class Directives {
|
|
|
6
6
|
constructor(sets) {
|
|
7
7
|
this.sets = sets;
|
|
8
8
|
this.spans = sets.map((set) => ({
|
|
9
|
-
|
|
10
|
-
settle: options(set, 'settle')
|
|
9
|
+
precall: options(set, 'precall'),
|
|
10
|
+
settle: options(set, 'settle'),
|
|
11
|
+
explain: options(set, 'explain')
|
|
11
12
|
}));
|
|
12
13
|
}
|
|
13
|
-
|
|
14
|
+
declared(family) {
|
|
15
|
+
return this.sets.find((set) => set.family.name === family)?.directives;
|
|
16
|
+
}
|
|
17
|
+
async precall(context, parameters) {
|
|
14
18
|
let output = null;
|
|
15
19
|
for (let i = 0; i < this.sets.length; i++) {
|
|
16
20
|
const set = this.sets[i];
|
|
17
|
-
if (set.family.
|
|
21
|
+
if (set.family.precall === undefined)
|
|
18
22
|
continue;
|
|
19
|
-
const out = await console.span(this.spans[i].
|
|
23
|
+
const out = await console.span(this.spans[i].precall, async () => await set.family.precall(set.directives, context, parameters));
|
|
20
24
|
if (out === null)
|
|
21
25
|
continue;
|
|
22
26
|
if (output !== null)
|
|
23
|
-
throw new Error('Multiple
|
|
27
|
+
throw new Error('Multiple precall directives responded');
|
|
24
28
|
else
|
|
25
29
|
output = out;
|
|
26
30
|
}
|
|
27
31
|
return output;
|
|
28
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* What the method says about itself, as its directives leave it. Each family is given
|
|
35
|
+
* what the one before it returned, and the first to refuse ends it: a method this caller
|
|
36
|
+
* cannot reach is not described at all.
|
|
37
|
+
*/
|
|
38
|
+
async explain(context, introspection) {
|
|
39
|
+
let described = introspection;
|
|
40
|
+
for (let i = 0; i < this.sets.length; i++) {
|
|
41
|
+
const set = this.sets[i];
|
|
42
|
+
if (set.family.explain === undefined)
|
|
43
|
+
continue;
|
|
44
|
+
const next = await console.span(this.spans[i].explain, async () => await set.family.explain(set.directives, context, described));
|
|
45
|
+
if (next === null)
|
|
46
|
+
return null;
|
|
47
|
+
described = next;
|
|
48
|
+
}
|
|
49
|
+
return described;
|
|
50
|
+
}
|
|
29
51
|
async settle(context, response) {
|
|
30
52
|
for (let i = 0; i < this.sets.length; i++) {
|
|
31
53
|
const set = this.sets[i];
|
|
@@ -43,6 +65,8 @@ export class DirectivesFactory {
|
|
|
43
65
|
families = {};
|
|
44
66
|
mandatory = [];
|
|
45
67
|
instances = [];
|
|
68
|
+
/** The request-scoped stages, in registration order, with the spans they run in. */
|
|
69
|
+
stages = [];
|
|
46
70
|
// eslint-disable-next-line max-params
|
|
47
71
|
constructor(families, remotes, host, options) {
|
|
48
72
|
for (const family of families) {
|
|
@@ -50,9 +74,29 @@ export class DirectivesFactory {
|
|
|
50
74
|
this.families[family.name] = family;
|
|
51
75
|
if (family.mandatory)
|
|
52
76
|
this.mandatory.push(family.name);
|
|
77
|
+
this.stages.push({
|
|
78
|
+
family,
|
|
79
|
+
preflight: { name: `${family.name} preflight` },
|
|
80
|
+
depart: { name: `${family.name} depart` }
|
|
81
|
+
});
|
|
53
82
|
}
|
|
54
83
|
this.remotes = remotes;
|
|
55
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* Request-scoped, before anything is routed, so no directives are passed: a family
|
|
87
|
+
* answers here only for what it does on its own behalf.
|
|
88
|
+
*/
|
|
89
|
+
async preflight(context) {
|
|
90
|
+
for (const stage of this.stages)
|
|
91
|
+
if (stage.family.preflight !== undefined)
|
|
92
|
+
await console.span(stage.preflight, async () => { await stage.family.preflight(context); });
|
|
93
|
+
}
|
|
94
|
+
/** Request-scoped, on the message going back. */
|
|
95
|
+
async depart(context, response) {
|
|
96
|
+
for (const stage of this.stages)
|
|
97
|
+
if (stage.family.depart !== undefined)
|
|
98
|
+
await console.span(stage.depart, async () => { await stage.family.depart(context, response); });
|
|
99
|
+
}
|
|
56
100
|
create(declarations, route = '') {
|
|
57
101
|
const groups = {};
|
|
58
102
|
const mandatory = new Set(this.mandatory);
|