@ref0/git 0.7.0 → 0.9.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 (245) hide show
  1. package/dist/access/private-refs.mjs +0 -2
  2. package/dist/auth/authorize.mjs +31 -24
  3. package/dist/auth/bridge.mjs +8 -8
  4. package/dist/auth/fences.d.mts +0 -1
  5. package/dist/auth/fences.mjs +1 -1
  6. package/dist/auth/grants.d.mts +0 -1
  7. package/dist/auth/grants.mjs +2 -2
  8. package/dist/auth/host-function.d.mts +1 -7
  9. package/dist/auth/host-function.mjs +38 -38
  10. package/dist/auth/identify.d.mts +0 -1
  11. package/dist/auth/identify.mjs +1 -1
  12. package/dist/auth/policy.d.mts +7 -4
  13. package/dist/auth/policy.mjs +13 -10
  14. package/dist/auth/token-rows.mjs +2 -5
  15. package/dist/auth/tokens-layer.d.mts +0 -2
  16. package/dist/auth/tokens-public.d.mts +3 -3
  17. package/dist/auth/tokens-public.mjs +4 -2
  18. package/dist/auth/tokens.d.mts +6 -1
  19. package/dist/auth/tokens.mjs +7 -1
  20. package/dist/client/client.d.mts +22 -15
  21. package/dist/client/client.mjs +31 -27
  22. package/dist/client/git-http.mjs +22 -5
  23. package/dist/client/local.mjs +1 -1
  24. package/dist/client/namespace.d.mts +2 -0
  25. package/dist/client/push-upload.d.mts +1 -0
  26. package/dist/client/push-upload.mjs +169 -2
  27. package/dist/client/remote-helper.mjs +2 -4
  28. package/dist/client/remote.mjs +37 -15
  29. package/dist/client/run-remote-helper.mjs +4 -4
  30. package/dist/client/transport.mjs +26 -19
  31. package/dist/contracts/actors.d.mts +57 -28
  32. package/dist/contracts/actors.mjs +38 -2
  33. package/dist/contracts/authorize.d.mts +21 -15
  34. package/dist/contracts/callers.mjs +40 -0
  35. package/dist/contracts/calls-spent.d.mts +2 -12
  36. package/dist/contracts/calls-spent.mjs +4 -5
  37. package/dist/contracts/client.d.mts +16 -9
  38. package/dist/contracts/events.d.mts +82 -14
  39. package/dist/contracts/events.mjs +35 -9
  40. package/dist/contracts/files.d.mts +42 -42
  41. package/dist/contracts/forks.d.mts +0 -24
  42. package/dist/contracts/git-hooks.d.mts +217 -0
  43. package/dist/contracts/git-hooks.mjs +3 -1
  44. package/dist/contracts/git.d.mts +13 -3
  45. package/dist/contracts/grants.d.mts +46 -27
  46. package/dist/contracts/lfs.d.mts +17 -4
  47. package/dist/contracts/merges.d.mts +7 -7
  48. package/dist/contracts/objects.d.mts +38 -4
  49. package/dist/contracts/opaque.mjs +19 -1
  50. package/dist/contracts/operations.d.mts +8 -1
  51. package/dist/contracts/operations.mjs +209 -0
  52. package/dist/contracts/queue.d.mts +6 -5
  53. package/dist/contracts/queue.mjs +9 -20
  54. package/dist/contracts/remote.d.mts +13 -4
  55. package/dist/contracts/remote.mjs +3 -3
  56. package/dist/contracts/repos.d.mts +11 -40
  57. package/dist/contracts/repos.mjs +11 -10
  58. package/dist/contracts/result.d.mts +28 -11
  59. package/dist/contracts/result.mjs +32 -2
  60. package/dist/contracts/rules.d.mts +706 -46
  61. package/dist/contracts/rules.mjs +81 -2
  62. package/dist/contracts/server.d.mts +5 -275
  63. package/dist/contracts/services.d.mts +0 -3
  64. package/dist/contracts/services.mjs +1 -3
  65. package/dist/contracts/signin.d.mts +2 -2
  66. package/dist/contracts/signin.mjs +4 -5
  67. package/dist/contracts/sync.d.mts +1 -4
  68. package/dist/contracts/tokens.d.mts +29 -17
  69. package/dist/contracts/tokens.mjs +14 -3
  70. package/dist/contracts/topics.d.mts +38 -11
  71. package/dist/contracts/topics.mjs +8 -2
  72. package/dist/core/access.d.mts +0 -2
  73. package/dist/core/access.mjs +15 -4
  74. package/dist/core/ancestry.mjs +5 -4
  75. package/dist/core/events/deliver.mjs +19 -1
  76. package/dist/core/forks.mjs +30 -11
  77. package/dist/core/hooks/groups.d.mts +0 -1
  78. package/dist/core/hooks/groups.mjs +8 -9
  79. package/dist/core/index-job.mjs +23 -1
  80. package/dist/core/index-lost.d.mts +11 -0
  81. package/dist/core/index-lost.mjs +55 -0
  82. package/dist/core/loose-tally.mjs +46 -0
  83. package/dist/core/objects/commit-writes.mjs +1 -1
  84. package/dist/core/objects/commits.mjs +10 -9
  85. package/dist/core/objects/merges.mjs +1 -1
  86. package/dist/core/objects/reading.mjs +28 -13
  87. package/dist/core/objects/trees.mjs +1 -1
  88. package/dist/core/objects/writing.mjs +1 -0
  89. package/dist/core/parts.d.mts +7 -0
  90. package/dist/core/promise.mjs +1 -15
  91. package/dist/core/publish.mjs +9 -5
  92. package/dist/core/purge.mjs +30 -12
  93. package/dist/core/push.mjs +39 -16
  94. package/dist/core/ref-view.mjs +14 -6
  95. package/dist/core/repack.mjs +54 -27
  96. package/dist/core/repo-info.mjs +8 -6
  97. package/dist/core/repos.mjs +1 -0
  98. package/dist/core/rules/check.mjs +10 -10
  99. package/dist/core/rules/context.d.mts +3 -1
  100. package/dist/core/rules/context.mjs +16 -13
  101. package/dist/core/rules/fetch.mjs +17 -23
  102. package/dist/core/tokens.mjs +2 -1
  103. package/dist/core/view.d.mts +10 -1
  104. package/dist/core/view.mjs +15 -6
  105. package/dist/effect.d.mts +3 -6
  106. package/dist/effect.mjs +3 -6
  107. package/dist/engine/commits.mjs +23 -50
  108. package/dist/engine/failures.d.mts +1 -2
  109. package/dist/engine/failures.mjs +1 -3
  110. package/dist/engine/merge-base-walk.mjs +57 -142
  111. package/dist/engine/merge-bases.mjs +9 -7
  112. package/dist/engine/merge.mjs +20 -17
  113. package/dist/engine/parts.d.mts +1 -0
  114. package/dist/engine/parts.mjs +1 -1
  115. package/dist/engine/walk.mjs +15 -11
  116. package/dist/extend.d.mts +1 -2
  117. package/dist/extend.mjs +1 -2
  118. package/dist/http/core-parts.mjs +18 -10
  119. package/dist/http/handler.mjs +11 -31
  120. package/dist/http/parts.d.mts +0 -1
  121. package/dist/index.d.mts +29 -22
  122. package/dist/index.mjs +5 -2
  123. package/dist/lfs/base.d.mts +6 -3
  124. package/dist/lfs/base.mjs +2 -1
  125. package/dist/lfs/layer.d.mts +4 -3
  126. package/dist/lfs/layer.mjs +23 -9
  127. package/dist/lfs/objects.mjs +93 -41
  128. package/dist/lfs/pointers.mjs +69 -18
  129. package/dist/lfs/purge.mjs +6 -2
  130. package/dist/lfs/rows.mjs +24 -7
  131. package/dist/lfs/service.d.mts +6 -3
  132. package/dist/lfs/service.mjs +8 -2
  133. package/dist/lfs/upkeep.mjs +47 -28
  134. package/dist/lfs/upload-most.mjs +47 -0
  135. package/dist/lfs/uploaded.mjs +59 -0
  136. package/dist/protocol/bytes/sha256-hasher.mjs +51 -0
  137. package/dist/protocol/bytes/streams.mjs +84 -2
  138. package/dist/protocol/bytes/text.mjs +6 -1
  139. package/dist/protocol/diff/read.d.mts +1 -0
  140. package/dist/protocol/diff/read.mjs +5 -2
  141. package/dist/protocol/objects/commit.d.mts +7 -0
  142. package/dist/protocol/objects/commit.mjs +5 -1
  143. package/dist/protocol/objects/fsck.mjs +6 -3
  144. package/dist/queue/advance.mjs +77 -18
  145. package/dist/queue/calls.mjs +4 -14
  146. package/dist/queue/host.d.mts +4 -0
  147. package/dist/queue/lanes.mjs +1 -1
  148. package/dist/queue/layer.mjs +4 -2
  149. package/dist/queue/limits.mjs +18 -2
  150. package/dist/queue/rows.mjs +10 -1
  151. package/dist/queue/schedule.mjs +1 -1
  152. package/dist/queue/search.mjs +3 -4
  153. package/dist/queue/trim.mjs +2 -2
  154. package/dist/rest/client-namespace.d.mts +2 -0
  155. package/dist/rest/client.d.mts +32 -8
  156. package/dist/rest/client.mjs +308 -382
  157. package/dist/rest/commits.d.mts +150 -150
  158. package/dist/rest/files.d.mts +18 -18
  159. package/dist/rest/forks.d.mts +77 -89
  160. package/dist/rest/handlers.mjs +2 -1
  161. package/dist/rest/listen.d.mts +8 -6
  162. package/dist/rest/listen.mjs +31 -75
  163. package/dist/rest/me.d.mts +2 -2
  164. package/dist/rest/merges.d.mts +7 -7
  165. package/dist/rest/refs.d.mts +27 -27
  166. package/dist/rest/repos.d.mts +40 -52
  167. package/dist/rest/tokens.d.mts +12 -12
  168. package/dist/rest/topics.d.mts +13 -13
  169. package/dist/rest/trees.d.mts +66 -66
  170. package/dist/rest/wire.d.mts +20 -2
  171. package/dist/rest/work.d.mts +39 -39
  172. package/dist/rest.d.mts +1 -7
  173. package/dist/rest.mjs +1 -5
  174. package/dist/server/git-layer.d.mts +10 -2
  175. package/dist/server/git-layer.mjs +29 -10
  176. package/dist/server/joined.d.mts +12 -6
  177. package/dist/server/joined.mjs +3 -2
  178. package/dist/server/registry.mjs +11 -5
  179. package/dist/server/server.d.mts +0 -1
  180. package/dist/server/server.mjs +42 -49
  181. package/dist/signin/context.d.mts +0 -1
  182. package/dist/signin/context.mjs +5 -9
  183. package/dist/storage/clean-up.mjs +3 -1
  184. package/dist/storage/fsck.mjs +12 -2
  185. package/dist/storage/graph-rebuild.mjs +262 -0
  186. package/dist/storage/index-bitmaps.mjs +16 -10
  187. package/dist/storage/index-build.mjs +160 -24
  188. package/dist/storage/index-graph.d.mts +1 -0
  189. package/dist/storage/index-graph.mjs +29 -5
  190. package/dist/storage/index-layers.d.mts +1 -0
  191. package/dist/storage/index-layers.mjs +5 -2
  192. package/dist/storage/index-reach.mjs +7 -5
  193. package/dist/storage/index-remap.mjs +5 -5
  194. package/dist/storage/index-visible.mjs +16 -5
  195. package/dist/storage/lfs-pointers.d.mts +5 -5
  196. package/dist/storage/lfs-pointers.mjs +37 -11
  197. package/dist/storage/links.mjs +3 -3
  198. package/dist/storage/loose.mjs +4 -1
  199. package/dist/storage/memory-budget.mjs +1 -1
  200. package/dist/storage/merge-fence.mjs +81 -19
  201. package/dist/storage/merge-most.mjs +1 -0
  202. package/dist/storage/merge-row.mjs +16 -4
  203. package/dist/storage/merge-stream.mjs +9 -6
  204. package/dist/storage/object-rows.mjs +17 -1
  205. package/dist/storage/pack-order.d.mts +1 -0
  206. package/dist/storage/pack-order.mjs +18 -1
  207. package/dist/storage/pack-receive.mjs +10 -6
  208. package/dist/storage/packs.mjs +58 -27
  209. package/dist/storage/prune-walk.mjs +5 -2
  210. package/dist/storage/prune.mjs +168 -70
  211. package/dist/storage/ready.d.mts +1 -1
  212. package/dist/storage/ready.mjs +12 -3
  213. package/dist/storage/receive-bounds.mjs +3 -2
  214. package/dist/storage/receive-state.mjs +1 -1
  215. package/dist/storage/repack-contained.mjs +22 -14
  216. package/dist/storage/repack.d.mts +1 -1
  217. package/dist/storage/repack.mjs +3 -2
  218. package/dist/storage/unpack.mjs +7 -0
  219. package/dist/storage/visible.mjs +3 -2
  220. package/dist/storage/walk.d.mts +1 -0
  221. package/dist/storage/walk.mjs +9 -5
  222. package/dist/storage/wants.mjs +17 -11
  223. package/dist/store/call-count.d.mts +31 -3
  224. package/dist/store/call-count.mjs +51 -20
  225. package/dist/store/errors.d.mts +7 -1
  226. package/dist/store/errors.mjs +7 -1
  227. package/dist/store/job-try.mjs +3 -1
  228. package/dist/store/records.mjs +26 -5
  229. package/dist/store/repo-record.mjs +36 -12
  230. package/dist/store/scopes.mjs +15 -2
  231. package/dist/sync/bound.d.mts +1 -1
  232. package/dist/sync/import.mjs +15 -3
  233. package/dist/sync/layer.d.mts +5 -1
  234. package/dist/sync/layer.mjs +11 -9
  235. package/dist/sync/mirror.mjs +1 -1
  236. package/dist/sync/step.mjs +15 -15
  237. package/dist/topics/advance.mjs +11 -10
  238. package/dist/topics/layer.mjs +1 -1
  239. package/dist/topics/members.mjs +38 -9
  240. package/package.json +3 -3
  241. package/dist/engine/merge-base-walk.d.mts +0 -3
  242. package/dist/server/routes.d.mts +0 -32
  243. package/dist/server/routes.mjs +0 -69
  244. package/dist/sync/bridge.d.mts +0 -6
  245. package/dist/sync/bridge.mjs +0 -29
