@ref0/git 0.12.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 +3 -3
- 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 +11 -1
- package/dist/contracts/git.d.mts +18 -7
- 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 +23 -18
- package/dist/contracts/result.mjs +17 -4
- 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 +79 -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.mjs +27 -5
- package/dist/core/ancestry.d.mts +9 -0
- package/dist/core/ancestry.mjs +6 -6
- package/dist/core/asked.mjs +42 -4
- package/dist/core/call-names.mjs +1 -0
- package/dist/core/call-services.mjs +2 -1
- package/dist/core/events/deliver.mjs +10 -2
- package/dist/core/forks.mjs +3 -3
- package/dist/core/imports.mjs +147 -9
- 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/parts.d.mts +6 -1
- 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 +98 -26
- package/dist/core/receipts.mjs +26 -10
- package/dist/core/ref-view.mjs +59 -5
- package/dist/core/refs.mjs +13 -8
- package/dist/core/repack.mjs +11 -8
- package/dist/core/repo-info.mjs +16 -9
- package/dist/core/repos.mjs +30 -14
- 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 +3 -3
- package/dist/extend.mjs +2 -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 +114 -56
- 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/objects.d.mts +6 -0
- package/dist/lfs/objects.mjs +68 -41
- 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/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 +31 -23
- 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 +273 -240
- 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 +127 -115
- package/dist/rest/forks.d.mts +121 -97
- 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 +2 -1
- 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 +282 -226
- package/dist/rest/refs.d.mts +205 -176
- package/dist/rest/repos.d.mts +108 -80
- package/dist/rest/tags.d.mts +24 -12
- package/dist/rest/tokens.d.mts +235 -211
- package/dist/rest/topics.d.mts +53 -33
- package/dist/rest/trees.d.mts +105 -89
- 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 +3 -3
- 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 +133 -212
- 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 +28 -4
- package/dist/storage/pack-reads.mjs +8 -8
- 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-walk.mjs +54 -16
- package/dist/storage/prune.mjs +629 -196
- package/dist/storage/push-uploads.mjs +36 -12
- package/dist/storage/quarantine.mjs +9 -9
- 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 +9 -7
- package/dist/store/repo-record.mjs +102 -19
- 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 +55 -43
- package/dist/sync/http.mjs +36 -1
- package/dist/sync/import.mjs +1 -0
- 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 +210 -137
- package/dist/sync/smart-http.mjs +4 -2
- package/dist/sync/step.mjs +25 -5
- package/dist/sync/tries.mjs +45 -14
- package/dist/sync.d.mts +2 -2
- 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 -5
- 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/contracts/repos.mjs
CHANGED
|
@@ -8,6 +8,7 @@ var repos_exports = /* @__PURE__ */ __exportAll({
|
|
|
8
8
|
JobCounts: () => JobCounts,
|
|
9
9
|
Moment: () => Moment,
|
|
10
10
|
PinnedRepo: () => PinnedRepo,
|
|
11
|
+
RenamedRepo: () => RenamedRepo,
|
|
11
12
|
RepoCatalogueEntry: () => RepoCatalogueEntry,
|
|
12
13
|
RepoCreate: () => RepoCreate,
|
|
13
14
|
RepoIndexHold: () => RepoIndexHold,
|
|
@@ -104,6 +105,12 @@ const RepoInfo = /* @__PURE__ */ Schema.Struct({
|
|
|
104
105
|
public: Schema.Boolean,
|
|
105
106
|
upstream: Schema.optionalKey(RepoName),
|
|
106
107
|
/**
|
|
108
|
+
* Whether the repo's history stops short of its first commits: true while it holds roots, the
|
|
109
|
+
* commits a shallow import or a shallow fetch ends at, and false once none is left. Told to
|
|
110
|
+
* every caller, since it names no commit.
|
|
111
|
+
*/
|
|
112
|
+
shallow: Schema.Boolean,
|
|
113
|
+
/**
|
|
107
114
|
* The repo's stats as this caller may know them: all of them for a caller with the whole view,
|
|
108
115
|
* and for one a private pattern restricts, only `repo`, `refs` and `pushedAt`, as
|
|
109
116
|
* `RepoInfoStats` says.
|
|
@@ -116,6 +123,18 @@ const RepoInfo = /* @__PURE__ */ Schema.Struct({
|
|
|
116
123
|
work: Schema.optionalKey(RepoWork)
|
|
117
124
|
}).annotate({ identifier: "RepoInfo" });
|
|
118
125
|
/**
|
|
126
|
+
* A rename's answer: the repo under its new name, and `seq`, the place in the name's event
|
|
127
|
+
* sequence of the `repo.renamed` the rename's commit wrote, so a host matches its own work to that
|
|
128
|
+
* event, as the drop-in keys a transfer's grants by the repo and `seq`. A key sent again answers the
|
|
129
|
+
* same `seq`. Left out when the server keeps no events, with no delivery, since no event is written
|
|
130
|
+
* and the sequence doesn't move: two renames there would otherwise answer one `seq`. It's the host's,
|
|
131
|
+
* so only a call in the host's process answers it: REST, and the client over it, leave it out.
|
|
132
|
+
*/
|
|
133
|
+
const RenamedRepo = /* @__PURE__ */ Schema.Struct({
|
|
134
|
+
...RepoInfo.fields,
|
|
135
|
+
seq: Schema.optionalKey(Schema.Int)
|
|
136
|
+
}).annotate({ identifier: "RenamedRepo" });
|
|
137
|
+
/**
|
|
119
138
|
* A repo's name together with the internal ID it held when a request resolved it. A rename moves
|
|
120
139
|
* the name to another internal ID, so a call that holds both acts on the repo it resolved.
|
|
121
140
|
*/
|
|
@@ -138,7 +157,15 @@ const RepoRecord = /* @__PURE__ */ Schema.Struct({
|
|
|
138
157
|
upstream: Schema.optionalKey(RepoName),
|
|
139
158
|
/** A fork's source's internal ID, kept after the source is renamed or deleted, beside `upstream`. */
|
|
140
159
|
upstreamInternalId: Schema.optionalKey(InternalRepoId),
|
|
141
|
-
createdAt: Moment
|
|
160
|
+
createdAt: Moment,
|
|
161
|
+
/**
|
|
162
|
+
* The `seq` of the rename that gave the repo its name now, as `RenamedRepo.seq` answered it:
|
|
163
|
+
* absent for a repo never renamed, and when the server keeps no events. The host's alone, never
|
|
164
|
+
* on the wire. A host stamps its own work with it, so its work for a rename's event delivered
|
|
165
|
+
* late tells what came after: the drop-in stamps each grant, and a move drops the team grants
|
|
166
|
+
* whose stamp is `<` its `seq`.
|
|
167
|
+
*/
|
|
168
|
+
renamedSeq: Schema.optionalKey(Schema.Int)
|
|
142
169
|
});
|
|
143
170
|
/** A create's own fields. Its actor, key and signal are `WriteInput`'s, with no JSON form. */
|
|
144
171
|
const RepoCreate = /* @__PURE__ */ Schema.Struct({
|
|
@@ -172,4 +199,4 @@ const list = (input, by) => Effect.flatMap(Effect.service(Repos), (calls) => cal
|
|
|
172
199
|
const update = (repo, input, by) => Effect.flatMap(Effect.service(Repos), (calls) => calls.update(repo, input, by));
|
|
173
200
|
const rename = (repo, input, by) => Effect.flatMap(Effect.service(Repos), (calls) => calls.rename(repo, input, by));
|
|
174
201
|
const remove = (repo, input, by) => Effect.flatMap(Effect.service(Repos), (calls) => calls.delete(repo, input, by));
|
|
175
|
-
export { JobCounts, Moment, PinnedRepo, RepoCatalogueEntry, RepoCreate, RepoIndexHold, RepoInfo, RepoInfoStats, RepoRecord, RepoStats, RepoWork, Repos, create, remove as delete, get, list, rename, repos_exports, update };
|
|
202
|
+
export { JobCounts, Moment, PinnedRepo, RenamedRepo, RepoCatalogueEntry, RepoCreate, RepoIndexHold, RepoInfo, RepoInfoStats, RepoRecord, RepoStats, RepoWork, Repos, create, remove as delete, get, list, rename, repos_exports, update };
|
|
@@ -98,6 +98,10 @@ export type PreconditionContext = typeof PreconditionContext.Type;
|
|
|
98
98
|
* add or hold may fit once one leaves. `queue-targets-full` is a write onto a new target once the
|
|
99
99
|
* repo's queues hold as many targets as they may, which no leave mends: queue onto one it holds.
|
|
100
100
|
*
|
|
101
|
+
* `repo-too-large` is a push that would take its repo's `ownBytes` past the server's
|
|
102
|
+
* `pushes.repo.refuseAbove`, which no default sets. Only a push that adds bytes is refused, so one
|
|
103
|
+
* that deletes or moves refs still lands.
|
|
104
|
+
*
|
|
101
105
|
* `prune-walk-too-large` is upkeep's prune pass, refused at one of the bounds its message names:
|
|
102
106
|
* - its walk's charge past the step's allotment, its seen set of a bit an object beside a fixed
|
|
103
107
|
* room for its packs' indexes, `pruneIndexFloor`'s 32 MiB: past about 141,500,000 objects at
|
|
@@ -126,14 +130,14 @@ export type PreconditionContext = typeof PreconditionContext.Type;
|
|
|
126
130
|
* tries it again by the job's policy, and the next try goes on from what it saved. Its context is
|
|
127
131
|
* `job-step-calls`', and each try it takes spends one of the job's attempts.
|
|
128
132
|
*/
|
|
129
|
-
export declare const ResourceReason: Schema.Literals<readonly ["too-large", "rate-limited", "walk-limit", "diff-limit", "object-too-large", "delta-too-large", "response-too-large", "too-many-pointers", "fetch-plan-too-large", "too-many-store-calls", "call-budget", "events-undelivered", "events-waiting", "name-churn", "queue-full", "queue-targets-full", "too-many-gitmodules-and-gitattributes", "prune-walk-too-large", "job-step-calls", "job-step-yielded"]>;
|
|
133
|
+
export declare const ResourceReason: Schema.Literals<readonly ["too-large", "rate-limited", "walk-limit", "diff-limit", "object-too-large", "repo-too-large", "delta-too-large", "response-too-large", "too-many-pointers", "fetch-plan-too-large", "too-many-store-calls", "call-budget", "events-undelivered", "events-waiting", "name-churn", "queue-full", "queue-targets-full", "too-many-gitmodules-and-gitattributes", "prune-walk-too-large", "job-step-calls", "job-step-yielded"]>;
|
|
130
134
|
/**
|
|
131
135
|
* A push refused `too-large` by the repo's pack indexes it reads: those indexes' bytes in
|
|
132
136
|
* `indexBytes`, the push's own beside them in `pushBytes`, and the most the server's memory could
|
|
133
137
|
* give it in `most`.
|
|
134
138
|
*/
|
|
135
139
|
export declare const ResourceContext: Schema.StructWithRest<Schema.Struct<{
|
|
136
|
-
reason: Schema.optionalKey<Schema.Union<readonly [Schema.Literals<readonly ["too-large", "rate-limited", "walk-limit", "diff-limit", "object-too-large", "delta-too-large", "response-too-large", "too-many-pointers", "fetch-plan-too-large", "too-many-store-calls", "call-budget", "events-undelivered", "events-waiting", "name-churn", "queue-full", "queue-targets-full", "too-many-gitmodules-and-gitattributes", "prune-walk-too-large", "job-step-calls", "job-step-yielded"]>, Schema.decodeTo<Schema.String, Schema.String, never, never>]>>;
|
|
140
|
+
reason: Schema.optionalKey<Schema.Union<readonly [Schema.Literals<readonly ["too-large", "rate-limited", "walk-limit", "diff-limit", "object-too-large", "repo-too-large", "delta-too-large", "response-too-large", "too-many-pointers", "fetch-plan-too-large", "too-many-store-calls", "call-budget", "events-undelivered", "events-waiting", "name-churn", "queue-full", "queue-targets-full", "too-many-gitmodules-and-gitattributes", "prune-walk-too-large", "job-step-calls", "job-step-yielded"]>, Schema.decodeTo<Schema.String, Schema.String, never, never>]>>;
|
|
137
141
|
indexBytes: Schema.optionalKey<Schema.Number>;
|
|
138
142
|
pushBytes: Schema.optionalKey<Schema.Number>;
|
|
139
143
|
most: Schema.optionalKey<Schema.Number>;
|
|
@@ -168,14 +172,21 @@ export type HostErrorContext = typeof HostErrorContext.Type;
|
|
|
168
172
|
* index is rebuilt for the server's patterns: the same call is served once the index is built.
|
|
169
173
|
* `may-have-saved`: the write may have landed, so read it back before sending it again.
|
|
170
174
|
* `too-many-writes`: other writes won every try, so no ref changed; sending the same request again
|
|
171
|
-
* is safe.
|
|
175
|
+
* is safe. `starting`: the server's build failed on weather, and a call once `retryAfter` seconds
|
|
176
|
+
* pass starts it again.
|
|
177
|
+
*/
|
|
178
|
+
export declare const UnavailableReason: Schema.Literals<readonly ["busy", "packs-awaiting-repack", "awaiting-index", "may-have-saved", "too-many-writes", "starting"]>;
|
|
179
|
+
/**
|
|
180
|
+
* `UNAVAILABLE`'s context: `reason` says why, and `retryAfter`, the seconds to wait, comes with
|
|
181
|
+
* `starting`, as HTTP's `Retry-After` does. Both are additions: a caller that reads neither meets
|
|
182
|
+
* `UNAVAILABLE` and a 503, as it did when a failed build answered that way for good.
|
|
172
183
|
*/
|
|
173
|
-
export declare const UnavailableReason: Schema.Literals<readonly ["busy", "packs-awaiting-repack", "awaiting-index", "may-have-saved", "too-many-writes"]>;
|
|
174
184
|
export declare const UnavailableContext: Schema.StructWithRest<Schema.Struct<{
|
|
175
185
|
id: Schema.optionalKey<Schema.decodeTo<Schema.String, Schema.String, never, never>>;
|
|
176
|
-
reason: Schema.optionalKey<Schema.Union<readonly [Schema.Literals<readonly ["busy", "packs-awaiting-repack", "awaiting-index", "may-have-saved", "too-many-writes"]>, Schema.decodeTo<Schema.String, Schema.String, never, never>]>>;
|
|
186
|
+
reason: Schema.optionalKey<Schema.Union<readonly [Schema.Literals<readonly ["busy", "packs-awaiting-repack", "awaiting-index", "may-have-saved", "too-many-writes", "starting"]>, Schema.decodeTo<Schema.String, Schema.String, never, never>]>>;
|
|
177
187
|
packs: Schema.optionalKey<Schema.Number>;
|
|
178
188
|
most: Schema.optionalKey<Schema.Number>;
|
|
189
|
+
retryAfter: Schema.optionalKey<Schema.Number>;
|
|
179
190
|
}>, readonly [Schema.$Record<Schema.String, Schema.Union<readonly [Schema.decodeTo<Schema.String, Schema.String, never, never>, Schema.Number, Schema.Boolean, Schema.$Array<Schema.decodeTo<Schema.String, Schema.String, never, never>>, Schema.Undefined]>>]>;
|
|
180
191
|
export type UnavailableContext = typeof UnavailableContext.Type;
|
|
181
192
|
/** Each code's context. */
|
|
@@ -210,7 +221,7 @@ export declare const gitErrorContexts: {
|
|
|
210
221
|
tip: Schema.optionalKey<Schema.decodeTo<Schema.String, Schema.String, never, never>>;
|
|
211
222
|
}>, readonly [Schema.$Record<Schema.String, Schema.Union<readonly [Schema.decodeTo<Schema.String, Schema.String, never, never>, Schema.Number, Schema.Boolean, Schema.$Array<Schema.decodeTo<Schema.String, Schema.String, never, never>>, Schema.Undefined]>>]>;
|
|
212
223
|
readonly RESOURCE_EXHAUSTED: Schema.StructWithRest<Schema.Struct<{
|
|
213
|
-
reason: Schema.optionalKey<Schema.Union<readonly [Schema.Literals<readonly ["too-large", "rate-limited", "walk-limit", "diff-limit", "object-too-large", "delta-too-large", "response-too-large", "too-many-pointers", "fetch-plan-too-large", "too-many-store-calls", "call-budget", "events-undelivered", "events-waiting", "name-churn", "queue-full", "queue-targets-full", "too-many-gitmodules-and-gitattributes", "prune-walk-too-large", "job-step-calls", "job-step-yielded"]>, Schema.decodeTo<Schema.String, Schema.String, never, never>]>>;
|
|
224
|
+
reason: Schema.optionalKey<Schema.Union<readonly [Schema.Literals<readonly ["too-large", "rate-limited", "walk-limit", "diff-limit", "object-too-large", "repo-too-large", "delta-too-large", "response-too-large", "too-many-pointers", "fetch-plan-too-large", "too-many-store-calls", "call-budget", "events-undelivered", "events-waiting", "name-churn", "queue-full", "queue-targets-full", "too-many-gitmodules-and-gitattributes", "prune-walk-too-large", "job-step-calls", "job-step-yielded"]>, Schema.decodeTo<Schema.String, Schema.String, never, never>]>>;
|
|
214
225
|
indexBytes: Schema.optionalKey<Schema.Number>;
|
|
215
226
|
pushBytes: Schema.optionalKey<Schema.Number>;
|
|
216
227
|
most: Schema.optionalKey<Schema.Number>;
|
|
@@ -220,9 +231,10 @@ export declare const gitErrorContexts: {
|
|
|
220
231
|
}>, readonly [Schema.$Record<Schema.String, Schema.Union<readonly [Schema.decodeTo<Schema.String, Schema.String, never, never>, Schema.Number, Schema.Boolean, Schema.$Array<Schema.decodeTo<Schema.String, Schema.String, never, never>>, Schema.Undefined]>>]>;
|
|
221
232
|
readonly UNAVAILABLE: Schema.StructWithRest<Schema.Struct<{
|
|
222
233
|
id: Schema.optionalKey<Schema.decodeTo<Schema.String, Schema.String, never, never>>;
|
|
223
|
-
reason: Schema.optionalKey<Schema.Union<readonly [Schema.Literals<readonly ["busy", "packs-awaiting-repack", "awaiting-index", "may-have-saved", "too-many-writes"]>, Schema.decodeTo<Schema.String, Schema.String, never, never>]>>;
|
|
234
|
+
reason: Schema.optionalKey<Schema.Union<readonly [Schema.Literals<readonly ["busy", "packs-awaiting-repack", "awaiting-index", "may-have-saved", "too-many-writes", "starting"]>, Schema.decodeTo<Schema.String, Schema.String, never, never>]>>;
|
|
224
235
|
packs: Schema.optionalKey<Schema.Number>;
|
|
225
236
|
most: Schema.optionalKey<Schema.Number>;
|
|
237
|
+
retryAfter: Schema.optionalKey<Schema.Number>;
|
|
226
238
|
}>, readonly [Schema.$Record<Schema.String, Schema.Union<readonly [Schema.decodeTo<Schema.String, Schema.String, never, never>, Schema.Number, Schema.Boolean, Schema.$Array<Schema.decodeTo<Schema.String, Schema.String, never, never>>, Schema.Undefined]>>]>;
|
|
227
239
|
readonly DATA_LOSS: Schema.StructWithRest<Schema.Struct<{
|
|
228
240
|
reason: Schema.optionalKey<Schema.Union<readonly [Schema.Literals<readonly ["event-version", "graph-length", "merge-incomplete"]>, Schema.decodeTo<Schema.String, Schema.String, never, never>]>>;
|
|
@@ -304,7 +316,7 @@ export declare const GitErrorBody: Schema.Union<(Schema.Struct<{
|
|
|
304
316
|
readonly message: Schema.decodeTo<Schema.String, Schema.String, never, never>;
|
|
305
317
|
readonly hint: Schema.optionalKey<Schema.decodeTo<Schema.String, Schema.String, never, never>>;
|
|
306
318
|
readonly context: Schema.optionalKey<Schema.StructWithRest<Schema.Struct<{
|
|
307
|
-
reason: Schema.optionalKey<Schema.Union<readonly [Schema.Literals<readonly ["too-large", "rate-limited", "walk-limit", "diff-limit", "object-too-large", "delta-too-large", "response-too-large", "too-many-pointers", "fetch-plan-too-large", "too-many-store-calls", "call-budget", "events-undelivered", "events-waiting", "name-churn", "queue-full", "queue-targets-full", "too-many-gitmodules-and-gitattributes", "prune-walk-too-large", "job-step-calls", "job-step-yielded"]>, Schema.decodeTo<Schema.String, Schema.String, never, never>]>>;
|
|
319
|
+
reason: Schema.optionalKey<Schema.Union<readonly [Schema.Literals<readonly ["too-large", "rate-limited", "walk-limit", "diff-limit", "object-too-large", "repo-too-large", "delta-too-large", "response-too-large", "too-many-pointers", "fetch-plan-too-large", "too-many-store-calls", "call-budget", "events-undelivered", "events-waiting", "name-churn", "queue-full", "queue-targets-full", "too-many-gitmodules-and-gitattributes", "prune-walk-too-large", "job-step-calls", "job-step-yielded"]>, Schema.decodeTo<Schema.String, Schema.String, never, never>]>>;
|
|
308
320
|
indexBytes: Schema.optionalKey<Schema.Number>;
|
|
309
321
|
pushBytes: Schema.optionalKey<Schema.Number>;
|
|
310
322
|
most: Schema.optionalKey<Schema.Number>;
|
|
@@ -320,14 +332,15 @@ export declare const GitErrorBody: Schema.Union<(Schema.Struct<{
|
|
|
320
332
|
readonly hint: Schema.optionalKey<Schema.decodeTo<Schema.String, Schema.String, never, never>>;
|
|
321
333
|
readonly context: Schema.optionalKey<Schema.StructWithRest<Schema.Struct<{
|
|
322
334
|
id: Schema.optionalKey<Schema.decodeTo<Schema.String, Schema.String, never, never>>;
|
|
323
|
-
reason: Schema.optionalKey<Schema.Union<readonly [Schema.Literals<readonly ["busy", "packs-awaiting-repack", "awaiting-index", "may-have-saved", "too-many-writes"]>, Schema.decodeTo<Schema.String, Schema.String, never, never>]>>;
|
|
335
|
+
reason: Schema.optionalKey<Schema.Union<readonly [Schema.Literals<readonly ["busy", "packs-awaiting-repack", "awaiting-index", "may-have-saved", "too-many-writes", "starting"]>, Schema.decodeTo<Schema.String, Schema.String, never, never>]>>;
|
|
324
336
|
packs: Schema.optionalKey<Schema.Number>;
|
|
325
337
|
most: Schema.optionalKey<Schema.Number>;
|
|
338
|
+
retryAfter: Schema.optionalKey<Schema.Number>;
|
|
326
339
|
}>, readonly [Schema.$Record<Schema.String, Schema.Union<readonly [Schema.decodeTo<Schema.String, Schema.String, never, never>, Schema.Number, Schema.Boolean, Schema.$Array<Schema.decodeTo<Schema.String, Schema.String, never, never>>, Schema.Undefined]>>]>>;
|
|
327
340
|
}>)[]>;
|
|
328
341
|
export type GitErrorBody = typeof GitErrorBody.Type;
|
|
329
342
|
/** Every reason a refusal names, each once, by code: what `ref0-push-reasons` tells. */
|
|
330
|
-
declare const refusalReasonLists: readonly [Schema.Literals<readonly ["ofs-delta", "fsck", "provider-unknown", "body-ended", "link-wrong-type", "tag-target-missing", "object-missing", "boundary-not-in-pack", "too-many-short-ids", "too-many-parents"]>, Schema.Literals<readonly ["files-refused", "entry-unpublishable", "fetch-depth-unsupported"]>, Schema.Literals<readonly ["key-reused"]>, Schema.Literals<readonly ["no-queue", "no-sync", "no-topics", "ambiguous"]>, Schema.Literals<readonly ["cursor-expired", "diverged", "merge-conflict", "candidate-superseded", "candidate-cancelled", "entry-gone", "ref-conflict", "newer-format", "changed-while-checked", "unsupported-attribute", "unrelated-histories", "unsupported-virtual-base", "own-repo", "not-a-fork", "no-copy-rows", "shallow-root", "shallow-upload", "import-cancelled", "importing", "history-not-imported", "stage-gone", "remote-refused", "atomic-partner", "merges-off", "no-releases"]>, Schema.Literals<readonly ["too-large", "rate-limited", "walk-limit", "diff-limit", "object-too-large", "delta-too-large", "response-too-large", "too-many-pointers", "fetch-plan-too-large", "too-many-store-calls", "call-budget", "events-undelivered", "events-waiting", "name-churn", "queue-full", "queue-targets-full", "too-many-gitmodules-and-gitattributes", "prune-walk-too-large", "job-step-calls", "job-step-yielded"]>, Schema.Literals<readonly ["busy", "packs-awaiting-repack", "awaiting-index", "may-have-saved", "too-many-writes"]>, Schema.Literals<readonly ["event-version", "graph-length", "merge-incomplete"]>];
|
|
343
|
+
declare const refusalReasonLists: readonly [Schema.Literals<readonly ["ofs-delta", "fsck", "provider-unknown", "body-ended", "link-wrong-type", "tag-target-missing", "object-missing", "boundary-not-in-pack", "too-many-short-ids", "too-many-parents"]>, Schema.Literals<readonly ["files-refused", "entry-unpublishable", "fetch-depth-unsupported"]>, Schema.Literals<readonly ["key-reused"]>, Schema.Literals<readonly ["no-queue", "no-sync", "no-topics", "ambiguous"]>, Schema.Literals<readonly ["cursor-expired", "diverged", "merge-conflict", "candidate-superseded", "candidate-cancelled", "entry-gone", "ref-conflict", "newer-format", "changed-while-checked", "unsupported-attribute", "unrelated-histories", "unsupported-virtual-base", "own-repo", "not-a-fork", "no-copy-rows", "shallow-root", "shallow-upload", "import-cancelled", "importing", "history-not-imported", "stage-gone", "remote-refused", "atomic-partner", "merges-off", "no-releases"]>, Schema.Literals<readonly ["too-large", "rate-limited", "walk-limit", "diff-limit", "object-too-large", "repo-too-large", "delta-too-large", "response-too-large", "too-many-pointers", "fetch-plan-too-large", "too-many-store-calls", "call-budget", "events-undelivered", "events-waiting", "name-churn", "queue-full", "queue-targets-full", "too-many-gitmodules-and-gitattributes", "prune-walk-too-large", "job-step-calls", "job-step-yielded"]>, Schema.Literals<readonly ["busy", "packs-awaiting-repack", "awaiting-index", "may-have-saved", "too-many-writes", "starting"]>, Schema.Literals<readonly ["event-version", "graph-length", "merge-incomplete"]>];
|
|
331
344
|
/** A refusal's reason, of every code whose context names one. */
|
|
332
345
|
export type RefusalReason = (typeof refusalReasonLists)[number]['Type'];
|
|
333
346
|
export interface GitErrorFields {
|
|
@@ -414,14 +427,6 @@ export interface Accepted<Data = undefined> {
|
|
|
414
427
|
}
|
|
415
428
|
/** A host check's answer: `decisionAnswer` reads one a host's JavaScript gave. */
|
|
416
429
|
export type DecisionAnswer<Data = undefined> = Accepted<Data> | Rejected;
|
|
417
|
-
/** With no value, it fits any answer: a fetch rule's as well as a push rule's. */
|
|
418
|
-
export declare function accept(): Accepted<never>;
|
|
419
|
-
export declare function accept<Data>(value: Data): Accepted<Data>;
|
|
420
|
-
/**
|
|
421
|
-
* A host function's refusal of `input`, read field by field: a `GitError` given as `input` keeps
|
|
422
|
-
* `message` off its enumerable keys, so a spread of one would drop it.
|
|
423
|
-
*/
|
|
424
|
-
export declare const reject: ({ code, message, hint, context }: RejectInput) => Rejected;
|
|
425
430
|
/**
|
|
426
431
|
* The host functions Git runs, by the name its logs give each. When one throws, fails or runs past
|
|
427
432
|
* its timeout, its caller gets a fixed sentence and a failure ID, and the runtime's Logger gets a
|
|
@@ -179,6 +179,10 @@ const PreconditionContext = contextOf({
|
|
|
179
179
|
* add or hold may fit once one leaves. `queue-targets-full` is a write onto a new target once the
|
|
180
180
|
* repo's queues hold as many targets as they may, which no leave mends: queue onto one it holds.
|
|
181
181
|
*
|
|
182
|
+
* `repo-too-large` is a push that would take its repo's `ownBytes` past the server's
|
|
183
|
+
* `pushes.repo.refuseAbove`, which no default sets. Only a push that adds bytes is refused, so one
|
|
184
|
+
* that deletes or moves refs still lands.
|
|
185
|
+
*
|
|
182
186
|
* `prune-walk-too-large` is upkeep's prune pass, refused at one of the bounds its message names:
|
|
183
187
|
* - its walk's charge past the step's allotment, its seen set of a bit an object beside a fixed
|
|
184
188
|
* room for its packs' indexes, `pruneIndexFloor`'s 32 MiB: past about 141,500,000 objects at
|
|
@@ -213,6 +217,7 @@ const ResourceReason = /* @__PURE__ */ Schema.Literals([
|
|
|
213
217
|
"walk-limit",
|
|
214
218
|
"diff-limit",
|
|
215
219
|
"object-too-large",
|
|
220
|
+
"repo-too-large",
|
|
216
221
|
"delta-too-large",
|
|
217
222
|
"response-too-large",
|
|
218
223
|
"too-many-pointers",
|
|
@@ -267,20 +272,28 @@ const HostErrorContext = contextOf({ id: Schema.optionalKey(BodyText) });
|
|
|
267
272
|
* index is rebuilt for the server's patterns: the same call is served once the index is built.
|
|
268
273
|
* `may-have-saved`: the write may have landed, so read it back before sending it again.
|
|
269
274
|
* `too-many-writes`: other writes won every try, so no ref changed; sending the same request again
|
|
270
|
-
* is safe.
|
|
275
|
+
* is safe. `starting`: the server's build failed on weather, and a call once `retryAfter` seconds
|
|
276
|
+
* pass starts it again.
|
|
271
277
|
*/
|
|
272
278
|
const UnavailableReason = /* @__PURE__ */ Schema.Literals([
|
|
273
279
|
"busy",
|
|
274
280
|
"packs-awaiting-repack",
|
|
275
281
|
"awaiting-index",
|
|
276
282
|
"may-have-saved",
|
|
277
|
-
"too-many-writes"
|
|
278
|
-
|
|
283
|
+
"too-many-writes",
|
|
284
|
+
"starting"
|
|
285
|
+
]).annotate({ description: "`may-have-saved`: the write may have landed; read it back before you send it again. `too-many-writes`: other writes won every try, so no ref changed; sending the same request again is safe. `starting`: the server failed to start and starts again once `retryAfter` seconds pass." });
|
|
286
|
+
/**
|
|
287
|
+
* `UNAVAILABLE`'s context: `reason` says why, and `retryAfter`, the seconds to wait, comes with
|
|
288
|
+
* `starting`, as HTTP's `Retry-After` does. Both are additions: a caller that reads neither meets
|
|
289
|
+
* `UNAVAILABLE` and a 503, as it did when a failed build answered that way for good.
|
|
290
|
+
*/
|
|
279
291
|
const UnavailableContext = contextOf({
|
|
280
292
|
id: Schema.optionalKey(BodyText),
|
|
281
293
|
reason: reasonOf(UnavailableReason),
|
|
282
294
|
packs: Count,
|
|
283
|
-
most: Count
|
|
295
|
+
most: Count,
|
|
296
|
+
retryAfter: Count
|
|
284
297
|
});
|
|
285
298
|
/**
|
|
286
299
|
* A code's refusal as it crosses HTTP: its fields by name, so neither its tag nor what HTTP strips,
|
|
@@ -574,6 +574,17 @@ declare const FetchRuleOf: Schema.Struct<{
|
|
|
574
574
|
type FetchRuleOf = typeof FetchRuleOf.Type;
|
|
575
575
|
/** A clone or fetch over Git's protocol, with its HTTP request and what its client asked. */
|
|
576
576
|
export declare const FetchGitRuleInput: Schema.Struct<{
|
|
577
|
+
readonly actor: Schema.Union<readonly [Schema.Struct<{
|
|
578
|
+
readonly id: Schema.String;
|
|
579
|
+
readonly anonymous: Schema.optionalKey<Schema.Literal<false>>;
|
|
580
|
+
readonly meta: Schema.optionalKey<Schema.Unknown>;
|
|
581
|
+
}>, Schema.Struct<{
|
|
582
|
+
readonly anonymous: Schema.Literal<true>;
|
|
583
|
+
readonly meta: Schema.optionalKey<Schema.Unknown>;
|
|
584
|
+
}>]>;
|
|
585
|
+
readonly repo: Schema.String;
|
|
586
|
+
readonly kind: Schema.Literal<"git">;
|
|
587
|
+
readonly request: Schema.declare<Request, Request>;
|
|
577
588
|
readonly wants: Schema.mutable<Schema.$Array<Schema.String>>;
|
|
578
589
|
readonly haves: Schema.mutable<Schema.$Array<Schema.String>>;
|
|
579
590
|
readonly shallows: Schema.mutable<Schema.$Array<Schema.String>>;
|
|
@@ -590,17 +601,6 @@ export declare const FetchGitRuleInput: Schema.Struct<{
|
|
|
590
601
|
}>]>>;
|
|
591
602
|
readonly includeTag: Schema.Boolean;
|
|
592
603
|
readonly thinPack: Schema.optionalKey<Schema.Literal<true>>;
|
|
593
|
-
readonly actor: Schema.Union<readonly [Schema.Struct<{
|
|
594
|
-
readonly id: Schema.String;
|
|
595
|
-
readonly anonymous: Schema.optionalKey<Schema.Literal<false>>;
|
|
596
|
-
readonly meta: Schema.optionalKey<Schema.Unknown>;
|
|
597
|
-
}>, Schema.Struct<{
|
|
598
|
-
readonly anonymous: Schema.Literal<true>;
|
|
599
|
-
readonly meta: Schema.optionalKey<Schema.Unknown>;
|
|
600
|
-
}>]>;
|
|
601
|
-
readonly repo: Schema.String;
|
|
602
|
-
readonly kind: Schema.Literal<"git">;
|
|
603
|
-
readonly request: Schema.declare<Request, Request>;
|
|
604
604
|
}>;
|
|
605
605
|
export type FetchGitRuleInput = typeof FetchGitRuleInput.Type;
|
|
606
606
|
/**
|
|
@@ -673,6 +673,17 @@ export declare const FetchReadRuleInput: Schema.Union<readonly [Schema.Struct<{
|
|
|
673
673
|
*/
|
|
674
674
|
export type FetchRuleInput = FetchGitRuleInput | FetchReadRuleInput;
|
|
675
675
|
export declare const FetchRuleInput: Schema.Union<readonly [Schema.Struct<{
|
|
676
|
+
readonly actor: Schema.Union<readonly [Schema.Struct<{
|
|
677
|
+
readonly id: Schema.String;
|
|
678
|
+
readonly anonymous: Schema.optionalKey<Schema.Literal<false>>;
|
|
679
|
+
readonly meta: Schema.optionalKey<Schema.Unknown>;
|
|
680
|
+
}>, Schema.Struct<{
|
|
681
|
+
readonly anonymous: Schema.Literal<true>;
|
|
682
|
+
readonly meta: Schema.optionalKey<Schema.Unknown>;
|
|
683
|
+
}>]>;
|
|
684
|
+
readonly repo: Schema.String;
|
|
685
|
+
readonly kind: Schema.Literal<"git">;
|
|
686
|
+
readonly request: Schema.declare<Request, Request>;
|
|
676
687
|
readonly wants: Schema.mutable<Schema.$Array<Schema.String>>;
|
|
677
688
|
readonly haves: Schema.mutable<Schema.$Array<Schema.String>>;
|
|
678
689
|
readonly shallows: Schema.mutable<Schema.$Array<Schema.String>>;
|
|
@@ -689,17 +700,6 @@ export declare const FetchRuleInput: Schema.Union<readonly [Schema.Struct<{
|
|
|
689
700
|
}>]>>;
|
|
690
701
|
readonly includeTag: Schema.Boolean;
|
|
691
702
|
readonly thinPack: Schema.optionalKey<Schema.Literal<true>>;
|
|
692
|
-
readonly actor: Schema.Union<readonly [Schema.Struct<{
|
|
693
|
-
readonly id: Schema.String;
|
|
694
|
-
readonly anonymous: Schema.optionalKey<Schema.Literal<false>>;
|
|
695
|
-
readonly meta: Schema.optionalKey<Schema.Unknown>;
|
|
696
|
-
}>, Schema.Struct<{
|
|
697
|
-
readonly anonymous: Schema.Literal<true>;
|
|
698
|
-
readonly meta: Schema.optionalKey<Schema.Unknown>;
|
|
699
|
-
}>]>;
|
|
700
|
-
readonly repo: Schema.String;
|
|
701
|
-
readonly kind: Schema.Literal<"git">;
|
|
702
|
-
readonly request: Schema.declare<Request, Request>;
|
|
703
703
|
}>, Schema.Union<readonly [Schema.Struct<{
|
|
704
704
|
readonly actor: Schema.Union<readonly [Schema.Struct<{
|
|
705
705
|
readonly id: Schema.String;
|
|
@@ -1,30 +1,27 @@
|
|
|
1
1
|
import { Duration } from "./promises.mjs";
|
|
2
|
-
import { AccessOption } from "./access.mjs";
|
|
3
2
|
import { Authorize } from "./authorize.mjs";
|
|
4
|
-
import { Caller
|
|
3
|
+
import { Caller } from "./actors.mjs";
|
|
5
4
|
import { BlobCalls, Blobs } from "./blobs.mjs";
|
|
6
5
|
import { CommitCalls, Commits } from "./commits.mjs";
|
|
7
6
|
import { Events } from "./events.mjs";
|
|
8
7
|
import { FileCalls, Files } from "./files.mjs";
|
|
9
8
|
import { ForkCalls, Forks } from "./forks.mjs";
|
|
10
|
-
import { LfsCalls
|
|
9
|
+
import { LfsCalls } from "./lfs.mjs";
|
|
11
10
|
import { MergeCalls } from "./merges.mjs";
|
|
12
|
-
import { EffectiveLimits
|
|
13
|
-
import { MergeQueueCalls, MergeQueueLayerOptions } from "./queue.mjs";
|
|
11
|
+
import { EffectiveLimits } from "./objects.mjs";
|
|
14
12
|
import { PushOptions } from "./push-uploads.mjs";
|
|
13
|
+
import { MergeQueueCalls } from "./queue.mjs";
|
|
15
14
|
import { RefCalls, Refs } from "./refs.mjs";
|
|
16
15
|
import { RepoCalls, Repos } from "./repos.mjs";
|
|
17
16
|
import { RepoRecords } from "./repo-records.mjs";
|
|
18
17
|
import { TagCalls, Tags } from "./tags.mjs";
|
|
19
18
|
import { TreeCalls, Trees } from "./trees.mjs";
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import { TokenCalls, TokensFeature } from "./tokens.mjs";
|
|
19
|
+
import { Result } from "./result.mjs";
|
|
20
|
+
import { Rules } from "./rules.mjs";
|
|
21
|
+
import { TokenCalls } from "./tokens.mjs";
|
|
24
22
|
import { Work, WorkCalls } from "./work.mjs";
|
|
25
|
-
import { TopicCalls
|
|
26
|
-
import
|
|
27
|
-
import { Bucket, CallLimits, JobQueue, Records } from "@ref0/infra";
|
|
23
|
+
import { TopicCalls } from "./topics.mjs";
|
|
24
|
+
import { CallLimits, JobQueue, Records } from "@ref0/infra";
|
|
28
25
|
import * as Layer from "effect/Layer";
|
|
29
26
|
import * as ManagedRuntime from "effect/ManagedRuntime";
|
|
30
27
|
/** The call modules' services, which a server's runtime holds, each deciding for its `by`. */
|
|
@@ -42,45 +39,12 @@ export type GitNeeds = Records.Records | JobQueue.JobQueue | CallLimits.CallLimi
|
|
|
42
39
|
export type GitAdapter = Layer.Layer<never, Error> | readonly Layer.Layer<never, Error>[];
|
|
43
40
|
/** What `adapter` gives. */
|
|
44
41
|
export type ProvidedBy<A extends GitAdapter> = A extends readonly (infer L extends Layer.Any)[] ? Layer.Success<L> : A extends Layer.Any ? Layer.Success<A> : never;
|
|
45
|
-
/**
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
* merge queue, comparisons' line counts and diffs' patches. Left out, those refuse with
|
|
52
|
-
* `FAILED_PRECONDITION`, `merges-off`, a comparison counts no lines, and `queue` is refused at
|
|
53
|
-
* start. A module that won't load fails the server's build. A Worker imports
|
|
54
|
-
* `@ref0/xdiff-wasm/xdiff.wasm`, and a host on Node passes `await xdiff()` from `@ref0/xdiff-wasm/node`.
|
|
55
|
-
*/
|
|
56
|
-
readonly xdiff?: WebAssembly.Module;
|
|
57
|
-
readonly tokens?: TokensFeature;
|
|
58
|
-
/**
|
|
59
|
-
* `MergeQueue.layer`'s options, one queue every repo has, as `mergeQueue(…)` checks it, or a
|
|
60
|
-
* function of the repo: `git.queue`,
|
|
61
|
-
* its jobs and its events, and `-o queue`. A bridge, as `xdiff` is: the server wires the queue
|
|
62
|
-
* over them itself, as `MergeQueue.layer` does under `Git.layer`, and it goes with
|
|
63
|
-
* `createGitServer`.
|
|
64
|
-
*/
|
|
65
|
-
readonly queue?: MergeQueueLayerOptions;
|
|
66
|
-
/**
|
|
67
|
-
* `lfs()`: `Lfs.layer()`, Git LFS's API under `info/lfs`, its upkeep, purge and pointer check,
|
|
68
|
-
* with its objects in the adapter's bucket. Without it, a server with a bucket has no LFS.
|
|
69
|
-
*/
|
|
70
|
-
readonly lfs?: LfsFeature;
|
|
71
|
-
/** `topics()`: `git.topics`, their jobs and their events, across the repos a `queue` has. */
|
|
72
|
-
readonly topics?: TopicsFactory;
|
|
73
|
-
/** Serves GitHub's device flow and the web flow at `/login/...`; needs `tokens`. */
|
|
74
|
-
readonly signIn?: SignInLayerOptions;
|
|
75
|
-
readonly auth?: GitAuth;
|
|
76
|
-
readonly authorize?: GitAuthorize;
|
|
77
|
-
/**
|
|
78
|
-
* The host's push and fetch rules, each a rule or an Effect that builds one, as `Rules.layer`
|
|
79
|
-
* takes them: they run in this order, before any a package built on Git adds. An Effect that
|
|
80
|
-
* fails fails the server's build. The adapter must not provide `Rules`: pass them here instead.
|
|
81
|
-
* Until 2a's `Git.layer`, and gone in 2c.
|
|
82
|
-
*/
|
|
83
|
-
readonly rules?: readonly (PushRule | FetchRule | Effect.Effect<PushRule | FetchRule, GitError>)[];
|
|
42
|
+
/**
|
|
43
|
+
* `Git.layer`'s options: settings only (Q834, Q1006), with a platform's `maxDuration` (Q1190), and
|
|
44
|
+
* the sizes a pushed file and its repo are held to, `pushes.files` and `pushes.repo` (#2395). Push
|
|
45
|
+
* uploads are `Git.layerUploads`'.
|
|
46
|
+
*/
|
|
47
|
+
export interface GitOptions {
|
|
84
48
|
readonly basePath?: string;
|
|
85
49
|
/**
|
|
86
50
|
* The most one fetch may send and how long it may stream: Git's HTTP limits each fetch by them,
|
|
@@ -91,35 +55,18 @@ export interface GitServerOptions<A extends GitAdapter = GitAdapter> {
|
|
|
91
55
|
* doesn't bound. A host may lower it as far as `pruneFloor`, an hour, never below.
|
|
92
56
|
*/
|
|
93
57
|
readonly fetchLimits?: EffectiveLimits;
|
|
94
|
-
/** A large push's pack straight to the bucket: off unless set, and a bucket that signs parts. */
|
|
95
|
-
readonly pushes?: PushOptions;
|
|
96
58
|
/**
|
|
97
59
|
* The route's own limit, such as `'60 seconds'`, counted from each request's start. A pack that
|
|
98
60
|
* would run past it ends 5 seconds before, or a tenth of a shorter limit, on side-band 3, naming
|
|
99
61
|
* the limit and `git clone --depth 1`. With none, a pack runs to its end.
|
|
100
62
|
*/
|
|
101
63
|
readonly maxDuration?: Duration;
|
|
64
|
+
/**
|
|
65
|
+
* The sizes a pushed file and its repo are held to, as `PushFileOptions` and `PushRepoOptions`
|
|
66
|
+
* say.
|
|
67
|
+
*/
|
|
68
|
+
readonly pushes?: Pick<PushOptions, 'files' | 'repo'>;
|
|
102
69
|
}
|
|
103
|
-
/**
|
|
104
|
-
* `access`, private branches from `PrivateRefs.layer`, only over objects that keep the
|
|
105
|
-
* reachability index, `packs()`: a caller's view of a repo's objects is read from it.
|
|
106
|
-
*/
|
|
107
|
-
type AccessSetup = {
|
|
108
|
-
readonly access?: undefined;
|
|
109
|
-
} | {
|
|
110
|
-
readonly access: AccessOption;
|
|
111
|
-
readonly objects: IndexedObjectsFactory;
|
|
112
|
-
};
|
|
113
|
-
/**
|
|
114
|
-
* `packs()` and `lfs()` need a `Bucket`; `loose()` doesn't. Only `packs()` takes `access`. An adapter that
|
|
115
|
-
* gives no `Records`, `JobQueue` or `CallLimits` is refused.
|
|
116
|
-
*/
|
|
117
|
-
export type ServerSetup<A extends GitAdapter = GitAdapter> = GitServerOptions<A> & ([GitNeeds] extends [ProvidedBy<A>] ? [Bucket.Bucket] extends [ProvidedBy<A>] ? unknown : {
|
|
118
|
-
readonly objects: ObjectsFactory<false>;
|
|
119
|
-
readonly lfs?: never;
|
|
120
|
-
} : {
|
|
121
|
-
readonly adapter: never;
|
|
122
|
-
}) & AccessSetup;
|
|
123
70
|
/** Each piece adds its own groups: C's, RD's objects, Q's `queue` and TP's `topics`. */
|
|
124
71
|
export interface ServerCalls {
|
|
125
72
|
readonly repos: RepoCalls;
|
|
@@ -146,8 +93,13 @@ export interface GitServer<R = never> extends ServerCalls {
|
|
|
146
93
|
readonly identify: (request: Request) => Promise<Result<Caller>>;
|
|
147
94
|
/**
|
|
148
95
|
* The isolate's runtime, over the adapter's Layers and Git's own wiring, which registers Git's
|
|
149
|
-
* jobs on the adapter's queue: built
|
|
150
|
-
*
|
|
96
|
+
* jobs on the adapter's queue: built starting as the tick that made the server ends, so a joined
|
|
97
|
+
* Layer joins in that tick, and a module that only runs jobs has them. A build that fails on
|
|
98
|
+
* weather in the adapter's Layers, before Git's wiring, is built again on a new runtime by the
|
|
99
|
+
* first call once its wait has passed: 1 s, doubling to 30 s, each call before it answering
|
|
100
|
+
* `UNAVAILABLE`, reason `starting`, and `fetch` a 503 with `Retry-After`. Any other failed build
|
|
101
|
+
* stays failed: every call answers `UNAVAILABLE`, and `fetch` a 503. Read it again after a
|
|
102
|
+
* failed build, since the next is another. It
|
|
151
103
|
* holds `RepoRecords`, `Authorize`, `Refs`, `Rules`, `Events` and the call modules' services beside
|
|
152
104
|
* `R`, the adapter's services, and `Tokens` with `tokens`, for an Effect host to read. Named here, so a host's inferred server type names only
|
|
153
105
|
* its adapter's services. The bridge until SV's step 2c.
|
|
@@ -155,5 +107,4 @@ export interface GitServer<R = never> extends ServerCalls {
|
|
|
155
107
|
readonly runtime: ManagedRuntime.ManagedRuntime<R | RepoRecords | Authorize | Refs | Rules | Events | CallServices, Error>;
|
|
156
108
|
/** Disposes `runtime`. */
|
|
157
109
|
readonly close: () => Promise<void>;
|
|
158
|
-
}
|
|
159
|
-
export {};
|
|
110
|
+
}
|
|
@@ -18,7 +18,7 @@ export declare const OAuthClient: Schema.Struct<{
|
|
|
18
18
|
export type OAuthClient = typeof OAuthClient.Type;
|
|
19
19
|
/**
|
|
20
20
|
* Turns on sign-in: GitHub's device flow, which also accepts `gh`'s client ID, and the web flow for
|
|
21
|
-
* `clients`, both approved on the host's `approvalPage`. Needs `
|
|
21
|
+
* `clients`, both approved on the host's `approvalPage`. Needs `Tokens.layer()`, which mints the token.
|
|
22
22
|
*/
|
|
23
23
|
export interface SignInLayerOptions {
|
|
24
24
|
readonly clients?: readonly OAuthClient[];
|