@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/lfs/objects.mjs
CHANGED
|
@@ -1,54 +1,52 @@
|
|
|
1
1
|
import { Sha256 } from "../protocol/bytes/sha256.mjs";
|
|
2
|
-
import { contended } from "../core/access.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { contended, openFor } from "../core/access.mjs";
|
|
3
|
+
import { seenIn } from "../core/objects/reading.mjs";
|
|
4
|
+
import { checkRead, readRefusal } from "../core/rules/fetch.mjs";
|
|
5
|
+
import { utf8 } from "../protocol/bytes/text.mjs";
|
|
6
|
+
import { objectId } from "../protocol/objects/object.mjs";
|
|
7
|
+
import { bestEffort, decodeRow } from "../store/errors.mjs";
|
|
6
8
|
import { randomText } from "../store/random.mjs";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { promisePut, promiseStream } from "../storage/promise-calls.mjs";
|
|
11
|
-
import { isLfsOid } from "../protocol/objects/lfs-pointer.mjs";
|
|
12
|
-
import { ListedRow, UploadRow, largestObject, linkLife, listedKey, listedRead, objectKey, stagingId, stagingKey, stagingRead, streamMost, uploadGrace, uploadKey, uploadRead } from "./rows.mjs";
|
|
9
|
+
import { bucketCall, bucketDo, bucketFailed, bucketStream } from "../storage/calls.mjs";
|
|
10
|
+
import { isLfsOid, lfsPointerText } from "../protocol/objects/lfs-pointer.mjs";
|
|
11
|
+
import { ListedRow, UploadRow, largestObject, lfsCollections, linkLife, listedKey, listedRead, objectKey, stagingId, stagingKey, stagingRead, streamMost, uploadGrace, uploadKey, uploadRead } from "./rows.mjs";
|
|
13
12
|
import { BatchRequest, VerifyRequest, batchMost, bodyOf, lfsAnswer } from "./wire.mjs";
|
|
14
|
-
import { fail, gitError } from "../contracts/result.mjs";
|
|
15
|
-
import * as Effect from "effect/Effect";
|
|
13
|
+
import { fail, gitError, httpStatus } from "../contracts/result.mjs";
|
|
16
14
|
import * as Clock$1 from "effect/Clock";
|
|
15
|
+
import * as Effect from "effect/Effect";
|
|
16
|
+
import * as Option from "effect/Option";
|
|
17
|
+
import { Unavailable } from "@ref0/infra";
|
|
18
|
+
import * as Stream from "effect/Stream";
|
|
17
19
|
import * as DateTime from "effect/DateTime";
|
|
18
20
|
// src/lfs/objects.ts
|
|
19
|
-
/** A bucket's own LFS signing: links to read, and uploads it checks against their SHA-256. */
|
|
20
|
-
const signingOf = (bucket) => isSigned(bucket) ? bucket : void 0;
|
|
21
|
-
/** A bucket made with signing, as `r2()` given S3 credentials makes one, has all three. */
|
|
22
|
-
const isSigned = (bucket) => "url" in bucket && "putUrl" in bucket && "head" in bucket;
|
|
23
21
|
/**
|
|
24
22
|
* Each object's rows, read with the repo's record and the fence's rows at one version, the fence
|
|
25
23
|
* checked; `also`'s rows after them. A repo deleted since it opened is `NOT_FOUND`.
|
|
26
24
|
*/
|
|
27
|
-
const objectRows = /* @__PURE__ */ Effect.fnUntraced(function* (
|
|
25
|
+
const objectRows = /* @__PURE__ */ Effect.fnUntraced(function* (rows, caller, repo, oids, also = []) {
|
|
28
26
|
const own = oids.flatMap((oid) => [listedRead(oid), uploadRead(oid)]);
|
|
29
|
-
const { version, results } = yield*
|
|
30
|
-
const
|
|
27
|
+
const { version, results } = yield* rows.readFenced(caller, repo, [...own, ...also]);
|
|
28
|
+
const found = /* @__PURE__ */ new Map();
|
|
31
29
|
for (const [at, oid] of oids.entries()) {
|
|
32
30
|
const [listedRows = [], uploadRows = []] = results.slice(at * 2, at * 2 + 2);
|
|
33
|
-
const
|
|
34
|
-
if (listedRows[0] !== void 0)
|
|
35
|
-
if (uploadRows[0] !== void 0)
|
|
36
|
-
|
|
31
|
+
const one = {};
|
|
32
|
+
if (listedRows[0] !== void 0) one.listed = yield* decodeListed(listedRows[0], oid);
|
|
33
|
+
if (uploadRows[0] !== void 0) one.upload = yield* decodeUpload(uploadRows[0], oid);
|
|
34
|
+
found.set(oid, one);
|
|
37
35
|
}
|
|
38
36
|
return {
|
|
39
37
|
version,
|
|
40
|
-
rows,
|
|
38
|
+
rows: found,
|
|
41
39
|
also: results.slice(own.length)
|
|
42
40
|
};
|
|
43
41
|
});
|
|
44
42
|
const decodeListed = (row, oid) => decodeRow(ListedRow, row, `LFS object ${oid}`);
|
|
45
43
|
const decodeUpload = (row, oid) => decodeRow(UploadRow, row, `LFS object ${oid}'s upload`);
|
|
46
44
|
/** The repo's listed rows of `oids`, read in chunks. */
|
|
47
|
-
const listedOf = /* @__PURE__ */ Effect.fnUntraced(function* (
|
|
45
|
+
const listedOf = /* @__PURE__ */ Effect.fnUntraced(function* (rows, repo, oids) {
|
|
48
46
|
const listed = /* @__PURE__ */ new Map();
|
|
49
47
|
for (let at = 0; at < oids.length; at += 100) {
|
|
50
48
|
const chunk = oids.slice(at, at + 100);
|
|
51
|
-
const snapshot = yield*
|
|
49
|
+
const snapshot = yield* rows.read(repo, chunk.map(listedRead));
|
|
52
50
|
for (const [index, oid] of chunk.entries()) {
|
|
53
51
|
const row = snapshot.results[index]?.[0];
|
|
54
52
|
if (row !== void 0) listed.set(oid, yield* decodeListed(row, oid));
|
|
@@ -57,24 +55,64 @@ const listedOf = /* @__PURE__ */ Effect.fnUntraced(function* (store, repo, oids)
|
|
|
57
55
|
return listed;
|
|
58
56
|
});
|
|
59
57
|
/**
|
|
60
|
-
* The listed rows of `oids` a download from `repo` reads: its own, then,
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
58
|
+
* The listed rows of `oids` a download from `repo` reads: its own, then its source's, up the fork
|
|
59
|
+
* chain by internal ID for at most `forkReads` sources. The first listing wins, so a fork's own
|
|
60
|
+
* upload shadows its source's. Each source's rows of every one of `oids` are read, found sooner or
|
|
61
|
+
* not, so the reads made are the same whichever of them are listed, as `unseenOf` needs. A deleted
|
|
62
|
+
* source's rows are read too: its LFS rows and bytes stay while a fork's row names it, since
|
|
63
|
+
* `git.purge` waits on one.
|
|
64
64
|
*/
|
|
65
|
-
const chainListed = /* @__PURE__ */ Effect.fnUntraced(function* (
|
|
66
|
-
const listed = yield* listedOf(
|
|
65
|
+
const chainListed = /* @__PURE__ */ Effect.fnUntraced(function* (rows, repo, oids) {
|
|
66
|
+
const listed = yield* listedOf(rows, repo, oids);
|
|
67
|
+
if (oids.length === 0) return listed;
|
|
67
68
|
let from = repo;
|
|
68
69
|
for (let read = 0; read < 16; read += 1) {
|
|
69
|
-
const
|
|
70
|
-
if (missing.length === 0) break;
|
|
71
|
-
const source = (yield* readRecord(store, from)).record?.fork?.upstreamInternalId;
|
|
70
|
+
const source = yield* rows.source(from);
|
|
72
71
|
if (source === void 0) break;
|
|
73
|
-
for (const [oid, row] of yield* listedOf(
|
|
72
|
+
for (const [oid, row] of yield* listedOf(rows, source, oids)) if (!listed.has(oid)) listed.set(oid, row);
|
|
74
73
|
from = source;
|
|
75
74
|
}
|
|
76
75
|
return listed;
|
|
77
76
|
});
|
|
77
|
+
/**
|
|
78
|
+
* Which of `listed`'s objects `caller` mayn't know `repo` lists. A caller whose view of it is
|
|
79
|
+
* narrowed (`RepoView.narrowed`), as under `access` one who doesn't read every pattern is, knows of
|
|
80
|
+
* a listed object only when a ref it sees reaches its pointer as git-lfs writes it
|
|
81
|
+
* (`lfsPointerText`), so an object only a hidden ref's tree points at answers as one never
|
|
82
|
+
* uploaded. So does one only a pointer of another text names, with an extension or blank lines.
|
|
83
|
+
* The view is asked of a pointer for each of `oids`, listed or not, by the listed size or else 0,
|
|
84
|
+
* so the calls it makes are the same whichever of them are listed. Any other caller knows of every
|
|
85
|
+
* one: its view answers that it isn't narrowed, and nothing more is read.
|
|
86
|
+
*/
|
|
87
|
+
const unseenOf = /* @__PURE__ */ Effect.fnUntraced(function* (caller, repo, oids, listed) {
|
|
88
|
+
const unseen = /* @__PURE__ */ new Set();
|
|
89
|
+
const pointers = /* @__PURE__ */ new Map();
|
|
90
|
+
for (const oid of new Set(oids)) {
|
|
91
|
+
const text = lfsPointerText({
|
|
92
|
+
oid,
|
|
93
|
+
size: listed.get(oid)?.size ?? 0
|
|
94
|
+
});
|
|
95
|
+
pointers.set(yield* objectId({
|
|
96
|
+
type: "blob",
|
|
97
|
+
bytes: utf8(text)
|
|
98
|
+
}), oid);
|
|
99
|
+
}
|
|
100
|
+
const seen = yield* seenIn(caller, repo, [...pointers.keys()]);
|
|
101
|
+
if (seen === void 0) return unseen;
|
|
102
|
+
for (const [pointer, oid] of pointers) if (listed.has(oid) && !seen.has(pointer)) unseen.add(oid);
|
|
103
|
+
return unseen;
|
|
104
|
+
});
|
|
105
|
+
/** `listed`, less what `caller` mayn't know of, asked for each of `oids`, as `unseenOf` says. */
|
|
106
|
+
const seenListed = /* @__PURE__ */ Effect.fnUntraced(function* (caller, repo, oids, listed) {
|
|
107
|
+
const unseen = yield* unseenOf(caller, repo, oids, listed);
|
|
108
|
+
return unseen.size === 0 ? listed : new Map([...listed].filter(([oid]) => !unseen.has(oid)));
|
|
109
|
+
});
|
|
110
|
+
/** Which of `rows`' objects `caller` mayn't know are listed, asked for each of `oids`, as `unseenOf` says. */
|
|
111
|
+
const unseenRows = (caller, repo, oids, rows) => {
|
|
112
|
+
const listed = /* @__PURE__ */ new Map();
|
|
113
|
+
for (const [oid, { listed: row }] of rows) if (row !== void 0) listed.set(oid, row);
|
|
114
|
+
return unseenOf(caller, repo, oids, listed);
|
|
115
|
+
};
|
|
78
116
|
const isoOf = (at) => DateTime.formatIso(DateTime.makeUnsafe(at));
|
|
79
117
|
/** An action back to this server, sending the request's own credentials. */
|
|
80
118
|
const ownAction = (call, path, expiresAt) => {
|
|
@@ -113,9 +151,32 @@ const batch = /* @__PURE__ */ Effect.fnUntraced(function* (parts, call) {
|
|
|
113
151
|
});
|
|
114
152
|
});
|
|
115
153
|
const validSize = (size) => Number.isSafeInteger(size) && size >= 0 && size <= largestObject;
|
|
154
|
+
/**
|
|
155
|
+
* The host's fetch rules' refusals of `listed`'s objects, each listed object the caller knows of
|
|
156
|
+
* asked once, before any link is signed. A host's failure fails the whole batch.
|
|
157
|
+
*/
|
|
158
|
+
const refusedOf = /* @__PURE__ */ Effect.fnUntraced(function* (call, listed) {
|
|
159
|
+
const refused = /* @__PURE__ */ new Map();
|
|
160
|
+
for (const [oid, { size }] of listed) {
|
|
161
|
+
const target = {
|
|
162
|
+
kind: "lfs",
|
|
163
|
+
oid,
|
|
164
|
+
size
|
|
165
|
+
};
|
|
166
|
+
const refusal = yield* readRefusal(call.repo, {
|
|
167
|
+
caller: call.caller,
|
|
168
|
+
target,
|
|
169
|
+
request: call.request
|
|
170
|
+
});
|
|
171
|
+
if (refusal !== void 0) refused.set(oid, refusal);
|
|
172
|
+
}
|
|
173
|
+
return refused;
|
|
174
|
+
});
|
|
116
175
|
const downloads = /* @__PURE__ */ Effect.fnUntraced(function* (parts, call, repo, objects) {
|
|
117
176
|
const oids = objects.map(({ oid }) => oid);
|
|
118
|
-
const
|
|
177
|
+
const chained = yield* chainListed(parts.rows, repo.internalId, oids);
|
|
178
|
+
const listed = yield* seenListed(call.caller, repo, oids, chained);
|
|
179
|
+
const refused = yield* refusedOf(call, listed);
|
|
119
180
|
const expiresAt = (yield* Clock$1.currentTimeMillis) + linkLife;
|
|
120
181
|
const answers = /* @__PURE__ */ new Map();
|
|
121
182
|
for (const { oid, size } of objects) {
|
|
@@ -124,13 +185,15 @@ const downloads = /* @__PURE__ */ Effect.fnUntraced(function* (parts, call, repo
|
|
|
124
185
|
answers.set(oid, objectError(oid, size, 404, "Object does not exist"));
|
|
125
186
|
continue;
|
|
126
187
|
}
|
|
188
|
+
const refusal = refused.get(oid);
|
|
189
|
+
if (refusal !== void 0) {
|
|
190
|
+
answers.set(oid, objectError(oid, size, httpStatus[refusal.code], refusal.message));
|
|
191
|
+
continue;
|
|
192
|
+
}
|
|
127
193
|
const key = row.key;
|
|
128
194
|
const signed = parts.signed;
|
|
129
195
|
const download = signed === void 0 ? ownAction(call, `objects/${oid}`, expiresAt) : {
|
|
130
|
-
href: yield* bucketCall(
|
|
131
|
-
expiresAt,
|
|
132
|
-
signal
|
|
133
|
-
})),
|
|
196
|
+
href: yield* bucketCall(signed.url(key, { expiresAt })),
|
|
134
197
|
expires_at: isoOf(expiresAt)
|
|
135
198
|
};
|
|
136
199
|
answers.set(oid, {
|
|
@@ -149,15 +212,14 @@ const downloads = /* @__PURE__ */ Effect.fnUntraced(function* (parts, call, repo
|
|
|
149
212
|
* so its links all write one key; a new row gets a new one.
|
|
150
213
|
*/
|
|
151
214
|
const uploads = /* @__PURE__ */ Effect.fnUntraced(function* (parts, call, repo, objects) {
|
|
152
|
-
const { core } = parts;
|
|
153
|
-
const fence = fenceFor(core, call.caller, repo);
|
|
154
215
|
const oids = objects.map(({ oid }) => oid);
|
|
155
216
|
for (let tries = 0; tries < 5; tries += 1) {
|
|
156
217
|
const at = yield* Clock$1.currentTimeMillis;
|
|
157
|
-
const read = yield* objectRows(
|
|
218
|
+
const read = yield* objectRows(parts.rows, call.caller, repo, oids);
|
|
219
|
+
const unseen = yield* unseenRows(call.caller, repo, oids, read.rows);
|
|
158
220
|
const expiresAt = at + linkLife;
|
|
159
221
|
const removeAt = expiresAt + uploadGrace;
|
|
160
|
-
const put = objects.filter(({ oid }) => read.rows.get(oid)?.listed === void 0).map(({ oid, size }) => {
|
|
222
|
+
const put = objects.filter(({ oid }) => read.rows.get(oid)?.listed === void 0 || unseen.has(oid)).map(({ oid, size }) => {
|
|
161
223
|
const before = read.rows.get(oid)?.upload;
|
|
162
224
|
const value = {
|
|
163
225
|
size,
|
|
@@ -171,12 +233,10 @@ const uploads = /* @__PURE__ */ Effect.fnUntraced(function* (parts, call, repo,
|
|
|
171
233
|
};
|
|
172
234
|
});
|
|
173
235
|
if (put.length > 0) {
|
|
174
|
-
if (!(yield*
|
|
175
|
-
id: newChangeId(),
|
|
176
|
-
expect: read.version,
|
|
236
|
+
if (!(yield* parts.rows.commit(repo.internalId, read.version, {
|
|
177
237
|
put,
|
|
178
|
-
|
|
179
|
-
}))
|
|
238
|
+
wake: removeAt
|
|
239
|
+
})).ok) continue;
|
|
180
240
|
}
|
|
181
241
|
const answers = /* @__PURE__ */ new Map();
|
|
182
242
|
const generations = new Map(put.map((row) => [row.id, row.value.generation]));
|
|
@@ -203,10 +263,9 @@ const uploadActions = /* @__PURE__ */ Effect.fnUntraced(function* (parts, call,
|
|
|
203
263
|
const signed = parts.signed;
|
|
204
264
|
if (signed === void 0) return { upload: ownAction(call, `objects/${oid}`, expiresAt) };
|
|
205
265
|
return {
|
|
206
|
-
upload: yield* bucketCall(
|
|
266
|
+
upload: yield* bucketCall(signed.putUrl(key, {
|
|
207
267
|
sha256: oid,
|
|
208
|
-
expiresAt
|
|
209
|
-
signal
|
|
268
|
+
expiresAt
|
|
210
269
|
})),
|
|
211
270
|
verify: ownAction(call, "objects/verify", expiresAt)
|
|
212
271
|
};
|
|
@@ -220,20 +279,19 @@ const uploadActions = /* @__PURE__ */ Effect.fnUntraced(function* (parts, call,
|
|
|
220
279
|
const verify = /* @__PURE__ */ Effect.fnUntraced(function* (parts, call) {
|
|
221
280
|
const { oid, size } = yield* bodyOf(call.request, VerifyRequest);
|
|
222
281
|
if (!isLfsOid(oid)) return yield* fail("INVALID_ARGUMENT", "An oid is a SHA-256, as 64 lowercase hex digits");
|
|
223
|
-
const {
|
|
282
|
+
const { rows: registered, signed } = parts;
|
|
224
283
|
const repo = yield* openFor(call.caller, call.repo, true);
|
|
225
|
-
const fence = fenceFor(core, call.caller, repo);
|
|
226
284
|
for (let tries = 0; tries < 5; tries += 1) {
|
|
227
|
-
const read = yield* objectRows(
|
|
285
|
+
const read = yield* objectRows(registered, call.caller, repo, [oid]);
|
|
228
286
|
const rows = read.rows.get(oid);
|
|
229
|
-
|
|
287
|
+
const unseen = (yield* unseenRows(call.caller, repo, [oid], read.rows)).has(oid);
|
|
288
|
+
if (rows?.listed !== void 0 && !unseen) return lfsAnswer(200, { message: "Verified" });
|
|
230
289
|
const key = rows?.upload === void 0 ? void 0 : objectKey(repo.internalId, oid, rows.upload.generation);
|
|
231
|
-
const stored = signed === void 0 || key === void 0 ? void 0 : yield* bucketCall((
|
|
290
|
+
const stored = signed === void 0 || key === void 0 ? void 0 : yield* bucketCall(Effect.map(signed.head(key), Option.getOrUndefined));
|
|
232
291
|
if (stored?.sha256 !== oid) return yield* fail("FAILED_PRECONDITION", "The bucket holds no bytes for this object", { hint: "Upload it again" });
|
|
233
292
|
if (stored.size !== size) return yield* fail("INVALID_ARGUMENT", `This object is ${stored.size} bytes, not ${size}`);
|
|
234
|
-
if (
|
|
235
|
-
|
|
236
|
-
expect: read.version,
|
|
293
|
+
if (unseen) return lfsAnswer(200, { message: "Verified" });
|
|
294
|
+
if ((yield* registered.commit(repo.internalId, read.version, {
|
|
237
295
|
put: [{
|
|
238
296
|
...listedKey(oid),
|
|
239
297
|
value: {
|
|
@@ -242,7 +300,7 @@ const verify = /* @__PURE__ */ Effect.fnUntraced(function* (parts, call) {
|
|
|
242
300
|
}
|
|
243
301
|
}],
|
|
244
302
|
delete: [uploadKey(oid)]
|
|
245
|
-
}))
|
|
303
|
+
})).ok) return lfsAnswer(200, { message: "Verified" });
|
|
246
304
|
}
|
|
247
305
|
return yield* contended();
|
|
248
306
|
});
|
|
@@ -253,44 +311,72 @@ const verify = /* @__PURE__ */ Effect.fnUntraced(function* (parts, call) {
|
|
|
253
311
|
*/
|
|
254
312
|
const receive = /* @__PURE__ */ Effect.fnUntraced(function* (parts, call, oid) {
|
|
255
313
|
if (!isLfsOid(oid)) return yield* fail("INVALID_ARGUMENT", "An oid is a SHA-256, as 64 lowercase hex digits");
|
|
256
|
-
const {
|
|
314
|
+
const { rows: registered, bucket } = parts;
|
|
257
315
|
const repo = yield* openFor(call.caller, call.repo, true);
|
|
258
|
-
const fence = fenceFor(core, call.caller, repo);
|
|
259
316
|
const started = yield* Clock$1.currentTimeMillis;
|
|
260
|
-
const
|
|
261
|
-
|
|
317
|
+
const read = yield* objectRows(registered, call.caller, repo, [oid]);
|
|
318
|
+
const rows = read.rows.get(oid);
|
|
319
|
+
const unseen = (yield* unseenRows(call.caller, repo, [oid], read.rows)).has(oid);
|
|
320
|
+
if (rows?.listed !== void 0 && !unseen) return yield* answered(call.request);
|
|
262
321
|
const upload = rows?.upload;
|
|
263
322
|
if (upload === void 0 || upload.expiresAt < started) return yield* fail("FAILED_PRECONDITION", "No upload link for this object is live", { hint: "Ask the batch API again" });
|
|
264
323
|
const id = randomText(16);
|
|
265
324
|
const key = stagingKey(repo.internalId, id);
|
|
266
325
|
const staged = stagingId(started + uploadGrace, id);
|
|
267
|
-
yield*
|
|
326
|
+
yield* registered.add(repo.internalId, {
|
|
268
327
|
put: [{
|
|
269
|
-
collection:
|
|
328
|
+
collection: lfsCollections.staging,
|
|
270
329
|
id: staged,
|
|
271
330
|
value: {
|
|
272
331
|
key,
|
|
273
332
|
removeAt: started + uploadGrace
|
|
274
333
|
}
|
|
275
334
|
}],
|
|
276
|
-
|
|
277
|
-
})
|
|
335
|
+
wake: started + uploadGrace
|
|
336
|
+
});
|
|
278
337
|
const hashed = hashing(call.request.body, upload.size);
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
338
|
+
const body = Stream.fromReadableStream({
|
|
339
|
+
evaluate: () => hashed.stream,
|
|
340
|
+
onError: (cause) => new Unavailable({
|
|
341
|
+
message: bucketFailed,
|
|
342
|
+
cause
|
|
343
|
+
})
|
|
344
|
+
});
|
|
345
|
+
yield* Effect.uninterruptible(bucketDo(bucket.put(key, body, { size: upload.size }))).pipe(Effect.mapError((error) => hashed.past() ? pastSize(upload.size) : error));
|
|
346
|
+
if (hashed.sha256() !== oid) {
|
|
347
|
+
yield* dropStaged(parts, repo.internalId, key, staged);
|
|
348
|
+
return yield* fail("INVALID_ARGUMENT", "The bytes' SHA-256 isn't the oid");
|
|
349
|
+
}
|
|
350
|
+
return yield* listStaged(registered, call.caller, repo, {
|
|
285
351
|
oid,
|
|
286
352
|
size: upload.size,
|
|
287
353
|
key,
|
|
288
354
|
staged,
|
|
289
|
-
deadline: started + streamMost
|
|
355
|
+
deadline: started + streamMost,
|
|
356
|
+
unseen
|
|
290
357
|
});
|
|
291
358
|
});
|
|
359
|
+
/**
|
|
360
|
+
* Deletes refused bytes at once, then their staging row at the version it's read at (#1940). A
|
|
361
|
+
* failure of either leaves the row, whose wake has upkeep delete the bytes at its removeAt, and is
|
|
362
|
+
* no reason to answer it in place of the refusal.
|
|
363
|
+
*/
|
|
364
|
+
const dropStaged = /* @__PURE__ */ Effect.fnUntraced(function* (parts, repo, key, staged) {
|
|
365
|
+
const row = {
|
|
366
|
+
collection: lfsCollections.staging,
|
|
367
|
+
id: staged
|
|
368
|
+
};
|
|
369
|
+
yield* bestEffort(Effect.gen(function* () {
|
|
370
|
+
yield* bucketDo(parts.bucket.remove(key));
|
|
371
|
+
const read = yield* parts.rows.read(repo, [row]);
|
|
372
|
+
yield* parts.rows.commit(repo, read.version, { delete: [row] });
|
|
373
|
+
}));
|
|
374
|
+
});
|
|
292
375
|
const pastSize = (size) => gitError("INVALID_ARGUMENT", `The bytes run past the ${size} the batch named`);
|
|
293
|
-
/**
|
|
376
|
+
/**
|
|
377
|
+
* An answer to a request whose body isn't needed: the body is let go first, and a cancel that
|
|
378
|
+
* rejects is no reason to fail an upload that's done.
|
|
379
|
+
*/
|
|
294
380
|
const answered = (request) => Effect.promise(async () => {
|
|
295
381
|
await request.body?.cancel();
|
|
296
382
|
return lfsAnswer(200, { message: "Already uploaded" });
|
|
@@ -312,15 +398,12 @@ const hashing = (body, most) => {
|
|
|
312
398
|
};
|
|
313
399
|
};
|
|
314
400
|
/** Lists a Worker upload's bytes at their staging key, in the commit that drops its staging row. */
|
|
315
|
-
const listStaged = /* @__PURE__ */ Effect.fnUntraced(function* (
|
|
316
|
-
const { core } = parts;
|
|
401
|
+
const listStaged = /* @__PURE__ */ Effect.fnUntraced(function* (registered, caller, repo, staged) {
|
|
317
402
|
for (let tries = 0; tries < 5; tries += 1) {
|
|
318
|
-
const read = yield* objectRows(
|
|
319
|
-
if (read.rows.get(staged.oid)?.listed !== void 0) return lfsAnswer(200, { message: "Already uploaded" });
|
|
403
|
+
const read = yield* objectRows(registered, caller, repo, [staged.oid], [stagingRead(staged.staged)]);
|
|
404
|
+
if (read.rows.get(staged.oid)?.listed !== void 0) return lfsAnswer(200, { message: staged.unseen ? "Uploaded" : "Already uploaded" });
|
|
320
405
|
if ((read.also[0] ?? []).length === 0 || (yield* Clock$1.currentTimeMillis) > staged.deadline) return yield* fail("DEADLINE_EXCEEDED", "The upload ran too long", { hint: "Upload it again" });
|
|
321
|
-
if ((yield*
|
|
322
|
-
id: newChangeId(),
|
|
323
|
-
expect: read.version,
|
|
406
|
+
if ((yield* registered.commit(repo.internalId, read.version, {
|
|
324
407
|
put: [{
|
|
325
408
|
...listedKey(staged.oid),
|
|
326
409
|
value: {
|
|
@@ -329,26 +412,36 @@ const listStaged = /* @__PURE__ */ Effect.fnUntraced(function* (parts, repo, fen
|
|
|
329
412
|
}
|
|
330
413
|
}],
|
|
331
414
|
delete: [uploadKey(staged.oid), {
|
|
332
|
-
collection:
|
|
415
|
+
collection: lfsCollections.staging,
|
|
333
416
|
id: staged.staged
|
|
334
417
|
}]
|
|
335
|
-
}))
|
|
418
|
+
})).ok) return lfsAnswer(200, { message: "Uploaded" });
|
|
336
419
|
}
|
|
337
420
|
return yield* contended();
|
|
338
421
|
});
|
|
339
422
|
/**
|
|
340
|
-
* A listed object's bytes, the repo's own or a source's, once the caller may read the repo
|
|
341
|
-
*
|
|
423
|
+
* A listed object's bytes, the repo's own or a source's, once the caller may read the repo and
|
|
424
|
+
* knows of the object, as `unseenOf` says: else it answers as one never uploaded. The host's fetch
|
|
425
|
+
* rules are asked of it then, before the bucket's stream opens, and their refusal or failure is
|
|
426
|
+
* the read's. `signal` aborted cancels the bucket's stream, opening or open.
|
|
342
427
|
*/
|
|
343
|
-
const objectOf = /* @__PURE__ */ Effect.fnUntraced(function* (
|
|
344
|
-
const core = yield* CoreParts;
|
|
428
|
+
const objectOf = /* @__PURE__ */ Effect.fnUntraced(function* (parts, read) {
|
|
345
429
|
const { oid, size, signal } = read;
|
|
346
430
|
if (!isLfsOid(oid)) return yield* fail("NOT_FOUND", "Object does not exist");
|
|
347
431
|
const repo = yield* openFor(read.caller, read.repo, false, read.internalId);
|
|
348
|
-
|
|
349
|
-
const listed = (yield*
|
|
432
|
+
const chained = yield* chainListed(parts.rows, repo.internalId, [oid]);
|
|
433
|
+
const listed = (yield* seenListed(read.caller, repo, [oid], chained)).get(oid);
|
|
350
434
|
if (listed === void 0 || size !== void 0 && size !== listed.size) return yield* fail("NOT_FOUND", "Object does not exist");
|
|
351
|
-
|
|
435
|
+
yield* checkRead(read.repo, {
|
|
436
|
+
caller: read.caller,
|
|
437
|
+
target: {
|
|
438
|
+
kind: "lfs",
|
|
439
|
+
oid,
|
|
440
|
+
size: listed.size
|
|
441
|
+
},
|
|
442
|
+
request: read.request
|
|
443
|
+
});
|
|
444
|
+
const stream = yield* bucketStream(parts.bucket, listed.key);
|
|
352
445
|
if (stream === void 0) return yield* fail("DATA_LOSS", `LFS object ${oid}'s bytes are missing`);
|
|
353
446
|
const bytes = signal === void 0 ? stream : stream.pipeThrough(new TransformStream(), { signal });
|
|
354
447
|
return {
|
|
@@ -357,12 +450,18 @@ const objectOf = /* @__PURE__ */ Effect.fnUntraced(function* (bucket, read) {
|
|
|
357
450
|
bytes
|
|
358
451
|
};
|
|
359
452
|
});
|
|
360
|
-
/**
|
|
453
|
+
/**
|
|
454
|
+
* `GET objects/<oid>`, a Worker download: a listed object's bytes, the repo's own or a source's,
|
|
455
|
+
* as `objectOf` reads them. Its fetch rules are asked again, though the batch that gave the link
|
|
456
|
+
* asked them: the link outlives that answer, and a signed bucket's link, which the bucket serves,
|
|
457
|
+
* is asked only at the batch.
|
|
458
|
+
*/
|
|
361
459
|
const send = /* @__PURE__ */ Effect.fnUntraced(function* (parts, call, oid) {
|
|
362
|
-
const object = yield* objectOf(parts
|
|
460
|
+
const object = yield* objectOf(parts, {
|
|
363
461
|
caller: call.caller,
|
|
364
462
|
repo: call.repo,
|
|
365
|
-
oid
|
|
463
|
+
oid,
|
|
464
|
+
request: call.request
|
|
366
465
|
});
|
|
367
466
|
return new Response(object.bytes, {
|
|
368
467
|
status: 200,
|
|
@@ -372,4 +471,4 @@ const send = /* @__PURE__ */ Effect.fnUntraced(function* (parts, call, oid) {
|
|
|
372
471
|
}
|
|
373
472
|
});
|
|
374
473
|
});
|
|
375
|
-
export { batch, listedOf, objectOf, receive, send,
|
|
474
|
+
export { batch, listedOf, objectOf, receive, send, verify };
|
package/dist/lfs/pointers.mjs
CHANGED
|
@@ -25,9 +25,11 @@ import * as Effect from "effect/Effect";
|
|
|
25
25
|
const pushCheckMilliseconds = 6e4;
|
|
26
26
|
/** A file's modes: a symlink or a submodule is never a pointer. */
|
|
27
27
|
const fileModes = /* @__PURE__ */ new Set(["100644", "100755"]);
|
|
28
|
-
/**
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
/**
|
|
29
|
+
* The check, over the repo's listed rows in LFS's registration's `rows`: each ref it refuses, with why.
|
|
30
|
+
* It answers only for the refs it's asked of, and may be asked twice.
|
|
31
|
+
*/
|
|
32
|
+
const pointerCheck = /* @__PURE__ */ Effect.fnUntraced(function* (rows, input) {
|
|
31
33
|
const refused = /* @__PURE__ */ new Map();
|
|
32
34
|
const tips = /* @__PURE__ */ new Map();
|
|
33
35
|
for (const update of input.updates) {
|
|
@@ -38,7 +40,7 @@ const checkPointers = /* @__PURE__ */ Effect.fnUntraced(function* (store, input)
|
|
|
38
40
|
}
|
|
39
41
|
const { lfsPointers } = input.objects;
|
|
40
42
|
if (lfsPointers.count === 0 || tips.size === 0) return refused;
|
|
41
|
-
const unlisted = yield* unlistedOf(
|
|
43
|
+
const unlisted = yield* unlistedOf(rows, input.objects.repo, lfsPointers);
|
|
42
44
|
if (unlisted === void 0) return refused;
|
|
43
45
|
const deadline = yield* deadlineOf(pushCheckMilliseconds, "walk-limit");
|
|
44
46
|
const walk = Effect.forEach(tips, ([ref, tip]) => Effect.map(missingAt(input, unlisted, tip, deadline), (missing) => [ref, missing]));
|
|
@@ -51,13 +53,13 @@ const checkPointers = /* @__PURE__ */ Effect.fnUntraced(function* (store, input)
|
|
|
51
53
|
* every one is listed. It reads a chunk of entries at a time, so it keeps no more than one read's
|
|
52
54
|
* rows beside the bits.
|
|
53
55
|
*/
|
|
54
|
-
const unlistedOf = /* @__PURE__ */ Effect.fnUntraced(function* (
|
|
56
|
+
const unlistedOf = /* @__PURE__ */ Effect.fnUntraced(function* (rows, repo, pointers) {
|
|
55
57
|
const unlisted = new Uint8Array(Math.ceil(pointers.count / 8));
|
|
56
58
|
let any = false;
|
|
57
59
|
for (let from = 0; from < pointers.count; from += 100) {
|
|
58
60
|
const to = Math.min(from + 100, pointers.count);
|
|
59
61
|
const oids = Array.from({ length: to - from }, (_, at) => lfsOidAt(pointers, from + at));
|
|
60
|
-
const listed = yield* listedOf(
|
|
62
|
+
const listed = yield* listedOf(rows, repo, [...new Set(oids)]);
|
|
61
63
|
for (const [at, oid] of oids.entries()) {
|
|
62
64
|
if (listed.has(oid)) continue;
|
|
63
65
|
unlisted[from + at >>> 3] = (unlisted[from + at >>> 3] ?? 0) | 1 << (from + at & 7);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { __exportAll } from "../_virtual/_rolldown/runtime.mjs";
|
|
2
|
+
import { Lfs, layer } from "./layer.mjs";
|
|
3
|
+
// src/lfs/public.ts
|
|
4
|
+
var public_exports = /* @__PURE__ */ __exportAll({
|
|
5
|
+
Lfs: () => Lfs,
|
|
6
|
+
layer: () => layer
|
|
7
|
+
});
|
|
8
|
+
export { Lfs, layer, public_exports };
|
package/dist/lfs/purge.mjs
CHANGED
|
@@ -1,50 +1,44 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { decodeRow
|
|
3
|
-
import {
|
|
4
|
-
import { ListedRow } from "./rows.mjs";
|
|
1
|
+
import { bucketDo } from "../storage/calls.mjs";
|
|
2
|
+
import { decodeRow } from "../store/errors.mjs";
|
|
3
|
+
import { ListedRow, lfsCollections } from "./rows.mjs";
|
|
5
4
|
import * as Effect from "effect/Effect";
|
|
6
|
-
/** LFS's purge over `bucket`,
|
|
7
|
-
const lfsPurge = (bucket) => /* @__PURE__ */ Effect.fnUntraced(function* (
|
|
8
|
-
const
|
|
9
|
-
const snapshot = yield* storeCall(() => store.read(scope, [
|
|
5
|
+
/** LFS's registration's purge over its `rows` and `bucket`, which charges each call. */
|
|
6
|
+
const lfsPurge = (rows, bucket) => /* @__PURE__ */ Effect.fnUntraced(function* ({ repo }) {
|
|
7
|
+
const snapshot = yield* rows.read(repo, [
|
|
10
8
|
{
|
|
11
|
-
collection:
|
|
9
|
+
collection: lfsCollections.uploads,
|
|
12
10
|
limit: 1
|
|
13
11
|
},
|
|
14
12
|
{
|
|
15
|
-
collection:
|
|
13
|
+
collection: lfsCollections.staging,
|
|
16
14
|
limit: 1
|
|
17
15
|
},
|
|
18
16
|
{
|
|
19
|
-
collection:
|
|
17
|
+
collection: lfsCollections.ending,
|
|
20
18
|
limit: 1
|
|
21
19
|
},
|
|
22
20
|
{
|
|
23
|
-
collection:
|
|
21
|
+
collection: lfsCollections.objects,
|
|
24
22
|
limit: 500
|
|
25
23
|
},
|
|
26
24
|
{
|
|
27
|
-
collection:
|
|
25
|
+
collection: lfsCollections.locks,
|
|
28
26
|
limit: 500
|
|
29
27
|
}
|
|
30
|
-
])
|
|
28
|
+
]);
|
|
31
29
|
const [uploads = [], staging = [], ending = [], listed = [], locks = []] = snapshot.results;
|
|
32
30
|
if (uploads.length + staging.length + ending.length > 0) return "waits";
|
|
33
|
-
const
|
|
34
|
-
if (
|
|
31
|
+
const found = listed.length > 0 ? listed : locks;
|
|
32
|
+
if (found.length === 0) return "done";
|
|
35
33
|
const keys = yield* Effect.forEach(listed, (row) => Effect.map(decodeRow(ListedRow, row, `LFS object ${row.id}`), (object) => object.key));
|
|
36
|
-
yield* Effect.forEach(keys, (key) =>
|
|
34
|
+
yield* Effect.forEach(keys, (key) => bucketDo(bucket.remove(key)), {
|
|
37
35
|
concurrency: 8,
|
|
38
36
|
discard: true
|
|
39
37
|
});
|
|
40
|
-
yield*
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
collection: row.collection,
|
|
45
|
-
id: row.id
|
|
46
|
-
}))
|
|
47
|
-
}));
|
|
38
|
+
yield* rows.commit(repo, snapshot.version, { delete: found.map((row) => ({
|
|
39
|
+
collection: row.collection,
|
|
40
|
+
id: row.id
|
|
41
|
+
})) });
|
|
48
42
|
return "did";
|
|
49
43
|
});
|
|
50
44
|
export { lfsPurge };
|