@earendil-works/chord 1.4.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +92 -0
- package/README.md +115 -90
- package/dist/context/index.d.ts +1 -1
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js +1 -1
- package/dist/context/index.js.map +1 -1
- package/dist/contracts/accepts.d.ts +81 -0
- package/dist/contracts/accepts.d.ts.map +1 -0
- package/dist/contracts/accepts.js +123 -0
- package/dist/contracts/accepts.js.map +1 -0
- package/dist/contracts/contract.d.ts +121 -0
- package/dist/contracts/contract.d.ts.map +1 -0
- package/dist/contracts/contract.js +50 -0
- package/dist/contracts/contract.js.map +1 -0
- package/dist/contracts/declare.d.ts +107 -0
- package/dist/contracts/declare.d.ts.map +1 -0
- package/dist/contracts/declare.js +136 -0
- package/dist/contracts/declare.js.map +1 -0
- package/dist/contracts/evolve.d.ts +92 -0
- package/dist/contracts/evolve.d.ts.map +1 -0
- package/dist/contracts/evolve.js +179 -0
- package/dist/contracts/evolve.js.map +1 -0
- package/dist/contracts/fingerprint.d.ts +16 -0
- package/dist/contracts/fingerprint.d.ts.map +1 -0
- package/dist/contracts/fingerprint.js +50 -0
- package/dist/contracts/fingerprint.js.map +1 -0
- package/dist/contracts/history.d.ts +71 -0
- package/dist/contracts/history.d.ts.map +1 -0
- package/dist/contracts/history.js +3 -0
- package/dist/contracts/history.js.map +1 -0
- package/dist/contracts/host-kind.d.ts +40 -0
- package/dist/contracts/host-kind.d.ts.map +1 -0
- package/dist/contracts/host-kind.js +37 -0
- package/dist/contracts/host-kind.js.map +1 -0
- package/dist/contracts/index.d.ts +7 -0
- package/dist/contracts/index.d.ts.map +1 -0
- package/dist/contracts/index.js +6 -0
- package/dist/contracts/index.js.map +1 -0
- package/dist/contracts/internal.d.ts +10 -0
- package/dist/contracts/internal.d.ts.map +1 -0
- package/dist/contracts/internal.js +9 -0
- package/dist/contracts/internal.js.map +1 -0
- package/dist/contracts/names.d.ts +3 -0
- package/dist/contracts/names.d.ts.map +1 -0
- package/dist/contracts/names.js +13 -0
- package/dist/contracts/names.js.map +1 -0
- package/dist/contracts/params.d.ts +28 -0
- package/dist/contracts/params.d.ts.map +1 -0
- package/dist/contracts/params.js +50 -0
- package/dist/contracts/params.js.map +1 -0
- package/dist/contracts/schema.d.ts +102 -0
- package/dist/contracts/schema.d.ts.map +1 -0
- package/dist/contracts/schema.js +103 -0
- package/dist/contracts/schema.js.map +1 -0
- package/dist/contracts/snapshot.d.ts +16 -0
- package/dist/contracts/snapshot.d.ts.map +1 -0
- package/dist/contracts/snapshot.js +167 -0
- package/dist/contracts/snapshot.js.map +1 -0
- package/dist/data/args.d.ts +50 -0
- package/dist/data/args.d.ts.map +1 -0
- package/dist/data/args.js +83 -0
- package/dist/data/args.js.map +1 -0
- package/dist/data/errors.d.ts +80 -0
- package/dist/data/errors.d.ts.map +1 -0
- package/dist/data/errors.js +116 -0
- package/dist/data/errors.js.map +1 -0
- package/dist/data/failure.d.ts +26 -0
- package/dist/data/failure.d.ts.map +1 -0
- package/dist/data/failure.js +77 -0
- package/dist/data/failure.js.map +1 -0
- package/dist/data/index.d.ts +4 -0
- package/dist/data/index.d.ts.map +1 -0
- package/dist/data/index.js +5 -0
- package/dist/data/index.js.map +1 -0
- package/dist/data/internal.d.ts +7 -0
- package/dist/data/internal.d.ts.map +1 -0
- package/dist/data/internal.js +8 -0
- package/dist/data/internal.js.map +1 -0
- package/dist/data/params.d.ts +20 -0
- package/dist/data/params.d.ts.map +1 -0
- package/dist/data/params.js +31 -0
- package/dist/data/params.js.map +1 -0
- package/dist/data/principal.d.ts +22 -0
- package/dist/data/principal.d.ts.map +1 -0
- package/dist/data/principal.js +49 -0
- package/dist/data/principal.js.map +1 -0
- package/dist/data/validator.d.ts +12 -0
- package/dist/data/validator.d.ts.map +1 -0
- package/dist/data/validator.js +35 -0
- package/dist/data/validator.js.map +1 -0
- package/dist/delta/apply-immutable-trusted.js +3 -4
- package/dist/delta/apply-immutable-trusted.js.map +1 -1
- package/dist/delta/diff.d.ts.map +1 -1
- package/dist/delta/diff.js +5 -3
- package/dist/delta/diff.js.map +1 -1
- package/dist/delta/index.d.ts +9 -1
- package/dist/delta/index.d.ts.map +1 -1
- package/dist/delta/index.js +15 -11
- package/dist/delta/index.js.map +1 -1
- package/dist/delta/pending.d.ts +36 -0
- package/dist/delta/pending.d.ts.map +1 -0
- package/dist/delta/pending.js +143 -0
- package/dist/delta/pending.js.map +1 -0
- package/dist/delta/tracker.d.ts +12 -0
- package/dist/delta/tracker.d.ts.map +1 -1
- package/dist/delta/tracker.js +109 -39
- package/dist/delta/tracker.js.map +1 -1
- package/dist/documents/address-source.d.ts +20 -0
- package/dist/documents/address-source.d.ts.map +1 -0
- package/dist/documents/address-source.js +44 -0
- package/dist/documents/address-source.js.map +1 -0
- package/dist/documents/definition.d.ts +84 -0
- package/dist/documents/definition.d.ts.map +1 -0
- package/dist/documents/definition.js +74 -0
- package/dist/documents/definition.js.map +1 -0
- package/dist/documents/documents.d.ts +126 -0
- package/dist/documents/documents.d.ts.map +1 -0
- package/dist/documents/documents.js +248 -0
- package/dist/documents/documents.js.map +1 -0
- package/dist/documents/fence.d.ts +9 -0
- package/dist/documents/fence.d.ts.map +1 -0
- package/dist/documents/fence.js +15 -0
- package/dist/documents/fence.js.map +1 -0
- package/dist/documents/handles.d.ts +76 -0
- package/dist/documents/handles.d.ts.map +1 -0
- package/dist/documents/handles.js +66 -0
- package/dist/documents/handles.js.map +1 -0
- package/dist/documents/index.d.ts +4 -0
- package/dist/documents/index.d.ts.map +1 -0
- package/dist/documents/index.js +3 -0
- package/dist/documents/index.js.map +1 -0
- package/dist/documents/internal.d.ts +9 -0
- package/dist/documents/internal.d.ts.map +1 -0
- package/dist/documents/internal.js +9 -0
- package/dist/documents/internal.js.map +1 -0
- package/dist/documents/keyed-slot.d.ts +103 -0
- package/dist/documents/keyed-slot.d.ts.map +1 -0
- package/dist/documents/keyed-slot.js +395 -0
- package/dist/documents/keyed-slot.js.map +1 -0
- package/dist/documents/line.d.ts +7 -0
- package/dist/documents/line.d.ts.map +1 -0
- package/dist/documents/line.js +14 -0
- package/dist/documents/line.js.map +1 -0
- package/dist/documents/persistence.d.ts +104 -0
- package/dist/documents/persistence.d.ts.map +1 -0
- package/dist/documents/persistence.js +129 -0
- package/dist/documents/persistence.js.map +1 -0
- package/dist/documents/residency.d.ts +31 -0
- package/dist/documents/residency.d.ts.map +1 -0
- package/dist/documents/residency.js +93 -0
- package/dist/documents/residency.js.map +1 -0
- package/dist/documents/slot.d.ts +109 -0
- package/dist/documents/slot.d.ts.map +1 -0
- package/dist/documents/slot.js +181 -0
- package/dist/documents/slot.js.map +1 -0
- package/dist/documents/transaction.d.ts +143 -0
- package/dist/documents/transaction.d.ts.map +1 -0
- package/dist/documents/transaction.js +442 -0
- package/dist/documents/transaction.js.map +1 -0
- package/dist/host/activity.d.ts +31 -0
- package/dist/host/activity.d.ts.map +1 -0
- package/dist/host/activity.js +40 -0
- package/dist/host/activity.js.map +1 -0
- package/dist/host/adapted.d.ts +49 -0
- package/dist/host/adapted.d.ts.map +1 -0
- package/dist/host/adapted.js +214 -0
- package/dist/host/adapted.js.map +1 -0
- package/dist/host/attempt.d.ts +308 -0
- package/dist/host/attempt.d.ts.map +1 -0
- package/dist/host/attempt.js +1199 -0
- package/dist/host/attempt.js.map +1 -0
- package/dist/host/backoff.d.ts +29 -0
- package/dist/host/backoff.d.ts.map +1 -0
- package/dist/host/backoff.js +69 -0
- package/dist/host/backoff.js.map +1 -0
- package/dist/host/ctx.d.ts +94 -0
- package/dist/host/ctx.d.ts.map +1 -0
- package/dist/host/ctx.js +200 -0
- package/dist/host/ctx.js.map +1 -0
- package/dist/host/deadline.d.ts +12 -0
- package/dist/host/deadline.d.ts.map +1 -0
- package/dist/host/deadline.js +40 -0
- package/dist/host/deadline.js.map +1 -0
- package/dist/host/dependencies.d.ts +65 -0
- package/dist/host/dependencies.d.ts.map +1 -0
- package/dist/host/dependencies.js +115 -0
- package/dist/host/dependencies.js.map +1 -0
- package/dist/host/destination.d.ts +48 -0
- package/dist/host/destination.d.ts.map +1 -0
- package/dist/host/destination.js +101 -0
- package/dist/host/destination.js.map +1 -0
- package/dist/host/facet.d.ts +84 -0
- package/dist/host/facet.d.ts.map +1 -0
- package/dist/host/facet.js +55 -0
- package/dist/host/facet.js.map +1 -0
- package/dist/host/follow.d.ts +52 -0
- package/dist/host/follow.d.ts.map +1 -0
- package/dist/host/follow.js +207 -0
- package/dist/host/follow.js.map +1 -0
- package/dist/host/host.d.ts +571 -0
- package/dist/host/host.d.ts.map +1 -0
- package/dist/host/host.js +1318 -0
- package/dist/host/host.js.map +1 -0
- package/dist/host/index.d.ts +17 -0
- package/dist/host/index.d.ts.map +1 -0
- package/dist/host/index.js +6 -0
- package/dist/host/index.js.map +1 -0
- package/dist/host/internal.d.ts +11 -0
- package/dist/host/internal.d.ts.map +1 -0
- package/dist/host/internal.js +9 -0
- package/dist/host/internal.js.map +1 -0
- package/dist/host/members.d.ts +50 -0
- package/dist/host/members.d.ts.map +1 -0
- package/dist/host/members.js +107 -0
- package/dist/host/members.js.map +1 -0
- package/dist/host/native.d.ts +64 -0
- package/dist/host/native.d.ts.map +1 -0
- package/dist/host/native.js +126 -0
- package/dist/host/native.js.map +1 -0
- package/dist/host/object.d.ts +331 -0
- package/dist/host/object.d.ts.map +1 -0
- package/dist/host/object.js +1296 -0
- package/dist/host/object.js.map +1 -0
- package/dist/host/old-work.d.ts +34 -0
- package/dist/host/old-work.d.ts.map +1 -0
- package/dist/host/old-work.js +52 -0
- package/dist/host/old-work.js.map +1 -0
- package/dist/host/parked.d.ts +23 -0
- package/dist/host/parked.d.ts.map +1 -0
- package/dist/host/parked.js +79 -0
- package/dist/host/parked.js.map +1 -0
- package/dist/host/presence.d.ts +34 -0
- package/dist/host/presence.d.ts.map +1 -0
- package/dist/host/presence.js +117 -0
- package/dist/host/presence.js.map +1 -0
- package/dist/host/readiness.d.ts +27 -0
- package/dist/host/readiness.d.ts.map +1 -0
- package/dist/host/readiness.js +134 -0
- package/dist/host/readiness.js.map +1 -0
- package/dist/host/ref-state.d.ts +53 -0
- package/dist/host/ref-state.d.ts.map +1 -0
- package/dist/host/ref-state.js +83 -0
- package/dist/host/ref-state.js.map +1 -0
- package/dist/host/reference-keys.d.ts +36 -0
- package/dist/host/reference-keys.d.ts.map +1 -0
- package/dist/host/reference-keys.js +168 -0
- package/dist/host/reference-keys.js.map +1 -0
- package/dist/host/reference-source.d.ts +65 -0
- package/dist/host/reference-source.d.ts.map +1 -0
- package/dist/host/reference-source.js +285 -0
- package/dist/host/reference-source.js.map +1 -0
- package/dist/host/reference.d.ts +321 -0
- package/dist/host/reference.d.ts.map +1 -0
- package/dist/host/reference.js +797 -0
- package/dist/host/reference.js.map +1 -0
- package/dist/host/reload-cycle.d.ts +16 -0
- package/dist/host/reload-cycle.d.ts.map +1 -0
- package/dist/host/reload-cycle.js +81 -0
- package/dist/host/reload-cycle.js.map +1 -0
- package/dist/host/retry-on.d.ts +28 -0
- package/dist/host/retry-on.d.ts.map +1 -0
- package/dist/host/retry-on.js +52 -0
- package/dist/host/retry-on.js.map +1 -0
- package/dist/host/revocation.d.ts +16 -0
- package/dist/host/revocation.d.ts.map +1 -0
- package/dist/host/revocation.js +27 -0
- package/dist/host/revocation.js.map +1 -0
- package/dist/host/root.d.ts +37 -0
- package/dist/host/root.d.ts.map +1 -0
- package/dist/host/root.js +68 -0
- package/dist/host/root.js.map +1 -0
- package/dist/host/route.d.ts +64 -0
- package/dist/host/route.d.ts.map +1 -0
- package/dist/host/route.js +227 -0
- package/dist/host/route.js.map +1 -0
- package/dist/host/routines.d.ts +78 -0
- package/dist/host/routines.d.ts.map +1 -0
- package/dist/host/routines.js +398 -0
- package/dist/host/routines.js.map +1 -0
- package/dist/host/sleep.d.ts +9 -0
- package/dist/host/sleep.d.ts.map +1 -0
- package/dist/host/sleep.js +40 -0
- package/dist/host/sleep.js.map +1 -0
- package/dist/host/staging.d.ts +94 -0
- package/dist/host/staging.d.ts.map +1 -0
- package/dist/host/staging.js +304 -0
- package/dist/host/staging.js.map +1 -0
- package/dist/host/unbound-clock.d.ts +23 -0
- package/dist/host/unbound-clock.d.ts.map +1 -0
- package/dist/host/unbound-clock.js +58 -0
- package/dist/host/unbound-clock.js.map +1 -0
- package/dist/host/unbound.d.ts +37 -0
- package/dist/host/unbound.d.ts.map +1 -0
- package/dist/host/unbound.js +88 -0
- package/dist/host/unbound.js.map +1 -0
- package/dist/host/uuid.d.ts +3 -0
- package/dist/host/uuid.d.ts.map +1 -0
- package/dist/host/uuid.js +38 -0
- package/dist/host/uuid.js.map +1 -0
- package/dist/index.d.ts +29 -18
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +20 -9
- package/dist/index.js.map +1 -1
- package/dist/jobs/definition.d.ts +96 -0
- package/dist/jobs/definition.d.ts.map +1 -0
- package/dist/jobs/definition.js +83 -0
- package/dist/jobs/definition.js.map +1 -0
- package/dist/jobs/index.d.ts +5 -0
- package/dist/jobs/index.d.ts.map +1 -0
- package/dist/jobs/index.js +3 -0
- package/dist/jobs/index.js.map +1 -0
- package/dist/jobs/internal.d.ts +3 -0
- package/dist/jobs/internal.d.ts.map +1 -0
- package/dist/jobs/internal.js +4 -0
- package/dist/jobs/internal.js.map +1 -0
- package/dist/jobs/job.d.ts +149 -0
- package/dist/jobs/job.d.ts.map +1 -0
- package/dist/jobs/job.js +387 -0
- package/dist/jobs/job.js.map +1 -0
- package/dist/jobs/persisted.d.ts +38 -0
- package/dist/jobs/persisted.d.ts.map +1 -0
- package/dist/jobs/persisted.js +95 -0
- package/dist/jobs/persisted.js.map +1 -0
- package/dist/jobs/records.d.ts +231 -0
- package/dist/jobs/records.d.ts.map +1 -0
- package/dist/jobs/records.js +871 -0
- package/dist/jobs/records.js.map +1 -0
- package/dist/jobs/run-states.d.ts +69 -0
- package/dist/jobs/run-states.d.ts.map +1 -0
- package/dist/jobs/run-states.js +228 -0
- package/dist/jobs/run-states.js.map +1 -0
- package/dist/jobs/run.d.ts +117 -0
- package/dist/jobs/run.d.ts.map +1 -0
- package/dist/jobs/run.js +204 -0
- package/dist/jobs/run.js.map +1 -0
- package/dist/jobs/running.d.ts +44 -0
- package/dist/jobs/running.d.ts.map +1 -0
- package/dist/jobs/running.js +117 -0
- package/dist/jobs/running.js.map +1 -0
- package/dist/jobs/stored.d.ts +63 -0
- package/dist/jobs/stored.d.ts.map +1 -0
- package/dist/jobs/stored.js +55 -0
- package/dist/jobs/stored.js.map +1 -0
- package/dist/link/binary.d.ts +4 -0
- package/dist/link/binary.d.ts.map +1 -0
- package/dist/link/binary.js +544 -0
- package/dist/link/binary.js.map +1 -0
- package/dist/link/channel.d.ts +68 -0
- package/dist/link/channel.d.ts.map +1 -0
- package/dist/link/channel.js +215 -0
- package/dist/link/channel.js.map +1 -0
- package/dist/link/errors.d.ts +7 -0
- package/dist/link/errors.d.ts.map +1 -0
- package/dist/link/errors.js +21 -0
- package/dist/link/errors.js.map +1 -0
- package/dist/link/index.d.ts +8 -0
- package/dist/link/index.d.ts.map +1 -0
- package/dist/link/index.js +8 -0
- package/dist/link/index.js.map +1 -0
- package/dist/link/internal.d.ts +9 -0
- package/dist/link/internal.d.ts.map +1 -0
- package/dist/link/internal.js +10 -0
- package/dist/link/internal.js.map +1 -0
- package/dist/link/ipc.d.ts +22 -0
- package/dist/link/ipc.d.ts.map +1 -0
- package/dist/link/ipc.js +64 -0
- package/dist/link/ipc.js.map +1 -0
- package/dist/link/link.d.ts +34 -0
- package/dist/link/link.d.ts.map +1 -0
- package/dist/link/link.js +87 -0
- package/dist/link/link.js.map +1 -0
- package/dist/link/message.d.ts +262 -0
- package/dist/link/message.d.ts.map +1 -0
- package/dist/link/message.js +156 -0
- package/dist/link/message.js.map +1 -0
- package/dist/link/part.d.ts +80 -0
- package/dist/link/part.d.ts.map +1 -0
- package/dist/link/part.js +165 -0
- package/dist/link/part.js.map +1 -0
- package/dist/link/text.d.ts +6 -0
- package/dist/link/text.d.ts.map +1 -0
- package/dist/link/text.js +355 -0
- package/dist/link/text.js.map +1 -0
- package/dist/link/values.d.ts +40 -0
- package/dist/link/values.d.ts.map +1 -0
- package/dist/link/values.js +121 -0
- package/dist/link/values.js.map +1 -0
- package/dist/link/websocket.d.ts +26 -0
- package/dist/link/websocket.d.ts.map +1 -0
- package/dist/link/websocket.js +91 -0
- package/dist/link/websocket.js.map +1 -0
- package/dist/node/app/app.d.ts +269 -0
- package/dist/node/app/app.d.ts.map +1 -0
- package/dist/node/app/app.js +513 -0
- package/dist/node/app/app.js.map +1 -0
- package/dist/node/app/archive.d.ts +37 -0
- package/dist/node/app/archive.d.ts.map +1 -0
- package/dist/node/app/archive.js +204 -0
- package/dist/node/app/archive.js.map +1 -0
- package/dist/node/app/blobs.d.ts +23 -0
- package/dist/node/app/blobs.d.ts.map +1 -0
- package/dist/node/app/blobs.js +64 -0
- package/dist/node/app/blobs.js.map +1 -0
- package/dist/node/app/data.d.ts +35 -0
- package/dist/node/app/data.d.ts.map +1 -0
- package/dist/node/app/data.js +44 -0
- package/dist/node/app/data.js.map +1 -0
- package/dist/node/app/ephemeral-sessions.d.ts +20 -0
- package/dist/node/app/ephemeral-sessions.d.ts.map +1 -0
- package/dist/node/app/ephemeral-sessions.js +69 -0
- package/dist/node/app/ephemeral-sessions.js.map +1 -0
- package/dist/node/app/ephemeral.d.ts +11 -0
- package/dist/node/app/ephemeral.d.ts.map +1 -0
- package/dist/node/app/ephemeral.js +34 -0
- package/dist/node/app/ephemeral.js.map +1 -0
- package/dist/node/app/files-copy.d.ts +13 -0
- package/dist/node/app/files-copy.d.ts.map +1 -0
- package/dist/node/app/files-copy.js +86 -0
- package/dist/node/app/files-copy.js.map +1 -0
- package/dist/node/app/files-entry.d.ts +4 -0
- package/dist/node/app/files-entry.d.ts.map +1 -0
- package/dist/node/app/files-entry.js +7 -0
- package/dist/node/app/files-entry.js.map +1 -0
- package/dist/node/app/files-index.d.ts +180 -0
- package/dist/node/app/files-index.d.ts.map +1 -0
- package/dist/node/app/files-index.js +535 -0
- package/dist/node/app/files-index.js.map +1 -0
- package/dist/node/app/files.d.ts +363 -0
- package/dist/node/app/files.d.ts.map +1 -0
- package/dist/node/app/files.js +368 -0
- package/dist/node/app/files.js.map +1 -0
- package/dist/node/app/folder-views.d.ts +21 -0
- package/dist/node/app/folder-views.d.ts.map +1 -0
- package/dist/node/app/folder-views.js +55 -0
- package/dist/node/app/folder-views.js.map +1 -0
- package/dist/node/app/index.d.ts +12 -0
- package/dist/node/app/index.d.ts.map +1 -0
- package/dist/node/app/index.js +15 -0
- package/dist/node/app/index.js.map +1 -0
- package/dist/node/app/info.d.ts +66 -0
- package/dist/node/app/info.d.ts.map +1 -0
- package/dist/node/app/info.js +37 -0
- package/dist/node/app/info.js.map +1 -0
- package/dist/node/app/invite.d.ts +5 -0
- package/dist/node/app/invite.d.ts.map +1 -0
- package/dist/node/app/invite.js +64 -0
- package/dist/node/app/invite.js.map +1 -0
- package/dist/node/app/layout.d.ts +36 -0
- package/dist/node/app/layout.d.ts.map +1 -0
- package/dist/node/app/layout.js +87 -0
- package/dist/node/app/layout.js.map +1 -0
- package/dist/node/app/owner.d.ts +31 -0
- package/dist/node/app/owner.d.ts.map +1 -0
- package/dist/node/app/owner.js +104 -0
- package/dist/node/app/owner.js.map +1 -0
- package/dist/node/app/pairing.d.ts +55 -0
- package/dist/node/app/pairing.d.ts.map +1 -0
- package/dist/node/app/pairing.js +183 -0
- package/dist/node/app/pairing.js.map +1 -0
- package/dist/node/app/secrets.d.ts +16 -0
- package/dist/node/app/secrets.d.ts.map +1 -0
- package/dist/node/app/secrets.js +72 -0
- package/dist/node/app/secrets.js.map +1 -0
- package/dist/node/app/sessions.d.ts +72 -0
- package/dist/node/app/sessions.d.ts.map +1 -0
- package/dist/node/app/sessions.js +222 -0
- package/dist/node/app/sessions.js.map +1 -0
- package/dist/node/app/tar.d.ts +24 -0
- package/dist/node/app/tar.d.ts.map +1 -0
- package/dist/node/app/tar.js +167 -0
- package/dist/node/app/tar.js.map +1 -0
- package/dist/node/app/uploads.d.ts +37 -0
- package/dist/node/app/uploads.d.ts.map +1 -0
- package/dist/node/app/uploads.js +157 -0
- package/dist/node/app/uploads.js.map +1 -0
- package/dist/node/app/users.d.ts +37 -0
- package/dist/node/app/users.d.ts.map +1 -0
- package/dist/node/app/users.js +62 -0
- package/dist/node/app/users.js.map +1 -0
- package/dist/node/app/worker.d.ts +18 -0
- package/dist/node/app/worker.d.ts.map +1 -0
- package/dist/node/app/worker.js +84 -0
- package/dist/node/app/worker.js.map +1 -0
- package/dist/node/compression.d.ts +7 -0
- package/dist/node/compression.d.ts.map +1 -0
- package/dist/node/compression.js +25 -0
- package/dist/node/compression.js.map +1 -0
- package/dist/node/http/admission.d.ts +63 -0
- package/dist/node/http/admission.d.ts.map +1 -0
- package/dist/node/http/admission.js +134 -0
- package/dist/node/http/admission.js.map +1 -0
- package/dist/node/http/authenticate.d.ts +21 -0
- package/dist/node/http/authenticate.d.ts.map +1 -0
- package/dist/node/http/authenticate.js +34 -0
- package/dist/node/http/authenticate.js.map +1 -0
- package/dist/node/http/cookies.d.ts +32 -0
- package/dist/node/http/cookies.d.ts.map +1 -0
- package/dist/node/http/cookies.js +70 -0
- package/dist/node/http/cookies.js.map +1 -0
- package/dist/node/http/file.d.ts +23 -0
- package/dist/node/http/file.d.ts.map +1 -0
- package/dist/node/http/file.js +94 -0
- package/dist/node/http/file.js.map +1 -0
- package/dist/node/http/headers.d.ts +37 -0
- package/dist/node/http/headers.d.ts.map +1 -0
- package/dist/node/http/headers.js +136 -0
- package/dist/node/http/headers.js.map +1 -0
- package/dist/node/http/http.d.ts +111 -0
- package/dist/node/http/http.d.ts.map +1 -0
- package/dist/node/http/http.js +524 -0
- package/dist/node/http/http.js.map +1 -0
- package/dist/node/http/incoming.d.ts +19 -0
- package/dist/node/http/incoming.d.ts.map +1 -0
- package/dist/node/http/incoming.js +31 -0
- package/dist/node/http/incoming.js.map +1 -0
- package/dist/node/http/index.d.ts +11 -0
- package/dist/node/http/index.d.ts.map +1 -0
- package/dist/node/http/index.js +12 -0
- package/dist/node/http/index.js.map +1 -0
- package/dist/node/http/node.d.ts +78 -0
- package/dist/node/http/node.d.ts.map +1 -0
- package/dist/node/http/node.js +291 -0
- package/dist/node/http/node.js.map +1 -0
- package/dist/node/http/request.d.ts +60 -0
- package/dist/node/http/request.d.ts.map +1 -0
- package/dist/node/http/request.js +118 -0
- package/dist/node/http/request.js.map +1 -0
- package/dist/node/http/response.d.ts +63 -0
- package/dist/node/http/response.d.ts.map +1 -0
- package/dist/node/http/response.js +202 -0
- package/dist/node/http/response.js.map +1 -0
- package/dist/node/http/router.d.ts +132 -0
- package/dist/node/http/router.d.ts.map +1 -0
- package/dist/node/http/router.js +267 -0
- package/dist/node/http/router.js.map +1 -0
- package/dist/node/http/upgrades.d.ts +61 -0
- package/dist/node/http/upgrades.d.ts.map +1 -0
- package/dist/node/http/upgrades.js +192 -0
- package/dist/node/http/upgrades.js.map +1 -0
- package/dist/node/plugins/base-inputs.d.ts +14 -0
- package/dist/node/plugins/base-inputs.d.ts.map +1 -0
- package/dist/node/plugins/base-inputs.js +33 -0
- package/dist/node/plugins/base-inputs.js.map +1 -0
- package/dist/node/plugins/build.d.ts +77 -0
- package/dist/node/plugins/build.d.ts.map +1 -0
- package/dist/node/plugins/build.js +576 -0
- package/dist/node/plugins/build.js.map +1 -0
- package/dist/node/plugins/css-modules.d.ts +13 -0
- package/dist/node/plugins/css-modules.d.ts.map +1 -0
- package/dist/node/plugins/css-modules.js +58 -0
- package/dist/node/plugins/css-modules.js.map +1 -0
- package/dist/node/plugins/discover.d.ts +67 -0
- package/dist/node/plugins/discover.d.ts.map +1 -0
- package/dist/node/plugins/discover.js +369 -0
- package/dist/node/plugins/discover.js.map +1 -0
- package/dist/node/plugins/evaluate.d.ts +33 -0
- package/dist/node/plugins/evaluate.d.ts.map +1 -0
- package/dist/node/plugins/evaluate.js +121 -0
- package/dist/node/plugins/evaluate.js.map +1 -0
- package/dist/node/plugins/index.d.ts +11 -0
- package/dist/node/plugins/index.d.ts.map +1 -0
- package/dist/node/plugins/index.js +13 -0
- package/dist/node/plugins/index.js.map +1 -0
- package/dist/node/plugins/install.d.ts +38 -0
- package/dist/node/plugins/install.d.ts.map +1 -0
- package/dist/node/plugins/install.js +213 -0
- package/dist/node/plugins/install.js.map +1 -0
- package/dist/node/plugins/plugins.d.ts +162 -0
- package/dist/node/plugins/plugins.d.ts.map +1 -0
- package/dist/node/plugins/plugins.js +244 -0
- package/dist/node/plugins/plugins.js.map +1 -0
- package/dist/node/plugins/runtime.d.ts +57 -0
- package/dist/node/plugins/runtime.d.ts.map +1 -0
- package/dist/node/plugins/runtime.js +92 -0
- package/dist/node/plugins/runtime.js.map +1 -0
- package/dist/node/plugins/stack.d.ts +16 -0
- package/dist/node/plugins/stack.d.ts.map +1 -0
- package/dist/node/plugins/stack.js +61 -0
- package/dist/node/plugins/stack.js.map +1 -0
- package/dist/node/plugins/testing.d.ts +58 -0
- package/dist/node/plugins/testing.d.ts.map +1 -0
- package/dist/node/plugins/testing.js +210 -0
- package/dist/node/plugins/testing.js.map +1 -0
- package/dist/node/plugins/watcher.d.ts +69 -0
- package/dist/node/plugins/watcher.d.ts.map +1 -0
- package/dist/node/plugins/watcher.js +622 -0
- package/dist/node/plugins/watcher.js.map +1 -0
- package/dist/node/surfaces/bundle.d.ts +31 -0
- package/dist/node/surfaces/bundle.d.ts.map +1 -0
- package/dist/node/surfaces/bundle.js +118 -0
- package/dist/node/surfaces/bundle.js.map +1 -0
- package/dist/node/surfaces/current.d.ts +17 -0
- package/dist/node/surfaces/current.d.ts.map +1 -0
- package/dist/node/surfaces/current.js +54 -0
- package/dist/node/surfaces/current.js.map +1 -0
- package/dist/node/surfaces/index.d.ts +6 -0
- package/dist/node/surfaces/index.d.ts.map +1 -0
- package/dist/node/surfaces/index.js +6 -0
- package/dist/node/surfaces/index.js.map +1 -0
- package/dist/node/surfaces/published.d.ts +27 -0
- package/dist/node/surfaces/published.d.ts.map +1 -0
- package/dist/node/surfaces/published.js +142 -0
- package/dist/node/surfaces/published.js.map +1 -0
- package/dist/node/surfaces/served.d.ts +15 -0
- package/dist/node/surfaces/served.d.ts.map +1 -0
- package/dist/node/surfaces/served.js +42 -0
- package/dist/node/surfaces/served.js.map +1 -0
- package/dist/node/surfaces/surface-build.d.ts +53 -0
- package/dist/node/surfaces/surface-build.d.ts.map +1 -0
- package/dist/node/surfaces/surface-build.js +105 -0
- package/dist/node/surfaces/surface-build.js.map +1 -0
- package/dist/node/surfaces/tui.d.ts +40 -0
- package/dist/node/surfaces/tui.d.ts.map +1 -0
- package/dist/node/surfaces/tui.js +55 -0
- package/dist/node/surfaces/tui.js.map +1 -0
- package/dist/node/surfaces/web.d.ts +56 -0
- package/dist/node/surfaces/web.d.ts.map +1 -0
- package/dist/node/surfaces/web.js +108 -0
- package/dist/node/surfaces/web.js.map +1 -0
- package/dist/node/tui/actions.d.ts +49 -0
- package/dist/node/tui/actions.d.ts.map +1 -0
- package/dist/node/tui/actions.js +195 -0
- package/dist/node/tui/actions.js.map +1 -0
- package/dist/node/tui/credentials.d.ts +17 -0
- package/dist/node/tui/credentials.d.ts.map +1 -0
- package/dist/node/tui/credentials.js +54 -0
- package/dist/node/tui/credentials.js.map +1 -0
- package/dist/node/tui/filter.d.ts +5 -0
- package/dist/node/tui/filter.d.ts.map +1 -0
- package/dist/node/tui/filter.js +79 -0
- package/dist/node/tui/filter.js.map +1 -0
- package/dist/node/tui/index.d.ts +6 -0
- package/dist/node/tui/index.d.ts.map +1 -0
- package/dist/node/tui/index.js +6 -0
- package/dist/node/tui/index.js.map +1 -0
- package/dist/node/tui/launcher.d.ts +40 -0
- package/dist/node/tui/launcher.d.ts.map +1 -0
- package/dist/node/tui/launcher.js +439 -0
- package/dist/node/tui/launcher.js.map +1 -0
- package/dist/node/tui/pipe.d.ts +18 -0
- package/dist/node/tui/pipe.d.ts.map +1 -0
- package/dist/node/tui/pipe.js +134 -0
- package/dist/node/tui/pipe.js.map +1 -0
- package/dist/node/tui/sandbox.d.ts +54 -0
- package/dist/node/tui/sandbox.d.ts.map +1 -0
- package/dist/node/tui/sandbox.js +431 -0
- package/dist/node/tui/sandbox.js.map +1 -0
- package/dist/node/workers/base.d.ts +30 -0
- package/dist/node/workers/base.d.ts.map +1 -0
- package/dist/node/workers/base.js +255 -0
- package/dist/node/workers/base.js.map +1 -0
- package/dist/node/workers/child.d.ts +4 -0
- package/dist/node/workers/child.d.ts.map +1 -0
- package/dist/node/workers/child.js +6 -0
- package/dist/node/workers/child.js.map +1 -0
- package/dist/node/workers/control.d.ts +83 -0
- package/dist/node/workers/control.d.ts.map +1 -0
- package/dist/node/workers/control.js +77 -0
- package/dist/node/workers/control.js.map +1 -0
- package/dist/node/workers/index.d.ts +4 -0
- package/dist/node/workers/index.d.ts.map +1 -0
- package/dist/node/workers/index.js +7 -0
- package/dist/node/workers/index.js.map +1 -0
- package/dist/node/workers/lock.d.ts +30 -0
- package/dist/node/workers/lock.d.ts.map +1 -0
- package/dist/node/workers/lock.js +180 -0
- package/dist/node/workers/lock.js.map +1 -0
- package/dist/node/workers/main.d.ts +46 -0
- package/dist/node/workers/main.d.ts.map +1 -0
- package/dist/node/workers/main.js +230 -0
- package/dist/node/workers/main.js.map +1 -0
- package/dist/node/workers/process.d.ts +42 -0
- package/dist/node/workers/process.d.ts.map +1 -0
- package/dist/node/workers/process.js +125 -0
- package/dist/node/workers/process.js.map +1 -0
- package/dist/node/workers/workers.d.ts +122 -0
- package/dist/node/workers/workers.d.ts.map +1 -0
- package/dist/node/workers/workers.js +677 -0
- package/dist/node/workers/workers.js.map +1 -0
- package/dist/output.d.ts +1 -1
- package/dist/output.d.ts.map +1 -1
- package/dist/output.js +4 -2
- package/dist/output.js.map +1 -1
- package/dist/react/hooks.d.ts +43 -0
- package/dist/react/hooks.d.ts.map +1 -0
- package/dist/react/hooks.js +82 -0
- package/dist/react/hooks.js.map +1 -0
- package/dist/react/index.d.ts +3 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +4 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/stores.d.ts +9 -0
- package/dist/react/stores.d.ts.map +1 -0
- package/dist/react/stores.js +37 -0
- package/dist/react/stores.js.map +1 -0
- package/dist/registries/contribution.d.ts +50 -0
- package/dist/registries/contribution.d.ts.map +1 -0
- package/dist/registries/contribution.js +129 -0
- package/dist/registries/contribution.js.map +1 -0
- package/dist/registries/entries.d.ts +18 -0
- package/dist/registries/entries.d.ts.map +1 -0
- package/dist/registries/entries.js +42 -0
- package/dist/registries/entries.js.map +1 -0
- package/dist/registries/index.d.ts +3 -0
- package/dist/registries/index.d.ts.map +1 -0
- package/dist/registries/index.js +5 -0
- package/dist/registries/index.js.map +1 -0
- package/dist/registries/internal.d.ts +4 -0
- package/dist/registries/internal.d.ts.map +1 -0
- package/dist/registries/internal.js +5 -0
- package/dist/registries/internal.js.map +1 -0
- package/dist/registries/record.d.ts +115 -0
- package/dist/registries/record.d.ts.map +1 -0
- package/dist/registries/record.js +283 -0
- package/dist/registries/record.js.map +1 -0
- package/dist/registries/registry.d.ts +74 -0
- package/dist/registries/registry.d.ts.map +1 -0
- package/dist/registries/registry.js +14 -0
- package/dist/registries/registry.js.map +1 -0
- package/dist/registries/value.d.ts +48 -0
- package/dist/registries/value.d.ts.map +1 -0
- package/dist/registries/value.js +224 -0
- package/dist/registries/value.js.map +1 -0
- package/dist/remote/calls.d.ts +25 -0
- package/dist/remote/calls.d.ts.map +1 -0
- package/dist/remote/calls.js +62 -0
- package/dist/remote/calls.js.map +1 -0
- package/dist/remote/consumer.d.ts +43 -0
- package/dist/remote/consumer.d.ts.map +1 -0
- package/dist/remote/consumer.js +350 -0
- package/dist/remote/consumer.js.map +1 -0
- package/dist/remote/hold.d.ts +141 -0
- package/dist/remote/hold.d.ts.map +1 -0
- package/dist/remote/hold.js +579 -0
- package/dist/remote/hold.js.map +1 -0
- package/dist/remote/host-link.d.ts +77 -0
- package/dist/remote/host-link.d.ts.map +1 -0
- package/dist/remote/host-link.js +184 -0
- package/dist/remote/host-link.js.map +1 -0
- package/dist/remote/internal.d.ts +6 -0
- package/dist/remote/internal.d.ts.map +1 -0
- package/dist/remote/internal.js +6 -0
- package/dist/remote/internal.js.map +1 -0
- package/dist/remote/path.d.ts +46 -0
- package/dist/remote/path.d.ts.map +1 -0
- package/dist/remote/path.js +73 -0
- package/dist/remote/path.js.map +1 -0
- package/dist/remote/provider.d.ts +89 -0
- package/dist/remote/provider.d.ts.map +1 -0
- package/dist/remote/provider.js +597 -0
- package/dist/remote/provider.js.map +1 -0
- package/dist/remote/relay.d.ts +69 -0
- package/dist/remote/relay.d.ts.map +1 -0
- package/dist/remote/relay.js +219 -0
- package/dist/remote/relay.js.map +1 -0
- package/dist/remote/remote-object.d.ts +138 -0
- package/dist/remote/remote-object.d.ts.map +1 -0
- package/dist/remote/remote-object.js +492 -0
- package/dist/remote/remote-object.js.map +1 -0
- package/dist/remote/replica.d.ts +59 -0
- package/dist/remote/replica.d.ts.map +1 -0
- package/dist/remote/replica.js +125 -0
- package/dist/remote/replica.js.map +1 -0
- package/dist/sqlite/cloudflare.d.ts +2 -0
- package/dist/sqlite/cloudflare.d.ts.map +1 -1
- package/dist/sqlite/cloudflare.js +10 -0
- package/dist/sqlite/cloudflare.js.map +1 -1
- package/dist/sqlite/database.d.ts +5 -2
- package/dist/sqlite/database.d.ts.map +1 -1
- package/dist/sqlite/database.js.map +1 -1
- package/dist/sqlite/node.d.ts +13 -2
- package/dist/sqlite/node.d.ts.map +1 -1
- package/dist/sqlite/node.js +31 -8
- package/dist/sqlite/node.js.map +1 -1
- package/dist/state/batch.d.ts +64 -0
- package/dist/state/batch.d.ts.map +1 -0
- package/dist/state/batch.js +164 -0
- package/dist/state/batch.js.map +1 -0
- package/dist/state/derive.d.ts +52 -0
- package/dist/state/derive.d.ts.map +1 -0
- package/dist/state/derive.js +182 -0
- package/dist/state/derive.js.map +1 -0
- package/dist/state/index.d.ts +6 -0
- package/dist/state/index.d.ts.map +1 -0
- package/dist/state/index.js +4 -0
- package/dist/state/index.js.map +1 -0
- package/dist/state/internal.d.ts +6 -0
- package/dist/state/internal.d.ts.map +1 -0
- package/dist/state/internal.js +8 -0
- package/dist/state/internal.js.map +1 -0
- package/dist/state/native-source.d.ts +106 -0
- package/dist/state/native-source.d.ts.map +1 -0
- package/dist/state/native-source.js +240 -0
- package/dist/state/native-source.js.map +1 -0
- package/dist/state/watchable.d.ts +114 -0
- package/dist/state/watchable.d.ts.map +1 -0
- package/dist/state/watchable.js +156 -0
- package/dist/state/watchable.js.map +1 -0
- package/dist/state/writable.d.ts +32 -0
- package/dist/state/writable.d.ts.map +1 -0
- package/dist/state/writable.js +49 -0
- package/dist/state/writable.js.map +1 -0
- package/dist/store/adapter.d.ts +67 -0
- package/dist/store/adapter.d.ts.map +1 -0
- package/dist/store/adapter.js +118 -0
- package/dist/store/adapter.js.map +1 -0
- package/dist/store/allocator.d.ts +17 -0
- package/dist/store/allocator.d.ts.map +1 -0
- package/dist/store/allocator.js +30 -0
- package/dist/store/allocator.js.map +1 -0
- package/dist/store/applier.d.ts +8 -0
- package/dist/store/applier.d.ts.map +1 -0
- package/dist/store/applier.js +375 -0
- package/dist/store/applier.js.map +1 -0
- package/dist/store/apply-batch.d.ts +12 -0
- package/dist/store/apply-batch.d.ts.map +1 -0
- package/dist/store/apply-batch.js +83 -0
- package/dist/store/apply-batch.js.map +1 -0
- package/dist/store/archive.d.ts +32 -0
- package/dist/store/archive.d.ts.map +1 -0
- package/dist/store/archive.js +130 -0
- package/dist/store/archive.js.map +1 -0
- package/dist/store/backend.d.ts +10 -0
- package/dist/store/backend.d.ts.map +1 -0
- package/dist/store/backend.js +15 -0
- package/dist/store/backend.js.map +1 -0
- package/dist/store/catalog.d.ts +24 -0
- package/dist/store/catalog.d.ts.map +1 -0
- package/dist/store/catalog.js +17 -0
- package/dist/store/catalog.js.map +1 -0
- package/dist/store/claims.d.ts +23 -0
- package/dist/store/claims.d.ts.map +1 -0
- package/dist/store/claims.js +65 -0
- package/dist/store/claims.js.map +1 -0
- package/dist/store/columns.d.ts +77 -0
- package/dist/store/columns.d.ts.map +1 -0
- package/dist/store/columns.js +77 -0
- package/dist/store/columns.js.map +1 -0
- package/dist/store/engine.d.ts +176 -0
- package/dist/store/engine.d.ts.map +1 -0
- package/dist/store/engine.js +283 -0
- package/dist/store/engine.js.map +1 -0
- package/dist/store/evaluate.d.ts +17 -0
- package/dist/store/evaluate.d.ts.map +1 -0
- package/dist/store/evaluate.js +128 -0
- package/dist/store/evaluate.js.map +1 -0
- package/dist/store/export.d.ts +17 -0
- package/dist/store/export.d.ts.map +1 -0
- package/dist/store/export.js +200 -0
- package/dist/store/export.js.map +1 -0
- package/dist/store/expression.d.ts +150 -0
- package/dist/store/expression.d.ts.map +1 -0
- package/dist/store/expression.js +268 -0
- package/dist/store/expression.js.map +1 -0
- package/dist/store/import.d.ts +10 -0
- package/dist/store/import.d.ts.map +1 -0
- package/dist/store/import.js +276 -0
- package/dist/store/import.js.map +1 -0
- package/dist/store/index.d.ts +16 -0
- package/dist/store/index.d.ts.map +1 -0
- package/dist/store/index.js +13 -0
- package/dist/store/index.js.map +1 -0
- package/dist/store/json-column.d.ts +33 -0
- package/dist/store/json-column.d.ts.map +1 -0
- package/dist/store/json-column.js +62 -0
- package/dist/store/json-column.js.map +1 -0
- package/dist/store/jsonl.d.ts +9 -0
- package/dist/store/jsonl.d.ts.map +1 -0
- package/dist/store/jsonl.js +61 -0
- package/dist/store/jsonl.js.map +1 -0
- package/dist/store/live-query.d.ts +108 -0
- package/dist/store/live-query.d.ts.map +1 -0
- package/dist/store/live-query.js +254 -0
- package/dist/store/live-query.js.map +1 -0
- package/dist/store/outbox.d.ts +26 -0
- package/dist/store/outbox.d.ts.map +1 -0
- package/dist/store/outbox.js +80 -0
- package/dist/store/outbox.js.map +1 -0
- package/dist/store/query.d.ts +39 -0
- package/dist/store/query.d.ts.map +1 -0
- package/dist/store/query.js +97 -0
- package/dist/store/query.js.map +1 -0
- package/dist/store/refusal.d.ts +15 -0
- package/dist/store/refusal.d.ts.map +1 -0
- package/dist/store/refusal.js +36 -0
- package/dist/store/refusal.js.map +1 -0
- package/dist/store/rows.d.ts +80 -0
- package/dist/store/rows.d.ts.map +1 -0
- package/dist/store/rows.js +183 -0
- package/dist/store/rows.js.map +1 -0
- package/dist/store/schema.d.ts +25 -0
- package/dist/store/schema.d.ts.map +1 -0
- package/dist/store/schema.js +115 -0
- package/dist/store/schema.js.map +1 -0
- package/dist/store/sql.d.ts +73 -0
- package/dist/store/sql.d.ts.map +1 -0
- package/dist/store/sql.js +234 -0
- package/dist/store/sql.js.map +1 -0
- package/dist/store/step.d.ts +50 -0
- package/dist/store/step.d.ts.map +1 -0
- package/dist/store/step.js +52 -0
- package/dist/store/step.js.map +1 -0
- package/dist/store/store.d.ts +171 -0
- package/dist/store/store.d.ts.map +1 -0
- package/dist/store/store.js +818 -0
- package/dist/store/store.js.map +1 -0
- package/dist/store/table-changes.d.ts +29 -0
- package/dist/store/table-changes.d.ts.map +1 -0
- package/dist/store/table-changes.js +102 -0
- package/dist/store/table-changes.js.map +1 -0
- package/dist/store/table-evolve.d.ts +74 -0
- package/dist/store/table-evolve.d.ts.map +1 -0
- package/dist/store/table-evolve.js +201 -0
- package/dist/store/table-evolve.js.map +1 -0
- package/dist/store/table-handle.d.ts +73 -0
- package/dist/store/table-handle.d.ts.map +1 -0
- package/dist/store/table-handle.js +101 -0
- package/dist/store/table-handle.js.map +1 -0
- package/dist/store/table-history.d.ts +75 -0
- package/dist/store/table-history.d.ts.map +1 -0
- package/dist/store/table-history.js +42 -0
- package/dist/store/table-history.js.map +1 -0
- package/dist/store/table-migration.d.ts +16 -0
- package/dist/store/table-migration.d.ts.map +1 -0
- package/dist/store/table-migration.js +202 -0
- package/dist/store/table-migration.js.map +1 -0
- package/dist/store/table-writes.d.ts +125 -0
- package/dist/store/table-writes.d.ts.map +1 -0
- package/dist/store/table-writes.js +170 -0
- package/dist/store/table-writes.js.map +1 -0
- package/dist/store/table.d.ts +80 -0
- package/dist/store/table.d.ts.map +1 -0
- package/dist/store/table.js +103 -0
- package/dist/store/table.js.map +1 -0
- package/dist/store/text.d.ts +14 -0
- package/dist/store/text.d.ts.map +1 -0
- package/dist/store/text.js +51 -0
- package/dist/store/text.js.map +1 -0
- package/dist/store/writes.d.ts +5 -0
- package/dist/store/writes.d.ts.map +1 -0
- package/dist/store/writes.js +4 -0
- package/dist/store/writes.js.map +1 -0
- package/dist/surfaces/active-language.d.ts +20 -0
- package/dist/surfaces/active-language.d.ts.map +1 -0
- package/dist/surfaces/active-language.js +78 -0
- package/dist/surfaces/active-language.js.map +1 -0
- package/dist/surfaces/active-theme.d.ts +16 -0
- package/dist/surfaces/active-theme.d.ts.map +1 -0
- package/dist/surfaces/active-theme.js +47 -0
- package/dist/surfaces/active-theme.js.map +1 -0
- package/dist/surfaces/client.d.ts +96 -0
- package/dist/surfaces/client.d.ts.map +1 -0
- package/dist/surfaces/client.js +264 -0
- package/dist/surfaces/client.js.map +1 -0
- package/dist/surfaces/connection.d.ts +49 -0
- package/dist/surfaces/connection.d.ts.map +1 -0
- package/dist/surfaces/connection.js +142 -0
- package/dist/surfaces/connection.js.map +1 -0
- package/dist/surfaces/format.d.ts +5 -0
- package/dist/surfaces/format.d.ts.map +1 -0
- package/dist/surfaces/format.js +37 -0
- package/dist/surfaces/format.js.map +1 -0
- package/dist/surfaces/index.d.ts +15 -0
- package/dist/surfaces/index.d.ts.map +1 -0
- package/dist/surfaces/index.js +18 -0
- package/dist/surfaces/index.js.map +1 -0
- package/dist/surfaces/language.d.ts +53 -0
- package/dist/surfaces/language.d.ts.map +1 -0
- package/dist/surfaces/language.js +74 -0
- package/dist/surfaces/language.js.map +1 -0
- package/dist/surfaces/loaded.d.ts +42 -0
- package/dist/surfaces/loaded.d.ts.map +1 -0
- package/dist/surfaces/loaded.js +116 -0
- package/dist/surfaces/loaded.js.map +1 -0
- package/dist/surfaces/locale-choice.d.ts +25 -0
- package/dist/surfaces/locale-choice.d.ts.map +1 -0
- package/dist/surfaces/locale-choice.js +14 -0
- package/dist/surfaces/locale-choice.js.map +1 -0
- package/dist/surfaces/messages.d.ts +67 -0
- package/dist/surfaces/messages.d.ts.map +1 -0
- package/dist/surfaces/messages.js +112 -0
- package/dist/surfaces/messages.js.map +1 -0
- package/dist/surfaces/page-state.d.ts +14 -0
- package/dist/surfaces/page-state.d.ts.map +1 -0
- package/dist/surfaces/page-state.js +43 -0
- package/dist/surfaces/page-state.js.map +1 -0
- package/dist/surfaces/preference.d.ts +32 -0
- package/dist/surfaces/preference.d.ts.map +1 -0
- package/dist/surfaces/preference.js +72 -0
- package/dist/surfaces/preference.js.map +1 -0
- package/dist/surfaces/registered.d.ts +33 -0
- package/dist/surfaces/registered.d.ts.map +1 -0
- package/dist/surfaces/registered.js +51 -0
- package/dist/surfaces/registered.js.map +1 -0
- package/dist/surfaces/scripts.d.ts +84 -0
- package/dist/surfaces/scripts.d.ts.map +1 -0
- package/dist/surfaces/scripts.js +28 -0
- package/dist/surfaces/scripts.js.map +1 -0
- package/dist/surfaces/theme-choice.d.ts +31 -0
- package/dist/surfaces/theme-choice.d.ts.map +1 -0
- package/dist/surfaces/theme-choice.js +18 -0
- package/dist/surfaces/theme-choice.js.map +1 -0
- package/dist/surfaces/themes.d.ts +43 -0
- package/dist/surfaces/themes.d.ts.map +1 -0
- package/dist/surfaces/themes.js +110 -0
- package/dist/surfaces/themes.js.map +1 -0
- package/dist/surfaces/translations.d.ts +29 -0
- package/dist/surfaces/translations.d.ts.map +1 -0
- package/dist/surfaces/translations.js +57 -0
- package/dist/surfaces/translations.js.map +1 -0
- package/dist/sync/batch.d.ts +18 -0
- package/dist/sync/batch.d.ts.map +1 -0
- package/dist/sync/batch.js +125 -0
- package/dist/sync/batch.js.map +1 -0
- package/dist/sync/client.d.ts +166 -0
- package/dist/sync/client.d.ts.map +1 -0
- package/dist/sync/client.js +438 -0
- package/dist/sync/client.js.map +1 -0
- package/dist/sync/files.d.ts +46 -0
- package/dist/sync/files.d.ts.map +1 -0
- package/dist/sync/files.js +13 -0
- package/dist/sync/files.js.map +1 -0
- package/dist/sync/filesystem.d.ts +37 -0
- package/dist/sync/filesystem.d.ts.map +1 -0
- package/dist/sync/filesystem.js +185 -0
- package/dist/sync/filesystem.js.map +1 -0
- package/dist/sync/index.d.ts +8 -0
- package/dist/sync/index.d.ts.map +1 -0
- package/dist/sync/index.js +9 -0
- package/dist/sync/index.js.map +1 -0
- package/dist/sync/lines.d.ts +18 -0
- package/dist/sync/lines.d.ts.map +1 -0
- package/dist/sync/lines.js +46 -0
- package/dist/sync/lines.js.map +1 -0
- package/dist/sync/remote.d.ts +130 -0
- package/dist/sync/remote.d.ts.map +1 -0
- package/dist/sync/remote.js +46 -0
- package/dist/sync/remote.js.map +1 -0
- package/dist/sync/state.d.ts +17 -0
- package/dist/sync/state.d.ts.map +1 -0
- package/dist/sync/state.js +40 -0
- package/dist/sync/state.js.map +1 -0
- package/dist/telemetry-ingest/batch.d.ts +70 -0
- package/dist/telemetry-ingest/batch.d.ts.map +1 -0
- package/dist/telemetry-ingest/batch.js +110 -0
- package/dist/telemetry-ingest/batch.js.map +1 -0
- package/dist/telemetry-ingest/facet.d.ts +21 -0
- package/dist/telemetry-ingest/facet.d.ts.map +1 -0
- package/dist/telemetry-ingest/facet.js +96 -0
- package/dist/telemetry-ingest/facet.js.map +1 -0
- package/dist/telemetry-ingest/index.d.ts +5 -0
- package/dist/telemetry-ingest/index.d.ts.map +1 -0
- package/dist/telemetry-ingest/index.js +8 -0
- package/dist/telemetry-ingest/index.js.map +1 -0
- package/dist/telemetry-ingest/recorder.d.ts +50 -0
- package/dist/telemetry-ingest/recorder.d.ts.map +1 -0
- package/dist/telemetry-ingest/recorder.js +298 -0
- package/dist/telemetry-ingest/recorder.js.map +1 -0
- package/dist/telemetry-ingest/sender.d.ts +14 -0
- package/dist/telemetry-ingest/sender.d.ts.map +1 -0
- package/dist/telemetry-ingest/sender.js +64 -0
- package/dist/telemetry-ingest/sender.js.map +1 -0
- package/dist/telemetry-sqlite/index.d.ts +13 -4
- package/dist/telemetry-sqlite/index.d.ts.map +1 -1
- package/dist/telemetry-sqlite/index.js +81 -241
- package/dist/telemetry-sqlite/index.js.map +1 -1
- package/dist/telemetry-sqlite/node.d.ts +13 -0
- package/dist/telemetry-sqlite/node.d.ts.map +1 -0
- package/dist/telemetry-sqlite/node.js +27 -0
- package/dist/telemetry-sqlite/node.js.map +1 -0
- package/dist/telemetry-sqlite/schema.d.ts +9 -0
- package/dist/telemetry-sqlite/schema.d.ts.map +1 -0
- package/dist/telemetry-sqlite/schema.js +61 -0
- package/dist/telemetry-sqlite/schema.js.map +1 -0
- package/dist/telemetry-sqlite/store.d.ts +3 -0
- package/dist/telemetry-sqlite/store.d.ts.map +1 -1
- package/dist/telemetry-sqlite/store.js +24 -13
- package/dist/telemetry-sqlite/store.js.map +1 -1
- package/dist/telemetry.d.ts +937 -0
- package/dist/telemetry.d.ts.map +1 -0
- package/dist/telemetry.js +470 -0
- package/dist/telemetry.js.map +1 -0
- package/dist/tui/bridge.d.ts +112 -0
- package/dist/tui/bridge.d.ts.map +1 -0
- package/dist/tui/bridge.js +9 -0
- package/dist/tui/bridge.js.map +1 -0
- package/dist/tui/channel.d.ts +44 -0
- package/dist/tui/channel.d.ts.map +1 -0
- package/dist/tui/channel.js +150 -0
- package/dist/tui/channel.js.map +1 -0
- package/dist/tui/frames.d.ts +5 -0
- package/dist/tui/frames.d.ts.map +1 -0
- package/dist/tui/frames.js +52 -0
- package/dist/tui/frames.js.map +1 -0
- package/dist/tui/index.d.ts +7 -0
- package/dist/tui/index.d.ts.map +1 -0
- package/dist/tui/index.js +8 -0
- package/dist/tui/index.js.map +1 -0
- package/dist/tui/runtime.d.ts +46 -0
- package/dist/tui/runtime.d.ts.map +1 -0
- package/dist/tui/runtime.js +101 -0
- package/dist/tui/runtime.js.map +1 -0
- package/dist/tui/scope.d.ts +46 -0
- package/dist/tui/scope.d.ts.map +1 -0
- package/dist/tui/scope.js +141 -0
- package/dist/tui/scope.js.map +1 -0
- package/dist/tui/terminal.d.ts +15 -0
- package/dist/tui/terminal.d.ts.map +1 -0
- package/dist/tui/terminal.js +37 -0
- package/dist/tui/terminal.js.map +1 -0
- package/dist/tui/theme.d.ts +17 -0
- package/dist/tui/theme.d.ts.map +1 -0
- package/dist/tui/theme.js +38 -0
- package/dist/tui/theme.js.map +1 -0
- package/dist/watch.d.ts +194 -0
- package/dist/watch.d.ts.map +1 -0
- package/dist/watch.js +383 -0
- package/dist/watch.js.map +1 -0
- package/dist/web/environment.d.ts +4 -0
- package/dist/web/environment.d.ts.map +1 -0
- package/dist/web/environment.js +37 -0
- package/dist/web/environment.js.map +1 -0
- package/dist/web/index.d.ts +5 -0
- package/dist/web/index.d.ts.map +1 -0
- package/dist/web/index.js +7 -0
- package/dist/web/index.js.map +1 -0
- package/dist/web/language.d.ts +7 -0
- package/dist/web/language.d.ts.map +1 -0
- package/dist/web/language.js +21 -0
- package/dist/web/language.js.map +1 -0
- package/dist/web/page.d.ts +29 -0
- package/dist/web/page.d.ts.map +1 -0
- package/dist/web/page.js +92 -0
- package/dist/web/page.js.map +1 -0
- package/dist/web/scripts.d.ts +23 -0
- package/dist/web/scripts.d.ts.map +1 -0
- package/dist/web/scripts.js +50 -0
- package/dist/web/scripts.js.map +1 -0
- package/dist/web/styles.d.ts +17 -0
- package/dist/web/styles.d.ts.map +1 -0
- package/dist/web/styles.js +218 -0
- package/dist/web/styles.js.map +1 -0
- package/dist/web/themes.d.ts +6 -0
- package/dist/web/themes.d.ts.map +1 -0
- package/dist/web/themes.js +31 -0
- package/dist/web/themes.js.map +1 -0
- package/docs/benchmarks.md +1036 -0
- package/docs/decisions.md +3436 -0
- package/docs/dependencies/book.md +1671 -0
- package/docs/dependencies/index.html +2641 -0
- package/docs/dependencies/model.md +330 -0
- package/docs/design.md +3065 -0
- package/docs/durable-observers/book.md +432 -0
- package/docs/durable-observers/index.html +517 -0
- package/docs/flow-control/book.md +333 -0
- package/docs/flow-control/fold/index.html +265 -0
- package/docs/flow-control/index.html +548 -0
- package/docs/flow-control/window/index.html +228 -0
- package/docs/guide-plugins-hosts/book.md +957 -0
- package/docs/guide-plugins-hosts/index.html +952 -0
- package/docs/http-workers/book.md +378 -0
- package/docs/http-workers/index.html +515 -0
- package/docs/i18n/book.md +217 -0
- package/docs/i18n/index.html +344 -0
- package/docs/layer-1.md +311 -0
- package/docs/layer-2.md +216 -0
- package/docs/p3-features/README.md +6 -0
- package/docs/p3-features/book.md +478 -0
- package/docs/plugin-authoring.md +276 -0
- package/docs/plugin-model/book.md +186 -0
- package/docs/plugin-model/index.html +310 -0
- package/docs/plugin-primer/book.md +273 -0
- package/docs/plugin-primer/index.html +430 -0
- package/docs/slice-1.md +236 -0
- package/docs/slice-10.md +288 -0
- package/docs/slice-11.md +114 -0
- package/docs/slice-12.md +132 -0
- package/docs/slice-13.md +121 -0
- package/docs/slice-2.md +174 -0
- package/docs/slice-3a.md +296 -0
- package/docs/slice-3b.md +197 -0
- package/docs/slice-4.md +146 -0
- package/docs/slice-4a.md +418 -0
- package/docs/slice-4b.md +208 -0
- package/docs/slice-5.md +281 -0
- package/docs/slice-6a.md +676 -0
- package/docs/slice-6b.md +332 -0
- package/docs/slice-7a.md +130 -0
- package/docs/slice-7b/book.md +608 -0
- package/docs/slice-7b/index.html +842 -0
- package/docs/slice-7b.md +255 -0
- package/docs/slice-7c.md +165 -0
- package/docs/slice-8.md +194 -0
- package/docs/slice-9.md +110 -0
- package/docs/slices.md +241 -0
- package/docs/store/book.md +670 -0
- package/docs/store/index.html +861 -0
- package/docs/store/walkthrough.md +193 -0
- package/docs/theming/book.md +223 -0
- package/docs/theming/index.html +371 -0
- package/docs/tutorial/book.md +2169 -0
- package/docs/tutorial/index.html +2112 -0
- package/docs/tutorial/screens/click-after.png +0 -0
- package/docs/tutorial/screens/click-before.png +0 -0
- package/docs/tutorial/screens/edited.png +0 -0
- package/docs/tutorial/screens/french.png +0 -0
- package/docs/tutorial/screens/harbor.png +0 -0
- package/docs/tutorial/screens/page.png +0 -0
- package/docs/tutorial/screens/traces-ada.png +0 -0
- package/docs/tutorial/screens/traces.png +0 -0
- package/package.json +114 -20
- package/src/delta/README.md +69 -0
- package/dist/cell.d.ts +0 -122
- package/dist/cell.d.ts.map +0 -1
- package/dist/cell.js +0 -356
- package/dist/cell.js.map +0 -1
- package/dist/cluster.d.ts +0 -27
- package/dist/cluster.d.ts.map +0 -1
- package/dist/cluster.js +0 -230
- package/dist/cluster.js.map +0 -1
- package/dist/connection.d.ts +0 -270
- package/dist/connection.d.ts.map +0 -1
- package/dist/connection.js +0 -1216
- package/dist/connection.js.map +0 -1
- package/dist/contract.d.ts +0 -208
- package/dist/contract.d.ts.map +0 -1
- package/dist/contract.js +0 -246
- package/dist/contract.js.map +0 -1
- package/dist/declare.d.ts +0 -33
- package/dist/declare.d.ts.map +0 -1
- package/dist/declare.js +0 -2
- package/dist/declare.js.map +0 -1
- package/dist/errors.d.ts +0 -28
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -59
- package/dist/errors.js.map +0 -1
- package/dist/host.d.ts +0 -348
- package/dist/host.d.ts.map +0 -1
- package/dist/host.js +0 -1000
- package/dist/host.js.map +0 -1
- package/dist/link.d.ts +0 -107
- package/dist/link.d.ts.map +0 -1
- package/dist/link.js +0 -355
- package/dist/link.js.map +0 -1
- package/dist/loader.d.ts +0 -4
- package/dist/loader.d.ts.map +0 -1
- package/dist/loader.js +0 -73
- package/dist/loader.js.map +0 -1
- package/dist/manager.d.ts +0 -115
- package/dist/manager.d.ts.map +0 -1
- package/dist/manager.js +0 -345
- package/dist/manager.js.map +0 -1
- package/dist/node.d.ts +0 -4
- package/dist/node.d.ts.map +0 -1
- package/dist/node.js +0 -4
- package/dist/node.js.map +0 -1
- package/dist/object.d.ts +0 -438
- package/dist/object.d.ts.map +0 -1
- package/dist/object.js +0 -1571
- package/dist/object.js.map +0 -1
- package/dist/publish.d.ts +0 -5
- package/dist/publish.d.ts.map +0 -1
- package/dist/publish.js +0 -40
- package/dist/publish.js.map +0 -1
- package/dist/registry.d.ts +0 -25
- package/dist/registry.d.ts.map +0 -1
- package/dist/registry.js +0 -6
- package/dist/registry.js.map +0 -1
- package/dist/reload.d.ts +0 -126
- package/dist/reload.d.ts.map +0 -1
- package/dist/reload.js +0 -653
- package/dist/reload.js.map +0 -1
- package/dist/remote.d.ts +0 -165
- package/dist/remote.d.ts.map +0 -1
- package/dist/remote.js +0 -612
- package/dist/remote.js.map +0 -1
- package/dist/schema.d.ts +0 -21
- package/dist/schema.d.ts.map +0 -1
- package/dist/schema.js +0 -228
- package/dist/schema.js.map +0 -1
- package/dist/state.d.ts +0 -92
- package/dist/state.d.ts.map +0 -1
- package/dist/state.js +0 -287
- package/dist/state.js.map +0 -1
- package/dist/types.d.ts +0 -88
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
- package/dist/websocket.d.ts +0 -15
- package/dist/websocket.d.ts.map +0 -1
- package/dist/websocket.js +0 -16
- package/dist/websocket.js.map +0 -1
- package/dist/wire.d.ts +0 -216
- package/dist/wire.d.ts.map +0 -1
- package/dist/wire.js +0 -165
- package/dist/wire.js.map +0 -1
- package/docs/guide.md +0 -814
- package/docs/spec.md +0 -288
- package/docs/tutorial.md +0 -931
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// The client surfaces' portable part (slice 11): the scripts objects a server serves and clients hold, plugin scripts
|
|
2
|
+
// that register themselves, a client host kept connected and current, a host's loaded plugins, themes, and messages and
|
|
3
|
+
// languages.
|
|
4
|
+
export { followActiveLanguage, hostLanguage } from "./active-language.js";
|
|
5
|
+
export { followActiveTheme } from "./active-theme.js";
|
|
6
|
+
export { startClient, } from "./client.js";
|
|
7
|
+
export { keepConnected, } from "./connection.js";
|
|
8
|
+
export { formatNumber, formatTime } from "./format.js";
|
|
9
|
+
export { createLanguage } from "./language.js";
|
|
10
|
+
export { LoadedFacets } from "./loaded.js";
|
|
11
|
+
export { LocaleChoice, localeChoiceFacet } from "./locale-choice.js";
|
|
12
|
+
export { defineMessages, MessageSchema, } from "./messages.js";
|
|
13
|
+
export { evaluateRegistered, REGISTER, registeredSource, } from "./registered.js";
|
|
14
|
+
export { ScriptSet, TuiScripts, WebScripts } from "./scripts.js";
|
|
15
|
+
export { ThemeChoice, themeChoiceFacet } from "./theme-choice.js";
|
|
16
|
+
export { activeTheme, BASE_ROLES, FALLBACK_THEMES, Themes, terminalColor, themesFacet, themeVariables, } from "./themes.js";
|
|
17
|
+
export { Translations, translationsFacet, } from "./translations.js";
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/surfaces/index.ts"],"names":[],"mappings":"AAAA,sHAAsH;AACtH,wHAAwH;AACxH,aAAa;AAEb,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAyB,MAAM,sBAAsB,CAAC;AACjG,OAAO,EAAE,iBAAiB,EAAsB,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAKN,WAAW,GACX,MAAM,aAAa,CAAC;AACrB,OAAO,EAEN,aAAa,GAKb,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,cAAc,EAAsC,MAAM,eAAe,CAAC;AACnF,OAAO,EAAE,YAAY,EAAgC,MAAM,aAAa,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,EAIN,cAAc,EAId,aAAa,GAKb,MAAM,eAAe,CAAC;AACvB,OAAO,EAEN,kBAAkB,EAElB,QAAQ,EAER,gBAAgB,GAChB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAoB,SAAS,EAAwB,UAAU,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACzG,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EACN,WAAW,EACX,UAAU,EAGV,eAAe,EAGf,MAAM,EACN,aAAa,EACb,WAAW,EACX,cAAc,GACd,MAAM,aAAa,CAAC;AACrB,OAAO,EAGN,YAAY,EACZ,iBAAiB,GACjB,MAAM,mBAAmB,CAAC","sourcesContent":["// The client surfaces' portable part (slice 11): the scripts objects a server serves and clients hold, plugin scripts\n// that register themselves, a client host kept connected and current, a host's loaded plugins, themes, and messages and\n// languages.\n\nexport { followActiveLanguage, hostLanguage, type LanguageFollower } from \"./active-language.ts\";\nexport { followActiveTheme, type ThemeFollower } from \"./active-theme.ts\";\nexport {\n\ttype Client,\n\ttype ClientError,\n\ttype ClientOptions,\n\ttype ClientStyles,\n\tstartClient,\n} from \"./client.ts\";\nexport {\n\ttype ConnectionState,\n\tkeepConnected,\n\ttype LoopEnvironment,\n\ttype LoopLink,\n\ttype LoopOptions,\n\ttype SocketEvents,\n} from \"./connection.ts\";\nexport { formatNumber, formatTime } from \"./format.ts\";\nexport { createLanguage, type Language, type MessagesReport } from \"./language.ts\";\nexport { LoadedFacets, type Prepared, type SetEntry } from \"./loaded.ts\";\nexport { LocaleChoice, localeChoiceFacet } from \"./locale-choice.ts\";\nexport {\n\ttype Catalog,\n\ttype CatalogShape,\n\ttype DataKeys,\n\tdefineMessages,\n\ttype MessageArgs,\n\ttype MessageData,\n\ttype MessageParam,\n\tMessageSchema,\n\ttype Messages,\n\ttype MessagesOf,\n\ttype MessageValue,\n\ttype Translator,\n} from \"./messages.ts\";\nexport {\n\ttype ClientModules,\n\tevaluateRegistered,\n\ttype FacetFunction,\n\tREGISTER,\n\ttype RegisteredScript,\n\tregisteredSource,\n} from \"./registered.ts\";\nexport { type ScriptEntry, ScriptSet, type ScriptsContract, TuiScripts, WebScripts } from \"./scripts.ts\";\nexport { ThemeChoice, themeChoiceFacet } from \"./theme-choice.ts\";\nexport {\n\tactiveTheme,\n\tBASE_ROLES,\n\ttype BaseRole,\n\ttype ColorDepth,\n\tFALLBACK_THEMES,\n\ttype Theme,\n\ttype ThemePick,\n\tThemes,\n\tterminalColor,\n\tthemesFacet,\n\tthemeVariables,\n} from \"./themes.ts\";\nexport {\n\ttype Translation,\n\ttype TranslationIndex,\n\tTranslations,\n\ttranslationsFacet,\n} from \"./translations.ts\";\n"]}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { type TranslationIndex } from "./translations.ts";
|
|
2
|
+
/** A locale to render in: its direction, its fallback chain, the host's catalogs and the reports' destination. */
|
|
3
|
+
export type Language = {
|
|
4
|
+
/** A canonical language tag (`de`, `pt-BR`). */
|
|
5
|
+
readonly locale: string;
|
|
6
|
+
readonly dir: "ltr" | "rtl";
|
|
7
|
+
/** The locales tried in order before a namespace's first catalog: `pt-BR`, `pt`. */
|
|
8
|
+
readonly chain: readonly string[];
|
|
9
|
+
readonly translations: TranslationIndex;
|
|
10
|
+
readonly report: (report: MessagesReport) => void;
|
|
11
|
+
};
|
|
12
|
+
/** What rendering reports: a key found only further down the chain, a contributed message that threw, a foreign message. */
|
|
13
|
+
export type MessagesReport = {
|
|
14
|
+
readonly kind: "fallback";
|
|
15
|
+
readonly namespace: string;
|
|
16
|
+
readonly locale: string;
|
|
17
|
+
readonly key: string;
|
|
18
|
+
/** The locale whose catalog had the key; `undefined`: the namespace's first catalog. */
|
|
19
|
+
readonly used: string | undefined;
|
|
20
|
+
} | {
|
|
21
|
+
readonly kind: "failed";
|
|
22
|
+
readonly namespace: string;
|
|
23
|
+
readonly locale: string;
|
|
24
|
+
readonly key: string;
|
|
25
|
+
/** The contributing plugin; `undefined`: the namespace's own catalogs (a message from a link that does not fit). */
|
|
26
|
+
readonly plugin: string | undefined;
|
|
27
|
+
readonly error: unknown;
|
|
28
|
+
}
|
|
29
|
+
/** `t.render` got a message of another namespace or a key the catalogs do not have: it shows the key. */
|
|
30
|
+
| {
|
|
31
|
+
readonly kind: "unknown";
|
|
32
|
+
readonly namespace: string;
|
|
33
|
+
readonly key: string;
|
|
34
|
+
readonly expected: string;
|
|
35
|
+
};
|
|
36
|
+
/** The language `locale` (canonical) with the host's `translations`; `report` gets every report as it happens. */
|
|
37
|
+
export declare function createLanguage(locale: string, translations: TranslationIndex, report: (report: MessagesReport) => void): Language;
|
|
38
|
+
/** Runs `render` with `language` as the current language (synchronous: the language is gone when it returns). */
|
|
39
|
+
export declare function inLanguage<T>(language: Language | undefined, render: () => T): T;
|
|
40
|
+
/** The current language: the render under way's, `undefined` outside one. */
|
|
41
|
+
export declare function currentLanguage(): Language | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* The locale to use: the user's `pick` when a catalog offers it (or its base), else the first of the device's
|
|
44
|
+
* `preferred` some catalog offers, else English (the source of truth) when offered, else the first offered, else `en`.
|
|
45
|
+
*/
|
|
46
|
+
export declare function resolveLocale(pick: string | null, preferred: readonly string[], offered: readonly string[]): string;
|
|
47
|
+
/**
|
|
48
|
+
* The first of `preferred` that `offered` (canonical tags) has: itself, one of its bases (`de-CH` for `de-CH-1996`, then
|
|
49
|
+
* `de`), or another of its language (`de-DE` for `de-AT`); `undefined` when none matches. Invalid tags are skipped
|
|
50
|
+
* (the device's list is the platform's data).
|
|
51
|
+
*/
|
|
52
|
+
export declare function matchLocale(preferred: readonly string[], offered: readonly string[]): string | undefined;
|
|
53
|
+
//# sourceMappingURL=language.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"language.d.ts","sourceRoot":"","sources":["../../src/surfaces/language.ts"],"names":[],"mappings":"AAOA,OAAO,EAAmB,KAAK,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE3E,kHAAkH;AAClH,MAAM,MAAM,QAAQ,GAAG;IACtB,gDAAgD;IAChD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,GAAG,EAAE,KAAK,GAAG,KAAK,CAAC;IAC5B,oFAAoF;IACpF,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,YAAY,EAAE,gBAAgB,CAAC;IACxC,QAAQ,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,IAAI,CAAC;CAClD,CAAC;AAEF,4HAA4H;AAC5H,MAAM,MAAM,cAAc,GACvB;IACA,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,wFAAwF;IACxF,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;CACjC,GACD;IACA,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,oHAAoH;IACpH,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACvB;AACH,yGAAyG;GACvG;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAE7G,kHAAkH;AAClH,wBAAgB,cAAc,CAC7B,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,gBAAgB,EAC9B,MAAM,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,IAAI,GACtC,QAAQ,CAEV;AAKD,iHAAiH;AACjH,wBAAgB,UAAU,CAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,GAAG,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,CAQhF;AAED,6EAA6E;AAC7E,wBAAgB,eAAe,IAAI,QAAQ,GAAG,SAAS,CAEtD;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,EAAE,SAAS,EAAE,SAAS,MAAM,EAAE,EAAE,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAMnH;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,EAAE,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,GAAG,SAAS,CAWxG"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// A language and rendering in it (decision "Messages and languages in the app kit" (1), (3), refined in the build): a
|
|
2
|
+
// `Language` is a locale with its text direction, the host's composed catalogs and where fallbacks are reported. A
|
|
3
|
+
// render is synchronous, and while one runs its language is the current one: a message function's own `formatTime` or a
|
|
4
|
+
// plain `t(...)` it calls renders in it. Outside a render there is no current language (a server, a test, a log line):
|
|
5
|
+
// `t` renders the first catalog. No module-wide setting (the current language exists only while a render runs): one
|
|
6
|
+
// process runs many hosts, and a server renders per recipient.
|
|
7
|
+
import { canonicalLocale } from "./translations.js";
|
|
8
|
+
/** The language `locale` (canonical) with the host's `translations`; `report` gets every report as it happens. */
|
|
9
|
+
export function createLanguage(locale, translations, report) {
|
|
10
|
+
return { locale, dir: directionOf(locale), chain: chainOf(locale), translations, report };
|
|
11
|
+
}
|
|
12
|
+
/** The language of the render under way; `undefined` outside one. */
|
|
13
|
+
let rendering;
|
|
14
|
+
/** Runs `render` with `language` as the current language (synchronous: the language is gone when it returns). */
|
|
15
|
+
export function inLanguage(language, render) {
|
|
16
|
+
const outer = rendering;
|
|
17
|
+
rendering = language;
|
|
18
|
+
try {
|
|
19
|
+
return render();
|
|
20
|
+
}
|
|
21
|
+
finally {
|
|
22
|
+
rendering = outer;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/** The current language: the render under way's, `undefined` outside one. */
|
|
26
|
+
export function currentLanguage() {
|
|
27
|
+
return rendering;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The locale to use: the user's `pick` when a catalog offers it (or its base), else the first of the device's
|
|
31
|
+
* `preferred` some catalog offers, else English (the source of truth) when offered, else the first offered, else `en`.
|
|
32
|
+
*/
|
|
33
|
+
export function resolveLocale(pick, preferred, offered) {
|
|
34
|
+
return (matchLocale(pick === null ? [] : [pick], offered) ??
|
|
35
|
+
matchLocale(preferred, offered) ??
|
|
36
|
+
(offered.includes("en") ? "en" : (offered[0] ?? "en")));
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The first of `preferred` that `offered` (canonical tags) has: itself, one of its bases (`de-CH` for `de-CH-1996`, then
|
|
40
|
+
* `de`), or another of its language (`de-DE` for `de-AT`); `undefined` when none matches. Invalid tags are skipped
|
|
41
|
+
* (the device's list is the platform's data).
|
|
42
|
+
*/
|
|
43
|
+
export function matchLocale(preferred, offered) {
|
|
44
|
+
for (const wanted of preferred) {
|
|
45
|
+
const locale = canonicalLocale(wanted);
|
|
46
|
+
if (locale === undefined)
|
|
47
|
+
continue;
|
|
48
|
+
const exact = chainOf(locale).find((each) => offered.includes(each));
|
|
49
|
+
if (exact !== undefined)
|
|
50
|
+
return exact;
|
|
51
|
+
const language = baseLanguage(locale);
|
|
52
|
+
const related = offered.find((each) => baseLanguage(each) === language);
|
|
53
|
+
if (related !== undefined)
|
|
54
|
+
return related;
|
|
55
|
+
}
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
/** `locale` and its bases, longest first: `zh-Hant-TW`, `zh-Hant`, `zh`. */
|
|
59
|
+
function chainOf(locale) {
|
|
60
|
+
const parts = locale.split("-");
|
|
61
|
+
return parts.map((_, index) => parts.slice(0, parts.length - index).join("-"));
|
|
62
|
+
}
|
|
63
|
+
/** The language subtag of a canonical tag (`pt` of `pt-BR`). */
|
|
64
|
+
function baseLanguage(locale) {
|
|
65
|
+
return locale.split("-")[0];
|
|
66
|
+
}
|
|
67
|
+
/** The scripts written right to left (ISO 15924), as `Intl.Locale` maximizes a tag's script. */
|
|
68
|
+
const RTL_SCRIPTS = new Set(["Adlm", "Arab", "Hebr", "Mand", "Nkoo", "Rohg", "Samr", "Syrc", "Thaa", "Yezi"]);
|
|
69
|
+
/** The text direction of `locale`: right to left when its likely script is (Arabic for `ar`, `ur`, `fa`). */
|
|
70
|
+
function directionOf(locale) {
|
|
71
|
+
const script = new Intl.Locale(locale).maximize().script;
|
|
72
|
+
return script !== undefined && RTL_SCRIPTS.has(script) ? "rtl" : "ltr";
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=language.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"language.js","sourceRoot":"","sources":["../../src/surfaces/language.ts"],"names":[],"mappings":"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","sourcesContent":["// A language and rendering in it (decision \"Messages and languages in the app kit\" (1), (3), refined in the build): a\n// `Language` is a locale with its text direction, the host's composed catalogs and where fallbacks are reported. A\n// render is synchronous, and while one runs its language is the current one: a message function's own `formatTime` or a\n// plain `t(...)` it calls renders in it. Outside a render there is no current language (a server, a test, a log line):\n// `t` renders the first catalog. No module-wide setting (the current language exists only while a render runs): one\n// process runs many hosts, and a server renders per recipient.\n\nimport { canonicalLocale, type TranslationIndex } from \"./translations.ts\";\n\n/** A locale to render in: its direction, its fallback chain, the host's catalogs and the reports' destination. */\nexport type Language = {\n\t/** A canonical language tag (`de`, `pt-BR`). */\n\treadonly locale: string;\n\treadonly dir: \"ltr\" | \"rtl\";\n\t/** The locales tried in order before a namespace's first catalog: `pt-BR`, `pt`. */\n\treadonly chain: readonly string[];\n\treadonly translations: TranslationIndex;\n\treadonly report: (report: MessagesReport) => void;\n};\n\n/** What rendering reports: a key found only further down the chain, a contributed message that threw, a foreign message. */\nexport type MessagesReport =\n\t| {\n\t\t\treadonly kind: \"fallback\";\n\t\t\treadonly namespace: string;\n\t\t\treadonly locale: string;\n\t\t\treadonly key: string;\n\t\t\t/** The locale whose catalog had the key; `undefined`: the namespace's first catalog. */\n\t\t\treadonly used: string | undefined;\n\t }\n\t| {\n\t\t\treadonly kind: \"failed\";\n\t\t\treadonly namespace: string;\n\t\t\treadonly locale: string;\n\t\t\treadonly key: string;\n\t\t\t/** The contributing plugin; `undefined`: the namespace's own catalogs (a message from a link that does not fit). */\n\t\t\treadonly plugin: string | undefined;\n\t\t\treadonly error: unknown;\n\t }\n\t/** `t.render` got a message of another namespace or a key the catalogs do not have: it shows the key. */\n\t| { readonly kind: \"unknown\"; readonly namespace: string; readonly key: string; readonly expected: string };\n\n/** The language `locale` (canonical) with the host's `translations`; `report` gets every report as it happens. */\nexport function createLanguage(\n\tlocale: string,\n\ttranslations: TranslationIndex,\n\treport: (report: MessagesReport) => void,\n): Language {\n\treturn { locale, dir: directionOf(locale), chain: chainOf(locale), translations, report };\n}\n\n/** The language of the render under way; `undefined` outside one. */\nlet rendering: Language | undefined;\n\n/** Runs `render` with `language` as the current language (synchronous: the language is gone when it returns). */\nexport function inLanguage<T>(language: Language | undefined, render: () => T): T {\n\tconst outer = rendering;\n\trendering = language;\n\ttry {\n\t\treturn render();\n\t} finally {\n\t\trendering = outer;\n\t}\n}\n\n/** The current language: the render under way's, `undefined` outside one. */\nexport function currentLanguage(): Language | undefined {\n\treturn rendering;\n}\n\n/**\n * The locale to use: the user's `pick` when a catalog offers it (or its base), else the first of the device's\n * `preferred` some catalog offers, else English (the source of truth) when offered, else the first offered, else `en`.\n */\nexport function resolveLocale(pick: string | null, preferred: readonly string[], offered: readonly string[]): string {\n\treturn (\n\t\tmatchLocale(pick === null ? [] : [pick], offered) ??\n\t\tmatchLocale(preferred, offered) ??\n\t\t(offered.includes(\"en\") ? \"en\" : (offered[0] ?? \"en\"))\n\t);\n}\n\n/**\n * The first of `preferred` that `offered` (canonical tags) has: itself, one of its bases (`de-CH` for `de-CH-1996`, then\n * `de`), or another of its language (`de-DE` for `de-AT`); `undefined` when none matches. Invalid tags are skipped\n * (the device's list is the platform's data).\n */\nexport function matchLocale(preferred: readonly string[], offered: readonly string[]): string | undefined {\n\tfor (const wanted of preferred) {\n\t\tconst locale = canonicalLocale(wanted);\n\t\tif (locale === undefined) continue;\n\t\tconst exact = chainOf(locale).find((each) => offered.includes(each));\n\t\tif (exact !== undefined) return exact;\n\t\tconst language = baseLanguage(locale);\n\t\tconst related = offered.find((each) => baseLanguage(each) === language);\n\t\tif (related !== undefined) return related;\n\t}\n\treturn undefined;\n}\n\n/** `locale` and its bases, longest first: `zh-Hant-TW`, `zh-Hant`, `zh`. */\nfunction chainOf(locale: string): readonly string[] {\n\tconst parts = locale.split(\"-\");\n\treturn parts.map((_, index) => parts.slice(0, parts.length - index).join(\"-\"));\n}\n\n/** The language subtag of a canonical tag (`pt` of `pt-BR`). */\nfunction baseLanguage(locale: string): string {\n\treturn locale.split(\"-\")[0]!;\n}\n\n/** The scripts written right to left (ISO 15924), as `Intl.Locale` maximizes a tag's script. */\nconst RTL_SCRIPTS = new Set([\"Adlm\", \"Arab\", \"Hebr\", \"Mand\", \"Nkoo\", \"Rohg\", \"Samr\", \"Syrc\", \"Thaa\", \"Yezi\"]);\n\n/** The text direction of `locale`: right to left when its likely script is (Arabic for `ar`, `ur`, `fa`). */\nfunction directionOf(locale: string): Language[\"dir\"] {\n\tconst script = new Intl.Locale(locale).maximize().script;\n\treturn script !== undefined && RTL_SCRIPTS.has(script) ? \"rtl\" : \"ltr\";\n}\n"]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { Context } from "../context/index.ts";
|
|
2
|
+
import { type Principal } from "../data/index.ts";
|
|
3
|
+
import type { Facet, Host, LoadReport, PluginFacet, ReloadReport } from "../host/index.ts";
|
|
4
|
+
/** A plugin's facet for a host, or why there is none: its script failed. */
|
|
5
|
+
export type Prepared = {
|
|
6
|
+
readonly kind: "facet";
|
|
7
|
+
readonly facet: Facet<Principal>;
|
|
8
|
+
readonly digest: string;
|
|
9
|
+
} | {
|
|
10
|
+
readonly kind: "failed";
|
|
11
|
+
readonly error: unknown;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* One plugin of a complete set: its name, its script's digest (`undefined` when its build failed: nothing to compare)
|
|
15
|
+
* and how to get its facet (evaluated only when the digest is new).
|
|
16
|
+
*/
|
|
17
|
+
export type SetEntry = {
|
|
18
|
+
readonly name: string;
|
|
19
|
+
readonly digest: string | undefined;
|
|
20
|
+
prepare(): Prepared;
|
|
21
|
+
};
|
|
22
|
+
/** A host's loaded plugins: its core facets, each plugin's loaded facet, and its reloads, one after another. */
|
|
23
|
+
export declare class LoadedFacets {
|
|
24
|
+
#private;
|
|
25
|
+
private constructor();
|
|
26
|
+
/**
|
|
27
|
+
* Prepares `entries` and loads them on `host` with `core` (the app's own facets): a plugin whose script failed is left
|
|
28
|
+
* out and reported in the report's `failed`, with the host's own. The host's loaded plugins, and the report.
|
|
29
|
+
*/
|
|
30
|
+
static load<P extends Principal>(host: Host<P>, core: readonly PluginFacet<P>[], entries: readonly SetEntry[], context: Context): Promise<{
|
|
31
|
+
readonly loaded: LoadedFacets;
|
|
32
|
+
readonly report: LoadReport;
|
|
33
|
+
}>;
|
|
34
|
+
/**
|
|
35
|
+
* Reloads `host` with `entries`, the complete set now, after its earlier reloads: core facets and unchanged plugins as
|
|
36
|
+
* the same objects, new scripts prepared, a plugin whose script failed passed as its loaded facet (an added one left
|
|
37
|
+
* out; both named to the host's closure rule), plugins not in `entries` left out. What the host committed becomes
|
|
38
|
+
* the loaded set, also when the reload rejects `aborted` after its commit.
|
|
39
|
+
*/
|
|
40
|
+
reload<P extends Principal>(host: Host<P>, entries: readonly SetEntry[], context: Context): Promise<ReloadReport>;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=loaded.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loaded.d.ts","sourceRoot":"","sources":["../../src/surfaces/loaded.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAgB,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,KAAK,EAEX,KAAK,EACL,IAAI,EACJ,UAAU,EACV,WAAW,EAEX,YAAY,EACZ,MAAM,kBAAkB,CAAC;AAE1B,4EAA4E;AAC5E,MAAM,MAAM,QAAQ,GACjB;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACrF;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAAC;AAExD;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,OAAO,IAAI,QAAQ,CAAA;CAAE,CAAC;AAK3G,gHAAgH;AAChH,qBAAa,YAAY;;IAKxB,OAAO,eAGN;IAED;;;OAGG;IACH,OAAa,IAAI,CAAC,CAAC,SAAS,SAAS,EACpC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,EACb,IAAI,EAAE,SAAS,WAAW,CAAC,CAAC,CAAC,EAAE,EAC/B,OAAO,EAAE,SAAS,QAAQ,EAAE,EAC5B,OAAO,EAAE,OAAO,GACd,OAAO,CAAC;QAAE,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;QAAC,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAA;KAAE,CAAC,CAkBzE;IAED;;;;;OAKG;IACH,MAAM,CAAC,CAAC,SAAS,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,SAAS,QAAQ,EAAE,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,YAAY,CAAC,CAUhH;CAuDD"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
// A host's loaded plugins (slice 10 D11, slice 11 §2): the facet loaded for each plugin, and loads and reloads with
|
|
2
|
+
// complete sets, the same on a server or worker (the plugins runtime, scripts evaluated with `vm`) and in a page or a
|
|
3
|
+
// terminal (scripts that registered themselves). Unchanged plugins (the same digest) pass as the same facet objects,
|
|
4
|
+
// removed ones are left out; a plugin whose script failed (its build, its evaluation) keeps its loaded facet (left out
|
|
5
|
+
// at the first load) and is named to the host, so its closure rule and its report see it.
|
|
6
|
+
import { isChordError } from "../data/index.js";
|
|
7
|
+
/** A host's loaded plugins: its core facets, each plugin's loaded facet, and its reloads, one after another. */
|
|
8
|
+
export class LoadedFacets {
|
|
9
|
+
#core;
|
|
10
|
+
#loaded;
|
|
11
|
+
#reloading = Promise.resolve();
|
|
12
|
+
constructor(core, loaded) {
|
|
13
|
+
this.#core = core;
|
|
14
|
+
this.#loaded = loaded;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Prepares `entries` and loads them on `host` with `core` (the app's own facets): a plugin whose script failed is left
|
|
18
|
+
* out and reported in the report's `failed`, with the host's own. The host's loaded plugins, and the report.
|
|
19
|
+
*/
|
|
20
|
+
static async load(host, core, entries, context) {
|
|
21
|
+
const prepared = entries.map((entry) => [entry.name, entry.prepare()]);
|
|
22
|
+
const failed = [];
|
|
23
|
+
const facets = [...core];
|
|
24
|
+
for (const [plugin, each] of prepared) {
|
|
25
|
+
if (each.kind === "failed")
|
|
26
|
+
failed.push({ plugin, error: each.error });
|
|
27
|
+
// Evaluated for this host's principal type: the facets are the app's (`Facet<P>` is invariant in `P`).
|
|
28
|
+
else
|
|
29
|
+
facets.push({ name: plugin, facet: each.facet });
|
|
30
|
+
}
|
|
31
|
+
const report = await host.load(facets, context);
|
|
32
|
+
const left = new Set(report.failed.map(({ plugin }) => plugin));
|
|
33
|
+
const loaded = new Map();
|
|
34
|
+
for (const [plugin, each] of prepared) {
|
|
35
|
+
if (each.kind === "facet" && !left.has(plugin))
|
|
36
|
+
loaded.set(plugin, each);
|
|
37
|
+
}
|
|
38
|
+
// The host's own facets, for its later reloads.
|
|
39
|
+
const kept = new LoadedFacets(core, loaded);
|
|
40
|
+
return { loaded: kept, report: { failed: [...failed, ...report.failed] } };
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Reloads `host` with `entries`, the complete set now, after its earlier reloads: core facets and unchanged plugins as
|
|
44
|
+
* the same objects, new scripts prepared, a plugin whose script failed passed as its loaded facet (an added one left
|
|
45
|
+
* out; both named to the host's closure rule), plugins not in `entries` left out. What the host committed becomes
|
|
46
|
+
* the loaded set, also when the reload rejects `aborted` after its commit.
|
|
47
|
+
*/
|
|
48
|
+
reload(host, entries, context) {
|
|
49
|
+
// One after another: a reload computing its set from a loaded map an earlier one is about to change would pass
|
|
50
|
+
// that plugin's old facet and roll it back.
|
|
51
|
+
const reload = this.#reloading.then(() => this.#reload(host, entries, context));
|
|
52
|
+
// The tail settles to nothing: a report kept as its value would keep a rejected facet's closure (its error).
|
|
53
|
+
this.#reloading = reload.then(() => { }, () => { });
|
|
54
|
+
return reload;
|
|
55
|
+
}
|
|
56
|
+
/** One reload of `host` with the complete set `entries`. */
|
|
57
|
+
async #reload(host, entries, context) {
|
|
58
|
+
const failed = [];
|
|
59
|
+
const next = new Map();
|
|
60
|
+
for (const entry of entries) {
|
|
61
|
+
const loaded = this.#loaded.get(entry.name);
|
|
62
|
+
if (entry.digest !== undefined && entry.digest === loaded?.digest) {
|
|
63
|
+
next.set(entry.name, loaded);
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
const prepared = entry.prepare();
|
|
67
|
+
if (prepared.kind === "facet") {
|
|
68
|
+
next.set(entry.name, prepared);
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
failed.push({ plugin: entry.name, error: prepared.error });
|
|
72
|
+
if (loaded !== undefined)
|
|
73
|
+
next.set(entry.name, loaded);
|
|
74
|
+
}
|
|
75
|
+
const facets = [...this.#core, ...[...next].map(([name, { facet }]) => ({ name, facet }))];
|
|
76
|
+
let report;
|
|
77
|
+
try {
|
|
78
|
+
// The host takes facets of its own principal type: they were loaded for it.
|
|
79
|
+
report = await host.reload(facets, context, { failed });
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
// Aborted after its commit: the commit stands, and is what the host runs now.
|
|
83
|
+
const committed = committedOf(error);
|
|
84
|
+
if (committed !== undefined)
|
|
85
|
+
this.#adopt(next, committed.failed);
|
|
86
|
+
throw error;
|
|
87
|
+
}
|
|
88
|
+
this.#adopt(next, report.failed.map(({ plugin }) => plugin));
|
|
89
|
+
return report;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Adopts the set `next` a reload committed: a plugin the host kept old (`failed`) stays loaded as it was, an added one
|
|
93
|
+
* it left out is not loaded.
|
|
94
|
+
*/
|
|
95
|
+
#adopt(next, failed) {
|
|
96
|
+
for (const plugin of failed) {
|
|
97
|
+
const loaded = this.#loaded.get(plugin);
|
|
98
|
+
if (loaded === undefined)
|
|
99
|
+
next.delete(plugin);
|
|
100
|
+
else
|
|
101
|
+
next.set(plugin, loaded);
|
|
102
|
+
}
|
|
103
|
+
this.#loaded.clear();
|
|
104
|
+
for (const [name, each] of next)
|
|
105
|
+
this.#loaded.set(name, each);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
/** What the commit of a reload that rejected applied: an `aborted` error after its commit says (`details.committed`). */
|
|
109
|
+
function committedOf(error) {
|
|
110
|
+
if (!isChordError(error, "aborted"))
|
|
111
|
+
return undefined;
|
|
112
|
+
const details = error.details;
|
|
113
|
+
// The kernel's own error: its `committed` is a `CommittedReload`.
|
|
114
|
+
return typeof details === "object" && details !== null ? details.committed : undefined;
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=loaded.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loaded.js","sourceRoot":"","sources":["../../src/surfaces/loaded.ts"],"names":[],"mappings":"AAAA,oHAAoH;AACpH,sHAAsH;AACtH,qHAAqH;AACrH,uHAAuH;AACvH,0FAA0F;AAG1F,OAAO,EAAE,YAAY,EAAkB,MAAM,kBAAkB,CAAC;AAyBhE,gHAAgH;AAChH,MAAM,OAAO,YAAY;IACf,KAAK,CAAoC;IACzC,OAAO,CAA2B;IAC3C,UAAU,GAAkB,OAAO,CAAC,OAAO,EAAE,CAAC;IAE9C,YAAoB,IAAuC,EAAE,MAAgC;QAC5F,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,KAAK,CAAC,IAAI,CAChB,IAAa,EACb,IAA+B,EAC/B,OAA4B,EAC5B,OAAgB;QAEhB,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,OAAO,EAAE,CAAU,CAAC,CAAC;QAChF,MAAM,MAAM,GAAoB,EAAE,CAAC;QACnC,MAAM,MAAM,GAAqB,CAAC,GAAG,IAAI,CAAC,CAAC;QAC3C,KAAK,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,QAAQ,EAAE,CAAC;YACvC,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ;gBAAE,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;YACvE,uGAAuG;;gBAClG,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,KAA4B,EAAE,CAAC,CAAC;QAC9E,CAAC;QACD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAChD,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;QAChE,MAAM,MAAM,GAAG,IAAI,GAAG,EAAuB,CAAC;QAC9C,KAAK,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,QAAQ,EAAE,CAAC;YACvC,IAAI,IAAI,CAAC,IAAI,KAAK,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC;gBAAE,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAC1E,CAAC;QACD,gDAAgD;QAChD,MAAM,IAAI,GAAG,IAAI,YAAY,CAAC,IAAoD,EAAE,MAAM,CAAC,CAAC;QAC5F,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,GAAG,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;IAC5E,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAsB,IAAa,EAAE,OAA4B,EAAE,OAAgB;QACxF,+GAA+G;QAC/G,4CAA4C;QAC5C,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;QAChF,6GAA6G;QAC7G,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,IAAI,CAC5B,GAAG,EAAE,GAAE,CAAC,EACR,GAAG,EAAE,GAAE,CAAC,CACR,CAAC;QACF,OAAO,MAAM,CAAC;IACf,CAAC;IAED,4DAA4D;IAC5D,KAAK,CAAC,OAAO,CACZ,IAAa,EACb,OAA4B,EAC5B,OAAgB;QAEhB,MAAM,MAAM,GAAoB,EAAE,CAAC;QACnC,MAAM,IAAI,GAAG,IAAI,GAAG,EAAuB,CAAC;QAC5C,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;YAC7B,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAC5C,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS,IAAI,KAAK,CAAC,MAAM,KAAK,MAAM,EAAE,MAAM,EAAE,CAAC;gBACnE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;gBAC7B,SAAS;YACV,CAAC;YACD,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,EAAE,CAAC;YACjC,IAAI,QAAQ,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;gBAC/B,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;gBAC/B,SAAS;YACV,CAAC;YACD,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;YAC3D,IAAI,MAAM,KAAK,SAAS;gBAAE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACxD,CAAC;QACD,MAAM,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;QAC3F,IAAI,MAAoB,CAAC;QACzB,IAAI,CAAC;YACJ,4EAA4E;YAC5E,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,MAA8C,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;QACjG,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,8EAA8E;YAC9E,MAAM,SAAS,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC;YACrC,IAAI,SAAS,KAAK,SAAS;gBAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;YACjE,MAAM,KAAK,CAAC;QACb,CAAC;QACD,IAAI,CAAC,MAAM,CACV,IAAI,EACJ,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,CACzC,CAAC;QACF,OAAO,MAAM,CAAC;IACf,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,IAA8B,EAAE,MAAyB;QAC/D,KAAK,MAAM,MAAM,IAAI,MAAM,EAAE,CAAC;YAC7B,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YACxC,IAAI,MAAM,KAAK,SAAS;gBAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;;gBACzC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC/B,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QACrB,KAAK,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI;YAAE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC/D,CAAC;CACD;AAED,yHAAyH;AACzH,SAAS,WAAW,CAAC,KAAc;IAClC,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,SAAS,CAAC;QAAE,OAAO,SAAS,CAAC;IACtD,MAAM,OAAO,GAAG,KAAK,CAAC,OAAsE,CAAC;IAC7F,kEAAkE;IAClE,OAAO,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;AACxF,CAAC","sourcesContent":["// A host's loaded plugins (slice 10 D11, slice 11 §2): the facet loaded for each plugin, and loads and reloads with\n// complete sets, the same on a server or worker (the plugins runtime, scripts evaluated with `vm`) and in a page or a\n// terminal (scripts that registered themselves). Unchanged plugins (the same digest) pass as the same facet objects,\n// removed ones are left out; a plugin whose script failed (its build, its evaluation) keeps its loaded facet (left out\n// at the first load) and is named to the host, so its closure rule and its report see it.\n\nimport type { Context } from \"../context/index.ts\";\nimport { isChordError, type Principal } from \"../data/index.ts\";\nimport type {\n\tCommittedReload,\n\tFacet,\n\tHost,\n\tLoadReport,\n\tPluginFacet,\n\tPluginFailure,\n\tReloadReport,\n} from \"../host/index.ts\";\n\n/** A plugin's facet for a host, or why there is none: its script failed. */\nexport type Prepared =\n\t| { readonly kind: \"facet\"; readonly facet: Facet<Principal>; readonly digest: string }\n\t| { readonly kind: \"failed\"; readonly error: unknown };\n\n/**\n * One plugin of a complete set: its name, its script's digest (`undefined` when its build failed: nothing to compare)\n * and how to get its facet (evaluated only when the digest is new).\n */\nexport type SetEntry = { readonly name: string; readonly digest: string | undefined; prepare(): Prepared };\n\n/** A plugin's facet as the host loaded it, with its script's digest. */\ntype LoadedFacet = { readonly facet: Facet<Principal>; readonly digest: string };\n\n/** A host's loaded plugins: its core facets, each plugin's loaded facet, and its reloads, one after another. */\nexport class LoadedFacets {\n\treadonly #core: readonly PluginFacet<Principal>[];\n\treadonly #loaded: Map<string, LoadedFacet>;\n\t#reloading: Promise<void> = Promise.resolve();\n\n\tprivate constructor(core: readonly PluginFacet<Principal>[], loaded: Map<string, LoadedFacet>) {\n\t\tthis.#core = core;\n\t\tthis.#loaded = loaded;\n\t}\n\n\t/**\n\t * Prepares `entries` and loads them on `host` with `core` (the app's own facets): a plugin whose script failed is left\n\t * out and reported in the report's `failed`, with the host's own. The host's loaded plugins, and the report.\n\t */\n\tstatic async load<P extends Principal>(\n\t\thost: Host<P>,\n\t\tcore: readonly PluginFacet<P>[],\n\t\tentries: readonly SetEntry[],\n\t\tcontext: Context,\n\t): Promise<{ readonly loaded: LoadedFacets; readonly report: LoadReport }> {\n\t\tconst prepared = entries.map((entry) => [entry.name, entry.prepare()] as const);\n\t\tconst failed: PluginFailure[] = [];\n\t\tconst facets: PluginFacet<P>[] = [...core];\n\t\tfor (const [plugin, each] of prepared) {\n\t\t\tif (each.kind === \"failed\") failed.push({ plugin, error: each.error });\n\t\t\t// Evaluated for this host's principal type: the facets are the app's (`Facet<P>` is invariant in `P`).\n\t\t\telse facets.push({ name: plugin, facet: each.facet as unknown as Facet<P> });\n\t\t}\n\t\tconst report = await host.load(facets, context);\n\t\tconst left = new Set(report.failed.map(({ plugin }) => plugin));\n\t\tconst loaded = new Map<string, LoadedFacet>();\n\t\tfor (const [plugin, each] of prepared) {\n\t\t\tif (each.kind === \"facet\" && !left.has(plugin)) loaded.set(plugin, each);\n\t\t}\n\t\t// The host's own facets, for its later reloads.\n\t\tconst kept = new LoadedFacets(core as unknown as readonly PluginFacet<Principal>[], loaded);\n\t\treturn { loaded: kept, report: { failed: [...failed, ...report.failed] } };\n\t}\n\n\t/**\n\t * Reloads `host` with `entries`, the complete set now, after its earlier reloads: core facets and unchanged plugins as\n\t * the same objects, new scripts prepared, a plugin whose script failed passed as its loaded facet (an added one left\n\t * out; both named to the host's closure rule), plugins not in `entries` left out. What the host committed becomes\n\t * the loaded set, also when the reload rejects `aborted` after its commit.\n\t */\n\treload<P extends Principal>(host: Host<P>, entries: readonly SetEntry[], context: Context): Promise<ReloadReport> {\n\t\t// One after another: a reload computing its set from a loaded map an earlier one is about to change would pass\n\t\t// that plugin's old facet and roll it back.\n\t\tconst reload = this.#reloading.then(() => this.#reload(host, entries, context));\n\t\t// The tail settles to nothing: a report kept as its value would keep a rejected facet's closure (its error).\n\t\tthis.#reloading = reload.then(\n\t\t\t() => {},\n\t\t\t() => {},\n\t\t);\n\t\treturn reload;\n\t}\n\n\t/** One reload of `host` with the complete set `entries`. */\n\tasync #reload<P extends Principal>(\n\t\thost: Host<P>,\n\t\tentries: readonly SetEntry[],\n\t\tcontext: Context,\n\t): Promise<ReloadReport> {\n\t\tconst failed: PluginFailure[] = [];\n\t\tconst next = new Map<string, LoadedFacet>();\n\t\tfor (const entry of entries) {\n\t\t\tconst loaded = this.#loaded.get(entry.name);\n\t\t\tif (entry.digest !== undefined && entry.digest === loaded?.digest) {\n\t\t\t\tnext.set(entry.name, loaded);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst prepared = entry.prepare();\n\t\t\tif (prepared.kind === \"facet\") {\n\t\t\t\tnext.set(entry.name, prepared);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tfailed.push({ plugin: entry.name, error: prepared.error });\n\t\t\tif (loaded !== undefined) next.set(entry.name, loaded);\n\t\t}\n\t\tconst facets = [...this.#core, ...[...next].map(([name, { facet }]) => ({ name, facet }))];\n\t\tlet report: ReloadReport;\n\t\ttry {\n\t\t\t// The host takes facets of its own principal type: they were loaded for it.\n\t\t\treport = await host.reload(facets as unknown as readonly PluginFacet<P>[], context, { failed });\n\t\t} catch (error) {\n\t\t\t// Aborted after its commit: the commit stands, and is what the host runs now.\n\t\t\tconst committed = committedOf(error);\n\t\t\tif (committed !== undefined) this.#adopt(next, committed.failed);\n\t\t\tthrow error;\n\t\t}\n\t\tthis.#adopt(\n\t\t\tnext,\n\t\t\treport.failed.map(({ plugin }) => plugin),\n\t\t);\n\t\treturn report;\n\t}\n\n\t/**\n\t * Adopts the set `next` a reload committed: a plugin the host kept old (`failed`) stays loaded as it was, an added one\n\t * it left out is not loaded.\n\t */\n\t#adopt(next: Map<string, LoadedFacet>, failed: readonly string[]): void {\n\t\tfor (const plugin of failed) {\n\t\t\tconst loaded = this.#loaded.get(plugin);\n\t\t\tif (loaded === undefined) next.delete(plugin);\n\t\t\telse next.set(plugin, loaded);\n\t\t}\n\t\tthis.#loaded.clear();\n\t\tfor (const [name, each] of next) this.#loaded.set(name, each);\n\t}\n}\n\n/** What the commit of a reload that rejected applied: an `aborted` error after its commit says (`details.committed`). */\nfunction committedOf(error: unknown): CommittedReload | undefined {\n\tif (!isChordError(error, \"aborted\")) return undefined;\n\tconst details = error.details as { readonly committed?: CommittedReload } | null | undefined;\n\t// The kernel's own error: its `committed` is a `CommittedReload`.\n\treturn typeof details === \"object\" && details !== null ? details.committed : undefined;\n}\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Principal } from "../data/index.ts";
|
|
2
|
+
import type { Facet } from "../host/index.ts";
|
|
3
|
+
/** The caller's locale choice, on the server: its pick, and `choose` to change it. */
|
|
4
|
+
export declare const LocaleChoice: import("../contracts/contract.ts").Contract<{
|
|
5
|
+
kind: "remote";
|
|
6
|
+
name: "chord.locale.choice";
|
|
7
|
+
params: {};
|
|
8
|
+
history: [{
|
|
9
|
+
version: "1";
|
|
10
|
+
variants: {
|
|
11
|
+
readonly main: {
|
|
12
|
+
state: {
|
|
13
|
+
readonly pick: import("../contracts/index.ts").Schema<string | null>;
|
|
14
|
+
};
|
|
15
|
+
methods: {
|
|
16
|
+
readonly choose: import("../contracts/schema.ts").Method<import("../contracts/index.ts").Schema<string | null>, import("../contracts/schema.ts").NullSchema>;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
changes: never;
|
|
21
|
+
}];
|
|
22
|
+
}>;
|
|
23
|
+
/** The kit's server facet for locale choices: the store of picks and each principal's `LocaleChoice`. */
|
|
24
|
+
export declare function localeChoiceFacet<P extends Principal>(): Facet<P>;
|
|
25
|
+
//# sourceMappingURL=locale-choice.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locale-choice.d.ts","sourceRoot":"","sources":["../../src/surfaces/locale-choice.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAM9C,sFAAsF;AACtF,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;EAAkD,CAAC;AAE5E,yGAAyG;AACzG,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,SAAS,KAAK,KAAK,CAAC,CAAC,CAAC,CAEjE"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// The user's locale choice (decision "Messages and languages in the app kit" (3)): one locale per principal, a
|
|
2
|
+
// preference the server keeps (the kit serves it) and every page and terminal of that principal holds, so choosing a
|
|
3
|
+
// language re-renders them all at once, without a reload. `null` until the user chooses: the device's languages decide.
|
|
4
|
+
import { nul, str, union } from "../contracts/index.js";
|
|
5
|
+
import { preferenceContract, preferenceFacet } from "./preference.js";
|
|
6
|
+
/** A language tag (`de`, `pt-BR`; at most 35 characters, BCP 47's practical bound), or `null`: the device's. */
|
|
7
|
+
const Pick = union([str({ max: 35, pattern: "^[A-Za-z]{2,8}(-[A-Za-z0-9]{1,8})*$" }), nul()]);
|
|
8
|
+
/** The caller's locale choice, on the server: its pick, and `choose` to change it. */
|
|
9
|
+
export const LocaleChoice = preferenceContract("chord.locale.choice", Pick);
|
|
10
|
+
/** The kit's server facet for locale choices: the store of picks and each principal's `LocaleChoice`. */
|
|
11
|
+
export function localeChoiceFacet() {
|
|
12
|
+
return preferenceFacet(LocaleChoice, "chord.locale.picks", Pick, null);
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=locale-choice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locale-choice.js","sourceRoot":"","sources":["../../src/surfaces/locale-choice.ts"],"names":[],"mappings":"AAAA,+GAA+G;AAC/G,qHAAqH;AACrH,wHAAwH;AAExH,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAGxD,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEtE,gHAAgH;AAChH,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,OAAO,EAAE,qCAAqC,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;AAE9F,sFAAsF;AACtF,MAAM,CAAC,MAAM,YAAY,GAAG,kBAAkB,CAAC,qBAAqB,EAAE,IAAI,CAAC,CAAC;AAE5E,yGAAyG;AACzG,MAAM,UAAU,iBAAiB;IAChC,OAAO,eAAe,CAAI,YAAY,EAAE,oBAAoB,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAC3E,CAAC","sourcesContent":["// The user's locale choice (decision \"Messages and languages in the app kit\" (3)): one locale per principal, a\n// preference the server keeps (the kit serves it) and every page and terminal of that principal holds, so choosing a\n// language re-renders them all at once, without a reload. `null` until the user chooses: the device's languages decide.\n\nimport { nul, str, union } from \"../contracts/index.ts\";\nimport type { Principal } from \"../data/index.ts\";\nimport type { Facet } from \"../host/index.ts\";\nimport { preferenceContract, preferenceFacet } from \"./preference.ts\";\n\n/** A language tag (`de`, `pt-BR`; at most 35 characters, BCP 47's practical bound), or `null`: the device's. */\nconst Pick = union([str({ max: 35, pattern: \"^[A-Za-z]{2,8}(-[A-Za-z0-9]{1,8})*$\" }), nul()]);\n\n/** The caller's locale choice, on the server: its pick, and `choose` to change it. */\nexport const LocaleChoice = preferenceContract(\"chord.locale.choice\", Pick);\n\n/** The kit's server facet for locale choices: the store of picks and each principal's `LocaleChoice`. */\nexport function localeChoiceFacet<P extends Principal>(): Facet<P> {\n\treturn preferenceFacet<P>(LocaleChoice, \"chord.locale.picks\", Pick, null);\n}\n"]}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { type Language } from "./language.ts";
|
|
2
|
+
import { type Translation } from "./translations.ts";
|
|
3
|
+
/** A message's value: a text, or a function of its arguments returning one. */
|
|
4
|
+
export type MessageValue = string | ((...args: never[]) => string);
|
|
5
|
+
/** A catalog: the messages of one namespace in one language, by key. */
|
|
6
|
+
export type Catalog = {
|
|
7
|
+
readonly [key: string]: MessageValue;
|
|
8
|
+
};
|
|
9
|
+
/** A catalog's shape as other catalogs must match it: its keys, strings as `string`, functions with their signatures. */
|
|
10
|
+
export type CatalogShape<M> = {
|
|
11
|
+
readonly [K in keyof M]: M[K] extends string ? string : M[K];
|
|
12
|
+
};
|
|
13
|
+
/** The arguments of a message: its function's parameters, none for a text. */
|
|
14
|
+
export type MessageArgs<V> = V extends (...args: infer A) => string ? A : [];
|
|
15
|
+
/** A parameter of a message as data: plain JSON (a date as an ISO string or a number), so it crosses links. */
|
|
16
|
+
export type MessageParam = string | number | boolean | null;
|
|
17
|
+
/**
|
|
18
|
+
* A message as data: its namespace, its key and its parameters; typed by `t.message` (`MessageData<"notes", "saved">`),
|
|
19
|
+
* any namespace and key as `MessageSchema` carries it across a link. (`Message` is the link protocol's.)
|
|
20
|
+
*/
|
|
21
|
+
export type MessageData<N extends string = string, K extends string = string> = {
|
|
22
|
+
readonly namespace: N;
|
|
23
|
+
readonly key: K;
|
|
24
|
+
readonly params: MessageParam[];
|
|
25
|
+
};
|
|
26
|
+
/** The schema of a message as data, for contract members (`notice: union([MessageSchema, nul()])`). */
|
|
27
|
+
export declare const MessageSchema: import("../contracts/index.ts").Schema<{
|
|
28
|
+
namespace: string;
|
|
29
|
+
key: string;
|
|
30
|
+
params: (string | number | boolean | null)[];
|
|
31
|
+
}>;
|
|
32
|
+
/** The keys of `M` whose arguments are all `MessageParam`s: those `t.message` can build. */
|
|
33
|
+
export type DataKeys<M> = {
|
|
34
|
+
[K in keyof M & string]: MessageArgs<M[K]> extends readonly MessageParam[] ? K : never;
|
|
35
|
+
}[keyof M & string];
|
|
36
|
+
/** A message of namespace `N`, or one of any namespace (`string`, from a schema): another literal namespace is refused. */
|
|
37
|
+
type OfNamespace<G extends MessageData, N extends string> = string extends G["namespace"] ? unknown : {
|
|
38
|
+
readonly namespace: N;
|
|
39
|
+
};
|
|
40
|
+
/** Renders the messages of namespace `N` with catalog shape `M` in one language. */
|
|
41
|
+
export type Translator<N extends string, M> = {
|
|
42
|
+
/** The message `key` with its arguments. */
|
|
43
|
+
<K extends keyof M & string>(key: K, ...args: MessageArgs<M[K]>): string;
|
|
44
|
+
/** A message as data; a foreign namespace or an unknown key shows the key (and is reported). */
|
|
45
|
+
render<G extends MessageData>(message: G & OfNamespace<G, N>): string;
|
|
46
|
+
};
|
|
47
|
+
/** A plugin's messages: `t` itself (in the current language), its namespace, its catalogs as contributions, `message`. */
|
|
48
|
+
export type Messages<N extends string, M> = Translator<N, M> & {
|
|
49
|
+
readonly namespace: N;
|
|
50
|
+
/** Its catalogs as `Translations` entries: a facet that renders contributes them. */
|
|
51
|
+
readonly translations: readonly Translation[];
|
|
52
|
+
/** The message `key` with its arguments as data, for state that clients render. */
|
|
53
|
+
message<K extends DataKeys<M>>(key: K, ...args: MessageArgs<M[K]>): MessageData<N, K>;
|
|
54
|
+
/** `t` in `language` (`undefined`: the first catalog). */
|
|
55
|
+
in(language: Language | undefined): Translator<N, M>;
|
|
56
|
+
};
|
|
57
|
+
/** The catalog shape of a plugin's messages: what a translation fills (`const fr: MessagesOf<typeof t> = {...}`). */
|
|
58
|
+
export type MessagesOf<T> = T extends Messages<string, infer M> ? M : never;
|
|
59
|
+
/**
|
|
60
|
+
* The messages of `namespace` (a name like a type's, `[a-z0-9@/._~-]`) in `catalogs` by locale; the first catalog
|
|
61
|
+
* defines the keys and signatures, the others match it.
|
|
62
|
+
*/
|
|
63
|
+
export declare function defineMessages<const N extends string, M extends Catalog>(namespace: N, catalogs: {
|
|
64
|
+
readonly [locale: string]: CatalogShape<M>;
|
|
65
|
+
}): Messages<N, CatalogShape<M>>;
|
|
66
|
+
export {};
|
|
67
|
+
//# sourceMappingURL=messages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/surfaces/messages.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
// Messages in code (decision "Messages and languages in the app kit" (1), (4), refined in the build): a plugin defines
|
|
2
|
+
// its texts once, per namespace, in a shared `messages.ts` every facet that renders imports: `defineMessages("notes", {
|
|
3
|
+
// en: {...}, de: {...} })` returns a typed `t`. The first catalog defines the keys and their argument types; every
|
|
4
|
+
// other catalog must have the same keys with the same signatures (a missing key, an unknown one or a wrong argument is
|
|
5
|
+
// a type error); values are strings or functions (plurals, word order). `t` renders in a language: bound to a host's
|
|
6
|
+
// (`useMessages`, `scope.messages`, `t.in`), or plain, in the render under way's, else in the first catalog.
|
|
7
|
+
// `t.message` builds a message as data (`{ namespace, key, params }`) for state, notices and errors, which each client
|
|
8
|
+
// renders with `t.render` in its own language, checked at runtime (it crossed a link).
|
|
9
|
+
import { arr, bool, nul, num, obj, str, union } from "../contracts/index.js";
|
|
10
|
+
import { checkName } from "../contracts/names.js";
|
|
11
|
+
import { currentLanguage, inLanguage } from "./language.js";
|
|
12
|
+
import { canonicalLocale } from "./translations.js";
|
|
13
|
+
/** The schema of a message as data, for contract members (`notice: union([MessageSchema, nul()])`). */
|
|
14
|
+
export const MessageSchema = obj({
|
|
15
|
+
namespace: str(),
|
|
16
|
+
key: str(),
|
|
17
|
+
params: arr(union([str(), num(), bool(), nul()])),
|
|
18
|
+
});
|
|
19
|
+
/**
|
|
20
|
+
* The messages of `namespace` (a name like a type's, `[a-z0-9@/._~-]`) in `catalogs` by locale; the first catalog
|
|
21
|
+
* defines the keys and signatures, the others match it.
|
|
22
|
+
*/
|
|
23
|
+
export function defineMessages(namespace, catalogs) {
|
|
24
|
+
// Declaration policy: a namespace is a name, a catalog's key a language tag (JavaScript callers reach both).
|
|
25
|
+
checkName(namespace, "A messages namespace");
|
|
26
|
+
const own = new Map();
|
|
27
|
+
for (const [locale, catalog] of Object.entries(catalogs)) {
|
|
28
|
+
const canonical = canonicalLocale(locale);
|
|
29
|
+
if (canonical === undefined)
|
|
30
|
+
throw new Error(`${namespace}: "${locale}" is no language tag`);
|
|
31
|
+
own.set(canonical, catalog);
|
|
32
|
+
}
|
|
33
|
+
const first = own.values().next().value;
|
|
34
|
+
if (first === undefined)
|
|
35
|
+
throw new Error(`${namespace}: defineMessages needs a catalog`);
|
|
36
|
+
const source = { namespace, own, first };
|
|
37
|
+
const translations = [...own].map(([locale, messages]) => ({ namespace, locale, messages }));
|
|
38
|
+
// The overloads `Messages` types are these functions', keyed by the catalog's shape.
|
|
39
|
+
return Object.assign(translator(source, currentLanguage), {
|
|
40
|
+
namespace,
|
|
41
|
+
translations,
|
|
42
|
+
message: (key, ...params) => ({ namespace, key, params }),
|
|
43
|
+
in: (language) => translator(source, () => language),
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
/** A translator of `source`'s messages in the language `language` reads at each call. */
|
|
47
|
+
function translator(source, language) {
|
|
48
|
+
const t = (key, ...args) => renderKey(source, language(), key, args);
|
|
49
|
+
const render = (message) => renderData(source, language(), message);
|
|
50
|
+
// The overloads `Translator` types are this one function's, keyed by the catalog's shape.
|
|
51
|
+
return Object.assign(t, { render });
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* `key` of `source` in `language`: down its chain, at each locale the host's contributed catalog, then the plugin's own;
|
|
55
|
+
* else the first catalog.
|
|
56
|
+
*/
|
|
57
|
+
function renderKey(source, language, key, args) {
|
|
58
|
+
if (language === undefined)
|
|
59
|
+
return call(source.first[key], args);
|
|
60
|
+
return inLanguage(language, () => {
|
|
61
|
+
for (const [index, locale] of language.chain.entries()) {
|
|
62
|
+
const contributed = language.translations.catalogs.get(source.namespace)?.get(locale);
|
|
63
|
+
if (contributed !== undefined && Object.hasOwn(contributed.value.messages, key)) {
|
|
64
|
+
try {
|
|
65
|
+
return found(language, source, key, index, call(contributed.value.messages[key], args));
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
// A contributed catalog is a plugin's code: reported, and the chain goes on (design §17).
|
|
69
|
+
const { plugin } = contributed;
|
|
70
|
+
language.report({ kind: "failed", namespace: source.namespace, locale, key, plugin, error });
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
const own = source.own.get(locale);
|
|
74
|
+
if (own !== undefined && own !== contributed?.value.messages && Object.hasOwn(own, key)) {
|
|
75
|
+
return found(language, source, key, index, call(own[key], args));
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return found(language, source, key, language.chain.length, call(source.first[key], args));
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
/** `text`, found at `index` in `language`'s chain (its length: the first catalog), a fallback reported past the first. */
|
|
82
|
+
function found(language, source, key, index, text) {
|
|
83
|
+
if (index > 0) {
|
|
84
|
+
const used = language.chain[index];
|
|
85
|
+
language.report({ kind: "fallback", namespace: source.namespace, locale: language.locale, key, used });
|
|
86
|
+
}
|
|
87
|
+
return text;
|
|
88
|
+
}
|
|
89
|
+
/** A message's text: the text, or the function called with `args` (typed by the catalog's signature). */
|
|
90
|
+
function call(value, args) {
|
|
91
|
+
return typeof value === "string" ? value : value(...args);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* A message as data in `language`. Checked first (wire input: the message crossed a link as state): another namespace,
|
|
95
|
+
* a key the first catalog lacks or params that are no list show the key, reported; so does a message that throws.
|
|
96
|
+
*/
|
|
97
|
+
function renderData(source, language, message) {
|
|
98
|
+
const { namespace, key, params } = message;
|
|
99
|
+
const known = namespace === source.namespace && Object.hasOwn(source.first, key) && Array.isArray(params);
|
|
100
|
+
if (!known) {
|
|
101
|
+
language?.report({ kind: "unknown", namespace, key, expected: source.namespace });
|
|
102
|
+
return key;
|
|
103
|
+
}
|
|
104
|
+
try {
|
|
105
|
+
return renderKey(source, language, key, params);
|
|
106
|
+
}
|
|
107
|
+
catch (error) {
|
|
108
|
+
language?.report({ kind: "failed", namespace, locale: language.locale, key, plugin: undefined, error });
|
|
109
|
+
return key;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=messages.js.map
|