@ref0/git 0.11.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (262) hide show
  1. package/dist/access/private-refs.mjs +8 -7
  2. package/dist/auth/auth.d.mts +2 -2
  3. package/dist/auth/auth.mjs +3 -6
  4. package/dist/auth/authorize.mjs +1 -17
  5. package/dist/auth/helpers.mjs +3 -11
  6. package/dist/auth/host-services.mjs +11 -0
  7. package/dist/auth/policy.d.mts +27 -7
  8. package/dist/auth/policy.mjs +8 -4
  9. package/dist/auth/tokens-layer.d.mts +1 -2
  10. package/dist/auth/tokens-layer.mjs +2 -3
  11. package/dist/auth/tokens-public.d.mts +3 -3
  12. package/dist/auth/tokens.d.mts +1 -8
  13. package/dist/auth/tokens.mjs +1 -8
  14. package/dist/auth.d.mts +1 -4
  15. package/dist/auth.mjs +1 -3
  16. package/dist/client/git-http.mjs +18 -4
  17. package/dist/client/push-upload.mjs +33 -7
  18. package/dist/client/remote.mjs +94 -28
  19. package/dist/client/slice-push.d.mts +1 -1
  20. package/dist/contracts/access.d.mts +8 -8
  21. package/dist/contracts/actors.d.mts +2 -34
  22. package/dist/contracts/blobs.d.mts +2 -2
  23. package/dist/contracts/client.d.mts +8 -3
  24. package/dist/contracts/commits.d.mts +10 -2
  25. package/dist/contracts/commits.mjs +9 -1
  26. package/dist/contracts/files.d.mts +2 -2
  27. package/dist/contracts/forks.d.mts +14 -3
  28. package/dist/contracts/git.d.mts +41 -12
  29. package/dist/contracts/git.mjs +3 -2
  30. package/dist/contracts/lfs.d.mts +0 -7
  31. package/dist/contracts/objects.d.mts +80 -10
  32. package/dist/contracts/operations.d.mts +3 -0
  33. package/dist/contracts/operations.mjs +12 -2
  34. package/dist/contracts/push-uploads.d.mts +44 -5
  35. package/dist/contracts/push-uploads.mjs +7 -3
  36. package/dist/contracts/refs.d.mts +28 -6
  37. package/dist/contracts/remote.mjs +1 -3
  38. package/dist/contracts/repo-records.d.mts +1 -0
  39. package/dist/contracts/repos.d.mts +90 -2
  40. package/dist/contracts/repos.mjs +29 -2
  41. package/dist/contracts/result.d.mts +30 -23
  42. package/dist/contracts/result.mjs +24 -9
  43. package/dist/contracts/rules.d.mts +22 -22
  44. package/dist/contracts/server.d.mts +28 -77
  45. package/dist/contracts/signin.d.mts +1 -1
  46. package/dist/contracts/sync.d.mts +90 -19
  47. package/dist/contracts/sync.mjs +34 -10
  48. package/dist/contracts/tokens.d.mts +1 -6
  49. package/dist/contracts/tokens.mjs +1 -2
  50. package/dist/contracts/topics.d.mts +0 -5
  51. package/dist/contracts/work.d.mts +66 -2
  52. package/dist/contracts/work.mjs +8 -1
  53. package/dist/core/access.d.mts +1 -0
  54. package/dist/core/access.mjs +34 -13
  55. package/dist/core/ancestry.d.mts +9 -0
  56. package/dist/core/ancestry.mjs +6 -6
  57. package/dist/core/asked.mjs +68 -0
  58. package/dist/core/call-names.mjs +1 -0
  59. package/dist/core/call-services.mjs +2 -1
  60. package/dist/core/events/deliver.d.mts +1 -0
  61. package/dist/core/events/deliver.mjs +15 -3
  62. package/dist/core/forks.mjs +42 -16
  63. package/dist/core/imports.mjs +156 -13
  64. package/dist/core/index-job.mjs +9 -6
  65. package/dist/core/job-view.mjs +8 -9
  66. package/dist/core/mirror-rows.mjs +19 -4
  67. package/dist/core/objects/commits.mjs +16 -6
  68. package/dist/core/objects/reading.mjs +17 -9
  69. package/dist/core/parts.d.mts +8 -2
  70. package/dist/core/parts.mjs +1 -4
  71. package/dist/core/purge.mjs +76 -6
  72. package/dist/core/push-decide.mjs +1 -1
  73. package/dist/core/push-files.d.mts +12 -0
  74. package/dist/core/push-files.mjs +225 -0
  75. package/dist/core/push-repo.d.mts +8 -0
  76. package/dist/core/push-repo.mjs +56 -0
  77. package/dist/core/push.d.mts +17 -0
  78. package/dist/core/push.mjs +107 -32
  79. package/dist/core/receipts.mjs +26 -10
  80. package/dist/core/ref-view.mjs +59 -5
  81. package/dist/core/refs.mjs +18 -10
  82. package/dist/core/registered-rows.mjs +7 -5
  83. package/dist/core/repack.mjs +16 -11
  84. package/dist/core/repo-info.mjs +16 -9
  85. package/dist/core/repos.mjs +30 -14
  86. package/dist/core/saved-caller-views.d.mts +18 -0
  87. package/dist/core/saved-caller-views.mjs +17 -4
  88. package/dist/core/saved-callers-public.d.mts +3 -3
  89. package/dist/core/saved-callers-public.mjs +3 -2
  90. package/dist/core/saved-callers.d.mts +7 -0
  91. package/dist/core/seam.mjs +2 -2
  92. package/dist/core/view.d.mts +6 -0
  93. package/dist/core/view.mjs +45 -12
  94. package/dist/core/work.mjs +47 -22
  95. package/dist/effect.d.mts +3 -1
  96. package/dist/effect.mjs +3 -1
  97. package/dist/engine/reads.mjs +13 -6
  98. package/dist/engine/walk.mjs +4 -4
  99. package/dist/event-streams/event-streams.d.mts +1 -1
  100. package/dist/event-streams/event-streams.mjs +1 -1
  101. package/dist/event-streams/stream.d.mts +1 -1
  102. package/dist/event-streams/stream.mjs +1 -1
  103. package/dist/extend.d.mts +4 -3
  104. package/dist/extend.mjs +3 -2
  105. package/dist/http/answers.mjs +4 -2
  106. package/dist/http/core-parts.mjs +64 -15
  107. package/dist/http/handler.mjs +2 -2
  108. package/dist/http/node.mjs +5 -4
  109. package/dist/http/parts.d.mts +1 -0
  110. package/dist/http/push-upload-job.mjs +503 -0
  111. package/dist/http/push-uploads.d.mts +1 -0
  112. package/dist/http/push-uploads.mjs +120 -59
  113. package/dist/http/upload-pack.mjs +7 -6
  114. package/dist/index.d.mts +23 -24
  115. package/dist/index.mjs +4 -7
  116. package/dist/lfs/base.d.mts +7 -3
  117. package/dist/lfs/base.mjs +2 -1
  118. package/dist/lfs/copy.d.mts +46 -0
  119. package/dist/lfs/copy.mjs +26 -0
  120. package/dist/lfs/layer.mjs +4 -2
  121. package/dist/lfs/locks.mjs +14 -9
  122. package/dist/lfs/objects.d.mts +6 -0
  123. package/dist/lfs/objects.mjs +95 -61
  124. package/dist/lfs/rows.d.mts +13 -0
  125. package/dist/lfs/service.d.mts +1 -7
  126. package/dist/lfs/service.mjs +1 -9
  127. package/dist/lfs/upload-most.mjs +5 -5
  128. package/dist/node.d.mts +2 -2
  129. package/dist/protocol/bytes/sha256-hasher.d.mts +15 -0
  130. package/dist/protocol/bytes/sha256.d.mts +32 -0
  131. package/dist/protocol/bytes/sha256.mjs +105 -49
  132. package/dist/protocol/wire/advertisement.mjs +9 -4
  133. package/dist/protocol/wire/lines.d.mts +4 -2
  134. package/dist/protocol/wire/lines.mjs +11 -5
  135. package/dist/protocol/wire/push-uploads.mjs +13 -1
  136. package/dist/protocol/wire/v2.mjs +2 -2
  137. package/dist/protocol.d.mts +3 -1
  138. package/dist/protocol.mjs +3 -1
  139. package/dist/queue/advance.mjs +1 -1
  140. package/dist/queue/calls.mjs +21 -1
  141. package/dist/queue/host.d.mts +1 -7
  142. package/dist/queue/host.mjs +1 -7
  143. package/dist/queue/layer.mjs +1 -1
  144. package/dist/queue/trim.mjs +1 -1
  145. package/dist/rest/blobs.d.mts +16 -8
  146. package/dist/rest/blobs.mjs +1 -1
  147. package/dist/rest/caller.d.mts +49 -9
  148. package/dist/rest/caller.mjs +1 -1
  149. package/dist/rest/client.d.mts +10 -3
  150. package/dist/rest/client.mjs +4 -0
  151. package/dist/rest/commits.d.mts +272 -239
  152. package/dist/rest/errors.d.mts +24 -4
  153. package/dist/rest/events.d.mts +9 -6
  154. package/dist/rest/events.mjs +1 -2
  155. package/dist/rest/files.d.mts +112 -100
  156. package/dist/rest/forks.d.mts +146 -122
  157. package/dist/rest/handler.mjs +4 -57
  158. package/dist/rest/handlers.d.mts +1 -1
  159. package/dist/rest/handlers.mjs +18 -4
  160. package/dist/rest/layer.mjs +10 -2
  161. package/dist/rest/me.d.mts +8 -4
  162. package/dist/rest/merges.d.mts +8 -4
  163. package/dist/rest/paths.mjs +1 -0
  164. package/dist/rest/queue.d.mts +292 -236
  165. package/dist/rest/refs.d.mts +98 -69
  166. package/dist/rest/repos.d.mts +133 -105
  167. package/dist/rest/tags.d.mts +100 -88
  168. package/dist/rest/tokens.d.mts +192 -168
  169. package/dist/rest/topics.d.mts +154 -134
  170. package/dist/rest/trees.d.mts +32 -16
  171. package/dist/rest/work.d.mts +467 -20
  172. package/dist/rest/work.mjs +8 -0
  173. package/dist/server/edge-node.d.mts +9 -13
  174. package/dist/server/edge-node.mjs +9 -12
  175. package/dist/server/git-layer.d.mts +1 -6
  176. package/dist/server/git-layer.mjs +2 -2
  177. package/dist/server/git-namespace.d.mts +4 -4
  178. package/dist/server/joined.d.mts +15 -22
  179. package/dist/server/joined.mjs +5 -29
  180. package/dist/server/lifecycle.mjs +107 -23
  181. package/dist/server/registry.mjs +9 -1
  182. package/dist/server/server.mjs +139 -216
  183. package/dist/storage/budget.mjs +2 -2
  184. package/dist/storage/clean-up.mjs +13 -10
  185. package/dist/storage/fetch.mjs +13 -8
  186. package/dist/storage/file-limits.mjs +24 -0
  187. package/dist/storage/index-build.d.mts +1 -0
  188. package/dist/storage/index-build.mjs +106 -62
  189. package/dist/storage/index-fetch.mjs +16 -3
  190. package/dist/storage/index-reach.mjs +33 -5
  191. package/dist/storage/index-remap.mjs +8 -1
  192. package/dist/storage/index-shallow.mjs +5 -3
  193. package/dist/storage/largest-files.mjs +48 -0
  194. package/dist/storage/lfs-pointers.mjs +10 -1
  195. package/dist/storage/loose.mjs +3 -1
  196. package/dist/storage/memory-budget.mjs +154 -8
  197. package/dist/storage/merge-cut.mjs +5 -4
  198. package/dist/storage/pack-reads.mjs +246 -34
  199. package/dist/storage/pack-receive.mjs +83 -25
  200. package/dist/storage/packs.mjs +37 -21
  201. package/dist/storage/prune-keep.mjs +203 -34
  202. package/dist/storage/prune-seen.mjs +11 -6
  203. package/dist/storage/prune-walk.mjs +219 -81
  204. package/dist/storage/prune.mjs +629 -196
  205. package/dist/storage/push-uploads.mjs +36 -12
  206. package/dist/storage/quarantine.mjs +9 -7
  207. package/dist/storage/ready.mjs +47 -19
  208. package/dist/storage/receive-bounds.mjs +29 -8
  209. package/dist/storage/receive-state.mjs +8 -0
  210. package/dist/storage/receive-steps.mjs +71 -18
  211. package/dist/storage/repack.d.mts +1 -1
  212. package/dist/storage/repack.mjs +1 -8
  213. package/dist/storage/rows.mjs +12 -1
  214. package/dist/storage/shallow.d.mts +1 -0
  215. package/dist/storage/shallow.mjs +26 -4
  216. package/dist/storage/stream-whole.mjs +5 -2
  217. package/dist/storage/visible.mjs +29 -1
  218. package/dist/storage/walk.mjs +2 -1
  219. package/dist/store/catalogue.mjs +1 -0
  220. package/dist/store/cursor-seal-namespace.d.mts +2 -0
  221. package/dist/store/cursor-seal-public.d.mts +5 -0
  222. package/dist/store/cursor-seal-public.mjs +5 -0
  223. package/dist/store/cursor-seal.d.mts +16 -2
  224. package/dist/store/cursor-seal.mjs +26 -14
  225. package/dist/store/errors.mjs +9 -1
  226. package/dist/store/records.d.mts +2 -0
  227. package/dist/store/records.mjs +9 -6
  228. package/dist/store/repo-record.d.mts +27 -0
  229. package/dist/store/repo-record.mjs +141 -4
  230. package/dist/store/scopes.mjs +10 -2
  231. package/dist/sync/bound.d.mts +2 -0
  232. package/dist/sync/bound.mjs +11 -2
  233. package/dist/sync/github.d.mts +6 -1
  234. package/dist/sync/github.mjs +63 -42
  235. package/dist/sync/http.mjs +36 -1
  236. package/dist/sync/import.mjs +4 -2
  237. package/dist/sync/layer.mjs +6 -2
  238. package/dist/sync/lfs-batch.mjs +119 -0
  239. package/dist/sync/lfs-copy.mjs +251 -0
  240. package/dist/sync/mirror.mjs +227 -147
  241. package/dist/sync/said.mjs +204 -0
  242. package/dist/sync/smart-http.mjs +4 -2
  243. package/dist/sync/step.mjs +33 -13
  244. package/dist/sync/tries.mjs +71 -24
  245. package/dist/sync.d.mts +2 -2
  246. package/dist/topics/advance.mjs +10 -3
  247. package/dist/topics/host.mjs +1 -19
  248. package/dist/topics/layer.mjs +1 -1
  249. package/package.json +3 -8
  250. package/dist/auth/bridge.mjs +0 -30
  251. package/dist/auth/helpers.d.mts +0 -17
  252. package/dist/core/purge.d.mts +0 -8
  253. package/dist/core/registered-rows.d.mts +0 -4
  254. package/dist/core/repack.d.mts +0 -11
  255. package/dist/http/handler.d.mts +0 -2
  256. package/dist/rest/handler.d.mts +0 -21
  257. package/dist/rest.d.mts +0 -2
  258. package/dist/rest.mjs +0 -1
  259. package/dist/server/registry.d.mts +0 -16
  260. package/dist/server/server.d.mts +0 -36
  261. package/dist/storage/repack-job.d.mts +0 -3
  262. package/dist/topics/host.d.mts +0 -7
