@astrale-os/kernel-client 0.6.0-beta.9 → 1.0.0-beta.1
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 +2 -3
- package/dist/client/index.js +2 -3
- 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 +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 +1 -1
- package/dist/errors/index.js +1 -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/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 +0 -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 +0 -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 +15 -8
- 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 +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 +0 -1
- package/dist/schema/admission.js +0 -1
- package/dist/schema/contracts.d.ts +3 -4
- 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 +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 +16 -10
- package/dist/schema/schema.js +92 -13
- 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 +54 -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 +65 -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 +35 -20
- package/dist/session/reference.js +28 -11
- 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 +113 -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 +9 -1
- package/dist/session/routing/request.js +17 -1
- package/dist/session/routing/result.d.ts +5 -0
- package/dist/session/routing/result.js +12 -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 +126 -152
- 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 +40 -17
- 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 +101 -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 +10 -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 +0 -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
|
@@ -1,56 +1,73 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { bundleUrl, decodeBundle } from '@astrale-os/kernel-protocol/release';
|
|
2
2
|
import { ClientError } from '../../errors/index.js';
|
|
3
3
|
import { allowEndpoint } from '../context/index.js';
|
|
4
|
-
import { boundedResponse, requireExactResponse } from './
|
|
4
|
+
import { boundedResponse, requireExactResponse } from './response.js';
|
|
5
5
|
import { runAcquisition } from './transport.js';
|
|
6
|
+
/** Internal evidence that a selected immutable artifact is no longer served. */
|
|
7
|
+
export class BundleUnavailableError extends ClientError {
|
|
8
|
+
}
|
|
6
9
|
export class BundleDiscovery {
|
|
7
10
|
options;
|
|
8
|
-
|
|
11
|
+
retained;
|
|
9
12
|
constructor(options) {
|
|
10
13
|
this.options = options;
|
|
11
14
|
}
|
|
12
|
-
async get(
|
|
13
|
-
const key = bundleKey(
|
|
14
|
-
|
|
15
|
-
if (
|
|
16
|
-
return
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return retained;
|
|
15
|
+
async get(release, operation) {
|
|
16
|
+
const key = bundleKey(release);
|
|
17
|
+
allowEndpoint(release.schema.bundle.href, this.options.policy);
|
|
18
|
+
if (this.retained?.key === key)
|
|
19
|
+
return this.retained.value;
|
|
20
|
+
const value = await this.fetch(release, operation);
|
|
21
|
+
this.retained = { key, value };
|
|
22
|
+
return value;
|
|
21
23
|
}
|
|
22
24
|
clear() {
|
|
23
|
-
this.
|
|
25
|
+
this.retained = undefined;
|
|
24
26
|
}
|
|
25
|
-
async fetch(
|
|
26
|
-
if (
|
|
27
|
+
async fetch(release, operation) {
|
|
28
|
+
if (release.schema.bundle.ref.size > this.options.maximumBytes) {
|
|
27
29
|
throw new ClientError('Bundle artifact exceeds its byte limit.');
|
|
28
30
|
}
|
|
29
|
-
const href =
|
|
30
|
-
|
|
31
|
+
const href = release.schema.bundle.href;
|
|
32
|
+
const immutable = href === bundleUrl(release.identity.issuer, release.schema.bundle.ref);
|
|
31
33
|
const response = await runAcquisition(operation, 'bundle', 'unknown', 'Kernel bundle could not be retrieved.', (signal) => this.options.fetch(href, {
|
|
32
|
-
headers: { accept:
|
|
34
|
+
headers: { accept: release.schema.bundle.ref.mediaType },
|
|
35
|
+
// Omitting `cache` is the browser default; Workers reject the DOM-only 'default' mode.
|
|
36
|
+
cache: immutable ? undefined : 'no-cache',
|
|
33
37
|
redirect: 'manual',
|
|
34
38
|
signal,
|
|
35
39
|
}));
|
|
36
40
|
requireExactResponse(response, href, 'Bundle retrieval');
|
|
41
|
+
if (immutable && (response.status === 404 || response.status === 410)) {
|
|
42
|
+
// Cleanup must not hold discovery open on an injected body cancellation.
|
|
43
|
+
void response.body?.cancel().catch(() => undefined);
|
|
44
|
+
throw new BundleUnavailableError(`Bundle retrieval returned HTTP ${response.status}.`);
|
|
45
|
+
}
|
|
37
46
|
if (!response.ok)
|
|
38
47
|
throw new ClientError(`Bundle retrieval returned HTTP ${response.status}.`);
|
|
39
|
-
if (response.headers.get('content-type') !==
|
|
48
|
+
if (response.headers.get('content-type') !== release.schema.bundle.ref.mediaType) {
|
|
40
49
|
throw new ClientError('Bundle artifact media type differs from its descriptor.');
|
|
41
50
|
}
|
|
42
51
|
const etag = response.headers.get('etag');
|
|
43
|
-
if (etag !== null && etag !== `"${
|
|
52
|
+
if (etag !== null && etag !== `"${release.schema.bundle.ref.digest}"`) {
|
|
44
53
|
throw new ClientError('Bundle response ETag differs from its descriptor.');
|
|
45
54
|
}
|
|
46
|
-
const bytes = await runAcquisition(operation, 'bundle', 'receive', 'Kernel bundle response could not be read.', (signal) => boundedResponse(response,
|
|
47
|
-
if (bytes.byteLength !==
|
|
55
|
+
const bytes = await runAcquisition(operation, 'bundle', 'receive', 'Kernel bundle response could not be read.', (signal) => boundedResponse(response, release.schema.bundle.ref.size, signal));
|
|
56
|
+
if (bytes.byteLength !== release.schema.bundle.ref.size) {
|
|
48
57
|
throw new ClientError('Bundle artifact size differs from its descriptor.');
|
|
49
58
|
}
|
|
50
|
-
return
|
|
59
|
+
return decodeBundle(release, bytes);
|
|
51
60
|
}
|
|
52
61
|
}
|
|
53
|
-
function bundleKey(
|
|
54
|
-
|
|
62
|
+
function bundleKey(release) {
|
|
63
|
+
const { href, ref } = release.schema.bundle;
|
|
64
|
+
return JSON.stringify([
|
|
65
|
+
release.identity.issuer,
|
|
66
|
+
new URL(href).origin,
|
|
67
|
+
release.origin,
|
|
68
|
+
release.schema.revision,
|
|
69
|
+
ref.digest,
|
|
70
|
+
ref.mediaType,
|
|
71
|
+
ref.size,
|
|
72
|
+
]);
|
|
55
73
|
}
|
|
56
|
-
//# sourceMappingURL=bundle.js.map
|
|
@@ -1,20 +1,27 @@
|
|
|
1
1
|
import type { IssuerId } from '@astrale-os/kernel-core/auth/issuer';
|
|
2
2
|
import type { SessionOperation, SessionPolicy } from '../context/index.js';
|
|
3
|
-
import type {
|
|
4
|
-
import type { PublicationDiscovery } from './publication.js';
|
|
3
|
+
import type { IntrinsicRelease } from './release.js';
|
|
5
4
|
import type { SessionSnapshot } from './snapshot.js';
|
|
5
|
+
import { type BundleDiscovery } from './bundle.js';
|
|
6
|
+
/** Revalidating reader of the source Kernel's intrinsic release. */
|
|
7
|
+
interface IntrinsicReleases {
|
|
8
|
+
revalidate(operation: SessionOperation): Promise<IntrinsicRelease>;
|
|
9
|
+
invalidate(): void;
|
|
10
|
+
}
|
|
6
11
|
export declare class SessionDiscovery {
|
|
7
12
|
readonly kernel: IssuerId;
|
|
8
13
|
private readonly policy;
|
|
9
|
-
private readonly
|
|
14
|
+
private readonly releases;
|
|
10
15
|
private readonly bundles;
|
|
11
16
|
private readonly requireOpen;
|
|
12
17
|
private readonly acquisitionOperation;
|
|
13
18
|
private retained?;
|
|
14
19
|
private flight?;
|
|
15
|
-
|
|
20
|
+
private releaseFlight?;
|
|
21
|
+
constructor(kernel: IssuerId, policy: Readonly<SessionPolicy>, releases: IntrinsicReleases, bundles: BundleDiscovery, requireOpen: () => void, acquisitionOperation: () => SessionOperation);
|
|
22
|
+
release(operation: SessionOperation): Promise<IntrinsicRelease>;
|
|
16
23
|
snapshot(operation: SessionOperation): Promise<SessionSnapshot>;
|
|
17
24
|
clear(): void;
|
|
18
25
|
private acquireSnapshot;
|
|
19
26
|
}
|
|
20
|
-
|
|
27
|
+
export {};
|
|
@@ -1,23 +1,43 @@
|
|
|
1
1
|
import { runSessionOperation } from '../context/index.js';
|
|
2
2
|
import { rootViewCatalog } from '../views/index.js';
|
|
3
|
+
import { BundleUnavailableError } from './bundle.js';
|
|
3
4
|
import { createSessionSnapshot } from './snapshot.js';
|
|
4
5
|
export class SessionDiscovery {
|
|
5
6
|
kernel;
|
|
6
7
|
policy;
|
|
7
|
-
|
|
8
|
+
releases;
|
|
8
9
|
bundles;
|
|
9
10
|
requireOpen;
|
|
10
11
|
acquisitionOperation;
|
|
11
12
|
retained;
|
|
12
13
|
flight;
|
|
13
|
-
|
|
14
|
+
releaseFlight;
|
|
15
|
+
constructor(kernel, policy, releases, bundles, requireOpen, acquisitionOperation) {
|
|
14
16
|
this.kernel = kernel;
|
|
15
17
|
this.policy = policy;
|
|
16
|
-
this.
|
|
18
|
+
this.releases = releases;
|
|
17
19
|
this.bundles = bundles;
|
|
18
20
|
this.requireOpen = requireOpen;
|
|
19
21
|
this.acquisitionOperation = acquisitionOperation;
|
|
20
22
|
}
|
|
23
|
+
release(operation) {
|
|
24
|
+
this.requireOpen();
|
|
25
|
+
const current = this.releaseFlight;
|
|
26
|
+
if (current !== undefined)
|
|
27
|
+
return runSessionOperation(operation, () => current);
|
|
28
|
+
const flight = this.releases.revalidate(this.acquisitionOperation()).then((value) => {
|
|
29
|
+
this.requireOpen();
|
|
30
|
+
return value;
|
|
31
|
+
});
|
|
32
|
+
this.releaseFlight = flight;
|
|
33
|
+
void flight
|
|
34
|
+
.finally(() => {
|
|
35
|
+
if (this.releaseFlight === flight)
|
|
36
|
+
this.releaseFlight = undefined;
|
|
37
|
+
})
|
|
38
|
+
.catch(() => undefined);
|
|
39
|
+
return runSessionOperation(operation, () => flight);
|
|
40
|
+
}
|
|
21
41
|
snapshot(operation) {
|
|
22
42
|
this.requireOpen();
|
|
23
43
|
const current = this.flight;
|
|
@@ -34,23 +54,32 @@ export class SessionDiscovery {
|
|
|
34
54
|
return runSessionOperation(operation, () => flight);
|
|
35
55
|
}
|
|
36
56
|
clear() {
|
|
37
|
-
this.
|
|
57
|
+
this.releases.invalidate();
|
|
38
58
|
this.bundles.clear();
|
|
39
59
|
this.retained = undefined;
|
|
40
60
|
}
|
|
41
61
|
async acquireSnapshot(operation) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
this.bundles.
|
|
46
|
-
|
|
62
|
+
let release = await this.release(operation);
|
|
63
|
+
let artifact;
|
|
64
|
+
try {
|
|
65
|
+
artifact = await this.bundles.get(release, operation);
|
|
66
|
+
}
|
|
67
|
+
catch (cause) {
|
|
68
|
+
if (!(cause instanceof BundleUnavailableError))
|
|
69
|
+
throw cause;
|
|
70
|
+
const current = await this.release(operation);
|
|
71
|
+
if (current.digest === release.digest)
|
|
72
|
+
throw cause;
|
|
73
|
+
release = current;
|
|
74
|
+
artifact = await this.bundles.get(release, operation);
|
|
75
|
+
}
|
|
47
76
|
this.requireOpen();
|
|
48
|
-
if (this.retained
|
|
77
|
+
if (this.retained !== undefined && this.retained.release.digest === release.digest) {
|
|
49
78
|
return this.retained;
|
|
50
|
-
|
|
51
|
-
const
|
|
79
|
+
}
|
|
80
|
+
const views = rootViewCatalog(release, artifact, this.policy);
|
|
81
|
+
const snapshot = createSessionSnapshot(this.kernel, release, artifact, views);
|
|
52
82
|
this.retained = snapshot;
|
|
53
83
|
return snapshot;
|
|
54
84
|
}
|
|
55
85
|
}
|
|
56
|
-
//# sourceMappingURL=discovery.js.map
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import type { IssuerId } from '@astrale-os/kernel-core/auth/issuer';
|
|
2
2
|
import type { Fetch } from '../../transport/http/index.js';
|
|
3
3
|
import type { SessionOperation, SessionPolicy } from '../context/index.js';
|
|
4
|
+
import type { IntrinsicRelease } from './release.js';
|
|
4
5
|
import type { SessionSnapshot } from './snapshot.js';
|
|
6
|
+
export type { IntrinsicRelease } from './release.js';
|
|
5
7
|
export type { SessionSnapshot } from './snapshot.js';
|
|
8
|
+
export { boundedResponse, requireExactResponse } from './response.js';
|
|
6
9
|
export interface SessionDiscovery {
|
|
7
10
|
readonly kernel: IssuerId;
|
|
11
|
+
release(operation: SessionOperation): Promise<IntrinsicRelease>;
|
|
8
12
|
snapshot(operation: SessionOperation): Promise<SessionSnapshot>;
|
|
9
13
|
clear(): void;
|
|
10
14
|
}
|
|
@@ -12,10 +16,10 @@ export interface SessionDiscoveryOptions {
|
|
|
12
16
|
readonly kernel: IssuerId;
|
|
13
17
|
readonly fetch: Fetch;
|
|
14
18
|
readonly policy: Readonly<SessionPolicy>;
|
|
15
|
-
|
|
19
|
+
/** Bounds the source Kernel's own `release.json`. */
|
|
20
|
+
readonly maximumReleaseBytes: number;
|
|
16
21
|
readonly maximumBundleBytes: number;
|
|
17
22
|
readonly requireOpen: () => void;
|
|
18
23
|
readonly acquisitionOperation: () => SessionOperation;
|
|
19
24
|
}
|
|
20
25
|
export declare function createSessionDiscovery(options: SessionDiscoveryOptions): SessionDiscovery;
|
|
21
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
import { BundleDiscovery } from './bundle.js';
|
|
2
2
|
import { SessionDiscovery as SessionDiscoveryImplementation } from './discovery.js';
|
|
3
|
-
import {
|
|
3
|
+
import { ReleaseDiscovery } from './release.js';
|
|
4
|
+
export { boundedResponse, requireExactResponse } from './response.js';
|
|
4
5
|
export function createSessionDiscovery(options) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
fetch: options.fetch,
|
|
8
|
-
policy: options.policy,
|
|
9
|
-
maximumBytes: options.maximumPublicationBytes,
|
|
10
|
-
}), new BundleDiscovery({
|
|
6
|
+
const source = { kernel: options.kernel, fetch: options.fetch, policy: options.policy };
|
|
7
|
+
return new SessionDiscoveryImplementation(options.kernel, options.policy, new ReleaseDiscovery({ ...source, maximumBytes: options.maximumReleaseBytes }), new BundleDiscovery({
|
|
11
8
|
fetch: options.fetch,
|
|
12
9
|
policy: options.policy,
|
|
13
10
|
maximumBytes: options.maximumBundleBytes,
|
|
14
11
|
}), options.requireOpen, options.acquisitionOperation);
|
|
15
12
|
}
|
|
16
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { IssuerId } from '@astrale-os/kernel-core/auth/issuer';
|
|
2
|
+
import type { release } from '@astrale-os/kernel-protocol';
|
|
3
|
+
import type { Fetch } from '../../transport/http/index.js';
|
|
4
|
+
import type { SessionOperation } from '../context/index.js';
|
|
5
|
+
import { type SessionPolicy } from '../context/index.js';
|
|
6
|
+
/** The source Kernel's exact intrinsic DomainRelease. */
|
|
7
|
+
export type IntrinsicRelease = release.DomainRelease;
|
|
8
|
+
interface ReleaseDiscoveryOptions {
|
|
9
|
+
readonly kernel: IssuerId;
|
|
10
|
+
readonly fetch: Fetch;
|
|
11
|
+
readonly policy: Readonly<SessionPolicy>;
|
|
12
|
+
readonly maximumBytes: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Conditionally revalidate by release digest. Only an exact 404 means absence;
|
|
16
|
+
* all other unsuccessful responses and Fetch failures remain errors.
|
|
17
|
+
*/
|
|
18
|
+
export declare class ReleaseDiscovery {
|
|
19
|
+
private readonly options;
|
|
20
|
+
private release;
|
|
21
|
+
private revision;
|
|
22
|
+
constructor(options: ReleaseDiscoveryOptions);
|
|
23
|
+
/** The release admitted since construction, the last `invalidate()` or the last 404, if any. */
|
|
24
|
+
current(): release.DomainRelease | undefined;
|
|
25
|
+
/** Revalidate the intrinsic release; an absent release is a discovery error. */
|
|
26
|
+
revalidate(operation: SessionOperation): Promise<release.DomainRelease>;
|
|
27
|
+
invalidate(): void;
|
|
28
|
+
private fetch;
|
|
29
|
+
}
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import * as codecs from '@astrale-os/kernel-protocol/codecs';
|
|
2
|
+
import * as releaseCodec from '@astrale-os/kernel-protocol/release';
|
|
3
|
+
import { ClientError } from '../../errors/index.js';
|
|
4
|
+
import { allowEndpoint } from '../context/index.js';
|
|
5
|
+
import { boundedResponse, requireExactResponse } from './response.js';
|
|
6
|
+
import { runAcquisition } from './transport.js';
|
|
7
|
+
/**
|
|
8
|
+
* Conditionally revalidate by release digest. Only an exact 404 means absence;
|
|
9
|
+
* all other unsuccessful responses and Fetch failures remain errors.
|
|
10
|
+
*/
|
|
11
|
+
export class ReleaseDiscovery {
|
|
12
|
+
options;
|
|
13
|
+
release;
|
|
14
|
+
revision = 0;
|
|
15
|
+
constructor(options) {
|
|
16
|
+
this.options = options;
|
|
17
|
+
}
|
|
18
|
+
/** The release admitted since construction, the last `invalidate()` or the last 404, if any. */
|
|
19
|
+
current() {
|
|
20
|
+
return this.release;
|
|
21
|
+
}
|
|
22
|
+
/** Revalidate the intrinsic release; an absent release is a discovery error. */
|
|
23
|
+
async revalidate(operation) {
|
|
24
|
+
const revision = this.revision;
|
|
25
|
+
const previous = this.release;
|
|
26
|
+
const discovered = await this.fetch(operation, previous);
|
|
27
|
+
if (revision !== this.revision)
|
|
28
|
+
return this.revalidate(operation);
|
|
29
|
+
const retained = previous?.digest === discovered.digest ? previous : discovered;
|
|
30
|
+
this.release = retained;
|
|
31
|
+
return retained;
|
|
32
|
+
}
|
|
33
|
+
invalidate() {
|
|
34
|
+
this.revision += 1;
|
|
35
|
+
this.release = undefined;
|
|
36
|
+
}
|
|
37
|
+
async fetch(operation, previous) {
|
|
38
|
+
const url = releaseCodec.url(this.options.kernel);
|
|
39
|
+
allowEndpoint(url, this.options.policy);
|
|
40
|
+
const response = await runAcquisition(operation, 'release', 'unknown', 'Kernel release could not be retrieved.', (signal) => this.options.fetch(url, {
|
|
41
|
+
headers: {
|
|
42
|
+
accept: releaseCodec.MEDIA_TYPE,
|
|
43
|
+
...(previous === undefined ? {} : { 'if-none-match': `"${previous.digest}"` }),
|
|
44
|
+
},
|
|
45
|
+
redirect: 'manual',
|
|
46
|
+
signal,
|
|
47
|
+
}));
|
|
48
|
+
requireExactResponse(response, url, 'Release discovery');
|
|
49
|
+
if (response.status === 404) {
|
|
50
|
+
// Cleanup must not hold discovery open on an injected body cancellation.
|
|
51
|
+
void response.body?.cancel().catch(() => undefined);
|
|
52
|
+
throw new ClientError('Release discovery returned HTTP 404.');
|
|
53
|
+
}
|
|
54
|
+
if (response.status === 304) {
|
|
55
|
+
if (previous === undefined) {
|
|
56
|
+
throw new ClientError('Release discovery returned an unexpected not-modified response.');
|
|
57
|
+
}
|
|
58
|
+
const etag = response.headers.get('etag');
|
|
59
|
+
if (etag !== null && etag !== `"${previous.digest}"`) {
|
|
60
|
+
throw new ClientError('Release not-modified ETag differs from the retained release digest.');
|
|
61
|
+
}
|
|
62
|
+
return previous;
|
|
63
|
+
}
|
|
64
|
+
if (!response.ok) {
|
|
65
|
+
throw new ClientError(`Release discovery returned HTTP ${response.status}.`);
|
|
66
|
+
}
|
|
67
|
+
if (response.headers.get('content-type') !== releaseCodec.MEDIA_TYPE) {
|
|
68
|
+
throw new ClientError('Release response media type differs from the DomainRelease v4 media type.');
|
|
69
|
+
}
|
|
70
|
+
const body = await runAcquisition(operation, 'release', 'receive', 'Kernel release response could not be read.', (signal) => boundedResponse(response, this.options.maximumBytes, signal));
|
|
71
|
+
const admitted = releaseCodec.accept(codecs.json.decode(body));
|
|
72
|
+
if (admitted.identity.issuer !== this.options.kernel) {
|
|
73
|
+
throw new ClientError('Release issuer differs from the requested Kernel issuer.');
|
|
74
|
+
}
|
|
75
|
+
const etag = response.headers.get('etag');
|
|
76
|
+
if (etag !== null && etag !== `"${admitted.digest}"`) {
|
|
77
|
+
throw new ClientError('Release response ETag differs from its release digest.');
|
|
78
|
+
}
|
|
79
|
+
return admitted;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/** Read external bytes within one Session operation's byte and lifetime bounds. */
|
|
2
|
+
export declare function boundedResponse(response: Response, maximum: number, signal: AbortSignal): Promise<Uint8Array>;
|
|
3
|
+
export declare function requireExactResponse(response: Response, expected: string, label: string): void;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { ClientError } from '../../errors/index.js';
|
|
2
|
+
/** Read external bytes within one Session operation's byte and lifetime bounds. */
|
|
3
|
+
export async function boundedResponse(response, maximum, signal) {
|
|
4
|
+
const declared = response.headers.get('content-length');
|
|
5
|
+
if (declared !== null) {
|
|
6
|
+
const length = Number(declared);
|
|
7
|
+
if (!Number.isSafeInteger(length) || length < 0) {
|
|
8
|
+
throw new ClientError('Response Content-Length is invalid.');
|
|
9
|
+
}
|
|
10
|
+
if (length > maximum)
|
|
11
|
+
throw new ClientError('Response exceeds its byte limit.');
|
|
12
|
+
}
|
|
13
|
+
if (response.body === null)
|
|
14
|
+
return new Uint8Array();
|
|
15
|
+
const reader = response.body.getReader();
|
|
16
|
+
const chunks = [];
|
|
17
|
+
let total = 0;
|
|
18
|
+
const abort = () => void reader.cancel(signal.reason).catch(() => undefined);
|
|
19
|
+
if (signal.aborted)
|
|
20
|
+
abort();
|
|
21
|
+
else
|
|
22
|
+
signal.addEventListener('abort', abort, { once: true });
|
|
23
|
+
try {
|
|
24
|
+
while (true) {
|
|
25
|
+
if (signal.aborted)
|
|
26
|
+
throw signal.reason;
|
|
27
|
+
const next = await reader.read();
|
|
28
|
+
if (next.done)
|
|
29
|
+
break;
|
|
30
|
+
total += next.value.byteLength;
|
|
31
|
+
if (total > maximum) {
|
|
32
|
+
await reader.cancel('response exceeds byte limit').catch(() => undefined);
|
|
33
|
+
throw new ClientError('Response exceeds its byte limit.');
|
|
34
|
+
}
|
|
35
|
+
chunks.push(next.value);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
finally {
|
|
39
|
+
signal.removeEventListener('abort', abort);
|
|
40
|
+
reader.releaseLock();
|
|
41
|
+
}
|
|
42
|
+
return join(chunks, total);
|
|
43
|
+
}
|
|
44
|
+
export function requireExactResponse(response, expected, label) {
|
|
45
|
+
if (response.redirected || response.url !== expected) {
|
|
46
|
+
throw new ClientError(`${label} did not return the exact requested URL.`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function join(parts, length) {
|
|
50
|
+
if (parts.length === 1)
|
|
51
|
+
return new Uint8Array(parts[0]);
|
|
52
|
+
const output = new Uint8Array(length);
|
|
53
|
+
let offset = 0;
|
|
54
|
+
for (const part of parts) {
|
|
55
|
+
output.set(part, offset);
|
|
56
|
+
offset += part.byteLength;
|
|
57
|
+
}
|
|
58
|
+
return output;
|
|
59
|
+
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import type { IssuerId } from '@astrale-os/kernel-core/auth/issuer';
|
|
2
2
|
import type { bundle } from '@astrale-os/kernel-dsl/v1';
|
|
3
|
-
import type { publication } from '@astrale-os/kernel-protocol';
|
|
4
3
|
import type { ViewCatalog } from '../views/index.js';
|
|
5
|
-
|
|
4
|
+
import type { IntrinsicRelease } from './release.js';
|
|
5
|
+
/** Coherent public observation acquired through one Client Session at one intrinsic release. */
|
|
6
6
|
export interface SessionSnapshot {
|
|
7
7
|
readonly kernel: IssuerId;
|
|
8
|
-
readonly
|
|
8
|
+
readonly release: IntrinsicRelease;
|
|
9
9
|
readonly bundle: bundle.Bundle;
|
|
10
10
|
readonly views: ViewCatalog;
|
|
11
11
|
}
|
|
12
|
-
export declare function createSessionSnapshot(kernel: IssuerId,
|
|
13
|
-
//# sourceMappingURL=snapshot.d.ts.map
|
|
12
|
+
export declare function createSessionSnapshot(kernel: IssuerId, release: IntrinsicRelease, artifact: bundle.Bundle, views: ViewCatalog): SessionSnapshot;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export function createSessionSnapshot(kernel,
|
|
2
|
-
return Object.freeze({ kernel,
|
|
1
|
+
export function createSessionSnapshot(kernel, release, artifact, views) {
|
|
2
|
+
return Object.freeze({ kernel, release, bundle: artifact, views });
|
|
3
3
|
}
|
|
4
|
-
//# sourceMappingURL=snapshot.js.map
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import type { TransportPhase } from '../../errors/index.js';
|
|
1
|
+
import type { AcquisitionResource, TransportPhase } from '../../errors/index.js';
|
|
2
2
|
import type { SessionOperation } from '../context/index.js';
|
|
3
|
-
type AcquisitionResource = 'publication' | 'bundle';
|
|
4
3
|
/** Normalize only unknown failures from one injected acquisition capability. */
|
|
5
4
|
export declare function runAcquisition<Result>(operation: SessionOperation, resource: AcquisitionResource, phase: Extract<TransportPhase, 'receive' | 'unknown'>, message: string, task: (signal: AbortSignal) => Result | PromiseLike<Result>): Promise<Result>;
|
|
6
|
-
export {};
|
|
7
|
-
//# sourceMappingURL=transport.d.ts.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { IssuerId } from '@astrale-os/kernel-core/auth/issuer';
|
|
2
|
+
import type { invocation } from '@astrale-os/kernel-protocol';
|
|
3
|
+
import { Path } from '@astrale-os/kernel-core/path';
|
|
4
|
+
import { Key } from '@astrale-os/kernel-dsl/v1/addressing';
|
|
5
|
+
import type { SessionOperation } from '../context/index.js';
|
|
6
|
+
import type { EffectiveAuth } from '../routing/index.js';
|
|
7
|
+
import type { ExchangeDependencies } from './exchange.js';
|
|
8
|
+
/** Installed issuers of the Domains one Session reaches. */
|
|
9
|
+
export interface Installations {
|
|
10
|
+
issuerOf(origin: Key.Origin, source: EffectiveAuth, operation: SessionOperation): Promise<IssuerId | undefined>;
|
|
11
|
+
clear(): void;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The origin of the Domain whose declaration a Call executes, or undefined when the target names no
|
|
15
|
+
* Domain. An instance Method belongs to its qualified Class, never to its receiver's Domain.
|
|
16
|
+
*/
|
|
17
|
+
export declare function declaringOrigin(target: invocation.Call['target']): Key.Origin | undefined;
|
|
18
|
+
export declare function callableOrigin(path: Path): Key.Origin | undefined;
|
|
19
|
+
export declare function isKernelOrigin(origin: Key.Origin): boolean;
|
|
20
|
+
/** The installed remote issuer of one Domain, read as the source caller; undefined when local. */
|
|
21
|
+
export declare function installedIssuer(dependencies: Pick<ExchangeDependencies, 'kernel' | 'source' | 'limits'>, origin: Key.Origin, source: EffectiveAuth, operation: SessionOperation): Promise<IssuerId | undefined>;
|
|
22
|
+
/**
|
|
23
|
+
* Remember each origin's installed issuer for the Session route age. The issuer is installation
|
|
24
|
+
* state, not authority, so one inspection serves every source credential; concurrent readers share
|
|
25
|
+
* it while each keeps its own cancellation and deadline.
|
|
26
|
+
*/
|
|
27
|
+
export declare function createInstallations(dependencies: ExchangeDependencies): Installations;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { targetPath } from '@astrale-os/kernel-core/callable';
|
|
2
|
+
import { Path } from '@astrale-os/kernel-core/path';
|
|
3
|
+
import { identity } from '@astrale-os/kernel-core/schema/kernel/syscalls/references';
|
|
4
|
+
import { Key } from '@astrale-os/kernel-dsl/v1/addressing';
|
|
5
|
+
import { createSchema } from '../../schema/index.js';
|
|
6
|
+
import { runSessionOperation } from '../context/index.js';
|
|
7
|
+
import { sourceCaller } from './source.js';
|
|
8
|
+
const KERNEL_ORIGIN = identity.whoami.owner.origin;
|
|
9
|
+
/**
|
|
10
|
+
* The origin of the Domain whose declaration a Call executes, or undefined when the target names no
|
|
11
|
+
* Domain. An instance Method belongs to its qualified Class, never to its receiver's Domain.
|
|
12
|
+
*/
|
|
13
|
+
export function declaringOrigin(target) {
|
|
14
|
+
return callableOrigin(Path.parse(targetPath(target)));
|
|
15
|
+
}
|
|
16
|
+
export function callableOrigin(path) {
|
|
17
|
+
const last = path.ast.steps.at(-1);
|
|
18
|
+
if (last?.kind === 'method' && last.dispatch === 'instance')
|
|
19
|
+
return Key.origin(last.class);
|
|
20
|
+
return path.ast.anchor.kind === 'domain' ? path.ast.anchor.origin : undefined;
|
|
21
|
+
}
|
|
22
|
+
export function isKernelOrigin(origin) {
|
|
23
|
+
return origin === KERNEL_ORIGIN;
|
|
24
|
+
}
|
|
25
|
+
/** The installed remote issuer of one Domain, read as the source caller; undefined when local. */
|
|
26
|
+
export async function installedIssuer(dependencies, origin, source, operation) {
|
|
27
|
+
const caller = sourceCaller(dependencies, source, operation);
|
|
28
|
+
const domain = await createSchema(caller.dispatch, dependencies.limits).inspect(origin);
|
|
29
|
+
const remote = domain.release;
|
|
30
|
+
return remote === null || remote.identity.issuer === dependencies.kernel
|
|
31
|
+
? undefined
|
|
32
|
+
: remote.identity.issuer;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Remember each origin's installed issuer for the Session route age. The issuer is installation
|
|
36
|
+
* state, not authority, so one inspection serves every source credential; concurrent readers share
|
|
37
|
+
* it while each keeps its own cancellation and deadline.
|
|
38
|
+
*/
|
|
39
|
+
export function createInstallations(dependencies) {
|
|
40
|
+
/** An inspection in flight never expires; a settled one lives for the route age. */
|
|
41
|
+
const entries = new Map();
|
|
42
|
+
return Object.freeze({
|
|
43
|
+
issuerOf(origin, source, operation) {
|
|
44
|
+
const held = entries.get(origin);
|
|
45
|
+
const { issuer } = held === undefined || held.expiresAt <= Date.now() ? inspect(origin, source) : held;
|
|
46
|
+
return runSessionOperation(operation, () => issuer);
|
|
47
|
+
},
|
|
48
|
+
clear: () => entries.clear(),
|
|
49
|
+
});
|
|
50
|
+
function inspect(origin, source) {
|
|
51
|
+
const issuer = installedIssuer(dependencies, origin, source, dependencies.operation());
|
|
52
|
+
const entry = { issuer, expiresAt: Infinity };
|
|
53
|
+
entries.set(origin, entry);
|
|
54
|
+
// Both reactions are attached, so a rejection that reaches no waiter is never unhandled.
|
|
55
|
+
issuer.then(() => {
|
|
56
|
+
entry.expiresAt = Date.now() + dependencies.policy.maximumRouteAgeMs;
|
|
57
|
+
}, () => {
|
|
58
|
+
if (entries.get(origin) === entry)
|
|
59
|
+
entries.delete(origin);
|
|
60
|
+
});
|
|
61
|
+
return entry;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { MintedCredential } from '@astrale-os/kernel-core/auth';
|
|
2
|
+
import type { IssuerId } from '@astrale-os/kernel-core/auth/issuer';
|
|
3
|
+
import type { Client } from '../../client/index.js';
|
|
4
|
+
import type { SchemaOptions } from '../../schema/schema.js';
|
|
5
|
+
import type { Fetch } from '../../transport/http/index.js';
|
|
6
|
+
import type { SessionOperation, SessionPolicy } from '../context/index.js';
|
|
7
|
+
import type { SessionCredential } from '../credential/index.js';
|
|
8
|
+
import type { EffectiveAuth, SessionAuth } from '../routing/index.js';
|
|
9
|
+
import type { ExchangeRequest } from './options.js';
|
|
10
|
+
/** Everything an exchange reaches: the Session's source Kernel and authority, and the Domain legs. */
|
|
11
|
+
export interface ExchangeDependencies {
|
|
12
|
+
readonly kernel: IssuerId;
|
|
13
|
+
/** Unauthenticated Client for the source Kernel invocation endpoint. */
|
|
14
|
+
readonly source: () => Client;
|
|
15
|
+
/** The Session's source authority, when the Session has one. */
|
|
16
|
+
readonly auth?: SessionAuth;
|
|
17
|
+
readonly fetch: Fetch;
|
|
18
|
+
readonly policy: Readonly<SessionPolicy>;
|
|
19
|
+
readonly limits: SchemaOptions;
|
|
20
|
+
readonly maximumResponseBytes: number;
|
|
21
|
+
/** Open one operation for work shared by several Calls; it fails once the Session closes. */
|
|
22
|
+
readonly operation: (signal?: AbortSignal) => SessionOperation;
|
|
23
|
+
}
|
|
24
|
+
/** One Domain-issued Kernel credential and the delegation the Domain exchanged for it. */
|
|
25
|
+
export interface DomainCredential extends SessionCredential {
|
|
26
|
+
readonly delegation: MintedCredential;
|
|
27
|
+
}
|
|
28
|
+
export interface DomainExchangeRequest {
|
|
29
|
+
readonly issuer: IssuerId;
|
|
30
|
+
/** Requested delegation lifetime; the source credential's remaining lifetime bounds it. */
|
|
31
|
+
readonly ttlSeconds: number;
|
|
32
|
+
/**
|
|
33
|
+
* Lifetime the returned credential must exceed. A source that bounds the delegation within it is
|
|
34
|
+
* exhausted rather than exchanged.
|
|
35
|
+
*/
|
|
36
|
+
readonly coverageMs?: number;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Delegate the source caller to one Domain issuer and redeem that delegation at the issuer's
|
|
40
|
+
* advertised endpoint for the Domain's credential to the source Kernel.
|
|
41
|
+
*/
|
|
42
|
+
export declare function exchangeDomainCredential(dependencies: ExchangeDependencies, source: EffectiveAuth, request: DomainExchangeRequest, operation: SessionOperation): Promise<DomainCredential>;
|
|
43
|
+
/**
|
|
44
|
+
* One Domain credential for a named Domain issuer, as `session.exchange` returns it. When the
|
|
45
|
+
* request asks for more than the Session delegation, the credential covers that delegation, and the
|
|
46
|
+
* source is renewed once if the current one can no longer feed it.
|
|
47
|
+
*/
|
|
48
|
+
export declare function acquireDomainCredential(dependencies: ExchangeDependencies, request: ExchangeRequest, operation: SessionOperation): Promise<SessionCredential>;
|