@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
package/dist/session/bound.js
CHANGED
|
@@ -1,42 +1,75 @@
|
|
|
1
1
|
import { createAuth } from '../auth/index.js';
|
|
2
|
+
import { call as createCall, } from '../client/index.js';
|
|
2
3
|
import { createGraph } from '../graph/index.js';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
return session.default;
|
|
26
|
-
},
|
|
27
|
-
get registry() {
|
|
28
|
-
return session.registry;
|
|
29
|
-
},
|
|
4
|
+
/** Capture one Session into the ordinary graph, auth, and invocation Kernel journey. */
|
|
5
|
+
export function bindSession(source, controls) {
|
|
6
|
+
if (source === null || typeof source !== 'object')
|
|
7
|
+
invalid();
|
|
8
|
+
const admittedControls = admitControls(controls);
|
|
9
|
+
const dispatchSource = capture(source, 'dispatch');
|
|
10
|
+
const callSource = capture(source, 'call');
|
|
11
|
+
const invokeSource = capture(source, 'invoke');
|
|
12
|
+
const streamSource = capture(source, 'stream');
|
|
13
|
+
const binarySource = capture(source, 'binary');
|
|
14
|
+
const installationSource = capture(source, 'installation');
|
|
15
|
+
const viewsForSource = capture(source, 'viewsFor');
|
|
16
|
+
const dispatch = (input, options) => dispatchSource(input, requestOptions(options, admittedControls));
|
|
17
|
+
const call = (input, options) => callSource(input, requestOptions(options, admittedControls));
|
|
18
|
+
const invoke = (reference, input, options) => invokeSource(reference, input, requestOptions(options, admittedControls));
|
|
19
|
+
const stream = (input, options) => streamSource(input, requestOptions(options, admittedControls));
|
|
20
|
+
const binary = (input, options) => binarySource(input, requestOptions(options, admittedControls));
|
|
21
|
+
const installation = (origin, options) => installationSource(origin, controlOptions(options, admittedControls));
|
|
22
|
+
const viewsFor = (target, options) => viewsForSource(target, controlOptions(options, admittedControls));
|
|
23
|
+
const graph = createGraph(call);
|
|
24
|
+
const auth = createAuth((target, input, options) => call(createCall(target, input), options));
|
|
25
|
+
return Object.freeze({
|
|
30
26
|
...graph,
|
|
27
|
+
kernel: source.kernel,
|
|
31
28
|
auth,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
};
|
|
40
|
-
|
|
29
|
+
dispatch,
|
|
30
|
+
call,
|
|
31
|
+
invoke,
|
|
32
|
+
stream,
|
|
33
|
+
binary,
|
|
34
|
+
installation,
|
|
35
|
+
viewsFor,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function admitControls(input) {
|
|
39
|
+
if (input === undefined)
|
|
40
|
+
return undefined;
|
|
41
|
+
if (input === null ||
|
|
42
|
+
typeof input !== 'object' ||
|
|
43
|
+
!(input.signal instanceof AbortSignal) ||
|
|
44
|
+
!Number.isFinite(input.deadline)) {
|
|
45
|
+
invalid();
|
|
46
|
+
}
|
|
47
|
+
return Object.freeze({ signal: input.signal, deadline: input.deadline });
|
|
48
|
+
}
|
|
49
|
+
function requestOptions(options, controls) {
|
|
50
|
+
return mergeOptions(options, controls);
|
|
51
|
+
}
|
|
52
|
+
function controlOptions(options, controls) {
|
|
53
|
+
return mergeOptions(options, controls);
|
|
54
|
+
}
|
|
55
|
+
function mergeOptions(options, controls) {
|
|
56
|
+
if (controls === undefined)
|
|
57
|
+
return options;
|
|
58
|
+
if (options?.signal !== undefined && options.signal !== controls.signal) {
|
|
59
|
+
throw new TypeError('Bound ClientSession cancellation cannot be replaced.');
|
|
60
|
+
}
|
|
61
|
+
if (controls.signal.aborted)
|
|
62
|
+
throw controls.signal.reason ?? new Error('Invocation cancelled.');
|
|
63
|
+
const remaining = Math.max(1, Math.ceil(controls.deadline - Date.now()));
|
|
64
|
+
const timeoutMs = options?.timeoutMs === undefined ? remaining : Math.min(options.timeoutMs, remaining);
|
|
65
|
+
return Object.freeze({ ...options, signal: controls.signal, timeoutMs });
|
|
66
|
+
}
|
|
67
|
+
function capture(source, key) {
|
|
68
|
+
const value = source[key];
|
|
69
|
+
if (typeof value !== 'function')
|
|
70
|
+
invalid();
|
|
71
|
+
return value.bind(source);
|
|
72
|
+
}
|
|
73
|
+
function invalid() {
|
|
74
|
+
throw new TypeError('Bound ClientSession source is invalid.');
|
|
41
75
|
}
|
|
42
|
-
//# sourceMappingURL=bound.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { platformDuration } from './limits.js';
|
|
2
|
+
export function admitControlOptions(input) {
|
|
3
|
+
if (input === undefined)
|
|
4
|
+
return Object.freeze({});
|
|
5
|
+
if (input === null || typeof input !== 'object' || Array.isArray(input)) {
|
|
6
|
+
throw new TypeError('Session control options are invalid.');
|
|
7
|
+
}
|
|
8
|
+
if (input.signal !== undefined && !(input.signal instanceof AbortSignal)) {
|
|
9
|
+
throw new TypeError('Session cancellation signal is invalid.');
|
|
10
|
+
}
|
|
11
|
+
return Object.freeze({
|
|
12
|
+
...(input.signal === undefined ? {} : { signal: input.signal }),
|
|
13
|
+
...(input.timeoutMs === undefined
|
|
14
|
+
? {}
|
|
15
|
+
: { timeoutMs: platformDuration(input.timeoutMs, 'timeoutMs') }),
|
|
16
|
+
});
|
|
17
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { admitControlOptions, type SessionControlOptions } from './control.js';
|
|
2
|
+
export { DEFAULT_MAXIMUM_BUNDLE_BYTES, DEFAULT_MAXIMUM_PUBLICATION_BYTES, DEFAULT_MAXIMUM_RESPONSE_BYTES, DEFAULT_MAXIMUM_ROUTES, DEFAULT_TIMEOUT_MS, platformDuration, positive, } from './limits.js';
|
|
3
|
+
export { createSessionOperation, runSessionOperation, sessionTransportOptions, type SessionOperation, } from './operation.js';
|
|
4
|
+
export { admitKernel, admitPolicy, allowEndpoint, kernelInvocationEndpoint, type SessionPolicy, } from './policy.js';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { admitControlOptions } from './control.js';
|
|
2
|
+
export { DEFAULT_MAXIMUM_BUNDLE_BYTES, DEFAULT_MAXIMUM_PUBLICATION_BYTES, DEFAULT_MAXIMUM_RESPONSE_BYTES, DEFAULT_MAXIMUM_ROUTES, DEFAULT_TIMEOUT_MS, platformDuration, positive, } from './limits.js';
|
|
3
|
+
export { createSessionOperation, runSessionOperation, sessionTransportOptions, } from './operation.js';
|
|
4
|
+
export { admitKernel, admitPolicy, allowEndpoint, kernelInvocationEndpoint, } from './policy.js';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const DEFAULT_MAXIMUM_PUBLICATION_BYTES: number;
|
|
2
|
+
export declare const DEFAULT_MAXIMUM_BUNDLE_BYTES: number;
|
|
3
|
+
export declare const DEFAULT_MAXIMUM_RESPONSE_BYTES: number;
|
|
4
|
+
export declare const DEFAULT_TIMEOUT_MS = 30000;
|
|
5
|
+
export declare const DEFAULT_MAXIMUM_ROUTES = 256;
|
|
6
|
+
export declare function positive(input: number, label: string): number;
|
|
7
|
+
export declare function platformDuration(input: number, label: string): number;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export const DEFAULT_MAXIMUM_PUBLICATION_BYTES = 1024 * 1024;
|
|
2
|
+
export const DEFAULT_MAXIMUM_BUNDLE_BYTES = 16 * 1024 * 1024;
|
|
3
|
+
export const DEFAULT_MAXIMUM_RESPONSE_BYTES = 16 * 1024 * 1024;
|
|
4
|
+
export const DEFAULT_TIMEOUT_MS = 30_000;
|
|
5
|
+
export const DEFAULT_MAXIMUM_ROUTES = 256;
|
|
6
|
+
export function positive(input, label) {
|
|
7
|
+
if (!Number.isSafeInteger(input) || input < 1) {
|
|
8
|
+
throw new TypeError(`${label} must be a positive safe integer.`);
|
|
9
|
+
}
|
|
10
|
+
return input;
|
|
11
|
+
}
|
|
12
|
+
export function platformDuration(input, label) {
|
|
13
|
+
const admitted = positive(input, label);
|
|
14
|
+
if (admitted > 2_147_483_647) {
|
|
15
|
+
throw new TypeError(`${label} exceeds the platform timer range.`);
|
|
16
|
+
}
|
|
17
|
+
return admitted;
|
|
18
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { RequestOptions } from '../../transport/index.js';
|
|
2
|
+
export interface SessionOperation {
|
|
3
|
+
readonly signal: AbortSignal;
|
|
4
|
+
readonly deadline: number;
|
|
5
|
+
readonly idempotencyKey?: RequestOptions['idempotencyKey'];
|
|
6
|
+
/** Atomically spend this operation's sole Stale-or-Miss source-resolution allowance. */
|
|
7
|
+
claimRecovery(): boolean;
|
|
8
|
+
}
|
|
9
|
+
/** Create one total wall-clock budget for a complete public Client Session operation. */
|
|
10
|
+
export declare function createSessionOperation(lifecycle: AbortSignal, input: {
|
|
11
|
+
readonly signal?: AbortSignal;
|
|
12
|
+
readonly timeoutMs?: number;
|
|
13
|
+
readonly idempotencyKey?: RequestOptions['idempotencyKey'];
|
|
14
|
+
} | undefined, defaultTimeoutMs: number): SessionOperation;
|
|
15
|
+
export declare function remainingSessionTime(operation: SessionOperation): number;
|
|
16
|
+
export declare function sessionTransportOptions(operation: SessionOperation, idempotencyKey?: RequestOptions['idempotencyKey']): RequestOptions;
|
|
17
|
+
/** Settle independently of a caller capability that ignores its supplied AbortSignal. */
|
|
18
|
+
export declare function runSessionOperation<Result>(operation: SessionOperation, task: (signal: AbortSignal) => Result | PromiseLike<Result>): Promise<Result>;
|
|
19
|
+
export declare function requireSessionOperation(operation: SessionOperation): void;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { SessionError } from '../../errors/index.js';
|
|
2
|
+
/** Create one total wall-clock budget for a complete public Client Session operation. */
|
|
3
|
+
export function createSessionOperation(lifecycle, input, defaultTimeoutMs) {
|
|
4
|
+
const timeoutMs = input?.timeoutMs ?? defaultTimeoutMs;
|
|
5
|
+
const deadline = Date.now() + timeoutMs;
|
|
6
|
+
const timeout = AbortSignal.timeout(timeoutMs);
|
|
7
|
+
const signals = input?.signal === undefined ? [lifecycle, timeout] : [input.signal, lifecycle, timeout];
|
|
8
|
+
let recoveryClaimed = false;
|
|
9
|
+
return Object.freeze({
|
|
10
|
+
signal: AbortSignal.any(signals),
|
|
11
|
+
deadline,
|
|
12
|
+
...(input?.idempotencyKey === undefined ? {} : { idempotencyKey: input.idempotencyKey }),
|
|
13
|
+
claimRecovery: () => {
|
|
14
|
+
if (recoveryClaimed)
|
|
15
|
+
return false;
|
|
16
|
+
recoveryClaimed = true;
|
|
17
|
+
return true;
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
export function remainingSessionTime(operation) {
|
|
22
|
+
requireSessionOperation(operation);
|
|
23
|
+
const remaining = operation.deadline - Date.now();
|
|
24
|
+
if (remaining < 1)
|
|
25
|
+
throw new SessionError('Session operation timed out.', { failure: 'timeout' });
|
|
26
|
+
return remaining;
|
|
27
|
+
}
|
|
28
|
+
export function sessionTransportOptions(operation, idempotencyKey) {
|
|
29
|
+
return Object.freeze({
|
|
30
|
+
signal: operation.signal,
|
|
31
|
+
timeoutMs: remainingSessionTime(operation),
|
|
32
|
+
...(idempotencyKey === undefined ? {} : { idempotencyKey }),
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
/** Settle independently of a caller capability that ignores its supplied AbortSignal. */
|
|
36
|
+
export async function runSessionOperation(operation, task) {
|
|
37
|
+
requireSessionOperation(operation);
|
|
38
|
+
let abort;
|
|
39
|
+
const interrupted = new Promise((_resolve, reject) => {
|
|
40
|
+
abort = () => reject(sessionInterruption(operation.signal.reason));
|
|
41
|
+
operation.signal.addEventListener('abort', abort, { once: true });
|
|
42
|
+
});
|
|
43
|
+
const execution = Promise.resolve().then(() => {
|
|
44
|
+
requireSessionOperation(operation);
|
|
45
|
+
return task(operation.signal);
|
|
46
|
+
});
|
|
47
|
+
return Promise.race([execution, interrupted])
|
|
48
|
+
.catch((cause) => {
|
|
49
|
+
if (operation.signal.aborted)
|
|
50
|
+
throw sessionInterruption(operation.signal.reason);
|
|
51
|
+
throw cause;
|
|
52
|
+
})
|
|
53
|
+
.finally(() => {
|
|
54
|
+
operation.signal.removeEventListener('abort', abort);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
export function requireSessionOperation(operation) {
|
|
58
|
+
if (!operation.signal.aborted)
|
|
59
|
+
return;
|
|
60
|
+
throw sessionInterruption(operation.signal.reason);
|
|
61
|
+
}
|
|
62
|
+
function sessionInterruption(reason) {
|
|
63
|
+
if (reason instanceof SessionError)
|
|
64
|
+
return reason;
|
|
65
|
+
if (reason instanceof DOMException && reason.name === 'TimeoutError') {
|
|
66
|
+
return new SessionError('Session operation timed out.', { cause: reason, failure: 'timeout' });
|
|
67
|
+
}
|
|
68
|
+
return new SessionError('Session operation was cancelled.', {
|
|
69
|
+
cause: reason,
|
|
70
|
+
failure: 'cancelled',
|
|
71
|
+
});
|
|
72
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type IssuerId } from '@astrale-os/kernel-core/auth/issuer';
|
|
2
|
+
export interface SessionPolicy {
|
|
3
|
+
readonly maximumRouteAgeMs: number;
|
|
4
|
+
readonly allowEndpoint?: (url: string) => boolean;
|
|
5
|
+
readonly allowInsecureHttp?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function admitPolicy(input: SessionPolicy): Readonly<SessionPolicy>;
|
|
8
|
+
export declare function admitKernel(input: string, insecure: boolean): IssuerId;
|
|
9
|
+
export declare function kernelInvocationEndpoint(input: IssuerId): string;
|
|
10
|
+
export declare function websocketEndpoint(input: string, insecure: boolean): string;
|
|
11
|
+
export declare function allowEndpoint(url: string, policy: Readonly<SessionPolicy>): void;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { accept as acceptIssuer } from '@astrale-os/kernel-core/auth/issuer';
|
|
2
|
+
import { ClientError } from '../../errors/index.js';
|
|
3
|
+
import { positive } from './limits.js';
|
|
4
|
+
export function admitPolicy(input) {
|
|
5
|
+
if (input === null || typeof input !== 'object') {
|
|
6
|
+
throw new TypeError('Session policy is invalid.');
|
|
7
|
+
}
|
|
8
|
+
if (input.allowEndpoint !== undefined && typeof input.allowEndpoint !== 'function') {
|
|
9
|
+
throw new TypeError('Session endpoint policy is invalid.');
|
|
10
|
+
}
|
|
11
|
+
if (input.allowInsecureHttp !== undefined && typeof input.allowInsecureHttp !== 'boolean') {
|
|
12
|
+
throw new TypeError('Session insecure-transport policy is invalid.');
|
|
13
|
+
}
|
|
14
|
+
return Object.freeze({
|
|
15
|
+
maximumRouteAgeMs: positive(input.maximumRouteAgeMs, 'maximumRouteAgeMs'),
|
|
16
|
+
...(input.allowEndpoint === undefined ? {} : { allowEndpoint: input.allowEndpoint }),
|
|
17
|
+
...(input.allowInsecureHttp === true ? { allowInsecureHttp: true } : {}),
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
export function admitKernel(input, insecure) {
|
|
21
|
+
let url;
|
|
22
|
+
let admitted;
|
|
23
|
+
try {
|
|
24
|
+
admitted = acceptIssuer(input);
|
|
25
|
+
url = new URL(admitted);
|
|
26
|
+
}
|
|
27
|
+
catch (cause) {
|
|
28
|
+
throw new TypeError('Session Kernel issuer is invalid.', { cause });
|
|
29
|
+
}
|
|
30
|
+
if (url.username !== '' ||
|
|
31
|
+
url.password !== '' ||
|
|
32
|
+
url.hash !== '' ||
|
|
33
|
+
url.search !== '' ||
|
|
34
|
+
(url.protocol !== 'https:' && !(insecure && url.protocol === 'http:'))) {
|
|
35
|
+
throw new TypeError('Session Kernel issuer is invalid.');
|
|
36
|
+
}
|
|
37
|
+
return admitted;
|
|
38
|
+
}
|
|
39
|
+
export function kernelInvocationEndpoint(input) {
|
|
40
|
+
return `${input}/invoke`;
|
|
41
|
+
}
|
|
42
|
+
export function websocketEndpoint(input, insecure) {
|
|
43
|
+
let url;
|
|
44
|
+
try {
|
|
45
|
+
url = new URL(input);
|
|
46
|
+
}
|
|
47
|
+
catch (cause) {
|
|
48
|
+
throw new TypeError('Session WebSocket endpoint is invalid.', { cause });
|
|
49
|
+
}
|
|
50
|
+
if (url.username !== '' ||
|
|
51
|
+
url.password !== '' ||
|
|
52
|
+
url.hash !== '' ||
|
|
53
|
+
(url.protocol !== 'wss:' && !(insecure && url.protocol === 'ws:'))) {
|
|
54
|
+
throw new TypeError('Session WebSocket endpoint is invalid.');
|
|
55
|
+
}
|
|
56
|
+
return url.toString();
|
|
57
|
+
}
|
|
58
|
+
export function allowEndpoint(url, policy) {
|
|
59
|
+
const parsed = new URL(url);
|
|
60
|
+
if (parsed.protocol !== 'https:' && parsed.protocol !== 'wss:') {
|
|
61
|
+
if ((parsed.protocol !== 'http:' && parsed.protocol !== 'ws:') ||
|
|
62
|
+
policy.allowInsecureHttp !== true) {
|
|
63
|
+
throw new ClientError('Insecure or unsupported endpoint is not allowed.');
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if (policy.allowEndpoint?.(parsed.toString()) === false) {
|
|
67
|
+
throw new ClientError('Endpoint is denied by Session policy.');
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { bundle } from '@astrale-os/kernel-dsl/v1';
|
|
2
|
+
import type { publication } from '@astrale-os/kernel-protocol';
|
|
3
|
+
import type { Fetch } from '../../transport/http/index.js';
|
|
4
|
+
import type { SessionOperation, SessionPolicy } from '../context/index.js';
|
|
5
|
+
export interface BundleDiscoveryOptions {
|
|
6
|
+
readonly fetch: Fetch;
|
|
7
|
+
readonly policy: Readonly<SessionPolicy>;
|
|
8
|
+
readonly maximumBytes: number;
|
|
9
|
+
}
|
|
10
|
+
export declare class BundleDiscovery {
|
|
11
|
+
private readonly options;
|
|
12
|
+
private readonly bundles;
|
|
13
|
+
constructor(options: BundleDiscoveryOptions);
|
|
14
|
+
get(publication: publication.Publication, operation: SessionOperation): Promise<bundle.Bundle>;
|
|
15
|
+
clear(): void;
|
|
16
|
+
private fetch;
|
|
17
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { decodeBundleValue } from '@astrale-os/kernel-protocol/publication/bundle';
|
|
2
|
+
import { ClientError } from '../../errors/index.js';
|
|
3
|
+
import { allowEndpoint } from '../context/index.js';
|
|
4
|
+
import { boundedResponse, requireExactResponse } from './publication.js';
|
|
5
|
+
import { runAcquisition } from './transport.js';
|
|
6
|
+
export class BundleDiscovery {
|
|
7
|
+
options;
|
|
8
|
+
bundles = new Map();
|
|
9
|
+
constructor(options) {
|
|
10
|
+
this.options = options;
|
|
11
|
+
}
|
|
12
|
+
async get(publication, operation) {
|
|
13
|
+
const key = bundleKey(publication);
|
|
14
|
+
const existing = this.bundles.get(key);
|
|
15
|
+
if (existing !== undefined)
|
|
16
|
+
return existing;
|
|
17
|
+
const discovered = await this.fetch(publication, operation);
|
|
18
|
+
const retained = this.bundles.get(key) ?? discovered;
|
|
19
|
+
this.bundles.set(key, retained);
|
|
20
|
+
return retained;
|
|
21
|
+
}
|
|
22
|
+
clear() {
|
|
23
|
+
this.bundles.clear();
|
|
24
|
+
}
|
|
25
|
+
async fetch(publication, operation) {
|
|
26
|
+
if (publication.schema.bundle.ref.size > this.options.maximumBytes) {
|
|
27
|
+
throw new ClientError('Bundle artifact exceeds its byte limit.');
|
|
28
|
+
}
|
|
29
|
+
const href = publication.schema.bundle.href;
|
|
30
|
+
allowEndpoint(href, this.options.policy);
|
|
31
|
+
const response = await runAcquisition(operation, 'bundle', 'unknown', 'Kernel bundle could not be retrieved.', (signal) => this.options.fetch(href, {
|
|
32
|
+
headers: { accept: publication.schema.bundle.ref.mediaType },
|
|
33
|
+
redirect: 'manual',
|
|
34
|
+
signal,
|
|
35
|
+
}));
|
|
36
|
+
requireExactResponse(response, href, 'Bundle retrieval');
|
|
37
|
+
if (!response.ok)
|
|
38
|
+
throw new ClientError(`Bundle retrieval returned HTTP ${response.status}.`);
|
|
39
|
+
if (response.headers.get('content-type') !== publication.schema.bundle.ref.mediaType) {
|
|
40
|
+
throw new ClientError('Bundle artifact media type differs from its descriptor.');
|
|
41
|
+
}
|
|
42
|
+
const etag = response.headers.get('etag');
|
|
43
|
+
if (etag !== null && etag !== `"${publication.schema.bundle.ref.digest}"`) {
|
|
44
|
+
throw new ClientError('Bundle response ETag differs from its descriptor.');
|
|
45
|
+
}
|
|
46
|
+
const bytes = await runAcquisition(operation, 'bundle', 'receive', 'Kernel bundle response could not be read.', (signal) => boundedResponse(response, publication.schema.bundle.ref.size, signal));
|
|
47
|
+
if (bytes.byteLength !== publication.schema.bundle.ref.size) {
|
|
48
|
+
throw new ClientError('Bundle artifact size differs from its descriptor.');
|
|
49
|
+
}
|
|
50
|
+
return decodeBundleValue(publication, bytes);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function bundleKey(publication) {
|
|
54
|
+
return `${new URL(publication.schema.bundle.href).origin}\u0000${publication.etag}`;
|
|
55
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { IssuerId } from '@astrale-os/kernel-core/auth/issuer';
|
|
2
|
+
import type { SessionOperation, SessionPolicy } from '../context/index.js';
|
|
3
|
+
import type { BundleDiscovery } from './bundle.js';
|
|
4
|
+
import type { PublicationDiscovery } from './publication.js';
|
|
5
|
+
import type { SessionSnapshot } from './snapshot.js';
|
|
6
|
+
export declare class SessionDiscovery {
|
|
7
|
+
readonly kernel: IssuerId;
|
|
8
|
+
private readonly policy;
|
|
9
|
+
private readonly publications;
|
|
10
|
+
private readonly bundles;
|
|
11
|
+
private readonly requireOpen;
|
|
12
|
+
private readonly acquisitionOperation;
|
|
13
|
+
private retained?;
|
|
14
|
+
private flight?;
|
|
15
|
+
constructor(kernel: IssuerId, policy: Readonly<SessionPolicy>, publications: PublicationDiscovery, bundles: BundleDiscovery, requireOpen: () => void, acquisitionOperation: () => SessionOperation);
|
|
16
|
+
snapshot(operation: SessionOperation): Promise<SessionSnapshot>;
|
|
17
|
+
clear(): void;
|
|
18
|
+
private acquireSnapshot;
|
|
19
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { runSessionOperation } from '../context/index.js';
|
|
2
|
+
import { rootViewCatalog } from '../views/index.js';
|
|
3
|
+
import { createSessionSnapshot } from './snapshot.js';
|
|
4
|
+
export class SessionDiscovery {
|
|
5
|
+
kernel;
|
|
6
|
+
policy;
|
|
7
|
+
publications;
|
|
8
|
+
bundles;
|
|
9
|
+
requireOpen;
|
|
10
|
+
acquisitionOperation;
|
|
11
|
+
retained;
|
|
12
|
+
flight;
|
|
13
|
+
constructor(kernel, policy, publications, bundles, requireOpen, acquisitionOperation) {
|
|
14
|
+
this.kernel = kernel;
|
|
15
|
+
this.policy = policy;
|
|
16
|
+
this.publications = publications;
|
|
17
|
+
this.bundles = bundles;
|
|
18
|
+
this.requireOpen = requireOpen;
|
|
19
|
+
this.acquisitionOperation = acquisitionOperation;
|
|
20
|
+
}
|
|
21
|
+
snapshot(operation) {
|
|
22
|
+
this.requireOpen();
|
|
23
|
+
const current = this.flight;
|
|
24
|
+
if (current !== undefined)
|
|
25
|
+
return runSessionOperation(operation, () => current);
|
|
26
|
+
const flight = this.acquireSnapshot(this.acquisitionOperation());
|
|
27
|
+
this.flight = flight;
|
|
28
|
+
void flight
|
|
29
|
+
.finally(() => {
|
|
30
|
+
if (this.flight === flight)
|
|
31
|
+
this.flight = undefined;
|
|
32
|
+
})
|
|
33
|
+
.catch(() => undefined);
|
|
34
|
+
return runSessionOperation(operation, () => flight);
|
|
35
|
+
}
|
|
36
|
+
clear() {
|
|
37
|
+
this.publications.invalidate();
|
|
38
|
+
this.bundles.clear();
|
|
39
|
+
this.retained = undefined;
|
|
40
|
+
}
|
|
41
|
+
async acquireSnapshot(operation) {
|
|
42
|
+
const previous = this.publications.current();
|
|
43
|
+
const publication = await this.publications.revalidate(operation);
|
|
44
|
+
if (previous !== undefined && previous.etag !== publication.etag)
|
|
45
|
+
this.bundles.clear();
|
|
46
|
+
const artifact = await this.bundles.get(publication, operation);
|
|
47
|
+
this.requireOpen();
|
|
48
|
+
if (this.retained?.publication.etag === publication.etag)
|
|
49
|
+
return this.retained;
|
|
50
|
+
const views = rootViewCatalog(publication, artifact, this.policy);
|
|
51
|
+
const snapshot = createSessionSnapshot(this.kernel, publication, artifact, views);
|
|
52
|
+
this.retained = snapshot;
|
|
53
|
+
return snapshot;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { IssuerId } from '@astrale-os/kernel-core/auth/issuer';
|
|
2
|
+
import type { Fetch } from '../../transport/http/index.js';
|
|
3
|
+
import type { SessionOperation, SessionPolicy } from '../context/index.js';
|
|
4
|
+
import type { SessionSnapshot } from './snapshot.js';
|
|
5
|
+
export type { SessionSnapshot } from './snapshot.js';
|
|
6
|
+
export interface SessionDiscovery {
|
|
7
|
+
readonly kernel: IssuerId;
|
|
8
|
+
snapshot(operation: SessionOperation): Promise<SessionSnapshot>;
|
|
9
|
+
clear(): void;
|
|
10
|
+
}
|
|
11
|
+
export interface SessionDiscoveryOptions {
|
|
12
|
+
readonly kernel: IssuerId;
|
|
13
|
+
readonly fetch: Fetch;
|
|
14
|
+
readonly policy: Readonly<SessionPolicy>;
|
|
15
|
+
readonly maximumPublicationBytes: number;
|
|
16
|
+
readonly maximumBundleBytes: number;
|
|
17
|
+
readonly requireOpen: () => void;
|
|
18
|
+
readonly acquisitionOperation: () => SessionOperation;
|
|
19
|
+
}
|
|
20
|
+
export declare function createSessionDiscovery(options: SessionDiscoveryOptions): SessionDiscovery;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BundleDiscovery } from './bundle.js';
|
|
2
|
+
import { SessionDiscovery as SessionDiscoveryImplementation } from './discovery.js';
|
|
3
|
+
import { PublicationDiscovery } from './publication.js';
|
|
4
|
+
export function createSessionDiscovery(options) {
|
|
5
|
+
return new SessionDiscoveryImplementation(options.kernel, options.policy, new PublicationDiscovery({
|
|
6
|
+
kernel: options.kernel,
|
|
7
|
+
fetch: options.fetch,
|
|
8
|
+
policy: options.policy,
|
|
9
|
+
maximumBytes: options.maximumPublicationBytes,
|
|
10
|
+
}), new BundleDiscovery({
|
|
11
|
+
fetch: options.fetch,
|
|
12
|
+
policy: options.policy,
|
|
13
|
+
maximumBytes: options.maximumBundleBytes,
|
|
14
|
+
}), options.requireOpen, options.acquisitionOperation);
|
|
15
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { IssuerId } from '@astrale-os/kernel-core/auth/issuer';
|
|
2
|
+
import type { publication } from '@astrale-os/kernel-protocol';
|
|
3
|
+
import type { Fetch } from '../../transport/http/index.js';
|
|
4
|
+
import type { SessionOperation } from '../context/index.js';
|
|
5
|
+
import { type SessionPolicy } from '../context/index.js';
|
|
6
|
+
export interface PublicationDiscoveryOptions {
|
|
7
|
+
readonly kernel: IssuerId;
|
|
8
|
+
readonly fetch: Fetch;
|
|
9
|
+
readonly policy: Readonly<SessionPolicy>;
|
|
10
|
+
readonly maximumBytes: number;
|
|
11
|
+
}
|
|
12
|
+
export declare class PublicationDiscovery {
|
|
13
|
+
private readonly options;
|
|
14
|
+
private publication;
|
|
15
|
+
private revision;
|
|
16
|
+
constructor(options: PublicationDiscoveryOptions);
|
|
17
|
+
current(): publication.Publication | undefined;
|
|
18
|
+
revalidate(operation: SessionOperation): Promise<publication.Publication>;
|
|
19
|
+
invalidate(): void;
|
|
20
|
+
private fetch;
|
|
21
|
+
}
|
|
22
|
+
export declare function boundedResponse(response: Response, maximum: number, signal: AbortSignal): Promise<Uint8Array>;
|
|
23
|
+
export declare function requireExactResponse(response: Response, expected: string, label: string): void;
|