@ref0/git 0.6.0 → 0.7.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 (431) hide show
  1. package/dist/access/namespace.d.mts +2 -0
  2. package/dist/access/private-refs.d.mts +6 -29
  3. package/dist/access/private-refs.mjs +28 -13
  4. package/dist/access/public.d.mts +6 -0
  5. package/dist/access/public.mjs +9 -0
  6. package/dist/auth/access-jwt.d.mts +10 -6
  7. package/dist/auth/access-jwt.mjs +59 -40
  8. package/dist/auth/auth-namespace.d.mts +6 -0
  9. package/dist/auth/auth-namespace.mjs +12 -0
  10. package/dist/auth/auth.d.mts +3 -6
  11. package/dist/auth/auth.mjs +2 -9
  12. package/dist/auth/authorize.mjs +4 -5
  13. package/dist/auth/fences.d.mts +1 -1
  14. package/dist/auth/host-function.mjs +17 -8
  15. package/dist/auth/identify.mjs +2 -1
  16. package/dist/auth/namespaces.d.mts +2 -2
  17. package/dist/auth/token-rows.mjs +1 -1
  18. package/dist/auth/tokens-layer.d.mts +42 -0
  19. package/dist/auth/tokens-layer.mjs +29 -0
  20. package/dist/auth/tokens-namespace.d.mts +2 -0
  21. package/dist/auth/tokens-public.d.mts +6 -0
  22. package/dist/auth/tokens-public.mjs +29 -0
  23. package/dist/auth/tokens.d.mts +13 -6
  24. package/dist/auth/tokens.mjs +5 -5
  25. package/dist/auth.d.mts +2 -2
  26. package/dist/auth.mjs +2 -2
  27. package/dist/client/git-http.mjs +1 -1
  28. package/dist/client/local.mjs +4 -3
  29. package/dist/client/remote-helper.mjs +3 -8
  30. package/dist/client/remote.mjs +26 -7
  31. package/dist/client/run-remote-helper.d.mts +1 -1
  32. package/dist/client/run-remote-helper.mjs +2 -2
  33. package/dist/client/slice-push.d.mts +1 -1
  34. package/dist/contracts/access.d.mts +18 -10
  35. package/dist/contracts/access.mjs +17 -0
  36. package/dist/contracts/actors.d.mts +17 -1
  37. package/dist/contracts/actors.mjs +8 -1
  38. package/dist/contracts/authorize.d.mts +7 -4
  39. package/dist/contracts/blobs.d.mts +1 -1
  40. package/dist/contracts/blobs.mjs +1 -1
  41. package/dist/contracts/calls-spent.d.mts +6 -4
  42. package/dist/contracts/calls-spent.mjs +10 -8
  43. package/dist/contracts/commits.d.mts +2 -2
  44. package/dist/contracts/commits.mjs +1 -1
  45. package/dist/contracts/engine.d.mts +1 -1
  46. package/dist/contracts/events.d.mts +33 -22
  47. package/dist/contracts/events.mjs +13 -4
  48. package/dist/contracts/files.d.mts +2 -2
  49. package/dist/contracts/files.mjs +1 -1
  50. package/dist/contracts/forks.d.mts +58 -58
  51. package/dist/contracts/forks.mjs +1 -1
  52. package/dist/contracts/git-events.d.mts +50 -0
  53. package/dist/contracts/git-events.mjs +23 -0
  54. package/dist/contracts/git-hooks.d.mts +37 -0
  55. package/dist/contracts/git-hooks.mjs +10 -0
  56. package/dist/contracts/git.d.mts +93 -42
  57. package/dist/contracts/git.mjs +6 -5
  58. package/dist/contracts/ids.d.mts +16 -0
  59. package/dist/contracts/ids.mjs +19 -4
  60. package/dist/contracts/lfs.d.mts +2 -0
  61. package/dist/contracts/namespaces.d.mts +2 -2
  62. package/dist/contracts/objects.d.mts +1 -1
  63. package/dist/contracts/opaque.mjs +9 -0
  64. package/dist/contracts/operations.d.mts +293 -100
  65. package/dist/contracts/promises.d.mts +2 -0
  66. package/dist/contracts/push-uploads.d.mts +4 -1
  67. package/dist/contracts/push-uploads.mjs +9 -4
  68. package/dist/contracts/queue.d.mts +218 -47
  69. package/dist/contracts/queue.mjs +81 -6
  70. package/dist/contracts/refs.d.mts +30 -8
  71. package/dist/contracts/refs.mjs +1 -1
  72. package/dist/contracts/remote.d.mts +42 -21
  73. package/dist/contracts/remote.mjs +22 -0
  74. package/dist/contracts/repo-records.d.mts +2 -2
  75. package/dist/contracts/repos.d.mts +126 -79
  76. package/dist/contracts/repos.mjs +43 -5
  77. package/dist/contracts/result.d.mts +46 -31
  78. package/dist/contracts/result.mjs +43 -16
  79. package/dist/contracts/rules.d.mts +50 -44
  80. package/dist/contracts/rules.mjs +5 -1
  81. package/dist/contracts/server.d.mts +282 -198
  82. package/dist/contracts/services.d.mts +1 -7
  83. package/dist/contracts/services.mjs +1 -3
  84. package/dist/contracts/signin.d.mts +140 -43
  85. package/dist/contracts/signin.mjs +35 -1
  86. package/dist/contracts/store.d.mts +1 -1
  87. package/dist/contracts/sync.d.mts +112 -90
  88. package/dist/contracts/sync.mjs +34 -7
  89. package/dist/contracts/tags.d.mts +1 -1
  90. package/dist/contracts/tags.mjs +1 -1
  91. package/dist/contracts/tokens.d.mts +232 -57
  92. package/dist/contracts/tokens.mjs +80 -19
  93. package/dist/contracts/topics.d.mts +22 -10
  94. package/dist/contracts/topics.mjs +6 -3
  95. package/dist/contracts/trees.d.mts +2 -2
  96. package/dist/contracts/trees.mjs +1 -1
  97. package/dist/contracts/work.d.mts +2 -2
  98. package/dist/contracts/work.mjs +2 -2
  99. package/dist/core/access.d.mts +10 -10
  100. package/dist/core/access.mjs +31 -8
  101. package/dist/core/clock.mjs +1 -1
  102. package/dist/core/events/deliver.d.mts +3 -2
  103. package/dist/core/events/deliver.mjs +170 -92
  104. package/dist/core/forks.mjs +49 -24
  105. package/dist/core/hooks/groups.d.mts +27 -0
  106. package/dist/core/hooks/groups.mjs +74 -0
  107. package/dist/core/hooks/namespace.d.mts +2 -0
  108. package/dist/core/hooks/order.d.mts +2 -2
  109. package/dist/core/hooks/order.mjs +6 -6
  110. package/dist/core/hooks/public.d.mts +7 -0
  111. package/dist/core/hooks/public.mjs +5 -0
  112. package/dist/core/imports.mjs +94 -10
  113. package/dist/core/index-job.mjs +11 -8
  114. package/dist/core/merge-parts.d.mts +1 -1
  115. package/dist/core/merge-parts.mjs +1 -1
  116. package/dist/core/mirror-rows.mjs +18 -0
  117. package/dist/core/names.mjs +1 -1
  118. package/dist/core/namespaces.d.mts +2 -1
  119. package/dist/core/objects/commit-writes.mjs +5 -5
  120. package/dist/core/objects/merges.mjs +1 -1
  121. package/dist/core/objects/objects-layer.mjs +1 -1
  122. package/dist/core/objects/reading.mjs +52 -7
  123. package/dist/core/objects/tree-edits.mjs +13 -28
  124. package/dist/core/objects/trees.mjs +4 -4
  125. package/dist/core/objects/writing.mjs +3 -3
  126. package/dist/core/own-writes.mjs +1 -1
  127. package/dist/core/parts.d.mts +22 -3
  128. package/dist/core/parts.mjs +5 -3
  129. package/dist/core/promise.mjs +23 -3
  130. package/dist/core/purge.d.mts +2 -2
  131. package/dist/core/purge.mjs +80 -30
  132. package/dist/core/push.mjs +55 -74
  133. package/dist/core/receipts.d.mts +2 -2
  134. package/dist/core/receipts.mjs +28 -4
  135. package/dist/core/ref-index-job.mjs +4 -4
  136. package/dist/core/ref-view.mjs +2 -2
  137. package/dist/core/refs.mjs +41 -10
  138. package/dist/core/registered-records.mjs +30 -0
  139. package/dist/core/{claim-rows.mjs → registered-rows.mjs} +6 -6
  140. package/dist/core/repack.d.mts +2 -2
  141. package/dist/core/repack.mjs +11 -9
  142. package/dist/core/repo-info.mjs +59 -25
  143. package/dist/core/repos.mjs +17 -11
  144. package/dist/core/rules/changes.mjs +2 -2
  145. package/dist/core/rules/commit-changes.mjs +1 -1
  146. package/dist/core/rules/context.d.mts +4 -5
  147. package/dist/core/rules/context.mjs +3 -4
  148. package/dist/core/rules/fetch.mjs +74 -21
  149. package/dist/core/saved-caller-views.d.mts +72 -0
  150. package/dist/core/saved-caller-views.mjs +123 -0
  151. package/dist/core/saved-callers-public.d.mts +5 -0
  152. package/dist/core/saved-callers-public.mjs +10 -0
  153. package/dist/core/saved-callers.mjs +95 -0
  154. package/dist/core/seam.d.mts +12 -1
  155. package/dist/core/seam.mjs +4 -2
  156. package/dist/core/tokens.mjs +5 -1
  157. package/dist/core/view.d.mts +1 -1
  158. package/dist/core/view.mjs +1 -1
  159. package/dist/core/work.mjs +6 -5
  160. package/dist/effect.d.mts +2 -2
  161. package/dist/effect.mjs +2 -2
  162. package/dist/engine/content.d.mts +2 -2
  163. package/dist/engine/content.mjs +1 -1
  164. package/dist/engine/diff.mjs +2 -2
  165. package/dist/engine/merge-base-walk.d.mts +2 -2
  166. package/dist/engine/merge-base-walk.mjs +1 -1
  167. package/dist/engine/merge-renames.mjs +1 -1
  168. package/dist/engine/reads.d.mts +2 -2
  169. package/dist/engine/reads.mjs +1 -1
  170. package/dist/engine/xdiff.d.mts +1 -1
  171. package/dist/engine/xdiff.mjs +2 -2
  172. package/dist/event-streams/event-streams.d.mts +6 -2
  173. package/dist/event-streams/event-streams.mjs +6 -2
  174. package/dist/event-streams/stream.mjs +5 -2
  175. package/dist/extend.d.mts +3 -3
  176. package/dist/extend.mjs +3 -2
  177. package/dist/http/answers.mjs +4 -3
  178. package/dist/http/core-parts.mjs +2 -2
  179. package/dist/http/handler.mjs +1 -1
  180. package/dist/http/parts.d.mts +1 -0
  181. package/dist/http/push-uploads.mjs +7 -5
  182. package/dist/http/receive-pack.mjs +3 -3
  183. package/dist/http/upload-pack.mjs +6 -5
  184. package/dist/index.d.mts +33 -20
  185. package/dist/index.mjs +13 -7
  186. package/dist/lfs/base.d.mts +2 -2
  187. package/dist/lfs/calls.mjs +3 -2
  188. package/dist/lfs/layer.d.mts +5 -4
  189. package/dist/lfs/layer.mjs +17 -16
  190. package/dist/lfs/locks.mjs +3 -3
  191. package/dist/lfs/objects.d.mts +3 -2
  192. package/dist/lfs/objects.mjs +149 -34
  193. package/dist/lfs/pointers.mjs +1 -1
  194. package/dist/lfs/purge.mjs +1 -1
  195. package/dist/lfs/rows.mjs +1 -1
  196. package/dist/lfs/upkeep.mjs +13 -9
  197. package/dist/lfs/wire.mjs +1 -1
  198. package/dist/protocol/bytes/buffers.d.mts +1 -1
  199. package/dist/protocol/bytes/buffers.mjs +1 -1
  200. package/dist/protocol/bytes/deflate.d.mts +1 -1
  201. package/dist/protocol/bytes/deflate.mjs +1 -1
  202. package/dist/protocol/bytes/hmac-sha256.mjs +3 -6
  203. package/dist/protocol/bytes/inflate.d.mts +1 -1
  204. package/dist/protocol/bytes/inflate.mjs +1 -1
  205. package/dist/protocol/bytes/sha1.d.mts +1 -1
  206. package/dist/protocol/bytes/sha1.mjs +2 -2
  207. package/dist/protocol/diff/read.d.mts +1 -1
  208. package/dist/protocol/diff/read.mjs +1 -1
  209. package/dist/protocol/diff/tree-diff.d.mts +1 -1
  210. package/dist/protocol/diff/tree-diff.mjs +11 -11
  211. package/dist/protocol/objects/lfs-pointer.mjs +6 -1
  212. package/dist/protocol/objects/tag.mjs +1 -1
  213. package/dist/protocol/objects/tree.mjs +1 -1
  214. package/dist/protocol/packs/graph.mjs +1 -1
  215. package/dist/protocol/packs/idx.d.mts +1 -1
  216. package/dist/protocol/packs/idx.mjs +1 -1
  217. package/dist/protocol/packs/parts.mjs +1 -1
  218. package/dist/protocol/packs/reader.d.mts +1 -1
  219. package/dist/protocol/packs/reader.mjs +2 -2
  220. package/dist/protocol/packs/write-error.d.mts +1 -1
  221. package/dist/protocol/packs/write-error.mjs +1 -1
  222. package/dist/protocol/packs/writer.mjs +4 -4
  223. package/dist/protocol/wire/advertisement.d.mts +1 -1
  224. package/dist/protocol/wire/advertisement.mjs +1 -1
  225. package/dist/protocol/wire/fetch.d.mts +1 -1
  226. package/dist/protocol/wire/fetch.mjs +1 -1
  227. package/dist/protocol/wire/lines.d.mts +1 -1
  228. package/dist/protocol/wire/lines.mjs +2 -2
  229. package/dist/protocol/wire/push-uploads.mjs +4 -2
  230. package/dist/protocol/wire/receive-pack.d.mts +1 -1
  231. package/dist/protocol/wire/receive-pack.mjs +1 -1
  232. package/dist/protocol/wire/report-status.d.mts +1 -1
  233. package/dist/protocol/wire/report-status.mjs +1 -1
  234. package/dist/protocol/wire/v2.d.mts +2 -2
  235. package/dist/protocol/wire/v2.mjs +2 -2
  236. package/dist/queue/advance.mjs +155 -63
  237. package/dist/queue/callers.mjs +56 -69
  238. package/dist/queue/calls.mjs +20 -11
  239. package/dist/queue/commit.mjs +28 -22
  240. package/dist/queue/host.d.mts +10 -11
  241. package/dist/queue/host.mjs +15 -7
  242. package/dist/queue/lanes.mjs +9 -18
  243. package/dist/queue/layer.d.mts +3 -3
  244. package/dist/queue/layer.mjs +11 -10
  245. package/dist/queue/limits.mjs +17 -5
  246. package/dist/queue/rows.mjs +5 -10
  247. package/dist/queue/schedule.mjs +6 -5
  248. package/dist/queue/search.mjs +8 -13
  249. package/dist/queue/state.mjs +7 -2
  250. package/dist/queue/trim.mjs +10 -5
  251. package/dist/rest/api.d.mts +1 -1
  252. package/dist/rest/blobs.d.mts +20 -20
  253. package/dist/rest/caller.d.mts +22 -20
  254. package/dist/rest/client.mjs +6 -6
  255. package/dist/rest/commits.d.mts +335 -335
  256. package/dist/rest/errors.d.mts +10 -10
  257. package/dist/rest/errors.mjs +1 -1
  258. package/dist/rest/events.d.mts +13 -11
  259. package/dist/rest/events.mjs +3 -1
  260. package/dist/rest/files.d.mts +30 -30
  261. package/dist/rest/forks.d.mts +150 -150
  262. package/dist/rest/handler.mjs +4 -3
  263. package/dist/rest/handlers.mjs +13 -7
  264. package/dist/rest/layer.d.mts +3 -3
  265. package/dist/rest/layer.mjs +8 -7
  266. package/dist/rest/listen.mjs +2 -2
  267. package/dist/rest/me.d.mts +18 -20
  268. package/dist/rest/me.mjs +1 -1
  269. package/dist/rest/merges.d.mts +10 -10
  270. package/dist/rest/queue.d.mts +140 -140
  271. package/dist/rest/queue.mjs +1 -1
  272. package/dist/rest/refs.d.mts +95 -95
  273. package/dist/rest/refs.mjs +1 -1
  274. package/dist/rest/repos.d.mts +127 -127
  275. package/dist/rest/tags.d.mts +30 -30
  276. package/dist/rest/tokens.d.mts +250 -260
  277. package/dist/rest/tokens.mjs +10 -42
  278. package/dist/rest/topics.d.mts +63 -63
  279. package/dist/rest/topics.mjs +1 -1
  280. package/dist/rest/trees.d.mts +106 -106
  281. package/dist/rest/wire.d.mts +6 -4
  282. package/dist/rest/wire.mjs +4 -3
  283. package/dist/rest/work.d.mts +69 -69
  284. package/dist/rest/work.mjs +1 -1
  285. package/dist/server/check-fetch.mjs +9 -0
  286. package/dist/server/extension.mjs +3 -115
  287. package/dist/server/git-layer.d.mts +20 -3
  288. package/dist/server/git-layer.mjs +30 -19
  289. package/dist/server/git-namespace.d.mts +4 -4
  290. package/dist/server/git-namespace.mjs +6 -4
  291. package/dist/server/joined.d.mts +83 -0
  292. package/dist/server/joined.mjs +91 -0
  293. package/dist/server/registry.d.mts +7 -3
  294. package/dist/server/registry.mjs +135 -31
  295. package/dist/server/routes.mjs +2 -2
  296. package/dist/server/server.d.mts +9 -2
  297. package/dist/server/server.mjs +279 -191
  298. package/dist/signin/context.d.mts +2 -1
  299. package/dist/signin/context.mjs +32 -37
  300. package/dist/signin/device.mjs +5 -5
  301. package/dist/signin/forms.mjs +1 -1
  302. package/dist/signin/grants.d.mts +2 -3
  303. package/dist/signin/grants.mjs +5 -5
  304. package/dist/signin/layer.d.mts +9 -0
  305. package/dist/signin/layer.mjs +41 -0
  306. package/dist/signin/namespace.d.mts +2 -0
  307. package/dist/signin/public.d.mts +6 -0
  308. package/dist/signin/public.mjs +5 -0
  309. package/dist/signin/route.mjs +47 -21
  310. package/dist/signin/web.mjs +3 -3
  311. package/dist/signin/wire.mjs +1 -1
  312. package/dist/storage/calls.d.mts +1 -1
  313. package/dist/storage/calls.mjs +4 -4
  314. package/dist/storage/clean-up.mjs +12 -5
  315. package/dist/storage/counted-bucket.mjs +34 -51
  316. package/dist/storage/fetch.mjs +1 -1
  317. package/dist/storage/host-bucket.mjs +1 -1
  318. package/dist/storage/index-build.d.mts +2 -2
  319. package/dist/storage/index-build.mjs +3 -3
  320. package/dist/storage/index-fetch.mjs +10 -6
  321. package/dist/storage/index-graph.mjs +1 -1
  322. package/dist/storage/index-layers.mjs +1 -1
  323. package/dist/storage/index-visible.mjs +1 -1
  324. package/dist/storage/memory-budget.mjs +7 -1
  325. package/dist/storage/merge-cut.mjs +24 -1
  326. package/dist/storage/merge-fence.mjs +1 -1
  327. package/dist/storage/merge-plan.mjs +5 -2
  328. package/dist/storage/merge-row.mjs +1 -1
  329. package/dist/storage/merge-stream.mjs +16 -7
  330. package/dist/storage/merge-write.mjs +1 -1
  331. package/dist/storage/merge.d.mts +2 -2
  332. package/dist/storage/merge.mjs +1 -1
  333. package/dist/storage/object-rows.d.mts +2 -2
  334. package/dist/storage/object-rows.mjs +3 -3
  335. package/dist/storage/pack-ranges.d.mts +3 -1
  336. package/dist/storage/pack-ranges.mjs +168 -69
  337. package/dist/storage/pack-reads.mjs +4 -4
  338. package/dist/storage/pack-receive.d.mts +1 -1
  339. package/dist/storage/pack-receive.mjs +7 -9
  340. package/dist/storage/packs.d.mts +1 -1
  341. package/dist/storage/packs.mjs +45 -52
  342. package/dist/storage/placed-reads.mjs +81 -15
  343. package/dist/storage/prune-seen.mjs +126 -0
  344. package/dist/storage/prune-walk.mjs +87 -99
  345. package/dist/storage/prune.mjs +49 -14
  346. package/dist/storage/push-uploads.mjs +4 -2
  347. package/dist/storage/quarantine.d.mts +2 -2
  348. package/dist/storage/ready.d.mts +2 -2
  349. package/dist/storage/ready.mjs +3 -3
  350. package/dist/storage/receive-files.mjs +1 -1
  351. package/dist/storage/receive-links.mjs +1 -1
  352. package/dist/storage/receive-state.d.mts +2 -2
  353. package/dist/storage/receive-state.mjs +1 -1
  354. package/dist/storage/receive-steps.mjs +1 -1
  355. package/dist/storage/repack-contained.mjs +2 -2
  356. package/dist/storage/repack-job.d.mts +2 -2
  357. package/dist/storage/repack-job.mjs +5 -4
  358. package/dist/storage/repack.d.mts +1 -1
  359. package/dist/storage/repack.mjs +9 -3
  360. package/dist/storage/rows.d.mts +2 -2
  361. package/dist/storage/rows.mjs +1 -1
  362. package/dist/storage/runs.d.mts +2 -2
  363. package/dist/storage/runs.mjs +15 -6
  364. package/dist/storage/send-list.mjs +6 -6
  365. package/dist/storage/single-flight.mjs +2 -2
  366. package/dist/storage/swap-walk.mjs +1 -1
  367. package/dist/storage/unpack.mjs +1 -1
  368. package/dist/store/call-count.d.mts +1 -1
  369. package/dist/store/call-count.mjs +125 -34
  370. package/dist/store/catalogue.d.mts +1 -1
  371. package/dist/store/catalogue.mjs +2 -2
  372. package/dist/store/crossing.mjs +2 -6
  373. package/dist/store/cursor-seal.mjs +1 -1
  374. package/dist/store/errors.d.mts +7 -3
  375. package/dist/store/errors.mjs +41 -13
  376. package/dist/store/job-try.mjs +119 -15
  377. package/dist/store/list-job.mjs +5 -5
  378. package/dist/store/outbox.d.mts +2 -2
  379. package/dist/store/outbox.mjs +75 -16
  380. package/dist/store/promises.d.mts +2 -2
  381. package/dist/store/promises.mjs +31 -6
  382. package/dist/store/queue-jobs.mjs +1 -1
  383. package/dist/store/records.d.mts +2 -2
  384. package/dist/store/records.mjs +16 -24
  385. package/dist/store/ref-rows.d.mts +2 -2
  386. package/dist/store/ref-rows.mjs +6 -6
  387. package/dist/store/reservations.mjs +35 -8
  388. package/dist/store/scopes.mjs +6 -4
  389. package/dist/store/topic-jobs.mjs +8 -8
  390. package/dist/sync/bound.d.mts +1 -3
  391. package/dist/sync/bound.mjs +30 -42
  392. package/dist/sync/bridge.d.mts +6 -0
  393. package/dist/sync/bridge.mjs +29 -0
  394. package/dist/sync/github.d.mts +5 -6
  395. package/dist/sync/github.mjs +37 -42
  396. package/dist/sync/http.mjs +15 -0
  397. package/dist/sync/import.mjs +17 -18
  398. package/dist/sync/layer.d.mts +9 -0
  399. package/dist/sync/layer.mjs +68 -0
  400. package/dist/sync/mirror.mjs +137 -58
  401. package/dist/sync/publish.mjs +3 -6
  402. package/dist/sync/step.mjs +217 -79
  403. package/dist/sync/tries.mjs +22 -15
  404. package/dist/sync.d.mts +3 -6
  405. package/dist/sync.mjs +3 -6
  406. package/dist/topics/advance.mjs +205 -90
  407. package/dist/topics/calls.mjs +8 -8
  408. package/dist/topics/directory.mjs +35 -12
  409. package/dist/topics/host.d.mts +5 -8
  410. package/dist/topics/host.mjs +42 -19
  411. package/dist/topics/layer.d.mts +381 -0
  412. package/dist/topics/layer.mjs +62 -0
  413. package/dist/topics/members.mjs +1 -1
  414. package/dist/topics/namespace.d.mts +2 -0
  415. package/dist/topics/public.d.mts +6 -0
  416. package/dist/topics/public.mjs +13 -0
  417. package/dist/topics/rows.mjs +12 -3
  418. package/dist/topics/topic.mjs +11 -10
  419. package/package.json +8 -13
  420. package/dist/access.d.mts +0 -2
  421. package/dist/access.mjs +0 -1
  422. package/dist/core/hooks/post-receive.mjs +0 -216
  423. package/dist/core/hooks/pre-receive.d.mts +0 -12
  424. package/dist/core/hooks/pre-receive.mjs +0 -36
  425. package/dist/server/extension.d.mts +0 -21
  426. package/dist/sync/import.d.mts +0 -10
  427. package/dist/sync/jobs.d.mts +0 -9
  428. package/dist/sync/jobs.mjs +0 -75
  429. package/dist/sync/mirror.d.mts +0 -13
  430. package/dist/sync/publish.d.mts +0 -6
  431. /package/dist/core/{claim-rows.d.mts → registered-rows.d.mts} +0 -0
