@ref0/git 0.12.0 → 0.20.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/access/private-refs.mjs +3 -3
- package/dist/auth/access-jwt.mjs +2 -2
- package/dist/auth/auth.d.mts +2 -2
- package/dist/auth/auth.mjs +3 -6
- package/dist/auth/authorize.mjs +4 -20
- package/dist/auth/fences.d.mts +1 -2
- package/dist/auth/fences.mjs +3 -3
- package/dist/auth/grants.mjs +4 -4
- package/dist/auth/helpers.mjs +3 -11
- package/dist/auth/host-function.mjs +18 -1
- package/dist/auth/host-services.mjs +11 -0
- package/dist/auth/identify.d.mts +1 -1
- package/dist/auth/identify.mjs +3 -3
- package/dist/auth/policy.d.mts +27 -7
- package/dist/auth/policy.mjs +8 -4
- package/dist/auth/token-cleanup.mjs +67 -0
- package/dist/auth/token-rows.mjs +1 -1
- package/dist/auth/token-text.mjs +9 -1
- package/dist/auth/tokens-base.d.mts +35 -0
- package/dist/auth/tokens-base.mjs +13 -0
- package/dist/auth/tokens-layer.d.mts +2 -28
- package/dist/auth/tokens-layer.mjs +6 -12
- package/dist/auth/tokens-public.d.mts +3 -3
- package/dist/auth/tokens.d.mts +7 -17
- package/dist/auth/tokens.mjs +9 -87
- package/dist/auth.d.mts +1 -4
- package/dist/auth.mjs +1 -3
- package/dist/client/answer.mjs +21 -42
- package/dist/client/client.d.mts +2 -4
- package/dist/client/git-http.mjs +35 -11
- package/dist/client/local.mjs +14 -13
- package/dist/client/push-upload.mjs +39 -12
- package/dist/client/remote.mjs +95 -31
- package/dist/client/run-remote-helper.d.mts +1 -0
- package/dist/client/run-remote-helper.mjs +58 -24
- package/dist/client/slice-push.d.mts +1 -1
- package/dist/client/transport.mjs +105 -46
- package/dist/contracts/access.d.mts +8 -8
- package/dist/contracts/actors.d.mts +2 -34
- package/dist/contracts/blobs.d.mts +57 -10
- package/dist/contracts/blobs.mjs +16 -2
- package/dist/contracts/call-allowance.d.mts +13 -0
- package/dist/contracts/call-allowance.mjs +44 -0
- package/dist/contracts/calls-spent.mjs +8 -3
- package/dist/contracts/client.d.mts +23 -19
- package/dist/contracts/commits.d.mts +34 -26
- package/dist/contracts/commits.mjs +9 -1
- package/dist/contracts/engine.d.mts +6 -1
- package/dist/contracts/engine.mjs +10 -1
- package/dist/contracts/files.d.mts +12 -12
- package/dist/contracts/forks.d.mts +27 -17
- package/dist/contracts/git-events.d.mts +29 -1
- package/dist/contracts/git-hooks.d.mts +1 -1
- package/dist/contracts/git.d.mts +39 -7
- package/dist/contracts/git.mjs +3 -2
- package/dist/contracts/grants.d.mts +24 -4
- package/dist/contracts/handlers.d.mts +1 -1
- package/dist/contracts/lfs.d.mts +28 -9
- package/dist/contracts/merges.d.mts +3 -2
- package/dist/contracts/objects.d.mts +103 -35
- package/dist/contracts/operations.d.mts +3 -0
- package/dist/contracts/operations.mjs +12 -2
- package/dist/contracts/push-uploads.d.mts +44 -5
- package/dist/contracts/push-uploads.mjs +7 -3
- package/dist/contracts/queue.d.mts +40 -12
- package/dist/contracts/queue.mjs +3 -4
- package/dist/contracts/refs.d.mts +50 -25
- package/dist/contracts/remote.d.mts +6 -7
- package/dist/contracts/remote.mjs +5 -4
- package/dist/contracts/repo-records.d.mts +1 -0
- package/dist/contracts/repos.d.mts +106 -127
- package/dist/contracts/repos.mjs +33 -4
- package/dist/contracts/result.d.mts +49 -25
- package/dist/contracts/result.mjs +52 -11
- package/dist/contracts/rules.d.mts +22 -22
- package/dist/contracts/server.d.mts +37 -111
- package/dist/contracts/services.d.mts +1 -1
- package/dist/contracts/signin.d.mts +1 -1
- package/dist/contracts/store.d.mts +6 -5
- package/dist/contracts/sync.d.mts +90 -26
- package/dist/contracts/sync.mjs +45 -11
- package/dist/contracts/tags.d.mts +10 -10
- package/dist/contracts/time.d.mts +3 -0
- package/dist/contracts/{promises.mjs → time.mjs} +1 -1
- package/dist/contracts/tokens.d.mts +15 -22
- package/dist/contracts/tokens.mjs +3 -3
- package/dist/contracts/topics.d.mts +1 -6
- package/dist/contracts/trees.d.mts +12 -12
- package/dist/contracts/work.d.mts +87 -12
- package/dist/contracts/work.mjs +8 -1
- package/dist/core/access.d.mts +1 -2
- package/dist/core/access.mjs +46 -13
- package/dist/core/ancestry.d.mts +10 -0
- package/dist/core/ancestry.mjs +6 -6
- package/dist/core/asked.mjs +43 -5
- package/dist/core/call-names.mjs +7 -1
- package/dist/core/call-services.mjs +13 -4
- package/dist/core/events/deliver.d.mts +1 -2
- package/dist/core/events/deliver.mjs +48 -33
- package/dist/core/events/retired.mjs +119 -0
- package/dist/core/forks.mjs +931 -435
- package/dist/core/hooks/groups.mjs +1 -1
- package/dist/core/imports.mjs +159 -15
- package/dist/core/index-job.mjs +128 -37
- package/dist/core/index-lost.d.mts +1 -2
- package/dist/core/index-lost.mjs +2 -2
- package/dist/core/job-view.mjs +8 -9
- package/dist/core/loose-tally.mjs +1 -1
- package/dist/core/mirror-rows.mjs +19 -4
- package/dist/core/objects/blobs.mjs +129 -3
- package/dist/core/objects/commits.mjs +16 -6
- package/dist/core/objects/lines.mjs +2 -2
- package/dist/core/objects/merges.mjs +4 -1
- package/dist/core/objects/objects-layer.d.mts +1 -1
- package/dist/core/objects/objects-layer.mjs +3 -3
- package/dist/core/objects/reading.mjs +24 -13
- package/dist/core/objects/tags.mjs +4 -1
- package/dist/core/objects/trees.mjs +2 -2
- package/dist/core/objects/writing.mjs +2 -2
- package/dist/core/own-writes.mjs +1 -1
- package/dist/core/parts.d.mts +10 -6
- package/dist/core/parts.mjs +3 -11
- package/dist/core/promise.mjs +9 -12
- package/dist/core/purge.mjs +316 -42
- package/dist/core/push-decide.mjs +3 -1
- package/dist/core/push-files.d.mts +12 -0
- package/dist/core/push-files.mjs +225 -0
- package/dist/core/push-repo.d.mts +8 -0
- package/dist/core/push-repo.mjs +56 -0
- package/dist/core/push.d.mts +17 -0
- package/dist/core/push.mjs +153 -70
- package/dist/core/receipts.mjs +34 -13
- package/dist/core/ref-index-job.mjs +4 -4
- package/dist/core/ref-view.mjs +61 -7
- package/dist/core/refs.mjs +18 -13
- package/dist/core/registered-rows.mjs +2 -2
- package/dist/core/repack.mjs +46 -28
- package/dist/core/repo-info.mjs +19 -12
- package/dist/core/repos.mjs +50 -22
- package/dist/core/rules/commit-changes.d.mts +0 -1
- package/dist/core/saved-caller-views.d.mts +7 -2
- package/dist/core/saved-caller-views.mjs +2 -2
- package/dist/core/saved-callers.d.mts +19 -2
- package/dist/core/seam.d.mts +16 -26
- package/dist/core/seam.mjs +7 -28
- package/dist/core/tokens.mjs +1 -1
- package/dist/core/view.d.mts +6 -0
- package/dist/core/view.mjs +51 -26
- package/dist/core/work.mjs +105 -35
- package/dist/effect.d.mts +5 -12
- package/dist/effect.mjs +3 -10
- package/dist/engine/failures.mjs +2 -1
- package/dist/engine/reads.mjs +17 -10
- package/dist/engine/walk.mjs +4 -4
- package/dist/event-streams/event-streams.d.mts +1 -1
- package/dist/event-streams/event-streams.mjs +1 -1
- package/dist/event-streams/stream.d.mts +3 -3
- package/dist/event-streams/stream.mjs +38 -15
- package/dist/extend.d.mts +4 -5
- package/dist/extend.mjs +3 -2
- package/dist/http/answers.mjs +12 -7
- package/dist/http/core-parts.mjs +129 -64
- package/dist/http/handler.mjs +36 -9
- package/dist/http/node.d.mts +14 -1
- package/dist/http/node.mjs +61 -31
- package/dist/http/parts.d.mts +2 -0
- package/dist/http/push-upload-job.mjs +507 -0
- package/dist/http/push-uploads.d.mts +1 -0
- package/dist/http/push-uploads.mjs +142 -69
- package/dist/http/upload-pack.mjs +10 -9
- package/dist/index.d.mts +27 -28
- package/dist/index.mjs +5 -8
- package/dist/lfs/answer.mjs +37 -0
- package/dist/lfs/base.d.mts +9 -3
- package/dist/lfs/base.mjs +27 -2
- package/dist/lfs/copy.d.mts +60 -0
- package/dist/lfs/copy.mjs +109 -0
- package/dist/lfs/layer.d.mts +15 -1
- package/dist/lfs/layer.mjs +28 -13
- package/dist/lfs/locks.mjs +2 -2
- package/dist/lfs/objects.d.mts +7 -0
- package/dist/lfs/objects.mjs +152 -55
- package/dist/lfs/pointers.mjs +2 -2
- package/dist/lfs/rows.d.mts +13 -0
- package/dist/lfs/rows.mjs +42 -8
- package/dist/lfs/service.d.mts +1 -7
- package/dist/lfs/service.mjs +1 -9
- package/dist/lfs/upkeep.mjs +48 -14
- package/dist/lfs/upload-most.mjs +5 -5
- package/dist/lfs/wire.mjs +6 -31
- package/dist/merges/merges.mjs +2 -2
- package/dist/node.d.mts +3 -3
- package/dist/protocol/bytes/buffers.mjs +13 -5
- package/dist/protocol/bytes/reader.mjs +6 -1
- package/dist/protocol/bytes/sha256-hasher.d.mts +15 -0
- package/dist/protocol/bytes/sha256.d.mts +32 -0
- package/dist/protocol/bytes/sha256.mjs +105 -49
- package/dist/protocol/bytes/streams.mjs +27 -1
- package/dist/protocol/diff/read.d.mts +4 -3
- package/dist/protocol/diff/read.mjs +8 -3
- package/dist/protocol/objects/lfs-pointer.d.mts +14 -2
- package/dist/protocol/objects/lfs-pointer.mjs +1 -3
- package/dist/protocol/objects/links-raw.mjs +24 -10
- package/dist/protocol/objects/tag.d.mts +1 -1
- package/dist/protocol/objects/tree.mjs +23 -6
- package/dist/protocol/packs/delta.d.mts +6 -3
- package/dist/protocol/packs/delta.mjs +96 -32
- package/dist/protocol/packs/idx.d.mts +2 -1
- package/dist/protocol/packs/idx.mjs +22 -3
- package/dist/protocol/packs/parts.d.mts +4 -1
- package/dist/protocol/packs/parts.mjs +10 -7
- package/dist/protocol/packs/reader.d.mts +5 -0
- package/dist/protocol/packs/reader.mjs +3 -2
- package/dist/protocol/packs/writer.mjs +26 -8
- package/dist/protocol/wire/advertisement.mjs +9 -4
- package/dist/protocol/wire/lines.d.mts +4 -2
- package/dist/protocol/wire/lines.mjs +11 -5
- package/dist/protocol/wire/push-uploads.mjs +13 -1
- package/dist/protocol/wire/v2.mjs +2 -2
- package/dist/protocol.d.mts +3 -1
- package/dist/protocol.mjs +3 -1
- package/dist/queue/advance.mjs +22 -25
- package/dist/queue/base.d.mts +55 -0
- package/dist/queue/base.mjs +44 -0
- package/dist/queue/calls.mjs +51 -54
- package/dist/queue/commit.mjs +1 -1
- package/dist/queue/host.d.mts +2 -22
- package/dist/queue/host.mjs +2 -13
- package/dist/queue/layer.d.mts +2 -1
- package/dist/queue/layer.mjs +11 -4
- package/dist/queue/limits.mjs +2 -0
- package/dist/queue/push-option.mjs +9 -24
- package/dist/queue/schedule.mjs +1 -1
- package/dist/queue/state.mjs +2 -10
- package/dist/queue/trim.mjs +6 -4
- package/dist/rest/blobs.mjs +29 -5
- package/dist/rest/caller.d.mts +4 -4231
- package/dist/rest/caller.mjs +5 -1
- package/dist/rest/client.d.mts +15 -5
- package/dist/rest/client.mjs +23 -2
- package/dist/rest/events.mjs +1 -2
- package/dist/rest/handler.mjs +4 -57
- package/dist/rest/handlers.mjs +68 -9
- package/dist/rest/layer.d.mts +2 -2
- package/dist/rest/layer.mjs +7 -13
- package/dist/rest/me.d.mts +3 -428
- package/dist/rest/paths.mjs +1 -0
- package/dist/rest/work.mjs +8 -0
- package/dist/server/check-fetch.mjs +3 -3
- package/dist/server/edge-node.d.mts +14 -15
- package/dist/server/edge-node.mjs +12 -12
- package/dist/server/edge.d.mts +21 -7
- package/dist/server/edge.mjs +32 -11
- package/dist/server/extension.mjs +1 -1
- package/dist/server/git-layer.d.mts +6 -11
- package/dist/server/git-layer.mjs +29 -23
- package/dist/server/git-namespace.d.mts +5 -4
- package/dist/server/git-namespace.mjs +3 -2
- package/dist/server/joined.d.mts +21 -40
- package/dist/server/joined.mjs +11 -62
- package/dist/server/lifecycle.mjs +65 -69
- package/dist/server/registry.mjs +28 -3
- package/dist/server/server.mjs +245 -465
- package/dist/signin/context.d.mts +1 -2
- package/dist/signin/layer.d.mts +1 -1
- package/dist/signin/layer.mjs +1 -1
- package/dist/storage/allotted.mjs +18 -3
- package/dist/storage/batch-upkeep.mjs +274 -0
- package/dist/{core/purge.d.mts → storage/batches.d.mts} +4 -4
- package/dist/storage/batches.mjs +344 -0
- package/dist/storage/budget.mjs +2 -2
- package/dist/storage/calls.d.mts +1 -2
- package/dist/storage/calls.mjs +144 -158
- package/dist/storage/chunks.d.mts +9 -0
- package/dist/storage/chunks.mjs +297 -0
- package/dist/storage/clean-up.mjs +85 -19
- package/dist/storage/counted-bucket.mjs +4 -4
- package/dist/storage/fetch.d.mts +1 -0
- package/dist/storage/fetch.mjs +298 -216
- package/dist/storage/file-limits.mjs +24 -0
- package/dist/storage/host-bucket.mjs +1 -2
- package/dist/storage/id-mix.mjs +19 -5
- package/dist/storage/index-bitmaps.mjs +9 -2
- package/dist/storage/index-build.d.mts +1 -1
- package/dist/storage/index-build.mjs +185 -84
- package/dist/storage/index-fetch.mjs +128 -74
- package/dist/storage/index-files.d.mts +3 -0
- package/dist/storage/index-files.mjs +10 -5
- package/dist/storage/index-graph.mjs +72 -22
- package/dist/storage/index-reach.mjs +33 -5
- package/dist/storage/index-remap.mjs +208 -65
- package/dist/storage/index-shallow.mjs +5 -3
- package/dist/storage/index-whole.mjs +127 -0
- package/dist/storage/largest-files.mjs +48 -0
- package/dist/storage/layout.mjs +23 -0
- package/dist/storage/lfs-pointers.mjs +10 -1
- package/dist/storage/loose.d.mts +7 -4
- package/dist/storage/loose.mjs +214 -67
- package/dist/storage/memory-budget.mjs +44 -8
- package/dist/storage/merge-plan.mjs +3 -2
- package/dist/storage/merge-row.mjs +7 -1
- package/dist/storage/merge-stream.mjs +164 -25
- package/dist/storage/merge-walk.mjs +8 -4
- package/dist/storage/merge-write.mjs +1 -1
- package/dist/storage/merge.d.mts +1 -1
- package/dist/storage/merge.mjs +1 -1
- package/dist/storage/object-rows.d.mts +1 -0
- package/dist/storage/object-rows.mjs +385 -65
- package/dist/storage/oid-table.mjs +171 -0
- package/dist/storage/pack-order.mjs +8 -4
- package/dist/storage/pack-ranges.d.mts +1 -2
- package/dist/storage/pack-ranges.mjs +4 -5
- package/dist/storage/pack-reads.d.mts +2 -1
- package/dist/storage/pack-reads.mjs +165 -49
- package/dist/storage/pack-receive.d.mts +1 -1
- package/dist/storage/pack-receive.mjs +85 -27
- package/dist/storage/packs.d.mts +1 -1
- package/dist/storage/packs.mjs +172 -86
- package/dist/storage/placed-reads.mjs +1 -1
- package/dist/storage/plan-columns.d.mts +4 -0
- package/dist/storage/plan-columns.mjs +238 -0
- package/dist/storage/prune-keep.mjs +299 -37
- package/dist/storage/prune-walk.mjs +240 -62
- package/dist/storage/prune.mjs +749 -213
- package/dist/storage/push-allotment.mjs +91 -12
- package/dist/storage/push-uploads.mjs +40 -16
- package/dist/storage/pushed-commits.mjs +4 -2
- package/dist/storage/quarantine.d.mts +1 -1
- package/dist/storage/quarantine.mjs +9 -9
- package/dist/storage/range-cache.mjs +125 -8
- package/dist/storage/ready.d.mts +1 -1
- package/dist/storage/ready.mjs +55 -25
- package/dist/storage/receive-bounds.mjs +51 -15
- package/dist/storage/receive-state.mjs +8 -0
- package/dist/storage/receive-steps.mjs +71 -18
- package/dist/storage/repack-backlog.mjs +6 -3
- package/dist/storage/repack.d.mts +2 -2
- package/dist/storage/repack.mjs +1 -8
- package/dist/storage/rows.d.mts +1 -1
- package/dist/storage/rows.mjs +13 -2
- package/dist/storage/runs.mjs +195 -43
- package/dist/storage/send-list.d.mts +1 -0
- package/dist/storage/send-list.mjs +54 -10
- package/dist/storage/shallow.d.mts +1 -0
- package/dist/storage/shallow.mjs +26 -4
- package/dist/storage/single-flight.mjs +13 -7
- package/dist/storage/stream-whole.mjs +132 -28
- package/dist/storage/unpack.mjs +371 -79
- package/dist/storage/visible.mjs +31 -3
- package/dist/storage/walk.mjs +194 -39
- package/dist/storage/wants.mjs +5 -5
- package/dist/store/bodies.mjs +38 -0
- package/dist/store/call-count.d.mts +8 -12
- package/dist/store/call-count.mjs +34 -46
- package/dist/store/catalogue.d.mts +2 -2
- package/dist/store/catalogue.mjs +146 -35
- package/dist/store/crossing.mjs +1 -3
- package/dist/store/cursor-seal-namespace.d.mts +2 -0
- package/dist/store/cursor-seal-public.d.mts +5 -0
- package/dist/store/cursor-seal-public.mjs +5 -0
- package/dist/store/cursor-seal.d.mts +16 -3
- package/dist/store/cursor-seal.mjs +40 -18
- package/dist/store/door.mjs +183 -0
- package/dist/store/errors.d.mts +3 -4
- package/dist/store/errors.mjs +24 -34
- package/dist/store/git-store.mjs +25 -7
- package/dist/store/job-try.mjs +9 -32
- package/dist/store/list-job.mjs +44 -8
- package/dist/store/records.d.mts +5 -0
- package/dist/store/records.mjs +12 -6
- package/dist/store/repo-record.d.mts +10 -9
- package/dist/store/repo-record.mjs +123 -28
- package/dist/store/reservations.mjs +1 -1
- package/dist/store/scopes.mjs +21 -2
- package/dist/store/settle.mjs +4 -4
- package/dist/sync/bound.d.mts +2 -0
- package/dist/sync/bound.mjs +11 -2
- package/dist/sync/github.d.mts +6 -1
- package/dist/sync/github.mjs +56 -44
- package/dist/sync/http.mjs +36 -1
- package/dist/sync/import.mjs +32 -18
- package/dist/sync/layer.mjs +6 -2
- package/dist/sync/lfs-batch.mjs +118 -0
- package/dist/sync/lfs-copy.mjs +262 -0
- package/dist/sync/mirror.mjs +227 -151
- package/dist/sync/said.mjs +16 -37
- package/dist/sync/smart-http.mjs +4 -2
- package/dist/sync/step.mjs +58 -30
- package/dist/sync/tries.mjs +52 -21
- package/dist/sync.d.mts +2 -2
- package/dist/topics/advance.mjs +10 -11
- package/dist/topics/base.d.mts +15 -0
- package/dist/topics/base.mjs +8 -0
- package/dist/topics/host.mjs +2 -20
- package/dist/topics/layer.d.mts +4 -9
- package/dist/topics/layer.mjs +3 -4
- package/dist/topics/members.mjs +4 -4
- package/dist/topics/public.d.mts +2 -1
- package/dist/topics/topic.mjs +2 -2
- package/package.json +5 -9
- package/dist/auth/bridge.mjs +0 -30
- package/dist/auth/helpers.d.mts +0 -17
- package/dist/contracts/promises.d.mts +0 -39
- package/dist/core/call-names.d.mts +0 -3
- package/dist/core/clock.mjs +0 -18
- package/dist/core/registered-rows.d.mts +0 -5
- package/dist/core/repack.d.mts +0 -11
- package/dist/http/handler.d.mts +0 -2
- package/dist/lfs/calls.mjs +0 -26
- package/dist/rest/api.d.mts +0 -23
- package/dist/rest/blobs.d.mts +0 -825
- package/dist/rest/commits.d.mts +0 -3510
- package/dist/rest/errors.d.mts +0 -2104
- package/dist/rest/events.d.mts +0 -423
- package/dist/rest/files.d.mts +0 -1330
- package/dist/rest/forks.d.mts +0 -2136
- package/dist/rest/handler.d.mts +0 -21
- package/dist/rest/handlers.d.mts +0 -8
- package/dist/rest/merges.d.mts +0 -473
- package/dist/rest/queue.d.mts +0 -5861
- package/dist/rest/refs.d.mts +0 -2959
- package/dist/rest/repos.d.mts +0 -2539
- package/dist/rest/tags.d.mts +0 -1304
- package/dist/rest/tokens.d.mts +0 -2590
- package/dist/rest/topics.d.mts +0 -2204
- package/dist/rest/trees.d.mts +0 -1693
- package/dist/rest/work.d.mts +0 -1248
- package/dist/rest.d.mts +0 -2
- package/dist/rest.mjs +0 -1
- package/dist/server/lifecycle.d.mts +0 -2
- package/dist/server/registry.d.mts +0 -16
- package/dist/server/server.d.mts +0 -36
- package/dist/storage/repack-job.d.mts +0 -3
- package/dist/store/promises.d.mts +0 -11
- package/dist/store/promises.mjs +0 -327
- package/dist/topics/host.d.mts +0 -7
|
@@ -18,7 +18,7 @@ export declare const OAuthClient: Schema.Struct<{
|
|
|
18
18
|
export type OAuthClient = typeof OAuthClient.Type;
|
|
19
19
|
/**
|
|
20
20
|
* Turns on sign-in: GitHub's device flow, which also accepts `gh`'s client ID, and the web flow for
|
|
21
|
-
* `clients`, both approved on the host's `approvalPage`. Needs `
|
|
21
|
+
* `clients`, both approved on the host's `approvalPage`. Needs `Tokens.layer()`, which mints the token.
|
|
22
22
|
*/
|
|
23
23
|
export interface SignInLayerOptions {
|
|
24
24
|
readonly clients?: readonly OAuthClient[];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { InternalRepoId } from "./ids.mjs";
|
|
2
2
|
import { CallInput } from "./actors.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { GitError } from "./result.mjs";
|
|
4
|
+
import * as Effect from "effect/Effect";
|
|
4
5
|
import * as Schema from "effect/Schema";
|
|
5
6
|
import { Addition, Change, Committed, Read, Scope, Snapshot } from "@ref0/infra";
|
|
6
7
|
/** A pack another pack holds whole, by its ID, with its size (Q903). */
|
|
@@ -72,10 +73,10 @@ export interface ListedInput extends CallInput {
|
|
|
72
73
|
}
|
|
73
74
|
/** Git's records over infra's `Store`, under Git's commit rules. Features never get the raw store. */
|
|
74
75
|
export interface GitStore {
|
|
75
|
-
readonly read: (input: GitStoreReadInput) =>
|
|
76
|
+
readonly read: (input: GitStoreReadInput) => Effect.Effect<Snapshot, GitError>;
|
|
76
77
|
/** Fenced by the current job's claim inside a job's try. */
|
|
77
|
-
readonly commit: (input: GitStoreCommitInput) =>
|
|
78
|
+
readonly commit: (input: GitStoreCommitInput) => Effect.Effect<Committed, GitError>;
|
|
78
79
|
/** Fenced like `commit`; `ALREADY_EXISTS` when a row it puts is there. */
|
|
79
|
-
readonly add: (input: GitStoreAddInput) =>
|
|
80
|
-
readonly listed: (input: ListedInput) =>
|
|
80
|
+
readonly add: (input: GitStoreAddInput) => Effect.Effect<void, GitError>;
|
|
81
|
+
readonly listed: (input: ListedInput) => Effect.Effect<Listed, GitError>;
|
|
81
82
|
}
|
|
@@ -1,16 +1,23 @@
|
|
|
1
|
-
import { ClientCredential
|
|
2
|
-
import { Awaitable, GitError, Result } from "./result.mjs";
|
|
1
|
+
import { ClientCredential } from "./remote.mjs";
|
|
3
2
|
import { ActorInput, WriteInput } from "./actors.mjs";
|
|
4
3
|
import { RefName, RepoName } from "./ids.mjs";
|
|
5
4
|
import { RepoInfo, RepoInput } from "./repos.mjs";
|
|
5
|
+
import { GitError, Result } from "./result.mjs";
|
|
6
6
|
import * as Effect from "effect/Effect";
|
|
7
7
|
import * as Schema from "effect/Schema";
|
|
8
8
|
import * as Context from "effect/Context";
|
|
9
|
+
/**
|
|
10
|
+
* A sync remote's sender of one request, in place of Git's own client: an Effect, run in the try's
|
|
11
|
+
* fiber, so Git charges each call of it to the try's `CallBudget` as one subrequest before it
|
|
12
|
+
* runs, and a request it sends again, as a retry, charges that one itself, through
|
|
13
|
+
* `CallBudget.charged`. A failure is the remote's: the try fails, and the job tries again.
|
|
14
|
+
*/
|
|
15
|
+
export declare const SyncTransport: Schema.declare<(request: Request) => Effect.Effect<Response, GitError>, (request: Request) => Effect.Effect<Response, GitError>>;
|
|
16
|
+
export type SyncTransport = typeof SyncTransport.Type;
|
|
9
17
|
/**
|
|
10
18
|
* A remote as one try reaches it. Its `credentials` are short-lived: a provider makes them again
|
|
11
19
|
* for each try, and Git never stores or logs them. `transport` sends its requests in place of
|
|
12
|
-
*
|
|
13
|
-
* own `fetch`.
|
|
20
|
+
* Git's client: a service binding's `fetch`, say, or another server's own.
|
|
14
21
|
*/
|
|
15
22
|
export declare const SyncRemote: Schema.Struct<{
|
|
16
23
|
readonly url: Schema.String;
|
|
@@ -19,8 +26,8 @@ export declare const SyncRemote: Schema.Struct<{
|
|
|
19
26
|
readonly password: Schema.String;
|
|
20
27
|
}>, Schema.Struct<{
|
|
21
28
|
readonly token: Schema.String;
|
|
22
|
-
}>]>, Schema.declare<(
|
|
23
|
-
readonly transport: Schema.optionalKey<Schema.declare<(request: Request) =>
|
|
29
|
+
}>]>, Schema.declare<() => Effect.Effect<ClientCredential, GitError>, () => Effect.Effect<ClientCredential, GitError>>]>>;
|
|
30
|
+
readonly transport: Schema.optionalKey<Schema.declare<(request: Request) => Effect.Effect<Response, GitError>, (request: Request) => Effect.Effect<Response, GitError>>>;
|
|
24
31
|
}>;
|
|
25
32
|
export type SyncRemote = typeof SyncRemote.Type;
|
|
26
33
|
/** What a provider's webhook says moved: `repo` is the provider's own name for the remote. */
|
|
@@ -32,14 +39,16 @@ export declare const SyncTrigger: Schema.Struct<{
|
|
|
32
39
|
export type SyncTrigger = typeof SyncTrigger.Type;
|
|
33
40
|
/**
|
|
34
41
|
* A kind of remote, as the host sets it up once: `smartHttp()` or `github({ app })`. `remote`
|
|
35
|
-
* answers the URL and fresh credentials for one of its repos, and runs again at every try
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
42
|
+
* answers the URL and fresh credentials for one of its repos, and runs again at every try, in the
|
|
43
|
+
* try's fiber, so a request it sends to mint them is charged to the try's `CallBudget` through
|
|
44
|
+
* `CallBudget.charged`. One that fails or dies, or answers no credentials where the remote asks for
|
|
45
|
+
* them, fails that try, and the job's retry tries again; interrupting the try interrupts it.
|
|
46
|
+
* `access` is what the try does there: an import's reads, a mirror's pushes, so a provider mints
|
|
47
|
+
* credentials for that and no more.
|
|
39
48
|
*/
|
|
40
49
|
export interface SyncProvider {
|
|
41
50
|
readonly name: string;
|
|
42
|
-
readonly remote: (repo: string, access: 'read' | 'write'
|
|
51
|
+
readonly remote: (repo: string, access: 'read' | 'write') => Effect.Effect<SyncRemote, GitError>;
|
|
43
52
|
/**
|
|
44
53
|
* The top-level string fields of its remote's JSON refusal, status 400 or more, that a sync
|
|
45
54
|
* error may keep, such as `['message']`: each one the remote never fills with the request's
|
|
@@ -74,12 +83,15 @@ export type SyncSource = typeof SyncSource.Type;
|
|
|
74
83
|
* a host such as the GitHub drop-in publishes from the pull's record with `publishImported`.
|
|
75
84
|
*/
|
|
76
85
|
export declare const importedPullRefs = "refs/import/pull/";
|
|
77
|
-
/**
|
|
78
|
-
|
|
86
|
+
/**
|
|
87
|
+
* An import's phases, in order: `fetch` from the remote, `receive` into the repo, copy its Git LFS
|
|
88
|
+
* objects, `lfs`, on a server with `Lfs.layer`, and `publish` its refs.
|
|
89
|
+
*/
|
|
90
|
+
export declare const ImportPhase: Schema.Literals<readonly ["fetch", "receive", "lfs", "publish"]>;
|
|
79
91
|
export type ImportPhase = typeof ImportPhase.Type;
|
|
80
92
|
/** At most four measures, as `context.progress` takes them. */
|
|
81
93
|
export declare const ImportProgress: Schema.Struct<{
|
|
82
|
-
readonly phase: Schema.Literals<readonly ["fetch", "receive", "publish"]>;
|
|
94
|
+
readonly phase: Schema.Literals<readonly ["fetch", "receive", "lfs", "publish"]>;
|
|
83
95
|
readonly measures: Schema.$Array<Schema.Struct<{
|
|
84
96
|
readonly unit: Schema.Literals<readonly ["bytes", "objects", "entries", "packs"]>;
|
|
85
97
|
readonly completed: Schema.Number;
|
|
@@ -90,14 +102,17 @@ export type ImportProgress = typeof ImportProgress.Type;
|
|
|
90
102
|
export type ReportImportProgress = (progress: ImportProgress) => void | Promise<void>;
|
|
91
103
|
/**
|
|
92
104
|
* `repo` is created by the import. `source` names a provider `Sync.layer` was given, or the import
|
|
93
|
-
* is refused `INVALID_ARGUMENT`, reason `provider-unknown`, and nothing is written.
|
|
94
|
-
*
|
|
95
|
-
* the
|
|
96
|
-
* it
|
|
105
|
+
* is refused `INVALID_ARGUMENT`, reason `provider-unknown`, and nothing is written. `depth` copies
|
|
106
|
+
* only that many commits from each tip, as `git clone --depth` does, a whole number from 1 to
|
|
107
|
+
* `importDepthMost`: the oldest it copies become the repo's shallow roots, which every fetch names
|
|
108
|
+
* and every walk stops at. Left out, it copies the whole history, and a remote that is itself a
|
|
109
|
+
* shallow clone imports with its own roots. `key` is a write's: sent again, the import answers as
|
|
110
|
+
* it first did. Interrupting ends the wait, not the import: `cancelImport` stops it.
|
|
97
111
|
*/
|
|
98
112
|
export interface SyncImportInput extends Omit<WriteInput, 'signal'> {
|
|
99
113
|
readonly repo: RepoName;
|
|
100
114
|
readonly source: SyncSource;
|
|
115
|
+
readonly depth?: number;
|
|
101
116
|
readonly onProgress?: ReportImportProgress;
|
|
102
117
|
}
|
|
103
118
|
/**
|
|
@@ -105,11 +120,17 @@ export interface SyncImportInput extends Omit<WriteInput, 'signal'> {
|
|
|
105
120
|
* for a paused mirror, it resumes it. A `destination` naming a provider `Sync.layer` wasn't given is
|
|
106
121
|
* refused `INVALID_ARGUMENT`, reason `provider-unknown`, and so is a `ref` only Git's own writers
|
|
107
122
|
* move, such as one under `refs/queue/` or `refs/import/`. It takes no `key`: sent again, it saves
|
|
108
|
-
* the same mirror.
|
|
123
|
+
* the same mirror, as this call says, so one sent without `deletes` deletes no more.
|
|
109
124
|
*/
|
|
110
125
|
export interface SyncMirrorInput extends Omit<ActorInput, 'signal'>, RepoInput {
|
|
111
126
|
readonly destination: SyncSource;
|
|
112
127
|
readonly ref?: RefName;
|
|
128
|
+
/**
|
|
129
|
+
* Deletes the upstream's ref once `ref` is deleted here, as `git push --mirror` does, while the
|
|
130
|
+
* upstream is still at the mirror's last push: one pushed there since pauses it `diverged`.
|
|
131
|
+
* Left out, the upstream keeps its copy.
|
|
132
|
+
*/
|
|
133
|
+
readonly deletes?: boolean;
|
|
113
134
|
}
|
|
114
135
|
/**
|
|
115
136
|
* Why a mirror stopped: `diverged`, the upstream holds commits the ref doesn't; `refused`, the
|
|
@@ -121,16 +142,18 @@ export interface SyncMirrorInput extends Omit<ActorInput, 'signal'>, RepoInput {
|
|
|
121
142
|
export declare const MirrorPause: Schema.Literals<readonly ["diverged", "refused", "unseen"]>;
|
|
122
143
|
export type MirrorPause = typeof MirrorPause.Type;
|
|
123
144
|
/**
|
|
124
|
-
* A mirror of `ref`: `active`, or `paused` and why
|
|
125
|
-
*
|
|
145
|
+
* A mirror of `ref`: `active`, or `paused` and why, and `deletes` when `mirror` saved it so, left
|
|
146
|
+
* out otherwise. `lastPushed` is the last push its upstream took, kept across pauses and resumes to
|
|
147
|
+
* the same destination, and left out until one lands.
|
|
126
148
|
*/
|
|
127
149
|
export declare const MirrorState: Schema.Struct<{
|
|
128
150
|
readonly repo: Schema.String;
|
|
129
151
|
readonly ref: Schema.String;
|
|
130
152
|
readonly state: Schema.Literals<readonly ["active", "paused"]>;
|
|
153
|
+
readonly deletes: Schema.optionalKey<Schema.Literal<true>>;
|
|
131
154
|
readonly paused: Schema.optionalKey<Schema.Literals<readonly ["diverged", "refused", "unseen"]>>;
|
|
132
155
|
readonly lastPushed: Schema.optionalKey<Schema.Struct<{
|
|
133
|
-
readonly oid: Schema.String
|
|
156
|
+
readonly oid: Schema.NullOr<Schema.String>;
|
|
134
157
|
readonly at: Schema.Int;
|
|
135
158
|
}>>;
|
|
136
159
|
}>;
|
|
@@ -197,11 +220,18 @@ export declare const ImportJobData: Schema.Struct<{
|
|
|
197
220
|
readonly provider: Schema.String;
|
|
198
221
|
readonly repo: Schema.String;
|
|
199
222
|
}>;
|
|
223
|
+
readonly depth: Schema.optionalKey<Schema.Int>;
|
|
200
224
|
}>;
|
|
201
225
|
export type ImportJobData = typeof ImportJobData.Type;
|
|
202
|
-
/**
|
|
226
|
+
/**
|
|
227
|
+
* `sync.mirror`, one a destination, in the repo's scope, keyed by the destination's digest: each
|
|
228
|
+
* try pushes every ref whose mirror names it.
|
|
229
|
+
*/
|
|
203
230
|
export declare const MirrorJobData: Schema.Struct<{
|
|
204
|
-
readonly
|
|
231
|
+
readonly destination: Schema.Struct<{
|
|
232
|
+
readonly provider: Schema.String;
|
|
233
|
+
readonly repo: Schema.String;
|
|
234
|
+
}>;
|
|
205
235
|
}>;
|
|
206
236
|
export type MirrorJobData = typeof MirrorJobData.Type;
|
|
207
237
|
/**
|
|
@@ -210,6 +240,37 @@ export type MirrorJobData = typeof MirrorJobData.Type;
|
|
|
210
240
|
* failed, and `done` once its history is published. Only `done` holds the source's history.
|
|
211
241
|
*/
|
|
212
242
|
export type ImportState = 'running' | 'cancelled' | 'failed' | 'done';
|
|
243
|
+
/** Why an import kept no copy of a Git LFS object its history points at. */
|
|
244
|
+
export declare const ImportLfsReason: Schema.Literals<readonly ["not-found", "refused", "other-bytes", "too-large", "no-lfs"]>;
|
|
245
|
+
export type ImportLfsReason = typeof ImportLfsReason.Type;
|
|
246
|
+
/**
|
|
247
|
+
* An LFS object the source didn't give, `ImportStatus.lfs.missed` names: `not-found` where the
|
|
248
|
+
* source's batch said it holds none, `refused` where it answered another error for it, as one
|
|
249
|
+
* past its own size limit, `other-bytes` where the bytes it sent weren't the oid's, `too-large`
|
|
250
|
+
* where the pointer names more than LFS keeps, and `no-lfs` where the source serves no LFS API.
|
|
251
|
+
* The repo answers it as one never uploaded.
|
|
252
|
+
*/
|
|
253
|
+
export interface ImportLfsMissed {
|
|
254
|
+
readonly oid: string;
|
|
255
|
+
readonly size: number;
|
|
256
|
+
readonly reason: ImportLfsReason;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* A repo's import as `JoinedCalls.importState` reads it: its `state`, and, on a server with
|
|
260
|
+
* `Lfs.layer`, the Git LFS objects its history points at that it has copied, `copied` of them
|
|
261
|
+
* and `bytes`, and those it couldn't, `missing`, the first `importLfsMissedMost` of them by oid in
|
|
262
|
+
* `missed`. An import whose source misses an object still completes: the pointer is published,
|
|
263
|
+
* and the object answers 404, as it did at the source.
|
|
264
|
+
*/
|
|
265
|
+
export interface ImportStatus {
|
|
266
|
+
readonly state: ImportState;
|
|
267
|
+
readonly lfs?: {
|
|
268
|
+
readonly copied: number;
|
|
269
|
+
readonly bytes: number;
|
|
270
|
+
readonly missing: number;
|
|
271
|
+
readonly missed: readonly ImportLfsMissed[];
|
|
272
|
+
};
|
|
273
|
+
}
|
|
213
274
|
/** The feature's calls, bound to the server that built its Layer. */
|
|
214
275
|
export interface SyncCalls {
|
|
215
276
|
readonly import: (input: SyncImportInput) => Effect.Effect<RepoInfo, GitError>;
|
|
@@ -227,6 +288,7 @@ export declare const importRepo: (input: SyncImportInput) => Effect.Effect<{
|
|
|
227
288
|
readonly defaultBranch?: string;
|
|
228
289
|
readonly public: boolean;
|
|
229
290
|
readonly upstream?: string;
|
|
291
|
+
readonly shallow: boolean;
|
|
230
292
|
readonly stats: {
|
|
231
293
|
readonly repo: string;
|
|
232
294
|
readonly refs: number;
|
|
@@ -254,9 +316,10 @@ export declare const mirror: (input: SyncMirrorInput) => Effect.Effect<{
|
|
|
254
316
|
readonly repo: string;
|
|
255
317
|
readonly ref: string;
|
|
256
318
|
readonly state: "active" | "paused";
|
|
319
|
+
readonly deletes?: true;
|
|
257
320
|
readonly paused?: "diverged" | "refused" | "unseen";
|
|
258
321
|
readonly lastPushed?: {
|
|
259
|
-
readonly oid: string;
|
|
322
|
+
readonly oid: string | null;
|
|
260
323
|
readonly at: number;
|
|
261
324
|
};
|
|
262
325
|
}, GitError, Sync>;
|
|
@@ -264,9 +327,10 @@ export declare const mirrors: (input: SyncMirrorsInput) => Effect.Effect<readonl
|
|
|
264
327
|
readonly repo: string;
|
|
265
328
|
readonly ref: string;
|
|
266
329
|
readonly state: "active" | "paused";
|
|
330
|
+
readonly deletes?: true;
|
|
267
331
|
readonly paused?: "diverged" | "refused" | "unseen";
|
|
268
332
|
readonly lastPushed?: {
|
|
269
|
-
readonly oid: string;
|
|
333
|
+
readonly oid: string | null;
|
|
270
334
|
readonly at: number;
|
|
271
335
|
};
|
|
272
336
|
}[], GitError, Sync>;
|
package/dist/contracts/sync.mjs
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
import { Oid, RefName } from "./ids.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { FunctionValue } from "./opaque.mjs";
|
|
3
|
+
import { ClientCredentials } from "./remote.mjs";
|
|
3
4
|
import { WorkMeasure } from "./work.mjs";
|
|
4
5
|
import * as Effect from "effect/Effect";
|
|
5
6
|
import * as Schema from "effect/Schema";
|
|
6
7
|
import * as Context from "effect/Context";
|
|
7
|
-
|
|
8
|
+
// src/contracts/sync.ts
|
|
9
|
+
/**
|
|
10
|
+
* A sync remote's sender of one request, in place of Git's own client: an Effect, run in the try's
|
|
11
|
+
* fiber, so Git charges each call of it to the try's `CallBudget` as one subrequest before it
|
|
12
|
+
* runs, and a request it sends again, as a retry, charges that one itself, through
|
|
13
|
+
* `CallBudget.charged`. A failure is the remote's: the try fails, and the job tries again.
|
|
14
|
+
*/
|
|
15
|
+
const SyncTransport = /* @__PURE__ */ FunctionValue();
|
|
16
|
+
Schema.String, Schema.optionalKey(ClientCredentials), Schema.optionalKey(SyncTransport);
|
|
8
17
|
Schema.String;
|
|
9
18
|
/**
|
|
10
19
|
* A remote repo by its provider's `name` and the provider's own name for it, such as
|
|
@@ -21,13 +30,24 @@ const SyncSource = /* @__PURE__ */ Schema.Struct({
|
|
|
21
30
|
* a host such as the GitHub drop-in publishes from the pull's record with `publishImported`.
|
|
22
31
|
*/
|
|
23
32
|
const importedPullRefs = "refs/import/pull/";
|
|
24
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* An import's phases, in order: `fetch` from the remote, `receive` into the repo, copy its Git LFS
|
|
35
|
+
* objects, `lfs`, on a server with `Lfs.layer`, and `publish` its refs.
|
|
36
|
+
*/
|
|
25
37
|
const ImportPhase = /* @__PURE__ */ Schema.Literals([
|
|
26
38
|
"fetch",
|
|
27
39
|
"receive",
|
|
40
|
+
"lfs",
|
|
28
41
|
"publish"
|
|
29
42
|
]);
|
|
30
43
|
Schema.Array(WorkMeasure);
|
|
44
|
+
/** The deepest an import's `depth` asks: as deep as a segment's step grows, past which a history is whole in one. */
|
|
45
|
+
const importDepthMost = 1 << 20;
|
|
46
|
+
/** An import's `depth`: a whole number of commits from each tip, 1 to `importDepthMost`. */
|
|
47
|
+
const ImportDepth = /* @__PURE__ */ Schema.Int.check(Schema.isBetween({
|
|
48
|
+
minimum: 1,
|
|
49
|
+
maximum: importDepthMost
|
|
50
|
+
}));
|
|
31
51
|
/**
|
|
32
52
|
* Why a mirror stopped: `diverged`, the upstream holds commits the ref doesn't; `refused`, the
|
|
33
53
|
* upstream refused the push for another reason, such as a protected branch or a credential;
|
|
@@ -41,14 +61,14 @@ const MirrorPause = /* @__PURE__ */ Schema.Literals([
|
|
|
41
61
|
"unseen"
|
|
42
62
|
]);
|
|
43
63
|
/**
|
|
44
|
-
* A mirror's last push its upstream took: the ID the ref moved to there,
|
|
45
|
-
* the mirror sent it, or first found the upstream already at it.
|
|
64
|
+
* A mirror's last push its upstream took: the ID the ref moved to there, `null` for a delete, and
|
|
65
|
+
* when, by `Clock`: when the mirror sent it, or first found the upstream already at it.
|
|
46
66
|
*/
|
|
47
67
|
const MirrorPush = /* @__PURE__ */ Schema.Struct({
|
|
48
|
-
oid: Oid,
|
|
68
|
+
oid: Schema.NullOr(Oid),
|
|
49
69
|
at: Schema.Int
|
|
50
70
|
});
|
|
51
|
-
Schema.Literals(["active", "paused"]), Schema.optionalKey(MirrorPause), Schema.optionalKey(MirrorPush);
|
|
71
|
+
Schema.Literals(["active", "paused"]), Schema.optionalKey(Schema.Literal(true)), Schema.optionalKey(MirrorPause), Schema.optionalKey(MirrorPush);
|
|
52
72
|
Schema.Struct({
|
|
53
73
|
from: RefName,
|
|
54
74
|
oid: Oid,
|
|
@@ -60,9 +80,23 @@ Schema.Struct({
|
|
|
60
80
|
to: Schema.Null
|
|
61
81
|
});
|
|
62
82
|
/** `sync.import`, keyed `import`, in the repo's scope. */
|
|
63
|
-
const ImportJobData = /* @__PURE__ */ Schema.Struct({
|
|
64
|
-
|
|
65
|
-
|
|
83
|
+
const ImportJobData = /* @__PURE__ */ Schema.Struct({
|
|
84
|
+
source: SyncSource,
|
|
85
|
+
depth: Schema.optionalKey(ImportDepth)
|
|
86
|
+
});
|
|
87
|
+
/**
|
|
88
|
+
* `sync.mirror`, one a destination, in the repo's scope, keyed by the destination's digest: each
|
|
89
|
+
* try pushes every ref whose mirror names it.
|
|
90
|
+
*/
|
|
91
|
+
const MirrorJobData = /* @__PURE__ */ Schema.Struct({ destination: SyncSource });
|
|
92
|
+
/** Why an import kept no copy of a Git LFS object its history points at. */
|
|
93
|
+
const ImportLfsReason = /* @__PURE__ */ Schema.Literals([
|
|
94
|
+
"not-found",
|
|
95
|
+
"refused",
|
|
96
|
+
"other-bytes",
|
|
97
|
+
"too-large",
|
|
98
|
+
"no-lfs"
|
|
99
|
+
]);
|
|
66
100
|
/** Import and mirroring, present only when the host composes Sync.layer. */
|
|
67
101
|
var Sync = class extends (/* @__PURE__ */ Context.Service()("@ref0/git/Sync")) {};
|
|
68
102
|
const importRepo = (input) => Effect.flatMap(Sync, (sync) => sync.import(input));
|
|
@@ -71,4 +105,4 @@ const mirror = (input) => Effect.flatMap(Sync, (sync) => sync.mirror(input));
|
|
|
71
105
|
const mirrors = (input) => Effect.flatMap(Sync, (sync) => sync.mirrors(input));
|
|
72
106
|
const removeMirror = (input) => Effect.flatMap(Sync, (sync) => sync.removeMirror(input));
|
|
73
107
|
const publishImported = (input) => Effect.flatMap(Sync, (sync) => sync.publishImported(input));
|
|
74
|
-
export { ImportJobData, ImportPhase, MirrorJobData, MirrorPause, MirrorPush, Sync, SyncSource, cancelImport, importRepo, importedPullRefs, mirror, mirrors, publishImported, removeMirror };
|
|
108
|
+
export { ImportDepth, ImportJobData, ImportLfsReason, ImportPhase, MirrorJobData, MirrorPause, MirrorPush, Sync, SyncSource, SyncTransport, cancelImport, importDepthMost, importRepo, importedPullRefs, mirror, mirrors, publishImported, removeMirror };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { EffectCalls } from "./services.mjs";
|
|
2
|
-
import { GitError, Result } from "./result.mjs";
|
|
3
2
|
import { Caller, WriteInput } from "./actors.mjs";
|
|
4
3
|
import { Acting, ObjectInput } from "./blobs.mjs";
|
|
5
4
|
import { ReadOptions, Tag, TagFields } from "./engine.mjs";
|
|
6
5
|
import { RepoName } from "./ids.mjs";
|
|
7
6
|
import { RepoInput } from "./repos.mjs";
|
|
7
|
+
import { GitError } from "./result.mjs";
|
|
8
8
|
import * as Effect from "effect/Effect";
|
|
9
9
|
import * as Schema from "effect/Schema";
|
|
10
10
|
import * as Context from "effect/Context";
|
|
@@ -79,17 +79,17 @@ export declare const Peeled: Schema.Union<readonly [Schema.Struct<{
|
|
|
79
79
|
export type Peeled = typeof Peeled.Type;
|
|
80
80
|
export interface TagCalls {
|
|
81
81
|
/** An annotated tag, by its object's ID. */
|
|
82
|
-
readonly get: (repo: RepoName, input: Acting<ObjectInput>) =>
|
|
82
|
+
readonly get: (repo: RepoName, input: Acting<ObjectInput>) => Effect.Effect<Tag, GitError>;
|
|
83
83
|
/**
|
|
84
84
|
* Each of `oids` peeled to its commit, in one opened repo, as `Peeled` says: `answer[i]`
|
|
85
85
|
* answers `oids[i]`, duplicates included. A missing or hidden ID answers for its entry alone.
|
|
86
86
|
*/
|
|
87
|
-
readonly peel: (repo: RepoName, input: Acting<PeelInput>) =>
|
|
87
|
+
readonly peel: (repo: RepoName, input: Acting<PeelInput>) => Effect.Effect<readonly Peeled[], GitError>;
|
|
88
88
|
/** An annotated tag, written as its own commit; `refs.update` points `refs/tags/<tag>` at it. */
|
|
89
|
-
readonly create: (repo: RepoName, input: TagCreateInput) =>
|
|
89
|
+
readonly create: (repo: RepoName, input: TagCreateInput) => Effect.Effect<Tag, GitError>;
|
|
90
90
|
}
|
|
91
91
|
declare const Tags_base: Context.ServiceClass<Tags, "@ref0/git/Tags", EffectCalls<{
|
|
92
|
-
readonly get: (repo: string, input: Acting<ObjectInput>, by?: Caller<unknown> | undefined) =>
|
|
92
|
+
readonly get: (repo: string, input: Acting<ObjectInput>, by?: Caller<unknown> | undefined) => Effect.Effect<{
|
|
93
93
|
readonly oid: string;
|
|
94
94
|
readonly object: string;
|
|
95
95
|
readonly type: "blob" | "commit" | "tag" | "tree";
|
|
@@ -101,8 +101,8 @@ declare const Tags_base: Context.ServiceClass<Tags, "@ref0/git/Tags", EffectCall
|
|
|
101
101
|
readonly offset: number;
|
|
102
102
|
};
|
|
103
103
|
readonly message: string;
|
|
104
|
-
}
|
|
105
|
-
readonly peel: (repo: string, input: Acting<PeelInput>, by?: Caller<unknown> | undefined) =>
|
|
104
|
+
}, GitError, never>;
|
|
105
|
+
readonly peel: (repo: string, input: Acting<PeelInput>, by?: Caller<unknown> | undefined) => Effect.Effect<readonly ({
|
|
106
106
|
readonly found: true;
|
|
107
107
|
readonly oid: string;
|
|
108
108
|
readonly type: "blob" | "commit" | "tag" | "tree";
|
|
@@ -142,8 +142,8 @@ declare const Tags_base: Context.ServiceClass<Tags, "@ref0/git/Tags", EffectCall
|
|
|
142
142
|
} | {
|
|
143
143
|
readonly found: false;
|
|
144
144
|
readonly oid: string;
|
|
145
|
-
})[]
|
|
146
|
-
readonly create: (repo: string, input: TagCreateInput, by?: Caller<unknown> | undefined) =>
|
|
145
|
+
})[], GitError, never>;
|
|
146
|
+
readonly create: (repo: string, input: TagCreateInput, by?: Caller<unknown> | undefined) => Effect.Effect<{
|
|
147
147
|
readonly oid: string;
|
|
148
148
|
readonly object: string;
|
|
149
149
|
readonly type: "blob" | "commit" | "tag" | "tree";
|
|
@@ -155,7 +155,7 @@ declare const Tags_base: Context.ServiceClass<Tags, "@ref0/git/Tags", EffectCall
|
|
|
155
155
|
readonly offset: number;
|
|
156
156
|
};
|
|
157
157
|
readonly message: string;
|
|
158
|
-
}
|
|
158
|
+
}, GitError, never>;
|
|
159
159
|
}, never>>;
|
|
160
160
|
/**
|
|
161
161
|
* A repo's annotated tags: read, peeled and written. `TagCalls` as Effects, each deciding for `by`. The server builds it inside its runtime's
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Option from "effect/Option";
|
|
2
2
|
import * as EffectDuration from "effect/Duration";
|
|
3
|
-
// src/contracts/
|
|
3
|
+
// src/contracts/time.ts
|
|
4
4
|
/** `duration` in whole milliseconds, or a `TypeError` for a negative, endless or unreadable one. */
|
|
5
5
|
const millis = (duration) => {
|
|
6
6
|
const value = Option.match(EffectDuration.fromInput(duration), {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { GitError, Result } from "./result.mjs";
|
|
2
1
|
import { CallInput, NamedActor } from "./actors.mjs";
|
|
3
|
-
import {
|
|
2
|
+
import { GitError } from "./result.mjs";
|
|
4
3
|
import * as Effect from "effect/Effect";
|
|
5
4
|
import * as Schema from "effect/Schema";
|
|
6
5
|
import { Listing } from "@ref0/infra";
|
|
@@ -173,36 +172,30 @@ export interface TokenListInput extends CallInput, TokenList {}
|
|
|
173
172
|
export interface TrustedWriteInput extends CallInput {
|
|
174
173
|
readonly key?: string;
|
|
175
174
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
readonly
|
|
179
|
-
|
|
175
|
+
export interface VerifiedToken {
|
|
176
|
+
readonly actor: NamedActor;
|
|
177
|
+
readonly scope: TokenScope;
|
|
178
|
+
}
|
|
179
|
+
declare const Tokens_base: Context.ServiceClass<Tokens, "@ref0/git/Tokens", {
|
|
180
|
+
readonly create: (target: TokenTarget, input: TokenCreateInput) => Effect.Effect<CreatedToken, GitError>;
|
|
181
|
+
readonly list: (target: TokenTarget, input?: TokenListInput) => Effect.Effect<Listing<TokenRecord>, GitError>;
|
|
180
182
|
/**
|
|
181
183
|
* One token's record, as `list` answers it, with no secret: `NOT_FOUND` for an ID no token has.
|
|
182
184
|
* A caller's is asked as a list of the token's place, and a refused one is `NOT_FOUND` too.
|
|
183
185
|
*/
|
|
184
|
-
readonly get: (token: TokenId, input?: CallInput) =>
|
|
185
|
-
readonly revoke: (token: TokenId, input?: TrustedWriteInput) =>
|
|
186
|
+
readonly get: (token: TokenId, input?: CallInput) => Effect.Effect<TokenRecord, GitError>;
|
|
187
|
+
readonly revoke: (token: TokenId, input?: TrustedWriteInput) => Effect.Effect<void, GitError>;
|
|
186
188
|
/**
|
|
187
189
|
* Revokes the token `key` made, or holds `key` until `until` so a later create naming it fails
|
|
188
190
|
* `ALREADY_EXISTS`: an owner that may end before its token is minted revokes it in either order.
|
|
189
191
|
* A key past `maxWriteKeyLength` bytes in UTF-8 is `INVALID_ARGUMENT`.
|
|
190
192
|
*/
|
|
191
|
-
readonly revokeKey: (target: TokenTarget, key: string, input: TokenKeyInput) =>
|
|
192
|
-
}
|
|
193
|
-
export interface VerifiedToken {
|
|
194
|
-
readonly actor: NamedActor;
|
|
195
|
-
readonly scope: TokenScope;
|
|
196
|
-
}
|
|
197
|
-
/** Turns on Git's tokens: `tokens()`, from `@ref0/git/auth`. */
|
|
198
|
-
export interface TokensFeature {
|
|
199
|
-
readonly kind: 'tokens';
|
|
200
|
-
}
|
|
201
|
-
declare const Tokens_base: Context.ServiceClass<Tokens, "@ref0/git/Tokens", EffectCalls<TokenCalls, never>>;
|
|
193
|
+
readonly revokeKey: (target: TokenTarget, key: string, input: TokenKeyInput) => Effect.Effect<void, GitError>;
|
|
194
|
+
}>;
|
|
202
195
|
/**
|
|
203
|
-
* Git's own tokens
|
|
204
|
-
*
|
|
205
|
-
*
|
|
196
|
+
* Git's own tokens as Effects, deciding for no caller, as host code's do: direct calls trust host
|
|
197
|
+
* code; over REST, `auth` and `authorize` run first. `Tokens.layer()` provides it. Without it it
|
|
198
|
+
* isn't there, so code that may run without it reads it with `Effect.serviceOption`.
|
|
206
199
|
*/
|
|
207
200
|
export declare class Tokens extends /* @__PURE__ */ Tokens_base {}
|
|
208
201
|
export declare const create: (target: TokenTarget, input: TokenCreateInput) => Effect.Effect<{
|
|
@@ -104,9 +104,9 @@ const TokenList = /* @__PURE__ */ Schema.Struct({
|
|
|
104
104
|
page: Schema.optionalKey(Page)
|
|
105
105
|
});
|
|
106
106
|
/**
|
|
107
|
-
* Git's own tokens
|
|
108
|
-
*
|
|
109
|
-
*
|
|
107
|
+
* Git's own tokens as Effects, deciding for no caller, as host code's do: direct calls trust host
|
|
108
|
+
* code; over REST, `auth` and `authorize` run first. `Tokens.layer()` provides it. Without it it
|
|
109
|
+
* isn't there, so code that may run without it reads it with `Effect.serviceOption`.
|
|
110
110
|
*/
|
|
111
111
|
var Tokens = class extends (/* @__PURE__ */ Context.Service()("@ref0/git/Tokens")) {};
|
|
112
112
|
const create = (target, input) => Effect.flatMap(Effect.service(Tokens), (tokens) => tokens.create(target, input));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Duration } from "./
|
|
1
|
+
import { Duration } from "./time.mjs";
|
|
2
2
|
import { ActorInput, WriteInput } from "./actors.mjs";
|
|
3
3
|
import { HandlerOptions } from "./handlers.mjs";
|
|
4
4
|
import { TopicId } from "./ids.mjs";
|
|
@@ -267,9 +267,4 @@ export interface TopicsLayerOptions {
|
|
|
267
267
|
* drains of what's open.
|
|
268
268
|
*/
|
|
269
269
|
readonly waitTimeout?: Duration;
|
|
270
|
-
}
|
|
271
|
-
/** What `topics()` returns: the options it checked, which only `createGitServer` reads. */
|
|
272
|
-
export interface TopicsFactory {
|
|
273
|
-
readonly kind: 'topics';
|
|
274
|
-
readonly options: TopicsLayerOptions;
|
|
275
270
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { EffectCalls } from "./services.mjs";
|
|
2
|
-
import { GitError, Result } from "./result.mjs";
|
|
3
2
|
import { Caller, WriteInput } from "./actors.mjs";
|
|
4
3
|
import { Acting, CreatedObject } from "./blobs.mjs";
|
|
5
4
|
import { ReadOptions, ReadPage, TreeChanges, TreeDiffInput } from "./engine.mjs";
|
|
6
5
|
import { Oid, RepoName } from "./ids.mjs";
|
|
7
6
|
import { RepoInput } from "./repos.mjs";
|
|
7
|
+
import { GitError } from "./result.mjs";
|
|
8
8
|
import * as Effect from "effect/Effect";
|
|
9
9
|
import * as Schema from "effect/Schema";
|
|
10
10
|
import { Listing } from "@ref0/infra";
|
|
@@ -108,20 +108,20 @@ export declare const MergedTree: Schema.Struct<{
|
|
|
108
108
|
export type MergedTree = typeof MergedTree.Type;
|
|
109
109
|
export interface TreeCalls {
|
|
110
110
|
/** A tree's entries in Git's order; recursive, each folder before what it holds. */
|
|
111
|
-
readonly get: (repo: RepoName, input: Acting<TreeInput>) =>
|
|
111
|
+
readonly get: (repo: RepoName, input: Acting<TreeInput>) => Effect.Effect<Listing<TreeEntry>, GitError>;
|
|
112
112
|
/** Two trees' changes, as `git diff-tree -r -M` lists them. */
|
|
113
|
-
readonly diff: (repo: RepoName, input: Acting<TreeDiffInput>) =>
|
|
113
|
+
readonly diff: (repo: RepoName, input: Acting<TreeDiffInput>) => Effect.Effect<TreeChanges, GitError>;
|
|
114
114
|
/** A tree, written as its own commit with the blobs its edits' content makes. */
|
|
115
|
-
readonly create: (repo: RepoName, input: TreeCreateInput) =>
|
|
115
|
+
readonly create: (repo: RepoName, input: TreeCreateInput) => Effect.Effect<CreatedObject, GitError>;
|
|
116
116
|
/**
|
|
117
117
|
* A conflict fails `FAILED_PRECONDITION` with `merge-conflict`, its paths and their count.
|
|
118
118
|
* Without a base, commits that share no history fail `unrelated-histories`, and a virtual base
|
|
119
119
|
* the engine doesn't build as Git does fails `unsupported-virtual-base`.
|
|
120
120
|
*/
|
|
121
|
-
readonly merge: (repo: RepoName, input: PublicTreeMergeInput) =>
|
|
121
|
+
readonly merge: (repo: RepoName, input: PublicTreeMergeInput) => Effect.Effect<MergedTree, GitError>;
|
|
122
122
|
}
|
|
123
123
|
declare const Trees_base: Context.ServiceClass<Trees, "@ref0/git/Trees", EffectCalls<{
|
|
124
|
-
readonly get: (repo: string, input: Acting<TreeInput>, by?: Caller<unknown> | undefined) =>
|
|
124
|
+
readonly get: (repo: string, input: Acting<TreeInput>, by?: Caller<unknown> | undefined) => Effect.Effect<Listing<{
|
|
125
125
|
readonly name: string;
|
|
126
126
|
readonly path: string;
|
|
127
127
|
readonly mode: string;
|
|
@@ -129,15 +129,15 @@ declare const Trees_base: Context.ServiceClass<Trees, "@ref0/git/Trees", EffectC
|
|
|
129
129
|
readonly oid: string;
|
|
130
130
|
readonly size?: number;
|
|
131
131
|
readonly pathBytes?: Uint8Array<ArrayBufferLike>;
|
|
132
|
-
}
|
|
133
|
-
readonly diff: (repo: string, input: Acting<TreeDiffInput>, by?: Caller<unknown> | undefined) =>
|
|
134
|
-
readonly create: (repo: string, input: TreeCreateInput, by?: Caller<unknown> | undefined) =>
|
|
132
|
+
}>, GitError, never>;
|
|
133
|
+
readonly diff: (repo: string, input: Acting<TreeDiffInput>, by?: Caller<unknown> | undefined) => Effect.Effect<TreeChanges, GitError, never>;
|
|
134
|
+
readonly create: (repo: string, input: TreeCreateInput, by?: Caller<unknown> | undefined) => Effect.Effect<{
|
|
135
135
|
readonly oid: string;
|
|
136
|
-
}
|
|
137
|
-
readonly merge: (repo: string, input: PublicTreeMergeInput, by?: Caller<unknown> | undefined) =>
|
|
136
|
+
}, GitError, never>;
|
|
137
|
+
readonly merge: (repo: string, input: PublicTreeMergeInput, by?: Caller<unknown> | undefined) => Effect.Effect<{
|
|
138
138
|
readonly tree: string;
|
|
139
139
|
readonly renamesSkipped?: "memory-limit" | "rename-limit";
|
|
140
|
-
}
|
|
140
|
+
}, GitError, never>;
|
|
141
141
|
}, never>>;
|
|
142
142
|
/**
|
|
143
143
|
* A repo's trees: read, compared, written and merged. `TreeCalls` as Effects, each deciding for `by`. The server builds it inside its runtime's
|