@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
|
@@ -2,6 +2,7 @@ import type * as http from '../../HTTP/index.js';
|
|
|
2
2
|
import type { Parameter, DirectiveFamily } from '../../RTD/index.js';
|
|
3
3
|
import type { Remotes } from '../../Remotes.js';
|
|
4
4
|
import type { Directive } from './Directive.js';
|
|
5
|
+
import type { Introspection } from '../../Introspection.js';
|
|
5
6
|
import type { extensions } from '@toa.io/core';
|
|
6
7
|
export declare class IO implements DirectiveFamily<Directive> {
|
|
7
8
|
readonly name = "io";
|
|
@@ -11,7 +12,12 @@ export declare class IO implements DirectiveFamily<Directive> {
|
|
|
11
12
|
private sync;
|
|
12
13
|
mount(host: extensions.Host): void;
|
|
13
14
|
create(name: string, value: unknown, remotes: Remotes, route: string): Directive;
|
|
14
|
-
|
|
15
|
+
precall(directives: Directive[], context: http.Context, parameters: Parameter[]): null;
|
|
16
|
+
/**
|
|
17
|
+
* What a whitelist admits is what the schema states. Without an `io:output` the reply is
|
|
18
|
+
* dropped before it is sent, so there is no output to describe at all.
|
|
19
|
+
*/
|
|
20
|
+
explain(directives: Directive[], _: http.Context, introspection: Introspection): Introspection;
|
|
15
21
|
settle(directives: Directive[], context: http.Context, output: http.OutgoingMessage): void;
|
|
16
22
|
/**
|
|
17
23
|
* The ticker belongs to the family rather than to any route's directives, and the
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { restrict } from '../../Introspection.js';
|
|
1
2
|
import { Output } from './Output.js';
|
|
2
3
|
import { Input } from './Input.js';
|
|
3
4
|
import { Throttle } from './Throttle.js';
|
|
@@ -23,16 +24,35 @@ export class IO {
|
|
|
23
24
|
this.sync ??= new Sync(this.host.atom(ATOM_GROUP));
|
|
24
25
|
return new Directive(value, this.sync, route);
|
|
25
26
|
}
|
|
26
|
-
|
|
27
|
+
precall(directives, context, parameters) {
|
|
27
28
|
let restricted = false;
|
|
28
29
|
for (const directive of directives) {
|
|
29
30
|
restricted ||= directive instanceof Output;
|
|
30
|
-
directive.
|
|
31
|
+
directive.precall(context, parameters);
|
|
31
32
|
}
|
|
32
33
|
if (!restricted)
|
|
33
|
-
DENIAL.
|
|
34
|
+
DENIAL.precall(context, parameters);
|
|
34
35
|
return null;
|
|
35
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* What a whitelist admits is what the schema states. Without an `io:output` the reply is
|
|
39
|
+
* dropped before it is sent, so there is no output to describe at all.
|
|
40
|
+
*/
|
|
41
|
+
explain(directives, _, introspection) {
|
|
42
|
+
let restricted = false;
|
|
43
|
+
for (const directive of directives) {
|
|
44
|
+
if (directive instanceof Input)
|
|
45
|
+
introspection.input = restrict(introspection.input, directive.allowed);
|
|
46
|
+
if (!(directive instanceof Output))
|
|
47
|
+
continue;
|
|
48
|
+
restricted = true;
|
|
49
|
+
if (!directive.disabled)
|
|
50
|
+
introspection.output = restrict(introspection.output, directive.allowed);
|
|
51
|
+
}
|
|
52
|
+
if (!restricted)
|
|
53
|
+
delete introspection.output;
|
|
54
|
+
return introspection;
|
|
55
|
+
}
|
|
36
56
|
settle(directives, context, output) {
|
|
37
57
|
for (const directive of directives)
|
|
38
58
|
directive.settle?.(context, output);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IO.js","sourceRoot":"","sources":["../../../source/directives/io/IO.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,IAAI,EAAE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,MAAM,YAAY,GAAgC;IAChD,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE,MAAM;IACd,MAAM,EAAE,MAAM;IACd,QAAQ,EAAE,QAAQ;CACnB,CAAA;AAED,MAAM,MAAM,GAAc,IAAI,MAAM,CAAC,EAAE,CAAC,CAAA"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { Directive } from './Directive.js';
|
|
2
2
|
import type { Input as Context } from '../../io.js';
|
|
3
3
|
export declare class Input implements Directive {
|
|
4
|
-
|
|
4
|
+
/** what a client may send, which is therefore what the input schema states */
|
|
5
|
+
readonly allowed: Set<string>;
|
|
5
6
|
constructor(permissions: Permissions);
|
|
6
7
|
static validate(permissions: unknown): asserts permissions is Permissions;
|
|
7
|
-
|
|
8
|
+
precall(context: Context): void;
|
|
8
9
|
private check;
|
|
9
10
|
private violation;
|
|
10
11
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { BadRequest } from '../../HTTP/index.js';
|
|
2
2
|
import * as schemas from './schemas.js';
|
|
3
3
|
export class Input {
|
|
4
|
+
/** what a client may send, which is therefore what the input schema states */
|
|
4
5
|
allowed;
|
|
5
6
|
constructor(permissions) {
|
|
6
7
|
this.allowed = new Set(permissions);
|
|
@@ -8,7 +9,7 @@ export class Input {
|
|
|
8
9
|
static validate(permissions) {
|
|
9
10
|
schemas.input.validate(permissions, 'Incorrect \'io:input\' format');
|
|
10
11
|
}
|
|
11
|
-
|
|
12
|
+
precall(context) {
|
|
12
13
|
// Restrictions are on what the client sent, so the check goes to the front of the
|
|
13
14
|
// pipeline whatever order the families ran in: `auth:delegate` embeds the identity
|
|
14
15
|
// and `map:*` assigns mapped properties, and those additions are the server's own,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.js","sourceRoot":"","sources":["../../../source/directives/io/Input.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAChD,OAAO,KAAK,OAAO,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K,CAAC,OAAO,CAAC,KAAK,CAAC;YACvB,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAA;QAEjE,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;YAErC,IAAI,QAAQ,KAAK,SAAS;gBACxB,OAAO,QAAQ,CAAA;QACnB,CAAC;IACH,CAAC;CACF"}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import type { Directive } from './Directive.js';
|
|
2
2
|
import type { Input as Context } from '../../io.js';
|
|
3
3
|
export declare class Output implements Directive {
|
|
4
|
-
|
|
4
|
+
/** whether the reply passes whole, which is when the schema is the operation's own */
|
|
5
|
+
readonly disabled: boolean;
|
|
6
|
+
/** what a reply may carry, which is therefore what the output schema states */
|
|
7
|
+
readonly allowed: Set<string>;
|
|
5
8
|
private readonly omitted;
|
|
6
9
|
private readonly permissions;
|
|
7
|
-
private readonly allowed;
|
|
8
10
|
constructor(permissions: Permissions);
|
|
9
11
|
static validate(permissions: unknown): asserts permissions is Permissions;
|
|
10
|
-
|
|
12
|
+
precall(context: Context): void;
|
|
11
13
|
private restriction;
|
|
12
14
|
/** Runs per entity of a collection, hence the set and the absence of intermediates. */
|
|
13
15
|
private fit;
|
|
@@ -2,10 +2,12 @@ import { Stream } from 'node:stream';
|
|
|
2
2
|
import { console } from 'openspan';
|
|
3
3
|
import * as schemas from './schemas.js';
|
|
4
4
|
export class Output {
|
|
5
|
+
/** whether the reply passes whole, which is when the schema is the operation's own */
|
|
5
6
|
disabled = false;
|
|
7
|
+
/** what a reply may carry, which is therefore what the output schema states */
|
|
8
|
+
allowed;
|
|
6
9
|
omitted = true;
|
|
7
10
|
permissions = [];
|
|
8
|
-
allowed;
|
|
9
11
|
constructor(permissions) {
|
|
10
12
|
if (typeof permissions === 'boolean')
|
|
11
13
|
if (permissions)
|
|
@@ -19,7 +21,7 @@ export class Output {
|
|
|
19
21
|
static validate(permissions) {
|
|
20
22
|
schemas.output.validate(permissions, 'Incorrect \'io:output\' format');
|
|
21
23
|
}
|
|
22
|
-
|
|
24
|
+
precall(context) {
|
|
23
25
|
context.pipelines.response.push(this.restriction(context));
|
|
24
26
|
}
|
|
25
27
|
restriction(context) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Output.js","sourceRoot":"","sources":["../../../source/directives/io/Output.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAClC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AAMvC,MAAM,OAAO,MAAM;
|
|
1
|
+
{"version":3,"file":"Output.js","sourceRoot":"","sources":["../../../source/directives/io/Output.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAClC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AAMvC,MAAM,OAAO,MAAM;IACjB,sFAAsF;IACtE,QAAQ,GAAY,KAAK,CAAA;IAEzC,+EAA+E;IAC/D,OAAO,CAAa;IACnB,OAAO,GAAY,IAAI,CAAA;IACvB,WAAW,GAAa,EAAE,CAAA;IAE3C,YAAoB,WAAwB;QAC1C,IAAI,OAAO,WAAW,KAAK,SAAS;YAClC,IAAI,WAAW;gBACb,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAA;;gBAEpB,IAAI,CAAC,OAAO,GAAG,KAAK,CAAA;;YAGtB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAA;QAEhC,IAAI,CAAC,OAAO,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC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CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,MAAiB,CAAC,CAAC,CAAA;;gBAExE,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;QACzC,CAAC,CAAA;IACH,CAAC;IAED,uFAAuF;IAC/E,GAAG,CAAE,OAAgB;QAC3B,MAAM,MAAM,GAAY,EAAE,CAAA;QAE1B,+EAA+E;QAC/E,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC;YACpC,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;gBACvB,MAAM,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAAA;QAE9B,OAAO,MAAM,CAAA;IACf,CAAC;CACF"}
|
|
@@ -14,6 +14,6 @@ export declare class Status implements Directive {
|
|
|
14
14
|
private readonly property;
|
|
15
15
|
constructor(property: unknown);
|
|
16
16
|
static validate(value: unknown): asserts value is string;
|
|
17
|
-
|
|
17
|
+
precall(): void;
|
|
18
18
|
settle(_: unknown, response: http.OutgoingMessage): void;
|
|
19
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Status.js","sourceRoot":"","sources":["../../../source/directives/io/Status.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAA;AAIhC;;;;;;;;;GASG;AACH,MAAM,OAAO,MAAM;IACA,QAAQ,CAAQ;IAEjC,YAAoB,QAAiB;QACnC,IAAI,CAAC,QAAQ,GAAG,QAAkB,CAAA;IACpC,CAAC;IAEM,MAAM,CAAC,QAAQ,CAAE,KAAc;QACpC,MAAM,CAAC,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,EAAE,8BAA8B,CAAC,CAAA;IACtE,CAAC;IAEM,
|
|
1
|
+
{"version":3,"file":"Status.js","sourceRoot":"","sources":["../../../source/directives/io/Status.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAA;AAIhC;;;;;;;;;GASG;AACH,MAAM,OAAO,MAAM;IACA,QAAQ,CAAQ;IAEjC,YAAoB,QAAiB;QACnC,IAAI,CAAC,QAAQ,GAAG,QAAkB,CAAA;IACpC,CAAC;IAEM,MAAM,CAAC,QAAQ,CAAE,KAAc;QACpC,MAAM,CAAC,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,EAAE,8BAA8B,CAAC,CAAA;IACtE,CAAC;IAEM,OAAO;QACZ,iDAAiD;IACnD,CAAC;IAEM,MAAM,CAAE,CAAU,EAAE,QAA8B;QACvD,MAAM,IAAI,GAAY,QAAQ,CAAC,IAAI,CAAA;QAEnC,IAAI,IAAI,KAAK,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC;YACvE,OAAM;QAER,MAAM,KAAK,GAAa,IAAgC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QAEvE,MAAM,CAAC,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,EACjC,0BAA0B,IAAI,CAAC,QAAQ,kBAAkB,CAAC,CAAA;QAE5D,QAAQ,CAAC,MAAM,GAAG,KAAK,CAAA;QAEvB,gEAAgE;QAChE,OAAQ,IAAgC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IACzD,CAAC;CACF"}
|
|
@@ -6,6 +6,6 @@ export declare class Throttle implements Directive {
|
|
|
6
6
|
private readonly quotas;
|
|
7
7
|
constructor(declaration: Declaration, sync: Sync, route: string);
|
|
8
8
|
static validate(declaration: unknown): asserts declaration is Declaration;
|
|
9
|
-
|
|
9
|
+
precall(context: http.Context, parameters: Parameter[]): void;
|
|
10
10
|
settle(context: http.Context, output: http.OutgoingMessage): void;
|
|
11
11
|
}
|
|
@@ -10,7 +10,7 @@ export class Throttle {
|
|
|
10
10
|
static validate(declaration) {
|
|
11
11
|
schemas.throttle.validate(declaration, 'Incorrect \'io:throttle\' format');
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
precall(context, parameters) {
|
|
14
14
|
const retry = this.quotas.check(context, parameters);
|
|
15
15
|
if (retry > 0)
|
|
16
16
|
throw new TooManyRequests(retry);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Throttle.js","sourceRoot":"","sources":["../../../source/directives/io/Throttle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AACrD,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,EAA+B,MAAM,yBAAyB,CAAA;AAKpF,MAAM,OAAO,QAAQ;IACF,MAAM,CAAQ;IAE/B,YAAoB,WAAwB,EAAE,IAAU,EAAE,KAAa;QACrE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,KAAK,CAAC,CAAA;QAEtD,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAC5B,CAAC;IAEM,MAAM,CAAC,QAAQ,CAAE,WAAoB;QAC1C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,WAAW,EAAE,kCAAkC,CAAC,CAAA;IAC5E,CAAC;IAEM,
|
|
1
|
+
{"version":3,"file":"Throttle.js","sourceRoot":"","sources":["../../../source/directives/io/Throttle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AACrD,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,EAA+B,MAAM,yBAAyB,CAAA;AAKpF,MAAM,OAAO,QAAQ;IACF,MAAM,CAAQ;IAE/B,YAAoB,WAAwB,EAAE,IAAU,EAAE,KAAa;QACrE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,KAAK,CAAC,CAAA;QAEtD,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAC5B,CAAC;IAEM,MAAM,CAAC,QAAQ,CAAE,WAAoB;QAC1C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,WAAW,EAAE,kCAAkC,CAAC,CAAA;IAC5E,CAAC;IAEM,OAAO,CAAE,OAAqB,EAAE,UAAuB;QAC5D,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,UAAU,CAAC,CAAA;QAEpD,IAAI,KAAK,GAAG,CAAC;YACX,MAAM,IAAI,eAAe,CAAC,KAAK,CAAC,CAAA;IACpC,CAAC;IAEM,MAAM,CAAE,OAAqB,EAAE,MAA4B;QAChE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;IAClC,CAAC;CACF"}
|
|
@@ -29,7 +29,7 @@ export declare class Quotas {
|
|
|
29
29
|
private readonly conditional;
|
|
30
30
|
private readonly entries;
|
|
31
31
|
/**
|
|
32
|
-
* The key computed at
|
|
32
|
+
* The key computed at precall, for settle to charge against.
|
|
33
33
|
*
|
|
34
34
|
* `segment` reads the route parameters, which settle is not given, and `identity`
|
|
35
35
|
* can be refreshed between the two — so recomputing there would key a request
|
|
@@ -25,7 +25,7 @@ export class Quotas {
|
|
|
25
25
|
conditional;
|
|
26
26
|
entries = new Map();
|
|
27
27
|
/**
|
|
28
|
-
* The key computed at
|
|
28
|
+
* The key computed at precall, for settle to charge against.
|
|
29
29
|
*
|
|
30
30
|
* `segment` reads the route parameters, which settle is not given, and `identity`
|
|
31
31
|
* can be refreshed between the two — so recomputing there would key a request
|
|
@@ -75,7 +75,7 @@ export class Quotas {
|
|
|
75
75
|
use(input, output) {
|
|
76
76
|
if (!this.conditional || !this.keys.matches(input, output))
|
|
77
77
|
return;
|
|
78
|
-
//
|
|
78
|
+
// precall always runs first, and a request it refuses never reaches settle
|
|
79
79
|
const key = this.keyed.get(input) ?? this.keys.get(input);
|
|
80
80
|
if (key === undefined)
|
|
81
81
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Quotas.js","sourceRoot":"","sources":["../../../../../source/directives/io/lib/throttle/Quotas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAMhC;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAO,MAAM;IACjB,wFAAwF;IACxE,MAAM,CAAQ;IAE9B,4EAA4E;IAC3D,QAAQ,CAAQ;IAEjC,qFAAqF;IACpE,QAAQ,CAAQ;IAEhB,IAAI,CAAM;IACV,MAAM,CAAQ;IACd,WAAW,CAAS;IACpB,OAAO,GAAG,IAAI,GAAG,EAAiB,CAAA;IAEnD;;;;;;OAMG;IACc,KAAK,GAAG,IAAI,OAAO,EAAmB,CAAA;IAEvD,YAAoB,OAAgB;QAClC,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAA;QACxB,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAA;QACtC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAA;QACnD,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAA;QAChC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;QAEtC,+EAA+E;QAC/E,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,IAAI,KAAK,SAAS;YACtC,CAAC,CAAC,KAAK,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,QAAQ,GAAG;YAC9C,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,GAAG,CAAA;IACxB,CAAC;IAEM,MAAM,CAAC,MAAM,CAAE,aAA4B,EAAE,QAAgB,EAAE;QACpE,MAAM,EAAE,QAAQ,EAAE,QAAQ,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Mapping } from './Mapping.js';
|
|
2
2
|
import type { Input } from '../../io.js';
|
|
3
|
+
import type { Introspection } from '../../Introspection.js';
|
|
3
4
|
export declare class Headers extends Mapping<Record<string, string>> {
|
|
4
5
|
private readonly headers;
|
|
5
6
|
constructor(map: Record<string, string>);
|
|
7
|
+
explain(introspection: Introspection): void;
|
|
6
8
|
properties(context: Input): Record<string, string>;
|
|
7
9
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import assert from 'node:assert';
|
|
2
2
|
import { cors } from '../cors/index.js';
|
|
3
3
|
import { Mapping } from './Mapping.js';
|
|
4
|
+
import { take } from '../../Introspection.js';
|
|
4
5
|
/**
|
|
5
6
|
* Forbidden request header names: the browser sets them itself and a script cannot
|
|
6
7
|
* list them in `Access-Control-Request-Headers`, so there is nothing to advertise
|
|
@@ -16,6 +17,13 @@ export class Headers extends Mapping {
|
|
|
16
17
|
this.headers = Object.values(map).filter((header) => !FORBIDDEN.has(header));
|
|
17
18
|
this.headers.forEach((header) => cors.allow(header));
|
|
18
19
|
}
|
|
20
|
+
explain(introspection) {
|
|
21
|
+
for (const [property, header] of Object.entries(this.value)) {
|
|
22
|
+
const schema = take(introspection, property);
|
|
23
|
+
introspection.headers ??= {};
|
|
24
|
+
introspection.headers[property] = { ...schema, header };
|
|
25
|
+
}
|
|
26
|
+
}
|
|
19
27
|
properties(context) {
|
|
20
28
|
context.pipelines.response.push((response) => {
|
|
21
29
|
response.headers ??= new global.Headers();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Headers.js","sourceRoot":"","sources":["../../../source/directives/map/Headers.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAA;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"Headers.js","sourceRoot":"","sources":["../../../source/directives/map/Headers.ts"],"names":[],"mapp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a,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,MAAM,EAAE,MAAM,EAAE,CAAA;QACzD,CAAC;IACH,CAAC;IAEM,UAAU,CAAE,OAAc;QAC/B,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;YAC3C,QAAQ,CAAC,OAAO,KAAK,IAAI,MAAM,CAAC,OAAO,EAAE,CAAA;YAEzC,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO;gBAC/B,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;QAC3C,CAAC,CAAC,CAAA;QAEF,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,UAAkC,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,EAAE;YAClG,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;YAE7C,IAAI,KAAK,KAAK,SAAS;gBACrB,UAAU,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAA;YAExE,OAAO,UAAU,CAAA;QACnB,CAAC,EAAE,EAAE,CAAC,CAAA;IACR,CAAC;CACF"}
|
|
@@ -3,11 +3,13 @@ import { Mapping } from './Mapping.js';
|
|
|
3
3
|
import type { Directive } from './Directive.js';
|
|
4
4
|
import type { DirectiveFamily, Parameter } from '../../RTD/index.js';
|
|
5
5
|
import type { Input, Output } from '../../io.js';
|
|
6
|
+
import type { Introspection } from '../../Introspection.js';
|
|
6
7
|
import type { Remotes } from '../../Remotes.js';
|
|
7
8
|
export declare class Map implements DirectiveFamily {
|
|
8
9
|
readonly name = "map";
|
|
9
10
|
readonly mandatory = false;
|
|
10
11
|
private remotes;
|
|
11
12
|
create(name: string, value: unknown, remotes: Remotes): Property | Mapping;
|
|
12
|
-
|
|
13
|
+
explain(directives: Directive[], _: Input, introspection: Introspection): Introspection;
|
|
14
|
+
precall(directives: Directive[], context: Input, parameters: Parameter[]): Promise<Output>;
|
|
13
15
|
}
|
|
@@ -18,7 +18,13 @@ export class Map {
|
|
|
18
18
|
throw new Error(`Directive 'map:${name}' is not implemented`);
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
explain(directives, _, introspection) {
|
|
22
|
+
for (const directive of directives)
|
|
23
|
+
if (directive instanceof Mapping)
|
|
24
|
+
directive.explain(introspection);
|
|
25
|
+
return introspection;
|
|
26
|
+
}
|
|
27
|
+
async precall(directives, context, parameters) {
|
|
22
28
|
const properties = {};
|
|
23
29
|
for (const directive of directives)
|
|
24
30
|
if (directive instanceof Mapping)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Map.js","sourceRoot":"","sources":["../../../source/directives/map/Map.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAA;AACjC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"Map.js","sourceRoot":"","sources":["../../../source/directives/map/Map.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AI,UAAU;YAChC,IAAI,SAAS,YAAY,OAAO;gBAC9B,SAAS,CAAC,OAAO,CAAC,aAAa,CAAC,CAAA;QAEpC,OAAO,aAAa,CAAA;IACtB,CAAC;IAEM,KAAK,CAAC,OAAO,CAAE,UAAuB,EAAE,OAAc,EAAE,UAAuB;QACpF,MAAM,UAAU,GAAG,EAAE,CAAA;QAErB,KAAK,MAAM,SAAS,IAAI,UAAU;YAChC,IAAI,SAAS,YAAY,OAAO;gBAC9B,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,SAAS,CAAC,UAAU,CAAC,OAAO,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAA;QAE1F,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAa,EAAE,EAAE;YAC5C,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ;gBACjE,OAAO,UAAU,CAAA;;gBAEjB,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,CAAA;QAC1C,CAAC,CAAC,CAAA;QAEF,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AAKD,MAAM,QAAQ,GAAoE;IAChF,SAAS,EAAE,SAAS;IACpB,MAAM,EAAE,aAAa;IACrB,OAAO,EAAE,OAAO;IAChB,SAAS,EAAE,SAAS;IACpB,QAAQ,EAAE,QAAQ;IAClB,QAAQ,EAAE,QAAQ;IAClB,MAAM,EAAE,MAAM;CACf,CAAA"}
|
|
@@ -2,11 +2,24 @@ import type { Remotes } from '../../Remotes.js';
|
|
|
2
2
|
import type { Directive } from './Directive.js';
|
|
3
3
|
import type { Input } from '../../io.js';
|
|
4
4
|
import type { Parameter } from '../../RTD/index.js';
|
|
5
|
+
import type { Introspection } from '../../Introspection.js';
|
|
5
6
|
export declare abstract class Mapping<T = unknown> {
|
|
6
7
|
protected value: T;
|
|
7
8
|
protected remotes?: Remotes;
|
|
8
9
|
protected constructor(value: T, remotes?: Remotes);
|
|
9
10
|
abstract properties(context: Input, parameters: Parameter[], directives: Directive[]): Output;
|
|
11
|
+
/**
|
|
12
|
+
* What this mapping does to what the method says about itself, which is the reverse of
|
|
13
|
+
* what it does to a request: a property the gateway fills is taken out of the input,
|
|
14
|
+
* because it is not the caller's to send.
|
|
15
|
+
*
|
|
16
|
+
* The default says nothing more than that. A claim, an authority and a language come
|
|
17
|
+
* from the request itself and there is nowhere for a caller to put one; a header and a
|
|
18
|
+
* segment are the caller's, and those say where.
|
|
19
|
+
*/
|
|
20
|
+
explain(introspection: Introspection): void;
|
|
21
|
+
/** The input properties this mapping fills, however its value names them. */
|
|
22
|
+
protected names(): string[];
|
|
10
23
|
}
|
|
11
24
|
type Properties = Record<string, unknown> | null;
|
|
12
25
|
type Output = Properties | Promise<Properties>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { take } from '../../Introspection.js';
|
|
1
2
|
export class Mapping {
|
|
2
3
|
value;
|
|
3
4
|
remotes;
|
|
@@ -5,5 +6,24 @@ export class Mapping {
|
|
|
5
6
|
this.value = value;
|
|
6
7
|
this.remotes = remotes;
|
|
7
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* What this mapping does to what the method says about itself, which is the reverse of
|
|
11
|
+
* what it does to a request: a property the gateway fills is taken out of the input,
|
|
12
|
+
* because it is not the caller's to send.
|
|
13
|
+
*
|
|
14
|
+
* The default says nothing more than that. A claim, an authority and a language come
|
|
15
|
+
* from the request itself and there is nowhere for a caller to put one; a header and a
|
|
16
|
+
* segment are the caller's, and those say where.
|
|
17
|
+
*/
|
|
18
|
+
explain(introspection) {
|
|
19
|
+
for (const property of this.names())
|
|
20
|
+
take(introspection, property);
|
|
21
|
+
}
|
|
22
|
+
/** The input properties this mapping fills, however its value names them. */
|
|
23
|
+
names() {
|
|
24
|
+
return typeof this.value === 'string'
|
|
25
|
+
? [this.value]
|
|
26
|
+
: Object.keys(this.value);
|
|
27
|
+
}
|
|
8
28
|
}
|
|
9
29
|
//# sourceMappingURL=Mapping.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Mapping.js","sourceRoot":"","sources":["../../../source/directives/map/Mapping.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Mapping.js","sourceRoot":"","sources":["../../../source/directives/map/Mapping.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAA;AAO7C,MAAM,OAAgB,OAAO;IACjB,KAAK,CAAG;IACR,OAAO,CAAU;IAE3B,YAAuB,KAAQ,EAAE,OAAiB;QAChD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;IAID;;;;;;;;OAQG;IACI,OAAO,CAAE,aAA4B;QAC1C,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,KAAK,EAAE;YACjC,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAA;IACjC,CAAC;IAED,6EAA6E;IACnE,KAAK;QACb,OAAO,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ;YACnC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;YACd,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAe,CAAC,CAAA;IACvC,CAAC;CACF"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { Mapping } from './Mapping.js';
|
|
2
2
|
import type { Parameter } from '../../RTD/index.js';
|
|
3
|
+
import type { Introspection } from '../../Introspection.js';
|
|
3
4
|
export declare class Segments extends Mapping<Record<string, string>> {
|
|
4
5
|
constructor(map: Record<string, string>);
|
|
6
|
+
/** A segment is the caller's, so it moves to the route rather than out of sight. */
|
|
7
|
+
explain(introspection: Introspection): void;
|
|
5
8
|
properties(_: unknown, parameters: Parameter[]): Record<string, string>;
|
|
6
9
|
}
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import assert from 'node:assert';
|
|
2
2
|
import { Mapping } from './Mapping.js';
|
|
3
|
+
import { take } from '../../Introspection.js';
|
|
3
4
|
export class Segments extends Mapping {
|
|
4
5
|
constructor(map) {
|
|
5
6
|
assert.ok(map.constructor === Object, '`map:segments` must be an object');
|
|
6
7
|
assert.ok(Object.values(map).every((value) => typeof value === 'string'), '`map:segments ` must be an object with string values');
|
|
7
8
|
super(map);
|
|
8
9
|
}
|
|
10
|
+
/** A segment is the caller's, so it moves to the route rather than out of sight. */
|
|
11
|
+
explain(introspection) {
|
|
12
|
+
for (const property of Object.keys(this.value)) {
|
|
13
|
+
const schema = take(introspection, property);
|
|
14
|
+
introspection.route ??= {};
|
|
15
|
+
introspection.route[property] = schema ?? { type: 'string' };
|
|
16
|
+
}
|
|
17
|
+
}
|
|
9
18
|
properties(_, parameters) {
|
|
10
19
|
return Object.entries(this.value).reduce((properties, [property, parameter]) => {
|
|
11
20
|
const cut = parameter[0] === '~';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Segments.js","sourceRoot":"","sources":["../../../source/directives/map/Segments.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAA;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"Segments.js","sourceRoot":"","sources":["../../../source/directives/map/Segments.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAA;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAA;AAI7C,MAAM,OAAO,QAAS,SAAQ,OAA+B;IAC3D,YAAoB,GAA2B;QAC7C,MAAM,CAAC,EAAE,CAAC,GAAG,CAAC,WAAW,KAAK,MAAM,EAAE,kCAAkC,CAAC,CAAA;QAEzE,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAA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AAA;QACnB,CAAC,EAAE,EAAE,CAAC,CAAA;IACR,CAAC;CACF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Tool } from './Tool.js';
|
|
2
|
+
import type { Context } from '../../HTTP/index.js';
|
|
3
|
+
import type { Introspection } from '../../Introspection.js';
|
|
4
|
+
import type { DirectiveFamily } from '../../RTD/index.js';
|
|
5
|
+
/** The name the family is declared under, and what `MCP` asks a method for. */
|
|
6
|
+
export declare const FAMILY = "mcp";
|
|
7
|
+
export declare class MCP implements DirectiveFamily<Tool> {
|
|
8
|
+
readonly name = "mcp";
|
|
9
|
+
readonly mandatory = false;
|
|
10
|
+
/** What this method is published as, which is what the nearest declaration says. */
|
|
11
|
+
static published(directives: Tool[] | undefined): Tool | null;
|
|
12
|
+
create(name: string, value: unknown, _: unknown, route: string): Tool;
|
|
13
|
+
/** What the route states this method is, which is the only thing that states it. */
|
|
14
|
+
explain(directives: Tool[], _: Context, introspection: Introspection): Introspection;
|
|
15
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import assert from 'node:assert';
|
|
2
|
+
import { Tool } from './Tool.js';
|
|
3
|
+
/** The name the family is declared under, and what `MCP` asks a method for. */
|
|
4
|
+
export const FAMILY = 'mcp';
|
|
5
|
+
export class MCP {
|
|
6
|
+
name = FAMILY;
|
|
7
|
+
mandatory = false;
|
|
8
|
+
/** What this method is published as, which is what the nearest declaration says. */
|
|
9
|
+
static published(directives) {
|
|
10
|
+
return directives?.[0] ?? null;
|
|
11
|
+
}
|
|
12
|
+
// eslint-disable-next-line max-params
|
|
13
|
+
create(name, value, _, route) {
|
|
14
|
+
assert.ok(name === 'tool', `Unknown directive: mcp:${name}`);
|
|
15
|
+
return new Tool(value, route);
|
|
16
|
+
}
|
|
17
|
+
/** What the route states this method is, which is the only thing that states it. */
|
|
18
|
+
explain(directives, _, introspection) {
|
|
19
|
+
const tool = MCP.published(directives);
|
|
20
|
+
if (tool === null)
|
|
21
|
+
return introspection;
|
|
22
|
+
return {
|
|
23
|
+
...introspection,
|
|
24
|
+
description: tool.description,
|
|
25
|
+
...tool.title === undefined ? {} : { title: tool.title }
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=MCP.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MCP.js","sourceRoot":"","sources":["../../../source/directives/mcp/MCP.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAA;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAKhC,+EAA+E;AAC/E,MAAM,CAAC,MAAM,MAAM,GAAG,KAAK,CAAA;AAE3B,MAAM,OAAO,GAAG;IACE,IAAI,GAAG,MAAM,CAAA;IACb,SAAS,GAAG,KAAK,CAAA;IAEjC,oFAAoF;IAC7E,MAAM,CAAC,SAAS,CAAE,UAA8B;QACrD,OAAO,UAAU,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAA;IAChC,CAAC;IAED,sCAAsC;IAC/B,MAAM,CAAE,IAAY,EAAE,KAAc,EAAE,CAAU,EAAE,KAAa;QACpE,MAAM,CAAC,EAAE,CAAC,IAAI,KAAK,MAAM,EAAE,0BAA0B,IAAI,EAAE,CAAC,CAAA;QAE5D,OAAO,IAAI,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;IAC/B,CAAC;IAED,oFAAoF;IAC7E,OAAO,CAAE,UAAkB,EAAE,CAAU,EAC5C,aAA4B;QAC5B,MAAM,IAAI,GAAG,GAAG,CAAC,SAAS,CAAC,UAAU,CAAC,CAAA;QAEtC,IAAI,IAAI,KAAK,IAAI;YACf,OAAO,aAAa,CAAA;QAEtB,OAAO;YACL,GAAG,aAAa;YAChB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,GAAG,IAAI,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE;SACzD,CAAA;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What one method is, published to a model. Declaring it is what publishes it, and what it
|
|
3
|
+
* says is what it says it is: a tool a model cannot read the purpose of is one it cannot
|
|
4
|
+
* choose, so there is no way to publish one that states nothing.
|
|
5
|
+
*
|
|
6
|
+
* A `title` is what a person is shown where a client lists what it may call — a name is an
|
|
7
|
+
* address and reads as one. A description alone is written as the value; both are written as
|
|
8
|
+
* a mapping.
|
|
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 is not true of both.
|
|
13
|
+
*/
|
|
14
|
+
export declare class Tool {
|
|
15
|
+
readonly description: string;
|
|
16
|
+
readonly title: string | undefined;
|
|
17
|
+
constructor(value: unknown, route: string);
|
|
18
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import assert from 'node:assert';
|
|
2
|
+
import { refusal } from '../../RPC/names.js';
|
|
3
|
+
import { segment } from '../../RTD/segment.js';
|
|
4
|
+
/**
|
|
5
|
+
* What one method is, published to a model. Declaring it is what publishes it, and what it
|
|
6
|
+
* says is what it says it is: a tool a model cannot read the purpose of is one it cannot
|
|
7
|
+
* choose, so there is no way to publish one that states nothing.
|
|
8
|
+
*
|
|
9
|
+
* A `title` is what a person is shown where a client lists what it may call — a name is an
|
|
10
|
+
* address and reads as one. A description alone is written as the value; both are written as
|
|
11
|
+
* a mapping.
|
|
12
|
+
*
|
|
13
|
+
* The operation states what it is too, and that is not this. An operation is written without
|
|
14
|
+
* knowledge of any route, and a tool is an operation and a route together — the same
|
|
15
|
+
* operation mounted twice is two tools, and one sentence is not true of both.
|
|
16
|
+
*/
|
|
17
|
+
export class Tool {
|
|
18
|
+
description;
|
|
19
|
+
title;
|
|
20
|
+
constructor(value, route) {
|
|
21
|
+
const stated = typeof value === 'string' ? { description: value } : value;
|
|
22
|
+
assert.ok(typeof stated === 'object' && stated !== null && !Array.isArray(stated), 'Directive mcp:tool: the value is what the tool is, or a `title` and a `description`');
|
|
23
|
+
const { description, title, ...rest } = stated;
|
|
24
|
+
assert.ok(Object.keys(rest).length === 0, `Directive mcp:tool: unknown ${Object.keys(rest).map((key) => `'${key}'`).join(', ')}`);
|
|
25
|
+
assert.ok(typeof description === 'string' && description.trim().length > 0, 'Directive mcp:tool: a description cannot be empty');
|
|
26
|
+
assert.ok(title === undefined || (typeof title === 'string' && title.trim().length > 0), 'Directive mcp:tool: a title cannot be empty');
|
|
27
|
+
// a tool is called by name, so a route that cannot be named cannot be one — said where
|
|
28
|
+
// the mistake is, rather than as a tool that is quietly never listed
|
|
29
|
+
assert.ok(refusal(segment(route)) === null, `Directive mcp:tool: '${route}' holds a segment no tool name can spell`);
|
|
30
|
+
this.description = description;
|
|
31
|
+
this.title = title;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=Tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tool.js","sourceRoot":"","sources":["../../../source/directives/mcp/Tool.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAA;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAE9C;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,IAAI;IACC,WAAW,CAAQ;IACnB,KAAK,CAAoB;IAEzC,YAAoB,KAAc,EAAE,KAAa;QAC/C,MAAM,MAAM,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAA;QAEzE,MAAM,CAAC,EAAE,CAAC,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAA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