@astrale-os/kernel-client 0.6.0-beta.9 → 0.6.0
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/auth/auth.d.ts +22 -10
- package/dist/auth/auth.js +5 -7
- package/dist/auth/authorization.d.ts +4 -2
- package/dist/auth/authorization.js +25 -6
- package/dist/auth/credential.d.ts +7 -4
- package/dist/auth/credential.js +6 -3
- package/dist/auth/identity.d.ts +7 -9
- package/dist/auth/identity.js +0 -1
- package/dist/auth/index.d.ts +4 -5
- package/dist/auth/index.js +2 -4
- package/dist/auth/register.d.ts +24 -0
- package/dist/auth/register.js +10 -0
- package/dist/client/admission.d.ts +4 -2
- package/dist/client/admission.js +9 -11
- package/dist/client/client.d.ts +4 -3
- package/dist/client/client.js +16 -4
- package/dist/client/credential.d.ts +5 -3
- package/dist/client/credential.js +7 -3
- package/dist/client/index.d.ts +3 -4
- package/dist/client/index.js +2 -3
- package/dist/client/request.d.ts +11 -4
- package/dist/client/request.js +50 -6
- package/dist/client/result.d.ts +7 -5
- package/dist/client/result.js +13 -5
- package/dist/client/routing-control.d.ts +11 -4
- package/dist/client/routing-control.js +18 -4
- package/dist/errors/client-error.d.ts +0 -1
- package/dist/errors/client-error.js +0 -1
- package/dist/errors/exchange-error.d.ts +19 -0
- package/dist/errors/exchange-error.js +9 -0
- package/dist/errors/index.d.ts +2 -1
- package/dist/errors/index.js +2 -1
- package/dist/errors/miss-error.d.ts +0 -1
- package/dist/errors/miss-error.js +0 -1
- package/dist/errors/protocol-error.d.ts +0 -1
- package/dist/errors/protocol-error.js +0 -1
- package/dist/errors/refusal.d.ts +12 -0
- package/dist/errors/refusal.js +40 -0
- package/dist/errors/response-error.d.ts +0 -1
- package/dist/errors/response-error.js +0 -1
- package/dist/errors/session-error.d.ts +0 -1
- package/dist/errors/session-error.js +0 -1
- package/dist/errors/stale-route-error.d.ts +4 -4
- package/dist/errors/stale-route-error.js +5 -5
- package/dist/errors/transport-error.d.ts +3 -3
- package/dist/errors/transport-error.js +0 -1
- package/dist/graph/domain/binding.d.ts +0 -1
- package/dist/graph/domain/binding.js +4 -1
- package/dist/graph/domain/domain.typecheck.d.ts +0 -1
- package/dist/graph/domain/domain.typecheck.js +21 -1
- package/dist/graph/domain/index.d.ts +0 -1
- package/dist/graph/domain/index.js +0 -1
- package/dist/graph/domain/model.d.ts +0 -1
- package/dist/graph/domain/model.js +0 -1
- package/dist/graph/domain/page.d.ts +0 -1
- package/dist/graph/domain/page.js +0 -1
- package/dist/graph/domain/project.d.ts +0 -1
- package/dist/graph/domain/project.js +10 -7
- package/dist/graph/domain/provenance.d.ts +0 -1
- package/dist/graph/domain/provenance.js +0 -1
- package/dist/graph/errors.d.ts +0 -1
- package/dist/graph/errors.js +1 -3
- package/dist/graph/expectation.d.ts +3 -0
- package/dist/graph/expectation.js +6 -0
- package/dist/graph/graph.d.ts +6 -3
- package/dist/graph/graph.js +0 -1
- package/dist/graph/index.d.ts +2 -3
- package/dist/graph/index.js +1 -2
- package/dist/graph/mutation.d.ts +2 -4
- package/dist/graph/mutation.js +12 -2
- package/dist/graph/page/index.d.ts +0 -1
- package/dist/graph/page/index.js +0 -1
- package/dist/graph/page/neighbors.d.ts +0 -1
- package/dist/graph/page/neighbors.js +2 -2
- package/dist/graph/page/page.d.ts +0 -1
- package/dist/graph/page/page.js +0 -1
- package/dist/graph/page-contract.d.ts +6 -1
- package/dist/graph/page-contract.js +0 -1
- package/dist/graph/provenance.d.ts +2 -1
- package/dist/graph/provenance.js +5 -1
- package/dist/graph/query.d.ts +3 -1
- package/dist/graph/query.js +25 -10
- package/dist/graph/read.d.ts +0 -1
- package/dist/graph/read.js +6 -5
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/pacer/batcher/batcher.d.ts +0 -1
- package/dist/pacer/batcher/batcher.js +0 -1
- package/dist/pacer/batcher/defaults.d.ts +0 -1
- package/dist/pacer/batcher/defaults.js +0 -1
- package/dist/pacer/batcher/index.d.ts +0 -1
- package/dist/pacer/batcher/index.js +0 -1
- package/dist/pacer/index.d.ts +1 -2
- package/dist/pacer/index.js +1 -2
- package/dist/pacer/limiter/defaults.d.ts +0 -1
- package/dist/pacer/limiter/defaults.js +0 -1
- package/dist/pacer/limiter/index.d.ts +0 -1
- package/dist/pacer/limiter/index.js +0 -1
- package/dist/pacer/limiter/limiter.d.ts +0 -1
- package/dist/pacer/limiter/limiter.js +0 -1
- package/dist/pacer/queue/defaults.d.ts +0 -1
- package/dist/pacer/queue/defaults.js +0 -1
- package/dist/pacer/queue/index.d.ts +0 -1
- package/dist/pacer/queue/index.js +0 -1
- package/dist/pacer/queue/queue.d.ts +0 -1
- package/dist/pacer/queue/queue.js +0 -1
- package/dist/pacer/retry/defaults.d.ts +0 -1
- package/dist/pacer/retry/defaults.js +0 -1
- package/dist/pacer/retry/index.d.ts +1 -1
- package/dist/pacer/retry/index.js +1 -1
- package/dist/pacer/retry/refusals.d.ts +7 -0
- package/dist/pacer/retry/refusals.js +10 -0
- package/dist/pacer/retry/retry.d.ts +2 -1
- package/dist/pacer/retry/retry.js +33 -2
- package/dist/pool/index.d.ts +0 -1
- package/dist/pool/index.js +0 -1
- package/dist/pool/pool.d.ts +0 -1
- package/dist/pool/pool.js +0 -1
- package/dist/pool/target.d.ts +0 -1
- package/dist/pool/target.js +0 -1
- package/dist/schema/admission.d.ts +1 -2
- package/dist/schema/admission.js +2 -3
- package/dist/schema/contracts.d.ts +97 -5
- package/dist/schema/contracts.js +0 -1
- package/dist/schema/index.d.ts +3 -3
- package/dist/schema/index.js +1 -2
- package/dist/schema/installation.d.ts +104 -0
- package/dist/schema/installation.js +144 -0
- package/dist/schema/introspection.d.ts +0 -1
- package/dist/schema/introspection.js +10 -3
- package/dist/schema/operation.d.ts +0 -1
- package/dist/schema/operation.js +1 -2
- package/dist/schema/schema.d.ts +32 -11
- package/dist/schema/schema.js +94 -19
- package/dist/session/admission.d.ts +6 -0
- package/dist/session/admission.js +52 -0
- package/dist/session/bound.d.ts +17 -14
- package/dist/session/bound.js +96 -10
- package/dist/session/content/api.d.ts +45 -0
- package/dist/session/content/api.js +28 -0
- package/dist/session/content/batch.d.ts +5 -0
- package/dist/session/content/batch.js +93 -0
- package/dist/session/content/index.d.ts +1 -0
- package/dist/session/content/index.js +1 -0
- package/dist/session/content/input.d.ts +9 -0
- package/dist/session/content/input.js +33 -0
- package/dist/session/content/parts.d.ts +36 -0
- package/dist/session/content/parts.js +154 -0
- package/dist/session/content/retry.d.ts +3 -0
- package/dist/session/content/retry.js +41 -0
- package/dist/session/content/wire.d.ts +12 -0
- package/dist/session/content/wire.js +60 -0
- package/dist/session/context/control.d.ts +0 -1
- package/dist/session/context/control.js +0 -1
- package/dist/session/context/index.d.ts +2 -3
- package/dist/session/context/index.js +2 -3
- package/dist/session/context/limits.d.ts +1 -2
- package/dist/session/context/limits.js +1 -2
- package/dist/session/context/operation.d.ts +5 -3
- package/dist/session/context/operation.js +1 -2
- package/dist/session/context/policy.d.ts +0 -2
- package/dist/session/context/policy.js +0 -17
- package/dist/session/credential/credentials.d.ts +65 -0
- package/dist/session/credential/credentials.js +296 -0
- package/dist/session/credential/index.d.ts +1 -0
- package/dist/session/credential/index.js +1 -0
- package/dist/session/credential/limits.d.ts +14 -0
- package/dist/session/credential/limits.js +14 -0
- package/dist/session/discovery/bundle.d.ts +9 -5
- package/dist/session/discovery/bundle.js +43 -26
- package/dist/session/discovery/discovery.d.ts +12 -5
- package/dist/session/discovery/discovery.js +42 -13
- package/dist/session/discovery/index.d.ts +6 -2
- package/dist/session/discovery/index.js +4 -8
- package/dist/session/discovery/release.d.ts +30 -0
- package/dist/session/discovery/release.js +81 -0
- package/dist/session/discovery/response.d.ts +3 -0
- package/dist/session/discovery/response.js +59 -0
- package/dist/session/discovery/snapshot.d.ts +4 -5
- package/dist/session/discovery/snapshot.js +2 -3
- package/dist/session/discovery/transport.d.ts +1 -4
- package/dist/session/discovery/transport.js +0 -1
- package/dist/session/exchange/domain.d.ts +27 -0
- package/dist/session/exchange/domain.js +63 -0
- package/dist/session/exchange/exchange.d.ts +48 -0
- package/dist/session/exchange/exchange.js +54 -0
- package/dist/session/exchange/index.d.ts +5 -0
- package/dist/session/exchange/index.js +5 -0
- package/dist/session/exchange/issuer.d.ts +18 -0
- package/dist/session/exchange/issuer.js +149 -0
- package/dist/session/exchange/limits.d.ts +10 -0
- package/dist/session/exchange/limits.js +10 -0
- package/dist/session/exchange/options.d.ts +37 -0
- package/dist/session/exchange/options.js +65 -0
- package/dist/session/exchange/presentation.d.ts +19 -0
- package/dist/session/exchange/presentation.js +72 -0
- package/dist/session/exchange/source.d.ts +33 -0
- package/dist/session/exchange/source.js +78 -0
- package/dist/session/execution.d.ts +88 -0
- package/dist/session/execution.js +34 -0
- package/dist/session/index.d.ts +9 -6
- package/dist/session/index.js +3 -2
- package/dist/session/options.d.ts +65 -0
- package/dist/session/options.js +132 -0
- package/dist/session/reference.d.ts +38 -19
- package/dist/session/reference.js +34 -12
- package/dist/session/routing/auth.d.ts +10 -1
- package/dist/session/routing/auth.js +8 -2
- package/dist/session/routing/cache.d.ts +21 -7
- package/dist/session/routing/cache.js +103 -73
- package/dist/session/routing/dispatch.d.ts +19 -11
- package/dist/session/routing/dispatch.js +115 -89
- package/dist/session/routing/envelope.d.ts +4 -3
- package/dist/session/routing/envelope.js +14 -10
- package/dist/session/routing/expiry.d.ts +4 -0
- package/dist/session/routing/expiry.js +32 -0
- package/dist/session/routing/index.d.ts +5 -5
- package/dist/session/routing/index.js +4 -3
- package/dist/session/routing/integrity.d.ts +7 -0
- package/dist/session/routing/integrity.js +44 -0
- package/dist/session/routing/recovery.d.ts +16 -0
- package/dist/session/routing/recovery.js +41 -0
- package/dist/session/routing/request.d.ts +13 -1
- package/dist/session/routing/request.js +28 -2
- package/dist/session/routing/result.d.ts +5 -0
- package/dist/session/routing/result.js +16 -0
- package/dist/session/routing/store.d.ts +23 -0
- package/dist/session/routing/store.js +99 -0
- package/dist/session/session.d.ts +37 -33
- package/dist/session/session.js +134 -157
- package/dist/session/session.typecheck.d.ts +0 -1
- package/dist/session/session.typecheck.js +183 -5
- package/dist/session/views/catalog.d.ts +9 -6
- package/dist/session/views/catalog.js +29 -23
- package/dist/session/views/index.d.ts +1 -2
- package/dist/session/views/index.js +1 -2
- package/dist/session/views/resolve.d.ts +6 -5
- package/dist/session/views/resolve.js +14 -7
- package/dist/store/entity-index.d.ts +1 -3
- package/dist/store/entity-index.js +0 -4
- package/dist/store/index.d.ts +0 -1
- package/dist/store/index.js +0 -1
- package/dist/store/memory.d.ts +2 -2
- package/dist/store/memory.js +60 -18
- package/dist/store/mutation.d.ts +1 -2
- package/dist/store/mutation.js +6 -4
- package/dist/store/observe.d.ts +0 -1
- package/dist/store/observe.js +0 -1
- package/dist/store/optimistic.d.ts +0 -1
- package/dist/store/optimistic.js +0 -1
- package/dist/store/query-key.d.ts +2 -2
- package/dist/store/query-key.js +7 -3
- package/dist/store/shape.d.ts +6 -3
- package/dist/store/shape.js +4 -2
- package/dist/store/store.d.ts +2 -4
- package/dist/store/store.js +6 -5
- package/dist/store/store.typecheck.d.ts +0 -1
- package/dist/store/store.typecheck.js +0 -6
- package/dist/transport/auto/decision.d.ts +3 -3
- package/dist/transport/auto/decision.js +0 -1
- package/dist/transport/auto/fallback.d.ts +2 -2
- package/dist/transport/auto/fallback.js +2 -2
- package/dist/transport/auto/index.d.ts +0 -1
- package/dist/transport/auto/index.js +0 -1
- package/dist/transport/auto/transport.d.ts +0 -2
- package/dist/transport/auto/transport.js +0 -3
- package/dist/transport/auto/warning.d.ts +0 -1
- package/dist/transport/auto/warning.js +5 -3
- package/dist/transport/deadline.d.ts +0 -1
- package/dist/transport/deadline.js +0 -1
- package/dist/transport/failure.d.ts +0 -1
- package/dist/transport/failure.js +0 -1
- package/dist/transport/http/admission.d.ts +5 -0
- package/dist/transport/http/admission.js +104 -0
- package/dist/transport/http/binary.d.ts +5 -0
- package/dist/transport/http/binary.js +70 -0
- package/dist/transport/http/byte-stream.d.ts +18 -0
- package/dist/transport/http/byte-stream.js +94 -0
- package/dist/transport/http/configuration.d.ts +24 -0
- package/dist/transport/http/configuration.js +116 -0
- package/dist/transport/http/index.d.ts +2 -2
- package/dist/transport/http/index.js +0 -1
- package/dist/transport/http/response.d.ts +8 -2
- package/dist/transport/http/response.js +11 -7
- package/dist/transport/http/retired.d.ts +8 -0
- package/dist/transport/http/retired.js +28 -0
- package/dist/transport/http/stream.d.ts +0 -1
- package/dist/transport/http/stream.js +0 -1
- package/dist/transport/http/transport.d.ts +4 -18
- package/dist/transport/http/transport.js +48 -252
- package/dist/transport/index.d.ts +1 -2
- package/dist/transport/index.js +0 -1
- package/dist/transport/transport.d.ts +20 -3
- package/dist/transport/transport.js +0 -1
- package/dist/transport/websocket/connection.d.ts +2 -2
- package/dist/transport/websocket/connection.js +5 -3
- package/dist/transport/websocket/exchange.d.ts +0 -1
- package/dist/transport/websocket/exchange.js +8 -1
- package/dist/transport/websocket/index.d.ts +0 -1
- package/dist/transport/websocket/index.js +0 -1
- package/dist/transport/websocket/transport.d.ts +0 -4
- package/dist/transport/websocket/transport.js +2 -18
- package/package.json +12 -15
- package/dist/auth/auth.d.ts.map +0 -1
- package/dist/auth/auth.js.map +0 -1
- package/dist/auth/authorization.d.ts.map +0 -1
- package/dist/auth/authorization.js.map +0 -1
- package/dist/auth/credential.d.ts.map +0 -1
- package/dist/auth/credential.js.map +0 -1
- package/dist/auth/identity.d.ts.map +0 -1
- package/dist/auth/identity.js.map +0 -1
- package/dist/auth/index.d.ts.map +0 -1
- package/dist/auth/index.js.map +0 -1
- package/dist/auth/provision.d.ts +0 -9
- package/dist/auth/provision.d.ts.map +0 -1
- package/dist/auth/provision.js +0 -11
- package/dist/auth/provision.js.map +0 -1
- package/dist/client/admission.d.ts.map +0 -1
- package/dist/client/admission.js.map +0 -1
- package/dist/client/client.d.ts.map +0 -1
- package/dist/client/client.js.map +0 -1
- package/dist/client/credential.d.ts.map +0 -1
- package/dist/client/credential.js.map +0 -1
- package/dist/client/index.d.ts.map +0 -1
- package/dist/client/index.js.map +0 -1
- package/dist/client/request.d.ts.map +0 -1
- package/dist/client/request.js.map +0 -1
- package/dist/client/result.d.ts.map +0 -1
- package/dist/client/result.js.map +0 -1
- package/dist/client/routing-control.d.ts.map +0 -1
- package/dist/client/routing-control.js.map +0 -1
- package/dist/errors/client-error.d.ts.map +0 -1
- package/dist/errors/client-error.js.map +0 -1
- package/dist/errors/index.d.ts.map +0 -1
- package/dist/errors/index.js.map +0 -1
- package/dist/errors/miss-error.d.ts.map +0 -1
- package/dist/errors/miss-error.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/response-error.d.ts.map +0 -1
- package/dist/errors/response-error.js.map +0 -1
- package/dist/errors/session-error.d.ts.map +0 -1
- package/dist/errors/session-error.js.map +0 -1
- package/dist/errors/stale-route-error.d.ts.map +0 -1
- package/dist/errors/stale-route-error.js.map +0 -1
- package/dist/errors/transport-error.d.ts.map +0 -1
- package/dist/errors/transport-error.js.map +0 -1
- package/dist/graph/domain/binding.d.ts.map +0 -1
- package/dist/graph/domain/binding.js.map +0 -1
- package/dist/graph/domain/domain.typecheck.d.ts.map +0 -1
- package/dist/graph/domain/domain.typecheck.js.map +0 -1
- package/dist/graph/domain/index.d.ts.map +0 -1
- package/dist/graph/domain/index.js.map +0 -1
- package/dist/graph/domain/model.d.ts.map +0 -1
- package/dist/graph/domain/model.js.map +0 -1
- package/dist/graph/domain/page.d.ts.map +0 -1
- package/dist/graph/domain/page.js.map +0 -1
- package/dist/graph/domain/project.d.ts.map +0 -1
- package/dist/graph/domain/project.js.map +0 -1
- package/dist/graph/domain/provenance.d.ts.map +0 -1
- package/dist/graph/domain/provenance.js.map +0 -1
- package/dist/graph/errors.d.ts.map +0 -1
- package/dist/graph/errors.js.map +0 -1
- package/dist/graph/graph.d.ts.map +0 -1
- package/dist/graph/graph.js.map +0 -1
- package/dist/graph/index.d.ts.map +0 -1
- package/dist/graph/index.js.map +0 -1
- package/dist/graph/mutation.d.ts.map +0 -1
- package/dist/graph/mutation.js.map +0 -1
- package/dist/graph/page/index.d.ts.map +0 -1
- package/dist/graph/page/index.js.map +0 -1
- package/dist/graph/page/neighbors.d.ts.map +0 -1
- package/dist/graph/page/neighbors.js.map +0 -1
- package/dist/graph/page/page.d.ts.map +0 -1
- package/dist/graph/page/page.js.map +0 -1
- package/dist/graph/page-contract.d.ts.map +0 -1
- package/dist/graph/page-contract.js.map +0 -1
- package/dist/graph/provenance.d.ts.map +0 -1
- package/dist/graph/provenance.js.map +0 -1
- package/dist/graph/query.d.ts.map +0 -1
- package/dist/graph/query.js.map +0 -1
- package/dist/graph/read.d.ts.map +0 -1
- package/dist/graph/read.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/pacer/batcher/batcher.d.ts.map +0 -1
- package/dist/pacer/batcher/batcher.js.map +0 -1
- package/dist/pacer/batcher/defaults.d.ts.map +0 -1
- package/dist/pacer/batcher/defaults.js.map +0 -1
- package/dist/pacer/batcher/index.d.ts.map +0 -1
- package/dist/pacer/batcher/index.js.map +0 -1
- package/dist/pacer/index.d.ts.map +0 -1
- package/dist/pacer/index.js.map +0 -1
- package/dist/pacer/limiter/defaults.d.ts.map +0 -1
- package/dist/pacer/limiter/defaults.js.map +0 -1
- package/dist/pacer/limiter/index.d.ts.map +0 -1
- package/dist/pacer/limiter/index.js.map +0 -1
- package/dist/pacer/limiter/limiter.d.ts.map +0 -1
- package/dist/pacer/limiter/limiter.js.map +0 -1
- package/dist/pacer/queue/defaults.d.ts.map +0 -1
- package/dist/pacer/queue/defaults.js.map +0 -1
- package/dist/pacer/queue/index.d.ts.map +0 -1
- package/dist/pacer/queue/index.js.map +0 -1
- package/dist/pacer/queue/queue.d.ts.map +0 -1
- package/dist/pacer/queue/queue.js.map +0 -1
- package/dist/pacer/retry/defaults.d.ts.map +0 -1
- package/dist/pacer/retry/defaults.js.map +0 -1
- package/dist/pacer/retry/index.d.ts.map +0 -1
- package/dist/pacer/retry/index.js.map +0 -1
- package/dist/pacer/retry/retry.d.ts.map +0 -1
- package/dist/pacer/retry/retry.js.map +0 -1
- package/dist/pool/index.d.ts.map +0 -1
- package/dist/pool/index.js.map +0 -1
- package/dist/pool/pool.d.ts.map +0 -1
- package/dist/pool/pool.js.map +0 -1
- package/dist/pool/target.d.ts.map +0 -1
- package/dist/pool/target.js.map +0 -1
- package/dist/schema/admission.d.ts.map +0 -1
- package/dist/schema/admission.js.map +0 -1
- package/dist/schema/contracts.d.ts.map +0 -1
- package/dist/schema/contracts.js.map +0 -1
- package/dist/schema/index.d.ts.map +0 -1
- package/dist/schema/index.js.map +0 -1
- package/dist/schema/introspection.d.ts.map +0 -1
- package/dist/schema/introspection.js.map +0 -1
- package/dist/schema/operation.d.ts.map +0 -1
- package/dist/schema/operation.js.map +0 -1
- package/dist/schema/schema.d.ts.map +0 -1
- package/dist/schema/schema.js.map +0 -1
- package/dist/session/bound.d.ts.map +0 -1
- package/dist/session/bound.js.map +0 -1
- package/dist/session/context/control.d.ts.map +0 -1
- package/dist/session/context/control.js.map +0 -1
- package/dist/session/context/index.d.ts.map +0 -1
- package/dist/session/context/index.js.map +0 -1
- package/dist/session/context/limits.d.ts.map +0 -1
- package/dist/session/context/limits.js.map +0 -1
- package/dist/session/context/operation.d.ts.map +0 -1
- package/dist/session/context/operation.js.map +0 -1
- package/dist/session/context/policy.d.ts.map +0 -1
- package/dist/session/context/policy.js.map +0 -1
- package/dist/session/discovery/bundle.d.ts.map +0 -1
- package/dist/session/discovery/bundle.js.map +0 -1
- package/dist/session/discovery/discovery.d.ts.map +0 -1
- package/dist/session/discovery/discovery.js.map +0 -1
- package/dist/session/discovery/index.d.ts.map +0 -1
- package/dist/session/discovery/index.js.map +0 -1
- package/dist/session/discovery/publication.d.ts +0 -24
- package/dist/session/discovery/publication.d.ts.map +0 -1
- package/dist/session/discovery/publication.js +0 -124
- package/dist/session/discovery/publication.js.map +0 -1
- package/dist/session/discovery/snapshot.d.ts.map +0 -1
- package/dist/session/discovery/snapshot.js.map +0 -1
- package/dist/session/discovery/transport.d.ts.map +0 -1
- package/dist/session/discovery/transport.js.map +0 -1
- package/dist/session/index.d.ts.map +0 -1
- package/dist/session/index.js.map +0 -1
- package/dist/session/reference.d.ts.map +0 -1
- package/dist/session/reference.js.map +0 -1
- package/dist/session/routing/auth.d.ts.map +0 -1
- package/dist/session/routing/auth.js.map +0 -1
- package/dist/session/routing/cache.d.ts.map +0 -1
- package/dist/session/routing/cache.js.map +0 -1
- package/dist/session/routing/dispatch.d.ts.map +0 -1
- package/dist/session/routing/dispatch.js.map +0 -1
- package/dist/session/routing/envelope.d.ts.map +0 -1
- package/dist/session/routing/envelope.js.map +0 -1
- package/dist/session/routing/expectation.d.ts +0 -7
- package/dist/session/routing/expectation.d.ts.map +0 -1
- package/dist/session/routing/expectation.js +0 -2
- package/dist/session/routing/expectation.js.map +0 -1
- package/dist/session/routing/index.d.ts.map +0 -1
- package/dist/session/routing/index.js.map +0 -1
- package/dist/session/routing/request.d.ts.map +0 -1
- package/dist/session/routing/request.js.map +0 -1
- package/dist/session/session.d.ts.map +0 -1
- package/dist/session/session.js.map +0 -1
- package/dist/session/session.typecheck.d.ts.map +0 -1
- package/dist/session/session.typecheck.js.map +0 -1
- package/dist/session/views/catalog.d.ts.map +0 -1
- package/dist/session/views/catalog.js.map +0 -1
- package/dist/session/views/index.d.ts.map +0 -1
- package/dist/session/views/index.js.map +0 -1
- package/dist/session/views/resolve.d.ts.map +0 -1
- package/dist/session/views/resolve.js.map +0 -1
- package/dist/store/entity-index.d.ts.map +0 -1
- package/dist/store/entity-index.js.map +0 -1
- package/dist/store/index.d.ts.map +0 -1
- package/dist/store/index.js.map +0 -1
- package/dist/store/memory.d.ts.map +0 -1
- package/dist/store/memory.js.map +0 -1
- package/dist/store/mutation.d.ts.map +0 -1
- package/dist/store/mutation.js.map +0 -1
- package/dist/store/observe.d.ts.map +0 -1
- package/dist/store/observe.js.map +0 -1
- package/dist/store/optimistic.d.ts.map +0 -1
- package/dist/store/optimistic.js.map +0 -1
- package/dist/store/query-key.d.ts.map +0 -1
- package/dist/store/query-key.js.map +0 -1
- package/dist/store/shape.d.ts.map +0 -1
- package/dist/store/shape.js.map +0 -1
- package/dist/store/store.d.ts.map +0 -1
- package/dist/store/store.js.map +0 -1
- package/dist/store/store.typecheck.d.ts.map +0 -1
- package/dist/store/store.typecheck.js.map +0 -1
- package/dist/transport/auto/decision.d.ts.map +0 -1
- package/dist/transport/auto/decision.js.map +0 -1
- package/dist/transport/auto/fallback.d.ts.map +0 -1
- package/dist/transport/auto/fallback.js.map +0 -1
- package/dist/transport/auto/index.d.ts.map +0 -1
- package/dist/transport/auto/index.js.map +0 -1
- package/dist/transport/auto/transport.d.ts.map +0 -1
- package/dist/transport/auto/transport.js.map +0 -1
- package/dist/transport/auto/warning.d.ts.map +0 -1
- package/dist/transport/auto/warning.js.map +0 -1
- package/dist/transport/deadline.d.ts.map +0 -1
- package/dist/transport/deadline.js.map +0 -1
- package/dist/transport/failure.d.ts.map +0 -1
- package/dist/transport/failure.js.map +0 -1
- package/dist/transport/http/index.d.ts.map +0 -1
- package/dist/transport/http/index.js.map +0 -1
- package/dist/transport/http/response.d.ts.map +0 -1
- package/dist/transport/http/response.js.map +0 -1
- package/dist/transport/http/stream.d.ts.map +0 -1
- package/dist/transport/http/stream.js.map +0 -1
- package/dist/transport/http/transport.d.ts.map +0 -1
- package/dist/transport/http/transport.js.map +0 -1
- package/dist/transport/index.d.ts.map +0 -1
- package/dist/transport/index.js.map +0 -1
- package/dist/transport/transport.d.ts.map +0 -1
- package/dist/transport/transport.js.map +0 -1
- package/dist/transport/websocket/connection.d.ts.map +0 -1
- package/dist/transport/websocket/connection.js.map +0 -1
- package/dist/transport/websocket/exchange.d.ts.map +0 -1
- package/dist/transport/websocket/exchange.js.map +0 -1
- package/dist/transport/websocket/index.d.ts.map +0 -1
- package/dist/transport/websocket/index.js.map +0 -1
- package/dist/transport/websocket/transport.d.ts.map +0 -1
- package/dist/transport/websocket/transport.js.map +0 -1
|
@@ -3,15 +3,11 @@ import * as protocol from '@astrale-os/kernel-protocol/invocation';
|
|
|
3
3
|
import { ProtocolError, ResponseError, TransportError } from '../../errors/index.js';
|
|
4
4
|
import { invocationFailure } from '../failure.js';
|
|
5
5
|
import { asError, controlledSignal, positiveInteger, requireLive, } from '../index.js';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
const DEFAULT_TIMEOUT_MS = 30_000;
|
|
9
|
-
const DEFAULT_MAXIMUM_REQUEST_BYTES = 16 * 1024 * 1024;
|
|
10
|
-
const DEFAULT_MAXIMUM_RESPONSE_BYTES = 16 * 1024 * 1024;
|
|
6
|
+
import { admitResponse } from './admission.js';
|
|
7
|
+
import { capture } from './configuration.js';
|
|
11
8
|
/** HTTP implementation of the universal invocation protocol. */
|
|
12
9
|
export class HttpTransport {
|
|
13
10
|
url;
|
|
14
|
-
codecName;
|
|
15
11
|
fetchImpl;
|
|
16
12
|
headers;
|
|
17
13
|
timeoutMs;
|
|
@@ -19,21 +15,30 @@ export class HttpTransport {
|
|
|
19
15
|
maximumResponseBytes;
|
|
20
16
|
nextId = 1;
|
|
21
17
|
constructor(options) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
this.
|
|
26
|
-
this.
|
|
27
|
-
this.
|
|
28
|
-
this.
|
|
29
|
-
this.timeoutMs = positiveInteger(options.timeoutMs ?? DEFAULT_TIMEOUT_MS, 'timeoutMs');
|
|
30
|
-
this.maximumRequestBytes = positiveInteger(options.maximumRequestBytes ?? DEFAULT_MAXIMUM_REQUEST_BYTES, 'maximumRequestBytes');
|
|
31
|
-
this.maximumResponseBytes = positiveInteger(options.maximumResponseBytes ?? DEFAULT_MAXIMUM_RESPONSE_BYTES, 'maximumResponseBytes');
|
|
18
|
+
const configuration = capture(options);
|
|
19
|
+
this.url = configuration.url;
|
|
20
|
+
this.fetchImpl = configuration.fetch;
|
|
21
|
+
this.headers = configuration.headers;
|
|
22
|
+
this.timeoutMs = configuration.timeoutMs;
|
|
23
|
+
this.maximumRequestBytes = configuration.maximumRequestBytes;
|
|
24
|
+
this.maximumResponseBytes = configuration.maximumResponseBytes;
|
|
32
25
|
}
|
|
33
26
|
async dispatch(input, options = {}) {
|
|
27
|
+
return this.dispatchWith(input, options);
|
|
28
|
+
}
|
|
29
|
+
/** HTTP-only binary invocation; each call may replay a re-readable Blob. */
|
|
30
|
+
async dispatchBinary(input, body, options = {}) {
|
|
31
|
+
if (!(body instanceof Blob))
|
|
32
|
+
throw new TypeError('Binary request body must be a Blob.');
|
|
33
|
+
if (options.idempotencyKey !== undefined) {
|
|
34
|
+
throw new TypeError('Binary requests cannot carry an idempotency key.');
|
|
35
|
+
}
|
|
36
|
+
return this.dispatchWith(input, options, body);
|
|
37
|
+
}
|
|
38
|
+
async dispatchWith(input, options, binaryBody) {
|
|
34
39
|
const requestId = this.nextRequestId();
|
|
35
40
|
const timeoutMs = positiveInteger(options.timeoutMs ?? this.timeoutMs, 'timeoutMs');
|
|
36
|
-
const codec =
|
|
41
|
+
const codec = codecs.json;
|
|
37
42
|
const { trace: traceInput, ...invocationInput } = input;
|
|
38
43
|
const trace = traceInput === undefined ? undefined : protocol.admitTrace(traceInput);
|
|
39
44
|
const request = protocol.decodeRequest({
|
|
@@ -42,87 +47,31 @@ export class HttpTransport {
|
|
|
42
47
|
...invocationInput,
|
|
43
48
|
...(options.idempotencyKey === undefined ? {} : { idempotencyKey: options.idempotencyKey }),
|
|
44
49
|
});
|
|
45
|
-
const encoded =
|
|
50
|
+
const encoded = binaryBody === undefined
|
|
51
|
+
? codec.encode(request)
|
|
52
|
+
: protocol.http.encodeBinaryRequestEnvelope(request);
|
|
46
53
|
const control = controlledSignal(options.signal, timeoutMs);
|
|
47
54
|
let handedOff = false;
|
|
48
55
|
let phase = 'connect';
|
|
49
56
|
let delivery = 'not-sent';
|
|
50
57
|
try {
|
|
51
58
|
requireLive(control);
|
|
52
|
-
if (encodedByteLength(encoded) > this.maximumRequestBytes) {
|
|
59
|
+
if (binaryBody === undefined && encodedByteLength(encoded) > this.maximumRequestBytes) {
|
|
53
60
|
throw invocationFailure(`request exceeds maximumRequestBytes (${this.maximumRequestBytes}).`, 'send');
|
|
54
61
|
}
|
|
55
62
|
phase = 'send';
|
|
56
63
|
delivery = 'unknown';
|
|
57
|
-
const response = await this.fetchResponse(codec, encoded, trace, control);
|
|
64
|
+
const response = await this.fetchResponse(codec, encoded, trace, control, binaryBody);
|
|
58
65
|
phase = 'receive';
|
|
59
66
|
requireLive(control);
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
const hasBinarySignal = binaryId !== null || binaryManifest !== null;
|
|
69
|
-
if (hasStreamSignal && hasBinarySignal) {
|
|
70
|
-
throw new ProtocolError('server returned conflicting stream and binary response signals.');
|
|
71
|
-
}
|
|
72
|
-
if (hasBinarySignal) {
|
|
73
|
-
if (binaryId === null || binaryManifest === null) {
|
|
74
|
-
throw new ProtocolError('server returned an incomplete binary response signal.');
|
|
75
|
-
}
|
|
76
|
-
return await this.decodeBinary(response, requestId, binaryId, control);
|
|
77
|
-
}
|
|
78
|
-
const responseCodec = await codecForResponse(response.headers.get('content-type'));
|
|
79
|
-
if (responseCodec === undefined) {
|
|
80
|
-
throw new ProtocolError(`server returned unsupported Content-Type ${JSON.stringify(response.headers.get('content-type'))}.`);
|
|
81
|
-
}
|
|
82
|
-
if (hasStreamSignal) {
|
|
83
|
-
if (streamFraming !== protocol.http.LENGTH_PREFIX_V1) {
|
|
84
|
-
throw new ProtocolError(`server returned unsupported stream framing ${JSON.stringify(streamFraming)}.`);
|
|
85
|
-
}
|
|
86
|
-
if (!response.ok) {
|
|
87
|
-
throw new ProtocolError('server returned a non-success stream response.');
|
|
88
|
-
}
|
|
89
|
-
const stream = await HttpStream.open(response, responseCodec, requestId, this.maximumResponseBytes, control);
|
|
90
|
-
requireLive(control);
|
|
91
|
-
handedOff = true;
|
|
92
|
-
return { kind: 'stream', stream, invocation: stream.invocation };
|
|
93
|
-
}
|
|
94
|
-
const body = await readBoundedBody(response, this.maximumResponseBytes, control.signal);
|
|
95
|
-
requireLive(control);
|
|
96
|
-
const decoded = decodeProtocol('response body', () => responseCodec.decode(body));
|
|
97
|
-
const envelope = decodeProtocol('response envelope', () => protocol.decodeResponse(decoded));
|
|
98
|
-
if (envelope.requestId === null && 'error' in envelope) {
|
|
99
|
-
throw new ResponseError(envelope.error.code, envelope.error.message, envelope.invocation, envelope.error.data);
|
|
100
|
-
}
|
|
101
|
-
requireId(requestId, envelope.requestId);
|
|
102
|
-
if ('kind' in envelope && envelope.kind === 'stale') {
|
|
103
|
-
const stale = decodeProtocol('stale response', () => protocol.decodeStale(envelope));
|
|
104
|
-
requireLive(control);
|
|
105
|
-
return Object.freeze({
|
|
106
|
-
kind: 'stale',
|
|
107
|
-
current: stale.current,
|
|
108
|
-
invocation: stale.invocation,
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
if ('kind' in envelope && envelope.kind === 'miss') {
|
|
112
|
-
decodeProtocol('miss response', () => protocol.decodeMiss(envelope));
|
|
113
|
-
requireLive(control);
|
|
114
|
-
return Object.freeze({ kind: 'miss', invocation: envelope.invocation });
|
|
115
|
-
}
|
|
116
|
-
if ('kind' in envelope && envelope.kind === 'redirect') {
|
|
117
|
-
const response = decodeProtocol('redirect response', () => protocol.decodeRedirectResponse(envelope));
|
|
118
|
-
requireLive(control);
|
|
119
|
-
return redirectResult(response);
|
|
120
|
-
}
|
|
121
|
-
if ('error' in envelope) {
|
|
122
|
-
throw new ResponseError(envelope.error.code, envelope.error.message, envelope.invocation, envelope.error.data);
|
|
123
|
-
}
|
|
124
|
-
requireLive(control);
|
|
125
|
-
return { kind: 'value', value: envelope.result, invocation: envelope.invocation };
|
|
67
|
+
const result = await admitResponse(response, requestId, {
|
|
68
|
+
maximumBytes: this.maximumResponseBytes,
|
|
69
|
+
control,
|
|
70
|
+
});
|
|
71
|
+
handedOff =
|
|
72
|
+
result.kind === 'stream' ||
|
|
73
|
+
(result.kind === 'binary' && !(result.value.body instanceof Uint8Array));
|
|
74
|
+
return result;
|
|
126
75
|
}
|
|
127
76
|
catch (error) {
|
|
128
77
|
throw transportFailure(error, control, options.signal, timeoutMs, this.url, phase, delivery);
|
|
@@ -132,117 +81,35 @@ export class HttpTransport {
|
|
|
132
81
|
control.close();
|
|
133
82
|
}
|
|
134
83
|
}
|
|
135
|
-
async fetchResponse(codec, encoded, trace, control) {
|
|
136
|
-
|
|
84
|
+
async fetchResponse(codec, encoded, trace, control, binaryBody) {
|
|
85
|
+
const init = {
|
|
137
86
|
method: 'POST',
|
|
138
|
-
redirect: '
|
|
87
|
+
redirect: 'manual',
|
|
139
88
|
credentials: 'omit',
|
|
140
|
-
cache: 'no-store',
|
|
141
89
|
referrerPolicy: 'no-referrer',
|
|
90
|
+
// Fetch owns Content-Length; the protocol carries Blob.size across Fetch runtimes.
|
|
142
91
|
headers: {
|
|
143
92
|
...this.headers,
|
|
144
93
|
...protocol.http.encodeTraceHeaders(trace),
|
|
145
|
-
'content-type': codec.contentType,
|
|
94
|
+
'content-type': binaryBody === undefined ? codec.contentType : protocol.http.BINARY_REQUEST_CONTENT_TYPE,
|
|
146
95
|
accept: codec.contentType,
|
|
96
|
+
...(binaryBody === undefined
|
|
97
|
+
? {}
|
|
98
|
+
: {
|
|
99
|
+
[protocol.http.REQUEST_ENVELOPE_FIELD]: encoded,
|
|
100
|
+
[protocol.http.BINARY_LENGTH_FIELD]: String(binaryBody.size),
|
|
101
|
+
}),
|
|
147
102
|
},
|
|
148
|
-
body: toBody(encoded),
|
|
103
|
+
body: binaryBody ?? toBody(encoded),
|
|
149
104
|
signal: control.signal,
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
async decodeBinary(response, requestId, binaryId, control) {
|
|
153
|
-
if (!response.ok) {
|
|
154
|
-
throw new ProtocolError('server returned binary data with an error status.');
|
|
155
|
-
}
|
|
156
|
-
if (binaryId !== String(requestId)) {
|
|
157
|
-
throw new ProtocolError(`binary response requestId ${JSON.stringify(binaryId)} does not match request requestId ${requestId}.`);
|
|
158
|
-
}
|
|
159
|
-
const mediaType = normalizeMediaType(response.headers.get('content-type'));
|
|
160
|
-
if (mediaType === undefined) {
|
|
161
|
-
throw new ProtocolError('binary response has no media type.');
|
|
162
|
-
}
|
|
163
|
-
const body = await readBoundedBody(response, this.maximumResponseBytes, control.signal);
|
|
164
|
-
requireLive(control);
|
|
165
|
-
const headerNames = decodeProtocol('binary application-header manifest', () => protocol.http.decodeBinaryHeaderNames(response.headers.get(protocol.http.BINARY_HEADERS_FIELD)));
|
|
166
|
-
const headers = binaryHeaders(response.headers, headerNames);
|
|
167
|
-
const invocation = decodeProtocol('binary InvocationId field', () => protocol.http.decodeInvocationId(response.headers.get(protocol.http.INVOCATION_FIELD)));
|
|
168
|
-
const binary = decodeProtocol('binary response', () => protocol.decodeBinaryResponse({
|
|
169
|
-
kind: 'binary',
|
|
170
|
-
requestId,
|
|
171
|
-
invocation,
|
|
172
|
-
body,
|
|
173
|
-
mediaType,
|
|
174
|
-
...(Object.keys(headers).length === 0 ? {} : { headers }),
|
|
175
|
-
}));
|
|
176
|
-
requireLive(control);
|
|
177
|
-
return {
|
|
178
|
-
kind: 'binary',
|
|
179
|
-
invocation: binary.invocation,
|
|
180
|
-
value: {
|
|
181
|
-
body: binary.body,
|
|
182
|
-
mediaType: binary.mediaType,
|
|
183
|
-
...(binary.headers === undefined ? {} : { headers: binary.headers }),
|
|
184
|
-
},
|
|
185
105
|
};
|
|
106
|
+
return this.fetchImpl(this.url, init);
|
|
186
107
|
}
|
|
187
108
|
nextRequestId() {
|
|
188
109
|
const requestId = this.nextId;
|
|
189
110
|
this.nextId = requestId === Number.MAX_SAFE_INTEGER ? 1 : requestId + 1;
|
|
190
111
|
return requestId;
|
|
191
112
|
}
|
|
192
|
-
requestCodec() {
|
|
193
|
-
return this.codecName === 'msgpack' ? codecs.loadMsgpack() : Promise.resolve(codecs.json);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
function redirectResult(response) {
|
|
197
|
-
return Object.freeze({
|
|
198
|
-
kind: 'redirect',
|
|
199
|
-
invocation: response.invocation,
|
|
200
|
-
redirect: response.redirect,
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
function normalizeUrl(input) {
|
|
204
|
-
if (typeof input !== 'string')
|
|
205
|
-
throw new TypeError('server URL must be a string.');
|
|
206
|
-
let parsed;
|
|
207
|
-
try {
|
|
208
|
-
parsed = new URL(input);
|
|
209
|
-
}
|
|
210
|
-
catch (error) {
|
|
211
|
-
throw new TypeError(`Invalid server URL ${JSON.stringify(input)}.`, { cause: asError(error) });
|
|
212
|
-
}
|
|
213
|
-
if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') {
|
|
214
|
-
throw new TypeError('server URL must use http or https.');
|
|
215
|
-
}
|
|
216
|
-
if (parsed.username !== '' || parsed.password !== '' || parsed.hash !== '') {
|
|
217
|
-
throw new TypeError('server URL cannot contain credentials or a fragment.');
|
|
218
|
-
}
|
|
219
|
-
return parsed.toString();
|
|
220
|
-
}
|
|
221
|
-
function admitHeaders(input) {
|
|
222
|
-
if (input === null || typeof input !== 'object' || Array.isArray(input)) {
|
|
223
|
-
throw new TypeError('HTTP headers must be an object.');
|
|
224
|
-
}
|
|
225
|
-
const output = {};
|
|
226
|
-
for (const [name, value] of Object.entries(input)) {
|
|
227
|
-
if (!HEADER_NAME.test(name)) {
|
|
228
|
-
throw new TypeError(`HTTP header name ${JSON.stringify(name)} is invalid.`);
|
|
229
|
-
}
|
|
230
|
-
const normalized = name.toLowerCase();
|
|
231
|
-
if (Object.hasOwn(output, normalized)) {
|
|
232
|
-
throw new TypeError(`HTTP header ${JSON.stringify(name)} occurs more than once.`);
|
|
233
|
-
}
|
|
234
|
-
if (isReservedRequestHeader(normalized)) {
|
|
235
|
-
throw new TypeError(`HTTP header ${JSON.stringify(name)} is owned by transport.`);
|
|
236
|
-
}
|
|
237
|
-
if (typeof value !== 'string') {
|
|
238
|
-
throw new TypeError(`HTTP header ${JSON.stringify(name)} must be a string.`);
|
|
239
|
-
}
|
|
240
|
-
if (hasControlCharacter(value)) {
|
|
241
|
-
throw new TypeError(`HTTP header ${JSON.stringify(name)} contains a control character.`);
|
|
242
|
-
}
|
|
243
|
-
output[normalized] = value;
|
|
244
|
-
}
|
|
245
|
-
return Object.freeze(output);
|
|
246
113
|
}
|
|
247
114
|
function toBody(input) {
|
|
248
115
|
if (typeof input === 'string')
|
|
@@ -253,15 +120,6 @@ function toBody(input) {
|
|
|
253
120
|
function encodedByteLength(input) {
|
|
254
121
|
return typeof input === 'string' ? new TextEncoder().encode(input).byteLength : input.byteLength;
|
|
255
122
|
}
|
|
256
|
-
function requireNoStore(response) {
|
|
257
|
-
const directives = response.headers
|
|
258
|
-
.get('cache-control')
|
|
259
|
-
?.split(',')
|
|
260
|
-
.map((directive) => directive.trim().toLowerCase()) ?? [];
|
|
261
|
-
if (!directives.includes('no-store')) {
|
|
262
|
-
throw new ProtocolError('server response is missing Cache-Control: no-store.');
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
123
|
function transportFailure(input, control, parent, timeoutMs, url, phase, delivery) {
|
|
266
124
|
if (input instanceof ResponseError || input instanceof ProtocolError)
|
|
267
125
|
return input;
|
|
@@ -280,65 +138,3 @@ function transportFailure(input, control, parent, timeoutMs, url, phase, deliver
|
|
|
280
138
|
delivery,
|
|
281
139
|
});
|
|
282
140
|
}
|
|
283
|
-
function admitCodecName(input) {
|
|
284
|
-
if (input === undefined || input === 'json')
|
|
285
|
-
return 'json';
|
|
286
|
-
if (input === 'msgpack')
|
|
287
|
-
return input;
|
|
288
|
-
throw new TypeError('codec must be "json" or "msgpack".');
|
|
289
|
-
}
|
|
290
|
-
function admitFetch(input) {
|
|
291
|
-
const implementation = input ?? globalThis.fetch;
|
|
292
|
-
if (typeof implementation !== 'function') {
|
|
293
|
-
throw new TypeError('HttpTransport requires a Fetch implementation.');
|
|
294
|
-
}
|
|
295
|
-
return input === undefined ? implementation.bind(globalThis) : implementation;
|
|
296
|
-
}
|
|
297
|
-
const HEADER_NAME = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
|
|
298
|
-
const RESERVED_REQUEST_HEADERS = new Set([
|
|
299
|
-
'accept',
|
|
300
|
-
'accept-encoding',
|
|
301
|
-
'authorization',
|
|
302
|
-
'cache-control',
|
|
303
|
-
'connection',
|
|
304
|
-
'content-length',
|
|
305
|
-
'content-type',
|
|
306
|
-
'cookie',
|
|
307
|
-
'expect',
|
|
308
|
-
'forwarded',
|
|
309
|
-
'host',
|
|
310
|
-
'keep-alive',
|
|
311
|
-
'origin',
|
|
312
|
-
'pragma',
|
|
313
|
-
'proxy-authenticate',
|
|
314
|
-
'proxy-authorization',
|
|
315
|
-
'referer',
|
|
316
|
-
'referrer-policy',
|
|
317
|
-
'set-cookie',
|
|
318
|
-
'te',
|
|
319
|
-
protocol.http.TRACEPARENT_FIELD,
|
|
320
|
-
protocol.http.TRACESTATE_FIELD,
|
|
321
|
-
protocol.http.BAGGAGE_FIELD,
|
|
322
|
-
'trailer',
|
|
323
|
-
'transfer-encoding',
|
|
324
|
-
'upgrade',
|
|
325
|
-
'via',
|
|
326
|
-
]);
|
|
327
|
-
function isReservedRequestHeader(name) {
|
|
328
|
-
return (RESERVED_REQUEST_HEADERS.has(name) ||
|
|
329
|
-
name.startsWith('access-control-') ||
|
|
330
|
-
name.startsWith('content-') ||
|
|
331
|
-
name.startsWith('proxy-') ||
|
|
332
|
-
name.startsWith('sec-websocket-') ||
|
|
333
|
-
name.startsWith('x-astrale-') ||
|
|
334
|
-
name.startsWith('x-forwarded-'));
|
|
335
|
-
}
|
|
336
|
-
function hasControlCharacter(input) {
|
|
337
|
-
for (let index = 0; index < input.length; index += 1) {
|
|
338
|
-
const code = input.charCodeAt(index);
|
|
339
|
-
if (code <= 0x1f || code === 0x7f)
|
|
340
|
-
return true;
|
|
341
|
-
}
|
|
342
|
-
return false;
|
|
343
|
-
}
|
|
344
|
-
//# sourceMappingURL=transport.js.map
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
export type { RequestOptions, MissControl, StaleControl, Transport, TransportRequest, TransportResult, } from './transport.js';
|
|
1
|
+
export type { RequestOptions, DeploymentRetired, MissControl, StaleControl, Transport, TransportRequest, TransportResult, } from './transport.js';
|
|
2
2
|
export { asError, controlledSignal, positiveInteger, requireLive, type ControlledSignal, } from './deadline.js';
|
|
3
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/transport/index.js
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
import type { invocation as protocol } from '@astrale-os/kernel-protocol';
|
|
1
|
+
import type { invocation as protocol, routes } from '@astrale-os/kernel-protocol';
|
|
2
2
|
import type { Result } from '../client/result.js';
|
|
3
3
|
export interface RequestOptions {
|
|
4
4
|
readonly signal?: AbortSignal;
|
|
5
5
|
readonly timeoutMs?: number;
|
|
6
6
|
readonly idempotencyKey?: protocol.IdempotencyKey;
|
|
7
|
+
/**
|
|
8
|
+
* The maintenance session a root request expects to act within, by its install execution id. It
|
|
9
|
+
* grants nothing: the Kernel refuses the request `MAINTENANCE_SESSION_STALE` unless that session
|
|
10
|
+
* is the Instance's live one. The Client carries it in the source request, never to a destination.
|
|
11
|
+
*/
|
|
12
|
+
readonly maintenance?: {
|
|
13
|
+
readonly session: string;
|
|
14
|
+
};
|
|
7
15
|
}
|
|
8
16
|
export interface TransportRequest {
|
|
9
17
|
readonly call: protocol.Call;
|
|
@@ -14,6 +22,8 @@ export interface TransportRequest {
|
|
|
14
22
|
readonly routing?: protocol.Routing;
|
|
15
23
|
/** Source-Kernel Schema Registration precondition; omitted after routing. */
|
|
16
24
|
readonly schema?: protocol.SchemaTarget;
|
|
25
|
+
/** Source-Kernel maintenance session guard; omitted after routing. */
|
|
26
|
+
readonly maintenance?: protocol.Maintenance;
|
|
17
27
|
}
|
|
18
28
|
/** Correlated reserved control decoded independently from application results and errors. */
|
|
19
29
|
export interface StaleControl {
|
|
@@ -25,11 +35,18 @@ export interface MissControl {
|
|
|
25
35
|
readonly kind: 'miss';
|
|
26
36
|
readonly invocation: protocol.InvocationId;
|
|
27
37
|
}
|
|
28
|
-
|
|
38
|
+
/**
|
|
39
|
+
* A retired deployment's reserved 410 control: its typed `DEPLOYMENT_RETIRED` reason with the
|
|
40
|
+
* message and invocation of the envelope it carried, which Client raises unchanged.
|
|
41
|
+
*/
|
|
42
|
+
export interface DeploymentRetired extends routes.DeploymentRetired {
|
|
43
|
+
readonly message: string;
|
|
44
|
+
readonly invocation: protocol.InvocationId;
|
|
45
|
+
}
|
|
46
|
+
export type TransportResult = Result | StaleControl | MissControl | DeploymentRetired;
|
|
29
47
|
export interface Transport {
|
|
30
48
|
/** Primary embedding-environment adapter for a complete invocation boundary. */
|
|
31
49
|
dispatch(input: TransportRequest, options?: RequestOptions): Promise<TransportResult>;
|
|
32
50
|
/** Optional owned-resource shutdown used by Client.close(). */
|
|
33
51
|
readonly close?: () => void;
|
|
34
52
|
}
|
|
35
|
-
//# sourceMappingURL=transport.d.ts.map
|
|
@@ -5,7 +5,7 @@ import type { TransportResult } from '../index.js';
|
|
|
5
5
|
import type { ExchangeOwner } from './exchange.js';
|
|
6
6
|
import type { WebSocketConstructor } from './transport.js';
|
|
7
7
|
import { WebSocketExchange } from './exchange.js';
|
|
8
|
-
|
|
8
|
+
interface ConnectionOwner {
|
|
9
9
|
closed(connection: WebSocketConnection): void;
|
|
10
10
|
}
|
|
11
11
|
export declare class WebSocketConnection implements ExchangeOwner {
|
|
@@ -36,4 +36,4 @@ export declare class WebSocketConnection implements ExchangeOwner {
|
|
|
36
36
|
private onMessage;
|
|
37
37
|
private onFailure;
|
|
38
38
|
}
|
|
39
|
-
|
|
39
|
+
export {};
|
|
@@ -81,7 +81,7 @@ export class WebSocketConnection {
|
|
|
81
81
|
control.close();
|
|
82
82
|
return Promise.reject(invocationFailure(`WebSocket request exceeds maximumRequestBytes (${this.maximumRequestBytes}).`, 'send'));
|
|
83
83
|
}
|
|
84
|
-
if (this.socket
|
|
84
|
+
if (socketBufferedAmount(this.socket) + encodedBytes > this.maximumBufferedBytes) {
|
|
85
85
|
control.close();
|
|
86
86
|
return Promise.reject(invocationFailure(`WebSocket connection exceeds maximumBufferedBytes (${this.maximumBufferedBytes}).`, 'send'));
|
|
87
87
|
}
|
|
@@ -105,7 +105,7 @@ export class WebSocketConnection {
|
|
|
105
105
|
const encoded = this.codec.encode(protocol.decodeCancelRequest({ version: protocol.VERSION, kind: 'cancel', requestId }));
|
|
106
106
|
const bytes = frameSize(encoded);
|
|
107
107
|
if (bytes > this.maximumRequestBytes ||
|
|
108
|
-
this.socket
|
|
108
|
+
socketBufferedAmount(this.socket) + bytes > this.maximumBufferedBytes) {
|
|
109
109
|
throw new WebSocketBindingFailure('WebSocket cancellation exceeds the connection send policy.', 1008, 'Client send policy exceeded');
|
|
110
110
|
}
|
|
111
111
|
this.socket.send(socketData(encoded));
|
|
@@ -180,6 +180,9 @@ export class WebSocketConnection {
|
|
|
180
180
|
this.shutdown(invocationFailure(message, this.opened ? 'receive' : 'connect'));
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
|
+
function socketBufferedAmount(socket) {
|
|
184
|
+
return socket.bufferedAmount ?? 0;
|
|
185
|
+
}
|
|
183
186
|
async function normalizeFrame(input) {
|
|
184
187
|
if (typeof input === 'string')
|
|
185
188
|
return input;
|
|
@@ -282,4 +285,3 @@ function removeExchange(exchanges, exchange) {
|
|
|
282
285
|
return;
|
|
283
286
|
}
|
|
284
287
|
}
|
|
285
|
-
//# sourceMappingURL=connection.js.map
|
|
@@ -153,6 +153,14 @@ export class WebSocketExchange {
|
|
|
153
153
|
this.reject(new ResponseError(response.error.code, response.error.message, response.invocation, response.error.data));
|
|
154
154
|
return;
|
|
155
155
|
}
|
|
156
|
+
if ('execution' in response) {
|
|
157
|
+
this.complete({
|
|
158
|
+
kind: 'execution',
|
|
159
|
+
execution: response.execution,
|
|
160
|
+
invocation: response.invocation,
|
|
161
|
+
});
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
156
164
|
this.complete({ kind: 'value', value: response.result, invocation: response.invocation });
|
|
157
165
|
}
|
|
158
166
|
receiveStreamFrame(frame) {
|
|
@@ -298,4 +306,3 @@ function isKind(input, kind) {
|
|
|
298
306
|
!Array.isArray(input) &&
|
|
299
307
|
input.kind === kind);
|
|
300
308
|
}
|
|
301
|
-
//# sourceMappingURL=exchange.js.map
|
|
@@ -3,7 +3,6 @@ import type { RequestOptions, Transport, TransportRequest, TransportResult } fro
|
|
|
3
3
|
export type WebSocketConstructor = new (url: string | URL, protocols?: string | string[]) => WebSocket;
|
|
4
4
|
export interface WebSocketTransportOptions {
|
|
5
5
|
readonly url: string;
|
|
6
|
-
readonly codec?: 'json' | 'msgpack';
|
|
7
6
|
/** Inject this capability when the host does not provide a global WebSocket. */
|
|
8
7
|
readonly websocket?: WebSocketConstructor;
|
|
9
8
|
readonly timeoutMs?: number;
|
|
@@ -22,7 +21,6 @@ export interface WebSocketTransportOptions {
|
|
|
22
21
|
export declare class WebSocketTransport implements Transport {
|
|
23
22
|
readonly url: string;
|
|
24
23
|
private readonly connectionUrl;
|
|
25
|
-
private readonly codecName;
|
|
26
24
|
private readonly WebSocketConstructor;
|
|
27
25
|
private readonly timeoutMs;
|
|
28
26
|
private readonly maximumRequestBytes;
|
|
@@ -42,6 +40,4 @@ export declare class WebSocketTransport implements Transport {
|
|
|
42
40
|
private connectionClosed;
|
|
43
41
|
private acquire;
|
|
44
42
|
private nextRequestId;
|
|
45
|
-
private codec;
|
|
46
43
|
}
|
|
47
|
-
//# sourceMappingURL=transport.d.ts.map
|
|
@@ -14,7 +14,6 @@ const DEFAULT_MAXIMUM_BUFFERED_STREAM_ITEMS = 256;
|
|
|
14
14
|
export class WebSocketTransport {
|
|
15
15
|
url;
|
|
16
16
|
connectionUrl;
|
|
17
|
-
codecName;
|
|
18
17
|
WebSocketConstructor;
|
|
19
18
|
timeoutMs;
|
|
20
19
|
maximumRequestBytes;
|
|
@@ -35,7 +34,6 @@ export class WebSocketTransport {
|
|
|
35
34
|
}
|
|
36
35
|
this.url = normalizeUrl(options.url);
|
|
37
36
|
this.connectionUrl = this.url;
|
|
38
|
-
this.codecName = admitCodecName(options.codec);
|
|
39
37
|
this.WebSocketConstructor = admitWebSocket(options.websocket);
|
|
40
38
|
this.timeoutMs = positiveInteger(options.timeoutMs ?? DEFAULT_TIMEOUT_MS, 'timeoutMs');
|
|
41
39
|
this.maximumRequestBytes = positiveInteger(options.maximumRequestBytes ?? DEFAULT_MAXIMUM_REQUEST_BYTES, 'maximumRequestBytes');
|
|
@@ -49,10 +47,7 @@ export class WebSocketTransport {
|
|
|
49
47
|
throw invocationFailure('WebSocketTransport is closed.', 'closed');
|
|
50
48
|
}
|
|
51
49
|
const timeoutMs = positiveInteger(options.timeoutMs ?? this.timeoutMs, 'timeoutMs');
|
|
52
|
-
const codec =
|
|
53
|
-
if (this.stopped) {
|
|
54
|
-
throw invocationFailure('WebSocketTransport is closed.', 'closed');
|
|
55
|
-
}
|
|
50
|
+
const codec = codecs.json;
|
|
56
51
|
const request = protocol.decodeRequest({
|
|
57
52
|
version: protocol.VERSION,
|
|
58
53
|
requestId: this.nextRequestId(),
|
|
@@ -106,9 +101,6 @@ export class WebSocketTransport {
|
|
|
106
101
|
this.nextId = id === Number.MAX_SAFE_INTEGER ? 1 : id + 1;
|
|
107
102
|
return id;
|
|
108
103
|
}
|
|
109
|
-
codec() {
|
|
110
|
-
return this.codecName === 'msgpack' ? codecs.loadMsgpack() : Promise.resolve(codecs.json);
|
|
111
|
-
}
|
|
112
104
|
}
|
|
113
105
|
function normalizeUrl(input) {
|
|
114
106
|
if (typeof input !== 'string')
|
|
@@ -132,15 +124,8 @@ function normalizeUrl(input) {
|
|
|
132
124
|
}
|
|
133
125
|
return parsed.toString();
|
|
134
126
|
}
|
|
135
|
-
function admitCodecName(input) {
|
|
136
|
-
if (input === undefined || input === 'json')
|
|
137
|
-
return 'json';
|
|
138
|
-
if (input === 'msgpack')
|
|
139
|
-
return input;
|
|
140
|
-
throw new TypeError('codec must be "json" or "msgpack".');
|
|
141
|
-
}
|
|
142
127
|
function admitWebSocket(input) {
|
|
143
|
-
const implementation = input ??
|
|
128
|
+
const implementation = input ?? (typeof WebSocket === 'undefined' ? undefined : WebSocket);
|
|
144
129
|
if (typeof implementation !== 'function') {
|
|
145
130
|
throw new TypeError('WebSocketTransport requires a WebSocket implementation.');
|
|
146
131
|
}
|
|
@@ -162,4 +147,3 @@ function transportFailure(input, control, parent, timeoutMs, url) {
|
|
|
162
147
|
cause: asError(input),
|
|
163
148
|
});
|
|
164
149
|
}
|
|
165
|
-
//# sourceMappingURL=transport.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrale-os/kernel-client",
|
|
3
|
-
"version": "0.6.0
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Universal Client — protocol-first, transport-agnostic",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"astrale",
|
|
@@ -65,31 +65,28 @@
|
|
|
65
65
|
"access": "public"
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@astrale-os/kernel-core": "
|
|
69
|
-
"@astrale-os/kernel-dsl": "
|
|
70
|
-
"@astrale-os/kernel-protocol": "
|
|
71
|
-
"@tanstack/pacer": "0.20.1"
|
|
72
|
-
"msgpackr": "^2.0.5"
|
|
68
|
+
"@astrale-os/kernel-core": "0.9.0",
|
|
69
|
+
"@astrale-os/kernel-dsl": "0.2.0",
|
|
70
|
+
"@astrale-os/kernel-protocol": "0.5.0",
|
|
71
|
+
"@tanstack/pacer": "0.20.1"
|
|
73
72
|
},
|
|
74
73
|
"devDependencies": {
|
|
75
|
-
"@astrale-os/kernel-server": "
|
|
74
|
+
"@astrale-os/kernel-server": "0.5.0",
|
|
76
75
|
"@astrale/typescript-config": "npm:@jsr/astrale__typescript-config@~1.1.0",
|
|
77
76
|
"@types/node": "^22.0.0",
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
"vitest": "^4.1.10"
|
|
77
|
+
"typescript": "7.0.2",
|
|
78
|
+
"vitest": "^5.0.1"
|
|
81
79
|
},
|
|
82
80
|
"scripts": {
|
|
83
|
-
"build": "
|
|
84
|
-
"dev": "
|
|
85
|
-
"typecheck": "
|
|
81
|
+
"build": "tsc",
|
|
82
|
+
"dev": "tsc --watch",
|
|
83
|
+
"typecheck": "tsc --noEmit && tsc -p tsconfig.workers.json",
|
|
86
84
|
"test": "vitest run",
|
|
87
85
|
"test:boundary:protocol": "vitest run --config vitest.protocol-boundary.config.ts",
|
|
88
86
|
"test:boundary:server": "vitest run --config vitest.server-boundary.config.ts",
|
|
89
87
|
"test:file": "vitest run",
|
|
90
88
|
"test:package": "node scripts/verify-packed-package.mjs",
|
|
91
89
|
"test:watch": "vitest",
|
|
92
|
-
"clean": "rm -rf dist"
|
|
93
|
-
"preinstall": "node -e \"try{require('./.check-workspace.cjs')}catch{}\""
|
|
90
|
+
"clean": "rm -rf dist"
|
|
94
91
|
}
|
|
95
92
|
}
|
package/dist/auth/auth.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../auth/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EACR,UAAU,EACV,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EAChB,MAAM,8BAA8B,CAAA;AACrC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAA;AAE5D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AACnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAO/C,MAAM,MAAM,QAAQ,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,cAAc,KAAK,OAAO,CAAC,KAAK,CAAC,CAAA;AAEnG,MAAM,WAAW,OAAO;IACtB,SAAS,CAAC,KAAK,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC,CAAA;IACtF,MAAM,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAA;IACnD,KAAK,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAA;IAC5E,GAAG,CAAC,KAAK,EAAE,mBAAmB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IAC3E,IAAI,CAAC,KAAK,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAA;IAC7E,QAAQ,CACN,QAAQ,EAAE,UAAU,EACpB,KAAK,EAAE,eAAe,EACtB,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,gBAAgB,CAAC,CAAA;CAC7B;AAED,0FAA0F;AAC1F,wBAAgB,UAAU,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAQlD"}
|
package/dist/auth/auth.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../auth/auth.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAiB7C,0FAA0F;AAC1F,MAAM,UAAU,UAAU,CAAC,IAAc;IACvC,IAAI,OAAO,IAAI,KAAK,UAAU;QAAE,MAAM,IAAI,SAAS,CAAC,kCAAkC,CAAC,CAAA;IACvF,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,GAAG,YAAY,CAAC,IAAI,CAAC;QACrB,GAAG,WAAW,CAAC,IAAI,CAAC;QACpB,GAAG,gBAAgB,CAAC,IAAI,CAAC;QACzB,GAAG,aAAa,CAAC,IAAI,CAAC;KACvB,CAAC,CAAA;AACJ,CAAC"}
|