@earendil-works/chord 1.5.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 +51 -0
- package/README.md +50 -90
- package/dist/contracts/accepts.d.ts +81 -0
- package/dist/contracts/accepts.d.ts.map +1 -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.map +1 -0
- package/dist/contracts/declare.d.ts.map +1 -0
- package/dist/contracts/declare.js.map +1 -0
- package/dist/contracts/evolve.d.ts.map +1 -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.map +1 -0
- package/dist/contracts/history.d.ts.map +1 -0
- package/dist/contracts/history.js.map +1 -0
- package/dist/contracts/host-kind.d.ts.map +1 -0
- package/dist/contracts/host-kind.js.map +1 -0
- package/dist/contracts/index.d.ts.map +1 -0
- package/dist/contracts/index.js.map +1 -0
- package/dist/contracts/internal.d.ts.map +1 -0
- package/dist/contracts/internal.js.map +1 -0
- package/dist/contracts/names.d.ts.map +1 -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.map +1 -0
- package/dist/contracts/schema.d.ts.map +1 -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.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.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.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/documents/address-source.d.ts +20 -0
- package/dist/documents/address-source.d.ts.map +1 -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.map +1 -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.map +1 -0
- package/dist/documents/index.d.ts.map +1 -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.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.map +1 -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.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.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.map +1 -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.map +1 -0
- package/dist/host/deadline.js.map +1 -0
- package/dist/host/dependencies.d.ts.map +1 -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.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.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.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.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.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.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.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.map +1 -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.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.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.map +1 -0
- package/dist/host/uuid.js.map +1 -0
- package/dist/index.d.ts +29 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +20 -10
- package/dist/index.js.map +1 -1
- package/dist/jobs/definition.d.ts.map +1 -0
- package/dist/jobs/definition.js.map +1 -0
- package/dist/jobs/index.d.ts.map +1 -0
- package/dist/jobs/index.js.map +1 -0
- package/dist/jobs/internal.d.ts.map +1 -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.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.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.map +1 -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.map +1 -0
- package/dist/link/errors.js.map +1 -0
- package/dist/link/index.d.ts.map +1 -0
- package/dist/link/index.js.map +1 -0
- package/dist/link/internal.d.ts.map +1 -0
- package/dist/link/internal.js.map +1 -0
- package/dist/link/ipc.d.ts.map +1 -0
- package/dist/link/ipc.js.map +1 -0
- package/dist/link/link.d.ts.map +1 -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.map +1 -0
- package/dist/link/text.js +355 -0
- package/dist/link/text.js.map +1 -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.map +1 -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.map +1 -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.map +1 -0
- package/dist/node/http/file.js.map +1 -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.map +1 -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.map +1 -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.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.map +1 -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/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.map +1 -0
- package/dist/registries/contribution.js.map +1 -0
- package/dist/registries/entries.d.ts.map +1 -0
- package/dist/registries/entries.js.map +1 -0
- package/dist/registries/index.d.ts.map +1 -0
- package/dist/registries/index.js.map +1 -0
- package/dist/registries/internal.d.ts.map +1 -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.map +1 -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.map +1 -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.map +1 -0
- package/dist/remote/internal.js.map +1 -0
- package/dist/remote/path.d.ts.map +1 -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/node.d.ts +9 -1
- package/dist/sqlite/node.d.ts.map +1 -1
- package/dist/sqlite/node.js +9 -3
- 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.map +1 -0
- package/dist/state/internal.d.ts.map +1 -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.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.map +1 -0
- package/dist/store/allocator.d.ts.map +1 -0
- package/dist/store/allocator.js.map +1 -0
- package/dist/store/applier.d.ts.map +1 -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.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.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.map +1 -0
- package/dist/store/claims.d.ts.map +1 -0
- package/dist/store/claims.js.map +1 -0
- package/dist/store/columns.d.ts.map +1 -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.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.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.map +1 -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.map +1 -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.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.map +1 -0
- package/dist/store/refusal.d.ts.map +1 -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.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.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.map +1 -0
- package/dist/store/table-evolve.d.ts.map +1 -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.map +1 -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.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.map +1 -0
- package/dist/store/text.d.ts.map +1 -0
- package/dist/store/text.js.map +1 -0
- package/dist/store/writes.d.ts.map +1 -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/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/design.md +3065 -0
- package/docs/durable-observers/book.md +432 -0
- package/docs/durable-observers/index.html +517 -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-4a.md +418 -0
- package/docs/slice-4b.md +208 -0
- package/docs/slice-6a.md +676 -0
- package/docs/slice-6b.md +332 -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-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 +99 -21
- 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 -207
- package/dist/contract.d.ts.map +0 -1
- package/dist/contract.js +0 -241
- 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 -1002
- 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/next/contracts/accepts.d.ts +0 -81
- package/dist/next/contracts/accepts.d.ts.map +0 -1
- package/dist/next/contracts/accepts.js.map +0 -1
- package/dist/next/contracts/contract.d.ts +0 -121
- package/dist/next/contracts/contract.d.ts.map +0 -1
- package/dist/next/contracts/contract.js.map +0 -1
- package/dist/next/contracts/declare.d.ts.map +0 -1
- package/dist/next/contracts/declare.js.map +0 -1
- package/dist/next/contracts/evolve.d.ts.map +0 -1
- package/dist/next/contracts/evolve.js.map +0 -1
- package/dist/next/contracts/fingerprint.d.ts +0 -16
- package/dist/next/contracts/fingerprint.d.ts.map +0 -1
- package/dist/next/contracts/fingerprint.js.map +0 -1
- package/dist/next/contracts/history.d.ts.map +0 -1
- package/dist/next/contracts/history.js.map +0 -1
- package/dist/next/contracts/host-kind.d.ts.map +0 -1
- package/dist/next/contracts/host-kind.js.map +0 -1
- package/dist/next/contracts/index.d.ts.map +0 -1
- package/dist/next/contracts/index.js.map +0 -1
- package/dist/next/contracts/internal.d.ts.map +0 -1
- package/dist/next/contracts/internal.js.map +0 -1
- package/dist/next/contracts/names.d.ts.map +0 -1
- package/dist/next/contracts/names.js.map +0 -1
- package/dist/next/contracts/params.d.ts +0 -28
- package/dist/next/contracts/params.d.ts.map +0 -1
- package/dist/next/contracts/params.js.map +0 -1
- package/dist/next/contracts/schema.d.ts.map +0 -1
- package/dist/next/contracts/schema.js.map +0 -1
- package/dist/next/contracts/snapshot.d.ts +0 -16
- package/dist/next/contracts/snapshot.d.ts.map +0 -1
- package/dist/next/contracts/snapshot.js +0 -167
- package/dist/next/contracts/snapshot.js.map +0 -1
- package/dist/next/data/args.d.ts +0 -50
- package/dist/next/data/args.d.ts.map +0 -1
- package/dist/next/data/args.js.map +0 -1
- package/dist/next/data/errors.d.ts +0 -73
- package/dist/next/data/errors.d.ts.map +0 -1
- package/dist/next/data/errors.js +0 -107
- package/dist/next/data/errors.js.map +0 -1
- package/dist/next/data/failure.d.ts.map +0 -1
- package/dist/next/data/failure.js +0 -72
- package/dist/next/data/failure.js.map +0 -1
- package/dist/next/data/index.d.ts +0 -4
- package/dist/next/data/index.d.ts.map +0 -1
- package/dist/next/data/index.js +0 -4
- package/dist/next/data/index.js.map +0 -1
- package/dist/next/data/internal.d.ts +0 -7
- package/dist/next/data/internal.d.ts.map +0 -1
- package/dist/next/data/internal.js +0 -8
- package/dist/next/data/internal.js.map +0 -1
- package/dist/next/data/params.d.ts +0 -20
- package/dist/next/data/params.d.ts.map +0 -1
- package/dist/next/data/params.js.map +0 -1
- package/dist/next/data/principal.d.ts +0 -17
- package/dist/next/data/principal.d.ts.map +0 -1
- package/dist/next/data/principal.js +0 -41
- package/dist/next/data/principal.js.map +0 -1
- package/dist/next/data/validator.d.ts +0 -12
- package/dist/next/data/validator.d.ts.map +0 -1
- package/dist/next/data/validator.js +0 -34
- package/dist/next/data/validator.js.map +0 -1
- package/dist/next/documents/address-source.d.ts +0 -20
- package/dist/next/documents/address-source.d.ts.map +0 -1
- package/dist/next/documents/address-source.js.map +0 -1
- package/dist/next/documents/definition.d.ts +0 -84
- package/dist/next/documents/definition.d.ts.map +0 -1
- package/dist/next/documents/definition.js +0 -73
- package/dist/next/documents/definition.js.map +0 -1
- package/dist/next/documents/documents.d.ts +0 -106
- package/dist/next/documents/documents.d.ts.map +0 -1
- package/dist/next/documents/documents.js +0 -224
- package/dist/next/documents/documents.js.map +0 -1
- package/dist/next/documents/fence.d.ts.map +0 -1
- package/dist/next/documents/fence.js.map +0 -1
- package/dist/next/documents/handles.d.ts +0 -76
- package/dist/next/documents/handles.d.ts.map +0 -1
- package/dist/next/documents/handles.js.map +0 -1
- package/dist/next/documents/index.d.ts.map +0 -1
- package/dist/next/documents/index.js.map +0 -1
- package/dist/next/documents/internal.d.ts +0 -9
- package/dist/next/documents/internal.d.ts.map +0 -1
- package/dist/next/documents/internal.js.map +0 -1
- package/dist/next/documents/keyed-slot.d.ts +0 -103
- package/dist/next/documents/keyed-slot.d.ts.map +0 -1
- package/dist/next/documents/keyed-slot.js +0 -395
- package/dist/next/documents/keyed-slot.js.map +0 -1
- package/dist/next/documents/line.d.ts.map +0 -1
- package/dist/next/documents/line.js.map +0 -1
- package/dist/next/documents/persistence.d.ts +0 -104
- package/dist/next/documents/persistence.d.ts.map +0 -1
- package/dist/next/documents/persistence.js +0 -128
- package/dist/next/documents/persistence.js.map +0 -1
- package/dist/next/documents/residency.d.ts +0 -31
- package/dist/next/documents/residency.d.ts.map +0 -1
- package/dist/next/documents/residency.js.map +0 -1
- package/dist/next/documents/slot.d.ts +0 -109
- package/dist/next/documents/slot.d.ts.map +0 -1
- package/dist/next/documents/slot.js +0 -181
- package/dist/next/documents/slot.js.map +0 -1
- package/dist/next/documents/transaction.d.ts +0 -133
- package/dist/next/documents/transaction.d.ts.map +0 -1
- package/dist/next/documents/transaction.js +0 -409
- package/dist/next/documents/transaction.js.map +0 -1
- package/dist/next/host/activity.d.ts +0 -31
- package/dist/next/host/activity.d.ts.map +0 -1
- package/dist/next/host/activity.js +0 -40
- package/dist/next/host/activity.js.map +0 -1
- package/dist/next/host/adapted.d.ts +0 -49
- package/dist/next/host/adapted.d.ts.map +0 -1
- package/dist/next/host/adapted.js.map +0 -1
- package/dist/next/host/attempt.d.ts +0 -278
- package/dist/next/host/attempt.d.ts.map +0 -1
- package/dist/next/host/attempt.js +0 -1072
- package/dist/next/host/attempt.js.map +0 -1
- package/dist/next/host/backoff.d.ts.map +0 -1
- package/dist/next/host/backoff.js.map +0 -1
- package/dist/next/host/ctx.d.ts +0 -47
- package/dist/next/host/ctx.d.ts.map +0 -1
- package/dist/next/host/ctx.js +0 -108
- package/dist/next/host/ctx.js.map +0 -1
- package/dist/next/host/deadline.d.ts.map +0 -1
- package/dist/next/host/deadline.js.map +0 -1
- package/dist/next/host/dependencies.d.ts.map +0 -1
- package/dist/next/host/dependencies.js.map +0 -1
- package/dist/next/host/destination.d.ts +0 -48
- package/dist/next/host/destination.d.ts.map +0 -1
- package/dist/next/host/destination.js.map +0 -1
- package/dist/next/host/facet.d.ts +0 -79
- package/dist/next/host/facet.d.ts.map +0 -1
- package/dist/next/host/facet.js.map +0 -1
- package/dist/next/host/follow.d.ts +0 -52
- package/dist/next/host/follow.d.ts.map +0 -1
- package/dist/next/host/follow.js.map +0 -1
- package/dist/next/host/host.d.ts +0 -495
- package/dist/next/host/host.d.ts.map +0 -1
- package/dist/next/host/host.js +0 -1075
- package/dist/next/host/host.js.map +0 -1
- package/dist/next/host/index.d.ts +0 -17
- package/dist/next/host/index.d.ts.map +0 -1
- package/dist/next/host/index.js.map +0 -1
- package/dist/next/host/internal.d.ts +0 -10
- package/dist/next/host/internal.d.ts.map +0 -1
- package/dist/next/host/internal.js +0 -8
- package/dist/next/host/internal.js.map +0 -1
- package/dist/next/host/members.d.ts +0 -50
- package/dist/next/host/members.d.ts.map +0 -1
- package/dist/next/host/members.js.map +0 -1
- package/dist/next/host/native.d.ts +0 -55
- package/dist/next/host/native.d.ts.map +0 -1
- package/dist/next/host/native.js +0 -92
- package/dist/next/host/native.js.map +0 -1
- package/dist/next/host/object.d.ts +0 -290
- package/dist/next/host/object.d.ts.map +0 -1
- package/dist/next/host/object.js +0 -1127
- package/dist/next/host/object.js.map +0 -1
- package/dist/next/host/parked.d.ts +0 -23
- package/dist/next/host/parked.d.ts.map +0 -1
- package/dist/next/host/parked.js.map +0 -1
- package/dist/next/host/presence.d.ts +0 -34
- package/dist/next/host/presence.d.ts.map +0 -1
- package/dist/next/host/presence.js.map +0 -1
- package/dist/next/host/ref-state.d.ts +0 -53
- package/dist/next/host/ref-state.d.ts.map +0 -1
- package/dist/next/host/ref-state.js +0 -83
- package/dist/next/host/ref-state.js.map +0 -1
- package/dist/next/host/reference-keys.d.ts +0 -36
- package/dist/next/host/reference-keys.d.ts.map +0 -1
- package/dist/next/host/reference-keys.js +0 -168
- package/dist/next/host/reference-keys.js.map +0 -1
- package/dist/next/host/reference-source.d.ts +0 -65
- package/dist/next/host/reference-source.d.ts.map +0 -1
- package/dist/next/host/reference-source.js +0 -285
- package/dist/next/host/reference-source.js.map +0 -1
- package/dist/next/host/reference.d.ts +0 -308
- package/dist/next/host/reference.d.ts.map +0 -1
- package/dist/next/host/reference.js +0 -775
- package/dist/next/host/reference.js.map +0 -1
- package/dist/next/host/retry-on.d.ts.map +0 -1
- package/dist/next/host/retry-on.js.map +0 -1
- package/dist/next/host/revocation.d.ts +0 -16
- package/dist/next/host/revocation.d.ts.map +0 -1
- package/dist/next/host/revocation.js.map +0 -1
- package/dist/next/host/root.d.ts +0 -27
- package/dist/next/host/root.d.ts.map +0 -1
- package/dist/next/host/root.js +0 -68
- package/dist/next/host/root.js.map +0 -1
- package/dist/next/host/route.d.ts +0 -64
- package/dist/next/host/route.d.ts.map +0 -1
- package/dist/next/host/route.js +0 -190
- package/dist/next/host/route.js.map +0 -1
- package/dist/next/host/routines.d.ts +0 -76
- package/dist/next/host/routines.d.ts.map +0 -1
- package/dist/next/host/routines.js +0 -350
- package/dist/next/host/routines.js.map +0 -1
- package/dist/next/host/sleep.d.ts +0 -9
- package/dist/next/host/sleep.d.ts.map +0 -1
- package/dist/next/host/sleep.js.map +0 -1
- package/dist/next/host/staging.d.ts +0 -94
- package/dist/next/host/staging.d.ts.map +0 -1
- package/dist/next/host/staging.js +0 -302
- package/dist/next/host/staging.js.map +0 -1
- package/dist/next/host/unbound.d.ts +0 -30
- package/dist/next/host/unbound.d.ts.map +0 -1
- package/dist/next/host/unbound.js +0 -67
- package/dist/next/host/unbound.js.map +0 -1
- package/dist/next/host/uuid.d.ts.map +0 -1
- package/dist/next/host/uuid.js.map +0 -1
- package/dist/next/index.d.ts +0 -28
- package/dist/next/index.d.ts.map +0 -1
- package/dist/next/index.js +0 -18
- package/dist/next/index.js.map +0 -1
- package/dist/next/jobs/definition.d.ts.map +0 -1
- package/dist/next/jobs/definition.js.map +0 -1
- package/dist/next/jobs/index.d.ts.map +0 -1
- package/dist/next/jobs/index.js.map +0 -1
- package/dist/next/jobs/internal.d.ts.map +0 -1
- package/dist/next/jobs/internal.js.map +0 -1
- package/dist/next/jobs/job.d.ts +0 -152
- package/dist/next/jobs/job.d.ts.map +0 -1
- package/dist/next/jobs/job.js +0 -320
- package/dist/next/jobs/job.js.map +0 -1
- package/dist/next/jobs/persisted.d.ts +0 -38
- package/dist/next/jobs/persisted.d.ts.map +0 -1
- package/dist/next/jobs/persisted.js.map +0 -1
- package/dist/next/jobs/records.d.ts +0 -231
- package/dist/next/jobs/records.d.ts.map +0 -1
- package/dist/next/jobs/records.js +0 -869
- package/dist/next/jobs/records.js.map +0 -1
- package/dist/next/jobs/run-states.d.ts +0 -69
- package/dist/next/jobs/run-states.d.ts.map +0 -1
- package/dist/next/jobs/run-states.js +0 -228
- package/dist/next/jobs/run-states.js.map +0 -1
- package/dist/next/jobs/run.d.ts +0 -113
- package/dist/next/jobs/run.d.ts.map +0 -1
- package/dist/next/jobs/run.js +0 -200
- package/dist/next/jobs/run.js.map +0 -1
- package/dist/next/jobs/running.d.ts +0 -44
- package/dist/next/jobs/running.d.ts.map +0 -1
- package/dist/next/jobs/running.js.map +0 -1
- package/dist/next/jobs/stored.d.ts +0 -63
- package/dist/next/jobs/stored.d.ts.map +0 -1
- package/dist/next/jobs/stored.js.map +0 -1
- package/dist/next/link/binary.d.ts.map +0 -1
- package/dist/next/link/binary.js +0 -534
- package/dist/next/link/binary.js.map +0 -1
- package/dist/next/link/channel.d.ts +0 -63
- package/dist/next/link/channel.d.ts.map +0 -1
- package/dist/next/link/channel.js +0 -202
- package/dist/next/link/channel.js.map +0 -1
- package/dist/next/link/errors.d.ts.map +0 -1
- package/dist/next/link/errors.js.map +0 -1
- package/dist/next/link/index.d.ts.map +0 -1
- package/dist/next/link/index.js.map +0 -1
- package/dist/next/link/internal.d.ts.map +0 -1
- package/dist/next/link/internal.js.map +0 -1
- package/dist/next/link/ipc.d.ts.map +0 -1
- package/dist/next/link/ipc.js.map +0 -1
- package/dist/next/link/link.d.ts.map +0 -1
- package/dist/next/link/link.js.map +0 -1
- package/dist/next/link/message.d.ts +0 -249
- package/dist/next/link/message.d.ts.map +0 -1
- package/dist/next/link/message.js +0 -123
- package/dist/next/link/message.js.map +0 -1
- package/dist/next/link/part.d.ts +0 -80
- package/dist/next/link/part.d.ts.map +0 -1
- package/dist/next/link/part.js +0 -164
- package/dist/next/link/part.js.map +0 -1
- package/dist/next/link/text.d.ts.map +0 -1
- package/dist/next/link/text.js +0 -335
- package/dist/next/link/text.js.map +0 -1
- package/dist/next/link/values.d.ts.map +0 -1
- package/dist/next/link/values.js +0 -117
- package/dist/next/link/values.js.map +0 -1
- package/dist/next/link/websocket.d.ts.map +0 -1
- package/dist/next/link/websocket.js.map +0 -1
- package/dist/next/registries/contribution.d.ts.map +0 -1
- package/dist/next/registries/contribution.js.map +0 -1
- package/dist/next/registries/entries.d.ts.map +0 -1
- package/dist/next/registries/entries.js.map +0 -1
- package/dist/next/registries/index.d.ts.map +0 -1
- package/dist/next/registries/index.js.map +0 -1
- package/dist/next/registries/internal.d.ts.map +0 -1
- package/dist/next/registries/internal.js.map +0 -1
- package/dist/next/registries/record.d.ts +0 -94
- package/dist/next/registries/record.d.ts.map +0 -1
- package/dist/next/registries/record.js +0 -253
- package/dist/next/registries/record.js.map +0 -1
- package/dist/next/registries/registry.d.ts +0 -74
- package/dist/next/registries/registry.d.ts.map +0 -1
- package/dist/next/registries/registry.js.map +0 -1
- package/dist/next/registries/value.d.ts.map +0 -1
- package/dist/next/registries/value.js +0 -199
- package/dist/next/registries/value.js.map +0 -1
- package/dist/next/remote/calls.d.ts.map +0 -1
- package/dist/next/remote/calls.js.map +0 -1
- package/dist/next/remote/consumer.d.ts +0 -42
- package/dist/next/remote/consumer.d.ts.map +0 -1
- package/dist/next/remote/consumer.js +0 -343
- package/dist/next/remote/consumer.js.map +0 -1
- package/dist/next/remote/hold.d.ts +0 -130
- package/dist/next/remote/hold.d.ts.map +0 -1
- package/dist/next/remote/hold.js +0 -537
- package/dist/next/remote/hold.js.map +0 -1
- package/dist/next/remote/host-link.d.ts +0 -77
- package/dist/next/remote/host-link.d.ts.map +0 -1
- package/dist/next/remote/host-link.js +0 -182
- package/dist/next/remote/host-link.js.map +0 -1
- package/dist/next/remote/internal.d.ts.map +0 -1
- package/dist/next/remote/internal.js.map +0 -1
- package/dist/next/remote/path.d.ts.map +0 -1
- package/dist/next/remote/path.js.map +0 -1
- package/dist/next/remote/provider.d.ts +0 -76
- package/dist/next/remote/provider.d.ts.map +0 -1
- package/dist/next/remote/provider.js +0 -506
- package/dist/next/remote/provider.js.map +0 -1
- package/dist/next/remote/relay.d.ts +0 -58
- package/dist/next/remote/relay.d.ts.map +0 -1
- package/dist/next/remote/relay.js +0 -117
- package/dist/next/remote/relay.js.map +0 -1
- package/dist/next/remote/remote-object.d.ts +0 -133
- package/dist/next/remote/remote-object.d.ts.map +0 -1
- package/dist/next/remote/remote-object.js +0 -411
- package/dist/next/remote/remote-object.js.map +0 -1
- package/dist/next/remote/replica.d.ts +0 -59
- package/dist/next/remote/replica.d.ts.map +0 -1
- package/dist/next/remote/replica.js +0 -125
- package/dist/next/remote/replica.js.map +0 -1
- package/dist/next/state/batch.d.ts +0 -64
- package/dist/next/state/batch.d.ts.map +0 -1
- package/dist/next/state/batch.js +0 -163
- package/dist/next/state/batch.js.map +0 -1
- package/dist/next/state/derive.d.ts +0 -52
- package/dist/next/state/derive.d.ts.map +0 -1
- package/dist/next/state/derive.js +0 -182
- package/dist/next/state/derive.js.map +0 -1
- package/dist/next/state/index.d.ts +0 -6
- package/dist/next/state/index.d.ts.map +0 -1
- package/dist/next/state/index.js.map +0 -1
- package/dist/next/state/internal.d.ts.map +0 -1
- package/dist/next/state/internal.js.map +0 -1
- package/dist/next/state/native-source.d.ts +0 -106
- package/dist/next/state/native-source.d.ts.map +0 -1
- package/dist/next/state/native-source.js +0 -240
- package/dist/next/state/native-source.js.map +0 -1
- package/dist/next/state/watchable.d.ts +0 -114
- package/dist/next/state/watchable.d.ts.map +0 -1
- package/dist/next/state/watchable.js +0 -156
- package/dist/next/state/watchable.js.map +0 -1
- package/dist/next/state/writable.d.ts +0 -32
- package/dist/next/state/writable.d.ts.map +0 -1
- package/dist/next/state/writable.js.map +0 -1
- package/dist/next/store/adapter.d.ts +0 -67
- package/dist/next/store/adapter.d.ts.map +0 -1
- package/dist/next/store/adapter.js.map +0 -1
- package/dist/next/store/allocator.d.ts.map +0 -1
- package/dist/next/store/allocator.js.map +0 -1
- package/dist/next/store/applier.d.ts.map +0 -1
- package/dist/next/store/applier.js.map +0 -1
- package/dist/next/store/apply-batch.d.ts +0 -12
- package/dist/next/store/apply-batch.d.ts.map +0 -1
- package/dist/next/store/apply-batch.js.map +0 -1
- package/dist/next/store/archive.d.ts +0 -32
- package/dist/next/store/archive.d.ts.map +0 -1
- package/dist/next/store/archive.js +0 -129
- package/dist/next/store/archive.js.map +0 -1
- package/dist/next/store/backend.d.ts +0 -10
- package/dist/next/store/backend.d.ts.map +0 -1
- package/dist/next/store/backend.js.map +0 -1
- package/dist/next/store/catalog.d.ts +0 -24
- package/dist/next/store/catalog.d.ts.map +0 -1
- package/dist/next/store/catalog.js.map +0 -1
- package/dist/next/store/claims.d.ts.map +0 -1
- package/dist/next/store/claims.js.map +0 -1
- package/dist/next/store/columns.d.ts.map +0 -1
- package/dist/next/store/columns.js.map +0 -1
- package/dist/next/store/engine.d.ts +0 -176
- package/dist/next/store/engine.d.ts.map +0 -1
- package/dist/next/store/engine.js +0 -283
- package/dist/next/store/engine.js.map +0 -1
- package/dist/next/store/evaluate.d.ts +0 -17
- package/dist/next/store/evaluate.d.ts.map +0 -1
- package/dist/next/store/evaluate.js.map +0 -1
- package/dist/next/store/export.d.ts +0 -17
- package/dist/next/store/export.d.ts.map +0 -1
- package/dist/next/store/export.js +0 -200
- package/dist/next/store/export.js.map +0 -1
- package/dist/next/store/expression.d.ts +0 -150
- package/dist/next/store/expression.d.ts.map +0 -1
- package/dist/next/store/expression.js.map +0 -1
- package/dist/next/store/import.d.ts +0 -10
- package/dist/next/store/import.d.ts.map +0 -1
- package/dist/next/store/import.js +0 -276
- package/dist/next/store/import.js.map +0 -1
- package/dist/next/store/index.d.ts.map +0 -1
- package/dist/next/store/index.js.map +0 -1
- package/dist/next/store/json-column.d.ts +0 -33
- package/dist/next/store/json-column.d.ts.map +0 -1
- package/dist/next/store/json-column.js +0 -61
- package/dist/next/store/json-column.js.map +0 -1
- package/dist/next/store/jsonl.d.ts.map +0 -1
- package/dist/next/store/jsonl.js.map +0 -1
- package/dist/next/store/outbox.d.ts +0 -26
- package/dist/next/store/outbox.d.ts.map +0 -1
- package/dist/next/store/outbox.js.map +0 -1
- package/dist/next/store/query.d.ts +0 -39
- package/dist/next/store/query.d.ts.map +0 -1
- package/dist/next/store/query.js.map +0 -1
- package/dist/next/store/refusal.d.ts.map +0 -1
- package/dist/next/store/refusal.js.map +0 -1
- package/dist/next/store/rows.d.ts +0 -80
- package/dist/next/store/rows.d.ts.map +0 -1
- package/dist/next/store/rows.js.map +0 -1
- package/dist/next/store/schema.d.ts +0 -25
- package/dist/next/store/schema.d.ts.map +0 -1
- package/dist/next/store/schema.js +0 -115
- package/dist/next/store/schema.js.map +0 -1
- package/dist/next/store/sql.d.ts +0 -73
- package/dist/next/store/sql.d.ts.map +0 -1
- package/dist/next/store/sql.js.map +0 -1
- package/dist/next/store/step.d.ts +0 -48
- package/dist/next/store/step.d.ts.map +0 -1
- package/dist/next/store/step.js +0 -50
- package/dist/next/store/step.js.map +0 -1
- package/dist/next/store/store.d.ts +0 -161
- package/dist/next/store/store.d.ts.map +0 -1
- package/dist/next/store/store.js +0 -627
- package/dist/next/store/store.js.map +0 -1
- package/dist/next/store/table-changes.d.ts +0 -29
- package/dist/next/store/table-changes.d.ts.map +0 -1
- package/dist/next/store/table-changes.js.map +0 -1
- package/dist/next/store/table-evolve.d.ts.map +0 -1
- package/dist/next/store/table-evolve.js.map +0 -1
- package/dist/next/store/table-handle.d.ts +0 -67
- package/dist/next/store/table-handle.d.ts.map +0 -1
- package/dist/next/store/table-handle.js +0 -101
- package/dist/next/store/table-handle.js.map +0 -1
- package/dist/next/store/table-history.d.ts.map +0 -1
- package/dist/next/store/table-history.js.map +0 -1
- package/dist/next/store/table-migration.d.ts +0 -16
- package/dist/next/store/table-migration.d.ts.map +0 -1
- package/dist/next/store/table-migration.js +0 -202
- package/dist/next/store/table-migration.js.map +0 -1
- package/dist/next/store/table-writes.d.ts.map +0 -1
- package/dist/next/store/table-writes.js +0 -165
- package/dist/next/store/table-writes.js.map +0 -1
- package/dist/next/store/table.d.ts +0 -80
- package/dist/next/store/table.d.ts.map +0 -1
- package/dist/next/store/table.js.map +0 -1
- package/dist/next/store/text.d.ts.map +0 -1
- package/dist/next/store/text.js.map +0 -1
- package/dist/next/store/writes.d.ts.map +0 -1
- package/dist/next/store/writes.js.map +0 -1
- package/dist/next-node/compression.d.ts +0 -7
- package/dist/next-node/compression.d.ts.map +0 -1
- package/dist/next-node/compression.js +0 -24
- package/dist/next-node/compression.js.map +0 -1
- package/dist/next-node/http/admission.d.ts.map +0 -1
- package/dist/next-node/http/admission.js.map +0 -1
- package/dist/next-node/http/authenticate.d.ts +0 -21
- package/dist/next-node/http/authenticate.d.ts.map +0 -1
- package/dist/next-node/http/authenticate.js +0 -34
- package/dist/next-node/http/authenticate.js.map +0 -1
- package/dist/next-node/http/cookies.d.ts +0 -24
- package/dist/next-node/http/cookies.d.ts.map +0 -1
- package/dist/next-node/http/cookies.js +0 -62
- package/dist/next-node/http/cookies.js.map +0 -1
- package/dist/next-node/http/file.d.ts.map +0 -1
- package/dist/next-node/http/file.js.map +0 -1
- package/dist/next-node/http/headers.d.ts.map +0 -1
- package/dist/next-node/http/headers.js +0 -129
- package/dist/next-node/http/headers.js.map +0 -1
- package/dist/next-node/http/http.d.ts +0 -100
- package/dist/next-node/http/http.d.ts.map +0 -1
- package/dist/next-node/http/http.js +0 -462
- package/dist/next-node/http/http.js.map +0 -1
- package/dist/next-node/http/incoming.d.ts.map +0 -1
- package/dist/next-node/http/incoming.js.map +0 -1
- package/dist/next-node/http/index.d.ts +0 -11
- package/dist/next-node/http/index.d.ts.map +0 -1
- package/dist/next-node/http/index.js +0 -12
- package/dist/next-node/http/index.js.map +0 -1
- package/dist/next-node/http/node.d.ts.map +0 -1
- package/dist/next-node/http/node.js.map +0 -1
- package/dist/next-node/http/request.d.ts +0 -54
- package/dist/next-node/http/request.d.ts.map +0 -1
- package/dist/next-node/http/request.js +0 -116
- package/dist/next-node/http/request.js.map +0 -1
- package/dist/next-node/http/response.d.ts +0 -63
- package/dist/next-node/http/response.d.ts.map +0 -1
- package/dist/next-node/http/response.js.map +0 -1
- package/dist/next-node/http/router.d.ts +0 -114
- package/dist/next-node/http/router.d.ts.map +0 -1
- package/dist/next-node/http/router.js +0 -261
- package/dist/next-node/http/router.js.map +0 -1
- package/dist/next-node/http/upgrades.d.ts +0 -58
- package/dist/next-node/http/upgrades.d.ts.map +0 -1
- package/dist/next-node/http/upgrades.js +0 -184
- package/dist/next-node/http/upgrades.js.map +0 -1
- package/dist/next-node/plugins/build.d.ts +0 -57
- package/dist/next-node/plugins/build.d.ts.map +0 -1
- package/dist/next-node/plugins/build.js +0 -334
- package/dist/next-node/plugins/build.js.map +0 -1
- package/dist/next-node/plugins/discover.d.ts +0 -36
- package/dist/next-node/plugins/discover.d.ts.map +0 -1
- package/dist/next-node/plugins/discover.js +0 -91
- package/dist/next-node/plugins/discover.js.map +0 -1
- package/dist/next-node/plugins/evaluate.d.ts +0 -33
- package/dist/next-node/plugins/evaluate.d.ts.map +0 -1
- package/dist/next-node/plugins/evaluate.js +0 -98
- package/dist/next-node/plugins/evaluate.js.map +0 -1
- package/dist/next-node/plugins/index.d.ts +0 -9
- package/dist/next-node/plugins/index.d.ts.map +0 -1
- package/dist/next-node/plugins/index.js +0 -11
- package/dist/next-node/plugins/index.js.map +0 -1
- package/dist/next-node/plugins/install.d.ts +0 -13
- package/dist/next-node/plugins/install.d.ts.map +0 -1
- package/dist/next-node/plugins/install.js +0 -37
- package/dist/next-node/plugins/install.js.map +0 -1
- package/dist/next-node/plugins/plugins.d.ts +0 -135
- package/dist/next-node/plugins/plugins.d.ts.map +0 -1
- package/dist/next-node/plugins/plugins.js +0 -206
- package/dist/next-node/plugins/plugins.js.map +0 -1
- package/dist/next-node/plugins/runtime.d.ts +0 -41
- package/dist/next-node/plugins/runtime.d.ts.map +0 -1
- package/dist/next-node/plugins/runtime.js +0 -136
- package/dist/next-node/plugins/runtime.js.map +0 -1
- package/dist/next-node/plugins/stack.d.ts.map +0 -1
- package/dist/next-node/plugins/stack.js.map +0 -1
- package/dist/next-node/plugins/watcher.d.ts +0 -58
- package/dist/next-node/plugins/watcher.d.ts.map +0 -1
- package/dist/next-node/plugins/watcher.js +0 -281
- package/dist/next-node/plugins/watcher.js.map +0 -1
- package/dist/next-node/workers/control.d.ts +0 -83
- package/dist/next-node/workers/control.d.ts.map +0 -1
- package/dist/next-node/workers/control.js +0 -77
- package/dist/next-node/workers/control.js.map +0 -1
- package/dist/next-node/workers/index.d.ts +0 -5
- package/dist/next-node/workers/index.d.ts.map +0 -1
- package/dist/next-node/workers/index.js +0 -7
- package/dist/next-node/workers/index.js.map +0 -1
- package/dist/next-node/workers/lock.d.ts +0 -21
- package/dist/next-node/workers/lock.d.ts.map +0 -1
- package/dist/next-node/workers/lock.js +0 -137
- package/dist/next-node/workers/lock.js.map +0 -1
- package/dist/next-node/workers/main.d.ts +0 -46
- package/dist/next-node/workers/main.d.ts.map +0 -1
- package/dist/next-node/workers/main.js +0 -230
- package/dist/next-node/workers/main.js.map +0 -1
- package/dist/next-node/workers/process.d.ts +0 -42
- package/dist/next-node/workers/process.d.ts.map +0 -1
- package/dist/next-node/workers/process.js +0 -125
- package/dist/next-node/workers/process.js.map +0 -1
- package/dist/next-node/workers/workers.d.ts +0 -80
- package/dist/next-node/workers/workers.d.ts.map +0 -1
- package/dist/next-node/workers/workers.js +0 -572
- package/dist/next-node/workers/workers.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 -1570
- 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 -25
- package/dist/schema.d.ts.map +0 -1
- package/dist/schema.js +0 -403
- 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 -197
- package/dist/wire.d.ts.map +0 -1
- package/dist/wire.js +0 -166
- package/dist/wire.js.map +0 -1
- package/docs/guide.md +0 -814
- package/docs/next/benchmarks.md +0 -959
- package/docs/next/decisions.md +0 -2957
- package/docs/next/dependencies/book.md +0 -1671
- package/docs/next/dependencies/index.html +0 -2641
- package/docs/next/design.md +0 -2554
- package/docs/next/durable-observers/book.md +0 -432
- package/docs/next/durable-observers/index.html +0 -517
- package/docs/next/guide-plugins-hosts/book.md +0 -607
- package/docs/next/guide-plugins-hosts/index.html +0 -652
- package/docs/next/http-workers/book.md +0 -378
- package/docs/next/http-workers/index.html +0 -515
- package/docs/next/layer-1.md +0 -311
- package/docs/next/layer-2.md +0 -216
- package/docs/next/plugin-model/book.md +0 -186
- package/docs/next/plugin-model/index.html +0 -310
- package/docs/next/plugin-primer/book.md +0 -273
- package/docs/next/plugin-primer/index.html +0 -430
- package/docs/next/slice-1.md +0 -236
- package/docs/next/slice-10.md +0 -285
- package/docs/next/slice-11.md +0 -93
- package/docs/next/slice-2.md +0 -174
- package/docs/next/slice-3a.md +0 -296
- package/docs/next/slice-3b.md +0 -197
- package/docs/next/slice-4a.md +0 -418
- package/docs/next/slice-4b.md +0 -208
- package/docs/next/slice-6a.md +0 -676
- package/docs/next/slice-6b.md +0 -332
- package/docs/next/slice-7b/book.md +0 -608
- package/docs/next/slice-7b/index.html +0 -842
- package/docs/next/slice-7b.md +0 -255
- package/docs/next/slice-7c.md +0 -165
- package/docs/next/slices.md +0 -230
- package/docs/next/store/book.md +0 -665
- package/docs/next/store/index.html +0 -861
- package/docs/next/store/walkthrough.md +0 -193
- package/docs/spec.md +0 -288
- package/docs/tutorial.md +0 -932
- /package/dist/{next/contracts → contracts}/accepts.js +0 -0
- /package/dist/{next/contracts → contracts}/contract.js +0 -0
- /package/dist/{next/contracts → contracts}/declare.d.ts +0 -0
- /package/dist/{next/contracts → contracts}/declare.js +0 -0
- /package/dist/{next/contracts → contracts}/evolve.d.ts +0 -0
- /package/dist/{next/contracts → contracts}/evolve.js +0 -0
- /package/dist/{next/contracts → contracts}/fingerprint.js +0 -0
- /package/dist/{next/contracts → contracts}/history.d.ts +0 -0
- /package/dist/{next/contracts → contracts}/history.js +0 -0
- /package/dist/{next/contracts → contracts}/host-kind.d.ts +0 -0
- /package/dist/{next/contracts → contracts}/host-kind.js +0 -0
- /package/dist/{next/contracts → contracts}/index.d.ts +0 -0
- /package/dist/{next/contracts → contracts}/index.js +0 -0
- /package/dist/{next/contracts → contracts}/internal.d.ts +0 -0
- /package/dist/{next/contracts → contracts}/internal.js +0 -0
- /package/dist/{next/contracts → contracts}/names.d.ts +0 -0
- /package/dist/{next/contracts → contracts}/names.js +0 -0
- /package/dist/{next/contracts → contracts}/params.js +0 -0
- /package/dist/{next/contracts → contracts}/schema.d.ts +0 -0
- /package/dist/{next/contracts → contracts}/schema.js +0 -0
- /package/dist/{next/data → data}/args.js +0 -0
- /package/dist/{next/data → data}/failure.d.ts +0 -0
- /package/dist/{next/data → data}/params.js +0 -0
- /package/dist/{next/documents → documents}/address-source.js +0 -0
- /package/dist/{next/documents → documents}/fence.d.ts +0 -0
- /package/dist/{next/documents → documents}/fence.js +0 -0
- /package/dist/{next/documents → documents}/handles.js +0 -0
- /package/dist/{next/documents → documents}/index.d.ts +0 -0
- /package/dist/{next/documents → documents}/index.js +0 -0
- /package/dist/{next/documents → documents}/internal.js +0 -0
- /package/dist/{next/documents → documents}/line.d.ts +0 -0
- /package/dist/{next/documents → documents}/line.js +0 -0
- /package/dist/{next/documents → documents}/residency.js +0 -0
- /package/dist/{next/host → host}/adapted.js +0 -0
- /package/dist/{next/host → host}/backoff.d.ts +0 -0
- /package/dist/{next/host → host}/backoff.js +0 -0
- /package/dist/{next/host → host}/deadline.d.ts +0 -0
- /package/dist/{next/host → host}/deadline.js +0 -0
- /package/dist/{next/host → host}/dependencies.d.ts +0 -0
- /package/dist/{next/host → host}/dependencies.js +0 -0
- /package/dist/{next/host → host}/destination.js +0 -0
- /package/dist/{next/host → host}/facet.js +0 -0
- /package/dist/{next/host → host}/follow.js +0 -0
- /package/dist/{next/host → host}/index.js +0 -0
- /package/dist/{next/host → host}/members.js +0 -0
- /package/dist/{next/host → host}/parked.js +0 -0
- /package/dist/{next/host → host}/presence.js +0 -0
- /package/dist/{next/host → host}/retry-on.d.ts +0 -0
- /package/dist/{next/host → host}/retry-on.js +0 -0
- /package/dist/{next/host → host}/revocation.js +0 -0
- /package/dist/{next/host → host}/sleep.js +0 -0
- /package/dist/{next/host → host}/uuid.d.ts +0 -0
- /package/dist/{next/host → host}/uuid.js +0 -0
- /package/dist/{next/jobs → jobs}/definition.d.ts +0 -0
- /package/dist/{next/jobs → jobs}/definition.js +0 -0
- /package/dist/{next/jobs → jobs}/index.d.ts +0 -0
- /package/dist/{next/jobs → jobs}/index.js +0 -0
- /package/dist/{next/jobs → jobs}/internal.d.ts +0 -0
- /package/dist/{next/jobs → jobs}/internal.js +0 -0
- /package/dist/{next/jobs → jobs}/persisted.js +0 -0
- /package/dist/{next/jobs → jobs}/running.js +0 -0
- /package/dist/{next/jobs → jobs}/stored.js +0 -0
- /package/dist/{next/link → link}/binary.d.ts +0 -0
- /package/dist/{next/link → link}/errors.d.ts +0 -0
- /package/dist/{next/link → link}/errors.js +0 -0
- /package/dist/{next/link → link}/index.d.ts +0 -0
- /package/dist/{next/link → link}/index.js +0 -0
- /package/dist/{next/link → link}/internal.d.ts +0 -0
- /package/dist/{next/link → link}/internal.js +0 -0
- /package/dist/{next/link → link}/ipc.d.ts +0 -0
- /package/dist/{next/link → link}/ipc.js +0 -0
- /package/dist/{next/link → link}/link.d.ts +0 -0
- /package/dist/{next/link → link}/link.js +0 -0
- /package/dist/{next/link → link}/text.d.ts +0 -0
- /package/dist/{next/link → link}/values.d.ts +0 -0
- /package/dist/{next/link → link}/websocket.d.ts +0 -0
- /package/dist/{next/link → link}/websocket.js +0 -0
- /package/dist/{next-node → node}/http/admission.d.ts +0 -0
- /package/dist/{next-node → node}/http/admission.js +0 -0
- /package/dist/{next-node → node}/http/file.d.ts +0 -0
- /package/dist/{next-node → node}/http/file.js +0 -0
- /package/dist/{next-node → node}/http/headers.d.ts +0 -0
- /package/dist/{next-node → node}/http/incoming.d.ts +0 -0
- /package/dist/{next-node → node}/http/incoming.js +0 -0
- /package/dist/{next-node → node}/http/node.d.ts +0 -0
- /package/dist/{next-node → node}/http/node.js +0 -0
- /package/dist/{next-node → node}/http/response.js +0 -0
- /package/dist/{next-node → node}/plugins/stack.d.ts +0 -0
- /package/dist/{next-node → node}/plugins/stack.js +0 -0
- /package/dist/{next/registries → registries}/contribution.d.ts +0 -0
- /package/dist/{next/registries → registries}/contribution.js +0 -0
- /package/dist/{next/registries → registries}/entries.d.ts +0 -0
- /package/dist/{next/registries → registries}/entries.js +0 -0
- /package/dist/{next/registries → registries}/index.d.ts +0 -0
- /package/dist/{next/registries → registries}/index.js +0 -0
- /package/dist/{next/registries → registries}/internal.d.ts +0 -0
- /package/dist/{next/registries → registries}/internal.js +0 -0
- /package/dist/{next/registries → registries}/registry.js +0 -0
- /package/dist/{next/registries → registries}/value.d.ts +0 -0
- /package/dist/{next/remote → remote}/calls.d.ts +0 -0
- /package/dist/{next/remote → remote}/calls.js +0 -0
- /package/dist/{next/remote → remote}/internal.d.ts +0 -0
- /package/dist/{next/remote → remote}/internal.js +0 -0
- /package/dist/{next/remote → remote}/path.d.ts +0 -0
- /package/dist/{next/remote → remote}/path.js +0 -0
- /package/dist/{next/state → state}/index.js +0 -0
- /package/dist/{next/state → state}/internal.d.ts +0 -0
- /package/dist/{next/state → state}/internal.js +0 -0
- /package/dist/{next/state → state}/writable.js +0 -0
- /package/dist/{next/store → store}/adapter.js +0 -0
- /package/dist/{next/store → store}/allocator.d.ts +0 -0
- /package/dist/{next/store → store}/allocator.js +0 -0
- /package/dist/{next/store → store}/applier.d.ts +0 -0
- /package/dist/{next/store → store}/applier.js +0 -0
- /package/dist/{next/store → store}/apply-batch.js +0 -0
- /package/dist/{next/store → store}/backend.js +0 -0
- /package/dist/{next/store → store}/catalog.js +0 -0
- /package/dist/{next/store → store}/claims.d.ts +0 -0
- /package/dist/{next/store → store}/claims.js +0 -0
- /package/dist/{next/store → store}/columns.d.ts +0 -0
- /package/dist/{next/store → store}/columns.js +0 -0
- /package/dist/{next/store → store}/evaluate.js +0 -0
- /package/dist/{next/store → store}/expression.js +0 -0
- /package/dist/{next/store → store}/index.d.ts +0 -0
- /package/dist/{next/store → store}/index.js +0 -0
- /package/dist/{next/store → store}/jsonl.d.ts +0 -0
- /package/dist/{next/store → store}/jsonl.js +0 -0
- /package/dist/{next/store → store}/outbox.js +0 -0
- /package/dist/{next/store → store}/query.js +0 -0
- /package/dist/{next/store → store}/refusal.d.ts +0 -0
- /package/dist/{next/store → store}/refusal.js +0 -0
- /package/dist/{next/store → store}/rows.js +0 -0
- /package/dist/{next/store → store}/sql.js +0 -0
- /package/dist/{next/store → store}/table-changes.js +0 -0
- /package/dist/{next/store → store}/table-evolve.d.ts +0 -0
- /package/dist/{next/store → store}/table-evolve.js +0 -0
- /package/dist/{next/store → store}/table-history.d.ts +0 -0
- /package/dist/{next/store → store}/table-history.js +0 -0
- /package/dist/{next/store → store}/table-writes.d.ts +0 -0
- /package/dist/{next/store → store}/table.js +0 -0
- /package/dist/{next/store → store}/text.d.ts +0 -0
- /package/dist/{next/store → store}/text.js +0 -0
- /package/dist/{next/store → store}/writes.d.ts +0 -0
- /package/dist/{next/store → store}/writes.js +0 -0
- /package/docs/{next/dependencies → dependencies}/model.md +0 -0
- /package/docs/{next/flow-control → flow-control}/book.md +0 -0
- /package/docs/{next/flow-control → flow-control}/fold/index.html +0 -0
- /package/docs/{next/flow-control → flow-control}/index.html +0 -0
- /package/docs/{next/flow-control → flow-control}/window/index.html +0 -0
- /package/docs/{next/slice-4.md → slice-4.md} +0 -0
- /package/docs/{next/slice-5.md → slice-5.md} +0 -0
- /package/docs/{next/slice-7a.md → slice-7a.md} +0 -0
- /package/docs/{next/slice-8.md → slice-8.md} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sessions.js","sourceRoot":"","sources":["../../../src/node/app/sessions.ts"],"names":[],"mappings":"AAAA,sHAAsH;AACtH,sHAAsH;AACtH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Q,CAAC;YAC1G,MAAM,MAAM,GAAG,gBAAgB,CAAC,OAAO,EAAE,cAAc,EAAE,MAAM,CAAC,CAAC;YACjE,IAAI,MAAM,EAAE,OAAO,KAAK,SAAS,IAAI,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,eAAe,GAAG,OAAO;gBAAE,OAAO,QAAQ,CAAC;YAC9G,IAAI,YAAY,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,KAAK,SAAS;gBAAE,OAAO,QAAQ,CAAC;YACnE,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;YACxE,OAAO,EAAE,GAAG,QAAQ,EAAE,OAAO,EAAE,EAAE,GAAG,QAAQ,CAAC,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,EAAE,CAAC;QACjF,CAAC;KACD,CAAC;AACH,CAAC;AAED,wDAAwD;AACxD,SAAS,WAAW,CAAC,IAAY;IAChC,OAAO,IAAI,CAAC,WAAW,EAAE,KAAK,YAAY,CAAC;AAC5C,CAAC;AAED,8DAA8D;AAC9D,SAAS,WAAW,CAAC,OAAoB;IACxC,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;IACpD,MAAM,KAAK,GAAG,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,mBAAmB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACxE,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;AACnB,CAAC","sourcesContent":["// Sessions (slice 13 §2, decision \"The app kit, point 3: authentication\"): the kit's object on the server that issues\n// and revokes sessions, and its authenticator. A session is a principal behind a token `<id>.<secret>` (random); only\n// the secret's hash is kept. A browser carries its token in the kit's signed session cookie (`HttpOnly`,\n// `SameSite=Strict`), a command-line client in `Authorization: Bearer <token>`. Browser and device sessions persist in\n// the server's store and expire after 400 days unused; ephemeral sessions (a pick-a-name login, a public route) live\n// in memory only (`EphemeralSessions`), at most `maxEphemeral` of them (past it the oldest ends), so a public login\n// costs the same whatever came before; each ends with its client's connection (its last link closed, a grace period\n// passed: the links endpoint's `opened` hook counts them), and none outlives the server's run.\n\nimport type { Context } from \"../../context/index.ts\";\nimport { arr, bool, local, map, method, num, obj, oneOf, opt, str, unknown } from \"../../contracts/index.ts\";\nimport type { Principal } from \"../../data/index.ts\";\nimport { defineState } from \"../../documents/index.ts\";\nimport { defineFacet, type Facet } from \"../../host/index.ts\";\nimport type { JsonValue } from \"../../json.ts\";\nimport {\n\tAuthenticators,\n\tcookie,\n\tHttp,\n\ttype HttpRequest,\n\ttype HttpWrap,\n\ttype Provenance,\n\treadCookie,\n\treadSignedCookie,\n} from \"../http/index.ts\";\nimport { EphemeralSessions } from \"./ephemeral-sessions.ts\";\nimport { hashToken, matchesHash, newToken } from \"./secrets.ts\";\n\n/** What a session is for: a browser (its cookie), a device (a command-line client's token), an ephemeral login. */\nexport type SessionKind = \"browser\" | \"device\" | \"ephemeral\";\n\n/** A browser or device session as `Sessions.list` shows it: never its token or hash. */\nexport type SessionInfo = {\n\treadonly id: string;\n\treadonly label: string;\n\treadonly kind: \"browser\" | \"device\";\n\treadonly principal: unknown;\n\treadonly created: number;\n\treadonly lastUsed: number;\n};\n\n/** The kit's sessions (one per server): issue, verify, revoke, and the watchable list of persisted ones. */\nexport const Sessions = local(\"chord.app.sessions\", {\n\tversion: 1,\n\tparams: {},\n\tmembers: {\n\t\t/** The browser and device sessions (ephemeral ones are not listed: there may be many, and they are short). */\n\t\tlist: arr(\n\t\t\tobj({\n\t\t\t\tid: str(),\n\t\t\t\tlabel: str(),\n\t\t\t\tkind: oneOf(\"browser\", \"device\"),\n\t\t\t\tprincipal: unknown(),\n\t\t\t\tcreated: num(),\n\t\t\t\tlastUsed: num(),\n\t\t\t}),\n\t\t),\n\t\t/**\n\t\t * A new session for `principal`: its id, its token (shown once, kept only hashed) and the session cookie carrying\n\t\t * it for a browser (`Set-Cookie`; `secure` for a remote one).\n\t\t */\n\t\tissue: method(\n\t\t\tobj({\n\t\t\t\tprincipal: unknown(),\n\t\t\t\tlabel: str(),\n\t\t\t\tkind: oneOf(\"browser\", \"device\", \"ephemeral\"),\n\t\t\t\tsecure: opt(bool()),\n\t\t\t}),\n\t\t\tobj({ id: str(), token: str(), cookie: str() }),\n\t\t),\n\t\t/** The principal `token` authenticates as, or `null` (unknown, revoked, expired, malformed). */\n\t\tverify: method(str(), unknown()),\n\t\t/** Ends session `id` at once: its token authenticates nothing more. */\n\t\trevoke: method(str()),\n\t},\n});\n\n/** The name of the kit's session cookie. */\nexport const SESSION_COOKIE = \"chord-session\";\n\n/** The stored sessions: by id, each with its secret's hash and its principal (as JSON text: any of the app's). */\nconst SessionsDocument = defineState(\"chord.app.sessions\", {\n\tschema: obj({\n\t\tsessions: map(\n\t\t\tobj({\n\t\t\t\thash: str(),\n\t\t\t\tlabel: str(),\n\t\t\t\tkind: oneOf(\"browser\", \"device\"),\n\t\t\t\tprincipal: str(),\n\t\t\t\tcreated: num(),\n\t\t\t\tlastUsed: num(),\n\t\t\t}),\n\t\t),\n\t}),\n\tversion: 1,\n\tinitial: () => ({ sessions: {} }),\n\tpersist: true,\n\tcheckpointWhen: (_value, _ops, { deltasSinceBase }) => deltasSinceBase >= 50,\n});\n\n/** How often a session's `lastUsed` is written at most: once a minute (not one commit per request). */\nconst TOUCH_MS = 60_000;\n\n/** How long a persisted session lives unused: 400 days, as its cookie. */\nconst SESSION_IDLE_MS = 400 * 24 * 60 * 60_000;\n\n/** The sessions' limits: how many ephemeral sessions live at once (1,000 by default; past it the oldest ends). */\nexport type SessionLimits = { readonly maxEphemeral?: number };\n\n/** The kit's sessions: the facet for the server's core facets, and the links endpoint's `opened` hook. */\nexport type KitSessions<P extends Principal> = {\n\treadonly facet: Facet<P>;\n\t/** A link opened with `request`'s credentials: an ephemeral session's links are counted (it ends with its last). */\n\treadonly opened: (request: HttpRequest) => (() => void) | undefined;\n};\n\n/**\n * The kit's sessions: its facet serving `Sessions` (a host-lifetime object) and contributing its authenticator (the\n * bearer token first, else the session cookie signed with `cookieSecret`), and the links hook ending an ephemeral\n * session with its client's connection.\n */\nexport function createSessions<P extends Principal>(cookieSecret: string, limits: SessionLimits = {}): KitSessions<P> {\n\tconst ephemeral = new EphemeralSessions(limits.maxEphemeral ?? 1000);\n\tconst opened = (request: HttpRequest): (() => void) | undefined => {\n\t\tconst token = bearerToken(request) ?? readCookie(request, SESSION_COOKIE, cookieSecret);\n\t\tconst dot = token?.indexOf(\".\") ?? -1;\n\t\treturn dot > 0 ? ephemeral.linkOpened(token!.slice(0, dot)) : undefined;\n\t};\n\treturn { facet: sessionsFacet<P>(cookieSecret, ephemeral), opened };\n}\n\n/** The facet of `createSessions`. */\nfunction sessionsFacet<P extends Principal>(cookieSecret: string, ephemeral: EphemeralSessions): Facet<P> {\n\treturn defineFacet<P>((host) =>\n\t\thost.serve(Sessions, (_params, self) => {\n\t\t\tconst document = self.state(SessionsDocument);\n\t\t\tconst change = (fn: (sessions: Record<string, { lastUsed: number }>) => void, context: Context) =>\n\t\t\t\t// Not awaited by authentication: the request goes on; a write that fails is made again by a later request.\n\t\t\t\tvoid document.change((draft) => fn(draft.sessions), context).catch(() => {});\n\t\t\t/** The principal of `token`, or `undefined`; touches or lazily removes the persisted session it names. */\n\t\t\tconst authenticate = (token: string, context: Context): Principal | undefined => {\n\t\t\t\tconst dot = token.indexOf(\".\");\n\t\t\t\tif (dot <= 0) return undefined;\n\t\t\t\tconst id = token.slice(0, dot);\n\t\t\t\tconst secret = token.slice(dot + 1);\n\t\t\t\tconst short = ephemeral.get(id);\n\t\t\t\tif (short !== undefined) return matchesHash(secret, short.hash) ? short.principal : undefined;\n\t\t\t\t// A trust boundary: `id` is the client's (`Object.hasOwn`: no inherited member is a session).\n\t\t\t\tconst sessions = document.value.sessions;\n\t\t\t\tif (!Object.hasOwn(sessions, id)) return undefined;\n\t\t\t\tconst session = sessions[id]!;\n\t\t\t\tif (!matchesHash(secret, session.hash)) return undefined;\n\t\t\t\tconst now = Date.now();\n\t\t\t\tif (now - session.lastUsed > SESSION_IDLE_MS) {\n\t\t\t\t\tchange((draft) => {\n\t\t\t\t\t\tdelete draft[id];\n\t\t\t\t\t}, context);\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t\tif (now - session.lastUsed > TOUCH_MS) {\n\t\t\t\t\tchange((draft) => {\n\t\t\t\t\t\tif (Object.hasOwn(draft, id)) draft[id]!.lastUsed = now;\n\t\t\t\t\t}, context);\n\t\t\t\t}\n\t\t\t\t// Stored by `issue` from a principal of the app's type.\n\t\t\t\treturn JSON.parse(session.principal) as Principal;\n\t\t\t};\n\t\t\tself.contribute(Authenticators, (request, context) => {\n\t\t\t\tconst token = bearerToken(request) ?? readCookie(request, SESSION_COOKIE, cookieSecret);\n\t\t\t\treturn token === undefined ? undefined : authenticate(token, context);\n\t\t\t});\n\t\t\tself.contribute(Http, { wraps: [rollingCookie(cookieSecret, authenticate)] });\n\t\t\treturn {\n\t\t\t\tlist: self.derive([document], ([value]) =>\n\t\t\t\t\tObject.entries(value.sessions).map(([id, { label, kind, principal, created, lastUsed }]) => ({\n\t\t\t\t\t\tid,\n\t\t\t\t\t\tlabel,\n\t\t\t\t\t\tkind,\n\t\t\t\t\t\t// Stored by `issue` as JSON text.\n\t\t\t\t\t\tprincipal: JSON.parse(principal) as JsonValue,\n\t\t\t\t\t\tcreated,\n\t\t\t\t\t\tlastUsed,\n\t\t\t\t\t})),\n\t\t\t\t),\n\t\t\t\tissue: async ({ principal, label, kind, secure }, ctx) => {\n\t\t\t\t\tconst id = newToken(12);\n\t\t\t\t\tconst secret = newToken(32);\n\t\t\t\t\tif (kind === \"ephemeral\") {\n\t\t\t\t\t\t// Principals are the app's: `issue`'s callers pass one of its type.\n\t\t\t\t\t\tephemeral.issue(id, hashToken(secret), principal as Principal);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst now = Date.now();\n\t\t\t\t\t\tconst stored = JSON.stringify(principal);\n\t\t\t\t\t\tawait document.change((draft) => {\n\t\t\t\t\t\t\tdraft.sessions[id] = {\n\t\t\t\t\t\t\t\thash: hashToken(secret),\n\t\t\t\t\t\t\t\tlabel,\n\t\t\t\t\t\t\t\tkind,\n\t\t\t\t\t\t\t\tprincipal: stored,\n\t\t\t\t\t\t\t\tcreated: now,\n\t\t\t\t\t\t\t\tlastUsed: now,\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t}, ctx);\n\t\t\t\t\t}\n\t\t\t\t\tconst token = `${id}.${secret}`;\n\t\t\t\t\t// Only whether the browser is remote matters to the cookie (`Secure`).\n\t\t\t\t\tconst provenance: Provenance = secure === true ? { kind: \"remote\", host: \"\" } : { kind: \"local\" };\n\t\t\t\t\tconst set = sessionCookie(token, kind, { provenance }, cookieSecret);\n\t\t\t\t\treturn { id, token, cookie: set };\n\t\t\t\t},\n\t\t\t\tverify: async (token, ctx) => (authenticate(token, ctx) as JsonValue | undefined) ?? null,\n\t\t\t\trevoke: async (id, ctx) => {\n\t\t\t\t\tif (ephemeral.revoke(id)) return null;\n\t\t\t\t\tawait document.change((draft) => {\n\t\t\t\t\t\tdelete draft.sessions[id];\n\t\t\t\t\t}, ctx);\n\t\t\t\t\treturn null;\n\t\t\t\t},\n\t\t\t};\n\t\t}),\n\t);\n}\n\n/**\n * The session cookie carrying `token` (a session of `kind`) for a browser of `request`'s provenance: a persisted\n * session's lives as long as the session does unused (400 days, renewed by `rollingCookie`), an ephemeral one's only\n * while the browser runs.\n */\nfunction sessionCookie(\n\ttoken: string,\n\tkind: SessionKind,\n\trequest: Pick<HttpRequest, \"provenance\">,\n\tsecret: string,\n): string {\n\tconst maxAge = kind === \"ephemeral\" ? undefined : SESSION_IDLE_MS / 1000;\n\treturn cookie(SESSION_COOKIE, token, { secret, request, maxAge });\n}\n\n/** How old a session cookie gets before a response renews it: a day. */\nconst ROLL_MS = 24 * 60 * 60_000;\n\n/**\n * The wrap around every route renewing the session cookie a request signed in with once it is older than a day: the\n * response sets it again with a fresh signed expiry, so a browser used within every 400 days stays signed in. Not when\n * the route sets a cookie itself, nor for an ephemeral session's (it has no expiry) or a token that no longer\n * authenticates.\n */\nfunction rollingCookie(\n\tsecret: string,\n\tauthenticate: (token: string, context: Context) => Principal | undefined,\n): HttpWrap {\n\treturn {\n\t\tname: \"chord.app.rolling-cookie\",\n\t\tphase: \"headers\",\n\t\tscope: \"all\",\n\t\twrap: async (request, next, ctx) => {\n\t\t\tconst response = await next(request);\n\t\t\tif (ctx.principal === undefined || Object.keys(response.headers ?? {}).some(isSetCookie)) return response;\n\t\t\tconst signed = readSignedCookie(request, SESSION_COOKIE, secret);\n\t\t\tif (signed?.expires === undefined || signed.expires - Date.now() > SESSION_IDLE_MS - ROLL_MS) return response;\n\t\t\tif (authenticate(signed.value, ctx) === undefined) return response;\n\t\t\tconst renewed = sessionCookie(signed.value, \"browser\", request, secret);\n\t\t\treturn { ...response, headers: { ...response.headers, \"Set-Cookie\": renewed } };\n\t\t},\n\t};\n}\n\n/** Whether a header name is `Set-Cookie` (any case). */\nfunction isSetCookie(name: string): boolean {\n\treturn name.toLowerCase() === \"set-cookie\";\n}\n\n/** The token of an `Authorization: Bearer <token>` header. */\nfunction bearerToken(request: HttpRequest): string | undefined {\n\tconst header = request.headers.get(\"authorization\");\n\tconst match = header === null ? null : /^Bearer\\s+(\\S+)$/i.exec(header);\n\treturn match?.[1];\n}\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** One entry to write: its path (`/`-separated, relative) and its bytes, as a size and the chunks that make it up. */
|
|
2
|
+
export type TarEntry = {
|
|
3
|
+
readonly path: string;
|
|
4
|
+
readonly size: number;
|
|
5
|
+
readonly data: AsyncIterable<Uint8Array>;
|
|
6
|
+
};
|
|
7
|
+
/** One entry read: a regular file (its data, to be consumed before the next entry) or a directory. */
|
|
8
|
+
export type TarRead = {
|
|
9
|
+
readonly kind: "file";
|
|
10
|
+
readonly path: string;
|
|
11
|
+
readonly size: number;
|
|
12
|
+
readonly data: AsyncIterable<Uint8Array>;
|
|
13
|
+
} | {
|
|
14
|
+
readonly kind: "directory";
|
|
15
|
+
readonly path: string;
|
|
16
|
+
};
|
|
17
|
+
/** The archive of `entries`, as the chunks of its bytes (two zero blocks end it). */
|
|
18
|
+
export declare function writeTar(entries: AsyncIterable<TarEntry> | Iterable<TarEntry>): AsyncGenerator<Uint8Array>;
|
|
19
|
+
/**
|
|
20
|
+
* Reads the archive `source` entry by entry (each file's data read fully before the next entry is asked for), refusing
|
|
21
|
+
* what it may not hold (see the file's header).
|
|
22
|
+
*/
|
|
23
|
+
export declare function readTar(source: AsyncIterable<Uint8Array>): AsyncGenerator<TarRead>;
|
|
24
|
+
//# sourceMappingURL=tar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tar.d.ts","sourceRoot":"","sources":["../../../src/node/app/tar.ts"],"names":[],"mappings":"AAKA,sHAAsH;AACtH,MAAM,MAAM,QAAQ,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC,UAAU,CAAC,CAAA;CAAE,CAAC;AAElH,sGAAsG;AACtG,MAAM,MAAM,OAAO,GAChB;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC,UAAU,CAAC,CAAA;CAAE,GACjH;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAKzD,qFAAqF;AACrF,wBAAuB,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC,GAAG,cAAc,CAAC,UAAU,CAAC,CAcjH;AAuDD;;;GAGG;AACH,wBAAuB,OAAO,CAAC,MAAM,EAAE,aAAa,CAAC,UAAU,CAAC,GAAG,cAAc,CAAC,OAAO,CAAC,CA0BzF"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
// A minimal ustar (POSIX tar) writer and reader for the kit's address archives (slice 13 §4): regular files and
|
|
2
|
+
// directories, paths of at most 255 bytes, nothing else. The reader is a trust boundary: an archive may come from
|
|
3
|
+
// anywhere, so it refuses every entry that is no regular file or directory, a path that is absolute, holds `..`, a
|
|
4
|
+
// backslash or NUL, or names an empty segment, and a header whose checksum does not hold.
|
|
5
|
+
/** A tar block. */
|
|
6
|
+
const BLOCK = 512;
|
|
7
|
+
/** The archive of `entries`, as the chunks of its bytes (two zero blocks end it). */
|
|
8
|
+
export async function* writeTar(entries) {
|
|
9
|
+
for await (const entry of entries) {
|
|
10
|
+
yield header(entry.path, entry.size);
|
|
11
|
+
let written = 0;
|
|
12
|
+
for await (const chunk of entry.data) {
|
|
13
|
+
written += chunk.length;
|
|
14
|
+
if (written > entry.size)
|
|
15
|
+
throw new Error(`tar: ${entry.path} is larger than its size ${entry.size}`);
|
|
16
|
+
yield chunk;
|
|
17
|
+
}
|
|
18
|
+
if (written !== entry.size)
|
|
19
|
+
throw new Error(`tar: ${entry.path} is ${written} bytes, not ${entry.size}`);
|
|
20
|
+
const pad = (BLOCK - (entry.size % BLOCK)) % BLOCK;
|
|
21
|
+
if (pad > 0)
|
|
22
|
+
yield new Uint8Array(pad);
|
|
23
|
+
}
|
|
24
|
+
yield new Uint8Array(BLOCK * 2);
|
|
25
|
+
}
|
|
26
|
+
/** The ustar header of a regular file at `path` of `size` bytes. */
|
|
27
|
+
function header(path, size) {
|
|
28
|
+
checkPath(path);
|
|
29
|
+
const block = new Uint8Array(BLOCK);
|
|
30
|
+
const bytes = new TextEncoder().encode(path);
|
|
31
|
+
let name = bytes;
|
|
32
|
+
let prefix = new Uint8Array();
|
|
33
|
+
if (bytes.length > 100) {
|
|
34
|
+
// Split at a `/` so the name has at most 100 bytes and the prefix at most 155.
|
|
35
|
+
const at = path.lastIndexOf("/", path.length - 1);
|
|
36
|
+
const split = new TextEncoder().encode(path.slice(0, at)).length;
|
|
37
|
+
if (at < 0 || split > 155 || bytes.length - split - 1 > 100)
|
|
38
|
+
throw new Error(`tar: the path ${path} is too long`);
|
|
39
|
+
prefix = bytes.subarray(0, split);
|
|
40
|
+
name = bytes.subarray(split + 1);
|
|
41
|
+
}
|
|
42
|
+
block.set(name, 0);
|
|
43
|
+
field(block, 100, 8, "0000644");
|
|
44
|
+
field(block, 108, 8, "0000000");
|
|
45
|
+
field(block, 116, 8, "0000000");
|
|
46
|
+
field(block, 124, 12, size.toString(8).padStart(11, "0"));
|
|
47
|
+
field(block, 136, 12, Math.floor(Date.now() / 1000)
|
|
48
|
+
.toString(8)
|
|
49
|
+
.padStart(11, "0"));
|
|
50
|
+
block.fill(0x20, 148, 156);
|
|
51
|
+
block[156] = 0x30;
|
|
52
|
+
block.set(new TextEncoder().encode("ustar\u000000"), 257);
|
|
53
|
+
block.set(prefix, 345);
|
|
54
|
+
const sum = block.reduce((total, byte) => total + byte, 0);
|
|
55
|
+
field(block, 148, 8, `${sum.toString(8).padStart(6, "0")}\u0000 `);
|
|
56
|
+
return block;
|
|
57
|
+
}
|
|
58
|
+
/** Writes `text` (ASCII) at `offset` of `block`, NUL-terminated within `length`. */
|
|
59
|
+
function field(block, offset, length, text) {
|
|
60
|
+
const bytes = new TextEncoder().encode(text);
|
|
61
|
+
if (bytes.length > length)
|
|
62
|
+
throw new Error(`tar: ${text} does not fit ${length} bytes`);
|
|
63
|
+
block.set(bytes, offset);
|
|
64
|
+
}
|
|
65
|
+
/** Refuses a path an archive may not hold: absolute, with `..`, `.`, an empty segment, a backslash or a NUL. */
|
|
66
|
+
function checkPath(path) {
|
|
67
|
+
const segments = path.split("/");
|
|
68
|
+
const bad = path === "" || path.includes("\\") || path.includes("\u0000") || path.startsWith("/");
|
|
69
|
+
if (bad || segments.some((segment) => segment === "" || segment === "." || segment === "..")) {
|
|
70
|
+
throw new Error(`tar: the path ${JSON.stringify(path)} is refused`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Reads the archive `source` entry by entry (each file's data read fully before the next entry is asked for), refusing
|
|
75
|
+
* what it may not hold (see the file's header).
|
|
76
|
+
*/
|
|
77
|
+
export async function* readTar(source) {
|
|
78
|
+
const reader = new ByteReader(source);
|
|
79
|
+
for (;;) {
|
|
80
|
+
const block = await reader.read(BLOCK);
|
|
81
|
+
if (block.length < BLOCK)
|
|
82
|
+
throw new Error("tar: the archive ends inside a header");
|
|
83
|
+
if (block.every((byte) => byte === 0))
|
|
84
|
+
return;
|
|
85
|
+
const { path, size, type } = parseHeader(block);
|
|
86
|
+
const padded = Math.ceil(size / BLOCK) * BLOCK;
|
|
87
|
+
if (type === "directory") {
|
|
88
|
+
yield { kind: "directory", path };
|
|
89
|
+
await reader.skip(padded);
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
let left = size;
|
|
93
|
+
const data = (async function* () {
|
|
94
|
+
while (left > 0) {
|
|
95
|
+
const chunk = await reader.read(Math.min(left, 64 * 1024));
|
|
96
|
+
if (chunk.length === 0)
|
|
97
|
+
throw new Error(`tar: the archive ends inside ${path}`);
|
|
98
|
+
left -= chunk.length;
|
|
99
|
+
yield chunk;
|
|
100
|
+
}
|
|
101
|
+
})();
|
|
102
|
+
yield { kind: "file", path, size, data };
|
|
103
|
+
// What the consumer left unread (also when it ended the data's iteration early), then the padding.
|
|
104
|
+
await reader.skip(left + padded - size);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
/** A header's path, size and type, its checksum checked; anything but a regular file or a directory refused. */
|
|
108
|
+
function parseHeader(block) {
|
|
109
|
+
const stored = Number.parseInt(text(block, 148, 8).trim(), 8);
|
|
110
|
+
let sum = 0;
|
|
111
|
+
for (let index = 0; index < BLOCK; index++)
|
|
112
|
+
sum += index >= 148 && index < 156 ? 0x20 : block[index];
|
|
113
|
+
if (stored !== sum)
|
|
114
|
+
throw new Error("tar: a header's checksum does not hold");
|
|
115
|
+
const flag = String.fromCharCode(block[156]);
|
|
116
|
+
const type = flag === "0" || flag === "\u0000" ? "file" : flag === "5" ? "directory" : undefined;
|
|
117
|
+
if (type === undefined)
|
|
118
|
+
throw new Error(`tar: an entry of type ${JSON.stringify(flag)} is refused (files only)`);
|
|
119
|
+
const prefix = text(block, 345, 155);
|
|
120
|
+
const name = text(block, 0, 100);
|
|
121
|
+
const path = (prefix === "" ? name : `${prefix}/${name}`).replace(/\/$/, "");
|
|
122
|
+
checkPath(path);
|
|
123
|
+
const size = Number.parseInt(text(block, 124, 12).trim() || "0", 8);
|
|
124
|
+
if (!Number.isSafeInteger(size) || size < 0)
|
|
125
|
+
throw new Error(`tar: ${path} has no valid size`);
|
|
126
|
+
return { path, size: type === "directory" ? 0 : size, type };
|
|
127
|
+
}
|
|
128
|
+
/** The NUL-terminated text of a header field. */
|
|
129
|
+
function text(block, offset, length) {
|
|
130
|
+
const bytes = block.subarray(offset, offset + length);
|
|
131
|
+
const end = bytes.indexOf(0);
|
|
132
|
+
return new TextDecoder().decode(end < 0 ? bytes : bytes.subarray(0, end));
|
|
133
|
+
}
|
|
134
|
+
/** Reads exactly as many bytes as asked from a stream of chunks (fewer only at its end). */
|
|
135
|
+
class ByteReader {
|
|
136
|
+
#source;
|
|
137
|
+
#buffer = new Uint8Array();
|
|
138
|
+
constructor(source) {
|
|
139
|
+
this.#source = source[Symbol.asyncIterator]();
|
|
140
|
+
}
|
|
141
|
+
/** Up to `length` bytes: `length` unless the stream ends first. */
|
|
142
|
+
async read(length) {
|
|
143
|
+
while (this.#buffer.length < length) {
|
|
144
|
+
const next = await this.#source.next();
|
|
145
|
+
if (next.done === true)
|
|
146
|
+
break;
|
|
147
|
+
const joined = new Uint8Array(this.#buffer.length + next.value.length);
|
|
148
|
+
joined.set(this.#buffer);
|
|
149
|
+
joined.set(next.value, this.#buffer.length);
|
|
150
|
+
this.#buffer = joined;
|
|
151
|
+
}
|
|
152
|
+
const taken = this.#buffer.subarray(0, Math.min(length, this.#buffer.length));
|
|
153
|
+
this.#buffer = this.#buffer.subarray(taken.length);
|
|
154
|
+
return taken;
|
|
155
|
+
}
|
|
156
|
+
/** Skips `length` bytes. */
|
|
157
|
+
async skip(length) {
|
|
158
|
+
let left = length;
|
|
159
|
+
while (left > 0) {
|
|
160
|
+
const skipped = await this.read(Math.min(left, 64 * 1024));
|
|
161
|
+
if (skipped.length === 0)
|
|
162
|
+
throw new Error("tar: the archive ends early");
|
|
163
|
+
left -= skipped.length;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
//# sourceMappingURL=tar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tar.js","sourceRoot":"","sources":["../../../src/node/app/tar.ts"],"names":[],"mappings":"AAAA,gHAAgH;AAChH,kHAAkH;AAClH,mHAAmH;AACnH,0FAA0F;AAU1F,mBAAmB;AACnB,MAAM,KAAK,GAAG,GAAG,CAAC;AAElB,qFAAqF;AACrF,MAAM,CAAC,KAAK,SAAS,CAAC,CAAC,QAAQ,CAAC,OAAqD;IACpF,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QACnC,MAAM,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;QACrC,IAAI,OAAO,GAAG,CAAC,CAAC;QAChB,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC;YACtC,OAAO,IAAI,KAAK,CAAC,MAAM,CAAC;YACxB,IAAI,OAAO,GAAG,KAAK,CAAC,IAAI;gBAAE,MAAM,I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IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;YACzE,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC;QACxB,CAAC;IACF,CAAC;CACD","sourcesContent":["// A minimal ustar (POSIX tar) writer and reader for the kit's address archives (slice 13 §4): regular files and\n// directories, paths of at most 255 bytes, nothing else. The reader is a trust boundary: an archive may come from\n// anywhere, so it refuses every entry that is no regular file or directory, a path that is absolute, holds `..`, a\n// backslash or NUL, or names an empty segment, and a header whose checksum does not hold.\n\n/** One entry to write: its path (`/`-separated, relative) and its bytes, as a size and the chunks that make it up. */\nexport type TarEntry = { readonly path: string; readonly size: number; readonly data: AsyncIterable<Uint8Array> };\n\n/** One entry read: a regular file (its data, to be consumed before the next entry) or a directory. */\nexport type TarRead =\n\t| { readonly kind: \"file\"; readonly path: string; readonly size: number; readonly data: AsyncIterable<Uint8Array> }\n\t| { readonly kind: \"directory\"; readonly path: string };\n\n/** A tar block. */\nconst BLOCK = 512;\n\n/** The archive of `entries`, as the chunks of its bytes (two zero blocks end it). */\nexport async function* writeTar(entries: AsyncIterable<TarEntry> | Iterable<TarEntry>): AsyncGenerator<Uint8Array> {\n\tfor await (const entry of entries) {\n\t\tyield header(entry.path, entry.size);\n\t\tlet written = 0;\n\t\tfor await (const chunk of entry.data) {\n\t\t\twritten += chunk.length;\n\t\t\tif (written > entry.size) throw new Error(`tar: ${entry.path} is larger than its size ${entry.size}`);\n\t\t\tyield chunk;\n\t\t}\n\t\tif (written !== entry.size) throw new Error(`tar: ${entry.path} is ${written} bytes, not ${entry.size}`);\n\t\tconst pad = (BLOCK - (entry.size % BLOCK)) % BLOCK;\n\t\tif (pad > 0) yield new Uint8Array(pad);\n\t}\n\tyield new Uint8Array(BLOCK * 2);\n}\n\n/** The ustar header of a regular file at `path` of `size` bytes. */\nfunction header(path: string, size: number): Uint8Array {\n\tcheckPath(path);\n\tconst block = new Uint8Array(BLOCK);\n\tconst bytes = new TextEncoder().encode(path);\n\tlet name = bytes;\n\tlet prefix = new Uint8Array();\n\tif (bytes.length > 100) {\n\t\t// Split at a `/` so the name has at most 100 bytes and the prefix at most 155.\n\t\tconst at = path.lastIndexOf(\"/\", path.length - 1);\n\t\tconst split = new TextEncoder().encode(path.slice(0, at)).length;\n\t\tif (at < 0 || split > 155 || bytes.length - split - 1 > 100) throw new Error(`tar: the path ${path} is too long`);\n\t\tprefix = bytes.subarray(0, split);\n\t\tname = bytes.subarray(split + 1);\n\t}\n\tblock.set(name, 0);\n\tfield(block, 100, 8, \"0000644\");\n\tfield(block, 108, 8, \"0000000\");\n\tfield(block, 116, 8, \"0000000\");\n\tfield(block, 124, 12, size.toString(8).padStart(11, \"0\"));\n\tfield(\n\t\tblock,\n\t\t136,\n\t\t12,\n\t\tMath.floor(Date.now() / 1000)\n\t\t\t.toString(8)\n\t\t\t.padStart(11, \"0\"),\n\t);\n\tblock.fill(0x20, 148, 156);\n\tblock[156] = 0x30;\n\tblock.set(new TextEncoder().encode(\"ustar\\u000000\"), 257);\n\tblock.set(prefix, 345);\n\tconst sum = block.reduce((total, byte) => total + byte, 0);\n\tfield(block, 148, 8, `${sum.toString(8).padStart(6, \"0\")}\\u0000 `);\n\treturn block;\n}\n\n/** Writes `text` (ASCII) at `offset` of `block`, NUL-terminated within `length`. */\nfunction field(block: Uint8Array, offset: number, length: number, text: string): void {\n\tconst bytes = new TextEncoder().encode(text);\n\tif (bytes.length > length) throw new Error(`tar: ${text} does not fit ${length} bytes`);\n\tblock.set(bytes, offset);\n}\n\n/** Refuses a path an archive may not hold: absolute, with `..`, `.`, an empty segment, a backslash or a NUL. */\nfunction checkPath(path: string): void {\n\tconst segments = path.split(\"/\");\n\tconst bad = path === \"\" || path.includes(\"\\\\\") || path.includes(\"\\u0000\") || path.startsWith(\"/\");\n\tif (bad || segments.some((segment) => segment === \"\" || segment === \".\" || segment === \"..\")) {\n\t\tthrow new Error(`tar: the path ${JSON.stringify(path)} is refused`);\n\t}\n}\n\n/**\n * Reads the archive `source` entry by entry (each file's data read fully before the next entry is asked for), refusing\n * what it may not hold (see the file's header).\n */\nexport async function* readTar(source: AsyncIterable<Uint8Array>): AsyncGenerator<TarRead> {\n\tconst reader = new ByteReader(source);\n\tfor (;;) {\n\t\tconst block = await reader.read(BLOCK);\n\t\tif (block.length < BLOCK) throw new Error(\"tar: the archive ends inside a header\");\n\t\tif (block.every((byte) => byte === 0)) return;\n\t\tconst { path, size, type } = parseHeader(block);\n\t\tconst padded = Math.ceil(size / BLOCK) * BLOCK;\n\t\tif (type === \"directory\") {\n\t\t\tyield { kind: \"directory\", path };\n\t\t\tawait reader.skip(padded);\n\t\t\tcontinue;\n\t\t}\n\t\tlet left = size;\n\t\tconst data = (async function* () {\n\t\t\twhile (left > 0) {\n\t\t\t\tconst chunk = await reader.read(Math.min(left, 64 * 1024));\n\t\t\t\tif (chunk.length === 0) throw new Error(`tar: the archive ends inside ${path}`);\n\t\t\t\tleft -= chunk.length;\n\t\t\t\tyield chunk;\n\t\t\t}\n\t\t})();\n\t\tyield { kind: \"file\", path, size, data };\n\t\t// What the consumer left unread (also when it ended the data's iteration early), then the padding.\n\t\tawait reader.skip(left + padded - size);\n\t}\n}\n\n/** A header's path, size and type, its checksum checked; anything but a regular file or a directory refused. */\nfunction parseHeader(block: Uint8Array): {\n\treadonly path: string;\n\treadonly size: number;\n\treadonly type: \"file\" | \"directory\";\n} {\n\tconst stored = Number.parseInt(text(block, 148, 8).trim(), 8);\n\tlet sum = 0;\n\tfor (let index = 0; index < BLOCK; index++) sum += index >= 148 && index < 156 ? 0x20 : block[index]!;\n\tif (stored !== sum) throw new Error(\"tar: a header's checksum does not hold\");\n\tconst flag = String.fromCharCode(block[156]!);\n\tconst type = flag === \"0\" || flag === \"\\u0000\" ? \"file\" : flag === \"5\" ? \"directory\" : undefined;\n\tif (type === undefined) throw new Error(`tar: an entry of type ${JSON.stringify(flag)} is refused (files only)`);\n\tconst prefix = text(block, 345, 155);\n\tconst name = text(block, 0, 100);\n\tconst path = (prefix === \"\" ? name : `${prefix}/${name}`).replace(/\\/$/, \"\");\n\tcheckPath(path);\n\tconst size = Number.parseInt(text(block, 124, 12).trim() || \"0\", 8);\n\tif (!Number.isSafeInteger(size) || size < 0) throw new Error(`tar: ${path} has no valid size`);\n\treturn { path, size: type === \"directory\" ? 0 : size, type };\n}\n\n/** The NUL-terminated text of a header field. */\nfunction text(block: Uint8Array, offset: number, length: number): string {\n\tconst bytes = block.subarray(offset, offset + length);\n\tconst end = bytes.indexOf(0);\n\treturn new TextDecoder().decode(end < 0 ? bytes : bytes.subarray(0, end));\n}\n\n/** Reads exactly as many bytes as asked from a stream of chunks (fewer only at its end). */\nclass ByteReader {\n\treadonly #source: AsyncIterator<Uint8Array>;\n\t#buffer = new Uint8Array();\n\n\tconstructor(source: AsyncIterable<Uint8Array>) {\n\t\tthis.#source = source[Symbol.asyncIterator]();\n\t}\n\n\t/** Up to `length` bytes: `length` unless the stream ends first. */\n\tasync read(length: number): Promise<Uint8Array> {\n\t\twhile (this.#buffer.length < length) {\n\t\t\tconst next = await this.#source.next();\n\t\t\tif (next.done === true) break;\n\t\t\tconst joined = new Uint8Array(this.#buffer.length + next.value.length);\n\t\t\tjoined.set(this.#buffer);\n\t\t\tjoined.set(next.value, this.#buffer.length);\n\t\t\tthis.#buffer = joined;\n\t\t}\n\t\tconst taken = this.#buffer.subarray(0, Math.min(length, this.#buffer.length));\n\t\tthis.#buffer = this.#buffer.subarray(taken.length);\n\t\treturn taken;\n\t}\n\n\t/** Skips `length` bytes. */\n\tasync skip(length: number): Promise<void> {\n\t\tlet left = length;\n\t\twhile (left > 0) {\n\t\t\tconst skipped = await this.read(Math.min(left, 64 * 1024));\n\t\t\tif (skipped.length === 0) throw new Error(\"tar: the archive ends early\");\n\t\t\tleft -= skipped.length;\n\t\t}\n\t}\n}\n"]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** A finished upload: what it was begun with and its size, its bytes moved to the path `finish` was given. */
|
|
2
|
+
export type Finished<T> = {
|
|
3
|
+
readonly data: T;
|
|
4
|
+
readonly size: number;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* The uploads under way of one `Files` object, in the directory `run` (this object's own, made on first use), at most
|
|
8
|
+
* `max` at once: each holds a file handle until it ends, so a caller beginning uploads without end would exhaust the
|
|
9
|
+
* process's descriptors. Each carries its owner's `T` (what the file becomes when it finishes).
|
|
10
|
+
*/
|
|
11
|
+
export declare class Uploads<T> {
|
|
12
|
+
#private;
|
|
13
|
+
constructor(run: string, max: number);
|
|
14
|
+
/** The bytes accepted by every upload under way (they count against the host's cap). */
|
|
15
|
+
get size(): number;
|
|
16
|
+
/** The id of the upload under way whose data `matches`, if any. */
|
|
17
|
+
find(matches: (data: T) => boolean): string | undefined;
|
|
18
|
+
/** A new upload carrying `data`: its id; `unavailable` (`busy`) while `max` are under way. */
|
|
19
|
+
begin(data: T): Promise<string>;
|
|
20
|
+
/**
|
|
21
|
+
* Writes `bytes` at `offset` of upload `id`, which must be where the accepted appends reached (else `invalid`, its
|
|
22
|
+
* details the expected `{ offset }`); `room(adding, fileSize)` refuses what the caps do not allow, before anything
|
|
23
|
+
* is accepted. A failed write ends the upload.
|
|
24
|
+
*/
|
|
25
|
+
append(id: string, offset: number, bytes: Uint8Array, room: (adding: number, fileSize: number) => void): Promise<void>;
|
|
26
|
+
/** The bytes of upload `id` written so far, once its writes in flight landed: where a writer resumes. */
|
|
27
|
+
uploaded(id: string): Promise<number>;
|
|
28
|
+
/** Ends upload `id` once its writes landed and moves its file to `path`; refused when a write of it failed. */
|
|
29
|
+
finish(id: string, path: string): Promise<Finished<T>>;
|
|
30
|
+
/** Drops upload `id` once its writes landed (an unknown one: nothing): its writer gave up. */
|
|
31
|
+
cancel(id: string): Promise<void>;
|
|
32
|
+
/** Drops the uploads unwritten for `idleMs`, once their writes landed. */
|
|
33
|
+
expire(idleMs: number): Promise<void>;
|
|
34
|
+
/** Drops every upload under way (their object ended). */
|
|
35
|
+
close(): Promise<void>;
|
|
36
|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,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAK1C;IAED,yDAAyD;IACnD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAE3B;CAqBD"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
// Chunked uploads of one `Files` object (slice 13 §4, design §23 "Chunked transfers"): each upload one file handle in
|
|
2
|
+
// the run's directory, written at positions. An append is accepted at the offset the accepted appends reached, so a
|
|
3
|
+
// writer may send several without waiting (the call window allows it): each write lands at its own position whatever
|
|
4
|
+
// order the thread pool completes them in. `uploaded`, `finish` and expiry wait for an upload's writes in flight; a
|
|
5
|
+
// failed write ends its upload.
|
|
6
|
+
import { mkdir, open, rename, rm } from "node:fs/promises";
|
|
7
|
+
import { join } from "node:path";
|
|
8
|
+
import { ChordError } from "../../data/index.js";
|
|
9
|
+
import { invalid } from "../../data/internal.js";
|
|
10
|
+
import { newToken } from "./secrets.js";
|
|
11
|
+
/**
|
|
12
|
+
* The uploads under way of one `Files` object, in the directory `run` (this object's own, made on first use), at most
|
|
13
|
+
* `max` at once: each holds a file handle until it ends, so a caller beginning uploads without end would exhaust the
|
|
14
|
+
* process's descriptors. Each carries its owner's `T` (what the file becomes when it finishes).
|
|
15
|
+
*/
|
|
16
|
+
export class Uploads {
|
|
17
|
+
#run;
|
|
18
|
+
#max;
|
|
19
|
+
#uploads = new Map();
|
|
20
|
+
constructor(run, max) {
|
|
21
|
+
this.#run = run;
|
|
22
|
+
this.#max = max;
|
|
23
|
+
}
|
|
24
|
+
/** The bytes accepted by every upload under way (they count against the host's cap). */
|
|
25
|
+
get size() {
|
|
26
|
+
let size = 0;
|
|
27
|
+
for (const upload of this.#uploads.values())
|
|
28
|
+
size += upload.size;
|
|
29
|
+
return size;
|
|
30
|
+
}
|
|
31
|
+
/** The id of the upload under way whose data `matches`, if any. */
|
|
32
|
+
find(matches) {
|
|
33
|
+
for (const [id, upload] of this.#uploads)
|
|
34
|
+
if (matches(upload.data))
|
|
35
|
+
return id;
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
/** A new upload carrying `data`: its id; `unavailable` (`busy`) while `max` are under way. */
|
|
39
|
+
async begin(data) {
|
|
40
|
+
if (this.#uploads.size >= this.#max) {
|
|
41
|
+
throw new ChordError({
|
|
42
|
+
code: "unavailable",
|
|
43
|
+
reason: "busy",
|
|
44
|
+
message: `files: ${this.#max} uploads are under way; finish one, or wait for an idle one to expire`,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
const id = newToken(12);
|
|
48
|
+
await mkdir(this.#run, { recursive: true, mode: 0o700 });
|
|
49
|
+
const handle = await open(join(this.#run, id), "wx", 0o600);
|
|
50
|
+
const upload = {
|
|
51
|
+
data,
|
|
52
|
+
handle,
|
|
53
|
+
size: 0,
|
|
54
|
+
touched: Date.now(),
|
|
55
|
+
writes: new Set(),
|
|
56
|
+
failed: false,
|
|
57
|
+
ended: undefined,
|
|
58
|
+
};
|
|
59
|
+
this.#uploads.set(id, upload);
|
|
60
|
+
return id;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Writes `bytes` at `offset` of upload `id`, which must be where the accepted appends reached (else `invalid`, its
|
|
64
|
+
* details the expected `{ offset }`); `room(adding, fileSize)` refuses what the caps do not allow, before anything
|
|
65
|
+
* is accepted. A failed write ends the upload.
|
|
66
|
+
*/
|
|
67
|
+
async append(id, offset, bytes, room) {
|
|
68
|
+
const upload = this.#underway(id);
|
|
69
|
+
if (offset !== upload.size) {
|
|
70
|
+
throw invalid("args", `files: upload ${id} is at offset ${upload.size}, not ${offset}`, {
|
|
71
|
+
offset: upload.size,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
room(bytes.length, upload.size + bytes.length);
|
|
75
|
+
// Accepted now, with no await before the write starts: the next append may follow at once, its write going to
|
|
76
|
+
// its own position.
|
|
77
|
+
upload.size += bytes.length;
|
|
78
|
+
upload.touched = Date.now();
|
|
79
|
+
const write = upload.handle.write(bytes, 0, bytes.length, offset);
|
|
80
|
+
upload.writes.add(write);
|
|
81
|
+
try {
|
|
82
|
+
await write;
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
upload.writes.delete(write);
|
|
86
|
+
if (!upload.failed) {
|
|
87
|
+
upload.failed = true;
|
|
88
|
+
this.#uploads.delete(id);
|
|
89
|
+
await this.#end(upload);
|
|
90
|
+
await rm(join(this.#run, id), { force: true });
|
|
91
|
+
}
|
|
92
|
+
throw error;
|
|
93
|
+
}
|
|
94
|
+
upload.writes.delete(write);
|
|
95
|
+
}
|
|
96
|
+
/** The bytes of upload `id` written so far, once its writes in flight landed: where a writer resumes. */
|
|
97
|
+
async uploaded(id) {
|
|
98
|
+
const upload = this.#underway(id);
|
|
99
|
+
await Promise.allSettled([...upload.writes]);
|
|
100
|
+
if (upload.failed)
|
|
101
|
+
throw failedUpload(id);
|
|
102
|
+
return upload.size;
|
|
103
|
+
}
|
|
104
|
+
/** Ends upload `id` once its writes landed and moves its file to `path`; refused when a write of it failed. */
|
|
105
|
+
async finish(id, path) {
|
|
106
|
+
const upload = this.#underway(id);
|
|
107
|
+
// Taken out first: an append arriving now finds no upload.
|
|
108
|
+
this.#uploads.delete(id);
|
|
109
|
+
await this.#end(upload);
|
|
110
|
+
if (upload.failed)
|
|
111
|
+
throw failedUpload(id);
|
|
112
|
+
await rename(join(this.#run, id), path);
|
|
113
|
+
return { data: upload.data, size: upload.size };
|
|
114
|
+
}
|
|
115
|
+
/** Drops upload `id` once its writes landed (an unknown one: nothing): its writer gave up. */
|
|
116
|
+
async cancel(id) {
|
|
117
|
+
const upload = this.#uploads.get(id);
|
|
118
|
+
if (upload !== undefined)
|
|
119
|
+
await this.#discard(id, upload);
|
|
120
|
+
}
|
|
121
|
+
/** Drops the uploads unwritten for `idleMs`, once their writes landed. */
|
|
122
|
+
async expire(idleMs) {
|
|
123
|
+
const now = Date.now();
|
|
124
|
+
for (const [id, upload] of this.#uploads) {
|
|
125
|
+
if (now - upload.touched >= idleMs)
|
|
126
|
+
await this.#discard(id, upload);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
/** Drops every upload under way (their object ended). */
|
|
130
|
+
async close() {
|
|
131
|
+
for (const [id, upload] of this.#uploads)
|
|
132
|
+
await this.#discard(id, upload);
|
|
133
|
+
}
|
|
134
|
+
/** The upload `id` under way; else `invalid`. */
|
|
135
|
+
#underway(id) {
|
|
136
|
+
const upload = this.#uploads.get(id);
|
|
137
|
+
if (upload === undefined)
|
|
138
|
+
throw invalid("args", `files: no upload ${id} (finished, failed, expired or unknown)`);
|
|
139
|
+
return upload;
|
|
140
|
+
}
|
|
141
|
+
/** Takes upload `id` out, closes its file once its writes landed and removes it. */
|
|
142
|
+
async #discard(id, upload) {
|
|
143
|
+
this.#uploads.delete(id);
|
|
144
|
+
await this.#end(upload);
|
|
145
|
+
await rm(join(this.#run, id), { force: true });
|
|
146
|
+
}
|
|
147
|
+
/** Closes `upload`'s file once its writes in flight landed; once, whoever ends it first. */
|
|
148
|
+
#end(upload) {
|
|
149
|
+
upload.ended ??= Promise.allSettled([...upload.writes]).then(() => upload.handle.close());
|
|
150
|
+
return upload.ended;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
/** The refusal of an upload one of whose writes failed. */
|
|
154
|
+
function failedUpload(id) {
|
|
155
|
+
return invalid("args", `files: upload ${id} failed to write and was dropped`);
|
|
156
|
+
}
|
|
157
|
+
//# sourceMappingURL=uploads.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uploads.js","sourceRoot":"","sources":["../../../src/node/app/uploads.ts"],"names":[],"mappings":"AAAA,sHAAsH;AACtH,oHAAoH;AACpH,qHAAqH;AACrH,oHAAoH;AACpH,gCAAgC;AAGhC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,U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B,EAAE,yCAAyC,CAAC,CAAC;QACjH,OAAO,MAAM,CAAC;IACf,CAAC;IAED,oFAAoF;IACpF,KAAK,CAAC,QAAQ,CAAC,EAAU,EAAE,MAAiB;QAC3C,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACzB,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACxB,MAAM,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAChD,CAAC;IAED,4FAA4F;IAC5F,IAAI,CAAC,MAAiB;QACrB,MAAM,CAAC,KAAK,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;QAC1F,OAAO,MAAM,CAAC,KAAK,CAAC;IACrB,CAAC;CACD;AAED,2DAA2D;AAC3D,SAAS,YAAY,CAAC,EAAU;IAC/B,OAAO,OAAO,CAAC,MAAM,EAAE,iBAAiB,EAAE,kCAAkC,CAAC,CAAC;AAC/E,CAAC","sourcesContent":["// Chunked uploads of one `Files` object (slice 13 §4, design §23 \"Chunked transfers\"): each upload one file handle in\n// the run's directory, written at positions. An append is accepted at the offset the accepted appends reached, so a\n// writer may send several without waiting (the call window allows it): each write lands at its own position whatever\n// order the thread pool completes them in. `uploaded`, `finish` and expiry wait for an upload's writes in flight; a\n// failed write ends its upload.\n\nimport type { FileHandle } from \"node:fs/promises\";\nimport { mkdir, open, rename, rm } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport { ChordError } from \"../../data/index.ts\";\nimport { invalid } from \"../../data/internal.ts\";\nimport { newToken } from \"./secrets.ts\";\n\n/** An upload under way: its owner's data, its file, the bytes accepted, its writes in flight, its first failed write, its end. */\ntype Upload<T> = {\n\treadonly data: T;\n\treadonly handle: FileHandle;\n\tsize: number;\n\ttouched: number;\n\treadonly writes: Set<Promise<unknown>>;\n\tfailed: boolean;\n\tended: Promise<void> | undefined;\n};\n\n/** A finished upload: what it was begun with and its size, its bytes moved to the path `finish` was given. */\nexport type Finished<T> = { readonly data: T; readonly size: number };\n\n/**\n * The uploads under way of one `Files` object, in the directory `run` (this object's own, made on first use), at most\n * `max` at once: each holds a file handle until it ends, so a caller beginning uploads without end would exhaust the\n * process's descriptors. Each carries its owner's `T` (what the file becomes when it finishes).\n */\nexport class Uploads<T> {\n\treadonly #run: string;\n\treadonly #max: number;\n\treadonly #uploads = new Map<string, Upload<T>>();\n\n\tconstructor(run: string, max: number) {\n\t\tthis.#run = run;\n\t\tthis.#max = max;\n\t}\n\n\t/** The bytes accepted by every upload under way (they count against the host's cap). */\n\tget size(): number {\n\t\tlet size = 0;\n\t\tfor (const upload of this.#uploads.values()) size += upload.size;\n\t\treturn size;\n\t}\n\n\t/** The id of the upload under way whose data `matches`, if any. */\n\tfind(matches: (data: T) => boolean): string | undefined {\n\t\tfor (const [id, upload] of this.#uploads) if (matches(upload.data)) return id;\n\t\treturn undefined;\n\t}\n\n\t/** A new upload carrying `data`: its id; `unavailable` (`busy`) while `max` are under way. */\n\tasync begin(data: T): Promise<string> {\n\t\tif (this.#uploads.size >= this.#max) {\n\t\t\tthrow new ChordError({\n\t\t\t\tcode: \"unavailable\",\n\t\t\t\treason: \"busy\",\n\t\t\t\tmessage: `files: ${this.#max} uploads are under way; finish one, or wait for an idle one to expire`,\n\t\t\t});\n\t\t}\n\t\tconst id = newToken(12);\n\t\tawait mkdir(this.#run, { recursive: true, mode: 0o700 });\n\t\tconst handle = await open(join(this.#run, id), \"wx\", 0o600);\n\t\tconst upload: Upload<T> = {\n\t\t\tdata,\n\t\t\thandle,\n\t\t\tsize: 0,\n\t\t\ttouched: Date.now(),\n\t\t\twrites: new Set(),\n\t\t\tfailed: false,\n\t\t\tended: undefined,\n\t\t};\n\t\tthis.#uploads.set(id, upload);\n\t\treturn id;\n\t}\n\n\t/**\n\t * Writes `bytes` at `offset` of upload `id`, which must be where the accepted appends reached (else `invalid`, its\n\t * details the expected `{ offset }`); `room(adding, fileSize)` refuses what the caps do not allow, before anything\n\t * is accepted. A failed write ends the upload.\n\t */\n\tasync append(\n\t\tid: string,\n\t\toffset: number,\n\t\tbytes: Uint8Array,\n\t\troom: (adding: number, fileSize: number) => void,\n\t): Promise<void> {\n\t\tconst upload = this.#underway(id);\n\t\tif (offset !== upload.size) {\n\t\t\tthrow invalid(\"args\", `files: upload ${id} is at offset ${upload.size}, not ${offset}`, {\n\t\t\t\toffset: upload.size,\n\t\t\t});\n\t\t}\n\t\troom(bytes.length, upload.size + bytes.length);\n\t\t// Accepted now, with no await before the write starts: the next append may follow at once, its write going to\n\t\t// its own position.\n\t\tupload.size += bytes.length;\n\t\tupload.touched = Date.now();\n\t\tconst write = upload.handle.write(bytes, 0, bytes.length, offset);\n\t\tupload.writes.add(write);\n\t\ttry {\n\t\t\tawait write;\n\t\t} catch (error) {\n\t\t\tupload.writes.delete(write);\n\t\t\tif (!upload.failed) {\n\t\t\t\tupload.failed = true;\n\t\t\t\tthis.#uploads.delete(id);\n\t\t\t\tawait this.#end(upload);\n\t\t\t\tawait rm(join(this.#run, id), { force: true });\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t\tupload.writes.delete(write);\n\t}\n\n\t/** The bytes of upload `id` written so far, once its writes in flight landed: where a writer resumes. */\n\tasync uploaded(id: string): Promise<number> {\n\t\tconst upload = this.#underway(id);\n\t\tawait Promise.allSettled([...upload.writes]);\n\t\tif (upload.failed) throw failedUpload(id);\n\t\treturn upload.size;\n\t}\n\n\t/** Ends upload `id` once its writes landed and moves its file to `path`; refused when a write of it failed. */\n\tasync finish(id: string, path: string): Promise<Finished<T>> {\n\t\tconst upload = this.#underway(id);\n\t\t// Taken out first: an append arriving now finds no upload.\n\t\tthis.#uploads.delete(id);\n\t\tawait this.#end(upload);\n\t\tif (upload.failed) throw failedUpload(id);\n\t\tawait rename(join(this.#run, id), path);\n\t\treturn { data: upload.data, size: upload.size };\n\t}\n\n\t/** Drops upload `id` once its writes landed (an unknown one: nothing): its writer gave up. */\n\tasync cancel(id: string): Promise<void> {\n\t\tconst upload = this.#uploads.get(id);\n\t\tif (upload !== undefined) await this.#discard(id, upload);\n\t}\n\n\t/** Drops the uploads unwritten for `idleMs`, once their writes landed. */\n\tasync expire(idleMs: number): Promise<void> {\n\t\tconst now = Date.now();\n\t\tfor (const [id, upload] of this.#uploads) {\n\t\t\tif (now - upload.touched >= idleMs) await this.#discard(id, upload);\n\t\t}\n\t}\n\n\t/** Drops every upload under way (their object ended). */\n\tasync close(): Promise<void> {\n\t\tfor (const [id, upload] of this.#uploads) await this.#discard(id, upload);\n\t}\n\n\t/** The upload `id` under way; else `invalid`. */\n\t#underway(id: string): Upload<T> {\n\t\tconst upload = this.#uploads.get(id);\n\t\tif (upload === undefined) throw invalid(\"args\", `files: no upload ${id} (finished, failed, expired or unknown)`);\n\t\treturn upload;\n\t}\n\n\t/** Takes upload `id` out, closes its file once its writes landed and removes it. */\n\tasync #discard(id: string, upload: Upload<T>): Promise<void> {\n\t\tthis.#uploads.delete(id);\n\t\tawait this.#end(upload);\n\t\tawait rm(join(this.#run, id), { force: true });\n\t}\n\n\t/** Closes `upload`'s file once its writes in flight landed; once, whoever ends it first. */\n\t#end(upload: Upload<T>): Promise<void> {\n\t\tupload.ended ??= Promise.allSettled([...upload.writes]).then(() => upload.handle.close());\n\t\treturn upload.ended;\n\t}\n}\n\n/** The refusal of an upload one of whose writes failed. */\nfunction failedUpload(id: string): Error {\n\treturn invalid(\"args\", `files: upload ${id} failed to write and was dropped`);\n}\n"]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type Schema } from "../../contracts/index.ts";
|
|
2
|
+
import type { Principal } from "../../data/index.ts";
|
|
3
|
+
import { type Facet } from "../../host/index.ts";
|
|
4
|
+
import type { JsonValue } from "../../json.ts";
|
|
5
|
+
/** The users plugin for profiles of schema `profile`: its contract and the facet serving it on the server. */
|
|
6
|
+
export declare function defineUsers<T extends JsonValue, P extends Principal = Principal>(profile: Schema<T>): {
|
|
7
|
+
Users: import("../../contracts/contract.ts").Contract<{
|
|
8
|
+
kind: "local";
|
|
9
|
+
name: "chord.app.users";
|
|
10
|
+
params: {};
|
|
11
|
+
history: [{
|
|
12
|
+
version: "1";
|
|
13
|
+
variants: {
|
|
14
|
+
members: {
|
|
15
|
+
state: {
|
|
16
|
+
readonly list: Schema<{
|
|
17
|
+
id: string;
|
|
18
|
+
profile: unknown extends T ? T : T;
|
|
19
|
+
}[]>;
|
|
20
|
+
};
|
|
21
|
+
methods: {
|
|
22
|
+
readonly get: import("../../contracts/schema.ts").Method<import("../../contracts/schema.ts").StringSchema, Schema<(unknown extends T ? T : T) | null>>;
|
|
23
|
+
readonly update: import("../../contracts/schema.ts").Method<Schema<{
|
|
24
|
+
id: string;
|
|
25
|
+
profile: unknown extends T ? T : T;
|
|
26
|
+
}>, import("../../contracts/schema.ts").NullSchema>;
|
|
27
|
+
readonly remove: import("../../contracts/schema.ts").Method<import("../../contracts/schema.ts").StringSchema, import("../../contracts/schema.ts").NullSchema>;
|
|
28
|
+
};
|
|
29
|
+
keyed: {};
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
changes: never;
|
|
33
|
+
}];
|
|
34
|
+
}>;
|
|
35
|
+
facet: Facet<P>;
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=users.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"users.d.ts","sourceRoot":"","sources":["../../../src/node/app/users.ts"],"names":[],"mappings":"AAOA,OAAO,EAAqC,KAAK,MAAM,EAAc,MAAM,0BAA0B,CAAC;AACtG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGrD,OAAO,EAAe,KAAK,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE/C,8GAA8G;AAC9G,wBAAgB,WAAW,CAAC,CAAC,SAAS,SAAS,EAAE,CAAC,SAAS,SAAS,GAAG,SAAS,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoDnG"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// The users plugin (slice 13 §3, decision "The app kit, point 2: principals and users"): accounts keyed by the user's
|
|
2
|
+
// id with a profile the app describes (a schema it passes in: a Slack-like profile or just a name), kept in the
|
|
3
|
+
// server's store. User data never rides in the principal: a principal names the user, `Users` holds the rest.
|
|
4
|
+
// An exported facet, not a plugin directory: it takes the app's schema as an argument (settings are arguments), and a
|
|
5
|
+
// plugin directory could not import it (plugins import only the app's API). The app loads it in its root by
|
|
6
|
+
// re-exporting it through its API (`export const users = defineUsers(Profile)` in `/v3/server`, a one-line plugin).
|
|
7
|
+
import { arr, local, map, method, nul, obj, str, union } from "../../contracts/index.js";
|
|
8
|
+
import { invalid } from "../../data/internal.js";
|
|
9
|
+
import { defineState } from "../../documents/index.js";
|
|
10
|
+
import { defineFacet } from "../../host/index.js";
|
|
11
|
+
/** The users plugin for profiles of schema `profile`: its contract and the facet serving it on the server. */
|
|
12
|
+
export function defineUsers(profile) {
|
|
13
|
+
const Users = local("chord.app.users", {
|
|
14
|
+
version: 1,
|
|
15
|
+
params: {},
|
|
16
|
+
members: {
|
|
17
|
+
/** Every user: id and profile. */
|
|
18
|
+
list: arr(obj({ id: str(), profile })),
|
|
19
|
+
/** The profile of user `id`, or `null`. */
|
|
20
|
+
get: method(str(), union([profile, nul()])),
|
|
21
|
+
/** Sets the profile of user `id` (a new user: an account made). */
|
|
22
|
+
update: method(obj({ id: str(), profile })),
|
|
23
|
+
/** Removes user `id`'s account. */
|
|
24
|
+
remove: method(str()),
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
// Stored as JSON: the document's types cannot follow a generic profile, the contract's members do.
|
|
28
|
+
const stored = profile;
|
|
29
|
+
const Accounts = defineState("chord.app.users", {
|
|
30
|
+
schema: obj({ users: map(stored) }),
|
|
31
|
+
version: 1,
|
|
32
|
+
initial: () => ({ users: {} }),
|
|
33
|
+
persist: true,
|
|
34
|
+
checkpointWhen: (_value, _ops, { deltasSinceBase }) => deltasSinceBase >= 50,
|
|
35
|
+
});
|
|
36
|
+
const facet = defineFacet((host) => host.serve(Users, (_params, self) => {
|
|
37
|
+
const accounts = self.state(Accounts);
|
|
38
|
+
return {
|
|
39
|
+
list: self.derive([accounts], ([value]) => Object.entries(value.users).map(([id, each]) => ({ id, profile: each }))),
|
|
40
|
+
// A trust boundary: `id` is the caller's (`Object.hasOwn`: no inherited member is a user). Written by
|
|
41
|
+
// `update` from a `T`.
|
|
42
|
+
get: async (id) => (Object.hasOwn(accounts.value.users, id) ? accounts.value.users[id] : null),
|
|
43
|
+
update: async ({ id, profile: next }, ctx) => {
|
|
44
|
+
// As a key it would set the record's prototype, not add a user.
|
|
45
|
+
if (id === "__proto__")
|
|
46
|
+
throw invalid("args", "users: __proto__ is no user id");
|
|
47
|
+
await accounts.change((draft) => {
|
|
48
|
+
draft.users[id] = next;
|
|
49
|
+
}, ctx);
|
|
50
|
+
return null;
|
|
51
|
+
},
|
|
52
|
+
remove: async (id, ctx) => {
|
|
53
|
+
await accounts.change((draft) => {
|
|
54
|
+
delete draft.users[id];
|
|
55
|
+
}, ctx);
|
|
56
|
+
return null;
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
}));
|
|
60
|
+
return { Users, facet };
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=users.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"users.js","sourceRoot":"","sources":["../../../src/node/app/users.ts"],"names":[],"mappings":"AAAA,sHAAsH;AACtH,gHAAgH;AAChH,8GAA8G;AAC9G,sHAAsH;A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AAC;gBACrC,CAAC,EAAE,GAAG,CAAC,CAAC;gBACR,OAAO,IAAI,CAAC;YACb,CAAC;YACD,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE;gBACzB,MAAM,QAAQ,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;oBAC/B,OAAO,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;gBACxB,CAAC,EAAE,GAAG,CAAC,CAAC;gBACR,OAAO,IAAI,CAAC;YACb,CAAC;SACD,CAAC;IACH,CAAC,CAAC,CACF,CAAC;IACF,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;AACzB,CAAC","sourcesContent":["// The users plugin (slice 13 §3, decision \"The app kit, point 2: principals and users\"): accounts keyed by the user's\n// id with a profile the app describes (a schema it passes in: a Slack-like profile or just a name), kept in the\n// server's store. User data never rides in the principal: a principal names the user, `Users` holds the rest.\n// An exported facet, not a plugin directory: it takes the app's schema as an argument (settings are arguments), and a\n// plugin directory could not import it (plugins import only the app's API). The app loads it in its root by\n// re-exporting it through its API (`export const users = defineUsers(Profile)` in `/v3/server`, a one-line plugin).\n\nimport { arr, local, map, method, nul, obj, type Schema, str, union } from \"../../contracts/index.ts\";\nimport type { Principal } from \"../../data/index.ts\";\nimport { invalid } from \"../../data/internal.ts\";\nimport { defineState } from \"../../documents/index.ts\";\nimport { defineFacet, type Facet } from \"../../host/index.ts\";\nimport type { JsonValue } from \"../../json.ts\";\n\n/** The users plugin for profiles of schema `profile`: its contract and the facet serving it on the server. */\nexport function defineUsers<T extends JsonValue, P extends Principal = Principal>(profile: Schema<T>) {\n\tconst Users = local(\"chord.app.users\", {\n\t\tversion: 1,\n\t\tparams: {},\n\t\tmembers: {\n\t\t\t/** Every user: id and profile. */\n\t\t\tlist: arr(obj({ id: str(), profile })),\n\t\t\t/** The profile of user `id`, or `null`. */\n\t\t\tget: method(str(), union([profile, nul()])),\n\t\t\t/** Sets the profile of user `id` (a new user: an account made). */\n\t\t\tupdate: method(obj({ id: str(), profile })),\n\t\t\t/** Removes user `id`'s account. */\n\t\t\tremove: method(str()),\n\t\t},\n\t});\n\t// Stored as JSON: the document's types cannot follow a generic profile, the contract's members do.\n\tconst stored = profile as Schema<JsonValue>;\n\tconst Accounts = defineState(\"chord.app.users\", {\n\t\tschema: obj({ users: map(stored) }),\n\t\tversion: 1,\n\t\tinitial: () => ({ users: {} }),\n\t\tpersist: true,\n\t\tcheckpointWhen: (_value, _ops, { deltasSinceBase }) => deltasSinceBase >= 50,\n\t});\n\tconst facet: Facet<P> = defineFacet<P>((host) =>\n\t\thost.serve(Users, (_params, self) => {\n\t\t\tconst accounts = self.state(Accounts);\n\t\t\treturn {\n\t\t\t\tlist: self.derive([accounts], ([value]) =>\n\t\t\t\t\tObject.entries(value.users).map(([id, each]) => ({ id, profile: each as T })),\n\t\t\t\t),\n\t\t\t\t// A trust boundary: `id` is the caller's (`Object.hasOwn`: no inherited member is a user). Written by\n\t\t\t\t// `update` from a `T`.\n\t\t\t\tget: async (id) => (Object.hasOwn(accounts.value.users, id) ? (accounts.value.users[id] as T) : null),\n\t\t\t\tupdate: async ({ id, profile: next }, ctx) => {\n\t\t\t\t\t// As a key it would set the record's prototype, not add a user.\n\t\t\t\t\tif (id === \"__proto__\") throw invalid(\"args\", \"users: __proto__ is no user id\");\n\t\t\t\t\tawait accounts.change((draft) => {\n\t\t\t\t\t\tdraft.users[id] = next as JsonValue;\n\t\t\t\t\t}, ctx);\n\t\t\t\t\treturn null;\n\t\t\t\t},\n\t\t\t\tremove: async (id, ctx) => {\n\t\t\t\t\tawait accounts.change((draft) => {\n\t\t\t\t\t\tdelete draft.users[id];\n\t\t\t\t\t}, ctx);\n\t\t\t\t\treturn null;\n\t\t\t\t},\n\t\t\t};\n\t\t}),\n\t);\n\treturn { Users, facet };\n}\n"]}
|