@ref0/git 0.7.0 → 0.8.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 (191) 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/client.d.mts +16 -9
  36. package/dist/contracts/events.d.mts +12 -10
  37. package/dist/contracts/events.mjs +8 -6
  38. package/dist/contracts/files.d.mts +42 -42
  39. package/dist/contracts/forks.d.mts +0 -24
  40. package/dist/contracts/git-hooks.d.mts +217 -0
  41. package/dist/contracts/git-hooks.mjs +3 -1
  42. package/dist/contracts/grants.d.mts +46 -27
  43. package/dist/contracts/lfs.d.mts +17 -4
  44. package/dist/contracts/merges.d.mts +7 -7
  45. package/dist/contracts/objects.d.mts +20 -4
  46. package/dist/contracts/opaque.mjs +19 -1
  47. package/dist/contracts/operations.d.mts +8 -1
  48. package/dist/contracts/operations.mjs +209 -0
  49. package/dist/contracts/queue.d.mts +3 -3
  50. package/dist/contracts/queue.mjs +5 -18
  51. package/dist/contracts/remote.d.mts +13 -4
  52. package/dist/contracts/remote.mjs +3 -3
  53. package/dist/contracts/repos.d.mts +11 -40
  54. package/dist/contracts/repos.mjs +11 -10
  55. package/dist/contracts/result.d.mts +28 -11
  56. package/dist/contracts/result.mjs +32 -2
  57. package/dist/contracts/rules.d.mts +706 -46
  58. package/dist/contracts/rules.mjs +81 -2
  59. package/dist/contracts/server.d.mts +5 -275
  60. package/dist/contracts/services.d.mts +0 -3
  61. package/dist/contracts/services.mjs +1 -3
  62. package/dist/contracts/signin.d.mts +2 -2
  63. package/dist/contracts/signin.mjs +4 -5
  64. package/dist/contracts/sync.d.mts +1 -4
  65. package/dist/contracts/tokens.d.mts +29 -17
  66. package/dist/contracts/tokens.mjs +14 -3
  67. package/dist/contracts/topics.d.mts +38 -11
  68. package/dist/contracts/topics.mjs +8 -2
  69. package/dist/core/access.d.mts +0 -2
  70. package/dist/core/access.mjs +15 -4
  71. package/dist/core/events/deliver.mjs +19 -1
  72. package/dist/core/forks.mjs +30 -11
  73. package/dist/core/hooks/groups.d.mts +0 -1
  74. package/dist/core/hooks/groups.mjs +8 -9
  75. package/dist/core/loose-tally.mjs +46 -0
  76. package/dist/core/objects/writing.mjs +1 -0
  77. package/dist/core/promise.mjs +1 -15
  78. package/dist/core/purge.mjs +14 -9
  79. package/dist/core/push.mjs +13 -6
  80. package/dist/core/ref-view.mjs +14 -6
  81. package/dist/core/repack.mjs +19 -14
  82. package/dist/core/repo-info.mjs +8 -6
  83. package/dist/core/repos.mjs +1 -0
  84. package/dist/core/rules/check.mjs +10 -10
  85. package/dist/core/rules/context.d.mts +3 -1
  86. package/dist/core/rules/context.mjs +16 -13
  87. package/dist/core/rules/fetch.mjs +17 -23
  88. package/dist/core/tokens.mjs +2 -1
  89. package/dist/effect.d.mts +2 -4
  90. package/dist/effect.mjs +2 -4
  91. package/dist/engine/commits.mjs +19 -47
  92. package/dist/engine/failures.d.mts +1 -2
  93. package/dist/engine/failures.mjs +1 -3
  94. package/dist/engine/merge-base-walk.mjs +57 -142
  95. package/dist/engine/merge-bases.mjs +5 -5
  96. package/dist/engine/merge.mjs +16 -14
  97. package/dist/extend.d.mts +1 -2
  98. package/dist/extend.mjs +1 -2
  99. package/dist/http/core-parts.mjs +1 -2
  100. package/dist/http/handler.mjs +11 -31
  101. package/dist/http/parts.d.mts +0 -1
  102. package/dist/index.d.mts +28 -21
  103. package/dist/index.mjs +5 -2
  104. package/dist/lfs/base.d.mts +6 -3
  105. package/dist/lfs/base.mjs +2 -1
  106. package/dist/lfs/layer.d.mts +4 -3
  107. package/dist/lfs/layer.mjs +23 -9
  108. package/dist/lfs/objects.mjs +90 -41
  109. package/dist/lfs/pointers.mjs +69 -18
  110. package/dist/lfs/purge.mjs +6 -2
  111. package/dist/lfs/rows.mjs +24 -7
  112. package/dist/lfs/service.d.mts +6 -3
  113. package/dist/lfs/service.mjs +8 -2
  114. package/dist/lfs/upkeep.mjs +44 -26
  115. package/dist/lfs/upload-most.mjs +41 -0
  116. package/dist/lfs/uploaded.mjs +59 -0
  117. package/dist/protocol/bytes/sha256-hasher.mjs +51 -0
  118. package/dist/protocol/bytes/text.mjs +6 -1
  119. package/dist/protocol/objects/fsck.mjs +6 -3
  120. package/dist/queue/advance.mjs +38 -8
  121. package/dist/queue/calls.mjs +4 -14
  122. package/dist/queue/lanes.mjs +1 -1
  123. package/dist/queue/rows.mjs +8 -0
  124. package/dist/queue/schedule.mjs +1 -1
  125. package/dist/queue/search.mjs +3 -4
  126. package/dist/rest/client-namespace.d.mts +2 -0
  127. package/dist/rest/client.d.mts +32 -8
  128. package/dist/rest/client.mjs +308 -382
  129. package/dist/rest/commits.d.mts +240 -240
  130. package/dist/rest/files.d.mts +18 -18
  131. package/dist/rest/forks.d.mts +45 -57
  132. package/dist/rest/handlers.mjs +2 -1
  133. package/dist/rest/listen.d.mts +8 -6
  134. package/dist/rest/listen.mjs +31 -75
  135. package/dist/rest/me.d.mts +2 -2
  136. package/dist/rest/merges.d.mts +7 -7
  137. package/dist/rest/refs.d.mts +139 -139
  138. package/dist/rest/repos.d.mts +54 -66
  139. package/dist/rest/tokens.d.mts +12 -12
  140. package/dist/rest/topics.d.mts +110 -110
  141. package/dist/rest/trees.d.mts +66 -66
  142. package/dist/rest/wire.d.mts +1 -1
  143. package/dist/rest.d.mts +1 -7
  144. package/dist/rest.mjs +1 -5
  145. package/dist/server/git-layer.d.mts +10 -2
  146. package/dist/server/git-layer.mjs +29 -10
  147. package/dist/server/joined.d.mts +1 -1
  148. package/dist/server/server.d.mts +0 -1
  149. package/dist/server/server.mjs +26 -45
  150. package/dist/signin/context.d.mts +0 -1
  151. package/dist/signin/context.mjs +5 -9
  152. package/dist/storage/clean-up.mjs +3 -1
  153. package/dist/storage/fsck.mjs +12 -2
  154. package/dist/storage/graph-rebuild.mjs +262 -0
  155. package/dist/storage/index-build.mjs +100 -12
  156. package/dist/storage/lfs-pointers.d.mts +5 -5
  157. package/dist/storage/lfs-pointers.mjs +37 -11
  158. package/dist/storage/loose.mjs +4 -1
  159. package/dist/storage/memory-budget.mjs +1 -1
  160. package/dist/storage/merge-fence.mjs +81 -19
  161. package/dist/storage/merge-most.mjs +1 -0
  162. package/dist/storage/merge-row.mjs +16 -4
  163. package/dist/storage/merge-stream.mjs +9 -6
  164. package/dist/storage/object-rows.mjs +17 -1
  165. package/dist/storage/pack-receive.mjs +10 -6
  166. package/dist/storage/packs.mjs +58 -27
  167. package/dist/storage/prune.mjs +68 -40
  168. package/dist/storage/ready.d.mts +1 -1
  169. package/dist/storage/ready.mjs +12 -3
  170. package/dist/storage/receive-state.mjs +1 -1
  171. package/dist/storage/repack-contained.mjs +22 -14
  172. package/dist/storage/repack.d.mts +1 -1
  173. package/dist/storage/repack.mjs +3 -2
  174. package/dist/storage/unpack.mjs +7 -0
  175. package/dist/store/call-count.d.mts +23 -3
  176. package/dist/store/call-count.mjs +36 -13
  177. package/dist/store/records.mjs +10 -4
  178. package/dist/store/repo-record.mjs +29 -12
  179. package/dist/store/scopes.mjs +6 -1
  180. package/dist/sync/import.mjs +14 -2
  181. package/dist/sync/layer.d.mts +5 -1
  182. package/dist/sync/layer.mjs +7 -2
  183. package/dist/sync/step.mjs +15 -15
  184. package/dist/topics/advance.mjs +7 -6
  185. package/dist/topics/members.mjs +38 -9
  186. package/package.json +3 -3
  187. package/dist/engine/merge-base-walk.d.mts +0 -3
  188. package/dist/server/routes.d.mts +0 -32
  189. package/dist/server/routes.mjs +0 -69
  190. package/dist/sync/bridge.d.mts +0 -6
  191. package/dist/sync/bridge.mjs +0 -29
