@ref0/git 0.7.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (245) hide show
  1. package/dist/access/private-refs.mjs +0 -2
  2. package/dist/auth/authorize.mjs +31 -24
  3. package/dist/auth/bridge.mjs +8 -8
  4. package/dist/auth/fences.d.mts +0 -1
  5. package/dist/auth/fences.mjs +1 -1
  6. package/dist/auth/grants.d.mts +0 -1
  7. package/dist/auth/grants.mjs +2 -2
  8. package/dist/auth/host-function.d.mts +1 -7
  9. package/dist/auth/host-function.mjs +38 -38
  10. package/dist/auth/identify.d.mts +0 -1
  11. package/dist/auth/identify.mjs +1 -1
  12. package/dist/auth/policy.d.mts +7 -4
  13. package/dist/auth/policy.mjs +13 -10
  14. package/dist/auth/token-rows.mjs +2 -5
  15. package/dist/auth/tokens-layer.d.mts +0 -2
  16. package/dist/auth/tokens-public.d.mts +3 -3
  17. package/dist/auth/tokens-public.mjs +4 -2
  18. package/dist/auth/tokens.d.mts +6 -1
  19. package/dist/auth/tokens.mjs +7 -1
  20. package/dist/client/client.d.mts +22 -15
  21. package/dist/client/client.mjs +31 -27
  22. package/dist/client/git-http.mjs +22 -5
  23. package/dist/client/local.mjs +1 -1
  24. package/dist/client/namespace.d.mts +2 -0
  25. package/dist/client/push-upload.d.mts +1 -0
  26. package/dist/client/push-upload.mjs +169 -2
  27. package/dist/client/remote-helper.mjs +2 -4
  28. package/dist/client/remote.mjs +37 -15
  29. package/dist/client/run-remote-helper.mjs +4 -4
  30. package/dist/client/transport.mjs +26 -19
  31. package/dist/contracts/actors.d.mts +57 -28
  32. package/dist/contracts/actors.mjs +38 -2
  33. package/dist/contracts/authorize.d.mts +21 -15
  34. package/dist/contracts/callers.mjs +40 -0
  35. package/dist/contracts/calls-spent.d.mts +2 -12
  36. package/dist/contracts/calls-spent.mjs +4 -5
  37. package/dist/contracts/client.d.mts +16 -9
  38. package/dist/contracts/events.d.mts +82 -14
  39. package/dist/contracts/events.mjs +35 -9
  40. package/dist/contracts/files.d.mts +42 -42
  41. package/dist/contracts/forks.d.mts +0 -24
  42. package/dist/contracts/git-hooks.d.mts +217 -0
  43. package/dist/contracts/git-hooks.mjs +3 -1
  44. package/dist/contracts/git.d.mts +13 -3
  45. package/dist/contracts/grants.d.mts +46 -27
  46. package/dist/contracts/lfs.d.mts +17 -4
  47. package/dist/contracts/merges.d.mts +7 -7
  48. package/dist/contracts/objects.d.mts +38 -4
  49. package/dist/contracts/opaque.mjs +19 -1
  50. package/dist/contracts/operations.d.mts +8 -1
  51. package/dist/contracts/operations.mjs +209 -0
  52. package/dist/contracts/queue.d.mts +6 -5
  53. package/dist/contracts/queue.mjs +9 -20
  54. package/dist/contracts/remote.d.mts +13 -4
  55. package/dist/contracts/remote.mjs +3 -3
  56. package/dist/contracts/repos.d.mts +11 -40
  57. package/dist/contracts/repos.mjs +11 -10
  58. package/dist/contracts/result.d.mts +28 -11
  59. package/dist/contracts/result.mjs +32 -2
  60. package/dist/contracts/rules.d.mts +706 -46
  61. package/dist/contracts/rules.mjs +81 -2
  62. package/dist/contracts/server.d.mts +5 -275
  63. package/dist/contracts/services.d.mts +0 -3
  64. package/dist/contracts/services.mjs +1 -3
  65. package/dist/contracts/signin.d.mts +2 -2
  66. package/dist/contracts/signin.mjs +4 -5
  67. package/dist/contracts/sync.d.mts +1 -4
  68. package/dist/contracts/tokens.d.mts +29 -17
  69. package/dist/contracts/tokens.mjs +14 -3
  70. package/dist/contracts/topics.d.mts +38 -11
  71. package/dist/contracts/topics.mjs +8 -2
  72. package/dist/core/access.d.mts +0 -2
  73. package/dist/core/access.mjs +15 -4
  74. package/dist/core/ancestry.mjs +5 -4
  75. package/dist/core/events/deliver.mjs +19 -1
  76. package/dist/core/forks.mjs +30 -11
  77. package/dist/core/hooks/groups.d.mts +0 -1
  78. package/dist/core/hooks/groups.mjs +8 -9
  79. package/dist/core/index-job.mjs +23 -1
  80. package/dist/core/index-lost.d.mts +11 -0
  81. package/dist/core/index-lost.mjs +55 -0
  82. package/dist/core/loose-tally.mjs +46 -0
  83. package/dist/core/objects/commit-writes.mjs +1 -1
  84. package/dist/core/objects/commits.mjs +10 -9
  85. package/dist/core/objects/merges.mjs +1 -1
  86. package/dist/core/objects/reading.mjs +28 -13
  87. package/dist/core/objects/trees.mjs +1 -1
  88. package/dist/core/objects/writing.mjs +1 -0
  89. package/dist/core/parts.d.mts +7 -0
  90. package/dist/core/promise.mjs +1 -15
  91. package/dist/core/publish.mjs +9 -5
  92. package/dist/core/purge.mjs +30 -12
  93. package/dist/core/push.mjs +39 -16
  94. package/dist/core/ref-view.mjs +14 -6
  95. package/dist/core/repack.mjs +54 -27
  96. package/dist/core/repo-info.mjs +8 -6
  97. package/dist/core/repos.mjs +1 -0
  98. package/dist/core/rules/check.mjs +10 -10
  99. package/dist/core/rules/context.d.mts +3 -1
  100. package/dist/core/rules/context.mjs +16 -13
  101. package/dist/core/rules/fetch.mjs +17 -23
  102. package/dist/core/tokens.mjs +2 -1
  103. package/dist/core/view.d.mts +10 -1
  104. package/dist/core/view.mjs +15 -6
  105. package/dist/effect.d.mts +3 -6
  106. package/dist/effect.mjs +3 -6
  107. package/dist/engine/commits.mjs +23 -50
  108. package/dist/engine/failures.d.mts +1 -2
  109. package/dist/engine/failures.mjs +1 -3
  110. package/dist/engine/merge-base-walk.mjs +57 -142
  111. package/dist/engine/merge-bases.mjs +9 -7
  112. package/dist/engine/merge.mjs +20 -17
  113. package/dist/engine/parts.d.mts +1 -0
  114. package/dist/engine/parts.mjs +1 -1
  115. package/dist/engine/walk.mjs +15 -11
  116. package/dist/extend.d.mts +1 -2
  117. package/dist/extend.mjs +1 -2
  118. package/dist/http/core-parts.mjs +18 -10
  119. package/dist/http/handler.mjs +11 -31
  120. package/dist/http/parts.d.mts +0 -1
  121. package/dist/index.d.mts +29 -22
  122. package/dist/index.mjs +5 -2
  123. package/dist/lfs/base.d.mts +6 -3
  124. package/dist/lfs/base.mjs +2 -1
  125. package/dist/lfs/layer.d.mts +4 -3
  126. package/dist/lfs/layer.mjs +23 -9
  127. package/dist/lfs/objects.mjs +93 -41
  128. package/dist/lfs/pointers.mjs +69 -18
  129. package/dist/lfs/purge.mjs +6 -2
  130. package/dist/lfs/rows.mjs +24 -7
  131. package/dist/lfs/service.d.mts +6 -3
  132. package/dist/lfs/service.mjs +8 -2
  133. package/dist/lfs/upkeep.mjs +47 -28
  134. package/dist/lfs/upload-most.mjs +47 -0
  135. package/dist/lfs/uploaded.mjs +59 -0
  136. package/dist/protocol/bytes/sha256-hasher.mjs +51 -0
  137. package/dist/protocol/bytes/streams.mjs +84 -2
  138. package/dist/protocol/bytes/text.mjs +6 -1
  139. package/dist/protocol/diff/read.d.mts +1 -0
  140. package/dist/protocol/diff/read.mjs +5 -2
  141. package/dist/protocol/objects/commit.d.mts +7 -0
  142. package/dist/protocol/objects/commit.mjs +5 -1
  143. package/dist/protocol/objects/fsck.mjs +6 -3
  144. package/dist/queue/advance.mjs +77 -18
  145. package/dist/queue/calls.mjs +4 -14
  146. package/dist/queue/host.d.mts +4 -0
  147. package/dist/queue/lanes.mjs +1 -1
  148. package/dist/queue/layer.mjs +4 -2
  149. package/dist/queue/limits.mjs +18 -2
  150. package/dist/queue/rows.mjs +10 -1
  151. package/dist/queue/schedule.mjs +1 -1
  152. package/dist/queue/search.mjs +3 -4
  153. package/dist/queue/trim.mjs +2 -2
  154. package/dist/rest/client-namespace.d.mts +2 -0
  155. package/dist/rest/client.d.mts +32 -8
  156. package/dist/rest/client.mjs +308 -382
  157. package/dist/rest/commits.d.mts +150 -150
  158. package/dist/rest/files.d.mts +18 -18
  159. package/dist/rest/forks.d.mts +77 -89
  160. package/dist/rest/handlers.mjs +2 -1
  161. package/dist/rest/listen.d.mts +8 -6
  162. package/dist/rest/listen.mjs +31 -75
  163. package/dist/rest/me.d.mts +2 -2
  164. package/dist/rest/merges.d.mts +7 -7
  165. package/dist/rest/refs.d.mts +27 -27
  166. package/dist/rest/repos.d.mts +40 -52
  167. package/dist/rest/tokens.d.mts +12 -12
  168. package/dist/rest/topics.d.mts +13 -13
  169. package/dist/rest/trees.d.mts +66 -66
  170. package/dist/rest/wire.d.mts +20 -2
  171. package/dist/rest/work.d.mts +39 -39
  172. package/dist/rest.d.mts +1 -7
  173. package/dist/rest.mjs +1 -5
  174. package/dist/server/git-layer.d.mts +10 -2
  175. package/dist/server/git-layer.mjs +29 -10
  176. package/dist/server/joined.d.mts +12 -6
  177. package/dist/server/joined.mjs +3 -2
  178. package/dist/server/registry.mjs +11 -5
  179. package/dist/server/server.d.mts +0 -1
  180. package/dist/server/server.mjs +42 -49
  181. package/dist/signin/context.d.mts +0 -1
  182. package/dist/signin/context.mjs +5 -9
  183. package/dist/storage/clean-up.mjs +3 -1
  184. package/dist/storage/fsck.mjs +12 -2
  185. package/dist/storage/graph-rebuild.mjs +262 -0
  186. package/dist/storage/index-bitmaps.mjs +16 -10
  187. package/dist/storage/index-build.mjs +160 -24
  188. package/dist/storage/index-graph.d.mts +1 -0
  189. package/dist/storage/index-graph.mjs +29 -5
  190. package/dist/storage/index-layers.d.mts +1 -0
  191. package/dist/storage/index-layers.mjs +5 -2
  192. package/dist/storage/index-reach.mjs +7 -5
  193. package/dist/storage/index-remap.mjs +5 -5
  194. package/dist/storage/index-visible.mjs +16 -5
  195. package/dist/storage/lfs-pointers.d.mts +5 -5
  196. package/dist/storage/lfs-pointers.mjs +37 -11
  197. package/dist/storage/links.mjs +3 -3
  198. package/dist/storage/loose.mjs +4 -1
  199. package/dist/storage/memory-budget.mjs +1 -1
  200. package/dist/storage/merge-fence.mjs +81 -19
  201. package/dist/storage/merge-most.mjs +1 -0
  202. package/dist/storage/merge-row.mjs +16 -4
  203. package/dist/storage/merge-stream.mjs +9 -6
  204. package/dist/storage/object-rows.mjs +17 -1
  205. package/dist/storage/pack-order.d.mts +1 -0
  206. package/dist/storage/pack-order.mjs +18 -1
  207. package/dist/storage/pack-receive.mjs +10 -6
  208. package/dist/storage/packs.mjs +58 -27
  209. package/dist/storage/prune-walk.mjs +5 -2
  210. package/dist/storage/prune.mjs +168 -70
  211. package/dist/storage/ready.d.mts +1 -1
  212. package/dist/storage/ready.mjs +12 -3
  213. package/dist/storage/receive-bounds.mjs +3 -2
  214. package/dist/storage/receive-state.mjs +1 -1
  215. package/dist/storage/repack-contained.mjs +22 -14
  216. package/dist/storage/repack.d.mts +1 -1
  217. package/dist/storage/repack.mjs +3 -2
  218. package/dist/storage/unpack.mjs +7 -0
  219. package/dist/storage/visible.mjs +3 -2
  220. package/dist/storage/walk.d.mts +1 -0
  221. package/dist/storage/walk.mjs +9 -5
  222. package/dist/storage/wants.mjs +17 -11
  223. package/dist/store/call-count.d.mts +31 -3
  224. package/dist/store/call-count.mjs +51 -20
  225. package/dist/store/errors.d.mts +7 -1
  226. package/dist/store/errors.mjs +7 -1
  227. package/dist/store/job-try.mjs +3 -1
  228. package/dist/store/records.mjs +26 -5
  229. package/dist/store/repo-record.mjs +36 -12
  230. package/dist/store/scopes.mjs +15 -2
  231. package/dist/sync/bound.d.mts +1 -1
  232. package/dist/sync/import.mjs +15 -3
  233. package/dist/sync/layer.d.mts +5 -1
  234. package/dist/sync/layer.mjs +11 -9
  235. package/dist/sync/mirror.mjs +1 -1
  236. package/dist/sync/step.mjs +15 -15
  237. package/dist/topics/advance.mjs +11 -10
  238. package/dist/topics/layer.mjs +1 -1
  239. package/dist/topics/members.mjs +38 -9
  240. package/package.json +3 -3
  241. package/dist/engine/merge-base-walk.d.mts +0 -3
  242. package/dist/server/routes.d.mts +0 -32
  243. package/dist/server/routes.mjs +0 -69
  244. package/dist/sync/bridge.d.mts +0 -6
  245. package/dist/sync/bridge.mjs +0 -29