@@ -40,6 +40,7 @@ var events_exports = /* @__PURE__ */ __exportAll({
40
40
  RepoIndexRefused: () => RepoIndexRefused,
41
41
  RepoJobFailed: () => RepoJobFailed,
42
42
  RepoMaintained: () => RepoMaintained,
43
+ RepoPruneRefused: () => RepoPruneRefused,
43
44
  RepoRenamed: () => RepoRenamed,
44
45
  RepoTokenEvent: () => RepoTokenEvent,
45
46
  RepoVisibilityChanged: () => RepoVisibilityChanged,
@@ -190,11 +191,12 @@ const BeforeAfter = /* @__PURE__ */ Schema.Struct({
190
191
  * Why a geometric merge left a pack out. A fenced pack is left as it is: it stays listed, its
191
192
  * objects read, clone and fetch as before, and nothing is lost. Upkeep never merges it again on its
192
193
  * own while it stays listed, and no prune pass rewrites it, since a pass reads its classes over the
193
- * packs out of the fence and keeps a fenced pack whole. So each reason names what the host can do:
194
+ * packs out of the fence and keeps a fenced pack whole. A fence for calls lifts on its own once a
195
+ * fresh try has more than the one that fenced it. So each reason names what the host can do:
194
196
  * - `open-past-try`: opening a merge of it alone, its choose, its quarantine and its walk's first
195
197
  * reads, takes more calls than a fresh merge try has, about 1.84M objects at R2's charges, fenced
196
- * before the merge reads anything. Raise the host's `callLimits`; a later merge takes the pack
197
- * only once it leaves the listing.
198
+ * before the merge reads anything. Raise the host's `callLimits`, and the next step merges the
199
+ * pack again; one still past the try is fenced again at its calls.
198
200
  * - `entry-past-try`: one of its entries takes more calls to resolve than a merge try has. As for
199
201
  * `open-past-try`.
200
202
  * - `resolve-past-try`: its longest delta chain could take more calls to resolve than a fresh
@@ -202,8 +204,9 @@ const BeforeAfter = /* @__PURE__ */ Schema.Struct({
202
204
  * `open-past-try`.
203
205
  * - `graph-length`: its `.graph` reads past the bytes its pack row records, or ends short of them.
204
206
  * - `graph-broken`: its `.graph` is missing or broken, or counts a commit past 4,096 parents, which
205
- * every write refuses. Nothing rebuilds a pack's `.graph` yet: for either `.graph` reason, the
206
- * pack keeps its file as it is.
207
+ * every write refuses. For either `.graph` reason, the next upkeep steps rebuild the file from the
208
+ * pack's commits, a part each step, and then the pack merges again. One whose commits can't be
209
+ * read stays fenced, and no step rebuilds it again.
207
210
  * - `packs-past-most`: the merge would write more than `mergePacksMost` packs, about 418, and this
208
211
  * pack held the step that reached them. A prune that keeps deltas whose bases it drops writes them
209
212
  * whole, so each pack fills a try's calls after a few dozen. The host can do nothing for it yet:
@@ -265,8 +268,31 @@ const RepoIndexRefused = /* @__PURE__ */ Schema.Struct({
265
268
  refused: IndexRefusal,
266
269
  error: Schema.String
267
270
  });
268
- /** `repo.work.failed`: a job's last try failed, or a round of index builds was refused. */
269
- const RepoWorkFailed = /* @__PURE__ */ Schema.Union([RepoJobFailed, RepoIndexRefused]);
271
+ /**
272
+ * The repo's prune pass has waited `periods` prune periods in a row, each because pushes moved its
273
+ * refs onto what its rewrite was about to drop: the repo's unreachable objects stay until a period
274
+ * quiet enough for a pass to end. Sent once the pass has waited `prunePeriodsMost` periods, then
275
+ * once each further one, in the commit that writes the wait, and no more once a pass ends. No job
276
+ * is failed, so there is nothing to retry or discard. `error` says why, in the core's words.
277
+ */
278
+ const RepoPruneRefused = /* @__PURE__ */ Schema.Struct({
279
+ ...RepoEnvelope.fields,
280
+ type: Schema.Literal("repo.work.failed"),
281
+ name: Schema.Literal("git.repack"),
282
+ key: Schema.Literal("prune"),
283
+ refused: Schema.Literal("busy"),
284
+ periods: Schema.Int,
285
+ error: Schema.String
286
+ });
287
+ /**
288
+ * `repo.work.failed`: a job's last try failed, a round of index builds was refused, or pushes kept
289
+ * the prune pass from ending.
290
+ */
291
+ const RepoWorkFailed = /* @__PURE__ */ Schema.Union([
292
+ RepoJobFailed,
293
+ RepoIndexRefused,
294
+ RepoPruneRefused
295
+ ]);
270
296
  const RepoEvent = /* @__PURE__ */ Schema.Union([
271
297
  RepoCreated,
272
298
  RepoDeletedEvent,
@@ -314,7 +340,7 @@ const EntryMerged = /* @__PURE__ */ Schema.Struct({
314
340
  candidate: CandidateId,
315
341
  commit: Oid
316
342
  });
317
- /** `error`: for `host-error`, the failure's ID, which `onError` got too. */
343
+ /** `error`: for `host-error`, the failure's ID, which the host's log line names too. */
318
344
  const EntryFailed = /* @__PURE__ */ Schema.Struct({
319
345
  ...RepoEnvelope.fields,
320
346
  summary: ReportDetails.fields.summary,
@@ -502,4 +528,4 @@ const keepsEvents = (log) => log !== void 0 && log.deliveries.length > 0;
502
528
  * `layer`; a repo's feed is `EventStreams`'.
503
529
  */
504
530
  var Events = class extends (/* @__PURE__ */ Context.Service()("@ref0/git/Events")) {};
505
- export { BeforeAfter, CandidateClosed, CandidateClosedFields, CandidateOpened, CandidateReported, EntryAdded, EntryFailed, EntryMerged, EntryPinned, EntryRemoved, EntryRetried, EventEnvelope, Events, FenceReason, FencedPack, HoldEvent, HoldEventFields, IndexRefusal, QueueEvent, QueueRestarted, RefPush, RefUpdated, RepoCreated, RepoDeletedEvent, RepoEnvelope, RepoEvent, RepoIndexRefused, RepoJobFailed, RepoMaintained, RepoRenamed, RepoTokenEvent, RepoVisibilityChanged, RepoWorkFailed, TokenEvent, TokenEventFields, TopicAdded, TopicEnvelope, TopicEvent, TopicFailed, TopicMerged, TopicOpened, TopicRemoved, TopicReported, TopicWorkFailed, events_exports, keepsEvents };
531
+ export { BeforeAfter, CandidateClosed, CandidateClosedFields, CandidateOpened, CandidateReported, EntryAdded, EntryFailed, EntryMerged, EntryPinned, EntryRemoved, EntryRetried, EventEnvelope, Events, FenceReason, FencedPack, HoldEvent, HoldEventFields, IndexRefusal, QueueEvent, QueueRestarted, RefPush, RefUpdated, RepoCreated, RepoDeletedEvent, RepoEnvelope, RepoEvent, RepoIndexRefused, RepoJobFailed, RepoMaintained, RepoPruneRefused, RepoRenamed, RepoTokenEvent, RepoVisibilityChanged, RepoWorkFailed, TokenEvent, TokenEventFields, TopicAdded, TopicEnvelope, TopicEvent, TopicFailed, TopicMerged, TopicOpened, TopicRemoved, TopicReported, TopicWorkFailed, events_exports, keepsEvents };
@@ -60,11 +60,11 @@ export type FilesList = typeof FilesList.Type;
60
60
  export interface FilesListInput extends ReadPage, FilesList {}
61
61
  /** A diff's files, only those at or under `paths` when given, as a patch or as hunks. */
62
62
  export declare const FilesDiff: Schema.Struct<{
63
- readonly paths: Schema.optionalKey<Schema.$Array<Schema.String>>;
64
- readonly format: Schema.optionalKey<Schema.Literals<readonly ["patch", "hunks"]>>;
65
63
  readonly base: Schema.String;
66
64
  readonly head: Schema.String;
67
65
  readonly renames: Schema.optionalKey<Schema.Boolean>;
66
+ readonly paths: Schema.optionalKey<Schema.$Array<Schema.String>>;
67
+ readonly format: Schema.optionalKey<Schema.Literals<readonly ["patch", "hunks"]>>;
68
68
  }>;
69
69
  export type FilesDiff = typeof FilesDiff.Type;
70
70
  export interface FilesDiffInput extends ReadPage, FilesDiff {}
@@ -97,7 +97,6 @@ export type Hunk = typeof Hunk.Type;
97
97
  * decodes with replacements.
98
98
  */
99
99
  export declare const FileDiff: Schema.Union<readonly [Schema.Struct<{
100
- readonly patch: Schema.String;
101
100
  readonly status: Schema.Literals<readonly ["A", "D", "M", "R", "T"]>;
102
101
  readonly path: Schema.String;
103
102
  readonly from: Schema.optionalKey<Schema.String>;
@@ -116,20 +115,8 @@ export declare const FileDiff: Schema.Union<readonly [Schema.Struct<{
116
115
  readonly added: Schema.Int;
117
116
  readonly deleted: Schema.Int;
118
117
  }>, Schema.Literal<"binary">]>;
118
+ readonly patch: Schema.String;
119
119
  }>, Schema.Struct<{
120
- readonly hunks: Schema.$Array<Schema.Struct<{
121
- readonly oldStart: Schema.Int;
122
- readonly oldLines: Schema.Int;
123
- readonly newStart: Schema.Int;
124
- readonly newLines: Schema.Int;
125
- /** The hunk header's function context, after `@@ ... @@ `: empty when there's none. */
126
- readonly context: Schema.String;
127
- readonly lines: Schema.$Array<Schema.Struct<{
128
- readonly kind: Schema.Literals<readonly ["context", "add", "delete"]>;
129
- readonly text: Schema.String;
130
- readonly noNewline: Schema.optionalKey<Schema.Literal<true>>;
131
- }>>;
132
- }>>;
133
120
  readonly status: Schema.Literals<readonly ["A", "D", "M", "R", "T"]>;
134
121
  readonly path: Schema.String;
135
122
  readonly from: Schema.optionalKey<Schema.String>;
@@ -148,6 +135,19 @@ export declare const FileDiff: Schema.Union<readonly [Schema.Struct<{
148
135
  readonly added: Schema.Int;
149
136
  readonly deleted: Schema.Int;
150
137
  }>, Schema.Literal<"binary">]>;
138
+ readonly hunks: Schema.$Array<Schema.Struct<{
139
+ readonly oldStart: Schema.Int;
140
+ readonly oldLines: Schema.Int;
141
+ readonly newStart: Schema.Int;
142
+ readonly newLines: Schema.Int;
143
+ /** The hunk header's function context, after `@@ ... @@ `: empty when there's none. */
144
+ readonly context: Schema.String;
145
+ readonly lines: Schema.$Array<Schema.Struct<{
146
+ readonly kind: Schema.Literals<readonly ["context", "add", "delete"]>;
147
+ readonly text: Schema.String;
148
+ readonly noNewline: Schema.optionalKey<Schema.Literal<true>>;
149
+ }>>;
150
+ }>>;
151
151
  }>]>;
152
152
  export type FileDiff = typeof FileDiff.Type;
153
153
  export interface FileCalls {
@@ -186,7 +186,6 @@ declare const Files_base: Context.ServiceClass<Files, "@ref0/git/Files", EffectC
186
186
  readonly pathBytes?: Uint8Array<ArrayBufferLike>;
187
187
  }>>>;
188
188
  readonly diff: (repo: string, input: Acting<FilesDiffInput>, by?: Caller<unknown> | undefined) => Promise<Result<DiffListing<{
189
- readonly patch: string;
190
189
  readonly status: "A" | "D" | "M" | "R" | "T";
191
190
  readonly path: string;
192
191
  readonly from?: string;
@@ -205,19 +204,8 @@ declare const Files_base: Context.ServiceClass<Files, "@ref0/git/Files", EffectC
205
204
  readonly added: number;
206
205
  readonly deleted: number;
207
206
  };
207
+ readonly patch: string;
208
208
  } | {
209
- readonly hunks: readonly {
210
- readonly oldStart: number;
211
- readonly oldLines: number;
212
- readonly newStart: number;
213
- readonly newLines: number;
214
- readonly context: string;
215
- readonly lines: readonly {
216
- readonly kind: "add" | "context" | "delete";
217
- readonly text: string;
218
- readonly noNewline?: true;
219
- }[];
220
- }[];
221
209
  readonly status: "A" | "D" | "M" | "R" | "T";
222
210
  readonly path: string;
223
211
  readonly from?: string;
@@ -236,6 +224,18 @@ declare const Files_base: Context.ServiceClass<Files, "@ref0/git/Files", EffectC
236
224
  readonly added: number;
237
225
  readonly deleted: number;
238
226
  };
227
+ readonly hunks: readonly {
228
+ readonly oldStart: number;
229
+ readonly oldLines: number;
230
+ readonly newStart: number;
231
+ readonly newLines: number;
232
+ readonly context: string;
233
+ readonly lines: readonly {
234
+ readonly kind: "add" | "context" | "delete";
235
+ readonly text: string;
236
+ readonly noNewline?: true;
237
+ }[];
238
+ }[];
239
239
  }>>>;
240
240
  }, never>>;
241
241
  /**
@@ -266,7 +266,6 @@ export declare const list: (repo: RepoName, input: Acting<FilesListInput>, by?:
266
266
  readonly pathBytes?: Uint8Array<ArrayBufferLike>;
267
267
  }>, GitError, Files>;
268
268
  export declare const diff: (repo: RepoName, input: Acting<FilesDiffInput>, by?: Caller) => Effect.Effect<DiffListing<{
269
- readonly patch: string;
270
269
  readonly status: "A" | "D" | "M" | "R" | "T";
271
270
  readonly path: string;
272
271
  readonly from?: string;
@@ -285,19 +284,8 @@ export declare const diff: (repo: RepoName, input: Acting<FilesDiffInput>, by?:
285
284
  readonly added: number;
286
285
  readonly deleted: number;
287
286
  };
287
+ readonly patch: string;
288
288
  } | {
289
- readonly hunks: readonly {
290
- readonly oldStart: number;
291
- readonly oldLines: number;
292
- readonly newStart: number;
293
- readonly newLines: number;
294
- readonly context: string;
295
- readonly lines: readonly {
296
- readonly kind: "add" | "context" | "delete";
297
- readonly text: string;
298
- readonly noNewline?: true;
299
- }[];
300
- }[];
301
289
  readonly status: "A" | "D" | "M" | "R" | "T";
302
290
  readonly path: string;
303
291
  readonly from?: string;
@@ -316,5 +304,17 @@ export declare const diff: (repo: RepoName, input: Acting<FilesDiffInput>, by?:
316
304
  readonly added: number;
317
305
  readonly deleted: number;
318
306
  };
307
+ readonly hunks: readonly {
308
+ readonly oldStart: number;
309
+ readonly oldLines: number;
310
+ readonly newStart: number;
311
+ readonly newLines: number;
312
+ readonly context: string;
313
+ readonly lines: readonly {
314
+ readonly kind: "add" | "context" | "delete";
315
+ readonly text: string;
316
+ readonly noNewline?: true;
317
+ }[];
318
+ }[];
319
319
  }>, GitError, Files>;
320
320
  export { files_d_exports };
@@ -105,9 +105,6 @@ declare const Forks_base: Context.ServiceClass<Forks, "@ref0/git/Forks", EffectC
105
105
  readonly packs?: number;
106
106
  readonly packBytes?: number;
107
107
  readonly ownBytes?: number;
108
- readonly looseObjects?: number;
109
- readonly looseBytes?: number;
110
- readonly leavingBytes?: number;
111
108
  readonly pushedAt?: number;
112
109
  readonly maintainedAt?: number;
113
110
  };
@@ -135,9 +132,6 @@ declare const Forks_base: Context.ServiceClass<Forks, "@ref0/git/Forks", EffectC
135
132
  readonly packs?: number;
136
133
  readonly packBytes?: number;
137
134
  readonly ownBytes?: number;
138
- readonly looseObjects?: number;
139
- readonly looseBytes?: number;
140
- readonly leavingBytes?: number;
141
135
  readonly pushedAt?: number;
142
136
  readonly maintainedAt?: number;
143
137
  };
@@ -165,9 +159,6 @@ declare const Forks_base: Context.ServiceClass<Forks, "@ref0/git/Forks", EffectC
165
159
  readonly packs?: number;
166
160
  readonly packBytes?: number;
167
161
  readonly ownBytes?: number;
168
- readonly looseObjects?: number;
169
- readonly looseBytes?: number;
170
- readonly leavingBytes?: number;
171
162
  readonly pushedAt?: number;
172
163
  readonly maintainedAt?: number;
173
164
  };
@@ -195,9 +186,6 @@ declare const Forks_base: Context.ServiceClass<Forks, "@ref0/git/Forks", EffectC
195
186
  readonly packs?: number;
196
187
  readonly packBytes?: number;
197
188
  readonly ownBytes?: number;
198
- readonly looseObjects?: number;
199
- readonly looseBytes?: number;
200
- readonly leavingBytes?: number;
201
189
  readonly pushedAt?: number;
202
190
  readonly maintainedAt?: number;
203
191
  };
@@ -239,9 +227,6 @@ export declare const create: (repo: RepoName, input: ForkCreateInput, by?: Calle
239
227
  readonly packs?: number;
240
228
  readonly packBytes?: number;
241
229
  readonly ownBytes?: number;
242
- readonly looseObjects?: number;
243
- readonly looseBytes?: number;
244
- readonly leavingBytes?: number;
245
230
  readonly pushedAt?: number;
246
231
  readonly maintainedAt?: number;
247
232
  };
@@ -269,9 +254,6 @@ export declare const get: (repo: RepoName, input: ForkGetInput, by?: Caller) =>
269
254
  readonly packs?: number;
270
255
  readonly packBytes?: number;
271
256
  readonly ownBytes?: number;
272
- readonly looseObjects?: number;
273
- readonly looseBytes?: number;
274
- readonly leavingBytes?: number;
275
257
  readonly pushedAt?: number;
276
258
  readonly maintainedAt?: number;
277
259
  };
@@ -299,9 +281,6 @@ export declare const list: (repo: RepoName, input: ForkListInput, by?: Caller) =
299
281
  readonly packs?: number;
300
282
  readonly packBytes?: number;
301
283
  readonly ownBytes?: number;
302
- readonly looseObjects?: number;
303
- readonly looseBytes?: number;
304
- readonly leavingBytes?: number;
305
284
  readonly pushedAt?: number;
306
285
  readonly maintainedAt?: number;
307
286
  };
@@ -329,9 +308,6 @@ export declare const sync: (fork: RepoName, input: WriteInput & Pick<RepoInput,
329
308
  readonly packs?: number;
330
309
  readonly packBytes?: number;
331
310
  readonly ownBytes?: number;
332
- readonly looseObjects?: number;
333
- readonly looseBytes?: number;
334
- readonly leavingBytes?: number;
335
311
  readonly pushedAt?: number;
336
312
  readonly maintainedAt?: number;
337
313
  };
@@ -2,6 +2,7 @@ import { Duration } from "./promises.mjs";
2
2
  import { DecisionAnswer, GitError } from "./result.mjs";
3
3
  import { PushContext } from "./rules.mjs";
4
4
  import * as Effect from "effect/Effect";
5
+ import * as Schema from "effect/Schema";
5
6
  /** A point core calls a host's hook group at: `push.check`, the whole push, after every per-ref check. */
6
7
  export type HookPoint = 'push.check';
7
8
  /**
@@ -12,6 +13,222 @@ export type HookPoint = 'push.check';
12
13
  export type PushHookInput = PushContext & {
13
14
  readonly atomic: boolean;
14
15
  };
16
+ /** A `PushHookInput`, with `PushContext`'s request, Effect and Stream held as themselves. */
17
+ export declare const PushHookInput: Schema.Union<readonly [Schema.Struct<{
18
+ readonly at: Schema.optionalKey<Schema.Never>;
19
+ readonly actor: Schema.Union<readonly [Schema.Struct<{
20
+ readonly id: Schema.String;
21
+ readonly anonymous: Schema.optionalKey<Schema.Literal<false>>;
22
+ readonly meta: Schema.optionalKey<Schema.Unknown>;
23
+ }>, Schema.Struct<{
24
+ readonly anonymous: Schema.Literal<true>;
25
+ readonly meta: Schema.optionalKey<Schema.Unknown>;
26
+ }>]>;
27
+ } & {
28
+ readonly repo: Schema.String;
29
+ readonly subject: Schema.optionalKey<Schema.Struct<{
30
+ readonly id: Schema.String;
31
+ }>>;
32
+ readonly source: Schema.Literals<readonly ["git", "api", "queue", "import"]>;
33
+ readonly push: Schema.Struct<{
34
+ readonly bytes: Schema.Number;
35
+ readonly objects: Schema.Number;
36
+ readonly updates: Schema.mutable<Schema.$Array<Schema.Struct<{
37
+ readonly ref: Schema.String;
38
+ readonly from: Schema.NullOr<Schema.String>;
39
+ readonly to: Schema.NullOr<Schema.String>;
40
+ readonly kind: Schema.Literals<readonly ["create", "fast-forward", "force", "delete"]>;
41
+ }>>>;
42
+ }>;
43
+ readonly stats: Schema.Struct<{
44
+ readonly repo: Schema.String;
45
+ readonly refs: Schema.Number;
46
+ readonly packs: Schema.Number;
47
+ readonly packBytes: Schema.Number;
48
+ readonly ownBytes: Schema.Number;
49
+ readonly pushedAt: Schema.optionalKey<Schema.Number>;
50
+ readonly maintainedAt: Schema.optionalKey<Schema.Number>;
51
+ }>;
52
+ readonly request: Schema.optionalKey<Schema.declare<Request, Request>>;
53
+ readonly pushOptions: Schema.optionalKey<Schema.$Array<Schema.String>>;
54
+ readonly changes: Schema.declare<Effect.Effect<readonly {
55
+ readonly status: "A" | "D" | "M" | "R" | "T";
56
+ readonly path: string;
57
+ readonly from?: string;
58
+ readonly similarity?: number;
59
+ readonly old?: {
60
+ readonly mode: string;
61
+ readonly oid: string;
62
+ };
63
+ readonly new?: {
64
+ readonly mode: string;
65
+ readonly oid: string;
66
+ };
67
+ readonly pathBytes?: Uint8Array<ArrayBufferLike>;
68
+ readonly fromPathBytes?: Uint8Array<ArrayBufferLike>;
69
+ }[], GitError, never>, Effect.Effect<readonly {
70
+ readonly status: "A" | "D" | "M" | "R" | "T";
71
+ readonly path: string;
72
+ readonly from?: string;
73
+ readonly similarity?: number;
74
+ readonly old?: {
75
+ readonly mode: string;
76
+ readonly oid: string;
77
+ };
78
+ readonly new?: {
79
+ readonly mode: string;
80
+ readonly oid: string;
81
+ };
82
+ readonly pathBytes?: Uint8Array<ArrayBufferLike>;
83
+ readonly fromPathBytes?: Uint8Array<ArrayBufferLike>;
84
+ }[], GitError, never>>;
85
+ readonly commitChanges: Schema.declare<import("effect/Stream").Stream<{
86
+ readonly commit: string;
87
+ readonly root: boolean;
88
+ readonly change: {
89
+ readonly status: "A" | "D" | "M" | "R" | "T";
90
+ readonly path: string;
91
+ readonly from?: string;
92
+ readonly similarity?: number;
93
+ readonly old?: {
94
+ readonly mode: string;
95
+ readonly oid: string;
96
+ };
97
+ readonly new?: {
98
+ readonly mode: string;
99
+ readonly oid: string;
100
+ };
101
+ readonly pathBytes?: Uint8Array<ArrayBufferLike>;
102
+ readonly fromPathBytes?: Uint8Array<ArrayBufferLike>;
103
+ };
104
+ }, GitError, never>, import("effect/Stream").Stream<{
105
+ readonly commit: string;
106
+ readonly root: boolean;
107
+ readonly change: {
108
+ readonly status: "A" | "D" | "M" | "R" | "T";
109
+ readonly path: string;
110
+ readonly from?: string;
111
+ readonly similarity?: number;
112
+ readonly old?: {
113
+ readonly mode: string;
114
+ readonly oid: string;
115
+ };
116
+ readonly new?: {
117
+ readonly mode: string;
118
+ readonly oid: string;
119
+ };
120
+ readonly pathBytes?: Uint8Array<ArrayBufferLike>;
121
+ readonly fromPathBytes?: Uint8Array<ArrayBufferLike>;
122
+ };
123
+ }, GitError, never>>;
124
+ } & {
125
+ readonly atomic: Schema.Boolean;
126
+ }>, Schema.Struct<{
127
+ readonly at: Schema.Literal<"queued">;
128
+ readonly actor: Schema.Struct<{
129
+ readonly id: Schema.String;
130
+ readonly anonymous: Schema.optionalKey<Schema.Literal<false>>;
131
+ }>;
132
+ } & {
133
+ readonly repo: Schema.String;
134
+ readonly subject: Schema.optionalKey<Schema.Struct<{
135
+ readonly id: Schema.String;
136
+ }>>;
137
+ readonly source: Schema.Literals<readonly ["git", "api", "queue", "import"]>;
138
+ readonly push: Schema.Struct<{
139
+ readonly bytes: Schema.Number;
140
+ readonly objects: Schema.Number;
141
+ readonly updates: Schema.mutable<Schema.$Array<Schema.Struct<{
142
+ readonly ref: Schema.String;
143
+ readonly from: Schema.NullOr<Schema.String>;
144
+ readonly to: Schema.NullOr<Schema.String>;
145
+ readonly kind: Schema.Literals<readonly ["create", "fast-forward", "force", "delete"]>;
146
+ }>>>;
147
+ }>;
148
+ readonly stats: Schema.Struct<{
149
+ readonly repo: Schema.String;
150
+ readonly refs: Schema.Number;
151
+ readonly packs: Schema.Number;
152
+ readonly packBytes: Schema.Number;
153
+ readonly ownBytes: Schema.Number;
154
+ readonly pushedAt: Schema.optionalKey<Schema.Number>;
155
+ readonly maintainedAt: Schema.optionalKey<Schema.Number>;
156
+ }>;
157
+ readonly request: Schema.optionalKey<Schema.declare<Request, Request>>;
158
+ readonly pushOptions: Schema.optionalKey<Schema.$Array<Schema.String>>;
159
+ readonly changes: Schema.declare<Effect.Effect<readonly {
160
+ readonly status: "A" | "D" | "M" | "R" | "T";
161
+ readonly path: string;
162
+ readonly from?: string;
163
+ readonly similarity?: number;
164
+ readonly old?: {
165
+ readonly mode: string;
166
+ readonly oid: string;
167
+ };
168
+ readonly new?: {
169
+ readonly mode: string;
170
+ readonly oid: string;
171
+ };
172
+ readonly pathBytes?: Uint8Array<ArrayBufferLike>;
173
+ readonly fromPathBytes?: Uint8Array<ArrayBufferLike>;
174
+ }[], GitError, never>, Effect.Effect<readonly {
175
+ readonly status: "A" | "D" | "M" | "R" | "T";
176
+ readonly path: string;
177
+ readonly from?: string;
178
+ readonly similarity?: number;
179
+ readonly old?: {
180
+ readonly mode: string;
181
+ readonly oid: string;
182
+ };
183
+ readonly new?: {
184
+ readonly mode: string;
185
+ readonly oid: string;
186
+ };
187
+ readonly pathBytes?: Uint8Array<ArrayBufferLike>;
188
+ readonly fromPathBytes?: Uint8Array<ArrayBufferLike>;
189
+ }[], GitError, never>>;
190
+ readonly commitChanges: Schema.declare<import("effect/Stream").Stream<{
191
+ readonly commit: string;
192
+ readonly root: boolean;
193
+ readonly change: {
194
+ readonly status: "A" | "D" | "M" | "R" | "T";
195
+ readonly path: string;
196
+ readonly from?: string;
197
+ readonly similarity?: number;
198
+ readonly old?: {
199
+ readonly mode: string;
200
+ readonly oid: string;
201
+ };
202
+ readonly new?: {
203
+ readonly mode: string;
204
+ readonly oid: string;
205
+ };
206
+ readonly pathBytes?: Uint8Array<ArrayBufferLike>;
207
+ readonly fromPathBytes?: Uint8Array<ArrayBufferLike>;
208
+ };
209
+ }, GitError, never>, import("effect/Stream").Stream<{
210
+ readonly commit: string;
211
+ readonly root: boolean;
212
+ readonly change: {
213
+ readonly status: "A" | "D" | "M" | "R" | "T";
214
+ readonly path: string;
215
+ readonly from?: string;
216
+ readonly similarity?: number;
217
+ readonly old?: {
218
+ readonly mode: string;
219
+ readonly oid: string;
220
+ };
221
+ readonly new?: {
222
+ readonly mode: string;
223
+ readonly oid: string;
224
+ };
225
+ readonly pathBytes?: Uint8Array<ArrayBufferLike>;
226
+ readonly fromPathBytes?: Uint8Array<ArrayBufferLike>;
227
+ };
228
+ }, GitError, never>>;
229
+ } & {
230
+ readonly atomic: Schema.Boolean;
231
+ }>]>;
15
232
  /**
16
233
  * A hook group's options: its band, `pre` or `post`, plain when left out, and how long each of its
17
234
  * handlers may run, past which its call is interrupted and the push refused.
@@ -1,4 +1,6 @@
1
- // src/contracts/git-hooks.ts
1
+ import "./rules.mjs";
2
+ import * as Schema from "effect/Schema";
3
+ Schema.Boolean;
2
4
  /** The handlers `handlers` holds, with `handle` to add one. */
3
5
  const handlersOf = (handlers) => ({
4
6
  handlers,
@@ -9,7 +9,7 @@ import { PinnedRepo } from "./repos.mjs";
9
9
  import { GitError } from "./result.mjs";
10
10
  import * as Effect from "effect/Effect";
11
11
  import * as Option from "effect/Option";
12
- import { Committed, JobDefinition, Key, Moment, Read, Records, Row, WatchedRow } from "@ref0/infra";
12
+ import { Committed, CurrentJob, Job, Key, Moment, Read, Records, Row, WatchedRow } from "@ref0/infra";
13
13
  import * as Context from "effect/Context";
14
14
  import * as Stream from "effect/Stream";
15
15
  /**
@@ -99,6 +99,11 @@ export interface UpkeepStep {
99
99
  export type Upkeep = (input: {
100
100
  readonly repo: InternalRepoId;
101
101
  readonly at: Moment;
102
+ /**
103
+ * Whether the repo is deleted: its purge deletes the rows that only wait for their day, so a
104
+ * step leaves them to it and answers no time for them (#2282).
105
+ */
106
+ readonly deleted: boolean;
102
107
  }) => Effect.Effect<UpkeepStep, GitError>;
103
108
  /** A step of a registration's purge: `did` when it deleted some, `waits` while what it ends stands, `done`. */
104
109
  export type PurgeStep = 'did' | 'waits' | 'done';
@@ -187,8 +192,13 @@ export interface Registration {
187
192
  readonly addUpkeep: (step: Hook<Upkeep>) => Effect.Effect<void>;
188
193
  readonly addPurge: (step: Hook<Purge>) => Effect.Effect<void>;
189
194
  readonly addRoute: (route: Hook<Route>) => Effect.Effect<void>;
190
- /** A job named `<registration name>.<job>`: infra's `JobDefinition`, as `JobQueue.register` takes. */
191
- readonly addJob: (definition: JobDefinition) => Effect.Effect<void>;
195
+ /**
196
+ * A job named `<registration name>.<job>`: `job`, an infra `Job.make`, its try `handler`, and
197
+ * `options`' `onFailure`, each run in a budget of the adapter's `callLimits` made fresh for each
198
+ * run, as Git's own jobs are, so a try's store, bucket and outbound calls stop at its bound. Each
199
+ * runs with the services `addJob` ran with, beneath its own `CurrentJob`, fence and budget.
200
+ */
201
+ readonly addJob: <Name extends string, Data, Encoded, E, E2 = never>(job: Job.Definition<Name, Data, Encoded>, handler: Job.Handler<Data, E, CurrentJob.CurrentJob>, options?: Job.DefinitionOptions<Data, E2, CurrentJob.CurrentJob>) => Effect.Effect<void>;
192
202
  readonly addGrant: (resolver: Hook<GrantResolver>) => Effect.Effect<void>;
193
203
  }
194
204
  declare const Git_base: Context.ServiceClass<Git, "@ref0/git/Git", {