@@ -105,9 +105,6 @@ declare const Forks_base: Context.ServiceClass<Forks, "@ref0/git/Forks", EffectC
105
105
  readonly packs?: number;
106
106
  readonly packBytes?: number;
107
107
  readonly ownBytes?: number;
108
- readonly looseObjects?: number;
109
- readonly looseBytes?: number;
110
- readonly leavingBytes?: number;
111
108
  readonly pushedAt?: number;
112
109
  readonly maintainedAt?: number;
113
110
  };
@@ -135,9 +132,6 @@ declare const Forks_base: Context.ServiceClass<Forks, "@ref0/git/Forks", EffectC
135
132
  readonly packs?: number;
136
133
  readonly packBytes?: number;
137
134
  readonly ownBytes?: number;
138
- readonly looseObjects?: number;
139
- readonly looseBytes?: number;
140
- readonly leavingBytes?: number;
141
135
  readonly pushedAt?: number;
142
136
  readonly maintainedAt?: number;
143
137
  };
@@ -165,9 +159,6 @@ declare const Forks_base: Context.ServiceClass<Forks, "@ref0/git/Forks", EffectC
165
159
  readonly packs?: number;
166
160
  readonly packBytes?: number;
167
161
  readonly ownBytes?: number;
168
- readonly looseObjects?: number;
169
- readonly looseBytes?: number;
170
- readonly leavingBytes?: number;
171
162
  readonly pushedAt?: number;
