@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,144 @@
|
|
|
1
|
+
import { RepoId } from "./ids.mjs";
|
|
2
|
+
import { Operation } from "./operations.mjs";
|
|
3
|
+
import { RefAudience } from "./access.mjs";
|
|
4
|
+
import { Accepted, Awaitable, DecisionAnswer } from "./result.mjs";
|
|
5
|
+
import { TokenInfo } from "./tokens.mjs";
|
|
6
|
+
/**
|
|
7
|
+
* An actor's or a subject's ID, which the host chooses: at most `maxActorIdLength` bytes in UTF-8.
|
|
8
|
+
* A call naming a longer one answers `INVALID_ARGUMENT`, writing nothing and showing nothing it
|
|
9
|
+
* read.
|
|
10
|
+
*/
|
|
11
|
+
export interface ActorId {
|
|
12
|
+
readonly id: string;
|
|
13
|
+
}
|
|
14
|
+
/** Who acts. Git never reads `meta`: it's the host's. */
|
|
15
|
+
export interface NamedActor<Meta = unknown> extends ActorId {
|
|
16
|
+
readonly anonymous?: false;
|
|
17
|
+
readonly meta?: Meta;
|
|
18
|
+
}
|
|
19
|
+
export interface AnonymousActor<Meta = unknown> {
|
|
20
|
+
readonly anonymous: true;
|
|
21
|
+
readonly meta?: Meta;
|
|
22
|
+
}
|
|
23
|
+
export type Actor<Meta = unknown> = NamedActor<Meta> | AnonymousActor<Meta>;
|
|
24
|
+
/**
|
|
25
|
+
* The actor of a merge queue's publish of an entry, asked again after it waited: its ID alone. It
|
|
26
|
+
* has no `meta`, which was a snapshot of the sign-in at `queue.add`, and replaying it would decide
|
|
27
|
+
* the publish on what held then.
|
|
28
|
+
*/
|
|
29
|
+
export interface QueuedActor extends ActorId {
|
|
30
|
+
readonly anonymous?: false;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Who a check is asked about. `at: 'queued'`: the merge queue's publish of an entry that waited,
|
|
34
|
+
* asked again as the caller that added it, its actor named by ID alone, with no `meta`. Narrow on
|
|
35
|
+
* `at` before reading `actor.meta`: decide a queued publish from the ID, and never grant on
|
|
36
|
+
* `meta`'s absence, since a refusal `meta` would have given doesn't hold without it.
|
|
37
|
+
*/
|
|
38
|
+
export type Acting<Meta = unknown> = {
|
|
39
|
+
readonly at?: never;
|
|
40
|
+
readonly actor: Actor<Meta>;
|
|
41
|
+
} | {
|
|
42
|
+
readonly at: 'queued';
|
|
43
|
+
readonly actor: QueuedActor;
|
|
44
|
+
};
|
|
45
|
+
export interface CallInput {
|
|
46
|
+
readonly signal?: AbortSignal;
|
|
47
|
+
}
|
|
48
|
+
/** Every call names who it acts for, reads included, and `authorize` decides it. */
|
|
49
|
+
export interface ActorInput<Meta = unknown> extends CallInput {
|
|
50
|
+
readonly actor: Actor<Meta>;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* `key`: sent again within 24 hours, after a lost reply, the write answers as it first did; with
|
|
54
|
+
* other input, `ALREADY_EXISTS` with reason `key-reused`. The first answer is kept as a receipt in
|
|
55
|
+
* the repo's own records, in the write's commit, so a write sent again by the repo's new name
|
|
56
|
+
* after a rename finds it, and one sent by name finds it among the repos that name held in the
|
|
57
|
+
* last 24 hours. A key is its caller's: the actor's, and the token's when the caller came with one,
|
|
58
|
+
* so Pip's and Mo's writes with one key both apply. Errors aren't kept, and no count limits the
|
|
59
|
+
* receipts: only the writes do.
|
|
60
|
+
* `tokens.create`'s key is refused for the token's life instead, since its secret is shown once.
|
|
61
|
+
*/
|
|
62
|
+
export interface WriteInput<Meta = unknown> extends ActorInput<Meta> {
|
|
63
|
+
readonly key?: string;
|
|
64
|
+
}
|
|
65
|
+
export interface CredentialsBasic {
|
|
66
|
+
readonly kind: 'basic';
|
|
67
|
+
readonly username: string;
|
|
68
|
+
readonly password: string;
|
|
69
|
+
}
|
|
70
|
+
export interface CredentialsBearer {
|
|
71
|
+
readonly kind: 'bearer';
|
|
72
|
+
readonly token: string;
|
|
73
|
+
}
|
|
74
|
+
export type Credentials = CredentialsBasic | CredentialsBearer;
|
|
75
|
+
export interface AuthInput {
|
|
76
|
+
readonly request: Request;
|
|
77
|
+
readonly credentials?: Credentials;
|
|
78
|
+
readonly signal: AbortSignal;
|
|
79
|
+
}
|
|
80
|
+
/** Who is calling: `undefined` for a credential it doesn't know. */
|
|
81
|
+
export type GitAuth<Meta = unknown> = (input: AuthInput) => Awaitable<Actor<Meta> | undefined>;
|
|
82
|
+
/**
|
|
83
|
+
* The extension's grant resolver that identified a caller, by its `name`, for reading only: Git
|
|
84
|
+
* never trusts it, so a caller built by hand with it is a plain caller. To keep a caller's grant,
|
|
85
|
+
* such as a link or a queued entry does, read `ExtendedGit.grantOf`.
|
|
86
|
+
*/
|
|
87
|
+
export interface CallerGrant {
|
|
88
|
+
readonly resolver: string;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* `subject`: whom the actor acts for. `token`: set when the credential is one of Git's tokens.
|
|
92
|
+
* `grant`: set when an extension's grant resolver identified the caller, and absent for a token
|
|
93
|
+
* or the host's `auth`. `at: 'queued'`: the merge queue publishing an entry as the caller that
|
|
94
|
+
* added it, its token and grant identified again, its actor with no `meta`.
|
|
95
|
+
*/
|
|
96
|
+
export interface Caller<Meta = unknown> {
|
|
97
|
+
readonly actor: Actor<Meta>;
|
|
98
|
+
readonly subject?: ActorId;
|
|
99
|
+
readonly token?: TokenInfo;
|
|
100
|
+
readonly grant?: CallerGrant;
|
|
101
|
+
readonly at?: 'queued';
|
|
102
|
+
}
|
|
103
|
+
/** The repo an operation names, when it exists. */
|
|
104
|
+
export interface RepoAccess {
|
|
105
|
+
readonly id: RepoId;
|
|
106
|
+
readonly public: boolean;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* `subject` and `token`: the caller's, as `Caller` has them. With `at: 'queued'`, the merge
|
|
110
|
+
* queue's publish of an entry that waited, asked as the caller that added it, again: its actor
|
|
111
|
+
* is its ID alone, with no `meta`, and its token is the one it added with, read again live.
|
|
112
|
+
*/
|
|
113
|
+
export type AuthorizeInput<Meta = unknown> = Acting<Meta> & {
|
|
114
|
+
readonly subject?: ActorId;
|
|
115
|
+
readonly token?: TokenInfo;
|
|
116
|
+
readonly operation: Operation;
|
|
117
|
+
readonly repo?: RepoAccess;
|
|
118
|
+
readonly signal: AbortSignal;
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* Whether they may. A merge queue's publish asks again, for each entry, as the caller that added
|
|
122
|
+
* it, with `at: 'queued'` and no actor `meta`: decide it from the actor's ID, and never grant on
|
|
123
|
+
* `meta`'s absence.
|
|
124
|
+
*
|
|
125
|
+
* A refusal reaches the caller exactly as it's returned when it names a code of
|
|
126
|
+
* its own, such as `FAILED_PRECONDITION`: Git can't tell who may know a repo exists, so it passes
|
|
127
|
+
* that code on. The default refusal, `reject` with no code, `NOT_ALLOWED` or `NOT_FOUND`, answers
|
|
128
|
+
* a stranger as for a repo that isn't there: `UNAUTHENTICATED` when anonymous, so Git asks to sign
|
|
129
|
+
* in, and `NOT_FOUND` when signed in. A refusal of anything but a read or a create, whatever its code,
|
|
130
|
+
* reaches only a caller you'd let read the repo; anyone else gets your answer to a read, and a
|
|
131
|
+
* name with no repo answers as a read of it would. So return the
|
|
132
|
+
* default refusal to anyone who may not know a private repo exists, and a code of your own only
|
|
133
|
+
* to a caller who may.
|
|
134
|
+
*
|
|
135
|
+
* A `token.create` names whom the token is for, its `subject`, and any `actor` acting for them,
|
|
136
|
+
* since a token's caller is its subject: refuse one a caller mints for anyone they may not act as.
|
|
137
|
+
* Decided 21 Nov by the coordinator.
|
|
138
|
+
*
|
|
139
|
+
* A `refs.private` operation, asked only of a server made with `access`, is accepted with the
|
|
140
|
+
* caller's `RefAudience`: `accept({ read, publish })`. Any other is accepted with no value.
|
|
141
|
+
*/
|
|
142
|
+
export type GitAuthorize<Meta = unknown> = (input: AuthorizeInput<Meta>) => Awaitable<AuthorizeAnswer>;
|
|
143
|
+
/** What `authorize` answers: a decision, or for `refs.private`, the caller's ref audience. */
|
|
144
|
+
export type AuthorizeAnswer = DecisionAnswer | Accepted<RefAudience>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ActorInput, WriteInput } from "./actors.mjs";
|
|
2
|
+
import { ReadOptions } from "./engine.mjs";
|
|
3
|
+
import { Oid, RepoId } from "./ids.mjs";
|
|
4
|
+
import { Bytes } from "./objects.mjs";
|
|
5
|
+
import { RepoInput } from "./repos.mjs";
|
|
6
|
+
import { Result } from "./result.mjs";
|
|
7
|
+
/** A call's input with the actor it acts for, and the repo it resolved its first argument to. */
|
|
8
|
+
export type Acting<Input> = Input & ActorInput & Pick<RepoInput, 'internalId'>;
|
|
9
|
+
/** One object, by its ID. */
|
|
10
|
+
export interface ObjectInput extends ReadOptions {
|
|
11
|
+
readonly oid: Oid;
|
|
12
|
+
}
|
|
13
|
+
/** A blob: its ID, its size in bytes, and its bytes, streamed. */
|
|
14
|
+
export interface Blob {
|
|
15
|
+
readonly oid: Oid;
|
|
16
|
+
readonly size: number;
|
|
17
|
+
readonly bytes: Bytes;
|
|
18
|
+
}
|
|
19
|
+
/** A blob's bytes, up to 16 MiB, read whole before it's written. */
|
|
20
|
+
export interface BlobCreateInput extends WriteInput, Pick<RepoInput, 'internalId'> {
|
|
21
|
+
readonly bytes: Bytes;
|
|
22
|
+
}
|
|
23
|
+
/** An object a write made, by its ID. */
|
|
24
|
+
export interface CreatedObject {
|
|
25
|
+
readonly oid: Oid;
|
|
26
|
+
}
|
|
27
|
+
export interface BlobCalls {
|
|
28
|
+
/**
|
|
29
|
+
* Any blob the repo holds, its `bytes` streamed and checked against its ID as they go: a
|
|
30
|
+
* mismatch errors the stream with `DATA_LOSS`. Its `bytes` limit has no default, so the file
|
|
31
|
+
* limit, 100 MiB, caps it. `RESOURCE_EXHAUSTED` with `object-too-large` comes before the first
|
|
32
|
+
* byte for a blob past the `bytes` limit the caller sets, or one stored as a delta past 16 MiB.
|
|
33
|
+
* `milliseconds` limits the call until it answers, not the stream after it.
|
|
34
|
+
*/
|
|
35
|
+
readonly get: (repo: RepoId, input: Acting<ObjectInput>) => Promise<Result<Blob>>;
|
|
36
|
+
/** A blob, written as its own commit: past 16 MiB `RESOURCE_EXHAUSTED` with `object-too-large`. */
|
|
37
|
+
readonly create: (repo: RepoId, input: BlobCreateInput) => Promise<Result<CreatedObject>>;
|
|
38
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { GitError } from "./result.mjs";
|
|
2
|
+
import "effect/Effect";
|
|
3
|
+
import "effect/Exit";
|
|
4
|
+
/**
|
|
5
|
+
* The refusal of the spent bound `cause` holds, `spentAt`'s, or `undefined` for a cause that holds
|
|
6
|
+
* none: a Promise edge's answer, such as a host's route catching what a door's defect rejected
|
|
7
|
+
* with (Q826). A bridge, as Q787 names one: it carries a spent bound across a Promise edge, where
|
|
8
|
+
* `answerSpent` can't reach, since Effect's context stops at a Promise. The drop-in's Effect step
|
|
9
|
+
* 2b (Q783) deletes it with the Promise edges, once its routes answer as Effects.
|
|
10
|
+
*/
|
|
11
|
+
export declare const spentRefusalOf: (cause: unknown) => GitError | undefined;
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { isInfraError } from "@ref0/infra";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import * as EffectResult from "effect/Result";
|
|
4
|
+
import * as Option from "effect/Option";
|
|
5
|
+
import * as Cause from "effect/Cause";
|
|
6
|
+
import * as Exit from "effect/Exit";
|
|
7
|
+
import * as Predicate from "effect/Predicate";
|
|
8
|
+
// src/contracts/calls-spent.ts
|
|
9
|
+
/**
|
|
10
|
+
* A call that never started, or that the platform refused, past a bound: `most` of `bound`'s calls
|
|
11
|
+
* of a request's count or a `CallBudget`, or the platform's cap on one invocation's calls, which
|
|
12
|
+
* names no count, so its `most` is 0. The doors fail with it as a defect, never as an error: a
|
|
13
|
+
* spent request stops as a whole, as an interruption does, so no path that settles for less, tries
|
|
14
|
+
* again or refuses one ref takes it for its own. Only the edges answer it, each as its refusal:
|
|
15
|
+
* the routes, the Promise and Effect faces a host calls, `hostCall`, and the steps that stop at
|
|
16
|
+
* their own bound on purpose, which `lint/call-spent.test.ts` names.
|
|
17
|
+
*/
|
|
18
|
+
var CallsSpent = class extends Error {
|
|
19
|
+
_tag = "CallsSpent";
|
|
20
|
+
bound;
|
|
21
|
+
most;
|
|
22
|
+
of;
|
|
23
|
+
constructor(bound, most, of = "request", cause) {
|
|
24
|
+
super(spentMessage(bound, most, of, cause), cause === void 0 ? void 0 : { cause });
|
|
25
|
+
this.bound = bound;
|
|
26
|
+
this.most = most;
|
|
27
|
+
this.of = of;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
const spentMessage = (bound, most, of, cause) => {
|
|
31
|
+
const calls = bound === "bucket" ? "bucket calls" : "subrequests";
|
|
32
|
+
if (of === "budget") return `The call budget's ${most} ${calls} are spent`;
|
|
33
|
+
if (of === "cap") return cause instanceof Error ? cause.message : "The platform refused a call";
|
|
34
|
+
return `The ${most} ${calls} allowed are spent`;
|
|
35
|
+
};
|
|
36
|
+
/** The hint a spent count's or the platform cap's refusal gives. */
|
|
37
|
+
const callLimitTry = "The server reached its limit of store calls for one request: try again with less at once";
|
|
38
|
+
/**
|
|
39
|
+
* `spent`'s refusal, as an edge answers it, with `spent` its cause: a request's count's, named by
|
|
40
|
+
* its bound, which a fetch's route words as `tooManyCalls`, and the platform cap's, its own
|
|
41
|
+
* message, each with `callLimitTry`; or a budget's, `reason: 'call-budget'`.
|
|
42
|
+
*/
|
|
43
|
+
const spentRefusal = (spent) => spent.of === "budget" ? {
|
|
44
|
+
code: "RESOURCE_EXHAUSTED",
|
|
45
|
+
message: spent.message,
|
|
46
|
+
hint: "Raise the CallBudget, or make fewer calls inside it",
|
|
47
|
+
context: { reason: "call-budget" },
|
|
48
|
+
cause: spent
|
|
49
|
+
} : {
|
|
50
|
+
code: "RESOURCE_EXHAUSTED",
|
|
51
|
+
message: spent.message,
|
|
52
|
+
hint: callLimitTry,
|
|
53
|
+
cause: spent
|
|
54
|
+
};
|
|
55
|
+
/** How many causes deep `spentIn` looks: past a few wraps, a chain is a loop. */
|
|
56
|
+
const spentDepth = 8;
|
|
57
|
+
/**
|
|
58
|
+
* The `CallsSpent` `cause` holds, itself or a few causes down, as a refusal, a thrown error or a
|
|
59
|
+
* stream's error keeps it.
|
|
60
|
+
*/
|
|
61
|
+
const spentIn = (cause) => {
|
|
62
|
+
let at = cause;
|
|
63
|
+
for (let depth = 0; depth < spentDepth; depth += 1) {
|
|
64
|
+
if (at instanceof CallsSpent) return at;
|
|
65
|
+
if (!Predicate.hasProperty(at, "cause")) return void 0;
|
|
66
|
+
at = at.cause;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
/** Infra's refusal past the platform's cap on one invocation's calls, `cause` or one beneath it. */
|
|
70
|
+
const callLimitIn = (cause) => {
|
|
71
|
+
let at = cause;
|
|
72
|
+
for (let depth = 0; depth < spentDepth; depth += 1) {
|
|
73
|
+
if (isInfraError(at)) return at.reason === "call-limit" ? at : void 0;
|
|
74
|
+
if (!Predicate.hasProperty(at, "cause")) return void 0;
|
|
75
|
+
at = at.cause;
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* The spent bound `cause` holds, as a door, `hostCall` or a re-entry finds it: a `CallsSpent` a
|
|
80
|
+
* few causes down, or infra's refusal past the platform's cap, as the bound it is.
|
|
81
|
+
*/
|
|
82
|
+
const spentAt = (cause) => {
|
|
83
|
+
const spent = spentIn(cause);
|
|
84
|
+
if (spent !== void 0) return spent;
|
|
85
|
+
const limit = callLimitIn(cause);
|
|
86
|
+
return limit === void 0 ? void 0 : new CallsSpent("subrequests", 0, "cap", limit);
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* The refusal of the spent bound `cause` holds, `spentAt`'s, or `undefined` for a cause that holds
|
|
90
|
+
* none: a Promise edge's answer, such as a host's route catching what a door's defect rejected
|
|
91
|
+
* with (Q826). A bridge, as Q787 names one: it carries a spent bound across a Promise edge, where
|
|
92
|
+
* `answerSpent` can't reach, since Effect's context stops at a Promise. The drop-in's Effect step
|
|
93
|
+
* 2b (Q783) deletes it with the Promise edges, once its routes answer as Effects.
|
|
94
|
+
*/
|
|
95
|
+
const spentRefusalOf = (cause) => {
|
|
96
|
+
const spent = spentAt(cause);
|
|
97
|
+
return spent === void 0 ? void 0 : spentRefusal(spent);
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* `run`'s Promise, its rejection as `caught` makes it, but one past a call bound, `spentAt` of it,
|
|
101
|
+
* the defect it is: a read of a stream a spent call broke, or a call that threw a spent refusal.
|
|
102
|
+
*/
|
|
103
|
+
const tryUnlessSpent = (run, caught) => Effect.tryPromise({
|
|
104
|
+
try: run,
|
|
105
|
+
catch: (cause) => new Caught(cause)
|
|
106
|
+
}).pipe(Effect.catch(({ cause }) => {
|
|
107
|
+
const spent = spentAt(cause);
|
|
108
|
+
return spent === void 0 ? Effect.fail(caught(cause)) : Effect.die(spent);
|
|
109
|
+
}));
|
|
110
|
+
/** A rejection `tryUnlessSpent` holds until it tells a spent bound from the rest. */
|
|
111
|
+
var Caught = class {
|
|
112
|
+
cause;
|
|
113
|
+
constructor(cause) {
|
|
114
|
+
this.cause = cause;
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* `result`, a Promise face's answer, back in Effect: its error a failure, but one past a call bound
|
|
119
|
+
* the defect it is, so a spent call that crossed a Promise stops its request still.
|
|
120
|
+
*/
|
|
121
|
+
const fromAnswer = (result) => result.kind === "success" ? Effect.succeed(result.value) : answerFailed(result.error);
|
|
122
|
+
/** `error`, a Promise face's refusal, back in Effect: as `fromAnswer` takes a failed answer. */
|
|
123
|
+
const answerFailed = (error) => {
|
|
124
|
+
const spent = spentAt(error);
|
|
125
|
+
return spent === void 0 ? Effect.fail(error) : Effect.die(spent);
|
|
126
|
+
};
|
|
127
|
+
/**
|
|
128
|
+
* A call's `Exit` as its Promise answers: the value, or Git's error as `Result`, a spent call
|
|
129
|
+
* bound's refusal among them. A call `signal` interrupted throws the signal's reason, as `fetch`
|
|
130
|
+
* does, and any other defect throws as it is.
|
|
131
|
+
*/
|
|
132
|
+
const answerOf = (exit, signal) => {
|
|
133
|
+
if (Exit.isSuccess(exit)) return {
|
|
134
|
+
kind: "success",
|
|
135
|
+
value: exit.value
|
|
136
|
+
};
|
|
137
|
+
const spent = spentIn(EffectResult.getOrUndefined(Exit.findDefect(exit)));
|
|
138
|
+
if (spent !== void 0) return {
|
|
139
|
+
kind: "error",
|
|
140
|
+
error: spentRefusal(spent)
|
|
141
|
+
};
|
|
142
|
+
const error = Cause.findErrorOption(exit.cause);
|
|
143
|
+
if (Option.isSome(error)) return {
|
|
144
|
+
kind: "error",
|
|
145
|
+
error: error.value
|
|
146
|
+
};
|
|
147
|
+
if (signal?.aborted === true && Cause.hasInterruptsOnly(exit.cause)) throw signal.reason;
|
|
148
|
+
throw Cause.squash(exit.cause);
|
|
149
|
+
};
|
|
150
|
+
export { CallsSpent, answerFailed, answerOf, callLimitIn, callLimitTry, fromAnswer, spentAt, spentIn, spentRefusal, spentRefusalOf, tryUnlessSpent };
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { CallInput } from "./actors.mjs";
|
|
2
|
+
import { BlobCalls } from "./blobs.mjs";
|
|
3
|
+
import { CommitCalls } from "./commits.mjs";
|
|
4
|
+
import { GitEngine } from "./engine.mjs";
|
|
5
|
+
import { FileCalls } from "./files.mjs";
|
|
6
|
+
import { Oid, RefName, RepoId } from "./ids.mjs";
|
|
7
|
+
import { MergeCalls } from "./merges.mjs";
|
|
8
|
+
import { Filter, ObjectsFactory } from "./objects.mjs";
|
|
9
|
+
import { Ref, RefApplied, RefCalls, RefEdit, RefRejected, RefsUpdated } from "./refs.mjs";
|
|
10
|
+
import { RemoteOptions, WithoutActor } from "./remote.mjs";
|
|
11
|
+
import { Result } from "./result.mjs";
|
|
12
|
+
import { TagCalls } from "./tags.mjs";
|
|
13
|
+
import { TreeCalls } from "./trees.mjs";
|
|
14
|
+
import { Bucket, Clock, RecordStore } from "./promises.mjs";
|
|
15
|
+
import { Listing, Page } from "@ref0/infra";
|
|
16
|
+
/** Where a client keeps its objects and refs: the server's keys, with no `jobs`. */
|
|
17
|
+
export interface ClientAdapter {
|
|
18
|
+
readonly store: RecordStore;
|
|
19
|
+
readonly bucket?: Bucket;
|
|
20
|
+
/** The store's clock: Effect's when left out. */
|
|
21
|
+
readonly clock?: Clock;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* A client of one remote. Its local side is storage, not a cache: a commit made here is its only
|
|
25
|
+
* copy until a push. A memory adapter and `loose()` when left out; `engine` for the calls that
|
|
26
|
+
* walk, diff or merge, which refuse without one.
|
|
27
|
+
*/
|
|
28
|
+
export interface GitClientOptions extends RemoteOptions {
|
|
29
|
+
readonly adapter?: ClientAdapter;
|
|
30
|
+
readonly objects?: ObjectsFactory<false>;
|
|
31
|
+
readonly engine?: GitEngine;
|
|
32
|
+
}
|
|
33
|
+
export interface RemoteRefsInput extends CallInput {
|
|
34
|
+
/** Only refs whose full name starts with it, such as `refs/heads/`. */
|
|
35
|
+
readonly prefix?: string;
|
|
36
|
+
readonly page?: Page;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* `refs`: branch names, such as `main`, or full names; every branch and tag when left out.
|
|
40
|
+
* `depth`: commits of history from each tip, a shallow fetch. `filter`: objects left out, a
|
|
41
|
+
* partial fetch, such as `{ kind: 'blob:none' }`. `force`: move a local ref that holds commits
|
|
42
|
+
* the remote's tip doesn't to that tip anyway, as `git fetch --force` does.
|
|
43
|
+
*/
|
|
44
|
+
export interface ClientFetchInput extends CallInput {
|
|
45
|
+
readonly refs?: readonly RefName[];
|
|
46
|
+
readonly depth?: number;
|
|
47
|
+
readonly filter?: Filter;
|
|
48
|
+
readonly force?: boolean;
|
|
49
|
+
}
|
|
50
|
+
/** A local ref a forced fetch moved to the remote's tip, dropping commits only it held. */
|
|
51
|
+
export interface RefForced {
|
|
52
|
+
readonly kind: 'force';
|
|
53
|
+
readonly ref: RefName;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* The refs fetched, each at the remote's tip; the commits the local history now ends at, or no
|
|
57
|
+
* longer does; and each local ref of the same name moved to its tip, or refused. Without `force`,
|
|
58
|
+
* a fetch never drops a commit only the local ref holds: it refuses that ref as `diverged`,
|
|
59
|
+
* naming the tip in its `context`, and keeps the tip's objects, to merge or rebase onto.
|
|
60
|
+
*/
|
|
61
|
+
export interface ClientFetchResult {
|
|
62
|
+
readonly refs: readonly Ref[];
|
|
63
|
+
readonly shallow: readonly Oid[];
|
|
64
|
+
readonly unshallow: readonly Oid[];
|
|
65
|
+
readonly updates: readonly (RefApplied | RefForced | RefRejected)[];
|
|
66
|
+
}
|
|
67
|
+
/** `from` is the remote's tip as last seen; `atomic`: all move or none, where the remote can. */
|
|
68
|
+
export interface ClientPushInput extends CallInput {
|
|
69
|
+
readonly updates: readonly RefEdit[];
|
|
70
|
+
readonly atomic?: boolean;
|
|
71
|
+
readonly pushOptions?: readonly string[];
|
|
72
|
+
}
|
|
73
|
+
/** A server's call group as a client makes it: no repo, and no actor. */
|
|
74
|
+
export type Localize<Calls> = { readonly [Key in keyof Calls]: Calls[Key] extends ((repo: RepoId, input: infer Input) => infer Answer) ? (input: WithoutActor<Input>) => Answer : never; };
|
|
75
|
+
export interface GitClient {
|
|
76
|
+
readonly remoteRefs: (input?: RemoteRefsInput) => Promise<Result<Listing<Ref>>>;
|
|
77
|
+
readonly fetch: (input?: ClientFetchInput) => Promise<Result<ClientFetchResult>>;
|
|
78
|
+
readonly push: (input: ClientPushInput) => Promise<Result<RefsUpdated>>;
|
|
79
|
+
readonly refs: Localize<RefCalls>;
|
|
80
|
+
readonly blobs: Localize<BlobCalls>;
|
|
81
|
+
readonly trees: Localize<TreeCalls>;
|
|
82
|
+
readonly commits: Localize<CommitCalls>;
|
|
83
|
+
readonly tags: Localize<TagCalls>;
|
|
84
|
+
readonly files: Localize<FileCalls>;
|
|
85
|
+
readonly merges: Localize<MergeCalls>;
|
|
86
|
+
}
|
|
87
|
+
/** A list call's input: the page it starts from. */
|
|
88
|
+
export interface PagedInput {
|
|
89
|
+
readonly page?: Page;
|
|
90
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { WriteInput } from "./actors.mjs";
|
|
2
|
+
import { Acting, ObjectInput } from "./blobs.mjs";
|
|
3
|
+
import { Commit, DiffListing, MergeBases, ReadOptions, ReadPage, Signature, TreeChange, TreeChanges } from "./engine.mjs";
|
|
4
|
+
import { Oid, RefName, RepoId } from "./ids.mjs";
|
|
5
|
+
import { RepoInput } from "./repos.mjs";
|
|
6
|
+
import { TreeEdit } from "./trees.mjs";
|
|
7
|
+
import { Result } from "./result.mjs";
|
|
8
|
+
import { Listing, Page } from "@ref0/infra";
|
|
9
|
+
/**
|
|
10
|
+
* A revision, as a call names a commit: a full object ID, a full ref name, `HEAD` for the
|
|
11
|
+
* default branch, or a short name, tried as Git tries it: `refs/<name>`, `refs/tags/<name>`,
|
|
12
|
+
* `refs/heads/<name>`, `refs/remotes/<name>` and `refs/remotes/<name>/HEAD`. A tag peels to its
|
|
13
|
+
* commit.
|
|
14
|
+
*/
|
|
15
|
+
export type Revision = string;
|
|
16
|
+
/** `git log <ref> [-- <path>]`: newest first; with `path`, only the commits that changed it. */
|
|
17
|
+
export interface LogInput extends ReadPage {
|
|
18
|
+
readonly ref: Revision;
|
|
19
|
+
readonly path?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface CommitsMergeBaseInput extends ReadOptions {
|
|
22
|
+
readonly commits: readonly Revision[];
|
|
23
|
+
}
|
|
24
|
+
/** `git diff <base> <head>`, as `diff-tree -r -M` lists it: renames unless `renames` is false. */
|
|
25
|
+
export interface CommitDiffInput extends ReadPage {
|
|
26
|
+
readonly base: Revision;
|
|
27
|
+
readonly head: Revision;
|
|
28
|
+
readonly renames?: boolean;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* `base...head`: the commits `head` has that `base` hasn't, and the files changed from their
|
|
32
|
+
* first merge base to `head`, or from `base` when their histories are unrelated. Each list pages
|
|
33
|
+
* apart. A `commits` limit of 0 lists no commits, and the rest is answered as ever, so the counts
|
|
34
|
+
* and the files answer however large a commit's message is.
|
|
35
|
+
*/
|
|
36
|
+
export interface CompareInput extends ReadOptions {
|
|
37
|
+
readonly base: Revision;
|
|
38
|
+
readonly head: Revision;
|
|
39
|
+
readonly renames?: boolean;
|
|
40
|
+
readonly commits?: Page;
|
|
41
|
+
readonly files?: Page;
|
|
42
|
+
}
|
|
43
|
+
export interface LineCounts {
|
|
44
|
+
readonly added: number;
|
|
45
|
+
readonly deleted: number;
|
|
46
|
+
}
|
|
47
|
+
/** A change and its lines, as `git diff --numstat` counts them, or `binary`. */
|
|
48
|
+
export interface ComparisonFile extends TreeChange {
|
|
49
|
+
readonly lines: LineCounts | 'binary';
|
|
50
|
+
}
|
|
51
|
+
export interface Compare {
|
|
52
|
+
readonly base: Oid;
|
|
53
|
+
readonly head: Oid;
|
|
54
|
+
/** The first merge base, as `git merge-base` answers it: left out for unrelated histories. */
|
|
55
|
+
readonly mergeBase?: Oid;
|
|
56
|
+
/** How many commits `head` has that `base` hasn't, and the other way. */
|
|
57
|
+
readonly ahead: number;
|
|
58
|
+
readonly behind: number;
|
|
59
|
+
readonly commits: Listing<Commit>;
|
|
60
|
+
readonly files: DiffListing<ComparisonFile>;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* The ref a write moves to the commit it makes, in the same commit as its objects: `name` a full
|
|
64
|
+
* ref, or a branch's short name, and `from` where the write expects it, `null` for a new ref. A
|
|
65
|
+
* ref elsewhere fails `FAILED_PRECONDITION` with `ref-conflict`, and nothing is written.
|
|
66
|
+
*/
|
|
67
|
+
export interface RefPublication {
|
|
68
|
+
readonly name: RefName;
|
|
69
|
+
readonly from: Oid | null;
|
|
70
|
+
}
|
|
71
|
+
export interface CommitMessage {
|
|
72
|
+
readonly message: string;
|
|
73
|
+
readonly author: Signature;
|
|
74
|
+
}
|
|
75
|
+
export interface CommitCreateFields extends WriteInput, CommitMessage {
|
|
76
|
+
readonly parents: readonly Oid[];
|
|
77
|
+
/** The author, when left out. */
|
|
78
|
+
readonly committer?: Signature;
|
|
79
|
+
/** An armored signature, written as the commit's `gpgsig`. */
|
|
80
|
+
readonly signature?: string;
|
|
81
|
+
readonly ref?: RefPublication;
|
|
82
|
+
}
|
|
83
|
+
/** A commit of `tree`, or of the first parent's tree, an empty one for none, with `changes`. */
|
|
84
|
+
export type CommitCreateInput = CommitCreateFields & Pick<RepoInput, 'internalId'> & ({
|
|
85
|
+
readonly tree: Oid;
|
|
86
|
+
readonly changes?: never;
|
|
87
|
+
} | {
|
|
88
|
+
readonly changes: readonly TreeEdit[];
|
|
89
|
+
readonly tree?: never;
|
|
90
|
+
});
|
|
91
|
+
/**
|
|
92
|
+
* `git revert <commit>` onto the branch `onto`, published there: `commit`'s change undone on
|
|
93
|
+
* `onto`'s tip, as a new commit whose parent is that tip. A merge commit is refused.
|
|
94
|
+
*/
|
|
95
|
+
export interface CommitRevertInput extends WriteInput, CommitMessage, Pick<RepoInput, 'internalId'> {
|
|
96
|
+
readonly commit: Oid;
|
|
97
|
+
readonly onto: RefName;
|
|
98
|
+
/** The author, when left out. */
|
|
99
|
+
readonly committer?: Signature;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* `git cherry-pick <commit>` onto `onto`: `commit`'s change against its parent made on `onto`, as
|
|
103
|
+
* a commit whose parent is `onto`, keeping `commit`'s author and message. Its committer is
|
|
104
|
+
* `commit`'s unless given. It moves a ref only with `ref` (Q29).
|
|
105
|
+
*/
|
|
106
|
+
export interface CommitPickInput extends WriteInput, Pick<RepoInput, 'internalId'> {
|
|
107
|
+
readonly commit: Oid;
|
|
108
|
+
readonly onto: Oid;
|
|
109
|
+
readonly committer?: Signature;
|
|
110
|
+
readonly ref?: RefPublication;
|
|
111
|
+
}
|
|
112
|
+
export interface CommitCalls {
|
|
113
|
+
/** A commit by its ID; a tag's ID peels to its commit. */
|
|
114
|
+
readonly get: (repo: RepoId, input: Acting<ObjectInput>) => Promise<Result<Commit>>;
|
|
115
|
+
readonly list: (repo: RepoId, input: Acting<LogInput>) => Promise<Result<Listing<Commit>>>;
|
|
116
|
+
/** `git merge-base --all`. */
|
|
117
|
+
readonly mergeBase: (repo: RepoId, input: Acting<CommitsMergeBaseInput>) => Promise<Result<MergeBases>>;
|
|
118
|
+
readonly diff: (repo: RepoId, input: Acting<CommitDiffInput>) => Promise<Result<TreeChanges>>;
|
|
119
|
+
readonly compare: (repo: RepoId, input: Acting<CompareInput>) => Promise<Result<Compare>>;
|
|
120
|
+
/** A commit, written with the tree its changes make, and its ref moved when it names one. */
|
|
121
|
+
readonly create: (repo: RepoId, input: CommitCreateInput) => Promise<Result<Commit>>;
|
|
122
|
+
/** A conflict fails `FAILED_PRECONDITION` with `merge-conflict`, and writes nothing. */
|
|
123
|
+
readonly revert: (repo: RepoId, input: CommitRevertInput) => Promise<Result<Commit>>;
|
|
124
|
+
/** A conflict fails `FAILED_PRECONDITION` with `merge-conflict`, and writes nothing. */
|
|
125
|
+
readonly pick: (repo: RepoId, input: CommitPickInput) => Promise<Result<Commit>>;
|
|
126
|
+
}
|