@ref0/git 0.14.0 → 0.25.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/private-refs.mjs +1 -1
- package/dist/auth/access-jwt.mjs +4 -4
- package/dist/auth/auth-namespace.d.mts +3 -3
- package/dist/auth/auth-namespace.mjs +3 -2
- package/dist/auth/auth.d.mts +3 -3
- package/dist/auth/auth.mjs +9 -8
- package/dist/auth/authorize.mjs +4 -4
- package/dist/auth/fences.d.mts +1 -2
- package/dist/auth/fences.mjs +3 -3
- package/dist/auth/grants.mjs +4 -4
- package/dist/auth/host-function.mjs +19 -2
- package/dist/auth/host-services.mjs +4 -6
- package/dist/auth/identify.d.mts +1 -1
- package/dist/auth/identify.mjs +9 -3
- package/dist/auth/token-cleanup.mjs +67 -0
- package/dist/auth/token-rows.mjs +7 -2
- package/dist/auth/token-text.mjs +9 -1
- package/dist/auth/tokens-base.d.mts +35 -0
- package/dist/auth/tokens-base.mjs +13 -0
- package/dist/auth/tokens-layer.d.mts +2 -27
- package/dist/auth/tokens-layer.mjs +6 -11
- package/dist/auth/tokens-public.d.mts +3 -3
- package/dist/auth/tokens.d.mts +7 -10
- package/dist/auth/tokens.mjs +10 -81
- package/dist/client/answer.mjs +21 -42
- package/dist/client/client.d.mts +17 -11
- package/dist/client/client.mjs +21 -12
- package/dist/client/git-http.mjs +18 -8
- package/dist/client/local.mjs +74 -37
- package/dist/client/negotiate.mjs +3 -3
- package/dist/client/push-upload.mjs +34 -17
- package/dist/client/remote.mjs +12 -13
- package/dist/client/run-remote-helper.d.mts +2 -1
- package/dist/client/run-remote-helper.mjs +61 -27
- package/dist/client/slice-push.d.mts +1 -1
- package/dist/client/transport.mjs +105 -46
- package/dist/contracts/blobs.d.mts +58 -11
- package/dist/contracts/blobs.mjs +17 -3
- package/dist/contracts/call-allowance.d.mts +13 -0
- package/dist/contracts/call-allowance.mjs +44 -0
- package/dist/contracts/calls-spent.mjs +12 -35
- package/dist/contracts/client.d.mts +18 -18
- package/dist/contracts/commits.d.mts +28 -28
- package/dist/contracts/commits.mjs +1 -1
- package/dist/contracts/engine.d.mts +8 -3
- package/dist/contracts/engine.mjs +10 -1
- package/dist/contracts/events.d.mts +1 -1
- package/dist/contracts/events.mjs +1 -1
- package/dist/contracts/files.d.mts +14 -14
- package/dist/contracts/files.mjs +1 -1
- package/dist/contracts/forks.d.mts +21 -21
- package/dist/contracts/forks.mjs +1 -1
- package/dist/contracts/git-events.d.mts +29 -1
- package/dist/contracts/git-hooks.d.mts +2 -2
- package/dist/contracts/git.d.mts +30 -5
- package/dist/contracts/grants.d.mts +24 -4
- package/dist/contracts/handlers.d.mts +1 -1
- package/dist/contracts/lfs.d.mts +28 -2
- package/dist/contracts/merges.d.mts +3 -2
- package/dist/contracts/object-values.d.mts +1 -0
- package/dist/contracts/object-values.mjs +16 -1
- package/dist/contracts/objects.d.mts +42 -41
- package/dist/contracts/opaque.mjs +1 -1
- package/dist/contracts/operations.mjs +1 -1
- package/dist/contracts/queue.d.mts +247 -55
- package/dist/contracts/queue.mjs +8 -9
- package/dist/contracts/refs.d.mts +30 -27
- package/dist/contracts/refs.mjs +1 -1
- package/dist/contracts/remote.d.mts +8 -12
- package/dist/contracts/remote.mjs +4 -1
- package/dist/contracts/repos.d.mts +32 -141
- package/dist/contracts/repos.mjs +6 -4
- package/dist/contracts/result.d.mts +40 -18
- package/dist/contracts/result.mjs +42 -9
- package/dist/contracts/rules.d.mts +2 -2
- package/dist/contracts/server.d.mts +25 -52
- package/dist/contracts/services.d.mts +6 -9
- package/dist/contracts/services.mjs +1 -2
- package/dist/contracts/signin.d.mts +1 -1
- package/dist/contracts/store.d.mts +7 -6
- package/dist/contracts/sync.d.mts +73 -12
- package/dist/contracts/sync.mjs +14 -3
- package/dist/contracts/tags.d.mts +13 -13
- package/dist/contracts/tags.mjs +1 -1
- package/dist/contracts/time.d.mts +3 -0
- package/dist/contracts/{promises.mjs → time.mjs} +1 -1
- package/dist/contracts/tokens.d.mts +17 -19
- package/dist/contracts/tokens.mjs +4 -3
- package/dist/contracts/topics.d.mts +10 -10
- package/dist/contracts/trees.d.mts +16 -16
- package/dist/contracts/trees.mjs +1 -1
- package/dist/contracts/work.d.mts +28 -17
- package/dist/contracts/work.mjs +2 -2
- package/dist/core/access.d.mts +1 -2
- package/dist/core/access.mjs +20 -9
- package/dist/core/ancestry.d.mts +1 -0
- package/dist/core/ancestry.mjs +30 -34
- package/dist/core/asked.mjs +1 -1
- package/dist/core/call-groups.mjs +48 -0
- package/dist/core/call-names.mjs +6 -1
- package/dist/core/call-services.mjs +11 -3
- package/dist/core/events/deliver.d.mts +2 -3
- package/dist/core/events/deliver.mjs +45 -38
- package/dist/core/events/retired.mjs +119 -0
- package/dist/core/forks.mjs +929 -433
- package/dist/core/hooks/groups.mjs +3 -3
- package/dist/core/imports.mjs +127 -41
- package/dist/core/index-job.mjs +131 -38
- package/dist/core/index-lost.d.mts +1 -2
- package/dist/core/index-lost.mjs +2 -2
- package/dist/core/loose-tally.mjs +38 -15
- package/dist/core/merge-parts.d.mts +17 -4
- package/dist/core/merge-parts.mjs +7 -2
- package/dist/core/mirror-rows.mjs +31 -1
- package/dist/core/objects/blobs.mjs +127 -3
- package/dist/core/objects/files.mjs +20 -17
- package/dist/core/objects/lines.mjs +2 -2
- package/dist/core/objects/merges.mjs +4 -1
- package/dist/core/objects/objects-layer.d.mts +1 -1
- package/dist/core/objects/objects-layer.mjs +4 -4
- package/dist/core/objects/peel.mjs +1 -7
- package/dist/core/objects/reading.mjs +41 -29
- package/dist/core/objects/tags.mjs +4 -1
- package/dist/core/objects/tree-edits.mjs +1 -1
- package/dist/core/objects/trees.mjs +257 -58
- package/dist/core/objects/writing.mjs +4 -10
- package/dist/core/own-writes.mjs +2 -2
- package/dist/core/parts.d.mts +11 -5
- package/dist/core/parts.mjs +9 -10
- package/dist/core/purge.mjs +310 -93
- package/dist/core/push-decide.mjs +2 -0
- package/dist/core/push-files.d.mts +1 -1
- package/dist/core/push.d.mts +2 -2
- package/dist/core/push.mjs +170 -128
- package/dist/core/receipts.d.mts +2 -2
- package/dist/core/receipts.mjs +17 -5
- package/dist/core/ref-index-job.mjs +7 -7
- package/dist/core/ref-view.mjs +75 -32
- package/dist/core/refs.mjs +7 -7
- package/dist/core/registered-rows.mjs +2 -2
- package/dist/core/repack.mjs +58 -48
- package/dist/core/repo-info.mjs +3 -3
- package/dist/core/repos.mjs +21 -9
- package/dist/core/rules/changes.mjs +18 -40
- package/dist/core/rules/check.mjs +6 -5
- package/dist/core/rules/commit-changes.mjs +3 -15
- package/dist/core/rules/context.d.mts +3 -3
- package/dist/core/rules/context.mjs +18 -14
- package/dist/core/rules/fetch.mjs +1 -1
- package/dist/core/rules/protect.mjs +30 -17
- package/dist/core/saved-caller-views.d.mts +8 -3
- package/dist/core/saved-caller-views.mjs +4 -4
- package/dist/core/saved-callers.d.mts +19 -2
- package/dist/core/saved-callers.mjs +1 -1
- package/dist/core/seam.d.mts +17 -28
- package/dist/core/seam.mjs +7 -28
- package/dist/core/tokens.mjs +1 -1
- package/dist/core/view.d.mts +6 -3
- package/dist/core/view.mjs +18 -25
- package/dist/core/work.mjs +60 -15
- package/dist/engine/allotted-xdiff.mjs +3 -16
- package/dist/engine/combined.d.mts +3 -0
- package/dist/engine/combined.mjs +200 -185
- package/dist/engine/content.d.mts +2 -2
- package/dist/engine/content.mjs +1 -1
- package/dist/engine/failures.mjs +2 -1
- package/dist/engine/merge.mjs +7 -9
- package/dist/engine/reads.d.mts +2 -2
- package/dist/engine/reads.mjs +25 -17
- package/dist/engine/xdiff.d.mts +1 -1
- package/dist/engine/xdiff.mjs +1 -1
- package/dist/event-streams/event-streams.d.mts +1 -1
- package/dist/event-streams/event-streams.mjs +1 -1
- package/dist/event-streams/stream.d.mts +3 -3
- package/dist/event-streams/stream.mjs +39 -16
- package/dist/extend.d.mts +2 -7
- package/dist/extend.mjs +1 -4
- package/dist/http/answers.mjs +8 -5
- package/dist/http/core-parts.mjs +169 -96
- package/dist/http/handler.mjs +82 -10
- package/dist/http/node.d.mts +14 -1
- package/dist/http/node.mjs +56 -27
- package/dist/http/parts.d.mts +2 -0
- package/dist/http/push-upload-job.mjs +165 -47
- package/dist/http/push-uploads.mjs +37 -22
- package/dist/http/receive-pack.mjs +14 -53
- package/dist/http/request-snapshot.mjs +258 -0
- package/dist/http/upload-pack.mjs +25 -20
- package/dist/index.d.mts +36 -28
- package/dist/index.mjs +12 -3
- package/dist/lfs/answer.mjs +37 -0
- package/dist/lfs/base.d.mts +3 -1
- package/dist/lfs/base.mjs +25 -1
- package/dist/lfs/copy.d.mts +70 -8
- package/dist/lfs/copy.mjs +217 -21
- package/dist/lfs/layer.d.mts +19 -4
- package/dist/lfs/layer.mjs +25 -13
- package/dist/lfs/locks.mjs +3 -3
- package/dist/lfs/objects.d.mts +2 -1
- package/dist/lfs/objects.mjs +89 -19
- package/dist/lfs/pointers.mjs +2 -2
- package/dist/lfs/rows.d.mts +1 -1
- package/dist/lfs/rows.mjs +50 -9
- package/dist/lfs/upkeep.mjs +82 -17
- package/dist/lfs/uploaded.mjs +1 -1
- package/dist/lfs/wire.mjs +7 -32
- package/dist/merges/merges.mjs +19 -4
- package/dist/node.d.mts +2 -2
- package/dist/protocol/bytes/buffers.d.mts +1 -1
- package/dist/protocol/bytes/buffers.mjs +14 -6
- package/dist/protocol/bytes/deflate.d.mts +1 -1
- package/dist/protocol/bytes/deflate.mjs +1 -1
- package/dist/protocol/bytes/inflate.d.mts +1 -1
- package/dist/protocol/bytes/inflate.mjs +1 -1
- package/dist/protocol/bytes/reader.mjs +6 -1
- package/dist/protocol/bytes/sha1.d.mts +1 -1
- package/dist/protocol/bytes/sha1.mjs +1 -1
- package/dist/protocol/bytes/streams.mjs +27 -1
- package/dist/protocol/diff/read.d.mts +6 -4
- package/dist/protocol/diff/read.mjs +110 -11
- package/dist/protocol/objects/lfs-pointer.d.mts +14 -2
- package/dist/protocol/objects/lfs-pointer.mjs +1 -3
- package/dist/protocol/objects/links-raw.mjs +24 -10
- package/dist/protocol/objects/tag.d.mts +1 -1
- package/dist/protocol/objects/tree.mjs +23 -6
- package/dist/protocol/packs/delta.d.mts +6 -3
- package/dist/protocol/packs/delta.mjs +96 -32
- package/dist/protocol/packs/graph.mjs +1 -1
- package/dist/protocol/packs/idx.d.mts +3 -2
- package/dist/protocol/packs/idx.mjs +23 -4
- package/dist/protocol/packs/parts.d.mts +4 -1
- package/dist/protocol/packs/parts.mjs +10 -7
- package/dist/protocol/packs/reader.d.mts +6 -1
- package/dist/protocol/packs/reader.mjs +4 -3
- 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 +26 -8
- package/dist/protocol/wire/advertisement.d.mts +1 -1
- package/dist/protocol/wire/advertisement.mjs +3 -2
- package/dist/protocol/wire/fetch.d.mts +1 -1
- package/dist/protocol/wire/fetch.mjs +1 -1
- package/dist/protocol/wire/lines.d.mts +9 -1
- package/dist/protocol/wire/lines.mjs +28 -1
- package/dist/protocol/wire/push-uploads.mjs +10 -7
- 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 +1 -1
- package/dist/protocol/wire/v2.mjs +1 -1
- package/dist/queue/advance.mjs +48 -44
- package/dist/queue/base.d.mts +57 -0
- package/dist/queue/base.mjs +44 -0
- package/dist/queue/calls.mjs +54 -57
- package/dist/queue/commit.mjs +2 -2
- package/dist/queue/host.d.mts +2 -16
- package/dist/queue/host.mjs +2 -7
- package/dist/queue/layer.d.mts +2 -2
- package/dist/queue/layer.mjs +19 -8
- package/dist/queue/limits.mjs +2 -0
- package/dist/queue/push-option.mjs +9 -24
- package/dist/queue/schedule.mjs +2 -2
- package/dist/queue/search.mjs +1 -1
- package/dist/queue/state.mjs +3 -11
- package/dist/queue/trim.mjs +6 -4
- package/dist/rest/blobs.mjs +29 -5
- package/dist/rest/caller.d.mts +4 -4271
- package/dist/rest/caller.mjs +4 -0
- package/dist/rest/client.d.mts +9 -6
- package/dist/rest/client.mjs +25 -8
- package/dist/rest/errors.mjs +1 -1
- package/dist/rest/handler.mjs +2 -2
- package/dist/rest/handlers.mjs +66 -11
- package/dist/rest/layer.d.mts +2 -2
- package/dist/rest/layer.mjs +6 -13
- package/dist/rest/listen.mjs +2 -2
- package/dist/rest/me.d.mts +3 -432
- package/dist/rest/refs.mjs +1 -1
- package/dist/server/check-fetch.mjs +3 -3
- package/dist/server/edge-node.d.mts +11 -8
- package/dist/server/edge-node.mjs +9 -6
- package/dist/server/edge.d.mts +21 -7
- package/dist/server/edge.mjs +56 -11
- package/dist/server/extension.mjs +1 -1
- package/dist/server/git-layer.d.mts +5 -6
- package/dist/server/git-layer.mjs +28 -23
- package/dist/server/git-namespace.d.mts +4 -3
- package/dist/server/git-namespace.mjs +3 -2
- package/dist/server/lifecycle.mjs +19 -107
- package/dist/server/registry.mjs +24 -13
- package/dist/server/server.mjs +249 -371
- package/dist/signin/context.d.mts +1 -2
- package/dist/signin/context.mjs +1 -1
- package/dist/signin/forms.mjs +1 -1
- package/dist/signin/grants.d.mts +2 -2
- package/dist/signin/grants.mjs +1 -1
- package/dist/signin/layer.d.mts +1 -1
- package/dist/signin/layer.mjs +1 -1
- package/dist/signin/wire.mjs +1 -1
- package/dist/storage/allotted.mjs +22 -12
- package/dist/storage/batch-upkeep.mjs +293 -0
- package/dist/storage/batches.d.mts +7 -0
- package/dist/storage/batches.mjs +347 -0
- package/dist/storage/budget.mjs +23 -1
- package/dist/storage/calls.d.mts +2 -3
- package/dist/storage/calls.mjs +166 -182
- package/dist/storage/charged-cache.mjs +180 -0
- package/dist/storage/chunks.d.mts +9 -0
- package/dist/storage/chunks.mjs +410 -0
- package/dist/storage/clean-up.mjs +72 -9
- package/dist/storage/counted-bucket.mjs +35 -13
- package/dist/storage/fetch-row-cache.d.mts +6 -0
- package/dist/storage/fetch-row-cache.mjs +211 -0
- package/dist/storage/fetch.d.mts +2 -0
- package/dist/storage/fetch.mjs +339 -450
- package/dist/storage/held-types.d.mts +0 -1
- package/dist/storage/host-bucket.mjs +10 -6
- package/dist/storage/id-mix.mjs +19 -5
- package/dist/storage/index-bitmaps.mjs +86 -51
- package/dist/storage/index-build.d.mts +2 -4
- package/dist/storage/index-build.mjs +324 -67
- package/dist/storage/index-fetch.d.mts +3 -1
- package/dist/storage/index-fetch.mjs +163 -83
- package/dist/storage/index-files.d.mts +3 -0
- package/dist/storage/index-files.mjs +10 -5
- package/dist/storage/index-graph.mjs +73 -23
- package/dist/storage/index-layers.mjs +55 -25
- package/dist/storage/index-reach.mjs +15 -22
- package/dist/storage/index-remap.mjs +200 -64
- package/dist/storage/index-whole.d.mts +7 -0
- package/dist/storage/index-whole.mjs +235 -0
- package/dist/storage/largest-files.mjs +1 -7
- package/dist/storage/layout.mjs +40 -1
- package/dist/storage/lfs-pointers.mjs +1 -6
- package/dist/storage/link-join.mjs +55 -16
- package/dist/storage/list-source.d.mts +7 -0
- package/dist/storage/list-source.mjs +288 -0
- package/dist/storage/loose.d.mts +10 -7
- package/dist/storage/loose.mjs +293 -82
- package/dist/storage/memory-budget.mjs +242 -26
- package/dist/storage/merge-cut.mjs +9 -6
- package/dist/storage/merge-fence.mjs +1 -1
- package/dist/storage/merge-plan.mjs +3 -2
- package/dist/storage/merge-row.mjs +8 -2
- package/dist/storage/merge-stream.mjs +164 -25
- package/dist/storage/merge-walk.mjs +8 -4
- package/dist/storage/merge-write.mjs +1 -1
- package/dist/storage/merge.d.mts +3 -4
- package/dist/storage/merge.mjs +3 -3
- package/dist/storage/object-rows.d.mts +4 -3
- package/dist/storage/object-rows.mjs +545 -84
- package/dist/storage/oid-table.mjs +171 -0
- package/dist/storage/pack-order.mjs +104 -47
- package/dist/storage/pack-ranges.d.mts +1 -2
- package/dist/storage/pack-ranges.mjs +48 -21
- package/dist/storage/pack-reads.d.mts +6 -3
- package/dist/storage/pack-reads.mjs +378 -98
- package/dist/storage/pack-receive.d.mts +2 -3
- package/dist/storage/pack-receive.mjs +22 -18
- package/dist/storage/packs.d.mts +2 -2
- package/dist/storage/packs.mjs +587 -156
- package/dist/storage/placed-reads.mjs +34 -17
- package/dist/storage/plan-columns.d.mts +4 -0
- package/dist/storage/plan-columns.mjs +238 -0
- package/dist/storage/prune-keep.mjs +134 -41
- package/dist/storage/prune-seen.mjs +1 -1
- package/dist/storage/prune-walk.mjs +203 -63
- package/dist/storage/prune.mjs +197 -121
- package/dist/storage/push-allotment.mjs +116 -25
- package/dist/storage/push-uploads.mjs +196 -58
- package/dist/storage/pushed-commits.mjs +24 -3
- package/dist/storage/quarantine.d.mts +3 -4
- package/dist/storage/range-cache.mjs +293 -41
- package/dist/storage/raw-ids.mjs +39 -10
- package/dist/storage/ready.d.mts +3 -4
- package/dist/storage/ready.mjs +121 -43
- package/dist/storage/receive-bounds.mjs +50 -13
- package/dist/storage/receive-cache.d.mts +7 -0
- package/dist/storage/receive-cache.mjs +147 -0
- 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 +6 -8
- package/dist/storage/receive-steps.d.mts +20 -0
- package/dist/storage/receive-steps.mjs +298 -13
- package/dist/storage/repack-backlog.mjs +1 -3
- package/dist/storage/repack-contained.mjs +2 -2
- package/dist/storage/repack-job.mjs +1 -1
- package/dist/storage/repack.d.mts +3 -4
- package/dist/storage/repack.mjs +54 -9
- package/dist/storage/request-cache.mjs +57 -0
- package/dist/storage/roots.mjs +1 -24
- package/dist/storage/rows.d.mts +3 -3
- package/dist/storage/rows.mjs +2 -2
- package/dist/storage/runs.d.mts +2 -2
- package/dist/storage/runs.mjs +196 -44
- package/dist/storage/send-list.d.mts +1 -0
- package/dist/storage/send-list.mjs +112 -31
- package/dist/storage/single-flight.mjs +13 -7
- package/dist/storage/stream-whole.mjs +188 -66
- package/dist/storage/swap-walk.mjs +1 -1
- package/dist/storage/unpack.mjs +919 -199
- package/dist/storage/visible.mjs +112 -34
- package/dist/storage/walk.mjs +193 -38
- package/dist/storage/wants.mjs +27 -63
- package/dist/store/bodies.mjs +38 -0
- package/dist/store/call-count.d.mts +10 -14
- package/dist/store/call-count.mjs +58 -57
- package/dist/store/catalogue.d.mts +2 -2
- package/dist/store/catalogue.mjs +158 -36
- package/dist/store/crossing.mjs +1 -9
- package/dist/store/cursor-seal.d.mts +1 -2
- package/dist/store/cursor-seal.mjs +17 -7
- package/dist/store/door.mjs +188 -0
- package/dist/store/errors.d.mts +4 -5
- package/dist/store/errors.mjs +119 -49
- package/dist/store/git-store.mjs +30 -7
- package/dist/store/job-try.mjs +98 -40
- package/dist/store/list-job.mjs +32 -20
- package/dist/store/outbox.d.mts +2 -2
- package/dist/store/outbox.mjs +2 -2
- package/dist/store/queue-jobs.mjs +6 -12
- package/dist/store/records.d.mts +5 -2
- package/dist/store/records.mjs +5 -2
- package/dist/store/ref-rows.d.mts +2 -2
- package/dist/store/ref-rows.mjs +2 -2
- package/dist/store/repo-record.d.mts +2 -3
- package/dist/store/repo-record.mjs +34 -22
- package/dist/store/request-snapshot.mjs +5 -0
- package/dist/store/reservations.mjs +3 -3
- package/dist/store/scopes.mjs +11 -0
- package/dist/store/settle.mjs +4 -4
- package/dist/store/topic-jobs.mjs +5 -11
- package/dist/sync/bound.d.mts +3 -3
- package/dist/sync/bound.mjs +10 -7
- package/dist/sync/github.mjs +67 -69
- package/dist/sync/http.mjs +1 -1
- package/dist/sync/import.mjs +205 -57
- package/dist/sync/layer.d.mts +1 -1
- package/dist/sync/layer.mjs +6 -6
- package/dist/sync/lfs-batch.mjs +5 -6
- package/dist/sync/lfs-copy.mjs +191 -20
- package/dist/sync/mirror.mjs +34 -36
- package/dist/sync/said.mjs +17 -38
- package/dist/sync/step.mjs +292 -102
- package/dist/sync/tries.mjs +34 -15
- package/dist/sync.d.mts +2 -2
- package/dist/sync.mjs +2 -2
- package/dist/topics/advance.mjs +12 -13
- package/dist/topics/base.d.mts +15 -0
- package/dist/topics/base.mjs +8 -0
- package/dist/topics/calls.mjs +1 -1
- package/dist/topics/host.mjs +1 -1
- package/dist/topics/layer.d.mts +17 -21
- package/dist/topics/layer.mjs +2 -3
- package/dist/topics/members.mjs +4 -4
- package/dist/topics/public.d.mts +2 -1
- package/dist/topics/topic.mjs +2 -2
- package/package.json +5 -14
- package/dist/auth/helpers.mjs +0 -17
- package/dist/auth.d.mts +0 -5
- package/dist/auth.mjs +0 -5
- package/dist/contracts/promises.d.mts +0 -39
- package/dist/core/call-names.d.mts +0 -3
- package/dist/core/clock.mjs +0 -18
- package/dist/core/promise.mjs +0 -74
- package/dist/core/rules/commit-changes.d.mts +0 -13
- package/dist/effect.d.mts +0 -18
- package/dist/effect.mjs +0 -16
- package/dist/lfs/calls.mjs +0 -26
- package/dist/rest/api.d.mts +0 -23
- package/dist/rest/blobs.d.mts +0 -833
- package/dist/rest/commits.d.mts +0 -3543
- package/dist/rest/errors.d.mts +0 -2124
- package/dist/rest/events.d.mts +0 -426
- package/dist/rest/files.d.mts +0 -1342
- package/dist/rest/forks.d.mts +0 -2160
- package/dist/rest/handlers.d.mts +0 -8
- package/dist/rest/merges.d.mts +0 -477
- package/dist/rest/queue.d.mts +0 -5917
- package/dist/rest/refs.d.mts +0 -2988
- package/dist/rest/repos.d.mts +0 -2567
- package/dist/rest/tags.d.mts +0 -1316
- package/dist/rest/tokens.d.mts +0 -2614
- package/dist/rest/topics.d.mts +0 -2224
- package/dist/rest/trees.d.mts +0 -1709
- package/dist/rest/work.d.mts +0 -1695
- package/dist/server/joined.d.mts +0 -82
- package/dist/server/joined.mjs +0 -68
- package/dist/server/lifecycle.d.mts +0 -2
- package/dist/store/promises.d.mts +0 -11
- package/dist/store/promises.mjs +0 -327
package/dist/lfs/copy.mjs
CHANGED
|
@@ -1,26 +1,222 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
1
|
+
import { gitError } from "../contracts/result.mjs";
|
|
2
|
+
import { Sha256 } from "../protocol/bytes/sha256.mjs";
|
|
3
|
+
import { bucketDo, joined } from "../storage/calls.mjs";
|
|
4
|
+
import { decodeRow } from "../store/errors.mjs";
|
|
5
|
+
import { randomText } from "../store/random.mjs";
|
|
6
|
+
import { listedOf } from "./objects.mjs";
|
|
7
|
+
import { CopyRow, StagingRow, copyKey, copyRead, copyRowKey, lfsCollections, listedKey, stagingId, stagingRead, streamMost, uploadGrace } from "./rows.mjs";
|
|
5
8
|
import * as Effect from "effect/Effect";
|
|
9
|
+
import * as Stream from "effect/Stream";
|
|
10
|
+
import * as Clock from "effect/Clock";
|
|
6
11
|
// src/lfs/copy.ts
|
|
7
|
-
/**
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
/**
|
|
13
|
+
* The fewest bytes of each part, and each part's where the bucket sets none, as disk's and
|
|
14
|
+
* memory's don't: R2's and Blob's own size, which a part held in memory as it's sent keeps well
|
|
15
|
+
* inside a Worker's, and at which the import record's cursor names at most 640 parts.
|
|
16
|
+
*/
|
|
17
|
+
const copyPartDefault = 8 * 1024 ** 2;
|
|
18
|
+
/**
|
|
19
|
+
* What `key` holds: `size` bytes, other bytes, or none. One `list` at the key itself, limit 1,
|
|
20
|
+
* which every bucket has: a `head` would be one call too, but a public API of its own. Only the
|
|
21
|
+
* copy puts at a copy key, and the bucket checks each put against the oid's SHA-256 and keeps all
|
|
22
|
+
* of it or nothing, so bytes there at the size are the oid's, and no hash is read.
|
|
23
|
+
*/
|
|
24
|
+
const heldAt = /* @__PURE__ */ Effect.fnUntraced(function* (bucket, key, size) {
|
|
25
|
+
const held = (yield* bucketDo(bucket.list(key, { limit: 1 }))).items.find((item) => item.key === key);
|
|
26
|
+
if (held === void 0) return "none";
|
|
27
|
+
return held.size === size ? "same" : "other";
|
|
28
|
+
});
|
|
29
|
+
/** The repo's copy rows of `oids`, read in chunks. */
|
|
30
|
+
const copiesOf = /* @__PURE__ */ Effect.fnUntraced(function* (rows, repo, oids) {
|
|
31
|
+
const copies = /* @__PURE__ */ new Map();
|
|
32
|
+
for (let at = 0; at < oids.length; at += 100) {
|
|
33
|
+
const chunk = oids.slice(at, at + 100);
|
|
34
|
+
const snapshot = yield* rows.read(repo, chunk.map(copyRead));
|
|
35
|
+
for (const [index, oid] of chunk.entries()) {
|
|
36
|
+
const row = snapshot.results[index]?.[0];
|
|
37
|
+
if (row !== void 0) copies.set(oid, yield* decodeRow(CopyRow, row, `LFS copy ${oid}`));
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return copies;
|
|
41
|
+
});
|
|
42
|
+
/** `stage`, over `rows` and `bucket`. */
|
|
43
|
+
const copyStages = /* @__PURE__ */ Effect.fnUntraced(function* (rows, bucket, repo, objects) {
|
|
44
|
+
const now = yield* Clock.currentTimeMillis;
|
|
45
|
+
const removeAt = now + uploadGrace;
|
|
46
|
+
const copies = yield* copiesOf(rows, repo, objects.map(({ oid }) => oid));
|
|
47
|
+
const stages = [];
|
|
48
|
+
const put = [];
|
|
49
|
+
for (const { oid, size } of objects) {
|
|
50
|
+
const copy = copies.get(oid);
|
|
51
|
+
const held = copy === void 0 ? "none" : yield* heldAt(bucket, copy.key, size);
|
|
52
|
+
const putsBefore = copy !== void 0 && copy.removeAt - streamMost > now;
|
|
53
|
+
if (copy !== void 0 && (held === "same" || held === "none" && putsBefore)) {
|
|
54
|
+
const row = {
|
|
55
|
+
collection: lfsCollections.staging,
|
|
56
|
+
id: copy.staged
|
|
57
|
+
};
|
|
58
|
+
stages.push({
|
|
59
|
+
key: copy.key,
|
|
60
|
+
row,
|
|
61
|
+
landed: held === "same"
|
|
62
|
+
});
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
const generation = randomText(16);
|
|
66
|
+
const key = copyKey(repo, oid, generation);
|
|
67
|
+
const row = {
|
|
68
|
+
collection: lfsCollections.staging,
|
|
69
|
+
id: stagingId(removeAt, generation)
|
|
70
|
+
};
|
|
71
|
+
put.push({
|
|
72
|
+
...row,
|
|
73
|
+
value: {
|
|
74
|
+
key,
|
|
75
|
+
removeAt,
|
|
76
|
+
oid
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
if (copy === void 0) put.push({
|
|
80
|
+
...copyRowKey(oid),
|
|
18
81
|
value: {
|
|
19
|
-
|
|
20
|
-
|
|
82
|
+
key,
|
|
83
|
+
staged: row.id,
|
|
84
|
+
removeAt
|
|
21
85
|
}
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
|
|
86
|
+
});
|
|
87
|
+
stages.push({
|
|
88
|
+
key,
|
|
89
|
+
row,
|
|
90
|
+
landed: false
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
if (put.length > 0) yield* rows.add(repo, {
|
|
94
|
+
put,
|
|
95
|
+
wake: removeAt
|
|
96
|
+
});
|
|
97
|
+
return stages;
|
|
25
98
|
});
|
|
26
|
-
|
|
99
|
+
/** `upload`, over `rows` and `bucket`: the token first, so the row that names it names an upload that is. */
|
|
100
|
+
const copyUpload = /* @__PURE__ */ Effect.fnUntraced(function* (rows, bucket, repo, oid) {
|
|
101
|
+
const removeAt = (yield* Clock.currentTimeMillis) + uploadGrace;
|
|
102
|
+
const generation = randomText(16);
|
|
103
|
+
const key = copyKey(repo, oid, generation);
|
|
104
|
+
const row = {
|
|
105
|
+
collection: lfsCollections.staging,
|
|
106
|
+
id: stagingId(removeAt, generation)
|
|
107
|
+
};
|
|
108
|
+
const token = yield* bucketDo(bucket.beginPut(key));
|
|
109
|
+
const value = {
|
|
110
|
+
key,
|
|
111
|
+
removeAt,
|
|
112
|
+
oid,
|
|
113
|
+
upload: token
|
|
114
|
+
};
|
|
115
|
+
yield* rows.add(repo, {
|
|
116
|
+
put: [{
|
|
117
|
+
...row,
|
|
118
|
+
value
|
|
119
|
+
}],
|
|
120
|
+
wake: removeAt
|
|
121
|
+
});
|
|
122
|
+
return {
|
|
123
|
+
staging: {
|
|
124
|
+
key,
|
|
125
|
+
row
|
|
126
|
+
},
|
|
127
|
+
token,
|
|
128
|
+
sha256: new Sha256().state()
|
|
129
|
+
};
|
|
130
|
+
});
|
|
131
|
+
const rowsMoved = /* @__PURE__ */ gitError("UNAVAILABLE", "Another write moved the repo's LFS rows while an upload's stage was read", { hint: "The job tries again" });
|
|
132
|
+
/** `resumable`, over `rows`. */
|
|
133
|
+
const uploadResumable = /* @__PURE__ */ Effect.fnUntraced(function* (rows, repo, staging, version) {
|
|
134
|
+
const now = yield* Clock.currentTimeMillis;
|
|
135
|
+
const snapshot = yield* rows.read(repo, [stagingRead(staging.row.id)]);
|
|
136
|
+
if (snapshot.version !== version) return yield* Effect.fail(rowsMoved);
|
|
137
|
+
const found = snapshot.results[0]?.[0];
|
|
138
|
+
if (found === void 0) return false;
|
|
139
|
+
return (yield* decodeRow(StagingRow, found, `LFS staging ${staging.row.id}`)).removeAt - streamMost > now;
|
|
140
|
+
});
|
|
141
|
+
/** The first `count` bytes of `held`'s chunks as one part, and the chunks left after them. */
|
|
142
|
+
const partOf = (held, count) => {
|
|
143
|
+
const bytes = joined(held);
|
|
144
|
+
return {
|
|
145
|
+
part: bytes.subarray(0, count),
|
|
146
|
+
rest: bytes.length > count ? [bytes.subarray(count)] : []
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
/** `putParts`, over `bucket`, in parts of `partBytes`. */
|
|
150
|
+
const partsPut = /* @__PURE__ */ Effect.fnUntraced(function* (bucket, partBytes, input) {
|
|
151
|
+
const { staging, token, object, saved } = input;
|
|
152
|
+
const most = Math.max(1, Math.floor(input.bytes / partBytes));
|
|
153
|
+
const hash = new Sha256(input.progress.sha256);
|
|
154
|
+
let progress = input.progress;
|
|
155
|
+
let held = [];
|
|
156
|
+
let heldBytes = 0;
|
|
157
|
+
let sent = 0;
|
|
158
|
+
let ending = "other";
|
|
159
|
+
const stop = (why) => {
|
|
160
|
+
ending = why;
|
|
161
|
+
return false;
|
|
162
|
+
};
|
|
163
|
+
const took = Effect.fnUntraced(function* (chunk) {
|
|
164
|
+
held.push(chunk);
|
|
165
|
+
heldBytes += chunk.byteLength;
|
|
166
|
+
if (progress.offset + heldBytes > object.size) return stop("other");
|
|
167
|
+
while (heldBytes >= partBytes || heldBytes > 0 && progress.offset + heldBytes === object.size) {
|
|
168
|
+
const { part, rest } = partOf(held, Math.min(heldBytes, partBytes));
|
|
169
|
+
held = rest;
|
|
170
|
+
heldBytes -= part.byteLength;
|
|
171
|
+
hash.update(part);
|
|
172
|
+
const number = progress.parts.length + 1;
|
|
173
|
+
const { etag, size } = yield* bucketDo(bucket.putPart(staging.key, token, number, part));
|
|
174
|
+
progress = {
|
|
175
|
+
offset: progress.offset + size,
|
|
176
|
+
parts: [...progress.parts, {
|
|
177
|
+
part: number,
|
|
178
|
+
etag,
|
|
179
|
+
size
|
|
180
|
+
}],
|
|
181
|
+
sha256: hash.state()
|
|
182
|
+
};
|
|
183
|
+
sent += 1;
|
|
184
|
+
const whole = progress.offset === object.size;
|
|
185
|
+
if (whole && hash.hex() !== object.oid) return stop("other");
|
|
186
|
+
yield* saved(progress);
|
|
187
|
+
if (whole) return stop("whole");
|
|
188
|
+
if (sent === most) return stop("step");
|
|
189
|
+
}
|
|
190
|
+
return true;
|
|
191
|
+
});
|
|
192
|
+
yield* Stream.runForEachWhile(input.body, took);
|
|
193
|
+
return ending;
|
|
194
|
+
});
|
|
195
|
+
/** The copy over LFS's registration's rows and its bucket. */
|
|
196
|
+
const lfsCopy = (rows, bucket) => {
|
|
197
|
+
const partBytes = Math.max(Number.isFinite(bucket.multipart.partSize) ? bucket.multipart.partSize : 0, copyPartDefault);
|
|
198
|
+
return {
|
|
199
|
+
listed: (repo, oids) => listedOf(rows, repo, oids),
|
|
200
|
+
stage: (repo, objects) => copyStages(rows, bucket, repo, objects),
|
|
201
|
+
put: (staging, body, size, oid) => Effect.asVoid(Effect.uninterruptible(bucketDo(bucket.put(staging.key, body, {
|
|
202
|
+
size,
|
|
203
|
+
sha256: oid
|
|
204
|
+
})))),
|
|
205
|
+
listing: (landed) => ({
|
|
206
|
+
put: landed.map(({ oid, size, staging }) => ({
|
|
207
|
+
...listedKey(oid),
|
|
208
|
+
value: {
|
|
209
|
+
size,
|
|
210
|
+
key: staging.key
|
|
211
|
+
}
|
|
212
|
+
})),
|
|
213
|
+
delete: landed.flatMap(({ oid, staging }) => [staging.row, copyRowKey(oid)])
|
|
214
|
+
}),
|
|
215
|
+
upload: (repo, oid) => copyUpload(rows, bucket, repo, oid),
|
|
216
|
+
resumable: (repo, staging, version) => uploadResumable(rows, repo, staging, version),
|
|
217
|
+
putParts: (input) => partsPut(bucket, partBytes, input),
|
|
218
|
+
complete: (staging, token, parts, size) => Effect.asVoid(bucketDo(bucket.completePut(staging.key, token, parts, { size }))),
|
|
219
|
+
abort: (staging, token) => bucketDo(bucket.abortPut(staging.key, token))
|
|
220
|
+
};
|
|
221
|
+
};
|
|
222
|
+
export { copyPartDefault, heldAt, lfsCopy };
|
package/dist/lfs/layer.d.mts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { Caller } from "../contracts/actors.mjs";
|
|
1
2
|
import { Git } from "../contracts/git.mjs";
|
|
2
|
-
import { LfsGetInput, LfsObject, LfsOptions } from "../contracts/lfs.mjs";
|
|
3
|
+
import { LfsGetInput, LfsGetManyInput, LfsObject, LfsObjects, LfsOptions } from "../contracts/lfs.mjs";
|
|
3
4
|
import { RepoName } from "../contracts/ids.mjs";
|
|
4
5
|
import { GitError } from "../contracts/result.mjs";
|
|
5
6
|
import { LfsBase } from "./base.mjs";
|
|
6
|
-
import * as Effect from "effect/Effect";
|
|
7
7
|
import { Bucket } from "@ref0/infra";
|
|
8
|
+
import * as Effect from "effect/Effect";
|
|
8
9
|
import * as Context from "effect/Context";
|
|
9
10
|
import * as Layer from "effect/Layer";
|
|
10
11
|
declare const Lfs_base: Context.ServiceClass<Lfs, "@ref0/git/Lfs", {
|
|
@@ -13,9 +14,23 @@ declare const Lfs_base: Context.ServiceClass<Lfs, "@ref0/git/Lfs", {
|
|
|
13
14
|
* the repo: the read refusal for any other. `NOT_FOUND` for an object none lists or of
|
|
14
15
|
* another `size`, and, under `access`, for one no ref the caller sees points at, as
|
|
15
16
|
* `privateRefs` says; `DATA_LOSS` for a listed object whose bytes are gone. `signal`
|
|
16
|
-
* aborted cancels the bucket's stream.
|
|
17
|
+
* aborted cancels the bucket's stream. It decides for `by` when given, as `getMany` does,
|
|
18
|
+
* its token's or grant's ceiling with it; else for the actor `input` names.
|
|
19
|
+
*/
|
|
20
|
+
readonly get: (repo: RepoName, input: LfsGetInput, by?: Caller) => Effect.Effect<LfsObject, GitError>;
|
|
21
|
+
/**
|
|
22
|
+
* Many objects at once, every read made but each one's bytes: `readable`, each object the
|
|
23
|
+
* caller may read, by its oid and size, in the order asked, each once, as `get` would read
|
|
24
|
+
* it, a rule's `NOT_FOUND` left out and its other refusals failing the call; and `open`, one
|
|
25
|
+
* bucket read of one of them, charged to the call budget `getMany` ran in. `open` fails
|
|
26
|
+
* `FAILED_PRECONDITION` for an oid outside `readable`, and once `signal`, which the owner
|
|
27
|
+
* aborts when the work the read serves ends, is aborted: an open waiting for the bucket then
|
|
28
|
+
* ends too, and an opened stream is cancelled. 1 to 1,000 objects; another count is
|
|
29
|
+
* `INVALID_ARGUMENT`. It decides for `by` when given, as each call module's call does: a
|
|
30
|
+
* caller `identify` answered, its token's or grant's ceiling with it, or `Git.host`; else
|
|
31
|
+
* for the actor `input` names.
|
|
17
32
|
*/
|
|
18
|
-
readonly
|
|
33
|
+
readonly getMany: (repo: RepoName, input: LfsGetManyInput, by?: Caller) => Effect.Effect<LfsObjects, GitError>;
|
|
19
34
|
}>;
|
|
20
35
|
/** Git LFS's objects, read as a call rather than over git-lfs's own HTTP API. */
|
|
21
36
|
export declare class Lfs extends /* @__PURE__ */ Lfs_base {}
|
package/dist/lfs/layer.mjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { register } from "../contracts/git.mjs";
|
|
2
|
-
import { callerFor, resolvedAs } from "../core/access.mjs";
|
|
2
|
+
import { acting, callerFor, resolvedAs } from "../core/access.mjs";
|
|
3
3
|
import { seenIn } from "../core/objects/reading.mjs";
|
|
4
4
|
import { LfsBase } from "./base.mjs";
|
|
5
5
|
import { lfsCopy } from "./copy.mjs";
|
|
6
|
-
import { objectOf } from "./objects.mjs";
|
|
6
|
+
import { objectOf, objectsOf } from "./objects.mjs";
|
|
7
7
|
import { pointerCheck } from "./pointers.mjs";
|
|
8
8
|
import { lfsPurge } from "./purge.mjs";
|
|
9
9
|
import { lfsService } from "./service.mjs";
|
|
10
10
|
import { lfsUpkeep } from "./upkeep.mjs";
|
|
11
11
|
import { capsRefusal, uploadMostOf } from "./upload-most.mjs";
|
|
12
|
-
import * as Effect from "effect/Effect";
|
|
13
12
|
import { Bucket } from "@ref0/infra";
|
|
13
|
+
import * as Effect from "effect/Effect";
|
|
14
14
|
import * as Context from "effect/Context";
|
|
15
15
|
import * as Layer from "effect/Layer";
|
|
16
16
|
// src/lfs/layer.ts
|
|
@@ -39,7 +39,6 @@ const lfsRegistration = /* @__PURE__ */ Effect.fnUntraced(function* (registratio
|
|
|
39
39
|
uploadMost: uploadMostOf(caps)
|
|
40
40
|
};
|
|
41
41
|
const read = (one) => objectOf(parts, one);
|
|
42
|
-
const callerOf = callerFor(void 0);
|
|
43
42
|
yield* base.attach({
|
|
44
43
|
service: lfsService(needs, parts),
|
|
45
44
|
check: {
|
|
@@ -57,15 +56,28 @@ const lfsRegistration = /* @__PURE__ */ Effect.fnUntraced(function* (registratio
|
|
|
57
56
|
});
|
|
58
57
|
yield* registration.addUpkeep(lfsUpkeep(registration.rows, bucket, links !== void 0));
|
|
59
58
|
yield* registration.addPurge(lfsPurge(registration.rows, bucket));
|
|
60
|
-
return Lfs.of({
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
59
|
+
return Lfs.of({
|
|
60
|
+
get: (repo, { oid, size, signal, internalId, request, ...input }, by) => Effect.provideContext(acting(by, read({
|
|
61
|
+
caller: callerFor(by)(input),
|
|
62
|
+
repo,
|
|
63
|
+
oid,
|
|
64
|
+
size,
|
|
65
|
+
signal,
|
|
66
|
+
internalId,
|
|
67
|
+
request
|
|
68
|
+
})), needs),
|
|
69
|
+
getMany: (repo, { objects, signal, internalId, request, ...input }, by) => Effect.provideContext(Effect.map(acting(by, objectsOf(parts, {
|
|
70
|
+
caller: callerFor(by)(input),
|
|
71
|
+
repo,
|
|
72
|
+
objects,
|
|
73
|
+
signal,
|
|
74
|
+
internalId,
|
|
75
|
+
request
|
|
76
|
+
})), ({ readable, open }) => ({
|
|
77
|
+
readable,
|
|
78
|
+
open: (oid) => Effect.provideContext(open(oid), needs)
|
|
79
|
+
})), needs)
|
|
80
|
+
});
|
|
69
81
|
});
|
|
70
82
|
/**
|
|
71
83
|
* Git LFS, a feature over core: it registers `lfs`, keeps its objects in the host's `Bucket`, and
|
package/dist/lfs/locks.mjs
CHANGED
|
@@ -6,9 +6,9 @@ import { decodeRow } from "../store/errors.mjs";
|
|
|
6
6
|
import { randomText } from "../store/random.mjs";
|
|
7
7
|
import { LockRow, lfsCollections, lockKey, lockRead } from "./rows.mjs";
|
|
8
8
|
import { LockCreate, LockQuery, LockVerify, Unlock, bodyOf, lfsAnswer } from "./wire.mjs";
|
|
9
|
-
import * as Clock$1 from "effect/Clock";
|
|
10
|
-
import * as Effect from "effect/Effect";
|
|
11
9
|
import * as Schema from "effect/Schema";
|
|
10
|
+
import * as Effect from "effect/Effect";
|
|
11
|
+
import * as Clock from "effect/Clock";
|
|
12
12
|
import * as DateTime from "effect/DateTime";
|
|
13
13
|
// src/lfs/locks.ts
|
|
14
14
|
/**
|
|
@@ -58,7 +58,7 @@ const createLock = /* @__PURE__ */ Effect.fnUntraced(function* (parts, call) {
|
|
|
58
58
|
const value = {
|
|
59
59
|
path,
|
|
60
60
|
owner,
|
|
61
|
-
lockedAt: yield* Clock
|
|
61
|
+
lockedAt: yield* Clock.currentTimeMillis,
|
|
62
62
|
held: randomText(12)
|
|
63
63
|
};
|
|
64
64
|
if ((yield* parts.rows.commit(repo.internalId, read.version, { put: [{
|
package/dist/lfs/objects.d.mts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import "../core/parts.mjs";
|
|
2
2
|
import "../contracts/objects.mjs";
|
|
3
3
|
import { Caller } from "../contracts/actors.mjs";
|
|
4
|
+
import "../contracts/lfs.mjs";
|
|
4
5
|
import "../contracts/git.mjs";
|
|
5
6
|
import { InternalRepoId, RepoName } from "../contracts/ids.mjs";
|
|
6
7
|
import "../contracts/result.mjs";
|
|
7
|
-
import "effect/Effect";
|
|
8
8
|
import { Key } from "@ref0/infra";
|
|
9
|
+
import "effect/Effect";
|
|
9
10
|
/** One request to a repo's `info/lfs/`, from a caller `identify` answered. */
|
|
10
11
|
export interface LfsCall {
|
|
11
12
|
readonly caller: Caller;
|
package/dist/lfs/objects.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { dropBody } from "../protocol/bytes/reader.mjs";
|
|
1
2
|
import { gathered } from "../protocol/bytes/streams.mjs";
|
|
2
3
|
import { contended, openFor } from "../core/access.mjs";
|
|
3
4
|
import { ownWriter } from "../core/own-writes.mjs";
|
|
@@ -8,19 +9,21 @@ import { utf8 } from "../protocol/bytes/text.mjs";
|
|
|
8
9
|
import { objectId } from "../protocol/objects/object.mjs";
|
|
9
10
|
import { bestEffort, decodeRow } from "../store/errors.mjs";
|
|
10
11
|
import { randomText } from "../store/random.mjs";
|
|
12
|
+
import { bodyUntilAborted } from "../store/bodies.mjs";
|
|
11
13
|
import { bucketCall, bucketDo, bucketFailed, bucketStream } from "../storage/calls.mjs";
|
|
14
|
+
import { CallBudget } from "../store/call-count.mjs";
|
|
12
15
|
import { isLfsOid, lfsPointerText } from "../protocol/objects/lfs-pointer.mjs";
|
|
13
16
|
import { ListedRow, UploadRow, largestObject, lfsCollections, linkLife, listedKey, listedRead, objectKey, stagingId, stagingKey, stagingRead, streamMost, uploadGrace, uploadKey, uploadRead } from "./rows.mjs";
|
|
14
17
|
import { BatchRequest, VerifyRequest, batchMost, bodyOf, lfsAnswer } from "./wire.mjs";
|
|
15
18
|
import { uploadedRow } from "./uploaded.mjs";
|
|
16
19
|
import { pastMost, uploadPieceBytes } from "./upload-most.mjs";
|
|
17
20
|
import { fail, gitError, httpStatus } from "../contracts/result.mjs";
|
|
18
|
-
import
|
|
21
|
+
import { Unavailable } from "@ref0/infra";
|
|
19
22
|
import * as Effect from "effect/Effect";
|
|
23
|
+
import * as Stream from "effect/Stream";
|
|
20
24
|
import * as Option from "effect/Option";
|
|
21
25
|
import * as Result from "effect/Result";
|
|
22
|
-
import
|
|
23
|
-
import * as Stream from "effect/Stream";
|
|
26
|
+
import * as Clock from "effect/Clock";
|
|
24
27
|
import * as DateTime from "effect/DateTime";
|
|
25
28
|
// src/lfs/objects.ts
|
|
26
29
|
/**
|
|
@@ -196,7 +199,7 @@ const downloads = /* @__PURE__ */ Effect.fnUntraced(function* (parts, call, repo
|
|
|
196
199
|
const chained = yield* chainListed(parts.rows, repo, oids);
|
|
197
200
|
const listed = yield* seenListed(call.caller, repo, oids, chained);
|
|
198
201
|
const refused = yield* refusedOf(call, listed);
|
|
199
|
-
const expiresAt = (yield* Clock
|
|
202
|
+
const expiresAt = (yield* Clock.currentTimeMillis) + linkLife;
|
|
200
203
|
const answers = /* @__PURE__ */ new Map();
|
|
201
204
|
for (const { oid, size } of objects) {
|
|
202
205
|
const row = listed.get(oid);
|
|
@@ -234,7 +237,7 @@ const downloads = /* @__PURE__ */ Effect.fnUntraced(function* (parts, call, repo
|
|
|
234
237
|
const uploads = /* @__PURE__ */ Effect.fnUntraced(function* (parts, call, repo, objects) {
|
|
235
238
|
const oids = objects.map(({ oid }) => oid);
|
|
236
239
|
for (let tries = 0; tries < 5; tries += 1) {
|
|
237
|
-
const at = yield* Clock
|
|
240
|
+
const at = yield* Clock.currentTimeMillis;
|
|
238
241
|
const asked = tries === 0 ? repo : void 0;
|
|
239
242
|
const read = yield* objectRows(parts.rows, call.caller, repo, oids, { asked });
|
|
240
243
|
const unseen = yield* unseenRows(call.caller, repo, oids, read.rows);
|
|
@@ -307,7 +310,7 @@ const verify = /* @__PURE__ */ Effect.fnUntraced(function* (parts, call) {
|
|
|
307
310
|
const repo = yield* openFor(call.caller, call.repo, true, void 0, "first-read");
|
|
308
311
|
const writer = yield* ownWriter(call.caller);
|
|
309
312
|
for (let tries = 0; tries < 5; tries += 1) {
|
|
310
|
-
const at = yield* Clock
|
|
313
|
+
const at = yield* Clock.currentTimeMillis;
|
|
311
314
|
const asked = tries === 0 ? repo : void 0;
|
|
312
315
|
const read = yield* objectRows(registered, call.caller, repo, [oid], { asked });
|
|
313
316
|
const rows = read.rows.get(oid);
|
|
@@ -350,7 +353,7 @@ const receive = /* @__PURE__ */ Effect.fnUntraced(function* (parts, call, oid) {
|
|
|
350
353
|
if (length > parts.uploadMost.bytes) return lfsAnswer(413, { message: pastMost(parts.uploadMost) });
|
|
351
354
|
const { rows: registered, bucket } = parts;
|
|
352
355
|
const repo = yield* openFor(call.caller, call.repo, true, void 0, "first-read");
|
|
353
|
-
const started = yield* Clock
|
|
356
|
+
const started = yield* Clock.currentTimeMillis;
|
|
354
357
|
const read = yield* objectRows(registered, call.caller, repo, [oid], { asked: repo });
|
|
355
358
|
const rows = read.rows.get(oid);
|
|
356
359
|
const unseen = (yield* unseenRows(call.caller, repo, [oid], read.rows)).has(oid);
|
|
@@ -384,8 +387,8 @@ const receive = /* @__PURE__ */ Effect.fnUntraced(function* (parts, call, oid) {
|
|
|
384
387
|
});
|
|
385
388
|
/**
|
|
386
389
|
* `count` staging keys in `repo`, each row added with upkeep's wake at `removeAt`: bytes put at a
|
|
387
|
-
* key that no commit lists by then are deleted, as `endStages` does. A Worker upload's
|
|
388
|
-
*
|
|
390
|
+
* key that no commit lists by then are deleted, as `endStages` does. A Worker upload's: an import's
|
|
391
|
+
* copy stages a key per object, as `LfsCopy.stage` says.
|
|
389
392
|
*/
|
|
390
393
|
const stagedKeys = /* @__PURE__ */ Effect.fnUntraced(function* (rows, repo, removeAt, count) {
|
|
391
394
|
const staging = Array.from({ length: count }, () => {
|
|
@@ -440,10 +443,7 @@ const shortSize = (size, sent) => gitError("INVALID_ARGUMENT", `The bytes end at
|
|
|
440
443
|
* An answer to a request whose body isn't needed: the body is let go first, and a cancel that
|
|
441
444
|
* rejects is no reason to fail an upload that's done.
|
|
442
445
|
*/
|
|
443
|
-
const answered = (request) => Effect.
|
|
444
|
-
await request.body?.cancel();
|
|
445
|
-
return lfsAnswer(200, { message: "Already uploaded" });
|
|
446
|
-
});
|
|
446
|
+
const answered = (request) => Effect.as(dropBody(request.body), lfsAnswer(200, { message: "Already uploaded" }));
|
|
447
447
|
/**
|
|
448
448
|
* `body` as it streams to the bucket, gathered into pieces of `uploadPieceBytes` and counted,
|
|
449
449
|
* failing past `most` bytes, or at its end short of them, before the bucket checks its hash. No
|
|
@@ -475,7 +475,7 @@ const counted = (body, most) => {
|
|
|
475
475
|
const listStaged = /* @__PURE__ */ Effect.fnUntraced(function* (registered, caller, repo, staged) {
|
|
476
476
|
const writer = yield* ownWriter(caller);
|
|
477
477
|
for (let tries = 0; tries < 5; tries += 1) {
|
|
478
|
-
const at = yield* Clock
|
|
478
|
+
const at = yield* Clock.currentTimeMillis;
|
|
479
479
|
const own = writer === void 0 ? [] : [uploadedRow(writer, staged.oid, at)];
|
|
480
480
|
const read = yield* objectRows(registered, caller, repo, [staged.oid], { also: [stagingRead(staged.staged)] });
|
|
481
481
|
if (read.rows.get(staged.oid)?.listed !== void 0) {
|
|
@@ -487,7 +487,7 @@ const listStaged = /* @__PURE__ */ Effect.fnUntraced(function* (registered, call
|
|
|
487
487
|
})).ok) return answer;
|
|
488
488
|
continue;
|
|
489
489
|
}
|
|
490
|
-
if ((read.also[0] ?? []).length === 0 || (yield* Clock
|
|
490
|
+
if ((read.also[0] ?? []).length === 0 || (yield* Clock.currentTimeMillis) > staged.deadline) return yield* fail("DEADLINE_EXCEEDED", "The upload ran too long", { hint: "Upload it again" });
|
|
491
491
|
if ((yield* registered.commit(repo.internalId, read.version, {
|
|
492
492
|
put: [{
|
|
493
493
|
...listedKey(staged.oid),
|
|
@@ -527,15 +527,85 @@ const objectOf = /* @__PURE__ */ Effect.fnUntraced(function* (parts, read) {
|
|
|
527
527
|
},
|
|
528
528
|
request: read.request
|
|
529
529
|
});
|
|
530
|
-
const
|
|
531
|
-
if (
|
|
532
|
-
const bytes = signal === void 0 ? stream : stream.pipeThrough(new TransformStream(), { signal });
|
|
530
|
+
const bytes = yield* Effect.uninterruptible(Effect.map(bucketStream(parts.bucket, listed.key), (stream) => stream === void 0 || signal === void 0 ? stream : bodyUntilAborted(stream, signal)));
|
|
531
|
+
if (bytes === void 0) return yield* fail("DATA_LOSS", `LFS object ${oid}'s bytes are missing`);
|
|
533
532
|
return {
|
|
534
533
|
oid,
|
|
535
534
|
size: listed.size,
|
|
536
535
|
bytes
|
|
537
536
|
};
|
|
538
537
|
});
|
|
538
|
+
/** `objectsOf`'s handle's refusal once its signal is aborted. */
|
|
539
|
+
const handleEnded = fail("FAILED_PRECONDITION", "The read of many LFS objects has ended", { context: { reason: "handle-ended" } });
|
|
540
|
+
/** Fails as `handleEnded` once `signal` is aborted, and waits until then. */
|
|
541
|
+
const endedBy = (signal) => Effect.callback((resume) => {
|
|
542
|
+
const end = () => resume(handleEnded);
|
|
543
|
+
if (signal.aborted) return end();
|
|
544
|
+
signal.addEventListener("abort", end, { once: true });
|
|
545
|
+
return Effect.sync(() => signal.removeEventListener("abort", end));
|
|
546
|
+
});
|
|
547
|
+
/**
|
|
548
|
+
* Many objects at once, for one caller: every read but the bytes' made before it answers, so a
|
|
549
|
+
* caller that must know its reads before it streams, as an archive's 200, knows them. It opens the
|
|
550
|
+
* repo once, lists the objects up the fork chain once, asks the caller's view of every pointer
|
|
551
|
+
* once and the host's fetch rules of each object it lists, each asked once. `readable` is what
|
|
552
|
+
* the caller may read, in the order asked, each once: an object no repo in the chain lists, of
|
|
553
|
+
* another size, unseen in a narrowed view or that a rule answers `NOT_FOUND` for is left out, and
|
|
554
|
+
* a rule's other refusal fails the call. `open` reads one of `readable`'s from the bucket, one call,
|
|
555
|
+
* in the budget the call was made in; it fails `FAILED_PRECONDITION` for an oid outside
|
|
556
|
+
* `readable`, which this call never answered may be read, or once `signal` is aborted, which
|
|
557
|
+
* also interrupts an open waiting for the bucket and cancels an opened stream. 1 to `batchMost`
|
|
558
|
+
* objects.
|
|
559
|
+
*/
|
|
560
|
+
const objectsOf = /* @__PURE__ */ Effect.fnUntraced(function* (parts, read) {
|
|
561
|
+
const { caller, signal } = read;
|
|
562
|
+
if (read.objects.length === 0 || read.objects.length > 1e3) return yield* fail("INVALID_ARGUMENT", `A read of many LFS objects names 1 to ${batchMost}`);
|
|
563
|
+
const repo = yield* openFor(caller, read.repo, false, read.internalId, "first-read");
|
|
564
|
+
const asked = read.objects.filter(({ oid, size }) => isLfsOid(oid) && validSize(size));
|
|
565
|
+
const oids = [...new Set(asked.map(({ oid }) => oid))];
|
|
566
|
+
const chained = yield* chainListed(parts.rows, repo, oids);
|
|
567
|
+
const listed = yield* seenListed(caller, repo, oids, chained);
|
|
568
|
+
const readable = /* @__PURE__ */ new Map();
|
|
569
|
+
const checked = /* @__PURE__ */ new Set();
|
|
570
|
+
for (const { oid, size } of asked) {
|
|
571
|
+
const row = listed.get(oid);
|
|
572
|
+
if (row === void 0 || row.size !== size || checked.has(oid)) continue;
|
|
573
|
+
checked.add(oid);
|
|
574
|
+
const target = {
|
|
575
|
+
kind: "lfs",
|
|
576
|
+
oid,
|
|
577
|
+
size: row.size
|
|
578
|
+
};
|
|
579
|
+
const refusal = yield* readRefusal(read.repo, {
|
|
580
|
+
caller,
|
|
581
|
+
target,
|
|
582
|
+
request: read.request
|
|
583
|
+
});
|
|
584
|
+
if (refusal?.code === "NOT_FOUND") continue;
|
|
585
|
+
if (refusal !== void 0) return yield* Effect.fail(refusal);
|
|
586
|
+
readable.set(oid, row);
|
|
587
|
+
}
|
|
588
|
+
const budget = yield* Effect.serviceOption(CallBudget);
|
|
589
|
+
const opened = (oid, row) => Effect.flatMap(Effect.uninterruptible(Effect.map(bucketStream(parts.bucket, row.key), (stream) => stream === void 0 ? void 0 : bodyUntilAborted(stream, signal))), (bytes) => bytes === void 0 ? fail("DATA_LOSS", `LFS object ${oid}'s bytes are missing`) : Effect.succeed({
|
|
590
|
+
oid,
|
|
591
|
+
size: row.size,
|
|
592
|
+
bytes
|
|
593
|
+
}));
|
|
594
|
+
const open = (oid) => Effect.suspend(() => {
|
|
595
|
+
if (signal.aborted) return handleEnded;
|
|
596
|
+
const row = readable.get(oid);
|
|
597
|
+
if (row === void 0) return fail("FAILED_PRECONDITION", `LFS object ${oid} isn't one this read may open`, { context: { reason: "not-readable" } });
|
|
598
|
+
const opening = Option.isSome(budget) ? Effect.provideService(opened(oid, row), CallBudget, budget.value) : opened(oid, row);
|
|
599
|
+
return Effect.raceFirst(opening, endedBy(signal));
|
|
600
|
+
});
|
|
601
|
+
return {
|
|
602
|
+
readable: [...readable].map(([oid, row]) => ({
|
|
603
|
+
oid,
|
|
604
|
+
size: row.size
|
|
605
|
+
})),
|
|
606
|
+
open
|
|
607
|
+
};
|
|
608
|
+
});
|
|
539
609
|
/**
|
|
540
610
|
* `GET objects/<oid>`, a Worker download: a listed object's bytes, the repo's own or a source's,
|
|
541
611
|
* as `objectOf` reads them. Its fetch rules are asked again, though the batch that gave the link
|
|
@@ -557,4 +627,4 @@ const send = /* @__PURE__ */ Effect.fnUntraced(function* (parts, call, oid) {
|
|
|
557
627
|
}
|
|
558
628
|
});
|
|
559
629
|
});
|
|
560
|
-
export { batch, listedOf, objectOf, receive, send, stagedKeys, verify };
|
|
630
|
+
export { batch, listedOf, objectOf, objectsOf, receive, send, stagedKeys, verify };
|
package/dist/lfs/pointers.mjs
CHANGED
|
@@ -10,8 +10,8 @@ import { lfsPointerText } from "../protocol/objects/lfs-pointer.mjs";
|
|
|
10
10
|
import { lfsOidAt, lfsSizeAt, pointersOfBlob } from "../storage/lfs-pointers.mjs";
|
|
11
11
|
import { listedOf } from "./objects.mjs";
|
|
12
12
|
import { uploadedOf } from "./uploaded.mjs";
|
|
13
|
-
import * as Clock$1 from "effect/Clock";
|
|
14
13
|
import * as Effect from "effect/Effect";
|
|
14
|
+
import * as Clock from "effect/Clock";
|
|
15
15
|
// src/lfs/pointers.ts
|
|
16
16
|
/**
|
|
17
17
|
* LFS's push rule: a ref whose new tip holds, in a tree the push carries, a Git LFS pointer the
|
|
@@ -117,7 +117,7 @@ const unprovenOf = /* @__PURE__ */ Effect.fnUntraced(function* (rows, input, ent
|
|
|
117
117
|
const unseen = [...blobs].flatMap(([blob, oid]) => seen.has(blob) ? [] : [oid]);
|
|
118
118
|
if (unseen.length === 0) return unproven;
|
|
119
119
|
const writer = yield* ownWriter(input.caller);
|
|
120
|
-
const at = yield* Clock
|
|
120
|
+
const at = yield* Clock.currentTimeMillis;
|
|
121
121
|
const own = writer === void 0 ? /* @__PURE__ */ new Set() : yield* uploadedOf(rows, repo, writer, unseen, at);
|
|
122
122
|
for (const oid of unseen) if (!own.has(oid)) unproven.add(oid);
|
|
123
123
|
return unproven;
|
package/dist/lfs/rows.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "../contracts/ids.mjs";
|
|
2
|
-
import * as Schema from "effect/Schema";
|
|
3
2
|
import { Key, Moment, Read } from "@ref0/infra";
|
|
3
|
+
import * as Schema from "effect/Schema";
|
|
4
4
|
/**
|
|
5
5
|
* A listed object: its bytes are at `key`, checked. A signed upload's are at its upload row's
|
|
6
6
|
* `objectKey`, and a Worker upload's stay at the staging key they streamed to, which only they
|