@diffra-ai/chord 0.0.0-stage → 0.2.2
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 +235 -0
- package/README.md +227 -2
- package/dist/context/index.d.ts +43 -0
- package/dist/context/index.d.ts.map +1 -0
- package/dist/context/index.js +112 -0
- package/dist/context/index.js.map +1 -0
- package/dist/contracts/accepts.d.ts +91 -0
- package/dist/contracts/accepts.d.ts.map +1 -0
- package/dist/contracts/accepts.js +145 -0
- package/dist/contracts/accepts.js.map +1 -0
- package/dist/contracts/contract.d.ts +238 -0
- package/dist/contracts/contract.d.ts.map +1 -0
- package/dist/contracts/contract.js +69 -0
- package/dist/contracts/contract.js.map +1 -0
- package/dist/contracts/declare.d.ts +144 -0
- package/dist/contracts/declare.d.ts.map +1 -0
- package/dist/contracts/declare.js +207 -0
- package/dist/contracts/declare.js.map +1 -0
- package/dist/contracts/evolve.d.ts +142 -0
- package/dist/contracts/evolve.d.ts.map +1 -0
- package/dist/contracts/evolve.js +216 -0
- package/dist/contracts/evolve.js.map +1 -0
- package/dist/contracts/fingerprint.d.ts +16 -0
- package/dist/contracts/fingerprint.d.ts.map +1 -0
- package/dist/contracts/fingerprint.js +61 -0
- package/dist/contracts/fingerprint.js.map +1 -0
- package/dist/contracts/history.d.ts +79 -0
- package/dist/contracts/history.d.ts.map +1 -0
- package/dist/contracts/history.js +3 -0
- package/dist/contracts/history.js.map +1 -0
- package/dist/contracts/host-kind.d.ts +58 -0
- package/dist/contracts/host-kind.d.ts.map +1 -0
- package/dist/contracts/host-kind.js +122 -0
- package/dist/contracts/host-kind.js.map +1 -0
- package/dist/contracts/index.d.ts +8 -0
- package/dist/contracts/index.d.ts.map +1 -0
- package/dist/contracts/index.js +7 -0
- package/dist/contracts/index.js.map +1 -0
- package/dist/contracts/internal.d.ts +12 -0
- package/dist/contracts/internal.d.ts.map +1 -0
- package/dist/contracts/internal.js +11 -0
- package/dist/contracts/internal.js.map +1 -0
- package/dist/contracts/names.d.ts +3 -0
- package/dist/contracts/names.d.ts.map +1 -0
- package/dist/contracts/names.js +13 -0
- package/dist/contracts/names.js.map +1 -0
- package/dist/contracts/params.d.ts +28 -0
- package/dist/contracts/params.d.ts.map +1 -0
- package/dist/contracts/params.js +55 -0
- package/dist/contracts/params.js.map +1 -0
- package/dist/contracts/schema.d.ts +144 -0
- package/dist/contracts/schema.d.ts.map +1 -0
- package/dist/contracts/schema.js +144 -0
- package/dist/contracts/schema.js.map +1 -0
- package/dist/contracts/snapshot.d.ts +16 -0
- package/dist/contracts/snapshot.d.ts.map +1 -0
- package/dist/contracts/snapshot.js +167 -0
- package/dist/contracts/snapshot.js.map +1 -0
- package/dist/data/args.d.ts +50 -0
- package/dist/data/args.d.ts.map +1 -0
- package/dist/data/args.js +83 -0
- package/dist/data/args.js.map +1 -0
- package/dist/data/errors.d.ts +80 -0
- package/dist/data/errors.d.ts.map +1 -0
- package/dist/data/errors.js +116 -0
- package/dist/data/errors.js.map +1 -0
- package/dist/data/failure.d.ts +31 -0
- package/dist/data/failure.d.ts.map +1 -0
- package/dist/data/failure.js +78 -0
- package/dist/data/failure.js.map +1 -0
- package/dist/data/index.d.ts +4 -0
- package/dist/data/index.d.ts.map +1 -0
- package/dist/data/index.js +5 -0
- package/dist/data/index.js.map +1 -0
- package/dist/data/internal.d.ts +7 -0
- package/dist/data/internal.d.ts.map +1 -0
- package/dist/data/internal.js +8 -0
- package/dist/data/internal.js.map +1 -0
- package/dist/data/params.d.ts +20 -0
- package/dist/data/params.d.ts.map +1 -0
- package/dist/data/params.js +31 -0
- package/dist/data/params.js.map +1 -0
- package/dist/data/principal.d.ts +28 -0
- package/dist/data/principal.d.ts.map +1 -0
- package/dist/data/principal.js +64 -0
- package/dist/data/principal.js.map +1 -0
- package/dist/data/validator.d.ts +12 -0
- package/dist/data/validator.d.ts.map +1 -0
- package/dist/data/validator.js +35 -0
- package/dist/data/validator.js.map +1 -0
- package/dist/delta/apply-immutable-trusted.d.ts +4 -0
- package/dist/delta/apply-immutable-trusted.d.ts.map +1 -0
- package/dist/delta/apply-immutable-trusted.js +126 -0
- package/dist/delta/apply-immutable-trusted.js.map +1 -0
- package/dist/delta/diff.d.ts +5 -0
- package/dist/delta/diff.d.ts.map +1 -0
- package/dist/delta/diff.js +435 -0
- package/dist/delta/diff.js.map +1 -0
- package/dist/delta/draft.d.ts +5 -0
- package/dist/delta/draft.d.ts.map +1 -0
- package/dist/delta/draft.js +2 -0
- package/dist/delta/draft.js.map +1 -0
- package/dist/delta/index.d.ts +120 -0
- package/dist/delta/index.d.ts.map +1 -0
- package/dist/delta/index.js +697 -0
- package/dist/delta/index.js.map +1 -0
- package/dist/delta/pending.d.ts +36 -0
- package/dist/delta/pending.d.ts.map +1 -0
- package/dist/delta/pending.js +143 -0
- package/dist/delta/pending.js.map +1 -0
- package/dist/delta/revision-validator.d.ts +7 -0
- package/dist/delta/revision-validator.d.ts.map +1 -0
- package/dist/delta/revision-validator.js +71 -0
- package/dist/delta/revision-validator.js.map +1 -0
- package/dist/delta/tracker.d.ts +38 -0
- package/dist/delta/tracker.d.ts.map +1 -0
- package/dist/delta/tracker.js +2175 -0
- package/dist/delta/tracker.js.map +1 -0
- package/dist/documents/address-source.d.ts +20 -0
- package/dist/documents/address-source.d.ts.map +1 -0
- package/dist/documents/address-source.js +44 -0
- package/dist/documents/address-source.js.map +1 -0
- package/dist/documents/definition.d.ts +92 -0
- package/dist/documents/definition.d.ts.map +1 -0
- package/dist/documents/definition.js +81 -0
- package/dist/documents/definition.js.map +1 -0
- package/dist/documents/documents.d.ts +129 -0
- package/dist/documents/documents.d.ts.map +1 -0
- package/dist/documents/documents.js +258 -0
- package/dist/documents/documents.js.map +1 -0
- package/dist/documents/fence.d.ts +9 -0
- package/dist/documents/fence.d.ts.map +1 -0
- package/dist/documents/fence.js +15 -0
- package/dist/documents/fence.js.map +1 -0
- package/dist/documents/handles.d.ts +81 -0
- package/dist/documents/handles.d.ts.map +1 -0
- package/dist/documents/handles.js +74 -0
- package/dist/documents/handles.js.map +1 -0
- package/dist/documents/index.d.ts +4 -0
- package/dist/documents/index.d.ts.map +1 -0
- package/dist/documents/index.js +3 -0
- package/dist/documents/index.js.map +1 -0
- package/dist/documents/internal.d.ts +9 -0
- package/dist/documents/internal.d.ts.map +1 -0
- package/dist/documents/internal.js +9 -0
- package/dist/documents/internal.js.map +1 -0
- package/dist/documents/keyed-slot.d.ts +139 -0
- package/dist/documents/keyed-slot.d.ts.map +1 -0
- package/dist/documents/keyed-slot.js +478 -0
- package/dist/documents/keyed-slot.js.map +1 -0
- package/dist/documents/line.d.ts +7 -0
- package/dist/documents/line.d.ts.map +1 -0
- package/dist/documents/line.js +14 -0
- package/dist/documents/line.js.map +1 -0
- package/dist/documents/persistence.d.ts +120 -0
- package/dist/documents/persistence.d.ts.map +1 -0
- package/dist/documents/persistence.js +156 -0
- package/dist/documents/persistence.js.map +1 -0
- package/dist/documents/residency.d.ts +31 -0
- package/dist/documents/residency.d.ts.map +1 -0
- package/dist/documents/residency.js +93 -0
- package/dist/documents/residency.js.map +1 -0
- package/dist/documents/slot.d.ts +112 -0
- package/dist/documents/slot.d.ts.map +1 -0
- package/dist/documents/slot.js +190 -0
- package/dist/documents/slot.js.map +1 -0
- package/dist/documents/transaction.d.ts +143 -0
- package/dist/documents/transaction.d.ts.map +1 -0
- package/dist/documents/transaction.js +445 -0
- package/dist/documents/transaction.js.map +1 -0
- package/dist/host/activity.d.ts +31 -0
- package/dist/host/activity.d.ts.map +1 -0
- package/dist/host/activity.js +40 -0
- package/dist/host/activity.js.map +1 -0
- package/dist/host/adapted.d.ts +63 -0
- package/dist/host/adapted.d.ts.map +1 -0
- package/dist/host/adapted.js +298 -0
- package/dist/host/adapted.js.map +1 -0
- package/dist/host/admission.d.ts +137 -0
- package/dist/host/admission.d.ts.map +1 -0
- package/dist/host/admission.js +290 -0
- package/dist/host/admission.js.map +1 -0
- package/dist/host/attempt.d.ts +417 -0
- package/dist/host/attempt.d.ts.map +1 -0
- package/dist/host/attempt.js +1490 -0
- package/dist/host/attempt.js.map +1 -0
- package/dist/host/backoff.d.ts +29 -0
- package/dist/host/backoff.d.ts.map +1 -0
- package/dist/host/backoff.js +69 -0
- package/dist/host/backoff.js.map +1 -0
- package/dist/host/ctx.d.ts +94 -0
- package/dist/host/ctx.d.ts.map +1 -0
- package/dist/host/ctx.js +200 -0
- package/dist/host/ctx.js.map +1 -0
- package/dist/host/deadline.d.ts +12 -0
- package/dist/host/deadline.d.ts.map +1 -0
- package/dist/host/deadline.js +40 -0
- package/dist/host/deadline.js.map +1 -0
- package/dist/host/dependencies.d.ts +97 -0
- package/dist/host/dependencies.d.ts.map +1 -0
- package/dist/host/dependencies.js +148 -0
- package/dist/host/dependencies.js.map +1 -0
- package/dist/host/destination.d.ts +48 -0
- package/dist/host/destination.d.ts.map +1 -0
- package/dist/host/destination.js +101 -0
- package/dist/host/destination.js.map +1 -0
- package/dist/host/events.d.ts +114 -0
- package/dist/host/events.d.ts.map +1 -0
- package/dist/host/events.js +191 -0
- package/dist/host/events.js.map +1 -0
- package/dist/host/facet.d.ts +106 -0
- package/dist/host/facet.d.ts.map +1 -0
- package/dist/host/facet.js +55 -0
- package/dist/host/facet.js.map +1 -0
- package/dist/host/follow.d.ts +52 -0
- package/dist/host/follow.d.ts.map +1 -0
- package/dist/host/follow.js +207 -0
- package/dist/host/follow.js.map +1 -0
- package/dist/host/host-data.d.ts +62 -0
- package/dist/host/host-data.d.ts.map +1 -0
- package/dist/host/host-data.js +229 -0
- package/dist/host/host-data.js.map +1 -0
- package/dist/host/host.d.ts +641 -0
- package/dist/host/host.d.ts.map +1 -0
- package/dist/host/host.js +1449 -0
- package/dist/host/host.js.map +1 -0
- package/dist/host/index.d.ts +20 -0
- package/dist/host/index.d.ts.map +1 -0
- package/dist/host/index.js +7 -0
- package/dist/host/index.js.map +1 -0
- package/dist/host/internal.d.ts +13 -0
- package/dist/host/internal.d.ts.map +1 -0
- package/dist/host/internal.js +11 -0
- package/dist/host/internal.js.map +1 -0
- package/dist/host/list.d.ts +52 -0
- package/dist/host/list.d.ts.map +1 -0
- package/dist/host/list.js +149 -0
- package/dist/host/list.js.map +1 -0
- package/dist/host/members.d.ts +58 -0
- package/dist/host/members.d.ts.map +1 -0
- package/dist/host/members.js +178 -0
- package/dist/host/members.js.map +1 -0
- package/dist/host/named-query.d.ts +67 -0
- package/dist/host/named-query.d.ts.map +1 -0
- package/dist/host/named-query.js +166 -0
- package/dist/host/named-query.js.map +1 -0
- package/dist/host/native.d.ts +64 -0
- package/dist/host/native.d.ts.map +1 -0
- package/dist/host/native.js +126 -0
- package/dist/host/native.js.map +1 -0
- package/dist/host/object.d.ts +388 -0
- package/dist/host/object.d.ts.map +1 -0
- package/dist/host/object.js +1527 -0
- package/dist/host/object.js.map +1 -0
- package/dist/host/old-work.d.ts +34 -0
- package/dist/host/old-work.d.ts.map +1 -0
- package/dist/host/old-work.js +52 -0
- package/dist/host/old-work.js.map +1 -0
- package/dist/host/parked.d.ts +23 -0
- package/dist/host/parked.d.ts.map +1 -0
- package/dist/host/parked.js +79 -0
- package/dist/host/parked.js.map +1 -0
- package/dist/host/presence.d.ts +34 -0
- package/dist/host/presence.d.ts.map +1 -0
- package/dist/host/presence.js +117 -0
- package/dist/host/presence.js.map +1 -0
- package/dist/host/query-reader.d.ts +80 -0
- package/dist/host/query-reader.d.ts.map +1 -0
- package/dist/host/query-reader.js +182 -0
- package/dist/host/query-reader.js.map +1 -0
- package/dist/host/read-declarations.d.ts +75 -0
- package/dist/host/read-declarations.d.ts.map +1 -0
- package/dist/host/read-declarations.js +152 -0
- package/dist/host/read-declarations.js.map +1 -0
- package/dist/host/readiness.d.ts +27 -0
- package/dist/host/readiness.d.ts.map +1 -0
- package/dist/host/readiness.js +134 -0
- package/dist/host/readiness.js.map +1 -0
- package/dist/host/ref-state.d.ts +53 -0
- package/dist/host/ref-state.d.ts.map +1 -0
- package/dist/host/ref-state.js +83 -0
- package/dist/host/ref-state.js.map +1 -0
- package/dist/host/reference-events.d.ts +51 -0
- package/dist/host/reference-events.d.ts.map +1 -0
- package/dist/host/reference-events.js +133 -0
- package/dist/host/reference-events.js.map +1 -0
- package/dist/host/reference-keys.d.ts +36 -0
- package/dist/host/reference-keys.d.ts.map +1 -0
- package/dist/host/reference-keys.js +168 -0
- package/dist/host/reference-keys.js.map +1 -0
- package/dist/host/reference-source.d.ts +77 -0
- package/dist/host/reference-source.d.ts.map +1 -0
- package/dist/host/reference-source.js +326 -0
- package/dist/host/reference-source.js.map +1 -0
- package/dist/host/reference.d.ts +377 -0
- package/dist/host/reference.d.ts.map +1 -0
- package/dist/host/reference.js +986 -0
- package/dist/host/reference.js.map +1 -0
- package/dist/host/reload-cycle.d.ts +16 -0
- package/dist/host/reload-cycle.d.ts.map +1 -0
- package/dist/host/reload-cycle.js +81 -0
- package/dist/host/reload-cycle.js.map +1 -0
- package/dist/host/retry-on.d.ts +28 -0
- package/dist/host/retry-on.d.ts.map +1 -0
- package/dist/host/retry-on.js +52 -0
- package/dist/host/retry-on.js.map +1 -0
- package/dist/host/revocation.d.ts +16 -0
- package/dist/host/revocation.d.ts.map +1 -0
- package/dist/host/revocation.js +27 -0
- package/dist/host/revocation.js.map +1 -0
- package/dist/host/root.d.ts +37 -0
- package/dist/host/root.d.ts.map +1 -0
- package/dist/host/root.js +68 -0
- package/dist/host/root.js.map +1 -0
- package/dist/host/route-admission.d.ts +24 -0
- package/dist/host/route-admission.d.ts.map +1 -0
- package/dist/host/route-admission.js +238 -0
- package/dist/host/route-admission.js.map +1 -0
- package/dist/host/route.d.ts +88 -0
- package/dist/host/route.d.ts.map +1 -0
- package/dist/host/route.js +247 -0
- package/dist/host/route.js.map +1 -0
- package/dist/host/routines.d.ts +78 -0
- package/dist/host/routines.d.ts.map +1 -0
- package/dist/host/routines.js +398 -0
- package/dist/host/routines.js.map +1 -0
- package/dist/host/sleep.d.ts +9 -0
- package/dist/host/sleep.d.ts.map +1 -0
- package/dist/host/sleep.js +40 -0
- package/dist/host/sleep.js.map +1 -0
- package/dist/host/staging.d.ts +100 -0
- package/dist/host/staging.d.ts.map +1 -0
- package/dist/host/staging.js +413 -0
- package/dist/host/staging.js.map +1 -0
- package/dist/host/tiling.d.ts +57 -0
- package/dist/host/tiling.d.ts.map +1 -0
- package/dist/host/tiling.js +269 -0
- package/dist/host/tiling.js.map +1 -0
- package/dist/host/unbound-clock.d.ts +23 -0
- package/dist/host/unbound-clock.d.ts.map +1 -0
- package/dist/host/unbound-clock.js +58 -0
- package/dist/host/unbound-clock.js.map +1 -0
- package/dist/host/unbound.d.ts +37 -0
- package/dist/host/unbound.d.ts.map +1 -0
- package/dist/host/unbound.js +88 -0
- package/dist/host/unbound.js.map +1 -0
- package/dist/host/uuid.d.ts +3 -0
- package/dist/host/uuid.d.ts.map +1 -0
- package/dist/host/uuid.js +38 -0
- package/dist/host/uuid.js.map +1 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/jobs/definition.d.ts +96 -0
- package/dist/jobs/definition.d.ts.map +1 -0
- package/dist/jobs/definition.js +83 -0
- package/dist/jobs/definition.js.map +1 -0
- package/dist/jobs/index.d.ts +5 -0
- package/dist/jobs/index.d.ts.map +1 -0
- package/dist/jobs/index.js +3 -0
- package/dist/jobs/index.js.map +1 -0
- package/dist/jobs/internal.d.ts +3 -0
- package/dist/jobs/internal.d.ts.map +1 -0
- package/dist/jobs/internal.js +4 -0
- package/dist/jobs/internal.js.map +1 -0
- package/dist/jobs/job.d.ts +149 -0
- package/dist/jobs/job.d.ts.map +1 -0
- package/dist/jobs/job.js +387 -0
- package/dist/jobs/job.js.map +1 -0
- package/dist/jobs/persisted.d.ts +38 -0
- package/dist/jobs/persisted.d.ts.map +1 -0
- package/dist/jobs/persisted.js +95 -0
- package/dist/jobs/persisted.js.map +1 -0
- package/dist/jobs/records.d.ts +231 -0
- package/dist/jobs/records.d.ts.map +1 -0
- package/dist/jobs/records.js +871 -0
- package/dist/jobs/records.js.map +1 -0
- package/dist/jobs/run-states.d.ts +69 -0
- package/dist/jobs/run-states.d.ts.map +1 -0
- package/dist/jobs/run-states.js +228 -0
- package/dist/jobs/run-states.js.map +1 -0
- package/dist/jobs/run.d.ts +117 -0
- package/dist/jobs/run.d.ts.map +1 -0
- package/dist/jobs/run.js +204 -0
- package/dist/jobs/run.js.map +1 -0
- package/dist/jobs/running.d.ts +44 -0
- package/dist/jobs/running.d.ts.map +1 -0
- package/dist/jobs/running.js +117 -0
- package/dist/jobs/running.js.map +1 -0
- package/dist/jobs/stored.d.ts +63 -0
- package/dist/jobs/stored.d.ts.map +1 -0
- package/dist/jobs/stored.js +55 -0
- package/dist/jobs/stored.js.map +1 -0
- package/dist/json.d.ts +18 -0
- package/dist/json.d.ts.map +1 -0
- package/dist/json.js +124 -0
- package/dist/json.js.map +1 -0
- package/dist/link/binary.d.ts +4 -0
- package/dist/link/binary.d.ts.map +1 -0
- package/dist/link/binary.js +574 -0
- package/dist/link/binary.js.map +1 -0
- package/dist/link/channel.d.ts +78 -0
- package/dist/link/channel.d.ts.map +1 -0
- package/dist/link/channel.js +252 -0
- package/dist/link/channel.js.map +1 -0
- package/dist/link/errors.d.ts +7 -0
- package/dist/link/errors.d.ts.map +1 -0
- package/dist/link/errors.js +21 -0
- package/dist/link/errors.js.map +1 -0
- package/dist/link/index.d.ts +8 -0
- package/dist/link/index.d.ts.map +1 -0
- package/dist/link/index.js +8 -0
- package/dist/link/index.js.map +1 -0
- package/dist/link/internal.d.ts +9 -0
- package/dist/link/internal.d.ts.map +1 -0
- package/dist/link/internal.js +10 -0
- package/dist/link/internal.js.map +1 -0
- package/dist/link/ipc.d.ts +22 -0
- package/dist/link/ipc.d.ts.map +1 -0
- package/dist/link/ipc.js +64 -0
- package/dist/link/ipc.js.map +1 -0
- package/dist/link/link.d.ts +34 -0
- package/dist/link/link.d.ts.map +1 -0
- package/dist/link/link.js +87 -0
- package/dist/link/link.js.map +1 -0
- package/dist/link/message.d.ts +278 -0
- package/dist/link/message.d.ts.map +1 -0
- package/dist/link/message.js +179 -0
- package/dist/link/message.js.map +1 -0
- package/dist/link/part.d.ts +80 -0
- package/dist/link/part.d.ts.map +1 -0
- package/dist/link/part.js +165 -0
- package/dist/link/part.js.map +1 -0
- package/dist/link/text.d.ts +6 -0
- package/dist/link/text.d.ts.map +1 -0
- package/dist/link/text.js +383 -0
- package/dist/link/text.js.map +1 -0
- package/dist/link/values.d.ts +40 -0
- package/dist/link/values.d.ts.map +1 -0
- package/dist/link/values.js +121 -0
- package/dist/link/values.js.map +1 -0
- package/dist/link/websocket.d.ts +26 -0
- package/dist/link/websocket.d.ts.map +1 -0
- package/dist/link/websocket.js +91 -0
- package/dist/link/websocket.js.map +1 -0
- package/dist/node/app/app.d.ts +283 -0
- package/dist/node/app/app.d.ts.map +1 -0
- package/dist/node/app/app.js +598 -0
- package/dist/node/app/app.js.map +1 -0
- package/dist/node/app/archive.d.ts +44 -0
- package/dist/node/app/archive.d.ts.map +1 -0
- package/dist/node/app/archive.js +212 -0
- package/dist/node/app/archive.js.map +1 -0
- package/dist/node/app/blobs.d.ts +23 -0
- package/dist/node/app/blobs.d.ts.map +1 -0
- package/dist/node/app/blobs.js +64 -0
- package/dist/node/app/blobs.js.map +1 -0
- package/dist/node/app/data.d.ts +40 -0
- package/dist/node/app/data.d.ts.map +1 -0
- package/dist/node/app/data.js +47 -0
- package/dist/node/app/data.js.map +1 -0
- package/dist/node/app/ephemeral-sign-ins.d.ts +20 -0
- package/dist/node/app/ephemeral-sign-ins.d.ts.map +1 -0
- package/dist/node/app/ephemeral-sign-ins.js +69 -0
- package/dist/node/app/ephemeral-sign-ins.js.map +1 -0
- package/dist/node/app/ephemeral.d.ts +11 -0
- package/dist/node/app/ephemeral.d.ts.map +1 -0
- package/dist/node/app/ephemeral.js +34 -0
- package/dist/node/app/ephemeral.js.map +1 -0
- package/dist/node/app/files-copy.d.ts +13 -0
- package/dist/node/app/files-copy.d.ts.map +1 -0
- package/dist/node/app/files-copy.js +86 -0
- package/dist/node/app/files-copy.js.map +1 -0
- package/dist/node/app/files-entry.d.ts +4 -0
- package/dist/node/app/files-entry.d.ts.map +1 -0
- package/dist/node/app/files-entry.js +7 -0
- package/dist/node/app/files-entry.js.map +1 -0
- package/dist/node/app/files-index.d.ts +180 -0
- package/dist/node/app/files-index.d.ts.map +1 -0
- package/dist/node/app/files-index.js +535 -0
- package/dist/node/app/files-index.js.map +1 -0
- package/dist/node/app/files.d.ts +388 -0
- package/dist/node/app/files.d.ts.map +1 -0
- package/dist/node/app/files.js +368 -0
- package/dist/node/app/files.js.map +1 -0
- package/dist/node/app/folder-views.d.ts +21 -0
- package/dist/node/app/folder-views.d.ts.map +1 -0
- package/dist/node/app/folder-views.js +55 -0
- package/dist/node/app/folder-views.js.map +1 -0
- package/dist/node/app/index.d.ts +12 -0
- package/dist/node/app/index.d.ts.map +1 -0
- package/dist/node/app/index.js +15 -0
- package/dist/node/app/index.js.map +1 -0
- package/dist/node/app/info.d.ts +70 -0
- package/dist/node/app/info.d.ts.map +1 -0
- package/dist/node/app/info.js +37 -0
- package/dist/node/app/info.js.map +1 -0
- package/dist/node/app/invite.d.ts +5 -0
- package/dist/node/app/invite.d.ts.map +1 -0
- package/dist/node/app/invite.js +64 -0
- package/dist/node/app/invite.js.map +1 -0
- package/dist/node/app/layout.d.ts +36 -0
- package/dist/node/app/layout.d.ts.map +1 -0
- package/dist/node/app/layout.js +87 -0
- package/dist/node/app/layout.js.map +1 -0
- package/dist/node/app/owner.d.ts +31 -0
- package/dist/node/app/owner.d.ts.map +1 -0
- package/dist/node/app/owner.js +104 -0
- package/dist/node/app/owner.js.map +1 -0
- package/dist/node/app/pairing.d.ts +55 -0
- package/dist/node/app/pairing.d.ts.map +1 -0
- package/dist/node/app/pairing.js +183 -0
- package/dist/node/app/pairing.js.map +1 -0
- package/dist/node/app/secrets.d.ts +16 -0
- package/dist/node/app/secrets.d.ts.map +1 -0
- package/dist/node/app/secrets.js +72 -0
- package/dist/node/app/secrets.js.map +1 -0
- package/dist/node/app/sign-ins.d.ts +74 -0
- package/dist/node/app/sign-ins.d.ts.map +1 -0
- package/dist/node/app/sign-ins.js +222 -0
- package/dist/node/app/sign-ins.js.map +1 -0
- package/dist/node/app/tar.d.ts +24 -0
- package/dist/node/app/tar.d.ts.map +1 -0
- package/dist/node/app/tar.js +167 -0
- package/dist/node/app/tar.js.map +1 -0
- package/dist/node/app/uploads.d.ts +37 -0
- package/dist/node/app/uploads.d.ts.map +1 -0
- package/dist/node/app/uploads.js +157 -0
- package/dist/node/app/uploads.js.map +1 -0
- package/dist/node/app/users.d.ts +39 -0
- package/dist/node/app/users.d.ts.map +1 -0
- package/dist/node/app/users.js +62 -0
- package/dist/node/app/users.js.map +1 -0
- package/dist/node/app/worker.d.ts +18 -0
- package/dist/node/app/worker.d.ts.map +1 -0
- package/dist/node/app/worker.js +84 -0
- package/dist/node/app/worker.js.map +1 -0
- package/dist/node/compression.d.ts +7 -0
- package/dist/node/compression.d.ts.map +1 -0
- package/dist/node/compression.js +25 -0
- package/dist/node/compression.js.map +1 -0
- package/dist/node/http/admission.d.ts +64 -0
- package/dist/node/http/admission.d.ts.map +1 -0
- package/dist/node/http/admission.js +137 -0
- package/dist/node/http/admission.js.map +1 -0
- package/dist/node/http/authenticate.d.ts +21 -0
- package/dist/node/http/authenticate.d.ts.map +1 -0
- package/dist/node/http/authenticate.js +34 -0
- package/dist/node/http/authenticate.js.map +1 -0
- package/dist/node/http/cookies.d.ts +32 -0
- package/dist/node/http/cookies.d.ts.map +1 -0
- package/dist/node/http/cookies.js +70 -0
- package/dist/node/http/cookies.js.map +1 -0
- package/dist/node/http/file.d.ts +23 -0
- package/dist/node/http/file.d.ts.map +1 -0
- package/dist/node/http/file.js +94 -0
- package/dist/node/http/file.js.map +1 -0
- package/dist/node/http/headers.d.ts +37 -0
- package/dist/node/http/headers.d.ts.map +1 -0
- package/dist/node/http/headers.js +136 -0
- package/dist/node/http/headers.js.map +1 -0
- package/dist/node/http/http.d.ts +114 -0
- package/dist/node/http/http.d.ts.map +1 -0
- package/dist/node/http/http.js +524 -0
- package/dist/node/http/http.js.map +1 -0
- package/dist/node/http/incoming.d.ts +19 -0
- package/dist/node/http/incoming.d.ts.map +1 -0
- package/dist/node/http/incoming.js +31 -0
- package/dist/node/http/incoming.js.map +1 -0
- package/dist/node/http/index.d.ts +11 -0
- package/dist/node/http/index.d.ts.map +1 -0
- package/dist/node/http/index.js +12 -0
- package/dist/node/http/index.js.map +1 -0
- package/dist/node/http/node.d.ts +78 -0
- package/dist/node/http/node.d.ts.map +1 -0
- package/dist/node/http/node.js +291 -0
- package/dist/node/http/node.js.map +1 -0
- package/dist/node/http/request.d.ts +60 -0
- package/dist/node/http/request.d.ts.map +1 -0
- package/dist/node/http/request.js +118 -0
- package/dist/node/http/request.js.map +1 -0
- package/dist/node/http/response.d.ts +63 -0
- package/dist/node/http/response.d.ts.map +1 -0
- package/dist/node/http/response.js +202 -0
- package/dist/node/http/response.js.map +1 -0
- package/dist/node/http/router.d.ts +132 -0
- package/dist/node/http/router.d.ts.map +1 -0
- package/dist/node/http/router.js +267 -0
- package/dist/node/http/router.js.map +1 -0
- package/dist/node/http/upgrades.d.ts +62 -0
- package/dist/node/http/upgrades.d.ts.map +1 -0
- package/dist/node/http/upgrades.js +194 -0
- package/dist/node/http/upgrades.js.map +1 -0
- package/dist/node/plugins/base-inputs.d.ts +14 -0
- package/dist/node/plugins/base-inputs.d.ts.map +1 -0
- package/dist/node/plugins/base-inputs.js +33 -0
- package/dist/node/plugins/base-inputs.js.map +1 -0
- package/dist/node/plugins/build.d.ts +77 -0
- package/dist/node/plugins/build.d.ts.map +1 -0
- package/dist/node/plugins/build.js +577 -0
- package/dist/node/plugins/build.js.map +1 -0
- package/dist/node/plugins/css-modules.d.ts +13 -0
- package/dist/node/plugins/css-modules.d.ts.map +1 -0
- package/dist/node/plugins/css-modules.js +58 -0
- package/dist/node/plugins/css-modules.js.map +1 -0
- package/dist/node/plugins/discover.d.ts +67 -0
- package/dist/node/plugins/discover.d.ts.map +1 -0
- package/dist/node/plugins/discover.js +369 -0
- package/dist/node/plugins/discover.js.map +1 -0
- package/dist/node/plugins/evaluate.d.ts +33 -0
- package/dist/node/plugins/evaluate.d.ts.map +1 -0
- package/dist/node/plugins/evaluate.js +121 -0
- package/dist/node/plugins/evaluate.js.map +1 -0
- package/dist/node/plugins/index.d.ts +11 -0
- package/dist/node/plugins/index.d.ts.map +1 -0
- package/dist/node/plugins/index.js +13 -0
- package/dist/node/plugins/index.js.map +1 -0
- package/dist/node/plugins/install.d.ts +40 -0
- package/dist/node/plugins/install.d.ts.map +1 -0
- package/dist/node/plugins/install.js +215 -0
- package/dist/node/plugins/install.js.map +1 -0
- package/dist/node/plugins/plugins.d.ts +165 -0
- package/dist/node/plugins/plugins.d.ts.map +1 -0
- package/dist/node/plugins/plugins.js +268 -0
- package/dist/node/plugins/plugins.js.map +1 -0
- package/dist/node/plugins/runtime.d.ts +57 -0
- package/dist/node/plugins/runtime.d.ts.map +1 -0
- package/dist/node/plugins/runtime.js +92 -0
- package/dist/node/plugins/runtime.js.map +1 -0
- package/dist/node/plugins/stack.d.ts +16 -0
- package/dist/node/plugins/stack.d.ts.map +1 -0
- package/dist/node/plugins/stack.js +70 -0
- package/dist/node/plugins/stack.js.map +1 -0
- package/dist/node/plugins/testing.d.ts +58 -0
- package/dist/node/plugins/testing.d.ts.map +1 -0
- package/dist/node/plugins/testing.js +210 -0
- package/dist/node/plugins/testing.js.map +1 -0
- package/dist/node/plugins/watcher.d.ts +69 -0
- package/dist/node/plugins/watcher.d.ts.map +1 -0
- package/dist/node/plugins/watcher.js +622 -0
- package/dist/node/plugins/watcher.js.map +1 -0
- package/dist/node/surfaces/bundle.d.ts +40 -0
- package/dist/node/surfaces/bundle.d.ts.map +1 -0
- package/dist/node/surfaces/bundle.js +121 -0
- package/dist/node/surfaces/bundle.js.map +1 -0
- package/dist/node/surfaces/current.d.ts +17 -0
- package/dist/node/surfaces/current.d.ts.map +1 -0
- package/dist/node/surfaces/current.js +54 -0
- package/dist/node/surfaces/current.js.map +1 -0
- package/dist/node/surfaces/index.d.ts +6 -0
- package/dist/node/surfaces/index.d.ts.map +1 -0
- package/dist/node/surfaces/index.js +6 -0
- package/dist/node/surfaces/index.js.map +1 -0
- package/dist/node/surfaces/published.d.ts +27 -0
- package/dist/node/surfaces/published.d.ts.map +1 -0
- package/dist/node/surfaces/published.js +142 -0
- package/dist/node/surfaces/published.js.map +1 -0
- package/dist/node/surfaces/served.d.ts +17 -0
- package/dist/node/surfaces/served.d.ts.map +1 -0
- package/dist/node/surfaces/served.js +44 -0
- package/dist/node/surfaces/served.js.map +1 -0
- package/dist/node/surfaces/surface-build.d.ts +53 -0
- package/dist/node/surfaces/surface-build.d.ts.map +1 -0
- package/dist/node/surfaces/surface-build.js +105 -0
- package/dist/node/surfaces/surface-build.js.map +1 -0
- package/dist/node/surfaces/tui.d.ts +42 -0
- package/dist/node/surfaces/tui.d.ts.map +1 -0
- package/dist/node/surfaces/tui.js +59 -0
- package/dist/node/surfaces/tui.js.map +1 -0
- package/dist/node/surfaces/web.d.ts +82 -0
- package/dist/node/surfaces/web.d.ts.map +1 -0
- package/dist/node/surfaces/web.js +122 -0
- package/dist/node/surfaces/web.js.map +1 -0
- package/dist/node/tui/actions.d.ts +49 -0
- package/dist/node/tui/actions.d.ts.map +1 -0
- package/dist/node/tui/actions.js +195 -0
- package/dist/node/tui/actions.js.map +1 -0
- package/dist/node/tui/credentials.d.ts +17 -0
- package/dist/node/tui/credentials.d.ts.map +1 -0
- package/dist/node/tui/credentials.js +54 -0
- package/dist/node/tui/credentials.js.map +1 -0
- package/dist/node/tui/filter.d.ts +5 -0
- package/dist/node/tui/filter.d.ts.map +1 -0
- package/dist/node/tui/filter.js +79 -0
- package/dist/node/tui/filter.js.map +1 -0
- package/dist/node/tui/index.d.ts +6 -0
- package/dist/node/tui/index.d.ts.map +1 -0
- package/dist/node/tui/index.js +6 -0
- package/dist/node/tui/index.js.map +1 -0
- package/dist/node/tui/launcher.d.ts +40 -0
- package/dist/node/tui/launcher.d.ts.map +1 -0
- package/dist/node/tui/launcher.js +439 -0
- package/dist/node/tui/launcher.js.map +1 -0
- package/dist/node/tui/pipe.d.ts +18 -0
- package/dist/node/tui/pipe.d.ts.map +1 -0
- package/dist/node/tui/pipe.js +134 -0
- package/dist/node/tui/pipe.js.map +1 -0
- package/dist/node/tui/sandbox.d.ts +54 -0
- package/dist/node/tui/sandbox.d.ts.map +1 -0
- package/dist/node/tui/sandbox.js +431 -0
- package/dist/node/tui/sandbox.js.map +1 -0
- package/dist/node/workers/base.d.ts +30 -0
- package/dist/node/workers/base.d.ts.map +1 -0
- package/dist/node/workers/base.js +260 -0
- package/dist/node/workers/base.js.map +1 -0
- package/dist/node/workers/child.d.ts +4 -0
- package/dist/node/workers/child.d.ts.map +1 -0
- package/dist/node/workers/child.js +6 -0
- package/dist/node/workers/child.js.map +1 -0
- package/dist/node/workers/control.d.ts +83 -0
- package/dist/node/workers/control.d.ts.map +1 -0
- package/dist/node/workers/control.js +77 -0
- package/dist/node/workers/control.js.map +1 -0
- package/dist/node/workers/index.d.ts +4 -0
- package/dist/node/workers/index.d.ts.map +1 -0
- package/dist/node/workers/index.js +7 -0
- package/dist/node/workers/index.js.map +1 -0
- package/dist/node/workers/lock.d.ts +30 -0
- package/dist/node/workers/lock.d.ts.map +1 -0
- package/dist/node/workers/lock.js +180 -0
- package/dist/node/workers/lock.js.map +1 -0
- package/dist/node/workers/main.d.ts +46 -0
- package/dist/node/workers/main.d.ts.map +1 -0
- package/dist/node/workers/main.js +230 -0
- package/dist/node/workers/main.js.map +1 -0
- package/dist/node/workers/process.d.ts +43 -0
- package/dist/node/workers/process.d.ts.map +1 -0
- package/dist/node/workers/process.js +137 -0
- package/dist/node/workers/process.js.map +1 -0
- package/dist/node/workers/workers.d.ts +144 -0
- package/dist/node/workers/workers.d.ts.map +1 -0
- package/dist/node/workers/workers.js +723 -0
- package/dist/node/workers/workers.js.map +1 -0
- package/dist/output.d.ts +91 -0
- package/dist/output.d.ts.map +1 -0
- package/dist/output.js +362 -0
- package/dist/output.js.map +1 -0
- package/dist/react/hooks.d.ts +61 -0
- package/dist/react/hooks.d.ts.map +1 -0
- package/dist/react/hooks.js +119 -0
- package/dist/react/hooks.js.map +1 -0
- package/dist/react/index.d.ts +4 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +4 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/stores.d.ts +9 -0
- package/dist/react/stores.d.ts.map +1 -0
- package/dist/react/stores.js +37 -0
- package/dist/react/stores.js.map +1 -0
- package/dist/registries/contribution.d.ts +50 -0
- package/dist/registries/contribution.d.ts.map +1 -0
- package/dist/registries/contribution.js +129 -0
- package/dist/registries/contribution.js.map +1 -0
- package/dist/registries/entries.d.ts +18 -0
- package/dist/registries/entries.d.ts.map +1 -0
- package/dist/registries/entries.js +42 -0
- package/dist/registries/entries.js.map +1 -0
- package/dist/registries/index.d.ts +3 -0
- package/dist/registries/index.d.ts.map +1 -0
- package/dist/registries/index.js +5 -0
- package/dist/registries/index.js.map +1 -0
- package/dist/registries/internal.d.ts +4 -0
- package/dist/registries/internal.d.ts.map +1 -0
- package/dist/registries/internal.js +5 -0
- package/dist/registries/internal.js.map +1 -0
- package/dist/registries/record.d.ts +115 -0
- package/dist/registries/record.d.ts.map +1 -0
- package/dist/registries/record.js +283 -0
- package/dist/registries/record.js.map +1 -0
- package/dist/registries/registry.d.ts +74 -0
- package/dist/registries/registry.d.ts.map +1 -0
- package/dist/registries/registry.js +14 -0
- package/dist/registries/registry.js.map +1 -0
- package/dist/registries/value.d.ts +48 -0
- package/dist/registries/value.d.ts.map +1 -0
- package/dist/registries/value.js +224 -0
- package/dist/registries/value.js.map +1 -0
- package/dist/remote/calls.d.ts +34 -0
- package/dist/remote/calls.d.ts.map +1 -0
- package/dist/remote/calls.js +75 -0
- package/dist/remote/calls.js.map +1 -0
- package/dist/remote/consumer.d.ts +59 -0
- package/dist/remote/consumer.d.ts.map +1 -0
- package/dist/remote/consumer.js +468 -0
- package/dist/remote/consumer.js.map +1 -0
- package/dist/remote/hold.d.ts +147 -0
- package/dist/remote/hold.d.ts.map +1 -0
- package/dist/remote/hold.js +653 -0
- package/dist/remote/hold.js.map +1 -0
- package/dist/remote/host-link.d.ts +81 -0
- package/dist/remote/host-link.d.ts.map +1 -0
- package/dist/remote/host-link.js +198 -0
- package/dist/remote/host-link.js.map +1 -0
- package/dist/remote/internal.d.ts +6 -0
- package/dist/remote/internal.d.ts.map +1 -0
- package/dist/remote/internal.js +6 -0
- package/dist/remote/internal.js.map +1 -0
- package/dist/remote/path.d.ts +105 -0
- package/dist/remote/path.d.ts.map +1 -0
- package/dist/remote/path.js +197 -0
- package/dist/remote/path.js.map +1 -0
- package/dist/remote/provider.d.ts +113 -0
- package/dist/remote/provider.d.ts.map +1 -0
- package/dist/remote/provider.js +787 -0
- package/dist/remote/provider.js.map +1 -0
- package/dist/remote/relay.d.ts +126 -0
- package/dist/remote/relay.d.ts.map +1 -0
- package/dist/remote/relay.js +334 -0
- package/dist/remote/relay.js.map +1 -0
- package/dist/remote/remote-object.d.ts +181 -0
- package/dist/remote/remote-object.d.ts.map +1 -0
- package/dist/remote/remote-object.js +683 -0
- package/dist/remote/remote-object.js.map +1 -0
- package/dist/remote/replica.d.ts +66 -0
- package/dist/remote/replica.d.ts.map +1 -0
- package/dist/remote/replica.js +148 -0
- package/dist/remote/replica.js.map +1 -0
- package/dist/sqlite/cloudflare.d.ts +54 -0
- package/dist/sqlite/cloudflare.d.ts.map +1 -0
- package/dist/sqlite/cloudflare.js +144 -0
- package/dist/sqlite/cloudflare.js.map +1 -0
- package/dist/sqlite/database.d.ts +40 -0
- package/dist/sqlite/database.d.ts.map +1 -0
- package/dist/sqlite/database.js +2 -0
- package/dist/sqlite/database.js.map +1 -0
- package/dist/sqlite/index.d.ts +4 -0
- package/dist/sqlite/index.d.ts.map +1 -0
- package/dist/sqlite/index.js +3 -0
- package/dist/sqlite/index.js.map +1 -0
- package/dist/sqlite/migrations.d.ts +10 -0
- package/dist/sqlite/migrations.d.ts.map +1 -0
- package/dist/sqlite/migrations.js +33 -0
- package/dist/sqlite/migrations.js.map +1 -0
- package/dist/sqlite/node.d.ts +49 -0
- package/dist/sqlite/node.d.ts.map +1 -0
- package/dist/sqlite/node.js +197 -0
- package/dist/sqlite/node.js.map +1 -0
- package/dist/sqlite/schema.d.ts +3 -0
- package/dist/sqlite/schema.d.ts.map +1 -0
- package/dist/sqlite/schema.js +10 -0
- package/dist/sqlite/schema.js.map +1 -0
- package/dist/state/batch.d.ts +64 -0
- package/dist/state/batch.d.ts.map +1 -0
- package/dist/state/batch.js +164 -0
- package/dist/state/batch.js.map +1 -0
- package/dist/state/derive.d.ts +56 -0
- package/dist/state/derive.d.ts.map +1 -0
- package/dist/state/derive.js +192 -0
- package/dist/state/derive.js.map +1 -0
- package/dist/state/framed.d.ts +43 -0
- package/dist/state/framed.d.ts.map +1 -0
- package/dist/state/framed.js +121 -0
- package/dist/state/framed.js.map +1 -0
- package/dist/state/index.d.ts +6 -0
- package/dist/state/index.d.ts.map +1 -0
- package/dist/state/index.js +4 -0
- package/dist/state/index.js.map +1 -0
- package/dist/state/internal.d.ts +7 -0
- package/dist/state/internal.d.ts.map +1 -0
- package/dist/state/internal.js +9 -0
- package/dist/state/internal.js.map +1 -0
- package/dist/state/native-source.d.ts +106 -0
- package/dist/state/native-source.d.ts.map +1 -0
- package/dist/state/native-source.js +240 -0
- package/dist/state/native-source.js.map +1 -0
- package/dist/state/watchable.d.ts +114 -0
- package/dist/state/watchable.d.ts.map +1 -0
- package/dist/state/watchable.js +156 -0
- package/dist/state/watchable.js.map +1 -0
- package/dist/state/writable.d.ts +32 -0
- package/dist/state/writable.d.ts.map +1 -0
- package/dist/state/writable.js +49 -0
- package/dist/state/writable.js.map +1 -0
- package/dist/store/adapter.d.ts +67 -0
- package/dist/store/adapter.d.ts.map +1 -0
- package/dist/store/adapter.js +118 -0
- package/dist/store/adapter.js.map +1 -0
- package/dist/store/allocator.d.ts +17 -0
- package/dist/store/allocator.d.ts.map +1 -0
- package/dist/store/allocator.js +30 -0
- package/dist/store/allocator.js.map +1 -0
- package/dist/store/applier.d.ts +8 -0
- package/dist/store/applier.d.ts.map +1 -0
- package/dist/store/applier.js +390 -0
- package/dist/store/applier.js.map +1 -0
- package/dist/store/apply-batch.d.ts +12 -0
- package/dist/store/apply-batch.d.ts.map +1 -0
- package/dist/store/apply-batch.js +83 -0
- package/dist/store/apply-batch.js.map +1 -0
- package/dist/store/archive.d.ts +36 -0
- package/dist/store/archive.d.ts.map +1 -0
- package/dist/store/archive.js +140 -0
- package/dist/store/archive.js.map +1 -0
- package/dist/store/backend.d.ts +10 -0
- package/dist/store/backend.d.ts.map +1 -0
- package/dist/store/backend.js +15 -0
- package/dist/store/backend.js.map +1 -0
- package/dist/store/catalog.d.ts +24 -0
- package/dist/store/catalog.d.ts.map +1 -0
- package/dist/store/catalog.js +17 -0
- package/dist/store/catalog.js.map +1 -0
- package/dist/store/claims.d.ts +23 -0
- package/dist/store/claims.d.ts.map +1 -0
- package/dist/store/claims.js +65 -0
- package/dist/store/claims.js.map +1 -0
- package/dist/store/column-set.d.ts +64 -0
- package/dist/store/column-set.d.ts.map +1 -0
- package/dist/store/column-set.js +96 -0
- package/dist/store/column-set.js.map +1 -0
- package/dist/store/columns.d.ts +93 -0
- package/dist/store/columns.d.ts.map +1 -0
- package/dist/store/columns.js +87 -0
- package/dist/store/columns.js.map +1 -0
- package/dist/store/engine.d.ts +182 -0
- package/dist/store/engine.d.ts.map +1 -0
- package/dist/store/engine.js +290 -0
- package/dist/store/engine.js.map +1 -0
- package/dist/store/evaluate.d.ts +17 -0
- package/dist/store/evaluate.d.ts.map +1 -0
- package/dist/store/evaluate.js +131 -0
- package/dist/store/evaluate.js.map +1 -0
- package/dist/store/export.d.ts +30 -0
- package/dist/store/export.d.ts.map +1 -0
- package/dist/store/export.js +221 -0
- package/dist/store/export.js.map +1 -0
- package/dist/store/expression.d.ts +254 -0
- package/dist/store/expression.d.ts.map +1 -0
- package/dist/store/expression.js +577 -0
- package/dist/store/expression.js.map +1 -0
- package/dist/store/host-column.d.ts +22 -0
- package/dist/store/host-column.d.ts.map +1 -0
- package/dist/store/host-column.js +36 -0
- package/dist/store/host-column.js.map +1 -0
- package/dist/store/host-data.d.ts +100 -0
- package/dist/store/host-data.d.ts.map +1 -0
- package/dist/store/host-data.js +397 -0
- package/dist/store/host-data.js.map +1 -0
- package/dist/store/import-migration.d.ts +19 -0
- package/dist/store/import-migration.d.ts.map +1 -0
- package/dist/store/import-migration.js +124 -0
- package/dist/store/import-migration.js.map +1 -0
- package/dist/store/import.d.ts +12 -0
- package/dist/store/import.d.ts.map +1 -0
- package/dist/store/import.js +279 -0
- package/dist/store/import.js.map +1 -0
- package/dist/store/index.d.ts +19 -0
- package/dist/store/index.d.ts.map +1 -0
- package/dist/store/index.js +16 -0
- package/dist/store/index.js.map +1 -0
- package/dist/store/json-column.d.ts +33 -0
- package/dist/store/json-column.d.ts.map +1 -0
- package/dist/store/json-column.js +62 -0
- package/dist/store/json-column.js.map +1 -0
- package/dist/store/jsonl.d.ts +9 -0
- package/dist/store/jsonl.d.ts.map +1 -0
- package/dist/store/jsonl.js +61 -0
- package/dist/store/jsonl.js.map +1 -0
- package/dist/store/live-query.d.ts +72 -0
- package/dist/store/live-query.d.ts.map +1 -0
- package/dist/store/live-query.js +162 -0
- package/dist/store/live-query.js.map +1 -0
- package/dist/store/open-query.d.ts +90 -0
- package/dist/store/open-query.d.ts.map +1 -0
- package/dist/store/open-query.js +201 -0
- package/dist/store/open-query.js.map +1 -0
- package/dist/store/outbox.d.ts +26 -0
- package/dist/store/outbox.d.ts.map +1 -0
- package/dist/store/outbox.js +80 -0
- package/dist/store/outbox.js.map +1 -0
- package/dist/store/page.d.ts +14 -0
- package/dist/store/page.d.ts.map +1 -0
- package/dist/store/page.js +26 -0
- package/dist/store/page.js.map +1 -0
- package/dist/store/query.d.ts +65 -0
- package/dist/store/query.d.ts.map +1 -0
- package/dist/store/query.js +193 -0
- package/dist/store/query.js.map +1 -0
- package/dist/store/read-plan.d.ts +74 -0
- package/dist/store/read-plan.d.ts.map +1 -0
- package/dist/store/read-plan.js +324 -0
- package/dist/store/read-plan.js.map +1 -0
- package/dist/store/read.d.ts +81 -0
- package/dist/store/read.d.ts.map +1 -0
- package/dist/store/read.js +113 -0
- package/dist/store/read.js.map +1 -0
- package/dist/store/reads.d.ts +79 -0
- package/dist/store/reads.d.ts.map +1 -0
- package/dist/store/reads.js +255 -0
- package/dist/store/reads.js.map +1 -0
- package/dist/store/refusal.d.ts +15 -0
- package/dist/store/refusal.d.ts.map +1 -0
- package/dist/store/refusal.js +36 -0
- package/dist/store/refusal.js.map +1 -0
- package/dist/store/rows.d.ts +96 -0
- package/dist/store/rows.d.ts.map +1 -0
- package/dist/store/rows.js +222 -0
- package/dist/store/rows.js.map +1 -0
- package/dist/store/schema.d.ts +25 -0
- package/dist/store/schema.d.ts.map +1 -0
- package/dist/store/schema.js +123 -0
- package/dist/store/schema.js.map +1 -0
- package/dist/store/skip.d.ts +26 -0
- package/dist/store/skip.d.ts.map +1 -0
- package/dist/store/skip.js +66 -0
- package/dist/store/skip.js.map +1 -0
- package/dist/store/sql.d.ts +78 -0
- package/dist/store/sql.d.ts.map +1 -0
- package/dist/store/sql.js +244 -0
- package/dist/store/sql.js.map +1 -0
- package/dist/store/step.d.ts +52 -0
- package/dist/store/step.d.ts.map +1 -0
- package/dist/store/step.js +59 -0
- package/dist/store/step.js.map +1 -0
- package/dist/store/store.d.ts +192 -0
- package/dist/store/store.d.ts.map +1 -0
- package/dist/store/store.js +863 -0
- package/dist/store/store.js.map +1 -0
- package/dist/store/table-changes.d.ts +35 -0
- package/dist/store/table-changes.d.ts.map +1 -0
- package/dist/store/table-changes.js +127 -0
- package/dist/store/table-changes.js.map +1 -0
- package/dist/store/table-evolve.d.ts +82 -0
- package/dist/store/table-evolve.d.ts.map +1 -0
- package/dist/store/table-evolve.js +208 -0
- package/dist/store/table-evolve.js.map +1 -0
- package/dist/store/table-handle.d.ts +69 -0
- package/dist/store/table-handle.d.ts.map +1 -0
- package/dist/store/table-handle.js +92 -0
- package/dist/store/table-handle.js.map +1 -0
- package/dist/store/table-history.d.ts +78 -0
- package/dist/store/table-history.d.ts.map +1 -0
- package/dist/store/table-history.js +43 -0
- package/dist/store/table-history.js.map +1 -0
- package/dist/store/table-migration.d.ts +28 -0
- package/dist/store/table-migration.d.ts.map +1 -0
- package/dist/store/table-migration.js +212 -0
- package/dist/store/table-migration.js.map +1 -0
- package/dist/store/table-writes.d.ts +125 -0
- package/dist/store/table-writes.d.ts.map +1 -0
- package/dist/store/table-writes.js +170 -0
- package/dist/store/table-writes.js.map +1 -0
- package/dist/store/table.d.ts +91 -0
- package/dist/store/table.d.ts.map +1 -0
- package/dist/store/table.js +133 -0
- package/dist/store/table.js.map +1 -0
- package/dist/store/text.d.ts +14 -0
- package/dist/store/text.d.ts.map +1 -0
- package/dist/store/text.js +51 -0
- package/dist/store/text.js.map +1 -0
- package/dist/store/writes.d.ts +5 -0
- package/dist/store/writes.d.ts.map +1 -0
- package/dist/store/writes.js +4 -0
- package/dist/store/writes.js.map +1 -0
- package/dist/surfaces/active-language.d.ts +20 -0
- package/dist/surfaces/active-language.d.ts.map +1 -0
- package/dist/surfaces/active-language.js +78 -0
- package/dist/surfaces/active-language.js.map +1 -0
- package/dist/surfaces/active-theme.d.ts +16 -0
- package/dist/surfaces/active-theme.d.ts.map +1 -0
- package/dist/surfaces/active-theme.js +47 -0
- package/dist/surfaces/active-theme.js.map +1 -0
- package/dist/surfaces/client.d.ts +106 -0
- package/dist/surfaces/client.d.ts.map +1 -0
- package/dist/surfaces/client.js +280 -0
- package/dist/surfaces/client.js.map +1 -0
- package/dist/surfaces/connection.d.ts +53 -0
- package/dist/surfaces/connection.d.ts.map +1 -0
- package/dist/surfaces/connection.js +161 -0
- package/dist/surfaces/connection.js.map +1 -0
- package/dist/surfaces/format.d.ts +5 -0
- package/dist/surfaces/format.d.ts.map +1 -0
- package/dist/surfaces/format.js +37 -0
- package/dist/surfaces/format.js.map +1 -0
- package/dist/surfaces/index.d.ts +15 -0
- package/dist/surfaces/index.d.ts.map +1 -0
- package/dist/surfaces/index.js +18 -0
- package/dist/surfaces/index.js.map +1 -0
- package/dist/surfaces/language.d.ts +53 -0
- package/dist/surfaces/language.d.ts.map +1 -0
- package/dist/surfaces/language.js +74 -0
- package/dist/surfaces/language.js.map +1 -0
- package/dist/surfaces/loaded.d.ts +42 -0
- package/dist/surfaces/loaded.d.ts.map +1 -0
- package/dist/surfaces/loaded.js +116 -0
- package/dist/surfaces/loaded.js.map +1 -0
- package/dist/surfaces/locale-choice.d.ts +26 -0
- package/dist/surfaces/locale-choice.d.ts.map +1 -0
- package/dist/surfaces/locale-choice.js +14 -0
- package/dist/surfaces/locale-choice.js.map +1 -0
- package/dist/surfaces/messages.d.ts +67 -0
- package/dist/surfaces/messages.d.ts.map +1 -0
- package/dist/surfaces/messages.js +112 -0
- package/dist/surfaces/messages.js.map +1 -0
- package/dist/surfaces/page-state.d.ts +14 -0
- package/dist/surfaces/page-state.d.ts.map +1 -0
- package/dist/surfaces/page-state.js +43 -0
- package/dist/surfaces/page-state.js.map +1 -0
- package/dist/surfaces/preference.d.ts +33 -0
- package/dist/surfaces/preference.d.ts.map +1 -0
- package/dist/surfaces/preference.js +72 -0
- package/dist/surfaces/preference.js.map +1 -0
- package/dist/surfaces/registered.d.ts +33 -0
- package/dist/surfaces/registered.d.ts.map +1 -0
- package/dist/surfaces/registered.js +51 -0
- package/dist/surfaces/registered.js.map +1 -0
- package/dist/surfaces/scripts.d.ts +86 -0
- package/dist/surfaces/scripts.d.ts.map +1 -0
- package/dist/surfaces/scripts.js +28 -0
- package/dist/surfaces/scripts.js.map +1 -0
- package/dist/surfaces/theme-choice.d.ts +32 -0
- package/dist/surfaces/theme-choice.d.ts.map +1 -0
- package/dist/surfaces/theme-choice.js +18 -0
- package/dist/surfaces/theme-choice.js.map +1 -0
- package/dist/surfaces/themes.d.ts +43 -0
- package/dist/surfaces/themes.d.ts.map +1 -0
- package/dist/surfaces/themes.js +110 -0
- package/dist/surfaces/themes.js.map +1 -0
- package/dist/surfaces/translations.d.ts +29 -0
- package/dist/surfaces/translations.d.ts.map +1 -0
- package/dist/surfaces/translations.js +57 -0
- package/dist/surfaces/translations.js.map +1 -0
- package/dist/surfaces/variant.d.ts +23 -0
- package/dist/surfaces/variant.d.ts.map +1 -0
- package/dist/surfaces/variant.js +18 -0
- package/dist/surfaces/variant.js.map +1 -0
- package/dist/sync/batch.d.ts +18 -0
- package/dist/sync/batch.d.ts.map +1 -0
- package/dist/sync/batch.js +125 -0
- package/dist/sync/batch.js.map +1 -0
- package/dist/sync/client.d.ts +169 -0
- package/dist/sync/client.d.ts.map +1 -0
- package/dist/sync/client.js +459 -0
- package/dist/sync/client.js.map +1 -0
- package/dist/sync/files.d.ts +46 -0
- package/dist/sync/files.d.ts.map +1 -0
- package/dist/sync/files.js +13 -0
- package/dist/sync/files.js.map +1 -0
- package/dist/sync/filesystem.d.ts +37 -0
- package/dist/sync/filesystem.d.ts.map +1 -0
- package/dist/sync/filesystem.js +205 -0
- package/dist/sync/filesystem.js.map +1 -0
- package/dist/sync/index.d.ts +8 -0
- package/dist/sync/index.d.ts.map +1 -0
- package/dist/sync/index.js +9 -0
- package/dist/sync/index.js.map +1 -0
- package/dist/sync/lines.d.ts +18 -0
- package/dist/sync/lines.d.ts.map +1 -0
- package/dist/sync/lines.js +46 -0
- package/dist/sync/lines.js.map +1 -0
- package/dist/sync/remote.d.ts +145 -0
- package/dist/sync/remote.d.ts.map +1 -0
- package/dist/sync/remote.js +59 -0
- package/dist/sync/remote.js.map +1 -0
- package/dist/sync/state.d.ts +17 -0
- package/dist/sync/state.d.ts.map +1 -0
- package/dist/sync/state.js +40 -0
- package/dist/sync/state.js.map +1 -0
- package/dist/telemetry-ingest/batch.d.ts +73 -0
- package/dist/telemetry-ingest/batch.d.ts.map +1 -0
- package/dist/telemetry-ingest/batch.js +110 -0
- package/dist/telemetry-ingest/batch.js.map +1 -0
- package/dist/telemetry-ingest/facet.d.ts +26 -0
- package/dist/telemetry-ingest/facet.d.ts.map +1 -0
- package/dist/telemetry-ingest/facet.js +100 -0
- package/dist/telemetry-ingest/facet.js.map +1 -0
- package/dist/telemetry-ingest/index.d.ts +5 -0
- package/dist/telemetry-ingest/index.d.ts.map +1 -0
- package/dist/telemetry-ingest/index.js +8 -0
- package/dist/telemetry-ingest/index.js.map +1 -0
- package/dist/telemetry-ingest/recorder.d.ts +50 -0
- package/dist/telemetry-ingest/recorder.d.ts.map +1 -0
- package/dist/telemetry-ingest/recorder.js +298 -0
- package/dist/telemetry-ingest/recorder.js.map +1 -0
- package/dist/telemetry-ingest/sender.d.ts +14 -0
- package/dist/telemetry-ingest/sender.d.ts.map +1 -0
- package/dist/telemetry-ingest/sender.js +64 -0
- package/dist/telemetry-ingest/sender.js.map +1 -0
- package/dist/telemetry-sqlite/index.d.ts +33 -0
- package/dist/telemetry-sqlite/index.d.ts.map +1 -0
- package/dist/telemetry-sqlite/index.js +113 -0
- package/dist/telemetry-sqlite/index.js.map +1 -0
- package/dist/telemetry-sqlite/node.d.ts +13 -0
- package/dist/telemetry-sqlite/node.d.ts.map +1 -0
- package/dist/telemetry-sqlite/node.js +27 -0
- package/dist/telemetry-sqlite/node.js.map +1 -0
- package/dist/telemetry-sqlite/schema.d.ts +9 -0
- package/dist/telemetry-sqlite/schema.d.ts.map +1 -0
- package/dist/telemetry-sqlite/schema.js +61 -0
- package/dist/telemetry-sqlite/schema.js.map +1 -0
- package/dist/telemetry-sqlite/store.d.ts +12 -0
- package/dist/telemetry-sqlite/store.d.ts.map +1 -0
- package/dist/telemetry-sqlite/store.js +121 -0
- package/dist/telemetry-sqlite/store.js.map +1 -0
- package/dist/telemetry.d.ts +1013 -0
- package/dist/telemetry.d.ts.map +1 -0
- package/dist/telemetry.js +518 -0
- package/dist/telemetry.js.map +1 -0
- package/dist/tui/bridge.d.ts +112 -0
- package/dist/tui/bridge.d.ts.map +1 -0
- package/dist/tui/bridge.js +9 -0
- package/dist/tui/bridge.js.map +1 -0
- package/dist/tui/channel.d.ts +44 -0
- package/dist/tui/channel.d.ts.map +1 -0
- package/dist/tui/channel.js +150 -0
- package/dist/tui/channel.js.map +1 -0
- package/dist/tui/frames.d.ts +5 -0
- package/dist/tui/frames.d.ts.map +1 -0
- package/dist/tui/frames.js +52 -0
- package/dist/tui/frames.js.map +1 -0
- package/dist/tui/index.d.ts +8 -0
- package/dist/tui/index.d.ts.map +1 -0
- package/dist/tui/index.js +8 -0
- package/dist/tui/index.js.map +1 -0
- package/dist/tui/runtime.d.ts +46 -0
- package/dist/tui/runtime.d.ts.map +1 -0
- package/dist/tui/runtime.js +101 -0
- package/dist/tui/runtime.js.map +1 -0
- package/dist/tui/scope.d.ts +62 -0
- package/dist/tui/scope.d.ts.map +1 -0
- package/dist/tui/scope.js +173 -0
- package/dist/tui/scope.js.map +1 -0
- package/dist/tui/terminal.d.ts +15 -0
- package/dist/tui/terminal.d.ts.map +1 -0
- package/dist/tui/terminal.js +37 -0
- package/dist/tui/terminal.js.map +1 -0
- package/dist/tui/theme.d.ts +17 -0
- package/dist/tui/theme.d.ts.map +1 -0
- package/dist/tui/theme.js +38 -0
- package/dist/tui/theme.js.map +1 -0
- package/dist/watch.d.ts +194 -0
- package/dist/watch.d.ts.map +1 -0
- package/dist/watch.js +383 -0
- package/dist/watch.js.map +1 -0
- package/dist/web/environment.d.ts +4 -0
- package/dist/web/environment.d.ts.map +1 -0
- package/dist/web/environment.js +37 -0
- package/dist/web/environment.js.map +1 -0
- package/dist/web/index.d.ts +5 -0
- package/dist/web/index.d.ts.map +1 -0
- package/dist/web/index.js +7 -0
- package/dist/web/index.js.map +1 -0
- package/dist/web/language.d.ts +7 -0
- package/dist/web/language.d.ts.map +1 -0
- package/dist/web/language.js +21 -0
- package/dist/web/language.js.map +1 -0
- package/dist/web/page.d.ts +42 -0
- package/dist/web/page.d.ts.map +1 -0
- package/dist/web/page.js +96 -0
- package/dist/web/page.js.map +1 -0
- package/dist/web/scripts.d.ts +23 -0
- package/dist/web/scripts.d.ts.map +1 -0
- package/dist/web/scripts.js +50 -0
- package/dist/web/scripts.js.map +1 -0
- package/dist/web/styles.d.ts +17 -0
- package/dist/web/styles.d.ts.map +1 -0
- package/dist/web/styles.js +218 -0
- package/dist/web/styles.js.map +1 -0
- package/dist/web/themes.d.ts +6 -0
- package/dist/web/themes.d.ts.map +1 -0
- package/dist/web/themes.js +31 -0
- package/dist/web/themes.js.map +1 -0
- package/docs/admission/design.md +178 -0
- package/docs/benchmarks.md +1182 -0
- package/docs/decisions.md +3760 -0
- package/docs/dependencies/book.md +1671 -0
- package/docs/dependencies/index.html +2641 -0
- package/docs/dependencies/model.md +330 -0
- package/docs/design.md +3691 -0
- package/docs/durable-observers/book.md +432 -0
- package/docs/durable-observers/index.html +517 -0
- package/docs/events/spec.md +438 -0
- package/docs/flow-control/book.md +333 -0
- package/docs/flow-control/fold/index.html +265 -0
- package/docs/flow-control/index.html +548 -0
- package/docs/flow-control/window/index.html +228 -0
- package/docs/guide-plugins-hosts/book.md +958 -0
- package/docs/guide-plugins-hosts/index.html +952 -0
- package/docs/host-keyed/spec.md +343 -0
- package/docs/http-workers/book.md +378 -0
- package/docs/http-workers/index.html +515 -0
- package/docs/i18n/book.md +217 -0
- package/docs/i18n/index.html +344 -0
- package/docs/layer-1.md +311 -0
- package/docs/layer-2.md +216 -0
- package/docs/p3-features/README.md +6 -0
- package/docs/p3-features/book.md +478 -0
- package/docs/plugin-authoring.md +389 -0
- package/docs/plugin-model/book.md +186 -0
- package/docs/plugin-model/index.html +310 -0
- package/docs/plugin-primer/book.md +273 -0
- package/docs/plugin-primer/index.html +430 -0
- package/docs/shared-holds/design.md +339 -0
- package/docs/slice-1.md +236 -0
- package/docs/slice-10.md +288 -0
- package/docs/slice-11.md +114 -0
- package/docs/slice-12.md +132 -0
- package/docs/slice-13.md +121 -0
- package/docs/slice-14-design.md +213 -0
- package/docs/slice-14.md +861 -0
- package/docs/slice-2.md +174 -0
- package/docs/slice-3a.md +296 -0
- package/docs/slice-3b.md +197 -0
- package/docs/slice-4.md +146 -0
- package/docs/slice-4a.md +418 -0
- package/docs/slice-4b.md +208 -0
- package/docs/slice-5.md +281 -0
- package/docs/slice-6a.md +676 -0
- package/docs/slice-6b.md +332 -0
- package/docs/slice-7a.md +130 -0
- package/docs/slice-7b/book.md +608 -0
- package/docs/slice-7b/index.html +842 -0
- package/docs/slice-7b.md +255 -0
- package/docs/slice-7c.md +165 -0
- package/docs/slice-8.md +194 -0
- package/docs/slice-9.md +110 -0
- package/docs/slices.md +380 -0
- package/docs/store/book.md +670 -0
- package/docs/store/index.html +861 -0
- package/docs/store/walkthrough.md +193 -0
- package/docs/theming/book.md +223 -0
- package/docs/theming/index.html +371 -0
- package/docs/tutorial/book.md +2170 -0
- package/docs/tutorial/index.html +2112 -0
- package/docs/tutorial/screens/click-after.png +0 -0
- package/docs/tutorial/screens/click-before.png +0 -0
- package/docs/tutorial/screens/edited.png +0 -0
- package/docs/tutorial/screens/french.png +0 -0
- package/docs/tutorial/screens/harbor.png +0 -0
- package/docs/tutorial/screens/page.png +0 -0
- package/docs/tutorial/screens/traces-ada.png +0 -0
- package/docs/tutorial/screens/traces.png +0 -0
- package/package.json +200 -5
- package/src/delta/README.md +262 -0
|
@@ -0,0 +1,81 @@
|
|
|
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, kindParams } 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
|
+
// Declaration policy: only a declared host kind keys documents (its params decode the keys).
|
|
11
|
+
if (keyed !== undefined && typeof keyed !== "boolean")
|
|
12
|
+
kindParams(keyed);
|
|
13
|
+
return new StateDefinition(name, schema, version, initial, migrate, keyed ?? false, persist ?? false, checkpointWhen);
|
|
14
|
+
}
|
|
15
|
+
const NEVER = () => false;
|
|
16
|
+
/** A declared document; `T` is its value, `K` what it is keyed by, `P` whether it is persisted. */
|
|
17
|
+
export class StateDefinition {
|
|
18
|
+
name;
|
|
19
|
+
schema;
|
|
20
|
+
version;
|
|
21
|
+
/** Whether it is keyed: by string keys or by addresses. */
|
|
22
|
+
keyed;
|
|
23
|
+
/** The host kind whose addresses key it (a declared `hostKind`); `undefined` for string keys and singletons. */
|
|
24
|
+
host;
|
|
25
|
+
persist;
|
|
26
|
+
/**
|
|
27
|
+
* `hash64` of the schema's normal form (descriptions and titles ignored), computed once: the same version with
|
|
28
|
+
* another fingerprint is a schema changed without a version bump.
|
|
29
|
+
*/
|
|
30
|
+
fingerprint;
|
|
31
|
+
#initial;
|
|
32
|
+
#migrate;
|
|
33
|
+
/** Method-typed so that a definition of a narrower `T` still is a `StateDefinition<JsonObject, ...>`. */
|
|
34
|
+
#checkpointWhen;
|
|
35
|
+
#checked = false;
|
|
36
|
+
constructor(name, schema, version, initial, migrate, keyed, persist, checkpointWhen) {
|
|
37
|
+
this.name = name;
|
|
38
|
+
this.schema = schema;
|
|
39
|
+
this.version = version;
|
|
40
|
+
this.#initial = initial;
|
|
41
|
+
this.#migrate = migrate;
|
|
42
|
+
this.keyed = keyed !== false;
|
|
43
|
+
this.host = typeof keyed === "boolean" ? undefined : keyed;
|
|
44
|
+
this.persist = persist;
|
|
45
|
+
this.#checkpointWhen = checkpointWhen ?? NEVER;
|
|
46
|
+
this.fingerprint = fingerprintOf(snapshotSchema(schema, name).normal);
|
|
47
|
+
}
|
|
48
|
+
/** Whether a persisted document's change is stored as a new base (its `checkpointWhen`); never asked in memory. */
|
|
49
|
+
checkpointWhen(value, ops, info) {
|
|
50
|
+
return this.#checkpointWhen(value, ops, info);
|
|
51
|
+
}
|
|
52
|
+
/** A fresh `initial()` value; the first is checked against the schema (counted), later ones are not (R8). */
|
|
53
|
+
initial(context) {
|
|
54
|
+
const value = this.#initial();
|
|
55
|
+
if (this.#checked)
|
|
56
|
+
return value;
|
|
57
|
+
this.#check(value, "initial()", context);
|
|
58
|
+
this.#checked = true;
|
|
59
|
+
return value;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* `old`, a value of version `from`, migrated to this version and checked against the schema once, as it is
|
|
63
|
+
* produced (R8, counted). Throws without a `migrate` (the access is refused, the data kept) and when the result does
|
|
64
|
+
* not match.
|
|
65
|
+
*/
|
|
66
|
+
migrate(old, from, context) {
|
|
67
|
+
if (this.#migrate === undefined) {
|
|
68
|
+
throw new Error(`${this.name}: no migrate from version ${from} to ${this.version}`);
|
|
69
|
+
}
|
|
70
|
+
const value = this.#migrate(old, from);
|
|
71
|
+
this.#check(value, `migrate() from version ${from}`, context);
|
|
72
|
+
return value;
|
|
73
|
+
}
|
|
74
|
+
#check(value, what, context) {
|
|
75
|
+
chordMetrics(context.telemetry.metrics).counter("chord.data.validations").add(1);
|
|
76
|
+
if (!validatorFor(this, context).check(value)) {
|
|
77
|
+
throw new Error(`${this.name}: ${what} does not match the schema`);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=definition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definition.js","sourceRoot":"","sources":["../../src/documents/definition.ts"],"names":[],"mappings":"AAAA,qHAAqH;AACrH,6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AAE,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 { KindShape, Schema, Static } from \"../contracts/index.ts\";\nimport { checkName, fingerprintOf, kindParams } 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 a definition is keyed by: nothing (`false`, a singleton), string keys (`true`) or addresses of a host kind. */\nexport type KeyedBy = boolean | KindShape;\n\n/** What `defineState` takes for any document. */\ntype StateOptions<S extends Schema, K extends KeyedBy> = {\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\t/** `true`: many per object by string key; a host kind: many per object, each keyed by an address of that kind. */\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, or with\n * `keyed: <host kind>` many per object, each by an address of that kind, belonging to that host (the store exports,\n * imports and deletes it with the host's data); with `persist: true` stored in the host's store. Its name is a\n * restricted name (lowercase `[a-z0-9@/._~-]`).\n */\nexport function defineState<S extends Schema, K extends KeyedBy = 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 KeyedBy = 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 KeyedBy>(\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\t// Declaration policy: only a declared host kind keys documents (its params decode the keys).\n\tif (keyed !== undefined && typeof keyed !== \"boolean\") kindParams(keyed);\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` what it is keyed by, `P` whether it is persisted. */\nexport class StateDefinition<T extends JsonObject, K extends KeyedBy, P extends boolean = false> {\n\treadonly name: string;\n\treadonly schema: Schema;\n\treadonly version: number;\n\t/** Whether it is keyed: by string keys or by addresses. */\n\treadonly keyed: boolean;\n\t/** The host kind whose addresses key it (a declared `hostKind`); `undefined` for string keys and singletons. */\n\treadonly host: KindShape | undefined;\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: what the definition is keyed by. */\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: KeyedBy,\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 !== false;\n\t\tthis.host = typeof keyed === \"boolean\" ? undefined : 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,129 @@
|
|
|
1
|
+
import type { TelemetryContext } from "@diffra-ai/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, KeyedBy, StateDefinition } from "./definition.ts";
|
|
7
|
+
import { SealToken } from "./fence.ts";
|
|
8
|
+
import { type HandleOf, type KeyDeclarer } from "./handles.ts";
|
|
9
|
+
import { KeyedSlot } from "./keyed-slot.ts";
|
|
10
|
+
import { Line } from "./line.ts";
|
|
11
|
+
import { Residency } from "./residency.ts";
|
|
12
|
+
import { type AnyDefinition } from "./slot.ts";
|
|
13
|
+
import { Transaction } from "./transaction.ts";
|
|
14
|
+
/**
|
|
15
|
+
* A transaction (a document change or retirement, `self.tx`, a job start) that did not commit because the context it
|
|
16
|
+
* was started with ended first: a root whose `fn` settled, a handler or routine whose object ended, a caller that
|
|
17
|
+
* cancelled. `error` is that context's abort reason, naming the scope that ended (decision "Mistakes that wait are
|
|
18
|
+
* reported at once" (e)).
|
|
19
|
+
*/
|
|
20
|
+
export type TransactionCancelled = {
|
|
21
|
+
readonly kind: "transaction_cancelled";
|
|
22
|
+
readonly object: string;
|
|
23
|
+
readonly error: unknown;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Who owns an object's documents: the object's name, batch and context, its store address, its live failure, and where
|
|
27
|
+
* a cancelled transaction is reported.
|
|
28
|
+
*/
|
|
29
|
+
export type DocumentsOwner = {
|
|
30
|
+
/** The owner's name in errors. */
|
|
31
|
+
readonly label: string;
|
|
32
|
+
readonly batch: Batch;
|
|
33
|
+
/** The object's context: shared cold loads run under it (rule 11). */
|
|
34
|
+
readonly context: Context;
|
|
35
|
+
/** The host's store and the object's owner name in it (its type, R2), when it has one. */
|
|
36
|
+
readonly store: {
|
|
37
|
+
readonly store: ChordStore;
|
|
38
|
+
readonly owner: string;
|
|
39
|
+
} | undefined;
|
|
40
|
+
/** A document the code cannot read fails the live object `broken` (slice 6a §1.4); ignored when it is not live. */
|
|
41
|
+
fail(error: ChordError): void;
|
|
42
|
+
/** Reports a transaction its context's end cancelled (the host's `onError`). */
|
|
43
|
+
report(error: TransactionCancelled): void;
|
|
44
|
+
/** The host's telemetry adapter: commit durations go to its metrics. */
|
|
45
|
+
readonly telemetry: TelemetryContext;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* The documents of one object, from its first activation to its end: one slot per declared name, kept across
|
|
49
|
+
* attempts, and the line. Each attempt declares its handles under its own seal token; the object's own transactions
|
|
50
|
+
* (job outcomes) run under `own`, sealed only by the object's end.
|
|
51
|
+
*/
|
|
52
|
+
export declare class Documents {
|
|
53
|
+
#private;
|
|
54
|
+
/** The owner's name in errors. */
|
|
55
|
+
readonly label: string;
|
|
56
|
+
readonly batch: Batch;
|
|
57
|
+
/** The object's context. */
|
|
58
|
+
readonly context: Context;
|
|
59
|
+
readonly line: Line;
|
|
60
|
+
/**
|
|
61
|
+
* The idle persisted keyed documents and their eviction. A sweep's only rejection is `onLine`'s `released` once
|
|
62
|
+
* the object ended (a sweep itself drops trackers in memory and does not throw): nothing to report.
|
|
63
|
+
*/
|
|
64
|
+
readonly residency: Residency;
|
|
65
|
+
/** The token of the object's own transactions: sealed with the object (`seal`). */
|
|
66
|
+
readonly own: SealToken;
|
|
67
|
+
constructor(owner: DocumentsOwner);
|
|
68
|
+
/**
|
|
69
|
+
* A handle to `definition`'s slot for an attempt sealed by `token`, whose `at(key)` pins `declarer` takes: the slot
|
|
70
|
+
* made by the first declaration of its name, checked against the values for later ones (`SlotDefinition.check`).
|
|
71
|
+
* "Declared twice" is the attempt's check.
|
|
72
|
+
*/
|
|
73
|
+
declare<D extends StateDefinition<JsonObject, KeyedBy, boolean>>(definition: D, token: SealToken, declarer: KeyDeclarer): HandleOf<D>;
|
|
74
|
+
/**
|
|
75
|
+
* Checks a declaration of `definition` as `declare` would, changing nothing (a reload's staging: a recording factory
|
|
76
|
+
* declares against the documents the object has).
|
|
77
|
+
*/
|
|
78
|
+
check(definition: AnyDefinition): void;
|
|
79
|
+
/**
|
|
80
|
+
* Takes an attempt's declarations once its factory returned: its `at(key)` pins replace the previous factory's, the
|
|
81
|
+
* slots it no longer declares are dropped (their watches end; persisted ones load again when declared again), every
|
|
82
|
+
* declared one hydrated (`initial()`, migrations; a throw fails the activation).
|
|
83
|
+
*/
|
|
84
|
+
hydrate(declared: ReadonlyMap<string, AnyDefinition>, pins: readonly (() => void)[], context: Context): void;
|
|
85
|
+
/**
|
|
86
|
+
* Loads, in one line job, every persisted singleton not loaded yet and every pinned key not loaded since it was
|
|
87
|
+
* pinned (an attempt's activation, before it goes live, rule 6); `undefined` when nothing is persisted. A failure
|
|
88
|
+
* fails the activation.
|
|
89
|
+
*/
|
|
90
|
+
load(context: Context): Promise<void> | undefined;
|
|
91
|
+
/**
|
|
92
|
+
* Runs `job` on the line (a cold load, a page of keys, an eviction sweep); refused `released` once the object is
|
|
93
|
+
* ending or `token` (the handle's that asks, when the job is one handle's) is sealed, a job queued before either
|
|
94
|
+
* included (anything taking the line after the seal is refused, rule 4).
|
|
95
|
+
*/
|
|
96
|
+
onLine<T>(job: () => Promise<T>, token?: SealToken): Promise<T>;
|
|
97
|
+
/**
|
|
98
|
+
* Runs `fn` as one transaction on the line under `token` and commits what it drafted (§9): a throw, an abort of
|
|
99
|
+
* `context`, the token's seal or the object's end discards everything; one that did not commit while `context` was
|
|
100
|
+
* aborted is also reported (`transaction_cancelled`): an empty `catch` cannot hide a change that never happened.
|
|
101
|
+
* `persistence` defers storing a run state's change (D8).
|
|
102
|
+
*/
|
|
103
|
+
tx<R>(fn: (tx: Transaction) => R | Promise<R>, token: SealToken, context: Context, persistence?: CommitPersistence): Promise<R>;
|
|
104
|
+
/**
|
|
105
|
+
* Seals `token` (the seal fence): its transactions are refused from now on, and the one holding the line is
|
|
106
|
+
* discarded and the line released.
|
|
107
|
+
*/
|
|
108
|
+
fence(token: SealToken): void;
|
|
109
|
+
/** Throws `released` once the object ended. */
|
|
110
|
+
assertLive(): void;
|
|
111
|
+
/** Throws `released` once `token` is sealed or the object is ending: no new work takes the line. */
|
|
112
|
+
assertAdmitted(token: SealToken): void;
|
|
113
|
+
/** The live object fails `broken` with `error` (a document the code cannot read); ignored when it is not live. */
|
|
114
|
+
fail(error: ChordError): void;
|
|
115
|
+
/** The object is ending: every transaction is refused, the one holding the line discarded; documents stay readable. */
|
|
116
|
+
seal(): void;
|
|
117
|
+
/**
|
|
118
|
+
* Resolves once the line is free. After `seal` only an admitted step can hold it (every other holder was cut):
|
|
119
|
+
* the object's teardown waits here, so the step adopts into documents that still exist (slice 6a §1.3).
|
|
120
|
+
*/
|
|
121
|
+
settled(): Promise<void>;
|
|
122
|
+
/** The persisted slots keyed by addresses of host kind `kind`: the documents of this object belonging to such hosts. */
|
|
123
|
+
hostSlots(kind: string): KeyedSlot[];
|
|
124
|
+
/** Drops every document and pin; watches end `ended`, and every later use throws `released`. */
|
|
125
|
+
end(): void;
|
|
126
|
+
/** The `released` error of this object's documents. */
|
|
127
|
+
released(): ChordError;
|
|
128
|
+
}
|
|
129
|
+
//# 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,sBAAsB,CAAC;AAC7D,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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,OAAO,EAAE,OAAO,EAChB,WAAW,CAAC,EAAE,iBAAiB,GAC7B,OAAO,CAAC,CAAC,CAAC,CA6BZ;IAcD;;;OAGG;IACH,KAAK,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CAG5B;IAED,+CAA+C;IAC/C,UAAU,IAAI,IAAI,CAEjB;IAED,oGAAoG;IACpG,cAAc,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CAErC;IAED,kHAAkH;IAClH,IAAI,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAE5B;IAED,uHAAuH;IACvH,IAAI,IAAI,IAAI,CAKX;IAED;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAG7B;IAED,wHAAwH;IACxH,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,CAQnC;IAED,gGAAgG;IAChG,GAAG,IAAI,IAAI,CAMV;IAED,uDAAuD;IACvD,QAAQ,IAAI,UAAU,CAErB;CAmBD"}
|
|
@@ -0,0 +1,258 @@
|
|
|
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) : 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
|
+
/** The persisted slots keyed by addresses of host kind `kind`: the documents of this object belonging to such hosts. */
|
|
220
|
+
hostSlots(kind) {
|
|
221
|
+
const slots = [];
|
|
222
|
+
for (const slot of this.#slots.values()) {
|
|
223
|
+
if (slot instanceof KeyedSlot && slot.persisted !== undefined && slot.definition.current.host?.kind === kind) {
|
|
224
|
+
slots.push(slot);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
return slots;
|
|
228
|
+
}
|
|
229
|
+
/** Drops every document and pin; watches end `ended`, and every later use throws `released`. */
|
|
230
|
+
end() {
|
|
231
|
+
this.#state = "ended";
|
|
232
|
+
this.residency.end();
|
|
233
|
+
for (const slot of this.#slots.values())
|
|
234
|
+
slot.drop();
|
|
235
|
+
this.#slots.clear();
|
|
236
|
+
this.#pins = [];
|
|
237
|
+
}
|
|
238
|
+
/** The `released` error of this object's documents. */
|
|
239
|
+
released() {
|
|
240
|
+
return new ChordError({ code: "released", reason: "ended", message: `${this.label}: ended` });
|
|
241
|
+
}
|
|
242
|
+
/** Discards the transaction holding the line and releases the line. */
|
|
243
|
+
#cut() {
|
|
244
|
+
const holder = this.#holder;
|
|
245
|
+
this.#holder = undefined;
|
|
246
|
+
holder?.cut();
|
|
247
|
+
}
|
|
248
|
+
#add(slot) {
|
|
249
|
+
this.#slots.set(slot.definition.current.name, slot);
|
|
250
|
+
return slot;
|
|
251
|
+
}
|
|
252
|
+
/** The store side of persisted `definition`'s documents; the attempt checked the store first (P3). */
|
|
253
|
+
#persistence(definition) {
|
|
254
|
+
const { store, owner } = this.#owner.store;
|
|
255
|
+
return new Persistence(store, owner, "chord", definition.name, definition.host);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
//# sourceMappingURL=documents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"documents.js","sourceRoot":"","sources":["../../src/documents/documents.ts"],"names":[],"mappings":"AAAA,qHAAqH;AACrH,sHAAsH;AACtH,wHAAwH;AAIxH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAG9C,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEzD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAmC,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACjF,OAAO,EAAE,SAAS,EAAE,MAA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GAAG;QACF,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC;QACtB,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC;QACrB,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;YAAE,IAAI,CAAC,IAAI,EAAE,CAAC;QACrD,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QACpB,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;IACjB,CAAC;IAED,uDAAuD;IACvD,QAAQ;QACP,OAAO,IAAI,UAAU,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,KAAK,SAAS,EAAE,CAAC,CAAC;IAC/F,CAAC;IAED,uEAAuE;IACvE,IAAI;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC;QAC5B,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC;QACzB,MAAM,EAAE,GAAG,EAAE,CAAC;IACf,CAAC;IAED,IAAI,CAAsC,IAAO;QAChD,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACpD,OAAO,IAAI,CAAC;IACb,CAAC;IAED,sGAAsG;IACtG,YAAY,CAAC,UAAyB;QACrC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,KAAM,CAAC;QAC5C,OAAO,IAAI,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,IAAI,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;IACjF,CAAC;CACD","sourcesContent":["// An object's documents (§9, P2, slice 6a §1.2, §10): its slots across attempts, its line (its transactions and line\n// jobs run one at a time), the seal fence over the transaction holding the line, the factory's pins between attempts,\n// the activation's loads and the residency of keyed documents; a commit's telemetry (its event, its duration, slice 9).\n\nimport type { TelemetryContext } from \"@diffra-ai/telemetry\";\nimport type { Context } from \"../context/index.ts\";\nimport { ChordError } from \"../data/index.ts\";\nimport type { Batch } from \"../state/internal.ts\";\nimport type { ChordStore } from \"../store/store.ts\";\nimport { chordMetrics, untraced } from \"../telemetry.ts\";\nimport type { CommitPersistence, JsonObject, KeyedBy, StateDefinition } from \"./definition.ts\";\nimport { SealToken } from \"./fence.ts\";\nimport { type HandleOf, type KeyDeclarer, Keyed, Singleton } from \"./handles.ts\";\nimport { KeyedSlot } from \"./keyed-slot.ts\";\nimport { Line } from \"./line.ts\";\nimport { Persistence } from \"./persistence.ts\";\nimport { Residency } from \"./residency.ts\";\nimport { type AnyDefinition, SingletonSlot } from \"./slot.ts\";\nimport { Transaction } from \"./transaction.ts\";\n\n/**\n * A transaction (a document change or retirement, `self.tx`, a job start) that did not commit because the context it\n * was started with ended first: a root whose `fn` settled, a handler or routine whose object ended, a caller that\n * cancelled. `error` is that context's abort reason, naming the scope that ended (decision \"Mistakes that wait are\n * reported at once\" (e)).\n */\nexport type TransactionCancelled = {\n\treadonly kind: \"transaction_cancelled\";\n\treadonly object: string;\n\treadonly error: unknown;\n};\n\n/**\n * Who owns an object's documents: the object's name, batch and context, its store address, its live failure, and where\n * a cancelled transaction is reported.\n */\nexport type DocumentsOwner = {\n\t/** The owner's name in errors. */\n\treadonly label: string;\n\treadonly batch: Batch;\n\t/** The object's context: shared cold loads run under it (rule 11). */\n\treadonly context: Context;\n\t/** The host's store and the object's owner name in it (its type, R2), when it has one. */\n\treadonly store: { readonly store: ChordStore; readonly owner: string } | undefined;\n\t/** A document the code cannot read fails the live object `broken` (slice 6a §1.4); ignored when it is not live. */\n\tfail(error: ChordError): void;\n\t/** Reports a transaction its context's end cancelled (the host's `onError`). */\n\treport(error: TransactionCancelled): void;\n\t/** The host's telemetry adapter: commit durations go to its metrics. */\n\treadonly telemetry: TelemetryContext;\n};\n\n/**\n * The documents of one object, from its first activation to its end: one slot per declared name, kept across\n * attempts, and the line. Each attempt declares its handles under its own seal token; the object's own transactions\n * (job outcomes) run under `own`, sealed only by the object's end.\n */\nexport class Documents {\n\t/** The owner's name in errors. */\n\treadonly label: string;\n\treadonly batch: Batch;\n\t/** The object's context. */\n\treadonly context: Context;\n\treadonly line = new Line();\n\t/**\n\t * The idle persisted keyed documents and their eviction. A sweep's only rejection is `onLine`'s `released` once\n\t * the object ended (a sweep itself drops trackers in memory and does not throw): nothing to report.\n\t */\n\treadonly residency = new Residency((sweep) => void this.onLine(async () => sweep()).catch(() => {}));\n\treadonly #owner: DocumentsOwner;\n\t/** The token of the object's own transactions: sealed with the object (`seal`). */\n\treadonly own = new SealToken();\n\treadonly #slots = new Map<string, SingletonSlot | KeyedSlot>();\n\t/** The transaction holding the line, until it settles or its token is sealed. */\n\t#holder: Transaction | undefined;\n\t/** `sealed`: the object is ending; its documents stay readable, its transactions throw `released`. */\n\t#state: \"open\" | \"sealed\" | \"ended\" = \"open\";\n\t/** The pins the last factory that returned declared (`at(key)`): held until the next one returns (rule 6). */\n\t#pins: readonly (() => void)[] = [];\n\n\tconstructor(owner: DocumentsOwner) {\n\t\tthis.label = owner.label;\n\t\tthis.batch = owner.batch;\n\t\tthis.context = owner.context;\n\t\tthis.#owner = owner;\n\t}\n\n\t/**\n\t * A handle to `definition`'s slot for an attempt sealed by `token`, whose `at(key)` pins `declarer` takes: the slot\n\t * made by the first declaration of its name, checked against the values for later ones (`SlotDefinition.check`).\n\t * \"Declared twice\" is the attempt's check.\n\t */\n\tdeclare<D extends StateDefinition<JsonObject, KeyedBy, boolean>>(\n\t\tdefinition: D,\n\t\ttoken: SealToken,\n\t\tdeclarer: KeyDeclarer,\n\t): HandleOf<D> {\n\t\tconst slot = this.#slots.get(definition.name);\n\t\tif (slot !== undefined) slot.definition.check(definition);\n\t\tconst persistence = slot === undefined && definition.persist ? this.#persistence(definition) : undefined;\n\t\t// The definition's `keyed` decides the slot's class and the handle's; its documents are the definition's `T`.\n\t\tif (definition.keyed) {\n\t\t\tconst keyed = slot ?? this.#add(new KeyedSlot(this, definition, persistence));\n\t\t\treturn new Keyed(keyed as KeyedSlot, token, definition.version, declarer) as unknown as HandleOf<D>;\n\t\t}\n\t\tconst singleton = slot ?? this.#add(new SingletonSlot(this, definition, persistence));\n\t\treturn new Singleton(singleton as SingletonSlot, token, definition.version) as unknown as HandleOf<D>;\n\t}\n\n\t/**\n\t * Checks a declaration of `definition` as `declare` would, changing nothing (a reload's staging: a recording factory\n\t * declares against the documents the object has).\n\t */\n\tcheck(definition: AnyDefinition): void {\n\t\tthis.#slots.get(definition.name)?.definition.check(definition);\n\t}\n\n\t/**\n\t * Takes an attempt's declarations once its factory returned: its `at(key)` pins replace the previous factory's, the\n\t * slots it no longer declares are dropped (their watches end; persisted ones load again when declared again), every\n\t * declared one hydrated (`initial()`, migrations; a throw fails the activation).\n\t */\n\thydrate(declared: ReadonlyMap<string, AnyDefinition>, pins: readonly (() => void)[], context: Context): void {\n\t\tconst previous = this.#pins;\n\t\tthis.#pins = pins;\n\t\tfor (const release of previous) release();\n\t\t// A dropped persisted slot goes whole, its loaded documents too: observably the same as keeping them, since\n\t\t// every committed write is in the store and a later declaration reloads from there.\n\t\tfor (const [name, slot] of this.#slots) {\n\t\t\tif (declared.has(name)) continue;\n\t\t\tthis.#slots.delete(name);\n\t\t\tslot.drop();\n\t\t}\n\t\tfor (const [name, definition] of declared) this.#slots.get(name)!.hydrate(definition, context);\n\t}\n\n\t/**\n\t * Loads, in one line job, every persisted singleton not loaded yet and every pinned key not loaded since it was\n\t * pinned (an attempt's activation, before it goes live, rule 6); `undefined` when nothing is persisted. A failure\n\t * fails the activation.\n\t */\n\tload(context: Context): Promise<void> | undefined {\n\t\tconst persisted = [...this.#slots.values()].filter((slot) => slot.persisted !== undefined);\n\t\t// In memory only: nothing to wait for (an activation without persisted documents takes no extra turn).\n\t\tif (persisted.length === 0) return undefined;\n\t\treturn this.onLine(async () => {\n\t\t\tfor (const slot of persisted) await slot.loadDeclared(context);\n\t\t});\n\t}\n\n\t/**\n\t * Runs `job` on the line (a cold load, a page of keys, an eviction sweep); refused `released` once the object is\n\t * ending or `token` (the handle's that asks, when the job is one handle's) is sealed, a job queued before either\n\t * included (anything taking the line after the seal is refused, rule 4).\n\t */\n\tasync onLine<T>(job: () => Promise<T>, token?: SealToken): Promise<T> {\n\t\tif (this.#state !== \"open\" || token?.sealed) throw this.released();\n\t\tconst release = await this.line.acquire();\n\t\ttry {\n\t\t\tif (this.#state !== \"open\" || token?.sealed) throw this.released();\n\t\t\treturn await job();\n\t\t} finally {\n\t\t\trelease();\n\t\t}\n\t}\n\n\t/**\n\t * Runs `fn` as one transaction on the line under `token` and commits what it drafted (§9): a throw, an abort of\n\t * `context`, the token's seal or the object's end discards everything; one that did not commit while `context` was\n\t * aborted is also reported (`transaction_cancelled`): an empty `catch` cannot hide a change that never happened.\n\t * `persistence` defers storing a run state's change (D8).\n\t */\n\tasync tx<R>(\n\t\tfn: (tx: Transaction) => R | Promise<R>,\n\t\ttoken: SealToken,\n\t\tcontext: Context,\n\t\tpersistence?: CommitPersistence,\n\t): Promise<R> {\n\t\tthis.batch.assertOutside(\"tx\");\n\t\tthis.assertAdmitted(token);\n\t\tconst release = await this.line.acquire();\n\t\tconst tx = new Transaction(this, token, release, context, persistence);\n\t\ttry {\n\t\t\tthis.assertAdmitted(token);\n\t\t\tthis.#holder = tx;\n\t\t\tconst result = await fn(tx);\n\t\t\t// Timed only when something records: the commit's duration metric, its event on the enclosing span.\n\t\t\tconst timed = !untraced(this.#owner.telemetry) || !untraced(context.telemetry);\n\t\t\tconst started = timed ? performance.now() : 0;\n\t\t\t// In-memory-only commits are synchronous (W12): no await unless the store's step is taken.\n\t\t\tconst step = tx.commit();\n\t\t\tif (step !== undefined) await step;\n\t\t\tif (timed) this.#recordCommit(tx, performance.now() - started, context);\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\ttx.discard();\n\t\t\t// Only a transaction that did not commit reads this; Chord's own run under contexts that never abort.\n\t\t\tconst signal = context.abortSignal;\n\t\t\tif (signal?.aborted)\n\t\t\t\tthis.#owner.report({ kind: \"transaction_cancelled\", object: this.label, error: signal.reason });\n\t\t\tthrow error;\n\t\t} finally {\n\t\t\tif (this.#holder === tx) this.#holder = undefined;\n\t\t\trelease();\n\t\t\ttx.settle();\n\t\t}\n\t}\n\n\t/**\n\t * A commit of `tx` that took `duration` ms (from its start to its adoption): its event on `context`'s span (the\n\t * method, routine or job it ran in) and the host's commit duration metric; a commit that changed nothing records\n\t * nothing.\n\t */\n\t#recordCommit(tx: Transaction, duration: number, context: Context): void {\n\t\tconst { documents, ops, writes, rows } = tx.committed();\n\t\tif (documents === 0 && writes === 0) return;\n\t\tif (!untraced(context.telemetry)) context.telemetry.addEvent(\"chord.commit\", { documents, ops, rows, duration });\n\t\tchordMetrics(this.#owner.telemetry.metrics).histogram(\"chord.commit.duration\").record(duration);\n\t}\n\n\t/**\n\t * Seals `token` (the seal fence): its transactions are refused from now on, and the one holding the line is\n\t * discarded and the line released.\n\t */\n\tfence(token: SealToken): void {\n\t\ttoken.seal();\n\t\tif (this.#holder?.token === token) this.#cut();\n\t}\n\n\t/** Throws `released` once the object ended. */\n\tassertLive(): void {\n\t\tif (this.#state === \"ended\") throw this.released();\n\t}\n\n\t/** Throws `released` once `token` is sealed or the object is ending: no new work takes the line. */\n\tassertAdmitted(token: SealToken): void {\n\t\tif (token.sealed || this.#state !== \"open\") throw this.released();\n\t}\n\n\t/** The live object fails `broken` with `error` (a document the code cannot read); ignored when it is not live. */\n\tfail(error: ChordError): void {\n\t\tthis.#owner.fail(error);\n\t}\n\n\t/** The object is ending: every transaction is refused, the one holding the line discarded; documents stay readable. */\n\tseal(): void {\n\t\tif (this.#state !== \"open\") return;\n\t\tthis.#state = \"sealed\";\n\t\tthis.own.seal();\n\t\tthis.#cut();\n\t}\n\n\t/**\n\t * Resolves once the line is free. After `seal` only an admitted step can hold it (every other holder was cut):\n\t * the object's teardown waits here, so the step adopts into documents that still exist (slice 6a §1.3).\n\t */\n\tasync settled(): Promise<void> {\n\t\tconst release = await this.line.acquire();\n\t\trelease();\n\t}\n\n\t/** The persisted slots keyed by addresses of host kind `kind`: the documents of this object belonging to such hosts. */\n\thostSlots(kind: string): KeyedSlot[] {\n\t\tconst slots: KeyedSlot[] = [];\n\t\tfor (const slot of this.#slots.values()) {\n\t\t\tif (slot instanceof KeyedSlot && slot.persisted !== undefined && slot.definition.current.host?.kind === kind) {\n\t\t\t\tslots.push(slot);\n\t\t\t}\n\t\t}\n\t\treturn slots;\n\t}\n\n\t/** Drops every document and pin; watches end `ended`, and every later use throws `released`. */\n\tend(): void {\n\t\tthis.#state = \"ended\";\n\t\tthis.residency.end();\n\t\tfor (const slot of this.#slots.values()) slot.drop();\n\t\tthis.#slots.clear();\n\t\tthis.#pins = [];\n\t}\n\n\t/** The `released` error of this object's documents. */\n\treleased(): ChordError {\n\t\treturn new ChordError({ code: \"released\", reason: \"ended\", message: `${this.label}: ended` });\n\t}\n\n\t/** Discards the transaction holding the line and releases the line. */\n\t#cut(): void {\n\t\tconst holder = this.#holder;\n\t\tthis.#holder = undefined;\n\t\tholder?.cut();\n\t}\n\n\t#add<S extends SingletonSlot | KeyedSlot>(slot: S): S {\n\t\tthis.#slots.set(slot.definition.current.name, slot);\n\t\treturn slot;\n\t}\n\n\t/** The store side of persisted `definition`'s documents; the attempt checked the store first (P3). */\n\t#persistence(definition: AnyDefinition): Persistence {\n\t\tconst { store, owner } = this.#owner.store!;\n\t\treturn new Persistence(store, owner, \"chord\", definition.name, definition.host);\n\t}\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** One seal token; sealed once, never unsealed. */
|
|
2
|
+
export declare class SealToken {
|
|
3
|
+
#private;
|
|
4
|
+
/** Whether work under this token is refused. */
|
|
5
|
+
get sealed(): boolean;
|
|
6
|
+
/** Seals the token; `Documents.fence` also discards the transaction it holds open. */
|
|
7
|
+
seal(): void;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=fence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fence.d.ts","sourceRoot":"","sources":["../../src/documents/fence.ts"],"names":[],"mappings":"AAGA,mDAAmD;AACnD,qBAAa,SAAS;;IAGrB,gDAAgD;IAChD,IAAI,MAAM,IAAI,OAAO,CAEpB;IAED,sFAAsF;IACtF,IAAI,IAAI,IAAI,CAEX;CACD"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// The seal fence (slice 6a §1.3): the token an attempt, a job run's invocation or the object itself hands its
|
|
2
|
+
// transactions. Once sealed, new transactions under it are refused `released` and the open one is discarded.
|
|
3
|
+
/** One seal token; sealed once, never unsealed. */
|
|
4
|
+
export class SealToken {
|
|
5
|
+
#sealed = false;
|
|
6
|
+
/** Whether work under this token is refused. */
|
|
7
|
+
get sealed() {
|
|
8
|
+
return this.#sealed;
|
|
9
|
+
}
|
|
10
|
+
/** Seals the token; `Documents.fence` also discards the transaction it holds open. */
|
|
11
|
+
seal() {
|
|
12
|
+
this.#sealed = true;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=fence.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fence.js","sourceRoot":"","sources":["../../src/documents/fence.ts"],"names":[],"mappings":"AAAA,8GAA8G;AAC9G,6GAA6G;AAE7G,mDAAmD;AACnD,MAAM,OAAO,SAAS;IACrB,OAAO,GAAG,KAAK,CAAC;IAEhB,gDAAgD;IAChD,IAAI,MAAM;QACT,OAAO,IAAI,CAAC,OAAO,CAAC;IACrB,CAAC;IAED,sFAAsF;IACtF,IAAI;QACH,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;IACrB,CAAC;CACD","sourcesContent":["// The seal fence (slice 6a §1.3): the token an attempt, a job run's invocation or the object itself hands its\n// transactions. Once sealed, new transactions under it are refused `released` and the open one is discarded.\n\n/** One seal token; sealed once, never unsealed. */\nexport class SealToken {\n\t#sealed = false;\n\n\t/** Whether work under this token is refused. */\n\tget sealed(): boolean {\n\t\treturn this.#sealed;\n\t}\n\n\t/** Seals the token; `Documents.fence` also discards the transaction it holds open. */\n\tseal(): void {\n\t\tthis.#sealed = true;\n\t}\n}\n"]}
|