@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,20 @@
|
|
|
1
|
+
import type { Context } from "../context/index.ts";
|
|
2
|
+
import type { Prepared } from "../delta/index.ts";
|
|
3
|
+
import { Source } from "../state/internal.ts";
|
|
4
|
+
import type { JsonObject } from "./definition.ts";
|
|
5
|
+
/** A source following one document address; `value` is the document's, or `initial()` while it is absent. */
|
|
6
|
+
export declare abstract class AddressSource extends Source {
|
|
7
|
+
#private;
|
|
8
|
+
abstract get value(): JsonObject;
|
|
9
|
+
deliver(context: Context): void;
|
|
10
|
+
/**
|
|
11
|
+
* A commit wrote the document, which read `before`: its ops, or a root replacement when the draft started from
|
|
12
|
+
* another base or the document was retired earlier in the batch.
|
|
13
|
+
*/
|
|
14
|
+
written(before: JsonObject, prepared: Prepared<JsonObject>): void;
|
|
15
|
+
/** The document was retired: it reads `initial` again, and the frame says so. */
|
|
16
|
+
retired(initial: JsonObject): void;
|
|
17
|
+
/** The value changed outside a commit (a migration, a load): a root replacement. */
|
|
18
|
+
replaced(): void;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=address-source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"address-source.d.ts","sourceRoot":"","sources":["../../src/documents/address-source.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAM,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAIlD,6GAA6G;AAC7G,8BAAsB,aAAc,SAAQ,MAAM;;IAKjD,aAAsB,KAAK,IAAI,UAAU,CAAC;IAE1C,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAI9B;IAED;;;OAGG;IACH,OAAO,CAAC,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,CAAC,UAAU,CAAC,GAAG,IAAI,CAIhE;IAED,iFAAiF;IACjF,OAAO,CAAC,OAAO,EAAE,UAAU,GAAG,IAAI,CAQjC;IAED,oFAAoF;IACpF,QAAQ,IAAI,IAAI,CAGf;CACD"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// Watchable document addresses (slice 6a §11; decision "One retirement mechanism"): the frames of a source that
|
|
2
|
+
// follows one address, a singleton's slot or one key of a keyed slot. A change arrives with its ops, a write over
|
|
3
|
+
// another base as a root replacement, a retirement as `[["r", initial()]]` with the `retired` flag, and a document
|
|
4
|
+
// created after a retirement in the same batch as one root replacement with the flag.
|
|
5
|
+
import { Source } from "../state/internal.js";
|
|
6
|
+
const NO_OPS = [];
|
|
7
|
+
/** A source following one document address; `value` is the document's, or `initial()` while it is absent. */
|
|
8
|
+
export class AddressSource extends Source {
|
|
9
|
+
/** The ops of the current batch's frame, and whether the document was retired in it. */
|
|
10
|
+
#ops = NO_OPS;
|
|
11
|
+
#retired = false;
|
|
12
|
+
deliver(context) {
|
|
13
|
+
this.publish(this.value, this.#ops, this.#retired, context);
|
|
14
|
+
this.#ops = NO_OPS;
|
|
15
|
+
this.#retired = false;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A commit wrote the document, which read `before`: its ops, or a root replacement when the draft started from
|
|
19
|
+
* another base or the document was retired earlier in the batch.
|
|
20
|
+
*/
|
|
21
|
+
written(before, prepared) {
|
|
22
|
+
// The ops are kept for a frame, which only a watched source gets: an unwatched one keeps none.
|
|
23
|
+
if (this.watched)
|
|
24
|
+
this.#ops = prepared.base === before && !this.#retired ? prepared.ops : [["r", prepared.value]];
|
|
25
|
+
this.changed();
|
|
26
|
+
}
|
|
27
|
+
/** The document was retired: it reads `initial` again, and the frame says so. */
|
|
28
|
+
retired(initial) {
|
|
29
|
+
// Reset by the frame, which only a watched source gets.
|
|
30
|
+
if (this.watched) {
|
|
31
|
+
this.#ops = [["r", initial]];
|
|
32
|
+
this.#retired = true;
|
|
33
|
+
}
|
|
34
|
+
this.changed();
|
|
35
|
+
this.retiredInBatch();
|
|
36
|
+
}
|
|
37
|
+
/** The value changed outside a commit (a migration, a load): a root replacement. */
|
|
38
|
+
replaced() {
|
|
39
|
+
if (this.watched)
|
|
40
|
+
this.#ops = [["r", this.value]];
|
|
41
|
+
this.changed();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=address-source.js.map
|
|
@@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CAAC;QACf,IAAI,CAAC,cAAc,EAAE,CAAC;IACvB,CAAC;IAED,oFAAoF;IACpF,QAAQ;QACP,IAAI,IAAI,CAAC,OAAO;YAAE,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QAClD,IAAI,CAAC,OAAO,EAAE,CAAC;IAChB,CAAC;CACD","sourcesContent":["// Watchable document addresses (slice 6a §11; decision \"One retirement mechanism\"): the frames of a source that\n// follows one address, a singleton's slot or one key of a keyed slot. A change arrives with its ops, a write over\n// another base as a root replacement, a retirement as `[[\"r\", initial()]]` with the `retired` flag, and a document\n// created after a retirement in the same batch as one root replacement with the flag.\n\nimport type { Context } from \"../context/index.ts\";\nimport type { Op, Prepared } from \"../delta/index.ts\";\nimport { Source } from \"../state/internal.ts\";\nimport type { JsonObject } from \"./definition.ts\";\n\nconst NO_OPS: readonly Op[] = [];\n\n/** A source following one document address; `value` is the document's, or `initial()` while it is absent. */\nexport abstract class AddressSource extends Source {\n\t/** The ops of the current batch's frame, and whether the document was retired in it. */\n\t#ops = NO_OPS;\n\t#retired = false;\n\n\tabstract override get value(): JsonObject;\n\n\tdeliver(context: Context): void {\n\t\tthis.publish(this.value, this.#ops, this.#retired, context);\n\t\tthis.#ops = NO_OPS;\n\t\tthis.#retired = false;\n\t}\n\n\t/**\n\t * A commit wrote the document, which read `before`: its ops, or a root replacement when the draft started from\n\t * another base or the document was retired earlier in the batch.\n\t */\n\twritten(before: JsonObject, prepared: Prepared<JsonObject>): void {\n\t\t// The ops are kept for a frame, which only a watched source gets: an unwatched one keeps none.\n\t\tif (this.watched) this.#ops = prepared.base === before && !this.#retired ? prepared.ops : [[\"r\", prepared.value]];\n\t\tthis.changed();\n\t}\n\n\t/** The document was retired: it reads `initial` again, and the frame says so. */\n\tretired(initial: JsonObject): void {\n\t\t// Reset by the frame, which only a watched source gets.\n\t\tif (this.watched) {\n\t\t\tthis.#ops = [[\"r\", initial]];\n\t\t\tthis.#retired = true;\n\t\t}\n\t\tthis.changed();\n\t\tthis.retiredInBatch();\n\t}\n\n\t/** The value changed outside a commit (a migration, a load): a root replacement. */\n\treplaced(): void {\n\t\tif (this.watched) this.#ops = [[\"r\", this.value]];\n\t\tthis.changed();\n\t}\n}\n"]}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { Context } from "../context/index.ts";
|
|
2
|
+
import type { Schema, Static } from "../contracts/index.ts";
|
|
3
|
+
import type { Op } from "../delta/index.ts";
|
|
4
|
+
import type { JsonValue } from "../json.ts";
|
|
5
|
+
/** A document root: a JSON object. */
|
|
6
|
+
export type JsonObject = {
|
|
7
|
+
[key: string]: JsonValue;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* When a commit reaches the store (Durable's `CommitPersistence`): `immediate`, the default, before the commit
|
|
11
|
+
* resolves; `deferred` (a persisted run's state change, D8): adopted and published at once, stored with the next
|
|
12
|
+
* immediate change, the run's outcome, the object's close, or about `withinMs` (default 1,000 ms) later.
|
|
13
|
+
*/
|
|
14
|
+
export type CommitPersistence = {
|
|
15
|
+
readonly kind: "immediate";
|
|
16
|
+
} | {
|
|
17
|
+
readonly kind: "deferred";
|
|
18
|
+
readonly withinMs?: number;
|
|
19
|
+
};
|
|
20
|
+
/** What a persisted document's `checkpointWhen` learns of its stored revisions. */
|
|
21
|
+
export type CheckpointInfo = {
|
|
22
|
+
/** The deltas stored after its newest base, without the change being decided. */
|
|
23
|
+
readonly deltasSinceBase: number;
|
|
24
|
+
};
|
|
25
|
+
/** Whether a commit's change of a persisted document is stored as a whole new base (`true`) or as a delta. */
|
|
26
|
+
export type CheckpointWhen<T> = (value: T, ops: readonly Op[], info: CheckpointInfo) => boolean;
|
|
27
|
+
/** What `defineState` takes for any document. */
|
|
28
|
+
type StateOptions<S extends Schema, K extends boolean> = {
|
|
29
|
+
readonly schema: S;
|
|
30
|
+
readonly version: number;
|
|
31
|
+
readonly initial: () => DocumentOf<S>;
|
|
32
|
+
/** Maps a value of an older version `from` to this version's shape; pure. Required to read older values. */
|
|
33
|
+
readonly migrate?: (old: JsonObject, from: number) => DocumentOf<S>;
|
|
34
|
+
readonly keyed?: K;
|
|
35
|
+
};
|
|
36
|
+
/** What a persisted document adds (slice 6a §10): `checkpointWhen` is required. */
|
|
37
|
+
type PersistOptions<S extends Schema> = {
|
|
38
|
+
/** Stored in the host's store; only in `local` types with empty params (P3). */
|
|
39
|
+
readonly persist: true;
|
|
40
|
+
/** Called once per commit per changed document; creations and version changes always store a base. */
|
|
41
|
+
readonly checkpointWhen: CheckpointWhen<DocumentOf<S>>;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Declares a document: a singleton per object, or with `keyed: true` many per object, each by a string key; with
|
|
45
|
+
* `persist: true` stored in the host's store. Its name is a restricted name (lowercase `[a-z0-9@/._~-]`).
|
|
46
|
+
*/
|
|
47
|
+
export declare function defineState<S extends Schema, K extends boolean = false>(name: string, options: StateOptions<S, K> & {
|
|
48
|
+
readonly persist?: false;
|
|
49
|
+
readonly checkpointWhen?: never;
|
|
50
|
+
}): StateDefinition<DocumentOf<S>, K, false>;
|
|
51
|
+
export declare function defineState<S extends Schema, K extends boolean = false>(name: string, options: StateOptions<S, K> & PersistOptions<S>): StateDefinition<DocumentOf<S>, K, true>;
|
|
52
|
+
/** The value of a document whose schema is `S`: its static type, which must be a JSON object. */
|
|
53
|
+
type DocumentOf<S extends Schema> = Static<S> extends JsonObject ? Static<S> : never;
|
|
54
|
+
/** A declared document; `T` is its value, `K` whether it is keyed, `P` whether it is persisted. */
|
|
55
|
+
export declare class StateDefinition<T extends JsonObject, K extends boolean, P extends boolean = false> {
|
|
56
|
+
#private;
|
|
57
|
+
readonly name: string;
|
|
58
|
+
readonly schema: Schema;
|
|
59
|
+
readonly version: number;
|
|
60
|
+
readonly keyed: boolean;
|
|
61
|
+
readonly persist: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* `hash64` of the schema's normal form (descriptions and titles ignored), computed once: the same version with
|
|
64
|
+
* another fingerprint is a schema changed without a version bump.
|
|
65
|
+
*/
|
|
66
|
+
readonly fingerprint: string;
|
|
67
|
+
/** Type only: whether the definition is keyed. */
|
|
68
|
+
readonly "~keyed"?: K;
|
|
69
|
+
/** Type only: whether the definition is persisted. */
|
|
70
|
+
readonly "~persist"?: P;
|
|
71
|
+
constructor(name: string, schema: Schema, version: number, initial: () => T, migrate: ((old: JsonObject, from: number) => T) | undefined, keyed: boolean, persist: boolean, checkpointWhen: CheckpointWhen<T> | undefined);
|
|
72
|
+
/** Whether a persisted document's change is stored as a new base (its `checkpointWhen`); never asked in memory. */
|
|
73
|
+
checkpointWhen(value: T, ops: readonly Op[], info: CheckpointInfo): boolean;
|
|
74
|
+
/** A fresh `initial()` value; the first is checked against the schema (counted), later ones are not (R8). */
|
|
75
|
+
initial(context: Context): T;
|
|
76
|
+
/**
|
|
77
|
+
* `old`, a value of version `from`, migrated to this version and checked against the schema once, as it is
|
|
78
|
+
* produced (R8, counted). Throws without a `migrate` (the access is refused, the data kept) and when the result does
|
|
79
|
+
* not match.
|
|
80
|
+
*/
|
|
81
|
+
migrate(old: JsonObject, from: number, context: Context): T;
|
|
82
|
+
}
|
|
83
|
+
export {};
|
|
84
|
+
//# sourceMappingURL=definition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../src/documents/definition.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAI5D,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAG5C,sCAAsC;AACtC,MAAM,MAAM,UAAU,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,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AC,CAAC;IAOhC,YACC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,CAAC,EAChB,OAAO,EAAE,CAAC,CAAC,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC,CAAC,GAAG,SAAS,EAC3D,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,OAAO,EAChB,cAAc,EAAE,cAAc,CAAC,CAAC,CAAC,GAAG,SAAS,EAW7C;IAED,mHAAmH;IACnH,cAAc,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,EAAE,IAAI,EAAE,cAAc,GAAG,OAAO,CAE1E;IAED,6GAA6G;IAC7G,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,CAAC,CAM3B;IAED;;;;OAIG;IACH,OAAO,CAAC,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,CAAC,CAO1D;CAQD"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// Document definitions: `defineState(name, ...)`, its fingerprint, the one check of a definition's `initial()` (R8),
|
|
2
|
+
// the checked `migrate` of an older value and, for a persisted document, its checkpoint rule (slice 6a §10).
|
|
3
|
+
import { checkName, fingerprintOf } from "../contracts/internal.js";
|
|
4
|
+
import { snapshotSchema } from "../contracts/snapshot.js";
|
|
5
|
+
import { validatorFor } from "../data/internal.js";
|
|
6
|
+
import { chordMetrics } from "../telemetry.js";
|
|
7
|
+
export function defineState(name, options) {
|
|
8
|
+
checkName(name, "A state name");
|
|
9
|
+
const { schema, version, initial, migrate, keyed, persist, checkpointWhen } = options;
|
|
10
|
+
return new StateDefinition(name, schema, version, initial, migrate, keyed ?? false, persist ?? false, checkpointWhen);
|
|
11
|
+
}
|
|
12
|
+
const NEVER = () => false;
|
|
13
|
+
/** A declared document; `T` is its value, `K` whether it is keyed, `P` whether it is persisted. */
|
|
14
|
+
export class StateDefinition {
|
|
15
|
+
name;
|
|
16
|
+
schema;
|
|
17
|
+
version;
|
|
18
|
+
keyed;
|
|
19
|
+
persist;
|
|
20
|
+
/**
|
|
21
|
+
* `hash64` of the schema's normal form (descriptions and titles ignored), computed once: the same version with
|
|
22
|
+
* another fingerprint is a schema changed without a version bump.
|
|
23
|
+
*/
|
|
24
|
+
fingerprint;
|
|
25
|
+
#initial;
|
|
26
|
+
#migrate;
|
|
27
|
+
/** Method-typed so that a definition of a narrower `T` still is a `StateDefinition<JsonObject, ...>`. */
|
|
28
|
+
#checkpointWhen;
|
|
29
|
+
#checked = false;
|
|
30
|
+
constructor(name, schema, version, initial, migrate, keyed, persist, checkpointWhen) {
|
|
31
|
+
this.name = name;
|
|
32
|
+
this.schema = schema;
|
|
33
|
+
this.version = version;
|
|
34
|
+
this.#initial = initial;
|
|
35
|
+
this.#migrate = migrate;
|
|
36
|
+
this.keyed = keyed;
|
|
37
|
+
this.persist = persist;
|
|
38
|
+
this.#checkpointWhen = checkpointWhen ?? NEVER;
|
|
39
|
+
this.fingerprint = fingerprintOf(snapshotSchema(schema, name).normal);
|
|
40
|
+
}
|
|
41
|
+
/** Whether a persisted document's change is stored as a new base (its `checkpointWhen`); never asked in memory. */
|
|
42
|
+
checkpointWhen(value, ops, info) {
|
|
43
|
+
return this.#checkpointWhen(value, ops, info);
|
|
44
|
+
}
|
|
45
|
+
/** A fresh `initial()` value; the first is checked against the schema (counted), later ones are not (R8). */
|
|
46
|
+
initial(context) {
|
|
47
|
+
const value = this.#initial();
|
|
48
|
+
if (this.#checked)
|
|
49
|
+
return value;
|
|
50
|
+
this.#check(value, "initial()", context);
|
|
51
|
+
this.#checked = true;
|
|
52
|
+
return value;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* `old`, a value of version `from`, migrated to this version and checked against the schema once, as it is
|
|
56
|
+
* produced (R8, counted). Throws without a `migrate` (the access is refused, the data kept) and when the result does
|
|
57
|
+
* not match.
|
|
58
|
+
*/
|
|
59
|
+
migrate(old, from, context) {
|
|
60
|
+
if (this.#migrate === undefined) {
|
|
61
|
+
throw new Error(`${this.name}: no migrate from version ${from} to ${this.version}`);
|
|
62
|
+
}
|
|
63
|
+
const value = this.#migrate(old, from);
|
|
64
|
+
this.#check(value, `migrate() from version ${from}`, context);
|
|
65
|
+
return value;
|
|
66
|
+
}
|
|
67
|
+
#check(value, what, context) {
|
|
68
|
+
chordMetrics(context.telemetry.metrics).counter("chord.data.validations").add(1);
|
|
69
|
+
if (!validatorFor(this, context).check(value)) {
|
|
70
|
+
throw new Error(`${this.name}: ${what} does not match the schema`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=definition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definition.js","sourceRoot":"","sources":["../../src/documents/definition.ts"],"names":[],"mappings":"AAAA,qHAAqH;AACrH,6GAA6G;AAI7G,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGnD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAqD/C,MAAM,UAAU,WAAW,CAC1B,IAAY,EACZ,OAGC;IAED,SAAS,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;IAChC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC;IACtF,OAAO,IAAI,eAAe,CACzB,IAAI,EACJ,MAAM,EACN,OAAO,EACP,OAAO,EACP,OAAO,EACP,KAAK,IAAI,KAAK,EACd,OAAO,IAAI,KAAK,EAChB,cAAc,CACd,CAAC;AACH,CAAC;AAKD,MAAM,KAAK,GAA+B,GAAG,E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C,CAAC;QACzC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,OAAO,KAAK,CAAC;IACd,CAAC;IAED;;;;OAIG;IACH,OAAO,CAAC,GAAe,EAAE,IAAY,EAAE,OAAgB;QACtD,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;YACjC,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,CAAC,IAAI,6BAA6B,IAAI,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;QACrF,CAAC;QACD,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACvC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,0BAA0B,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC;QAC9D,OAAO,KAAK,CAAC;IACd,CAAC;IAED,MAAM,CAAC,KAAQ,EAAE,IAAY,EAAE,OAAgB;QAC9C,YAAY,CAAC,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,wBAAwB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QACjF,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;YAC/C,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,CAAC,IAAI,KAAK,IAAI,4BAA4B,CAAC,CAAC;QACpE,CAAC;IACF,CAAC;CACD","sourcesContent":["// Document definitions: `defineState(name, ...)`, its fingerprint, the one check of a definition's `initial()` (R8),\n// the checked `migrate` of an older value and, for a persisted document, its checkpoint rule (slice 6a §10).\n\nimport type { Context } from \"../context/index.ts\";\nimport type { Schema, Static } from \"../contracts/index.ts\";\nimport { checkName, fingerprintOf } from \"../contracts/internal.ts\";\nimport { snapshotSchema } from \"../contracts/snapshot.ts\";\nimport { validatorFor } from \"../data/internal.ts\";\nimport type { Op } from \"../delta/index.ts\";\nimport type { JsonValue } from \"../json.ts\";\nimport { chordMetrics } from \"../telemetry.ts\";\n\n/** A document root: a JSON object. */\nexport type JsonObject = { [key: string]: JsonValue };\n\n/**\n * When a commit reaches the store (Durable's `CommitPersistence`): `immediate`, the default, before the commit\n * resolves; `deferred` (a persisted run's state change, D8): adopted and published at once, stored with the next\n * immediate change, the run's outcome, the object's close, or about `withinMs` (default 1,000 ms) later.\n */\nexport type CommitPersistence =\n\t| { readonly kind: \"immediate\" }\n\t| { readonly kind: \"deferred\"; readonly withinMs?: number };\n\n/** What a persisted document's `checkpointWhen` learns of its stored revisions. */\nexport type CheckpointInfo = {\n\t/** The deltas stored after its newest base, without the change being decided. */\n\treadonly deltasSinceBase: number;\n};\n\n/** Whether a commit's change of a persisted document is stored as a whole new base (`true`) or as a delta. */\nexport type CheckpointWhen<T> = (value: T, ops: readonly Op[], info: CheckpointInfo) => boolean;\n\n/** What `defineState` takes for any document. */\ntype StateOptions<S extends Schema, K extends boolean> = {\n\treadonly schema: S;\n\treadonly version: number;\n\treadonly initial: () => DocumentOf<S>;\n\t/** Maps a value of an older version `from` to this version's shape; pure. Required to read older values. */\n\treadonly migrate?: (old: JsonObject, from: number) => DocumentOf<S>;\n\treadonly keyed?: K;\n};\n\n/** What a persisted document adds (slice 6a §10): `checkpointWhen` is required. */\ntype PersistOptions<S extends Schema> = {\n\t/** Stored in the host's store; only in `local` types with empty params (P3). */\n\treadonly persist: true;\n\t/** Called once per commit per changed document; creations and version changes always store a base. */\n\treadonly checkpointWhen: CheckpointWhen<DocumentOf<S>>;\n};\n\n/**\n * Declares a document: a singleton per object, or with `keyed: true` many per object, each by a string key; with\n * `persist: true` stored in the host's store. Its name is a restricted name (lowercase `[a-z0-9@/._~-]`).\n */\nexport function defineState<S extends Schema, K extends boolean = false>(\n\tname: string,\n\toptions: StateOptions<S, K> & { readonly persist?: false; readonly checkpointWhen?: never },\n): StateDefinition<DocumentOf<S>, K, false>;\nexport function defineState<S extends Schema, K extends boolean = false>(\n\tname: string,\n\toptions: StateOptions<S, K> & PersistOptions<S>,\n): StateDefinition<DocumentOf<S>, K, true>;\nexport function defineState<S extends Schema, K extends boolean>(\n\tname: string,\n\toptions: StateOptions<S, K> & {\n\t\treadonly persist?: boolean;\n\t\treadonly checkpointWhen?: CheckpointWhen<DocumentOf<S>>;\n\t},\n): StateDefinition<DocumentOf<S>, K, boolean> {\n\tcheckName(name, \"A state name\");\n\tconst { schema, version, initial, migrate, keyed, persist, checkpointWhen } = options;\n\treturn new StateDefinition(\n\t\tname,\n\t\tschema,\n\t\tversion,\n\t\tinitial,\n\t\tmigrate,\n\t\tkeyed ?? false,\n\t\tpersist ?? false,\n\t\tcheckpointWhen,\n\t);\n}\n\n/** The value of a document whose schema is `S`: its static type, which must be a JSON object. */\ntype DocumentOf<S extends Schema> = Static<S> extends JsonObject ? Static<S> : never;\n\nconst NEVER: CheckpointWhen<JsonObject> = () => false;\n\n/** A declared document; `T` is its value, `K` whether it is keyed, `P` whether it is persisted. */\nexport class StateDefinition<T extends JsonObject, K extends boolean, P extends boolean = false> {\n\treadonly name: string;\n\treadonly schema: Schema;\n\treadonly version: number;\n\treadonly keyed: boolean;\n\treadonly persist: boolean;\n\t/**\n\t * `hash64` of the schema's normal form (descriptions and titles ignored), computed once: the same version with\n\t * another fingerprint is a schema changed without a version bump.\n\t */\n\treadonly fingerprint: string;\n\t/** Type only: whether the definition is keyed. */\n\tdeclare readonly \"~keyed\"?: K;\n\t/** Type only: whether the definition is persisted. */\n\tdeclare readonly \"~persist\"?: P;\n\treadonly #initial: () => T;\n\treadonly #migrate: ((old: JsonObject, from: number) => T) | undefined;\n\t/** Method-typed so that a definition of a narrower `T` still is a `StateDefinition<JsonObject, ...>`. */\n\treadonly #checkpointWhen: { rule(value: T, ops: readonly Op[], info: CheckpointInfo): boolean }[\"rule\"];\n\t#checked = false;\n\n\tconstructor(\n\t\tname: string,\n\t\tschema: Schema,\n\t\tversion: number,\n\t\tinitial: () => T,\n\t\tmigrate: ((old: JsonObject, from: number) => T) | undefined,\n\t\tkeyed: boolean,\n\t\tpersist: boolean,\n\t\tcheckpointWhen: CheckpointWhen<T> | undefined,\n\t) {\n\t\tthis.name = name;\n\t\tthis.schema = schema;\n\t\tthis.version = version;\n\t\tthis.#initial = initial;\n\t\tthis.#migrate = migrate;\n\t\tthis.keyed = keyed;\n\t\tthis.persist = persist;\n\t\tthis.#checkpointWhen = checkpointWhen ?? NEVER;\n\t\tthis.fingerprint = fingerprintOf(snapshotSchema(schema, name).normal);\n\t}\n\n\t/** Whether a persisted document's change is stored as a new base (its `checkpointWhen`); never asked in memory. */\n\tcheckpointWhen(value: T, ops: readonly Op[], info: CheckpointInfo): boolean {\n\t\treturn this.#checkpointWhen(value, ops, info);\n\t}\n\n\t/** A fresh `initial()` value; the first is checked against the schema (counted), later ones are not (R8). */\n\tinitial(context: Context): T {\n\t\tconst value = this.#initial();\n\t\tif (this.#checked) return value;\n\t\tthis.#check(value, \"initial()\", context);\n\t\tthis.#checked = true;\n\t\treturn value;\n\t}\n\n\t/**\n\t * `old`, a value of version `from`, migrated to this version and checked against the schema once, as it is\n\t * produced (R8, counted). Throws without a `migrate` (the access is refused, the data kept) and when the result does\n\t * not match.\n\t */\n\tmigrate(old: JsonObject, from: number, context: Context): T {\n\t\tif (this.#migrate === undefined) {\n\t\t\tthrow new Error(`${this.name}: no migrate from version ${from} to ${this.version}`);\n\t\t}\n\t\tconst value = this.#migrate(old, from);\n\t\tthis.#check(value, `migrate() from version ${from}`, context);\n\t\treturn value;\n\t}\n\n\t#check(value: T, what: string, context: Context): void {\n\t\tchordMetrics(context.telemetry.metrics).counter(\"chord.data.validations\").add(1);\n\t\tif (!validatorFor(this, context).check(value)) {\n\t\t\tthrow new Error(`${this.name}: ${what} does not match the schema`);\n\t\t}\n\t}\n}\n"]}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import type { TelemetryContext } from "@earendil-works/pi-telemetry";
|
|
2
|
+
import type { Context } from "../context/index.ts";
|
|
3
|
+
import { ChordError } from "../data/index.ts";
|
|
4
|
+
import type { Batch } from "../state/internal.ts";
|
|
5
|
+
import type { ChordStore } from "../store/store.ts";
|
|
6
|
+
import type { CommitPersistence, JsonObject, StateDefinition } from "./definition.ts";
|
|
7
|
+
import { SealToken } from "./fence.ts";
|
|
8
|
+
import { type HandleOf, type KeyDeclarer } from "./handles.ts";
|
|
9
|
+
import { Line } from "./line.ts";
|
|
10
|
+
import { Residency } from "./residency.ts";
|
|
11
|
+
import { type AnyDefinition } from "./slot.ts";
|
|
12
|
+
import { Transaction } from "./transaction.ts";
|
|
13
|
+
/**
|
|
14
|
+
* A transaction (a document change or retirement, `self.tx`, a job start) that did not commit because the context it
|
|
15
|
+
* was started with ended first: a root whose `fn` settled, a handler or routine whose object ended, a caller that
|
|
16
|
+
* cancelled. `error` is that context's abort reason, naming the scope that ended (decision "Mistakes that wait are
|
|
17
|
+
* reported at once" (e)).
|
|
18
|
+
*/
|
|
19
|
+
export type TransactionCancelled = {
|
|
20
|
+
readonly kind: "transaction_cancelled";
|
|
21
|
+
readonly object: string;
|
|
22
|
+
readonly error: unknown;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Who owns an object's documents: the object's name, batch and context, its store address, its live failure, and where
|
|
26
|
+
* a cancelled transaction is reported.
|
|
27
|
+
*/
|
|
28
|
+
export type DocumentsOwner = {
|
|
29
|
+
/** The owner's name in errors. */
|
|
30
|
+
readonly label: string;
|
|
31
|
+
readonly batch: Batch;
|
|
32
|
+
/** The object's context: shared cold loads run under it (rule 11). */
|
|
33
|
+
readonly context: Context;
|
|
34
|
+
/** The host's store and the object's owner name in it (its type, R2), when it has one. */
|
|
35
|
+
readonly store: {
|
|
36
|
+
readonly store: ChordStore;
|
|
37
|
+
readonly owner: string;
|
|
38
|
+
} | undefined;
|
|
39
|
+
/** A document the code cannot read fails the live object `broken` (slice 6a §1.4); ignored when it is not live. */
|
|
40
|
+
fail(error: ChordError): void;
|
|
41
|
+
/** Reports a transaction its context's end cancelled (the host's `onError`). */
|
|
42
|
+
report(error: TransactionCancelled): void;
|
|
43
|
+
/** The host's telemetry adapter: commit durations go to its metrics. */
|
|
44
|
+
readonly telemetry: TelemetryContext;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* The documents of one object, from its first activation to its end: one slot per declared name, kept across
|
|
48
|
+
* attempts, and the line. Each attempt declares its handles under its own seal token; the object's own transactions
|
|
49
|
+
* (job outcomes) run under `own`, sealed only by the object's end.
|
|
50
|
+
*/
|
|
51
|
+
export declare class Documents {
|
|
52
|
+
#private;
|
|
53
|
+
/** The owner's name in errors. */
|
|
54
|
+
readonly label: string;
|
|
55
|
+
readonly batch: Batch;
|
|
56
|
+
/** The object's context. */
|
|
57
|
+
readonly context: Context;
|
|
58
|
+
readonly line: Line;
|
|
59
|
+
/**
|
|
60
|
+
* The idle persisted keyed documents and their eviction. A sweep's only rejection is `onLine`'s `released` once
|
|
61
|
+
* the object ended (a sweep itself drops trackers in memory and does not throw): nothing to report.
|
|
62
|
+
*/
|
|
63
|
+
readonly residency: Residency;
|
|
64
|
+
/** The token of the object's own transactions: sealed with the object (`seal`). */
|
|
65
|
+
readonly own: SealToken;
|
|
66
|
+
constructor(owner: DocumentsOwner);
|
|
67
|
+
/**
|
|
68
|
+
* A handle to `definition`'s slot for an attempt sealed by `token`, whose `at(key)` pins `declarer` takes: the slot
|
|
69
|
+
* made by the first declaration of its name, checked against the values for later ones (`SlotDefinition.check`).
|
|
70
|
+
* "Declared twice" is the attempt's check.
|
|
71
|
+
*/
|
|
72
|
+
declare<D extends StateDefinition<JsonObject, boolean, boolean>>(definition: D, token: SealToken, declarer: KeyDeclarer): HandleOf<D>;
|
|
73
|
+
/**
|
|
74
|
+
* Checks a declaration of `definition` as `declare` would, changing nothing (a reload's staging: a recording factory
|
|
75
|
+
* declares against the documents the object has).
|
|
76
|
+
*/
|
|
77
|
+
check(definition: AnyDefinition): void;
|
|
78
|
+
/**
|
|
79
|
+
* Takes an attempt's declarations once its factory returned: its `at(key)` pins replace the previous factory's, the
|
|
80
|
+
* slots it no longer declares are dropped (their watches end; persisted ones load again when declared again), every
|
|
81
|
+
* declared one hydrated (`initial()`, migrations; a throw fails the activation).
|
|
82
|
+
*/
|
|
83
|
+
hydrate(declared: ReadonlyMap<string, AnyDefinition>, pins: readonly (() => void)[], context: Context): void;
|
|
84
|
+
/**
|
|
85
|
+
* Loads, in one line job, every persisted singleton not loaded yet and every pinned key not loaded since it was
|
|
86
|
+
* pinned (an attempt's activation, before it goes live, rule 6); `undefined` when nothing is persisted. A failure
|
|
87
|
+
* fails the activation.
|
|
88
|
+
*/
|
|
89
|
+
load(context: Context): Promise<void> | undefined;
|
|
90
|
+
/**
|
|
91
|
+
* Runs `job` on the line (a cold load, a page of keys, an eviction sweep); refused `released` once the object is
|
|
92
|
+
* ending or `token` (the handle's that asks, when the job is one handle's) is sealed, a job queued before either
|
|
93
|
+
* included (anything taking the line after the seal is refused, rule 4).
|
|
94
|
+
*/
|
|
95
|
+
onLine<T>(job: () => Promise<T>, token?: SealToken): Promise<T>;
|
|
96
|
+
/**
|
|
97
|
+
* Runs `fn` as one transaction on the line under `token` and commits what it drafted (§9): a throw, an abort of
|
|
98
|
+
* `context`, the token's seal or the object's end discards everything; one that did not commit while `context` was
|
|
99
|
+
* aborted is also reported (`transaction_cancelled`): an empty `catch` cannot hide a change that never happened.
|
|
100
|
+
* `persistence` defers storing a run state's change (D8).
|
|
101
|
+
*/
|
|
102
|
+
tx<R>(fn: (tx: Transaction) => R | Promise<R>, token: SealToken, context: Context, persistence?: CommitPersistence): Promise<R>;
|
|
103
|
+
/**
|
|
104
|
+
* Seals `token` (the seal fence): its transactions are refused from now on, and the one holding the line is
|
|
105
|
+
* discarded and the line released.
|
|
106
|
+
*/
|
|
107
|
+
fence(token: SealToken): void;
|
|
108
|
+
/** Throws `released` once the object ended. */
|
|
109
|
+
assertLive(): void;
|
|
110
|
+
/** Throws `released` once `token` is sealed or the object is ending: no new work takes the line. */
|
|
111
|
+
assertAdmitted(token: SealToken): void;
|
|
112
|
+
/** The live object fails `broken` with `error` (a document the code cannot read); ignored when it is not live. */
|
|
113
|
+
fail(error: ChordError): void;
|
|
114
|
+
/** The object is ending: every transaction is refused, the one holding the line discarded; documents stay readable. */
|
|
115
|
+
seal(): void;
|
|
116
|
+
/**
|
|
117
|
+
* Resolves once the line is free. After `seal` only an admitted step can hold it (every other holder was cut):
|
|
118
|
+
* the object's teardown waits here, so the step adopts into documents that still exist (slice 6a §1.3).
|
|
119
|
+
*/
|
|
120
|
+
settled(): Promise<void>;
|
|
121
|
+
/** Drops every document and pin; watches end `ended`, and every later use throws `released`. */
|
|
122
|
+
end(): void;
|
|
123
|
+
/** The `released` error of this object's documents. */
|
|
124
|
+
released(): ChordError;
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=documents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"documents.d.ts","sourceRoot":"","sources":["../../src/documents/documents.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACtF,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,WAAW,EAAoB,MAAM,cAAc,CAAC;AAEjF,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3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;IAED;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAG7B;IAED,gGAAgG;IAChG,GAAG,IAAI,IAAI,CAMV;IAED,uDAAuD;IACvD,QAAQ,IAAI,UAAU,CAErB;CAmBD"}
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
// An object's documents (§9, P2, slice 6a §1.2, §10): its slots across attempts, its line (its transactions and line
|
|
2
|
+
// jobs run one at a time), the seal fence over the transaction holding the line, the factory's pins between attempts,
|
|
3
|
+
// the activation's loads and the residency of keyed documents; a commit's telemetry (its event, its duration, slice 9).
|
|
4
|
+
import { ChordError } from "../data/index.js";
|
|
5
|
+
import { chordMetrics, untraced } from "../telemetry.js";
|
|
6
|
+
import { SealToken } from "./fence.js";
|
|
7
|
+
import { Keyed, Singleton } from "./handles.js";
|
|
8
|
+
import { KeyedSlot } from "./keyed-slot.js";
|
|
9
|
+
import { Line } from "./line.js";
|
|
10
|
+
import { Persistence } from "./persistence.js";
|
|
11
|
+
import { Residency } from "./residency.js";
|
|
12
|
+
import { SingletonSlot } from "./slot.js";
|
|
13
|
+
import { Transaction } from "./transaction.js";
|
|
14
|
+
/**
|
|
15
|
+
* The documents of one object, from its first activation to its end: one slot per declared name, kept across
|
|
16
|
+
* attempts, and the line. Each attempt declares its handles under its own seal token; the object's own transactions
|
|
17
|
+
* (job outcomes) run under `own`, sealed only by the object's end.
|
|
18
|
+
*/
|
|
19
|
+
export class Documents {
|
|
20
|
+
/** The owner's name in errors. */
|
|
21
|
+
label;
|
|
22
|
+
batch;
|
|
23
|
+
/** The object's context. */
|
|
24
|
+
context;
|
|
25
|
+
line = new Line();
|
|
26
|
+
/**
|
|
27
|
+
* The idle persisted keyed documents and their eviction. A sweep's only rejection is `onLine`'s `released` once
|
|
28
|
+
* the object ended (a sweep itself drops trackers in memory and does not throw): nothing to report.
|
|
29
|
+
*/
|
|
30
|
+
residency = new Residency((sweep) => void this.onLine(async () => sweep()).catch(() => { }));
|
|
31
|
+
#owner;
|
|
32
|
+
/** The token of the object's own transactions: sealed with the object (`seal`). */
|
|
33
|
+
own = new SealToken();
|
|
34
|
+
#slots = new Map();
|
|
35
|
+
/** The transaction holding the line, until it settles or its token is sealed. */
|
|
36
|
+
#holder;
|
|
37
|
+
/** `sealed`: the object is ending; its documents stay readable, its transactions throw `released`. */
|
|
38
|
+
#state = "open";
|
|
39
|
+
/** The pins the last factory that returned declared (`at(key)`): held until the next one returns (rule 6). */
|
|
40
|
+
#pins = [];
|
|
41
|
+
constructor(owner) {
|
|
42
|
+
this.label = owner.label;
|
|
43
|
+
this.batch = owner.batch;
|
|
44
|
+
this.context = owner.context;
|
|
45
|
+
this.#owner = owner;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* A handle to `definition`'s slot for an attempt sealed by `token`, whose `at(key)` pins `declarer` takes: the slot
|
|
49
|
+
* made by the first declaration of its name, checked against the values for later ones (`SlotDefinition.check`).
|
|
50
|
+
* "Declared twice" is the attempt's check.
|
|
51
|
+
*/
|
|
52
|
+
declare(definition, token, declarer) {
|
|
53
|
+
const slot = this.#slots.get(definition.name);
|
|
54
|
+
if (slot !== undefined)
|
|
55
|
+
slot.definition.check(definition);
|
|
56
|
+
const persistence = slot === undefined && definition.persist ? this.#persistence(definition.name) : undefined;
|
|
57
|
+
// The definition's `keyed` decides the slot's class and the handle's; its documents are the definition's `T`.
|
|
58
|
+
if (definition.keyed) {
|
|
59
|
+
const keyed = slot ?? this.#add(new KeyedSlot(this, definition, persistence));
|
|
60
|
+
return new Keyed(keyed, token, definition.version, declarer);
|
|
61
|
+
}
|
|
62
|
+
const singleton = slot ?? this.#add(new SingletonSlot(this, definition, persistence));
|
|
63
|
+
return new Singleton(singleton, token, definition.version);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Checks a declaration of `definition` as `declare` would, changing nothing (a reload's staging: a recording factory
|
|
67
|
+
* declares against the documents the object has).
|
|
68
|
+
*/
|
|
69
|
+
check(definition) {
|
|
70
|
+
this.#slots.get(definition.name)?.definition.check(definition);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Takes an attempt's declarations once its factory returned: its `at(key)` pins replace the previous factory's, the
|
|
74
|
+
* slots it no longer declares are dropped (their watches end; persisted ones load again when declared again), every
|
|
75
|
+
* declared one hydrated (`initial()`, migrations; a throw fails the activation).
|
|
76
|
+
*/
|
|
77
|
+
hydrate(declared, pins, context) {
|
|
78
|
+
const previous = this.#pins;
|
|
79
|
+
this.#pins = pins;
|
|
80
|
+
for (const release of previous)
|
|
81
|
+
release();
|
|
82
|
+
// A dropped persisted slot goes whole, its loaded documents too: observably the same as keeping them, since
|
|
83
|
+
// every committed write is in the store and a later declaration reloads from there.
|
|
84
|
+
for (const [name, slot] of this.#slots) {
|
|
85
|
+
if (declared.has(name))
|
|
86
|
+
continue;
|
|
87
|
+
this.#slots.delete(name);
|
|
88
|
+
slot.drop();
|
|
89
|
+
}
|
|
90
|
+
for (const [name, definition] of declared)
|
|
91
|
+
this.#slots.get(name).hydrate(definition, context);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Loads, in one line job, every persisted singleton not loaded yet and every pinned key not loaded since it was
|
|
95
|
+
* pinned (an attempt's activation, before it goes live, rule 6); `undefined` when nothing is persisted. A failure
|
|
96
|
+
* fails the activation.
|
|
97
|
+
*/
|
|
98
|
+
load(context) {
|
|
99
|
+
const persisted = [...this.#slots.values()].filter((slot) => slot.persisted !== undefined);
|
|
100
|
+
// In memory only: nothing to wait for (an activation without persisted documents takes no extra turn).
|
|
101
|
+
if (persisted.length === 0)
|
|
102
|
+
return undefined;
|
|
103
|
+
return this.onLine(async () => {
|
|
104
|
+
for (const slot of persisted)
|
|
105
|
+
await slot.loadDeclared(context);
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Runs `job` on the line (a cold load, a page of keys, an eviction sweep); refused `released` once the object is
|
|
110
|
+
* ending or `token` (the handle's that asks, when the job is one handle's) is sealed, a job queued before either
|
|
111
|
+
* included (anything taking the line after the seal is refused, rule 4).
|
|
112
|
+
*/
|
|
113
|
+
async onLine(job, token) {
|
|
114
|
+
if (this.#state !== "open" || token?.sealed)
|
|
115
|
+
throw this.released();
|
|
116
|
+
const release = await this.line.acquire();
|
|
117
|
+
try {
|
|
118
|
+
if (this.#state !== "open" || token?.sealed)
|
|
119
|
+
throw this.released();
|
|
120
|
+
return await job();
|
|
121
|
+
}
|
|
122
|
+
finally {
|
|
123
|
+
release();
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Runs `fn` as one transaction on the line under `token` and commits what it drafted (§9): a throw, an abort of
|
|
128
|
+
* `context`, the token's seal or the object's end discards everything; one that did not commit while `context` was
|
|
129
|
+
* aborted is also reported (`transaction_cancelled`): an empty `catch` cannot hide a change that never happened.
|
|
130
|
+
* `persistence` defers storing a run state's change (D8).
|
|
131
|
+
*/
|
|
132
|
+
async tx(fn, token, context, persistence) {
|
|
133
|
+
this.batch.assertOutside("tx");
|
|
134
|
+
this.assertAdmitted(token);
|
|
135
|
+
const release = await this.line.acquire();
|
|
136
|
+
const tx = new Transaction(this, token, release, context, persistence);
|
|
137
|
+
try {
|
|
138
|
+
this.assertAdmitted(token);
|
|
139
|
+
this.#holder = tx;
|
|
140
|
+
const result = await fn(tx);
|
|
141
|
+
// Timed only when something records: the commit's duration metric, its event on the enclosing span.
|
|
142
|
+
const timed = !untraced(this.#owner.telemetry) || !untraced(context.telemetry);
|
|
143
|
+
const started = timed ? performance.now() : 0;
|
|
144
|
+
// In-memory-only commits are synchronous (W12): no await unless the store's step is taken.
|
|
145
|
+
const step = tx.commit();
|
|
146
|
+
if (step !== undefined)
|
|
147
|
+
await step;
|
|
148
|
+
if (timed)
|
|
149
|
+
this.#recordCommit(tx, performance.now() - started, context);
|
|
150
|
+
return result;
|
|
151
|
+
}
|
|
152
|
+
catch (error) {
|
|
153
|
+
tx.discard();
|
|
154
|
+
// Only a transaction that did not commit reads this; Chord's own run under contexts that never abort.
|
|
155
|
+
const signal = context.abortSignal;
|
|
156
|
+
if (signal?.aborted)
|
|
157
|
+
this.#owner.report({ kind: "transaction_cancelled", object: this.label, error: signal.reason });
|
|
158
|
+
throw error;
|
|
159
|
+
}
|
|
160
|
+
finally {
|
|
161
|
+
if (this.#holder === tx)
|
|
162
|
+
this.#holder = undefined;
|
|
163
|
+
release();
|
|
164
|
+
tx.settle();
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* A commit of `tx` that took `duration` ms (from its start to its adoption): its event on `context`'s span (the
|
|
169
|
+
* method, routine or job it ran in) and the host's commit duration metric; a commit that changed nothing records
|
|
170
|
+
* nothing.
|
|
171
|
+
*/
|
|
172
|
+
#recordCommit(tx, duration, context) {
|
|
173
|
+
const { documents, ops, writes, rows } = tx.committed();
|
|
174
|
+
if (documents === 0 && writes === 0)
|
|
175
|
+
return;
|
|
176
|
+
if (!untraced(context.telemetry))
|
|
177
|
+
context.telemetry.addEvent("chord.commit", { documents, ops, rows, duration });
|
|
178
|
+
chordMetrics(this.#owner.telemetry.metrics).histogram("chord.commit.duration").record(duration);
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Seals `token` (the seal fence): its transactions are refused from now on, and the one holding the line is
|
|
182
|
+
* discarded and the line released.
|
|
183
|
+
*/
|
|
184
|
+
fence(token) {
|
|
185
|
+
token.seal();
|
|
186
|
+
if (this.#holder?.token === token)
|
|
187
|
+
this.#cut();
|
|
188
|
+
}
|
|
189
|
+
/** Throws `released` once the object ended. */
|
|
190
|
+
assertLive() {
|
|
191
|
+
if (this.#state === "ended")
|
|
192
|
+
throw this.released();
|
|
193
|
+
}
|
|
194
|
+
/** Throws `released` once `token` is sealed or the object is ending: no new work takes the line. */
|
|
195
|
+
assertAdmitted(token) {
|
|
196
|
+
if (token.sealed || this.#state !== "open")
|
|
197
|
+
throw this.released();
|
|
198
|
+
}
|
|
199
|
+
/** The live object fails `broken` with `error` (a document the code cannot read); ignored when it is not live. */
|
|
200
|
+
fail(error) {
|
|
201
|
+
this.#owner.fail(error);
|
|
202
|
+
}
|
|
203
|
+
/** The object is ending: every transaction is refused, the one holding the line discarded; documents stay readable. */
|
|
204
|
+
seal() {
|
|
205
|
+
if (this.#state !== "open")
|
|
206
|
+
return;
|
|
207
|
+
this.#state = "sealed";
|
|
208
|
+
this.own.seal();
|
|
209
|
+
this.#cut();
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Resolves once the line is free. After `seal` only an admitted step can hold it (every other holder was cut):
|
|
213
|
+
* the object's teardown waits here, so the step adopts into documents that still exist (slice 6a §1.3).
|
|
214
|
+
*/
|
|
215
|
+
async settled() {
|
|
216
|
+
const release = await this.line.acquire();
|
|
217
|
+
release();
|
|
218
|
+
}
|
|
219
|
+
/** Drops every document and pin; watches end `ended`, and every later use throws `released`. */
|
|
220
|
+
end() {
|
|
221
|
+
this.#state = "ended";
|
|
222
|
+
this.residency.end();
|
|
223
|
+
for (const slot of this.#slots.values())
|
|
224
|
+
slot.drop();
|
|
225
|
+
this.#slots.clear();
|
|
226
|
+
this.#pins = [];
|
|
227
|
+
}
|
|
228
|
+
/** The `released` error of this object's documents. */
|
|
229
|
+
released() {
|
|
230
|
+
return new ChordError({ code: "released", reason: "ended", message: `${this.label}: ended` });
|
|
231
|
+
}
|
|
232
|
+
/** Discards the transaction holding the line and releases the line. */
|
|
233
|
+
#cut() {
|
|
234
|
+
const holder = this.#holder;
|
|
235
|
+
this.#holder = undefined;
|
|
236
|
+
holder?.cut();
|
|
237
|
+
}
|
|
238
|
+
#add(slot) {
|
|
239
|
+
this.#slots.set(slot.definition.current.name, slot);
|
|
240
|
+
return slot;
|
|
241
|
+
}
|
|
242
|
+
/** The store side of persisted documents named `name`; the attempt checked the store first (P3). */
|
|
243
|
+
#persistence(name) {
|
|
244
|
+
const { store, owner } = this.#owner.store;
|
|
245
|
+
return new Persistence(store, owner, "chord", name);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
//# sourceMappingURL=documents.js.map
|