@ref0/git 0.0.0 → 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 +86 -5
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
import { contended } from "../core/access.mjs";
|
|
2
|
+
import { decodeRow, fail } from "../store/errors.mjs";
|
|
3
|
+
import { decodeOutbox, outboxReads } from "../store/outbox.mjs";
|
|
4
|
+
import { WholeRepo, wholeRef } from "../store/ref-rows.mjs";
|
|
5
|
+
import { readRecord } from "../store/repo-record.mjs";
|
|
6
|
+
import { collections } from "../store/scopes.mjs";
|
|
7
|
+
import { queueId, shortTarget } from "./ids.mjs";
|
|
8
|
+
import { placeOrder } from "./pages.mjs";
|
|
9
|
+
import { CandidateRow, CounterRow, EntryRow, HoldRow, KeyRow, MetaRow, ReportRow, TargetRow } from "./rows.mjs";
|
|
10
|
+
import * as Effect from "effect/Effect";
|
|
11
|
+
// src/queue/state.ts
|
|
12
|
+
/** The queue merges onto its target's tip whoever added the entry: it reads the repo whole. */
|
|
13
|
+
const queueWhole = WholeRepo.mint();
|
|
14
|
+
/** The ID of the row that keeps the entry `key` merged last on `target`. */
|
|
15
|
+
const keyRowId = (target, key) => JSON.stringify([target, key]);
|
|
16
|
+
const counterKey = {
|
|
17
|
+
collection: collections.queue,
|
|
18
|
+
id: "self"
|
|
19
|
+
};
|
|
20
|
+
const emptyTarget = {
|
|
21
|
+
order: [],
|
|
22
|
+
open: [],
|
|
23
|
+
holds: [],
|
|
24
|
+
keyHolds: {}
|
|
25
|
+
};
|
|
26
|
+
const named = (row, reading) => ({
|
|
27
|
+
entries: reading === "row" ? [] : row.order.map((place) => place.entry),
|
|
28
|
+
candidates: reading === "target" ? [...row.open, ...row.searches ?? []] : [],
|
|
29
|
+
holds: reading === "target" ? openHolds(row) : []
|
|
30
|
+
});
|
|
31
|
+
/** The IDs of a target's open holds: its own, then each key's. */
|
|
32
|
+
const openHolds = (row) => [...row.holds, ...Object.values(row.keyHolds).flat()];
|
|
33
|
+
const idReads = (collection, ids) => ids.map((id) => ({
|
|
34
|
+
collection,
|
|
35
|
+
id
|
|
36
|
+
}));
|
|
37
|
+
/** Each row a read of `ids` found, by ID. */
|
|
38
|
+
const decodeAll = Effect.fnUntraced(function* (schema, results, what) {
|
|
39
|
+
const rows = /* @__PURE__ */ new Map();
|
|
40
|
+
for (const [row] of results) {
|
|
41
|
+
if (row === void 0) continue;
|
|
42
|
+
rows.set(row.id, yield* decodeRow(schema, row, `${what} '${row.id}'`));
|
|
43
|
+
}
|
|
44
|
+
return rows;
|
|
45
|
+
});
|
|
46
|
+
const union = (a = [], b = []) => [.../* @__PURE__ */ new Set([...a, ...b])];
|
|
47
|
+
/**
|
|
48
|
+
* `target`'s queue in `internalId`'s repo, read at one version: the target's row first, then it
|
|
49
|
+
* and every row it names, again until a read finds no row it names that it didn't read. A target
|
|
50
|
+
* that keeps changing under it is `contended()`. A read that plans nothing may take only the
|
|
51
|
+
* entries, `order`, or none of them, `row`; the rest of its state is then empty.
|
|
52
|
+
*/
|
|
53
|
+
const loadTarget = Effect.fnUntraced(function* (store, internalId, target, also = {}, reading = "target") {
|
|
54
|
+
let wanted = {
|
|
55
|
+
entries: [],
|
|
56
|
+
candidates: [],
|
|
57
|
+
holds: []
|
|
58
|
+
};
|
|
59
|
+
const keys = also.keys ?? [];
|
|
60
|
+
for (let attempt = 0; attempt < 5; attempt += 1) {
|
|
61
|
+
const ids = {
|
|
62
|
+
entries: union(wanted.entries, also.entries),
|
|
63
|
+
candidates: union(wanted.candidates, also.candidates),
|
|
64
|
+
holds: union(wanted.holds, also.holds)
|
|
65
|
+
};
|
|
66
|
+
const { record, snapshot } = yield* readRecord(store, internalId, [
|
|
67
|
+
...outboxReads,
|
|
68
|
+
counterKey,
|
|
69
|
+
{
|
|
70
|
+
collection: collections.queueTargets,
|
|
71
|
+
id: target
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
collection: collections.refs,
|
|
75
|
+
id: target
|
|
76
|
+
},
|
|
77
|
+
...idReads(collections.queueEntries, ids.entries),
|
|
78
|
+
...idReads(collections.queueCandidates, ids.candidates),
|
|
79
|
+
...idReads(collections.queueHolds, ids.holds),
|
|
80
|
+
...idReads(collections.queueKeys, keys.map((key) => keyRowId(target, key)))
|
|
81
|
+
]);
|
|
82
|
+
if (record === void 0 || record.deleted === true) return yield* fail("NOT_FOUND", "The repo was deleted");
|
|
83
|
+
const { results } = snapshot;
|
|
84
|
+
const [targetRow] = results[4] ?? [];
|
|
85
|
+
const row = targetRow === void 0 ? emptyTarget : yield* decodeRow(TargetRow, targetRow, `The queue of '${target}'`);
|
|
86
|
+
const names = named(row, reading);
|
|
87
|
+
const missing = (key) => names[key].some((id) => !ids[key].includes(id));
|
|
88
|
+
if (missing("entries") || missing("candidates") || missing("holds")) {
|
|
89
|
+
wanted = names;
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
const outbox = yield* decodeOutbox(results.slice(1, 3));
|
|
93
|
+
const [counter] = results[3] ?? [];
|
|
94
|
+
const [ref] = results[5] ?? [];
|
|
95
|
+
const firstEntry = 6;
|
|
96
|
+
const firstCandidate = firstEntry + ids.entries.length;
|
|
97
|
+
const firstHold = firstCandidate + ids.candidates.length;
|
|
98
|
+
const firstKey = firstHold + ids.holds.length;
|
|
99
|
+
const keyRows = yield* decodeAll(KeyRow, results.slice(firstKey), "The queue key");
|
|
100
|
+
return {
|
|
101
|
+
version: snapshot.version,
|
|
102
|
+
internalId,
|
|
103
|
+
record,
|
|
104
|
+
revision: outbox.head.next - 1,
|
|
105
|
+
next: counter === void 0 ? 1 : (yield* decodeRow(CounterRow, counter, "The queue counter")).next,
|
|
106
|
+
target,
|
|
107
|
+
row,
|
|
108
|
+
tip: ref === void 0 ? null : yield* wholeRef(queueWhole, ref, `The ref '${target}'`),
|
|
109
|
+
entries: yield* decodeAll(EntryRow, results.slice(firstEntry, firstCandidate), "The queue entry"),
|
|
110
|
+
candidates: yield* decodeAll(CandidateRow, results.slice(firstCandidate, firstHold), "The candidate"),
|
|
111
|
+
holds: yield* decodeAll(HoldRow, results.slice(firstHold, firstKey), "The hold"),
|
|
112
|
+
keys: new Map(keys.flatMap((key) => {
|
|
113
|
+
const found = keyRows.get(keyRowId(target, key));
|
|
114
|
+
return found === void 0 ? [] : [[key, found]];
|
|
115
|
+
}))
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
return yield* contended();
|
|
119
|
+
});
|
|
120
|
+
/**
|
|
121
|
+
* What one call or step writes to a target's queue, planned over a `TargetState`: rows changed
|
|
122
|
+
* in place, by ID, ref edits, events and jobs, all committed in one push at the state's version.
|
|
123
|
+
*/
|
|
124
|
+
var QueuePlan = class {
|
|
125
|
+
state;
|
|
126
|
+
next;
|
|
127
|
+
edits = [];
|
|
128
|
+
/** For the publish check, what a candidate's publish of each target publishes: its entries' heads. */
|
|
129
|
+
publishes = /* @__PURE__ */ new Map();
|
|
130
|
+
jobs = [];
|
|
131
|
+
events = [];
|
|
132
|
+
#row;
|
|
133
|
+
#entries;
|
|
134
|
+
#candidates;
|
|
135
|
+
#holds;
|
|
136
|
+
#metas = /* @__PURE__ */ new Map();
|
|
137
|
+
#reports = /* @__PURE__ */ new Map();
|
|
138
|
+
#keys = /* @__PURE__ */ new Map();
|
|
139
|
+
#changed = /* @__PURE__ */ new Set();
|
|
140
|
+
/** The clock's time the plan was made at, which a place joining takes as its `since`. */
|
|
141
|
+
now;
|
|
142
|
+
constructor(state, now) {
|
|
143
|
+
this.state = state;
|
|
144
|
+
this.now = now;
|
|
145
|
+
this.next = state.next;
|
|
146
|
+
this.#row = state.row;
|
|
147
|
+
this.#entries = new Map(state.entries);
|
|
148
|
+
this.#candidates = new Map(state.candidates);
|
|
149
|
+
this.#holds = new Map(state.holds);
|
|
150
|
+
}
|
|
151
|
+
get row() {
|
|
152
|
+
return this.#row;
|
|
153
|
+
}
|
|
154
|
+
get entries() {
|
|
155
|
+
return this.#entries;
|
|
156
|
+
}
|
|
157
|
+
get candidates() {
|
|
158
|
+
return this.#candidates;
|
|
159
|
+
}
|
|
160
|
+
get holds() {
|
|
161
|
+
return this.#holds;
|
|
162
|
+
}
|
|
163
|
+
/** A new ID of `kind`, from the repo's counter. */
|
|
164
|
+
id(kind) {
|
|
165
|
+
const id = queueId(kind, this.state.internalId, this.next);
|
|
166
|
+
this.next += 1;
|
|
167
|
+
return id;
|
|
168
|
+
}
|
|
169
|
+
setTarget(row) {
|
|
170
|
+
this.#row = row;
|
|
171
|
+
this.#changed.add("target");
|
|
172
|
+
}
|
|
173
|
+
setEntry(id, row) {
|
|
174
|
+
this.#entries.set(id, row);
|
|
175
|
+
this.#changed.add(`e:${id}`);
|
|
176
|
+
}
|
|
177
|
+
setCandidate(id, row) {
|
|
178
|
+
this.#candidates.set(id, row);
|
|
179
|
+
this.#changed.add(`c:${id}`);
|
|
180
|
+
}
|
|
181
|
+
setHold(id, row) {
|
|
182
|
+
this.#holds.set(id, row);
|
|
183
|
+
this.#changed.add(`h:${id}`);
|
|
184
|
+
}
|
|
185
|
+
/** An entry's `meta`, which it keeps as its own row: written once, as the entry is added. */
|
|
186
|
+
setMeta(entry, meta) {
|
|
187
|
+
this.#metas.set(entry, meta);
|
|
188
|
+
this.#changed.add(`m:${entry}`);
|
|
189
|
+
}
|
|
190
|
+
/** A candidate's report, which it keeps as its own row too, for the entries it judged. */
|
|
191
|
+
setReport(candidate, report) {
|
|
192
|
+
this.#reports.set(candidate, report);
|
|
193
|
+
this.#changed.add(`r:${candidate}`);
|
|
194
|
+
}
|
|
195
|
+
/** The entry `key` merged last, and its head. */
|
|
196
|
+
setKey(key, row) {
|
|
197
|
+
this.#keys.set(key, row);
|
|
198
|
+
this.#changed.add(`k:${key}`);
|
|
199
|
+
}
|
|
200
|
+
/** Adds an event, made once its envelope and its own `seq` are known. */
|
|
201
|
+
event(made) {
|
|
202
|
+
this.events.push(made);
|
|
203
|
+
}
|
|
204
|
+
/** The topics whose members' entries or candidates the plan moves, each once. */
|
|
205
|
+
topicsMoved() {
|
|
206
|
+
const entries = /* @__PURE__ */ new Set();
|
|
207
|
+
for (const changed of this.#changed) {
|
|
208
|
+
const [kind, id = ""] = changed.split(/:(.*)/s);
|
|
209
|
+
if (kind === "e") entries.add(id);
|
|
210
|
+
if (kind === "c") for (const entry of this.#candidates.get(id)?.entries ?? []) entries.add(entry);
|
|
211
|
+
}
|
|
212
|
+
const topics = [...entries].map((entry) => this.#entries.get(entry)?.topic?.topic);
|
|
213
|
+
return new Set(topics.filter((topic) => topic !== void 0));
|
|
214
|
+
}
|
|
215
|
+
/** Whether the plan writes anything. */
|
|
216
|
+
get writes() {
|
|
217
|
+
return this.#changed.size > 0 || this.edits.length > 0 || this.events.length > 0;
|
|
218
|
+
}
|
|
219
|
+
/** The rows the plan puts: each it changed, and the counter once it took a number. */
|
|
220
|
+
rows() {
|
|
221
|
+
const put = [];
|
|
222
|
+
if (this.next !== this.state.next) put.push({
|
|
223
|
+
...counterKey,
|
|
224
|
+
value: { next: this.next }
|
|
225
|
+
});
|
|
226
|
+
for (const changed of this.#changed) {
|
|
227
|
+
const [kind, id = ""] = changed.split(/:(.*)/s);
|
|
228
|
+
if (kind === "target") put.push({
|
|
229
|
+
collection: collections.queueTargets,
|
|
230
|
+
id: this.state.target,
|
|
231
|
+
value: this.#row
|
|
232
|
+
});
|
|
233
|
+
if (kind === "e") put.push({
|
|
234
|
+
collection: collections.queueEntries,
|
|
235
|
+
id,
|
|
236
|
+
value: this.#entries.get(id)
|
|
237
|
+
});
|
|
238
|
+
if (kind === "c") put.push({
|
|
239
|
+
collection: collections.queueCandidates,
|
|
240
|
+
id,
|
|
241
|
+
value: this.#candidates.get(id)
|
|
242
|
+
});
|
|
243
|
+
if (kind === "h") put.push({
|
|
244
|
+
collection: collections.queueHolds,
|
|
245
|
+
id,
|
|
246
|
+
value: this.#holds.get(id)
|
|
247
|
+
});
|
|
248
|
+
if (kind === "m") put.push({
|
|
249
|
+
collection: collections.queueMeta,
|
|
250
|
+
id,
|
|
251
|
+
value: this.#metas.get(id)
|
|
252
|
+
});
|
|
253
|
+
if (kind === "r") put.push({
|
|
254
|
+
collection: collections.queueReports,
|
|
255
|
+
id,
|
|
256
|
+
value: this.#reports.get(id)
|
|
257
|
+
});
|
|
258
|
+
if (kind === "k") {
|
|
259
|
+
const value = this.#keys.get(id);
|
|
260
|
+
put.push({
|
|
261
|
+
collection: collections.queueKeys,
|
|
262
|
+
id: keyRowId(this.state.target, id),
|
|
263
|
+
value
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
return put;
|
|
268
|
+
}
|
|
269
|
+
/** The events in `envelope`, the first at `first`. */
|
|
270
|
+
eventsAt(envelope, first) {
|
|
271
|
+
return this.events.map((made, index) => made(envelope, first + index));
|
|
272
|
+
}
|
|
273
|
+
};
|
|
274
|
+
/** Entries whose notes one read takes: a `meta` under 4 KiB and a report under 32 KiB each. */
|
|
275
|
+
const notesMost = 100;
|
|
276
|
+
/**
|
|
277
|
+
* The notes of each of `entries`, by ID, read `notesMost` entries at a time: the `meta` rows of
|
|
278
|
+
* those that have one and the reports of the candidates they were `judged` by, never those
|
|
279
|
+
* candidates, whose entries and blame a closed one keeps. A `meta` is written once, and a report
|
|
280
|
+
* once, in the commit that sets the entry's `judged`, so a later read finds what the entry's row
|
|
281
|
+
* says, and reads at different versions agree.
|
|
282
|
+
*/
|
|
283
|
+
const entryNotes = Effect.fnUntraced(function* (store, internalId, entries) {
|
|
284
|
+
const notes = /* @__PURE__ */ new Map();
|
|
285
|
+
for (let at = 0; at < entries.length; at += notesMost) {
|
|
286
|
+
const some = entries.slice(at, at + notesMost);
|
|
287
|
+
const metas = some.flatMap(([id, row]) => row.meta === true ? [id] : []);
|
|
288
|
+
const judged = union(some.flatMap(([, row]) => row.judged === void 0 ? [] : [row.judged]));
|
|
289
|
+
const { snapshot } = yield* readRecord(store, internalId, [...idReads(collections.queueMeta, metas), ...idReads(collections.queueReports, judged)]);
|
|
290
|
+
const results = snapshot.results.slice(1);
|
|
291
|
+
const metaRows = yield* decodeAll(MetaRow, results.slice(0, metas.length), "The meta of");
|
|
292
|
+
const reports = yield* decodeAll(ReportRow, results.slice(metas.length), "The report of");
|
|
293
|
+
for (const [id, row] of some) {
|
|
294
|
+
const note = {};
|
|
295
|
+
const meta = metaRows.get(id);
|
|
296
|
+
if (meta !== void 0) note.meta = meta;
|
|
297
|
+
const report = row.judged === void 0 ? void 0 : reports.get(row.judged);
|
|
298
|
+
if (report !== void 0) note.report = report;
|
|
299
|
+
notes.set(id, note);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
return notes;
|
|
303
|
+
});
|
|
304
|
+
/** The entries of `ids` a read finds, by ID, for a page of them. */
|
|
305
|
+
const readEntries = Effect.fnUntraced(function* (store, internalId, ids) {
|
|
306
|
+
const reads = idReads(collections.queueEntries, ids);
|
|
307
|
+
const { snapshot } = yield* readRecord(store, internalId, reads);
|
|
308
|
+
return yield* decodeAll(EntryRow, snapshot.results.slice(1), "The queue entry");
|
|
309
|
+
});
|
|
310
|
+
/** A repo with no queue, or none on `target`: `NOT_FOUND`, reason `no-queue` (Q364). */
|
|
311
|
+
const noQueue = (repo, target) => {
|
|
312
|
+
if (target === void 0) return fail("NOT_FOUND", `${repo} has no merge queue`, { context: { reason: "no-queue" } });
|
|
313
|
+
return fail("NOT_FOUND", `${repo}'s ${shortTarget(target)} has no merge queue`, { context: {
|
|
314
|
+
reason: "no-queue",
|
|
315
|
+
target
|
|
316
|
+
} });
|
|
317
|
+
};
|
|
318
|
+
/** An entry's, candidate's or hold's ID that names nothing in `repo`. */
|
|
319
|
+
const unknownId = (what, id) => fail("NOT_FOUND", `No ${what} '${id}'`);
|
|
320
|
+
/**
|
|
321
|
+
* The order entries are tried in: those checking first, as they stand, then each jumped, the last
|
|
322
|
+
* to jump first, then the highest priority, then the earliest to join.
|
|
323
|
+
*/
|
|
324
|
+
const orderOf = (order) => order.toSorted(placeOrder);
|
|
325
|
+
export { QueuePlan, entryNotes, keyRowId, loadTarget, noQueue, openHolds, orderOf, readEntries, unknownId };
|
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
import { advanceRow } from "../store/queue-jobs.mjs";
|
|
2
|
+
import { queueRef } from "./ids.mjs";
|
|
3
|
+
import { isPinned } from "./lanes.mjs";
|
|
4
|
+
import { orderOf } from "./state.mjs";
|
|
5
|
+
// src/queue/steps.ts
|
|
6
|
+
/** The steps every queue write shares, each a change to a `QueuePlan`, and the rows as answered. */
|
|
7
|
+
/** An entry's row as `get`, `list` and `add` answer it, with its `meta` and report from `notes`. */
|
|
8
|
+
const entryOf = (repo, id, row, notes) => {
|
|
9
|
+
const entry = {
|
|
10
|
+
id,
|
|
11
|
+
repo,
|
|
12
|
+
target: row.target,
|
|
13
|
+
source: row.source,
|
|
14
|
+
head: row.head,
|
|
15
|
+
key: row.key,
|
|
16
|
+
actor: { id: row.actor },
|
|
17
|
+
state: row.state,
|
|
18
|
+
lanes: row.lanes
|
|
19
|
+
};
|
|
20
|
+
if (row.priority !== void 0) entry.priority = row.priority;
|
|
21
|
+
if (notes.meta !== void 0) entry.meta = notes.meta;
|
|
22
|
+
if (row.subject !== void 0) entry.subject = { id: row.subject };
|
|
23
|
+
if (notes.report !== void 0) entry.report = notes.report;
|
|
24
|
+
if (isOpen(row) && isPinned(row)) entry.pinned = true;
|
|
25
|
+
return entry;
|
|
26
|
+
};
|
|
27
|
+
const candidateOf = (repo, id, row) => {
|
|
28
|
+
const candidate = {
|
|
29
|
+
id,
|
|
30
|
+
repo,
|
|
31
|
+
target: row.target,
|
|
32
|
+
base: row.base,
|
|
33
|
+
entries: row.entries,
|
|
34
|
+
state: row.state
|
|
35
|
+
};
|
|
36
|
+
if (row.ref !== void 0) candidate.ref = row.ref;
|
|
37
|
+
if (row.commit !== void 0) candidate.commit = row.commit;
|
|
38
|
+
if (row.report !== void 0) candidate.report = row.report;
|
|
39
|
+
if (row.reason !== void 0) candidate.reason = row.reason;
|
|
40
|
+
return candidate;
|
|
41
|
+
};
|
|
42
|
+
const holdOf = (repo, id, row) => row.entry === void 0 ? {
|
|
43
|
+
id,
|
|
44
|
+
repo,
|
|
45
|
+
reason: row.reason,
|
|
46
|
+
target: row.target
|
|
47
|
+
} : {
|
|
48
|
+
id,
|
|
49
|
+
repo,
|
|
50
|
+
reason: row.reason,
|
|
51
|
+
entry: row.entry
|
|
52
|
+
};
|
|
53
|
+
/** Whether an entry is still in its target's order. */
|
|
54
|
+
const isOpen = (row) => row.state === "waiting" || row.state === "checking" || row.state === "held";
|
|
55
|
+
/** How many open entries stand ahead of `entry` in its target's order. */
|
|
56
|
+
const aheadOf = (plan, entry) => {
|
|
57
|
+
const order = orderOf(plan.row.order);
|
|
58
|
+
return Math.max(0, order.findIndex((place) => place.entry === entry));
|
|
59
|
+
};
|
|
60
|
+
/** The next number in the plan's order, which a new or released entry joins at. */
|
|
61
|
+
const joinedAt = (plan) => {
|
|
62
|
+
const joined = plan.next;
|
|
63
|
+
plan.next += 1;
|
|
64
|
+
return joined;
|
|
65
|
+
};
|
|
66
|
+
/** A target's open candidates that stack in their lanes and publish: all but bisect groups. */
|
|
67
|
+
const stackOf = (queue) => queue.row.open.filter((id) => queue.candidates.get(id)?.group === void 0);
|
|
68
|
+
/** `entry` waiting again, or held, if it's checking for `candidate`. */
|
|
69
|
+
const releaseEntry = (plan, entry, candidate) => {
|
|
70
|
+
const row = plan.entries.get(entry);
|
|
71
|
+
if (row?.state !== "checking" || row.candidate !== candidate) return;
|
|
72
|
+
const { candidate: _candidate, ...waiting } = row;
|
|
73
|
+
plan.setEntry(entry, {
|
|
74
|
+
...waiting,
|
|
75
|
+
state: held(plan, row) ? "held" : "waiting"
|
|
76
|
+
});
|
|
77
|
+
setChecking(plan, entry, false);
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* What a closed candidate counts as among the outcomes: `m` merged, `b` failed by its report, and
|
|
81
|
+
* `c` any other close, which counts toward the 50 but neither way. A bisect's group counts none:
|
|
82
|
+
* the batch it searches counted once.
|
|
83
|
+
*/
|
|
84
|
+
const outcomeOf = (row) => {
|
|
85
|
+
if (row.reason === "merged") return "m";
|
|
86
|
+
return row.reason === "failed" && row.report?.verdict === "fail" ? "b" : "c";
|
|
87
|
+
};
|
|
88
|
+
/** The target's row with one more outcome, its oldest past `recentMost` dropped. */
|
|
89
|
+
const withOutcome = (row, outcome) => ({
|
|
90
|
+
...row,
|
|
91
|
+
recent: `${row.recent ?? ""}${outcome}`.slice(-50)
|
|
92
|
+
});
|
|
93
|
+
/**
|
|
94
|
+
* Closes an open candidate for `reason`: its ref is deleted, it leaves the target's open list,
|
|
95
|
+
* and each of its entries still checking waits again. Unless it merged, each open candidate built
|
|
96
|
+
* over it, stacked on its commit or carrying its entries, closes too, `superseded`, or `restarted`
|
|
97
|
+
* with it, and so on, and each bisect of a candidate built over it ends, since its groups carry
|
|
98
|
+
* what it carried. A bisect group stacks on nothing: one closed while its bisect still waits on it
|
|
99
|
+
* ends the bisect, so a judgment takes it out of the bisect first.
|
|
100
|
+
*/
|
|
101
|
+
const closeCandidate = (plan, id, reason, extra = {}) => {
|
|
102
|
+
const row = plan.candidates.get(id);
|
|
103
|
+
if (row === void 0 || row.state === "closed") return;
|
|
104
|
+
if (row.ref !== void 0 && row.commit !== void 0) plan.edits.push({
|
|
105
|
+
ref: row.ref,
|
|
106
|
+
from: row.commit,
|
|
107
|
+
to: null
|
|
108
|
+
});
|
|
109
|
+
const { ref: _ref, built: _built, landing: _landing, landed: _landed, ...open } = row;
|
|
110
|
+
const closed = {
|
|
111
|
+
...open,
|
|
112
|
+
state: "closed",
|
|
113
|
+
reason
|
|
114
|
+
};
|
|
115
|
+
if (extra.report !== void 0) closed.report = extra.report;
|
|
116
|
+
plan.setCandidate(id, closed);
|
|
117
|
+
plan.setTarget({
|
|
118
|
+
...plan.row,
|
|
119
|
+
open: plan.row.open.filter((open) => open !== id)
|
|
120
|
+
});
|
|
121
|
+
if (row.group === void 0) plan.setTarget(withOutcome(plan.row, outcomeOf(closed)));
|
|
122
|
+
for (const entry of row.entries) releaseEntry(plan, entry, id);
|
|
123
|
+
if (reason === "merged") return;
|
|
124
|
+
plan.event((envelope) => ({
|
|
125
|
+
type: "queue.candidate.closed",
|
|
126
|
+
...envelope,
|
|
127
|
+
candidate: id,
|
|
128
|
+
reason
|
|
129
|
+
}));
|
|
130
|
+
if (row.group !== void 0 && waitsOn(plan, row.group, id)) endSearch(plan, row.group);
|
|
131
|
+
const over = (candidate) => plan.candidates.get(candidate)?.over?.includes(id) === true;
|
|
132
|
+
const after = reason === "restarted" ? "restarted" : "superseded";
|
|
133
|
+
for (const open of plan.row.open.filter(over)) closeCandidate(plan, open, after);
|
|
134
|
+
for (const failed of (plan.row.searches ?? []).filter(over)) endSearch(plan, failed);
|
|
135
|
+
};
|
|
136
|
+
/** Whether the bisect of `failed` still waits on its group `group`. */
|
|
137
|
+
const waitsOn = (plan, failed, group) => plan.candidates.get(failed)?.search?.groups.some((open) => open.candidate === group) === true;
|
|
138
|
+
/**
|
|
139
|
+
* Ends the bisect of the failed candidate `failed`: its open groups close `superseded`, and its
|
|
140
|
+
* entries still checking for it wait again in their places, none of them judged.
|
|
141
|
+
*/
|
|
142
|
+
const endSearch = (plan, failed) => {
|
|
143
|
+
const row = plan.candidates.get(failed);
|
|
144
|
+
if (row?.search === void 0) return;
|
|
145
|
+
const { search, ...ended } = row;
|
|
146
|
+
plan.setCandidate(failed, ended);
|
|
147
|
+
plan.setTarget({
|
|
148
|
+
...plan.row,
|
|
149
|
+
searches: (plan.row.searches ?? []).filter((open) => open !== failed)
|
|
150
|
+
});
|
|
151
|
+
for (const group of search.groups) if (group.candidate !== void 0) closeCandidate(plan, group.candidate, "superseded");
|
|
152
|
+
for (const entry of row.entries) releaseEntry(plan, entry, failed);
|
|
153
|
+
};
|
|
154
|
+
/**
|
|
155
|
+
* Marks `entry`'s place as checking, or not: what `orderOf` orders by, beside the entry's state,
|
|
156
|
+
* which every step that opens or closes a candidate over it changes with it.
|
|
157
|
+
*/
|
|
158
|
+
const setChecking = (plan, entry, checking) => {
|
|
159
|
+
const order = plan.row.order.map((place) => {
|
|
160
|
+
if (place.entry !== entry) return place;
|
|
161
|
+
const { checking: _checking, ...rest } = place;
|
|
162
|
+
return checking ? {
|
|
163
|
+
...rest,
|
|
164
|
+
checking: true
|
|
165
|
+
} : rest;
|
|
166
|
+
});
|
|
167
|
+
plan.setTarget({
|
|
168
|
+
...plan.row,
|
|
169
|
+
order
|
|
170
|
+
});
|
|
171
|
+
};
|
|
172
|
+
/**
|
|
173
|
+
* The holds open on `key`: an own property of `keyHolds` only, so a key such as `constructor`
|
|
174
|
+
* finds none of the prototype's.
|
|
175
|
+
*/
|
|
176
|
+
const keyHoldsOf = (row, key) => Object.hasOwn(row.keyHolds, key) ? row.keyHolds[key] ?? [] : [];
|
|
177
|
+
/** Whether a hold on its key holds `entry`. */
|
|
178
|
+
const held = (plan, entry) => keyHoldsOf(plan.row, entry.key).length > 0;
|
|
179
|
+
/** Closes every open candidate that holds `entry`, as `superseded`, and the bisect it's in. */
|
|
180
|
+
const supersede = (plan, entry) => {
|
|
181
|
+
for (const id of plan.row.open) if (plan.candidates.get(id)?.entries.includes(entry)) closeCandidate(plan, id, "superseded");
|
|
182
|
+
const searched = plan.entries.get(entry)?.candidate;
|
|
183
|
+
if (searched !== void 0) endSearch(plan, searched);
|
|
184
|
+
};
|
|
185
|
+
/**
|
|
186
|
+
* Closes every candidate in the target's row for `reason`, and ends every bisect: a jump or a
|
|
187
|
+
* restart changes what the row merges first, so a recheck mustn't merge ahead of it.
|
|
188
|
+
*/
|
|
189
|
+
const closeAll = (plan, reason) => {
|
|
190
|
+
for (const id of stackOf(plan)) closeCandidate(plan, id, reason);
|
|
191
|
+
for (const failed of plan.row.searches ?? []) endSearch(plan, failed);
|
|
192
|
+
};
|
|
193
|
+
/** Whether the target moved past the tip the queue last saw, by anything but the queue. */
|
|
194
|
+
const movedOutside = (state) => state.row.tip !== void 0 && state.row.tip !== state.tip;
|
|
195
|
+
/**
|
|
196
|
+
* Takes an open entry out of its target's order, as `state`: its ref deleted, and every open
|
|
197
|
+
* candidate over it closed. A merge keeps the entry as its key's last, so the same add sent again
|
|
198
|
+
* answers it.
|
|
199
|
+
*/
|
|
200
|
+
const endEntry = (plan, id, state, extra = {}) => {
|
|
201
|
+
const row = plan.entries.get(id);
|
|
202
|
+
if (row === void 0 || !isOpen(row)) return;
|
|
203
|
+
if (state !== "merged") supersede(plan, id);
|
|
204
|
+
plan.edits.push({
|
|
205
|
+
ref: queueRef(row.target, id),
|
|
206
|
+
from: row.head,
|
|
207
|
+
to: null
|
|
208
|
+
});
|
|
209
|
+
const { candidate: _candidate, ...rest } = plan.entries.get(id) ?? row;
|
|
210
|
+
plan.setEntry(id, {
|
|
211
|
+
...rest,
|
|
212
|
+
state,
|
|
213
|
+
...extra
|
|
214
|
+
});
|
|
215
|
+
plan.setTarget({
|
|
216
|
+
...plan.row,
|
|
217
|
+
order: plan.row.order.filter((place) => place.entry !== id)
|
|
218
|
+
});
|
|
219
|
+
if (state === "merged") plan.setKey(row.key, {
|
|
220
|
+
entry: id,
|
|
221
|
+
head: row.head
|
|
222
|
+
});
|
|
223
|
+
};
|
|
224
|
+
/** Ends open entry `id` `removed`, as `queue.entry.removed` says for its `removal`. */
|
|
225
|
+
const removeEntry = (plan, id, removal) => {
|
|
226
|
+
endEntry(plan, id, "removed");
|
|
227
|
+
plan.event((envelope) => ({
|
|
228
|
+
type: "queue.entry.removed",
|
|
229
|
+
...envelope,
|
|
230
|
+
entry: id,
|
|
231
|
+
...removal
|
|
232
|
+
}));
|
|
233
|
+
};
|
|
234
|
+
/** The job that moves the target on, saved with the write that gave it something to do. */
|
|
235
|
+
const advanceAfter = (plan) => {
|
|
236
|
+
if (!plan.jobs.some((job) => job.name === "git.queue.advance" && job.key === plan.state.target)) plan.jobs.push(advanceRow(plan.state.target));
|
|
237
|
+
};
|
|
238
|
+
/** Holds the target for `reason`, which stops only its merges: the new hold's ID. */
|
|
239
|
+
const addTargetHold = (plan, reason, work) => {
|
|
240
|
+
const id = plan.id("h");
|
|
241
|
+
const { target } = plan.state;
|
|
242
|
+
plan.setHold(id, work === void 0 ? {
|
|
243
|
+
target,
|
|
244
|
+
reason
|
|
245
|
+
} : {
|
|
246
|
+
target,
|
|
247
|
+
reason,
|
|
248
|
+
work
|
|
249
|
+
});
|
|
250
|
+
plan.setTarget({
|
|
251
|
+
...plan.row,
|
|
252
|
+
holds: [...plan.row.holds, id]
|
|
253
|
+
});
|
|
254
|
+
plan.event((envelope) => ({
|
|
255
|
+
type: "queue.hold.created",
|
|
256
|
+
...envelope,
|
|
257
|
+
hold: id,
|
|
258
|
+
reason,
|
|
259
|
+
target
|
|
260
|
+
}));
|
|
261
|
+
return id;
|
|
262
|
+
};
|
|
263
|
+
/** Lets `hold` go from `key`'s holds: once none is left, the key's entry goes to the back. */
|
|
264
|
+
const releaseKey = (plan, key, hold) => {
|
|
265
|
+
const left = keyHoldsOf(plan.row, key).filter((open) => open !== hold);
|
|
266
|
+
const { [key]: _released, ...others } = plan.row.keyHolds;
|
|
267
|
+
plan.setTarget({
|
|
268
|
+
...plan.row,
|
|
269
|
+
keyHolds: left.length === 0 ? others : {
|
|
270
|
+
...others,
|
|
271
|
+
[key]: left
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
if (left.length > 0) return;
|
|
275
|
+
const place = plan.row.order.find((open) => open.key === key);
|
|
276
|
+
const row = place === void 0 ? void 0 : plan.entries.get(place.entry);
|
|
277
|
+
if (place === void 0 || row === void 0 || row.state !== "held") return;
|
|
278
|
+
plan.setEntry(place.entry, {
|
|
279
|
+
...row,
|
|
280
|
+
state: "waiting"
|
|
281
|
+
});
|
|
282
|
+
const { jumped: _jumped, ...back } = place;
|
|
283
|
+
const moved = {
|
|
284
|
+
...back,
|
|
285
|
+
joined: joinedAt(plan),
|
|
286
|
+
since: plan.now
|
|
287
|
+
};
|
|
288
|
+
plan.setTarget({
|
|
289
|
+
...plan.row,
|
|
290
|
+
order: plan.row.order.map((open) => open.entry === place.entry ? moved : open)
|
|
291
|
+
});
|
|
292
|
+
};
|
|
293
|
+
/** Lets an open hold go: the target's own, or its key's, whose entry then goes to the back. */
|
|
294
|
+
const releaseHold = (plan, hold, row) => {
|
|
295
|
+
plan.setHold(hold, {
|
|
296
|
+
...row,
|
|
297
|
+
released: true
|
|
298
|
+
});
|
|
299
|
+
if (row.key === void 0) plan.setTarget({
|
|
300
|
+
...plan.row,
|
|
301
|
+
holds: plan.row.holds.filter((open) => open !== hold)
|
|
302
|
+
});
|
|
303
|
+
else releaseKey(plan, row.key, hold);
|
|
304
|
+
plan.event((envelope) => ({
|
|
305
|
+
type: "queue.hold.released",
|
|
306
|
+
...envelope,
|
|
307
|
+
hold,
|
|
308
|
+
reason: row.reason,
|
|
309
|
+
...row.entry === void 0 ? { target: row.target } : { entry: row.entry }
|
|
310
|
+
}));
|
|
311
|
+
};
|
|
312
|
+
/** The target's open holds that wait on `work`, with their rows. */
|
|
313
|
+
const workHolds = (state, work) => state.row.holds.flatMap((id) => {
|
|
314
|
+
const row = state.holds.get(id);
|
|
315
|
+
return row?.work?.name === work.name && row.work.key === work.key && row !== void 0 ? [[id, row]] : [];
|
|
316
|
+
});
|
|
317
|
+
export { addTargetHold, advanceAfter, aheadOf, candidateOf, closeAll, closeCandidate, endEntry, endSearch, entryOf, held, holdOf, isOpen, joinedAt, keyHoldsOf, movedOutside, releaseEntry, releaseHold, removeEntry, setChecking, stackOf, supersede, withOutcome, workHolds };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { BlobsApiGroup } from "./blobs.mjs";
|
|
2
|
+
import { CommitsApiGroup } from "./commits.mjs";
|
|
3
|
+
import { EventsApiGroup } from "./events.mjs";
|
|
4
|
+
import { FilesApiGroup } from "./files.mjs";
|
|
5
|
+
import { ForksApiGroup } from "./forks.mjs";
|
|
6
|
+
import { MeApiGroup } from "./me.mjs";
|
|
7
|
+
import { MergesApiGroup } from "./merges.mjs";
|
|
8
|
+
import { QueueApiGroup } from "./queue.mjs";
|
|
9
|
+
import { RefsApiGroup } from "./refs.mjs";
|
|
10
|
+
import { ReposApiGroup } from "./repos.mjs";
|
|
11
|
+
import { TagsApiGroup } from "./tags.mjs";
|
|
12
|
+
import { TokensApiGroup } from "./tokens.mjs";
|
|
13
|
+
import { TopicsApiGroup } from "./topics.mjs";
|
|
14
|
+
import { TreesApiGroup } from "./trees.mjs";
|
|
15
|
+
import { WorkApiGroup } from "./work.mjs";
|
|
16
|
+
import { HttpApi } from "effect/http-api";
|
|
17
|
+
declare const GitRestApi_base: HttpApi.HttpApi<"git", typeof BlobsApiGroup | typeof TreesApiGroup | typeof CommitsApiGroup | typeof EventsApiGroup | typeof FilesApiGroup | typeof RefsApiGroup | typeof ReposApiGroup | typeof ForksApiGroup | typeof TokensApiGroup | typeof MeApiGroup | typeof MergesApiGroup | typeof QueueApiGroup | typeof TagsApiGroup | typeof TopicsApiGroup | typeof WorkApiGroup>;
|
|
18
|
+
/**
|
|
19
|
+
* Git's REST API, under `<base>`. A repo's paths are `/repos/<repo>/-/…`, where `<repo>` takes any
|
|
20
|
+
* number of segments: the API names it as one, and the handler and client carry it either way.
|
|
21
|
+
*/
|
|
22
|
+
export declare class GitRestApi extends GitRestApi_base {}
|
|
23
|
+
export {};
|