@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,221 @@
|
|
|
1
|
+
import { gitsOwnMove, hiddenRefs } from "../protocol/wire/lines.mjs";
|
|
2
|
+
import { resultCall } from "../store/errors.mjs";
|
|
3
|
+
import { upstreamOf } from "../store/catalogue.mjs";
|
|
4
|
+
import { collections } from "../store/scopes.mjs";
|
|
5
|
+
import { answerTo, effectObjects, scopedReader } from "../storage/calls.mjs";
|
|
6
|
+
import { handedScope, inCallScope } from "../store/call-count.mjs";
|
|
7
|
+
import { resultIn } from "../store/crossing.mjs";
|
|
8
|
+
import { withPushed } from "../storage/visible.mjs";
|
|
9
|
+
import { WholeRepo, wholeRefs } from "../store/ref-rows.mjs";
|
|
10
|
+
import { openRepo } from "./access.mjs";
|
|
11
|
+
import { ownWriter, ownWritesOf } from "./own-writes.mjs";
|
|
12
|
+
import { seenIn, sightIn } from "./sight.mjs";
|
|
13
|
+
import * as Effect from "effect/Effect";
|
|
14
|
+
// src/core/view.ts
|
|
15
|
+
/** `first`'s answer, and of the IDs it left, `then`'s: asked only when `first` left one. */
|
|
16
|
+
const orElse = (first, then) => async (oids, input) => {
|
|
17
|
+
const held = await first(oids, input);
|
|
18
|
+
if (held.kind === "error") return held;
|
|
19
|
+
const left = oids.filter((oid) => !held.value.has(oid));
|
|
20
|
+
if (left.length === 0) return held;
|
|
21
|
+
const more = await then(left, input);
|
|
22
|
+
if (more.kind === "error") return more;
|
|
23
|
+
return {
|
|
24
|
+
kind: "success",
|
|
25
|
+
value: /* @__PURE__ */ new Set([...held.value, ...more.value])
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* The server's objects, sealed: a call reaches them only through a `RepoView` core built for its
|
|
30
|
+
* caller, or with `WholeRepo`. So a group of calls that reads an object without its caller's view
|
|
31
|
+
* doesn't type-check: `Core` holds these, never `GitObjects`.
|
|
32
|
+
*/
|
|
33
|
+
var SealedObjects = class SealedObjects {
|
|
34
|
+
#objects;
|
|
35
|
+
#indexed;
|
|
36
|
+
/** `objects`, and with `access`, the same objects as they keep their index. */
|
|
37
|
+
constructor(objects, indexed) {
|
|
38
|
+
this.#objects = objects;
|
|
39
|
+
this.#indexed = indexed;
|
|
40
|
+
}
|
|
41
|
+
/** `objects` sealed with their index: the objects a server with `access` hides by. */
|
|
42
|
+
static indexed(objects) {
|
|
43
|
+
return new SealedObjects(objects, objects);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* `sealed`, telling `seen` each receive's result, as HTTP's push watches for an unpack error:
|
|
47
|
+
* a caller's narrowed objects' receives too. `seen` gets the result alone, never the objects,
|
|
48
|
+
* so it's no way past a view.
|
|
49
|
+
*/
|
|
50
|
+
static onReceive(sealed, seen) {
|
|
51
|
+
const watch = (objects) => ({
|
|
52
|
+
...objects,
|
|
53
|
+
receive: async (listed, receive) => {
|
|
54
|
+
const result = await objects.receive(listed, receive);
|
|
55
|
+
seen(result);
|
|
56
|
+
return result;
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
const indexed = sealed.#indexed;
|
|
60
|
+
if (indexed === void 0) return new SealedObjects(watch(sealed.#objects));
|
|
61
|
+
const watched = watch(indexed);
|
|
62
|
+
return SealedObjects.indexed({
|
|
63
|
+
...watched,
|
|
64
|
+
seen: (set) => watch(indexed.seen(set))
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
/** Every object of every repo, for one of the readers `WholeRepo` names. */
|
|
68
|
+
static whole(sealed, _whole) {
|
|
69
|
+
return sealed.#objects;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* The objects one caller's `set` holds, for the view `WholeRepo` names: `undefined` for objects
|
|
73
|
+
* sealed with no index, which a server with `access` never has.
|
|
74
|
+
*/
|
|
75
|
+
static seen(sealed, _whole, at, tips, pushed) {
|
|
76
|
+
const indexed = sealed.#indexed;
|
|
77
|
+
if (indexed === void 0) return void 0;
|
|
78
|
+
const set = indexed.visible(at, tips);
|
|
79
|
+
const own = pushed?.change.add ?? [];
|
|
80
|
+
return indexed.seen(own.length === 0 ? set : withPushed(set, indexed, {
|
|
81
|
+
...at,
|
|
82
|
+
packs: [...own]
|
|
83
|
+
}));
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* `seen`'s objects, where an ID its tips don't reach is asked of `missed` too, which answers the
|
|
87
|
+
* ones it reaches: the caller's own writes (Q773), and a fork's read of what its parent's tips
|
|
88
|
+
* reach (Q772).
|
|
89
|
+
*/
|
|
90
|
+
static falling(sealed, at, tips, missed, pushed) {
|
|
91
|
+
const indexed = sealed.#indexed;
|
|
92
|
+
if (indexed === void 0) return void 0;
|
|
93
|
+
const set = indexed.visible(at, tips);
|
|
94
|
+
const own = pushed?.change.add ?? [];
|
|
95
|
+
const first = own.length === 0 ? set : withPushed(set, indexed, {
|
|
96
|
+
...at,
|
|
97
|
+
packs: [...own]
|
|
98
|
+
});
|
|
99
|
+
return indexed.seen({ has: orElse((oids, input) => first.has(oids, input), missed) });
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Whether a caller who sees every ref of `resolved` still reads its objects only through its
|
|
104
|
+
* refs' reach: for every fork on a server with `access`. A fork lists its source's packs, which
|
|
105
|
+
* hold every commit of the source, a private one's too, so a fork's reader, its owner as well,
|
|
106
|
+
* reads by ID only what the fork's own tips reach (piece 3, choice 7).
|
|
107
|
+
*/
|
|
108
|
+
const objectsFollowRefs = (core, resolved) => core.access !== void 0 && resolved.record.fork !== void 0;
|
|
109
|
+
/** The view's own leave: a view reads its repo's refs whole, then leaves out what's hidden. */
|
|
110
|
+
const viewWhole = WholeRepo.mint();
|
|
111
|
+
/**
|
|
112
|
+
* `sight`, with the refs under a prefix `owner` owns seen too: the merge queue's publish, which
|
|
113
|
+
* runs as the entry's caller, deletes its candidate and moves its target to the candidate's commit.
|
|
114
|
+
*/
|
|
115
|
+
const ownersSight = (sight, owner) => {
|
|
116
|
+
if (sight.whole) return sight;
|
|
117
|
+
const owns = (ref) => gitsOwnMove(owner, ref);
|
|
118
|
+
return {
|
|
119
|
+
...sight,
|
|
120
|
+
sees: (ref) => owns(ref) || sight.sees(ref),
|
|
121
|
+
creates: (ref) => owns(ref) || sight.creates(ref)
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
* `resolved`, opened for `caller`, as the caller sees it: for a push from `source`, the merge
|
|
126
|
+
* queue or an import, with Git's own refs that source moves seen as well.
|
|
127
|
+
*/
|
|
128
|
+
const viewOf = (core, caller, resolved, source, options = {}) => {
|
|
129
|
+
const asked = sightIn(core, caller, {
|
|
130
|
+
id: resolved.name,
|
|
131
|
+
public: resolved.record.public,
|
|
132
|
+
internalId: resolved.internalId
|
|
133
|
+
});
|
|
134
|
+
const owner = hiddenRefs.find((hidden) => hidden.owner === source)?.owner;
|
|
135
|
+
const sight = owner === void 0 ? asked : Effect.map(asked, (seen) => ownersSight(seen, owner));
|
|
136
|
+
const whole = SealedObjects.whole(core.objects, viewWhole);
|
|
137
|
+
const followsRefs = objectsFollowRefs(core, resolved);
|
|
138
|
+
const narrowed = Effect.map(sight, (seen) => !seen.whole || followsRefs);
|
|
139
|
+
return {
|
|
140
|
+
resolved,
|
|
141
|
+
sight,
|
|
142
|
+
narrowed,
|
|
143
|
+
refs: (rows) => Effect.gen(function* () {
|
|
144
|
+
const all = yield* wholeRefs(viewWhole, rows);
|
|
145
|
+
const seen = yield* sight;
|
|
146
|
+
if (seen.whole) return all;
|
|
147
|
+
return new Map([...all].filter(([name]) => seen.sees(name)));
|
|
148
|
+
}),
|
|
149
|
+
objectsAt: (at) => Effect.gen(function* () {
|
|
150
|
+
if (!(yield* narrowed)) return whole;
|
|
151
|
+
const tips = {
|
|
152
|
+
tips: [...new Set(at.refs.values())],
|
|
153
|
+
row: at.index
|
|
154
|
+
};
|
|
155
|
+
const read = at.pushed === void 0 ? `${at.listed.version}` : `${at.listed.version}+${at.pushed.id}`;
|
|
156
|
+
const reach = options.ownWrites === false ? `${read}:refs` : read;
|
|
157
|
+
const key = owner === void 0 ? reach : `${reach}:${owner}`;
|
|
158
|
+
const from = (asked) => () => SealedObjects.seen(core.objects, viewWhole, at.listed, asked, at.pushed);
|
|
159
|
+
const writer = options.ownWrites === false ? void 0 : yield* ownWriter(caller);
|
|
160
|
+
const own = writer === void 0 ? void 0 : (oids, input) => answerTo(Effect.gen(function* () {
|
|
161
|
+
const now = yield* core.now;
|
|
162
|
+
return yield* ownWritesOf(core.store, resolved.internalId, writer, oids, now);
|
|
163
|
+
}), input);
|
|
164
|
+
const falling = (missed) => () => SealedObjects.falling(core.objects, at.listed, tips, missed, at.pushed);
|
|
165
|
+
if (!followsRefs) {
|
|
166
|
+
const read = own === void 0 ? from(tips) : falling(own);
|
|
167
|
+
return yield* seenIn(caller, resolved.internalId, key, tips.tips, read);
|
|
168
|
+
}
|
|
169
|
+
const context = yield* Effect.context();
|
|
170
|
+
const union = yield* Effect.cached(Effect.gen(function* () {
|
|
171
|
+
const above = yield* parentTips(core, caller, resolved);
|
|
172
|
+
const both = [.../* @__PURE__ */ new Set([...tips.tips, ...above])];
|
|
173
|
+
if (both.length === tips.tips.length) return void 0;
|
|
174
|
+
const asked = {
|
|
175
|
+
tips: both,
|
|
176
|
+
row: at.index
|
|
177
|
+
};
|
|
178
|
+
const objects = yield* seenIn(caller, resolved.internalId, key, both, from(asked));
|
|
179
|
+
return effectObjects(objects);
|
|
180
|
+
}));
|
|
181
|
+
const parent = (oids, input) => resultIn(Effect.provideContext(inCallScope(Effect.scoped(Effect.gen(function* () {
|
|
182
|
+
const objects = yield* union;
|
|
183
|
+
if (objects === void 0) return /* @__PURE__ */ new Set();
|
|
184
|
+
const reader = yield* scopedReader(objects, at.listed);
|
|
185
|
+
return yield* resultCall(() => reader.held({
|
|
186
|
+
...input,
|
|
187
|
+
oids
|
|
188
|
+
}));
|
|
189
|
+
})), handedScope(input)), context), handedScope(input), input?.signal);
|
|
190
|
+
return yield* seenIn(caller, resolved.internalId, key, tips.tips, falling(own === void 0 ? parent : orElse(own, parent)));
|
|
191
|
+
})
|
|
192
|
+
};
|
|
193
|
+
};
|
|
194
|
+
/** The repo `operation` names, opened as `openRepo` opens it, as `caller` sees it. */
|
|
195
|
+
const openView = (core, caller, operation, reads = [], internalId) => Effect.map(openRepo(core, caller, operation, reads, internalId), (resolved) => viewOf(core, caller, resolved));
|
|
196
|
+
/** How a caller who may not read a fork's parent is refused: its fallback then reaches nothing. */
|
|
197
|
+
const unread = /* @__PURE__ */ new Set([
|
|
198
|
+
"NOT_FOUND",
|
|
199
|
+
"PERMISSION_DENIED",
|
|
200
|
+
"UNAUTHENTICATED"
|
|
201
|
+
]);
|
|
202
|
+
/**
|
|
203
|
+
* The tips of the refs `caller` sees in fork `resolved`'s direct parent, through the parent's own
|
|
204
|
+
* view, so its access and its hidden refs apply: none where it may not read the parent, or the
|
|
205
|
+
* parent is gone. Only the parent, never a repo it's a fork of (Q772).
|
|
206
|
+
*/
|
|
207
|
+
const parentTips = Effect.fnUntraced(function* (core, caller, resolved) {
|
|
208
|
+
const upstream = resolved.record.fork?.upstreamInternalId;
|
|
209
|
+
if (upstream === void 0) return [];
|
|
210
|
+
const name = yield* upstreamOf(core.store, resolved.record);
|
|
211
|
+
if (name === void 0) return [];
|
|
212
|
+
const reads = [{ collection: collections.refs }];
|
|
213
|
+
const opened = yield* openView(core, caller, {
|
|
214
|
+
kind: "read",
|
|
215
|
+
repo: name
|
|
216
|
+
}, reads, upstream).pipe(Effect.catchIf((error) => unread.has(error.code), () => Effect.succeed(void 0)));
|
|
217
|
+
if (opened === void 0) return [];
|
|
218
|
+
const [, rows = []] = opened.resolved.snapshot.results;
|
|
219
|
+
return [...(yield* opened.refs(rows)).values()];
|
|
220
|
+
});
|
|
221
|
+
export { SealedObjects, objectsFollowRefs, openView, viewOf };
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { storeCall } from "../store/errors.mjs";
|
|
2
|
+
import { keptKey } from "../store/records.mjs";
|
|
3
|
+
import { newChangeId, repoScope } from "../store/scopes.mjs";
|
|
4
|
+
import { callerFor, contended, openRepo } from "./access.mjs";
|
|
5
|
+
import { isDeliverJob, skipFailed } from "./events/deliver.mjs";
|
|
6
|
+
import { heldReceipt, receiptReads, receiptWrites } from "./receipts.mjs";
|
|
7
|
+
import * as Effect from "effect/Effect";
|
|
8
|
+
// src/core/work.ts
|
|
9
|
+
/** Commits a work write's receipt, and `git.repack` due to sweep it, at the scope's `expect`. */
|
|
10
|
+
const commitReceipt = (core, internalId, write) => storeCall(() => {
|
|
11
|
+
const receipt = receiptWrites(write.kept, write.answer, core.repackJobRow);
|
|
12
|
+
const change = {
|
|
13
|
+
id: newChangeId(),
|
|
14
|
+
expect: write.expect
|
|
15
|
+
};
|
|
16
|
+
return core.store.commit(repoScope(internalId), {
|
|
17
|
+
...change,
|
|
18
|
+
put: [...receipt.put],
|
|
19
|
+
jobs: [...receipt.jobs]
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
/**
|
|
23
|
+
* Marks a work write's receipt answered once the queue took the write, so the write sent again
|
|
24
|
+
* answers as it did. The queue's calls join no commit, so a write stopped before this answers as
|
|
25
|
+
* the queue does when it's sent again (Q150).
|
|
26
|
+
*/
|
|
27
|
+
const keepAnswer = Effect.fnUntraced(function* (core, internalId, kept) {
|
|
28
|
+
for (let attempt = 0; attempt < 5; attempt += 1) {
|
|
29
|
+
const scope = repoScope(internalId);
|
|
30
|
+
const write = {
|
|
31
|
+
expect: (yield* storeCall(() => core.store.read(scope, []))).version,
|
|
32
|
+
kept,
|
|
33
|
+
answer: { kind: "done" }
|
|
34
|
+
};
|
|
35
|
+
if ((yield* commitReceipt(core, internalId, write)).ok) return;
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
/** `work`: a repo's jobs, over the queue's own calls, once `authorize` lets the caller. */
|
|
39
|
+
const workCalls = (core, bound) => {
|
|
40
|
+
const callerOf = callerFor(bound);
|
|
41
|
+
const write = (kind) => Effect.fnUntraced(function* (repo, input) {
|
|
42
|
+
const job = {
|
|
43
|
+
name: input.name,
|
|
44
|
+
key: input.key
|
|
45
|
+
};
|
|
46
|
+
const operation = {
|
|
47
|
+
kind,
|
|
48
|
+
repo,
|
|
49
|
+
...job
|
|
50
|
+
};
|
|
51
|
+
const caller = callerOf(input);
|
|
52
|
+
const kept = yield* keptKey(caller, input.requestKey, [
|
|
53
|
+
kind,
|
|
54
|
+
job.name,
|
|
55
|
+
job.key
|
|
56
|
+
], yield* core.now);
|
|
57
|
+
for (let attempt = 0; attempt < 5; attempt += 1) {
|
|
58
|
+
const { internalId, snapshot } = yield* openRepo(core, caller, operation, receiptReads(kept), input.internalId);
|
|
59
|
+
const held = yield* heldReceipt(snapshot.results.slice(1), kept);
|
|
60
|
+
if (held !== void 0 && held.pending !== true) return;
|
|
61
|
+
if (kept !== void 0 && held === void 0) {
|
|
62
|
+
const write = {
|
|
63
|
+
expect: snapshot.version,
|
|
64
|
+
kept,
|
|
65
|
+
answer: "pending"
|
|
66
|
+
};
|
|
67
|
+
if (!(yield* commitReceipt(core, internalId, write)).ok) continue;
|
|
68
|
+
}
|
|
69
|
+
const scope = repoScope(internalId);
|
|
70
|
+
if (kind === "work.discard" && isDeliverJob(job)) yield* skipFailed(core.store, core.jobs, scope);
|
|
71
|
+
else yield* storeCall(() => kind === "work.retry" ? core.jobs.retry(scope, job) : core.jobs.discard(scope, job));
|
|
72
|
+
if (kept !== void 0) yield* keepAnswer(core, internalId, kept);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
return yield* contended();
|
|
76
|
+
});
|
|
77
|
+
return {
|
|
78
|
+
list: Effect.fnUntraced(function* (repo, input) {
|
|
79
|
+
const { internalId } = yield* openRepo(core, callerOf(input), {
|
|
80
|
+
kind: "work.list",
|
|
81
|
+
repo
|
|
82
|
+
}, [], input.internalId);
|
|
83
|
+
const request = {};
|
|
84
|
+
if (input.state !== void 0) request.state = input.state;
|
|
85
|
+
if (input.page !== void 0) request.page = input.page;
|
|
86
|
+
return yield* storeCall(() => core.jobs.list(repoScope(internalId), request));
|
|
87
|
+
}),
|
|
88
|
+
retry: write("work.retry"),
|
|
89
|
+
discard: write("work.discard")
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
export { workCalls };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { EffectCalls, EffectGitAuth, EffectGitAuthorize, EffectGitEvents, GitAuth, GitAuthorize, GitCaller, GitClient, GitEngine, GitEvents, GitObjects, GitServices, GitStore } from "./contracts/services.mjs";
|
|
2
|
+
import { IndexCalls, IndexReachInput, IndexReached, IndexStatus, IndexTip, IndexTry, IndexTryInput } from "./contracts/objects.mjs";
|
|
3
|
+
import { effectGitClient } from "./client/client.mjs";
|
|
4
|
+
import { CallAllowance, CallBudget } from "./store/call-count.mjs";
|
|
5
|
+
import { spentRefusalOf } from "./contracts/calls-spent.mjs";
|
|
6
|
+
import { storeCall } from "./store/errors.mjs";
|
|
7
|
+
import { bucketCall } from "./storage/calls.mjs";
|
|
8
|
+
import { effectEngine } from "./engine/engine.mjs";
|
|
9
|
+
import { GitRestApi } from "./rest/api.mjs";
|
|
10
|
+
import { GitRoutesOptions, GitRoutesServices, GitServer } from "./server/routes.mjs";
|
|
11
|
+
import { GitCallerMiddleware, GitRestServices, RestServerSeam } from "./rest/caller.mjs";
|
|
12
|
+
import { GitErrors } from "./rest/errors.mjs";
|
|
13
|
+
import { GitRestHandlers } from "./rest/handlers.mjs";
|
|
14
|
+
import { MeApiGroup } from "./rest/me.mjs";
|
|
15
|
+
import { RefsApiGroup } from "./rest/refs.mjs";
|
|
16
|
+
import { ReposApiGroup } from "./rest/repos.mjs";
|
|
17
|
+
import { TokensApiGroup } from "./rest/tokens.mjs";
|
|
18
|
+
import { WorkApiGroup } from "./rest/work.mjs";
|
|
19
|
+
import { SeamAuthorizeInput, TokenRevokeCheck } from "./core/seam.mjs";
|
|
20
|
+
export { type CallAllowance, CallBudget, type EffectCalls, type EffectGitAuth, type EffectGitAuthorize, type EffectGitEvents, GitAuth, GitAuthorize, GitCaller, GitCallerMiddleware, GitClient, GitEngine, GitErrors, GitEvents, GitObjects, GitRestApi, GitRestHandlers, GitRestServices, type GitRoutesOptions, type GitRoutesServices, GitServer, type GitServices, GitStore, type IndexCalls, type IndexReachInput, type IndexReached, type IndexStatus, type IndexTip, type IndexTry, type IndexTryInput, MeApiGroup, RefsApiGroup, ReposApiGroup, type RestServerSeam, type SeamAuthorizeInput, type TokenRevokeCheck, TokensApiGroup, WorkApiGroup, bucketCall, effectEngine, effectGitClient, spentRefusalOf, storeCall };
|
package/dist/effect.mjs
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { GitAuth, GitAuthorize, GitCaller, GitClient, GitEngine, GitEvents, GitObjects, GitStore } from "./contracts/services.mjs";
|
|
2
|
+
import { effectGitClient } from "./client/client.mjs";
|
|
3
|
+
import { CallBudget } from "./store/call-count.mjs";
|
|
4
|
+
import { spentRefusalOf } from "./contracts/calls-spent.mjs";
|
|
5
|
+
import { storeCall } from "./store/errors.mjs";
|
|
6
|
+
import { bucketCall } from "./storage/calls.mjs";
|
|
7
|
+
import { effectEngine } from "./engine/engine.mjs";
|
|
8
|
+
import { GitRestApi } from "./rest/api.mjs";
|
|
9
|
+
import { GitServer } from "./server/routes.mjs";
|
|
10
|
+
import { GitCallerMiddleware, GitRestServices } from "./rest/caller.mjs";
|
|
11
|
+
import { GitErrors } from "./rest/errors.mjs";
|
|
12
|
+
import { GitRestHandlers } from "./rest/handlers.mjs";
|
|
13
|
+
import { MeApiGroup } from "./rest/me.mjs";
|
|
14
|
+
import { RefsApiGroup } from "./rest/refs.mjs";
|
|
15
|
+
import { ReposApiGroup } from "./rest/repos.mjs";
|
|
16
|
+
import { TokensApiGroup } from "./rest/tokens.mjs";
|
|
17
|
+
import { WorkApiGroup } from "./rest/work.mjs";
|
|
18
|
+
export { CallBudget, GitAuth, GitAuthorize, GitCaller, GitCallerMiddleware, GitClient, GitEngine, GitErrors, GitEvents, GitObjects, GitRestApi, GitRestHandlers, GitRestServices, GitServer, GitStore, MeApiGroup, RefsApiGroup, ReposApiGroup, TokensApiGroup, WorkApiGroup, bucketCall, effectEngine, effectGitClient, spentRefusalOf, storeCall };
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import * as Semaphore from "effect/Semaphore";
|
|
3
|
+
// src/engine/allotted-xdiff.ts
|
|
4
|
+
/** Linear memory grows by whole 64 KiB pages, so a call's pages cover its memory rounded up. */
|
|
5
|
+
const pageBytes = 65536;
|
|
6
|
+
const pagesOf = (bytes) => Math.ceil(bytes / pageBytes) * pageBytes;
|
|
7
|
+
/**
|
|
8
|
+
* `allotment` grown by `bytes`, as an Effect: on the spot, or once its wait ends. A wait
|
|
9
|
+
* interrupted before it ends gives back what it's granted after, so nothing holds it.
|
|
10
|
+
*/
|
|
11
|
+
const granted = (allotment, bytes) => Effect.suspend(() => {
|
|
12
|
+
const answer = allotment.grow(bytes);
|
|
13
|
+
if (answer instanceof Promise) {
|
|
14
|
+
const waited = Effect.onInterrupt(Effect.promise(() => answer), () => Effect.sync(() => {
|
|
15
|
+
answer.then((late) => {
|
|
16
|
+
if (late === void 0) allotment.shrink(bytes);
|
|
17
|
+
});
|
|
18
|
+
}));
|
|
19
|
+
return Effect.flatMap(waited, (settled) => settled === void 0 ? Effect.void : Effect.fail(settled));
|
|
20
|
+
}
|
|
21
|
+
return answer === void 0 ? Effect.void : Effect.fail(answer);
|
|
22
|
+
});
|
|
23
|
+
/** Whether a call was refused for reaching its ceiling, not by its admission or its stack. */
|
|
24
|
+
const pastCeiling = (answer) => answer.kind === "refused" && answer.limit === "memory";
|
|
25
|
+
/**
|
|
26
|
+
* `xdiff` on `allotment`: before each call runs, the allotment grows to the most the call takes,
|
|
27
|
+
* in whole pages, or to what the instance already holds when that's more, and the call runs with
|
|
28
|
+
* that as its ceiling, so it never holds more than was granted. A call refused `memory` below
|
|
29
|
+
* xdiff's own ceiling, as a merge's refinement or its markers can take more than its reservation,
|
|
30
|
+
* grows to that ceiling and runs once more. After each call, on success, failure and interrupt
|
|
31
|
+
* alike, the allotment shrinks to what the instance keeps for the next call, up to `retainBytes`,
|
|
32
|
+
* none once the instance is dropped. So the instance kept between calls is counted once, on this
|
|
33
|
+
* allotment. A call xdiff's admission refuses runs nothing and takes nothing. Calls take their
|
|
34
|
+
* turn here, as the module's own permit runs them one at a time.
|
|
35
|
+
*/
|
|
36
|
+
const allottedXdiff = (xdiff, allotment) => {
|
|
37
|
+
const turn = Semaphore.makeUnsafe(1).withPermits(1);
|
|
38
|
+
let counted = 0;
|
|
39
|
+
const settled = Effect.sync(() => {
|
|
40
|
+
const held = xdiff.heldBytes();
|
|
41
|
+
if (held >= counted) return;
|
|
42
|
+
allotment.shrink(counted - held);
|
|
43
|
+
counted = held;
|
|
44
|
+
});
|
|
45
|
+
const most = pagesOf(xdiff.budget.memoryBytes);
|
|
46
|
+
/** `call` under a ceiling of `memory` in pages, or what's counted when that's more. */
|
|
47
|
+
const ran = (memory, call) => Effect.suspend(() => {
|
|
48
|
+
const target = Math.max(pagesOf(memory), counted);
|
|
49
|
+
return Effect.flatMap(granted(allotment, target - counted), () => {
|
|
50
|
+
counted = target;
|
|
51
|
+
return Effect.map(call(target), (answer) => ({
|
|
52
|
+
answer,
|
|
53
|
+
ceiling: target
|
|
54
|
+
}));
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
const within = (memory, call) => turn(Effect.suspend(() => {
|
|
58
|
+
if (memory === void 0) return call();
|
|
59
|
+
const once = Effect.flatMap(ran(memory, call), ({ answer, ceiling }) => ceiling < most && pastCeiling(answer) ? Effect.map(ran(most, call), (again) => again.answer) : Effect.succeed(answer));
|
|
60
|
+
return Effect.ensuring(once, settled);
|
|
61
|
+
}));
|
|
62
|
+
return {
|
|
63
|
+
budget: xdiff.budget,
|
|
64
|
+
count: (one, two, algorithm) => within(xdiff.memoryOf(one, two, algorithm), (ceiling) => xdiff.count(one, two, algorithm, ceiling)),
|
|
65
|
+
patch: (one, two, algorithm) => within(xdiff.memoryOf(one, two, algorithm), (ceiling) => xdiff.patch(one, two, algorithm, ceiling)),
|
|
66
|
+
merge: (base, ours, theirs, favor, markers) => within(xdiff.mergeMemoryOf(base, ours, theirs), (ceiling) => xdiff.merge(base, ours, theirs, favor, markers, ceiling))
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* xdiff for the scope, on an allotment `allot` hands: at most one call's ceiling, `memoryBytes` in
|
|
71
|
+
* whole pages, `refusal` past it or past the whole budget. The allotment goes back when the scope
|
|
72
|
+
* closes.
|
|
73
|
+
*/
|
|
74
|
+
const loadAllotted = (load, allot, refusal) => Effect.gen(function* () {
|
|
75
|
+
const xdiff = yield* load;
|
|
76
|
+
const allotment = allot(pagesOf(xdiff.budget.memoryBytes), refusal);
|
|
77
|
+
yield* Effect.addFinalizer(() => Effect.sync(() => allotment.release()));
|
|
78
|
+
return allottedXdiff(xdiff, allotment);
|
|
79
|
+
});
|
|
80
|
+
export { allottedXdiff, loadAllotted };
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
// src/engine/attribute-patterns.ts
|
|
2
|
+
/**
|
|
3
|
+
* gitignore(5)'s patterns, as `.gitattributes` matches them against a path: `matching` carries
|
|
4
|
+
* every position a pattern may be at through the text a byte at a time, pausing before each byte.
|
|
5
|
+
*/
|
|
6
|
+
/** POSIX's classes, over ASCII, as a bracket names them. */
|
|
7
|
+
const inClass = (pattern) => (char) => pattern.test(char);
|
|
8
|
+
const classes = new Map(Object.entries({
|
|
9
|
+
alnum: inClass(/[0-9A-Za-z]/),
|
|
10
|
+
alpha: inClass(/[A-Za-z]/),
|
|
11
|
+
blank: inClass(/[ \t]/),
|
|
12
|
+
cntrl: (char) => char < " " || char === "",
|
|
13
|
+
digit: inClass(/[0-9]/),
|
|
14
|
+
graph: (char) => char > " " && char < "",
|
|
15
|
+
lower: inClass(/[a-z]/),
|
|
16
|
+
print: (char) => char >= " " && char < "",
|
|
17
|
+
punct: inClass(/[!-/:-@[-`{-~]/),
|
|
18
|
+
space: inClass(/[ \t\n\v\f\r]/),
|
|
19
|
+
upper: inClass(/[A-Z]/),
|
|
20
|
+
xdigit: inClass(/[0-9A-Fa-f]/)
|
|
21
|
+
}));
|
|
22
|
+
/** A bracket from `at`, just past its `[`: whether it matches `char`, and where it ends, or none if it's malformed. */
|
|
23
|
+
const bracket = (pattern, at, char) => {
|
|
24
|
+
let next = at;
|
|
25
|
+
const negated = pattern[next] === "!" || pattern[next] === "^";
|
|
26
|
+
if (negated) next += 1;
|
|
27
|
+
let matched = false;
|
|
28
|
+
let first = true;
|
|
29
|
+
while (next < pattern.length) {
|
|
30
|
+
let low = pattern[next] ?? "";
|
|
31
|
+
if (low === "]" && !first) return {
|
|
32
|
+
matched: matched !== negated && char !== "/",
|
|
33
|
+
end: next + 1
|
|
34
|
+
};
|
|
35
|
+
first = false;
|
|
36
|
+
if (low === "[" && pattern[next + 1] === ":") {
|
|
37
|
+
const close = pattern.indexOf(":]", next + 2);
|
|
38
|
+
const test = close < 0 ? void 0 : classes.get(pattern.slice(next + 2, close));
|
|
39
|
+
if (test === void 0) return void 0;
|
|
40
|
+
if (test(char)) matched = true;
|
|
41
|
+
next = close + 2;
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
if (low === "\\") {
|
|
45
|
+
next += 1;
|
|
46
|
+
low = pattern[next] ?? "";
|
|
47
|
+
if (low === "") return void 0;
|
|
48
|
+
}
|
|
49
|
+
next += 1;
|
|
50
|
+
if (pattern[next] === "-" && pattern[next + 1] !== void 0 && pattern[next + 1] !== "]") {
|
|
51
|
+
let high = pattern[next + 1] ?? "";
|
|
52
|
+
next += 2;
|
|
53
|
+
if (high === "\\") {
|
|
54
|
+
high = pattern[next] ?? "";
|
|
55
|
+
if (high === "") return void 0;
|
|
56
|
+
next += 1;
|
|
57
|
+
}
|
|
58
|
+
if (char >= low && char <= high) matched = true;
|
|
59
|
+
} else if (char === low) matched = true;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
/** A bracket from just past its `[`: a test of one byte, cached by byte, and where it ends. */
|
|
63
|
+
const bracketStep = (pattern, at) => {
|
|
64
|
+
const bounds = bracket(pattern, at, "");
|
|
65
|
+
if (bounds === void 0) return { kind: "never" };
|
|
66
|
+
const tested = /* @__PURE__ */ new Map();
|
|
67
|
+
const test = (char) => {
|
|
68
|
+
const known = tested.get(char);
|
|
69
|
+
if (known !== void 0) return known;
|
|
70
|
+
const matched = bracket(pattern, at, char)?.matched === true;
|
|
71
|
+
tested.set(char, matched);
|
|
72
|
+
return matched;
|
|
73
|
+
};
|
|
74
|
+
return {
|
|
75
|
+
kind: "one",
|
|
76
|
+
test,
|
|
77
|
+
next: bounds.end
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
/** The step at each of `pattern`'s positions that starts one, by position. */
|
|
81
|
+
const stepsOf = (pattern) => {
|
|
82
|
+
const steps = /* @__PURE__ */ new Map();
|
|
83
|
+
for (let p = 0; p < pattern.length;) {
|
|
84
|
+
const char = pattern[p];
|
|
85
|
+
if (char === "*") {
|
|
86
|
+
let after = p;
|
|
87
|
+
while (pattern[after] === "*") after += 1;
|
|
88
|
+
const across = !(after - p >= 2 && (p === 0 || pattern[p - 1] === "/")) ? "none" : after === pattern.length ? "rest" : pattern[after] === "/" ? "folders" : pattern[after] === "\\" && pattern[after + 1] === "/" ? "any" : "none";
|
|
89
|
+
steps.set(p, {
|
|
90
|
+
kind: "star",
|
|
91
|
+
after,
|
|
92
|
+
across
|
|
93
|
+
});
|
|
94
|
+
p = after;
|
|
95
|
+
} else if (char === "?") {
|
|
96
|
+
steps.set(p, {
|
|
97
|
+
kind: "one",
|
|
98
|
+
test: (got) => got !== "/",
|
|
99
|
+
next: p + 1
|
|
100
|
+
});
|
|
101
|
+
p += 1;
|
|
102
|
+
} else if (char === "[") {
|
|
103
|
+
const step = bracketStep(pattern, p + 1);
|
|
104
|
+
steps.set(p, step);
|
|
105
|
+
p = step.kind === "one" ? step.next : pattern.length;
|
|
106
|
+
} else if (char === "\\") {
|
|
107
|
+
const escaped = pattern[p + 1];
|
|
108
|
+
steps.set(p, escaped === void 0 ? { kind: "never" } : {
|
|
109
|
+
kind: "one",
|
|
110
|
+
test: (got) => got === escaped,
|
|
111
|
+
next: p + 2
|
|
112
|
+
});
|
|
113
|
+
p += 2;
|
|
114
|
+
} else {
|
|
115
|
+
steps.set(p, {
|
|
116
|
+
kind: "one",
|
|
117
|
+
test: (got) => got === char,
|
|
118
|
+
next: p + 1
|
|
119
|
+
});
|
|
120
|
+
p += 1;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return steps;
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* Whether `pattern` matches `text` whole, as gitignore(5)'s patterns do with `FNM_PATHNAME`: `*`
|
|
127
|
+
* and `?` never cross a slash, a `**` that's a whole part of the path does, and a malformed
|
|
128
|
+
* bracket or a trailing `\` never matches. Every position the pattern may be at is carried
|
|
129
|
+
* through the text a byte at a time, so the work is at most the pattern's length times the text's.
|
|
130
|
+
* It pauses before each byte, about the pattern's length of work, and returns the answer.
|
|
131
|
+
*/
|
|
132
|
+
function* matching(pattern, text) {
|
|
133
|
+
const steps = stepsOf(pattern);
|
|
134
|
+
let at = new Uint8Array(pattern.length + 1);
|
|
135
|
+
let next = new Uint8Array(pattern.length + 1);
|
|
136
|
+
at[0] = 1;
|
|
137
|
+
for (let t = 0;; t += 1) {
|
|
138
|
+
let live = false;
|
|
139
|
+
for (let p = 0; p <= pattern.length; p += 1) {
|
|
140
|
+
if (at[p] === 0) continue;
|
|
141
|
+
live = true;
|
|
142
|
+
const step = steps.get(p);
|
|
143
|
+
if (step?.kind !== "star") continue;
|
|
144
|
+
if (step.across === "rest") return true;
|
|
145
|
+
if (step.across !== "folders") at[step.after] = 1;
|
|
146
|
+
else if (t === 0 || text[t - 1] === "/") at[step.after + 1] = 1;
|
|
147
|
+
}
|
|
148
|
+
if (t === text.length) return at[pattern.length] === 1;
|
|
149
|
+
if (!live) return false;
|
|
150
|
+
yield;
|
|
151
|
+
const got = text[t] ?? "";
|
|
152
|
+
next.fill(0);
|
|
153
|
+
for (let p = 0; p < pattern.length; p += 1) {
|
|
154
|
+
if (at[p] === 0) continue;
|
|
155
|
+
const step = steps.get(p);
|
|
156
|
+
if (step?.kind === "star") {
|
|
157
|
+
if (step.across !== "none" || got !== "/") next[p] = 1;
|
|
158
|
+
} else if (step?.kind === "one" && step.test(got)) next[step.next] = 1;
|
|
159
|
+
}
|
|
160
|
+
[at, next] = [next, at];
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
export { matching };
|