@@ -1,5 +1,5 @@
1
- import { Moment } from "./repos.mjs";
2
- import { Awaitable } from "./result.mjs";
1
+ import { GitError } from "./result.mjs";
2
+ import * as Effect from "effect/Effect";
3
3
  import * as Schema from "effect/Schema";
4
4
  /**
5
5
  * The GitHub scope a device asks for so its token can push, as gh does: Git's refusal of a push
@@ -8,69 +8,166 @@ import * as Schema from "effect/Schema";
8
8
  */
9
9
  export declare const ghWriteScope = "repo";
10
10
  /** A browser app registered for the web flow: its callbacks, and a secret if it's confidential. */
11
- export interface OAuthClient {
12
- readonly id: string;
11
+ export declare const OAuthClient: Schema.Struct<{
12
+ readonly id: Schema.String;
13
13
  /** Each callback the client may name, matched exactly. The first is the default. */
14
- readonly redirectUris: readonly string[];
14
+ readonly redirectUris: Schema.$Array<Schema.String>;
15
15
  /** Sent at the exchange by a confidential client; a public client proves itself with PKCE. */
16
- readonly secret?: string;
17
- }
16
+ readonly secret: Schema.optionalKey<Schema.String>;
17
+ }>;
18
+ export type OAuthClient = typeof OAuthClient.Type;
18
19
  /**
19
20
  * Turns on sign-in: GitHub's device flow, which also accepts `gh`'s client ID, and the web flow for
20
21
  * `clients`, both approved on the host's `approvalPage`. Needs `tokens()`, which mints the token.
21
22
  */
