@astrale-os/kernel-client 0.6.0-beta.4 → 0.6.0-beta.41
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 +3 -4
- package/dist/auth/auth.js +0 -1
- package/dist/auth/authorization.d.ts +2 -3
- package/dist/auth/authorization.js +3 -4
- package/dist/auth/credential.d.ts +1 -2
- package/dist/auth/credential.js +5 -6
- package/dist/auth/identity.d.ts +6 -9
- package/dist/auth/identity.js +4 -5
- package/dist/auth/index.d.ts +1 -2
- package/dist/auth/index.js +0 -1
- package/dist/auth/provision.d.ts +0 -1
- package/dist/auth/provision.js +2 -3
- package/dist/client/admission.d.ts +0 -1
- package/dist/client/admission.js +0 -1
- package/dist/client/client.d.ts +0 -1
- package/dist/client/client.js +0 -1
- package/dist/client/credential.d.ts +0 -1
- package/dist/client/credential.js +0 -1
- package/dist/client/index.d.ts +0 -1
- package/dist/client/index.js +0 -1
- package/dist/client/request.d.ts +1 -2
- package/dist/client/request.js +1 -2
- package/dist/client/result.d.ts +3 -4
- package/dist/client/result.js +3 -1
- package/dist/client/routing-control.d.ts +0 -1
- package/dist/client/routing-control.js +0 -1
- package/dist/errors/client-error.d.ts +0 -1
- package/dist/errors/client-error.js +2 -1
- package/dist/errors/index.d.ts +7 -7
- package/dist/errors/index.js +7 -7
- 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/response-error.d.ts +2 -2
- package/dist/errors/response-error.js +1 -2
- package/dist/errors/session-error.d.ts +9 -0
- package/dist/errors/session-error.js +9 -0
- package/dist/errors/stale-route-error.d.ts +0 -1
- package/dist/errors/stale-route-error.js +0 -1
- package/dist/errors/transport-error.d.ts +18 -6
- package/dist/errors/transport-error.js +11 -7
- package/dist/graph/domain/binding.d.ts +22 -0
- package/dist/graph/domain/binding.js +123 -0
- package/dist/graph/domain/domain.typecheck.d.ts +1 -0
- package/dist/graph/domain/domain.typecheck.js +139 -0
- package/dist/graph/domain/index.d.ts +3 -0
- package/dist/graph/domain/index.js +1 -0
- package/dist/graph/domain/model.d.ts +18 -0
- package/dist/graph/domain/model.js +1 -0
- package/dist/graph/domain/page.d.ts +23 -0
- package/dist/graph/domain/page.js +42 -0
- package/dist/graph/domain/project.d.ts +8 -0
- package/dist/graph/domain/project.js +120 -0
- package/dist/graph/domain/provenance.d.ts +6 -0
- package/dist/graph/domain/provenance.js +11 -0
- package/dist/graph/errors.d.ts +2 -3
- package/dist/graph/errors.js +2 -2
- package/dist/graph/expectation.d.ts +3 -0
- package/dist/graph/expectation.js +6 -0
- package/dist/graph/graph.d.ts +12 -8
- package/dist/graph/graph.js +0 -1
- package/dist/graph/index.d.ts +2 -2
- package/dist/graph/index.js +1 -1
- package/dist/graph/mutation.d.ts +2 -4
- package/dist/graph/mutation.js +12 -4
- package/dist/graph/page/index.d.ts +0 -1
- package/dist/graph/page/index.js +0 -1
- package/dist/graph/page/neighbors.d.ts +4 -5
- package/dist/graph/page/neighbors.js +6 -7
- package/dist/graph/page/page.d.ts +5 -2
- package/dist/graph/page/page.js +0 -1
- package/dist/graph/page-contract.d.ts +1 -2
- package/dist/graph/page-contract.js +0 -1
- package/dist/graph/provenance.d.ts +14 -0
- package/dist/graph/provenance.js +42 -0
- package/dist/graph/query.d.ts +0 -1
- package/dist/graph/query.js +21 -13
- package/dist/graph/read.d.ts +3 -4
- package/dist/graph/read.js +1 -2
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -2
- 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 +0 -1
- package/dist/pacer/index.js +0 -1
- 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 +0 -1
- package/dist/pacer/retry/index.js +0 -1
- package/dist/pacer/retry/retry.d.ts +0 -1
- package/dist/pacer/retry/retry.js +0 -1
- 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 +9 -7
- package/dist/schema/admission.js +6 -12
- package/dist/schema/contracts.d.ts +6 -16
- package/dist/schema/contracts.js +0 -1
- package/dist/schema/index.d.ts +2 -3
- package/dist/schema/index.js +1 -2
- package/dist/schema/introspection.d.ts +1 -2
- package/dist/schema/introspection.js +7 -4
- package/dist/schema/operation.d.ts +0 -1
- package/dist/schema/operation.js +2 -3
- package/dist/schema/schema.d.ts +11 -10
- package/dist/schema/schema.js +60 -13
- package/dist/session/bound.d.ts +45 -0
- package/dist/session/bound.js +89 -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 +0 -1
- package/dist/session/context/index.js +0 -1
- package/dist/session/context/limits.d.ts +0 -1
- package/dist/session/context/limits.js +0 -1
- package/dist/session/context/operation.d.ts +0 -1
- package/dist/session/context/operation.js +19 -17
- package/dist/session/context/policy.d.ts +1 -2
- package/dist/session/context/policy.js +2 -3
- package/dist/session/discovery/bundle.d.ts +0 -1
- package/dist/session/discovery/bundle.js +6 -6
- package/dist/session/discovery/discovery.d.ts +1 -2
- package/dist/session/discovery/discovery.js +0 -1
- package/dist/session/discovery/index.d.ts +1 -2
- package/dist/session/discovery/index.js +0 -1
- package/dist/session/discovery/publication.d.ts +1 -2
- package/dist/session/discovery/publication.js +6 -5
- package/dist/session/discovery/snapshot.d.ts +1 -2
- package/dist/session/discovery/snapshot.js +0 -1
- package/dist/session/discovery/transport.d.ts +6 -0
- package/dist/session/discovery/transport.js +13 -0
- package/dist/session/index.d.ts +6 -4
- package/dist/session/index.js +3 -2
- package/dist/session/reference.d.ts +36 -0
- package/dist/session/reference.js +74 -0
- package/dist/session/routing/auth.d.ts +1 -2
- package/dist/session/routing/auth.js +1 -2
- package/dist/session/routing/cache.d.ts +28 -8
- package/dist/session/routing/cache.js +216 -28
- package/dist/session/routing/dispatch.d.ts +3 -7
- package/dist/session/routing/dispatch.js +32 -25
- package/dist/session/routing/envelope.d.ts +2 -1
- package/dist/session/routing/envelope.js +14 -10
- package/dist/session/routing/expectation.d.ts +6 -0
- package/dist/session/routing/expectation.js +1 -0
- package/dist/session/routing/index.d.ts +2 -3
- package/dist/session/routing/index.js +1 -2
- package/dist/session/routing/request.d.ts +1 -2
- package/dist/session/routing/request.js +1 -2
- package/dist/session/session.d.ts +17 -10
- package/dist/session/session.js +54 -38
- package/dist/session/session.typecheck.d.ts +0 -1
- package/dist/session/session.typecheck.js +23 -3
- package/dist/session/views/catalog.d.ts +2 -3
- package/dist/session/views/catalog.js +15 -7
- package/dist/session/views/index.d.ts +0 -1
- package/dist/session/views/index.js +0 -1
- package/dist/session/views/resolve.d.ts +0 -1
- package/dist/session/views/resolve.js +4 -3
- package/dist/store/entity-index.d.ts +0 -1
- package/dist/store/entity-index.js +0 -1
- 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 +24 -13
- package/dist/store/mutation.d.ts +0 -1
- package/dist/store/mutation.js +0 -1
- 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 +3 -2
- package/dist/store/shape.js +3 -2
- package/dist/store/store.d.ts +2 -4
- package/dist/store/store.js +5 -4
- package/dist/store/store.typecheck.d.ts +0 -1
- package/dist/store/store.typecheck.js +3 -9
- package/dist/transport/auto/decision.d.ts +0 -1
- package/dist/transport/auto/decision.js +0 -1
- package/dist/transport/auto/fallback.d.ts +0 -1
- package/dist/transport/auto/fallback.js +8 -10
- 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 -1
- package/dist/transport/auto/transport.js +5 -6
- 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 +7 -0
- package/dist/transport/failure.js +9 -0
- package/dist/transport/http/byte-stream.d.ts +17 -0
- package/dist/transport/http/byte-stream.js +86 -0
- package/dist/transport/http/index.d.ts +0 -1
- package/dist/transport/http/index.js +0 -1
- package/dist/transport/http/response.d.ts +2 -2
- package/dist/transport/http/response.js +2 -2
- package/dist/transport/http/stream.d.ts +2 -2
- package/dist/transport/http/stream.js +8 -8
- package/dist/transport/http/transport.d.ts +0 -1
- package/dist/transport/http/transport.js +40 -18
- package/dist/transport/index.d.ts +0 -1
- package/dist/transport/index.js +0 -1
- package/dist/transport/transport.d.ts +0 -1
- package/dist/transport/transport.js +0 -1
- package/dist/transport/websocket/connection.d.ts +2 -2
- package/dist/transport/websocket/connection.js +17 -27
- package/dist/transport/websocket/exchange.d.ts +1 -2
- package/dist/transport/websocket/exchange.js +6 -10
- 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 -1
- package/dist/transport/websocket/transport.js +9 -21
- package/package.json +21 -18
- 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.map +0 -1
- 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/domain/binding.d.ts +0 -24
- package/dist/domain/binding.d.ts.map +0 -1
- package/dist/domain/binding.js +0 -69
- package/dist/domain/binding.js.map +0 -1
- package/dist/domain/callable.d.ts +0 -25
- package/dist/domain/callable.d.ts.map +0 -1
- package/dist/domain/callable.js +0 -70
- package/dist/domain/callable.js.map +0 -1
- package/dist/domain/domain.typecheck.d.ts +0 -2
- package/dist/domain/domain.typecheck.d.ts.map +0 -1
- package/dist/domain/domain.typecheck.js +0 -69
- package/dist/domain/domain.typecheck.js.map +0 -1
- package/dist/domain/index.d.ts +0 -4
- package/dist/domain/index.d.ts.map +0 -1
- package/dist/domain/index.js +0 -2
- package/dist/domain/index.js.map +0 -1
- package/dist/domain/node.d.ts +0 -10
- package/dist/domain/node.d.ts.map +0 -1
- package/dist/domain/node.js +0 -6
- package/dist/domain/node.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/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/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/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/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.map +0 -1
- 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/index.d.ts.map +0 -1
- package/dist/session/index.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/bound.d.ts +0 -7
- package/dist/session/routing/bound.d.ts.map +0 -1
- package/dist/session/routing/bound.js +0 -2
- package/dist/session/routing/bound.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/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/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
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as codecs from '@astrale-os/kernel-protocol/codecs';
|
|
2
|
+
import * as protocol from '@astrale-os/kernel-protocol/invocation';
|
|
2
3
|
export declare function codecForResponse(contentType: string | null): Promise<codecs.Codec | undefined>;
|
|
3
4
|
export declare function readBoundedBody(response: Response, maximumBytes: number, signal: AbortSignal): Promise<Uint8Array>;
|
|
4
5
|
export declare function requireId(expected: protocol.RequestId, received: protocol.RequestId): void;
|
|
5
6
|
export declare function decodeProtocol<T>(label: string, decode: () => T): T;
|
|
6
7
|
export declare function normalizeMediaType(input: string | null): string | undefined;
|
|
7
8
|
export declare function binaryHeaders(input: Headers, names: readonly string[]): Readonly<Record<string, string>>;
|
|
8
|
-
//# sourceMappingURL=response.d.ts.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as codecs from '@astrale-os/kernel-protocol/codecs';
|
|
2
|
+
import * as protocol from '@astrale-os/kernel-protocol/invocation';
|
|
2
3
|
import { ProtocolError, ResponseError } from '../../errors/index.js';
|
|
3
4
|
import { asError } from '../index.js';
|
|
4
5
|
export async function codecForResponse(contentType) {
|
|
@@ -76,4 +77,3 @@ export function binaryHeaders(input, names) {
|
|
|
76
77
|
}
|
|
77
78
|
return Object.freeze(output);
|
|
78
79
|
}
|
|
79
|
-
//# sourceMappingURL=response.js.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Value } from '@astrale-os/kernel-dsl/value';
|
|
2
|
-
import
|
|
2
|
+
import type * as codecs from '@astrale-os/kernel-protocol/codecs';
|
|
3
|
+
import * as protocol from '@astrale-os/kernel-protocol/invocation';
|
|
3
4
|
import type { Stream } from '../../client/index.js';
|
|
4
5
|
import { type ControlledSignal } from '../index.js';
|
|
5
6
|
export declare class HttpStream implements Stream {
|
|
@@ -23,4 +24,3 @@ export declare class HttpStream implements Stream {
|
|
|
23
24
|
private stop;
|
|
24
25
|
private abortFailure;
|
|
25
26
|
}
|
|
26
|
-
//# sourceMappingURL=stream.d.ts.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as protocol from '@astrale-os/kernel-protocol/invocation';
|
|
2
2
|
import { ProtocolError, ResponseError, TransportError } from '../../errors/index.js';
|
|
3
|
+
import { invocationFailure } from '../failure.js';
|
|
3
4
|
import { asError } from '../index.js';
|
|
4
5
|
import { decodeProtocol, requireId } from './response.js';
|
|
5
6
|
export class HttpStream {
|
|
@@ -124,9 +125,8 @@ export class HttpStream {
|
|
|
124
125
|
}
|
|
125
126
|
abortFailure(reason) {
|
|
126
127
|
if (this.control.timedOut) {
|
|
127
|
-
return
|
|
128
|
+
return invocationFailure('stream exceeded its invocation timeout.', 'timeout', {
|
|
128
129
|
cause: asError(reason),
|
|
129
|
-
phase: 'timeout',
|
|
130
130
|
delivery: 'unknown',
|
|
131
131
|
invocation: this.invocation,
|
|
132
132
|
});
|
|
@@ -138,11 +138,12 @@ function retainInvocationId(input, invocation) {
|
|
|
138
138
|
if (input instanceof ProtocolError && input.invocation === undefined) {
|
|
139
139
|
return new ProtocolError(input.message, { cause: input, invocation });
|
|
140
140
|
}
|
|
141
|
-
if (input instanceof TransportError &&
|
|
142
|
-
|
|
141
|
+
if (input instanceof TransportError &&
|
|
142
|
+
input.context.kind === 'invocation' &&
|
|
143
|
+
input.context.invocation === undefined) {
|
|
144
|
+
return invocationFailure(input.message, input.phase, {
|
|
143
145
|
cause: input,
|
|
144
|
-
|
|
145
|
-
delivery: input.delivery,
|
|
146
|
+
delivery: input.context.delivery,
|
|
146
147
|
invocation,
|
|
147
148
|
});
|
|
148
149
|
}
|
|
@@ -211,4 +212,3 @@ class LengthPrefixedFrames {
|
|
|
211
212
|
return output;
|
|
212
213
|
}
|
|
213
214
|
}
|
|
214
|
-
//# sourceMappingURL=stream.js.map
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as codecs from '@astrale-os/kernel-protocol/codecs';
|
|
2
|
+
import * as protocol from '@astrale-os/kernel-protocol/invocation';
|
|
2
3
|
import { ProtocolError, ResponseError, TransportError } from '../../errors/index.js';
|
|
4
|
+
import { invocationFailure } from '../failure.js';
|
|
3
5
|
import { asError, controlledSignal, positiveInteger, requireLive, } from '../index.js';
|
|
6
|
+
import { HttpByteStream } from './byte-stream.js';
|
|
4
7
|
import { binaryHeaders, codecForResponse, decodeProtocol, normalizeMediaType, readBoundedBody, requireId, } from './response.js';
|
|
5
8
|
import { HttpStream } from './stream.js';
|
|
6
9
|
const DEFAULT_TIMEOUT_MS = 30_000;
|
|
@@ -48,7 +51,7 @@ export class HttpTransport {
|
|
|
48
51
|
try {
|
|
49
52
|
requireLive(control);
|
|
50
53
|
if (encodedByteLength(encoded) > this.maximumRequestBytes) {
|
|
51
|
-
throw
|
|
54
|
+
throw invocationFailure(`request exceeds maximumRequestBytes (${this.maximumRequestBytes}).`, 'send');
|
|
52
55
|
}
|
|
53
56
|
phase = 'send';
|
|
54
57
|
delivery = 'unknown';
|
|
@@ -62,8 +65,9 @@ export class HttpTransport {
|
|
|
62
65
|
const streamFraming = response.headers.get(protocol.http.STREAM_FRAMING_FIELD);
|
|
63
66
|
const binaryId = response.headers.get(protocol.http.REQUEST_ID_FIELD);
|
|
64
67
|
const binaryManifest = response.headers.get(protocol.http.BINARY_HEADERS_FIELD);
|
|
68
|
+
const binaryDelivery = response.headers.get(protocol.http.BINARY_DELIVERY_FIELD);
|
|
65
69
|
const hasStreamSignal = streamFraming !== null;
|
|
66
|
-
const hasBinarySignal = binaryId !== null || binaryManifest !== null;
|
|
70
|
+
const hasBinarySignal = binaryId !== null || binaryManifest !== null || binaryDelivery !== null;
|
|
67
71
|
if (hasStreamSignal && hasBinarySignal) {
|
|
68
72
|
throw new ProtocolError('server returned conflicting stream and binary response signals.');
|
|
69
73
|
}
|
|
@@ -71,7 +75,13 @@ export class HttpTransport {
|
|
|
71
75
|
if (binaryId === null || binaryManifest === null) {
|
|
72
76
|
throw new ProtocolError('server returned an incomplete binary response signal.');
|
|
73
77
|
}
|
|
74
|
-
|
|
78
|
+
if (binaryDelivery !== null && binaryDelivery !== protocol.http.STREAMING_BINARY_DELIVERY) {
|
|
79
|
+
throw new ProtocolError('server returned an unsupported binary delivery signal.');
|
|
80
|
+
}
|
|
81
|
+
const binary = await this.decodeBinary(response, requestId, binaryId, binaryDelivery !== null, control);
|
|
82
|
+
if (!(binary.value.body instanceof Uint8Array))
|
|
83
|
+
handedOff = true;
|
|
84
|
+
return binary;
|
|
75
85
|
}
|
|
76
86
|
const responseCodec = await codecForResponse(response.headers.get('content-type'));
|
|
77
87
|
if (responseCodec === undefined) {
|
|
@@ -131,9 +141,9 @@ export class HttpTransport {
|
|
|
131
141
|
}
|
|
132
142
|
}
|
|
133
143
|
async fetchResponse(codec, encoded, trace, control) {
|
|
134
|
-
|
|
144
|
+
const init = {
|
|
135
145
|
method: 'POST',
|
|
136
|
-
redirect: '
|
|
146
|
+
redirect: 'manual',
|
|
137
147
|
credentials: 'omit',
|
|
138
148
|
cache: 'no-store',
|
|
139
149
|
referrerPolicy: 'no-referrer',
|
|
@@ -145,12 +155,10 @@ export class HttpTransport {
|
|
|
145
155
|
},
|
|
146
156
|
body: toBody(encoded),
|
|
147
157
|
signal: control.signal,
|
|
148
|
-
}
|
|
158
|
+
};
|
|
159
|
+
return this.fetchImpl(this.url, init);
|
|
149
160
|
}
|
|
150
|
-
async decodeBinary(response, requestId, binaryId, control) {
|
|
151
|
-
if (!response.ok) {
|
|
152
|
-
throw new ProtocolError('server returned binary data with an error status.');
|
|
153
|
-
}
|
|
161
|
+
async decodeBinary(response, requestId, binaryId, streaming, control) {
|
|
154
162
|
if (binaryId !== String(requestId)) {
|
|
155
163
|
throw new ProtocolError(`binary response requestId ${JSON.stringify(binaryId)} does not match request requestId ${requestId}.`);
|
|
156
164
|
}
|
|
@@ -158,17 +166,33 @@ export class HttpTransport {
|
|
|
158
166
|
if (mediaType === undefined) {
|
|
159
167
|
throw new ProtocolError('binary response has no media type.');
|
|
160
168
|
}
|
|
161
|
-
const body = await readBoundedBody(response, this.maximumResponseBytes, control.signal);
|
|
162
|
-
requireLive(control);
|
|
163
169
|
const headerNames = decodeProtocol('binary application-header manifest', () => protocol.http.decodeBinaryHeaderNames(response.headers.get(protocol.http.BINARY_HEADERS_FIELD)));
|
|
164
170
|
const headers = binaryHeaders(response.headers, headerNames);
|
|
165
171
|
const invocation = decodeProtocol('binary InvocationId field', () => protocol.http.decodeInvocationId(response.headers.get(protocol.http.INVOCATION_FIELD)));
|
|
172
|
+
if (streaming) {
|
|
173
|
+
if (response.body === null)
|
|
174
|
+
throw new ProtocolError('streaming binary has no body.');
|
|
175
|
+
requireLive(control);
|
|
176
|
+
return {
|
|
177
|
+
kind: 'binary',
|
|
178
|
+
invocation,
|
|
179
|
+
value: {
|
|
180
|
+
body: new HttpByteStream(response.body, this.maximumResponseBytes, control),
|
|
181
|
+
mediaType,
|
|
182
|
+
...(response.status === 200 ? {} : { status: response.status }),
|
|
183
|
+
...(Object.keys(headers).length === 0 ? {} : { headers }),
|
|
184
|
+
},
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
const body = await readBoundedBody(response, this.maximumResponseBytes, control.signal);
|
|
188
|
+
requireLive(control);
|
|
166
189
|
const binary = decodeProtocol('binary response', () => protocol.decodeBinaryResponse({
|
|
167
190
|
kind: 'binary',
|
|
168
191
|
requestId,
|
|
169
192
|
invocation,
|
|
170
193
|
body,
|
|
171
194
|
mediaType,
|
|
195
|
+
status: response.status,
|
|
172
196
|
...(Object.keys(headers).length === 0 ? {} : { headers }),
|
|
173
197
|
}));
|
|
174
198
|
requireLive(control);
|
|
@@ -178,6 +202,7 @@ export class HttpTransport {
|
|
|
178
202
|
value: {
|
|
179
203
|
body: binary.body,
|
|
180
204
|
mediaType: binary.mediaType,
|
|
205
|
+
...(binary.status === 200 ? {} : { status: binary.status }),
|
|
181
206
|
...(binary.headers === undefined ? {} : { headers: binary.headers }),
|
|
182
207
|
},
|
|
183
208
|
};
|
|
@@ -264,9 +289,8 @@ function transportFailure(input, control, parent, timeoutMs, url, phase, deliver
|
|
|
264
289
|
if (input instanceof ResponseError || input instanceof ProtocolError)
|
|
265
290
|
return input;
|
|
266
291
|
if (control.timedOut) {
|
|
267
|
-
return
|
|
292
|
+
return invocationFailure(`request timed out after ${timeoutMs}ms.`, 'timeout', {
|
|
268
293
|
cause: asError(input),
|
|
269
|
-
phase: 'timeout',
|
|
270
294
|
delivery,
|
|
271
295
|
});
|
|
272
296
|
}
|
|
@@ -274,9 +298,8 @@ function transportFailure(input, control, parent, timeoutMs, url, phase, deliver
|
|
|
274
298
|
return asError(parent.reason ?? input);
|
|
275
299
|
return input instanceof TransportError
|
|
276
300
|
? input
|
|
277
|
-
:
|
|
301
|
+
: invocationFailure(`Failed to communicate with the server at ${url}.`, phase, {
|
|
278
302
|
cause: asError(input),
|
|
279
|
-
phase,
|
|
280
303
|
delivery,
|
|
281
304
|
});
|
|
282
305
|
}
|
|
@@ -341,4 +364,3 @@ function hasControlCharacter(input) {
|
|
|
341
364
|
}
|
|
342
365
|
return false;
|
|
343
366
|
}
|
|
344
|
-
//# sourceMappingURL=transport.js.map
|
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
export type { RequestOptions, 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,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type * as codecs from '@astrale-os/kernel-protocol/codecs';
|
|
2
|
+
import * as protocol from '@astrale-os/kernel-protocol/invocation';
|
|
2
3
|
import type { ControlledSignal } from '../index.js';
|
|
3
4
|
import type { TransportResult } from '../index.js';
|
|
4
5
|
import type { ExchangeOwner } from './exchange.js';
|
|
@@ -35,4 +36,3 @@ export declare class WebSocketConnection implements ExchangeOwner {
|
|
|
35
36
|
private onMessage;
|
|
36
37
|
private onFailure;
|
|
37
38
|
}
|
|
38
|
-
//# sourceMappingURL=connection.d.ts.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { ProtocolError
|
|
1
|
+
import * as protocol from '@astrale-os/kernel-protocol/invocation';
|
|
2
|
+
import { ProtocolError } from '../../errors/index.js';
|
|
3
|
+
import { invocationFailure } from '../failure.js';
|
|
3
4
|
import { asError } from '../index.js';
|
|
4
5
|
import { WebSocketExchange } from './exchange.js';
|
|
5
6
|
const WS_CONNECTING = 0;
|
|
@@ -63,10 +64,7 @@ export class WebSocketConnection {
|
|
|
63
64
|
dispatch(request, control, maximumBufferedItems) {
|
|
64
65
|
if (!this.isOpen) {
|
|
65
66
|
control.close();
|
|
66
|
-
return Promise.reject(
|
|
67
|
-
phase: 'connect',
|
|
68
|
-
delivery: 'not-sent',
|
|
69
|
-
}));
|
|
67
|
+
return Promise.reject(invocationFailure('WebSocket connection is not available.', 'connect'));
|
|
70
68
|
}
|
|
71
69
|
const key = requestKey(request.requestId);
|
|
72
70
|
if (this.active.has(key) || this.cancelled.has(key)) {
|
|
@@ -75,17 +73,17 @@ export class WebSocketConnection {
|
|
|
75
73
|
}
|
|
76
74
|
if (this.active.size + this.cancelled.size >= this.maximumActiveInvocations) {
|
|
77
75
|
control.close();
|
|
78
|
-
return Promise.reject(
|
|
76
|
+
return Promise.reject(invocationFailure(`WebSocket connection exceeds maximumActiveInvocations (${this.maximumActiveInvocations}).`, 'send'));
|
|
79
77
|
}
|
|
80
78
|
const encoded = this.codec.encode(request);
|
|
81
79
|
const encodedBytes = frameSize(encoded);
|
|
82
80
|
if (encodedBytes > this.maximumRequestBytes) {
|
|
83
81
|
control.close();
|
|
84
|
-
return Promise.reject(
|
|
82
|
+
return Promise.reject(invocationFailure(`WebSocket request exceeds maximumRequestBytes (${this.maximumRequestBytes}).`, 'send'));
|
|
85
83
|
}
|
|
86
|
-
if (this.socket
|
|
84
|
+
if (socketBufferedAmount(this.socket) + encodedBytes > this.maximumBufferedBytes) {
|
|
87
85
|
control.close();
|
|
88
|
-
return Promise.reject(
|
|
86
|
+
return Promise.reject(invocationFailure(`WebSocket connection exceeds maximumBufferedBytes (${this.maximumBufferedBytes}).`, 'send'));
|
|
89
87
|
}
|
|
90
88
|
const exchange = new WebSocketExchange(this, request.requestId, control, maximumBufferedItems);
|
|
91
89
|
this.active.set(key, exchange);
|
|
@@ -94,10 +92,7 @@ export class WebSocketConnection {
|
|
|
94
92
|
finish(exchange, reusable, closeCode = 1002) {
|
|
95
93
|
removeExchange(this.active, exchange);
|
|
96
94
|
if (!reusable) {
|
|
97
|
-
this.shutdown(
|
|
98
|
-
phase: 'receive',
|
|
99
|
-
delivery: 'not-sent',
|
|
100
|
-
}), closeCode, closeReason(closeCode));
|
|
95
|
+
this.shutdown(invocationFailure('WebSocket connection was closed after a binding failure.', 'receive'), closeCode, closeReason(closeCode));
|
|
101
96
|
}
|
|
102
97
|
}
|
|
103
98
|
cancel(exchange, requestId) {
|
|
@@ -110,23 +105,19 @@ export class WebSocketConnection {
|
|
|
110
105
|
const encoded = this.codec.encode(protocol.decodeCancelRequest({ version: protocol.VERSION, kind: 'cancel', requestId }));
|
|
111
106
|
const bytes = frameSize(encoded);
|
|
112
107
|
if (bytes > this.maximumRequestBytes ||
|
|
113
|
-
this.socket
|
|
108
|
+
socketBufferedAmount(this.socket) + bytes > this.maximumBufferedBytes) {
|
|
114
109
|
throw new WebSocketBindingFailure('WebSocket cancellation exceeds the connection send policy.', 1008, 'Client send policy exceeded');
|
|
115
110
|
}
|
|
116
111
|
this.socket.send(socketData(encoded));
|
|
117
112
|
}
|
|
118
113
|
catch (error) {
|
|
119
|
-
this.shutdown(
|
|
114
|
+
this.shutdown(invocationFailure('Failed to send WebSocket cancellation.', 'send', {
|
|
120
115
|
cause: asError(error),
|
|
121
|
-
phase: 'send',
|
|
122
116
|
delivery: 'unknown',
|
|
123
117
|
}), error instanceof WebSocketBindingFailure ? error.closeCode : 1011, error instanceof WebSocketBindingFailure ? error.closeReason : 'Client send failed');
|
|
124
118
|
}
|
|
125
119
|
}
|
|
126
|
-
shutdown(reason =
|
|
127
|
-
phase: 'closed',
|
|
128
|
-
delivery: 'not-sent',
|
|
129
|
-
}), closeCode = 1000, closeReason = 'Client closed') {
|
|
120
|
+
shutdown(reason = invocationFailure('WebSocket connection was closed.', 'closed'), closeCode = 1000, closeReason = 'Client closed') {
|
|
130
121
|
if (this.closedState)
|
|
131
122
|
return;
|
|
132
123
|
this.closedState = true;
|
|
@@ -151,7 +142,7 @@ export class WebSocketConnection {
|
|
|
151
142
|
return;
|
|
152
143
|
const expected = protocol.websocket.subprotocolFor(this.codec);
|
|
153
144
|
if (this.socket.protocol !== expected) {
|
|
154
|
-
this.shutdown(
|
|
145
|
+
this.shutdown(invocationFailure(`server selected WebSocket subprotocol ${JSON.stringify(this.socket.protocol)}; expected ${JSON.stringify(expected)}.`, 'connect'), 1002, 'Subprotocol mismatch');
|
|
155
146
|
return;
|
|
156
147
|
}
|
|
157
148
|
this.opened = true;
|
|
@@ -186,12 +177,12 @@ export class WebSocketConnection {
|
|
|
186
177
|
onFailure(message) {
|
|
187
178
|
if (this.closedState)
|
|
188
179
|
return;
|
|
189
|
-
this.shutdown(
|
|
190
|
-
phase: this.opened ? 'receive' : 'connect',
|
|
191
|
-
delivery: 'not-sent',
|
|
192
|
-
}));
|
|
180
|
+
this.shutdown(invocationFailure(message, this.opened ? 'receive' : 'connect'));
|
|
193
181
|
}
|
|
194
182
|
}
|
|
183
|
+
function socketBufferedAmount(socket) {
|
|
184
|
+
return socket.bufferedAmount ?? 0;
|
|
185
|
+
}
|
|
195
186
|
async function normalizeFrame(input) {
|
|
196
187
|
if (typeof input === 'string')
|
|
197
188
|
return input;
|
|
@@ -294,4 +285,3 @@ function removeExchange(exchanges, exchange) {
|
|
|
294
285
|
return;
|
|
295
286
|
}
|
|
296
287
|
}
|
|
297
|
-
//# sourceMappingURL=connection.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Value } from '@astrale-os/kernel-dsl/value';
|
|
2
|
-
import
|
|
2
|
+
import type * as protocol from '@astrale-os/kernel-protocol/invocation';
|
|
3
3
|
import type { Stream } from '../../client/index.js';
|
|
4
4
|
import type { ControlledSignal } from '../index.js';
|
|
5
5
|
import type { TransportResult } from '../index.js';
|
|
@@ -44,4 +44,3 @@ export declare class WebSocketExchange implements Stream {
|
|
|
44
44
|
private flushTerminal;
|
|
45
45
|
private abortFailure;
|
|
46
46
|
}
|
|
47
|
-
//# sourceMappingURL=exchange.d.ts.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { ProtocolError, ResponseError
|
|
1
|
+
import * as errors from '@astrale-os/kernel-protocol/errors';
|
|
2
|
+
import { ProtocolError, ResponseError } from '../../errors/index.js';
|
|
3
|
+
import { invocationFailure } from '../failure.js';
|
|
3
4
|
import { asError } from '../index.js';
|
|
4
5
|
/** One correlated invocation within a multiplexed WebSocket connection. */
|
|
5
6
|
export class WebSocketExchange {
|
|
@@ -44,10 +45,8 @@ export class WebSocketExchange {
|
|
|
44
45
|
this.sent = true;
|
|
45
46
|
}
|
|
46
47
|
catch (error) {
|
|
47
|
-
this.fail(
|
|
48
|
+
this.fail(invocationFailure('Failed to send the WebSocket invocation.', 'send', {
|
|
48
49
|
cause: asError(error),
|
|
49
|
-
phase: 'send',
|
|
50
|
-
delivery: 'not-sent',
|
|
51
50
|
}), 1011);
|
|
52
51
|
}
|
|
53
52
|
return this.result;
|
|
@@ -70,9 +69,8 @@ export class WebSocketExchange {
|
|
|
70
69
|
}
|
|
71
70
|
connectionFailed(error) {
|
|
72
71
|
this.fail(this.sent
|
|
73
|
-
?
|
|
72
|
+
? invocationFailure(error.message, 'receive', {
|
|
74
73
|
cause: error,
|
|
75
|
-
phase: 'receive',
|
|
76
74
|
delivery: 'unknown',
|
|
77
75
|
...(this.invocation === undefined ? {} : { invocation: this.invocation }),
|
|
78
76
|
})
|
|
@@ -257,9 +255,8 @@ export class WebSocketExchange {
|
|
|
257
255
|
}
|
|
258
256
|
abortFailure() {
|
|
259
257
|
if (this.control.timedOut) {
|
|
260
|
-
return
|
|
258
|
+
return invocationFailure('WebSocket invocation exceeded its timeout.', 'timeout', {
|
|
261
259
|
cause: asError(this.control.signal.reason),
|
|
262
|
-
phase: 'timeout',
|
|
263
260
|
delivery: this.sent ? 'unknown' : 'not-sent',
|
|
264
261
|
...(this.invocation === undefined ? {} : { invocation: this.invocation }),
|
|
265
262
|
});
|
|
@@ -301,4 +298,3 @@ function isKind(input, kind) {
|
|
|
301
298
|
!Array.isArray(input) &&
|
|
302
299
|
input.kind === kind);
|
|
303
300
|
}
|
|
304
|
-
//# sourceMappingURL=exchange.js.map
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as codecs from '@astrale-os/kernel-protocol/codecs';
|
|
2
|
+
import * as protocol from '@astrale-os/kernel-protocol/invocation';
|
|
2
3
|
import { ProtocolError, ResponseError, TransportError } from '../../errors/index.js';
|
|
4
|
+
import { invocationFailure } from '../failure.js';
|
|
3
5
|
import { asError, controlledSignal, positiveInteger, requireLive } from '../index.js';
|
|
4
6
|
import { WebSocketConnection } from './connection.js';
|
|
5
7
|
const DEFAULT_TIMEOUT_MS = 30_000;
|
|
@@ -44,18 +46,12 @@ export class WebSocketTransport {
|
|
|
44
46
|
}
|
|
45
47
|
async dispatch(input, options = {}) {
|
|
46
48
|
if (this.stopped) {
|
|
47
|
-
throw
|
|
48
|
-
phase: 'closed',
|
|
49
|
-
delivery: 'not-sent',
|
|
50
|
-
});
|
|
49
|
+
throw invocationFailure('WebSocketTransport is closed.', 'closed');
|
|
51
50
|
}
|
|
52
51
|
const timeoutMs = positiveInteger(options.timeoutMs ?? this.timeoutMs, 'timeoutMs');
|
|
53
52
|
const codec = await this.codec();
|
|
54
53
|
if (this.stopped) {
|
|
55
|
-
throw
|
|
56
|
-
phase: 'closed',
|
|
57
|
-
delivery: 'not-sent',
|
|
58
|
-
});
|
|
54
|
+
throw invocationFailure('WebSocketTransport is closed.', 'closed');
|
|
59
55
|
}
|
|
60
56
|
const request = protocol.decodeRequest({
|
|
61
57
|
version: protocol.VERSION,
|
|
@@ -86,10 +82,7 @@ export class WebSocketTransport {
|
|
|
86
82
|
return;
|
|
87
83
|
this.stopped = true;
|
|
88
84
|
this.connection = undefined;
|
|
89
|
-
const failure =
|
|
90
|
-
phase: 'closed',
|
|
91
|
-
delivery: 'not-sent',
|
|
92
|
-
});
|
|
85
|
+
const failure = invocationFailure('WebSocketTransport is closed.', 'closed');
|
|
93
86
|
for (const connection of this.connections)
|
|
94
87
|
connection.shutdown(failure);
|
|
95
88
|
}
|
|
@@ -147,7 +140,7 @@ function admitCodecName(input) {
|
|
|
147
140
|
throw new TypeError('codec must be "json" or "msgpack".');
|
|
148
141
|
}
|
|
149
142
|
function admitWebSocket(input) {
|
|
150
|
-
const implementation = input ??
|
|
143
|
+
const implementation = input ?? (typeof WebSocket === 'undefined' ? undefined : WebSocket);
|
|
151
144
|
if (typeof implementation !== 'function') {
|
|
152
145
|
throw new TypeError('WebSocketTransport requires a WebSocket implementation.');
|
|
153
146
|
}
|
|
@@ -159,18 +152,13 @@ function transportFailure(input, control, parent, timeoutMs, url) {
|
|
|
159
152
|
if (input instanceof TransportError)
|
|
160
153
|
return input;
|
|
161
154
|
if (control.timedOut) {
|
|
162
|
-
return
|
|
155
|
+
return invocationFailure(`WebSocket invocation timed out after ${timeoutMs}ms.`, 'timeout', {
|
|
163
156
|
cause: asError(input),
|
|
164
|
-
phase: 'timeout',
|
|
165
|
-
delivery: 'not-sent',
|
|
166
157
|
});
|
|
167
158
|
}
|
|
168
159
|
if (parent?.aborted)
|
|
169
160
|
return asError(parent.reason ?? input);
|
|
170
|
-
return
|
|
161
|
+
return invocationFailure(`Failed to communicate with the server at ${url}.`, 'connect', {
|
|
171
162
|
cause: asError(input),
|
|
172
|
-
phase: 'connect',
|
|
173
|
-
delivery: 'not-sent',
|
|
174
163
|
});
|
|
175
164
|
}
|
|
176
|
-
//# 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-beta.
|
|
3
|
+
"version": "0.6.0-beta.41",
|
|
4
4
|
"description": "Universal Client — protocol-first, transport-agnostic",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"astrale",
|
|
@@ -11,6 +11,11 @@
|
|
|
11
11
|
],
|
|
12
12
|
"license": "Apache-2.0",
|
|
13
13
|
"author": "Astrale",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/astrale-os/kernel.git",
|
|
17
|
+
"directory": "client"
|
|
18
|
+
},
|
|
14
19
|
"files": [
|
|
15
20
|
"dist"
|
|
16
21
|
],
|
|
@@ -26,6 +31,10 @@
|
|
|
26
31
|
"types": "./dist/auth/index.d.ts",
|
|
27
32
|
"import": "./dist/auth/index.js"
|
|
28
33
|
},
|
|
34
|
+
"./errors": {
|
|
35
|
+
"types": "./dist/errors/index.d.ts",
|
|
36
|
+
"import": "./dist/errors/index.js"
|
|
37
|
+
},
|
|
29
38
|
"./graph": {
|
|
30
39
|
"types": "./dist/graph/index.d.ts",
|
|
31
40
|
"import": "./dist/graph/index.js"
|
|
@@ -34,10 +43,6 @@
|
|
|
34
43
|
"types": "./dist/schema/index.d.ts",
|
|
35
44
|
"import": "./dist/schema/index.js"
|
|
36
45
|
},
|
|
37
|
-
"./domain": {
|
|
38
|
-
"types": "./dist/domain/index.d.ts",
|
|
39
|
-
"import": "./dist/domain/index.js"
|
|
40
|
-
},
|
|
41
46
|
"./session": {
|
|
42
47
|
"types": "./dist/session/index.d.ts",
|
|
43
48
|
"import": "./dist/session/index.js"
|
|
@@ -60,31 +65,29 @@
|
|
|
60
65
|
"access": "public"
|
|
61
66
|
},
|
|
62
67
|
"dependencies": {
|
|
63
|
-
"@astrale-os/kernel-core": "
|
|
64
|
-
"@astrale-os/kernel-dsl": "
|
|
65
|
-
"@astrale-os/kernel-protocol": "
|
|
68
|
+
"@astrale-os/kernel-core": "0.9.0-beta.30",
|
|
69
|
+
"@astrale-os/kernel-dsl": "0.2.0-beta.23",
|
|
70
|
+
"@astrale-os/kernel-protocol": "0.5.0-beta.33",
|
|
66
71
|
"@tanstack/pacer": "0.20.1",
|
|
67
|
-
"msgpackr": "^
|
|
72
|
+
"msgpackr": "^2.0.5"
|
|
68
73
|
},
|
|
69
74
|
"devDependencies": {
|
|
75
|
+
"@astrale-os/kernel-server": "0.5.0-beta.35",
|
|
70
76
|
"@astrale/typescript-config": "npm:@jsr/astrale__typescript-config@~1.1.0",
|
|
71
77
|
"@types/node": "^22.0.0",
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"vitest": "^3.1.4",
|
|
75
|
-
"@astrale-os/kernel-server": "^0.5.0-beta.4"
|
|
78
|
+
"typescript": "7.0.2",
|
|
79
|
+
"vitest": "^4.1.10"
|
|
76
80
|
},
|
|
77
81
|
"scripts": {
|
|
78
|
-
"build": "
|
|
79
|
-
"dev": "
|
|
80
|
-
"typecheck": "
|
|
82
|
+
"build": "tsc",
|
|
83
|
+
"dev": "tsc --watch",
|
|
84
|
+
"typecheck": "tsc --noEmit",
|
|
81
85
|
"test": "vitest run",
|
|
82
86
|
"test:boundary:protocol": "vitest run --config vitest.protocol-boundary.config.ts",
|
|
83
87
|
"test:boundary:server": "vitest run --config vitest.server-boundary.config.ts",
|
|
84
88
|
"test:file": "vitest run",
|
|
85
89
|
"test:package": "node scripts/verify-packed-package.mjs",
|
|
86
90
|
"test:watch": "vitest",
|
|
87
|
-
"clean": "rm -rf dist"
|
|
88
|
-
"preinstall": "node -e \"try{require('./.check-workspace.cjs')}catch{}\""
|
|
91
|
+
"clean": "rm -rf dist"
|
|
89
92
|
}
|
|
90
93
|
}
|
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;IACt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ACnB,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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"authorization.d.ts","sourceRoot":"","sources":["../../auth/authorization.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAA;AAChE,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAA;AACtE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAKvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAEzC,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,MAAM,EAAE,QAAQ,GAAG,MAAM,CAAC,SAAS,CAAA;IAC5C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CACxB;AAID,eAAO,MAAM,iBAAiB,EAAE,QAG3B,CAAA;AAEL,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,QAAQ;eAE1B,mBAAmB,YAAY,cAAc;GASjE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"authorization.js","sourceRoot":"","sources":["../../auth/authorization.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAA;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAA;AAUzD,MAAM,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;AAEtE,MAAM,CAAC,MAAM,iBAAiB,GAAa,IAAI,CAAC,YAAY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