@ref0/git 0.4.0 → 0.6.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.
Files changed (167) hide show
  1. package/dist/access/private-refs.mjs +3 -4
  2. package/dist/auth/authorize.mjs +9 -4
  3. package/dist/auth/identify.d.mts +5 -3
  4. package/dist/auth/tokens.mjs +12 -11
  5. package/dist/client/local.mjs +2 -0
  6. package/dist/client/slice-push.d.mts +1 -1
  7. package/dist/contracts/access.d.mts +6 -2
  8. package/dist/contracts/authorize.d.mts +14 -10
  9. package/dist/contracts/events.d.mts +32 -5
  10. package/dist/contracts/events.mjs +14 -3
  11. package/dist/contracts/git.d.mts +68 -3
  12. package/dist/contracts/grants.d.mts +6 -1
  13. package/dist/contracts/lfs.d.mts +5 -2
  14. package/dist/contracts/objects.d.mts +7 -2
  15. package/dist/contracts/promises.d.mts +2 -14
  16. package/dist/contracts/push-uploads.d.mts +1 -1
  17. package/dist/contracts/queue.d.mts +15 -7
  18. package/dist/contracts/refs.d.mts +1 -1
  19. package/dist/contracts/result.d.mts +9 -5
  20. package/dist/contracts/result.mjs +5 -0
  21. package/dist/contracts/server.d.mts +13 -6
  22. package/dist/contracts/work.d.mts +1 -1
  23. package/dist/core/access.mjs +17 -1
  24. package/dist/core/call-names.d.mts +3 -1
  25. package/dist/core/claim-rows.d.mts +4 -0
  26. package/dist/core/claim-rows.mjs +53 -0
  27. package/dist/core/events/deliver.d.mts +12 -0
  28. package/dist/core/events/deliver.mjs +367 -145
  29. package/dist/core/events/seen.mjs +17 -3
  30. package/dist/core/forks.mjs +82 -20
  31. package/dist/core/hooks/post-receive.mjs +20 -17
  32. package/dist/core/index-job.mjs +23 -17
  33. package/dist/core/parts.d.mts +6 -0
  34. package/dist/core/purge.d.mts +8 -0
  35. package/dist/core/purge.mjs +16 -21
  36. package/dist/core/push-decide.mjs +26 -4
  37. package/dist/core/push.mjs +57 -20
  38. package/dist/core/ref-index-job.mjs +9 -14
  39. package/dist/core/ref-index.d.mts +1 -0
  40. package/dist/core/ref-index.mjs +28 -8
  41. package/dist/core/ref-view.mjs +14 -9
  42. package/dist/core/refs.mjs +13 -11
  43. package/dist/core/repack.d.mts +2 -1
  44. package/dist/core/repack.mjs +66 -118
  45. package/dist/core/repos.mjs +5 -5
  46. package/dist/core/rules/check.mjs +7 -6
  47. package/dist/core/rules/context.d.mts +1 -1
  48. package/dist/core/seam.d.mts +56 -9
  49. package/dist/core/seam.mjs +7 -1
  50. package/dist/core/still-takes.mjs +75 -0
  51. package/dist/core/view.d.mts +1 -0
  52. package/dist/core/view.mjs +8 -9
  53. package/dist/core/work.mjs +1 -1
  54. package/dist/extend.d.mts +2 -1
  55. package/dist/http/core-parts.mjs +19 -11
  56. package/dist/http/handler.mjs +2 -2
  57. package/dist/http/node.d.mts +2 -23
  58. package/dist/http/parts.d.mts +1 -0
  59. package/dist/http/push-uploads.d.mts +10 -2
  60. package/dist/http/push-uploads.mjs +31 -34
  61. package/dist/http/receive-pack.mjs +5 -3
  62. package/dist/http/upload-pack.mjs +2 -2
  63. package/dist/index.d.mts +11 -7
  64. package/dist/index.mjs +5 -3
  65. package/dist/lfs/base.d.mts +32 -0
  66. package/dist/lfs/base.mjs +8 -0
  67. package/dist/lfs/calls.mjs +21 -12
  68. package/dist/lfs/layer.d.mts +27 -0
  69. package/dist/lfs/layer.mjs +64 -0
  70. package/dist/lfs/locks.mjs +13 -27
  71. package/dist/lfs/namespace.d.mts +2 -0
  72. package/dist/lfs/objects.d.mts +23 -4
  73. package/dist/lfs/objects.mjs +65 -81
  74. package/dist/lfs/pointers.mjs +8 -6
  75. package/dist/lfs/public.d.mts +5 -0
  76. package/dist/lfs/public.mjs +8 -0
  77. package/dist/lfs/purge.mjs +19 -25
  78. package/dist/lfs/rows.mjs +22 -10
  79. package/dist/lfs/service.d.mts +9 -4
  80. package/dist/lfs/service.mjs +3 -12
  81. package/dist/lfs/upkeep.mjs +34 -49
  82. package/dist/node.d.mts +3 -2
  83. package/dist/node.mjs +1 -1
  84. package/dist/protocol/wire/advertisement.d.mts +4 -10
  85. package/dist/protocol/wire/advertisement.mjs +16 -12
  86. package/dist/protocol/wire/lines.d.mts +14 -2
  87. package/dist/protocol/wire/lines.mjs +32 -21
  88. package/dist/protocol/wire/v2.d.mts +4 -15
  89. package/dist/protocol/wire/v2.mjs +16 -14
  90. package/dist/queue/advance.mjs +78 -55
  91. package/dist/queue/calls.mjs +4 -2
  92. package/dist/queue/commit.mjs +20 -13
  93. package/dist/queue/host.d.mts +2 -2
  94. package/dist/queue/layer.d.mts +4 -2
  95. package/dist/queue/layer.mjs +8 -3
  96. package/dist/queue/limits.mjs +36 -6
  97. package/dist/queue/rows.mjs +14 -5
  98. package/dist/queue/state.mjs +19 -5
  99. package/dist/queue/steps.mjs +10 -4
  100. package/dist/queue/trim.mjs +284 -0
  101. package/dist/rest/blobs.d.mts +19 -19
  102. package/dist/rest/caller.d.mts +4 -4
  103. package/dist/rest/commits.d.mts +96 -96
  104. package/dist/rest/errors.d.mts +2 -2
  105. package/dist/rest/events.d.mts +2 -2
  106. package/dist/rest/files.d.mts +54 -54
  107. package/dist/rest/forks.d.mts +87 -87
  108. package/dist/rest/handler.mjs +13 -5
  109. package/dist/rest/layer.d.mts +14 -0
  110. package/dist/rest/layer.mjs +52 -0
  111. package/dist/rest/me.d.mts +2 -2
  112. package/dist/rest/merges.d.mts +2 -2
  113. package/dist/rest/namespace.d.mts +2 -0
  114. package/dist/rest/queue.d.mts +208 -208
  115. package/dist/rest/refs.d.mts +131 -131
  116. package/dist/rest/repos.d.mts +12 -12
  117. package/dist/rest/tags.d.mts +70 -70
  118. package/dist/rest/tokens.d.mts +23 -23
  119. package/dist/rest/topics.d.mts +111 -111
  120. package/dist/rest/trees.d.mts +57 -57
  121. package/dist/rest/wire.d.mts +2 -0
  122. package/dist/rest/wire.mjs +2 -2
  123. package/dist/rest/work.d.mts +6 -6
  124. package/dist/server/edge-node.d.mts +20 -0
  125. package/dist/server/edge-node.mjs +20 -0
  126. package/dist/server/edge.d.mts +10 -0
  127. package/dist/server/edge.mjs +23 -0
  128. package/dist/server/extension.mjs +1 -1
  129. package/dist/server/git-layer.d.mts +15 -4
  130. package/dist/server/git-layer.mjs +13 -2
  131. package/dist/server/git-namespace.d.mts +5 -4
  132. package/dist/server/git-namespace.mjs +6 -3
  133. package/dist/server/registry.d.mts +3 -0
  134. package/dist/server/registry.mjs +58 -7
  135. package/dist/server/server.d.mts +3 -0
  136. package/dist/server/server.mjs +81 -39
  137. package/dist/server/uploads.d.mts +14 -0
  138. package/dist/server/uploads.mjs +15 -0
  139. package/dist/storage/calls.d.mts +7 -8
  140. package/dist/storage/calls.mjs +14 -14
  141. package/dist/storage/clean-up.mjs +59 -29
  142. package/dist/storage/host-bucket.mjs +16 -1
  143. package/dist/storage/index-build.d.mts +1 -1
  144. package/dist/storage/layout.mjs +5 -0
  145. package/dist/storage/merge.d.mts +1 -1
  146. package/dist/storage/push-uploads.mjs +12 -16
  147. package/dist/storage/quarantine.d.mts +1 -1
  148. package/dist/storage/quarantine.mjs +51 -12
  149. package/dist/storage/receive-bounds.d.mts +1 -1
  150. package/dist/storage/repack-job.d.mts +1 -1
  151. package/dist/storage/repack-job.mjs +7 -14
  152. package/dist/storage/rows.mjs +42 -3
  153. package/dist/storage/runs.d.mts +1 -1
  154. package/dist/store/job-try.mjs +26 -0
  155. package/dist/store/list-job.mjs +22 -16
  156. package/dist/store/outbox.mjs +38 -12
  157. package/dist/store/promises.d.mts +6 -1
  158. package/dist/store/promises.mjs +74 -89
  159. package/dist/store/queue-jobs.mjs +22 -1
  160. package/dist/store/scopes.mjs +0 -10
  161. package/dist/sync/mirror.d.mts +1 -1
  162. package/dist/sync/mirror.mjs +1 -1
  163. package/dist/sync/publish.mjs +12 -7
  164. package/dist/sync/step.mjs +4 -0
  165. package/package.json +3 -3
  166. package/dist/lfs/repo.mjs +0 -42
  167. package/dist/storage/promise-calls.mjs +0 -29
