@astrale-os/kernel-client 0.6.0-beta.7 → 0.6.0-beta.70
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 +9 -6
- package/dist/auth/auth.js +2 -3
- package/dist/auth/authorization.d.ts +6 -4
- package/dist/auth/authorization.js +25 -6
- package/dist/auth/credential.d.ts +5 -1
- package/dist/auth/credential.js +6 -3
- package/dist/auth/identity.d.ts +6 -9
- package/dist/auth/identity.js +0 -1
- package/dist/auth/index.d.ts +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 +13 -10
- package/dist/schema/schema.js +83 -11
- package/dist/session/bound.d.ts +45 -0
- package/dist/session/bound.js +91 -0
- package/dist/session/context/control.d.ts +0 -1
- package/dist/session/context/control.js +0 -1
- package/dist/session/context/index.d.ts +0 -1
- package/dist/session/context/index.js +0 -1
- package/dist/session/context/limits.d.ts +0 -1
- package/dist/session/context/limits.js +0 -1
- package/dist/session/context/operation.d.ts +0 -1
- package/dist/session/context/operation.js +19 -17
- package/dist/session/context/policy.d.ts +0 -1
- package/dist/session/context/policy.js +0 -1
- package/dist/session/credential/index.d.ts +1 -0
- package/dist/session/credential/index.js +1 -0
- package/dist/session/credential/limits.d.ts +12 -0
- package/dist/session/credential/limits.js +12 -0
- package/dist/session/credential/provider.d.ts +51 -0
- package/dist/session/credential/provider.js +229 -0
- package/dist/session/discovery/bundle.d.ts +5 -2
- package/dist/session/discovery/bundle.js +34 -15
- package/dist/session/discovery/discovery.d.ts +4 -2
- package/dist/session/discovery/discovery.js +34 -6
- package/dist/session/discovery/index.d.ts +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 +5 -3
- package/dist/session/index.js +3 -1
- package/dist/session/reference.d.ts +23 -10
- package/dist/session/reference.js +38 -10
- package/dist/session/routing/auth.d.ts +0 -1
- package/dist/session/routing/auth.js +0 -1
- package/dist/session/routing/cache.d.ts +27 -8
- package/dist/session/routing/cache.js +218 -25
- package/dist/session/routing/dispatch.d.ts +3 -7
- package/dist/session/routing/dispatch.js +53 -28
- package/dist/session/routing/envelope.d.ts +2 -1
- package/dist/session/routing/envelope.js +14 -10
- package/dist/session/routing/index.d.ts +1 -3
- package/dist/session/routing/index.js +1 -2
- package/dist/session/routing/request.d.ts +0 -1
- package/dist/session/routing/request.js +0 -1
- package/dist/session/session.d.ts +16 -7
- package/dist/session/session.js +54 -30
- package/dist/session/session.typecheck.d.ts +0 -1
- package/dist/session/session.typecheck.js +96 -3
- package/dist/session/views/catalog.d.ts +0 -1
- package/dist/session/views/catalog.js +14 -5
- package/dist/session/views/index.d.ts +0 -1
- package/dist/session/views/index.js +0 -1
- package/dist/session/views/resolve.d.ts +0 -1
- package/dist/session/views/resolve.js +0 -1
- package/dist/store/entity-index.d.ts +0 -1
- package/dist/store/entity-index.js +0 -1
- package/dist/store/index.d.ts +0 -1
- package/dist/store/index.js +0 -1
- package/dist/store/memory.d.ts +2 -2
- package/dist/store/memory.js +38 -15
- package/dist/store/mutation.d.ts +1 -2
- package/dist/store/mutation.js +6 -4
- package/dist/store/observe.d.ts +0 -1
- package/dist/store/observe.js +0 -1
- package/dist/store/optimistic.d.ts +0 -1
- package/dist/store/optimistic.js +0 -1
- package/dist/store/query-key.d.ts +2 -2
- package/dist/store/query-key.js +7 -3
- package/dist/store/shape.d.ts +4 -2
- package/dist/store/shape.js +4 -2
- package/dist/store/store.d.ts +2 -4
- package/dist/store/store.js +6 -5
- package/dist/store/store.typecheck.d.ts +0 -1
- package/dist/store/store.typecheck.js +3 -9
- package/dist/transport/auto/decision.d.ts +0 -1
- package/dist/transport/auto/decision.js +0 -1
- package/dist/transport/auto/fallback.d.ts +2 -2
- package/dist/transport/auto/fallback.js +10 -11
- package/dist/transport/auto/index.d.ts +0 -1
- package/dist/transport/auto/index.js +0 -1
- package/dist/transport/auto/transport.d.ts +0 -1
- package/dist/transport/auto/transport.js +5 -6
- package/dist/transport/auto/warning.d.ts +0 -1
- package/dist/transport/auto/warning.js +5 -3
- package/dist/transport/deadline.d.ts +0 -1
- package/dist/transport/deadline.js +0 -1
- package/dist/transport/failure.d.ts +7 -0
- package/dist/transport/failure.js +9 -0
- package/dist/transport/http/byte-stream.d.ts +17 -0
- package/dist/transport/http/byte-stream.js +86 -0
- package/dist/transport/http/index.d.ts +0 -1
- package/dist/transport/http/index.js +0 -1
- package/dist/transport/http/response.d.ts +0 -1
- package/dist/transport/http/response.js +0 -1
- package/dist/transport/http/stream.d.ts +0 -1
- package/dist/transport/http/stream.js +7 -7
- package/dist/transport/http/transport.d.ts +0 -1
- package/dist/transport/http/transport.js +43 -20
- package/dist/transport/index.d.ts +0 -1
- package/dist/transport/index.js +0 -1
- package/dist/transport/transport.d.ts +0 -1
- package/dist/transport/transport.js +0 -1
- package/dist/transport/websocket/connection.d.ts +0 -1
- package/dist/transport/websocket/connection.js +16 -26
- package/dist/transport/websocket/exchange.d.ts +0 -1
- package/dist/transport/websocket/exchange.js +5 -9
- package/dist/transport/websocket/index.d.ts +0 -1
- package/dist/transport/websocket/index.js +0 -1
- package/dist/transport/websocket/transport.d.ts +0 -1
- package/dist/transport/websocket/transport.js +7 -20
- package/package.json +12 -14
- package/dist/auth/auth.d.ts.map +0 -1
- package/dist/auth/auth.js.map +0 -1
- package/dist/auth/authorization.d.ts.map +0 -1
- package/dist/auth/authorization.js.map +0 -1
- package/dist/auth/credential.d.ts.map +0 -1
- package/dist/auth/credential.js.map +0 -1
- package/dist/auth/identity.d.ts.map +0 -1
- package/dist/auth/identity.js.map +0 -1
- package/dist/auth/index.d.ts.map +0 -1
- package/dist/auth/index.js.map +0 -1
- package/dist/auth/provision.d.ts +0 -9
- package/dist/auth/provision.d.ts.map +0 -1
- package/dist/auth/provision.js +0 -11
- package/dist/auth/provision.js.map +0 -1
- package/dist/client/admission.d.ts.map +0 -1
- package/dist/client/admission.js.map +0 -1
- package/dist/client/client.d.ts.map +0 -1
- package/dist/client/client.js.map +0 -1
- package/dist/client/credential.d.ts.map +0 -1
- package/dist/client/credential.js.map +0 -1
- package/dist/client/index.d.ts.map +0 -1
- package/dist/client/index.js.map +0 -1
- package/dist/client/request.d.ts.map +0 -1
- package/dist/client/request.js.map +0 -1
- package/dist/client/result.d.ts.map +0 -1
- package/dist/client/result.js.map +0 -1
- package/dist/client/routing-control.d.ts.map +0 -1
- package/dist/client/routing-control.js.map +0 -1
- package/dist/errors/client-error.d.ts.map +0 -1
- package/dist/errors/client-error.js.map +0 -1
- package/dist/errors/index.d.ts.map +0 -1
- package/dist/errors/index.js.map +0 -1
- package/dist/errors/miss-error.d.ts.map +0 -1
- package/dist/errors/miss-error.js.map +0 -1
- package/dist/errors/protocol-error.d.ts.map +0 -1
- package/dist/errors/protocol-error.js.map +0 -1
- package/dist/errors/response-error.d.ts.map +0 -1
- package/dist/errors/response-error.js.map +0 -1
- package/dist/errors/stale-route-error.d.ts.map +0 -1
- package/dist/errors/stale-route-error.js.map +0 -1
- package/dist/errors/transport-error.d.ts.map +0 -1
- package/dist/errors/transport-error.js.map +0 -1
- package/dist/graph/errors.d.ts.map +0 -1
- package/dist/graph/errors.js.map +0 -1
- package/dist/graph/graph.d.ts.map +0 -1
- package/dist/graph/graph.js.map +0 -1
- package/dist/graph/index.d.ts.map +0 -1
- package/dist/graph/index.js.map +0 -1
- package/dist/graph/mutation.d.ts.map +0 -1
- package/dist/graph/mutation.js.map +0 -1
- package/dist/graph/page/index.d.ts.map +0 -1
- package/dist/graph/page/index.js.map +0 -1
- package/dist/graph/page/neighbors.d.ts.map +0 -1
- package/dist/graph/page/neighbors.js.map +0 -1
- package/dist/graph/page/page.d.ts.map +0 -1
- package/dist/graph/page/page.js.map +0 -1
- package/dist/graph/page-contract.d.ts.map +0 -1
- package/dist/graph/page-contract.js.map +0 -1
- package/dist/graph/query.d.ts.map +0 -1
- package/dist/graph/query.js.map +0 -1
- package/dist/graph/read.d.ts.map +0 -1
- package/dist/graph/read.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/pacer/batcher/batcher.d.ts.map +0 -1
- package/dist/pacer/batcher/batcher.js.map +0 -1
- package/dist/pacer/batcher/defaults.d.ts.map +0 -1
- package/dist/pacer/batcher/defaults.js.map +0 -1
- package/dist/pacer/batcher/index.d.ts.map +0 -1
- package/dist/pacer/batcher/index.js.map +0 -1
- package/dist/pacer/index.d.ts.map +0 -1
- package/dist/pacer/index.js.map +0 -1
- package/dist/pacer/limiter/defaults.d.ts.map +0 -1
- package/dist/pacer/limiter/defaults.js.map +0 -1
- package/dist/pacer/limiter/index.d.ts.map +0 -1
- package/dist/pacer/limiter/index.js.map +0 -1
- package/dist/pacer/limiter/limiter.d.ts.map +0 -1
- package/dist/pacer/limiter/limiter.js.map +0 -1
- package/dist/pacer/queue/defaults.d.ts.map +0 -1
- package/dist/pacer/queue/defaults.js.map +0 -1
- package/dist/pacer/queue/index.d.ts.map +0 -1
- package/dist/pacer/queue/index.js.map +0 -1
- package/dist/pacer/queue/queue.d.ts.map +0 -1
- package/dist/pacer/queue/queue.js.map +0 -1
- package/dist/pacer/retry/defaults.d.ts.map +0 -1
- package/dist/pacer/retry/defaults.js.map +0 -1
- package/dist/pacer/retry/index.d.ts.map +0 -1
- package/dist/pacer/retry/index.js.map +0 -1
- package/dist/pacer/retry/retry.d.ts.map +0 -1
- package/dist/pacer/retry/retry.js.map +0 -1
- package/dist/pool/index.d.ts.map +0 -1
- package/dist/pool/index.js.map +0 -1
- package/dist/pool/pool.d.ts.map +0 -1
- package/dist/pool/pool.js.map +0 -1
- package/dist/pool/target.d.ts.map +0 -1
- package/dist/pool/target.js.map +0 -1
- package/dist/schema/admission.d.ts.map +0 -1
- package/dist/schema/admission.js.map +0 -1
- package/dist/schema/contracts.d.ts.map +0 -1
- package/dist/schema/contracts.js.map +0 -1
- package/dist/schema/index.d.ts.map +0 -1
- package/dist/schema/index.js.map +0 -1
- package/dist/schema/introspection.d.ts.map +0 -1
- package/dist/schema/introspection.js.map +0 -1
- package/dist/schema/operation.d.ts.map +0 -1
- package/dist/schema/operation.js.map +0 -1
- package/dist/schema/schema.d.ts.map +0 -1
- package/dist/schema/schema.js.map +0 -1
- package/dist/session/context/control.d.ts.map +0 -1
- package/dist/session/context/control.js.map +0 -1
- package/dist/session/context/index.d.ts.map +0 -1
- package/dist/session/context/index.js.map +0 -1
- package/dist/session/context/limits.d.ts.map +0 -1
- package/dist/session/context/limits.js.map +0 -1
- package/dist/session/context/operation.d.ts.map +0 -1
- package/dist/session/context/operation.js.map +0 -1
- package/dist/session/context/policy.d.ts.map +0 -1
- package/dist/session/context/policy.js.map +0 -1
- package/dist/session/discovery/bundle.d.ts.map +0 -1
- package/dist/session/discovery/bundle.js.map +0 -1
- package/dist/session/discovery/discovery.d.ts.map +0 -1
- package/dist/session/discovery/discovery.js.map +0 -1
- package/dist/session/discovery/index.d.ts.map +0 -1
- package/dist/session/discovery/index.js.map +0 -1
- package/dist/session/discovery/publication.d.ts.map +0 -1
- package/dist/session/discovery/publication.js.map +0 -1
- package/dist/session/discovery/snapshot.d.ts.map +0 -1
- package/dist/session/discovery/snapshot.js.map +0 -1
- package/dist/session/index.d.ts.map +0 -1
- package/dist/session/index.js.map +0 -1
- package/dist/session/reference.d.ts.map +0 -1
- package/dist/session/reference.js.map +0 -1
- package/dist/session/routing/auth.d.ts.map +0 -1
- package/dist/session/routing/auth.js.map +0 -1
- package/dist/session/routing/cache.d.ts.map +0 -1
- package/dist/session/routing/cache.js.map +0 -1
- package/dist/session/routing/dispatch.d.ts.map +0 -1
- package/dist/session/routing/dispatch.js.map +0 -1
- package/dist/session/routing/envelope.d.ts.map +0 -1
- package/dist/session/routing/envelope.js.map +0 -1
- package/dist/session/routing/expectation.d.ts +0 -7
- package/dist/session/routing/expectation.d.ts.map +0 -1
- package/dist/session/routing/expectation.js +0 -2
- package/dist/session/routing/expectation.js.map +0 -1
- package/dist/session/routing/index.d.ts.map +0 -1
- package/dist/session/routing/index.js.map +0 -1
- package/dist/session/routing/request.d.ts.map +0 -1
- package/dist/session/routing/request.js.map +0 -1
- package/dist/session/session.d.ts.map +0 -1
- package/dist/session/session.js.map +0 -1
- package/dist/session/session.typecheck.d.ts.map +0 -1
- package/dist/session/session.typecheck.js.map +0 -1
- package/dist/session/views/catalog.d.ts.map +0 -1
- package/dist/session/views/catalog.js.map +0 -1
- package/dist/session/views/index.d.ts.map +0 -1
- package/dist/session/views/index.js.map +0 -1
- package/dist/session/views/resolve.d.ts.map +0 -1
- package/dist/session/views/resolve.js.map +0 -1
- package/dist/store/entity-index.d.ts.map +0 -1
- package/dist/store/entity-index.js.map +0 -1
- package/dist/store/index.d.ts.map +0 -1
- package/dist/store/index.js.map +0 -1
- package/dist/store/memory.d.ts.map +0 -1
- package/dist/store/memory.js.map +0 -1
- package/dist/store/mutation.d.ts.map +0 -1
- package/dist/store/mutation.js.map +0 -1
- package/dist/store/observe.d.ts.map +0 -1
- package/dist/store/observe.js.map +0 -1
- package/dist/store/optimistic.d.ts.map +0 -1
- package/dist/store/optimistic.js.map +0 -1
- package/dist/store/query-key.d.ts.map +0 -1
- package/dist/store/query-key.js.map +0 -1
- package/dist/store/shape.d.ts.map +0 -1
- package/dist/store/shape.js.map +0 -1
- package/dist/store/store.d.ts.map +0 -1
- package/dist/store/store.js.map +0 -1
- package/dist/store/store.typecheck.d.ts.map +0 -1
- package/dist/store/store.typecheck.js.map +0 -1
- package/dist/transport/auto/decision.d.ts.map +0 -1
- package/dist/transport/auto/decision.js.map +0 -1
- package/dist/transport/auto/fallback.d.ts.map +0 -1
- package/dist/transport/auto/fallback.js.map +0 -1
- package/dist/transport/auto/index.d.ts.map +0 -1
- package/dist/transport/auto/index.js.map +0 -1
- package/dist/transport/auto/transport.d.ts.map +0 -1
- package/dist/transport/auto/transport.js.map +0 -1
- package/dist/transport/auto/warning.d.ts.map +0 -1
- package/dist/transport/auto/warning.js.map +0 -1
- package/dist/transport/deadline.d.ts.map +0 -1
- package/dist/transport/deadline.js.map +0 -1
- package/dist/transport/http/index.d.ts.map +0 -1
- package/dist/transport/http/index.js.map +0 -1
- package/dist/transport/http/response.d.ts.map +0 -1
- package/dist/transport/http/response.js.map +0 -1
- package/dist/transport/http/stream.d.ts.map +0 -1
- package/dist/transport/http/stream.js.map +0 -1
- package/dist/transport/http/transport.d.ts.map +0 -1
- package/dist/transport/http/transport.js.map +0 -1
- package/dist/transport/index.d.ts.map +0 -1
- package/dist/transport/index.js.map +0 -1
- package/dist/transport/transport.d.ts.map +0 -1
- package/dist/transport/transport.js.map +0 -1
- package/dist/transport/websocket/connection.d.ts.map +0 -1
- package/dist/transport/websocket/connection.js.map +0 -1
- package/dist/transport/websocket/exchange.d.ts.map +0 -1
- package/dist/transport/websocket/exchange.js.map +0 -1
- package/dist/transport/websocket/index.d.ts.map +0 -1
- package/dist/transport/websocket/index.js.map +0 -1
- package/dist/transport/websocket/transport.d.ts.map +0 -1
- package/dist/transport/websocket/transport.js.map +0 -1
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,23 @@
|
|
|
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 DomainDependencies = protocolSchema.installation.introspection.DomainDependencies;
|
|
13
|
+
export type InstallResult = protocolSchema.installation.InstallResult;
|
|
13
14
|
export interface SchemaApi {
|
|
14
|
-
install(request: InstallRequest, options?: RequestOptions): Promise<
|
|
15
|
+
install(request: InstallRequest, options?: RequestOptions): Promise<InstallResult>;
|
|
15
16
|
uninstall(request: UninstallRequest, options?: RequestOptions): Promise<UninstallReceipt>;
|
|
16
|
-
|
|
17
|
+
inspect(origin: Key.Origin, options?: RequestOptions): Promise<DomainInfo>;
|
|
18
|
+
bundle(origin: Key.Origin, options?: RequestOptions): Promise<DomainBundle>;
|
|
19
|
+
dependencies(origin: Key.Origin, options?: RequestOptions): Promise<DomainDependencies>;
|
|
17
20
|
}
|
|
21
|
+
export declare const DEFAULT_SCHEMA_LIFECYCLE_TIMEOUT_MS = 110000;
|
|
18
22
|
/** Bind the canonical Schema lifecycle syscalls to one caller-scoped value-call capability. */
|
|
19
23
|
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,102 @@ 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
|
+
async dependencies(origin, options) {
|
|
47
|
+
return introspect(call, admittedLimits, { kind: 'dependencies', origin }, options);
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
function snapshotUninstallRequest(request) {
|
|
52
|
+
return Object.freeze({
|
|
53
|
+
operation: request.operation,
|
|
54
|
+
domains: Object.freeze([...new Set(request.domains)].sort(compare)),
|
|
55
|
+
data: Object.freeze({ mode: request.data.mode }),
|
|
26
56
|
});
|
|
27
57
|
}
|
|
58
|
+
function proveUninstallReceipt(request, receipt) {
|
|
59
|
+
if (receipt.operation !== request.operation) {
|
|
60
|
+
throw new TypeError('Schema uninstall result does not match the requested operation.');
|
|
61
|
+
}
|
|
62
|
+
const actual = receipt.transitions.map((transition) => transition.intent.origin);
|
|
63
|
+
if (actual.length !== request.domains.length ||
|
|
64
|
+
actual.some((origin, index) => origin !== request.domains[index])) {
|
|
65
|
+
throw new TypeError('Schema uninstall result does not match the requested Domains.');
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
function compare(left, right) {
|
|
69
|
+
return left < right ? -1 : left > right ? 1 : 0;
|
|
70
|
+
}
|
|
71
|
+
function installationResultLimit(maximumDomainBytes, roots) {
|
|
72
|
+
const perDomain = maximumDomainBytes + 4_096;
|
|
73
|
+
if (roots > Math.floor((Number.MAX_SAFE_INTEGER - 4_096) / perDomain)) {
|
|
74
|
+
return Number.MAX_SAFE_INTEGER;
|
|
75
|
+
}
|
|
76
|
+
return perDomain * roots + 4_096;
|
|
77
|
+
}
|
|
78
|
+
function proveInstallResult(request, result) {
|
|
79
|
+
if (result.changed) {
|
|
80
|
+
if (result.receipt.operation !== request.operation) {
|
|
81
|
+
throw new TypeError('Schema install result does not match the requested operation.');
|
|
82
|
+
}
|
|
83
|
+
if (result.receipt.transitions.length > request.domains.length) {
|
|
84
|
+
throw new TypeError('Schema install result contains more transitions than requested Domains.');
|
|
85
|
+
}
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (result.domains.length !== request.domains.length) {
|
|
89
|
+
throw new TypeError('Schema unchanged result does not match the requested Domain count.');
|
|
90
|
+
}
|
|
91
|
+
}
|
|
28
92
|
function value(result) {
|
|
29
93
|
if (result.kind !== 'value')
|
|
30
94
|
throw new TypeError('Schema syscall returned a non-value result.');
|
|
31
95
|
return result.value;
|
|
32
96
|
}
|
|
33
97
|
function admitLimits(input) {
|
|
98
|
+
const lifecycleTimeoutMs = input?.lifecycleTimeoutMs ?? DEFAULT_SCHEMA_LIFECYCLE_TIMEOUT_MS;
|
|
34
99
|
if (input === null ||
|
|
35
100
|
typeof input !== 'object' ||
|
|
36
101
|
!Number.isSafeInteger(input.maximumPublicationBytes) ||
|
|
37
102
|
input.maximumPublicationBytes < 1 ||
|
|
38
103
|
!Number.isSafeInteger(input.maximumBundleBytes) ||
|
|
39
|
-
input.maximumBundleBytes < 1
|
|
104
|
+
input.maximumBundleBytes < 1 ||
|
|
105
|
+
!Number.isSafeInteger(lifecycleTimeoutMs) ||
|
|
106
|
+
lifecycleTimeoutMs < 1 ||
|
|
107
|
+
lifecycleTimeoutMs > 2_147_483_647) {
|
|
40
108
|
throw new TypeError('Schema introspection limits are invalid.');
|
|
41
109
|
}
|
|
42
|
-
return Object.freeze({ ...input });
|
|
110
|
+
return Object.freeze({ ...input, lifecycleTimeoutMs });
|
|
111
|
+
}
|
|
112
|
+
function lifecycleOptions(options, timeoutMs) {
|
|
113
|
+
if (options?.timeoutMs !== undefined)
|
|
114
|
+
return options;
|
|
115
|
+
return Object.freeze({ ...options, timeoutMs });
|
|
43
116
|
}
|
|
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,91 @@
|
|
|
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 dependencies = (origin, options) => schemaSource.dependencies(origin, controlOptions(options, admittedControls));
|
|
27
|
+
const schema = Object.freeze({ install, uninstall, inspect, bundle, dependencies });
|
|
28
|
+
const graph = createGraph(call);
|
|
29
|
+
const auth = createAuth((target, input, options) => call(createCall(target, input), options));
|
|
30
|
+
return Object.freeze({
|
|
31
|
+
...graph,
|
|
32
|
+
kernel: source.kernel,
|
|
33
|
+
auth,
|
|
34
|
+
schema,
|
|
35
|
+
dispatch,
|
|
36
|
+
call,
|
|
37
|
+
invoke,
|
|
38
|
+
stream,
|
|
39
|
+
binary,
|
|
40
|
+
viewsFor,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
function admitControls(input) {
|
|
44
|
+
if (input === undefined)
|
|
45
|
+
return undefined;
|
|
46
|
+
if (input === null ||
|
|
47
|
+
typeof input !== 'object' ||
|
|
48
|
+
!(input.signal instanceof AbortSignal) ||
|
|
49
|
+
!Number.isFinite(input.deadline)) {
|
|
50
|
+
invalid();
|
|
51
|
+
}
|
|
52
|
+
return Object.freeze({ signal: input.signal, deadline: input.deadline });
|
|
53
|
+
}
|
|
54
|
+
function requestOptions(options, controls) {
|
|
55
|
+
return mergeOptions(options, controls);
|
|
56
|
+
}
|
|
57
|
+
function controlOptions(options, controls) {
|
|
58
|
+
return mergeOptions(options, controls);
|
|
59
|
+
}
|
|
60
|
+
function mergeOptions(options, controls) {
|
|
61
|
+
if (controls === undefined)
|
|
62
|
+
return options;
|
|
63
|
+
if (options?.signal !== undefined && options.signal !== controls.signal) {
|
|
64
|
+
throw new TypeError('Bound ClientSession cancellation cannot be replaced.');
|
|
65
|
+
}
|
|
66
|
+
if (controls.signal.aborted)
|
|
67
|
+
throw controls.signal.reason ?? new Error('Invocation cancelled.');
|
|
68
|
+
const remaining = Math.max(1, Math.ceil(controls.deadline - Date.now()));
|
|
69
|
+
const timeoutMs = options?.timeoutMs === undefined ? remaining : Math.min(options.timeoutMs, remaining);
|
|
70
|
+
return Object.freeze({ ...options, signal: controls.signal, timeoutMs });
|
|
71
|
+
}
|
|
72
|
+
function capture(source, key) {
|
|
73
|
+
const value = source[key];
|
|
74
|
+
if (typeof value !== 'function')
|
|
75
|
+
invalid();
|
|
76
|
+
return value.bind(source);
|
|
77
|
+
}
|
|
78
|
+
function captureSchema(input) {
|
|
79
|
+
if (input === null || typeof input !== 'object')
|
|
80
|
+
invalid();
|
|
81
|
+
return Object.freeze({
|
|
82
|
+
install: capture(input, 'install'),
|
|
83
|
+
uninstall: capture(input, 'uninstall'),
|
|
84
|
+
inspect: capture(input, 'inspect'),
|
|
85
|
+
bundle: capture(input, 'bundle'),
|
|
86
|
+
dependencies: capture(input, 'dependencies'),
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
function invalid() {
|
|
90
|
+
throw new TypeError('Bound ClientSession source is invalid.');
|
|
91
|
+
}
|
|
@@ -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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createSessionCredentialProvider, type SessionCredential, type SessionCredentialProvider, type SessionCredentialProviderOptions, type SessionCredentialState, } from './provider.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createSessionCredentialProvider, } from './provider.js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Settlement allowance added to the declared delegation TTL to form the refresh threshold. It
|
|
3
|
+
* matches the destination-credential skew routing already applies to a warm entry, so a credential
|
|
4
|
+
* served here cannot expire between admission and delivery.
|
|
5
|
+
*/
|
|
6
|
+
export declare const SETTLEMENT_SKEW_MS = 5000;
|
|
7
|
+
/** Total budget for one mint, matching the default Session operation budget. */
|
|
8
|
+
export declare const MINT_TIMEOUT_MS = 30000;
|
|
9
|
+
/** Bounded backoff between anticipation attempts after a failed mint. */
|
|
10
|
+
export declare const BACKOFF_MS: readonly [1000, 2000, 4000];
|
|
11
|
+
/** Steady retry interval once the bounded backoff is exhausted. */
|
|
12
|
+
export declare const RETRY_INTERVAL_MS = 4000;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Settlement allowance added to the declared delegation TTL to form the refresh threshold. It
|
|
3
|
+
* matches the destination-credential skew routing already applies to a warm entry, so a credential
|
|
4
|
+
* served here cannot expire between admission and delivery.
|
|
5
|
+
*/
|
|
6
|
+
export const SETTLEMENT_SKEW_MS = 5_000;
|
|
7
|
+
/** Total budget for one mint, matching the default Session operation budget. */
|
|
8
|
+
export const MINT_TIMEOUT_MS = 30_000;
|
|
9
|
+
/** Bounded backoff between anticipation attempts after a failed mint. */
|
|
10
|
+
export const BACKOFF_MS = [1_000, 2_000, 4_000];
|
|
11
|
+
/** Steady retry interval once the bounded backoff is exhausted. */
|
|
12
|
+
export const RETRY_INTERVAL_MS = 4_000;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { SessionAuth } from '../routing/index.js';
|
|
2
|
+
/** One source credential and the exact instant it stops being accepted. */
|
|
3
|
+
export interface SessionCredential {
|
|
4
|
+
readonly credential: string;
|
|
5
|
+
/** Absolute Unix time in milliseconds. */
|
|
6
|
+
readonly expiresAt: number;
|
|
7
|
+
}
|
|
8
|
+
/** Observable lifecycle of the single credential one provider owns. */
|
|
9
|
+
export type SessionCredentialState = {
|
|
10
|
+
readonly status: 'empty';
|
|
11
|
+
} | {
|
|
12
|
+
readonly status: 'valid';
|
|
13
|
+
readonly credential: SessionCredential;
|
|
14
|
+
} | {
|
|
15
|
+
readonly status: 'refreshing';
|
|
16
|
+
readonly credential?: SessionCredential;
|
|
17
|
+
} | {
|
|
18
|
+
readonly status: 'degraded';
|
|
19
|
+
readonly credential: SessionCredential;
|
|
20
|
+
readonly error: unknown;
|
|
21
|
+
} | {
|
|
22
|
+
readonly status: 'expired';
|
|
23
|
+
readonly error: unknown;
|
|
24
|
+
};
|
|
25
|
+
export interface SessionCredentialProviderOptions {
|
|
26
|
+
/** Delegation TTL every served credential must still cover; also the SessionAuth TTL. */
|
|
27
|
+
readonly ttlSeconds: number;
|
|
28
|
+
/** Acquire one fresh credential; the supplied signal is owned by the provider. */
|
|
29
|
+
mint(signal: AbortSignal): Promise<SessionCredential>;
|
|
30
|
+
/** Caller-held credential admitted as the initial entry; it need only be unexpired. */
|
|
31
|
+
readonly initial?: SessionCredential;
|
|
32
|
+
readonly onChange?: (state: SessionCredentialState) => void;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Caller-owned source credential with a derived refresh threshold and shared minting.
|
|
36
|
+
*
|
|
37
|
+
* The provider is a SessionAuth, so a ClientSession consumes it directly. Anticipation is opt-in:
|
|
38
|
+
* an ephemeral process or a request-scoped worker never holds a pending timer it did not ask for.
|
|
39
|
+
*/
|
|
40
|
+
export interface SessionCredentialProvider extends SessionAuth {
|
|
41
|
+
state(): SessionCredentialState;
|
|
42
|
+
/** Serve a credential that still covers the delegation TTL; concurrent callers share one mint. */
|
|
43
|
+
acquire(signal?: AbortSignal): Promise<SessionCredential>;
|
|
44
|
+
/** Mint regardless of the current credential, joining a mint already in flight. */
|
|
45
|
+
refresh(signal?: AbortSignal): Promise<SessionCredential>;
|
|
46
|
+
/** Begin anticipating expiry: threshold timer, bounded backoff, and an expiry watchdog. */
|
|
47
|
+
start(): void;
|
|
48
|
+
/** Stop anticipating; a mint already in flight still settles. */
|
|
49
|
+
stop(): void;
|
|
50
|
+
}
|
|
51
|
+
export declare function createSessionCredentialProvider(options: SessionCredentialProviderOptions): SessionCredentialProvider;
|