@ref0/git 0.20.0 → 0.26.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 +1 -1
- package/dist/auth/access-jwt.mjs +3 -3
- package/dist/auth/auth-namespace.d.mts +3 -3
- package/dist/auth/auth-namespace.mjs +3 -2
- package/dist/auth/auth.d.mts +3 -3
- package/dist/auth/auth.mjs +9 -8
- package/dist/auth/authorize.mjs +1 -1
- package/dist/auth/fences.d.mts +1 -1
- package/dist/auth/host-function.mjs +1 -1
- package/dist/auth/host-services.mjs +4 -6
- package/dist/auth/identify.d.mts +1 -1
- package/dist/auth/identify.mjs +6 -0
- package/dist/auth/token-cleanup.mjs +2 -2
- package/dist/auth/token-rows.mjs +6 -1
- package/dist/auth/token-text.mjs +1 -1
- package/dist/auth/tokens-base.d.mts +1 -1
- package/dist/auth/tokens.d.mts +1 -1
- package/dist/auth/tokens.mjs +1 -1
- package/dist/client/client.d.mts +15 -7
- package/dist/client/client.mjs +21 -12
- package/dist/client/git-http.mjs +1 -1
- package/dist/client/local.mjs +60 -24
- package/dist/client/negotiate.mjs +3 -3
- package/dist/client/push-upload.mjs +26 -10
- package/dist/client/remote.mjs +4 -3
- package/dist/client/run-remote-helper.d.mts +2 -2
- package/dist/client/run-remote-helper.mjs +6 -6
- package/dist/client/slice-push.d.mts +1 -1
- package/dist/client/transport.mjs +3 -3
- package/dist/contracts/blobs.d.mts +3 -3
- package/dist/contracts/blobs.mjs +1 -1
- package/dist/contracts/calls-spent.mjs +5 -33
- package/dist/contracts/client.d.mts +15 -14
- package/dist/contracts/commits.d.mts +4 -4
- package/dist/contracts/commits.mjs +1 -1
- package/dist/contracts/engine.d.mts +2 -2
- package/dist/contracts/events.d.mts +1 -1
- package/dist/contracts/events.mjs +1 -1
- package/dist/contracts/files.d.mts +4 -4
- package/dist/contracts/files.mjs +1 -1
- package/dist/contracts/forks.d.mts +4 -4
- package/dist/contracts/forks.mjs +1 -1
- package/dist/contracts/git-hooks.d.mts +1 -1
- package/dist/contracts/git.d.mts +9 -5
- package/dist/contracts/grants.d.mts +1 -1
- package/dist/contracts/merges.d.mts +1 -1
- package/dist/contracts/object-values.d.mts +1 -0
- package/dist/contracts/object-values.mjs +16 -1
- package/dist/contracts/objects.d.mts +30 -18
- package/dist/contracts/opaque.mjs +1 -1
- package/dist/contracts/operations.mjs +1 -1
- package/dist/contracts/queue.d.mts +208 -44
- package/dist/contracts/queue.mjs +5 -5
- package/dist/contracts/refs.d.mts +5 -5
- package/dist/contracts/refs.mjs +1 -1
- package/dist/contracts/remote.d.mts +3 -6
- package/dist/contracts/repos.d.mts +3 -3
- package/dist/contracts/repos.mjs +1 -1
- package/dist/contracts/result.d.mts +10 -7
- package/dist/contracts/result.mjs +8 -3
- package/dist/contracts/rules.d.mts +13 -12
- package/dist/contracts/server.d.mts +8 -10
- package/dist/contracts/services.d.mts +6 -9
- package/dist/contracts/services.mjs +1 -2
- package/dist/contracts/signin.d.mts +1 -1
- package/dist/contracts/store.d.mts +2 -2
- package/dist/contracts/sync.d.mts +63 -6
- package/dist/contracts/sync.mjs +3 -2
- package/dist/contracts/tags.d.mts +3 -3
- package/dist/contracts/tags.mjs +1 -1
- package/dist/contracts/tokens.d.mts +2 -2
- package/dist/contracts/tokens.mjs +1 -1
- package/dist/contracts/topics.d.mts +9 -9
- package/dist/contracts/trees.d.mts +4 -4
- package/dist/contracts/trees.mjs +1 -1
- package/dist/contracts/work.d.mts +4 -4
- package/dist/contracts/work.mjs +2 -2
- package/dist/core/access.d.mts +1 -1
- package/dist/core/ancestry.mjs +30 -34
- package/dist/core/{promise.mjs → call-groups.mjs} +7 -30
- package/dist/core/call-services.mjs +1 -1
- package/dist/core/events/deliver.d.mts +2 -2
- package/dist/core/events/deliver.mjs +3 -3
- package/dist/core/events/retired.mjs +1 -1
- package/dist/core/forks.mjs +5 -5
- package/dist/core/hooks/groups.mjs +2 -2
- package/dist/core/imports.mjs +101 -21
- package/dist/core/index-job.mjs +14 -9
- package/dist/core/index-lost.d.mts +1 -1
- package/dist/core/loose-tally.mjs +38 -15
- package/dist/core/merge-parts.d.mts +17 -4
- package/dist/core/merge-parts.mjs +7 -2
- package/dist/core/mirror-rows.mjs +31 -1
- package/dist/core/objects/blobs.mjs +8 -10
- package/dist/core/objects/files.mjs +20 -17
- package/dist/core/objects/objects-layer.mjs +1 -1
- package/dist/core/objects/peel.mjs +1 -7
- package/dist/core/objects/reading.mjs +19 -18
- package/dist/core/objects/tree-edits.mjs +1 -1
- package/dist/core/objects/trees.mjs +257 -58
- package/dist/core/objects/writing.mjs +3 -9
- package/dist/core/own-writes.mjs +1 -1
- package/dist/core/parts.d.mts +8 -1
- package/dist/core/parts.mjs +8 -4
- package/dist/core/purge.mjs +31 -18
- package/dist/core/push.d.mts +2 -2
- package/dist/core/push.mjs +145 -98
- package/dist/core/receipts.d.mts +2 -2
- package/dist/core/receipts.mjs +9 -2
- package/dist/core/ref-index-job.mjs +4 -4
- package/dist/core/ref-view.mjs +74 -31
- package/dist/core/refs.mjs +3 -3
- package/dist/core/repack.mjs +25 -30
- package/dist/core/repo-info.mjs +1 -1
- package/dist/core/repos.mjs +1 -1
- package/dist/core/rules/changes.mjs +18 -40
- package/dist/core/rules/check.mjs +6 -5
- package/dist/core/rules/commit-changes.mjs +114 -58
- package/dist/core/rules/context.d.mts +3 -3
- package/dist/core/rules/context.mjs +18 -14
- package/dist/core/rules/fetch.mjs +1 -1
- package/dist/core/rules/protect.mjs +30 -17
- package/dist/core/saved-caller-views.d.mts +1 -1
- package/dist/core/saved-caller-views.mjs +3 -3
- package/dist/core/saved-callers.d.mts +1 -1
- package/dist/core/saved-callers.mjs +1 -1
- package/dist/core/seam.d.mts +1 -2
- package/dist/core/view.d.mts +6 -3
- package/dist/core/view.mjs +11 -10
- package/dist/core/work.mjs +2 -2
- package/dist/engine/allotted-xdiff.mjs +3 -16
- package/dist/engine/combined.d.mts +3 -0
- package/dist/engine/combined.mjs +200 -185
- package/dist/engine/content.d.mts +2 -2
- package/dist/engine/content.mjs +1 -1
- package/dist/engine/merge.mjs +7 -9
- package/dist/engine/reads.d.mts +2 -2
- package/dist/engine/reads.mjs +22 -14
- package/dist/engine/xdiff.d.mts +1 -1
- package/dist/engine/xdiff.mjs +1 -1
- 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 +2 -2
- package/dist/event-streams/stream.mjs +3 -3
- package/dist/extend.d.mts +2 -6
- package/dist/extend.mjs +1 -5
- package/dist/http/core-parts.mjs +83 -26
- package/dist/http/handler.mjs +54 -9
- package/dist/http/parts.d.mts +1 -0
- package/dist/http/push-upload-job.mjs +138 -24
- package/dist/http/push-uploads.mjs +2 -2
- package/dist/http/receive-pack.mjs +14 -53
- package/dist/http/request-snapshot.mjs +258 -0
- package/dist/http/upload-pack.mjs +23 -18
- package/dist/index.d.mts +29 -21
- package/dist/index.mjs +11 -2
- package/dist/lfs/base.d.mts +1 -1
- package/dist/lfs/copy.d.mts +49 -1
- package/dist/lfs/copy.mjs +135 -22
- package/dist/lfs/layer.d.mts +4 -3
- package/dist/lfs/layer.mjs +4 -5
- package/dist/lfs/locks.mjs +2 -2
- package/dist/lfs/objects.d.mts +1 -1
- package/dist/lfs/objects.mjs +3 -3
- package/dist/lfs/pointers.mjs +1 -1
- package/dist/lfs/rows.d.mts +1 -1
- package/dist/lfs/rows.mjs +11 -4
- package/dist/lfs/upkeep.mjs +40 -9
- package/dist/lfs/uploaded.mjs +1 -1
- package/dist/lfs/wire.mjs +1 -1
- package/dist/merges/merges.mjs +17 -2
- package/dist/protocol/bytes/buffers.d.mts +1 -1
- package/dist/protocol/bytes/buffers.mjs +1 -1
- package/dist/protocol/bytes/deflate.d.mts +1 -1
- package/dist/protocol/bytes/deflate.mjs +1 -1
- package/dist/protocol/bytes/inflate.d.mts +1 -1
- package/dist/protocol/bytes/inflate.mjs +1 -1
- package/dist/protocol/bytes/sha1.d.mts +1 -1
- package/dist/protocol/bytes/sha1.mjs +1 -1
- package/dist/protocol/diff/read.d.mts +2 -1
- package/dist/protocol/diff/read.mjs +102 -8
- package/dist/protocol/packs/graph.mjs +1 -1
- package/dist/protocol/packs/idx.d.mts +1 -1
- package/dist/protocol/packs/idx.mjs +1 -1
- package/dist/protocol/packs/parts.mjs +1 -1
- package/dist/protocol/packs/reader.d.mts +1 -1
- package/dist/protocol/packs/reader.mjs +1 -1
- package/dist/protocol/packs/write-error.d.mts +1 -1
- package/dist/protocol/packs/write-error.mjs +1 -1
- package/dist/protocol/packs/writer.mjs +3 -3
- package/dist/protocol/wire/advertisement.d.mts +1 -1
- package/dist/protocol/wire/advertisement.mjs +3 -2
- package/dist/protocol/wire/fetch.d.mts +1 -1
- package/dist/protocol/wire/fetch.mjs +1 -1
- package/dist/protocol/wire/lines.d.mts +9 -1
- package/dist/protocol/wire/lines.mjs +28 -1
- package/dist/protocol/wire/push-uploads.mjs +10 -7
- package/dist/protocol/wire/receive-pack.d.mts +1 -1
- package/dist/protocol/wire/receive-pack.mjs +1 -1
- package/dist/protocol/wire/report-status.d.mts +1 -1
- package/dist/protocol/wire/report-status.mjs +1 -1
- package/dist/protocol/wire/v2.d.mts +1 -1
- package/dist/protocol/wire/v2.mjs +1 -1
- package/dist/queue/advance.mjs +31 -24
- package/dist/queue/base.d.mts +5 -3
- package/dist/queue/calls.mjs +5 -5
- package/dist/queue/commit.mjs +1 -1
- package/dist/queue/host.d.mts +1 -1
- package/dist/queue/layer.d.mts +0 -1
- package/dist/queue/layer.mjs +9 -5
- package/dist/queue/schedule.mjs +1 -1
- package/dist/queue/search.mjs +1 -1
- package/dist/queue/state.mjs +1 -1
- package/dist/queue/trim.mjs +2 -2
- package/dist/rest/client.d.mts +1 -1
- package/dist/rest/client.mjs +6 -6
- package/dist/rest/errors.mjs +1 -1
- package/dist/rest/handler.mjs +2 -2
- package/dist/rest/handlers.mjs +16 -6
- package/dist/rest/layer.mjs +1 -1
- package/dist/rest/listen.mjs +2 -2
- package/dist/rest/refs.mjs +1 -1
- package/dist/server/edge.mjs +27 -3
- package/dist/server/git-layer.d.mts +1 -2
- package/dist/server/git-layer.mjs +4 -5
- package/dist/server/lifecycle.mjs +1 -1
- package/dist/server/registry.mjs +2 -8
- package/dist/server/server.mjs +62 -43
- package/dist/signin/context.d.mts +1 -1
- package/dist/signin/context.mjs +1 -1
- package/dist/signin/forms.mjs +1 -1
- package/dist/signin/grants.d.mts +2 -2
- package/dist/signin/grants.mjs +1 -1
- package/dist/signin/wire.mjs +1 -1
- package/dist/storage/allotted.mjs +4 -9
- package/dist/storage/batch-upkeep.mjs +31 -12
- package/dist/storage/batches.d.mts +2 -3
- package/dist/storage/batches.mjs +52 -49
- package/dist/storage/budget.mjs +23 -1
- package/dist/storage/calls.d.mts +1 -1
- package/dist/storage/calls.mjs +41 -43
- package/dist/storage/charged-cache.mjs +180 -0
- package/dist/storage/chunks.d.mts +3 -3
- package/dist/storage/chunks.mjs +121 -8
- package/dist/storage/counted-bucket.mjs +32 -10
- package/dist/storage/fetch-row-cache.d.mts +6 -0
- package/dist/storage/fetch-row-cache.mjs +211 -0
- package/dist/storage/fetch.d.mts +1 -0
- package/dist/storage/fetch.mjs +54 -242
- package/dist/storage/held-types.d.mts +0 -1
- package/dist/storage/held-types.mjs +13 -4
- package/dist/storage/host-bucket.mjs +9 -4
- package/dist/storage/index-bitmaps.mjs +340 -65
- package/dist/storage/index-build.d.mts +2 -3
- package/dist/storage/index-build.mjs +274 -56
- package/dist/storage/index-fetch.d.mts +3 -1
- package/dist/storage/index-fetch.mjs +60 -21
- package/dist/storage/index-graph.mjs +1 -1
- package/dist/storage/index-layers.mjs +55 -25
- package/dist/storage/index-reach.mjs +15 -22
- package/dist/storage/index-whole.d.mts +7 -0
- package/dist/storage/index-whole.mjs +145 -37
- package/dist/storage/largest-files.mjs +1 -7
- package/dist/storage/layout.mjs +17 -1
- package/dist/storage/lfs-pointers.mjs +1 -6
- package/dist/storage/link-join.mjs +55 -16
- package/dist/storage/list-source.d.mts +7 -0
- package/dist/storage/list-source.mjs +288 -0
- package/dist/storage/loose.d.mts +8 -8
- package/dist/storage/loose.mjs +157 -91
- package/dist/storage/memory-budget.mjs +226 -22
- package/dist/storage/merge-cut.mjs +9 -6
- package/dist/storage/merge-fence.mjs +1 -1
- package/dist/storage/merge-row.mjs +1 -1
- package/dist/storage/merge.d.mts +2 -3
- package/dist/storage/merge.mjs +2 -2
- package/dist/storage/object-rows.d.mts +3 -3
- package/dist/storage/object-rows.mjs +179 -38
- package/dist/storage/pack-order.mjs +97 -44
- package/dist/storage/pack-ranges.mjs +44 -16
- package/dist/storage/pack-reads.d.mts +5 -3
- package/dist/storage/pack-reads.mjs +236 -72
- package/dist/storage/pack-receive.d.mts +1 -2
- package/dist/storage/pack-receive.mjs +24 -18
- package/dist/storage/packs.d.mts +1 -1
- package/dist/storage/packs.mjs +477 -116
- package/dist/storage/placed-reads.mjs +33 -16
- package/dist/storage/prune-seen.mjs +1 -1
- package/dist/storage/prune-walk.mjs +1 -1
- package/dist/storage/prune.mjs +4 -31
- package/dist/storage/push-allotment.mjs +26 -14
- package/dist/storage/push-uploads.mjs +195 -57
- package/dist/storage/pushed-commits.mjs +20 -1
- package/dist/storage/quarantine.d.mts +2 -3
- package/dist/storage/range-cache.mjs +175 -40
- package/dist/storage/raw-ids.mjs +39 -10
- package/dist/storage/ready.d.mts +2 -3
- package/dist/storage/ready.mjs +114 -38
- package/dist/storage/receive-bounds.mjs +31 -9
- package/dist/storage/receive-cache.d.mts +7 -0
- package/dist/storage/receive-cache.mjs +147 -0
- package/dist/storage/receive-files.mjs +1 -1
- package/dist/storage/receive-links.mjs +1 -1
- package/dist/storage/receive-state.d.mts +2 -2
- package/dist/storage/receive-state.mjs +6 -8
- package/dist/storage/receive-steps.d.mts +20 -0
- package/dist/storage/receive-steps.mjs +298 -13
- package/dist/storage/repack-backlog.mjs +1 -6
- package/dist/storage/repack-contained.mjs +2 -2
- package/dist/storage/repack-job.mjs +1 -1
- package/dist/storage/repack.d.mts +2 -3
- package/dist/storage/repack.mjs +54 -9
- package/dist/storage/request-cache.mjs +57 -0
- package/dist/storage/roots.mjs +1 -24
- package/dist/storage/rows.d.mts +2 -2
- package/dist/storage/rows.mjs +1 -1
- package/dist/storage/runs.d.mts +2 -2
- package/dist/storage/runs.mjs +1 -1
- package/dist/storage/send-list.mjs +62 -25
- package/dist/storage/stream-whole.mjs +84 -63
- package/dist/storage/swap-walk.mjs +1 -1
- package/dist/storage/unpack.mjs +878 -450
- package/dist/storage/visible.mjs +110 -32
- package/dist/storage/walk.mjs +1 -0
- package/dist/storage/wants.mjs +22 -58
- package/dist/store/call-count.d.mts +2 -2
- package/dist/store/call-count.mjs +24 -11
- package/dist/store/catalogue.d.mts +1 -1
- package/dist/store/catalogue.mjs +19 -7
- package/dist/store/crossing.mjs +1 -7
- package/dist/store/cursor-seal.d.mts +1 -1
- package/dist/store/cursor-seal.mjs +1 -1
- package/dist/store/door.mjs +9 -4
- package/dist/store/errors.d.mts +2 -2
- package/dist/store/errors.mjs +107 -19
- package/dist/store/git-store.mjs +7 -2
- package/dist/store/job-try.mjs +90 -9
- package/dist/store/list-job.mjs +10 -34
- package/dist/store/outbox.d.mts +2 -2
- package/dist/store/outbox.mjs +2 -2
- package/dist/store/queue-jobs.mjs +6 -12
- package/dist/store/records.d.mts +2 -2
- package/dist/store/records.mjs +2 -2
- package/dist/store/ref-rows.d.mts +2 -2
- package/dist/store/ref-rows.mjs +2 -2
- package/dist/store/repo-record.d.mts +2 -2
- package/dist/store/repo-record.mjs +3 -3
- package/dist/store/request-snapshot.mjs +5 -0
- package/dist/store/reservations.mjs +2 -2
- package/dist/store/topic-jobs.mjs +5 -11
- package/dist/sync/bound.d.mts +3 -3
- package/dist/sync/bound.mjs +10 -7
- package/dist/sync/github.mjs +65 -67
- package/dist/sync/http.mjs +1 -1
- package/dist/sync/import.mjs +201 -66
- package/dist/sync/layer.d.mts +1 -1
- package/dist/sync/layer.mjs +6 -6
- package/dist/sync/lfs-batch.mjs +1 -1
- package/dist/sync/lfs-copy.mjs +175 -15
- package/dist/sync/mirror.mjs +5 -10
- package/dist/sync/said.mjs +1 -1
- package/dist/sync/step.mjs +268 -86
- package/dist/sync/tries.mjs +25 -6
- package/dist/sync.d.mts +2 -2
- package/dist/sync.mjs +2 -2
- package/dist/topics/advance.mjs +3 -3
- package/dist/topics/calls.mjs +1 -1
- package/dist/topics/layer.d.mts +15 -14
- package/dist/topics/members.mjs +1 -1
- package/dist/topics/topic.mjs +1 -1
- package/package.json +3 -13
- package/dist/auth/helpers.mjs +0 -17
- package/dist/auth.d.mts +0 -5
- package/dist/auth.mjs +0 -5
- package/dist/core/rules/commit-changes.d.mts +0 -12
- package/dist/effect.d.mts +0 -9
- package/dist/effect.mjs +0 -7
- package/dist/server/joined.d.mts +0 -70
- package/dist/server/joined.mjs +0 -41
|
@@ -85,6 +85,17 @@ const importOwner = Object.freeze({
|
|
|
85
85
|
owner: "import"
|
|
86
86
|
});
|
|
87
87
|
/**
|
|
88
|
+
* Git's own refs on a ref0 upstream, which no reader sees. Only a mirror's segment refs under it,
|
|
89
|
+
* `refs/ref0/mirror/<run>/<n>`, does a writer move: the mirror's own transport, pushed as a caller
|
|
90
|
+
* who reads every ref, and the target ref moves to them once they're whole (#2989, #3005).
|
|
91
|
+
*/
|
|
92
|
+
const ref0Owner = Object.freeze({
|
|
93
|
+
prefix: "refs/ref0/",
|
|
94
|
+
owner: "ref0"
|
|
95
|
+
});
|
|
96
|
+
/** Where a mirror pushes its segments, the one part of `refs/ref0/` a writer moves. */
|
|
97
|
+
const mirrorSegments = "refs/ref0/mirror/";
|
|
98
|
+
/**
|
|
88
99
|
* Git's own rows, beside each registered prefix's, which a server's registry adds at its seal: a
|
|
89
100
|
* client's table, and the one this module's public encoders read.
|
|
90
101
|
*/
|
|
@@ -92,6 +103,11 @@ const gitsOwnRefs = [{
|
|
|
92
103
|
owner: importOwner,
|
|
93
104
|
underPrefix: "hidden",
|
|
94
105
|
mover: "an import"
|
|
106
|
+
}, {
|
|
107
|
+
owner: ref0Owner,
|
|
108
|
+
underPrefix: "owned",
|
|
109
|
+
mover: "a mirror, under refs/ref0/mirror/,",
|
|
110
|
+
movedUnder: mirrorSegments
|
|
95
111
|
}];
|
|
96
112
|
/**
|
|
97
113
|
* A registered prefix's row, as the registry adds it for a registration with `refs`: listed for a prefix
|
|
@@ -115,6 +131,17 @@ const hiddenUnder = (table, name) => table.find((hidden) => name.startsWith(hidd
|
|
|
115
131
|
* a move of it no rule, hook, `ref.updated` or index update sees, and that owner's view sees it.
|
|
116
132
|
*/
|
|
117
133
|
const gitsOwnMove = (table, as, ref) => as !== void 0 && hiddenUnder(table, ref)?.owner === as;
|
|
134
|
+
/** Whether any writer moves `ref`: it's under its row's `movedUnder`, as a mirror's segment is. */
|
|
135
|
+
const anyoneMoves = (table, ref) => {
|
|
136
|
+
const under = hiddenUnder(table, ref)?.movedUnder;
|
|
137
|
+
return under !== void 0 && ref.startsWith(under);
|
|
138
|
+
};
|
|
139
|
+
/**
|
|
140
|
+
* Whether a write moves `ref` as Git's own: its owner's move, or any writer's under a row's
|
|
141
|
+
* `movedUnder`, as a mirror's segments, which no reader sees. No rule, hook, publish check,
|
|
142
|
+
* `ref.updated` or `pushedAt` sees it.
|
|
143
|
+
*/
|
|
144
|
+
const movesAsGitsOwn = (table, as, ref) => gitsOwnMove(table, as, ref) || anyoneMoves(table, ref);
|
|
118
145
|
/**
|
|
119
146
|
* Whether a host's own listing for `prefix` shows `name`, as `refs.list` does: a ref under a
|
|
120
147
|
* hidden prefix only for a prefix under it, of any kind, since the host's code asks for it.
|
|
@@ -135,4 +162,4 @@ const listsRef = (table, name, prefixes) => {
|
|
|
135
162
|
if (prefixes.length === 0) return hidden === void 0;
|
|
136
163
|
return prefixes.some((prefix) => name.startsWith(prefix) && (hidden === void 0 || hidden.underPrefix === "listed" && prefix.startsWith(hidden.owner.prefix)));
|
|
137
164
|
};
|
|
138
|
-
export { byName, decoded, encodeErr, fetchReaches, gitsOwnMove, gitsOwnRefs, hiddenUnder, hostLists, importOwner, isWord, listsRef, ownedAway, readSection, refusedText, registeredRow, textLines, unwritable };
|
|
165
|
+
export { anyoneMoves, byName, decoded, encodeErr, fetchReaches, gitsOwnMove, gitsOwnRefs, hiddenUnder, hostLists, importOwner, isWord, listsRef, mirrorSegments, movesAsGitsOwn, ownedAway, readSection, ref0Owner, refusedText, registeredRow, textLines, unwritable };
|
|
@@ -7,16 +7,19 @@
|
|
|
7
7
|
const pushUploadCapability = "push-upload";
|
|
8
8
|
/** The capability for `above`. */
|
|
9
9
|
const pushUploadOffer = (above) => `${pushUploadCapability}=${above}`;
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
const prefix = `${pushUploadCapability}=`;
|
|
10
|
+
const capNumber = (capabilities, name, nonzero) => {
|
|
11
|
+
const prefix = `${name}=`;
|
|
13
12
|
const offered = capabilities.find((capability) => capability.startsWith(prefix));
|
|
14
13
|
if (offered === void 0) return void 0;
|
|
15
14
|
const raw = offered.slice(prefix.length);
|
|
16
|
-
if (!/^[0-9]+$/.test(raw)) return void 0;
|
|
17
|
-
const
|
|
18
|
-
return Number.isSafeInteger(
|
|
15
|
+
if (!/^[0-9]+$/.test(raw) || nonzero && raw.startsWith("0")) return void 0;
|
|
16
|
+
const value = Number(raw);
|
|
17
|
+
return Number.isSafeInteger(value) ? value : void 0;
|
|
19
18
|
};
|
|
19
|
+
/** The size a receive-pack advertisement's capabilities offer the upload above, if they do. */
|
|
20
|
+
const pushUploadAbove = (capabilities) => capNumber(capabilities, pushUploadCapability, false);
|
|
21
|
+
/** The max pack bytes a receive-pack advertisement's `ref0-push-bytes=<most>` allows, if any. */
|
|
22
|
+
const pushBytesLimit = (capabilities) => capNumber(capabilities, "ref0-push-bytes", true);
|
|
20
23
|
/** `seconds` within `retryAfterLeast` and `retryAfterMost`, whole. */
|
|
21
24
|
const retryAfterOf = (seconds) => Math.min(Math.max(Math.ceil(seconds), 1), 10);
|
|
22
25
|
/**
|
|
@@ -29,4 +32,4 @@ const retryAfterOf = (seconds) => Math.min(Math.max(Math.ceil(seconds), 1), 10);
|
|
|
29
32
|
* report.
|
|
30
33
|
*/
|
|
31
34
|
const completeMost = 432e5;
|
|
32
|
-
export { completeMost, pushUploadAbove, pushUploadCapability, pushUploadOffer, retryAfterOf };
|
|
35
|
+
export { completeMost, pushBytesLimit, pushUploadAbove, pushUploadCapability, pushUploadOffer, retryAfterOf };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { WireDecodeError, WireEncodeError } from "../bytes/errors.mjs";
|
|
2
|
-
import * as Effect from "effect/Effect";
|
|
3
2
|
import * as Schema from "effect/Schema";
|
|
3
|
+
import * as Effect from "effect/Effect";
|
|
4
4
|
/**
|
|
5
5
|
* The start of a push: what Git sends to `git-receive-pack` before the pack itself, as
|
|
6
6
|
* `gitprotocol-pack` defines it. A server reads only this, then streams the rest of the body,
|
|
@@ -3,8 +3,8 @@ import { joinedBytes } from "../bytes/joined.mjs";
|
|
|
3
3
|
import { isOid, quoted } from "../bytes/text.mjs";
|
|
4
4
|
import { dataPkt, pktText, readPkt } from "../framing/pkt-line.mjs";
|
|
5
5
|
import { decoded, isWord, textLines, unwritable } from "./lines.mjs";
|
|
6
|
-
import * as Effect from "effect/Effect";
|
|
7
6
|
import * as Schema from "effect/Schema";
|
|
7
|
+
import * as Effect from "effect/Effect";
|
|
8
8
|
import * as Result from "effect/Result";
|
|
9
9
|
// src/protocol/wire/receive-pack.ts
|
|
10
10
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { WireDecodeError, WireEncodeError } from "../bytes/errors.mjs";
|
|
2
|
-
import * as Effect from "effect/Effect";
|
|
3
2
|
import * as Schema from "effect/Schema";
|
|
3
|
+
import * as Effect from "effect/Effect";
|
|
4
4
|
/**
|
|
5
5
|
* What `git-receive-pack` answers a push with: whether the pack unpacked, and each ref's
|
|
6
6
|
* result, `ok` or `ng` with a reason, as `report-status` and `report-status-v2` define it.
|
|
@@ -3,8 +3,8 @@ import { quoted } from "../bytes/text.mjs";
|
|
|
3
3
|
import { onBand } from "../framing/band.mjs";
|
|
4
4
|
import { flushPkt, pktText, readPkt } from "../framing/pkt-line.mjs";
|
|
5
5
|
import { decoded, isWord, textLines, unwritable } from "./lines.mjs";
|
|
6
|
-
import * as Effect from "effect/Effect";
|
|
7
6
|
import * as Schema from "effect/Schema";
|
|
7
|
+
import * as Effect from "effect/Effect";
|
|
8
8
|
import * as Result from "effect/Result";
|
|
9
9
|
// src/protocol/wire/report-status.ts
|
|
10
10
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { WireDecodeError, WireEncodeError } from "../bytes/errors.mjs";
|
|
2
2
|
import { ServedRefs } from "./advertisement.mjs";
|
|
3
3
|
import "./lines.mjs";
|
|
4
|
-
import * as Effect from "effect/Effect";
|
|
5
4
|
import * as Schema from "effect/Schema";
|
|
5
|
+
import * as Effect from "effect/Effect";
|
|
6
6
|
/**
|
|
7
7
|
* Protocol v2 as `git-upload-pack` serves it over smart HTTP: its capability advertisement, the
|
|
8
8
|
* requests that follow it, `command=<name>`, capabilities, a delim and the command's arguments,
|
|
@@ -4,8 +4,8 @@ import { isOid, quoted } from "../bytes/text.mjs";
|
|
|
4
4
|
import { delimPkt, pktText, readPkt } from "../framing/pkt-line.mjs";
|
|
5
5
|
import { AdvertisedRef, headOf, pastServiceLine, servedHead } from "./advertisement.mjs";
|
|
6
6
|
import { byName, decoded, gitsOwnRefs, isWord, listsRef, readSection, refusedText, textLines, unwritable } from "./lines.mjs";
|
|
7
|
-
import * as Effect from "effect/Effect";
|
|
8
7
|
import * as Schema from "effect/Schema";
|
|
8
|
+
import * as Effect from "effect/Effect";
|
|
9
9
|
import * as Result from "effect/Result";
|
|
10
10
|
// src/protocol/wire/v2.ts
|
|
11
11
|
/**
|
package/dist/queue/advance.mjs
CHANGED
|
@@ -34,13 +34,13 @@ import { blameGroup, failEntries, groupsOf, openSearched, passGroup, reportDetai
|
|
|
34
34
|
import { QueuePlan, entryNotes, loadTarget, openHolds, orderOf, storedId } from "./state.mjs";
|
|
35
35
|
import { AdvanceData, CandidateData, advanceName, buildName, buildRow, timeoutName, timeoutRow } from "../store/queue-jobs.mjs";
|
|
36
36
|
import { addTargetHold, advanceAfter, closeAll, closeCandidate, endEntry, entryOf, isOpen, movedOutside, releaseHold, removeEntry, stackOf, workHolds } from "./steps.mjs";
|
|
37
|
-
import * as Clock from "effect/Clock";
|
|
38
|
-
import * as Effect from "effect/Effect";
|
|
39
|
-
import * as Schema from "effect/Schema";
|
|
40
|
-
import * as Result from "effect/Result";
|
|
41
37
|
import { CurrentJob, Job } from "@ref0/infra";
|
|
38
|
+
import * as Schema from "effect/Schema";
|
|
39
|
+
import * as Effect from "effect/Effect";
|
|
42
40
|
import * as Predicate from "effect/Predicate";
|
|
43
41
|
import * as Context from "effect/Context";
|
|
42
|
+
import * as Result from "effect/Result";
|
|
43
|
+
import * as Clock from "effect/Clock";
|
|
44
44
|
// src/queue/advance.ts
|
|
45
45
|
/**
|
|
46
46
|
* The queue's jobs. `queue.advance`, one per target, moves it on a step at a time: a
|
|
@@ -66,6 +66,13 @@ const queueTry = (host, data, run) => Effect.flatMap(Effect.all([CurrentJob.curr
|
|
|
66
66
|
signal
|
|
67
67
|
}));
|
|
68
68
|
const overCore = (host, _context, step) => Effect.provideContext(step, host.needs);
|
|
69
|
+
/**
|
|
70
|
+
* Ends `run` cleanly when it failed `NOT_FOUND` because its repo was already deleted: once
|
|
71
|
+
* `record` is absent or marked `deleted`, retrying a queue job can only fail the same way, and
|
|
72
|
+
* pointless retries contend for the claim lock. Any other `NOT_FOUND` (while the repo is still
|
|
73
|
+
* live) and any other failure keep the job's retry policy.
|
|
74
|
+
*/
|
|
75
|
+
const endWhenDeleted = (context, internalId, run) => run.pipe(Effect.catch((error) => error.code !== "NOT_FOUND" ? Effect.fail(error) : readRecord(context.store, internalId).pipe(Effect.flatMap(({ record }) => record === void 0 || record.deleted === true ? Effect.succeed(void 0) : Effect.fail(error)))));
|
|
69
76
|
/** A plan's write by the queue itself, its rules skipped: the calls that led to it were checked. */
|
|
70
77
|
const queueOwn = (context, plan, answer) => ({
|
|
71
78
|
kind: "write",
|
|
@@ -905,10 +912,7 @@ const buildStep = /* @__PURE__ */ Effect.fnUntraced(function* (host$1, context,
|
|
|
905
912
|
const made = new MadeObjects();
|
|
906
913
|
const read = (input) => {
|
|
907
914
|
const object = made.get(input.oid);
|
|
908
|
-
return object === void 0 ? opened.read(input) :
|
|
909
|
-
kind: "success",
|
|
910
|
-
value: gitObjectOf(object)
|
|
911
|
-
});
|
|
915
|
+
return object === void 0 ? opened.read(input) : Effect.sync(() => gitObjectOf(object));
|
|
912
916
|
};
|
|
913
917
|
const links = landing ? row.entries : [...row.carried ?? [], ...row.entries];
|
|
914
918
|
const from = row.built?.linked ?? 0;
|
|
@@ -952,21 +956,24 @@ const buildStep = /* @__PURE__ */ Effect.fnUntraced(function* (host$1, context,
|
|
|
952
956
|
by
|
|
953
957
|
};
|
|
954
958
|
let first;
|
|
955
|
-
const
|
|
959
|
+
const unlinked = tried.unlinked?.candidate === id ? tried.unlinked : void 0;
|
|
956
960
|
const linkOf = Effect.fnUntraced(function* (entry, entryRow, onto) {
|
|
957
961
|
const key = yield* linkKey(linking, onto, entry, entryRow);
|
|
958
962
|
if (reached.at === from) first = {
|
|
959
963
|
entry,
|
|
960
964
|
key
|
|
961
965
|
};
|
|
962
|
-
if (
|
|
963
|
-
kind: "tooLarge",
|
|
964
|
-
summary: tooLarge.summary
|
|
965
|
-
}));
|
|
966
|
+
if (unlinked?.key === key) return yield* Effect.fail(linkFailed(entry, unlinked.failure));
|
|
966
967
|
const kept = last.get(key);
|
|
967
968
|
const before = made.count;
|
|
968
969
|
if (kept !== void 0) for (const { type, bytes } of kept.objects) yield* made.add(type, bytes);
|
|
969
|
-
const commit = kept?.commit ?? (yield* linkOnto(linking, entry, entryRow, onto))
|
|
970
|
+
const commit = kept?.commit ?? (yield* linkOnto(linking, entry, entryRow, onto).pipe(Effect.tapErrorTag("LinkFailed", ({ failure }) => Effect.sync(() => {
|
|
971
|
+
tried.unlinked = {
|
|
972
|
+
candidate: id,
|
|
973
|
+
key,
|
|
974
|
+
failure
|
|
975
|
+
};
|
|
976
|
+
}))));
|
|
970
977
|
by.set(key, {
|
|
971
978
|
commit,
|
|
972
979
|
objects: made.objects.slice(before)
|
|
@@ -988,16 +995,16 @@ const buildStep = /* @__PURE__ */ Effect.fnUntraced(function* (host$1, context,
|
|
|
988
995
|
if (reached.at > from) return Effect.succeed(reached);
|
|
989
996
|
if (first === void 0) return Effect.fail(error);
|
|
990
997
|
const { entry, key } = first;
|
|
991
|
-
const
|
|
992
|
-
|
|
998
|
+
const tooLarge = {
|
|
999
|
+
kind: "tooLarge",
|
|
1000
|
+
summary: `${entry} can't be linked within one build try: ${error.message}`
|
|
1001
|
+
};
|
|
1002
|
+
tried.unlinked = {
|
|
993
1003
|
candidate: id,
|
|
994
1004
|
key,
|
|
995
|
-
|
|
1005
|
+
failure: tooLarge
|
|
996
1006
|
};
|
|
997
|
-
return Effect.succeed({ failed: linkFailed(entry,
|
|
998
|
-
kind: "tooLarge",
|
|
999
|
-
summary
|
|
1000
|
-
}) });
|
|
1007
|
+
return Effect.succeed({ failed: linkFailed(entry, tooLarge) });
|
|
1001
1008
|
}));
|
|
1002
1009
|
const plan = new QueuePlan(state, now);
|
|
1003
1010
|
if ("failed" in built) {
|
|
@@ -1273,9 +1280,9 @@ const queueJobs = (host, onFailure) => {
|
|
|
1273
1280
|
const candidateOf = (job, context) => loadCandidate(context, jobRepo(job), job.data.candidate).pipe(Effect.map((loaded) => loaded?.state));
|
|
1274
1281
|
return [
|
|
1275
1282
|
queueTrimJob(host, onFailure),
|
|
1276
|
-
jobParts(AdvanceJob, (data) => queueTry(host, data, (job, context) => overCore(host, context, advance(host, job, context))), { onFailure: holdOnFailure(host, targetOf, onFailure, unbatch) }),
|
|
1277
|
-
jobParts(BuildJob, (data) => queueTry(host, data, (job, context) => Effect.asVoid(overCore(host, context, build(job, context)))), { onFailure: holdOnFailure(host, candidateOf, onFailure) }),
|
|
1278
|
-
jobParts(TimeoutJob, (data) => queueTry(host, data, (job, context) => Effect.asVoid(overCore(host, context, timeout(job, context)))), { onFailure: holdOnFailure(host, candidateOf, onFailure) })
|
|
1283
|
+
jobParts(AdvanceJob, (data) => queueTry(host, data, (job, context) => endWhenDeleted(context, jobRepo(job), overCore(host, context, advance(host, job, context)))), { onFailure: holdOnFailure(host, targetOf, onFailure, unbatch) }),
|
|
1284
|
+
jobParts(BuildJob, (data) => queueTry(host, data, (job, context) => Effect.asVoid(endWhenDeleted(context, jobRepo(job), overCore(host, context, build(job, context))))), { onFailure: holdOnFailure(host, candidateOf, onFailure) }),
|
|
1285
|
+
jobParts(TimeoutJob, (data) => queueTry(host, data, (job, context) => Effect.asVoid(endWhenDeleted(context, jobRepo(job), overCore(host, context, timeout(job, context))))), { onFailure: holdOnFailure(host, candidateOf, onFailure) })
|
|
1279
1286
|
];
|
|
1280
1287
|
};
|
|
1281
1288
|
export { checkPublish, queueJobs };
|
package/dist/queue/base.d.mts
CHANGED
|
@@ -3,13 +3,13 @@ import { InternalRepoId, RepoName } from "../contracts/ids.mjs";
|
|
|
3
3
|
import { MergeQueueCalls } from "../contracts/queue.mjs";
|
|
4
4
|
import { RefEdit, RefsUpdated } from "../contracts/refs.mjs";
|
|
5
5
|
import { GitError } from "../contracts/result.mjs";
|
|
6
|
-
import {
|
|
6
|
+
import { Needing } from "../contracts/services.mjs";
|
|
7
7
|
import { WorkFailed } from "../core/events/deliver.mjs";
|
|
8
8
|
import { QueueNeeds } from "../core/parts.mjs";
|
|
9
9
|
import { EntryAdderOf } from "../core/saved-caller-views.mjs";
|
|
10
10
|
import { QueueHost } from "./host.mjs";
|
|
11
|
-
import * as Effect from "effect/Effect";
|
|
12
11
|
import { Records } from "@ref0/infra";
|
|
12
|
+
import * as Effect from "effect/Effect";
|
|
13
13
|
import * as Context from "effect/Context";
|
|
14
14
|
/** The branches a push queues, once it's landed: the lines Git prints as `remote:` for them. */
|
|
15
15
|
export type QueuedBranches = (updated: RefsUpdated) => Effect.Effect<readonly string[]>;
|
|
@@ -32,7 +32,7 @@ export type QueuePush = (caller: Caller, repo: RepoName, edits: readonly RefEdit
|
|
|
32
32
|
export interface QueueAttached {
|
|
33
33
|
readonly host: QueueHost;
|
|
34
34
|
/** The `queue` group deciding for `bound`, as the server's other groups do. */
|
|
35
|
-
readonly calls: (bound?: Caller) =>
|
|
35
|
+
readonly calls: (bound?: Caller) => Needing<MergeQueueCalls, QueueNeeds>;
|
|
36
36
|
readonly push: QueuePush;
|
|
37
37
|
/** `SavedCallers.queueEntry`'s reader of who added an entry. */
|
|
38
38
|
readonly entryAdder: EntryAdderOf;
|
|
@@ -44,6 +44,8 @@ declare const QueueBase_base: Context.ServiceClass<QueueBase, "@ref0/git/queue/Q
|
|
|
44
44
|
/** The CPU one try may use, from the adapter's `RequestLimits`: none where it gives none. */
|
|
45
45
|
readonly cpuMs: number | undefined;
|
|
46
46
|
readonly attach: (queue: QueueAttached) => Effect.Effect<void>;
|
|
47
|
+
/** The server's door, which each of `MergeQueue`'s calls goes through, as core's do. */
|
|
48
|
+
readonly door: <A>(effect: Effect.Effect<A, GitError>) => Effect.Effect<A, GitError>;
|
|
47
49
|
}>;
|
|
48
50
|
/**
|
|
49
51
|
* What core hands `MergeQueue.layer`, inside the runtime only: the parts the queue runs over, what
|
package/dist/queue/calls.mjs
CHANGED
|
@@ -13,7 +13,7 @@ import { Changes } from "../core/changes.mjs";
|
|
|
13
13
|
import { unseenRef } from "../core/rules/check.mjs";
|
|
14
14
|
import { savedCallerOf } from "../core/saved-callers.mjs";
|
|
15
15
|
import { limitsOf } from "../engine/reads.mjs";
|
|
16
|
-
import { decodeRow,
|
|
16
|
+
import { decodeRow, storeCall } from "../store/errors.mjs";
|
|
17
17
|
import { keptKey } from "../store/records.mjs";
|
|
18
18
|
import { readRecord } from "../store/repo-record.mjs";
|
|
19
19
|
import { refuseLive, reservedTarget, topicMember } from "../store/reservations.mjs";
|
|
@@ -28,9 +28,9 @@ import { CandidateRow, EntryRow, HoldRow } from "./rows.mjs";
|
|
|
28
28
|
import { QueuePlan, entryNotes, loadTarget, openHolds, orderOf, readEntries, unknownId } from "./state.mjs";
|
|
29
29
|
import { noQueue } from "./base.mjs";
|
|
30
30
|
import { addTargetHold, advanceAfter, aheadOf, candidateOf, closeAll, closeCandidate, endSearch, entryOf, held, holdOf, isOpen, joinedAt, keyHoldsOf, releaseHold, removeEntry, setChecking, supersede } from "./steps.mjs";
|
|
31
|
-
import * as Clock from "effect/Clock";
|
|
32
|
-
import * as Effect from "effect/Effect";
|
|
33
31
|
import * as Schema from "effect/Schema";
|
|
32
|
+
import * as Effect from "effect/Effect";
|
|
33
|
+
import * as Clock from "effect/Clock";
|
|
34
34
|
// src/queue/calls.ts
|
|
35
35
|
const idKinds = {
|
|
36
36
|
e: {
|
|
@@ -362,8 +362,8 @@ const lanesFor = /* @__PURE__ */ Effect.fnUntraced(function* (caller, opened) {
|
|
|
362
362
|
const { between } = yield* Changes;
|
|
363
363
|
const diff = between({
|
|
364
364
|
objects: {
|
|
365
|
-
read: (_, at) =>
|
|
366
|
-
objects: (_, at) =>
|
|
365
|
+
read: (_, at) => repo.read(at),
|
|
366
|
+
objects: (_, at) => repo.batch(at)
|
|
367
367
|
},
|
|
368
368
|
listed: repo.listed,
|
|
369
369
|
from: tip ?? void 0,
|
package/dist/queue/commit.mjs
CHANGED
|
@@ -11,9 +11,9 @@ import { trimRow } from "../store/queue-jobs.mjs";
|
|
|
11
11
|
import { queueLimits, targetsFull } from "./limits.mjs";
|
|
12
12
|
import { noteAlone } from "./state.mjs";
|
|
13
13
|
import { CoreParts, asHost } from "../core/parts.mjs";
|
|
14
|
+
import * as Schema from "effect/Schema";
|
|
14
15
|
import * as Effect from "effect/Effect";
|
|
15
16
|
import * as Option from "effect/Option";
|
|
16
|
-
import * as Schema from "effect/Schema";
|
|
17
17
|
// src/queue/commit.ts
|
|
18
18
|
/** An answer as its receipt keeps it: every answer is built from JSON rows, so it is JSON. */
|
|
19
19
|
const asJson = /* @__PURE__ */ Schema.decodeUnknownSync(Schema.Json);
|
package/dist/queue/host.d.mts
CHANGED
|
@@ -3,8 +3,8 @@ import { RepoName } from "../contracts/ids.mjs";
|
|
|
3
3
|
import { MergeQueueOptions, QueueKeys } from "../contracts/queue.mjs";
|
|
4
4
|
import { GitError } from "../contracts/result.mjs";
|
|
5
5
|
import { QueueNeeds } from "../core/parts.mjs";
|
|
6
|
-
import * as Effect from "effect/Effect";
|
|
7
6
|
import { Records } from "@ref0/infra";
|
|
7
|
+
import * as Effect from "effect/Effect";
|
|
8
8
|
import * as Context from "effect/Context";
|
|
9
9
|
/**
|
|
10
10
|
* What the queue runs over, which `MergeQueue.layer` makes: the server's services, which its jobs
|
package/dist/queue/layer.d.mts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Git } from "../contracts/git.mjs";
|
|
2
2
|
import { MergeQueue, MergeQueueLayerOptions } from "../contracts/queue.mjs";
|
|
3
3
|
import { GitError } from "../contracts/result.mjs";
|
|
4
|
-
import "../contracts/services.mjs";
|
|
5
4
|
import { Merges } from "../core/merge-parts.mjs";
|
|
6
5
|
import { QueueBase } from "./base.mjs";
|
|
7
6
|
import { QueueInternals } from "./host.mjs";
|
package/dist/queue/layer.mjs
CHANGED
|
@@ -9,14 +9,18 @@ import { QueueInternals, queueKeysOf, queueOptions } from "./host.mjs";
|
|
|
9
9
|
import { buildMillisecondsOf } from "./limits.mjs";
|
|
10
10
|
import { queuePush } from "./push-option.mjs";
|
|
11
11
|
import * as Effect from "effect/Effect";
|
|
12
|
-
import * as Option from "effect/Option";
|
|
13
12
|
import * as Context from "effect/Context";
|
|
14
13
|
import * as Layer from "effect/Layer";
|
|
14
|
+
import * as Option from "effect/Option";
|
|
15
15
|
// src/queue/layer.ts
|
|
16
|
-
/**
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
/**
|
|
17
|
+
* `git.queue` over `host`, each call deciding for its `by`, over the host's parts and through the
|
|
18
|
+
* server's `door`, with the queue's `keys`.
|
|
19
|
+
*/
|
|
20
|
+
const queueService = (host, door) => {
|
|
21
|
+
const run = (by, call) => door(Effect.suspend(() => Effect.provideContext(acting(by, call(queueCalls(host, by))), host.needs)));
|
|
19
22
|
return {
|
|
23
|
+
keys: host.keys,
|
|
20
24
|
add: (repo, input, by) => run(by, (calls) => calls.add(repo, input)),
|
|
21
25
|
remove: (entry, input, by) => run(by, (calls) => calls.remove(entry, input)),
|
|
22
26
|
hold: (...[first, input, by]) => run(by, (calls) => calls.hold(...[first, input])),
|
|
@@ -64,7 +68,7 @@ const layer = (options) => {
|
|
|
64
68
|
push: queuePush(host),
|
|
65
69
|
entryAdder: entryAdderOf
|
|
66
70
|
});
|
|
67
|
-
return Context.make(MergeQueue, queueService(host)).pipe(Context.add(QueueInternals, host));
|
|
71
|
+
return Context.make(MergeQueue, queueService(host, base.door)).pipe(Context.add(QueueInternals, host));
|
|
68
72
|
}));
|
|
69
73
|
};
|
|
70
74
|
export { layer, queueService };
|
package/dist/queue/schedule.mjs
CHANGED
|
@@ -6,8 +6,8 @@ import { lanesNamed } from "./lanes.mjs";
|
|
|
6
6
|
import { entryNotes, orderOf } from "./state.mjs";
|
|
7
7
|
import { candidateOf, entryOf } from "./steps.mjs";
|
|
8
8
|
import { CoreParts } from "../core/parts.mjs";
|
|
9
|
-
import * as Effect from "effect/Effect";
|
|
10
9
|
import * as Schema from "effect/Schema";
|
|
10
|
+
import * as Effect from "effect/Effect";
|
|
11
11
|
import * as Predicate from "effect/Predicate";
|
|
12
12
|
// src/queue/schedule.ts
|
|
13
13
|
/** A target's last outcomes, as its row keeps them, oldest first. */
|
package/dist/queue/search.mjs
CHANGED
|
@@ -5,8 +5,8 @@ import { openCandidate } from "./calls.mjs";
|
|
|
5
5
|
import { lanesNamed, placeOf, placed } from "./lanes.mjs";
|
|
6
6
|
import { concurrencyOf, roomFor, schedulesOf } from "./schedule.mjs";
|
|
7
7
|
import { candidateOf, closeCandidate, endEntry, endSearch, isOpen, releaseEntry, setChecking } from "./steps.mjs";
|
|
8
|
-
import * as Effect from "effect/Effect";
|
|
9
8
|
import * as Schema from "effect/Schema";
|
|
9
|
+
import * as Effect from "effect/Effect";
|
|
10
10
|
// src/queue/search.ts
|
|
11
11
|
/** A report's summary and URL, for the events of the entries it failed. */
|
|
12
12
|
const reportDetails = (report) => {
|
package/dist/queue/state.mjs
CHANGED
|
@@ -9,8 +9,8 @@ import { collections, prunedKey } from "../store/scopes.mjs";
|
|
|
9
9
|
import { queueId } from "./ids.mjs";
|
|
10
10
|
import { placeOrder } from "./pages.mjs";
|
|
11
11
|
import { CandidateRow, CounterRow, EntryRow, HoldRow, KeyRow, MetaRow, ReportRow, TargetRow } from "./rows.mjs";
|
|
12
|
-
import * as Effect from "effect/Effect";
|
|
13
12
|
import * as Schema from "effect/Schema";
|
|
13
|
+
import * as Effect from "effect/Effect";
|
|
14
14
|
// src/queue/state.ts
|
|
15
15
|
/** The queue merges onto its target's tip whoever added the entry: it reads the repo whole. */
|
|
16
16
|
const queueWhole = /* @__PURE__ */ WholeRepo.mint();
|
package/dist/queue/trim.mjs
CHANGED
|
@@ -7,10 +7,10 @@ import { collections, jobRepo, newChangeId, repoScope } from "../store/scopes.mj
|
|
|
7
7
|
import { queueJobRetry, queueLimits } from "./limits.mjs";
|
|
8
8
|
import { CandidateRow, EntryRow, HoldRow, KeyRow, TargetRow } from "./rows.mjs";
|
|
9
9
|
import { keyRowId } from "./state.mjs";
|
|
10
|
-
import * as Clock from "effect/Clock";
|
|
11
|
-
import * as Effect from "effect/Effect";
|
|
12
10
|
import { CurrentJob, Job } from "@ref0/infra";
|
|
11
|
+
import * as Effect from "effect/Effect";
|
|
13
12
|
import * as Context from "effect/Context";
|
|
13
|
+
import * as Clock from "effect/Clock";
|
|
14
14
|
// src/queue/trim.ts
|
|
15
15
|
const phases = [
|
|
16
16
|
"targets",
|
package/dist/rest/client.d.mts
CHANGED
|
@@ -7,9 +7,9 @@ import { CreatedToken, TokenCreateInput, TokenTarget, Tokens } from "../contract
|
|
|
7
7
|
import { RestEvents } from "./listen.mjs";
|
|
8
8
|
import { Me } from "./me.mjs";
|
|
9
9
|
import * as Effect from "effect/Effect";
|
|
10
|
-
import * as HttpClient from "effect/http/HttpClient";
|
|
11
10
|
import * as Context from "effect/Context";
|
|
12
11
|
import * as Layer from "effect/Layer";
|
|
12
|
+
import * as HttpClient from "effect/http/HttpClient";
|
|
13
13
|
declare namespace client_d_exports {
|
|
14
14
|
export { RestClient, RestClientCalls, RestRepoCalls, RestTokenCalls, layer, make };
|
|
15
15
|
}
|
package/dist/rest/client.mjs
CHANGED
|
@@ -8,19 +8,19 @@ import { abortable, credentialHeader, credentialRefused, pauseOf, shouldRetry, u
|
|
|
8
8
|
import { jsonError, restFailure } from "./errors.mjs";
|
|
9
9
|
import { listenOver } from "./listen.mjs";
|
|
10
10
|
import { readableUrl } from "./paths.mjs";
|
|
11
|
-
import * as Effect from "effect/Effect";
|
|
12
|
-
import * as HttpClient from "effect/http/HttpClient";
|
|
13
|
-
import * as HttpClientResponse from "effect/http/HttpClientResponse";
|
|
14
|
-
import * as Option from "effect/Option";
|
|
15
11
|
import * as Schema from "effect/Schema";
|
|
16
|
-
import * as
|
|
12
|
+
import * as Effect from "effect/Effect";
|
|
17
13
|
import * as Predicate from "effect/Predicate";
|
|
14
|
+
import * as Stream from "effect/Stream";
|
|
18
15
|
import * as Context from "effect/Context";
|
|
19
16
|
import * as Layer from "effect/Layer";
|
|
20
|
-
import * as
|
|
17
|
+
import * as Option from "effect/Option";
|
|
18
|
+
import * as Exit from "effect/Exit";
|
|
19
|
+
import * as HttpClient from "effect/http/HttpClient";
|
|
21
20
|
import * as Scope from "effect/Scope";
|
|
22
21
|
import * as FetchHttpClient from "effect/http/FetchHttpClient";
|
|
23
22
|
import * as HttpClientRequest from "effect/http/HttpClientRequest";
|
|
23
|
+
import * as HttpClientResponse from "effect/http/HttpClientResponse";
|
|
24
24
|
import * as HttpClientError from "effect/http/HttpClientError";
|
|
25
25
|
import { HttpApiClient } from "effect/http-api";
|
|
26
26
|
// src/rest/client.ts
|
package/dist/rest/errors.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ContextValue, GitErrorBody, gitError, gitErrorBodies, gitErrorFrom, httpStatus, isGitErrorCode, refusalCodeHeader } from "../contracts/result.mjs";
|
|
2
2
|
import { bodyStart, dropped } from "../client/transport.mjs";
|
|
3
|
+
import * as Schema from "effect/Schema";
|
|
3
4
|
import * as Effect from "effect/Effect";
|
|
4
5
|
import * as Option from "effect/Option";
|
|
5
|
-
import * as Schema from "effect/Schema";
|
|
6
6
|
import { HttpApiSchema } from "effect/http-api";
|
|
7
7
|
import * as SchemaAST from "effect/SchemaAST";
|
|
8
8
|
// src/rest/errors.ts
|
package/dist/rest/handler.mjs
CHANGED
|
@@ -9,11 +9,11 @@ import { normalBase, restPath, wireRepoPath } from "./paths.mjs";
|
|
|
9
9
|
import { exitIn, noCall } from "../store/crossing.mjs";
|
|
10
10
|
import { answerSpent } from "../store/errors.mjs";
|
|
11
11
|
import "effect/Effect";
|
|
12
|
+
import * as Context from "effect/Context";
|
|
13
|
+
import * as Layer from "effect/Layer";
|
|
12
14
|
import * as Option from "effect/Option";
|
|
13
15
|
import * as Cause from "effect/Cause";
|
|
14
16
|
import * as Exit from "effect/Exit";
|
|
15
|
-
import * as Context from "effect/Context";
|
|
16
|
-
import * as Layer from "effect/Layer";
|
|
17
17
|
import { HttpApiBuilder } from "effect/http-api";
|
|
18
18
|
import * as HttpRouter from "effect/http/HttpRouter";
|
|
19
19
|
import * as HttpServer from "effect/http/HttpServer";
|
package/dist/rest/handlers.mjs
CHANGED
|
@@ -14,9 +14,9 @@ import { GitCallerMiddleware, GitRestServices, IncomingRequest } from "./caller.
|
|
|
14
14
|
import { sseResponse } from "./events.mjs";
|
|
15
15
|
import { answerSpent } from "../store/errors.mjs";
|
|
16
16
|
import * as Effect from "effect/Effect";
|
|
17
|
-
import * as Option from "effect/Option";
|
|
18
|
-
import * as Layer from "effect/Layer";
|
|
19
17
|
import * as Stream from "effect/Stream";
|
|
18
|
+
import * as Layer from "effect/Layer";
|
|
19
|
+
import * as Option from "effect/Option";
|
|
20
20
|
import { HttpApiBuilder, HttpApiSchema } from "effect/http-api";
|
|
21
21
|
import * as HttpServerRequest from "effect/http/HttpServerRequest";
|
|
22
22
|
import { HttpApiSchemaError } from "effect/http-api/HttpApiError";
|
|
@@ -354,9 +354,14 @@ const BlobsHandlers = HttpApiBuilder.group(GitRestApi, "blobs", (handlers) => ha
|
|
|
354
354
|
});
|
|
355
355
|
})));
|
|
356
356
|
const TreesHandlers = HttpApiBuilder.group(GitRestApi, "trees", (handlers) => handlers.handle("get", ({ params, query }) => Effect.gen(function* () {
|
|
357
|
-
|
|
357
|
+
const server = yield* callsFor;
|
|
358
|
+
const limit = query.limit === void 0 ? {} : { limit: Math.min(query.limit, 200) };
|
|
359
|
+
return yield* server.trees.get(params.repo, {
|
|
358
360
|
oid: params.oid,
|
|
359
|
-
...readInput(
|
|
361
|
+
...readInput({
|
|
362
|
+
...query,
|
|
363
|
+
...limit
|
|
364
|
+
}),
|
|
360
365
|
actor: yield* actor
|
|
361
366
|
});
|
|
362
367
|
})).handle("diff", ({ params, payload }) => Effect.gen(function* () {
|
|
@@ -448,8 +453,13 @@ const MergesHandlers = HttpApiBuilder.group(GitRestApi, "merges", (handlers) =>
|
|
|
448
453
|
});
|
|
449
454
|
})));
|
|
450
455
|
const FilesHandlers = HttpApiBuilder.group(GitRestApi, "files", (handlers) => handlers.handle("list", ({ params, query }) => Effect.gen(function* () {
|
|
451
|
-
|
|
452
|
-
|
|
456
|
+
const server = yield* callsFor;
|
|
457
|
+
const limit = query.limit === void 0 ? {} : { limit: Math.min(query.limit, 200) };
|
|
458
|
+
return yield* server.files.list(params.repo, {
|
|
459
|
+
...readInput({
|
|
460
|
+
...query,
|
|
461
|
+
...limit
|
|
462
|
+
}),
|
|
453
463
|
actor: yield* actor
|
|
454
464
|
});
|
|
455
465
|
})).handle("read", ({ params, payload }) => Effect.gen(function* () {
|
package/dist/rest/layer.mjs
CHANGED
|
@@ -5,9 +5,9 @@ import { ServedParts } from "../core/seam.mjs";
|
|
|
5
5
|
import { GitRestServices } from "./caller.mjs";
|
|
6
6
|
import { notFound, restApp } from "./handler.mjs";
|
|
7
7
|
import * as Effect from "effect/Effect";
|
|
8
|
-
import * as Option from "effect/Option";
|
|
9
8
|
import * as Context from "effect/Context";
|
|
10
9
|
import * as Layer from "effect/Layer";
|
|
10
|
+
import * as Option from "effect/Option";
|
|
11
11
|
// src/rest/layer.ts
|
|
12
12
|
var layer_exports = /* @__PURE__ */ __exportAll({ layer: () => layer });
|
|
13
13
|
/** REST's URLs under `<base>`, as `restPath` owns them: each a route of the `rest` registration. */
|
package/dist/rest/listen.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { gitError } from "../contracts/result.mjs";
|
|
2
2
|
import { RepoStreamEvent, StreamEnd } from "./wire.mjs";
|
|
3
|
-
import * as Effect from "effect/Effect";
|
|
4
|
-
import * as Option from "effect/Option";
|
|
5
3
|
import * as Schema from "effect/Schema";
|
|
4
|
+
import * as Effect from "effect/Effect";
|
|
6
5
|
import * as Predicate from "effect/Predicate";
|
|
7
6
|
import * as Stream from "effect/Stream";
|
|
7
|
+
import * as Option from "effect/Option";
|
|
8
8
|
import * as Sse from "effect/encoding/Sse";
|
|
9
9
|
// src/rest/listen.ts
|
|
10
10
|
/** The first pause before opening again a connection that sent no event, doubled up to 9 s. */
|
package/dist/rest/refs.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Listing } from "../contracts/engine.mjs";
|
|
2
1
|
import { Ref, RefCount, RefCountFields, RefList, RefOutcome, RefProtection, RefsProtections, RefsSees, RefsUpdate } from "../contracts/refs.mjs";
|
|
2
|
+
import { Listing } from "../contracts/engine.mjs";
|
|
3
3
|
import { GitCallerMiddleware } from "./caller.mjs";
|
|
4
4
|
import { GitErrors } from "./errors.mjs";
|
|
5
5
|
import { PageQuery, RepoParam, WriteKey } from "./wire.mjs";
|
package/dist/server/edge.mjs
CHANGED
|
@@ -2,12 +2,27 @@ import { handle } from "../contracts/git.mjs";
|
|
|
2
2
|
import { gitError } from "../contracts/result.mjs";
|
|
3
3
|
import { refusal } from "../http/answers.mjs";
|
|
4
4
|
import { buildRefused, retries, retryDelay } from "./lifecycle.mjs";
|
|
5
|
+
import { HostRuntime } from "@ref0/infra";
|
|
5
6
|
import * as Effect from "effect/Effect";
|
|
7
|
+
import * as Layer from "effect/Layer";
|
|
6
8
|
import * as Cause from "effect/Cause";
|
|
7
9
|
import * as Exit from "effect/Exit";
|
|
8
|
-
import
|
|
9
|
-
import * as Layer from "effect/Layer";
|
|
10
|
+
import * as Tracer from "effect/Tracer";
|
|
10
11
|
// src/server/edge.ts
|
|
12
|
+
/** A W3C `traceparent` header's trace, span, and flags: `00-<trace>-<span>-<flags>`. */
|
|
13
|
+
const traceparentPattern = /^00-([\da-f]{32})-([\da-f]{16})-([\da-f]{2})$/;
|
|
14
|
+
const zeroTraceId = "00000000000000000000000000000000";
|
|
15
|
+
const zeroSpanId = "0000000000000000";
|
|
16
|
+
/** The caller's external span from `request`'s `traceparent` header, when valid (#3019). */
|
|
17
|
+
const parentOf = (request) => {
|
|
18
|
+
const [, traceId, spanId, flags] = traceparentPattern.exec(request.headers.get("traceparent") ?? "") ?? [];
|
|
19
|
+
if (traceId === void 0 || spanId === void 0 || flags === void 0 || traceId === zeroTraceId || spanId === zeroSpanId) return;
|
|
20
|
+
return Tracer.externalSpan({
|
|
21
|
+
traceId,
|
|
22
|
+
spanId,
|
|
23
|
+
sampled: (Number.parseInt(flags, 16) & 1) === 1
|
|
24
|
+
});
|
|
25
|
+
};
|
|
11
26
|
/**
|
|
12
27
|
* A host's one runtime over `layer`, `Git.layer` and its adapter, which every entry, object class,
|
|
13
28
|
* job runner and direct run shares: it builds on its first use, and again on a fresh runtime after
|
|
@@ -36,7 +51,16 @@ const runtime = (layer) => {
|
|
|
36
51
|
* disposes of it; `toFetch` builds nothing of its own.
|
|
37
52
|
*/
|
|
38
53
|
const toFetch = (host) => async (request) => {
|
|
39
|
-
const
|
|
54
|
+
const parent = parentOf(request);
|
|
55
|
+
const attributes = {
|
|
56
|
+
"http.method": request.method,
|
|
57
|
+
"url.path": new URL(request.url).pathname
|
|
58
|
+
};
|
|
59
|
+
const traced = handle(request).pipe(Effect.tap((response) => Effect.annotateCurrentSpan("http.status_code", response.status)), Effect.withSpan("git.fetch", parent === void 0 ? { attributes } : {
|
|
60
|
+
attributes,
|
|
61
|
+
parent
|
|
62
|
+
}));
|
|
63
|
+
const answer = await host.runPromiseExit(traced, { signal: request.signal });
|
|
40
64
|
if (Exit.isSuccess(answer)) return answer.value;
|
|
41
65
|
if (request.signal.aborted && Cause.hasInterruptsOnly(answer.cause)) return new Response(null, { status: 499 });
|
|
42
66
|
return refusal(buildRefused(host.state()) ?? gitError("INTERNAL", "The server failed"));
|