@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,269 @@
|
|
|
1
|
+
// A list's pages (slice 14 §4): the tiling of a query's order between fixed bookmarks. Page 1 is `(start, b1]`,
|
|
2
|
+
// page 2 `(b1, b2]`, and the last page is open at its end while no row is known behind it. Each page is one read of
|
|
3
|
+
// the open query; pages are cut and merged when their runs are adopted, from the rows just read, with no I/O, so no
|
|
4
|
+
// frame loses a loaded row.
|
|
5
|
+
import { compareScalar } from "../store/evaluate.js";
|
|
6
|
+
import { OpenQuery } from "../store/open-query.js";
|
|
7
|
+
/** How many rows a bounded page reads at most, in pages (slice 14 §4 "Overflow"). */
|
|
8
|
+
const MAX_PAGES = 4;
|
|
9
|
+
/**
|
|
10
|
+
* The pages of a list for one target (a query and its arguments): one open query, a read of it per page, the rows
|
|
11
|
+
* each returned, and the tiling rules.
|
|
12
|
+
*/
|
|
13
|
+
export class Tiling {
|
|
14
|
+
target;
|
|
15
|
+
#query;
|
|
16
|
+
#first;
|
|
17
|
+
#order;
|
|
18
|
+
#owner;
|
|
19
|
+
#pages = [];
|
|
20
|
+
constructor(site, target, first, owner, context) {
|
|
21
|
+
this.target = target;
|
|
22
|
+
this.#query = new OpenQuery(site, target.spec, "rows", () => owner.rebound(), context);
|
|
23
|
+
this.#first = first;
|
|
24
|
+
this.#order = target.spec.query.order;
|
|
25
|
+
this.#owner = owner;
|
|
26
|
+
}
|
|
27
|
+
/** What bookmarks of this tiling are positions of: the table, the order's columns and its direction. */
|
|
28
|
+
get signature() {
|
|
29
|
+
return JSON.stringify([this.target.spec.table, this.#order.columns, this.#order.direction]);
|
|
30
|
+
}
|
|
31
|
+
/** The bookmarks: the upper bound of every bounded page. */
|
|
32
|
+
get bookmarks() {
|
|
33
|
+
return this.#pages.flatMap(({ through }) => (through === undefined ? [] : [through]));
|
|
34
|
+
}
|
|
35
|
+
/** Whether the last page is open at its end: no row is known behind what the list shows. */
|
|
36
|
+
get open() {
|
|
37
|
+
return this.#pages.at(-1)?.through === undefined;
|
|
38
|
+
}
|
|
39
|
+
/** Whether rows may follow what `rows` gives: a bounded last page, or a page that has not run yet. */
|
|
40
|
+
get moreAfter() {
|
|
41
|
+
return !this.open || !this.complete;
|
|
42
|
+
}
|
|
43
|
+
/** Whether every page has run. */
|
|
44
|
+
get complete() {
|
|
45
|
+
return this.#pages.every((page) => page.rows !== undefined);
|
|
46
|
+
}
|
|
47
|
+
/** The failure of the first page whose last run failed: the list is failed while any page is. */
|
|
48
|
+
get failure() {
|
|
49
|
+
return this.#pages.find((page) => page.failure !== undefined)?.failure;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Whether its query was closed under it: its provider's attempt ended (slice 14 §3.2). It keeps its rows and
|
|
53
|
+
* loads nothing; the list reads the successor's query next.
|
|
54
|
+
*/
|
|
55
|
+
get retired() {
|
|
56
|
+
return this.#query.closed;
|
|
57
|
+
}
|
|
58
|
+
/** The context its rows are decoded under: its query's. */
|
|
59
|
+
get context() {
|
|
60
|
+
return this.#query.context;
|
|
61
|
+
}
|
|
62
|
+
/** The loaded rows in order, up to the first page that has none yet: a prefix, never a hole. */
|
|
63
|
+
rows() {
|
|
64
|
+
const rows = [];
|
|
65
|
+
for (const page of this.#pages) {
|
|
66
|
+
if (page.rows === undefined)
|
|
67
|
+
break;
|
|
68
|
+
rows.push(...page.rows);
|
|
69
|
+
}
|
|
70
|
+
return rows;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Opens a page per bookmark, and the open last page when the list ended in one, and resolves once each load
|
|
74
|
+
* settled. No bookmarks: one open page, the first.
|
|
75
|
+
*/
|
|
76
|
+
async start(bookmarks, open) {
|
|
77
|
+
let after;
|
|
78
|
+
for (const through of bookmarks) {
|
|
79
|
+
this.#pages.push(this.#page(after, through));
|
|
80
|
+
after = through;
|
|
81
|
+
}
|
|
82
|
+
if (open || bookmarks.length === 0)
|
|
83
|
+
this.#pages.push(this.#page(after, undefined));
|
|
84
|
+
await Promise.all(this.#pages.map((page) => page.read.load()));
|
|
85
|
+
}
|
|
86
|
+
/** Loads the next page behind a bounded last page; with an open last page there is nothing more to load. */
|
|
87
|
+
async more() {
|
|
88
|
+
const last = this.#pages.at(-1);
|
|
89
|
+
if (last === undefined || last.through === undefined)
|
|
90
|
+
return;
|
|
91
|
+
const page = this.#page(last.through, undefined);
|
|
92
|
+
this.#pages.push(page);
|
|
93
|
+
await page.read.load();
|
|
94
|
+
}
|
|
95
|
+
/** Closes its query: no commit runs its pages again. */
|
|
96
|
+
close() {
|
|
97
|
+
this.#query.close();
|
|
98
|
+
this.#pages = [];
|
|
99
|
+
}
|
|
100
|
+
/** A page of `(after, through]` that has not run: its read is registered, a load or a commit runs it. */
|
|
101
|
+
#page(after, through) {
|
|
102
|
+
const sink = { adopt: (run) => this.#adopt(page, run) };
|
|
103
|
+
const read = this.#query.read({ kind: "rows", range: this.#range(after, through) }, sink);
|
|
104
|
+
const page = { after, through, rows: undefined, more: false, failure: undefined, read };
|
|
105
|
+
return page;
|
|
106
|
+
}
|
|
107
|
+
/** A page of `(after, through]` whose rows are known (a cut, a merge): its read runs nothing. */
|
|
108
|
+
#pageOf(after, through, rows) {
|
|
109
|
+
const sink = { adopt: (run) => this.#adopt(page, run) };
|
|
110
|
+
const read = this.#query.readKnown(this.#range(after, through), rows, sink);
|
|
111
|
+
const page = { after, through, rows, more: false, failure: undefined, read };
|
|
112
|
+
return page;
|
|
113
|
+
}
|
|
114
|
+
/** The range a page of `(after, through]` reads. */
|
|
115
|
+
#range(after, through) {
|
|
116
|
+
// The open last page reads one page; a bounded one everything between its bookmarks, up to the overflow bound.
|
|
117
|
+
const limit = through === undefined ? this.#first : this.#first * MAX_PAGES;
|
|
118
|
+
return { ...(after === undefined ? {} : { after }), ...(through === undefined ? {} : { through }), limit };
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Takes a page's run, inside a batch. A run belongs to the interval it read, not to a page (slice 14 §4): the
|
|
122
|
+
* runs of one commit, and of a commit group, are all computed before any is adopted, and an earlier adoption may
|
|
123
|
+
* have cut or merged the page meanwhile. The run then applies to whatever pages cover its interval now.
|
|
124
|
+
*/
|
|
125
|
+
#adopt(page, run) {
|
|
126
|
+
const current = this.#pages.includes(page);
|
|
127
|
+
if (run.kind !== "rows") {
|
|
128
|
+
// A page's read is never a count. The pages that show the interval are failed until a run of them succeeds;
|
|
129
|
+
// a page that did not run itself forgets its result, so the next commit over its tables runs it.
|
|
130
|
+
const failure = { error: run.kind === "failed" ? run.error : new Error("a list's page took a count") };
|
|
131
|
+
for (const each of current ? [page] : this.#pages.filter((other) => this.#overlap(other, page))) {
|
|
132
|
+
each.failure = failure;
|
|
133
|
+
each.read.forget();
|
|
134
|
+
}
|
|
135
|
+
this.#owner.adopted();
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
const { rows, more } = run.result;
|
|
139
|
+
if (current) {
|
|
140
|
+
page.rows = rows;
|
|
141
|
+
page.more = more;
|
|
142
|
+
page.failure = undefined;
|
|
143
|
+
}
|
|
144
|
+
else
|
|
145
|
+
this.#patch(page, rows, more);
|
|
146
|
+
this.#retile();
|
|
147
|
+
this.#owner.adopted();
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Applies the run of a retired page (`rows` of its interval; `more`: the run was cut by its limit, so the interval
|
|
151
|
+
* is known only through its last row) to the pages that cover the interval now. Each patched page's read is told
|
|
152
|
+
* its rows again: the skip test reasons from the keys of what the page shows. A failed page takes the rows and
|
|
153
|
+
* stays without a result, so the next commit over its tables runs it, whatever it writes. A page that lies behind
|
|
154
|
+
* what a cut run knows is loaded again; one the cut falls into keeps the rows up to it, and `#retile` continues
|
|
155
|
+
* behind.
|
|
156
|
+
*/
|
|
157
|
+
#patch(retired, rows, more) {
|
|
158
|
+
const known = more ? this.#position(rows.at(-1)) : undefined;
|
|
159
|
+
this.#pages = this.#pages.map((page) => {
|
|
160
|
+
if (page.rows === undefined || !this.#overlap(page, retired))
|
|
161
|
+
return page;
|
|
162
|
+
if (known !== undefined && page.after !== undefined && this.#compare(page.after, known) >= 0) {
|
|
163
|
+
page.read.close();
|
|
164
|
+
const again = this.#page(page.after, page.through);
|
|
165
|
+
void again.read.load();
|
|
166
|
+
return again;
|
|
167
|
+
}
|
|
168
|
+
const kept = page.rows.filter((row) => !this.#inside(this.#position(row), retired));
|
|
169
|
+
const taken = rows.filter((row) => this.#inside(this.#position(row), page));
|
|
170
|
+
const merged = [...kept, ...taken].sort((a, b) => this.#compare(this.#position(a), this.#position(b)));
|
|
171
|
+
const cut = known !== undefined && (page.through === undefined || this.#compare(page.through, known) > 0);
|
|
172
|
+
page.rows = cut ? merged.filter((row) => this.#compare(this.#position(row), known) <= 0) : merged;
|
|
173
|
+
page.more = page.more || cut;
|
|
174
|
+
if (page.failure === undefined)
|
|
175
|
+
page.read.know(page.rows);
|
|
176
|
+
return page;
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Cuts and merges, from the rows the pages hold, with no I/O. The open last page with a row behind it, or grown
|
|
181
|
+
* past one page, gets its bound at its last row (the list ends there until `more`); a bounded page past the
|
|
182
|
+
* overflow bound is cut and the rest of its range loads next; a page of more than two pages' rows is cut into
|
|
183
|
+
* pages; neighbours with at most one page's rows together become one.
|
|
184
|
+
*/
|
|
185
|
+
#retile() {
|
|
186
|
+
const first = this.#first;
|
|
187
|
+
const pages = [];
|
|
188
|
+
for (const page of this.#pages) {
|
|
189
|
+
const rows = page.rows;
|
|
190
|
+
const open = page.through === undefined;
|
|
191
|
+
const full = rows !== undefined && (page.more || rows.length > (open ? first : 2 * first));
|
|
192
|
+
if (rows === undefined || page.failure !== undefined || !full) {
|
|
193
|
+
pages.push(page);
|
|
194
|
+
continue;
|
|
195
|
+
}
|
|
196
|
+
page.read.close();
|
|
197
|
+
// Rows of a bounded page's range are still unread behind `rows` (overflow): the rest loads as a page of its own.
|
|
198
|
+
const unread = !open && page.more;
|
|
199
|
+
const through = open ? this.#position(rows.at(-1)) : page.through;
|
|
200
|
+
let after = page.after;
|
|
201
|
+
for (let from = 0; from < rows.length; from += first) {
|
|
202
|
+
// The last cut takes what is left when that is at most two pages' rows, and ends where the page did.
|
|
203
|
+
const last = rows.length - from <= 2 * first;
|
|
204
|
+
const chunk = last ? rows.slice(from) : rows.slice(from, from + first);
|
|
205
|
+
const end = last && !unread ? through : this.#position(chunk.at(-1));
|
|
206
|
+
pages.push(this.#pageOf(after, end, chunk));
|
|
207
|
+
after = end;
|
|
208
|
+
if (last)
|
|
209
|
+
break;
|
|
210
|
+
}
|
|
211
|
+
if (unread) {
|
|
212
|
+
const rest = this.#page(after, page.through);
|
|
213
|
+
pages.push(rest);
|
|
214
|
+
void rest.read.load();
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
this.#pages = this.#merged(pages);
|
|
218
|
+
}
|
|
219
|
+
/** `pages` with neighbours that hold at most one page's rows together merged into one. */
|
|
220
|
+
#merged(pages) {
|
|
221
|
+
const merged = [];
|
|
222
|
+
for (const page of pages) {
|
|
223
|
+
const previous = merged.at(-1);
|
|
224
|
+
if (previous === undefined || !this.#mergeable(previous) || !this.#mergeable(page)) {
|
|
225
|
+
merged.push(page);
|
|
226
|
+
continue;
|
|
227
|
+
}
|
|
228
|
+
const rows = [...previous.rows, ...page.rows];
|
|
229
|
+
if (rows.length > this.#first) {
|
|
230
|
+
merged.push(page);
|
|
231
|
+
continue;
|
|
232
|
+
}
|
|
233
|
+
previous.read.close();
|
|
234
|
+
page.read.close();
|
|
235
|
+
merged[merged.length - 1] = this.#pageOf(previous.after, page.through, rows);
|
|
236
|
+
}
|
|
237
|
+
return merged;
|
|
238
|
+
}
|
|
239
|
+
/** Whether `page` may merge with a neighbour: every row of its range is known. */
|
|
240
|
+
#mergeable(page) {
|
|
241
|
+
return page.rows !== undefined && !page.more && page.failure === undefined;
|
|
242
|
+
}
|
|
243
|
+
/** Whether the intervals of two pages share a position. */
|
|
244
|
+
#overlap(a, b) {
|
|
245
|
+
const before = (x, y) => x.through !== undefined && y.after !== undefined && this.#compare(x.through, y.after) <= 0;
|
|
246
|
+
return !before(a, b) && !before(b, a);
|
|
247
|
+
}
|
|
248
|
+
/** Whether `position` is in `page`'s interval. */
|
|
249
|
+
#inside(position, { after, through }) {
|
|
250
|
+
if (after !== undefined && this.#compare(position, after) <= 0)
|
|
251
|
+
return false;
|
|
252
|
+
return through === undefined || this.#compare(position, through) <= 0;
|
|
253
|
+
}
|
|
254
|
+
/** The position of `row` in the order: its order columns' values. */
|
|
255
|
+
#position(row) {
|
|
256
|
+
return this.#order.columns.map((name) => row[name]);
|
|
257
|
+
}
|
|
258
|
+
/** Orders two positions as the list shows them: negative when `a` comes first. */
|
|
259
|
+
#compare(a, b) {
|
|
260
|
+
for (let index = 0; index < a.length; index++) {
|
|
261
|
+
// Order columns are non-`opt` `str` or `int` ones (checked when the query was built).
|
|
262
|
+
const order = compareScalar(a[index], b[index]);
|
|
263
|
+
if (order !== 0)
|
|
264
|
+
return this.#order.direction === "asc" ? order : -order;
|
|
265
|
+
}
|
|
266
|
+
return 0;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
//# sourceMappingURL=tiling.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tiling.js","sourceRoot":"","sources":["../../src/host/tiling.ts"],"names":[],"mappings":"AAAA,gHAAgH;AAChH,oHAAoH;AACpH,oHAAoH;AACpH,4BAA4B;AAG5B,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,EAAE,SAAS,EAAgC,MAAM,wBAAwB,CAAC;AAmBjF,qFAAqF;AACrF,MAAM,SAAS,GAAG,CAAC,CAAC;AAcpB;;;GAGG;AACH,MAAM,OAAO,MAAM;IACT,MAAM,CAAa;IACnB,MAAM,CAAY;IAClB,MAAM,CAAS;IACf,MAAM,CAAQ;IACd,MAAM,CAAc;IAC7B,MAAM,GAAW,EAAE,CAAC;IAEpB,YAAY,IAAc,EAAE,MAAkB,EAAE,KAAa,EAAE,KAAkB,EAAE,OAAgB;QAClG,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,IAAI,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;QACvF,I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AAC;QAC5F,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACvC,CAAC;IAED,kDAAkD;IAClD,OAAO,CAAC,QAAkB,EAAE,EAAE,KAAK,EAAE,OAAO,EAAmC;QAC9E,IAAI,KAAK,KAAK,SAAS,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,IAAI,CAAC;YAAE,OAAO,KAAK,CAAC;QAC7E,OAAO,OAAO,KAAK,SAAS,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACvE,CAAC;IAED,qEAAqE;IACrE,SAAS,CAAC,GAAe;QACxB,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAE,CAAC,CAAC;IACtD,CAAC;IAED,kFAAkF;IAClF,QAAQ,CAAC,CAAW,EAAE,CAAW;QAChC,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;YAC/C,sFAAsF;YACtF,MAAM,KAAK,GAAG,aAAa,CAAC,CAAC,CAAC,KAAK,CAAW,EAAE,CAAC,CAAC,KAAK,CAAW,CAAC,CAAC;YACpE,IAAI,KAAK,KAAK,CAAC;gBAAE,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QAC1E,CAAC;QACD,OAAO,CAAC,CAAC;IACV,CAAC;CACD","sourcesContent":["// A list's pages (slice 14 §4): the tiling of a query's order between fixed bookmarks. Page 1 is `(start, b1]`,\n// page 2 `(b1, b2]`, and the last page is open at its end while no row is known behind it. Each page is one read of\n// the open query; pages are cut and merged when their runs are adopted, from the rows just read, with no I/O, so no\n// frame loses a loaded row.\n\nimport type { Context } from \"../context/index.ts\";\nimport { compareScalar } from \"../store/evaluate.ts\";\nimport type { LiveTarget } from \"../store/live-query.ts\";\nimport { OpenQuery, type OpenRead, type ReadSite } from \"../store/open-query.ts\";\nimport type { ReadRun } from \"../store/read.ts\";\nimport type { Position, Range, StoredRead } from \"../store/read-plan.ts\";\nimport type { Scalar } from \"../store/rows.ts\";\nimport type { Order } from \"../store/sql.ts\";\n\n/** One page: the rows after `after` through `through` (the last page has none: it is open at its end). */\ntype Page = {\n\treadonly after: Position | undefined;\n\treadonly through: Position | undefined;\n\treadonly read: OpenRead;\n\t/** Its rows as its last run (or the cut that made it) left them; `undefined` until its first run. */\n\trows: readonly StoredRead[] | undefined;\n\t/** Whether rows of its range are unread behind `rows`: its run was cut by its limit. */\n\tmore: boolean;\n\t/** Why its last run could not read it, until a run of it succeeds. */\n\tfailure: { readonly error: unknown } | undefined;\n};\n\n/** How many rows a bounded page reads at most, in pages (slice 14 §4 \"Overflow\"). */\nconst MAX_PAGES = 4;\n\n/** Who a tiling tells: its list. */\nexport type TilingOwner = {\n\t/** A run was adopted; called inside a batch. */\n\tadopted(): void;\n\t/**\n\t * A binding of its query changed (a set moved, its table ready after a migration): rows and their order may be\n\t * others in every page. Its pages are not read again one by one (the first adoption would cut and merge the others\n\t * with the rows they had); its list reads the target again as one new tiling.\n\t */\n\trebound(): void;\n};\n\n/**\n * The pages of a list for one target (a query and its arguments): one open query, a read of it per page, the rows\n * each returned, and the tiling rules.\n */\nexport class Tiling {\n\treadonly target: LiveTarget;\n\treadonly #query: OpenQuery;\n\treadonly #first: number;\n\treadonly #order: Order;\n\treadonly #owner: TilingOwner;\n\t#pages: Page[] = [];\n\n\tconstructor(site: ReadSite, target: LiveTarget, first: number, owner: TilingOwner, context: Context) {\n\t\tthis.target = target;\n\t\tthis.#query = new OpenQuery(site, target.spec, \"rows\", () => owner.rebound(), context);\n\t\tthis.#first = first;\n\t\tthis.#order = target.spec.query.order;\n\t\tthis.#owner = owner;\n\t}\n\n\t/** What bookmarks of this tiling are positions of: the table, the order's columns and its direction. */\n\tget signature(): string {\n\t\treturn JSON.stringify([this.target.spec.table, this.#order.columns, this.#order.direction]);\n\t}\n\n\t/** The bookmarks: the upper bound of every bounded page. */\n\tget bookmarks(): Position[] {\n\t\treturn this.#pages.flatMap(({ through }) => (through === undefined ? [] : [through]));\n\t}\n\n\t/** Whether the last page is open at its end: no row is known behind what the list shows. */\n\tget open(): boolean {\n\t\treturn this.#pages.at(-1)?.through === undefined;\n\t}\n\n\t/** Whether rows may follow what `rows` gives: a bounded last page, or a page that has not run yet. */\n\tget moreAfter(): boolean {\n\t\treturn !this.open || !this.complete;\n\t}\n\n\t/** Whether every page has run. */\n\tget complete(): boolean {\n\t\treturn this.#pages.every((page) => page.rows !== undefined);\n\t}\n\n\t/** The failure of the first page whose last run failed: the list is failed while any page is. */\n\tget failure(): { readonly error: unknown } | undefined {\n\t\treturn this.#pages.find((page) => page.failure !== undefined)?.failure;\n\t}\n\n\t/**\n\t * Whether its query was closed under it: its provider's attempt ended (slice 14 §3.2). It keeps its rows and\n\t * loads nothing; the list reads the successor's query next.\n\t */\n\tget retired(): boolean {\n\t\treturn this.#query.closed;\n\t}\n\n\t/** The context its rows are decoded under: its query's. */\n\tget context(): Context {\n\t\treturn this.#query.context;\n\t}\n\n\t/** The loaded rows in order, up to the first page that has none yet: a prefix, never a hole. */\n\trows(): StoredRead[] {\n\t\tconst rows: StoredRead[] = [];\n\t\tfor (const page of this.#pages) {\n\t\t\tif (page.rows === undefined) break;\n\t\t\trows.push(...page.rows);\n\t\t}\n\t\treturn rows;\n\t}\n\n\t/**\n\t * Opens a page per bookmark, and the open last page when the list ended in one, and resolves once each load\n\t * settled. No bookmarks: one open page, the first.\n\t */\n\tasync start(bookmarks: readonly Position[], open: boolean): Promise<void> {\n\t\tlet after: Position | undefined;\n\t\tfor (const through of bookmarks) {\n\t\t\tthis.#pages.push(this.#page(after, through));\n\t\t\tafter = through;\n\t\t}\n\t\tif (open || bookmarks.length === 0) this.#pages.push(this.#page(after, undefined));\n\t\tawait Promise.all(this.#pages.map((page) => page.read.load()));\n\t}\n\n\t/** Loads the next page behind a bounded last page; with an open last page there is nothing more to load. */\n\tasync more(): Promise<void> {\n\t\tconst last = this.#pages.at(-1);\n\t\tif (last === undefined || last.through === undefined) return;\n\t\tconst page = this.#page(last.through, undefined);\n\t\tthis.#pages.push(page);\n\t\tawait page.read.load();\n\t}\n\n\t/** Closes its query: no commit runs its pages again. */\n\tclose(): void {\n\t\tthis.#query.close();\n\t\tthis.#pages = [];\n\t}\n\n\t/** A page of `(after, through]` that has not run: its read is registered, a load or a commit runs it. */\n\t#page(after: Position | undefined, through: Position | undefined): Page {\n\t\tconst sink = { adopt: (run: ReadRun): void => this.#adopt(page, run) };\n\t\tconst read = this.#query.read({ kind: \"rows\", range: this.#range(after, through) }, sink);\n\t\tconst page: Page = { after, through, rows: undefined, more: false, failure: undefined, read };\n\t\treturn page;\n\t}\n\n\t/** A page of `(after, through]` whose rows are known (a cut, a merge): its read runs nothing. */\n\t#pageOf(after: Position | undefined, through: Position | undefined, rows: readonly StoredRead[]): Page {\n\t\tconst sink = { adopt: (run: ReadRun): void => this.#adopt(page, run) };\n\t\tconst read = this.#query.readKnown(this.#range(after, through), rows, sink);\n\t\tconst page: Page = { after, through, rows, more: false, failure: undefined, read };\n\t\treturn page;\n\t}\n\n\t/** The range a page of `(after, through]` reads. */\n\t#range(after: Position | undefined, through: Position | undefined): Range {\n\t\t// The open last page reads one page; a bounded one everything between its bookmarks, up to the overflow bound.\n\t\tconst limit = through === undefined ? this.#first : this.#first * MAX_PAGES;\n\t\treturn { ...(after === undefined ? {} : { after }), ...(through === undefined ? {} : { through }), limit };\n\t}\n\n\t/**\n\t * Takes a page's run, inside a batch. A run belongs to the interval it read, not to a page (slice 14 §4): the\n\t * runs of one commit, and of a commit group, are all computed before any is adopted, and an earlier adoption may\n\t * have cut or merged the page meanwhile. The run then applies to whatever pages cover its interval now.\n\t */\n\t#adopt(page: Page, run: ReadRun): void {\n\t\tconst current = this.#pages.includes(page);\n\t\tif (run.kind !== \"rows\") {\n\t\t\t// A page's read is never a count. The pages that show the interval are failed until a run of them succeeds;\n\t\t\t// a page that did not run itself forgets its result, so the next commit over its tables runs it.\n\t\t\tconst failure = { error: run.kind === \"failed\" ? run.error : new Error(\"a list's page took a count\") };\n\t\t\tfor (const each of current ? [page] : this.#pages.filter((other) => this.#overlap(other, page))) {\n\t\t\t\teach.failure = failure;\n\t\t\t\teach.read.forget();\n\t\t\t}\n\t\t\tthis.#owner.adopted();\n\t\t\treturn;\n\t\t}\n\t\tconst { rows, more } = run.result;\n\t\tif (current) {\n\t\t\tpage.rows = rows;\n\t\t\tpage.more = more;\n\t\t\tpage.failure = undefined;\n\t\t} else this.#patch(page, rows, more);\n\t\tthis.#retile();\n\t\tthis.#owner.adopted();\n\t}\n\n\t/**\n\t * Applies the run of a retired page (`rows` of its interval; `more`: the run was cut by its limit, so the interval\n\t * is known only through its last row) to the pages that cover the interval now. Each patched page's read is told\n\t * its rows again: the skip test reasons from the keys of what the page shows. A failed page takes the rows and\n\t * stays without a result, so the next commit over its tables runs it, whatever it writes. A page that lies behind\n\t * what a cut run knows is loaded again; one the cut falls into keeps the rows up to it, and `#retile` continues\n\t * behind.\n\t */\n\t#patch(retired: Page, rows: readonly StoredRead[], more: boolean): void {\n\t\tconst known = more ? this.#position(rows.at(-1)!) : undefined;\n\t\tthis.#pages = this.#pages.map((page) => {\n\t\t\tif (page.rows === undefined || !this.#overlap(page, retired)) return page;\n\t\t\tif (known !== undefined && page.after !== undefined && this.#compare(page.after, known) >= 0) {\n\t\t\t\tpage.read.close();\n\t\t\t\tconst again = this.#page(page.after, page.through);\n\t\t\t\tvoid again.read.load();\n\t\t\t\treturn again;\n\t\t\t}\n\t\t\tconst kept = page.rows.filter((row) => !this.#inside(this.#position(row), retired));\n\t\t\tconst taken = rows.filter((row) => this.#inside(this.#position(row), page));\n\t\t\tconst merged = [...kept, ...taken].sort((a, b) => this.#compare(this.#position(a), this.#position(b)));\n\t\t\tconst cut = known !== undefined && (page.through === undefined || this.#compare(page.through, known) > 0);\n\t\t\tpage.rows = cut ? merged.filter((row) => this.#compare(this.#position(row), known) <= 0) : merged;\n\t\t\tpage.more = page.more || cut;\n\t\t\tif (page.failure === undefined) page.read.know(page.rows);\n\t\t\treturn page;\n\t\t});\n\t}\n\n\t/**\n\t * Cuts and merges, from the rows the pages hold, with no I/O. The open last page with a row behind it, or grown\n\t * past one page, gets its bound at its last row (the list ends there until `more`); a bounded page past the\n\t * overflow bound is cut and the rest of its range loads next; a page of more than two pages' rows is cut into\n\t * pages; neighbours with at most one page's rows together become one.\n\t */\n\t#retile(): void {\n\t\tconst first = this.#first;\n\t\tconst pages: Page[] = [];\n\t\tfor (const page of this.#pages) {\n\t\t\tconst rows = page.rows;\n\t\t\tconst open = page.through === undefined;\n\t\t\tconst full = rows !== undefined && (page.more || rows.length > (open ? first : 2 * first));\n\t\t\tif (rows === undefined || page.failure !== undefined || !full) {\n\t\t\t\tpages.push(page);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tpage.read.close();\n\t\t\t// Rows of a bounded page's range are still unread behind `rows` (overflow): the rest loads as a page of its own.\n\t\t\tconst unread = !open && page.more;\n\t\t\tconst through = open ? this.#position(rows.at(-1)!) : page.through;\n\t\t\tlet after = page.after;\n\t\t\tfor (let from = 0; from < rows.length; from += first) {\n\t\t\t\t// The last cut takes what is left when that is at most two pages' rows, and ends where the page did.\n\t\t\t\tconst last = rows.length - from <= 2 * first;\n\t\t\t\tconst chunk = last ? rows.slice(from) : rows.slice(from, from + first);\n\t\t\t\tconst end = last && !unread ? through : this.#position(chunk.at(-1)!);\n\t\t\t\tpages.push(this.#pageOf(after, end, chunk));\n\t\t\t\tafter = end;\n\t\t\t\tif (last) break;\n\t\t\t}\n\t\t\tif (unread) {\n\t\t\t\tconst rest = this.#page(after, page.through);\n\t\t\t\tpages.push(rest);\n\t\t\t\tvoid rest.read.load();\n\t\t\t}\n\t\t}\n\t\tthis.#pages = this.#merged(pages);\n\t}\n\n\t/** `pages` with neighbours that hold at most one page's rows together merged into one. */\n\t#merged(pages: readonly Page[]): Page[] {\n\t\tconst merged: Page[] = [];\n\t\tfor (const page of pages) {\n\t\t\tconst previous = merged.at(-1);\n\t\t\tif (previous === undefined || !this.#mergeable(previous) || !this.#mergeable(page)) {\n\t\t\t\tmerged.push(page);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst rows = [...previous.rows!, ...page.rows!];\n\t\t\tif (rows.length > this.#first) {\n\t\t\t\tmerged.push(page);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tprevious.read.close();\n\t\t\tpage.read.close();\n\t\t\tmerged[merged.length - 1] = this.#pageOf(previous.after, page.through, rows);\n\t\t}\n\t\treturn merged;\n\t}\n\n\t/** Whether `page` may merge with a neighbour: every row of its range is known. */\n\t#mergeable(page: Page): boolean {\n\t\treturn page.rows !== undefined && !page.more && page.failure === undefined;\n\t}\n\n\t/** Whether the intervals of two pages share a position. */\n\t#overlap(a: Pick<Page, \"after\" | \"through\">, b: Pick<Page, \"after\" | \"through\">): boolean {\n\t\tconst before = (x: typeof a, y: typeof a): boolean =>\n\t\t\tx.through !== undefined && y.after !== undefined && this.#compare(x.through, y.after) <= 0;\n\t\treturn !before(a, b) && !before(b, a);\n\t}\n\n\t/** Whether `position` is in `page`'s interval. */\n\t#inside(position: Position, { after, through }: Pick<Page, \"after\" | \"through\">): boolean {\n\t\tif (after !== undefined && this.#compare(position, after) <= 0) return false;\n\t\treturn through === undefined || this.#compare(position, through) <= 0;\n\t}\n\n\t/** The position of `row` in the order: its order columns' values. */\n\t#position(row: StoredRead): Position {\n\t\treturn this.#order.columns.map((name) => row[name]!);\n\t}\n\n\t/** Orders two positions as the list shows them: negative when `a` comes first. */\n\t#compare(a: Position, b: Position): number {\n\t\tfor (let index = 0; index < a.length; index++) {\n\t\t\t// Order columns are non-`opt` `str` or `int` ones (checked when the query was built).\n\t\t\tconst order = compareScalar(a[index] as Scalar, b[index] as Scalar);\n\t\t\tif (order !== 0) return this.#order.direction === \"asc\" ? order : -order;\n\t\t}\n\t\treturn 0;\n\t}\n}\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ChordError } from "../data/index.ts";
|
|
2
|
+
/** What the clock reports: a request waiting unbound for `waitingFor` since `since` (`Date.now()` time), and why. */
|
|
3
|
+
export type UnboundLong = {
|
|
4
|
+
readonly kind: "unbound_long";
|
|
5
|
+
/** The type's name, or `registry <name>`. */
|
|
6
|
+
readonly waitingFor: string;
|
|
7
|
+
readonly error: ChordError;
|
|
8
|
+
readonly since: number;
|
|
9
|
+
};
|
|
10
|
+
/** A host's waits not reported yet and the one timer of their sweep. */
|
|
11
|
+
export declare class UnboundClock {
|
|
12
|
+
#private;
|
|
13
|
+
constructor(report: (error: UnboundLong) => void);
|
|
14
|
+
/** `request` waits unbound for `waitingFor` with `error`: reported after 5 s unless it stops before. */
|
|
15
|
+
start(request: object, waitingFor: string, error: ChordError): void;
|
|
16
|
+
/** The wait of `request` has a new error (a registry's failure changed): the report names the latest. */
|
|
17
|
+
failed(request: object, error: ChordError): void;
|
|
18
|
+
/** `request` bound, ended or was woken: no report for this wait. */
|
|
19
|
+
stop(request: object): void;
|
|
20
|
+
/** The host closed: nothing is reported any more. */
|
|
21
|
+
close(): void;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=unbound-clock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unbound-clock.d.ts","sourceRoot":"","sources":["../../src/host/unbound-clock.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,qHAAqH;AACrH,MAAM,MAAM,WAAW,GAAG;IACzB,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,6CAA6C;IAC7C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACvB,CAAC;AAQF,wEAAwE;AACxE,qBAAa,YAAY;;IAMxB,YAAY,MAAM,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,EAE/C;IAED,wGAAwG;IACxG,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,IAAI,CAIlE;IAED,yGAAyG;IACzG,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,IAAI,CAG/C;IAED,oEAAoE;IACpE,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAI1B;IAED,qDAAqD;IACrD,KAAK,IAAI,IAAI,CAIZ;CAiBD"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// The `unbound_long` report (decision "Mistakes that wait are reported at once" (c)): a request waiting unbound after
|
|
2
|
+
// the host's publication (a type or registry not served here, not at its version, a registry whose first `compose`
|
|
3
|
+
// threw) is reported once through `onError` after 5 s, naming what it waits for and why; it keeps waiting as before.
|
|
4
|
+
// One clock per host, one timer armed for the earliest wait not reported yet: no timer per request.
|
|
5
|
+
/** How long a request waits unbound before it is reported (decided: 5 s). */
|
|
6
|
+
const REPORTED_AFTER = 5_000;
|
|
7
|
+
/** A host's waits not reported yet and the one timer of their sweep. */
|
|
8
|
+
export class UnboundClock {
|
|
9
|
+
/** By request, in the order they started, so by `since`: the sweep reads from the front and stops at the first due later. */
|
|
10
|
+
#waits = new Map();
|
|
11
|
+
#report;
|
|
12
|
+
#timer;
|
|
13
|
+
constructor(report) {
|
|
14
|
+
this.#report = report;
|
|
15
|
+
}
|
|
16
|
+
/** `request` waits unbound for `waitingFor` with `error`: reported after 5 s unless it stops before. */
|
|
17
|
+
start(request, waitingFor, error) {
|
|
18
|
+
if (this.#waits.has(request))
|
|
19
|
+
return;
|
|
20
|
+
this.#waits.set(request, { waitingFor, error, since: Date.now() });
|
|
21
|
+
this.#timer ??= setTimeout(() => this.#sweep(), REPORTED_AFTER);
|
|
22
|
+
}
|
|
23
|
+
/** The wait of `request` has a new error (a registry's failure changed): the report names the latest. */
|
|
24
|
+
failed(request, error) {
|
|
25
|
+
const wait = this.#waits.get(request);
|
|
26
|
+
if (wait !== undefined)
|
|
27
|
+
wait.error = error;
|
|
28
|
+
}
|
|
29
|
+
/** `request` bound, ended or was woken: no report for this wait. */
|
|
30
|
+
stop(request) {
|
|
31
|
+
if (!this.#waits.delete(request) || this.#waits.size > 0)
|
|
32
|
+
return;
|
|
33
|
+
clearTimeout(this.#timer);
|
|
34
|
+
this.#timer = undefined;
|
|
35
|
+
}
|
|
36
|
+
/** The host closed: nothing is reported any more. */
|
|
37
|
+
close() {
|
|
38
|
+
this.#waits.clear();
|
|
39
|
+
clearTimeout(this.#timer);
|
|
40
|
+
this.#timer = undefined;
|
|
41
|
+
}
|
|
42
|
+
/** Reports every wait due, each once, then arms the timer for the next one, if any. */
|
|
43
|
+
#sweep() {
|
|
44
|
+
this.#timer = undefined;
|
|
45
|
+
const now = Date.now();
|
|
46
|
+
for (const [request, wait] of this.#waits) {
|
|
47
|
+
const due = wait.since + REPORTED_AFTER;
|
|
48
|
+
if (due > now) {
|
|
49
|
+
this.#timer = setTimeout(() => this.#sweep(), due - now);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
this.#waits.delete(request);
|
|
53
|
+
const { waitingFor, error, since } = wait;
|
|
54
|
+
this.#report({ kind: "unbound_long", waitingFor, error, since });
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=unbound-clock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unbound-clock.js","sourceRoot":"","sources":["../../src/host/unbound-clock.ts"],"names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AAK;QACJ,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QACpB,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC1B,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;IACzB,CAAC;IAED,uFAAuF;IACvF,MAAM;QACL,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;QACxB,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACvB,KAAK,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAC3C,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,GAAG,cAAc,CAAC;YACxC,IAAI,GAAG,GAAG,GAAG,EAAE,CAAC;gBACf,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,GAAG,GAAG,GAAG,CAAC,CAAC;gBACzD,OAAO;YACR,CAAC;YACD,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YAC5B,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;YAC1C,IAAI,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;QAClE,CAAC;IACF,CAAC;CACD","sourcesContent":["// The `unbound_long` report (decision \"Mistakes that wait are reported at once\" (c)): a request waiting unbound after\n// the host's publication (a type or registry not served here, not at its version, a registry whose first `compose`\n// threw) is reported once through `onError` after 5 s, naming what it waits for and why; it keeps waiting as before.\n// One clock per host, one timer armed for the earliest wait not reported yet: no timer per request.\n\nimport type { ChordError } from \"../data/index.ts\";\n\n/** What the clock reports: a request waiting unbound for `waitingFor` since `since` (`Date.now()` time), and why. */\nexport type UnboundLong = {\n\treadonly kind: \"unbound_long\";\n\t/** The type's name, or `registry <name>`. */\n\treadonly waitingFor: string;\n\treadonly error: ChordError;\n\treadonly since: number;\n};\n\n/** One wait not reported yet: what it waits for, its latest error, since when. */\ntype Wait = { readonly waitingFor: string; error: ChordError; readonly since: number };\n\n/** How long a request waits unbound before it is reported (decided: 5 s). */\nconst REPORTED_AFTER = 5_000;\n\n/** A host's waits not reported yet and the one timer of their sweep. */\nexport class UnboundClock {\n\t/** By request, in the order they started, so by `since`: the sweep reads from the front and stops at the first due later. */\n\treadonly #waits = new Map<object, Wait>();\n\treadonly #report: (error: UnboundLong) => void;\n\t#timer: ReturnType<typeof setTimeout> | undefined;\n\n\tconstructor(report: (error: UnboundLong) => void) {\n\t\tthis.#report = report;\n\t}\n\n\t/** `request` waits unbound for `waitingFor` with `error`: reported after 5 s unless it stops before. */\n\tstart(request: object, waitingFor: string, error: ChordError): void {\n\t\tif (this.#waits.has(request)) return;\n\t\tthis.#waits.set(request, { waitingFor, error, since: Date.now() });\n\t\tthis.#timer ??= setTimeout(() => this.#sweep(), REPORTED_AFTER);\n\t}\n\n\t/** The wait of `request` has a new error (a registry's failure changed): the report names the latest. */\n\tfailed(request: object, error: ChordError): void {\n\t\tconst wait = this.#waits.get(request);\n\t\tif (wait !== undefined) wait.error = error;\n\t}\n\n\t/** `request` bound, ended or was woken: no report for this wait. */\n\tstop(request: object): void {\n\t\tif (!this.#waits.delete(request) || this.#waits.size > 0) return;\n\t\tclearTimeout(this.#timer);\n\t\tthis.#timer = undefined;\n\t}\n\n\t/** The host closed: nothing is reported any more. */\n\tclose(): void {\n\t\tthis.#waits.clear();\n\t\tclearTimeout(this.#timer);\n\t\tthis.#timer = undefined;\n\t}\n\n\t/** Reports every wait due, each once, then arms the timer for the next one, if any. */\n\t#sweep(): void {\n\t\tthis.#timer = undefined;\n\t\tconst now = Date.now();\n\t\tfor (const [request, wait] of this.#waits) {\n\t\t\tconst due = wait.since + REPORTED_AFTER;\n\t\t\tif (due > now) {\n\t\t\t\tthis.#timer = setTimeout(() => this.#sweep(), due - now);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis.#waits.delete(request);\n\t\t\tconst { waitingFor, error, since } = wait;\n\t\t\tthis.#report({ kind: \"unbound_long\", waitingFor, error, since });\n\t\t}\n\t}\n}\n"]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { ChordError, FailureCause, Principal } from "../data/index.ts";
|
|
2
|
+
import type { UnboundClock } from "./unbound-clock.ts";
|
|
3
|
+
/** A request in the index: a reference made here or a hold that arrived over a link. */
|
|
4
|
+
export interface UnboundRequest {
|
|
5
|
+
/** Whom it acts for: revocation ends the requests of a revoked principal. */
|
|
6
|
+
readonly principal: Principal | undefined;
|
|
7
|
+
/** The name it waits for became usable (or the host published): it runs its check again, leaving the index first. */
|
|
8
|
+
wake(): void;
|
|
9
|
+
/** It is revoked, or its host closes: it ends with `error` (a hold sends `gone`), leaving the index. */
|
|
10
|
+
end(error: ChordError): void;
|
|
11
|
+
}
|
|
12
|
+
/** A host's unbound requests by name. */
|
|
13
|
+
export declare class UnboundIndex {
|
|
14
|
+
#private;
|
|
15
|
+
constructor(clock: UnboundClock);
|
|
16
|
+
/**
|
|
17
|
+
* Indexes `request` under `name` (once; again after a wake), waiting for the publication (no `cause`) or for a
|
|
18
|
+
* provider that fits (`cause`, on the clock).
|
|
19
|
+
*/
|
|
20
|
+
add(name: string, request: UnboundRequest, cause: FailureCause | undefined): void;
|
|
21
|
+
/** `request` ended or binds: it leaves the index. */
|
|
22
|
+
delete(name: string, request: UnboundRequest): void;
|
|
23
|
+
/** The names requests wait for, sorted. */
|
|
24
|
+
names(): string[];
|
|
25
|
+
/** The host's publication: every request indexed (by any name) runs its check again, out of the index first. */
|
|
26
|
+
wakeAll(): void;
|
|
27
|
+
/**
|
|
28
|
+
* A reload's publication: the requests indexed under `names` (the types and registries it serves) run their check
|
|
29
|
+
* again, out of the index first; the others stay (carry-over "Publications wake per name").
|
|
30
|
+
*/
|
|
31
|
+
wake(names: Iterable<string>): void;
|
|
32
|
+
/** Every indexed request acting for a principal `revoked` names ends with `error`. */
|
|
33
|
+
revoke(revoked: (principal: Principal) => boolean, error: ChordError): void;
|
|
34
|
+
/** The host closed: every indexed request ends with `error`. */
|
|
35
|
+
close(error: ChordError): void;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=unbound.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unbound.d.ts","sourceRoot":"","sources":["../../src/host/unbound.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC5E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,wFAAwF;AACxF,MAAM,WAAW,cAAc;IAC9B,6EAA6E;IAC7E,QAAQ,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,CAAC;IAC1C,qHAAqH;IACrH,IAAI,IAAI,IAAI,CAAC;IACb,wGAAwG;IACxG,GAAG,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAAC;CAC7B;AAED,yCAAyC;AACzC,qBAAa,YAAY;;IAIxB,YAAY,KAAK,EAAE,YAAY,EAE9B;IAED;;;OAGG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,GAAG,SAAS,GAAG,IAAI,CAQhF;IAED,qDAAqD;IACrD,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,IAAI,CAKlD;IAED,2CAA2C;IAC3C,KAAK,IAAI,MAAM,EAAE,CAEhB;IAED,gHAAgH;IAChH,OAAO,IAAI,IAAI,CAKd;IAED;;;OAGG;IACH,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,IAAI,CAUlC;IAED,sFAAsF;IACtF,MAAM,CAAC,OAAO,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,OAAO,EAAE,KAAK,EAAE,UAAU,GAAG,IAAI,CAM1E;IAED,gEAAgE;IAChE,KAAK,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAK7B;CACD"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
// The unbound index (dependency model §1, §4): the requests a host decided cannot bind yet, by the name they wait for.
|
|
2
|
+
// Before the host's first publication every hold arriving on its links, and a request made here while `load` runs the
|
|
3
|
+
// setups (before `load` this host's own requests throw), waits here (`unpublished`); after it, those its check left
|
|
4
|
+
// unbound (`not_served`, `version`): a reference made here, a hold that arrived over a link and was refused for a name.
|
|
5
|
+
// A publication wakes the requests of the names it serves (`load`'s every one, a reload's those of its names); a
|
|
6
|
+
// request leaves when it ends (released, settled, given up, its link or origin closed, revoked) or binds. A request
|
|
7
|
+
// waiting with a cause (after the publication) is on the host's `UnboundClock` while it is indexed: reported after 5 s.
|
|
8
|
+
/** A host's unbound requests by name. */
|
|
9
|
+
export class UnboundIndex {
|
|
10
|
+
#byName = new Map();
|
|
11
|
+
#clock;
|
|
12
|
+
constructor(clock) {
|
|
13
|
+
this.#clock = clock;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Indexes `request` under `name` (once; again after a wake), waiting for the publication (no `cause`) or for a
|
|
17
|
+
* provider that fits (`cause`, on the clock).
|
|
18
|
+
*/
|
|
19
|
+
add(name, request, cause) {
|
|
20
|
+
let requests = this.#byName.get(name);
|
|
21
|
+
if (requests === undefined) {
|
|
22
|
+
requests = new Set();
|
|
23
|
+
this.#byName.set(name, requests);
|
|
24
|
+
}
|
|
25
|
+
requests.add(request);
|
|
26
|
+
if (cause !== undefined)
|
|
27
|
+
this.#clock.start(request, name, cause.error);
|
|
28
|
+
}
|
|
29
|
+
/** `request` ended or binds: it leaves the index. */
|
|
30
|
+
delete(name, request) {
|
|
31
|
+
const requests = this.#byName.get(name);
|
|
32
|
+
if (requests === undefined || !requests.delete(request))
|
|
33
|
+
return;
|
|
34
|
+
this.#clock.stop(request);
|
|
35
|
+
if (requests.size === 0)
|
|
36
|
+
this.#byName.delete(name);
|
|
37
|
+
}
|
|
38
|
+
/** The names requests wait for, sorted. */
|
|
39
|
+
names() {
|
|
40
|
+
return [...this.#byName.keys()].sort();
|
|
41
|
+
}
|
|
42
|
+
/** The host's publication: every request indexed (by any name) runs its check again, out of the index first. */
|
|
43
|
+
wakeAll() {
|
|
44
|
+
const all = [...this.#byName.values()].flatMap((requests) => [...requests]);
|
|
45
|
+
this.#byName.clear();
|
|
46
|
+
for (const request of all)
|
|
47
|
+
this.#clock.stop(request);
|
|
48
|
+
for (const request of all)
|
|
49
|
+
request.wake();
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* A reload's publication: the requests indexed under `names` (the types and registries it serves) run their check
|
|
53
|
+
* again, out of the index first; the others stay (carry-over "Publications wake per name").
|
|
54
|
+
*/
|
|
55
|
+
wake(names) {
|
|
56
|
+
const woken = [];
|
|
57
|
+
for (const name of names) {
|
|
58
|
+
const requests = this.#byName.get(name);
|
|
59
|
+
if (requests === undefined)
|
|
60
|
+
continue;
|
|
61
|
+
this.#byName.delete(name);
|
|
62
|
+
woken.push(...requests);
|
|
63
|
+
}
|
|
64
|
+
for (const request of woken)
|
|
65
|
+
this.#clock.stop(request);
|
|
66
|
+
for (const request of woken)
|
|
67
|
+
request.wake();
|
|
68
|
+
}
|
|
69
|
+
/** Every indexed request acting for a principal `revoked` names ends with `error`. */
|
|
70
|
+
revoke(revoked, error) {
|
|
71
|
+
for (const requests of [...this.#byName.values()]) {
|
|
72
|
+
for (const request of [...requests]) {
|
|
73
|
+
if (request.principal !== undefined && revoked(request.principal))
|
|
74
|
+
request.end(error);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
/** The host closed: every indexed request ends with `error`. */
|
|
79
|
+
close(error) {
|
|
80
|
+
const all = [...this.#byName.values()].flatMap((requests) => [...requests]);
|
|
81
|
+
this.#byName.clear();
|
|
82
|
+
for (const request of all)
|
|
83
|
+
this.#clock.stop(request);
|
|
84
|
+
for (const request of all)
|
|
85
|
+
request.end(error);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=unbound.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unbound.js","sourceRoot":"","sources":["../../src/host/unbound.ts"],"names":[],"mappings":"AAAA,uHAAuH;AACvH,sHAAsH;AACtH,oHAAoH;AACpH,wHAAwH;AACxH,iHAAiH;AACjH,oHAAoH;AACpH,wHAAwH;AAexH,yCAAyC;AACzC,MAAM,OAAO,YAAY;IACf,OAAO,GAAG,IAAI,GAAG,EAA+B,CAAC;IACjD,MAAM,CAAe;IAE9B,YAAY,KAAmB;QAC9B,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACrB,CAAC;IAED;;;OAGG;IACH,GAAG,CAAC,IAAY,EAAE,OAAuB,EAAE,KAA+B;QACzE,IAAI,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACtC,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC5B,QAAQ,GAAG,IAAI,GAAG,EAAE,CAAC;YACrB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAClC,CAAC;QACD,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACtB,IAAI,KAAK,KAAK,SAAS;YAAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IACxE,CAAC;IAED,qDAAqD;IACrD,MAAM,CAAC,IAAY,EAAE,OAAuB;QAC3C,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACxC,IAAI,QAAQ,KAAK,SAAS,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC;YAAE,OAAO;QAChE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AE,OAAO,CAAC,IAAI,EAAE,CAAC;IAC7C,CAAC;IAED,sFAAsF;IACtF,MAAM,CAAC,OAA0C,EAAE,KAAiB;QACnE,KAAK,MAAM,QAAQ,IAAI,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC;YACnD,KAAK,MAAM,OAAO,IAAI,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC;gBACrC,IAAI,OAAO,CAAC,SAAS,KAAK,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC;oBAAE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YACvF,CAAC;QACF,CAAC;IACF,CAAC;IAED,gEAAgE;IAChE,KAAK,CAAC,KAAiB;QACtB,MAAM,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC;QAC5E,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QACrB,KAAK,MAAM,OAAO,IAAI,GAAG;YAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACrD,KAAK,MAAM,OAAO,IAAI,GAAG;YAAE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC/C,CAAC;CACD","sourcesContent":["// The unbound index (dependency model §1, §4): the requests a host decided cannot bind yet, by the name they wait for.\n// Before the host's first publication every hold arriving on its links, and a request made here while `load` runs the\n// setups (before `load` this host's own requests throw), waits here (`unpublished`); after it, those its check left\n// unbound (`not_served`, `version`): a reference made here, a hold that arrived over a link and was refused for a name.\n// A publication wakes the requests of the names it serves (`load`'s every one, a reload's those of its names); a\n// request leaves when it ends (released, settled, given up, its link or origin closed, revoked) or binds. A request\n// waiting with a cause (after the publication) is on the host's `UnboundClock` while it is indexed: reported after 5 s.\n\nimport type { ChordError, FailureCause, Principal } from \"../data/index.ts\";\nimport type { UnboundClock } from \"./unbound-clock.ts\";\n\n/** A request in the index: a reference made here or a hold that arrived over a link. */\nexport interface UnboundRequest {\n\t/** Whom it acts for: revocation ends the requests of a revoked principal. */\n\treadonly principal: Principal | undefined;\n\t/** The name it waits for became usable (or the host published): it runs its check again, leaving the index first. */\n\twake(): void;\n\t/** It is revoked, or its host closes: it ends with `error` (a hold sends `gone`), leaving the index. */\n\tend(error: ChordError): void;\n}\n\n/** A host's unbound requests by name. */\nexport class UnboundIndex {\n\treadonly #byName = new Map<string, Set<UnboundRequest>>();\n\treadonly #clock: UnboundClock;\n\n\tconstructor(clock: UnboundClock) {\n\t\tthis.#clock = clock;\n\t}\n\n\t/**\n\t * Indexes `request` under `name` (once; again after a wake), waiting for the publication (no `cause`) or for a\n\t * provider that fits (`cause`, on the clock).\n\t */\n\tadd(name: string, request: UnboundRequest, cause: FailureCause | undefined): void {\n\t\tlet requests = this.#byName.get(name);\n\t\tif (requests === undefined) {\n\t\t\trequests = new Set();\n\t\t\tthis.#byName.set(name, requests);\n\t\t}\n\t\trequests.add(request);\n\t\tif (cause !== undefined) this.#clock.start(request, name, cause.error);\n\t}\n\n\t/** `request` ended or binds: it leaves the index. */\n\tdelete(name: string, request: UnboundRequest): void {\n\t\tconst requests = this.#byName.get(name);\n\t\tif (requests === undefined || !requests.delete(request)) return;\n\t\tthis.#clock.stop(request);\n\t\tif (requests.size === 0) this.#byName.delete(name);\n\t}\n\n\t/** The names requests wait for, sorted. */\n\tnames(): string[] {\n\t\treturn [...this.#byName.keys()].sort();\n\t}\n\n\t/** The host's publication: every request indexed (by any name) runs its check again, out of the index first. */\n\twakeAll(): void {\n\t\tconst all = [...this.#byName.values()].flatMap((requests) => [...requests]);\n\t\tthis.#byName.clear();\n\t\tfor (const request of all) this.#clock.stop(request);\n\t\tfor (const request of all) request.wake();\n\t}\n\n\t/**\n\t * A reload's publication: the requests indexed under `names` (the types and registries it serves) run their check\n\t * again, out of the index first; the others stay (carry-over \"Publications wake per name\").\n\t */\n\twake(names: Iterable<string>): void {\n\t\tconst woken: UnboundRequest[] = [];\n\t\tfor (const name of names) {\n\t\t\tconst requests = this.#byName.get(name);\n\t\t\tif (requests === undefined) continue;\n\t\t\tthis.#byName.delete(name);\n\t\t\twoken.push(...requests);\n\t\t}\n\t\tfor (const request of woken) this.#clock.stop(request);\n\t\tfor (const request of woken) request.wake();\n\t}\n\n\t/** Every indexed request acting for a principal `revoked` names ends with `error`. */\n\trevoke(revoked: (principal: Principal) => boolean, error: ChordError): void {\n\t\tfor (const requests of [...this.#byName.values()]) {\n\t\t\tfor (const request of [...requests]) {\n\t\t\t\tif (request.principal !== undefined && revoked(request.principal)) request.end(error);\n\t\t\t}\n\t\t}\n\t}\n\n\t/** The host closed: every indexed request ends with `error`. */\n\tclose(error: ChordError): void {\n\t\tconst all = [...this.#byName.values()].flatMap((requests) => [...requests]);\n\t\tthis.#byName.clear();\n\t\tfor (const request of all) this.#clock.stop(request);\n\t\tfor (const request of all) request.end(error);\n\t}\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uuid.d.ts","sourceRoot":"","sources":["../../src/host/uuid.ts"],"names":[],"mappings":"AAUA,6BAA6B;AAC7B,wBAAgB,MAAM,IAAI,MAAM,CA0B/B"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// UUIDv7 (§3, code copied from diffra-ai's `uuidv7`): time-ordered ids, minted for host incarnations.
|
|
2
|
+
const MAX_SEQUENCE = (1n << 41n) - 1n;
|
|
3
|
+
/** The last timestamp used: a clock going backwards keeps the ids ordered. */
|
|
4
|
+
let lastTimestamp = -1;
|
|
5
|
+
/** A random start, then incremented per id, so ids within one millisecond stay ordered and unique. */
|
|
6
|
+
let sequence;
|
|
7
|
+
/** A time-ordered UUIDv7. */
|
|
8
|
+
export function uuidv7() {
|
|
9
|
+
const timestamp = Math.max(Date.now(), lastTimestamp);
|
|
10
|
+
lastTimestamp = timestamp;
|
|
11
|
+
const bytes = new Uint8Array(16);
|
|
12
|
+
globalThis.crypto.getRandomValues(bytes);
|
|
13
|
+
if (sequence === undefined) {
|
|
14
|
+
sequence =
|
|
15
|
+
(BigInt(bytes[1]) << 32n) |
|
|
16
|
+
(BigInt(bytes[2]) << 24n) |
|
|
17
|
+
(BigInt(bytes[3]) << 16n) |
|
|
18
|
+
(BigInt(bytes[4]) << 8n) |
|
|
19
|
+
BigInt(bytes[5]);
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
if (sequence === MAX_SEQUENCE)
|
|
23
|
+
throw new RangeError("UUIDv7 generator sequence exhausted");
|
|
24
|
+
sequence++;
|
|
25
|
+
}
|
|
26
|
+
const time = BigInt(timestamp);
|
|
27
|
+
for (let index = 5; index >= 0; index--)
|
|
28
|
+
bytes[index] = Number(time >> BigInt((5 - index) * 8)) & 0xff;
|
|
29
|
+
bytes[6] = 0x70 | Number((sequence >> 37n) & 0x0fn);
|
|
30
|
+
bytes[7] = Number((sequence >> 29n) & 0xffn);
|
|
31
|
+
bytes[8] = 0x80 | Number((sequence >> 23n) & 0x3fn);
|
|
32
|
+
bytes[9] = Number((sequence >> 15n) & 0xffn);
|
|
33
|
+
bytes[10] = Number((sequence >> 7n) & 0xffn);
|
|
34
|
+
bytes[11] = Number((sequence & 0x7fn) << 1n) | (bytes[11] & 0x01);
|
|
35
|
+
const hex = Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0"));
|
|
36
|
+
return `${hex.slice(0, 4).join("")}-${hex.slice(4, 6).join("")}-${hex.slice(6, 8).join("")}-${hex.slice(8, 10).join("")}-${hex.slice(10).join("")}`;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=uuid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uuid.js","sourceRoot":"","sources":["../../src/host/uuid.ts"],"names":[],"mappings":"AAAA,sGAAsG;AAEtG,MAAM,YAAY,GAAG,CAAC,EAAE,I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AAI,CAAC,EAAE,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;AACrJ,CAAC","sourcesContent":["// UUIDv7 (§3, code copied from diffra-ai's `uuidv7`): time-ordered ids, minted for host incarnations.\n\nconst MAX_SEQUENCE = (1n << 41n) - 1n;\n\n/** The last timestamp used: a clock going backwards keeps the ids ordered. */\nlet lastTimestamp = -1;\n\n/** A random start, then incremented per id, so ids within one millisecond stay ordered and unique. */\nlet sequence: bigint | undefined;\n\n/** A time-ordered UUIDv7. */\nexport function uuidv7(): string {\n\tconst timestamp = Math.max(Date.now(), lastTimestamp);\n\tlastTimestamp = timestamp;\n\tconst bytes = new Uint8Array(16);\n\tglobalThis.crypto.getRandomValues(bytes);\n\tif (sequence === undefined) {\n\t\tsequence =\n\t\t\t(BigInt(bytes[1]!) << 32n) |\n\t\t\t(BigInt(bytes[2]!) << 24n) |\n\t\t\t(BigInt(bytes[3]!) << 16n) |\n\t\t\t(BigInt(bytes[4]!) << 8n) |\n\t\t\tBigInt(bytes[5]!);\n\t} else {\n\t\tif (sequence === MAX_SEQUENCE) throw new RangeError(\"UUIDv7 generator sequence exhausted\");\n\t\tsequence++;\n\t}\n\tconst time = BigInt(timestamp);\n\tfor (let index = 5; index >= 0; index--) bytes[index] = Number(time >> BigInt((5 - index) * 8)) & 0xff;\n\tbytes[6] = 0x70 | Number((sequence >> 37n) & 0x0fn);\n\tbytes[7] = Number((sequence >> 29n) & 0xffn);\n\tbytes[8] = 0x80 | Number((sequence >> 23n) & 0x3fn);\n\tbytes[9] = Number((sequence >> 15n) & 0xffn);\n\tbytes[10] = Number((sequence >> 7n) & 0xffn);\n\tbytes[11] = Number((sequence & 0x7fn) << 1n) | (bytes[11]! & 0x01);\n\tconst hex = Array.from(bytes, (byte) => byte.toString(16).padStart(2, \"0\"));\n\treturn `${hex.slice(0, 4).join(\"\")}-${hex.slice(4, 6).join(\"\")}-${hex.slice(6, 8).join(\"\")}-${hex.slice(8, 10).join(\"\")}-${hex.slice(10).join(\"\")}`;\n}\n"]}
|