@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,587 @@
|
|
|
1
|
+
import { streamOf } from "../protocol/bytes/streams.mjs";
|
|
2
|
+
import { heldBytes } from "../protocol/objects/held.mjs";
|
|
3
|
+
import { queueIdParts } from "../queue/ids.mjs";
|
|
4
|
+
import { GitRestApi } from "./api.mjs";
|
|
5
|
+
import { abortable, credentialRefused, remoteFetch } from "../client/transport.mjs";
|
|
6
|
+
import { jsonError, restFailure } from "./errors.mjs";
|
|
7
|
+
import { listenOver } from "./listen.mjs";
|
|
8
|
+
import { readableUrl } from "./paths.mjs";
|
|
9
|
+
import * as Effect from "effect/Effect";
|
|
10
|
+
import * as Schema from "effect/Schema";
|
|
11
|
+
import * as Option from "effect/Option";
|
|
12
|
+
import * as Cause from "effect/Cause";
|
|
13
|
+
import * as Exit from "effect/Exit";
|
|
14
|
+
import * as Predicate from "effect/Predicate";
|
|
15
|
+
import { HttpApiClient } from "effect/http-api";
|
|
16
|
+
import * as Stream from "effect/Stream";
|
|
17
|
+
import * as FetchHttpClient from "effect/http/FetchHttpClient";
|
|
18
|
+
import * as HttpClient from "effect/http/HttpClient";
|
|
19
|
+
import * as HttpClientError from "effect/http/HttpClientError";
|
|
20
|
+
import * as HttpClientRequest from "effect/http/HttpClientRequest";
|
|
21
|
+
import * as HttpClientResponse from "effect/http/HttpClientResponse";
|
|
22
|
+
// src/rest/client.ts
|
|
23
|
+
const statusError = (status) => {
|
|
24
|
+
if (status === 502 || status === 503) return {
|
|
25
|
+
code: "UNAVAILABLE",
|
|
26
|
+
message: `The remote answered ${status}`
|
|
27
|
+
};
|
|
28
|
+
if (status === 504) return {
|
|
29
|
+
code: "DEADLINE_EXCEEDED",
|
|
30
|
+
message: "The remote answered 504"
|
|
31
|
+
};
|
|
32
|
+
if (status === 401) return {
|
|
33
|
+
code: "UNAUTHENTICATED",
|
|
34
|
+
message: "The remote answered 401"
|
|
35
|
+
};
|
|
36
|
+
return {
|
|
37
|
+
code: "INTERNAL",
|
|
38
|
+
message: `The remote answered ${status}, which REST doesn't send`
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
/** What the transport threw when no answer came: never the request, which holds the credential. */
|
|
42
|
+
const transportCause = (error) => Predicate.isTagged(error.reason, "TransportError") ? error.reason.cause : void 0;
|
|
43
|
+
/**
|
|
44
|
+
* What the typed client failed with, as a `GitError`: the remote's own, or what kept it away. A
|
|
45
|
+
* schema's failure before the request was `sent` is the call's input REST can't carry. An
|
|
46
|
+
* `HttpClientError` is never a cause: its request holds the credential.
|
|
47
|
+
*/
|
|
48
|
+
const gitErrorOf = (error, sent) => {
|
|
49
|
+
if (HttpClientError.isHttpClientError(error)) {
|
|
50
|
+
const { reason } = error;
|
|
51
|
+
if (transportCause(error) === credentialRefused) return credentialRefused;
|
|
52
|
+
if (Predicate.isTagged(reason, "TransportError")) return {
|
|
53
|
+
code: "UNAVAILABLE",
|
|
54
|
+
message: "The remote didn't answer",
|
|
55
|
+
cause: transportCause(error)
|
|
56
|
+
};
|
|
57
|
+
if (Predicate.isTagged(reason, "StatusCodeError")) return statusError(reason.response.status);
|
|
58
|
+
return {
|
|
59
|
+
code: "INTERNAL",
|
|
60
|
+
message: "The remote's answer couldn't be read"
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
if (Schema.isSchemaError(error) && !sent) return {
|
|
64
|
+
code: "INVALID_ARGUMENT",
|
|
65
|
+
message: "The call's input doesn't match REST's",
|
|
66
|
+
cause: error
|
|
67
|
+
};
|
|
68
|
+
if (Schema.isSchemaError(error)) return {
|
|
69
|
+
code: "INTERNAL",
|
|
70
|
+
message: "The remote's answer doesn't match REST's",
|
|
71
|
+
cause: error
|
|
72
|
+
};
|
|
73
|
+
return error;
|
|
74
|
+
};
|
|
75
|
+
/** The call's `Result`; a cancelled call throws its signal's reason, and a defect its cause. */
|
|
76
|
+
const resultOf = (exit, signal, sent) => {
|
|
77
|
+
if (Exit.isSuccess(exit)) return {
|
|
78
|
+
kind: "success",
|
|
79
|
+
value: exit.value
|
|
80
|
+
};
|
|
81
|
+
const failure = Cause.findErrorOption(exit.cause);
|
|
82
|
+
if (Option.isSome(failure)) return {
|
|
83
|
+
kind: "error",
|
|
84
|
+
error: gitErrorOf(failure.value, sent)
|
|
85
|
+
};
|
|
86
|
+
if (signal?.aborted === true && Cause.hasInterruptsOnly(exit.cause)) throw signal.reason;
|
|
87
|
+
throw Cause.squash(exit.cause);
|
|
88
|
+
};
|
|
89
|
+
/** An answer's body as a web stream: the response's own when it has one. */
|
|
90
|
+
const bodyStream = (response) => Option.match(HttpClientResponse.toWeb(response), {
|
|
91
|
+
onNone: () => Stream.toReadableStream(response.stream),
|
|
92
|
+
onSome: (web) => web.body ?? new ReadableStream({ start: (controller) => controller.close() })
|
|
93
|
+
});
|
|
94
|
+
/** A refused answer as its `GitError`: the remote's own, or what its status says. */
|
|
95
|
+
const refusalOf = (response) => Effect.flatMap(Option.match(HttpClientResponse.toWeb(response), {
|
|
96
|
+
onNone: () => Effect.succeed({ status: response.status }),
|
|
97
|
+
onSome: restFailure
|
|
98
|
+
}), ({ status, error }) => Effect.fail(error ?? statusError(status)));
|
|
99
|
+
/**
|
|
100
|
+
* An events answer's body, as EventSource takes one: a 200 of `text/event-stream`. Any other
|
|
101
|
+
* answer under 400 isn't REST's stream.
|
|
102
|
+
*/
|
|
103
|
+
const eventStreamOf = (response) => {
|
|
104
|
+
if (response.status >= 400) return refusalOf(response);
|
|
105
|
+
const type = response.headers["content-type"] ?? "";
|
|
106
|
+
const media = type.split(";")[0]?.trim().toLowerCase();
|
|
107
|
+
if (response.status === 200 && media === "text/event-stream") return Effect.succeed(bodyStream(response));
|
|
108
|
+
return Effect.fail({
|
|
109
|
+
code: "INTERNAL",
|
|
110
|
+
message: `The remote answered ${response.status} of '${type}', not an event stream`
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
/** A call's input as a GET's query: its page's fields beside its filters, and no `signal`. */
|
|
114
|
+
const queryOf = ({ signal: _signal, page, ...filters }) => ({
|
|
115
|
+
...filters,
|
|
116
|
+
...page
|
|
117
|
+
});
|
|
118
|
+
/** A read's input as a GET's query: its page's and its limits' fields beside its filters. */
|
|
119
|
+
const readQuery = ({ signal: _signal, page, limits, ...filters }) => ({
|
|
120
|
+
...filters,
|
|
121
|
+
...page,
|
|
122
|
+
...limits
|
|
123
|
+
});
|
|
124
|
+
/** A read of one object's input as a GET's query: its ID goes in the path. */
|
|
125
|
+
const objectQuery = ({ signal: _signal, oid: _oid, page, limits, ...filters }) => ({
|
|
126
|
+
...filters,
|
|
127
|
+
...page,
|
|
128
|
+
...limits
|
|
129
|
+
});
|
|
130
|
+
/** A call's input as a JSON body: everything but `signal`. */
|
|
131
|
+
const bodyOf = ({ signal: _signal, ...body }) => body;
|
|
132
|
+
/** An edit as a body sends it: bytes as `contentBytes`, base64, and text as `content`. */
|
|
133
|
+
const wireEdit = ({ content, ...edit }) => {
|
|
134
|
+
if (content === void 0) return edit;
|
|
135
|
+
return content instanceof Uint8Array ? {
|
|
136
|
+
...edit,
|
|
137
|
+
contentBytes: content
|
|
138
|
+
} : {
|
|
139
|
+
...edit,
|
|
140
|
+
content
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
const tokenBody = ({ signal: _signal, expiresAt, ...body }) => ({
|
|
144
|
+
...body,
|
|
145
|
+
expiresAt: expiresAt instanceof Date ? expiresAt.getTime() : expiresAt
|
|
146
|
+
});
|
|
147
|
+
/**
|
|
148
|
+
* A typed client for a Git server's REST: `HttpApiClient` over `GitRestApi`, every call answering
|
|
149
|
+
* `Result` as the server's own does. It sends `credentials` on each request and `signal` cancels
|
|
150
|
+
* one. It carries none of REST's serving code.
|
|
151
|
+
*/
|
|
152
|
+
/** A blob's bytes read whole, up to the most a blob takes: past it `object-too-large`. */
|
|
153
|
+
const heldOf = (bytes, signal) => Effect.runPromise(heldBytes(bytes, "blob").pipe(Effect.match({
|
|
154
|
+
onFailure: (error) => ({
|
|
155
|
+
kind: "error",
|
|
156
|
+
error
|
|
157
|
+
}),
|
|
158
|
+
onSuccess: (value) => ({
|
|
159
|
+
kind: "success",
|
|
160
|
+
value
|
|
161
|
+
})
|
|
162
|
+
})), signal === void 0 ? void 0 : { signal });
|
|
163
|
+
/**
|
|
164
|
+
* A blob's body checked against its `content-length`, `size`: one that ends short of it, or
|
|
165
|
+
* breaks, as a server's does when the bytes it streams fail their ID, errors with `DATA_LOSS`. A
|
|
166
|
+
* break `signal` caused keeps its own error.
|
|
167
|
+
*/
|
|
168
|
+
/**
|
|
169
|
+
* Whether `signal`'s abort ended a read that failed with `cause`: the abort's reason itself, or
|
|
170
|
+
* wrapped as the cause of the HTTP adapter's error.
|
|
171
|
+
*/
|
|
172
|
+
const abortedBy = (signal, cause) => signal?.aborted === true && (cause === signal.reason || Predicate.hasProperty(cause, "cause") && cause.cause === signal.reason);
|
|
173
|
+
const checkedBody = (oid, size, body, signal) => {
|
|
174
|
+
const reader = body.getReader();
|
|
175
|
+
let seen = 0;
|
|
176
|
+
const lost = () => ({
|
|
177
|
+
code: "DATA_LOSS",
|
|
178
|
+
message: `Blob ${oid}'s body ended at ${seen} of its ${size} bytes`
|
|
179
|
+
});
|
|
180
|
+
return new ReadableStream({
|
|
181
|
+
pull: async (controller) => {
|
|
182
|
+
const next = await reader.read().catch((cause) => {
|
|
183
|
+
throw abortedBy(signal, cause) ? signal?.reason : {
|
|
184
|
+
...lost(),
|
|
185
|
+
cause
|
|
186
|
+
};
|
|
187
|
+
});
|
|
188
|
+
if (!next.done) {
|
|
189
|
+
seen += next.value.byteLength;
|
|
190
|
+
return controller.enqueue(next.value);
|
|
191
|
+
}
|
|
192
|
+
if (seen === size) return controller.close();
|
|
193
|
+
controller.error(lost());
|
|
194
|
+
},
|
|
195
|
+
cancel: (reason) => reader.cancel(reason)
|
|
196
|
+
}, { highWaterMark: 0 });
|
|
197
|
+
};
|
|
198
|
+
/**
|
|
199
|
+
* A stream that reads nothing until its first pull, then `open`'s bytes; a refusal errors it.
|
|
200
|
+
* `open` takes a signal that `signal` and a cancel abort, so a cancel stops its call and ends any
|
|
201
|
+
* body it answers, as `run` does for each call's signal.
|
|
202
|
+
*/
|
|
203
|
+
const lazyBytes = (open, signal) => {
|
|
204
|
+
const cancelled = new AbortController();
|
|
205
|
+
const stopped = signal === void 0 ? cancelled.signal : AbortSignal.any([signal, cancelled.signal]);
|
|
206
|
+
let reader;
|
|
207
|
+
return new ReadableStream({
|
|
208
|
+
pull: async (controller) => {
|
|
209
|
+
if (reader === void 0) {
|
|
210
|
+
const opened = await open(stopped);
|
|
211
|
+
if (opened.kind === "error") return controller.error(opened.error);
|
|
212
|
+
reader = opened.value.getReader();
|
|
213
|
+
}
|
|
214
|
+
const next = await reader.read();
|
|
215
|
+
if (next.done) return controller.close();
|
|
216
|
+
controller.enqueue(next.value);
|
|
217
|
+
},
|
|
218
|
+
cancel: async (reason) => {
|
|
219
|
+
cancelled.abort(reason);
|
|
220
|
+
await reader?.cancel(reason);
|
|
221
|
+
}
|
|
222
|
+
}, { highWaterMark: 0 });
|
|
223
|
+
};
|
|
224
|
+
const createRestClient = (options) => {
|
|
225
|
+
const readable = HttpClient.mapRequest((request) => HttpClientRequest.setUrl(request, readableUrl(request.url)));
|
|
226
|
+
const client = Effect.runSync(HttpApiClient.make(GitRestApi, {
|
|
227
|
+
baseUrl: options.url,
|
|
228
|
+
transformClient: readable
|
|
229
|
+
}).pipe(Effect.provide(FetchHttpClient.layer)));
|
|
230
|
+
const http = Effect.runSync(Effect.gen(function* () {
|
|
231
|
+
const base = yield* HttpClient.HttpClient;
|
|
232
|
+
return readable(base).pipe(HttpClient.mapRequest(HttpClientRequest.prependUrl(options.url)));
|
|
233
|
+
}).pipe(Effect.provide(FetchHttpClient.layer)));
|
|
234
|
+
const remote = remoteFetch(options, restFailure);
|
|
235
|
+
/** `fetch` as the typed client calls it: the remote's sends, rejecting with no answer's cause. */
|
|
236
|
+
const remoteThrough = async (input, init) => {
|
|
237
|
+
const runOptions = init?.signal == null ? void 0 : { signal: init.signal };
|
|
238
|
+
const answer = await Effect.runPromise(remote(new Request(input, init)).pipe(Effect.match({
|
|
239
|
+
onFailure: (failed) => ({
|
|
240
|
+
kind: "unanswered",
|
|
241
|
+
cause: failed.kind === "refused" ? failed.error : failed.cause
|
|
242
|
+
}),
|
|
243
|
+
onSuccess: (response) => ({
|
|
244
|
+
kind: "answered",
|
|
245
|
+
response
|
|
246
|
+
})
|
|
247
|
+
})), runOptions);
|
|
248
|
+
if (answer.kind === "unanswered") throw answer.cause;
|
|
249
|
+
if (answer.response.status < 400) return answer.response;
|
|
250
|
+
const { status, error } = await Effect.runPromise(restFailure(answer.response), runOptions);
|
|
251
|
+
return error === void 0 ? new Response(null, { status }) : jsonError(error);
|
|
252
|
+
};
|
|
253
|
+
/**
|
|
254
|
+
* Runs one call, noting once its request is sent, so its input's failure is told apart. Each
|
|
255
|
+
* answer's body ends when `signal` aborts, wherever the call has it then.
|
|
256
|
+
*/
|
|
257
|
+
const run = (call, signal) => {
|
|
258
|
+
let sent = false;
|
|
259
|
+
const noted = async (input, init) => {
|
|
260
|
+
sent = true;
|
|
261
|
+
const response = await remoteThrough(input, init);
|
|
262
|
+
return signal === void 0 ? response : abortable(response, signal);
|
|
263
|
+
};
|
|
264
|
+
const effect = call(client).pipe(Effect.provideService(FetchHttpClient.Fetch, noted));
|
|
265
|
+
const runOptions = signal === void 0 ? void 0 : { signal };
|
|
266
|
+
return Effect.runPromiseExit(effect, runOptions).then((exit) => resultOf(exit, signal, sent));
|
|
267
|
+
};
|
|
268
|
+
const blobOf = (repo, input) => run((api) => api.blobs.get({
|
|
269
|
+
params: {
|
|
270
|
+
repo,
|
|
271
|
+
oid: input.oid
|
|
272
|
+
},
|
|
273
|
+
query: objectQuery(input)
|
|
274
|
+
}).pipe(Effect.map(({ body, headers }) => {
|
|
275
|
+
const size = headers["content-length"];
|
|
276
|
+
const bytes = checkedBody(input.oid, size, Stream.toReadableStream(body), input.signal);
|
|
277
|
+
return {
|
|
278
|
+
oid: input.oid,
|
|
279
|
+
size,
|
|
280
|
+
bytes
|
|
281
|
+
};
|
|
282
|
+
})), input.signal);
|
|
283
|
+
/** `GET <r>/events` after `after`, its `seq` sent as `Last-Event-ID`. */
|
|
284
|
+
const connect = (repo, after, signal) => {
|
|
285
|
+
const request = HttpClientRequest.get(`/repos/${encodeURIComponent(repo)}/-/events`).pipe(HttpClientRequest.setHeader("accept", "text/event-stream"), (each) => after === void 0 ? each : HttpClientRequest.setHeader(each, "last-event-id", String(after)));
|
|
286
|
+
return run(() => http.execute(request).pipe(Effect.flatMap(eventStreamOf)), signal);
|
|
287
|
+
};
|
|
288
|
+
return {
|
|
289
|
+
repos: {
|
|
290
|
+
list: (input) => run((api) => api.repos.list({ query: queryOf(input) }), input.signal),
|
|
291
|
+
create: (input) => run((api) => api.repos.create({ payload: bodyOf(input) }), input.signal),
|
|
292
|
+
get: (repo, input) => run((api) => api.repos.get({ params: { repo } }), input.signal),
|
|
293
|
+
update: (repo, input) => run((api) => api.repos.update({
|
|
294
|
+
params: { repo },
|
|
295
|
+
payload: bodyOf(input)
|
|
296
|
+
}), input.signal),
|
|
297
|
+
rename: (repo, input) => run((api) => api.repos.rename({
|
|
298
|
+
params: { repo },
|
|
299
|
+
payload: bodyOf(input)
|
|
300
|
+
}), input.signal),
|
|
301
|
+
delete: (repo, input) => run((api) => api.repos.delete({
|
|
302
|
+
params: { repo },
|
|
303
|
+
query: bodyOf(input)
|
|
304
|
+
}), input.signal)
|
|
305
|
+
},
|
|
306
|
+
forks: {
|
|
307
|
+
create: (repo, input) => run((api) => api.forks.create({
|
|
308
|
+
params: { repo },
|
|
309
|
+
payload: bodyOf(input)
|
|
310
|
+
}), input.signal),
|
|
311
|
+
get: (repo, input) => run((api) => api.forks.get({ params: {
|
|
312
|
+
repo,
|
|
313
|
+
holder: input.holder
|
|
314
|
+
} }), input.signal),
|
|
315
|
+
list: (repo, input) => run((api) => api.forks.list({
|
|
316
|
+
params: { repo },
|
|
317
|
+
query: queryOf(input)
|
|
318
|
+
}), input.signal),
|
|
319
|
+
sync: (repo, input) => run((api) => api.forks.sync({
|
|
320
|
+
params: { repo },
|
|
321
|
+
payload: bodyOf(input)
|
|
322
|
+
}), input.signal),
|
|
323
|
+
fetch: (repo, input) => run((api) => api.forks.fetch({ params: { repo } }), input.signal)
|
|
324
|
+
},
|
|
325
|
+
refs: {
|
|
326
|
+
get: (repo, input) => run((api) => api.refs.get({ params: {
|
|
327
|
+
repo,
|
|
328
|
+
ref: input.ref
|
|
329
|
+
} }), input.signal),
|
|
330
|
+
protection: async (repo, input) => {
|
|
331
|
+
const params = {
|
|
332
|
+
repo,
|
|
333
|
+
ref: input.ref
|
|
334
|
+
};
|
|
335
|
+
const answer = await run((api) => api.refs.protection({ params }), input.signal);
|
|
336
|
+
if (answer.kind !== "success") return answer;
|
|
337
|
+
return {
|
|
338
|
+
kind: "success",
|
|
339
|
+
value: answer.value ?? void 0
|
|
340
|
+
};
|
|
341
|
+
},
|
|
342
|
+
sees: (repo, input) => run((api) => api.refs.sees({
|
|
343
|
+
params: { repo },
|
|
344
|
+
payload: { refs: input.refs }
|
|
345
|
+
}), input.signal),
|
|
346
|
+
list: (repo, input) => run((api) => api.refs.list({
|
|
347
|
+
params: { repo },
|
|
348
|
+
query: queryOf(input)
|
|
349
|
+
}), input.signal),
|
|
350
|
+
count: (repo, input) => run((api) => api.refs.count({
|
|
351
|
+
params: { repo },
|
|
352
|
+
query: queryOf(input)
|
|
353
|
+
}), input.signal),
|
|
354
|
+
update: (repo, input) => run((api) => api.refs.update({
|
|
355
|
+
params: { repo },
|
|
356
|
+
payload: bodyOf(input)
|
|
357
|
+
}), input.signal)
|
|
358
|
+
},
|
|
359
|
+
work: {
|
|
360
|
+
list: (repo, input) => run((api) => api.work.list({
|
|
361
|
+
params: { repo },
|
|
362
|
+
query: queryOf(input)
|
|
363
|
+
}), input.signal),
|
|
364
|
+
retry: (repo, input) => run((api) => api.work.retry({
|
|
365
|
+
params: { repo },
|
|
366
|
+
payload: bodyOf(input)
|
|
367
|
+
}), input.signal),
|
|
368
|
+
discard: (repo, input) => run((api) => api.work.discard({
|
|
369
|
+
params: { repo },
|
|
370
|
+
payload: bodyOf(input)
|
|
371
|
+
}), input.signal)
|
|
372
|
+
},
|
|
373
|
+
tokens: {
|
|
374
|
+
create: (target, input) => run((api) => Predicate.isString(target) ? api.tokens.createRepo({
|
|
375
|
+
params: { repo: target },
|
|
376
|
+
payload: tokenBody(input)
|
|
377
|
+
}) : api.tokens.createPrefix({
|
|
378
|
+
query: target,
|
|
379
|
+
payload: tokenBody(input)
|
|
380
|
+
}), input.signal),
|
|
381
|
+
list: (target, input = {}) => run((api) => Predicate.isString(target) ? api.tokens.listRepo({
|
|
382
|
+
params: { repo: target },
|
|
383
|
+
query: queryOf(input)
|
|
384
|
+
}) : api.tokens.listPrefix({ query: {
|
|
385
|
+
...target,
|
|
386
|
+
...queryOf(input)
|
|
387
|
+
} }), input.signal),
|
|
388
|
+
get: (token, input = {}) => run((api) => api.tokens.get({ params: { id: token } }), input.signal),
|
|
389
|
+
revoke: (token, input = {}) => run((api) => api.tokens.revoke({
|
|
390
|
+
params: { id: token },
|
|
391
|
+
query: bodyOf(input)
|
|
392
|
+
}), input.signal)
|
|
393
|
+
},
|
|
394
|
+
blobs: {
|
|
395
|
+
get: blobOf,
|
|
396
|
+
create: async (repo, { bytes, signal, ...query }) => {
|
|
397
|
+
const held = await heldOf(bytes, signal);
|
|
398
|
+
if (held.kind === "error") return held;
|
|
399
|
+
return run((api) => api.blobs.create({
|
|
400
|
+
params: { repo },
|
|
401
|
+
query,
|
|
402
|
+
payload: Stream.succeed(held.value)
|
|
403
|
+
}), signal);
|
|
404
|
+
}
|
|
405
|
+
},
|
|
406
|
+
trees: {
|
|
407
|
+
get: (repo, input) => run((api) => api.trees.get({
|
|
408
|
+
params: {
|
|
409
|
+
repo,
|
|
410
|
+
oid: input.oid
|
|
411
|
+
},
|
|
412
|
+
query: objectQuery(input)
|
|
413
|
+
}), input.signal),
|
|
414
|
+
diff: (repo, input) => run((api) => api.trees.diff({
|
|
415
|
+
params: { repo },
|
|
416
|
+
payload: bodyOf(input)
|
|
417
|
+
}), input.signal),
|
|
418
|
+
create: (repo, { changes, ...input }) => run((api) => api.trees.create({
|
|
419
|
+
params: { repo },
|
|
420
|
+
payload: {
|
|
421
|
+
...bodyOf(input),
|
|
422
|
+
changes: changes.map(wireEdit)
|
|
423
|
+
}
|
|
424
|
+
}), input.signal),
|
|
425
|
+
merge: (repo, input) => run((api) => api.trees.merge({
|
|
426
|
+
params: { repo },
|
|
427
|
+
payload: bodyOf(input)
|
|
428
|
+
}), input.signal)
|
|
429
|
+
},
|
|
430
|
+
commits: {
|
|
431
|
+
get: (repo, input) => run((api) => api.commits.get({
|
|
432
|
+
params: {
|
|
433
|
+
repo,
|
|
434
|
+
oid: input.oid
|
|
435
|
+
},
|
|
436
|
+
query: objectQuery(input)
|
|
437
|
+
}), input.signal),
|
|
438
|
+
list: (repo, input) => run((api) => api.commits.list({
|
|
439
|
+
params: { repo },
|
|
440
|
+
query: readQuery(input)
|
|
441
|
+
}), input.signal),
|
|
442
|
+
mergeBase: (repo, input) => run((api) => api.commits.mergeBase({
|
|
443
|
+
params: { repo },
|
|
444
|
+
payload: bodyOf(input)
|
|
445
|
+
}), input.signal),
|
|
446
|
+
diff: (repo, input) => run((api) => api.commits.diff({
|
|
447
|
+
params: { repo },
|
|
448
|
+
payload: bodyOf(input)
|
|
449
|
+
}), input.signal),
|
|
450
|
+
compare: (repo, input) => run((api) => api.commits.compare({
|
|
451
|
+
params: { repo },
|
|
452
|
+
payload: bodyOf(input)
|
|
453
|
+
}), input.signal),
|
|
454
|
+
create: (repo, { changes, ...input }) => run((api) => api.commits.create({
|
|
455
|
+
params: { repo },
|
|
456
|
+
payload: changes === void 0 ? bodyOf(input) : {
|
|
457
|
+
...bodyOf(input),
|
|
458
|
+
changes: changes.map(wireEdit)
|
|
459
|
+
}
|
|
460
|
+
}), input.signal),
|
|
461
|
+
revert: (repo, input) => run((api) => api.commits.revert({
|
|
462
|
+
params: { repo },
|
|
463
|
+
payload: bodyOf(input)
|
|
464
|
+
}), input.signal),
|
|
465
|
+
pick: (repo, input) => run((api) => api.commits.pick({
|
|
466
|
+
params: { repo },
|
|
467
|
+
payload: bodyOf(input)
|
|
468
|
+
}), input.signal)
|
|
469
|
+
},
|
|
470
|
+
tags: {
|
|
471
|
+
get: (repo, input) => run((api) => api.tags.get({
|
|
472
|
+
params: {
|
|
473
|
+
repo,
|
|
474
|
+
oid: input.oid
|
|
475
|
+
},
|
|
476
|
+
query: objectQuery(input)
|
|
477
|
+
}), input.signal),
|
|
478
|
+
peel: (repo, input) => run((api) => api.tags.peel({
|
|
479
|
+
params: { repo },
|
|
480
|
+
payload: bodyOf(input)
|
|
481
|
+
}), input.signal),
|
|
482
|
+
create: (repo, input) => run((api) => api.tags.create({
|
|
483
|
+
params: { repo },
|
|
484
|
+
payload: bodyOf(input)
|
|
485
|
+
}), input.signal)
|
|
486
|
+
},
|
|
487
|
+
merges: { create: (repo, input) => run((api) => api.merges.create({
|
|
488
|
+
params: { repo },
|
|
489
|
+
payload: bodyOf(input)
|
|
490
|
+
}), input.signal) },
|
|
491
|
+
files: {
|
|
492
|
+
list: (repo, input) => run((api) => api.files.list({
|
|
493
|
+
params: { repo },
|
|
494
|
+
query: readQuery(input)
|
|
495
|
+
}), input.signal),
|
|
496
|
+
read: (repo, input) => run((api) => api.files.read({
|
|
497
|
+
params: { repo },
|
|
498
|
+
payload: bodyOf(input)
|
|
499
|
+
}).pipe(Effect.map((read) => ({
|
|
500
|
+
...read,
|
|
501
|
+
files: {
|
|
502
|
+
...read.files,
|
|
503
|
+
items: read.files.items.map(({ content, ...file }) => ({
|
|
504
|
+
...file,
|
|
505
|
+
bytes: content === void 0 ? lazyBytes(async (signal) => {
|
|
506
|
+
const blob = await blobOf(repo, {
|
|
507
|
+
oid: file.oid,
|
|
508
|
+
signal
|
|
509
|
+
});
|
|
510
|
+
return blob.kind === "error" ? blob : {
|
|
511
|
+
...blob,
|
|
512
|
+
value: blob.value.bytes
|
|
513
|
+
};
|
|
514
|
+
}, input.signal) : streamOf(content)
|
|
515
|
+
}))
|
|
516
|
+
}
|
|
517
|
+
}))), input.signal),
|
|
518
|
+
diff: (repo, input) => run((api) => api.files.diff({
|
|
519
|
+
params: { repo },
|
|
520
|
+
payload: bodyOf(input)
|
|
521
|
+
}), input.signal)
|
|
522
|
+
},
|
|
523
|
+
queue: {
|
|
524
|
+
add: (repo, input) => run((api) => api.queue.add({
|
|
525
|
+
params: { repo },
|
|
526
|
+
payload: bodyOf(input)
|
|
527
|
+
}), input.signal),
|
|
528
|
+
list: (repo, input) => run((api) => api.queue.list({
|
|
529
|
+
params: { repo },
|
|
530
|
+
query: queryOf(input)
|
|
531
|
+
}), input.signal),
|
|
532
|
+
get: (entry, input) => run((api) => api.queue.get({ params: { entry } }), input.signal),
|
|
533
|
+
candidates: (repo, input) => run((api) => api.queue.candidates({
|
|
534
|
+
params: { repo },
|
|
535
|
+
query: queryOf(input)
|
|
536
|
+
}), input.signal),
|
|
537
|
+
candidate: (candidate, input) => run((api) => api.queue.candidate({ params: { candidate } }), input.signal),
|
|
538
|
+
remove: (entry, input) => run((api) => api.queue.remove({
|
|
539
|
+
params: { entry },
|
|
540
|
+
query: bodyOf(input)
|
|
541
|
+
}), input.signal),
|
|
542
|
+
hold: (id, input) => run((api) => "target" in input ? api.queue.holdTarget({
|
|
543
|
+
params: { repo: id },
|
|
544
|
+
payload: bodyOf(input)
|
|
545
|
+
}) : api.queue.holdEntry({
|
|
546
|
+
params: { entry: id },
|
|
547
|
+
payload: bodyOf(input)
|
|
548
|
+
}), input.signal),
|
|
549
|
+
holds: (id, input) => run((api) => queueIdParts("e", id) !== void 0 ? api.queue.holdsOfEntry({
|
|
550
|
+
params: { entry: id },
|
|
551
|
+
query: queryOf(input)
|
|
552
|
+
}) : api.queue.holdsOfTarget({
|
|
553
|
+
params: { repo: id },
|
|
554
|
+
query: queryOf(input)
|
|
555
|
+
}), input.signal),
|
|
556
|
+
release: (hold, input) => run((api) => api.queue.release({
|
|
557
|
+
params: { hold },
|
|
558
|
+
query: bodyOf(input)
|
|
559
|
+
}), input.signal),
|
|
560
|
+
report: (candidate, input) => run((api) => api.queue.report({
|
|
561
|
+
params: { candidate },
|
|
562
|
+
payload: bodyOf(input)
|
|
563
|
+
}), input.signal),
|
|
564
|
+
retry: (candidate, input) => run((api) => api.queue.retry({
|
|
565
|
+
params: { candidate },
|
|
566
|
+
payload: bodyOf(input)
|
|
567
|
+
}), input.signal),
|
|
568
|
+
restart: (repo, input) => run((api) => api.queue.restart({
|
|
569
|
+
params: { repo },
|
|
570
|
+
payload: bodyOf(input)
|
|
571
|
+
}), input.signal)
|
|
572
|
+
},
|
|
573
|
+
topics: {
|
|
574
|
+
add: (input) => run((api) => api.topics.add({ payload: bodyOf(input) }), input.signal),
|
|
575
|
+
list: (input) => run((api) => api.topics.list({ query: queryOf(input) }), input.signal),
|
|
576
|
+
get: (topic, input) => run((api) => api.topics.get({ params: { topic } }), input.signal),
|
|
577
|
+
remove: (topic, input) => run((api) => api.topics.remove({ params: { topic } }), input.signal),
|
|
578
|
+
report: (topic, input) => run((api) => api.topics.report({
|
|
579
|
+
params: { topic },
|
|
580
|
+
payload: bodyOf(input)
|
|
581
|
+
}), input.signal)
|
|
582
|
+
},
|
|
583
|
+
events: { listen: (repo, input) => listenOver((after, signal) => connect(repo, after, signal), input) },
|
|
584
|
+
me: (input = {}) => run((api) => api.me.get(), input.signal)
|
|
585
|
+
};
|
|
586
|
+
};
|
|
587
|
+
export { createRestClient };
|