@astrale-os/kernel-client 0.6.0-beta.9 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth/auth.d.ts +22 -10
- package/dist/auth/auth.js +5 -7
- package/dist/auth/authorization.d.ts +4 -2
- package/dist/auth/authorization.js +25 -6
- package/dist/auth/credential.d.ts +7 -4
- package/dist/auth/credential.js +6 -3
- package/dist/auth/identity.d.ts +7 -9
- package/dist/auth/identity.js +0 -1
- package/dist/auth/index.d.ts +4 -5
- package/dist/auth/index.js +2 -4
- package/dist/auth/register.d.ts +24 -0
- package/dist/auth/register.js +10 -0
- package/dist/client/admission.d.ts +4 -2
- package/dist/client/admission.js +9 -11
- package/dist/client/client.d.ts +4 -3
- package/dist/client/client.js +16 -4
- package/dist/client/credential.d.ts +5 -3
- package/dist/client/credential.js +7 -3
- package/dist/client/index.d.ts +3 -4
- package/dist/client/index.js +2 -3
- package/dist/client/request.d.ts +11 -4
- package/dist/client/request.js +50 -6
- package/dist/client/result.d.ts +7 -5
- package/dist/client/result.js +13 -5
- package/dist/client/routing-control.d.ts +11 -4
- package/dist/client/routing-control.js +18 -4
- package/dist/errors/client-error.d.ts +0 -1
- package/dist/errors/client-error.js +0 -1
- package/dist/errors/exchange-error.d.ts +19 -0
- package/dist/errors/exchange-error.js +9 -0
- package/dist/errors/index.d.ts +2 -1
- package/dist/errors/index.js +2 -1
- package/dist/errors/miss-error.d.ts +0 -1
- package/dist/errors/miss-error.js +0 -1
- package/dist/errors/protocol-error.d.ts +0 -1
- package/dist/errors/protocol-error.js +0 -1
- package/dist/errors/refusal.d.ts +12 -0
- package/dist/errors/refusal.js +40 -0
- package/dist/errors/response-error.d.ts +0 -1
- package/dist/errors/response-error.js +0 -1
- package/dist/errors/session-error.d.ts +0 -1
- package/dist/errors/session-error.js +0 -1
- package/dist/errors/stale-route-error.d.ts +4 -4
- package/dist/errors/stale-route-error.js +5 -5
- package/dist/errors/transport-error.d.ts +3 -3
- package/dist/errors/transport-error.js +0 -1
- package/dist/graph/domain/binding.d.ts +0 -1
- package/dist/graph/domain/binding.js +4 -1
- package/dist/graph/domain/domain.typecheck.d.ts +0 -1
- package/dist/graph/domain/domain.typecheck.js +21 -1
- package/dist/graph/domain/index.d.ts +0 -1
- package/dist/graph/domain/index.js +0 -1
- package/dist/graph/domain/model.d.ts +0 -1
- package/dist/graph/domain/model.js +0 -1
- package/dist/graph/domain/page.d.ts +0 -1
- package/dist/graph/domain/page.js +0 -1
- package/dist/graph/domain/project.d.ts +0 -1
- package/dist/graph/domain/project.js +10 -7
- package/dist/graph/domain/provenance.d.ts +0 -1
- package/dist/graph/domain/provenance.js +0 -1
- package/dist/graph/errors.d.ts +0 -1
- package/dist/graph/errors.js +1 -3
- package/dist/graph/expectation.d.ts +3 -0
- package/dist/graph/expectation.js +6 -0
- package/dist/graph/graph.d.ts +6 -3
- package/dist/graph/graph.js +0 -1
- package/dist/graph/index.d.ts +2 -3
- package/dist/graph/index.js +1 -2
- package/dist/graph/mutation.d.ts +2 -4
- package/dist/graph/mutation.js +12 -2
- package/dist/graph/page/index.d.ts +0 -1
- package/dist/graph/page/index.js +0 -1
- package/dist/graph/page/neighbors.d.ts +0 -1
- package/dist/graph/page/neighbors.js +2 -2
- package/dist/graph/page/page.d.ts +0 -1
- package/dist/graph/page/page.js +0 -1
- package/dist/graph/page-contract.d.ts +6 -1
- package/dist/graph/page-contract.js +0 -1
- package/dist/graph/provenance.d.ts +2 -1
- package/dist/graph/provenance.js +5 -1
- package/dist/graph/query.d.ts +3 -1
- package/dist/graph/query.js +25 -10
- package/dist/graph/read.d.ts +0 -1
- package/dist/graph/read.js +6 -5
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/pacer/batcher/batcher.d.ts +0 -1
- package/dist/pacer/batcher/batcher.js +0 -1
- package/dist/pacer/batcher/defaults.d.ts +0 -1
- package/dist/pacer/batcher/defaults.js +0 -1
- package/dist/pacer/batcher/index.d.ts +0 -1
- package/dist/pacer/batcher/index.js +0 -1
- package/dist/pacer/index.d.ts +1 -2
- package/dist/pacer/index.js +1 -2
- package/dist/pacer/limiter/defaults.d.ts +0 -1
- package/dist/pacer/limiter/defaults.js +0 -1
- package/dist/pacer/limiter/index.d.ts +0 -1
- package/dist/pacer/limiter/index.js +0 -1
- package/dist/pacer/limiter/limiter.d.ts +0 -1
- package/dist/pacer/limiter/limiter.js +0 -1
- package/dist/pacer/queue/defaults.d.ts +0 -1
- package/dist/pacer/queue/defaults.js +0 -1
- package/dist/pacer/queue/index.d.ts +0 -1
- package/dist/pacer/queue/index.js +0 -1
- package/dist/pacer/queue/queue.d.ts +0 -1
- package/dist/pacer/queue/queue.js +0 -1
- package/dist/pacer/retry/defaults.d.ts +0 -1
- package/dist/pacer/retry/defaults.js +0 -1
- package/dist/pacer/retry/index.d.ts +1 -1
- package/dist/pacer/retry/index.js +1 -1
- package/dist/pacer/retry/refusals.d.ts +7 -0
- package/dist/pacer/retry/refusals.js +10 -0
- package/dist/pacer/retry/retry.d.ts +2 -1
- package/dist/pacer/retry/retry.js +33 -2
- package/dist/pool/index.d.ts +0 -1
- package/dist/pool/index.js +0 -1
- package/dist/pool/pool.d.ts +0 -1
- package/dist/pool/pool.js +0 -1
- package/dist/pool/target.d.ts +0 -1
- package/dist/pool/target.js +0 -1
- package/dist/schema/admission.d.ts +1 -2
- package/dist/schema/admission.js +2 -3
- package/dist/schema/contracts.d.ts +97 -5
- package/dist/schema/contracts.js +0 -1
- package/dist/schema/index.d.ts +3 -3
- package/dist/schema/index.js +1 -2
- package/dist/schema/installation.d.ts +104 -0
- package/dist/schema/installation.js +144 -0
- package/dist/schema/introspection.d.ts +0 -1
- package/dist/schema/introspection.js +10 -3
- package/dist/schema/operation.d.ts +0 -1
- package/dist/schema/operation.js +1 -2
- package/dist/schema/schema.d.ts +32 -11
- package/dist/schema/schema.js +94 -19
- package/dist/session/admission.d.ts +6 -0
- package/dist/session/admission.js +52 -0
- package/dist/session/bound.d.ts +17 -14
- package/dist/session/bound.js +96 -10
- package/dist/session/content/api.d.ts +45 -0
- package/dist/session/content/api.js +28 -0
- package/dist/session/content/batch.d.ts +5 -0
- package/dist/session/content/batch.js +93 -0
- package/dist/session/content/index.d.ts +1 -0
- package/dist/session/content/index.js +1 -0
- package/dist/session/content/input.d.ts +9 -0
- package/dist/session/content/input.js +33 -0
- package/dist/session/content/parts.d.ts +36 -0
- package/dist/session/content/parts.js +154 -0
- package/dist/session/content/retry.d.ts +3 -0
- package/dist/session/content/retry.js +41 -0
- package/dist/session/content/wire.d.ts +12 -0
- package/dist/session/content/wire.js +60 -0
- package/dist/session/context/control.d.ts +0 -1
- package/dist/session/context/control.js +0 -1
- package/dist/session/context/index.d.ts +2 -3
- package/dist/session/context/index.js +2 -3
- package/dist/session/context/limits.d.ts +1 -2
- package/dist/session/context/limits.js +1 -2
- package/dist/session/context/operation.d.ts +5 -3
- package/dist/session/context/operation.js +1 -2
- package/dist/session/context/policy.d.ts +0 -2
- package/dist/session/context/policy.js +0 -17
- package/dist/session/credential/credentials.d.ts +65 -0
- package/dist/session/credential/credentials.js +296 -0
- package/dist/session/credential/index.d.ts +1 -0
- package/dist/session/credential/index.js +1 -0
- package/dist/session/credential/limits.d.ts +14 -0
- package/dist/session/credential/limits.js +14 -0
- package/dist/session/discovery/bundle.d.ts +9 -5
- package/dist/session/discovery/bundle.js +43 -26
- package/dist/session/discovery/discovery.d.ts +12 -5
- package/dist/session/discovery/discovery.js +42 -13
- package/dist/session/discovery/index.d.ts +6 -2
- package/dist/session/discovery/index.js +4 -8
- package/dist/session/discovery/release.d.ts +30 -0
- package/dist/session/discovery/release.js +81 -0
- package/dist/session/discovery/response.d.ts +3 -0
- package/dist/session/discovery/response.js +59 -0
- package/dist/session/discovery/snapshot.d.ts +4 -5
- package/dist/session/discovery/snapshot.js +2 -3
- package/dist/session/discovery/transport.d.ts +1 -4
- package/dist/session/discovery/transport.js +0 -1
- package/dist/session/exchange/domain.d.ts +27 -0
- package/dist/session/exchange/domain.js +63 -0
- package/dist/session/exchange/exchange.d.ts +48 -0
- package/dist/session/exchange/exchange.js +54 -0
- package/dist/session/exchange/index.d.ts +5 -0
- package/dist/session/exchange/index.js +5 -0
- package/dist/session/exchange/issuer.d.ts +18 -0
- package/dist/session/exchange/issuer.js +149 -0
- package/dist/session/exchange/limits.d.ts +10 -0
- package/dist/session/exchange/limits.js +10 -0
- package/dist/session/exchange/options.d.ts +37 -0
- package/dist/session/exchange/options.js +65 -0
- package/dist/session/exchange/presentation.d.ts +19 -0
- package/dist/session/exchange/presentation.js +72 -0
- package/dist/session/exchange/source.d.ts +33 -0
- package/dist/session/exchange/source.js +78 -0
- package/dist/session/execution.d.ts +88 -0
- package/dist/session/execution.js +34 -0
- package/dist/session/index.d.ts +9 -6
- package/dist/session/index.js +3 -2
- package/dist/session/options.d.ts +65 -0
- package/dist/session/options.js +132 -0
- package/dist/session/reference.d.ts +38 -19
- package/dist/session/reference.js +34 -12
- package/dist/session/routing/auth.d.ts +10 -1
- package/dist/session/routing/auth.js +8 -2
- package/dist/session/routing/cache.d.ts +21 -7
- package/dist/session/routing/cache.js +103 -73
- package/dist/session/routing/dispatch.d.ts +19 -11
- package/dist/session/routing/dispatch.js +115 -89
- package/dist/session/routing/envelope.d.ts +4 -3
- package/dist/session/routing/envelope.js +14 -10
- package/dist/session/routing/expiry.d.ts +4 -0
- package/dist/session/routing/expiry.js +32 -0
- package/dist/session/routing/index.d.ts +5 -5
- package/dist/session/routing/index.js +4 -3
- package/dist/session/routing/integrity.d.ts +7 -0
- package/dist/session/routing/integrity.js +44 -0
- package/dist/session/routing/recovery.d.ts +16 -0
- package/dist/session/routing/recovery.js +41 -0
- package/dist/session/routing/request.d.ts +13 -1
- package/dist/session/routing/request.js +28 -2
- package/dist/session/routing/result.d.ts +5 -0
- package/dist/session/routing/result.js +16 -0
- package/dist/session/routing/store.d.ts +23 -0
- package/dist/session/routing/store.js +99 -0
- package/dist/session/session.d.ts +37 -33
- package/dist/session/session.js +134 -157
- package/dist/session/session.typecheck.d.ts +0 -1
- package/dist/session/session.typecheck.js +183 -5
- package/dist/session/views/catalog.d.ts +9 -6
- package/dist/session/views/catalog.js +29 -23
- package/dist/session/views/index.d.ts +1 -2
- package/dist/session/views/index.js +1 -2
- package/dist/session/views/resolve.d.ts +6 -5
- package/dist/session/views/resolve.js +14 -7
- package/dist/store/entity-index.d.ts +1 -3
- package/dist/store/entity-index.js +0 -4
- package/dist/store/index.d.ts +0 -1
- package/dist/store/index.js +0 -1
- package/dist/store/memory.d.ts +2 -2
- package/dist/store/memory.js +60 -18
- package/dist/store/mutation.d.ts +1 -2
- package/dist/store/mutation.js +6 -4
- package/dist/store/observe.d.ts +0 -1
- package/dist/store/observe.js +0 -1
- package/dist/store/optimistic.d.ts +0 -1
- package/dist/store/optimistic.js +0 -1
- package/dist/store/query-key.d.ts +2 -2
- package/dist/store/query-key.js +7 -3
- package/dist/store/shape.d.ts +6 -3
- package/dist/store/shape.js +4 -2
- package/dist/store/store.d.ts +2 -4
- package/dist/store/store.js +6 -5
- package/dist/store/store.typecheck.d.ts +0 -1
- package/dist/store/store.typecheck.js +0 -6
- package/dist/transport/auto/decision.d.ts +3 -3
- package/dist/transport/auto/decision.js +0 -1
- package/dist/transport/auto/fallback.d.ts +2 -2
- package/dist/transport/auto/fallback.js +2 -2
- package/dist/transport/auto/index.d.ts +0 -1
- package/dist/transport/auto/index.js +0 -1
- package/dist/transport/auto/transport.d.ts +0 -2
- package/dist/transport/auto/transport.js +0 -3
- package/dist/transport/auto/warning.d.ts +0 -1
- package/dist/transport/auto/warning.js +5 -3
- package/dist/transport/deadline.d.ts +0 -1
- package/dist/transport/deadline.js +0 -1
- package/dist/transport/failure.d.ts +0 -1
- package/dist/transport/failure.js +0 -1
- package/dist/transport/http/admission.d.ts +5 -0
- package/dist/transport/http/admission.js +104 -0
- package/dist/transport/http/binary.d.ts +5 -0
- package/dist/transport/http/binary.js +70 -0
- package/dist/transport/http/byte-stream.d.ts +18 -0
- package/dist/transport/http/byte-stream.js +94 -0
- package/dist/transport/http/configuration.d.ts +24 -0
- package/dist/transport/http/configuration.js +116 -0
- package/dist/transport/http/index.d.ts +2 -2
- package/dist/transport/http/index.js +0 -1
- package/dist/transport/http/response.d.ts +8 -2
- package/dist/transport/http/response.js +11 -7
- package/dist/transport/http/retired.d.ts +8 -0
- package/dist/transport/http/retired.js +28 -0
- package/dist/transport/http/stream.d.ts +0 -1
- package/dist/transport/http/stream.js +0 -1
- package/dist/transport/http/transport.d.ts +4 -18
- package/dist/transport/http/transport.js +48 -252
- package/dist/transport/index.d.ts +1 -2
- package/dist/transport/index.js +0 -1
- package/dist/transport/transport.d.ts +20 -3
- package/dist/transport/transport.js +0 -1
- package/dist/transport/websocket/connection.d.ts +2 -2
- package/dist/transport/websocket/connection.js +5 -3
- package/dist/transport/websocket/exchange.d.ts +0 -1
- package/dist/transport/websocket/exchange.js +8 -1
- package/dist/transport/websocket/index.d.ts +0 -1
- package/dist/transport/websocket/index.js +0 -1
- package/dist/transport/websocket/transport.d.ts +0 -4
- package/dist/transport/websocket/transport.js +2 -18
- package/package.json +12 -15
- package/dist/auth/auth.d.ts.map +0 -1
- package/dist/auth/auth.js.map +0 -1
- package/dist/auth/authorization.d.ts.map +0 -1
- package/dist/auth/authorization.js.map +0 -1
- package/dist/auth/credential.d.ts.map +0 -1
- package/dist/auth/credential.js.map +0 -1
- package/dist/auth/identity.d.ts.map +0 -1
- package/dist/auth/identity.js.map +0 -1
- package/dist/auth/index.d.ts.map +0 -1
- package/dist/auth/index.js.map +0 -1
- package/dist/auth/provision.d.ts +0 -9
- package/dist/auth/provision.d.ts.map +0 -1
- package/dist/auth/provision.js +0 -11
- package/dist/auth/provision.js.map +0 -1
- package/dist/client/admission.d.ts.map +0 -1
- package/dist/client/admission.js.map +0 -1
- package/dist/client/client.d.ts.map +0 -1
- package/dist/client/client.js.map +0 -1
- package/dist/client/credential.d.ts.map +0 -1
- package/dist/client/credential.js.map +0 -1
- package/dist/client/index.d.ts.map +0 -1
- package/dist/client/index.js.map +0 -1
- package/dist/client/request.d.ts.map +0 -1
- package/dist/client/request.js.map +0 -1
- package/dist/client/result.d.ts.map +0 -1
- package/dist/client/result.js.map +0 -1
- package/dist/client/routing-control.d.ts.map +0 -1
- package/dist/client/routing-control.js.map +0 -1
- package/dist/errors/client-error.d.ts.map +0 -1
- package/dist/errors/client-error.js.map +0 -1
- package/dist/errors/index.d.ts.map +0 -1
- package/dist/errors/index.js.map +0 -1
- package/dist/errors/miss-error.d.ts.map +0 -1
- package/dist/errors/miss-error.js.map +0 -1
- package/dist/errors/protocol-error.d.ts.map +0 -1
- package/dist/errors/protocol-error.js.map +0 -1
- package/dist/errors/response-error.d.ts.map +0 -1
- package/dist/errors/response-error.js.map +0 -1
- package/dist/errors/session-error.d.ts.map +0 -1
- package/dist/errors/session-error.js.map +0 -1
- package/dist/errors/stale-route-error.d.ts.map +0 -1
- package/dist/errors/stale-route-error.js.map +0 -1
- package/dist/errors/transport-error.d.ts.map +0 -1
- package/dist/errors/transport-error.js.map +0 -1
- package/dist/graph/domain/binding.d.ts.map +0 -1
- package/dist/graph/domain/binding.js.map +0 -1
- package/dist/graph/domain/domain.typecheck.d.ts.map +0 -1
- package/dist/graph/domain/domain.typecheck.js.map +0 -1
- package/dist/graph/domain/index.d.ts.map +0 -1
- package/dist/graph/domain/index.js.map +0 -1
- package/dist/graph/domain/model.d.ts.map +0 -1
- package/dist/graph/domain/model.js.map +0 -1
- package/dist/graph/domain/page.d.ts.map +0 -1
- package/dist/graph/domain/page.js.map +0 -1
- package/dist/graph/domain/project.d.ts.map +0 -1
- package/dist/graph/domain/project.js.map +0 -1
- package/dist/graph/domain/provenance.d.ts.map +0 -1
- package/dist/graph/domain/provenance.js.map +0 -1
- package/dist/graph/errors.d.ts.map +0 -1
- package/dist/graph/errors.js.map +0 -1
- package/dist/graph/graph.d.ts.map +0 -1
- package/dist/graph/graph.js.map +0 -1
- package/dist/graph/index.d.ts.map +0 -1
- package/dist/graph/index.js.map +0 -1
- package/dist/graph/mutation.d.ts.map +0 -1
- package/dist/graph/mutation.js.map +0 -1
- package/dist/graph/page/index.d.ts.map +0 -1
- package/dist/graph/page/index.js.map +0 -1
- package/dist/graph/page/neighbors.d.ts.map +0 -1
- package/dist/graph/page/neighbors.js.map +0 -1
- package/dist/graph/page/page.d.ts.map +0 -1
- package/dist/graph/page/page.js.map +0 -1
- package/dist/graph/page-contract.d.ts.map +0 -1
- package/dist/graph/page-contract.js.map +0 -1
- package/dist/graph/provenance.d.ts.map +0 -1
- package/dist/graph/provenance.js.map +0 -1
- package/dist/graph/query.d.ts.map +0 -1
- package/dist/graph/query.js.map +0 -1
- package/dist/graph/read.d.ts.map +0 -1
- package/dist/graph/read.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/pacer/batcher/batcher.d.ts.map +0 -1
- package/dist/pacer/batcher/batcher.js.map +0 -1
- package/dist/pacer/batcher/defaults.d.ts.map +0 -1
- package/dist/pacer/batcher/defaults.js.map +0 -1
- package/dist/pacer/batcher/index.d.ts.map +0 -1
- package/dist/pacer/batcher/index.js.map +0 -1
- package/dist/pacer/index.d.ts.map +0 -1
- package/dist/pacer/index.js.map +0 -1
- package/dist/pacer/limiter/defaults.d.ts.map +0 -1
- package/dist/pacer/limiter/defaults.js.map +0 -1
- package/dist/pacer/limiter/index.d.ts.map +0 -1
- package/dist/pacer/limiter/index.js.map +0 -1
- package/dist/pacer/limiter/limiter.d.ts.map +0 -1
- package/dist/pacer/limiter/limiter.js.map +0 -1
- package/dist/pacer/queue/defaults.d.ts.map +0 -1
- package/dist/pacer/queue/defaults.js.map +0 -1
- package/dist/pacer/queue/index.d.ts.map +0 -1
- package/dist/pacer/queue/index.js.map +0 -1
- package/dist/pacer/queue/queue.d.ts.map +0 -1
- package/dist/pacer/queue/queue.js.map +0 -1
- package/dist/pacer/retry/defaults.d.ts.map +0 -1
- package/dist/pacer/retry/defaults.js.map +0 -1
- package/dist/pacer/retry/index.d.ts.map +0 -1
- package/dist/pacer/retry/index.js.map +0 -1
- package/dist/pacer/retry/retry.d.ts.map +0 -1
- package/dist/pacer/retry/retry.js.map +0 -1
- package/dist/pool/index.d.ts.map +0 -1
- package/dist/pool/index.js.map +0 -1
- package/dist/pool/pool.d.ts.map +0 -1
- package/dist/pool/pool.js.map +0 -1
- package/dist/pool/target.d.ts.map +0 -1
- package/dist/pool/target.js.map +0 -1
- package/dist/schema/admission.d.ts.map +0 -1
- package/dist/schema/admission.js.map +0 -1
- package/dist/schema/contracts.d.ts.map +0 -1
- package/dist/schema/contracts.js.map +0 -1
- package/dist/schema/index.d.ts.map +0 -1
- package/dist/schema/index.js.map +0 -1
- package/dist/schema/introspection.d.ts.map +0 -1
- package/dist/schema/introspection.js.map +0 -1
- package/dist/schema/operation.d.ts.map +0 -1
- package/dist/schema/operation.js.map +0 -1
- package/dist/schema/schema.d.ts.map +0 -1
- package/dist/schema/schema.js.map +0 -1
- package/dist/session/bound.d.ts.map +0 -1
- package/dist/session/bound.js.map +0 -1
- package/dist/session/context/control.d.ts.map +0 -1
- package/dist/session/context/control.js.map +0 -1
- package/dist/session/context/index.d.ts.map +0 -1
- package/dist/session/context/index.js.map +0 -1
- package/dist/session/context/limits.d.ts.map +0 -1
- package/dist/session/context/limits.js.map +0 -1
- package/dist/session/context/operation.d.ts.map +0 -1
- package/dist/session/context/operation.js.map +0 -1
- package/dist/session/context/policy.d.ts.map +0 -1
- package/dist/session/context/policy.js.map +0 -1
- package/dist/session/discovery/bundle.d.ts.map +0 -1
- package/dist/session/discovery/bundle.js.map +0 -1
- package/dist/session/discovery/discovery.d.ts.map +0 -1
- package/dist/session/discovery/discovery.js.map +0 -1
- package/dist/session/discovery/index.d.ts.map +0 -1
- package/dist/session/discovery/index.js.map +0 -1
- package/dist/session/discovery/publication.d.ts +0 -24
- package/dist/session/discovery/publication.d.ts.map +0 -1
- package/dist/session/discovery/publication.js +0 -124
- package/dist/session/discovery/publication.js.map +0 -1
- package/dist/session/discovery/snapshot.d.ts.map +0 -1
- package/dist/session/discovery/snapshot.js.map +0 -1
- package/dist/session/discovery/transport.d.ts.map +0 -1
- package/dist/session/discovery/transport.js.map +0 -1
- package/dist/session/index.d.ts.map +0 -1
- package/dist/session/index.js.map +0 -1
- package/dist/session/reference.d.ts.map +0 -1
- package/dist/session/reference.js.map +0 -1
- package/dist/session/routing/auth.d.ts.map +0 -1
- package/dist/session/routing/auth.js.map +0 -1
- package/dist/session/routing/cache.d.ts.map +0 -1
- package/dist/session/routing/cache.js.map +0 -1
- package/dist/session/routing/dispatch.d.ts.map +0 -1
- package/dist/session/routing/dispatch.js.map +0 -1
- package/dist/session/routing/envelope.d.ts.map +0 -1
- package/dist/session/routing/envelope.js.map +0 -1
- package/dist/session/routing/expectation.d.ts +0 -7
- package/dist/session/routing/expectation.d.ts.map +0 -1
- package/dist/session/routing/expectation.js +0 -2
- package/dist/session/routing/expectation.js.map +0 -1
- package/dist/session/routing/index.d.ts.map +0 -1
- package/dist/session/routing/index.js.map +0 -1
- package/dist/session/routing/request.d.ts.map +0 -1
- package/dist/session/routing/request.js.map +0 -1
- package/dist/session/session.d.ts.map +0 -1
- package/dist/session/session.js.map +0 -1
- package/dist/session/session.typecheck.d.ts.map +0 -1
- package/dist/session/session.typecheck.js.map +0 -1
- package/dist/session/views/catalog.d.ts.map +0 -1
- package/dist/session/views/catalog.js.map +0 -1
- package/dist/session/views/index.d.ts.map +0 -1
- package/dist/session/views/index.js.map +0 -1
- package/dist/session/views/resolve.d.ts.map +0 -1
- package/dist/session/views/resolve.js.map +0 -1
- package/dist/store/entity-index.d.ts.map +0 -1
- package/dist/store/entity-index.js.map +0 -1
- package/dist/store/index.d.ts.map +0 -1
- package/dist/store/index.js.map +0 -1
- package/dist/store/memory.d.ts.map +0 -1
- package/dist/store/memory.js.map +0 -1
- package/dist/store/mutation.d.ts.map +0 -1
- package/dist/store/mutation.js.map +0 -1
- package/dist/store/observe.d.ts.map +0 -1
- package/dist/store/observe.js.map +0 -1
- package/dist/store/optimistic.d.ts.map +0 -1
- package/dist/store/optimistic.js.map +0 -1
- package/dist/store/query-key.d.ts.map +0 -1
- package/dist/store/query-key.js.map +0 -1
- package/dist/store/shape.d.ts.map +0 -1
- package/dist/store/shape.js.map +0 -1
- package/dist/store/store.d.ts.map +0 -1
- package/dist/store/store.js.map +0 -1
- package/dist/store/store.typecheck.d.ts.map +0 -1
- package/dist/store/store.typecheck.js.map +0 -1
- package/dist/transport/auto/decision.d.ts.map +0 -1
- package/dist/transport/auto/decision.js.map +0 -1
- package/dist/transport/auto/fallback.d.ts.map +0 -1
- package/dist/transport/auto/fallback.js.map +0 -1
- package/dist/transport/auto/index.d.ts.map +0 -1
- package/dist/transport/auto/index.js.map +0 -1
- package/dist/transport/auto/transport.d.ts.map +0 -1
- package/dist/transport/auto/transport.js.map +0 -1
- package/dist/transport/auto/warning.d.ts.map +0 -1
- package/dist/transport/auto/warning.js.map +0 -1
- package/dist/transport/deadline.d.ts.map +0 -1
- package/dist/transport/deadline.js.map +0 -1
- package/dist/transport/failure.d.ts.map +0 -1
- package/dist/transport/failure.js.map +0 -1
- package/dist/transport/http/index.d.ts.map +0 -1
- package/dist/transport/http/index.js.map +0 -1
- package/dist/transport/http/response.d.ts.map +0 -1
- package/dist/transport/http/response.js.map +0 -1
- package/dist/transport/http/stream.d.ts.map +0 -1
- package/dist/transport/http/stream.js.map +0 -1
- package/dist/transport/http/transport.d.ts.map +0 -1
- package/dist/transport/http/transport.js.map +0 -1
- package/dist/transport/index.d.ts.map +0 -1
- package/dist/transport/index.js.map +0 -1
- package/dist/transport/transport.d.ts.map +0 -1
- package/dist/transport/transport.js.map +0 -1
- package/dist/transport/websocket/connection.d.ts.map +0 -1
- package/dist/transport/websocket/connection.js.map +0 -1
- package/dist/transport/websocket/exchange.d.ts.map +0 -1
- package/dist/transport/websocket/exchange.js.map +0 -1
- package/dist/transport/websocket/index.d.ts.map +0 -1
- package/dist/transport/websocket/index.js.map +0 -1
- package/dist/transport/websocket/transport.d.ts.map +0 -1
- package/dist/transport/websocket/transport.js.map +0 -1
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { DOWNLOAD_PARTS_MEDIA_TYPE } from '@astrale-os/kernel-core/schema/kernel/syscalls/contracts';
|
|
2
|
+
import * as artifact from '@astrale-os/kernel-protocol/artifact';
|
|
3
|
+
import { ClientError, ProtocolError } from '../../errors/index.js';
|
|
4
|
+
import { decodeRejection } from './wire.js';
|
|
5
|
+
// A media type fits one request envelope (8 KiB); a part header adds a few fixed fields to it.
|
|
6
|
+
const MAXIMUM_PART_HEADER_BYTES = 16 * 1_024;
|
|
7
|
+
/** Decode the parts of one multi-slot download body, in order, without buffering content. */
|
|
8
|
+
export class PartReader {
|
|
9
|
+
source;
|
|
10
|
+
/** Response fields of the transfer, which every content of it carries. */
|
|
11
|
+
fields;
|
|
12
|
+
buffered = new Uint8Array();
|
|
13
|
+
/** Bytes of the declared body that have not been decoded yet. */
|
|
14
|
+
undecoded;
|
|
15
|
+
/** Content bytes of the current part that its consumer has not read yet. */
|
|
16
|
+
unread = 0;
|
|
17
|
+
current;
|
|
18
|
+
constructor(binary) {
|
|
19
|
+
if (binary.body instanceof Uint8Array ||
|
|
20
|
+
binary.mediaType !== DOWNLOAD_PARTS_MEDIA_TYPE ||
|
|
21
|
+
!('length' in binary) ||
|
|
22
|
+
binary.length === undefined) {
|
|
23
|
+
throw new ProtocolError('Content download returned no part body for its slot list.');
|
|
24
|
+
}
|
|
25
|
+
this.source = binary.body[Symbol.asyncIterator]();
|
|
26
|
+
this.undecoded = binary.length;
|
|
27
|
+
this.fields = binary.headers ?? {};
|
|
28
|
+
}
|
|
29
|
+
async next() {
|
|
30
|
+
await this.skip();
|
|
31
|
+
const length = new DataView((await this.exactly(4)).buffer).getUint32(0);
|
|
32
|
+
if (length === 0 || length > MAXIMUM_PART_HEADER_BYTES) {
|
|
33
|
+
throw new ProtocolError('Content download part header length is invalid.');
|
|
34
|
+
}
|
|
35
|
+
let header;
|
|
36
|
+
try {
|
|
37
|
+
header = JSON.parse(new TextDecoder().decode(await this.exactly(length)));
|
|
38
|
+
}
|
|
39
|
+
catch (cause) {
|
|
40
|
+
throw new ProtocolError('Content download part header is not JSON.', { cause });
|
|
41
|
+
}
|
|
42
|
+
if (header === null || typeof header !== 'object' || Array.isArray(header)) {
|
|
43
|
+
throw new ProtocolError('Content download part header is invalid.');
|
|
44
|
+
}
|
|
45
|
+
const { outcome, mediaType, size, code, headers } = header;
|
|
46
|
+
if (outcome === 'deferred')
|
|
47
|
+
return { outcome };
|
|
48
|
+
if (outcome === 'rejected') {
|
|
49
|
+
const rejection = decodeRejection(code);
|
|
50
|
+
if (rejection === undefined) {
|
|
51
|
+
throw new ProtocolError('Content download part rejection is invalid.');
|
|
52
|
+
}
|
|
53
|
+
return { outcome, code: rejection };
|
|
54
|
+
}
|
|
55
|
+
if (outcome !== 'content' ||
|
|
56
|
+
typeof mediaType !== 'string' ||
|
|
57
|
+
!Number.isSafeInteger(size) ||
|
|
58
|
+
size < 0 ||
|
|
59
|
+
size > this.undecoded) {
|
|
60
|
+
throw new ProtocolError('Content download part header is invalid.');
|
|
61
|
+
}
|
|
62
|
+
let canonical;
|
|
63
|
+
try {
|
|
64
|
+
canonical = artifact.canonicalMediaType(mediaType);
|
|
65
|
+
}
|
|
66
|
+
catch (cause) {
|
|
67
|
+
throw new ProtocolError('Content download part media type is invalid.', { cause });
|
|
68
|
+
}
|
|
69
|
+
// A content carries what its own download would: the transfer's fields, then its own.
|
|
70
|
+
const fields = { ...this.fields, ...decodeFields(headers) };
|
|
71
|
+
this.unread = size;
|
|
72
|
+
this.current = {};
|
|
73
|
+
return {
|
|
74
|
+
outcome,
|
|
75
|
+
content: {
|
|
76
|
+
mediaType: canonical,
|
|
77
|
+
length: size,
|
|
78
|
+
body: this.body(this.current),
|
|
79
|
+
...(Object.keys(fields).length === 0 ? {} : { headers: Object.freeze(fields) }),
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
async *body(part) {
|
|
84
|
+
while (this.current === part && this.unread > 0) {
|
|
85
|
+
const bytes = await this.content();
|
|
86
|
+
// The caller owns its chunks: one that shares its buffer with later parts is copied.
|
|
87
|
+
yield bytes.byteLength === bytes.buffer.byteLength ? bytes : bytes.slice();
|
|
88
|
+
}
|
|
89
|
+
if (this.current !== part) {
|
|
90
|
+
throw new ClientError('Content was skipped: its body was not read before the next one.');
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/** The body ends exactly after its last part. */
|
|
94
|
+
async end() {
|
|
95
|
+
await this.skip();
|
|
96
|
+
if (this.buffered.byteLength > 0 || !(await this.source.next()).done) {
|
|
97
|
+
throw new ProtocolError('Content download continued after its last part.');
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
async cancel() {
|
|
101
|
+
this.current = undefined;
|
|
102
|
+
try {
|
|
103
|
+
await this.source.return?.();
|
|
104
|
+
}
|
|
105
|
+
catch {
|
|
106
|
+
// The transfer already ended with its own outcome.
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
/** Pass an unread body; its consumer then learns that it was skipped. */
|
|
110
|
+
async skip() {
|
|
111
|
+
this.current = undefined;
|
|
112
|
+
while (this.unread > 0)
|
|
113
|
+
await this.content();
|
|
114
|
+
}
|
|
115
|
+
/** The next unread bytes of the current content, as the transport delivered them. */
|
|
116
|
+
async content() {
|
|
117
|
+
const bytes = await this.read(this.unread);
|
|
118
|
+
this.unread -= bytes.byteLength;
|
|
119
|
+
return bytes;
|
|
120
|
+
}
|
|
121
|
+
async exactly(count) {
|
|
122
|
+
const bytes = new Uint8Array(count);
|
|
123
|
+
for (let filled = 0; filled < count;) {
|
|
124
|
+
const part = await this.read(count - filled);
|
|
125
|
+
bytes.set(part, filled);
|
|
126
|
+
filled += part.byteLength;
|
|
127
|
+
}
|
|
128
|
+
return bytes;
|
|
129
|
+
}
|
|
130
|
+
async read(maximum) {
|
|
131
|
+
if (this.buffered.byteLength === 0) {
|
|
132
|
+
const next = await this.source.next();
|
|
133
|
+
if (next.done)
|
|
134
|
+
throw new ProtocolError('Content download ended inside a part.');
|
|
135
|
+
this.buffered = next.value;
|
|
136
|
+
}
|
|
137
|
+
const bytes = this.buffered.subarray(0, maximum);
|
|
138
|
+
this.buffered = this.buffered.subarray(bytes.byteLength);
|
|
139
|
+
this.undecoded -= bytes.byteLength;
|
|
140
|
+
return bytes;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
/** The response fields a part header adds to those of its transfer. */
|
|
144
|
+
function decodeFields(input) {
|
|
145
|
+
if (input === undefined)
|
|
146
|
+
return {};
|
|
147
|
+
if (input === null ||
|
|
148
|
+
typeof input !== 'object' ||
|
|
149
|
+
Array.isArray(input) ||
|
|
150
|
+
!Object.values(input).every((value) => typeof value === 'string')) {
|
|
151
|
+
throw new ProtocolError('Content download part fields are invalid.');
|
|
152
|
+
}
|
|
153
|
+
return input;
|
|
154
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { CODES } from '@astrale-os/kernel-protocol/errors';
|
|
2
|
+
import { ResponseError, TransportError } from '../../errors/index.js';
|
|
3
|
+
import { runSessionOperation } from '../context/index.js';
|
|
4
|
+
const MAXIMUM_ATTEMPTS = 3;
|
|
5
|
+
/** Repeat one content request that failed before any of its result was delivered. */
|
|
6
|
+
export async function retry(operation, request) {
|
|
7
|
+
for (let attempt = 0;; attempt++) {
|
|
8
|
+
try {
|
|
9
|
+
return await request();
|
|
10
|
+
}
|
|
11
|
+
catch (cause) {
|
|
12
|
+
if (!retryable(cause) || attempt + 1 === MAXIMUM_ATTEMPTS || operation.signal.aborted) {
|
|
13
|
+
throw cause;
|
|
14
|
+
}
|
|
15
|
+
await runSessionOperation(operation, (signal) => delay(200 * 2 ** attempt, signal));
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function retryable(cause) {
|
|
20
|
+
return ((cause instanceof TransportError && cause.context.kind === 'invocation') ||
|
|
21
|
+
(cause instanceof ResponseError &&
|
|
22
|
+
(cause.reason?.code === 'BLOB_UNAVAILABLE' ||
|
|
23
|
+
cause.code === CODES.CANCELLED ||
|
|
24
|
+
cause.code === CODES.DEADLINE_EXCEEDED ||
|
|
25
|
+
cause.code === CODES.OUTCOME_UNKNOWN)));
|
|
26
|
+
}
|
|
27
|
+
function delay(ms, signal) {
|
|
28
|
+
return new Promise((resolve, reject) => {
|
|
29
|
+
if (signal.aborted)
|
|
30
|
+
return reject(signal.reason);
|
|
31
|
+
const timer = setTimeout(() => {
|
|
32
|
+
signal.removeEventListener('abort', abort);
|
|
33
|
+
resolve();
|
|
34
|
+
}, ms);
|
|
35
|
+
const abort = () => {
|
|
36
|
+
clearTimeout(timer);
|
|
37
|
+
reject(signal.reason);
|
|
38
|
+
};
|
|
39
|
+
signal.addEventListener('abort', abort, { once: true });
|
|
40
|
+
});
|
|
41
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Path } from '@astrale-os/kernel-core/path';
|
|
2
|
+
import type { Binary } from '../../client/index.js';
|
|
3
|
+
import type { ContentRejection, ContentUploadResult } from './api.js';
|
|
4
|
+
export declare const UPLOAD: Path.Projection;
|
|
5
|
+
export declare const DOWNLOAD: Path.Projection;
|
|
6
|
+
export declare function decodeUploadResult(input: unknown): ContentUploadResult;
|
|
7
|
+
/** The rejection a code names, or `undefined` when it names none. */
|
|
8
|
+
export declare function decodeRejection(code: unknown): ContentRejection | undefined;
|
|
9
|
+
/** A download whose exact size is declared; anything else is closed and refused. */
|
|
10
|
+
export declare function decodeDownload(input: Binary): Promise<Binary>;
|
|
11
|
+
/** Close a streamed body nobody will read. */
|
|
12
|
+
export declare function cancelBinary(input: Binary): Promise<void>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Path } from '@astrale-os/kernel-core/path';
|
|
2
|
+
import { download, upload } from '@astrale-os/kernel-core/schema/kernel/syscalls/references';
|
|
3
|
+
import * as artifact from '@astrale-os/kernel-protocol/artifact';
|
|
4
|
+
import { ClientError, ProtocolError } from '../../errors/index.js';
|
|
5
|
+
export const UPLOAD = Path.project(upload);
|
|
6
|
+
export const DOWNLOAD = Path.project(download);
|
|
7
|
+
const REJECTIONS = [
|
|
8
|
+
'BLOB_NOT_FOUND',
|
|
9
|
+
'BLOB_UNAVAILABLE',
|
|
10
|
+
'BLOB_INTEGRITY',
|
|
11
|
+
];
|
|
12
|
+
export function decodeUploadResult(input) {
|
|
13
|
+
if (input === null || typeof input !== 'object' || Array.isArray(input)) {
|
|
14
|
+
throw new ClientError('Content upload returned an invalid receipt.');
|
|
15
|
+
}
|
|
16
|
+
const value = input;
|
|
17
|
+
if (typeof value.receipt !== 'string' ||
|
|
18
|
+
value.receipt.length === 0 ||
|
|
19
|
+
typeof value.expiresAt !== 'string' ||
|
|
20
|
+
!Number.isFinite(Date.parse(value.expiresAt))) {
|
|
21
|
+
throw new ClientError('Content upload returned an invalid receipt.');
|
|
22
|
+
}
|
|
23
|
+
let ref;
|
|
24
|
+
try {
|
|
25
|
+
ref = artifact.accept(value.ref);
|
|
26
|
+
}
|
|
27
|
+
catch (cause) {
|
|
28
|
+
throw new ClientError('Content upload returned an invalid Ref.', { cause });
|
|
29
|
+
}
|
|
30
|
+
return Object.freeze({
|
|
31
|
+
receipt: value.receipt,
|
|
32
|
+
ref,
|
|
33
|
+
expiresAt: value.expiresAt,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
/** The rejection a code names, or `undefined` when it names none. */
|
|
37
|
+
export function decodeRejection(code) {
|
|
38
|
+
return REJECTIONS.find((candidate) => candidate === code);
|
|
39
|
+
}
|
|
40
|
+
/** A download whose exact size is declared; anything else is closed and refused. */
|
|
41
|
+
export async function decodeDownload(input) {
|
|
42
|
+
// The HTTP transport sets `length` only from an admitted declared length, and its byte stream
|
|
43
|
+
// enforces that exact count through the final read.
|
|
44
|
+
if (input.body instanceof Uint8Array || !('length' in input) || input.length === undefined) {
|
|
45
|
+
await cancelBinary(input);
|
|
46
|
+
throw new ProtocolError('Content download omitted its exact content size.');
|
|
47
|
+
}
|
|
48
|
+
return input;
|
|
49
|
+
}
|
|
50
|
+
/** Close a streamed body nobody will read. */
|
|
51
|
+
export async function cancelBinary(input) {
|
|
52
|
+
if (input.body instanceof Uint8Array)
|
|
53
|
+
return;
|
|
54
|
+
try {
|
|
55
|
+
await input.body[Symbol.asyncIterator]().return?.();
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
// Preserve the admission error after the response stream has been closed.
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { admitControlOptions, type SessionControlOptions } from './control.js';
|
|
2
|
-
export { DEFAULT_MAXIMUM_BUNDLE_BYTES,
|
|
3
|
-
export { createSessionOperation, runSessionOperation, sessionTransportOptions, type SessionOperation, } from './operation.js';
|
|
2
|
+
export { DEFAULT_MAXIMUM_BUNDLE_BYTES, DEFAULT_MAXIMUM_RELEASE_BYTES, DEFAULT_MAXIMUM_RESPONSE_BYTES, DEFAULT_MAXIMUM_ROUTES, DEFAULT_TIMEOUT_MS, platformDuration, positive, } from './limits.js';
|
|
3
|
+
export { createSessionOperation, remainingSessionTime, 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
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { admitControlOptions } from './control.js';
|
|
2
|
-
export { DEFAULT_MAXIMUM_BUNDLE_BYTES,
|
|
3
|
-
export { createSessionOperation, runSessionOperation, sessionTransportOptions, } from './operation.js';
|
|
2
|
+
export { DEFAULT_MAXIMUM_BUNDLE_BYTES, DEFAULT_MAXIMUM_RELEASE_BYTES, DEFAULT_MAXIMUM_RESPONSE_BYTES, DEFAULT_MAXIMUM_ROUTES, DEFAULT_TIMEOUT_MS, platformDuration, positive, } from './limits.js';
|
|
3
|
+
export { createSessionOperation, remainingSessionTime, runSessionOperation, sessionTransportOptions, } from './operation.js';
|
|
4
4
|
export { admitKernel, admitPolicy, allowEndpoint, kernelInvocationEndpoint, } from './policy.js';
|
|
5
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const DEFAULT_MAXIMUM_RELEASE_BYTES: number;
|
|
2
2
|
export declare const DEFAULT_MAXIMUM_BUNDLE_BYTES: number;
|
|
3
3
|
export declare const DEFAULT_MAXIMUM_RESPONSE_BYTES: number;
|
|
4
4
|
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
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const
|
|
1
|
+
export const DEFAULT_MAXIMUM_RELEASE_BYTES = 1024 * 1024;
|
|
2
2
|
export const DEFAULT_MAXIMUM_BUNDLE_BYTES = 16 * 1024 * 1024;
|
|
3
3
|
export const DEFAULT_MAXIMUM_RESPONSE_BYTES = 16 * 1024 * 1024;
|
|
4
4
|
export const DEFAULT_TIMEOUT_MS = 30_000;
|
|
@@ -16,4 +16,3 @@ export function platformDuration(input, label) {
|
|
|
16
16
|
}
|
|
17
17
|
return admitted;
|
|
18
18
|
}
|
|
19
|
-
//# sourceMappingURL=limits.js.map
|
|
@@ -13,8 +13,10 @@ export declare function createSessionOperation(lifecycle: AbortSignal, input: {
|
|
|
13
13
|
readonly idempotencyKey?: RequestOptions['idempotencyKey'];
|
|
14
14
|
} | undefined, defaultTimeoutMs: number): SessionOperation;
|
|
15
15
|
export declare function remainingSessionTime(operation: SessionOperation): number;
|
|
16
|
-
export declare function sessionTransportOptions(operation: SessionOperation
|
|
16
|
+
export declare function sessionTransportOptions(operation: SessionOperation): {
|
|
17
|
+
readonly signal: AbortSignal;
|
|
18
|
+
readonly timeoutMs: number;
|
|
19
|
+
};
|
|
20
|
+
export declare function sessionTransportOptions(operation: SessionOperation, idempotencyKey: RequestOptions['idempotencyKey']): RequestOptions;
|
|
17
21
|
/** Settle independently of a caller capability that ignores its supplied AbortSignal. */
|
|
18
22
|
export declare function runSessionOperation<Result>(operation: SessionOperation, task: (signal: AbortSignal) => Result | PromiseLike<Result>): Promise<Result>;
|
|
19
|
-
export declare function requireSessionOperation(operation: SessionOperation): void;
|
|
20
|
-
//# sourceMappingURL=operation.d.ts.map
|
|
@@ -54,7 +54,7 @@ export async function runSessionOperation(operation, task) {
|
|
|
54
54
|
operation.signal.removeEventListener('abort', abort);
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
|
-
|
|
57
|
+
function requireSessionOperation(operation) {
|
|
58
58
|
if (!operation.signal.aborted)
|
|
59
59
|
return;
|
|
60
60
|
throw sessionInterruption(operation.signal.reason);
|
|
@@ -70,4 +70,3 @@ function sessionInterruption(reason) {
|
|
|
70
70
|
failure: 'cancelled',
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
|
-
//# sourceMappingURL=operation.js.map
|
|
@@ -7,6 +7,4 @@ export interface SessionPolicy {
|
|
|
7
7
|
export declare function admitPolicy(input: SessionPolicy): Readonly<SessionPolicy>;
|
|
8
8
|
export declare function admitKernel(input: string, insecure: boolean): IssuerId;
|
|
9
9
|
export declare function kernelInvocationEndpoint(input: IssuerId): string;
|
|
10
|
-
export declare function websocketEndpoint(input: string, insecure: boolean): string;
|
|
11
10
|
export declare function allowEndpoint(url: string, policy: Readonly<SessionPolicy>): void;
|
|
12
|
-
//# sourceMappingURL=policy.d.ts.map
|
|
@@ -39,22 +39,6 @@ export function admitKernel(input, insecure) {
|
|
|
39
39
|
export function kernelInvocationEndpoint(input) {
|
|
40
40
|
return `${input}/invoke`;
|
|
41
41
|
}
|
|
42
|
-
export function websocketEndpoint(input, insecure) {
|
|
43
|
-
let url;
|
|
44
|
-
try {
|
|
45
|
-
url = new URL(input);
|
|
46
|
-
}
|
|
47
|
-
catch (cause) {
|
|
48
|
-
throw new TypeError('Session WebSocket endpoint is invalid.', { cause });
|
|
49
|
-
}
|
|
50
|
-
if (url.username !== '' ||
|
|
51
|
-
url.password !== '' ||
|
|
52
|
-
url.hash !== '' ||
|
|
53
|
-
(url.protocol !== 'wss:' && !(insecure && url.protocol === 'ws:'))) {
|
|
54
|
-
throw new TypeError('Session WebSocket endpoint is invalid.');
|
|
55
|
-
}
|
|
56
|
-
return url.toString();
|
|
57
|
-
}
|
|
58
42
|
export function allowEndpoint(url, policy) {
|
|
59
43
|
const parsed = new URL(url);
|
|
60
44
|
if (parsed.protocol !== 'https:' && parsed.protocol !== 'wss:') {
|
|
@@ -67,4 +51,3 @@ export function allowEndpoint(url, policy) {
|
|
|
67
51
|
throw new ClientError('Endpoint is denied by Session policy.');
|
|
68
52
|
}
|
|
69
53
|
}
|
|
70
|
-
//# sourceMappingURL=policy.js.map
|
|
@@ -0,0 +1,65 @@
|
|
|
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 Credentials owns. */
|
|
9
|
+
export type CredentialsState = {
|
|
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
|
+
/**
|
|
26
|
+
* Acquire one fresh credential: a compact JWT, whose `exp` claim is its expiry, or an explicit
|
|
27
|
+
* credential and expiry. The supplied signal is owned by Credentials.
|
|
28
|
+
*/
|
|
29
|
+
export type CredentialsMint = (signal: AbortSignal) => string | SessionCredential | PromiseLike<string | SessionCredential>;
|
|
30
|
+
export interface CredentialsOptions {
|
|
31
|
+
/** Delegation TTL every served credential must still cover; also the SessionAuth TTL. */
|
|
32
|
+
readonly ttlSeconds?: number;
|
|
33
|
+
/** Renew the credential. Without it, the initial credential is served until it stops covering. */
|
|
34
|
+
readonly mint?: CredentialsMint;
|
|
35
|
+
/** Caller-held credential admitted as the initial entry; it need only be unexpired. */
|
|
36
|
+
readonly initial?: string | SessionCredential;
|
|
37
|
+
readonly onChange?: (state: CredentialsState) => void;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Caller-owned source credential with a derived refresh threshold and shared minting.
|
|
41
|
+
*
|
|
42
|
+
* Credentials is a SessionAuth, so a ClientSession consumes it directly. Anticipation is opt-in:
|
|
43
|
+
* an ephemeral process or a request-scoped worker never holds a pending timer it did not ask for.
|
|
44
|
+
*/
|
|
45
|
+
export interface Credentials extends SessionAuth {
|
|
46
|
+
state(): CredentialsState;
|
|
47
|
+
/** Serve a credential that still covers the delegation TTL; concurrent callers share one mint. */
|
|
48
|
+
acquire(signal?: AbortSignal): Promise<SessionCredential>;
|
|
49
|
+
/** Mint regardless of the current credential, joining a mint already in flight. */
|
|
50
|
+
refresh(signal?: AbortSignal): Promise<SessionCredential>;
|
|
51
|
+
/** Begin anticipating expiry: threshold timer, bounded backoff, and an expiry watchdog. */
|
|
52
|
+
start(): void;
|
|
53
|
+
/** Stop anticipating; a mint already in flight still settles. */
|
|
54
|
+
stop(): void;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Remaining lifetime a credential must exceed to carry a delegation of `ttlSeconds`: the TTL itself
|
|
58
|
+
* plus the settlement skew, so it cannot expire between admission and delivery.
|
|
59
|
+
*/
|
|
60
|
+
export declare function delegationCoverageMs(ttlSeconds: number): number;
|
|
61
|
+
/**
|
|
62
|
+
* Hold one source credential for a Session: a fixed credential, a mint that renews it on demand,
|
|
63
|
+
* or options that also seed it, observe it, or change the delegation TTL it must cover.
|
|
64
|
+
*/
|
|
65
|
+
export declare function credentials(source: string | CredentialsMint | CredentialsOptions): Credentials;
|