@@ -19,10 +19,9 @@ import { mergeCalls } from "../core/objects/merges.mjs";
19
19
  import { tagCalls } from "../core/objects/tags.mjs";
20
20
  import { treeCalls } from "../core/objects/trees.mjs";
21
21
  import { refIndexOf } from "../core/ref-index.mjs";
22
- import { byOrder } from "../core/hooks/order.mjs";
23
22
  import { callNames } from "../core/call-names.mjs";
24
23
  import { clocksOf } from "../core/clock.mjs";
25
- import { checkDeliveryTimeout, deliverJob, eventDelivery, workFailed } from "../core/events/deliver.mjs";
24
+ import { checkDeliveries, deliverJobs, deliveriesOf, workFailed } from "../core/events/deliver.mjs";
26
25
  import { checkPostReceiveTimeout, postReceiveJob } from "../core/hooks/post-receive.mjs";
27
26
  import { servedSources } from "../core/rules/protect.mjs";
28
27
  import { rulesOf } from "../core/rules/service.mjs";
@@ -43,11 +42,10 @@ import { tokenCallsAs } from "../core/tokens.mjs";
43
42
  import { workCalls } from "../core/work.mjs";
44
43
  import { coreHttpParts } from "../http/core-parts.mjs";
45
44
  import { refusal } from "../http/answers.mjs";
45
+ import { LfsBase } from "../lfs/base.mjs";
46
+ import { UploadsBase, attachUploads } from "./uploads.mjs";
46
47
  import { lfsCalls } from "../lfs/calls.mjs";
47
- import { lfsService } from "../lfs/service.mjs";
48
- import { pointerCheck } from "../lfs/pointers.mjs";
49
- import { lfsPurge } from "../lfs/purge.mjs";
50
- import { lfsUpkeep } from "../lfs/upkeep.mjs";
48
+ import { lfsClaim } from "../lfs/layer.mjs";
51
49
  import { gitHttp } from "../http/handler.mjs";
52
50
  import { gitUrlOf, normalBase } from "../http/paths.mjs";
53
51
  import { pushUploads } from "../http/push-uploads.mjs";
@@ -60,9 +58,11 @@ import { closedError } from "../store/closed.mjs";
60
58
  import { clientWentAway } from "../store/errors.mjs";
61
59
  import { cursorSeal } from "../store/cursor-seal.mjs";
62
60
  import { gitStore } from "../store/git-store.mjs";
63
- import { doorBucket, promisesBucket, promisesClock, promisesQueue, promisesStore } from "../store/promises.mjs";
61
+ import { doorBucket, doorLinks, doorUploads, promisesClock, promisesQueue, promisesStore } from "../store/promises.mjs";
64
62
  import { defaultFetchLimits } from "../storage/fetch.mjs";
65
- import { pushUploadUpkeep, signedUploadOf } from "../storage/push-uploads.mjs";
63
+ import { countedBucket } from "../storage/counted-bucket.mjs";
64
+ import { hostFailures, hostLinks, hostUploads } from "../storage/host-bucket.mjs";
65
+ import { pushUploadUpkeep } from "../storage/push-uploads.mjs";
66
66
  import { checkedLimits, countedMost, countedScope, lessBefore, noScope } from "../store/call-count.mjs";
