@ref0/git 0.6.0 → 0.8.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 +26 -13
- 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 +35 -29
- package/dist/auth/bridge.mjs +8 -8
- package/dist/auth/fences.d.mts +1 -2
- package/dist/auth/fences.mjs +1 -1
- package/dist/auth/grants.d.mts +0 -1
- package/dist/auth/grants.mjs +2 -2
- package/dist/auth/host-function.d.mts +1 -7
- package/dist/auth/host-function.mjs +51 -42
- package/dist/auth/identify.d.mts +0 -1
- package/dist/auth/identify.mjs +3 -2
- package/dist/auth/namespaces.d.mts +2 -2
- package/dist/auth/policy.d.mts +7 -4
- package/dist/auth/policy.mjs +13 -10
- package/dist/auth/token-rows.mjs +3 -6
- package/dist/auth/tokens-layer.d.mts +40 -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 +31 -0
- package/dist/auth/tokens.d.mts +19 -7
- package/dist/auth/tokens.mjs +12 -6
- package/dist/auth.d.mts +2 -2
- package/dist/auth.mjs +2 -2
- package/dist/client/client.d.mts +22 -15
- package/dist/client/client.mjs +31 -27
- package/dist/client/git-http.mjs +23 -6
- package/dist/client/local.mjs +5 -4
- package/dist/client/namespace.d.mts +2 -0
- package/dist/client/push-upload.d.mts +1 -0
- package/dist/client/push-upload.mjs +169 -2
- package/dist/client/remote-helper.mjs +5 -12
- package/dist/client/remote.mjs +63 -22
- package/dist/client/run-remote-helper.d.mts +1 -1
- package/dist/client/run-remote-helper.mjs +6 -6
- package/dist/client/slice-push.d.mts +1 -1
- package/dist/client/transport.mjs +26 -19
- package/dist/contracts/access.d.mts +18 -10
- package/dist/contracts/access.mjs +17 -0
- package/dist/contracts/actors.d.mts +73 -28
- package/dist/contracts/actors.mjs +45 -2
- package/dist/contracts/authorize.d.mts +26 -17
- package/dist/contracts/blobs.d.mts +1 -1
- package/dist/contracts/blobs.mjs +1 -1
- package/dist/contracts/callers.mjs +40 -0
- package/dist/contracts/calls-spent.d.mts +6 -4
- package/dist/contracts/calls-spent.mjs +10 -8
- package/dist/contracts/client.d.mts +16 -9
- 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 +45 -32
- package/dist/contracts/events.mjs +21 -10
- package/dist/contracts/files.d.mts +44 -44
- package/dist/contracts/files.mjs +1 -1
- package/dist/contracts/forks.d.mts +34 -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 +254 -0
- package/dist/contracts/git-hooks.mjs +12 -0
- package/dist/contracts/git.d.mts +93 -42
- package/dist/contracts/git.mjs +6 -5
- package/dist/contracts/grants.d.mts +46 -27
- package/dist/contracts/ids.d.mts +16 -0
- package/dist/contracts/ids.mjs +19 -4
- package/dist/contracts/lfs.d.mts +19 -4
- package/dist/contracts/merges.d.mts +7 -7
- package/dist/contracts/namespaces.d.mts +2 -2
- package/dist/contracts/objects.d.mts +21 -5
- package/dist/contracts/opaque.mjs +27 -0
- package/dist/contracts/operations.d.mts +301 -101
- package/dist/contracts/operations.mjs +209 -0
- package/dist/contracts/promises.d.mts +2 -0
- package/dist/contracts/push-uploads.d.mts +4 -1
- package/dist/contracts/push-uploads.mjs +9 -4
- package/dist/contracts/queue.d.mts +220 -49
- package/dist/contracts/queue.mjs +68 -6
- package/dist/contracts/refs.d.mts +30 -8
- package/dist/contracts/refs.mjs +1 -1
- package/dist/contracts/remote.d.mts +53 -23
- package/dist/contracts/remote.mjs +22 -0
- package/dist/contracts/repo-records.d.mts +2 -2
- package/dist/contracts/repos.d.mts +100 -82
- package/dist/contracts/repos.mjs +47 -8
- package/dist/contracts/result.d.mts +73 -41
- package/dist/contracts/result.mjs +74 -17
- package/dist/contracts/rules.d.mts +734 -68
- package/dist/contracts/rules.mjs +84 -1
- package/dist/contracts/server.d.mts +20 -206
- package/dist/contracts/services.d.mts +1 -10
- package/dist/contracts/services.mjs +1 -5
- package/dist/contracts/signin.d.mts +140 -43
- package/dist/contracts/signin.mjs +36 -3
- package/dist/contracts/store.d.mts +1 -1
- package/dist/contracts/sync.d.mts +109 -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 +247 -60
- package/dist/contracts/tokens.mjs +93 -21
- package/dist/contracts/topics.d.mts +59 -20
- package/dist/contracts/topics.mjs +14 -5
- package/dist/contracts/trees.d.mts +2 -2
- package/dist/contracts/trees.mjs +1 -1
- package/dist/contracts/work.d.mts +2 -2
- package/dist/contracts/work.mjs +2 -2
- package/dist/core/access.d.mts +10 -12
- package/dist/core/access.mjs +45 -11
- package/dist/core/clock.mjs +1 -1
- package/dist/core/events/deliver.d.mts +3 -2
- package/dist/core/events/deliver.mjs +188 -92
- package/dist/core/forks.mjs +78 -34
- package/dist/core/hooks/groups.d.mts +26 -0
- package/dist/core/hooks/groups.mjs +73 -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 +11 -8
- package/dist/core/loose-tally.mjs +46 -0
- 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 +4 -3
- package/dist/core/own-writes.mjs +1 -1
- package/dist/core/parts.d.mts +22 -3
- package/dist/core/parts.mjs +5 -3
- package/dist/core/promise.mjs +23 -17
- package/dist/core/purge.d.mts +2 -2
- package/dist/core/purge.mjs +89 -34
- package/dist/core/push.mjs +67 -79
- package/dist/core/receipts.d.mts +2 -2
- package/dist/core/receipts.mjs +28 -4
- package/dist/core/ref-index-job.mjs +4 -4
- package/dist/core/ref-view.mjs +16 -8
- package/dist/core/refs.mjs +41 -10
- package/dist/core/registered-records.mjs +30 -0
- package/dist/core/{claim-rows.mjs → registered-rows.mjs} +6 -6
- package/dist/core/repack.d.mts +2 -2
- package/dist/core/repack.mjs +30 -23
- package/dist/core/repo-info.mjs +62 -26
- package/dist/core/repos.mjs +18 -11
- package/dist/core/rules/changes.mjs +2 -2
- package/dist/core/rules/check.mjs +10 -10
- package/dist/core/rules/commit-changes.mjs +1 -1
- package/dist/core/rules/context.d.mts +7 -6
- package/dist/core/rules/context.mjs +18 -16
- package/dist/core/rules/fetch.mjs +78 -31
- 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 +12 -1
- package/dist/core/seam.mjs +4 -2
- package/dist/core/tokens.mjs +7 -2
- package/dist/core/view.d.mts +1 -1
- package/dist/core/view.mjs +1 -1
- package/dist/core/work.mjs +6 -5
- package/dist/effect.d.mts +2 -4
- package/dist/effect.mjs +2 -4
- package/dist/engine/commits.mjs +19 -47
- 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/failures.d.mts +1 -2
- package/dist/engine/failures.mjs +1 -3
- package/dist/engine/merge-base-walk.mjs +57 -142
- package/dist/engine/merge-bases.mjs +5 -5
- package/dist/engine/merge-renames.mjs +1 -1
- package/dist/engine/merge.mjs +16 -14
- 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 +2 -3
- package/dist/extend.mjs +2 -2
- package/dist/http/answers.mjs +4 -3
- package/dist/http/core-parts.mjs +3 -4
- package/dist/http/handler.mjs +12 -32
- package/dist/http/parts.d.mts +1 -1
- package/dist/http/push-uploads.mjs +7 -5
- package/dist/http/receive-pack.mjs +3 -3
- package/dist/http/upload-pack.mjs +6 -5
- package/dist/index.d.mts +44 -24
- package/dist/index.mjs +17 -8
- package/dist/lfs/base.d.mts +8 -5
- package/dist/lfs/base.mjs +2 -1
- package/dist/lfs/calls.mjs +3 -2
- package/dist/lfs/layer.d.mts +9 -7
- package/dist/lfs/layer.mjs +37 -22
- package/dist/lfs/locks.mjs +3 -3
- package/dist/lfs/objects.d.mts +3 -2
- package/dist/lfs/objects.mjs +235 -71
- package/dist/lfs/pointers.mjs +70 -19
- package/dist/lfs/purge.mjs +7 -3
- package/dist/lfs/rows.mjs +25 -8
- package/dist/lfs/service.d.mts +6 -3
- package/dist/lfs/service.mjs +8 -2
- package/dist/lfs/upkeep.mjs +53 -31
- package/dist/lfs/upload-most.mjs +41 -0
- package/dist/lfs/uploaded.mjs +59 -0
- package/dist/lfs/wire.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/bytes/sha256-hasher.mjs +51 -0
- package/dist/protocol/bytes/text.mjs +6 -1
- 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/fsck.mjs +6 -3
- 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 +1 -1
- package/dist/protocol/wire/advertisement.mjs +1 -1
- package/dist/protocol/wire/fetch.d.mts +1 -1
- package/dist/protocol/wire/fetch.mjs +1 -1
- package/dist/protocol/wire/lines.d.mts +1 -1
- package/dist/protocol/wire/lines.mjs +2 -2
- 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 +2 -2
- package/dist/protocol/wire/v2.mjs +2 -2
- package/dist/queue/advance.mjs +190 -68
- package/dist/queue/callers.mjs +56 -69
- package/dist/queue/calls.mjs +10 -11
- package/dist/queue/commit.mjs +28 -22
- package/dist/queue/host.d.mts +10 -11
- package/dist/queue/host.mjs +15 -7
- package/dist/queue/lanes.mjs +9 -18
- package/dist/queue/layer.d.mts +3 -3
- package/dist/queue/layer.mjs +11 -10
- package/dist/queue/limits.mjs +17 -5
- package/dist/queue/rows.mjs +13 -10
- package/dist/queue/schedule.mjs +7 -6
- package/dist/queue/search.mjs +11 -17
- package/dist/queue/state.mjs +7 -2
- package/dist/queue/trim.mjs +10 -5
- package/dist/rest/api.d.mts +1 -1
- package/dist/rest/blobs.d.mts +20 -20
- package/dist/rest/caller.d.mts +22 -20
- package/dist/rest/client-namespace.d.mts +2 -0
- package/dist/rest/client.d.mts +32 -8
- package/dist/rest/client.mjs +314 -388
- package/dist/rest/commits.d.mts +284 -284
- 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 +48 -48
- package/dist/rest/forks.d.mts +131 -143
- package/dist/rest/handler.mjs +4 -3
- package/dist/rest/handlers.mjs +15 -8
- package/dist/rest/layer.d.mts +3 -3
- package/dist/rest/layer.mjs +8 -7
- package/dist/rest/listen.d.mts +8 -6
- package/dist/rest/listen.mjs +33 -77
- package/dist/rest/me.d.mts +18 -20
- package/dist/rest/me.mjs +1 -1
- package/dist/rest/merges.d.mts +17 -17
- package/dist/rest/queue.d.mts +140 -140
- package/dist/rest/queue.mjs +1 -1
- package/dist/rest/refs.d.mts +214 -214
- package/dist/rest/refs.mjs +1 -1
- package/dist/rest/repos.d.mts +123 -135
- package/dist/rest/tags.d.mts +30 -30
- package/dist/rest/tokens.d.mts +250 -260
- package/dist/rest/tokens.mjs +10 -42
- package/dist/rest/topics.d.mts +162 -162
- package/dist/rest/topics.mjs +1 -1
- package/dist/rest/trees.d.mts +117 -117
- package/dist/rest/wire.d.mts +7 -5
- package/dist/rest/wire.mjs +4 -3
- package/dist/rest/work.d.mts +69 -69
- package/dist/rest/work.mjs +1 -1
- package/dist/rest.d.mts +1 -7
- package/dist/rest.mjs +1 -5
- package/dist/server/check-fetch.mjs +9 -0
- package/dist/server/extension.mjs +3 -115
- package/dist/server/git-layer.d.mts +30 -5
- package/dist/server/git-layer.mjs +59 -29
- package/dist/server/git-namespace.d.mts +4 -4
- package/dist/server/git-namespace.mjs +6 -4
- package/dist/server/joined.d.mts +83 -0
- package/dist/server/joined.mjs +91 -0
- package/dist/server/registry.d.mts +7 -3
- package/dist/server/registry.mjs +135 -31
- package/dist/server/server.d.mts +9 -3
- package/dist/server/server.mjs +277 -208
- package/dist/signin/context.d.mts +2 -2
- package/dist/signin/context.mjs +28 -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 +1 -1
- package/dist/storage/calls.mjs +4 -4
- package/dist/storage/clean-up.mjs +15 -6
- package/dist/storage/counted-bucket.mjs +34 -51
- package/dist/storage/fetch.mjs +1 -1
- package/dist/storage/fsck.mjs +12 -2
- package/dist/storage/graph-rebuild.mjs +262 -0
- package/dist/storage/host-bucket.mjs +1 -1
- package/dist/storage/index-build.d.mts +2 -2
- package/dist/storage/index-build.mjs +103 -15
- 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/lfs-pointers.d.mts +5 -5
- package/dist/storage/lfs-pointers.mjs +37 -11
- package/dist/storage/loose.mjs +4 -1
- package/dist/storage/memory-budget.mjs +8 -2
- package/dist/storage/merge-cut.mjs +24 -1
- package/dist/storage/merge-fence.mjs +82 -20
- package/dist/storage/merge-most.mjs +1 -0
- package/dist/storage/merge-plan.mjs +5 -2
- package/dist/storage/merge-row.mjs +17 -5
- package/dist/storage/merge-stream.mjs +25 -13
- 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 +20 -4
- 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 +17 -15
- package/dist/storage/packs.d.mts +1 -1
- package/dist/storage/packs.mjs +103 -79
- 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 +113 -50
- package/dist/storage/push-uploads.mjs +4 -2
- package/dist/storage/quarantine.d.mts +2 -2
- package/dist/storage/ready.d.mts +2 -2
- package/dist/storage/ready.mjs +15 -6
- 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 +2 -2
- package/dist/storage/receive-steps.mjs +1 -1
- package/dist/storage/repack-contained.mjs +24 -16
- package/dist/storage/repack-job.d.mts +2 -2
- package/dist/storage/repack-job.mjs +5 -4
- package/dist/storage/repack.d.mts +2 -2
- package/dist/storage/repack.mjs +12 -5
- package/dist/storage/rows.d.mts +2 -2
- package/dist/storage/rows.mjs +1 -1
- 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 +8 -1
- package/dist/store/call-count.d.mts +24 -4
- package/dist/store/call-count.mjs +158 -44
- 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 +119 -15
- package/dist/store/list-job.mjs +5 -5
- package/dist/store/outbox.d.mts +2 -2
- package/dist/store/outbox.mjs +75 -16
- package/dist/store/promises.d.mts +2 -2
- package/dist/store/promises.mjs +31 -6
- package/dist/store/queue-jobs.mjs +1 -1
- package/dist/store/records.d.mts +2 -2
- package/dist/store/records.mjs +22 -24
- package/dist/store/ref-rows.d.mts +2 -2
- package/dist/store/ref-rows.mjs +6 -6
- package/dist/store/repo-record.mjs +29 -12
- package/dist/store/reservations.mjs +35 -8
- package/dist/store/scopes.mjs +12 -5
- 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/github.d.mts +5 -6
- package/dist/sync/github.mjs +37 -42
- package/dist/sync/http.mjs +15 -0
- package/dist/sync/import.mjs +30 -19
- package/dist/sync/layer.d.mts +13 -0
- package/dist/sync/layer.mjs +73 -0
- package/dist/sync/mirror.mjs +137 -58
- package/dist/sync/publish.mjs +3 -6
- package/dist/sync/step.mjs +223 -85
- 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 +210 -94
- 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 +39 -10
- 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 -216
- package/dist/core/hooks/pre-receive.d.mts +0 -12
- package/dist/core/hooks/pre-receive.mjs +0 -36
- package/dist/engine/merge-base-walk.d.mts +0 -3
- package/dist/server/extension.d.mts +0 -21
- package/dist/server/routes.d.mts +0 -32
- package/dist/server/routes.mjs +0 -69
- 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/{claim-rows.d.mts → registered-rows.d.mts} +0 -0
package/dist/core/purge.d.mts
CHANGED
|
@@ -3,6 +3,6 @@ import "../contracts/git.mjs";
|
|
|
3
3
|
import "../contracts/result.mjs";
|
|
4
4
|
import "../contracts/ids.mjs";
|
|
5
5
|
import "../contracts/objects.mjs";
|
|
6
|
-
import
|
|
6
|
+
import "effect/Effect";
|
|
7
7
|
import "effect/Schema";
|
|
8
|
-
import "
|
|
8
|
+
import { JobDefinition, JobInput, Moment } from "@ref0/infra";
|
package/dist/core/purge.mjs
CHANGED
|
@@ -3,27 +3,41 @@ import { objectCollections } from "../storage/layout.mjs";
|
|
|
3
3
|
import { tooLargeRead } from "../storage/object-rows.mjs";
|
|
4
4
|
import { forkedFrom, reconcile, releaseHold } from "../store/catalogue.mjs";
|
|
5
5
|
import { storeCall } from "../store/errors.mjs";
|
|
6
|
-
import {
|
|
6
|
+
import { gitJob, repoTry } from "../store/job-try.mjs";
|
|
7
7
|
import { outboxCollections } from "../store/outbox.mjs";
|
|
8
8
|
import { readRecord } from "../store/repo-record.mjs";
|
|
9
9
|
import { collections, newChangeId, repoScope } from "../store/scopes.mjs";
|
|
10
|
-
import { isDeliverJob } from "./events/deliver.mjs";
|
|
11
|
-
import "./hooks/post-receive.mjs";
|
|
10
|
+
import { isDeliverJob, sentThrough } from "./events/deliver.mjs";
|
|
12
11
|
import { indexJobName } from "./index-job.mjs";
|
|
13
|
-
import { Job, limits } from "@ref0/infra";
|
|
14
|
-
import * as Schema from "effect/Schema";
|
|
15
12
|
import * as Effect from "effect/Effect";
|
|
13
|
+
import * as Schema from "effect/Schema";
|
|
14
|
+
import { Job, limits } from "@ref0/infra";
|
|
16
15
|
// src/core/purge.ts
|
|
17
16
|
/**
|
|
18
|
-
* `git.purge`, a deleted repo's last job (L61, L130).
|
|
19
|
-
*
|
|
17
|
+
* `git.purge`, a deleted repo's last job (L61, L130). Not before its delete's `fetchLimits` has
|
|
18
|
+
* passed, so a fetch begun before the delete reads to its end, and once the jobs that drain its
|
|
19
|
+
* bytes have ended, it deletes the rows of its scope a page a step, each feature's part first with the bytes
|
|
20
20
|
* its rows name, then its record last, so a late try of any other job reads no record and ends.
|
|
21
21
|
* A source waits while a fork holds it, deleted or not, since a fork's LFS reads through its
|
|
22
|
-
* source; a fork's purge releases its hold just before its record goes.
|
|
22
|
+
* source; a fork's purge releases its hold just before its record goes. Then it drops the repo's
|
|
23
|
+
* scopes, the registrations' and its own, so a store frees each, as Turso's deletes its database
|
|
24
|
+
* (#1911, Q1160, Q1161).
|
|
23
25
|
*/
|
|
24
26
|
/** The most rows a step deletes: inside one commit's `limits.writes`. */
|
|
25
27
|
const purgePage = 1e3;
|
|
26
28
|
/**
|
|
29
|
+
* When a waiting purge looks again while what holds it has no time of its own: a failed drain job,
|
|
30
|
+
* a drained row with no job to drain it, a fork's hold or a part's `waits`. Their end wakes no
|
|
31
|
+
* purge, so this bounds how long one stands after it.
|
|
32
|
+
*/
|
|
33
|
+
const purgeBackstop = 6e5;
|
|
34
|
+
/**
|
|
35
|
+
* When a waiting purge looks again while a drain job runs, or is due and not yet claimed: a try's
|
|
36
|
+
* default timeout, 30 s, and its lease margin, 30 s. A drain's end wakes no purge, since its row
|
|
37
|
+
* goes only after its try returns, so a purge woken from inside the try would read it running.
|
|
38
|
+
*/
|
|
39
|
+
const purgeRunningRelook = 6e4;
|
|
40
|
+
/**
|
|
27
41
|
* A step's page where its rows passed one read's `limits.answerBytes`, as object rows can: rows
|
|
28
42
|
* of `limits.valueBytes` each fill half an answer.
|
|
29
43
|
*/
|
|
@@ -32,11 +46,11 @@ const purgeLargePage = /* @__PURE__ */ Math.floor(limits.answerBytes / limits.va
|
|
|
32
46
|
* The jobs whose work a purge waits for, while one is waiting, running or failed in the repo's
|
|
33
47
|
* scope: git.repack's moves its packs' bytes out and runs its upkeep's, git.index's deleted round
|
|
34
48
|
* deletes its index's files, and each delivery's, `git.deliver.<name>`, sends `repo.deleted`. A
|
|
35
|
-
* failed one holds the purge until a host retries or discards it. A
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
49
|
+
* failed one holds the purge until a host retries or discards it. A delivery's waiting job that
|
|
50
|
+
* has sent `repo.deleted` holds it no longer, since it waits only to trim events the purge
|
|
51
|
+
* deletes itself. A new job that deletes a repo's bytes joins this list, or its check below.
|
|
52
|
+
* Every other job ends on the record the purge deletes last: git.list's projection the purge runs
|
|
53
|
+
* itself before it.
|
|
40
54
|
*/
|
|
41
55
|
const drainJobs = /* @__PURE__ */ new Set([repackJobName, indexJobName]);
|
|
42
56
|
/**
|
|
@@ -61,8 +75,6 @@ const drainedCollections = [
|
|
|
61
75
|
const purgeCollections = [
|
|
62
76
|
collections.refs,
|
|
63
77
|
collections.refIndex,
|
|
64
|
-
collections.pushes,
|
|
65
|
-
collections.postReceive,
|
|
66
78
|
collections.receipts,
|
|
67
79
|
collections.receiptIndex,
|
|
68
80
|
collections.ownWrites,
|
|
@@ -73,6 +85,7 @@ const purgeCollections = [
|
|
|
73
85
|
collections.tokenExpiry,
|
|
74
86
|
collections.queue,
|
|
75
87
|
collections.queueTargets,
|
|
88
|
+
collections.queueReservations,
|
|
76
89
|
collections.queueEntries,
|
|
77
90
|
collections.queueCandidates,
|
|
78
91
|
collections.queueHolds,
|
|
@@ -99,16 +112,33 @@ const purgeJobKey = "purge";
|
|
|
99
112
|
const PurgeData = /* @__PURE__ */ Schema.Struct({});
|
|
100
113
|
const again = { kind: "more" };
|
|
101
114
|
/**
|
|
102
|
-
*
|
|
103
|
-
* a
|
|
115
|
+
* When a purge at `at` looks again for one drain job or delivery's: a waiting one's due, a running
|
|
116
|
+
* one's `purgeRunningRelook`, a failed one's `purgeBackstop`. A due time no later than the
|
|
117
|
+
* running re-look's is the queue's to claim at once.
|
|
104
118
|
*/
|
|
105
|
-
const
|
|
119
|
+
const relookFor = (item, at) => {
|
|
120
|
+
if (item.state === "failed") return at + purgeBackstop;
|
|
121
|
+
return item.state === "waiting" ? Math.max(item.due, at + purgeRunningRelook) : at + purgeRunningRelook;
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* When a purge at `at` looks again for the drain jobs and deliveries waiting, running or failed in
|
|
125
|
+
* `scope`, the soonest of theirs: none when none is left. A page of its jobs at a time. `deleted`
|
|
126
|
+
* is `repo.deleted`'s `seq`, past which a waiting delivery holds nothing; with none, each holds.
|
|
127
|
+
*/
|
|
128
|
+
const draining = /* @__PURE__ */ Effect.fnUntraced(function* (store, scope, at, deleted) {
|
|
106
129
|
let after;
|
|
130
|
+
let soonest;
|
|
107
131
|
for (;;) {
|
|
108
132
|
const page = after === void 0 ? {} : { page: { after } };
|
|
109
133
|
const listing = yield* storeCall(() => store.list(scope, page));
|
|
110
|
-
|
|
111
|
-
|
|
134
|
+
for (const item of listing.items) {
|
|
135
|
+
const delivery = isDeliverJob(item);
|
|
136
|
+
if (!drainJobs.has(item.name) && !delivery) continue;
|
|
137
|
+
if (delivery && item.state === "waiting" && deleted !== void 0 && (yield* sentThrough(store, scope, item, deleted))) continue;
|
|
138
|
+
const relook = relookFor(item, at);
|
|
139
|
+
soonest = soonest === void 0 ? relook : Math.min(soonest, relook);
|
|
140
|
+
}
|
|
141
|
+
if (listing.next === void 0) return soonest;
|
|
112
142
|
after = listing.next;
|
|
113
143
|
}
|
|
114
144
|
});
|
|
@@ -175,9 +205,22 @@ const discardFailed = /* @__PURE__ */ Effect.fnUntraced(function* (store, scope)
|
|
|
175
205
|
}
|
|
176
206
|
});
|
|
177
207
|
/**
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
*
|
|
208
|
+
* Drops the scopes the registrations name for the repo, then its own, whose `git.purge` row is
|
|
209
|
+
* the last to go: a drop that fails leaves the row, whose next try drops each again. Past
|
|
210
|
+
* `purgeScopesMost` named, it drops none.
|
|
211
|
+
*/
|
|
212
|
+
const dropScopes = /* @__PURE__ */ Effect.fnUntraced(function* (parts, store, internalId) {
|
|
213
|
+
const named = yield* parts.scopes(internalId);
|
|
214
|
+
if (named.length > 64) return yield* Effect.die(/* @__PURE__ */ new TypeError(`The registrations name ${named.length} scopes of '${internalId}', past 64`));
|
|
215
|
+
for (const scope of [...named, repoScope(internalId)]) yield* storeCall(() => store.drop(scope));
|
|
216
|
+
});
|
|
217
|
+
/**
|
|
218
|
+
* One step in the repo's scope: none for a repo that isn't deleted. It waits until its delete's
|
|
219
|
+
* `fetchLimits` has passed, then while a drain job or a drained row stands, or a fork holds the
|
|
220
|
+
* repo, each wait till its own time to look again; else each part's step, then a page of
|
|
221
|
+
* `purgeCollections`, then the fork's hold on its source, then the record, then the drops. A repo
|
|
222
|
+
* with no record is one whose record this purge deleted, since only a delete queues it: its
|
|
223
|
+
* drops run again, each done already or done now.
|
|
181
224
|
*/
|
|
182
225
|
const purgeStep = /* @__PURE__ */ Effect.fnUntraced(function* (parts, store, internalId) {
|
|
183
226
|
const scope = repoScope(internalId);
|
|
@@ -186,18 +229,29 @@ const purgeStep = /* @__PURE__ */ Effect.fnUntraced(function* (parts, store, int
|
|
|
186
229
|
limit: 1
|
|
187
230
|
}));
|
|
188
231
|
const { record, snapshot } = yield* readRecord(store, internalId, drainedReads);
|
|
189
|
-
if (record
|
|
232
|
+
if (record === void 0) return yield* dropScopes(parts, store, internalId);
|
|
233
|
+
if (record.deleted !== true) return void 0;
|
|
190
234
|
const at = yield* parts.now;
|
|
191
|
-
const
|
|
235
|
+
const guard = record.changedAt + parts.fetchLimits.milliseconds;
|
|
236
|
+
if (at < guard) return {
|
|
237
|
+
...again,
|
|
238
|
+
at: guard
|
|
239
|
+
};
|
|
240
|
+
const backstop = {
|
|
241
|
+
...again,
|
|
242
|
+
at: at + purgeBackstop
|
|
243
|
+
};
|
|
244
|
+
const deleted = record.nextSeq === void 0 ? void 0 : record.nextSeq - 1;
|
|
245
|
+
const drain = yield* draining(store, scope, at, deleted);
|
|
246
|
+
if (drain !== void 0) return {
|
|
192
247
|
...again,
|
|
193
|
-
at:
|
|
248
|
+
at: drain
|
|
194
249
|
};
|
|
195
|
-
if (snapshot.results.slice(1).some((rows) => rows.length > 0)) return
|
|
196
|
-
if (yield*
|
|
197
|
-
if (yield* forkedFrom(store, internalId)) return waits;
|
|
250
|
+
if (snapshot.results.slice(1).some((rows) => rows.length > 0)) return backstop;
|
|
251
|
+
if (yield* forkedFrom(store, internalId)) return backstop;
|
|
198
252
|
for (const part of parts.parts) {
|
|
199
253
|
const step = yield* part(store, internalId);
|
|
200
|
-
if (step === "waits") return
|
|
254
|
+
if (step === "waits") return backstop;
|
|
201
255
|
if (step === "did") return again;
|
|
202
256
|
}
|
|
203
257
|
const { left, version } = yield* firstLeft(store, scope);
|
|
@@ -215,11 +269,12 @@ const purgeStep = /* @__PURE__ */ Effect.fnUntraced(function* (parts, store, int
|
|
|
215
269
|
yield* discardFailed(store, scope);
|
|
216
270
|
const own = yield* pageOf(store, scope, collections.repo);
|
|
217
271
|
if (own.version !== version) return again;
|
|
218
|
-
|
|
272
|
+
if (!(yield* storeCall(() => store.commit(scope, {
|
|
219
273
|
id: newChangeId(),
|
|
220
274
|
expect: version,
|
|
221
275
|
delete: own.keys
|
|
222
|
-
}))).ok
|
|
276
|
+
}))).ok) return again;
|
|
277
|
+
return yield* dropScopes(parts, store, internalId);
|
|
223
278
|
});
|
|
224
279
|
const PurgeJob = /* @__PURE__ */ Job.make(purgeJobName, {
|
|
225
280
|
payload: PurgeData,
|
|
@@ -227,11 +282,11 @@ const PurgeJob = /* @__PURE__ */ Job.make(purgeJobName, {
|
|
|
227
282
|
rebuild: () => ({})
|
|
228
283
|
});
|
|
229
284
|
/** `git.purge`, over one server's parts: each try one page of the repo's rows. */
|
|
230
|
-
const purgeJob = (parts) =>
|
|
285
|
+
const purgeJob = (parts) => gitJob(PurgeJob, () => repoTry((store, repo) => purgeStep(parts, store, repo)));
|
|
231
286
|
/** The repo's `git.purge` row, due at `at`. */
|
|
232
287
|
const purgeJobRow = (job, at) => job.job({
|
|
233
288
|
key: purgeJobKey,
|
|
234
289
|
data: {},
|
|
235
290
|
at
|
|
236
291
|
});
|
|
237
|
-
export { purgeCollections, purgeJob, purgeJobKey, purgeJobName, purgeJobRow, purgePage };
|
|
292
|
+
export { purgeBackstop, purgeCollections, purgeJob, purgeJobKey, purgeJobName, purgeJobRow, purgePage, purgeRunningRelook };
|
package/dist/core/push.mjs
CHANGED
|
@@ -10,11 +10,12 @@ import { noLfsPointers } from "../storage/lfs-pointers.mjs";
|
|
|
10
10
|
import { isShallowRoot } from "../storage/links.mjs";
|
|
11
11
|
import { isAwaitingRepack } from "../storage/repack-backlog.mjs";
|
|
12
12
|
import { allottedRows } from "../storage/allotted.mjs";
|
|
13
|
-
import { gitObjectOf, objectOfRow, receivedRows } from "../storage/object-rows.mjs";
|
|
13
|
+
import { gitObjectOf, noRows, objectOfRow, receivedRows } from "../storage/object-rows.mjs";
|
|
14
14
|
import { pruneClearedKey } from "../storage/prune.mjs";
|
|
15
15
|
import { abandonOwn } from "../storage/quarantine.mjs";
|
|
16
|
+
import { readyBytesOf, readyKey } from "../storage/ready.mjs";
|
|
16
17
|
import { QuarantineRow, decodeHeld } from "../storage/rows.mjs";
|
|
17
|
-
import { bestEffort, decodeRow, storeCall } from "../store/errors.mjs";
|
|
18
|
+
import { bestEffort, decodeRow, fromInfra, storeCall } from "../store/errors.mjs";
|
|
18
19
|
import { callScope } from "../store/call-count.mjs";
|
|
19
20
|
import { decodePacks, gitStore } from "../store/git-store.mjs";
|
|
20
21
|
import { WholeRepo, refBytesOf, storesPeel, wholeRefs } from "../store/ref-rows.mjs";
|
|
@@ -23,16 +24,18 @@ import { sliceOf } from "../protocol/wire/push-limits.mjs";
|
|
|
23
24
|
import { pushCounts } from "./events/seen.mjs";
|
|
24
25
|
import { refViewIn } from "./ref-view.mjs";
|
|
25
26
|
import { appendEvents, decodeOutbox, firstSeq, outboxReads, repoEnvelope } from "../store/outbox.mjs";
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
27
|
+
import { rowsAtCommit } from "./loose-tally.mjs";
|
|
28
|
+
import { MirrorRow } from "./mirror-rows.mjs";
|
|
29
|
+
import { PrunedMark, mirrorJobName } from "../store/records.mjs";
|
|
30
|
+
import { decodeStats, looseRows, readRecord, repoStats, timeRow } from "../store/repo-record.mjs";
|
|
28
31
|
import { advanceRow } from "../store/queue-jobs.mjs";
|
|
29
32
|
import { liveReservations, reservedTarget } from "../store/reservations.mjs";
|
|
30
33
|
import { settleName } from "../store/settle.mjs";
|
|
31
34
|
import { collections, newChangeId, prunedKey, pushedKey, pushedUnder, reachedKey, repoScope } from "../store/scopes.mjs";
|
|
32
35
|
import { headOf, indexJobs, openKeyed, openRepo, refIndexJobs, repoAccess } from "./access.mjs";
|
|
33
36
|
import { kindsOf } from "./ancestry.mjs";
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
37
|
+
import { isRefName } from "./names.mjs";
|
|
38
|
+
import { runHookGroups } from "./hooks/groups.mjs";
|
|
36
39
|
import { Changes } from "./changes.mjs";
|
|
37
40
|
import { batchOf, readerOf } from "./rules/changes.mjs";
|
|
38
41
|
import { commitChangesOf, coveredTips } from "./rules/commit-changes.mjs";
|
|
@@ -49,11 +52,11 @@ import { peeledAll, peeledOf } from "../storage/wants.mjs";
|
|
|
49
52
|
import { CoreParts, ObjectsParts } from "./parts.mjs";
|
|
50
53
|
import { Authorize, check } from "../contracts/authorize.mjs";
|
|
51
54
|
import { read } from "./objects/objects.mjs";
|
|
52
|
-
import { checkWrites } from "@ref0/infra";
|
|
53
|
-
import * as Effect from "effect/Effect";
|
|
54
55
|
import * as Clock$1 from "effect/Clock";
|
|
55
|
-
import * as
|
|
56
|
+
import * as Effect from "effect/Effect";
|
|
56
57
|
import * as Exit from "effect/Exit";
|
|
58
|
+
import * as Result from "effect/Result";
|
|
59
|
+
import { checkWrites } from "@ref0/infra";
|
|
57
60
|
import * as Equal from "effect/Equal";
|
|
58
61
|
// src/core/push.ts
|
|
59
62
|
/**
|
|
@@ -194,12 +197,12 @@ const markOf = (rows) => {
|
|
|
194
197
|
const firstRead = (caller, operation, internalId) => openRepo(caller, {
|
|
195
198
|
kind: "read",
|
|
196
199
|
repo: operation.repo
|
|
197
|
-
}, [packsRead, prunedKey], internalId);
|
|
200
|
+
}, [packsRead, prunedKey], internalId, "skip");
|
|
198
201
|
/** `firstRead` for a keyed push: `undefined` once `missed`'s repo moved, as `openKeyed` says. */
|
|
199
202
|
const keyedRead = (caller, operation, missed, internalId) => openKeyed(caller, {
|
|
200
203
|
kind: "read",
|
|
201
204
|
repo: operation.repo
|
|
202
|
-
}, [packsRead, prunedKey], missed, internalId);
|
|
205
|
+
}, [packsRead, prunedKey], missed, internalId, "skip");
|
|
203
206
|
/**
|
|
204
207
|
* The first read's repo once `authorize` lets the caller push to it: its list, for the pack to be
|
|
205
208
|
* received against, its default branch, whose move rebuilds the ready shallow pack, and its
|
|
@@ -294,8 +297,8 @@ const activeMirrors = /* @__PURE__ */ Effect.fnUntraced(function* (rows) {
|
|
|
294
297
|
return active;
|
|
295
298
|
});
|
|
296
299
|
/**
|
|
297
|
-
* `
|
|
298
|
-
* name among the jobs the server knows: none until `
|
|
300
|
+
* `sync.mirror`'s row for each ref the commit moves that an active mirror names, found by
|
|
301
|
+
* name among the jobs the server knows: none until `Sync.layer` has bound them.
|
|
299
302
|
*/
|
|
300
303
|
const mirrorJobs = (core, moved, mirrored) => {
|
|
301
304
|
const definition = core.jobOf?.(mirrorJobName);
|
|
@@ -400,9 +403,9 @@ const buildFence = (build) => [
|
|
|
400
403
|
/**
|
|
401
404
|
* The decide's read, one of the repo's scope: its refs, its outbox, the push's own `quarantine` row
|
|
402
405
|
* if it has one, its key's receipt if it has a key, the mirror of each ref in `touched`, the
|
|
403
|
-
*
|
|
404
|
-
*
|
|
405
|
-
* does a write with the same key that commits first. A prune that dropped objects since the first
|
|
406
|
+
* reservation row of each branch in `branches`, there while a queue targets it, with the live
|
|
407
|
+
* reservation each holds, and the caller's grant fence, checked on what it read. A revoke after it
|
|
408
|
+
* moves the version, as does a write with the same key that commits first. A prune that dropped objects since the first
|
|
406
409
|
* read moved the `pruned` mark: the push may name one it dropped, so unless its key's receipt
|
|
407
410
|
* answers, it fails, to be sent again (Q270). `changed`: whether a row of a build's fence,
|
|
408
411
|
* `unchanged`, holds another value than its plan read.
|
|
@@ -411,7 +414,7 @@ const finalRead = /* @__PURE__ */ Effect.fnUntraced(function* (store, repo, fenc
|
|
|
411
414
|
const own = received?.quarantine === void 0 ? [] : [received.quarantine];
|
|
412
415
|
const keyed = receiptReads(kept);
|
|
413
416
|
const targets = branches.map((id) => ({
|
|
414
|
-
collection: collections.
|
|
417
|
+
collection: collections.queueReservations,
|
|
415
418
|
id
|
|
416
419
|
}));
|
|
417
420
|
const linkedRows = received?.linked?.rows ?? [];
|
|
@@ -428,6 +431,7 @@ const finalRead = /* @__PURE__ */ Effect.fnUntraced(function* (store, repo, fenc
|
|
|
428
431
|
cruftRead,
|
|
429
432
|
indexRowKey,
|
|
430
433
|
reachedKey,
|
|
434
|
+
readyKey,
|
|
431
435
|
...own,
|
|
432
436
|
...keyed,
|
|
433
437
|
...targets,
|
|
@@ -444,7 +448,7 @@ const finalRead = /* @__PURE__ */ Effect.fnUntraced(function* (store, repo, fenc
|
|
|
444
448
|
], rowCounts);
|
|
445
449
|
if (record === void 0 || record.deleted === true) return yield* fail("NOT_FOUND", `No repo '${repo.name}'`);
|
|
446
450
|
const [, refRows = [], headRows = [], cursorRows = [], packRows = [], ...more] = snapshot.results;
|
|
447
|
-
const [markRows = [], timeRows = [], cruftRows = [], indexRows = [], reachedRows = [], ...rest] = more;
|
|
451
|
+
const [markRows = [], timeRows = [], cruftRows = [], indexRows = [], reachedRows = [], readyRows = [], ...rest] = more;
|
|
448
452
|
const receipt = yield* heldReceipt(rest.slice(own.length, own.length + keyed.length), kept);
|
|
449
453
|
if (receipt === void 0 && (yield* markOf(markRows)) !== mark) return yield* fail("UNAVAILABLE", "The repo was pruned during the push", { hint: "Push again" });
|
|
450
454
|
const targeted = rest.slice(own.length + keyed.length, own.length + keyed.length + targets.length);
|
|
@@ -463,7 +467,7 @@ const finalRead = /* @__PURE__ */ Effect.fnUntraced(function* (store, repo, fenc
|
|
|
463
467
|
const mirrorRows = rest.slice(guardedAt + unchanged.length).flat();
|
|
464
468
|
const changed = unchanged.some((row, at) => !Equal.equals(row.value, now[at]?.[0]?.value));
|
|
465
469
|
const packs = yield* decodePacks(packRows);
|
|
466
|
-
const times = yield*
|
|
470
|
+
const times = yield* decodeStats(timeRows);
|
|
467
471
|
const [ownRow] = own.length === 0 ? [] : rest[0] ?? [];
|
|
468
472
|
const refs = yield* wholeRefs(pushWhole, refRows);
|
|
469
473
|
const outbox = yield* decodeOutbox([headRows, cursorRows]);
|
|
@@ -498,7 +502,7 @@ const finalRead = /* @__PURE__ */ Effect.fnUntraced(function* (store, repo, fenc
|
|
|
498
502
|
tips: /* @__PURE__ */ new Map(),
|
|
499
503
|
revoked: revoked !== void 0
|
|
500
504
|
};
|
|
501
|
-
const stats = repoStats(record, refs.size, packs, times);
|
|
505
|
+
const stats = repoStats(record, refs.size, packs, times, yield* readyBytesOf(readyRows));
|
|
502
506
|
const [indexRow] = indexRows;
|
|
503
507
|
return {
|
|
504
508
|
read,
|
|
@@ -521,11 +525,11 @@ const settingsOf = (record) => ({
|
|
|
521
525
|
public: record.public,
|
|
522
526
|
defaultBranch: record.defaultBranch
|
|
523
527
|
});
|
|
524
|
-
/** The rules, then
|
|
528
|
+
/** The rules, the registrations' checks, then the hook groups, once, at the first read the push decides on. */
|
|
525
529
|
const runChecks = /* @__PURE__ */ Effect.fnUntraced(function* (checks, input, facts) {
|
|
526
530
|
const context = checking(input);
|
|
527
|
-
const ruled = yield*
|
|
528
|
-
const whole = yield*
|
|
531
|
+
const ruled = yield* registeredAfter(checks, input, yield* runPushRules(checks, input, context));
|
|
532
|
+
const whole = yield* runHookGroups(checks.groups?.() ?? [], context, {
|
|
529
533
|
atomic: input.atomic,
|
|
530
534
|
updates: ruled.updates,
|
|
531
535
|
refused: ruled.refused
|
|
@@ -580,12 +584,12 @@ const checkAll = /* @__PURE__ */ Effect.fnUntraced(function* (checks, request, i
|
|
|
580
584
|
};
|
|
581
585
|
});
|
|
582
586
|
/**
|
|
583
|
-
* The rules' answer, with the refs the
|
|
584
|
-
* then
|
|
587
|
+
* The rules' answer, with the refs the registered checks refuse among the rest: each in turn, by band
|
|
588
|
+
* then registration name, on the refs none before it refused, so a ref's first refusal is its answer.
|
|
585
589
|
*/
|
|
586
|
-
const
|
|
590
|
+
const registeredAfter = /* @__PURE__ */ Effect.fnUntraced(function* (checks, input, ruled) {
|
|
587
591
|
const refused = new Map(ruled.refused);
|
|
588
|
-
for (const { handler } of checks.
|
|
592
|
+
for (const { handler } of checks.registered?.() ?? []) {
|
|
589
593
|
const updates = ruled.updates.filter((update) => !refused.has(update.ref));
|
|
590
594
|
if (updates.length === 0) break;
|
|
591
595
|
for (const [ref, error] of yield* handler(input, updates)) if (!refused.has(ref)) refused.set(ref, error);
|
|
@@ -595,11 +599,11 @@ const claimedAfter = /* @__PURE__ */ Effect.fnUntraced(function* (checks, input,
|
|
|
595
599
|
refused
|
|
596
600
|
};
|
|
597
601
|
});
|
|
598
|
-
/** Whether a push has anything to check: a rule, a
|
|
602
|
+
/** Whether a push has anything to check: a rule, a registered check, or a hook group. */
|
|
599
603
|
const checksOf = /* @__PURE__ */ Effect.fnUntraced(function* (core) {
|
|
600
604
|
const { checks } = core;
|
|
601
605
|
if (checks === void 0) return void 0;
|
|
602
|
-
return (yield* pushRulesFor(checks)).length > 0 || checks.
|
|
606
|
+
return (yield* pushRulesFor(checks)).length > 0 || (checks.registered?.().length ?? 0) > 0 || (checks.groups?.().length ?? 0) > 0 ? checks : void 0;
|
|
603
607
|
});
|
|
604
608
|
/**
|
|
605
609
|
* The repo's objects with the push's own, for the built-in check: `objects` and `listed` read
|
|
@@ -703,8 +707,8 @@ const fetchedRefused = /* @__PURE__ */ Effect.fnUntraced(function* (kinds, reque
|
|
|
703
707
|
/**
|
|
704
708
|
* A commit the store refuses as too large, before it applies any write, for a `loose()` push whose
|
|
705
709
|
* objects are rows of it: its objects fit `loose()`'s limits, but not beside the push's own
|
|
706
|
-
* writes. It gets the hint those limits give. A refusal the push's own writes earn alone
|
|
707
|
-
*
|
|
710
|
+
* writes. It gets the hint those limits give. A refusal the push's own writes earn alone keeps
|
|
711
|
+
* the store's message: fewer objects wouldn't help it.
|
|
708
712
|
* So does `packs()`'s, whose small pushes are rows too: it's on `packs()` already. `loose()` is
|
|
709
713
|
* known by the quarantine it received, so a wrapper that passes it on, as Git's HTTP does, keeps it.
|
|
710
714
|
*/
|
|
@@ -787,6 +791,7 @@ const pushOf = (access, id, moved, request) => {
|
|
|
787
791
|
if (slice !== void 0) push.slice = slice;
|
|
788
792
|
const options = request.pushOptions ?? [];
|
|
789
793
|
if (options.length > 0) push.options = options;
|
|
794
|
+
if (request.onBehalfOf === true) push.onBehalfOf = true;
|
|
790
795
|
return push;
|
|
791
796
|
};
|
|
792
797
|
/**
|
|
@@ -801,32 +806,6 @@ const movedKinds = (updates, moved) => {
|
|
|
801
806
|
}));
|
|
802
807
|
};
|
|
803
808
|
/**
|
|
804
|
-
* What a push's commit saves for `hooks.postReceive`, when the host passed one: the push, with
|
|
805
|
-
* the refs it moved and their kinds, at the version the commit makes, and the repo's
|
|
806
|
-
* `git.post-receive` row. Its ID is the commit's own.
|
|
807
|
-
*/
|
|
808
|
-
const savedPush = (checks, push) => {
|
|
809
|
-
const jobRow = checks?.postReceiveJobRow;
|
|
810
|
-
if (jobRow === void 0 || push.moved.length === 0) return {
|
|
811
|
-
put: [],
|
|
812
|
-
jobs: []
|
|
813
|
-
};
|
|
814
|
-
const updates = movedKinds(push.updates, push.moved);
|
|
815
|
-
const { pushOptions, source } = push.request;
|
|
816
|
-
const saved = {
|
|
817
|
-
pushId: push.id,
|
|
818
|
-
repo: push.name,
|
|
819
|
-
caller: push.caller,
|
|
820
|
-
source,
|
|
821
|
-
updates
|
|
822
|
-
};
|
|
823
|
-
if (pushOptions !== void 0) saved.pushOptions = pushOptions;
|
|
824
|
-
return {
|
|
825
|
-
put: [savedPushRow(push.version, saved)],
|
|
826
|
-
jobs: [jobRow()]
|
|
827
|
-
};
|
|
828
|
-
};
|
|
829
|
-
/**
|
|
830
809
|
* The pack a push's own receive put under its `quarantine` row: none for a push with no pack, one
|
|
831
810
|
* of rows alone, or a caller's `received`, which stays its caller's to end.
|
|
832
811
|
*/
|
|
@@ -841,11 +820,13 @@ const lists = (body, pack) => body.delete.some((key) => key.collection === objec
|
|
|
841
820
|
* The push decide's loop past its first read, onto `listed`, keeping its answer under `key`:
|
|
842
821
|
* the pack received into its quarantine; each edit's kind from the objects; then a read of the
|
|
843
822
|
* refs, the push's `quarantine` row and the caller's fence; a held receipt's answer; the rules and
|
|
844
|
-
*
|
|
845
|
-
* version, with the ref moves, the receipt
|
|
846
|
-
* `answers` says what the call answers and keeps.
|
|
823
|
+
* the hook groups, for a write that moves a ref; the pure decide, and one commit at that read's
|
|
824
|
+
* version, with the ref moves, the receipt and the events.
|
|
825
|
+
* `answers` says what the call answers and keeps. `checking`: the rules, the hook and the decide
|
|
826
|
+
* only, refused as the commit would be, its `writes` or none, and answered before it, for
|
|
827
|
+
* `checkPush`: nothing before that point writes, reserves or enqueues, with no pack.
|
|
847
828
|
*/
|
|
848
|
-
const pushOnto = (request, { listed, defaultBranch, mark, repo: checkedRepo, view, views }, key, answers) => Effect.scoped(Effect.gen(function* () {
|
|
829
|
+
const pushOnto = (request, { listed, defaultBranch, mark, repo: checkedRepo, view, views }, key, answers, checking = false) => Effect.scoped(Effect.gen(function* () {
|
|
849
830
|
const core = yield* CoreParts;
|
|
850
831
|
const { objects: sealed } = yield* ObjectsParts;
|
|
851
832
|
const authorize = yield* Authorize;
|
|
@@ -978,7 +959,8 @@ const pushOnto = (request, { listed, defaultBranch, mark, repo: checkedRepo, vie
|
|
|
978
959
|
const own = updates.filter((update) => gitsOwnMove(hidden, request.as, update.ref));
|
|
979
960
|
const outside = updates.filter((update) => !gitsOwnMove(hidden, request.as, update.ref));
|
|
980
961
|
const checks = outside.length === 0 ? void 0 : yield* checksOf(core);
|
|
981
|
-
const branches = request.source === "queue" ? [] : outside.map((update) => update.ref).filter((ref) => ref.startsWith("refs/heads/"));
|
|
962
|
+
const branches = request.source === "queue" ? [] : outside.map((update) => update.ref).filter((ref) => ref.startsWith("refs/heads/") && isRefName(ref));
|
|
963
|
+
const touched = updates.map(({ ref }) => ref).filter(isRefName);
|
|
982
964
|
const scope = yield* callScope;
|
|
983
965
|
const reader = readerOf(pushedObjects, pushedListed, scope);
|
|
984
966
|
const batch = batchOf(pushedObjects, pushedListed, scope);
|
|
@@ -989,7 +971,6 @@ const pushOnto = (request, { listed, defaultBranch, mark, repo: checkedRepo, vie
|
|
|
989
971
|
repo,
|
|
990
972
|
source: request.source,
|
|
991
973
|
atomic: request.atomic,
|
|
992
|
-
...call,
|
|
993
974
|
push: {
|
|
994
975
|
bytes: received?.bytes ?? 0,
|
|
995
976
|
objects: received?.objects ?? 0
|
|
@@ -1025,7 +1006,7 @@ const pushOnto = (request, { listed, defaultBranch, mark, repo: checkedRepo, vie
|
|
|
1025
1006
|
let checked;
|
|
1026
1007
|
for (let tries = 0; tries < 10; tries += 1) {
|
|
1027
1008
|
const at = yield* Clock$1.currentTimeMillis;
|
|
1028
|
-
const decide = yield* finalRead(store, target, fence, received, key, mark, branches,
|
|
1009
|
+
const decide = yield* finalRead(store, target, fence, received, key, mark, branches, touched, request.guard, request.writes?.unchanged);
|
|
1029
1010
|
const { read, receipt, outbox, record, mirrored, facts, stats, times, queued, reserved, indexRow } = decide;
|
|
1030
1011
|
const indexed = SealedObjects.whole(sealed, pushWhole).index?.status(indexRow, at, listedIds(decide.at, received?.change));
|
|
1031
1012
|
if (receipt !== void 0) return yield* answers.held(receipt);
|
|
@@ -1093,11 +1074,12 @@ const pushOnto = (request, { listed, defaultBranch, mark, repo: checkedRepo, vie
|
|
|
1093
1074
|
const upkept = clears && jobs.length === 0 ? [core.repackJobRow()] : jobs;
|
|
1094
1075
|
const planned = yield* planOf(decision, read.version, upkept);
|
|
1095
1076
|
const { change } = planned;
|
|
1096
|
-
const refusal = writes === void 0 ? void 0 : refusalOf(planned.answer);
|
|
1077
|
+
const refusal = writes === void 0 && !checking ? void 0 : refusalOf(planned.answer);
|
|
1097
1078
|
if (refusal !== void 0) return yield* Effect.fail(refusal);
|
|
1098
1079
|
const movedRefs = new Set(planned.moved.map((move) => move.ref));
|
|
1099
1080
|
const liftedOnMoves = [...checked?.bypassed ?? none].filter(([ref]) => movedRefs.has(ref));
|
|
1100
1081
|
const answer = yield* answers.answer(planned.answer, forced, new Map(liftedOnMoves));
|
|
1082
|
+
if (checking) return answer;
|
|
1101
1083
|
const also = planned.answer.updates.some((update) => update.kind === "rejected") || request.also === void 0 ? void 0 : request.also(yield* Clock$1.currentTimeMillis, received);
|
|
1102
1084
|
const alsoWrites = (also?.put.length ?? 0) + (also?.delete?.length ?? 0);
|
|
1103
1085
|
const quiet = key === void 0 && alsoWrites === 0 && writes === void 0;
|
|
@@ -1137,27 +1119,21 @@ const pushOnto = (request, { listed, defaultBranch, mark, repo: checkedRepo, vie
|
|
|
1137
1119
|
});
|
|
1138
1120
|
const final = answers.committed?.(answer, appended.head.next - 1) ?? answer;
|
|
1139
1121
|
const kept = receiptWrites(key, answers.kept(final), core.repackJobRow);
|
|
1140
|
-
const saved = savedPush(core.checks, {
|
|
1141
|
-
id,
|
|
1142
|
-
version: planned.expect + 1,
|
|
1143
|
-
caller,
|
|
1144
|
-
name,
|
|
1145
|
-
request,
|
|
1146
|
-
updates: decided.updates,
|
|
1147
|
-
moved: shown
|
|
1148
|
-
});
|
|
1149
1122
|
const woken = shown.filter((move) => queued.has(move.ref)).map((move) => advanceRow(move.ref));
|
|
1150
1123
|
const pushed = pushedRows(core.access, shown, times, at);
|
|
1124
|
+
const moved = received === void 0 || !planned.moves ? noRows : yield* rowsAtCommit(store, listed.repo, received.change, read.version);
|
|
1125
|
+
if (moved === void 0) continue;
|
|
1126
|
+
const loose = looseRows(times.loose, moved);
|
|
1151
1127
|
const body = {
|
|
1152
1128
|
id,
|
|
1153
1129
|
expect: planned.expect,
|
|
1154
1130
|
put: [
|
|
1155
1131
|
...change.put,
|
|
1156
1132
|
...pushed,
|
|
1133
|
+
...loose,
|
|
1157
1134
|
...kept.put,
|
|
1158
1135
|
...also?.put ?? [],
|
|
1159
1136
|
...appended.put,
|
|
1160
|
-
...saved.put,
|
|
1161
1137
|
...writes?.put ?? []
|
|
1162
1138
|
],
|
|
1163
1139
|
delete: [
|
|
@@ -1169,7 +1145,6 @@ const pushOnto = (request, { listed, defaultBranch, mark, repo: checkedRepo, vie
|
|
|
1169
1145
|
jobs: withJobs([
|
|
1170
1146
|
...planned.jobs,
|
|
1171
1147
|
...appended.jobs,
|
|
1172
|
-
...saved.jobs,
|
|
1173
1148
|
...mirrorJobs(core, planned.moved, mirrored),
|
|
1174
1149
|
...writes?.jobs ?? [],
|
|
1175
1150
|
...woken,
|
|
@@ -1185,6 +1160,10 @@ const pushOnto = (request, { listed, defaultBranch, mark, repo: checkedRepo, vie
|
|
|
1185
1160
|
moved: planned.moved.length
|
|
1186
1161
|
}, core.refIndex);
|
|
1187
1162
|
if (past !== void 0) return yield* Effect.fail(past);
|
|
1163
|
+
yield* Effect.try({
|
|
1164
|
+
try: () => checkWrites(body),
|
|
1165
|
+
catch: (cause) => fromInfra(cause)
|
|
1166
|
+
}).pipe(Effect.mapError(commitTooLarge(received, body)));
|
|
1188
1167
|
if ((yield* storeCall(() => store.commit(scope, body)).pipe(Effect.mapError(commitTooLarge(received, body)))).ok) {
|
|
1189
1168
|
listing = ownedPack !== void 0 && lists(body, ownedPack);
|
|
1190
1169
|
return final;
|
|
@@ -1206,14 +1185,23 @@ const operationOf = ({ repo, edits }) => edits.length === 0 ? {
|
|
|
1206
1185
|
* reads and decides again. A push cut before its commit leaves an unlisted pack for clean-up, and
|
|
1207
1186
|
* no ref moved.
|
|
1208
1187
|
*/
|
|
1209
|
-
const pushWith =
|
|
1188
|
+
const pushWith = (request, answers, key) => pushThrough(request, answers, key, false);
|
|
1189
|
+
/** `pushWith`, or with `checking`, its checks alone, as `pushOnto` says. */
|
|
1190
|
+
const pushThrough = /* @__PURE__ */ Effect.fnUntraced(function* (request, answers, key, checking) {
|
|
1210
1191
|
const operation = operationOf(request);
|
|
1211
1192
|
const resolved = yield* firstRead(request.caller, operation, request.internalId).pipe(Effect.tapError((error) => retriedCodes.has(error.code) ? Effect.void : refuseQueued(request, [error], "access")));
|
|
1212
1193
|
const opened = yield* listedFor(request, operation, resolved);
|
|
1213
|
-
return yield* pushOnto(request, opened, key, answers);
|
|
1194
|
+
return yield* pushOnto(request, opened, key, answers, checking);
|
|
1214
1195
|
});
|
|
1215
1196
|
/** A push or an unkeyed `refs.update`, answering the decide's ref answer. */
|
|
1216
1197
|
const push = (request) => pushWith(request, refsAnswers);
|
|
1198
|
+
/**
|
|
1199
|
+
* What `push` of `request` would answer, with nothing written, reserved or enqueued: its reads,
|
|
1200
|
+
* `authorize`, its rules and the hook, and the decide, failing as its commit would, a queue's
|
|
1201
|
+
* callers told as its publish tells them. A topic asks it of each member's publish before its
|
|
1202
|
+
* decision (Q1159). For a request with no pack; re-exported from no index.
|
|
1203
|
+
*/
|
|
1204
|
+
const checkPush = (request) => request.pack === void 0 ? pushThrough(request, refsAnswers, void 0, true) : fail("INTERNAL", "A push is checked with no pack");
|
|
1217
1205
|
/** A `git push`, as `push`, with the lines Git prints for the rules `authorize` lifted. */
|
|
1218
1206
|
const gitPush = (request) => pushWith(request, gitAnswers);
|
|
1219
1207
|
/** A ref a forced fetch moved past its diverged tip, answered `force`; the rest as they are. */
|
|
@@ -1248,4 +1236,4 @@ const keyedPushWith = /* @__PURE__ */ Effect.fnUntraced(function* (request, answ
|
|
|
1248
1236
|
});
|
|
1249
1237
|
/** `keyedPushWith` for `refs.update`, answering the decide's ref answer. */
|
|
1250
1238
|
const keyedPush = (request, keyed) => keyedPushWith(request, refsAnswers, keyed);
|
|
1251
|
-
export { buildFence, gitPush, isQueueMoved, keyedPush, keyedPushWith, push, pushFetched, pushWith, retriedCodes };
|
|
1239
|
+
export { buildFence, checkPush, gitPush, isQueueMoved, keyedPush, keyedPushWith, push, pushFetched, pushWith, retriedCodes };
|
package/dist/core/receipts.d.mts
CHANGED
|
@@ -3,6 +3,6 @@ import "../contracts/refs.mjs";
|
|
|
3
3
|
import "../contracts/repos.mjs";
|
|
4
4
|
import "../contracts/result.mjs";
|
|
5
5
|
import "../store/records.mjs";
|
|
6
|
-
import
|
|
6
|
+
import "effect/Effect";
|
|
7
7
|
import "effect/Schema";
|
|
8
|
-
import "
|
|
8
|
+
import { JobInput, Key, Moment, Read, Row } from "@ref0/infra";
|