@earendil-works/chord 1.3.0 → 1.5.0
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 +54 -0
- package/README.md +129 -10
- package/dist/cell.d.ts +7 -7
- package/dist/cell.d.ts.map +1 -1
- package/dist/cell.js.map +1 -1
- package/dist/context/index.d.ts +8 -0
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js +15 -0
- package/dist/context/index.js.map +1 -1
- package/dist/contract.d.ts +51 -52
- package/dist/contract.d.ts.map +1 -1
- package/dist/contract.js +19 -24
- package/dist/contract.js.map +1 -1
- package/dist/delta/apply-immutable-trusted.js +3 -4
- package/dist/delta/apply-immutable-trusted.js.map +1 -1
- package/dist/delta/diff.d.ts.map +1 -1
- package/dist/delta/diff.js +5 -3
- package/dist/delta/diff.js.map +1 -1
- package/dist/delta/index.d.ts +9 -1
- package/dist/delta/index.d.ts.map +1 -1
- package/dist/delta/index.js +15 -11
- package/dist/delta/index.js.map +1 -1
- package/dist/delta/pending.d.ts +36 -0
- package/dist/delta/pending.d.ts.map +1 -0
- package/dist/delta/pending.js +143 -0
- package/dist/delta/pending.js.map +1 -0
- package/dist/delta/tracker.d.ts +12 -0
- package/dist/delta/tracker.d.ts.map +1 -1
- package/dist/delta/tracker.js +109 -39
- package/dist/delta/tracker.js.map +1 -1
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +9 -7
- package/dist/host.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/next/contracts/accepts.d.ts +81 -0
- package/dist/next/contracts/accepts.d.ts.map +1 -0
- package/dist/next/contracts/accepts.js +123 -0
- package/dist/next/contracts/accepts.js.map +1 -0
- package/dist/next/contracts/contract.d.ts +121 -0
- package/dist/next/contracts/contract.d.ts.map +1 -0
- package/dist/next/contracts/contract.js +50 -0
- package/dist/next/contracts/contract.js.map +1 -0
- package/dist/next/contracts/declare.d.ts +107 -0
- package/dist/next/contracts/declare.d.ts.map +1 -0
- package/dist/next/contracts/declare.js +136 -0
- package/dist/next/contracts/declare.js.map +1 -0
- package/dist/next/contracts/evolve.d.ts +92 -0
- package/dist/next/contracts/evolve.d.ts.map +1 -0
- package/dist/next/contracts/evolve.js +179 -0
- package/dist/next/contracts/evolve.js.map +1 -0
- package/dist/next/contracts/fingerprint.d.ts +16 -0
- package/dist/next/contracts/fingerprint.d.ts.map +1 -0
- package/dist/next/contracts/fingerprint.js +50 -0
- package/dist/next/contracts/fingerprint.js.map +1 -0
- package/dist/next/contracts/history.d.ts +71 -0
- package/dist/next/contracts/history.d.ts.map +1 -0
- package/dist/next/contracts/history.js +3 -0
- package/dist/next/contracts/history.js.map +1 -0
- package/dist/next/contracts/host-kind.d.ts +40 -0
- package/dist/next/contracts/host-kind.d.ts.map +1 -0
- package/dist/next/contracts/host-kind.js +37 -0
- package/dist/next/contracts/host-kind.js.map +1 -0
- package/dist/next/contracts/index.d.ts +7 -0
- package/dist/next/contracts/index.d.ts.map +1 -0
- package/dist/next/contracts/index.js +6 -0
- package/dist/next/contracts/index.js.map +1 -0
- package/dist/next/contracts/internal.d.ts +10 -0
- package/dist/next/contracts/internal.d.ts.map +1 -0
- package/dist/next/contracts/internal.js +9 -0
- package/dist/next/contracts/internal.js.map +1 -0
- package/dist/next/contracts/names.d.ts +3 -0
- package/dist/next/contracts/names.d.ts.map +1 -0
- package/dist/next/contracts/names.js +13 -0
- package/dist/next/contracts/names.js.map +1 -0
- package/dist/next/contracts/params.d.ts +28 -0
- package/dist/next/contracts/params.d.ts.map +1 -0
- package/dist/next/contracts/params.js +50 -0
- package/dist/next/contracts/params.js.map +1 -0
- package/dist/next/contracts/schema.d.ts +102 -0
- package/dist/next/contracts/schema.d.ts.map +1 -0
- package/dist/next/contracts/schema.js +103 -0
- package/dist/next/contracts/schema.js.map +1 -0
- package/dist/next/contracts/snapshot.d.ts +16 -0
- package/dist/next/contracts/snapshot.d.ts.map +1 -0
- package/dist/next/contracts/snapshot.js +167 -0
- package/dist/next/contracts/snapshot.js.map +1 -0
- package/dist/next/data/args.d.ts +50 -0
- package/dist/next/data/args.d.ts.map +1 -0
- package/dist/next/data/args.js +83 -0
- package/dist/next/data/args.js.map +1 -0
- package/dist/next/data/errors.d.ts +73 -0
- package/dist/next/data/errors.d.ts.map +1 -0
- package/dist/next/data/errors.js +107 -0
- package/dist/next/data/errors.js.map +1 -0
- package/dist/next/data/failure.d.ts +26 -0
- package/dist/next/data/failure.d.ts.map +1 -0
- package/dist/next/data/failure.js +72 -0
- package/dist/next/data/failure.js.map +1 -0
- package/dist/next/data/index.d.ts +4 -0
- package/dist/next/data/index.d.ts.map +1 -0
- package/dist/next/data/index.js +4 -0
- package/dist/next/data/index.js.map +1 -0
- package/dist/next/data/internal.d.ts +7 -0
- package/dist/next/data/internal.d.ts.map +1 -0
- package/dist/next/data/internal.js +8 -0
- package/dist/next/data/internal.js.map +1 -0
- package/dist/next/data/params.d.ts +20 -0
- package/dist/next/data/params.d.ts.map +1 -0
- package/dist/next/data/params.js +31 -0
- package/dist/next/data/params.js.map +1 -0
- package/dist/next/data/principal.d.ts +17 -0
- package/dist/next/data/principal.d.ts.map +1 -0
- package/dist/next/data/principal.js +41 -0
- package/dist/next/data/principal.js.map +1 -0
- package/dist/next/data/validator.d.ts +12 -0
- package/dist/next/data/validator.d.ts.map +1 -0
- package/dist/next/data/validator.js +34 -0
- package/dist/next/data/validator.js.map +1 -0
- package/dist/next/documents/address-source.d.ts +20 -0
- package/dist/next/documents/address-source.d.ts.map +1 -0
- package/dist/next/documents/address-source.js +44 -0
- package/dist/next/documents/address-source.js.map +1 -0
- package/dist/next/documents/definition.d.ts +84 -0
- package/dist/next/documents/definition.d.ts.map +1 -0
- package/dist/next/documents/definition.js +73 -0
- package/dist/next/documents/definition.js.map +1 -0
- package/dist/next/documents/documents.d.ts +106 -0
- package/dist/next/documents/documents.d.ts.map +1 -0
- package/dist/next/documents/documents.js +224 -0
- package/dist/next/documents/documents.js.map +1 -0
- package/dist/next/documents/fence.d.ts +9 -0
- package/dist/next/documents/fence.d.ts.map +1 -0
- package/dist/next/documents/fence.js +15 -0
- package/dist/next/documents/fence.js.map +1 -0
- package/dist/next/documents/handles.d.ts +76 -0
- package/dist/next/documents/handles.d.ts.map +1 -0
- package/dist/next/documents/handles.js +66 -0
- package/dist/next/documents/handles.js.map +1 -0
- package/dist/next/documents/index.d.ts +4 -0
- package/dist/next/documents/index.d.ts.map +1 -0
- package/dist/next/documents/index.js +3 -0
- package/dist/next/documents/index.js.map +1 -0
- package/dist/next/documents/internal.d.ts +9 -0
- package/dist/next/documents/internal.d.ts.map +1 -0
- package/dist/next/documents/internal.js +9 -0
- package/dist/next/documents/internal.js.map +1 -0
- package/dist/next/documents/keyed-slot.d.ts +103 -0
- package/dist/next/documents/keyed-slot.d.ts.map +1 -0
- package/dist/next/documents/keyed-slot.js +395 -0
- package/dist/next/documents/keyed-slot.js.map +1 -0
- package/dist/next/documents/line.d.ts +7 -0
- package/dist/next/documents/line.d.ts.map +1 -0
- package/dist/next/documents/line.js +14 -0
- package/dist/next/documents/line.js.map +1 -0
- package/dist/next/documents/persistence.d.ts +104 -0
- package/dist/next/documents/persistence.d.ts.map +1 -0
- package/dist/next/documents/persistence.js +128 -0
- package/dist/next/documents/persistence.js.map +1 -0
- package/dist/next/documents/residency.d.ts +31 -0
- package/dist/next/documents/residency.d.ts.map +1 -0
- package/dist/next/documents/residency.js +93 -0
- package/dist/next/documents/residency.js.map +1 -0
- package/dist/next/documents/slot.d.ts +109 -0
- package/dist/next/documents/slot.d.ts.map +1 -0
- package/dist/next/documents/slot.js +181 -0
- package/dist/next/documents/slot.js.map +1 -0
- package/dist/next/documents/transaction.d.ts +133 -0
- package/dist/next/documents/transaction.d.ts.map +1 -0
- package/dist/next/documents/transaction.js +409 -0
- package/dist/next/documents/transaction.js.map +1 -0
- package/dist/next/host/activity.d.ts +31 -0
- package/dist/next/host/activity.d.ts.map +1 -0
- package/dist/next/host/activity.js +40 -0
- package/dist/next/host/activity.js.map +1 -0
- package/dist/next/host/adapted.d.ts +49 -0
- package/dist/next/host/adapted.d.ts.map +1 -0
- package/dist/next/host/adapted.js +214 -0
- package/dist/next/host/adapted.js.map +1 -0
- package/dist/next/host/attempt.d.ts +278 -0
- package/dist/next/host/attempt.d.ts.map +1 -0
- package/dist/next/host/attempt.js +1072 -0
- package/dist/next/host/attempt.js.map +1 -0
- package/dist/next/host/backoff.d.ts +29 -0
- package/dist/next/host/backoff.d.ts.map +1 -0
- package/dist/next/host/backoff.js +69 -0
- package/dist/next/host/backoff.js.map +1 -0
- package/dist/next/host/ctx.d.ts +47 -0
- package/dist/next/host/ctx.d.ts.map +1 -0
- package/dist/next/host/ctx.js +108 -0
- package/dist/next/host/ctx.js.map +1 -0
- package/dist/next/host/deadline.d.ts +12 -0
- package/dist/next/host/deadline.d.ts.map +1 -0
- package/dist/next/host/deadline.js +40 -0
- package/dist/next/host/deadline.js.map +1 -0
- package/dist/next/host/dependencies.d.ts +65 -0
- package/dist/next/host/dependencies.d.ts.map +1 -0
- package/dist/next/host/dependencies.js +115 -0
- package/dist/next/host/dependencies.js.map +1 -0
- package/dist/next/host/destination.d.ts +48 -0
- package/dist/next/host/destination.d.ts.map +1 -0
- package/dist/next/host/destination.js +101 -0
- package/dist/next/host/destination.js.map +1 -0
- package/dist/next/host/facet.d.ts +79 -0
- package/dist/next/host/facet.d.ts.map +1 -0
- package/dist/next/host/facet.js +55 -0
- package/dist/next/host/facet.js.map +1 -0
- package/dist/next/host/follow.d.ts +52 -0
- package/dist/next/host/follow.d.ts.map +1 -0
- package/dist/next/host/follow.js +207 -0
- package/dist/next/host/follow.js.map +1 -0
- package/dist/next/host/host.d.ts +495 -0
- package/dist/next/host/host.d.ts.map +1 -0
- package/dist/next/host/host.js +1075 -0
- package/dist/next/host/host.js.map +1 -0
- package/dist/next/host/index.d.ts +17 -0
- package/dist/next/host/index.d.ts.map +1 -0
- package/dist/next/host/index.js +6 -0
- package/dist/next/host/index.js.map +1 -0
- package/dist/next/host/internal.d.ts +10 -0
- package/dist/next/host/internal.d.ts.map +1 -0
- package/dist/next/host/internal.js +8 -0
- package/dist/next/host/internal.js.map +1 -0
- package/dist/next/host/members.d.ts +50 -0
- package/dist/next/host/members.d.ts.map +1 -0
- package/dist/next/host/members.js +107 -0
- package/dist/next/host/members.js.map +1 -0
- package/dist/next/host/native.d.ts +55 -0
- package/dist/next/host/native.d.ts.map +1 -0
- package/dist/next/host/native.js +92 -0
- package/dist/next/host/native.js.map +1 -0
- package/dist/next/host/object.d.ts +290 -0
- package/dist/next/host/object.d.ts.map +1 -0
- package/dist/next/host/object.js +1127 -0
- package/dist/next/host/object.js.map +1 -0
- package/dist/next/host/parked.d.ts +23 -0
- package/dist/next/host/parked.d.ts.map +1 -0
- package/dist/next/host/parked.js +79 -0
- package/dist/next/host/parked.js.map +1 -0
- package/dist/next/host/presence.d.ts +34 -0
- package/dist/next/host/presence.d.ts.map +1 -0
- package/dist/next/host/presence.js +117 -0
- package/dist/next/host/presence.js.map +1 -0
- package/dist/next/host/ref-state.d.ts +53 -0
- package/dist/next/host/ref-state.d.ts.map +1 -0
- package/dist/next/host/ref-state.js +83 -0
- package/dist/next/host/ref-state.js.map +1 -0
- package/dist/next/host/reference-keys.d.ts +36 -0
- package/dist/next/host/reference-keys.d.ts.map +1 -0
- package/dist/next/host/reference-keys.js +168 -0
- package/dist/next/host/reference-keys.js.map +1 -0
- package/dist/next/host/reference-source.d.ts +65 -0
- package/dist/next/host/reference-source.d.ts.map +1 -0
- package/dist/next/host/reference-source.js +285 -0
- package/dist/next/host/reference-source.js.map +1 -0
- package/dist/next/host/reference.d.ts +308 -0
- package/dist/next/host/reference.d.ts.map +1 -0
- package/dist/next/host/reference.js +775 -0
- package/dist/next/host/reference.js.map +1 -0
- package/dist/next/host/retry-on.d.ts +28 -0
- package/dist/next/host/retry-on.d.ts.map +1 -0
- package/dist/next/host/retry-on.js +52 -0
- package/dist/next/host/retry-on.js.map +1 -0
- package/dist/next/host/revocation.d.ts +16 -0
- package/dist/next/host/revocation.d.ts.map +1 -0
- package/dist/next/host/revocation.js +27 -0
- package/dist/next/host/revocation.js.map +1 -0
- package/dist/next/host/root.d.ts +27 -0
- package/dist/next/host/root.d.ts.map +1 -0
- package/dist/next/host/root.js +68 -0
- package/dist/next/host/root.js.map +1 -0
- package/dist/next/host/route.d.ts +64 -0
- package/dist/next/host/route.d.ts.map +1 -0
- package/dist/next/host/route.js +190 -0
- package/dist/next/host/route.js.map +1 -0
- package/dist/next/host/routines.d.ts +76 -0
- package/dist/next/host/routines.d.ts.map +1 -0
- package/dist/next/host/routines.js +350 -0
- package/dist/next/host/routines.js.map +1 -0
- package/dist/next/host/sleep.d.ts +9 -0
- package/dist/next/host/sleep.d.ts.map +1 -0
- package/dist/next/host/sleep.js +40 -0
- package/dist/next/host/sleep.js.map +1 -0
- package/dist/next/host/staging.d.ts +94 -0
- package/dist/next/host/staging.d.ts.map +1 -0
- package/dist/next/host/staging.js +302 -0
- package/dist/next/host/staging.js.map +1 -0
- package/dist/next/host/unbound.d.ts +30 -0
- package/dist/next/host/unbound.d.ts.map +1 -0
- package/dist/next/host/unbound.js +67 -0
- package/dist/next/host/unbound.js.map +1 -0
- package/dist/next/host/uuid.d.ts +3 -0
- package/dist/next/host/uuid.d.ts.map +1 -0
- package/dist/next/host/uuid.js +38 -0
- package/dist/next/host/uuid.js.map +1 -0
- package/dist/next/index.d.ts +28 -0
- package/dist/next/index.d.ts.map +1 -0
- package/dist/next/index.js +18 -0
- package/dist/next/index.js.map +1 -0
- package/dist/next/jobs/definition.d.ts +96 -0
- package/dist/next/jobs/definition.d.ts.map +1 -0
- package/dist/next/jobs/definition.js +83 -0
- package/dist/next/jobs/definition.js.map +1 -0
- package/dist/next/jobs/index.d.ts +5 -0
- package/dist/next/jobs/index.d.ts.map +1 -0
- package/dist/next/jobs/index.js +3 -0
- package/dist/next/jobs/index.js.map +1 -0
- package/dist/next/jobs/internal.d.ts +3 -0
- package/dist/next/jobs/internal.d.ts.map +1 -0
- package/dist/next/jobs/internal.js +4 -0
- package/dist/next/jobs/internal.js.map +1 -0
- package/dist/next/jobs/job.d.ts +152 -0
- package/dist/next/jobs/job.d.ts.map +1 -0
- package/dist/next/jobs/job.js +320 -0
- package/dist/next/jobs/job.js.map +1 -0
- package/dist/next/jobs/persisted.d.ts +38 -0
- package/dist/next/jobs/persisted.d.ts.map +1 -0
- package/dist/next/jobs/persisted.js +95 -0
- package/dist/next/jobs/persisted.js.map +1 -0
- package/dist/next/jobs/records.d.ts +231 -0
- package/dist/next/jobs/records.d.ts.map +1 -0
- package/dist/next/jobs/records.js +869 -0
- package/dist/next/jobs/records.js.map +1 -0
- package/dist/next/jobs/run-states.d.ts +69 -0
- package/dist/next/jobs/run-states.d.ts.map +1 -0
- package/dist/next/jobs/run-states.js +228 -0
- package/dist/next/jobs/run-states.js.map +1 -0
- package/dist/next/jobs/run.d.ts +113 -0
- package/dist/next/jobs/run.d.ts.map +1 -0
- package/dist/next/jobs/run.js +200 -0
- package/dist/next/jobs/run.js.map +1 -0
- package/dist/next/jobs/running.d.ts +44 -0
- package/dist/next/jobs/running.d.ts.map +1 -0
- package/dist/next/jobs/running.js +117 -0
- package/dist/next/jobs/running.js.map +1 -0
- package/dist/next/jobs/stored.d.ts +63 -0
- package/dist/next/jobs/stored.d.ts.map +1 -0
- package/dist/next/jobs/stored.js +55 -0
- package/dist/next/jobs/stored.js.map +1 -0
- package/dist/next/link/binary.d.ts +4 -0
- package/dist/next/link/binary.d.ts.map +1 -0
- package/dist/next/link/binary.js +534 -0
- package/dist/next/link/binary.js.map +1 -0
- package/dist/next/link/channel.d.ts +63 -0
- package/dist/next/link/channel.d.ts.map +1 -0
- package/dist/next/link/channel.js +202 -0
- package/dist/next/link/channel.js.map +1 -0
- package/dist/next/link/errors.d.ts +7 -0
- package/dist/next/link/errors.d.ts.map +1 -0
- package/dist/next/link/errors.js +21 -0
- package/dist/next/link/errors.js.map +1 -0
- package/dist/next/link/index.d.ts +8 -0
- package/dist/next/link/index.d.ts.map +1 -0
- package/dist/next/link/index.js +8 -0
- package/dist/next/link/index.js.map +1 -0
- package/dist/next/link/internal.d.ts +9 -0
- package/dist/next/link/internal.d.ts.map +1 -0
- package/dist/next/link/internal.js +10 -0
- package/dist/next/link/internal.js.map +1 -0
- package/dist/next/link/ipc.d.ts +22 -0
- package/dist/next/link/ipc.d.ts.map +1 -0
- package/dist/next/link/ipc.js +64 -0
- package/dist/next/link/ipc.js.map +1 -0
- package/dist/next/link/link.d.ts +34 -0
- package/dist/next/link/link.d.ts.map +1 -0
- package/dist/next/link/link.js +87 -0
- package/dist/next/link/link.js.map +1 -0
- package/dist/next/link/message.d.ts +249 -0
- package/dist/next/link/message.d.ts.map +1 -0
- package/dist/next/link/message.js +123 -0
- package/dist/next/link/message.js.map +1 -0
- package/dist/next/link/part.d.ts +80 -0
- package/dist/next/link/part.d.ts.map +1 -0
- package/dist/next/link/part.js +164 -0
- package/dist/next/link/part.js.map +1 -0
- package/dist/next/link/text.d.ts +6 -0
- package/dist/next/link/text.d.ts.map +1 -0
- package/dist/next/link/text.js +335 -0
- package/dist/next/link/text.js.map +1 -0
- package/dist/next/link/values.d.ts +40 -0
- package/dist/next/link/values.d.ts.map +1 -0
- package/dist/next/link/values.js +117 -0
- package/dist/next/link/values.js.map +1 -0
- package/dist/next/link/websocket.d.ts +26 -0
- package/dist/next/link/websocket.d.ts.map +1 -0
- package/dist/next/link/websocket.js +91 -0
- package/dist/next/link/websocket.js.map +1 -0
- package/dist/next/registries/contribution.d.ts +50 -0
- package/dist/next/registries/contribution.d.ts.map +1 -0
- package/dist/next/registries/contribution.js +129 -0
- package/dist/next/registries/contribution.js.map +1 -0
- package/dist/next/registries/entries.d.ts +18 -0
- package/dist/next/registries/entries.d.ts.map +1 -0
- package/dist/next/registries/entries.js +42 -0
- package/dist/next/registries/entries.js.map +1 -0
- package/dist/next/registries/index.d.ts +3 -0
- package/dist/next/registries/index.d.ts.map +1 -0
- package/dist/next/registries/index.js +5 -0
- package/dist/next/registries/index.js.map +1 -0
- package/dist/next/registries/internal.d.ts +4 -0
- package/dist/next/registries/internal.d.ts.map +1 -0
- package/dist/next/registries/internal.js +5 -0
- package/dist/next/registries/internal.js.map +1 -0
- package/dist/next/registries/record.d.ts +94 -0
- package/dist/next/registries/record.d.ts.map +1 -0
- package/dist/next/registries/record.js +253 -0
- package/dist/next/registries/record.js.map +1 -0
- package/dist/next/registries/registry.d.ts +74 -0
- package/dist/next/registries/registry.d.ts.map +1 -0
- package/dist/next/registries/registry.js +14 -0
- package/dist/next/registries/registry.js.map +1 -0
- package/dist/next/registries/value.d.ts +48 -0
- package/dist/next/registries/value.d.ts.map +1 -0
- package/dist/next/registries/value.js +199 -0
- package/dist/next/registries/value.js.map +1 -0
- package/dist/next/remote/calls.d.ts +25 -0
- package/dist/next/remote/calls.d.ts.map +1 -0
- package/dist/next/remote/calls.js +62 -0
- package/dist/next/remote/calls.js.map +1 -0
- package/dist/next/remote/consumer.d.ts +42 -0
- package/dist/next/remote/consumer.d.ts.map +1 -0
- package/dist/next/remote/consumer.js +343 -0
- package/dist/next/remote/consumer.js.map +1 -0
- package/dist/next/remote/hold.d.ts +130 -0
- package/dist/next/remote/hold.d.ts.map +1 -0
- package/dist/next/remote/hold.js +537 -0
- package/dist/next/remote/hold.js.map +1 -0
- package/dist/next/remote/host-link.d.ts +77 -0
- package/dist/next/remote/host-link.d.ts.map +1 -0
- package/dist/next/remote/host-link.js +182 -0
- package/dist/next/remote/host-link.js.map +1 -0
- package/dist/next/remote/internal.d.ts +6 -0
- package/dist/next/remote/internal.d.ts.map +1 -0
- package/dist/next/remote/internal.js +6 -0
- package/dist/next/remote/internal.js.map +1 -0
- package/dist/next/remote/path.d.ts +46 -0
- package/dist/next/remote/path.d.ts.map +1 -0
- package/dist/next/remote/path.js +73 -0
- package/dist/next/remote/path.js.map +1 -0
- package/dist/next/remote/provider.d.ts +76 -0
- package/dist/next/remote/provider.d.ts.map +1 -0
- package/dist/next/remote/provider.js +506 -0
- package/dist/next/remote/provider.js.map +1 -0
- package/dist/next/remote/relay.d.ts +58 -0
- package/dist/next/remote/relay.d.ts.map +1 -0
- package/dist/next/remote/relay.js +117 -0
- package/dist/next/remote/relay.js.map +1 -0
- package/dist/next/remote/remote-object.d.ts +133 -0
- package/dist/next/remote/remote-object.d.ts.map +1 -0
- package/dist/next/remote/remote-object.js +411 -0
- package/dist/next/remote/remote-object.js.map +1 -0
- package/dist/next/remote/replica.d.ts +59 -0
- package/dist/next/remote/replica.d.ts.map +1 -0
- package/dist/next/remote/replica.js +125 -0
- package/dist/next/remote/replica.js.map +1 -0
- package/dist/next/state/batch.d.ts +64 -0
- package/dist/next/state/batch.d.ts.map +1 -0
- package/dist/next/state/batch.js +163 -0
- package/dist/next/state/batch.js.map +1 -0
- package/dist/next/state/derive.d.ts +52 -0
- package/dist/next/state/derive.d.ts.map +1 -0
- package/dist/next/state/derive.js +182 -0
- package/dist/next/state/derive.js.map +1 -0
- package/dist/next/state/index.d.ts +6 -0
- package/dist/next/state/index.d.ts.map +1 -0
- package/dist/next/state/index.js +4 -0
- package/dist/next/state/index.js.map +1 -0
- package/dist/next/state/internal.d.ts +6 -0
- package/dist/next/state/internal.d.ts.map +1 -0
- package/dist/next/state/internal.js +8 -0
- package/dist/next/state/internal.js.map +1 -0
- package/dist/next/state/native-source.d.ts +106 -0
- package/dist/next/state/native-source.d.ts.map +1 -0
- package/dist/next/state/native-source.js +240 -0
- package/dist/next/state/native-source.js.map +1 -0
- package/dist/next/state/watchable.d.ts +114 -0
- package/dist/next/state/watchable.d.ts.map +1 -0
- package/dist/next/state/watchable.js +156 -0
- package/dist/next/state/watchable.js.map +1 -0
- package/dist/next/state/writable.d.ts +32 -0
- package/dist/next/state/writable.d.ts.map +1 -0
- package/dist/next/state/writable.js +49 -0
- package/dist/next/state/writable.js.map +1 -0
- package/dist/next/store/adapter.d.ts +67 -0
- package/dist/next/store/adapter.d.ts.map +1 -0
- package/dist/next/store/adapter.js +118 -0
- package/dist/next/store/adapter.js.map +1 -0
- package/dist/next/store/allocator.d.ts +17 -0
- package/dist/next/store/allocator.d.ts.map +1 -0
- package/dist/next/store/allocator.js +30 -0
- package/dist/next/store/allocator.js.map +1 -0
- package/dist/next/store/applier.d.ts +8 -0
- package/dist/next/store/applier.d.ts.map +1 -0
- package/dist/next/store/applier.js +375 -0
- package/dist/next/store/applier.js.map +1 -0
- package/dist/next/store/apply-batch.d.ts +12 -0
- package/dist/next/store/apply-batch.d.ts.map +1 -0
- package/dist/next/store/apply-batch.js +83 -0
- package/dist/next/store/apply-batch.js.map +1 -0
- package/dist/next/store/archive.d.ts +32 -0
- package/dist/next/store/archive.d.ts.map +1 -0
- package/dist/next/store/archive.js +129 -0
- package/dist/next/store/archive.js.map +1 -0
- package/dist/next/store/backend.d.ts +10 -0
- package/dist/next/store/backend.d.ts.map +1 -0
- package/dist/next/store/backend.js +15 -0
- package/dist/next/store/backend.js.map +1 -0
- package/dist/next/store/catalog.d.ts +24 -0
- package/dist/next/store/catalog.d.ts.map +1 -0
- package/dist/next/store/catalog.js +17 -0
- package/dist/next/store/catalog.js.map +1 -0
- package/dist/next/store/claims.d.ts +23 -0
- package/dist/next/store/claims.d.ts.map +1 -0
- package/dist/next/store/claims.js +65 -0
- package/dist/next/store/claims.js.map +1 -0
- package/dist/next/store/columns.d.ts +77 -0
- package/dist/next/store/columns.d.ts.map +1 -0
- package/dist/next/store/columns.js +77 -0
- package/dist/next/store/columns.js.map +1 -0
- package/dist/next/store/engine.d.ts +176 -0
- package/dist/next/store/engine.d.ts.map +1 -0
- package/dist/next/store/engine.js +283 -0
- package/dist/next/store/engine.js.map +1 -0
- package/dist/next/store/evaluate.d.ts +17 -0
- package/dist/next/store/evaluate.d.ts.map +1 -0
- package/dist/next/store/evaluate.js +128 -0
- package/dist/next/store/evaluate.js.map +1 -0
- package/dist/next/store/export.d.ts +17 -0
- package/dist/next/store/export.d.ts.map +1 -0
- package/dist/next/store/export.js +200 -0
- package/dist/next/store/export.js.map +1 -0
- package/dist/next/store/expression.d.ts +150 -0
- package/dist/next/store/expression.d.ts.map +1 -0
- package/dist/next/store/expression.js +268 -0
- package/dist/next/store/expression.js.map +1 -0
- package/dist/next/store/import.d.ts +10 -0
- package/dist/next/store/import.d.ts.map +1 -0
- package/dist/next/store/import.js +276 -0
- package/dist/next/store/import.js.map +1 -0
- package/dist/next/store/index.d.ts +16 -0
- package/dist/next/store/index.d.ts.map +1 -0
- package/dist/next/store/index.js +13 -0
- package/dist/next/store/index.js.map +1 -0
- package/dist/next/store/json-column.d.ts +33 -0
- package/dist/next/store/json-column.d.ts.map +1 -0
- package/dist/next/store/json-column.js +61 -0
- package/dist/next/store/json-column.js.map +1 -0
- package/dist/next/store/jsonl.d.ts +9 -0
- package/dist/next/store/jsonl.d.ts.map +1 -0
- package/dist/next/store/jsonl.js +61 -0
- package/dist/next/store/jsonl.js.map +1 -0
- package/dist/next/store/outbox.d.ts +26 -0
- package/dist/next/store/outbox.d.ts.map +1 -0
- package/dist/next/store/outbox.js +80 -0
- package/dist/next/store/outbox.js.map +1 -0
- package/dist/next/store/query.d.ts +39 -0
- package/dist/next/store/query.d.ts.map +1 -0
- package/dist/next/store/query.js +97 -0
- package/dist/next/store/query.js.map +1 -0
- package/dist/next/store/refusal.d.ts +15 -0
- package/dist/next/store/refusal.d.ts.map +1 -0
- package/dist/next/store/refusal.js +36 -0
- package/dist/next/store/refusal.js.map +1 -0
- package/dist/next/store/rows.d.ts +80 -0
- package/dist/next/store/rows.d.ts.map +1 -0
- package/dist/next/store/rows.js +183 -0
- package/dist/next/store/rows.js.map +1 -0
- package/dist/next/store/schema.d.ts +25 -0
- package/dist/next/store/schema.d.ts.map +1 -0
- package/dist/next/store/schema.js +115 -0
- package/dist/next/store/schema.js.map +1 -0
- package/dist/next/store/sql.d.ts +73 -0
- package/dist/next/store/sql.d.ts.map +1 -0
- package/dist/next/store/sql.js +234 -0
- package/dist/next/store/sql.js.map +1 -0
- package/dist/next/store/step.d.ts +48 -0
- package/dist/next/store/step.d.ts.map +1 -0
- package/dist/next/store/step.js +50 -0
- package/dist/next/store/step.js.map +1 -0
- package/dist/next/store/store.d.ts +161 -0
- package/dist/next/store/store.d.ts.map +1 -0
- package/dist/next/store/store.js +627 -0
- package/dist/next/store/store.js.map +1 -0
- package/dist/next/store/table-changes.d.ts +29 -0
- package/dist/next/store/table-changes.d.ts.map +1 -0
- package/dist/next/store/table-changes.js +102 -0
- package/dist/next/store/table-changes.js.map +1 -0
- package/dist/next/store/table-evolve.d.ts +74 -0
- package/dist/next/store/table-evolve.d.ts.map +1 -0
- package/dist/next/store/table-evolve.js +201 -0
- package/dist/next/store/table-evolve.js.map +1 -0
- package/dist/next/store/table-handle.d.ts +67 -0
- package/dist/next/store/table-handle.d.ts.map +1 -0
- package/dist/next/store/table-handle.js +101 -0
- package/dist/next/store/table-handle.js.map +1 -0
- package/dist/next/store/table-history.d.ts +75 -0
- package/dist/next/store/table-history.d.ts.map +1 -0
- package/dist/next/store/table-history.js +42 -0
- package/dist/next/store/table-history.js.map +1 -0
- package/dist/next/store/table-migration.d.ts +16 -0
- package/dist/next/store/table-migration.d.ts.map +1 -0
- package/dist/next/store/table-migration.js +202 -0
- package/dist/next/store/table-migration.js.map +1 -0
- package/dist/next/store/table-writes.d.ts +125 -0
- package/dist/next/store/table-writes.d.ts.map +1 -0
- package/dist/next/store/table-writes.js +165 -0
- package/dist/next/store/table-writes.js.map +1 -0
- package/dist/next/store/table.d.ts +80 -0
- package/dist/next/store/table.d.ts.map +1 -0
- package/dist/next/store/table.js +103 -0
- package/dist/next/store/table.js.map +1 -0
- package/dist/next/store/text.d.ts +14 -0
- package/dist/next/store/text.d.ts.map +1 -0
- package/dist/next/store/text.js +51 -0
- package/dist/next/store/text.js.map +1 -0
- package/dist/next/store/writes.d.ts +5 -0
- package/dist/next/store/writes.d.ts.map +1 -0
- package/dist/next/store/writes.js +4 -0
- package/dist/next/store/writes.js.map +1 -0
- package/dist/next-node/compression.d.ts +7 -0
- package/dist/next-node/compression.d.ts.map +1 -0
- package/dist/next-node/compression.js +24 -0
- package/dist/next-node/compression.js.map +1 -0
- package/dist/next-node/http/admission.d.ts +63 -0
- package/dist/next-node/http/admission.d.ts.map +1 -0
- package/dist/next-node/http/admission.js +134 -0
- package/dist/next-node/http/admission.js.map +1 -0
- package/dist/next-node/http/authenticate.d.ts +21 -0
- package/dist/next-node/http/authenticate.d.ts.map +1 -0
- package/dist/next-node/http/authenticate.js +34 -0
- package/dist/next-node/http/authenticate.js.map +1 -0
- package/dist/next-node/http/cookies.d.ts +24 -0
- package/dist/next-node/http/cookies.d.ts.map +1 -0
- package/dist/next-node/http/cookies.js +62 -0
- package/dist/next-node/http/cookies.js.map +1 -0
- package/dist/next-node/http/file.d.ts +23 -0
- package/dist/next-node/http/file.d.ts.map +1 -0
- package/dist/next-node/http/file.js +94 -0
- package/dist/next-node/http/file.js.map +1 -0
- package/dist/next-node/http/headers.d.ts +37 -0
- package/dist/next-node/http/headers.d.ts.map +1 -0
- package/dist/next-node/http/headers.js +129 -0
- package/dist/next-node/http/headers.js.map +1 -0
- package/dist/next-node/http/http.d.ts +100 -0
- package/dist/next-node/http/http.d.ts.map +1 -0
- package/dist/next-node/http/http.js +462 -0
- package/dist/next-node/http/http.js.map +1 -0
- package/dist/next-node/http/incoming.d.ts +19 -0
- package/dist/next-node/http/incoming.d.ts.map +1 -0
- package/dist/next-node/http/incoming.js +31 -0
- package/dist/next-node/http/incoming.js.map +1 -0
- package/dist/next-node/http/index.d.ts +11 -0
- package/dist/next-node/http/index.d.ts.map +1 -0
- package/dist/next-node/http/index.js +12 -0
- package/dist/next-node/http/index.js.map +1 -0
- package/dist/next-node/http/node.d.ts +78 -0
- package/dist/next-node/http/node.d.ts.map +1 -0
- package/dist/next-node/http/node.js +291 -0
- package/dist/next-node/http/node.js.map +1 -0
- package/dist/next-node/http/request.d.ts +54 -0
- package/dist/next-node/http/request.d.ts.map +1 -0
- package/dist/next-node/http/request.js +116 -0
- package/dist/next-node/http/request.js.map +1 -0
- package/dist/next-node/http/response.d.ts +63 -0
- package/dist/next-node/http/response.d.ts.map +1 -0
- package/dist/next-node/http/response.js +202 -0
- package/dist/next-node/http/response.js.map +1 -0
- package/dist/next-node/http/router.d.ts +114 -0
- package/dist/next-node/http/router.d.ts.map +1 -0
- package/dist/next-node/http/router.js +261 -0
- package/dist/next-node/http/router.js.map +1 -0
- package/dist/next-node/http/upgrades.d.ts +58 -0
- package/dist/next-node/http/upgrades.d.ts.map +1 -0
- package/dist/next-node/http/upgrades.js +184 -0
- package/dist/next-node/http/upgrades.js.map +1 -0
- package/dist/next-node/plugins/build.d.ts +57 -0
- package/dist/next-node/plugins/build.d.ts.map +1 -0
- package/dist/next-node/plugins/build.js +334 -0
- package/dist/next-node/plugins/build.js.map +1 -0
- package/dist/next-node/plugins/discover.d.ts +36 -0
- package/dist/next-node/plugins/discover.d.ts.map +1 -0
- package/dist/next-node/plugins/discover.js +91 -0
- package/dist/next-node/plugins/discover.js.map +1 -0
- package/dist/next-node/plugins/evaluate.d.ts +33 -0
- package/dist/next-node/plugins/evaluate.d.ts.map +1 -0
- package/dist/next-node/plugins/evaluate.js +98 -0
- package/dist/next-node/plugins/evaluate.js.map +1 -0
- package/dist/next-node/plugins/index.d.ts +9 -0
- package/dist/next-node/plugins/index.d.ts.map +1 -0
- package/dist/next-node/plugins/index.js +11 -0
- package/dist/next-node/plugins/index.js.map +1 -0
- package/dist/next-node/plugins/install.d.ts +13 -0
- package/dist/next-node/plugins/install.d.ts.map +1 -0
- package/dist/next-node/plugins/install.js +37 -0
- package/dist/next-node/plugins/install.js.map +1 -0
- package/dist/next-node/plugins/plugins.d.ts +135 -0
- package/dist/next-node/plugins/plugins.d.ts.map +1 -0
- package/dist/next-node/plugins/plugins.js +206 -0
- package/dist/next-node/plugins/plugins.js.map +1 -0
- package/dist/next-node/plugins/runtime.d.ts +41 -0
- package/dist/next-node/plugins/runtime.d.ts.map +1 -0
- package/dist/next-node/plugins/runtime.js +136 -0
- package/dist/next-node/plugins/runtime.js.map +1 -0
- package/dist/next-node/plugins/stack.d.ts +16 -0
- package/dist/next-node/plugins/stack.d.ts.map +1 -0
- package/dist/next-node/plugins/stack.js +61 -0
- package/dist/next-node/plugins/stack.js.map +1 -0
- package/dist/next-node/plugins/watcher.d.ts +58 -0
- package/dist/next-node/plugins/watcher.d.ts.map +1 -0
- package/dist/next-node/plugins/watcher.js +281 -0
- package/dist/next-node/plugins/watcher.js.map +1 -0
- package/dist/next-node/workers/control.d.ts +83 -0
- package/dist/next-node/workers/control.d.ts.map +1 -0
- package/dist/next-node/workers/control.js +77 -0
- package/dist/next-node/workers/control.js.map +1 -0
- package/dist/next-node/workers/index.d.ts +5 -0
- package/dist/next-node/workers/index.d.ts.map +1 -0
- package/dist/next-node/workers/index.js +7 -0
- package/dist/next-node/workers/index.js.map +1 -0
- package/dist/next-node/workers/lock.d.ts +21 -0
- package/dist/next-node/workers/lock.d.ts.map +1 -0
- package/dist/next-node/workers/lock.js +137 -0
- package/dist/next-node/workers/lock.js.map +1 -0
- package/dist/next-node/workers/main.d.ts +46 -0
- package/dist/next-node/workers/main.d.ts.map +1 -0
- package/dist/next-node/workers/main.js +230 -0
- package/dist/next-node/workers/main.js.map +1 -0
- package/dist/next-node/workers/process.d.ts +42 -0
- package/dist/next-node/workers/process.d.ts.map +1 -0
- package/dist/next-node/workers/process.js +125 -0
- package/dist/next-node/workers/process.js.map +1 -0
- package/dist/next-node/workers/workers.d.ts +80 -0
- package/dist/next-node/workers/workers.d.ts.map +1 -0
- package/dist/next-node/workers/workers.js +572 -0
- package/dist/next-node/workers/workers.js.map +1 -0
- package/dist/object.d.ts +4 -4
- package/dist/object.d.ts.map +1 -1
- package/dist/object.js +3 -4
- package/dist/object.js.map +1 -1
- package/dist/output.d.ts +9 -3
- package/dist/output.d.ts.map +1 -1
- package/dist/output.js +21 -9
- package/dist/output.js.map +1 -1
- package/dist/remote.d.ts.map +1 -1
- package/dist/remote.js +2 -2
- package/dist/remote.js.map +1 -1
- package/dist/schema.d.ts +8 -4
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +180 -5
- package/dist/schema.js.map +1 -1
- 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 +41 -0
- package/dist/sqlite/node.d.ts.map +1 -0
- package/dist/sqlite/node.js +191 -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/telemetry-sqlite/index.d.ts +24 -0
- package/dist/telemetry-sqlite/index.d.ts.map +1 -0
- package/dist/telemetry-sqlite/index.js +273 -0
- package/dist/telemetry-sqlite/index.js.map +1 -0
- package/dist/telemetry-sqlite/store.d.ts +9 -0
- package/dist/telemetry-sqlite/store.d.ts.map +1 -0
- package/dist/telemetry-sqlite/store.js +110 -0
- package/dist/telemetry-sqlite/store.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/wire.d.ts +174 -193
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +81 -80
- package/dist/wire.js.map +1 -1
- package/docs/guide.md +15 -15
- package/docs/next/benchmarks.md +959 -0
- package/docs/next/decisions.md +2957 -0
- package/docs/next/dependencies/book.md +1671 -0
- package/docs/next/dependencies/index.html +2641 -0
- package/docs/next/dependencies/model.md +330 -0
- package/docs/next/design.md +2554 -0
- package/docs/next/durable-observers/book.md +432 -0
- package/docs/next/durable-observers/index.html +517 -0
- package/docs/next/flow-control/book.md +333 -0
- package/docs/next/flow-control/fold/index.html +265 -0
- package/docs/next/flow-control/index.html +548 -0
- package/docs/next/flow-control/window/index.html +228 -0
- package/docs/next/guide-plugins-hosts/book.md +607 -0
- package/docs/next/guide-plugins-hosts/index.html +652 -0
- package/docs/next/http-workers/book.md +378 -0
- package/docs/next/http-workers/index.html +515 -0
- package/docs/next/layer-1.md +311 -0
- package/docs/next/layer-2.md +216 -0
- package/docs/next/plugin-model/book.md +186 -0
- package/docs/next/plugin-model/index.html +310 -0
- package/docs/next/plugin-primer/book.md +273 -0
- package/docs/next/plugin-primer/index.html +430 -0
- package/docs/next/slice-1.md +236 -0
- package/docs/next/slice-10.md +285 -0
- package/docs/next/slice-11.md +93 -0
- package/docs/next/slice-2.md +174 -0
- package/docs/next/slice-3a.md +296 -0
- package/docs/next/slice-3b.md +197 -0
- package/docs/next/slice-4.md +146 -0
- package/docs/next/slice-4a.md +418 -0
- package/docs/next/slice-4b.md +208 -0
- package/docs/next/slice-5.md +281 -0
- package/docs/next/slice-6a.md +676 -0
- package/docs/next/slice-6b.md +332 -0
- package/docs/next/slice-7a.md +130 -0
- package/docs/next/slice-7b/book.md +608 -0
- package/docs/next/slice-7b/index.html +842 -0
- package/docs/next/slice-7b.md +255 -0
- package/docs/next/slice-7c.md +165 -0
- package/docs/next/slice-8.md +194 -0
- package/docs/next/slices.md +230 -0
- package/docs/next/store/book.md +665 -0
- package/docs/next/store/index.html +861 -0
- package/docs/next/store/walkthrough.md +193 -0
- package/docs/spec.md +9 -9
- package/docs/tutorial.md +26 -25
- package/package.json +42 -5
- package/src/delta/README.md +69 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/next/data/errors.ts"],"names":[],"mappings":"AAAA,uHAAuH;AACvH,uDAAuD;AAIvD,6FAA6F;AAC7F,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAElC,2GAA2G;AAC3G,MAAM,CAAC,MAAM,mBAAmB,GAAG;IAClC,OAAO,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,cAAc,EAAE,WAAW,EAAE,iBAAiB,EAAE,OAAO,CAAC;IAC9F,iBAAiB,EAAE,CAAC,UAAU,CAAC;IAC/B,SAAS,EAAE,CAAC,SAAS,CAAC;IACtB,IAAI,EAAE,EAAE;IACR,SAAS,EAAE,EAAE;IACb,4GAA4G;IAC5G,4GAA4G;IAC5G,8CAA8C;IAC9C,QAAQ,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,CAAC;IAChE,SAAS,EAAE,CAAC,MAAM,CAAC;IACnB,0DAA0D;IAC1D,WAAW,EAAE,CAAC,QAAQ,EAAE,cAAc,EAAE,MAAM,EAAE,gBAAgB,EAAE,YAAY,CAAC;IAC/E,OAAO,EAAE,EAAE;CACF,CAAC;AAmBX,MAAM,eAAgB,SAAQ,KAAK;IACzB,IAAI,CAAiB;IACrB,MAAM,CAA+B;IACrC,OAAO,CAAwB;IAExC,YAAY,IAAoB,EAAE,OAAsB;QACvD,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC7B,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC;QACzB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACtB,IAAI,CAAC,MAAM,GAAG,IAAI,CAA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AAC,QAAQ,CAAC,MAAgB,CAAC,EAAE,CAAC;QACrF,MAAM,aAAa,CAAC,0BAA0B,IAAI,EAAE,CAAC,CAAC;IACvD,CAAC;IACD,IAAI,OAAO,OAAO,KAAK,QAAQ;QAAE,MAAM,aAAa,CAAC,yBAAyB,CAAC,CAAC;IAChF,0CAA0C;IAC1C,OAAO,IAAI,UAAU,CAAC,IAAsB,CAAC,CAAC;AAC/C,CAAC;AAED,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC;AAExE,SAAS,aAAa,CAAC,OAAe;IACrC,OAAO,IAAI,KAAK,CAAC,4BAA4B,OAAO,EAAE,CAAC,CAAC;AACzD,CAAC","sourcesContent":["// ChordError: Chord's one error type, its codes and reasons (link protocol) and its wire form; and PluginError, what a\n// plugin throws to give its callers a code of its own.\n\nimport type { JsonValue } from \"../../json.ts\";\n\n/** Version of the error table below on links; adding or moving a code or reason bumps it. */\nexport const PROTOCOL_VERSION = 1;\n\n/** Every code with the reasons it may carry. `invalid` requires a reason; every other code may omit it. */\nexport const CHORD_ERROR_REASONS = {\n\tinvalid: [\"args\", \"params\", \"member\", \"host_address\", \"reentrant\", \"read_after_bulk\", \"cycle\"],\n\tcontract_mismatch: [\"updating\"],\n\tforbidden: [\"revoked\"],\n\tgone: [],\n\tnot_ready: [],\n\t// No reason: released by its holder. `ended`: its object ended; `closed`: its host, store or native closed;\n\t// `settled`: used after the call or run it belonged to settled; `version`: an old handle after a migration;\n\t// `discarded`: a transaction cut at the seal.\n\treleased: [\"ended\", \"closed\", \"settled\", \"version\", \"discarded\"],\n\ttoo_large: [\"part\"],\n\t// `undeclared`: a registry no plugin serves on this host.\n\tunavailable: [\"locked\", \"park_timeout\", \"busy\", \"storage_failed\", \"undeclared\"],\n\taborted: [],\n} as const;\n\nexport type ChordErrorCode = keyof typeof CHORD_ERROR_REASONS;\n\nexport type ChordErrorReason<C extends ChordErrorCode = ChordErrorCode> = (typeof CHORD_ERROR_REASONS)[C][number];\n\n/** The wire form of a ChordError and its constructor argument: one member per code, so wrong pairings fail to type. */\ntype ChordErrorJson = { [C in ChordErrorCode]: ErrorFields<C> }[ChordErrorCode];\n\ntype ErrorFields<C extends ChordErrorCode> = {\n\treadonly code: C;\n\treadonly message: string;\n\treadonly details?: JsonValue;\n} & (C extends \"invalid\"\n\t? { readonly reason: ChordErrorReason<C> }\n\t: [ChordErrorReason<C>] extends [never]\n\t\t? { readonly reason?: undefined }\n\t\t: { readonly reason?: ChordErrorReason<C> });\n\nclass ChordErrorClass extends Error {\n\treadonly code: ChordErrorCode;\n\treadonly reason: ChordErrorReason | undefined;\n\treadonly details: JsonValue | undefined;\n\n\tconstructor(init: ChordErrorJson, options?: ErrorOptions) {\n\t\tsuper(init.message, options);\n\t\tthis.name = \"ChordError\";\n\t\tthis.code = init.code;\n\t\tthis.reason = init.reason;\n\t\tthis.details = init.details;\n\t}\n\n\t/** The wire form; stack and cause never cross a link. */\n\ttoJSON(): ChordErrorJson {\n\t\tconst { code, reason, message, details } = this;\n\t\t// The fields were copied from a ChordErrorJson, so the pairing holds.\n\t\treturn {\n\t\t\tcode,\n\t\t\t...(reason === undefined ? {} : { reason }),\n\t\t\tmessage,\n\t\t\t...(details === undefined ? {} : { details }),\n\t\t} as ChordErrorJson;\n\t}\n}\n\n/** A Chord failure. Narrowing on `code` narrows `reason`. */\nexport type ChordError = ChordErrorClass & ChordErrorJson;\n\n/**\n * Creates a ChordError: `new ChordError({ code: \"invalid\", reason: \"args\", message })`. A class cannot declare its\n * instances as a tagged union; this constructor signature does.\n */\nexport const ChordError = ChordErrorClass as new (init: ChordErrorJson, options?: ErrorOptions) => ChordError;\n\n/** Whether `error` is a ChordError, optionally with the given code. */\nexport function isChordError<C extends ChordErrorCode = ChordErrorCode>(\n\terror: unknown,\n\tcode?: C,\n): error is Extract<ChordError, { readonly code: C }> {\n\treturn error instanceof ChordError && (code === undefined || error.code === code);\n}\n\n/**\n * An error a plugin throws for its callers: its own `code`, a message and JSON `details`. Only these cross a link\n * (never a stack or a cause); a consumer rethrows it as a PluginError.\n */\nexport class PluginError extends Error {\n\treadonly code: string;\n\treadonly details: JsonValue | undefined;\n\n\tconstructor(code: string, message: string, details?: JsonValue) {\n\t\tsuper(message);\n\t\tthis.name = \"PluginError\";\n\t\tthis.code = code;\n\t\tthis.details = details;\n\t}\n}\n\n/** An `invalid` error with the given reason. */\nexport function invalid(\n\treason: ChordErrorReason<\"invalid\">,\n\tmessage: string,\n\tdetails?: JsonValue,\n): Extract<ChordError, { readonly code: \"invalid\" }> {\n\t// The constructor's return type cannot narrow on its argument.\n\treturn new ChordError({ code: \"invalid\", reason, message, details }) as Extract<ChordError, { code: \"invalid\" }>;\n}\n\n/** `error` itself when it is a ChordError, otherwise an `unavailable` error naming `label`, with `error` as cause. */\nexport function asChordError(error: unknown, label: string): ChordError {\n\tif (isChordError(error)) return error;\n\tconst message = error instanceof Error ? error.message : String(error);\n\treturn new ChordError({ code: \"unavailable\", message: `${label}: ${message}` }, { cause: error });\n}\n\n/**\n * Rebuilds a ChordError from a link. Checks the envelope only: a known code, a reason allowed for it (required for\n * `invalid`), a string message, no other keys. `details` is kept by reference.\n */\nexport function chordErrorFromJson(raw: unknown): ChordError {\n\t// Trust boundary: `raw` is fresh JSON from the link decoder.\n\tif (typeof raw !== \"object\" || raw === null || Array.isArray(raw)) throw envelopeError(\"not an object\");\n\tconst json = raw as Record<string, unknown>;\n\tfor (const key of Object.keys(json)) if (!ENVELOPE_KEYS.has(key)) throw envelopeError(`unknown key \"${key}\"`);\n\tconst { code, reason, message } = json;\n\tif (typeof code !== \"string\" || !Object.hasOwn(CHORD_ERROR_REASONS, code)) throw envelopeError(\"unknown code\");\n\tconst reasons: readonly string[] = CHORD_ERROR_REASONS[code as ChordErrorCode];\n\tif (reason === undefined ? code === \"invalid\" : !reasons.includes(reason as string)) {\n\t\tthrow envelopeError(`reason not allowed for ${code}`);\n\t}\n\tif (typeof message !== \"string\") throw envelopeError(\"message is not a string\");\n\t// The checks above establish the pairing.\n\treturn new ChordError(json as ChordErrorJson);\n}\n\nconst ENVELOPE_KEYS = new Set([\"code\", \"reason\", \"message\", \"details\"]);\n\nfunction envelopeError(problem: string): Error {\n\treturn new Error(`Invalid ChordError JSON: ${problem}`);\n}\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ChordError } from "./errors.ts";
|
|
2
|
+
/** Why an object, or a request, is failed; the kind comes from the failing stage, never from the error code. */
|
|
3
|
+
export type FailureCause = {
|
|
4
|
+
readonly kind: "transient";
|
|
5
|
+
readonly error: ChordError;
|
|
6
|
+
} | {
|
|
7
|
+
readonly kind: "broken";
|
|
8
|
+
readonly error: ChordError;
|
|
9
|
+
} | {
|
|
10
|
+
readonly kind: "waiting";
|
|
11
|
+
readonly error: ChordError;
|
|
12
|
+
};
|
|
13
|
+
/** Marks an open's failure as broken (bad configuration): `throw broken(error)`. */
|
|
14
|
+
export declare function broken(cause: unknown): Error;
|
|
15
|
+
/** The cause of a value thrown by an open: broken when it came from `broken()`, transient otherwise. */
|
|
16
|
+
export declare function openFailure(thrown: unknown, label: string): FailureCause;
|
|
17
|
+
/**
|
|
18
|
+
* The `waiting` cause of a dependent parked on `blocker`, which failed with `error`: `unavailable`, its message always
|
|
19
|
+
* "waiting for <blocker>: <root cause>" (the root found through any "waiting for …: " of `error`'s message), so a ring
|
|
20
|
+
* of waiting attempts passing causes round reaches the same message after one round; within 500 characters, the
|
|
21
|
+
* label clipped first, the root only past its share. `error` is its cause.
|
|
22
|
+
*/
|
|
23
|
+
export declare function waitingFor(blocker: string, error: ChordError): FailureCause;
|
|
24
|
+
/** Whether two failure causes say the same (a wake compares causes by value): kind, code, reason and message. */
|
|
25
|
+
export declare function sameCause(a: FailureCause, b: FailureCause): boolean;
|
|
26
|
+
//# sourceMappingURL=failure.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"failure.d.ts","sourceRoot":"","sources":["../../../src/next/data/failure.ts"],"names":[],"mappings":"AAIA,OAAO,EAAgB,UAAU,EAAE,MAAM,aAAa,CAAC;AAEvD,gHAAgH;AAChH,MAAM,MAAM,YAAY,GACrB;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAA;CAAE,GAC1D;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAA;CAAE,GACvD;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAA;CAAE,CAAC;AAE5D,oFAAoF;AACpF,wBAAgB,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,CAE5C;AAED,wGAAwG;AACxG,wBAAgB,WAAW,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,YAAY,CAGxE;AAiBD;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,YAAY,CAW3E;AAkBD,iHAAiH;AACjH,wBAAgB,SAAS,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,YAAY,GAAG,OAAO,CAMnE"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// Failure causes: transient (the object's own effect failed: retry later), broken (its own code, a cycle or authority:
|
|
2
|
+
// retry by hand) or waiting (not its fault: no provider, no fitting version, a dependency that failed; woken by an
|
|
3
|
+
// event). The failing stage decides, never the error code.
|
|
4
|
+
import { asChordError, ChordError } from "./errors.js";
|
|
5
|
+
/** Marks an open's failure as broken (bad configuration): `throw broken(error)`. */
|
|
6
|
+
export function broken(cause) {
|
|
7
|
+
return new BrokenOpen(cause);
|
|
8
|
+
}
|
|
9
|
+
/** The cause of a value thrown by an open: broken when it came from `broken()`, transient otherwise. */
|
|
10
|
+
export function openFailure(thrown, label) {
|
|
11
|
+
if (thrown instanceof BrokenOpen)
|
|
12
|
+
return { kind: "broken", error: asChordError(thrown.cause, label) };
|
|
13
|
+
return { kind: "transient", error: asChordError(thrown, label) };
|
|
14
|
+
}
|
|
15
|
+
/** The longest message a `waiting` cause of a dependent carries (telemetry's rule for error messages). */
|
|
16
|
+
const MESSAGE_LIMIT = 500;
|
|
17
|
+
/** How a dependent's message names its blocker: the nearest one first. */
|
|
18
|
+
const PREFIX = "waiting for ";
|
|
19
|
+
/** The separator after a blocker's label. */
|
|
20
|
+
const SEPARATOR = ": ";
|
|
21
|
+
/** The marker of a clipped label or root. */
|
|
22
|
+
const CLIPPED = "…";
|
|
23
|
+
/** The most of the 500 characters the root cause takes when both are long: the nearest blocker keeps the rest. */
|
|
24
|
+
const ROOT_LIMIT = 320;
|
|
25
|
+
/**
|
|
26
|
+
* The `waiting` cause of a dependent parked on `blocker`, which failed with `error`: `unavailable`, its message always
|
|
27
|
+
* "waiting for <blocker>: <root cause>" (the root found through any "waiting for …: " of `error`'s message), so a ring
|
|
28
|
+
* of waiting attempts passing causes round reaches the same message after one round; within 500 characters, the
|
|
29
|
+
* label clipped first, the root only past its share. `error` is its cause.
|
|
30
|
+
*/
|
|
31
|
+
export function waitingFor(blocker, error) {
|
|
32
|
+
let root = rootMessage(error.message);
|
|
33
|
+
let label = blocker;
|
|
34
|
+
const room = MESSAGE_LIMIT - PREFIX.length - SEPARATOR.length;
|
|
35
|
+
if (label.length + root.length > room) {
|
|
36
|
+
const rootRoom = Math.max(ROOT_LIMIT, room - label.length);
|
|
37
|
+
if (root.length > rootRoom)
|
|
38
|
+
root = clipped(root, rootRoom);
|
|
39
|
+
if (label.length + root.length > room)
|
|
40
|
+
label = clipped(label, room - root.length);
|
|
41
|
+
}
|
|
42
|
+
const message = `${PREFIX}${label}${SEPARATOR}${root}`;
|
|
43
|
+
return { kind: "waiting", error: new ChordError({ code: "unavailable", message }, { cause: error }) };
|
|
44
|
+
}
|
|
45
|
+
/** `text` within `length` characters, clipped with "…" when longer. */
|
|
46
|
+
function clipped(text, length) {
|
|
47
|
+
return text.length <= length ? text : `${text.slice(0, length - CLIPPED.length)}${CLIPPED}`;
|
|
48
|
+
}
|
|
49
|
+
/** The root cause in a "waiting for X: root" message: past every leading "waiting for …: ". */
|
|
50
|
+
function rootMessage(message) {
|
|
51
|
+
let rest = message;
|
|
52
|
+
while (rest.startsWith(PREFIX)) {
|
|
53
|
+
const end = rest.indexOf(SEPARATOR, PREFIX.length);
|
|
54
|
+
if (end < 0)
|
|
55
|
+
break;
|
|
56
|
+
rest = rest.slice(end + SEPARATOR.length);
|
|
57
|
+
}
|
|
58
|
+
return rest;
|
|
59
|
+
}
|
|
60
|
+
/** Whether two failure causes say the same (a wake compares causes by value): kind, code, reason and message. */
|
|
61
|
+
export function sameCause(a, b) {
|
|
62
|
+
const { error: left } = a;
|
|
63
|
+
const { error: right } = b;
|
|
64
|
+
return (a.kind === b.kind && left.code === right.code && left.reason === right.reason && left.message === right.message);
|
|
65
|
+
}
|
|
66
|
+
class BrokenOpen extends Error {
|
|
67
|
+
constructor(cause) {
|
|
68
|
+
super(cause instanceof Error ? cause.message : String(cause), { cause });
|
|
69
|
+
this.name = "BrokenOpen";
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=failure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"failure.js","sourceRoot":"","sources":["../../../src/next/data/failure.ts"],"names":[],"mappings":"AAAA,uHAAuH;AACvH,mHAAmH;AACnH,2DAA2D;AAE3D,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAQvD,oFAAoF;AACpF,MAAM,UAAU,MAAM,CAAC,KAAc;IACpC,OAAO,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC;AAED,wGAAwG;AACxG,MAAM,UAAU,WAAW,CAAC,MAAe,EAAE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AC,MAAM,KAAK,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC,OAAO,KAAK,KAAK,CAAC,OAAO,CAC/G,CAAC;AACH,CAAC;AAED,MAAM,UAAW,SAAQ,KAAK;IAC7B,YAAY,KAAc;QACzB,KAAK,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QACzE,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC;IAC1B,CAAC;CACD","sourcesContent":["// Failure causes: transient (the object's own effect failed: retry later), broken (its own code, a cycle or authority:\n// retry by hand) or waiting (not its fault: no provider, no fitting version, a dependency that failed; woken by an\n// event). The failing stage decides, never the error code.\n\nimport { asChordError, ChordError } from \"./errors.ts\";\n\n/** Why an object, or a request, is failed; the kind comes from the failing stage, never from the error code. */\nexport type FailureCause =\n\t| { readonly kind: \"transient\"; readonly error: ChordError }\n\t| { readonly kind: \"broken\"; readonly error: ChordError }\n\t| { readonly kind: \"waiting\"; readonly error: ChordError };\n\n/** Marks an open's failure as broken (bad configuration): `throw broken(error)`. */\nexport function broken(cause: unknown): Error {\n\treturn new BrokenOpen(cause);\n}\n\n/** The cause of a value thrown by an open: broken when it came from `broken()`, transient otherwise. */\nexport function openFailure(thrown: unknown, label: string): FailureCause {\n\tif (thrown instanceof BrokenOpen) return { kind: \"broken\", error: asChordError(thrown.cause, label) };\n\treturn { kind: \"transient\", error: asChordError(thrown, label) };\n}\n\n/** The longest message a `waiting` cause of a dependent carries (telemetry's rule for error messages). */\nconst MESSAGE_LIMIT = 500;\n\n/** How a dependent's message names its blocker: the nearest one first. */\nconst PREFIX = \"waiting for \";\n\n/** The separator after a blocker's label. */\nconst SEPARATOR = \": \";\n\n/** The marker of a clipped label or root. */\nconst CLIPPED = \"…\";\n\n/** The most of the 500 characters the root cause takes when both are long: the nearest blocker keeps the rest. */\nconst ROOT_LIMIT = 320;\n\n/**\n * The `waiting` cause of a dependent parked on `blocker`, which failed with `error`: `unavailable`, its message always\n * \"waiting for <blocker>: <root cause>\" (the root found through any \"waiting for …: \" of `error`'s message), so a ring\n * of waiting attempts passing causes round reaches the same message after one round; within 500 characters, the\n * label clipped first, the root only past its share. `error` is its cause.\n */\nexport function waitingFor(blocker: string, error: ChordError): FailureCause {\n\tlet root = rootMessage(error.message);\n\tlet label = blocker;\n\tconst room = MESSAGE_LIMIT - PREFIX.length - SEPARATOR.length;\n\tif (label.length + root.length > room) {\n\t\tconst rootRoom = Math.max(ROOT_LIMIT, room - label.length);\n\t\tif (root.length > rootRoom) root = clipped(root, rootRoom);\n\t\tif (label.length + root.length > room) label = clipped(label, room - root.length);\n\t}\n\tconst message = `${PREFIX}${label}${SEPARATOR}${root}`;\n\treturn { kind: \"waiting\", error: new ChordError({ code: \"unavailable\", message }, { cause: error }) };\n}\n\n/** `text` within `length` characters, clipped with \"…\" when longer. */\nfunction clipped(text: string, length: number): string {\n\treturn text.length <= length ? text : `${text.slice(0, length - CLIPPED.length)}${CLIPPED}`;\n}\n\n/** The root cause in a \"waiting for X: root\" message: past every leading \"waiting for …: \". */\nfunction rootMessage(message: string): string {\n\tlet rest = message;\n\twhile (rest.startsWith(PREFIX)) {\n\t\tconst end = rest.indexOf(SEPARATOR, PREFIX.length);\n\t\tif (end < 0) break;\n\t\trest = rest.slice(end + SEPARATOR.length);\n\t}\n\treturn rest;\n}\n\n/** Whether two failure causes say the same (a wake compares causes by value): kind, code, reason and message. */\nexport function sameCause(a: FailureCause, b: FailureCause): boolean {\n\tconst { error: left } = a;\n\tconst { error: right } = b;\n\treturn (\n\t\ta.kind === b.kind && left.code === right.code && left.reason === right.reason && left.message === right.message\n\t);\n}\n\nclass BrokenOpen extends Error {\n\tconstructor(cause: unknown) {\n\t\tsuper(cause instanceof Error ? cause.message : String(cause), { cause });\n\t\tthis.name = \"BrokenOpen\";\n\t}\n}\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { ChordError, type ChordErrorCode, type ChordErrorReason, isChordError, PluginError, } from "./errors.ts";
|
|
2
|
+
export { broken, type FailureCause } from "./failure.ts";
|
|
3
|
+
export type { Principal, PrincipalKeyFunction } from "./principal.ts";
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/next/data/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACN,UAAU,EACV,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,YAAY,EACZ,WAAW,GACX,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,MAAM,EAAE,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AACzD,YAAY,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/next/data/index.ts"],"names":[],"mappings":"AAAA,uHAAuH;AAEvH,OAAO,EACN,UAAU,EAGV,YAAY,EACZ,WAAW,GACX,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,MAAM,EAAqB,MAAM,cAAc,CAAC","sourcesContent":["// Data for apps: Chord's errors and plugin errors, principals, and how a plugin's open reports a broken configuration.\n\nexport {\n\tChordError,\n\ttype ChordErrorCode,\n\ttype ChordErrorReason,\n\tisChordError,\n\tPluginError,\n} from \"./errors.ts\";\nexport { broken, type FailureCause } from \"./failure.ts\";\nexport type { Principal, PrincipalKeyFunction } from \"./principal.ts\";\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { bindProvider, binds, type CheckedArgs, checkArgs, type Provider, type Value } from "./args.ts";
|
|
2
|
+
export { asChordError, CHORD_ERROR_REASONS, chordErrorFromJson, invalid, PROTOCOL_VERSION, } from "./errors.ts";
|
|
3
|
+
export { openFailure, sameCause, waitingFor } from "./failure.ts";
|
|
4
|
+
export { checkAddress, checkParams, identityKey } from "./params.ts";
|
|
5
|
+
export { canonicalJson, principalKey } from "./principal.ts";
|
|
6
|
+
export { check, validatorFor } from "./validator.ts";
|
|
7
|
+
//# sourceMappingURL=internal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/next/data/internal.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,KAAK,WAAW,EAAE,SAAS,EAAE,KAAK,QAAQ,EAAE,KAAK,KAAK,EAAE,MAAM,WAAW,CAAC;AACxG,OAAO,EACN,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,OAAO,EACP,gBAAgB,GAChB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Data for Chord's layers: per-call checks of params and arguments, principal keys, and errors on the wire.
|
|
2
|
+
export { bindProvider, binds, checkArgs } from "./args.js";
|
|
3
|
+
export { asChordError, CHORD_ERROR_REASONS, chordErrorFromJson, invalid, PROTOCOL_VERSION, } from "./errors.js";
|
|
4
|
+
export { openFailure, sameCause, waitingFor } from "./failure.js";
|
|
5
|
+
export { checkAddress, checkParams, identityKey } from "./params.js";
|
|
6
|
+
export { canonicalJson, principalKey } from "./principal.js";
|
|
7
|
+
export { check, validatorFor } from "./validator.js";
|
|
8
|
+
//# sourceMappingURL=internal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/next/data/internal.ts"],"names":[],"mappings":"AAAA,4GAA4G;AAE5G,OAAO,EAAE,YAAY,EAAE,KAAK,EAAoB,SAAS,EAA6B,MAAM,WAAW,CAAC;AACxG,OAAO,EACN,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,OAAO,EACP,gBAAgB,GAChB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC","sourcesContent":["// Data for Chord's layers: per-call checks of params and arguments, principal keys, and errors on the wire.\n\nexport { bindProvider, binds, type CheckedArgs, checkArgs, type Provider, type Value } from \"./args.ts\";\nexport {\n\tasChordError,\n\tCHORD_ERROR_REASONS,\n\tchordErrorFromJson,\n\tinvalid,\n\tPROTOCOL_VERSION,\n} from \"./errors.ts\";\nexport { openFailure, sameCause, waitingFor } from \"./failure.ts\";\nexport { checkAddress, checkParams, identityKey } from \"./params.ts\";\nexport { canonicalJson, principalKey } from \"./principal.ts\";\nexport { check, validatorFor } from \"./validator.ts\";\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Context } from "../../context/index.ts";
|
|
2
|
+
import { type Contract, type ParamsOf, type ShapeOf } from "../contracts/contract.ts";
|
|
3
|
+
import { type Address } from "../contracts/host-kind.ts";
|
|
4
|
+
import { type ParamsData } from "../contracts/params.ts";
|
|
5
|
+
/**
|
|
6
|
+
* Checks `raw` against the contract's params with one compiled closed-object check (`invalid/params` on failure) and
|
|
7
|
+
* returns the caller's own object with its key: the field values in declared order, each escaped, joined with `|`.
|
|
8
|
+
*/
|
|
9
|
+
export declare function checkParams<C extends Contract>(contract: C, raw: unknown, context: Context): {
|
|
10
|
+
readonly params: ParamsOf<C>;
|
|
11
|
+
readonly key: string;
|
|
12
|
+
};
|
|
13
|
+
/** The in-process identity of an object: `name|key|principalKey`, each part escaped; `local` has no principal. */
|
|
14
|
+
export declare function identityKey<C extends Contract>(contract: C, key: string, ...principalKey: ShapeOf<C>["kind"] extends "local" ? [] : [principalKey: string]): string;
|
|
15
|
+
/**
|
|
16
|
+
* An address from a kind's name and params as a hold names it or a `hostAddress` returned it: the params checked
|
|
17
|
+
* against the kind's with one compiled closed-object check (`invalid/host_address` on failure), the key computed.
|
|
18
|
+
*/
|
|
19
|
+
export declare function checkAddress(kind: string, params: ParamsData, raw: unknown, context: Context): Address;
|
|
20
|
+
//# sourceMappingURL=params.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"params.d.ts","sourceRoot":"","sources":["../../../src/next/data/params.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,KAAK,QAAQ,EAAgB,KAAK,QAAQ,EAAE,KAAK,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACpG,OAAO,EAAE,KAAK,OAAO,EAAc,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAW,KAAK,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAGlE;;;GAGG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,QAAQ,EAC7C,QAAQ,EAAE,CAAC,EACX,GAAG,EAAE,OAAO,EACZ,OAAO,EAAE,OAAO,GACd;IAAE,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAMxD;AAED,kHAAkH;AAClH,wBAAgB,WAAW,CAAC,CAAC,SAAS,QAAQ,EAC7C,QAAQ,EAAE,CAAC,EACX,GAAG,EAAE,MAAM,EACX,GAAG,YAAY,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,OAAO,GAAG,EAAE,GAAG,CAAC,YAAY,EAAE,MAAM,CAAC,GAC/E,MAAM,CAER;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAKtG"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// Params and identity: the checked params of a get, their key, and the in-process identity of an object.
|
|
2
|
+
import { contractData } from "../contracts/contract.js";
|
|
3
|
+
import { addressKey } from "../contracts/host-kind.js";
|
|
4
|
+
import { joinKey } from "../contracts/params.js";
|
|
5
|
+
import { check, validatorFor } from "./validator.js";
|
|
6
|
+
/**
|
|
7
|
+
* Checks `raw` against the contract's params with one compiled closed-object check (`invalid/params` on failure) and
|
|
8
|
+
* returns the caller's own object with its key: the field values in declared order, each escaped, joined with `|`.
|
|
9
|
+
*/
|
|
10
|
+
export function checkParams(contract, raw, context) {
|
|
11
|
+
const { params } = contractData(contract);
|
|
12
|
+
check(validatorFor(params, context), raw, "params", context);
|
|
13
|
+
// The check above establishes the params type.
|
|
14
|
+
const checked = raw;
|
|
15
|
+
return { params: checked, key: joinKey(params.fields.map((field) => String(checked[field]))) };
|
|
16
|
+
}
|
|
17
|
+
/** The in-process identity of an object: `name|key|principalKey`, each part escaped; `local` has no principal. */
|
|
18
|
+
export function identityKey(contract, key, ...principalKey) {
|
|
19
|
+
return joinKey([contract.name, key, ...principalKey]);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* An address from a kind's name and params as a hold names it or a `hostAddress` returned it: the params checked
|
|
23
|
+
* against the kind's with one compiled closed-object check (`invalid/host_address` on failure), the key computed.
|
|
24
|
+
*/
|
|
25
|
+
export function checkAddress(kind, params, raw, context) {
|
|
26
|
+
check(validatorFor(params, context), raw, "host_address", context);
|
|
27
|
+
// The check above establishes a flat record of the kind's scalar fields.
|
|
28
|
+
const values = raw;
|
|
29
|
+
return { kind, params: values, key: addressKey(kind, params, values) };
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=params.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"params.js","sourceRoot":"","sources":["../../../src/next/data/params.ts"],"names":[],"mappings":"AAAA,yGAAyG;AAGzG,OAAO,EAAiB,YAAY,EAA+B,MAAM,0BAA0B,CAAC;AACpG,OAAO,EAAgB,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,OAAO,EAAmB,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAErD;;;GAGG;AACH,MAAM,UAAU,WAAW,CAC1B,QAAW,EACX,GAAY,EACZ,OAAgB;IAEhB,MAAM,EAAE,MAAM,EAAE,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;IAC1C,KAAK,CAAC,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC7D,+CAA+C;IAC/C,MAAM,OAAO,GAAG,GAA4E,CAAC;IAC7F,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAChG,CAAC;AAED,kHAAkH;AAClH,MAAM,UAAU,WAAW,CAC1B,QAAW,EACX,GAAW,EACX,GAAG,YAA8E;IAEjF,OAAO,OAAO,CAAC,CAAC,QAAQ,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,YAAY,CAAC,CAAC,CAAC;AACvD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,IAAY,EAAE,MAAkB,EAAE,GAAY,EAAE,OAAgB;IAC5F,KAAK,CAAC,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,cAAc,EAAE,OAAO,CAAC,CAAC;IACnE,yEAAyE;IACzE,MAAM,MAAM,GAAG,GAA8D,CAAC;IAC9E,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;AACxE,CAAC","sourcesContent":["// Params and identity: the checked params of a get, their key, and the in-process identity of an object.\n\nimport type { Context } from \"../../context/index.ts\";\nimport { type Contract, contractData, type ParamsOf, type ShapeOf } from \"../contracts/contract.ts\";\nimport { type Address, addressKey } from \"../contracts/host-kind.ts\";\nimport { joinKey, type ParamsData } from \"../contracts/params.ts\";\nimport { check, validatorFor } from \"./validator.ts\";\n\n/**\n * Checks `raw` against the contract's params with one compiled closed-object check (`invalid/params` on failure) and\n * returns the caller's own object with its key: the field values in declared order, each escaped, joined with `|`.\n */\nexport function checkParams<C extends Contract>(\n\tcontract: C,\n\traw: unknown,\n\tcontext: Context,\n): { readonly params: ParamsOf<C>; readonly key: string } {\n\tconst { params } = contractData(contract);\n\tcheck(validatorFor(params, context), raw, \"params\", context);\n\t// The check above establishes the params type.\n\tconst checked = raw as ParamsOf<C> & { readonly [field: string]: string | number | boolean };\n\treturn { params: checked, key: joinKey(params.fields.map((field) => String(checked[field]))) };\n}\n\n/** The in-process identity of an object: `name|key|principalKey`, each part escaped; `local` has no principal. */\nexport function identityKey<C extends Contract>(\n\tcontract: C,\n\tkey: string,\n\t...principalKey: ShapeOf<C>[\"kind\"] extends \"local\" ? [] : [principalKey: string]\n): string {\n\treturn joinKey([contract.name, key, ...principalKey]);\n}\n\n/**\n * An address from a kind's name and params as a hold names it or a `hostAddress` returned it: the params checked\n * against the kind's with one compiled closed-object check (`invalid/host_address` on failure), the key computed.\n */\nexport function checkAddress(kind: string, params: ParamsData, raw: unknown, context: Context): Address {\n\tcheck(validatorFor(params, context), raw, \"host_address\", context);\n\t// The check above establishes a flat record of the kind's scalar fields.\n\tconst values = raw as { readonly [field: string]: string | number | boolean };\n\treturn { kind, params: values, key: addressKey(kind, params, values) };\n}\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Context } from "../../context/index.ts";
|
|
2
|
+
import type { JsonValue } from "../../json.ts";
|
|
3
|
+
/** An app's principal: plain JSON with a `kind`. Chord never persists it. */
|
|
4
|
+
export type Principal = {
|
|
5
|
+
readonly kind: string;
|
|
6
|
+
readonly [field: string]: JsonValue;
|
|
7
|
+
};
|
|
8
|
+
/** An app's own principal key; it must be the same function on every host. */
|
|
9
|
+
export type PrincipalKeyFunction<P extends Principal = Principal> = (principal: P) => string;
|
|
10
|
+
/**
|
|
11
|
+
* The key of a principal: its canonical JSON, or `customKey(principal)`. Cached per principal object; a custom key's
|
|
12
|
+
* cache is keyed by the function too, so a live principal never retains a dropped function.
|
|
13
|
+
*/
|
|
14
|
+
export declare function principalKey<P extends Principal>(principal: P, context: Context, customKey?: PrincipalKeyFunction<P>): string;
|
|
15
|
+
/** Canonical JSON: sorted object keys, `-0` written as `0`. Counts one walk. */
|
|
16
|
+
export declare function canonicalJson(value: JsonValue, context: Context): string;
|
|
17
|
+
//# sourceMappingURL=principal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"principal.d.ts","sourceRoot":"","sources":["../../../src/next/data/principal.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE/C,6EAA6E;AAC7E,MAAM,MAAM,SAAS,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAEvF,8EAA8E;AAC9E,MAAM,MAAM,oBAAoB,CAAC,CAAC,SAAS,SAAS,GAAG,SAAS,IAAI,CAAC,SAAS,EAAE,CAAC,KAAK,MAAM,CAAC;AAE7F;;;GAGG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,SAAS,EAC/C,SAAS,EAAE,CAAC,EACZ,OAAO,EAAE,OAAO,EAChB,SAAS,CAAC,EAAE,oBAAoB,CAAC,CAAC,CAAC,GACjC,MAAM,CAQR;AAeD,gFAAgF;AAChF,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,CAGxE"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// Principals: the app's caller identities, and the keys Chord derives from them.
|
|
2
|
+
/**
|
|
3
|
+
* The key of a principal: its canonical JSON, or `customKey(principal)`. Cached per principal object; a custom key's
|
|
4
|
+
* cache is keyed by the function too, so a live principal never retains a dropped function.
|
|
5
|
+
*/
|
|
6
|
+
export function principalKey(principal, context, customKey) {
|
|
7
|
+
const cache = customKey === undefined ? defaultKeys : customKeyCache(customKey);
|
|
8
|
+
let key = cache.get(principal);
|
|
9
|
+
if (key === undefined) {
|
|
10
|
+
key = customKey === undefined ? canonicalJson(principal, context) : customKey(principal);
|
|
11
|
+
cache.set(principal, key);
|
|
12
|
+
}
|
|
13
|
+
return key;
|
|
14
|
+
}
|
|
15
|
+
const defaultKeys = new WeakMap();
|
|
16
|
+
const customKeys = new WeakMap();
|
|
17
|
+
function customKeyCache(customKey) {
|
|
18
|
+
let cache = customKeys.get(customKey);
|
|
19
|
+
if (cache === undefined) {
|
|
20
|
+
cache = new WeakMap();
|
|
21
|
+
customKeys.set(customKey, cache);
|
|
22
|
+
}
|
|
23
|
+
return cache;
|
|
24
|
+
}
|
|
25
|
+
/** Canonical JSON: sorted object keys, `-0` written as `0`. Counts one walk. */
|
|
26
|
+
export function canonicalJson(value, context) {
|
|
27
|
+
context.telemetry.metrics?.counter("chord.data.walks").add(1);
|
|
28
|
+
return canonical(value);
|
|
29
|
+
}
|
|
30
|
+
function canonical(value) {
|
|
31
|
+
// JSON.stringify writes -0 as 0.
|
|
32
|
+
if (value === null || typeof value !== "object")
|
|
33
|
+
return JSON.stringify(value);
|
|
34
|
+
if (Array.isArray(value))
|
|
35
|
+
return `[${value.map(canonical).join(",")}]`;
|
|
36
|
+
const fields = Object.keys(value)
|
|
37
|
+
.sort()
|
|
38
|
+
.map((key) => `${JSON.stringify(key)}:${canonical(value[key])}`);
|
|
39
|
+
return `{${fields.join(",")}}`;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=principal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"principal.js","sourceRoot":"","sources":["../../../src/next/data/principal.ts"],"names":[],"mappings":"AAAA,iFAAiF;AAWjF;;;GAGG;AACH,MAAM,UAAU,YAAY,CAC3B,SAAY,EACZ,OAAgB,EAChB,SAAmC;IAEnC,MAAM,KAAK,GAAG,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;IAChF,IAAI,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAC/B,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QACvB,GAAG,GAAG,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,aAAa,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QACzF,KAAK,CAAC,GAAG,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;IAC3B,CAAC;IACD,OAAO,GAAG,CAAC;AACZ,CAAC;AAED,MAAM,WAAW,GAAG,IAAI,OAAO,EAAqB,CAAC;AAErD,MAAM,UAAU,GAAG,IAAI,OAAO,EAA2D,CAAC;AAE1F,SAAS,cAAc,CAAC,SAAsC;IAC7D,IAAI,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IACtC,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACzB,KAAK,GAAG,IAAI,OAAO,EAAE,CAAC;QACtB,UAAU,CAAC,GAAG,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IAClC,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC;AAED,gFAAgF;AAChF,MAAM,UAAU,aAAa,CAAC,KAAgB,EAAE,OAAgB;IAC/D,OAAO,CAAC,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAC9D,OAAO,SAAS,CAAC,KAAK,CAAC,CAAC;AACzB,CAAC;AAED,SAAS,SAAS,CAAC,KAAgB;IAClC,iCAAiC;IACjC,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAC9E,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;IACvE,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;SAC/B,IAAI,EAAE;SACN,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,SAAS,CAAC,KAAK,CAAC,GAAG,CAAE,CAAC,EAAE,CAAC,CAAC;IACnE,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;AAChC,CAAC","sourcesContent":["// Principals: the app's caller identities, and the keys Chord derives from them.\n\nimport type { Context } from \"../../context/index.ts\";\nimport type { JsonValue } from \"../../json.ts\";\n\n/** An app's principal: plain JSON with a `kind`. Chord never persists it. */\nexport type Principal = { readonly kind: string; readonly [field: string]: JsonValue };\n\n/** An app's own principal key; it must be the same function on every host. */\nexport type PrincipalKeyFunction<P extends Principal = Principal> = (principal: P) => string;\n\n/**\n * The key of a principal: its canonical JSON, or `customKey(principal)`. Cached per principal object; a custom key's\n * cache is keyed by the function too, so a live principal never retains a dropped function.\n */\nexport function principalKey<P extends Principal>(\n\tprincipal: P,\n\tcontext: Context,\n\tcustomKey?: PrincipalKeyFunction<P>,\n): string {\n\tconst cache = customKey === undefined ? defaultKeys : customKeyCache(customKey);\n\tlet key = cache.get(principal);\n\tif (key === undefined) {\n\t\tkey = customKey === undefined ? canonicalJson(principal, context) : customKey(principal);\n\t\tcache.set(principal, key);\n\t}\n\treturn key;\n}\n\nconst defaultKeys = new WeakMap<Principal, string>();\n\nconst customKeys = new WeakMap<PrincipalKeyFunction<never>, WeakMap<Principal, string>>();\n\nfunction customKeyCache(customKey: PrincipalKeyFunction<never>): WeakMap<Principal, string> {\n\tlet cache = customKeys.get(customKey);\n\tif (cache === undefined) {\n\t\tcache = new WeakMap();\n\t\tcustomKeys.set(customKey, cache);\n\t}\n\treturn cache;\n}\n\n/** Canonical JSON: sorted object keys, `-0` written as `0`. Counts one walk. */\nexport function canonicalJson(value: JsonValue, context: Context): string {\n\tcontext.telemetry.metrics?.counter(\"chord.data.walks\").add(1);\n\treturn canonical(value);\n}\n\nfunction canonical(value: JsonValue): string {\n\t// JSON.stringify writes -0 as 0.\n\tif (value === null || typeof value !== \"object\") return JSON.stringify(value);\n\tif (Array.isArray(value)) return `[${value.map(canonical).join(\",\")}]`;\n\tconst fields = Object.keys(value)\n\t\t.sort()\n\t\t.map((key) => `${JSON.stringify(key)}:${canonical(value[key]!)}`);\n\treturn `{${fields.join(\",\")}}`;\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type JsonSchema, type Validator } from "@earendil-works/pi-schema";
|
|
2
|
+
import type { Context } from "../../context/index.ts";
|
|
3
|
+
/** A Chord-owned record holding a schema: a snapshot, or a contract's params. */
|
|
4
|
+
type SchemaOwner = {
|
|
5
|
+
readonly schema: JsonSchema;
|
|
6
|
+
};
|
|
7
|
+
/** The validator of an owner's schema, compiled on first use (counted) and cached weakly by the owner. */
|
|
8
|
+
export declare function validatorFor(owner: SchemaOwner, context: Context): Validator;
|
|
9
|
+
/** Checks `value` (counted); a failure throws `invalid/<reason>` with the first error's JSON Pointer path. */
|
|
10
|
+
export declare function check(validator: Validator, value: unknown, reason: "args" | "params" | "host_address", context: Context): void;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../../src/next/data/validator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAW,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACrF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAGtD,iFAAiF;AACjF,KAAK,WAAW,GAAG;IAAE,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAA;CAAE,CAAC;AAEnD,0GAA0G;AAC1G,wBAAgB,YAAY,CAAC,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,GAAG,SAAS,CAS5E;AAID,8GAA8G;AAC9G,wBAAgB,KAAK,CACpB,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,OAAO,EACd,MAAM,EAAE,MAAM,GAAG,QAAQ,GAAG,cAAc,EAC1C,OAAO,EAAE,OAAO,GACd,IAAI,CAGN"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// Compiled checks: pi-schema validators of Chord-owned schemas, and the `invalid` error of a failed check.
|
|
2
|
+
import { compile } from "@earendil-works/pi-schema";
|
|
3
|
+
import { invalid } from "./errors.js";
|
|
4
|
+
/** The validator of an owner's schema, compiled on first use (counted) and cached weakly by the owner. */
|
|
5
|
+
export function validatorFor(owner, context) {
|
|
6
|
+
let validator = validators.get(owner);
|
|
7
|
+
if (validator === undefined) {
|
|
8
|
+
context.telemetry.metrics?.counter("chord.data.compilations").add(1);
|
|
9
|
+
// `format` is an annotation (decided for the schema switch): no format checks are compiled in.
|
|
10
|
+
validator = compile(owner.schema);
|
|
11
|
+
validators.set(owner, validator);
|
|
12
|
+
}
|
|
13
|
+
return validator;
|
|
14
|
+
}
|
|
15
|
+
const validators = new WeakMap();
|
|
16
|
+
/** Checks `value` (counted); a failure throws `invalid/<reason>` with the first error's JSON Pointer path. */
|
|
17
|
+
export function check(validator, value, reason, context) {
|
|
18
|
+
context.telemetry.metrics?.counter("chord.data.validations").add(1);
|
|
19
|
+
if (!validator.check(value))
|
|
20
|
+
throw failedCheck(validator, value, reason, context);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The error of a failed check: the first error of the validator's explanation (counted: it walks the schema). A
|
|
24
|
+
* missing field is reported at the field ("missing"), an unknown one at its own path ("unknown field"); the value
|
|
25
|
+
* itself at `/`.
|
|
26
|
+
*/
|
|
27
|
+
function failedCheck(validator, value, reason, context) {
|
|
28
|
+
context.telemetry.metrics?.counter("chord.data.walks").add(1);
|
|
29
|
+
// A value that failed the check has at least one error.
|
|
30
|
+
const error = validator.errors(value)[0];
|
|
31
|
+
const path = error.path || "/";
|
|
32
|
+
return invalid(reason, `${reason}${path === "/" ? "" : path}: ${error.message}`, { path });
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=validator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validator.js","sourceRoot":"","sources":["../../../src/next/data/validator.ts"],"names":[],"mappings":"AAAA,2GAA2G;AAE3G,OAAO,EAAE,OAAO,EAAmC,MAAM,2BAA2B,CAAC;AAErF,OAAO,EAAmB,OAAO,EAAE,MAAM,aAAa,CAAC;AAKvD,0GAA0G;AAC1G,MAAM,UAAU,YAAY,CAAC,KAAkB,EAAE,OAAgB;IAChE,IAAI,SAAS,GAAG,UAAU,CAAC,GAAG,CAAC,KAAK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AAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;AAC5F,CAAC","sourcesContent":["// Compiled checks: pi-schema validators of Chord-owned schemas, and the `invalid` error of a failed check.\n\nimport { compile, type JsonSchema, type Validator } from \"@earendil-works/pi-schema\";\nimport type { Context } from \"../../context/index.ts\";\nimport { type ChordError, invalid } from \"./errors.ts\";\n\n/** A Chord-owned record holding a schema: a snapshot, or a contract's params. */\ntype SchemaOwner = { readonly schema: JsonSchema };\n\n/** The validator of an owner's schema, compiled on first use (counted) and cached weakly by the owner. */\nexport function validatorFor(owner: SchemaOwner, context: Context): Validator {\n\tlet validator = validators.get(owner);\n\tif (validator === undefined) {\n\t\tcontext.telemetry.metrics?.counter(\"chord.data.compilations\").add(1);\n\t\t// `format` is an annotation (decided for the schema switch): no format checks are compiled in.\n\t\tvalidator = compile(owner.schema);\n\t\tvalidators.set(owner, validator);\n\t}\n\treturn validator;\n}\n\nconst validators = new WeakMap<SchemaOwner, Validator>();\n\n/** Checks `value` (counted); a failure throws `invalid/<reason>` with the first error's JSON Pointer path. */\nexport function check(\n\tvalidator: Validator,\n\tvalue: unknown,\n\treason: \"args\" | \"params\" | \"host_address\",\n\tcontext: Context,\n): void {\n\tcontext.telemetry.metrics?.counter(\"chord.data.validations\").add(1);\n\tif (!validator.check(value)) throw failedCheck(validator, value, reason, context);\n}\n\n/**\n * The error of a failed check: the first error of the validator's explanation (counted: it walks the schema). A\n * missing field is reported at the field (\"missing\"), an unknown one at its own path (\"unknown field\"); the value\n * itself at `/`.\n */\nfunction failedCheck(\n\tvalidator: Validator,\n\tvalue: unknown,\n\treason: \"args\" | \"params\" | \"host_address\",\n\tcontext: Context,\n): ChordError {\n\tcontext.telemetry.metrics?.counter(\"chord.data.walks\").add(1);\n\t// A value that failed the check has at least one error.\n\tconst error = validator.errors(value)[0]!;\n\tconst path = error.path || \"/\";\n\treturn invalid(reason, `${reason}${path === \"/\" ? \"\" : path}: ${error.message}`, { path });\n}\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Context } from "../../context/index.ts";
|
|
2
|
+
import type { Prepared } from "../../delta/index.ts";
|
|
3
|
+
import { Source } from "../state/internal.ts";
|
|
4
|
+
import type { JsonObject } from "./definition.ts";
|
|
5
|
+
/** A source following one document address; `value` is the document's, or `initial()` while it is absent. */
|
|
6
|
+
export declare abstract class AddressSource extends Source {
|
|
7
|
+
#private;
|
|
8
|
+
abstract get value(): JsonObject;
|
|
9
|
+
deliver(context: Context): void;
|
|
10
|
+
/**
|
|
11
|
+
* A commit wrote the document, which read `before`: its ops, or a root replacement when the draft started from
|
|
12
|
+
* another base or the document was retired earlier in the batch.
|
|
13
|
+
*/
|
|
14
|
+
written(before: JsonObject, prepared: Prepared<JsonObject>): void;
|
|
15
|
+
/** The document was retired: it reads `initial` again, and the frame says so. */
|
|
16
|
+
retired(initial: JsonObject): void;
|
|
17
|
+
/** The value changed outside a commit (a migration, a load): a root replacement. */
|
|
18
|
+
replaced(): void;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=address-source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"address-source.d.ts","sourceRoot":"","sources":["../../../src/next/documents/address-source.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,EAAM,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAIlD,6GAA6G;AAC7G,8BAAsB,aAAc,SAAQ,MAAM;;IAKjD,aAAsB,KAAK,IAAI,UAAU,CAAC;IAE1C,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAI9B;IAED;;;OAGG;IACH,OAAO,CAAC,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,CAAC,UAAU,CAAC,GAAG,IAAI,CAIhE;IAED,iFAAiF;IACjF,OAAO,CAAC,OAAO,EAAE,UAAU,GAAG,IAAI,CAQjC;IAED,oFAAoF;IACpF,QAAQ,IAAI,IAAI,CAGf;CACD"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// Watchable document addresses (slice 6a §11; decision "One retirement mechanism"): the frames of a source that
|
|
2
|
+
// follows one address, a singleton's slot or one key of a keyed slot. A change arrives with its ops, a write over
|
|
3
|
+
// another base as a root replacement, a retirement as `[["r", initial()]]` with the `retired` flag, and a document
|
|
4
|
+
// created after a retirement in the same batch as one root replacement with the flag.
|
|
5
|
+
import { Source } from "../state/internal.js";
|
|
6
|
+
const NO_OPS = [];
|
|
7
|
+
/** A source following one document address; `value` is the document's, or `initial()` while it is absent. */
|
|
8
|
+
export class AddressSource extends Source {
|
|
9
|
+
/** The ops of the current batch's frame, and whether the document was retired in it. */
|
|
10
|
+
#ops = NO_OPS;
|
|
11
|
+
#retired = false;
|
|
12
|
+
deliver(context) {
|
|
13
|
+
this.publish(this.value, this.#ops, this.#retired, context);
|
|
14
|
+
this.#ops = NO_OPS;
|
|
15
|
+
this.#retired = false;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A commit wrote the document, which read `before`: its ops, or a root replacement when the draft started from
|
|
19
|
+
* another base or the document was retired earlier in the batch.
|
|
20
|
+
*/
|
|
21
|
+
written(before, prepared) {
|
|
22
|
+
// The ops are kept for a frame, which only a watched source gets: an unwatched one keeps none.
|
|
23
|
+
if (this.watched)
|
|
24
|
+
this.#ops = prepared.base === before && !this.#retired ? prepared.ops : [["r", prepared.value]];
|
|
25
|
+
this.changed();
|
|
26
|
+
}
|
|
27
|
+
/** The document was retired: it reads `initial` again, and the frame says so. */
|
|
28
|
+
retired(initial) {
|
|
29
|
+
// Reset by the frame, which only a watched source gets.
|
|
30
|
+
if (this.watched) {
|
|
31
|
+
this.#ops = [["r", initial]];
|
|
32
|
+
this.#retired = true;
|
|
33
|
+
}
|
|
34
|
+
this.changed();
|
|
35
|
+
this.retiredInBatch();
|
|
36
|
+
}
|
|
37
|
+
/** The value changed outside a commit (a migration, a load): a root replacement. */
|
|
38
|
+
replaced() {
|
|
39
|
+
if (this.watched)
|
|
40
|
+
this.#ops = [["r", this.value]];
|
|
41
|
+
this.changed();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=address-source.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"address-source.js","sourceRoot":"","sources":["../../../src/next/documents/address-source.ts"],"names":[],"mappings":"AAAA,gHAAgH;AAChH,kHAAkH;AAClH,mHAAmH;AACnH,sFAAsF;AAItF,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAG9C,MAAM,MAAM,GAAkB,EAAE,CAAC;AAEjC,6GAA6G;AAC7G,MAAM,OAAgB,aAAc,SAAQ,MAAM;IACjD,wFAAwF;IACxF,IAAI,GAAG,MAAM,CAAC;IACd,QAAQ,GAAG,KAAK,CAAC;IAIjB,OAAO,CAAC,OAAgB;QACvB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC5D,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC;QACnB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;IACvB,CAAC;IAED;;;OAGG;IACH,OAAO,CAAC,MAAkB,EAAE,QAA8B;QACzD,+FAA+F;QAC/F,IAAI,IAAI,CAAC,OAAO;YAAE,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC,IAAI,KAAK,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;QAClH,IAAI,CAAC,OAAO,EAAE,CAAC;IAChB,CAAC;IAED,iFAAiF;IACjF,OAAO,CAAC,OAAmB;QAC1B,wDAAwD;QACxD,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YAClB,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC;YAC7B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACtB,CAAC;QACD,IAAI,CAAC,OAAO,EAAE,CAAC;QACf,IAAI,CAAC,cAAc,EAAE,CAAC;IACvB,CAAC;IAED,oFAAoF;IACpF,QAAQ;QACP,IAAI,IAAI,CAAC,OAAO;YAAE,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QAClD,IAAI,CAAC,OAAO,EAAE,CAAC;IAChB,CAAC;CACD","sourcesContent":["// Watchable document addresses (slice 6a §11; decision \"One retirement mechanism\"): the frames of a source that\n// follows one address, a singleton's slot or one key of a keyed slot. A change arrives with its ops, a write over\n// another base as a root replacement, a retirement as `[[\"r\", initial()]]` with the `retired` flag, and a document\n// created after a retirement in the same batch as one root replacement with the flag.\n\nimport type { Context } from \"../../context/index.ts\";\nimport type { Op, Prepared } from \"../../delta/index.ts\";\nimport { Source } from \"../state/internal.ts\";\nimport type { JsonObject } from \"./definition.ts\";\n\nconst NO_OPS: readonly Op[] = [];\n\n/** A source following one document address; `value` is the document's, or `initial()` while it is absent. */\nexport abstract class AddressSource extends Source {\n\t/** The ops of the current batch's frame, and whether the document was retired in it. */\n\t#ops = NO_OPS;\n\t#retired = false;\n\n\tabstract override get value(): JsonObject;\n\n\tdeliver(context: Context): void {\n\t\tthis.publish(this.value, this.#ops, this.#retired, context);\n\t\tthis.#ops = NO_OPS;\n\t\tthis.#retired = false;\n\t}\n\n\t/**\n\t * A commit wrote the document, which read `before`: its ops, or a root replacement when the draft started from\n\t * another base or the document was retired earlier in the batch.\n\t */\n\twritten(before: JsonObject, prepared: Prepared<JsonObject>): void {\n\t\t// The ops are kept for a frame, which only a watched source gets: an unwatched one keeps none.\n\t\tif (this.watched) this.#ops = prepared.base === before && !this.#retired ? prepared.ops : [[\"r\", prepared.value]];\n\t\tthis.changed();\n\t}\n\n\t/** The document was retired: it reads `initial` again, and the frame says so. */\n\tretired(initial: JsonObject): void {\n\t\t// Reset by the frame, which only a watched source gets.\n\t\tif (this.watched) {\n\t\t\tthis.#ops = [[\"r\", initial]];\n\t\t\tthis.#retired = true;\n\t\t}\n\t\tthis.changed();\n\t\tthis.retiredInBatch();\n\t}\n\n\t/** The value changed outside a commit (a migration, a load): a root replacement. */\n\treplaced(): void {\n\t\tif (this.watched) this.#ops = [[\"r\", this.value]];\n\t\tthis.changed();\n\t}\n}\n"]}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { Context } from "../../context/index.ts";
|
|
2
|
+
import type { Op } from "../../delta/index.ts";
|
|
3
|
+
import type { JsonValue } from "../../json.ts";
|
|
4
|
+
import type { Schema, Static } from "../contracts/index.ts";
|
|
5
|
+
/** A document root: a JSON object. */
|
|
6
|
+
export type JsonObject = {
|
|
7
|
+
[key: string]: JsonValue;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* When a commit reaches the store (Durable's `CommitPersistence`): `immediate`, the default, before the commit
|
|
11
|
+
* resolves; `deferred` (a persisted run's state change, D8): adopted and published at once, stored with the next
|
|
12
|
+
* immediate change, the run's outcome, the object's close, or about `withinMs` (default 1,000 ms) later.
|
|
13
|
+
*/
|
|
14
|
+
export type CommitPersistence = {
|
|
15
|
+
readonly kind: "immediate";
|
|
16
|
+
} | {
|
|
17
|
+
readonly kind: "deferred";
|
|
18
|
+
readonly withinMs?: number;
|
|
19
|
+
};
|
|
20
|
+
/** What a persisted document's `checkpointWhen` learns of its stored revisions. */
|
|
21
|
+
export type CheckpointInfo = {
|
|
22
|
+
/** The deltas stored after its newest base, without the change being decided. */
|
|
23
|
+
readonly deltasSinceBase: number;
|
|
24
|
+
};
|
|
25
|
+
/** Whether a commit's change of a persisted document is stored as a whole new base (`true`) or as a delta. */
|
|
26
|
+
export type CheckpointWhen<T> = (value: T, ops: readonly Op[], info: CheckpointInfo) => boolean;
|
|
27
|
+
/** What `defineState` takes for any document. */
|
|
28
|
+
type StateOptions<S extends Schema, K extends boolean> = {
|
|
29
|
+
readonly schema: S;
|
|
30
|
+
readonly version: number;
|
|
31
|
+
readonly initial: () => DocumentOf<S>;
|
|
32
|
+
/** Maps a value of an older version `from` to this version's shape; pure. Required to read older values. */
|
|
33
|
+
readonly migrate?: (old: JsonObject, from: number) => DocumentOf<S>;
|
|
34
|
+
readonly keyed?: K;
|
|
35
|
+
};
|
|
36
|
+
/** What a persisted document adds (slice 6a §10): `checkpointWhen` is required. */
|
|
37
|
+
type PersistOptions<S extends Schema> = {
|
|
38
|
+
/** Stored in the host's store; only in `local` types with empty params (P3). */
|
|
39
|
+
readonly persist: true;
|
|
40
|
+
/** Called once per commit per changed document; creations and version changes always store a base. */
|
|
41
|
+
readonly checkpointWhen: CheckpointWhen<DocumentOf<S>>;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Declares a document: a singleton per object, or with `keyed: true` many per object, each by a string key; with
|
|
45
|
+
* `persist: true` stored in the host's store. Its name is a restricted name (lowercase `[a-z0-9@/._~-]`).
|
|
46
|
+
*/
|
|
47
|
+
export declare function defineState<S extends Schema, K extends boolean = false>(name: string, options: StateOptions<S, K> & {
|
|
48
|
+
readonly persist?: false;
|
|
49
|
+
readonly checkpointWhen?: never;
|
|
50
|
+
}): StateDefinition<DocumentOf<S>, K, false>;
|
|
51
|
+
export declare function defineState<S extends Schema, K extends boolean = false>(name: string, options: StateOptions<S, K> & PersistOptions<S>): StateDefinition<DocumentOf<S>, K, true>;
|
|
52
|
+
/** The value of a document whose schema is `S`: its static type, which must be a JSON object. */
|
|
53
|
+
type DocumentOf<S extends Schema> = Static<S> extends JsonObject ? Static<S> : never;
|
|
54
|
+
/** A declared document; `T` is its value, `K` whether it is keyed, `P` whether it is persisted. */
|
|
55
|
+
export declare class StateDefinition<T extends JsonObject, K extends boolean, P extends boolean = false> {
|
|
56
|
+
#private;
|
|
57
|
+
readonly name: string;
|
|
58
|
+
readonly schema: Schema;
|
|
59
|
+
readonly version: number;
|
|
60
|
+
readonly keyed: boolean;
|
|
61
|
+
readonly persist: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* `hash64` of the schema's normal form (descriptions and titles ignored), computed once: the same version with
|
|
64
|
+
* another fingerprint is a schema changed without a version bump.
|
|
65
|
+
*/
|
|
66
|
+
readonly fingerprint: string;
|
|
67
|
+
/** Type only: whether the definition is keyed. */
|
|
68
|
+
readonly "~keyed"?: K;
|
|
69
|
+
/** Type only: whether the definition is persisted. */
|
|
70
|
+
readonly "~persist"?: P;
|
|
71
|
+
constructor(name: string, schema: Schema, version: number, initial: () => T, migrate: ((old: JsonObject, from: number) => T) | undefined, keyed: boolean, persist: boolean, checkpointWhen: CheckpointWhen<T> | undefined);
|
|
72
|
+
/** Whether a persisted document's change is stored as a new base (its `checkpointWhen`); never asked in memory. */
|
|
73
|
+
checkpointWhen(value: T, ops: readonly Op[], info: CheckpointInfo): boolean;
|
|
74
|
+
/** A fresh `initial()` value; the first is checked against the schema (counted), later ones are not (R8). */
|
|
75
|
+
initial(context: Context): T;
|
|
76
|
+
/**
|
|
77
|
+
* `old`, a value of version `from`, migrated to this version and checked against the schema once, as it is
|
|
78
|
+
* produced (R8, counted). Throws without a `migrate` (the access is refused, the data kept) and when the result does
|
|
79
|
+
* not match.
|
|
80
|
+
*/
|
|
81
|
+
migrate(old: JsonObject, from: number, context: Context): T;
|
|
82
|
+
}
|
|
83
|
+
export {};
|
|
84
|
+
//# sourceMappingURL=definition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../../src/next/documents/definition.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAA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