@ref0/git 0.0.0-stage → 0.2.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/LICENSE +202 -0
- package/dist/access/private-refs.d.mts +27 -0
- package/dist/access/private-refs.mjs +173 -0
- package/dist/access.d.mts +2 -0
- package/dist/access.mjs +1 -0
- package/dist/auth/access-jwt.d.mts +21 -0
- package/dist/auth/access-jwt.mjs +102 -0
- package/dist/auth/acting.mjs +15 -0
- package/dist/auth/authorize.d.mts +5 -0
- package/dist/auth/authorize.mjs +292 -0
- package/dist/auth/credentials.mjs +57 -0
- package/dist/auth/fences.d.mts +5 -0
- package/dist/auth/fences.mjs +65 -0
- package/dist/auth/grants.mjs +61 -0
- package/dist/auth/helpers.d.mts +17 -0
- package/dist/auth/helpers.mjs +25 -0
- package/dist/auth/host-function.d.mts +4 -0
- package/dist/auth/host-function.mjs +69 -0
- package/dist/auth/identify.d.mts +6 -0
- package/dist/auth/identify.mjs +97 -0
- package/dist/auth/token-rows.mjs +100 -0
- package/dist/auth/token-text.mjs +66 -0
- package/dist/auth/tokens.d.mts +10 -0
- package/dist/auth/tokens.mjs +347 -0
- package/dist/auth.d.mts +7 -0
- package/dist/auth.mjs +6 -0
- package/dist/client/answer.mjs +141 -0
- package/dist/client/client.d.mts +23 -0
- package/dist/client/client.mjs +51 -0
- package/dist/client/git-http.mjs +201 -0
- package/dist/client/helper-node.mjs +19 -0
- package/dist/client/local.mjs +160 -0
- package/dist/client/negotiate.mjs +170 -0
- package/dist/client/push-upload.mjs +53 -0
- package/dist/client/remote-helper.mjs +129 -0
- package/dist/client/remote.mjs +398 -0
- package/dist/client/run-remote-helper.d.mts +35 -0
- package/dist/client/run-remote-helper.mjs +259 -0
- package/dist/client/scrub.d.mts +18 -0
- package/dist/client/scrub.mjs +38 -0
- package/dist/client/transport.d.mts +2 -0
- package/dist/client/transport.mjs +211 -0
- package/dist/contracts/access.d.mts +87 -0
- package/dist/contracts/actors.d.mts +144 -0
- package/dist/contracts/blobs.d.mts +38 -0
- package/dist/contracts/calls-spent.d.mts +11 -0
- package/dist/contracts/calls-spent.mjs +150 -0
- package/dist/contracts/client.d.mts +90 -0
- package/dist/contracts/commits.d.mts +126 -0
- package/dist/contracts/engine.d.mts +134 -0
- package/dist/contracts/events.d.mts +276 -0
- package/dist/contracts/files.d.mts +75 -0
- package/dist/contracts/forks.d.mts +78 -0
- package/dist/contracts/grants.d.mts +60 -0
- package/dist/contracts/handlers.d.mts +10 -0
- package/dist/contracts/ids.d.mts +15 -0
- package/dist/contracts/ids.mjs +15 -0
- package/dist/contracts/lfs.d.mts +27 -0
- package/dist/contracts/merges.d.mts +33 -0
- package/dist/contracts/objects.d.mts +645 -0
- package/dist/contracts/objects.mjs +54 -0
- package/dist/contracts/operations.d.mts +133 -0
- package/dist/contracts/promises.d.mts +63 -0
- package/dist/contracts/push-uploads.d.mts +44 -0
- package/dist/contracts/queue.d.mts +401 -0
- package/dist/contracts/refs.d.mts +95 -0
- package/dist/contracts/remote.d.mts +50 -0
- package/dist/contracts/repos.d.mts +153 -0
- package/dist/contracts/result.d.mts +126 -0
- package/dist/contracts/result.mjs +34 -0
- package/dist/contracts/rules.d.mts +159 -0
- package/dist/contracts/server.d.mts +245 -0
- package/dist/contracts/services.d.mts +36 -0
- package/dist/contracts/services.mjs +13 -0
- package/dist/contracts/signin.d.mts +126 -0
- package/dist/contracts/store.d.mts +41 -0
- package/dist/contracts/sync.d.mts +210 -0
- package/dist/contracts/sync.mjs +8 -0
- package/dist/contracts/tags.d.mts +50 -0
- package/dist/contracts/tags.mjs +6 -0
- package/dist/contracts/tokens.d.mts +87 -0
- package/dist/contracts/tokens.mjs +15 -0
- package/dist/contracts/topics.d.mts +174 -0
- package/dist/contracts/trees.d.mts +84 -0
- package/dist/contracts/work.d.mts +31 -0
- package/dist/core/access.d.mts +22 -0
- package/dist/core/access.mjs +262 -0
- package/dist/core/ancestry.mjs +235 -0
- package/dist/core/clock.mjs +18 -0
- package/dist/core/events/deliver.mjs +468 -0
- package/dist/core/events/stream.d.mts +19 -0
- package/dist/core/events/stream.mjs +290 -0
- package/dist/core/forks.mjs +1027 -0
- package/dist/core/hooks/post-receive.mjs +204 -0
- package/dist/core/hooks/pre-receive.d.mts +5 -0
- package/dist/core/hooks/pre-receive.mjs +34 -0
- package/dist/core/index-job.mjs +198 -0
- package/dist/core/names.mjs +30 -0
- package/dist/core/objects/blobs.mjs +60 -0
- package/dist/core/objects/commit-writes.mjs +185 -0
- package/dist/core/objects/commits.mjs +172 -0
- package/dist/core/objects/files.mjs +211 -0
- package/dist/core/objects/lines.mjs +42 -0
- package/dist/core/objects/merges.mjs +83 -0
- package/dist/core/objects/peel.mjs +166 -0
- package/dist/core/objects/reading.mjs +284 -0
- package/dist/core/objects/tags.mjs +96 -0
- package/dist/core/objects/tree-edits.mjs +266 -0
- package/dist/core/objects/trees.mjs +229 -0
- package/dist/core/objects/writing.mjs +266 -0
- package/dist/core/own-writes.mjs +94 -0
- package/dist/core/promise.mjs +46 -0
- package/dist/core/publish.mjs +142 -0
- package/dist/core/push-decide.mjs +206 -0
- package/dist/core/push.mjs +1069 -0
- package/dist/core/receipts.d.mts +7 -0
- package/dist/core/receipts.mjs +234 -0
- package/dist/core/ref-conflicts.mjs +27 -0
- package/dist/core/refs.mjs +359 -0
- package/dist/core/repack.mjs +521 -0
- package/dist/core/repos.mjs +752 -0
- package/dist/core/rules/changes.mjs +57 -0
- package/dist/core/rules/check.mjs +101 -0
- package/dist/core/rules/commit-changes.mjs +216 -0
- package/dist/core/rules/context.d.mts +9 -0
- package/dist/core/rules/context.mjs +120 -0
- package/dist/core/rules/define.d.mts +5 -0
- package/dist/core/rules/define.mjs +13 -0
- package/dist/core/rules/facts.mjs +13 -0
- package/dist/core/rules/fetch.d.mts +5 -0
- package/dist/core/rules/fetch.mjs +59 -0
- package/dist/core/rules/file-globs.mjs +55 -0
- package/dist/core/rules/files.mjs +142 -0
- package/dist/core/rules/patterns.mjs +23 -0
- package/dist/core/rules/protect.d.mts +9 -0
- package/dist/core/rules/protect.mjs +116 -0
- package/dist/core/seam.d.mts +24 -0
- package/dist/core/seam.mjs +41 -0
- package/dist/core/sight.mjs +99 -0
- package/dist/core/tokens.mjs +95 -0
- package/dist/core/view.d.mts +9 -0
- package/dist/core/view.mjs +221 -0
- package/dist/core/work.mjs +92 -0
- package/dist/effect.d.mts +20 -0
- package/dist/effect.mjs +18 -0
- package/dist/engine/allotted-xdiff.d.mts +4 -0
- package/dist/engine/allotted-xdiff.mjs +80 -0
- package/dist/engine/attribute-patterns.mjs +163 -0
- package/dist/engine/attributes.mjs +226 -0
- package/dist/engine/combined.mjs +653 -0
- package/dist/engine/commits.mjs +90 -0
- package/dist/engine/content.d.mts +4 -0
- package/dist/engine/content.mjs +221 -0
- package/dist/engine/diff.mjs +49 -0
- package/dist/engine/engine.d.mts +25 -0
- package/dist/engine/engine.mjs +49 -0
- package/dist/engine/failures.d.mts +4 -0
- package/dist/engine/failures.mjs +23 -0
- package/dist/engine/line-count.mjs +23 -0
- package/dist/engine/merge-base-walk.d.mts +2 -0
- package/dist/engine/merge-base-walk.mjs +265 -0
- package/dist/engine/merge-bases.mjs +27 -0
- package/dist/engine/merge-renames.mjs +165 -0
- package/dist/engine/merge.mjs +1125 -0
- package/dist/engine/parts.d.mts +8 -0
- package/dist/engine/parts.mjs +9 -0
- package/dist/engine/reads.d.mts +5 -0
- package/dist/engine/reads.mjs +105 -0
- package/dist/engine/walk.mjs +328 -0
- package/dist/engine/xdiff/NOTICE.md +63 -0
- package/dist/engine/xdiff/compiled.d.mts +7 -0
- package/dist/engine/xdiff/compiled.mjs +9 -0
- package/dist/engine/xdiff/embedded.mjs +4 -0
- package/dist/engine/xdiff/node.d.mts +7 -0
- package/dist/engine/xdiff/node.mjs +10 -0
- package/dist/engine/xdiff/upstream/LGPL-2.1 +511 -0
- package/dist/engine/xdiff/xdiff.wasm +0 -0
- package/dist/engine/xdiff.d.mts +34 -0
- package/dist/engine/xdiff.mjs +380 -0
- package/dist/engine.d.mts +3 -0
- package/dist/engine.mjs +3 -0
- package/dist/extend.d.mts +3 -0
- package/dist/extend.mjs +1 -0
- package/dist/http/answers.mjs +74 -0
- package/dist/http/bodies.mjs +143 -0
- package/dist/http/core-parts.mjs +252 -0
- package/dist/http/fetch-depth.mjs +26 -0
- package/dist/http/handler.mjs +94 -0
- package/dist/http/node.d.mts +70 -0
- package/dist/http/node.mjs +178 -0
- package/dist/http/paths.d.mts +9 -0
- package/dist/http/paths.mjs +118 -0
- package/dist/http/push-uploads.mjs +286 -0
- package/dist/http/receive-pack.mjs +235 -0
- package/dist/http/upload-pack.mjs +229 -0
- package/dist/index.d.mts +46 -0
- package/dist/index.mjs +16 -0
- package/dist/lfs/calls.mjs +16 -0
- package/dist/lfs/locks.mjs +161 -0
- package/dist/lfs/objects.mjs +370 -0
- package/dist/lfs/pointers.mjs +141 -0
- package/dist/lfs/repo.mjs +42 -0
- package/dist/lfs/rows.mjs +108 -0
- package/dist/lfs/service.mjs +34 -0
- package/dist/lfs/upkeep.mjs +162 -0
- package/dist/lfs/wire.mjs +102 -0
- package/dist/node.d.mts +3 -0
- package/dist/node.mjs +3 -0
- package/dist/protocol/bytes/buffers.d.mts +38 -0
- package/dist/protocol/bytes/buffers.mjs +62 -0
- package/dist/protocol/bytes/crc32.d.mts +4 -0
- package/dist/protocol/bytes/crc32.mjs +14 -0
- package/dist/protocol/bytes/deflate.d.mts +78 -0
- package/dist/protocol/bytes/deflate.mjs +175 -0
- package/dist/protocol/bytes/errors.d.mts +20 -0
- package/dist/protocol/bytes/errors.mjs +19 -0
- package/dist/protocol/bytes/hex.mjs +16 -0
- package/dist/protocol/bytes/hmac-sha256.mjs +91 -0
- package/dist/protocol/bytes/inflate.d.mts +40 -0
- package/dist/protocol/bytes/inflate.mjs +109 -0
- package/dist/protocol/bytes/joined.d.mts +2 -0
- package/dist/protocol/bytes/joined.mjs +25 -0
- package/dist/protocol/bytes/sha1-hasher.d.mts +20 -0
- package/dist/protocol/bytes/sha1-hasher.mjs +72 -0
- package/dist/protocol/bytes/sha1.d.mts +35 -0
- package/dist/protocol/bytes/sha1.mjs +409 -0
- package/dist/protocol/bytes/sha256.mjs +156 -0
- package/dist/protocol/bytes/streams.mjs +11 -0
- package/dist/protocol/bytes/text.mjs +19 -0
- package/dist/protocol/diff/diff-raw.d.mts +29 -0
- package/dist/protocol/diff/diff-raw.mjs +73 -0
- package/dist/protocol/diff/patch.mjs +92 -0
- package/dist/protocol/diff/paths.mjs +67 -0
- package/dist/protocol/diff/read.d.mts +62 -0
- package/dist/protocol/diff/read.mjs +342 -0
- package/dist/protocol/diff/rename-similarity.mjs +428 -0
- package/dist/protocol/diff/text.mjs +12 -0
- package/dist/protocol/diff/tree-diff.d.mts +41 -0
- package/dist/protocol/diff/tree-diff.mjs +607 -0
- package/dist/protocol/framing/band.d.mts +10 -0
- package/dist/protocol/framing/band.mjs +16 -0
- package/dist/protocol/framing/pkt-line.d.mts +48 -0
- package/dist/protocol/framing/pkt-line.mjs +92 -0
- package/dist/protocol/objects/checked-blobs.mjs +127 -0
- package/dist/protocol/objects/commit.d.mts +25 -0
- package/dist/protocol/objects/commit.mjs +138 -0
- package/dist/protocol/objects/fsck-gitmodules.mjs +296 -0
- package/dist/protocol/objects/fsck-names.mjs +189 -0
- package/dist/protocol/objects/fsck.mjs +297 -0
- package/dist/protocol/objects/headers.mjs +109 -0
- package/dist/protocol/objects/held.mjs +56 -0
- package/dist/protocol/objects/iconv.mjs +145 -0
- package/dist/protocol/objects/ident.mjs +111 -0
- package/dist/protocol/objects/lfs-pointer.d.mts +8 -0
- package/dist/protocol/objects/lfs-pointer.mjs +63 -0
- package/dist/protocol/objects/links-raw.mjs +89 -0
- package/dist/protocol/objects/object-rules.mjs +75 -0
- package/dist/protocol/objects/object.d.mts +16 -0
- package/dist/protocol/objects/object.mjs +29 -0
- package/dist/protocol/objects/tag.d.mts +21 -0
- package/dist/protocol/objects/tag.mjs +96 -0
- package/dist/protocol/objects/tree.d.mts +43 -0
- package/dist/protocol/objects/tree.mjs +162 -0
- package/dist/protocol/objects/utf8-verify.mjs +71 -0
- package/dist/protocol/packs/delta.d.mts +57 -0
- package/dist/protocol/packs/delta.mjs +229 -0
- package/dist/protocol/packs/graph.mjs +78 -0
- package/dist/protocol/packs/idx.d.mts +54 -0
- package/dist/protocol/packs/idx.mjs +274 -0
- package/dist/protocol/packs/indexer.d.mts +167 -0
- package/dist/protocol/packs/indexer.mjs +507 -0
- package/dist/protocol/packs/parts.d.mts +40 -0
- package/dist/protocol/packs/parts.mjs +89 -0
- package/dist/protocol/packs/pos.mjs +51 -0
- package/dist/protocol/packs/reader.d.mts +180 -0
- package/dist/protocol/packs/reader.mjs +414 -0
- package/dist/protocol/packs/rev.d.mts +32 -0
- package/dist/protocol/packs/rev.mjs +99 -0
- package/dist/protocol/packs/step.d.mts +10 -0
- package/dist/protocol/packs/step.mjs +12 -0
- package/dist/protocol/packs/write-error.d.mts +12 -0
- package/dist/protocol/packs/write-error.mjs +27 -0
- package/dist/protocol/packs/writer.d.mts +157 -0
- package/dist/protocol/packs/writer.mjs +353 -0
- package/dist/protocol/wire/advertisement.d.mts +72 -0
- package/dist/protocol/wire/advertisement.mjs +161 -0
- package/dist/protocol/wire/fetch.d.mts +155 -0
- package/dist/protocol/wire/fetch.mjs +458 -0
- package/dist/protocol/wire/lines.mjs +107 -0
- package/dist/protocol/wire/push-uploads.mjs +43 -0
- package/dist/protocol/wire/receive-pack.d.mts +71 -0
- package/dist/protocol/wire/receive-pack.mjs +157 -0
- package/dist/protocol/wire/report-status.d.mts +47 -0
- package/dist/protocol/wire/report-status.mjs +119 -0
- package/dist/protocol/wire/v2.d.mts +90 -0
- package/dist/protocol/wire/v2.mjs +185 -0
- package/dist/protocol.d.mts +31 -0
- package/dist/protocol.mjs +31 -0
- package/dist/queue/advance.mjs +1036 -0
- package/dist/queue/callers.mjs +134 -0
- package/dist/queue/calls.mjs +1154 -0
- package/dist/queue/commit.mjs +85 -0
- package/dist/queue/host.d.mts +15 -0
- package/dist/queue/host.mjs +88 -0
- package/dist/queue/ids.d.mts +5 -0
- package/dist/queue/ids.mjs +21 -0
- package/dist/queue/lanes.mjs +86 -0
- package/dist/queue/limits.mjs +99 -0
- package/dist/queue/pages.mjs +76 -0
- package/dist/queue/push-option.mjs +62 -0
- package/dist/queue/rows.mjs +206 -0
- package/dist/queue/schedule.mjs +132 -0
- package/dist/queue/search.mjs +315 -0
- package/dist/queue/state.mjs +325 -0
- package/dist/queue/steps.mjs +317 -0
- package/dist/remote-helper.d.mts +3 -0
- package/dist/remote-helper.mjs +3 -0
- package/dist/rest/api.d.mts +23 -0
- package/dist/rest/api.mjs +27 -0
- package/dist/rest/blobs.d.mts +58 -0
- package/dist/rest/blobs.mjs +41 -0
- package/dist/rest/caller.d.mts +102 -0
- package/dist/rest/caller.mjs +18 -0
- package/dist/rest/client.d.mts +18 -0
- package/dist/rest/client.mjs +587 -0
- package/dist/rest/commits.d.mts +435 -0
- package/dist/rest/commits.mjs +140 -0
- package/dist/rest/errors.d.mts +44 -0
- package/dist/rest/errors.mjs +186 -0
- package/dist/rest/events.d.mts +38 -0
- package/dist/rest/events.mjs +74 -0
- package/dist/rest/files.d.mts +179 -0
- package/dist/rest/files.mjs +92 -0
- package/dist/rest/forks.d.mts +205 -0
- package/dist/rest/forks.mjs +51 -0
- package/dist/rest/handler.d.mts +17 -0
- package/dist/rest/handler.mjs +106 -0
- package/dist/rest/handlers.d.mts +8 -0
- package/dist/rest/handlers.mjs +592 -0
- package/dist/rest/listen.d.mts +24 -0
- package/dist/rest/listen.mjs +142 -0
- package/dist/rest/me.d.mts +55 -0
- package/dist/rest/me.mjs +21 -0
- package/dist/rest/merges.d.mts +90 -0
- package/dist/rest/merges.mjs +39 -0
- package/dist/rest/paths.mjs +86 -0
- package/dist/rest/queue.d.mts +486 -0
- package/dist/rest/queue.mjs +228 -0
- package/dist/rest/refs.d.mts +232 -0
- package/dist/rest/refs.mjs +86 -0
- package/dist/rest/repos.d.mts +223 -0
- package/dist/rest/repos.mjs +93 -0
- package/dist/rest/tags.d.mts +153 -0
- package/dist/rest/tags.mjs +72 -0
- package/dist/rest/tokens.d.mts +297 -0
- package/dist/rest/tokens.mjs +88 -0
- package/dist/rest/topics.d.mts +257 -0
- package/dist/rest/topics.mjs +116 -0
- package/dist/rest/trees.d.mts +158 -0
- package/dist/rest/trees.mjs +118 -0
- package/dist/rest/wire.mjs +57 -0
- package/dist/rest/work.d.mts +107 -0
- package/dist/rest/work.mjs +77 -0
- package/dist/rest.d.mts +8 -0
- package/dist/rest.mjs +5 -0
- package/dist/server/extension.d.mts +14 -0
- package/dist/server/extension.mjs +85 -0
- package/dist/server/routes.d.mts +25 -0
- package/dist/server/routes.mjs +67 -0
- package/dist/server/server.d.mts +2 -0
- package/dist/server/server.mjs +439 -0
- package/dist/signin/codes.mjs +47 -0
- package/dist/signin/context.d.mts +9 -0
- package/dist/signin/context.mjs +121 -0
- package/dist/signin/device.mjs +122 -0
- package/dist/signin/forms.mjs +157 -0
- package/dist/signin/grants.d.mts +5 -0
- package/dist/signin/grants.mjs +257 -0
- package/dist/signin/route.mjs +68 -0
- package/dist/signin/web.mjs +125 -0
- package/dist/signin/wire.d.mts +42 -0
- package/dist/signin/wire.mjs +43 -0
- package/dist/storage/allotted.mjs +102 -0
- package/dist/storage/budget.mjs +96 -0
- package/dist/storage/calls.d.mts +18 -0
- package/dist/storage/calls.mjs +273 -0
- package/dist/storage/clean-up.mjs +124 -0
- package/dist/storage/distinct-ids.mjs +39 -0
- package/dist/storage/ewah.mjs +97 -0
- package/dist/storage/fetch.d.mts +13 -0
- package/dist/storage/fetch.mjs +792 -0
- package/dist/storage/fsck.mjs +77 -0
- package/dist/storage/held-memo.mjs +188 -0
- package/dist/storage/index-bitmaps.d.mts +4 -0
- package/dist/storage/index-bitmaps.mjs +654 -0
- package/dist/storage/index-build.d.mts +15 -0
- package/dist/storage/index-build.mjs +1433 -0
- package/dist/storage/index-fetch.d.mts +9 -0
- package/dist/storage/index-fetch.mjs +756 -0
- package/dist/storage/index-files.mjs +232 -0
- package/dist/storage/index-graph.d.mts +3 -0
- package/dist/storage/index-graph.mjs +1049 -0
- package/dist/storage/index-layers.mjs +317 -0
- package/dist/storage/index-reach.mjs +216 -0
- package/dist/storage/index-remap.d.mts +8 -0
- package/dist/storage/index-remap.mjs +592 -0
- package/dist/storage/layout.mjs +69 -0
- package/dist/storage/lfs-pointers.d.mts +21 -0
- package/dist/storage/lfs-pointers.mjs +175 -0
- package/dist/storage/link-join.mjs +106 -0
- package/dist/storage/links.mjs +105 -0
- package/dist/storage/loose.d.mts +15 -0
- package/dist/storage/loose.mjs +120 -0
- package/dist/storage/memory-budget.d.mts +8 -0
- package/dist/storage/memory-budget.mjs +546 -0
- package/dist/storage/merge.mjs +416 -0
- package/dist/storage/object-rows.d.mts +6 -0
- package/dist/storage/object-rows.mjs +211 -0
- package/dist/storage/pack-order.d.mts +8 -0
- package/dist/storage/pack-order.mjs +779 -0
- package/dist/storage/pack-ranges.d.mts +5 -0
- package/dist/storage/pack-ranges.mjs +284 -0
- package/dist/storage/pack-reads.d.mts +11 -0
- package/dist/storage/pack-reads.mjs +990 -0
- package/dist/storage/pack-receive.d.mts +11 -0
- package/dist/storage/pack-receive.mjs +449 -0
- package/dist/storage/packs.d.mts +56 -0
- package/dist/storage/packs.mjs +600 -0
- package/dist/storage/prune.mjs +506 -0
- package/dist/storage/push-allotment.mjs +109 -0
- package/dist/storage/push-uploads.mjs +151 -0
- package/dist/storage/pushed-commits.mjs +136 -0
- package/dist/storage/quarantine.mjs +98 -0
- package/dist/storage/raw-ids.mjs +44 -0
- package/dist/storage/ready.d.mts +19 -0
- package/dist/storage/ready.mjs +328 -0
- package/dist/storage/receive-links.mjs +297 -0
- package/dist/storage/repack-job.mjs +48 -0
- package/dist/storage/repack.d.mts +31 -0
- package/dist/storage/repack.mjs +182 -0
- package/dist/storage/roots.mjs +42 -0
- package/dist/storage/rows.d.mts +3 -0
- package/dist/storage/rows.mjs +71 -0
- package/dist/storage/shallow.d.mts +5 -0
- package/dist/storage/shallow.mjs +128 -0
- package/dist/storage/stream-whole.mjs +236 -0
- package/dist/storage/unpack.mjs +236 -0
- package/dist/storage/visible.mjs +137 -0
- package/dist/storage/walk.d.mts +7 -0
- package/dist/storage/walk.mjs +170 -0
- package/dist/storage/wants.mjs +362 -0
- package/dist/store/call-count.d.mts +47 -0
- package/dist/store/call-count.mjs +207 -0
- package/dist/store/catalogue.d.mts +7 -0
- package/dist/store/catalogue.mjs +643 -0
- package/dist/store/crossing.mjs +66 -0
- package/dist/store/cursor-seal.d.mts +2 -0
- package/dist/store/cursor-seal.mjs +85 -0
- package/dist/store/errors.d.mts +12 -0
- package/dist/store/errors.mjs +129 -0
- package/dist/store/git-store.mjs +75 -0
- package/dist/store/list-job.mjs +35 -0
- package/dist/store/outbox.d.mts +7 -0
- package/dist/store/outbox.mjs +295 -0
- package/dist/store/queue-jobs.mjs +43 -0
- package/dist/store/random.mjs +28 -0
- package/dist/store/records.d.mts +4 -0
- package/dist/store/records.mjs +192 -0
- package/dist/store/ref-rows.d.mts +4 -0
- package/dist/store/ref-rows.mjs +30 -0
- package/dist/store/repo-record.mjs +100 -0
- package/dist/store/reservations.mjs +82 -0
- package/dist/store/scopes.mjs +170 -0
- package/dist/store/settle.mjs +63 -0
- package/dist/store/topic-jobs.mjs +62 -0
- package/dist/sync/bound.d.mts +7 -0
- package/dist/sync/bound.mjs +29 -0
- package/dist/sync/github.d.mts +12 -0
- package/dist/sync/github.mjs +297 -0
- package/dist/sync/import.d.mts +8 -0
- package/dist/sync/import.mjs +154 -0
- package/dist/sync/jobs.d.mts +9 -0
- package/dist/sync/jobs.mjs +80 -0
- package/dist/sync/mirror.d.mts +9 -0
- package/dist/sync/mirror.mjs +227 -0
- package/dist/sync/publish.d.mts +5 -0
- package/dist/sync/publish.mjs +117 -0
- package/dist/sync/records.mjs +73 -0
- package/dist/sync/smart-http.d.mts +8 -0
- package/dist/sync/smart-http.mjs +23 -0
- package/dist/sync/step.mjs +334 -0
- package/dist/sync/tries.mjs +126 -0
- package/dist/sync.d.mts +8 -0
- package/dist/sync.mjs +8 -0
- package/dist/topics/advance.mjs +554 -0
- package/dist/topics/calls.mjs +346 -0
- package/dist/topics/directory.mjs +107 -0
- package/dist/topics/host.d.mts +11 -0
- package/dist/topics/host.mjs +71 -0
- package/dist/topics/members.mjs +177 -0
- package/dist/topics/rows.mjs +99 -0
- package/dist/topics/topic.mjs +126 -0
- package/package.json +88 -3
- package/README.md +0 -3
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { LfsPointers } from "../contracts/objects.mjs";
|
|
2
|
+
import { hexOf } from "../protocol/bytes/hex.mjs";
|
|
3
|
+
import { lfsPointerOfBlob, maxLfsPointerBytes } from "../protocol/objects/lfs-pointer.mjs";
|
|
4
|
+
import { gitError } from "../store/errors.mjs";
|
|
5
|
+
import * as Effect from "effect/Effect";
|
|
6
|
+
// src/storage/lfs-pointers.ts
|
|
7
|
+
/**
|
|
8
|
+
* The most Git LFS pointers one push may carry, held as the receive's `lfsPointers` until its
|
|
9
|
+
* commit. A push past it is refused as `too-many-pointers`.
|
|
10
|
+
*/
|
|
11
|
+
const lfsPointersMost = 5e4;
|
|
12
|
+
const tooManyPointers = gitError("RESOURCE_EXHAUSTED", `The push carries more than ${lfsPointersMost.toLocaleString("en-US")} Git LFS pointers, the most one push takes`, {
|
|
13
|
+
hint: "Push fewer LFS files at a time",
|
|
14
|
+
context: {
|
|
15
|
+
reason: "too-many-pointers",
|
|
16
|
+
total: 50001
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const notPointer = (blob, oid) => gitError("INVALID_ARGUMENT", `A Git LFS pointer names a blob by 40 lowercase hex digits and its object by 64: ${blob}, ${oid}`);
|
|
20
|
+
/** No pointers, as a push without any carries. */
|
|
21
|
+
const noLfsPointers = LfsPointers.made(0, []);
|
|
22
|
+
/**
|
|
23
|
+
* The pointers each page of the table holds, 53,248 bytes: the builder takes a page as it fills
|
|
24
|
+
* the last, so a push of a few pointers holds one page, not the whole table, and nothing is copied.
|
|
25
|
+
*/
|
|
26
|
+
const pageEntries = 1024;
|
|
27
|
+
const noPage = /* @__PURE__ */ new Uint8Array(0);
|
|
28
|
+
/** The page that holds entry `at`. */
|
|
29
|
+
const pageOf = (pages, at) => pages[Math.floor(at / 1024)] ?? noPage;
|
|
30
|
+
/** Where entry `at` starts in its page. */
|
|
31
|
+
const offsetOf = (at) => at % pageEntries * 52;
|
|
32
|
+
/**
|
|
33
|
+
* A builder of a push's pointers. Its pages hold `lfsPointersMost` entries at most, the last cut to
|
|
34
|
+
* fit, so they never pass `budget.ts`'s `lfsPointersBytes`.
|
|
35
|
+
*/
|
|
36
|
+
const lfsPointers = () => {
|
|
37
|
+
const pages = [];
|
|
38
|
+
let count = 0;
|
|
39
|
+
let finished = false;
|
|
40
|
+
const add = (blob, oid) => {
|
|
41
|
+
if (finished) return Effect.die(/* @__PURE__ */ new Error("A finished list of LFS pointers takes no more"));
|
|
42
|
+
if (count >= 5e4) return Effect.fail(tooManyPointers);
|
|
43
|
+
if (count === pages.length * 1024) {
|
|
44
|
+
const entries = Math.min(pageEntries, lfsPointersMost - count);
|
|
45
|
+
pages.push(new Uint8Array(entries * 52));
|
|
46
|
+
}
|
|
47
|
+
const page = pageOf(pages, count);
|
|
48
|
+
const at = offsetOf(count);
|
|
49
|
+
if (!(blob.length === 40 && oid.length === 64 && hexInto(blob, page, at) && hexInto(oid, page, at + 20))) return Effect.fail(notPointer(blob, oid));
|
|
50
|
+
count += 1;
|
|
51
|
+
return Effect.void;
|
|
52
|
+
};
|
|
53
|
+
const finish = () => {
|
|
54
|
+
finished = true;
|
|
55
|
+
if (count === 0) return noLfsPointers;
|
|
56
|
+
sortByBlob(pages, count);
|
|
57
|
+
return LfsPointers.made(count, pages);
|
|
58
|
+
};
|
|
59
|
+
return {
|
|
60
|
+
add,
|
|
61
|
+
finish
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
/** A hex digit's value, or -1 for any other character. */
|
|
65
|
+
const digit = (code) => code >= 48 && code <= 57 ? code - 48 : code >= 97 && code <= 102 ? code - 87 : -1;
|
|
66
|
+
/** Writes the lowercase hex `text` into `bytes` at `at`, or says it isn't hex. */
|
|
67
|
+
const hexInto = (text, bytes, at) => {
|
|
68
|
+
for (let index = 0; index < text.length; index += 2) {
|
|
69
|
+
const high = digit(text.charCodeAt(index));
|
|
70
|
+
const low = digit(text.charCodeAt(index + 1));
|
|
71
|
+
if (high < 0 || low < 0) return false;
|
|
72
|
+
bytes[at + index / 2] = high * 16 + low;
|
|
73
|
+
}
|
|
74
|
+
return true;
|
|
75
|
+
};
|
|
76
|
+
/** How entry `at`'s blob compares with the 20 bytes of `other` from `from`. */
|
|
77
|
+
const compareBlob = (pages, at, other, from) => {
|
|
78
|
+
const page = pageOf(pages, at);
|
|
79
|
+
const start = offsetOf(at);
|
|
80
|
+
for (let index = 0; index < 20; index += 1) {
|
|
81
|
+
const difference = (page[start + index] ?? 0) - (other[from + index] ?? 0);
|
|
82
|
+
if (difference !== 0) return difference;
|
|
83
|
+
}
|
|
84
|
+
return 0;
|
|
85
|
+
};
|
|
86
|
+
/** How entry `left`'s blob compares with entry `right`'s. */
|
|
87
|
+
const compareBlobs = (pages, left, right) => compareBlob(pages, left, pageOf(pages, right), offsetOf(right));
|
|
88
|
+
const swap = (pages, left, right, spare) => {
|
|
89
|
+
const leftPage = pageOf(pages, left);
|
|
90
|
+
const rightPage = pageOf(pages, right);
|
|
91
|
+
const from = offsetOf(left);
|
|
92
|
+
const to = offsetOf(right);
|
|
93
|
+
spare.set(leftPage.subarray(from, from + 52));
|
|
94
|
+
leftPage.set(rightPage.subarray(to, to + 52), from);
|
|
95
|
+
rightPage.set(spare, to);
|
|
96
|
+
};
|
|
97
|
+
/** Sorts the first `count` entries by blob, in place: a heapsort, so nothing beside them. */
|
|
98
|
+
const sortByBlob = (pages, count) => {
|
|
99
|
+
const spare = /* @__PURE__ */ new Uint8Array(52);
|
|
100
|
+
const sift = (start, end) => {
|
|
101
|
+
let root = start;
|
|
102
|
+
for (let child = 2 * root + 1; child < end; child = 2 * root + 1) {
|
|
103
|
+
if (child + 1 < end && compareBlobs(pages, child, child + 1) < 0) child += 1;
|
|
104
|
+
if (compareBlobs(pages, root, child) >= 0) return;
|
|
105
|
+
swap(pages, root, child, spare);
|
|
106
|
+
root = child;
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
for (let start = Math.floor(count / 2) - 1; start >= 0; start -= 1) sift(start, count);
|
|
110
|
+
for (let end = count - 1; end > 0; end -= 1) {
|
|
111
|
+
swap(pages, 0, end, spare);
|
|
112
|
+
sift(0, end);
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
/** The LFS oid `pointers`' entry `at` names. */
|
|
116
|
+
const lfsOidAt = (pointers, at) => {
|
|
117
|
+
const from = offsetOf(at) + 20;
|
|
118
|
+
return hexOf(pageOf(LfsPointers.pagesOf(pointers), at).subarray(from, from + 52 - 20));
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* The entries of `pointers` for the blob `blob`, from `from` up to `to`: a search of the sorted
|
|
122
|
+
* pages in place, empty when it lists none, or when `blob` isn't an ID.
|
|
123
|
+
*/
|
|
124
|
+
const pointersOfBlob = (pointers, blob) => {
|
|
125
|
+
const key = /* @__PURE__ */ new Uint8Array(20);
|
|
126
|
+
if (blob.length !== 40 || !hexInto(blob, key, 0)) return {
|
|
127
|
+
from: 0,
|
|
128
|
+
to: 0
|
|
129
|
+
};
|
|
130
|
+
const pages = LfsPointers.pagesOf(pointers);
|
|
131
|
+
let low = 0;
|
|
132
|
+
let high = pointers.count;
|
|
133
|
+
while (low < high) {
|
|
134
|
+
const middle = low + high >>> 1;
|
|
135
|
+
if (compareBlob(pages, middle, key, 0) < 0) low = middle + 1;
|
|
136
|
+
else high = middle;
|
|
137
|
+
}
|
|
138
|
+
let to = low;
|
|
139
|
+
while (to < pointers.count && compareBlob(pages, to, key, 0) === 0) to += 1;
|
|
140
|
+
return {
|
|
141
|
+
from: low,
|
|
142
|
+
to
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
/** A receive's pointers, as its blobs come: each that reads as one, to `lfsPointersMost`. */
|
|
146
|
+
var ReceivedPointers = class {
|
|
147
|
+
#builder = lfsPointers();
|
|
148
|
+
#count = 0;
|
|
149
|
+
/** How many it has listed so far. */
|
|
150
|
+
get count() {
|
|
151
|
+
return this.#count;
|
|
152
|
+
}
|
|
153
|
+
/** Whether a blob of `size` bytes may be a pointer, so its bytes are worth reading. */
|
|
154
|
+
static mayHold(size) {
|
|
155
|
+
return size <= maxLfsPointerBytes;
|
|
156
|
+
}
|
|
157
|
+
/** Lists the blob `blob` of `bytes` if it reads as a pointer; past the most, fails. */
|
|
158
|
+
add(blob, bytes) {
|
|
159
|
+
const pointer = lfsPointerOfBlob(bytes);
|
|
160
|
+
if (pointer === void 0) return Effect.void;
|
|
161
|
+
return Effect.map(this.#builder.add(blob, pointer.oid), () => {
|
|
162
|
+
this.#count += 1;
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
/** The pointers it found, sorted by blob. */
|
|
166
|
+
finish() {
|
|
167
|
+
return this.#builder.finish();
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
/** The pointers among a receive's whole objects, found by `pointers`. */
|
|
171
|
+
const pointersOfObjects = Effect.fnUntraced(function* (objects, pointers = new ReceivedPointers()) {
|
|
172
|
+
for (const object of objects) if (object.type === "blob") yield* pointers.add(object.oid, object.bytes);
|
|
173
|
+
return pointers.finish();
|
|
174
|
+
});
|
|
175
|
+
export { ReceivedPointers, lfsOidAt, lfsPointers, lfsPointersMost, noLfsPointers, pageEntries, pointersOfBlob, pointersOfObjects };
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { hexOf } from "../protocol/bytes/hex.mjs";
|
|
2
|
+
import { emptyTree } from "../protocol/objects/object.mjs";
|
|
3
|
+
import { oidBytes } from "../protocol/packs/idx.mjs";
|
|
4
|
+
import { gitError } from "../store/errors.mjs";
|
|
5
|
+
import { compareIds, orderById } from "./raw-ids.mjs";
|
|
6
|
+
import { rangeRanks } from "./pack-ranges.mjs";
|
|
7
|
+
import * as Effect from "effect/Effect";
|
|
8
|
+
// src/storage/link-join.ts
|
|
9
|
+
/**
|
|
10
|
+
* A slice's links turned from IDs into repo positions, by a merge rather than a lookup each: the
|
|
11
|
+
* links sorted by ID, then walked beside each pack's `.idx` IDs and `.pos` positions, a chunk of
|
|
12
|
+
* ranks at a time, then the extended region's rows. An ID two of them hold takes the lower
|
|
13
|
+
* position, so a layer below's row that a pack above holds again keeps the position its bitmaps
|
|
14
|
+
* set. What it holds is the slice's links, 28 bytes each, and one chunk; no pack's index is held
|
|
15
|
+
* whole.
|
|
16
|
+
*/
|
|
17
|
+
/** A link no pack or row holds, before the join decides whether that's allowed. */
|
|
18
|
+
const missing = 4294967295;
|
|
19
|
+
/**
|
|
20
|
+
* What a join of `links` holds besides them: each one's place by ID and its target, 8 bytes, and
|
|
21
|
+
* the larger of its sort's two tables, 512 KiB, and a chunk of IDs, 640 KiB, held twice while its
|
|
22
|
+
* read gathers it.
|
|
23
|
+
*/
|
|
24
|
+
const joinBytes = (links) => 2 * rangeRanks * 20 + links * 8;
|
|
25
|
+
const lost = (message) => gitError("DATA_LOSS", message);
|
|
26
|
+
/**
|
|
27
|
+
* The empty tree, which Git takes as present in every repo without storing it, so a push may name
|
|
28
|
+
* it and not send it. It's the one ID a link may name that nothing holds; any other tree is lost.
|
|
29
|
+
*/
|
|
30
|
+
const emptyTreeId = oidBytes(emptyTree);
|
|
31
|
+
/**
|
|
32
|
+
* Fills `targets` for the links in `order` that `ids` and `positions` hold: `ids`, ascending,
|
|
33
|
+
* the source's from rank `from`, and each one's position. A link an earlier source filled at a
|
|
34
|
+
* lower position is left.
|
|
35
|
+
*/
|
|
36
|
+
const mergeChunk = (links, order, start, targets, ids, count, position) => {
|
|
37
|
+
let link = start;
|
|
38
|
+
let rank = 0;
|
|
39
|
+
while (link < order.length && rank < count) {
|
|
40
|
+
const at = order[link] ?? 0;
|
|
41
|
+
const compared = compareIds(links, at * 20, ids, rank * 20);
|
|
42
|
+
if (compared < 0) link += 1;
|
|
43
|
+
else if (compared > 0) rank += 1;
|
|
44
|
+
else {
|
|
45
|
+
targets[at] = Math.min(targets[at] ?? 4294967295, position(rank));
|
|
46
|
+
link += 1;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return link;
|
|
50
|
+
};
|
|
51
|
+
/** Whether `ids`' `count` IDs ascend strictly, after `previous`'s last, if any. */
|
|
52
|
+
const ascending = (ids, count, previous) => {
|
|
53
|
+
if (previous !== void 0 && count > 0 && compareIds(previous, 0, ids, 0) >= 0) return false;
|
|
54
|
+
for (let rank = 1; rank < count; rank += 1) if (compareIds(ids, (rank - 1) * 20, ids, rank * 20) >= 0) return false;
|
|
55
|
+
return true;
|
|
56
|
+
};
|
|
57
|
+
/** The first link in `order` at or past `link` whose ID is at or past `ids`' first. */
|
|
58
|
+
const skipBelow = (links, order, link, ids) => {
|
|
59
|
+
let at = link;
|
|
60
|
+
while (at < order.length && compareIds(links, (order[at] ?? 0) * 20, ids, 0) < 0) at += 1;
|
|
61
|
+
return at;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Each of `size` IDs, 20 raw bytes each of `ids`, as a repo position: the lowest `packs` or
|
|
65
|
+
* `region` holds it at, or `missing` when none does, as a tip pushed after a build began is.
|
|
66
|
+
* It joins them where they are, with nothing copied.
|
|
67
|
+
*/
|
|
68
|
+
const joinIds = (ids, size, packs, region) => Effect.gen(function* () {
|
|
69
|
+
const order = orderById(ids, size);
|
|
70
|
+
const targets = new Uint32Array(size).fill(missing);
|
|
71
|
+
for (const ranges of packs) {
|
|
72
|
+
let link = 0;
|
|
73
|
+
let previous;
|
|
74
|
+
for (let rank = 0; rank < ranges.count && link < order.length; rank += rangeRanks) {
|
|
75
|
+
const count = Math.min(rangeRanks, ranges.count - rank);
|
|
76
|
+
const chunk = yield* ranges.ids(rank, count);
|
|
77
|
+
if (!ascending(chunk, count, previous)) return yield* Effect.fail(lost(`Pack ${ranges.pack.id}'s index isn't in ID order`));
|
|
78
|
+
previous = chunk.subarray((count - 1) * 20, count * 20);
|
|
79
|
+
link = skipBelow(ids, order, link, chunk);
|
|
80
|
+
const last = chunk.subarray((count - 1) * 20);
|
|
81
|
+
if (link >= order.length || compareIds(ids, (order[link] ?? 0) * 20, last, 0) > 0) continue;
|
|
82
|
+
const positions = yield* ranges.positions(rank, count);
|
|
83
|
+
link = mergeChunk(ids, order, link, targets, chunk, count, (at) => ranges.base + (positions[at] ?? 0));
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (region !== void 0 && region.positions.length > 0) mergeChunk(ids, order, 0, targets, region.ids, region.positions.length, (at) => region.positions[at] ?? 0);
|
|
87
|
+
return targets;
|
|
88
|
+
});
|
|
89
|
+
/**
|
|
90
|
+
* Each of `links`' links as a repo position, by `joinIds`. A link none holds is refused as
|
|
91
|
+
* `DATA_LOSS`, but for a shallow commit's parent and the empty tree, which are `missing`.
|
|
92
|
+
*/
|
|
93
|
+
const joinLinks = (links, packs, region) => Effect.gen(function* () {
|
|
94
|
+
const ids = links.ids;
|
|
95
|
+
const targets = yield* joinIds(ids, links.size, packs, region);
|
|
96
|
+
for (let source = 0; source < links.sources; source += 1) {
|
|
97
|
+
const [from, to] = links.linksOf(source);
|
|
98
|
+
for (let link = from; link < to; link += 1) {
|
|
99
|
+
if (targets[link] !== 4294967295 || links.mayLack(source, link - from)) continue;
|
|
100
|
+
if (compareIds(ids, link * 20, emptyTreeId, 0) === 0) continue;
|
|
101
|
+
return yield* Effect.fail(lost(`The object at ${links.positionOf(source)} names ${hexOf(ids.subarray(link * 20, link * 20 + 20))}, which the repo doesn't hold`));
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return targets;
|
|
105
|
+
});
|
|
106
|
+
export { joinBytes, joinIds, joinLinks, missing };
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { readCommit } from "../protocol/objects/commit.mjs";
|
|
2
|
+
import { readTag } from "../protocol/objects/tag.mjs";
|
|
3
|
+
import { treeReader } from "../protocol/objects/tree.mjs";
|
|
4
|
+
import { gitError } from "../store/errors.mjs";
|
|
5
|
+
import * as Result from "effect/Result";
|
|
6
|
+
// src/storage/links.ts
|
|
7
|
+
/** A tree entry's mode for a submodule's commit, which lives in another repo. */
|
|
8
|
+
const gitlink = "160000";
|
|
9
|
+
/** A tree entry's mode for a folder, another tree, as a tree's parse gives it. */
|
|
10
|
+
const folder = "040000";
|
|
11
|
+
/** A tree entry's object's type, by its mode, as Git's `object_type` gives it: a folder's is a tree. */
|
|
12
|
+
const entryType = (mode) => mode === "040000" ? "tree" : "blob";
|
|
13
|
+
/**
|
|
14
|
+
* The objects `object` names, which a repo must hold beside it, each with the type its link says:
|
|
15
|
+
* a commit's tree and parents, a tree's entries but its submodules, by their modes, and a tag's
|
|
16
|
+
* object, by its `type` line. Bytes Git wouldn't take are `INVALID_ARGUMENT`. It takes no Effect
|
|
17
|
+
* step, since a push reads it for each of its objects.
|
|
18
|
+
*/
|
|
19
|
+
const linksOf = (object) => {
|
|
20
|
+
const next = linkReader(object);
|
|
21
|
+
const links = [];
|
|
22
|
+
for (let read = next();; read = next()) {
|
|
23
|
+
if (Result.isFailure(read)) return Result.fail(read.failure);
|
|
24
|
+
if (read.success === void 0) return Result.succeed(links);
|
|
25
|
+
links.push(read.success);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* `linksOf`'s links one at a time, in its order, `undefined` past the last: a tree's are read an
|
|
30
|
+
* entry at a time, so one as wide as a push may carry holds only the links its caller keeps.
|
|
31
|
+
*/
|
|
32
|
+
const linkReader = (object) => {
|
|
33
|
+
const malformed = (error) => Result.fail(gitError("INVALID_ARGUMENT", `The ${object.type} ${object.oid} is malformed: ${error.message}`));
|
|
34
|
+
if (object.type === "tree") {
|
|
35
|
+
const next = treeReader(object.bytes);
|
|
36
|
+
return () => {
|
|
37
|
+
for (let read = next();; read = next()) {
|
|
38
|
+
if (Result.isFailure(read)) return malformed(read.failure);
|
|
39
|
+
const entry = read.success;
|
|
40
|
+
if (entry === void 0) return Result.succeed(void 0);
|
|
41
|
+
if (entry.mode !== "160000") return Result.succeed({
|
|
42
|
+
oid: entry.oid,
|
|
43
|
+
type: entryType(entry.mode)
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
const links = fewLinks(object);
|
|
49
|
+
if (Result.isFailure(links)) return () => malformed(links.failure);
|
|
50
|
+
let at = 0;
|
|
51
|
+
return () => Result.succeed(links.success[at++]);
|
|
52
|
+
};
|
|
53
|
+
/** The links of an object that isn't a tree, which are few: a commit's tree and parents, a tag's object. */
|
|
54
|
+
const fewLinks = (object) => {
|
|
55
|
+
switch (object.type) {
|
|
56
|
+
case "commit": return Result.map(readCommit(object.bytes), ({ tree, parents }) => [{
|
|
57
|
+
oid: tree,
|
|
58
|
+
type: "tree"
|
|
59
|
+
}, ...parents.map((oid) => ({
|
|
60
|
+
oid,
|
|
61
|
+
type: "commit"
|
|
62
|
+
}))]);
|
|
63
|
+
case "tag": return Result.map(readTag(object.bytes), (tag) => [{
|
|
64
|
+
oid: tag.object,
|
|
65
|
+
type: tag.type
|
|
66
|
+
}]);
|
|
67
|
+
default: return Result.succeed([]);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* `links` of an object a repo must hold, and apart from them the parents of a commit a shallow
|
|
72
|
+
* client named in `shallow`, which its push may name without holding.
|
|
73
|
+
*/
|
|
74
|
+
const shallowLinks = (object, links, shallow) => object.type === "commit" && shallow.has(object.oid) ? {
|
|
75
|
+
needed: links.slice(0, 1),
|
|
76
|
+
parents: links.slice(1)
|
|
77
|
+
} : {
|
|
78
|
+
needed: links,
|
|
79
|
+
parents: []
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* `INVALID_ARGUMENT` for the first of `links` whose object is of another type than it says, as
|
|
83
|
+
* Git's receive words it: `object <oid> is a commit, not a tree`. `typeOf` gives the type of an
|
|
84
|
+
* object the push brings or the repo holds; one it doesn't know is left to the missing check.
|
|
85
|
+
*/
|
|
86
|
+
const mistyped = (links, typeOf) => {
|
|
87
|
+
for (const link of links) {
|
|
88
|
+
const type = typeOf(link.oid);
|
|
89
|
+
if (type === void 0 || type === link.type) continue;
|
|
90
|
+
return wrongType(link, type);
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
/** `mistyped`'s refusal of `link`, whose object is a `type`. */
|
|
94
|
+
const wrongType = (link, type) => gitError("INVALID_ARGUMENT", `object ${link.oid} is a ${type}, not a ${link.type}`, { hint: "Point each link at an object of the type it says" });
|
|
95
|
+
/**
|
|
96
|
+
* A push whose pack holds a shallow client's commit without its parents, which the repo lacks too:
|
|
97
|
+
* its refs would make the repo shallow, so the pack is never listed, as Git refuses such a ref
|
|
98
|
+
* with `receive.shallowUpdate` off.
|
|
99
|
+
*/
|
|
100
|
+
const shallowRoot = () => gitError("FAILED_PRECONDITION", "shallow update not allowed", {
|
|
101
|
+
hint: "Push each branch on its own: one whose history this repo lacks needs `git fetch --unshallow` first",
|
|
102
|
+
context: { reason: "shallow-root" }
|
|
103
|
+
});
|
|
104
|
+
const isShallowRoot = (error) => error.code === "FAILED_PRECONDITION" && error.context?.reason === "shallow-root";
|
|
105
|
+
export { folder, gitlink, isShallowRoot, linkReader, linksOf, mistyped, shallowLinks, shallowRoot, wrongType };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ObjectsFactory } from "../contracts/objects.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* What one push may carry into `loose()` storage: its `objects`, and the `bytes` of its rows as
|
|
4
|
+
* JSON, which its commit holds.
|
|
5
|
+
*/
|
|
6
|
+
export declare const looseLimits: {
|
|
7
|
+
readonly objects: 10000;
|
|
8
|
+
readonly bytes: number;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* `loose()`: each object a row of the repo's scope, with no bucket. A push of more than 10,000
|
|
12
|
+
* objects is refused whole, and so is one whose rows pass one commit's 8 MiB, or with an object
|
|
13
|
+
* whose row passes one row's 1 MiB, as `object-too-large`. The client's default.
|
|
14
|
+
*/
|
|
15
|
+
export declare const loose: () => ObjectsFactory<false>;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { gitError } from "../store/errors.mjs";
|
|
2
|
+
import { newChangeId } from "../store/scopes.mjs";
|
|
3
|
+
import { handedScope } from "../store/call-count.mjs";
|
|
4
|
+
import { answerTo, cancelsBody, effectStore, objectReader } from "./calls.mjs";
|
|
5
|
+
import { fetchPack } from "./fetch.mjs";
|
|
6
|
+
import { pushedCommitsPage } from "./pushed-commits.mjs";
|
|
7
|
+
import { eachHeldRow, gitObjectOf, heldRows, rowHeaders, rowSizes } from "./object-rows.mjs";
|
|
8
|
+
import { allotmentWithin } from "../contracts/objects.mjs";
|
|
9
|
+
import { allottedRows } from "./allotted.mjs";
|
|
10
|
+
import { pointersOfObjects } from "./lfs-pointers.mjs";
|
|
11
|
+
import { commitBytes, unpackObjects } from "./unpack.mjs";
|
|
12
|
+
import * as Effect from "effect/Effect";
|
|
13
|
+
// src/storage/loose.ts
|
|
14
|
+
/** The most objects one push may carry into `loose()` storage, each a row of its commit. */
|
|
15
|
+
const looseObjectsMost = 1e4;
|
|
16
|
+
/**
|
|
17
|
+
* What one push may carry into `loose()` storage: its `objects`, and the `bytes` of its rows as
|
|
18
|
+
* JSON, which its commit holds.
|
|
19
|
+
*/
|
|
20
|
+
const looseLimits = {
|
|
21
|
+
objects: looseObjectsMost,
|
|
22
|
+
bytes: commitBytes
|
|
23
|
+
};
|
|
24
|
+
const tooMany = (count) => gitError("RESOURCE_EXHAUSTED", `push has ${count.toLocaleString("en-US")} objects; loose() storage takes ${looseObjectsMost.toLocaleString("en-US")} per push`, {
|
|
25
|
+
hint: "Use packs() storage, or push fewer commits at a time",
|
|
26
|
+
context: {
|
|
27
|
+
reason: "too-large",
|
|
28
|
+
total: count
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
/** Each quarantine `loose()` received, whose objects are rows of the push's commit. */
|
|
32
|
+
const received = /* @__PURE__ */ new WeakSet();
|
|
33
|
+
/**
|
|
34
|
+
* Whether `quarantine` is one `loose()` received, so a commit too large for its rows earns
|
|
35
|
+
* `loose()`'s hint. It's the same quarantine through any wrapper that passes `receive`'s result on,
|
|
36
|
+
* as Git's HTTP does; `packs()`'s, whose small pushes are rows too, isn't one.
|
|
37
|
+
*/
|
|
38
|
+
const isLoose = (quarantine) => received.has(quarantine);
|
|
39
|
+
/** A push's pack as rows for its commit: no quarantine row, since nothing outlives the commit. */
|
|
40
|
+
const receiveRows = Effect.fnUntraced(function* (store, listed, receive) {
|
|
41
|
+
const unpacked = yield* unpackObjects({
|
|
42
|
+
receive,
|
|
43
|
+
limits: {
|
|
44
|
+
objects: looseObjectsMost,
|
|
45
|
+
bytes: commitBytes
|
|
46
|
+
},
|
|
47
|
+
tooMany,
|
|
48
|
+
held: heldRows(store, listed)
|
|
49
|
+
});
|
|
50
|
+
const quarantine = {
|
|
51
|
+
id: newChangeId(),
|
|
52
|
+
change: { put: unpacked.rows },
|
|
53
|
+
bytes: unpacked.bytes,
|
|
54
|
+
objects: unpacked.objects.length,
|
|
55
|
+
lfsPointers: yield* pointersOfObjects(unpacked.objects)
|
|
56
|
+
};
|
|
57
|
+
received.add(quarantine);
|
|
58
|
+
return quarantine;
|
|
59
|
+
});
|
|
60
|
+
const readObject = Effect.fnUntraced(function* (store, listed, oid) {
|
|
61
|
+
const object = (yield* heldRows(store, listed)([oid])).get(oid);
|
|
62
|
+
return object === void 0 ? void 0 : gitObjectOf(object);
|
|
63
|
+
});
|
|
64
|
+
/**
|
|
65
|
+
* `loose()`: each object a row of the repo's scope, with no bucket. A push of more than 10,000
|
|
66
|
+
* objects is refused whole, and so is one whose rows pass one commit's 8 MiB, or with an object
|
|
67
|
+
* whose row passes one row's 1 MiB, as `object-too-large`. The client's default.
|
|
68
|
+
*/
|
|
69
|
+
const loose = () => ({
|
|
70
|
+
needsBucket: false,
|
|
71
|
+
open: ({ store, fetchLimits }) => {
|
|
72
|
+
const calls = effectStore(store);
|
|
73
|
+
const openReader = (listed, scope, listedOnly) => objectReader(listedOnly === true ? {
|
|
74
|
+
object: () => Effect.succeed(void 0),
|
|
75
|
+
sizes: () => Effect.succeed(/* @__PURE__ */ new Map()),
|
|
76
|
+
headers: () => Effect.succeed(/* @__PURE__ */ new Map()),
|
|
77
|
+
has: () => Effect.succeed(/* @__PURE__ */ new Set()),
|
|
78
|
+
objects: () => Effect.succeed({
|
|
79
|
+
objects: /* @__PURE__ */ new Map(),
|
|
80
|
+
left: []
|
|
81
|
+
}),
|
|
82
|
+
allotment: allotmentWithin,
|
|
83
|
+
release: () => {}
|
|
84
|
+
} : {
|
|
85
|
+
object: (oid) => readObject(calls, listed, oid),
|
|
86
|
+
sizes: rowSizes(calls, listed),
|
|
87
|
+
headers: rowHeaders(calls, listed),
|
|
88
|
+
has: (oids) => Effect.map(rowHeaders(calls, listed)(oids), (headers) => new Set(headers.keys())),
|
|
89
|
+
objects: (oids, bytes) => allottedRows(eachHeldRow(calls, listed), oids, bytes),
|
|
90
|
+
allotment: allotmentWithin,
|
|
91
|
+
release: () => {}
|
|
92
|
+
}, scope);
|
|
93
|
+
return {
|
|
94
|
+
reader: async (listed, input) => ({
|
|
95
|
+
kind: "success",
|
|
96
|
+
value: openReader(listed, handedScope(input), input?.listedOnly)
|
|
97
|
+
}),
|
|
98
|
+
pushedCommits: (_, input) => answerTo(pushedCommitsPage(void 0, input), input),
|
|
99
|
+
receive: (listed, input) => answerTo(cancelsBody(input.pack, receiveRows(calls, listed, input)), input),
|
|
100
|
+
fetch: (listed, input) => {
|
|
101
|
+
const reads = {
|
|
102
|
+
held: heldRows(calls, listed),
|
|
103
|
+
each: eachHeldRow(calls, listed),
|
|
104
|
+
sizes: rowSizes(calls, listed)
|
|
105
|
+
};
|
|
106
|
+
return answerTo(fetchPack(reads, input, fetchLimits), input);
|
|
107
|
+
},
|
|
108
|
+
maintain: () => Promise.resolve({
|
|
109
|
+
kind: "success",
|
|
110
|
+
value: void 0
|
|
111
|
+
}),
|
|
112
|
+
share: () => Promise.resolve({
|
|
113
|
+
kind: "success",
|
|
114
|
+
value: void 0
|
|
115
|
+
}),
|
|
116
|
+
readyShallow: false
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
export { isLoose, loose, looseLimits, looseObjectsMost };
|