172
163
  readonly maintainedAt?: number;
173
164
  };
@@ -195,9 +186,6 @@ declare const Forks_base: Context.ServiceClass<Forks, "@ref0/git/Forks", EffectC
195
186
  readonly packs?: number;
196
187
  readonly packBytes?: number;
197
188
  readonly ownBytes?: number;
198
- readonly looseObjects?: number;
199
- readonly looseBytes?: number;
200
- readonly leavingBytes?: number;
201
189
  readonly pushedAt?: number;
202
190
  readonly maintainedAt?: number;
203
191
  };
@@ -239,9 +227,6 @@ export declare const create: (repo: RepoName, input: ForkCreateInput, by?: Calle
239
227
  readonly packs?: number;
240
228
  readonly packBytes?: number;
241
229
  readonly ownBytes?: number;
242
- readonly looseObjects?: number;
243
- readonly looseBytes?: number;
244
- readonly leavingBytes?: number;
245
230
  readonly pushedAt?: number;
246
231
  readonly maintainedAt?: number;
247
232
  };
@@ -269,9 +254,6 @@ export declare const get: (repo: RepoName, input: ForkGetInput, by?: Caller) =>
269
254
  readonly packs?: number;
270
255
  readonly packBytes?: number;
271
256
  readonly ownBytes?: number;
272
- readonly looseObjects?: number;
273
- readonly looseBytes?: number;
274
- readonly leavingBytes?: number;
275
257
  readonly pushedAt?: number;
276
258
  readonly maintainedAt?: number;
277
259
  };
@@ -299,9 +281,6 @@ export declare const list: (repo: RepoName, input: ForkListInput, by?: Caller) =
299
281
  readonly packs?: number;
300
282
  readonly packBytes?: number;
301
283
  readonly ownBytes?: number;
302
- readonly looseObjects?: number;
303
- readonly looseBytes?: number;
304
- readonly leavingBytes?: number;
305
284
  readonly pushedAt?: number;
306
285
  readonly maintainedAt?: number;
307
286
  };
@@ -329,9 +308,6 @@ export declare const sync: (fork: RepoName, input: WriteInput & Pick<RepoInput,
329
308
  readonly packs?: number;
330
309
  readonly packBytes?: number;
331
310
  readonly ownBytes?: number;
332
- readonly looseObjects?: number;
333
- readonly looseBytes?: number;
334
- readonly leavingBytes?: number;
335
311
  readonly pushedAt?: number;
336
312
  readonly maintainedAt?: number;
337
313
  };
@@ -2,6 +2,7 @@ import { Duration } from "./promises.mjs";
2
2
  import { DecisionAnswer, GitError } from "./result.mjs";
3
3
  import { PushContext } from "./rules.mjs";
4
4
  import * as Effect from "effect/Effect";
5
+ import * as Schema from "effect/Schema";
5
6
  /** A point core calls a host's hook group at: `push.check`, the whole push, after every per-ref check. */
6
7
  export type HookPoint = 'push.check';
