@ref0/git 0.4.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/access/namespace.d.mts +2 -0
- package/dist/access/private-refs.d.mts +6 -29
- package/dist/access/private-refs.mjs +31 -17
- package/dist/access/public.d.mts +6 -0
- package/dist/access/public.mjs +9 -0
- package/dist/auth/access-jwt.d.mts +10 -6
- package/dist/auth/access-jwt.mjs +59 -40
- package/dist/auth/auth-namespace.d.mts +6 -0
- package/dist/auth/auth-namespace.mjs +12 -0
- package/dist/auth/auth.d.mts +3 -6
- package/dist/auth/auth.mjs +2 -9
- package/dist/auth/authorize.mjs +13 -9
- package/dist/auth/fences.d.mts +1 -1
- package/dist/auth/host-function.mjs +17 -8
- package/dist/auth/identify.d.mts +5 -3
- package/dist/auth/identify.mjs +2 -1
- package/dist/auth/namespaces.d.mts +2 -2
- package/dist/auth/token-rows.mjs +1 -1
- package/dist/auth/tokens-layer.d.mts +42 -0
- package/dist/auth/tokens-layer.mjs +29 -0
- package/dist/auth/tokens-namespace.d.mts +2 -0
- package/dist/auth/tokens-public.d.mts +6 -0
- package/dist/auth/tokens-public.mjs +29 -0
- package/dist/auth/tokens.d.mts +13 -6
- package/dist/auth/tokens.mjs +13 -12
- package/dist/auth.d.mts +2 -2
- package/dist/auth.mjs +2 -2
- package/dist/client/git-http.mjs +1 -1
- package/dist/client/local.mjs +6 -3
- package/dist/client/remote-helper.mjs +3 -8
- package/dist/client/remote.mjs +26 -7
- package/dist/client/run-remote-helper.d.mts +1 -1
- package/dist/client/run-remote-helper.mjs +2 -2
- package/dist/client/slice-push.d.mts +1 -1
- package/dist/contracts/access.d.mts +24 -12
- package/dist/contracts/access.mjs +17 -0
- package/dist/contracts/actors.d.mts +17 -1
- package/dist/contracts/actors.mjs +8 -1
- package/dist/contracts/authorize.d.mts +21 -14
- package/dist/contracts/blobs.d.mts +1 -1
- package/dist/contracts/blobs.mjs +1 -1
- package/dist/contracts/calls-spent.d.mts +6 -4
- package/dist/contracts/calls-spent.mjs +10 -8
- package/dist/contracts/commits.d.mts +2 -2
- package/dist/contracts/commits.mjs +1 -1
- package/dist/contracts/engine.d.mts +1 -1
- package/dist/contracts/events.d.mts +64 -26
- package/dist/contracts/events.mjs +26 -6
- package/dist/contracts/files.d.mts +2 -2
- package/dist/contracts/files.mjs +1 -1
- package/dist/contracts/forks.d.mts +58 -58
- package/dist/contracts/forks.mjs +1 -1
- package/dist/contracts/git-events.d.mts +50 -0
- package/dist/contracts/git-events.mjs +23 -0
- package/dist/contracts/git-hooks.d.mts +37 -0
- package/dist/contracts/git-hooks.mjs +10 -0
- package/dist/contracts/git.d.mts +138 -22
- package/dist/contracts/git.mjs +6 -5
- package/dist/contracts/grants.d.mts +6 -1
- package/dist/contracts/ids.d.mts +16 -0
- package/dist/contracts/ids.mjs +19 -4
- package/dist/contracts/lfs.d.mts +7 -2
- package/dist/contracts/namespaces.d.mts +2 -2
- package/dist/contracts/objects.d.mts +7 -2
- package/dist/contracts/opaque.mjs +9 -0
- package/dist/contracts/operations.d.mts +293 -100
- package/dist/contracts/promises.d.mts +4 -14
- package/dist/contracts/push-uploads.d.mts +5 -2
- package/dist/contracts/push-uploads.mjs +9 -4
- package/dist/contracts/queue.d.mts +233 -54
- package/dist/contracts/queue.mjs +81 -6
- package/dist/contracts/refs.d.mts +30 -8
- package/dist/contracts/refs.mjs +1 -1
- package/dist/contracts/remote.d.mts +42 -21
- package/dist/contracts/remote.mjs +22 -0
- package/dist/contracts/repo-records.d.mts +2 -2
- package/dist/contracts/repos.d.mts +126 -79
- package/dist/contracts/repos.mjs +43 -5
- package/dist/contracts/result.d.mts +50 -31
- package/dist/contracts/result.mjs +48 -16
- package/dist/contracts/rules.d.mts +50 -44
- package/dist/contracts/rules.mjs +5 -1
- package/dist/contracts/server.d.mts +282 -191
- package/dist/contracts/services.d.mts +1 -7
- package/dist/contracts/services.mjs +1 -3
- package/dist/contracts/signin.d.mts +140 -43
- package/dist/contracts/signin.mjs +35 -1
- package/dist/contracts/store.d.mts +1 -1
- package/dist/contracts/sync.d.mts +112 -90
- package/dist/contracts/sync.mjs +34 -7
- package/dist/contracts/tags.d.mts +1 -1
- package/dist/contracts/tags.mjs +1 -1
- package/dist/contracts/tokens.d.mts +232 -57
- package/dist/contracts/tokens.mjs +80 -19
- package/dist/contracts/topics.d.mts +22 -10
- package/dist/contracts/topics.mjs +6 -3
- package/dist/contracts/trees.d.mts +2 -2
- package/dist/contracts/trees.mjs +1 -1
- package/dist/contracts/work.d.mts +3 -3
- package/dist/contracts/work.mjs +2 -2
- package/dist/core/access.d.mts +10 -10
- package/dist/core/access.mjs +47 -8
- package/dist/core/call-names.d.mts +3 -1
- package/dist/core/clock.mjs +1 -1
- package/dist/core/events/deliver.d.mts +13 -0
- package/dist/core/events/deliver.mjs +475 -175
- package/dist/core/events/seen.mjs +17 -3
- package/dist/core/forks.mjs +131 -44
- package/dist/core/hooks/groups.d.mts +27 -0
- package/dist/core/hooks/groups.mjs +74 -0
- package/dist/core/hooks/namespace.d.mts +2 -0
- package/dist/core/hooks/order.d.mts +2 -2
- package/dist/core/hooks/order.mjs +6 -6
- package/dist/core/hooks/public.d.mts +7 -0
- package/dist/core/hooks/public.mjs +5 -0
- package/dist/core/imports.mjs +94 -10
- package/dist/core/index-job.mjs +31 -22
- package/dist/core/merge-parts.d.mts +1 -1
- package/dist/core/merge-parts.mjs +1 -1
- package/dist/core/mirror-rows.mjs +18 -0
- package/dist/core/names.mjs +1 -1
- package/dist/core/namespaces.d.mts +2 -1
- package/dist/core/objects/commit-writes.mjs +5 -5
- package/dist/core/objects/merges.mjs +1 -1
- package/dist/core/objects/objects-layer.mjs +1 -1
- package/dist/core/objects/reading.mjs +52 -7
- package/dist/core/objects/tree-edits.mjs +13 -28
- package/dist/core/objects/trees.mjs +4 -4
- package/dist/core/objects/writing.mjs +3 -3
- package/dist/core/own-writes.mjs +1 -1
- package/dist/core/parts.d.mts +27 -2
- package/dist/core/parts.mjs +5 -3
- package/dist/core/promise.mjs +23 -3
- package/dist/core/purge.d.mts +8 -0
- package/dist/core/purge.mjs +91 -46
- package/dist/core/push-decide.mjs +26 -4
- package/dist/core/push.mjs +104 -86
- package/dist/core/receipts.d.mts +2 -2
- package/dist/core/receipts.mjs +28 -4
- package/dist/core/ref-index-job.mjs +10 -15
- package/dist/core/ref-index.d.mts +1 -0
- package/dist/core/ref-index.mjs +28 -8
- package/dist/core/ref-view.mjs +16 -11
- package/dist/core/refs.mjs +54 -21
- package/dist/core/registered-records.mjs +30 -0
- package/dist/core/registered-rows.d.mts +4 -0
- package/dist/core/registered-rows.mjs +53 -0
- package/dist/core/repack.d.mts +3 -2
- package/dist/core/repack.mjs +70 -120
- package/dist/core/repo-info.mjs +59 -25
- package/dist/core/repos.mjs +22 -16
- package/dist/core/rules/changes.mjs +2 -2
- package/dist/core/rules/check.mjs +7 -6
- package/dist/core/rules/commit-changes.mjs +1 -1
- package/dist/core/rules/context.d.mts +4 -5
- package/dist/core/rules/context.mjs +3 -4
- package/dist/core/rules/fetch.mjs +74 -21
- package/dist/core/saved-caller-views.d.mts +72 -0
- package/dist/core/saved-caller-views.mjs +123 -0
- package/dist/core/saved-callers-public.d.mts +5 -0
- package/dist/core/saved-callers-public.mjs +10 -0
- package/dist/core/saved-callers.mjs +95 -0
- package/dist/core/seam.d.mts +67 -9
- package/dist/core/seam.mjs +11 -3
- package/dist/core/still-takes.mjs +75 -0
- package/dist/core/tokens.mjs +5 -1
- package/dist/core/view.d.mts +2 -1
- package/dist/core/view.mjs +9 -10
- package/dist/core/work.mjs +6 -5
- package/dist/effect.d.mts +2 -2
- package/dist/effect.mjs +2 -2
- package/dist/engine/content.d.mts +2 -2
- package/dist/engine/content.mjs +1 -1
- package/dist/engine/diff.mjs +2 -2
- package/dist/engine/merge-base-walk.d.mts +2 -2
- package/dist/engine/merge-base-walk.mjs +1 -1
- package/dist/engine/merge-renames.mjs +1 -1
- package/dist/engine/reads.d.mts +2 -2
- package/dist/engine/reads.mjs +1 -1
- package/dist/engine/xdiff.d.mts +1 -1
- package/dist/engine/xdiff.mjs +2 -2
- package/dist/event-streams/event-streams.d.mts +6 -2
- package/dist/event-streams/event-streams.mjs +6 -2
- package/dist/event-streams/stream.mjs +5 -2
- package/dist/extend.d.mts +5 -4
- package/dist/extend.mjs +3 -2
- package/dist/http/answers.mjs +4 -3
- package/dist/http/core-parts.mjs +21 -13
- package/dist/http/handler.mjs +3 -3
- package/dist/http/node.d.mts +2 -23
- package/dist/http/parts.d.mts +2 -0
- package/dist/http/push-uploads.d.mts +10 -2
- package/dist/http/push-uploads.mjs +38 -39
- package/dist/http/receive-pack.mjs +8 -6
- package/dist/http/upload-pack.mjs +8 -7
- package/dist/index.d.mts +36 -19
- package/dist/index.mjs +14 -6
- package/dist/lfs/base.d.mts +32 -0
- package/dist/lfs/base.mjs +8 -0
- package/dist/lfs/calls.mjs +22 -12
- package/dist/lfs/layer.d.mts +28 -0
- package/dist/lfs/layer.mjs +65 -0
- package/dist/lfs/locks.mjs +16 -30
- package/dist/lfs/namespace.d.mts +2 -0
- package/dist/lfs/objects.d.mts +26 -6
- package/dist/lfs/objects.mjs +197 -98
- package/dist/lfs/pointers.mjs +8 -6
- package/dist/lfs/public.d.mts +5 -0
- package/dist/lfs/public.mjs +8 -0
- package/dist/lfs/purge.mjs +19 -25
- package/dist/lfs/rows.mjs +22 -10
- package/dist/lfs/service.d.mts +9 -4
- package/dist/lfs/service.mjs +3 -12
- package/dist/lfs/upkeep.mjs +45 -56
- package/dist/lfs/wire.mjs +1 -1
- package/dist/node.d.mts +3 -2
- package/dist/node.mjs +1 -1
- package/dist/protocol/bytes/buffers.d.mts +1 -1
- package/dist/protocol/bytes/buffers.mjs +1 -1
- package/dist/protocol/bytes/deflate.d.mts +1 -1
- package/dist/protocol/bytes/deflate.mjs +1 -1
- package/dist/protocol/bytes/hmac-sha256.mjs +3 -6
- package/dist/protocol/bytes/inflate.d.mts +1 -1
- package/dist/protocol/bytes/inflate.mjs +1 -1
- package/dist/protocol/bytes/sha1.d.mts +1 -1
- package/dist/protocol/bytes/sha1.mjs +2 -2
- package/dist/protocol/diff/read.d.mts +1 -1
- package/dist/protocol/diff/read.mjs +1 -1
- package/dist/protocol/diff/tree-diff.d.mts +1 -1
- package/dist/protocol/diff/tree-diff.mjs +11 -11
- package/dist/protocol/objects/lfs-pointer.mjs +6 -1
- package/dist/protocol/objects/tag.mjs +1 -1
- package/dist/protocol/objects/tree.mjs +1 -1
- package/dist/protocol/packs/graph.mjs +1 -1
- package/dist/protocol/packs/idx.d.mts +1 -1
- package/dist/protocol/packs/idx.mjs +1 -1
- package/dist/protocol/packs/parts.mjs +1 -1
- package/dist/protocol/packs/reader.d.mts +1 -1
- package/dist/protocol/packs/reader.mjs +2 -2
- package/dist/protocol/packs/write-error.d.mts +1 -1
- package/dist/protocol/packs/write-error.mjs +1 -1
- package/dist/protocol/packs/writer.mjs +4 -4
- package/dist/protocol/wire/advertisement.d.mts +5 -11
- package/dist/protocol/wire/advertisement.mjs +17 -13
- package/dist/protocol/wire/fetch.d.mts +1 -1
- package/dist/protocol/wire/fetch.mjs +1 -1
- package/dist/protocol/wire/lines.d.mts +14 -2
- package/dist/protocol/wire/lines.mjs +32 -21
- package/dist/protocol/wire/push-uploads.mjs +4 -2
- package/dist/protocol/wire/receive-pack.d.mts +1 -1
- package/dist/protocol/wire/receive-pack.mjs +1 -1
- package/dist/protocol/wire/report-status.d.mts +1 -1
- package/dist/protocol/wire/report-status.mjs +1 -1
- package/dist/protocol/wire/v2.d.mts +5 -16
- package/dist/protocol/wire/v2.mjs +17 -15
- package/dist/queue/advance.mjs +227 -112
- package/dist/queue/callers.mjs +56 -69
- package/dist/queue/calls.mjs +24 -13
- package/dist/queue/commit.mjs +20 -7
- package/dist/queue/host.d.mts +12 -13
- package/dist/queue/host.mjs +15 -7
- package/dist/queue/lanes.mjs +9 -18
- package/dist/queue/layer.d.mts +6 -4
- package/dist/queue/layer.mjs +17 -11
- package/dist/queue/limits.mjs +53 -11
- package/dist/queue/rows.mjs +19 -15
- package/dist/queue/schedule.mjs +6 -5
- package/dist/queue/search.mjs +8 -13
- package/dist/queue/state.mjs +26 -7
- package/dist/queue/steps.mjs +10 -4
- package/dist/queue/trim.mjs +289 -0
- package/dist/rest/api.d.mts +1 -1
- package/dist/rest/blobs.d.mts +35 -35
- package/dist/rest/caller.d.mts +22 -20
- package/dist/rest/client.mjs +6 -6
- package/dist/rest/commits.d.mts +274 -274
- package/dist/rest/errors.d.mts +10 -10
- package/dist/rest/errors.mjs +1 -1
- package/dist/rest/events.d.mts +13 -11
- package/dist/rest/events.mjs +3 -1
- package/dist/rest/files.d.mts +78 -78
- package/dist/rest/forks.d.mts +170 -170
- package/dist/rest/handler.mjs +17 -8
- package/dist/rest/handlers.mjs +13 -7
- package/dist/rest/layer.d.mts +14 -0
- package/dist/rest/layer.mjs +53 -0
- package/dist/rest/listen.mjs +2 -2
- package/dist/rest/me.d.mts +18 -20
- package/dist/rest/me.mjs +1 -1
- package/dist/rest/merges.d.mts +10 -10
- package/dist/rest/namespace.d.mts +2 -0
- package/dist/rest/queue.d.mts +320 -320
- package/dist/rest/queue.mjs +1 -1
- package/dist/rest/refs.d.mts +207 -207
- package/dist/rest/refs.mjs +1 -1
- package/dist/rest/repos.d.mts +127 -127
- package/dist/rest/tags.d.mts +94 -94
- package/dist/rest/tokens.d.mts +248 -258
- package/dist/rest/tokens.mjs +10 -42
- package/dist/rest/topics.d.mts +154 -154
- package/dist/rest/topics.mjs +1 -1
- package/dist/rest/trees.d.mts +84 -84
- package/dist/rest/wire.d.mts +8 -4
- package/dist/rest/wire.mjs +3 -2
- package/dist/rest/work.d.mts +69 -69
- package/dist/rest/work.mjs +1 -1
- package/dist/server/check-fetch.mjs +9 -0
- package/dist/server/edge-node.d.mts +20 -0
- package/dist/server/edge-node.mjs +20 -0
- package/dist/server/edge.d.mts +10 -0
- package/dist/server/edge.mjs +23 -0
- package/dist/server/extension.mjs +3 -115
- package/dist/server/git-layer.d.mts +34 -6
- package/dist/server/git-layer.mjs +40 -18
- package/dist/server/git-namespace.d.mts +5 -4
- package/dist/server/git-namespace.mjs +10 -5
- package/dist/server/joined.d.mts +83 -0
- package/dist/server/joined.mjs +91 -0
- package/dist/server/registry.d.mts +9 -2
- package/dist/server/registry.mjs +179 -24
- package/dist/server/routes.mjs +2 -2
- package/dist/server/server.d.mts +11 -1
- package/dist/server/server.mjs +331 -201
- package/dist/server/uploads.d.mts +14 -0
- package/dist/server/uploads.mjs +15 -0
- package/dist/signin/context.d.mts +2 -1
- package/dist/signin/context.mjs +32 -37
- package/dist/signin/device.mjs +5 -5
- package/dist/signin/forms.mjs +1 -1
- package/dist/signin/grants.d.mts +2 -3
- package/dist/signin/grants.mjs +5 -5
- package/dist/signin/layer.d.mts +9 -0
- package/dist/signin/layer.mjs +41 -0
- package/dist/signin/namespace.d.mts +2 -0
- package/dist/signin/public.d.mts +6 -0
- package/dist/signin/public.mjs +5 -0
- package/dist/signin/route.mjs +47 -21
- package/dist/signin/web.mjs +3 -3
- package/dist/signin/wire.mjs +1 -1
- package/dist/storage/calls.d.mts +7 -8
- package/dist/storage/calls.mjs +17 -17
- package/dist/storage/clean-up.mjs +71 -34
- package/dist/storage/counted-bucket.mjs +34 -51
- package/dist/storage/fetch.mjs +1 -1
- package/dist/storage/host-bucket.mjs +17 -2
- package/dist/storage/index-build.d.mts +2 -2
- package/dist/storage/index-build.mjs +3 -3
- package/dist/storage/index-fetch.mjs +10 -6
- package/dist/storage/index-graph.mjs +1 -1
- package/dist/storage/index-layers.mjs +1 -1
- package/dist/storage/index-visible.mjs +1 -1
- package/dist/storage/layout.mjs +5 -0
- package/dist/storage/memory-budget.mjs +7 -1
- package/dist/storage/merge-cut.mjs +24 -1
- package/dist/storage/merge-fence.mjs +1 -1
- package/dist/storage/merge-plan.mjs +5 -2
- package/dist/storage/merge-row.mjs +1 -1
- package/dist/storage/merge-stream.mjs +16 -7
- package/dist/storage/merge-write.mjs +1 -1
- package/dist/storage/merge.d.mts +2 -2
- package/dist/storage/merge.mjs +1 -1
- package/dist/storage/object-rows.d.mts +2 -2
- package/dist/storage/object-rows.mjs +3 -3
- package/dist/storage/pack-ranges.d.mts +3 -1
- package/dist/storage/pack-ranges.mjs +168 -69
- package/dist/storage/pack-reads.mjs +4 -4
- package/dist/storage/pack-receive.d.mts +1 -1
- package/dist/storage/pack-receive.mjs +7 -9
- package/dist/storage/packs.d.mts +1 -1
- package/dist/storage/packs.mjs +45 -52
- package/dist/storage/placed-reads.mjs +81 -15
- package/dist/storage/prune-seen.mjs +126 -0
- package/dist/storage/prune-walk.mjs +87 -99
- package/dist/storage/prune.mjs +49 -14
- package/dist/storage/push-uploads.mjs +16 -18
- package/dist/storage/quarantine.d.mts +2 -2
- package/dist/storage/quarantine.mjs +51 -12
- package/dist/storage/ready.d.mts +2 -2
- package/dist/storage/ready.mjs +3 -3
- package/dist/storage/receive-bounds.d.mts +1 -1
- package/dist/storage/receive-files.mjs +1 -1
- package/dist/storage/receive-links.mjs +1 -1
- package/dist/storage/receive-state.d.mts +2 -2
- package/dist/storage/receive-state.mjs +1 -1
- package/dist/storage/receive-steps.mjs +1 -1
- package/dist/storage/repack-contained.mjs +2 -2
- package/dist/storage/repack-job.d.mts +2 -2
- package/dist/storage/repack-job.mjs +11 -17
- package/dist/storage/repack.d.mts +1 -1
- package/dist/storage/repack.mjs +9 -3
- package/dist/storage/rows.d.mts +2 -2
- package/dist/storage/rows.mjs +43 -4
- package/dist/storage/runs.d.mts +2 -2
- package/dist/storage/runs.mjs +15 -6
- package/dist/storage/send-list.mjs +6 -6
- package/dist/storage/single-flight.mjs +2 -2
- package/dist/storage/swap-walk.mjs +1 -1
- package/dist/storage/unpack.mjs +1 -1
- package/dist/store/call-count.d.mts +1 -1
- package/dist/store/call-count.mjs +125 -34
- package/dist/store/catalogue.d.mts +1 -1
- package/dist/store/catalogue.mjs +2 -2
- package/dist/store/crossing.mjs +2 -6
- package/dist/store/cursor-seal.mjs +1 -1
- package/dist/store/errors.d.mts +7 -3
- package/dist/store/errors.mjs +41 -13
- package/dist/store/job-try.mjs +130 -0
- package/dist/store/list-job.mjs +22 -16
- package/dist/store/outbox.d.mts +2 -2
- package/dist/store/outbox.mjs +112 -27
- package/dist/store/promises.d.mts +8 -3
- package/dist/store/promises.mjs +104 -94
- package/dist/store/queue-jobs.mjs +23 -2
- package/dist/store/records.d.mts +2 -2
- package/dist/store/records.mjs +16 -24
- package/dist/store/ref-rows.d.mts +2 -2
- package/dist/store/ref-rows.mjs +6 -6
- package/dist/store/reservations.mjs +35 -8
- package/dist/store/scopes.mjs +6 -14
- package/dist/store/topic-jobs.mjs +8 -8
- package/dist/sync/bound.d.mts +1 -3
- package/dist/sync/bound.mjs +30 -42
- package/dist/sync/bridge.d.mts +6 -0
- package/dist/sync/bridge.mjs +29 -0
- package/dist/sync/github.d.mts +5 -6
- package/dist/sync/github.mjs +37 -42
- package/dist/sync/http.mjs +15 -0
- package/dist/sync/import.mjs +17 -18
- package/dist/sync/layer.d.mts +9 -0
- package/dist/sync/layer.mjs +68 -0
- package/dist/sync/mirror.mjs +138 -59
- package/dist/sync/publish.mjs +15 -13
- package/dist/sync/step.mjs +221 -79
- package/dist/sync/tries.mjs +22 -15
- package/dist/sync.d.mts +3 -6
- package/dist/sync.mjs +3 -6
- package/dist/topics/advance.mjs +205 -90
- package/dist/topics/calls.mjs +8 -8
- package/dist/topics/directory.mjs +35 -12
- package/dist/topics/host.d.mts +5 -8
- package/dist/topics/host.mjs +42 -19
- package/dist/topics/layer.d.mts +381 -0
- package/dist/topics/layer.mjs +62 -0
- package/dist/topics/members.mjs +1 -1
- package/dist/topics/namespace.d.mts +2 -0
- package/dist/topics/public.d.mts +6 -0
- package/dist/topics/public.mjs +13 -0
- package/dist/topics/rows.mjs +12 -3
- package/dist/topics/topic.mjs +11 -10
- package/package.json +8 -13
- package/dist/access.d.mts +0 -2
- package/dist/access.mjs +0 -1
- package/dist/core/hooks/post-receive.mjs +0 -213
- package/dist/core/hooks/pre-receive.d.mts +0 -12
- package/dist/core/hooks/pre-receive.mjs +0 -36
- package/dist/lfs/repo.mjs +0 -42
- package/dist/server/extension.d.mts +0 -21
- package/dist/storage/promise-calls.mjs +0 -29
- package/dist/sync/import.d.mts +0 -10
- package/dist/sync/jobs.d.mts +0 -9
- package/dist/sync/jobs.mjs +0 -75
- package/dist/sync/mirror.d.mts +0 -13
- package/dist/sync/publish.d.mts +0 -6
package/dist/core/imports.mjs
CHANGED
|
@@ -1,23 +1,31 @@
|
|
|
1
1
|
import { SyncSource } from "../contracts/sync.mjs";
|
|
2
2
|
import { KeptError, keptError } from "./receipts.mjs";
|
|
3
|
+
import { SavedCaller } from "./saved-callers.mjs";
|
|
3
4
|
import { hexOf } from "../protocol/bytes/hex.mjs";
|
|
4
5
|
import { oidBytes } from "../protocol/packs/idx.mjs";
|
|
5
6
|
import { decodeRow, storeCall } from "../store/errors.mjs";
|
|
6
7
|
import { importJobName } from "../store/records.mjs";
|
|
8
|
+
import { refRowBytes, storesPeel } from "../store/ref-rows.mjs";
|
|
7
9
|
import { isPackId } from "../storage/layout.mjs";
|
|
8
10
|
import { receiveKey } from "../storage/receive-steps.mjs";
|
|
9
11
|
import { collections, newChangeId, repoScope } from "../store/scopes.mjs";
|
|
10
12
|
import { gitError } from "../contracts/result.mjs";
|
|
11
|
-
import * as Schema from "effect/Schema";
|
|
12
13
|
import * as Effect from "effect/Effect";
|
|
14
|
+
import * as Schema from "effect/Schema";
|
|
13
15
|
import * as Result from "effect/Result";
|
|
16
|
+
import { jsonBytes } from "@ref0/infra";
|
|
14
17
|
import * as Base64 from "effect/encoding/Base64";
|
|
15
18
|
// src/core/imports.ts
|
|
16
19
|
/**
|
|
17
20
|
* An import's own record, `imports/self` in its repo's scope, written by the create that starts it
|
|
18
21
|
* and by each step's commit, so a try after a crash goes on from the last step that landed:
|
|
19
|
-
* - `
|
|
20
|
-
* to its tip by the last step, `publish
|
|
22
|
+
* - `tipPages`: how many pages of tips the import's first step listed, the remote's branches and
|
|
23
|
+
* tags, each moved to its tip by the last step, `publish`, a page at a time, as `TipPage` says;
|
|
24
|
+
* none until that step lands;
|
|
25
|
+
* - `publishedPages`: how many of those pages `publish` has moved, the cursor each page's commit
|
|
26
|
+
* moves with its refs;
|
|
27
|
+
* - `head`: the branch the remote's `HEAD` named at that listing, kept only when it's one of
|
|
28
|
+
* the tips, which `publish` makes the repo's default branch, in the last page's commit;
|
|
21
29
|
* - `roots`: where the history copied so far stops, the remote's `shallow` lines; `deepest`, how
|
|
22
30
|
* many commits from each tip it holds; `step`, how many more the next segment asks for;
|
|
23
31
|
* - `copied`: whether the history is whole, so the next step publishes;
|
|
@@ -45,14 +53,21 @@ const ImportReceiving = /* @__PURE__ */ Schema.Struct({
|
|
|
45
53
|
bytes: Schema.Int
|
|
46
54
|
})
|
|
47
55
|
});
|
|
56
|
+
/**
|
|
57
|
+
* An import's record. `by`: who started it, as `SavedCaller` keeps them, asked again before each
|
|
58
|
+
* step, so the import fetches, publishes and offers the remote only what they may still see.
|
|
59
|
+
*/
|
|
48
60
|
const ImportRow = /* @__PURE__ */ Schema.Struct({
|
|
49
61
|
source: SyncSource,
|
|
62
|
+
by: SavedCaller,
|
|
50
63
|
state: Schema.Literals([
|
|
51
64
|
"running",
|
|
52
65
|
"done",
|
|
53
66
|
"failed"
|
|
54
67
|
]),
|
|
55
|
-
|
|
68
|
+
tipPages: Schema.optionalKey(Schema.Int),
|
|
69
|
+
publishedPages: Schema.optionalKey(Schema.Int),
|
|
70
|
+
head: Schema.optionalKey(Schema.String),
|
|
56
71
|
roots: Schema.Array(Schema.String),
|
|
57
72
|
deepest: Schema.Int,
|
|
58
73
|
step: Schema.Int,
|
|
@@ -99,11 +114,80 @@ const cutKey = {
|
|
|
99
114
|
id: "cut"
|
|
100
115
|
};
|
|
101
116
|
/**
|
|
117
|
+
* One page of the tips the import's listing kept, `imports/tip/<page>` beside its record: each ref
|
|
118
|
+
* by name, to the OID `publish` moves it to. The listing packs them by their bytes and by the most
|
|
119
|
+
* one push moves, as `tipPagesOf` says, so the record stays small whatever the remote holds, and
|
|
120
|
+
* each page's refs move in one commit with the cursor.
|
|
121
|
+
*/
|
|
122
|
+
const TipPage = /* @__PURE__ */ Schema.Record(Schema.String, Schema.String);
|
|
123
|
+
/** Page `page`'s key, zero-padded so the pages list in their order. */
|
|
124
|
+
const tipPageKey = (page) => ({
|
|
125
|
+
collection: collections.imports,
|
|
126
|
+
id: `tip/${String(page).padStart(4, "0")}`
|
|
127
|
+
});
|
|
128
|
+
const tipPageRow = (page, tips) => ({
|
|
129
|
+
...tipPageKey(page),
|
|
130
|
+
value: tips
|
|
131
|
+
});
|
|
132
|
+
/** The keys of pages `from` to `to`, `to` left out. */
|
|
133
|
+
const tipPageKeys = (from, to) => Array.from({ length: Math.max(0, to - from) }, (_, at) => tipPageKey(from + at));
|
|
134
|
+
/**
|
|
102
135
|
* What every end of an import deletes in the commit that ends it, publish's, a failure's and a
|
|
103
|
-
* cancel's: each key it keeps only while it runs, its cut
|
|
104
|
-
* receiving in steps, whose keys the quarantine's clean-up takes
|
|
136
|
+
* cancel's: each key it keeps only while it runs, its cut, the record of the segment `row` is
|
|
137
|
+
* receiving in steps, whose keys the quarantine's clean-up takes, and the pages of tips it hasn't
|
|
138
|
+
* published.
|
|
139
|
+
*/
|
|
140
|
+
const importEndDeletes = (row) => [
|
|
141
|
+
{ ...cutKey },
|
|
142
|
+
...row?.receiving === void 0 ? [] : [receiveKey(row.receiving.pack)],
|
|
143
|
+
...tipPageKeys(row?.publishedPages ?? 0, row?.tipPages ?? 0)
|
|
144
|
+
];
|
|
145
|
+
const pageMissing = (page) => gitError("DATA_LOSS", `The import's page ${page} of tips is gone`, { hint: failedHint });
|
|
146
|
+
/** Pages `from` to `to` of the import's tips, `to` left out, in one read. */
|
|
147
|
+
const readTipPages = /* @__PURE__ */ Effect.fnUntraced(function* (store, internalId, from, to) {
|
|
148
|
+
const keys = tipPageKeys(from, to);
|
|
149
|
+
if (keys.length === 0) return [];
|
|
150
|
+
const snapshot = yield* storeCall(() => store.read(repoScope(internalId), keys));
|
|
151
|
+
return yield* Effect.forEach(snapshot.results, ([held], at) => held === void 0 ? Effect.fail(pageMissing(from + at)) : decodeRow(TipPage, held, "Import tip page"));
|
|
152
|
+
});
|
|
153
|
+
/**
|
|
154
|
+
* The bytes the ref row a tip of `ref` puts takes, as `refBytesMost` counts it: a tag's with its
|
|
155
|
+
* peel, its most, since the listing doesn't say which tags are annotated. Its entry in a page
|
|
156
|
+
* takes 42 bytes less, its comma included.
|
|
105
157
|
*/
|
|
106
|
-
const
|
|
158
|
+
const tipRowBytes = (ref, oid) => refRowBytes(ref, storesPeel(ref) ? {
|
|
159
|
+
oid,
|
|
160
|
+
peeled: oid
|
|
161
|
+
} : { oid });
|
|
162
|
+
/** A tip's entry in its page, as UTF-8 JSON: its name, `:`, its OID. */
|
|
163
|
+
const entryBytes = (ref, oid) => jsonBytes(ref) + 1 + jsonBytes(oid);
|
|
164
|
+
/**
|
|
165
|
+
* `tips` packed into pages: each at most `most` entries and, as UTF-8 JSON, `bytes` with its braces
|
|
166
|
+
* and commas, unless one entry alone is past it. `last`'s entry, the head the import adopts, goes on
|
|
167
|
+
* the last page, so the record's fence and the default's move stay in the commit that ends the
|
|
168
|
+
* import.
|
|
169
|
+
*/
|
|
170
|
+
const tipPagesOf = (tips, last, limits) => {
|
|
171
|
+
const ordered = [...tips.filter(([ref]) => ref !== last), ...tips.filter(([ref]) => ref === last)];
|
|
172
|
+
const pages = [];
|
|
173
|
+
let page = {};
|
|
174
|
+
let count = 0;
|
|
175
|
+
let bytes = 2;
|
|
176
|
+
for (const [ref, oid] of ordered) {
|
|
177
|
+
const size = entryBytes(ref, oid);
|
|
178
|
+
if (count > 0 && (count >= limits.most || bytes + 1 + size > limits.bytes)) {
|
|
179
|
+
pages.push(page);
|
|
180
|
+
page = {};
|
|
181
|
+
count = 0;
|
|
182
|
+
bytes = 2;
|
|
183
|
+
}
|
|
184
|
+
bytes += (count === 0 ? 0 : 1) + size;
|
|
185
|
+
count += 1;
|
|
186
|
+
page[ref] = oid;
|
|
187
|
+
}
|
|
188
|
+
if (count > 0) pages.push(page);
|
|
189
|
+
return pages;
|
|
190
|
+
};
|
|
107
191
|
/** `cut` as its row, beside `roots`: none of their parents are anywhere but in it. */
|
|
108
192
|
const cutRow = (roots, cut) => {
|
|
109
193
|
const parents = roots.flatMap((root) => cut[root] ?? []);
|
|
@@ -163,7 +247,7 @@ const readImport = /* @__PURE__ */ Effect.fnUntraced(function* (store, internalI
|
|
|
163
247
|
};
|
|
164
248
|
});
|
|
165
249
|
/**
|
|
166
|
-
* `
|
|
250
|
+
* `JoinedCalls.importState`: the repo's import as its row and cancel row hold it, in one read, or
|
|
167
251
|
* `undefined` for a repo no import made. A running row whose job has gone stays `running`: this
|
|
168
252
|
* read writes nothing, where `importLive` commits it `failed`.
|
|
169
253
|
*/
|
|
@@ -172,7 +256,7 @@ const importStateOf = /* @__PURE__ */ Effect.fnUntraced(function* (store, intern
|
|
|
172
256
|
if (row === void 0) return void 0;
|
|
173
257
|
return row.state === "running" && cancelled ? "cancelled" : row.state;
|
|
174
258
|
});
|
|
175
|
-
/** Whether the repo's `
|
|
259
|
+
/** Whether the repo's `sync.import` job is waiting or running: a try is due or under way. */
|
|
176
260
|
const jobLive = /* @__PURE__ */ Effect.fnUntraced(function* (store, internalId) {
|
|
177
261
|
const scope = repoScope(internalId);
|
|
178
262
|
let after;
|
|
@@ -209,4 +293,4 @@ const importLive = /* @__PURE__ */ Effect.fnUntraced(function* (store, internalI
|
|
|
209
293
|
}
|
|
210
294
|
return true;
|
|
211
295
|
});
|
|
212
|
-
export { ImportReceiving, ImportRow, cancelKey, cutKey, cutRow, failedHint, failedRow, importEndDeletes, importKey, importLive, importRow, importStateOf, readImport, stoppedTry };
|
|
296
|
+
export { ImportReceiving, ImportRow, cancelKey, cutKey, cutRow, failedHint, failedRow, importEndDeletes, importKey, importLive, importRow, importStateOf, readImport, readTipPages, stoppedTry, tipPageKey, tipPageRow, tipPagesOf, tipRowBytes };
|
package/dist/core/index-job.mjs
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
|
+
import { keepsEvents } from "../contracts/events.mjs";
|
|
1
2
|
import { indexRowOf } from "../storage/index-build.mjs";
|
|
2
3
|
import { liftsHolds } from "../storage/index-remap.mjs";
|
|
3
4
|
import { indexRowKey } from "../storage/layout.mjs";
|
|
4
5
|
import { resultCall, storeCall } from "../store/errors.mjs";
|
|
5
|
-
import { runJobTry } from "../store/crossing.mjs";
|
|
6
6
|
import { decodePacks } from "../store/git-store.mjs";
|
|
7
7
|
import { appendEvents, decodeOutbox, outboxReads, repoEnvelope } from "../store/outbox.mjs";
|
|
8
8
|
import { WholeRepo, wholeRefs } from "../store/ref-rows.mjs";
|
|
9
9
|
import { readRecord } from "../store/repo-record.mjs";
|
|
10
|
+
import { budgetedInput } from "../store/call-count.mjs";
|
|
11
|
+
import { gitJob } from "../store/job-try.mjs";
|
|
10
12
|
import { collections, jobRepo, newChangeId, repoScope } from "../store/scopes.mjs";
|
|
11
13
|
import { settleName } from "../store/settle.mjs";
|
|
12
14
|
import { SealedObjects } from "./view.mjs";
|
|
13
15
|
import { fail } from "../contracts/result.mjs";
|
|
14
|
-
import { defineJob } from "@ref0/infra";
|
|
15
|
-
import * as Schema from "effect/Schema";
|
|
16
16
|
import * as Effect from "effect/Effect";
|
|
17
|
-
import * as
|
|
17
|
+
import * as Schema from "effect/Schema";
|
|
18
|
+
import { CurrentJob, Job } from "@ref0/infra";
|
|
18
19
|
import * as DateTime from "effect/DateTime";
|
|
19
20
|
// src/core/index-job.ts
|
|
20
21
|
/**
|
|
@@ -46,8 +47,6 @@ const roundOf = (key) => {
|
|
|
46
47
|
const round = Number(key.slice(6));
|
|
47
48
|
return Number.isSafeInteger(round) && round > 0 ? round : 0;
|
|
48
49
|
};
|
|
49
|
-
const indexJobSchema = /* @__PURE__ */ Schema.toStandardSchemaV1(IndexJobData);
|
|
50
|
-
const decodeIndexJobData = /* @__PURE__ */ Schema.decodeUnknownOption(IndexJobData);
|
|
51
50
|
/**
|
|
52
51
|
* The build reads every ref, private or not: its index answers for the repo's objects, as upkeep
|
|
53
52
|
* keeps them, whoever fetches.
|
|
@@ -99,18 +98,19 @@ const indexAttempt = /* @__PURE__ */ Effect.fnUntraced(function* (parts, store,
|
|
|
99
98
|
at,
|
|
100
99
|
lastCheck
|
|
101
100
|
});
|
|
101
|
+
const stepOf = (asked) => Effect.flatMap(budgetedInput(asked.input), (input) => resultCall(() => index.step(asked.listed, input)));
|
|
102
102
|
const first = yield* read();
|
|
103
103
|
if (first === void 0) return {
|
|
104
104
|
ended: "none",
|
|
105
105
|
next: void 0
|
|
106
106
|
};
|
|
107
|
-
const asked = yield*
|
|
107
|
+
const asked = yield* stepOf(first);
|
|
108
108
|
const tried = asked.kind === "moved" ? yield* read(true) : first;
|
|
109
109
|
if (tried === void 0) return {
|
|
110
110
|
ended: "none",
|
|
111
111
|
next: void 0
|
|
112
112
|
};
|
|
113
|
-
const step = tried === first ? asked : yield*
|
|
113
|
+
const step = tried === first ? asked : yield* stepOf(tried);
|
|
114
114
|
if (step.kind === "moved") return yield* fail("INTERNAL", "The host's IndexCalls answered moved to a last check");
|
|
115
115
|
const { record, snapshot, listed, packs, row, headRows, cursorRows } = tried;
|
|
116
116
|
if (step.kind === "more") return {
|
|
@@ -132,7 +132,7 @@ const indexAttempt = /* @__PURE__ */ Effect.fnUntraced(function* (parts, store,
|
|
|
132
132
|
const ids = packs.map(({ id }) => id);
|
|
133
133
|
const landed = index.status(step.row, at, ids);
|
|
134
134
|
const refusal = refusalOf(landed, index.status(row, at, ids));
|
|
135
|
-
const sends = refusal !== void 0 && parts.events
|
|
135
|
+
const sends = refusal !== void 0 && keepsEvents(parts.events) && record.deleted !== true;
|
|
136
136
|
const events = sends ? [refusedEvent(record.name, refusal)] : [];
|
|
137
137
|
const outbox = yield* decodeOutbox([headRows, cursorRows]);
|
|
138
138
|
const settling = {
|
|
@@ -181,7 +181,7 @@ const refusedEvent = (repo, refusal) => ({
|
|
|
181
181
|
* one version, and the step's input over them. `undefined` for a repo with no record.
|
|
182
182
|
*/
|
|
183
183
|
const readTry = /* @__PURE__ */ Effect.fnUntraced(function* (parts, store, internalId, of) {
|
|
184
|
-
const reads = parts.events
|
|
184
|
+
const reads = keepsEvents(parts.events) ? eventReads : tryReads;
|
|
185
185
|
const { record, snapshot } = yield* readRecord(store, internalId, reads);
|
|
186
186
|
if (record === void 0) return void 0;
|
|
187
187
|
const [, refRows = [], packRows = [], indexRows = [], headRows = [], cursorRows = []] = snapshot.results;
|
|
@@ -218,10 +218,14 @@ const readTry = /* @__PURE__ */ Effect.fnUntraced(function* (parts, store, inter
|
|
|
218
218
|
/** `indexAttempt`, as the queue takes it. */
|
|
219
219
|
const indexTry = (...args) => Effect.map(indexAttempt(...args), (attempt) => attempt.next);
|
|
220
220
|
/** `git.index`'s try, in the repo's scope: a step of the build, or past its tries, the refusal. */
|
|
221
|
-
const
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
221
|
+
const indexStep = (parts) => (data) => Effect.flatMap(Effect.all([
|
|
222
|
+
CurrentJob.current,
|
|
223
|
+
CurrentJob.store,
|
|
224
|
+
CurrentJob.signal
|
|
225
|
+
]), ([job, store, signal]) => job.attempt > 20 ? refusalTry(parts, job, {
|
|
226
|
+
store,
|
|
227
|
+
signal
|
|
228
|
+
}, data, spentReason(lastOf(job))) : indexTry(parts, store, jobRepo(job), data, signal, roundOf(job.key)));
|
|
225
229
|
/** How the build's last try ended, as the first refusal try's claim says: later ones can't. */
|
|
226
230
|
const lastOf = (job) => {
|
|
227
231
|
if (job.attempt > 21) return "its refusal tried again";
|
|
@@ -260,7 +264,14 @@ const refusalTry = /* @__PURE__ */ Effect.fnUntraced(function* (parts, job, cont
|
|
|
260
264
|
* its failure logged. A round left failed with no refused row is one an operator's `retry` starts
|
|
261
265
|
* again, since no refusal stands for its try to prune against.
|
|
262
266
|
*/
|
|
263
|
-
const indexFailed = (parts) => (
|
|
267
|
+
const indexFailed = (parts) => (data, failure) => Effect.flatMap(Effect.all([
|
|
268
|
+
CurrentJob.current,
|
|
269
|
+
CurrentJob.store,
|
|
270
|
+
CurrentJob.signal
|
|
271
|
+
]), ([job, store, signal]) => Effect.catch(refusalTry(parts, job, {
|
|
272
|
+
store,
|
|
273
|
+
signal
|
|
274
|
+
}, data, spentReason(failure.error instanceof Error ? failure.error.message : String(failure.error))), (error) => Effect.logError(`git.index left repo ${jobRepo(job)} failed, with no refusal: ${error.message}`)).pipe(Effect.asVoid));
|
|
264
275
|
/** How many times a refusal's try reads and writes the refused row before it fails. */
|
|
265
276
|
const refusalWrites = 3;
|
|
266
277
|
/**
|
|
@@ -269,9 +280,8 @@ const refusalWrites = 3;
|
|
|
269
280
|
* row, the next tries leave a refused row, and `indexFailed` is their last chance. One at a time
|
|
270
281
|
* in each process, as `git.repack` runs.
|
|
271
282
|
*/
|
|
272
|
-
const
|
|
273
|
-
|
|
274
|
-
schema: indexJobSchema,
|
|
283
|
+
const IndexJob = /* @__PURE__ */ Job.make(indexJobName, {
|
|
284
|
+
payload: IndexJobData,
|
|
275
285
|
timeout: "13 minutes",
|
|
276
286
|
concurrency: 1,
|
|
277
287
|
retry: {
|
|
@@ -279,13 +289,12 @@ const indexJob = (parts) => defineJob({
|
|
|
279
289
|
delay: "1 second",
|
|
280
290
|
backoff: "exponential",
|
|
281
291
|
maxDelay: "5 minutes"
|
|
282
|
-
}
|
|
283
|
-
handler: indexHandler(parts),
|
|
284
|
-
onFailure: indexFailed(parts)
|
|
292
|
+
}
|
|
285
293
|
});
|
|
294
|
+
const indexJob = (parts) => gitJob(IndexJob, indexStep(parts), { onFailure: indexFailed(parts) });
|
|
286
295
|
/** The repo's `git.index` row for `round`, or for its delete, due now. */
|
|
287
296
|
const indexJobRow = (job, round = 0) => job.job({
|
|
288
297
|
key: indexJobKeyOf(round),
|
|
289
298
|
data: {}
|
|
290
299
|
});
|
|
291
|
-
export { IndexJobData, indexDeletedKey,
|
|
300
|
+
export { IndexJobData, indexDeletedKey, indexJob, indexJobKey, indexJobKeyOf, indexJobName, indexJobRow };
|
|
@@ -3,8 +3,8 @@ import { GitError } from "../contracts/result.mjs";
|
|
|
3
3
|
import "../engine/parts.mjs";
|
|
4
4
|
import { RepoView, ViewRead } from "./view.mjs";
|
|
5
5
|
import * as Effect from "effect/Effect";
|
|
6
|
-
import * as Context from "effect/Context";
|
|
7
6
|
import "effect/Option";
|
|
7
|
+
import * as Context from "effect/Context";
|
|
8
8
|
/** What `MergesService.merge` merges: three trees, read as `view`'s caller reads them at `at`. */
|
|
9
9
|
export interface MergeInput {
|
|
10
10
|
readonly view: RepoView;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { gitError } from "../contracts/result.mjs";
|
|
2
2
|
import * as Effect from "effect/Effect";
|
|
3
|
-
import * as Context from "effect/Context";
|
|
4
3
|
import * as Option from "effect/Option";
|
|
4
|
+
import * as Context from "effect/Context";
|
|
5
5
|
// src/core/merge-parts.ts
|
|
6
6
|
/**
|
|
7
7
|
* Git's three-way merge and line diff, over xdiff: what a host provides with `Merges.layer` to
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { MirrorPause, MirrorPush, SyncSource } from "../contracts/sync.mjs";
|
|
2
|
+
import { SavedCaller } from "./saved-callers.mjs";
|
|
3
|
+
import * as Schema from "effect/Schema";
|
|
4
|
+
// src/core/mirror-rows.ts
|
|
5
|
+
/**
|
|
6
|
+
* A mirror's row in `mirrors`, by its ref's full name: where it pushes, by provider name, whether
|
|
7
|
+
* it's paused and why, `lastPushed`, the last push the destination took, and `by`, who saved it,
|
|
8
|
+
* whom each try asks again before it reads the ref. A push that moves the ref saves the mirror's
|
|
9
|
+
* job while it's `active`.
|
|
10
|
+
*/
|
|
11
|
+
const MirrorRow = /* @__PURE__ */ Schema.Struct({
|
|
12
|
+
destination: SyncSource,
|
|
13
|
+
state: Schema.Literals(["active", "paused"]),
|
|
14
|
+
paused: Schema.optionalKey(MirrorPause),
|
|
15
|
+
lastPushed: Schema.optionalKey(MirrorPush),
|
|
16
|
+
by: SavedCaller
|
|
17
|
+
});
|
|
18
|
+
export { MirrorRow };
|
package/dist/core/names.mjs
CHANGED
|
@@ -9,7 +9,7 @@ const refPart = /^[^\0-\x20\x7f~^:?*[\\]+$/;
|
|
|
9
9
|
*/
|
|
10
10
|
const isRefName = (name) => {
|
|
11
11
|
if (!name.startsWith("refs/") || name.endsWith("/") || name.endsWith(".")) return false;
|
|
12
|
-
if (name.length >
|
|
12
|
+
if (name.length > 768 || utf8(name).length > 768) return false;
|
|
13
13
|
if (name.includes("..") || name.includes("@{") || name === "@") return false;
|
|
14
14
|
return name.split("/").every((part) => refPart.test(part) && !part.startsWith(".") && !part.endsWith(".lock"));
|
|
15
15
|
};
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { objects_namespace_d_exports } from "./objects/objects-namespace.mjs";
|
|
2
|
-
|
|
2
|
+
import { saved_callers_public_d_exports } from "./saved-callers-public.mjs";
|
|
3
|
+
export { objects_namespace_d_exports as Objects, saved_callers_public_d_exports as SavedCallers };
|
|
@@ -25,7 +25,7 @@ const fieldsOf = (fields, signature) => signature === void 0 ? fields : {
|
|
|
25
25
|
* what the call's reads before it left, `call`. A server with no `Merges` refuses it as
|
|
26
26
|
* `merges-off`.
|
|
27
27
|
*/
|
|
28
|
-
const mergedTree = (opened, made, sides, options, call)
|
|
28
|
+
const mergedTree = /* @__PURE__ */ Effect.fnUntraced(function* (opened, made, sides, options, call) {
|
|
29
29
|
const parts = yield* mergePartsOrOff;
|
|
30
30
|
const input = { ...sides };
|
|
31
31
|
if (options.limits !== void 0) input.limits = options.limits;
|
|
@@ -42,7 +42,7 @@ const parentOf = (commit, call) => {
|
|
|
42
42
|
/** A revert or pick whose change is already on its target: Git commits nothing for it. */
|
|
43
43
|
const unchanged = (tree, onto, call) => tree === onto.tree ? fail("FAILED_PRECONDITION", `The ${call} changes nothing on ${onto.oid}`, { hint: "Its change is already there" }) : Effect.void;
|
|
44
44
|
/** Each parent a commit the repo holds, named once. */
|
|
45
|
-
const checkedParents =
|
|
45
|
+
const checkedParents = /* @__PURE__ */ Effect.fnUntraced(function* (reader, parents) {
|
|
46
46
|
if (parents.length > 4096) return yield* Effect.fail(tooManyParents("The commit", parents.length));
|
|
47
47
|
if (new Set(parents).size < parents.length) return yield* fail("INVALID_ARGUMENT", "The commit names a parent twice");
|
|
48
48
|
for (const parent of parents) yield* objectOfType(reader, parent, "commit");
|
|
@@ -70,7 +70,7 @@ const commitWrites = (callerOf) => {
|
|
|
70
70
|
signature ?? null,
|
|
71
71
|
ref ?? null
|
|
72
72
|
],
|
|
73
|
-
make: (opened, made, limits)
|
|
73
|
+
make: Effect.fnUntraced(function* (opened, made, limits) {
|
|
74
74
|
const { reader, deadline } = yield* readerOf(opened, limits, "walk-limit");
|
|
75
75
|
const written = Effect.gen(function* () {
|
|
76
76
|
yield* checkedParents(reader, parents);
|
|
@@ -113,7 +113,7 @@ const commitWrites = (callerOf) => {
|
|
|
113
113
|
committer
|
|
114
114
|
],
|
|
115
115
|
revisions: [onto],
|
|
116
|
-
make: (opened, made, limits)
|
|
116
|
+
make: Effect.fnUntraced(function* (opened, made, limits) {
|
|
117
117
|
const [tip = ""] = opened.oids;
|
|
118
118
|
const { reader, call } = yield* readerOf(opened, limits, "walk-limit");
|
|
119
119
|
const reverted = yield* namedCommit(reader, commit);
|
|
@@ -157,7 +157,7 @@ const commitWrites = (callerOf) => {
|
|
|
157
157
|
input.committer ?? null,
|
|
158
158
|
ref ?? null
|
|
159
159
|
],
|
|
160
|
-
make: (opened, made, limits)
|
|
160
|
+
make: Effect.fnUntraced(function* (opened, made, limits) {
|
|
161
161
|
const { reader, call } = yield* readerOf(opened, limits, "walk-limit");
|
|
162
162
|
const picked = yield* namedCommit(reader, commit);
|
|
163
163
|
const parent = yield* parentOf(picked, "a pick");
|
|
@@ -33,7 +33,7 @@ const mergeCalls = (bound) => {
|
|
|
33
33
|
committer
|
|
34
34
|
],
|
|
35
35
|
revisions: [ours, input.theirs],
|
|
36
|
-
make: (opened, made, limits)
|
|
36
|
+
make: Effect.fnUntraced(function* (opened, made, limits) {
|
|
37
37
|
const [tip = "", named = ""] = opened.oids;
|
|
38
38
|
const { reader, call } = yield* readerOf(opened, limits, "walk-limit");
|
|
39
39
|
const theirs = (yield* namedCommit(reader, named)).oid;
|
|
@@ -5,8 +5,8 @@ import { defaultFetchLimits } from "../../storage/fetch.mjs";
|
|
|
5
5
|
import { loose } from "../../storage/loose.mjs";
|
|
6
6
|
import { packs } from "../../storage/packs.mjs";
|
|
7
7
|
import { IndexedStorage, Storage } from "./objects.mjs";
|
|
8
|
-
import { Bucket, CallLimits, Records } from "@ref0/infra";
|
|
9
8
|
import * as Effect from "effect/Effect";
|
|
9
|
+
import { Bucket, CallLimits, Records } from "@ref0/infra";
|
|
10
10
|
import * as Context from "effect/Context";
|
|
11
11
|
import * as Layer from "effect/Layer";
|
|
12
12
|
// src/core/objects/objects-layer.ts
|
|
@@ -8,6 +8,7 @@ import { WholeRepo } from "../../store/ref-rows.mjs";
|
|
|
8
8
|
import { collections } from "../../store/scopes.mjs";
|
|
9
9
|
import { indexRowKey } from "../../storage/layout.mjs";
|
|
10
10
|
import { isVisibleTooLong } from "../../storage/visible.mjs";
|
|
11
|
+
import { heldOf as heldOf$1 } from "../../storage/wants.mjs";
|
|
11
12
|
import { objectsFace, objectsOnce, readOnce, scopedReader, startingOnce } from "../../storage/calls.mjs";
|
|
12
13
|
import { callScope } from "../../store/call-count.mjs";
|
|
13
14
|
import { resultIn } from "../../store/crossing.mjs";
|
|
@@ -18,10 +19,10 @@ import { SealedObjects, viewOf } from "../view.mjs";
|
|
|
18
19
|
import { answerFailed } from "../../contracts/calls-spent.mjs";
|
|
19
20
|
import { CoreParts, ObjectsParts } from "../parts.mjs";
|
|
20
21
|
import { read } from "./objects.mjs";
|
|
21
|
-
import * as Schema from "effect/Schema";
|
|
22
22
|
import * as Effect from "effect/Effect";
|
|
23
|
-
import * as SchemaTransformation from "effect/SchemaTransformation";
|
|
24
23
|
import * as Option from "effect/Option";
|
|
24
|
+
import * as Schema from "effect/Schema";
|
|
25
|
+
import * as SchemaTransformation from "effect/SchemaTransformation";
|
|
25
26
|
import * as Scope from "effect/Scope";
|
|
26
27
|
// src/core/objects/reading.ts
|
|
27
28
|
/**
|
|
@@ -72,14 +73,15 @@ const openRead = /* @__PURE__ */ Effect.fnUntraced(function* (caller, repo, revi
|
|
|
72
73
|
});
|
|
73
74
|
/**
|
|
74
75
|
* `openRead` for a write `keyed` by a key: `undefined`, with nothing asked of `authorize`, once
|
|
75
|
-
* the name holds a repo other than the one its key's lookup saw, as `openKeyed` says.
|
|
76
|
+
* the name holds a repo other than the one its key's lookup saw, as `openKeyed` says. It confirms
|
|
77
|
+
* nothing: the write lands by `internalId`, as `Confirm`'s `skip` says.
|
|
76
78
|
*/
|
|
77
79
|
const openKeyedRead = /* @__PURE__ */ Effect.fnUntraced(function* (caller, repo, revisions, keyed, internalId) {
|
|
78
80
|
const { asked, reads } = yield* readsOf(revisions);
|
|
79
81
|
const opened = yield* openKeyed(caller, {
|
|
80
82
|
kind: "read",
|
|
81
83
|
repo
|
|
82
|
-
}, reads, keyed, internalId);
|
|
84
|
+
}, reads, keyed, internalId, "skip");
|
|
83
85
|
if (opened === void 0) return void 0;
|
|
84
86
|
return yield* readOpened(caller, repo, revisions, {
|
|
85
87
|
asked,
|
|
@@ -203,7 +205,7 @@ const namedBy = (revision, candidates, held, defaultBranch) => {
|
|
|
203
205
|
* rule (Q861): nothing a request caches, skips or stops on may depend on whether a hidden ID was
|
|
204
206
|
* found, so only reached IDs and tips are remembered, and `hidden-short-ids.fuzz.test.ts` holds it.
|
|
205
207
|
*/
|
|
206
|
-
const resolved = (revision, candidates, held, defaultBranch, repo, starting)
|
|
208
|
+
const resolved = /* @__PURE__ */ Effect.fnUntraced(function* (revision, candidates, held, defaultBranch, repo, starting) {
|
|
207
209
|
if (isOid(revision)) return revision;
|
|
208
210
|
const named = namedBy(revision, candidates, held, defaultBranch);
|
|
209
211
|
if (named !== void 0) return named;
|
|
@@ -221,6 +223,49 @@ const resolved = (revision, candidates, held, defaultBranch, repo, starting) =>
|
|
|
221
223
|
context: { reason: "ambiguous" }
|
|
222
224
|
});
|
|
223
225
|
});
|
|
226
|
+
/** Git's zero ID, which names no object: a lookup of it always makes the reads a missing ID needs. */
|
|
227
|
+
const noObject = "0".repeat(40);
|
|
228
|
+
/**
|
|
229
|
+
* Which of `oids` the refs `caller` sees of `resolved` reach, or `undefined` when its view isn't
|
|
230
|
+
* narrowed, so it reads every object and nothing is read here. Else one read of the repo's packs,
|
|
231
|
+
* every ref and its `index` row at one version, as `readOpened` makes for a narrowed view, and
|
|
232
|
+
* one lookup of them all beside `noObject`, so where an index covers the listing the lookup's reads
|
|
233
|
+
* are the same whichever of them the repo holds. Where none does, as with Git's reads by ID, an ID
|
|
234
|
+
* the repo holds walks the caller's history and a missing one doesn't, so the reads differ, and
|
|
235
|
+
* past `wantWalkMost` the answer does too: the residual `before-production.md` names, and the
|
|
236
|
+
* oracle's record, `.agents/docs/security/git-want-existence-oracle.md` (Q839 (4)). The caller's
|
|
237
|
+
* own writes count for nothing: an object only they wrote, through the API, is unseen here, so
|
|
238
|
+
* writing a blob proves no ref reaches it. A repo deleted since it opened is `NOT_FOUND`.
|
|
239
|
+
*/
|
|
240
|
+
const seenIn = /* @__PURE__ */ Effect.fnUntraced(function* (caller, resolved, oids) {
|
|
241
|
+
const core = yield* CoreParts;
|
|
242
|
+
const view = yield* viewOf(caller, resolved, void 0, { ownWrites: false });
|
|
243
|
+
if (!(yield* view.narrowed)) return void 0;
|
|
244
|
+
const { record, snapshot } = yield* readRecord(core.store, resolved.internalId, [
|
|
245
|
+
packsRead,
|
|
246
|
+
everyRef,
|
|
247
|
+
indexRowKey
|
|
248
|
+
]);
|
|
249
|
+
if (record === void 0 || record.deleted === true) return yield* fail("NOT_FOUND", `No repo '${resolved.name}'`);
|
|
250
|
+
const [, packRows = [], refRows = [], indexRows = []] = snapshot.results;
|
|
251
|
+
const packs = yield* decodePacks(packRows);
|
|
252
|
+
const listed = {
|
|
253
|
+
repo: resolved.internalId,
|
|
254
|
+
version: snapshot.version,
|
|
255
|
+
packs
|
|
256
|
+
};
|
|
257
|
+
const at = {
|
|
258
|
+
listed,
|
|
259
|
+
refs: yield* view.refs(refRows),
|
|
260
|
+
refRows,
|
|
261
|
+
index: indexRows[0]?.value
|
|
262
|
+
};
|
|
263
|
+
const objects = yield* read({
|
|
264
|
+
view,
|
|
265
|
+
at
|
|
266
|
+
});
|
|
267
|
+
return yield* heldOf$1(objectsFace(objects), listed, [...oids, noObject]);
|
|
268
|
+
});
|
|
224
269
|
/**
|
|
225
270
|
* A write sent again reads back the object it made, which its caller already holds: it reads it
|
|
226
271
|
* whole, whatever refs reach it.
|
|
@@ -250,7 +295,7 @@ const objectIn = /* @__PURE__ */ Effect.fnUntraced(function* (repo, oid) {
|
|
|
250
295
|
* An object by its ID, through the repo's reads: `NOT_FOUND` when it holds none. The read takes
|
|
251
296
|
* the call's interruption as its signal, so a call cancelled, or a REST request dropped, stops it.
|
|
252
297
|
*/
|
|
253
|
-
const objectAt =
|
|
298
|
+
const objectAt = /* @__PURE__ */ Effect.fnUntraced(function* (opened, oid) {
|
|
254
299
|
if (!isOid(oid)) return yield* fail("INVALID_ARGUMENT", `'${oid}' isn't a full object ID`);
|
|
255
300
|
const result = yield* Effect.promise((signal) => opened.read({
|
|
256
301
|
oid,
|
|
@@ -376,4 +421,4 @@ const readerOf = (opened, limits, reason) => Effect.map(deadlineOf(limits.millis
|
|
|
376
421
|
call
|
|
377
422
|
};
|
|
378
423
|
});
|
|
379
|
-
export { base64Size, dropped, fitting, heldCursor, heldDigest, heldIndex, heldListing, heldOf, innerPage, jsonSize, objectAt, objectIn, openKeyedRead, openRead, readerOf, responseBytes, responseTooLarge, withinResponse };
|
|
424
|
+
export { base64Size, dropped, fitting, heldCursor, heldDigest, heldIndex, heldListing, heldOf, innerPage, jsonSize, objectAt, objectIn, openKeyedRead, openRead, readerOf, responseBytes, responseTooLarge, seenIn, withinResponse };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { fail } from "../../contracts/result.mjs";
|
|
2
|
+
import { TreeEdit } from "../../contracts/trees.mjs";
|
|
2
3
|
import { fromDiff } from "../../engine/failures.mjs";
|
|
3
4
|
import { keyOf } from "../../protocol/diff/paths.mjs";
|
|
4
5
|
import { isDotFile, isDotgit } from "../../protocol/objects/fsck-names.mjs";
|
|
@@ -9,6 +10,7 @@ import { isOid, utf8 } from "../../protocol/bytes/text.mjs";
|
|
|
9
10
|
import { dropped } from "./reading.mjs";
|
|
10
11
|
import { writeBytesMost } from "./writing.mjs";
|
|
11
12
|
import * as Effect from "effect/Effect";
|
|
13
|
+
import * as Schema from "effect/Schema";
|
|
12
14
|
// src/core/objects/tree-edits.ts
|
|
13
15
|
const asRead = fromDiff("walk-limit");
|
|
14
16
|
/** The most edits one `trees.create` or `commits.create` takes. */
|
|
@@ -58,37 +60,20 @@ const typeOf = /* @__PURE__ */ Effect.fnUntraced(function* (reader, oid) {
|
|
|
58
60
|
dropped(object);
|
|
59
61
|
return object.type;
|
|
60
62
|
});
|
|
63
|
+
const decodeTreeEdit = /* @__PURE__ */ Schema.decodeUnknownEffect(TreeEdit);
|
|
64
|
+
/** `edit` without keys set to `undefined`, which `TreeEdit`'s `optionalKey` fields refuse. */
|
|
65
|
+
const definedFields = ({ path, mode, oid, content }) => {
|
|
66
|
+
const fields = { path };
|
|
67
|
+
if (mode !== void 0) fields.mode = mode;
|
|
68
|
+
if (oid !== void 0) fields.oid = oid;
|
|
69
|
+
if (content !== void 0) fields.content = content;
|
|
70
|
+
return fields;
|
|
71
|
+
};
|
|
61
72
|
/**
|
|
62
73
|
* One edit's shape: a deletion with no content or mode, or content or an object ID, not both,
|
|
63
|
-
* each with a mode or none.
|
|
74
|
+
* each with a mode or none. Decoded through `TreeEdit`, with failures mapped to `badPath`.
|
|
64
75
|
*/
|
|
65
|
-
const treeEditOf = (edit) =>
|
|
66
|
-
const { path, mode, oid, content } = edit;
|
|
67
|
-
if (oid === null) {
|
|
68
|
-
if (content !== void 0 || mode !== void 0) return badPath(path, "is deleted, so its edit takes no content or mode");
|
|
69
|
-
return Effect.succeed({
|
|
70
|
-
path,
|
|
71
|
-
oid: null
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
if (content !== void 0 && oid === void 0) return Effect.succeed(mode === void 0 ? {
|
|
75
|
-
path,
|
|
76
|
-
content
|
|
77
|
-
} : {
|
|
78
|
-
path,
|
|
79
|
-
content,
|
|
80
|
-
mode
|
|
81
|
-
});
|
|
82
|
-
if (oid !== void 0 && content === void 0) return Effect.succeed(mode === void 0 ? {
|
|
83
|
-
path,
|
|
84
|
-
oid
|
|
85
|
-
} : {
|
|
86
|
-
path,
|
|
87
|
-
oid,
|
|
88
|
-
mode
|
|
89
|
-
});
|
|
90
|
-
return badPath(path, "needs an object ID or content, and not both");
|
|
91
|
-
};
|
|
76
|
+
const treeEditOf = (edit) => Effect.catch(decodeTreeEdit(definedFields(edit)), () => badPath(edit.path, edit.oid === null ? "is deleted, so its edit takes no content or mode" : "needs an object ID or content, and not both"));
|
|
92
77
|
/**
|
|
93
78
|
* One edit's entry: its content made a blob, or its object, checked to be of its mode's type. A
|
|
94
79
|
* mode left out keeps the path's own when it has one of the same type, else is the object's
|
|
@@ -46,7 +46,7 @@ const entryOf = (entry, path) => {
|
|
|
46
46
|
* folder before what it holds, as `ls-tree -r -t` lists them, a submodule not entered. Paths start
|
|
47
47
|
* with `prefix`. Reads stop once `most` are found, past which `more` says entries follow.
|
|
48
48
|
*/
|
|
49
|
-
const listTree =
|
|
49
|
+
const listTree = /* @__PURE__ */ Effect.fnUntraced(function* (reader, tree, options) {
|
|
50
50
|
const entries = [];
|
|
51
51
|
const stack = [{
|
|
52
52
|
children: yield* reader.treeOf(tree),
|
|
@@ -92,7 +92,7 @@ const listTree = (reader, tree, options) => Effect.gen(function* () {
|
|
|
92
92
|
* `NOT_FOUND`, as reading it would be, unless the core is `partial`: then it has no `size`, since
|
|
93
93
|
* the client fetches no blob to size it.
|
|
94
94
|
*/
|
|
95
|
-
const sized =
|
|
95
|
+
const sized = /* @__PURE__ */ Effect.fnUntraced(function* (opened, listed) {
|
|
96
96
|
const { partial } = yield* ObjectsParts;
|
|
97
97
|
const blobs = [...new Set(listed.entries.filter((entry) => entry.type === "blob").map((entry) => entry.oid))];
|
|
98
98
|
if (blobs.length === 0) return listed;
|
|
@@ -160,7 +160,7 @@ const treeCalls = (bound) => {
|
|
|
160
160
|
repo,
|
|
161
161
|
input,
|
|
162
162
|
parts: [base ?? null, changes],
|
|
163
|
-
make: (opened, made, limits)
|
|
163
|
+
make: Effect.fnUntraced(function* (opened, made, limits) {
|
|
164
164
|
const { reader, deadline } = yield* readerOf(opened, limits, "walk-limit");
|
|
165
165
|
return { oid: yield* timed(editTree(reader, made, base, changes), deadline) };
|
|
166
166
|
}),
|
|
@@ -185,7 +185,7 @@ const treeCalls = (bound) => {
|
|
|
185
185
|
ours,
|
|
186
186
|
theirs
|
|
187
187
|
],
|
|
188
|
-
make:
|
|
188
|
+
make: Effect.fnUntraced(function* (opened, made) {
|
|
189
189
|
const merged = yield* (yield* mergePartsOrOff).mergeTrees(opened.read, mergeInput(input), callAllot(opened));
|
|
190
190
|
yield* takeWrites(made, merged.objects);
|
|
191
191
|
const { renamesSkipped } = merged;
|