@diffra-ai/chord 0.0.0-stage → 0.2.3
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/CHANGELOG.md +237 -0
- package/README.md +227 -2
- package/dist/context/index.d.ts +43 -0
- package/dist/context/index.d.ts.map +1 -0
- package/dist/context/index.js +112 -0
- package/dist/context/index.js.map +1 -0
- package/dist/contracts/accepts.d.ts +91 -0
- package/dist/contracts/accepts.d.ts.map +1 -0
- package/dist/contracts/accepts.js +145 -0
- package/dist/contracts/accepts.js.map +1 -0
- package/dist/contracts/contract.d.ts +238 -0
- package/dist/contracts/contract.d.ts.map +1 -0
- package/dist/contracts/contract.js +69 -0
- package/dist/contracts/contract.js.map +1 -0
- package/dist/contracts/declare.d.ts +144 -0
- package/dist/contracts/declare.d.ts.map +1 -0
- package/dist/contracts/declare.js +207 -0
- package/dist/contracts/declare.js.map +1 -0
- package/dist/contracts/evolve.d.ts +142 -0
- package/dist/contracts/evolve.d.ts.map +1 -0
- package/dist/contracts/evolve.js +216 -0
- package/dist/contracts/evolve.js.map +1 -0
- package/dist/contracts/fingerprint.d.ts +16 -0
- package/dist/contracts/fingerprint.d.ts.map +1 -0
- package/dist/contracts/fingerprint.js +61 -0
- package/dist/contracts/fingerprint.js.map +1 -0
- package/dist/contracts/history.d.ts +79 -0
- package/dist/contracts/history.d.ts.map +1 -0
- package/dist/contracts/history.js +3 -0
- package/dist/contracts/history.js.map +1 -0
- package/dist/contracts/host-kind.d.ts +58 -0
- package/dist/contracts/host-kind.d.ts.map +1 -0
- package/dist/contracts/host-kind.js +122 -0
- package/dist/contracts/host-kind.js.map +1 -0
- package/dist/contracts/index.d.ts +8 -0
- package/dist/contracts/index.d.ts.map +1 -0
- package/dist/contracts/index.js +7 -0
- package/dist/contracts/index.js.map +1 -0
- package/dist/contracts/internal.d.ts +12 -0
- package/dist/contracts/internal.d.ts.map +1 -0
- package/dist/contracts/internal.js +11 -0
- package/dist/contracts/internal.js.map +1 -0
- package/dist/contracts/names.d.ts +3 -0
- package/dist/contracts/names.d.ts.map +1 -0
- package/dist/contracts/names.js +13 -0
- package/dist/contracts/names.js.map +1 -0
- package/dist/contracts/params.d.ts +28 -0
- package/dist/contracts/params.d.ts.map +1 -0
- package/dist/contracts/params.js +55 -0
- package/dist/contracts/params.js.map +1 -0
- package/dist/contracts/schema.d.ts +144 -0
- package/dist/contracts/schema.d.ts.map +1 -0
- package/dist/contracts/schema.js +144 -0
- package/dist/contracts/schema.js.map +1 -0
- package/dist/contracts/snapshot.d.ts +16 -0
- package/dist/contracts/snapshot.d.ts.map +1 -0
- package/dist/contracts/snapshot.js +167 -0
- package/dist/contracts/snapshot.js.map +1 -0
- package/dist/data/args.d.ts +50 -0
- package/dist/data/args.d.ts.map +1 -0
- package/dist/data/args.js +83 -0
- package/dist/data/args.js.map +1 -0
- package/dist/data/errors.d.ts +80 -0
- package/dist/data/errors.d.ts.map +1 -0
- package/dist/data/errors.js +116 -0
- package/dist/data/errors.js.map +1 -0
- package/dist/data/failure.d.ts +31 -0
- package/dist/data/failure.d.ts.map +1 -0
- package/dist/data/failure.js +78 -0
- package/dist/data/failure.js.map +1 -0
- package/dist/data/index.d.ts +4 -0
- package/dist/data/index.d.ts.map +1 -0
- package/dist/data/index.js +5 -0
- package/dist/data/index.js.map +1 -0
- package/dist/data/internal.d.ts +7 -0
- package/dist/data/internal.d.ts.map +1 -0
- package/dist/data/internal.js +8 -0
- package/dist/data/internal.js.map +1 -0
- package/dist/data/params.d.ts +20 -0
- package/dist/data/params.d.ts.map +1 -0
- package/dist/data/params.js +31 -0
- package/dist/data/params.js.map +1 -0
- package/dist/data/principal.d.ts +28 -0
- package/dist/data/principal.d.ts.map +1 -0
- package/dist/data/principal.js +64 -0
- package/dist/data/principal.js.map +1 -0
- package/dist/data/validator.d.ts +12 -0
- package/dist/data/validator.d.ts.map +1 -0
- package/dist/data/validator.js +35 -0
- package/dist/data/validator.js.map +1 -0
- package/dist/delta/apply-immutable-trusted.d.ts +4 -0
- package/dist/delta/apply-immutable-trusted.d.ts.map +1 -0
- package/dist/delta/apply-immutable-trusted.js +126 -0
- package/dist/delta/apply-immutable-trusted.js.map +1 -0
- package/dist/delta/diff.d.ts +5 -0
- package/dist/delta/diff.d.ts.map +1 -0
- package/dist/delta/diff.js +435 -0
- package/dist/delta/diff.js.map +1 -0
- package/dist/delta/draft.d.ts +5 -0
- package/dist/delta/draft.d.ts.map +1 -0
- package/dist/delta/draft.js +2 -0
- package/dist/delta/draft.js.map +1 -0
- package/dist/delta/index.d.ts +120 -0
- package/dist/delta/index.d.ts.map +1 -0
- package/dist/delta/index.js +697 -0
- package/dist/delta/index.js.map +1 -0
- package/dist/delta/pending.d.ts +36 -0
- package/dist/delta/pending.d.ts.map +1 -0
- package/dist/delta/pending.js +143 -0
- package/dist/delta/pending.js.map +1 -0
- package/dist/delta/revision-validator.d.ts +7 -0
- package/dist/delta/revision-validator.d.ts.map +1 -0
- package/dist/delta/revision-validator.js +71 -0
- package/dist/delta/revision-validator.js.map +1 -0
- package/dist/delta/tracker.d.ts +38 -0
- package/dist/delta/tracker.d.ts.map +1 -0
- package/dist/delta/tracker.js +2175 -0
- package/dist/delta/tracker.js.map +1 -0
- package/dist/documents/address-source.d.ts +20 -0
- package/dist/documents/address-source.d.ts.map +1 -0
- package/dist/documents/address-source.js +44 -0
- package/dist/documents/address-source.js.map +1 -0
- package/dist/documents/definition.d.ts +92 -0
- package/dist/documents/definition.d.ts.map +1 -0
- package/dist/documents/definition.js +81 -0
- package/dist/documents/definition.js.map +1 -0
- package/dist/documents/documents.d.ts +129 -0
- package/dist/documents/documents.d.ts.map +1 -0
- package/dist/documents/documents.js +258 -0
- package/dist/documents/documents.js.map +1 -0
- package/dist/documents/fence.d.ts +9 -0
- package/dist/documents/fence.d.ts.map +1 -0
- package/dist/documents/fence.js +15 -0
- package/dist/documents/fence.js.map +1 -0
- package/dist/documents/handles.d.ts +81 -0
- package/dist/documents/handles.d.ts.map +1 -0
- package/dist/documents/handles.js +74 -0
- package/dist/documents/handles.js.map +1 -0
- package/dist/documents/index.d.ts +4 -0
- package/dist/documents/index.d.ts.map +1 -0
- package/dist/documents/index.js +3 -0
- package/dist/documents/index.js.map +1 -0
- package/dist/documents/internal.d.ts +9 -0
- package/dist/documents/internal.d.ts.map +1 -0
- package/dist/documents/internal.js +9 -0
- package/dist/documents/internal.js.map +1 -0
- package/dist/documents/keyed-slot.d.ts +139 -0
- package/dist/documents/keyed-slot.d.ts.map +1 -0
- package/dist/documents/keyed-slot.js +478 -0
- package/dist/documents/keyed-slot.js.map +1 -0
- package/dist/documents/line.d.ts +7 -0
- package/dist/documents/line.d.ts.map +1 -0
- package/dist/documents/line.js +14 -0
- package/dist/documents/line.js.map +1 -0
- package/dist/documents/persistence.d.ts +120 -0
- package/dist/documents/persistence.d.ts.map +1 -0
- package/dist/documents/persistence.js +156 -0
- package/dist/documents/persistence.js.map +1 -0
- package/dist/documents/residency.d.ts +31 -0
- package/dist/documents/residency.d.ts.map +1 -0
- package/dist/documents/residency.js +93 -0
- package/dist/documents/residency.js.map +1 -0
- package/dist/documents/slot.d.ts +112 -0
- package/dist/documents/slot.d.ts.map +1 -0
- package/dist/documents/slot.js +190 -0
- package/dist/documents/slot.js.map +1 -0
- package/dist/documents/transaction.d.ts +143 -0
- package/dist/documents/transaction.d.ts.map +1 -0
- package/dist/documents/transaction.js +445 -0
- package/dist/documents/transaction.js.map +1 -0
- package/dist/host/activity.d.ts +31 -0
- package/dist/host/activity.d.ts.map +1 -0
- package/dist/host/activity.js +40 -0
- package/dist/host/activity.js.map +1 -0
- package/dist/host/adapted.d.ts +63 -0
- package/dist/host/adapted.d.ts.map +1 -0
- package/dist/host/adapted.js +298 -0
- package/dist/host/adapted.js.map +1 -0
- package/dist/host/admission.d.ts +137 -0
- package/dist/host/admission.d.ts.map +1 -0
- package/dist/host/admission.js +290 -0
- package/dist/host/admission.js.map +1 -0
- package/dist/host/attempt.d.ts +417 -0
- package/dist/host/attempt.d.ts.map +1 -0
- package/dist/host/attempt.js +1490 -0
- package/dist/host/attempt.js.map +1 -0
- package/dist/host/backoff.d.ts +29 -0
- package/dist/host/backoff.d.ts.map +1 -0
- package/dist/host/backoff.js +69 -0
- package/dist/host/backoff.js.map +1 -0
- package/dist/host/ctx.d.ts +94 -0
- package/dist/host/ctx.d.ts.map +1 -0
- package/dist/host/ctx.js +200 -0
- package/dist/host/ctx.js.map +1 -0
- package/dist/host/deadline.d.ts +12 -0
- package/dist/host/deadline.d.ts.map +1 -0
- package/dist/host/deadline.js +40 -0
- package/dist/host/deadline.js.map +1 -0
- package/dist/host/dependencies.d.ts +97 -0
- package/dist/host/dependencies.d.ts.map +1 -0
- package/dist/host/dependencies.js +148 -0
- package/dist/host/dependencies.js.map +1 -0
- package/dist/host/destination.d.ts +48 -0
- package/dist/host/destination.d.ts.map +1 -0
- package/dist/host/destination.js +101 -0
- package/dist/host/destination.js.map +1 -0
- package/dist/host/events.d.ts +114 -0
- package/dist/host/events.d.ts.map +1 -0
- package/dist/host/events.js +191 -0
- package/dist/host/events.js.map +1 -0
- package/dist/host/facet.d.ts +106 -0
- package/dist/host/facet.d.ts.map +1 -0
- package/dist/host/facet.js +55 -0
- package/dist/host/facet.js.map +1 -0
- package/dist/host/follow.d.ts +52 -0
- package/dist/host/follow.d.ts.map +1 -0
- package/dist/host/follow.js +207 -0
- package/dist/host/follow.js.map +1 -0
- package/dist/host/host-data.d.ts +62 -0
- package/dist/host/host-data.d.ts.map +1 -0
- package/dist/host/host-data.js +229 -0
- package/dist/host/host-data.js.map +1 -0
- package/dist/host/host.d.ts +641 -0
- package/dist/host/host.d.ts.map +1 -0
- package/dist/host/host.js +1449 -0
- package/dist/host/host.js.map +1 -0
- package/dist/host/index.d.ts +20 -0
- package/dist/host/index.d.ts.map +1 -0
- package/dist/host/index.js +7 -0
- package/dist/host/index.js.map +1 -0
- package/dist/host/internal.d.ts +13 -0
- package/dist/host/internal.d.ts.map +1 -0
- package/dist/host/internal.js +11 -0
- package/dist/host/internal.js.map +1 -0
- package/dist/host/list.d.ts +52 -0
- package/dist/host/list.d.ts.map +1 -0
- package/dist/host/list.js +149 -0
- package/dist/host/list.js.map +1 -0
- package/dist/host/members.d.ts +58 -0
- package/dist/host/members.d.ts.map +1 -0
- package/dist/host/members.js +178 -0
- package/dist/host/members.js.map +1 -0
- package/dist/host/named-query.d.ts +67 -0
- package/dist/host/named-query.d.ts.map +1 -0
- package/dist/host/named-query.js +166 -0
- package/dist/host/named-query.js.map +1 -0
- package/dist/host/native.d.ts +64 -0
- package/dist/host/native.d.ts.map +1 -0
- package/dist/host/native.js +126 -0
- package/dist/host/native.js.map +1 -0
- package/dist/host/object.d.ts +388 -0
- package/dist/host/object.d.ts.map +1 -0
- package/dist/host/object.js +1527 -0
- package/dist/host/object.js.map +1 -0
- package/dist/host/old-work.d.ts +34 -0
- package/dist/host/old-work.d.ts.map +1 -0
- package/dist/host/old-work.js +52 -0
- package/dist/host/old-work.js.map +1 -0
- package/dist/host/parked.d.ts +23 -0
- package/dist/host/parked.d.ts.map +1 -0
- package/dist/host/parked.js +79 -0
- package/dist/host/parked.js.map +1 -0
- package/dist/host/presence.d.ts +34 -0
- package/dist/host/presence.d.ts.map +1 -0
- package/dist/host/presence.js +117 -0
- package/dist/host/presence.js.map +1 -0
- package/dist/host/query-reader.d.ts +80 -0
- package/dist/host/query-reader.d.ts.map +1 -0
- package/dist/host/query-reader.js +182 -0
- package/dist/host/query-reader.js.map +1 -0
- package/dist/host/read-declarations.d.ts +75 -0
- package/dist/host/read-declarations.d.ts.map +1 -0
- package/dist/host/read-declarations.js +152 -0
- package/dist/host/read-declarations.js.map +1 -0
- package/dist/host/readiness.d.ts +27 -0
- package/dist/host/readiness.d.ts.map +1 -0
- package/dist/host/readiness.js +134 -0
- package/dist/host/readiness.js.map +1 -0
- package/dist/host/ref-state.d.ts +53 -0
- package/dist/host/ref-state.d.ts.map +1 -0
- package/dist/host/ref-state.js +83 -0
- package/dist/host/ref-state.js.map +1 -0
- package/dist/host/reference-events.d.ts +51 -0
- package/dist/host/reference-events.d.ts.map +1 -0
- package/dist/host/reference-events.js +133 -0
- package/dist/host/reference-events.js.map +1 -0
- package/dist/host/reference-keys.d.ts +36 -0
- package/dist/host/reference-keys.d.ts.map +1 -0
- package/dist/host/reference-keys.js +168 -0
- package/dist/host/reference-keys.js.map +1 -0
- package/dist/host/reference-source.d.ts +77 -0
- package/dist/host/reference-source.d.ts.map +1 -0
- package/dist/host/reference-source.js +326 -0
- package/dist/host/reference-source.js.map +1 -0
- package/dist/host/reference.d.ts +377 -0
- package/dist/host/reference.d.ts.map +1 -0
- package/dist/host/reference.js +986 -0
- package/dist/host/reference.js.map +1 -0
- package/dist/host/reload-cycle.d.ts +16 -0
- package/dist/host/reload-cycle.d.ts.map +1 -0
- package/dist/host/reload-cycle.js +81 -0
- package/dist/host/reload-cycle.js.map +1 -0
- package/dist/host/retry-on.d.ts +28 -0
- package/dist/host/retry-on.d.ts.map +1 -0
- package/dist/host/retry-on.js +52 -0
- package/dist/host/retry-on.js.map +1 -0
- package/dist/host/revocation.d.ts +16 -0
- package/dist/host/revocation.d.ts.map +1 -0
- package/dist/host/revocation.js +27 -0
- package/dist/host/revocation.js.map +1 -0
- package/dist/host/root.d.ts +37 -0
- package/dist/host/root.d.ts.map +1 -0
- package/dist/host/root.js +68 -0
- package/dist/host/root.js.map +1 -0
- package/dist/host/route-admission.d.ts +24 -0
- package/dist/host/route-admission.d.ts.map +1 -0
- package/dist/host/route-admission.js +238 -0
- package/dist/host/route-admission.js.map +1 -0
- package/dist/host/route.d.ts +88 -0
- package/dist/host/route.d.ts.map +1 -0
- package/dist/host/route.js +247 -0
- package/dist/host/route.js.map +1 -0
- package/dist/host/routines.d.ts +78 -0
- package/dist/host/routines.d.ts.map +1 -0
- package/dist/host/routines.js +398 -0
- package/dist/host/routines.js.map +1 -0
- package/dist/host/sleep.d.ts +9 -0
- package/dist/host/sleep.d.ts.map +1 -0
- package/dist/host/sleep.js +40 -0
- package/dist/host/sleep.js.map +1 -0
- package/dist/host/staging.d.ts +100 -0
- package/dist/host/staging.d.ts.map +1 -0
- package/dist/host/staging.js +413 -0
- package/dist/host/staging.js.map +1 -0
- package/dist/host/tiling.d.ts +57 -0
- package/dist/host/tiling.d.ts.map +1 -0
- package/dist/host/tiling.js +269 -0
- package/dist/host/tiling.js.map +1 -0
- package/dist/host/unbound-clock.d.ts +23 -0
- package/dist/host/unbound-clock.d.ts.map +1 -0
- package/dist/host/unbound-clock.js +58 -0
- package/dist/host/unbound-clock.js.map +1 -0
- package/dist/host/unbound.d.ts +37 -0
- package/dist/host/unbound.d.ts.map +1 -0
- package/dist/host/unbound.js +88 -0
- package/dist/host/unbound.js.map +1 -0
- package/dist/host/uuid.d.ts +3 -0
- package/dist/host/uuid.d.ts.map +1 -0
- package/dist/host/uuid.js +38 -0
- package/dist/host/uuid.js.map +1 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/jobs/definition.d.ts +96 -0
- package/dist/jobs/definition.d.ts.map +1 -0
- package/dist/jobs/definition.js +83 -0
- package/dist/jobs/definition.js.map +1 -0
- package/dist/jobs/index.d.ts +5 -0
- package/dist/jobs/index.d.ts.map +1 -0
- package/dist/jobs/index.js +3 -0
- package/dist/jobs/index.js.map +1 -0
- package/dist/jobs/internal.d.ts +3 -0
- package/dist/jobs/internal.d.ts.map +1 -0
- package/dist/jobs/internal.js +4 -0
- package/dist/jobs/internal.js.map +1 -0
- package/dist/jobs/job.d.ts +149 -0
- package/dist/jobs/job.d.ts.map +1 -0
- package/dist/jobs/job.js +387 -0
- package/dist/jobs/job.js.map +1 -0
- package/dist/jobs/persisted.d.ts +38 -0
- package/dist/jobs/persisted.d.ts.map +1 -0
- package/dist/jobs/persisted.js +95 -0
- package/dist/jobs/persisted.js.map +1 -0
- package/dist/jobs/records.d.ts +231 -0
- package/dist/jobs/records.d.ts.map +1 -0
- package/dist/jobs/records.js +871 -0
- package/dist/jobs/records.js.map +1 -0
- package/dist/jobs/run-states.d.ts +69 -0
- package/dist/jobs/run-states.d.ts.map +1 -0
- package/dist/jobs/run-states.js +228 -0
- package/dist/jobs/run-states.js.map +1 -0
- package/dist/jobs/run.d.ts +117 -0
- package/dist/jobs/run.d.ts.map +1 -0
- package/dist/jobs/run.js +204 -0
- package/dist/jobs/run.js.map +1 -0
- package/dist/jobs/running.d.ts +44 -0
- package/dist/jobs/running.d.ts.map +1 -0
- package/dist/jobs/running.js +117 -0
- package/dist/jobs/running.js.map +1 -0
- package/dist/jobs/stored.d.ts +63 -0
- package/dist/jobs/stored.d.ts.map +1 -0
- package/dist/jobs/stored.js +55 -0
- package/dist/jobs/stored.js.map +1 -0
- package/dist/json.d.ts +18 -0
- package/dist/json.d.ts.map +1 -0
- package/dist/json.js +124 -0
- package/dist/json.js.map +1 -0
- package/dist/link/binary.d.ts +4 -0
- package/dist/link/binary.d.ts.map +1 -0
- package/dist/link/binary.js +574 -0
- package/dist/link/binary.js.map +1 -0
- package/dist/link/channel.d.ts +78 -0
- package/dist/link/channel.d.ts.map +1 -0
- package/dist/link/channel.js +252 -0
- package/dist/link/channel.js.map +1 -0
- package/dist/link/errors.d.ts +7 -0
- package/dist/link/errors.d.ts.map +1 -0
- package/dist/link/errors.js +21 -0
- package/dist/link/errors.js.map +1 -0
- package/dist/link/index.d.ts +8 -0
- package/dist/link/index.d.ts.map +1 -0
- package/dist/link/index.js +8 -0
- package/dist/link/index.js.map +1 -0
- package/dist/link/internal.d.ts +9 -0
- package/dist/link/internal.d.ts.map +1 -0
- package/dist/link/internal.js +10 -0
- package/dist/link/internal.js.map +1 -0
- package/dist/link/ipc.d.ts +22 -0
- package/dist/link/ipc.d.ts.map +1 -0
- package/dist/link/ipc.js +64 -0
- package/dist/link/ipc.js.map +1 -0
- package/dist/link/link.d.ts +34 -0
- package/dist/link/link.d.ts.map +1 -0
- package/dist/link/link.js +87 -0
- package/dist/link/link.js.map +1 -0
- package/dist/link/message.d.ts +278 -0
- package/dist/link/message.d.ts.map +1 -0
- package/dist/link/message.js +179 -0
- package/dist/link/message.js.map +1 -0
- package/dist/link/part.d.ts +80 -0
- package/dist/link/part.d.ts.map +1 -0
- package/dist/link/part.js +165 -0
- package/dist/link/part.js.map +1 -0
- package/dist/link/text.d.ts +6 -0
- package/dist/link/text.d.ts.map +1 -0
- package/dist/link/text.js +383 -0
- package/dist/link/text.js.map +1 -0
- package/dist/link/values.d.ts +40 -0
- package/dist/link/values.d.ts.map +1 -0
- package/dist/link/values.js +121 -0
- package/dist/link/values.js.map +1 -0
- package/dist/link/websocket.d.ts +26 -0
- package/dist/link/websocket.d.ts.map +1 -0
- package/dist/link/websocket.js +91 -0
- package/dist/link/websocket.js.map +1 -0
- package/dist/node/app/app.d.ts +283 -0
- package/dist/node/app/app.d.ts.map +1 -0
- package/dist/node/app/app.js +598 -0
- package/dist/node/app/app.js.map +1 -0
- package/dist/node/app/archive.d.ts +44 -0
- package/dist/node/app/archive.d.ts.map +1 -0
- package/dist/node/app/archive.js +212 -0
- package/dist/node/app/archive.js.map +1 -0
- package/dist/node/app/blobs.d.ts +23 -0
- package/dist/node/app/blobs.d.ts.map +1 -0
- package/dist/node/app/blobs.js +64 -0
- package/dist/node/app/blobs.js.map +1 -0
- package/dist/node/app/data.d.ts +40 -0
- package/dist/node/app/data.d.ts.map +1 -0
- package/dist/node/app/data.js +47 -0
- package/dist/node/app/data.js.map +1 -0
- package/dist/node/app/ephemeral-sign-ins.d.ts +20 -0
- package/dist/node/app/ephemeral-sign-ins.d.ts.map +1 -0
- package/dist/node/app/ephemeral-sign-ins.js +69 -0
- package/dist/node/app/ephemeral-sign-ins.js.map +1 -0
- package/dist/node/app/ephemeral.d.ts +11 -0
- package/dist/node/app/ephemeral.d.ts.map +1 -0
- package/dist/node/app/ephemeral.js +34 -0
- package/dist/node/app/ephemeral.js.map +1 -0
- package/dist/node/app/files-copy.d.ts +13 -0
- package/dist/node/app/files-copy.d.ts.map +1 -0
- package/dist/node/app/files-copy.js +86 -0
- package/dist/node/app/files-copy.js.map +1 -0
- package/dist/node/app/files-entry.d.ts +4 -0
- package/dist/node/app/files-entry.d.ts.map +1 -0
- package/dist/node/app/files-entry.js +7 -0
- package/dist/node/app/files-entry.js.map +1 -0
- package/dist/node/app/files-index.d.ts +180 -0
- package/dist/node/app/files-index.d.ts.map +1 -0
- package/dist/node/app/files-index.js +535 -0
- package/dist/node/app/files-index.js.map +1 -0
- package/dist/node/app/files.d.ts +388 -0
- package/dist/node/app/files.d.ts.map +1 -0
- package/dist/node/app/files.js +368 -0
- package/dist/node/app/files.js.map +1 -0
- package/dist/node/app/folder-views.d.ts +21 -0
- package/dist/node/app/folder-views.d.ts.map +1 -0
- package/dist/node/app/folder-views.js +55 -0
- package/dist/node/app/folder-views.js.map +1 -0
- package/dist/node/app/index.d.ts +12 -0
- package/dist/node/app/index.d.ts.map +1 -0
- package/dist/node/app/index.js +15 -0
- package/dist/node/app/index.js.map +1 -0
- package/dist/node/app/info.d.ts +70 -0
- package/dist/node/app/info.d.ts.map +1 -0
- package/dist/node/app/info.js +37 -0
- package/dist/node/app/info.js.map +1 -0
- package/dist/node/app/invite.d.ts +5 -0
- package/dist/node/app/invite.d.ts.map +1 -0
- package/dist/node/app/invite.js +64 -0
- package/dist/node/app/invite.js.map +1 -0
- package/dist/node/app/layout.d.ts +36 -0
- package/dist/node/app/layout.d.ts.map +1 -0
- package/dist/node/app/layout.js +87 -0
- package/dist/node/app/layout.js.map +1 -0
- package/dist/node/app/owner.d.ts +31 -0
- package/dist/node/app/owner.d.ts.map +1 -0
- package/dist/node/app/owner.js +104 -0
- package/dist/node/app/owner.js.map +1 -0
- package/dist/node/app/pairing.d.ts +55 -0
- package/dist/node/app/pairing.d.ts.map +1 -0
- package/dist/node/app/pairing.js +183 -0
- package/dist/node/app/pairing.js.map +1 -0
- package/dist/node/app/secrets.d.ts +16 -0
- package/dist/node/app/secrets.d.ts.map +1 -0
- package/dist/node/app/secrets.js +72 -0
- package/dist/node/app/secrets.js.map +1 -0
- package/dist/node/app/sign-ins.d.ts +74 -0
- package/dist/node/app/sign-ins.d.ts.map +1 -0
- package/dist/node/app/sign-ins.js +222 -0
- package/dist/node/app/sign-ins.js.map +1 -0
- package/dist/node/app/tar.d.ts +24 -0
- package/dist/node/app/tar.d.ts.map +1 -0
- package/dist/node/app/tar.js +167 -0
- package/dist/node/app/tar.js.map +1 -0
- package/dist/node/app/uploads.d.ts +37 -0
- package/dist/node/app/uploads.d.ts.map +1 -0
- package/dist/node/app/uploads.js +157 -0
- package/dist/node/app/uploads.js.map +1 -0
- package/dist/node/app/users.d.ts +39 -0
- package/dist/node/app/users.d.ts.map +1 -0
- package/dist/node/app/users.js +62 -0
- package/dist/node/app/users.js.map +1 -0
- package/dist/node/app/worker.d.ts +18 -0
- package/dist/node/app/worker.d.ts.map +1 -0
- package/dist/node/app/worker.js +84 -0
- package/dist/node/app/worker.js.map +1 -0
- package/dist/node/compression.d.ts +7 -0
- package/dist/node/compression.d.ts.map +1 -0
- package/dist/node/compression.js +25 -0
- package/dist/node/compression.js.map +1 -0
- package/dist/node/http/admission.d.ts +64 -0
- package/dist/node/http/admission.d.ts.map +1 -0
- package/dist/node/http/admission.js +137 -0
- package/dist/node/http/admission.js.map +1 -0
- package/dist/node/http/authenticate.d.ts +21 -0
- package/dist/node/http/authenticate.d.ts.map +1 -0
- package/dist/node/http/authenticate.js +34 -0
- package/dist/node/http/authenticate.js.map +1 -0
- package/dist/node/http/cookies.d.ts +32 -0
- package/dist/node/http/cookies.d.ts.map +1 -0
- package/dist/node/http/cookies.js +70 -0
- package/dist/node/http/cookies.js.map +1 -0
- package/dist/node/http/file.d.ts +23 -0
- package/dist/node/http/file.d.ts.map +1 -0
- package/dist/node/http/file.js +94 -0
- package/dist/node/http/file.js.map +1 -0
- package/dist/node/http/headers.d.ts +37 -0
- package/dist/node/http/headers.d.ts.map +1 -0
- package/dist/node/http/headers.js +136 -0
- package/dist/node/http/headers.js.map +1 -0
- package/dist/node/http/http.d.ts +114 -0
- package/dist/node/http/http.d.ts.map +1 -0
- package/dist/node/http/http.js +524 -0
- package/dist/node/http/http.js.map +1 -0
- package/dist/node/http/incoming.d.ts +19 -0
- package/dist/node/http/incoming.d.ts.map +1 -0
- package/dist/node/http/incoming.js +31 -0
- package/dist/node/http/incoming.js.map +1 -0
- package/dist/node/http/index.d.ts +11 -0
- package/dist/node/http/index.d.ts.map +1 -0
- package/dist/node/http/index.js +12 -0
- package/dist/node/http/index.js.map +1 -0
- package/dist/node/http/node.d.ts +78 -0
- package/dist/node/http/node.d.ts.map +1 -0
- package/dist/node/http/node.js +291 -0
- package/dist/node/http/node.js.map +1 -0
- package/dist/node/http/request.d.ts +60 -0
- package/dist/node/http/request.d.ts.map +1 -0
- package/dist/node/http/request.js +118 -0
- package/dist/node/http/request.js.map +1 -0
- package/dist/node/http/response.d.ts +63 -0
- package/dist/node/http/response.d.ts.map +1 -0
- package/dist/node/http/response.js +202 -0
- package/dist/node/http/response.js.map +1 -0
- package/dist/node/http/router.d.ts +132 -0
- package/dist/node/http/router.d.ts.map +1 -0
- package/dist/node/http/router.js +267 -0
- package/dist/node/http/router.js.map +1 -0
- package/dist/node/http/upgrades.d.ts +62 -0
- package/dist/node/http/upgrades.d.ts.map +1 -0
- package/dist/node/http/upgrades.js +194 -0
- package/dist/node/http/upgrades.js.map +1 -0
- package/dist/node/plugins/base-inputs.d.ts +14 -0
- package/dist/node/plugins/base-inputs.d.ts.map +1 -0
- package/dist/node/plugins/base-inputs.js +33 -0
- package/dist/node/plugins/base-inputs.js.map +1 -0
- package/dist/node/plugins/build.d.ts +77 -0
- package/dist/node/plugins/build.d.ts.map +1 -0
- package/dist/node/plugins/build.js +577 -0
- package/dist/node/plugins/build.js.map +1 -0
- package/dist/node/plugins/css-modules.d.ts +13 -0
- package/dist/node/plugins/css-modules.d.ts.map +1 -0
- package/dist/node/plugins/css-modules.js +58 -0
- package/dist/node/plugins/css-modules.js.map +1 -0
- package/dist/node/plugins/discover.d.ts +67 -0
- package/dist/node/plugins/discover.d.ts.map +1 -0
- package/dist/node/plugins/discover.js +369 -0
- package/dist/node/plugins/discover.js.map +1 -0
- package/dist/node/plugins/evaluate.d.ts +33 -0
- package/dist/node/plugins/evaluate.d.ts.map +1 -0
- package/dist/node/plugins/evaluate.js +121 -0
- package/dist/node/plugins/evaluate.js.map +1 -0
- package/dist/node/plugins/index.d.ts +11 -0
- package/dist/node/plugins/index.d.ts.map +1 -0
- package/dist/node/plugins/index.js +13 -0
- package/dist/node/plugins/index.js.map +1 -0
- package/dist/node/plugins/install.d.ts +40 -0
- package/dist/node/plugins/install.d.ts.map +1 -0
- package/dist/node/plugins/install.js +215 -0
- package/dist/node/plugins/install.js.map +1 -0
- package/dist/node/plugins/plugins.d.ts +165 -0
- package/dist/node/plugins/plugins.d.ts.map +1 -0
- package/dist/node/plugins/plugins.js +268 -0
- package/dist/node/plugins/plugins.js.map +1 -0
- package/dist/node/plugins/runtime.d.ts +57 -0
- package/dist/node/plugins/runtime.d.ts.map +1 -0
- package/dist/node/plugins/runtime.js +92 -0
- package/dist/node/plugins/runtime.js.map +1 -0
- package/dist/node/plugins/stack.d.ts +16 -0
- package/dist/node/plugins/stack.d.ts.map +1 -0
- package/dist/node/plugins/stack.js +70 -0
- package/dist/node/plugins/stack.js.map +1 -0
- package/dist/node/plugins/testing.d.ts +58 -0
- package/dist/node/plugins/testing.d.ts.map +1 -0
- package/dist/node/plugins/testing.js +210 -0
- package/dist/node/plugins/testing.js.map +1 -0
- package/dist/node/plugins/watcher.d.ts +69 -0
- package/dist/node/plugins/watcher.d.ts.map +1 -0
- package/dist/node/plugins/watcher.js +622 -0
- package/dist/node/plugins/watcher.js.map +1 -0
- package/dist/node/surfaces/bundle.d.ts +40 -0
- package/dist/node/surfaces/bundle.d.ts.map +1 -0
- package/dist/node/surfaces/bundle.js +121 -0
- package/dist/node/surfaces/bundle.js.map +1 -0
- package/dist/node/surfaces/current.d.ts +17 -0
- package/dist/node/surfaces/current.d.ts.map +1 -0
- package/dist/node/surfaces/current.js +54 -0
- package/dist/node/surfaces/current.js.map +1 -0
- package/dist/node/surfaces/index.d.ts +6 -0
- package/dist/node/surfaces/index.d.ts.map +1 -0
- package/dist/node/surfaces/index.js +6 -0
- package/dist/node/surfaces/index.js.map +1 -0
- package/dist/node/surfaces/published.d.ts +27 -0
- package/dist/node/surfaces/published.d.ts.map +1 -0
- package/dist/node/surfaces/published.js +142 -0
- package/dist/node/surfaces/published.js.map +1 -0
- package/dist/node/surfaces/served.d.ts +17 -0
- package/dist/node/surfaces/served.d.ts.map +1 -0
- package/dist/node/surfaces/served.js +44 -0
- package/dist/node/surfaces/served.js.map +1 -0
- package/dist/node/surfaces/surface-build.d.ts +53 -0
- package/dist/node/surfaces/surface-build.d.ts.map +1 -0
- package/dist/node/surfaces/surface-build.js +105 -0
- package/dist/node/surfaces/surface-build.js.map +1 -0
- package/dist/node/surfaces/tui.d.ts +42 -0
- package/dist/node/surfaces/tui.d.ts.map +1 -0
- package/dist/node/surfaces/tui.js +59 -0
- package/dist/node/surfaces/tui.js.map +1 -0
- package/dist/node/surfaces/web.d.ts +82 -0
- package/dist/node/surfaces/web.d.ts.map +1 -0
- package/dist/node/surfaces/web.js +122 -0
- package/dist/node/surfaces/web.js.map +1 -0
- package/dist/node/tui/actions.d.ts +49 -0
- package/dist/node/tui/actions.d.ts.map +1 -0
- package/dist/node/tui/actions.js +195 -0
- package/dist/node/tui/actions.js.map +1 -0
- package/dist/node/tui/credentials.d.ts +17 -0
- package/dist/node/tui/credentials.d.ts.map +1 -0
- package/dist/node/tui/credentials.js +54 -0
- package/dist/node/tui/credentials.js.map +1 -0
- package/dist/node/tui/filter.d.ts +5 -0
- package/dist/node/tui/filter.d.ts.map +1 -0
- package/dist/node/tui/filter.js +79 -0
- package/dist/node/tui/filter.js.map +1 -0
- package/dist/node/tui/index.d.ts +6 -0
- package/dist/node/tui/index.d.ts.map +1 -0
- package/dist/node/tui/index.js +6 -0
- package/dist/node/tui/index.js.map +1 -0
- package/dist/node/tui/launcher.d.ts +40 -0
- package/dist/node/tui/launcher.d.ts.map +1 -0
- package/dist/node/tui/launcher.js +439 -0
- package/dist/node/tui/launcher.js.map +1 -0
- package/dist/node/tui/pipe.d.ts +18 -0
- package/dist/node/tui/pipe.d.ts.map +1 -0
- package/dist/node/tui/pipe.js +134 -0
- package/dist/node/tui/pipe.js.map +1 -0
- package/dist/node/tui/sandbox.d.ts +54 -0
- package/dist/node/tui/sandbox.d.ts.map +1 -0
- package/dist/node/tui/sandbox.js +431 -0
- package/dist/node/tui/sandbox.js.map +1 -0
- package/dist/node/workers/base.d.ts +30 -0
- package/dist/node/workers/base.d.ts.map +1 -0
- package/dist/node/workers/base.js +260 -0
- package/dist/node/workers/base.js.map +1 -0
- package/dist/node/workers/child.d.ts +4 -0
- package/dist/node/workers/child.d.ts.map +1 -0
- package/dist/node/workers/child.js +6 -0
- package/dist/node/workers/child.js.map +1 -0
- package/dist/node/workers/control.d.ts +83 -0
- package/dist/node/workers/control.d.ts.map +1 -0
- package/dist/node/workers/control.js +77 -0
- package/dist/node/workers/control.js.map +1 -0
- package/dist/node/workers/index.d.ts +4 -0
- package/dist/node/workers/index.d.ts.map +1 -0
- package/dist/node/workers/index.js +7 -0
- package/dist/node/workers/index.js.map +1 -0
- package/dist/node/workers/lock.d.ts +30 -0
- package/dist/node/workers/lock.d.ts.map +1 -0
- package/dist/node/workers/lock.js +180 -0
- package/dist/node/workers/lock.js.map +1 -0
- package/dist/node/workers/main.d.ts +46 -0
- package/dist/node/workers/main.d.ts.map +1 -0
- package/dist/node/workers/main.js +230 -0
- package/dist/node/workers/main.js.map +1 -0
- package/dist/node/workers/process.d.ts +43 -0
- package/dist/node/workers/process.d.ts.map +1 -0
- package/dist/node/workers/process.js +137 -0
- package/dist/node/workers/process.js.map +1 -0
- package/dist/node/workers/workers.d.ts +144 -0
- package/dist/node/workers/workers.d.ts.map +1 -0
- package/dist/node/workers/workers.js +723 -0
- package/dist/node/workers/workers.js.map +1 -0
- package/dist/output.d.ts +91 -0
- package/dist/output.d.ts.map +1 -0
- package/dist/output.js +362 -0
- package/dist/output.js.map +1 -0
- package/dist/react/hooks.d.ts +61 -0
- package/dist/react/hooks.d.ts.map +1 -0
- package/dist/react/hooks.js +119 -0
- package/dist/react/hooks.js.map +1 -0
- package/dist/react/index.d.ts +4 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +4 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/stores.d.ts +9 -0
- package/dist/react/stores.d.ts.map +1 -0
- package/dist/react/stores.js +37 -0
- package/dist/react/stores.js.map +1 -0
- package/dist/registries/contribution.d.ts +50 -0
- package/dist/registries/contribution.d.ts.map +1 -0
- package/dist/registries/contribution.js +129 -0
- package/dist/registries/contribution.js.map +1 -0
- package/dist/registries/entries.d.ts +18 -0
- package/dist/registries/entries.d.ts.map +1 -0
- package/dist/registries/entries.js +42 -0
- package/dist/registries/entries.js.map +1 -0
- package/dist/registries/index.d.ts +3 -0
- package/dist/registries/index.d.ts.map +1 -0
- package/dist/registries/index.js +5 -0
- package/dist/registries/index.js.map +1 -0
- package/dist/registries/internal.d.ts +4 -0
- package/dist/registries/internal.d.ts.map +1 -0
- package/dist/registries/internal.js +5 -0
- package/dist/registries/internal.js.map +1 -0
- package/dist/registries/record.d.ts +115 -0
- package/dist/registries/record.d.ts.map +1 -0
- package/dist/registries/record.js +283 -0
- package/dist/registries/record.js.map +1 -0
- package/dist/registries/registry.d.ts +74 -0
- package/dist/registries/registry.d.ts.map +1 -0
- package/dist/registries/registry.js +14 -0
- package/dist/registries/registry.js.map +1 -0
- package/dist/registries/value.d.ts +48 -0
- package/dist/registries/value.d.ts.map +1 -0
- package/dist/registries/value.js +224 -0
- package/dist/registries/value.js.map +1 -0
- package/dist/remote/calls.d.ts +34 -0
- package/dist/remote/calls.d.ts.map +1 -0
- package/dist/remote/calls.js +75 -0
- package/dist/remote/calls.js.map +1 -0
- package/dist/remote/consumer.d.ts +59 -0
- package/dist/remote/consumer.d.ts.map +1 -0
- package/dist/remote/consumer.js +468 -0
- package/dist/remote/consumer.js.map +1 -0
- package/dist/remote/hold.d.ts +147 -0
- package/dist/remote/hold.d.ts.map +1 -0
- package/dist/remote/hold.js +653 -0
- package/dist/remote/hold.js.map +1 -0
- package/dist/remote/host-link.d.ts +81 -0
- package/dist/remote/host-link.d.ts.map +1 -0
- package/dist/remote/host-link.js +198 -0
- package/dist/remote/host-link.js.map +1 -0
- package/dist/remote/internal.d.ts +6 -0
- package/dist/remote/internal.d.ts.map +1 -0
- package/dist/remote/internal.js +6 -0
- package/dist/remote/internal.js.map +1 -0
- package/dist/remote/path.d.ts +105 -0
- package/dist/remote/path.d.ts.map +1 -0
- package/dist/remote/path.js +197 -0
- package/dist/remote/path.js.map +1 -0
- package/dist/remote/provider.d.ts +113 -0
- package/dist/remote/provider.d.ts.map +1 -0
- package/dist/remote/provider.js +787 -0
- package/dist/remote/provider.js.map +1 -0
- package/dist/remote/relay.d.ts +126 -0
- package/dist/remote/relay.d.ts.map +1 -0
- package/dist/remote/relay.js +334 -0
- package/dist/remote/relay.js.map +1 -0
- package/dist/remote/remote-object.d.ts +181 -0
- package/dist/remote/remote-object.d.ts.map +1 -0
- package/dist/remote/remote-object.js +683 -0
- package/dist/remote/remote-object.js.map +1 -0
- package/dist/remote/replica.d.ts +66 -0
- package/dist/remote/replica.d.ts.map +1 -0
- package/dist/remote/replica.js +148 -0
- package/dist/remote/replica.js.map +1 -0
- package/dist/sqlite/cloudflare.d.ts +54 -0
- package/dist/sqlite/cloudflare.d.ts.map +1 -0
- package/dist/sqlite/cloudflare.js +144 -0
- package/dist/sqlite/cloudflare.js.map +1 -0
- package/dist/sqlite/database.d.ts +40 -0
- package/dist/sqlite/database.d.ts.map +1 -0
- package/dist/sqlite/database.js +2 -0
- package/dist/sqlite/database.js.map +1 -0
- package/dist/sqlite/index.d.ts +4 -0
- package/dist/sqlite/index.d.ts.map +1 -0
- package/dist/sqlite/index.js +3 -0
- package/dist/sqlite/index.js.map +1 -0
- package/dist/sqlite/migrations.d.ts +10 -0
- package/dist/sqlite/migrations.d.ts.map +1 -0
- package/dist/sqlite/migrations.js +33 -0
- package/dist/sqlite/migrations.js.map +1 -0
- package/dist/sqlite/node.d.ts +49 -0
- package/dist/sqlite/node.d.ts.map +1 -0
- package/dist/sqlite/node.js +197 -0
- package/dist/sqlite/node.js.map +1 -0
- package/dist/sqlite/schema.d.ts +3 -0
- package/dist/sqlite/schema.d.ts.map +1 -0
- package/dist/sqlite/schema.js +10 -0
- package/dist/sqlite/schema.js.map +1 -0
- package/dist/state/batch.d.ts +64 -0
- package/dist/state/batch.d.ts.map +1 -0
- package/dist/state/batch.js +164 -0
- package/dist/state/batch.js.map +1 -0
- package/dist/state/derive.d.ts +56 -0
- package/dist/state/derive.d.ts.map +1 -0
- package/dist/state/derive.js +192 -0
- package/dist/state/derive.js.map +1 -0
- package/dist/state/framed.d.ts +43 -0
- package/dist/state/framed.d.ts.map +1 -0
- package/dist/state/framed.js +121 -0
- package/dist/state/framed.js.map +1 -0
- package/dist/state/index.d.ts +6 -0
- package/dist/state/index.d.ts.map +1 -0
- package/dist/state/index.js +4 -0
- package/dist/state/index.js.map +1 -0
- package/dist/state/internal.d.ts +7 -0
- package/dist/state/internal.d.ts.map +1 -0
- package/dist/state/internal.js +9 -0
- package/dist/state/internal.js.map +1 -0
- package/dist/state/native-source.d.ts +106 -0
- package/dist/state/native-source.d.ts.map +1 -0
- package/dist/state/native-source.js +240 -0
- package/dist/state/native-source.js.map +1 -0
- package/dist/state/watchable.d.ts +114 -0
- package/dist/state/watchable.d.ts.map +1 -0
- package/dist/state/watchable.js +156 -0
- package/dist/state/watchable.js.map +1 -0
- package/dist/state/writable.d.ts +32 -0
- package/dist/state/writable.d.ts.map +1 -0
- package/dist/state/writable.js +49 -0
- package/dist/state/writable.js.map +1 -0
- package/dist/store/adapter.d.ts +67 -0
- package/dist/store/adapter.d.ts.map +1 -0
- package/dist/store/adapter.js +118 -0
- package/dist/store/adapter.js.map +1 -0
- package/dist/store/allocator.d.ts +17 -0
- package/dist/store/allocator.d.ts.map +1 -0
- package/dist/store/allocator.js +30 -0
- package/dist/store/allocator.js.map +1 -0
- package/dist/store/applier.d.ts +8 -0
- package/dist/store/applier.d.ts.map +1 -0
- package/dist/store/applier.js +390 -0
- package/dist/store/applier.js.map +1 -0
- package/dist/store/apply-batch.d.ts +12 -0
- package/dist/store/apply-batch.d.ts.map +1 -0
- package/dist/store/apply-batch.js +83 -0
- package/dist/store/apply-batch.js.map +1 -0
- package/dist/store/archive.d.ts +36 -0
- package/dist/store/archive.d.ts.map +1 -0
- package/dist/store/archive.js +140 -0
- package/dist/store/archive.js.map +1 -0
- package/dist/store/backend.d.ts +10 -0
- package/dist/store/backend.d.ts.map +1 -0
- package/dist/store/backend.js +15 -0
- package/dist/store/backend.js.map +1 -0
- package/dist/store/catalog.d.ts +24 -0
- package/dist/store/catalog.d.ts.map +1 -0
- package/dist/store/catalog.js +17 -0
- package/dist/store/catalog.js.map +1 -0
- package/dist/store/claims.d.ts +23 -0
- package/dist/store/claims.d.ts.map +1 -0
- package/dist/store/claims.js +65 -0
- package/dist/store/claims.js.map +1 -0
- package/dist/store/column-set.d.ts +64 -0
- package/dist/store/column-set.d.ts.map +1 -0
- package/dist/store/column-set.js +96 -0
- package/dist/store/column-set.js.map +1 -0
- package/dist/store/columns.d.ts +93 -0
- package/dist/store/columns.d.ts.map +1 -0
- package/dist/store/columns.js +87 -0
- package/dist/store/columns.js.map +1 -0
- package/dist/store/engine.d.ts +182 -0
- package/dist/store/engine.d.ts.map +1 -0
- package/dist/store/engine.js +290 -0
- package/dist/store/engine.js.map +1 -0
- package/dist/store/evaluate.d.ts +17 -0
- package/dist/store/evaluate.d.ts.map +1 -0
- package/dist/store/evaluate.js +131 -0
- package/dist/store/evaluate.js.map +1 -0
- package/dist/store/export.d.ts +30 -0
- package/dist/store/export.d.ts.map +1 -0
- package/dist/store/export.js +221 -0
- package/dist/store/export.js.map +1 -0
- package/dist/store/expression.d.ts +254 -0
- package/dist/store/expression.d.ts.map +1 -0
- package/dist/store/expression.js +577 -0
- package/dist/store/expression.js.map +1 -0
- package/dist/store/host-column.d.ts +22 -0
- package/dist/store/host-column.d.ts.map +1 -0
- package/dist/store/host-column.js +36 -0
- package/dist/store/host-column.js.map +1 -0
- package/dist/store/host-data.d.ts +100 -0
- package/dist/store/host-data.d.ts.map +1 -0
- package/dist/store/host-data.js +397 -0
- package/dist/store/host-data.js.map +1 -0
- package/dist/store/import-migration.d.ts +19 -0
- package/dist/store/import-migration.d.ts.map +1 -0
- package/dist/store/import-migration.js +124 -0
- package/dist/store/import-migration.js.map +1 -0
- package/dist/store/import.d.ts +12 -0
- package/dist/store/import.d.ts.map +1 -0
- package/dist/store/import.js +279 -0
- package/dist/store/import.js.map +1 -0
- package/dist/store/index.d.ts +19 -0
- package/dist/store/index.d.ts.map +1 -0
- package/dist/store/index.js +16 -0
- package/dist/store/index.js.map +1 -0
- package/dist/store/json-column.d.ts +33 -0
- package/dist/store/json-column.d.ts.map +1 -0
- package/dist/store/json-column.js +62 -0
- package/dist/store/json-column.js.map +1 -0
- package/dist/store/jsonl.d.ts +9 -0
- package/dist/store/jsonl.d.ts.map +1 -0
- package/dist/store/jsonl.js +61 -0
- package/dist/store/jsonl.js.map +1 -0
- package/dist/store/live-query.d.ts +72 -0
- package/dist/store/live-query.d.ts.map +1 -0
- package/dist/store/live-query.js +162 -0
- package/dist/store/live-query.js.map +1 -0
- package/dist/store/open-query.d.ts +90 -0
- package/dist/store/open-query.d.ts.map +1 -0
- package/dist/store/open-query.js +201 -0
- package/dist/store/open-query.js.map +1 -0
- package/dist/store/outbox.d.ts +26 -0
- package/dist/store/outbox.d.ts.map +1 -0
- package/dist/store/outbox.js +80 -0
- package/dist/store/outbox.js.map +1 -0
- package/dist/store/page.d.ts +14 -0
- package/dist/store/page.d.ts.map +1 -0
- package/dist/store/page.js +26 -0
- package/dist/store/page.js.map +1 -0
- package/dist/store/query.d.ts +65 -0
- package/dist/store/query.d.ts.map +1 -0
- package/dist/store/query.js +193 -0
- package/dist/store/query.js.map +1 -0
- package/dist/store/read-plan.d.ts +74 -0
- package/dist/store/read-plan.d.ts.map +1 -0
- package/dist/store/read-plan.js +324 -0
- package/dist/store/read-plan.js.map +1 -0
- package/dist/store/read.d.ts +81 -0
- package/dist/store/read.d.ts.map +1 -0
- package/dist/store/read.js +113 -0
- package/dist/store/read.js.map +1 -0
- package/dist/store/reads.d.ts +79 -0
- package/dist/store/reads.d.ts.map +1 -0
- package/dist/store/reads.js +255 -0
- package/dist/store/reads.js.map +1 -0
- package/dist/store/refusal.d.ts +15 -0
- package/dist/store/refusal.d.ts.map +1 -0
- package/dist/store/refusal.js +36 -0
- package/dist/store/refusal.js.map +1 -0
- package/dist/store/rows.d.ts +96 -0
- package/dist/store/rows.d.ts.map +1 -0
- package/dist/store/rows.js +222 -0
- package/dist/store/rows.js.map +1 -0
- package/dist/store/schema.d.ts +25 -0
- package/dist/store/schema.d.ts.map +1 -0
- package/dist/store/schema.js +123 -0
- package/dist/store/schema.js.map +1 -0
- package/dist/store/skip.d.ts +26 -0
- package/dist/store/skip.d.ts.map +1 -0
- package/dist/store/skip.js +66 -0
- package/dist/store/skip.js.map +1 -0
- package/dist/store/sql.d.ts +78 -0
- package/dist/store/sql.d.ts.map +1 -0
- package/dist/store/sql.js +244 -0
- package/dist/store/sql.js.map +1 -0
- package/dist/store/step.d.ts +52 -0
- package/dist/store/step.d.ts.map +1 -0
- package/dist/store/step.js +59 -0
- package/dist/store/step.js.map +1 -0
- package/dist/store/store.d.ts +192 -0
- package/dist/store/store.d.ts.map +1 -0
- package/dist/store/store.js +863 -0
- package/dist/store/store.js.map +1 -0
- package/dist/store/table-changes.d.ts +35 -0
- package/dist/store/table-changes.d.ts.map +1 -0
- package/dist/store/table-changes.js +127 -0
- package/dist/store/table-changes.js.map +1 -0
- package/dist/store/table-evolve.d.ts +82 -0
- package/dist/store/table-evolve.d.ts.map +1 -0
- package/dist/store/table-evolve.js +208 -0
- package/dist/store/table-evolve.js.map +1 -0
- package/dist/store/table-handle.d.ts +69 -0
- package/dist/store/table-handle.d.ts.map +1 -0
- package/dist/store/table-handle.js +92 -0
- package/dist/store/table-handle.js.map +1 -0
- package/dist/store/table-history.d.ts +78 -0
- package/dist/store/table-history.d.ts.map +1 -0
- package/dist/store/table-history.js +43 -0
- package/dist/store/table-history.js.map +1 -0
- package/dist/store/table-migration.d.ts +28 -0
- package/dist/store/table-migration.d.ts.map +1 -0
- package/dist/store/table-migration.js +212 -0
- package/dist/store/table-migration.js.map +1 -0
- package/dist/store/table-writes.d.ts +125 -0
- package/dist/store/table-writes.d.ts.map +1 -0
- package/dist/store/table-writes.js +170 -0
- package/dist/store/table-writes.js.map +1 -0
- package/dist/store/table.d.ts +91 -0
- package/dist/store/table.d.ts.map +1 -0
- package/dist/store/table.js +133 -0
- package/dist/store/table.js.map +1 -0
- package/dist/store/text.d.ts +14 -0
- package/dist/store/text.d.ts.map +1 -0
- package/dist/store/text.js +51 -0
- package/dist/store/text.js.map +1 -0
- package/dist/store/writes.d.ts +5 -0
- package/dist/store/writes.d.ts.map +1 -0
- package/dist/store/writes.js +4 -0
- package/dist/store/writes.js.map +1 -0
- package/dist/surfaces/active-language.d.ts +20 -0
- package/dist/surfaces/active-language.d.ts.map +1 -0
- package/dist/surfaces/active-language.js +78 -0
- package/dist/surfaces/active-language.js.map +1 -0
- package/dist/surfaces/active-theme.d.ts +16 -0
- package/dist/surfaces/active-theme.d.ts.map +1 -0
- package/dist/surfaces/active-theme.js +47 -0
- package/dist/surfaces/active-theme.js.map +1 -0
- package/dist/surfaces/client.d.ts +106 -0
- package/dist/surfaces/client.d.ts.map +1 -0
- package/dist/surfaces/client.js +280 -0
- package/dist/surfaces/client.js.map +1 -0
- package/dist/surfaces/connection.d.ts +53 -0
- package/dist/surfaces/connection.d.ts.map +1 -0
- package/dist/surfaces/connection.js +161 -0
- package/dist/surfaces/connection.js.map +1 -0
- package/dist/surfaces/format.d.ts +5 -0
- package/dist/surfaces/format.d.ts.map +1 -0
- package/dist/surfaces/format.js +37 -0
- package/dist/surfaces/format.js.map +1 -0
- package/dist/surfaces/index.d.ts +15 -0
- package/dist/surfaces/index.d.ts.map +1 -0
- package/dist/surfaces/index.js +18 -0
- package/dist/surfaces/index.js.map +1 -0
- package/dist/surfaces/language.d.ts +53 -0
- package/dist/surfaces/language.d.ts.map +1 -0
- package/dist/surfaces/language.js +74 -0
- package/dist/surfaces/language.js.map +1 -0
- package/dist/surfaces/loaded.d.ts +42 -0
- package/dist/surfaces/loaded.d.ts.map +1 -0
- package/dist/surfaces/loaded.js +116 -0
- package/dist/surfaces/loaded.js.map +1 -0
- package/dist/surfaces/locale-choice.d.ts +26 -0
- package/dist/surfaces/locale-choice.d.ts.map +1 -0
- package/dist/surfaces/locale-choice.js +14 -0
- package/dist/surfaces/locale-choice.js.map +1 -0
- package/dist/surfaces/messages.d.ts +67 -0
- package/dist/surfaces/messages.d.ts.map +1 -0
- package/dist/surfaces/messages.js +112 -0
- package/dist/surfaces/messages.js.map +1 -0
- package/dist/surfaces/page-state.d.ts +14 -0
- package/dist/surfaces/page-state.d.ts.map +1 -0
- package/dist/surfaces/page-state.js +43 -0
- package/dist/surfaces/page-state.js.map +1 -0
- package/dist/surfaces/preference.d.ts +33 -0
- package/dist/surfaces/preference.d.ts.map +1 -0
- package/dist/surfaces/preference.js +72 -0
- package/dist/surfaces/preference.js.map +1 -0
- package/dist/surfaces/registered.d.ts +33 -0
- package/dist/surfaces/registered.d.ts.map +1 -0
- package/dist/surfaces/registered.js +51 -0
- package/dist/surfaces/registered.js.map +1 -0
- package/dist/surfaces/scripts.d.ts +86 -0
- package/dist/surfaces/scripts.d.ts.map +1 -0
- package/dist/surfaces/scripts.js +28 -0
- package/dist/surfaces/scripts.js.map +1 -0
- package/dist/surfaces/theme-choice.d.ts +32 -0
- package/dist/surfaces/theme-choice.d.ts.map +1 -0
- package/dist/surfaces/theme-choice.js +18 -0
- package/dist/surfaces/theme-choice.js.map +1 -0
- package/dist/surfaces/themes.d.ts +43 -0
- package/dist/surfaces/themes.d.ts.map +1 -0
- package/dist/surfaces/themes.js +110 -0
- package/dist/surfaces/themes.js.map +1 -0
- package/dist/surfaces/translations.d.ts +29 -0
- package/dist/surfaces/translations.d.ts.map +1 -0
- package/dist/surfaces/translations.js +57 -0
- package/dist/surfaces/translations.js.map +1 -0
- package/dist/surfaces/variant.d.ts +23 -0
- package/dist/surfaces/variant.d.ts.map +1 -0
- package/dist/surfaces/variant.js +18 -0
- package/dist/surfaces/variant.js.map +1 -0
- package/dist/sync/batch.d.ts +18 -0
- package/dist/sync/batch.d.ts.map +1 -0
- package/dist/sync/batch.js +125 -0
- package/dist/sync/batch.js.map +1 -0
- package/dist/sync/client.d.ts +169 -0
- package/dist/sync/client.d.ts.map +1 -0
- package/dist/sync/client.js +459 -0
- package/dist/sync/client.js.map +1 -0
- package/dist/sync/files.d.ts +46 -0
- package/dist/sync/files.d.ts.map +1 -0
- package/dist/sync/files.js +13 -0
- package/dist/sync/files.js.map +1 -0
- package/dist/sync/filesystem.d.ts +37 -0
- package/dist/sync/filesystem.d.ts.map +1 -0
- package/dist/sync/filesystem.js +205 -0
- package/dist/sync/filesystem.js.map +1 -0
- package/dist/sync/index.d.ts +8 -0
- package/dist/sync/index.d.ts.map +1 -0
- package/dist/sync/index.js +9 -0
- package/dist/sync/index.js.map +1 -0
- package/dist/sync/lines.d.ts +18 -0
- package/dist/sync/lines.d.ts.map +1 -0
- package/dist/sync/lines.js +46 -0
- package/dist/sync/lines.js.map +1 -0
- package/dist/sync/remote.d.ts +145 -0
- package/dist/sync/remote.d.ts.map +1 -0
- package/dist/sync/remote.js +59 -0
- package/dist/sync/remote.js.map +1 -0
- package/dist/sync/state.d.ts +17 -0
- package/dist/sync/state.d.ts.map +1 -0
- package/dist/sync/state.js +40 -0
- package/dist/sync/state.js.map +1 -0
- package/dist/telemetry-ingest/batch.d.ts +73 -0
- package/dist/telemetry-ingest/batch.d.ts.map +1 -0
- package/dist/telemetry-ingest/batch.js +110 -0
- package/dist/telemetry-ingest/batch.js.map +1 -0
- package/dist/telemetry-ingest/facet.d.ts +26 -0
- package/dist/telemetry-ingest/facet.d.ts.map +1 -0
- package/dist/telemetry-ingest/facet.js +100 -0
- package/dist/telemetry-ingest/facet.js.map +1 -0
- package/dist/telemetry-ingest/index.d.ts +5 -0
- package/dist/telemetry-ingest/index.d.ts.map +1 -0
- package/dist/telemetry-ingest/index.js +8 -0
- package/dist/telemetry-ingest/index.js.map +1 -0
- package/dist/telemetry-ingest/recorder.d.ts +50 -0
- package/dist/telemetry-ingest/recorder.d.ts.map +1 -0
- package/dist/telemetry-ingest/recorder.js +298 -0
- package/dist/telemetry-ingest/recorder.js.map +1 -0
- package/dist/telemetry-ingest/sender.d.ts +14 -0
- package/dist/telemetry-ingest/sender.d.ts.map +1 -0
- package/dist/telemetry-ingest/sender.js +64 -0
- package/dist/telemetry-ingest/sender.js.map +1 -0
- package/dist/telemetry-sqlite/index.d.ts +33 -0
- package/dist/telemetry-sqlite/index.d.ts.map +1 -0
- package/dist/telemetry-sqlite/index.js +113 -0
- package/dist/telemetry-sqlite/index.js.map +1 -0
- package/dist/telemetry-sqlite/node.d.ts +13 -0
- package/dist/telemetry-sqlite/node.d.ts.map +1 -0
- package/dist/telemetry-sqlite/node.js +27 -0
- package/dist/telemetry-sqlite/node.js.map +1 -0
- package/dist/telemetry-sqlite/schema.d.ts +9 -0
- package/dist/telemetry-sqlite/schema.d.ts.map +1 -0
- package/dist/telemetry-sqlite/schema.js +61 -0
- package/dist/telemetry-sqlite/schema.js.map +1 -0
- package/dist/telemetry-sqlite/store.d.ts +12 -0
- package/dist/telemetry-sqlite/store.d.ts.map +1 -0
- package/dist/telemetry-sqlite/store.js +121 -0
- package/dist/telemetry-sqlite/store.js.map +1 -0
- package/dist/telemetry.d.ts +1013 -0
- package/dist/telemetry.d.ts.map +1 -0
- package/dist/telemetry.js +518 -0
- package/dist/telemetry.js.map +1 -0
- package/dist/tui/bridge.d.ts +112 -0
- package/dist/tui/bridge.d.ts.map +1 -0
- package/dist/tui/bridge.js +9 -0
- package/dist/tui/bridge.js.map +1 -0
- package/dist/tui/channel.d.ts +44 -0
- package/dist/tui/channel.d.ts.map +1 -0
- package/dist/tui/channel.js +150 -0
- package/dist/tui/channel.js.map +1 -0
- package/dist/tui/frames.d.ts +5 -0
- package/dist/tui/frames.d.ts.map +1 -0
- package/dist/tui/frames.js +52 -0
- package/dist/tui/frames.js.map +1 -0
- package/dist/tui/index.d.ts +8 -0
- package/dist/tui/index.d.ts.map +1 -0
- package/dist/tui/index.js +8 -0
- package/dist/tui/index.js.map +1 -0
- package/dist/tui/runtime.d.ts +46 -0
- package/dist/tui/runtime.d.ts.map +1 -0
- package/dist/tui/runtime.js +101 -0
- package/dist/tui/runtime.js.map +1 -0
- package/dist/tui/scope.d.ts +62 -0
- package/dist/tui/scope.d.ts.map +1 -0
- package/dist/tui/scope.js +173 -0
- package/dist/tui/scope.js.map +1 -0
- package/dist/tui/terminal.d.ts +15 -0
- package/dist/tui/terminal.d.ts.map +1 -0
- package/dist/tui/terminal.js +37 -0
- package/dist/tui/terminal.js.map +1 -0
- package/dist/tui/theme.d.ts +17 -0
- package/dist/tui/theme.d.ts.map +1 -0
- package/dist/tui/theme.js +38 -0
- package/dist/tui/theme.js.map +1 -0
- package/dist/watch.d.ts +194 -0
- package/dist/watch.d.ts.map +1 -0
- package/dist/watch.js +383 -0
- package/dist/watch.js.map +1 -0
- package/dist/web/environment.d.ts +4 -0
- package/dist/web/environment.d.ts.map +1 -0
- package/dist/web/environment.js +37 -0
- package/dist/web/environment.js.map +1 -0
- package/dist/web/index.d.ts +5 -0
- package/dist/web/index.d.ts.map +1 -0
- package/dist/web/index.js +7 -0
- package/dist/web/index.js.map +1 -0
- package/dist/web/language.d.ts +7 -0
- package/dist/web/language.d.ts.map +1 -0
- package/dist/web/language.js +21 -0
- package/dist/web/language.js.map +1 -0
- package/dist/web/page.d.ts +42 -0
- package/dist/web/page.d.ts.map +1 -0
- package/dist/web/page.js +96 -0
- package/dist/web/page.js.map +1 -0
- package/dist/web/scripts.d.ts +23 -0
- package/dist/web/scripts.d.ts.map +1 -0
- package/dist/web/scripts.js +50 -0
- package/dist/web/scripts.js.map +1 -0
- package/dist/web/styles.d.ts +17 -0
- package/dist/web/styles.d.ts.map +1 -0
- package/dist/web/styles.js +218 -0
- package/dist/web/styles.js.map +1 -0
- package/dist/web/themes.d.ts +6 -0
- package/dist/web/themes.d.ts.map +1 -0
- package/dist/web/themes.js +31 -0
- package/dist/web/themes.js.map +1 -0
- package/docs/admission/design.md +178 -0
- package/docs/benchmarks.md +1182 -0
- package/docs/decisions.md +3760 -0
- package/docs/dependencies/book.md +1671 -0
- package/docs/dependencies/index.html +2641 -0
- package/docs/dependencies/model.md +330 -0
- package/docs/design.md +3691 -0
- package/docs/durable-observers/book.md +432 -0
- package/docs/durable-observers/index.html +517 -0
- package/docs/events/spec.md +438 -0
- package/docs/flow-control/book.md +333 -0
- package/docs/flow-control/fold/index.html +265 -0
- package/docs/flow-control/index.html +548 -0
- package/docs/flow-control/window/index.html +228 -0
- package/docs/guide-plugins-hosts/book.md +958 -0
- package/docs/guide-plugins-hosts/index.html +952 -0
- package/docs/host-keyed/spec.md +343 -0
- package/docs/http-workers/book.md +378 -0
- package/docs/http-workers/index.html +515 -0
- package/docs/i18n/book.md +217 -0
- package/docs/i18n/index.html +344 -0
- package/docs/layer-1.md +311 -0
- package/docs/layer-2.md +216 -0
- package/docs/p3-features/README.md +6 -0
- package/docs/p3-features/book.md +478 -0
- package/docs/plugin-authoring.md +389 -0
- package/docs/plugin-model/book.md +186 -0
- package/docs/plugin-model/index.html +310 -0
- package/docs/plugin-primer/book.md +273 -0
- package/docs/plugin-primer/index.html +430 -0
- package/docs/shared-holds/design.md +339 -0
- package/docs/slice-1.md +236 -0
- package/docs/slice-10.md +288 -0
- package/docs/slice-11.md +114 -0
- package/docs/slice-12.md +132 -0
- package/docs/slice-13.md +121 -0
- package/docs/slice-14-design.md +213 -0
- package/docs/slice-14.md +861 -0
- package/docs/slice-2.md +174 -0
- package/docs/slice-3a.md +296 -0
- package/docs/slice-3b.md +197 -0
- package/docs/slice-4.md +146 -0
- package/docs/slice-4a.md +418 -0
- package/docs/slice-4b.md +208 -0
- package/docs/slice-5.md +281 -0
- package/docs/slice-6a.md +676 -0
- package/docs/slice-6b.md +332 -0
- package/docs/slice-7a.md +130 -0
- package/docs/slice-7b/book.md +608 -0
- package/docs/slice-7b/index.html +842 -0
- package/docs/slice-7b.md +255 -0
- package/docs/slice-7c.md +165 -0
- package/docs/slice-8.md +194 -0
- package/docs/slice-9.md +110 -0
- package/docs/slices.md +380 -0
- package/docs/store/book.md +670 -0
- package/docs/store/index.html +861 -0
- package/docs/store/walkthrough.md +193 -0
- package/docs/theming/book.md +223 -0
- package/docs/theming/index.html +371 -0
- package/docs/tutorial/book.md +2170 -0
- package/docs/tutorial/index.html +2112 -0
- package/docs/tutorial/screens/click-after.png +0 -0
- package/docs/tutorial/screens/click-before.png +0 -0
- package/docs/tutorial/screens/edited.png +0 -0
- package/docs/tutorial/screens/french.png +0 -0
- package/docs/tutorial/screens/harbor.png +0 -0
- package/docs/tutorial/screens/page.png +0 -0
- package/docs/tutorial/screens/traces-ada.png +0 -0
- package/docs/tutorial/screens/traces.png +0 -0
- package/package.json +200 -5
- package/src/delta/README.md +262 -0
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
// Named queries (slice 14 §3.1): what `self.queries(table, options, builders)` returns, one `OwnQuery` per name, and
|
|
2
|
+
// what a reference shows for a `queries` member, one `ReferenceQuery` per name. A reader (`self.liveQuery`,
|
|
3
|
+
// `self.count`, `self.list`, `page`) asks either for the provider's declaration, checks its arguments, builds the
|
|
4
|
+
// query and reads it through the store.
|
|
5
|
+
import { check, validatorFor } from "../data/internal.js";
|
|
6
|
+
import { partnerName } from "../store/expression.js";
|
|
7
|
+
import { readPage } from "../store/page.js";
|
|
8
|
+
import { Query } from "../store/query.js";
|
|
9
|
+
import { ReadPlan } from "../store/read-plan.js";
|
|
10
|
+
import { decodeScalar, versionColumn } from "../store/rows.js";
|
|
11
|
+
/** A named query as readers hold it: its owner's declaration, or a reference's member. */
|
|
12
|
+
export class NamedQueryHandle {
|
|
13
|
+
/** Up to `limit` items for `args` (after `options.after`), and the cursor of the next page when there is one. */
|
|
14
|
+
page(args, limit, context, options = {}) {
|
|
15
|
+
return this.provided().pageOf(args, limit, context, options.after);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
const NEVER_MOVES = () => { };
|
|
19
|
+
/**
|
|
20
|
+
* A named query as its owner declared it: the table, the builder, the schema its arguments are checked by (the
|
|
21
|
+
* contract's when the query is listed there, its own otherwise), the columns its mapping gets and the mapping.
|
|
22
|
+
*/
|
|
23
|
+
export class OwnQuery extends NamedQueryHandle {
|
|
24
|
+
label;
|
|
25
|
+
handle;
|
|
26
|
+
#builder;
|
|
27
|
+
#projection;
|
|
28
|
+
#map;
|
|
29
|
+
/** The schema of its arguments: its own (a private query), or the contract's once its member was checked. */
|
|
30
|
+
#args;
|
|
31
|
+
#listed = false;
|
|
32
|
+
constructor(owner, name, handle, builder, options, args) {
|
|
33
|
+
super();
|
|
34
|
+
this.label = `${owner}: query "${name}"`;
|
|
35
|
+
this.handle = handle;
|
|
36
|
+
this.#builder = builder;
|
|
37
|
+
this.#projection = {
|
|
38
|
+
...(options.reads === undefined ? {} : { reads: options.reads }),
|
|
39
|
+
...(options.partnerReads === undefined ? {} : { partnerReads: options.partnerReads }),
|
|
40
|
+
};
|
|
41
|
+
this.#map = options.map;
|
|
42
|
+
this.#args = args;
|
|
43
|
+
}
|
|
44
|
+
/** Whether its arguments have a schema: its own, or the contract's. */
|
|
45
|
+
get checked() {
|
|
46
|
+
return this.#args !== undefined;
|
|
47
|
+
}
|
|
48
|
+
provided() {
|
|
49
|
+
return this;
|
|
50
|
+
}
|
|
51
|
+
follow() {
|
|
52
|
+
return NEVER_MOVES;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* The contract lists this query with the argument schema `args` (the member check): a listed query brings no
|
|
56
|
+
* schema of its own (declaration policy).
|
|
57
|
+
*/
|
|
58
|
+
listed(args) {
|
|
59
|
+
if (this.#listed)
|
|
60
|
+
return;
|
|
61
|
+
if (this.#args !== undefined)
|
|
62
|
+
throw new Error(`${this.label}: the contract has its argument schema; give only the builder`);
|
|
63
|
+
this.#args = args;
|
|
64
|
+
this.#listed = true;
|
|
65
|
+
}
|
|
66
|
+
/** What reading this query for `args` reads: `args` checked (a trust boundary), the query built and checked. */
|
|
67
|
+
target(args, context) {
|
|
68
|
+
const query = this.#build(args, context);
|
|
69
|
+
const { handle } = this;
|
|
70
|
+
const spec = { query, table: handle.sql.table, projection: this.#projection, owner: handle };
|
|
71
|
+
return { spec, decode: (stored, decoding) => this.#decode(query, stored, decoding) };
|
|
72
|
+
}
|
|
73
|
+
/** One page, read once: not live. */
|
|
74
|
+
async pageOf(args, limit, context, after) {
|
|
75
|
+
const { handle } = this;
|
|
76
|
+
handle.owner.assertLive();
|
|
77
|
+
const query = this.#build(args, context);
|
|
78
|
+
const plan = new ReadPlan(query, handle.sql.table, this.#projection, "rows", handle.store.reads);
|
|
79
|
+
const page = await readPage(handle.store, plan, limit, after, context);
|
|
80
|
+
const items = page.stored.map((row) => this.#decode(query, row, context));
|
|
81
|
+
return page.next === undefined ? { items } : { items, next: page.next };
|
|
82
|
+
}
|
|
83
|
+
#build(args, context) {
|
|
84
|
+
const schema = this.#args;
|
|
85
|
+
// Declaration policy: a query the contract does not list brings its schema (`name: [argsSchema, builder]`).
|
|
86
|
+
if (schema === undefined)
|
|
87
|
+
throw new Error(`${this.label}: a private query brings its argument schema`);
|
|
88
|
+
check(validatorFor(schema, context), args, "args", context);
|
|
89
|
+
// The builder is plugin code: what it returns is checked.
|
|
90
|
+
const built = this.#builder(args);
|
|
91
|
+
if (!(built instanceof Query) || built.table !== this.handle.definition) {
|
|
92
|
+
throw new Error(`${this.label}: the builder returns a query of table "${this.handle.definition.name}"`);
|
|
93
|
+
}
|
|
94
|
+
return built;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* A stored row as readers get it: the row (and partner) decoded and mapped. The statement also selects what the
|
|
98
|
+
* store needs (the key, the order and match columns): the mapping gets only the columns `reads` and
|
|
99
|
+
* `partnerReads` list, so a column it does not declare is absent, at once and visibly.
|
|
100
|
+
*/
|
|
101
|
+
#decode(query, stored, context) {
|
|
102
|
+
const { reads, partnerReads } = this.#projection;
|
|
103
|
+
const { definition } = this.handle;
|
|
104
|
+
const own = reads === undefined ? stored : projected(stored, reads);
|
|
105
|
+
const row = definition.rows.decode(own, context);
|
|
106
|
+
const joined = query.joined;
|
|
107
|
+
const map = this.#map;
|
|
108
|
+
// A table's rows hold its columns' values (scalars and JSON); a mapping's result is the item (its contract's).
|
|
109
|
+
if (map === undefined)
|
|
110
|
+
return row;
|
|
111
|
+
return map(row, joined === undefined ? NO_PARTNER : partnerRow(joined.set, partnerReads, stored));
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
const NO_PARTNER = {};
|
|
115
|
+
/** The columns `names` of `stored`, each `json(...)` one with its version column. */
|
|
116
|
+
function projected(stored, names) {
|
|
117
|
+
const row = {};
|
|
118
|
+
for (const name of names) {
|
|
119
|
+
row[name] = stored[name];
|
|
120
|
+
const version = stored[versionColumn(name)];
|
|
121
|
+
if (version !== undefined)
|
|
122
|
+
row[versionColumn(name)] = version;
|
|
123
|
+
}
|
|
124
|
+
return row;
|
|
125
|
+
}
|
|
126
|
+
/** The joined set's columns `names` (all without) of `stored` (named `<set>:<column>` there), decoded. */
|
|
127
|
+
function partnerRow(set, names, stored) {
|
|
128
|
+
const row = {};
|
|
129
|
+
for (const name of names ?? set.byName.keys()) {
|
|
130
|
+
const value = stored[partnerName(set.name, name)];
|
|
131
|
+
// A set's columns are scalar (`defineColumns` refuses `json(...)`).
|
|
132
|
+
if (value !== null && value !== undefined)
|
|
133
|
+
row[name] = decodeScalar(set.byName.get(name), value);
|
|
134
|
+
}
|
|
135
|
+
return row;
|
|
136
|
+
}
|
|
137
|
+
/** A named query of a reference's `queries` member: the provider's declaration of that name, while it is live. */
|
|
138
|
+
export class ReferenceQuery extends NamedQueryHandle {
|
|
139
|
+
label;
|
|
140
|
+
#binding;
|
|
141
|
+
#member;
|
|
142
|
+
#name;
|
|
143
|
+
constructor(binding, member, name) {
|
|
144
|
+
super();
|
|
145
|
+
this.label = `${binding.label}: query "${member}.${name}"`;
|
|
146
|
+
this.#binding = binding;
|
|
147
|
+
this.#member = member;
|
|
148
|
+
this.#name = name;
|
|
149
|
+
}
|
|
150
|
+
provided() {
|
|
151
|
+
return this.#binding.queryMember(this.#member, this.#name);
|
|
152
|
+
}
|
|
153
|
+
follow(moved) {
|
|
154
|
+
return this.#binding.followInstance(moved);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
/** The named queries of `value` when it is what `self.queries` returned: an object of `OwnQuery`s. */
|
|
158
|
+
export function ownQueries(value) {
|
|
159
|
+
if (typeof value !== "object" || value === null)
|
|
160
|
+
return undefined;
|
|
161
|
+
const entries = Object.entries(value);
|
|
162
|
+
if (!entries.every(([, each]) => each instanceof OwnQuery))
|
|
163
|
+
return undefined;
|
|
164
|
+
return new Map(entries);
|
|
165
|
+
}
|
|
166
|
+
//# sourceMappingURL=named-query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"named-query.js","sourceRoot":"","sources":["../../src/host/named-query.ts"],"names":[],"mappings":"AAAA,qHAAqH;AACrH,4GAA4G;AAC5G,kHAAkH;AAClH,wCAAwC;AAKxC,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAI1D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AG,MAAM,CAAC;QACtB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,QAAQ;QACP,OAAO,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IAC5D,CAAC;IAED,MAAM,CAAC,KAAiB;QACvB,OAAO,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IAC5C,CAAC;CACD;AAED,sGAAsG;AACtG,MAAM,UAAU,UAAU,CAAC,KAAc;IACxC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,SAAS,CAAC;IAClE,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACtC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,YAAY,QAAQ,CAAC;QAAE,OAAO,SAAS,CAAC;IAC7E,OAAO,IAAI,GAAG,CAAC,OAA+B,CAAC,CAAC;AACjD,CAAC","sourcesContent":["// Named queries (slice 14 §3.1): what `self.queries(table, options, builders)` returns, one `OwnQuery` per name, and\n// what a reference shows for a `queries` member, one `ReferenceQuery` per name. A reader (`self.liveQuery`,\n// `self.count`, `self.list`, `page`) asks either for the provider's declaration, checks its arguments, builds the\n// query and reads it through the store.\n\nimport type { Context } from \"../context/index.ts\";\nimport type { QueryPage } from \"../contracts/index.ts\";\nimport type { Snapshot } from \"../contracts/internal.ts\";\nimport { check, validatorFor } from \"../data/internal.ts\";\nimport type { JsonValue } from \"../json.ts\";\nimport type { ColumnSet } from \"../store/column-set.ts\";\nimport type { ScalarColumn } from \"../store/columns.ts\";\nimport { partnerName } from \"../store/expression.ts\";\nimport type { LiveTarget } from \"../store/live-query.ts\";\nimport { readPage } from \"../store/page.ts\";\nimport { Query } from \"../store/query.ts\";\nimport { type Projection, ReadPlan, type StoredRead } from \"../store/read-plan.ts\";\nimport { decodeScalar, versionColumn } from \"../store/rows.ts\";\nimport type { TableHandle } from \"../store/table-handle.ts\";\nimport type { Binding } from \"./reference.ts\";\n\n/** A row of a joined set as a mapping gets it: the projected columns, decoded. */\nexport type PartnerRow = { readonly [column: string]: unknown };\n\n/** What `self.queries` takes besides the table and the builders. */\nexport type QueriesOptions<R, T> = {\n\t/** Maps a row (and, for a joined query, its partner) to the item readers get; the row itself when left out. */\n\treadonly map?: (row: R, partner: PartnerRow) => T;\n\t/** The columns of the table `map` gets: only these (a change of another is no change of the item). All by default. */\n\treadonly reads?: readonly string[];\n\t/** The columns of a joined set `map` gets. All by default. */\n\treadonly partnerReads?: readonly string[];\n};\n\n/** A named query as readers hold it: its owner's declaration, or a reference's member. */\nexport abstract class NamedQueryHandle {\n\t/** The query in errors and reports: its name, with its member for a reference's. */\n\tabstract readonly label: string;\n\n\t/** The provider's declaration; throws while the provider is not live (a reference's state says why). */\n\tabstract provided(): OwnQuery;\n\n\t/** Calls `moved` whenever another instance of the provider is live, until the returned release. */\n\tabstract follow(moved: () => void): () => void;\n\n\t/** Up to `limit` items for `args` (after `options.after`), and the cursor of the next page when there is one. */\n\tpage(\n\t\targs: unknown,\n\t\tlimit: number,\n\t\tcontext: Context,\n\t\toptions: { readonly after?: string } = {},\n\t): Promise<QueryPage<JsonValue>> {\n\t\treturn this.provided().pageOf(args, limit, context, options.after);\n\t}\n}\n\nconst NEVER_MOVES = (): void => {};\n\n/**\n * A named query as its owner declared it: the table, the builder, the schema its arguments are checked by (the\n * contract's when the query is listed there, its own otherwise), the columns its mapping gets and the mapping.\n */\nexport class OwnQuery extends NamedQueryHandle {\n\treadonly label: string;\n\treadonly handle: TableHandle;\n\treadonly #builder: (args: unknown) => unknown;\n\treadonly #projection: Projection;\n\treadonly #map: ((row: unknown, partner: PartnerRow) => unknown) | undefined;\n\t/** The schema of its arguments: its own (a private query), or the contract's once its member was checked. */\n\t#args: Snapshot | undefined;\n\t#listed = false;\n\n\tconstructor(\n\t\towner: string,\n\t\tname: string,\n\t\thandle: TableHandle,\n\t\tbuilder: (args: unknown) => unknown,\n\t\toptions: QueriesOptions<unknown, unknown>,\n\t\targs: Snapshot | undefined,\n\t) {\n\t\tsuper();\n\t\tthis.label = `${owner}: query \"${name}\"`;\n\t\tthis.handle = handle;\n\t\tthis.#builder = builder;\n\t\tthis.#projection = {\n\t\t\t...(options.reads === undefined ? {} : { reads: options.reads }),\n\t\t\t...(options.partnerReads === undefined ? {} : { partnerReads: options.partnerReads }),\n\t\t};\n\t\tthis.#map = options.map;\n\t\tthis.#args = args;\n\t}\n\n\t/** Whether its arguments have a schema: its own, or the contract's. */\n\tget checked(): boolean {\n\t\treturn this.#args !== undefined;\n\t}\n\n\tprovided(): OwnQuery {\n\t\treturn this;\n\t}\n\n\tfollow(): () => void {\n\t\treturn NEVER_MOVES;\n\t}\n\n\t/**\n\t * The contract lists this query with the argument schema `args` (the member check): a listed query brings no\n\t * schema of its own (declaration policy).\n\t */\n\tlisted(args: Snapshot): void {\n\t\tif (this.#listed) return;\n\t\tif (this.#args !== undefined)\n\t\t\tthrow new Error(`${this.label}: the contract has its argument schema; give only the builder`);\n\t\tthis.#args = args;\n\t\tthis.#listed = true;\n\t}\n\n\t/** What reading this query for `args` reads: `args` checked (a trust boundary), the query built and checked. */\n\ttarget(args: unknown, context: Context): LiveTarget {\n\t\tconst query = this.#build(args, context);\n\t\tconst { handle } = this;\n\t\tconst spec = { query, table: handle.sql.table, projection: this.#projection, owner: handle };\n\t\treturn { spec, decode: (stored, decoding) => this.#decode(query, stored, decoding) };\n\t}\n\n\t/** One page, read once: not live. */\n\tasync pageOf(\n\t\targs: unknown,\n\t\tlimit: number,\n\t\tcontext: Context,\n\t\tafter: string | undefined,\n\t): Promise<QueryPage<JsonValue>> {\n\t\tconst { handle } = this;\n\t\thandle.owner.assertLive();\n\t\tconst query = this.#build(args, context);\n\t\tconst plan = new ReadPlan(query, handle.sql.table, this.#projection, \"rows\", handle.store.reads);\n\t\tconst page = await readPage(handle.store, plan, limit, after, context);\n\t\tconst items = page.stored.map((row) => this.#decode(query, row, context));\n\t\treturn page.next === undefined ? { items } : { items, next: page.next };\n\t}\n\n\t#build(args: unknown, context: Context): Query {\n\t\tconst schema = this.#args;\n\t\t// Declaration policy: a query the contract does not list brings its schema (`name: [argsSchema, builder]`).\n\t\tif (schema === undefined) throw new Error(`${this.label}: a private query brings its argument schema`);\n\t\tcheck(validatorFor(schema, context), args, \"args\", context);\n\t\t// The builder is plugin code: what it returns is checked.\n\t\tconst built = this.#builder(args);\n\t\tif (!(built instanceof Query) || built.table !== this.handle.definition) {\n\t\t\tthrow new Error(`${this.label}: the builder returns a query of table \"${this.handle.definition.name}\"`);\n\t\t}\n\t\treturn built;\n\t}\n\n\t/**\n\t * A stored row as readers get it: the row (and partner) decoded and mapped. The statement also selects what the\n\t * store needs (the key, the order and match columns): the mapping gets only the columns `reads` and\n\t * `partnerReads` list, so a column it does not declare is absent, at once and visibly.\n\t */\n\t#decode(query: Query, stored: StoredRead, context: Context): JsonValue {\n\t\tconst { reads, partnerReads } = this.#projection;\n\t\tconst { definition } = this.handle;\n\t\tconst own = reads === undefined ? stored : projected(stored, reads);\n\t\tconst row = definition.rows.decode(own, context);\n\t\tconst joined = query.joined;\n\t\tconst map = this.#map;\n\t\t// A table's rows hold its columns' values (scalars and JSON); a mapping's result is the item (its contract's).\n\t\tif (map === undefined) return row as JsonValue;\n\t\treturn map(row, joined === undefined ? NO_PARTNER : partnerRow(joined.set, partnerReads, stored)) as JsonValue;\n\t}\n}\n\nconst NO_PARTNER: PartnerRow = {};\n\n/** The columns `names` of `stored`, each `json(...)` one with its version column. */\nfunction projected(stored: StoredRead, names: readonly string[]): StoredRead {\n\tconst row: { [column: string]: StoredRead[string] } = {};\n\tfor (const name of names) {\n\t\trow[name] = stored[name]!;\n\t\tconst version = stored[versionColumn(name)];\n\t\tif (version !== undefined) row[versionColumn(name)] = version;\n\t}\n\treturn row;\n}\n\n/** The joined set's columns `names` (all without) of `stored` (named `<set>:<column>` there), decoded. */\nfunction partnerRow(set: ColumnSet, names: readonly string[] | undefined, stored: StoredRead): PartnerRow {\n\tconst row: { [column: string]: unknown } = {};\n\tfor (const name of names ?? set.byName.keys()) {\n\t\tconst value = stored[partnerName(set.name, name)];\n\t\t// A set's columns are scalar (`defineColumns` refuses `json(...)`).\n\t\tif (value !== null && value !== undefined) row[name] = decodeScalar(set.byName.get(name) as ScalarColumn, value);\n\t}\n\treturn row;\n}\n\n/** A named query of a reference's `queries` member: the provider's declaration of that name, while it is live. */\nexport class ReferenceQuery extends NamedQueryHandle {\n\treadonly label: string;\n\treadonly #binding: Binding;\n\treadonly #member: string;\n\treadonly #name: string;\n\n\tconstructor(binding: Binding, member: string, name: string) {\n\t\tsuper();\n\t\tthis.label = `${binding.label}: query \"${member}.${name}\"`;\n\t\tthis.#binding = binding;\n\t\tthis.#member = member;\n\t\tthis.#name = name;\n\t}\n\n\tprovided(): OwnQuery {\n\t\treturn this.#binding.queryMember(this.#member, this.#name);\n\t}\n\n\tfollow(moved: () => void): () => void {\n\t\treturn this.#binding.followInstance(moved);\n\t}\n}\n\n/** The named queries of `value` when it is what `self.queries` returned: an object of `OwnQuery`s. */\nexport function ownQueries(value: unknown): ReadonlyMap<string, OwnQuery> | undefined {\n\tif (typeof value !== \"object\" || value === null) return undefined;\n\tconst entries = Object.entries(value);\n\tif (!entries.every(([, each]) => each instanceof OwnQuery)) return undefined;\n\treturn new Map(entries as [string, OwnQuery][]);\n}\n"]}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { TelemetryContext } from "@diffra-ai/telemetry";
|
|
2
|
+
import { type Context } from "../context/index.ts";
|
|
3
|
+
import type { HostError } from "./host.ts";
|
|
4
|
+
/** Why a native closes: its object ended or its attempt failed (`end`), the host closes (`close`), a reload (slice 7). */
|
|
5
|
+
export type NativeCloseReason = {
|
|
6
|
+
readonly kind: "end";
|
|
7
|
+
} | {
|
|
8
|
+
readonly kind: "close";
|
|
9
|
+
} | {
|
|
10
|
+
readonly kind: "reload";
|
|
11
|
+
};
|
|
12
|
+
/** A native's handle. */
|
|
13
|
+
export interface Native<T> {
|
|
14
|
+
/** The opened value: throws `not_ready` until its open resolved and `released` once its close started. */
|
|
15
|
+
readonly value: T;
|
|
16
|
+
}
|
|
17
|
+
/** What `self.open` takes besides the open and the close. */
|
|
18
|
+
export type NativeOptions = {
|
|
19
|
+
/** How long its close may take; the host's `closeTimeout` by default. */
|
|
20
|
+
readonly closeTimeout?: number;
|
|
21
|
+
};
|
|
22
|
+
/** A close that threw, as reported. */
|
|
23
|
+
export type CloseFailed = Extract<HostError, {
|
|
24
|
+
readonly kind: "close_failed";
|
|
25
|
+
}>;
|
|
26
|
+
/**
|
|
27
|
+
* Where a native belongs: its object's label, type and its position in declaration order (from 1) for errors, reports
|
|
28
|
+
* and spans, the object's context (every close runs under it, never under the aborted opener's), the host's telemetry
|
|
29
|
+
* adapter (a close is a root span), and where it reports.
|
|
30
|
+
*/
|
|
31
|
+
type NativeOwner = {
|
|
32
|
+
readonly object: string;
|
|
33
|
+
readonly type: string;
|
|
34
|
+
readonly position: number;
|
|
35
|
+
readonly context: Context;
|
|
36
|
+
readonly telemetry: TelemetryContext;
|
|
37
|
+
/** Its host's `chord.host`. */
|
|
38
|
+
readonly host: string;
|
|
39
|
+
readonly report: (error: HostError) => void;
|
|
40
|
+
};
|
|
41
|
+
/** What an attempt does with each of its natives, whatever their value's type. */
|
|
42
|
+
export interface NativeSlot {
|
|
43
|
+
open(context: Context): Promise<void>;
|
|
44
|
+
close(reason: NativeCloseReason): Promise<CloseFailed | undefined>;
|
|
45
|
+
}
|
|
46
|
+
/** One native of one attempt: opened at most once, closed exactly once. */
|
|
47
|
+
export declare class NativeHandle<T> implements Native<T>, NativeSlot {
|
|
48
|
+
#private;
|
|
49
|
+
constructor(open: (context: Context) => Promise<T>, close: (value: T, reason: NativeCloseReason, context: Context) => void | Promise<void>, closeTimeout: number, owner: NativeOwner);
|
|
50
|
+
get value(): T;
|
|
51
|
+
/**
|
|
52
|
+
* Opens the value in its `chord.open` span (under `context`'s, its attempt's); one that arrives after its attempt was
|
|
53
|
+
* abandoned is closed at once, a failure reported.
|
|
54
|
+
*/
|
|
55
|
+
open(context: Context): Promise<void>;
|
|
56
|
+
/** Closes the value if it is open (a pending open's value is closed when it arrives); resolves with a throw. */
|
|
57
|
+
close(reason: NativeCloseReason): Promise<CloseFailed | undefined>;
|
|
58
|
+
}
|
|
59
|
+
/** Whether `promise` settled within `ms` (it rejects when `promise` does first); `promise` itself runs on. */
|
|
60
|
+
export declare function within(promise: Promise<unknown>, ms: number): Promise<"settled" | "timeout">;
|
|
61
|
+
/** Whether the `size` pieces of work in `drain` settled within `ms` (at once when there is none). */
|
|
62
|
+
export declare function drained(drain: Iterable<Promise<unknown>>, size: number, ms: number): Promise<"settled" | "timeout">;
|
|
63
|
+
export {};
|
|
64
|
+
//# sourceMappingURL=native.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native.d.ts","sourceRoot":"","sources":["../../src/host/native.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,KAAK,OAAO,EAAkC,MAAM,qBAAqB,CAAC;AAGnF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,0HAA0H;AAC1H,MAAM,MAAM,iBAAiB,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAA;CAAE,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC;AAEpH,yBAAyB;AACzB,MAAM,WAAW,MAAM,CAAC,CAAC;IACxB,0GAA0G;IAC1G,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;CA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;IAED,IAAI,KAAK,IAAI,CAAC,CAQb;IAED;;;OAGG;IACG,IAAI,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAmB1C;IAED,gHAAgH;IAC1G,KAAK,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC,CAIvE;CAiDD;AAED,8GAA8G;AAC9G,wBAAsB,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAUlG;AAED,qGAAqG;AACrG,wBAAsB,OAAO,CAC5B,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,EACjC,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,GACR,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAEhC"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
// Natives (§13): the handle `self.open` returns, a value opened during activation and closed with a reason when its
|
|
2
|
+
// attempt ends; `within`, which bounds a close or a drain by a timeout; and the drain's admission of running work.
|
|
3
|
+
import { withAbortSignal, withTelemetry } from "../context/index.js";
|
|
4
|
+
import { ChordError } from "../data/index.js";
|
|
5
|
+
import { chordSpans, ended, spanFailed, untraced } from "../telemetry.js";
|
|
6
|
+
/** One native of one attempt: opened at most once, closed exactly once. */
|
|
7
|
+
export class NativeHandle {
|
|
8
|
+
#open;
|
|
9
|
+
#close;
|
|
10
|
+
#closeTimeout;
|
|
11
|
+
#owner;
|
|
12
|
+
#state = { kind: "unopened" };
|
|
13
|
+
constructor(open, close, closeTimeout, owner) {
|
|
14
|
+
this.#open = open;
|
|
15
|
+
this.#close = close;
|
|
16
|
+
this.#closeTimeout = closeTimeout;
|
|
17
|
+
this.#owner = owner;
|
|
18
|
+
}
|
|
19
|
+
get value() {
|
|
20
|
+
const state = this.#state;
|
|
21
|
+
if (state.kind === "open")
|
|
22
|
+
return state.value;
|
|
23
|
+
const name = this.#name();
|
|
24
|
+
if (state.kind === "unopened" || state.kind === "opening") {
|
|
25
|
+
throw new ChordError({ code: "not_ready", message: `${name}: not open yet` });
|
|
26
|
+
}
|
|
27
|
+
throw new ChordError({ code: "released", reason: "closed", message: `${name}: closed` });
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Opens the value in its `chord.open` span (under `context`'s, its attempt's); one that arrives after its attempt was
|
|
31
|
+
* abandoned is closed at once, a failure reported.
|
|
32
|
+
*/
|
|
33
|
+
async open(context) {
|
|
34
|
+
this.#state = { kind: "opening" };
|
|
35
|
+
const parent = context.telemetry;
|
|
36
|
+
if (untraced(parent)) {
|
|
37
|
+
await this.#opened(await this.#open(context));
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const { host, type, position } = this.#owner;
|
|
41
|
+
await chordSpans(parent)("chord.open", { "chord.host": host, type, native: position }, async (span) => {
|
|
42
|
+
let value;
|
|
43
|
+
try {
|
|
44
|
+
value = await this.#open(withTelemetry(span, context));
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
// An open its attempt abandoned (a deadline, an end) was cancelled: no error.
|
|
48
|
+
ended(span, "open_failed", error, context.abortSignal);
|
|
49
|
+
throw error;
|
|
50
|
+
}
|
|
51
|
+
await this.#opened(value);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
/** Closes the value if it is open (a pending open's value is closed when it arrives); resolves with a throw. */
|
|
55
|
+
async close(reason) {
|
|
56
|
+
const state = this.#state;
|
|
57
|
+
this.#state = state.kind === "opening" ? { kind: "abandoned", reason } : { kind: "closed" };
|
|
58
|
+
return state.kind === "open" ? this.#closeValue(state.value, reason) : undefined;
|
|
59
|
+
}
|
|
60
|
+
/** Keeps the value an open resolved with, or closes it at once when the native was closed meanwhile. */
|
|
61
|
+
async #opened(value) {
|
|
62
|
+
const state = this.#state;
|
|
63
|
+
if (state.kind !== "abandoned") {
|
|
64
|
+
this.#state = { kind: "open", value };
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
this.#state = { kind: "closed" };
|
|
68
|
+
const failure = await this.#closeValue(value, state.reason);
|
|
69
|
+
if (failure !== undefined)
|
|
70
|
+
this.#owner.report(failure);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Runs the close under the object's context (in a `chord.close` root span), aborted at the close timeout, and waits
|
|
74
|
+
* for it up to then; longer is reported.
|
|
75
|
+
*/
|
|
76
|
+
async #closeValue(value, reason) {
|
|
77
|
+
const { telemetry, host, type, position } = this.#owner;
|
|
78
|
+
if (untraced(telemetry))
|
|
79
|
+
return this.#closeWithin(value, reason, this.#owner.context);
|
|
80
|
+
const attributes = { "chord.host": host, type, native: position, reason: reason.kind };
|
|
81
|
+
return chordSpans(telemetry)("chord.close", attributes, async (span) => {
|
|
82
|
+
const failure = await this.#closeWithin(value, reason, withTelemetry(span, this.#owner.context));
|
|
83
|
+
if (failure !== undefined)
|
|
84
|
+
spanFailed(span, "close_failed", failure.error);
|
|
85
|
+
return failure;
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
/** `#closeValue`'s close under `context`. */
|
|
89
|
+
async #closeWithin(value, reason, context) {
|
|
90
|
+
const { object, position, report } = this.#owner;
|
|
91
|
+
const at = { object, native: { kind: "native", position } };
|
|
92
|
+
const timeout = new AbortController();
|
|
93
|
+
const closing = (async () => this.#close(value, reason, withAbortSignal(timeout.signal, context)))();
|
|
94
|
+
try {
|
|
95
|
+
if ((await within(closing, this.#closeTimeout)) === "timeout") {
|
|
96
|
+
timeout.abort(new ChordError({ code: "aborted", message: `${this.#name()}: close timed out` }));
|
|
97
|
+
report({ kind: "close_timeout", ...at });
|
|
98
|
+
}
|
|
99
|
+
return undefined;
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
return { kind: "close_failed", ...at, error };
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
#name() {
|
|
106
|
+
return `${this.#owner.object} native #${this.#owner.position}`;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
/** Whether `promise` settled within `ms` (it rejects when `promise` does first); `promise` itself runs on. */
|
|
110
|
+
export async function within(promise, ms) {
|
|
111
|
+
let timer;
|
|
112
|
+
const timeout = new Promise((resolve) => {
|
|
113
|
+
timer = setTimeout(resolve, ms, "timeout");
|
|
114
|
+
});
|
|
115
|
+
try {
|
|
116
|
+
return await Promise.race([promise.then(() => "settled"), timeout]);
|
|
117
|
+
}
|
|
118
|
+
finally {
|
|
119
|
+
clearTimeout(timer);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
/** Whether the `size` pieces of work in `drain` settled within `ms` (at once when there is none). */
|
|
123
|
+
export async function drained(drain, size, ms) {
|
|
124
|
+
return size === 0 ? "settled" : within(Promise.allSettled(drain), ms);
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native.js","sourceRoot":"","sources":["../../src/host/native.ts"],"names":[],"mappings":"AAAA,oHAAoH;AACpH,mHAAmH;AAGnH,OAAO,EAAgB,eAAe,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAmD1E,2EAA2E;AAC3E,MAAM,OAAO,YAAY;IACf,KAAK,CAAmC;IACxC,MAAM,CAAkF;IACxF,aAAa,CAAS;IACtB,MAAM,CAAc;IAC7B,MAAM,GAAmB,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;IAE9C,YACC,IAAsC,EACtC,KAAsF,EACtF,YAAoB,EACpB,KAAkB;QAElB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,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O,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,SAAkB,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;IAC9E,CAAC;YAAS,CAAC;QACV,YAAY,CAAC,KAAK,CAAC,CAAC;IACrB,CAAC;AACF,CAAC;AAED,qGAAqG;AACrG,MAAM,CAAC,KAAK,UAAU,OAAO,CAC5B,KAAiC,EACjC,IAAY,EACZ,EAAU;IAEV,OAAO,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;AACvE,CAAC","sourcesContent":["// Natives (§13): the handle `self.open` returns, a value opened during activation and closed with a reason when its\n// attempt ends; `within`, which bounds a close or a drain by a timeout; and the drain's admission of running work.\n\nimport type { TelemetryContext } from \"@diffra-ai/telemetry\";\nimport { type Context, withAbortSignal, withTelemetry } from \"../context/index.ts\";\nimport { ChordError } from \"../data/index.ts\";\nimport { chordSpans, ended, spanFailed, untraced } from \"../telemetry.ts\";\nimport type { HostError } from \"./host.ts\";\n\n/** Why a native closes: its object ended or its attempt failed (`end`), the host closes (`close`), a reload (slice 7). */\nexport type NativeCloseReason = { readonly kind: \"end\" } | { readonly kind: \"close\" } | { readonly kind: \"reload\" };\n\n/** A native's handle. */\nexport interface Native<T> {\n\t/** The opened value: throws `not_ready` until its open resolved and `released` once its close started. */\n\treadonly value: T;\n}\n\n/** What `self.open` takes besides the open and the close. */\nexport type NativeOptions = {\n\t/** How long its close may take; the host's `closeTimeout` by default. */\n\treadonly closeTimeout?: number;\n};\n\n/** A close that threw, as reported. */\nexport type CloseFailed = Extract<HostError, { readonly kind: \"close_failed\" }>;\n\n/**\n * Where a native belongs: its object's label, type and its position in declaration order (from 1) for errors, reports\n * and spans, the object's context (every close runs under it, never under the aborted opener's), the host's telemetry\n * adapter (a close is a root span), and where it reports.\n */\ntype NativeOwner = {\n\treadonly object: string;\n\treadonly type: string;\n\treadonly position: number;\n\treadonly context: Context;\n\treadonly telemetry: TelemetryContext;\n\t/** Its host's `chord.host`. */\n\treadonly host: string;\n\treadonly report: (error: HostError) => void;\n};\n\n/** What an attempt does with each of its natives, whatever their value's type. */\nexport interface NativeSlot {\n\topen(context: Context): Promise<void>;\n\tclose(reason: NativeCloseReason): Promise<CloseFailed | undefined>;\n}\n\n/** Where a native stands. `abandoned`: closed while its open was pending, so the late value is closed at once. */\ntype NativeState<T> =\n\t| { readonly kind: \"unopened\" }\n\t| { readonly kind: \"opening\" }\n\t| { readonly kind: \"open\"; readonly value: T }\n\t| { readonly kind: \"abandoned\"; readonly reason: NativeCloseReason }\n\t| { readonly kind: \"closed\" };\n\n/** One native of one attempt: opened at most once, closed exactly once. */\nexport class NativeHandle<T> implements Native<T>, NativeSlot {\n\treadonly #open: (context: Context) => Promise<T>;\n\treadonly #close: (value: T, reason: NativeCloseReason, context: Context) => void | Promise<void>;\n\treadonly #closeTimeout: number;\n\treadonly #owner: NativeOwner;\n\t#state: NativeState<T> = { kind: \"unopened\" };\n\n\tconstructor(\n\t\topen: (context: Context) => Promise<T>,\n\t\tclose: (value: T, reason: NativeCloseReason, context: Context) => void | Promise<void>,\n\t\tcloseTimeout: number,\n\t\towner: NativeOwner,\n\t) {\n\t\tthis.#open = open;\n\t\tthis.#close = close;\n\t\tthis.#closeTimeout = closeTimeout;\n\t\tthis.#owner = owner;\n\t}\n\n\tget value(): T {\n\t\tconst state = this.#state;\n\t\tif (state.kind === \"open\") return state.value;\n\t\tconst name = this.#name();\n\t\tif (state.kind === \"unopened\" || state.kind === \"opening\") {\n\t\t\tthrow new ChordError({ code: \"not_ready\", message: `${name}: not open yet` });\n\t\t}\n\t\tthrow new ChordError({ code: \"released\", reason: \"closed\", message: `${name}: closed` });\n\t}\n\n\t/**\n\t * Opens the value in its `chord.open` span (under `context`'s, its attempt's); one that arrives after its attempt was\n\t * abandoned is closed at once, a failure reported.\n\t */\n\tasync open(context: Context): Promise<void> {\n\t\tthis.#state = { kind: \"opening\" };\n\t\tconst parent = context.telemetry;\n\t\tif (untraced(parent)) {\n\t\t\tawait this.#opened(await this.#open(context));\n\t\t\treturn;\n\t\t}\n\t\tconst { host, type, position } = this.#owner;\n\t\tawait chordSpans(parent)(\"chord.open\", { \"chord.host\": host, type, native: position }, async (span) => {\n\t\t\tlet value: T;\n\t\t\ttry {\n\t\t\t\tvalue = await this.#open(withTelemetry(span, context));\n\t\t\t} catch (error) {\n\t\t\t\t// An open its attempt abandoned (a deadline, an end) was cancelled: no error.\n\t\t\t\tended(span, \"open_failed\", error, context.abortSignal);\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\tawait this.#opened(value);\n\t\t});\n\t}\n\n\t/** Closes the value if it is open (a pending open's value is closed when it arrives); resolves with a throw. */\n\tasync close(reason: NativeCloseReason): Promise<CloseFailed | undefined> {\n\t\tconst state = this.#state;\n\t\tthis.#state = state.kind === \"opening\" ? { kind: \"abandoned\", reason } : { kind: \"closed\" };\n\t\treturn state.kind === \"open\" ? this.#closeValue(state.value, reason) : undefined;\n\t}\n\n\t/** Keeps the value an open resolved with, or closes it at once when the native was closed meanwhile. */\n\tasync #opened(value: T): Promise<void> {\n\t\tconst state = this.#state;\n\t\tif (state.kind !== \"abandoned\") {\n\t\t\tthis.#state = { kind: \"open\", value };\n\t\t\treturn;\n\t\t}\n\t\tthis.#state = { kind: \"closed\" };\n\t\tconst failure = await this.#closeValue(value, state.reason);\n\t\tif (failure !== undefined) this.#owner.report(failure);\n\t}\n\n\t/**\n\t * Runs the close under the object's context (in a `chord.close` root span), aborted at the close timeout, and waits\n\t * for it up to then; longer is reported.\n\t */\n\tasync #closeValue(value: T, reason: NativeCloseReason): Promise<CloseFailed | undefined> {\n\t\tconst { telemetry, host, type, position } = this.#owner;\n\t\tif (untraced(telemetry)) return this.#closeWithin(value, reason, this.#owner.context);\n\t\tconst attributes = { \"chord.host\": host, type, native: position, reason: reason.kind };\n\t\treturn chordSpans(telemetry)(\"chord.close\", attributes, async (span) => {\n\t\t\tconst failure = await this.#closeWithin(value, reason, withTelemetry(span, this.#owner.context));\n\t\t\tif (failure !== undefined) spanFailed(span, \"close_failed\", failure.error);\n\t\t\treturn failure;\n\t\t});\n\t}\n\n\t/** `#closeValue`'s close under `context`. */\n\tasync #closeWithin(value: T, reason: NativeCloseReason, context: Context): Promise<CloseFailed | undefined> {\n\t\tconst { object, position, report } = this.#owner;\n\t\tconst at = { object, native: { kind: \"native\", position } } as const;\n\t\tconst timeout = new AbortController();\n\t\tconst closing = (async () => this.#close(value, reason, withAbortSignal(timeout.signal, context)))();\n\t\ttry {\n\t\t\tif ((await within(closing, this.#closeTimeout)) === \"timeout\") {\n\t\t\t\ttimeout.abort(new ChordError({ code: \"aborted\", message: `${this.#name()}: close timed out` }));\n\t\t\t\treport({ kind: \"close_timeout\", ...at });\n\t\t\t}\n\t\t\treturn undefined;\n\t\t} catch (error) {\n\t\t\treturn { kind: \"close_failed\", ...at, error };\n\t\t}\n\t}\n\n\t#name(): string {\n\t\treturn `${this.#owner.object} native #${this.#owner.position}`;\n\t}\n}\n\n/** Whether `promise` settled within `ms` (it rejects when `promise` does first); `promise` itself runs on. */\nexport async function within(promise: Promise<unknown>, ms: number): Promise<\"settled\" | \"timeout\"> {\n\tlet timer: ReturnType<typeof setTimeout> | undefined;\n\tconst timeout = new Promise<\"timeout\">((resolve) => {\n\t\ttimer = setTimeout(resolve, ms, \"timeout\");\n\t});\n\ttry {\n\t\treturn await Promise.race([promise.then(() => \"settled\" as const), timeout]);\n\t} finally {\n\t\tclearTimeout(timer);\n\t}\n}\n\n/** Whether the `size` pieces of work in `drain` settled within `ms` (at once when there is none). */\nexport async function drained(\n\tdrain: Iterable<Promise<unknown>>,\n\tsize: number,\n\tms: number,\n): Promise<\"settled\" | \"timeout\"> {\n\treturn size === 0 ? \"settled\" : within(Promise.allSettled(drain), ms);\n}\n"]}
|