@earendil-works/chord 1.4.0 → 1.5.1
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 +92 -0
- package/README.md +115 -90
- package/dist/context/index.d.ts +1 -1
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js +1 -1
- package/dist/context/index.js.map +1 -1
- package/dist/contracts/accepts.d.ts +81 -0
- package/dist/contracts/accepts.d.ts.map +1 -0
- package/dist/contracts/accepts.js +123 -0
- package/dist/contracts/accepts.js.map +1 -0
- package/dist/contracts/contract.d.ts +121 -0
- package/dist/contracts/contract.d.ts.map +1 -0
- package/dist/contracts/contract.js +50 -0
- package/dist/contracts/contract.js.map +1 -0
- package/dist/contracts/declare.d.ts +107 -0
- package/dist/contracts/declare.d.ts.map +1 -0
- package/dist/contracts/declare.js +136 -0
- package/dist/contracts/declare.js.map +1 -0
- package/dist/contracts/evolve.d.ts +92 -0
- package/dist/contracts/evolve.d.ts.map +1 -0
- package/dist/contracts/evolve.js +179 -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 +50 -0
- package/dist/contracts/fingerprint.js.map +1 -0
- package/dist/contracts/history.d.ts +71 -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 +40 -0
- package/dist/contracts/host-kind.d.ts.map +1 -0
- package/dist/contracts/host-kind.js +37 -0
- package/dist/contracts/host-kind.js.map +1 -0
- package/dist/contracts/index.d.ts +7 -0
- package/dist/contracts/index.d.ts.map +1 -0
- package/dist/contracts/index.js +6 -0
- package/dist/contracts/index.js.map +1 -0
- package/dist/contracts/internal.d.ts +10 -0
- package/dist/contracts/internal.d.ts.map +1 -0
- package/dist/contracts/internal.js +9 -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 +50 -0
- package/dist/contracts/params.js.map +1 -0
- package/dist/contracts/schema.d.ts +102 -0
- package/dist/contracts/schema.d.ts.map +1 -0
- package/dist/contracts/schema.js +103 -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 +26 -0
- package/dist/data/failure.d.ts.map +1 -0
- package/dist/data/failure.js +77 -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 +22 -0
- package/dist/data/principal.d.ts.map +1 -0
- package/dist/data/principal.js +49 -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.js +3 -4
- package/dist/delta/apply-immutable-trusted.js.map +1 -1
- package/dist/delta/diff.d.ts.map +1 -1
- package/dist/delta/diff.js +5 -3
- package/dist/delta/diff.js.map +1 -1
- package/dist/delta/index.d.ts +9 -1
- package/dist/delta/index.d.ts.map +1 -1
- package/dist/delta/index.js +15 -11
- package/dist/delta/index.js.map +1 -1
- 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/tracker.d.ts +12 -0
- package/dist/delta/tracker.d.ts.map +1 -1
- package/dist/delta/tracker.js +109 -39
- package/dist/delta/tracker.js.map +1 -1
- 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 +84 -0
- package/dist/documents/definition.d.ts.map +1 -0
- package/dist/documents/definition.js +74 -0
- package/dist/documents/definition.js.map +1 -0
- package/dist/documents/documents.d.ts +126 -0
- package/dist/documents/documents.d.ts.map +1 -0
- package/dist/documents/documents.js +248 -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 +76 -0
- package/dist/documents/handles.d.ts.map +1 -0
- package/dist/documents/handles.js +66 -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 +103 -0
- package/dist/documents/keyed-slot.d.ts.map +1 -0
- package/dist/documents/keyed-slot.js +395 -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 +104 -0
- package/dist/documents/persistence.d.ts.map +1 -0
- package/dist/documents/persistence.js +129 -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 +109 -0
- package/dist/documents/slot.d.ts.map +1 -0
- package/dist/documents/slot.js +181 -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 +442 -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 +49 -0
- package/dist/host/adapted.d.ts.map +1 -0
- package/dist/host/adapted.js +214 -0
- package/dist/host/adapted.js.map +1 -0
- package/dist/host/attempt.d.ts +308 -0
- package/dist/host/attempt.d.ts.map +1 -0
- package/dist/host/attempt.js +1199 -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 +65 -0
- package/dist/host/dependencies.d.ts.map +1 -0
- package/dist/host/dependencies.js +115 -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/facet.d.ts +84 -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.d.ts +571 -0
- package/dist/host/host.d.ts.map +1 -0
- package/dist/host/host.js +1318 -0
- package/dist/host/host.js.map +1 -0
- package/dist/host/index.d.ts +17 -0
- package/dist/host/index.d.ts.map +1 -0
- package/dist/host/index.js +6 -0
- package/dist/host/index.js.map +1 -0
- package/dist/host/internal.d.ts +11 -0
- package/dist/host/internal.d.ts.map +1 -0
- package/dist/host/internal.js +9 -0
- package/dist/host/internal.js.map +1 -0
- package/dist/host/members.d.ts +50 -0
- package/dist/host/members.d.ts.map +1 -0
- package/dist/host/members.js +107 -0
- package/dist/host/members.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 +331 -0
- package/dist/host/object.d.ts.map +1 -0
- package/dist/host/object.js +1296 -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/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-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 +65 -0
- package/dist/host/reference-source.d.ts.map +1 -0
- package/dist/host/reference-source.js +285 -0
- package/dist/host/reference-source.js.map +1 -0
- package/dist/host/reference.d.ts +321 -0
- package/dist/host/reference.d.ts.map +1 -0
- package/dist/host/reference.js +797 -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.d.ts +64 -0
- package/dist/host/route.d.ts.map +1 -0
- package/dist/host/route.js +227 -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 +94 -0
- package/dist/host/staging.d.ts.map +1 -0
- package/dist/host/staging.js +304 -0
- package/dist/host/staging.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 +29 -18
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +20 -9
- package/dist/index.js.map +1 -1
- 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/link/binary.d.ts +4 -0
- package/dist/link/binary.d.ts.map +1 -0
- package/dist/link/binary.js +544 -0
- package/dist/link/binary.js.map +1 -0
- package/dist/link/channel.d.ts +68 -0
- package/dist/link/channel.d.ts.map +1 -0
- package/dist/link/channel.js +215 -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 +262 -0
- package/dist/link/message.d.ts.map +1 -0
- package/dist/link/message.js +156 -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 +355 -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 +269 -0
- package/dist/node/app/app.d.ts.map +1 -0
- package/dist/node/app/app.js +513 -0
- package/dist/node/app/app.js.map +1 -0
- package/dist/node/app/archive.d.ts +37 -0
- package/dist/node/app/archive.d.ts.map +1 -0
- package/dist/node/app/archive.js +204 -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 +35 -0
- package/dist/node/app/data.d.ts.map +1 -0
- package/dist/node/app/data.js +44 -0
- package/dist/node/app/data.js.map +1 -0
- package/dist/node/app/ephemeral-sessions.d.ts +20 -0
- package/dist/node/app/ephemeral-sessions.d.ts.map +1 -0
- package/dist/node/app/ephemeral-sessions.js +69 -0
- package/dist/node/app/ephemeral-sessions.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 +363 -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 +66 -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/sessions.d.ts +72 -0
- package/dist/node/app/sessions.d.ts.map +1 -0
- package/dist/node/app/sessions.js +222 -0
- package/dist/node/app/sessions.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 +37 -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 +63 -0
- package/dist/node/http/admission.d.ts.map +1 -0
- package/dist/node/http/admission.js +134 -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 +111 -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 +61 -0
- package/dist/node/http/upgrades.d.ts.map +1 -0
- package/dist/node/http/upgrades.js +192 -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 +576 -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 +38 -0
- package/dist/node/plugins/install.d.ts.map +1 -0
- package/dist/node/plugins/install.js +213 -0
- package/dist/node/plugins/install.js.map +1 -0
- package/dist/node/plugins/plugins.d.ts +162 -0
- package/dist/node/plugins/plugins.d.ts.map +1 -0
- package/dist/node/plugins/plugins.js +244 -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 +61 -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 +31 -0
- package/dist/node/surfaces/bundle.d.ts.map +1 -0
- package/dist/node/surfaces/bundle.js +118 -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 +15 -0
- package/dist/node/surfaces/served.d.ts.map +1 -0
- package/dist/node/surfaces/served.js +42 -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 +40 -0
- package/dist/node/surfaces/tui.d.ts.map +1 -0
- package/dist/node/surfaces/tui.js +55 -0
- package/dist/node/surfaces/tui.js.map +1 -0
- package/dist/node/surfaces/web.d.ts +56 -0
- package/dist/node/surfaces/web.d.ts.map +1 -0
- package/dist/node/surfaces/web.js +108 -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 +255 -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 +42 -0
- package/dist/node/workers/process.d.ts.map +1 -0
- package/dist/node/workers/process.js +125 -0
- package/dist/node/workers/process.js.map +1 -0
- package/dist/node/workers/workers.d.ts +122 -0
- package/dist/node/workers/workers.d.ts.map +1 -0
- package/dist/node/workers/workers.js +677 -0
- package/dist/node/workers/workers.js.map +1 -0
- package/dist/output.d.ts +1 -1
- package/dist/output.d.ts.map +1 -1
- package/dist/output.js +4 -2
- package/dist/output.js.map +1 -1
- package/dist/react/hooks.d.ts +43 -0
- package/dist/react/hooks.d.ts.map +1 -0
- package/dist/react/hooks.js +82 -0
- package/dist/react/hooks.js.map +1 -0
- package/dist/react/index.d.ts +3 -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 +25 -0
- package/dist/remote/calls.d.ts.map +1 -0
- package/dist/remote/calls.js +62 -0
- package/dist/remote/calls.js.map +1 -0
- package/dist/remote/consumer.d.ts +43 -0
- package/dist/remote/consumer.d.ts.map +1 -0
- package/dist/remote/consumer.js +350 -0
- package/dist/remote/consumer.js.map +1 -0
- package/dist/remote/hold.d.ts +141 -0
- package/dist/remote/hold.d.ts.map +1 -0
- package/dist/remote/hold.js +579 -0
- package/dist/remote/hold.js.map +1 -0
- package/dist/remote/host-link.d.ts +77 -0
- package/dist/remote/host-link.d.ts.map +1 -0
- package/dist/remote/host-link.js +184 -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 +46 -0
- package/dist/remote/path.d.ts.map +1 -0
- package/dist/remote/path.js +73 -0
- package/dist/remote/path.js.map +1 -0
- package/dist/remote/provider.d.ts +89 -0
- package/dist/remote/provider.d.ts.map +1 -0
- package/dist/remote/provider.js +597 -0
- package/dist/remote/provider.js.map +1 -0
- package/dist/remote/relay.d.ts +69 -0
- package/dist/remote/relay.d.ts.map +1 -0
- package/dist/remote/relay.js +219 -0
- package/dist/remote/relay.js.map +1 -0
- package/dist/remote/remote-object.d.ts +138 -0
- package/dist/remote/remote-object.d.ts.map +1 -0
- package/dist/remote/remote-object.js +492 -0
- package/dist/remote/remote-object.js.map +1 -0
- package/dist/remote/replica.d.ts +59 -0
- package/dist/remote/replica.d.ts.map +1 -0
- package/dist/remote/replica.js +125 -0
- package/dist/remote/replica.js.map +1 -0
- package/dist/sqlite/cloudflare.d.ts +2 -0
- package/dist/sqlite/cloudflare.d.ts.map +1 -1
- package/dist/sqlite/cloudflare.js +10 -0
- package/dist/sqlite/cloudflare.js.map +1 -1
- package/dist/sqlite/database.d.ts +5 -2
- package/dist/sqlite/database.d.ts.map +1 -1
- package/dist/sqlite/database.js.map +1 -1
- package/dist/sqlite/node.d.ts +13 -2
- package/dist/sqlite/node.d.ts.map +1 -1
- package/dist/sqlite/node.js +31 -8
- package/dist/sqlite/node.js.map +1 -1
- 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 +52 -0
- package/dist/state/derive.d.ts.map +1 -0
- package/dist/state/derive.js +182 -0
- package/dist/state/derive.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 +6 -0
- package/dist/state/internal.d.ts.map +1 -0
- package/dist/state/internal.js +8 -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 +375 -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 +32 -0
- package/dist/store/archive.d.ts.map +1 -0
- package/dist/store/archive.js +130 -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/columns.d.ts +77 -0
- package/dist/store/columns.d.ts.map +1 -0
- package/dist/store/columns.js +77 -0
- package/dist/store/columns.js.map +1 -0
- package/dist/store/engine.d.ts +176 -0
- package/dist/store/engine.d.ts.map +1 -0
- package/dist/store/engine.js +283 -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 +128 -0
- package/dist/store/evaluate.js.map +1 -0
- package/dist/store/export.d.ts +17 -0
- package/dist/store/export.d.ts.map +1 -0
- package/dist/store/export.js +200 -0
- package/dist/store/export.js.map +1 -0
- package/dist/store/expression.d.ts +150 -0
- package/dist/store/expression.d.ts.map +1 -0
- package/dist/store/expression.js +268 -0
- package/dist/store/expression.js.map +1 -0
- package/dist/store/import.d.ts +10 -0
- package/dist/store/import.d.ts.map +1 -0
- package/dist/store/import.js +276 -0
- package/dist/store/import.js.map +1 -0
- package/dist/store/index.d.ts +16 -0
- package/dist/store/index.d.ts.map +1 -0
- package/dist/store/index.js +13 -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 +108 -0
- package/dist/store/live-query.d.ts.map +1 -0
- package/dist/store/live-query.js +254 -0
- package/dist/store/live-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/query.d.ts +39 -0
- package/dist/store/query.d.ts.map +1 -0
- package/dist/store/query.js +97 -0
- package/dist/store/query.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 +80 -0
- package/dist/store/rows.d.ts.map +1 -0
- package/dist/store/rows.js +183 -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 +115 -0
- package/dist/store/schema.js.map +1 -0
- package/dist/store/sql.d.ts +73 -0
- package/dist/store/sql.d.ts.map +1 -0
- package/dist/store/sql.js +234 -0
- package/dist/store/sql.js.map +1 -0
- package/dist/store/step.d.ts +50 -0
- package/dist/store/step.d.ts.map +1 -0
- package/dist/store/step.js +52 -0
- package/dist/store/step.js.map +1 -0
- package/dist/store/store.d.ts +171 -0
- package/dist/store/store.d.ts.map +1 -0
- package/dist/store/store.js +818 -0
- package/dist/store/store.js.map +1 -0
- package/dist/store/table-changes.d.ts +29 -0
- package/dist/store/table-changes.d.ts.map +1 -0
- package/dist/store/table-changes.js +102 -0
- package/dist/store/table-changes.js.map +1 -0
- package/dist/store/table-evolve.d.ts +74 -0
- package/dist/store/table-evolve.d.ts.map +1 -0
- package/dist/store/table-evolve.js +201 -0
- package/dist/store/table-evolve.js.map +1 -0
- package/dist/store/table-handle.d.ts +73 -0
- package/dist/store/table-handle.d.ts.map +1 -0
- package/dist/store/table-handle.js +101 -0
- package/dist/store/table-handle.js.map +1 -0
- package/dist/store/table-history.d.ts +75 -0
- package/dist/store/table-history.d.ts.map +1 -0
- package/dist/store/table-history.js +42 -0
- package/dist/store/table-history.js.map +1 -0
- package/dist/store/table-migration.d.ts +16 -0
- package/dist/store/table-migration.d.ts.map +1 -0
- package/dist/store/table-migration.js +202 -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 +80 -0
- package/dist/store/table.d.ts.map +1 -0
- package/dist/store/table.js +103 -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 +96 -0
- package/dist/surfaces/client.d.ts.map +1 -0
- package/dist/surfaces/client.js +264 -0
- package/dist/surfaces/client.js.map +1 -0
- package/dist/surfaces/connection.d.ts +49 -0
- package/dist/surfaces/connection.d.ts.map +1 -0
- package/dist/surfaces/connection.js +142 -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 +25 -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 +32 -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 +84 -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 +31 -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/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 +166 -0
- package/dist/sync/client.d.ts.map +1 -0
- package/dist/sync/client.js +438 -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 +185 -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 +130 -0
- package/dist/sync/remote.d.ts.map +1 -0
- package/dist/sync/remote.js +46 -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 +70 -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 +21 -0
- package/dist/telemetry-ingest/facet.d.ts.map +1 -0
- package/dist/telemetry-ingest/facet.js +96 -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 +13 -4
- package/dist/telemetry-sqlite/index.d.ts.map +1 -1
- package/dist/telemetry-sqlite/index.js +81 -241
- package/dist/telemetry-sqlite/index.js.map +1 -1
- 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 +3 -0
- package/dist/telemetry-sqlite/store.d.ts.map +1 -1
- package/dist/telemetry-sqlite/store.js +24 -13
- package/dist/telemetry-sqlite/store.js.map +1 -1
- package/dist/telemetry.d.ts +937 -0
- package/dist/telemetry.d.ts.map +1 -0
- package/dist/telemetry.js +470 -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 +7 -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 +46 -0
- package/dist/tui/scope.d.ts.map +1 -0
- package/dist/tui/scope.js +141 -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 +29 -0
- package/dist/web/page.d.ts.map +1 -0
- package/dist/web/page.js +92 -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/benchmarks.md +1036 -0
- package/docs/decisions.md +3436 -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 +3065 -0
- package/docs/durable-observers/book.md +432 -0
- package/docs/durable-observers/index.html +517 -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 +957 -0
- package/docs/guide-plugins-hosts/index.html +952 -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 +276 -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/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-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 +241 -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 +2169 -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 +114 -20
- package/src/delta/README.md +69 -0
- package/dist/cell.d.ts +0 -122
- package/dist/cell.d.ts.map +0 -1
- package/dist/cell.js +0 -356
- package/dist/cell.js.map +0 -1
- package/dist/cluster.d.ts +0 -27
- package/dist/cluster.d.ts.map +0 -1
- package/dist/cluster.js +0 -230
- package/dist/cluster.js.map +0 -1
- package/dist/connection.d.ts +0 -270
- package/dist/connection.d.ts.map +0 -1
- package/dist/connection.js +0 -1216
- package/dist/connection.js.map +0 -1
- package/dist/contract.d.ts +0 -208
- package/dist/contract.d.ts.map +0 -1
- package/dist/contract.js +0 -246
- package/dist/contract.js.map +0 -1
- package/dist/declare.d.ts +0 -33
- package/dist/declare.d.ts.map +0 -1
- package/dist/declare.js +0 -2
- package/dist/declare.js.map +0 -1
- package/dist/errors.d.ts +0 -28
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -59
- package/dist/errors.js.map +0 -1
- package/dist/host.d.ts +0 -348
- package/dist/host.d.ts.map +0 -1
- package/dist/host.js +0 -1000
- package/dist/host.js.map +0 -1
- package/dist/link.d.ts +0 -107
- package/dist/link.d.ts.map +0 -1
- package/dist/link.js +0 -355
- package/dist/link.js.map +0 -1
- package/dist/loader.d.ts +0 -4
- package/dist/loader.d.ts.map +0 -1
- package/dist/loader.js +0 -73
- package/dist/loader.js.map +0 -1
- package/dist/manager.d.ts +0 -115
- package/dist/manager.d.ts.map +0 -1
- package/dist/manager.js +0 -345
- package/dist/manager.js.map +0 -1
- package/dist/node.d.ts +0 -4
- package/dist/node.d.ts.map +0 -1
- package/dist/node.js +0 -4
- package/dist/node.js.map +0 -1
- package/dist/object.d.ts +0 -438
- package/dist/object.d.ts.map +0 -1
- package/dist/object.js +0 -1571
- package/dist/object.js.map +0 -1
- package/dist/publish.d.ts +0 -5
- package/dist/publish.d.ts.map +0 -1
- package/dist/publish.js +0 -40
- package/dist/publish.js.map +0 -1
- package/dist/registry.d.ts +0 -25
- package/dist/registry.d.ts.map +0 -1
- package/dist/registry.js +0 -6
- package/dist/registry.js.map +0 -1
- package/dist/reload.d.ts +0 -126
- package/dist/reload.d.ts.map +0 -1
- package/dist/reload.js +0 -653
- package/dist/reload.js.map +0 -1
- package/dist/remote.d.ts +0 -165
- package/dist/remote.d.ts.map +0 -1
- package/dist/remote.js +0 -612
- package/dist/remote.js.map +0 -1
- package/dist/schema.d.ts +0 -21
- package/dist/schema.d.ts.map +0 -1
- package/dist/schema.js +0 -228
- package/dist/schema.js.map +0 -1
- package/dist/state.d.ts +0 -92
- package/dist/state.d.ts.map +0 -1
- package/dist/state.js +0 -287
- package/dist/state.js.map +0 -1
- package/dist/types.d.ts +0 -88
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
- package/dist/websocket.d.ts +0 -15
- package/dist/websocket.d.ts.map +0 -1
- package/dist/websocket.js +0 -16
- package/dist/websocket.js.map +0 -1
- package/dist/wire.d.ts +0 -216
- package/dist/wire.d.ts.map +0 -1
- package/dist/wire.js +0 -165
- package/dist/wire.js.map +0 -1
- package/docs/guide.md +0 -814
- package/docs/spec.md +0 -288
- package/docs/tutorial.md +0 -931
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
// Live queries (decision "Live queries over an object's own tables"): `self.query(table, q, limit)`, a JSON watchable
|
|
2
|
+
// of a query's rows over a table of the object itself. Run once before the object goes live, then again inside the
|
|
3
|
+
// commit step of every commit of the object that wrote the table (after its writes, so it sees them) and published in
|
|
4
|
+
// that commit's batch as the diff from the previous rows (W1). Only the object writes its tables, so its commits are
|
|
5
|
+
// the exact invalidation; a commit writing no table with a live query runs none.
|
|
6
|
+
import { ChordError } from "../data/index.js";
|
|
7
|
+
import { invalid } from "../data/internal.js";
|
|
8
|
+
import { diffRevisions } from "../delta/index.js";
|
|
9
|
+
import { handedOut, Source } from "../state/internal.js";
|
|
10
|
+
import { chordMetrics } from "../telemetry.js";
|
|
11
|
+
/**
|
|
12
|
+
* Refuses what the types cannot (plugin code is bundled without type checks; declaration policy): a query of another
|
|
13
|
+
* table than `table`, and a `limit` that is no positive integer (a live query must be bounded: one run per commit
|
|
14
|
+
* that writes its table reads at most `limit` rows).
|
|
15
|
+
*/
|
|
16
|
+
export function checkLiveQuery(table, q, limit, label) {
|
|
17
|
+
if (q.table !== table) {
|
|
18
|
+
throw invalid("args", `${label}: self.query: a query of table "${q.table.name}" over "${table.name}"`);
|
|
19
|
+
}
|
|
20
|
+
if (!Number.isSafeInteger(limit) || limit < 1) {
|
|
21
|
+
throw invalid("args", `${label}: self.query: a limit is required, a positive integer`);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/** The live queries of one object by table (its SQL name), across its attempts: what its commits re-run. */
|
|
25
|
+
export class LiveQueries {
|
|
26
|
+
#byTable = new Map();
|
|
27
|
+
/** Adds `query` (its attempt declared it): re-run by every commit writing its table from now on. */
|
|
28
|
+
add(query) {
|
|
29
|
+
const table = query.handle.sql.table;
|
|
30
|
+
let queries = this.#byTable.get(table);
|
|
31
|
+
if (queries === undefined) {
|
|
32
|
+
queries = new Set();
|
|
33
|
+
this.#byTable.set(table, queries);
|
|
34
|
+
}
|
|
35
|
+
queries.add(query);
|
|
36
|
+
}
|
|
37
|
+
/** Removes `query` (its attempt ended). */
|
|
38
|
+
delete(query) {
|
|
39
|
+
const table = query.handle.sql.table;
|
|
40
|
+
const queries = this.#byTable.get(table);
|
|
41
|
+
if (queries === undefined)
|
|
42
|
+
return;
|
|
43
|
+
queries.delete(query);
|
|
44
|
+
if (queries.size === 0)
|
|
45
|
+
this.#byTable.delete(table);
|
|
46
|
+
}
|
|
47
|
+
/** The live queries over `table`, if any. */
|
|
48
|
+
on(table) {
|
|
49
|
+
return this.#byTable.get(table);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* The re-run of the live queries over the tables a transaction writes (`handles`), `undefined` when none has one (the
|
|
54
|
+
* common case: a map lookup per written table, nothing more). `context` is the transaction's: the runs count through it.
|
|
55
|
+
*/
|
|
56
|
+
export function refreshOf(handles, context) {
|
|
57
|
+
let queries;
|
|
58
|
+
for (const handle of handles) {
|
|
59
|
+
const on = handle.owner.queries.on(handle.sql.table);
|
|
60
|
+
if (on === undefined)
|
|
61
|
+
continue;
|
|
62
|
+
queries ??= new Set();
|
|
63
|
+
for (const query of on)
|
|
64
|
+
queries.add(query);
|
|
65
|
+
}
|
|
66
|
+
return queries === undefined ? undefined : new QueryRefresh([...queries], context);
|
|
67
|
+
}
|
|
68
|
+
const NO_WRITES = [];
|
|
69
|
+
/**
|
|
70
|
+
* The re-run of live queries in one commit: `write` reads them in the commit step after the commit's own writes (the
|
|
71
|
+
* last write of the last phase), and `adopt` publishes their rows in the commit's batch; a refused step adopts nothing.
|
|
72
|
+
* A transaction stages it as its own change (`Staged`).
|
|
73
|
+
*/
|
|
74
|
+
export class QueryRefresh {
|
|
75
|
+
#queries;
|
|
76
|
+
#context;
|
|
77
|
+
#runs = [];
|
|
78
|
+
/** The staged write that reads the queries; it writes nothing and records nothing in the outbox. */
|
|
79
|
+
write;
|
|
80
|
+
constructor(queries, context) {
|
|
81
|
+
this.#queries = queries;
|
|
82
|
+
this.#context = context;
|
|
83
|
+
this.write = { order: "write", apply: (step) => this.#rerun(step) };
|
|
84
|
+
}
|
|
85
|
+
async #rerun(step) {
|
|
86
|
+
// A grouped commit that rolled back applies again alone (store.ts): only the last application's runs count.
|
|
87
|
+
this.#runs.length = 0;
|
|
88
|
+
for (const query of this.#queries)
|
|
89
|
+
this.#runs.push(await query.rerun(step, this.#context));
|
|
90
|
+
return NO_WRITES;
|
|
91
|
+
}
|
|
92
|
+
/** Publishes each query's new rows (or its failure), inside the commit's batch. */
|
|
93
|
+
adopt() {
|
|
94
|
+
for (const [index, query] of this.#queries.entries())
|
|
95
|
+
query.adopt(this.#runs[index]);
|
|
96
|
+
}
|
|
97
|
+
committed() { }
|
|
98
|
+
discarded() { }
|
|
99
|
+
}
|
|
100
|
+
/** What the watches of a failed live query had: no rows, so its next rows replace the value whole. */
|
|
101
|
+
const NO_VALUE = Symbol("no value");
|
|
102
|
+
const NO_ROWS = new Map();
|
|
103
|
+
/**
|
|
104
|
+
* A live query: the rows of `query` (at most `limit`, in its order) over its object's table `handle`, as a JSON source
|
|
105
|
+
* (a state member, a derive source, an `on` source). Its statement is compiled once; each run decodes only the rows
|
|
106
|
+
* whose stored columns changed and keeps the others the same objects, so its frame, the diff from the rows its watches
|
|
107
|
+
* had, compares unchanged rows by identity (a window shifted by one row: one insert and one removal, not a comparison
|
|
108
|
+
* of every row with every other).
|
|
109
|
+
*/
|
|
110
|
+
export class LiveQuery extends Source {
|
|
111
|
+
handle;
|
|
112
|
+
#owner;
|
|
113
|
+
#statement;
|
|
114
|
+
#state = { kind: "loading" };
|
|
115
|
+
/** The last adopted rows by key, with the stored rows they were decoded from (the next run reuses unchanged ones). */
|
|
116
|
+
#byKey = NO_ROWS;
|
|
117
|
+
/** The rows this query's watches have, kept from its adoption to its frame in the batch; `undefined`: not listed. */
|
|
118
|
+
#framed;
|
|
119
|
+
/** Commits adopted so far: an activation run that a commit overtook keeps the commit's newer rows. */
|
|
120
|
+
#adopted = 0;
|
|
121
|
+
/** Set from a failed run until the next good one: a failure episode is reported once. */
|
|
122
|
+
#failing = false;
|
|
123
|
+
constructor(handle, query, limit, owner, batch) {
|
|
124
|
+
super(batch);
|
|
125
|
+
this.handle = handle;
|
|
126
|
+
this.#owner = owner;
|
|
127
|
+
this.#statement = handle.sql.select(query.condition, query.order, undefined, limit);
|
|
128
|
+
}
|
|
129
|
+
get value() {
|
|
130
|
+
const state = this.#state;
|
|
131
|
+
if (state.kind === "rows")
|
|
132
|
+
return state.value;
|
|
133
|
+
if (state.kind === "loading") {
|
|
134
|
+
throw new ChordError({ code: "not_ready", message: `${this.#owner.label}: a live query read before it ran` });
|
|
135
|
+
}
|
|
136
|
+
throw state.error;
|
|
137
|
+
}
|
|
138
|
+
/** Its rows, or while failed its failure and last good rows (a detached query throws). */
|
|
139
|
+
start() {
|
|
140
|
+
const state = this.#state;
|
|
141
|
+
if (state.kind === "failed")
|
|
142
|
+
return { kind: "failed", error: state.error, last: state.last };
|
|
143
|
+
return { kind: "value", value: this.value };
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* The first run, before its object goes live (activation, after its tables are prepared): a failure throws and fails
|
|
147
|
+
* the activation. Rows a commit adopted meanwhile are newer and stay.
|
|
148
|
+
*/
|
|
149
|
+
async load(context) {
|
|
150
|
+
const adopted = this.#adopted;
|
|
151
|
+
this.#count(context);
|
|
152
|
+
const { sql, params } = this.#statement;
|
|
153
|
+
const stored = await this.handle.store.read((executor) => executor.all(sql, ...params), context);
|
|
154
|
+
// Decoded outside the store's read: a row the code cannot read is this query's failure, not the backend's.
|
|
155
|
+
const rows = this.#decode(stored, context);
|
|
156
|
+
if (this.#adopted !== adopted)
|
|
157
|
+
return;
|
|
158
|
+
this.#byKey = rows.byKey;
|
|
159
|
+
this.#state = { kind: "rows", value: rows.value };
|
|
160
|
+
}
|
|
161
|
+
/** A run inside the commit step `step`, after its writes: the rows, or the failure; it never throws. */
|
|
162
|
+
async rerun(step, context) {
|
|
163
|
+
try {
|
|
164
|
+
this.#count(context);
|
|
165
|
+
const { sql, params } = this.#statement;
|
|
166
|
+
return { kind: "rows", rows: this.#decode(await step.all(sql, ...params), context) };
|
|
167
|
+
}
|
|
168
|
+
catch (error) {
|
|
169
|
+
return { kind: "failed", error };
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Takes a commit's run, inside its batch: listed for a frame when watched, its dependents marked. A failed run makes
|
|
174
|
+
* the query a failed member (as a throwing derive): its watches get one failure call, the owner a report per
|
|
175
|
+
* failure episode; the next good run replaces the value whole.
|
|
176
|
+
*/
|
|
177
|
+
adopt(run) {
|
|
178
|
+
const state = this.#state;
|
|
179
|
+
if (state.kind === "detached")
|
|
180
|
+
return;
|
|
181
|
+
this.#adopted++;
|
|
182
|
+
if (this.watched && this.#framed === undefined)
|
|
183
|
+
this.#framed = state.kind === "rows" ? state.value : NO_VALUE;
|
|
184
|
+
if (run.kind === "rows") {
|
|
185
|
+
this.#failing = false;
|
|
186
|
+
this.#byKey = run.rows.byKey;
|
|
187
|
+
this.#state = { kind: "rows", value: run.rows.value };
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
if (!this.#failing)
|
|
191
|
+
this.#owner.report(handedOut(run.error));
|
|
192
|
+
this.#failing = true;
|
|
193
|
+
const last = state.kind === "rows" ? state.value : state.kind === "failed" ? state.last : undefined;
|
|
194
|
+
this.#state = { kind: "failed", error: run.error, last };
|
|
195
|
+
}
|
|
196
|
+
this.changed();
|
|
197
|
+
}
|
|
198
|
+
/** Delivers the frame: the diff from the rows its watches had, or one failure call when they had rows. */
|
|
199
|
+
deliver(context) {
|
|
200
|
+
const before = this.#framed;
|
|
201
|
+
this.#framed = undefined;
|
|
202
|
+
const state = this.#state;
|
|
203
|
+
if (state.kind === "rows") {
|
|
204
|
+
// Listed by `adopt`, so `before` was kept (a detach in the batch leaves no rows).
|
|
205
|
+
const after = state.value;
|
|
206
|
+
const ops = before === NO_VALUE ? [["r", after]] : diffRevisions(before, after);
|
|
207
|
+
if (ops.length > 0)
|
|
208
|
+
this.publish(after, ops, false, context);
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
// Still failed since the last call: nothing new for the watches.
|
|
212
|
+
if (state.kind === "failed" && before !== NO_VALUE)
|
|
213
|
+
this.failWatches(state.error, context);
|
|
214
|
+
}
|
|
215
|
+
/** Its attempt ended: no commit re-runs it, reads throw `error` (the object's), its watches end `ended`. */
|
|
216
|
+
detach(error) {
|
|
217
|
+
this.handle.owner.queries.delete(this);
|
|
218
|
+
this.#state = { kind: "detached", error };
|
|
219
|
+
this.#framed = undefined;
|
|
220
|
+
this.endWatches();
|
|
221
|
+
}
|
|
222
|
+
/** One run, counted where it happens (the cost guard: a commit not writing the table runs none). */
|
|
223
|
+
#count(context) {
|
|
224
|
+
chordMetrics(context.telemetry.metrics).counter("chord.query.runs").add(1);
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* The rows of `stored`: a row whose stored columns are all the same as in the last adopted run is that run's object
|
|
228
|
+
* (one comparison per physical column), any other is decoded.
|
|
229
|
+
*/
|
|
230
|
+
#decode(stored, context) {
|
|
231
|
+
const { key, rows } = this.handle.definition;
|
|
232
|
+
const value = [];
|
|
233
|
+
const byKey = new Map();
|
|
234
|
+
for (const each of stored) {
|
|
235
|
+
const id = key.length === 1 ? each[key[0]] : JSON.stringify(key.map((column) => each[column]));
|
|
236
|
+
const before = this.#byKey.get(id);
|
|
237
|
+
const row = before !== undefined && sameStored(before.stored, each, rows.physical)
|
|
238
|
+
? before.row
|
|
239
|
+
: // A table's rows hold its columns' values: scalars and JSON.
|
|
240
|
+
rows.decode(each, context);
|
|
241
|
+
value.push(row);
|
|
242
|
+
byKey.set(id, { stored: each, row });
|
|
243
|
+
}
|
|
244
|
+
return { value, byKey };
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
/** Whether two stored rows have the same value in every physical column (SQLite values compare by `===`). */
|
|
248
|
+
function sameStored(a, b, physical) {
|
|
249
|
+
for (const column of physical)
|
|
250
|
+
if (a[column] !== b[column])
|
|
251
|
+
return false;
|
|
252
|
+
return true;
|
|
253
|
+
}
|
|
254
|
+
//# sourceMappingURL=live-query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"live-query.js","sourceRoot":"","sources":["../../src/store/live-query.ts"],"names":[],"mappings":"AAAA,sHAAsH;AACtH,mHA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AAE,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC;YAAE,OAAO,KAAK,CAAC;IACzE,OAAO,IAAI,CAAC;AACb,CAAC","sourcesContent":["// Live queries (decision \"Live queries over an object's own tables\"): `self.query(table, q, limit)`, a JSON watchable\n// of a query's rows over a table of the object itself. Run once before the object goes live, then again inside the\n// commit step of every commit of the object that wrote the table (after its writes, so it sees them) and published in\n// that commit's batch as the diff from the previous rows (W1). Only the object writes its tables, so its commits are\n// the exact invalidation; a commit writing no table with a live query runs none.\n\nimport type { Context } from \"../context/index.ts\";\nimport { ChordError } from \"../data/index.ts\";\nimport { invalid } from \"../data/internal.ts\";\nimport { diffRevisions, type Op } from \"../delta/index.ts\";\nimport type { JsonValue } from \"../json.ts\";\nimport type { SqliteValue } from \"../sqlite/index.ts\";\nimport { type Batch, handedOut, Source, type WatchStart } from \"../state/internal.ts\";\nimport { chordMetrics } from \"../telemetry.ts\";\nimport type { Query } from \"./query.ts\";\nimport type { Statement } from \"./sql.ts\";\nimport type { StagedWrite, Step } from \"./step.ts\";\nimport type { TableDefinition } from \"./table.ts\";\nimport type { TableHandle } from \"./table-handle.ts\";\nimport type { StoreWrite } from \"./writes.ts\";\n\n/** Who a live query belongs to: its object, and where its failures after activation are reported (`query_failed`). */\nexport type QueryOwner = {\n\treadonly label: string;\n\treport(error: unknown): void;\n};\n\n/**\n * The rows of one run: in order, and by key with the stored row each was decoded from, which the next run compares\n * against to keep an unchanged row the same object.\n */\ntype Rows = { readonly value: JsonValue[]; readonly byKey: ReadonlyMap<unknown, Decoded> };\n\n/** A row as a run decoded it, with the stored row it came from. */\ntype Decoded = { readonly stored: StoredRow; readonly row: JsonValue };\n\n/** One run of a live query in a commit step: its rows, or why it could not read them. */\ntype QueryRun = { readonly kind: \"rows\"; readonly rows: Rows } | { readonly kind: \"failed\"; readonly error: unknown };\n\n/**\n * Where a live query stands: before its first run (activation), with rows, failed (its last run threw; its last good\n * rows kept for a watch opened meanwhile), or detached (its attempt ended).\n */\ntype QueryState =\n\t| { readonly kind: \"loading\" }\n\t| { readonly kind: \"rows\"; readonly value: JsonValue[] }\n\t| { readonly kind: \"failed\"; readonly error: unknown; readonly last: JsonValue[] | undefined }\n\t| { readonly kind: \"detached\"; readonly error: unknown };\n\n/** A stored row as the backend returns it. */\ntype StoredRow = { readonly [column: string]: SqliteValue };\n\n/**\n * Refuses what the types cannot (plugin code is bundled without type checks; declaration policy): a query of another\n * table than `table`, and a `limit` that is no positive integer (a live query must be bounded: one run per commit\n * that writes its table reads at most `limit` rows).\n */\nexport function checkLiveQuery(table: TableDefinition, q: Query, limit: unknown, label: string): void {\n\tif (q.table !== table) {\n\t\tthrow invalid(\"args\", `${label}: self.query: a query of table \"${q.table.name}\" over \"${table.name}\"`);\n\t}\n\tif (!Number.isSafeInteger(limit) || (limit as number) < 1) {\n\t\tthrow invalid(\"args\", `${label}: self.query: a limit is required, a positive integer`);\n\t}\n}\n\n/** The live queries of one object by table (its SQL name), across its attempts: what its commits re-run. */\nexport class LiveQueries {\n\treadonly #byTable = new Map<string, Set<LiveQuery>>();\n\n\t/** Adds `query` (its attempt declared it): re-run by every commit writing its table from now on. */\n\tadd(query: LiveQuery): void {\n\t\tconst table = query.handle.sql.table;\n\t\tlet queries = this.#byTable.get(table);\n\t\tif (queries === undefined) {\n\t\t\tqueries = new Set();\n\t\t\tthis.#byTable.set(table, queries);\n\t\t}\n\t\tqueries.add(query);\n\t}\n\n\t/** Removes `query` (its attempt ended). */\n\tdelete(query: LiveQuery): void {\n\t\tconst table = query.handle.sql.table;\n\t\tconst queries = this.#byTable.get(table);\n\t\tif (queries === undefined) return;\n\t\tqueries.delete(query);\n\t\tif (queries.size === 0) this.#byTable.delete(table);\n\t}\n\n\t/** The live queries over `table`, if any. */\n\ton(table: string): ReadonlySet<LiveQuery> | undefined {\n\t\treturn this.#byTable.get(table);\n\t}\n}\n\n/**\n * The re-run of the live queries over the tables a transaction writes (`handles`), `undefined` when none has one (the\n * common case: a map lookup per written table, nothing more). `context` is the transaction's: the runs count through it.\n */\nexport function refreshOf(handles: Iterable<TableHandle>, context: Context): QueryRefresh | undefined {\n\tlet queries: Set<LiveQuery> | undefined;\n\tfor (const handle of handles) {\n\t\tconst on = handle.owner.queries.on(handle.sql.table);\n\t\tif (on === undefined) continue;\n\t\tqueries ??= new Set();\n\t\tfor (const query of on) queries.add(query);\n\t}\n\treturn queries === undefined ? undefined : new QueryRefresh([...queries], context);\n}\n\nconst NO_WRITES: readonly StoreWrite[] = [];\n\n/**\n * The re-run of live queries in one commit: `write` reads them in the commit step after the commit's own writes (the\n * last write of the last phase), and `adopt` publishes their rows in the commit's batch; a refused step adopts nothing.\n * A transaction stages it as its own change (`Staged`).\n */\nexport class QueryRefresh {\n\treadonly #queries: readonly LiveQuery[];\n\treadonly #context: Context;\n\treadonly #runs: QueryRun[] = [];\n\t/** The staged write that reads the queries; it writes nothing and records nothing in the outbox. */\n\treadonly write: StagedWrite;\n\n\tconstructor(queries: readonly LiveQuery[], context: Context) {\n\t\tthis.#queries = queries;\n\t\tthis.#context = context;\n\t\tthis.write = { order: \"write\", apply: (step) => this.#rerun(step) };\n\t}\n\n\tasync #rerun(step: Step): Promise<readonly StoreWrite[]> {\n\t\t// A grouped commit that rolled back applies again alone (store.ts): only the last application's runs count.\n\t\tthis.#runs.length = 0;\n\t\tfor (const query of this.#queries) this.#runs.push(await query.rerun(step, this.#context));\n\t\treturn NO_WRITES;\n\t}\n\n\t/** Publishes each query's new rows (or its failure), inside the commit's batch. */\n\tadopt(): void {\n\t\tfor (const [index, query] of this.#queries.entries()) query.adopt(this.#runs[index]!);\n\t}\n\n\tcommitted(): void {}\n\n\tdiscarded(): void {}\n}\n\n/** What the watches of a failed live query had: no rows, so its next rows replace the value whole. */\nconst NO_VALUE: unique symbol = Symbol(\"no value\");\n\nconst NO_ROWS: ReadonlyMap<unknown, Decoded> = new Map();\n\n/**\n * A live query: the rows of `query` (at most `limit`, in its order) over its object's table `handle`, as a JSON source\n * (a state member, a derive source, an `on` source). Its statement is compiled once; each run decodes only the rows\n * whose stored columns changed and keeps the others the same objects, so its frame, the diff from the rows its watches\n * had, compares unchanged rows by identity (a window shifted by one row: one insert and one removal, not a comparison\n * of every row with every other).\n */\nexport class LiveQuery extends Source {\n\treadonly handle: TableHandle;\n\treadonly #owner: QueryOwner;\n\treadonly #statement: Statement;\n\t#state: QueryState = { kind: \"loading\" };\n\t/** The last adopted rows by key, with the stored rows they were decoded from (the next run reuses unchanged ones). */\n\t#byKey: ReadonlyMap<unknown, Decoded> = NO_ROWS;\n\t/** The rows this query's watches have, kept from its adoption to its frame in the batch; `undefined`: not listed. */\n\t#framed: JsonValue[] | typeof NO_VALUE | undefined;\n\t/** Commits adopted so far: an activation run that a commit overtook keeps the commit's newer rows. */\n\t#adopted = 0;\n\t/** Set from a failed run until the next good one: a failure episode is reported once. */\n\t#failing = false;\n\n\tconstructor(handle: TableHandle, query: Query, limit: number, owner: QueryOwner, batch: Batch) {\n\t\tsuper(batch);\n\t\tthis.handle = handle;\n\t\tthis.#owner = owner;\n\t\tthis.#statement = handle.sql.select(query.condition, query.order, undefined, limit);\n\t}\n\n\tget value(): JsonValue[] {\n\t\tconst state = this.#state;\n\t\tif (state.kind === \"rows\") return state.value;\n\t\tif (state.kind === \"loading\") {\n\t\t\tthrow new ChordError({ code: \"not_ready\", message: `${this.#owner.label}: a live query read before it ran` });\n\t\t}\n\t\tthrow state.error;\n\t}\n\n\t/** Its rows, or while failed its failure and last good rows (a detached query throws). */\n\toverride start(): WatchStart {\n\t\tconst state = this.#state;\n\t\tif (state.kind === \"failed\") return { kind: \"failed\", error: state.error, last: state.last };\n\t\treturn { kind: \"value\", value: this.value };\n\t}\n\n\t/**\n\t * The first run, before its object goes live (activation, after its tables are prepared): a failure throws and fails\n\t * the activation. Rows a commit adopted meanwhile are newer and stay.\n\t */\n\tasync load(context: Context): Promise<void> {\n\t\tconst adopted = this.#adopted;\n\t\tthis.#count(context);\n\t\tconst { sql, params } = this.#statement;\n\t\tconst stored = await this.handle.store.read((executor) => executor.all<StoredRow>(sql, ...params), context);\n\t\t// Decoded outside the store's read: a row the code cannot read is this query's failure, not the backend's.\n\t\tconst rows = this.#decode(stored, context);\n\t\tif (this.#adopted !== adopted) return;\n\t\tthis.#byKey = rows.byKey;\n\t\tthis.#state = { kind: \"rows\", value: rows.value };\n\t}\n\n\t/** A run inside the commit step `step`, after its writes: the rows, or the failure; it never throws. */\n\tasync rerun(step: Step, context: Context): Promise<QueryRun> {\n\t\ttry {\n\t\t\tthis.#count(context);\n\t\t\tconst { sql, params } = this.#statement;\n\t\t\treturn { kind: \"rows\", rows: this.#decode(await step.all<StoredRow>(sql, ...params), context) };\n\t\t} catch (error) {\n\t\t\treturn { kind: \"failed\", error };\n\t\t}\n\t}\n\n\t/**\n\t * Takes a commit's run, inside its batch: listed for a frame when watched, its dependents marked. A failed run makes\n\t * the query a failed member (as a throwing derive): its watches get one failure call, the owner a report per\n\t * failure episode; the next good run replaces the value whole.\n\t */\n\tadopt(run: QueryRun): void {\n\t\tconst state = this.#state;\n\t\tif (state.kind === \"detached\") return;\n\t\tthis.#adopted++;\n\t\tif (this.watched && this.#framed === undefined) this.#framed = state.kind === \"rows\" ? state.value : NO_VALUE;\n\t\tif (run.kind === \"rows\") {\n\t\t\tthis.#failing = false;\n\t\t\tthis.#byKey = run.rows.byKey;\n\t\t\tthis.#state = { kind: \"rows\", value: run.rows.value };\n\t\t} else {\n\t\t\tif (!this.#failing) this.#owner.report(handedOut(run.error));\n\t\t\tthis.#failing = true;\n\t\t\tconst last = state.kind === \"rows\" ? state.value : state.kind === \"failed\" ? state.last : undefined;\n\t\t\tthis.#state = { kind: \"failed\", error: run.error, last };\n\t\t}\n\t\tthis.changed();\n\t}\n\n\t/** Delivers the frame: the diff from the rows its watches had, or one failure call when they had rows. */\n\tdeliver(context: Context): void {\n\t\tconst before = this.#framed;\n\t\tthis.#framed = undefined;\n\t\tconst state = this.#state;\n\t\tif (state.kind === \"rows\") {\n\t\t\t// Listed by `adopt`, so `before` was kept (a detach in the batch leaves no rows).\n\t\t\tconst after = state.value;\n\t\t\tconst ops: readonly Op[] = before === NO_VALUE ? [[\"r\", after]] : diffRevisions(before!, after);\n\t\t\tif (ops.length > 0) this.publish(after, ops, false, context);\n\t\t\treturn;\n\t\t}\n\t\t// Still failed since the last call: nothing new for the watches.\n\t\tif (state.kind === \"failed\" && before !== NO_VALUE) this.failWatches(state.error, context);\n\t}\n\n\t/** Its attempt ended: no commit re-runs it, reads throw `error` (the object's), its watches end `ended`. */\n\tdetach(error: Error): void {\n\t\tthis.handle.owner.queries.delete(this);\n\t\tthis.#state = { kind: \"detached\", error };\n\t\tthis.#framed = undefined;\n\t\tthis.endWatches();\n\t}\n\n\t/** One run, counted where it happens (the cost guard: a commit not writing the table runs none). */\n\t#count(context: Context): void {\n\t\tchordMetrics(context.telemetry.metrics).counter(\"chord.query.runs\").add(1);\n\t}\n\n\t/**\n\t * The rows of `stored`: a row whose stored columns are all the same as in the last adopted run is that run's object\n\t * (one comparison per physical column), any other is decoded.\n\t */\n\t#decode(stored: readonly StoredRow[], context: Context): Rows {\n\t\tconst { key, rows } = this.handle.definition;\n\t\tconst value: JsonValue[] = [];\n\t\tconst byKey = new Map<unknown, Decoded>();\n\t\tfor (const each of stored) {\n\t\t\tconst id = key.length === 1 ? each[key[0]!] : JSON.stringify(key.map((column) => each[column]));\n\t\t\tconst before = this.#byKey.get(id);\n\t\t\tconst row =\n\t\t\t\tbefore !== undefined && sameStored(before.stored, each, rows.physical)\n\t\t\t\t\t? before.row\n\t\t\t\t\t: // A table's rows hold its columns' values: scalars and JSON.\n\t\t\t\t\t\t(rows.decode(each, context) as JsonValue);\n\t\t\tvalue.push(row);\n\t\t\tbyKey.set(id, { stored: each, row });\n\t\t}\n\t\treturn { value, byKey };\n\t}\n}\n\n/** Whether two stored rows have the same value in every physical column (SQLite values compare by `===`). */\nfunction sameStored(a: StoredRow, b: StoredRow, physical: readonly string[]): boolean {\n\tfor (const column of physical) if (a[column] !== b[column]) return false;\n\treturn true;\n}\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Context } from "../context/index.ts";
|
|
2
|
+
import type { ChordStore } from "./store.ts";
|
|
3
|
+
import type { StoreWrite } from "./writes.ts";
|
|
4
|
+
/** The write vocabulary's version an outbox commit is stored in; a newer one is refused, data intact. */
|
|
5
|
+
export declare const OUTBOX_FORMAT = 1;
|
|
6
|
+
/** One commit as the outbox gives it: its seq, the allocator's value it persisted (D3) and its writes in applied order. */
|
|
7
|
+
export type OutboxCommit = {
|
|
8
|
+
readonly seq: number;
|
|
9
|
+
readonly nextId: number;
|
|
10
|
+
readonly writes: readonly StoreWrite[];
|
|
11
|
+
};
|
|
12
|
+
/** A store's outbox: its commits after the floor (the seq it was turned on at, advanced by `trim`). */
|
|
13
|
+
export declare class Outbox {
|
|
14
|
+
#private;
|
|
15
|
+
constructor(store: ChordStore, floor: number);
|
|
16
|
+
/** The seq the outbox starts after: `read` takes any `afterSeq` from it to `lastSeq`. */
|
|
17
|
+
get floor(): number;
|
|
18
|
+
/** Up to `limit` commits after `afterSeq`, in seq order; `afterSeq` outside floor..lastSeq is `invalid/args`. */
|
|
19
|
+
read(afterSeq: number, limit: number, context: Context): Promise<OutboxCommit[]>;
|
|
20
|
+
/**
|
|
21
|
+
* Drops the commits through `throughSeq` and advances the floor; idempotent; beyond `lastSeq` is `invalid/args`.
|
|
22
|
+
* Trims run one at a time, so the stored floor only rises and equals the one in memory.
|
|
23
|
+
*/
|
|
24
|
+
trim(throughSeq: number, context: Context): Promise<void>;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=outbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outbox.d.ts","sourceRoot":"","sources":["../../src/store/outbox.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAInD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,yGAAyG;AACzG,eAAO,MAAM,aAAa,IAAI,CAAC;AAE/B,2HAA2H;AAC3H,MAAM,MAAM,YAAY,GAAG;IAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,UAAU,EAAE,CAAA;CAAE,CAAC;AAIrH,uGAAuG;AACvG,qBAAa,MAAM;;IASlB,YAAY,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAG3C;IAED,yFAAyF;IACzF,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,iHAAiH;IAC3G,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAIrF;IAED;;;OAGG;IACH,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAUxD;CA6CD"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// The outbox (slice 6a §2; decisions "The outbox is optional, internal and versioned", small items 3-4): the store's
|
|
2
|
+
// commits as the sync layer reads them, one `{ seq, writes }` per commit from its floor on, in the current format.
|
|
3
|
+
import { ChordError } from "../data/index.js";
|
|
4
|
+
import { invalid } from "../data/internal.js";
|
|
5
|
+
import { TABLES } from "./schema.js";
|
|
6
|
+
/** The write vocabulary's version an outbox commit is stored in; a newer one is refused, data intact. */
|
|
7
|
+
export const OUTBOX_FORMAT = 1;
|
|
8
|
+
const NOTHING = () => { };
|
|
9
|
+
/** A store's outbox: its commits after the floor (the seq it was turned on at, advanced by `trim`). */
|
|
10
|
+
export class Outbox {
|
|
11
|
+
#store;
|
|
12
|
+
#floor;
|
|
13
|
+
/**
|
|
14
|
+
* The outbox's reads and trims, one at a time: a read checks the floor and reads with no trim running (a trim's
|
|
15
|
+
* commit may have deleted rows before its floor is set), a trim waits for the reads in flight.
|
|
16
|
+
*/
|
|
17
|
+
#queue = Promise.resolve();
|
|
18
|
+
constructor(store, floor) {
|
|
19
|
+
this.#store = store;
|
|
20
|
+
this.#floor = floor;
|
|
21
|
+
}
|
|
22
|
+
/** The seq the outbox starts after: `read` takes any `afterSeq` from it to `lastSeq`. */
|
|
23
|
+
get floor() {
|
|
24
|
+
return this.#floor;
|
|
25
|
+
}
|
|
26
|
+
/** Up to `limit` commits after `afterSeq`, in seq order; `afterSeq` outside floor..lastSeq is `invalid/args`. */
|
|
27
|
+
async read(afterSeq, limit, context) {
|
|
28
|
+
if (!Number.isSafeInteger(afterSeq))
|
|
29
|
+
throw invalid("args", `outbox: read after ${afterSeq}, not an integer`);
|
|
30
|
+
if (!Number.isSafeInteger(limit) || limit < 1)
|
|
31
|
+
throw invalid("args", "outbox: limit is a positive integer");
|
|
32
|
+
return this.#queued(() => this.#read(afterSeq, limit, context));
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Drops the commits through `throughSeq` and advances the floor; idempotent; beyond `lastSeq` is `invalid/args`.
|
|
36
|
+
* Trims run one at a time, so the stored floor only rises and equals the one in memory.
|
|
37
|
+
*/
|
|
38
|
+
trim(throughSeq, context) {
|
|
39
|
+
try {
|
|
40
|
+
context.abortSignal?.throwIfAborted();
|
|
41
|
+
if (!Number.isSafeInteger(throughSeq) || throughSeq > this.#store.lastSeq) {
|
|
42
|
+
throw invalid("args", `outbox: trim through ${throughSeq}, beyond ${this.#store.lastSeq}`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
return Promise.reject(error);
|
|
47
|
+
}
|
|
48
|
+
return this.#queued(() => this.#trim(throughSeq));
|
|
49
|
+
}
|
|
50
|
+
/** Runs `operation` once the outbox operations before it settled. */
|
|
51
|
+
#queued(operation) {
|
|
52
|
+
const run = this.#queue.then(operation);
|
|
53
|
+
this.#queue = run.then(NOTHING, NOTHING);
|
|
54
|
+
return run;
|
|
55
|
+
}
|
|
56
|
+
/** `read`, its turn come: the floor as no trim moves it. */
|
|
57
|
+
async #read(afterSeq, limit, context) {
|
|
58
|
+
if (afterSeq < this.#floor || afterSeq > this.#store.lastSeq) {
|
|
59
|
+
throw invalid("args", `outbox: read after ${afterSeq}, outside ${this.#floor}..${this.#store.lastSeq}`);
|
|
60
|
+
}
|
|
61
|
+
const rows = await this.#store.read((executor) => executor.all(`SELECT seq, format, next_id, writes FROM ${TABLES.outbox} WHERE seq > ? ORDER BY seq LIMIT ?`, afterSeq, limit), context);
|
|
62
|
+
return rows.map(({ seq, format, next_id, writes }) => {
|
|
63
|
+
if (format !== OUTBOX_FORMAT) {
|
|
64
|
+
const message = `outbox: commit ${seq} is in format ${format}, newer than ${OUTBOX_FORMAT}`;
|
|
65
|
+
throw new ChordError({ code: "unavailable", message });
|
|
66
|
+
}
|
|
67
|
+
return { seq, nextId: next_id, writes: JSON.parse(writes) };
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
async #trim(throughSeq) {
|
|
71
|
+
if (throughSeq <= this.#floor)
|
|
72
|
+
return;
|
|
73
|
+
await this.#store.maintain(async (executor) => {
|
|
74
|
+
await executor.run(`DELETE FROM ${TABLES.outbox} WHERE seq <= ?`, throughSeq);
|
|
75
|
+
await executor.run(`UPDATE ${TABLES.meta} SET outbox_floor = ? WHERE singleton = 1`, throughSeq);
|
|
76
|
+
});
|
|
77
|
+
this.#floor = throughSeq;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=outbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outbox.js","sourceRoot":"","sources":["../../src/store/outbox.ts"],"names":[],"mappings":"AAAA,qHAAqH;AACrH,mHAAmH;AAGnH,OAAO,EAAE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,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE;YACpD,IAAI,MAAM,KAAK,aAAa,EAAE,CAAC;gBAC9B,MAAM,OAAO,GAAG,kBAAkB,GAAG,iBAAiB,MAAM,gBAAgB,aAAa,EAAE,CAAC;gBAC5F,MAAM,IAAI,UAAU,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,CAAC,CAAC;YACxD,CAAC;YACD,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAiB,EAAE,CAAC;QAC7E,CAAC,CAAC,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,UAAkB;QAC7B,IAAI,UAAU,IAAI,IAAI,CAAC,MAAM;YAAE,OAAO;QACtC,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE;YAC7C,MAAM,QAAQ,CAAC,GAAG,CAAC,eAAe,MAAM,CAAC,MAAM,iBAAiB,EAAE,UAAU,CAAC,CAAC;YAC9E,MAAM,QAAQ,CAAC,GAAG,CAAC,UAAU,MAAM,CAAC,IAAI,2CAA2C,EAAE,UAAU,CAAC,CAAC;QAClG,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC;IAC1B,CAAC;CACD","sourcesContent":["// The outbox (slice 6a §2; decisions \"The outbox is optional, internal and versioned\", small items 3-4): the store's\n// commits as the sync layer reads them, one `{ seq, writes }` per commit from its floor on, in the current format.\n\nimport type { Context } from \"../context/index.ts\";\nimport { ChordError } from \"../data/index.ts\";\nimport { invalid } from \"../data/internal.ts\";\nimport { TABLES } from \"./schema.ts\";\nimport type { ChordStore } from \"./store.ts\";\nimport type { StoreWrite } from \"./writes.ts\";\n\n/** The write vocabulary's version an outbox commit is stored in; a newer one is refused, data intact. */\nexport const OUTBOX_FORMAT = 1;\n\n/** One commit as the outbox gives it: its seq, the allocator's value it persisted (D3) and its writes in applied order. */\nexport type OutboxCommit = { readonly seq: number; readonly nextId: number; readonly writes: readonly StoreWrite[] };\n\nconst NOTHING = (): void => {};\n\n/** A store's outbox: its commits after the floor (the seq it was turned on at, advanced by `trim`). */\nexport class Outbox {\n\treadonly #store: ChordStore;\n\t#floor: number;\n\t/**\n\t * The outbox's reads and trims, one at a time: a read checks the floor and reads with no trim running (a trim's\n\t * commit may have deleted rows before its floor is set), a trim waits for the reads in flight.\n\t */\n\t#queue: Promise<void> = Promise.resolve();\n\n\tconstructor(store: ChordStore, floor: number) {\n\t\tthis.#store = store;\n\t\tthis.#floor = floor;\n\t}\n\n\t/** The seq the outbox starts after: `read` takes any `afterSeq` from it to `lastSeq`. */\n\tget floor(): number {\n\t\treturn this.#floor;\n\t}\n\n\t/** Up to `limit` commits after `afterSeq`, in seq order; `afterSeq` outside floor..lastSeq is `invalid/args`. */\n\tasync read(afterSeq: number, limit: number, context: Context): Promise<OutboxCommit[]> {\n\t\tif (!Number.isSafeInteger(afterSeq)) throw invalid(\"args\", `outbox: read after ${afterSeq}, not an integer`);\n\t\tif (!Number.isSafeInteger(limit) || limit < 1) throw invalid(\"args\", \"outbox: limit is a positive integer\");\n\t\treturn this.#queued(() => this.#read(afterSeq, limit, context));\n\t}\n\n\t/**\n\t * Drops the commits through `throughSeq` and advances the floor; idempotent; beyond `lastSeq` is `invalid/args`.\n\t * Trims run one at a time, so the stored floor only rises and equals the one in memory.\n\t */\n\ttrim(throughSeq: number, context: Context): Promise<void> {\n\t\ttry {\n\t\t\tcontext.abortSignal?.throwIfAborted();\n\t\t\tif (!Number.isSafeInteger(throughSeq) || throughSeq > this.#store.lastSeq) {\n\t\t\t\tthrow invalid(\"args\", `outbox: trim through ${throughSeq}, beyond ${this.#store.lastSeq}`);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\treturn Promise.reject(error);\n\t\t}\n\t\treturn this.#queued(() => this.#trim(throughSeq));\n\t}\n\n\t/** Runs `operation` once the outbox operations before it settled. */\n\t#queued<T>(operation: () => Promise<T>): Promise<T> {\n\t\tconst run = this.#queue.then(operation);\n\t\tthis.#queue = run.then(NOTHING, NOTHING);\n\t\treturn run;\n\t}\n\n\t/** `read`, its turn come: the floor as no trim moves it. */\n\tasync #read(afterSeq: number, limit: number, context: Context): Promise<OutboxCommit[]> {\n\t\tif (afterSeq < this.#floor || afterSeq > this.#store.lastSeq) {\n\t\t\tthrow invalid(\"args\", `outbox: read after ${afterSeq}, outside ${this.#floor}..${this.#store.lastSeq}`);\n\t\t}\n\t\tconst rows = await this.#store.read(\n\t\t\t(executor) =>\n\t\t\t\texecutor.all<{\n\t\t\t\t\treadonly seq: number;\n\t\t\t\t\treadonly format: number;\n\t\t\t\t\treadonly next_id: number;\n\t\t\t\t\treadonly writes: string;\n\t\t\t\t}>(\n\t\t\t\t\t`SELECT seq, format, next_id, writes FROM ${TABLES.outbox} WHERE seq > ? ORDER BY seq LIMIT ?`,\n\t\t\t\t\tafterSeq,\n\t\t\t\t\tlimit,\n\t\t\t\t),\n\t\t\tcontext,\n\t\t);\n\t\treturn rows.map(({ seq, format, next_id, writes }) => {\n\t\t\tif (format !== OUTBOX_FORMAT) {\n\t\t\t\tconst message = `outbox: commit ${seq} is in format ${format}, newer than ${OUTBOX_FORMAT}`;\n\t\t\t\tthrow new ChordError({ code: \"unavailable\", message });\n\t\t\t}\n\t\t\treturn { seq, nextId: next_id, writes: JSON.parse(writes) as StoreWrite[] };\n\t\t});\n\t}\n\n\tasync #trim(throughSeq: number): Promise<void> {\n\t\tif (throughSeq <= this.#floor) return;\n\t\tawait this.#store.maintain(async (executor) => {\n\t\t\tawait executor.run(`DELETE FROM ${TABLES.outbox} WHERE seq <= ?`, throughSeq);\n\t\t\tawait executor.run(`UPDATE ${TABLES.meta} SET outbox_floor = ? WHERE singleton = 1`, throughSeq);\n\t\t});\n\t\tthis.#floor = throughSeq;\n\t}\n}\n"]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { SqliteValue } from "../sqlite/index.ts";
|
|
2
|
+
import type { Columns, ColumnTypeOf, ValueOf } from "./columns.ts";
|
|
3
|
+
import { type ColumnRef, type Condition, type WhereNode } from "./expression.ts";
|
|
4
|
+
import type { Order } from "./sql.ts";
|
|
5
|
+
import type { TableDefinition } from "./table.ts";
|
|
6
|
+
/** The column references a table's callbacks get: `e.path`, `e.at`. */
|
|
7
|
+
export type ColumnRefs<C extends Columns> = {
|
|
8
|
+
readonly [K in keyof C & string]: ColumnRef<ValueOf<C[K]>, ColumnTypeOf<C[K]>>;
|
|
9
|
+
};
|
|
10
|
+
/** A query of `table`: its rows, in key order. */
|
|
11
|
+
export declare function query<C extends Columns, K extends readonly string[]>(table: TableDefinition<C, K>): Query<C, K>;
|
|
12
|
+
/**
|
|
13
|
+
* An immutable query of one table: an optional condition (several `where`s are `and`ed) and an order (`orderBy`
|
|
14
|
+
* columns, one direction, the key appended unless already there).
|
|
15
|
+
*/
|
|
16
|
+
export declare class Query<C extends Columns = Columns, K extends readonly string[] = readonly string[]> {
|
|
17
|
+
#private;
|
|
18
|
+
readonly table: TableDefinition<C, K>;
|
|
19
|
+
readonly condition: WhereNode | undefined;
|
|
20
|
+
constructor(table: TableDefinition<C, K>, condition: WhereNode | undefined, orderBy: readonly string[], direction: "asc" | "desc" | undefined);
|
|
21
|
+
/** This query with `fn`'s condition too. */
|
|
22
|
+
where(fn: (row: ColumnRefs<C>) => Condition): Query<C, K>;
|
|
23
|
+
/**
|
|
24
|
+
* This query ordered by `fn`'s column next (a non-`opt` `str` or `int` one), in `direction`: one direction per
|
|
25
|
+
* query, no column twice (`invalid/args`).
|
|
26
|
+
*/
|
|
27
|
+
orderBy(fn: (row: ColumnRefs<C>) => ColumnRef<unknown, "str" | "int">, direction?: "asc" | "desc"): Query<C, K>;
|
|
28
|
+
/** The order of its rows: the `orderBy` columns, then the key columns not among them. */
|
|
29
|
+
get order(): Order;
|
|
30
|
+
}
|
|
31
|
+
/** The cursor of the position after a row with the order values `values` in the table named `table` (its SQL name). */
|
|
32
|
+
export declare function encodeCursor(table: string, order: Order, values: readonly SqliteValue[]): string;
|
|
33
|
+
/**
|
|
34
|
+
* The order values of `cursor` (a trust boundary: an app hands it back): one made for `table`'s `order` (any
|
|
35
|
+
* condition) in the table named `sqlName` (another object's table of the same definition is another table), each value
|
|
36
|
+
* of its column's type; `invalid/args` otherwise.
|
|
37
|
+
*/
|
|
38
|
+
export declare function decodeCursor(table: TableDefinition, sqlName: string, order: Order, cursor: unknown): SqliteValue[];
|
|
39
|
+
//# sourceMappingURL=query.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/store/query.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACnE,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAgB,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE/F,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,uEAAuE;AACvE,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,OAAO,IAAI;IAC3C,QAAQ,EAAE,CAAC,IAAI,MAAM,CAAC,GAAG,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAC9E,CAAC;AAEF,kDAAkD;AAClD,wBAAgB,KAAK,CAAC,CAAC,SAAS,OAAO,EAAE,CAAC,SAAS,SAAS,MAAM,EAAE,EAAE,KAAK,EAAE,eAAe,CAAC,CAAC,EAAE,CAAC,CAA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0,0 +1,97 @@
|
|
|
1
|
+
// Queries (decision "Query runner"; slice 6a §6, rule 17): `query(Table).where(…).orderBy(…)` as immutable data
|
|
2
|
+
// (the condition compiled when given, the order with the key appended as the tie-break), and the opaque cursors that
|
|
3
|
+
// continue a page, bound to the table, the order columns and the direction.
|
|
4
|
+
import { invalid } from "../data/internal.js";
|
|
5
|
+
import { compileWhere } from "./expression.js";
|
|
6
|
+
import { checkScalar } from "./rows.js";
|
|
7
|
+
/** A query of `table`: its rows, in key order. */
|
|
8
|
+
export function query(table) {
|
|
9
|
+
return new Query(table, undefined, [], undefined);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* An immutable query of one table: an optional condition (several `where`s are `and`ed) and an order (`orderBy`
|
|
13
|
+
* columns, one direction, the key appended unless already there).
|
|
14
|
+
*/
|
|
15
|
+
export class Query {
|
|
16
|
+
table;
|
|
17
|
+
condition;
|
|
18
|
+
#orderBy;
|
|
19
|
+
#direction;
|
|
20
|
+
constructor(table, condition, orderBy, direction) {
|
|
21
|
+
this.table = table;
|
|
22
|
+
this.condition = condition;
|
|
23
|
+
this.#orderBy = orderBy;
|
|
24
|
+
this.#direction = direction;
|
|
25
|
+
}
|
|
26
|
+
/** This query with `fn`'s condition too. */
|
|
27
|
+
where(fn) {
|
|
28
|
+
// The refs are the table's columns, typed by `C`.
|
|
29
|
+
const compiled = compileWhere(this.table, fn(this.table.refs), "where");
|
|
30
|
+
const condition = this.condition === undefined ? compiled : { and: [this.condition, compiled] };
|
|
31
|
+
return new Query(this.table, condition, this.#orderBy, this.#direction);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* This query ordered by `fn`'s column next (a non-`opt` `str` or `int` one), in `direction`: one direction per
|
|
35
|
+
* query, no column twice (`invalid/args`).
|
|
36
|
+
*/
|
|
37
|
+
orderBy(fn, direction = "asc") {
|
|
38
|
+
const table = this.table;
|
|
39
|
+
// The refs are `C`'s columns; what the plugin's callback returns is checked below.
|
|
40
|
+
const ref = fn(table.refs);
|
|
41
|
+
const column = table.byName.get(ref?.column ?? "");
|
|
42
|
+
if (column === undefined || column.optional || (column.type !== "str" && column.type !== "int")) {
|
|
43
|
+
throw invalid("args", `${table.name}: orderBy: expected a non-opt str() or int() column`);
|
|
44
|
+
}
|
|
45
|
+
if (this.#orderBy.includes(column.name))
|
|
46
|
+
throw invalid("args", `${table.name}: orderBy: "${column.name}" twice`);
|
|
47
|
+
if (this.#direction !== undefined && this.#direction !== direction) {
|
|
48
|
+
throw invalid("args", `${table.name}: orderBy: one direction per query`);
|
|
49
|
+
}
|
|
50
|
+
return new Query(table, this.condition, [...this.#orderBy, column.name], direction);
|
|
51
|
+
}
|
|
52
|
+
/** The order of its rows: the `orderBy` columns, then the key columns not among them. */
|
|
53
|
+
get order() {
|
|
54
|
+
const columns = [...this.#orderBy, ...this.table.key.filter((column) => !this.#orderBy.includes(column))];
|
|
55
|
+
return { columns, direction: this.#direction ?? "asc" };
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/** The cursor of the position after a row with the order values `values` in the table named `table` (its SQL name). */
|
|
59
|
+
export function encodeCursor(table, order, values) {
|
|
60
|
+
const json = JSON.stringify({ t: table, o: order.columns, d: order.direction, v: values });
|
|
61
|
+
let binary = "";
|
|
62
|
+
for (const byte of new TextEncoder().encode(json))
|
|
63
|
+
binary += String.fromCharCode(byte);
|
|
64
|
+
return btoa(binary).replaceAll("+", "-").replaceAll("/", "_").replace(/=+$/, "");
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* The order values of `cursor` (a trust boundary: an app hands it back): one made for `table`'s `order` (any
|
|
68
|
+
* condition) in the table named `sqlName` (another object's table of the same definition is another table), each value
|
|
69
|
+
* of its column's type; `invalid/args` otherwise.
|
|
70
|
+
*/
|
|
71
|
+
export function decodeCursor(table, sqlName, order, cursor) {
|
|
72
|
+
const refuse = () => {
|
|
73
|
+
throw invalid("args", `${table.name}: the cursor is not one of this table's order`);
|
|
74
|
+
};
|
|
75
|
+
if (typeof cursor !== "string")
|
|
76
|
+
return refuse();
|
|
77
|
+
let decoded;
|
|
78
|
+
try {
|
|
79
|
+
const binary = atob(cursor.replaceAll("-", "+").replaceAll("_", "/"));
|
|
80
|
+
decoded = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(Uint8Array.from(binary, (c) => c.charCodeAt(0))));
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
return refuse();
|
|
84
|
+
}
|
|
85
|
+
// Wire input: every field is checked below.
|
|
86
|
+
const { t, o, d, v } = (decoded ?? {});
|
|
87
|
+
if (t !== sqlName || d !== order.direction || JSON.stringify(o) !== JSON.stringify(order.columns))
|
|
88
|
+
refuse();
|
|
89
|
+
if (!Array.isArray(v) || v.length !== order.columns.length)
|
|
90
|
+
return refuse();
|
|
91
|
+
return order.columns.map((name, index) => {
|
|
92
|
+
const column = table.byName.get(name);
|
|
93
|
+
// Order columns are non-opt `str` or `int` (checked when the query was built).
|
|
94
|
+
return checkScalar(column.type, v[index], `${table.name}: cursor`);
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.js","sourceRoot":"","sources":["../../src/store/query.ts"],"names":[],"mappings":"AAAA,gHAAgH;AAChH,qHAAqH;AACrH,4EAA4E;AAE5E,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAG9C,OAAO,EAAkC,YAAY,EAAkB,MAAM,iBAAiB,CAAC;AAC/F,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AASxC,kDAAkD;AAClD,MAAM,UAAU,KAAK,CAAiD,KAA4B;IACjG,OAAO,IAAI,KAAK,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,SAAS,CAAC,CAAC;AACnD,CAAC;AAED;;;GAGG;AACH,MAAM,OAAO,KAAK;IACR,KAAK,CAAwB;IAC7B,SAAS,CAAwB;IACj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,OAAO,IAAI,EAAE,CAA2D,CAAC;IACjG,IAAI,CAAC,KAAK,OAAO,IAAI,CAAC,KAAK,KAAK,CAAC,SAAS,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC;QAAE,MAAM,EAAE,CAAC;IAC5G,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,KAAK,CAAC,OAAO,CAAC,MAAM;QAAE,OAAO,MAAM,EAAE,CAAC;IAC5E,OAAO,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;QACxC,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAE,CAAC;QACvC,+EAA+E;QAC/E,OAAO,WAAW,CAAC,MAAM,CAAC,IAAqB,EAAE,CAAC,CAAC,KAAK,CAAC,EAAE,GAAG,KAAK,CAAC,IAAI,UAAU,CAAoB,CAAC;IACxG,CAAC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["// Queries (decision \"Query runner\"; slice 6a §6, rule 17): `query(Table).where(…).orderBy(…)` as immutable data\n// (the condition compiled when given, the order with the key appended as the tie-break), and the opaque cursors that\n// continue a page, bound to the table, the order columns and the direction.\n\nimport { invalid } from \"../data/internal.ts\";\nimport type { SqliteValue } from \"../sqlite/index.ts\";\nimport type { Columns, ColumnTypeOf, ValueOf } from \"./columns.ts\";\nimport { type ColumnRef, type Condition, compileWhere, type WhereNode } from \"./expression.ts\";\nimport { checkScalar } from \"./rows.ts\";\nimport type { Order } from \"./sql.ts\";\nimport type { TableDefinition } from \"./table.ts\";\n\n/** The column references a table's callbacks get: `e.path`, `e.at`. */\nexport type ColumnRefs<C extends Columns> = {\n\treadonly [K in keyof C & string]: ColumnRef<ValueOf<C[K]>, ColumnTypeOf<C[K]>>;\n};\n\n/** A query of `table`: its rows, in key order. */\nexport function query<C extends Columns, K extends readonly string[]>(table: TableDefinition<C, K>): Query<C, K> {\n\treturn new Query(table, undefined, [], undefined);\n}\n\n/**\n * An immutable query of one table: an optional condition (several `where`s are `and`ed) and an order (`orderBy`\n * columns, one direction, the key appended unless already there).\n */\nexport class Query<C extends Columns = Columns, K extends readonly string[] = readonly string[]> {\n\treadonly table: TableDefinition<C, K>;\n\treadonly condition: WhereNode | undefined;\n\treadonly #orderBy: readonly string[];\n\treadonly #direction: \"asc\" | \"desc\" | undefined;\n\n\tconstructor(\n\t\ttable: TableDefinition<C, K>,\n\t\tcondition: WhereNode | undefined,\n\t\torderBy: readonly string[],\n\t\tdirection: \"asc\" | \"desc\" | undefined,\n\t) {\n\t\tthis.table = table;\n\t\tthis.condition = condition;\n\t\tthis.#orderBy = orderBy;\n\t\tthis.#direction = direction;\n\t}\n\n\t/** This query with `fn`'s condition too. */\n\twhere(fn: (row: ColumnRefs<C>) => Condition): Query<C, K> {\n\t\t// The refs are the table's columns, typed by `C`.\n\t\tconst compiled = compileWhere(this.table, fn(this.table.refs as ColumnRefs<C>), \"where\");\n\t\tconst condition = this.condition === undefined ? compiled : { and: [this.condition, compiled] };\n\t\treturn new Query(this.table, condition, this.#orderBy, this.#direction);\n\t}\n\n\t/**\n\t * This query ordered by `fn`'s column next (a non-`opt` `str` or `int` one), in `direction`: one direction per\n\t * query, no column twice (`invalid/args`).\n\t */\n\torderBy(\n\t\tfn: (row: ColumnRefs<C>) => ColumnRef<unknown, \"str\" | \"int\">,\n\t\tdirection: \"asc\" | \"desc\" = \"asc\",\n\t): Query<C, K> {\n\t\tconst table = this.table;\n\t\t// The refs are `C`'s columns; what the plugin's callback returns is checked below.\n\t\tconst ref = fn(table.refs as ColumnRefs<C>) as ColumnRef | undefined;\n\t\tconst column = table.byName.get(ref?.column ?? \"\");\n\t\tif (column === undefined || column.optional || (column.type !== \"str\" && column.type !== \"int\")) {\n\t\t\tthrow invalid(\"args\", `${table.name}: orderBy: expected a non-opt str() or int() column`);\n\t\t}\n\t\tif (this.#orderBy.includes(column.name)) throw invalid(\"args\", `${table.name}: orderBy: \"${column.name}\" twice`);\n\t\tif (this.#direction !== undefined && this.#direction !== direction) {\n\t\t\tthrow invalid(\"args\", `${table.name}: orderBy: one direction per query`);\n\t\t}\n\t\treturn new Query(table, this.condition, [...this.#orderBy, column.name], direction);\n\t}\n\n\t/** The order of its rows: the `orderBy` columns, then the key columns not among them. */\n\tget order(): Order {\n\t\tconst columns = [...this.#orderBy, ...this.table.key.filter((column) => !this.#orderBy.includes(column))];\n\t\treturn { columns, direction: this.#direction ?? \"asc\" };\n\t}\n}\n\n/** The cursor of the position after a row with the order values `values` in the table named `table` (its SQL name). */\nexport function encodeCursor(table: string, order: Order, values: readonly SqliteValue[]): string {\n\tconst json = JSON.stringify({ t: table, o: order.columns, d: order.direction, v: values });\n\tlet binary = \"\";\n\tfor (const byte of new TextEncoder().encode(json)) binary += String.fromCharCode(byte);\n\treturn btoa(binary).replaceAll(\"+\", \"-\").replaceAll(\"/\", \"_\").replace(/=+$/, \"\");\n}\n\n/**\n * The order values of `cursor` (a trust boundary: an app hands it back): one made for `table`'s `order` (any\n * condition) in the table named `sqlName` (another object's table of the same definition is another table), each value\n * of its column's type; `invalid/args` otherwise.\n */\nexport function decodeCursor(table: TableDefinition, sqlName: string, order: Order, cursor: unknown): SqliteValue[] {\n\tconst refuse = (): never => {\n\t\tthrow invalid(\"args\", `${table.name}: the cursor is not one of this table's order`);\n\t};\n\tif (typeof cursor !== \"string\") return refuse();\n\tlet decoded: unknown;\n\ttry {\n\t\tconst binary = atob(cursor.replaceAll(\"-\", \"+\").replaceAll(\"_\", \"/\"));\n\t\tdecoded = JSON.parse(\n\t\t\tnew TextDecoder(\"utf-8\", { fatal: true }).decode(Uint8Array.from(binary, (c) => c.charCodeAt(0))),\n\t\t);\n\t} catch {\n\t\treturn refuse();\n\t}\n\t// Wire input: every field is checked below.\n\tconst { t, o, d, v } = (decoded ?? {}) as { t?: unknown; o?: unknown; d?: unknown; v?: unknown };\n\tif (t !== sqlName || d !== order.direction || JSON.stringify(o) !== JSON.stringify(order.columns)) refuse();\n\tif (!Array.isArray(v) || v.length !== order.columns.length) return refuse();\n\treturn order.columns.map((name, index) => {\n\t\tconst column = table.byName.get(name)!;\n\t\t// Order columns are non-opt `str` or `int` (checked when the query was built).\n\t\treturn checkScalar(column.type as \"str\" | \"int\", v[index], `${table.name}: cursor`) as string | number;\n\t});\n}\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ChordError } from "../data/index.ts";
|
|
2
|
+
/** How a Chord commit ended that the store rejected: `check` fails the transaction only, `broken` its object too. */
|
|
3
|
+
export type Refusal = {
|
|
4
|
+
readonly kind: "check";
|
|
5
|
+
readonly error: ChordError;
|
|
6
|
+
} | {
|
|
7
|
+
readonly kind: "broken";
|
|
8
|
+
readonly error: ChordError;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* The refusal behind `error`, a store commit's rejection; `undefined` when it is the store's own (`released` at
|
|
12
|
+
* admission or after close, `unavailable/storage_failed` once stopped), which the owner rethrows as it is.
|
|
13
|
+
*/
|
|
14
|
+
export declare function refusalOf(error: unknown, label: string): Refusal | undefined;
|
|
15
|
+
//# sourceMappingURL=refusal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refusal.d.ts","sourceRoot":"","sources":["../../src/store/refusal.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAgB,MAAM,kBAAkB,CAAC;AAE5D,qHAAqH;AACrH,MAAM,MAAM,OAAO,GAChB;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAA;CAAE,GACtD;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAA;CAAE,CAAC;AAK3D;;;GAGG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAc5E"}
|