@astrale-os/kernel-client 0.6.0-beta.7 → 0.6.0-beta.71
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 +25 -10
- package/dist/auth/auth.js +5 -7
- package/dist/auth/authorization.d.ts +6 -4
- package/dist/auth/authorization.js +25 -6
- package/dist/auth/credential.d.ts +5 -1
- package/dist/auth/credential.js +6 -3
- package/dist/auth/identity.d.ts +6 -9
- package/dist/auth/identity.js +0 -1
- package/dist/auth/index.d.ts +4 -5
- package/dist/auth/index.js +2 -4
- package/dist/auth/register.d.ts +24 -0
- package/dist/auth/register.js +10 -0
- package/dist/client/admission.d.ts +4 -2
- package/dist/client/admission.js +8 -2
- 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 +3 -3
- package/dist/client/request.js +3 -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 +147 -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 +124 -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 +2 -2
- package/dist/index.js +2 -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 +13 -10
- package/dist/schema/schema.js +83 -11
- package/dist/session/admission.d.ts +18 -0
- package/dist/session/admission.js +117 -0
- package/dist/session/bound.d.ts +46 -0
- package/dist/session/bound.js +93 -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/credential/index.d.ts +1 -0
- package/dist/session/credential/index.js +1 -0
- package/dist/session/credential/limits.d.ts +12 -0
- package/dist/session/credential/limits.js +12 -0
- package/dist/session/credential/provider.d.ts +51 -0
- package/dist/session/credential/provider.js +229 -0
- package/dist/session/discovery/bundle.d.ts +5 -2
- package/dist/session/discovery/bundle.js +34 -15
- package/dist/session/discovery/discovery.d.ts +4 -2
- package/dist/session/discovery/discovery.js +34 -6
- package/dist/session/discovery/index.d.ts +3 -1
- package/dist/session/discovery/index.js +1 -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 +5 -3
- package/dist/session/index.js +3 -1
- package/dist/session/reference.d.ts +24 -10
- package/dist/session/reference.js +39 -11
- package/dist/session/routing/auth.d.ts +0 -1
- package/dist/session/routing/auth.js +0 -1
- package/dist/session/routing/cache.d.ts +27 -8
- package/dist/session/routing/cache.js +218 -25
- package/dist/session/routing/dispatch.d.ts +3 -7
- package/dist/session/routing/dispatch.js +53 -28
- package/dist/session/routing/envelope.d.ts +2 -1
- package/dist/session/routing/envelope.js +14 -10
- package/dist/session/routing/index.d.ts +1 -3
- 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 +18 -7
- package/dist/session/session.js +77 -33
- package/dist/session/session.typecheck.d.ts +0 -1
- package/dist/session/session.typecheck.js +103 -3
- package/dist/session/views/catalog.d.ts +0 -1
- package/dist/session/views/catalog.js +14 -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 +38 -15
- package/dist/store/mutation.d.ts +1 -2
- package/dist/store/mutation.js +6 -4
- package/dist/store/observe.d.ts +0 -1
- package/dist/store/observe.js +0 -1
- package/dist/store/optimistic.d.ts +0 -1
- package/dist/store/optimistic.js +0 -1
- package/dist/store/query-key.d.ts +2 -2
- package/dist/store/query-key.js +7 -3
- package/dist/store/shape.d.ts +4 -2
- package/dist/store/shape.js +4 -2
- package/dist/store/store.d.ts +2 -4
- package/dist/store/store.js +6 -5
- package/dist/store/store.typecheck.d.ts +0 -1
- package/dist/store/store.typecheck.js +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 +2 -2
- package/dist/transport/auto/fallback.js +10 -11
- 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 -20
- 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 +0 -9
- package/dist/auth/provision.d.ts.map +0 -1
- package/dist/auth/provision.js +0 -11
- package/dist/auth/provision.js.map +0 -1
- package/dist/client/admission.d.ts.map +0 -1
- package/dist/client/admission.js.map +0 -1
- package/dist/client/client.d.ts.map +0 -1
- package/dist/client/client.js.map +0 -1
- package/dist/client/credential.d.ts.map +0 -1
- package/dist/client/credential.js.map +0 -1
- package/dist/client/index.d.ts.map +0 -1
- package/dist/client/index.js.map +0 -1
- package/dist/client/request.d.ts.map +0 -1
- package/dist/client/request.js.map +0 -1
- package/dist/client/result.d.ts.map +0 -1
- package/dist/client/result.js.map +0 -1
- package/dist/client/routing-control.d.ts.map +0 -1
- package/dist/client/routing-control.js.map +0 -1
- package/dist/errors/client-error.d.ts.map +0 -1
- package/dist/errors/client-error.js.map +0 -1
- package/dist/errors/index.d.ts.map +0 -1
- package/dist/errors/index.js.map +0 -1
- package/dist/errors/miss-error.d.ts.map +0 -1
- package/dist/errors/miss-error.js.map +0 -1
- package/dist/errors/protocol-error.d.ts.map +0 -1
- package/dist/errors/protocol-error.js.map +0 -1
- package/dist/errors/response-error.d.ts.map +0 -1
- package/dist/errors/response-error.js.map +0 -1
- package/dist/errors/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 +0 -7
- package/dist/session/routing/expectation.d.ts.map +0 -1
- package/dist/session/routing/expectation.js +0 -2
- package/dist/session/routing/expectation.js.map +0 -1
- package/dist/session/routing/index.d.ts.map +0 -1
- package/dist/session/routing/index.js.map +0 -1
- package/dist/session/routing/request.d.ts.map +0 -1
- package/dist/session/routing/request.js.map +0 -1
- package/dist/session/session.d.ts.map +0 -1
- package/dist/session/session.js.map +0 -1
- package/dist/session/session.typecheck.d.ts.map +0 -1
- package/dist/session/session.typecheck.js.map +0 -1
- package/dist/session/views/catalog.d.ts.map +0 -1
- package/dist/session/views/catalog.js.map +0 -1
- package/dist/session/views/index.d.ts.map +0 -1
- package/dist/session/views/index.js.map +0 -1
- package/dist/session/views/resolve.d.ts.map +0 -1
- package/dist/session/views/resolve.js.map +0 -1
- package/dist/store/entity-index.d.ts.map +0 -1
- package/dist/store/entity-index.js.map +0 -1
- package/dist/store/index.d.ts.map +0 -1
- package/dist/store/index.js.map +0 -1
- package/dist/store/memory.d.ts.map +0 -1
- package/dist/store/memory.js.map +0 -1
- package/dist/store/mutation.d.ts.map +0 -1
- package/dist/store/mutation.js.map +0 -1
- package/dist/store/observe.d.ts.map +0 -1
- package/dist/store/observe.js.map +0 -1
- package/dist/store/optimistic.d.ts.map +0 -1
- package/dist/store/optimistic.js.map +0 -1
- package/dist/store/query-key.d.ts.map +0 -1
- package/dist/store/query-key.js.map +0 -1
- package/dist/store/shape.d.ts.map +0 -1
- package/dist/store/shape.js.map +0 -1
- package/dist/store/store.d.ts.map +0 -1
- package/dist/store/store.js.map +0 -1
- package/dist/store/store.typecheck.d.ts.map +0 -1
- package/dist/store/store.typecheck.js.map +0 -1
- package/dist/transport/auto/decision.d.ts.map +0 -1
- package/dist/transport/auto/decision.js.map +0 -1
- package/dist/transport/auto/fallback.d.ts.map +0 -1
- package/dist/transport/auto/fallback.js.map +0 -1
- package/dist/transport/auto/index.d.ts.map +0 -1
- package/dist/transport/auto/index.js.map +0 -1
- package/dist/transport/auto/transport.d.ts.map +0 -1
- package/dist/transport/auto/transport.js.map +0 -1
- package/dist/transport/auto/warning.d.ts.map +0 -1
- package/dist/transport/auto/warning.js.map +0 -1
- package/dist/transport/deadline.d.ts.map +0 -1
- package/dist/transport/deadline.js.map +0 -1
- package/dist/transport/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,30 +1,39 @@
|
|
|
1
|
+
import { Key } from '@astrale-os/kernel-dsl/v1/addressing';
|
|
1
2
|
import * as invocationProtocol from '@astrale-os/kernel-protocol/invocation';
|
|
2
3
|
import { acceptCall, dispatchTrace, isAdmittedMissError, isAdmittedStaleRouteError, } from '../../client/index.js';
|
|
3
4
|
import { ClientError, ResponseError } from '../../errors/index.js';
|
|
4
5
|
import { runSessionOperation, sessionTransportOptions, allowEndpoint } from '../context/index.js';
|
|
5
6
|
import { resolveAuth } from './auth.js';
|
|
6
|
-
import { selectEnvelope } from './envelope.js';
|
|
7
|
+
import { selectEnvelope, selectEnvelopeTarget } from './envelope.js';
|
|
7
8
|
export class SessionDispatcher {
|
|
8
9
|
state;
|
|
9
10
|
constructor(state) {
|
|
10
11
|
this.state = state;
|
|
11
12
|
}
|
|
12
|
-
async dispatch(input, options, operation
|
|
13
|
+
async dispatch(input, options, operation) {
|
|
13
14
|
this.state.requireOpen();
|
|
14
15
|
const call = acceptCall(input);
|
|
15
16
|
// Authority is resolved before warm lookup so changed credentials or delegation cannot reuse a
|
|
16
17
|
// carrier minted for a different caller partition.
|
|
17
18
|
const auth = await resolveAuth(this.state.auth, call, operation);
|
|
18
|
-
const source =
|
|
19
|
-
const cacheKey = await this.state.cache.key(source
|
|
19
|
+
const source = this.state.kernel;
|
|
20
|
+
const cacheKey = await this.state.cache.key(source, call, auth);
|
|
20
21
|
const dispatch = Object.freeze({
|
|
21
22
|
call,
|
|
22
23
|
auth,
|
|
23
24
|
source,
|
|
24
25
|
cacheKey,
|
|
25
|
-
...(expected === undefined ? {} : { expected }),
|
|
26
26
|
});
|
|
27
|
-
|
|
27
|
+
let learned = await this.state.cache.get(cacheKey, auth.credential);
|
|
28
|
+
if (learned !== undefined) {
|
|
29
|
+
try {
|
|
30
|
+
requireCachedRoute(learned, source, call.target, this.state.envelopeTransport, this.state.websocketAvailable, this.state.policy);
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
this.state.cache.delete(cacheKey);
|
|
34
|
+
learned = undefined;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
28
37
|
if (learned !== undefined) {
|
|
29
38
|
return this.dispatchDestinationWithRecovery(learned, dispatch, options, operation);
|
|
30
39
|
}
|
|
@@ -39,23 +48,22 @@ export class SessionDispatcher {
|
|
|
39
48
|
...sessionTransportOptions(operation, options.idempotencyKey),
|
|
40
49
|
...(state.auth.delegate === undefined ? {} : { delegate: state.auth.delegate }),
|
|
41
50
|
...(routing === undefined ? {} : { routing }),
|
|
42
|
-
...(state.expected === undefined ? {} : { schema: { revision: state.expected.revision } }),
|
|
43
51
|
}));
|
|
44
52
|
}
|
|
45
53
|
async followSource(result, state, options, operation) {
|
|
46
54
|
if (result.kind !== 'redirect')
|
|
47
55
|
return result;
|
|
48
56
|
const redirect = result.redirect;
|
|
49
|
-
if (redirect.route.via.issuer !== state.source
|
|
57
|
+
if (redirect.route.via.issuer !== state.source) {
|
|
50
58
|
throw new ClientError('Redirect issuer differs from the session-pinned source Kernel identity.');
|
|
51
59
|
}
|
|
52
|
-
|
|
53
|
-
const learned = this.state.cache.learn(state.cacheKey, redirect.route, redirect.credential);
|
|
60
|
+
requireTargetPublication(redirect.route, state.call.target);
|
|
61
|
+
const learned = await this.state.cache.learn(state.cacheKey, redirect.route, redirect.credential, state.auth.credential);
|
|
54
62
|
return this.dispatchDestinationWithRecovery(learned, state, options, operation, redirect.trace);
|
|
55
63
|
}
|
|
56
64
|
async dispatchDestinationWithRecovery(learned, state, options, operation, trace) {
|
|
57
65
|
try {
|
|
58
|
-
return await this.dispatchDestination(learned, state.call, options, operation, state.
|
|
66
|
+
return await this.dispatchDestination(learned, state.call, options, operation, state.source, trace);
|
|
59
67
|
}
|
|
60
68
|
catch (cause) {
|
|
61
69
|
const stale = isAdmittedStaleRouteError(cause);
|
|
@@ -79,31 +87,45 @@ export class SessionDispatcher {
|
|
|
79
87
|
return this.followSource(refreshed, state, options, operation);
|
|
80
88
|
}
|
|
81
89
|
}
|
|
82
|
-
async dispatchDestination(learned, call, options, operation,
|
|
83
|
-
if (learned.route.via.issuer !==
|
|
90
|
+
async dispatchDestination(learned, call, options, operation, source, trace) {
|
|
91
|
+
if (learned.route.via.issuer !== source) {
|
|
84
92
|
throw new ClientError('Learned route issuer differs from the session-pinned source Kernel.');
|
|
85
93
|
}
|
|
86
|
-
|
|
94
|
+
requireTargetPublication(learned.route, call.target);
|
|
87
95
|
const envelope = selectEnvelope(learned.route.endpoint, this.state.envelopeTransport, this.state.websocketAvailable, this.state.pool, this.state.policy);
|
|
88
96
|
const requestOptions = {
|
|
89
97
|
...sessionTransportOptions(operation, options.idempotencyKey),
|
|
90
98
|
routing: learned.route.via,
|
|
91
99
|
};
|
|
100
|
+
// The source has admitted this fingerprint against the exact Publication carried by Via.
|
|
101
|
+
// Pin that revision at the destination so existing Workers can execute the same admitted
|
|
102
|
+
// callable without understanding the newer fingerprint Target representation. The cache
|
|
103
|
+
// remains partitioned by the original fingerprint, and stale recovery re-admits it at source.
|
|
104
|
+
const destinationCall = typeof call.target !== 'string' && call.target.fingerprint !== undefined
|
|
105
|
+
? {
|
|
106
|
+
...call,
|
|
107
|
+
target: invocationProtocol.Target({
|
|
108
|
+
callable: call.target.callable,
|
|
109
|
+
revision: learned.route.via.publication.revision,
|
|
110
|
+
...(call.target.instance === undefined ? {} : { instance: call.target.instance }),
|
|
111
|
+
}),
|
|
112
|
+
}
|
|
113
|
+
: call;
|
|
92
114
|
const result = await runSessionOperation(operation, () => trace === undefined
|
|
93
|
-
? authenticated(envelope.client, learned.credential).dispatch(
|
|
94
|
-
: dispatchTrace(envelope.client, learned.credential,
|
|
115
|
+
? authenticated(envelope.client, learned.credential).dispatch(destinationCall, requestOptions)
|
|
116
|
+
: dispatchTrace(envelope.client, learned.credential, destinationCall, requestOptions, trace));
|
|
95
117
|
if (result.kind === 'redirect') {
|
|
96
118
|
throw new ClientError('A destination redirect is invalid; only the source Kernel may redirect.');
|
|
97
119
|
}
|
|
98
120
|
return result;
|
|
99
121
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
105
|
-
return Object.freeze({ issuer: snapshot.publication.identity.issuer });
|
|
122
|
+
}
|
|
123
|
+
function requireCachedRoute(learned, source, target, envelopeTransport, websocketAvailable, policy) {
|
|
124
|
+
if (learned.route.via.issuer !== source) {
|
|
125
|
+
throw new ClientError('Learned route issuer differs from the session-pinned source Kernel.');
|
|
106
126
|
}
|
|
127
|
+
requireTargetPublication(learned.route, target);
|
|
128
|
+
selectEnvelopeTarget(learned.route.endpoint, envelopeTransport, websocketAvailable, policy);
|
|
107
129
|
}
|
|
108
130
|
function isRouteCompatibilityConflict(input) {
|
|
109
131
|
if (!(input instanceof ResponseError))
|
|
@@ -113,15 +135,16 @@ function isRouteCompatibilityConflict(input) {
|
|
|
113
135
|
message: input.message,
|
|
114
136
|
...(input.data === undefined ? {} : { data: input.data }),
|
|
115
137
|
});
|
|
116
|
-
return (failure?.data.code === invocationProtocol.
|
|
117
|
-
failure?.data.code === invocationProtocol.
|
|
138
|
+
return (failure?.data.code === invocationProtocol.SCHEMA_REVISION_MISMATCH ||
|
|
139
|
+
failure?.data.code === invocationProtocol.CALLABLE_FINGERPRINT_MISMATCH ||
|
|
118
140
|
failure?.data.code === invocationProtocol.SERVICE_TRUST_REQUIRED);
|
|
119
141
|
}
|
|
120
|
-
function
|
|
121
|
-
if (
|
|
142
|
+
function requireTargetPublication(route, target) {
|
|
143
|
+
if (typeof target === 'string')
|
|
122
144
|
return;
|
|
123
145
|
const actual = route.via.publication;
|
|
124
|
-
if (actual.origin !==
|
|
146
|
+
if (actual.origin !== Key.origin(target.callable) ||
|
|
147
|
+
(target.revision !== undefined && actual.revision !== target.revision)) {
|
|
125
148
|
throw new ClientError('Resolved route does not match the expected Schema revision.');
|
|
126
149
|
}
|
|
127
150
|
}
|
|
@@ -130,9 +153,11 @@ export function requireResultKind(expected, result) {
|
|
|
130
153
|
return result;
|
|
131
154
|
if (result.kind === 'stream')
|
|
132
155
|
void result.stream.cancel(`Expected ${expected} result.`);
|
|
156
|
+
if (result.kind === 'binary' && !(result.value.body instanceof Uint8Array)) {
|
|
157
|
+
void result.value.body[Symbol.asyncIterator]().return?.();
|
|
158
|
+
}
|
|
133
159
|
throw new ClientError(`Function returned ${result.kind}; ${expected} was required.`);
|
|
134
160
|
}
|
|
135
161
|
function authenticated(client, credential) {
|
|
136
162
|
return credential === undefined ? client : client.as(credential);
|
|
137
163
|
}
|
|
138
|
-
//# sourceMappingURL=dispatch.js.map
|
|
@@ -11,4 +11,5 @@ export interface EnvelopeSelection {
|
|
|
11
11
|
readonly destination: ClientTarget;
|
|
12
12
|
}
|
|
13
13
|
export declare function selectEnvelope(endpoints: publication.InvocationEndpoints, preference: SessionEnvelopeTransport, websocketAvailable: boolean, pool: ClientPoolCapability, policy: Readonly<SessionPolicy>): EnvelopeSelection;
|
|
14
|
-
|
|
14
|
+
/** Resolve and admit one route endpoint without acquiring a transport Client. */
|
|
15
|
+
export declare function selectEnvelopeTarget(endpoints: publication.InvocationEndpoints, preference: SessionEnvelopeTransport, websocketAvailable: boolean, policy: Readonly<SessionPolicy>): ClientTarget;
|
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
import { ClientError } from '../../errors/index.js';
|
|
2
2
|
import { allowEndpoint } from '../context/index.js';
|
|
3
3
|
export function selectEnvelope(endpoints, preference, websocketAvailable, pool, policy) {
|
|
4
|
+
const destination = selectEnvelopeTarget(endpoints, preference, websocketAvailable, policy);
|
|
5
|
+
const client = pool.clientFor(destination);
|
|
6
|
+
if (client === null ||
|
|
7
|
+
typeof client !== 'object' ||
|
|
8
|
+
typeof client.dispatch !== 'function' ||
|
|
9
|
+
typeof client.as !== 'function' ||
|
|
10
|
+
typeof client.close !== 'function') {
|
|
11
|
+
throw new TypeError('Session client pool capability returned an invalid Client.');
|
|
12
|
+
}
|
|
13
|
+
return Object.freeze({ client, destination });
|
|
14
|
+
}
|
|
15
|
+
/** Resolve and admit one route endpoint without acquiring a transport Client. */
|
|
16
|
+
export function selectEnvelopeTarget(endpoints, preference, websocketAvailable, policy) {
|
|
4
17
|
let destination;
|
|
5
18
|
if (preference === 'websocket') {
|
|
6
19
|
if (endpoints.websocket === undefined) {
|
|
@@ -23,14 +36,5 @@ export function selectEnvelope(endpoints, preference, websocketAvailable, pool,
|
|
|
23
36
|
allowEndpoint(endpoints.http, policy);
|
|
24
37
|
destination = Object.freeze({ transport: 'http', url: endpoints.http });
|
|
25
38
|
}
|
|
26
|
-
|
|
27
|
-
if (client === null ||
|
|
28
|
-
typeof client !== 'object' ||
|
|
29
|
-
typeof client.dispatch !== 'function' ||
|
|
30
|
-
typeof client.as !== 'function' ||
|
|
31
|
-
typeof client.close !== 'function') {
|
|
32
|
-
throw new TypeError('Session client pool capability returned an invalid Client.');
|
|
33
|
-
}
|
|
34
|
-
return Object.freeze({ client, destination });
|
|
39
|
+
return destination;
|
|
35
40
|
}
|
|
36
|
-
//# sourceMappingURL=envelope.js.map
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
export { admitSessionAuth, resolveAuth, type Auth, type EffectiveAuth, type SessionAuth, } from './auth.js';
|
|
2
|
-
export type
|
|
3
|
-
export { RouteCache, type LearnedRoute } from './cache.js';
|
|
2
|
+
export { RouteCache, type LearnedRoute, type PersistedRoute, type SessionRouteArtifact, type SessionRouteStore, } from './cache.js';
|
|
4
3
|
export { requireResultKind, SessionDispatcher, type SessionDispatcherOptions } from './dispatch.js';
|
|
5
4
|
export { type ClientPoolCapability, type EnvelopeSelection } from './envelope.js';
|
|
6
5
|
export { admitEnvelopeTransport, admitRequestOptions, type SessionEnvelopeTransport, type SessionRequestOptions, } from './request.js';
|
|
7
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export { admitSessionAuth, resolveAuth, } from './auth.js';
|
|
2
|
-
export { RouteCache } from './cache.js';
|
|
2
|
+
export { RouteCache, } from './cache.js';
|
|
3
3
|
export { requireResultKind, SessionDispatcher } from './dispatch.js';
|
|
4
4
|
export {} from './envelope.js';
|
|
5
5
|
export { admitEnvelopeTransport, admitRequestOptions, } from './request.js';
|
|
6
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -6,4 +6,3 @@ export interface SessionRequestOptions extends SessionControlOptions {
|
|
|
6
6
|
}
|
|
7
7
|
export declare function admitRequestOptions(input?: SessionRequestOptions): Readonly<SessionRequestOptions>;
|
|
8
8
|
export declare function admitEnvelopeTransport(input: SessionEnvelopeTransport): SessionEnvelopeTransport;
|
|
9
|
-
//# sourceMappingURL=request.d.ts.map
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import type { IssuerId } from '@astrale-os/kernel-core/auth/issuer';
|
|
2
2
|
import type { PathLike } from '@astrale-os/kernel-core/path';
|
|
3
|
-
import type {
|
|
3
|
+
import type { Domain } from '@astrale-os/kernel-dsl/v1/domain';
|
|
4
|
+
import type { publication } from '@astrale-os/kernel-protocol';
|
|
5
|
+
import type { AuthApi } from '../auth/index.js';
|
|
4
6
|
import type { Call, Input, Result } from '../client/index.js';
|
|
7
|
+
import type { DomainBinding, GraphApi } from '../graph/index.js';
|
|
5
8
|
import type { ClientFactory, ClientPool as ClientPoolType } from '../pool/index.js';
|
|
6
|
-
import type {
|
|
9
|
+
import type { SchemaApi } from '../schema/index.js';
|
|
7
10
|
import type { ClientWarning } from '../transport/auto/index.js';
|
|
8
11
|
import type { Fetch } from '../transport/http/index.js';
|
|
9
12
|
import type { WebSocketConstructor } from '../transport/websocket/index.js';
|
|
10
13
|
import type { SessionControlOptions, SessionPolicy } from './context/index.js';
|
|
11
14
|
import type { SessionSnapshot } from './discovery/index.js';
|
|
12
15
|
import type { CallableReference, InputOfReference, OutputOfReference } from './reference.js';
|
|
13
|
-
import type { SessionAuth, SessionEnvelopeTransport, SessionRequestOptions } from './routing/index.js';
|
|
16
|
+
import type { SessionRouteStore, SessionAuth, SessionEnvelopeTransport, SessionRequestOptions } from './routing/index.js';
|
|
14
17
|
import type { ViewCatalog } from './views/index.js';
|
|
15
18
|
export interface ClientSessionOptions {
|
|
16
19
|
/** Exact canonical source Kernel identity; its invocation and discovery endpoints are derived. */
|
|
@@ -20,6 +23,8 @@ export interface ClientSessionOptions {
|
|
|
20
23
|
readonly pool?: Pick<ClientPoolType, 'clientFor'>;
|
|
21
24
|
readonly websocket?: WebSocketConstructor;
|
|
22
25
|
readonly auth?: SessionAuth;
|
|
26
|
+
/** Optional caller-owned persistence for bounded confidential route artifacts. */
|
|
27
|
+
readonly routeStore?: SessionRouteStore;
|
|
23
28
|
readonly policy: SessionPolicy;
|
|
24
29
|
readonly envelopeTransport?: SessionEnvelopeTransport;
|
|
25
30
|
readonly onWarning?: (warning: ClientWarning) => void;
|
|
@@ -27,6 +32,7 @@ export interface ClientSessionOptions {
|
|
|
27
32
|
readonly maximumBundleBytes?: number;
|
|
28
33
|
readonly maximumResponseBytes?: number;
|
|
29
34
|
readonly timeoutMs?: number;
|
|
35
|
+
readonly schemaLifecycleTimeoutMs?: number;
|
|
30
36
|
}
|
|
31
37
|
export type ConnectOptions = Omit<ClientSessionOptions, 'kernel' | 'policy'> & {
|
|
32
38
|
readonly url: string;
|
|
@@ -36,6 +42,8 @@ export type ConnectOptions = Omit<ClientSessionOptions, 'kernel' | 'policy'> & {
|
|
|
36
42
|
export declare class ClientSession {
|
|
37
43
|
readonly kernel: IssuerId;
|
|
38
44
|
readonly schema: SchemaApi;
|
|
45
|
+
readonly graph: GraphApi;
|
|
46
|
+
readonly auth: AuthApi;
|
|
39
47
|
private readonly ownedPool?;
|
|
40
48
|
private readonly discovery;
|
|
41
49
|
private readonly dispatcher;
|
|
@@ -45,18 +53,21 @@ export declare class ClientSession {
|
|
|
45
53
|
private readonly admitTargetViews;
|
|
46
54
|
private closed;
|
|
47
55
|
constructor(options: ClientSessionOptions);
|
|
56
|
+
/** Bind one admitted DSL Domain to authenticated graph projection and Method dispatch. */
|
|
57
|
+
bind<const DomainValue extends Domain>(domain: DomainValue): DomainBinding<DomainValue>;
|
|
58
|
+
/** Revalidate the intrinsic Publication without acquiring its bundle or Views. */
|
|
59
|
+
publication(options?: SessionControlOptions): Promise<publication.Publication>;
|
|
48
60
|
snapshot(options?: SessionControlOptions): Promise<SessionSnapshot>;
|
|
49
61
|
viewsFor(target: PathLike, options?: SessionControlOptions): Promise<ViewCatalog>;
|
|
50
|
-
installation(origin: Key.Origin, options?: SessionControlOptions): Promise<ReadyInstallation>;
|
|
51
62
|
dispatch(call: Call, options?: SessionRequestOptions): Promise<Result>;
|
|
52
63
|
call(call: Call, options?: SessionRequestOptions): Promise<Input>;
|
|
53
|
-
invoke<const Reference extends CallableReference
|
|
64
|
+
invoke<const Reference extends CallableReference<unknown>>(reference: Reference, input: InputOfReference<Reference>, options?: SessionRequestOptions): Promise<OutputOfReference<Reference>>;
|
|
54
65
|
stream(call: Call, options?: SessionRequestOptions): Promise<import("../client/result.js").Stream>;
|
|
55
|
-
binary(call: Call, options?: SessionRequestOptions): Promise<import("@astrale-os/kernel-core/
|
|
66
|
+
binary(call: Call, options?: SessionRequestOptions): Promise<import("@astrale-os/kernel-core/callable").BinaryOutput>;
|
|
56
67
|
close(): void;
|
|
57
68
|
private requireOpen;
|
|
69
|
+
private invokeDomainMethod;
|
|
58
70
|
private operation;
|
|
59
71
|
}
|
|
60
72
|
/** Open one caller-owned conversation with a Kernel using secure defaults. */
|
|
61
73
|
export declare function connect(options: ConnectOptions): ClientSession;
|
|
62
|
-
//# sourceMappingURL=session.d.ts.map
|
package/dist/session/session.js
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Path } from '@astrale-os/kernel-core/path';
|
|
2
|
+
import { callableFingerprint } from '@astrale-os/kernel-dsl/v1/schema/fingerprint';
|
|
3
|
+
import { createAuth } from '../auth/auth.js';
|
|
4
|
+
import { Client, acceptCall } from '../client/index.js';
|
|
5
|
+
import { SessionError } from '../errors/index.js';
|
|
6
|
+
import { createDomainBinding } from '../graph/domain/binding.js';
|
|
7
|
+
import { createGraph } from '../graph/index.js';
|
|
3
8
|
import { ClientPool } from '../pool/index.js';
|
|
4
|
-
import { createSchema } from '../schema/index.js';
|
|
9
|
+
import { createSchema, DEFAULT_SCHEMA_LIFECYCLE_TIMEOUT_MS } from '../schema/index.js';
|
|
5
10
|
import { AutoTransport } from '../transport/auto/index.js';
|
|
6
11
|
import { HttpTransport } from '../transport/http/index.js';
|
|
7
12
|
import { WebSocketTransport } from '../transport/websocket/index.js';
|
|
8
|
-
import {
|
|
13
|
+
import { admitFunction } from './admission.js';
|
|
14
|
+
import { admitControlOptions, admitPolicy, createSessionOperation, DEFAULT_MAXIMUM_BUNDLE_BYTES, DEFAULT_MAXIMUM_PUBLICATION_BYTES, DEFAULT_MAXIMUM_RESPONSE_BYTES, DEFAULT_TIMEOUT_MS, admitKernel, allowEndpoint, kernelInvocationEndpoint, platformDuration, positive, } from './context/index.js';
|
|
9
15
|
import { createSessionDiscovery } from './discovery/index.js';
|
|
10
16
|
import { admitReference } from './reference.js';
|
|
11
17
|
import { admitEnvelopeTransport, admitRequestOptions, admitSessionAuth, requireResultKind, RouteCache, SessionDispatcher, } from './routing/index.js';
|
|
@@ -15,6 +21,8 @@ const DEFAULT_SESSION_POLICY = Object.freeze({ maximumRouteAgeMs: 60_000 });
|
|
|
15
21
|
export class ClientSession {
|
|
16
22
|
kernel;
|
|
17
23
|
schema;
|
|
24
|
+
graph;
|
|
25
|
+
auth;
|
|
18
26
|
ownedPool;
|
|
19
27
|
discovery;
|
|
20
28
|
dispatcher;
|
|
@@ -42,11 +50,12 @@ export class ClientSession {
|
|
|
42
50
|
const maximumBundleBytes = positive(options.maximumBundleBytes ?? DEFAULT_MAXIMUM_BUNDLE_BYTES, 'maximumBundleBytes');
|
|
43
51
|
const maximumResponseBytes = positive(options.maximumResponseBytes ?? DEFAULT_MAXIMUM_RESPONSE_BYTES, 'maximumResponseBytes');
|
|
44
52
|
const timeoutMs = platformDuration(options.timeoutMs ?? DEFAULT_TIMEOUT_MS, 'timeoutMs');
|
|
53
|
+
const schemaLifecycleTimeoutMs = platformDuration(options.schemaLifecycleTimeoutMs ?? DEFAULT_SCHEMA_LIFECYCLE_TIMEOUT_MS, 'schemaLifecycleTimeoutMs');
|
|
45
54
|
this.timeoutMs = timeoutMs;
|
|
46
55
|
const websocketAvailable = options.client !== undefined ||
|
|
47
56
|
options.pool !== undefined ||
|
|
48
57
|
options.websocket !== undefined ||
|
|
49
|
-
typeof
|
|
58
|
+
typeof WebSocket === 'function';
|
|
50
59
|
const client = options.client ??
|
|
51
60
|
defaultClientFactory({
|
|
52
61
|
fetch: fetchImpl,
|
|
@@ -73,24 +82,50 @@ export class ClientSession {
|
|
|
73
82
|
requireOpen: () => this.requireOpen(),
|
|
74
83
|
acquisitionOperation: () => this.operation(undefined),
|
|
75
84
|
});
|
|
76
|
-
this.routes = new RouteCache(policy.maximumRouteAgeMs);
|
|
85
|
+
this.routes = new RouteCache(policy.maximumRouteAgeMs, undefined, options.routeStore);
|
|
86
|
+
const auth = admitSessionAuth(options.auth);
|
|
87
|
+
const admission = {
|
|
88
|
+
kernel: this.kernel,
|
|
89
|
+
auth,
|
|
90
|
+
source: () => {
|
|
91
|
+
allowEndpoint(sourceEndpoint, policy);
|
|
92
|
+
return pool.clientFor({ transport: 'http', url: sourceEndpoint });
|
|
93
|
+
},
|
|
94
|
+
fetch: fetchImpl,
|
|
95
|
+
policy,
|
|
96
|
+
limits: { maximumPublicationBytes, maximumBundleBytes },
|
|
97
|
+
maximumResponseBytes,
|
|
98
|
+
};
|
|
77
99
|
this.dispatcher = new SessionDispatcher({
|
|
78
100
|
kernel: this.kernel,
|
|
79
101
|
sourceEndpoint,
|
|
80
102
|
pool,
|
|
81
103
|
websocketAvailable,
|
|
82
|
-
auth
|
|
104
|
+
auth,
|
|
83
105
|
cache: this.routes,
|
|
84
106
|
policy,
|
|
85
107
|
envelopeTransport: admitEnvelopeTransport(options.envelopeTransport ?? 'http'),
|
|
86
|
-
discovery: this.discovery,
|
|
87
108
|
requireOpen: () => this.requireOpen(),
|
|
88
109
|
});
|
|
89
110
|
this.schema = createSchema((request, options) => this.dispatch(request, options), {
|
|
90
111
|
maximumPublicationBytes,
|
|
91
112
|
maximumBundleBytes,
|
|
113
|
+
lifecycleTimeoutMs: schemaLifecycleTimeoutMs,
|
|
114
|
+
});
|
|
115
|
+
this.graph = createGraph((call, options) => this.call(call, options));
|
|
116
|
+
this.auth = createAuth((target, input, options) => this.call({ target, input }, options), (call, options) => {
|
|
117
|
+
const operation = this.operation(admitControlOptions(options));
|
|
118
|
+
return admitFunction(admission, acceptCall(call), options, operation);
|
|
92
119
|
});
|
|
93
120
|
}
|
|
121
|
+
/** Bind one admitted DSL Domain to authenticated graph projection and Method dispatch. */
|
|
122
|
+
bind(domain) {
|
|
123
|
+
return createDomainBinding(domain, this.graph, (node, method, input) => this.invokeDomainMethod(domain, node, method, input));
|
|
124
|
+
}
|
|
125
|
+
/** Revalidate the intrinsic Publication without acquiring its bundle or Views. */
|
|
126
|
+
publication(options) {
|
|
127
|
+
return this.discovery.publication(this.operation(admitControlOptions(options)));
|
|
128
|
+
}
|
|
94
129
|
snapshot(options) {
|
|
95
130
|
return this.discovery.snapshot(this.operation(admitControlOptions(options)));
|
|
96
131
|
}
|
|
@@ -98,23 +133,6 @@ export class ClientSession {
|
|
|
98
133
|
this.requireOpen();
|
|
99
134
|
return resolveViewsFor(async (call, operation) => requireResultKind('value', await this.dispatcher.dispatch(call, {}, operation)).value, this.admitTargetViews, target, this.operation(admitControlOptions(options)));
|
|
100
135
|
}
|
|
101
|
-
async installation(origin, options) {
|
|
102
|
-
const result = await this.schema.introspect({
|
|
103
|
-
from: { kind: 'installation', origin },
|
|
104
|
-
select: {
|
|
105
|
-
state: true,
|
|
106
|
-
target: true,
|
|
107
|
-
source: true,
|
|
108
|
-
bundle: true,
|
|
109
|
-
readiness: true,
|
|
110
|
-
capabilities: true,
|
|
111
|
-
},
|
|
112
|
-
}, options);
|
|
113
|
-
if (result?.state !== 'ready' || result.readiness === null) {
|
|
114
|
-
throw new ClientError(`Domain ${origin} is not ready on this Kernel.`);
|
|
115
|
-
}
|
|
116
|
-
return result;
|
|
117
|
-
}
|
|
118
136
|
dispatch(call, options) {
|
|
119
137
|
const admitted = admitRequestOptions(options);
|
|
120
138
|
return this.dispatcher.dispatch(call, admitted, this.operation(admitted));
|
|
@@ -126,11 +144,22 @@ export class ClientSession {
|
|
|
126
144
|
async invoke(reference, input, options) {
|
|
127
145
|
const admittedReference = admitReference(reference);
|
|
128
146
|
const admittedOptions = admitRequestOptions(options);
|
|
129
|
-
const
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
147
|
+
const { anchor, steps } = admittedReference.target.ast;
|
|
148
|
+
const last = steps.at(-1);
|
|
149
|
+
const instance = last?.kind === 'method' && last.dispatch === 'instance'
|
|
150
|
+
? Path.fromAST({ anchor, steps: steps.slice(0, -1) }).raw
|
|
151
|
+
: undefined;
|
|
152
|
+
// A generated reference pins the callable meaning; a hand-written one still pins the revision.
|
|
153
|
+
const result = await this.dispatcher.dispatch({
|
|
154
|
+
target: Object.freeze({
|
|
155
|
+
callable: admittedReference.callable,
|
|
156
|
+
...(admittedReference.fingerprint === undefined
|
|
157
|
+
? { revision: admittedReference.revision }
|
|
158
|
+
: { fingerprint: admittedReference.fingerprint }),
|
|
159
|
+
...(instance === undefined ? {} : { instance }),
|
|
160
|
+
}),
|
|
161
|
+
input,
|
|
162
|
+
}, admittedOptions, this.operation(admittedOptions));
|
|
134
163
|
const narrowed = requireResultKind(admittedReference.outputMode, result);
|
|
135
164
|
return (narrowed.kind === 'value'
|
|
136
165
|
? narrowed.value
|
|
@@ -150,14 +179,30 @@ export class ClientSession {
|
|
|
150
179
|
if (this.closed)
|
|
151
180
|
return;
|
|
152
181
|
this.closed = true;
|
|
153
|
-
this.lifecycle.abort(new
|
|
182
|
+
this.lifecycle.abort(new SessionError('ClientSession is closed.', { failure: 'closed' }));
|
|
154
183
|
this.ownedPool?.close();
|
|
155
184
|
this.routes.clear();
|
|
156
185
|
this.discovery.clear();
|
|
157
186
|
}
|
|
158
187
|
requireOpen() {
|
|
159
188
|
if (this.closed)
|
|
160
|
-
throw new
|
|
189
|
+
throw new SessionError('ClientSession is closed.', { failure: 'closed' });
|
|
190
|
+
}
|
|
191
|
+
invokeDomainMethod(domain, node, method, input) {
|
|
192
|
+
const diagnostics = method.validateInput(input);
|
|
193
|
+
if (diagnostics.length > 0)
|
|
194
|
+
throw new TypeError(`Method ${method.key} input is invalid.`);
|
|
195
|
+
const owner = domain.closure.find(({ origin }) => origin === method.owner.ref.origin);
|
|
196
|
+
if (owner === undefined)
|
|
197
|
+
throw new TypeError(`Method owner ${method.owner.ref.origin} is absent.`);
|
|
198
|
+
return this.invoke({
|
|
199
|
+
origin: owner.origin,
|
|
200
|
+
revision: owner.revision,
|
|
201
|
+
fingerprint: callableFingerprint(method),
|
|
202
|
+
callable: method.key,
|
|
203
|
+
target: Path.instanceMethod(Path.id(node.id), method.key),
|
|
204
|
+
outputMode: method.output.mode,
|
|
205
|
+
}, input);
|
|
161
206
|
}
|
|
162
207
|
operation(options) {
|
|
163
208
|
this.requireOpen();
|
|
@@ -231,4 +276,3 @@ function defaultClientFactory(options) {
|
|
|
231
276
|
}
|
|
232
277
|
};
|
|
233
278
|
}
|
|
234
|
-
//# sourceMappingURL=session.js.map
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NodeId } from '@astrale-os/kernel-core/graph/node';
|
|
2
|
+
import { Path } from '@astrale-os/kernel-core/path';
|
|
3
|
+
import { K, KernelSchema } from '@astrale-os/kernel-core/schema';
|
|
4
|
+
import { defineSchema, func, method, nodeClass, schema, valueSchema, } from '@astrale-os/kernel-dsl/v1';
|
|
5
|
+
import { ClientSession, createSessionCredentialProvider, reference } from './index.js';
|
|
2
6
|
void new ClientSession(options);
|
|
3
7
|
void auth;
|
|
4
8
|
void control;
|
|
@@ -6,5 +10,101 @@ void envelope;
|
|
|
6
10
|
void policy;
|
|
7
11
|
void request;
|
|
8
12
|
void snapshot;
|
|
9
|
-
|
|
10
|
-
|
|
13
|
+
const observedPublication = session.publication(control);
|
|
14
|
+
void observedPublication;
|
|
15
|
+
const admitted = session.auth.admit({
|
|
16
|
+
target: Path.parse('/:example.test:function.write'),
|
|
17
|
+
input: {},
|
|
18
|
+
}, { attenuation: { kind: 'identity', self: true }, ...control });
|
|
19
|
+
void admitted;
|
|
20
|
+
// @ts-expect-error Admission belongs to Auth, not the top-level Session.
|
|
21
|
+
void session.admit({ target: Path.parse('/:example.test:function.write'), input: {} });
|
|
22
|
+
const credentials = createSessionCredentialProvider({
|
|
23
|
+
ttlSeconds: 60,
|
|
24
|
+
mint: async () => minted,
|
|
25
|
+
});
|
|
26
|
+
// A credential provider is a Session authentication resolver; no adapter stands between them.
|
|
27
|
+
const credentialAuth = credentials;
|
|
28
|
+
void new ClientSession({ ...options, auth: credentialAuth });
|
|
29
|
+
// @ts-expect-error A minted credential must carry its own absolute expiry.
|
|
30
|
+
void createSessionCredentialProvider({ ttlSeconds: 60, mint: async () => minted.credential });
|
|
31
|
+
const dynamicReference = reference(dynamicDomain, dynamicMethod)(Path.id(NodeId('dynamic-node')));
|
|
32
|
+
void session.invoke(dynamicReference, dynamicInput);
|
|
33
|
+
const dynamicInputIsClientInput = true;
|
|
34
|
+
const dynamicOutputIsUnknown = true;
|
|
35
|
+
void dynamicInputIsClientInput;
|
|
36
|
+
void dynamicOutputIsUnknown;
|
|
37
|
+
const renameInput = valueSchema()({
|
|
38
|
+
type: 'object',
|
|
39
|
+
properties: { name: { type: 'string' } },
|
|
40
|
+
required: ['name'],
|
|
41
|
+
additionalProperties: false,
|
|
42
|
+
});
|
|
43
|
+
const registrationInput = valueSchema()(K.functions.register.input);
|
|
44
|
+
const booleanOutput = valueSchema()({ type: 'boolean' });
|
|
45
|
+
const typedDomain = schema.resolve(defineSchema('client.input-witness.typecheck', {
|
|
46
|
+
dependencies: { kernel: KernelSchema },
|
|
47
|
+
functions: {
|
|
48
|
+
registerIdentity: func({
|
|
49
|
+
auth: 'authenticated',
|
|
50
|
+
input: registrationInput,
|
|
51
|
+
output: booleanOutput,
|
|
52
|
+
}),
|
|
53
|
+
},
|
|
54
|
+
classes: {
|
|
55
|
+
Person: nodeClass({
|
|
56
|
+
methods: {
|
|
57
|
+
rename: method({ auth: 'authenticated', input: renameInput, output: booleanOutput }),
|
|
58
|
+
registerIdentity: method({
|
|
59
|
+
static: true,
|
|
60
|
+
auth: 'authenticated',
|
|
61
|
+
input: registrationInput,
|
|
62
|
+
output: booleanOutput,
|
|
63
|
+
}),
|
|
64
|
+
},
|
|
65
|
+
}),
|
|
66
|
+
},
|
|
67
|
+
}));
|
|
68
|
+
const registerReference = reference(typedDomain, typedDomain.functions.registerIdentity);
|
|
69
|
+
const staticRegisterReference = reference(typedDomain, typedDomain.classes.Person.static.methods.registerIdentity);
|
|
70
|
+
const renameReference = reference(typedDomain, typedDomain.classes.Person.methods.rename)(Path.id(NodeId('person')));
|
|
71
|
+
void session.invoke(registerReference, registration);
|
|
72
|
+
void boundSession.invoke(staticRegisterReference, registration);
|
|
73
|
+
void session.invoke(renameReference, renameRequest);
|
|
74
|
+
const registerInputIsRequest = true;
|
|
75
|
+
const renameInputIsInterface = true;
|
|
76
|
+
const renameOutputIsBoolean = true;
|
|
77
|
+
void registerInputIsRequest;
|
|
78
|
+
void renameInputIsInterface;
|
|
79
|
+
void renameOutputIsBoolean;
|
|
80
|
+
// @ts-expect-error The exact Schema's required input fields are retained.
|
|
81
|
+
void session.invoke(renameReference, {});
|
|
82
|
+
// @ts-expect-error A Date is not the Schema's declared string input.
|
|
83
|
+
void session.invoke(renameReference, { name: new Date() });
|
|
84
|
+
// @ts-expect-error A function is not the Schema's declared string input.
|
|
85
|
+
void session.invoke(renameReference, { name: () => 'Ada' });
|
|
86
|
+
// @ts-expect-error RegisterRequest retains its nonempty identities tuple.
|
|
87
|
+
void session.invoke(registerReference, { idempotencyKey: 'key', identities: [] });
|
|
88
|
+
// @ts-expect-error An unknown-schema reference still accepts only portable Client Input.
|
|
89
|
+
void session.invoke(dynamicReference, new Date());
|
|
90
|
+
const abstractMethod = method({
|
|
91
|
+
auth: 'authenticated',
|
|
92
|
+
input: { type: 'null' },
|
|
93
|
+
output: { type: 'null' },
|
|
94
|
+
abstract: true,
|
|
95
|
+
});
|
|
96
|
+
const abstractDomain = schema.resolve(defineSchema('client.reference.typecheck', {
|
|
97
|
+
classes: {
|
|
98
|
+
AbstractItem: nodeClass({ abstract: true, methods: { abstractMethod } }),
|
|
99
|
+
},
|
|
100
|
+
}));
|
|
101
|
+
// @ts-expect-error Abstract Methods are declarations and cannot become Client references.
|
|
102
|
+
reference(abstractDomain, abstractDomain.classes.AbstractItem.methods.abstractMethod);
|
|
103
|
+
// @ts-expect-error Exact identity is derived internally, never supplied as a Session option.
|
|
104
|
+
void session.invoke(dynamicReference, dynamicInput, { expect: undefined });
|
|
105
|
+
// @ts-expect-error Raw Client options do not select a declaration.
|
|
106
|
+
const unsupportedClientOptions = { expect: undefined };
|
|
107
|
+
void unsupportedClientOptions;
|
|
108
|
+
// @ts-expect-error Internal metadata dispatch is absent from the public package facade.
|
|
109
|
+
import { dispatchTrace } from '../index.js';
|
|
110
|
+
void dispatchTrace;
|
|
@@ -13,4 +13,3 @@ export declare function rootViewCatalog(publication: publication.Publication, ar
|
|
|
13
13
|
export declare function catalogFromKeys(root: ViewCatalog, keys: readonly Key.View[]): ViewCatalog;
|
|
14
14
|
/** Re-admit one Runtime-resolved heterogeneous View catalog at the Client trust boundary. */
|
|
15
15
|
export declare function targetViewCatalog(input: unknown, policy: Readonly<SessionPolicy>): ViewCatalog;
|
|
16
|
-
//# sourceMappingURL=catalog.d.ts.map
|