@astrale-os/kernel-client 0.6.0-beta.6 → 0.6.0-beta.61
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 +7 -6
- package/dist/auth/auth.js +2 -3
- package/dist/auth/authorization.d.ts +2 -3
- package/dist/auth/authorization.js +0 -1
- package/dist/auth/credential.d.ts +5 -1
- package/dist/auth/credential.js +6 -3
- package/dist/auth/identity.d.ts +6 -9
- package/dist/auth/identity.js +0 -1
- package/dist/auth/index.d.ts +3 -4
- package/dist/auth/index.js +2 -3
- package/dist/auth/register.d.ts +24 -0
- package/dist/auth/register.js +10 -0
- package/dist/client/admission.d.ts +4 -2
- package/dist/client/admission.js +8 -2
- package/dist/client/client.d.ts +0 -1
- package/dist/client/client.js +0 -1
- package/dist/client/credential.d.ts +0 -1
- package/dist/client/credential.js +0 -1
- package/dist/client/index.d.ts +0 -1
- package/dist/client/index.js +0 -1
- package/dist/client/request.d.ts +3 -3
- package/dist/client/request.js +3 -1
- package/dist/client/result.d.ts +3 -4
- package/dist/client/result.js +3 -1
- package/dist/client/routing-control.d.ts +0 -1
- package/dist/client/routing-control.js +0 -1
- package/dist/errors/client-error.d.ts +0 -1
- package/dist/errors/client-error.js +2 -1
- package/dist/errors/index.d.ts +7 -7
- package/dist/errors/index.js +7 -7
- package/dist/errors/miss-error.d.ts +0 -1
- package/dist/errors/miss-error.js +0 -1
- package/dist/errors/protocol-error.d.ts +0 -1
- package/dist/errors/protocol-error.js +0 -1
- package/dist/errors/response-error.d.ts +0 -1
- package/dist/errors/response-error.js +0 -1
- package/dist/errors/session-error.d.ts +9 -0
- package/dist/errors/session-error.js +9 -0
- package/dist/errors/stale-route-error.d.ts +0 -1
- package/dist/errors/stale-route-error.js +0 -1
- package/dist/errors/transport-error.d.ts +18 -6
- package/dist/errors/transport-error.js +11 -7
- package/dist/graph/domain/binding.d.ts +22 -0
- package/dist/graph/domain/binding.js +123 -0
- package/dist/graph/domain/domain.typecheck.d.ts +1 -0
- package/dist/graph/domain/domain.typecheck.js +147 -0
- package/dist/graph/domain/index.d.ts +3 -0
- package/dist/graph/domain/index.js +1 -0
- package/dist/graph/domain/model.d.ts +18 -0
- package/dist/graph/domain/model.js +1 -0
- package/dist/graph/domain/page.d.ts +23 -0
- package/dist/graph/domain/page.js +42 -0
- package/dist/graph/domain/project.d.ts +8 -0
- package/dist/graph/domain/project.js +124 -0
- package/dist/graph/domain/provenance.d.ts +6 -0
- package/dist/graph/domain/provenance.js +11 -0
- package/dist/graph/errors.d.ts +2 -3
- package/dist/graph/errors.js +1 -2
- package/dist/graph/expectation.d.ts +3 -0
- package/dist/graph/expectation.js +6 -0
- package/dist/graph/graph.d.ts +12 -8
- package/dist/graph/graph.js +0 -1
- package/dist/graph/index.d.ts +2 -2
- package/dist/graph/index.js +1 -1
- package/dist/graph/mutation.d.ts +2 -4
- package/dist/graph/mutation.js +10 -2
- package/dist/graph/page/index.d.ts +0 -1
- package/dist/graph/page/index.js +0 -1
- package/dist/graph/page/neighbors.d.ts +4 -5
- package/dist/graph/page/neighbors.js +7 -7
- package/dist/graph/page/page.d.ts +5 -2
- package/dist/graph/page/page.js +0 -1
- package/dist/graph/page-contract.d.ts +1 -2
- package/dist/graph/page-contract.js +0 -1
- package/dist/graph/provenance.d.ts +14 -0
- package/dist/graph/provenance.js +42 -0
- package/dist/graph/query.d.ts +3 -1
- package/dist/graph/query.js +33 -13
- package/dist/graph/read.d.ts +3 -4
- package/dist/graph/read.js +6 -5
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/pacer/batcher/batcher.d.ts +0 -1
- package/dist/pacer/batcher/batcher.js +0 -1
- package/dist/pacer/batcher/defaults.d.ts +0 -1
- package/dist/pacer/batcher/defaults.js +0 -1
- package/dist/pacer/batcher/index.d.ts +0 -1
- package/dist/pacer/batcher/index.js +0 -1
- package/dist/pacer/index.d.ts +0 -1
- package/dist/pacer/index.js +0 -1
- package/dist/pacer/limiter/defaults.d.ts +0 -1
- package/dist/pacer/limiter/defaults.js +0 -1
- package/dist/pacer/limiter/index.d.ts +0 -1
- package/dist/pacer/limiter/index.js +0 -1
- package/dist/pacer/limiter/limiter.d.ts +0 -1
- package/dist/pacer/limiter/limiter.js +0 -1
- package/dist/pacer/queue/defaults.d.ts +0 -1
- package/dist/pacer/queue/defaults.js +0 -1
- package/dist/pacer/queue/index.d.ts +0 -1
- package/dist/pacer/queue/index.js +0 -1
- package/dist/pacer/queue/queue.d.ts +0 -1
- package/dist/pacer/queue/queue.js +0 -1
- package/dist/pacer/retry/defaults.d.ts +0 -1
- package/dist/pacer/retry/defaults.js +0 -1
- package/dist/pacer/retry/index.d.ts +0 -1
- package/dist/pacer/retry/index.js +0 -1
- package/dist/pacer/retry/retry.d.ts +0 -1
- package/dist/pacer/retry/retry.js +0 -1
- package/dist/pool/index.d.ts +0 -1
- package/dist/pool/index.js +0 -1
- package/dist/pool/pool.d.ts +0 -1
- package/dist/pool/pool.js +0 -1
- package/dist/pool/target.d.ts +0 -1
- package/dist/pool/target.js +0 -1
- package/dist/schema/admission.d.ts +1 -2
- package/dist/schema/admission.js +0 -1
- package/dist/schema/contracts.d.ts +6 -16
- package/dist/schema/contracts.js +0 -1
- package/dist/schema/index.d.ts +2 -3
- package/dist/schema/index.js +1 -2
- package/dist/schema/introspection.d.ts +1 -2
- package/dist/schema/introspection.js +5 -2
- package/dist/schema/operation.d.ts +0 -1
- package/dist/schema/operation.js +2 -3
- package/dist/schema/schema.d.ts +11 -10
- package/dist/schema/schema.js +80 -11
- package/dist/session/bound.d.ts +45 -0
- package/dist/session/bound.js +89 -0
- package/dist/session/context/control.d.ts +0 -1
- package/dist/session/context/control.js +0 -1
- package/dist/session/context/index.d.ts +0 -1
- package/dist/session/context/index.js +0 -1
- package/dist/session/context/limits.d.ts +0 -1
- package/dist/session/context/limits.js +0 -1
- package/dist/session/context/operation.d.ts +0 -1
- package/dist/session/context/operation.js +19 -17
- package/dist/session/context/policy.d.ts +0 -1
- package/dist/session/context/policy.js +0 -1
- package/dist/session/discovery/bundle.d.ts +5 -2
- package/dist/session/discovery/bundle.js +34 -15
- package/dist/session/discovery/discovery.d.ts +4 -2
- package/dist/session/discovery/discovery.js +34 -6
- package/dist/session/discovery/index.d.ts +2 -1
- package/dist/session/discovery/index.js +0 -1
- package/dist/session/discovery/publication.d.ts +0 -1
- package/dist/session/discovery/publication.js +4 -4
- package/dist/session/discovery/snapshot.d.ts +0 -1
- package/dist/session/discovery/snapshot.js +0 -1
- package/dist/session/discovery/transport.d.ts +6 -0
- package/dist/session/discovery/transport.js +13 -0
- package/dist/session/index.d.ts +4 -3
- package/dist/session/index.js +2 -1
- package/dist/session/reference.d.ts +18 -10
- package/dist/session/reference.js +31 -9
- package/dist/session/routing/auth.d.ts +0 -1
- package/dist/session/routing/auth.js +0 -1
- package/dist/session/routing/cache.d.ts +27 -8
- package/dist/session/routing/cache.js +218 -25
- package/dist/session/routing/dispatch.d.ts +3 -7
- package/dist/session/routing/dispatch.js +36 -26
- package/dist/session/routing/envelope.d.ts +2 -1
- package/dist/session/routing/envelope.js +14 -10
- package/dist/session/routing/index.d.ts +1 -3
- package/dist/session/routing/index.js +1 -2
- package/dist/session/routing/request.d.ts +0 -1
- package/dist/session/routing/request.js +0 -1
- package/dist/session/session.d.ts +16 -7
- package/dist/session/session.js +49 -30
- package/dist/session/session.typecheck.d.ts +0 -1
- package/dist/session/session.typecheck.js +87 -3
- package/dist/session/views/catalog.d.ts +0 -1
- package/dist/session/views/catalog.js +13 -5
- package/dist/session/views/index.d.ts +0 -1
- package/dist/session/views/index.js +0 -1
- package/dist/session/views/resolve.d.ts +0 -1
- package/dist/session/views/resolve.js +0 -1
- package/dist/store/entity-index.d.ts +0 -1
- package/dist/store/entity-index.js +0 -1
- package/dist/store/index.d.ts +0 -1
- package/dist/store/index.js +0 -1
- package/dist/store/memory.d.ts +2 -2
- package/dist/store/memory.js +38 -15
- package/dist/store/mutation.d.ts +1 -2
- package/dist/store/mutation.js +6 -4
- package/dist/store/observe.d.ts +0 -1
- package/dist/store/observe.js +0 -1
- package/dist/store/optimistic.d.ts +0 -1
- package/dist/store/optimistic.js +0 -1
- package/dist/store/query-key.d.ts +2 -2
- package/dist/store/query-key.js +7 -3
- package/dist/store/shape.d.ts +4 -2
- package/dist/store/shape.js +4 -2
- package/dist/store/store.d.ts +2 -4
- package/dist/store/store.js +6 -5
- package/dist/store/store.typecheck.d.ts +0 -1
- package/dist/store/store.typecheck.js +3 -9
- package/dist/transport/auto/decision.d.ts +0 -1
- package/dist/transport/auto/decision.js +0 -1
- package/dist/transport/auto/fallback.d.ts +2 -2
- package/dist/transport/auto/fallback.js +10 -11
- package/dist/transport/auto/index.d.ts +0 -1
- package/dist/transport/auto/index.js +0 -1
- package/dist/transport/auto/transport.d.ts +0 -1
- package/dist/transport/auto/transport.js +5 -6
- package/dist/transport/auto/warning.d.ts +0 -1
- package/dist/transport/auto/warning.js +5 -3
- package/dist/transport/deadline.d.ts +0 -1
- package/dist/transport/deadline.js +0 -1
- package/dist/transport/failure.d.ts +7 -0
- package/dist/transport/failure.js +9 -0
- package/dist/transport/http/byte-stream.d.ts +17 -0
- package/dist/transport/http/byte-stream.js +86 -0
- package/dist/transport/http/index.d.ts +0 -1
- package/dist/transport/http/index.js +0 -1
- package/dist/transport/http/response.d.ts +0 -1
- package/dist/transport/http/response.js +0 -1
- package/dist/transport/http/stream.d.ts +0 -1
- package/dist/transport/http/stream.js +7 -7
- package/dist/transport/http/transport.d.ts +0 -1
- package/dist/transport/http/transport.js +43 -20
- package/dist/transport/index.d.ts +0 -1
- package/dist/transport/index.js +0 -1
- package/dist/transport/transport.d.ts +0 -1
- package/dist/transport/transport.js +0 -1
- package/dist/transport/websocket/connection.d.ts +0 -1
- package/dist/transport/websocket/connection.js +16 -26
- package/dist/transport/websocket/exchange.d.ts +0 -1
- package/dist/transport/websocket/exchange.js +5 -9
- package/dist/transport/websocket/index.d.ts +0 -1
- package/dist/transport/websocket/index.js +0 -1
- package/dist/transport/websocket/transport.d.ts +0 -1
- package/dist/transport/websocket/transport.js +7 -20
- package/package.json +12 -14
- package/dist/auth/auth.d.ts.map +0 -1
- package/dist/auth/auth.js.map +0 -1
- package/dist/auth/authorization.d.ts.map +0 -1
- package/dist/auth/authorization.js.map +0 -1
- package/dist/auth/credential.d.ts.map +0 -1
- package/dist/auth/credential.js.map +0 -1
- package/dist/auth/identity.d.ts.map +0 -1
- package/dist/auth/identity.js.map +0 -1
- package/dist/auth/index.d.ts.map +0 -1
- package/dist/auth/index.js.map +0 -1
- package/dist/auth/provision.d.ts +0 -9
- package/dist/auth/provision.d.ts.map +0 -1
- package/dist/auth/provision.js +0 -11
- package/dist/auth/provision.js.map +0 -1
- package/dist/client/admission.d.ts.map +0 -1
- package/dist/client/admission.js.map +0 -1
- package/dist/client/client.d.ts.map +0 -1
- package/dist/client/client.js.map +0 -1
- package/dist/client/credential.d.ts.map +0 -1
- package/dist/client/credential.js.map +0 -1
- package/dist/client/index.d.ts.map +0 -1
- package/dist/client/index.js.map +0 -1
- package/dist/client/request.d.ts.map +0 -1
- package/dist/client/request.js.map +0 -1
- package/dist/client/result.d.ts.map +0 -1
- package/dist/client/result.js.map +0 -1
- package/dist/client/routing-control.d.ts.map +0 -1
- package/dist/client/routing-control.js.map +0 -1
- package/dist/errors/client-error.d.ts.map +0 -1
- package/dist/errors/client-error.js.map +0 -1
- package/dist/errors/index.d.ts.map +0 -1
- package/dist/errors/index.js.map +0 -1
- package/dist/errors/miss-error.d.ts.map +0 -1
- package/dist/errors/miss-error.js.map +0 -1
- package/dist/errors/protocol-error.d.ts.map +0 -1
- package/dist/errors/protocol-error.js.map +0 -1
- package/dist/errors/response-error.d.ts.map +0 -1
- package/dist/errors/response-error.js.map +0 -1
- package/dist/errors/stale-route-error.d.ts.map +0 -1
- package/dist/errors/stale-route-error.js.map +0 -1
- package/dist/errors/transport-error.d.ts.map +0 -1
- package/dist/errors/transport-error.js.map +0 -1
- package/dist/graph/errors.d.ts.map +0 -1
- package/dist/graph/errors.js.map +0 -1
- package/dist/graph/graph.d.ts.map +0 -1
- package/dist/graph/graph.js.map +0 -1
- package/dist/graph/index.d.ts.map +0 -1
- package/dist/graph/index.js.map +0 -1
- package/dist/graph/mutation.d.ts.map +0 -1
- package/dist/graph/mutation.js.map +0 -1
- package/dist/graph/page/index.d.ts.map +0 -1
- package/dist/graph/page/index.js.map +0 -1
- package/dist/graph/page/neighbors.d.ts.map +0 -1
- package/dist/graph/page/neighbors.js.map +0 -1
- package/dist/graph/page/page.d.ts.map +0 -1
- package/dist/graph/page/page.js.map +0 -1
- package/dist/graph/page-contract.d.ts.map +0 -1
- package/dist/graph/page-contract.js.map +0 -1
- package/dist/graph/query.d.ts.map +0 -1
- package/dist/graph/query.js.map +0 -1
- package/dist/graph/read.d.ts.map +0 -1
- package/dist/graph/read.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/pacer/batcher/batcher.d.ts.map +0 -1
- package/dist/pacer/batcher/batcher.js.map +0 -1
- package/dist/pacer/batcher/defaults.d.ts.map +0 -1
- package/dist/pacer/batcher/defaults.js.map +0 -1
- package/dist/pacer/batcher/index.d.ts.map +0 -1
- package/dist/pacer/batcher/index.js.map +0 -1
- package/dist/pacer/index.d.ts.map +0 -1
- package/dist/pacer/index.js.map +0 -1
- package/dist/pacer/limiter/defaults.d.ts.map +0 -1
- package/dist/pacer/limiter/defaults.js.map +0 -1
- package/dist/pacer/limiter/index.d.ts.map +0 -1
- package/dist/pacer/limiter/index.js.map +0 -1
- package/dist/pacer/limiter/limiter.d.ts.map +0 -1
- package/dist/pacer/limiter/limiter.js.map +0 -1
- package/dist/pacer/queue/defaults.d.ts.map +0 -1
- package/dist/pacer/queue/defaults.js.map +0 -1
- package/dist/pacer/queue/index.d.ts.map +0 -1
- package/dist/pacer/queue/index.js.map +0 -1
- package/dist/pacer/queue/queue.d.ts.map +0 -1
- package/dist/pacer/queue/queue.js.map +0 -1
- package/dist/pacer/retry/defaults.d.ts.map +0 -1
- package/dist/pacer/retry/defaults.js.map +0 -1
- package/dist/pacer/retry/index.d.ts.map +0 -1
- package/dist/pacer/retry/index.js.map +0 -1
- package/dist/pacer/retry/retry.d.ts.map +0 -1
- package/dist/pacer/retry/retry.js.map +0 -1
- package/dist/pool/index.d.ts.map +0 -1
- package/dist/pool/index.js.map +0 -1
- package/dist/pool/pool.d.ts.map +0 -1
- package/dist/pool/pool.js.map +0 -1
- package/dist/pool/target.d.ts.map +0 -1
- package/dist/pool/target.js.map +0 -1
- package/dist/schema/admission.d.ts.map +0 -1
- package/dist/schema/admission.js.map +0 -1
- package/dist/schema/contracts.d.ts.map +0 -1
- package/dist/schema/contracts.js.map +0 -1
- package/dist/schema/index.d.ts.map +0 -1
- package/dist/schema/index.js.map +0 -1
- package/dist/schema/introspection.d.ts.map +0 -1
- package/dist/schema/introspection.js.map +0 -1
- package/dist/schema/operation.d.ts.map +0 -1
- package/dist/schema/operation.js.map +0 -1
- package/dist/schema/schema.d.ts.map +0 -1
- package/dist/schema/schema.js.map +0 -1
- package/dist/session/context/control.d.ts.map +0 -1
- package/dist/session/context/control.js.map +0 -1
- package/dist/session/context/index.d.ts.map +0 -1
- package/dist/session/context/index.js.map +0 -1
- package/dist/session/context/limits.d.ts.map +0 -1
- package/dist/session/context/limits.js.map +0 -1
- package/dist/session/context/operation.d.ts.map +0 -1
- package/dist/session/context/operation.js.map +0 -1
- package/dist/session/context/policy.d.ts.map +0 -1
- package/dist/session/context/policy.js.map +0 -1
- package/dist/session/discovery/bundle.d.ts.map +0 -1
- package/dist/session/discovery/bundle.js.map +0 -1
- package/dist/session/discovery/discovery.d.ts.map +0 -1
- package/dist/session/discovery/discovery.js.map +0 -1
- package/dist/session/discovery/index.d.ts.map +0 -1
- package/dist/session/discovery/index.js.map +0 -1
- package/dist/session/discovery/publication.d.ts.map +0 -1
- package/dist/session/discovery/publication.js.map +0 -1
- package/dist/session/discovery/snapshot.d.ts.map +0 -1
- package/dist/session/discovery/snapshot.js.map +0 -1
- package/dist/session/index.d.ts.map +0 -1
- package/dist/session/index.js.map +0 -1
- package/dist/session/reference.d.ts.map +0 -1
- package/dist/session/reference.js.map +0 -1
- package/dist/session/routing/auth.d.ts.map +0 -1
- package/dist/session/routing/auth.js.map +0 -1
- package/dist/session/routing/cache.d.ts.map +0 -1
- package/dist/session/routing/cache.js.map +0 -1
- package/dist/session/routing/dispatch.d.ts.map +0 -1
- package/dist/session/routing/dispatch.js.map +0 -1
- package/dist/session/routing/envelope.d.ts.map +0 -1
- package/dist/session/routing/envelope.js.map +0 -1
- package/dist/session/routing/expectation.d.ts +0 -7
- package/dist/session/routing/expectation.d.ts.map +0 -1
- package/dist/session/routing/expectation.js +0 -2
- package/dist/session/routing/expectation.js.map +0 -1
- package/dist/session/routing/index.d.ts.map +0 -1
- package/dist/session/routing/index.js.map +0 -1
- package/dist/session/routing/request.d.ts.map +0 -1
- package/dist/session/routing/request.js.map +0 -1
- package/dist/session/session.d.ts.map +0 -1
- package/dist/session/session.js.map +0 -1
- package/dist/session/session.typecheck.d.ts.map +0 -1
- package/dist/session/session.typecheck.js.map +0 -1
- package/dist/session/views/catalog.d.ts.map +0 -1
- package/dist/session/views/catalog.js.map +0 -1
- package/dist/session/views/index.d.ts.map +0 -1
- package/dist/session/views/index.js.map +0 -1
- package/dist/session/views/resolve.d.ts.map +0 -1
- package/dist/session/views/resolve.js.map +0 -1
- package/dist/store/entity-index.d.ts.map +0 -1
- package/dist/store/entity-index.js.map +0 -1
- package/dist/store/index.d.ts.map +0 -1
- package/dist/store/index.js.map +0 -1
- package/dist/store/memory.d.ts.map +0 -1
- package/dist/store/memory.js.map +0 -1
- package/dist/store/mutation.d.ts.map +0 -1
- package/dist/store/mutation.js.map +0 -1
- package/dist/store/observe.d.ts.map +0 -1
- package/dist/store/observe.js.map +0 -1
- package/dist/store/optimistic.d.ts.map +0 -1
- package/dist/store/optimistic.js.map +0 -1
- package/dist/store/query-key.d.ts.map +0 -1
- package/dist/store/query-key.js.map +0 -1
- package/dist/store/shape.d.ts.map +0 -1
- package/dist/store/shape.js.map +0 -1
- package/dist/store/store.d.ts.map +0 -1
- package/dist/store/store.js.map +0 -1
- package/dist/store/store.typecheck.d.ts.map +0 -1
- package/dist/store/store.typecheck.js.map +0 -1
- package/dist/transport/auto/decision.d.ts.map +0 -1
- package/dist/transport/auto/decision.js.map +0 -1
- package/dist/transport/auto/fallback.d.ts.map +0 -1
- package/dist/transport/auto/fallback.js.map +0 -1
- package/dist/transport/auto/index.d.ts.map +0 -1
- package/dist/transport/auto/index.js.map +0 -1
- package/dist/transport/auto/transport.d.ts.map +0 -1
- package/dist/transport/auto/transport.js.map +0 -1
- package/dist/transport/auto/warning.d.ts.map +0 -1
- package/dist/transport/auto/warning.js.map +0 -1
- package/dist/transport/deadline.d.ts.map +0 -1
- package/dist/transport/deadline.js.map +0 -1
- package/dist/transport/http/index.d.ts.map +0 -1
- package/dist/transport/http/index.js.map +0 -1
- package/dist/transport/http/response.d.ts.map +0 -1
- package/dist/transport/http/response.js.map +0 -1
- package/dist/transport/http/stream.d.ts.map +0 -1
- package/dist/transport/http/stream.js.map +0 -1
- package/dist/transport/http/transport.d.ts.map +0 -1
- package/dist/transport/http/transport.js.map +0 -1
- package/dist/transport/index.d.ts.map +0 -1
- package/dist/transport/index.js.map +0 -1
- package/dist/transport/transport.d.ts.map +0 -1
- package/dist/transport/transport.js.map +0 -1
- package/dist/transport/websocket/connection.d.ts.map +0 -1
- package/dist/transport/websocket/connection.js.map +0 -1
- package/dist/transport/websocket/exchange.d.ts.map +0 -1
- package/dist/transport/websocket/exchange.js.map +0 -1
- package/dist/transport/websocket/index.d.ts.map +0 -1
- package/dist/transport/websocket/index.js.map +0 -1
- package/dist/transport/websocket/transport.d.ts.map +0 -1
- package/dist/transport/websocket/transport.js.map +0 -1
package/dist/schema/operation.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as installation from '@astrale-os/kernel-core/schema/installation';
|
|
2
2
|
/** Accept one canonical lowercase RFC 9562 UUIDv4 operation identity. */
|
|
3
3
|
export function acceptOperationId(input) {
|
|
4
4
|
return installation.acceptOperationId(input);
|
|
5
5
|
}
|
|
6
6
|
/** Allocate one cryptographically generated operation identity for a new lifecycle request. */
|
|
7
7
|
export function createOperationId() {
|
|
8
|
-
return acceptOperationId(
|
|
8
|
+
return acceptOperationId(crypto.randomUUID());
|
|
9
9
|
}
|
|
10
|
-
//# sourceMappingURL=operation.js.map
|
package/dist/schema/schema.d.ts
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import
|
|
1
|
+
import type { Key } from '@astrale-os/kernel-dsl/v1';
|
|
2
|
+
import * as protocolSchema from '@astrale-os/kernel-protocol/schema';
|
|
3
3
|
import type { Call, Result } from '../client/index.js';
|
|
4
4
|
import type { RequestOptions } from '../transport/index.js';
|
|
5
|
-
import type {
|
|
5
|
+
import type { InstallRequest, UninstallReceipt, UninstallRequest } from './contracts.js';
|
|
6
6
|
export type SchemaCall = (call: Call, options?: RequestOptions) => Promise<Result>;
|
|
7
7
|
export interface SchemaOptions extends protocolSchema.installation.introspection.Limits {
|
|
8
|
+
readonly lifecycleTimeoutMs?: number;
|
|
8
9
|
}
|
|
9
|
-
export type
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
10
|
+
export type DomainInfo = protocolSchema.installation.introspection.DomainInfo;
|
|
11
|
+
export type DomainBundle = protocolSchema.installation.introspection.DomainBundle;
|
|
12
|
+
export type InstallResult = protocolSchema.installation.InstallResult;
|
|
13
13
|
export interface SchemaApi {
|
|
14
|
-
install(request: InstallRequest, options?: RequestOptions): Promise<
|
|
14
|
+
install(request: InstallRequest, options?: RequestOptions): Promise<InstallResult>;
|
|
15
15
|
uninstall(request: UninstallRequest, options?: RequestOptions): Promise<UninstallReceipt>;
|
|
16
|
-
|
|
16
|
+
inspect(origin: Key.Origin, options?: RequestOptions): Promise<DomainInfo>;
|
|
17
|
+
bundle(origin: Key.Origin, options?: RequestOptions): Promise<DomainBundle>;
|
|
17
18
|
}
|
|
19
|
+
export declare const DEFAULT_SCHEMA_LIFECYCLE_TIMEOUT_MS = 110000;
|
|
18
20
|
/** Bind the canonical Schema lifecycle syscalls to one caller-scoped value-call capability. */
|
|
19
21
|
export declare function createSchema(call: SchemaCall, limits: SchemaOptions): SchemaApi;
|
|
20
|
-
//# sourceMappingURL=schema.d.ts.map
|
package/dist/schema/schema.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { Path } from '@astrale-os/kernel-core/path';
|
|
2
|
-
import {
|
|
2
|
+
import { uninstallOutput } from '@astrale-os/kernel-core/schema/kernel/syscalls/contracts';
|
|
3
3
|
import { install, uninstall } from '@astrale-os/kernel-core/schema/kernel/syscalls/references';
|
|
4
|
+
import * as protocolSchema from '@astrale-os/kernel-protocol/schema';
|
|
4
5
|
import { call as invocation } from '../client/index.js';
|
|
5
6
|
import { acceptOutput } from './admission.js';
|
|
6
|
-
import { introspect
|
|
7
|
+
import { introspect } from './introspection.js';
|
|
7
8
|
const INSTALL_PATH = Path.project(install).raw;
|
|
8
9
|
const UNINSTALL_PATH = Path.project(uninstall).raw;
|
|
10
|
+
export const DEFAULT_SCHEMA_LIFECYCLE_TIMEOUT_MS = 110_000;
|
|
9
11
|
/** Bind the canonical Schema lifecycle syscalls to one caller-scoped value-call capability. */
|
|
10
12
|
export function createSchema(call, limits) {
|
|
11
13
|
if (typeof call !== 'function')
|
|
@@ -13,32 +15,99 @@ export function createSchema(call, limits) {
|
|
|
13
15
|
const admittedLimits = admitLimits(limits);
|
|
14
16
|
return Object.freeze({
|
|
15
17
|
async install(request, options) {
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
+
const result = await call(invocation(INSTALL_PATH, request), lifecycleOptions(options, admittedLimits.lifecycleTimeoutMs));
|
|
19
|
+
if (result.kind !== 'binary') {
|
|
20
|
+
throw new TypeError('Schema install returned a non-binary result.');
|
|
21
|
+
}
|
|
22
|
+
if (result.value.mediaType !== protocolSchema.installation.MEDIA_TYPE) {
|
|
23
|
+
throw new TypeError('Schema install returned an unsupported media type.');
|
|
24
|
+
}
|
|
25
|
+
if (!(result.value.body instanceof Uint8Array)) {
|
|
26
|
+
await result.value.body[Symbol.asyncIterator]().return?.();
|
|
27
|
+
throw new TypeError('Schema install returned a streaming binary result.');
|
|
28
|
+
}
|
|
29
|
+
const decoded = await protocolSchema.installation.decode(result.value.body, installationResultLimit(admittedLimits.maximumPublicationBytes, request.domains.length));
|
|
30
|
+
proveInstallResult(request, decoded);
|
|
31
|
+
return decoded;
|
|
18
32
|
},
|
|
19
33
|
async uninstall(request, options) {
|
|
20
|
-
const
|
|
21
|
-
|
|
34
|
+
const snapshot = snapshotUninstallRequest(request);
|
|
35
|
+
const output = value(await call(invocation(UNINSTALL_PATH, snapshot), lifecycleOptions(options, admittedLimits.lifecycleTimeoutMs)));
|
|
36
|
+
const receipt = acceptOutput(uninstallOutput, output);
|
|
37
|
+
proveUninstallReceipt(snapshot, receipt);
|
|
38
|
+
return receipt;
|
|
22
39
|
},
|
|
23
|
-
async
|
|
24
|
-
return
|
|
40
|
+
async inspect(origin, options) {
|
|
41
|
+
return introspect(call, admittedLimits, { kind: 'inspect', origin }, options);
|
|
25
42
|
},
|
|
43
|
+
async bundle(origin, options) {
|
|
44
|
+
return introspect(call, admittedLimits, { kind: 'bundle', origin }, options);
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function snapshotUninstallRequest(request) {
|
|
49
|
+
return Object.freeze({
|
|
50
|
+
operation: request.operation,
|
|
51
|
+
domains: Object.freeze([...new Set(request.domains)].sort(compare)),
|
|
52
|
+
data: Object.freeze({ mode: request.data.mode }),
|
|
26
53
|
});
|
|
27
54
|
}
|
|
55
|
+
function proveUninstallReceipt(request, receipt) {
|
|
56
|
+
if (receipt.operation !== request.operation) {
|
|
57
|
+
throw new TypeError('Schema uninstall result does not match the requested operation.');
|
|
58
|
+
}
|
|
59
|
+
const actual = receipt.transitions.map((transition) => transition.intent.origin);
|
|
60
|
+
if (actual.length !== request.domains.length ||
|
|
61
|
+
actual.some((origin, index) => origin !== request.domains[index])) {
|
|
62
|
+
throw new TypeError('Schema uninstall result does not match the requested Domains.');
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function compare(left, right) {
|
|
66
|
+
return left < right ? -1 : left > right ? 1 : 0;
|
|
67
|
+
}
|
|
68
|
+
function installationResultLimit(maximumDomainBytes, roots) {
|
|
69
|
+
const perDomain = maximumDomainBytes + 4_096;
|
|
70
|
+
if (roots > Math.floor((Number.MAX_SAFE_INTEGER - 4_096) / perDomain)) {
|
|
71
|
+
return Number.MAX_SAFE_INTEGER;
|
|
72
|
+
}
|
|
73
|
+
return perDomain * roots + 4_096;
|
|
74
|
+
}
|
|
75
|
+
function proveInstallResult(request, result) {
|
|
76
|
+
if (result.changed) {
|
|
77
|
+
if (result.receipt.operation !== request.operation) {
|
|
78
|
+
throw new TypeError('Schema install result does not match the requested operation.');
|
|
79
|
+
}
|
|
80
|
+
if (result.receipt.transitions.length > request.domains.length) {
|
|
81
|
+
throw new TypeError('Schema install result contains more transitions than requested Domains.');
|
|
82
|
+
}
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
if (result.domains.length !== request.domains.length) {
|
|
86
|
+
throw new TypeError('Schema unchanged result does not match the requested Domain count.');
|
|
87
|
+
}
|
|
88
|
+
}
|
|
28
89
|
function value(result) {
|
|
29
90
|
if (result.kind !== 'value')
|
|
30
91
|
throw new TypeError('Schema syscall returned a non-value result.');
|
|
31
92
|
return result.value;
|
|
32
93
|
}
|
|
33
94
|
function admitLimits(input) {
|
|
95
|
+
const lifecycleTimeoutMs = input?.lifecycleTimeoutMs ?? DEFAULT_SCHEMA_LIFECYCLE_TIMEOUT_MS;
|
|
34
96
|
if (input === null ||
|
|
35
97
|
typeof input !== 'object' ||
|
|
36
98
|
!Number.isSafeInteger(input.maximumPublicationBytes) ||
|
|
37
99
|
input.maximumPublicationBytes < 1 ||
|
|
38
100
|
!Number.isSafeInteger(input.maximumBundleBytes) ||
|
|
39
|
-
input.maximumBundleBytes < 1
|
|
101
|
+
input.maximumBundleBytes < 1 ||
|
|
102
|
+
!Number.isSafeInteger(lifecycleTimeoutMs) ||
|
|
103
|
+
lifecycleTimeoutMs < 1 ||
|
|
104
|
+
lifecycleTimeoutMs > 2_147_483_647) {
|
|
40
105
|
throw new TypeError('Schema introspection limits are invalid.');
|
|
41
106
|
}
|
|
42
|
-
return Object.freeze({ ...input });
|
|
107
|
+
return Object.freeze({ ...input, lifecycleTimeoutMs });
|
|
108
|
+
}
|
|
109
|
+
function lifecycleOptions(options, timeoutMs) {
|
|
110
|
+
if (options?.timeoutMs !== undefined)
|
|
111
|
+
return options;
|
|
112
|
+
return Object.freeze({ ...options, timeoutMs });
|
|
43
113
|
}
|
|
44
|
-
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { IssuerId } from '@astrale-os/kernel-core/auth';
|
|
2
|
+
import type { SchemaApi } from '../schema/index.js';
|
|
3
|
+
import type { SessionControlOptions } from './context/index.js';
|
|
4
|
+
import type { CallableReference, InputOfReference, OutputOfReference } from './reference.js';
|
|
5
|
+
import type { SessionRequestOptions } from './routing/index.js';
|
|
6
|
+
import type { ClientSession } from './session.js';
|
|
7
|
+
import type { ViewCatalog } from './views/index.js';
|
|
8
|
+
import { type AuthApi } from '../auth/index.js';
|
|
9
|
+
import { type Binary, type Call, type Input, type Result, type Stream } from '../client/index.js';
|
|
10
|
+
import { type GraphApi } from '../graph/index.js';
|
|
11
|
+
/** Exact live Session surface captured by one credential-bound Kernel view. */
|
|
12
|
+
export interface BoundSessionSource {
|
|
13
|
+
readonly kernel: IssuerId;
|
|
14
|
+
readonly schema: SchemaApi;
|
|
15
|
+
dispatch(call: Call, options?: SessionRequestOptions): Promise<Result>;
|
|
16
|
+
call(call: Call, options?: SessionRequestOptions): Promise<Input>;
|
|
17
|
+
invoke<const Reference extends CallableReference<unknown>>(reference: Reference, input: InputOfReference<Reference>, options?: SessionRequestOptions): Promise<OutputOfReference<Reference>>;
|
|
18
|
+
stream(call: Call, options?: SessionRequestOptions): Promise<Stream>;
|
|
19
|
+
binary(call: Call, options?: SessionRequestOptions): Promise<Binary>;
|
|
20
|
+
viewsFor(target: Parameters<ClientSession['viewsFor']>[0], options?: SessionControlOptions): Promise<ViewCatalog>;
|
|
21
|
+
}
|
|
22
|
+
export interface BoundSessionControls {
|
|
23
|
+
readonly signal: AbortSignal;
|
|
24
|
+
/** Absolute Unix time in milliseconds. */
|
|
25
|
+
readonly deadline: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Credential-bound Kernel operations over one caller-owned ClientSession.
|
|
29
|
+
*
|
|
30
|
+
* The view owns no credential, transport, route cache, or lifecycle. Its source Session owns all of
|
|
31
|
+
* those concerns and closing that Session invalidates every operation exposed here.
|
|
32
|
+
*/
|
|
33
|
+
export interface BoundClientSession extends GraphApi {
|
|
34
|
+
readonly kernel: IssuerId;
|
|
35
|
+
readonly auth: AuthApi;
|
|
36
|
+
readonly schema: SchemaApi;
|
|
37
|
+
dispatch(call: Call, options?: SessionRequestOptions): Promise<Result>;
|
|
38
|
+
call(call: Call, options?: SessionRequestOptions): Promise<Input>;
|
|
39
|
+
invoke<const Reference extends CallableReference<unknown>>(reference: Reference, input: InputOfReference<Reference>, options?: SessionRequestOptions): Promise<OutputOfReference<Reference>>;
|
|
40
|
+
stream(call: Call, options?: SessionRequestOptions): Promise<Stream>;
|
|
41
|
+
binary(call: Call, options?: SessionRequestOptions): Promise<Binary>;
|
|
42
|
+
viewsFor: BoundSessionSource['viewsFor'];
|
|
43
|
+
}
|
|
44
|
+
/** Capture one Session into the ordinary graph, auth, and invocation Kernel journey. */
|
|
45
|
+
export declare function bindSession(source: BoundSessionSource, controls?: BoundSessionControls): BoundClientSession;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { createAuth } from '../auth/index.js';
|
|
2
|
+
import { call as createCall, } from '../client/index.js';
|
|
3
|
+
import { createGraph } from '../graph/index.js';
|
|
4
|
+
/** Capture one Session into the ordinary graph, auth, and invocation Kernel journey. */
|
|
5
|
+
export function bindSession(source, controls) {
|
|
6
|
+
if (source === null || typeof source !== 'object')
|
|
7
|
+
invalid();
|
|
8
|
+
const admittedControls = admitControls(controls);
|
|
9
|
+
const dispatchSource = capture(source, 'dispatch');
|
|
10
|
+
const callSource = capture(source, 'call');
|
|
11
|
+
const invokeSource = capture(source, 'invoke');
|
|
12
|
+
const streamSource = capture(source, 'stream');
|
|
13
|
+
const binarySource = capture(source, 'binary');
|
|
14
|
+
const viewsForSource = capture(source, 'viewsFor');
|
|
15
|
+
const schemaSource = captureSchema(source.schema);
|
|
16
|
+
const dispatch = (input, options) => dispatchSource(input, requestOptions(options, admittedControls));
|
|
17
|
+
const call = (input, options) => callSource(input, requestOptions(options, admittedControls));
|
|
18
|
+
const invoke = (reference, input, options) => invokeSource(reference, input, requestOptions(options, admittedControls));
|
|
19
|
+
const stream = (input, options) => streamSource(input, requestOptions(options, admittedControls));
|
|
20
|
+
const binary = (input, options) => binarySource(input, requestOptions(options, admittedControls));
|
|
21
|
+
const viewsFor = (target, options) => viewsForSource(target, controlOptions(options, admittedControls));
|
|
22
|
+
const install = (request, options) => schemaSource.install(request, controlOptions(options, admittedControls));
|
|
23
|
+
const uninstall = (request, options) => schemaSource.uninstall(request, controlOptions(options, admittedControls));
|
|
24
|
+
const inspect = (origin, options) => schemaSource.inspect(origin, controlOptions(options, admittedControls));
|
|
25
|
+
const bundle = (origin, options) => schemaSource.bundle(origin, controlOptions(options, admittedControls));
|
|
26
|
+
const schema = Object.freeze({ install, uninstall, inspect, bundle });
|
|
27
|
+
const graph = createGraph(call);
|
|
28
|
+
const auth = createAuth((target, input, options) => call(createCall(target, input), options));
|
|
29
|
+
return Object.freeze({
|
|
30
|
+
...graph,
|
|
31
|
+
kernel: source.kernel,
|
|
32
|
+
auth,
|
|
33
|
+
schema,
|
|
34
|
+
dispatch,
|
|
35
|
+
call,
|
|
36
|
+
invoke,
|
|
37
|
+
stream,
|
|
38
|
+
binary,
|
|
39
|
+
viewsFor,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
function admitControls(input) {
|
|
43
|
+
if (input === undefined)
|
|
44
|
+
return undefined;
|
|
45
|
+
if (input === null ||
|
|
46
|
+
typeof input !== 'object' ||
|
|
47
|
+
!(input.signal instanceof AbortSignal) ||
|
|
48
|
+
!Number.isFinite(input.deadline)) {
|
|
49
|
+
invalid();
|
|
50
|
+
}
|
|
51
|
+
return Object.freeze({ signal: input.signal, deadline: input.deadline });
|
|
52
|
+
}
|
|
53
|
+
function requestOptions(options, controls) {
|
|
54
|
+
return mergeOptions(options, controls);
|
|
55
|
+
}
|
|
56
|
+
function controlOptions(options, controls) {
|
|
57
|
+
return mergeOptions(options, controls);
|
|
58
|
+
}
|
|
59
|
+
function mergeOptions(options, controls) {
|
|
60
|
+
if (controls === undefined)
|
|
61
|
+
return options;
|
|
62
|
+
if (options?.signal !== undefined && options.signal !== controls.signal) {
|
|
63
|
+
throw new TypeError('Bound ClientSession cancellation cannot be replaced.');
|
|
64
|
+
}
|
|
65
|
+
if (controls.signal.aborted)
|
|
66
|
+
throw controls.signal.reason ?? new Error('Invocation cancelled.');
|
|
67
|
+
const remaining = Math.max(1, Math.ceil(controls.deadline - Date.now()));
|
|
68
|
+
const timeoutMs = options?.timeoutMs === undefined ? remaining : Math.min(options.timeoutMs, remaining);
|
|
69
|
+
return Object.freeze({ ...options, signal: controls.signal, timeoutMs });
|
|
70
|
+
}
|
|
71
|
+
function capture(source, key) {
|
|
72
|
+
const value = source[key];
|
|
73
|
+
if (typeof value !== 'function')
|
|
74
|
+
invalid();
|
|
75
|
+
return value.bind(source);
|
|
76
|
+
}
|
|
77
|
+
function captureSchema(input) {
|
|
78
|
+
if (input === null || typeof input !== 'object')
|
|
79
|
+
invalid();
|
|
80
|
+
return Object.freeze({
|
|
81
|
+
install: capture(input, 'install'),
|
|
82
|
+
uninstall: capture(input, 'uninstall'),
|
|
83
|
+
inspect: capture(input, 'inspect'),
|
|
84
|
+
bundle: capture(input, 'bundle'),
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
function invalid() {
|
|
88
|
+
throw new TypeError('Bound ClientSession source is invalid.');
|
|
89
|
+
}
|
|
@@ -2,4 +2,3 @@ export { admitControlOptions, type SessionControlOptions } from './control.js';
|
|
|
2
2
|
export { DEFAULT_MAXIMUM_BUNDLE_BYTES, DEFAULT_MAXIMUM_PUBLICATION_BYTES, DEFAULT_MAXIMUM_RESPONSE_BYTES, DEFAULT_MAXIMUM_ROUTES, DEFAULT_TIMEOUT_MS, platformDuration, positive, } from './limits.js';
|
|
3
3
|
export { createSessionOperation, runSessionOperation, sessionTransportOptions, type SessionOperation, } from './operation.js';
|
|
4
4
|
export { admitKernel, admitPolicy, allowEndpoint, kernelInvocationEndpoint, type SessionPolicy, } from './policy.js';
|
|
5
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -2,4 +2,3 @@ export { admitControlOptions } from './control.js';
|
|
|
2
2
|
export { DEFAULT_MAXIMUM_BUNDLE_BYTES, DEFAULT_MAXIMUM_PUBLICATION_BYTES, DEFAULT_MAXIMUM_RESPONSE_BYTES, DEFAULT_MAXIMUM_ROUTES, DEFAULT_TIMEOUT_MS, platformDuration, positive, } from './limits.js';
|
|
3
3
|
export { createSessionOperation, runSessionOperation, sessionTransportOptions, } from './operation.js';
|
|
4
4
|
export { admitKernel, admitPolicy, allowEndpoint, kernelInvocationEndpoint, } from './policy.js';
|
|
5
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -5,4 +5,3 @@ export declare const DEFAULT_TIMEOUT_MS = 30000;
|
|
|
5
5
|
export declare const DEFAULT_MAXIMUM_ROUTES = 256;
|
|
6
6
|
export declare function positive(input: number, label: string): number;
|
|
7
7
|
export declare function platformDuration(input: number, label: string): number;
|
|
8
|
-
//# sourceMappingURL=limits.d.ts.map
|
|
@@ -17,4 +17,3 @@ export declare function sessionTransportOptions(operation: SessionOperation, ide
|
|
|
17
17
|
/** Settle independently of a caller capability that ignores its supplied AbortSignal. */
|
|
18
18
|
export declare function runSessionOperation<Result>(operation: SessionOperation, task: (signal: AbortSignal) => Result | PromiseLike<Result>): Promise<Result>;
|
|
19
19
|
export declare function requireSessionOperation(operation: SessionOperation): void;
|
|
20
|
-
//# sourceMappingURL=operation.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SessionError } from '../../errors/index.js';
|
|
2
2
|
/** Create one total wall-clock budget for a complete public Client Session operation. */
|
|
3
3
|
export function createSessionOperation(lifecycle, input, defaultTimeoutMs) {
|
|
4
4
|
const timeoutMs = input?.timeoutMs ?? defaultTimeoutMs;
|
|
@@ -22,7 +22,7 @@ export function remainingSessionTime(operation) {
|
|
|
22
22
|
requireSessionOperation(operation);
|
|
23
23
|
const remaining = operation.deadline - Date.now();
|
|
24
24
|
if (remaining < 1)
|
|
25
|
-
throw new
|
|
25
|
+
throw new SessionError('Session operation timed out.', { failure: 'timeout' });
|
|
26
26
|
return remaining;
|
|
27
27
|
}
|
|
28
28
|
export function sessionTransportOptions(operation, idempotencyKey) {
|
|
@@ -33,13 +33,8 @@ export function sessionTransportOptions(operation, idempotencyKey) {
|
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
35
|
/** Settle independently of a caller capability that ignores its supplied AbortSignal. */
|
|
36
|
-
export function runSessionOperation(operation, task) {
|
|
37
|
-
|
|
38
|
-
requireSessionOperation(operation);
|
|
39
|
-
}
|
|
40
|
-
catch (error) {
|
|
41
|
-
return Promise.reject(error);
|
|
42
|
-
}
|
|
36
|
+
export async function runSessionOperation(operation, task) {
|
|
37
|
+
requireSessionOperation(operation);
|
|
43
38
|
let abort;
|
|
44
39
|
const interrupted = new Promise((_resolve, reject) => {
|
|
45
40
|
abort = () => reject(sessionInterruption(operation.signal.reason));
|
|
@@ -49,9 +44,14 @@ export function runSessionOperation(operation, task) {
|
|
|
49
44
|
requireSessionOperation(operation);
|
|
50
45
|
return task(operation.signal);
|
|
51
46
|
});
|
|
52
|
-
return Promise.race([execution, interrupted])
|
|
53
|
-
|
|
54
|
-
|
|
47
|
+
return Promise.race([execution, interrupted])
|
|
48
|
+
.catch((cause) => {
|
|
49
|
+
if (operation.signal.aborted)
|
|
50
|
+
throw sessionInterruption(operation.signal.reason);
|
|
51
|
+
throw cause;
|
|
52
|
+
})
|
|
53
|
+
.finally(() => {
|
|
54
|
+
operation.signal.removeEventListener('abort', abort);
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
57
|
export function requireSessionOperation(operation) {
|
|
@@ -60,11 +60,13 @@ export function requireSessionOperation(operation) {
|
|
|
60
60
|
throw sessionInterruption(operation.signal.reason);
|
|
61
61
|
}
|
|
62
62
|
function sessionInterruption(reason) {
|
|
63
|
+
if (reason instanceof SessionError)
|
|
64
|
+
return reason;
|
|
63
65
|
if (reason instanceof DOMException && reason.name === 'TimeoutError') {
|
|
64
|
-
return new
|
|
66
|
+
return new SessionError('Session operation timed out.', { cause: reason, failure: 'timeout' });
|
|
65
67
|
}
|
|
66
|
-
return
|
|
67
|
-
|
|
68
|
-
:
|
|
68
|
+
return new SessionError('Session operation was cancelled.', {
|
|
69
|
+
cause: reason,
|
|
70
|
+
failure: 'cancelled',
|
|
71
|
+
});
|
|
69
72
|
}
|
|
70
|
-
//# sourceMappingURL=operation.js.map
|
|
@@ -9,4 +9,3 @@ export declare function admitKernel(input: string, insecure: boolean): IssuerId;
|
|
|
9
9
|
export declare function kernelInvocationEndpoint(input: IssuerId): string;
|
|
10
10
|
export declare function websocketEndpoint(input: string, insecure: boolean): string;
|
|
11
11
|
export declare function allowEndpoint(url: string, policy: Readonly<SessionPolicy>): void;
|
|
12
|
-
//# sourceMappingURL=policy.d.ts.map
|
|
@@ -2,17 +2,20 @@ import type { bundle } from '@astrale-os/kernel-dsl/v1';
|
|
|
2
2
|
import type { publication } from '@astrale-os/kernel-protocol';
|
|
3
3
|
import type { Fetch } from '../../transport/http/index.js';
|
|
4
4
|
import type { SessionOperation, SessionPolicy } from '../context/index.js';
|
|
5
|
+
import { ClientError } from '../../errors/index.js';
|
|
5
6
|
export interface BundleDiscoveryOptions {
|
|
6
7
|
readonly fetch: Fetch;
|
|
7
8
|
readonly policy: Readonly<SessionPolicy>;
|
|
8
9
|
readonly maximumBytes: number;
|
|
9
10
|
}
|
|
11
|
+
/** Internal evidence that a selected immutable artifact is no longer served. */
|
|
12
|
+
export declare class BundleUnavailableError extends ClientError {
|
|
13
|
+
}
|
|
10
14
|
export declare class BundleDiscovery {
|
|
11
15
|
private readonly options;
|
|
12
|
-
private
|
|
16
|
+
private retained?;
|
|
13
17
|
constructor(options: BundleDiscoveryOptions);
|
|
14
18
|
get(publication: publication.Publication, operation: SessionOperation): Promise<bundle.Bundle>;
|
|
15
19
|
clear(): void;
|
|
16
20
|
private fetch;
|
|
17
21
|
}
|
|
18
|
-
//# sourceMappingURL=bundle.d.ts.map
|
|
@@ -1,38 +1,49 @@
|
|
|
1
|
+
import { bundleUrl } from '@astrale-os/kernel-protocol/publication';
|
|
1
2
|
import { decodeBundleValue } from '@astrale-os/kernel-protocol/publication/bundle';
|
|
2
3
|
import { ClientError } from '../../errors/index.js';
|
|
3
|
-
import { allowEndpoint
|
|
4
|
+
import { allowEndpoint } from '../context/index.js';
|
|
4
5
|
import { boundedResponse, requireExactResponse } from './publication.js';
|
|
6
|
+
import { runAcquisition } from './transport.js';
|
|
7
|
+
/** Internal evidence that a selected immutable artifact is no longer served. */
|
|
8
|
+
export class BundleUnavailableError extends ClientError {
|
|
9
|
+
}
|
|
5
10
|
export class BundleDiscovery {
|
|
6
11
|
options;
|
|
7
|
-
|
|
12
|
+
retained;
|
|
8
13
|
constructor(options) {
|
|
9
14
|
this.options = options;
|
|
10
15
|
}
|
|
11
16
|
async get(publication, operation) {
|
|
12
17
|
const key = bundleKey(publication);
|
|
13
|
-
|
|
14
|
-
if (
|
|
15
|
-
return
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return retained;
|
|
18
|
+
allowEndpoint(publication.schema.bundle.href, this.options.policy);
|
|
19
|
+
if (this.retained?.key === key)
|
|
20
|
+
return this.retained.value;
|
|
21
|
+
const value = await this.fetch(publication, operation);
|
|
22
|
+
this.retained = { key, value };
|
|
23
|
+
return value;
|
|
20
24
|
}
|
|
21
25
|
clear() {
|
|
22
|
-
this.
|
|
26
|
+
this.retained = undefined;
|
|
23
27
|
}
|
|
24
28
|
async fetch(publication, operation) {
|
|
25
29
|
if (publication.schema.bundle.ref.size > this.options.maximumBytes) {
|
|
26
30
|
throw new ClientError('Bundle artifact exceeds its byte limit.');
|
|
27
31
|
}
|
|
28
32
|
const href = publication.schema.bundle.href;
|
|
29
|
-
|
|
30
|
-
const response = await
|
|
33
|
+
const immutable = href === bundleUrl(publication.identity.issuer, publication.schema.bundle.ref);
|
|
34
|
+
const response = await runAcquisition(operation, 'bundle', 'unknown', 'Kernel bundle could not be retrieved.', (signal) => this.options.fetch(href, {
|
|
31
35
|
headers: { accept: publication.schema.bundle.ref.mediaType },
|
|
36
|
+
// Omitting `cache` is the browser default; Workers reject the DOM-only 'default' mode.
|
|
37
|
+
cache: immutable ? undefined : 'no-cache',
|
|
32
38
|
redirect: 'manual',
|
|
33
39
|
signal,
|
|
34
40
|
}));
|
|
35
41
|
requireExactResponse(response, href, 'Bundle retrieval');
|
|
42
|
+
if (immutable && (response.status === 404 || response.status === 410)) {
|
|
43
|
+
// Cleanup must not hold discovery open on an injected body cancellation.
|
|
44
|
+
void response.body?.cancel().catch(() => undefined);
|
|
45
|
+
throw new BundleUnavailableError(`Bundle retrieval returned HTTP ${response.status}.`);
|
|
46
|
+
}
|
|
36
47
|
if (!response.ok)
|
|
37
48
|
throw new ClientError(`Bundle retrieval returned HTTP ${response.status}.`);
|
|
38
49
|
if (response.headers.get('content-type') !== publication.schema.bundle.ref.mediaType) {
|
|
@@ -42,7 +53,7 @@ export class BundleDiscovery {
|
|
|
42
53
|
if (etag !== null && etag !== `"${publication.schema.bundle.ref.digest}"`) {
|
|
43
54
|
throw new ClientError('Bundle response ETag differs from its descriptor.');
|
|
44
55
|
}
|
|
45
|
-
const bytes = await
|
|
56
|
+
const bytes = await runAcquisition(operation, 'bundle', 'receive', 'Kernel bundle response could not be read.', (signal) => boundedResponse(response, publication.schema.bundle.ref.size, signal));
|
|
46
57
|
if (bytes.byteLength !== publication.schema.bundle.ref.size) {
|
|
47
58
|
throw new ClientError('Bundle artifact size differs from its descriptor.');
|
|
48
59
|
}
|
|
@@ -50,6 +61,14 @@ export class BundleDiscovery {
|
|
|
50
61
|
}
|
|
51
62
|
}
|
|
52
63
|
function bundleKey(publication) {
|
|
53
|
-
|
|
64
|
+
const { href, ref } = publication.schema.bundle;
|
|
65
|
+
return JSON.stringify([
|
|
66
|
+
publication.identity.issuer,
|
|
67
|
+
new URL(href).origin,
|
|
68
|
+
publication.origin,
|
|
69
|
+
publication.schema.revision,
|
|
70
|
+
ref.digest,
|
|
71
|
+
ref.mediaType,
|
|
72
|
+
ref.size,
|
|
73
|
+
]);
|
|
54
74
|
}
|
|
55
|
-
//# sourceMappingURL=bundle.js.map
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { IssuerId } from '@astrale-os/kernel-core/auth/issuer';
|
|
2
|
+
import type { publication } from '@astrale-os/kernel-protocol';
|
|
2
3
|
import type { SessionOperation, SessionPolicy } from '../context/index.js';
|
|
3
|
-
import type { BundleDiscovery } from './bundle.js';
|
|
4
4
|
import type { PublicationDiscovery } from './publication.js';
|
|
5
5
|
import type { SessionSnapshot } from './snapshot.js';
|
|
6
|
+
import { type BundleDiscovery } from './bundle.js';
|
|
6
7
|
export declare class SessionDiscovery {
|
|
7
8
|
readonly kernel: IssuerId;
|
|
8
9
|
private readonly policy;
|
|
@@ -12,9 +13,10 @@ export declare class SessionDiscovery {
|
|
|
12
13
|
private readonly acquisitionOperation;
|
|
13
14
|
private retained?;
|
|
14
15
|
private flight?;
|
|
16
|
+
private publicationFlight?;
|
|
15
17
|
constructor(kernel: IssuerId, policy: Readonly<SessionPolicy>, publications: PublicationDiscovery, bundles: BundleDiscovery, requireOpen: () => void, acquisitionOperation: () => SessionOperation);
|
|
18
|
+
publication(operation: SessionOperation): Promise<publication.Publication>;
|
|
16
19
|
snapshot(operation: SessionOperation): Promise<SessionSnapshot>;
|
|
17
20
|
clear(): void;
|
|
18
21
|
private acquireSnapshot;
|
|
19
22
|
}
|
|
20
|
-
//# sourceMappingURL=discovery.d.ts.map
|
|
@@ -1,5 +1,6 @@
|
|
|
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;
|
|
@@ -10,6 +11,7 @@ export class SessionDiscovery {
|
|
|
10
11
|
acquisitionOperation;
|
|
11
12
|
retained;
|
|
12
13
|
flight;
|
|
14
|
+
publicationFlight;
|
|
13
15
|
constructor(kernel, policy, publications, bundles, requireOpen, acquisitionOperation) {
|
|
14
16
|
this.kernel = kernel;
|
|
15
17
|
this.policy = policy;
|
|
@@ -18,6 +20,24 @@ export class SessionDiscovery {
|
|
|
18
20
|
this.requireOpen = requireOpen;
|
|
19
21
|
this.acquisitionOperation = acquisitionOperation;
|
|
20
22
|
}
|
|
23
|
+
publication(operation) {
|
|
24
|
+
this.requireOpen();
|
|
25
|
+
const current = this.publicationFlight;
|
|
26
|
+
if (current !== undefined)
|
|
27
|
+
return runSessionOperation(operation, () => current);
|
|
28
|
+
const flight = this.publications.revalidate(this.acquisitionOperation()).then((value) => {
|
|
29
|
+
this.requireOpen();
|
|
30
|
+
return value;
|
|
31
|
+
});
|
|
32
|
+
this.publicationFlight = flight;
|
|
33
|
+
void flight
|
|
34
|
+
.finally(() => {
|
|
35
|
+
if (this.publicationFlight === flight)
|
|
36
|
+
this.publicationFlight = 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;
|
|
@@ -39,11 +59,20 @@ export class SessionDiscovery {
|
|
|
39
59
|
this.retained = undefined;
|
|
40
60
|
}
|
|
41
61
|
async acquireSnapshot(operation) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
this.bundles.
|
|
46
|
-
|
|
62
|
+
let publication = await this.publication(operation);
|
|
63
|
+
let artifact;
|
|
64
|
+
try {
|
|
65
|
+
artifact = await this.bundles.get(publication, operation);
|
|
66
|
+
}
|
|
67
|
+
catch (cause) {
|
|
68
|
+
if (!(cause instanceof BundleUnavailableError))
|
|
69
|
+
throw cause;
|
|
70
|
+
const current = await this.publication(operation);
|
|
71
|
+
if (current.etag === publication.etag)
|
|
72
|
+
throw cause;
|
|
73
|
+
publication = current;
|
|
74
|
+
artifact = await this.bundles.get(publication, operation);
|
|
75
|
+
}
|
|
47
76
|
this.requireOpen();
|
|
48
77
|
if (this.retained?.publication.etag === publication.etag)
|
|
49
78
|
return this.retained;
|
|
@@ -53,4 +82,3 @@ export class SessionDiscovery {
|
|
|
53
82
|
return snapshot;
|
|
54
83
|
}
|
|
55
84
|
}
|
|
56
|
-
//# sourceMappingURL=discovery.js.map
|