@astrale-os/kernel-protocol 0.5.0-beta.8 → 1.0.0-beta.1
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/dist/artifact/index.d.ts +1 -2
- package/dist/artifact/index.js +1 -2
- package/dist/artifact/ref.d.ts +2 -1
- package/dist/artifact/ref.js +4 -4
- package/dist/codecs/codec.d.ts +0 -1
- package/dist/codecs/codec.js +0 -1
- package/dist/codecs/index.d.ts +1 -3
- package/dist/codecs/index.js +1 -3
- package/dist/codecs/json.d.ts +0 -1
- package/dist/codecs/json.js +0 -1
- package/dist/codecs/media-types.d.ts +0 -2
- package/dist/codecs/media-types.js +0 -2
- package/dist/errors/codes.d.ts +0 -1
- package/dist/errors/codes.js +0 -1
- package/dist/errors/http-status.d.ts +0 -1
- package/dist/errors/http-status.js +0 -1
- package/dist/errors/index.d.ts +1 -1
- package/dist/errors/index.js +1 -1
- package/dist/errors/payload.d.ts +0 -1
- package/dist/errors/payload.js +0 -1
- package/dist/errors/protocol-error.d.ts +0 -1
- package/dist/errors/protocol-error.js +0 -1
- package/dist/errors/reason.d.ts +0 -1
- package/dist/errors/reason.js +0 -1
- package/dist/errors/retry.d.ts +23 -0
- package/dist/errors/retry.js +44 -0
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -2
- package/dist/invocation/admission.d.ts +2 -3
- package/dist/invocation/admission.js +5 -6
- package/dist/invocation/binary.d.ts +1 -1
- package/dist/invocation/binary.js +21 -5
- package/dist/invocation/binding-codecs.d.ts +3 -3
- package/dist/invocation/binding-codecs.js +1 -7
- package/dist/invocation/cancellation.d.ts +0 -1
- package/dist/invocation/cancellation.js +0 -1
- package/dist/invocation/correlation.d.ts +0 -1
- package/dist/invocation/correlation.js +0 -1
- package/dist/invocation/delegate.d.ts +0 -21
- package/dist/invocation/delegate.js +2 -35
- package/dist/invocation/http/binary.d.ts +3 -2
- package/dist/invocation/http/binary.js +6 -2
- package/dist/invocation/http/index.d.ts +2 -2
- package/dist/invocation/http/index.js +2 -2
- package/dist/invocation/http/negotiation.d.ts +0 -1
- package/dist/invocation/http/negotiation.js +3 -11
- package/dist/invocation/http/request.d.ts +11 -0
- package/dist/invocation/http/request.js +69 -0
- package/dist/invocation/http/stream.d.ts +0 -1
- package/dist/invocation/http/stream.js +0 -1
- package/dist/invocation/http/trace.d.ts +0 -1
- package/dist/invocation/http/trace.js +0 -1
- package/dist/invocation/idempotency.d.ts +0 -1
- package/dist/invocation/idempotency.js +0 -1
- package/dist/invocation/identity.d.ts +0 -1
- package/dist/invocation/identity.js +0 -1
- package/dist/invocation/index.d.ts +3 -4
- package/dist/invocation/index.js +3 -4
- package/dist/invocation/miss.d.ts +0 -1
- package/dist/invocation/miss.js +0 -1
- package/dist/invocation/redirect.d.ts +10 -13
- package/dist/invocation/redirect.js +10 -23
- package/dist/invocation/request.d.ts +0 -1
- package/dist/invocation/request.js +2 -3
- package/dist/invocation/response.d.ts +0 -1
- package/dist/invocation/response.js +0 -1
- package/dist/invocation/routing.d.ts +14 -5
- package/dist/invocation/routing.js +35 -21
- package/dist/invocation/schema.d.ts +6 -5
- package/dist/invocation/schema.js +5 -12
- package/dist/invocation/service-reason.d.ts +20 -16
- package/dist/invocation/service-reason.js +27 -20
- package/dist/invocation/stale-route.d.ts +3 -4
- package/dist/invocation/stale-route.js +0 -1
- package/dist/invocation/stream.d.ts +0 -1
- package/dist/invocation/stream.js +0 -1
- package/dist/invocation/target.d.ts +5 -3
- package/dist/invocation/target.js +25 -4
- package/dist/invocation/trace.d.ts +0 -1
- package/dist/invocation/trace.js +0 -1
- package/dist/invocation/version.d.ts +0 -1
- package/dist/invocation/version.js +0 -1
- package/dist/invocation/websocket/binary.d.ts +0 -1
- package/dist/invocation/websocket/binary.js +1 -1
- package/dist/invocation/websocket/index.d.ts +1 -2
- package/dist/invocation/websocket/index.js +1 -2
- package/dist/invocation/websocket/subprotocol.d.ts +1 -3
- package/dist/invocation/websocket/subprotocol.js +3 -5
- package/dist/issuer/claims.d.ts +7 -0
- package/dist/issuer/claims.js +7 -0
- package/dist/issuer/configuration.d.ts +0 -1
- package/dist/issuer/configuration.js +0 -1
- package/dist/issuer/error.d.ts +0 -1
- package/dist/issuer/error.js +0 -1
- package/dist/issuer/exchange.d.ts +0 -1
- package/dist/issuer/exchange.js +0 -1
- package/dist/issuer/hosted.d.ts +0 -1
- package/dist/issuer/hosted.js +0 -1
- package/dist/issuer/index.d.ts +2 -1
- package/dist/issuer/index.js +2 -1
- package/dist/issuer/key-set.d.ts +0 -1
- package/dist/issuer/key-set.js +0 -1
- package/dist/issuer/paths.d.ts +2 -1
- package/dist/issuer/paths.js +1 -1
- package/dist/issuer/url.d.ts +0 -1
- package/dist/issuer/url.js +0 -1
- package/dist/issuer/workflow-engine.d.ts +18 -0
- package/dist/issuer/workflow-engine.js +59 -0
- package/dist/{publication → release}/bindings/callable.d.ts +0 -1
- package/dist/{publication → release}/bindings/callable.js +6 -7
- package/dist/{publication → release}/bindings/index.d.ts +0 -1
- package/dist/{publication → release}/bindings/index.js +0 -1
- package/dist/{publication → release}/bindings/invocation.d.ts +0 -1
- package/dist/release/bindings/invocation.js +13 -0
- package/dist/release/bindings/view.d.ts +11 -0
- package/dist/release/bindings/view.js +54 -0
- package/dist/release/build.d.ts +6 -0
- package/dist/release/build.js +7 -0
- package/dist/release/bundle-admission.d.ts +21 -0
- package/dist/{publication → release}/bundle-admission.js +15 -21
- package/dist/{publication → release}/bundle-descriptor.d.ts +0 -1
- package/dist/release/bundle-descriptor.js +19 -0
- package/dist/release/bundle-evidence.d.ts +3 -0
- package/dist/release/bundle-evidence.js +13 -0
- package/dist/{publication → release}/bundle.d.ts +5 -3
- package/dist/{publication → release}/bundle.js +13 -8
- package/dist/{publication → release}/declaration.d.ts +0 -1
- package/dist/release/declaration.js +1 -0
- package/dist/{publication → release}/delivery/attestation.d.ts +1 -1
- package/dist/{publication → release}/delivery/attestation.js +0 -1
- package/dist/{publication → release}/delivery/claims.d.ts +7 -3
- package/dist/{publication → release}/delivery/claims.js +20 -14
- package/dist/release/delivery/delivery.d.ts +11 -0
- package/dist/{publication → release}/delivery/delivery.js +7 -13
- package/dist/{publication → release}/delivery/error.d.ts +2 -1
- package/dist/{publication → release}/delivery/error.js +1 -1
- package/dist/{publication → release}/delivery/index.d.ts +5 -2
- package/dist/{publication → release}/delivery/index.js +4 -1
- package/dist/{publication → release}/delivery/limits.d.ts +2 -2
- package/dist/release/delivery/limits.js +5 -0
- package/dist/{publication → release}/delivery/request.d.ts +10 -10
- package/dist/{publication → release}/delivery/request.js +9 -11
- package/dist/{publication → release}/delivery-declaration.d.ts +0 -1
- package/dist/{publication → release}/delivery-declaration.js +4 -5
- package/dist/{publication → release}/delivery-endpoint.d.ts +0 -1
- package/dist/release/delivery-endpoint.js +22 -0
- package/dist/release/digest.d.ts +13 -0
- package/dist/{publication/etag.js → release/digest.js} +1 -7
- package/dist/release/error.d.ts +7 -0
- package/dist/release/error.js +11 -0
- package/dist/release/index.d.ts +17 -0
- package/dist/release/index.js +10 -0
- package/dist/release/issuer.d.ts +5 -0
- package/dist/release/issuer.js +34 -0
- package/dist/release/manifest.d.ts +6 -0
- package/dist/release/manifest.js +22 -0
- package/dist/release/reference.d.ts +26 -0
- package/dist/release/reference.js +70 -0
- package/dist/release/release.d.ts +60 -0
- package/dist/release/release.js +125 -0
- package/dist/release/requirements.d.ts +41 -0
- package/dist/release/requirements.js +306 -0
- package/dist/{publication → release}/route.d.ts +0 -1
- package/dist/{publication → release}/route.js +24 -25
- package/dist/{publication → release}/schema.d.ts +0 -1
- package/dist/{publication → release}/schema.js +4 -5
- package/dist/release/served.d.ts +27 -0
- package/dist/release/served.js +56 -0
- package/dist/release/shape.d.ts +8 -0
- package/dist/{publication/content.js → release/shape.js} +0 -1
- package/dist/routes/admission.d.ts +1 -2
- package/dist/routes/admission.js +7 -86
- package/dist/routes/binding.d.ts +3 -4
- package/dist/routes/binding.js +11 -22
- package/dist/routes/collision.d.ts +0 -1
- package/dist/routes/collision.js +0 -1
- package/dist/routes/compiler.d.ts +2 -3
- package/dist/routes/compiler.js +7 -4
- package/dist/routes/credential.d.ts +12 -3
- package/dist/routes/credential.js +9 -5
- package/dist/routes/decode.d.ts +5 -3
- package/dist/routes/decode.js +24 -18
- package/dist/routes/deployment-retired.d.ts +30 -0
- package/dist/routes/deployment-retired.js +96 -0
- package/dist/routes/encode.d.ts +0 -1
- package/dist/routes/encode.js +12 -6
- package/dist/routes/entries.d.ts +23 -0
- package/dist/routes/entries.js +150 -0
- package/dist/routes/error-response.d.ts +0 -1
- package/dist/routes/error-response.js +0 -1
- package/dist/routes/error.d.ts +0 -1
- package/dist/routes/error.js +0 -1
- package/dist/routes/evidence.d.ts +3 -4
- package/dist/routes/evidence.js +7 -34
- package/dist/routes/header.d.ts +9 -0
- package/dist/routes/header.js +34 -0
- package/dist/routes/index.d.ts +2 -3
- package/dist/routes/index.js +2 -3
- package/dist/routes/mapping.d.ts +1 -2
- package/dist/routes/mapping.js +4 -5
- package/dist/routes/match.d.ts +1 -2
- package/dist/routes/match.js +0 -1
- package/dist/routes/placement.d.ts +2 -3
- package/dist/routes/placement.js +0 -1
- package/dist/routes/plan.d.ts +1 -2
- package/dist/routes/plan.js +0 -1
- package/dist/routes/request.d.ts +3 -2
- package/dist/routes/request.js +0 -1
- package/dist/routes/reservation.d.ts +4 -3
- package/dist/routes/reservation.js +14 -9
- package/dist/routes/routing.d.ts +18 -7
- package/dist/routes/routing.js +28 -50
- package/dist/routes/scalar.d.ts +0 -1
- package/dist/routes/scalar.js +0 -1
- package/dist/routes/select.d.ts +1 -2
- package/dist/routes/select.js +0 -1
- package/dist/routes/stream.d.ts +0 -1
- package/dist/routes/stream.js +0 -1
- package/dist/routes/table.d.ts +3 -3
- package/dist/routes/table.js +0 -1
- package/dist/routes/target.d.ts +5 -1
- package/dist/routes/target.js +16 -1
- package/dist/routes/template.d.ts +0 -2
- package/dist/routes/template.js +0 -4
- package/dist/runtime/artifact.d.ts +5 -5
- package/dist/runtime/artifact.js +7 -5
- package/dist/runtime/index.d.ts +1 -2
- package/dist/runtime/index.js +1 -2
- package/dist/schema/index.d.ts +0 -1
- package/dist/schema/index.js +0 -1
- package/dist/schema/installation/codec.d.ts +4 -0
- package/dist/schema/installation/codec.js +70 -0
- package/dist/schema/installation/index.d.ts +2 -1
- package/dist/schema/installation/index.js +1 -1
- package/dist/schema/installation/introspection/codec.d.ts +5 -3
- package/dist/schema/installation/introspection/codec.js +307 -196
- package/dist/schema/installation/introspection/index.d.ts +2 -3
- package/dist/schema/installation/introspection/index.js +1 -2
- package/dist/schema/installation/introspection/result.d.ts +72 -26
- package/dist/schema/installation/introspection/result.js +0 -1
- package/dist/schema/installation/result.d.ts +9 -0
- package/dist/schema/installation/result.js +1 -0
- package/package.json +23 -78
- package/dist/artifact/index.d.ts.map +0 -1
- package/dist/artifact/index.js.map +0 -1
- package/dist/artifact/ref.d.ts.map +0 -1
- package/dist/artifact/ref.js.map +0 -1
- package/dist/codecs/codec.d.ts.map +0 -1
- package/dist/codecs/codec.js.map +0 -1
- package/dist/codecs/index.d.ts.map +0 -1
- package/dist/codecs/index.js.map +0 -1
- package/dist/codecs/json.d.ts.map +0 -1
- package/dist/codecs/json.js.map +0 -1
- package/dist/codecs/media-types.d.ts.map +0 -1
- package/dist/codecs/media-types.js.map +0 -1
- package/dist/codecs/msgpack.d.ts +0 -5
- package/dist/codecs/msgpack.d.ts.map +0 -1
- package/dist/codecs/msgpack.js +0 -51
- package/dist/codecs/msgpack.js.map +0 -1
- package/dist/errors/codes.d.ts.map +0 -1
- package/dist/errors/codes.js.map +0 -1
- package/dist/errors/http-status.d.ts.map +0 -1
- package/dist/errors/http-status.js.map +0 -1
- package/dist/errors/index.d.ts.map +0 -1
- package/dist/errors/index.js.map +0 -1
- package/dist/errors/payload.d.ts.map +0 -1
- package/dist/errors/payload.js.map +0 -1
- package/dist/errors/protocol-error.d.ts.map +0 -1
- package/dist/errors/protocol-error.js.map +0 -1
- package/dist/errors/reason.d.ts.map +0 -1
- package/dist/errors/reason.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/invocation/admission.d.ts.map +0 -1
- package/dist/invocation/admission.js.map +0 -1
- package/dist/invocation/binary.d.ts.map +0 -1
- package/dist/invocation/binary.js.map +0 -1
- package/dist/invocation/binding-codecs.d.ts.map +0 -1
- package/dist/invocation/binding-codecs.js.map +0 -1
- package/dist/invocation/cancellation.d.ts.map +0 -1
- package/dist/invocation/cancellation.js.map +0 -1
- package/dist/invocation/correlation.d.ts.map +0 -1
- package/dist/invocation/correlation.js.map +0 -1
- package/dist/invocation/delegate.d.ts.map +0 -1
- package/dist/invocation/delegate.js.map +0 -1
- package/dist/invocation/http/binary.d.ts.map +0 -1
- package/dist/invocation/http/binary.js.map +0 -1
- package/dist/invocation/http/index.d.ts.map +0 -1
- package/dist/invocation/http/index.js.map +0 -1
- package/dist/invocation/http/negotiation.d.ts.map +0 -1
- package/dist/invocation/http/negotiation.js.map +0 -1
- package/dist/invocation/http/stream.d.ts.map +0 -1
- package/dist/invocation/http/stream.js.map +0 -1
- package/dist/invocation/http/trace.d.ts.map +0 -1
- package/dist/invocation/http/trace.js.map +0 -1
- package/dist/invocation/idempotency.d.ts.map +0 -1
- package/dist/invocation/idempotency.js.map +0 -1
- package/dist/invocation/identity.d.ts.map +0 -1
- package/dist/invocation/identity.js.map +0 -1
- package/dist/invocation/index.d.ts.map +0 -1
- package/dist/invocation/index.js.map +0 -1
- package/dist/invocation/miss.d.ts.map +0 -1
- package/dist/invocation/miss.js.map +0 -1
- package/dist/invocation/redirect.d.ts.map +0 -1
- package/dist/invocation/redirect.js.map +0 -1
- package/dist/invocation/request.d.ts.map +0 -1
- package/dist/invocation/request.js.map +0 -1
- package/dist/invocation/response.d.ts.map +0 -1
- package/dist/invocation/response.js.map +0 -1
- package/dist/invocation/routing.d.ts.map +0 -1
- package/dist/invocation/routing.js.map +0 -1
- package/dist/invocation/schema.d.ts.map +0 -1
- package/dist/invocation/schema.js.map +0 -1
- package/dist/invocation/service-reason.d.ts.map +0 -1
- package/dist/invocation/service-reason.js.map +0 -1
- package/dist/invocation/stale-route.d.ts.map +0 -1
- package/dist/invocation/stale-route.js.map +0 -1
- package/dist/invocation/stream.d.ts.map +0 -1
- package/dist/invocation/stream.js.map +0 -1
- package/dist/invocation/target.d.ts.map +0 -1
- package/dist/invocation/target.js.map +0 -1
- package/dist/invocation/trace.d.ts.map +0 -1
- package/dist/invocation/trace.js.map +0 -1
- package/dist/invocation/version.d.ts.map +0 -1
- package/dist/invocation/version.js.map +0 -1
- package/dist/invocation/websocket/binary.d.ts.map +0 -1
- package/dist/invocation/websocket/binary.js.map +0 -1
- package/dist/invocation/websocket/index.d.ts.map +0 -1
- package/dist/invocation/websocket/index.js.map +0 -1
- package/dist/invocation/websocket/subprotocol.d.ts.map +0 -1
- package/dist/invocation/websocket/subprotocol.js.map +0 -1
- package/dist/issuer/configuration.d.ts.map +0 -1
- package/dist/issuer/configuration.js.map +0 -1
- package/dist/issuer/error.d.ts.map +0 -1
- package/dist/issuer/error.js.map +0 -1
- package/dist/issuer/exchange.d.ts.map +0 -1
- package/dist/issuer/exchange.js.map +0 -1
- package/dist/issuer/hosted.d.ts.map +0 -1
- package/dist/issuer/hosted.js.map +0 -1
- package/dist/issuer/index.d.ts.map +0 -1
- package/dist/issuer/index.js.map +0 -1
- package/dist/issuer/key-set.d.ts.map +0 -1
- package/dist/issuer/key-set.js.map +0 -1
- package/dist/issuer/paths.d.ts.map +0 -1
- package/dist/issuer/paths.js.map +0 -1
- package/dist/issuer/url.d.ts.map +0 -1
- package/dist/issuer/url.js.map +0 -1
- package/dist/publication/bindings/callable.d.ts.map +0 -1
- package/dist/publication/bindings/callable.js.map +0 -1
- package/dist/publication/bindings/index.d.ts.map +0 -1
- package/dist/publication/bindings/index.js.map +0 -1
- package/dist/publication/bindings/invocation.d.ts.map +0 -1
- package/dist/publication/bindings/invocation.js +0 -14
- package/dist/publication/bindings/invocation.js.map +0 -1
- package/dist/publication/bindings/view.d.ts +0 -8
- package/dist/publication/bindings/view.d.ts.map +0 -1
- package/dist/publication/bindings/view.js +0 -29
- package/dist/publication/bindings/view.js.map +0 -1
- package/dist/publication/bundle-admission.d.ts +0 -5
- package/dist/publication/bundle-admission.d.ts.map +0 -1
- package/dist/publication/bundle-admission.js.map +0 -1
- package/dist/publication/bundle-descriptor.d.ts.map +0 -1
- package/dist/publication/bundle-descriptor.js +0 -20
- package/dist/publication/bundle-descriptor.js.map +0 -1
- package/dist/publication/bundle-evidence.d.ts +0 -4
- package/dist/publication/bundle-evidence.d.ts.map +0 -1
- package/dist/publication/bundle-evidence.js +0 -14
- package/dist/publication/bundle-evidence.js.map +0 -1
- package/dist/publication/bundle.d.ts.map +0 -1
- package/dist/publication/bundle.js.map +0 -1
- package/dist/publication/content.d.ts +0 -11
- package/dist/publication/content.d.ts.map +0 -1
- package/dist/publication/content.js.map +0 -1
- package/dist/publication/declaration.d.ts.map +0 -1
- package/dist/publication/declaration.js +0 -2
- package/dist/publication/declaration.js.map +0 -1
- package/dist/publication/delivery/attestation.d.ts.map +0 -1
- package/dist/publication/delivery/attestation.js.map +0 -1
- package/dist/publication/delivery/claims.d.ts.map +0 -1
- package/dist/publication/delivery/claims.js.map +0 -1
- package/dist/publication/delivery/delivery.d.ts +0 -10
- package/dist/publication/delivery/delivery.d.ts.map +0 -1
- package/dist/publication/delivery/delivery.js.map +0 -1
- package/dist/publication/delivery/error.d.ts.map +0 -1
- package/dist/publication/delivery/error.js.map +0 -1
- package/dist/publication/delivery/index.d.ts.map +0 -1
- package/dist/publication/delivery/index.js.map +0 -1
- package/dist/publication/delivery/limits.d.ts.map +0 -1
- package/dist/publication/delivery/limits.js +0 -5
- package/dist/publication/delivery/limits.js.map +0 -1
- package/dist/publication/delivery/request.d.ts.map +0 -1
- package/dist/publication/delivery/request.js.map +0 -1
- package/dist/publication/delivery-declaration.d.ts.map +0 -1
- package/dist/publication/delivery-declaration.js.map +0 -1
- package/dist/publication/delivery-endpoint.d.ts.map +0 -1
- package/dist/publication/delivery-endpoint.js +0 -23
- package/dist/publication/delivery-endpoint.js.map +0 -1
- package/dist/publication/error.d.ts +0 -8
- package/dist/publication/error.d.ts.map +0 -1
- package/dist/publication/error.js +0 -12
- package/dist/publication/error.js.map +0 -1
- package/dist/publication/etag.d.ts +0 -7
- package/dist/publication/etag.d.ts.map +0 -1
- package/dist/publication/etag.js.map +0 -1
- package/dist/publication/index.d.ts +0 -18
- package/dist/publication/index.d.ts.map +0 -1
- package/dist/publication/index.js +0 -11
- package/dist/publication/index.js.map +0 -1
- package/dist/publication/manifest.d.ts +0 -7
- package/dist/publication/manifest.d.ts.map +0 -1
- package/dist/publication/manifest.js +0 -31
- package/dist/publication/manifest.js.map +0 -1
- package/dist/publication/publication.d.ts +0 -37
- package/dist/publication/publication.d.ts.map +0 -1
- package/dist/publication/publication.js +0 -134
- package/dist/publication/publication.js.map +0 -1
- package/dist/publication/reference.d.ts +0 -18
- package/dist/publication/reference.d.ts.map +0 -1
- package/dist/publication/reference.js +0 -69
- package/dist/publication/reference.js.map +0 -1
- package/dist/publication/requirements.d.ts +0 -27
- package/dist/publication/requirements.d.ts.map +0 -1
- package/dist/publication/requirements.js +0 -181
- package/dist/publication/requirements.js.map +0 -1
- package/dist/publication/route.d.ts.map +0 -1
- package/dist/publication/route.js.map +0 -1
- package/dist/publication/schema.d.ts.map +0 -1
- package/dist/publication/schema.js.map +0 -1
- package/dist/routes/admission.d.ts.map +0 -1
- package/dist/routes/admission.js.map +0 -1
- package/dist/routes/binding.d.ts.map +0 -1
- package/dist/routes/binding.js.map +0 -1
- package/dist/routes/collision.d.ts.map +0 -1
- package/dist/routes/collision.js.map +0 -1
- package/dist/routes/compiler.d.ts.map +0 -1
- package/dist/routes/compiler.js.map +0 -1
- package/dist/routes/credential.d.ts.map +0 -1
- package/dist/routes/credential.js.map +0 -1
- package/dist/routes/decode.d.ts.map +0 -1
- package/dist/routes/decode.js.map +0 -1
- package/dist/routes/encode.d.ts.map +0 -1
- package/dist/routes/encode.js.map +0 -1
- package/dist/routes/error-response.d.ts.map +0 -1
- package/dist/routes/error-response.js.map +0 -1
- package/dist/routes/error.d.ts.map +0 -1
- package/dist/routes/error.js.map +0 -1
- package/dist/routes/evidence.d.ts.map +0 -1
- package/dist/routes/evidence.js.map +0 -1
- package/dist/routes/index.d.ts.map +0 -1
- package/dist/routes/index.js.map +0 -1
- package/dist/routes/mapping.d.ts.map +0 -1
- package/dist/routes/mapping.js.map +0 -1
- package/dist/routes/match.d.ts.map +0 -1
- package/dist/routes/match.js.map +0 -1
- package/dist/routes/placement.d.ts.map +0 -1
- package/dist/routes/placement.js.map +0 -1
- package/dist/routes/plan.d.ts.map +0 -1
- package/dist/routes/plan.js.map +0 -1
- package/dist/routes/release-unavailable.d.ts +0 -9
- package/dist/routes/release-unavailable.d.ts.map +0 -1
- package/dist/routes/release-unavailable.js +0 -33
- package/dist/routes/release-unavailable.js.map +0 -1
- package/dist/routes/request.d.ts.map +0 -1
- package/dist/routes/request.js.map +0 -1
- package/dist/routes/reservation.d.ts.map +0 -1
- package/dist/routes/reservation.js.map +0 -1
- package/dist/routes/routing.d.ts.map +0 -1
- package/dist/routes/routing.js.map +0 -1
- package/dist/routes/scalar.d.ts.map +0 -1
- package/dist/routes/scalar.js.map +0 -1
- package/dist/routes/select.d.ts.map +0 -1
- package/dist/routes/select.js.map +0 -1
- package/dist/routes/stream.d.ts.map +0 -1
- package/dist/routes/stream.js.map +0 -1
- package/dist/routes/table.d.ts.map +0 -1
- package/dist/routes/table.js.map +0 -1
- package/dist/routes/target.d.ts.map +0 -1
- package/dist/routes/target.js.map +0 -1
- package/dist/routes/template.d.ts.map +0 -1
- package/dist/routes/template.js.map +0 -1
- package/dist/runtime/artifact.d.ts.map +0 -1
- package/dist/runtime/artifact.js.map +0 -1
- package/dist/runtime/index.d.ts.map +0 -1
- package/dist/runtime/index.js.map +0 -1
- package/dist/schema/index.d.ts.map +0 -1
- package/dist/schema/index.js.map +0 -1
- package/dist/schema/installation/index.d.ts.map +0 -1
- package/dist/schema/installation/index.js.map +0 -1
- package/dist/schema/installation/introspection/codec.d.ts.map +0 -1
- package/dist/schema/installation/introspection/codec.js.map +0 -1
- package/dist/schema/installation/introspection/index.d.ts.map +0 -1
- package/dist/schema/installation/introspection/index.js.map +0 -1
- package/dist/schema/installation/introspection/result.d.ts.map +0 -1
- package/dist/schema/installation/introspection/result.js.map +0 -1
|
@@ -1,227 +1,352 @@
|
|
|
1
|
+
import { is as isIssuer } from '@astrale-os/kernel-core/auth/issuer';
|
|
2
|
+
import { patterns } from '@astrale-os/kernel-dsl/v1/addressing';
|
|
1
3
|
import * as bundle from '@astrale-os/kernel-dsl/v1/bundle/transport';
|
|
2
|
-
import
|
|
3
|
-
import { json } from '
|
|
4
|
-
import
|
|
5
|
-
import * as
|
|
6
|
-
export const MEDIA_TYPE = 'application/vnd.astrale.schema-introspection.
|
|
4
|
+
import { revision as schemaRevision } from '@astrale-os/kernel-dsl/v1/schema/revision';
|
|
5
|
+
import { json } from '@astrale-os/kernel-dsl/value';
|
|
6
|
+
import { admitCallableBinding, admitViewBinding } from '../../../release/bindings/index.js';
|
|
7
|
+
import * as release from '../../../release/index.js';
|
|
8
|
+
export const MEDIA_TYPE = 'application/vnd.astrale.schema-introspection.v4+json';
|
|
9
|
+
const encoder = new TextEncoder();
|
|
10
|
+
const serializedBundles = new WeakMap();
|
|
11
|
+
const admittedBundles = new Map();
|
|
12
|
+
const MAXIMUM_ADMITTED_BUNDLES = 128;
|
|
13
|
+
// The Bundle travels as its JSON text inside the evidence; string escaping at most doubles it.
|
|
14
|
+
const BUNDLE_ESCAPE_FACTOR = 2;
|
|
15
|
+
// Encoding is bounded by the Server response policy, not by the default portable-value limits.
|
|
16
|
+
const ENCODE_LIMITS = Object.freeze({
|
|
17
|
+
maxBytes: Number.MAX_SAFE_INTEGER,
|
|
18
|
+
maxStringBytes: Number.MAX_SAFE_INTEGER,
|
|
19
|
+
});
|
|
7
20
|
export async function encode(input, result) {
|
|
8
|
-
const
|
|
9
|
-
const wire =
|
|
10
|
-
|
|
11
|
-
|
|
21
|
+
const request = admitRequest(input);
|
|
22
|
+
const wire = request.kind === 'installed'
|
|
23
|
+
? acceptInstalledReleases(result)
|
|
24
|
+
: request.kind === 'bundle'
|
|
25
|
+
? encodeDomainBundle(result)
|
|
26
|
+
: request.kind === 'dependencies'
|
|
27
|
+
? encodeDomainDependencies(result)
|
|
28
|
+
: encodeDomainInfo(result);
|
|
29
|
+
if (request.kind !== 'installed') {
|
|
30
|
+
proveRequestedOrigin(request, result);
|
|
31
|
+
}
|
|
32
|
+
return encoder.encode(json.serialize(wire, { limits: ENCODE_LIMITS }));
|
|
12
33
|
}
|
|
13
34
|
export async function decode(input, bytes, limits) {
|
|
35
|
+
const request = admitRequest(input);
|
|
14
36
|
if (!(bytes instanceof Uint8Array))
|
|
15
37
|
invalid('Schema introspection evidence must be binary.');
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
38
|
+
admitLimits(request, limits);
|
|
39
|
+
const maximumEvidenceBytes = limits.maximumReleaseBytes +
|
|
40
|
+
(request.kind === 'bundle' ? BUNDLE_ESCAPE_FACTOR * limits.maximumBundleBytes : 0) +
|
|
41
|
+
4_096;
|
|
42
|
+
if (bytes.byteLength > maximumEvidenceBytes) {
|
|
19
43
|
invalid('Schema introspection evidence exceeds its declared bounds.');
|
|
20
44
|
}
|
|
21
|
-
const { unpack } = await import('msgpackr/unpack');
|
|
22
45
|
let decoded;
|
|
23
46
|
try {
|
|
24
|
-
decoded =
|
|
47
|
+
decoded = json.decode(bytes, {
|
|
48
|
+
limits: {
|
|
49
|
+
maxBytes: maximumEvidenceBytes,
|
|
50
|
+
...(request.kind === 'bundle' ? { maxStringBytes: limits.maximumBundleBytes } : {}),
|
|
51
|
+
},
|
|
52
|
+
});
|
|
25
53
|
}
|
|
26
54
|
catch (cause) {
|
|
27
55
|
throw new TypeError('Schema introspection evidence is malformed.', { cause });
|
|
28
56
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
57
|
+
return acceptEvidence(request, decoded, limits);
|
|
58
|
+
}
|
|
59
|
+
function acceptEvidence(request, decoded, limits) {
|
|
60
|
+
if (request.kind === 'installed')
|
|
61
|
+
return acceptInstalledReleases(decoded);
|
|
62
|
+
const result = request.kind === 'bundle'
|
|
63
|
+
? decodeDomainBundle(decoded, limits.maximumBundleBytes)
|
|
64
|
+
: request.kind === 'dependencies'
|
|
65
|
+
? acceptDomainDependencies(decoded)
|
|
66
|
+
: acceptDomainInfo(decoded);
|
|
67
|
+
proveRequestedOrigin(request, result);
|
|
68
|
+
return result;
|
|
69
|
+
}
|
|
70
|
+
/** Admit the evidence bounds a request declares. */
|
|
71
|
+
function admitLimits(request, limits) {
|
|
72
|
+
admitLimit(limits.maximumReleaseBytes, 'Release');
|
|
73
|
+
if (request.kind === 'bundle')
|
|
74
|
+
admitLimit(limits.maximumBundleBytes, 'Bundle');
|
|
36
75
|
}
|
|
37
|
-
function
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
76
|
+
function proveRequestedOrigin(request, result) {
|
|
77
|
+
const origin = request.kind === 'inspect'
|
|
78
|
+
? result.origin
|
|
79
|
+
: result.domain.origin;
|
|
80
|
+
if (origin !== request.origin)
|
|
81
|
+
invalid('Schema introspection evidence does not match the requested origin.');
|
|
82
|
+
}
|
|
83
|
+
function encodeDomainDependencies(input) {
|
|
84
|
+
const admitted = acceptDomainDependencies(input);
|
|
85
|
+
return Object.freeze({
|
|
86
|
+
domain: encodeDomainInfo(admitted.domain),
|
|
87
|
+
dependencies: admitted.dependencies.map((binding) => ({ ...binding })),
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
/** Admit dependency bindings: origin-ordered, one per origin, each label agreeing with its revisions. */
|
|
91
|
+
export function acceptDomainDependencies(input) {
|
|
92
|
+
const value = record(input, 'Domain dependencies result');
|
|
93
|
+
exact(value, ['dependencies', 'domain'], 'Domain dependencies result');
|
|
94
|
+
const domain = acceptDomainInfo(value.domain);
|
|
95
|
+
if (!Array.isArray(value.dependencies))
|
|
96
|
+
invalid('Domain dependency bindings are invalid.');
|
|
97
|
+
const dependencies = value.dependencies.map(acceptDependencyBinding);
|
|
98
|
+
for (const [index, binding] of dependencies.entries()) {
|
|
99
|
+
const previous = dependencies[index - 1];
|
|
100
|
+
if (previous !== undefined && previous.origin >= binding.origin) {
|
|
101
|
+
invalid('Domain dependency bindings must be origin-ordered and unique.');
|
|
62
102
|
}
|
|
103
|
+
if (binding.origin === domain.origin)
|
|
104
|
+
invalid('Domain dependency bindings cannot name the Domain.');
|
|
63
105
|
}
|
|
64
|
-
return Object.freeze(
|
|
106
|
+
return Object.freeze({ domain, dependencies: Object.freeze(dependencies) });
|
|
65
107
|
}
|
|
66
|
-
function
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
108
|
+
function acceptDependencyBinding(input) {
|
|
109
|
+
const value = record(input, 'Domain dependency binding');
|
|
110
|
+
exact(value, ['active', 'binding', 'origin', 'pinned'], 'Domain dependency binding');
|
|
111
|
+
if (typeof value.origin !== 'string' || !patterns.origin.test(value.origin)) {
|
|
112
|
+
invalid('Domain dependency binding origin is invalid.');
|
|
113
|
+
}
|
|
114
|
+
if (typeof value.pinned !== 'string' || !patterns.revision.test(value.pinned)) {
|
|
115
|
+
invalid('Domain dependency binding pinned revision is invalid.');
|
|
116
|
+
}
|
|
117
|
+
if (typeof value.active !== 'string' || !patterns.revision.test(value.active)) {
|
|
118
|
+
invalid('Domain dependency binding active revision is invalid.');
|
|
119
|
+
}
|
|
120
|
+
const expected = value.pinned === value.active ? 'exact' : 'retained';
|
|
121
|
+
if (value.binding !== expected)
|
|
122
|
+
invalid('Domain dependency binding label is invalid.');
|
|
123
|
+
return Object.freeze({
|
|
124
|
+
origin: value.origin,
|
|
125
|
+
pinned: value.pinned,
|
|
126
|
+
active: value.active,
|
|
127
|
+
binding: expected,
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
/** Admit the installed listing: origin-ordered, one release per origin, each pin of one kind. */
|
|
131
|
+
function acceptInstalledReleases(input) {
|
|
132
|
+
if (!Array.isArray(input))
|
|
133
|
+
invalid('Installed releases are invalid.');
|
|
134
|
+
const releases = input.map(acceptInstalledRelease);
|
|
135
|
+
for (const [index, installed] of releases.entries()) {
|
|
136
|
+
const previous = releases[index - 1];
|
|
137
|
+
if (previous !== undefined && previous.origin >= installed.origin) {
|
|
138
|
+
invalid('Installed releases must be origin-ordered and unique.');
|
|
90
139
|
}
|
|
91
140
|
}
|
|
92
|
-
|
|
93
|
-
|
|
141
|
+
return Object.freeze(releases);
|
|
142
|
+
}
|
|
143
|
+
function acceptInstalledRelease(input) {
|
|
144
|
+
const value = record(input, 'Installed release');
|
|
145
|
+
exact(value, ['inFlight', 'issuer', 'origin', 'pin', 'revision', 'url'], 'Installed release');
|
|
146
|
+
if (typeof value.origin !== 'string' || !patterns.origin.test(value.origin)) {
|
|
147
|
+
invalid('Installed release origin is invalid.');
|
|
148
|
+
}
|
|
149
|
+
if (typeof value.revision !== 'string' || !patterns.revision.test(value.revision)) {
|
|
150
|
+
invalid('Installed release revision is invalid.');
|
|
94
151
|
}
|
|
95
|
-
|
|
152
|
+
const issuer = issuerId(value.issuer, 'Installed release issuer');
|
|
153
|
+
return Object.freeze({
|
|
154
|
+
origin: value.origin,
|
|
155
|
+
revision: value.revision,
|
|
156
|
+
issuer,
|
|
157
|
+
url: deploymentUrl(value.url),
|
|
158
|
+
pin: installedPin(value.pin),
|
|
159
|
+
inFlight: inFlightIssuers(value.inFlight, issuer),
|
|
160
|
+
});
|
|
96
161
|
}
|
|
97
|
-
function
|
|
98
|
-
|
|
162
|
+
function installedPin(input) {
|
|
163
|
+
const value = record(input, 'Installed pin');
|
|
164
|
+
if (value.kind === 'release') {
|
|
165
|
+
exact(value, ['build', 'kind', 'release'], 'Installed release pin');
|
|
99
166
|
return Object.freeze({
|
|
100
|
-
kind: '
|
|
101
|
-
|
|
167
|
+
kind: 'release',
|
|
168
|
+
release: digest(value.release, 'Installed release'),
|
|
169
|
+
build: digest(value.build, 'Installed build'),
|
|
102
170
|
});
|
|
103
171
|
}
|
|
104
|
-
|
|
172
|
+
return invalid('Installed pin kind is invalid.');
|
|
173
|
+
}
|
|
174
|
+
function inFlightIssuers(input, current) {
|
|
175
|
+
if (!Array.isArray(input))
|
|
176
|
+
invalid('Installed release in-flight issuers are invalid.');
|
|
177
|
+
const entries = input.map((entry) => {
|
|
178
|
+
const value = record(entry, 'In-flight issuer');
|
|
179
|
+
exact(value, ['issuer', 'release', 'replacedAt'], 'In-flight issuer');
|
|
180
|
+
if (typeof value.replacedAt !== 'string' || !isInstant(value.replacedAt)) {
|
|
181
|
+
invalid('In-flight issuer replacement instant is invalid.');
|
|
182
|
+
}
|
|
105
183
|
return Object.freeze({
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
184
|
+
issuer: issuerId(value.issuer, 'In-flight issuer'),
|
|
185
|
+
release: digest(value.release, 'In-flight release'),
|
|
186
|
+
replacedAt: value.replacedAt,
|
|
109
187
|
});
|
|
188
|
+
});
|
|
189
|
+
for (const [index, entry] of entries.entries()) {
|
|
190
|
+
if (entry.issuer === current)
|
|
191
|
+
invalid('An in-flight issuer cannot be the current issuer.');
|
|
192
|
+
const previous = entries[index - 1];
|
|
193
|
+
if (previous !== undefined && previous.issuer >= entry.issuer) {
|
|
194
|
+
invalid('In-flight issuers must be issuer-ordered and unique.');
|
|
195
|
+
}
|
|
110
196
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
});
|
|
197
|
+
return Object.freeze(entries);
|
|
198
|
+
}
|
|
199
|
+
function issuerId(input, label) {
|
|
200
|
+
if (!isIssuer(input))
|
|
201
|
+
invalid(`${label} is invalid.`);
|
|
202
|
+
return input;
|
|
203
|
+
}
|
|
204
|
+
/** An HTTP(S) origin, spelled exactly as `URL.origin` spells it. */
|
|
205
|
+
function deploymentUrl(input) {
|
|
206
|
+
let url;
|
|
207
|
+
try {
|
|
208
|
+
url = typeof input === 'string' ? new URL(input) : undefined;
|
|
116
209
|
}
|
|
117
|
-
|
|
210
|
+
catch {
|
|
211
|
+
url = undefined;
|
|
212
|
+
}
|
|
213
|
+
if (url === undefined || (url.protocol !== 'https:' && url.protocol !== 'http:')) {
|
|
214
|
+
invalid('Installed release URL is invalid.');
|
|
215
|
+
}
|
|
216
|
+
if (url.origin !== input)
|
|
217
|
+
invalid('Installed release URL must be an origin.');
|
|
218
|
+
return url.origin;
|
|
118
219
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
220
|
+
/** A UTC millisecond instant, spelled exactly as `Date.prototype.toISOString` spells it. */
|
|
221
|
+
function isInstant(input) {
|
|
222
|
+
const time = Date.parse(input);
|
|
223
|
+
return Number.isFinite(time) && new Date(time).toISOString() === input;
|
|
224
|
+
}
|
|
225
|
+
function encodeDomainBundle(input) {
|
|
226
|
+
exact(input, ['bundle', 'domain'], 'Domain Bundle result');
|
|
227
|
+
const admittedDomain = acceptDomainInfo(input.domain);
|
|
228
|
+
const domain = encodeDomainInfo(admittedDomain);
|
|
229
|
+
proveBundle(input.bundle, admittedDomain);
|
|
230
|
+
const text = serializedBundles.get(input.bundle) ?? bundle.serialize(input.bundle);
|
|
231
|
+
if (!serializedBundles.has(input.bundle))
|
|
232
|
+
serializedBundles.set(input.bundle, text);
|
|
233
|
+
return Object.freeze({ domain, bundle: text });
|
|
234
|
+
}
|
|
235
|
+
function decodeDomainBundle(input, maximum) {
|
|
236
|
+
const value = record(input, 'Domain Bundle result');
|
|
237
|
+
exact(value, ['bundle', 'domain'], 'Domain Bundle result');
|
|
238
|
+
const domain = acceptDomainInfo(value.domain);
|
|
239
|
+
const text = boundedText(value.bundle, maximum, 'Bundle');
|
|
240
|
+
const cached = admittedBundles.get(domain.generation);
|
|
241
|
+
if (cached !== undefined && cached.text === text) {
|
|
242
|
+
return Object.freeze({ domain, bundle: cached.bundle });
|
|
128
243
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
kind: 'local',
|
|
133
|
-
artifact: ref(input.artifact, runtime.MEDIA_TYPE, 'Local Runtime Artifact'),
|
|
134
|
-
bundle: ref(input.bundle, publication.BUNDLE_MEDIA_TYPE, 'Local schema Bundle'),
|
|
135
|
-
});
|
|
244
|
+
let admitted;
|
|
245
|
+
try {
|
|
246
|
+
admitted = bundle.decode(text);
|
|
136
247
|
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
throw new TypeError('Remote installed Publication is invalid.', { cause });
|
|
146
|
-
}
|
|
147
|
-
if (!equal(encoded, publication.encode(admitted))) {
|
|
148
|
-
invalid('Remote installed Publication is not canonical.');
|
|
149
|
-
}
|
|
150
|
-
return Object.freeze({ kind: 'remote', publication: admitted });
|
|
248
|
+
catch (cause) {
|
|
249
|
+
throw new TypeError('Installed Domain Bundle is invalid.', { cause });
|
|
250
|
+
}
|
|
251
|
+
proveBundle(admitted, domain);
|
|
252
|
+
admittedBundles.delete(domain.generation);
|
|
253
|
+
admittedBundles.set(domain.generation, Object.freeze({ text, bundle: admitted }));
|
|
254
|
+
if (admittedBundles.size > MAXIMUM_ADMITTED_BUNDLES) {
|
|
255
|
+
admittedBundles.delete(admittedBundles.keys().next().value);
|
|
151
256
|
}
|
|
152
|
-
return
|
|
257
|
+
return Object.freeze({ domain, bundle: admitted });
|
|
153
258
|
}
|
|
154
|
-
function
|
|
155
|
-
|
|
156
|
-
invalid('Bundle source evidence is missing.');
|
|
157
|
-
const admitted = source.kind === 'remote'
|
|
158
|
-
? publication.acceptBundle(source.publication, input)
|
|
159
|
-
: bundle.accept(input);
|
|
160
|
-
const encoded = bundle.encode(admitted);
|
|
161
|
-
if (source.kind !== 'remote' &&
|
|
162
|
-
!same(artifact.identify(encoded, publication.BUNDLE_MEDIA_TYPE), source.bundle)) {
|
|
163
|
-
invalid('Local schema Bundle does not match its source Ref.');
|
|
164
|
-
}
|
|
165
|
-
return encoded;
|
|
259
|
+
function encodeDomainInfo(input) {
|
|
260
|
+
return acceptDomainInfo(input);
|
|
166
261
|
}
|
|
167
|
-
function
|
|
168
|
-
const
|
|
262
|
+
export function acceptDomainInfo(input) {
|
|
263
|
+
const value = record(input, 'Domain info');
|
|
264
|
+
exact(value, ['bindings', 'capabilities', 'generation', 'origin', 'release', 'readiness', 'revision'], 'Domain info');
|
|
265
|
+
if (typeof value.origin !== 'string' || !patterns.origin.test(value.origin)) {
|
|
266
|
+
invalid('Domain info origin is invalid.');
|
|
267
|
+
}
|
|
268
|
+
if (typeof value.revision !== 'string' || !patterns.revision.test(value.revision)) {
|
|
269
|
+
invalid('Domain info revision is invalid.');
|
|
270
|
+
}
|
|
271
|
+
const origin = value.origin;
|
|
272
|
+
const revision = value.revision;
|
|
273
|
+
const published = releaseReference(value.release, origin, revision);
|
|
274
|
+
return Object.freeze({
|
|
275
|
+
origin,
|
|
276
|
+
revision,
|
|
277
|
+
generation: digest(value.generation, 'Domain generation'),
|
|
278
|
+
release: published,
|
|
279
|
+
readiness: digest(value.readiness, 'Domain readiness'),
|
|
280
|
+
capabilities: capabilities(value.capabilities),
|
|
281
|
+
bindings: bindings(value.bindings, origin),
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
function releaseReference(input, origin, revision) {
|
|
285
|
+
if (input === null)
|
|
286
|
+
return null;
|
|
169
287
|
let admitted;
|
|
170
288
|
try {
|
|
171
|
-
admitted =
|
|
172
|
-
source.kind === 'remote'
|
|
173
|
-
? publication.decodeBundle(source.publication, encoded)
|
|
174
|
-
: bundle.decode(encoded);
|
|
289
|
+
admitted = release.acceptReference(input);
|
|
175
290
|
}
|
|
176
291
|
catch (cause) {
|
|
177
|
-
throw new TypeError('
|
|
292
|
+
throw new TypeError('Domain Release metadata is invalid.', { cause });
|
|
178
293
|
}
|
|
179
|
-
if (
|
|
180
|
-
invalid('
|
|
181
|
-
if (source.kind !== 'remote' &&
|
|
182
|
-
!same(artifact.identify(encoded, publication.BUNDLE_MEDIA_TYPE), source.bundle)) {
|
|
183
|
-
invalid('Local schema Bundle does not match its source Ref.');
|
|
294
|
+
if (admitted.origin !== origin || admitted.revision !== revision) {
|
|
295
|
+
invalid('Domain Release metadata does not match its Schema coordinate.');
|
|
184
296
|
}
|
|
185
297
|
return admitted;
|
|
186
298
|
}
|
|
187
|
-
function
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
}
|
|
203
|
-
|
|
299
|
+
function bindings(input, origin) {
|
|
300
|
+
const value = record(input, 'Domain bindings');
|
|
301
|
+
exact(value, ['callables', 'views'], 'Domain bindings');
|
|
302
|
+
const { callables, views } = value;
|
|
303
|
+
if (!Array.isArray(callables) || !Array.isArray(views)) {
|
|
304
|
+
invalid('Domain bindings are invalid.');
|
|
305
|
+
}
|
|
306
|
+
try {
|
|
307
|
+
return Object.freeze({
|
|
308
|
+
callables: Object.freeze(callables.map((entry) => admitCallableBinding(entry, origin))),
|
|
309
|
+
views: Object.freeze(views.map((entry) => admitViewBinding(entry, origin))),
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
catch (cause) {
|
|
313
|
+
throw new TypeError('Domain bindings are invalid.', { cause });
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
function proveBundle(input, domain) {
|
|
317
|
+
if (input.root.origin !== domain.origin || schemaRevision(input.root) !== domain.revision) {
|
|
318
|
+
invalid('Installed Bundle root does not match the ready Domain coordinate.');
|
|
319
|
+
}
|
|
204
320
|
}
|
|
205
321
|
function capabilities(input) {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
exact(input, ['materialized', 'requested'], 'Installation capabilities');
|
|
322
|
+
const value = record(input, 'Domain capabilities');
|
|
323
|
+
exact(value, ['materialized', 'requested'], 'Domain capabilities');
|
|
209
324
|
try {
|
|
210
|
-
const requested =
|
|
211
|
-
const materialized =
|
|
212
|
-
capabilities:
|
|
325
|
+
const requested = release.admitRequirements({ capabilities: value.requested }).capabilities;
|
|
326
|
+
const materialized = release.admitRequirements({
|
|
327
|
+
capabilities: value.materialized,
|
|
213
328
|
}).capabilities;
|
|
214
329
|
return Object.freeze({ requested, materialized });
|
|
215
330
|
}
|
|
216
331
|
catch (cause) {
|
|
217
|
-
throw new TypeError('
|
|
332
|
+
throw new TypeError('Domain capabilities are invalid.', { cause });
|
|
218
333
|
}
|
|
219
334
|
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
335
|
+
/** Admit one introspection request. */
|
|
336
|
+
function admitRequest(input) {
|
|
337
|
+
const value = record(input, 'Schema introspection request');
|
|
338
|
+
if (value.kind === 'installed') {
|
|
339
|
+
exact(value, ['kind'], 'Schema introspection request');
|
|
340
|
+
return Object.freeze({ kind: 'installed' });
|
|
223
341
|
}
|
|
224
|
-
|
|
342
|
+
exact(value, ['kind', 'origin'], 'Schema introspection request');
|
|
343
|
+
if (value.kind !== 'inspect' && value.kind !== 'bundle' && value.kind !== 'dependencies') {
|
|
344
|
+
invalid('Schema introspection kind is invalid.');
|
|
345
|
+
}
|
|
346
|
+
if (typeof value.origin !== 'string' || !patterns.origin.test(value.origin)) {
|
|
347
|
+
invalid('Schema introspection origin is invalid.');
|
|
348
|
+
}
|
|
349
|
+
return Object.freeze({ kind: value.kind, origin: value.origin });
|
|
225
350
|
}
|
|
226
351
|
function digest(input, label) {
|
|
227
352
|
if (typeof input !== 'string' || !/^sha256:[0-9a-f]{64}$/u.test(input)) {
|
|
@@ -229,31 +354,24 @@ function digest(input, label) {
|
|
|
229
354
|
}
|
|
230
355
|
return input;
|
|
231
356
|
}
|
|
232
|
-
function
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
}
|
|
237
|
-
catch (cause) {
|
|
238
|
-
throw new TypeError(`${label} Ref is invalid.`, { cause });
|
|
239
|
-
}
|
|
240
|
-
if (admitted.mediaType !== mediaType)
|
|
241
|
-
invalid(`${label} media type is invalid.`);
|
|
242
|
-
return admitted;
|
|
243
|
-
}
|
|
244
|
-
function same(left, right) {
|
|
245
|
-
return (left.digest === right.digest && left.mediaType === right.mediaType && left.size === right.size);
|
|
246
|
-
}
|
|
247
|
-
function boundedBytes(input, maximum, label) {
|
|
248
|
-
if (!(input instanceof Uint8Array) || input.byteLength === 0 || input.byteLength > maximum) {
|
|
357
|
+
function boundedText(input, maximum, label) {
|
|
358
|
+
if (typeof input !== 'string' ||
|
|
359
|
+
input.length === 0 ||
|
|
360
|
+
encoder.encode(input).byteLength > maximum) {
|
|
249
361
|
invalid(`${label} evidence is invalid or exceeds its bound.`);
|
|
250
362
|
}
|
|
251
|
-
return
|
|
363
|
+
return input;
|
|
252
364
|
}
|
|
253
365
|
function admitLimit(input, label) {
|
|
254
366
|
if (!Number.isSafeInteger(input) || input < 1)
|
|
255
367
|
invalid(`${label} evidence bound is invalid.`);
|
|
256
368
|
}
|
|
369
|
+
function record(input, label) {
|
|
370
|
+
if (input === null || typeof input !== 'object' || Array.isArray(input)) {
|
|
371
|
+
invalid(`${label} is invalid.`);
|
|
372
|
+
}
|
|
373
|
+
return input;
|
|
374
|
+
}
|
|
257
375
|
function exact(input, expected, label) {
|
|
258
376
|
const keys = Object.keys(input).sort();
|
|
259
377
|
const wanted = [...expected].sort();
|
|
@@ -261,13 +379,6 @@ function exact(input, expected, label) {
|
|
|
261
379
|
invalid(`${label} fields are invalid.`);
|
|
262
380
|
}
|
|
263
381
|
}
|
|
264
|
-
function equal(left, right) {
|
|
265
|
-
return left.byteLength === right.byteLength && left.every((byte, index) => byte === right[index]);
|
|
266
|
-
}
|
|
267
|
-
function isRecord(input) {
|
|
268
|
-
return input !== null && typeof input === 'object' && !Array.isArray(input);
|
|
269
|
-
}
|
|
270
382
|
function invalid(message) {
|
|
271
383
|
throw new TypeError(message);
|
|
272
384
|
}
|
|
273
|
-
//# sourceMappingURL=codec.js.map
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
export { MEDIA_TYPE, decode, encode } from './codec.js';
|
|
2
|
-
export type { Digest,
|
|
3
|
-
//# sourceMappingURL=index.d.ts.map
|
|
1
|
+
export { MEDIA_TYPE, acceptDomainDependencies, acceptDomainInfo, decode, encode } from './codec.js';
|
|
2
|
+
export type { DependencyBinding, Digest, DomainBundle, DomainDependencies, DomainInfo, InFlightIssuer, InstalledPin, InstalledRelease, Limits, ResultFor, } from './result.js';
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export { MEDIA_TYPE, decode, encode } from './codec.js';
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export { MEDIA_TYPE, acceptDomainDependencies, acceptDomainInfo, decode, encode } from './codec.js';
|