22
- export interface GitSignInOptions {
23
+ export interface SignInLayerOptions {
23
24
  readonly clients?: readonly OAuthClient[];
24
- readonly approvalPage: (input: ApprovalPageInput) => Awaitable<Response>;
25
+ readonly approvalPage: (input: ApprovalPageInput) => Effect.Effect<Response, GitError>;
25
26
  }
27
+ export declare const ApprovalBase: Schema.Struct<{
28
+ /** The requesting OAuth client's ID. */
29
+ readonly clientId: Schema.String;
30
+ /** The scopes the client asked for, which the host may show and narrow. */
31
+ readonly scopes: Schema.$Array<Schema.String>;
32
+ /** When the request can no longer be approved. */
33
+ readonly expiresAt: Schema.Number;
34
+ }>;
35
+ export type ApprovalBase = typeof ApprovalBase.Type;
36
+ export declare const DeviceApproval: Schema.Struct<{
37
+ /** The requesting OAuth client's ID. */
38
+ readonly clientId: Schema.String;
39
+ /** The scopes the client asked for, which the host may show and narrow. */
40
+ readonly scopes: Schema.$Array<Schema.String>;
41
+ /** When the request can no longer be approved. */
42
+ readonly expiresAt: Schema.Number;
43
+ readonly kind: Schema.Literal<"device">;
44
+ /** As the device shows it: `XXXX-XXXX`. */
45
+ readonly userCode: Schema.String;
46
+ }>;
47
+ export type DeviceApproval = typeof DeviceApproval.Type;
48
+ export declare const WebApproval: Schema.Struct<{
49
+ /** The requesting OAuth client's ID. */
50
+ readonly clientId: Schema.String;
51
+ /** The scopes the client asked for, which the host may show and narrow. */
52
+ readonly scopes: Schema.$Array<Schema.String>;
53
+ /** When the request can no longer be approved. */
54
+ readonly expiresAt: Schema.Number;
55
+ readonly kind: Schema.Literal<"web">;
56
+ /** Where the browser goes with the code once approved. */
57
+ readonly redirectUri: Schema.String;
58
+ }>;
59
+ export type WebApproval = typeof WebApproval.Type;
60
+ export declare const ApprovalPrompt: Schema.Union<readonly [Schema.Struct<{
61
+ /** The requesting OAuth client's ID. */
62
+ readonly clientId: Schema.String;
63
+ /** The scopes the client asked for, which the host may show and narrow. */
64
+ readonly scopes: Schema.$Array<Schema.String>;
65
+ /** When the request can no longer be approved. */
66
+ readonly expiresAt: Schema.Number;
67
+ readonly kind: Schema.Literal<"device">;
68
+ /** As the device shows it: `XXXX-XXXX`. */
69
+ readonly userCode: Schema.String;
70
+ }>, Schema.Struct<{
71
+ /** The requesting OAuth client's ID. */
72
+ readonly clientId: Schema.String;
73
+ /** The scopes the client asked for, which the host may show and narrow. */
74
+ readonly scopes: Schema.$Array<Schema.String>;
75
+ /** When the request can no longer be approved. */
76
+ readonly expiresAt: Schema.Number;
77
+ readonly kind: Schema.Literal<"web">;
78
+ /** Where the browser goes with the code once approved. */
79
+ readonly redirectUri: Schema.String;
80
+ }>]>;
81
+ export type ApprovalPrompt = typeof ApprovalPrompt.Type;
26
82
  /**
27
83
  * `request` is a copy of the one the browser sent, with its body unread, so the host reads its own
28
84
  * fields. Each page gets its own, the one `decide` answers with too.
29
85
  */
30
- export interface ApprovalPageContext {
31
- readonly request: Request;
32
- readonly signal: AbortSignal;
33
- }
86
+ export declare const ApprovalPageContext: Schema.Struct<{
87
+ readonly request: Schema.declare<Request, Request>;
88
+ readonly signal: Schema.declare<AbortSignal, AbortSignal>;
89
+ }>;
90
+ export type ApprovalPageContext = typeof ApprovalPageContext.Type;
34
91
  /**
35
92
  * Asks the person for the user code their device shows, submitted as `user_code` to `action`.
36
93
  * `invalid-code`: no code is pending under what they typed. `expired-code`: it was, and can't be
37
94
  * used any more, since it expired or was decided: they start again on their device.
38
95
  */
39
- export interface DeviceCodePage extends ApprovalPageContext {
40
- readonly kind: 'enter-code';
41
- readonly action: '/login/device';
42
- readonly error?: 'invalid-code' | 'expired-code';
43
- }
96
+ export declare const DeviceCodePage: Schema.Struct<{
97
+ readonly request: Schema.declare<Request, Request>;
98
+ readonly signal: Schema.declare<AbortSignal, AbortSignal>;
99
+ readonly kind: Schema.Literal<"enter-code">;
100
+ readonly action: Schema.Literal<"/login/device">;
101
+ readonly error: Schema.optionalKey<Schema.Literals<readonly ["invalid-code", "expired-code"]>>;
102
+ }>;
103
+ export type DeviceCodePage = typeof DeviceCodePage.Type;
44
104
  /**
45
105
  * A validated request for the person to approve or deny. The host authenticates the person and
46
106
  * checks the submission belongs to the page's browser session before it calls `decide`, which
47
107
  * settles this request alone and answers the response to send back.
48
108
  */
49
- export interface ConfirmApprovalPage extends ApprovalPageContext {
50
- readonly kind: 'confirm';
51
- readonly prompt: ApprovalPrompt;
52
- readonly decide: (decision: ApprovalDecision) => Promise<Response>;
53
- }
54
- export type ApprovalPageInput = DeviceCodePage | ConfirmApprovalPage;
55
- export interface ApprovalBase {
56
- /** The requesting OAuth client's ID. */
57
- readonly clientId: string;
58
- /** The scopes the client asked for, which the host may show and narrow. */
59
- readonly scopes: readonly string[];
60
- /** When the request can no longer be approved. */
61
- readonly expiresAt: Moment;
62
- }
63
- export interface DeviceApproval extends ApprovalBase {
64
- readonly kind: 'device';
65
- /** As the device shows it: `XXXX-XXXX`. */
66
- readonly userCode: string;
67
- }
68
- export interface WebApproval extends ApprovalBase {
69
- readonly kind: 'web';
70
- /** Where the browser goes with the code once approved. */
71
- readonly redirectUri: string;
72
- }
73
- export type ApprovalPrompt = DeviceApproval | WebApproval;
109
+ export declare const ConfirmApprovalPage: Schema.Struct<{
110
+ readonly request: Schema.declare<Request, Request>;
111
+ readonly signal: Schema.declare<AbortSignal, AbortSignal>;
112
+ readonly kind: Schema.Literal<"confirm">;
113
+ readonly prompt: Schema.Union<readonly [Schema.Struct<{
114
+ /** The requesting OAuth client's ID. */
115
+ readonly clientId: Schema.String;
116
+ /** The scopes the client asked for, which the host may show and narrow. */
117
+ readonly scopes: Schema.$Array<Schema.String>;
118
+ /** When the request can no longer be approved. */
119
+ readonly expiresAt: Schema.Number;
120
+ readonly kind: Schema.Literal<"device">;
121
+ /** As the device shows it: `XXXX-XXXX`. */
122
+ readonly userCode: Schema.String;
123
+ }>, Schema.Struct<{
124
+ /** The requesting OAuth client's ID. */
125
+ readonly clientId: Schema.String;
126
+ /** The scopes the client asked for, which the host may show and narrow. */
127
+ readonly scopes: Schema.$Array<Schema.String>;
128
+ /** When the request can no longer be approved. */
129
+ readonly expiresAt: Schema.Number;
130
+ readonly kind: Schema.Literal<"web">;
131
+ /** Where the browser goes with the code once approved. */
132
+ readonly redirectUri: Schema.String;
133
+ }>]>;
134
+ readonly decide: Schema.declare<(decision: ApprovalDecision) => Effect.Effect<Response, GitError>, unknown>;
135
+ }>;
136
+ export type ConfirmApprovalPage = typeof ConfirmApprovalPage.Type;
137
+ export declare const ApprovalPageInput: Schema.Union<readonly [Schema.Struct<{
138
+ readonly request: Schema.declare<Request, Request>;
139
+ readonly signal: Schema.declare<AbortSignal, AbortSignal>;
140
+ readonly kind: Schema.Literal<"enter-code">;
141
+ readonly action: Schema.Literal<"/login/device">;
142
+ readonly error: Schema.optionalKey<Schema.Literals<readonly ["invalid-code", "expired-code"]>>;
143
+ }>, Schema.Struct<{
144
+ readonly request: Schema.declare<Request, Request>;
145
+ readonly signal: Schema.declare<AbortSignal, AbortSignal>;
146
+ readonly kind: Schema.Literal<"confirm">;
147
+ readonly prompt: Schema.Union<readonly [Schema.Struct<{
148
+ /** The requesting OAuth client's ID. */
149
+ readonly clientId: Schema.String;
150
+ /** The scopes the client asked for, which the host may show and narrow. */
151
+ readonly scopes: Schema.$Array<Schema.String>;
152
+ /** When the request can no longer be approved. */
153
+ readonly expiresAt: Schema.Number;
154
+ readonly kind: Schema.Literal<"device">;
155
+ /** As the device shows it: `XXXX-XXXX`. */
156
+ readonly userCode: Schema.String;
157
+ }>, Schema.Struct<{
158
+ /** The requesting OAuth client's ID. */
159
+ readonly clientId: Schema.String;
160
+ /** The scopes the client asked for, which the host may show and narrow. */
161
+ readonly scopes: Schema.$Array<Schema.String>;
162
+ /** When the request can no longer be approved. */
163
+ readonly expiresAt: Schema.Number;
164
+ readonly kind: Schema.Literal<"web">;
165
+ /** Where the browser goes with the code once approved. */
166
+ readonly redirectUri: Schema.String;
167
+ }>]>;
168
+ readonly decide: Schema.declare<(decision: ApprovalDecision) => Effect.Effect<Response, GitError>, unknown>;
169
+ }>]>;
170
+ export type ApprovalPageInput = typeof ApprovalPageInput.Type;
74
171
  /** The person's token, for the repo or prefix, scope and expiry the host chose. */
75
172
  export declare const ApprovedGrant: Schema.Struct<{
76
173
  readonly kind: Schema.Literal<"approve">;
@@ -1,8 +1,10 @@
1
1
  import "./actors.mjs";
2
2
  import { RepoName } from "./ids.mjs";
3
+ import { AbortSignalValue, RequestValue } from "./opaque.mjs";
3
4
  import { Moment } from "./repos.mjs";
4
5
  import { tokenScopes } from "./tokens.mjs";
5
6
  import * as Schema from "effect/Schema";
7
+ import * as Predicate from "effect/Predicate";
6
8
  // src/contracts/signin.ts
7
9
  /**
8
10
  * The GitHub scope a device asks for so its token can push, as gh does: Git's refusal of a push
@@ -10,9 +12,41 @@ import * as Schema from "effect/Schema";
10
12
  * scopes Git understands: Git reads none, and a host maps each scope a device asks for itself.
11
13
  */
12
14
  const ghWriteScope = "repo";
15
+ Schema.String, Schema.Array(Schema.String), Schema.optionalKey(Schema.String);
16
+ const ApprovalBase = /* @__PURE__ */ Schema.Struct({
17
+ /** The requesting OAuth client's ID. */
18
+ clientId: Schema.String,
19
+ /** The scopes the client asked for, which the host may show and narrow. */
20
+ scopes: Schema.Array(Schema.String),
21
+ /** When the request can no longer be approved. */
22
+ expiresAt: Moment
23
+ });
24
+ const DeviceApproval = /* @__PURE__ */ Schema.Struct({
25
+ ...ApprovalBase.fields,
26
+ kind: Schema.Literal("device"),
27
+ /** As the device shows it: `XXXX-XXXX`. */
28
+ userCode: Schema.String
29
+ });
30
+ const WebApproval = /* @__PURE__ */ Schema.Struct({
31
+ ...ApprovalBase.fields,
32
+ kind: Schema.Literal("web"),
33
+ /** Where the browser goes with the code once approved. */
34
+ redirectUri: Schema.String
35
+ });
36
+ const ApprovalPrompt = /* @__PURE__ */ Schema.Union([DeviceApproval, WebApproval]);
37
+ /**
38
+ * `request` is a copy of the one the browser sent, with its body unread, so the host reads its own
39
+ * fields. Each page gets its own, the one `decide` answers with too.
40
+ */
41
+ const ApprovalPageContext = /* @__PURE__ */ Schema.Struct({
42
+ request: RequestValue,
43
+ signal: AbortSignalValue
44
+ });
45
+ ({ ...ApprovalPageContext.fields }), Schema.Literal("enter-code"), Schema.Literal("/login/device"), Schema.optionalKey(Schema.Literals(["invalid-code", "expired-code"]));
46
+ ({ ...ApprovalPageContext.fields }), Schema.Literal("confirm"), Schema.declare((input) => Predicate.isFunction(input));
13
47
  Schema.Literal("approve"), Schema.Union([RepoName, Schema.Struct({ prefix: Schema.String })]), Schema.Literals(tokenScopes), Schema.Union([Moment, Schema.Date]);
14
48
  Schema.Literal("deny");
15
49
  Schema.String, Schema.String, Schema.String, Schema.Number, Schema.Number;
16
50
  Schema.String, Schema.Literal("bearer"), Schema.String;
17
51
  Schema.String, Schema.optionalKey(Schema.String), Schema.optionalKey(Schema.String);
18
- export { ghWriteScope };
52
+ export { ApprovalBase, ApprovalPageContext, ApprovalPrompt, DeviceApproval, WebApproval, ghWriteScope };
@@ -1,8 +1,8 @@
1
1
  import { InternalRepoId } from "./ids.mjs";
2
2
  import { CallInput } from "./actors.mjs";
3
3
  import { Result } from "./result.mjs";
4
- import { Addition, Change, Committed, Read, Scope, Snapshot } from "@ref0/infra";
5
4
  import * as Schema from "effect/Schema";
5
+ import { Addition, Change, Committed, Read, Scope, Snapshot } from "@ref0/infra";
6
6
  /** A pack another pack holds whole, by its ID, with its size (Q903). */
7
7
  export declare const HeldPack: Schema.Struct<{
8
8
  readonly id: Schema.String;
@@ -1,22 +1,28 @@
1
+ import { ClientCredential, CredentialInput } from "./remote.mjs";
2
+ import { Awaitable, GitError, Result } from "./result.mjs";
1
3
  import { ActorInput, WriteInput } from "./actors.mjs";
2
4
  import { RefName, RepoName } from "./ids.mjs";
3
- import { ClientCredentials } from "./remote.mjs";
4
5
  import { RepoInfo, RepoInput } from "./repos.mjs";
5
- import { Result } from "./result.mjs";
6
- import { GitServer } from "./server.mjs";
7
- import { JobDefinition } from "@ref0/infra";
6
+ import * as Effect from "effect/Effect";
8
7
  import * as Schema from "effect/Schema";
8
+ import * as Context from "effect/Context";
9
9
  /**
10
10
  * A remote as one try reaches it. Its `credentials` are short-lived: a provider makes them again
11
11
  * for each try, and Git never stores or logs them. `transport` sends its requests in place of
12
12
  * `fetch`, as the client's `RemoteOptions` does: a service binding's, say, or another server's
13
13
  * own `fetch`.
14
14
  */
15
- export interface SyncRemote {
16
- readonly url: string;
17
- readonly credentials?: ClientCredentials;
18
- readonly transport?: (request: Request) => Promise<Response>;
19
- }
15
+ export declare const SyncRemote: Schema.Struct<{
16
+ readonly url: Schema.String;
17
+ readonly credentials: Schema.optionalKey<Schema.Union<readonly [Schema.Union<readonly [Schema.Struct<{
18
+ readonly username: Schema.String;
19
+ readonly password: Schema.String;
20
+ }>, Schema.Struct<{
21
+ readonly token: Schema.String;
22
+ }>]>, Schema.declare<(input: CredentialInput) => Awaitable<ClientCredential>, unknown>]>>;
23
+ readonly transport: Schema.optionalKey<Schema.declare<(request: Request) => Promise<Response>, (request: Request) => Promise<Response>>>;
24
+ }>;
25
+ export type SyncRemote = typeof SyncRemote.Type;
20
26
  /** What a provider's webhook says moved: `repo` is the provider's own name for the remote. */
21
27
  export declare const SyncTrigger: Schema.Struct<{
22
28
  readonly repo: Schema.String;
@@ -28,11 +34,12 @@ export type SyncTrigger = typeof SyncTrigger.Type;
28
34
  * A kind of remote, as the host sets it up once: `smartHttp()` or `github({ app })`. `remote`
29
35
  * answers the URL and fresh credentials for one of its repos, and runs again at every try: one
30
36
  * that throws, or answers no credentials where the remote asks for them, fails that try, and the
31
- * job's retry tries again.
37
+ * job's retry tries again. `access` is what the try does there: an import's reads, a mirror's
38
+ * pushes, so a provider mints credentials for that and no more.
32
39
  */
33
40
  export interface SyncProvider {
34
41
  readonly name: string;
35
- readonly remote: (repo: string, signal?: AbortSignal) => Promise<SyncRemote>;
42
+ readonly remote: (repo: string, access: 'read' | 'write', signal?: AbortSignal) => Promise<SyncRemote>;
36
43
  /**
37
44
  * Checks a webhook's request: the push it signed, `undefined` for a request the remote didn't
38
45
  * send or no push, and `RESOURCE_EXHAUSTED` for a body longer than the remote sends. It reads the
@@ -51,7 +58,7 @@ export declare const SyncSource: Schema.Struct<{
51
58
  }>;
52
59
  export type SyncSource = typeof SyncSource.Type;
53
60
  /**
54
- * Where `git.sync.import` publishes each pull request's head the remote holds, as
61
+ * Where `sync.import` publishes each pull request's head the remote holds, as
55
62
  * `refs/import/pull/N/head`, from its `refs/pull/N/head`: a staging ref, not the pull's own, which
56
63
  * a host such as the GitHub drop-in publishes from the pull's record with `publishImported`.
57
64
  */
@@ -71,41 +78,50 @@ export declare const ImportProgress: Schema.Struct<{
71
78
  export type ImportProgress = typeof ImportProgress.Type;
72
79
  export type ReportImportProgress = (progress: ImportProgress) => void | Promise<void>;
73
80
  /**
74
- * `repo` is created by the import. `source` names a provider `syncJobs` was given, or the import
81
+ * `repo` is created by the import. `source` names a provider `Sync.layer` was given, or the import
75
82
  * is refused `INVALID_ARGUMENT`, reason `provider-unknown`, and nothing is written. It copies the
76
83
  * whole history: no depth, since the server serves no repo's own shallow roots. `key` is a write's: sent again,
77
- * the import answers as it first did. `signal` ends the wait, not the import: `cancelImport` stops
84
+ * the import answers as it first did. Interrupting ends the wait, not the import: `cancelImport` stops
78
85
  * it.
79
86
  */
80
- export interface SyncImportInput extends WriteInput {
81
- readonly git: GitServer;
87
+ export interface SyncImportInput extends Omit<WriteInput, 'signal'> {
82
88
  readonly repo: RepoName;
83
89
  readonly source: SyncSource;
84
90
  readonly onProgress?: ReportImportProgress;
85
91
  }
86
92
  /**
87
93
  * Pushes `ref`, the repo's default branch when left out, to `destination` after each move. Sent
88
- * for a paused mirror, it resumes it. A `destination` naming a provider `syncJobs` wasn't given is
94
+ * for a paused mirror, it resumes it. A `destination` naming a provider `Sync.layer` wasn't given is
89
95
  * refused `INVALID_ARGUMENT`, reason `provider-unknown`, and so is a `ref` only Git's own writers
90
96
  * move, such as one under `refs/queue/` or `refs/import/`. It takes no `key`: sent again, it saves
91
97
  * the same mirror.
92
98
  */
93
- export interface SyncMirrorInput extends ActorInput, RepoInput {
94
- readonly git: GitServer;
99
+ export interface SyncMirrorInput extends Omit<ActorInput, 'signal'>, RepoInput {
95
100
  readonly destination: SyncSource;
96
101
  readonly ref?: RefName;
97
102
  }
98
103
  /**
99
104
  * Why a mirror stopped: `diverged`, the upstream holds commits the ref doesn't; `refused`, the
100
- * upstream refused the push for another reason, such as a protected branch or a credential.
105
+ * upstream refused the push for another reason, such as a protected branch or a credential;
106
+ * `unseen`, the caller who saved it, asked again before a try read the ref, no longer sees it:
107
+ * their right to read the repo, their credential or their view of the ref ended. Saving the
108
+ * mirror again, as a caller who sees the ref, resumes it.
101
109
  */
102
- export declare const MirrorPause: Schema.Literals<readonly ["diverged", "refused"]>;
110
+ export declare const MirrorPause: Schema.Literals<readonly ["diverged", "refused", "unseen"]>;
103
111
  export type MirrorPause = typeof MirrorPause.Type;
112
+ /**
113
+ * A mirror of `ref`: `active`, or `paused` and why. `lastPushed` is the last push its upstream
114
+ * took, kept across pauses and resumes to the same destination, and left out until one lands.
115
+ */
104
116
  export declare const MirrorState: Schema.Struct<{
105
117
  readonly repo: Schema.String;
106
118
  readonly ref: Schema.String;
107
119
  readonly state: Schema.Literals<readonly ["active", "paused"]>;
108
- readonly paused: Schema.optionalKey<Schema.Literals<readonly ["diverged", "refused"]>>;
120
+ readonly paused: Schema.optionalKey<Schema.Literals<readonly ["diverged", "refused", "unseen"]>>;
121
+ readonly lastPushed: Schema.optionalKey<Schema.Struct<{
122
+ readonly oid: Schema.String;
123
+ readonly at: Schema.Int;
124
+ }>>;
109
125
  }>;
110
126
  export type MirrorState = typeof MirrorState.Type;
111
127
  export interface GitHubAppCredentials {
@@ -130,9 +146,7 @@ export interface SyncGitHubOptions {
130
146
  * Stops a repo's import: its job ends before its next fetch, and what it has committed stays. It
131
147
  * takes no `key`: sent again, it answers as the import's stop is.
132
148
  */
133
- export interface SyncCancelInput extends ActorInput, RepoInput {
134
- readonly git: GitServer;
135
- }
149
+ export interface SyncCancelInput extends Omit<ActorInput, 'signal'>, RepoInput {}
136
150
  /**
137
151
  * One staging ref an import left, `from`, which must be at `oid`: written to `to` and deleted, or
138
152
  * with `to` `null` only deleted, such as a closed pull's or what a failed import left. A write
@@ -150,27 +164,23 @@ export declare const ImportedMove: Schema.Union<readonly [Schema.Struct<{
150
164
  }>]>;
151
165
  export type ImportedMove = typeof ImportedMove.Type;
152
166
  /** The staging refs to move, as one atomic push. */
153
- export interface SyncPublishInput extends ActorInput, RepoInput {
154
- readonly git: GitServer;
167
+ export interface SyncPublishInput extends Omit<ActorInput, 'signal'>, RepoInput {
155
168
  readonly moves: readonly ImportedMove[];
156
169
  }
157
170
  /** The mirror of `ref` to remove, for a caller who may update the repo. */
158
- export interface SyncRemoveMirrorInput extends ActorInput, RepoInput {
159
- readonly git: GitServer;
171
+ export interface SyncRemoveMirrorInput extends Omit<ActorInput, 'signal'>, RepoInput {
160
172
  readonly ref: RefName;
161
173
  }
162
174
  /** The repo's mirrors, for a caller who may read it. */
163
- export interface SyncMirrorsInput extends ActorInput, RepoInput {
164
- readonly git: GitServer;
165
- }
175
+ export interface SyncMirrorsInput extends Omit<ActorInput, 'signal'>, RepoInput {}
166
176
  /**
167
177
  * The providers sync's jobs find by `name`, each try. A queued job whose provider has since gone
168
178
  * fails for good, naming it, with no retry.
169
179
  */
170
- export interface SyncJobsOptions {
180
+ export interface SyncLayerOptions {
171
181
  readonly providers: readonly SyncProvider[];
172
182
  }
173
- /** `git.sync.import`, keyed `import`, in the repo's scope. */
183
+ /** `sync.import`, keyed `import`, in the repo's scope. */
174
184
  export declare const ImportJobData: Schema.Struct<{
175
185
  readonly source: Schema.Struct<{
176
186
  readonly provider: Schema.String;
@@ -178,68 +188,80 @@ export declare const ImportJobData: Schema.Struct<{
178
188
  }>;
179
189
  }>;
180
190
  export type ImportJobData = typeof ImportJobData.Type;
181
- /** `git.sync.mirror`, keyed by its ref, in the repo's scope: the mirror's record names its destination. */
191
+ /** `sync.mirror`, keyed by its ref, in the repo's scope: the mirror's record names its destination. */
182
192
  export declare const MirrorJobData: Schema.Struct<{
183
193
  readonly ref: Schema.String;
184
194
  }>;
185
195
  export type MirrorJobData = typeof MirrorJobData.Type;
186
196
  /**
187
- * Where a repo's `git.sync.import` stands, as `ExtendedGit.importState` reads it: `running` while
197
+ * Where a repo's `sync.import` stands, as `JoinedCalls.importState` reads it: `running` while
188
198
  * its tries run or wait, `cancelled` once `cancelImport` stopped it, `failed` once its last try
189
199
  * failed, and `done` once its history is published. Only `done` holds the source's history.
190
200
  */
191
201
  export type ImportState = 'running' | 'cancelled' | 'failed' | 'done';
192
- /** Sync's two job definitions, which one server's build binds and registers on its queue. */
193
- export type SyncJobs = readonly [JobDefinition<'git.sync.import', ImportJobData, ImportJobData>, JobDefinition<'git.sync.mirror', MirrorJobData, MirrorJobData>];
194
- /**
195
- * Creates `repo` and copies the source into it on the queue, a push under 100 MB at a time, each
196
- * landing as `source: 'import'`, and answers once it's done, reporting each phase to `onProgress`
197
- * on the way. A failed import answers its try's error, which never carries a credential; a
198
- * cancelled one, `FAILED_PRECONDITION`, reason `import-cancelled`. `FAILED_PRECONDITION`, reason
199
- * `sync-unbound`, until `syncJobs` has bound the server's jobs.
200
- */
201
- export type ImportRepo = (input: SyncImportInput) => Promise<Result<RepoInfo>>;
202
- /**
203
- * Saves the repo's mirror of `ref` and pushes it now, then after each move, once the repo's import
204
- * has finished. A repo holds at most 1,000 mirrors: past them, a ref with no mirror yet is refused
205
- * `RESOURCE_EXHAUSTED`, reason `too-large`, until `removeMirror` frees one. A mirror whose ref and
206
- * destination take more than 4 KiB is refused `INVALID_ARGUMENT`. `FAILED_PRECONDITION`, reason
207
- * `sync-unbound`, until `syncJobs` has bound the server's jobs.
208
- */
209
- export type Mirror = (input: SyncMirrorInput) => Promise<Result<MirrorState>>;
210
- /**
211
- * Deletes the repo's mirror of `ref`: the ref's later moves push nothing, and a try already
212
- * pushing ends after its push. `NOT_FOUND` for a ref with no mirror, and for one the caller can't see;
213
- * `INVALID_ARGUMENT` for a ref Git doesn't take.
214
- * `FAILED_PRECONDITION`, reason `sync-unbound`, until `syncJobs` has bound the server's jobs.
215
- */
216
- export type RemoveMirror = (input: SyncRemoveMirrorInput) => Promise<Result<void>>;
217
- /**
218
- * Stops the repo's import before its next fetch, leaving its committed objects and refs readable,
219
- * and answers once the stop is saved; `import` then answers `import-cancelled`. `NOT_FOUND` for a
220
- * repo with no import running.
221
- */
222
- export type CancelImport = (input: SyncCancelInput) => Promise<Result<void>>;
223
- /**
224
- * Moves each staging ref `moves` names to its `to` and deletes it, in one atomic push as
225
- * `source: 'import'`, which is the only source that may write under `refs/import/`. It's for host
226
- * code that holds `git`, and no client reaches it: like a host call, it skips `authorize`, and
227
- * `actor` is who its events name.
228
- *
229
- * - `INVALID_ARGUMENT` for a `from` outside `refs/import/`, a `to` under a prefix only Git's own
230
- * writers move, such as `refs/queue/`, or two moves with one `from` or one `to`.
231
- * - Sent again after a lost answer, it does nothing more: a move whose `from` is gone is done when
232
- * its `to` is `null` or already at `oid`, and `FAILED_PRECONDITION` otherwise.
233
- * - `FAILED_PRECONDITION` for a `from` at another oid, or a `to` that's at neither its `at` nor
234
- * `oid`, naming the ref, the oid it expected and the one it found: either refuses the whole
235
- * push. The second is reason `ref-conflict`, with `ref`, `expected` and `found` in its context,
236
- * each oid `nothing` for a ref that isn't there.
237
- * - `ref.updated` tells each `to` it writes, with `source: 'import'`, and nothing of the staging
238
- * refs. `FAILED_PRECONDITION`, reason `sync-unbound`, until `syncJobs` has bound the server's jobs.
239
- */
240
- export type PublishImported = (input: SyncPublishInput) => Promise<Result<void>>;
241
- /**
242
- * The repo's mirrors, by ref: each one's state, and why a paused one stopped, so a host can show
243
- * it. `FAILED_PRECONDITION`, reason `sync-unbound`, until `syncJobs` has bound the server's jobs.
244
- */
245
- export type Mirrors = (input: SyncMirrorsInput) => Promise<Result<readonly MirrorState[]>>;
202
+ /** The feature's calls, bound to the server that built its Layer. */
203
+ export interface SyncCalls {
204
+ readonly import: (input: SyncImportInput) => Effect.Effect<RepoInfo, GitError>;
205
+ readonly cancelImport: (input: SyncCancelInput) => Effect.Effect<void, GitError>;
206
+ readonly mirror: (input: SyncMirrorInput) => Effect.Effect<MirrorState, GitError>;
207
+ readonly mirrors: (input: SyncMirrorsInput) => Effect.Effect<readonly MirrorState[], GitError>;
208
+ readonly removeMirror: (input: SyncRemoveMirrorInput) => Effect.Effect<void, GitError>;
209
+ readonly publishImported: (input: SyncPublishInput) => Effect.Effect<void, GitError>;
210
+ }
211
+ declare const Sync_base: Context.ServiceClass<Sync, "@ref0/git/Sync", SyncCalls>;
212
+ /** Import and mirroring, present only when the host composes Sync.layer. */
213
+ export declare class Sync extends /* @__PURE__ */ Sync_base {}
214
+ export declare const importRepo: (input: SyncImportInput) => Effect.Effect<{
215
+ readonly name: string;
216
+ readonly defaultBranch?: string;
217
+ readonly public: boolean;
218
+ readonly upstream?: string;
219
+ readonly stats: {
220
+ readonly repo: string;
221
+ readonly refs: number;
222
+ readonly packs?: number;
223
+ readonly packBytes?: number;
224
+ readonly ownBytes?: number;
225
+ readonly looseObjects?: number;
226
+ readonly looseBytes?: number;
227
+ readonly leavingBytes?: number;
228
+ readonly pushedAt?: number;
229
+ readonly maintainedAt?: number;
230
+ };
231
+ readonly work?: {
232
+ readonly waiting: number;
233
+ readonly oldestDue?: number;
234
+ readonly failed: number;
235
+ readonly oldestFailed?: number;
236
+ readonly index?: {
237
+ readonly state: "refused";
238
+ readonly retryAt: number;
239
+ } | {
240
+ readonly state: "too-large";
241
+ };
242
+ };
243
+ }, GitError, Sync>;
244
+ export declare const cancelImport: (input: SyncCancelInput) => Effect.Effect<void, GitError, Sync>;
245
+ export declare const mirror: (input: SyncMirrorInput) => Effect.Effect<{
246
+ readonly repo: string;
247
+ readonly ref: string;
248
+ readonly state: "active" | "paused";
249
+ readonly paused?: "diverged" | "refused" | "unseen";
250
+ readonly lastPushed?: {
251
+ readonly oid: string;
252
+ readonly at: number;
253
+ };
254
+ }, GitError, Sync>;
255
+ export declare const mirrors: (input: SyncMirrorsInput) => Effect.Effect<readonly {
256
+ readonly repo: string;
257
+ readonly ref: string;
258
+ readonly state: "active" | "paused";
259
+ readonly paused?: "diverged" | "refused" | "unseen";
260
+ readonly lastPushed?: {
261
+ readonly oid: string;
262
+ readonly at: number;
263
+ };
264
+ }[], GitError, Sync>;
265
+ export declare const removeMirror: (input: SyncRemoveMirrorInput) => Effect.Effect<void, GitError, Sync>;
266
+ export declare const publishImported: (input: SyncPublishInput) => Effect.Effect<void, GitError, Sync>;
267
+ export {};