@diffra-ai/chord 0.0.0-stage → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +235 -0
- package/README.md +227 -2
- package/dist/context/index.d.ts +43 -0
- package/dist/context/index.d.ts.map +1 -0
- package/dist/context/index.js +112 -0
- package/dist/context/index.js.map +1 -0
- package/dist/contracts/accepts.d.ts +91 -0
- package/dist/contracts/accepts.d.ts.map +1 -0
- package/dist/contracts/accepts.js +145 -0
- package/dist/contracts/accepts.js.map +1 -0
- package/dist/contracts/contract.d.ts +238 -0
- package/dist/contracts/contract.d.ts.map +1 -0
- package/dist/contracts/contract.js +69 -0
- package/dist/contracts/contract.js.map +1 -0
- package/dist/contracts/declare.d.ts +144 -0
- package/dist/contracts/declare.d.ts.map +1 -0
- package/dist/contracts/declare.js +207 -0
- package/dist/contracts/declare.js.map +1 -0
- package/dist/contracts/evolve.d.ts +142 -0
- package/dist/contracts/evolve.d.ts.map +1 -0
- package/dist/contracts/evolve.js +216 -0
- package/dist/contracts/evolve.js.map +1 -0
- package/dist/contracts/fingerprint.d.ts +16 -0
- package/dist/contracts/fingerprint.d.ts.map +1 -0
- package/dist/contracts/fingerprint.js +61 -0
- package/dist/contracts/fingerprint.js.map +1 -0
- package/dist/contracts/history.d.ts +79 -0
- package/dist/contracts/history.d.ts.map +1 -0
- package/dist/contracts/history.js +3 -0
- package/dist/contracts/history.js.map +1 -0
- package/dist/contracts/host-kind.d.ts +58 -0
- package/dist/contracts/host-kind.d.ts.map +1 -0
- package/dist/contracts/host-kind.js +122 -0
- package/dist/contracts/host-kind.js.map +1 -0
- package/dist/contracts/index.d.ts +8 -0
- package/dist/contracts/index.d.ts.map +1 -0
- package/dist/contracts/index.js +7 -0
- package/dist/contracts/index.js.map +1 -0
- package/dist/contracts/internal.d.ts +12 -0
- package/dist/contracts/internal.d.ts.map +1 -0
- package/dist/contracts/internal.js +11 -0
- package/dist/contracts/internal.js.map +1 -0
- package/dist/contracts/names.d.ts +3 -0
- package/dist/contracts/names.d.ts.map +1 -0
- package/dist/contracts/names.js +13 -0
- package/dist/contracts/names.js.map +1 -0
- package/dist/contracts/params.d.ts +28 -0
- package/dist/contracts/params.d.ts.map +1 -0
- package/dist/contracts/params.js +55 -0
- package/dist/contracts/params.js.map +1 -0
- package/dist/contracts/schema.d.ts +144 -0
- package/dist/contracts/schema.d.ts.map +1 -0
- package/dist/contracts/schema.js +144 -0
- package/dist/contracts/schema.js.map +1 -0
- package/dist/contracts/snapshot.d.ts +16 -0
- package/dist/contracts/snapshot.d.ts.map +1 -0
- package/dist/contracts/snapshot.js +167 -0
- package/dist/contracts/snapshot.js.map +1 -0
- package/dist/data/args.d.ts +50 -0
- package/dist/data/args.d.ts.map +1 -0
- package/dist/data/args.js +83 -0
- package/dist/data/args.js.map +1 -0
- package/dist/data/errors.d.ts +80 -0
- package/dist/data/errors.d.ts.map +1 -0
- package/dist/data/errors.js +116 -0
- package/dist/data/errors.js.map +1 -0
- package/dist/data/failure.d.ts +31 -0
- package/dist/data/failure.d.ts.map +1 -0
- package/dist/data/failure.js +78 -0
- package/dist/data/failure.js.map +1 -0
- package/dist/data/index.d.ts +4 -0
- package/dist/data/index.d.ts.map +1 -0
- package/dist/data/index.js +5 -0
- package/dist/data/index.js.map +1 -0
- package/dist/data/internal.d.ts +7 -0
- package/dist/data/internal.d.ts.map +1 -0
- package/dist/data/internal.js +8 -0
- package/dist/data/internal.js.map +1 -0
- package/dist/data/params.d.ts +20 -0
- package/dist/data/params.d.ts.map +1 -0
- package/dist/data/params.js +31 -0
- package/dist/data/params.js.map +1 -0
- package/dist/data/principal.d.ts +28 -0
- package/dist/data/principal.d.ts.map +1 -0
- package/dist/data/principal.js +64 -0
- package/dist/data/principal.js.map +1 -0
- package/dist/data/validator.d.ts +12 -0
- package/dist/data/validator.d.ts.map +1 -0
- package/dist/data/validator.js +35 -0
- package/dist/data/validator.js.map +1 -0
- package/dist/delta/apply-immutable-trusted.d.ts +4 -0
- package/dist/delta/apply-immutable-trusted.d.ts.map +1 -0
- package/dist/delta/apply-immutable-trusted.js +126 -0
- package/dist/delta/apply-immutable-trusted.js.map +1 -0
- package/dist/delta/diff.d.ts +5 -0
- package/dist/delta/diff.d.ts.map +1 -0
- package/dist/delta/diff.js +435 -0
- package/dist/delta/diff.js.map +1 -0
- package/dist/delta/draft.d.ts +5 -0
- package/dist/delta/draft.d.ts.map +1 -0
- package/dist/delta/draft.js +2 -0
- package/dist/delta/draft.js.map +1 -0
- package/dist/delta/index.d.ts +120 -0
- package/dist/delta/index.d.ts.map +1 -0
- package/dist/delta/index.js +697 -0
- package/dist/delta/index.js.map +1 -0
- package/dist/delta/pending.d.ts +36 -0
- package/dist/delta/pending.d.ts.map +1 -0
- package/dist/delta/pending.js +143 -0
- package/dist/delta/pending.js.map +1 -0
- package/dist/delta/revision-validator.d.ts +7 -0
- package/dist/delta/revision-validator.d.ts.map +1 -0
- package/dist/delta/revision-validator.js +71 -0
- package/dist/delta/revision-validator.js.map +1 -0
- package/dist/delta/tracker.d.ts +38 -0
- package/dist/delta/tracker.d.ts.map +1 -0
- package/dist/delta/tracker.js +2175 -0
- package/dist/delta/tracker.js.map +1 -0
- package/dist/documents/address-source.d.ts +20 -0
- package/dist/documents/address-source.d.ts.map +1 -0
- package/dist/documents/address-source.js +44 -0
- package/dist/documents/address-source.js.map +1 -0
- package/dist/documents/definition.d.ts +92 -0
- package/dist/documents/definition.d.ts.map +1 -0
- package/dist/documents/definition.js +81 -0
- package/dist/documents/definition.js.map +1 -0
- package/dist/documents/documents.d.ts +129 -0
- package/dist/documents/documents.d.ts.map +1 -0
- package/dist/documents/documents.js +258 -0
- package/dist/documents/documents.js.map +1 -0
- package/dist/documents/fence.d.ts +9 -0
- package/dist/documents/fence.d.ts.map +1 -0
- package/dist/documents/fence.js +15 -0
- package/dist/documents/fence.js.map +1 -0
- package/dist/documents/handles.d.ts +81 -0
- package/dist/documents/handles.d.ts.map +1 -0
- package/dist/documents/handles.js +74 -0
- package/dist/documents/handles.js.map +1 -0
- package/dist/documents/index.d.ts +4 -0
- package/dist/documents/index.d.ts.map +1 -0
- package/dist/documents/index.js +3 -0
- package/dist/documents/index.js.map +1 -0
- package/dist/documents/internal.d.ts +9 -0
- package/dist/documents/internal.d.ts.map +1 -0
- package/dist/documents/internal.js +9 -0
- package/dist/documents/internal.js.map +1 -0
- package/dist/documents/keyed-slot.d.ts +139 -0
- package/dist/documents/keyed-slot.d.ts.map +1 -0
- package/dist/documents/keyed-slot.js +478 -0
- package/dist/documents/keyed-slot.js.map +1 -0
- package/dist/documents/line.d.ts +7 -0
- package/dist/documents/line.d.ts.map +1 -0
- package/dist/documents/line.js +14 -0
- package/dist/documents/line.js.map +1 -0
- package/dist/documents/persistence.d.ts +120 -0
- package/dist/documents/persistence.d.ts.map +1 -0
- package/dist/documents/persistence.js +156 -0
- package/dist/documents/persistence.js.map +1 -0
- package/dist/documents/residency.d.ts +31 -0
- package/dist/documents/residency.d.ts.map +1 -0
- package/dist/documents/residency.js +93 -0
- package/dist/documents/residency.js.map +1 -0
- package/dist/documents/slot.d.ts +112 -0
- package/dist/documents/slot.d.ts.map +1 -0
- package/dist/documents/slot.js +190 -0
- package/dist/documents/slot.js.map +1 -0
- package/dist/documents/transaction.d.ts +143 -0
- package/dist/documents/transaction.d.ts.map +1 -0
- package/dist/documents/transaction.js +445 -0
- package/dist/documents/transaction.js.map +1 -0
- package/dist/host/activity.d.ts +31 -0
- package/dist/host/activity.d.ts.map +1 -0
- package/dist/host/activity.js +40 -0
- package/dist/host/activity.js.map +1 -0
- package/dist/host/adapted.d.ts +63 -0
- package/dist/host/adapted.d.ts.map +1 -0
- package/dist/host/adapted.js +298 -0
- package/dist/host/adapted.js.map +1 -0
- package/dist/host/admission.d.ts +137 -0
- package/dist/host/admission.d.ts.map +1 -0
- package/dist/host/admission.js +290 -0
- package/dist/host/admission.js.map +1 -0
- package/dist/host/attempt.d.ts +417 -0
- package/dist/host/attempt.d.ts.map +1 -0
- package/dist/host/attempt.js +1490 -0
- package/dist/host/attempt.js.map +1 -0
- package/dist/host/backoff.d.ts +29 -0
- package/dist/host/backoff.d.ts.map +1 -0
- package/dist/host/backoff.js +69 -0
- package/dist/host/backoff.js.map +1 -0
- package/dist/host/ctx.d.ts +94 -0
- package/dist/host/ctx.d.ts.map +1 -0
- package/dist/host/ctx.js +200 -0
- package/dist/host/ctx.js.map +1 -0
- package/dist/host/deadline.d.ts +12 -0
- package/dist/host/deadline.d.ts.map +1 -0
- package/dist/host/deadline.js +40 -0
- package/dist/host/deadline.js.map +1 -0
- package/dist/host/dependencies.d.ts +97 -0
- package/dist/host/dependencies.d.ts.map +1 -0
- package/dist/host/dependencies.js +148 -0
- package/dist/host/dependencies.js.map +1 -0
- package/dist/host/destination.d.ts +48 -0
- package/dist/host/destination.d.ts.map +1 -0
- package/dist/host/destination.js +101 -0
- package/dist/host/destination.js.map +1 -0
- package/dist/host/events.d.ts +114 -0
- package/dist/host/events.d.ts.map +1 -0
- package/dist/host/events.js +191 -0
- package/dist/host/events.js.map +1 -0
- package/dist/host/facet.d.ts +106 -0
- package/dist/host/facet.d.ts.map +1 -0
- package/dist/host/facet.js +55 -0
- package/dist/host/facet.js.map +1 -0
- package/dist/host/follow.d.ts +52 -0
- package/dist/host/follow.d.ts.map +1 -0
- package/dist/host/follow.js +207 -0
- package/dist/host/follow.js.map +1 -0
- package/dist/host/host-data.d.ts +62 -0
- package/dist/host/host-data.d.ts.map +1 -0
- package/dist/host/host-data.js +229 -0
- package/dist/host/host-data.js.map +1 -0
- package/dist/host/host.d.ts +641 -0
- package/dist/host/host.d.ts.map +1 -0
- package/dist/host/host.js +1449 -0
- package/dist/host/host.js.map +1 -0
- package/dist/host/index.d.ts +20 -0
- package/dist/host/index.d.ts.map +1 -0
- package/dist/host/index.js +7 -0
- package/dist/host/index.js.map +1 -0
- package/dist/host/internal.d.ts +13 -0
- package/dist/host/internal.d.ts.map +1 -0
- package/dist/host/internal.js +11 -0
- package/dist/host/internal.js.map +1 -0
- package/dist/host/list.d.ts +52 -0
- package/dist/host/list.d.ts.map +1 -0
- package/dist/host/list.js +149 -0
- package/dist/host/list.js.map +1 -0
- package/dist/host/members.d.ts +58 -0
- package/dist/host/members.d.ts.map +1 -0
- package/dist/host/members.js +178 -0
- package/dist/host/members.js.map +1 -0
- package/dist/host/named-query.d.ts +67 -0
- package/dist/host/named-query.d.ts.map +1 -0
- package/dist/host/named-query.js +166 -0
- package/dist/host/named-query.js.map +1 -0
- package/dist/host/native.d.ts +64 -0
- package/dist/host/native.d.ts.map +1 -0
- package/dist/host/native.js +126 -0
- package/dist/host/native.js.map +1 -0
- package/dist/host/object.d.ts +388 -0
- package/dist/host/object.d.ts.map +1 -0
- package/dist/host/object.js +1527 -0
- package/dist/host/object.js.map +1 -0
- package/dist/host/old-work.d.ts +34 -0
- package/dist/host/old-work.d.ts.map +1 -0
- package/dist/host/old-work.js +52 -0
- package/dist/host/old-work.js.map +1 -0
- package/dist/host/parked.d.ts +23 -0
- package/dist/host/parked.d.ts.map +1 -0
- package/dist/host/parked.js +79 -0
- package/dist/host/parked.js.map +1 -0
- package/dist/host/presence.d.ts +34 -0
- package/dist/host/presence.d.ts.map +1 -0
- package/dist/host/presence.js +117 -0
- package/dist/host/presence.js.map +1 -0
- package/dist/host/query-reader.d.ts +80 -0
- package/dist/host/query-reader.d.ts.map +1 -0
- package/dist/host/query-reader.js +182 -0
- package/dist/host/query-reader.js.map +1 -0
- package/dist/host/read-declarations.d.ts +75 -0
- package/dist/host/read-declarations.d.ts.map +1 -0
- package/dist/host/read-declarations.js +152 -0
- package/dist/host/read-declarations.js.map +1 -0
- package/dist/host/readiness.d.ts +27 -0
- package/dist/host/readiness.d.ts.map +1 -0
- package/dist/host/readiness.js +134 -0
- package/dist/host/readiness.js.map +1 -0
- package/dist/host/ref-state.d.ts +53 -0
- package/dist/host/ref-state.d.ts.map +1 -0
- package/dist/host/ref-state.js +83 -0
- package/dist/host/ref-state.js.map +1 -0
- package/dist/host/reference-events.d.ts +51 -0
- package/dist/host/reference-events.d.ts.map +1 -0
- package/dist/host/reference-events.js +133 -0
- package/dist/host/reference-events.js.map +1 -0
- package/dist/host/reference-keys.d.ts +36 -0
- package/dist/host/reference-keys.d.ts.map +1 -0
- package/dist/host/reference-keys.js +168 -0
- package/dist/host/reference-keys.js.map +1 -0
- package/dist/host/reference-source.d.ts +77 -0
- package/dist/host/reference-source.d.ts.map +1 -0
- package/dist/host/reference-source.js +326 -0
- package/dist/host/reference-source.js.map +1 -0
- package/dist/host/reference.d.ts +377 -0
- package/dist/host/reference.d.ts.map +1 -0
- package/dist/host/reference.js +986 -0
- package/dist/host/reference.js.map +1 -0
- package/dist/host/reload-cycle.d.ts +16 -0
- package/dist/host/reload-cycle.d.ts.map +1 -0
- package/dist/host/reload-cycle.js +81 -0
- package/dist/host/reload-cycle.js.map +1 -0
- package/dist/host/retry-on.d.ts +28 -0
- package/dist/host/retry-on.d.ts.map +1 -0
- package/dist/host/retry-on.js +52 -0
- package/dist/host/retry-on.js.map +1 -0
- package/dist/host/revocation.d.ts +16 -0
- package/dist/host/revocation.d.ts.map +1 -0
- package/dist/host/revocation.js +27 -0
- package/dist/host/revocation.js.map +1 -0
- package/dist/host/root.d.ts +37 -0
- package/dist/host/root.d.ts.map +1 -0
- package/dist/host/root.js +68 -0
- package/dist/host/root.js.map +1 -0
- package/dist/host/route-admission.d.ts +24 -0
- package/dist/host/route-admission.d.ts.map +1 -0
- package/dist/host/route-admission.js +238 -0
- package/dist/host/route-admission.js.map +1 -0
- package/dist/host/route.d.ts +88 -0
- package/dist/host/route.d.ts.map +1 -0
- package/dist/host/route.js +247 -0
- package/dist/host/route.js.map +1 -0
- package/dist/host/routines.d.ts +78 -0
- package/dist/host/routines.d.ts.map +1 -0
- package/dist/host/routines.js +398 -0
- package/dist/host/routines.js.map +1 -0
- package/dist/host/sleep.d.ts +9 -0
- package/dist/host/sleep.d.ts.map +1 -0
- package/dist/host/sleep.js +40 -0
- package/dist/host/sleep.js.map +1 -0
- package/dist/host/staging.d.ts +100 -0
- package/dist/host/staging.d.ts.map +1 -0
- package/dist/host/staging.js +413 -0
- package/dist/host/staging.js.map +1 -0
- package/dist/host/tiling.d.ts +57 -0
- package/dist/host/tiling.d.ts.map +1 -0
- package/dist/host/tiling.js +269 -0
- package/dist/host/tiling.js.map +1 -0
- package/dist/host/unbound-clock.d.ts +23 -0
- package/dist/host/unbound-clock.d.ts.map +1 -0
- package/dist/host/unbound-clock.js +58 -0
- package/dist/host/unbound-clock.js.map +1 -0
- package/dist/host/unbound.d.ts +37 -0
- package/dist/host/unbound.d.ts.map +1 -0
- package/dist/host/unbound.js +88 -0
- package/dist/host/unbound.js.map +1 -0
- package/dist/host/uuid.d.ts +3 -0
- package/dist/host/uuid.d.ts.map +1 -0
- package/dist/host/uuid.js +38 -0
- package/dist/host/uuid.js.map +1 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/jobs/definition.d.ts +96 -0
- package/dist/jobs/definition.d.ts.map +1 -0
- package/dist/jobs/definition.js +83 -0
- package/dist/jobs/definition.js.map +1 -0
- package/dist/jobs/index.d.ts +5 -0
- package/dist/jobs/index.d.ts.map +1 -0
- package/dist/jobs/index.js +3 -0
- package/dist/jobs/index.js.map +1 -0
- package/dist/jobs/internal.d.ts +3 -0
- package/dist/jobs/internal.d.ts.map +1 -0
- package/dist/jobs/internal.js +4 -0
- package/dist/jobs/internal.js.map +1 -0
- package/dist/jobs/job.d.ts +149 -0
- package/dist/jobs/job.d.ts.map +1 -0
- package/dist/jobs/job.js +387 -0
- package/dist/jobs/job.js.map +1 -0
- package/dist/jobs/persisted.d.ts +38 -0
- package/dist/jobs/persisted.d.ts.map +1 -0
- package/dist/jobs/persisted.js +95 -0
- package/dist/jobs/persisted.js.map +1 -0
- package/dist/jobs/records.d.ts +231 -0
- package/dist/jobs/records.d.ts.map +1 -0
- package/dist/jobs/records.js +871 -0
- package/dist/jobs/records.js.map +1 -0
- package/dist/jobs/run-states.d.ts +69 -0
- package/dist/jobs/run-states.d.ts.map +1 -0
- package/dist/jobs/run-states.js +228 -0
- package/dist/jobs/run-states.js.map +1 -0
- package/dist/jobs/run.d.ts +117 -0
- package/dist/jobs/run.d.ts.map +1 -0
- package/dist/jobs/run.js +204 -0
- package/dist/jobs/run.js.map +1 -0
- package/dist/jobs/running.d.ts +44 -0
- package/dist/jobs/running.d.ts.map +1 -0
- package/dist/jobs/running.js +117 -0
- package/dist/jobs/running.js.map +1 -0
- package/dist/jobs/stored.d.ts +63 -0
- package/dist/jobs/stored.d.ts.map +1 -0
- package/dist/jobs/stored.js +55 -0
- package/dist/jobs/stored.js.map +1 -0
- package/dist/json.d.ts +18 -0
- package/dist/json.d.ts.map +1 -0
- package/dist/json.js +124 -0
- package/dist/json.js.map +1 -0
- package/dist/link/binary.d.ts +4 -0
- package/dist/link/binary.d.ts.map +1 -0
- package/dist/link/binary.js +574 -0
- package/dist/link/binary.js.map +1 -0
- package/dist/link/channel.d.ts +78 -0
- package/dist/link/channel.d.ts.map +1 -0
- package/dist/link/channel.js +252 -0
- package/dist/link/channel.js.map +1 -0
- package/dist/link/errors.d.ts +7 -0
- package/dist/link/errors.d.ts.map +1 -0
- package/dist/link/errors.js +21 -0
- package/dist/link/errors.js.map +1 -0
- package/dist/link/index.d.ts +8 -0
- package/dist/link/index.d.ts.map +1 -0
- package/dist/link/index.js +8 -0
- package/dist/link/index.js.map +1 -0
- package/dist/link/internal.d.ts +9 -0
- package/dist/link/internal.d.ts.map +1 -0
- package/dist/link/internal.js +10 -0
- package/dist/link/internal.js.map +1 -0
- package/dist/link/ipc.d.ts +22 -0
- package/dist/link/ipc.d.ts.map +1 -0
- package/dist/link/ipc.js +64 -0
- package/dist/link/ipc.js.map +1 -0
- package/dist/link/link.d.ts +34 -0
- package/dist/link/link.d.ts.map +1 -0
- package/dist/link/link.js +87 -0
- package/dist/link/link.js.map +1 -0
- package/dist/link/message.d.ts +278 -0
- package/dist/link/message.d.ts.map +1 -0
- package/dist/link/message.js +179 -0
- package/dist/link/message.js.map +1 -0
- package/dist/link/part.d.ts +80 -0
- package/dist/link/part.d.ts.map +1 -0
- package/dist/link/part.js +165 -0
- package/dist/link/part.js.map +1 -0
- package/dist/link/text.d.ts +6 -0
- package/dist/link/text.d.ts.map +1 -0
- package/dist/link/text.js +383 -0
- package/dist/link/text.js.map +1 -0
- package/dist/link/values.d.ts +40 -0
- package/dist/link/values.d.ts.map +1 -0
- package/dist/link/values.js +121 -0
- package/dist/link/values.js.map +1 -0
- package/dist/link/websocket.d.ts +26 -0
- package/dist/link/websocket.d.ts.map +1 -0
- package/dist/link/websocket.js +91 -0
- package/dist/link/websocket.js.map +1 -0
- package/dist/node/app/app.d.ts +283 -0
- package/dist/node/app/app.d.ts.map +1 -0
- package/dist/node/app/app.js +598 -0
- package/dist/node/app/app.js.map +1 -0
- package/dist/node/app/archive.d.ts +44 -0
- package/dist/node/app/archive.d.ts.map +1 -0
- package/dist/node/app/archive.js +212 -0
- package/dist/node/app/archive.js.map +1 -0
- package/dist/node/app/blobs.d.ts +23 -0
- package/dist/node/app/blobs.d.ts.map +1 -0
- package/dist/node/app/blobs.js +64 -0
- package/dist/node/app/blobs.js.map +1 -0
- package/dist/node/app/data.d.ts +40 -0
- package/dist/node/app/data.d.ts.map +1 -0
- package/dist/node/app/data.js +47 -0
- package/dist/node/app/data.js.map +1 -0
- package/dist/node/app/ephemeral-sign-ins.d.ts +20 -0
- package/dist/node/app/ephemeral-sign-ins.d.ts.map +1 -0
- package/dist/node/app/ephemeral-sign-ins.js +69 -0
- package/dist/node/app/ephemeral-sign-ins.js.map +1 -0
- package/dist/node/app/ephemeral.d.ts +11 -0
- package/dist/node/app/ephemeral.d.ts.map +1 -0
- package/dist/node/app/ephemeral.js +34 -0
- package/dist/node/app/ephemeral.js.map +1 -0
- package/dist/node/app/files-copy.d.ts +13 -0
- package/dist/node/app/files-copy.d.ts.map +1 -0
- package/dist/node/app/files-copy.js +86 -0
- package/dist/node/app/files-copy.js.map +1 -0
- package/dist/node/app/files-entry.d.ts +4 -0
- package/dist/node/app/files-entry.d.ts.map +1 -0
- package/dist/node/app/files-entry.js +7 -0
- package/dist/node/app/files-entry.js.map +1 -0
- package/dist/node/app/files-index.d.ts +180 -0
- package/dist/node/app/files-index.d.ts.map +1 -0
- package/dist/node/app/files-index.js +535 -0
- package/dist/node/app/files-index.js.map +1 -0
- package/dist/node/app/files.d.ts +388 -0
- package/dist/node/app/files.d.ts.map +1 -0
- package/dist/node/app/files.js +368 -0
- package/dist/node/app/files.js.map +1 -0
- package/dist/node/app/folder-views.d.ts +21 -0
- package/dist/node/app/folder-views.d.ts.map +1 -0
- package/dist/node/app/folder-views.js +55 -0
- package/dist/node/app/folder-views.js.map +1 -0
- package/dist/node/app/index.d.ts +12 -0
- package/dist/node/app/index.d.ts.map +1 -0
- package/dist/node/app/index.js +15 -0
- package/dist/node/app/index.js.map +1 -0
- package/dist/node/app/info.d.ts +70 -0
- package/dist/node/app/info.d.ts.map +1 -0
- package/dist/node/app/info.js +37 -0
- package/dist/node/app/info.js.map +1 -0
- package/dist/node/app/invite.d.ts +5 -0
- package/dist/node/app/invite.d.ts.map +1 -0
- package/dist/node/app/invite.js +64 -0
- package/dist/node/app/invite.js.map +1 -0
- package/dist/node/app/layout.d.ts +36 -0
- package/dist/node/app/layout.d.ts.map +1 -0
- package/dist/node/app/layout.js +87 -0
- package/dist/node/app/layout.js.map +1 -0
- package/dist/node/app/owner.d.ts +31 -0
- package/dist/node/app/owner.d.ts.map +1 -0
- package/dist/node/app/owner.js +104 -0
- package/dist/node/app/owner.js.map +1 -0
- package/dist/node/app/pairing.d.ts +55 -0
- package/dist/node/app/pairing.d.ts.map +1 -0
- package/dist/node/app/pairing.js +183 -0
- package/dist/node/app/pairing.js.map +1 -0
- package/dist/node/app/secrets.d.ts +16 -0
- package/dist/node/app/secrets.d.ts.map +1 -0
- package/dist/node/app/secrets.js +72 -0
- package/dist/node/app/secrets.js.map +1 -0
- package/dist/node/app/sign-ins.d.ts +74 -0
- package/dist/node/app/sign-ins.d.ts.map +1 -0
- package/dist/node/app/sign-ins.js +222 -0
- package/dist/node/app/sign-ins.js.map +1 -0
- package/dist/node/app/tar.d.ts +24 -0
- package/dist/node/app/tar.d.ts.map +1 -0
- package/dist/node/app/tar.js +167 -0
- package/dist/node/app/tar.js.map +1 -0
- package/dist/node/app/uploads.d.ts +37 -0
- package/dist/node/app/uploads.d.ts.map +1 -0
- package/dist/node/app/uploads.js +157 -0
- package/dist/node/app/uploads.js.map +1 -0
- package/dist/node/app/users.d.ts +39 -0
- package/dist/node/app/users.d.ts.map +1 -0
- package/dist/node/app/users.js +62 -0
- package/dist/node/app/users.js.map +1 -0
- package/dist/node/app/worker.d.ts +18 -0
- package/dist/node/app/worker.d.ts.map +1 -0
- package/dist/node/app/worker.js +84 -0
- package/dist/node/app/worker.js.map +1 -0
- package/dist/node/compression.d.ts +7 -0
- package/dist/node/compression.d.ts.map +1 -0
- package/dist/node/compression.js +25 -0
- package/dist/node/compression.js.map +1 -0
- package/dist/node/http/admission.d.ts +64 -0
- package/dist/node/http/admission.d.ts.map +1 -0
- package/dist/node/http/admission.js +137 -0
- package/dist/node/http/admission.js.map +1 -0
- package/dist/node/http/authenticate.d.ts +21 -0
- package/dist/node/http/authenticate.d.ts.map +1 -0
- package/dist/node/http/authenticate.js +34 -0
- package/dist/node/http/authenticate.js.map +1 -0
- package/dist/node/http/cookies.d.ts +32 -0
- package/dist/node/http/cookies.d.ts.map +1 -0
- package/dist/node/http/cookies.js +70 -0
- package/dist/node/http/cookies.js.map +1 -0
- package/dist/node/http/file.d.ts +23 -0
- package/dist/node/http/file.d.ts.map +1 -0
- package/dist/node/http/file.js +94 -0
- package/dist/node/http/file.js.map +1 -0
- package/dist/node/http/headers.d.ts +37 -0
- package/dist/node/http/headers.d.ts.map +1 -0
- package/dist/node/http/headers.js +136 -0
- package/dist/node/http/headers.js.map +1 -0
- package/dist/node/http/http.d.ts +114 -0
- package/dist/node/http/http.d.ts.map +1 -0
- package/dist/node/http/http.js +524 -0
- package/dist/node/http/http.js.map +1 -0
- package/dist/node/http/incoming.d.ts +19 -0
- package/dist/node/http/incoming.d.ts.map +1 -0
- package/dist/node/http/incoming.js +31 -0
- package/dist/node/http/incoming.js.map +1 -0
- package/dist/node/http/index.d.ts +11 -0
- package/dist/node/http/index.d.ts.map +1 -0
- package/dist/node/http/index.js +12 -0
- package/dist/node/http/index.js.map +1 -0
- package/dist/node/http/node.d.ts +78 -0
- package/dist/node/http/node.d.ts.map +1 -0
- package/dist/node/http/node.js +291 -0
- package/dist/node/http/node.js.map +1 -0
- package/dist/node/http/request.d.ts +60 -0
- package/dist/node/http/request.d.ts.map +1 -0
- package/dist/node/http/request.js +118 -0
- package/dist/node/http/request.js.map +1 -0
- package/dist/node/http/response.d.ts +63 -0
- package/dist/node/http/response.d.ts.map +1 -0
- package/dist/node/http/response.js +202 -0
- package/dist/node/http/response.js.map +1 -0
- package/dist/node/http/router.d.ts +132 -0
- package/dist/node/http/router.d.ts.map +1 -0
- package/dist/node/http/router.js +267 -0
- package/dist/node/http/router.js.map +1 -0
- package/dist/node/http/upgrades.d.ts +62 -0
- package/dist/node/http/upgrades.d.ts.map +1 -0
- package/dist/node/http/upgrades.js +194 -0
- package/dist/node/http/upgrades.js.map +1 -0
- package/dist/node/plugins/base-inputs.d.ts +14 -0
- package/dist/node/plugins/base-inputs.d.ts.map +1 -0
- package/dist/node/plugins/base-inputs.js +33 -0
- package/dist/node/plugins/base-inputs.js.map +1 -0
- package/dist/node/plugins/build.d.ts +77 -0
- package/dist/node/plugins/build.d.ts.map +1 -0
- package/dist/node/plugins/build.js +577 -0
- package/dist/node/plugins/build.js.map +1 -0
- package/dist/node/plugins/css-modules.d.ts +13 -0
- package/dist/node/plugins/css-modules.d.ts.map +1 -0
- package/dist/node/plugins/css-modules.js +58 -0
- package/dist/node/plugins/css-modules.js.map +1 -0
- package/dist/node/plugins/discover.d.ts +67 -0
- package/dist/node/plugins/discover.d.ts.map +1 -0
- package/dist/node/plugins/discover.js +369 -0
- package/dist/node/plugins/discover.js.map +1 -0
- package/dist/node/plugins/evaluate.d.ts +33 -0
- package/dist/node/plugins/evaluate.d.ts.map +1 -0
- package/dist/node/plugins/evaluate.js +121 -0
- package/dist/node/plugins/evaluate.js.map +1 -0
- package/dist/node/plugins/index.d.ts +11 -0
- package/dist/node/plugins/index.d.ts.map +1 -0
- package/dist/node/plugins/index.js +13 -0
- package/dist/node/plugins/index.js.map +1 -0
- package/dist/node/plugins/install.d.ts +40 -0
- package/dist/node/plugins/install.d.ts.map +1 -0
- package/dist/node/plugins/install.js +215 -0
- package/dist/node/plugins/install.js.map +1 -0
- package/dist/node/plugins/plugins.d.ts +165 -0
- package/dist/node/plugins/plugins.d.ts.map +1 -0
- package/dist/node/plugins/plugins.js +268 -0
- package/dist/node/plugins/plugins.js.map +1 -0
- package/dist/node/plugins/runtime.d.ts +57 -0
- package/dist/node/plugins/runtime.d.ts.map +1 -0
- package/dist/node/plugins/runtime.js +92 -0
- package/dist/node/plugins/runtime.js.map +1 -0
- package/dist/node/plugins/stack.d.ts +16 -0
- package/dist/node/plugins/stack.d.ts.map +1 -0
- package/dist/node/plugins/stack.js +70 -0
- package/dist/node/plugins/stack.js.map +1 -0
- package/dist/node/plugins/testing.d.ts +58 -0
- package/dist/node/plugins/testing.d.ts.map +1 -0
- package/dist/node/plugins/testing.js +210 -0
- package/dist/node/plugins/testing.js.map +1 -0
- package/dist/node/plugins/watcher.d.ts +69 -0
- package/dist/node/plugins/watcher.d.ts.map +1 -0
- package/dist/node/plugins/watcher.js +622 -0
- package/dist/node/plugins/watcher.js.map +1 -0
- package/dist/node/surfaces/bundle.d.ts +40 -0
- package/dist/node/surfaces/bundle.d.ts.map +1 -0
- package/dist/node/surfaces/bundle.js +121 -0
- package/dist/node/surfaces/bundle.js.map +1 -0
- package/dist/node/surfaces/current.d.ts +17 -0
- package/dist/node/surfaces/current.d.ts.map +1 -0
- package/dist/node/surfaces/current.js +54 -0
- package/dist/node/surfaces/current.js.map +1 -0
- package/dist/node/surfaces/index.d.ts +6 -0
- package/dist/node/surfaces/index.d.ts.map +1 -0
- package/dist/node/surfaces/index.js +6 -0
- package/dist/node/surfaces/index.js.map +1 -0
- package/dist/node/surfaces/published.d.ts +27 -0
- package/dist/node/surfaces/published.d.ts.map +1 -0
- package/dist/node/surfaces/published.js +142 -0
- package/dist/node/surfaces/published.js.map +1 -0
- package/dist/node/surfaces/served.d.ts +17 -0
- package/dist/node/surfaces/served.d.ts.map +1 -0
- package/dist/node/surfaces/served.js +44 -0
- package/dist/node/surfaces/served.js.map +1 -0
- package/dist/node/surfaces/surface-build.d.ts +53 -0
- package/dist/node/surfaces/surface-build.d.ts.map +1 -0
- package/dist/node/surfaces/surface-build.js +105 -0
- package/dist/node/surfaces/surface-build.js.map +1 -0
- package/dist/node/surfaces/tui.d.ts +42 -0
- package/dist/node/surfaces/tui.d.ts.map +1 -0
- package/dist/node/surfaces/tui.js +59 -0
- package/dist/node/surfaces/tui.js.map +1 -0
- package/dist/node/surfaces/web.d.ts +82 -0
- package/dist/node/surfaces/web.d.ts.map +1 -0
- package/dist/node/surfaces/web.js +122 -0
- package/dist/node/surfaces/web.js.map +1 -0
- package/dist/node/tui/actions.d.ts +49 -0
- package/dist/node/tui/actions.d.ts.map +1 -0
- package/dist/node/tui/actions.js +195 -0
- package/dist/node/tui/actions.js.map +1 -0
- package/dist/node/tui/credentials.d.ts +17 -0
- package/dist/node/tui/credentials.d.ts.map +1 -0
- package/dist/node/tui/credentials.js +54 -0
- package/dist/node/tui/credentials.js.map +1 -0
- package/dist/node/tui/filter.d.ts +5 -0
- package/dist/node/tui/filter.d.ts.map +1 -0
- package/dist/node/tui/filter.js +79 -0
- package/dist/node/tui/filter.js.map +1 -0
- package/dist/node/tui/index.d.ts +6 -0
- package/dist/node/tui/index.d.ts.map +1 -0
- package/dist/node/tui/index.js +6 -0
- package/dist/node/tui/index.js.map +1 -0
- package/dist/node/tui/launcher.d.ts +40 -0
- package/dist/node/tui/launcher.d.ts.map +1 -0
- package/dist/node/tui/launcher.js +439 -0
- package/dist/node/tui/launcher.js.map +1 -0
- package/dist/node/tui/pipe.d.ts +18 -0
- package/dist/node/tui/pipe.d.ts.map +1 -0
- package/dist/node/tui/pipe.js +134 -0
- package/dist/node/tui/pipe.js.map +1 -0
- package/dist/node/tui/sandbox.d.ts +54 -0
- package/dist/node/tui/sandbox.d.ts.map +1 -0
- package/dist/node/tui/sandbox.js +431 -0
- package/dist/node/tui/sandbox.js.map +1 -0
- package/dist/node/workers/base.d.ts +30 -0
- package/dist/node/workers/base.d.ts.map +1 -0
- package/dist/node/workers/base.js +260 -0
- package/dist/node/workers/base.js.map +1 -0
- package/dist/node/workers/child.d.ts +4 -0
- package/dist/node/workers/child.d.ts.map +1 -0
- package/dist/node/workers/child.js +6 -0
- package/dist/node/workers/child.js.map +1 -0
- package/dist/node/workers/control.d.ts +83 -0
- package/dist/node/workers/control.d.ts.map +1 -0
- package/dist/node/workers/control.js +77 -0
- package/dist/node/workers/control.js.map +1 -0
- package/dist/node/workers/index.d.ts +4 -0
- package/dist/node/workers/index.d.ts.map +1 -0
- package/dist/node/workers/index.js +7 -0
- package/dist/node/workers/index.js.map +1 -0
- package/dist/node/workers/lock.d.ts +30 -0
- package/dist/node/workers/lock.d.ts.map +1 -0
- package/dist/node/workers/lock.js +180 -0
- package/dist/node/workers/lock.js.map +1 -0
- package/dist/node/workers/main.d.ts +46 -0
- package/dist/node/workers/main.d.ts.map +1 -0
- package/dist/node/workers/main.js +230 -0
- package/dist/node/workers/main.js.map +1 -0
- package/dist/node/workers/process.d.ts +43 -0
- package/dist/node/workers/process.d.ts.map +1 -0
- package/dist/node/workers/process.js +137 -0
- package/dist/node/workers/process.js.map +1 -0
- package/dist/node/workers/workers.d.ts +144 -0
- package/dist/node/workers/workers.d.ts.map +1 -0
- package/dist/node/workers/workers.js +723 -0
- package/dist/node/workers/workers.js.map +1 -0
- package/dist/output.d.ts +91 -0
- package/dist/output.d.ts.map +1 -0
- package/dist/output.js +362 -0
- package/dist/output.js.map +1 -0
- package/dist/react/hooks.d.ts +61 -0
- package/dist/react/hooks.d.ts.map +1 -0
- package/dist/react/hooks.js +119 -0
- package/dist/react/hooks.js.map +1 -0
- package/dist/react/index.d.ts +4 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +4 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/stores.d.ts +9 -0
- package/dist/react/stores.d.ts.map +1 -0
- package/dist/react/stores.js +37 -0
- package/dist/react/stores.js.map +1 -0
- package/dist/registries/contribution.d.ts +50 -0
- package/dist/registries/contribution.d.ts.map +1 -0
- package/dist/registries/contribution.js +129 -0
- package/dist/registries/contribution.js.map +1 -0
- package/dist/registries/entries.d.ts +18 -0
- package/dist/registries/entries.d.ts.map +1 -0
- package/dist/registries/entries.js +42 -0
- package/dist/registries/entries.js.map +1 -0
- package/dist/registries/index.d.ts +3 -0
- package/dist/registries/index.d.ts.map +1 -0
- package/dist/registries/index.js +5 -0
- package/dist/registries/index.js.map +1 -0
- package/dist/registries/internal.d.ts +4 -0
- package/dist/registries/internal.d.ts.map +1 -0
- package/dist/registries/internal.js +5 -0
- package/dist/registries/internal.js.map +1 -0
- package/dist/registries/record.d.ts +115 -0
- package/dist/registries/record.d.ts.map +1 -0
- package/dist/registries/record.js +283 -0
- package/dist/registries/record.js.map +1 -0
- package/dist/registries/registry.d.ts +74 -0
- package/dist/registries/registry.d.ts.map +1 -0
- package/dist/registries/registry.js +14 -0
- package/dist/registries/registry.js.map +1 -0
- package/dist/registries/value.d.ts +48 -0
- package/dist/registries/value.d.ts.map +1 -0
- package/dist/registries/value.js +224 -0
- package/dist/registries/value.js.map +1 -0
- package/dist/remote/calls.d.ts +34 -0
- package/dist/remote/calls.d.ts.map +1 -0
- package/dist/remote/calls.js +75 -0
- package/dist/remote/calls.js.map +1 -0
- package/dist/remote/consumer.d.ts +59 -0
- package/dist/remote/consumer.d.ts.map +1 -0
- package/dist/remote/consumer.js +468 -0
- package/dist/remote/consumer.js.map +1 -0
- package/dist/remote/hold.d.ts +147 -0
- package/dist/remote/hold.d.ts.map +1 -0
- package/dist/remote/hold.js +653 -0
- package/dist/remote/hold.js.map +1 -0
- package/dist/remote/host-link.d.ts +81 -0
- package/dist/remote/host-link.d.ts.map +1 -0
- package/dist/remote/host-link.js +198 -0
- package/dist/remote/host-link.js.map +1 -0
- package/dist/remote/internal.d.ts +6 -0
- package/dist/remote/internal.d.ts.map +1 -0
- package/dist/remote/internal.js +6 -0
- package/dist/remote/internal.js.map +1 -0
- package/dist/remote/path.d.ts +105 -0
- package/dist/remote/path.d.ts.map +1 -0
- package/dist/remote/path.js +197 -0
- package/dist/remote/path.js.map +1 -0
- package/dist/remote/provider.d.ts +113 -0
- package/dist/remote/provider.d.ts.map +1 -0
- package/dist/remote/provider.js +787 -0
- package/dist/remote/provider.js.map +1 -0
- package/dist/remote/relay.d.ts +126 -0
- package/dist/remote/relay.d.ts.map +1 -0
- package/dist/remote/relay.js +334 -0
- package/dist/remote/relay.js.map +1 -0
- package/dist/remote/remote-object.d.ts +181 -0
- package/dist/remote/remote-object.d.ts.map +1 -0
- package/dist/remote/remote-object.js +683 -0
- package/dist/remote/remote-object.js.map +1 -0
- package/dist/remote/replica.d.ts +66 -0
- package/dist/remote/replica.d.ts.map +1 -0
- package/dist/remote/replica.js +148 -0
- package/dist/remote/replica.js.map +1 -0
- package/dist/sqlite/cloudflare.d.ts +54 -0
- package/dist/sqlite/cloudflare.d.ts.map +1 -0
- package/dist/sqlite/cloudflare.js +144 -0
- package/dist/sqlite/cloudflare.js.map +1 -0
- package/dist/sqlite/database.d.ts +40 -0
- package/dist/sqlite/database.d.ts.map +1 -0
- package/dist/sqlite/database.js +2 -0
- package/dist/sqlite/database.js.map +1 -0
- package/dist/sqlite/index.d.ts +4 -0
- package/dist/sqlite/index.d.ts.map +1 -0
- package/dist/sqlite/index.js +3 -0
- package/dist/sqlite/index.js.map +1 -0
- package/dist/sqlite/migrations.d.ts +10 -0
- package/dist/sqlite/migrations.d.ts.map +1 -0
- package/dist/sqlite/migrations.js +33 -0
- package/dist/sqlite/migrations.js.map +1 -0
- package/dist/sqlite/node.d.ts +49 -0
- package/dist/sqlite/node.d.ts.map +1 -0
- package/dist/sqlite/node.js +197 -0
- package/dist/sqlite/node.js.map +1 -0
- package/dist/sqlite/schema.d.ts +3 -0
- package/dist/sqlite/schema.d.ts.map +1 -0
- package/dist/sqlite/schema.js +10 -0
- package/dist/sqlite/schema.js.map +1 -0
- package/dist/state/batch.d.ts +64 -0
- package/dist/state/batch.d.ts.map +1 -0
- package/dist/state/batch.js +164 -0
- package/dist/state/batch.js.map +1 -0
- package/dist/state/derive.d.ts +56 -0
- package/dist/state/derive.d.ts.map +1 -0
- package/dist/state/derive.js +192 -0
- package/dist/state/derive.js.map +1 -0
- package/dist/state/framed.d.ts +43 -0
- package/dist/state/framed.d.ts.map +1 -0
- package/dist/state/framed.js +121 -0
- package/dist/state/framed.js.map +1 -0
- package/dist/state/index.d.ts +6 -0
- package/dist/state/index.d.ts.map +1 -0
- package/dist/state/index.js +4 -0
- package/dist/state/index.js.map +1 -0
- package/dist/state/internal.d.ts +7 -0
- package/dist/state/internal.d.ts.map +1 -0
- package/dist/state/internal.js +9 -0
- package/dist/state/internal.js.map +1 -0
- package/dist/state/native-source.d.ts +106 -0
- package/dist/state/native-source.d.ts.map +1 -0
- package/dist/state/native-source.js +240 -0
- package/dist/state/native-source.js.map +1 -0
- package/dist/state/watchable.d.ts +114 -0
- package/dist/state/watchable.d.ts.map +1 -0
- package/dist/state/watchable.js +156 -0
- package/dist/state/watchable.js.map +1 -0
- package/dist/state/writable.d.ts +32 -0
- package/dist/state/writable.d.ts.map +1 -0
- package/dist/state/writable.js +49 -0
- package/dist/state/writable.js.map +1 -0
- package/dist/store/adapter.d.ts +67 -0
- package/dist/store/adapter.d.ts.map +1 -0
- package/dist/store/adapter.js +118 -0
- package/dist/store/adapter.js.map +1 -0
- package/dist/store/allocator.d.ts +17 -0
- package/dist/store/allocator.d.ts.map +1 -0
- package/dist/store/allocator.js +30 -0
- package/dist/store/allocator.js.map +1 -0
- package/dist/store/applier.d.ts +8 -0
- package/dist/store/applier.d.ts.map +1 -0
- package/dist/store/applier.js +390 -0
- package/dist/store/applier.js.map +1 -0
- package/dist/store/apply-batch.d.ts +12 -0
- package/dist/store/apply-batch.d.ts.map +1 -0
- package/dist/store/apply-batch.js +83 -0
- package/dist/store/apply-batch.js.map +1 -0
- package/dist/store/archive.d.ts +36 -0
- package/dist/store/archive.d.ts.map +1 -0
- package/dist/store/archive.js +140 -0
- package/dist/store/archive.js.map +1 -0
- package/dist/store/backend.d.ts +10 -0
- package/dist/store/backend.d.ts.map +1 -0
- package/dist/store/backend.js +15 -0
- package/dist/store/backend.js.map +1 -0
- package/dist/store/catalog.d.ts +24 -0
- package/dist/store/catalog.d.ts.map +1 -0
- package/dist/store/catalog.js +17 -0
- package/dist/store/catalog.js.map +1 -0
- package/dist/store/claims.d.ts +23 -0
- package/dist/store/claims.d.ts.map +1 -0
- package/dist/store/claims.js +65 -0
- package/dist/store/claims.js.map +1 -0
- package/dist/store/column-set.d.ts +64 -0
- package/dist/store/column-set.d.ts.map +1 -0
- package/dist/store/column-set.js +96 -0
- package/dist/store/column-set.js.map +1 -0
- package/dist/store/columns.d.ts +93 -0
- package/dist/store/columns.d.ts.map +1 -0
- package/dist/store/columns.js +87 -0
- package/dist/store/columns.js.map +1 -0
- package/dist/store/engine.d.ts +182 -0
- package/dist/store/engine.d.ts.map +1 -0
- package/dist/store/engine.js +290 -0
- package/dist/store/engine.js.map +1 -0
- package/dist/store/evaluate.d.ts +17 -0
- package/dist/store/evaluate.d.ts.map +1 -0
- package/dist/store/evaluate.js +131 -0
- package/dist/store/evaluate.js.map +1 -0
- package/dist/store/export.d.ts +30 -0
- package/dist/store/export.d.ts.map +1 -0
- package/dist/store/export.js +221 -0
- package/dist/store/export.js.map +1 -0
- package/dist/store/expression.d.ts +254 -0
- package/dist/store/expression.d.ts.map +1 -0
- package/dist/store/expression.js +577 -0
- package/dist/store/expression.js.map +1 -0
- package/dist/store/host-column.d.ts +22 -0
- package/dist/store/host-column.d.ts.map +1 -0
- package/dist/store/host-column.js +36 -0
- package/dist/store/host-column.js.map +1 -0
- package/dist/store/host-data.d.ts +100 -0
- package/dist/store/host-data.d.ts.map +1 -0
- package/dist/store/host-data.js +397 -0
- package/dist/store/host-data.js.map +1 -0
- package/dist/store/import-migration.d.ts +19 -0
- package/dist/store/import-migration.d.ts.map +1 -0
- package/dist/store/import-migration.js +124 -0
- package/dist/store/import-migration.js.map +1 -0
- package/dist/store/import.d.ts +12 -0
- package/dist/store/import.d.ts.map +1 -0
- package/dist/store/import.js +279 -0
- package/dist/store/import.js.map +1 -0
- package/dist/store/index.d.ts +19 -0
- package/dist/store/index.d.ts.map +1 -0
- package/dist/store/index.js +16 -0
- package/dist/store/index.js.map +1 -0
- package/dist/store/json-column.d.ts +33 -0
- package/dist/store/json-column.d.ts.map +1 -0
- package/dist/store/json-column.js +62 -0
- package/dist/store/json-column.js.map +1 -0
- package/dist/store/jsonl.d.ts +9 -0
- package/dist/store/jsonl.d.ts.map +1 -0
- package/dist/store/jsonl.js +61 -0
- package/dist/store/jsonl.js.map +1 -0
- package/dist/store/live-query.d.ts +72 -0
- package/dist/store/live-query.d.ts.map +1 -0
- package/dist/store/live-query.js +162 -0
- package/dist/store/live-query.js.map +1 -0
- package/dist/store/open-query.d.ts +90 -0
- package/dist/store/open-query.d.ts.map +1 -0
- package/dist/store/open-query.js +201 -0
- package/dist/store/open-query.js.map +1 -0
- package/dist/store/outbox.d.ts +26 -0
- package/dist/store/outbox.d.ts.map +1 -0
- package/dist/store/outbox.js +80 -0
- package/dist/store/outbox.js.map +1 -0
- package/dist/store/page.d.ts +14 -0
- package/dist/store/page.d.ts.map +1 -0
- package/dist/store/page.js +26 -0
- package/dist/store/page.js.map +1 -0
- package/dist/store/query.d.ts +65 -0
- package/dist/store/query.d.ts.map +1 -0
- package/dist/store/query.js +193 -0
- package/dist/store/query.js.map +1 -0
- package/dist/store/read-plan.d.ts +74 -0
- package/dist/store/read-plan.d.ts.map +1 -0
- package/dist/store/read-plan.js +324 -0
- package/dist/store/read-plan.js.map +1 -0
- package/dist/store/read.d.ts +81 -0
- package/dist/store/read.d.ts.map +1 -0
- package/dist/store/read.js +113 -0
- package/dist/store/read.js.map +1 -0
- package/dist/store/reads.d.ts +79 -0
- package/dist/store/reads.d.ts.map +1 -0
- package/dist/store/reads.js +255 -0
- package/dist/store/reads.js.map +1 -0
- package/dist/store/refusal.d.ts +15 -0
- package/dist/store/refusal.d.ts.map +1 -0
- package/dist/store/refusal.js +36 -0
- package/dist/store/refusal.js.map +1 -0
- package/dist/store/rows.d.ts +96 -0
- package/dist/store/rows.d.ts.map +1 -0
- package/dist/store/rows.js +222 -0
- package/dist/store/rows.js.map +1 -0
- package/dist/store/schema.d.ts +25 -0
- package/dist/store/schema.d.ts.map +1 -0
- package/dist/store/schema.js +123 -0
- package/dist/store/schema.js.map +1 -0
- package/dist/store/skip.d.ts +26 -0
- package/dist/store/skip.d.ts.map +1 -0
- package/dist/store/skip.js +66 -0
- package/dist/store/skip.js.map +1 -0
- package/dist/store/sql.d.ts +78 -0
- package/dist/store/sql.d.ts.map +1 -0
- package/dist/store/sql.js +244 -0
- package/dist/store/sql.js.map +1 -0
- package/dist/store/step.d.ts +52 -0
- package/dist/store/step.d.ts.map +1 -0
- package/dist/store/step.js +59 -0
- package/dist/store/step.js.map +1 -0
- package/dist/store/store.d.ts +192 -0
- package/dist/store/store.d.ts.map +1 -0
- package/dist/store/store.js +863 -0
- package/dist/store/store.js.map +1 -0
- package/dist/store/table-changes.d.ts +35 -0
- package/dist/store/table-changes.d.ts.map +1 -0
- package/dist/store/table-changes.js +127 -0
- package/dist/store/table-changes.js.map +1 -0
- package/dist/store/table-evolve.d.ts +82 -0
- package/dist/store/table-evolve.d.ts.map +1 -0
- package/dist/store/table-evolve.js +208 -0
- package/dist/store/table-evolve.js.map +1 -0
- package/dist/store/table-handle.d.ts +69 -0
- package/dist/store/table-handle.d.ts.map +1 -0
- package/dist/store/table-handle.js +92 -0
- package/dist/store/table-handle.js.map +1 -0
- package/dist/store/table-history.d.ts +78 -0
- package/dist/store/table-history.d.ts.map +1 -0
- package/dist/store/table-history.js +43 -0
- package/dist/store/table-history.js.map +1 -0
- package/dist/store/table-migration.d.ts +28 -0
- package/dist/store/table-migration.d.ts.map +1 -0
- package/dist/store/table-migration.js +212 -0
- package/dist/store/table-migration.js.map +1 -0
- package/dist/store/table-writes.d.ts +125 -0
- package/dist/store/table-writes.d.ts.map +1 -0
- package/dist/store/table-writes.js +170 -0
- package/dist/store/table-writes.js.map +1 -0
- package/dist/store/table.d.ts +91 -0
- package/dist/store/table.d.ts.map +1 -0
- package/dist/store/table.js +133 -0
- package/dist/store/table.js.map +1 -0
- package/dist/store/text.d.ts +14 -0
- package/dist/store/text.d.ts.map +1 -0
- package/dist/store/text.js +51 -0
- package/dist/store/text.js.map +1 -0
- package/dist/store/writes.d.ts +5 -0
- package/dist/store/writes.d.ts.map +1 -0
- package/dist/store/writes.js +4 -0
- package/dist/store/writes.js.map +1 -0
- package/dist/surfaces/active-language.d.ts +20 -0
- package/dist/surfaces/active-language.d.ts.map +1 -0
- package/dist/surfaces/active-language.js +78 -0
- package/dist/surfaces/active-language.js.map +1 -0
- package/dist/surfaces/active-theme.d.ts +16 -0
- package/dist/surfaces/active-theme.d.ts.map +1 -0
- package/dist/surfaces/active-theme.js +47 -0
- package/dist/surfaces/active-theme.js.map +1 -0
- package/dist/surfaces/client.d.ts +106 -0
- package/dist/surfaces/client.d.ts.map +1 -0
- package/dist/surfaces/client.js +280 -0
- package/dist/surfaces/client.js.map +1 -0
- package/dist/surfaces/connection.d.ts +53 -0
- package/dist/surfaces/connection.d.ts.map +1 -0
- package/dist/surfaces/connection.js +161 -0
- package/dist/surfaces/connection.js.map +1 -0
- package/dist/surfaces/format.d.ts +5 -0
- package/dist/surfaces/format.d.ts.map +1 -0
- package/dist/surfaces/format.js +37 -0
- package/dist/surfaces/format.js.map +1 -0
- package/dist/surfaces/index.d.ts +15 -0
- package/dist/surfaces/index.d.ts.map +1 -0
- package/dist/surfaces/index.js +18 -0
- package/dist/surfaces/index.js.map +1 -0
- package/dist/surfaces/language.d.ts +53 -0
- package/dist/surfaces/language.d.ts.map +1 -0
- package/dist/surfaces/language.js +74 -0
- package/dist/surfaces/language.js.map +1 -0
- package/dist/surfaces/loaded.d.ts +42 -0
- package/dist/surfaces/loaded.d.ts.map +1 -0
- package/dist/surfaces/loaded.js +116 -0
- package/dist/surfaces/loaded.js.map +1 -0
- package/dist/surfaces/locale-choice.d.ts +26 -0
- package/dist/surfaces/locale-choice.d.ts.map +1 -0
- package/dist/surfaces/locale-choice.js +14 -0
- package/dist/surfaces/locale-choice.js.map +1 -0
- package/dist/surfaces/messages.d.ts +67 -0
- package/dist/surfaces/messages.d.ts.map +1 -0
- package/dist/surfaces/messages.js +112 -0
- package/dist/surfaces/messages.js.map +1 -0
- package/dist/surfaces/page-state.d.ts +14 -0
- package/dist/surfaces/page-state.d.ts.map +1 -0
- package/dist/surfaces/page-state.js +43 -0
- package/dist/surfaces/page-state.js.map +1 -0
- package/dist/surfaces/preference.d.ts +33 -0
- package/dist/surfaces/preference.d.ts.map +1 -0
- package/dist/surfaces/preference.js +72 -0
- package/dist/surfaces/preference.js.map +1 -0
- package/dist/surfaces/registered.d.ts +33 -0
- package/dist/surfaces/registered.d.ts.map +1 -0
- package/dist/surfaces/registered.js +51 -0
- package/dist/surfaces/registered.js.map +1 -0
- package/dist/surfaces/scripts.d.ts +86 -0
- package/dist/surfaces/scripts.d.ts.map +1 -0
- package/dist/surfaces/scripts.js +28 -0
- package/dist/surfaces/scripts.js.map +1 -0
- package/dist/surfaces/theme-choice.d.ts +32 -0
- package/dist/surfaces/theme-choice.d.ts.map +1 -0
- package/dist/surfaces/theme-choice.js +18 -0
- package/dist/surfaces/theme-choice.js.map +1 -0
- package/dist/surfaces/themes.d.ts +43 -0
- package/dist/surfaces/themes.d.ts.map +1 -0
- package/dist/surfaces/themes.js +110 -0
- package/dist/surfaces/themes.js.map +1 -0
- package/dist/surfaces/translations.d.ts +29 -0
- package/dist/surfaces/translations.d.ts.map +1 -0
- package/dist/surfaces/translations.js +57 -0
- package/dist/surfaces/translations.js.map +1 -0
- package/dist/surfaces/variant.d.ts +23 -0
- package/dist/surfaces/variant.d.ts.map +1 -0
- package/dist/surfaces/variant.js +18 -0
- package/dist/surfaces/variant.js.map +1 -0
- package/dist/sync/batch.d.ts +18 -0
- package/dist/sync/batch.d.ts.map +1 -0
- package/dist/sync/batch.js +125 -0
- package/dist/sync/batch.js.map +1 -0
- package/dist/sync/client.d.ts +169 -0
- package/dist/sync/client.d.ts.map +1 -0
- package/dist/sync/client.js +459 -0
- package/dist/sync/client.js.map +1 -0
- package/dist/sync/files.d.ts +46 -0
- package/dist/sync/files.d.ts.map +1 -0
- package/dist/sync/files.js +13 -0
- package/dist/sync/files.js.map +1 -0
- package/dist/sync/filesystem.d.ts +37 -0
- package/dist/sync/filesystem.d.ts.map +1 -0
- package/dist/sync/filesystem.js +205 -0
- package/dist/sync/filesystem.js.map +1 -0
- package/dist/sync/index.d.ts +8 -0
- package/dist/sync/index.d.ts.map +1 -0
- package/dist/sync/index.js +9 -0
- package/dist/sync/index.js.map +1 -0
- package/dist/sync/lines.d.ts +18 -0
- package/dist/sync/lines.d.ts.map +1 -0
- package/dist/sync/lines.js +46 -0
- package/dist/sync/lines.js.map +1 -0
- package/dist/sync/remote.d.ts +145 -0
- package/dist/sync/remote.d.ts.map +1 -0
- package/dist/sync/remote.js +59 -0
- package/dist/sync/remote.js.map +1 -0
- package/dist/sync/state.d.ts +17 -0
- package/dist/sync/state.d.ts.map +1 -0
- package/dist/sync/state.js +40 -0
- package/dist/sync/state.js.map +1 -0
- package/dist/telemetry-ingest/batch.d.ts +73 -0
- package/dist/telemetry-ingest/batch.d.ts.map +1 -0
- package/dist/telemetry-ingest/batch.js +110 -0
- package/dist/telemetry-ingest/batch.js.map +1 -0
- package/dist/telemetry-ingest/facet.d.ts +26 -0
- package/dist/telemetry-ingest/facet.d.ts.map +1 -0
- package/dist/telemetry-ingest/facet.js +100 -0
- package/dist/telemetry-ingest/facet.js.map +1 -0
- package/dist/telemetry-ingest/index.d.ts +5 -0
- package/dist/telemetry-ingest/index.d.ts.map +1 -0
- package/dist/telemetry-ingest/index.js +8 -0
- package/dist/telemetry-ingest/index.js.map +1 -0
- package/dist/telemetry-ingest/recorder.d.ts +50 -0
- package/dist/telemetry-ingest/recorder.d.ts.map +1 -0
- package/dist/telemetry-ingest/recorder.js +298 -0
- package/dist/telemetry-ingest/recorder.js.map +1 -0
- package/dist/telemetry-ingest/sender.d.ts +14 -0
- package/dist/telemetry-ingest/sender.d.ts.map +1 -0
- package/dist/telemetry-ingest/sender.js +64 -0
- package/dist/telemetry-ingest/sender.js.map +1 -0
- package/dist/telemetry-sqlite/index.d.ts +33 -0
- package/dist/telemetry-sqlite/index.d.ts.map +1 -0
- package/dist/telemetry-sqlite/index.js +113 -0
- package/dist/telemetry-sqlite/index.js.map +1 -0
- package/dist/telemetry-sqlite/node.d.ts +13 -0
- package/dist/telemetry-sqlite/node.d.ts.map +1 -0
- package/dist/telemetry-sqlite/node.js +27 -0
- package/dist/telemetry-sqlite/node.js.map +1 -0
- package/dist/telemetry-sqlite/schema.d.ts +9 -0
- package/dist/telemetry-sqlite/schema.d.ts.map +1 -0
- package/dist/telemetry-sqlite/schema.js +61 -0
- package/dist/telemetry-sqlite/schema.js.map +1 -0
- package/dist/telemetry-sqlite/store.d.ts +12 -0
- package/dist/telemetry-sqlite/store.d.ts.map +1 -0
- package/dist/telemetry-sqlite/store.js +121 -0
- package/dist/telemetry-sqlite/store.js.map +1 -0
- package/dist/telemetry.d.ts +1013 -0
- package/dist/telemetry.d.ts.map +1 -0
- package/dist/telemetry.js +518 -0
- package/dist/telemetry.js.map +1 -0
- package/dist/tui/bridge.d.ts +112 -0
- package/dist/tui/bridge.d.ts.map +1 -0
- package/dist/tui/bridge.js +9 -0
- package/dist/tui/bridge.js.map +1 -0
- package/dist/tui/channel.d.ts +44 -0
- package/dist/tui/channel.d.ts.map +1 -0
- package/dist/tui/channel.js +150 -0
- package/dist/tui/channel.js.map +1 -0
- package/dist/tui/frames.d.ts +5 -0
- package/dist/tui/frames.d.ts.map +1 -0
- package/dist/tui/frames.js +52 -0
- package/dist/tui/frames.js.map +1 -0
- package/dist/tui/index.d.ts +8 -0
- package/dist/tui/index.d.ts.map +1 -0
- package/dist/tui/index.js +8 -0
- package/dist/tui/index.js.map +1 -0
- package/dist/tui/runtime.d.ts +46 -0
- package/dist/tui/runtime.d.ts.map +1 -0
- package/dist/tui/runtime.js +101 -0
- package/dist/tui/runtime.js.map +1 -0
- package/dist/tui/scope.d.ts +62 -0
- package/dist/tui/scope.d.ts.map +1 -0
- package/dist/tui/scope.js +173 -0
- package/dist/tui/scope.js.map +1 -0
- package/dist/tui/terminal.d.ts +15 -0
- package/dist/tui/terminal.d.ts.map +1 -0
- package/dist/tui/terminal.js +37 -0
- package/dist/tui/terminal.js.map +1 -0
- package/dist/tui/theme.d.ts +17 -0
- package/dist/tui/theme.d.ts.map +1 -0
- package/dist/tui/theme.js +38 -0
- package/dist/tui/theme.js.map +1 -0
- package/dist/watch.d.ts +194 -0
- package/dist/watch.d.ts.map +1 -0
- package/dist/watch.js +383 -0
- package/dist/watch.js.map +1 -0
- package/dist/web/environment.d.ts +4 -0
- package/dist/web/environment.d.ts.map +1 -0
- package/dist/web/environment.js +37 -0
- package/dist/web/environment.js.map +1 -0
- package/dist/web/index.d.ts +5 -0
- package/dist/web/index.d.ts.map +1 -0
- package/dist/web/index.js +7 -0
- package/dist/web/index.js.map +1 -0
- package/dist/web/language.d.ts +7 -0
- package/dist/web/language.d.ts.map +1 -0
- package/dist/web/language.js +21 -0
- package/dist/web/language.js.map +1 -0
- package/dist/web/page.d.ts +42 -0
- package/dist/web/page.d.ts.map +1 -0
- package/dist/web/page.js +96 -0
- package/dist/web/page.js.map +1 -0
- package/dist/web/scripts.d.ts +23 -0
- package/dist/web/scripts.d.ts.map +1 -0
- package/dist/web/scripts.js +50 -0
- package/dist/web/scripts.js.map +1 -0
- package/dist/web/styles.d.ts +17 -0
- package/dist/web/styles.d.ts.map +1 -0
- package/dist/web/styles.js +218 -0
- package/dist/web/styles.js.map +1 -0
- package/dist/web/themes.d.ts +6 -0
- package/dist/web/themes.d.ts.map +1 -0
- package/dist/web/themes.js +31 -0
- package/dist/web/themes.js.map +1 -0
- package/docs/admission/design.md +178 -0
- package/docs/benchmarks.md +1182 -0
- package/docs/decisions.md +3760 -0
- package/docs/dependencies/book.md +1671 -0
- package/docs/dependencies/index.html +2641 -0
- package/docs/dependencies/model.md +330 -0
- package/docs/design.md +3691 -0
- package/docs/durable-observers/book.md +432 -0
- package/docs/durable-observers/index.html +517 -0
- package/docs/events/spec.md +438 -0
- package/docs/flow-control/book.md +333 -0
- package/docs/flow-control/fold/index.html +265 -0
- package/docs/flow-control/index.html +548 -0
- package/docs/flow-control/window/index.html +228 -0
- package/docs/guide-plugins-hosts/book.md +958 -0
- package/docs/guide-plugins-hosts/index.html +952 -0
- package/docs/host-keyed/spec.md +343 -0
- package/docs/http-workers/book.md +378 -0
- package/docs/http-workers/index.html +515 -0
- package/docs/i18n/book.md +217 -0
- package/docs/i18n/index.html +344 -0
- package/docs/layer-1.md +311 -0
- package/docs/layer-2.md +216 -0
- package/docs/p3-features/README.md +6 -0
- package/docs/p3-features/book.md +478 -0
- package/docs/plugin-authoring.md +389 -0
- package/docs/plugin-model/book.md +186 -0
- package/docs/plugin-model/index.html +310 -0
- package/docs/plugin-primer/book.md +273 -0
- package/docs/plugin-primer/index.html +430 -0
- package/docs/shared-holds/design.md +339 -0
- package/docs/slice-1.md +236 -0
- package/docs/slice-10.md +288 -0
- package/docs/slice-11.md +114 -0
- package/docs/slice-12.md +132 -0
- package/docs/slice-13.md +121 -0
- package/docs/slice-14-design.md +213 -0
- package/docs/slice-14.md +861 -0
- package/docs/slice-2.md +174 -0
- package/docs/slice-3a.md +296 -0
- package/docs/slice-3b.md +197 -0
- package/docs/slice-4.md +146 -0
- package/docs/slice-4a.md +418 -0
- package/docs/slice-4b.md +208 -0
- package/docs/slice-5.md +281 -0
- package/docs/slice-6a.md +676 -0
- package/docs/slice-6b.md +332 -0
- package/docs/slice-7a.md +130 -0
- package/docs/slice-7b/book.md +608 -0
- package/docs/slice-7b/index.html +842 -0
- package/docs/slice-7b.md +255 -0
- package/docs/slice-7c.md +165 -0
- package/docs/slice-8.md +194 -0
- package/docs/slice-9.md +110 -0
- package/docs/slices.md +380 -0
- package/docs/store/book.md +670 -0
- package/docs/store/index.html +861 -0
- package/docs/store/walkthrough.md +193 -0
- package/docs/theming/book.md +223 -0
- package/docs/theming/index.html +371 -0
- package/docs/tutorial/book.md +2170 -0
- package/docs/tutorial/index.html +2112 -0
- package/docs/tutorial/screens/click-after.png +0 -0
- package/docs/tutorial/screens/click-before.png +0 -0
- package/docs/tutorial/screens/edited.png +0 -0
- package/docs/tutorial/screens/french.png +0 -0
- package/docs/tutorial/screens/harbor.png +0 -0
- package/docs/tutorial/screens/page.png +0 -0
- package/docs/tutorial/screens/traces-ada.png +0 -0
- package/docs/tutorial/screens/traces.png +0 -0
- package/package.json +200 -5
- package/src/delta/README.md +262 -0
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
// The worker base (decision "Workers start from the base code the server booted with"): a worker kind's entry and the
|
|
2
|
+
// base code it imports, bundled once by esbuild when the workers component builds it (the kit: right after the server
|
|
3
|
+
// listens), as the surfaces build their base bundles. Every worker of the kind is forked from this snapshot, so an edit
|
|
4
|
+
// of the app's source while the server runs reaches workers only through a restart of the server. Packages installed under `node_modules` (native
|
|
5
|
+
// addons, packages reading their own files) and Node builtins stay external: Node loads them at each fork from where
|
|
6
|
+
// the build resolved them. Everything else, the app's files and workspace packages linked into `node_modules`, is
|
|
7
|
+
// inlined. The bundle is split at each dynamic `import()` esbuild can follow: the entry module and the chunks it imports
|
|
8
|
+
// statically load at each fork, a lazily imported module (diffra-ai's provider APIs and the packages they import) only when
|
|
9
|
+
// the worker imports it. Every file is an ES module with its source map beside it (`<name>.mjs.map`, linked from its
|
|
10
|
+
// last line; an inline one would be text of the module V8 keeps, and Node keeps its decoded copy), written at the first
|
|
11
|
+
// fork (`file()`; a handle never forked writes nothing) into one private directory its handle owns and removes: a new temporary one, or
|
|
12
|
+
// one the caller names (the kit's per kind in the data directory: the same path at every start, so Node's compile cache
|
|
13
|
+
// knows the files). Every file the build read is recorded with its bytes' hash
|
|
14
|
+
// (`BaseInputs`), as its one read hands them to esbuild.
|
|
15
|
+
import { existsSync, mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
16
|
+
import { isBuiltin } from "node:module";
|
|
17
|
+
import { tmpdir } from "node:os";
|
|
18
|
+
import { basename, dirname, extname, join, parse, resolve, sep } from "node:path";
|
|
19
|
+
import { pathToFileURL } from "node:url";
|
|
20
|
+
import { build } from "esbuild";
|
|
21
|
+
import { readRecorded, recordedSources } from "../plugins/base-inputs.js";
|
|
22
|
+
import { conditionsOf } from "../surfaces/bundle.js";
|
|
23
|
+
/**
|
|
24
|
+
* What `import.meta.url`, `.dirname` and `.filename` (and a CommonJS file's free `__dirname` and `__filename`) become: a
|
|
25
|
+
* module's own constants (`moduleLocations`).
|
|
26
|
+
*/
|
|
27
|
+
const MODULE_URL = "__chordModuleUrl";
|
|
28
|
+
const MODULE_DIRNAME = "__chordModuleDirname";
|
|
29
|
+
const MODULE_FILENAME = "__chordModuleFilename";
|
|
30
|
+
/** The entry module's name in the bundle's directory (`worker.mjs`); chunks are named `<name>-<hash>.mjs`. */
|
|
31
|
+
const ENTRY_NAME = "worker";
|
|
32
|
+
/**
|
|
33
|
+
* Bundles `entry` for workers forked with `execArgv` (its `--conditions` resolve imports as the child's Node would),
|
|
34
|
+
* in memory; its files are written at the handle's first `file()`, into `dir` (a private directory the handle owns:
|
|
35
|
+
* emptied first, removed by `remove`) or, without one, a new temporary directory. Rejects with esbuild's failure.
|
|
36
|
+
*/
|
|
37
|
+
export async function buildWorkerBase(entry, execArgv, dir) {
|
|
38
|
+
// Built as if at the file system's root: the source map's paths relative to it, made absolute by `sourceRoot`.
|
|
39
|
+
const root = parse(resolve(entry)).root;
|
|
40
|
+
const inputs = new Map();
|
|
41
|
+
const result = await build({
|
|
42
|
+
entryPoints: [{ in: entry, out: ENTRY_NAME }],
|
|
43
|
+
// One flat directory: every chunk imports the others as `./<name>`, and the source maps' paths stay relative to
|
|
44
|
+
// the root.
|
|
45
|
+
outdir: root,
|
|
46
|
+
entryNames: "[name]",
|
|
47
|
+
chunkNames: "[name]-[hash]",
|
|
48
|
+
outExtension: { ".js": ".mjs" },
|
|
49
|
+
// A dynamic `import()` esbuild can follow becomes a chunk Node loads only when the worker imports it, with the
|
|
50
|
+
// packages it imports: inlined into one module, every lazily imported module would load and run at each fork.
|
|
51
|
+
splitting: true,
|
|
52
|
+
write: false,
|
|
53
|
+
bundle: true,
|
|
54
|
+
format: "esm",
|
|
55
|
+
platform: "node",
|
|
56
|
+
// Node's own resolution: the child's conditions, `main` only (no `module` condition or field).
|
|
57
|
+
conditions: conditionsOf(execArgv),
|
|
58
|
+
mainFields: ["main"],
|
|
59
|
+
// Every imported module runs, as Node runs it: `sideEffects: false` and pure annotations drop none (the entry's
|
|
60
|
+
// own package may say it, as Chord's does).
|
|
61
|
+
ignoreAnnotations: true,
|
|
62
|
+
// Function and class names as the source has them (`name` stays what unbundled code sees).
|
|
63
|
+
keepNames: true,
|
|
64
|
+
// Minified but for the names: every worker holds the base's source text, and V8 keeps a text with any non-ASCII
|
|
65
|
+
// character (a comment's `§`) as UTF-16, twice its size.
|
|
66
|
+
minifyWhitespace: true,
|
|
67
|
+
minifySyntax: true,
|
|
68
|
+
sourcemap: "linked",
|
|
69
|
+
sourcesContent: false,
|
|
70
|
+
sourceRoot: pathToFileURL(root).href,
|
|
71
|
+
// A CommonJS file of the base code requires through this (each chunk has its own); external packages by their
|
|
72
|
+
// absolute paths.
|
|
73
|
+
banner: {
|
|
74
|
+
js: 'import { createRequire as __chordCreateRequire } from "node:module"; const require = __chordCreateRequire(import.meta.url);',
|
|
75
|
+
},
|
|
76
|
+
define: {
|
|
77
|
+
"import.meta.url": MODULE_URL,
|
|
78
|
+
"import.meta.dirname": MODULE_DIRNAME,
|
|
79
|
+
"import.meta.filename": MODULE_FILENAME,
|
|
80
|
+
__dirname: MODULE_DIRNAME,
|
|
81
|
+
__filename: MODULE_FILENAME,
|
|
82
|
+
},
|
|
83
|
+
plugins: [installedPackages(), moduleLocations(inputs), recordedSources(inputs)],
|
|
84
|
+
logLevel: "silent",
|
|
85
|
+
});
|
|
86
|
+
const files = result.outputFiles.map((output) => ({ name: basename(output.path), contents: output.contents }));
|
|
87
|
+
return new BundleFiles(files, inputs, dir);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* The files of the static import graph of Node code started from `entry` with `conditions`, with their bytes' hashes: a
|
|
91
|
+
* best-effort scan (esbuild bundles it only to record what it reads; nothing is written or run). It sees the literal
|
|
92
|
+
* imports of the graph, including lazy literal `import()`s Node may never run (conservative: such a file's edit asks
|
|
93
|
+
* for a restart); a computed `import(x)` and modules a loader provides are not seen, and an import that does not
|
|
94
|
+
* resolve (an inactive optional import of a missing file or package, a loader's scheme) is left out. It resolves as
|
|
95
|
+
* Node does: the conditions, `main`, no `tsconfig.json` `paths`; installed packages are left out (never compared).
|
|
96
|
+
* Rejects with esbuild's failure for anything else (a file it cannot parse).
|
|
97
|
+
*/
|
|
98
|
+
export async function nodeBaseInputs(entry, conditions) {
|
|
99
|
+
const inputs = new Map();
|
|
100
|
+
await build({
|
|
101
|
+
entryPoints: [entry],
|
|
102
|
+
write: false,
|
|
103
|
+
bundle: true,
|
|
104
|
+
format: "esm",
|
|
105
|
+
platform: "node",
|
|
106
|
+
conditions: [...conditions],
|
|
107
|
+
mainFields: ["main"],
|
|
108
|
+
// Node reads no tsconfig.json: its `paths` would resolve an import elsewhere than Node does.
|
|
109
|
+
tsconfigRaw: "{}",
|
|
110
|
+
// Every file the bundle reaches is read, as Node would load it; the output is dropped.
|
|
111
|
+
ignoreAnnotations: true,
|
|
112
|
+
plugins: [staticGraph(), recordedSources(inputs)],
|
|
113
|
+
logLevel: "silent",
|
|
114
|
+
});
|
|
115
|
+
return inputs;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* The scan's resolution (`nodeBaseInputs`): an import resolving under a `node_modules` directory and one that does not
|
|
119
|
+
* resolve at all are left out (external); the rest resolves as esbuild does.
|
|
120
|
+
*/
|
|
121
|
+
function staticGraph() {
|
|
122
|
+
return {
|
|
123
|
+
name: "chord-node-base-static-graph",
|
|
124
|
+
setup(builder) {
|
|
125
|
+
builder.onResolve({ filter: /.*/ }, async (args) => {
|
|
126
|
+
if (args.pluginData === RESOLVING || args.kind === "entry-point" || isBuiltin(args.path))
|
|
127
|
+
return undefined;
|
|
128
|
+
const resolved = await builder.resolve(args.path, {
|
|
129
|
+
kind: args.kind,
|
|
130
|
+
importer: args.importer,
|
|
131
|
+
resolveDir: args.resolveDir,
|
|
132
|
+
pluginData: RESOLVING,
|
|
133
|
+
});
|
|
134
|
+
const outside = resolved.errors.length > 0 || resolved.external || resolved.path.split(sep).includes("node_modules");
|
|
135
|
+
return outside ? { path: args.path, external: true } : resolved;
|
|
136
|
+
});
|
|
137
|
+
},
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
/** Marks the resolver's own call, so the plugin does not resolve it again. */
|
|
141
|
+
const RESOLVING = Symbol("chord.worker-base.resolving");
|
|
142
|
+
/**
|
|
143
|
+
* Keeps a package resolved under a `node_modules` directory external, by its absolute file (a URL for an `import`, a
|
|
144
|
+
* path for a `require`): the bundle lives elsewhere, so a bare specifier would not resolve from it. A workspace
|
|
145
|
+
* package resolves to its real path outside `node_modules` and is inlined. A specifier that does not resolve is left to
|
|
146
|
+
* esbuild (an error, or a warning for a `require` in a `try`).
|
|
147
|
+
*/
|
|
148
|
+
function installedPackages() {
|
|
149
|
+
return {
|
|
150
|
+
name: "chord-worker-installed-packages",
|
|
151
|
+
setup(builder) {
|
|
152
|
+
builder.onResolve({ filter: /^[^./]/ }, async (args) => {
|
|
153
|
+
if (args.pluginData === RESOLVING || isBuiltin(args.path))
|
|
154
|
+
return undefined;
|
|
155
|
+
const resolved = await builder.resolve(args.path, {
|
|
156
|
+
kind: args.kind,
|
|
157
|
+
importer: args.importer,
|
|
158
|
+
resolveDir: args.resolveDir,
|
|
159
|
+
pluginData: RESOLVING,
|
|
160
|
+
});
|
|
161
|
+
if (resolved.errors.length > 0)
|
|
162
|
+
return undefined;
|
|
163
|
+
if (!resolved.path.split(sep).includes("node_modules"))
|
|
164
|
+
return resolved;
|
|
165
|
+
const path = args.kind.startsWith("require") ? resolved.path : pathToFileURL(resolved.path).href;
|
|
166
|
+
return { path, external: true };
|
|
167
|
+
});
|
|
168
|
+
},
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
/** Whether a source names its own location. */
|
|
172
|
+
const LOCATIONS = /import\.meta|__dirname|__filename/;
|
|
173
|
+
/** The loaders of the source files `moduleLocations` reads: every extension its filter matches. */
|
|
174
|
+
const LOADERS = {
|
|
175
|
+
".js": "js",
|
|
176
|
+
".mjs": "js",
|
|
177
|
+
".cjs": "js",
|
|
178
|
+
".jsx": "jsx",
|
|
179
|
+
".ts": "ts",
|
|
180
|
+
".mts": "ts",
|
|
181
|
+
".cts": "ts",
|
|
182
|
+
".tsx": "tsx",
|
|
183
|
+
};
|
|
184
|
+
/**
|
|
185
|
+
* Keeps `import.meta.url`, `.dirname` and `.filename`, `__dirname` and `__filename` naming each module's source file, not
|
|
186
|
+
* the bundle (base code finds files beside it this way: p2's plugins directory): a module using them gets its own
|
|
187
|
+
* constants, which `define` puts in their place. Declared on its first line, so the source map's lines stay. It reads
|
|
188
|
+
* (and records in `inputs`) every source file of its extensions, which it hands to esbuild changed or as read.
|
|
189
|
+
*/
|
|
190
|
+
function moduleLocations(inputs) {
|
|
191
|
+
return {
|
|
192
|
+
name: "chord-worker-module-locations",
|
|
193
|
+
setup(builder) {
|
|
194
|
+
builder.onLoad({ filter: /\.(?:[cm]?[jt]s|[jt]sx)$/ }, async (args) => {
|
|
195
|
+
if (args.namespace !== "file")
|
|
196
|
+
return undefined;
|
|
197
|
+
const bytes = await readRecorded(args.path, inputs);
|
|
198
|
+
// The filter matched one of `LOADERS`' extensions.
|
|
199
|
+
const loader = LOADERS[extname(args.path)];
|
|
200
|
+
const source = bytes.toString("utf8");
|
|
201
|
+
if (!LOCATIONS.test(source))
|
|
202
|
+
return { contents: bytes, loader };
|
|
203
|
+
const constants = [
|
|
204
|
+
[MODULE_URL, pathToFileURL(args.path).href],
|
|
205
|
+
[MODULE_DIRNAME, dirname(args.path)],
|
|
206
|
+
[MODULE_FILENAME, args.path],
|
|
207
|
+
].map(([name, value]) => `${name} = ${JSON.stringify(value)}`);
|
|
208
|
+
return { contents: `var ${constants.join(", ")};${source}`, loader };
|
|
209
|
+
});
|
|
210
|
+
},
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* The bundle as files: written at the first `file()` (a named directory is shared with later starts: a handle whose
|
|
215
|
+
* owner closed before forking must never touch it) into its named directory (emptied first: the files of an earlier
|
|
216
|
+
* build go) or a new private temporary one, again when one of them is gone; the directory removed with the handle.
|
|
217
|
+
*/
|
|
218
|
+
class BundleFiles {
|
|
219
|
+
inputs;
|
|
220
|
+
#files;
|
|
221
|
+
#named;
|
|
222
|
+
/** Where the files were written; `undefined` before the first `file()` and after `remove`. */
|
|
223
|
+
#dir;
|
|
224
|
+
constructor(files, inputs, named) {
|
|
225
|
+
this.#files = files;
|
|
226
|
+
this.inputs = inputs;
|
|
227
|
+
this.#named = named;
|
|
228
|
+
}
|
|
229
|
+
file() {
|
|
230
|
+
// A long-running server's temporary directory may be cleaned (systemd-tmpfiles, macOS), a chunk no worker
|
|
231
|
+
// imported for a while first: a fork needs all of them. A temporary directory is a new one, never the old name:
|
|
232
|
+
// another user may have made that one since (a named directory is the app's own, private).
|
|
233
|
+
const dir = this.#dir;
|
|
234
|
+
if (dir !== undefined && this.#files.every((file) => existsSync(join(dir, file.name)))) {
|
|
235
|
+
return join(dir, `${ENTRY_NAME}.mjs`);
|
|
236
|
+
}
|
|
237
|
+
this.remove();
|
|
238
|
+
return join(this.#write(), `${ENTRY_NAME}.mjs`);
|
|
239
|
+
}
|
|
240
|
+
remove() {
|
|
241
|
+
if (this.#dir !== undefined)
|
|
242
|
+
rmSync(this.#dir, { recursive: true, force: true });
|
|
243
|
+
this.#dir = undefined;
|
|
244
|
+
}
|
|
245
|
+
/** Writes the bundle's files into its private directory (mode 0700, each file 0600); the directory. */
|
|
246
|
+
#write() {
|
|
247
|
+
let dir = this.#named;
|
|
248
|
+
if (dir === undefined)
|
|
249
|
+
dir = mkdtempSync(join(tmpdir(), "chord-worker-"));
|
|
250
|
+
else {
|
|
251
|
+
rmSync(dir, { recursive: true, force: true });
|
|
252
|
+
mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
253
|
+
}
|
|
254
|
+
for (const file of this.#files)
|
|
255
|
+
writeFileSync(join(dir, file.name), file.contents, { mode: 0o600 });
|
|
256
|
+
this.#dir = dir;
|
|
257
|
+
return dir;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
//# sourceMappingURL=base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/node/workers/base.ts"],"names":[],"mappings":"AAAA,sHAAsH;AACtH,sHAAsH;AACtH,wHAAwH;AACxH,kJAAkJ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GAAG,UAAU,MAAM,CAAC,CAAC;QACvC,CAAC;QACD,IAAI,CAAC,MAAM,EAAE,CAAC;QACd,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,GAAG,UAAU,MAAM,CAAC,CAAC;IACjD,CAAC;IAED,MAAM;QACL,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS;YAAE,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACjF,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC;IACvB,CAAC;IAED,uGAAuG;IACvG,MAAM;QACL,IAAI,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC;QACtB,IAAI,GAAG,KAAK,SAAS;YAAE,GAAG,GAAG,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,eAAe,CAAC,CAAC,CAAC;aACrE,CAAC;YACL,MAAM,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;YAC9C,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QAClD,CAAC;QACD,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,MAAM;YAAE,aAAa,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QACpG,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;QAChB,OAAO,GAAG,CAAC;IACZ,CAAC;CACD","sourcesContent":["// The worker base (decision \"Workers start from the base code the server booted with\"): a worker kind's entry and the\n// base code it imports, bundled once by esbuild when the workers component builds it (the kit: right after the server\n// listens), as the surfaces build their base bundles. Every worker of the kind is forked from this snapshot, so an edit\n// of the app's source while the server runs reaches workers only through a restart of the server. Packages installed under `node_modules` (native\n// addons, packages reading their own files) and Node builtins stay external: Node loads them at each fork from where\n// the build resolved them. Everything else, the app's files and workspace packages linked into `node_modules`, is\n// inlined. The bundle is split at each dynamic `import()` esbuild can follow: the entry module and the chunks it imports\n// statically load at each fork, a lazily imported module (diffra-ai's provider APIs and the packages they import) only when\n// the worker imports it. Every file is an ES module with its source map beside it (`<name>.mjs.map`, linked from its\n// last line; an inline one would be text of the module V8 keeps, and Node keeps its decoded copy), written at the first\n// fork (`file()`; a handle never forked writes nothing) into one private directory its handle owns and removes: a new temporary one, or\n// one the caller names (the kit's per kind in the data directory: the same path at every start, so Node's compile cache\n// knows the files). Every file the build read is recorded with its bytes' hash\n// (`BaseInputs`), as its one read hands them to esbuild.\n\nimport { existsSync, mkdirSync, mkdtempSync, rmSync, writeFileSync } from \"node:fs\";\nimport { isBuiltin } from \"node:module\";\nimport { tmpdir } from \"node:os\";\nimport { basename, dirname, extname, join, parse, resolve, sep } from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport { build, type Loader, type Plugin } from \"esbuild\";\nimport { type BaseInputs, readRecorded, recordedSources } from \"../plugins/base-inputs.ts\";\nimport { conditionsOf } from \"../surfaces/bundle.ts\";\n\n/** A worker kind's bundled base: the file workers are forked from, and the files it was built from. */\nexport interface WorkerBase {\n\t/** The files esbuild read for it with their bytes' hashes: the app's base code, a file differing outdates it. */\n\treadonly inputs: BaseInputs;\n\t/**\n\t * The entry module's path, its chunks beside it: written at the first call, and again when a temporary-file cleaner\n\t * removed one of them (into a new temporary directory, or its named one).\n\t */\n\tfile(): string;\n\t/** Removes the bundle's directory, when `file()` wrote it. */\n\tremove(): void;\n}\n\n/**\n * What `import.meta.url`, `.dirname` and `.filename` (and a CommonJS file's free `__dirname` and `__filename`) become: a\n * module's own constants (`moduleLocations`).\n */\nconst MODULE_URL = \"__chordModuleUrl\";\nconst MODULE_DIRNAME = \"__chordModuleDirname\";\nconst MODULE_FILENAME = \"__chordModuleFilename\";\n\n/** The entry module's name in the bundle's directory (`worker.mjs`); chunks are named `<name>-<hash>.mjs`. */\nconst ENTRY_NAME = \"worker\";\n\n/**\n * Bundles `entry` for workers forked with `execArgv` (its `--conditions` resolve imports as the child's Node would),\n * in memory; its files are written at the handle's first `file()`, into `dir` (a private directory the handle owns:\n * emptied first, removed by `remove`) or, without one, a new temporary directory. Rejects with esbuild's failure.\n */\nexport async function buildWorkerBase(entry: string, execArgv: readonly string[], dir?: string): Promise<WorkerBase> {\n\t// Built as if at the file system's root: the source map's paths relative to it, made absolute by `sourceRoot`.\n\tconst root = parse(resolve(entry)).root;\n\tconst inputs = new Map<string, string>();\n\tconst result = await build({\n\t\tentryPoints: [{ in: entry, out: ENTRY_NAME }],\n\t\t// One flat directory: every chunk imports the others as `./<name>`, and the source maps' paths stay relative to\n\t\t// the root.\n\t\toutdir: root,\n\t\tentryNames: \"[name]\",\n\t\tchunkNames: \"[name]-[hash]\",\n\t\toutExtension: { \".js\": \".mjs\" },\n\t\t// A dynamic `import()` esbuild can follow becomes a chunk Node loads only when the worker imports it, with the\n\t\t// packages it imports: inlined into one module, every lazily imported module would load and run at each fork.\n\t\tsplitting: true,\n\t\twrite: false,\n\t\tbundle: true,\n\t\tformat: \"esm\",\n\t\tplatform: \"node\",\n\t\t// Node's own resolution: the child's conditions, `main` only (no `module` condition or field).\n\t\tconditions: conditionsOf(execArgv),\n\t\tmainFields: [\"main\"],\n\t\t// Every imported module runs, as Node runs it: `sideEffects: false` and pure annotations drop none (the entry's\n\t\t// own package may say it, as Chord's does).\n\t\tignoreAnnotations: true,\n\t\t// Function and class names as the source has them (`name` stays what unbundled code sees).\n\t\tkeepNames: true,\n\t\t// Minified but for the names: every worker holds the base's source text, and V8 keeps a text with any non-ASCII\n\t\t// character (a comment's `§`) as UTF-16, twice its size.\n\t\tminifyWhitespace: true,\n\t\tminifySyntax: true,\n\t\tsourcemap: \"linked\",\n\t\tsourcesContent: false,\n\t\tsourceRoot: pathToFileURL(root).href,\n\t\t// A CommonJS file of the base code requires through this (each chunk has its own); external packages by their\n\t\t// absolute paths.\n\t\tbanner: {\n\t\t\tjs: 'import { createRequire as __chordCreateRequire } from \"node:module\"; const require = __chordCreateRequire(import.meta.url);',\n\t\t},\n\t\tdefine: {\n\t\t\t\"import.meta.url\": MODULE_URL,\n\t\t\t\"import.meta.dirname\": MODULE_DIRNAME,\n\t\t\t\"import.meta.filename\": MODULE_FILENAME,\n\t\t\t__dirname: MODULE_DIRNAME,\n\t\t\t__filename: MODULE_FILENAME,\n\t\t},\n\t\tplugins: [installedPackages(), moduleLocations(inputs), recordedSources(inputs)],\n\t\tlogLevel: \"silent\",\n\t});\n\tconst files = result.outputFiles.map((output) => ({ name: basename(output.path), contents: output.contents }));\n\treturn new BundleFiles(files, inputs, dir);\n}\n\n/**\n * The files of the static import graph of Node code started from `entry` with `conditions`, with their bytes' hashes: a\n * best-effort scan (esbuild bundles it only to record what it reads; nothing is written or run). It sees the literal\n * imports of the graph, including lazy literal `import()`s Node may never run (conservative: such a file's edit asks\n * for a restart); a computed `import(x)` and modules a loader provides are not seen, and an import that does not\n * resolve (an inactive optional import of a missing file or package, a loader's scheme) is left out. It resolves as\n * Node does: the conditions, `main`, no `tsconfig.json` `paths`; installed packages are left out (never compared).\n * Rejects with esbuild's failure for anything else (a file it cannot parse).\n */\nexport async function nodeBaseInputs(entry: string, conditions: readonly string[]): Promise<BaseInputs> {\n\tconst inputs = new Map<string, string>();\n\tawait build({\n\t\tentryPoints: [entry],\n\t\twrite: false,\n\t\tbundle: true,\n\t\tformat: \"esm\",\n\t\tplatform: \"node\",\n\t\tconditions: [...conditions],\n\t\tmainFields: [\"main\"],\n\t\t// Node reads no tsconfig.json: its `paths` would resolve an import elsewhere than Node does.\n\t\ttsconfigRaw: \"{}\",\n\t\t// Every file the bundle reaches is read, as Node would load it; the output is dropped.\n\t\tignoreAnnotations: true,\n\t\tplugins: [staticGraph(), recordedSources(inputs)],\n\t\tlogLevel: \"silent\",\n\t});\n\treturn inputs;\n}\n\n/**\n * The scan's resolution (`nodeBaseInputs`): an import resolving under a `node_modules` directory and one that does not\n * resolve at all are left out (external); the rest resolves as esbuild does.\n */\nfunction staticGraph(): Plugin {\n\treturn {\n\t\tname: \"chord-node-base-static-graph\",\n\t\tsetup(builder) {\n\t\t\tbuilder.onResolve({ filter: /.*/ }, async (args) => {\n\t\t\t\tif (args.pluginData === RESOLVING || args.kind === \"entry-point\" || isBuiltin(args.path)) return undefined;\n\t\t\t\tconst resolved = await builder.resolve(args.path, {\n\t\t\t\t\tkind: args.kind,\n\t\t\t\t\timporter: args.importer,\n\t\t\t\t\tresolveDir: args.resolveDir,\n\t\t\t\t\tpluginData: RESOLVING,\n\t\t\t\t});\n\t\t\t\tconst outside =\n\t\t\t\t\tresolved.errors.length > 0 || resolved.external || resolved.path.split(sep).includes(\"node_modules\");\n\t\t\t\treturn outside ? { path: args.path, external: true } : resolved;\n\t\t\t});\n\t\t},\n\t};\n}\n\n/** Marks the resolver's own call, so the plugin does not resolve it again. */\nconst RESOLVING = Symbol(\"chord.worker-base.resolving\");\n\n/**\n * Keeps a package resolved under a `node_modules` directory external, by its absolute file (a URL for an `import`, a\n * path for a `require`): the bundle lives elsewhere, so a bare specifier would not resolve from it. A workspace\n * package resolves to its real path outside `node_modules` and is inlined. A specifier that does not resolve is left to\n * esbuild (an error, or a warning for a `require` in a `try`).\n */\nfunction installedPackages(): Plugin {\n\treturn {\n\t\tname: \"chord-worker-installed-packages\",\n\t\tsetup(builder) {\n\t\t\tbuilder.onResolve({ filter: /^[^./]/ }, async (args) => {\n\t\t\t\tif (args.pluginData === RESOLVING || isBuiltin(args.path)) return undefined;\n\t\t\t\tconst resolved = await builder.resolve(args.path, {\n\t\t\t\t\tkind: args.kind,\n\t\t\t\t\timporter: args.importer,\n\t\t\t\t\tresolveDir: args.resolveDir,\n\t\t\t\t\tpluginData: RESOLVING,\n\t\t\t\t});\n\t\t\t\tif (resolved.errors.length > 0) return undefined;\n\t\t\t\tif (!resolved.path.split(sep).includes(\"node_modules\")) return resolved;\n\t\t\t\tconst path = args.kind.startsWith(\"require\") ? resolved.path : pathToFileURL(resolved.path).href;\n\t\t\t\treturn { path, external: true };\n\t\t\t});\n\t\t},\n\t};\n}\n\n/** Whether a source names its own location. */\nconst LOCATIONS = /import\\.meta|__dirname|__filename/;\n\n/** The loaders of the source files `moduleLocations` reads: every extension its filter matches. */\nconst LOADERS: Readonly<Record<string, Loader>> = {\n\t\".js\": \"js\",\n\t\".mjs\": \"js\",\n\t\".cjs\": \"js\",\n\t\".jsx\": \"jsx\",\n\t\".ts\": \"ts\",\n\t\".mts\": \"ts\",\n\t\".cts\": \"ts\",\n\t\".tsx\": \"tsx\",\n};\n\n/**\n * Keeps `import.meta.url`, `.dirname` and `.filename`, `__dirname` and `__filename` naming each module's source file, not\n * the bundle (base code finds files beside it this way: p2's plugins directory): a module using them gets its own\n * constants, which `define` puts in their place. Declared on its first line, so the source map's lines stay. It reads\n * (and records in `inputs`) every source file of its extensions, which it hands to esbuild changed or as read.\n */\nfunction moduleLocations(inputs: Map<string, string>): Plugin {\n\treturn {\n\t\tname: \"chord-worker-module-locations\",\n\t\tsetup(builder) {\n\t\t\tbuilder.onLoad({ filter: /\\.(?:[cm]?[jt]s|[jt]sx)$/ }, async (args) => {\n\t\t\t\tif (args.namespace !== \"file\") return undefined;\n\t\t\t\tconst bytes = await readRecorded(args.path, inputs);\n\t\t\t\t// The filter matched one of `LOADERS`' extensions.\n\t\t\t\tconst loader = LOADERS[extname(args.path)]!;\n\t\t\t\tconst source = bytes.toString(\"utf8\");\n\t\t\t\tif (!LOCATIONS.test(source)) return { contents: bytes, loader };\n\t\t\t\tconst constants = [\n\t\t\t\t\t[MODULE_URL, pathToFileURL(args.path).href],\n\t\t\t\t\t[MODULE_DIRNAME, dirname(args.path)],\n\t\t\t\t\t[MODULE_FILENAME, args.path],\n\t\t\t\t].map(([name, value]) => `${name} = ${JSON.stringify(value)}`);\n\t\t\t\treturn { contents: `var ${constants.join(\", \")};${source}`, loader };\n\t\t\t});\n\t\t},\n\t};\n}\n\n/** One output file of the bundle: its name in the bundle's directory and its contents. */\ninterface BundleFile {\n\treadonly name: string;\n\treadonly contents: Uint8Array;\n}\n\n/**\n * The bundle as files: written at the first `file()` (a named directory is shared with later starts: a handle whose\n * owner closed before forking must never touch it) into its named directory (emptied first: the files of an earlier\n * build go) or a new private temporary one, again when one of them is gone; the directory removed with the handle.\n */\nclass BundleFiles implements WorkerBase {\n\treadonly inputs: BaseInputs;\n\treadonly #files: readonly BundleFile[];\n\treadonly #named: string | undefined;\n\t/** Where the files were written; `undefined` before the first `file()` and after `remove`. */\n\t#dir: string | undefined;\n\n\tconstructor(files: readonly BundleFile[], inputs: BaseInputs, named: string | undefined) {\n\t\tthis.#files = files;\n\t\tthis.inputs = inputs;\n\t\tthis.#named = named;\n\t}\n\n\tfile(): string {\n\t\t// A long-running server's temporary directory may be cleaned (systemd-tmpfiles, macOS), a chunk no worker\n\t\t// imported for a while first: a fork needs all of them. A temporary directory is a new one, never the old name:\n\t\t// another user may have made that one since (a named directory is the app's own, private).\n\t\tconst dir = this.#dir;\n\t\tif (dir !== undefined && this.#files.every((file) => existsSync(join(dir, file.name)))) {\n\t\t\treturn join(dir, `${ENTRY_NAME}.mjs`);\n\t\t}\n\t\tthis.remove();\n\t\treturn join(this.#write(), `${ENTRY_NAME}.mjs`);\n\t}\n\n\tremove(): void {\n\t\tif (this.#dir !== undefined) rmSync(this.#dir, { recursive: true, force: true });\n\t\tthis.#dir = undefined;\n\t}\n\n\t/** Writes the bundle's files into its private directory (mode 0700, each file 0600); the directory. */\n\t#write(): string {\n\t\tlet dir = this.#named;\n\t\tif (dir === undefined) dir = mkdtempSync(join(tmpdir(), \"chord-worker-\"));\n\t\telse {\n\t\t\trmSync(dir, { recursive: true, force: true });\n\t\t\tmkdirSync(dir, { recursive: true, mode: 0o700 });\n\t\t}\n\t\tfor (const file of this.#files) writeFileSync(join(dir, file.name), file.contents, { mode: 0o600 });\n\t\tthis.#dir = dir;\n\t\treturn dir;\n\t}\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"child.d.ts","sourceRoot":"","sources":["../../../src/node/workers/child.ts"],"names":[],"mappings":"AAIA,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,KAAK,WAAW,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC1D,OAAO,EACN,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,UAAU,GACV,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// The worker process's side of the workers component (`@diffra-ai/chord/workers/child`): `workerMain` and
|
|
2
|
+
// `processLock` without the server's side, whose worker base bundles with esbuild. A worker entry imports this, so a
|
|
3
|
+
// forked worker never loads esbuild.
|
|
4
|
+
export { processLock } from "./lock.js";
|
|
5
|
+
export { workerMain, } from "./main.js";
|
|
6
|
+
//# sourceMappingURL=child.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"child.js","sourceRoot":"","sources":["../../../src/node/workers/child.ts"],"names":[],"mappings":"AAAA,0GAA0G;AAC1G,qHAAqH;AACrH,qCAAqC;AAGrC,OAAO,EAAoB,WAAW,EAAE,MAAM,WAAW,CAAC;AAC1D,OAAO,EAKN,UAAU,GACV,MAAM,WAAW,CAAC","sourcesContent":["// The worker process's side of the workers component (`@diffra-ai/chord/workers/child`): `workerMain` and\n// `processLock` without the server's side, whose worker base bundles with esbuild. A worker entry imports this, so a\n// forked worker never loads esbuild.\n\nexport type { CrossedError } from \"./control.ts\";\nexport { type ProcessLock, processLock } from \"./lock.ts\";\nexport {\n\ttype WorkerMainOptions,\n\ttype WorkerPlugins,\n\ttype WorkerResult,\n\ttype WorkerStart,\n\tworkerMain,\n} from \"./main.ts\";\n"]}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { Address } from "../../contracts/index.ts";
|
|
2
|
+
import { type FailureCause } from "../../data/index.ts";
|
|
3
|
+
import type { ReloadReport } from "../../host/index.ts";
|
|
4
|
+
import type { JsonValue } from "../../json.ts";
|
|
5
|
+
import type { PluginScript } from "../plugins/runtime.ts";
|
|
6
|
+
/** An error as it crosses: its message, and a ChordError's code and reason. */
|
|
7
|
+
export type CrossedError = {
|
|
8
|
+
readonly message: string;
|
|
9
|
+
readonly code?: string;
|
|
10
|
+
readonly reason?: string;
|
|
11
|
+
};
|
|
12
|
+
/** A reload report as it crosses: its errors crossed. */
|
|
13
|
+
export type CrossedReport = {
|
|
14
|
+
readonly plugins: ReloadReport["plugins"];
|
|
15
|
+
readonly failed: readonly {
|
|
16
|
+
readonly plugin: string;
|
|
17
|
+
readonly error: CrossedError;
|
|
18
|
+
}[];
|
|
19
|
+
readonly objects: readonly {
|
|
20
|
+
readonly object: string;
|
|
21
|
+
readonly kind: string;
|
|
22
|
+
readonly cause?: CrossedCause;
|
|
23
|
+
}[];
|
|
24
|
+
};
|
|
25
|
+
/** A failure cause as it crosses. */
|
|
26
|
+
type CrossedCause = {
|
|
27
|
+
readonly kind: FailureCause["kind"];
|
|
28
|
+
readonly error: CrossedError;
|
|
29
|
+
};
|
|
30
|
+
/** What the server sends a worker. */
|
|
31
|
+
export type ToWorker = {
|
|
32
|
+
readonly kind: "start";
|
|
33
|
+
readonly address: Address;
|
|
34
|
+
readonly start: JsonValue;
|
|
35
|
+
readonly scripts: readonly PluginScript[];
|
|
36
|
+
readonly lock: string;
|
|
37
|
+
} | {
|
|
38
|
+
readonly kind: "shutdown";
|
|
39
|
+
} | {
|
|
40
|
+
readonly kind: "reload";
|
|
41
|
+
readonly scripts: readonly PluginScript[];
|
|
42
|
+
};
|
|
43
|
+
/** What a worker sends the server. */
|
|
44
|
+
export type FromWorker = {
|
|
45
|
+
readonly kind: "started";
|
|
46
|
+
} | {
|
|
47
|
+
readonly kind: "ready";
|
|
48
|
+
readonly idle: boolean;
|
|
49
|
+
readonly report: CrossedReport;
|
|
50
|
+
} | {
|
|
51
|
+
readonly kind: "idle";
|
|
52
|
+
readonly idle: boolean;
|
|
53
|
+
} | {
|
|
54
|
+
readonly kind: "fatal";
|
|
55
|
+
readonly error: CrossedError;
|
|
56
|
+
} | {
|
|
57
|
+
readonly kind: "reloaded";
|
|
58
|
+
readonly report: CrossedReport;
|
|
59
|
+
} | {
|
|
60
|
+
readonly kind: "reload_failed";
|
|
61
|
+
readonly error: CrossedError;
|
|
62
|
+
};
|
|
63
|
+
/** `message` in its envelope, as it goes over the IPC channel. */
|
|
64
|
+
export declare function envelope(message: ToWorker | FromWorker): {
|
|
65
|
+
readonly [ENVELOPE]: ToWorker | FromWorker;
|
|
66
|
+
};
|
|
67
|
+
/** The envelope's key: a control message is `{ "chord.workers": message }`. */
|
|
68
|
+
declare const ENVELOPE = "chord.workers";
|
|
69
|
+
/**
|
|
70
|
+
* The control message in an IPC message, or `undefined` for anything else (a link frame, the app's own). A trust
|
|
71
|
+
* boundary in name only: both ends are the app's processes, so only the envelope is checked.
|
|
72
|
+
*/
|
|
73
|
+
export declare function controlOf<M extends ToWorker | FromWorker>(message: unknown): M | undefined;
|
|
74
|
+
/** `error` as it crosses. */
|
|
75
|
+
export declare function crossed(error: unknown): CrossedError;
|
|
76
|
+
/** A crossed error as an error again: a ChordError when its code is one, an `Error` otherwise. */
|
|
77
|
+
export declare function uncrossed(error: CrossedError): Error;
|
|
78
|
+
/** `report` as it crosses. */
|
|
79
|
+
export declare function crossedReport(report: ReloadReport): CrossedReport;
|
|
80
|
+
/** A crossed report as a report again. */
|
|
81
|
+
export declare function uncrossedReport(report: CrossedReport): ReloadReport;
|
|
82
|
+
export {};
|
|
83
|
+
//# sourceMappingURL=control.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"control.d.ts","sourceRoot":"","sources":["../../../src/node/workers/control.ts"],"names":[],"mappings":"AAIA,OAAO,KA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AU,EAAE,OAAO,EAAE,OAAO,GAAG,CAAC,GAAG,SAAS,CAI1F;AAED,6BAA6B;AAC7B,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,YAAY,CASpD;AAED,kGAAkG;AAClG,wBAAgB,SAAS,CAAC,KAAK,EAAE,YAAY,GAAG,KAAK,CAWpD;AAED,8BAA8B;AAC9B,wBAAgB,aAAa,CAAC,MAAM,EAAE,YAAY,GAAG,aAAa,CAcjE;AAED,0CAA0C;AAC1C,wBAAgB,eAAe,CAAC,MAAM,EAAE,aAAa,GAAG,YAAY,CAanE"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// The control channel between the server and a worker (slice 10 §3): JSON messages beside the link's `Uint8Array`
|
|
2
|
+
// frames on one IPC channel (the IPC link skips them), and errors as they cross it (`{ message, code?, reason? }`,
|
|
3
|
+
// never a stack or a cause).
|
|
4
|
+
import { ChordError, isChordError } from "../../data/index.js";
|
|
5
|
+
import { chordErrorFromJson } from "../../data/internal.js";
|
|
6
|
+
/** `message` in its envelope, as it goes over the IPC channel. */
|
|
7
|
+
export function envelope(message) {
|
|
8
|
+
return { [ENVELOPE]: message };
|
|
9
|
+
}
|
|
10
|
+
/** The envelope's key: a control message is `{ "chord.workers": message }`. */
|
|
11
|
+
const ENVELOPE = "chord.workers";
|
|
12
|
+
/**
|
|
13
|
+
* The control message in an IPC message, or `undefined` for anything else (a link frame, the app's own). A trust
|
|
14
|
+
* boundary in name only: both ends are the app's processes, so only the envelope is checked.
|
|
15
|
+
*/
|
|
16
|
+
export function controlOf(message) {
|
|
17
|
+
if (typeof message !== "object" || message === null || !(ENVELOPE in message))
|
|
18
|
+
return undefined;
|
|
19
|
+
// Sent by the other end of this channel through `envelope`.
|
|
20
|
+
return message[ENVELOPE];
|
|
21
|
+
}
|
|
22
|
+
/** `error` as it crosses. */
|
|
23
|
+
export function crossed(error) {
|
|
24
|
+
if (isChordError(error)) {
|
|
25
|
+
return {
|
|
26
|
+
message: error.message,
|
|
27
|
+
code: error.code,
|
|
28
|
+
...(error.reason === undefined ? {} : { reason: error.reason }),
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
return { message: error instanceof Error ? error.message : String(error) };
|
|
32
|
+
}
|
|
33
|
+
/** A crossed error as an error again: a ChordError when its code is one, an `Error` otherwise. */
|
|
34
|
+
export function uncrossed(error) {
|
|
35
|
+
if (error.code === undefined)
|
|
36
|
+
return new Error(error.message);
|
|
37
|
+
try {
|
|
38
|
+
return chordErrorFromJson({
|
|
39
|
+
code: error.code,
|
|
40
|
+
message: error.message,
|
|
41
|
+
...(error.reason === undefined ? {} : { reason: error.reason }),
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
return new Error(error.message);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/** `report` as it crosses. */
|
|
49
|
+
export function crossedReport(report) {
|
|
50
|
+
return {
|
|
51
|
+
plugins: report.plugins,
|
|
52
|
+
failed: report.failed.map(({ plugin, error }) => ({ plugin, error: crossed(error) })),
|
|
53
|
+
objects: report.objects.map((each) => each.kind === "parked"
|
|
54
|
+
? {
|
|
55
|
+
object: each.object,
|
|
56
|
+
kind: each.kind,
|
|
57
|
+
cause: { kind: each.cause.kind, error: crossed(each.cause.error) },
|
|
58
|
+
}
|
|
59
|
+
: each),
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
/** A crossed report as a report again. */
|
|
63
|
+
export function uncrossedReport(report) {
|
|
64
|
+
return {
|
|
65
|
+
plugins: report.plugins,
|
|
66
|
+
failed: report.failed.map(({ plugin, error }) => ({ plugin, error: uncrossed(error) })),
|
|
67
|
+
objects: report.objects.map(({ object, kind, cause }) => {
|
|
68
|
+
if (cause === undefined)
|
|
69
|
+
return { object, kind: kind };
|
|
70
|
+
const error = uncrossed(cause.error);
|
|
71
|
+
// A parked object's cause is a ChordError on the worker; one that crossed without a code is wrapped as one.
|
|
72
|
+
const chord = isChordError(error) ? error : new ChordError({ code: "unavailable", message: error.message });
|
|
73
|
+
return { object, kind: "parked", cause: { kind: cause.kind, error: chord } };
|
|
74
|
+
}),
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=control.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"control.js","sourceRoot":"","sources":["../../../src/node/workers/control.ts"],"names":[],"mappings":"AAAA,kHAAkH;AAClH,mHAAmH;AACnH,6BAA6B;AAG7B,OAAO,EAAE,UAAU,EAAqB,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAClF,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAuC5D,kEAAkE;AAClE,MAAM,UAAU,QAAQ,CAAC,OAA8B;IACtD,OAAO,EAAE,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;AAChC,CAAC;AAED,+EAA+E;AAC/E,MAAM,QAAQ,GAAG,eAAe,CAAC;AAEjC;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAkC,OAAgB;IAC1E,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,IAAI,IAAI,CAAC,CAAC,QAAQ,IAAI,OAAO,CAAC;QAAE,OAAO,SAAS,CAAC;IAChG,4DAA4D;IAC5D,OAAQ,OAAsC,CAAC,QAAQ,CAAC,CAAC;AAC1D,CAAC;AAED,6BAA6B;AAC7B,MAAM,UAAU,OAAO,CAAC,KAAc;IACrC,IAAI,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO;YACN,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,GAAG,CAAC,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;SAC/D,CAAC;IACH,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,KAAK,YAA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AO,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;aAClE;YACF,CAAC,CAAC,IAAI,CACP;KACD,CAAC;AACH,CAAC;AAED,0CAA0C;AAC1C,MAAM,UAAU,eAAe,CAAC,MAAqB;IACpD,OAAO;QACN,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACvF,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE;YACvD,IAAI,KAAK,KAAK,SAAS;gBACtB,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAkE,EAAE,CAAC;YAC7F,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACrC,4GAA4G;YAC5G,MAAM,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;YAC5G,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAkB,EAAE,CAAC;QAC9F,CAAC,CAAC;KACF,CAAC;AACH,CAAC","sourcesContent":["// The control channel between the server and a worker (slice 10 §3): JSON messages beside the link's `Uint8Array`\n// frames on one IPC channel (the IPC link skips them), and errors as they cross it (`{ message, code?, reason? }`,\n// never a stack or a cause).\n\nimport type { Address } from \"../../contracts/index.ts\";\nimport { ChordError, type FailureCause, isChordError } from \"../../data/index.ts\";\nimport { chordErrorFromJson } from \"../../data/internal.ts\";\nimport type { ReloadReport } from \"../../host/index.ts\";\nimport type { JsonValue } from \"../../json.ts\";\nimport type { PluginScript } from \"../plugins/runtime.ts\";\n\n/** An error as it crosses: its message, and a ChordError's code and reason. */\nexport type CrossedError = { readonly message: string; readonly code?: string; readonly reason?: string };\n\n/** A reload report as it crosses: its errors crossed. */\nexport type CrossedReport = {\n\treadonly plugins: ReloadReport[\"plugins\"];\n\treadonly failed: readonly { readonly plugin: string; readonly error: CrossedError }[];\n\treadonly objects: readonly { readonly object: string; readonly kind: string; readonly cause?: CrossedCause }[];\n};\n\n/** A failure cause as it crosses. */\ntype CrossedCause = { readonly kind: FailureCause[\"kind\"]; readonly error: CrossedError };\n\n/** What the server sends a worker. */\nexport type ToWorker =\n\t| {\n\t\t\treadonly kind: \"start\";\n\t\t\treadonly address: Address;\n\t\t\treadonly start: JsonValue;\n\t\t\treadonly scripts: readonly PluginScript[];\n\t\t\treadonly lock: string;\n\t }\n\t| { readonly kind: \"shutdown\" }\n\t| { readonly kind: \"reload\"; readonly scripts: readonly PluginScript[] };\n\n/** What a worker sends the server. */\nexport type FromWorker =\n\t| { readonly kind: \"started\" }\n\t| { readonly kind: \"ready\"; readonly idle: boolean; readonly report: CrossedReport }\n\t| { readonly kind: \"idle\"; readonly idle: boolean }\n\t| { readonly kind: \"fatal\"; readonly error: CrossedError }\n\t| { readonly kind: \"reloaded\"; readonly report: CrossedReport }\n\t| { readonly kind: \"reload_failed\"; readonly error: CrossedError };\n\n/** `message` in its envelope, as it goes over the IPC channel. */\nexport function envelope(message: ToWorker | FromWorker): { readonly [ENVELOPE]: ToWorker | FromWorker } {\n\treturn { [ENVELOPE]: message };\n}\n\n/** The envelope's key: a control message is `{ \"chord.workers\": message }`. */\nconst ENVELOPE = \"chord.workers\";\n\n/**\n * The control message in an IPC message, or `undefined` for anything else (a link frame, the app's own). A trust\n * boundary in name only: both ends are the app's processes, so only the envelope is checked.\n */\nexport function controlOf<M extends ToWorker | FromWorker>(message: unknown): M | undefined {\n\tif (typeof message !== \"object\" || message === null || !(ENVELOPE in message)) return undefined;\n\t// Sent by the other end of this channel through `envelope`.\n\treturn (message as { readonly [ENVELOPE]: M })[ENVELOPE];\n}\n\n/** `error` as it crosses. */\nexport function crossed(error: unknown): CrossedError {\n\tif (isChordError(error)) {\n\t\treturn {\n\t\t\tmessage: error.message,\n\t\t\tcode: error.code,\n\t\t\t...(error.reason === undefined ? {} : { reason: error.reason }),\n\t\t};\n\t}\n\treturn { message: error instanceof Error ? error.message : String(error) };\n}\n\n/** A crossed error as an error again: a ChordError when its code is one, an `Error` otherwise. */\nexport function uncrossed(error: CrossedError): Error {\n\tif (error.code === undefined) return new Error(error.message);\n\ttry {\n\t\treturn chordErrorFromJson({\n\t\t\tcode: error.code,\n\t\t\tmessage: error.message,\n\t\t\t...(error.reason === undefined ? {} : { reason: error.reason }),\n\t\t});\n\t} catch {\n\t\treturn new Error(error.message);\n\t}\n}\n\n/** `report` as it crosses. */\nexport function crossedReport(report: ReloadReport): CrossedReport {\n\treturn {\n\t\tplugins: report.plugins,\n\t\tfailed: report.failed.map(({ plugin, error }) => ({ plugin, error: crossed(error) })),\n\t\tobjects: report.objects.map((each) =>\n\t\t\teach.kind === \"parked\"\n\t\t\t\t? {\n\t\t\t\t\t\tobject: each.object,\n\t\t\t\t\t\tkind: each.kind,\n\t\t\t\t\t\tcause: { kind: each.cause.kind, error: crossed(each.cause.error) },\n\t\t\t\t\t}\n\t\t\t\t: each,\n\t\t),\n\t};\n}\n\n/** A crossed report as a report again. */\nexport function uncrossedReport(report: CrossedReport): ReloadReport {\n\treturn {\n\t\tplugins: report.plugins,\n\t\tfailed: report.failed.map(({ plugin, error }) => ({ plugin, error: uncrossed(error) })),\n\t\tobjects: report.objects.map(({ object, kind, cause }) => {\n\t\t\tif (cause === undefined)\n\t\t\t\treturn { object, kind: kind as Exclude<ReloadReport[\"objects\"][number][\"kind\"], \"parked\"> };\n\t\t\tconst error = uncrossed(cause.error);\n\t\t\t// A parked object's cause is a ChordError on the worker; one that crossed without a code is wrapped as one.\n\t\t\tconst chord = isChordError(error) ? error : new ChordError({ code: \"unavailable\", message: error.message });\n\t\t\treturn { object, kind: \"parked\", cause: { kind: cause.kind, error: chord } as FailureCause };\n\t\t}),\n\t};\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/node/workers/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,cAAc,YAAY,CAAC;AAC3B,OAAO,EACN,aAAa,EACb,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,cAAc,GACnB,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Chord v2's workers component (`@diffra-ai/chord/workers`, slice 10 §3, §4): a forked worker process per
|
|
2
|
+
// address of a host kind, started on demand, stopped when idle, never restarted by itself, its plugins shipped from the
|
|
3
|
+
// server; `workerMain` is the worker's side (also `@diffra-ai/chord/workers/child`, without esbuild). Node-only.
|
|
4
|
+
export { nodeBaseInputs } from "./base.js";
|
|
5
|
+
export * from "./child.js";
|
|
6
|
+
export { createWorkers, } from "./workers.js";
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/node/workers/index.ts"],"names":[],"mappings":"AAAA,0GAA0G;AAC1G,wHAAwH;AACxH,iHAAiH;AAEjH,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,cAAc,YAAY,CAAC;AAC3B,OAAO,EACN,aAAa,GAMb,MAAM,cAAc,CAAC","sourcesContent":["// Chord v2's workers component (`@diffra-ai/chord/workers`, slice 10 §3, §4): a forked worker process per\n// address of a host kind, started on demand, stopped when idle, never restarted by itself, its plugins shipped from the\n// server; `workerMain` is the worker's side (also `@diffra-ai/chord/workers/child`, without esbuild). Node-only.\n\nexport { nodeBaseInputs } from \"./base.ts\";\nexport * from \"./child.ts\";\nexport {\n\tcreateWorkers,\n\ttype WorkerState,\n\ttype Workers,\n\ttype WorkersBuilt,\n\ttype WorkersError,\n\ttype WorkersOptions,\n} from \"./workers.ts\";\n"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Context } from "../../context/index.ts";
|
|
2
|
+
/** A held lock: `release` frees it (the process's exit does too). */
|
|
3
|
+
export type ProcessLock = {
|
|
4
|
+
release(): Promise<void>;
|
|
5
|
+
};
|
|
6
|
+
/** Where a lock lives: an abstract socket (Linux, Android), a named pipe (Windows) or a socket file (elsewhere). */
|
|
7
|
+
export type LockAddress = {
|
|
8
|
+
readonly kind: "abstract" | "pipe" | "file";
|
|
9
|
+
readonly address: string;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Takes the lock `name`, waiting while another process holds it (until `context` aborts: rejects with its reason).
|
|
13
|
+
* Throws what listening throws besides "in use", and for a stale socket file (macOS, the BSDs) an error naming it.
|
|
14
|
+
*/
|
|
15
|
+
export declare function processLock(name: string, context: Context): Promise<ProcessLock>;
|
|
16
|
+
/**
|
|
17
|
+
* Removes the socket file of the lock `name` when nobody accepts on it (a holder killed without its exit hooks left
|
|
18
|
+
* it); resolves with whether it did. Abstract sockets and named pipes end with their holder: nothing to clear. Only one
|
|
19
|
+
* process clears a name, one clear at a time: two clearers could both find it stale, one remove it, a new holder take
|
|
20
|
+
* it, and the other remove the new holder's file.
|
|
21
|
+
*/
|
|
22
|
+
export declare function clearStaleLock(name: string, context: Context): Promise<boolean>;
|
|
23
|
+
/** `clearStaleLock` at `lock`: a socket file nobody accepts on is removed. */
|
|
24
|
+
export declare function clearStaleLockAt(lock: LockAddress, context: Context): Promise<boolean>;
|
|
25
|
+
/**
|
|
26
|
+
* Takes the lock at `lock`, waiting while it is held. A socket file nobody accepts on (a crashed holder's) fails closed:
|
|
27
|
+
* taking it over races another taker (two could both unlink and listen), so the error names the file to remove.
|
|
28
|
+
*/
|
|
29
|
+
export declare function lockAt(lock: LockAddress, context: Context): Promise<ProcessLock>;
|
|
30
|
+
//# sourceMappingURL=lock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lock.d.ts","sourceRoot":"","sources":["../../../src/node/workers/lock.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEtD,qEAAqE;AACrE,MAAM,MAAM,WAAW,GAAG;IAAE,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;CAAE,CAAC;AAEvD,oHAAoH;AACpH,MAAM,MAAM,WAAW,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,GAAG,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAEpG;;;GAGG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,WAAW,CAAC,CAEtF;AAED;;;;;GAKG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAErF;AAYD,8EAA8E;AAC9E,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAU5F;AAiBD;;;GAGG;AACH,wBAAsB,MAAM,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,WAAW,CAAC,CAmCtF"}
|