@astrale-os/kernel-client 0.6.0-beta.5 → 0.6.0-beta.50
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 +0 -1
- package/dist/auth/credential.d.ts +0 -1
- package/dist/auth/credential.js +0 -1
- package/dist/auth/identity.d.ts +6 -9
- package/dist/auth/identity.js +0 -1
- package/dist/auth/index.d.ts +0 -1
- package/dist/auth/index.js +0 -1
- package/dist/auth/provision.d.ts +0 -1
- package/dist/auth/provision.js +0 -1
- 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 +0 -1
- package/dist/client/request.js +0 -1
- 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 +0 -1
- package/dist/errors/response-error.js +0 -1
- 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 +146 -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 +1 -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 +10 -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 +4 -5
- package/dist/graph/page/neighbors.js +7 -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 +3 -1
- package/dist/graph/query.js +33 -13
- package/dist/graph/read.d.ts +3 -4
- package/dist/graph/read.js +6 -5
- 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 +1 -2
- package/dist/schema/admission.js +0 -1
- 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 +5 -2
- 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 +80 -11
- 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 +0 -1
- package/dist/session/context/policy.js +0 -1
- package/dist/session/discovery/bundle.d.ts +0 -1
- package/dist/session/discovery/bundle.js +4 -4
- package/dist/session/discovery/discovery.d.ts +0 -1
- package/dist/session/discovery/discovery.js +0 -1
- package/dist/session/discovery/index.d.ts +0 -1
- package/dist/session/discovery/index.js +0 -1
- package/dist/session/discovery/publication.d.ts +0 -1
- package/dist/session/discovery/publication.js +4 -4
- package/dist/session/discovery/snapshot.d.ts +0 -1
- 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 +4 -3
- package/dist/session/index.js +2 -1
- package/dist/session/reference.d.ts +14 -5
- package/dist/session/reference.js +28 -8
- package/dist/session/routing/auth.d.ts +0 -1
- package/dist/session/routing/auth.js +0 -1
- package/dist/session/routing/cache.d.ts +26 -6
- package/dist/session/routing/cache.js +215 -16
- package/dist/session/routing/dispatch.d.ts +0 -4
- package/dist/session/routing/dispatch.js +28 -18
- package/dist/session/routing/envelope.d.ts +2 -1
- package/dist/session/routing/envelope.js +14 -10
- package/dist/session/routing/expectation.d.ts +2 -3
- package/dist/session/routing/expectation.js +0 -1
- package/dist/session/routing/index.d.ts +1 -2
- package/dist/session/routing/index.js +1 -2
- package/dist/session/routing/request.d.ts +0 -1
- package/dist/session/routing/request.js +0 -1
- package/dist/session/session.d.ts +12 -6
- package/dist/session/session.js +32 -25
- package/dist/session/session.typecheck.d.ts +0 -1
- package/dist/session/session.typecheck.js +23 -3
- package/dist/session/views/catalog.d.ts +0 -1
- package/dist/session/views/catalog.js +13 -5
- 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 +0 -1
- 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 +0 -1
- package/dist/transport/http/response.js +0 -1
- package/dist/transport/http/stream.d.ts +0 -1
- package/dist/transport/http/stream.js +7 -7
- package/dist/transport/http/transport.d.ts +0 -1
- package/dist/transport/http/transport.js +43 -19
- 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 +0 -1
- package/dist/transport/websocket/connection.js +16 -26
- package/dist/transport/websocket/exchange.d.ts +0 -1
- package/dist/transport/websocket/exchange.js +5 -9
- 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 +7 -20
- package/package.json +12 -14
- 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/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/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.map +0 -1
- 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/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
package/dist/schema/schema.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { Path } from '@astrale-os/kernel-core/path';
|
|
2
|
-
import {
|
|
2
|
+
import { uninstallOutput } from '@astrale-os/kernel-core/schema/kernel/syscalls/contracts';
|
|
3
3
|
import { install, uninstall } from '@astrale-os/kernel-core/schema/kernel/syscalls/references';
|
|
4
|
+
import * as protocolSchema from '@astrale-os/kernel-protocol/schema';
|
|
4
5
|
import { call as invocation } from '../client/index.js';
|
|
5
6
|
import { acceptOutput } from './admission.js';
|
|
6
|
-
import { introspect
|
|
7
|
+
import { introspect } from './introspection.js';
|
|
7
8
|
const INSTALL_PATH = Path.project(install).raw;
|
|
8
9
|
const UNINSTALL_PATH = Path.project(uninstall).raw;
|
|
10
|
+
export const DEFAULT_SCHEMA_LIFECYCLE_TIMEOUT_MS = 110_000;
|
|
9
11
|
/** Bind the canonical Schema lifecycle syscalls to one caller-scoped value-call capability. */
|
|
10
12
|
export function createSchema(call, limits) {
|
|
11
13
|
if (typeof call !== 'function')
|
|
@@ -13,32 +15,99 @@ export function createSchema(call, limits) {
|
|
|
13
15
|
const admittedLimits = admitLimits(limits);
|
|
14
16
|
return Object.freeze({
|
|
15
17
|
async install(request, options) {
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
+
const result = await call(invocation(INSTALL_PATH, request), lifecycleOptions(options, admittedLimits.lifecycleTimeoutMs));
|
|
19
|
+
if (result.kind !== 'binary') {
|
|
20
|
+
throw new TypeError('Schema install returned a non-binary result.');
|
|
21
|
+
}
|
|
22
|
+
if (result.value.mediaType !== protocolSchema.installation.MEDIA_TYPE) {
|
|
23
|
+
throw new TypeError('Schema install returned an unsupported media type.');
|
|
24
|
+
}
|
|
25
|
+
if (!(result.value.body instanceof Uint8Array)) {
|
|
26
|
+
await result.value.body[Symbol.asyncIterator]().return?.();
|
|
27
|
+
throw new TypeError('Schema install returned a streaming binary result.');
|
|
28
|
+
}
|
|
29
|
+
const decoded = await protocolSchema.installation.decode(result.value.body, installationResultLimit(admittedLimits.maximumPublicationBytes, request.domains.length));
|
|
30
|
+
proveInstallResult(request, decoded);
|
|
31
|
+
return decoded;
|
|
18
32
|
},
|
|
19
33
|
async uninstall(request, options) {
|
|
20
|
-
const
|
|
21
|
-
|
|
34
|
+
const snapshot = snapshotUninstallRequest(request);
|
|
35
|
+
const output = value(await call(invocation(UNINSTALL_PATH, snapshot), lifecycleOptions(options, admittedLimits.lifecycleTimeoutMs)));
|
|
36
|
+
const receipt = acceptOutput(uninstallOutput, output);
|
|
37
|
+
proveUninstallReceipt(snapshot, receipt);
|
|
38
|
+
return receipt;
|
|
22
39
|
},
|
|
23
|
-
async
|
|
24
|
-
return
|
|
40
|
+
async inspect(origin, options) {
|
|
41
|
+
return introspect(call, admittedLimits, { kind: 'inspect', origin }, options);
|
|
25
42
|
},
|
|
43
|
+
async bundle(origin, options) {
|
|
44
|
+
return introspect(call, admittedLimits, { kind: 'bundle', origin }, options);
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function snapshotUninstallRequest(request) {
|
|
49
|
+
return Object.freeze({
|
|
50
|
+
operation: request.operation,
|
|
51
|
+
domains: Object.freeze([...new Set(request.domains)].sort(compare)),
|
|
52
|
+
data: Object.freeze({ mode: request.data.mode }),
|
|
26
53
|
});
|
|
27
54
|
}
|
|
55
|
+
function proveUninstallReceipt(request, receipt) {
|
|
56
|
+
if (receipt.operation !== request.operation) {
|
|
57
|
+
throw new TypeError('Schema uninstall result does not match the requested operation.');
|
|
58
|
+
}
|
|
59
|
+
const actual = receipt.transitions.map((transition) => transition.intent.origin);
|
|
60
|
+
if (actual.length !== request.domains.length ||
|
|
61
|
+
actual.some((origin, index) => origin !== request.domains[index])) {
|
|
62
|
+
throw new TypeError('Schema uninstall result does not match the requested Domains.');
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function compare(left, right) {
|
|
66
|
+
return left < right ? -1 : left > right ? 1 : 0;
|
|
67
|
+
}
|
|
68
|
+
function installationResultLimit(maximumDomainBytes, roots) {
|
|
69
|
+
const perDomain = maximumDomainBytes + 4_096;
|
|
70
|
+
if (roots > Math.floor((Number.MAX_SAFE_INTEGER - 4_096) / perDomain)) {
|
|
71
|
+
return Number.MAX_SAFE_INTEGER;
|
|
72
|
+
}
|
|
73
|
+
return perDomain * roots + 4_096;
|
|
74
|
+
}
|
|
75
|
+
function proveInstallResult(request, result) {
|
|
76
|
+
if (result.changed) {
|
|
77
|
+
if (result.receipt.operation !== request.operation) {
|
|
78
|
+
throw new TypeError('Schema install result does not match the requested operation.');
|
|
79
|
+
}
|
|
80
|
+
if (result.receipt.transitions.length > request.domains.length) {
|
|
81
|
+
throw new TypeError('Schema install result contains more transitions than requested Domains.');
|
|
82
|
+
}
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
if (result.domains.length !== request.domains.length) {
|
|
86
|
+
throw new TypeError('Schema unchanged result does not match the requested Domain count.');
|
|
87
|
+
}
|
|
88
|
+
}
|
|
28
89
|
function value(result) {
|
|
29
90
|
if (result.kind !== 'value')
|
|
30
91
|
throw new TypeError('Schema syscall returned a non-value result.');
|
|
31
92
|
return result.value;
|
|
32
93
|
}
|
|
33
94
|
function admitLimits(input) {
|
|
95
|
+
const lifecycleTimeoutMs = input?.lifecycleTimeoutMs ?? DEFAULT_SCHEMA_LIFECYCLE_TIMEOUT_MS;
|
|
34
96
|
if (input === null ||
|
|
35
97
|
typeof input !== 'object' ||
|
|
36
98
|
!Number.isSafeInteger(input.maximumPublicationBytes) ||
|
|
37
99
|
input.maximumPublicationBytes < 1 ||
|
|
38
100
|
!Number.isSafeInteger(input.maximumBundleBytes) ||
|
|
39
|
-
input.maximumBundleBytes < 1
|
|
101
|
+
input.maximumBundleBytes < 1 ||
|
|
102
|
+
!Number.isSafeInteger(lifecycleTimeoutMs) ||
|
|
103
|
+
lifecycleTimeoutMs < 1 ||
|
|
104
|
+
lifecycleTimeoutMs > 2_147_483_647) {
|
|
40
105
|
throw new TypeError('Schema introspection limits are invalid.');
|
|
41
106
|
}
|
|
42
|
-
return Object.freeze({ ...input });
|
|
107
|
+
return Object.freeze({ ...input, lifecycleTimeoutMs });
|
|
108
|
+
}
|
|
109
|
+
function lifecycleOptions(options, timeoutMs) {
|
|
110
|
+
if (options?.timeoutMs !== undefined)
|
|
111
|
+
return options;
|
|
112
|
+
return Object.freeze({ ...options, timeoutMs });
|
|
43
113
|
}
|
|
44
|
-
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { IssuerId } from '@astrale-os/kernel-core/auth';
|
|
2
|
+
import type { SchemaApi } from '../schema/index.js';
|
|
3
|
+
import type { SessionControlOptions } from './context/index.js';
|
|
4
|
+
import type { CallableReference, InputOfReference, OutputOfReference } from './reference.js';
|
|
5
|
+
import type { SessionRequestOptions } from './routing/index.js';
|
|
6
|
+
import type { ClientSession } from './session.js';
|
|
7
|
+
import type { ViewCatalog } from './views/index.js';
|
|
8
|
+
import { type AuthApi } from '../auth/index.js';
|
|
9
|
+
import { type Binary, type Call, type Input, type Result, type Stream } from '../client/index.js';
|
|
10
|
+
import { type GraphApi } from '../graph/index.js';
|
|
11
|
+
/** Exact live Session surface captured by one credential-bound Kernel view. */
|
|
12
|
+
export interface BoundSessionSource {
|
|
13
|
+
readonly kernel: IssuerId;
|
|
14
|
+
readonly schema: SchemaApi;
|
|
15
|
+
dispatch(call: Call, options?: SessionRequestOptions): Promise<Result>;
|
|
16
|
+
call(call: Call, options?: SessionRequestOptions): Promise<Input>;
|
|
17
|
+
invoke<const Reference extends CallableReference>(reference: Reference, input: InputOfReference<Reference>, options?: SessionRequestOptions): Promise<OutputOfReference<Reference>>;
|
|
18
|
+
stream(call: Call, options?: SessionRequestOptions): Promise<Stream>;
|
|
19
|
+
binary(call: Call, options?: SessionRequestOptions): Promise<Binary>;
|
|
20
|
+
viewsFor(target: Parameters<ClientSession['viewsFor']>[0], options?: SessionControlOptions): Promise<ViewCatalog>;
|
|
21
|
+
}
|
|
22
|
+
export interface BoundSessionControls {
|
|
23
|
+
readonly signal: AbortSignal;
|
|
24
|
+
/** Absolute Unix time in milliseconds. */
|
|
25
|
+
readonly deadline: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Credential-bound Kernel operations over one caller-owned ClientSession.
|
|
29
|
+
*
|
|
30
|
+
* The view owns no credential, transport, route cache, or lifecycle. Its source Session owns all of
|
|
31
|
+
* those concerns and closing that Session invalidates every operation exposed here.
|
|
32
|
+
*/
|
|
33
|
+
export interface BoundClientSession extends GraphApi {
|
|
34
|
+
readonly kernel: IssuerId;
|
|
35
|
+
readonly auth: AuthApi;
|
|
36
|
+
readonly schema: SchemaApi;
|
|
37
|
+
dispatch(call: Call, options?: SessionRequestOptions): Promise<Result>;
|
|
38
|
+
call(call: Call, options?: SessionRequestOptions): Promise<Input>;
|
|
39
|
+
invoke<const Reference extends CallableReference>(reference: Reference, input: InputOfReference<Reference>, options?: SessionRequestOptions): Promise<OutputOfReference<Reference>>;
|
|
40
|
+
stream(call: Call, options?: SessionRequestOptions): Promise<Stream>;
|
|
41
|
+
binary(call: Call, options?: SessionRequestOptions): Promise<Binary>;
|
|
42
|
+
viewsFor: BoundSessionSource['viewsFor'];
|
|
43
|
+
}
|
|
44
|
+
/** Capture one Session into the ordinary graph, auth, and invocation Kernel journey. */
|
|
45
|
+
export declare function bindSession(source: BoundSessionSource, controls?: BoundSessionControls): BoundClientSession;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { createAuth } from '../auth/index.js';
|
|
2
|
+
import { call as createCall, } from '../client/index.js';
|
|
3
|
+
import { createGraph } from '../graph/index.js';
|
|
4
|
+
/** Capture one Session into the ordinary graph, auth, and invocation Kernel journey. */
|
|
5
|
+
export function bindSession(source, controls) {
|
|
6
|
+
if (source === null || typeof source !== 'object')
|
|
7
|
+
invalid();
|
|
8
|
+
const admittedControls = admitControls(controls);
|
|
9
|
+
const dispatchSource = capture(source, 'dispatch');
|
|
10
|
+
const callSource = capture(source, 'call');
|
|
11
|
+
const invokeSource = capture(source, 'invoke');
|
|
12
|
+
const streamSource = capture(source, 'stream');
|
|
13
|
+
const binarySource = capture(source, 'binary');
|
|
14
|
+
const viewsForSource = capture(source, 'viewsFor');
|
|
15
|
+
const schemaSource = captureSchema(source.schema);
|
|
16
|
+
const dispatch = (input, options) => dispatchSource(input, requestOptions(options, admittedControls));
|
|
17
|
+
const call = (input, options) => callSource(input, requestOptions(options, admittedControls));
|
|
18
|
+
const invoke = (reference, input, options) => invokeSource(reference, input, requestOptions(options, admittedControls));
|
|
19
|
+
const stream = (input, options) => streamSource(input, requestOptions(options, admittedControls));
|
|
20
|
+
const binary = (input, options) => binarySource(input, requestOptions(options, admittedControls));
|
|
21
|
+
const viewsFor = (target, options) => viewsForSource(target, controlOptions(options, admittedControls));
|
|
22
|
+
const install = (request, options) => schemaSource.install(request, controlOptions(options, admittedControls));
|
|
23
|
+
const uninstall = (request, options) => schemaSource.uninstall(request, controlOptions(options, admittedControls));
|
|
24
|
+
const inspect = (origin, options) => schemaSource.inspect(origin, controlOptions(options, admittedControls));
|
|
25
|
+
const bundle = (origin, options) => schemaSource.bundle(origin, controlOptions(options, admittedControls));
|
|
26
|
+
const schema = Object.freeze({ install, uninstall, inspect, bundle });
|
|
27
|
+
const graph = createGraph(call);
|
|
28
|
+
const auth = createAuth((target, input, options) => call(createCall(target, input), options));
|
|
29
|
+
return Object.freeze({
|
|
30
|
+
...graph,
|
|
31
|
+
kernel: source.kernel,
|
|
32
|
+
auth,
|
|
33
|
+
schema,
|
|
34
|
+
dispatch,
|
|
35
|
+
call,
|
|
36
|
+
invoke,
|
|
37
|
+
stream,
|
|
38
|
+
binary,
|
|
39
|
+
viewsFor,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
function admitControls(input) {
|
|
43
|
+
if (input === undefined)
|
|
44
|
+
return undefined;
|
|
45
|
+
if (input === null ||
|
|
46
|
+
typeof input !== 'object' ||
|
|
47
|
+
!(input.signal instanceof AbortSignal) ||
|
|
48
|
+
!Number.isFinite(input.deadline)) {
|
|
49
|
+
invalid();
|
|
50
|
+
}
|
|
51
|
+
return Object.freeze({ signal: input.signal, deadline: input.deadline });
|
|
52
|
+
}
|
|
53
|
+
function requestOptions(options, controls) {
|
|
54
|
+
return mergeOptions(options, controls);
|
|
55
|
+
}
|
|
56
|
+
function controlOptions(options, controls) {
|
|
57
|
+
return mergeOptions(options, controls);
|
|
58
|
+
}
|
|
59
|
+
function mergeOptions(options, controls) {
|
|
60
|
+
if (controls === undefined)
|
|
61
|
+
return options;
|
|
62
|
+
if (options?.signal !== undefined && options.signal !== controls.signal) {
|
|
63
|
+
throw new TypeError('Bound ClientSession cancellation cannot be replaced.');
|
|
64
|
+
}
|
|
65
|
+
if (controls.signal.aborted)
|
|
66
|
+
throw controls.signal.reason ?? new Error('Invocation cancelled.');
|
|
67
|
+
const remaining = Math.max(1, Math.ceil(controls.deadline - Date.now()));
|
|
68
|
+
const timeoutMs = options?.timeoutMs === undefined ? remaining : Math.min(options.timeoutMs, remaining);
|
|
69
|
+
return Object.freeze({ ...options, signal: controls.signal, timeoutMs });
|
|
70
|
+
}
|
|
71
|
+
function capture(source, key) {
|
|
72
|
+
const value = source[key];
|
|
73
|
+
if (typeof value !== 'function')
|
|
74
|
+
invalid();
|
|
75
|
+
return value.bind(source);
|
|
76
|
+
}
|
|
77
|
+
function captureSchema(input) {
|
|
78
|
+
if (input === null || typeof input !== 'object')
|
|
79
|
+
invalid();
|
|
80
|
+
return Object.freeze({
|
|
81
|
+
install: capture(input, 'install'),
|
|
82
|
+
uninstall: capture(input, 'uninstall'),
|
|
83
|
+
inspect: capture(input, 'inspect'),
|
|
84
|
+
bundle: capture(input, 'bundle'),
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
function invalid() {
|
|
88
|
+
throw new TypeError('Bound ClientSession source is invalid.');
|
|
89
|
+
}
|
|
@@ -2,4 +2,3 @@ export { admitControlOptions, type SessionControlOptions } from './control.js';
|
|
|
2
2
|
export { DEFAULT_MAXIMUM_BUNDLE_BYTES, DEFAULT_MAXIMUM_PUBLICATION_BYTES, DEFAULT_MAXIMUM_RESPONSE_BYTES, DEFAULT_MAXIMUM_ROUTES, DEFAULT_TIMEOUT_MS, platformDuration, positive, } from './limits.js';
|
|
3
3
|
export { createSessionOperation, runSessionOperation, sessionTransportOptions, type SessionOperation, } from './operation.js';
|
|
4
4
|
export { admitKernel, admitPolicy, allowEndpoint, kernelInvocationEndpoint, type SessionPolicy, } from './policy.js';
|
|
5
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -2,4 +2,3 @@ export { admitControlOptions } from './control.js';
|
|
|
2
2
|
export { DEFAULT_MAXIMUM_BUNDLE_BYTES, DEFAULT_MAXIMUM_PUBLICATION_BYTES, DEFAULT_MAXIMUM_RESPONSE_BYTES, DEFAULT_MAXIMUM_ROUTES, DEFAULT_TIMEOUT_MS, platformDuration, positive, } from './limits.js';
|
|
3
3
|
export { createSessionOperation, runSessionOperation, sessionTransportOptions, } from './operation.js';
|
|
4
4
|
export { admitKernel, admitPolicy, allowEndpoint, kernelInvocationEndpoint, } from './policy.js';
|
|
5
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -5,4 +5,3 @@ export declare const DEFAULT_TIMEOUT_MS = 30000;
|
|
|
5
5
|
export declare const DEFAULT_MAXIMUM_ROUTES = 256;
|
|
6
6
|
export declare function positive(input: number, label: string): number;
|
|
7
7
|
export declare function platformDuration(input: number, label: string): number;
|
|
8
|
-
//# sourceMappingURL=limits.d.ts.map
|
|
@@ -17,4 +17,3 @@ export declare function sessionTransportOptions(operation: SessionOperation, ide
|
|
|
17
17
|
/** Settle independently of a caller capability that ignores its supplied AbortSignal. */
|
|
18
18
|
export declare function runSessionOperation<Result>(operation: SessionOperation, task: (signal: AbortSignal) => Result | PromiseLike<Result>): Promise<Result>;
|
|
19
19
|
export declare function requireSessionOperation(operation: SessionOperation): void;
|
|
20
|
-
//# sourceMappingURL=operation.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SessionError } from '../../errors/index.js';
|
|
2
2
|
/** Create one total wall-clock budget for a complete public Client Session operation. */
|
|
3
3
|
export function createSessionOperation(lifecycle, input, defaultTimeoutMs) {
|
|
4
4
|
const timeoutMs = input?.timeoutMs ?? defaultTimeoutMs;
|
|
@@ -22,7 +22,7 @@ export function remainingSessionTime(operation) {
|
|
|
22
22
|
requireSessionOperation(operation);
|
|
23
23
|
const remaining = operation.deadline - Date.now();
|
|
24
24
|
if (remaining < 1)
|
|
25
|
-
throw new
|
|
25
|
+
throw new SessionError('Session operation timed out.', { failure: 'timeout' });
|
|
26
26
|
return remaining;
|
|
27
27
|
}
|
|
28
28
|
export function sessionTransportOptions(operation, idempotencyKey) {
|
|
@@ -33,13 +33,8 @@ export function sessionTransportOptions(operation, idempotencyKey) {
|
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
35
|
/** Settle independently of a caller capability that ignores its supplied AbortSignal. */
|
|
36
|
-
export function runSessionOperation(operation, task) {
|
|
37
|
-
|
|
38
|
-
requireSessionOperation(operation);
|
|
39
|
-
}
|
|
40
|
-
catch (error) {
|
|
41
|
-
return Promise.reject(error);
|
|
42
|
-
}
|
|
36
|
+
export async function runSessionOperation(operation, task) {
|
|
37
|
+
requireSessionOperation(operation);
|
|
43
38
|
let abort;
|
|
44
39
|
const interrupted = new Promise((_resolve, reject) => {
|
|
45
40
|
abort = () => reject(sessionInterruption(operation.signal.reason));
|
|
@@ -49,9 +44,14 @@ export function runSessionOperation(operation, task) {
|
|
|
49
44
|
requireSessionOperation(operation);
|
|
50
45
|
return task(operation.signal);
|
|
51
46
|
});
|
|
52
|
-
return Promise.race([execution, interrupted])
|
|
53
|
-
|
|
54
|
-
|
|
47
|
+
return Promise.race([execution, interrupted])
|
|
48
|
+
.catch((cause) => {
|
|
49
|
+
if (operation.signal.aborted)
|
|
50
|
+
throw sessionInterruption(operation.signal.reason);
|
|
51
|
+
throw cause;
|
|
52
|
+
})
|
|
53
|
+
.finally(() => {
|
|
54
|
+
operation.signal.removeEventListener('abort', abort);
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
57
|
export function requireSessionOperation(operation) {
|
|
@@ -60,11 +60,13 @@ export function requireSessionOperation(operation) {
|
|
|
60
60
|
throw sessionInterruption(operation.signal.reason);
|
|
61
61
|
}
|
|
62
62
|
function sessionInterruption(reason) {
|
|
63
|
+
if (reason instanceof SessionError)
|
|
64
|
+
return reason;
|
|
63
65
|
if (reason instanceof DOMException && reason.name === 'TimeoutError') {
|
|
64
|
-
return new
|
|
66
|
+
return new SessionError('Session operation timed out.', { cause: reason, failure: 'timeout' });
|
|
65
67
|
}
|
|
66
|
-
return
|
|
67
|
-
|
|
68
|
-
:
|
|
68
|
+
return new SessionError('Session operation was cancelled.', {
|
|
69
|
+
cause: reason,
|
|
70
|
+
failure: 'cancelled',
|
|
71
|
+
});
|
|
69
72
|
}
|
|
70
|
-
//# sourceMappingURL=operation.js.map
|
|
@@ -9,4 +9,3 @@ export declare function admitKernel(input: string, insecure: boolean): IssuerId;
|
|
|
9
9
|
export declare function kernelInvocationEndpoint(input: IssuerId): string;
|
|
10
10
|
export declare function websocketEndpoint(input: string, insecure: boolean): string;
|
|
11
11
|
export declare function allowEndpoint(url: string, policy: Readonly<SessionPolicy>): void;
|
|
12
|
-
//# sourceMappingURL=policy.d.ts.map
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { decodeBundleValue } from '@astrale-os/kernel-protocol/publication/bundle';
|
|
2
2
|
import { ClientError } from '../../errors/index.js';
|
|
3
|
-
import { allowEndpoint
|
|
3
|
+
import { allowEndpoint } from '../context/index.js';
|
|
4
4
|
import { boundedResponse, requireExactResponse } from './publication.js';
|
|
5
|
+
import { runAcquisition } from './transport.js';
|
|
5
6
|
export class BundleDiscovery {
|
|
6
7
|
options;
|
|
7
8
|
bundles = new Map();
|
|
@@ -27,7 +28,7 @@ export class BundleDiscovery {
|
|
|
27
28
|
}
|
|
28
29
|
const href = publication.schema.bundle.href;
|
|
29
30
|
allowEndpoint(href, this.options.policy);
|
|
30
|
-
const response = await
|
|
31
|
+
const response = await runAcquisition(operation, 'bundle', 'unknown', 'Kernel bundle could not be retrieved.', (signal) => this.options.fetch(href, {
|
|
31
32
|
headers: { accept: publication.schema.bundle.ref.mediaType },
|
|
32
33
|
redirect: 'manual',
|
|
33
34
|
signal,
|
|
@@ -42,7 +43,7 @@ export class BundleDiscovery {
|
|
|
42
43
|
if (etag !== null && etag !== `"${publication.schema.bundle.ref.digest}"`) {
|
|
43
44
|
throw new ClientError('Bundle response ETag differs from its descriptor.');
|
|
44
45
|
}
|
|
45
|
-
const bytes = await
|
|
46
|
+
const bytes = await runAcquisition(operation, 'bundle', 'receive', 'Kernel bundle response could not be read.', (signal) => boundedResponse(response, publication.schema.bundle.ref.size, signal));
|
|
46
47
|
if (bytes.byteLength !== publication.schema.bundle.ref.size) {
|
|
47
48
|
throw new ClientError('Bundle artifact size differs from its descriptor.');
|
|
48
49
|
}
|
|
@@ -52,4 +53,3 @@ export class BundleDiscovery {
|
|
|
52
53
|
function bundleKey(publication) {
|
|
53
54
|
return `${new URL(publication.schema.bundle.href).origin}\u0000${publication.etag}`;
|
|
54
55
|
}
|
|
55
|
-
//# sourceMappingURL=bundle.js.map
|
|
@@ -21,4 +21,3 @@ export declare class PublicationDiscovery {
|
|
|
21
21
|
}
|
|
22
22
|
export declare function boundedResponse(response: Response, maximum: number, signal: AbortSignal): Promise<Uint8Array>;
|
|
23
23
|
export declare function requireExactResponse(response: Response, expected: string, label: string): void;
|
|
24
|
-
//# sourceMappingURL=publication.d.ts.map
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as codecs from '@astrale-os/kernel-protocol/codecs';
|
|
2
2
|
import * as publicationCodec from '@astrale-os/kernel-protocol/publication/publication';
|
|
3
3
|
import { ClientError } from '../../errors/index.js';
|
|
4
|
-
import { allowEndpoint
|
|
4
|
+
import { allowEndpoint } from '../context/index.js';
|
|
5
|
+
import { runAcquisition } from './transport.js';
|
|
5
6
|
export class PublicationDiscovery {
|
|
6
7
|
options;
|
|
7
8
|
publication;
|
|
@@ -29,7 +30,7 @@ export class PublicationDiscovery {
|
|
|
29
30
|
async fetch(operation, previous) {
|
|
30
31
|
const url = publicationCodec.url(this.options.kernel);
|
|
31
32
|
allowEndpoint(url, this.options.policy);
|
|
32
|
-
const response = await
|
|
33
|
+
const response = await runAcquisition(operation, 'publication', 'unknown', 'Kernel Publication could not be retrieved.', (signal) => this.options.fetch(url, {
|
|
33
34
|
headers: {
|
|
34
35
|
accept: 'application/json',
|
|
35
36
|
...(previous === undefined ? {} : { 'if-none-match': `"${previous.etag}"` }),
|
|
@@ -51,7 +52,7 @@ export class PublicationDiscovery {
|
|
|
51
52
|
if (!response.ok) {
|
|
52
53
|
throw new ClientError(`Publication discovery returned HTTP ${response.status}.`);
|
|
53
54
|
}
|
|
54
|
-
const body = await
|
|
55
|
+
const body = await runAcquisition(operation, 'publication', 'receive', 'Kernel Publication response could not be read.', (signal) => boundedResponse(response, this.options.maximumBytes, signal));
|
|
55
56
|
const admitted = publicationCodec.accept(codecs.json.decode(body));
|
|
56
57
|
if (admitted.identity.issuer !== this.options.kernel) {
|
|
57
58
|
throw new ClientError('Publication issuer differs from the requested Kernel issuer.');
|
|
@@ -120,4 +121,3 @@ function join(parts, length) {
|
|
|
120
121
|
}
|
|
121
122
|
return output;
|
|
122
123
|
}
|
|
123
|
-
//# sourceMappingURL=publication.js.map
|
|
@@ -10,4 +10,3 @@ export interface SessionSnapshot {
|
|
|
10
10
|
readonly views: ViewCatalog;
|
|
11
11
|
}
|
|
12
12
|
export declare function createSessionSnapshot(kernel: IssuerId, publication: publication.Publication, artifact: bundle.Bundle, views: ViewCatalog): SessionSnapshot;
|
|
13
|
-
//# sourceMappingURL=snapshot.d.ts.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { TransportPhase } from '../../errors/index.js';
|
|
2
|
+
import type { SessionOperation } from '../context/index.js';
|
|
3
|
+
type AcquisitionResource = 'publication' | 'bundle';
|
|
4
|
+
/** Normalize only unknown failures from one injected acquisition capability. */
|
|
5
|
+
export declare function runAcquisition<Result>(operation: SessionOperation, resource: AcquisitionResource, phase: Extract<TransportPhase, 'receive' | 'unknown'>, message: string, task: (signal: AbortSignal) => Result | PromiseLike<Result>): Promise<Result>;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ClientError, TransportError } from '../../errors/index.js';
|
|
2
|
+
import { runSessionOperation } from '../context/index.js';
|
|
3
|
+
/** Normalize only unknown failures from one injected acquisition capability. */
|
|
4
|
+
export async function runAcquisition(operation, resource, phase, message, task) {
|
|
5
|
+
try {
|
|
6
|
+
return await runSessionOperation(operation, task);
|
|
7
|
+
}
|
|
8
|
+
catch (cause) {
|
|
9
|
+
if (cause instanceof ClientError)
|
|
10
|
+
throw cause;
|
|
11
|
+
throw TransportError.acquisition(message, { cause, phase, resource });
|
|
12
|
+
}
|
|
13
|
+
}
|
package/dist/session/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export type { SessionControlOptions, SessionPolicy } from './context/index.js';
|
|
2
|
-
export type
|
|
2
|
+
export { bindSession, type BoundClientSession, type BoundSessionControls, type BoundSessionSource, } from './bound.js';
|
|
3
3
|
export type { SessionSnapshot } from './discovery/index.js';
|
|
4
|
-
export type { Auth, SessionAuth, SessionEnvelopeTransport, SessionRequestOptions, } from './routing/index.js';
|
|
4
|
+
export type { Auth, PersistedRoute, SessionRouteArtifact, SessionRouteStore, SessionAuth, SessionEnvelopeTransport, SessionRequestOptions, } from './routing/index.js';
|
|
5
5
|
export { ClientSession, connect, type ClientSessionOptions, type ConnectOptions, } from './session.js';
|
|
6
6
|
export type { CallableReference, InputOfReference, InstanceCallableReference, OutputOfReference, } from './reference.js';
|
|
7
|
+
export { reference } from './reference.js';
|
|
7
8
|
export type { ResolvedView, ViewCatalog } from './views/index.js';
|
|
8
|
-
|
|
9
|
+
export type { DomainBinding } from '../graph/domain/index.js';
|
package/dist/session/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { Path as PathValue, PathLike } from '@astrale-os/kernel-core/path';
|
|
2
|
-
import type {
|
|
2
|
+
import type { CallableInputOf, CallableOutputOf, CallableResultOf, Domain, MethodInheritance, ResolvedFunction, ResolvedMethod } from '@astrale-os/kernel-dsl/v1';
|
|
3
|
+
import type { Revision } from '@astrale-os/kernel-dsl/v1/addressing';
|
|
3
4
|
import { type Key as KeyType } from '@astrale-os/kernel-dsl/v1/addressing';
|
|
4
|
-
import type {
|
|
5
|
+
import type { Binary, Input } from '../client/index.js';
|
|
5
6
|
declare const REFERENCE_INPUT: unique symbol;
|
|
6
7
|
declare const REFERENCE_OUTPUT: unique symbol;
|
|
7
8
|
export interface CallableReference<InputValue extends Input = Input, Output = unknown> {
|
|
@@ -9,7 +10,7 @@ export interface CallableReference<InputValue extends Input = Input, Output = un
|
|
|
9
10
|
readonly revision: Revision;
|
|
10
11
|
readonly callable: KeyType.Callable;
|
|
11
12
|
readonly target: PathValue;
|
|
12
|
-
readonly outputMode:
|
|
13
|
+
readonly outputMode: 'value' | 'stream' | 'binary';
|
|
13
14
|
readonly [REFERENCE_INPUT]?: InputValue;
|
|
14
15
|
readonly [REFERENCE_OUTPUT]?: Output;
|
|
15
16
|
}
|
|
@@ -18,10 +19,18 @@ export interface InstanceCallableReference<InputValue extends Input = Input, Out
|
|
|
18
19
|
readonly origin: KeyType.Origin;
|
|
19
20
|
readonly revision: Revision;
|
|
20
21
|
readonly callable: KeyType.Callable;
|
|
21
|
-
readonly outputMode:
|
|
22
|
+
readonly outputMode: 'value' | 'stream' | 'binary';
|
|
22
23
|
}
|
|
23
24
|
export type InputOfReference<Reference extends CallableReference> = Reference extends CallableReference<infer InputValue, unknown> ? InputValue : never;
|
|
24
25
|
export type OutputOfReference<Reference extends CallableReference> = Reference extends CallableReference<infer _Input, infer Output> ? Output : never;
|
|
26
|
+
type ReferenceInput<Callable> = unknown extends CallableInputOf<Callable> ? Input : Extract<CallableInputOf<Callable>, Input>;
|
|
27
|
+
type ReferenceOutput<Callable> = unknown extends CallableOutputOf<Callable> ? unknown : CallableResultOf<Callable, Binary>;
|
|
28
|
+
type ExecutableMethodInheritance = Exclude<MethodInheritance, 'abstract'>;
|
|
29
|
+
type ExecutableStaticMethod = ResolvedMethod<unknown, unknown, true, ExecutableMethodInheritance>;
|
|
30
|
+
type ExecutableInstanceMethod = ResolvedMethod<unknown, unknown, false, ExecutableMethodInheritance>;
|
|
31
|
+
/** Project one exact resolved Function or static Method into a typed Client reference. */
|
|
32
|
+
export declare function reference<const Callable extends ResolvedFunction | ExecutableStaticMethod>(domain: Pick<Domain, 'origin' | 'revision'>, callable: Callable): CallableReference<ReferenceInput<Callable>, ReferenceOutput<Callable>>;
|
|
33
|
+
/** Project one exact resolved instance Method into a receiver-bound typed Client reference. */
|
|
34
|
+
export declare function reference<const Callable extends ExecutableInstanceMethod>(domain: Pick<Domain, 'origin' | 'revision'>, callable: Callable): InstanceCallableReference<ReferenceInput<Callable>, ReferenceOutput<Callable>>;
|
|
25
35
|
export declare function admitReference(input: CallableReference): CallableReference;
|
|
26
36
|
export {};
|
|
27
|
-
//# sourceMappingURL=reference.d.ts.map
|