@toa.io/extensions.exposition 1.0.0-alpha.284 → 1.0.0-alpha.286
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/components/exposition.octets/operations/delete.js +1 -1
- package/components/exposition.octets/operations/get.js +5 -2
- package/components/exposition.octets/operations/head.js +1 -1
- package/components/exposition.octets/operations/put.js +29 -37
- package/components/exposition.octets/types/toa.d.ts +1 -1
- package/components/identity.bans/manifest.toa.yaml +12 -13
- package/components/identity.bans/migrations/0001-system-properties.yaml +14 -0
- package/components/identity.bans/operations/transit.js +1 -1
- package/components/identity.bans/source/transit.ts +1 -1
- package/components/identity.bans/tsconfig.tsbuildinfo +1 -1
- package/components/identity.bans/types/toa.d.ts +5 -5
- package/components/identity.basic/events/principal.js +3 -1
- package/components/identity.basic/manifest.toa.yaml +17 -23
- package/components/identity.basic/migrations/0001-system-properties.yaml +14 -0
- package/components/identity.basic/migrations/0002-indexes.yaml +13 -0
- package/components/identity.basic/operations/add.js +1 -1
- package/components/identity.basic/operations/authenticate.js +2 -2
- package/components/identity.basic/operations/check.js +4 -2
- package/components/identity.basic/operations/delete.js +1 -1
- package/components/identity.basic/operations/incept.js +1 -1
- 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 +7 -8
- package/components/identity.basic/source/add.ts +5 -2
- package/components/identity.basic/source/authenticate.ts +11 -13
- package/components/identity.basic/source/check.ts +9 -6
- package/components/identity.basic/source/delete.ts +4 -1
- package/components/identity.basic/source/incept.ts +13 -10
- package/components/identity.basic/source/info.ts +4 -1
- package/components/identity.basic/source/lib/credentials.ts +2 -3
- package/components/identity.basic/source/transit.ts +27 -21
- package/components/identity.basic/tsconfig.tsbuildinfo +1 -1
- package/components/identity.basic/types/index.d.ts +7 -3
- package/components/identity.basic/types/toa.d.ts +5 -5
- package/components/identity.clients/manifest.toa.yaml +36 -40
- package/components/identity.clients/migrations/0001-system-properties.yaml +14 -0
- package/components/identity.clients/migrations/0002-indexes.yaml +4 -0
- package/components/identity.clients/operations/describe.js +1 -1
- package/components/identity.clients/operations/lib/canonical.js +1 -1
- package/components/identity.clients/operations/lib/cimd.js +3 -2
- package/components/identity.clients/operations/lib/redirect.js +7 -4
- package/components/identity.clients/operations/register.js +2 -2
- package/components/identity.clients/source/describe.ts +6 -8
- package/components/identity.clients/source/lib/Context.ts +6 -3
- package/components/identity.clients/source/lib/Entity.ts +1 -1
- package/components/identity.clients/source/lib/canonical.ts +1 -1
- package/components/identity.clients/source/lib/cimd.test.ts +8 -6
- package/components/identity.clients/source/lib/cimd.ts +24 -19
- package/components/identity.clients/source/lib/redirect.test.ts +8 -2
- package/components/identity.clients/source/lib/redirect.ts +12 -8
- package/components/identity.clients/source/register.ts +18 -18
- package/components/identity.clients/tsconfig.tsbuildinfo +1 -1
- package/components/identity.clients/types/toa.d.ts +5 -5
- package/components/identity.credentials/manifest.toa.yaml +4 -4
- package/components/identity.credentials/operations/list.js +8 -4
- package/components/identity.credentials/source/list.test.ts +39 -20
- package/components/identity.credentials/source/list.ts +12 -8
- package/components/identity.credentials/tsconfig.tsbuildinfo +1 -1
- package/components/identity.credentials/types/toa.d.ts +2 -2
- package/components/identity.federation/manifest.toa.yaml +23 -32
- package/components/identity.federation/migrations/0001-system-properties.yaml +14 -0
- package/components/identity.federation/migrations/0002-indexes.yaml +25 -0
- package/components/identity.federation/operations/authenticate.js +4 -2
- package/components/identity.federation/operations/create.js +2 -2
- 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 +1 -1
- package/components/identity.federation/operations/lib/decode.js +1 -1
- package/components/identity.federation/operations/lib/discovery.js +2 -2
- package/components/identity.federation/operations/lib/exchange.js +8 -4
- package/components/identity.federation/operations/lib/principal.js +1 -1
- package/components/identity.federation/operations/lib/resolve.js +1 -1
- package/components/identity.federation/operations/list.js +2 -2
- package/components/identity.federation/source/authenticate.ts +19 -17
- package/components/identity.federation/source/create.ts +6 -7
- package/components/identity.federation/source/decode.ts +4 -1
- package/components/identity.federation/source/delete.ts +4 -1
- package/components/identity.federation/source/incept.ts +2 -3
- package/components/identity.federation/source/lib/decode.ts +4 -7
- package/components/identity.federation/source/lib/discovery.test.ts +15 -5
- package/components/identity.federation/source/lib/discovery.ts +10 -9
- package/components/identity.federation/source/lib/exchange.ts +18 -15
- package/components/identity.federation/source/lib/jose.d.ts +1 -1
- package/components/identity.federation/source/lib/principal.ts +5 -3
- package/components/identity.federation/source/lib/resolve.ts +5 -1
- package/components/identity.federation/source/list.test.ts +26 -10
- package/components/identity.federation/source/list.ts +5 -2
- package/components/identity.federation/source/types/context.ts +5 -2
- package/components/identity.federation/source/types/entity.ts +2 -2
- package/components/identity.federation/tsconfig.tsbuildinfo +1 -1
- package/components/identity.federation/types/toa.d.ts +5 -5
- package/components/identity.grants/manifest.toa.yaml +27 -31
- package/components/identity.grants/migrations/0001-system-properties.yaml +14 -0
- package/components/identity.grants/migrations/0002-indexes.yaml +5 -0
- package/components/identity.grants/operations/authorize.js +1 -1
- package/components/identity.grants/operations/exchange.js +5 -2
- 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/list.js +1 -1
- package/components/identity.grants/operations/revoke.js +3 -2
- package/components/identity.grants/source/authorize.ts +27 -19
- package/components/identity.grants/source/exchange.ts +15 -11
- package/components/identity.grants/source/lib/code.ts +20 -8
- package/components/identity.grants/source/lib/identify.ts +1 -1
- package/components/identity.grants/source/list.ts +2 -2
- package/components/identity.grants/source/revoke.ts +9 -7
- package/components/identity.grants/tsconfig.tsbuildinfo +1 -1
- package/components/identity.grants/types/index.d.ts +3 -3
- package/components/identity.grants/types/toa.d.ts +5 -5
- package/components/identity.keys/manifest.toa.yaml +18 -23
- package/components/identity.keys/migrations/0001-system-properties.yaml +14 -0
- package/components/identity.keys/migrations/0002-indexes.yaml +4 -0
- package/components/identity.keys/operations/create.js +1 -1
- package/components/identity.keys/operations/disable.js +1 -1
- package/components/identity.keys/operations/revoke.js +1 -1
- package/components/identity.keys/source/create.ts +2 -3
- package/components/identity.keys/source/disable.ts +1 -1
- package/components/identity.keys/source/revoke.ts +2 -2
- package/components/identity.keys/tsconfig.tsbuildinfo +1 -1
- package/components/identity.keys/types/toa.d.ts +5 -5
- package/components/identity.otp/manifest.toa.yaml +16 -24
- package/components/identity.otp/migrations/0001-system-properties.yaml +14 -0
- package/components/identity.otp/migrations/0002-indexes.yaml +5 -0
- package/components/identity.otp/operations/authenticate.js +1 -1
- package/components/identity.otp/operations/issue.js +1 -1
- package/components/identity.otp/source/authenticate.ts +4 -7
- package/components/identity.otp/source/issue.ts +1 -1
- package/components/identity.otp/source/lib/Context.ts +1 -1
- package/components/identity.otp/tsconfig.tsbuildinfo +1 -1
- package/components/identity.otp/types/toa.d.ts +5 -5
- package/components/identity.passkeys/manifest.toa.yaml +45 -53
- package/components/identity.passkeys/migrations/0001-system-properties.yaml +14 -0
- package/components/identity.passkeys/migrations/0002-indexes.yaml +11 -0
- package/components/identity.passkeys/operations/authenticate.js +1 -1
- package/components/identity.passkeys/operations/challenge.js +6 -3
- package/components/identity.passkeys/operations/create.js +1 -1
- package/components/identity.passkeys/operations/delete.js +1 -1
- package/components/identity.passkeys/operations/list.js +1 -1
- package/components/identity.passkeys/operations/use.js +1 -1
- package/components/identity.passkeys/source/authenticate.ts +3 -4
- package/components/identity.passkeys/source/challenge.ts +29 -25
- package/components/identity.passkeys/source/create.ts +8 -6
- package/components/identity.passkeys/source/delete.ts +4 -1
- package/components/identity.passkeys/source/list.ts +4 -1
- package/components/identity.passkeys/source/types/Context.ts +1 -1
- package/components/identity.passkeys/source/use.ts +12 -10
- package/components/identity.passkeys/tsconfig.tsbuildinfo +1 -1
- package/components/identity.passkeys/types/toa.d.ts +5 -5
- package/components/identity.roles/manifest.toa.yaml +12 -16
- package/components/identity.roles/migrations/0001-system-properties.yaml +14 -0
- package/components/identity.roles/migrations/0002-indexes.yaml +8 -0
- package/components/identity.roles/operations/grant.js +1 -1
- package/components/identity.roles/operations/list.js +1 -1
- package/components/identity.roles/operations/principal.js +2 -2
- package/components/identity.roles/source/grant.ts +7 -6
- package/components/identity.roles/source/list.ts +1 -1
- package/components/identity.roles/source/principal.ts +5 -7
- package/components/identity.roles/tsconfig.tsbuildinfo +1 -1
- package/components/identity.roles/types/toa.d.ts +5 -5
- package/components/identity.tokens/manifest.toa.yaml +17 -15
- package/components/identity.tokens/migrations/0001-system-properties.yaml +14 -0
- package/components/identity.tokens/operations/authenticate.js +2 -2
- package/components/identity.tokens/operations/decrypt.js +11 -5
- package/components/identity.tokens/operations/encrypt.js +2 -2
- package/components/identity.tokens/operations/issue.js +2 -4
- package/components/identity.tokens/operations/lib/form.js +1 -1
- package/components/identity.tokens/operations/lib/key.js +1 -1
- package/components/identity.tokens/operations/revoke.js +1 -1
- package/components/identity.tokens/source/authenticate.test.ts +22 -16
- package/components/identity.tokens/source/authenticate.ts +7 -10
- package/components/identity.tokens/source/decrypt.test.ts +62 -29
- package/components/identity.tokens/source/decrypt.ts +30 -27
- package/components/identity.tokens/source/encrypt.test.ts +21 -16
- package/components/identity.tokens/source/encrypt.ts +8 -11
- package/components/identity.tokens/source/issue.test.ts +4 -2
- package/components/identity.tokens/source/issue.ts +6 -8
- package/components/identity.tokens/source/lib/form.ts +5 -9
- package/components/identity.tokens/source/lib/jose.d.ts +1 -1
- package/components/identity.tokens/source/lib/key.ts +1 -1
- package/components/identity.tokens/source/lib/paseto.test.ts +17 -6
- package/components/identity.tokens/source/revoke.ts +1 -1
- package/components/identity.tokens/tsconfig.tsbuildinfo +1 -1
- package/components/identity.tokens/types/index.d.ts +13 -4
- package/components/identity.tokens/types/toa.d.ts +5 -5
- package/context.toa.yaml +2 -2
- package/cucumber.mjs +3 -0
- package/documentation/access.md +4 -3
- package/documentation/cache.md +17 -3
- package/documentation/components.md +2 -2
- package/documentation/credentials.md +2 -2
- package/documentation/identity.md +7 -9
- package/documentation/map.md +2 -2
- package/documentation/mcp.md +23 -17
- package/documentation/notes/peers.md +1 -1
- package/documentation/notes/throttling.md +1 -1
- package/documentation/octets.md +4 -4
- package/documentation/protocol.md +3 -3
- package/documentation/query.md +14 -8
- package/documentation/rpc.md +45 -31
- package/documentation/tracing.md +3 -3
- package/documentation/tree.md +1 -1
- package/features/auth.assert.feature +2 -2
- package/features/auth.bearer.feature +1 -1
- package/features/auth.claims.feature +5 -5
- package/features/auth.incept.feature +2 -2
- package/features/authorities.federation.feature +1 -1
- package/features/configuration.feature +3 -4
- package/features/credentials.feature +9 -9
- package/features/dev.feature +1 -0
- package/features/dynamic.feature +1 -0
- package/features/errors.feature +21 -0
- package/features/etag.feature +0 -86
- package/features/identity.bans.feature +3 -3
- package/features/identity.basic.feature +9 -9
- package/features/identity.federation.feature +11 -11
- package/features/identity.tokens.custom.feature +5 -5
- package/features/identity.tokens.feature +2 -2
- package/features/interruptions.feature +1 -0
- package/features/introspection.map.feature +4 -4
- package/features/io.throttle.feature +1 -0
- package/features/map.feature +2 -2
- package/features/mcp.feature +32 -28
- package/features/oauth.grants.feature +1 -1
- package/features/octets.cloudinary.feature +1 -1
- package/features/octets.download.feature +1 -0
- package/features/require.feature +1 -2
- package/features/rpc.feature +21 -21
- package/features/steps/Captures.ts +1 -1
- package/features/steps/Cloudinary.ts +1 -2
- package/features/steps/Common.ts +4 -5
- package/features/steps/Components.ts +17 -12
- package/features/steps/Database.ts +42 -23
- package/features/steps/Gateway.ts +55 -71
- package/features/steps/HTTP.ts +12 -15
- package/features/steps/IDP.ts +118 -94
- package/features/steps/Identity.ts +3 -3
- package/features/steps/OTP.ts +3 -3
- package/features/steps/Parameters.ts +20 -10
- package/features/steps/Probe.ts +9 -7
- package/features/steps/Realtime.ts +40 -22
- package/features/steps/Workspace.ts +10 -7
- package/features/steps/components/audit/operations/record.js +1 -1
- package/features/steps/components/echo/operations/affect.js +1 -1
- package/features/steps/components/echo/operations/compute.js +1 -1
- package/features/steps/components/echo/operations/echo.js +1 -1
- package/features/steps/components/echo/operations/error.js +1 -1
- package/features/steps/components/echo/operations/identity.js +1 -1
- package/features/steps/components/echo/operations/parameters.js +1 -1
- package/features/steps/components/echo/operations/ping.js +1 -1
- package/features/steps/components/echo/operations/unwrap.js +1 -1
- package/features/steps/components/greeter/operations/greet.js +1 -1
- package/features/steps/components/notify/operations/send.js +1 -1
- package/features/steps/components/octets.tester/operations/authority.js +1 -1
- package/features/steps/components/octets.tester/operations/bar.js +1 -1
- package/features/steps/components/octets.tester/operations/baz.js +1 -1
- package/features/steps/components/octets.tester/operations/concat.js +1 -1
- package/features/steps/components/octets.tester/operations/echo.js +1 -1
- package/features/steps/components/octets.tester/operations/err.js +1 -1
- package/features/steps/components/octets.tester/operations/foo.js +1 -1
- package/features/steps/components/octets.tester/operations/id.js +1 -1
- package/features/steps/components/octets.tester/operations/identity.js +1 -1
- package/features/steps/components/octets.tester/operations/redirect.js +6 -4
- package/features/steps/components/octets.tester/operations/yex.js +1 -1
- package/features/steps/components/octets.tester/operations/yield.js +1 -1
- package/features/steps/components/orders/manifest.toa.yaml +10 -12
- package/features/steps/components/orders/operations/create.js +4 -2
- package/features/steps/components/pots/manifest.toa.yaml +15 -20
- package/features/steps/components/pots/migrations/0002-indexes.yaml +4 -0
- package/features/steps/components/pricing/operations/quote.js +1 -1
- package/features/steps/components/sequences/manifest.toa.yaml +0 -1
- package/features/steps/components/sequences/operations/numbers.js +1 -1
- package/features/steps/components/sequences/operations/tokens.js +3 -3
- package/features/steps/components/users/manifest.toa.yaml +3 -5
- package/features/steps/components/users/operations/create.js +1 -1
- package/features/steps/components/users.properties/manifest.toa.yaml +5 -6
- package/features/steps/map.ts +2 -2
- package/features/timestamps.feature +1 -1
- package/package.json +7 -7
- package/readme.md +11 -11
- package/schemas/annotation.cos.yaml +1 -3
- package/schemas/method.cos.yaml +2 -0
- package/source/Branch.test.ts +2 -2
- package/source/Branch.ts +3 -5
- package/source/Composition.ts +5 -5
- package/source/Directive.test.ts +38 -20
- package/source/Directive.ts +61 -47
- package/source/Endpoint.test.ts +1 -1
- package/source/Endpoint.ts +27 -92
- package/source/Factory.ts +26 -12
- package/source/Gateway.ts +87 -76
- package/source/HTTP/Context.ts +23 -30
- package/source/HTTP/Probe.ts +7 -9
- package/source/HTTP/Server.ts +88 -69
- package/source/HTTP/Timing.ts +6 -21
- package/source/HTTP/address.test.ts +8 -2
- package/source/HTTP/address.ts +2 -3
- package/source/HTTP/exceptions.ts +20 -18
- package/source/HTTP/formats/form.ts +1 -1
- package/source/HTTP/formats/json.ts +2 -2
- package/source/HTTP/formats/msgpack.ts +3 -4
- package/source/HTTP/formats/text.ts +2 -2
- package/source/HTTP/formats/yaml.test.ts +4 -1
- package/source/HTTP/formats/yaml.ts +14 -11
- package/source/HTTP/messages.test.ts +38 -28
- package/source/HTTP/messages.ts +44 -98
- package/source/Interception.ts +3 -4
- package/source/Introspection.ts +29 -14
- package/source/MCP/Server.ts +114 -54
- package/source/MCP/discover.ts +6 -7
- package/source/MCP/errors.ts +7 -8
- package/source/MCP/schema.test.ts +9 -3
- package/source/MCP/schema.ts +12 -16
- package/source/MCP/tools.ts +33 -27
- package/source/MCP/types.ts +4 -1
- package/source/Mapping.ts +25 -27
- package/source/Query.ts +58 -44
- package/source/RPC/Context.ts +8 -11
- package/source/RPC/Dispatcher.ts +46 -26
- package/source/RPC/errors.test.ts +41 -16
- package/source/RPC/errors.ts +9 -10
- package/source/RPC/names.test.ts +51 -32
- package/source/RPC/names.ts +26 -32
- package/source/RTD/Directives.ts +21 -10
- package/source/RTD/Endpoint.ts +4 -1
- package/source/RTD/Method.ts +8 -6
- package/source/RTD/Node.ts +32 -34
- package/source/RTD/Route.ts +18 -21
- package/source/RTD/Tree.ts +18 -18
- package/source/RTD/factory.ts +13 -16
- package/source/RTD/segment.ts +12 -10
- package/source/RTD/syntax/parse.test.ts +12 -6
- package/source/RTD/syntax/parse.ts +30 -26
- package/source/RTD/syntax/types.ts +17 -1
- package/source/RTD/walk.test.ts +64 -27
- package/source/Remotes.test.ts +25 -4
- package/source/Remotes.ts +9 -4
- package/source/Tenant.ts +12 -12
- package/source/deployment.ts +20 -20
- package/source/directives/auth/Anonymous.test.ts +8 -2
- package/source/directives/auth/Anonymous.ts +5 -8
- package/source/directives/auth/Anyone.ts +3 -3
- package/source/directives/auth/Assert.ts +10 -10
- package/source/directives/auth/Authorization.ts +83 -69
- package/source/directives/auth/Delegate.test.ts +2 -2
- package/source/directives/auth/Delegate.ts +8 -10
- package/source/directives/auth/Echo.ts +5 -8
- package/source/directives/auth/Federation.ts +30 -21
- package/source/directives/auth/Id.ts +7 -4
- package/source/directives/auth/Incept.ts +32 -26
- package/source/directives/auth/Input.ts +36 -20
- package/source/directives/auth/Role.test.ts +49 -23
- package/source/directives/auth/Role.ts +29 -22
- package/source/directives/auth/Rule.ts +13 -8
- package/source/directives/auth/Scheme.ts +7 -7
- package/source/directives/auth/create.ts +1 -1
- package/source/directives/auth/schemes.ts +1 -1
- package/source/directives/auth/split.ts +2 -3
- package/source/directives/auth/types.ts +5 -2
- package/source/directives/cache/Cache.ts +44 -9
- package/source/directives/cache/Control.ts +25 -26
- package/source/directives/cache/Exact.ts +1 -1
- package/source/directives/cache/etag.ts +38 -0
- package/source/directives/cors/CORS.ts +9 -7
- package/source/directives/dev/Development.ts +3 -4
- package/source/directives/dev/Faulty.ts +11 -6
- package/source/directives/dev/Sleep.ts +5 -7
- package/source/directives/dev/Stub.ts +2 -2
- package/source/directives/dev/Throw.ts +2 -2
- package/source/directives/flow/Compose.ts +26 -20
- package/source/directives/flow/Fetch.ts +15 -15
- package/source/directives/flow/Flow.ts +9 -8
- package/source/directives/index.ts +11 -2
- package/source/directives/io/IO.ts +29 -20
- package/source/directives/io/Input.ts +9 -12
- package/source/directives/io/Output.ts +20 -23
- package/source/directives/io/Status.test.ts +12 -8
- package/source/directives/io/Status.ts +9 -8
- package/source/directives/io/Throttle.ts +6 -7
- package/source/directives/io/lib/throttle/Configuration.test.ts +32 -23
- package/source/directives/io/lib/throttle/Configuration.ts +14 -9
- package/source/directives/io/lib/throttle/Keys.ts +15 -10
- package/source/directives/io/lib/throttle/Quotas.test.ts +33 -17
- package/source/directives/io/lib/throttle/Quotas.ts +20 -26
- package/source/directives/io/lib/throttle/Sync.test.ts +14 -10
- package/source/directives/io/lib/throttle/Sync.ts +9 -12
- package/source/directives/io/lib/throttle/Warning.ts +3 -4
- package/source/directives/io/lib/throttle/components/IP.ts +4 -5
- package/source/directives/io/lib/throttle/components/Identity.ts +1 -1
- package/source/directives/io/lib/throttle/components/Path.ts +1 -1
- package/source/directives/io/lib/throttle/components/Route.ts +2 -2
- package/source/directives/io/lib/throttle/components/Segment.ts +2 -2
- package/source/directives/io/lib/throttle/conditions/Status.ts +2 -2
- package/source/directives/io/schemas.test.ts +12 -6
- package/source/directives/map/Authority.ts +2 -2
- package/source/directives/map/Buffer.ts +2 -2
- package/source/directives/map/Claims.ts +25 -20
- package/source/directives/map/Headers.ts +17 -13
- package/source/directives/map/Language.ts +8 -5
- package/source/directives/map/Languages.ts +9 -3
- package/source/directives/map/Map.ts +25 -12
- package/source/directives/map/Mapping.ts +9 -6
- package/source/directives/map/Properties.ts +1 -1
- package/source/directives/map/Segments.ts +22 -15
- package/source/directives/mcp/MCP.ts +14 -5
- package/source/directives/mcp/Tool.test.ts +42 -6
- package/source/directives/mcp/Tool.ts +38 -7
- package/source/directives/oauth/Discovery.ts +7 -11
- package/source/directives/oauth/documents.ts +11 -14
- package/source/directives/octets/Context.ts +6 -3
- package/source/directives/octets/Delete.ts +33 -25
- package/source/directives/octets/Directive.ts +5 -1
- package/source/directives/octets/Get.ts +13 -21
- package/source/directives/octets/Octets.ts +20 -15
- package/source/directives/octets/Put.ts +62 -27
- package/source/directives/octets/Workflow.ts +18 -12
- package/source/directives/octets/bytes.ts +1 -1
- package/source/directives/octets/schemas.test.ts +8 -14
- package/source/directives/octets/workflows/Execution.ts +19 -21
- package/source/directives/octets/workflows/Workflow.ts +10 -7
- package/source/directives/require/Headers.ts +3 -4
- package/source/directives/require/Require.ts +3 -4
- package/source/exceptions.ts +19 -12
- package/source/index.ts +1 -1
- package/source/manifest.test.ts +4 -1
- package/source/manifest.ts +19 -13
- package/source/octets.d.ts +1 -1
- package/source/root.ts +3 -2
- package/source/schemas.test.ts +17 -3
- package/transpiled/Branch.js.map +1 -1
- package/transpiled/Composition.js.map +1 -1
- package/transpiled/Directive.js +6 -2
- package/transpiled/Directive.js.map +1 -1
- package/transpiled/Endpoint.d.ts +0 -2
- package/transpiled/Endpoint.js +11 -52
- package/transpiled/Endpoint.js.map +1 -1
- package/transpiled/Factory.d.ts +2 -1
- package/transpiled/Factory.js +1 -0
- package/transpiled/Factory.js.map +1 -1
- package/transpiled/Gateway.d.ts +2 -1
- package/transpiled/Gateway.js +24 -15
- package/transpiled/Gateway.js.map +1 -1
- package/transpiled/HTTP/Context.d.ts +0 -3
- package/transpiled/HTTP/Context.js +7 -9
- package/transpiled/HTTP/Context.js.map +1 -1
- package/transpiled/HTTP/Probe.js.map +1 -1
- package/transpiled/HTTP/Server.js +19 -4
- package/transpiled/HTTP/Server.js.map +1 -1
- package/transpiled/HTTP/Timing.d.ts +1 -2
- package/transpiled/HTTP/Timing.js +2 -10
- package/transpiled/HTTP/Timing.js.map +1 -1
- package/transpiled/HTTP/address.js.map +1 -1
- package/transpiled/HTTP/exceptions.js.map +1 -1
- package/transpiled/HTTP/formats/form.js.map +1 -1
- package/transpiled/HTTP/formats/json.js.map +1 -1
- package/transpiled/HTTP/formats/msgpack.js.map +1 -1
- package/transpiled/HTTP/formats/text.js.map +1 -1
- package/transpiled/HTTP/formats/yaml.js +4 -1
- package/transpiled/HTTP/formats/yaml.js.map +1 -1
- package/transpiled/HTTP/messages.d.ts +3 -2
- package/transpiled/HTTP/messages.js +1 -43
- package/transpiled/HTTP/messages.js.map +1 -1
- package/transpiled/Interception.js.map +1 -1
- package/transpiled/Introspection.d.ts +2 -0
- package/transpiled/Introspection.js +13 -2
- package/transpiled/Introspection.js.map +1 -1
- package/transpiled/MCP/Server.js +15 -4
- package/transpiled/MCP/Server.js.map +1 -1
- package/transpiled/MCP/discover.js.map +1 -1
- package/transpiled/MCP/errors.js.map +1 -1
- package/transpiled/MCP/schema.js +1 -1
- package/transpiled/MCP/schema.js.map +1 -1
- package/transpiled/MCP/tools.js +10 -6
- package/transpiled/MCP/tools.js.map +1 -1
- package/transpiled/MCP/types.d.ts +3 -1
- package/transpiled/Mapping.d.ts +2 -2
- package/transpiled/Mapping.js +3 -5
- package/transpiled/Mapping.js.map +1 -1
- package/transpiled/Query.d.ts +6 -2
- package/transpiled/Query.js +23 -8
- package/transpiled/Query.js.map +1 -1
- package/transpiled/RPC/Context.js +0 -7
- package/transpiled/RPC/Context.js.map +1 -1
- package/transpiled/RPC/Dispatcher.js +4 -1
- package/transpiled/RPC/Dispatcher.js.map +1 -1
- package/transpiled/RPC/errors.js.map +1 -1
- package/transpiled/RPC/names.d.ts +3 -2
- package/transpiled/RPC/names.js +1 -1
- package/transpiled/RPC/names.js.map +1 -1
- package/transpiled/RTD/Directives.d.ts +1 -1
- package/transpiled/RTD/Method.js +1 -3
- package/transpiled/RTD/Method.js.map +1 -1
- package/transpiled/RTD/Node.js +5 -4
- package/transpiled/RTD/Node.js.map +1 -1
- package/transpiled/RTD/Route.js +4 -1
- package/transpiled/RTD/Route.js.map +1 -1
- package/transpiled/RTD/Tree.js +1 -1
- package/transpiled/RTD/Tree.js.map +1 -1
- package/transpiled/RTD/factory.js.map +1 -1
- package/transpiled/RTD/segment.js.map +1 -1
- package/transpiled/RTD/syntax/parse.js.map +1 -1
- package/transpiled/RTD/syntax/types.d.ts +6 -0
- package/transpiled/RTD/syntax/types.js +10 -1
- package/transpiled/RTD/syntax/types.js.map +1 -1
- package/transpiled/Remotes.js.map +1 -1
- package/transpiled/Tenant.d.ts +1 -1
- package/transpiled/Tenant.js.map +1 -1
- package/transpiled/deployment.d.ts +3 -0
- package/transpiled/deployment.js +6 -1
- package/transpiled/deployment.js.map +1 -1
- package/transpiled/directives/auth/Anonymous.js +1 -3
- package/transpiled/directives/auth/Anonymous.js.map +1 -1
- package/transpiled/directives/auth/Anyone.js.map +1 -1
- package/transpiled/directives/auth/Assert.js.map +1 -1
- package/transpiled/directives/auth/Authorization.js +7 -3
- package/transpiled/directives/auth/Authorization.js.map +1 -1
- package/transpiled/directives/auth/Delegate.js.map +1 -1
- package/transpiled/directives/auth/Echo.js +1 -3
- package/transpiled/directives/auth/Echo.js.map +1 -1
- package/transpiled/directives/auth/Federation.js +3 -7
- package/transpiled/directives/auth/Federation.js.map +1 -1
- package/transpiled/directives/auth/Id.js.map +1 -1
- package/transpiled/directives/auth/Incept.js +1 -1
- package/transpiled/directives/auth/Incept.js.map +1 -1
- package/transpiled/directives/auth/Input.js.map +1 -1
- package/transpiled/directives/auth/Role.js.map +1 -1
- package/transpiled/directives/auth/Rule.js.map +1 -1
- package/transpiled/directives/auth/Scheme.js +1 -2
- package/transpiled/directives/auth/Scheme.js.map +1 -1
- package/transpiled/directives/auth/create.js.map +1 -1
- package/transpiled/directives/auth/schemes.js.map +1 -1
- package/transpiled/directives/auth/split.js.map +1 -1
- package/transpiled/directives/auth/types.d.ts +3 -1
- package/transpiled/directives/cache/Cache.js +28 -2
- package/transpiled/directives/cache/Cache.js.map +1 -1
- package/transpiled/directives/cache/Control.js +1 -1
- package/transpiled/directives/cache/Control.js.map +1 -1
- package/transpiled/directives/cache/etag.d.ts +10 -0
- package/transpiled/directives/cache/etag.js +30 -0
- package/transpiled/directives/cache/etag.js.map +1 -0
- package/transpiled/directives/cors/CORS.js.map +1 -1
- package/transpiled/directives/dev/Development.js.map +1 -1
- package/transpiled/directives/dev/Faulty.js.map +1 -1
- package/transpiled/directives/dev/Sleep.js.map +1 -1
- package/transpiled/directives/dev/Stub.js.map +1 -1
- package/transpiled/directives/dev/Throw.js.map +1 -1
- package/transpiled/directives/flow/Compose.js +7 -3
- package/transpiled/directives/flow/Compose.js.map +1 -1
- package/transpiled/directives/flow/Fetch.js.map +1 -1
- package/transpiled/directives/flow/Flow.js.map +1 -1
- package/transpiled/directives/index.js +11 -1
- package/transpiled/directives/index.js.map +1 -1
- package/transpiled/directives/io/IO.d.ts +1 -1
- package/transpiled/directives/io/IO.js.map +1 -1
- package/transpiled/directives/io/Input.js +1 -1
- package/transpiled/directives/io/Input.js.map +1 -1
- package/transpiled/directives/io/Output.js +3 -3
- package/transpiled/directives/io/Output.js.map +1 -1
- package/transpiled/directives/io/Status.js.map +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/Configuration.js +8 -2
- package/transpiled/directives/io/lib/throttle/Configuration.js.map +1 -1
- package/transpiled/directives/io/lib/throttle/Keys.js.map +1 -1
- package/transpiled/directives/io/lib/throttle/Quotas.js +4 -3
- package/transpiled/directives/io/lib/throttle/Quotas.js.map +1 -1
- package/transpiled/directives/io/lib/throttle/Sync.d.ts +1 -1
- package/transpiled/directives/io/lib/throttle/Sync.js.map +1 -1
- package/transpiled/directives/io/lib/throttle/Warning.js.map +1 -1
- package/transpiled/directives/io/lib/throttle/components/IP.js.map +1 -1
- package/transpiled/directives/io/lib/throttle/components/Identity.js.map +1 -1
- package/transpiled/directives/io/lib/throttle/components/Path.js.map +1 -1
- package/transpiled/directives/io/lib/throttle/components/Route.js.map +1 -1
- package/transpiled/directives/io/lib/throttle/components/Segment.js.map +1 -1
- package/transpiled/directives/io/lib/throttle/conditions/Status.js.map +1 -1
- package/transpiled/directives/map/Authority.js.map +1 -1
- package/transpiled/directives/map/Buffer.js.map +1 -1
- package/transpiled/directives/map/Claims.js.map +1 -1
- package/transpiled/directives/map/Headers.js.map +1 -1
- package/transpiled/directives/map/Language.js.map +1 -1
- package/transpiled/directives/map/Languages.js.map +1 -1
- package/transpiled/directives/map/Map.js.map +1 -1
- package/transpiled/directives/map/Mapping.js.map +1 -1
- package/transpiled/directives/map/Properties.js.map +1 -1
- package/transpiled/directives/map/Segments.js.map +1 -1
- package/transpiled/directives/mcp/MCP.js +7 -1
- package/transpiled/directives/mcp/MCP.js.map +1 -1
- package/transpiled/directives/mcp/Tool.d.ts +6 -1
- package/transpiled/directives/mcp/Tool.js +16 -3
- package/transpiled/directives/mcp/Tool.js.map +1 -1
- package/transpiled/directives/oauth/Discovery.js.map +1 -1
- package/transpiled/directives/oauth/documents.js.map +1 -1
- package/transpiled/directives/octets/Context.js +1 -1
- package/transpiled/directives/octets/Context.js.map +1 -1
- package/transpiled/directives/octets/Delete.js.map +1 -1
- package/transpiled/directives/octets/Directive.js.map +1 -1
- package/transpiled/directives/octets/Get.js.map +1 -1
- package/transpiled/directives/octets/Octets.js +1 -1
- package/transpiled/directives/octets/Octets.js.map +1 -1
- package/transpiled/directives/octets/Put.js.map +1 -1
- package/transpiled/directives/octets/Workflow.js.map +1 -1
- package/transpiled/directives/octets/bytes.js.map +1 -1
- package/transpiled/directives/octets/workflows/Execution.js +1 -2
- package/transpiled/directives/octets/workflows/Execution.js.map +1 -1
- package/transpiled/directives/octets/workflows/Workflow.js.map +1 -1
- package/transpiled/directives/require/Headers.js.map +1 -1
- package/transpiled/directives/require/Require.js.map +1 -1
- package/transpiled/exceptions.js.map +1 -1
- package/transpiled/index.d.ts +1 -1
- package/transpiled/index.js +1 -1
- package/transpiled/index.js.map +1 -1
- package/transpiled/manifest.js +5 -1
- package/transpiled/manifest.js.map +1 -1
- package/transpiled/root.js.map +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/CHANGELOG.md +0 -541
- package/source/redact.test.ts +0 -27
- package/source/redact.ts +0 -21
- package/transpiled/redact.d.ts +0 -5
- package/transpiled/redact.js +0 -17
- package/transpiled/redact.js.map +0 -1
|
@@ -69,7 +69,8 @@ function validate(id, metadata) {
|
|
|
69
69
|
// the document names itself, so one client's cannot claim another's identity
|
|
70
70
|
if (metadata.client_id !== id)
|
|
71
71
|
return ERR_UNKNOWN_CLIENT;
|
|
72
|
-
if (!Array.isArray(metadata.redirect_uris) ||
|
|
72
|
+
if (!Array.isArray(metadata.redirect_uris) ||
|
|
73
|
+
metadata.redirect_uris.length === 0 ||
|
|
73
74
|
metadata.redirect_uris.some((uri) => typeof uri !== 'string'))
|
|
74
75
|
return ERR_UNKNOWN_CLIENT;
|
|
75
76
|
return {
|
|
@@ -83,4 +84,4 @@ function validate(id, metadata) {
|
|
|
83
84
|
const CACHE = 'cimd:';
|
|
84
85
|
/** Held in place of a document that could not be read, so a bad id is not refetched. */
|
|
85
86
|
const MISS = '';
|
|
86
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
87
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2ltZC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NvdXJjZS9saWIvY2ltZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sYUFBYSxDQUFBO0FBQ3hDLE9BQU8sRUFBRSxrQkFBa0IsRUFBRSxNQUFNLGFBQWEsQ0FBQTtBQUloRDs7OztHQUlHO0FBQ0gsTUFBTSxDQUFDLEtBQUssVUFBVSxJQUFJLENBQUMsRUFBVSxFQUFFLE9BQWdCO0lBQ3JELHFGQUFxRjtJQUNyRixnRkFBZ0Y7SUFDaEYsSUFBSSxDQUFDLE9BQU8sQ0FBQyxFQUFFLEVBQUUsT0FBTyxDQUFDLGFBQWEsQ0FBQyxLQUFLLENBQUM7UUFBRSxPQUFPLGtCQUFrQixDQUFBO0lBRXhFLE1BQU0sR0FBRyxHQUFHLEtBQUssR0FBRyxVQUFVLENBQUMsUUFBUSxDQUFDLENBQUMsTUFBTSxDQUFDLEVBQUUsQ0FBQyxDQUFDLE1BQU0sQ0FBQyxLQUFLLENBQUMsQ0FBQTtJQU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return a.protocol === 'http:' &&
|
|
19
|
-
|
|
20
|
-
a.
|
|
18
|
+
return (a.protocol === 'http:' &&
|
|
19
|
+
b.protocol === 'http:' &&
|
|
20
|
+
LOOPBACK.has(a.hostname) &&
|
|
21
|
+
a.hostname === b.hostname &&
|
|
22
|
+
a.pathname === b.pathname &&
|
|
23
|
+
a.search === b.search);
|
|
21
24
|
}
|
|
22
25
|
function parse(value) {
|
|
23
26
|
try {
|
|
@@ -29,4 +32,4 @@ function parse(value) {
|
|
|
29
32
|
}
|
|
30
33
|
/** `localhost` resolves through the host's own configuration, which RFC 8252 §8.3 warns of. */
|
|
31
34
|
const LOOPBACK = new Set(['127.0.0.1', '[::1]', 'localhost']);
|
|
32
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
35
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVkaXJlY3QuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zb3VyY2UvbGliL3JlZGlyZWN0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7OztHQVFHO0FBQ0gsTUFBTSxVQUFVLE9BQU8sQ0FBQyxVQUFvQixFQUFFLFFBQWdCO0lBQzVELE9BQU8sVUFBVSxDQUFDLElBQUksQ0FBQyxDQUFDLEdBQUcsRUFBRSxFQUFFLENBQUMsR0FBRyxLQUFLLFFBQVEsSUFBSSxRQUFRLENBQUMsR0FBRyxFQUFFLFFBQVEsQ0FBQyxDQUFDLENBQUE7QUFDOUUsQ0FBQztBQUVELFNBQVMsUUFBUSxDQUFDLFVBQWtCLEVBQUUsUUFBZ0I7SUFDcEQsTUFBTSxDQUFDLEdBQUcsS0FBSyxDQUFDLFVBQVUsQ0FBQyxDQUFBO0lBQzNCLE1BQU0sQ0FBQyxHQUFHLEtBQUssQ0FBQyxRQUFRLENBQUMsQ0FBQTtJQUV6QixJQUFJLENBQUMsS0FBSyxJQUFJLElBQUksQ0FBQyxLQUFLLElBQUk7UUFBRSxPQUFPLEtBQUssQ0FBQTtJQUUxQyxPQUFPLENBQ0wsQ0FBQyxDQUFDLFFBQVEsS0FBSyxPQUFPO1FBQ3RCLENBQUMsQ0FBQyxRQUFRLEtBQUssT0FBTztRQUN0QixRQUFRLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQyxRQUFRLENBQUM7UUFDeEIsQ0FBQyxDQUFDLFFBQVEsS0FBSyxDQUFDLENBQUMsUUFBUTtRQUN6QixDQUFDLENBQUMsUUFBUSxLQUFLLENBQUMsQ0FBQyxRQUFRO1FBQ3pCLENBQUMsQ0FBQyxNQUFNLEtBQUssQ0FBQyxDQUFDLE1BQU0sQ0FDdEIsQ0FBQTtBQUNILENBQUM7QUFFRCxTQUFTLEtBQUssQ0FBQyxLQUFhO0lBQzFCLElBQUksQ0FBQztRQUNILE9BQU8sSUFBSSxHQUFHLENBQUMsS0FBSyxDQUFDLENBQUE7SUFDdkIsQ0FBQztJQUFDLE1BQU0sQ0FBQztRQUNQLE9BQU8sSUFBSSxDQUFBO0lBQ2IsQ0FBQztBQUNILENBQUM7QUFFRCwrRkFBK0Y7QUFDL0YsTUFBTSxRQUFRLEdBQUcsSUFBSSxHQUFHLENBQUMsQ0FBQyxXQUFXLEVBQUUsT0FBTyxFQUFFLFdBQVcsQ0FBQyxDQUFDLENBQUEifQ==
|
|
@@ -47,7 +47,7 @@ export class Effect {
|
|
|
47
47
|
return {
|
|
48
48
|
client_id: id,
|
|
49
49
|
// of the record, not of this request: registering again answers what it answered
|
|
50
|
-
client_id_issued_at: Math.floor((entity.
|
|
50
|
+
client_id_issued_at: Math.floor((entity.CREATED ?? Date.now()) / 1000),
|
|
51
51
|
client_name: entity.name,
|
|
52
52
|
client_uri: entity.uri,
|
|
53
53
|
logo_uri: entity.logo,
|
|
@@ -81,4 +81,4 @@ function invalid(error, description) {
|
|
|
81
81
|
}
|
|
82
82
|
const BAD_REQUEST = 400;
|
|
83
83
|
const LOOPBACK = new Set(['127.0.0.1', '[::1]', 'localhost']);
|
|
84
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
84
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVnaXN0ZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zb3VyY2UvcmVnaXN0ZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFFBQVEsRUFBRSxNQUFNLGdCQUFnQixDQUFBO0FBS3pDOzs7Ozs7OztHQVFHO0FBQ0gsTUFBTSxPQUFPLE1BQU07SUFDVCxPQUFPLENBQThCO0lBQ3JDLEdBQUcsQ0FBUztJQUViLEtBQUssQ0FBQyxPQUFnQjtRQUMzQixJQUFJLENBQUMsT0FBTyxHQUFHLE9BQU8sQ0FBQyxLQUFLLENBQUMsT0FBTyxDQUFBO1FBQ3BDLElBQUksQ0FBQyxHQUFHLEdBQUcsT0FBTyxDQUFDLGFBQWEsQ0FBQyxHQUFHLENBQUE7SUFDdEMsQ0FBQztJQUVNLEtBQUssQ0FBQyxPQUFPLENBQUMsS0FBWTtRQUMvQixNQUFNLEVBQUUsU0FBUyxFQUFFLEdBQUcsS0FBSyxDQUFBO1FBRTNCLElBQ0UsS0FBSyxDQUFDLDBCQUEwQixLQUFLLFNBQVM7WUFDOUMsS0FBSyxDQUFDLDBCQUEwQixLQUFLLE1BQU07WUFFM0MsT0FBTyxPQUFPLENBQ1oseUJBQXlCLEVBQ3pCLDhFQUE4RSxDQUMvRSxDQUFBO1FBRUgsTUFBTSxJQUFJLEdBQUcsS0FBSyxDQUFDLGFBQWEsQ0FBQyxHQUFHLENBQUMsU0FBUyxDQUFDLENBQUE7UUFFL0MsS0FBSyxNQUFNLEdBQUcsSUFBSSxJQUFJO1lBQ3BCLElBQUksR0FBRyxZQUFZLEtBQUs7Z0JBQUUsT0FBTyxPQUFPLENBQUMsc0JBQXNCLE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LEVBQUUsV0FBbUI7SUFDakQsT0FBTyxFQUFFLE1BQU0sRUFBRSxXQUFXLEVBQUUsS0FBSyxFQUFFLGlCQUFpQixFQUFFLFdBQVcsRUFBRSxDQUFBO0FBQ3ZFLENBQUM7QUFFRCxNQUFNLFdBQVcsR0FBRyxHQUFHLENBQUE7QUFFdkIsTUFBTSxRQUFRLEdBQUcsSUFBSSxHQUFHLENBQUMsQ0FBQyxXQUFXLEVBQUUsT0FBTyxFQUFFLFdBQVcsQ0FBQyxDQUFDLENBQUEifQ==
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ERR_UNKNOWN_CLIENT, permits, read } from './lib/index.js'
|
|
2
|
-
import type { Maybe } from '@toa.io/core'
|
|
2
|
+
import type { Maybe } from '@toa.io/core/types'
|
|
3
3
|
import type { Operation } from '@toa.io/bridges.node'
|
|
4
4
|
import type { Client, Context } from './lib/index.js'
|
|
5
5
|
|
|
@@ -15,17 +15,16 @@ import type { Client, Context } from './lib/index.js'
|
|
|
15
15
|
export class Computation implements Operation {
|
|
16
16
|
private context!: Context
|
|
17
17
|
|
|
18
|
-
public mount
|
|
18
|
+
public mount(context: Context): void {
|
|
19
19
|
this.context = context
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
public async execute
|
|
22
|
+
public async execute(input: Input): Promise<Maybe<Output>> {
|
|
23
23
|
const client = input.id.startsWith(HTTPS)
|
|
24
24
|
? await read(input.id, this.context)
|
|
25
25
|
: await this.registered(input)
|
|
26
26
|
|
|
27
|
-
if (client instanceof Error)
|
|
28
|
-
return client
|
|
27
|
+
if (client instanceof Error) return client
|
|
29
28
|
|
|
30
29
|
return {
|
|
31
30
|
...client,
|
|
@@ -35,12 +34,11 @@ export class Computation implements Operation {
|
|
|
35
34
|
}
|
|
36
35
|
}
|
|
37
36
|
|
|
38
|
-
private async registered
|
|
37
|
+
private async registered(input: Input): Promise<Client | Error> {
|
|
39
38
|
const entity = await this.context.local.observe({ query: { id: input.id } })
|
|
40
39
|
|
|
41
40
|
// credentials are scoped to an authority, and so is what may act for them
|
|
42
|
-
if (entity === null || entity.authority !== input.authority)
|
|
43
|
-
return ERR_UNKNOWN_CLIENT
|
|
41
|
+
if (entity === null || entity.authority !== input.authority) return ERR_UNKNOWN_CLIENT
|
|
44
42
|
|
|
45
43
|
return {
|
|
46
44
|
client_id: entity.id,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Call, Observation, Transition } from '@toa.io/core'
|
|
1
|
+
import type { Call, Observation, Transition } from '@toa.io/core/types'
|
|
2
2
|
import type { Stash } from '@toa.io/extensions.stash'
|
|
3
3
|
import type { Logs } from '@toa.io/extensions.telemetry'
|
|
4
4
|
import type { Entity } from './Entity.js'
|
|
@@ -14,9 +14,12 @@ export interface Context {
|
|
|
14
14
|
configuration: Configuration
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
export type Fetch = (
|
|
17
|
+
export type Fetch = (
|
|
18
|
+
input: string | URL | Request,
|
|
19
|
+
init?: RequestInit
|
|
20
|
+
) => Promise<Response>
|
|
18
21
|
|
|
19
|
-
export type TransitInput = Omit<Entity, 'id' | '
|
|
22
|
+
export type TransitInput = Omit<Entity, 'id' | 'CREATED'>
|
|
20
23
|
|
|
21
24
|
export interface Configuration {
|
|
22
25
|
/** Origins whose Client ID Metadata Documents may be read. Empty admits nobody. */
|
|
@@ -10,7 +10,7 @@ import type { Metadata } from './Entity.js'
|
|
|
10
10
|
* client per release of whoever sends it, and the authority is in there because credentials
|
|
11
11
|
* are scoped to one.
|
|
12
12
|
*/
|
|
13
|
-
export function identify
|
|
13
|
+
export function identify(authority: string, metadata: Metadata): string {
|
|
14
14
|
const canonical = JSON.stringify([
|
|
15
15
|
authority,
|
|
16
16
|
metadata.client_name ?? null,
|
|
@@ -16,7 +16,7 @@ let context: Context
|
|
|
16
16
|
let fetched: string[]
|
|
17
17
|
let stored: Record<string, string>
|
|
18
18
|
|
|
19
|
-
function respond
|
|
19
|
+
function respond(body: unknown, ok = true): Response {
|
|
20
20
|
return {
|
|
21
21
|
ok,
|
|
22
22
|
text: async () => JSON.stringify(body)
|
|
@@ -94,15 +94,17 @@ it('should refuse anything but https', async () => {
|
|
|
94
94
|
})
|
|
95
95
|
|
|
96
96
|
it('should refuse a document that names another client', async () => {
|
|
97
|
-
context.fetch = mock.fn(async () =>
|
|
97
|
+
context.fetch = mock.fn(async () =>
|
|
98
|
+
respond({ ...document, client_id: 'https://claude.ai/other' })
|
|
99
|
+
)
|
|
98
100
|
|
|
99
|
-
assert.ok(await read(ID, context) instanceof Error)
|
|
101
|
+
assert.ok((await read(ID, context)) instanceof Error)
|
|
100
102
|
})
|
|
101
103
|
|
|
102
104
|
it('should refuse a document with no redirect to send a code to', async () => {
|
|
103
105
|
context.fetch = mock.fn(async () => respond({ client_id: ID, redirect_uris: [] }))
|
|
104
106
|
|
|
105
|
-
assert.ok(await read(ID, context) instanceof Error)
|
|
107
|
+
assert.ok((await read(ID, context)) instanceof Error)
|
|
106
108
|
})
|
|
107
109
|
|
|
108
110
|
it('should remember that a document did not answer', async () => {
|
|
@@ -114,7 +116,7 @@ it('should remember that a document did not answer', async () => {
|
|
|
114
116
|
return respond({}, false)
|
|
115
117
|
})
|
|
116
118
|
|
|
117
|
-
assert.ok(await read(ID, context) instanceof Error)
|
|
118
|
-
assert.ok(await read(ID, context) instanceof Error)
|
|
119
|
+
assert.ok((await read(ID, context)) instanceof Error)
|
|
120
|
+
assert.ok((await read(ID, context)) instanceof Error)
|
|
119
121
|
assert.equal(calls, 1, 'a document that failed must not be refetched per request')
|
|
120
122
|
})
|
|
@@ -8,23 +8,26 @@ import type { Client, Metadata } from './Entity.js'
|
|
|
8
8
|
* URL is its `client_id`. Control of the origin is what proves the identity, so nothing is
|
|
9
9
|
* registered and nothing is written — the document is read and held for a while.
|
|
10
10
|
*/
|
|
11
|
-
export async function read
|
|
11
|
+
export async function read(id: string, context: Context): Promise<Client | Error> {
|
|
12
12
|
// before anything is fetched: the id is the caller's to choose, and this runs inside
|
|
13
13
|
// the cluster. An origin the configuration does not name is not reached at all.
|
|
14
|
-
if (!trusted(id, context.configuration.trust))
|
|
15
|
-
return ERR_UNKNOWN_CLIENT
|
|
14
|
+
if (!trusted(id, context.configuration.trust)) return ERR_UNKNOWN_CLIENT
|
|
16
15
|
|
|
17
16
|
const key = CACHE + createHash('sha256').update(id).digest('hex')
|
|
18
17
|
const cached = await context.stash.get(key)
|
|
19
18
|
|
|
20
19
|
if (cached !== null)
|
|
21
|
-
return cached === MISS ? ERR_UNKNOWN_CLIENT : JSON.parse(cached) as Client
|
|
20
|
+
return cached === MISS ? ERR_UNKNOWN_CLIENT : (JSON.parse(cached) as Client)
|
|
22
21
|
|
|
23
22
|
const client = await fetch(id, context)
|
|
24
23
|
|
|
25
24
|
// a document that does not answer is remembered too, or a bad id is fetched per request
|
|
26
|
-
await context.stash.set(
|
|
27
|
-
|
|
25
|
+
await context.stash.set(
|
|
26
|
+
key,
|
|
27
|
+
client instanceof Error ? MISS : JSON.stringify(client),
|
|
28
|
+
'EX',
|
|
29
|
+
context.configuration.lifetime
|
|
30
|
+
)
|
|
28
31
|
|
|
29
32
|
return client
|
|
30
33
|
}
|
|
@@ -33,7 +36,7 @@ export async function read (id: string, context: Context): Promise<Client | Erro
|
|
|
33
36
|
* An https URL whose origin the configuration names. Compared by origin so that a path on a
|
|
34
37
|
* trusted host cannot be escaped by one that merely starts the same way.
|
|
35
38
|
*/
|
|
36
|
-
function trusted
|
|
39
|
+
function trusted(id: string, trust: string[]): boolean {
|
|
37
40
|
let url: URL
|
|
38
41
|
|
|
39
42
|
try {
|
|
@@ -42,8 +45,7 @@ function trusted (id: string, trust: string[]): boolean {
|
|
|
42
45
|
return false
|
|
43
46
|
}
|
|
44
47
|
|
|
45
|
-
if (url.protocol !== 'https:')
|
|
46
|
-
return false
|
|
48
|
+
if (url.protocol !== 'https:') return false
|
|
47
49
|
|
|
48
50
|
return trust.some((origin) => {
|
|
49
51
|
try {
|
|
@@ -54,7 +56,7 @@ function trusted (id: string, trust: string[]): boolean {
|
|
|
54
56
|
})
|
|
55
57
|
}
|
|
56
58
|
|
|
57
|
-
async function fetch
|
|
59
|
+
async function fetch(id: string, context: Context): Promise<Client | Error> {
|
|
58
60
|
const { size, timeout } = context.configuration
|
|
59
61
|
|
|
60
62
|
try {
|
|
@@ -64,13 +66,11 @@ async function fetch (id: string, context: Context): Promise<Client | Error> {
|
|
|
64
66
|
headers: { accept: 'application/json' }
|
|
65
67
|
})
|
|
66
68
|
|
|
67
|
-
if (!response.ok)
|
|
68
|
-
return ERR_UNKNOWN_CLIENT
|
|
69
|
+
if (!response.ok) return ERR_UNKNOWN_CLIENT
|
|
69
70
|
|
|
70
71
|
const text = await response.text()
|
|
71
72
|
|
|
72
|
-
if (text.length > size)
|
|
73
|
-
return ERR_UNKNOWN_CLIENT
|
|
73
|
+
if (text.length > size) return ERR_UNKNOWN_CLIENT
|
|
74
74
|
|
|
75
75
|
return validate(id, JSON.parse(text) as Metadata & { client_id?: string })
|
|
76
76
|
} catch (error: unknown) {
|
|
@@ -83,13 +83,18 @@ async function fetch (id: string, context: Context): Promise<Client | Error> {
|
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
function validate
|
|
86
|
+
function validate(
|
|
87
|
+
id: string,
|
|
88
|
+
metadata: Metadata & { client_id?: string }
|
|
89
|
+
): Client | Error {
|
|
87
90
|
// the document names itself, so one client's cannot claim another's identity
|
|
88
|
-
if (metadata.client_id !== id)
|
|
89
|
-
return ERR_UNKNOWN_CLIENT
|
|
91
|
+
if (metadata.client_id !== id) return ERR_UNKNOWN_CLIENT
|
|
90
92
|
|
|
91
|
-
if (
|
|
92
|
-
metadata.redirect_uris
|
|
93
|
+
if (
|
|
94
|
+
!Array.isArray(metadata.redirect_uris) ||
|
|
95
|
+
metadata.redirect_uris.length === 0 ||
|
|
96
|
+
metadata.redirect_uris.some((uri) => typeof uri !== 'string')
|
|
97
|
+
)
|
|
93
98
|
return ERR_UNKNOWN_CLIENT
|
|
94
99
|
|
|
95
100
|
return {
|
|
@@ -16,7 +16,10 @@ it('should refuse anything else on a registered host', () => {
|
|
|
16
16
|
})
|
|
17
17
|
|
|
18
18
|
it('should refuse a host that merely starts the same way', () => {
|
|
19
|
-
assert.equal(
|
|
19
|
+
assert.equal(
|
|
20
|
+
permits(hosted, 'https://claude.ai.evil.example/api/mcp/auth_callback'),
|
|
21
|
+
false
|
|
22
|
+
)
|
|
20
23
|
})
|
|
21
24
|
|
|
22
25
|
it('should ignore the port of a loopback address', () => {
|
|
@@ -33,7 +36,10 @@ it('should not ignore the path of a loopback address', () => {
|
|
|
33
36
|
})
|
|
34
37
|
|
|
35
38
|
it('should not treat a remote address as loopback', () => {
|
|
36
|
-
assert.equal(
|
|
39
|
+
assert.equal(
|
|
40
|
+
permits(['http://example.com/callback'], 'http://example.com:8080/callback'),
|
|
41
|
+
false
|
|
42
|
+
)
|
|
37
43
|
})
|
|
38
44
|
|
|
39
45
|
it('should not cross schemes', () => {
|
|
@@ -7,23 +7,27 @@
|
|
|
7
7
|
* `http://127.0.0.1/callback` and comes back on an ephemeral port; comparing those
|
|
8
8
|
* literally would refuse every one of them.
|
|
9
9
|
*/
|
|
10
|
-
export function permits
|
|
10
|
+
export function permits(registered: string[], redirect: string): boolean {
|
|
11
11
|
return registered.some((uri) => uri === redirect || loopback(uri, redirect))
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
function loopback
|
|
14
|
+
function loopback(registered: string, redirect: string): boolean {
|
|
15
15
|
const a = parse(registered)
|
|
16
16
|
const b = parse(redirect)
|
|
17
17
|
|
|
18
|
-
if (a === null || b === null)
|
|
19
|
-
return false
|
|
18
|
+
if (a === null || b === null) return false
|
|
20
19
|
|
|
21
|
-
return
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
return (
|
|
21
|
+
a.protocol === 'http:' &&
|
|
22
|
+
b.protocol === 'http:' &&
|
|
23
|
+
LOOPBACK.has(a.hostname) &&
|
|
24
|
+
a.hostname === b.hostname &&
|
|
25
|
+
a.pathname === b.pathname &&
|
|
26
|
+
a.search === b.search
|
|
27
|
+
)
|
|
24
28
|
}
|
|
25
29
|
|
|
26
|
-
function parse
|
|
30
|
+
function parse(value: string): URL | null {
|
|
27
31
|
try {
|
|
28
32
|
return new URL(value)
|
|
29
33
|
} catch {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { identify } from './lib/index.js'
|
|
2
|
-
import type { Maybe } from '@toa.io/core'
|
|
2
|
+
import type { Maybe } from '@toa.io/core/types'
|
|
3
3
|
import type { Operation } from '@toa.io/bridges.node'
|
|
4
4
|
import type { Context, Metadata } from './lib/index.js'
|
|
5
5
|
|
|
@@ -16,24 +16,27 @@ export class Effect implements Operation {
|
|
|
16
16
|
private transit!: Context['local']['transit']
|
|
17
17
|
private ttl!: number
|
|
18
18
|
|
|
19
|
-
public mount
|
|
19
|
+
public mount(context: Context): void {
|
|
20
20
|
this.transit = context.local.transit
|
|
21
21
|
this.ttl = context.configuration.ttl
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
public async execute
|
|
24
|
+
public async execute(input: Input): Promise<Maybe<Output>> {
|
|
25
25
|
const { authority } = input
|
|
26
26
|
|
|
27
|
-
if (
|
|
28
|
-
input.token_endpoint_auth_method !==
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
if (
|
|
28
|
+
input.token_endpoint_auth_method !== undefined &&
|
|
29
|
+
input.token_endpoint_auth_method !== 'none'
|
|
30
|
+
)
|
|
31
|
+
return invalid(
|
|
32
|
+
'invalid_client_metadata',
|
|
33
|
+
'Only public clients are supported: token_endpoint_auth_method must be `none`'
|
|
34
|
+
)
|
|
31
35
|
|
|
32
36
|
const uris = input.redirect_uris.map(normalize)
|
|
33
37
|
|
|
34
38
|
for (const uri of uris)
|
|
35
|
-
if (uri instanceof Error)
|
|
36
|
-
return invalid('invalid_redirect_uri', uri.message)
|
|
39
|
+
if (uri instanceof Error) return invalid('invalid_redirect_uri', uri.message)
|
|
37
40
|
|
|
38
41
|
const metadata: Metadata = {
|
|
39
42
|
client_name: input.client_name,
|
|
@@ -61,7 +64,7 @@ export class Effect implements Operation {
|
|
|
61
64
|
return {
|
|
62
65
|
client_id: id,
|
|
63
66
|
// of the record, not of this request: registering again answers what it answered
|
|
64
|
-
client_id_issued_at: Math.floor((entity.
|
|
67
|
+
client_id_issued_at: Math.floor((entity.CREATED ?? Date.now()) / 1000),
|
|
65
68
|
client_name: entity.name,
|
|
66
69
|
client_uri: entity.uri,
|
|
67
70
|
logo_uri: entity.logo,
|
|
@@ -74,7 +77,7 @@ export class Effect implements Operation {
|
|
|
74
77
|
}
|
|
75
78
|
|
|
76
79
|
/** Absolute, no fragment, and either https or a loopback address (RFC 8252 §7.3). */
|
|
77
|
-
function normalize
|
|
80
|
+
function normalize(value: string): string | Error {
|
|
78
81
|
let url: URL
|
|
79
82
|
|
|
80
83
|
try {
|
|
@@ -83,20 +86,17 @@ function normalize (value: string): string | Error {
|
|
|
83
86
|
return new Error(`\`${value}\` is not an absolute URI`)
|
|
84
87
|
}
|
|
85
88
|
|
|
86
|
-
if (url.hash !== '')
|
|
87
|
-
return new Error(`\`${value}\` carries a fragment`)
|
|
89
|
+
if (url.hash !== '') return new Error(`\`${value}\` carries a fragment`)
|
|
88
90
|
|
|
89
|
-
if (url.protocol === 'https:')
|
|
90
|
-
return url.href
|
|
91
|
+
if (url.protocol === 'https:') return url.href
|
|
91
92
|
|
|
92
|
-
if (url.protocol === 'http:' && LOOPBACK.has(url.hostname))
|
|
93
|
-
return url.href
|
|
93
|
+
if (url.protocol === 'http:' && LOOPBACK.has(url.hostname)) return url.href
|
|
94
94
|
|
|
95
95
|
return new Error(`\`${value}\` is neither https nor a loopback address`)
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
/** RFC 7591 §3.2.2: a registration error is a body, and `map:status` makes it the status. */
|
|
99
|
-
function invalid
|
|
99
|
+
function invalid(error: string, description: string): Output {
|
|
100
100
|
return { status: BAD_REQUEST, error, error_description: description }
|
|
101
101
|
}
|
|
102
102
|
|