@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,164 @@
|
|
|
1
|
+
import * as codecs from '@astrale-os/kernel-protocol/codecs';
|
|
2
|
+
import * as protocol from '@astrale-os/kernel-protocol/invocation';
|
|
3
|
+
import { ProtocolError, ResponseError, TransportError } from '../../errors/index.js';
|
|
4
|
+
import { invocationFailure } from '../failure.js';
|
|
5
|
+
import { asError, controlledSignal, positiveInteger, requireLive } from '../index.js';
|
|
6
|
+
import { WebSocketConnection } from './connection.js';
|
|
7
|
+
const DEFAULT_TIMEOUT_MS = 30_000;
|
|
8
|
+
const DEFAULT_MAXIMUM_REQUEST_BYTES = 16 * 1024 * 1024;
|
|
9
|
+
const DEFAULT_MAXIMUM_RESPONSE_BYTES = 16 * 1024 * 1024;
|
|
10
|
+
const DEFAULT_MAXIMUM_BUFFERED_BYTES = 16 * 1024 * 1024;
|
|
11
|
+
const DEFAULT_MAXIMUM_ACTIVE_INVOCATIONS = 1_024;
|
|
12
|
+
const DEFAULT_MAXIMUM_BUFFERED_STREAM_ITEMS = 256;
|
|
13
|
+
/** WebSocket implementation of the universal invocation protocol. */
|
|
14
|
+
export class WebSocketTransport {
|
|
15
|
+
url;
|
|
16
|
+
connectionUrl;
|
|
17
|
+
codecName;
|
|
18
|
+
WebSocketConstructor;
|
|
19
|
+
timeoutMs;
|
|
20
|
+
maximumRequestBytes;
|
|
21
|
+
maximumResponseBytes;
|
|
22
|
+
maximumBufferedBytes;
|
|
23
|
+
maximumActiveInvocations;
|
|
24
|
+
maximumBufferedStreamItems;
|
|
25
|
+
connections = new Set();
|
|
26
|
+
connectionOwner = Object.freeze({
|
|
27
|
+
closed: (connection) => this.connectionClosed(connection),
|
|
28
|
+
});
|
|
29
|
+
connection;
|
|
30
|
+
stopped = false;
|
|
31
|
+
nextId = 1;
|
|
32
|
+
constructor(options) {
|
|
33
|
+
if (options === null || typeof options !== 'object') {
|
|
34
|
+
throw new TypeError('WebSocketTransport options must be an object.');
|
|
35
|
+
}
|
|
36
|
+
this.url = normalizeUrl(options.url);
|
|
37
|
+
this.connectionUrl = this.url;
|
|
38
|
+
this.codecName = admitCodecName(options.codec);
|
|
39
|
+
this.WebSocketConstructor = admitWebSocket(options.websocket);
|
|
40
|
+
this.timeoutMs = positiveInteger(options.timeoutMs ?? DEFAULT_TIMEOUT_MS, 'timeoutMs');
|
|
41
|
+
this.maximumRequestBytes = positiveInteger(options.maximumRequestBytes ?? DEFAULT_MAXIMUM_REQUEST_BYTES, 'maximumRequestBytes');
|
|
42
|
+
this.maximumResponseBytes = positiveInteger(options.maximumResponseBytes ?? DEFAULT_MAXIMUM_RESPONSE_BYTES, 'maximumResponseBytes');
|
|
43
|
+
this.maximumBufferedBytes = positiveInteger(options.maximumBufferedBytes ?? DEFAULT_MAXIMUM_BUFFERED_BYTES, 'maximumBufferedBytes');
|
|
44
|
+
this.maximumActiveInvocations = positiveInteger(options.maximumActiveInvocations ?? DEFAULT_MAXIMUM_ACTIVE_INVOCATIONS, 'maximumActiveInvocations');
|
|
45
|
+
this.maximumBufferedStreamItems = positiveInteger(options.maximumBufferedStreamItems ?? DEFAULT_MAXIMUM_BUFFERED_STREAM_ITEMS, 'maximumBufferedStreamItems');
|
|
46
|
+
}
|
|
47
|
+
async dispatch(input, options = {}) {
|
|
48
|
+
if (this.stopped) {
|
|
49
|
+
throw invocationFailure('WebSocketTransport is closed.', 'closed');
|
|
50
|
+
}
|
|
51
|
+
const timeoutMs = positiveInteger(options.timeoutMs ?? this.timeoutMs, 'timeoutMs');
|
|
52
|
+
const codec = await this.codec();
|
|
53
|
+
if (this.stopped) {
|
|
54
|
+
throw invocationFailure('WebSocketTransport is closed.', 'closed');
|
|
55
|
+
}
|
|
56
|
+
const request = protocol.decodeRequest({
|
|
57
|
+
version: protocol.VERSION,
|
|
58
|
+
requestId: this.nextRequestId(),
|
|
59
|
+
...input,
|
|
60
|
+
...(options.idempotencyKey === undefined ? {} : { idempotencyKey: options.idempotencyKey }),
|
|
61
|
+
});
|
|
62
|
+
const control = controlledSignal(options.signal, timeoutMs);
|
|
63
|
+
let owned = false;
|
|
64
|
+
try {
|
|
65
|
+
requireLive(control);
|
|
66
|
+
const connection = await this.acquire(control, codec);
|
|
67
|
+
requireLive(control);
|
|
68
|
+
owned = true;
|
|
69
|
+
return await connection.dispatch(request, control, this.maximumBufferedStreamItems);
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
throw transportFailure(error, control, options.signal, timeoutMs, this.url);
|
|
73
|
+
}
|
|
74
|
+
finally {
|
|
75
|
+
if (!owned)
|
|
76
|
+
control.close();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/** Close the multiplexed connection, reject active exchanges, and reject future dispatches. */
|
|
80
|
+
close() {
|
|
81
|
+
if (this.stopped)
|
|
82
|
+
return;
|
|
83
|
+
this.stopped = true;
|
|
84
|
+
this.connection = undefined;
|
|
85
|
+
const failure = invocationFailure('WebSocketTransport is closed.', 'closed');
|
|
86
|
+
for (const connection of this.connections)
|
|
87
|
+
connection.shutdown(failure);
|
|
88
|
+
}
|
|
89
|
+
connectionClosed(connection) {
|
|
90
|
+
this.connections.delete(connection);
|
|
91
|
+
if (this.connection === connection)
|
|
92
|
+
this.connection = undefined;
|
|
93
|
+
}
|
|
94
|
+
async acquire(control, codec) {
|
|
95
|
+
let connection = this.connection;
|
|
96
|
+
if (connection === undefined || !connection.isAvailable) {
|
|
97
|
+
connection = new WebSocketConnection(this.connectionOwner, this.WebSocketConstructor, this.connectionUrl, codec, this.maximumRequestBytes, this.maximumResponseBytes, this.maximumBufferedBytes, this.maximumActiveInvocations);
|
|
98
|
+
this.connection = connection;
|
|
99
|
+
this.connections.add(connection);
|
|
100
|
+
}
|
|
101
|
+
await connection.connect(control);
|
|
102
|
+
return connection;
|
|
103
|
+
}
|
|
104
|
+
nextRequestId() {
|
|
105
|
+
const id = this.nextId;
|
|
106
|
+
this.nextId = id === Number.MAX_SAFE_INTEGER ? 1 : id + 1;
|
|
107
|
+
return id;
|
|
108
|
+
}
|
|
109
|
+
codec() {
|
|
110
|
+
return this.codecName === 'msgpack' ? codecs.loadMsgpack() : Promise.resolve(codecs.json);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
function normalizeUrl(input) {
|
|
114
|
+
if (typeof input !== 'string')
|
|
115
|
+
throw new TypeError('server URL must be a string.');
|
|
116
|
+
let parsed;
|
|
117
|
+
try {
|
|
118
|
+
parsed = new URL(input);
|
|
119
|
+
}
|
|
120
|
+
catch (error) {
|
|
121
|
+
throw new TypeError(`Invalid server URL ${JSON.stringify(input)}.`, { cause: asError(error) });
|
|
122
|
+
}
|
|
123
|
+
if (parsed.protocol === 'http:')
|
|
124
|
+
parsed.protocol = 'ws:';
|
|
125
|
+
else if (parsed.protocol === 'https:')
|
|
126
|
+
parsed.protocol = 'wss:';
|
|
127
|
+
else if (parsed.protocol !== 'ws:' && parsed.protocol !== 'wss:') {
|
|
128
|
+
throw new TypeError('server URL must use http, https, ws, or wss.');
|
|
129
|
+
}
|
|
130
|
+
if (parsed.username !== '' || parsed.password !== '' || parsed.hash !== '') {
|
|
131
|
+
throw new TypeError('server URL cannot contain credentials or a fragment.');
|
|
132
|
+
}
|
|
133
|
+
return parsed.toString();
|
|
134
|
+
}
|
|
135
|
+
function admitCodecName(input) {
|
|
136
|
+
if (input === undefined || input === 'json')
|
|
137
|
+
return 'json';
|
|
138
|
+
if (input === 'msgpack')
|
|
139
|
+
return input;
|
|
140
|
+
throw new TypeError('codec must be "json" or "msgpack".');
|
|
141
|
+
}
|
|
142
|
+
function admitWebSocket(input) {
|
|
143
|
+
const implementation = input ?? globalThis.WebSocket;
|
|
144
|
+
if (typeof implementation !== 'function') {
|
|
145
|
+
throw new TypeError('WebSocketTransport requires a WebSocket implementation.');
|
|
146
|
+
}
|
|
147
|
+
return implementation;
|
|
148
|
+
}
|
|
149
|
+
function transportFailure(input, control, parent, timeoutMs, url) {
|
|
150
|
+
if (input instanceof ResponseError || input instanceof ProtocolError)
|
|
151
|
+
return input;
|
|
152
|
+
if (input instanceof TransportError)
|
|
153
|
+
return input;
|
|
154
|
+
if (control.timedOut) {
|
|
155
|
+
return invocationFailure(`WebSocket invocation timed out after ${timeoutMs}ms.`, 'timeout', {
|
|
156
|
+
cause: asError(input),
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
if (parent?.aborted)
|
|
160
|
+
return asError(parent.reason ?? input);
|
|
161
|
+
return invocationFailure(`Failed to communicate with the server at ${url}.`, 'connect', {
|
|
162
|
+
cause: asError(input),
|
|
163
|
+
});
|
|
164
|
+
}
|
package/package.json
CHANGED
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrale-os/kernel-client",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.6.0-beta.10",
|
|
4
|
+
"description": "Universal Client — protocol-first, transport-agnostic",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"astrale",
|
|
7
7
|
"client",
|
|
8
|
-
"
|
|
8
|
+
"protocol",
|
|
9
9
|
"sdk",
|
|
10
10
|
"webos"
|
|
11
11
|
],
|
|
12
12
|
"license": "Apache-2.0",
|
|
13
13
|
"author": "Astrale",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/astrale-os/kernel.git",
|
|
17
|
+
"directory": "client"
|
|
18
|
+
},
|
|
14
19
|
"files": [
|
|
15
20
|
"dist"
|
|
16
21
|
],
|
|
@@ -22,65 +27,66 @@
|
|
|
22
27
|
"types": "./dist/index.d.ts",
|
|
23
28
|
"import": "./dist/index.js"
|
|
24
29
|
},
|
|
25
|
-
"./
|
|
26
|
-
"types": "./dist/
|
|
27
|
-
"import": "./dist/
|
|
30
|
+
"./auth": {
|
|
31
|
+
"types": "./dist/auth/index.d.ts",
|
|
32
|
+
"import": "./dist/auth/index.js"
|
|
33
|
+
},
|
|
34
|
+
"./errors": {
|
|
35
|
+
"types": "./dist/errors/index.d.ts",
|
|
36
|
+
"import": "./dist/errors/index.js"
|
|
37
|
+
},
|
|
38
|
+
"./graph": {
|
|
39
|
+
"types": "./dist/graph/index.d.ts",
|
|
40
|
+
"import": "./dist/graph/index.js"
|
|
28
41
|
},
|
|
29
42
|
"./schema": {
|
|
30
43
|
"types": "./dist/schema/index.d.ts",
|
|
31
44
|
"import": "./dist/schema/index.js"
|
|
32
45
|
},
|
|
33
|
-
"./pool": {
|
|
34
|
-
"types": "./dist/pool/index.d.ts",
|
|
35
|
-
"import": "./dist/pool/index.js"
|
|
36
|
-
},
|
|
37
46
|
"./session": {
|
|
38
47
|
"types": "./dist/session/index.d.ts",
|
|
39
48
|
"import": "./dist/session/index.js"
|
|
40
49
|
},
|
|
41
|
-
"./
|
|
42
|
-
"types": "./dist/
|
|
43
|
-
"import": "./dist/
|
|
50
|
+
"./pacer": {
|
|
51
|
+
"types": "./dist/pacer/index.d.ts",
|
|
52
|
+
"import": "./dist/pacer/index.js"
|
|
53
|
+
},
|
|
54
|
+
"./pool": {
|
|
55
|
+
"types": "./dist/pool/index.d.ts",
|
|
56
|
+
"import": "./dist/pool/index.js"
|
|
44
57
|
},
|
|
45
58
|
"./store": {
|
|
46
59
|
"types": "./dist/store/index.d.ts",
|
|
47
60
|
"import": "./dist/store/index.js"
|
|
48
61
|
},
|
|
49
|
-
"./auth": {
|
|
50
|
-
"types": "./dist/auth/index.d.ts",
|
|
51
|
-
"import": "./dist/auth/index.js"
|
|
52
|
-
},
|
|
53
62
|
"./package.json": "./package.json"
|
|
54
63
|
},
|
|
55
64
|
"publishConfig": {
|
|
56
65
|
"access": "public"
|
|
57
66
|
},
|
|
58
67
|
"dependencies": {
|
|
59
|
-
"@
|
|
60
|
-
"
|
|
61
|
-
"@astrale-os/kernel-
|
|
62
|
-
"@
|
|
63
|
-
"
|
|
68
|
+
"@astrale-os/kernel-core": ">=0.9.0-beta.9 <1.0.0",
|
|
69
|
+
"@astrale-os/kernel-dsl": ">=0.2.0-beta.7 <1.0.0",
|
|
70
|
+
"@astrale-os/kernel-protocol": ">=0.5.0-beta.9 <1.0.0",
|
|
71
|
+
"@tanstack/pacer": "0.20.1",
|
|
72
|
+
"msgpackr": "^2.0.5"
|
|
64
73
|
},
|
|
65
74
|
"devDependencies": {
|
|
75
|
+
"@astrale-os/kernel-server": ">=0.5.0-beta.10 <1.0.0",
|
|
66
76
|
"@astrale/typescript-config": "npm:@jsr/astrale__typescript-config@~1.1.0",
|
|
67
|
-
"@hono/node-server": "^1.19.9",
|
|
68
|
-
"@hono/node-ws": "^1.3.0",
|
|
69
77
|
"@types/node": "^22.0.0",
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"hono": "^4.6.20",
|
|
73
|
-
"typescript": "~6.0.1-rc",
|
|
74
|
-
"vitest": "^3.1.4",
|
|
75
|
-
"ws": "^8.18.0",
|
|
76
|
-
"zod": "^4.3.6",
|
|
77
|
-
"@astrale-os/kernel-server": "^0.4.17"
|
|
78
|
+
"typescript": "7.0.2",
|
|
79
|
+
"vitest": "^4.1.10"
|
|
78
80
|
},
|
|
79
81
|
"scripts": {
|
|
80
|
-
"build": "
|
|
81
|
-
"dev": "
|
|
82
|
-
"typecheck": "
|
|
82
|
+
"build": "tsc",
|
|
83
|
+
"dev": "tsc --watch",
|
|
84
|
+
"typecheck": "tsc --noEmit",
|
|
83
85
|
"test": "vitest run",
|
|
86
|
+
"test:boundary:protocol": "vitest run --config vitest.protocol-boundary.config.ts",
|
|
87
|
+
"test:boundary:server": "vitest run --config vitest.server-boundary.config.ts",
|
|
88
|
+
"test:file": "vitest run",
|
|
89
|
+
"test:package": "node scripts/verify-packed-package.mjs",
|
|
84
90
|
"test:watch": "vitest",
|
|
85
91
|
"clean": "rm -rf dist",
|
|
86
92
|
"preinstall": "node -e \"try{require('./.check-workspace.cjs')}catch{}\""
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Addressing for the auth surface — the one place a syscall address is formed.
|
|
3
|
-
* Method slugs and the static `whoami` path derive from `K.Identity.*`
|
|
4
|
-
* accessors, so a kernel schema rename breaks at compile time (the property
|
|
5
|
-
* access) instead of failing silently at dispatch.
|
|
6
|
-
*/
|
|
7
|
-
/** AuthApi verb → the K-derived Identity method slug it dispatches. */
|
|
8
|
-
export declare const IDENTITY_METHOD: {
|
|
9
|
-
readonly mint: string;
|
|
10
|
-
readonly delegate: string;
|
|
11
|
-
readonly check: string;
|
|
12
|
-
readonly grant: string;
|
|
13
|
-
readonly revoke: string;
|
|
14
|
-
readonly extend: string;
|
|
15
|
-
readonly constrain: string;
|
|
16
|
-
readonly exclude: string;
|
|
17
|
-
readonly removeExtension: string;
|
|
18
|
-
readonly removeConstraint: string;
|
|
19
|
-
readonly removeExclusion: string;
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* Static dispatch path of `Identity.whoami` — the layout-independent MethodPath
|
|
23
|
-
* (`/:kernel.astrale.ai:interface.Identity:whoami`). The one static syscall.
|
|
24
|
-
*/
|
|
25
|
-
export declare const WHOAMI_PATH: string;
|
|
26
|
-
/**
|
|
27
|
-
* Format an `InstanceMethodPath` (`<base>::<slug>`) for a syscall dispatched at
|
|
28
|
-
* one identity node. `idOrPath` is already-raw; a leading `/` or `@` is used
|
|
29
|
-
* verbatim, a bare id gets the `@` prefix — never a double `@`.
|
|
30
|
-
*/
|
|
31
|
-
export declare function instanceTarget(idOrPath: string, slug: string): string;
|
|
32
|
-
//# sourceMappingURL=addressing.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"addressing.d.ts","sourceRoot":"","sources":["../../src/auth/addressing.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,uEAAuE;AACvE,eAAO,MAAM,eAAe;aAC1B,IAAI;aACJ,QAAQ;aACR,KAAK;aACL,KAAK;aACL,MAAM;aACN,MAAM;aACN,SAAS;aACT,OAAO;aACP,eAAe;aACf,gBAAgB;aAChB,eAAe;CACP,CAAA;AAEV;;;GAGG;AACH,eAAO,MAAM,WAAW,EAAE,MAA0C,CAAA;AAEpE;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAGrE"}
|
package/dist/auth/addressing.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Addressing for the auth surface — the one place a syscall address is formed.
|
|
3
|
-
* Method slugs and the static `whoami` path derive from `K.Identity.*`
|
|
4
|
-
* accessors, so a kernel schema rename breaks at compile time (the property
|
|
5
|
-
* access) instead of failing silently at dispatch.
|
|
6
|
-
*/
|
|
7
|
-
import { K } from '@astrale-os/kernel-core';
|
|
8
|
-
/** AuthApi verb → the K-derived Identity method slug it dispatches. */
|
|
9
|
-
export const IDENTITY_METHOD = {
|
|
10
|
-
mint: K.Identity.mintIdentityCredential.path.method.method,
|
|
11
|
-
delegate: K.Identity.mintDelegationCredential.path.method.method,
|
|
12
|
-
check: K.Identity.checkPerm.path.method.method,
|
|
13
|
-
grant: K.Identity.grantPerm.path.method.method,
|
|
14
|
-
revoke: K.Identity.revokePerm.path.method.method,
|
|
15
|
-
extend: K.Identity.extendIdentity.path.method.method,
|
|
16
|
-
constrain: K.Identity.constrainIdentity.path.method.method,
|
|
17
|
-
exclude: K.Identity.excludeIdentity.path.method.method,
|
|
18
|
-
removeExtension: K.Identity.removeExtension.path.method.method,
|
|
19
|
-
removeConstraint: K.Identity.removeConstraint.path.method.method,
|
|
20
|
-
removeExclusion: K.Identity.removeExclusion.path.method.method,
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* Static dispatch path of `Identity.whoami` — the layout-independent MethodPath
|
|
24
|
-
* (`/:kernel.astrale.ai:interface.Identity:whoami`). The one static syscall.
|
|
25
|
-
*/
|
|
26
|
-
export const WHOAMI_PATH = K.Identity.whoami.path.method.raw;
|
|
27
|
-
/**
|
|
28
|
-
* Format an `InstanceMethodPath` (`<base>::<slug>`) for a syscall dispatched at
|
|
29
|
-
* one identity node. `idOrPath` is already-raw; a leading `/` or `@` is used
|
|
30
|
-
* verbatim, a bare id gets the `@` prefix — never a double `@`.
|
|
31
|
-
*/
|
|
32
|
-
export function instanceTarget(idOrPath, slug) {
|
|
33
|
-
const base = idOrPath.startsWith('/') || idOrPath.startsWith('@') ? idOrPath : `@${idOrPath}`;
|
|
34
|
-
return `${base}::${slug}`;
|
|
35
|
-
}
|
|
36
|
-
//# sourceMappingURL=addressing.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"addressing.js","sourceRoot":"","sources":["../../src/auth/addressing.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,yBAAyB,CAAA;AAE3C,uEAAuE;AACvE,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,sBAAsB,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM;IAC1D,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,wBAAwB,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM;IAChE,KAAK,EAAE,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM;IAC9C,KAAK,EAAE,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM;IAC9C,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM;IAChD,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM;IACpD,SAAS,EAAE,CAAC,CAAC,QAAQ,CAAC,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM;IAC1D,OAAO,EAAE,CAAC,CAAC,QAAQ,CAAC,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM;IACtD,eAAe,EAAE,CAAC,CAAC,QAAQ,CAAC,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM;IAC9D,gBAAgB,EAAE,CAAC,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM;IAChE,eAAe,EAAE,CAAC,CAAC,QAAQ,CAAC,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM;CACtD,CAAA;AAEV;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAW,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAA;AAEpE;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,QAAgB,EAAE,IAAY;IAC3D,MAAM,IAAI,GAAG,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,QAAQ,EAAE,CAAA;IAC7F,OAAO,GAAG,IAAI,KAAK,IAAI,EAAE,CAAA;AAC3B,CAAC"}
|
package/dist/auth/api.d.ts
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The `AuthApi` surface and its one implementation, `createAuth` — the control
|
|
3
|
-
* plane of a bound session view, over the same {@link GraphCall} capability as
|
|
4
|
-
* `graph/`. Instance-dispatched verbs target the counterparty identity
|
|
5
|
-
* (`@<id>::<slug>`); `whoami` is the one static syscall. `createAuth` is thin:
|
|
6
|
-
* it wires the verb modules over one caller resolver.
|
|
7
|
-
*/
|
|
8
|
-
import type { CredentialInput, Node } from '@astrale-os/kernel-core';
|
|
9
|
-
import type { GraphCall } from '../graph/index.js';
|
|
10
|
-
import type { Composition } from './composition.js';
|
|
11
|
-
import type { DelegateOpts, MintOpts } from './minting.js';
|
|
12
|
-
import type { CheckInput, GrantInput, RevokeInput } from './permissions.js';
|
|
13
|
-
import type { AuthShorthands } from './shorthands.js';
|
|
14
|
-
/**
|
|
15
|
-
* Control-plane surface of a bound session view. All calls dispatch with the
|
|
16
|
-
* view's credential.
|
|
17
|
-
*/
|
|
18
|
-
export interface AuthApi extends AuthShorthands {
|
|
19
|
-
/** The authenticated caller's identity node. Always a live syscall — never cached. */
|
|
20
|
-
whoami(): Promise<Node>;
|
|
21
|
-
/**
|
|
22
|
-
* The credential this view currently dispatches with — resolved fresh per
|
|
23
|
-
* call, so never cache the return.
|
|
24
|
-
*/
|
|
25
|
-
credential(): CredentialInput;
|
|
26
|
-
/**
|
|
27
|
-
* Mint a single-layer identity credential for {@link MintOpts.subject}
|
|
28
|
-
* (default: the memoized principal). (syscall: mintIdentityCredential)
|
|
29
|
-
*/
|
|
30
|
-
mint(opts?: MintOpts): Promise<string>;
|
|
31
|
-
/**
|
|
32
|
-
* Mint a two-layer delegation credential — always as self (no subject param).
|
|
33
|
-
* {@link DelegateOpts.delegation} defaults to `{ kind: 'identity', self: true }`.
|
|
34
|
-
* (syscall: mintDelegationCredential)
|
|
35
|
-
*/
|
|
36
|
-
delegate(opts?: DelegateOpts): Promise<string>;
|
|
37
|
-
/**
|
|
38
|
-
* Does `who` (default: self) hold `perms` on `on` by its own STANDING grant
|
|
39
|
-
* edges — "does this identity hold X", not "would the current (maybe narrowed)
|
|
40
|
-
* token pass". Batch: array in → positionally-aligned `boolean[]`.
|
|
41
|
-
*/
|
|
42
|
-
check(q: CheckInput): Promise<boolean>;
|
|
43
|
-
check(q: readonly CheckInput[]): Promise<boolean[]>;
|
|
44
|
-
/**
|
|
45
|
-
* Grant `perms` to `to` on `on` (and its subtree). ⚠ SETS the has_perm bits —
|
|
46
|
-
* does NOT OR; re-granting with fewer bits downgrades. Batch: set semantics,
|
|
47
|
-
* not a transaction — a failure throws `AuthBatchError` with per-entry outcomes.
|
|
48
|
-
*/
|
|
49
|
-
grant(g: GrantInput): Promise<void>;
|
|
50
|
-
grant(g: readonly GrantInput[]): Promise<void>;
|
|
51
|
-
/** Remove `perms` from `from` on `on`. Batch semantics mirror {@link grant}. */
|
|
52
|
-
revoke(r: RevokeInput): Promise<void>;
|
|
53
|
-
revoke(r: readonly RevokeInput[]): Promise<void>;
|
|
54
|
-
/**
|
|
55
|
-
* Attach the described composition edges to `who` (default: self). Fields fan
|
|
56
|
-
* out; an empty record is a resolved no-op. On any entry failure throws
|
|
57
|
-
* `AuthBatchError` with per-entry outcomes.
|
|
58
|
-
*/
|
|
59
|
-
bind(c: Composition): Promise<void>;
|
|
60
|
-
/** Detach the described composition edges — the exact mirror of {@link bind}. */
|
|
61
|
-
unbind(c: Composition): Promise<void>;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Bind the auth surface onto a call capability and a credential thunk. One caller
|
|
65
|
-
* resolver (whoami + principal memo) fans into the verb modules.
|
|
66
|
-
*/
|
|
67
|
-
export declare function createAuth(call: GraphCall, opts: {
|
|
68
|
-
credential: () => CredentialInput;
|
|
69
|
-
}): AuthApi;
|
|
70
|
-
//# sourceMappingURL=api.d.ts.map
|
package/dist/auth/api.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/auth/api.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAA;AAEpE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAQrD;;;GAGG;AACH,MAAM,WAAW,OAAQ,SAAQ,cAAc;IAE7C,sFAAsF;IACtF,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IAGvB;;;OAGG;IACH,UAAU,IAAI,eAAe,CAAA;IAC7B;;;OAGG;IACH,IAAI,CAAC,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IACtC;;;;OAIG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IAG9C;;;;OAIG;IACH,KAAK,CAAC,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IACtC,KAAK,CAAC,CAAC,EAAE,SAAS,UAAU,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAAA;IACnD;;;;OAIG;IACH,KAAK,CAAC,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACnC,KAAK,CAAC,CAAC,EAAE,SAAS,UAAU,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC9C,gFAAgF;IAChF,MAAM,CAAC,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACrC,MAAM,CAAC,CAAC,EAAE,SAAS,WAAW,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAGhD;;;;OAIG;IACH,IAAI,CAAC,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACnC,iFAAiF;IACjF,MAAM,CAAC,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACtC;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE;IAAE,UAAU,EAAE,MAAM,eAAe,CAAA;CAAE,GAAG,OAAO,CAoBhG"}
|
package/dist/auth/api.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The `AuthApi` surface and its one implementation, `createAuth` — the control
|
|
3
|
-
* plane of a bound session view, over the same {@link GraphCall} capability as
|
|
4
|
-
* `graph/`. Instance-dispatched verbs target the counterparty identity
|
|
5
|
-
* (`@<id>::<slug>`); `whoami` is the one static syscall. `createAuth` is thin:
|
|
6
|
-
* it wires the verb modules over one caller resolver.
|
|
7
|
-
*/
|
|
8
|
-
import { createComposition } from './composition.js';
|
|
9
|
-
import { createMinting } from './minting.js';
|
|
10
|
-
import { createPermissions } from './permissions.js';
|
|
11
|
-
import { createCaller } from './principal.js';
|
|
12
|
-
import { makeAuthShorthands } from './shorthands.js';
|
|
13
|
-
/**
|
|
14
|
-
* Bind the auth surface onto a call capability and a credential thunk. One caller
|
|
15
|
-
* resolver (whoami + principal memo) fans into the verb modules.
|
|
16
|
-
*/
|
|
17
|
-
export function createAuth(call, opts) {
|
|
18
|
-
const caller = createCaller(call);
|
|
19
|
-
const { mint, delegate } = createMinting(call, caller);
|
|
20
|
-
const { check, grant, revoke } = createPermissions(call, caller);
|
|
21
|
-
const { bind, unbind } = createComposition(call, caller);
|
|
22
|
-
const credential = () => opts.credential();
|
|
23
|
-
return {
|
|
24
|
-
whoami: caller.whoami,
|
|
25
|
-
credential,
|
|
26
|
-
mint,
|
|
27
|
-
delegate,
|
|
28
|
-
check,
|
|
29
|
-
grant,
|
|
30
|
-
revoke,
|
|
31
|
-
bind,
|
|
32
|
-
unbind,
|
|
33
|
-
...makeAuthShorthands(check),
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
//# sourceMappingURL=api.js.map
|
package/dist/auth/api.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/auth/api.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAUH,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AA2DpD;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,IAAe,EAAE,IAA2C;IACrF,MAAM,MAAM,GAAG,YAAY,CAAC,IAAI,CAAC,CAAA;IACjC,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,aAAa,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;IACtD,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,iBAAiB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;IAChE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,iBAAiB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;IAExD,MAAM,UAAU,GAAG,GAAoB,EAAE,CAAC,IAAI,CAAC,UAAU,EAAE,CAAA;IAE3D,OAAO;QACL,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,UAAU;QACV,IAAI;QACJ,QAAQ;QACR,KAAK;QACL,KAAK;QACL,MAAM;QACN,IAAI;QACJ,MAAM;QACN,GAAG,kBAAkB,CAAC,KAAK,CAAC;KAC7B,CAAA;AACH,CAAC"}
|
package/dist/auth/batch.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Batch fan-out for the auth surface. Set semantics, not a transaction: entries
|
|
3
|
-
* dispatch in PARALLEL and partial application is possible, so a failure
|
|
4
|
-
* surfaces every entry's outcome through {@link AuthBatchError}.
|
|
5
|
-
*/
|
|
6
|
-
/** One unit of a fan-out: a summary of the entry plus the dispatch that runs it. */
|
|
7
|
-
export interface BatchEntry<T> {
|
|
8
|
-
/** Caller-legible summary of this entry (goes into {@link AuthBatchOutcome.input}). */
|
|
9
|
-
readonly input: unknown;
|
|
10
|
-
run(): Promise<T>;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Run every entry in parallel; resolve to the results positionally aligned with
|
|
14
|
-
* `entries`, or throw {@link AuthBatchError} carrying all outcomes if any
|
|
15
|
-
* rejected. Zero entries ⇒ zero dispatches, resolves to `[]` (the no-op case).
|
|
16
|
-
*/
|
|
17
|
-
export declare function settleAll<T>(operation: string, entries: readonly BatchEntry<T>[]): Promise<T[]>;
|
|
18
|
-
//# sourceMappingURL=batch.d.ts.map
|
package/dist/auth/batch.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"batch.d.ts","sourceRoot":"","sources":["../../src/auth/batch.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,oFAAoF;AACpF,MAAM,WAAW,UAAU,CAAC,CAAC;IAC3B,uFAAuF;IACvF,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;IACvB,GAAG,IAAI,OAAO,CAAC,CAAC,CAAC,CAAA;CAClB;AAED;;;;GAIG;AACH,wBAAsB,SAAS,CAAC,CAAC,EAC/B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,SAAS,UAAU,CAAC,CAAC,CAAC,EAAE,GAChC,OAAO,CAAC,CAAC,EAAE,CAAC,CAed"}
|
package/dist/auth/batch.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Batch fan-out for the auth surface. Set semantics, not a transaction: entries
|
|
3
|
-
* dispatch in PARALLEL and partial application is possible, so a failure
|
|
4
|
-
* surfaces every entry's outcome through {@link AuthBatchError}.
|
|
5
|
-
*/
|
|
6
|
-
import { AuthBatchError } from '../errors/errors.js';
|
|
7
|
-
/**
|
|
8
|
-
* Run every entry in parallel; resolve to the results positionally aligned with
|
|
9
|
-
* `entries`, or throw {@link AuthBatchError} carrying all outcomes if any
|
|
10
|
-
* rejected. Zero entries ⇒ zero dispatches, resolves to `[]` (the no-op case).
|
|
11
|
-
*/
|
|
12
|
-
export async function settleAll(operation, entries) {
|
|
13
|
-
const settled = await Promise.allSettled(entries.map((e) => e.run()));
|
|
14
|
-
const outcomes = settled.map((result, index) => ({
|
|
15
|
-
index,
|
|
16
|
-
input: entries[index].input,
|
|
17
|
-
status: result.status,
|
|
18
|
-
...(result.status === 'fulfilled' ? { value: result.value } : { error: result.reason }),
|
|
19
|
-
}));
|
|
20
|
-
if (outcomes.some((o) => o.status === 'rejected')) {
|
|
21
|
-
throw new AuthBatchError(operation, outcomes);
|
|
22
|
-
}
|
|
23
|
-
return settled.map((r) => r.value);
|
|
24
|
-
}
|
|
25
|
-
//# sourceMappingURL=batch.js.map
|
package/dist/auth/batch.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"batch.js","sourceRoot":"","sources":["../../src/auth/batch.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AASpD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,SAAiB,EACjB,OAAiC;IAEjC,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAA;IAErE,MAAM,QAAQ,GAAuB,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;QACnE,KAAK;QACL,KAAK,EAAE,OAAO,CAAC,KAAK,CAAE,CAAC,KAAK;QAC5B,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,GAAG,CAAC,MAAM,CAAC,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC;KACxF,CAAC,CAAC,CAAA;IAEH,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,UAAU,CAAC,EAAE,CAAC;QAClD,MAAM,IAAI,cAAc,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAA;IAC/C,CAAC;IAED,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAE,CAA+B,CAAC,KAAK,CAAC,CAAA;AACnE,CAAC"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Durable composition — `bind` / `unbind`, six syscalls behind two verbs over
|
|
3
|
-
* one described edge delta, plus the delta shape and its flattening.
|
|
4
|
-
*/
|
|
5
|
-
import type { GraphCall, Ref } from '../graph/index.js';
|
|
6
|
-
import type { Caller } from './principal.js';
|
|
7
|
-
/**
|
|
8
|
-
* A described composition delta — the flat edge set on one identity node. Field
|
|
9
|
-
* names are the edge classes (camelCased); each is optional, accepts one or many
|
|
10
|
-
* counterparties, and fans out. An empty record is a resolved no-op.
|
|
11
|
-
*/
|
|
12
|
-
export interface Composition {
|
|
13
|
-
/** The identity the edges hang off. Absent ⇒ the memoized principal. */
|
|
14
|
-
who?: Ref;
|
|
15
|
-
/** extends_with — `who` gains each counterparty's reach (union). */
|
|
16
|
-
extendsWith?: Ref | readonly Ref[];
|
|
17
|
-
/** constrained_by — `who` reaches only the overlap (intersect). */
|
|
18
|
-
constrainedBy?: Ref | readonly Ref[];
|
|
19
|
-
/** excluded_from — `who` loses each counterparty's reach (asymmetric). */
|
|
20
|
-
excludedFrom?: Ref | readonly Ref[];
|
|
21
|
-
}
|
|
22
|
-
/** Bind bind + unbind onto a call capability and the caller resolver. */
|
|
23
|
-
export declare function createComposition(call: GraphCall, caller: Caller): {
|
|
24
|
-
bind(c: Composition): Promise<void>;
|
|
25
|
-
unbind(c: Composition): Promise<void>;
|
|
26
|
-
};
|
|
27
|
-
//# sourceMappingURL=composition.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"composition.d.ts","sourceRoot":"","sources":["../../src/auth/composition.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAA;AAEvD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAM5C;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,wEAAwE;IACxE,GAAG,CAAC,EAAE,GAAG,CAAA;IACT,oEAAoE;IACpE,WAAW,CAAC,EAAE,GAAG,GAAG,SAAS,GAAG,EAAE,CAAA;IAClC,mEAAmE;IACnE,aAAa,CAAC,EAAE,GAAG,GAAG,SAAS,GAAG,EAAE,CAAA;IACpC,0EAA0E;IAC1E,YAAY,CAAC,EAAE,GAAG,GAAG,SAAS,GAAG,EAAE,CAAA;CACpC;AAED,yEAAyE;AACzE,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,SAAS,EACf,MAAM,EAAE,MAAM,GACb;IAAE,IAAI,CAAC,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAAC,MAAM,CAAC,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAAE,CAwBhF"}
|
package/dist/auth/composition.js
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Durable composition — `bind` / `unbind`, six syscalls behind two verbs over
|
|
3
|
-
* one described edge delta, plus the delta shape and its flattening.
|
|
4
|
-
*/
|
|
5
|
-
import { refRaw } from '../graph/mutate/index.js';
|
|
6
|
-
import { IDENTITY_METHOD, instanceTarget } from './addressing.js';
|
|
7
|
-
import { settleAll } from './batch.js';
|
|
8
|
-
/** Bind bind + unbind onto a call capability and the caller resolver. */
|
|
9
|
-
export function createComposition(call, caller) {
|
|
10
|
-
const compose = async (c, kind) => {
|
|
11
|
-
const fields = compositionFields(c, kind);
|
|
12
|
-
// Empty / all-absent record: a resolved no-op — no whoami, no dispatch.
|
|
13
|
-
if (fields.length === 0)
|
|
14
|
-
return;
|
|
15
|
-
const whoRaw = c.who !== undefined ? refRaw(c.who) : await caller.principal();
|
|
16
|
-
const entries = fields.map(({ ref, slug, paramKey, edge }) => {
|
|
17
|
-
const counterparty = refRaw(ref);
|
|
18
|
-
const target = instanceTarget(whoRaw, slug);
|
|
19
|
-
return {
|
|
20
|
-
input: { who: whoRaw, edge, counterparty },
|
|
21
|
-
run: async () => {
|
|
22
|
-
await call(target, { [paramKey]: counterparty });
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
-
});
|
|
26
|
-
await settleAll(kind, entries);
|
|
27
|
-
};
|
|
28
|
-
const bind = (c) => compose(c, 'bind');
|
|
29
|
-
const unbind = (c) => compose(c, 'unbind');
|
|
30
|
-
return { bind, unbind };
|
|
31
|
-
}
|
|
32
|
-
/** Flatten a {@link Composition} into per-(field × counterparty) dispatch specs. */
|
|
33
|
-
function compositionFields(c, kind) {
|
|
34
|
-
const specs = kind === 'bind'
|
|
35
|
-
? [
|
|
36
|
-
{
|
|
37
|
-
refs: c.extendsWith,
|
|
38
|
-
slug: IDENTITY_METHOD.extend,
|
|
39
|
-
paramKey: 'with',
|
|
40
|
-
edge: 'extendsWith',
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
refs: c.constrainedBy,
|
|
44
|
-
slug: IDENTITY_METHOD.constrain,
|
|
45
|
-
paramKey: 'by',
|
|
46
|
-
edge: 'constrainedBy',
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
refs: c.excludedFrom,
|
|
50
|
-
slug: IDENTITY_METHOD.exclude,
|
|
51
|
-
paramKey: 'without',
|
|
52
|
-
edge: 'excludedFrom',
|
|
53
|
-
},
|
|
54
|
-
]
|
|
55
|
-
: [
|
|
56
|
-
{
|
|
57
|
-
refs: c.extendsWith,
|
|
58
|
-
slug: IDENTITY_METHOD.removeExtension,
|
|
59
|
-
paramKey: 'identity',
|
|
60
|
-
edge: 'extendsWith',
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
refs: c.constrainedBy,
|
|
64
|
-
slug: IDENTITY_METHOD.removeConstraint,
|
|
65
|
-
paramKey: 'identity',
|
|
66
|
-
edge: 'constrainedBy',
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
refs: c.excludedFrom,
|
|
70
|
-
slug: IDENTITY_METHOD.removeExclusion,
|
|
71
|
-
paramKey: 'identity',
|
|
72
|
-
edge: 'excludedFrom',
|
|
73
|
-
},
|
|
74
|
-
];
|
|
75
|
-
return specs.flatMap(({ refs, slug, paramKey, edge }) => toRefArray(refs).map((ref) => ({ ref, slug, paramKey, edge })));
|
|
76
|
-
}
|
|
77
|
-
/** Normalize `Ref | readonly Ref[] | undefined` to an array (single Ref → `[ref]`). */
|
|
78
|
-
function toRefArray(v) {
|
|
79
|
-
if (v === undefined)
|
|
80
|
-
return [];
|
|
81
|
-
return Array.isArray(v) ? v : [v];
|
|
82
|
-
}
|
|
83
|
-
//# sourceMappingURL=composition.js.map
|