@ref0/git 0.14.0 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth/access-jwt.mjs +2 -2
- package/dist/auth/authorize.mjs +3 -3
- package/dist/auth/fences.d.mts +1 -2
- package/dist/auth/fences.mjs +3 -3
- package/dist/auth/grants.mjs +4 -4
- package/dist/auth/host-function.mjs +18 -1
- package/dist/auth/identify.d.mts +1 -1
- package/dist/auth/identify.mjs +3 -3
- package/dist/auth/token-cleanup.mjs +67 -0
- package/dist/auth/token-rows.mjs +1 -1
- package/dist/auth/token-text.mjs +9 -1
- package/dist/auth/tokens-base.d.mts +35 -0
- package/dist/auth/tokens-base.mjs +13 -0
- package/dist/auth/tokens-layer.d.mts +2 -27
- package/dist/auth/tokens-layer.mjs +6 -11
- package/dist/auth/tokens-public.d.mts +3 -3
- package/dist/auth/tokens.d.mts +7 -10
- package/dist/auth/tokens.mjs +9 -80
- package/dist/client/answer.mjs +21 -42
- package/dist/client/client.d.mts +2 -4
- package/dist/client/git-http.mjs +17 -7
- package/dist/client/local.mjs +14 -13
- package/dist/client/push-upload.mjs +9 -8
- package/dist/client/remote.mjs +8 -10
- package/dist/client/run-remote-helper.d.mts +1 -0
- package/dist/client/run-remote-helper.mjs +58 -24
- package/dist/client/slice-push.d.mts +1 -1
- package/dist/client/transport.mjs +105 -46
- package/dist/contracts/blobs.d.mts +55 -8
- package/dist/contracts/blobs.mjs +16 -2
- package/dist/contracts/call-allowance.d.mts +13 -0
- package/dist/contracts/call-allowance.mjs +44 -0
- package/dist/contracts/calls-spent.mjs +8 -3
- package/dist/contracts/client.d.mts +15 -16
- package/dist/contracts/commits.d.mts +24 -24
- package/dist/contracts/engine.d.mts +6 -1
- package/dist/contracts/engine.mjs +10 -1
- package/dist/contracts/files.d.mts +10 -10
- package/dist/contracts/forks.d.mts +17 -17
- package/dist/contracts/git-events.d.mts +29 -1
- package/dist/contracts/git-hooks.d.mts +1 -1
- package/dist/contracts/git.d.mts +21 -0
- package/dist/contracts/grants.d.mts +24 -4
- package/dist/contracts/handlers.d.mts +1 -1
- package/dist/contracts/lfs.d.mts +28 -2
- package/dist/contracts/merges.d.mts +3 -2
- package/dist/contracts/objects.d.mts +23 -25
- package/dist/contracts/queue.d.mts +40 -12
- package/dist/contracts/queue.mjs +3 -4
- package/dist/contracts/refs.d.mts +26 -23
- package/dist/contracts/remote.d.mts +6 -7
- package/dist/contracts/remote.mjs +4 -1
- package/dist/contracts/repos.d.mts +29 -138
- package/dist/contracts/repos.mjs +5 -3
- package/dist/contracts/result.d.mts +35 -16
- package/dist/contracts/result.mjs +35 -7
- package/dist/contracts/server.d.mts +25 -50
- package/dist/contracts/services.d.mts +1 -1
- package/dist/contracts/store.d.mts +6 -5
- package/dist/contracts/sync.d.mts +11 -7
- package/dist/contracts/sync.mjs +12 -2
- package/dist/contracts/tags.d.mts +10 -10
- package/dist/contracts/time.d.mts +3 -0
- package/dist/contracts/{promises.mjs → time.mjs} +1 -1
- package/dist/contracts/tokens.d.mts +15 -17
- package/dist/contracts/tokens.mjs +3 -2
- package/dist/contracts/topics.d.mts +1 -1
- package/dist/contracts/trees.d.mts +12 -12
- package/dist/contracts/work.d.mts +24 -13
- package/dist/core/access.d.mts +1 -2
- package/dist/core/access.mjs +20 -9
- package/dist/core/ancestry.d.mts +1 -0
- package/dist/core/asked.mjs +1 -1
- package/dist/core/call-names.mjs +6 -1
- package/dist/core/call-services.mjs +11 -3
- package/dist/core/events/deliver.d.mts +1 -2
- package/dist/core/events/deliver.mjs +43 -36
- package/dist/core/events/retired.mjs +119 -0
- package/dist/core/forks.mjs +928 -432
- package/dist/core/hooks/groups.mjs +1 -1
- package/dist/core/imports.mjs +29 -23
- package/dist/core/index-job.mjs +122 -34
- package/dist/core/index-lost.d.mts +1 -2
- package/dist/core/index-lost.mjs +2 -2
- package/dist/core/loose-tally.mjs +1 -1
- package/dist/core/objects/blobs.mjs +129 -3
- package/dist/core/objects/lines.mjs +2 -2
- package/dist/core/objects/merges.mjs +4 -1
- package/dist/core/objects/objects-layer.d.mts +1 -1
- package/dist/core/objects/objects-layer.mjs +3 -3
- package/dist/core/objects/reading.mjs +24 -13
- package/dist/core/objects/tags.mjs +4 -1
- package/dist/core/objects/trees.mjs +2 -2
- package/dist/core/objects/writing.mjs +2 -2
- package/dist/core/own-writes.mjs +1 -1
- package/dist/core/parts.d.mts +4 -5
- package/dist/core/parts.mjs +3 -8
- package/dist/core/promise.mjs +9 -12
- package/dist/core/purge.mjs +287 -83
- package/dist/core/push-decide.mjs +2 -0
- package/dist/core/push-files.d.mts +1 -1
- package/dist/core/push.mjs +58 -47
- package/dist/core/receipts.mjs +8 -3
- package/dist/core/ref-index-job.mjs +4 -4
- package/dist/core/ref-view.mjs +2 -2
- package/dist/core/refs.mjs +5 -5
- package/dist/core/registered-rows.mjs +2 -2
- package/dist/core/repack.mjs +36 -21
- package/dist/core/repo-info.mjs +3 -3
- package/dist/core/repos.mjs +21 -9
- package/dist/core/rules/commit-changes.d.mts +0 -1
- package/dist/core/saved-caller-views.d.mts +7 -2
- package/dist/core/saved-caller-views.mjs +2 -2
- package/dist/core/saved-callers.d.mts +19 -2
- package/dist/core/seam.d.mts +16 -26
- package/dist/core/seam.mjs +7 -28
- package/dist/core/tokens.mjs +1 -1
- package/dist/core/view.mjs +7 -15
- package/dist/core/work.mjs +59 -14
- package/dist/effect.d.mts +3 -12
- package/dist/effect.mjs +1 -10
- package/dist/engine/failures.mjs +2 -1
- package/dist/engine/reads.mjs +4 -4
- package/dist/event-streams/stream.d.mts +2 -2
- package/dist/event-streams/stream.mjs +37 -14
- package/dist/extend.d.mts +2 -3
- package/dist/extend.mjs +2 -1
- package/dist/http/answers.mjs +8 -5
- package/dist/http/core-parts.mjs +95 -79
- package/dist/http/handler.mjs +34 -7
- package/dist/http/node.d.mts +14 -1
- package/dist/http/node.mjs +56 -27
- package/dist/http/parts.d.mts +1 -0
- package/dist/http/push-upload-job.mjs +30 -26
- package/dist/http/push-uploads.mjs +36 -21
- package/dist/http/upload-pack.mjs +3 -3
- package/dist/index.d.mts +14 -14
- package/dist/index.mjs +2 -2
- package/dist/lfs/answer.mjs +37 -0
- package/dist/lfs/base.d.mts +2 -0
- package/dist/lfs/base.mjs +25 -1
- package/dist/lfs/copy.d.mts +21 -7
- package/dist/lfs/copy.mjs +89 -6
- package/dist/lfs/layer.d.mts +15 -1
- package/dist/lfs/layer.mjs +24 -11
- package/dist/lfs/locks.mjs +2 -2
- package/dist/lfs/objects.d.mts +1 -0
- package/dist/lfs/objects.mjs +87 -17
- package/dist/lfs/pointers.mjs +2 -2
- package/dist/lfs/rows.mjs +42 -8
- package/dist/lfs/upkeep.mjs +48 -14
- package/dist/lfs/wire.mjs +6 -31
- package/dist/merges/merges.mjs +2 -2
- package/dist/node.d.mts +2 -2
- package/dist/protocol/bytes/buffers.mjs +13 -5
- package/dist/protocol/bytes/reader.mjs +6 -1
- package/dist/protocol/bytes/streams.mjs +27 -1
- package/dist/protocol/diff/read.d.mts +4 -3
- package/dist/protocol/diff/read.mjs +8 -3
- package/dist/protocol/objects/lfs-pointer.d.mts +14 -2
- package/dist/protocol/objects/lfs-pointer.mjs +1 -3
- package/dist/protocol/objects/links-raw.mjs +24 -10
- package/dist/protocol/objects/tag.d.mts +1 -1
- package/dist/protocol/objects/tree.mjs +23 -6
- package/dist/protocol/packs/delta.d.mts +6 -3
- package/dist/protocol/packs/delta.mjs +96 -32
- package/dist/protocol/packs/idx.d.mts +2 -1
- package/dist/protocol/packs/idx.mjs +22 -3
- package/dist/protocol/packs/parts.d.mts +4 -1
- package/dist/protocol/packs/parts.mjs +10 -7
- package/dist/protocol/packs/reader.d.mts +5 -0
- package/dist/protocol/packs/reader.mjs +3 -2
- package/dist/protocol/packs/writer.mjs +26 -8
- package/dist/queue/advance.mjs +21 -24
- package/dist/queue/base.d.mts +55 -0
- package/dist/queue/base.mjs +44 -0
- package/dist/queue/calls.mjs +51 -54
- package/dist/queue/commit.mjs +1 -1
- package/dist/queue/host.d.mts +1 -15
- package/dist/queue/host.mjs +2 -7
- package/dist/queue/layer.d.mts +2 -1
- package/dist/queue/layer.mjs +10 -3
- package/dist/queue/limits.mjs +2 -0
- package/dist/queue/push-option.mjs +9 -24
- package/dist/queue/schedule.mjs +1 -1
- package/dist/queue/state.mjs +2 -10
- package/dist/queue/trim.mjs +5 -3
- package/dist/rest/blobs.mjs +29 -5
- package/dist/rest/caller.d.mts +4 -4271
- package/dist/rest/caller.mjs +4 -0
- package/dist/rest/client.d.mts +8 -5
- package/dist/rest/client.mjs +19 -2
- package/dist/rest/handlers.mjs +50 -5
- package/dist/rest/layer.d.mts +2 -2
- package/dist/rest/layer.mjs +5 -12
- package/dist/rest/me.d.mts +3 -432
- package/dist/server/check-fetch.mjs +3 -3
- package/dist/server/edge-node.d.mts +11 -8
- package/dist/server/edge-node.mjs +9 -6
- package/dist/server/edge.d.mts +21 -7
- package/dist/server/edge.mjs +32 -11
- package/dist/server/extension.mjs +1 -1
- package/dist/server/git-layer.d.mts +5 -5
- package/dist/server/git-layer.mjs +28 -22
- package/dist/server/git-namespace.d.mts +4 -3
- package/dist/server/git-namespace.mjs +3 -2
- package/dist/server/joined.d.mts +6 -18
- package/dist/server/joined.mjs +9 -36
- package/dist/server/lifecycle.mjs +18 -106
- package/dist/server/registry.mjs +24 -7
- package/dist/server/server.mjs +205 -346
- package/dist/signin/context.d.mts +1 -2
- package/dist/signin/layer.d.mts +1 -1
- package/dist/signin/layer.mjs +1 -1
- package/dist/storage/allotted.mjs +18 -3
- package/dist/storage/batch-upkeep.mjs +274 -0
- package/dist/storage/batches.d.mts +8 -0
- package/dist/storage/batches.mjs +344 -0
- package/dist/storage/calls.d.mts +1 -2
- package/dist/storage/calls.mjs +144 -158
- package/dist/storage/chunks.d.mts +9 -0
- package/dist/storage/chunks.mjs +297 -0
- package/dist/storage/clean-up.mjs +72 -9
- package/dist/storage/counted-bucket.mjs +4 -4
- package/dist/storage/fetch.d.mts +1 -0
- package/dist/storage/fetch.mjs +287 -210
- package/dist/storage/host-bucket.mjs +1 -2
- package/dist/storage/id-mix.mjs +19 -5
- package/dist/storage/index-bitmaps.mjs +9 -2
- package/dist/storage/index-build.d.mts +0 -1
- package/dist/storage/index-build.mjs +80 -23
- package/dist/storage/index-fetch.mjs +113 -72
- package/dist/storage/index-files.d.mts +3 -0
- package/dist/storage/index-files.mjs +10 -5
- package/dist/storage/index-graph.mjs +72 -22
- package/dist/storage/index-remap.mjs +200 -64
- package/dist/storage/index-whole.mjs +127 -0
- package/dist/storage/largest-files.mjs +1 -1
- package/dist/storage/layout.mjs +23 -0
- package/dist/storage/loose.d.mts +7 -4
- package/dist/storage/loose.mjs +212 -67
- package/dist/storage/memory-budget.mjs +16 -4
- package/dist/storage/merge-plan.mjs +3 -2
- package/dist/storage/merge-row.mjs +7 -1
- package/dist/storage/merge-stream.mjs +164 -25
- package/dist/storage/merge-walk.mjs +8 -4
- package/dist/storage/merge-write.mjs +1 -1
- package/dist/storage/merge.d.mts +1 -1
- package/dist/storage/merge.mjs +1 -1
- package/dist/storage/object-rows.d.mts +1 -0
- package/dist/storage/object-rows.mjs +385 -65
- package/dist/storage/oid-table.mjs +171 -0
- package/dist/storage/pack-order.mjs +8 -4
- package/dist/storage/pack-ranges.d.mts +1 -2
- package/dist/storage/pack-ranges.mjs +4 -5
- package/dist/storage/pack-reads.d.mts +2 -1
- package/dist/storage/pack-reads.mjs +158 -42
- package/dist/storage/pack-receive.d.mts +1 -1
- package/dist/storage/pack-receive.mjs +2 -2
- package/dist/storage/packs.d.mts +1 -1
- package/dist/storage/packs.mjs +136 -66
- package/dist/storage/placed-reads.mjs +1 -1
- package/dist/storage/plan-columns.d.mts +4 -0
- package/dist/storage/plan-columns.mjs +238 -0
- package/dist/storage/prune-keep.mjs +134 -41
- package/dist/storage/prune-walk.mjs +202 -62
- package/dist/storage/prune.mjs +194 -91
- package/dist/storage/push-allotment.mjs +91 -12
- package/dist/storage/push-uploads.mjs +4 -4
- package/dist/storage/pushed-commits.mjs +4 -2
- package/dist/storage/quarantine.d.mts +1 -1
- package/dist/storage/range-cache.mjs +125 -8
- package/dist/storage/ready.d.mts +1 -1
- package/dist/storage/ready.mjs +8 -6
- package/dist/storage/receive-bounds.mjs +23 -8
- package/dist/storage/repack-backlog.mjs +6 -3
- package/dist/storage/repack.d.mts +1 -1
- package/dist/storage/rows.d.mts +1 -1
- package/dist/storage/rows.mjs +1 -1
- package/dist/storage/runs.mjs +195 -43
- package/dist/storage/send-list.d.mts +1 -0
- package/dist/storage/send-list.mjs +54 -10
- package/dist/storage/single-flight.mjs +13 -7
- package/dist/storage/stream-whole.mjs +127 -26
- package/dist/storage/unpack.mjs +371 -79
- package/dist/storage/visible.mjs +2 -2
- package/dist/storage/walk.mjs +192 -38
- package/dist/storage/wants.mjs +5 -5
- package/dist/store/bodies.mjs +38 -0
- package/dist/store/call-count.d.mts +8 -12
- package/dist/store/call-count.mjs +34 -46
- package/dist/store/catalogue.d.mts +2 -2
- package/dist/store/catalogue.mjs +145 -35
- package/dist/store/crossing.mjs +1 -3
- package/dist/store/cursor-seal.d.mts +1 -2
- package/dist/store/cursor-seal.mjs +16 -6
- package/dist/store/door.mjs +183 -0
- package/dist/store/errors.d.mts +3 -4
- package/dist/store/errors.mjs +15 -33
- package/dist/store/git-store.mjs +25 -7
- package/dist/store/job-try.mjs +9 -32
- package/dist/store/list-job.mjs +44 -8
- package/dist/store/records.d.mts +3 -0
- package/dist/store/records.mjs +3 -0
- package/dist/store/repo-record.d.mts +1 -2
- package/dist/store/repo-record.mjs +32 -20
- package/dist/store/reservations.mjs +1 -1
- package/dist/store/scopes.mjs +11 -0
- package/dist/store/settle.mjs +4 -4
- package/dist/sync/github.mjs +3 -3
- package/dist/sync/import.mjs +31 -18
- package/dist/sync/lfs-batch.mjs +4 -5
- package/dist/sync/lfs-copy.mjs +17 -6
- package/dist/sync/mirror.mjs +34 -31
- package/dist/sync/said.mjs +16 -37
- package/dist/sync/step.mjs +33 -25
- package/dist/sync/tries.mjs +9 -9
- package/dist/topics/advance.mjs +10 -11
- package/dist/topics/base.d.mts +15 -0
- package/dist/topics/base.mjs +8 -0
- package/dist/topics/host.mjs +1 -1
- package/dist/topics/layer.d.mts +4 -9
- package/dist/topics/layer.mjs +2 -3
- package/dist/topics/members.mjs +4 -4
- package/dist/topics/public.d.mts +2 -1
- package/dist/topics/topic.mjs +2 -2
- package/package.json +5 -4
- package/dist/contracts/promises.d.mts +0 -39
- package/dist/core/call-names.d.mts +0 -3
- package/dist/core/clock.mjs +0 -18
- package/dist/lfs/calls.mjs +0 -26
- package/dist/rest/api.d.mts +0 -23
- package/dist/rest/blobs.d.mts +0 -833
- package/dist/rest/commits.d.mts +0 -3543
- package/dist/rest/errors.d.mts +0 -2124
- package/dist/rest/events.d.mts +0 -426
- package/dist/rest/files.d.mts +0 -1342
- package/dist/rest/forks.d.mts +0 -2160
- package/dist/rest/handlers.d.mts +0 -8
- package/dist/rest/merges.d.mts +0 -477
- package/dist/rest/queue.d.mts +0 -5917
- package/dist/rest/refs.d.mts +0 -2988
- package/dist/rest/repos.d.mts +0 -2567
- package/dist/rest/tags.d.mts +0 -1316
- package/dist/rest/tokens.d.mts +0 -2614
- package/dist/rest/topics.d.mts +0 -2224
- package/dist/rest/trees.d.mts +0 -1709
- package/dist/rest/work.d.mts +0 -1695
- package/dist/server/lifecycle.d.mts +0 -2
- package/dist/store/promises.d.mts +0 -11
- package/dist/store/promises.mjs +0 -327
|
@@ -108,13 +108,16 @@ const ExistingContext = contextOf({
|
|
|
108
108
|
/**
|
|
109
109
|
* `no-queue`: the repo is there, with no merge queue, so a caller never reads it as a missing
|
|
110
110
|
* repo. `no-topics`: the server runs no topics. `ambiguous`: a short ID starts more than one
|
|
111
|
-
* object, so it names none. `
|
|
111
|
+
* object, so it names none. `past-roots`: the repo is shallow and holds no object the call named,
|
|
112
|
+
* which may be history past its roots: a deepen or an import without a depth brings it. `target`
|
|
113
|
+
* is the one the call or push named, when it named one.
|
|
112
114
|
*/
|
|
113
115
|
const MissingReason = /* @__PURE__ */ Schema.Literals([
|
|
114
116
|
"no-queue",
|
|
115
117
|
"no-sync",
|
|
116
118
|
"no-topics",
|
|
117
|
-
"ambiguous"
|
|
119
|
+
"ambiguous",
|
|
120
|
+
"past-roots"
|
|
118
121
|
]);
|
|
119
122
|
const MissingContext = contextOf({
|
|
120
123
|
reason: reasonOf(MissingReason),
|
|
@@ -210,6 +213,10 @@ const PreconditionContext = contextOf({
|
|
|
210
213
|
* `job-step-yielded` is a try that spent those calls once a write of its own landed: the queue
|
|
211
214
|
* tries it again by the job's policy, and the next try goes on from what it saved. Its context is
|
|
212
215
|
* `job-step-calls`', and each try it takes spends one of the job's attempts.
|
|
216
|
+
*
|
|
217
|
+
* `fork-chunks-past-budget` is a fork's create, sync or fetch whose source holds chunked objects
|
|
218
|
+
* that need more store calls (`needed`) than the request's call budget has left (`allowed`),
|
|
219
|
+
* refused up front before any chunk is copied so no partial chunks are staged.
|
|
213
220
|
*/
|
|
214
221
|
const ResourceReason = /* @__PURE__ */ Schema.Literals([
|
|
215
222
|
"too-large",
|
|
@@ -232,18 +239,22 @@ const ResourceReason = /* @__PURE__ */ Schema.Literals([
|
|
|
232
239
|
"too-many-gitmodules-and-gitattributes",
|
|
233
240
|
"prune-walk-too-large",
|
|
234
241
|
"job-step-calls",
|
|
235
|
-
"job-step-yielded"
|
|
242
|
+
"job-step-yielded",
|
|
243
|
+
"fork-chunks-past-budget"
|
|
236
244
|
]);
|
|
237
245
|
/**
|
|
238
246
|
* A push refused `too-large` by the repo's pack indexes it reads: those indexes' bytes in
|
|
239
247
|
* `indexBytes`, the push's own beside them in `pushBytes`, and the most the server's memory could
|
|
240
|
-
* give it in `most`.
|
|
248
|
+
* give it in `most`. A fork refused `fork-chunks-past-budget` names the chunk-copy store calls
|
|
249
|
+
* `needed` and the `allowed` calls left in the request's budget.
|
|
241
250
|
*/
|
|
242
251
|
const ResourceContext = contextOf({
|
|
243
252
|
reason: reasonOf(ResourceReason),
|
|
244
253
|
indexBytes: Count,
|
|
245
254
|
pushBytes: Count,
|
|
246
|
-
most: Count
|
|
255
|
+
most: Count,
|
|
256
|
+
needed: Count,
|
|
257
|
+
allowed: Count
|
|
247
258
|
});
|
|
248
259
|
/**
|
|
249
260
|
* `graph-length`: `pack`'s `.graph` reads past the bytes its pack row records, or ends whole, its
|
|
@@ -266,7 +277,10 @@ const HostErrorContext = contextOf({ id: Schema.optionalKey(BodyText) });
|
|
|
266
277
|
* `packs-awaiting-repack`: a push to a repo whose listed packs, piled up between repacks, are more
|
|
267
278
|
* than its links can be checked against, refused before its body is read. `packs` is how many the
|
|
268
279
|
* repo lists, and `most` how many a push's links can be checked against; `git.repack` merging them
|
|
269
|
-
* lets the same push land. `awaiting-
|
|
280
|
+
* lets the same push land. `batches-awaiting-upkeep`: a push to a `loose()` repo already holding
|
|
281
|
+
* as many published batches, each a large push's rows staged apart, as a read checks, refused at
|
|
282
|
+
* its commit: `batches` is how many are waiting, and `most` how many a repo holds; upkeep moving
|
|
283
|
+
* them into its rows lets the same push land. `awaiting-index`: a fetch past what one fetch's walk holds, refused
|
|
270
284
|
* while `git.index` will build the index it can be sent from, or under private branches a
|
|
271
285
|
* `refs.list` or `refs.count` by a caller who doesn't read every pattern, while the repo's ref
|
|
272
286
|
* index is rebuilt for the server's patterns: the same call is served once the index is built.
|
|
@@ -278,6 +292,7 @@ const HostErrorContext = contextOf({ id: Schema.optionalKey(BodyText) });
|
|
|
278
292
|
const UnavailableReason = /* @__PURE__ */ Schema.Literals([
|
|
279
293
|
"busy",
|
|
280
294
|
"packs-awaiting-repack",
|
|
295
|
+
"batches-awaiting-upkeep",
|
|
281
296
|
"awaiting-index",
|
|
282
297
|
"may-have-saved",
|
|
283
298
|
"too-many-writes",
|
|
@@ -292,6 +307,7 @@ const UnavailableContext = contextOf({
|
|
|
292
307
|
id: Schema.optionalKey(BodyText),
|
|
293
308
|
reason: reasonOf(UnavailableReason),
|
|
294
309
|
packs: Count,
|
|
310
|
+
batches: Count,
|
|
295
311
|
most: Count,
|
|
296
312
|
retryAfter: Count
|
|
297
313
|
});
|
|
@@ -383,6 +399,18 @@ const gitError = (code, message, input = {}) => new GitErrorTagged({
|
|
|
383
399
|
/** An Effect failing with `gitError`'s error. */
|
|
384
400
|
const fail = (code, message, input) => Effect.fail(gitError(code, message, input));
|
|
385
401
|
/**
|
|
402
|
+
* A read of `oid` a shallow repo doesn't hold: `NOT_FOUND`, `past-roots`, since it may be history
|
|
403
|
+
* past the repo's roots, which no fetch of it brought. A repo that holds no roots answers a plain
|
|
404
|
+
* `NOT_FOUND` instead, as `missingObject` chooses.
|
|
405
|
+
*/
|
|
406
|
+
const pastRoots = (message, oid) => gitError("NOT_FOUND", message, {
|
|
407
|
+
hint: "The object may be history past the repo's roots: deepen the repo, or import it again without a depth",
|
|
408
|
+
context: {
|
|
409
|
+
reason: "past-roots",
|
|
410
|
+
target: oid
|
|
411
|
+
}
|
|
412
|
+
});
|
|
413
|
+
/**
|
|
386
414
|
* Git's error from `fields`, a `GitError`'s or a body's that a client read, with `over`'s fields,
|
|
387
415
|
* its message among them, over them. A `GitError` keeps `message` and `cause` off its enumerable
|
|
388
416
|
* keys, as an `Error` does, so a spread of one would drop them: this reads each field by name.
|
|
@@ -453,4 +481,4 @@ const reject = ({ code, message, hint, context }) => {
|
|
|
453
481
|
if (context !== void 0) rejected.context = context;
|
|
454
482
|
return rejected;
|
|
455
483
|
};
|
|
456
|
-
export { ContextValue, DataLossContext, DataLossReason, ErrorContext, ExistingContext, ExistingReason, GitErrorBody, GitErrorCode, GitErrorTagged, GitErrorValue, HostErrorContext, InvalidInputContext, InvalidInputReason, MissingContext, MissingReason, NotAllowedContext, NotAllowedReason, PreconditionContext, PreconditionReason, RejectInput, Rejected, ResourceContext, ResourceReason, UnavailableContext, UnavailableReason, Verdict, accept, decisionAnswer, fail, gitError, gitErrorBodies, gitErrorFrom, httpStatus, isGitError, isGitErrorCode, isRefusalReason, refusalCodeHeader, reject };
|
|
484
|
+
export { ContextValue, DataLossContext, DataLossReason, ErrorContext, ExistingContext, ExistingReason, GitErrorBody, GitErrorCode, GitErrorTagged, GitErrorValue, HostErrorContext, InvalidInputContext, InvalidInputReason, MissingContext, MissingReason, NotAllowedContext, NotAllowedReason, PreconditionContext, PreconditionReason, RejectInput, Rejected, ResourceContext, ResourceReason, UnavailableContext, UnavailableReason, Verdict, accept, decisionAnswer, fail, gitError, gitErrorBodies, gitErrorFrom, httpStatus, isGitError, isGitErrorCode, isRefusalReason, pastRoots, refusalCodeHeader, reject };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { Duration } from "./
|
|
2
|
-
import { Authorize } from "./authorize.mjs";
|
|
1
|
+
import { Duration } from "./time.mjs";
|
|
3
2
|
import { Caller } from "./actors.mjs";
|
|
4
3
|
import { BlobCalls, Blobs } from "./blobs.mjs";
|
|
5
4
|
import { CommitCalls, Commits } from "./commits.mjs";
|
|
6
|
-
import {
|
|
5
|
+
import { EventsOptions } from "./git-events.mjs";
|
|
7
6
|
import { FileCalls, Files } from "./files.mjs";
|
|
8
7
|
import { ForkCalls, Forks } from "./forks.mjs";
|
|
9
8
|
import { LfsCalls } from "./lfs.mjs";
|
|
@@ -11,37 +10,30 @@ import { MergeCalls } from "./merges.mjs";
|
|
|
11
10
|
import { EffectiveLimits } from "./objects.mjs";
|
|
12
11
|
import { PushOptions } from "./push-uploads.mjs";
|
|
13
12
|
import { MergeQueueCalls } from "./queue.mjs";
|
|
14
|
-
import { RefCalls
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
13
|
+
import { RefCalls } from "./refs.mjs";
|
|
14
|
+
import { Repos } from "./repos.mjs";
|
|
15
|
+
import { GitError, Result } from "./result.mjs";
|
|
17
16
|
import { TagCalls, Tags } from "./tags.mjs";
|
|
18
17
|
import { TreeCalls, Trees } from "./trees.mjs";
|
|
19
|
-
import {
|
|
20
|
-
import { Rules } from "./rules.mjs";
|
|
21
|
-
import { TokenCalls } from "./tokens.mjs";
|
|
18
|
+
import { Tokens } from "./tokens.mjs";
|
|
22
19
|
import { Work, WorkCalls } from "./work.mjs";
|
|
23
20
|
import { TopicCalls } from "./topics.mjs";
|
|
21
|
+
import * as Effect from "effect/Effect";
|
|
24
22
|
import { CallLimits, JobQueue, Records } from "@ref0/infra";
|
|
25
|
-
import * as Layer from "effect/Layer";
|
|
26
|
-
import * as ManagedRuntime from "effect/ManagedRuntime";
|
|
27
23
|
/** The call modules' services, which a server's runtime holds, each deciding for its `by`. */
|
|
28
24
|
export type CallServices = Repos | Forks | Work | Blobs | Trees | Commits | Tags | Files;
|
|
29
|
-
/** The services every Git server takes from its adapter. */
|
|
30
|
-
export type GitNeeds = Records.Records | JobQueue.JobQueue | CallLimits.CallLimits;
|
|
31
25
|
/**
|
|
32
|
-
* The
|
|
33
|
-
* `
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* no whole number of calls fails the build, logged as "The Git server failed to start" with the
|
|
37
|
-
* bound it names, and every request answers `UNAVAILABLE` until it's fixed.
|
|
26
|
+
* The services `Git.layer` takes from the host, beside its `Policy` and objects: `Records`,
|
|
27
|
+
* `JobQueue` and `CallLimits`. Its `CallLimits` are checked as the server builds, before any
|
|
28
|
+
* objects open them: a bound that's no whole number of calls fails the host's build, logged as "The
|
|
29
|
+
* Git server failed to start" with the bound it names, and stays failed until it's fixed.
|
|
38
30
|
*/
|
|
39
|
-
export type
|
|
40
|
-
/** What `adapter` gives. */
|
|
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;
|
|
31
|
+
export type GitNeeds = Records.Records | JobQueue.JobQueue | CallLimits.CallLimits;
|
|
42
32
|
/**
|
|
43
|
-
* `Git.layer`'s options: settings only (Q834, Q1006), with a platform's `maxDuration` (Q1190),
|
|
44
|
-
*
|
|
33
|
+
* `Git.layer`'s options: settings only (Q834, Q1006), with a platform's `maxDuration` (Q1190), the
|
|
34
|
+
* sizes a pushed file and its repo are held to, `pushes.files` and `pushes.repo` (#2395), and the
|
|
35
|
+
* deliveries the host has retired, `events.retired` (#2473), written as rows once the server is
|
|
36
|
+
* live, never in its build, as `EventsOptions` says. Push
|
|
45
37
|
* uploads are `Git.layerUploads`'.
|
|
46
38
|
*/
|
|
47
39
|
export interface GitOptions {
|
|
@@ -55,6 +47,8 @@ export interface GitOptions {
|
|
|
55
47
|
* doesn't bound. A host may lower it as far as `pruneFloor`, an hour, never below.
|
|
56
48
|
*/
|
|
57
49
|
readonly fetchLimits?: EffectiveLimits;
|
|
50
|
+
/** The host's events settings: the deliveries it has retired, `EventsOptions` says. */
|
|
51
|
+
readonly events?: EventsOptions;
|
|
58
52
|
/**
|
|
59
53
|
* The route's own limit, such as `'60 seconds'`, counted from each request's start. A pack that
|
|
60
54
|
* would run past it ends 5 seconds before, or a tenth of a shorter limit, on side-band 3, naming
|
|
@@ -67,9 +61,13 @@ export interface GitOptions {
|
|
|
67
61
|
*/
|
|
68
62
|
readonly pushes?: Pick<PushOptions, 'files' | 'repo'>;
|
|
69
63
|
}
|
|
64
|
+
/** The Promise twin of an Effect call group on `ServerCalls`. */
|
|
65
|
+
type PromiseGroup<T> = { readonly [K in keyof T]: T[K] extends ((...args: infer Args) => Effect.Effect<infer A, GitError>) ? (...args: Args) => Promise<Result<A>> : never; };
|
|
66
|
+
/** The Promise twin of a `by?: Caller` Effect service on `ServerCalls`, dropping the trailing `by`. */
|
|
67
|
+
type WithoutByPromise<T> = { readonly [K in keyof T]: T[K] extends ((a: infer A, by?: Caller) => Effect.Effect<infer R, GitError>) ? (a: A) => Promise<Result<R>> : T[K] extends ((a: infer A, b: infer B, by?: Caller) => Effect.Effect<infer R, GitError>) ? (a: A, b: B) => Promise<Result<R>> : never; };
|
|
70
68
|
/** Each piece adds its own groups: C's, RD's objects, Q's `queue` and TP's `topics`. */
|
|
71
69
|
export interface ServerCalls {
|
|
72
|
-
readonly repos:
|
|
70
|
+
readonly repos: WithoutByPromise<Repos['Service']>;
|
|
73
71
|
readonly forks: ForkCalls;
|
|
74
72
|
readonly work: WorkCalls;
|
|
75
73
|
readonly refs: RefCalls;
|
|
@@ -80,31 +78,8 @@ export interface ServerCalls {
|
|
|
80
78
|
readonly files: FileCalls;
|
|
81
79
|
readonly merges: MergeCalls;
|
|
82
80
|
readonly lfs: LfsCalls;
|
|
83
|
-
readonly tokens?:
|
|
81
|
+
readonly tokens?: PromiseGroup<Tokens['Service']>;
|
|
84
82
|
readonly queue?: MergeQueueCalls;
|
|
85
83
|
readonly topics?: TopicCalls;
|
|
86
84
|
}
|
|
87
|
-
export
|
|
88
|
-
/** 404 outside Git's URLs. */
|
|
89
|
-
readonly fetch: (request: Request) => Promise<Response>;
|
|
90
|
-
/** `undefined` only for a URL Git doesn't own. */
|
|
91
|
-
readonly route: (request: Request) => Promise<Response | undefined>;
|
|
92
|
-
/** Who `request` is, as `authorize` sees it: its token's, its grant's, or the host's session's. */
|
|
93
|
-
readonly identify: (request: Request) => Promise<Result<Caller>>;
|
|
94
|
-
/**
|
|
95
|
-
* The isolate's runtime, over the adapter's Layers and Git's own wiring, which registers Git's
|
|
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
|
|
103
|
-
* holds `RepoRecords`, `Authorize`, `Refs`, `Rules`, `Events` and the call modules' services beside
|
|
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
|
|
105
|
-
* its adapter's services. The bridge until SV's step 2c.
|
|
106
|
-
*/
|
|
107
|
-
readonly runtime: ManagedRuntime.ManagedRuntime<R | RepoRecords | Authorize | Refs | Rules | Events | CallServices, Error>;
|
|
108
|
-
/** Disposes `runtime`. */
|
|
109
|
-
readonly close: () => Promise<void>;
|
|
110
|
-
}
|
|
85
|
+
export {};
|
|
@@ -7,7 +7,7 @@ import * as Context from "effect/Context";
|
|
|
7
7
|
* A Promise surface's Effect twin: the same inputs, with the failure in the error channel, each
|
|
8
8
|
* call needing `R`: none on any face a host holds, and core's services inside it.
|
|
9
9
|
*/
|
|
10
|
-
export type EffectCalls<T, R = never> = { readonly [K in keyof T]: NonNullable<T[K]> extends ((...args: infer Args) => Promise<infer Answer>) ? (...args: Args) => [Answer] extends [Result<infer A>] ? Effect.Effect<A, GitError, R> : Effect.Effect<Answer, never, R> : EffectCalls<NonNullable<T[K]>, R>; };
|
|
10
|
+
export type EffectCalls<T, R = never> = { readonly [K in keyof T]: NonNullable<T[K]> extends ((...args: infer Args) => Promise<infer Answer>) ? (...args: Args) => [Answer] extends [Result<infer A>] ? Effect.Effect<A, GitError, R> : Effect.Effect<Answer, never, R> : NonNullable<T[K]> extends ((...args: infer Args) => Effect.Effect<infer A, infer E, unknown>) ? (...args: Args) => Effect.Effect<A, E, R> : EffectCalls<NonNullable<T[K]>, R>; };
|
|
11
11
|
/**
|
|
12
12
|
* `T`'s calls as Effects, each deciding for `by`: a caller `identify` answered, its token or grant
|
|
13
13
|
* with it, or `Git.host`. With none, a call decides for the actor its input names, as the server's
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { InternalRepoId } from "./ids.mjs";
|
|
2
2
|
import { CallInput } from "./actors.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { GitError } from "./result.mjs";
|
|
4
|
+
import * as Effect from "effect/Effect";
|
|
4
5
|
import * as Schema from "effect/Schema";
|
|
5
6
|
import { Addition, Change, Committed, Read, Scope, Snapshot } from "@ref0/infra";
|
|
6
7
|
/** A pack another pack holds whole, by its ID, with its size (Q903). */
|
|
@@ -72,10 +73,10 @@ export interface ListedInput extends CallInput {
|
|
|
72
73
|
}
|
|
73
74
|
/** Git's records over infra's `Store`, under Git's commit rules. Features never get the raw store. */
|
|
74
75
|
export interface GitStore {
|
|
75
|
-
readonly read: (input: GitStoreReadInput) =>
|
|
76
|
+
readonly read: (input: GitStoreReadInput) => Effect.Effect<Snapshot, GitError>;
|
|
76
77
|
/** Fenced by the current job's claim inside a job's try. */
|
|
77
|
-
readonly commit: (input: GitStoreCommitInput) =>
|
|
78
|
+
readonly commit: (input: GitStoreCommitInput) => Effect.Effect<Committed, GitError>;
|
|
78
79
|
/** Fenced like `commit`; `ALREADY_EXISTS` when a row it puts is there. */
|
|
79
|
-
readonly add: (input: GitStoreAddInput) =>
|
|
80
|
-
readonly listed: (input: ListedInput) =>
|
|
80
|
+
readonly add: (input: GitStoreAddInput) => Effect.Effect<void, GitError>;
|
|
81
|
+
readonly listed: (input: ListedInput) => Effect.Effect<Listed, GitError>;
|
|
81
82
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ClientCredential
|
|
2
|
-
import { Awaitable, GitError, Result } from "./result.mjs";
|
|
1
|
+
import { ClientCredential } from "./remote.mjs";
|
|
3
2
|
import { ActorInput, WriteInput } from "./actors.mjs";
|
|
4
3
|
import { RefName, RepoName } from "./ids.mjs";
|
|
5
4
|
import { RepoInfo, RepoInput } from "./repos.mjs";
|
|
5
|
+
import { GitError, Result } from "./result.mjs";
|
|
6
6
|
import * as Effect from "effect/Effect";
|
|
7
7
|
import * as Schema from "effect/Schema";
|
|
8
8
|
import * as Context from "effect/Context";
|
|
@@ -26,7 +26,7 @@ export declare const SyncRemote: Schema.Struct<{
|
|
|
26
26
|
readonly password: Schema.String;
|
|
27
27
|
}>, Schema.Struct<{
|
|
28
28
|
readonly token: Schema.String;
|
|
29
|
-
}>]>, Schema.declare<(
|
|
29
|
+
}>]>, Schema.declare<() => Effect.Effect<ClientCredential, GitError>, () => Effect.Effect<ClientCredential, GitError>>]>>;
|
|
30
30
|
readonly transport: Schema.optionalKey<Schema.declare<(request: Request) => Effect.Effect<Response, GitError>, (request: Request) => Effect.Effect<Response, GitError>>>;
|
|
31
31
|
}>;
|
|
32
32
|
export type SyncRemote = typeof SyncRemote.Type;
|
|
@@ -102,14 +102,17 @@ export type ImportProgress = typeof ImportProgress.Type;
|
|
|
102
102
|
export type ReportImportProgress = (progress: ImportProgress) => void | Promise<void>;
|
|
103
103
|
/**
|
|
104
104
|
* `repo` is created by the import. `source` names a provider `Sync.layer` was given, or the import
|
|
105
|
-
* is refused `INVALID_ARGUMENT`, reason `provider-unknown`, and nothing is written.
|
|
106
|
-
*
|
|
107
|
-
* the
|
|
108
|
-
* it
|
|
105
|
+
* is refused `INVALID_ARGUMENT`, reason `provider-unknown`, and nothing is written. `depth` copies
|
|
106
|
+
* only that many commits from each tip, as `git clone --depth` does, a whole number from 1 to
|
|
107
|
+
* `importDepthMost`: the oldest it copies become the repo's shallow roots, which every fetch names
|
|
108
|
+
* and every walk stops at. Left out, it copies the whole history, and a remote that is itself a
|
|
109
|
+
* shallow clone imports with its own roots. `key` is a write's: sent again, the import answers as
|
|
110
|
+
* it first did. Interrupting ends the wait, not the import: `cancelImport` stops it.
|
|
109
111
|
*/
|
|
110
112
|
export interface SyncImportInput extends Omit<WriteInput, 'signal'> {
|
|
111
113
|
readonly repo: RepoName;
|
|
112
114
|
readonly source: SyncSource;
|
|
115
|
+
readonly depth?: number;
|
|
113
116
|
readonly onProgress?: ReportImportProgress;
|
|
114
117
|
}
|
|
115
118
|
/**
|
|
@@ -217,6 +220,7 @@ export declare const ImportJobData: Schema.Struct<{
|
|
|
217
220
|
readonly provider: Schema.String;
|
|
218
221
|
readonly repo: Schema.String;
|
|
219
222
|
}>;
|
|
223
|
+
readonly depth: Schema.optionalKey<Schema.Int>;
|
|
220
224
|
}>;
|
|
221
225
|
export type ImportJobData = typeof ImportJobData.Type;
|
|
222
226
|
/**
|
package/dist/contracts/sync.mjs
CHANGED
|
@@ -41,6 +41,13 @@ const ImportPhase = /* @__PURE__ */ Schema.Literals([
|
|
|
41
41
|
"publish"
|
|
42
42
|
]);
|
|
43
43
|
Schema.Array(WorkMeasure);
|
|
44
|
+
/** The deepest an import's `depth` asks: as deep as a segment's step grows, past which a history is whole in one. */
|
|
45
|
+
const importDepthMost = 1 << 20;
|
|
46
|
+
/** An import's `depth`: a whole number of commits from each tip, 1 to `importDepthMost`. */
|
|
47
|
+
const ImportDepth = /* @__PURE__ */ Schema.Int.check(Schema.isBetween({
|
|
48
|
+
minimum: 1,
|
|
49
|
+
maximum: importDepthMost
|
|
50
|
+
}));
|
|
44
51
|
/**
|
|
45
52
|
* Why a mirror stopped: `diverged`, the upstream holds commits the ref doesn't; `refused`, the
|
|
46
53
|
* upstream refused the push for another reason, such as a protected branch or a credential;
|
|
@@ -73,7 +80,10 @@ Schema.Struct({
|
|
|
73
80
|
to: Schema.Null
|
|
74
81
|
});
|
|
75
82
|
/** `sync.import`, keyed `import`, in the repo's scope. */
|
|
76
|
-
const ImportJobData = /* @__PURE__ */ Schema.Struct({
|
|
83
|
+
const ImportJobData = /* @__PURE__ */ Schema.Struct({
|
|
84
|
+
source: SyncSource,
|
|
85
|
+
depth: Schema.optionalKey(ImportDepth)
|
|
86
|
+
});
|
|
77
87
|
/**
|
|
78
88
|
* `sync.mirror`, one a destination, in the repo's scope, keyed by the destination's digest: each
|
|
79
89
|
* try pushes every ref whose mirror names it.
|
|
@@ -95,4 +105,4 @@ const mirror = (input) => Effect.flatMap(Sync, (sync) => sync.mirror(input));
|
|
|
95
105
|
const mirrors = (input) => Effect.flatMap(Sync, (sync) => sync.mirrors(input));
|
|
96
106
|
const removeMirror = (input) => Effect.flatMap(Sync, (sync) => sync.removeMirror(input));
|
|
97
107
|
const publishImported = (input) => Effect.flatMap(Sync, (sync) => sync.publishImported(input));
|
|
98
|
-
export { ImportJobData, ImportLfsReason, ImportPhase, MirrorJobData, MirrorPause, MirrorPush, Sync, SyncSource, SyncTransport, cancelImport, importRepo, importedPullRefs, mirror, mirrors, publishImported, removeMirror };
|
|
108
|
+
export { ImportDepth, ImportJobData, ImportLfsReason, ImportPhase, MirrorJobData, MirrorPause, MirrorPush, Sync, SyncSource, SyncTransport, cancelImport, importDepthMost, importRepo, importedPullRefs, mirror, mirrors, publishImported, removeMirror };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { EffectCalls } from "./services.mjs";
|
|
2
|
-
import { GitError, Result } from "./result.mjs";
|
|
3
2
|
import { Caller, WriteInput } from "./actors.mjs";
|
|
4
3
|
import { Acting, ObjectInput } from "./blobs.mjs";
|
|
5
4
|
import { ReadOptions, Tag, TagFields } from "./engine.mjs";
|
|
6
5
|
import { RepoName } from "./ids.mjs";
|
|
7
6
|
import { RepoInput } from "./repos.mjs";
|
|
7
|
+
import { GitError } from "./result.mjs";
|
|
8
8
|
import * as Effect from "effect/Effect";
|
|
9
9
|
import * as Schema from "effect/Schema";
|
|
10
10
|
import * as Context from "effect/Context";
|
|
@@ -79,17 +79,17 @@ export declare const Peeled: Schema.Union<readonly [Schema.Struct<{
|
|
|
79
79
|
export type Peeled = typeof Peeled.Type;
|
|
80
80
|
export interface TagCalls {
|
|
81
81
|
/** An annotated tag, by its object's ID. */
|
|
82
|
-
readonly get: (repo: RepoName, input: Acting<ObjectInput>) =>
|
|
82
|
+
readonly get: (repo: RepoName, input: Acting<ObjectInput>) => Effect.Effect<Tag, GitError>;
|
|
83
83
|
/**
|
|
84
84
|
* Each of `oids` peeled to its commit, in one opened repo, as `Peeled` says: `answer[i]`
|
|
85
85
|
* answers `oids[i]`, duplicates included. A missing or hidden ID answers for its entry alone.
|
|
86
86
|
*/
|
|
87
|
-
readonly peel: (repo: RepoName, input: Acting<PeelInput>) =>
|
|
87
|
+
readonly peel: (repo: RepoName, input: Acting<PeelInput>) => Effect.Effect<readonly Peeled[], GitError>;
|
|
88
88
|
/** An annotated tag, written as its own commit; `refs.update` points `refs/tags/<tag>` at it. */
|
|
89
|
-
readonly create: (repo: RepoName, input: TagCreateInput) =>
|
|
89
|
+
readonly create: (repo: RepoName, input: TagCreateInput) => Effect.Effect<Tag, GitError>;
|
|
90
90
|
}
|
|
91
91
|
declare const Tags_base: Context.ServiceClass<Tags, "@ref0/git/Tags", EffectCalls<{
|
|
92
|
-
readonly get: (repo: string, input: Acting<ObjectInput>, by?: Caller<unknown> | undefined) =>
|
|
92
|
+
readonly get: (repo: string, input: Acting<ObjectInput>, by?: Caller<unknown> | undefined) => Effect.Effect<{
|
|
93
93
|
readonly oid: string;
|
|
94
94
|
readonly object: string;
|
|
95
95
|
readonly type: "blob" | "commit" | "tag" | "tree";
|
|
@@ -101,8 +101,8 @@ declare const Tags_base: Context.ServiceClass<Tags, "@ref0/git/Tags", EffectCall
|
|
|
101
101
|
readonly offset: number;
|
|
102
102
|
};
|
|
103
103
|
readonly message: string;
|
|
104
|
-
}
|
|
105
|
-
readonly peel: (repo: string, input: Acting<PeelInput>, by?: Caller<unknown> | undefined) =>
|
|
104
|
+
}, GitError, never>;
|
|
105
|
+
readonly peel: (repo: string, input: Acting<PeelInput>, by?: Caller<unknown> | undefined) => Effect.Effect<readonly ({
|
|
106
106
|
readonly found: true;
|
|
107
107
|
readonly oid: string;
|
|
108
108
|
readonly type: "blob" | "commit" | "tag" | "tree";
|
|
@@ -142,8 +142,8 @@ declare const Tags_base: Context.ServiceClass<Tags, "@ref0/git/Tags", EffectCall
|
|
|
142
142
|
} | {
|
|
143
143
|
readonly found: false;
|
|
144
144
|
readonly oid: string;
|
|
145
|
-
})[]
|
|
146
|
-
readonly create: (repo: string, input: TagCreateInput, by?: Caller<unknown> | undefined) =>
|
|
145
|
+
})[], GitError, never>;
|
|
146
|
+
readonly create: (repo: string, input: TagCreateInput, by?: Caller<unknown> | undefined) => Effect.Effect<{
|
|
147
147
|
readonly oid: string;
|
|
148
148
|
readonly object: string;
|
|
149
149
|
readonly type: "blob" | "commit" | "tag" | "tree";
|
|
@@ -155,7 +155,7 @@ declare const Tags_base: Context.ServiceClass<Tags, "@ref0/git/Tags", EffectCall
|
|
|
155
155
|
readonly offset: number;
|
|
156
156
|
};
|
|
157
157
|
readonly message: string;
|
|
158
|
-
}
|
|
158
|
+
}, GitError, never>;
|
|
159
159
|
}, never>>;
|
|
160
160
|
/**
|
|
161
161
|
* A repo's annotated tags: read, peeled and written. `TagCalls` as Effects, each deciding for `by`. The server builds it inside its runtime's
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Option from "effect/Option";
|
|
2
2
|
import * as EffectDuration from "effect/Duration";
|
|
3
|
-
// src/contracts/
|
|
3
|
+
// src/contracts/time.ts
|
|
4
4
|
/** `duration` in whole milliseconds, or a `TypeError` for a negative, endless or unreadable one. */
|
|
5
5
|
const millis = (duration) => {
|
|
6
6
|
const value = Option.match(EffectDuration.fromInput(duration), {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { GitError, Result } from "./result.mjs";
|
|
2
1
|
import { CallInput, NamedActor } from "./actors.mjs";
|
|
3
|
-
import {
|
|
2
|
+
import { GitError } from "./result.mjs";
|
|
4
3
|
import * as Effect from "effect/Effect";
|
|
5
4
|
import * as Schema from "effect/Schema";
|
|
6
5
|
import { Listing } from "@ref0/infra";
|
|
@@ -173,31 +172,30 @@ export interface TokenListInput extends CallInput, TokenList {}
|
|
|
173
172
|
export interface TrustedWriteInput extends CallInput {
|
|
174
173
|
readonly key?: string;
|
|
175
174
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
readonly
|
|
179
|
-
|
|
175
|
+
export interface VerifiedToken {
|
|
176
|
+
readonly actor: NamedActor;
|
|
177
|
+
readonly scope: TokenScope;
|
|
178
|
+
}
|
|
179
|
+
declare const Tokens_base: Context.ServiceClass<Tokens, "@ref0/git/Tokens", {
|
|
180
|
+
readonly create: (target: TokenTarget, input: TokenCreateInput) => Effect.Effect<CreatedToken, GitError>;
|
|
181
|
+
readonly list: (target: TokenTarget, input?: TokenListInput) => Effect.Effect<Listing<TokenRecord>, GitError>;
|
|
180
182
|
/**
|
|
181
183
|
* One token's record, as `list` answers it, with no secret: `NOT_FOUND` for an ID no token has.
|
|
182
184
|
* A caller's is asked as a list of the token's place, and a refused one is `NOT_FOUND` too.
|
|
183
185
|
*/
|
|
184
|
-
readonly get: (token: TokenId, input?: CallInput) =>
|
|
185
|
-
readonly revoke: (token: TokenId, input?: TrustedWriteInput) =>
|
|
186
|
+
readonly get: (token: TokenId, input?: CallInput) => Effect.Effect<TokenRecord, GitError>;
|
|
187
|
+
readonly revoke: (token: TokenId, input?: TrustedWriteInput) => Effect.Effect<void, GitError>;
|
|
186
188
|
/**
|
|
187
189
|
* Revokes the token `key` made, or holds `key` until `until` so a later create naming it fails
|
|
188
190
|
* `ALREADY_EXISTS`: an owner that may end before its token is minted revokes it in either order.
|
|
189
191
|
* A key past `maxWriteKeyLength` bytes in UTF-8 is `INVALID_ARGUMENT`.
|
|
190
192
|
*/
|
|
191
|
-
readonly revokeKey: (target: TokenTarget, key: string, input: TokenKeyInput) =>
|
|
192
|
-
}
|
|
193
|
-
export interface VerifiedToken {
|
|
194
|
-
readonly actor: NamedActor;
|
|
195
|
-
readonly scope: TokenScope;
|
|
196
|
-
}
|
|
197
|
-
declare const Tokens_base: Context.ServiceClass<Tokens, "@ref0/git/Tokens", EffectCalls<TokenCalls, never>>;
|
|
193
|
+
readonly revokeKey: (target: TokenTarget, key: string, input: TokenKeyInput) => Effect.Effect<void, GitError>;
|
|
194
|
+
}>;
|
|
198
195
|
/**
|
|
199
|
-
* Git's own tokens
|
|
200
|
-
* `Tokens.layer()` provides it. Without it it
|
|
196
|
+
* Git's own tokens as Effects, deciding for no caller, as host code's do: direct calls trust host
|
|
197
|
+
* code; over REST, `auth` and `authorize` run first. `Tokens.layer()` provides it. Without it it
|
|
198
|
+
* isn't there, so code that may run without it reads it with `Effect.serviceOption`.
|
|
201
199
|
*/
|
|
202
200
|
export declare class Tokens extends /* @__PURE__ */ Tokens_base {}
|
|
203
201
|
export declare const create: (target: TokenTarget, input: TokenCreateInput) => Effect.Effect<{
|
|
@@ -104,8 +104,9 @@ const TokenList = /* @__PURE__ */ Schema.Struct({
|
|
|
104
104
|
page: Schema.optionalKey(Page)
|
|
105
105
|
});
|
|
106
106
|
/**
|
|
107
|
-
* Git's own tokens
|
|
108
|
-
* `Tokens.layer()` provides it. Without it it
|
|
107
|
+
* Git's own tokens as Effects, deciding for no caller, as host code's do: direct calls trust host
|
|
108
|
+
* code; over REST, `auth` and `authorize` run first. `Tokens.layer()` provides it. Without it it
|
|
109
|
+
* isn't there, so code that may run without it reads it with `Effect.serviceOption`.
|
|
109
110
|
*/
|
|
110
111
|
var Tokens = class extends (/* @__PURE__ */ Context.Service()("@ref0/git/Tokens")) {};
|
|
111
112
|
const create = (target, input) => Effect.flatMap(Effect.service(Tokens), (tokens) => tokens.create(target, input));
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { EffectCalls } from "./services.mjs";
|
|
2
|
-
import { GitError, Result } from "./result.mjs";
|
|
3
2
|
import { Caller, WriteInput } from "./actors.mjs";
|
|
4
3
|
import { Acting, CreatedObject } from "./blobs.mjs";
|
|
5
4
|
import { ReadOptions, ReadPage, TreeChanges, TreeDiffInput } from "./engine.mjs";
|
|
6
5
|
import { Oid, RepoName } from "./ids.mjs";
|
|
7
6
|
import { RepoInput } from "./repos.mjs";
|
|
7
|
+
import { GitError } from "./result.mjs";
|
|
8
8
|
import * as Effect from "effect/Effect";
|
|
9
9
|
import * as Schema from "effect/Schema";
|
|
10
10
|
import { Listing } from "@ref0/infra";
|
|
@@ -108,20 +108,20 @@ export declare const MergedTree: Schema.Struct<{
|
|
|
108
108
|
export type MergedTree = typeof MergedTree.Type;
|
|
109
109
|
export interface TreeCalls {
|
|
110
110
|
/** A tree's entries in Git's order; recursive, each folder before what it holds. */
|
|
111
|
-
readonly get: (repo: RepoName, input: Acting<TreeInput>) =>
|
|
111
|
+
readonly get: (repo: RepoName, input: Acting<TreeInput>) => Effect.Effect<Listing<TreeEntry>, GitError>;
|
|
112
112
|
/** Two trees' changes, as `git diff-tree -r -M` lists them. */
|
|
113
|
-
readonly diff: (repo: RepoName, input: Acting<TreeDiffInput>) =>
|
|
113
|
+
readonly diff: (repo: RepoName, input: Acting<TreeDiffInput>) => Effect.Effect<TreeChanges, GitError>;
|
|
114
114
|
/** A tree, written as its own commit with the blobs its edits' content makes. */
|
|
115
|
-
readonly create: (repo: RepoName, input: TreeCreateInput) =>
|
|
115
|
+
readonly create: (repo: RepoName, input: TreeCreateInput) => Effect.Effect<CreatedObject, GitError>;
|
|
116
116
|
/**
|
|
117
117
|
* A conflict fails `FAILED_PRECONDITION` with `merge-conflict`, its paths and their count.
|
|
118
118
|
* Without a base, commits that share no history fail `unrelated-histories`, and a virtual base
|
|
119
119
|
* the engine doesn't build as Git does fails `unsupported-virtual-base`.
|
|
120
120
|
*/
|
|
121
|
-
readonly merge: (repo: RepoName, input: PublicTreeMergeInput) =>
|
|
121
|
+
readonly merge: (repo: RepoName, input: PublicTreeMergeInput) => Effect.Effect<MergedTree, GitError>;
|
|
122
122
|
}
|
|
123
123
|
declare const Trees_base: Context.ServiceClass<Trees, "@ref0/git/Trees", EffectCalls<{
|
|
124
|
-
readonly get: (repo: string, input: Acting<TreeInput>, by?: Caller<unknown> | undefined) =>
|
|
124
|
+
readonly get: (repo: string, input: Acting<TreeInput>, by?: Caller<unknown> | undefined) => Effect.Effect<Listing<{
|
|
125
125
|
readonly name: string;
|
|
126
126
|
readonly path: string;
|
|
127
127
|
readonly mode: string;
|
|
@@ -129,15 +129,15 @@ declare const Trees_base: Context.ServiceClass<Trees, "@ref0/git/Trees", EffectC
|
|
|
129
129
|
readonly oid: string;
|
|
130
130
|
readonly size?: number;
|
|
131
131
|
readonly pathBytes?: Uint8Array<ArrayBufferLike>;
|
|
132
|
-
}
|
|
133
|
-
readonly diff: (repo: string, input: Acting<TreeDiffInput>, by?: Caller<unknown> | undefined) =>
|
|
134
|
-
readonly create: (repo: string, input: TreeCreateInput, by?: Caller<unknown> | undefined) =>
|
|
132
|
+
}>, GitError, never>;
|
|
133
|
+
readonly diff: (repo: string, input: Acting<TreeDiffInput>, by?: Caller<unknown> | undefined) => Effect.Effect<TreeChanges, GitError, never>;
|
|
134
|
+
readonly create: (repo: string, input: TreeCreateInput, by?: Caller<unknown> | undefined) => Effect.Effect<{
|
|
135
135
|
readonly oid: string;
|
|
136
|
-
}
|
|
137
|
-
readonly merge: (repo: string, input: PublicTreeMergeInput, by?: Caller<unknown> | undefined) =>
|
|
136
|
+
}, GitError, never>;
|
|
137
|
+
readonly merge: (repo: string, input: PublicTreeMergeInput, by?: Caller<unknown> | undefined) => Effect.Effect<{
|
|
138
138
|
readonly tree: string;
|
|
139
139
|
readonly renamesSkipped?: "memory-limit" | "rename-limit";
|
|
140
|
-
}
|
|
140
|
+
}, GitError, never>;
|
|
141
141
|
}, never>>;
|
|
142
142
|
/**
|
|
143
143
|
* A repo's trees: read, compared, written and merged. `TreeCalls` as Effects, each deciding for `by`. The server builds it inside its runtime's
|