@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/repack.mjs
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { keepsEvents } from "../contracts/events.mjs";
|
|
1
2
|
import { fail } from "../contracts/result.mjs";
|
|
2
3
|
import { bestEffort, decodeRow, resultCall, storeCall, thrownError } from "../store/errors.mjs";
|
|
3
|
-
import {
|
|
4
|
+
import { untilAborted } from "../store/crossing.mjs";
|
|
5
|
+
import { gitJob } from "../store/job-try.mjs";
|
|
4
6
|
import { decodePacks, featureChange, gitStore, packRow } from "../store/git-store.mjs";
|
|
5
7
|
import { appendEvents, decodeOutbox, outboxReads, repoEnvelope } from "../store/outbox.mjs";
|
|
6
8
|
import { decodeTimes, readRecord, repoStats, timeRow } from "../store/repo-record.mjs";
|
|
@@ -11,24 +13,23 @@ import { listedIds } from "../storage/listed-ids.mjs";
|
|
|
11
13
|
import { ReadyRow } from "../storage/ready.mjs";
|
|
12
14
|
import { ApartRow, apartAfter, apartKey } from "../storage/repack-contained.mjs";
|
|
13
15
|
import { SwapsSettled, swapsKey, swapsLeft } from "../storage/swap-walk.mjs";
|
|
14
|
-
import {
|
|
16
|
+
import { QuarantineRow, decodeHeld, decodeLeft, isLeftKey, leavingKey, leavingLate, leavingRow, leftPack } from "../storage/rows.mjs";
|
|
15
17
|
import { WholeRepo, wholeRefs } from "../store/ref-rows.mjs";
|
|
16
18
|
import { collections, jobRepo, maintainedKey, newChangeId, prunedKey, reachedKey, repoScope } from "../store/scopes.mjs";
|
|
17
|
-
import { MaintenanceRun, RepackData, maintenanceRunKey, parksPass, pruneJobKey, pruneJobRow, repackJobKey, repackJobName, repackJobRow as repackJobRow$1
|
|
19
|
+
import { MaintenanceRun, RepackData, maintenanceRunKey, parksPass, pruneJobKey, pruneJobRow, repackJobKey, repackJobName, repackJobRow as repackJobRow$1 } from "../storage/repack-job.mjs";
|
|
18
20
|
import { headOf, indexJobs, statsReads } from "./access.mjs";
|
|
19
21
|
import { notFailed } from "./events/deliver.mjs";
|
|
20
22
|
import { importLive } from "./imports.mjs";
|
|
21
23
|
import { ownSweepOf, ownSweepRead } from "./own-writes.mjs";
|
|
22
24
|
import { sweepOf, sweepRead } from "./receipts.mjs";
|
|
25
|
+
import { heldId, isAbandon, isReadyPut, isTake, ownRows, stillTakes } from "./still-takes.mjs";
|
|
23
26
|
import { SealedObjects } from "./view.mjs";
|
|
24
|
-
import { defineJob, jobLeaseMargin } from "@ref0/infra";
|
|
25
|
-
import * as Schema from "effect/Schema";
|
|
26
27
|
import * as Effect from "effect/Effect";
|
|
28
|
+
import { CurrentJob, Job, jobLeaseMargin } from "@ref0/infra";
|
|
27
29
|
import * as Predicate from "effect/Predicate";
|
|
28
|
-
import * as Option from "effect/Option";
|
|
29
30
|
// src/core/repack.ts
|
|
30
31
|
/** Upkeep keeps every ref's objects, private or not: it reads the repo whole. */
|
|
31
|
-
const upkeepWhole = WholeRepo.mint();
|
|
32
|
+
const upkeepWhole = /* @__PURE__ */ WholeRepo.mint();
|
|
32
33
|
/**
|
|
33
34
|
* `upkeeps` as one, in order: the first that did some answers `more`, so a step stays short;
|
|
34
35
|
* else the soonest any is due.
|
|
@@ -60,7 +61,6 @@ const changeOf = (expect, change) => ({
|
|
|
60
61
|
id
|
|
61
62
|
})), ...change.delete ?? []]
|
|
62
63
|
});
|
|
63
|
-
const isLeaving = Schema.is(LeavingRow);
|
|
64
64
|
/** `change` with each leaving row due `late` later, as `leavingLate` says. */
|
|
65
65
|
const startedLate = (change, late) => change.put === void 0 ? change : {
|
|
66
66
|
...change,
|
|
@@ -180,12 +180,6 @@ const leavingOf = /* @__PURE__ */ Effect.fnUntraced(function* (parts, packs, at)
|
|
|
180
180
|
more: true
|
|
181
181
|
};
|
|
182
182
|
});
|
|
183
|
-
const heldId = (key) => `${key.collection}/${key.id}`;
|
|
184
|
-
const isQuarantine = Schema.is(QuarantineRow);
|
|
185
|
-
/** Clean-up's put: a `quarantine` row it commits abandoned. */
|
|
186
|
-
const isAbandon = (row) => row.collection === objectCollections.quarantine && isQuarantine(row.value) && row.value.state === "abandoned";
|
|
187
|
-
/** Clean-up's put: a `leaving` row it commits taken (#394). */
|
|
188
|
-
const isTake = (row) => row.collection === objectCollections.leaving && isLeaving(row.value) && row.value.taken === true;
|
|
189
183
|
/** Clean-up's put: a row it abandons or takes. */
|
|
190
184
|
const isCleanUpPut = (row) => isAbandon(row) || isTake(row);
|
|
191
185
|
/**
|
|
@@ -193,31 +187,22 @@ const isCleanUpPut = (row) => isAbandon(row) || isTake(row);
|
|
|
193
187
|
* drop writes the key, and each pack is received once, so a reread puts it again unchecked.
|
|
194
188
|
*/
|
|
195
189
|
const isStagedPut = (row) => row.collection === objectCollections.staged;
|
|
196
|
-
/** The ready shallow pack's step's put: its row. */
|
|
197
|
-
const isReadyPut = (row) => row.collection === objectCollections.ready;
|
|
198
190
|
/** A row a step may put at a newer version than it read: a prune pass's, or a walk's `apart`. */
|
|
199
191
|
const isUpkeepMark = (row) => row.collection === objectCollections.prune || row.collection === objectCollections.apart;
|
|
200
192
|
/**
|
|
201
|
-
* Clean-up's delete: an ended `quarantine` row
|
|
202
|
-
* a swept `staged` row.
|
|
193
|
+
* Clean-up's delete: an ended `quarantine` row, its receive's record and its merge's row, a taken
|
|
194
|
+
* `leaving` or `cover` row, or a swept `staged` row.
|
|
203
195
|
*/
|
|
204
|
-
const isEnded = (key) => key.collection === objectCollections.quarantine || key.collection === objectCollections.receive || key.collection === objectCollections.
|
|
205
|
-
/**
|
|
206
|
-
* A listing step's own `quarantine` rows: `step.quarantine`, then each other `quarantine` row its
|
|
207
|
-
* change ends, such as a streaming merge's packs past its first (maintenance-1m B5).
|
|
208
|
-
*/
|
|
209
|
-
const ownRows = (step) => {
|
|
210
|
-
const own = step.quarantine;
|
|
211
|
-
if (own === void 0) return [];
|
|
212
|
-
return [own, ...(step.change.delete ?? []).filter((key) => key.collection === objectCollections.quarantine && key.id !== own.id)];
|
|
213
|
-
};
|
|
196
|
+
const isEnded = (key) => key.collection === objectCollections.quarantine || key.collection === objectCollections.receive || isLeftKey(key) || key.collection === objectCollections.staged || key.collection === objectCollections.merge;
|
|
214
197
|
/**
|
|
215
198
|
* The rows a missed step's reread checks, or `undefined` for a step that never reads again: its
|
|
216
199
|
* own `quarantine` rows (Q269), every one its change ends, and the ready row a ready pack's step puts; none for a prune
|
|
217
200
|
* pass's row alone, or a walk's `apart` row alone, which keeps only what the next step checks
|
|
218
201
|
* against its listing again (#1148); and, for clean-up's change
|
|
219
202
|
* alone, the `quarantine` rows it abandons (#326), the `leaving` rows it takes (#394) and the
|
|
220
|
-
* `leaving` rows it deletes (#1490),
|
|
203
|
+
* `leaving` rows it deletes (#1490), each as a `cover` row too (#1582), and the `leaving` row of
|
|
204
|
+
* each `cover` row's pack it takes, with the `staged` rows it puts and sweeps, and the `merge` row
|
|
205
|
+
* of each pack it abandons, unchecked (#1558, #1927).
|
|
221
206
|
* A step that abandons a row and also prunes or merges commits only at its first read's version
|
|
222
207
|
* (Q438).
|
|
223
208
|
*/
|
|
@@ -234,20 +219,45 @@ const rereadKeys = (step) => {
|
|
|
234
219
|
if (deleted.length === 0 && put.every(isUpkeepMark)) return [];
|
|
235
220
|
const checked = put.filter((row) => !isStagedPut(row));
|
|
236
221
|
if (!checked.every(isCleanUpPut) || !deleted.every(isEnded)) return void 0;
|
|
237
|
-
const leaving = deleted.filter(
|
|
238
|
-
|
|
239
|
-
collection
|
|
240
|
-
|
|
241
|
-
})
|
|
222
|
+
const leaving = deleted.filter(isLeftKey);
|
|
223
|
+
const covered = checked.flatMap((row) => {
|
|
224
|
+
const pack = row.collection === objectCollections.cover ? leftPack(row) : void 0;
|
|
225
|
+
return pack === void 0 ? [] : [leavingKey(pack)];
|
|
226
|
+
});
|
|
227
|
+
return [
|
|
228
|
+
...checked.map(({ collection, id }) => ({
|
|
229
|
+
collection,
|
|
230
|
+
id
|
|
231
|
+
})),
|
|
232
|
+
...leaving,
|
|
233
|
+
...covered
|
|
234
|
+
];
|
|
242
235
|
};
|
|
236
|
+
/**
|
|
237
|
+
* The rows a reread holds at `rereadKeys`' keys, each decoded as its collection's, for
|
|
238
|
+
* `stillTakes`. One that doesn't decode fails the try with `DATA_LOSS`, whichever check would
|
|
239
|
+
* have reached it.
|
|
240
|
+
*/
|
|
241
|
+
const heldRows = /* @__PURE__ */ Effect.fnUntraced(function* (keyed) {
|
|
242
|
+
const quarantine = /* @__PURE__ */ new Map();
|
|
243
|
+
const left = /* @__PURE__ */ new Map();
|
|
244
|
+
const ready = /* @__PURE__ */ new Map();
|
|
245
|
+
for (const row of keyed) if (row.collection === objectCollections.quarantine) quarantine.set(heldId(row), (yield* decodeHeld(QuarantineRow, row)).value);
|
|
246
|
+
else if (isLeftKey(row)) left.set(heldId(row), (yield* decodeLeft(row)).value);
|
|
247
|
+
else if (row.collection === objectCollections.ready) ready.set(heldId(row), yield* decodeRow(ReadyRow, row, "The ready shallow pack's row"));
|
|
248
|
+
return {
|
|
249
|
+
quarantine,
|
|
250
|
+
left,
|
|
251
|
+
ready
|
|
252
|
+
};
|
|
253
|
+
});
|
|
243
254
|
/** A step's read, decoded, with the rows of `keys` it holds: `undefined` when the repo has none. */
|
|
244
255
|
const readStep = /* @__PURE__ */ Effect.fnUntraced(function* (store, internalId, keys = []) {
|
|
245
256
|
const { record, snapshot } = yield* readRecord(store, internalId, [...stepReads, ...keys]);
|
|
246
257
|
if (record === void 0) return void 0;
|
|
247
258
|
const [refRows = [], packRows = [], timeRows = [], ...rest] = snapshot.results.slice(1);
|
|
248
259
|
const [headRows = [], cursorRows = [], runRows = [], receipts = [], own = [], indexRows = [], apartRows = [], swapsRows = []] = rest;
|
|
249
|
-
const
|
|
250
|
-
const held = new Map(keyed.map((row) => [heldId(row), row]));
|
|
260
|
+
const held = yield* heldRows(snapshot.results.slice(stepReads.length + 1).flat());
|
|
251
261
|
const packs = yield* decodePacks(packRows);
|
|
252
262
|
const refs = yield* wholeRefs(upkeepWhole, refRows);
|
|
253
263
|
const times = yield* decodeTimes(timeRows);
|
|
@@ -270,72 +280,12 @@ const readStep = /* @__PURE__ */ Effect.fnUntraced(function* (store, internalId,
|
|
|
270
280
|
outbox,
|
|
271
281
|
saved,
|
|
272
282
|
sweep,
|
|
273
|
-
held,
|
|
283
|
+
...held,
|
|
274
284
|
index,
|
|
275
285
|
apart,
|
|
276
286
|
swaps
|
|
277
287
|
};
|
|
278
288
|
});
|
|
279
|
-
/** The reread's `quarantine` row at `key`, or `undefined` when it holds none. */
|
|
280
|
-
const heldQuarantine = /* @__PURE__ */ Effect.fnUntraced(function* (again, key) {
|
|
281
|
-
const row = again.held.get(heldId(key));
|
|
282
|
-
return row === void 0 ? void 0 : (yield* decodeHeld(QuarantineRow, row)).value;
|
|
283
|
-
});
|
|
284
|
-
/** The reread's `leaving` row at `key`, or `undefined` when it holds none. */
|
|
285
|
-
const heldLeaving = /* @__PURE__ */ Effect.fnUntraced(function* (again, key) {
|
|
286
|
-
const row = again.held.get(heldId(key));
|
|
287
|
-
return row === void 0 ? void 0 : (yield* decodeHeld(LeavingRow, row)).value;
|
|
288
|
-
});
|
|
289
|
-
/** The reread's ready row at `key`, or `undefined` when it holds none. */
|
|
290
|
-
const heldReady = /* @__PURE__ */ Effect.fnUntraced(function* (again, key) {
|
|
291
|
-
const row = again.held.get(heldId(key));
|
|
292
|
-
return row === void 0 ? void 0 : yield* decodeRow(ReadyRow, row, "The ready shallow pack's row");
|
|
293
|
-
});
|
|
294
|
-
/**
|
|
295
|
-
* Whether a step's reread still takes its commit, as `rereadKeys` let it read again: the repo
|
|
296
|
-
* isn't deleted, and each of the step's own `quarantine` rows is open and every pack it removes is
|
|
297
|
-
* still listed (Q269). A ready pack's step takes it too while the reread's ready row names the pack the
|
|
298
|
-
* step moves out, or none when it moves none: its pack answers its tip whatever moved since, and
|
|
299
|
-
* a tip that moved builds again at the next step. A prune pass's row alone takes any version: it
|
|
300
|
-
* adds no object and lets none go.
|
|
301
|
-
* Clean-up's change takes the reread's version only as its decision would there (#326): each
|
|
302
|
-
* `quarantine` row it abandons is still `open`, its `removeAt` unchanged, and its pack unlisted,
|
|
303
|
-
* so a push that listed the pack since refuses it (#318); and each `leaving` row it takes is still
|
|
304
|
-
* there, not taken, its `removeAt` unchanged and its pack unlisted, so a sync or a fetch that
|
|
305
|
-
* listed the pack again since refuses it (#394, #1490); and each `leaving` row it deletes untaken
|
|
306
|
-
* still has its pack listed. The rows it ends were abandoned or taken, which no later write undoes,
|
|
307
|
-
* so they need no check.
|
|
308
|
-
*/
|
|
309
|
-
const stillTakes = /* @__PURE__ */ Effect.fnUntraced(function* (again, step) {
|
|
310
|
-
if (again.record.deleted === true) return false;
|
|
311
|
-
const { remove = [], put = [] } = step.change;
|
|
312
|
-
const listed = new Set(again.packs.map((pack) => pack.id));
|
|
313
|
-
if (step.quarantine !== void 0) {
|
|
314
|
-
if ((yield* heldQuarantine(again, step.quarantine))?.state !== "open" || !remove.every((id) => listed.has(id))) return false;
|
|
315
|
-
for (const key of ownRows(step).slice(1)) if ((yield* heldQuarantine(again, key))?.state !== "open") return false;
|
|
316
|
-
const leaving = put.find((row) => row.collection === objectCollections.leaving)?.id;
|
|
317
|
-
for (const row of put.filter(isReadyPut)) if ((yield* heldReady(again, row))?.pack?.id !== leaving) return false;
|
|
318
|
-
return true;
|
|
319
|
-
}
|
|
320
|
-
for (const row of put.filter(isAbandon)) {
|
|
321
|
-
const held = yield* heldQuarantine(again, row);
|
|
322
|
-
if (held?.state !== "open") return false;
|
|
323
|
-
if (held.removeAt !== row.value.removeAt) return false;
|
|
324
|
-
if (listed.has(row.id)) return false;
|
|
325
|
-
}
|
|
326
|
-
for (const row of put.filter(isTake)) {
|
|
327
|
-
const held = yield* heldLeaving(again, row);
|
|
328
|
-
if (held === void 0 || held.taken === true) return false;
|
|
329
|
-
if (held.removeAt !== row.value.removeAt) return false;
|
|
330
|
-
if (listed.has(row.id)) return false;
|
|
331
|
-
}
|
|
332
|
-
for (const key of step.change.delete ?? []) {
|
|
333
|
-
if (key.collection !== objectCollections.leaving) continue;
|
|
334
|
-
const held = yield* heldLeaving(again, key);
|
|
335
|
-
if (held !== void 0 && held.taken !== true && !listed.has(key.id)) return false;
|
|
336
|
-
}
|
|
337
|
-
return true;
|
|
338
|
-
});
|
|
339
289
|
/**
|
|
340
290
|
* Whether a commit at `writing` is too late for a remap's row: within the queue's lease margin of
|
|
341
291
|
* prune's grace, `fetchLimits`' time, since the try's `at`. The remap starts only when its claim's
|
|
@@ -368,7 +318,7 @@ const commitStep = /* @__PURE__ */ Effect.fnUntraced(function* (parts, store, in
|
|
|
368
318
|
};
|
|
369
319
|
const listing = listedIds(read, step?.change);
|
|
370
320
|
const fenced = (step?.fenced ?? []).filter(({ pack }) => listing.includes(pack));
|
|
371
|
-
const report = parts.events
|
|
321
|
+
const report = !keepsEvents(parts.events) || deleted ? {
|
|
372
322
|
put: [],
|
|
373
323
|
delete: [],
|
|
374
324
|
jobs: []
|
|
@@ -442,7 +392,7 @@ const commitStep = /* @__PURE__ */ Effect.fnUntraced(function* (parts, store, in
|
|
|
442
392
|
};
|
|
443
393
|
});
|
|
444
394
|
/** Whether a read must settle a rename first, which it commits itself (Q186). */
|
|
445
|
-
const settles = (parts, store, internalId, read) => parts.events
|
|
395
|
+
const settles = (parts, store, internalId, read) => !keepsEvents(parts.events) ? Effect.succeed(false) : settleName(store, repoScope(internalId), {
|
|
446
396
|
version: read.version,
|
|
447
397
|
head: read.outbox.head,
|
|
448
398
|
record: read.record
|
|
@@ -583,7 +533,7 @@ const repackStep = /* @__PURE__ */ Effect.fnUntraced(function* (parts, store, in
|
|
|
583
533
|
const keys = rereadKeys(step);
|
|
584
534
|
if (keys === void 0) return again;
|
|
585
535
|
const reread = yield* readStep(store, internalId, keys);
|
|
586
|
-
if (reread === void 0 || !
|
|
536
|
+
if (reread === void 0 || !stillTakes(reread, step)) return again;
|
|
587
537
|
if (yield* settles(parts, store, internalId, reread)) return again;
|
|
588
538
|
read = reread;
|
|
589
539
|
}
|
|
@@ -606,20 +556,22 @@ const rewalking = /* @__PURE__ */ Effect.fnUntraced(function* (parts, store, int
|
|
|
606
556
|
}
|
|
607
557
|
return false;
|
|
608
558
|
});
|
|
609
|
-
const decodeRepackData = Schema.decodeUnknownOption(RepackData);
|
|
610
559
|
/**
|
|
611
560
|
* `git.repack`'s try, in the repo's scope: one step, as `repackStep` says, given the dropping
|
|
612
561
|
* commits its data says missed, and whether the try before it died or failed: a step that ends
|
|
613
562
|
* with `more` starts its row's tries again at 1, so a later attempt follows one that never settled.
|
|
614
563
|
*/
|
|
615
|
-
const
|
|
564
|
+
const repackTry = (parts) => ({ missed = 0 }) => Effect.flatMap(Effect.all([
|
|
565
|
+
CurrentJob.current,
|
|
566
|
+
CurrentJob.store,
|
|
567
|
+
CurrentJob.signal,
|
|
568
|
+
CurrentJob.deadline
|
|
569
|
+
]), ([job, store, signal, deadline]) => {
|
|
616
570
|
const pass = job.key === pruneJobKey;
|
|
617
|
-
const
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
return runJobTry(pass ? Effect.catchIf(step, parksPass, (error) => Effect.die(parked(error))) : step);
|
|
622
|
-
};
|
|
571
|
+
const steps = pass ? "prune" : "others";
|
|
572
|
+
const step = repackStep(parts, store, jobRepo(job), signal, deadline, missed, job.attempt > 1, steps);
|
|
573
|
+
return pass ? Effect.catchIf(step, parksPass, (error) => Effect.die(parked(error))) : step;
|
|
574
|
+
});
|
|
623
575
|
/**
|
|
624
576
|
* The name a `prune` try's refusal that `parksPass` names is thrown under: `repackRetry` fails its
|
|
625
577
|
* row at once, and it stays failed till a `repack` run's revive once a period, as `reviveParked`
|
|
@@ -658,18 +610,16 @@ const repackRetry = (failure) => {
|
|
|
658
610
|
*/
|
|
659
611
|
/** A `git.repack` try's timeout, in ms. */
|
|
660
612
|
const repackTimeout = 78e4;
|
|
613
|
+
const RepackJob = /* @__PURE__ */ Job.make(repackJobName, {
|
|
614
|
+
payload: RepackData,
|
|
615
|
+
timeout: repackTimeout,
|
|
616
|
+
concurrency: 1,
|
|
617
|
+
retry: repackRetry,
|
|
618
|
+
rebuild: () => ({})
|
|
619
|
+
});
|
|
661
620
|
const repackJob = (parts) => {
|
|
662
|
-
const
|
|
663
|
-
|
|
664
|
-
schema: repackJobSchema,
|
|
665
|
-
timeout: repackTimeout,
|
|
666
|
-
concurrency: 1,
|
|
667
|
-
retry: repackRetry,
|
|
668
|
-
handler: repackHandler(parts),
|
|
669
|
-
rebuild: () => ({})
|
|
670
|
-
};
|
|
671
|
-
if (parts.onFailure !== void 0) options.onFailure = parts.onFailure;
|
|
672
|
-
return defineJob(options);
|
|
621
|
+
const { onFailure } = parts;
|
|
622
|
+
return gitJob(RepackJob, repackTry(parts), onFailure === void 0 ? {} : { onFailure });
|
|
673
623
|
};
|
|
674
624
|
/** The repo's one `git.repack` row, due at `at` or now. */
|
|
675
625
|
const repackJobRow = (job, at) => job.job(at === void 0 ? {
|
|
@@ -698,4 +648,4 @@ const ensureRepack = /* @__PURE__ */ Effect.fnUntraced(function* (core, jobs, sc
|
|
|
698
648
|
* is nothing to revive, and `ensureRepack`'s add alone is what it keeps.
|
|
699
649
|
*/
|
|
700
650
|
const noRepackRetry = { retry: async () => {} };
|
|
701
|
-
export { ensureRepack, leavingPage, noRepackRetry, passParked,
|
|
651
|
+
export { ensureRepack, leavingPage, noRepackRetry, passParked, repackJob, repackJobRow, repackSlowJitter, repackSlowWait, repackTimeout, upkeepsOf };
|
package/dist/core/repo-info.mjs
CHANGED
|
@@ -4,13 +4,13 @@ import { storeCall } from "../store/errors.mjs";
|
|
|
4
4
|
import { decodePacks } from "../store/git-store.mjs";
|
|
5
5
|
import { decodeTimes, repoStats, seenTimes } from "../store/repo-record.mjs";
|
|
6
6
|
import { repoScope } from "../store/scopes.mjs";
|
|
7
|
-
import { repoAccess, statsReads } from "./access.mjs";
|
|
7
|
+
import { liveAsAsked, repoAccess, statsReads } from "./access.mjs";
|
|
8
8
|
import { refViewIn, wholeView } from "./ref-view.mjs";
|
|
9
9
|
import { SealedObjects } from "./view.mjs";
|
|
10
10
|
import { CoreParts, ObjectsParts, QueueParts } from "./parts.mjs";
|
|
11
11
|
import { check } from "../contracts/authorize.mjs";
|
|
12
|
-
import * as Effect from "effect/Effect";
|
|
13
12
|
import * as Clock$1 from "effect/Clock";
|
|
13
|
+
import * as Effect from "effect/Effect";
|
|
14
14
|
// src/core/repo-info.ts
|
|
15
15
|
/**
|
|
16
16
|
* A repo's info, as `repos` and `forks` answer it: its stats, its work and its upstream, for one
|
|
@@ -30,39 +30,67 @@ const indexHoldOf = (status) => {
|
|
|
30
30
|
return status?.state === "too-large" ? { state: "too-large" } : void 0;
|
|
31
31
|
};
|
|
32
32
|
/**
|
|
33
|
+
* The stats a caller a private pattern restricts is told: only what its own view counts, as
|
|
34
|
+
* `RepoInfoStats` says. A hidden push moves the rest, so they're left out.
|
|
35
|
+
*/
|
|
36
|
+
const restricted = ({ repo, refs, pushedAt }) => pushedAt === void 0 ? {
|
|
37
|
+
repo,
|
|
38
|
+
refs
|
|
39
|
+
} : {
|
|
40
|
+
repo,
|
|
41
|
+
refs,
|
|
42
|
+
pushedAt
|
|
43
|
+
};
|
|
44
|
+
/** The repo's jobs, and `index` while a refusal stops its index builds, as `RepoWork` says. */
|
|
45
|
+
const repoWork = /* @__PURE__ */ Effect.fnUntraced(function* (internalId, sealed, indexRow, packs) {
|
|
46
|
+
const { jobs } = yield* QueueParts;
|
|
47
|
+
const counts = yield* storeCall(() => jobs.count(repoScope(internalId)));
|
|
48
|
+
const status = SealedObjects.indexStatus(sealed)?.(indexRow, yield* Clock$1.currentTimeMillis, packs.map(({ id }) => id));
|
|
49
|
+
const index = indexHoldOf(status);
|
|
50
|
+
return index === void 0 ? counts : {
|
|
51
|
+
...counts,
|
|
52
|
+
index
|
|
53
|
+
};
|
|
54
|
+
});
|
|
55
|
+
/**
|
|
33
56
|
* A repo's info for `caller`, from its record, the rows `infoReads` read, and its jobs' counts. A
|
|
34
57
|
* fork's `upstream` names its source as it's named now, told only to a caller that may read it, as
|
|
35
58
|
* `readableRedirect` says, so no fork tells a stranger a private source's name.
|
|
36
59
|
*/
|
|
37
60
|
const repoInfo = /* @__PURE__ */ Effect.fnUntraced(function* (caller, internalId, record, results) {
|
|
38
61
|
const core = yield* CoreParts;
|
|
39
|
-
const { objects: sealed } = yield* ObjectsParts;
|
|
40
|
-
const packs = yield* decodePacks(results[1] ?? []);
|
|
41
|
-
const times = yield* decodeTimes(results[2] ?? []);
|
|
42
|
-
const refRows = results[0] ?? [];
|
|
43
|
-
const { access } = core;
|
|
44
|
-
const hides = access !== void 0 && (times.privately !== void 0 || access.patternOf(record.defaultBranch) !== void 0 || refRows.some((row) => access.patternOf(row.id) !== void 0));
|
|
45
62
|
const repo = repoAccess({
|
|
46
63
|
name: record.name,
|
|
47
64
|
record,
|
|
48
65
|
internalId
|
|
49
66
|
});
|
|
50
|
-
const refView =
|
|
67
|
+
const refView = core.access === void 0 ? wholeView : yield* refViewIn(caller, repo);
|
|
68
|
+
return yield* infoIn(caller, internalId, record, results, refView);
|
|
69
|
+
});
|
|
70
|
+
/**
|
|
71
|
+
* A repo's info as `repos.create` answers it, before its commit: whole, with no `refs.private`
|
|
72
|
+
* asked, since the catalogue doesn't name the repo yet. The create writes no ref, pack or push, and
|
|
73
|
+
* `privateDefault` refuses a default branch a private pattern matches, so every caller is told the
|
|
74
|
+
* same.
|
|
75
|
+
*/
|
|
76
|
+
const createdInfo = (caller, internalId, record) => infoIn(caller, internalId, record, [], wholeView);
|
|
77
|
+
/** A repo's info for a caller with `refView`, from what `repoInfo` says. */
|
|
78
|
+
const infoIn = /* @__PURE__ */ Effect.fnUntraced(function* (caller, internalId, record, results, refView) {
|
|
79
|
+
const { objects: sealed } = yield* ObjectsParts;
|
|
80
|
+
const packs = yield* decodePacks(results[1] ?? []);
|
|
81
|
+
const times = yield* decodeTimes(results[2] ?? []);
|
|
82
|
+
const refRows = results[0] ?? [];
|
|
51
83
|
const refs = refView.whole ? refRows.length : refRows.filter((row) => refView.sees(row.id)).length;
|
|
52
|
-
const
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
index
|
|
60
|
-
};
|
|
61
|
-
const info = {
|
|
84
|
+
const whole = repoStats(record, refs, packs, seenTimes(times, refView));
|
|
85
|
+
const info = refView.whole ? {
|
|
86
|
+
name: record.name,
|
|
87
|
+
public: record.public,
|
|
88
|
+
stats: whole,
|
|
89
|
+
work: yield* repoWork(internalId, sealed, results[3]?.[0], packs)
|
|
90
|
+
} : {
|
|
62
91
|
name: record.name,
|
|
63
92
|
public: record.public,
|
|
64
|
-
stats
|
|
65
|
-
work
|
|
93
|
+
stats: restricted(whole)
|
|
66
94
|
};
|
|
67
95
|
if (refView.sees(record.defaultBranch)) info.defaultBranch = record.defaultBranch;
|
|
68
96
|
const upstream = yield* readableUpstream(caller, record);
|
|
@@ -74,7 +102,9 @@ const repoInfo = /* @__PURE__ */ Effect.fnUntraced(function* (caller, internalId
|
|
|
74
102
|
* says: `undefined` for a repo that isn't a fork, once its source is deleted, and for a caller that
|
|
75
103
|
* may not read it. The source is read and asked of `authorize` by the internal ID the fork's
|
|
76
104
|
* record keeps, never opened again by the name that read gave, so a rename landing between the
|
|
77
|
-
* two never hides a live source.
|
|
105
|
+
* two never hides a live source. Once `authorize` answers, the source is read again, as
|
|
106
|
+
* `liveAsAsked` says: told by the name it holds then, the new one past a rename, and `undefined`
|
|
107
|
+
* once it's deleted or made public or private meanwhile. A host's outage still fails.
|
|
78
108
|
*/
|
|
79
109
|
const readableUpstream = /* @__PURE__ */ Effect.fnUntraced(function* (caller, record) {
|
|
80
110
|
const core = yield* CoreParts;
|
|
@@ -87,13 +117,17 @@ const readableUpstream = /* @__PURE__ */ Effect.fnUntraced(function* (caller, re
|
|
|
87
117
|
...source,
|
|
88
118
|
internalId
|
|
89
119
|
});
|
|
90
|
-
|
|
120
|
+
const asked = check({
|
|
91
121
|
caller,
|
|
92
122
|
operation: {
|
|
93
123
|
kind: "read",
|
|
94
124
|
repo: name
|
|
95
125
|
},
|
|
96
126
|
repo
|
|
97
|
-
})
|
|
127
|
+
});
|
|
128
|
+
return yield* Effect.andThen(asked, liveAsAsked({
|
|
129
|
+
...source,
|
|
130
|
+
internalId
|
|
131
|
+
})).pipe(Effect.map((now) => now?.name), Effect.catch((error) => error.code === "UNAVAILABLE" ? Effect.fail(error) : Effect.succeed(void 0)));
|
|
98
132
|
});
|
|
99
|
-
export { infoReads, repoInfo };
|
|
133
|
+
export { createdInfo, infoReads, repoInfo };
|
package/dist/core/repos.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { keepsEvents } from "../contracts/events.mjs";
|
|
1
2
|
import { isRepoName } from "../contracts/ids.mjs";
|
|
2
3
|
import { isTokenOf } from "../auth/token-text.mjs";
|
|
3
4
|
import { checkChurn, createdKey, createdKeyOf, entryOf, listCreated, listLimit, listNames, listPublic, readEntries, recordAt } from "../store/catalogue.mjs";
|
|
@@ -9,7 +10,7 @@ import { keptKey, takenBack } from "../store/records.mjs";
|
|
|
9
10
|
import { refuseLive, reservationOf, reservedRepo } from "../store/reservations.mjs";
|
|
10
11
|
import { collections, newInternalId, reachedKey, repoScope } from "../store/scopes.mjs";
|
|
11
12
|
import { alreadyExists, callerFor, contended, contendedAfterWrites, indexDeleteJobs, keyedRecord, nameMoved, openKeyed, openRepo, purgeJobs, repoAccess, unlessHidden } from "./access.mjs";
|
|
12
|
-
import { infoReads, repoInfo } from "./repo-info.mjs";
|
|
13
|
+
import { createdInfo, infoReads, repoInfo } from "./repo-info.mjs";
|
|
13
14
|
import { isRefName } from "./names.mjs";
|
|
14
15
|
import { shortRef } from "./rules/patterns.mjs";
|
|
15
16
|
import { hiddenUnder } from "../protocol/wire/lines.mjs";
|
|
@@ -17,8 +18,8 @@ import { heldReceipt, receiptId, receiptKeys, receiptReads, receiptWrites, repoA
|
|
|
17
18
|
import { fail } from "../contracts/result.mjs";
|
|
18
19
|
import { CoreParts } from "./parts.mjs";
|
|
19
20
|
import { check } from "../contracts/authorize.mjs";
|
|
20
|
-
import * as Effect from "effect/Effect";
|
|
21
21
|
import * as Clock$1 from "effect/Clock";
|
|
22
|
+
import * as Effect from "effect/Effect";
|
|
22
23
|
// src/core/repos.ts
|
|
23
24
|
const defaultBranch = "refs/heads/main";
|
|
24
25
|
/**
|
|
@@ -82,11 +83,11 @@ const badRefName = (name) => fail("INVALID_ARGUMENT", `'${name}' isn't a full re
|
|
|
82
83
|
* A default branch under a prefix Git moves itself, such as the merge queue's or an import's, is
|
|
83
84
|
* refused: a clone's `HEAD` would check out a ref no push names.
|
|
84
85
|
*/
|
|
85
|
-
const hiddenDefault = (branch)
|
|
86
|
-
const hidden = hiddenUnder(branch);
|
|
87
|
-
if (hidden === void 0) return
|
|
88
|
-
return fail("INVALID_ARGUMENT", `The default branch can't be a ref Git moves: ${branch} is under ${hidden.prefix}, which ${hidden.mover} moves`, { hint: "Name a branch under 'refs/heads/', such as 'refs/heads/main'" });
|
|
89
|
-
};
|
|
86
|
+
const hiddenDefault = /* @__PURE__ */ Effect.fnUntraced(function* (branch) {
|
|
87
|
+
const hidden = hiddenUnder((yield* CoreParts).hiddenRefs(), branch);
|
|
88
|
+
if (hidden === void 0) return;
|
|
89
|
+
return yield* fail("INVALID_ARGUMENT", `The default branch can't be a ref Git moves: ${branch} is under ${hidden.owner.prefix}, which ${hidden.mover} moves`, { hint: "Name a branch under 'refs/heads/', such as 'refs/heads/main'" });
|
|
90
|
+
});
|
|
90
91
|
/**
|
|
91
92
|
* A default branch `access` would hide from some readers is refused: a clone's `HEAD` would name
|
|
92
93
|
* a branch they can't see. A record that names one, from before a pattern matched it, keeps it,
|
|
@@ -100,8 +101,12 @@ const privateDefault = /* @__PURE__ */ Effect.fnUntraced(function* (branch) {
|
|
|
100
101
|
});
|
|
101
102
|
/** What `repos.rename` reads besides the record: its stats' rows, then its outbox. */
|
|
102
103
|
const renameReads = [...infoReads, ...outboxReads];
|
|
103
|
-
/**
|
|
104
|
-
|
|
104
|
+
/**
|
|
105
|
+
* Every merge queue target's reservation row, which a delete or rename reads for a topic's
|
|
106
|
+
* reservation: `queueLimits.targets` at most, each under `reservationRowBytesMost`, never the
|
|
107
|
+
* targets' own rows, which can pass 16 MiB together (#1971).
|
|
108
|
+
*/
|
|
109
|
+
const targetsRead = { collection: collections.queueReservations };
|
|
105
110
|
/**
|
|
106
111
|
* Refused while a topic's live reservation holds one of the repo's targets, `rows`, which a delete
|
|
107
112
|
* or rename would take from under it after its check: the topic is named, and how to release it
|
|
@@ -327,7 +332,7 @@ const createWith = /* @__PURE__ */ Effect.fnUntraced(function* (caller, input, a
|
|
|
327
332
|
changedAt: at
|
|
328
333
|
};
|
|
329
334
|
if (core.refIndex !== void 0) record.refIndex = core.refIndex.stamp;
|
|
330
|
-
const info = yield*
|
|
335
|
+
const info = yield* createdInfo(caller, internalId, record);
|
|
331
336
|
const receipt = receiptWrites(kept, repoKept(info), core.repackJobRow);
|
|
332
337
|
const created = {
|
|
333
338
|
type: "repo.created",
|
|
@@ -385,7 +390,8 @@ const repoCalls = (bound) => {
|
|
|
385
390
|
repo
|
|
386
391
|
};
|
|
387
392
|
const caller = callerOf(input);
|
|
388
|
-
const
|
|
393
|
+
const confirm = input.unconfirmed === true ? "skip" : "read";
|
|
394
|
+
const opened = yield* openRepo(caller, operation, infoReads, input.internalId, confirm);
|
|
389
395
|
return yield* repoInfo(caller, opened.internalId, opened.record, opened.snapshot.results.slice(1));
|
|
390
396
|
});
|
|
391
397
|
const list = Effect.fnUntraced(function* (input) {
|
|
@@ -555,7 +561,7 @@ const repoCalls = (bound) => {
|
|
|
555
561
|
...infoReads,
|
|
556
562
|
...keyReads,
|
|
557
563
|
...flipReads
|
|
558
|
-
], input.internalId);
|
|
564
|
+
], input.internalId, "skip");
|
|
559
565
|
const results = snapshot.results.slice(1);
|
|
560
566
|
const keyRows = results.slice(infoReads.length, infoReads.length + keyReads.length);
|
|
561
567
|
const held = yield* heldReceipt(keyRows, kept);
|
|
@@ -641,7 +647,7 @@ const repoCalls = (bound) => {
|
|
|
641
647
|
...keyReads,
|
|
642
648
|
targetsRead
|
|
643
649
|
];
|
|
644
|
-
const opened = yield* openKeyed(caller, operation, reads, keyed, input.internalId);
|
|
650
|
+
const opened = yield* openKeyed(caller, operation, reads, keyed, input.internalId, "skip");
|
|
645
651
|
if (opened === void 0) continue;
|
|
646
652
|
const keyRows = opened.snapshot.results.slice(1 + renameReads.length);
|
|
647
653
|
const held = yield* heldReceipt(keyRows.slice(0, keyReads.length), kept);
|
|
@@ -662,7 +668,7 @@ const repoCalls = (bound) => {
|
|
|
662
668
|
name: repo,
|
|
663
669
|
revision: opened.record.revision + 1
|
|
664
670
|
};
|
|
665
|
-
if (core.events
|
|
671
|
+
if (keepsEvents(core.events)) renamedFrom.nextSeq = outbox.head.next;
|
|
666
672
|
if (kept !== void 0) renamedFrom.receipt = receiptId(kept.at, kept.key);
|
|
667
673
|
const moved = {
|
|
668
674
|
...opened.record,
|
|
@@ -742,7 +748,7 @@ const repoCalls = (bound) => {
|
|
|
742
748
|
...keyReads,
|
|
743
749
|
targetsRead
|
|
744
750
|
];
|
|
745
|
-
const opened = yield* openKeyed(caller, operation, reads, keyed, input.internalId);
|
|
751
|
+
const opened = yield* openKeyed(caller, operation, reads, keyed, input.internalId, "skip");
|
|
746
752
|
if (opened === void 0) continue;
|
|
747
753
|
const { name, internalId, record, snapshot } = opened;
|
|
748
754
|
const keyRows = snapshot.results.slice(1 + outboxReads.length);
|
|
@@ -765,7 +771,7 @@ const repoCalls = (bound) => {
|
|
|
765
771
|
revision: record.revision + 1,
|
|
766
772
|
changedAt: at
|
|
767
773
|
};
|
|
768
|
-
if (core.events
|
|
774
|
+
if (keepsEvents(core.events)) deleted.nextSeq = appended.head.next;
|
|
769
775
|
const receipt = receiptWrites(kept, { kind: "done" }, core.repackJobRow);
|
|
770
776
|
if ((yield* writeRecord(store, internalId, {
|
|
771
777
|
expect: snapshot.version,
|
|
@@ -20,7 +20,7 @@ const withEmptyTree = (read) => async (input) => input.oid === "4b825dc642cb6eb9
|
|
|
20
20
|
}
|
|
21
21
|
} : read(input);
|
|
22
22
|
/** A commit, or `undefined` for a tip that isn't one, such as a tag's. */
|
|
23
|
-
const commitOf =
|
|
23
|
+
const commitOf = /* @__PURE__ */ Effect.fnUntraced(function* (read, oid, signal) {
|
|
24
24
|
const found = yield* Effect.promise(() => read({
|
|
25
25
|
oid,
|
|
26
26
|
signal
|
|
@@ -42,7 +42,7 @@ const treeOf = (read, oid, signal) => Effect.map(commitOf(read, oid, signal), (c
|
|
|
42
42
|
* The files that differ between `from`'s and `to`'s trees, as `diff-tree -r -M` lists them: a
|
|
43
43
|
* create from the empty tree, a delete to it. A tip that isn't a commit changes no files.
|
|
44
44
|
*/
|
|
45
|
-
const changesBetween = (read, from, to, signal, objects)
|
|
45
|
+
const changesBetween = /* @__PURE__ */ Effect.fnUntraced(function* (read, from, to, signal, objects) {
|
|
46
46
|
const reads = withEmptyTree(read);
|
|
47
47
|
const base = from === void 0 ? emptyTree : yield* treeOf(reads, from, signal);
|
|
48
48
|
const head = to === void 0 ? emptyTree : yield* treeOf(reads, to, signal);
|
|
@@ -25,13 +25,14 @@ const ruleAnswer = (reports, checking, rule, reached, update) => {
|
|
|
25
25
|
return hostEffect(reports, "rules.push", checking.about, answer);
|
|
26
26
|
};
|
|
27
27
|
/**
|
|
28
|
-
* Whether `
|
|
29
|
-
* merge queue's or an import's, and no push or API call moves it, whatever
|
|
28
|
+
* Whether a push `as` an owner may change `ref`: a ref under one of `table`'s prefixes is its
|
|
29
|
+
* owner's own, the merge queue's or an import's, and no other push or API call moves it, whatever
|
|
30
|
+
* the rules say.
|
|
30
31
|
*/
|
|
31
|
-
const gitsOwnRef = (ref,
|
|
32
|
-
const hidden = hiddenUnder(ref);
|
|
33
|
-
if (hidden === void 0 || hidden.owner ===
|
|
34
|
-
return gitError("NOT_ALLOWED", `'${ref}' is Git's own: only ${hidden.mover} moves it`, { hint: `Push to a branch, not under ${hidden.prefix}` });
|
|
32
|
+
const gitsOwnRef = (table, ref, as) => {
|
|
33
|
+
const hidden = hiddenUnder(table, ref);
|
|
34
|
+
if (hidden === void 0 || hidden.owner === as) return void 0;
|
|
35
|
+
return gitError("NOT_ALLOWED", `'${ref}' is Git's own: only ${hidden.mover} moves it`, { hint: `Push to a branch, not under ${hidden.owner.prefix}` });
|
|
35
36
|
};
|
|
36
37
|
/**
|
|
37
38
|
* A write to a name the caller can't write, as `RefView.writes` says: one it doesn't see, or one
|
|
@@ -7,8 +7,8 @@ import { openTreesRefusal } from "../../storage/push-allotment.mjs";
|
|
|
7
7
|
import { answerFailed } from "../../contracts/calls-spent.mjs";
|
|
8
8
|
import { commitOf, treeOf, withEmptyTree } from "./changes.mjs";
|
|
9
9
|
import * as Effect from "effect/Effect";
|
|
10
|
-
import * as Predicate from "effect/Predicate";
|
|
11
10
|
import * as Option from "effect/Option";
|
|
11
|
+
import * as Predicate from "effect/Predicate";
|
|
12
12
|
import * as Stream from "effect/Stream";
|
|
13
13
|
// src/core/rules/commit-changes.ts
|
|
14
14
|
/** Whether `received` brings any object at all: a pack, or rows. */
|
|
@@ -21,7 +21,6 @@ export interface CheckInput {
|
|
|
21
21
|
readonly atomic: boolean;
|
|
22
22
|
readonly pushOptions?: readonly string[];
|
|
23
23
|
readonly request?: Request;
|
|
24
|
-
readonly signal?: AbortSignal;
|
|
25
24
|
readonly push: {
|
|
26
25
|
readonly bytes: number;
|
|
27
26
|
readonly objects: number;
|
|
@@ -30,7 +29,7 @@ export interface CheckInput {
|
|
|
30
29
|
/** Refs refused before the checks, which no rule sees. */
|
|
31
30
|
readonly refused: ReadonlyMap<RefName, GitError>;
|
|
32
31
|
readonly stats: RepoStats;
|
|
33
|
-
/** The push's call scope, which a check's reads carry, so a hook's
|
|
32
|
+
/** The push's call scope, which a check's reads carry, so a hook group's reads count into it too. */
|
|
34
33
|
readonly scope: CallScope;
|
|
35
34
|
/** `Kinds.exact`: a force's kind with no trust in the clock. */
|
|
36
35
|
readonly exact: (update: RefUpdate) => Effect.Effect<RefUpdateKind, GitError>;
|
|
@@ -57,10 +56,10 @@ export interface PushedObjects {
|
|
|
57
56
|
readonly lfsPointers: LfsPointers;
|
|
58
57
|
}
|
|
59
58
|
/**
|
|
60
|
-
* A check after the host's rules, in its
|
|
61
|
-
* no earlier check refused. A
|
|
59
|
+
* A check after the host's rules, in its registration's band: the refs it refuses among `updates`, those
|
|
60
|
+
* no earlier check refused. A registration's push check is one, LFS's pointer check among them.
|
|
62
61
|
*/
|
|
63
|
-
export type
|
|
62
|
+
export type RegisteredCheck = Ordered<(input: CheckInput, updates: readonly RefUpdate[]) => Effect.Effect<ReadonlyMap<RefName, GitError>, GitError>>;
|
|
64
63
|
/** What a rule such as `Rules.files` tells the walk: the refs it covers, and a path it refuses. */
|
|
65
64
|
export interface JudgingRule {
|
|
66
65
|
readonly covers: (ref: RefName) => boolean;
|