@@ -1,30 +1,27 @@
1
1
  import { Duration } from "./promises.mjs";
2
- import { AccessOption } from "./access.mjs";
3
2
  import { Authorize } from "./authorize.mjs";
4
- import { Caller, GitAuth, GitAuthorize } from "./actors.mjs";
3
+ import { Caller } from "./actors.mjs";
5
4
  import { BlobCalls, Blobs } from "./blobs.mjs";
6
5
  import { CommitCalls, Commits } from "./commits.mjs";
7
6
  import { Events } from "./events.mjs";
8
7
  import { FileCalls, Files } from "./files.mjs";
9
8
  import { ForkCalls, Forks } from "./forks.mjs";
10
- import { LfsCalls, LfsFeature } from "./lfs.mjs";
9
+ import { LfsCalls } from "./lfs.mjs";
11
10
  import { MergeCalls } from "./merges.mjs";
12
- import { EffectiveLimits, IndexedObjectsFactory, ObjectsFactory } from "./objects.mjs";
13
- import { MergeQueueCalls, MergeQueueLayerOptions } from "./queue.mjs";
11
+ import { EffectiveLimits } from "./objects.mjs";
14
12
  import { PushOptions } from "./push-uploads.mjs";
13
+ import { MergeQueueCalls } from "./queue.mjs";
15
14
  import { RefCalls, Refs } from "./refs.mjs";