67
67
  import { exitOn, noCall, syncIn, uncounted } from "../store/crossing.mjs";
68
68
  import { pruneFloor } from "../storage/rows.mjs";
@@ -149,6 +149,21 @@ const partsOnce = (loaded) => {
149
149
  lineDiff: (allot) => Effect.flatMap(parts, (one) => one.lineDiff(allot))
150
150
  };
151
151
  };
152
+ /** The deliveries a server runs: `setup.deliveries`, or the one of its `events`, or none. */
153
+ const deliveriesIn = (setup) => setup.deliveries ?? (setup.events === void 0 ? void 0 : deliveriesOf(setup.events));
154
+ /**
155
+ * `createGitServer`'s options onto the Layers that replace them, run once its wiring is built and
156
+ * before the seal, in one list: core's inputs first, then the features, `lfs` building
157
+ * `Lfs.layer()` and `pushes.upload` `Git.layerUploads`. 2c-3b deletes it, with `createGitServer`.
158
+ */
159
+ const bridged = /* @__PURE__ */ Effect.fnUntraced(function* (setup, services, registry) {
160
+ if (setup.lfs !== void 0) {
161
+ const claim = yield* registry.claim({ name: "lfs" });
162
+ yield* Effect.provideContext(lfsClaim(claim), services);
163
+ }
164
+ const upload = setup.pushes?.upload;
165
+ if (upload !== void 0 && Context.get(services, UploadsBase).staging !== void 0) yield* Effect.provideContext(attachUploads(upload), services);
166
+ });
152
167
  /** Git's own wiring over the adapter's services, as the runtime's build runs it. */
