@astrale-os/kernel-client 0.6.0-beta.9 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth/auth.d.ts +22 -10
- package/dist/auth/auth.js +5 -7
- package/dist/auth/authorization.d.ts +4 -2
- package/dist/auth/authorization.js +25 -6
- package/dist/auth/credential.d.ts +7 -4
- package/dist/auth/credential.js +6 -3
- package/dist/auth/identity.d.ts +7 -9
- package/dist/auth/identity.js +0 -1
- package/dist/auth/index.d.ts +4 -5
- package/dist/auth/index.js +2 -4
- package/dist/auth/register.d.ts +24 -0
- package/dist/auth/register.js +10 -0
- package/dist/client/admission.d.ts +4 -2
- package/dist/client/admission.js +9 -11
- package/dist/client/client.d.ts +4 -3
- package/dist/client/client.js +16 -4
- package/dist/client/credential.d.ts +5 -3
- package/dist/client/credential.js +7 -3
- package/dist/client/index.d.ts +3 -4
- package/dist/client/index.js +2 -3
- package/dist/client/request.d.ts +11 -4
- package/dist/client/request.js +50 -6
- package/dist/client/result.d.ts +7 -5
- package/dist/client/result.js +13 -5
- package/dist/client/routing-control.d.ts +11 -4
- package/dist/client/routing-control.js +18 -4
- package/dist/errors/client-error.d.ts +0 -1
- package/dist/errors/client-error.js +0 -1
- package/dist/errors/exchange-error.d.ts +19 -0
- package/dist/errors/exchange-error.js +9 -0
- package/dist/errors/index.d.ts +2 -1
- package/dist/errors/index.js +2 -1
- package/dist/errors/miss-error.d.ts +0 -1
- package/dist/errors/miss-error.js +0 -1
- package/dist/errors/protocol-error.d.ts +0 -1
- package/dist/errors/protocol-error.js +0 -1
- package/dist/errors/refusal.d.ts +12 -0
- package/dist/errors/refusal.js +40 -0
- package/dist/errors/response-error.d.ts +0 -1
- package/dist/errors/response-error.js +0 -1
- package/dist/errors/session-error.d.ts +0 -1
- package/dist/errors/session-error.js +0 -1
- package/dist/errors/stale-route-error.d.ts +4 -4
- package/dist/errors/stale-route-error.js +5 -5
- package/dist/errors/transport-error.d.ts +3 -3
- package/dist/errors/transport-error.js +0 -1
- package/dist/graph/domain/binding.d.ts +0 -1
- package/dist/graph/domain/binding.js +4 -1
- package/dist/graph/domain/domain.typecheck.d.ts +0 -1
- package/dist/graph/domain/domain.typecheck.js +21 -1
- package/dist/graph/domain/index.d.ts +0 -1
- package/dist/graph/domain/index.js +0 -1
- package/dist/graph/domain/model.d.ts +0 -1
- package/dist/graph/domain/model.js +0 -1
- package/dist/graph/domain/page.d.ts +0 -1
- package/dist/graph/domain/page.js +0 -1
- package/dist/graph/domain/project.d.ts +0 -1
- package/dist/graph/domain/project.js +10 -7
- package/dist/graph/domain/provenance.d.ts +0 -1
- package/dist/graph/domain/provenance.js +0 -1
- package/dist/graph/errors.d.ts +0 -1
- package/dist/graph/errors.js +1 -3
- package/dist/graph/expectation.d.ts +3 -0
- package/dist/graph/expectation.js +6 -0
- package/dist/graph/graph.d.ts +6 -3
- package/dist/graph/graph.js +0 -1
- package/dist/graph/index.d.ts +2 -3
- package/dist/graph/index.js +1 -2
- package/dist/graph/mutation.d.ts +2 -4
- package/dist/graph/mutation.js +12 -2
- package/dist/graph/page/index.d.ts +0 -1
- package/dist/graph/page/index.js +0 -1
- package/dist/graph/page/neighbors.d.ts +0 -1
- package/dist/graph/page/neighbors.js +2 -2
- package/dist/graph/page/page.d.ts +0 -1
- package/dist/graph/page/page.js +0 -1
- package/dist/graph/page-contract.d.ts +6 -1
- package/dist/graph/page-contract.js +0 -1
- package/dist/graph/provenance.d.ts +2 -1
- package/dist/graph/provenance.js +5 -1
- package/dist/graph/query.d.ts +3 -1
- package/dist/graph/query.js +25 -10
- package/dist/graph/read.d.ts +0 -1
- package/dist/graph/read.js +6 -5
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/pacer/batcher/batcher.d.ts +0 -1
- package/dist/pacer/batcher/batcher.js +0 -1
- package/dist/pacer/batcher/defaults.d.ts +0 -1
- package/dist/pacer/batcher/defaults.js +0 -1
- package/dist/pacer/batcher/index.d.ts +0 -1
- package/dist/pacer/batcher/index.js +0 -1
- package/dist/pacer/index.d.ts +1 -2
- package/dist/pacer/index.js +1 -2
- package/dist/pacer/limiter/defaults.d.ts +0 -1
- package/dist/pacer/limiter/defaults.js +0 -1
- package/dist/pacer/limiter/index.d.ts +0 -1
- package/dist/pacer/limiter/index.js +0 -1
- package/dist/pacer/limiter/limiter.d.ts +0 -1
- package/dist/pacer/limiter/limiter.js +0 -1
- package/dist/pacer/queue/defaults.d.ts +0 -1
- package/dist/pacer/queue/defaults.js +0 -1
- package/dist/pacer/queue/index.d.ts +0 -1
- package/dist/pacer/queue/index.js +0 -1
- package/dist/pacer/queue/queue.d.ts +0 -1
- package/dist/pacer/queue/queue.js +0 -1
- package/dist/pacer/retry/defaults.d.ts +0 -1
- package/dist/pacer/retry/defaults.js +0 -1
- package/dist/pacer/retry/index.d.ts +1 -1
- package/dist/pacer/retry/index.js +1 -1
- package/dist/pacer/retry/refusals.d.ts +7 -0
- package/dist/pacer/retry/refusals.js +10 -0
- package/dist/pacer/retry/retry.d.ts +2 -1
- package/dist/pacer/retry/retry.js +33 -2
- package/dist/pool/index.d.ts +0 -1
- package/dist/pool/index.js +0 -1
- package/dist/pool/pool.d.ts +0 -1
- package/dist/pool/pool.js +0 -1
- package/dist/pool/target.d.ts +0 -1
- package/dist/pool/target.js +0 -1
- package/dist/schema/admission.d.ts +1 -2
- package/dist/schema/admission.js +2 -3
- package/dist/schema/contracts.d.ts +97 -5
- package/dist/schema/contracts.js +0 -1
- package/dist/schema/index.d.ts +3 -3
- package/dist/schema/index.js +1 -2
- package/dist/schema/installation.d.ts +104 -0
- package/dist/schema/installation.js +144 -0
- package/dist/schema/introspection.d.ts +0 -1
- package/dist/schema/introspection.js +10 -3
- package/dist/schema/operation.d.ts +0 -1
- package/dist/schema/operation.js +1 -2
- package/dist/schema/schema.d.ts +32 -11
- package/dist/schema/schema.js +94 -19
- package/dist/session/admission.d.ts +6 -0
- package/dist/session/admission.js +52 -0
- package/dist/session/bound.d.ts +17 -14
- package/dist/session/bound.js +96 -10
- package/dist/session/content/api.d.ts +45 -0
- package/dist/session/content/api.js +28 -0
- package/dist/session/content/batch.d.ts +5 -0
- package/dist/session/content/batch.js +93 -0
- package/dist/session/content/index.d.ts +1 -0
- package/dist/session/content/index.js +1 -0
- package/dist/session/content/input.d.ts +9 -0
- package/dist/session/content/input.js +33 -0
- package/dist/session/content/parts.d.ts +36 -0
- package/dist/session/content/parts.js +154 -0
- package/dist/session/content/retry.d.ts +3 -0
- package/dist/session/content/retry.js +41 -0
- package/dist/session/content/wire.d.ts +12 -0
- package/dist/session/content/wire.js +60 -0
- package/dist/session/context/control.d.ts +0 -1
- package/dist/session/context/control.js +0 -1
- package/dist/session/context/index.d.ts +2 -3
- package/dist/session/context/index.js +2 -3
- package/dist/session/context/limits.d.ts +1 -2
- package/dist/session/context/limits.js +1 -2
- package/dist/session/context/operation.d.ts +5 -3
- package/dist/session/context/operation.js +1 -2
- package/dist/session/context/policy.d.ts +0 -2
- package/dist/session/context/policy.js +0 -17
- package/dist/session/credential/credentials.d.ts +65 -0
- package/dist/session/credential/credentials.js +296 -0
- package/dist/session/credential/index.d.ts +1 -0
- package/dist/session/credential/index.js +1 -0
- package/dist/session/credential/limits.d.ts +14 -0
- package/dist/session/credential/limits.js +14 -0
- package/dist/session/discovery/bundle.d.ts +9 -5
- package/dist/session/discovery/bundle.js +43 -26
- package/dist/session/discovery/discovery.d.ts +12 -5
- package/dist/session/discovery/discovery.js +42 -13
- package/dist/session/discovery/index.d.ts +6 -2
- package/dist/session/discovery/index.js +4 -8
- package/dist/session/discovery/release.d.ts +30 -0
- package/dist/session/discovery/release.js +81 -0
- package/dist/session/discovery/response.d.ts +3 -0
- package/dist/session/discovery/response.js +59 -0
- package/dist/session/discovery/snapshot.d.ts +4 -5
- package/dist/session/discovery/snapshot.js +2 -3
- package/dist/session/discovery/transport.d.ts +1 -4
- package/dist/session/discovery/transport.js +0 -1
- package/dist/session/exchange/domain.d.ts +27 -0
- package/dist/session/exchange/domain.js +63 -0
- package/dist/session/exchange/exchange.d.ts +48 -0
- package/dist/session/exchange/exchange.js +54 -0
- package/dist/session/exchange/index.d.ts +5 -0
- package/dist/session/exchange/index.js +5 -0
- package/dist/session/exchange/issuer.d.ts +18 -0
- package/dist/session/exchange/issuer.js +149 -0
- package/dist/session/exchange/limits.d.ts +10 -0
- package/dist/session/exchange/limits.js +10 -0
- package/dist/session/exchange/options.d.ts +37 -0
- package/dist/session/exchange/options.js +65 -0
- package/dist/session/exchange/presentation.d.ts +19 -0
- package/dist/session/exchange/presentation.js +72 -0
- package/dist/session/exchange/source.d.ts +33 -0
- package/dist/session/exchange/source.js +78 -0
- package/dist/session/execution.d.ts +88 -0
- package/dist/session/execution.js +34 -0
- package/dist/session/index.d.ts +9 -6
- package/dist/session/index.js +3 -2
- package/dist/session/options.d.ts +65 -0
- package/dist/session/options.js +132 -0
- package/dist/session/reference.d.ts +38 -19
- package/dist/session/reference.js +34 -12
- package/dist/session/routing/auth.d.ts +10 -1
- package/dist/session/routing/auth.js +8 -2
- package/dist/session/routing/cache.d.ts +21 -7
- package/dist/session/routing/cache.js +103 -73
- package/dist/session/routing/dispatch.d.ts +19 -11
- package/dist/session/routing/dispatch.js +115 -89
- package/dist/session/routing/envelope.d.ts +4 -3
- package/dist/session/routing/envelope.js +14 -10
- package/dist/session/routing/expiry.d.ts +4 -0
- package/dist/session/routing/expiry.js +32 -0
- package/dist/session/routing/index.d.ts +5 -5
- package/dist/session/routing/index.js +4 -3
- package/dist/session/routing/integrity.d.ts +7 -0
- package/dist/session/routing/integrity.js +44 -0
- package/dist/session/routing/recovery.d.ts +16 -0
- package/dist/session/routing/recovery.js +41 -0
- package/dist/session/routing/request.d.ts +13 -1
- package/dist/session/routing/request.js +28 -2
- package/dist/session/routing/result.d.ts +5 -0
- package/dist/session/routing/result.js +16 -0
- package/dist/session/routing/store.d.ts +23 -0
- package/dist/session/routing/store.js +99 -0
- package/dist/session/session.d.ts +37 -33
- package/dist/session/session.js +134 -157
- package/dist/session/session.typecheck.d.ts +0 -1
- package/dist/session/session.typecheck.js +183 -5
- package/dist/session/views/catalog.d.ts +9 -6
- package/dist/session/views/catalog.js +29 -23
- package/dist/session/views/index.d.ts +1 -2
- package/dist/session/views/index.js +1 -2
- package/dist/session/views/resolve.d.ts +6 -5
- package/dist/session/views/resolve.js +14 -7
- package/dist/store/entity-index.d.ts +1 -3
- package/dist/store/entity-index.js +0 -4
- package/dist/store/index.d.ts +0 -1
- package/dist/store/index.js +0 -1
- package/dist/store/memory.d.ts +2 -2
- package/dist/store/memory.js +60 -18
- package/dist/store/mutation.d.ts +1 -2
- package/dist/store/mutation.js +6 -4
- package/dist/store/observe.d.ts +0 -1
- package/dist/store/observe.js +0 -1
- package/dist/store/optimistic.d.ts +0 -1
- package/dist/store/optimistic.js +0 -1
- package/dist/store/query-key.d.ts +2 -2
- package/dist/store/query-key.js +7 -3
- package/dist/store/shape.d.ts +6 -3
- package/dist/store/shape.js +4 -2
- package/dist/store/store.d.ts +2 -4
- package/dist/store/store.js +6 -5
- package/dist/store/store.typecheck.d.ts +0 -1
- package/dist/store/store.typecheck.js +0 -6
- package/dist/transport/auto/decision.d.ts +3 -3
- package/dist/transport/auto/decision.js +0 -1
- package/dist/transport/auto/fallback.d.ts +2 -2
- package/dist/transport/auto/fallback.js +2 -2
- package/dist/transport/auto/index.d.ts +0 -1
- package/dist/transport/auto/index.js +0 -1
- package/dist/transport/auto/transport.d.ts +0 -2
- package/dist/transport/auto/transport.js +0 -3
- package/dist/transport/auto/warning.d.ts +0 -1
- package/dist/transport/auto/warning.js +5 -3
- package/dist/transport/deadline.d.ts +0 -1
- package/dist/transport/deadline.js +0 -1
- package/dist/transport/failure.d.ts +0 -1
- package/dist/transport/failure.js +0 -1
- package/dist/transport/http/admission.d.ts +5 -0
- package/dist/transport/http/admission.js +104 -0
- package/dist/transport/http/binary.d.ts +5 -0
- package/dist/transport/http/binary.js +70 -0
- package/dist/transport/http/byte-stream.d.ts +18 -0
- package/dist/transport/http/byte-stream.js +94 -0
- package/dist/transport/http/configuration.d.ts +24 -0
- package/dist/transport/http/configuration.js +116 -0
- package/dist/transport/http/index.d.ts +2 -2
- package/dist/transport/http/index.js +0 -1
- package/dist/transport/http/response.d.ts +8 -2
- package/dist/transport/http/response.js +11 -7
- package/dist/transport/http/retired.d.ts +8 -0
- package/dist/transport/http/retired.js +28 -0
- package/dist/transport/http/stream.d.ts +0 -1
- package/dist/transport/http/stream.js +0 -1
- package/dist/transport/http/transport.d.ts +4 -18
- package/dist/transport/http/transport.js +48 -252
- package/dist/transport/index.d.ts +1 -2
- package/dist/transport/index.js +0 -1
- package/dist/transport/transport.d.ts +20 -3
- package/dist/transport/transport.js +0 -1
- package/dist/transport/websocket/connection.d.ts +2 -2
- package/dist/transport/websocket/connection.js +5 -3
- package/dist/transport/websocket/exchange.d.ts +0 -1
- package/dist/transport/websocket/exchange.js +8 -1
- package/dist/transport/websocket/index.d.ts +0 -1
- package/dist/transport/websocket/index.js +0 -1
- package/dist/transport/websocket/transport.d.ts +0 -4
- package/dist/transport/websocket/transport.js +2 -18
- package/package.json +12 -15
- package/dist/auth/auth.d.ts.map +0 -1
- package/dist/auth/auth.js.map +0 -1
- package/dist/auth/authorization.d.ts.map +0 -1
- package/dist/auth/authorization.js.map +0 -1
- package/dist/auth/credential.d.ts.map +0 -1
- package/dist/auth/credential.js.map +0 -1
- package/dist/auth/identity.d.ts.map +0 -1
- package/dist/auth/identity.js.map +0 -1
- package/dist/auth/index.d.ts.map +0 -1
- package/dist/auth/index.js.map +0 -1
- package/dist/auth/provision.d.ts +0 -9
- package/dist/auth/provision.d.ts.map +0 -1
- package/dist/auth/provision.js +0 -11
- package/dist/auth/provision.js.map +0 -1
- package/dist/client/admission.d.ts.map +0 -1
- package/dist/client/admission.js.map +0 -1
- package/dist/client/client.d.ts.map +0 -1
- package/dist/client/client.js.map +0 -1
- package/dist/client/credential.d.ts.map +0 -1
- package/dist/client/credential.js.map +0 -1
- package/dist/client/index.d.ts.map +0 -1
- package/dist/client/index.js.map +0 -1
- package/dist/client/request.d.ts.map +0 -1
- package/dist/client/request.js.map +0 -1
- package/dist/client/result.d.ts.map +0 -1
- package/dist/client/result.js.map +0 -1
- package/dist/client/routing-control.d.ts.map +0 -1
- package/dist/client/routing-control.js.map +0 -1
- package/dist/errors/client-error.d.ts.map +0 -1
- package/dist/errors/client-error.js.map +0 -1
- package/dist/errors/index.d.ts.map +0 -1
- package/dist/errors/index.js.map +0 -1
- package/dist/errors/miss-error.d.ts.map +0 -1
- package/dist/errors/miss-error.js.map +0 -1
- package/dist/errors/protocol-error.d.ts.map +0 -1
- package/dist/errors/protocol-error.js.map +0 -1
- package/dist/errors/response-error.d.ts.map +0 -1
- package/dist/errors/response-error.js.map +0 -1
- package/dist/errors/session-error.d.ts.map +0 -1
- package/dist/errors/session-error.js.map +0 -1
- package/dist/errors/stale-route-error.d.ts.map +0 -1
- package/dist/errors/stale-route-error.js.map +0 -1
- package/dist/errors/transport-error.d.ts.map +0 -1
- package/dist/errors/transport-error.js.map +0 -1
- package/dist/graph/domain/binding.d.ts.map +0 -1
- package/dist/graph/domain/binding.js.map +0 -1
- package/dist/graph/domain/domain.typecheck.d.ts.map +0 -1
- package/dist/graph/domain/domain.typecheck.js.map +0 -1
- package/dist/graph/domain/index.d.ts.map +0 -1
- package/dist/graph/domain/index.js.map +0 -1
- package/dist/graph/domain/model.d.ts.map +0 -1
- package/dist/graph/domain/model.js.map +0 -1
- package/dist/graph/domain/page.d.ts.map +0 -1
- package/dist/graph/domain/page.js.map +0 -1
- package/dist/graph/domain/project.d.ts.map +0 -1
- package/dist/graph/domain/project.js.map +0 -1
- package/dist/graph/domain/provenance.d.ts.map +0 -1
- package/dist/graph/domain/provenance.js.map +0 -1
- package/dist/graph/errors.d.ts.map +0 -1
- package/dist/graph/errors.js.map +0 -1
- package/dist/graph/graph.d.ts.map +0 -1
- package/dist/graph/graph.js.map +0 -1
- package/dist/graph/index.d.ts.map +0 -1
- package/dist/graph/index.js.map +0 -1
- package/dist/graph/mutation.d.ts.map +0 -1
- package/dist/graph/mutation.js.map +0 -1
- package/dist/graph/page/index.d.ts.map +0 -1
- package/dist/graph/page/index.js.map +0 -1
- package/dist/graph/page/neighbors.d.ts.map +0 -1
- package/dist/graph/page/neighbors.js.map +0 -1
- package/dist/graph/page/page.d.ts.map +0 -1
- package/dist/graph/page/page.js.map +0 -1
- package/dist/graph/page-contract.d.ts.map +0 -1
- package/dist/graph/page-contract.js.map +0 -1
- package/dist/graph/provenance.d.ts.map +0 -1
- package/dist/graph/provenance.js.map +0 -1
- package/dist/graph/query.d.ts.map +0 -1
- package/dist/graph/query.js.map +0 -1
- package/dist/graph/read.d.ts.map +0 -1
- package/dist/graph/read.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/pacer/batcher/batcher.d.ts.map +0 -1
- package/dist/pacer/batcher/batcher.js.map +0 -1
- package/dist/pacer/batcher/defaults.d.ts.map +0 -1
- package/dist/pacer/batcher/defaults.js.map +0 -1
- package/dist/pacer/batcher/index.d.ts.map +0 -1
- package/dist/pacer/batcher/index.js.map +0 -1
- package/dist/pacer/index.d.ts.map +0 -1
- package/dist/pacer/index.js.map +0 -1
- package/dist/pacer/limiter/defaults.d.ts.map +0 -1
- package/dist/pacer/limiter/defaults.js.map +0 -1
- package/dist/pacer/limiter/index.d.ts.map +0 -1
- package/dist/pacer/limiter/index.js.map +0 -1
- package/dist/pacer/limiter/limiter.d.ts.map +0 -1
- package/dist/pacer/limiter/limiter.js.map +0 -1
- package/dist/pacer/queue/defaults.d.ts.map +0 -1
- package/dist/pacer/queue/defaults.js.map +0 -1
- package/dist/pacer/queue/index.d.ts.map +0 -1
- package/dist/pacer/queue/index.js.map +0 -1
- package/dist/pacer/queue/queue.d.ts.map +0 -1
- package/dist/pacer/queue/queue.js.map +0 -1
- package/dist/pacer/retry/defaults.d.ts.map +0 -1
- package/dist/pacer/retry/defaults.js.map +0 -1
- package/dist/pacer/retry/index.d.ts.map +0 -1
- package/dist/pacer/retry/index.js.map +0 -1
- package/dist/pacer/retry/retry.d.ts.map +0 -1
- package/dist/pacer/retry/retry.js.map +0 -1
- package/dist/pool/index.d.ts.map +0 -1
- package/dist/pool/index.js.map +0 -1
- package/dist/pool/pool.d.ts.map +0 -1
- package/dist/pool/pool.js.map +0 -1
- package/dist/pool/target.d.ts.map +0 -1
- package/dist/pool/target.js.map +0 -1
- package/dist/schema/admission.d.ts.map +0 -1
- package/dist/schema/admission.js.map +0 -1
- package/dist/schema/contracts.d.ts.map +0 -1
- package/dist/schema/contracts.js.map +0 -1
- package/dist/schema/index.d.ts.map +0 -1
- package/dist/schema/index.js.map +0 -1
- package/dist/schema/introspection.d.ts.map +0 -1
- package/dist/schema/introspection.js.map +0 -1
- package/dist/schema/operation.d.ts.map +0 -1
- package/dist/schema/operation.js.map +0 -1
- package/dist/schema/schema.d.ts.map +0 -1
- package/dist/schema/schema.js.map +0 -1
- package/dist/session/bound.d.ts.map +0 -1
- package/dist/session/bound.js.map +0 -1
- package/dist/session/context/control.d.ts.map +0 -1
- package/dist/session/context/control.js.map +0 -1
- package/dist/session/context/index.d.ts.map +0 -1
- package/dist/session/context/index.js.map +0 -1
- package/dist/session/context/limits.d.ts.map +0 -1
- package/dist/session/context/limits.js.map +0 -1
- package/dist/session/context/operation.d.ts.map +0 -1
- package/dist/session/context/operation.js.map +0 -1
- package/dist/session/context/policy.d.ts.map +0 -1
- package/dist/session/context/policy.js.map +0 -1
- package/dist/session/discovery/bundle.d.ts.map +0 -1
- package/dist/session/discovery/bundle.js.map +0 -1
- package/dist/session/discovery/discovery.d.ts.map +0 -1
- package/dist/session/discovery/discovery.js.map +0 -1
- package/dist/session/discovery/index.d.ts.map +0 -1
- package/dist/session/discovery/index.js.map +0 -1
- package/dist/session/discovery/publication.d.ts +0 -24
- package/dist/session/discovery/publication.d.ts.map +0 -1
- package/dist/session/discovery/publication.js +0 -124
- package/dist/session/discovery/publication.js.map +0 -1
- package/dist/session/discovery/snapshot.d.ts.map +0 -1
- package/dist/session/discovery/snapshot.js.map +0 -1
- package/dist/session/discovery/transport.d.ts.map +0 -1
- package/dist/session/discovery/transport.js.map +0 -1
- package/dist/session/index.d.ts.map +0 -1
- package/dist/session/index.js.map +0 -1
- package/dist/session/reference.d.ts.map +0 -1
- package/dist/session/reference.js.map +0 -1
- package/dist/session/routing/auth.d.ts.map +0 -1
- package/dist/session/routing/auth.js.map +0 -1
- package/dist/session/routing/cache.d.ts.map +0 -1
- package/dist/session/routing/cache.js.map +0 -1
- package/dist/session/routing/dispatch.d.ts.map +0 -1
- package/dist/session/routing/dispatch.js.map +0 -1
- package/dist/session/routing/envelope.d.ts.map +0 -1
- package/dist/session/routing/envelope.js.map +0 -1
- package/dist/session/routing/expectation.d.ts +0 -7
- package/dist/session/routing/expectation.d.ts.map +0 -1
- package/dist/session/routing/expectation.js +0 -2
- package/dist/session/routing/expectation.js.map +0 -1
- package/dist/session/routing/index.d.ts.map +0 -1
- package/dist/session/routing/index.js.map +0 -1
- package/dist/session/routing/request.d.ts.map +0 -1
- package/dist/session/routing/request.js.map +0 -1
- package/dist/session/session.d.ts.map +0 -1
- package/dist/session/session.js.map +0 -1
- package/dist/session/session.typecheck.d.ts.map +0 -1
- package/dist/session/session.typecheck.js.map +0 -1
- package/dist/session/views/catalog.d.ts.map +0 -1
- package/dist/session/views/catalog.js.map +0 -1
- package/dist/session/views/index.d.ts.map +0 -1
- package/dist/session/views/index.js.map +0 -1
- package/dist/session/views/resolve.d.ts.map +0 -1
- package/dist/session/views/resolve.js.map +0 -1
- package/dist/store/entity-index.d.ts.map +0 -1
- package/dist/store/entity-index.js.map +0 -1
- package/dist/store/index.d.ts.map +0 -1
- package/dist/store/index.js.map +0 -1
- package/dist/store/memory.d.ts.map +0 -1
- package/dist/store/memory.js.map +0 -1
- package/dist/store/mutation.d.ts.map +0 -1
- package/dist/store/mutation.js.map +0 -1
- package/dist/store/observe.d.ts.map +0 -1
- package/dist/store/observe.js.map +0 -1
- package/dist/store/optimistic.d.ts.map +0 -1
- package/dist/store/optimistic.js.map +0 -1
- package/dist/store/query-key.d.ts.map +0 -1
- package/dist/store/query-key.js.map +0 -1
- package/dist/store/shape.d.ts.map +0 -1
- package/dist/store/shape.js.map +0 -1
- package/dist/store/store.d.ts.map +0 -1
- package/dist/store/store.js.map +0 -1
- package/dist/store/store.typecheck.d.ts.map +0 -1
- package/dist/store/store.typecheck.js.map +0 -1
- package/dist/transport/auto/decision.d.ts.map +0 -1
- package/dist/transport/auto/decision.js.map +0 -1
- package/dist/transport/auto/fallback.d.ts.map +0 -1
- package/dist/transport/auto/fallback.js.map +0 -1
- package/dist/transport/auto/index.d.ts.map +0 -1
- package/dist/transport/auto/index.js.map +0 -1
- package/dist/transport/auto/transport.d.ts.map +0 -1
- package/dist/transport/auto/transport.js.map +0 -1
- package/dist/transport/auto/warning.d.ts.map +0 -1
- package/dist/transport/auto/warning.js.map +0 -1
- package/dist/transport/deadline.d.ts.map +0 -1
- package/dist/transport/deadline.js.map +0 -1
- package/dist/transport/failure.d.ts.map +0 -1
- package/dist/transport/failure.js.map +0 -1
- package/dist/transport/http/index.d.ts.map +0 -1
- package/dist/transport/http/index.js.map +0 -1
- package/dist/transport/http/response.d.ts.map +0 -1
- package/dist/transport/http/response.js.map +0 -1
- package/dist/transport/http/stream.d.ts.map +0 -1
- package/dist/transport/http/stream.js.map +0 -1
- package/dist/transport/http/transport.d.ts.map +0 -1
- package/dist/transport/http/transport.js.map +0 -1
- package/dist/transport/index.d.ts.map +0 -1
- package/dist/transport/index.js.map +0 -1
- package/dist/transport/transport.d.ts.map +0 -1
- package/dist/transport/transport.js.map +0 -1
- package/dist/transport/websocket/connection.d.ts.map +0 -1
- package/dist/transport/websocket/connection.js.map +0 -1
- package/dist/transport/websocket/exchange.d.ts.map +0 -1
- package/dist/transport/websocket/exchange.js.map +0 -1
- package/dist/transport/websocket/index.d.ts.map +0 -1
- package/dist/transport/websocket/index.js.map +0 -1
- package/dist/transport/websocket/transport.d.ts.map +0 -1
- package/dist/transport/websocket/transport.js.map +0 -1
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { invocation } from '@astrale-os/kernel-protocol';
|
|
2
|
+
import { credentialExpiry, refreshBoundary } from './expiry.js';
|
|
3
|
+
/** Snapshot and receiver-bind a caller's route store. */
|
|
4
|
+
export function captureRouteStore(input) {
|
|
5
|
+
if (input === null ||
|
|
6
|
+
typeof input !== 'object' ||
|
|
7
|
+
typeof input.read !== 'function' ||
|
|
8
|
+
typeof input.write !== 'function') {
|
|
9
|
+
throw new TypeError('Session route store capability is invalid.');
|
|
10
|
+
}
|
|
11
|
+
const read = input.read;
|
|
12
|
+
const write = input.write;
|
|
13
|
+
return Object.freeze({
|
|
14
|
+
read: () => read.call(input),
|
|
15
|
+
write: (artifact) => write.call(input, artifact),
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Re-admit the entries of a stored artifact in their stored order. An unsupported artifact, or
|
|
20
|
+
* one holding more than `maximumSize` entries, restores nothing; an invalid entry is skipped.
|
|
21
|
+
*/
|
|
22
|
+
export function restoreRoutes(input, now, maximumAgeMs, maximumSize) {
|
|
23
|
+
const restored = new Map();
|
|
24
|
+
if (typeof input !== 'object' || input === null || Array.isArray(input))
|
|
25
|
+
return restored;
|
|
26
|
+
const artifact = input;
|
|
27
|
+
if (artifact.version !== 1 ||
|
|
28
|
+
typeof artifact.entries !== 'object' ||
|
|
29
|
+
artifact.entries === null ||
|
|
30
|
+
Array.isArray(artifact.entries)) {
|
|
31
|
+
return restored;
|
|
32
|
+
}
|
|
33
|
+
let count = 0;
|
|
34
|
+
for (const key in artifact.entries) {
|
|
35
|
+
if (!Object.hasOwn(artifact.entries, key))
|
|
36
|
+
continue;
|
|
37
|
+
count += 1;
|
|
38
|
+
if (count > maximumSize)
|
|
39
|
+
return new Map();
|
|
40
|
+
const value = Reflect.get(artifact.entries, key);
|
|
41
|
+
const entry = admitStoredEntry(value, now, maximumAgeMs);
|
|
42
|
+
if (entry !== undefined)
|
|
43
|
+
restored.set(key, entry);
|
|
44
|
+
}
|
|
45
|
+
return restored;
|
|
46
|
+
}
|
|
47
|
+
/** The artifact persisting every integrity-bound entry, as it was sealed. */
|
|
48
|
+
export function routeArtifact(entries) {
|
|
49
|
+
const persisted = Object.fromEntries([...entries].flatMap(([key, cached]) => cached.integrity === undefined
|
|
50
|
+
? []
|
|
51
|
+
: [
|
|
52
|
+
[
|
|
53
|
+
key,
|
|
54
|
+
Object.freeze({
|
|
55
|
+
...(cached.sealed ?? cached.learned),
|
|
56
|
+
integrity: cached.integrity,
|
|
57
|
+
}),
|
|
58
|
+
],
|
|
59
|
+
]));
|
|
60
|
+
return Object.freeze({ version: 1, entries: Object.freeze(persisted) });
|
|
61
|
+
}
|
|
62
|
+
function admitStoredEntry(input, now, maximumAgeMs) {
|
|
63
|
+
try {
|
|
64
|
+
if (typeof input !== 'object' || input === null || Array.isArray(input))
|
|
65
|
+
return undefined;
|
|
66
|
+
const value = input;
|
|
67
|
+
if ((value.credential !== undefined && typeof value.credential !== 'string') ||
|
|
68
|
+
typeof value.expiresAt !== 'number' ||
|
|
69
|
+
!Number.isSafeInteger(value.expiresAt) ||
|
|
70
|
+
typeof value.integrity !== 'string' ||
|
|
71
|
+
!/^[A-Za-z0-9_-]{43}$/u.test(value.integrity)) {
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
74
|
+
const expiry = value.credential === undefined ? undefined : credentialExpiry(value.credential);
|
|
75
|
+
if (value.credential !== undefined && expiry === undefined)
|
|
76
|
+
return undefined;
|
|
77
|
+
const sealed = Object.freeze({
|
|
78
|
+
route: invocation.acceptRoute(value.route),
|
|
79
|
+
...(value.credential === undefined ? {} : { credential: value.credential }),
|
|
80
|
+
expiresAt: value.expiresAt,
|
|
81
|
+
});
|
|
82
|
+
const expiresAt = Math.min(value.expiresAt, now + maximumAgeMs, refreshBoundary(expiry));
|
|
83
|
+
if (expiresAt <= now)
|
|
84
|
+
return undefined;
|
|
85
|
+
return Object.freeze({
|
|
86
|
+
learned: Object.freeze({
|
|
87
|
+
route: sealed.route,
|
|
88
|
+
...(sealed.credential === undefined ? {} : { credential: sealed.credential }),
|
|
89
|
+
expiresAt,
|
|
90
|
+
}),
|
|
91
|
+
sealed,
|
|
92
|
+
integrity: value.integrity,
|
|
93
|
+
...(expiry === undefined ? {} : { credentialRefreshBoundary: refreshBoundary(expiry) }),
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
catch {
|
|
97
|
+
return undefined;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
@@ -1,35 +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 { Key } from '@astrale-os/kernel-dsl/v1';
|
|
4
3
|
import type { Domain } from '@astrale-os/kernel-dsl/v1/domain';
|
|
4
|
+
import type { AuthApi } from '../auth/index.js';
|
|
5
5
|
import type { Call, Input, Result } from '../client/index.js';
|
|
6
6
|
import type { DomainBinding, GraphApi } from '../graph/index.js';
|
|
7
|
-
import type {
|
|
8
|
-
import type {
|
|
9
|
-
import type { ClientWarning } from '../transport/auto/index.js';
|
|
10
|
-
import type { Fetch } from '../transport/http/index.js';
|
|
11
|
-
import type { WebSocketConstructor } from '../transport/websocket/index.js';
|
|
7
|
+
import type { SchemaApi } from '../schema/index.js';
|
|
8
|
+
import type { ContentApi } from './content/index.js';
|
|
12
9
|
import type { SessionControlOptions, SessionPolicy } from './context/index.js';
|
|
13
|
-
import type {
|
|
14
|
-
import type {
|
|
15
|
-
import type {
|
|
10
|
+
import type { SessionCredential } from './credential/index.js';
|
|
11
|
+
import type { IntrinsicRelease, SessionSnapshot } from './discovery/index.js';
|
|
12
|
+
import type { SessionExchangeRequest } from './exchange/index.js';
|
|
13
|
+
import type { CallableReference, InputModeOfReference, InputOfReference, OutputOfReference } from './reference.js';
|
|
14
|
+
import type { SessionRequestOptions, SessionRequestOptionsWithBody } from './routing/index.js';
|
|
16
15
|
import type { ViewCatalog } from './views/index.js';
|
|
17
|
-
|
|
18
|
-
/** Exact canonical source Kernel identity; its invocation and discovery endpoints are derived. */
|
|
19
|
-
readonly kernel: string;
|
|
20
|
-
readonly fetch?: Fetch;
|
|
21
|
-
readonly client?: ClientFactory;
|
|
22
|
-
readonly pool?: Pick<ClientPoolType, 'clientFor'>;
|
|
23
|
-
readonly websocket?: WebSocketConstructor;
|
|
24
|
-
readonly auth?: SessionAuth;
|
|
25
|
-
readonly policy: SessionPolicy;
|
|
26
|
-
readonly envelopeTransport?: SessionEnvelopeTransport;
|
|
27
|
-
readonly onWarning?: (warning: ClientWarning) => void;
|
|
28
|
-
readonly maximumPublicationBytes?: number;
|
|
29
|
-
readonly maximumBundleBytes?: number;
|
|
30
|
-
readonly maximumResponseBytes?: number;
|
|
31
|
-
readonly timeoutMs?: number;
|
|
32
|
-
}
|
|
16
|
+
import { type ClientSessionOptions } from './options.js';
|
|
33
17
|
export type ConnectOptions = Omit<ClientSessionOptions, 'kernel' | 'policy'> & {
|
|
34
18
|
readonly url: string;
|
|
35
19
|
readonly policy?: SessionPolicy;
|
|
@@ -39,30 +23,50 @@ export declare class ClientSession {
|
|
|
39
23
|
readonly kernel: IssuerId;
|
|
40
24
|
readonly schema: SchemaApi;
|
|
41
25
|
readonly graph: GraphApi;
|
|
42
|
-
|
|
26
|
+
readonly auth: AuthApi;
|
|
27
|
+
readonly content: ContentApi;
|
|
28
|
+
private readonly ownedPool;
|
|
43
29
|
private readonly discovery;
|
|
44
30
|
private readonly dispatcher;
|
|
45
31
|
private readonly lifecycle;
|
|
46
32
|
private readonly timeoutMs;
|
|
47
33
|
private readonly routes;
|
|
48
|
-
private readonly
|
|
34
|
+
private readonly exchangeDependencies;
|
|
35
|
+
private readonly callExchange?;
|
|
36
|
+
private readonly admitDomainViews;
|
|
49
37
|
private closed;
|
|
50
38
|
constructor(options: ClientSessionOptions);
|
|
51
39
|
/** Bind one admitted DSL Domain to authenticated graph projection and Method dispatch. */
|
|
52
40
|
bind<const DomainValue extends Domain>(domain: DomainValue): DomainBinding<DomainValue>;
|
|
41
|
+
/**
|
|
42
|
+
* Delegate this Session's caller to one Domain issuer and exchange that delegation for the
|
|
43
|
+
* Domain's credential to this Kernel. Nothing is cached: hold the result, for example through
|
|
44
|
+
* `credentials`, for as long as it covers the calls it carries.
|
|
45
|
+
*/
|
|
46
|
+
exchange(domain: string, options?: SessionExchangeRequest): Promise<SessionCredential>;
|
|
47
|
+
/**
|
|
48
|
+
* Revalidate the source Kernel's own release (`release.json`) without acquiring its bundle or Views.
|
|
49
|
+
*/
|
|
50
|
+
release(options?: SessionControlOptions): Promise<IntrinsicRelease>;
|
|
53
51
|
snapshot(options?: SessionControlOptions): Promise<SessionSnapshot>;
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
/**
|
|
53
|
+
* Resolve the View catalog of one installed Domain. Only an exact Domain Path `/:<origin>` is
|
|
54
|
+
* accepted; any other Path rejects with a TypeError before the call.
|
|
55
|
+
*/
|
|
56
|
+
viewsFor(domain: PathLike, options?: SessionControlOptions): Promise<ViewCatalog>;
|
|
56
57
|
dispatch(call: Call, options?: SessionRequestOptions): Promise<Result>;
|
|
58
|
+
dispatch(call: Call, options: SessionRequestOptionsWithBody): Promise<Result>;
|
|
57
59
|
call(call: Call, options?: SessionRequestOptions): Promise<Input>;
|
|
58
|
-
|
|
60
|
+
call(call: Call, options: SessionRequestOptionsWithBody): Promise<Input>;
|
|
61
|
+
invoke<const Reference extends CallableReference<unknown>>(reference: InputModeOfReference<Reference> extends 'binary' ? never : Reference, input: InputOfReference<Reference>, options?: SessionRequestOptions): Promise<OutputOfReference<Reference>>;
|
|
62
|
+
invoke<const Reference extends CallableReference<unknown, unknown, 'binary'>>(reference: Reference, input: InputOfReference<Reference>, options: SessionRequestOptionsWithBody): Promise<OutputOfReference<Reference>>;
|
|
63
|
+
private dispatchWith;
|
|
59
64
|
stream(call: Call, options?: SessionRequestOptions): Promise<import("../client/result.js").Stream>;
|
|
60
|
-
binary(call: Call, options?: SessionRequestOptions): Promise<import("@astrale-os/kernel-core/callable").
|
|
65
|
+
binary(call: Call, options?: SessionRequestOptions): Promise<import("@astrale-os/kernel-core/callable").BinaryOutput>;
|
|
61
66
|
close(): void;
|
|
62
67
|
private requireOpen;
|
|
63
68
|
private invokeDomainMethod;
|
|
64
69
|
private operation;
|
|
65
70
|
}
|
|
66
|
-
/** Open
|
|
71
|
+
/** Open a Kernel conversation with secure defaults and automatic Domain exchange when authenticated. */
|
|
67
72
|
export declare function connect(options: ConnectOptions): ClientSession;
|
|
68
|
-
//# sourceMappingURL=session.d.ts.map
|
package/dist/session/session.js
CHANGED
|
@@ -1,158 +1,189 @@
|
|
|
1
1
|
import { Path } from '@astrale-os/kernel-core/path';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { callableFingerprint } from '@astrale-os/kernel-dsl/v1/schema/fingerprint';
|
|
3
|
+
import { createAuth } from '../auth/auth.js';
|
|
4
|
+
import { acceptCall } from '../client/index.js';
|
|
5
|
+
import { SessionError } from '../errors/index.js';
|
|
4
6
|
import { createDomainBinding } from '../graph/domain/binding.js';
|
|
5
7
|
import { createGraph } from '../graph/index.js';
|
|
6
|
-
import { ClientPool } from '../pool/index.js';
|
|
7
8
|
import { createSchema } from '../schema/index.js';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { admitControlOptions, admitPolicy, createSessionOperation, DEFAULT_MAXIMUM_BUNDLE_BYTES, DEFAULT_MAXIMUM_PUBLICATION_BYTES, DEFAULT_MAXIMUM_RESPONSE_BYTES, DEFAULT_TIMEOUT_MS, admitKernel, kernelInvocationEndpoint, platformDuration, positive, } from './context/index.js';
|
|
9
|
+
import { admitFunction } from './admission.js';
|
|
10
|
+
import { createContentApi } from './content/index.js';
|
|
11
|
+
import { admitControlOptions, allowEndpoint, createSessionOperation } from './context/index.js';
|
|
12
12
|
import { createSessionDiscovery } from './discovery/index.js';
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
13
|
+
import { acquireDomainCredential, admitExchangeRequest, createSessionExchange, } from './exchange/index.js';
|
|
14
|
+
import { acceptSessionOptions } from './options.js';
|
|
15
|
+
import { admitReference, outputModeOf } from './reference.js';
|
|
16
|
+
import { admitInvocationOptions, requireResultKind, SessionDispatcher } from './routing/index.js';
|
|
17
|
+
import { domainViewCatalog, resolveViewsFor } from './views/index.js';
|
|
16
18
|
const DEFAULT_SESSION_POLICY = Object.freeze({ maximumRouteAgeMs: 60_000 });
|
|
17
19
|
/** Caller-owned discovery and redirect-following conversation with one exact source Kernel. */
|
|
18
20
|
export class ClientSession {
|
|
19
21
|
kernel;
|
|
20
22
|
schema;
|
|
21
23
|
graph;
|
|
24
|
+
auth;
|
|
25
|
+
content;
|
|
22
26
|
ownedPool;
|
|
23
27
|
discovery;
|
|
24
28
|
dispatcher;
|
|
25
29
|
lifecycle = new AbortController();
|
|
26
30
|
timeoutMs;
|
|
27
31
|
routes;
|
|
28
|
-
|
|
32
|
+
exchangeDependencies;
|
|
33
|
+
callExchange;
|
|
34
|
+
admitDomainViews;
|
|
29
35
|
closed = false;
|
|
30
36
|
constructor(options) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
this.
|
|
36
|
-
this.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
if (typeof fetch !== 'function')
|
|
40
|
-
throw new TypeError('ClientSession requires Fetch.');
|
|
41
|
-
const fetchImpl = options.fetch === undefined ? fetch.bind(globalThis) : fetch;
|
|
42
|
-
if (options.client !== undefined && options.pool !== undefined) {
|
|
43
|
-
throw new TypeError('ClientSession accepts either client or pool, not both.');
|
|
44
|
-
}
|
|
45
|
-
const maximumPublicationBytes = positive(options.maximumPublicationBytes ?? DEFAULT_MAXIMUM_PUBLICATION_BYTES, 'maximumPublicationBytes');
|
|
46
|
-
const maximumBundleBytes = positive(options.maximumBundleBytes ?? DEFAULT_MAXIMUM_BUNDLE_BYTES, 'maximumBundleBytes');
|
|
47
|
-
const maximumResponseBytes = positive(options.maximumResponseBytes ?? DEFAULT_MAXIMUM_RESPONSE_BYTES, 'maximumResponseBytes');
|
|
48
|
-
const timeoutMs = platformDuration(options.timeoutMs ?? DEFAULT_TIMEOUT_MS, 'timeoutMs');
|
|
49
|
-
this.timeoutMs = timeoutMs;
|
|
50
|
-
const websocketAvailable = options.client !== undefined ||
|
|
51
|
-
options.pool !== undefined ||
|
|
52
|
-
options.websocket !== undefined ||
|
|
53
|
-
typeof globalThis.WebSocket === 'function';
|
|
54
|
-
const client = options.client ??
|
|
55
|
-
defaultClientFactory({
|
|
56
|
-
fetch: fetchImpl,
|
|
57
|
-
...(options.websocket === undefined ? {} : { websocket: options.websocket }),
|
|
58
|
-
...(options.onWarning === undefined ? {} : { onWarning: options.onWarning }),
|
|
59
|
-
maximumResponseBytes,
|
|
60
|
-
timeoutMs,
|
|
61
|
-
});
|
|
62
|
-
let pool;
|
|
63
|
-
if (options.pool === undefined) {
|
|
64
|
-
const ownedPool = new ClientPool({ client });
|
|
65
|
-
this.ownedPool = ownedPool;
|
|
66
|
-
pool = admitClientPool(ownedPool);
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
pool = admitClientPool(options.pool);
|
|
70
|
-
}
|
|
37
|
+
const settled = acceptSessionOptions(options);
|
|
38
|
+
const { kernel, sourceEndpoint, policy, fetch, pool, auth } = settled;
|
|
39
|
+
const { maximumReleaseBytes, maximumBundleBytes, maximumResponseBytes } = settled;
|
|
40
|
+
this.kernel = kernel;
|
|
41
|
+
this.timeoutMs = settled.timeoutMs;
|
|
42
|
+
this.ownedPool = settled.ownedPool;
|
|
43
|
+
this.routes = settled.routes;
|
|
44
|
+
this.admitDomainViews = (input, domain) => domainViewCatalog(input, domain, policy);
|
|
71
45
|
this.discovery = createSessionDiscovery({
|
|
72
|
-
kernel
|
|
73
|
-
fetch
|
|
46
|
+
kernel,
|
|
47
|
+
fetch,
|
|
74
48
|
policy,
|
|
75
|
-
|
|
49
|
+
maximumReleaseBytes,
|
|
76
50
|
maximumBundleBytes,
|
|
77
51
|
requireOpen: () => this.requireOpen(),
|
|
78
52
|
acquisitionOperation: () => this.operation(undefined),
|
|
79
53
|
});
|
|
80
|
-
this.
|
|
54
|
+
this.exchangeDependencies = Object.freeze({
|
|
55
|
+
kernel,
|
|
56
|
+
source: () => {
|
|
57
|
+
allowEndpoint(sourceEndpoint, policy);
|
|
58
|
+
return pool.clientFor({ transport: 'http', url: sourceEndpoint });
|
|
59
|
+
},
|
|
60
|
+
...(auth === undefined ? {} : { auth }),
|
|
61
|
+
fetch,
|
|
62
|
+
policy,
|
|
63
|
+
limits: { maximumReleaseBytes, maximumBundleBytes },
|
|
64
|
+
maximumResponseBytes,
|
|
65
|
+
operation: (signal) => this.operation(signal === undefined ? undefined : { signal }),
|
|
66
|
+
});
|
|
67
|
+
this.callExchange =
|
|
68
|
+
settled.exchange === undefined || auth === undefined
|
|
69
|
+
? undefined
|
|
70
|
+
: createSessionExchange({ ...this.exchangeDependencies, auth }, settled.exchange);
|
|
81
71
|
this.dispatcher = new SessionDispatcher({
|
|
82
|
-
kernel
|
|
72
|
+
kernel,
|
|
83
73
|
sourceEndpoint,
|
|
84
74
|
pool,
|
|
85
|
-
websocketAvailable,
|
|
86
|
-
auth
|
|
75
|
+
websocketAvailable: settled.websocketAvailable,
|
|
76
|
+
auth,
|
|
77
|
+
...(this.callExchange === undefined ? {} : { exchange: this.callExchange }),
|
|
87
78
|
cache: this.routes,
|
|
88
79
|
policy,
|
|
89
|
-
envelopeTransport:
|
|
90
|
-
discovery: this.discovery,
|
|
80
|
+
envelopeTransport: settled.envelopeTransport,
|
|
91
81
|
requireOpen: () => this.requireOpen(),
|
|
82
|
+
streamingHttp: {
|
|
83
|
+
fetch,
|
|
84
|
+
maximumResponseBytes: 100 * 1024 * 1024,
|
|
85
|
+
timeoutMs: 30 * 60 * 1_000,
|
|
86
|
+
},
|
|
87
|
+
});
|
|
88
|
+
this.content = createContentApi({
|
|
89
|
+
operation: (options) => this.operation(options),
|
|
90
|
+
dispatch: (target, input, operation, body) => this.dispatcher.dispatchHttp({ target, input }, {}, operation, body),
|
|
92
91
|
});
|
|
93
92
|
this.schema = createSchema((request, options) => this.dispatch(request, options), {
|
|
94
|
-
|
|
93
|
+
maximumReleaseBytes,
|
|
95
94
|
maximumBundleBytes,
|
|
95
|
+
lifecycleTimeoutMs: settled.schemaLifecycleTimeoutMs,
|
|
96
96
|
});
|
|
97
97
|
this.graph = createGraph((call, options) => this.call(call, options));
|
|
98
|
+
this.auth = createAuth((target, input, options) => this.call({ target, input }, options), (call, options) => {
|
|
99
|
+
const operation = this.operation(admitControlOptions(options));
|
|
100
|
+
return admitFunction(this.exchangeDependencies, acceptCall(call), operation);
|
|
101
|
+
});
|
|
98
102
|
}
|
|
99
103
|
/** Bind one admitted DSL Domain to authenticated graph projection and Method dispatch. */
|
|
100
104
|
bind(domain) {
|
|
101
105
|
return createDomainBinding(domain, this.graph, (node, method, input) => this.invokeDomainMethod(domain, node, method, input));
|
|
102
106
|
}
|
|
107
|
+
/**
|
|
108
|
+
* Delegate this Session's caller to one Domain issuer and exchange that delegation for the
|
|
109
|
+
* Domain's credential to this Kernel. Nothing is cached: hold the result, for example through
|
|
110
|
+
* `credentials`, for as long as it covers the calls it carries.
|
|
111
|
+
*/
|
|
112
|
+
async exchange(domain, options) {
|
|
113
|
+
const request = admitExchangeRequest(domain, options);
|
|
114
|
+
return acquireDomainCredential(this.exchangeDependencies, request, this.operation(request.control));
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Revalidate the source Kernel's own release (`release.json`) without acquiring its bundle or Views.
|
|
118
|
+
*/
|
|
119
|
+
release(options) {
|
|
120
|
+
return this.discovery.release(this.operation(admitControlOptions(options)));
|
|
121
|
+
}
|
|
103
122
|
snapshot(options) {
|
|
104
123
|
return this.discovery.snapshot(this.operation(admitControlOptions(options)));
|
|
105
124
|
}
|
|
106
|
-
|
|
125
|
+
/**
|
|
126
|
+
* Resolve the View catalog of one installed Domain. Only an exact Domain Path `/:<origin>` is
|
|
127
|
+
* accepted; any other Path rejects with a TypeError before the call.
|
|
128
|
+
*/
|
|
129
|
+
viewsFor(domain, options) {
|
|
107
130
|
this.requireOpen();
|
|
108
|
-
return resolveViewsFor(async (call, operation) => requireResultKind('value', await this.dispatcher.dispatch(call, {}, operation)).value, this.
|
|
109
|
-
}
|
|
110
|
-
async installation(origin, options) {
|
|
111
|
-
const result = await this.schema.introspect({
|
|
112
|
-
from: { kind: 'installation', origin },
|
|
113
|
-
select: {
|
|
114
|
-
state: true,
|
|
115
|
-
target: true,
|
|
116
|
-
source: true,
|
|
117
|
-
bundle: true,
|
|
118
|
-
readiness: true,
|
|
119
|
-
capabilities: true,
|
|
120
|
-
},
|
|
121
|
-
}, options);
|
|
122
|
-
if (result?.state !== 'ready' || result.readiness === null) {
|
|
123
|
-
throw new ClientError(`Domain ${origin} is not ready on this Kernel.`);
|
|
124
|
-
}
|
|
125
|
-
return result;
|
|
131
|
+
return resolveViewsFor(async (call, operation) => requireResultKind('value', await this.dispatcher.dispatch(call, {}, operation)).value, this.admitDomainViews, domain, this.operation(admitControlOptions(options)));
|
|
126
132
|
}
|
|
127
133
|
dispatch(call, options) {
|
|
128
|
-
|
|
129
|
-
return this.dispatcher.dispatch(call, admitted, this.operation(admitted));
|
|
134
|
+
return this.dispatchWith(call, options);
|
|
130
135
|
}
|
|
131
136
|
async call(call, options) {
|
|
132
|
-
const result = await this.
|
|
137
|
+
const result = await this.dispatchWith(call, options);
|
|
133
138
|
return requireResultKind('value', result).value;
|
|
134
139
|
}
|
|
135
140
|
async invoke(reference, input, options) {
|
|
136
141
|
const admittedReference = admitReference(reference);
|
|
137
|
-
const
|
|
138
|
-
const
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
142
|
+
const admitted = admitInvocationOptions(options);
|
|
143
|
+
const { anchor, steps } = admittedReference.target.ast;
|
|
144
|
+
const last = steps.at(-1);
|
|
145
|
+
const instance = last?.kind === 'method' && last.dispatch === 'instance'
|
|
146
|
+
? Path.fromAST({ anchor, steps: steps.slice(0, -1) }).raw
|
|
147
|
+
: undefined;
|
|
148
|
+
// A generated reference pins the callable meaning; a Kernel reference pins nothing, like every
|
|
149
|
+
// other syscall the Session addresses.
|
|
150
|
+
const call = {
|
|
151
|
+
target: Object.freeze({
|
|
152
|
+
callable: admittedReference.callable,
|
|
153
|
+
...(admittedReference.fingerprint === undefined
|
|
154
|
+
? {}
|
|
155
|
+
: { fingerprint: admittedReference.fingerprint }),
|
|
156
|
+
...(instance === undefined ? {} : { instance }),
|
|
157
|
+
}),
|
|
158
|
+
input,
|
|
159
|
+
};
|
|
160
|
+
const operation = this.operation(admitted.options);
|
|
161
|
+
const result = await (admitted.body === undefined && admittedReference.outputMode !== 'binary'
|
|
162
|
+
? this.dispatcher.dispatch(call, admitted.options, operation)
|
|
163
|
+
: this.dispatcher.dispatchHttp(call, admitted.options, operation, admitted.body));
|
|
143
164
|
const narrowed = requireResultKind(admittedReference.outputMode, result);
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
: narrowed.
|
|
165
|
+
switch (narrowed.kind) {
|
|
166
|
+
case 'stream':
|
|
167
|
+
return narrowed.stream;
|
|
168
|
+
case 'execution':
|
|
169
|
+
return Object.freeze({ id: narrowed.execution });
|
|
170
|
+
default:
|
|
171
|
+
return narrowed.value;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
dispatchWith(call, options, requireHttp = false) {
|
|
175
|
+
const admitted = admitInvocationOptions(options);
|
|
176
|
+
const operation = this.operation(admitted.options);
|
|
177
|
+
return admitted.body === undefined && !requireHttp
|
|
178
|
+
? this.dispatcher.dispatch(call, admitted.options, operation)
|
|
179
|
+
: this.dispatcher.dispatchHttp(call, admitted.options, operation, admitted.body);
|
|
149
180
|
}
|
|
150
181
|
async stream(call, options) {
|
|
151
182
|
const result = await this.dispatch(call, options);
|
|
152
183
|
return requireResultKind('stream', result).stream;
|
|
153
184
|
}
|
|
154
185
|
async binary(call, options) {
|
|
155
|
-
const result = await this.
|
|
186
|
+
const result = await this.dispatchWith(call, options, true);
|
|
156
187
|
return requireResultKind('binary', result).value;
|
|
157
188
|
}
|
|
158
189
|
close() {
|
|
@@ -163,6 +194,7 @@ export class ClientSession {
|
|
|
163
194
|
this.ownedPool?.close();
|
|
164
195
|
this.routes.clear();
|
|
165
196
|
this.discovery.clear();
|
|
197
|
+
this.callExchange?.clear();
|
|
166
198
|
}
|
|
167
199
|
requireOpen() {
|
|
168
200
|
if (this.closed)
|
|
@@ -177,10 +209,10 @@ export class ClientSession {
|
|
|
177
209
|
throw new TypeError(`Method owner ${method.owner.ref.origin} is absent.`);
|
|
178
210
|
return this.invoke({
|
|
179
211
|
origin: owner.origin,
|
|
180
|
-
|
|
212
|
+
fingerprint: callableFingerprint(method),
|
|
181
213
|
callable: method.key,
|
|
182
|
-
target: Path.instanceMethod(Path.id(node.id), method.
|
|
183
|
-
outputMode: method
|
|
214
|
+
target: Path.instanceMethod(Path.id(node.id), method.key),
|
|
215
|
+
outputMode: outputModeOf(method),
|
|
184
216
|
}, input);
|
|
185
217
|
}
|
|
186
218
|
operation(options) {
|
|
@@ -188,71 +220,16 @@ export class ClientSession {
|
|
|
188
220
|
return createSessionOperation(this.lifecycle.signal, options, this.timeoutMs);
|
|
189
221
|
}
|
|
190
222
|
}
|
|
191
|
-
/** Open
|
|
223
|
+
/** Open a Kernel conversation with secure defaults and automatic Domain exchange when authenticated. */
|
|
192
224
|
export function connect(options) {
|
|
193
225
|
if (options === null || typeof options !== 'object') {
|
|
194
226
|
throw new TypeError('Connect options are invalid.');
|
|
195
227
|
}
|
|
196
|
-
const { url, ...rest } = options;
|
|
228
|
+
const { url, exchange, ...rest } = options;
|
|
197
229
|
return new ClientSession({
|
|
198
230
|
...rest,
|
|
199
231
|
kernel: url,
|
|
200
|
-
|
|
232
|
+
exchange: exchange === undefined && rest.auth !== undefined ? { mode: 'auto' } : exchange,
|
|
233
|
+
policy: rest.policy ?? DEFAULT_SESSION_POLICY,
|
|
201
234
|
});
|
|
202
235
|
}
|
|
203
|
-
function admitClientPool(input) {
|
|
204
|
-
if (input === null ||
|
|
205
|
-
typeof input !== 'object' ||
|
|
206
|
-
typeof input.clientFor !== 'function') {
|
|
207
|
-
throw new TypeError('Session client pool capability is invalid.');
|
|
208
|
-
}
|
|
209
|
-
return Object.freeze({
|
|
210
|
-
clientFor: (target) => admitPooledClient(input.clientFor.call(input, target)),
|
|
211
|
-
});
|
|
212
|
-
}
|
|
213
|
-
function admitPooledClient(input) {
|
|
214
|
-
if (input === null ||
|
|
215
|
-
typeof input !== 'object' ||
|
|
216
|
-
typeof input.dispatch !== 'function' ||
|
|
217
|
-
typeof input.as !== 'function' ||
|
|
218
|
-
typeof input.close !== 'function') {
|
|
219
|
-
throw new TypeError('Session client pool capability returned an invalid Client.');
|
|
220
|
-
}
|
|
221
|
-
return input;
|
|
222
|
-
}
|
|
223
|
-
function defaultClientFactory(options) {
|
|
224
|
-
return (target) => {
|
|
225
|
-
switch (target.transport) {
|
|
226
|
-
case 'http':
|
|
227
|
-
return new Client({
|
|
228
|
-
transport: new HttpTransport({
|
|
229
|
-
url: target.url,
|
|
230
|
-
fetch: options.fetch,
|
|
231
|
-
timeoutMs: options.timeoutMs,
|
|
232
|
-
maximumResponseBytes: options.maximumResponseBytes,
|
|
233
|
-
}),
|
|
234
|
-
});
|
|
235
|
-
case 'websocket':
|
|
236
|
-
return new Client({
|
|
237
|
-
transport: new WebSocketTransport({
|
|
238
|
-
url: target.url,
|
|
239
|
-
timeoutMs: options.timeoutMs,
|
|
240
|
-
maximumResponseBytes: options.maximumResponseBytes,
|
|
241
|
-
...(options.websocket === undefined ? {} : { websocket: options.websocket }),
|
|
242
|
-
}),
|
|
243
|
-
});
|
|
244
|
-
case 'auto':
|
|
245
|
-
return new Client({
|
|
246
|
-
transport: new AutoTransport({
|
|
247
|
-
endpoints: target.endpoints,
|
|
248
|
-
fetch: options.fetch,
|
|
249
|
-
timeoutMs: options.timeoutMs,
|
|
250
|
-
maximumResponseBytes: options.maximumResponseBytes,
|
|
251
|
-
...(options.websocket === undefined ? {} : { websocket: options.websocket }),
|
|
252
|
-
...(options.onWarning === undefined ? {} : { onWarning: options.onWarning }),
|
|
253
|
-
}),
|
|
254
|
-
});
|
|
255
|
-
}
|
|
256
|
-
};
|
|
257
|
-
}
|
|
258
|
-
//# sourceMappingURL=session.js.map
|