@ref0/git 0.11.0 → 0.14.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 +8 -7
- package/dist/auth/auth.d.mts +2 -2
- package/dist/auth/auth.mjs +3 -6
- package/dist/auth/authorize.mjs +1 -17
- package/dist/auth/helpers.mjs +3 -11
- package/dist/auth/host-services.mjs +11 -0
- package/dist/auth/policy.d.mts +27 -7
- package/dist/auth/policy.mjs +8 -4
- package/dist/auth/tokens-layer.d.mts +1 -2
- package/dist/auth/tokens-layer.mjs +2 -3
- package/dist/auth/tokens-public.d.mts +3 -3
- package/dist/auth/tokens.d.mts +1 -8
- package/dist/auth/tokens.mjs +1 -8
- package/dist/auth.d.mts +1 -4
- package/dist/auth.mjs +1 -3
- package/dist/client/git-http.mjs +18 -4
- package/dist/client/push-upload.mjs +33 -7
- package/dist/client/remote.mjs +94 -28
- package/dist/client/slice-push.d.mts +1 -1
- package/dist/contracts/access.d.mts +8 -8
- package/dist/contracts/actors.d.mts +2 -34
- package/dist/contracts/blobs.d.mts +2 -2
- package/dist/contracts/client.d.mts +8 -3
- package/dist/contracts/commits.d.mts +10 -2
- package/dist/contracts/commits.mjs +9 -1
- package/dist/contracts/files.d.mts +2 -2
- package/dist/contracts/forks.d.mts +14 -3
- package/dist/contracts/git.d.mts +41 -12
- package/dist/contracts/git.mjs +3 -2
- package/dist/contracts/lfs.d.mts +0 -7
- package/dist/contracts/objects.d.mts +80 -10
- package/dist/contracts/operations.d.mts +3 -0
- package/dist/contracts/operations.mjs +12 -2
- package/dist/contracts/push-uploads.d.mts +44 -5
- package/dist/contracts/push-uploads.mjs +7 -3
- package/dist/contracts/refs.d.mts +28 -6
- package/dist/contracts/remote.mjs +1 -3
- package/dist/contracts/repo-records.d.mts +1 -0
- package/dist/contracts/repos.d.mts +90 -2
- package/dist/contracts/repos.mjs +29 -2
- package/dist/contracts/result.d.mts +30 -23
- package/dist/contracts/result.mjs +24 -9
- package/dist/contracts/rules.d.mts +22 -22
- package/dist/contracts/server.d.mts +28 -77
- package/dist/contracts/signin.d.mts +1 -1
- package/dist/contracts/sync.d.mts +90 -19
- package/dist/contracts/sync.mjs +34 -10
- package/dist/contracts/tokens.d.mts +1 -6
- package/dist/contracts/tokens.mjs +1 -2
- package/dist/contracts/topics.d.mts +0 -5
- package/dist/contracts/work.d.mts +66 -2
- package/dist/contracts/work.mjs +8 -1
- package/dist/core/access.d.mts +1 -0
- package/dist/core/access.mjs +34 -13
- package/dist/core/ancestry.d.mts +9 -0
- package/dist/core/ancestry.mjs +6 -6
- package/dist/core/asked.mjs +68 -0
- package/dist/core/call-names.mjs +1 -0
- package/dist/core/call-services.mjs +2 -1
- package/dist/core/events/deliver.d.mts +1 -0
- package/dist/core/events/deliver.mjs +15 -3
- package/dist/core/forks.mjs +42 -16
- package/dist/core/imports.mjs +156 -13
- package/dist/core/index-job.mjs +9 -6
- package/dist/core/job-view.mjs +8 -9
- package/dist/core/mirror-rows.mjs +19 -4
- package/dist/core/objects/commits.mjs +16 -6
- package/dist/core/objects/reading.mjs +17 -9
- package/dist/core/parts.d.mts +8 -2
- package/dist/core/parts.mjs +1 -4
- package/dist/core/purge.mjs +76 -6
- package/dist/core/push-decide.mjs +1 -1
- package/dist/core/push-files.d.mts +12 -0
- package/dist/core/push-files.mjs +225 -0
- package/dist/core/push-repo.d.mts +8 -0
- package/dist/core/push-repo.mjs +56 -0
- package/dist/core/push.d.mts +17 -0
- package/dist/core/push.mjs +107 -32
- package/dist/core/receipts.mjs +26 -10
- package/dist/core/ref-view.mjs +59 -5
- package/dist/core/refs.mjs +18 -10
- package/dist/core/registered-rows.mjs +7 -5
- package/dist/core/repack.mjs +16 -11
- package/dist/core/repo-info.mjs +16 -9
- package/dist/core/repos.mjs +30 -14
- package/dist/core/saved-caller-views.d.mts +18 -0
- package/dist/core/saved-caller-views.mjs +17 -4
- package/dist/core/saved-callers-public.d.mts +3 -3
- package/dist/core/saved-callers-public.mjs +3 -2
- package/dist/core/saved-callers.d.mts +7 -0
- package/dist/core/seam.mjs +2 -2
- package/dist/core/view.d.mts +6 -0
- package/dist/core/view.mjs +45 -12
- package/dist/core/work.mjs +47 -22
- package/dist/effect.d.mts +3 -1
- package/dist/effect.mjs +3 -1
- package/dist/engine/reads.mjs +13 -6
- package/dist/engine/walk.mjs +4 -4
- package/dist/event-streams/event-streams.d.mts +1 -1
- package/dist/event-streams/event-streams.mjs +1 -1
- package/dist/event-streams/stream.d.mts +1 -1
- package/dist/event-streams/stream.mjs +1 -1
- package/dist/extend.d.mts +4 -3
- package/dist/extend.mjs +3 -2
- package/dist/http/answers.mjs +4 -2
- package/dist/http/core-parts.mjs +64 -15
- package/dist/http/handler.mjs +2 -2
- package/dist/http/node.mjs +5 -4
- package/dist/http/parts.d.mts +1 -0
- package/dist/http/push-upload-job.mjs +503 -0
- package/dist/http/push-uploads.d.mts +1 -0
- package/dist/http/push-uploads.mjs +120 -59
- package/dist/http/upload-pack.mjs +7 -6
- package/dist/index.d.mts +23 -24
- package/dist/index.mjs +4 -7
- package/dist/lfs/base.d.mts +7 -3
- package/dist/lfs/base.mjs +2 -1
- package/dist/lfs/copy.d.mts +46 -0
- package/dist/lfs/copy.mjs +26 -0
- package/dist/lfs/layer.mjs +4 -2
- package/dist/lfs/locks.mjs +14 -9
- package/dist/lfs/objects.d.mts +6 -0
- package/dist/lfs/objects.mjs +95 -61
- package/dist/lfs/rows.d.mts +13 -0
- package/dist/lfs/service.d.mts +1 -7
- package/dist/lfs/service.mjs +1 -9
- package/dist/lfs/upload-most.mjs +5 -5
- package/dist/node.d.mts +2 -2
- package/dist/protocol/bytes/sha256-hasher.d.mts +15 -0
- package/dist/protocol/bytes/sha256.d.mts +32 -0
- package/dist/protocol/bytes/sha256.mjs +105 -49
- package/dist/protocol/wire/advertisement.mjs +9 -4
- package/dist/protocol/wire/lines.d.mts +4 -2
- package/dist/protocol/wire/lines.mjs +11 -5
- package/dist/protocol/wire/push-uploads.mjs +13 -1
- package/dist/protocol/wire/v2.mjs +2 -2
- package/dist/protocol.d.mts +3 -1
- package/dist/protocol.mjs +3 -1
- package/dist/queue/advance.mjs +1 -1
- package/dist/queue/calls.mjs +21 -1
- package/dist/queue/host.d.mts +1 -7
- package/dist/queue/host.mjs +1 -7
- package/dist/queue/layer.mjs +1 -1
- package/dist/queue/trim.mjs +1 -1
- package/dist/rest/blobs.d.mts +16 -8
- package/dist/rest/blobs.mjs +1 -1
- package/dist/rest/caller.d.mts +49 -9
- package/dist/rest/caller.mjs +1 -1
- package/dist/rest/client.d.mts +10 -3
- package/dist/rest/client.mjs +4 -0
- package/dist/rest/commits.d.mts +272 -239
- package/dist/rest/errors.d.mts +24 -4
- package/dist/rest/events.d.mts +9 -6
- package/dist/rest/events.mjs +1 -2
- package/dist/rest/files.d.mts +112 -100
- package/dist/rest/forks.d.mts +146 -122
- package/dist/rest/handler.mjs +4 -57
- package/dist/rest/handlers.d.mts +1 -1
- package/dist/rest/handlers.mjs +18 -4
- package/dist/rest/layer.mjs +10 -2
- package/dist/rest/me.d.mts +8 -4
- package/dist/rest/merges.d.mts +8 -4
- package/dist/rest/paths.mjs +1 -0
- package/dist/rest/queue.d.mts +292 -236
- package/dist/rest/refs.d.mts +98 -69
- package/dist/rest/repos.d.mts +133 -105
- package/dist/rest/tags.d.mts +100 -88
- package/dist/rest/tokens.d.mts +192 -168
- package/dist/rest/topics.d.mts +154 -134
- package/dist/rest/trees.d.mts +32 -16
- package/dist/rest/work.d.mts +467 -20
- package/dist/rest/work.mjs +8 -0
- package/dist/server/edge-node.d.mts +9 -13
- package/dist/server/edge-node.mjs +9 -12
- package/dist/server/git-layer.d.mts +1 -6
- package/dist/server/git-layer.mjs +2 -2
- package/dist/server/git-namespace.d.mts +4 -4
- package/dist/server/joined.d.mts +15 -22
- package/dist/server/joined.mjs +5 -29
- package/dist/server/lifecycle.mjs +107 -23
- package/dist/server/registry.mjs +9 -1
- package/dist/server/server.mjs +139 -216
- package/dist/storage/budget.mjs +2 -2
- package/dist/storage/clean-up.mjs +13 -10
- package/dist/storage/fetch.mjs +13 -8
- package/dist/storage/file-limits.mjs +24 -0
- package/dist/storage/index-build.d.mts +1 -0
- package/dist/storage/index-build.mjs +106 -62
- package/dist/storage/index-fetch.mjs +16 -3
- package/dist/storage/index-reach.mjs +33 -5
- package/dist/storage/index-remap.mjs +8 -1
- package/dist/storage/index-shallow.mjs +5 -3
- package/dist/storage/largest-files.mjs +48 -0
- package/dist/storage/lfs-pointers.mjs +10 -1
- package/dist/storage/loose.mjs +3 -1
- package/dist/storage/memory-budget.mjs +154 -8
- package/dist/storage/merge-cut.mjs +5 -4
- package/dist/storage/pack-reads.mjs +246 -34
- package/dist/storage/pack-receive.mjs +83 -25
- package/dist/storage/packs.mjs +37 -21
- package/dist/storage/prune-keep.mjs +203 -34
- package/dist/storage/prune-seen.mjs +11 -6
- package/dist/storage/prune-walk.mjs +219 -81
- package/dist/storage/prune.mjs +629 -196
- package/dist/storage/push-uploads.mjs +36 -12
- package/dist/storage/quarantine.mjs +9 -7
- package/dist/storage/ready.mjs +47 -19
- package/dist/storage/receive-bounds.mjs +29 -8
- package/dist/storage/receive-state.mjs +8 -0
- package/dist/storage/receive-steps.mjs +71 -18
- package/dist/storage/repack.d.mts +1 -1
- package/dist/storage/repack.mjs +1 -8
- package/dist/storage/rows.mjs +12 -1
- package/dist/storage/shallow.d.mts +1 -0
- package/dist/storage/shallow.mjs +26 -4
- package/dist/storage/stream-whole.mjs +5 -2
- package/dist/storage/visible.mjs +29 -1
- package/dist/storage/walk.mjs +2 -1
- package/dist/store/catalogue.mjs +1 -0
- package/dist/store/cursor-seal-namespace.d.mts +2 -0
- package/dist/store/cursor-seal-public.d.mts +5 -0
- package/dist/store/cursor-seal-public.mjs +5 -0
- package/dist/store/cursor-seal.d.mts +16 -2
- package/dist/store/cursor-seal.mjs +26 -14
- package/dist/store/errors.mjs +9 -1
- package/dist/store/records.d.mts +2 -0
- package/dist/store/records.mjs +9 -6
- package/dist/store/repo-record.d.mts +27 -0
- package/dist/store/repo-record.mjs +141 -4
- package/dist/store/scopes.mjs +10 -2
- package/dist/sync/bound.d.mts +2 -0
- package/dist/sync/bound.mjs +11 -2
- package/dist/sync/github.d.mts +6 -1
- package/dist/sync/github.mjs +63 -42
- package/dist/sync/http.mjs +36 -1
- package/dist/sync/import.mjs +4 -2
- package/dist/sync/layer.mjs +6 -2
- package/dist/sync/lfs-batch.mjs +119 -0
- package/dist/sync/lfs-copy.mjs +251 -0
- package/dist/sync/mirror.mjs +227 -147
- package/dist/sync/said.mjs +204 -0
- package/dist/sync/smart-http.mjs +4 -2
- package/dist/sync/step.mjs +33 -13
- package/dist/sync/tries.mjs +71 -24
- package/dist/sync.d.mts +2 -2
- package/dist/topics/advance.mjs +10 -3
- package/dist/topics/host.mjs +1 -19
- package/dist/topics/layer.mjs +1 -1
- package/package.json +3 -8
- package/dist/auth/bridge.mjs +0 -30
- package/dist/auth/helpers.d.mts +0 -17
- package/dist/core/purge.d.mts +0 -8
- package/dist/core/registered-rows.d.mts +0 -4
- package/dist/core/repack.d.mts +0 -11
- package/dist/http/handler.d.mts +0 -2
- package/dist/rest/handler.d.mts +0 -21
- package/dist/rest.d.mts +0 -2
- package/dist/rest.mjs +0 -1
- package/dist/server/registry.d.mts +0 -16
- package/dist/server/server.d.mts +0 -36
- package/dist/storage/repack-job.d.mts +0 -3
- package/dist/topics/host.d.mts +0 -7
package/dist/effect.mjs
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { GitCaller, GitStore } from "./contracts/services.mjs";
|
|
2
|
+
import { Actor } from "./contracts/actors.mjs";
|
|
3
|
+
import { RepoName } from "./contracts/ids.mjs";
|
|
2
4
|
import { CallBudget } from "./store/call-count.mjs";
|
|
3
5
|
import { commitCallsMost, storeCall } from "./store/errors.mjs";
|
|
4
6
|
import { bucketCall } from "./storage/calls.mjs";
|
|
@@ -11,4 +13,4 @@ import { RefsApiGroup } from "./rest/refs.mjs";
|
|
|
11
13
|
import { ReposApiGroup } from "./rest/repos.mjs";
|
|
12
14
|
import { TokensApiGroup } from "./rest/tokens.mjs";
|
|
13
15
|
import { WorkApiGroup } from "./rest/work.mjs";
|
|
14
|
-
export { CallBudget, GitCaller, GitCallerMiddleware, GitErrors, GitRestApi, GitRestHandlers, GitRestServices, GitStore, MeApiGroup, RefsApiGroup, ReposApiGroup, TokensApiGroup, WorkApiGroup, bucketCall, commitCallsMost, storeCall };
|
|
16
|
+
export { Actor, CallBudget, GitCaller, GitCallerMiddleware, GitErrors, GitRestApi, GitRestHandlers, GitRestServices, GitStore, MeApiGroup, RefsApiGroup, RepoName, ReposApiGroup, TokensApiGroup, WorkApiGroup, bucketCall, commitCallsMost, storeCall };
|
package/dist/engine/reads.mjs
CHANGED
|
@@ -81,13 +81,20 @@ const timed = (effect, deadline) => Effect.flatMap(Clock$1.currentTimeMillis, (n
|
|
|
81
81
|
orElse: () => ranPast(deadline)
|
|
82
82
|
})).pipe(Effect.catch((error) => Effect.andThen(within(deadline), Effect.fail(error))), Effect.tap(() => within(deadline)));
|
|
83
83
|
/**
|
|
84
|
-
*
|
|
85
|
-
*
|
|
84
|
+
* The most a page of `commits.list` holds when called in process: a caller that reads a range
|
|
85
|
+
* whole, such as a release's notes past 1,000 commits, lists it in one walk, where each page of
|
|
86
|
+
* `maxPageLimit` would walk it again. The REST API holds its pages to `maxPageLimit`.
|
|
86
87
|
*/
|
|
87
|
-
const
|
|
88
|
+
const logLimitMost = 1001;
|
|
89
|
+
/**
|
|
90
|
+
* A page's size: the caller's whole number, held to 1 through `most`, `maxPageLimit` as the
|
|
91
|
+
* store's lists hold it unless a call names more. A limit that isn't a whole number is refused,
|
|
92
|
+
* since no page holds part of an item.
|
|
93
|
+
*/
|
|
94
|
+
const limitOf = (page = {}, most = 200) => {
|
|
88
95
|
const limit = page.limit ?? 50;
|
|
89
|
-
if (!Number.isSafeInteger(limit)) return fail("INVALID_ARGUMENT", "A page limit is a whole number", { hint: `Leave it out for 50, or pass 1 through
|
|
90
|
-
return Effect.succeed(Math.min(Math.max(limit, 1),
|
|
96
|
+
if (!Number.isSafeInteger(limit)) return fail("INVALID_ARGUMENT", "A page limit is a whole number", { hint: `Leave it out for 50, or pass 1 through ${most}` });
|
|
97
|
+
return Effect.succeed(Math.min(Math.max(limit, 1), most));
|
|
91
98
|
};
|
|
92
99
|
/** What binds a cursor to its call's input: the SHA-1 of each part, NUL-joined. */
|
|
93
100
|
const inputDigest = (parts) => Effect.map(sha1Of(utf8(parts.join("\0"))), (digest) => Hex.encode(digest).slice(0, 16));
|
|
@@ -102,4 +109,4 @@ const indexOf = (after, digest) => {
|
|
|
102
109
|
if (held !== digest || rest.length > 0 || !/^[1-9]\d*$/.test(index ?? "")) return badCursor();
|
|
103
110
|
return Effect.succeed(Number(index));
|
|
104
111
|
};
|
|
105
|
-
export { badCursor, deadlineOf, defaultMilliseconds, indexCursor, indexOf, inputDigest, limitOf, limitsOf, readThrough, readsThrough, stepDeadline, timed, within };
|
|
112
|
+
export { badCursor, deadlineOf, defaultMilliseconds, indexCursor, indexOf, inputDigest, limitOf, limitsOf, logLimitMost, readThrough, readsThrough, stepDeadline, timed, within };
|
package/dist/engine/walk.mjs
CHANGED
|
@@ -218,7 +218,7 @@ const started = /* @__PURE__ */ Effect.fnUntraced(function* (reader, wants, have
|
|
|
218
218
|
* `--author`, `--committer`, `--max-age` and `--min-age` do. Each walk here sees each of `roots`
|
|
219
219
|
* as having no parents, as Git's shallow grafts make a repo's roots.
|
|
220
220
|
*/
|
|
221
|
-
const walkHistory = /* @__PURE__ */ Effect.fnUntraced(function* (read, input, call, roots = noRepoRoots) {
|
|
221
|
+
const walkHistory = /* @__PURE__ */ Effect.fnUntraced(function* (read, input, call, roots = noRepoRoots, most = 200) {
|
|
222
222
|
const haves = input.haves ?? [];
|
|
223
223
|
if (input.wants.length === 0) return yield* fail("INVALID_ARGUMENT", "A walk needs a want");
|
|
224
224
|
const digest = yield* inputDigest([
|
|
@@ -229,7 +229,7 @@ const walkHistory = /* @__PURE__ */ Effect.fnUntraced(function* (read, input, ca
|
|
|
229
229
|
filterKey(input)
|
|
230
230
|
]);
|
|
231
231
|
const stale = staleOf(input);
|
|
232
|
-
return yield* paged(read, input, digest, (walk, take) => haves.length > 0 ? limited(walk, take, input) : unlimited(walk, take, stale), call, roots);
|
|
232
|
+
return yield* paged(read, input, digest, (walk, take) => haves.length > 0 ? limited(walk, take, input) : unlimited(walk, take, stale), call, roots, most);
|
|
233
233
|
});
|
|
234
234
|
/** `rev-list --count <wants> ^<haves>`: how many commits the walk lists, within its limits. */
|
|
235
235
|
const countHistory = /* @__PURE__ */ Effect.fnUntraced(function* (read, input, call, roots = noRepoRoots) {
|
|
@@ -325,9 +325,9 @@ const simplified = /* @__PURE__ */ Effect.fnUntraced(function* (walk, parts, tak
|
|
|
325
325
|
* walk runs again from the start each page, within the call's limits, and lists after its
|
|
326
326
|
* cursor's commit, so a cursor holds the input's digest and that commit.
|
|
327
327
|
*/
|
|
328
|
-
const paged = /* @__PURE__ */ Effect.fnUntraced(function* (read, input, digest, run, call, roots) {
|
|
328
|
+
const paged = /* @__PURE__ */ Effect.fnUntraced(function* (read, input, digest, run, call, roots, most = 200) {
|
|
329
329
|
const limits = yield* limitsOf(input.limits);
|
|
330
|
-
const limit = yield* limitOf(input.page);
|
|
330
|
+
const limit = yield* limitOf(input.page, most);
|
|
331
331
|
const after = yield* afterOf(input.page?.after, digest);
|
|
332
332
|
const items = [];
|
|
333
333
|
const keeps = keeperOf(input);
|
|
@@ -17,7 +17,7 @@ export interface EventStreamCalls {
|
|
|
17
17
|
readonly feed: (input: FeedInput) => Stream.Stream<FeedItem, GitError>;
|
|
18
18
|
}
|
|
19
19
|
declare const EventStreams_base: Context.ServiceClass<EventStreams, "@ref0/git/EventStreams", EventStreamCalls>;
|
|
20
|
-
/** A server's event feeds: every server's context holds it
|
|
20
|
+
/** A server's event feeds: every server's context holds it. */
|
|
21
21
|
export declare class EventStreams extends /* @__PURE__ */ EventStreams_base {}
|
|
22
22
|
export declare const feed: (input: FeedInput) => Stream.Stream<FeedItem, GitError, EventStreams>;
|
|
23
23
|
/**
|
|
@@ -10,7 +10,7 @@ var event_streams_exports = /* @__PURE__ */ __exportAll({
|
|
|
10
10
|
feed: () => feed,
|
|
11
11
|
layer: () => layer
|
|
12
12
|
});
|
|
13
|
-
/** A server's event feeds: every server's context holds it
|
|
13
|
+
/** A server's event feeds: every server's context holds it. */
|
|
14
14
|
var EventStreams = class extends (/* @__PURE__ */ Context.Service()("@ref0/git/EventStreams")) {};
|
|
15
15
|
const feed = (input) => Stream.unwrap(Effect.map(Effect.service(EventStreams), (streams) => streams.feed(input)));
|
|
16
16
|
/**
|
|
@@ -24,7 +24,7 @@ export interface FeedFields {
|
|
|
24
24
|
declare const FeedParts_base: Context.ServiceClass<FeedParts, "@ref0/git/event-streams/FeedParts", FeedFields>;
|
|
25
25
|
/**
|
|
26
26
|
* The server's `FeedFields`, which `EventStreams.layer()` builds over beside core's needs.
|
|
27
|
-
* Internal:
|
|
27
|
+
* Internal: only `Git.layer`'s core provides it.
|
|
28
28
|
*/
|
|
29
29
|
export declare class FeedParts extends /* @__PURE__ */ FeedParts_base {}
|
|
30
30
|
/** What `EventStreams.feed` is asked: whose events, from which repo, and after which `seq`. */
|
|
@@ -19,7 +19,7 @@ import * as Stream from "effect/Stream";
|
|
|
19
19
|
// src/event-streams/stream.ts
|
|
20
20
|
/**
|
|
21
21
|
* The server's `FeedFields`, which `EventStreams.layer()` builds over beside core's needs.
|
|
22
|
-
* Internal:
|
|
22
|
+
* Internal: only `Git.layer`'s core provides it.
|
|
23
23
|
*/
|
|
24
24
|
var FeedParts = class extends (/* @__PURE__ */ Context.Service()("@ref0/git/event-streams/FeedParts")) {};
|
|
25
25
|
/** The `FeedNeeds` a feed opened over, with its clock, which each later step runs over. */
|
package/dist/extend.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { isServerClosed } from "./store/closed.mjs";
|
|
2
|
-
import { Joined, JoinedAdapter, JoinedCalls
|
|
2
|
+
import { Joined, JoinedAdapter, JoinedCalls } from "./server/joined.mjs";
|
|
3
3
|
import { Bucket } from "./contracts/objects.mjs";
|
|
4
4
|
import { Clock, RecordStore, Store } from "./contracts/promises.mjs";
|
|
5
|
-
import { ImportState } from "./contracts/sync.mjs";
|
|
6
|
-
|
|
5
|
+
import { ImportLfsMissed, ImportLfsReason, ImportState, ImportStatus } from "./contracts/sync.mjs";
|
|
6
|
+
import { heldUntil, inTime } from "./store/repo-record.mjs";
|
|
7
|
+
export { type Bucket, type Clock, type ImportLfsMissed, type ImportLfsReason, type ImportState, type ImportStatus, type Joined, type JoinedAdapter, JoinedCalls, type RecordStore, type Store, heldUntil, inTime, isServerClosed };
|
package/dist/extend.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { isServerClosed } from "./store/closed.mjs";
|
|
2
|
-
import { JoinedCalls
|
|
3
|
-
|
|
2
|
+
import { JoinedCalls } from "./server/joined.mjs";
|
|
3
|
+
import { heldUntil, inTime } from "./store/repo-record.mjs";
|
|
4
|
+
export { JoinedCalls, heldUntil, inTime, isServerClosed };
|
package/dist/http/answers.mjs
CHANGED
|
@@ -43,14 +43,16 @@ const notFound = () => refused(404, "NOT_FOUND", "Repository not found");
|
|
|
43
43
|
* read gets the 404 a missing repo gets, so the repo's existence stays hidden. Pass `true` for an
|
|
44
44
|
* answer that isn't a repo read, such as a push, a feature route or an approval page, so
|
|
45
45
|
* `NOT_ALLOWED` keeps its 403. Any other refusal's body is its message, then its `hintLines`, which
|
|
46
|
-
* Git prints as `remote:` lines
|
|
46
|
+
* Git prints as `remote:` lines, and an `UNAVAILABLE` naming its `retryAfter` sets `Retry-After`.
|
|
47
47
|
*/
|
|
48
48
|
const refusal = (error, pushing = false) => {
|
|
49
49
|
if (error.code === "UNAUTHENTICATED") return signIn(error.message);
|
|
50
50
|
if (error.code === "NOT_FOUND" || error.code === "NOT_ALLOWED" && !pushing) return notFound();
|
|
51
51
|
const rateLimited = error.code === "RESOURCE_EXHAUSTED" && error.context?.reason === "rate-limited";
|
|
52
52
|
const body = [error.message, ...hintLines(error.hint)].join("\n");
|
|
53
|
-
|
|
53
|
+
const retryAfter = error.code === "UNAVAILABLE" ? error.context?.retryAfter : void 0;
|
|
54
|
+
const headers = retryAfter === void 0 ? void 0 : { "retry-after": `${retryAfter}` };
|
|
55
|
+
return refused(rateLimited ? 429 : httpStatus[error.code], error.code, body, headers);
|
|
54
56
|
};
|
|
55
57
|
/** A 301 to `location`, as a renamed repo's old `info/refs` answers. */
|
|
56
58
|
const moved = (location) => {
|
package/dist/http/core-parts.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { fail, gitErrorFrom } from "../contracts/result.mjs";
|
|
2
|
-
import { openRepo, repoAccess } from "../core/access.mjs";
|
|
1
|
+
import { fail, gitError, gitErrorFrom } from "../contracts/result.mjs";
|
|
2
|
+
import { contended, openRepo, repoAccess } from "../core/access.mjs";
|
|
3
3
|
import { accessAgain } from "../core/ref-view.mjs";
|
|
4
|
-
import { gitPush } from "../core/push.mjs";
|
|
4
|
+
import { gitPush, keyedGitPush } from "../core/push.mjs";
|
|
5
5
|
import { runFetchRules } from "../core/rules/fetch.mjs";
|
|
6
6
|
import { fetchRulesOf } from "../core/rules/service.mjs";
|
|
7
7
|
import { CoreParts, ObjectsParts } from "../core/parts.mjs";
|
|
8
|
-
import { SealedObjects, viewOf } from "../core/view.mjs";
|
|
9
|
-
import { notReachable } from "../storage/visible.mjs";
|
|
10
|
-
import { heldOf, unreachableWant } from "../storage/wants.mjs";
|
|
8
|
+
import { SealedObjects, rootsSeen, viewOf } from "../core/view.mjs";
|
|
9
|
+
import { isVisibleTooLong, notReachable } from "../storage/visible.mjs";
|
|
10
|
+
import { heldOf, unreachableWant, wantWalkMost } from "../storage/wants.mjs";
|
|
11
11
|
import { objectsFace } from "../storage/calls.mjs";
|
|
12
12
|
import { indexRowKey } from "../storage/layout.mjs";
|
|
13
13
|
import { spentIn } from "../contracts/calls-spent.mjs";
|
|
@@ -68,6 +68,16 @@ const fullClone = (table, request, refs) => {
|
|
|
68
68
|
const wants = new Set(request.wants);
|
|
69
69
|
return request.haves.length === 0 && request.shallows.length === 0 && request.depth === void 0 && request.deepenRelative !== true && request.filter === void 0 && refs.every((ref) => !fetchReaches(table, ref.name) || wants.has(ref.oid));
|
|
70
70
|
};
|
|
71
|
+
/**
|
|
72
|
+
* A v0 listing's refusal where no index covers the listing and the walk of the caller's visible
|
|
73
|
+
* commits passes its bound before it ends: a root told as `shallow` it can't read names a hidden
|
|
74
|
+
* commit, and one left out sends a clone history it can't connect. v2 tells only the roots a
|
|
75
|
+
* fetch's pack sends, which asks no such question.
|
|
76
|
+
*/
|
|
77
|
+
const rootsPastWalk = () => gitError("RESOURCE_EXHAUSTED", `Can't tell which of the repo's shallow roots you can read within ${wantWalkMost} objects: fetch with Git's protocol v2, \`git -c protocol.version=2\``, {
|
|
78
|
+
hint: "Fetch with Git protocol v2",
|
|
79
|
+
context: { reason: "walk-limit" }
|
|
80
|
+
});
|
|
71
81
|
const coreHttpParts = (parts, options = {}) => {
|
|
72
82
|
const { needs } = parts;
|
|
73
83
|
const core = Context.get(needs, CoreParts);
|
|
@@ -192,7 +202,8 @@ const coreHttpParts = (parts, options = {}) => {
|
|
|
192
202
|
* at its own. Each later page reads the record in its own call and asks `current`, and the first
|
|
193
203
|
* page and `HEAD` ask it of `HEAD`'s read, the later of theirs, so a repo deleted, renamed or made
|
|
194
204
|
* private, a right lost or a token revoked since the open, a POST's body read between, ends the
|
|
195
|
-
* listing.
|
|
205
|
+
* listing. The repo's roots are read with page 1, and those `caller` may be told are asked once
|
|
206
|
+
* the last page is listed, as `ListedRefs.roots` says.
|
|
196
207
|
*/
|
|
197
208
|
const listsAt = Effect.fnUntraced(function* (caller, repo, resolved) {
|
|
198
209
|
const { internalId } = resolved;
|
|
@@ -211,8 +222,9 @@ const coreHttpParts = (parts, options = {}) => {
|
|
|
211
222
|
});
|
|
212
223
|
/** The refs of `rows` `view` sees, each tag peeled: a row with no peel fails in the stream. */
|
|
213
224
|
const refsOf = ({ rows, view }) => Effect.flatMap(view.refs(rows), (seen) => advertised(rows, seen));
|
|
214
|
-
const page = yield* readRecord(core.store, internalId, [refPage()]);
|
|
225
|
+
const page = yield* readRecord(core.store, internalId, [refPage(), repoRootsKey]);
|
|
215
226
|
if (page.record === void 0) return yield* fail("NOT_FOUND", `No repo '${repo}'`);
|
|
227
|
+
const roots = yield* rootsOf(page.snapshot.results[2]);
|
|
216
228
|
const head = headOf(page.record.defaultBranch);
|
|
217
229
|
const headRead = {
|
|
218
230
|
collection: collections.refs,
|
|
@@ -233,19 +245,52 @@ const coreHttpParts = (parts, options = {}) => {
|
|
|
233
245
|
});
|
|
234
246
|
let pending = first;
|
|
235
247
|
let after = first.last;
|
|
248
|
+
const hidden = core.hiddenRefs();
|
|
249
|
+
const tips = [];
|
|
250
|
+
const shownOf = Effect.fnUntraced(function* (at) {
|
|
251
|
+
const refs = yield* refsOf(at);
|
|
252
|
+
if (roots.size > 0) for (const { name, oid } of refs) tips.push({
|
|
253
|
+
name,
|
|
254
|
+
oid
|
|
255
|
+
});
|
|
256
|
+
return refs;
|
|
257
|
+
});
|
|
236
258
|
const next = Effect.gen(function* () {
|
|
237
259
|
const page = pending;
|
|
238
260
|
pending = void 0;
|
|
239
|
-
if (page !== void 0) return yield*
|
|
261
|
+
if (page !== void 0) return yield* shownOf(page);
|
|
240
262
|
if (after === void 0) return void 0;
|
|
241
263
|
const later = yield* pageAt(after);
|
|
242
264
|
after = later.last;
|
|
243
|
-
return yield*
|
|
265
|
+
return yield* shownOf(later);
|
|
266
|
+
});
|
|
267
|
+
const told = Effect.gen(function* () {
|
|
268
|
+
if (roots.size === 0) return [];
|
|
269
|
+
const read = yield* readRecord(core.store, internalId, [
|
|
270
|
+
packsRead,
|
|
271
|
+
indexRowKey,
|
|
272
|
+
repoRootsKey
|
|
273
|
+
]);
|
|
274
|
+
const { view } = yield* current(caller, repo, resolved, read);
|
|
275
|
+
const seen = yield* view.refView;
|
|
276
|
+
const [, packRows = [], indexRows = [], rootRows] = read.snapshot.results;
|
|
277
|
+
const packs = yield* decodePacks(packRows);
|
|
278
|
+
const at = {
|
|
279
|
+
listed: {
|
|
280
|
+
repo: internalId,
|
|
281
|
+
version: read.snapshot.version,
|
|
282
|
+
packs
|
|
283
|
+
},
|
|
284
|
+
index: indexRows[0]?.value,
|
|
285
|
+
roots: yield* rootsOf(rootRows),
|
|
286
|
+
tips: [...new Set(tips.flatMap(({ name, oid }) => seen.sees(name) ? [oid] : []))]
|
|
287
|
+
};
|
|
288
|
+
return [...yield* Effect.catchIf(rootsSeen(view, at), isVisibleTooLong, () => Effect.fail(rootsPastWalk()))].toSorted();
|
|
244
289
|
});
|
|
245
|
-
const hidden = core.hiddenRefs();
|
|
246
290
|
const listed = {
|
|
247
291
|
next: Effect.provideContext(next, needs),
|
|
248
|
-
hidden
|
|
292
|
+
hidden,
|
|
293
|
+
roots: Effect.provideContext(told, needs)
|
|
249
294
|
};
|
|
250
295
|
const shown = hiddenUnder(hidden, head) === void 0;
|
|
251
296
|
if (shown && refView.sees(head)) listed.head = head;
|
|
@@ -300,6 +345,7 @@ const coreHttpParts = (parts, options = {}) => {
|
|
|
300
345
|
const unruled = (yield* fetchRulesOf()).length === 0;
|
|
301
346
|
if (at.whole && unruled && fullClone(core.hiddenRefs(), request, at.refs.refs)) fetching.whole = true;
|
|
302
347
|
if (request.thinPack === true && at.seesAll && unruled) fetching.thin = true;
|
|
348
|
+
if (at.roots.size > 0) fetching.roots = [...at.roots];
|
|
303
349
|
return yield* at.objects.fetch(at.listed, fetching);
|
|
304
350
|
})
|
|
305
351
|
};
|
|
@@ -391,10 +437,11 @@ const landed = (stored, objects, caller, repo, input, internalId) => {
|
|
|
391
437
|
edits: input.edits,
|
|
392
438
|
atomic: input.atomic,
|
|
393
439
|
pushOptions: input.pushOptions,
|
|
394
|
-
request: input.request,
|
|
395
440
|
signal: input.signal
|
|
396
441
|
};
|
|
397
|
-
if (input.
|
|
442
|
+
if (input.request !== void 0) request.request = input.request;
|
|
443
|
+
if (input.stepped !== void 0) request.pack = input.stepped;
|
|
444
|
+
else if (input.pack !== void 0) {
|
|
398
445
|
const { bytes, objects, length, atMost } = input.pack;
|
|
399
446
|
const pack = {
|
|
400
447
|
bytes,
|
|
@@ -406,7 +453,9 @@ const landed = (stored, objects, caller, repo, input, internalId) => {
|
|
|
406
453
|
}
|
|
407
454
|
if (internalId !== void 0) request.internalId = internalId;
|
|
408
455
|
if (input.shallow !== void 0) request.shallow = input.shallow;
|
|
409
|
-
|
|
456
|
+
const { key } = input;
|
|
457
|
+
const pushing = key === void 0 ? gitPush(request) : Effect.flatMap(keyedGitPush(request, key), (answer) => answer === void 0 ? contended() : Effect.succeed(answer));
|
|
458
|
+
return Effect.provideService(pushing, ObjectsParts, {
|
|
410
459
|
...stored,
|
|
411
460
|
objects
|
|
412
461
|
});
|
package/dist/http/handler.mjs
CHANGED
|
@@ -21,8 +21,8 @@ const gitHttp = (parts) => {
|
|
|
21
21
|
} };
|
|
22
22
|
};
|
|
23
23
|
/**
|
|
24
|
-
* What git-lfs prints from a server without `
|
|
25
|
-
* turns it on, and nothing only a host sets. The host's step
|
|
24
|
+
* What git-lfs prints from a server without `Lfs.layer()`, to the person pushing as much as its
|
|
25
|
+
* host: who turns it on, and nothing only a host sets. The host's step is in `docs/deploy/large-pushes.md`.
|
|
26
26
|
*/
|
|
27
27
|
const lfsOff = "This server has no Git LFS: its host turns it on";
|
|
28
28
|
/** A request to Git LFS's API: its refusals are LFS's JSON, as git-lfs reads them. */
|
package/dist/http/node.mjs
CHANGED
|
@@ -148,8 +148,9 @@ const answerAt = (handler, incoming, response, url) => {
|
|
|
148
148
|
});
|
|
149
149
|
};
|
|
150
150
|
/**
|
|
151
|
-
* A
|
|
152
|
-
* `
|
|
151
|
+
* A `fetch` as a `node:http` or `node:http2` listener or an Express route, which
|
|
152
|
+
* `@ref0/git/node`'s `toNodeHandler` hands a runtime's `Git.toFetch`; beside an app's own routes,
|
|
153
|
+
* `toNodeMiddleware`. The body
|
|
153
154
|
* streams to Git unread. The response streams back as Node can take it, and a client that
|
|
154
155
|
* disconnects or resets its stream before the response ends, which a `close` of the HTTP/2
|
|
155
156
|
* stream, or the HTTP/1 response, before `writableEnded` says, aborts the request's `signal`, which ends Git's reads and leaves it
|
|
@@ -159,8 +160,8 @@ const answerAt = (handler, incoming, response, url) => {
|
|
|
159
160
|
*/
|
|
160
161
|
const toNodeHandler = (handler) => (incoming, response) => answerAt(handler, incoming, response, void 0);
|
|
161
162
|
/**
|
|
162
|
-
* A
|
|
163
|
-
* `
|
|
163
|
+
* A `fetch` beside an app's own routes, as an Express middleware, which `@ref0/git/node`'s
|
|
164
|
+
* `toNodeMiddleware` hands a runtime's `Git.toFetch`, before any body parser. A
|
|
164
165
|
* request `pathOf` names is answered at the path it gives, as `toNodeHandler` answers it, the
|
|
165
166
|
* query kept; every other goes on to `next`, its body unread. `pathOf` is handed the URL `fetch`
|
|
166
167
|
* gets, with its dot segments resolved, so the path Express routed by never decides. A URL that
|
package/dist/http/parts.d.mts
CHANGED
|
@@ -5,6 +5,7 @@ import "../contracts/refs.mjs";
|
|
|
5
5
|
import "../contracts/result.mjs";
|
|
6
6
|
import "../auth/identify.mjs";
|
|
7
7
|
import "../core/access.mjs";
|
|
8
|
+
import "../core/push.mjs";
|
|
8
9
|
import "../store/call-count.mjs";
|
|
9
10
|
import "../protocol/wire/advertisement.mjs";
|
|
10
11
|
import "../protocol/wire/lines.mjs";
|