@astrale-os/kernel-client 0.5.1 → 0.6.0-beta.10
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 +18 -0
- package/dist/auth/auth.js +15 -0
- package/dist/auth/authorization.d.ts +13 -0
- package/dist/auth/authorization.js +17 -0
- package/dist/auth/credential.d.ts +19 -0
- package/dist/auth/credential.js +21 -0
- package/dist/auth/identity.d.ts +14 -0
- package/dist/auth/identity.js +15 -0
- package/dist/auth/index.d.ts +6 -16
- package/dist/auth/index.js +5 -10
- package/dist/auth/provision.d.ts +8 -0
- package/dist/auth/provision.js +10 -0
- package/dist/client/admission.d.ts +4 -0
- package/dist/client/admission.js +34 -0
- package/dist/client/client.d.ts +24 -109
- package/dist/client/client.js +80 -381
- package/dist/client/credential.d.ts +12 -0
- package/dist/client/credential.js +51 -0
- package/dist/client/index.d.ts +6 -0
- package/dist/client/index.js +4 -0
- package/dist/client/request.d.ts +26 -0
- package/dist/client/request.js +100 -0
- package/dist/client/result.d.ts +35 -0
- package/dist/client/result.js +28 -0
- package/dist/client/routing-control.d.ts +10 -0
- package/dist/client/routing-control.js +23 -0
- package/dist/errors/client-error.d.ts +3 -0
- package/dist/errors/client-error.js +8 -0
- package/dist/errors/index.d.ts +7 -6
- package/dist/errors/index.js +7 -4
- package/dist/errors/miss-error.d.ts +8 -0
- package/dist/errors/miss-error.js +10 -0
- package/dist/errors/protocol-error.d.ts +9 -0
- package/dist/errors/protocol-error.js +9 -0
- package/dist/errors/response-error.d.ts +11 -0
- package/dist/errors/response-error.js +16 -0
- package/dist/errors/session-error.d.ts +8 -20
- package/dist/errors/session-error.js +6 -22
- package/dist/errors/stale-route-error.d.ts +9 -0
- package/dist/errors/stale-route-error.js +12 -0
- package/dist/errors/transport-error.d.ts +30 -0
- package/dist/errors/transport-error.js +18 -0
- package/dist/graph/domain/binding.d.ts +22 -0
- package/dist/graph/domain/binding.js +123 -0
- package/dist/graph/domain/domain.typecheck.d.ts +1 -0
- package/dist/graph/domain/domain.typecheck.js +139 -0
- package/dist/graph/domain/index.d.ts +3 -0
- package/dist/graph/domain/index.js +1 -0
- package/dist/graph/domain/model.d.ts +18 -0
- package/dist/graph/domain/model.js +1 -0
- package/dist/graph/domain/page.d.ts +23 -0
- package/dist/graph/domain/page.js +42 -0
- package/dist/graph/domain/project.d.ts +8 -0
- package/dist/graph/domain/project.js +120 -0
- package/dist/graph/domain/provenance.d.ts +6 -0
- package/dist/graph/domain/provenance.js +11 -0
- package/dist/graph/errors.d.ts +8 -0
- package/dist/graph/errors.js +14 -0
- package/dist/graph/graph.d.ts +26 -0
- package/dist/graph/graph.js +18 -0
- package/dist/graph/index.d.ts +8 -26
- package/dist/graph/index.js +6 -21
- package/dist/graph/mutation.d.ts +5 -0
- package/dist/graph/mutation.js +17 -0
- package/dist/graph/page/index.d.ts +2 -0
- package/dist/graph/page/index.js +1 -0
- package/dist/graph/page/neighbors.d.ts +9 -0
- package/dist/graph/page/neighbors.js +34 -0
- package/dist/graph/page/page.d.ts +37 -0
- package/dist/graph/page/page.js +55 -0
- package/dist/graph/page-contract.d.ts +13 -0
- package/dist/graph/page-contract.js +1 -0
- package/dist/graph/provenance.d.ts +12 -0
- package/dist/graph/provenance.js +37 -0
- package/dist/graph/query.d.ts +4 -0
- package/dist/graph/query.js +69 -0
- package/dist/graph/read.d.ts +6 -0
- package/dist/graph/read.js +17 -0
- package/dist/index.d.ts +6 -25
- package/dist/index.js +6 -21
- package/dist/pacer/batcher/batcher.d.ts +7 -0
- package/dist/pacer/batcher/batcher.js +13 -0
- package/dist/pacer/batcher/defaults.d.ts +2 -0
- package/dist/pacer/batcher/defaults.js +2 -0
- package/dist/pacer/batcher/index.d.ts +1 -0
- package/dist/pacer/batcher/index.js +1 -0
- package/dist/pacer/index.d.ts +4 -10
- package/dist/pacer/index.js +4 -11
- package/dist/pacer/limiter/defaults.d.ts +2 -0
- package/dist/pacer/limiter/defaults.js +2 -0
- package/dist/pacer/limiter/index.d.ts +1 -0
- package/dist/pacer/limiter/index.js +1 -0
- package/dist/pacer/limiter/limiter.d.ts +7 -0
- package/dist/pacer/limiter/limiter.js +14 -0
- package/dist/pacer/queue/defaults.d.ts +1 -0
- package/dist/pacer/queue/defaults.js +1 -0
- package/dist/pacer/queue/index.d.ts +1 -0
- package/dist/pacer/queue/index.js +1 -0
- package/dist/pacer/queue/queue.d.ts +6 -0
- package/dist/pacer/queue/queue.js +12 -0
- package/dist/pacer/retry/defaults.d.ts +6 -0
- package/dist/pacer/retry/defaults.js +16 -0
- package/dist/pacer/retry/index.d.ts +1 -0
- package/dist/pacer/retry/index.js +1 -0
- package/dist/pacer/retry/retry.d.ts +9 -0
- package/dist/pacer/retry/retry.js +55 -0
- package/dist/pool/index.d.ts +2 -4
- package/dist/pool/index.js +0 -2
- package/dist/pool/pool.d.ts +19 -59
- package/dist/pool/pool.js +46 -64
- package/dist/pool/target.d.ts +15 -0
- package/dist/pool/target.js +49 -0
- package/dist/schema/admission.d.ts +12 -0
- package/dist/schema/admission.js +17 -0
- package/dist/schema/contracts.d.ts +12 -0
- package/dist/schema/contracts.js +1 -0
- package/dist/schema/index.d.ts +3 -16
- package/dist/schema/index.js +2 -12
- package/dist/schema/introspection.d.ts +5 -0
- package/dist/schema/introspection.js +15 -0
- package/dist/schema/operation.d.ts +5 -0
- package/dist/schema/operation.js +9 -0
- package/dist/schema/schema.d.ts +19 -0
- package/dist/schema/schema.js +43 -0
- package/dist/session/bound.d.ts +42 -9
- package/dist/session/bound.js +70 -37
- package/dist/session/context/control.d.ts +5 -0
- package/dist/session/context/control.js +17 -0
- package/dist/session/context/index.d.ts +4 -0
- package/dist/session/context/index.js +4 -0
- package/dist/session/context/limits.d.ts +7 -0
- package/dist/session/context/limits.js +18 -0
- package/dist/session/context/operation.d.ts +19 -0
- package/dist/session/context/operation.js +72 -0
- package/dist/session/context/policy.d.ts +11 -0
- package/dist/session/context/policy.js +69 -0
- package/dist/session/discovery/bundle.d.ts +17 -0
- package/dist/session/discovery/bundle.js +55 -0
- package/dist/session/discovery/discovery.d.ts +19 -0
- package/dist/session/discovery/discovery.js +55 -0
- package/dist/session/discovery/index.d.ts +20 -0
- package/dist/session/discovery/index.js +15 -0
- package/dist/session/discovery/publication.d.ts +23 -0
- package/dist/session/discovery/publication.js +123 -0
- package/dist/session/discovery/snapshot.d.ts +12 -0
- package/dist/session/discovery/snapshot.js +3 -0
- package/dist/session/discovery/transport.d.ts +6 -0
- package/dist/session/discovery/transport.js +13 -0
- package/dist/session/index.d.ts +10 -16
- package/dist/session/index.js +3 -9
- package/dist/session/reference.d.ts +36 -0
- package/dist/session/reference.js +74 -0
- package/dist/session/routing/auth.d.ts +18 -0
- package/dist/session/routing/auth.js +39 -0
- package/dist/session/routing/cache.d.ts +20 -0
- package/dist/session/routing/cache.js +115 -0
- package/dist/session/routing/dispatch.d.ts +34 -0
- package/dist/session/routing/dispatch.js +137 -0
- package/dist/session/routing/envelope.d.ts +13 -0
- package/dist/session/routing/envelope.js +35 -0
- package/dist/session/routing/expectation.d.ts +6 -0
- package/dist/session/routing/expectation.js +1 -0
- package/dist/session/routing/index.d.ts +6 -0
- package/dist/session/routing/index.js +5 -0
- package/dist/session/routing/request.d.ts +8 -0
- package/dist/session/routing/request.js +25 -0
- package/dist/session/session.d.ts +67 -0
- package/dist/session/session.js +257 -0
- package/dist/session/session.typecheck.d.ts +1 -0
- package/dist/session/session.typecheck.js +31 -0
- package/dist/session/views/catalog.d.ts +15 -0
- package/dist/session/views/catalog.js +70 -0
- package/dist/session/views/index.d.ts +2 -0
- package/dist/session/views/index.js +2 -0
- package/dist/session/views/resolve.d.ts +11 -0
- package/dist/session/views/resolve.js +13 -0
- package/dist/store/entity-index.d.ts +22 -0
- package/dist/store/entity-index.js +94 -0
- package/dist/store/index.d.ts +1 -26
- package/dist/store/index.js +1 -19
- package/dist/store/memory.d.ts +46 -97
- package/dist/store/memory.js +346 -763
- package/dist/store/mutation.d.ts +5 -0
- package/dist/store/mutation.js +34 -0
- package/dist/store/observe.d.ts +3 -0
- package/dist/store/observe.js +17 -0
- package/dist/store/optimistic.d.ts +12 -0
- package/dist/store/optimistic.js +43 -0
- package/dist/store/query-key.d.ts +5 -0
- package/dist/store/query-key.js +22 -0
- package/dist/store/shape.d.ts +25 -0
- package/dist/store/shape.js +29 -0
- package/dist/store/store.d.ts +68 -0
- package/dist/store/store.js +144 -0
- package/dist/store/store.typecheck.d.ts +1 -0
- package/dist/store/store.typecheck.js +40 -0
- package/dist/transport/auto/decision.d.ts +22 -0
- package/dist/transport/auto/decision.js +48 -0
- package/dist/transport/auto/fallback.d.ts +16 -0
- package/dist/transport/auto/fallback.js +75 -0
- package/dist/transport/auto/index.d.ts +2 -0
- package/dist/transport/auto/index.js +2 -0
- package/dist/transport/auto/transport.d.ts +37 -0
- package/dist/transport/auto/transport.js +140 -0
- package/dist/transport/auto/warning.d.ts +13 -0
- package/dist/transport/auto/warning.js +18 -0
- package/dist/transport/deadline.d.ts +11 -0
- package/dist/transport/deadline.js +39 -0
- package/dist/transport/failure.d.ts +7 -0
- package/dist/transport/failure.js +9 -0
- package/dist/transport/http/index.d.ts +1 -0
- package/dist/transport/http/index.js +1 -0
- package/dist/transport/http/response.d.ts +8 -0
- package/dist/transport/http/response.js +79 -0
- package/dist/transport/http/stream.d.ts +26 -0
- package/dist/transport/http/stream.js +214 -0
- package/dist/transport/http/transport.d.ts +32 -0
- package/dist/transport/http/transport.js +343 -0
- package/dist/transport/index.d.ts +2 -8
- package/dist/transport/index.js +1 -6
- package/dist/transport/transport.d.ts +34 -0
- package/dist/transport/transport.js +1 -0
- package/dist/transport/websocket/connection.d.ts +38 -0
- package/dist/transport/websocket/connection.js +284 -0
- package/dist/transport/websocket/exchange.d.ts +46 -0
- package/dist/transport/websocket/exchange.js +300 -0
- package/dist/transport/websocket/index.d.ts +1 -0
- package/dist/transport/websocket/index.js +1 -0
- package/dist/transport/websocket/transport.d.ts +46 -0
- package/dist/transport/websocket/transport.js +164 -0
- package/package.json +41 -35
- package/dist/auth/addressing.d.ts +0 -32
- package/dist/auth/addressing.d.ts.map +0 -1
- package/dist/auth/addressing.js +0 -36
- package/dist/auth/addressing.js.map +0 -1
- package/dist/auth/api.d.ts +0 -70
- package/dist/auth/api.d.ts.map +0 -1
- package/dist/auth/api.js +0 -36
- package/dist/auth/api.js.map +0 -1
- package/dist/auth/batch.d.ts +0 -18
- package/dist/auth/batch.d.ts.map +0 -1
- package/dist/auth/batch.js +0 -25
- package/dist/auth/batch.js.map +0 -1
- package/dist/auth/composition.d.ts +0 -27
- package/dist/auth/composition.d.ts.map +0 -1
- package/dist/auth/composition.js +0 -83
- package/dist/auth/composition.js.map +0 -1
- package/dist/auth/defaults.d.ts +0 -3
- package/dist/auth/defaults.d.ts.map +0 -1
- package/dist/auth/defaults.js +0 -3
- package/dist/auth/defaults.js.map +0 -1
- package/dist/auth/index.d.ts.map +0 -1
- package/dist/auth/index.js.map +0 -1
- package/dist/auth/minting.d.ts +0 -35
- package/dist/auth/minting.d.ts.map +0 -1
- package/dist/auth/minting.js +0 -31
- package/dist/auth/minting.js.map +0 -1
- package/dist/auth/permissions.d.ts +0 -55
- package/dist/auth/permissions.d.ts.map +0 -1
- package/dist/auth/permissions.js +0 -47
- package/dist/auth/permissions.js.map +0 -1
- package/dist/auth/principal.d.ts +0 -19
- package/dist/auth/principal.d.ts.map +0 -1
- package/dist/auth/principal.js +0 -46
- package/dist/auth/principal.js.map +0 -1
- package/dist/auth/shorthands.d.ts +0 -19
- package/dist/auth/shorthands.d.ts.map +0 -1
- package/dist/auth/shorthands.js +0 -27
- package/dist/auth/shorthands.js.map +0 -1
- package/dist/client/batch.d.ts +0 -26
- package/dist/client/batch.d.ts.map +0 -1
- package/dist/client/batch.js +0 -8
- package/dist/client/batch.js.map +0 -1
- package/dist/client/bound.d.ts +0 -27
- package/dist/client/bound.d.ts.map +0 -1
- package/dist/client/bound.js +0 -14
- package/dist/client/bound.js.map +0 -1
- package/dist/client/client.d.ts.map +0 -1
- package/dist/client/client.js.map +0 -1
- package/dist/client/config.d.ts +0 -112
- package/dist/client/config.d.ts.map +0 -1
- package/dist/client/config.js +0 -10
- package/dist/client/config.js.map +0 -1
- package/dist/client/fn-map.d.ts +0 -61
- package/dist/client/fn-map.d.ts.map +0 -1
- package/dist/client/fn-map.js +0 -2
- package/dist/client/fn-map.js.map +0 -1
- package/dist/client/freeze.d.ts +0 -32
- package/dist/client/freeze.d.ts.map +0 -1
- package/dist/client/freeze.js +0 -42
- package/dist/client/freeze.js.map +0 -1
- package/dist/client/hooks.d.ts +0 -49
- package/dist/client/hooks.d.ts.map +0 -1
- package/dist/client/hooks.js +0 -2
- package/dist/client/hooks.js.map +0 -1
- package/dist/errors/errors.d.ts +0 -156
- package/dist/errors/errors.d.ts.map +0 -1
- package/dist/errors/errors.js +0 -238
- package/dist/errors/errors.js.map +0 -1
- package/dist/errors/guards.d.ts +0 -39
- package/dist/errors/guards.d.ts.map +0 -1
- package/dist/errors/guards.js +0 -127
- package/dist/errors/guards.js.map +0 -1
- package/dist/errors/index.d.ts.map +0 -1
- package/dist/errors/index.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/graph/api.d.ts +0 -85
- package/dist/graph/api.d.ts.map +0 -1
- package/dist/graph/api.js +0 -66
- package/dist/graph/api.js.map +0 -1
- package/dist/graph/index.d.ts.map +0 -1
- package/dist/graph/index.js.map +0 -1
- package/dist/graph/mutate/builder.d.ts +0 -108
- package/dist/graph/mutate/builder.d.ts.map +0 -1
- package/dist/graph/mutate/builder.js +0 -127
- package/dist/graph/mutate/builder.js.map +0 -1
- package/dist/graph/mutate/index.d.ts +0 -5
- package/dist/graph/mutate/index.d.ts.map +0 -1
- package/dist/graph/mutate/index.js +0 -3
- package/dist/graph/mutate/index.js.map +0 -1
- package/dist/graph/mutate/shorthands.d.ts +0 -42
- package/dist/graph/mutate/shorthands.d.ts.map +0 -1
- package/dist/graph/mutate/shorthands.js +0 -65
- package/dist/graph/mutate/shorthands.js.map +0 -1
- package/dist/graph/named.d.ts +0 -38
- package/dist/graph/named.d.ts.map +0 -1
- package/dist/graph/named.js +0 -47
- package/dist/graph/named.js.map +0 -1
- package/dist/graph/query/builder.d.ts +0 -116
- package/dist/graph/query/builder.d.ts.map +0 -1
- package/dist/graph/query/builder.js +0 -136
- package/dist/graph/query/builder.js.map +0 -1
- package/dist/graph/query/edge-ref.d.ts +0 -13
- package/dist/graph/query/edge-ref.d.ts.map +0 -1
- package/dist/graph/query/edge-ref.js +0 -56
- package/dist/graph/query/edge-ref.js.map +0 -1
- package/dist/graph/query/edges.d.ts +0 -10
- package/dist/graph/query/edges.d.ts.map +0 -1
- package/dist/graph/query/edges.js +0 -11
- package/dist/graph/query/edges.js.map +0 -1
- package/dist/graph/query/errors.d.ts +0 -31
- package/dist/graph/query/errors.d.ts.map +0 -1
- package/dist/graph/query/errors.js +0 -28
- package/dist/graph/query/errors.js.map +0 -1
- package/dist/graph/query/filter.d.ts +0 -50
- package/dist/graph/query/filter.d.ts.map +0 -1
- package/dist/graph/query/filter.js +0 -32
- package/dist/graph/query/filter.js.map +0 -1
- package/dist/graph/query/index.d.ts +0 -12
- package/dist/graph/query/index.d.ts.map +0 -1
- package/dist/graph/query/index.js +0 -7
- package/dist/graph/query/index.js.map +0 -1
- package/dist/graph/query/lower.d.ts +0 -30
- package/dist/graph/query/lower.d.ts.map +0 -1
- package/dist/graph/query/lower.js +0 -171
- package/dist/graph/query/lower.js.map +0 -1
- package/dist/graph/query/shorthands.d.ts +0 -34
- package/dist/graph/query/shorthands.d.ts.map +0 -1
- package/dist/graph/query/shorthands.js +0 -71
- package/dist/graph/query/shorthands.js.map +0 -1
- package/dist/graph/query/traverse.d.ts +0 -59
- package/dist/graph/query/traverse.d.ts.map +0 -1
- package/dist/graph/query/traverse.js +0 -144
- package/dist/graph/query/traverse.js.map +0 -1
- package/dist/graph/reconcile/execute.d.ts +0 -8
- package/dist/graph/reconcile/execute.d.ts.map +0 -1
- package/dist/graph/reconcile/execute.js +0 -56
- package/dist/graph/reconcile/execute.js.map +0 -1
- package/dist/graph/reconcile/index.d.ts +0 -5
- package/dist/graph/reconcile/index.d.ts.map +0 -1
- package/dist/graph/reconcile/index.js +0 -3
- package/dist/graph/reconcile/index.js.map +0 -1
- package/dist/graph/reconcile/input.d.ts +0 -80
- package/dist/graph/reconcile/input.d.ts.map +0 -1
- package/dist/graph/reconcile/input.js +0 -5
- package/dist/graph/reconcile/input.js.map +0 -1
- package/dist/graph/reconcile/normalize.d.ts +0 -3
- package/dist/graph/reconcile/normalize.d.ts.map +0 -1
- package/dist/graph/reconcile/normalize.js +0 -144
- package/dist/graph/reconcile/normalize.js.map +0 -1
- package/dist/graph/reconcile/result.d.ts +0 -19
- package/dist/graph/reconcile/result.d.ts.map +0 -1
- package/dist/graph/reconcile/result.js +0 -95
- package/dist/graph/reconcile/result.js.map +0 -1
- package/dist/graph/reconcile/scope.d.ts +0 -6
- package/dist/graph/reconcile/scope.d.ts.map +0 -1
- package/dist/graph/reconcile/scope.js +0 -69
- package/dist/graph/reconcile/scope.js.map +0 -1
- package/dist/graph/result/envelope.d.ts +0 -37
- package/dist/graph/result/envelope.d.ts.map +0 -1
- package/dist/graph/result/envelope.js +0 -59
- package/dist/graph/result/envelope.js.map +0 -1
- package/dist/graph/result/index.d.ts +0 -6
- package/dist/graph/result/index.d.ts.map +0 -1
- package/dist/graph/result/index.js +0 -4
- package/dist/graph/result/index.js.map +0 -1
- package/dist/graph/result/next.d.ts +0 -16
- package/dist/graph/result/next.d.ts.map +0 -1
- package/dist/graph/result/next.js +0 -77
- package/dist/graph/result/next.js.map +0 -1
- package/dist/graph/result/paged.d.ts +0 -30
- package/dist/graph/result/paged.d.ts.map +0 -1
- package/dist/graph/result/paged.js +0 -41
- package/dist/graph/result/paged.js.map +0 -1
- package/dist/graph/wire.d.ts +0 -33
- package/dist/graph/wire.d.ts.map +0 -1
- package/dist/graph/wire.js +0 -16
- package/dist/graph/wire.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/pacer/batcher.d.ts +0 -11
- package/dist/pacer/batcher.d.ts.map +0 -1
- package/dist/pacer/batcher.js +0 -15
- package/dist/pacer/batcher.js.map +0 -1
- package/dist/pacer/defaults.d.ts +0 -18
- package/dist/pacer/defaults.d.ts.map +0 -1
- package/dist/pacer/defaults.js +0 -18
- package/dist/pacer/defaults.js.map +0 -1
- package/dist/pacer/index.d.ts.map +0 -1
- package/dist/pacer/index.js.map +0 -1
- package/dist/pacer/queue.d.ts +0 -11
- package/dist/pacer/queue.d.ts.map +0 -1
- package/dist/pacer/queue.js +0 -15
- package/dist/pacer/queue.js.map +0 -1
- package/dist/pacer/rate-limiter.d.ts +0 -11
- package/dist/pacer/rate-limiter.d.ts.map +0 -1
- package/dist/pacer/rate-limiter.js +0 -15
- package/dist/pacer/rate-limiter.js.map +0 -1
- package/dist/pacer/retry.d.ts +0 -14
- package/dist/pacer/retry.d.ts.map +0 -1
- package/dist/pacer/retry.js +0 -50
- package/dist/pacer/retry.js.map +0 -1
- package/dist/pool/errors.d.ts +0 -13
- package/dist/pool/errors.d.ts.map +0 -1
- package/dist/pool/errors.js +0 -16
- package/dist/pool/errors.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/schema/bound/binder.d.ts +0 -49
- package/dist/schema/bound/binder.d.ts.map +0 -1
- package/dist/schema/bound/binder.js +0 -195
- package/dist/schema/bound/binder.js.map +0 -1
- package/dist/schema/bound/bound-node.d.ts +0 -105
- package/dist/schema/bound/bound-node.d.ts.map +0 -1
- package/dist/schema/bound/bound-node.js +0 -128
- package/dist/schema/bound/bound-node.js.map +0 -1
- package/dist/schema/bound/index.d.ts +0 -10
- package/dist/schema/bound/index.d.ts.map +0 -1
- package/dist/schema/bound/index.js +0 -5
- package/dist/schema/bound/index.js.map +0 -1
- package/dist/schema/bound/view.d.ts +0 -44
- package/dist/schema/bound/view.d.ts.map +0 -1
- package/dist/schema/bound/view.js +0 -117
- package/dist/schema/bound/view.js.map +0 -1
- package/dist/schema/bound/write-props.d.ts +0 -38
- package/dist/schema/bound/write-props.d.ts.map +0 -1
- package/dist/schema/bound/write-props.js +0 -2
- package/dist/schema/bound/write-props.js.map +0 -1
- package/dist/schema/call-args.d.ts +0 -6
- package/dist/schema/call-args.d.ts.map +0 -1
- package/dist/schema/call-args.js +0 -21
- package/dist/schema/call-args.js.map +0 -1
- package/dist/schema/class-proxy.d.ts +0 -11
- package/dist/schema/class-proxy.d.ts.map +0 -1
- package/dist/schema/class-proxy.js +0 -46
- package/dist/schema/class-proxy.js.map +0 -1
- package/dist/schema/extract.d.ts +0 -24
- package/dist/schema/extract.d.ts.map +0 -1
- package/dist/schema/extract.js +0 -45
- package/dist/schema/extract.js.map +0 -1
- package/dist/schema/from-entries.d.ts +0 -12
- package/dist/schema/from-entries.d.ts.map +0 -1
- package/dist/schema/from-entries.js +0 -39
- package/dist/schema/from-entries.js.map +0 -1
- package/dist/schema/index.d.ts.map +0 -1
- package/dist/schema/index.js.map +0 -1
- package/dist/schema/known-dispatch.d.ts +0 -6
- package/dist/schema/known-dispatch.d.ts.map +0 -1
- package/dist/schema/known-dispatch.js +0 -39
- package/dist/schema/known-dispatch.js.map +0 -1
- package/dist/schema/node-proxy.d.ts +0 -21
- package/dist/schema/node-proxy.d.ts.map +0 -1
- package/dist/schema/node-proxy.js +0 -75
- package/dist/schema/node-proxy.js.map +0 -1
- package/dist/schema/persistence.d.ts +0 -31
- package/dist/schema/persistence.d.ts.map +0 -1
- package/dist/schema/persistence.js +0 -2
- package/dist/schema/persistence.js.map +0 -1
- package/dist/schema/proxy-types.d.ts +0 -131
- package/dist/schema/proxy-types.d.ts.map +0 -1
- package/dist/schema/proxy-types.js +0 -2
- package/dist/schema/proxy-types.js.map +0 -1
- package/dist/schema/registry.d.ts +0 -50
- package/dist/schema/registry.d.ts.map +0 -1
- package/dist/schema/registry.js +0 -110
- package/dist/schema/registry.js.map +0 -1
- package/dist/schema/resolve.d.ts +0 -26
- package/dist/schema/resolve.d.ts.map +0 -1
- package/dist/schema/resolve.js +0 -27
- package/dist/schema/resolve.js.map +0 -1
- package/dist/schema/typed-client.d.ts +0 -10
- package/dist/schema/typed-client.d.ts.map +0 -1
- package/dist/schema/typed-client.js +0 -26
- package/dist/schema/typed-client.js.map +0 -1
- package/dist/schema/types.d.ts +0 -9
- package/dist/schema/types.d.ts.map +0 -1
- package/dist/schema/types.js +0 -2
- package/dist/schema/types.js.map +0 -1
- package/dist/session/bound.d.ts.map +0 -1
- package/dist/session/bound.js.map +0 -1
- package/dist/session/client-session.d.ts +0 -72
- package/dist/session/client-session.d.ts.map +0 -1
- package/dist/session/client-session.js +0 -673
- package/dist/session/client-session.js.map +0 -1
- package/dist/session/config.d.ts +0 -168
- package/dist/session/config.d.ts.map +0 -1
- package/dist/session/config.js +0 -2
- package/dist/session/config.js.map +0 -1
- package/dist/session/delegation/cache.d.ts +0 -139
- package/dist/session/delegation/cache.d.ts.map +0 -1
- package/dist/session/delegation/cache.js +0 -256
- package/dist/session/delegation/cache.js.map +0 -1
- package/dist/session/delegation/errors.d.ts +0 -44
- package/dist/session/delegation/errors.d.ts.map +0 -1
- package/dist/session/delegation/errors.js +0 -62
- package/dist/session/delegation/errors.js.map +0 -1
- package/dist/session/delegation/policy.d.ts +0 -183
- package/dist/session/delegation/policy.d.ts.map +0 -1
- package/dist/session/delegation/policy.js +0 -114
- package/dist/session/delegation/policy.js.map +0 -1
- package/dist/session/delegation/utils.d.ts +0 -4
- package/dist/session/delegation/utils.d.ts.map +0 -1
- package/dist/session/delegation/utils.js +0 -12
- package/dist/session/delegation/utils.js.map +0 -1
- package/dist/session/delegation-mint.d.ts +0 -13
- package/dist/session/delegation-mint.d.ts.map +0 -1
- package/dist/session/delegation-mint.js +0 -39
- package/dist/session/delegation-mint.js.map +0 -1
- package/dist/session/dispatch-routes.d.ts +0 -27
- package/dist/session/dispatch-routes.d.ts.map +0 -1
- package/dist/session/dispatch-routes.js +0 -77
- package/dist/session/dispatch-routes.js.map +0 -1
- package/dist/session/errors/index.d.ts +0 -6
- package/dist/session/errors/index.d.ts.map +0 -1
- package/dist/session/errors/index.js +0 -8
- package/dist/session/errors/index.js.map +0 -1
- package/dist/session/errors/session-errors.d.ts +0 -52
- package/dist/session/errors/session-errors.d.ts.map +0 -1
- package/dist/session/errors/session-errors.js +0 -70
- package/dist/session/errors/session-errors.js.map +0 -1
- package/dist/session/forward.d.ts +0 -15
- package/dist/session/forward.d.ts.map +0 -1
- package/dist/session/forward.js +0 -40
- package/dist/session/forward.js.map +0 -1
- package/dist/session/helpers.d.ts +0 -23
- package/dist/session/helpers.d.ts.map +0 -1
- package/dist/session/helpers.js +0 -56
- package/dist/session/helpers.js.map +0 -1
- package/dist/session/hooks.d.ts +0 -140
- package/dist/session/hooks.d.ts.map +0 -1
- package/dist/session/hooks.js +0 -2
- package/dist/session/hooks.js.map +0 -1
- package/dist/session/index.d.ts.map +0 -1
- package/dist/session/index.js.map +0 -1
- package/dist/session/redirect/errors.d.ts +0 -45
- package/dist/session/redirect/errors.d.ts.map +0 -1
- package/dist/session/redirect/errors.js +0 -52
- package/dist/session/redirect/errors.js.map +0 -1
- package/dist/session/redirect/policy.d.ts +0 -79
- package/dist/session/redirect/policy.d.ts.map +0 -1
- package/dist/session/redirect/policy.js +0 -69
- package/dist/session/redirect/policy.js.map +0 -1
- package/dist/session/types.d.ts +0 -54
- package/dist/session/types.d.ts.map +0 -1
- package/dist/session/types.js +0 -2
- package/dist/session/types.js.map +0 -1
- package/dist/store/canonicalize.d.ts +0 -44
- package/dist/store/canonicalize.d.ts.map +0 -1
- package/dist/store/canonicalize.js +0 -0
- package/dist/store/canonicalize.js.map +0 -1
- package/dist/store/entities.d.ts +0 -81
- package/dist/store/entities.d.ts.map +0 -1
- package/dist/store/entities.js +0 -202
- package/dist/store/entities.js.map +0 -1
- package/dist/store/index.d.ts.map +0 -1
- package/dist/store/index.js.map +0 -1
- package/dist/store/invalidate.d.ts +0 -66
- package/dist/store/invalidate.d.ts.map +0 -1
- package/dist/store/invalidate.js +0 -117
- package/dist/store/invalidate.js.map +0 -1
- package/dist/store/memory.d.ts.map +0 -1
- package/dist/store/memory.js.map +0 -1
- package/dist/store/overlay.d.ts +0 -118
- package/dist/store/overlay.d.ts.map +0 -1
- package/dist/store/overlay.js +0 -237
- package/dist/store/overlay.js.map +0 -1
- package/dist/store/schedule.d.ts +0 -31
- package/dist/store/schedule.d.ts.map +0 -1
- package/dist/store/schedule.js +0 -76
- package/dist/store/schedule.js.map +0 -1
- package/dist/store/shapes.d.ts +0 -92
- package/dist/store/shapes.d.ts.map +0 -1
- package/dist/store/shapes.js +0 -369
- package/dist/store/shapes.js.map +0 -1
- package/dist/store/types.d.ts +0 -168
- package/dist/store/types.d.ts.map +0 -1
- package/dist/store/types.js +0 -7
- package/dist/store/types.js.map +0 -1
- package/dist/transport/binary.d.ts +0 -15
- package/dist/transport/binary.d.ts.map +0 -1
- package/dist/transport/binary.js +0 -2
- package/dist/transport/binary.js.map +0 -1
- package/dist/transport/contract.d.ts +0 -58
- package/dist/transport/contract.d.ts.map +0 -1
- package/dist/transport/contract.js +0 -11
- package/dist/transport/contract.js.map +0 -1
- package/dist/transport/fetch.d.ts +0 -31
- package/dist/transport/fetch.d.ts.map +0 -1
- package/dist/transport/fetch.js +0 -78
- package/dist/transport/fetch.js.map +0 -1
- package/dist/transport/http-envelope.d.ts +0 -49
- package/dist/transport/http-envelope.d.ts.map +0 -1
- package/dist/transport/http-envelope.js +0 -418
- package/dist/transport/http-envelope.js.map +0 -1
- package/dist/transport/http-routed.d.ts +0 -61
- package/dist/transport/http-routed.d.ts.map +0 -1
- package/dist/transport/http-routed.js +0 -409
- package/dist/transport/http-routed.js.map +0 -1
- package/dist/transport/index.d.ts.map +0 -1
- package/dist/transport/index.js.map +0 -1
- package/dist/transport/request-id.d.ts +0 -9
- package/dist/transport/request-id.d.ts.map +0 -1
- package/dist/transport/request-id.js +0 -12
- package/dist/transport/request-id.js.map +0 -1
- package/dist/transport/ws-envelope.d.ts +0 -74
- package/dist/transport/ws-envelope.d.ts.map +0 -1
- package/dist/transport/ws-envelope.js +0 -567
- package/dist/transport/ws-envelope.js.map +0 -1
- package/dist/util/race-signal.d.ts +0 -12
- package/dist/util/race-signal.d.ts.map +0 -1
- package/dist/util/race-signal.js +0 -34
- package/dist/util/race-signal.js.map +0 -1
- package/dist/wire/controller.d.ts +0 -38
- package/dist/wire/controller.d.ts.map +0 -1
- package/dist/wire/controller.js +0 -38
- package/dist/wire/controller.js.map +0 -1
- package/dist/wire/index.d.ts +0 -7
- package/dist/wire/index.d.ts.map +0 -1
- package/dist/wire/index.js +0 -4
- package/dist/wire/index.js.map +0 -1
- package/dist/wire/meta.d.ts +0 -81
- package/dist/wire/meta.d.ts.map +0 -1
- package/dist/wire/meta.js +0 -44
- package/dist/wire/meta.js.map +0 -1
- package/dist/wire/sse.d.ts +0 -67
- package/dist/wire/sse.d.ts.map +0 -1
- package/dist/wire/sse.js +0 -170
- package/dist/wire/sse.js.map +0 -1
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import * as invocationProtocol from '@astrale-os/kernel-protocol/invocation';
|
|
2
|
+
import { acceptCall, dispatchTrace, isAdmittedMissError, isAdmittedStaleRouteError, } from '../../client/index.js';
|
|
3
|
+
import { ClientError, ResponseError } from '../../errors/index.js';
|
|
4
|
+
import { runSessionOperation, sessionTransportOptions, allowEndpoint } from '../context/index.js';
|
|
5
|
+
import { resolveAuth } from './auth.js';
|
|
6
|
+
import { selectEnvelope } from './envelope.js';
|
|
7
|
+
export class SessionDispatcher {
|
|
8
|
+
state;
|
|
9
|
+
constructor(state) {
|
|
10
|
+
this.state = state;
|
|
11
|
+
}
|
|
12
|
+
async dispatch(input, options, operation, expected) {
|
|
13
|
+
this.state.requireOpen();
|
|
14
|
+
const call = acceptCall(input);
|
|
15
|
+
// Authority is resolved before warm lookup so changed credentials or delegation cannot reuse a
|
|
16
|
+
// carrier minted for a different caller partition.
|
|
17
|
+
const auth = await resolveAuth(this.state.auth, call, operation);
|
|
18
|
+
const source = await this.sourceKernel(operation);
|
|
19
|
+
const cacheKey = await this.state.cache.key(source.issuer, call, auth, expected);
|
|
20
|
+
const dispatch = Object.freeze({
|
|
21
|
+
call,
|
|
22
|
+
auth,
|
|
23
|
+
source,
|
|
24
|
+
cacheKey,
|
|
25
|
+
...(expected === undefined ? {} : { expected }),
|
|
26
|
+
});
|
|
27
|
+
const learned = this.state.cache.get(cacheKey);
|
|
28
|
+
if (learned !== undefined) {
|
|
29
|
+
return this.dispatchDestinationWithRecovery(learned, dispatch, options, operation);
|
|
30
|
+
}
|
|
31
|
+
const result = await this.dispatchSource(dispatch, undefined, options, operation);
|
|
32
|
+
return this.followSource(result, dispatch, options, operation);
|
|
33
|
+
}
|
|
34
|
+
async dispatchSource(state, routing, options, operation) {
|
|
35
|
+
this.state.requireOpen();
|
|
36
|
+
allowEndpoint(this.state.sourceEndpoint, this.state.policy);
|
|
37
|
+
const client = this.state.pool.clientFor(Object.freeze({ transport: 'http', url: this.state.sourceEndpoint }));
|
|
38
|
+
return runSessionOperation(operation, () => authenticated(client, state.auth.credential).dispatch(state.call, {
|
|
39
|
+
...sessionTransportOptions(operation, options.idempotencyKey),
|
|
40
|
+
...(state.auth.delegate === undefined ? {} : { delegate: state.auth.delegate }),
|
|
41
|
+
...(routing === undefined ? {} : { routing }),
|
|
42
|
+
...(state.expected === undefined ? {} : { schema: { revision: state.expected.revision } }),
|
|
43
|
+
}));
|
|
44
|
+
}
|
|
45
|
+
async followSource(result, state, options, operation) {
|
|
46
|
+
if (result.kind !== 'redirect')
|
|
47
|
+
return result;
|
|
48
|
+
const redirect = result.redirect;
|
|
49
|
+
if (redirect.route.via.issuer !== state.source.issuer) {
|
|
50
|
+
throw new ClientError('Redirect issuer differs from the session-pinned source Kernel identity.');
|
|
51
|
+
}
|
|
52
|
+
requireExpectedPublication(redirect.route, state.expected);
|
|
53
|
+
const learned = this.state.cache.learn(state.cacheKey, redirect.route, redirect.credential);
|
|
54
|
+
return this.dispatchDestinationWithRecovery(learned, state, options, operation, redirect.trace);
|
|
55
|
+
}
|
|
56
|
+
async dispatchDestinationWithRecovery(learned, state, options, operation, trace) {
|
|
57
|
+
try {
|
|
58
|
+
return await this.dispatchDestination(learned, state.call, options, operation, state.expected, trace);
|
|
59
|
+
}
|
|
60
|
+
catch (cause) {
|
|
61
|
+
const stale = isAdmittedStaleRouteError(cause);
|
|
62
|
+
const miss = isAdmittedMissError(cause);
|
|
63
|
+
if (isRouteCompatibilityConflict(cause)) {
|
|
64
|
+
this.state.cache.delete(state.cacheKey);
|
|
65
|
+
throw cause;
|
|
66
|
+
}
|
|
67
|
+
if (!stale && !miss)
|
|
68
|
+
throw cause;
|
|
69
|
+
this.state.cache.delete(state.cacheKey);
|
|
70
|
+
if (!operation.claimRecovery())
|
|
71
|
+
throw cause;
|
|
72
|
+
const routing = stale
|
|
73
|
+
? Object.freeze({
|
|
74
|
+
kind: 'refresh',
|
|
75
|
+
stale: learned.route.via.publication.etag,
|
|
76
|
+
})
|
|
77
|
+
: undefined;
|
|
78
|
+
const refreshed = await this.dispatchSource(state, routing, options, operation);
|
|
79
|
+
return this.followSource(refreshed, state, options, operation);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
async dispatchDestination(learned, call, options, operation, expected, trace) {
|
|
83
|
+
if (learned.route.via.issuer !== (await this.sourceKernel(operation)).issuer) {
|
|
84
|
+
throw new ClientError('Learned route issuer differs from the session-pinned source Kernel.');
|
|
85
|
+
}
|
|
86
|
+
requireExpectedPublication(learned.route, expected);
|
|
87
|
+
const envelope = selectEnvelope(learned.route.endpoint, this.state.envelopeTransport, this.state.websocketAvailable, this.state.pool, this.state.policy);
|
|
88
|
+
const requestOptions = {
|
|
89
|
+
...sessionTransportOptions(operation, options.idempotencyKey),
|
|
90
|
+
routing: learned.route.via,
|
|
91
|
+
};
|
|
92
|
+
const result = await runSessionOperation(operation, () => trace === undefined
|
|
93
|
+
? authenticated(envelope.client, learned.credential).dispatch(call, requestOptions)
|
|
94
|
+
: dispatchTrace(envelope.client, learned.credential, call, requestOptions, trace));
|
|
95
|
+
if (result.kind === 'redirect') {
|
|
96
|
+
throw new ClientError('A destination redirect is invalid; only the source Kernel may redirect.');
|
|
97
|
+
}
|
|
98
|
+
return result;
|
|
99
|
+
}
|
|
100
|
+
async sourceKernel(operation) {
|
|
101
|
+
const snapshot = await this.state.discovery.snapshot(operation);
|
|
102
|
+
if (snapshot.kernel !== this.state.kernel) {
|
|
103
|
+
throw new ClientError('Session discovery returned another Kernel identity.');
|
|
104
|
+
}
|
|
105
|
+
return Object.freeze({ issuer: snapshot.publication.identity.issuer });
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
function isRouteCompatibilityConflict(input) {
|
|
109
|
+
if (!(input instanceof ResponseError))
|
|
110
|
+
return false;
|
|
111
|
+
const failure = invocationProtocol.serviceErrorOf({
|
|
112
|
+
code: input.code,
|
|
113
|
+
message: input.message,
|
|
114
|
+
...(input.data === undefined ? {} : { data: input.data }),
|
|
115
|
+
});
|
|
116
|
+
return (failure?.data.code === invocationProtocol.SCHEMA_UPGRADE_REQUIRED ||
|
|
117
|
+
failure?.data.code === invocationProtocol.SCHEMA_REVISION_MISMATCH ||
|
|
118
|
+
failure?.data.code === invocationProtocol.SERVICE_TRUST_REQUIRED);
|
|
119
|
+
}
|
|
120
|
+
function requireExpectedPublication(route, expected) {
|
|
121
|
+
if (expected === undefined)
|
|
122
|
+
return;
|
|
123
|
+
const actual = route.via.publication;
|
|
124
|
+
if (actual.origin !== expected.origin || actual.revision !== expected.revision) {
|
|
125
|
+
throw new ClientError('Resolved route does not match the expected Schema revision.');
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
export function requireResultKind(expected, result) {
|
|
129
|
+
if (result.kind === expected)
|
|
130
|
+
return result;
|
|
131
|
+
if (result.kind === 'stream')
|
|
132
|
+
void result.stream.cancel(`Expected ${expected} result.`);
|
|
133
|
+
throw new ClientError(`Function returned ${result.kind}; ${expected} was required.`);
|
|
134
|
+
}
|
|
135
|
+
function authenticated(client, credential) {
|
|
136
|
+
return credential === undefined ? client : client.as(credential);
|
|
137
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { publication } from '@astrale-os/kernel-protocol';
|
|
2
|
+
import type { Client } from '../../client/index.js';
|
|
3
|
+
import type { ClientTarget } from '../../pool/index.js';
|
|
4
|
+
import type { SessionPolicy } from '../context/index.js';
|
|
5
|
+
import type { SessionEnvelopeTransport } from './request.js';
|
|
6
|
+
export interface ClientPoolCapability {
|
|
7
|
+
clientFor(target: ClientTarget): Client;
|
|
8
|
+
}
|
|
9
|
+
export interface EnvelopeSelection {
|
|
10
|
+
readonly client: Client;
|
|
11
|
+
readonly destination: ClientTarget;
|
|
12
|
+
}
|
|
13
|
+
export declare function selectEnvelope(endpoints: publication.InvocationEndpoints, preference: SessionEnvelopeTransport, websocketAvailable: boolean, pool: ClientPoolCapability, policy: Readonly<SessionPolicy>): EnvelopeSelection;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ClientError } from '../../errors/index.js';
|
|
2
|
+
import { allowEndpoint } from '../context/index.js';
|
|
3
|
+
export function selectEnvelope(endpoints, preference, websocketAvailable, pool, policy) {
|
|
4
|
+
let destination;
|
|
5
|
+
if (preference === 'websocket') {
|
|
6
|
+
if (endpoints.websocket === undefined) {
|
|
7
|
+
throw new ClientError('Callable does not advertise a WebSocket endpoint.');
|
|
8
|
+
}
|
|
9
|
+
if (!websocketAvailable)
|
|
10
|
+
throw new ClientError('No WebSocket implementation is available.');
|
|
11
|
+
allowEndpoint(endpoints.websocket, policy);
|
|
12
|
+
destination = Object.freeze({ transport: 'websocket', url: endpoints.websocket });
|
|
13
|
+
}
|
|
14
|
+
else if (preference === 'auto' && endpoints.websocket !== undefined && websocketAvailable) {
|
|
15
|
+
allowEndpoint(endpoints.http, policy);
|
|
16
|
+
allowEndpoint(endpoints.websocket, policy);
|
|
17
|
+
destination = Object.freeze({
|
|
18
|
+
transport: 'auto',
|
|
19
|
+
endpoints: Object.freeze({ http: endpoints.http, websocket: endpoints.websocket }),
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
allowEndpoint(endpoints.http, policy);
|
|
24
|
+
destination = Object.freeze({ transport: 'http', url: endpoints.http });
|
|
25
|
+
}
|
|
26
|
+
const client = pool.clientFor(destination);
|
|
27
|
+
if (client === null ||
|
|
28
|
+
typeof client !== 'object' ||
|
|
29
|
+
typeof client.dispatch !== 'function' ||
|
|
30
|
+
typeof client.as !== 'function' ||
|
|
31
|
+
typeof client.close !== 'function') {
|
|
32
|
+
throw new TypeError('Session client pool capability returned an invalid Client.');
|
|
33
|
+
}
|
|
34
|
+
return Object.freeze({ client, destination });
|
|
35
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { admitSessionAuth, resolveAuth, type Auth, type EffectiveAuth, type SessionAuth, } from './auth.js';
|
|
2
|
+
export type { SchemaExpectation } from './expectation.js';
|
|
3
|
+
export { RouteCache, type LearnedRoute } from './cache.js';
|
|
4
|
+
export { requireResultKind, SessionDispatcher, type SessionDispatcherOptions } from './dispatch.js';
|
|
5
|
+
export { type ClientPoolCapability, type EnvelopeSelection } from './envelope.js';
|
|
6
|
+
export { admitEnvelopeTransport, admitRequestOptions, type SessionEnvelopeTransport, type SessionRequestOptions, } from './request.js';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { admitSessionAuth, resolveAuth, } from './auth.js';
|
|
2
|
+
export { RouteCache } from './cache.js';
|
|
3
|
+
export { requireResultKind, SessionDispatcher } from './dispatch.js';
|
|
4
|
+
export {} from './envelope.js';
|
|
5
|
+
export { admitEnvelopeTransport, admitRequestOptions, } from './request.js';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type * as invocation from '@astrale-os/kernel-protocol/invocation';
|
|
2
|
+
import type { SessionControlOptions } from '../context/index.js';
|
|
3
|
+
export type SessionEnvelopeTransport = 'auto' | 'http' | 'websocket';
|
|
4
|
+
export interface SessionRequestOptions extends SessionControlOptions {
|
|
5
|
+
readonly idempotencyKey?: invocation.IdempotencyKey;
|
|
6
|
+
}
|
|
7
|
+
export declare function admitRequestOptions(input?: SessionRequestOptions): Readonly<SessionRequestOptions>;
|
|
8
|
+
export declare function admitEnvelopeTransport(input: SessionEnvelopeTransport): SessionEnvelopeTransport;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as invocationProtocol from '@astrale-os/kernel-protocol/invocation';
|
|
2
|
+
import { admitControlOptions } from '../context/index.js';
|
|
3
|
+
export function admitRequestOptions(input = {}) {
|
|
4
|
+
if (input === null || typeof input !== 'object' || Array.isArray(input)) {
|
|
5
|
+
throw new TypeError('Session request options are invalid.');
|
|
6
|
+
}
|
|
7
|
+
const control = admitControlOptions(input);
|
|
8
|
+
const fields = Reflect.ownKeys(input);
|
|
9
|
+
if (fields.some((field) => !['signal', 'timeoutMs', 'idempotencyKey'].includes(String(field)))) {
|
|
10
|
+
throw new TypeError('Session request options contain unsupported fields.');
|
|
11
|
+
}
|
|
12
|
+
const idempotencyKey = input.idempotencyKey === undefined
|
|
13
|
+
? undefined
|
|
14
|
+
: invocationProtocol.acceptIdempotencyKey(input.idempotencyKey, 'request.idempotencyKey');
|
|
15
|
+
return Object.freeze({
|
|
16
|
+
...control,
|
|
17
|
+
...(idempotencyKey === undefined ? {} : { idempotencyKey }),
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
export function admitEnvelopeTransport(input) {
|
|
21
|
+
if (input !== 'auto' && input !== 'http' && input !== 'websocket') {
|
|
22
|
+
throw new TypeError('Session envelope transport is invalid.');
|
|
23
|
+
}
|
|
24
|
+
return input;
|
|
25
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { IssuerId } from '@astrale-os/kernel-core/auth/issuer';
|
|
2
|
+
import type { PathLike } from '@astrale-os/kernel-core/path';
|
|
3
|
+
import type { Key } from '@astrale-os/kernel-dsl/v1';
|
|
4
|
+
import type { Domain } from '@astrale-os/kernel-dsl/v1/domain';
|
|
5
|
+
import type { Call, Input, Result } from '../client/index.js';
|
|
6
|
+
import type { DomainBinding, GraphApi } from '../graph/index.js';
|
|
7
|
+
import type { ClientFactory, ClientPool as ClientPoolType } from '../pool/index.js';
|
|
8
|
+
import type { ReadyInstallation, SchemaApi } from '../schema/index.js';
|
|
9
|
+
import type { ClientWarning } from '../transport/auto/index.js';
|
|
10
|
+
import type { Fetch } from '../transport/http/index.js';
|
|
11
|
+
import type { WebSocketConstructor } from '../transport/websocket/index.js';
|
|
12
|
+
import type { SessionControlOptions, SessionPolicy } from './context/index.js';
|
|
13
|
+
import type { SessionSnapshot } from './discovery/index.js';
|
|
14
|
+
import type { CallableReference, InputOfReference, OutputOfReference } from './reference.js';
|
|
15
|
+
import type { SessionAuth, SessionEnvelopeTransport, SessionRequestOptions } from './routing/index.js';
|
|
16
|
+
import type { ViewCatalog } from './views/index.js';
|
|
17
|
+
export interface ClientSessionOptions {
|
|
18
|
+
/** Exact canonical source Kernel identity; its invocation and discovery endpoints are derived. */
|
|
19
|
+
readonly kernel: string;
|
|
20
|
+
readonly fetch?: Fetch;
|
|
21
|
+
readonly client?: ClientFactory;
|
|
22
|
+
readonly pool?: Pick<ClientPoolType, 'clientFor'>;
|
|
23
|
+
readonly websocket?: WebSocketConstructor;
|
|
24
|
+
readonly auth?: SessionAuth;
|
|
25
|
+
readonly policy: SessionPolicy;
|
|
26
|
+
readonly envelopeTransport?: SessionEnvelopeTransport;
|
|
27
|
+
readonly onWarning?: (warning: ClientWarning) => void;
|
|
28
|
+
readonly maximumPublicationBytes?: number;
|
|
29
|
+
readonly maximumBundleBytes?: number;
|
|
30
|
+
readonly maximumResponseBytes?: number;
|
|
31
|
+
readonly timeoutMs?: number;
|
|
32
|
+
}
|
|
33
|
+
export type ConnectOptions = Omit<ClientSessionOptions, 'kernel' | 'policy'> & {
|
|
34
|
+
readonly url: string;
|
|
35
|
+
readonly policy?: SessionPolicy;
|
|
36
|
+
};
|
|
37
|
+
/** Caller-owned discovery and redirect-following conversation with one exact source Kernel. */
|
|
38
|
+
export declare class ClientSession {
|
|
39
|
+
readonly kernel: IssuerId;
|
|
40
|
+
readonly schema: SchemaApi;
|
|
41
|
+
readonly graph: GraphApi;
|
|
42
|
+
private readonly ownedPool?;
|
|
43
|
+
private readonly discovery;
|
|
44
|
+
private readonly dispatcher;
|
|
45
|
+
private readonly lifecycle;
|
|
46
|
+
private readonly timeoutMs;
|
|
47
|
+
private readonly routes;
|
|
48
|
+
private readonly admitTargetViews;
|
|
49
|
+
private closed;
|
|
50
|
+
constructor(options: ClientSessionOptions);
|
|
51
|
+
/** Bind one admitted DSL Domain to authenticated graph projection and Method dispatch. */
|
|
52
|
+
bind<const DomainValue extends Domain>(domain: DomainValue): DomainBinding<DomainValue>;
|
|
53
|
+
snapshot(options?: SessionControlOptions): Promise<SessionSnapshot>;
|
|
54
|
+
viewsFor(target: PathLike, options?: SessionControlOptions): Promise<ViewCatalog>;
|
|
55
|
+
installation(origin: Key.Origin, options?: SessionControlOptions): Promise<ReadyInstallation>;
|
|
56
|
+
dispatch(call: Call, options?: SessionRequestOptions): Promise<Result>;
|
|
57
|
+
call(call: Call, options?: SessionRequestOptions): Promise<Input>;
|
|
58
|
+
invoke<const Reference extends CallableReference>(reference: Reference, input: InputOfReference<Reference>, options?: SessionRequestOptions): Promise<OutputOfReference<Reference>>;
|
|
59
|
+
stream(call: Call, options?: SessionRequestOptions): Promise<import("../client/result.js").Stream>;
|
|
60
|
+
binary(call: Call, options?: SessionRequestOptions): Promise<import("@astrale-os/kernel-core/callable").BinaryResult>;
|
|
61
|
+
close(): void;
|
|
62
|
+
private requireOpen;
|
|
63
|
+
private invokeDomainMethod;
|
|
64
|
+
private operation;
|
|
65
|
+
}
|
|
66
|
+
/** Open one caller-owned conversation with a Kernel using secure defaults. */
|
|
67
|
+
export declare function connect(options: ConnectOptions): ClientSession;
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
import { Path } from '@astrale-os/kernel-core/path';
|
|
2
|
+
import { Client } from '../client/index.js';
|
|
3
|
+
import { ClientError, SessionError } from '../errors/index.js';
|
|
4
|
+
import { createDomainBinding } from '../graph/domain/binding.js';
|
|
5
|
+
import { createGraph } from '../graph/index.js';
|
|
6
|
+
import { ClientPool } from '../pool/index.js';
|
|
7
|
+
import { createSchema } from '../schema/index.js';
|
|
8
|
+
import { AutoTransport } from '../transport/auto/index.js';
|
|
9
|
+
import { HttpTransport } from '../transport/http/index.js';
|
|
10
|
+
import { WebSocketTransport } from '../transport/websocket/index.js';
|
|
11
|
+
import { admitControlOptions, admitPolicy, createSessionOperation, DEFAULT_MAXIMUM_BUNDLE_BYTES, DEFAULT_MAXIMUM_PUBLICATION_BYTES, DEFAULT_MAXIMUM_RESPONSE_BYTES, DEFAULT_TIMEOUT_MS, admitKernel, kernelInvocationEndpoint, platformDuration, positive, } from './context/index.js';
|
|
12
|
+
import { createSessionDiscovery } from './discovery/index.js';
|
|
13
|
+
import { admitReference } from './reference.js';
|
|
14
|
+
import { admitEnvelopeTransport, admitRequestOptions, admitSessionAuth, requireResultKind, RouteCache, SessionDispatcher, } from './routing/index.js';
|
|
15
|
+
import { resolveViewsFor, targetViewCatalog } from './views/index.js';
|
|
16
|
+
const DEFAULT_SESSION_POLICY = Object.freeze({ maximumRouteAgeMs: 60_000 });
|
|
17
|
+
/** Caller-owned discovery and redirect-following conversation with one exact source Kernel. */
|
|
18
|
+
export class ClientSession {
|
|
19
|
+
kernel;
|
|
20
|
+
schema;
|
|
21
|
+
graph;
|
|
22
|
+
ownedPool;
|
|
23
|
+
discovery;
|
|
24
|
+
dispatcher;
|
|
25
|
+
lifecycle = new AbortController();
|
|
26
|
+
timeoutMs;
|
|
27
|
+
routes;
|
|
28
|
+
admitTargetViews;
|
|
29
|
+
closed = false;
|
|
30
|
+
constructor(options) {
|
|
31
|
+
if (options === null || typeof options !== 'object') {
|
|
32
|
+
throw new TypeError('ClientSession options are invalid.');
|
|
33
|
+
}
|
|
34
|
+
const policy = admitPolicy(options.policy);
|
|
35
|
+
this.admitTargetViews = (input) => targetViewCatalog(input, policy);
|
|
36
|
+
this.kernel = admitKernel(options.kernel, policy.allowInsecureHttp === true);
|
|
37
|
+
const sourceEndpoint = kernelInvocationEndpoint(this.kernel);
|
|
38
|
+
const fetch = options.fetch ?? globalThis.fetch;
|
|
39
|
+
if (typeof fetch !== 'function')
|
|
40
|
+
throw new TypeError('ClientSession requires Fetch.');
|
|
41
|
+
const fetchImpl = options.fetch === undefined ? fetch.bind(globalThis) : fetch;
|
|
42
|
+
if (options.client !== undefined && options.pool !== undefined) {
|
|
43
|
+
throw new TypeError('ClientSession accepts either client or pool, not both.');
|
|
44
|
+
}
|
|
45
|
+
const maximumPublicationBytes = positive(options.maximumPublicationBytes ?? DEFAULT_MAXIMUM_PUBLICATION_BYTES, 'maximumPublicationBytes');
|
|
46
|
+
const maximumBundleBytes = positive(options.maximumBundleBytes ?? DEFAULT_MAXIMUM_BUNDLE_BYTES, 'maximumBundleBytes');
|
|
47
|
+
const maximumResponseBytes = positive(options.maximumResponseBytes ?? DEFAULT_MAXIMUM_RESPONSE_BYTES, 'maximumResponseBytes');
|
|
48
|
+
const timeoutMs = platformDuration(options.timeoutMs ?? DEFAULT_TIMEOUT_MS, 'timeoutMs');
|
|
49
|
+
this.timeoutMs = timeoutMs;
|
|
50
|
+
const websocketAvailable = options.client !== undefined ||
|
|
51
|
+
options.pool !== undefined ||
|
|
52
|
+
options.websocket !== undefined ||
|
|
53
|
+
typeof globalThis.WebSocket === 'function';
|
|
54
|
+
const client = options.client ??
|
|
55
|
+
defaultClientFactory({
|
|
56
|
+
fetch: fetchImpl,
|
|
57
|
+
...(options.websocket === undefined ? {} : { websocket: options.websocket }),
|
|
58
|
+
...(options.onWarning === undefined ? {} : { onWarning: options.onWarning }),
|
|
59
|
+
maximumResponseBytes,
|
|
60
|
+
timeoutMs,
|
|
61
|
+
});
|
|
62
|
+
let pool;
|
|
63
|
+
if (options.pool === undefined) {
|
|
64
|
+
const ownedPool = new ClientPool({ client });
|
|
65
|
+
this.ownedPool = ownedPool;
|
|
66
|
+
pool = admitClientPool(ownedPool);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
pool = admitClientPool(options.pool);
|
|
70
|
+
}
|
|
71
|
+
this.discovery = createSessionDiscovery({
|
|
72
|
+
kernel: this.kernel,
|
|
73
|
+
fetch: fetchImpl,
|
|
74
|
+
policy,
|
|
75
|
+
maximumPublicationBytes,
|
|
76
|
+
maximumBundleBytes,
|
|
77
|
+
requireOpen: () => this.requireOpen(),
|
|
78
|
+
acquisitionOperation: () => this.operation(undefined),
|
|
79
|
+
});
|
|
80
|
+
this.routes = new RouteCache(policy.maximumRouteAgeMs);
|
|
81
|
+
this.dispatcher = new SessionDispatcher({
|
|
82
|
+
kernel: this.kernel,
|
|
83
|
+
sourceEndpoint,
|
|
84
|
+
pool,
|
|
85
|
+
websocketAvailable,
|
|
86
|
+
auth: admitSessionAuth(options.auth),
|
|
87
|
+
cache: this.routes,
|
|
88
|
+
policy,
|
|
89
|
+
envelopeTransport: admitEnvelopeTransport(options.envelopeTransport ?? 'http'),
|
|
90
|
+
discovery: this.discovery,
|
|
91
|
+
requireOpen: () => this.requireOpen(),
|
|
92
|
+
});
|
|
93
|
+
this.schema = createSchema((request, options) => this.dispatch(request, options), {
|
|
94
|
+
maximumPublicationBytes,
|
|
95
|
+
maximumBundleBytes,
|
|
96
|
+
});
|
|
97
|
+
this.graph = createGraph((call, options) => this.call(call, options));
|
|
98
|
+
}
|
|
99
|
+
/** Bind one admitted DSL Domain to authenticated graph projection and Method dispatch. */
|
|
100
|
+
bind(domain) {
|
|
101
|
+
return createDomainBinding(domain, this.graph, (node, method, input) => this.invokeDomainMethod(domain, node, method, input));
|
|
102
|
+
}
|
|
103
|
+
snapshot(options) {
|
|
104
|
+
return this.discovery.snapshot(this.operation(admitControlOptions(options)));
|
|
105
|
+
}
|
|
106
|
+
viewsFor(target, options) {
|
|
107
|
+
this.requireOpen();
|
|
108
|
+
return resolveViewsFor(async (call, operation) => requireResultKind('value', await this.dispatcher.dispatch(call, {}, operation)).value, this.admitTargetViews, target, this.operation(admitControlOptions(options)));
|
|
109
|
+
}
|
|
110
|
+
async installation(origin, options) {
|
|
111
|
+
const result = await this.schema.introspect({
|
|
112
|
+
from: { kind: 'installation', origin },
|
|
113
|
+
select: {
|
|
114
|
+
state: true,
|
|
115
|
+
target: true,
|
|
116
|
+
source: true,
|
|
117
|
+
bundle: true,
|
|
118
|
+
readiness: true,
|
|
119
|
+
capabilities: true,
|
|
120
|
+
},
|
|
121
|
+
}, options);
|
|
122
|
+
if (result?.state !== 'ready' || result.readiness === null) {
|
|
123
|
+
throw new ClientError(`Domain ${origin} is not ready on this Kernel.`);
|
|
124
|
+
}
|
|
125
|
+
return result;
|
|
126
|
+
}
|
|
127
|
+
dispatch(call, options) {
|
|
128
|
+
const admitted = admitRequestOptions(options);
|
|
129
|
+
return this.dispatcher.dispatch(call, admitted, this.operation(admitted));
|
|
130
|
+
}
|
|
131
|
+
async call(call, options) {
|
|
132
|
+
const result = await this.dispatch(call, options);
|
|
133
|
+
return requireResultKind('value', result).value;
|
|
134
|
+
}
|
|
135
|
+
async invoke(reference, input, options) {
|
|
136
|
+
const admittedReference = admitReference(reference);
|
|
137
|
+
const admittedOptions = admitRequestOptions(options);
|
|
138
|
+
const expected = Object.freeze({
|
|
139
|
+
origin: admittedReference.origin,
|
|
140
|
+
revision: admittedReference.revision,
|
|
141
|
+
});
|
|
142
|
+
const result = await this.dispatcher.dispatch({ target: admittedReference.target, input }, admittedOptions, this.operation(admittedOptions), expected);
|
|
143
|
+
const narrowed = requireResultKind(admittedReference.outputMode, result);
|
|
144
|
+
return (narrowed.kind === 'value'
|
|
145
|
+
? narrowed.value
|
|
146
|
+
: narrowed.kind === 'stream'
|
|
147
|
+
? narrowed.stream
|
|
148
|
+
: narrowed.value);
|
|
149
|
+
}
|
|
150
|
+
async stream(call, options) {
|
|
151
|
+
const result = await this.dispatch(call, options);
|
|
152
|
+
return requireResultKind('stream', result).stream;
|
|
153
|
+
}
|
|
154
|
+
async binary(call, options) {
|
|
155
|
+
const result = await this.dispatch(call, options);
|
|
156
|
+
return requireResultKind('binary', result).value;
|
|
157
|
+
}
|
|
158
|
+
close() {
|
|
159
|
+
if (this.closed)
|
|
160
|
+
return;
|
|
161
|
+
this.closed = true;
|
|
162
|
+
this.lifecycle.abort(new SessionError('ClientSession is closed.', { failure: 'closed' }));
|
|
163
|
+
this.ownedPool?.close();
|
|
164
|
+
this.routes.clear();
|
|
165
|
+
this.discovery.clear();
|
|
166
|
+
}
|
|
167
|
+
requireOpen() {
|
|
168
|
+
if (this.closed)
|
|
169
|
+
throw new SessionError('ClientSession is closed.', { failure: 'closed' });
|
|
170
|
+
}
|
|
171
|
+
invokeDomainMethod(domain, node, method, input) {
|
|
172
|
+
const diagnostics = method.validateInput(input);
|
|
173
|
+
if (diagnostics.length > 0)
|
|
174
|
+
throw new TypeError(`Method ${method.key} input is invalid.`);
|
|
175
|
+
const owner = domain.closure.find(({ origin }) => origin === method.owner.ref.origin);
|
|
176
|
+
if (owner === undefined)
|
|
177
|
+
throw new TypeError(`Method owner ${method.owner.ref.origin} is absent.`);
|
|
178
|
+
return this.invoke({
|
|
179
|
+
origin: owner.origin,
|
|
180
|
+
revision: owner.revision,
|
|
181
|
+
callable: method.key,
|
|
182
|
+
target: Path.instanceMethod(Path.id(node.id), method.name),
|
|
183
|
+
outputMode: method.output.mode,
|
|
184
|
+
}, input);
|
|
185
|
+
}
|
|
186
|
+
operation(options) {
|
|
187
|
+
this.requireOpen();
|
|
188
|
+
return createSessionOperation(this.lifecycle.signal, options, this.timeoutMs);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
/** Open one caller-owned conversation with a Kernel using secure defaults. */
|
|
192
|
+
export function connect(options) {
|
|
193
|
+
if (options === null || typeof options !== 'object') {
|
|
194
|
+
throw new TypeError('Connect options are invalid.');
|
|
195
|
+
}
|
|
196
|
+
const { url, ...rest } = options;
|
|
197
|
+
return new ClientSession({
|
|
198
|
+
...rest,
|
|
199
|
+
kernel: url,
|
|
200
|
+
policy: options.policy ?? DEFAULT_SESSION_POLICY,
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
function admitClientPool(input) {
|
|
204
|
+
if (input === null ||
|
|
205
|
+
typeof input !== 'object' ||
|
|
206
|
+
typeof input.clientFor !== 'function') {
|
|
207
|
+
throw new TypeError('Session client pool capability is invalid.');
|
|
208
|
+
}
|
|
209
|
+
return Object.freeze({
|
|
210
|
+
clientFor: (target) => admitPooledClient(input.clientFor.call(input, target)),
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
function admitPooledClient(input) {
|
|
214
|
+
if (input === null ||
|
|
215
|
+
typeof input !== 'object' ||
|
|
216
|
+
typeof input.dispatch !== 'function' ||
|
|
217
|
+
typeof input.as !== 'function' ||
|
|
218
|
+
typeof input.close !== 'function') {
|
|
219
|
+
throw new TypeError('Session client pool capability returned an invalid Client.');
|
|
220
|
+
}
|
|
221
|
+
return input;
|
|
222
|
+
}
|
|
223
|
+
function defaultClientFactory(options) {
|
|
224
|
+
return (target) => {
|
|
225
|
+
switch (target.transport) {
|
|
226
|
+
case 'http':
|
|
227
|
+
return new Client({
|
|
228
|
+
transport: new HttpTransport({
|
|
229
|
+
url: target.url,
|
|
230
|
+
fetch: options.fetch,
|
|
231
|
+
timeoutMs: options.timeoutMs,
|
|
232
|
+
maximumResponseBytes: options.maximumResponseBytes,
|
|
233
|
+
}),
|
|
234
|
+
});
|
|
235
|
+
case 'websocket':
|
|
236
|
+
return new Client({
|
|
237
|
+
transport: new WebSocketTransport({
|
|
238
|
+
url: target.url,
|
|
239
|
+
timeoutMs: options.timeoutMs,
|
|
240
|
+
maximumResponseBytes: options.maximumResponseBytes,
|
|
241
|
+
...(options.websocket === undefined ? {} : { websocket: options.websocket }),
|
|
242
|
+
}),
|
|
243
|
+
});
|
|
244
|
+
case 'auto':
|
|
245
|
+
return new Client({
|
|
246
|
+
transport: new AutoTransport({
|
|
247
|
+
endpoints: target.endpoints,
|
|
248
|
+
fetch: options.fetch,
|
|
249
|
+
timeoutMs: options.timeoutMs,
|
|
250
|
+
maximumResponseBytes: options.maximumResponseBytes,
|
|
251
|
+
...(options.websocket === undefined ? {} : { websocket: options.websocket }),
|
|
252
|
+
...(options.onWarning === undefined ? {} : { onWarning: options.onWarning }),
|
|
253
|
+
}),
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { NodeId } from '@astrale-os/kernel-core/graph/node';
|
|
2
|
+
import { Path } from '@astrale-os/kernel-core/path';
|
|
3
|
+
import { defineSchema, method, nodeClass, schema } from '@astrale-os/kernel-dsl/v1';
|
|
4
|
+
import { ClientSession, reference } from './index.js';
|
|
5
|
+
void new ClientSession(options);
|
|
6
|
+
void auth;
|
|
7
|
+
void control;
|
|
8
|
+
void envelope;
|
|
9
|
+
void policy;
|
|
10
|
+
void request;
|
|
11
|
+
void snapshot;
|
|
12
|
+
const dynamicReference = reference(dynamicDomain, dynamicMethod)(Path.id(NodeId('dynamic-node')));
|
|
13
|
+
void session.invoke(dynamicReference, dynamicInput);
|
|
14
|
+
const dynamicInputIsClientInput = true;
|
|
15
|
+
const dynamicOutputIsUnknown = true;
|
|
16
|
+
void dynamicInputIsClientInput;
|
|
17
|
+
void dynamicOutputIsUnknown;
|
|
18
|
+
const abstractMethod = method({
|
|
19
|
+
auth: 'authenticated',
|
|
20
|
+
input: { type: 'null' },
|
|
21
|
+
output: { type: 'null' },
|
|
22
|
+
inheritance: 'abstract',
|
|
23
|
+
});
|
|
24
|
+
const abstractDomain = schema.resolve(defineSchema('client.reference.typecheck', {
|
|
25
|
+
classes: {
|
|
26
|
+
AbstractItem: nodeClass({ abstract: true, methods: { abstractMethod } }),
|
|
27
|
+
},
|
|
28
|
+
}));
|
|
29
|
+
// @ts-expect-error Abstract Methods are declarations and cannot become Client references.
|
|
30
|
+
reference(abstractDomain, abstractDomain.classes.AbstractItem.methods.abstractMethod);
|
|
31
|
+
void {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Key, bundle } from '@astrale-os/kernel-dsl/v1';
|
|
2
|
+
import type { publication } from '@astrale-os/kernel-protocol';
|
|
3
|
+
import { type ResolvedView } from '@astrale-os/kernel-core/schema/kernel/syscalls/view-resolution';
|
|
4
|
+
export type { ResolvedView } from '@astrale-os/kernel-core/schema/kernel/syscalls/view-resolution';
|
|
5
|
+
import type { SessionPolicy } from '../context/index.js';
|
|
6
|
+
/** One verified View declaration joined with its owning Publication and provenance. */
|
|
7
|
+
/** Immutable canonical-key-ordered inventory of Views resolved under one Session revision. */
|
|
8
|
+
export interface ViewCatalog {
|
|
9
|
+
readonly entrypoint?: ResolvedView;
|
|
10
|
+
readonly views: readonly ResolvedView[];
|
|
11
|
+
}
|
|
12
|
+
export declare function rootViewCatalog(publication: publication.Publication, artifact: bundle.Bundle, policy: Readonly<SessionPolicy>): ViewCatalog;
|
|
13
|
+
export declare function catalogFromKeys(root: ViewCatalog, keys: readonly Key.View[]): ViewCatalog;
|
|
14
|
+
/** Re-admit one Runtime-resolved heterogeneous View catalog at the Client trust boundary. */
|
|
15
|
+
export declare function targetViewCatalog(input: unknown, policy: Readonly<SessionPolicy>): ViewCatalog;
|