@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,100 @@
|
|
|
1
|
+
import { checkChurn, decodeRecord, entryOf, project } from "./catalogue.mjs";
|
|
2
|
+
import { decodeRow, storeCall } from "./errors.mjs";
|
|
3
|
+
import { listJobRow } from "./list-job.mjs";
|
|
4
|
+
import { StatsTime } from "./records.mjs";
|
|
5
|
+
import { maintainedKey, newChangeId, pushedKey, repoScope, selfKey } from "./scopes.mjs";
|
|
6
|
+
import * as Effect from "effect/Effect";
|
|
7
|
+
// src/store/repo-record.ts
|
|
8
|
+
/** A repo's record and its scope's rows, read at one version: `results[0]` is `self`. */
|
|
9
|
+
const readRecord = Effect.fnUntraced(function* (store, internalId, reads = [], counts = []) {
|
|
10
|
+
const scope = repoScope(internalId);
|
|
11
|
+
const snapshot = yield* storeCall(() => store.read(scope, [selfKey, ...reads], [...counts]));
|
|
12
|
+
return {
|
|
13
|
+
record: yield* decodeRecord(snapshot.results[0]?.[0]),
|
|
14
|
+
snapshot
|
|
15
|
+
};
|
|
16
|
+
});
|
|
17
|
+
/**
|
|
18
|
+
* The first of a repo write's two commits: its record, in its own scope, with `git.list` saved
|
|
19
|
+
* beside it, so the catalogue's projection happens even if the second never does.
|
|
20
|
+
*/
|
|
21
|
+
const commitRecord = (store, internalId, write) => {
|
|
22
|
+
const change = {
|
|
23
|
+
id: write.id ?? newChangeId(),
|
|
24
|
+
expect: write.expect,
|
|
25
|
+
put: [{
|
|
26
|
+
...selfKey,
|
|
27
|
+
value: write.record
|
|
28
|
+
}, ...write.put ?? []],
|
|
29
|
+
delete: [...write.delete ?? []],
|
|
30
|
+
jobs: [listJobRow(), ...write.jobs ?? []]
|
|
31
|
+
};
|
|
32
|
+
return storeCall(() => store.commit(repoScope(internalId), change));
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* A repo write's two commits: its record, then its projection into `git/repos`. Answers
|
|
36
|
+
* `undefined` when the scope moved since `expect`, else whether the record's name is its own.
|
|
37
|
+
* A live record is checked against its name's entry first, so every write that puts a repo on
|
|
38
|
+
* a name refuses `name-churn` before it commits, whichever call makes it (#128).
|
|
39
|
+
*/
|
|
40
|
+
const writeRecord = Effect.fnUntraced(function* (store, internalId, write) {
|
|
41
|
+
const { record } = write;
|
|
42
|
+
if (record.deleted !== true) yield* checkChurn(internalId, record, yield* entryOf(store, record.name));
|
|
43
|
+
const committed = yield* commitRecord(store, internalId, write);
|
|
44
|
+
if (!committed.ok) return void 0;
|
|
45
|
+
const outcome = yield* project(store, internalId, record);
|
|
46
|
+
return {
|
|
47
|
+
version: committed.version,
|
|
48
|
+
outcome
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
/** The times in a repo's `stats` rows, as `statsRead` reads them. */
|
|
52
|
+
const decodeTimes = Effect.fnUntraced(function* (rows) {
|
|
53
|
+
const times = {};
|
|
54
|
+
const privately = /* @__PURE__ */ new Map();
|
|
55
|
+
for (const row of rows) {
|
|
56
|
+
const { at } = yield* decodeRow(StatsTime, row, `The repo's '${row.id}' time`);
|
|
57
|
+
if (row.id === pushedKey.id) times.pushed = at;
|
|
58
|
+
else if (row.id === maintainedKey.id) times.maintained = at;
|
|
59
|
+
else if (row.id.startsWith(privatePushed)) privately.set(row.id.slice(privatePushed.length), at);
|
|
60
|
+
}
|
|
61
|
+
if (privately.size > 0) times.privately = privately;
|
|
62
|
+
return times;
|
|
63
|
+
});
|
|
64
|
+
const privatePushed = "pushed/";
|
|
65
|
+
/** `times` as a caller with `sight` sees them: its `pushed` the latest of the patterns it reads. */
|
|
66
|
+
const seenTimes = (times, sight) => {
|
|
67
|
+
const seen = [...times.privately ?? []].flatMap(([pattern, at]) => sight.reads(pattern) ? [at] : []);
|
|
68
|
+
const { privately: _privately, ...rest } = times;
|
|
69
|
+
if (seen.length === 0) return rest;
|
|
70
|
+
return {
|
|
71
|
+
...rest,
|
|
72
|
+
pushed: Math.max(times.pushed ?? 0, ...seen)
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* A `stats` time's row for a commit at `now`: never before the time it held, since the clocks of
|
|
77
|
+
* two isolates can differ, and the commit's own read holds the row it replaces.
|
|
78
|
+
*/
|
|
79
|
+
const timeRow = (key, held, now) => ({
|
|
80
|
+
...key,
|
|
81
|
+
value: { at: Math.max(held ?? now, now) }
|
|
82
|
+
});
|
|
83
|
+
/** A repo's stats, from its record, its refs' count, its listed packs and its `stats` times. */
|
|
84
|
+
const repoStats = (record, refs, packs, times) => {
|
|
85
|
+
const packBytes = packs.reduce((sum, pack) => sum + pack.bytes, 0);
|
|
86
|
+
const stats = {
|
|
87
|
+
repo: record.name,
|
|
88
|
+
refs,
|
|
89
|
+
packs: packs.length,
|
|
90
|
+
packBytes,
|
|
91
|
+
ownBytes: packBytes,
|
|
92
|
+
looseObjects: 0,
|
|
93
|
+
looseBytes: 0,
|
|
94
|
+
leavingBytes: 0
|
|
95
|
+
};
|
|
96
|
+
if (times.pushed !== void 0) stats.pushedAt = times.pushed;
|
|
97
|
+
if (times.maintained !== void 0) stats.maintainedAt = times.maintained;
|
|
98
|
+
return stats;
|
|
99
|
+
};
|
|
100
|
+
export { commitRecord, decodeTimes, readRecord, repoStats, seenTimes, timeRow, writeRecord };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { decodeRow, gitError, storeCall } from "./errors.mjs";
|
|
2
|
+
import { collections, topicScope } from "./scopes.mjs";
|
|
3
|
+
import * as Effect from "effect/Effect";
|
|
4
|
+
import * as Schema from "effect/Schema";
|
|
5
|
+
// src/store/reservations.ts
|
|
6
|
+
/**
|
|
7
|
+
* A target's reservation, a field of its `queue-targets` row in its repo's scope, so the push
|
|
8
|
+
* decide reads it in the commit it refuses: the topic that holds the target (Q557). A topic
|
|
9
|
+
* reserves its targets in separate commits, so each reservation has its own way out: once its topic
|
|
10
|
+
* ends, it's free, whether or not the topic's job has released it.
|
|
11
|
+
*/
|
|
12
|
+
const Reservation = Schema.Struct({ topic: Schema.String });
|
|
13
|
+
/** A topic's states, as its own row keeps them. */
|
|
14
|
+
const TopicState = Schema.Literals([
|
|
15
|
+
"checking",
|
|
16
|
+
"reserving",
|
|
17
|
+
"publishing",
|
|
18
|
+
"failed",
|
|
19
|
+
"merged",
|
|
20
|
+
"removed"
|
|
21
|
+
]);
|
|
22
|
+
/** What a reservation's life reads of its topic's row: its state. The other fields are its own. */
|
|
23
|
+
const TopicLife = Schema.Struct({ state: TopicState });
|
|
24
|
+
/** A topic's own row, in its scope. */
|
|
25
|
+
const topicKey = {
|
|
26
|
+
collection: collections.topic,
|
|
27
|
+
id: "self"
|
|
28
|
+
};
|
|
29
|
+
/** The states a topic never leaves: its key is never opened again (Q624). */
|
|
30
|
+
const ended = /* @__PURE__ */ new Set([
|
|
31
|
+
"failed",
|
|
32
|
+
"merged",
|
|
33
|
+
"removed"
|
|
34
|
+
]);
|
|
35
|
+
/** The fields of a target's row a reservation's readers decode. */
|
|
36
|
+
const Reserved = Schema.Struct({ reserved: Schema.optionalKey(Reservation) });
|
|
37
|
+
/** The reservation on a target's row, if the row is there and holds one. */
|
|
38
|
+
const reservationOf = (rows) => {
|
|
39
|
+
const [row] = rows ?? [];
|
|
40
|
+
if (row === void 0) return Effect.succeed(void 0);
|
|
41
|
+
return Effect.map(decodeRow(Reserved, row, "A merge queue's target"), (read) => read.reserved);
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Its topic's state while `reservation` still holds, `publishing` once its publish decision is
|
|
45
|
+
* saved, or `undefined` once it's free. It holds till its topic ends. Read in the topic's scope,
|
|
46
|
+
* apart from the write it decides: a topic that ended stays ended, so a write that reads it ended
|
|
47
|
+
* may go on, and one that reads it live is refused, to be sent again. A topic with no row holds
|
|
48
|
+
* nothing.
|
|
49
|
+
*/
|
|
50
|
+
const liveState = Effect.fnUntraced(function* (store, reservation) {
|
|
51
|
+
const [row] = (yield* storeCall(() => store.read(topicScope(reservation.topic), [topicKey]))).results[0] ?? [];
|
|
52
|
+
if (row === void 0) return void 0;
|
|
53
|
+
const life = yield* decodeRow(TopicLife, row, `Topic ${reservation.topic}`);
|
|
54
|
+
return ended.has(life.state) ? void 0 : life.state;
|
|
55
|
+
});
|
|
56
|
+
/** Whether `reservation` still holds, as `liveState` reads it. */
|
|
57
|
+
const isLive = (store, reservation) => Effect.map(liveState(store, reservation), (state) => state !== void 0);
|
|
58
|
+
/** Fails with `refusal` while `held`, a topic's reservation, is live. */
|
|
59
|
+
const refuseLive = Effect.fnUntraced(function* (store, held, refusal) {
|
|
60
|
+
const state = held === void 0 ? void 0 : yield* liveState(store, held);
|
|
61
|
+
if (held !== void 0 && state !== void 0) return yield* Effect.fail(refusal(held, state));
|
|
62
|
+
});
|
|
63
|
+
/** The live reservation of each target in `rows`, by `rows`' index: `undefined` where none. */
|
|
64
|
+
const liveReservations = (store, rows) => Effect.forEach(rows, (row) => Effect.flatMap(reservationOf(row), (reservation) => reservation === void 0 ? Effect.succeed(void 0) : Effect.map(isLive(store, reservation), (live) => live ? reservation : void 0)));
|
|
65
|
+
/**
|
|
66
|
+
* How a write gets past `topic`, live in `state`: before its publish decision, a `topics.remove`
|
|
67
|
+
* of it always works and frees what it holds, so the hint says to remove it first. Once it's
|
|
68
|
+
* publishing, it can't be removed, and the hint says to wait for it to merge. A refusal that
|
|
69
|
+
* didn't read its state, as a push's, names both.
|
|
70
|
+
*/
|
|
71
|
+
const liveHint = (topic, state) => {
|
|
72
|
+
if (state === "publishing") return `Topic ${topic} is publishing its saved decision: wait for it to merge`;
|
|
73
|
+
const remove = `Remove topic ${topic} with topics.remove first`;
|
|
74
|
+
return state === void 0 ? `${remove}, or wait for it to merge` : remove;
|
|
75
|
+
};
|
|
76
|
+
/** A write to a target a live reservation holds, its topic in `state`: refused, naming the topic. */
|
|
77
|
+
const reservedTarget = (target, reservation, state) => gitError("FAILED_PRECONDITION", `${target} is reserved by topic ${reservation.topic}`, { hint: liveHint(reservation.topic, state) });
|
|
78
|
+
/** A delete or rename of a repo with a target a live reservation holds: refused, naming the topic. */
|
|
79
|
+
const reservedRepo = (target, reservation, state) => gitError("FAILED_PRECONDITION", `The repo's ${target} is reserved by topic ${reservation.topic}`, { hint: liveHint(reservation.topic, state) });
|
|
80
|
+
/** A write to a live topic's member, its topic in `state`: refused, naming the topic. */
|
|
81
|
+
const topicMember = (entry, reservation, state) => gitError("FAILED_PRECONDITION", `${entry} is a member of topic ${reservation.topic}`, { hint: liveHint(reservation.topic, state) });
|
|
82
|
+
export { Reservation, TopicState, isLive, liveReservations, liveState, refuseLive, reservationOf, reservedRepo, reservedTarget, topicKey, topicMember };
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { isInternalId } from "../contracts/ids.mjs";
|
|
2
|
+
import { randomText } from "./random.mjs";
|
|
3
|
+
// src/store/scopes.ts
|
|
4
|
+
/** The catalogue: each name's entry, by `RepoId`. */
|
|
5
|
+
const catalogueScope = "git/repos";
|
|
6
|
+
const repoScope = (internalId) => `git/repo/${internalId}`;
|
|
7
|
+
const topicScope = (topic) => `git/topic/${topic}`;
|
|
8
|
+
/** The index across topics, `topics/directory.ts` says: no decision reads its state rows. */
|
|
9
|
+
const topicsScope = "git/topics";
|
|
10
|
+
const collections = {
|
|
11
|
+
/** In `git/repos`: a name's `RepoCatalogueEntry`. */
|
|
12
|
+
catalogue: "repos",
|
|
13
|
+
/** In `git/repos`: each fork's `ForkRow`, by `forkId`, so a source has one fork a holder. */
|
|
14
|
+
forks: "forks",
|
|
15
|
+
/**
|
|
16
|
+
* In `git/repos`: each fork's `ForkRow` again under each folder of its name, by its source's
|
|
17
|
+
* internal ID, the folder and the fork's `createdKey`, so `forks.list` reads a source's forks the
|
|
18
|
+
* newest first, under its token's reach alone. They commit and go with the fork's created rows.
|
|
19
|
+
*/
|
|
20
|
+
forksCreated: "forks-created",
|
|
21
|
+
/**
|
|
22
|
+
* In `git/repos`: each repo's `CreatedRow` under each folder of its name, `''` and each ending in
|
|
23
|
+
* a `/`, by the folder and its `createdKey`, so a list in create order reads exactly the repos
|
|
24
|
+
* under its reach, the oldest or the newest first, and never a row it may not show.
|
|
25
|
+
*/
|
|
26
|
+
folderCreated: "folder-created",
|
|
27
|
+
/**
|
|
28
|
+
* In `git/repos`: each public repo's `ForkRow`, its internal ID, by its name, so a signed-out
|
|
29
|
+
* list by name reads only public repos (#209). It commits with the entry that wins the name.
|
|
30
|
+
*/
|
|
31
|
+
publicNames: "public-names",
|
|
32
|
+
/**
|
|
33
|
+
* In `git/repos`: each public repo's `CreatedRow` under `''` and its owner's folder, by the
|
|
34
|
+
* folder and its `createdKey`, so a signed-out list in create order reads only public repos.
|
|
35
|
+
* Create order takes no deeper prefix, so a repo has two, beside its entry's commit.
|
|
36
|
+
*/
|
|
37
|
+
publicCreated: "public-created",
|
|
38
|
+
/** In `git/repos`: the server's own keys, by use: `cursor`, which seals every list's cursor. */
|
|
39
|
+
keys: "keys",
|
|
40
|
+
/** In a repo's scope: its own record, `self`. */
|
|
41
|
+
repo: "repo",
|
|
42
|
+
/** In a repo's scope: each ref's `RefRow`, by its full name. */
|
|
43
|
+
refs: "refs",
|
|
44
|
+
/** In a repo's scope: each push `hooks.postReceive` owes, by the version its commit made. */
|
|
45
|
+
pushes: "pushes",
|
|
46
|
+
/** In a repo's scope: how far `git.post-receive` has gone, newest first, by `cursorId`. */
|
|
47
|
+
postReceive: "post-receive",
|
|
48
|
+
packs: "packs",
|
|
49
|
+
/** In a repo's scope: a keyed write's receipt, by its padded day and its key's SHA-256. */
|
|
50
|
+
receipts: "receipts",
|
|
51
|
+
/**
|
|
52
|
+
* In a repo's scope: an empty row beside each receipt, by its ID, which upkeep's sweep reads in
|
|
53
|
+
* place of the receipts, so a page of them stays small whatever each receipt holds.
|
|
54
|
+
*/
|
|
55
|
+
receiptIndex: "receipt-index",
|
|
56
|
+
/**
|
|
57
|
+
* In a repo's scope: each own write, an object a caller wrote through an object write, by its
|
|
58
|
+
* day, its actor's digest and its ID, which that caller reads for a day (Q773).
|
|
59
|
+
*/
|
|
60
|
+
ownWrites: "own-writes",
|
|
61
|
+
/** In a repo's scope: its import's `ImportRow`, `self`, and `cancel` once it's cancelled. */
|
|
62
|
+
imports: "imports",
|
|
63
|
+
/** In a repo's scope: each mirror's `MirrorRow`, by the full name of the ref it pushes. */
|
|
64
|
+
mirrors: "mirrors",
|
|
65
|
+
tokens: "tokens",
|
|
66
|
+
/** A token's write key, so a key sent again is refused: the secret is shown once. */
|
|
67
|
+
tokenKeys: "token-keys",
|
|
68
|
+
/** A token's ID after its padded `expiresAt`, so cleanup reads the oldest first. */
|
|
69
|
+
tokenExpiry: "token-expiry",
|
|
70
|
+
/** In a repo's scope: each LFS object the repo lists, by its oid. Only a deleted repo unlists. */
|
|
71
|
+
lfsObjects: "lfs-objects",
|
|
72
|
+
/** In a repo's scope: each LFS object an upload link was given for, by its oid, until listed. */
|
|
73
|
+
lfsUploads: "lfs-uploads",
|
|
74
|
+
/** In a repo's scope: a Worker upload's staging key, by its due `removeAt` and its ID. */
|
|
75
|
+
lfsStaging: "lfs-staging",
|
|
76
|
+
/** In a repo's scope: an LFS object upkeep is deleting, by its oid, which no verify lists. */
|
|
77
|
+
lfsEnding: "lfs-ending",
|
|
78
|
+
/** In a repo's scope: each LFS lock, by its path's SHA-256. */
|
|
79
|
+
lfsLocks: "lfs-locks",
|
|
80
|
+
/**
|
|
81
|
+
* In a repo's scope: each large push's pack uploading to the bucket, by its handle, until it's
|
|
82
|
+
* pushed or upkeep ends it.
|
|
83
|
+
*/
|
|
84
|
+
pushUploads: "push-uploads",
|
|
85
|
+
/** In a topic's scope: its own row, `self`, with its state. */
|
|
86
|
+
topic: "topic",
|
|
87
|
+
/** In `git/topics`: each key's topic, claimed by the first `topics.add` that names the key. */
|
|
88
|
+
topicKeys: "topic-keys",
|
|
89
|
+
/** In `git/topics`: each topic's state and the revision of its row it was projected from. */
|
|
90
|
+
topicIndex: "topics",
|
|
91
|
+
/** In `git/topics`: each topic again, by `<state>/<topic>`, so a list by state reads a prefix. */
|
|
92
|
+
topicStates: "topic-states",
|
|
93
|
+
/** In a repo's scope: the merge queue's `self`, which numbers its IDs. */
|
|
94
|
+
queue: "queue",
|
|
95
|
+
/** In a repo's scope: each target's open entries, candidates and holds, by its full name. */
|
|
96
|
+
queueTargets: "queue-targets",
|
|
97
|
+
queueEntries: "queue-entries",
|
|
98
|
+
queueCandidates: "queue-candidates",
|
|
99
|
+
queueHolds: "queue-holds",
|
|
100
|
+
/** In a repo's scope: an entry's `meta`, by the entry's ID, which no write of its target reads. */
|
|
101
|
+
queueMeta: "queue-meta",
|
|
102
|
+
/** In a repo's scope: a candidate's report, by the candidate's ID, which an entry it judged reads. */
|
|
103
|
+
queueReports: "queue-reports",
|
|
104
|
+
/** In a repo's scope: the entry each key merged last, by `[target, key]` as JSON. */
|
|
105
|
+
queueKeys: "queue-keys",
|
|
106
|
+
/** In a repo's scope: upkeep's own rows, such as the `pruned` mark. */
|
|
107
|
+
upkeep: "upkeep",
|
|
108
|
+
/**
|
|
109
|
+
* In a repo's scope: the times its stats show, each a `StatsTime`: `pushed`, put by every commit
|
|
110
|
+
* that moves a ref, and `maintained`, by repack's last step.
|
|
111
|
+
*/
|
|
112
|
+
stats: "stats"
|
|
113
|
+
};
|
|
114
|
+
/** A fork's row's ID in `git/repos`' `forks`: its source's internal ID and its holder. */
|
|
115
|
+
const forkId = (source, holder) => `${source}:${holder}`;
|
|
116
|
+
/** A repo's own record, in its scope: Git's alone, which no feature's commit may touch. */
|
|
117
|
+
const selfKey = {
|
|
118
|
+
collection: collections.repo,
|
|
119
|
+
id: "self"
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* The repo's prune mark: a new ID each time a prune drops objects. A push reads it first and
|
|
123
|
+
* again at its commit, and fails if it moved, so no ref names an object a prune dropped (Q270).
|
|
124
|
+
*/
|
|
125
|
+
const prunedKey = {
|
|
126
|
+
collection: collections.upkeep,
|
|
127
|
+
id: "pruned"
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* The repo's `ReachedMark`: written when a repo is made, cleared by any commit that can't show both
|
|
131
|
+
* its halves, and written again by a prune pass that shows them, as `ReachedMark` says.
|
|
132
|
+
*/
|
|
133
|
+
const reachedKey = {
|
|
134
|
+
collection: collections.upkeep,
|
|
135
|
+
id: "reached"
|
|
136
|
+
};
|
|
137
|
+
/** When a commit last moved one of the repo's refs, whatever the path: `stats.pushedAt`. */
|
|
138
|
+
const pushedKey = {
|
|
139
|
+
collection: collections.stats,
|
|
140
|
+
id: "pushed"
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* On a server with `access`, when a commit last moved a ref private by `pattern`: `pushedKey`
|
|
144
|
+
* then counts public refs alone, so a hidden push moves only what its readers see.
|
|
145
|
+
*/
|
|
146
|
+
const pushedUnder = (pattern) => ({
|
|
147
|
+
collection: collections.stats,
|
|
148
|
+
id: `pushed/${pattern}`
|
|
149
|
+
});
|
|
150
|
+
/** When repack last finished a run on the repo: `stats.maintainedAt`. */
|
|
151
|
+
const maintainedKey = {
|
|
152
|
+
collection: collections.stats,
|
|
153
|
+
id: "maintained"
|
|
154
|
+
};
|
|
155
|
+
/** A new repo's internal ID: `r_` and 12 random bytes. */
|
|
156
|
+
const newInternalId = () => `r_${randomText(12)}`;
|
|
157
|
+
/** The repo a scope is, or `undefined` for a scope that's no repo's, such as a prefix's. */
|
|
158
|
+
const scopeRepo = (scope) => {
|
|
159
|
+
const id = scope.slice(9);
|
|
160
|
+
return scope.startsWith("git/repo/") && isInternalId(id) ? id : void 0;
|
|
161
|
+
};
|
|
162
|
+
/** The repo whose scope one of Git's per-repo jobs runs in: in any other scope, it's a defect. */
|
|
163
|
+
const jobRepo = (job) => {
|
|
164
|
+
const id = scopeRepo(job.scope);
|
|
165
|
+
if (id === void 0) throw new TypeError(`'${job.name}' ran in '${job.scope}', which isn't a repo's scope`);
|
|
166
|
+
return id;
|
|
167
|
+
};
|
|
168
|
+
/** A commit's own ID, for a change no caller's key names. */
|
|
169
|
+
const newChangeId = () => randomText(16);
|
|
170
|
+
export { catalogueScope, collections, forkId, jobRepo, maintainedKey, newChangeId, newInternalId, prunedKey, pushedKey, pushedUnder, reachedKey, repoScope, scopeRepo, selfKey, topicScope, topicsScope };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { storeCall } from "./errors.mjs";
|
|
2
|
+
import { entryOf, project } from "./catalogue.mjs";
|
|
3
|
+
import { dropUnconfirmed, headKey } from "./outbox.mjs";
|
|
4
|
+
import { takenBack } from "./records.mjs";
|
|
5
|
+
import { writeRecord } from "./repo-record.mjs";
|
|
6
|
+
import { newChangeId, scopeRepo } from "./scopes.mjs";
|
|
7
|
+
import * as Effect from "effect/Effect";
|
|
8
|
+
// src/store/settle.ts
|
|
9
|
+
/**
|
|
10
|
+
* Settles a create's or rename's name that no write has confirmed, as `git.list` would: its event
|
|
11
|
+
* is kept once the catalogue gives the repo the name, and dropped once it's lost, in one commit
|
|
12
|
+
* with the record taken back to the name a rename kept and its receipt deleted (Q171). A write that adds events without
|
|
13
|
+
* opening the repo by name settles it first, so nothing is ever behind that one event, and a
|
|
14
|
+
* lost rename's repo keeps every event since, under the name it kept (Q186). Answers whether it
|
|
15
|
+
* wrote, so the caller reads again.
|
|
16
|
+
*/
|
|
17
|
+
const settleName = Effect.fnUntraced(function* (store, scope, read) {
|
|
18
|
+
const { version, head, record } = read;
|
|
19
|
+
const { unconfirmed } = head;
|
|
20
|
+
const internalId = scopeRepo(scope);
|
|
21
|
+
if (unconfirmed === void 0 || internalId === void 0) return false;
|
|
22
|
+
const named = record?.deleted !== true && record?.name === unconfirmed.name ? record : void 0;
|
|
23
|
+
const outcome = named === void 0 ? "lost" : yield* project(store, internalId, named);
|
|
24
|
+
const back = outcome === "lost" && named !== void 0 ? takenBack(named) : void 0;
|
|
25
|
+
const left = back === void 0 ? void 0 : yield* entryOf(store, back.record.name);
|
|
26
|
+
if (outcome === "won" || back !== void 0 && !ownLive(left, internalId)) {
|
|
27
|
+
const confirmed = { ...head };
|
|
28
|
+
delete confirmed.unconfirmed;
|
|
29
|
+
const put = [{
|
|
30
|
+
...headKey,
|
|
31
|
+
value: confirmed
|
|
32
|
+
}];
|
|
33
|
+
yield* storeCall(() => store.commit(scope, {
|
|
34
|
+
id: newChangeId(),
|
|
35
|
+
expect: version,
|
|
36
|
+
put
|
|
37
|
+
}));
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
if (back !== void 0) {
|
|
41
|
+
const dropped = dropUnconfirmed(head);
|
|
42
|
+
const write = {
|
|
43
|
+
expect: version,
|
|
44
|
+
record: back.record,
|
|
45
|
+
put: dropped.put
|
|
46
|
+
};
|
|
47
|
+
yield* writeRecord(store, internalId, {
|
|
48
|
+
...write,
|
|
49
|
+
delete: [...back.delete, ...dropped.delete]
|
|
50
|
+
});
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
const change = {
|
|
54
|
+
id: newChangeId(),
|
|
55
|
+
expect: version,
|
|
56
|
+
...dropUnconfirmed(head)
|
|
57
|
+
};
|
|
58
|
+
yield* storeCall(() => store.commit(scope, change));
|
|
59
|
+
return true;
|
|
60
|
+
});
|
|
61
|
+
/** Whether a name's entry is still this repo's own, and live: the name a lost rename left. */
|
|
62
|
+
const ownLive = (entry, internalId) => entry?.internalId === internalId && entry.deleted !== true;
|
|
63
|
+
export { settleName };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { defineJob } from "@ref0/infra";
|
|
2
|
+
import * as Schema from "effect/Schema";
|
|
3
|
+
// src/store/topic-jobs.ts
|
|
4
|
+
/**
|
|
5
|
+
* Topics' jobs' names, data and rows, each in its topic's scope, which a topic's writes save, and
|
|
6
|
+
* the queue saves `git.topic.advance` with, when a member's entry or candidate moves.
|
|
7
|
+
*/
|
|
8
|
+
const topicAdvanceName = "git.topic.advance";
|
|
9
|
+
const prepareName = "git.topic.prepare";
|
|
10
|
+
const reportTimeoutName = "git.topic.report-timeout";
|
|
11
|
+
const TopicAdvanceData = Schema.Struct({});
|
|
12
|
+
/** The exact set of candidates a `prepare` or a report's timeout is for. */
|
|
13
|
+
const CandidateSetData = Schema.Struct({ candidates: Schema.Array(Schema.String) });
|
|
14
|
+
/** What `prepare` answered: an accept, or the failure it fails its topic with. */
|
|
15
|
+
const PrepareAnswer = Schema.Union([Schema.Struct({ kind: Schema.Literal("accept") }), Schema.Struct({
|
|
16
|
+
kind: Schema.Literal("failed"),
|
|
17
|
+
failure: Schema.Struct({
|
|
18
|
+
reason: Schema.Literals(["prepare-rejected", "host-error"]),
|
|
19
|
+
summary: Schema.optionalKey(Schema.String),
|
|
20
|
+
error: Schema.optionalKey(Schema.String)
|
|
21
|
+
})
|
|
22
|
+
})]);
|
|
23
|
+
/**
|
|
24
|
+
* `prepare`'s set and, once it answered and that answer couldn't be saved to the topic yet, the
|
|
25
|
+
* answer, which the job's next run saves without asking the host again.
|
|
26
|
+
*/
|
|
27
|
+
const PrepareData = Schema.Struct({
|
|
28
|
+
candidates: Schema.Array(Schema.String),
|
|
29
|
+
answer: Schema.optionalKey(PrepareAnswer)
|
|
30
|
+
});
|
|
31
|
+
/** Makes a topic job's rows; the server's definitions, with the same names and schemas, run them. */
|
|
32
|
+
const rowsOf = (name, schema) => defineJob({
|
|
33
|
+
name,
|
|
34
|
+
schema: Schema.toStandardSchemaV1(schema),
|
|
35
|
+
handler: () => {
|
|
36
|
+
throw new TypeError(`'${name}' runs under the server's definition`);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
const advanceRows = rowsOf(topicAdvanceName, TopicAdvanceData);
|
|
40
|
+
const prepareRows = rowsOf(prepareName, PrepareData);
|
|
41
|
+
const timeoutRows = rowsOf(reportTimeoutName, CandidateSetData);
|
|
42
|
+
/** `git.topic.advance`, due at `at` or now: one row a topic, which a later save leaves due. */
|
|
43
|
+
const topicAdvanceRow = (at) => advanceRows.job(at === void 0 ? {
|
|
44
|
+
key: "advance",
|
|
45
|
+
data: {}
|
|
46
|
+
} : {
|
|
47
|
+
key: "advance",
|
|
48
|
+
data: {},
|
|
49
|
+
at
|
|
50
|
+
});
|
|
51
|
+
/** `git.topic.prepare` for one exact set, keyed by its set key, so a set is prepared once. */
|
|
52
|
+
const prepareRow = (key, candidates) => prepareRows.job({
|
|
53
|
+
key,
|
|
54
|
+
data: { candidates }
|
|
55
|
+
});
|
|
56
|
+
/** `git.topic.report-timeout` for one exact set, keyed by its set key, due when its report is late. */
|
|
57
|
+
const reportTimeoutRow = (key, candidates, at) => timeoutRows.job({
|
|
58
|
+
key,
|
|
59
|
+
data: { candidates },
|
|
60
|
+
at
|
|
61
|
+
});
|
|
62
|
+
export { CandidateSetData, PrepareData, TopicAdvanceData, prepareName, prepareRow, reportTimeoutName, reportTimeoutRow, topicAdvanceName, topicAdvanceRow };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { fail } from "../store/errors.mjs";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
// src/sync/bound.ts
|
|
4
|
+
/**
|
|
5
|
+
* The tips are kept in the import's one record, under the store's 1 MiB a value, and published in
|
|
6
|
+
* one commit, under its 10,000 writes.
|
|
7
|
+
*/
|
|
8
|
+
const importLimits = {
|
|
9
|
+
firstStep: 64,
|
|
10
|
+
packBytes: 96e6,
|
|
11
|
+
tips: 4e3,
|
|
12
|
+
tipNameBytes: 524288,
|
|
13
|
+
pollFirst: 100
|
|
14
|
+
};
|
|
15
|
+
const boundByServer = /* @__PURE__ */ new WeakMap();
|
|
16
|
+
/** Called once per server, by `syncJobs`: a second call throws, as a job registered twice does. */
|
|
17
|
+
const bindSync = (git, bound) => {
|
|
18
|
+
if (boundByServer.has(git)) throw new TypeError("syncJobs runs once for each server");
|
|
19
|
+
boundByServer.set(git, bound);
|
|
20
|
+
};
|
|
21
|
+
/** The server's binding, or `sync-unbound` until `syncJobs` has made it. */
|
|
22
|
+
const boundOf = (git) => {
|
|
23
|
+
const bound = boundByServer.get(git);
|
|
24
|
+
return bound === void 0 ? fail("FAILED_PRECONDITION", "Sync's jobs aren't bound to this server", {
|
|
25
|
+
hint: "Call syncJobs(git, { providers }) and register its jobs on the host queue",
|
|
26
|
+
context: { reason: "sync-unbound" }
|
|
27
|
+
}) : Effect.succeed(bound);
|
|
28
|
+
};
|
|
29
|
+
export { bindSync, boundOf, importLimits };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SyncGitHubOptions, SyncProvider } from "../contracts/sync.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* GitHub's cap on a webhook's payload: it delivers none larger, so a longer body isn't its, and is
|
|
4
|
+
* refused before more of it is read.
|
|
5
|
+
*/
|
|
6
|
+
export declare const webhookBodyBytes: number;
|
|
7
|
+
/**
|
|
8
|
+
* The GitHub App's repos, by `owner/name`: each try mints an installation token limited to the
|
|
9
|
+
* repo, and reads again while GitHub's Git doesn't know it yet. With `webhookSecret`, `verify`
|
|
10
|
+
* checks a push's webhook by its `X-Hub-Signature-256`; an empty one throws `INVALID_ARGUMENT`.
|
|
11
|
+
*/
|
|
12
|
+
export declare const github: (options: SyncGitHubOptions) => SyncProvider;
|