@astrale-os/kernel-client 0.6.0-beta.8 → 0.6.0-beta.80
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 +11 -2
- 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 +4 -3
- package/dist/client/client.js +13 -3
- package/dist/client/credential.d.ts +4 -3
- package/dist/client/credential.js +7 -3
- package/dist/client/index.d.ts +1 -2
- package/dist/client/index.js +1 -2
- package/dist/client/request.d.ts +10 -4
- package/dist/client/request.js +33 -6
- 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/exchange-error.d.ts +19 -0
- package/dist/errors/exchange-error.js +9 -0
- package/dist/errors/index.d.ts +8 -7
- package/dist/errors/index.js +8 -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 +3 -3
- 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 +9 -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 +6 -0
- package/dist/session/admission.js +59 -0
- package/dist/session/bound.d.ts +48 -0
- package/dist/session/bound.js +110 -0
- package/dist/session/content.d.ts +27 -0
- package/dist/session/content.js +158 -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 +5 -2
- 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 +56 -0
- package/dist/session/credential/provider.js +236 -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/exchange/domain.d.ts +27 -0
- package/dist/session/exchange/domain.js +63 -0
- package/dist/session/exchange/exchange.d.ts +54 -0
- package/dist/session/exchange/exchange.js +58 -0
- package/dist/session/exchange/index.d.ts +5 -0
- package/dist/session/exchange/index.js +5 -0
- package/dist/session/exchange/issuer.d.ts +18 -0
- package/dist/session/exchange/issuer.js +149 -0
- package/dist/session/exchange/limits.d.ts +10 -0
- package/dist/session/exchange/limits.js +10 -0
- package/dist/session/exchange/options.d.ts +29 -0
- package/dist/session/exchange/options.js +57 -0
- package/dist/session/exchange/presentation.d.ts +18 -0
- package/dist/session/exchange/presentation.js +73 -0
- package/dist/session/exchange/source.d.ts +32 -0
- package/dist/session/exchange/source.js +78 -0
- package/dist/session/execution.d.ts +65 -0
- package/dist/session/execution.js +34 -0
- package/dist/session/index.d.ts +9 -4
- package/dist/session/index.js +4 -1
- package/dist/session/reference.d.ts +40 -12
- package/dist/session/reference.js +56 -14
- package/dist/session/routing/auth.d.ts +10 -1
- package/dist/session/routing/auth.js +8 -2
- package/dist/session/routing/cache.d.ts +27 -8
- package/dist/session/routing/cache.js +218 -25
- package/dist/session/routing/dispatch.d.ts +15 -8
- package/dist/session/routing/dispatch.js +121 -48
- package/dist/session/routing/envelope.d.ts +2 -1
- package/dist/session/routing/envelope.js +14 -10
- package/dist/session/routing/index.d.ts +3 -5
- package/dist/session/routing/index.js +2 -3
- package/dist/session/routing/request.d.ts +9 -1
- package/dist/session/routing/request.js +17 -1
- package/dist/session/session.d.ts +41 -8
- package/dist/session/session.js +129 -41
- package/dist/session/session.typecheck.d.ts +0 -1
- package/dist/session/session.typecheck.js +172 -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 +18 -0
- package/dist/transport/http/byte-stream.js +94 -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 +3 -1
- package/dist/transport/http/transport.js +87 -30
- 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
|
@@ -3,7 +3,15 @@ import type { SessionControlOptions } from '../context/index.js';
|
|
|
3
3
|
export type SessionEnvelopeTransport = 'auto' | 'http' | 'websocket';
|
|
4
4
|
export interface SessionRequestOptions extends SessionControlOptions {
|
|
5
5
|
readonly idempotencyKey?: invocation.IdempotencyKey;
|
|
6
|
+
readonly body?: never;
|
|
6
7
|
}
|
|
8
|
+
export type SessionRequestOptionsWithBody = Omit<SessionRequestOptions, 'body' | 'idempotencyKey'> & {
|
|
9
|
+
readonly body: Blob;
|
|
10
|
+
readonly idempotencyKey?: never;
|
|
11
|
+
};
|
|
12
|
+
export declare function admitInvocationOptions(input: SessionRequestOptions | SessionRequestOptionsWithBody | undefined): {
|
|
13
|
+
readonly options: Readonly<SessionRequestOptions>;
|
|
14
|
+
readonly body?: Blob;
|
|
15
|
+
};
|
|
7
16
|
export declare function admitRequestOptions(input?: SessionRequestOptions): Readonly<SessionRequestOptions>;
|
|
8
17
|
export declare function admitEnvelopeTransport(input: SessionEnvelopeTransport): SessionEnvelopeTransport;
|
|
9
|
-
//# sourceMappingURL=request.d.ts.map
|
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
import * as invocationProtocol from '@astrale-os/kernel-protocol/invocation';
|
|
2
2
|
import { admitControlOptions } from '../context/index.js';
|
|
3
|
+
export function admitInvocationOptions(input) {
|
|
4
|
+
if (input === undefined)
|
|
5
|
+
return Object.freeze({ options: admitRequestOptions() });
|
|
6
|
+
if (input === null || typeof input !== 'object' || Array.isArray(input)) {
|
|
7
|
+
throw new TypeError('Session request options are invalid.');
|
|
8
|
+
}
|
|
9
|
+
if (!Object.hasOwn(input, 'body')) {
|
|
10
|
+
return Object.freeze({ options: admitRequestOptions(input) });
|
|
11
|
+
}
|
|
12
|
+
const { body, ...options } = input;
|
|
13
|
+
if (!(body instanceof Blob))
|
|
14
|
+
throw new TypeError('Binary input must be a Blob or File.');
|
|
15
|
+
if (options.idempotencyKey !== undefined) {
|
|
16
|
+
throw new TypeError('Binary requests cannot carry an idempotency key.');
|
|
17
|
+
}
|
|
18
|
+
return Object.freeze({ options: admitRequestOptions(options), body });
|
|
19
|
+
}
|
|
3
20
|
export function admitRequestOptions(input = {}) {
|
|
4
21
|
if (input === null || typeof input !== 'object' || Array.isArray(input)) {
|
|
5
22
|
throw new TypeError('Session request options are invalid.');
|
|
@@ -23,4 +40,3 @@ export function admitEnvelopeTransport(input) {
|
|
|
23
40
|
}
|
|
24
41
|
return input;
|
|
25
42
|
}
|
|
26
|
-
//# sourceMappingURL=request.js.map
|
|
@@ -1,16 +1,22 @@
|
|
|
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';
|
|
13
|
+
import type { ContentApi } from './content.js';
|
|
10
14
|
import type { SessionControlOptions, SessionPolicy } from './context/index.js';
|
|
15
|
+
import type { SessionCredential } from './credential/index.js';
|
|
11
16
|
import type { SessionSnapshot } from './discovery/index.js';
|
|
12
|
-
import type {
|
|
13
|
-
import type {
|
|
17
|
+
import type { SessionExchangeOptions, SessionExchangeRequest } from './exchange/index.js';
|
|
18
|
+
import type { CallableReference, InputModeOfReference, InputOfReference, OutputOfReference } from './reference.js';
|
|
19
|
+
import type { SessionRouteStore, SessionAuth, SessionEnvelopeTransport, SessionRequestOptions, SessionRequestOptionsWithBody } from './routing/index.js';
|
|
14
20
|
import type { ViewCatalog } from './views/index.js';
|
|
15
21
|
export interface ClientSessionOptions {
|
|
16
22
|
/** Exact canonical source Kernel identity; its invocation and discovery endpoints are derived. */
|
|
@@ -20,6 +26,14 @@ export interface ClientSessionOptions {
|
|
|
20
26
|
readonly pool?: Pick<ClientPoolType, 'clientFor'>;
|
|
21
27
|
readonly websocket?: WebSocketConstructor;
|
|
22
28
|
readonly auth?: SessionAuth;
|
|
29
|
+
/**
|
|
30
|
+
* Present each Domain callable with a credential its declaring Domain exchanges for the `auth`
|
|
31
|
+
* caller, so the Domain is the principal and the caller is `auth`. Kernel and local callables keep
|
|
32
|
+
* the `auth` credential.
|
|
33
|
+
*/
|
|
34
|
+
readonly exchange?: SessionExchangeOptions;
|
|
35
|
+
/** Optional caller-owned persistence for bounded confidential route artifacts. */
|
|
36
|
+
readonly routeStore?: SessionRouteStore;
|
|
23
37
|
readonly policy: SessionPolicy;
|
|
24
38
|
readonly envelopeTransport?: SessionEnvelopeTransport;
|
|
25
39
|
readonly onWarning?: (warning: ClientWarning) => void;
|
|
@@ -27,6 +41,7 @@ export interface ClientSessionOptions {
|
|
|
27
41
|
readonly maximumBundleBytes?: number;
|
|
28
42
|
readonly maximumResponseBytes?: number;
|
|
29
43
|
readonly timeoutMs?: number;
|
|
44
|
+
readonly schemaLifecycleTimeoutMs?: number;
|
|
30
45
|
}
|
|
31
46
|
export type ConnectOptions = Omit<ClientSessionOptions, 'kernel' | 'policy'> & {
|
|
32
47
|
readonly url: string;
|
|
@@ -36,27 +51,45 @@ export type ConnectOptions = Omit<ClientSessionOptions, 'kernel' | 'policy'> & {
|
|
|
36
51
|
export declare class ClientSession {
|
|
37
52
|
readonly kernel: IssuerId;
|
|
38
53
|
readonly schema: SchemaApi;
|
|
54
|
+
readonly graph: GraphApi;
|
|
55
|
+
readonly auth: AuthApi;
|
|
56
|
+
readonly content: ContentApi;
|
|
39
57
|
private readonly ownedPool?;
|
|
40
58
|
private readonly discovery;
|
|
41
59
|
private readonly dispatcher;
|
|
42
60
|
private readonly lifecycle;
|
|
43
61
|
private readonly timeoutMs;
|
|
44
62
|
private readonly routes;
|
|
63
|
+
private readonly exchangeDependencies;
|
|
64
|
+
private readonly callExchange?;
|
|
45
65
|
private readonly admitTargetViews;
|
|
46
66
|
private closed;
|
|
47
67
|
constructor(options: ClientSessionOptions);
|
|
68
|
+
/** Bind one admitted DSL Domain to authenticated graph projection and Method dispatch. */
|
|
69
|
+
bind<const DomainValue extends Domain>(domain: DomainValue): DomainBinding<DomainValue>;
|
|
70
|
+
/**
|
|
71
|
+
* Delegate this Session's caller to one Domain issuer and exchange that delegation for the
|
|
72
|
+
* Domain's credential to this Kernel. Nothing is cached: hold the result, for example through
|
|
73
|
+
* `createSessionCredentialProvider`, for as long as it covers the calls it carries.
|
|
74
|
+
*/
|
|
75
|
+
exchange(domain: string, options?: SessionExchangeRequest): Promise<SessionCredential>;
|
|
76
|
+
/** Revalidate the intrinsic Publication without acquiring its bundle or Views. */
|
|
77
|
+
publication(options?: SessionControlOptions): Promise<publication.Publication>;
|
|
48
78
|
snapshot(options?: SessionControlOptions): Promise<SessionSnapshot>;
|
|
49
79
|
viewsFor(target: PathLike, options?: SessionControlOptions): Promise<ViewCatalog>;
|
|
50
|
-
installation(origin: Key.Origin, options?: SessionControlOptions): Promise<ReadyInstallation>;
|
|
51
80
|
dispatch(call: Call, options?: SessionRequestOptions): Promise<Result>;
|
|
81
|
+
dispatch(call: Call, options: SessionRequestOptionsWithBody): Promise<Result>;
|
|
52
82
|
call(call: Call, options?: SessionRequestOptions): Promise<Input>;
|
|
53
|
-
|
|
83
|
+
call(call: Call, options: SessionRequestOptionsWithBody): Promise<Input>;
|
|
84
|
+
invoke<const Reference extends CallableReference<unknown>>(reference: InputModeOfReference<Reference> extends 'binary' ? never : Reference, input: InputOfReference<Reference>, options?: SessionRequestOptions): Promise<OutputOfReference<Reference>>;
|
|
85
|
+
invoke<const Reference extends CallableReference<unknown, unknown, 'binary'>>(reference: Reference, input: InputOfReference<Reference>, options: SessionRequestOptionsWithBody): Promise<OutputOfReference<Reference>>;
|
|
86
|
+
private dispatchWith;
|
|
54
87
|
stream(call: Call, options?: SessionRequestOptions): Promise<import("../client/result.js").Stream>;
|
|
55
|
-
binary(call: Call, options?: SessionRequestOptions): Promise<import("@astrale-os/kernel-core/
|
|
88
|
+
binary(call: Call, options?: SessionRequestOptions): Promise<import("@astrale-os/kernel-core/callable").BinaryOutput>;
|
|
56
89
|
close(): void;
|
|
57
90
|
private requireOpen;
|
|
91
|
+
private invokeDomainMethod;
|
|
58
92
|
private operation;
|
|
59
93
|
}
|
|
60
94
|
/** Open one caller-owned conversation with a Kernel using secure defaults. */
|
|
61
95
|
export declare function connect(options: ConnectOptions): ClientSession;
|
|
62
|
-
//# sourceMappingURL=session.d.ts.map
|
package/dist/session/session.js
CHANGED
|
@@ -1,26 +1,39 @@
|
|
|
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 { createContentApi } from './content.js';
|
|
15
|
+
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
16
|
import { createSessionDiscovery } from './discovery/index.js';
|
|
17
|
+
import { acquireDomainCredential, admitExchangeOptions, admitExchangeRequest, createSessionExchange, } from './exchange/index.js';
|
|
10
18
|
import { admitReference } from './reference.js';
|
|
11
|
-
import { admitEnvelopeTransport,
|
|
19
|
+
import { admitEnvelopeTransport, admitInvocationOptions, admitSessionAuth, requireResultKind, RouteCache, SessionDispatcher, } from './routing/index.js';
|
|
12
20
|
import { resolveViewsFor, targetViewCatalog } from './views/index.js';
|
|
13
21
|
const DEFAULT_SESSION_POLICY = Object.freeze({ maximumRouteAgeMs: 60_000 });
|
|
14
22
|
/** Caller-owned discovery and redirect-following conversation with one exact source Kernel. */
|
|
15
23
|
export class ClientSession {
|
|
16
24
|
kernel;
|
|
17
25
|
schema;
|
|
26
|
+
graph;
|
|
27
|
+
auth;
|
|
28
|
+
content;
|
|
18
29
|
ownedPool;
|
|
19
30
|
discovery;
|
|
20
31
|
dispatcher;
|
|
21
32
|
lifecycle = new AbortController();
|
|
22
33
|
timeoutMs;
|
|
23
34
|
routes;
|
|
35
|
+
exchangeDependencies;
|
|
36
|
+
callExchange;
|
|
24
37
|
admitTargetViews;
|
|
25
38
|
closed = false;
|
|
26
39
|
constructor(options) {
|
|
@@ -42,11 +55,12 @@ export class ClientSession {
|
|
|
42
55
|
const maximumBundleBytes = positive(options.maximumBundleBytes ?? DEFAULT_MAXIMUM_BUNDLE_BYTES, 'maximumBundleBytes');
|
|
43
56
|
const maximumResponseBytes = positive(options.maximumResponseBytes ?? DEFAULT_MAXIMUM_RESPONSE_BYTES, 'maximumResponseBytes');
|
|
44
57
|
const timeoutMs = platformDuration(options.timeoutMs ?? DEFAULT_TIMEOUT_MS, 'timeoutMs');
|
|
58
|
+
const schemaLifecycleTimeoutMs = platformDuration(options.schemaLifecycleTimeoutMs ?? DEFAULT_SCHEMA_LIFECYCLE_TIMEOUT_MS, 'schemaLifecycleTimeoutMs');
|
|
45
59
|
this.timeoutMs = timeoutMs;
|
|
46
60
|
const websocketAvailable = options.client !== undefined ||
|
|
47
61
|
options.pool !== undefined ||
|
|
48
62
|
options.websocket !== undefined ||
|
|
49
|
-
typeof
|
|
63
|
+
typeof WebSocket === 'function';
|
|
50
64
|
const client = options.client ??
|
|
51
65
|
defaultClientFactory({
|
|
52
66
|
fetch: fetchImpl,
|
|
@@ -73,23 +87,74 @@ export class ClientSession {
|
|
|
73
87
|
requireOpen: () => this.requireOpen(),
|
|
74
88
|
acquisitionOperation: () => this.operation(undefined),
|
|
75
89
|
});
|
|
76
|
-
this.routes = new RouteCache(policy.maximumRouteAgeMs);
|
|
90
|
+
this.routes = new RouteCache(policy.maximumRouteAgeMs, undefined, options.routeStore);
|
|
91
|
+
const auth = admitSessionAuth(options.auth);
|
|
92
|
+
const exchange = admitExchangeOptions(options.exchange, auth);
|
|
93
|
+
this.exchangeDependencies = Object.freeze({
|
|
94
|
+
kernel: this.kernel,
|
|
95
|
+
source: () => {
|
|
96
|
+
allowEndpoint(sourceEndpoint, policy);
|
|
97
|
+
return pool.clientFor({ transport: 'http', url: sourceEndpoint });
|
|
98
|
+
},
|
|
99
|
+
...(auth === undefined ? {} : { auth }),
|
|
100
|
+
fetch: fetchImpl,
|
|
101
|
+
policy,
|
|
102
|
+
limits: { maximumPublicationBytes, maximumBundleBytes },
|
|
103
|
+
maximumResponseBytes,
|
|
104
|
+
operation: (signal) => this.operation(signal === undefined ? undefined : { signal }),
|
|
105
|
+
});
|
|
106
|
+
this.callExchange =
|
|
107
|
+
exchange === undefined || auth === undefined
|
|
108
|
+
? undefined
|
|
109
|
+
: createSessionExchange({ ...this.exchangeDependencies, auth }, exchange);
|
|
77
110
|
this.dispatcher = new SessionDispatcher({
|
|
78
111
|
kernel: this.kernel,
|
|
79
112
|
sourceEndpoint,
|
|
80
113
|
pool,
|
|
81
114
|
websocketAvailable,
|
|
82
|
-
auth
|
|
115
|
+
auth,
|
|
116
|
+
...(this.callExchange === undefined ? {} : { exchange: this.callExchange }),
|
|
83
117
|
cache: this.routes,
|
|
84
118
|
policy,
|
|
85
119
|
envelopeTransport: admitEnvelopeTransport(options.envelopeTransport ?? 'http'),
|
|
86
|
-
discovery: this.discovery,
|
|
87
120
|
requireOpen: () => this.requireOpen(),
|
|
121
|
+
streamingHttp: {
|
|
122
|
+
fetch: fetchImpl,
|
|
123
|
+
maximumResponseBytes: 100 * 1024 * 1024,
|
|
124
|
+
timeoutMs: 30 * 60 * 1_000,
|
|
125
|
+
},
|
|
126
|
+
});
|
|
127
|
+
this.content = createContentApi({
|
|
128
|
+
operation: (options) => this.operation(options),
|
|
129
|
+
dispatch: (target, input, operation, body) => this.dispatcher.dispatchHttp({ target, input }, {}, operation, body),
|
|
88
130
|
});
|
|
89
131
|
this.schema = createSchema((request, options) => this.dispatch(request, options), {
|
|
90
132
|
maximumPublicationBytes,
|
|
91
133
|
maximumBundleBytes,
|
|
134
|
+
lifecycleTimeoutMs: schemaLifecycleTimeoutMs,
|
|
92
135
|
});
|
|
136
|
+
this.graph = createGraph((call, options) => this.call(call, options));
|
|
137
|
+
this.auth = createAuth((target, input, options) => this.call({ target, input }, options), (call, options) => {
|
|
138
|
+
const operation = this.operation(admitControlOptions(options));
|
|
139
|
+
return admitFunction(this.exchangeDependencies, acceptCall(call), options, operation);
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
/** Bind one admitted DSL Domain to authenticated graph projection and Method dispatch. */
|
|
143
|
+
bind(domain) {
|
|
144
|
+
return createDomainBinding(domain, this.graph, (node, method, input) => this.invokeDomainMethod(domain, node, method, input));
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Delegate this Session's caller to one Domain issuer and exchange that delegation for the
|
|
148
|
+
* Domain's credential to this Kernel. Nothing is cached: hold the result, for example through
|
|
149
|
+
* `createSessionCredentialProvider`, for as long as it covers the calls it carries.
|
|
150
|
+
*/
|
|
151
|
+
async exchange(domain, options) {
|
|
152
|
+
const request = admitExchangeRequest(domain, options);
|
|
153
|
+
return acquireDomainCredential(this.exchangeDependencies, request, this.operation(request.control));
|
|
154
|
+
}
|
|
155
|
+
/** Revalidate the intrinsic Publication without acquiring its bundle or Views. */
|
|
156
|
+
publication(options) {
|
|
157
|
+
return this.discovery.publication(this.operation(admitControlOptions(options)));
|
|
93
158
|
}
|
|
94
159
|
snapshot(options) {
|
|
95
160
|
return this.discovery.snapshot(this.operation(admitControlOptions(options)));
|
|
@@ -98,66 +163,90 @@ export class ClientSession {
|
|
|
98
163
|
this.requireOpen();
|
|
99
164
|
return resolveViewsFor(async (call, operation) => requireResultKind('value', await this.dispatcher.dispatch(call, {}, operation)).value, this.admitTargetViews, target, this.operation(admitControlOptions(options)));
|
|
100
165
|
}
|
|
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
166
|
dispatch(call, options) {
|
|
119
|
-
|
|
120
|
-
return this.dispatcher.dispatch(call, admitted, this.operation(admitted));
|
|
167
|
+
return this.dispatchWith(call, options);
|
|
121
168
|
}
|
|
122
169
|
async call(call, options) {
|
|
123
|
-
const result = await this.
|
|
170
|
+
const result = await this.dispatchWith(call, options);
|
|
124
171
|
return requireResultKind('value', result).value;
|
|
125
172
|
}
|
|
126
173
|
async invoke(reference, input, options) {
|
|
127
174
|
const admittedReference = admitReference(reference);
|
|
128
|
-
const
|
|
129
|
-
const
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
175
|
+
const admitted = admitInvocationOptions(options);
|
|
176
|
+
const { anchor, steps } = admittedReference.target.ast;
|
|
177
|
+
const last = steps.at(-1);
|
|
178
|
+
const instance = last?.kind === 'method' && last.dispatch === 'instance'
|
|
179
|
+
? Path.fromAST({ anchor, steps: steps.slice(0, -1) }).raw
|
|
180
|
+
: undefined;
|
|
181
|
+
// A generated reference pins the callable meaning, a hand-written one its revision, and a Kernel
|
|
182
|
+
// reference nothing, like every other syscall the Session addresses.
|
|
183
|
+
const call = {
|
|
184
|
+
target: Object.freeze({
|
|
185
|
+
callable: admittedReference.callable,
|
|
186
|
+
...(admittedReference.fingerprint !== undefined
|
|
187
|
+
? { fingerprint: admittedReference.fingerprint }
|
|
188
|
+
: admittedReference.revision !== undefined
|
|
189
|
+
? { revision: admittedReference.revision }
|
|
190
|
+
: {}),
|
|
191
|
+
...(instance === undefined ? {} : { instance }),
|
|
192
|
+
}),
|
|
193
|
+
input,
|
|
194
|
+
};
|
|
195
|
+
const operation = this.operation(admitted.options);
|
|
196
|
+
const result = await (admitted.body === undefined && admittedReference.outputMode !== 'binary'
|
|
197
|
+
? this.dispatcher.dispatch(call, admitted.options, operation)
|
|
198
|
+
: this.dispatcher.dispatchHttp(call, admitted.options, operation, admitted.body));
|
|
134
199
|
const narrowed = requireResultKind(admittedReference.outputMode, result);
|
|
135
|
-
return
|
|
200
|
+
return narrowed.kind === 'value'
|
|
136
201
|
? narrowed.value
|
|
137
202
|
: narrowed.kind === 'stream'
|
|
138
203
|
? narrowed.stream
|
|
139
|
-
: narrowed.value
|
|
204
|
+
: narrowed.value;
|
|
205
|
+
}
|
|
206
|
+
dispatchWith(call, options, requireHttp = false) {
|
|
207
|
+
const admitted = admitInvocationOptions(options);
|
|
208
|
+
const operation = this.operation(admitted.options);
|
|
209
|
+
return admitted.body === undefined && !requireHttp
|
|
210
|
+
? this.dispatcher.dispatch(call, admitted.options, operation)
|
|
211
|
+
: this.dispatcher.dispatchHttp(call, admitted.options, operation, admitted.body);
|
|
140
212
|
}
|
|
141
213
|
async stream(call, options) {
|
|
142
214
|
const result = await this.dispatch(call, options);
|
|
143
215
|
return requireResultKind('stream', result).stream;
|
|
144
216
|
}
|
|
145
217
|
async binary(call, options) {
|
|
146
|
-
const result = await this.
|
|
218
|
+
const result = await this.dispatchWith(call, options, true);
|
|
147
219
|
return requireResultKind('binary', result).value;
|
|
148
220
|
}
|
|
149
221
|
close() {
|
|
150
222
|
if (this.closed)
|
|
151
223
|
return;
|
|
152
224
|
this.closed = true;
|
|
153
|
-
this.lifecycle.abort(new
|
|
225
|
+
this.lifecycle.abort(new SessionError('ClientSession is closed.', { failure: 'closed' }));
|
|
154
226
|
this.ownedPool?.close();
|
|
155
227
|
this.routes.clear();
|
|
156
228
|
this.discovery.clear();
|
|
229
|
+
this.callExchange?.clear();
|
|
157
230
|
}
|
|
158
231
|
requireOpen() {
|
|
159
232
|
if (this.closed)
|
|
160
|
-
throw new
|
|
233
|
+
throw new SessionError('ClientSession is closed.', { failure: 'closed' });
|
|
234
|
+
}
|
|
235
|
+
invokeDomainMethod(domain, node, method, input) {
|
|
236
|
+
const diagnostics = method.validateInput(input);
|
|
237
|
+
if (diagnostics.length > 0)
|
|
238
|
+
throw new TypeError(`Method ${method.key} input is invalid.`);
|
|
239
|
+
const owner = domain.closure.find(({ origin }) => origin === method.owner.ref.origin);
|
|
240
|
+
if (owner === undefined)
|
|
241
|
+
throw new TypeError(`Method owner ${method.owner.ref.origin} is absent.`);
|
|
242
|
+
return this.invoke({
|
|
243
|
+
origin: owner.origin,
|
|
244
|
+
revision: owner.revision,
|
|
245
|
+
fingerprint: callableFingerprint(method),
|
|
246
|
+
callable: method.key,
|
|
247
|
+
target: Path.instanceMethod(Path.id(node.id), method.key),
|
|
248
|
+
outputMode: method.output.mode,
|
|
249
|
+
}, input);
|
|
161
250
|
}
|
|
162
251
|
operation(options) {
|
|
163
252
|
this.requireOpen();
|
|
@@ -231,4 +320,3 @@ function defaultClientFactory(options) {
|
|
|
231
320
|
}
|
|
232
321
|
};
|
|
233
322
|
}
|
|
234
|
-
//# sourceMappingURL=session.js.map
|
|
@@ -1,4 +1,10 @@
|
|
|
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 { isBinaryInput } from '@astrale-os/kernel-dsl/v1/language';
|
|
6
|
+
import { call } from '../client/index.js';
|
|
7
|
+
import { ClientSession, createSessionCredentialProvider, execution, reference } from './index.js';
|
|
2
8
|
void new ClientSession(options);
|
|
3
9
|
void auth;
|
|
4
10
|
void control;
|
|
@@ -6,5 +12,168 @@ void envelope;
|
|
|
6
12
|
void policy;
|
|
7
13
|
void request;
|
|
8
14
|
void snapshot;
|
|
9
|
-
|
|
10
|
-
|
|
15
|
+
const observedPublication = session.publication(control);
|
|
16
|
+
void observedPublication;
|
|
17
|
+
const admitted = session.auth.admit({
|
|
18
|
+
target: Path.parse('/:example.test:function.write'),
|
|
19
|
+
input: {},
|
|
20
|
+
}, { attenuation: { kind: 'identity', self: true }, ...control });
|
|
21
|
+
void admitted;
|
|
22
|
+
// @ts-expect-error Admission belongs to Auth, not the top-level Session.
|
|
23
|
+
void session.admit({ target: Path.parse('/:example.test:function.write'), input: {} });
|
|
24
|
+
const credentials = createSessionCredentialProvider({
|
|
25
|
+
ttlSeconds: 60,
|
|
26
|
+
mint: async () => minted,
|
|
27
|
+
});
|
|
28
|
+
// A credential provider is a Session authentication resolver; no adapter stands between them.
|
|
29
|
+
const credentialAuth = credentials;
|
|
30
|
+
void new ClientSession({ ...options, auth: credentialAuth });
|
|
31
|
+
// @ts-expect-error A minted credential must carry its own absolute expiry.
|
|
32
|
+
void createSessionCredentialProvider({ ttlSeconds: 60, mint: async () => minted.credential });
|
|
33
|
+
const dynamicReference = reference(dynamicDomain, dynamicMethod)(Path.id(NodeId('dynamic-node')));
|
|
34
|
+
void session.invoke(dynamicReference, dynamicInput);
|
|
35
|
+
const dynamicInputIsClientInput = true;
|
|
36
|
+
const dynamicOutputIsUnknown = true;
|
|
37
|
+
void dynamicInputIsClientInput;
|
|
38
|
+
void dynamicOutputIsUnknown;
|
|
39
|
+
const renameInput = valueSchema()({
|
|
40
|
+
type: 'object',
|
|
41
|
+
properties: { name: { type: 'string' } },
|
|
42
|
+
required: ['name'],
|
|
43
|
+
additionalProperties: false,
|
|
44
|
+
});
|
|
45
|
+
const registerInput = K.functions.register.input;
|
|
46
|
+
if (isBinaryInput(registerInput))
|
|
47
|
+
throw new TypeError('Register input must be a Value.');
|
|
48
|
+
const registrationInput = valueSchema()(registerInput);
|
|
49
|
+
const booleanOutput = valueSchema()({ type: 'boolean' });
|
|
50
|
+
const typedDomain = schema.resolve(defineSchema('client.input-witness.typecheck', {
|
|
51
|
+
dependencies: { kernel: KernelSchema },
|
|
52
|
+
functions: {
|
|
53
|
+
registerIdentity: func({
|
|
54
|
+
auth: 'authenticated',
|
|
55
|
+
input: registrationInput,
|
|
56
|
+
output: booleanOutput,
|
|
57
|
+
}),
|
|
58
|
+
},
|
|
59
|
+
classes: {
|
|
60
|
+
Person: nodeClass({
|
|
61
|
+
methods: {
|
|
62
|
+
rename: method({ auth: 'authenticated', input: renameInput, output: booleanOutput }),
|
|
63
|
+
registerIdentity: method({
|
|
64
|
+
static: true,
|
|
65
|
+
auth: 'authenticated',
|
|
66
|
+
input: registrationInput,
|
|
67
|
+
output: booleanOutput,
|
|
68
|
+
}),
|
|
69
|
+
},
|
|
70
|
+
}),
|
|
71
|
+
},
|
|
72
|
+
}));
|
|
73
|
+
const registerReference = reference(typedDomain, typedDomain.functions.registerIdentity);
|
|
74
|
+
const staticRegisterReference = reference(typedDomain, typedDomain.classes.Person.static.methods.registerIdentity);
|
|
75
|
+
const renameReference = reference(typedDomain, typedDomain.classes.Person.methods.rename)(Path.id(NodeId('person')));
|
|
76
|
+
const blobReceipt = session.content
|
|
77
|
+
.upload(blobBytes, { mediaType: 'image/png' })
|
|
78
|
+
.then(({ receipt }) => receipt);
|
|
79
|
+
const boundBlobReceipt = boundSession.content
|
|
80
|
+
.upload(blobBytes, { mediaType: 'image/png' })
|
|
81
|
+
.then(({ receipt }) => receipt);
|
|
82
|
+
void blobReceipt;
|
|
83
|
+
void boundBlobReceipt;
|
|
84
|
+
void session.invoke(registerReference, registration);
|
|
85
|
+
void boundSession.invoke(staticRegisterReference, registration);
|
|
86
|
+
void session.invoke(renameReference, renameRequest);
|
|
87
|
+
const binaryUploadReference = reference(K, K.functions.upload);
|
|
88
|
+
void session.invoke(binaryUploadReference, { mediaType: 'image/png' }, { body: new Blob() });
|
|
89
|
+
void boundSession.invoke(binaryUploadReference, { mediaType: 'image/png' }, { body: new Blob() });
|
|
90
|
+
const rawBinaryCall = call(Path.parse('/:example.test:function.write'), { mediaType: 'image/png' });
|
|
91
|
+
void client.dispatch(rawBinaryCall, { body: new Blob() });
|
|
92
|
+
void client.as('credential').call(rawBinaryCall, { body: new Blob() });
|
|
93
|
+
// @ts-expect-error Binary Functions require a byte source.
|
|
94
|
+
void session.invoke(binaryUploadReference, { mediaType: 'image/png' });
|
|
95
|
+
// @ts-expect-error Value Functions reject binary bodies.
|
|
96
|
+
void session.invoke(registerReference, registration, { body: new Blob() });
|
|
97
|
+
// @ts-expect-error Bound binary Functions require a byte source.
|
|
98
|
+
void boundSession.invoke(binaryUploadReference, { mediaType: 'image/png' });
|
|
99
|
+
// @ts-expect-error Bound value Functions reject binary bodies.
|
|
100
|
+
void boundSession.invoke(registerReference, registration, { body: new Blob() });
|
|
101
|
+
void session.invoke(binaryUploadReference, { mediaType: 'image/png' },
|
|
102
|
+
// @ts-expect-error Binary invocations cannot carry an idempotency key.
|
|
103
|
+
{ body: new Blob(), idempotencyKey: 'retry' });
|
|
104
|
+
// @ts-expect-error Raw Session binary calls cannot carry an idempotency key.
|
|
105
|
+
void session.dispatch(rawBinaryCall, { body: new Blob(), idempotencyKey: 'retry' });
|
|
106
|
+
// @ts-expect-error Raw Client binary calls cannot carry an idempotency key.
|
|
107
|
+
void client.dispatch(rawBinaryCall, { body: new Blob(), idempotencyKey: 'retry' });
|
|
108
|
+
// @ts-expect-error Authenticated Client binary calls cannot carry an idempotency key.
|
|
109
|
+
void client.as('credential').call(rawBinaryCall, { body: new Blob(), idempotencyKey: 'retry' });
|
|
110
|
+
void session.dispatch({ target: Path.parse('/:example.test:function.write'), input: {} }, { body: new Blob() });
|
|
111
|
+
void session.call({ target: Path.parse('/:example.test:function.write'), input: {} }, { body: new Blob() });
|
|
112
|
+
const registerInputIsRequest = true;
|
|
113
|
+
const renameInputIsInterface = true;
|
|
114
|
+
const renameOutputIsBoolean = true;
|
|
115
|
+
void registerInputIsRequest;
|
|
116
|
+
void renameInputIsInterface;
|
|
117
|
+
void renameOutputIsBoolean;
|
|
118
|
+
// @ts-expect-error The exact Schema's required input fields are retained.
|
|
119
|
+
void session.invoke(renameReference, {});
|
|
120
|
+
// @ts-expect-error A Date is not the Schema's declared string input.
|
|
121
|
+
void session.invoke(renameReference, { name: new Date() });
|
|
122
|
+
// @ts-expect-error A function is not the Schema's declared string input.
|
|
123
|
+
void session.invoke(renameReference, { name: () => 'Ada' });
|
|
124
|
+
// @ts-expect-error RegisterRequest retains its nonempty identities tuple.
|
|
125
|
+
void session.invoke(registerReference, { idempotencyKey: 'key', identities: [] });
|
|
126
|
+
// @ts-expect-error An unknown-schema reference still accepts only portable Client Input.
|
|
127
|
+
void session.invoke(dynamicReference, new Date());
|
|
128
|
+
const abstractMethod = method({
|
|
129
|
+
auth: 'authenticated',
|
|
130
|
+
input: { type: 'null' },
|
|
131
|
+
output: { type: 'null' },
|
|
132
|
+
abstract: true,
|
|
133
|
+
});
|
|
134
|
+
const abstractDomain = schema.resolve(defineSchema('client.reference.typecheck', {
|
|
135
|
+
classes: {
|
|
136
|
+
AbstractItem: nodeClass({ abstract: true, methods: { abstractMethod } }),
|
|
137
|
+
},
|
|
138
|
+
}));
|
|
139
|
+
const reminderOutput = valueSchema()({
|
|
140
|
+
type: 'object',
|
|
141
|
+
properties: { reminder: { type: 'string' } },
|
|
142
|
+
required: ['reminder'],
|
|
143
|
+
additionalProperties: false,
|
|
144
|
+
});
|
|
145
|
+
const durableDomain = schema.resolve(defineSchema('client.durable.typecheck', {
|
|
146
|
+
classes: {
|
|
147
|
+
Invoice: nodeClass({
|
|
148
|
+
methods: {
|
|
149
|
+
remind: method({
|
|
150
|
+
auth: 'authenticated',
|
|
151
|
+
input: renameInput,
|
|
152
|
+
output: reminderOutput,
|
|
153
|
+
execution: { durable: true },
|
|
154
|
+
}),
|
|
155
|
+
},
|
|
156
|
+
}),
|
|
157
|
+
},
|
|
158
|
+
}));
|
|
159
|
+
const remindReference = reference(durableDomain, durableDomain.classes.Invoice.methods.remind)(Path.id(NodeId('invoice-1')));
|
|
160
|
+
const durableReturnsExecution = true;
|
|
161
|
+
const outcomeIsTyped = true;
|
|
162
|
+
const statusIsTyped = true;
|
|
163
|
+
void session.invoke(execution.result(run), { waitMs: 1_000 });
|
|
164
|
+
void session.invoke(execution.signal(run), { name: 'approval', value: { by: 'billing' } });
|
|
165
|
+
// @ts-expect-error Force is the only cancellation option.
|
|
166
|
+
void session.invoke(execution.cancel(run), { waitMs: 1_000 });
|
|
167
|
+
void durableReturnsExecution;
|
|
168
|
+
void outcomeIsTyped;
|
|
169
|
+
void statusIsTyped;
|
|
170
|
+
// @ts-expect-error Abstract Methods are declarations and cannot become Client references.
|
|
171
|
+
reference(abstractDomain, abstractDomain.classes.AbstractItem.methods.abstractMethod);
|
|
172
|
+
// @ts-expect-error Exact identity is derived internally, never supplied as a Session option.
|
|
173
|
+
void session.invoke(dynamicReference, dynamicInput, { expect: undefined });
|
|
174
|
+
// @ts-expect-error Raw Client options do not select a declaration.
|
|
175
|
+
const unsupportedClientOptions = { expect: undefined };
|
|
176
|
+
void unsupportedClientOptions;
|
|
177
|
+
// @ts-expect-error Internal metadata dispatch is absent from the public package facade.
|
|
178
|
+
import { dispatchTrace } from '../index.js';
|
|
179
|
+
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
|
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
import { acceptViewResolution, } from '@astrale-os/kernel-core/schema/kernel/syscalls/view-resolution';
|
|
2
|
-
import { Key as ViewKey
|
|
2
|
+
import { Key as ViewKey } from '@astrale-os/kernel-dsl/v1/addressing';
|
|
3
3
|
import { ClientError } from '../../errors/index.js';
|
|
4
4
|
import { allowEndpoint } from '../context/index.js';
|
|
5
5
|
export function rootViewCatalog(publication, artifact, policy) {
|
|
6
6
|
const views = publication.bindings.views
|
|
7
7
|
.map((binding) => {
|
|
8
8
|
allowEndpoint(binding.href, policy);
|
|
9
|
-
const declaration = artifact.root.views[
|
|
9
|
+
const declaration = artifact.root.views[viewName(binding.view)];
|
|
10
10
|
if (declaration === undefined) {
|
|
11
11
|
throw new ClientError('Published View has no verified root declaration.');
|
|
12
12
|
}
|
|
13
|
+
const { ref: _ref, ...viewDeclaration } = declaration;
|
|
13
14
|
return Object.freeze({
|
|
14
15
|
key: binding.view,
|
|
15
|
-
declaration,
|
|
16
|
+
declaration: Object.freeze(viewDeclaration),
|
|
16
17
|
href: binding.href,
|
|
17
18
|
handshake: binding.handshake,
|
|
19
|
+
...(binding.iframe === undefined ? {} : { iframe: binding.iframe }),
|
|
20
|
+
...(binding.host === undefined ? {} : { host: binding.host }),
|
|
18
21
|
issuer: publication.identity.issuer,
|
|
19
22
|
etag: publication.etag,
|
|
20
23
|
revision: publication.schema.revision,
|
|
@@ -25,7 +28,7 @@ export function rootViewCatalog(publication, artifact, policy) {
|
|
|
25
28
|
const entrypointRef = publication.manifest?.entrypoint;
|
|
26
29
|
const entrypoint = entrypointRef === undefined
|
|
27
30
|
? undefined
|
|
28
|
-
: catalogViews.find(({ key }) => key === ViewKey.of(
|
|
31
|
+
: catalogViews.find(({ key }) => key === ViewKey.of(entrypointRef));
|
|
29
32
|
if (entrypointRef !== undefined && entrypoint === undefined) {
|
|
30
33
|
throw new ClientError('Published View entrypoint has no verified Publication binding.');
|
|
31
34
|
}
|
|
@@ -60,4 +63,10 @@ export function targetViewCatalog(input, policy) {
|
|
|
60
63
|
function compareKeys(left, right) {
|
|
61
64
|
return left < right ? -1 : left > right ? 1 : 0;
|
|
62
65
|
}
|
|
63
|
-
|
|
66
|
+
function viewName(input) {
|
|
67
|
+
const coordinate = input.slice(input.indexOf(':') + 1);
|
|
68
|
+
const match = /^view\.([A-Za-z][A-Za-z0-9_]*)$/u.exec(coordinate);
|
|
69
|
+
if (match === null)
|
|
70
|
+
throw new ClientError('Published View key is invalid.');
|
|
71
|
+
return match[1];
|
|
72
|
+
}
|