@toa.io/extensions.exposition 1.0.0-alpha.283 → 1.0.0-alpha.285
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 +40 -0
- package/components/exposition.octets/types/index.d.ts +1 -1
- 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 +1 -1
- 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 +1 -1
- package/components/identity.basic/source/incept.ts +29 -1
- package/components/identity.basic/tsconfig.json +1 -1
- package/components/identity.basic/tsconfig.tsbuildinfo +1 -1
- package/components/identity.basic/types/index.d.ts +3 -2
- package/components/identity.clients/operations/describe.js +1 -1
- package/components/identity.clients/operations/lib/Context.js +1 -1
- package/components/identity.clients/operations/lib/Entity.js +1 -1
- package/components/identity.clients/operations/lib/canonical.js +1 -1
- package/components/identity.clients/operations/lib/cimd.js +1 -1
- package/components/identity.clients/operations/lib/errors.js +1 -1
- package/components/identity.clients/operations/lib/index.js +1 -1
- package/components/identity.clients/operations/lib/redirect.js +1 -1
- package/components/identity.clients/operations/register.js +1 -1
- package/components/identity.clients/tsconfig.json +1 -1
- package/components/identity.clients/tsconfig.tsbuildinfo +1 -1
- package/components/identity.clients/types/index.d.ts +1 -1
- package/components/identity.credentials/operations/list.js +1 -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 +1 -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 +1 -1
- package/components/identity.federation/operations/lib/discovery.js +1 -1
- package/components/identity.federation/operations/lib/errors.js +1 -1
- package/components/identity.federation/operations/lib/exchange.js +1 -1
- 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 +8 -2
- package/components/identity.federation/source/incept.ts +7 -1
- 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/context.ts +3 -0
- package/components/identity.federation/tsconfig.json +4 -2
- package/components/identity.federation/tsconfig.tsbuildinfo +1 -1
- package/components/identity.federation/types/index.d.ts +1 -1
- package/components/identity.grants/operations/authorize.js +1 -1
- package/components/identity.grants/operations/exchange.js +1 -1
- package/components/identity.grants/operations/lib/code.js +1 -1
- package/components/identity.grants/operations/lib/identify.js +1 -1
- package/components/identity.grants/operations/lib/index.js +1 -1
- package/components/identity.grants/operations/list.js +1 -1
- package/components/identity.grants/operations/revoke.js +1 -1
- package/components/identity.grants/tsconfig.json +1 -1
- package/components/identity.grants/tsconfig.tsbuildinfo +1 -1
- package/components/identity.grants/types/index.d.ts +1 -1
- 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/tsconfig.json +1 -1
- package/components/identity.keys/tsconfig.tsbuildinfo +1 -1
- package/components/identity.keys/types/index.d.ts +1 -1
- 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/tsconfig.json +1 -1
- package/components/identity.otp/tsconfig.tsbuildinfo +1 -1
- package/components/identity.otp/types/index.d.ts +1 -1
- 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/tsconfig.json +1 -1
- package/components/identity.passkeys/tsconfig.tsbuildinfo +1 -1
- package/components/identity.passkeys/types/index.d.ts +1 -1
- 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 +1 -1
- package/components/identity.tokens/operations/authenticate.js +1 -1
- package/components/identity.tokens/operations/decrypt.js +1 -1
- package/components/identity.tokens/operations/encrypt.js +1 -1
- package/components/identity.tokens/operations/issue.js +1 -1
- package/components/identity.tokens/operations/lib/form.js +1 -1
- package/components/identity.tokens/operations/lib/index.js +1 -1
- 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/tsconfig.json +1 -1
- package/components/identity.tokens/tsconfig.tsbuildinfo +1 -1
- package/components/identity.tokens/types/index.d.ts +1 -1
- package/documentation/access.md +13 -0
- package/documentation/components.md +3 -0
- package/documentation/introspection.md +13 -5
- package/documentation/io.md +6 -0
- package/documentation/map.md +8 -0
- package/documentation/mcp.md +186 -0
- package/documentation/oauth.md +8 -7
- package/documentation/rpc.md +144 -0
- package/documentation/tree.md +3 -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 +691 -0
- package/features/oauth.discovery.feature +10 -11
- package/features/oauth.grants.feature +22 -9
- 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 +19 -2
- package/features/steps/Parameters.ts +18 -7
- package/features/steps/Realtime.ts +3 -0
- package/features/steps/components/echo/manifest.toa.yaml +1 -0
- package/features/steps/components/pots/manifest.toa.yaml +2 -0
- package/package.json +3 -3
- package/readme.md +3 -0
- package/schemas/annotation.cos.yaml +33 -0
- package/schemas/call.cos.yaml +18 -0
- package/source/Annotation.ts +31 -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 +5 -1
- package/source/Gateway.ts +73 -11
- package/source/HTTP/Context.ts +7 -0
- package/source/HTTP/Server.ts +7 -1
- package/source/HTTP/exceptions.ts +2 -2
- package/source/HTTP/messages.ts +10 -1
- package/source/Introspection.ts +105 -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 +157 -0
- package/source/MCP/types.ts +84 -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 +183 -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 +8 -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 +62 -3
- 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 +2 -1
- 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/types.ts +21 -0
- package/source/directives/cache/Cache.ts +1 -1
- package/source/directives/dev/Development.ts +1 -1
- package/source/directives/flow/Flow.ts +1 -1
- package/source/directives/index.ts +3 -1
- package/source/directives/io/Directive.ts +1 -1
- package/source/directives/io/IO.ts +32 -3
- package/source/directives/io/Input.ts +3 -2
- package/source/directives/io/Output.ts +6 -3
- package/source/directives/io/Status.test.ts +2 -2
- package/source/directives/io/Status.ts +1 -1
- 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 +40 -0
- package/source/directives/mcp/Tool.test.ts +90 -0
- package/source/directives/mcp/Tool.ts +47 -0
- package/source/directives/mcp/index.ts +6 -0
- package/source/directives/oauth/Discovery.ts +10 -16
- package/source/directives/octets/Octets.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/schemas.ts +2 -0
- package/transpiled/Annotation.d.ts +24 -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 +5 -1
- 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 +5 -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/messages.d.ts +6 -0
- package/transpiled/HTTP/messages.js +9 -1
- package/transpiled/HTTP/messages.js.map +1 -1
- package/transpiled/Introspection.d.ts +42 -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 +122 -0
- package/transpiled/MCP/tools.js.map +1 -0
- package/transpiled/MCP/types.d.ts +66 -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 +31 -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 +4 -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 +27 -1
- package/transpiled/directives/auth/Authorization.js +49 -1
- 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.js +2 -1
- 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/types.d.ts +16 -0
- package/transpiled/directives/cache/Cache.d.ts +1 -1
- package/transpiled/directives/cache/Cache.js +1 -1
- package/transpiled/directives/cache/Cache.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 +2 -1
- 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 +23 -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 +4 -2
- package/transpiled/directives/io/Output.js.map +1 -1
- package/transpiled/directives/io/Status.d.ts +1 -1
- package/transpiled/directives/io/Status.js +1 -1
- package/transpiled/directives/io/Status.js.map +1 -1
- 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 +29 -0
- package/transpiled/directives/mcp/MCP.js.map +1 -0
- package/transpiled/directives/mcp/Tool.d.ts +18 -0
- package/transpiled/directives/mcp/Tool.js +34 -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.js +10 -13
- package/transpiled/directives/oauth/Discovery.js.map +1 -1
- 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/schemas.d.ts +2 -0
- package/transpiled/schemas.js +1 -0
- package/transpiled/schemas.js.map +1 -1
- 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 -15
- package/components/identity.basic/operations/transit.js.map +0 -1
- package/components/identity.clients/operations/describe.d.ts +0 -27
- package/components/identity.clients/operations/describe.js.map +0 -1
- package/components/identity.clients/operations/lib/Context.d.ts +0 -29
- package/components/identity.clients/operations/lib/Context.js.map +0 -1
- package/components/identity.clients/operations/lib/Entity.d.ts +0 -29
- package/components/identity.clients/operations/lib/Entity.js.map +0 -1
- package/components/identity.clients/operations/lib/canonical.d.ts +0 -11
- package/components/identity.clients/operations/lib/canonical.js.map +0 -1
- package/components/identity.clients/operations/lib/cimd.d.ts +0 -8
- package/components/identity.clients/operations/lib/cimd.js.map +0 -1
- package/components/identity.clients/operations/lib/errors.d.ts +0 -7
- package/components/identity.clients/operations/lib/errors.js.map +0 -1
- package/components/identity.clients/operations/lib/index.d.ts +0 -6
- package/components/identity.clients/operations/lib/index.js.map +0 -1
- package/components/identity.clients/operations/lib/redirect.d.ts +0 -10
- package/components/identity.clients/operations/lib/redirect.js.map +0 -1
- package/components/identity.clients/operations/register.d.ts +0 -37
- package/components/identity.clients/operations/register.js.map +0 -1
- package/components/identity.credentials/operations/list.d.ts +0 -52
- 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 -77
- 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 -36
- 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.grants/operations/authorize.d.ts +0 -35
- package/components/identity.grants/operations/authorize.js.map +0 -1
- package/components/identity.grants/operations/exchange.d.ts +0 -37
- package/components/identity.grants/operations/exchange.js.map +0 -1
- package/components/identity.grants/operations/lib/code.d.ts +0 -15
- package/components/identity.grants/operations/lib/code.js.map +0 -1
- package/components/identity.grants/operations/lib/identify.d.ts +0 -6
- package/components/identity.grants/operations/lib/identify.js.map +0 -1
- package/components/identity.grants/operations/lib/index.d.ts +0 -3
- package/components/identity.grants/operations/lib/index.js.map +0 -1
- package/components/identity.grants/operations/list.d.ts +0 -13
- package/components/identity.grants/operations/list.js.map +0 -1
- package/components/identity.grants/operations/revoke.d.ts +0 -18
- package/components/identity.grants/operations/revoke.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 -16
- 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 -16
- 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 -10
- package/components/identity.tokens/operations/authenticate.js.map +0 -1
- package/components/identity.tokens/operations/decrypt.d.ts +0 -16
- package/components/identity.tokens/operations/decrypt.js.map +0 -1
- package/components/identity.tokens/operations/encrypt.d.ts +0 -9
- package/components/identity.tokens/operations/encrypt.js.map +0 -1
- package/components/identity.tokens/operations/issue.d.ts +0 -25
- package/components/identity.tokens/operations/issue.js.map +0 -1
- package/components/identity.tokens/operations/lib/form.d.ts +0 -8
- package/components/identity.tokens/operations/lib/form.js.map +0 -1
- package/components/identity.tokens/operations/lib/index.d.ts +0 -4
- 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/revoke.d.ts +0 -2
- package/components/identity.tokens/operations/revoke.js.map +0 -1
|
@@ -44,6 +44,8 @@ export class Realtime {
|
|
|
44
44
|
|
|
45
45
|
Realtime.instance = await factory.service()
|
|
46
46
|
|
|
47
|
+
// not awaited: the routes connect to the components that produce the events, and this
|
|
48
|
+
// scenario starts the producer after the service, so the connection settles later
|
|
47
49
|
void Realtime.instance.connect()
|
|
48
50
|
}
|
|
49
51
|
|
|
@@ -152,3 +154,4 @@ export class Realtime {
|
|
|
152
154
|
}
|
|
153
155
|
}
|
|
154
156
|
}
|
|
157
|
+
|
|
@@ -24,6 +24,7 @@ entity:
|
|
|
24
24
|
|
|
25
25
|
operations:
|
|
26
26
|
create:
|
|
27
|
+
description: Put a pot on to brew.
|
|
27
28
|
query: false
|
|
28
29
|
forward: transit
|
|
29
30
|
input:
|
|
@@ -71,6 +72,7 @@ operations:
|
|
|
71
72
|
type: number
|
|
72
73
|
type: object
|
|
73
74
|
enumerate:
|
|
75
|
+
description: Every pot there is.
|
|
74
76
|
output:
|
|
75
77
|
type: array
|
|
76
78
|
items:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toa.io/extensions.exposition",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.285",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Toa Exposition",
|
|
6
6
|
"author": "temich <tema.gurtovoy@gmail.com>",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@simplewebauthn/server": "14.0.0",
|
|
22
|
-
"@toa.io/core": "1.0.0-alpha.
|
|
22
|
+
"@toa.io/core": "1.0.0-alpha.284",
|
|
23
23
|
"@toa.io/generic": "1.0.0-alpha.283",
|
|
24
24
|
"@toa.io/schemas": "1.0.0-alpha.283",
|
|
25
25
|
"bcryptjs": "3.0.3",
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"@types/cors": "2.8.19",
|
|
59
59
|
"@types/negotiator": "0.6.5"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "44ed1be7e322a5ea8f1a8ed85ba96b9dfaf28224"
|
|
62
62
|
}
|
package/readme.md
CHANGED
|
@@ -139,6 +139,9 @@ exposition:
|
|
|
139
139
|
| `ip` | Header the client address is read from. See [Client address](documentation/ip.md). |
|
|
140
140
|
| `bouncer` | Meter of failed authentications per address. See [Identity authentication](documentation/identity.md#failed-authentications). |
|
|
141
141
|
| `oauth` | Authorization server exposed to OAuth clients. See [OAuth](documentation/oauth.md). |
|
|
142
|
+
| `protocol` | `h1` or `h2c`. See [Protocol](documentation/protocol.md). |
|
|
143
|
+
| `rpc` | JSON-RPC at `/.rpc`; none is served without it. See [JSON-RPC](documentation/rpc.md). |
|
|
144
|
+
| `mcp` | MCP at `/.mcp`; none is served without it. See [MCP](documentation/mcp.md). |
|
|
142
145
|
|
|
143
146
|
### Observability
|
|
144
147
|
|
|
@@ -80,6 +80,39 @@ properties:
|
|
|
80
80
|
required:
|
|
81
81
|
- authorize
|
|
82
82
|
additionalProperties: false
|
|
83
|
+
rpc:
|
|
84
|
+
description: JSON-RPC at `/.rpc`; writing it is what turns the endpoint on
|
|
85
|
+
type: object
|
|
86
|
+
properties:
|
|
87
|
+
batch:
|
|
88
|
+
description: Calls one request may carry
|
|
89
|
+
type: integer
|
|
90
|
+
minimum: 1
|
|
91
|
+
additionalProperties: false
|
|
92
|
+
mcp:
|
|
93
|
+
description: MCP at `/.mcp`; writing it is what turns the endpoint on
|
|
94
|
+
type: object
|
|
95
|
+
properties:
|
|
96
|
+
name:
|
|
97
|
+
description: What the server calls itself
|
|
98
|
+
type: string
|
|
99
|
+
minLength: 1
|
|
100
|
+
instructions:
|
|
101
|
+
description: What a model is told before it calls anything here
|
|
102
|
+
type: string
|
|
103
|
+
origins:
|
|
104
|
+
description: Browser origins the endpoint answers; none without it
|
|
105
|
+
type: array
|
|
106
|
+
items:
|
|
107
|
+
type: string
|
|
108
|
+
pattern: ^https?://
|
|
109
|
+
anonymous:
|
|
110
|
+
description: Whether the endpoint answers without a credential
|
|
111
|
+
type: boolean
|
|
112
|
+
default: false
|
|
113
|
+
required:
|
|
114
|
+
- name
|
|
115
|
+
additionalProperties: false
|
|
83
116
|
/: {}
|
|
84
117
|
authorities:
|
|
85
118
|
type: object
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
description: One JSON-RPC call, as the envelope carries it
|
|
2
|
+
properties:
|
|
3
|
+
jsonrpc:
|
|
4
|
+
const: '2.0'
|
|
5
|
+
method:
|
|
6
|
+
type: string
|
|
7
|
+
minLength: 1
|
|
8
|
+
params:
|
|
9
|
+
description: By name only, because `io:input` validates an object
|
|
10
|
+
type: object
|
|
11
|
+
id:
|
|
12
|
+
description: Absent makes the call a notification, which answers nothing
|
|
13
|
+
type: [string, number]
|
|
14
|
+
required:
|
|
15
|
+
- jsonrpc
|
|
16
|
+
- method
|
|
17
|
+
additionalProperties: false
|
|
18
|
+
type: object
|
package/source/Annotation.ts
CHANGED
|
@@ -26,6 +26,12 @@ export interface Annotation {
|
|
|
26
26
|
|
|
27
27
|
/** The authorization server this context exposes; none is exposed without it. */
|
|
28
28
|
oauth?: OAuth
|
|
29
|
+
|
|
30
|
+
/** JSON-RPC at `/.rpc`; none is served without it. See `documentation/rpc.md`. */
|
|
31
|
+
rpc?: RPC
|
|
32
|
+
|
|
33
|
+
/** MCP at `/.mcp`; none is served without it. See `documentation/mcp.md`. */
|
|
34
|
+
mcp?: MCP
|
|
29
35
|
'/'?: object // parsed and validated by RTD.syntax.parse
|
|
30
36
|
}
|
|
31
37
|
|
|
@@ -49,6 +55,31 @@ export interface OAuth {
|
|
|
49
55
|
registration?: 'open' | 'closed'
|
|
50
56
|
}
|
|
51
57
|
|
|
58
|
+
export interface RPC {
|
|
59
|
+
/**
|
|
60
|
+
* Calls one request may carry, 32 by default. One request is one authentication and one
|
|
61
|
+
* reply however many calls it makes, so what a caller may ask for at once is bounded.
|
|
62
|
+
*/
|
|
63
|
+
batch?: number
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface MCP {
|
|
67
|
+
/** What the server calls itself, which a client shows a user. */
|
|
68
|
+
name: string
|
|
69
|
+
|
|
70
|
+
/** What a model is told before it calls anything here. */
|
|
71
|
+
instructions?: string
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Browser origins the endpoint answers, which the revision requires against DNS rebinding.
|
|
75
|
+
* None are admitted without it; a request carrying no `Origin` is not a browser's.
|
|
76
|
+
*/
|
|
77
|
+
origins?: string[]
|
|
78
|
+
|
|
79
|
+
/** Whether the endpoint answers without a credential. It does not unless it says so. */
|
|
80
|
+
anonymous?: boolean
|
|
81
|
+
}
|
|
82
|
+
|
|
52
83
|
export interface Bouncer {
|
|
53
84
|
/** what an address may fail at once, 20 by default */
|
|
54
85
|
attempts?: number
|
package/source/Directive.test.ts
CHANGED
|
@@ -16,7 +16,7 @@ const families: Array<DirectiveFamily> = [
|
|
|
16
16
|
mandatory: true,
|
|
17
17
|
create: mock.fn((_0: any, _1: any, _2: any) => generate() as any),
|
|
18
18
|
arrange: mock.fn(),
|
|
19
|
-
|
|
19
|
+
precall: mock.fn(() => { sequence.push('foo'); return null }),
|
|
20
20
|
settle: mock.fn(),
|
|
21
21
|
dispose: mock.fn()
|
|
22
22
|
},
|
|
@@ -25,7 +25,7 @@ const families: Array<DirectiveFamily> = [
|
|
|
25
25
|
mandatory: true,
|
|
26
26
|
create: mock.fn((_0: any, _1: any, _2: any) => generate() as any),
|
|
27
27
|
arrange: mock.fn(),
|
|
28
|
-
|
|
28
|
+
precall: mock.fn(() => { sequence.push('qux'); return null }),
|
|
29
29
|
settle: mock.fn(),
|
|
30
30
|
dispose: mock.fn()
|
|
31
31
|
},
|
|
@@ -34,7 +34,7 @@ const families: Array<DirectiveFamily> = [
|
|
|
34
34
|
mandatory: false,
|
|
35
35
|
create: mock.fn((_0: string, _1: any, _2: any) => generate() as any),
|
|
36
36
|
arrange: mock.fn(),
|
|
37
|
-
|
|
37
|
+
precall: mock.fn(() => { sequence.push('bar'); return null }),
|
|
38
38
|
settle: mock.fn(),
|
|
39
39
|
dispose: mock.fn()
|
|
40
40
|
}
|
|
@@ -47,9 +47,9 @@ beforeEach(() => {
|
|
|
47
47
|
sequence.length = 0
|
|
48
48
|
|
|
49
49
|
for (const family of families) {
|
|
50
|
-
assert.ok(family.
|
|
50
|
+
assert.ok(family.precall !== undefined)
|
|
51
51
|
|
|
52
|
-
family.
|
|
52
|
+
family.precall.mock.mockImplementation(() => { sequence.push(family.name); return null })
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
factory = new DirectivesFactory(families, {} as unknown as Remotes, {} as unknown as Host,
|
|
@@ -110,25 +110,25 @@ it('should apply directive', async () => {
|
|
|
110
110
|
const request = generate() as unknown as Context
|
|
111
111
|
const directive = families[0].create.mock.calls[0].result
|
|
112
112
|
|
|
113
|
-
await directives.
|
|
113
|
+
await directives.precall(request, [])
|
|
114
114
|
|
|
115
|
-
assert.ok(families[0].
|
|
115
|
+
assert.ok(families[0].precall !== undefined)
|
|
116
116
|
|
|
117
|
-
assert.deepStrictEqual(families[0].
|
|
118
|
-
assert.deepStrictEqual(families[0].
|
|
117
|
+
assert.deepStrictEqual(families[0].precall.mock.calls[0].arguments[0], [directive])
|
|
118
|
+
assert.deepStrictEqual(families[0].precall.mock.calls[0].arguments[1], request)
|
|
119
119
|
})
|
|
120
120
|
|
|
121
121
|
it('should apply mandatory families', async () => {
|
|
122
122
|
const directives = factory.create([])
|
|
123
123
|
const request = generate() as unknown as Context
|
|
124
124
|
|
|
125
|
-
await directives.
|
|
125
|
+
await directives.precall(request, [])
|
|
126
126
|
|
|
127
|
-
assert.ok(families[0].
|
|
127
|
+
assert.ok(families[0].precall.mock.callCount() > 0)
|
|
128
128
|
})
|
|
129
129
|
|
|
130
130
|
describe('order', () => {
|
|
131
|
-
// the order the families actually ran, as each
|
|
131
|
+
// the order the families actually ran, as each precall recorded it
|
|
132
132
|
function order (): string[] {
|
|
133
133
|
return sequence
|
|
134
134
|
}
|
|
@@ -140,7 +140,7 @@ describe('order', () => {
|
|
|
140
140
|
{ family: 'foo', name: generate(), value: generate() }
|
|
141
141
|
])
|
|
142
142
|
|
|
143
|
-
await directives.
|
|
143
|
+
await directives.precall(generate() as unknown as Context, [])
|
|
144
144
|
|
|
145
145
|
assert.deepStrictEqual(order(), ['foo', 'qux'])
|
|
146
146
|
})
|
|
@@ -153,7 +153,7 @@ describe('order', () => {
|
|
|
153
153
|
{ family: 'qux', name: generate(), value: generate() }
|
|
154
154
|
])
|
|
155
155
|
|
|
156
|
-
await directives.
|
|
156
|
+
await directives.precall(generate() as unknown as Context, [])
|
|
157
157
|
|
|
158
158
|
assert.deepStrictEqual(order(), ['foo', 'qux'])
|
|
159
159
|
})
|
|
@@ -164,7 +164,7 @@ describe('order', () => {
|
|
|
164
164
|
{ family: 'qux', name: generate(), value: generate() }
|
|
165
165
|
])
|
|
166
166
|
|
|
167
|
-
await directives.
|
|
167
|
+
await directives.precall(generate() as unknown as Context, [])
|
|
168
168
|
|
|
169
169
|
assert.deepStrictEqual(order(), ['foo', 'qux', 'bar'])
|
|
170
170
|
})
|
package/source/Directive.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { Context, OutgoingMessage, Options } from './HTTP/index.js'
|
|
|
3
3
|
import type { Remotes } from './Remotes.js'
|
|
4
4
|
import type { Host } from './Factory.js'
|
|
5
5
|
import type { Output } from './io.js'
|
|
6
|
+
import type { Introspection } from './Introspection.js'
|
|
6
7
|
import type * as RTD from './RTD/index.js'
|
|
7
8
|
|
|
8
9
|
export class Directives implements RTD.Directives {
|
|
@@ -14,28 +15,33 @@ export class Directives implements RTD.Directives {
|
|
|
14
15
|
public constructor (sets: RTD.DirectiveSet[]) {
|
|
15
16
|
this.sets = sets
|
|
16
17
|
this.spans = sets.map((set) => ({
|
|
17
|
-
|
|
18
|
-
settle: options(set, 'settle')
|
|
18
|
+
precall: options(set, 'precall'),
|
|
19
|
+
settle: options(set, 'settle'),
|
|
20
|
+
explain: options(set, 'explain')
|
|
19
21
|
}))
|
|
20
22
|
}
|
|
21
23
|
|
|
22
|
-
public
|
|
24
|
+
public declared<T> (family: string): T[] | undefined {
|
|
25
|
+
return this.sets.find((set) => set.family.name === family)?.directives as T[] | undefined
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
public async precall (context: Context, parameters: RTD.Parameter[]): Promise<Output> {
|
|
23
29
|
let output = null
|
|
24
30
|
|
|
25
31
|
for (let i = 0; i < this.sets.length; i++) {
|
|
26
32
|
const set = this.sets[i]
|
|
27
33
|
|
|
28
|
-
if (set.family.
|
|
34
|
+
if (set.family.precall === undefined)
|
|
29
35
|
continue
|
|
30
36
|
|
|
31
|
-
const out = await console.span(this.spans[i].
|
|
32
|
-
async () => await set.family.
|
|
37
|
+
const out = await console.span(this.spans[i].precall,
|
|
38
|
+
async () => await set.family.precall!(set.directives, context, parameters))
|
|
33
39
|
|
|
34
40
|
if (out === null)
|
|
35
41
|
continue
|
|
36
42
|
|
|
37
43
|
if (output !== null)
|
|
38
|
-
throw new Error('Multiple
|
|
44
|
+
throw new Error('Multiple precall directives responded')
|
|
39
45
|
else
|
|
40
46
|
output = out
|
|
41
47
|
}
|
|
@@ -43,6 +49,33 @@ export class Directives implements RTD.Directives {
|
|
|
43
49
|
return output
|
|
44
50
|
}
|
|
45
51
|
|
|
52
|
+
/**
|
|
53
|
+
* What the method says about itself, as its directives leave it. Each family is given
|
|
54
|
+
* what the one before it returned, and the first to refuse ends it: a method this caller
|
|
55
|
+
* cannot reach is not described at all.
|
|
56
|
+
*/
|
|
57
|
+
public async explain (context: Context,
|
|
58
|
+
introspection: Introspection): Promise<Introspection | null> {
|
|
59
|
+
let described: Introspection = introspection
|
|
60
|
+
|
|
61
|
+
for (let i = 0; i < this.sets.length; i++) {
|
|
62
|
+
const set = this.sets[i]
|
|
63
|
+
|
|
64
|
+
if (set.family.explain === undefined)
|
|
65
|
+
continue
|
|
66
|
+
|
|
67
|
+
const next = await console.span(this.spans[i].explain,
|
|
68
|
+
async () => await set.family.explain!(set.directives, context, described))
|
|
69
|
+
|
|
70
|
+
if (next === null)
|
|
71
|
+
return null
|
|
72
|
+
|
|
73
|
+
described = next
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return described
|
|
77
|
+
}
|
|
78
|
+
|
|
46
79
|
public async settle (context: Context, response: OutgoingMessage): Promise<void> {
|
|
47
80
|
for (let i = 0; i < this.sets.length; i++) {
|
|
48
81
|
const set = this.sets[i]
|
|
@@ -65,6 +98,9 @@ export class DirectivesFactory implements RTD.DirectiveFactory {
|
|
|
65
98
|
private readonly mandatory: string[] = []
|
|
66
99
|
private readonly instances: Directives[] = []
|
|
67
100
|
|
|
101
|
+
/** The request-scoped stages, in registration order, with the spans they run in. */
|
|
102
|
+
private readonly stages: Stage[] = []
|
|
103
|
+
|
|
68
104
|
// eslint-disable-next-line max-params
|
|
69
105
|
public constructor (families: RTD.DirectiveFamily[], remotes: Remotes, host: Host,
|
|
70
106
|
options: Options) {
|
|
@@ -74,11 +110,36 @@ export class DirectivesFactory implements RTD.DirectiveFactory {
|
|
|
74
110
|
|
|
75
111
|
if (family.mandatory)
|
|
76
112
|
this.mandatory.push(family.name)
|
|
113
|
+
|
|
114
|
+
this.stages.push({
|
|
115
|
+
family,
|
|
116
|
+
preflight: { name: `${family.name} preflight` },
|
|
117
|
+
depart: { name: `${family.name} depart` }
|
|
118
|
+
})
|
|
77
119
|
}
|
|
78
120
|
|
|
79
121
|
this.remotes = remotes
|
|
80
122
|
}
|
|
81
123
|
|
|
124
|
+
/**
|
|
125
|
+
* Request-scoped, before anything is routed, so no directives are passed: a family
|
|
126
|
+
* answers here only for what it does on its own behalf.
|
|
127
|
+
*/
|
|
128
|
+
public async preflight (context: Context): Promise<void> {
|
|
129
|
+
for (const stage of this.stages)
|
|
130
|
+
if (stage.family.preflight !== undefined)
|
|
131
|
+
await console.span(stage.preflight,
|
|
132
|
+
async () => { await stage.family.preflight!(context) })
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/** Request-scoped, on the message going back. */
|
|
136
|
+
public async depart (context: Context, response: OutgoingMessage): Promise<void> {
|
|
137
|
+
for (const stage of this.stages)
|
|
138
|
+
if (stage.family.depart !== undefined)
|
|
139
|
+
await console.span(stage.depart,
|
|
140
|
+
async () => { await stage.family.depart!(context, response) })
|
|
141
|
+
}
|
|
142
|
+
|
|
82
143
|
public create (declarations: RTD.syntax.Directive[], route: string = ''): Directives {
|
|
83
144
|
const groups: Record<string, any> = {}
|
|
84
145
|
const mandatory = new Set(this.mandatory)
|
|
@@ -146,7 +207,7 @@ export class DirectivesFactory implements RTD.DirectiveFactory {
|
|
|
146
207
|
}
|
|
147
208
|
}
|
|
148
209
|
|
|
149
|
-
function options (set: RTD.DirectiveSet, stage: '
|
|
210
|
+
function options (set: RTD.DirectiveSet, stage: 'precall' | 'settle' | 'explain'): SpanOptions {
|
|
150
211
|
const options: SpanOptions = { name: `${set.family.name} ${stage}` }
|
|
151
212
|
|
|
152
213
|
if (set.names !== undefined && set.names.length > 0)
|
|
@@ -156,8 +217,15 @@ function options (set: RTD.DirectiveSet, stage: 'preflight' | 'settle'): SpanOpt
|
|
|
156
217
|
}
|
|
157
218
|
|
|
158
219
|
interface Spans {
|
|
159
|
-
|
|
220
|
+
precall: SpanOptions
|
|
160
221
|
settle: SpanOptions
|
|
222
|
+
explain: SpanOptions
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
interface Stage {
|
|
226
|
+
family: RTD.DirectiveFamily
|
|
227
|
+
preflight: SpanOptions
|
|
228
|
+
depart: SpanOptions
|
|
161
229
|
}
|
|
162
230
|
|
|
163
231
|
export const shortcuts: RTD.syntax.Shortcuts = new Map([
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { describe, it } from 'node:test'
|
|
2
|
+
import assert from 'node:assert/strict'
|
|
3
|
+
|
|
4
|
+
import { Endpoint } from './Endpoint.js'
|
|
5
|
+
import { Mapping } from './Mapping.js'
|
|
6
|
+
import type { Remote } from '@toa.io/core'
|
|
7
|
+
import type { Parameter } from './RTD/index.js'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* What `Remote.explain` answers is the contract's own object, the same one every time and
|
|
11
|
+
* on every route that mounts the endpoint — which is what this stands in for.
|
|
12
|
+
*/
|
|
13
|
+
function remote (): Promise<Remote> {
|
|
14
|
+
const explanation = {
|
|
15
|
+
input: {
|
|
16
|
+
type: 'object',
|
|
17
|
+
properties: {
|
|
18
|
+
a: { type: 'string' },
|
|
19
|
+
b: { type: 'string' }
|
|
20
|
+
},
|
|
21
|
+
required: ['a', 'b']
|
|
22
|
+
},
|
|
23
|
+
output: null
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return Promise.resolve({
|
|
27
|
+
explain: async () => explanation
|
|
28
|
+
} as unknown as Remote)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const endpoint = (discovery: Promise<Remote>): Endpoint =>
|
|
32
|
+
new Endpoint('parameters', Mapping.create(), discovery)
|
|
33
|
+
|
|
34
|
+
const variable: Parameter[] = [{ name: 'a', value: 'a1b2' }]
|
|
35
|
+
|
|
36
|
+
describe('explain', () => {
|
|
37
|
+
it('should state a route variable as the route, not as the input', async () => {
|
|
38
|
+
const introspection = await endpoint(remote()).explain(variable)
|
|
39
|
+
|
|
40
|
+
assert.deepEqual(Object.keys(introspection.route ?? {}), ['a'])
|
|
41
|
+
assert.deepEqual(Object.keys((introspection.input as any).properties), ['b'])
|
|
42
|
+
assert.deepEqual((introspection.input as any).required, ['b'])
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
it('should leave the operation for the next route that mounts it', async () => {
|
|
46
|
+
const discovery = remote()
|
|
47
|
+
|
|
48
|
+
await endpoint(discovery).explain(variable)
|
|
49
|
+
|
|
50
|
+
// a second route on the same endpoint, taking no variable of its own
|
|
51
|
+
const introspection = await endpoint(discovery).explain([])
|
|
52
|
+
|
|
53
|
+
assert.deepEqual(Object.keys((introspection.input as any).properties), ['a', 'b'])
|
|
54
|
+
assert.deepEqual((introspection.input as any).required, ['a', 'b'])
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
it('should answer a copy, so what one caller narrows the next still sees', async () => {
|
|
58
|
+
const one = endpoint(remote())
|
|
59
|
+
const first = await one.explain(variable)
|
|
60
|
+
|
|
61
|
+
delete (first.input as any).properties.b
|
|
62
|
+
|
|
63
|
+
const second = await one.explain(variable)
|
|
64
|
+
|
|
65
|
+
assert.deepEqual(Object.keys((second.input as any).properties), ['b'])
|
|
66
|
+
})
|
|
67
|
+
})
|
package/source/Endpoint.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Readable } from 'node:stream'
|
|
2
2
|
import { console } from 'openspan'
|
|
3
3
|
import { Mapping } from './Mapping.js'
|
|
4
|
+
import { take } from './Introspection.js'
|
|
4
5
|
import { redact } from './redact.js'
|
|
5
6
|
import * as http from './HTTP/index.js'
|
|
6
7
|
import type { Introspection, Schema } from './Introspection.js'
|
|
@@ -15,6 +16,9 @@ export class Endpoint implements RTD.Endpoint {
|
|
|
15
16
|
private readonly discovery: Promise<Remote>
|
|
16
17
|
private remote: Remote | null = null
|
|
17
18
|
|
|
19
|
+
/** What the operation says, with what the route takes already split out of it. */
|
|
20
|
+
private introspection: Introspection | null = null
|
|
21
|
+
|
|
18
22
|
public constructor (endpoint: string, mapping: Mapping, discovery: Promise<Remote>) {
|
|
19
23
|
this.endpoint = endpoint
|
|
20
24
|
this.mapping = mapping
|
|
@@ -65,24 +69,40 @@ export class Endpoint implements RTD.Endpoint {
|
|
|
65
69
|
}
|
|
66
70
|
|
|
67
71
|
public async explain (parameters: RTD.Parameter[]): Promise<Introspection> {
|
|
72
|
+
this.introspection ??= await this.introspect(parameters)
|
|
73
|
+
|
|
74
|
+
// what a directive narrows is this caller's answer, not the next caller's
|
|
75
|
+
return structuredClone(this.introspection)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* `Remote.explain` answers the contract's own object, whose `input` is the manifest's by
|
|
80
|
+
* reference. What follows takes properties out of it, and two routes mounting one endpoint
|
|
81
|
+
* share one remote — so the copy is what keeps the second from describing what the first
|
|
82
|
+
* took away.
|
|
83
|
+
*/
|
|
84
|
+
private async introspect (parameters: RTD.Parameter[]): Promise<Introspection> {
|
|
68
85
|
this.remote ??= await this.discovery
|
|
69
86
|
|
|
70
|
-
const operation = await this.remote.explain(this.endpoint)
|
|
87
|
+
const operation = structuredClone(await this.remote.explain(this.endpoint))
|
|
88
|
+
|
|
89
|
+
// what the operation states it is, is the Introspection's to read and not a resource's:
|
|
90
|
+
// an operation is written without knowledge of any route, and the same one mounted twice
|
|
91
|
+
// is two methods. What a method states is what its route states, which `mcp:tool` gives.
|
|
92
|
+
delete operation.description
|
|
71
93
|
|
|
72
94
|
let route: Record<string, Schema> | null = null
|
|
73
95
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
96
|
+
// a variable the operation names is taken by the path, so it is not the body's to send
|
|
97
|
+
for (const parameter of parameters) {
|
|
98
|
+
const schema = take(operation, parameter.name)
|
|
77
99
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
route ??= {}
|
|
81
|
-
route[parameter.name] = schema
|
|
100
|
+
if (schema === undefined)
|
|
101
|
+
continue
|
|
82
102
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
103
|
+
route ??= {}
|
|
104
|
+
route[parameter.name] = schema
|
|
105
|
+
}
|
|
86
106
|
|
|
87
107
|
const query = this.mapping.explain(operation)
|
|
88
108
|
const introspection: Introspection = {}
|
package/source/Factory.ts
CHANGED
|
@@ -12,6 +12,8 @@ import { Composition } from './Composition.js'
|
|
|
12
12
|
import * as root from './root.js'
|
|
13
13
|
import { ATOM_GROUP } from './const.js'
|
|
14
14
|
import { Interception } from './Interception.js'
|
|
15
|
+
import { Dispatcher } from './RPC/index.js'
|
|
16
|
+
import { Server as Model } from './MCP/index.js'
|
|
15
17
|
import * as http from './HTTP/index.js'
|
|
16
18
|
import type { Branch } from './Branch.js'
|
|
17
19
|
import type { syntax } from './RTD/index.js'
|
|
@@ -58,7 +60,9 @@ export class Factory implements extensions.Factory {
|
|
|
58
60
|
const tree = new Tree(node, methods, directives)
|
|
59
61
|
|
|
60
62
|
const composition = new Composition(this.host)
|
|
61
|
-
const
|
|
63
|
+
const dispatcher = options.rpc === undefined ? null : new Dispatcher(options.rpc)
|
|
64
|
+
const mcp = options.mcp === undefined ? null : new Model(options.mcp, tree)
|
|
65
|
+
const gateway = new Gateway(broadcast, tree, interception, directives, dispatcher, mcp)
|
|
62
66
|
|
|
63
67
|
gateway.depends(remotes)
|
|
64
68
|
gateway.depends(composition)
|