@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
|
@@ -7,13 +7,13 @@ import { completeMost, pushUploadAbove } from "../protocol/wire/push-uploads.mjs
|
|
|
7
7
|
import { readableIn } from "../store/crossing.mjs";
|
|
8
8
|
import { emptyReadsMost } from "./answer.mjs";
|
|
9
9
|
import { heldBody } from "./git-http.mjs";
|
|
10
|
-
import * as Clock from "effect/Clock";
|
|
11
10
|
import * as Effect from "effect/Effect";
|
|
11
|
+
import * as Stream from "effect/Stream";
|
|
12
|
+
import * as Context from "effect/Context";
|
|
12
13
|
import * as Option from "effect/Option";
|
|
13
14
|
import * as Cause from "effect/Cause";
|
|
14
15
|
import * as Result from "effect/Result";
|
|
15
|
-
import * as
|
|
16
|
-
import * as Stream from "effect/Stream";
|
|
16
|
+
import * as Clock from "effect/Clock";
|
|
17
17
|
import * as Duration from "effect/Duration";
|
|
18
18
|
// src/client/push-upload.ts
|
|
19
19
|
/** The most of a begin's or a part's JSON answer read. */
|
|
@@ -54,12 +54,18 @@ const packChanged = /* @__PURE__ */ gitError("UNAVAILABLE", "The local repo's pa
|
|
|
54
54
|
const packStalled = /* @__PURE__ */ gitError("UNAVAILABLE", `The local repo's pack gave ${emptyReadsMost} empty reads in a row`, { hint: "Push again" });
|
|
55
55
|
/** A read of `reader` that tells a spent call bound from the rest, as `heldBody`'s does. */
|
|
56
56
|
const readOf = (reader) => tryUnlessSpent(() => reader.read(), packUnread);
|
|
57
|
+
/** A pack past what the remote advertised in `ref0-push-bytes`, refused locally before slicing. */
|
|
58
|
+
const packPastLimit = (limit) => gitError("RESOURCE_EXHAUSTED", `The push's pack is past the remote's ${limit} byte limit`, {
|
|
59
|
+
hint: "Push fewer commits at a time, or track large files with Git LFS",
|
|
60
|
+
context: { reason: "too-large" }
|
|
61
|
+
});
|
|
57
62
|
/**
|
|
58
63
|
* `pack` read to its end: its chunks held when it ends within `most` bytes, else only counted, the
|
|
59
|
-
* chunks dropped once past `most`, so it holds at most `most` and a chunk.
|
|
60
|
-
* `
|
|
64
|
+
* chunks dropped once past `most`, so it holds at most `most` and a chunk. Fails `packPastLimit`
|
|
65
|
+
* immediately when `stopAbove` is given and `bytes` passes it. More than `emptyReadsMost` empty
|
|
66
|
+
* reads in a row refuse it.
|
|
61
67
|
*/
|
|
62
|
-
const heldOrCounted = (pack, most) => Effect.scoped(Effect.gen(function* () {
|
|
68
|
+
const heldOrCounted = (pack, most, stopAbove) => Effect.scoped(Effect.gen(function* () {
|
|
63
69
|
const reader = yield* scopedReader(pack);
|
|
64
70
|
let held = [];
|
|
65
71
|
let bytes = 0;
|
|
@@ -74,6 +80,7 @@ const heldOrCounted = (pack, most) => Effect.scoped(Effect.gen(function* () {
|
|
|
74
80
|
}
|
|
75
81
|
empties = 0;
|
|
76
82
|
bytes += next.value.byteLength;
|
|
83
|
+
if (stopAbove !== void 0 && bytes > stopAbove) return yield* Effect.fail(packPastLimit(stopAbove));
|
|
77
84
|
if (bytes > most) held = void 0;
|
|
78
85
|
else held?.push(next.value);
|
|
79
86
|
}
|
|
@@ -144,14 +151,23 @@ const streamOf = (pack) => Stream.fromReadableStream({
|
|
|
144
151
|
evaluate: () => pack,
|
|
145
152
|
onError: (cause) => cause
|
|
146
153
|
});
|
|
154
|
+
const boundedPack = (pack, limit) => {
|
|
155
|
+
if (limit === void 0) return pack;
|
|
156
|
+
let seen = 0;
|
|
157
|
+
return Stream.tap(pack, (chunk) => {
|
|
158
|
+
seen += chunk.byteLength;
|
|
159
|
+
return seen > limit ? Effect.fail(packPastLimit(limit)) : Effect.void;
|
|
160
|
+
});
|
|
161
|
+
};
|
|
147
162
|
/**
|
|
148
163
|
* `start`, then a pack: a plain push's body, made afresh for each send. The first send takes
|
|
149
164
|
* `first`, the fetch already run, and each later one, a retry or a 401's second send, runs `fetch`
|
|
150
165
|
* again. Its pulls run in `context`, the push's own, so the store calls a run makes count where
|
|
151
166
|
* the push's do. What breaks the last body's pack is kept in `broke`, each body opened afresh, and
|
|
152
|
-
* `unsent` cancels `first` when no send took it.
|
|
167
|
+
* `unsent` cancels `first` when no send took it. When `limit` is given, stops at the first chunk
|
|
168
|
+
* past it with `packPastLimit`.
|
|
153
169
|
*/
|
|
154
|
-
const fetchedBody = (start, first, fetch, context) => {
|
|
170
|
+
const fetchedBody = (start, first, fetch, context, limit) => {
|
|
155
171
|
const broke = {
|
|
156
172
|
broke: false,
|
|
157
173
|
cause: void 0
|
|
@@ -163,7 +179,7 @@ const fetchedBody = (start, first, fetch, context) => {
|
|
|
163
179
|
broke.broke = false;
|
|
164
180
|
broke.cause = void 0;
|
|
165
181
|
const pack = taken === void 0 ? Stream.unwrap(Effect.map(fetch, streamOf)) : streamOf(taken);
|
|
166
|
-
return readableIn(Stream.concat(Stream.make(start), keptBreak(pack, broke)), context);
|
|
182
|
+
return readableIn(Stream.concat(Stream.make(start), keptBreak(boundedPack(pack, limit), broke)), context);
|
|
167
183
|
};
|
|
168
184
|
return {
|
|
169
185
|
open,
|
|
@@ -244,4 +260,4 @@ const completed = /* @__PURE__ */ Effect.fnUntraced(function* (http, path, finis
|
|
|
244
260
|
yield* Effect.sleep(Duration.millis(Math.min(answer.seconds * 1e3, waiting)));
|
|
245
261
|
}
|
|
246
262
|
});
|
|
247
|
-
export { brokenBy, fetchedBody, heldOrCounted, packBody, packHeldMost, packInMemory, packInOrder, takesUpload, uploadPush };
|
|
263
|
+
export { brokenBy, fetchedBody, heldOrCounted, packBody, packHeldMost, packInMemory, packInOrder, packPastLimit, takesUpload, uploadPush };
|
package/dist/client/remote.mjs
CHANGED
|
@@ -12,7 +12,7 @@ import { joinedBytes } from "../protocol/bytes/joined.mjs";
|
|
|
12
12
|
import { isOid } from "../protocol/bytes/text.mjs";
|
|
13
13
|
import { advertisedSource } from "../protocol/wire/advertisement.mjs";
|
|
14
14
|
import { encodePushStart, pushOptionsRefusal } from "../protocol/wire/receive-pack.mjs";
|
|
15
|
-
import { pushUploadAbove } from "../protocol/wire/push-uploads.mjs";
|
|
15
|
+
import { pushBytesLimit, pushUploadAbove } from "../protocol/wire/push-uploads.mjs";
|
|
16
16
|
import { readPushReport } from "../protocol/wire/report-status.mjs";
|
|
17
17
|
import { encodeV2Request, lsRefsArguments, readLsRefsAnswer, readV2Capabilities } from "../protocol/wire/v2.mjs";
|
|
18
18
|
import { oneShotReads } from "../storage/calls.mjs";
|
|
@@ -422,11 +422,12 @@ const sendPush = /* @__PURE__ */ Effect.fnUntraced(function* (http, source, adve
|
|
|
422
422
|
limits
|
|
423
423
|
}), (answer) => answer.pack);
|
|
424
424
|
const above = pushUploadAbove(advertised.capabilities);
|
|
425
|
+
const bytesLimit = pushBytesLimit(advertised.capabilities);
|
|
425
426
|
let first;
|
|
426
427
|
let chunks = [];
|
|
427
428
|
if (wants.length > 0 && above === void 0) first = yield* fetched;
|
|
428
429
|
else if (wants.length > 0 && above !== void 0) {
|
|
429
|
-
const read = yield* Effect.flatMap(fetched, (pack) => heldOrCounted(pack, above));
|
|
430
|
+
const read = yield* Effect.flatMap(fetched, (pack) => heldOrCounted(pack, above, bytesLimit));
|
|
430
431
|
if (read.kind === "counted") return yield* uploaded(http, Effect.flatMap(fetched, (pack) => packInOrder(pack, read.bytes)), updates, terms);
|
|
431
432
|
chunks = read.chunks;
|
|
432
433
|
}
|
|
@@ -453,7 +454,7 @@ const sendPush = /* @__PURE__ */ Effect.fnUntraced(function* (http, source, adve
|
|
|
453
454
|
const body = yield* http.post("git-receive-pack", "v0", joinedBytes([start, ...chunks]));
|
|
454
455
|
return yield* reportedPush(body, sideBand, updates);
|
|
455
456
|
}
|
|
456
|
-
const streamed = fetchedBody(start, first, fetched, yield* Effect.context());
|
|
457
|
+
const streamed = fetchedBody(start, first, fetched, yield* Effect.context(), bytesLimit);
|
|
457
458
|
const brokeOr = (answer) => streamed.broke.broke ? brokenBy(streamed.broke.cause) : answer;
|
|
458
459
|
return yield* http.post("git-receive-pack", "v0", streamed.open).pipe(Effect.flatMap((body) => reportedPush(body, sideBand, updates)), Effect.ensuring(streamed.unsent), Effect.catch((error) => brokeOr(Effect.fail(error))), Effect.flatMap((updated) => brokeOr(Effect.succeed(updated))));
|
|
459
460
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as Effect from "effect/Effect";
|
|
2
1
|
import * as Schema from "effect/Schema";
|
|
3
|
-
import * as
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
4
3
|
import "effect/http/HttpClientError";
|
|
4
|
+
import * as Redacted from "effect/Redacted";
|
|
5
5
|
import * as Runtime from "effect/Runtime";
|
|
6
6
|
import * as Stdio from "effect/Stdio";
|
|
7
7
|
/**
|
|
@@ -11,19 +11,19 @@ import { controlsAllowed, maskedControls, secretScrubber } from "./scrub.mjs";
|
|
|
11
11
|
import { packPastLimits } from "./slice-push.mjs";
|
|
12
12
|
import { slicedHelperPush } from "./slice-report.mjs";
|
|
13
13
|
import { LocalGit } from "./slices.mjs";
|
|
14
|
-
import * as Effect from "effect/Effect";
|
|
15
|
-
import * as HttpClient from "effect/http/HttpClient";
|
|
16
|
-
import * as HttpClientResponse from "effect/http/HttpClientResponse";
|
|
17
|
-
import * as Option from "effect/Option";
|
|
18
14
|
import * as Schema from "effect/Schema";
|
|
19
|
-
import * as
|
|
15
|
+
import * as Effect from "effect/Effect";
|
|
20
16
|
import * as Predicate from "effect/Predicate";
|
|
21
|
-
import * as Redacted from "effect/Redacted";
|
|
22
17
|
import * as Stream from "effect/Stream";
|
|
18
|
+
import * as Option from "effect/Option";
|
|
19
|
+
import * as Result from "effect/Result";
|
|
20
|
+
import * as HttpClient from "effect/http/HttpClient";
|
|
23
21
|
import * as Base64 from "effect/encoding/Base64";
|
|
24
22
|
import * as FetchHttpClient from "effect/http/FetchHttpClient";
|
|
25
23
|
import * as HttpBody from "effect/http/HttpBody";
|
|
26
24
|
import * as HttpClientRequest from "effect/http/HttpClientRequest";
|
|
25
|
+
import * as HttpClientResponse from "effect/http/HttpClientResponse";
|
|
26
|
+
import * as Redacted from "effect/Redacted";
|
|
27
27
|
import * as Pull from "effect/Pull";
|
|
28
28
|
import * as Runtime from "effect/Runtime";
|
|
29
29
|
import * as Stdio from "effect/Stdio";
|
|
@@ -68,7 +68,7 @@ export declare const pushSlices: (push: {
|
|
|
68
68
|
};
|
|
69
69
|
}[];
|
|
70
70
|
};
|
|
71
|
-
reason: "ambiguous" | "atomic-partner" | "awaiting-index" | "batches-awaiting-upkeep" | "body-ended" | "boundary-not-in-pack" | "busy" | "call-budget" | "candidate-cancelled" | "candidate-superseded" | "changed-while-checked" | "cursor-expired" | "delta-too-large" | "diff-limit" | "diverged" | "entry-gone" | "entry-unpublishable" | "event-version" | "events-undelivered" | "events-waiting" | "fetch-depth-unsupported" | "fetch-plan-too-large" | "files-refused" | "fork-chunks-past-budget" | "fsck" | "graph-length" | "history-not-imported" | "import-cancelled" | "importing" | "job-step-calls" | "job-step-yielded" | "key-reused" | "link-wrong-type" | "may-have-saved" | "merge-conflict" | "merge-incomplete" | "merges-off" | "name-churn" | "newer-format" | "no-copy-rows" | "no-queue" | "no-releases" | "no-sync" | "no-topics" | "not-a-fork" | "object-missing" | "object-too-large" | "ofs-delta" | "own-repo" | "packs-awaiting-repack" | "past-roots" | "provider-unknown" | "prune-walk-too-large" | "queue-full" | "queue-targets-full" | "rate-limited" | "ref-conflict" | "remote-refused" | "repo-too-large" | "response-too-large" | "shallow-root" | "shallow-upload" | "stage-gone" | "starting" | "tag-target-missing" | "too-many-gitmodules-and-gitattributes" | "too-many-parents" | "too-many-pointers" | "too-many-short-ids" | "too-many-store-calls" | "too-many-writes" | "unrelated-histories" | "unsupported-attribute" | "unsupported-virtual-base" | "walk-limit" | undefined;
|
|
71
|
+
reason: "ambiguous" | "atomic-partner" | "awaiting-index" | "batches-awaiting-upkeep" | "body-ended" | "boundary-not-in-pack" | "busy" | "call-budget" | "candidate-cancelled" | "candidate-superseded" | "changed-while-checked" | "cursor-expired" | "delta-chain-too-deep" | "delta-too-large" | "diff-limit" | "diverged" | "entry-gone" | "entry-unpublishable" | "event-version" | "events-undelivered" | "events-waiting" | "fetch-depth-unsupported" | "fetch-plan-too-large" | "files-refused" | "fork-chunks-past-budget" | "fsck" | "graph-length" | "history-not-imported" | "import-cancelled" | "importing" | "job-step-calls" | "job-step-yielded" | "key-reused" | "link-wrong-type" | "may-have-saved" | "merge-conflict" | "merge-incomplete" | "merges-off" | "name-churn" | "newer-format" | "no-copy-rows" | "no-queue" | "no-releases" | "no-sync" | "no-topics" | "not-a-fork" | "object-missing" | "object-too-large" | "ofs-delta" | "own-repo" | "packs-awaiting-repack" | "past-roots" | "provider-unknown" | "prune-walk-too-large" | "queue-full" | "queue-targets-full" | "rate-limited" | "ref-conflict" | "remote-refused" | "repo-too-large" | "response-too-large" | "shallow-root" | "shallow-upload" | "stage-gone" | "starting" | "tag-target-missing" | "too-many-gitmodules-and-gitattributes" | "too-many-parents" | "too-many-pointers" | "too-many-short-ids" | "too-many-store-calls" | "too-many-writes" | "unrelated-histories" | "unsupported-attribute" | "unsupported-virtual-base" | "walk-limit" | undefined;
|
|
72
72
|
};
|
|
73
73
|
} | {
|
|
74
74
|
refusal?: never;
|
|
@@ -2,15 +2,15 @@ import { gitError } from "../contracts/result.mjs";
|
|
|
2
2
|
import { ownedReader, scopedReader } from "../protocol/bytes/reader.mjs";
|
|
3
3
|
import { joinedBytes } from "../protocol/bytes/joined.mjs";
|
|
4
4
|
import * as Effect from "effect/Effect";
|
|
5
|
-
import * as HttpClient from "effect/http/HttpClient";
|
|
6
|
-
import * as HttpClientResponse from "effect/http/HttpClientResponse";
|
|
7
|
-
import * as Option from "effect/Option";
|
|
8
5
|
import * as Predicate from "effect/Predicate";
|
|
9
6
|
import * as Stream from "effect/Stream";
|
|
7
|
+
import * as Option from "effect/Option";
|
|
8
|
+
import * as HttpClient from "effect/http/HttpClient";
|
|
10
9
|
import * as Base64 from "effect/encoding/Base64";
|
|
11
10
|
import * as FetchHttpClient from "effect/http/FetchHttpClient";
|
|
12
11
|
import * as HttpBody from "effect/http/HttpBody";
|
|
13
12
|
import * as HttpClientRequest from "effect/http/HttpClientRequest";
|
|
13
|
+
import * as HttpClientResponse from "effect/http/HttpClientResponse";
|
|
14
14
|
import * as HttpMethod from "effect/http/HttpMethod";
|
|
15
15
|
// src/client/transport.ts
|
|
16
16
|
/**
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Needing } from "./services.mjs";
|
|
2
2
|
import { ActorInput, Caller, WriteInput } from "./actors.mjs";
|
|
3
3
|
import { ReadOptions } from "./engine.mjs";
|
|
4
4
|
import { Oid, RepoName } from "./ids.mjs";
|
|
5
5
|
import { Bytes } from "./object-values.mjs";
|
|
6
6
|
import { RepoInput } from "./repos.mjs";
|
|
7
7
|
import { GitError } from "./result.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
|
import * as Context from "effect/Context";
|
|
11
11
|
declare namespace blobs_d_exports {
|
|
12
12
|
export { Acting, Blob, BlobCalls, BlobCreateInput, Blobs, BlobsRead, CreatedObject, GetMany, GetManyInput, ObjectInput, create, get, getMany };
|
|
@@ -76,7 +76,7 @@ export interface BlobCalls {
|
|
|
76
76
|
/** A blob, written as its own commit: past 16 MiB `RESOURCE_EXHAUSTED` with `object-too-large`. */
|
|
77
77
|
readonly create: (repo: RepoName, input: BlobCreateInput) => Effect.Effect<CreatedObject, GitError>;
|
|
78
78
|
}
|
|
79
|
-
declare const Blobs_base: Context.ServiceClass<Blobs, "@ref0/git/Blobs",
|
|
79
|
+
declare const Blobs_base: Context.ServiceClass<Blobs, "@ref0/git/Blobs", Needing<{
|
|
80
80
|
readonly get: (repo: string, input: Acting<ObjectInput>, by?: Caller<unknown> | undefined) => Effect.Effect<{
|
|
81
81
|
readonly oid: string;
|
|
82
82
|
readonly size: number;
|
package/dist/contracts/blobs.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { __exportAll } from "../_virtual/_rolldown/runtime.mjs";
|
|
2
2
|
import { Oid } from "./ids.mjs";
|
|
3
3
|
import { Bytes } from "./object-values.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
|
import * as Context from "effect/Context";
|
|
7
7
|
// src/contracts/blobs.ts
|
|
8
8
|
var blobs_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { gitError } from "./result.mjs";
|
|
2
|
+
import { isInfraError } from "@ref0/infra";
|
|
2
3
|
import * as Effect from "effect/Effect";
|
|
3
|
-
import * as
|
|
4
|
+
import * as Predicate from "effect/Predicate";
|
|
5
|
+
import "effect/Option";
|
|
4
6
|
import * as Cause from "effect/Cause";
|
|
5
|
-
import
|
|
7
|
+
import "effect/Exit";
|
|
6
8
|
import * as EffectResult from "effect/Result";
|
|
7
|
-
import { isInfraError } from "@ref0/infra";
|
|
8
|
-
import * as Predicate from "effect/Predicate";
|
|
9
9
|
// src/contracts/calls-spent.ts
|
|
10
10
|
/**
|
|
11
11
|
* A call that never started, or that the platform refused, past a bound: `most` of `bound`'s calls
|
|
@@ -161,37 +161,9 @@ var Caught = class {
|
|
|
161
161
|
this.cause = cause;
|
|
162
162
|
}
|
|
163
163
|
};
|
|
164
|
-
/**
|
|
165
|
-
* `result`, a Promise face's answer, back in Effect: its error a failure, but one past a call bound
|
|
166
|
-
* the defect it is, so a spent call that crossed a Promise stops its request still.
|
|
167
|
-
*/
|
|
168
|
-
const fromAnswer = (result) => result.kind === "success" ? Effect.succeed(result.value) : answerFailed(result.error);
|
|
169
164
|
/** `error`, a Promise face's refusal, back in Effect: as `fromAnswer` takes a failed answer. */
|
|
170
165
|
const answerFailed = (error) => {
|
|
171
166
|
const spent = spentAt(error);
|
|
172
167
|
return spent === void 0 ? Effect.fail(error) : Effect.die(spent);
|
|
173
168
|
};
|
|
174
|
-
|
|
175
|
-
* A call's `Exit` as its Promise answers: the value, or Git's error as `Result`, a spent call
|
|
176
|
-
* bound's refusal among them. A call `signal` interrupted throws the signal's reason, as `fetch`
|
|
177
|
-
* does, and any other defect throws as it is.
|
|
178
|
-
*/
|
|
179
|
-
const answerOf = (exit, signal) => {
|
|
180
|
-
if (Exit.isSuccess(exit)) return {
|
|
181
|
-
kind: "success",
|
|
182
|
-
value: exit.value
|
|
183
|
-
};
|
|
184
|
-
const spent = spentOf(exit.cause);
|
|
185
|
-
if (spent !== void 0) return {
|
|
186
|
-
kind: "error",
|
|
187
|
-
error: spentRefusal(spent)
|
|
188
|
-
};
|
|
189
|
-
const error = Cause.findErrorOption(exit.cause);
|
|
190
|
-
if (Option.isSome(error)) return {
|
|
191
|
-
kind: "error",
|
|
192
|
-
error: error.value
|
|
193
|
-
};
|
|
194
|
-
if (signal?.aborted === true && Cause.hasInterruptsOnly(exit.cause)) throw signal.reason;
|
|
195
|
-
throw Cause.squash(exit.cause);
|
|
196
|
-
};
|
|
197
|
-
export { CallsSpent, answerFailed, answerOf, callLimitIn, callLimitTry, catchSpent, failUnlessSpent, fromAnswer, ownSpentOf, spentAt, spentIn, spentOf, spentRefusal, spentRefusalOf, tryUnlessSpent };
|
|
169
|
+
export { CallsSpent, answerFailed, callLimitIn, callLimitTry, catchSpent, failUnlessSpent, ownSpentOf, spentAt, spentIn, spentOf, spentRefusal, spentRefusalOf, tryUnlessSpent };
|
|
@@ -2,28 +2,29 @@ import { BlobCalls } from "./blobs.mjs";
|
|
|
2
2
|
import { CommitCalls } from "./commits.mjs";
|
|
3
3
|
import { FileCalls } from "./files.mjs";
|
|
4
4
|
import { Oid, RefName, RepoName } from "./ids.mjs";
|
|
5
|
-
import { MergeCalls } from "./merges.mjs";
|
|
6
5
|
import { Filter } from "./object-values.mjs";
|
|
6
|
+
import { MergeCalls } from "./merges.mjs";
|
|
7
7
|
import { ObjectsFactory } from "./objects.mjs";
|
|
8
8
|
import { Ref, RefApplied, RefCalls, RefEdit, RefRejected, RefsUpdated } from "./refs.mjs";
|
|
9
9
|
import { RemoteOptions, WithoutActor, WithoutSignal } from "./remote.mjs";
|
|
10
10
|
import { GitError } from "./result.mjs";
|
|
11
|
-
import { EffectCalls } from "./services.mjs";
|
|
12
11
|
import { TagCalls } from "./tags.mjs";
|
|
13
12
|
import { TreeCalls } from "./trees.mjs";
|
|
14
|
-
import * as Effect from "effect/Effect";
|
|
15
13
|
import { Listing, Page, Records } from "@ref0/infra";
|
|
14
|
+
import * as Effect from "effect/Effect";
|
|
16
15
|
import * as Layer from "effect/Layer";
|
|
17
16
|
/**
|
|
18
17
|
* Where a client keeps its objects and refs: a Layer giving `Records`, and a `Bucket` too if its
|
|
19
|
-
* objects keep one, such as `Memory.layer()`, or several merged with
|
|
20
|
-
* builds it once, on its first call, and reads its time from Effect's
|
|
18
|
+
* objects keep one, such as `Memory.layerRecords()` or `Memory.layer()`, or several merged with
|
|
19
|
+
* `Layer.mergeAll`. The client builds it once, on its first call, and reads its time from Effect's
|
|
20
|
+
* `Clock`.
|
|
21
21
|
*/
|
|
22
22
|
export type ClientAdapter = Layer.Layer<Records.Records, Error>;
|
|
23
23
|
/**
|
|
24
24
|
* A client of one remote. Its local side is storage, not a cache: a commit made here is its only
|
|
25
|
-
* copy until a push. `Memory.
|
|
26
|
-
* and patches refuse with `FAILED_PRECONDITION`, `merges-off`, and its comparisons count no
|
|
25
|
+
* copy until a push. `Memory.layerRecords()` and `loose()` when left out. It runs no `Merges`: its
|
|
26
|
+
* merges and patches refuse with `FAILED_PRECONDITION`, `merges-off`, and its comparisons count no
|
|
27
|
+
* lines.
|
|
27
28
|
*/
|
|
28
29
|
export interface GitClientOptions extends RemoteOptions {
|
|
29
30
|
readonly adapter?: ClientAdapter;
|
|
@@ -85,13 +86,13 @@ export type GitClientCalls = {
|
|
|
85
86
|
readonly remoteRefs: (input?: RemoteRefsInput) => Effect.Effect<Listing<Ref>, GitError>;
|
|
86
87
|
readonly fetch: (input?: ClientFetchInput) => Effect.Effect<ClientFetchResult, GitError>;
|
|
87
88
|
readonly push: (input: ClientPushInput) => Effect.Effect<RefsUpdated, GitError>;
|
|
88
|
-
readonly refs: Localize<
|
|
89
|
-
readonly blobs: Localize<
|
|
90
|
-
readonly trees: Localize<
|
|
91
|
-
readonly commits: Localize<
|
|
92
|
-
readonly tags: Localize<
|
|
93
|
-
readonly files: Localize<
|
|
94
|
-
readonly merges: Localize<
|
|
89
|
+
readonly refs: Localize<RefCalls>;
|
|
90
|
+
readonly blobs: Localize<BlobCalls>;
|
|
91
|
+
readonly trees: Localize<TreeCalls>;
|
|
92
|
+
readonly commits: Localize<CommitCalls>;
|
|
93
|
+
readonly tags: Localize<TagCalls>;
|
|
94
|
+
readonly files: Localize<FileCalls>;
|
|
95
|
+
readonly merges: Localize<MergeCalls>;
|
|
95
96
|
};
|
|
96
97
|
/** A list call's input: the page it starts from. */
|
|
97
98
|
export interface PagedInput {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Needing } from "./services.mjs";
|
|
2
2
|
import { Caller, WriteInput } from "./actors.mjs";
|
|
3
3
|
import { Acting, ObjectInput } from "./blobs.mjs";
|
|
4
4
|
import { Commit, MergeBases, ReadOptions, ReadPage, TreeChanges } from "./engine.mjs";
|
|
@@ -6,9 +6,9 @@ import { Oid, RepoName } from "./ids.mjs";
|
|
|
6
6
|
import { RepoInput } from "./repos.mjs";
|
|
7
7
|
import { TreeEdit } from "./trees.mjs";
|
|
8
8
|
import { GitError } from "./result.mjs";
|
|
9
|
-
import * as Effect from "effect/Effect";
|
|
10
|
-
import * as Schema from "effect/Schema";
|
|
11
9
|
import { Listing } from "@ref0/infra";
|
|
10
|
+
import * as Schema from "effect/Schema";
|
|
11
|
+
import * as Effect from "effect/Effect";
|
|
12
12
|
import * as Context from "effect/Context";
|
|
13
13
|
declare namespace commits_d_exports {
|
|
14
14
|
export { CommitCalls, CommitCreate, CommitCreateFields, CommitCreateInput, CommitDiff, CommitDiffInput, CommitMessage, CommitPick, CommitPickInput, CommitRevert, CommitRevertInput, Commits, CommitsMergeBase, CommitsMergeBaseInput, Compare, CompareInput, CompareRange, ComparisonFile, ComparisonFileFields, LineCounts, Log, LogInput, RefPublication, Revision, compare, create, diff, get, list, logEmailsMost, logExcludeMost, mergeBase, pick, revert };
|
|
@@ -302,7 +302,7 @@ export interface CommitCalls {
|
|
|
302
302
|
/** A conflict fails `FAILED_PRECONDITION` with `merge-conflict`, and writes nothing. */
|
|
303
303
|
readonly pick: (repo: RepoName, input: CommitPickInput) => Effect.Effect<Commit, GitError>;
|
|
304
304
|
}
|
|
305
|
-
declare const Commits_base: Context.ServiceClass<Commits, "@ref0/git/Commits",
|
|
305
|
+
declare const Commits_base: Context.ServiceClass<Commits, "@ref0/git/Commits", Needing<{
|
|
306
306
|
readonly get: (repo: string, input: Acting<ObjectInput>, by?: Caller<unknown> | undefined) => Effect.Effect<{
|
|
307
307
|
readonly oid: string;
|
|
308
308
|
readonly tree: string;
|
|
@@ -2,8 +2,8 @@ import { __exportAll } from "../_virtual/_rolldown/runtime.mjs";
|
|
|
2
2
|
import { Commit, DiffListing, Listing, Page, Signature, TreeChangeFields } from "./engine.mjs";
|
|
3
3
|
import { Oid, RefName } from "./ids.mjs";
|
|
4
4
|
import { Moment } from "./repos.mjs";
|
|
5
|
-
import * as Effect from "effect/Effect";
|
|
6
5
|
import * as Schema from "effect/Schema";
|
|
6
|
+
import * as Effect from "effect/Effect";
|
|
7
7
|
import * as Context from "effect/Context";
|
|
8
8
|
// src/contracts/commits.ts
|
|
9
9
|
var commits_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { CallInput } from "./actors.mjs";
|
|
2
2
|
import { Oid } from "./ids.mjs";
|
|
3
3
|
import { Bytes, ObjectType, ReadLimits } from "./object-values.mjs";
|
|
4
|
-
import * as Schema from "effect/Schema";
|
|
5
4
|
import { Listing, Page } from "@ref0/infra";
|
|
5
|
+
import * as Schema from "effect/Schema";
|
|
6
6
|
export interface ReadOptions extends CallInput {
|
|
7
7
|
readonly limits?: ReadLimits;
|
|
8
8
|
}
|
|
@@ -138,7 +138,7 @@ export interface ObjectWrite {
|
|
|
138
138
|
readonly size: number;
|
|
139
139
|
readonly bytes: Bytes;
|
|
140
140
|
}
|
|
141
|
-
export type ObjectWrites =
|
|
141
|
+
export type ObjectWrites = ReadonlyArray<ObjectWrite>;
|
|
142
142
|
/**
|
|
143
143
|
* Why inexact rename detection was skipped, as Git warns, when it was: past the rename limit,
|
|
144
144
|
* `'rename-limit'`, or past the 16 MiB of span sets a pass keeps, `'memory-limit'`. Exact
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as Schema from "effect/Schema";
|
|
2
1
|
import { JobInput } from "@ref0/infra";
|
|
2
|
+
import * as Schema from "effect/Schema";
|
|
3
3
|
import * as Context from "effect/Context";
|
|
4
4
|
declare namespace events_d_exports {
|
|
5
5
|
export { BeforeAfter, CandidateClosed, CandidateClosedFields, CandidateOpened, CandidateReported, EntryAdded, EntryFailed, EntryMerged, EntryPinned, EntryRemoved, EntryRetried, EventEnvelope, EventFeature, EventLog, Events, EventsService, FeedItem, FenceReason, FencedPack, GitEvent, HoldEvent, HoldEventFields, IndexRefusal, QueueEvent, QueueRestarted, RefPush, RefUpdated, RepoCreated, RepoDeletedEvent, RepoEnvelope, RepoEvent, RepoIndexRefused, RepoJobFailed, RepoMaintained, RepoPruneRefused, RepoRenamed, RepoTokenEvent, RepoVisibilityChanged, RepoWorkFailed, TokenEvent, TokenEventFields, TopicAdded, TopicEnvelope, TopicEvent, TopicFailed, TopicMerged, TopicOpened, TopicRemoved, TopicReported, TopicWorkFailed, keepsEvents };
|
|
@@ -6,8 +6,8 @@ import { RefEdit, RefSource, RefUpdateKind } from "./refs.mjs";
|
|
|
6
6
|
import { Moment as Moment$1 } from "./repos.mjs";
|
|
7
7
|
import { TokenId, TokenScope } from "./tokens.mjs";
|
|
8
8
|
import { TopicCandidate, TopicEntry, TopicFailure, TopicMergedEntry } from "./topics.mjs";
|
|
9
|
-
import * as Schema from "effect/Schema";
|
|
10
9
|
import { JobRef } from "@ref0/infra";
|
|
10
|
+
import * as Schema from "effect/Schema";
|
|
11
11
|
import * as Context from "effect/Context";
|
|
12
12
|
// src/contracts/events.ts
|
|
13
13
|
var events_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Needing } from "./services.mjs";
|
|
2
2
|
import { Caller } from "./actors.mjs";
|
|
3
3
|
import { Acting } from "./blobs.mjs";
|
|
4
4
|
import { DiffListing, ReadPage } from "./engine.mjs";
|
|
5
5
|
import { RepoName } from "./ids.mjs";
|
|
6
6
|
import { GitError } from "./result.mjs";
|
|
7
7
|
import { TreeEntry } from "./trees.mjs";
|
|
8
|
-
import * as Effect from "effect/Effect";
|
|
9
|
-
import * as Schema from "effect/Schema";
|
|
10
8
|
import { Listing } from "@ref0/infra";
|
|
9
|
+
import * as Schema from "effect/Schema";
|
|
10
|
+
import * as Effect from "effect/Effect";
|
|
11
11
|
import * as Context from "effect/Context";
|
|
12
12
|
declare namespace files_d_exports {
|
|
13
13
|
export { File, FileCalls, FileDiff, FileFields, FileRead, FileReadInput, Files, FilesDiff, FilesDiffInput, FilesList, FilesListInput, FilesRead, Hunk, HunkLine, diff, list, read };
|
|
@@ -162,7 +162,7 @@ export interface FileCalls {
|
|
|
162
162
|
/** `git diff <base> <head> -- <paths>`, a file at a time: `patch` unless `format` is `hunks`. */
|
|
163
163
|
readonly diff: (repo: RepoName, input: Acting<FilesDiffInput>) => Effect.Effect<DiffListing<FileDiff>, GitError>;
|
|
164
164
|
}
|
|
165
|
-
declare const Files_base: Context.ServiceClass<Files, "@ref0/git/Files",
|
|
165
|
+
declare const Files_base: Context.ServiceClass<Files, "@ref0/git/Files", Needing<{
|
|
166
166
|
readonly read: (repo: string, input: Acting<FileReadInput>, by?: Caller<unknown> | undefined) => Effect.Effect<{
|
|
167
167
|
readonly files: {
|
|
168
168
|
readonly items: {
|
package/dist/contracts/files.mjs
CHANGED
|
@@ -3,8 +3,8 @@ import { CommitDiff, ComparisonFileFields, Revision } from "./commits.mjs";
|
|
|
3
3
|
import { Listing } from "./engine.mjs";
|
|
4
4
|
import { Oid } from "./ids.mjs";
|
|
5
5
|
import { Bytes } from "./object-values.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 Context from "effect/Context";
|
|
9
9
|
// src/contracts/files.ts
|
|
10
10
|
var files_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Needing } from "./services.mjs";
|
|
2
2
|
import { ActorInput, Caller, WriteInput } from "./actors.mjs";
|
|
3
3
|
import { RepoName } from "./ids.mjs";
|
|
4
4
|
import { RepoInfo, RepoInput } from "./repos.mjs";
|
|
5
5
|
import { GitError } from "./result.mjs";
|
|
6
|
-
import * as Effect from "effect/Effect";
|
|
7
|
-
import * as Schema from "effect/Schema";
|
|
8
6
|
import { Listing, Page } from "@ref0/infra";
|
|
7
|
+
import * as Schema from "effect/Schema";
|
|
8
|
+
import * as Effect from "effect/Effect";
|
|
9
9
|
import * as Context from "effect/Context";
|
|
10
10
|
declare namespace forks_d_exports {
|
|
11
11
|
export { ForkCalls, ForkCreateInput, ForkFetched, ForkGetInput, ForkHolder, ForkListInput, Forks, create, fetch, get, list, sync };
|
|
@@ -96,7 +96,7 @@ export interface ForkCalls {
|
|
|
96
96
|
*/
|
|
97
97
|
readonly fetch: (fork: RepoName, input: ActorInput & Pick<RepoInput, 'internalId'>) => Effect.Effect<ForkFetched, GitError>;
|
|
98
98
|
}
|
|
99
|
-
declare const Forks_base: Context.ServiceClass<Forks, "@ref0/git/Forks",
|
|
99
|
+
declare const Forks_base: Context.ServiceClass<Forks, "@ref0/git/Forks", Needing<{
|
|
100
100
|
readonly create: (repo: string, input: ForkCreateInput, by?: Caller<unknown> | undefined) => Effect.Effect<{
|
|
101
101
|
readonly name: string;
|
|
102
102
|
readonly defaultBranch?: string;
|
package/dist/contracts/forks.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { __exportAll } from "../_virtual/_rolldown/runtime.mjs";
|
|
2
2
|
import { RefName, RepoName } from "./ids.mjs";
|
|
3
3
|
import { Ref } from "./refs.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
|
import * as Context from "effect/Context";
|
|
7
7
|
// src/contracts/forks.ts
|
|
8
8
|
var forks_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Duration } from "./time.mjs";
|
|
2
2
|
import { DecisionAnswer, GitError } from "./result.mjs";
|
|
3
3
|
import { PushContext } from "./rules.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
|
/** A point core calls a host's hook group at: `push.check`, the whole push, after every per-ref check. */
|
|
7
7
|
export type HookPoint = 'push.check';
|
|
8
8
|
/**
|
package/dist/contracts/git.d.mts
CHANGED
|
@@ -8,11 +8,11 @@ import { RefSource, RefUpdate } from "./refs.mjs";
|
|
|
8
8
|
import { FetchReadInput } from "./rules.mjs";
|
|
9
9
|
import { PinnedRepo } from "./repos.mjs";
|
|
10
10
|
import { GitError } from "./result.mjs";
|
|
11
|
-
import * as Effect from "effect/Effect";
|
|
12
|
-
import * as Option from "effect/Option";
|
|
13
11
|
import { Committed, CurrentJob, Job, Key, Moment, Read, Records, Row, WatchedRow } from "@ref0/infra";
|
|
14
|
-
import * as
|
|
12
|
+
import * as Effect from "effect/Effect";
|
|
15
13
|
import * as Stream from "effect/Stream";
|
|
14
|
+
import * as Context from "effect/Context";
|
|
15
|
+
import * as Option from "effect/Option";
|
|
16
16
|
import * as Duration from "effect/Duration";
|
|
17
17
|
/**
|
|
18
18
|
* The host, acting as itself (Q223): the caller host code's calls name, as `hostCalls()` do. A
|
|
@@ -122,8 +122,9 @@ export type Upkeep = (input: {
|
|
|
122
122
|
export type PurgeStep = 'did' | 'waits' | 'done';
|
|
123
123
|
/**
|
|
124
124
|
* A step of a registration's purge of a deleted repo, in `git.purge`, before core's rows go: its rows,
|
|
125
|
-
* and what they name outside the store, such as a bucket's keys.
|
|
126
|
-
*
|
|
125
|
+
* and what they name outside the store, such as a bucket's keys. Each registration's purge steps on its
|
|
126
|
+
* own: one that answers `waits` holds no other's. Core's own steps run once every registration's
|
|
127
|
+
* answers `done`.
|
|
127
128
|
*/
|
|
128
129
|
export type Purge = (input: {
|
|
129
130
|
readonly repo: InternalRepoId;
|
|
@@ -225,6 +226,9 @@ export interface Registration {
|
|
|
225
226
|
/**
|
|
226
227
|
* Adds `check` to `Git.layer`'s seal, which runs it once every feature has built, after the push
|
|
227
228
|
* rules' sources and before any job registers: a check that dies fails the build with its defect.
|
|
229
|
+
* It runs with every feature's services in its context, in whatever order the host composed
|
|
230
|
+
* them, so a check reads by `Effect.serviceOption` a service a feature built after its own, as
|
|
231
|
+
* the drop-in reads `MergeQueue`'s `keys`.
|
|
228
232
|
*/
|
|
229
233
|
readonly addSealCheck: (check: Effect.Effect<void>) => Effect.Effect<void>;
|
|
230
234
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GitError } from "./result.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
|
export declare const GrantInput: Schema.Struct<{
|
|
5
5
|
readonly credentials: Schema.Union<readonly [Schema.Struct<{
|
|
6
6
|
readonly kind: Schema.Literal<"basic">;
|
|
@@ -2,8 +2,8 @@ import { WriteInput } from "./actors.mjs";
|
|
|
2
2
|
import { RepoName } from "./ids.mjs";
|
|
3
3
|
import { RepoInput } from "./repos.mjs";
|
|
4
4
|
import { GitError } from "./result.mjs";
|
|
5
|
-
import * as Effect from "effect/Effect";
|
|
6
5
|
import * as Schema from "effect/Schema";
|
|
6
|
+
import * as Effect from "effect/Effect";
|
|
7
7
|
/**
|
|
8
8
|
* `git merge --no-ff <theirs>` on the branch `ours`, published there: a merge commit whose
|
|
9
9
|
* parents are `ours`' tip and `theirs`. Unrelated histories are refused.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Allotment } from "./objects.mjs";
|
|
2
2
|
import { GitError } from "./result.mjs";
|
|
3
3
|
import * as Schema from "effect/Schema";
|
|
4
|
+
import "effect/Effect";
|
|
4
5
|
export declare const ObjectType: Schema.Literals<readonly ["commit", "tree", "blob", "tag"]>;
|
|
5
6
|
export type ObjectType = typeof ObjectType.Type;
|
|
6
7
|
/** A read's own limits, each only lower than the server's. */
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Oid } from "./ids.mjs";
|
|
2
|
+
import { isGitError } from "./result.mjs";
|
|
2
3
|
import * as Schema from "effect/Schema";
|
|
4
|
+
import * as Effect from "effect/Effect";
|
|
3
5
|
// src/contracts/object-values.ts
|
|
4
6
|
const ObjectType = /* @__PURE__ */ Schema.Literals([
|
|
5
7
|
"commit",
|
|
@@ -80,6 +82,19 @@ var LfsPointers = class LfsPointers {
|
|
|
80
82
|
}
|
|
81
83
|
};
|
|
82
84
|
/**
|
|
85
|
+
* Whether a grow's answer is a wait, an Effect, rather than a refusal or a grant: Git's error is
|
|
86
|
+
* yieldable, so `Effect.isEffect` would take a refusal for a wait.
|
|
87
|
+
*/
|
|
88
|
+
const growWaits = (answer) => answer !== void 0 && !isGitError(answer);
|
|
89
|
+
/**
|
|
90
|
+
* `allotment` grown by `bytes`, as an Effect: the refusal, or `undefined` once granted, on the spot
|
|
91
|
+
* or once its wait ends.
|
|
92
|
+
*/
|
|
93
|
+
const grownBy = (allotment, bytes) => Effect.suspend(() => {
|
|
94
|
+
const answer = allotment.grow(bytes);
|
|
95
|
+
return growWaits(answer) ? answer : Effect.succeed(answer);
|
|
96
|
+
});
|
|
97
|
+
/**
|
|
83
98
|
* An allotment of at most `most` bytes at once, refused past it with `refusal`, outside any
|
|
84
99
|
* memory budget: what a storage with none, `loose()` or a host's own, answers
|
|
85
100
|
* `ObjectReader.allotment` with, as `allotment: allotmentWithin`.
|
|
@@ -101,4 +116,4 @@ const allotmentWithin = (most, refusal) => {
|
|
|
101
116
|
};
|
|
102
117
|
/** The most roots a receive lists: one for each ref a push may move. */
|
|
103
118
|
const receivedRootsMost = 4e3;
|
|
104
|
-
export { BlobLimit, BlobNone, Bytes, FetchRequest, Filter, LfsPointers, ObjectType, ReadLimits, TreeFilter, allotmentWithin, objectsReadMost, receivedRootsMost };
|
|
119
|
+
export { BlobLimit, BlobNone, Bytes, FetchRequest, Filter, LfsPointers, ObjectType, ReadLimits, TreeFilter, allotmentWithin, growWaits, grownBy, objectsReadMost, receivedRootsMost };
|