16
15
  import { RepoCalls, Repos } from "./repos.mjs";
17
16
  import { RepoRecords } from "./repo-records.mjs";
18
17
  import { TagCalls, Tags } from "./tags.mjs";
19
18
  import { TreeCalls, Trees } from "./trees.mjs";
20
- import { GitError, Result } from "./result.mjs";
21
- import { FetchRule, PushRule, Rules } from "./rules.mjs";
22
- import { SignInLayerOptions } from "./signin.mjs";
23
- import { TokenCalls, TokensFeature } from "./tokens.mjs";
19
+ import { Result } from "./result.mjs";
20
+ import { Rules } from "./rules.mjs";
21
+ import { TokenCalls } from "./tokens.mjs";
24
22
  import { Work, WorkCalls } from "./work.mjs";
25
- import { TopicCalls, TopicsFactory } from "./topics.mjs";
26
- import * as Effect from "effect/Effect";
27
- import { Bucket, CallLimits, JobQueue, Records } from "@ref0/infra";
23
+ import { TopicCalls } from "./topics.mjs";
24
+ import { CallLimits, JobQueue, Records } from "@ref0/infra";
28
25
  import * as Layer from "effect/Layer";
29
26
  import * as ManagedRuntime from "effect/ManagedRuntime";
30
27
  /** The call modules' services, which a server's runtime holds, each deciding for its `by`. */
@@ -42,45 +39,12 @@ export type GitNeeds = Records.Records | JobQueue.JobQueue | CallLimits.CallLimi
42
39
  export type GitAdapter = Layer.Layer<never, Error> | readonly Layer.Layer<never, Error>[];
43
40
  /** What `adapter` gives. */
44
41
  export type ProvidedBy<A extends GitAdapter> = A extends readonly (infer L extends Layer.Any)[] ? Layer.Success<L> : A extends Layer.Any ? Layer.Success<A> : never;