153
168
  const wireServer = (options, wiring) => {
154
169
  const { adapter, merges, optional, fetchLimits, reports, deciders, grants, extensions, run, guard, through, closing } = wiring;
@@ -156,8 +171,8 @@ const wireServer = (options, wiring) => {
156
171
  const queueOf = optional.queue;
157
172
  const { store, jobs } = adapter;
158
173
  const { clock, now } = clocksOf(adapter.clock);
159
- const lfsBucket = options.lfs === void 0 ? void 0 : adapter.bucket;
160
- if (options.lfs !== void 0 && lfsBucket === void 0) throw new TypeError("lfs() keeps its objects in the adapter's bucket: give the adapter a bucket");
174
+ const counted = adapter.bucket === void 0 ? void 0 : countedBucket(adapter.bucket);
175
+ if (options.lfs !== void 0 && counted === void 0) throw new TypeError("lfs() keeps its objects in the adapter's bucket: give the adapter a bucket");
161
176
  const callLimits = lessBefore(checkedLimits(adapter.callLimits, "The adapter's callLimits."));
162
177
  const opening = {
163
178
  store: gitStore(store),
@@ -170,19 +185,16 @@ const wireServer = (options, wiring) => {
170
185
  const objects = indexed ?? options.objects.open(opening);
171
186
  const sealed = indexed === void 0 ? new SealedObjects(objects) : SealedObjects.indexed(indexed);
172
187
  const cleanup = optional.tokens === void 0 ? void 0 : tokenCleanupJob(now);
173
- const delivery = options.events === void 0 ? void 0 : deliverJob({
188
+ const deliveries = deliveriesIn(options);
189
+ const delivery = deliveries === void 0 ? void 0 : deliverJobs({
174
190
  store,
175
191
  now,
176
- delivery: eventDelivery(options.events)
192
+ deliveries
177
193
  });
178
194
  const events = delivery?.log;
179
195
  const onFailure = events === void 0 ? void 0 : workFailed(events, now);
180
196
  const { registry } = extensions;
181
- const upkeep = upkeepsOf([
182
- ...lfsBucket === void 0 ? [] : [lfsUpkeep(lfsBucket)],
183
- ...adapter.bucket === void 0 ? [] : [pushUploadUpkeep(adapter.bucket)],
184
- registry.upkeep
185
- ]);
197
+ const upkeep = upkeepsOf([...counted === void 0 ? [] : [pushUploadUpkeep(counted, adapter.uploads)], registry.upkeep]);
186
198
  const index = objects.index === void 0 ? void 0 : indexJob({
187
199
  objects: sealed,
188
200
  now,
@@ -201,12 +213,12 @@ const wireServer = (options, wiring) => {
201
213
  });
202
214
  const { postReceive, preReceive } = options.hooks ?? {};
203
215
  const received = postReceive === void 0 ? void 0 : postReceiveJob(postReceive, onFailure);
204
- const refIndex = refIndexOf(options.access);
216
+ const refIndex = refIndexOf(options.access, registry.hiddenRefs);
205
217
  const rebuild = refIndex === void 0 ? void 0 : refIndexJob({ index: refIndex });
206
218
  const purge = purgeJob({
207
219
  now,
208
220
  fetchLimits,
209
- parts: lfsBucket === void 0 ? [] : [lfsPurge(lfsBucket)]
221
+ parts: [registry.purge]
210
222
  });
211
223
  const own = [
212
224
  listJob,
@@ -216,7 +228,7 @@ const wireServer = (options, wiring) => {
216
228
  if (index !== void 0) own.push(index);
217
229
  if (rebuild !== void 0) own.push(rebuild);
218
230
  if (cleanup !== void 0) own.push(cleanup);
219
- if (delivery !== void 0) own.push(delivery.definition);
231
+ if (delivery !== void 0) own.push(...delivery.definitions);
220
232
  if (received !== void 0) own.push(received.definition);
221
233
  const gits = registry.bridge("git");
222
234
  gits.knowJobs(own);
@@ -227,18 +239,10 @@ const wireServer = (options, wiring) => {
227
239
  grants
228
240
  };
229
241
  const authorize = authorizer(decides);
230
- const lfsCheck = lfsBucket === void 0 ? void 0 : {
231
- claim: "lfs",
232
- band: "post",
233
- handler: (input, updates) => pointerCheck(store)({
234
- updates,
235
- objects: input.objects
236
- })
237
- };
238
242
  const checks = {
239
243
  reports,
240
244
  added: () => registry.pushRules(),
241
- claimed: () => lfsCheck === void 0 ? registry.pushChecks() : [...registry.pushChecks(), lfsCheck].sort(byOrder)
245
+ claimed: () => registry.pushChecks()
242
246
  };
243
247
  if (preReceive !== void 0) checks.preReceive = preReceiveOf(preReceive);
244
248
  if (received !== void 0) checks.postReceiveJobRow = received.jobRow;
@@ -249,10 +253,16 @@ const wireServer = (options, wiring) => {
249
253
  grants
250
254
  });
251
255
  const repackRow = (at) => repackJobRow(repack, at);
256
+ registry.bindRows({
257
+ store,
258
+ fences,
259
+ repackJobRow: repackRow
260
+ });
252
261
  const parts = {
253
262
  store,
254
263
  jobs,
255
264
  fences,
265
+ hiddenRefs: registry.hiddenRefs,
256
266
  grants,
257
267
  checks,
258
268
  repackJobRow: repackRow,
@@ -268,7 +278,7 @@ const wireServer = (options, wiring) => {
268
278
  const decider = {
269
279
  check: authorize,
270
280
  audience: audienceOf(decides),
271
- ceiling: ({ caller, repo }) => accessOf(reports, grants, store, caller, repo),
281
+ ceiling: ({ caller, repo, internalId }) => accessOf(reports, grants, store, caller, repo, internalId),
272
282
  grantOf: grants.nameOf,
273
283
  grantAgain: ({ resolver, request }) => grantAgain(grants, reports, registry.grants(), resolver, request)
274
284
  };
@@ -307,7 +317,33 @@ const wireServer = (options, wiring) => {
307
317
  return Effect.void;
308
318
  })
309
319
  });
320
+ let lfsAttached;
321
+ const lfsBase = LfsBase.of({
322
+ needs,
323
+ bucket: counted,
324
+ links: adapter.links,
325
+ attach: (lfs) => Effect.suspend(() => {
326
+ if (lfsAttached !== void 0) return Effect.die(/* @__PURE__ */ new TypeError("The server has Git LFS: provide Lfs.layer once"));
327
+ lfsAttached = lfs;
328
+ return registry.addCheck(lfs.check);
329
+ })
330
+ });
331
+ const { uploads } = adapter;
332
+ const staging = counted === void 0 || uploads === void 0 ? void 0 : {
333
+ bucket: counted,
334
+ uploads
335
+ };
336
+ let uploadsAttached;
337
+ const uploadsBase = UploadsBase.of({
338
+ staging,
339
+ attach: (above) => Effect.suspend(() => {
340
+ if (staging === void 0 || uploadsAttached !== void 0) return Effect.die(/* @__PURE__ */ new TypeError("The server takes push uploads: provide Git.layerUploads once"));
341
+ uploadsAttached = pushUploads(needs, staging, above);
342
+ return Effect.void;
343
+ })
344
+ });
310
345
  if (queueHost !== void 0) {
346
+ registry.bridge("queue", "refs/queue/");
311
347
  const queueJobList = queueJobs(queueHost, onFailure);
312
348
  gits.knowJobs(queueJobList);
313
349
  jobs.register(...queueJobList);
@@ -336,7 +372,7 @@ const wireServer = (options, wiring) => {
336
372
  cleanup,
337
373
  events
338
374
  });
339
- const decided = Context.add(records, Authorize, decider).pipe(Context.add(Refs, Context.get(needs, Refs)), Context.add(Rules, wiring.rules), Context.add(Objects, objectsOverViews), Context.merge(callServices(needs)), Context.add(Events, { log: events }), Context.add(QueueBase, queueBase));
375
+ const decided = Context.add(records, Authorize, decider).pipe(Context.add(Refs, Context.get(needs, Refs)), Context.add(Rules, wiring.rules), Context.add(Objects, objectsOverViews), Context.merge(callServices(needs)), Context.add(Events, { log: events }), Context.add(QueueBase, queueBase), Context.add(LfsBase, lfsBase), Context.add(UploadsBase, uploadsBase));
340
376
  const withTokens = tokens === void 0 ? decided : Context.add(decided, Tokens, tokens);
341
377
  const streamed = streams === void 0 ? withTokens : Context.add(withTokens, EventStreams, { feed: streams.feed });
342
378
  const services = merges === void 0 ? streamed : Context.merge(streamed, merges);
@@ -359,7 +395,7 @@ const wireServer = (options, wiring) => {
359
395
  tags: over(tagCalls(bound)),
360
396
  files: over(fileCalls(bound)),
361
397
  merges: over(mergeCalls(bound)),
362
- lfs: over(lfsCalls(lfsBucket, bound))
398
+ lfs: over(lfsCalls(() => lfsAttached?.read, bound))
363
399
  };
364
400
  if (queueHost !== void 0) groups.queue = over(queueCalls(queueHost, bound));
365
401
  if (topicsHost !== void 0) groups.topics = over(topicCalls(topicsHost, bound));
@@ -399,10 +435,8 @@ const wireServer = (options, wiring) => {
399
435
  if (objects.pushObjectsMost !== void 0) httpOptions.pushObjectsMost = objects.pushObjectsMost;
400
436
  httpOptions.calls = boundOf(countedMost(objects) ?? callLimits);
401
437
  httpOptions.pushCalls = boundOf(callLimits);
402
- if (lfsBucket !== void 0) httpOptions.lfs = lfsService(needs, lfsBucket);
403
- const signed = adapter.bucket === void 0 ? void 0 : signedUploadOf(adapter.bucket);
404
- const above = options.pushes?.upload.above;
405
- if (signed !== void 0 && above !== void 0) httpOptions.uploads = pushUploads(needs, signed, above);
438
+ httpOptions.lfs = () => lfsAttached?.service;
439
+ httpOptions.uploads = () => uploadsAttached;
406
440
  const http = gitHttp(coreHttpParts(served, httpOptions));
407
441
  return {
408
442
  parts: served,
@@ -450,7 +484,8 @@ const openServer = (options, decidersOf, sealing) => {
450
484
  const setup = options;
451
485
  if (setup.signIn !== void 0 && setup.tokens === void 0) throw new TypeError("signIn mints tokens: pass tokens() too");
452
486
  if (setup.access !== void 0 && setup.objects.indexed !== true) throw new TypeError("access hides refs, which needs objects that follow them: pass packs()");
453
- if (setup.events !== void 0) checkDeliveryTimeout(eventDelivery(setup.events));
487
+ const deliveries = deliveriesIn(setup);
488
+ if (deliveries !== void 0) checkDeliveries(deliveries);
454
489
  const postReceive = setup.hooks?.postReceive;
455
490
  if (postReceive !== void 0) checkPostReceiveTimeout(postReceive);
456
491
  const queueOf = setup.queue === void 0 ? void 0 : queueOptions(setup.queue);
@@ -515,8 +550,10 @@ const openServer = (options, decidersOf, sealing) => {
515
550
  const adapter = {
516
551
  store: promisesStore(records, context, door),
517
552
  jobs: promisesQueue(queue, context, door),
518
- bucket: Option.isSome(bucket) ? promisesBucket(bucket.value, links, uploads, context, door) : void 0,
553
+ bucket: Option.isSome(bucket) ? doorBucket(hostFailures(bucket.value), context, door) : void 0,
519
554
  objectsBucket: Option.isSome(bucket) ? doorBucket(bucket.value, context, door) : void 0,
555
+ links: Option.isSome(links) ? doorLinks(hostLinks(links.value), context, door) : void 0,
556
+ uploads: Option.isSome(uploads) ? doorUploads(hostUploads(uploads.value), context, door) : void 0,
520
557
  clock: promisesClock(clock, context, door),
521
558
  callLimits
522
559
  };
@@ -545,6 +582,7 @@ const openServer = (options, decidersOf, sealing) => {
545
582
  for (const bind of extensions.binds) bind(made);
546
583
  return made;
547
584
  });
585
+ yield* bridged(setup, wired.services, extensions.registry);
548
586
  const register = (jobs) => adapter.jobs.register(...jobs);
549
587
  if (sealing === "build") {
550
588
  yield* Effect.sync(wired.checkSources);
@@ -670,9 +708,13 @@ const openServer = (options, decidersOf, sealing) => {
670
708
  hostCalls: callsOver((built) => built.hostCalls),
671
709
  effectHostCalls: aroundCalls(guardedCalls(lazyGroups(names, (group, name, args) => Effect.flatMap(wired, (built) => callOf(built.hostCalls, group, name)(...args))), through), withAudienceMemo),
672
710
  through,
673
- access: (caller, repo) => Effect.flatMap(wired, (built) => Context.get(built.services, Authorize).ceiling({
711
+ access: (caller, repo, internalId) => Effect.flatMap(wired, (built) => Context.get(built.services, Authorize).ceiling(internalId === void 0 ? {
674
712
  caller,
675
713
  repo
714
+ } : {
715
+ caller,
716
+ repo,
717
+ internalId
676
718
  })),
677
719
  grantAgain: (resolver, request) => Effect.flatMap(wired, (built) => Context.get(built.services, Authorize).grantAgain({
678
720
  resolver,
@@ -0,0 +1,14 @@
1
+ import "../contracts/push-uploads.mjs";
2
+ import { PushStaging } from "../http/push-uploads.mjs";
3
+ import * as Effect from "effect/Effect";
4
+ import * as Context from "effect/Context";
5
+ declare const UploadsBase_base: Context.ServiceClass<UploadsBase, "@ref0/git/server/UploadsBase", {
6
+ readonly staging: PushStaging | undefined;
7
+ readonly attach: (above: number) => Effect.Effect<void>;
8
+ }>;
9
+ /**
10
+ * What `Git.layer` gives `Git.layerUploads`: where push uploads stage, the adapter's bucket and
11
+ * its `BucketUploads` when it has both, and `attach`, once, before the seal.
12
+ */
13
+ export declare class UploadsBase extends /* @__PURE__ */ UploadsBase_base {}
14
+ export {};
@@ -0,0 +1,15 @@
1
+ import * as Effect from "effect/Effect";
2
+ import * as Context from "effect/Context";
3
+ // src/server/uploads.ts
4
+ /**
5
+ * What `Git.layer` gives `Git.layerUploads`: where push uploads stage, the adapter's bucket and
6
+ * its `BucketUploads` when it has both, and `attach`, once, before the seal.
7
+ */
8
+ var UploadsBase = class extends (/* @__PURE__ */ Context.Service()("@ref0/git/server/UploadsBase")) {};
9
+ /** Push uploads above `options.above` bytes, attached to the server's routes. */
10
+ const attachUploads = /* @__PURE__ */ Effect.fnUntraced(function* (options) {
11
+ const base = yield* UploadsBase;
12
+ if (base.staging === void 0) return yield* Effect.die(/* @__PURE__ */ new TypeError("Git.layerUploads stages packs in the adapter's bucket: give it BucketUploads"));
13
+ yield* base.attach(options.above);
14
+ });
15
+ export { UploadsBase, attachUploads };
@@ -4,7 +4,7 @@ import { Allotment, GitObject, ObjectHeader, ObjectHeadersInput, ObjectHeldInput
4
4
  import { GitError } from "../contracts/result.mjs";
5
5
  import { Listed } from "../contracts/store.mjs";
6
6
  import "../store/call-count.mjs";
7
- import { DeleteBatch, Multipart, Range, Stored } from "@ref0/infra";
7
+ import "@ref0/infra";
8
8
  import * as Effect from "effect/Effect";
9
9
  import "effect/Stream";
10
10
  import "effect/Scope";
@@ -26,11 +26,10 @@ export interface ObjectReads {
26
26
  readonly allotment: (listed: Listed, most: number, refusal: GitError) => Effect.Effect<Allotment, GitError>;
27
27
  }
28
28
  /**
29
- * A bucket call, its refusal as Git's error. Anything else it throws is `UNAVAILABLE`. One of the
30
- * two doors every call Git, and a package built on it, makes goes through, with `storeCall`: it
31
- * counts into the request and the `CallBudget` in scope, and never starts past either's bound
32
- * (Q799). `run` is handed the signal the fiber's interrupt aborts, which it passes to the bucket
33
- * call as `CallOptions.signal`, so an interrupt or a deadline stops the call's requests and its
34
- * store's retries.
29
+ * A call of a bucket service's, `Bucket`'s, `BucketLinks`' or `BucketUploads`', its failure as
30
+ * Git's error, as `bucketDo` maps one. One of the two doors every call Git, and a package built on
31
+ * it, makes goes through, with `storeCall`: it counts as one call into the request and the
32
+ * `CallBudget` in scope, and never starts past either's bound (Q799). An interrupt or a deadline
33
+ * interrupts `effect`, which stops the call's requests and its store's retries.
35
34
  */
36
- export declare const bucketCall: <A>(run: (signal: AbortSignal) => Promise<A>) => Effect.Effect<A, GitError>;
35
+ export declare const bucketCall: <A, E>(effect: Effect.Effect<A, E>) => Effect.Effect<A, GitError>;
@@ -301,14 +301,13 @@ const objectsFace = (objects) => {
301
301
  };
302
302
  };
303
303
  /**
304
- * A bucket call, its refusal as Git's error. Anything else it throws is `UNAVAILABLE`. One of the
305
- * two doors every call Git, and a package built on it, makes goes through, with `storeCall`: it
306
- * counts into the request and the `CallBudget` in scope, and never starts past either's bound
307
- * (Q799). `run` is handed the signal the fiber's interrupt aborts, which it passes to the bucket
308
- * call as `CallOptions.signal`, so an interrupt or a deadline stops the call's requests and its
309
- * store's retries.
310
- */
311
- const bucketCall = (run) => Effect.andThen(chargeCall("bucket"), bucketTry(run));
304
+ * A call of a bucket service's, `Bucket`'s, `BucketLinks`' or `BucketUploads`', its failure as
305
+ * Git's error, as `bucketDo` maps one. One of the two doors every call Git, and a package built on
306
+ * it, makes goes through, with `storeCall`: it counts as one call into the request and the
307
+ * `CallBudget` in scope, and never starts past either's bound (Q799). An interrupt or a deadline
308
+ * interrupts `effect`, which stops the call's requests and its store's retries.
309
+ */
310
+ const bucketCall = (effect) => Effect.andThen(chargeCall("bucket"), bucketDo(effect));
312
311
  /** What `bucketDo` answers a host bucket's own rejection with, as `bucketTry` always has. */
313
312
  const bucketFailed = "The bucket failed";
314
313
  /**
@@ -354,10 +353,10 @@ const bytesOf = (stream) => Stream.runCollect(stream).pipe(Effect.map(joined), E
354
353
  */
355
354
  const readWhole = (bucket, key, range) => bucketDo(bytesOf(bucket.read(key, range)));
356
355
  /**
357
- * Work on a bucket call already counted, its refusal as `bucketCall`'s: a body's reads, or a
358
- * promise put whose calls `promisePut` charged first. Never a call of its own. `run`
359
- * is handed the fiber's signal, as `bucketCall`'s is. One that fails after its request's deciding
360
- * commit, as `afterCommit` marks it, is `may-have-saved`, as a store call's is (#1462).
356
+ * Work on a bucket call already counted, its refusal as `bucketDo`'s: a body's reads. Never a
357
+ * call of its own. `run` is handed the signal the fiber's interrupt aborts. One that fails after
358
+ * its request's deciding commit, as `afterCommit` marks it, is `may-have-saved`, as a store
359
+ * call's is (#1462).
361
360
  */
362
361
  const bucketTry = (run) => Effect.flatMap(committedNow, (after) => tryClosing(closedOut(run), (cause) => {
363
362
  const error = isInfraError(cause) ? fromInfra(cause) : gitError("UNAVAILABLE", "The bucket failed", {
@@ -455,13 +454,14 @@ const counting = (multipart) => Effect.suspend(() => {
455
454
  * caller's context, or `undefined` when there's none, beside the cancel of the reader under it,
456
455
  * which ends the bucket's read even while the web stream's own reader holds it. Its first chunk is
457
456
  * read here, to tell a missing key from a found one, and handed on first. An interrupt as it opens
458
- * cancels it.
457
+ * cancels it without waiting for the bucket's answer, which ends the read once it comes.
459
458
  */
460
459
  const opened = (bucket, key, range) => Effect.flatMap(Effect.context(), (context) => {
461
460
  const missing = Stream.catchIf(bucket.read(key, range), (error) => Predicate.isTagged(error, "NotFound"), () => Stream.succeed(void 0));
462
461
  const reader = readableIn(missing, context).getReader();
463
462
  const cancel = Effect.promise(() => reader.cancel().catch(() => void 0));
464
- return bucketDo(tryClosing(closedOut(() => reader.read()), bucketError)).pipe(Effect.onInterrupt(() => cancel), Effect.flatMap((first) => {
463
+ const leaving = Effect.sync(() => void reader.cancel().catch(() => void 0));
464
+ return bucketDo(tryClosing(closedOut(() => reader.read()), bucketError)).pipe(Effect.onInterrupt(() => leaving), Effect.flatMap((first) => {
465
465
  const head = first.done ? void 0 : first.value;
466
466
  if (!first.done && head === void 0) return Effect.as(cancel, void 0);
467
467
  const body = new ReadableStream({
@@ -3,7 +3,7 @@ import { bucketDo } from "./calls.mjs";
3
3
  import { markerKey, markerPrefix, objectCollections } from "./layout.mjs";
4
4
  import { deletePackFiles } from "./quarantine.mjs";
5
5
  import { deleteStaged, receiveKey, stagedRow } from "./receive-steps.mjs";
6
- import { LeavingRow, QuarantineRow, StagedRow, decodeHeld, leavingKey, quarantineKey, quarantineRow, stagedKey } from "./rows.mjs";
6
+ import { QuarantineRow, StagedRow, decodeHeld, decodeLeft, quarantineKey, quarantineRow, stagedKey } from "./rows.mjs";
7
7
  import * as Effect from "effect/Effect";
8
8
  /**
9
9
  * Rows one read of clean-up's asks for. Each row is under 100 bytes as JSON, so a page stays under
@@ -38,21 +38,22 @@ const endStaged = /* @__PURE__ */ Effect.fnUntraced(function* (bucket, row) {
38
38
  return stagedKey(row.pack);
39
39
  });
40
40
  /**
41
- * A taken `leaving` row's pack: this repo's own marker first, then the bytes if no other marker is
42
- * left. Listing first would let two repos letting go at once each keep the pack for the other.
41
+ * A taken `leaving` or `cover` row's pack: this repo's own marker first, then the bytes if no other
42
+ * marker is left. Listing first would let two repos letting go at once each keep the pack for the
43
+ * other.
43
44
  */
44
- const endLeaving = /* @__PURE__ */ Effect.fnUntraced(function* (bucket, listed, pack) {
45
- yield* bucketDo(bucket.remove(markerKey(pack, listed.repo)));
46
- if ((yield* bucketDo(bucket.list(markerPrefix(pack), { limit: 1 }))).items.length === 0) yield* deletePackFiles(bucket, pack);
47
- return leavingKey(pack);
45
+ const endLeaving = /* @__PURE__ */ Effect.fnUntraced(function* (bucket, listed, row) {
46
+ yield* bucketDo(bucket.remove(markerKey(row.pack, listed.repo)));
47
+ if ((yield* bucketDo(bucket.list(markerPrefix(row.pack), { limit: 1 }))).items.length === 0) yield* deletePackFiles(bucket, row.pack);
48
+ return row.key;
48
49
  });
49
50
  const sooner = (one, other) => one === void 0 ? other : Math.min(one, other);
50
51
  /**
51
- * `collection`'s rows from its first, a page at a time, until `enough` holds of the rows with work,
52
- * which `isWork` picks, or none is left. Each step starts again from the first row, so no cursor
53
- * is kept: rows a step ends are gone from the next one's pages.
52
+ * `collection`'s rows from its first, a page at a time, each as `decode` reads it, until `enough`
53
+ * holds of the rows with work, which `isWork` picks, or none is left. Each step starts again from
54
+ * the first row, so no cursor is kept: rows a step ends are gone from the next one's pages.
54
55
  */
55
- const scan = /* @__PURE__ */ Effect.fnUntraced(function* (store, scope, collection, schema, isWork, enough) {
56
+ const scan = /* @__PURE__ */ Effect.fnUntraced(function* (store, scope, collection, decode, isWork, enough) {
56
57
  const work = [];
57
58
  let later;
58
59
  let held = false;
@@ -69,7 +70,7 @@ const scan = /* @__PURE__ */ Effect.fnUntraced(function* (store, scope, collecti
69
70
  })).results[0] ?? [];
70
71
  held ||= rows.length > 0;
71
72
  for (const row of rows) {
72
- const one = yield* decodeHeld(schema, row);
73
+ const one = yield* decode(row);
73
74
  if (isWork(one)) work.push(one);
74
75
  else later = sooner(later, one.value.removeAt);
75
76
  }
@@ -90,20 +91,40 @@ const scan = /* @__PURE__ */ Effect.fnUntraced(function* (store, scope, collecti
90
91
  }
91
92
  });
92
93
  /**
93
- * `git.repack`'s clean-up of a repo's `quarantine`, `leaving` and `staged` rows whose `removeAt` has
94
- * passed, as one step whose change the core commits:
94
+ * Of `covers`' packs, those with a `leaving` row in `scope`, read by id in one call. That row ends
95
+ * the same marker at its own `removeAt`, which an unlisting after the cover's add sets later than
96
+ * the cover's: taking the cover then would delete the marker before a fetch's grace ends.
97
+ */
98
+ const leavingOf = /* @__PURE__ */ Effect.fnUntraced(function* (store, scope, covers) {
99
+ if (covers.length === 0) return /* @__PURE__ */ new Set();
100
+ const reads = covers.map((row) => ({
101
+ collection: objectCollections.leaving,
102
+ id: row.pack
103
+ }));
104
+ const snapshot = yield* store.read({
105
+ scope,
106
+ reads
107
+ });
108
+ return new Set(covers.flatMap((row, index) => (snapshot.results[index]?.length ?? 0) > 0 ? [row.pack] : []));
109
+ });
110
+ /**
111
+ * `git.repack`'s clean-up of a repo's `quarantine`, `leaving`, `cover` and `staged` rows whose
112
+ * `removeAt` has passed, as one step whose change the core commits:
95
113
  * - an open `quarantine` row is committed abandoned first, so its writer's listing is refused;
96
114
  * - an abandoned one has its marker and bytes deleted, then its row, a `staged` row put for it;
97
115
  * - a `leaving` row is committed taken first, so a sync's or a fetch's listing is refused (#394),
98
116
  * unless the repo lists its pack: then it's deleted, since a fork's call that lost may add one
99
117
  * after another call listed the pack, and taking it would delete bytes the repo reads (#1490);
100
118
  * - a taken one deletes its own marker, then the bytes if no marker is left, then its row;
119
+ * - a `cover` row, a fork's try's for a marker its `leaving` row no longer held (#1582), is
120
+ * taken, deleted or ended just as a `leaving` row is, and deleted too while the pack has a
121
+ * `leaving` row, which ends the marker after a fetch's grace;
101
122
  * - a `staged` row has every key under its receive's prefix but its markers deleted, and its
102
123
  * pack's files unless it landed, then its row.
103
124
  * Bucket deletes come before the commit that drops their row, so a cut step leaves the row to do
104
125
  * them again. It reads each collection a page at a time, and stops once it has more than a batch
105
126
  * of one kind, so `more` holds; `due` is the earliest of the rows left only once it read them all.
106
- * `undefined` when the repo holds no row of the three kinds.
127
+ * `undefined` when the repo holds no row of the four kinds.
107
128
  */
108
129
  const cleanUp = /* @__PURE__ */ Effect.fnUntraced(function* (input) {
109
130
  const { store, bucket, listed, at } = input;
@@ -112,26 +133,34 @@ const cleanUp = /* @__PURE__ */ Effect.fnUntraced(function* (input) {
112
133
  const isAbandoned = (row) => row.value.state === "abandoned";
113
134
  const isTaken = (row) => row.value.taken === true;
114
135
  const pastBatch = (rows) => rows.length > 25;
115
- const quarantined = yield* scan(store, scope, objectCollections.quarantine, QuarantineRow, (row) => isAbandoned(row) || isDue(row), (work) => pastBatch(work.filter(isAbandoned)) || pastBatch(work.filter((row) => !isAbandoned(row))));
116
- const leaving = yield* scan(store, scope, objectCollections.leaving, LeavingRow, (row) => isTaken(row) || isDue(row), (work) => pastBatch(work.filter(isTaken)) || pastBatch(work.filter((row) => !isTaken(row))));
117
- const staged = yield* scan(store, scope, objectCollections.staged, StagedRow, isDue, pastBatch);
118
- if (!quarantined.held && !leaving.held && !staged.held) return void 0;
136
+ const scanLeft = (collection) => scan(store, scope, collection, decodeLeft, (row) => isTaken(row) || isDue(row), (work) => pastBatch(work.filter(isTaken)) || pastBatch(work.filter((row) => !isTaken(row))));
137
+ const quarantined = yield* scan(store, scope, objectCollections.quarantine, (row) => decodeHeld(QuarantineRow, row), (row) => isAbandoned(row) || isDue(row), (work) => pastBatch(work.filter(isAbandoned)) || pastBatch(work.filter((row) => !isAbandoned(row))));
138
+ const leaving = yield* scanLeft(objectCollections.leaving);
139
+ const covers = yield* scanLeft(objectCollections.cover);
140
+ const staged = yield* scan(store, scope, objectCollections.staged, (row) => decodeHeld(StagedRow, row), isDue, pastBatch);
141
+ const lefts = [leaving, covers];
142
+ if (!quarantined.held && !lefts.some((found) => found.held) && !staged.held) return void 0;
119
143
  const abandoned = quarantined.work.filter(isAbandoned);
120
144
  const toEnd = abandoned.slice(0, 25);
121
145
  const toAbandon = quarantined.work.filter((row) => !isAbandoned(row)).slice(0, 25);
122
- const taken = leaving.work.filter(isTaken);
123
- const toLeave = taken.slice(0, 25);
124
- const due = leaving.work.filter((row) => !isTaken(row)).slice(0, 25);
146
+ const taken = lefts.map((found) => found.work.filter(isTaken));
147
+ const toLeave = taken.flatMap((rows) => rows.slice(0, 25));
148
+ const dueOf = (found) => found.work.filter((row) => !isTaken(row)).slice(0, 25);
149
+ const due = lefts.flatMap(dueOf);
125
150
  const listedIds = new Set(listed.packs.map((pack) => pack.id));
126
- const toCancel = due.filter((row) => listedIds.has(row.pack));
127
- const toTake = due.filter((row) => !listedIds.has(row.pack));
151
+ const unlistedCovers = dueOf(covers).filter((row) => !listedIds.has(row.pack));
152
+ const leavingIds = yield* leavingOf(store, scope, unlistedCovers);
153
+ const isCovered = (row) => row.key.collection === objectCollections.cover && leavingIds.has(row.pack);
154
+ const isKept = (row) => listedIds.has(row.pack) || isCovered(row);
155
+ const toCancel = due.filter(isKept);
156
+ const toTake = due.filter((row) => !isKept(row));
128
157
  const toSweep = staged.work.slice(0, 25);
129
158
  const quarantineEnds = yield* Effect.forEach(toEnd, (row) => endQuarantine(bucket, listed, row.pack, at));
130
159
  const ended = [
131
160
  ...quarantineEnds.flatMap((end) => end.delete),
132
- ...yield* Effect.forEach(toLeave, (row) => endLeaving(bucket, listed, row.pack)),
161
+ ...yield* Effect.forEach(toLeave, (row) => endLeaving(bucket, listed, row)),
133
162
  ...yield* Effect.forEach(toSweep, (row) => endStaged(bucket, row)),
134
- ...toCancel.map((row) => leavingKey(row.pack))
163
+ ...toCancel.map((row) => row.key)
135
164
  ];
136
165
  const put = [
137
166
  ...toAbandon.map((row) => quarantineRow(row.pack, {
@@ -139,7 +168,7 @@ const cleanUp = /* @__PURE__ */ Effect.fnUntraced(function* (input) {
139
168
  state: "abandoned"
140
169
  })),
141
170
  ...toTake.map((row) => ({
142
- ...leavingKey(row.pack),
171
+ ...row.key,
143
172
  value: {
144
173
  ...row.value,
145
174
  taken: true
@@ -147,7 +176,7 @@ const cleanUp = /* @__PURE__ */ Effect.fnUntraced(function* (input) {
147
176
  })),
148
177
  ...quarantineEnds.map((end) => end.put)
149
178
  ];
150
- const more = toAbandon.length > 0 || abandoned.length > toEnd.length || due.length > 0 || taken.length > toLeave.length || staged.work.length > toSweep.length;
179
+ const more = toAbandon.length > 0 || abandoned.length > toEnd.length || due.length > 0 || taken.some((rows) => rows.length > 25) || staged.work.length > toSweep.length;
151
180
  const step = {
152
181
  change: {
153
182
  put,
@@ -155,10 +184,11 @@ const cleanUp = /* @__PURE__ */ Effect.fnUntraced(function* (input) {
155
184
  },
156
185
  more
157
186
  };
158
- const whole = quarantined.whole && leaving.whole && staged.whole;
187
+ const whole = quarantined.whole && lefts.every((found) => found.whole) && staged.whole;
159
188
  const later = [
160
189
  quarantined.later,
161
190
  leaving.later,
191
+ covers.later,
162
192
  staged.later
163
193
  ].reduce((soonest, one) => one === void 0 ? soonest : sooner(soonest, one), void 0);
164
194
  return !whole || later === void 0 ? step : {
@@ -25,4 +25,19 @@ const hostFailures = (bucket) => ({
25
25
  removeMany: (keys, options) => Effect.catchDefect(bucket.removeMany(keys, options), hostFailure),
26
26
  list: (prefix, page) => Effect.catchDefect(bucket.list(prefix, page), hostFailure)
27
27
  });
28
- export { hostFailures };
28
+ /** The host's links, each call's defect a failure, as `hostFailures` says. */
29
+ const hostLinks = (links) => ({
30
+ url: (key, options) => Effect.catchDefect(links.url(key, options), hostFailure),
31
+ putUrl: (key, options) => Effect.catchDefect(links.putUrl(key, options), hostFailure),
32
+ head: (key) => Effect.catchDefect(links.head(key), hostFailure)
33
+ });
34
+ /** The host's uploads, each call's defect a failure, as `hostFailures` says. */
35
+ const hostUploads = (uploads) => ({
36
+ maxParts: uploads.maxParts,
37
+ beginUpload: (key) => Effect.catchDefect(uploads.beginUpload(key), hostFailure),
38
+ uploadUrl: (key, options) => Effect.catchDefect(uploads.uploadUrl(key, options), hostFailure),
39
+ listParts: (key, upload) => Effect.catchDefect(uploads.listParts(key, upload), hostFailure),
40
+ completeUpload: (key, input) => Effect.catchDefect(uploads.completeUpload(key, input), hostFailure),
41
+ abortUpload: (key, upload) => Effect.catchDefect(uploads.abortUpload(key, upload), hostFailure)
42
+ });
43
+ export { hostFailures, hostLinks, hostUploads };
@@ -11,7 +11,7 @@ import "./index-layers.mjs";
11
11
  import "./layout.mjs";
12
12
  import "./memory-budget.mjs";
13
13
  import "./pack-order.mjs";
14
- import { Moment, Multipart, Row } from "@ref0/infra";
14
+ import { Moment, Row } from "@ref0/infra";
15
15
  import "effect/Schema";
16
16
  import "effect/Effect";
17
17
  import "effect/Option";
@@ -8,6 +8,11 @@ const objectCollections = {
8
8
  quarantine: "quarantine",
9
9
  /** A pack no list names any more, by its ID, kept until its bytes are cleaned: `LeavingRow`. */
10
10
  leaving: "leaving",
11
+ /**
12
+ * A fork's marker its reread found unheld, by its pack's ID and its try's, `<pack>.<try>`: a
13
+ * `LeavingRow` added after its `leaving` row was taken or ended, which clean-up ends as one (#1582).
14
+ */
15
+ cover: "cover",
11
16
  /** One object as a row, by its ID: every object `loose()` holds, and a small push's. */
12
17
  objects: "objects",
13
18
  /** A cruft pack, by its ID: when a prune pass found its objects unreached, `CruftRow`. */
@@ -6,5 +6,5 @@ import "../contracts/services.mjs";
6
6
  import "../contracts/store.mjs";
7
7
  import "./object-rows.mjs";
8
8
  import "./pack-reads.mjs";
9
- import { Key, Moment, PutOptions } from "@ref0/infra";
9
+ import { Key, Moment } from "@ref0/infra";
10
10
  import "effect/Effect";