7
8
  /**
@@ -12,6 +13,222 @@ export type HookPoint = 'push.check';
12
13
  export type PushHookInput = PushContext & {
13
14
  readonly atomic: boolean;
14
15
  };
16
+ /** A `PushHookInput`, with `PushContext`'s request, Effect and Stream held as themselves. */
17
+ export declare const PushHookInput: Schema.Union<readonly [Schema.Struct<{
18
+ readonly at: Schema.optionalKey<Schema.Never>;
19
+ readonly actor: Schema.Union<readonly [Schema.Struct<{
20
+ readonly id: Schema.String;
21
+ readonly anonymous: Schema.optionalKey<Schema.Literal<false>>;
22
+ readonly meta: Schema.optionalKey<Schema.Unknown>;
23
+ }>, Schema.Struct<{
24
+ readonly anonymous: Schema.Literal<true>;
25
+ readonly meta: Schema.optionalKey<Schema.Unknown>;
26
+ }>]>;
27
+ } & {
28
+ readonly repo: Schema.String;
29
+ readonly subject: Schema.optionalKey<Schema.Struct<{
30
+ readonly id: Schema.String;
31
+ }>>;
32
+ readonly source: Schema.Literals<readonly ["git", "api", "queue", "import"]>;
33
+ readonly push: Schema.Struct<{
34
+ readonly bytes: Schema.Number;
35
+ readonly objects: Schema.Number;
36
+ readonly updates: Schema.mutable<Schema.$Array<Schema.Struct<{
37
+ readonly ref: Schema.String;
38
+ readonly from: Schema.NullOr<Schema.String>;
39
+ readonly to: Schema.NullOr<Schema.String>;
40
+ readonly kind: Schema.Literals<readonly ["create", "fast-forward", "force", "delete"]>;
41
+ }>>>;
42
+ }>;
43
+ readonly stats: Schema.Struct<{
44
+ readonly repo: Schema.String;
45
+ readonly refs: Schema.Number;
46
+ readonly packs: Schema.Number;
47
+ readonly packBytes: Schema.Number;
48
+ readonly ownBytes: Schema.Number;
49
+ readonly pushedAt: Schema.optionalKey<Schema.Number>;
50
+ readonly maintainedAt: Schema.optionalKey<Schema.Number>;
51
+ }>;
52
+ readonly request: Schema.optionalKey<Schema.declare<Request, Request>>;
53
+ readonly pushOptions: Schema.optionalKey<Schema.$Array<Schema.String>>;
54
+ readonly changes: Schema.declare<Effect.Effect<readonly {
55
+ readonly status: "A" | "D" | "M" | "R" | "T";
56
+ readonly path: string;
57
+ readonly from?: string;
58
+ readonly similarity?: number;
59
+ readonly old?: {
60
+ readonly mode: string;
61
+ readonly oid: string;
62
+ };
63
+ readonly new?: {
64
+ readonly mode: string;
65
+ readonly oid: string;
66
+ };
67
+ readonly pathBytes?: Uint8Array<ArrayBufferLike>;
68
+ readonly fromPathBytes?: Uint8Array<ArrayBufferLike>;
69
+ }[], GitError, never>, Effect.Effect<readonly {
70
+ readonly status: "A" | "D" | "M" | "R" | "T";
71
+ readonly path: string;
72
+ readonly from?: string;
73
+ readonly similarity?: number;
74
+ readonly old?: {
75
+ readonly mode: string;
76
+ readonly oid: string;
77
+ };
78
+ readonly new?: {
79
+ readonly mode: string;
80
+ readonly oid: string;
81
+ };
82
+ readonly pathBytes?: Uint8Array<ArrayBufferLike>;
83
+ readonly fromPathBytes?: Uint8Array<ArrayBufferLike>;
84
+ }[], GitError, never>>;
85
+ readonly commitChanges: Schema.declare<import("effect/Stream").Stream<{
86
+ readonly commit: string;
87
+ readonly root: boolean;
88
+ readonly change: {
89
+ readonly status: "A" | "D" | "M" | "R" | "T";
90
+ readonly path: string;
91
+ readonly from?: string;
92
+ readonly similarity?: number;
93
+ readonly old?: {
94
+ readonly mode: string;
95
+ readonly oid: string;
96
+ };
97
+ readonly new?: {
98
+ readonly mode: string;
99
+ readonly oid: string;
100
+ };
101
+ readonly pathBytes?: Uint8Array<ArrayBufferLike>;
102
+ readonly fromPathBytes?: Uint8Array<ArrayBufferLike>;
103
+ };
104
+ }, GitError, never>, import("effect/Stream").Stream<{
105
+ readonly commit: string;
106
+ readonly root: boolean;
107
+ readonly change: {
108
+ readonly status: "A" | "D" | "M" | "R" | "T";
109
+ readonly path: string;
110
+ readonly from?: string;
111
+ readonly similarity?: number;
112
+ readonly old?: {
113
+ readonly mode: string;
114
+ readonly oid: string;
115
+ };
116
+ readonly new?: {
117
+ readonly mode: string;
118
+ readonly oid: string;
119
+ };
120
+ readonly pathBytes?: Uint8Array<ArrayBufferLike>;
121
+ readonly fromPathBytes?: Uint8Array<ArrayBufferLike>;
122
+ };
123
+ }, GitError, never>>;
124
+ } & {
125
+ readonly atomic: Schema.Boolean;
126
+ }>, Schema.Struct<{
127
+ readonly at: Schema.Literal<"queued">;
128
+ readonly actor: Schema.Struct<{
129
+ readonly id: Schema.String;
130
+ readonly anonymous: Schema.optionalKey<Schema.Literal<false>>;
131
+ }>;
132
+ } & {
133
+ readonly repo: Schema.String;
134
+ readonly subject: Schema.optionalKey<Schema.Struct<{
135
+ readonly id: Schema.String;
136
+ }>>;
137
+ readonly source: Schema.Literals<readonly ["git", "api", "queue", "import"]>;
138
+ readonly push: Schema.Struct<{
139
+ readonly bytes: Schema.Number;
140
+ readonly objects: Schema.Number;
141
+ readonly updates: Schema.mutable<Schema.$Array<Schema.Struct<{
142
+ readonly ref: Schema.String;
143
+ readonly from: Schema.NullOr<Schema.String>;
144
+ readonly to: Schema.NullOr<Schema.String>;
145
+ readonly kind: Schema.Literals<readonly ["create", "fast-forward", "force", "delete"]>;
146
+ }>>>;
147
+ }>;
148
+ readonly stats: Schema.Struct<{
149
+ readonly repo: Schema.String;
150
+ readonly refs: Schema.Number;
151
+ readonly packs: Schema.Number;
152
+ readonly packBytes: Schema.Number;
153
+ readonly ownBytes: Schema.Number;
154
+ readonly pushedAt: Schema.optionalKey<Schema.Number>;
155
+ readonly maintainedAt: Schema.optionalKey<Schema.Number>;
156
+ }>;
157
+ readonly request: Schema.optionalKey<Schema.declare<Request, Request>>;
158
+ readonly pushOptions: Schema.optionalKey<Schema.$Array<Schema.String>>;
159
+ readonly changes: Schema.declare<Effect.Effect<readonly {
160
+ readonly status: "A" | "D" | "M" | "R" | "T";
161
+ readonly path: string;
162
+ readonly from?: string;
163
+ readonly similarity?: number;
164
+ readonly old?: {
165
+ readonly mode: string;
166
+ readonly oid: string;
167
+ };
168
+ readonly new?: {
169
+ readonly mode: string;
170
+ readonly oid: string;
171
+ };
172
+ readonly pathBytes?: Uint8Array<ArrayBufferLike>;
173
+ readonly fromPathBytes?: Uint8Array<ArrayBufferLike>;
174
+ }[], GitError, never>, Effect.Effect<readonly {
175
+ readonly status: "A" | "D" | "M" | "R" | "T";
176
+ readonly path: string;
177
+ readonly from?: string;
178
+ readonly similarity?: number;
179
+ readonly old?: {
180
+ readonly mode: string;
181
+ readonly oid: string;
182
+ };
183
+ readonly new?: {
184
+ readonly mode: string;
185
+ readonly oid: string;
186
+ };
187
+ readonly pathBytes?: Uint8Array<ArrayBufferLike>;
188
+ readonly fromPathBytes?: Uint8Array<ArrayBufferLike>;
189
+ }[], GitError, never>>;
190
+ readonly commitChanges: Schema.declare<import("effect/Stream").Stream<{
191
+ readonly commit: string;
192
+ readonly root: boolean;
193
+ readonly change: {
194
+ readonly status: "A" | "D" | "M" | "R" | "T";
195
+ readonly path: string;
196
+ readonly from?: string;
197
+ readonly similarity?: number;
198
+ readonly old?: {
199
+ readonly mode: string;
200
+ readonly oid: string;
201
+ };
202
+ readonly new?: {
203
+ readonly mode: string;
204
+ readonly oid: string;
205
+ };
206
+ readonly pathBytes?: Uint8Array<ArrayBufferLike>;
207
+ readonly fromPathBytes?: Uint8Array<ArrayBufferLike>;
208
+ };
209
+ }, GitError, never>, import("effect/Stream").Stream<{
210
+ readonly commit: string;
211
+ readonly root: boolean;
212
+ readonly change: {
213
+ readonly status: "A" | "D" | "M" | "R" | "T";
214
+ readonly path: string;
215
+ readonly from?: string;
216
+ readonly similarity?: number;
217
+ readonly old?: {
218
+ readonly mode: string;
219
+ readonly oid: string;
220
+ };
221
+ readonly new?: {
222
+ readonly mode: string;
223
+ readonly oid: string;
224
+ };
225
+ readonly pathBytes?: Uint8Array<ArrayBufferLike>;
226
+ readonly fromPathBytes?: Uint8Array<ArrayBufferLike>;
227
+ };
228
+ }, GitError, never>>;
229
+ } & {
230
+ readonly atomic: Schema.Boolean;
231
+ }>]>;
15
232
  /**
16
233
  * A hook group's options: its band, `pre` or `post`, plain when left out, and how long each of its
17
234
  * handlers may run, past which its call is interrupted and the push refused.
@@ -1,4 +1,6 @@
1
- // src/contracts/git-hooks.ts
1
+ import "./rules.mjs";
2
+ import * as Schema from "effect/Schema";
3
+ Schema.Boolean;
2
4
  /** The handlers `handlers` holds, with `handle` to add one. */