45
- /** Each piece adds its own options: C's are these. */
46
- export interface GitServerOptions<A extends GitAdapter = GitAdapter> {
47
- readonly adapter: A;
48
- readonly objects: ObjectsFactory;
49
- /**
50
- * `xdiff.wasm` compiled, which the server runs `Merges` on: its trees' merges, reverts, picks,
51
- * merge queue, comparisons' line counts and diffs' patches. Left out, those refuse with
52
- * `FAILED_PRECONDITION`, `merges-off`, a comparison counts no lines, and `queue` is refused at
53
- * start. A module that won't load fails the server's build. A Worker imports
54
- * `@ref0/xdiff-wasm/xdiff.wasm`, and a host on Node passes `await xdiff()` from `@ref0/xdiff-wasm/node`.
55
- */
56
- readonly xdiff?: WebAssembly.Module;
57
- readonly tokens?: TokensFeature;
58
- /**
59
- * `MergeQueue.layer`'s options, one queue every repo has, as `mergeQueue(…)` checks it, or a
60
- * function of the repo: `git.queue`,
61
- * its jobs and its events, and `-o queue`. A bridge, as `xdiff` is: the server wires the queue
62
- * over them itself, as `MergeQueue.layer` does under `Git.layer`, and it goes with
63
- * `createGitServer`.
64
- */
65
- readonly queue?: MergeQueueLayerOptions;
66
- /**
67
- * `lfs()`: `Lfs.layer()`, Git LFS's API under `info/lfs`, its upkeep, purge and pointer check,
68
- * with its objects in the adapter's bucket. Without it, a server with a bucket has no LFS.
69
- */
70
- readonly lfs?: LfsFeature;
71
- /** `topics()`: `git.topics`, their jobs and their events, across the repos a `queue` has. */
72
- readonly topics?: TopicsFactory;
73
- /** Serves GitHub's device flow and the web flow at `/login/...`; needs `tokens`. */
74
- readonly signIn?: SignInLayerOptions;
75
- readonly auth?: GitAuth;
76
- readonly authorize?: GitAuthorize;
77
- /**
78
- * The host's push and fetch rules, each a rule or an Effect that builds one, as `Rules.layer`
79
- * takes them: they run in this order, before any a package built on Git adds. An Effect that
80
- * fails fails the server's build. The adapter must not provide `Rules`: pass them here instead.
81
- * Until 2a's `Git.layer`, and gone in 2c.
82
- */
83
- readonly rules?: readonly (PushRule | FetchRule | Effect.Effect<PushRule | FetchRule, GitError>)[];
42
+ /**
43
+ * `Git.layer`'s options: settings only (Q834, Q1006), with a platform's `maxDuration` (Q1190), and
44
+ * the sizes a pushed file and its repo are held to, `pushes.files` and `pushes.repo` (#2395). Push
45
+ * uploads are `Git.layerUploads`'.
46
+ */
47
+ export interface GitOptions {
84
48
  readonly basePath?: string;
85
49
  /**
86
50
  * The most one fetch may send and how long it may stream: Git's HTTP limits each fetch by them,
@@ -91,35 +55,18 @@ export interface GitServerOptions<A extends GitAdapter = GitAdapter> {
91
55
  * doesn't bound. A host may lower it as far as `pruneFloor`, an hour, never below.
92
56
  */
93
57
  readonly fetchLimits?: EffectiveLimits;
94
- /** A large push's pack straight to the bucket: off unless set, and a bucket that signs parts. */
95
- readonly pushes?: PushOptions;
96
58
  /**
97
59
  * The route's own limit, such as `'60 seconds'`, counted from each request's start. A pack that
98
60
  * would run past it ends 5 seconds before, or a tenth of a shorter limit, on side-band 3, naming
99
61
  * the limit and `git clone --depth 1`. With none, a pack runs to its end.
100
62
  */
101
63
  readonly maxDuration?: Duration;
64
+ /**
65
+ * The sizes a pushed file and its repo are held to, as `PushFileOptions` and `PushRepoOptions`
66
+ * say.
67
+ */
68
+ readonly pushes?: Pick<PushOptions, 'files' | 'repo'>;
102
69
  }
103
- /**
104
- * `access`, private branches from `PrivateRefs.layer`, only over objects that keep the
105
- * reachability index, `packs()`: a caller's view of a repo's objects is read from it.
106
- */
107
- type AccessSetup = {
108
- readonly access?: undefined;
109
- } | {
110
- readonly access: AccessOption;
111
- readonly objects: IndexedObjectsFactory;
112
- };
113
- /**
114
- * `packs()` and `lfs()` need a `Bucket`; `loose()` doesn't. Only `packs()` takes `access`. An adapter that
115
- * gives no `Records`, `JobQueue` or `CallLimits` is refused.
116
- */
117
- export type ServerSetup<A extends GitAdapter = GitAdapter> = GitServerOptions<A> & ([GitNeeds] extends [ProvidedBy<A>] ? [Bucket.Bucket] extends [ProvidedBy<A>] ? unknown : {
118
- readonly objects: ObjectsFactory<false>;
119
- readonly lfs?: never;
120
- } : {
121
- readonly adapter: never;
122
- }) & AccessSetup;
123
70
  /** Each piece adds its own groups: C's, RD's objects, Q's `queue` and TP's `topics`. */
124
71
  export interface ServerCalls {
125
72
  readonly repos: RepoCalls;
@@ -146,8 +93,13 @@ export interface GitServer<R = never> extends ServerCalls {
146
93
  readonly identify: (request: Request) => Promise<Result<Caller>>;
147
94
  /**
148
95
  * The isolate's runtime, over the adapter's Layers and Git's own wiring, which registers Git's
149
- * jobs on the adapter's queue: built at most once, starting as the tick that made the server
150
- * ends, so a joined Layer joins in that tick, and a module that only runs jobs has them. A failed build stays failed: every call answers `UNAVAILABLE`, and `fetch` a 503. It
96
+ * jobs on the adapter's queue: built starting as the tick that made the server ends, so a joined
97
+ * Layer joins in that tick, and a module that only runs jobs has them. A build that fails on
98
+ * weather in the adapter's Layers, before Git's wiring, is built again on a new runtime by the
99
+ * first call once its wait has passed: 1 s, doubling to 30 s, each call before it answering
100
+ * `UNAVAILABLE`, reason `starting`, and `fetch` a 503 with `Retry-After`. Any other failed build
101
+ * stays failed: every call answers `UNAVAILABLE`, and `fetch` a 503. Read it again after a
102
+ * failed build, since the next is another. It
151
103
  * holds `RepoRecords`, `Authorize`, `Refs`, `Rules`, `Events` and the call modules' services beside
152
104
  * `R`, the adapter's services, and `Tokens` with `tokens`, for an Effect host to read. Named here, so a host's inferred server type names only
153
105
  * its adapter's services. The bridge until SV's step 2c.
@@ -155,5 +107,4 @@ export interface GitServer<R = never> extends ServerCalls {
155
107
  readonly runtime: ManagedRuntime.ManagedRuntime<R | RepoRecords | Authorize | Refs | Rules | Events | CallServices, Error>;
156
108
  /** Disposes `runtime`. */
157
109
  readonly close: () => Promise<void>;
158
- }
159
- export {};
110
+ }
@@ -18,7 +18,7 @@ export declare const OAuthClient: Schema.Struct<{
18
18
  export type OAuthClient = typeof OAuthClient.Type;
19
19
  /**
20
20
  * Turns on sign-in: GitHub's device flow, which also accepts `gh`'s client ID, and the web flow for
21
- * `clients`, both approved on the host's `approvalPage`. Needs `tokens()`, which mints the token.
21
+ * `clients`, both approved on the host's `approvalPage`. Needs `Tokens.layer()`, which mints the token.
22
22
  */
23
23
  export interface SignInLayerOptions {
24
24
  readonly clients?: readonly OAuthClient[];
@@ -6,11 +6,18 @@ import { RepoInfo, RepoInput } from "./repos.mjs";
6
6
  import * as Effect from "effect/Effect";
7
7
  import * as Schema from "effect/Schema";
8
8
  import * as Context from "effect/Context";
9
+ /**
10
+ * A sync remote's sender of one request, in place of Git's own client: an Effect, run in the try's
11
+ * fiber, so Git charges each call of it to the try's `CallBudget` as one subrequest before it
12
+ * runs, and a request it sends again, as a retry, charges that one itself, through
13
+ * `CallBudget.charged`. A failure is the remote's: the try fails, and the job tries again.
14
+ */
15
+ export declare const SyncTransport: Schema.declare<(request: Request) => Effect.Effect<Response, GitError>, (request: Request) => Effect.Effect<Response, GitError>>;
16
+ export type SyncTransport = typeof SyncTransport.Type;
9
17
  /**
10
18
  * A remote as one try reaches it. Its `credentials` are short-lived: a provider makes them again
11
19
  * for each try, and Git never stores or logs them. `transport` sends its requests in place of
12
- * `fetch`, as the client's `RemoteOptions` does: a service binding's, say, or another server's
13
- * own `fetch`.
20
+ * Git's client: a service binding's `fetch`, say, or another server's own.
14
21
  */
15
22
  export declare const SyncRemote: Schema.Struct<{
16
23
  readonly url: Schema.String;
@@ -20,7 +27,7 @@ export declare const SyncRemote: Schema.Struct<{
20
27
  }>, Schema.Struct<{
21
28
  readonly token: Schema.String;
22
29
  }>]>, Schema.declare<(input: CredentialInput) => Awaitable<ClientCredential>, (input: CredentialInput) => Awaitable<ClientCredential>>]>>;
23
- readonly transport: Schema.optionalKey<Schema.declare<(request: Request) => Promise<Response>, (request: Request) => Promise<Response>>>;
30
+ readonly transport: Schema.optionalKey<Schema.declare<(request: Request) => Effect.Effect<Response, GitError>, (request: Request) => Effect.Effect<Response, GitError>>>;
24
31
  }>;
25
32
  export type SyncRemote = typeof SyncRemote.Type;
26
33
  /** What a provider's webhook says moved: `repo` is the provider's own name for the remote. */
@@ -32,14 +39,27 @@ export declare const SyncTrigger: Schema.Struct<{
32
39
  export type SyncTrigger = typeof SyncTrigger.Type;
33
40
  /**
34
41
  * A kind of remote, as the host sets it up once: `smartHttp()` or `github({ app })`. `remote`
35
- * answers the URL and fresh credentials for one of its repos, and runs again at every try: one
36
- * that throws, or answers no credentials where the remote asks for them, fails that try, and the
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.
42
+ * answers the URL and fresh credentials for one of its repos, and runs again at every try, in the
43
+ * try's fiber, so a request it sends to mint them is charged to the try's `CallBudget` through
44
+ * `CallBudget.charged`. One that fails or dies, or answers no credentials where the remote asks for
45
+ * them, fails that try, and the job's retry tries again; interrupting the try interrupts it.
46
+ * `access` is what the try does there: an import's reads, a mirror's pushes, so a provider mints
47
+ * credentials for that and no more.
39
48
  */
40
49
  export interface SyncProvider {
41
50
  readonly name: string;
42
- readonly remote: (repo: string, access: 'read' | 'write', signal?: AbortSignal) => Promise<SyncRemote>;
51
+ readonly remote: (repo: string, access: 'read' | 'write') => Effect.Effect<SyncRemote, GitError>;
52
+ /**
53
+ * The top-level string fields of its remote's JSON refusal, status 400 or more, that a sync
54
+ * error may keep, such as `['message']`: each one the remote never fills with the request's
55
+ * credential. Their text is kept in the error's message as one line of at most 256 UTF-16
56
+ * units, every credential-shaped string redacted first: the request's own credential and its
57
+ * parts as they are, JSON-escaped, in base64 and in any percent-encoding's spelling, then token
58
+ * prefixes, authorization values, URL userinfo and any run of 32 or more base64 or hex
59
+ * characters, a commit's ID too. The rest of the body, `ERR` lines and fatal bands are dropped,
60
+ * as they are with none. A body is read only until the try stops.
61
+ */
62
+ readonly keptFields?: readonly string[];
43
63
  /**
44
64
  * Checks a webhook's request: the push it signed, `undefined` for a request the remote didn't
45
65
  * send or no push, and `RESOURCE_EXHAUSTED` for a body longer than the remote sends. It reads the
@@ -63,12 +83,15 @@ export type SyncSource = typeof SyncSource.Type;
63
83
  * a host such as the GitHub drop-in publishes from the pull's record with `publishImported`.
64
84
  */
65
85
  export declare const importedPullRefs = "refs/import/pull/";
66
- /** An import's phases, in order: `fetch` from the remote, `receive` into the repo, `publish` its refs. */
67
- export declare const ImportPhase: Schema.Literals<readonly ["fetch", "receive", "publish"]>;
86
+ /**
87
+ * An import's phases, in order: `fetch` from the remote, `receive` into the repo, copy its Git LFS
88
+ * objects, `lfs`, on a server with `Lfs.layer`, and `publish` its refs.
89
+ */
90
+ export declare const ImportPhase: Schema.Literals<readonly ["fetch", "receive", "lfs", "publish"]>;
68
91
  export type ImportPhase = typeof ImportPhase.Type;
69
92
  /** At most four measures, as `context.progress` takes them. */
70
93
  export declare const ImportProgress: Schema.Struct<{
71
- readonly phase: Schema.Literals<readonly ["fetch", "receive", "publish"]>;
94
+ readonly phase: Schema.Literals<readonly ["fetch", "receive", "lfs", "publish"]>;
72
95
  readonly measures: Schema.$Array<Schema.Struct<{
73
96
  readonly unit: Schema.Literals<readonly ["bytes", "objects", "entries", "packs"]>;
74
97
  readonly completed: Schema.Number;
@@ -94,11 +117,17 @@ export interface SyncImportInput extends Omit<WriteInput, 'signal'> {
94
117
  * for a paused mirror, it resumes it. A `destination` naming a provider `Sync.layer` wasn't given is
95
118
  * refused `INVALID_ARGUMENT`, reason `provider-unknown`, and so is a `ref` only Git's own writers
96
119
  * move, such as one under `refs/queue/` or `refs/import/`. It takes no `key`: sent again, it saves
97
- * the same mirror.
120
+ * the same mirror, as this call says, so one sent without `deletes` deletes no more.
98
121
  */
99
122
  export interface SyncMirrorInput extends Omit<ActorInput, 'signal'>, RepoInput {
100
123
  readonly destination: SyncSource;
101
124
  readonly ref?: RefName;
125
+ /**
126
+ * Deletes the upstream's ref once `ref` is deleted here, as `git push --mirror` does, while the
127
+ * upstream is still at the mirror's last push: one pushed there since pauses it `diverged`.
128
+ * Left out, the upstream keeps its copy.
129
+ */
130
+ readonly deletes?: boolean;
102
131
  }
103
132
  /**
104
133
  * Why a mirror stopped: `diverged`, the upstream holds commits the ref doesn't; `refused`, the
@@ -110,16 +139,18 @@ export interface SyncMirrorInput extends Omit<ActorInput, 'signal'>, RepoInput {
110
139
  export declare const MirrorPause: Schema.Literals<readonly ["diverged", "refused", "unseen"]>;
111
140
  export type MirrorPause = typeof MirrorPause.Type;
112
141
  /**
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.
142
+ * A mirror of `ref`: `active`, or `paused` and why, and `deletes` when `mirror` saved it so, left
143
+ * out otherwise. `lastPushed` is the last push its upstream took, kept across pauses and resumes to
144
+ * the same destination, and left out until one lands.
115
145
  */
116
146
  export declare const MirrorState: Schema.Struct<{
117
147
  readonly repo: Schema.String;
118
148
  readonly ref: Schema.String;
119
149
  readonly state: Schema.Literals<readonly ["active", "paused"]>;
150
+ readonly deletes: Schema.optionalKey<Schema.Literal<true>>;
120
151
  readonly paused: Schema.optionalKey<Schema.Literals<readonly ["diverged", "refused", "unseen"]>>;
121
152
  readonly lastPushed: Schema.optionalKey<Schema.Struct<{
122
- readonly oid: Schema.String;
153
+ readonly oid: Schema.NullOr<Schema.String>;
123
154
  readonly at: Schema.Int;
124
155
  }>>;
125
156
  }>;
@@ -188,9 +219,15 @@ export declare const ImportJobData: Schema.Struct<{
188
219
  }>;
189
220
  }>;
190
221
  export type ImportJobData = typeof ImportJobData.Type;
191
- /** `sync.mirror`, keyed by its ref, in the repo's scope: the mirror's record names its destination. */
222
+ /**
223
+ * `sync.mirror`, one a destination, in the repo's scope, keyed by the destination's digest: each
224
+ * try pushes every ref whose mirror names it.
225
+ */
192
226
  export declare const MirrorJobData: Schema.Struct<{
193
- readonly ref: Schema.String;
227
+ readonly destination: Schema.Struct<{
228
+ readonly provider: Schema.String;
229
+ readonly repo: Schema.String;
230
+ }>;
194
231
  }>;
195
232
  export type MirrorJobData = typeof MirrorJobData.Type;
196
233
  /**
@@ -199,6 +236,37 @@ export type MirrorJobData = typeof MirrorJobData.Type;
199
236
  * failed, and `done` once its history is published. Only `done` holds the source's history.
200
237
  */
201
238
  export type ImportState = 'running' | 'cancelled' | 'failed' | 'done';
239
+ /** Why an import kept no copy of a Git LFS object its history points at. */
240
+ export declare const ImportLfsReason: Schema.Literals<readonly ["not-found", "refused", "other-bytes", "too-large", "no-lfs"]>;
241
+ export type ImportLfsReason = typeof ImportLfsReason.Type;
242
+ /**
243
+ * An LFS object the source didn't give, `ImportStatus.lfs.missed` names: `not-found` where the
244
+ * source's batch said it holds none, `refused` where it answered another error for it, as one
245
+ * past its own size limit, `other-bytes` where the bytes it sent weren't the oid's, `too-large`
246
+ * where the pointer names more than LFS keeps, and `no-lfs` where the source serves no LFS API.
247
+ * The repo answers it as one never uploaded.
248
+ */
249
+ export interface ImportLfsMissed {
250
+ readonly oid: string;
251
+ readonly size: number;
252
+ readonly reason: ImportLfsReason;
253
+ }
254
+ /**
255
+ * A repo's import as `JoinedCalls.importState` reads it: its `state`, and, on a server with
256
+ * `Lfs.layer`, the Git LFS objects its history points at that it has copied, `copied` of them
257
+ * and `bytes`, and those it couldn't, `missing`, the first `importLfsMissedMost` of them by oid in
258
+ * `missed`. An import whose source misses an object still completes: the pointer is published,
259
+ * and the object answers 404, as it did at the source.
260
+ */
261
+ export interface ImportStatus {
262
+ readonly state: ImportState;
263
+ readonly lfs?: {
264
+ readonly copied: number;
265
+ readonly bytes: number;
266
+ readonly missing: number;
267
+ readonly missed: readonly ImportLfsMissed[];
268
+ };
269
+ }
202
270
  /** The feature's calls, bound to the server that built its Layer. */
203
271
  export interface SyncCalls {
204
272
  readonly import: (input: SyncImportInput) => Effect.Effect<RepoInfo, GitError>;
@@ -216,6 +284,7 @@ export declare const importRepo: (input: SyncImportInput) => Effect.Effect<{
216
284
  readonly defaultBranch?: string;
217
285
  readonly public: boolean;
218
286
  readonly upstream?: string;
287
+ readonly shallow: boolean;
219
288
  readonly stats: {
220
289
  readonly repo: string;
221
290
  readonly refs: number;
@@ -243,9 +312,10 @@ export declare const mirror: (input: SyncMirrorInput) => Effect.Effect<{
243
312
  readonly repo: string;
244
313
  readonly ref: string;
245
314
  readonly state: "active" | "paused";
315
+ readonly deletes?: true;
246
316
  readonly paused?: "diverged" | "refused" | "unseen";
247
317
  readonly lastPushed?: {
248
- readonly oid: string;
318
+ readonly oid: string | null;
249
319
  readonly at: number;
250
320
  };
251
321
  }, GitError, Sync>;
@@ -253,9 +323,10 @@ export declare const mirrors: (input: SyncMirrorsInput) => Effect.Effect<readonl
253
323
  readonly repo: string;
254
324
  readonly ref: string;
255
325
  readonly state: "active" | "paused";
326
+ readonly deletes?: true;
256
327
  readonly paused?: "diverged" | "refused" | "unseen";
257
328
  readonly lastPushed?: {
258
- readonly oid: string;
329
+ readonly oid: string | null;
259
330
  readonly at: number;
260
331
  };
261
332
  }[], GitError, Sync>;
@@ -1,10 +1,19 @@
1
1
  import { Oid, RefName } from "./ids.mjs";
2
- import { ClientCredentials, Transport } from "./remote.mjs";
2
+ import { FunctionValue } from "./opaque.mjs";
3
+ import { ClientCredentials } from "./remote.mjs";
3
4
  import { WorkMeasure } from "./work.mjs";
4
5
  import * as Effect from "effect/Effect";
5
6
  import * as Schema from "effect/Schema";
6
7
  import * as Context from "effect/Context";
7
- Schema.String, Schema.optionalKey(ClientCredentials), Schema.optionalKey(Transport);
8
+ // src/contracts/sync.ts
9
+ /**
10
+ * A sync remote's sender of one request, in place of Git's own client: an Effect, run in the try's
11
+ * fiber, so Git charges each call of it to the try's `CallBudget` as one subrequest before it
12
+ * runs, and a request it sends again, as a retry, charges that one itself, through
13
+ * `CallBudget.charged`. A failure is the remote's: the try fails, and the job tries again.
14
+ */
15
+ const SyncTransport = /* @__PURE__ */ FunctionValue();
16
+ Schema.String, Schema.optionalKey(ClientCredentials), Schema.optionalKey(SyncTransport);
8
17
  Schema.String;
9
18
  /**
10
19
  * A remote repo by its provider's `name` and the provider's own name for it, such as
@@ -21,10 +30,14 @@ const SyncSource = /* @__PURE__ */ Schema.Struct({
21
30
  * a host such as the GitHub drop-in publishes from the pull's record with `publishImported`.
22
31
  */
23
32
  const importedPullRefs = "refs/import/pull/";
24
- /** An import's phases, in order: `fetch` from the remote, `receive` into the repo, `publish` its refs. */
33
+ /**
34
+ * An import's phases, in order: `fetch` from the remote, `receive` into the repo, copy its Git LFS
35
+ * objects, `lfs`, on a server with `Lfs.layer`, and `publish` its refs.
36
+ */
25
37
  const ImportPhase = /* @__PURE__ */ Schema.Literals([
26
38
  "fetch",
27
39
  "receive",
40
+ "lfs",
28
41
  "publish"
29
42
  ]);
30
43
  Schema.Array(WorkMeasure);
@@ -41,14 +54,14 @@ const MirrorPause = /* @__PURE__ */ Schema.Literals([
41
54
  "unseen"
42
55
  ]);
43
56
  /**
44
- * A mirror's last push its upstream took: the ID the ref moved to there, and when, by `Clock`: when
45
- * the mirror sent it, or first found the upstream already at it.
57
+ * A mirror's last push its upstream took: the ID the ref moved to there, `null` for a delete, and
58
+ * when, by `Clock`: when the mirror sent it, or first found the upstream already at it.
46
59
  */
47
60
  const MirrorPush = /* @__PURE__ */ Schema.Struct({
48
- oid: Oid,
61
+ oid: Schema.NullOr(Oid),
49
62
  at: Schema.Int
50
63
  });
51
- Schema.Literals(["active", "paused"]), Schema.optionalKey(MirrorPause), Schema.optionalKey(MirrorPush);
64
+ Schema.Literals(["active", "paused"]), Schema.optionalKey(Schema.Literal(true)), Schema.optionalKey(MirrorPause), Schema.optionalKey(MirrorPush);
52
65
  Schema.Struct({
53
66
  from: RefName,
54
67
  oid: Oid,
@@ -61,8 +74,19 @@ Schema.Struct({
61
74
  });
62
75
  /** `sync.import`, keyed `import`, in the repo's scope. */
63
76
  const ImportJobData = /* @__PURE__ */ Schema.Struct({ source: SyncSource });
64
- /** `sync.mirror`, keyed by its ref, in the repo's scope: the mirror's record names its destination. */
65
- const MirrorJobData = /* @__PURE__ */ Schema.Struct({ ref: RefName });
77
+ /**
78
+ * `sync.mirror`, one a destination, in the repo's scope, keyed by the destination's digest: each
79
+ * try pushes every ref whose mirror names it.
80
+ */
81
+ const MirrorJobData = /* @__PURE__ */ Schema.Struct({ destination: SyncSource });
82
+ /** Why an import kept no copy of a Git LFS object its history points at. */
83
+ const ImportLfsReason = /* @__PURE__ */ Schema.Literals([
84
+ "not-found",
85
+ "refused",
86
+ "other-bytes",
87
+ "too-large",
88
+ "no-lfs"
89
+ ]);
66
90
  /** Import and mirroring, present only when the host composes Sync.layer. */
67
91
  var Sync = class extends (/* @__PURE__ */ Context.Service()("@ref0/git/Sync")) {};
68
92
  const importRepo = (input) => Effect.flatMap(Sync, (sync) => sync.import(input));
@@ -71,4 +95,4 @@ const mirror = (input) => Effect.flatMap(Sync, (sync) => sync.mirror(input));
71
95
  const mirrors = (input) => Effect.flatMap(Sync, (sync) => sync.mirrors(input));
72
96
  const removeMirror = (input) => Effect.flatMap(Sync, (sync) => sync.removeMirror(input));
73
97
  const publishImported = (input) => Effect.flatMap(Sync, (sync) => sync.publishImported(input));
74
- export { ImportJobData, ImportPhase, MirrorJobData, MirrorPause, MirrorPush, Sync, SyncSource, cancelImport, importRepo, importedPullRefs, mirror, mirrors, publishImported, removeMirror };
98
+ export { ImportJobData, ImportLfsReason, ImportPhase, MirrorJobData, MirrorPause, MirrorPush, Sync, SyncSource, SyncTransport, cancelImport, importRepo, importedPullRefs, mirror, mirrors, publishImported, removeMirror };
@@ -194,15 +194,10 @@ export interface VerifiedToken {
194
194
  readonly actor: NamedActor;
195
195
  readonly scope: TokenScope;
196
196
  }
197
- /** Turns on Git's tokens: `tokens()`, from `@ref0/git/auth`. */
198
- export interface TokensFeature {
199
- readonly kind: 'tokens';
200
- }
201
197
  declare const Tokens_base: Context.ServiceClass<Tokens, "@ref0/git/Tokens", EffectCalls<TokenCalls, never>>;
202
198
  /**
203
199
  * Git's own tokens: `TokenCalls` as Effects, deciding for no caller, as host code's do.
204
- * `Tokens.layer()` provides it, and so does `createGitServer`'s `tokens()` bridge until 2c. With
205
- * neither it isn't there, so code that may run without it reads it with `Effect.serviceOption`.
200
+ * `Tokens.layer()` provides it. Without it it isn't there, so code that may run without it reads it with `Effect.serviceOption`.
206
201
  */
207
202
  export declare class Tokens extends /* @__PURE__ */ Tokens_base {}
208
203
  export declare const create: (target: TokenTarget, input: TokenCreateInput) => Effect.Effect<{
@@ -105,8 +105,7 @@ const TokenList = /* @__PURE__ */ Schema.Struct({
105
105
  });
106
106
  /**
107
107
  * Git's own tokens: `TokenCalls` as Effects, deciding for no caller, as host code's do.
108
- * `Tokens.layer()` provides it, and so does `createGitServer`'s `tokens()` bridge until 2c. With
109
- * neither it isn't there, so code that may run without it reads it with `Effect.serviceOption`.
108
+ * `Tokens.layer()` provides it. Without it it isn't there, so code that may run without it reads it with `Effect.serviceOption`.
110
109
  */
111
110
  var Tokens = class extends (/* @__PURE__ */ Context.Service()("@ref0/git/Tokens")) {};
112
111
  const create = (target, input) => Effect.flatMap(Effect.service(Tokens), (tokens) => tokens.create(target, input));
@@ -267,9 +267,4 @@ export interface TopicsLayerOptions {
267
267
  * drains of what's open.
268
268
  */
269
269
  readonly waitTimeout?: Duration;
270
- }
271
- /** What `topics()` returns: the options it checked, which only `createGitServer` reads. */
272
- export interface TopicsFactory {
273
- readonly kind: 'topics';
274
- readonly options: TopicsLayerOptions;
275
270
  }
@@ -1,14 +1,14 @@
1
1
  import { EffectCalls } from "./services.mjs";
2
2
  import { GitError, Result } from "./result.mjs";
3
3
  import { ActorInput, Caller } from "./actors.mjs";
4
- import { RepoName } from "./ids.mjs";
4
+ import { InternalRepoId, RepoName } from "./ids.mjs";
5
5
  import { RepoInput } from "./repos.mjs";
6
6
  import * as Effect from "effect/Effect";
7
7
  import * as Schema from "effect/Schema";
8
8
  import { JobListRequest, JobRef, Listing } from "@ref0/infra";
9
9
  import * as Context from "effect/Context";
10
10
  declare namespace work_d_exports {
11
- export { JobState, ProgressSample, Work, WorkCalls, WorkItem, WorkListInput, WorkMeasure, WorkWrite, WorkWriteInput, discard, list, retry };
11
+ export { JobState, ProgressSample, Work, WorkByIdInput, WorkCalls, WorkItem, WorkListInput, WorkMeasure, WorkWrite, WorkWriteInput, discard, list, listById, retry };
12
12
  }
13
13
  /** A job's state, as `@ref0/infra` lists them. */
14
14
  export declare const JobState: Schema.Literals<readonly ["waiting", "running", "failed"]>;
@@ -70,9 +70,20 @@ export interface WorkListInput extends ActorInput, Omit<JobListRequest, 'name'>,
70
70
  * kept, or sent again while the first still runs, calls the queue again, and answers as it does.
71
71
  */
72
72
  export interface WorkWriteInput extends ActorInput, JobRef, Pick<RepoInput, 'internalId'>, WorkWrite {}
73
+ /** `list`'s input for a repo named by its internal ID, which needs no pin to its name. */
74
+ export interface WorkByIdInput extends ActorInput, Omit<JobListRequest, 'name'> {}
73
75
  /** A repo's jobs, over infra's job calls. */
74
76
  export interface WorkCalls {
75
77
  readonly list: (repo: RepoName, input: WorkListInput) => Promise<Result<Listing<WorkItem>>>;
78
+ /**
79
+ * Admin-only: a repo's jobs by its internal ID, and works on a deleted record, whose purge and
80
+ * repacks still run after its name answers `NOT_FOUND`. The default policy, `Policy.signedIn`,
81
+ * refuses it to everyone, `NOT_ALLOWED`: only a host's own policy grants it, as
82
+ * `ref0-git init`'s does for its admin. No token scope's ceiling names it either, so a `read`,
83
+ * `report` or `write` token is refused `NOT_ALLOWED` whatever the policy says. An ID that names
84
+ * no record, or that REST's path holds and isn't an ID, answers `NOT_FOUND`.
85
+ */
86
+ readonly listById: (internalId: InternalRepoId, input: WorkByIdInput) => Promise<Result<Listing<WorkItem>>>;
76
87
  readonly retry: (repo: RepoName, input: WorkWriteInput) => Promise<Result<void>>;
77
88
  readonly discard: (repo: RepoName, input: WorkWriteInput) => Promise<Result<void>>;
78
89
  }
@@ -101,6 +112,30 @@ declare const Work_base: Context.ServiceClass<Work, "@ref0/git/Work", EffectCall
101
112
  readonly at: number;
102
113
  };
103
114
  }>>>;
115
+ readonly listById: (internalId: `r_${string}`, input: WorkByIdInput, by?: Caller<unknown> | undefined) => Promise<Result<Listing<{
116
+ readonly scope: string;
117
+ readonly name: string;
118
+ readonly key: string;
119
+ readonly data: unknown;
120
+ readonly due: number;
121
+ readonly attempt: number;
122
+ readonly trace?: string;
123
+ readonly firstTry?: number;
124
+ readonly claim?: number;
125
+ readonly state: "failed" | "running" | "waiting";
126
+ readonly error?: string;
127
+ readonly failedAt?: number;
128
+ readonly progress?: {
129
+ readonly phase: string;
130
+ readonly measures: readonly {
131
+ readonly unit: "bytes" | "entries" | "objects" | "packs";
132
+ readonly completed: number;
133
+ readonly total?: number;
134
+ }[];
135
+ readonly attempt: number;
136
+ readonly at: number;
137
+ };
138
+ }>>>;
104
139
  readonly retry: (repo: string, input: WorkWriteInput, by?: Caller<unknown> | undefined) => Promise<Result<void>>;
105
140
  readonly discard: (repo: string, input: WorkWriteInput, by?: Caller<unknown> | undefined) => Promise<Result<void>>;
106
141
  }, never>>;
@@ -133,6 +168,35 @@ export declare const list: (repo: RepoName, input: WorkListInput, by?: Caller) =
133
168
  readonly at: number;
134
169
  };
135
170
  }>, GitError, Work>;
171
+ /**
172
+ * Admin-only, and works on a deleted record: `WorkCalls.listById`. `Policy.signedIn` refuses it to
173
+ * everyone, `NOT_ALLOWED`; only a host's own policy grants it, as `ref0-git init`'s does for its
174
+ * admin.
175
+ */
176
+ export declare const listById: (internalId: InternalRepoId, input: WorkByIdInput, by?: Caller) => Effect.Effect<Listing<{
177
+ readonly scope: string;
178
+ readonly name: string;
179
+ readonly key: string;
180
+ readonly data: unknown;
181
+ readonly due: number;
182
+ readonly attempt: number;
183
+ readonly trace?: string;
184
+ readonly firstTry?: number;
185
+ readonly claim?: number;
186
+ readonly state: "failed" | "running" | "waiting";
187
+ readonly error?: string;
188
+ readonly failedAt?: number;
189
+ readonly progress?: {
190
+ readonly phase: string;
191
+ readonly measures: readonly {
192
+ readonly unit: "bytes" | "entries" | "objects" | "packs";
193
+ readonly completed: number;
194
+ readonly total?: number;
195
+ }[];
196
+ readonly attempt: number;
197
+ readonly at: number;
198
+ };
199
+ }>, GitError, Work>;
136
200
  export declare const retry: (repo: RepoName, input: WorkWriteInput, by?: Caller) => Effect.Effect<void, GitError, Work>;
137
201
  export declare const discard: (repo: RepoName, input: WorkWriteInput, by?: Caller) => Effect.Effect<void, GitError, Work>;
138
202
  export { work_d_exports };
@@ -14,6 +14,7 @@ var work_exports = /* @__PURE__ */ __exportAll({
14
14
  WorkWrite: () => WorkWrite,
15
15
  discard: () => discard,
16
16
  list: () => list,
17
+ listById: () => listById,
17
18
  retry: () => retry
18
19
  });
19
20
  /** A job's state, as `@ref0/infra` lists them. */
@@ -64,6 +65,12 @@ const WorkWrite = /* @__PURE__ */ Schema.Struct({
64
65
  */
65
66
  var Work = class extends (/* @__PURE__ */ Context.Service()("@ref0/git/Work")) {};
66
67
  const list = (repo, input, by) => Effect.flatMap(Effect.service(Work), (calls) => calls.list(repo, input, by));
68
+ /**
69
+ * Admin-only, and works on a deleted record: `WorkCalls.listById`. `Policy.signedIn` refuses it to
70
+ * everyone, `NOT_ALLOWED`; only a host's own policy grants it, as `ref0-git init`'s does for its
71
+ * admin.
72
+ */
73
+ const listById = (internalId, input, by) => Effect.flatMap(Effect.service(Work), (calls) => calls.listById(internalId, input, by));
67
74
  const retry = (repo, input, by) => Effect.flatMap(Effect.service(Work), (calls) => calls.retry(repo, input, by));
68
75
  const discard = (repo, input, by) => Effect.flatMap(Effect.service(Work), (calls) => calls.discard(repo, input, by));
69
- export { JobState, ProgressSample, Work, WorkItem, WorkMeasure, WorkWrite, discard, list, retry, work_exports };
76
+ export { JobState, ProgressSample, Work, WorkItem, WorkMeasure, WorkWrite, discard, list, listById, retry, work_exports };
@@ -1,5 +1,6 @@
1
1
  import "../contracts/promises.mjs";
2
2
  import "../contracts/actors.mjs";
3
+ import "../contracts/git.mjs";
3
4
  import "../contracts/ids.mjs";
4
5
  import "../contracts/objects.mjs";
5
6
  import "../contracts/operations.mjs";