@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
|
@@ -1,13 +1,105 @@
|
|
|
1
|
+
import type { NodeId } from '@astrale-os/kernel-core/graph/node';
|
|
1
2
|
import type { installation } from '@astrale-os/kernel-core/schema';
|
|
2
|
-
import type {
|
|
3
|
+
import type { AttemptReport, DomainRequest as CoreDomainRequest, InstallClass as CoreInstallClass, InstallInput, InstallMode as CoreInstallMode, InstallReceipt as CoreInstallReceipt, SystemExecutionDetail, UninstallInput, UninstallOutput, ValidationOptions } from '@astrale-os/kernel-core/schema/kernel/syscalls/contracts';
|
|
4
|
+
import type { Value } from '@astrale-os/kernel-dsl/value';
|
|
5
|
+
import type { schema as protocolSchema } from '@astrale-os/kernel-protocol';
|
|
6
|
+
import type { ExecutionState } from '../session/execution.js';
|
|
3
7
|
export type OperationId = installation.OperationId;
|
|
4
8
|
/** Canonical caller input accepted by the Kernel install syscall. */
|
|
5
|
-
export type
|
|
6
|
-
|
|
9
|
+
export type DomainRequest = CoreDomainRequest;
|
|
10
|
+
/**
|
|
11
|
+
* One install: its Kernel input, plus `wait`, which the Client alone reads: `false` answers at
|
|
12
|
+
* once, otherwise the Client waits for the outcome within the request deadline. It is never sent,
|
|
13
|
+
* so it is no part of the operation's intent.
|
|
14
|
+
*/
|
|
15
|
+
export type InstallRequest = InstallInput & {
|
|
16
|
+
readonly wait?: boolean;
|
|
17
|
+
};
|
|
7
18
|
/** Admitted terminal install receipt returned by the Kernel. */
|
|
8
|
-
export type InstallReceipt =
|
|
19
|
+
export type InstallReceipt = CoreInstallReceipt;
|
|
20
|
+
/** The `K.Execution` an install or uninstall is; a repair session's id is its Execution's. */
|
|
21
|
+
export type InstallExecutionId = NodeId;
|
|
22
|
+
/** What an install does to the stored data: nothing, applied at once, or revalidated first. */
|
|
23
|
+
export type InstallClass = CoreInstallClass;
|
|
24
|
+
export type InstallMode = CoreInstallMode;
|
|
25
|
+
/** The validation options of an install, defaults filled in. */
|
|
26
|
+
export type InstallValidationOptions = ValidationOptions;
|
|
27
|
+
/** The last attempt of a repair session that ended without activating, with its report. */
|
|
28
|
+
export type InstallAttemptReport = AttemptReport;
|
|
29
|
+
/** What an install or session shows beside its engine state, as Core shapes it. */
|
|
30
|
+
export type InstallDetail = SystemExecutionDetail;
|
|
31
|
+
/** The public failure a rejected install ended with, such as `DATA_MIGRATION_REQUIRED`. */
|
|
32
|
+
export interface InstallFailure {
|
|
33
|
+
readonly code: string;
|
|
34
|
+
readonly message: string;
|
|
35
|
+
readonly family?: string;
|
|
36
|
+
readonly details?: Value;
|
|
37
|
+
}
|
|
38
|
+
/** A terminal install: its committed result, its rejection, or its cancellation. */
|
|
39
|
+
export type InstallOutcome = {
|
|
40
|
+
readonly kind: 'completed';
|
|
41
|
+
readonly value: protocolSchema.installation.InstallResult;
|
|
42
|
+
} | {
|
|
43
|
+
readonly kind: 'failed';
|
|
44
|
+
readonly error: InstallFailure;
|
|
45
|
+
} | {
|
|
46
|
+
readonly kind: 'cancelled';
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* The status of one install, uninstall or repair session: the engine `state` the CLI decides on,
|
|
50
|
+
* and the Core `detail` (phase, class, progress, the next command index, the running attempt and
|
|
51
|
+
* the last attempt report).
|
|
52
|
+
*/
|
|
53
|
+
export type InstallStatus<Outcome = InstallOutcome> = InstallNodeStatus<Outcome> | DeletedInstallStatus<Outcome>;
|
|
54
|
+
/** The status of an install, uninstall or session whose Execution node exists. */
|
|
55
|
+
export interface InstallNodeStatus<Outcome = InstallOutcome> {
|
|
56
|
+
readonly id: InstallExecutionId;
|
|
57
|
+
readonly function: NodeId;
|
|
58
|
+
readonly version: `sha256:${string}`;
|
|
59
|
+
readonly state: ExecutionState;
|
|
60
|
+
readonly createdAt: string;
|
|
61
|
+
readonly detail?: InstallDetail;
|
|
62
|
+
/** Present exactly once the Execution is terminal. */
|
|
63
|
+
readonly outcome?: Outcome;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* What Root alone reads once the Execution node of an install, uninstall or session was deleted:
|
|
67
|
+
* the outcome its lifecycle record keeps, under the explicit state `deleted`.
|
|
68
|
+
*/
|
|
69
|
+
export interface DeletedInstallStatus<Outcome = InstallOutcome> {
|
|
70
|
+
readonly id: InstallExecutionId;
|
|
71
|
+
readonly state: 'deleted';
|
|
72
|
+
readonly outcome: Outcome;
|
|
73
|
+
/** Absent: the node that recorded them is deleted. */
|
|
74
|
+
readonly function?: never;
|
|
75
|
+
readonly version?: never;
|
|
76
|
+
readonly createdAt?: never;
|
|
77
|
+
readonly detail?: never;
|
|
78
|
+
}
|
|
79
|
+
/** One admitted install answer: its Execution, its status, and its result once completed. */
|
|
80
|
+
export interface Installation {
|
|
81
|
+
readonly execution: InstallExecutionId;
|
|
82
|
+
readonly status: InstallStatus;
|
|
83
|
+
/** The committed result, present exactly when the status is completed. */
|
|
84
|
+
readonly result?: protocolSchema.installation.InstallResult;
|
|
85
|
+
}
|
|
9
86
|
/** Canonical caller input accepted by the Kernel uninstall syscall. */
|
|
10
87
|
export type UninstallRequest = UninstallInput;
|
|
11
88
|
/** Admitted terminal uninstall receipt returned by the Kernel. */
|
|
12
89
|
export type UninstallReceipt = UninstallOutput;
|
|
13
|
-
|
|
90
|
+
/** A terminal uninstall: its committed receipt, its rejection, or its cancellation. */
|
|
91
|
+
export type UninstallOutcome = {
|
|
92
|
+
readonly kind: 'completed';
|
|
93
|
+
readonly value: UninstallReceipt;
|
|
94
|
+
} | {
|
|
95
|
+
readonly kind: 'failed';
|
|
96
|
+
readonly error: InstallFailure;
|
|
97
|
+
} | {
|
|
98
|
+
readonly kind: 'cancelled';
|
|
99
|
+
};
|
|
100
|
+
/** One admitted uninstall answer: its Execution, its status, and its receipt once completed. */
|
|
101
|
+
export interface Uninstallation {
|
|
102
|
+
readonly execution: InstallExecutionId;
|
|
103
|
+
readonly status: InstallStatus<UninstallOutcome>;
|
|
104
|
+
readonly result?: UninstallReceipt;
|
|
105
|
+
}
|
package/dist/schema/contracts.js
CHANGED
package/dist/schema/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { createSchema, type SchemaApi, type SchemaCall, type SchemaOptions, type
|
|
1
|
+
export { createSchema, DEFAULT_SCHEMA_LIFECYCLE_TIMEOUT_MS, type SchemaApi, type SchemaCall, type SchemaOptions, type DomainBundle, type DomainDependencies, type DomainInfo, type InstalledPin, type InstalledRelease, type InstallResult, } from './schema.js';
|
|
2
2
|
export { acceptOperationId, createOperationId } from './operation.js';
|
|
3
|
-
export type {
|
|
4
|
-
|
|
3
|
+
export type { InstallationApi, UninstallationApi } from './installation.js';
|
|
4
|
+
export type { DomainRequest, InstallAttemptReport, InstallClass, InstallDetail, InstallExecutionId, InstallFailure, InstallMode, InstallOutcome, InstallStatus, InstallNodeStatus, DeletedInstallStatus, InstallValidationOptions, Installation, InstallReceipt, InstallRequest, OperationId, Uninstallation, UninstallOutcome, UninstallReceipt, UninstallRequest, } from './contracts.js';
|
package/dist/schema/index.js
CHANGED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import type { PathLike } from '@astrale-os/kernel-core/path';
|
|
2
|
+
import type { InstallValidation } from '@astrale-os/kernel-core/schema/kernel/syscalls/contracts';
|
|
3
|
+
import type { RequestOptions } from '../transport/index.js';
|
|
4
|
+
import type { InstallExecutionId, InstallFailure, InstallOutcome, InstallStatus, UninstallOutcome, UninstallReceipt } from './contracts.js';
|
|
5
|
+
import type { SchemaCall } from './schema.js';
|
|
6
|
+
/**
|
|
7
|
+
* The install executions of one Instance, through the `K.Execution` Methods of each. Observing
|
|
8
|
+
* and a cooperative cancel are Root's or the initiator's; signals, a forced cancel, resume and
|
|
9
|
+
* delete are Root's.
|
|
10
|
+
*/
|
|
11
|
+
export interface InstallationApi {
|
|
12
|
+
/** The status of one install or repair session. */
|
|
13
|
+
status(execution: InstallExecutionId, options?: RequestOptions): Promise<InstallStatus>;
|
|
14
|
+
/** The terminal outcome, waiting at most `waitMs`; `EXECUTION_PENDING` once it lapses. */
|
|
15
|
+
result(execution: InstallExecutionId, wait?: {
|
|
16
|
+
readonly waitMs?: number;
|
|
17
|
+
}, options?: RequestOptions): Promise<InstallOutcome>;
|
|
18
|
+
/**
|
|
19
|
+
* A waiting repair session attempts its target: the `command:<index>` signal, `index` being
|
|
20
|
+
* the `detail.command` its status announces. A signal already resolved is refused.
|
|
21
|
+
*/
|
|
22
|
+
apply(execution: InstallExecutionId, command: {
|
|
23
|
+
readonly index: number;
|
|
24
|
+
readonly validation?: InstallValidation;
|
|
25
|
+
}, options?: RequestOptions): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Stop the attempt a repair session runs, `detail.attempt.number`, through its `abort:<attempt>`
|
|
28
|
+
* signal; the session waits again.
|
|
29
|
+
*/
|
|
30
|
+
abort(execution: InstallExecutionId, attempt: number, options?: RequestOptions): Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* A cooperative cancel ends an install before its point of no return with nothing changed, and
|
|
33
|
+
* has a repair session attempt its source schema. `force` kills the run; a live session first
|
|
34
|
+
* takes the break-glass exit (the Instance reopens on its source, marked `uncertified`).
|
|
35
|
+
*/
|
|
36
|
+
cancel(execution: InstallExecutionId, input?: {
|
|
37
|
+
readonly force?: boolean;
|
|
38
|
+
}, options?: RequestOptions): Promise<InstallStatus>;
|
|
39
|
+
/** Resume a paused install or session; a running one is unchanged. */
|
|
40
|
+
resume(execution: InstallExecutionId, options?: RequestOptions): Promise<InstallStatus>;
|
|
41
|
+
/** Delete the Execution, then kill and purge its run; a live session exits by break-glass. */
|
|
42
|
+
delete(execution: InstallExecutionId, options?: RequestOptions): Promise<void>;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The uninstall executions of one Instance, through the same `K.Execution` Methods: a completed
|
|
46
|
+
* outcome carries the uninstall receipt. An uninstall has no repair session, so no signal.
|
|
47
|
+
*/
|
|
48
|
+
export interface UninstallationApi {
|
|
49
|
+
/** The status of one uninstall. */
|
|
50
|
+
status(execution: InstallExecutionId, options?: RequestOptions): Promise<InstallStatus<UninstallOutcome>>;
|
|
51
|
+
/** The terminal outcome, waiting at most `waitMs`; `EXECUTION_PENDING` once it lapses. */
|
|
52
|
+
result(execution: InstallExecutionId, wait?: {
|
|
53
|
+
readonly waitMs?: number;
|
|
54
|
+
}, options?: RequestOptions): Promise<UninstallOutcome>;
|
|
55
|
+
/** A cooperative cancel ends it before its point of no return; `force` kills the run. */
|
|
56
|
+
cancel(execution: InstallExecutionId, input?: {
|
|
57
|
+
readonly force?: boolean;
|
|
58
|
+
}, options?: RequestOptions): Promise<InstallStatus<UninstallOutcome>>;
|
|
59
|
+
/** Resume a paused uninstall; a running one is unchanged. */
|
|
60
|
+
resume(execution: InstallExecutionId, options?: RequestOptions): Promise<InstallStatus<UninstallOutcome>>;
|
|
61
|
+
/** Delete the Execution, then kill and purge its run. */
|
|
62
|
+
delete(execution: InstallExecutionId, options?: RequestOptions): Promise<void>;
|
|
63
|
+
}
|
|
64
|
+
/** Admit a completed outcome's value; anything else of the outcome is kept as admitted. */
|
|
65
|
+
export type AcceptValue<Value> = (input: unknown) => Value;
|
|
66
|
+
export type ExecutionOutcomeOf<Value> = {
|
|
67
|
+
readonly kind: 'completed';
|
|
68
|
+
readonly value: Value;
|
|
69
|
+
} | {
|
|
70
|
+
readonly kind: 'failed';
|
|
71
|
+
readonly error: InstallFailure;
|
|
72
|
+
} | {
|
|
73
|
+
readonly kind: 'cancelled';
|
|
74
|
+
};
|
|
75
|
+
/** The `K.Execution` Methods of one Execution, over one call capability; package-private. */
|
|
76
|
+
export declare function executionMethods(call: SchemaCall, options: (input: RequestOptions | undefined) => RequestOptions): Readonly<{
|
|
77
|
+
status: <Value>(id: InstallExecutionId, accept: AcceptValue<Value>, request?: RequestOptions) => Promise<InstallStatus<ExecutionOutcomeOf<Value>>>;
|
|
78
|
+
result<Value>(id: InstallExecutionId, accept: AcceptValue<Value>, wait?: {
|
|
79
|
+
readonly waitMs?: number;
|
|
80
|
+
}, request?: RequestOptions): Promise<ExecutionOutcomeOf<Value>>;
|
|
81
|
+
signal(id: InstallExecutionId, name: string, signalled: unknown, request?: RequestOptions): Promise<void>;
|
|
82
|
+
cancel: <Value>(id: InstallExecutionId, accept: AcceptValue<Value>, input: {
|
|
83
|
+
readonly force?: boolean;
|
|
84
|
+
}, request?: RequestOptions) => Promise<InstallStatus<ExecutionOutcomeOf<Value>>>;
|
|
85
|
+
resume: <Value>(id: InstallExecutionId, accept: AcceptValue<Value>, request?: RequestOptions) => Promise<InstallStatus<ExecutionOutcomeOf<Value>>>;
|
|
86
|
+
delete(id: InstallExecutionId, request?: RequestOptions): Promise<void>;
|
|
87
|
+
/** Admit what a durable call answers at once: the Execution it created or recovered. */
|
|
88
|
+
start(path: PathLike, input: unknown, request?: RequestOptions): Promise<InstallExecutionId>;
|
|
89
|
+
/**
|
|
90
|
+
* Wait within the request deadline for the outcome. A wait that lapsed after waiting, while
|
|
91
|
+
* time remains, waits again; a wait a closing process or a gap with no process failed is sent
|
|
92
|
+
* again. Every other end of the wait, or its deadline, leaves the Execution as it is: its
|
|
93
|
+
* status, read next, says where it is, so the caller never loses the Execution.
|
|
94
|
+
*/
|
|
95
|
+
settle(id: InstallExecutionId, request?: RequestOptions): Promise<void>;
|
|
96
|
+
/** The status after a wait, read again as `settle` sends its wait again, within the deadline. */
|
|
97
|
+
observe<Value>(id: InstallExecutionId, accept: AcceptValue<Value>, request?: RequestOptions): Promise<InstallStatus<ExecutionOutcomeOf<Value>>>;
|
|
98
|
+
}>;
|
|
99
|
+
export type ExecutionMethods = ReturnType<typeof executionMethods>;
|
|
100
|
+
/** The install Methods: a completed outcome carries the result its Protocol owner admits. */
|
|
101
|
+
export declare function createInstallation(executions: ExecutionMethods): InstallationApi;
|
|
102
|
+
/** The uninstall Methods: a completed outcome carries the receipt Core's contract admits. */
|
|
103
|
+
export declare function createUninstallation(executions: ExecutionMethods): UninstallationApi;
|
|
104
|
+
export declare function acceptUninstallReceipt(input: unknown): UninstallReceipt;
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { Path } from '@astrale-os/kernel-core/path';
|
|
2
|
+
import { abortSignal, commandSignal, executionOutcome, executionStatus, uninstallOutput, } from '@astrale-os/kernel-core/schema/kernel/syscalls/contracts';
|
|
3
|
+
import { execution as methods } from '@astrale-os/kernel-core/schema/kernel/syscalls/references';
|
|
4
|
+
import { MethodKey } from '@astrale-os/kernel-dsl/v1/addressing';
|
|
5
|
+
import * as protocolSchema from '@astrale-os/kernel-protocol/schema';
|
|
6
|
+
import { call as invocation } from '../client/index.js';
|
|
7
|
+
import { ResponseError, TransportError } from '../errors/index.js';
|
|
8
|
+
import { RETRY_REFUSALS, retry } from '../pacer/index.js';
|
|
9
|
+
import { acceptOutput } from './admission.js';
|
|
10
|
+
/** Attempts of one effect-free Execution read; the wait's deadline bounds them too. */
|
|
11
|
+
const READ_ATTEMPTS = 8;
|
|
12
|
+
/** A pending answer sooner than this did not wait: the Kernel answers now, so waiting ends. */
|
|
13
|
+
const LAPSED_WAIT_MS = 1_000;
|
|
14
|
+
/** No wait starts with less time left than this before its deadline. */
|
|
15
|
+
const MINIMUM_WAIT_MS = 1_000;
|
|
16
|
+
/** The `K.Execution` Methods of one Execution, over one call capability; package-private. */
|
|
17
|
+
export function executionMethods(call, options) {
|
|
18
|
+
const value = async (id, method, input, request) => {
|
|
19
|
+
const target = Path.instanceMethod(Path.id(id), MethodKey.of(method.owner, method.name));
|
|
20
|
+
const result = await call(invocation(target, input), options(request));
|
|
21
|
+
if (result.kind !== 'value')
|
|
22
|
+
throw new TypeError('Execution Method returned a non-value result.');
|
|
23
|
+
return result.value;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* An Execution read has no effect: one a process refused with a retry delay, or a gap with no
|
|
27
|
+
* process on the port failed, is sent again through the pacer, each attempt within `deadline`.
|
|
28
|
+
*/
|
|
29
|
+
const read = (deadline, request, work) => retry(() => work({ ...request, timeoutMs: Math.max(1, deadline - Date.now()) }), {
|
|
30
|
+
maxAttempts: READ_ATTEMPTS,
|
|
31
|
+
shouldRetry: (error, attempt) => Date.now() < deadline &&
|
|
32
|
+
(error instanceof TransportError || RETRY_REFUSALS.shouldRetry(error, attempt)),
|
|
33
|
+
retryAfter: RETRY_REFUSALS.retryAfter,
|
|
34
|
+
});
|
|
35
|
+
const status = async (id, accept, answer) => {
|
|
36
|
+
const admitted = acceptOutput(executionStatus, await answer, 'Execution status');
|
|
37
|
+
if (admitted.id !== id)
|
|
38
|
+
throw new TypeError('Kernel returned the status of another Execution.');
|
|
39
|
+
const outcome = admitted.outcome === undefined ? undefined : outcomeOf(admitted.outcome, accept);
|
|
40
|
+
// A deleted Execution carries the outcome its lifecycle record keeps, whatever its kind.
|
|
41
|
+
if (admitted.state !== 'deleted' &&
|
|
42
|
+
(admitted.state === 'completed') !== (outcome?.kind === 'completed')) {
|
|
43
|
+
throw new TypeError('Execution status and outcome disagree.');
|
|
44
|
+
}
|
|
45
|
+
if (admitted.state === 'deleted')
|
|
46
|
+
return Object.freeze({ id, state: 'deleted', outcome: outcome });
|
|
47
|
+
const { outcome: _outcome, ...rest } = admitted;
|
|
48
|
+
return Object.freeze({ ...rest, ...(outcome === undefined ? {} : { outcome }) });
|
|
49
|
+
};
|
|
50
|
+
return Object.freeze({
|
|
51
|
+
status: (id, accept, request) => status(id, accept, value(id, methods.status, {}, request)),
|
|
52
|
+
async result(id, accept, wait = {}, request) {
|
|
53
|
+
const answer = await value(id, methods.result, { ...wait }, request);
|
|
54
|
+
return outcomeOf(acceptOutput(executionOutcome, answer, 'Execution outcome'), accept);
|
|
55
|
+
},
|
|
56
|
+
async signal(id, name, signalled, request) {
|
|
57
|
+
await value(id, methods.signal, { name, value: signalled }, request);
|
|
58
|
+
},
|
|
59
|
+
cancel: (id, accept, input, request) => status(id, accept, value(id, methods.cancel, { ...input }, request)),
|
|
60
|
+
resume: (id, accept, request) => status(id, accept, value(id, methods.resume, {}, request)),
|
|
61
|
+
async delete(id, request) {
|
|
62
|
+
await value(id, methods.delete, {}, request);
|
|
63
|
+
},
|
|
64
|
+
/** Admit what a durable call answers at once: the Execution it created or recovered. */
|
|
65
|
+
async start(path, input, request) {
|
|
66
|
+
const result = await call(invocation(path, input), options(request));
|
|
67
|
+
if (result.kind !== 'execution')
|
|
68
|
+
throw new TypeError('Schema syscall did not answer with an Execution.');
|
|
69
|
+
return result.execution;
|
|
70
|
+
},
|
|
71
|
+
/**
|
|
72
|
+
* Wait within the request deadline for the outcome. A wait that lapsed after waiting, while
|
|
73
|
+
* time remains, waits again; a wait a closing process or a gap with no process failed is sent
|
|
74
|
+
* again. Every other end of the wait, or its deadline, leaves the Execution as it is: its
|
|
75
|
+
* status, read next, says where it is, so the caller never loses the Execution.
|
|
76
|
+
*/
|
|
77
|
+
async settle(id, request) {
|
|
78
|
+
const deadline = Date.now() + (options(request).timeoutMs ?? 0);
|
|
79
|
+
while (deadline - Date.now() >= MINIMUM_WAIT_MS) {
|
|
80
|
+
const started = Date.now();
|
|
81
|
+
try {
|
|
82
|
+
await read(deadline, request, (attempt) => value(id, methods.result, { waitMs: attempt.timeoutMs }, attempt));
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
const pending = error instanceof ResponseError && error.reason?.code === 'EXECUTION_PENDING';
|
|
87
|
+
if (!pending || Date.now() - started < LAPSED_WAIT_MS)
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
/** The status after a wait, read again as `settle` sends its wait again, within the deadline. */
|
|
93
|
+
observe(id, accept, request) {
|
|
94
|
+
const deadline = Date.now() + (options(request).timeoutMs ?? 0);
|
|
95
|
+
return read(deadline, request, (attempt) => status(id, accept, value(id, methods.status, {}, attempt)));
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
/** The install Methods: a completed outcome carries the result its Protocol owner admits. */
|
|
100
|
+
export function createInstallation(executions) {
|
|
101
|
+
const accept = (input) => {
|
|
102
|
+
if (uninstallOutput.safeParse(input).success) {
|
|
103
|
+
throw new TypeError('The Execution is an uninstall: read it through SchemaApi.uninstallation.');
|
|
104
|
+
}
|
|
105
|
+
return protocolSchema.installation.acceptResult(input);
|
|
106
|
+
};
|
|
107
|
+
return Object.freeze({
|
|
108
|
+
status: (execution, request) => executions.status(execution, accept, request),
|
|
109
|
+
result: (execution, wait, request) => executions.result(execution, accept, wait, request),
|
|
110
|
+
apply: async (execution, command, request) => executions.signal(execution, commandSignal(ordinal(command.index)), Object.freeze({
|
|
111
|
+
kind: 'apply',
|
|
112
|
+
...(command.validation === undefined ? {} : { validation: command.validation }),
|
|
113
|
+
}), request),
|
|
114
|
+
abort: async (execution, attempt, request) => executions.signal(execution, abortSignal(ordinal(attempt)), Object.freeze({ kind: 'abort' }), request),
|
|
115
|
+
cancel: (execution, input = {}, request) => executions.cancel(execution, accept, input, request),
|
|
116
|
+
resume: (execution, request) => executions.resume(execution, accept, request),
|
|
117
|
+
delete: (execution, request) => executions.delete(execution, request),
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
/** The uninstall Methods: a completed outcome carries the receipt Core's contract admits. */
|
|
121
|
+
export function createUninstallation(executions) {
|
|
122
|
+
const accept = acceptUninstallReceipt;
|
|
123
|
+
return Object.freeze({
|
|
124
|
+
status: (execution, request) => executions.status(execution, accept, request),
|
|
125
|
+
result: (execution, wait, request) => executions.result(execution, accept, wait, request),
|
|
126
|
+
cancel: (execution, input = {}, request) => executions.cancel(execution, accept, input, request),
|
|
127
|
+
resume: (execution, request) => executions.resume(execution, accept, request),
|
|
128
|
+
delete: (execution, request) => executions.delete(execution, request),
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
export function acceptUninstallReceipt(input) {
|
|
132
|
+
return acceptOutput(uninstallOutput, input, 'uninstall receipt');
|
|
133
|
+
}
|
|
134
|
+
function outcomeOf(outcome, accept) {
|
|
135
|
+
if (outcome.kind !== 'completed')
|
|
136
|
+
return outcome;
|
|
137
|
+
return Object.freeze({ kind: 'completed', value: accept(outcome.value) });
|
|
138
|
+
}
|
|
139
|
+
function ordinal(input) {
|
|
140
|
+
if (!Number.isSafeInteger(input) || input < 1) {
|
|
141
|
+
throw new TypeError('A session signal index is a positive integer.');
|
|
142
|
+
}
|
|
143
|
+
return input;
|
|
144
|
+
}
|
|
@@ -3,4 +3,3 @@ import type * as protocol from '@astrale-os/kernel-protocol/schema';
|
|
|
3
3
|
import type { RequestOptions } from '../transport/index.js';
|
|
4
4
|
import type { SchemaCall, SchemaOptions } from './schema.js';
|
|
5
5
|
export declare function introspect<InputType extends language.Introspection>(invoke: SchemaCall, limits: SchemaOptions, request: InputType, options?: RequestOptions): Promise<protocol.installation.introspection.ResultFor<InputType>>;
|
|
6
|
-
//# sourceMappingURL=introspection.d.ts.map
|
|
@@ -8,9 +8,16 @@ export async function introspect(invoke, limits, request, options) {
|
|
|
8
8
|
if (result.kind !== 'binary') {
|
|
9
9
|
throw new TypeError('Schema introspection returned a non-binary result.');
|
|
10
10
|
}
|
|
11
|
-
|
|
11
|
+
const { mediaType } = result.value;
|
|
12
|
+
const decode = mediaType === schema.installation.introspection.MEDIA_TYPE
|
|
13
|
+
? schema.installation.introspection.decode
|
|
14
|
+
: undefined;
|
|
15
|
+
if (decode === undefined) {
|
|
12
16
|
throw new TypeError('Schema introspection returned an unsupported media type.');
|
|
13
17
|
}
|
|
14
|
-
|
|
18
|
+
if (!(result.value.body instanceof Uint8Array)) {
|
|
19
|
+
await result.value.body[Symbol.asyncIterator]().return?.();
|
|
20
|
+
throw new TypeError('Schema introspection returned a streaming binary result.');
|
|
21
|
+
}
|
|
22
|
+
return decode(request, result.value.body, limits);
|
|
15
23
|
}
|
|
16
|
-
//# sourceMappingURL=introspection.js.map
|
|
@@ -3,4 +3,3 @@ import type { OperationId } from './contracts.js';
|
|
|
3
3
|
export declare function acceptOperationId(input: unknown): OperationId;
|
|
4
4
|
/** Allocate one cryptographically generated operation identity for a new lifecycle request. */
|
|
5
5
|
export declare function createOperationId(): OperationId;
|
|
6
|
-
//# sourceMappingURL=operation.d.ts.map
|
package/dist/schema/operation.js
CHANGED
|
@@ -5,6 +5,5 @@ export function 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,41 @@
|
|
|
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 { Installation, InstallRequest, Uninstallation, UninstallRequest } from './contracts.js';
|
|
6
|
+
import { type InstallationApi, type UninstallationApi } from './installation.js';
|
|
6
7
|
export type SchemaCall = (call: Call, options?: RequestOptions) => Promise<Result>;
|
|
7
8
|
export interface SchemaOptions extends protocolSchema.installation.introspection.Limits {
|
|
9
|
+
readonly lifecycleTimeoutMs?: number;
|
|
8
10
|
}
|
|
9
|
-
export type
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
export type DomainInfo = protocolSchema.installation.introspection.DomainInfo;
|
|
12
|
+
export type DomainBundle = protocolSchema.installation.introspection.DomainBundle;
|
|
13
|
+
export type DomainDependencies = protocolSchema.installation.introspection.DomainDependencies;
|
|
14
|
+
export type InstalledRelease = protocolSchema.installation.introspection.InstalledRelease;
|
|
15
|
+
export type InstalledPin = protocolSchema.installation.introspection.InstalledPin;
|
|
16
|
+
export type InstallResult = protocolSchema.installation.InstallResult;
|
|
13
17
|
export interface SchemaApi {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Install Domains: start the durable Execution the install is, then, unless `wait` is false or
|
|
20
|
+
* the mode is `maintenance`, wait within the request deadline for its outcome. The answer names
|
|
21
|
+
* the Execution with its status; `result` is present once it completed. A rejected install is a
|
|
22
|
+
* terminal `failed` status, never a failed call.
|
|
23
|
+
*/
|
|
24
|
+
install(request: InstallRequest, options?: RequestOptions): Promise<Installation>;
|
|
25
|
+
/** The install executions and repair sessions, through their `K.Execution` Methods. */
|
|
26
|
+
readonly installation: InstallationApi;
|
|
27
|
+
/**
|
|
28
|
+
* Uninstall Domains: start the durable Execution the uninstall is and wait within the request
|
|
29
|
+
* deadline for its outcome. `result` is the receipt once it completed.
|
|
30
|
+
*/
|
|
31
|
+
uninstall(request: UninstallRequest, options?: RequestOptions): Promise<Uninstallation>;
|
|
32
|
+
/** The uninstall executions, through their `K.Execution` Methods. */
|
|
33
|
+
readonly uninstallation: UninstallationApi;
|
|
34
|
+
inspect(origin: Key.Origin, options?: RequestOptions): Promise<DomainInfo>;
|
|
35
|
+
bundle(origin: Key.Origin, options?: RequestOptions): Promise<DomainBundle>;
|
|
36
|
+
dependencies(origin: Key.Origin, options?: RequestOptions): Promise<DomainDependencies>;
|
|
37
|
+
installed(options?: RequestOptions): Promise<readonly InstalledRelease[]>;
|
|
17
38
|
}
|
|
39
|
+
export declare const DEFAULT_SCHEMA_LIFECYCLE_TIMEOUT_MS = 110000;
|
|
18
40
|
/** Bind the canonical Schema lifecycle syscalls to one caller-scoped value-call capability. */
|
|
19
41
|
export declare function createSchema(call: SchemaCall, limits: SchemaOptions): SchemaApi;
|
|
20
|
-
//# sourceMappingURL=schema.d.ts.map
|
package/dist/schema/schema.js
CHANGED
|
@@ -1,44 +1,119 @@
|
|
|
1
1
|
import { Path } from '@astrale-os/kernel-core/path';
|
|
2
|
-
import { installOutput, uninstallOutput, } from '@astrale-os/kernel-core/schema/kernel/syscalls/contracts';
|
|
3
2
|
import { install, uninstall } from '@astrale-os/kernel-core/schema/kernel/syscalls/references';
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import { introspect
|
|
3
|
+
import * as protocolSchema from '@astrale-os/kernel-protocol/schema';
|
|
4
|
+
import { acceptUninstallReceipt, createInstallation, createUninstallation, executionMethods, } from './installation.js';
|
|
5
|
+
import { introspect } from './introspection.js';
|
|
7
6
|
const INSTALL_PATH = Path.project(install).raw;
|
|
8
7
|
const UNINSTALL_PATH = Path.project(uninstall).raw;
|
|
8
|
+
export const DEFAULT_SCHEMA_LIFECYCLE_TIMEOUT_MS = 110_000;
|
|
9
9
|
/** Bind the canonical Schema lifecycle syscalls to one caller-scoped value-call capability. */
|
|
10
10
|
export function createSchema(call, limits) {
|
|
11
11
|
if (typeof call !== 'function')
|
|
12
12
|
throw new TypeError('Schema call capability is invalid.');
|
|
13
13
|
const admittedLimits = admitLimits(limits);
|
|
14
|
+
const executions = executionMethods(call, (options) => lifecycleOptions(options, admittedLimits.lifecycleTimeoutMs));
|
|
15
|
+
const installation = createInstallation(executions);
|
|
16
|
+
const uninstallation = createUninstallation(executions);
|
|
14
17
|
return Object.freeze({
|
|
15
18
|
async install(request, options) {
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
// `wait` is the Client's own: it never reaches the Kernel, so it is no part of the intent.
|
|
20
|
+
const { wait, ...input } = request;
|
|
21
|
+
const execution = await executions.start(INSTALL_PATH, input, options);
|
|
22
|
+
// A maintenance session awaits Root's commands: its outcome is not the call's to wait for.
|
|
23
|
+
if (wait !== false && input.mode !== 'maintenance') {
|
|
24
|
+
await executions.settle(execution, options);
|
|
25
|
+
}
|
|
26
|
+
const status = await executions.observe(execution, protocolSchema.installation.acceptResult, options);
|
|
27
|
+
return admitInstallation(request, execution, status);
|
|
18
28
|
},
|
|
29
|
+
installation,
|
|
19
30
|
async uninstall(request, options) {
|
|
20
|
-
const
|
|
21
|
-
|
|
31
|
+
const snapshot = snapshotUninstallRequest(request);
|
|
32
|
+
const execution = await executions.start(UNINSTALL_PATH, snapshot, options);
|
|
33
|
+
await executions.settle(execution, options);
|
|
34
|
+
const status = await executions.observe(execution, acceptUninstallReceipt, options);
|
|
35
|
+
if (status.outcome?.kind !== 'completed')
|
|
36
|
+
return Object.freeze({ execution, status });
|
|
37
|
+
proveUninstallReceipt(snapshot, status.outcome.value);
|
|
38
|
+
return Object.freeze({ execution, status, result: status.outcome.value });
|
|
22
39
|
},
|
|
23
|
-
|
|
24
|
-
|
|
40
|
+
uninstallation,
|
|
41
|
+
async inspect(origin, options) {
|
|
42
|
+
return introspect(call, admittedLimits, { kind: 'inspect', origin }, options);
|
|
43
|
+
},
|
|
44
|
+
async bundle(origin, options) {
|
|
45
|
+
return introspect(call, admittedLimits, { kind: 'bundle', origin }, options);
|
|
46
|
+
},
|
|
47
|
+
async dependencies(origin, options) {
|
|
48
|
+
return introspect(call, admittedLimits, { kind: 'dependencies', origin }, options);
|
|
49
|
+
},
|
|
50
|
+
async installed(options) {
|
|
51
|
+
return introspect(call, admittedLimits, { kind: 'installed' }, options);
|
|
25
52
|
},
|
|
26
53
|
});
|
|
27
54
|
}
|
|
28
|
-
function
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
55
|
+
function snapshotUninstallRequest(request) {
|
|
56
|
+
return Object.freeze({
|
|
57
|
+
operation: request.operation,
|
|
58
|
+
domains: Object.freeze([...new Set(request.domains)].sort(compare)),
|
|
59
|
+
data: Object.freeze({ mode: request.data.mode }),
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
function proveUninstallReceipt(request, receipt) {
|
|
63
|
+
if (receipt.operation !== request.operation) {
|
|
64
|
+
throw new TypeError('Schema uninstall result does not match the requested operation.');
|
|
65
|
+
}
|
|
66
|
+
const actual = receipt.transitions.map((transition) => transition.intent.origin);
|
|
67
|
+
if (actual.length !== request.domains.length ||
|
|
68
|
+
actual.some((origin, index) => origin !== request.domains[index])) {
|
|
69
|
+
throw new TypeError('Schema uninstall result does not match the requested Domains.');
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
function compare(left, right) {
|
|
73
|
+
return left < right ? -1 : left > right ? 1 : 0;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* The answer of one install, proved against its request: a completed status carries the result of
|
|
77
|
+
* exactly this operation, admitted by its Protocol owner.
|
|
78
|
+
*/
|
|
79
|
+
function admitInstallation(request, execution, status) {
|
|
80
|
+
if (status.outcome?.kind !== 'completed')
|
|
81
|
+
return Object.freeze({ execution, status });
|
|
82
|
+
const result = status.outcome.value;
|
|
83
|
+
proveInstallResult(request, result);
|
|
84
|
+
return Object.freeze({ execution, status, result });
|
|
85
|
+
}
|
|
86
|
+
function proveInstallResult(request, result) {
|
|
87
|
+
if (result.changed) {
|
|
88
|
+
if (result.receipt.operation !== request.operation) {
|
|
89
|
+
throw new TypeError('Schema install result does not match the requested operation.');
|
|
90
|
+
}
|
|
91
|
+
if (result.receipt.transitions.length > request.domains.length) {
|
|
92
|
+
throw new TypeError('Schema install result contains more transitions than requested Domains.');
|
|
93
|
+
}
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
if (result.domains.length !== request.domains.length) {
|
|
97
|
+
throw new TypeError('Schema unchanged result does not match the requested Domain count.');
|
|
98
|
+
}
|
|
32
99
|
}
|
|
33
100
|
function admitLimits(input) {
|
|
101
|
+
const lifecycleTimeoutMs = input?.lifecycleTimeoutMs ?? DEFAULT_SCHEMA_LIFECYCLE_TIMEOUT_MS;
|
|
34
102
|
if (input === null ||
|
|
35
103
|
typeof input !== 'object' ||
|
|
36
|
-
!Number.isSafeInteger(input.
|
|
37
|
-
input.
|
|
104
|
+
!Number.isSafeInteger(input.maximumReleaseBytes) ||
|
|
105
|
+
input.maximumReleaseBytes < 1 ||
|
|
38
106
|
!Number.isSafeInteger(input.maximumBundleBytes) ||
|
|
39
|
-
input.maximumBundleBytes < 1
|
|
107
|
+
input.maximumBundleBytes < 1 ||
|
|
108
|
+
!Number.isSafeInteger(lifecycleTimeoutMs) ||
|
|
109
|
+
lifecycleTimeoutMs < 1 ||
|
|
110
|
+
lifecycleTimeoutMs > 2_147_483_647) {
|
|
40
111
|
throw new TypeError('Schema introspection limits are invalid.');
|
|
41
112
|
}
|
|
42
|
-
return Object.freeze({ ...input });
|
|
113
|
+
return Object.freeze({ ...input, lifecycleTimeoutMs });
|
|
114
|
+
}
|
|
115
|
+
function lifecycleOptions(options, timeoutMs) {
|
|
116
|
+
if (options?.timeoutMs !== undefined)
|
|
117
|
+
return options;
|
|
118
|
+
return Object.freeze({ ...options, timeoutMs });
|
|
43
119
|
}
|
|
44
|
-
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { invocation } from '@astrale-os/kernel-protocol';
|
|
2
|
+
import type { FunctionAdmission } from '../auth/index.js';
|
|
3
|
+
import type { SessionOperation } from './context/index.js';
|
|
4
|
+
import type { ExchangeDependencies } from './exchange/index.js';
|
|
5
|
+
/** Check a remote Call through the existing Domain exchange and Kernel admission protocols. */
|
|
6
|
+
export declare function admitFunction(dependencies: ExchangeDependencies, call: invocation.Call, operation: SessionOperation): Promise<FunctionAdmission>;
|