@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,134 @@
|
|
|
1
|
+
import { CallInput } from "./actors.mjs";
|
|
2
|
+
import { Oid } from "./ids.mjs";
|
|
3
|
+
import { Bytes, ObjectType, ReadLimits, ReadObject } from "./objects.mjs";
|
|
4
|
+
import { Result } from "./result.mjs";
|
|
5
|
+
import { Listing, Moment, Page } from "@ref0/infra";
|
|
6
|
+
export interface ReadOptions extends CallInput {
|
|
7
|
+
readonly limits?: ReadLimits;
|
|
8
|
+
}
|
|
9
|
+
export interface ReadPage extends ReadOptions {
|
|
10
|
+
readonly page?: Page;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Who made a commit or a tag, and when: `at` in milliseconds since 1970, which Git keeps to the
|
|
14
|
+
* second, and `offset` the minutes their clock was east of UTC, such as 60 for `+0100` and -300
|
|
15
|
+
* for `-0500`, which `at` alone loses.
|
|
16
|
+
*/
|
|
17
|
+
export interface Signature {
|
|
18
|
+
readonly name: string;
|
|
19
|
+
readonly email: string;
|
|
20
|
+
readonly at: Moment;
|
|
21
|
+
readonly offset: number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* A commit: its tree, its parents in order, who wrote it and who committed it, and its message.
|
|
25
|
+
* `subject` is the message's first paragraph on one line, as Git's `%s` shows it, and
|
|
26
|
+
* `signature` the armored signature of its `gpgsig` header, when it has one.
|
|
27
|
+
*/
|
|
28
|
+
export interface Commit {
|
|
29
|
+
readonly oid: Oid;
|
|
30
|
+
readonly tree: Oid;
|
|
31
|
+
readonly parents: readonly Oid[];
|
|
32
|
+
readonly author: Signature;
|
|
33
|
+
readonly committer: Signature;
|
|
34
|
+
readonly subject: string;
|
|
35
|
+
readonly message: string;
|
|
36
|
+
readonly signature?: string;
|
|
37
|
+
}
|
|
38
|
+
/** What a new annotated tag names: the object it points at, its name, its tagger and message. */
|
|
39
|
+
export interface TagFields {
|
|
40
|
+
readonly object: Oid;
|
|
41
|
+
readonly tag: string;
|
|
42
|
+
readonly tagger: Signature;
|
|
43
|
+
readonly message: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* An annotated tag, with the type of the object it points at. A tag written before Git 0.99.9
|
|
47
|
+
* has no tagger, so a tag read may lack one, though every tag written here has one.
|
|
48
|
+
*/
|
|
49
|
+
export interface Tag extends Omit<TagFields, 'tagger'> {
|
|
50
|
+
readonly oid: Oid;
|
|
51
|
+
readonly type: ObjectType;
|
|
52
|
+
readonly tagger?: Signature;
|
|
53
|
+
}
|
|
54
|
+
export interface PathObject {
|
|
55
|
+
readonly mode: string;
|
|
56
|
+
readonly oid: Oid;
|
|
57
|
+
}
|
|
58
|
+
export interface TreeChange {
|
|
59
|
+
readonly status: 'A' | 'D' | 'M' | 'R' | 'T';
|
|
60
|
+
readonly path: string;
|
|
61
|
+
/** A rename's source path. */
|
|
62
|
+
readonly from?: string;
|
|
63
|
+
readonly similarity?: number;
|
|
64
|
+
readonly old?: PathObject;
|
|
65
|
+
readonly new?: PathObject;
|
|
66
|
+
/** `path`'s own bytes, when they aren't UTF-8. */
|
|
67
|
+
readonly pathBytes?: Uint8Array;
|
|
68
|
+
/** `from`'s own bytes, when they aren't UTF-8. */
|
|
69
|
+
readonly fromPathBytes?: Uint8Array;
|
|
70
|
+
}
|
|
71
|
+
export interface MergeBaseInput extends ReadOptions {
|
|
72
|
+
readonly commits: readonly Oid[];
|
|
73
|
+
}
|
|
74
|
+
export interface MergeBases {
|
|
75
|
+
readonly bases: readonly Oid[];
|
|
76
|
+
}
|
|
77
|
+
/** The names a merge's conflict markers carry for each side, as Git's are the names it's given. */
|
|
78
|
+
export interface MergeLabels {
|
|
79
|
+
readonly ours: string;
|
|
80
|
+
readonly theirs: string;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Three trees to merge, or what peels to them. Without `base`, `ours` and `theirs` are commits,
|
|
84
|
+
* merged over their merge bases as Git's `merge-tree --write-tree` merges them: one base's tree,
|
|
85
|
+
* or the virtual base merge-ort builds from several.
|
|
86
|
+
*/
|
|
87
|
+
export interface TreeMergeInput extends ReadOptions {
|
|
88
|
+
readonly base?: Oid;
|
|
89
|
+
readonly ours: Oid;
|
|
90
|
+
readonly theirs: Oid;
|
|
91
|
+
/** The sides' names in a merged blob's markers: `ours` and `theirs` as given, by default. */
|
|
92
|
+
readonly labels?: MergeLabels;
|
|
93
|
+
}
|
|
94
|
+
export interface ObjectWrite {
|
|
95
|
+
readonly oid: Oid;
|
|
96
|
+
readonly type: ObjectType;
|
|
97
|
+
readonly size: number;
|
|
98
|
+
readonly bytes: Bytes;
|
|
99
|
+
}
|
|
100
|
+
export type ObjectWrites = AsyncIterable<ObjectWrite>;
|
|
101
|
+
/**
|
|
102
|
+
* Why inexact rename detection was skipped, as Git warns, when it was: past the rename limit,
|
|
103
|
+
* `'rename-limit'`, or past the 16 MiB of span sets a pass keeps, `'memory-limit'`. Exact
|
|
104
|
+
* renames still pair, and a skipped pass's other changes list as deletes and adds.
|
|
105
|
+
*/
|
|
106
|
+
export type RenamesSkipped = 'rename-limit' | 'memory-limit';
|
|
107
|
+
/** A page of a diff's changes, and why its rename pass skipped inexact renames, when it did. */
|
|
108
|
+
export interface DiffListing<Item> extends Listing<Item> {
|
|
109
|
+
readonly renamesSkipped?: RenamesSkipped;
|
|
110
|
+
}
|
|
111
|
+
/** A page of two trees' changes. */
|
|
112
|
+
export type TreeChanges = DiffListing<TreeChange>;
|
|
113
|
+
export interface MergeTree {
|
|
114
|
+
readonly tree: Oid;
|
|
115
|
+
readonly objects: ObjectWrites;
|
|
116
|
+
/** Why either side's rename pass skipped inexact renames, when one did. */
|
|
117
|
+
readonly renamesSkipped?: RenamesSkipped;
|
|
118
|
+
}
|
|
119
|
+
export interface TreeDiffInput extends ReadPage {
|
|
120
|
+
readonly base: Oid;
|
|
121
|
+
readonly head: Oid;
|
|
122
|
+
readonly renames?: boolean;
|
|
123
|
+
}
|
|
124
|
+
export interface WalkInput extends ReadPage {
|
|
125
|
+
readonly wants: readonly Oid[];
|
|
126
|
+
readonly haves?: readonly Oid[];
|
|
127
|
+
}
|
|
128
|
+
/** Pure merge, diff, merge base and walk, over a way to read objects: `engine()`. */
|
|
129
|
+
export interface GitEngine {
|
|
130
|
+
readonly merge: (read: ReadObject, input: TreeMergeInput) => Promise<Result<MergeTree>>;
|
|
131
|
+
readonly diff: (read: ReadObject, input: TreeDiffInput) => Promise<Result<TreeChanges>>;
|
|
132
|
+
readonly mergeBase: (read: ReadObject, input: MergeBaseInput) => Promise<Result<MergeBases>>;
|
|
133
|
+
readonly walk: (read: ReadObject, input: WalkInput) => Promise<Result<Listing<Commit>>>;
|
|
134
|
+
}
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
import { ActorId } from "./actors.mjs";
|
|
2
|
+
import { SavedHandlerOptions } from "./handlers.mjs";
|
|
3
|
+
import { InternalRepoId, Oid, RefName, RepoId, TopicId } from "./ids.mjs";
|
|
4
|
+
import { CandidateCloseReason, CandidateId, EntryFailureReason, EntryId, HoldId, Judged, Report, ReportDetails } from "./queue.mjs";
|
|
5
|
+
import { RefEdit, RefSource } from "./refs.mjs";
|
|
6
|
+
import { Awaitable, Verdict } from "./result.mjs";
|
|
7
|
+
import { TokenId, TokenScope } from "./tokens.mjs";
|
|
8
|
+
import { TopicCandidate, TopicEntry, TopicFailure, TopicMergedEntry, TopicReportDetails } from "./topics.mjs";
|
|
9
|
+
import { JobRef, Moment } from "@ref0/infra";
|
|
10
|
+
/**
|
|
11
|
+
* What every event carries. `seq` orders a scope's events: a repo's name keeps one sequence
|
|
12
|
+
* across deletion and recreation. `at` is the time of the commit that wrote it. `actor` is left
|
|
13
|
+
* out when no named actor acted: Git's own work, or an anonymous caller.
|
|
14
|
+
*/
|
|
15
|
+
export interface EventEnvelope {
|
|
16
|
+
readonly seq: number;
|
|
17
|
+
readonly at: Moment;
|
|
18
|
+
readonly actor?: ActorId;
|
|
19
|
+
readonly subject?: ActorId;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* A repo's event: `repo` is its name when the event was written, `internalId` the repo's own ID,
|
|
23
|
+
* which no rename, deletion or recreation under its name changes, and `token` the credential's.
|
|
24
|
+
*/
|
|
25
|
+
export interface RepoEnvelope extends EventEnvelope {
|
|
26
|
+
readonly repo: RepoId;
|
|
27
|
+
readonly internalId: InternalRepoId;
|
|
28
|
+
readonly token?: TokenId;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* A repo made, or a fork made of `upstream`: the upstream's name when the fork was made, and
|
|
32
|
+
* `upstreamInternalId` its own ID, read from its record then, which follows it across a rename or
|
|
33
|
+
* a new repo under that name (Q197). The two come together, or neither does. `public` is the
|
|
34
|
+
* repo's visibility as it's made, so the stream alone gives a repo's visibility at every `seq`,
|
|
35
|
+
* with each `repo.visibility.changed` after it.
|
|
36
|
+
*/
|
|
37
|
+
export type RepoCreated = RepoEnvelope & {
|
|
38
|
+
readonly type: 'repo.created';
|
|
39
|
+
readonly public: boolean;
|
|
40
|
+
} & ({
|
|
41
|
+
readonly upstream?: never;
|
|
42
|
+
readonly upstreamInternalId?: never;
|
|
43
|
+
} | {
|
|
44
|
+
readonly upstream: RepoId;
|
|
45
|
+
readonly upstreamInternalId: InternalRepoId;
|
|
46
|
+
});
|
|
47
|
+
export interface RepoDeletedEvent extends RepoEnvelope {
|
|
48
|
+
readonly type: 'repo.deleted';
|
|
49
|
+
}
|
|
50
|
+
/** Written under the new name, past both names' sequences (Q28). */
|
|
51
|
+
export interface RepoRenamed extends RepoEnvelope {
|
|
52
|
+
readonly type: 'repo.renamed';
|
|
53
|
+
readonly from: RepoId;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* A repo made public or private by `repos.update`: `public` is what it is now, as `RepoInfo`
|
|
57
|
+
* names it. Written only when the update changes it, in the commit that does, so it's ordered
|
|
58
|
+
* with the repo's other events. Never written by a create, whose `repo.created` holds `public`,
|
|
59
|
+
* or by an update that sets `public` to what it was. It names a repo, never a ref, so what a
|
|
60
|
+
* caller may see of a repo's branches doesn't hold it back.
|
|
61
|
+
*/
|
|
62
|
+
export interface RepoVisibilityChanged extends RepoEnvelope {
|
|
63
|
+
readonly type: 'repo.visibility.changed';
|
|
64
|
+
readonly public: boolean;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* The write that moved a ref: one `id` for each write, usable as GitHub's `push_id`, how many
|
|
68
|
+
* branches and tags that write moved, so a consumer can cut a push as GitHub does (Q222), and its
|
|
69
|
+
* `source`, so a consumer can tell the queue's land from a person's push (#275).
|
|
70
|
+
*/
|
|
71
|
+
export interface RefPush {
|
|
72
|
+
readonly id: string;
|
|
73
|
+
readonly branches: number;
|
|
74
|
+
readonly tags: number;
|
|
75
|
+
readonly source: RefSource;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Each ref a write moved, with the same `push` as the others that write moved. `filesAllowed`:
|
|
79
|
+
* the files the ref's `refs.files` rules refuse that `authorize` let through, for a push with
|
|
80
|
+
* `-o allow-files`: each rule's, in the order the rules ran, the first refused first, each once.
|
|
81
|
+
* `bypassed`: the `refs.protect` and `refs.lock` rules `authorize` lifted for this move, by name,
|
|
82
|
+
* such as `refs.protect(main)`, in the order the rules ran.
|
|
83
|
+
*/
|
|
84
|
+
export interface RefUpdated extends RepoEnvelope, RefEdit {
|
|
85
|
+
readonly type: 'ref.updated';
|
|
86
|
+
readonly push: RefPush;
|
|
87
|
+
readonly filesAllowed?: readonly string[];
|
|
88
|
+
readonly bypassed?: readonly string[];
|
|
89
|
+
}
|
|
90
|
+
export interface BeforeAfter {
|
|
91
|
+
readonly before: number;
|
|
92
|
+
readonly after: number;
|
|
93
|
+
}
|
|
94
|
+
export interface RepoMaintained extends RepoEnvelope {
|
|
95
|
+
readonly type: 'repo.maintained';
|
|
96
|
+
readonly packs: BeforeAfter;
|
|
97
|
+
readonly bytes: BeforeAfter;
|
|
98
|
+
readonly deletedBytes: number;
|
|
99
|
+
}
|
|
100
|
+
/** A job of the repo's reached its last try: `error` is the failure's message. */
|
|
101
|
+
export interface RepoWorkFailed extends RepoEnvelope, JobRef {
|
|
102
|
+
readonly type: 'repo.work.failed';
|
|
103
|
+
readonly attempts: number;
|
|
104
|
+
readonly error: string;
|
|
105
|
+
}
|
|
106
|
+
export type RepoEvent = RepoCreated | RepoDeletedEvent | RepoRenamed | RepoVisibilityChanged | RefUpdated | RepoMaintained | RepoWorkFailed;
|
|
107
|
+
export interface TokenEventFields extends EventEnvelope {
|
|
108
|
+
readonly type: 'token.created' | 'token.revoked';
|
|
109
|
+
readonly token: TokenId;
|
|
110
|
+
readonly scope: TokenScope;
|
|
111
|
+
readonly subject: ActorId;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* A repo token's events are in its repo's sequence, and carry its `internalId` as a repo's events
|
|
115
|
+
* do; a prefix token's are in the prefix's own, and name no repo.
|
|
116
|
+
*/
|
|
117
|
+
export type TokenEvent = TokenEventFields & ({
|
|
118
|
+
readonly repo: RepoId;
|
|
119
|
+
readonly internalId: InternalRepoId;
|
|
120
|
+
readonly prefix?: never;
|
|
121
|
+
} | {
|
|
122
|
+
readonly prefix: string;
|
|
123
|
+
readonly repo?: never;
|
|
124
|
+
readonly internalId?: never;
|
|
125
|
+
});
|
|
126
|
+
export interface EntryAdded extends RepoEnvelope {
|
|
127
|
+
readonly type: 'queue.entry.added';
|
|
128
|
+
readonly entry: EntryId;
|
|
129
|
+
readonly key: string;
|
|
130
|
+
readonly target: RefName;
|
|
131
|
+
readonly source: RefName;
|
|
132
|
+
readonly head: Oid;
|
|
133
|
+
readonly priority?: number;
|
|
134
|
+
}
|
|
135
|
+
export interface EntryMerged extends RepoEnvelope {
|
|
136
|
+
readonly type: 'queue.entry.merged';
|
|
137
|
+
readonly entry: EntryId;
|
|
138
|
+
readonly candidate: CandidateId;
|
|
139
|
+
readonly commit: Oid;
|
|
140
|
+
}
|
|
141
|
+
/** `error`: for `host-error`, the failure's ID, which `onError` got too. */
|
|
142
|
+
export interface EntryFailed extends RepoEnvelope, Pick<ReportDetails, 'summary' | 'url'> {
|
|
143
|
+
readonly type: 'queue.entry.failed';
|
|
144
|
+
readonly entry: EntryId;
|
|
145
|
+
readonly reason: EntryFailureReason;
|
|
146
|
+
readonly candidate?: CandidateId;
|
|
147
|
+
readonly error?: string;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* `replaced`: the same key joined with a new head. `topic-ended`: a member added after `topic`
|
|
151
|
+
* ended, which its queue removes.
|
|
152
|
+
*/
|
|
153
|
+
export interface EntryRemoved extends RepoEnvelope {
|
|
154
|
+
readonly type: 'queue.entry.removed';
|
|
155
|
+
readonly entry: EntryId;
|
|
156
|
+
readonly reason: 'removed' | 'replaced' | 'topic-ended';
|
|
157
|
+
readonly topic?: TopicId;
|
|
158
|
+
}
|
|
159
|
+
/** A candidate built: CI fetches `ref`, or `commit` by ID, and reports on `candidate`. */
|
|
160
|
+
export interface CandidateOpened extends RepoEnvelope {
|
|
161
|
+
readonly type: 'queue.candidate.opened';
|
|
162
|
+
readonly candidate: CandidateId;
|
|
163
|
+
readonly ref: RefName;
|
|
164
|
+
readonly commit: Oid;
|
|
165
|
+
readonly entries: readonly EntryId[];
|
|
166
|
+
}
|
|
167
|
+
export interface CandidateReported extends RepoEnvelope, Report {
|
|
168
|
+
readonly type: 'queue.candidate.reported';
|
|
169
|
+
readonly candidate: CandidateId;
|
|
170
|
+
readonly blame?: readonly EntryId[];
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* An entry a `fail` failed, back at its place. `candidate`: the one the retry closed;
|
|
174
|
+
* `queue.candidate.opened` follows once advance opens the next over the entry (Q525).
|
|
175
|
+
*/
|
|
176
|
+
export interface EntryRetried extends RepoEnvelope {
|
|
177
|
+
readonly type: 'queue.entry.retried';
|
|
178
|
+
readonly entry: EntryId;
|
|
179
|
+
readonly candidate: CandidateId;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* An entry enters the order pinned: always the start of its hold. It opens alone, once nothing
|
|
183
|
+
* ahead of it in its lanes is open and nothing is landing, and while it's open nothing else on its
|
|
184
|
+
* target publishes, so it holds every lane till it ends. `candidate`: the candidate whose land
|
|
185
|
+
* conflict brought it to `landRestarts`; absent when a `retry` brought it back pinned.
|
|
186
|
+
*/
|
|
187
|
+
export interface EntryPinned extends RepoEnvelope {
|
|
188
|
+
readonly type: 'queue.entry.pinned';
|
|
189
|
+
readonly entry: EntryId;
|
|
190
|
+
readonly candidate?: CandidateId;
|
|
191
|
+
}
|
|
192
|
+
export interface CandidateClosedFields extends RepoEnvelope {
|
|
193
|
+
readonly type: 'queue.candidate.closed';
|
|
194
|
+
readonly candidate: CandidateId;
|
|
195
|
+
}
|
|
196
|
+
/** `commit`: what the target moved to, once merged. */
|
|
197
|
+
export type CandidateClosed = CandidateClosedFields & ({
|
|
198
|
+
readonly reason: 'merged';
|
|
199
|
+
readonly commit: Oid;
|
|
200
|
+
readonly judged: Judged;
|
|
201
|
+
} | {
|
|
202
|
+
readonly reason: Exclude<CandidateCloseReason, 'merged'>;
|
|
203
|
+
});
|
|
204
|
+
export interface HoldEventFields extends RepoEnvelope {
|
|
205
|
+
readonly type: 'queue.hold.created' | 'queue.hold.released';
|
|
206
|
+
readonly hold: HoldId;
|
|
207
|
+
readonly reason: string;
|
|
208
|
+
}
|
|
209
|
+
export type HoldEvent = HoldEventFields & ({
|
|
210
|
+
readonly entry: EntryId;
|
|
211
|
+
} | {
|
|
212
|
+
readonly target: RefName;
|
|
213
|
+
});
|
|
214
|
+
/** `revision`: this event's `seq`, as `restart` answers; `head`, the target's tip then. */
|
|
215
|
+
export interface QueueRestarted extends RepoEnvelope {
|
|
216
|
+
readonly type: 'queue.restarted';
|
|
217
|
+
readonly target: RefName;
|
|
218
|
+
readonly revision: number;
|
|
219
|
+
readonly head: Oid;
|
|
220
|
+
}
|
|
221
|
+
export type QueueEvent = EntryAdded | EntryMerged | EntryFailed | EntryRemoved | EntryRetried | EntryPinned | CandidateOpened | CandidateReported | CandidateClosed | HoldEvent | QueueRestarted;
|
|
222
|
+
/** A topic's event, in the topic's own sequence. */
|
|
223
|
+
export interface TopicEnvelope extends EventEnvelope {
|
|
224
|
+
readonly topic: TopicId;
|
|
225
|
+
readonly key: string;
|
|
226
|
+
}
|
|
227
|
+
export interface TopicAdded extends TopicEnvelope {
|
|
228
|
+
readonly type: 'topic.added';
|
|
229
|
+
readonly entries: readonly TopicEntry[];
|
|
230
|
+
}
|
|
231
|
+
/** Every member's candidate open: the exact set a topic report names, and whether one's needed. */
|
|
232
|
+
export interface TopicOpened extends TopicEnvelope {
|
|
233
|
+
readonly type: 'topic.opened';
|
|
234
|
+
readonly candidates: readonly TopicCandidate[];
|
|
235
|
+
readonly required: boolean;
|
|
236
|
+
}
|
|
237
|
+
export interface TopicReported extends TopicEnvelope, TopicReportDetails {
|
|
238
|
+
readonly type: 'topic.reported';
|
|
239
|
+
readonly verdict: Verdict;
|
|
240
|
+
}
|
|
241
|
+
export interface TopicMerged extends TopicEnvelope {
|
|
242
|
+
readonly type: 'topic.merged';
|
|
243
|
+
readonly entries: readonly TopicMergedEntry[];
|
|
244
|
+
}
|
|
245
|
+
export interface TopicFailed extends TopicEnvelope {
|
|
246
|
+
readonly type: 'topic.failed';
|
|
247
|
+
readonly failure: TopicFailure;
|
|
248
|
+
}
|
|
249
|
+
export interface TopicRemoved extends TopicEnvelope {
|
|
250
|
+
readonly type: 'topic.removed';
|
|
251
|
+
readonly reason: 'removed';
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* The topic's job, `name`, failed `attempts` tries in a row: once, at its 11th claim, beside
|
|
255
|
+
* `topic.failed` before the publish decision, and at every 10th failed try after it, as it rolls
|
|
256
|
+
* forward with no limit.
|
|
257
|
+
*/
|
|
258
|
+
export interface TopicWorkFailed extends TopicEnvelope {
|
|
259
|
+
readonly type: 'topic.work.failed';
|
|
260
|
+
readonly name: string;
|
|
261
|
+
readonly attempts: number;
|
|
262
|
+
}
|
|
263
|
+
export type TopicEvent = TopicAdded | TopicOpened | TopicReported | TopicMerged | TopicFailed | TopicRemoved | TopicWorkFailed;
|
|
264
|
+
/** The features whose events can be turned on. */
|
|
265
|
+
export type EventFeature = 'queue' | 'topics' | 'tokens';
|
|
266
|
+
/** The events a server with the `Enabled` features writes. */
|
|
267
|
+
export type GitEvent<Enabled extends EventFeature = EventFeature> = RepoEvent | ('queue' extends Enabled ? QueueEvent : never) | ('topics' extends Enabled ? TopicEvent : never) | ('tokens' extends Enabled ? TokenEvent : never);
|
|
268
|
+
/** One batch: up to 100 of one scope's events, in `seq` order. `attempt` is 1 on a first try. */
|
|
269
|
+
export interface EventsInput<Event extends GitEvent = GitEvent> {
|
|
270
|
+
readonly events: readonly Event[];
|
|
271
|
+
readonly attempt: number;
|
|
272
|
+
readonly signal: AbortSignal;
|
|
273
|
+
}
|
|
274
|
+
/** Delivers a batch whole, or throws, and the whole batch is sent again. */
|
|
275
|
+
export type EventsHandler<Event extends GitEvent = GitEvent> = (input: EventsInput<Event>) => Awaitable<void>;
|
|
276
|
+
export interface EventDelivery extends SavedHandlerOptions<EventsHandler> {}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { Acting } from "./blobs.mjs";
|
|
2
|
+
import { CommitDiffInput, ComparisonFile, Revision } from "./commits.mjs";
|
|
3
|
+
import { DiffListing, ReadPage } from "./engine.mjs";
|
|
4
|
+
import { Oid, RepoId } from "./ids.mjs";
|
|
5
|
+
import { Bytes } from "./objects.mjs";
|
|
6
|
+
import { Result } from "./result.mjs";
|
|
7
|
+
import { TreeEntry } from "./trees.mjs";
|
|
8
|
+
import { Listing } from "@ref0/infra";
|
|
9
|
+
/** Files at a revision, by path. */
|
|
10
|
+
export interface FileReadInput extends ReadPage {
|
|
11
|
+
readonly ref: Revision;
|
|
12
|
+
readonly paths: readonly string[];
|
|
13
|
+
}
|
|
14
|
+
export interface File {
|
|
15
|
+
readonly path: string;
|
|
16
|
+
readonly oid: Oid;
|
|
17
|
+
readonly mode: string;
|
|
18
|
+
readonly size: number;
|
|
19
|
+
readonly bytes: Bytes;
|
|
20
|
+
}
|
|
21
|
+
/** The page's files, in the order asked, and the page's paths that name no file. */
|
|
22
|
+
export interface FilesRead {
|
|
23
|
+
readonly files: Listing<File>;
|
|
24
|
+
readonly missing: readonly string[];
|
|
25
|
+
}
|
|
26
|
+
/** A folder at a revision: the root without `path`. */
|
|
27
|
+
export interface FilesListInput extends ReadPage {
|
|
28
|
+
readonly ref: Revision;
|
|
29
|
+
readonly path?: string;
|
|
30
|
+
readonly recursive?: boolean;
|
|
31
|
+
}
|
|
32
|
+
/** A diff's files, only those at or under `paths` when given, as a patch or as hunks. */
|
|
33
|
+
export interface FilesDiffInput extends CommitDiffInput {
|
|
34
|
+
readonly paths?: readonly string[];
|
|
35
|
+
readonly format?: 'patch' | 'hunks';
|
|
36
|
+
}
|
|
37
|
+
/** One line of a hunk, without its newline; `noNewline` when the file ends on it with none. */
|
|
38
|
+
export interface HunkLine {
|
|
39
|
+
readonly kind: 'context' | 'add' | 'delete';
|
|
40
|
+
readonly text: string;
|
|
41
|
+
readonly noNewline?: true;
|
|
42
|
+
}
|
|
43
|
+
/** One hunk, as `git diff` writes it, with three lines of context. */
|
|
44
|
+
export interface Hunk {
|
|
45
|
+
readonly oldStart: number;
|
|
46
|
+
readonly oldLines: number;
|
|
47
|
+
readonly newStart: number;
|
|
48
|
+
readonly newLines: number;
|
|
49
|
+
/** The hunk header's function context, after `@@ ... @@ `: empty when there's none. */
|
|
50
|
+
readonly context: string;
|
|
51
|
+
readonly lines: readonly HunkLine[];
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* A changed file, its lines, and its hunks: as text, `patch`, from its first `@@` as `git diff`
|
|
55
|
+
* writes it after the file's headers, or as `hunks`. Both are empty for a binary file, and where
|
|
56
|
+
* both sides hold the same content, as a rename or a mode change can. Content that isn't UTF-8
|
|
57
|
+
* decodes with replacements.
|
|
58
|
+
*/
|
|
59
|
+
export type FileDiff = ComparisonFile & ({
|
|
60
|
+
readonly patch: string;
|
|
61
|
+
} | {
|
|
62
|
+
readonly hunks: readonly Hunk[];
|
|
63
|
+
});
|
|
64
|
+
export interface FileCalls {
|
|
65
|
+
/**
|
|
66
|
+
* Files at a revision, each its `bytes` streamed as `blobs.get` streams a blob, to the file
|
|
67
|
+
* limit, 100 MiB. A page holds as many as fit 8 MiB as base64, and a file past it alone, which
|
|
68
|
+
* REST sends with no content and its client streams from the blob route. Its `bytes` limit has
|
|
69
|
+
* no default for a file's bytes: when the caller sets one, the page's files count against it.
|
|
70
|
+
*/
|
|
71
|
+
readonly read: (repo: RepoId, input: Acting<FileReadInput>) => Promise<Result<FilesRead>>;
|
|
72
|
+
readonly list: (repo: RepoId, input: Acting<FilesListInput>) => Promise<Result<Listing<TreeEntry>>>;
|
|
73
|
+
/** `git diff <base> <head> -- <paths>`, a file at a time: `patch` unless `format` is `hunks`. */
|
|
74
|
+
readonly diff: (repo: RepoId, input: Acting<FilesDiffInput>) => Promise<Result<DiffListing<FileDiff>>>;
|
|
75
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { ActorInput, WriteInput } from "./actors.mjs";
|
|
2
|
+
import { RefName, RepoId } from "./ids.mjs";
|
|
3
|
+
import { Ref } from "./refs.mjs";
|
|
4
|
+
import { RepoInfo, RepoInput } from "./repos.mjs";
|
|
5
|
+
import { Result } from "./result.mjs";
|
|
6
|
+
import { Listing, Page } from "@ref0/infra";
|
|
7
|
+
/** Whom a fork is for, such as Pip: a source has at most one fork for each holder. */
|
|
8
|
+
export interface ForkHolder {
|
|
9
|
+
readonly holder: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* `id`: the fork's own ID, `<holder>/<the source's last segment>` when left out, as GitHub names
|
|
13
|
+
* a fork: `acme/app` for `pip` is `pip/app` (Q327).
|
|
14
|
+
*/
|
|
15
|
+
export interface ForkCreateInput extends WriteInput, ForkHolder, Pick<RepoInput, 'internalId'> {
|
|
16
|
+
readonly id?: RepoId;
|
|
17
|
+
}
|
|
18
|
+
export interface ForkGetInput extends ActorInput, ForkHolder, Pick<RepoInput, 'internalId'> {}
|
|
19
|
+
/** A page of a source's forks, the newest first: `after` is the last page's `next`. */
|
|
20
|
+
export interface ForkListInput extends ActorInput, Pick<RepoInput, 'internalId'> {
|
|
21
|
+
readonly page?: Page;
|
|
22
|
+
}
|
|
23
|
+
/** What a fetch copied from: the source's name now, `head`, its default branch, and `tips`, each ref's tip. */
|
|
24
|
+
export interface ForkFetched {
|
|
25
|
+
readonly source: RepoId;
|
|
26
|
+
readonly head: RefName;
|
|
27
|
+
readonly tips: readonly Ref[];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* A fork is a complete repo of its own, made from what its source lists when it's made: every ref,
|
|
31
|
+
* and the source's packs, shared without copying a byte. Later pushes to either reach only the
|
|
32
|
+
* repo they're sent to, and deleting either leaves the other whole.
|
|
33
|
+
*/
|
|
34
|
+
export interface ForkCalls {
|
|
35
|
+
/**
|
|
36
|
+
* The holder's fork of `repo`, made now, or the one it has already, whatever `id` a second call
|
|
37
|
+
* passes, as GitHub answers a second fork. Its `upstream` is `repo`, and its `repo.created` names
|
|
38
|
+
* the source's internal ID too (Q197). `ALREADY_EXISTS` when another repo holds `id`, the default
|
|
39
|
+
* among them: the core never picks another name. `ALREADY_EXISTS` too when the holder has a fork
|
|
40
|
+
* the caller may not read, whatever `id`, and it names no fork: only its holder can give it. A
|
|
41
|
+
* source the caller may no longer fork by the read the fork copies is `NOT_FOUND`.
|
|
42
|
+
* `FAILED_PRECONDITION`, `reason: 'own-repo'`, when the default `id` is `repo` itself, as the
|
|
43
|
+
* holder's own repo is (Q327).
|
|
44
|
+
*/
|
|
45
|
+
readonly create: (repo: RepoId, input: ForkCreateInput) => Promise<Result<RepoInfo>>;
|
|
46
|
+
/** The holder's fork of `repo`, by the source's internal ID, across either's renames. */
|
|
47
|
+
readonly get: (repo: RepoId, input: ForkGetInput) => Promise<Result<RepoInfo>>;
|
|
48
|
+
/**
|
|
49
|
+
* `repo`'s live forks, the newest first, each named as it's named now. A fork the caller may not
|
|
50
|
+
* read is left out, and nothing counts it, so a page can be short while `next` says more may
|
|
51
|
+
* follow. Each `next` is sealed for this source's list and names no fork, and one that isn't a
|
|
52
|
+
* `next` of it is `INVALID_ARGUMENT`.
|
|
53
|
+
*/
|
|
54
|
+
readonly list: (repo: RepoId, input: ForkListInput) => Promise<Result<Listing<RepoInfo>>>;
|
|
55
|
+
/**
|
|
56
|
+
* Fast-forwards the fork's default branch to its source's, in one commit that takes the
|
|
57
|
+
* source's list as `create` does, and leaves its other refs alone. A fork whose branch has
|
|
58
|
+
* commits its source's lacks is `FAILED_PRECONDITION`, `reason: 'diverged'`, a repo that isn't a
|
|
59
|
+
* fork is `reason: 'not-a-fork'`, and a fork whose source is deleted, or that the caller may no
|
|
60
|
+
* longer read, is `NOT_FOUND`, as is a fork renamed since to a name the caller may not read.
|
|
61
|
+
*/
|
|
62
|
+
readonly sync: (fork: RepoId, input: WriteInput & Pick<RepoInput, 'internalId'>) => Promise<Result<RepoInfo>>;
|
|
63
|
+
/**
|
|
64
|
+
* Copies every object its source lists into the fork, as `sync` does, and moves no ref, as
|
|
65
|
+
* `git fetch upstream` does: the caller decides the move, such as `merges.create` of a diverged
|
|
66
|
+
* branch. It answers the source's tips from the read it copied. A second fetch copies only what
|
|
67
|
+
* the source has gained since, so it takes no key.
|
|
68
|
+
*
|
|
69
|
+
* It needs read on the source and `object.create` on the fork, as a push that names no ref
|
|
70
|
+
* does, so a `write` token may fetch into a fork. A sync moves the fork's branch, so it needs
|
|
71
|
+
* `fork.sync`, which only the host's own sign-in reaches.
|
|
72
|
+
*
|
|
73
|
+
* Nothing names what's copied until a ref does, so prune keeps it at least `prune` after the
|
|
74
|
+
* fetch: 14 days by default, never under 1 hour. A merge after that fails on its read, and
|
|
75
|
+
* leaves no ref at a missing object. Refused as `sync` is, but never `diverged`.
|
|
76
|
+
*/
|
|
77
|
+
readonly fetch: (fork: RepoId, input: ActorInput & Pick<RepoInput, 'internalId'>) => Promise<Result<ForkFetched>>;
|
|
78
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { ActorId, CallInput, Credentials, NamedActor } from "./actors.mjs";
|
|
2
|
+
import { RepoId } from "./ids.mjs";
|
|
3
|
+
import { Awaitable } from "./result.mjs";
|
|
4
|
+
import { TokenScope } from "./tokens.mjs";
|
|
5
|
+
export interface GrantInput extends CallInput {
|
|
6
|
+
readonly credentials: Credentials;
|
|
7
|
+
readonly request: Request;
|
|
8
|
+
readonly signal: AbortSignal;
|
|
9
|
+
}
|
|
10
|
+
export interface GrantReachInput extends CallInput {
|
|
11
|
+
readonly repo: RepoId;
|
|
12
|
+
readonly signal: AbortSignal;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* What a credential an extension issued holds: who it acts as, its ceiling, and which repos it
|
|
16
|
+
* reaches, asked on each request and again in a write's final read, so a grant that ends stops at
|
|
17
|
+
* the next commit. `id`: what its resolver names it by in `again`, such as an App's installation,
|
|
18
|
+
* so work that outlives the request, such as a merge queue entry, keeps the ID, never the
|
|
19
|
+
* credential, and asks for the grant again.
|
|
20
|
+
*/
|
|
21
|
+
export interface Grant {
|
|
22
|
+
readonly id: string;
|
|
23
|
+
readonly actor: NamedActor;
|
|
24
|
+
readonly subject?: ActorId;
|
|
25
|
+
readonly scope: TokenScope;
|
|
26
|
+
/**
|
|
27
|
+
* The folder every repo `reaches` answers yes for sits under, read as a prefix token's `prefix`
|
|
28
|
+
* is: `''`, or a prefix that ends in `/`. `forks.list` reads a source's forks under it alone, so
|
|
29
|
+
* it asks `reaches` of no fork outside it. Without it, the list reads every fork of the source
|
|
30
|
+
* and asks `reaches` of each. A `reach` that leaves out a repo `reaches` answers yes for hides
|
|
31
|
+
* that repo from the list.
|
|
32
|
+
*/
|
|
33
|
+
readonly reach?: string;
|
|
34
|
+
readonly reaches: (input: GrantReachInput) => Awaitable<boolean>;
|
|
35
|
+
}
|
|
36
|
+
/** A grant asked for again by the `id` it had, with the actor and subject it acted as then. */
|
|
37
|
+
export interface GrantAgainInput extends CallInput {
|
|
38
|
+
readonly id: string;
|
|
39
|
+
readonly actor: ActorId;
|
|
40
|
+
readonly subject?: ActorId;
|
|
41
|
+
readonly signal: AbortSignal;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* What host code asks `grantAgain` with: `GrantAgainInput`, its `signal` optional. The resolver
|
|
45
|
+
* gets it joined with Git's own, so a request that goes away stops the read.
|
|
46
|
+
*/
|
|
47
|
+
export type GrantAgainRequest = Omit<GrantAgainInput, 'signal'> & {
|
|
48
|
+
readonly signal?: AbortSignal;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* `resolve`: asked about a credential Git's own tokens don't know, before `auth`: its grant, or
|
|
52
|
+
* `undefined` when the credential isn't this resolver's. `again`: the grant `id` names now, read
|
|
53
|
+
* live, or `undefined` once it ended, which refuses whatever asked. Git refuses a grant `again`
|
|
54
|
+
* answers that acts for another actor or subject than the input's.
|
|
55
|
+
*/
|
|
56
|
+
export interface GrantResolver {
|
|
57
|
+
readonly name: string;
|
|
58
|
+
readonly resolve: (input: GrantInput) => Awaitable<Grant | undefined>;
|
|
59
|
+
readonly again: (input: GrantAgainInput) => Awaitable<Grant | undefined>;
|
|
60
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Duration, Retry } from "@ref0/infra";
|
|
2
|
+
/** A host function Git calls inside a request or a job, with the length of one try. */
|
|
3
|
+
export interface HandlerOptions<Handler> {
|
|
4
|
+
readonly handler: Handler;
|
|
5
|
+
readonly timeout?: Duration;
|
|
6
|
+
}
|
|
7
|
+
/** A host function a saved job calls, tried again as `retry` says when it throws. */
|
|
8
|
+
export interface SavedHandlerOptions<Handler> extends HandlerOptions<Handler> {
|
|
9
|
+
readonly retry?: Retry;
|
|
10
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** An object's ID: 40 hex digits for SHA-1. */
|
|
2
|
+
export type Oid = string;
|
|
3
|
+
/** A full ref name, such as `refs/heads/main`. `isRefName` says which the library takes. */
|
|
4
|
+
export type RefName = string;
|
|
5
|
+
/**
|
|
6
|
+
* A repo's public ID, which the host chooses: `acme/app`, `notes`, `a/b/c`. `isRepoId` says which
|
|
7
|
+
* the library takes.
|
|
8
|
+
*/
|
|
9
|
+
export type RepoId = string;
|
|
10
|
+
/** What the library keys a repo's records on: a new one on each create of a name. */
|
|
11
|
+
export type InternalRepoId = `r_${string}`;
|
|
12
|
+
/** A topic's ID, `t_` and random text, which its key names in `git/topics`. */
|
|
13
|
+
export type TopicId = string;
|
|
14
|
+
/** The scopes Git keeps in its one store. */
|
|
15
|
+
export type GitScope = `git/repo/${InternalRepoId}` | `git/topic/${TopicId}` | 'git/topics' | 'git/repos' | 'git/signin' | `git/tokens/${string}`;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// src/contracts/ids.ts
|
|
2
|
+
/**
|
|
3
|
+
* How long a ref's name may be, in UTF-8 bytes, `refs/` included. Every call that takes a ref name
|
|
4
|
+
* refuses a longer one, as `isRefName` does: a push answers `funny refname`, the rest
|
|
5
|
+
* `INVALID_ARGUMENT`. So a ref's name, which each event of a push repeats, stays a small part of a
|
|
6
|
+
* commit.
|
|
7
|
+
*/
|
|
8
|
+
const maxRefNameLength = 1024;
|
|
9
|
+
/**
|
|
10
|
+
* Whether `text` is an internal ID as a repo's create makes one: `r_` and 16 base64url characters,
|
|
11
|
+
* its 12 random bytes. A scope, a queue entry's ID or a token's text names a repo by one only once
|
|
12
|
+
* it passes.
|
|
13
|
+
*/
|
|
14
|
+
const isInternalId = (text) => /^r_[A-Za-z0-9_-]{16}$/.test(text);
|
|
15
|
+
export { isInternalId, maxRefNameLength };
|