3
5
  const handlersOf = (handlers) => ({
4
6
  handlers,
@@ -1,21 +1,28 @@
1
- import { ActorId, CallInput, Credentials, NamedActor } from "./actors.mjs";
2
- import { InternalRepoId, RepoName } from "./ids.mjs";
3
1
  import { Awaitable } from "./result.mjs";
4
- import { TokenScope } from "./tokens.mjs";
5
- export interface GrantInput extends CallInput {
6
- readonly credentials: Credentials;
7
- readonly request: Request;
8
- readonly signal: AbortSignal;
9
- }
2
+ import * as Schema from "effect/Schema";
3
+ export declare const GrantInput: Schema.Struct<{
4
+ readonly credentials: Schema.Union<readonly [Schema.Struct<{
5
+ readonly kind: Schema.Literal<"basic">;
6
+ readonly username: Schema.String;
7
+ readonly password: Schema.String;
8
+ }>, Schema.Struct<{
9
+ readonly kind: Schema.Literal<"bearer">;
10
+ readonly token: Schema.String;
11
+ }>]>;
12
+ readonly request: Schema.declare<Request, Request>;
13
+ readonly signal: Schema.declare<AbortSignal, AbortSignal>;
14
+ }>;
15
+ export type GrantInput = typeof GrantInput.Type;
10
16
  /**
11
17
  * `internalId`: which repo `repo` names, when Git holds it: decide by it, since a rename can give
12
18
  * the name to another repo while a request runs.
13
19
  */
14
- export interface GrantReachInput extends CallInput {
15
- readonly repo: RepoName;
16
- readonly internalId?: InternalRepoId;
17
- readonly signal: AbortSignal;
18
- }
20
+ export declare const GrantReachInput: Schema.Struct<{
21
+ readonly repo: Schema.String;
22
+ readonly internalId: Schema.optionalKey<Schema.TemplateLiteral<readonly ["r_", Schema.String]>>;
23
+ readonly signal: Schema.declare<AbortSignal, AbortSignal>;
24
+ }>;
25
+ export type GrantReachInput = typeof GrantReachInput.Type;
19
26
  /**
20
27
  * What a credential an extension issued holds: who it acts as, its ceiling, and which repos it
21
28
  * reaches, asked on each request and again in a write's final read, so a grant that ends stops at
@@ -23,11 +30,17 @@ export interface GrantReachInput extends CallInput {
23
30
  * so work that outlives the request, such as a merge queue entry, keeps the ID, never the
24
31
  * credential, and asks for the grant again.
25
32
  */
26
- export interface Grant {
27
- readonly id: string;
28
- readonly actor: NamedActor;
29
- readonly subject?: ActorId;
30
- readonly scope: TokenScope;
33
+ export declare const Grant: Schema.Struct<{
34
+ readonly id: Schema.String;
35
+ readonly actor: Schema.Struct<{
36
+ readonly id: Schema.String;
37
+ readonly anonymous: Schema.optionalKey<Schema.Literal<false>>;
38
+ readonly meta: Schema.optionalKey<Schema.Unknown>;
39
+ }>;
40
+ readonly subject: Schema.optionalKey<Schema.Struct<{
41
+ readonly id: Schema.String;
42
+ }>>;
43
+ readonly scope: Schema.Literals<readonly ["read", "report", "write"]>;
31
44
  /**
32
45
  * The folder every repo `reaches` answers yes for sits under, read as a prefix token's `prefix`
33
46
  * is: `''`, or a prefix that ends in `/`. `forks.list` reads a source's forks under it alone, so
@@ -35,16 +48,22 @@ export interface Grant {
35
48
  * and asks `reaches` of each. A `reach` that leaves out a repo `reaches` answers yes for hides
36
49
  * that repo from the list.
37
50
  */
38
- readonly reach?: string;
39
- readonly reaches: (input: GrantReachInput) => Awaitable<boolean>;
40
- }
51
+ readonly reach: Schema.optionalKey<Schema.String>;
52
+ readonly reaches: Schema.declare<(input: GrantReachInput) => Awaitable<boolean>, (input: GrantReachInput) => Awaitable<boolean>>;
53
+ }>;
54
+ export type Grant = typeof Grant.Type;
41
55
  /** A grant asked for again by the `id` it had, with the actor and subject it acted as then. */
42
- export interface GrantAgainInput extends CallInput {
43
- readonly id: string;
44
- readonly actor: ActorId;
45
- readonly subject?: ActorId;
46
- readonly signal: AbortSignal;
47
- }
56
+ export declare const GrantAgainInput: Schema.Struct<{
57
+ readonly id: Schema.String;
58
+ readonly actor: Schema.Struct<{
59
+ readonly id: Schema.String;
60
+ }>;
61
+ readonly subject: Schema.optionalKey<Schema.Struct<{
62
+ readonly id: Schema.String;
63
+ }>>;
64
+ readonly signal: Schema.declare<AbortSignal, AbortSignal>;
65
+ }>;
66
+ export type GrantAgainInput = typeof GrantAgainInput.Type;
48
67
  /**
49
68
  * What host code asks `grantAgain` with: `GrantAgainInput`, its `signal` optional. The resolver
50
69
  * gets it joined with Git's own, so a request that goes away stops the read.
@@ -2,13 +2,26 @@ import { ActorInput } from "./actors.mjs";
2
2
  import { RepoName } from "./ids.mjs";
3
3
  import "./objects.mjs";
4
4
  import { RepoInput } from "./repos.mjs";
5
- import { Bytes } from "./object-values.mjs";
6
5
  import { Result } from "./result.mjs";
6
+ import { Bytes } from "./object-values.mjs";
7
+ /**
8
+ * The caps an upload through the server meets, on a bucket that signs no links, so each upload's
9
+ * bytes stream through it: an upload past what they let finish is refused at the batch, 422, and
10
+ * its PUT, 413, before a byte streams. Each wins over the adapter's `RequestLimits`, which the
11
+ * platform's Layer gives, as Cloudflare's 100 MiB and 30,000 ms: set them where the host's differ,
12
+ * a zone's plan that takes a larger body, or a Worker's raised `limits.cpu_ms`.
13
+ */
14
+ export interface LfsOptions {
15
+ /** The largest request body the host's platform passes on, in bytes. */
16
+ readonly bodyCap?: number;
17
+ /** The CPU one of the host's requests may use, in milliseconds, as a Worker's `limits.cpu_ms`. */
18
+ readonly cpuMs?: number;
19
+ }
7
20
  /**
8
- * Turns on Git LFS: `lfs()`, from `@ref0/git`, which `createGitServer` builds `Lfs.layer()` for. A
9
- * bucket alone turns nothing on.
21
+ * Turns on Git LFS: `lfs()`, from `@ref0/git`, which `createGitServer` builds `Lfs.layer()` for,
22
+ * with its options. A bucket alone turns nothing on.
10
23
  */
11
- export interface LfsFeature {
24
+ export interface LfsFeature extends LfsOptions {
12
25
  readonly kind: 'lfs';
13
26
  }
14
27
  /** An LFS object, by its oid, the SHA-256 of its bytes in 64 hex digits. */
@@ -8,6 +8,13 @@ import * as Schema from "effect/Schema";
8
8
  * parents are `ours`' tip and `theirs`. Unrelated histories are refused.
9
9
  */
10
10
  export declare const MergeCreate: Schema.Struct<{
11
+ readonly message: Schema.String;
12
+ readonly author: Schema.Struct<{
13
+ readonly name: Schema.String;
14
+ readonly email: Schema.String;
15
+ readonly at: Schema.Number;
16
+ readonly offset: Schema.Int;
17
+ }>;
11
18
  readonly ours: Schema.String;
12
19
  readonly theirs: Schema.String;
13
20
  /** The author, when left out. */
@@ -17,13 +24,6 @@ export declare const MergeCreate: Schema.Struct<{
17
24
  readonly at: Schema.Number;
18
25
  readonly offset: Schema.Int;
19
26
  }>>;
20
- readonly message: Schema.String;
21
- readonly author: Schema.Struct<{
22
- readonly name: Schema.String;
23
- readonly email: Schema.String;
24
- readonly at: Schema.Number;
25
- readonly offset: Schema.Int;
26
- }>;
27
27
  }>;
28
28
  export type MergeCreate = typeof MergeCreate.Type;
29
29
  export interface MergeCreateInput extends WriteInput, MergeCreate, Pick<RepoInput, 'internalId'> {}
@@ -251,11 +251,26 @@ export interface SegmentCut {
251
251
  readonly commit: Oid;
252
252
  readonly parents: readonly Oid[];
253
253
  }
254
+ /**
255
+ * How a change moves the repo's object rows, the objects it keeps as rows in the `objects`
256
+ * collection and not in a pack: how many it puts less how many it deletes, and their values' bytes
257
+ * as UTF-8 JSON, as the store counts them, the same way. A storage that keeps no rows gives zeros.
258
+ * A put counts as new: the core takes out each row the repo holds already at the commit's version,
259
+ * which the put only writes again. The core keeps a tally of the rows that `RepoStats.ownBytes`
260
+ * counts, so a quota sees them (#2237): it's required, since one left out would hide them from the
261
+ * quota.
262
+ */
263
+ export interface RowsMoved {
264
+ readonly objects: number;
265
+ readonly bytes: number;
266
+ }
254
267
  export interface ObjectsChange {
255
268
  readonly add?: readonly Pack[];
256
269
  readonly remove?: readonly string[];
257
270
  readonly put?: readonly Row[];
258
271
  readonly delete?: readonly Key[];
272
+ /** The object rows the change puts and deletes, as `RowsMoved` says. */
273
+ readonly rows: RowsMoved;
259
274
  }
260
275
  /**
261
276
  * The bytes of a server's memory budget one call takes, which it grows as it needs more and
@@ -540,9 +555,10 @@ export interface ObjectsStep {
540
555
  */
541
556
  readonly yielded?: true;
542
557
  /**
543
- * When the `repack` row is next due, from a step of the prune pass's merge that ends it: the
544
- * core saves `git.repack`'s `repack` row for then, in that step's commit, as `prune` saves the
545
- * pass's. A `repack` run that yielded to the merge left its own row's work for this one.
558
+ * When the `repack` row is next due, from a step of the prune pass that ends a merge or unlists
559
+ * packs: the core saves `git.repack`'s `repack` row for then, in that step's commit, as `prune`
560
+ * saves the pass's. A `repack` run that yielded to the merge left its own row's work for this
561
+ * one, and clean-up deletes an unlisted pack's bytes once its `leaving` row is due.
546
562
  */
547
563
  readonly repack?: Moment;
548
564
  /**
@@ -883,4 +899,4 @@ export type IndexTry = {
883
899
  } | {
884
900
  readonly kind: 'moved';
885
901
  };
886
- export { Bucket$1 as Bucket, type Bytes, type FetchRequest, type Filter, type LfsPointers, type ObjectType, type ReadLimits };
902
+ export { Bucket$1 as Bucket, type Bytes, type Filter, type LfsPointers, type ObjectType, type ReadLimits };
@@ -1,4 +1,7 @@
1
+ import * as Effect from "effect/Effect";
1
2
  import * as Schema from "effect/Schema";
3
+ import * as Predicate from "effect/Predicate";
4
+ import * as Stream from "effect/Stream";
2
5
  // src/contracts/opaque.ts
3
6
  /**
4
7
  * The Web's values a contract carries as themselves, never as JSON: each is held as the very
@@ -6,4 +9,19 @@ import * as Schema from "effect/Schema";
6
9
  */
7
10
  const AbortSignalValue = /* @__PURE__ */ Schema.declare((input) => input instanceof AbortSignal);
8
11
  const RequestValue = /* @__PURE__ */ Schema.declare((input) => input instanceof Request);
9
- export { AbortSignalValue, RequestValue };
12
+ /**
13
+ * A host's function, held as itself: `F` is what its contract types it as, which nothing checks
14
+ * past its being a function, and a JSON codec refuses it.
15
+ */
16
+ const FunctionValue = () => Schema.declare((input) => Predicate.isFunction(input));
17
+ /**
18
+ * A host's Effect, held as itself: `A` and `E` are what its contract types it as, which nothing
19
+ * checks past its being an Effect, and a JSON codec refuses it.
20
+ */
21
+ const EffectValue = () => Schema.declare((input) => Effect.isEffect(input));
22
+ /**
23
+ * A Stream, held as itself: `A` and `E` are what its contract types it as, which nothing checks
24
+ * past its being a Stream, and a JSON codec refuses it.
25
+ */
26
+ const StreamValue = () => Schema.declare((input) => Stream.isStream(input));
27
+ export { AbortSignalValue, EffectValue, FunctionValue, RequestValue, StreamValue };
@@ -84,6 +84,7 @@ export declare const TokenCreateOperation: Schema.Union<readonly [Schema.Struct<
84
84
  readonly id: Schema.String;
85
85
  }>>;
86
86
  readonly kind: Schema.Literal<"token.create">;
87
+ readonly scope: Schema.Literals<readonly ["read", "report", "write", "admin"]>;
87
88
  }>, Schema.Struct<{
88
89
  readonly prefix: Schema.String;
89
90
  readonly repo: Schema.optionalKey<Schema.Never>;
@@ -94,6 +95,7 @@ export declare const TokenCreateOperation: Schema.Union<readonly [Schema.Struct<
94
95
  readonly id: Schema.String;
95
96
  }>>;
96
97
  readonly kind: Schema.Literal<"token.create">;
98
+ readonly scope: Schema.Literals<readonly ["read", "report", "write", "admin"]>;
97
99
  }>]>;
98
100
  export type TokenCreateOperation = typeof TokenCreateOperation.Type;
99
101
  export declare const TokenOperation: Schema.Union<readonly [Schema.Union<readonly [Schema.Struct<{
@@ -106,6 +108,7 @@ export declare const TokenOperation: Schema.Union<readonly [Schema.Union<readonl
106
108
  readonly id: Schema.String;
107
109
  }>>;
108
110
  readonly kind: Schema.Literal<"token.create">;
111
+ readonly scope: Schema.Literals<readonly ["read", "report", "write", "admin"]>;
109
112
  }>, Schema.Struct<{
110
113
  readonly prefix: Schema.String;
111
114
  readonly repo: Schema.optionalKey<Schema.Never>;
@@ -116,6 +119,7 @@ export declare const TokenOperation: Schema.Union<readonly [Schema.Union<readonl
116
119
  readonly id: Schema.String;
117
120
  }>>;
118
121
  readonly kind: Schema.Literal<"token.create">;
122
+ readonly scope: Schema.Literals<readonly ["read", "report", "write", "admin"]>;
119
123
  }>]>, Schema.Union<readonly [Schema.Struct<{
120
124
  readonly repo: Schema.String;
121
125
  readonly prefix: Schema.optionalKey<Schema.Never>;
@@ -191,7 +195,8 @@ export type TopicOperation = typeof TopicOperation.Type;
191
195
  * every pattern `privateRefs` was given, as written. Accept with `{ read, publish }`, each a list
192
196
  * of those patterns: `read` the patterns whose refs the caller sees, `publish` those whose commits
193
197
  * the caller may make reachable from a ref more people see. An answer with neither, `accept()`
194
- * with no value, or a refusal, sees no private ref and publishes nothing.
198
+ * with no value, or a refusal, sees no private ref and publishes nothing. An import asks it once
199
+ * more before it makes the repo, with no `AuthorizeInput.repo`, as `repo.create` asks.
195
200
  */
196
201
  export declare const RefsPrivateOperation: Schema.Struct<{
197
202
  readonly kind: Schema.Literal<"refs.private">;
@@ -255,6 +260,7 @@ export declare const Operation: Schema.Union<readonly [Schema.Struct<{
255
260
  readonly id: Schema.String;
256
261
  }>>;
257
262
  readonly kind: Schema.Literal<"token.create">;
263
+ readonly scope: Schema.Literals<readonly ["read", "report", "write", "admin"]>;
258
264
  }>, Schema.Struct<{
259
265
  readonly prefix: Schema.String;
260
266
  readonly repo: Schema.optionalKey<Schema.Never>;
@@ -265,6 +271,7 @@ export declare const Operation: Schema.Union<readonly [Schema.Struct<{
265
271
  readonly id: Schema.String;
266
272
  }>>;
267
273
  readonly kind: Schema.Literal<"token.create">;
274
+ readonly scope: Schema.Literals<readonly ["read", "report", "write", "admin"]>;
268
275
  }>]>, Schema.Union<readonly [Schema.Struct<{
269
276
  readonly repo: Schema.String;
270
277
  readonly prefix: Schema.optionalKey<Schema.Never>;