@@ -1,5 +1,6 @@
1
- import { Awaitable, GitError } from "./result.mjs";
2
1
  import { ActorInput } from "./actors.mjs";
2
+ import { Awaitable, GitError, Result } from "./result.mjs";
3
+ import * as Effect from "effect/Effect";
3
4
  import * as Schema from "effect/Schema";
4
5
  /** What a client sends as Basic: Git's own credential, such as `x-access-token` and a token. */
5
6
  export declare const BasicCredential: Schema.Struct<{
@@ -28,7 +29,7 @@ export declare const ClientCredentials: Schema.Union<readonly [Schema.Union<read
28
29
  readonly password: Schema.String;
29
30
  }>, Schema.Struct<{
30
31
  readonly token: Schema.String;
31
- }>]>, Schema.declare<(input: CredentialInput) => Awaitable<ClientCredential>, unknown>]>;
32
+ }>]>, Schema.declare<(input: CredentialInput) => Awaitable<ClientCredential>, (input: CredentialInput) => Awaitable<ClientCredential>>]>;
32
33
  export type ClientCredentials = typeof ClientCredentials.Type;
33
34
  /** A request that failed: its status, or `0` when no answer came, and its error when it sent one. */
34
35
  export declare const TransportFailure: Schema.Struct<{
@@ -67,5 +68,13 @@ export interface RemoteOptions {
67
68
  * either: REST names a repo by its path alone, so a remote couldn't hold a call to one (Q705).
68
69
  */
69
70
  export type WithoutActor<Input> = Input extends ActorInput ? Omit<Input, 'actor' | 'internalId'> : Input;
70
- /** A group of server calls as a remote makes them, each input without `actor`. */
71
- export type RemoteCalls<Calls> = { readonly [Key in keyof Calls]-?: NonNullable<Calls[Key]> extends ((...args: infer Args) => infer Answer) ? (...args: { [Index in keyof Args]: WithoutActor<Args[Index]>; }) => Answer : RemoteCalls<NonNullable<Calls[Key]>>; };
71
+ /** A call's input without `signal`: interrupting the call's fiber stops it. */
72
+ export type WithoutSignal<Input> = Input extends object ? Omit<Input, 'signal'> : Input;
73
+ /** A call's answer as a remote gives it: an Effect that fails with the call's `GitError`. */
74
+ type RemoteAnswer<Answer> = Answer extends Promise<Result<infer A>> ? Effect.Effect<A, GitError> : Answer;
75
+ /**
76
+ * A group of server calls as a remote makes them: each an Effect, its input without `actor` or
77
+ * `signal`.
78
+ */
79
+ export type RemoteCalls<Calls> = { readonly [Key in keyof Calls]-?: NonNullable<Calls[Key]> extends ((...args: infer Args) => infer Answer) ? (...args: { [Index in keyof Args]: WithoutSignal<WithoutActor<Args[Index]>>; }) => RemoteAnswer<Answer> : RemoteCalls<NonNullable<Calls[Key]>>; };
80
+ export {};
@@ -1,6 +1,6 @@
1
+ import { FunctionValue } from "./opaque.mjs";
1
2
  import { GitErrorValue } from "./result.mjs";
2
3
  import * as Schema from "effect/Schema";
3
- import * as Predicate from "effect/Predicate";
4
4
  // src/contracts/remote.ts
5
5
  /** What a client sends as Basic: Git's own credential, such as `x-access-token` and a token. */
6
6
  const BasicCredential = /* @__PURE__ */ Schema.Struct({
@@ -10,9 +10,9 @@ const BasicCredential = /* @__PURE__ */ Schema.Struct({
10
10
  const BearerCredential = /* @__PURE__ */ Schema.Struct({ token: Schema.String });
11
11
  const ClientCredential = /* @__PURE__ */ Schema.Union([BasicCredential, BearerCredential]);
12
12
  /** A value, or a function for short-lived credentials: after a 401 it runs once more. */
13
- const ClientCredentials = /* @__PURE__ */ Schema.Union([ClientCredential, Schema.declare((input) => Predicate.isFunction(input))]);
13
+ const ClientCredentials = /* @__PURE__ */ Schema.Union([ClientCredential, FunctionValue()]);
14
14
  /** A request's sender in place of `fetch`, held as itself. */
15
- const Transport = /* @__PURE__ */ Schema.declare((input) => Predicate.isFunction(input));
15
+ const Transport = /* @__PURE__ */ FunctionValue();
16
16
  /** A request that failed: its status, or `0` when no answer came, and its error when it sent one. */
17
17
  const TransportFailure = /* @__PURE__ */ Schema.Struct({
18
18
  status: Schema.Int,
@@ -15,12 +15,19 @@ type Moment$1 = typeof Moment$1.Type;
15
15
  export declare const RepoStats: Schema.Struct<{
16
16
  readonly repo: Schema.String;
17
17
  readonly refs: Schema.Number;
18
+ /** The packs the repo lists. */
18
19
  readonly packs: Schema.Number;
20
+ /**
21
+ * The bytes of the packs the repo lists, shared with forks or not, and of the pack kept ready for
22
+ * a shallow clone of the default branch, which no list names.
23
+ */
19
24
  readonly packBytes: Schema.Number;
25
+ /**
26
+ * The bytes a quota counts: `packBytes`, and the objects the repo keeps as rows, every object of
27
+ * a `loose()` repo's and a small push's that `packs()` keeps until its next repack, each its row's
28
+ * bytes as the store holds it.
29
+ */
20
30
  readonly ownBytes: Schema.Number;
21
- readonly looseObjects: Schema.Number;
22
- readonly looseBytes: Schema.Number;
23
- readonly leavingBytes: Schema.Number;
24
31
  /**
25
32
  * When the core last committed a move of one of the repo's refs: a push, a write that names a
26
33
  * ref, `refs.update`, a merge or a queue's publish, but not the queue's own refs alone. None
@@ -39,7 +46,7 @@ export type RepoStats = typeof RepoStats.Type;
39
46
  * every field: every caller of a server with no `access`, and one `refs.private` lets read every
40
47
  * pattern of the repo's, as it does on a repo with none. One a private pattern restricts gets only
41
48
  * what its own view counts: `repo`, the `refs` it sees and the `pushedAt` of those refs. The pack
42
- * and object counts, the bytes and `maintainedAt` are left out, never zero, since a push to a ref
49
+ * count, the bytes and `maintainedAt` are left out, never zero, since a push to a ref
43
50
  * it can't see moves them.
44
51
  */
45
52
  export declare const RepoInfoStats: Schema.Struct<{
@@ -51,12 +58,6 @@ export declare const RepoInfoStats: Schema.Struct<{
51
58
  readonly packBytes: Schema.optionalKey<Schema.Number>;
52
59
  /** As `RepoStats` counts it; left out for a caller a private pattern restricts. */
53
60
  readonly ownBytes: Schema.optionalKey<Schema.Number>;
54
- /** As `RepoStats` counts it; left out for a caller a private pattern restricts. */
55
- readonly looseObjects: Schema.optionalKey<Schema.Number>;
56
- /** As `RepoStats` counts it; left out for a caller a private pattern restricts. */
57
- readonly looseBytes: Schema.optionalKey<Schema.Number>;
58
- /** As `RepoStats` counts it; left out for a caller a private pattern restricts. */
59
- readonly leavingBytes: Schema.optionalKey<Schema.Number>;
60
61
  /** When a ref this caller sees last moved: the whole repo's for a caller with the whole view. */
61
62
  readonly pushedAt: Schema.optionalKey<Schema.Number>;
62
63
  /** As `RepoStats` keeps it; left out for a caller a private pattern restricts. */
@@ -116,12 +117,6 @@ export declare const RepoInfo: Schema.Struct<{
116
117
  readonly packBytes: Schema.optionalKey<Schema.Number>;
117
118
  /** As `RepoStats` counts it; left out for a caller a private pattern restricts. */
118
119
  readonly ownBytes: Schema.optionalKey<Schema.Number>;
119
- /** As `RepoStats` counts it; left out for a caller a private pattern restricts. */
120
- readonly looseObjects: Schema.optionalKey<Schema.Number>;
121
- /** As `RepoStats` counts it; left out for a caller a private pattern restricts. */
122
- readonly looseBytes: Schema.optionalKey<Schema.Number>;
123
- /** As `RepoStats` counts it; left out for a caller a private pattern restricts. */
124
- readonly leavingBytes: Schema.optionalKey<Schema.Number>;
125
120
  /** When a ref this caller sees last moved: the whole repo's for a caller with the whole view. */
126
121
  readonly pushedAt: Schema.optionalKey<Schema.Number>;
127
122
  /** As `RepoStats` keeps it; left out for a caller a private pattern restricts. */
@@ -311,9 +306,6 @@ declare const Repos_base: Context.ServiceClass<Repos, "@ref0/git/Repos", EffectC
311
306
  readonly packs?: number;
312
307
  readonly packBytes?: number;
313
308
  readonly ownBytes?: number;
314
- readonly looseObjects?: number;
315
- readonly looseBytes?: number;
316
- readonly leavingBytes?: number;
317
309
  readonly pushedAt?: number;
318
310
  readonly maintainedAt?: number;
319
311
  };
@@ -341,9 +333,6 @@ declare const Repos_base: Context.ServiceClass<Repos, "@ref0/git/Repos", EffectC
341
333
  readonly packs?: number;
342
334
  readonly packBytes?: number;
343
335
  readonly ownBytes?: number;
344
- readonly looseObjects?: number;
345
- readonly looseBytes?: number;
346
- readonly leavingBytes?: number;
347
336
  readonly pushedAt?: number;
348
337
  readonly maintainedAt?: number;
349
338
  };
@@ -372,9 +361,6 @@ declare const Repos_base: Context.ServiceClass<Repos, "@ref0/git/Repos", EffectC
372
361
  readonly packs?: number;
373
362
  readonly packBytes?: number;
374
363
  readonly ownBytes?: number;
375
- readonly looseObjects?: number;
376
- readonly looseBytes?: number;
377
- readonly leavingBytes?: number;
378
364
  readonly pushedAt?: number;
379
365
  readonly maintainedAt?: number;
380
366
  };
@@ -402,9 +388,6 @@ declare const Repos_base: Context.ServiceClass<Repos, "@ref0/git/Repos", EffectC
402
388
  readonly packs?: number;
403
389
  readonly packBytes?: number;
404
390
  readonly ownBytes?: number;
405
- readonly looseObjects?: number;
406
- readonly looseBytes?: number;
407
- readonly leavingBytes?: number;
408
391
  readonly pushedAt?: number;
409
392
  readonly maintainedAt?: number;
410
393
  };
@@ -439,9 +422,6 @@ export declare const create: (input: RepoCreateInput, by?: Caller) => Effect.Eff
439
422
  readonly packs?: number;
440
423
  readonly packBytes?: number;
441
424
  readonly ownBytes?: number;
442
- readonly looseObjects?: number;
443
- readonly looseBytes?: number;
444
- readonly leavingBytes?: number;
445
425
  readonly pushedAt?: number;
446
426
  readonly maintainedAt?: number;
447
427
  };
@@ -469,9 +449,6 @@ export declare const get: (repo: RepoName, input: ActorInput & Pick<RepoInput, '
469
449
  readonly packs?: number;
470
450
  readonly packBytes?: number;
471
451
  readonly ownBytes?: number;
472
- readonly looseObjects?: number;
473
- readonly looseBytes?: number;
474
- readonly leavingBytes?: number;
475
452
  readonly pushedAt?: number;
476
453
  readonly maintainedAt?: number;
477
454
  };
@@ -500,9 +477,6 @@ export declare const update: (repo: RepoName, input: RepoUpdateInput, by?: Calle
500
477
  readonly packs?: number;
501
478
  readonly packBytes?: number;
502
479
  readonly ownBytes?: number;
503
- readonly looseObjects?: number;
504
- readonly looseBytes?: number;
505
- readonly leavingBytes?: number;
506
480
  readonly pushedAt?: number;
507
481
  readonly maintainedAt?: number;
508
482
  };
@@ -530,9 +504,6 @@ export declare const rename: (repo: RepoName, input: RepoRenameInput, by?: Calle
530
504
  readonly packs?: number;
531
505
  readonly packBytes?: number;
532
506
  readonly ownBytes?: number;
533
- readonly looseObjects?: number;
534
- readonly looseBytes?: number;
535
- readonly leavingBytes?: number;
536
507
  readonly pushedAt?: number;
537
508
  readonly maintainedAt?: number;
538
509
  };
@@ -29,12 +29,19 @@ const Moment = Schema.Number;
29
29
  const RepoStats = /* @__PURE__ */ Schema.Struct({
30
30
  repo: RepoName,
31
31
  refs: Schema.Number,
32
+ /** The packs the repo lists. */
32
33
  packs: Schema.Number,
34
+ /**
35
+ * The bytes of the packs the repo lists, shared with forks or not, and of the pack kept ready for
36
+ * a shallow clone of the default branch, which no list names.
37
+ */
33
38
  packBytes: Schema.Number,
39
+ /**
40
+ * The bytes a quota counts: `packBytes`, and the objects the repo keeps as rows, every object of
41
+ * a `loose()` repo's and a small push's that `packs()` keeps until its next repack, each its row's
42
+ * bytes as the store holds it.
43
+ */
34
44
  ownBytes: Schema.Number,
35
- looseObjects: Schema.Number,
36
- looseBytes: Schema.Number,
37
- leavingBytes: Schema.Number,
38
45
  /**
39
46
  * When the core last committed a move of one of the repo's refs: a push, a write that names a
40
47
  * ref, `refs.update`, a merge or a queue's publish, but not the queue's own refs alone. None
@@ -52,7 +59,7 @@ const RepoStats = /* @__PURE__ */ Schema.Struct({
52
59
  * every field: every caller of a server with no `access`, and one `refs.private` lets read every
53
60
  * pattern of the repo's, as it does on a repo with none. One a private pattern restricts gets only
54
61
  * what its own view counts: `repo`, the `refs` it sees and the `pushedAt` of those refs. The pack
55
- * and object counts, the bytes and `maintainedAt` are left out, never zero, since a push to a ref
62
+ * count, the bytes and `maintainedAt` are left out, never zero, since a push to a ref
56
63
  * it can't see moves them.
57
64
  */
58
65
  const RepoInfoStats = /* @__PURE__ */ Schema.Struct({
@@ -64,12 +71,6 @@ const RepoInfoStats = /* @__PURE__ */ Schema.Struct({
64
71
  packBytes: Schema.optionalKey(Schema.Number),
65
72
  /** As `RepoStats` counts it; left out for a caller a private pattern restricts. */
66
73
  ownBytes: Schema.optionalKey(Schema.Number),
67
- /** As `RepoStats` counts it; left out for a caller a private pattern restricts. */
68
- looseObjects: Schema.optionalKey(Schema.Number),
69
- /** As `RepoStats` counts it; left out for a caller a private pattern restricts. */
70
- looseBytes: Schema.optionalKey(Schema.Number),
71
- /** As `RepoStats` counts it; left out for a caller a private pattern restricts. */
72
- leavingBytes: Schema.optionalKey(Schema.Number),
73
74
  /** When a ref this caller sees last moved: the whole repo's for a caller with the whole view. */
74
75
  pushedAt: RepoStats.fields.pushedAt,
75
76
  /** As `RepoStats` keeps it; left out for a caller a private pattern restricts. */
@@ -150,7 +150,7 @@ export declare const DataLossContext: Schema.StructWithRest<Schema.Struct<{
150
150
  reason: Schema.optionalKey<Schema.Union<readonly [Schema.Literals<readonly ["event-version", "graph-length", "merge-incomplete"]>, Schema.decodeTo<Schema.String, Schema.String, never, never>]>>;
151
151
  }>, readonly [Schema.$Record<Schema.String, Schema.Union<readonly [Schema.decodeTo<Schema.String, Schema.String, never, never>, Schema.Number, Schema.Boolean, Schema.$Array<Schema.decodeTo<Schema.String, Schema.String, never, never>>, Schema.Undefined]>>]>;
152
152
  export type DataLossContext = typeof DataLossContext.Type;
153
- /** `id`: the logged host-function failure's, which `onError` receives too. */
153
+ /** `id`: the logged host-function failure's, which its log line is annotated with as `failure`. */
154
154
  export declare const HostErrorContext: Schema.StructWithRest<Schema.Struct<{
155
155
  id: Schema.optionalKey<Schema.decodeTo<Schema.String, Schema.String, never, never>>;
156
156
  }>, readonly [Schema.$Record<Schema.String, Schema.Union<readonly [Schema.decodeTo<Schema.String, Schema.String, never, never>, Schema.Number, Schema.Boolean, Schema.$Array<Schema.decodeTo<Schema.String, Schema.String, never, never>>, Schema.Undefined]>>]>;
@@ -390,19 +390,27 @@ export declare const gitError: <Code extends GitErrorCode>(code: Code, message:
390
390
  /** Whether `told`, a `reason: <told>` line's, is a reason a refusal names. */
391
391
  export declare const isRefusalReason: (told: string) => told is RefusalReason;
392
392
  /** A host function's refusal: `code` is `NOT_ALLOWED` when it's left out. */
393
- export interface RejectInput {
394
- readonly code?: GitErrorCode;
395
- readonly message: string;
396
- readonly hint?: string;
397
- readonly context?: ErrorContext;
398
- }
399
- export interface Rejected extends RejectInput {
400
- readonly kind: 'reject';
401
- }
393
+ export declare const RejectInput: Schema.Struct<{
394
+ readonly code: Schema.decodeTo<Schema.optionalKey<Schema.toType<Schema.Literals<readonly ("ALREADY_EXISTS" | "DATA_LOSS" | "DEADLINE_EXCEEDED" | "FAILED_PRECONDITION" | "INTERNAL" | "INVALID_ARGUMENT" | "NOT_ALLOWED" | "NOT_FOUND" | "RESOURCE_EXHAUSTED" | "UNAUTHENTICATED" | "UNAVAILABLE")[]>>>, Schema.optional<Schema.Literals<readonly ("ALREADY_EXISTS" | "DATA_LOSS" | "DEADLINE_EXCEEDED" | "FAILED_PRECONDITION" | "INTERNAL" | "INVALID_ARGUMENT" | "NOT_ALLOWED" | "NOT_FOUND" | "RESOURCE_EXHAUSTED" | "UNAUTHENTICATED" | "UNAVAILABLE")[]>>, never, never>;
395
+ readonly message: Schema.String;
396
+ readonly hint: Schema.decodeTo<Schema.optionalKey<Schema.toType<Schema.String>>, Schema.optional<Schema.String>, never, never>;
397
+ readonly context: Schema.decodeTo<Schema.optionalKey<Schema.toType<Schema.StructWithRest<Schema.Struct<{}>, readonly [Schema.$Record<Schema.String, Schema.Union<readonly [Schema.decodeTo<Schema.String, Schema.String, never, never>, Schema.Number, Schema.Boolean, Schema.$Array<Schema.decodeTo<Schema.String, Schema.String, never, never>>, Schema.Undefined]>>]>>>, Schema.optional<Schema.StructWithRest<Schema.Struct<{}>, readonly [Schema.$Record<Schema.String, Schema.Union<readonly [Schema.decodeTo<Schema.String, Schema.String, never, never>, Schema.Number, Schema.Boolean, Schema.$Array<Schema.decodeTo<Schema.String, Schema.String, never, never>>, Schema.Undefined]>>]>>, never, never>;
398
+ }>;
399
+ export type RejectInput = typeof RejectInput.Type;
400
+ export declare const Rejected: Schema.Struct<{
401
+ readonly code: Schema.decodeTo<Schema.optionalKey<Schema.toType<Schema.Literals<readonly ("ALREADY_EXISTS" | "DATA_LOSS" | "DEADLINE_EXCEEDED" | "FAILED_PRECONDITION" | "INTERNAL" | "INVALID_ARGUMENT" | "NOT_ALLOWED" | "NOT_FOUND" | "RESOURCE_EXHAUSTED" | "UNAUTHENTICATED" | "UNAVAILABLE")[]>>>, Schema.optional<Schema.Literals<readonly ("ALREADY_EXISTS" | "DATA_LOSS" | "DEADLINE_EXCEEDED" | "FAILED_PRECONDITION" | "INTERNAL" | "INVALID_ARGUMENT" | "NOT_ALLOWED" | "NOT_FOUND" | "RESOURCE_EXHAUSTED" | "UNAUTHENTICATED" | "UNAVAILABLE")[]>>, never, never>;
402
+ readonly message: Schema.String;
403
+ readonly hint: Schema.decodeTo<Schema.optionalKey<Schema.toType<Schema.String>>, Schema.optional<Schema.String>, never, never>;
404
+ readonly context: Schema.decodeTo<Schema.optionalKey<Schema.toType<Schema.StructWithRest<Schema.Struct<{}>, readonly [Schema.$Record<Schema.String, Schema.Union<readonly [Schema.decodeTo<Schema.String, Schema.String, never, never>, Schema.Number, Schema.Boolean, Schema.$Array<Schema.decodeTo<Schema.String, Schema.String, never, never>>, Schema.Undefined]>>]>>>, Schema.optional<Schema.StructWithRest<Schema.Struct<{}>, readonly [Schema.$Record<Schema.String, Schema.Union<readonly [Schema.decodeTo<Schema.String, Schema.String, never, never>, Schema.Number, Schema.Boolean, Schema.$Array<Schema.decodeTo<Schema.String, Schema.String, never, never>>, Schema.Undefined]>>]>>, never, never>;
405
+ readonly kind: Schema.Literal<"reject">;
406
+ }>;
407
+ export type Rejected = typeof Rejected.Type;
408
+ /** An accept: `decisionAnswer` reads one with its value's Schema. */
402
409
  export interface Accepted<Data = undefined> {
403
410
  readonly kind: 'accept';
404
411
  readonly value?: Data;
405
412
  }
413
+ /** A host check's answer: `decisionAnswer` reads one a host's JavaScript gave. */
406
414
  export type DecisionAnswer<Data = undefined> = Accepted<Data> | Rejected;
407
415
  /** With no value, it fits any answer: a fetch rule's as well as a push rule's. */
408
416
  export declare function accept(): Accepted<never>;
@@ -412,7 +420,16 @@ export declare function accept<Data>(value: Data): Accepted<Data>;
412
420
  * `message` off its enumerable keys, so a spread of one would drop it.
413
421
  */
414
422
  export declare const reject: ({ code, message, hint, context }: RejectInput) => Rejected;
415
- export declare const HostFunctionName: Schema.Literals<readonly ["auth", "authorize", "approvalPage", "grants", "rules.push", "rules.fetch", "hooks", "resolve", "join", "queue.merge", "queue.lanes", "queue.bisect", "queue.schedule", "topics.prepare", "topics.required"]>;
423
+ /**
424
+ * The host functions Git runs, by the name its logs give each. When one throws, fails or runs past
425
+ * its timeout, its caller gets a fixed sentence and a failure ID, and the runtime's Logger gets a
426
+ * line at `Error`: `<name> failed` or `<name> ran out of time`, annotated `function`, `failure` (that
427
+ * ID), and `repo` and `operation` (the operation's kind) where the call has them. Its cause is the
428
+ * host's own error, unredacted, so a credential or a private ref name an `Auth`, a grant resolver or
429
+ * a rule puts in its error reaches the Logger as written: cleaning it is the host's Logger's job. A
430
+ * refusal is a line at `Debug`, `<name> refused: <message>`, annotated `code` beside the rest.
431
+ */
432
+ export declare const HostFunctionName: Schema.Literals<readonly ["auth", "authorize", "approvalPage", "grants", "rules.push", "rules.fetch", "hooks", "join", "queue.merge", "queue.lanes", "queue.bisect", "queue.schedule", "topics.prepare", "topics.required"]>;
416
433
  export type HostFunctionName = typeof HostFunctionName.Type;
417
434
  export type Awaitable<T> = T | Promise<T>;
418
435
  export {};
@@ -1,4 +1,5 @@
1
1
  import * as Effect from "effect/Effect";
2
+ import * as Option from "effect/Option";
2
3
  import * as Schema from "effect/Schema";
3
4
  import * as Predicate from "effect/Predicate";
4
5
  import * as SchemaTransformation from "effect/SchemaTransformation";
@@ -251,7 +252,7 @@ const DataLossReason = /* @__PURE__ */ Schema.Literals([
251
252
  "merge-incomplete"
252
253
  ]);
253
254
  const DataLossContext = contextOf({ reason: reasonOf(DataLossReason) });
254
- /** `id`: the logged host-function failure's, which `onError` receives too. */
255
+ /** `id`: the logged host-function failure's, which its log line is annotated with as `failure`. */
255
256
  const HostErrorContext = contextOf({ id: Schema.optionalKey(BodyText) });
256
257
  /**
257
258
  * `busy`: the server's memory, held by other calls, had no room for this one in time.
@@ -388,6 +389,35 @@ const gitErrorFrom = (fields, over = {}) => {
388
389
  const refusalReasons = /* @__PURE__ */ new Set(refusalReasonLists.flatMap((reasons) => reasons.literals));
389
390
  /** Whether `told`, a `reason: <told>` line's, is a reason a refusal names. */
390
391
  const isRefusalReason = (told) => refusalReasons.has(told);
392
+ /**
393
+ * An optional field a host's JavaScript may also answer as `undefined`, which reads as left out: so
394
+ * its type stays the field's own, as `reject()` writes it, and `join`'s explicit `undefined` still
395
+ * refuses (#1877).
396
+ */
397
+ const answeredOptional = (schema) => Schema.optional(schema).pipe(Schema.decodeTo(Schema.optionalKey(Schema.toType(schema)), SchemaTransformation.transformOptional({
398
+ decode: Option.filter(Predicate.isNotUndefined),
399
+ encode: (value) => value
400
+ })));
401
+ /** A host function's refusal: `code` is `NOT_ALLOWED` when it's left out. */
402
+ const RejectInput = /* @__PURE__ */ Schema.Struct({
403
+ code: answeredOptional(GitErrorCode),
404
+ message: Schema.String,
405
+ hint: answeredOptional(Schema.String),
406
+ context: answeredOptional(ErrorContext)
407
+ });
408
+ const Rejected = /* @__PURE__ */ Schema.Struct({
409
+ kind: Schema.Literal("reject"),
410
+ ...RejectInput.fields
411
+ });
412
+ /**
413
+ * A host check's answer, `accept()` with a `value` that `value` reads or `reject()`, as a host's
414
+ * JavaScript may answer anything: a push rule's, a hook group's, a fetch rule's, `join`'s and
415
+ * `prepare`'s. Its type is `DecisionAnswer` of `value`'s.
416
+ */
417
+ const decisionAnswer = (value) => Schema.Union([Schema.Struct({
418
+ kind: Schema.Literal("accept"),
419
+ value: answeredOptional(value)
420
+ }), Rejected]);
391
421
  function accept(...value) {
392
422
  return value.length === 0 ? { kind: "accept" } : {
393
423
  kind: "accept",
@@ -408,4 +438,4 @@ const reject = ({ code, message, hint, context }) => {
408
438
  if (context !== void 0) rejected.context = context;
409
439
  return rejected;
410
440
  };
411
- export { ContextValue, DataLossContext, DataLossReason, ErrorContext, ExistingContext, ExistingReason, GitErrorBody, GitErrorCode, GitErrorTagged, GitErrorValue, HostErrorContext, InvalidInputContext, InvalidInputReason, MissingContext, MissingReason, NotAllowedContext, NotAllowedReason, PreconditionContext, PreconditionReason, ResourceContext, ResourceReason, UnavailableContext, UnavailableReason, Verdict, accept, fail, gitError, gitErrorBodies, gitErrorFrom, httpStatus, isGitError, isGitErrorCode, isRefusalReason, refusalCodeHeader, reject };
441
+ export { ContextValue, DataLossContext, DataLossReason, ErrorContext, ExistingContext, ExistingReason, GitErrorBody, GitErrorCode, GitErrorTagged, GitErrorValue, HostErrorContext, InvalidInputContext, InvalidInputReason, MissingContext, MissingReason, NotAllowedContext, NotAllowedReason, PreconditionContext, PreconditionReason, RejectInput, Rejected, ResourceContext, ResourceReason, UnavailableContext, UnavailableReason, Verdict, accept, decisionAnswer, fail, gitError, gitErrorBodies, gitErrorFrom, httpStatus, isGitError, isGitErrorCode, isRefusalReason, refusalCodeHeader, reject };