@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
@@ -1,7 +1,7 @@
1
1
  import { GitCallerMiddleware, GitRestServices } from "./caller.mjs";
2
2
  import * as Schema from "effect/Schema";
3
3
  import { HttpApiEndpoint, HttpApiGroup } from "effect/http-api";
4
- declare const TopicsApiGroup_base: HttpApiGroup.HttpApiGroup<"topics", HttpApiEndpoint.HttpApiEndpoint<"remove", "DELETE", "/topics/:topic", Schema.toCodecStringTree<Schema.Struct<{
4
+ declare const TopicsApiGroup_base: HttpApiGroup.HttpApiGroup<"topics", HttpApiEndpoint.HttpApiEndpoint<"get", "GET", "/topics/:topic", Schema.toCodecStringTree<Schema.Struct<{
5
5
  topic: Schema.String;
6
6
  }>>, never, never, never, Schema.toCodecJson<Schema.Struct<{
7
7
  readonly id: Schema.String;
@@ -444,7 +444,7 @@ declare const TopicsApiGroup_base: HttpApiGroup.HttpApiGroup<"topics", HttpApiEn
444
444
  }>, {
445
445
  "ref0-code": Schema.String;
446
446
  'www-authenticate': Schema.String;
447
- }>>, GitCallerMiddleware, GitRestServices> | HttpApiEndpoint.HttpApiEndpoint<"get", "GET", "/topics/:topic", Schema.toCodecStringTree<Schema.Struct<{
447
+ }>>, GitCallerMiddleware, GitRestServices> | HttpApiEndpoint.HttpApiEndpoint<"remove", "DELETE", "/topics/:topic", Schema.toCodecStringTree<Schema.Struct<{
448
448
  topic: Schema.String;
449
449
  }>>, never, never, never, Schema.toCodecJson<Schema.Struct<{
450
450
  readonly id: Schema.String;
@@ -887,55 +887,57 @@ declare const TopicsApiGroup_base: HttpApiGroup.HttpApiGroup<"topics", HttpApiEn
887
887
  }>, {
888
888
  "ref0-code": Schema.String;
889
889
  'www-authenticate': Schema.String;
890
- }>>, GitCallerMiddleware, GitRestServices> | HttpApiEndpoint.HttpApiEndpoint<"list", "GET", "/topics", never, Schema.toCodecStringTree<Schema.Struct<{
891
- after: Schema.optionalKey<Schema.String>;
892
- limit: Schema.optionalKey<Schema.Int>;
893
- state: Schema.optionalKey<Schema.Literals<readonly ["reserving", "checking", "publishing", "failed", "merged", "removed"]>>;
894
- }>>, never, never, Schema.toCodecJson<Schema.Struct<{
895
- readonly items: Schema.mutable<Schema.$Array<Schema.Struct<{
896
- readonly id: Schema.String;
890
+ }>>, GitCallerMiddleware, GitRestServices> | HttpApiEndpoint.HttpApiEndpoint<"add", "POST", "/topics", never, never, Schema.toCodecJson<Schema.Struct<{
891
+ readonly key: Schema.String;
892
+ readonly entries: Schema.$Array<Schema.Struct<{
893
+ readonly target: Schema.String;
894
+ readonly source: Schema.String;
895
+ readonly head: Schema.String;
897
896
  readonly key: Schema.String;
898
- readonly state: Schema.Literals<readonly ["reserving", "checking", "publishing", "failed", "merged", "removed"]>;
899
- readonly entries: Schema.$Array<Schema.Struct<{
900
- readonly repo: Schema.String;
901
- readonly target: Schema.String;
902
- readonly entry: Schema.String;
903
- readonly key: Schema.String;
904
- readonly source: Schema.String;
905
- readonly head: Schema.String;
906
- }>>;
907
- readonly pending: Schema.$Array<Schema.Struct<{
908
- readonly repo: Schema.String;
909
- readonly target: Schema.String;
910
- readonly source: Schema.String;
911
- readonly head: Schema.String;
912
- readonly key: Schema.String;
913
- }>>;
914
- readonly candidates: Schema.$Array<Schema.Struct<{
915
- readonly repo: Schema.String;
916
- readonly target: Schema.String;
917
- readonly candidate: Schema.String;
918
- readonly ref: Schema.String;
919
- readonly commit: Schema.String;
920
- }>>;
921
- readonly waitingOn: Schema.optionalKey<Schema.Struct<{
922
- readonly repo: Schema.String;
923
- readonly target: Schema.String;
924
- readonly topic: Schema.optionalKey<Schema.String>;
925
- readonly hold: Schema.optionalKey<Schema.String>;
926
- }>>;
927
- readonly failure: Schema.optionalKey<Schema.Struct<{
928
- readonly reason: Schema.Literals<readonly ["entry-failed", "reported", "cancelled", "refused", "host-error", "work-failed", "timeout", "report-timeout", "prepare-rejected"]>;
929
- readonly repo: Schema.optionalKey<Schema.String>;
930
- readonly entry: Schema.optionalKey<Schema.String>;
931
- readonly candidate: Schema.optionalKey<Schema.String>;
932
- readonly summary: Schema.optionalKey<Schema.String>;
933
- readonly url: Schema.optionalKey<Schema.String>;
934
- readonly error: Schema.optionalKey<Schema.String>;
935
- readonly hint: Schema.String;
936
- }>>;
937
- }>>>;
938
- readonly next: Schema.optionalKey<Schema.String>;
897
+ readonly repo: Schema.String;
898
+ }>>;
899
+ }>>, never, Schema.toCodecJson<Schema.Struct<{
900
+ readonly id: Schema.String;
901
+ readonly key: Schema.String;
902
+ readonly state: Schema.Literals<readonly ["reserving", "checking", "publishing", "failed", "merged", "removed"]>;
903
+ readonly entries: Schema.$Array<Schema.Struct<{
904
+ readonly repo: Schema.String;
905
+ readonly target: Schema.String;
906
+ readonly entry: Schema.String;
907
+ readonly key: Schema.String;
908
+ readonly source: Schema.String;
909
+ readonly head: Schema.String;
910
+ }>>;
911
+ readonly pending: Schema.$Array<Schema.Struct<{
912
+ readonly repo: Schema.String;
913
+ readonly target: Schema.String;
914
+ readonly source: Schema.String;
915
+ readonly head: Schema.String;
916
+ readonly key: Schema.String;
917
+ }>>;
918
+ readonly candidates: Schema.$Array<Schema.Struct<{
919
+ readonly repo: Schema.String;
920
+ readonly target: Schema.String;
921
+ readonly candidate: Schema.String;
922
+ readonly ref: Schema.String;
923
+ readonly commit: Schema.String;
924
+ }>>;
925
+ readonly waitingOn: Schema.optionalKey<Schema.Struct<{
926
+ readonly repo: Schema.String;
927
+ readonly target: Schema.String;
928
+ readonly topic: Schema.optionalKey<Schema.String>;
929
+ readonly hold: Schema.optionalKey<Schema.String>;
930
+ }>>;
931
+ readonly failure: Schema.optionalKey<Schema.Struct<{
932
+ readonly reason: Schema.Literals<readonly ["entry-failed", "reported", "cancelled", "refused", "host-error", "work-failed", "timeout", "report-timeout", "prepare-rejected"]>;
933
+ readonly repo: Schema.optionalKey<Schema.String>;
934
+ readonly entry: Schema.optionalKey<Schema.String>;
935
+ readonly candidate: Schema.optionalKey<Schema.String>;
936
+ readonly summary: Schema.optionalKey<Schema.String>;
937
+ readonly url: Schema.optionalKey<Schema.String>;
938
+ readonly error: Schema.optionalKey<Schema.String>;
939
+ readonly hint: Schema.String;
940
+ }>>;
939
941
  }>>, Schema.toCodecJson<import("effect/http-api/HttpApiSchema").encodeToWithHeaders<Schema.Codec<{
940
942
  readonly code: "ALREADY_EXISTS";
941
943
  readonly message: string;
@@ -1335,57 +1337,16 @@ declare const TopicsApiGroup_base: HttpApiGroup.HttpApiGroup<"topics", HttpApiEn
1335
1337
  }>, {
1336
1338
  "ref0-code": Schema.String;
1337
1339
  'www-authenticate': Schema.String;
1338
- }>>, GitCallerMiddleware, GitRestServices> | HttpApiEndpoint.HttpApiEndpoint<"add", "POST", "/topics", never, never, Schema.toCodecJson<Schema.Struct<{
1339
- readonly key: Schema.String;
1340
- readonly entries: Schema.$Array<Schema.Struct<{
1341
- readonly target: Schema.String;
1342
- readonly source: Schema.String;
1343
- readonly head: Schema.String;
1344
- readonly key: Schema.String;
1345
- readonly repo: Schema.String;
1346
- }>>;
1340
+ }>>, GitCallerMiddleware, GitRestServices> | HttpApiEndpoint.HttpApiEndpoint<"report", "POST", "/topics/:topic/report", Schema.toCodecStringTree<Schema.Struct<{
1341
+ topic: Schema.String;
1347
1342
  }>>, never, Schema.toCodecJson<Schema.Struct<{
1348
- readonly id: Schema.String;
1349
- readonly key: Schema.String;
1350
- readonly state: Schema.Literals<readonly ["reserving", "checking", "publishing", "failed", "merged", "removed"]>;
1351
- readonly entries: Schema.$Array<Schema.Struct<{
1352
- readonly repo: Schema.String;
1353
- readonly target: Schema.String;
1354
- readonly entry: Schema.String;
1355
- readonly key: Schema.String;
1356
- readonly source: Schema.String;
1357
- readonly head: Schema.String;
1358
- }>>;
1359
- readonly pending: Schema.$Array<Schema.Struct<{
1360
- readonly repo: Schema.String;
1361
- readonly target: Schema.String;
1362
- readonly source: Schema.String;
1363
- readonly head: Schema.String;
1364
- readonly key: Schema.String;
1365
- }>>;
1366
- readonly candidates: Schema.$Array<Schema.Struct<{
1367
- readonly repo: Schema.String;
1368
- readonly target: Schema.String;
1369
- readonly candidate: Schema.String;
1370
- readonly ref: Schema.String;
1371
- readonly commit: Schema.String;
1372
- }>>;
1373
- readonly waitingOn: Schema.optionalKey<Schema.Struct<{
1374
- readonly repo: Schema.String;
1375
- readonly target: Schema.String;
1376
- readonly topic: Schema.optionalKey<Schema.String>;
1377
- readonly hold: Schema.optionalKey<Schema.String>;
1378
- }>>;
1379
- readonly failure: Schema.optionalKey<Schema.Struct<{
1380
- readonly reason: Schema.Literals<readonly ["entry-failed", "reported", "cancelled", "refused", "host-error", "work-failed", "timeout", "report-timeout", "prepare-rejected"]>;
1381
- readonly repo: Schema.optionalKey<Schema.String>;
1382
- readonly entry: Schema.optionalKey<Schema.String>;
1383
- readonly candidate: Schema.optionalKey<Schema.String>;
1384
- readonly summary: Schema.optionalKey<Schema.String>;
1385
- readonly url: Schema.optionalKey<Schema.String>;
1386
- readonly error: Schema.optionalKey<Schema.String>;
1387
- readonly hint: Schema.String;
1388
- }>>;
1343
+ readonly summary: Schema.optionalKey<Schema.String>;
1344
+ readonly url: Schema.optionalKey<Schema.String>;
1345
+ readonly meta: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
1346
+ readonly verdict: Schema.Literals<readonly ["pass", "fail", "cancel"]>;
1347
+ readonly candidates: Schema.$Array<Schema.String>;
1348
+ }>>, never, Schema.toCodecJson<Schema.Struct<{
1349
+ readonly repeat: Schema.Boolean;
1389
1350
  }>>, Schema.toCodecJson<import("effect/http-api/HttpApiSchema").encodeToWithHeaders<Schema.Codec<{
1390
1351
  readonly code: "ALREADY_EXISTS";
1391
1352
  readonly message: string;
@@ -1785,16 +1746,55 @@ declare const TopicsApiGroup_base: HttpApiGroup.HttpApiGroup<"topics", HttpApiEn
1785
1746
  }>, {
1786
1747
  "ref0-code": Schema.String;
1787
1748
  'www-authenticate': Schema.String;
1788
- }>>, GitCallerMiddleware, GitRestServices> | HttpApiEndpoint.HttpApiEndpoint<"report", "POST", "/topics/:topic/report", Schema.toCodecStringTree<Schema.Struct<{
1789
- topic: Schema.String;
1790
- }>>, never, Schema.toCodecJson<Schema.Struct<{
1791
- readonly summary: Schema.optionalKey<Schema.String>;
1792
- readonly url: Schema.optionalKey<Schema.String>;
1793
- readonly meta: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
1794
- readonly verdict: Schema.Literals<readonly ["pass", "fail", "cancel"]>;
1795
- readonly candidates: Schema.$Array<Schema.String>;
1796
- }>>, never, Schema.toCodecJson<Schema.Struct<{
1797
- readonly repeat: Schema.Boolean;
1749
+ }>>, GitCallerMiddleware, GitRestServices> | HttpApiEndpoint.HttpApiEndpoint<"list", "GET", "/topics", never, Schema.toCodecStringTree<Schema.Struct<{
1750
+ after: Schema.optionalKey<Schema.String>;
1751
+ limit: Schema.optionalKey<Schema.Int>;
1752
+ state: Schema.optionalKey<Schema.Literals<readonly ["reserving", "checking", "publishing", "failed", "merged", "removed"]>>;
1753
+ }>>, never, never, Schema.toCodecJson<Schema.Struct<{
1754
+ readonly items: Schema.mutable<Schema.$Array<Schema.Struct<{
1755
+ readonly id: Schema.String;
1756
+ readonly key: Schema.String;
1757
+ readonly state: Schema.Literals<readonly ["reserving", "checking", "publishing", "failed", "merged", "removed"]>;
1758
+ readonly entries: Schema.$Array<Schema.Struct<{
1759
+ readonly repo: Schema.String;
1760
+ readonly target: Schema.String;
1761
+ readonly entry: Schema.String;
1762
+ readonly key: Schema.String;
1763
+ readonly source: Schema.String;
1764
+ readonly head: Schema.String;
1765
+ }>>;
1766
+ readonly pending: Schema.$Array<Schema.Struct<{
1767
+ readonly repo: Schema.String;
1768
+ readonly target: Schema.String;
1769
+ readonly source: Schema.String;
1770
+ readonly head: Schema.String;
1771
+ readonly key: Schema.String;
1772
+ }>>;
1773
+ readonly candidates: Schema.$Array<Schema.Struct<{
1774
+ readonly repo: Schema.String;
1775
+ readonly target: Schema.String;
1776
+ readonly candidate: Schema.String;
1777
+ readonly ref: Schema.String;
1778
+ readonly commit: Schema.String;
1779
+ }>>;
1780
+ readonly waitingOn: Schema.optionalKey<Schema.Struct<{
1781
+ readonly repo: Schema.String;
1782
+ readonly target: Schema.String;
1783
+ readonly topic: Schema.optionalKey<Schema.String>;
1784
+ readonly hold: Schema.optionalKey<Schema.String>;
1785
+ }>>;
1786
+ readonly failure: Schema.optionalKey<Schema.Struct<{
1787
+ readonly reason: Schema.Literals<readonly ["entry-failed", "reported", "cancelled", "refused", "host-error", "work-failed", "timeout", "report-timeout", "prepare-rejected"]>;
1788
+ readonly repo: Schema.optionalKey<Schema.String>;
1789
+ readonly entry: Schema.optionalKey<Schema.String>;
1790
+ readonly candidate: Schema.optionalKey<Schema.String>;
1791
+ readonly summary: Schema.optionalKey<Schema.String>;
1792
+ readonly url: Schema.optionalKey<Schema.String>;
1793
+ readonly error: Schema.optionalKey<Schema.String>;
1794
+ readonly hint: Schema.String;
1795
+ }>>;
1796
+ }>>>;
1797
+ readonly next: Schema.optionalKey<Schema.String>;
1798
1798
  }>>, Schema.toCodecJson<import("effect/http-api/HttpApiSchema").encodeToWithHeaders<Schema.Codec<{
1799
1799
  readonly code: "ALREADY_EXISTS";
1800
1800
  readonly message: string;
@@ -1,28 +1,41 @@
1
1
  import { GitCallerMiddleware, GitRestServices } from "./caller.mjs";
2
2
  import * as Schema from "effect/Schema";
3
3
  import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema } from "effect/http-api";
4
- declare const TreesApiGroup_base: HttpApiGroup.HttpApiGroup<"trees", HttpApiEndpoint.HttpApiEndpoint<"get", "GET", "/repos/:repo/-/trees/:oid", Schema.toCodecStringTree<Schema.Struct<{
4
+ declare const TreesApiGroup_base: HttpApiGroup.HttpApiGroup<"trees", HttpApiEndpoint.HttpApiEndpoint<"diff", "POST", "/repos/:repo/-/trees/diff", Schema.toCodecStringTree<Schema.Struct<{
5
5
  repo: Schema.String;
6
- oid: Schema.String;
7
- }>>, Schema.toCodecStringTree<Schema.Struct<{
8
- objects: Schema.optionalKey<Schema.Int>;
9
- bytes: Schema.optionalKey<Schema.Int>;
10
- entries: Schema.optionalKey<Schema.Int>;
11
- milliseconds: Schema.optionalKey<Schema.Int>;
12
- after: Schema.optionalKey<Schema.String>;
13
- limit: Schema.optionalKey<Schema.Int>;
14
- recursive: Schema.optionalKey<Schema.Boolean>;
15
- }>>, never, never, Schema.toCodecJson<Schema.Struct<{
6
+ }>>, never, Schema.toCodecJson<Schema.Struct<{
7
+ readonly base: Schema.String;
8
+ readonly head: Schema.String;
9
+ readonly renames: Schema.optionalKey<Schema.Boolean>;
10
+ readonly limits: Schema.optionalKey<Schema.Struct<{
11
+ readonly objects: Schema.optionalKey<Schema.Int>;
12
+ readonly bytes: Schema.optionalKey<Schema.Int>;
13
+ readonly entries: Schema.optionalKey<Schema.Int>;
14
+ readonly milliseconds: Schema.optionalKey<Schema.Int>;
15
+ }>>;
16
+ readonly page: Schema.optionalKey<Schema.Struct<{
17
+ readonly after: Schema.optionalKey<Schema.String>;
18
+ readonly limit: Schema.optionalKey<Schema.Int>;
19
+ }>>;
20
+ }>>, never, Schema.toCodecJson<Schema.Struct<{
16
21
  readonly items: Schema.mutable<Schema.$Array<Schema.Struct<{
17
- readonly name: Schema.String;
18
- readonly path: Schema.String;
19
- readonly mode: Schema.String;
20
- readonly type: Schema.Literals<readonly ["blob", "tree", "commit"]>;
21
- readonly oid: Schema.String;
22
- readonly size: Schema.optionalKey<Schema.Int>;
23
- readonly pathBytes: Schema.optionalKey<Schema.Uint8ArrayFromBase64>;
22
+ status: Schema.Literals<readonly ["A", "D", "M", "R", "T"]>;
23
+ path: Schema.String;
24
+ from: Schema.optionalKey<Schema.String>;
25
+ similarity: Schema.optionalKey<Schema.Number>;
26
+ old: Schema.optionalKey<Schema.Struct<{
27
+ readonly mode: Schema.String;
28
+ readonly oid: Schema.String;
29
+ }>>;
30
+ new: Schema.optionalKey<Schema.Struct<{
31
+ readonly mode: Schema.String;
32
+ readonly oid: Schema.String;
33
+ }>>;
34
+ pathBytes: Schema.optionalKey<Schema.Uint8ArrayFromBase64>;
35
+ fromPathBytes: Schema.optionalKey<Schema.Uint8ArrayFromBase64>;
24
36
  }>>>;
25
37
  readonly next: Schema.optionalKey<Schema.String>;
38
+ readonly renamesSkipped: Schema.optionalKey<Schema.Literals<readonly ["rename-limit", "memory-limit"]>>;
26
39
  }>>, Schema.toCodecJson<HttpApiSchema.encodeToWithHeaders<Schema.Codec<{
27
40
  readonly code: "ALREADY_EXISTS";
28
41
  readonly message: string;
@@ -422,22 +435,20 @@ declare const TreesApiGroup_base: HttpApiGroup.HttpApiGroup<"trees", HttpApiEndp
422
435
  }>, {
423
436
  "ref0-code": Schema.String;
424
437
  'www-authenticate': Schema.String;
425
- }>>, GitCallerMiddleware, GitRestServices> | HttpApiEndpoint.HttpApiEndpoint<"merge", "POST", "/repos/:repo/-/trees/merge", Schema.toCodecStringTree<Schema.Struct<{
438
+ }>>, GitCallerMiddleware, GitRestServices> | HttpApiEndpoint.HttpApiEndpoint<"create", "POST", "/repos/:repo/-/trees", Schema.toCodecStringTree<Schema.Struct<{
426
439
  repo: Schema.String;
427
440
  }>>, never, Schema.toCodecJson<Schema.Struct<{
428
- readonly base: Schema.optionalKey<Schema.String>;
429
- readonly ours: Schema.String;
430
- readonly theirs: Schema.String;
431
441
  readonly key: Schema.optionalKey<Schema.String>;
432
- readonly limits: Schema.optionalKey<Schema.Struct<{
433
- readonly objects: Schema.optionalKey<Schema.Int>;
434
- readonly bytes: Schema.optionalKey<Schema.Int>;
435
- readonly entries: Schema.optionalKey<Schema.Int>;
436
- readonly milliseconds: Schema.optionalKey<Schema.Int>;
442
+ readonly base: Schema.optionalKey<Schema.String>;
443
+ readonly changes: Schema.$Array<Schema.Struct<{
444
+ readonly path: Schema.String;
445
+ readonly mode: Schema.optionalKey<Schema.String>;
446
+ readonly oid: Schema.optionalKey<Schema.NullOr<Schema.String>>;
447
+ readonly content: Schema.optionalKey<Schema.String>;
448
+ readonly contentBytes: Schema.optionalKey<Schema.Uint8ArrayFromBase64>;
437
449
  }>>;
438
450
  }>>, never, Schema.toCodecJson<Schema.Struct<{
439
- readonly tree: Schema.String;
440
- readonly renamesSkipped: Schema.optionalKey<Schema.Literals<readonly ["rename-limit", "memory-limit"]>>;
451
+ readonly oid: Schema.String;
441
452
  }>>, Schema.toCodecJson<HttpApiSchema.encodeToWithHeaders<Schema.Codec<{
442
453
  readonly code: "ALREADY_EXISTS";
443
454
  readonly message: string;
@@ -837,40 +848,21 @@ declare const TreesApiGroup_base: HttpApiGroup.HttpApiGroup<"trees", HttpApiEndp
837
848
  }>, {
838
849
  "ref0-code": Schema.String;
839
850
  'www-authenticate': Schema.String;
840
- }>>, GitCallerMiddleware, GitRestServices> | HttpApiEndpoint.HttpApiEndpoint<"diff", "POST", "/repos/:repo/-/trees/diff", Schema.toCodecStringTree<Schema.Struct<{
851
+ }>>, GitCallerMiddleware, GitRestServices> | HttpApiEndpoint.HttpApiEndpoint<"merge", "POST", "/repos/:repo/-/trees/merge", Schema.toCodecStringTree<Schema.Struct<{
841
852
  repo: Schema.String;
842
853
  }>>, never, Schema.toCodecJson<Schema.Struct<{
843
- readonly base: Schema.String;
844
- readonly head: Schema.String;
845
- readonly renames: Schema.optionalKey<Schema.Boolean>;
854
+ readonly base: Schema.optionalKey<Schema.String>;
855
+ readonly ours: Schema.String;
856
+ readonly theirs: Schema.String;
857
+ readonly key: Schema.optionalKey<Schema.String>;
846
858
  readonly limits: Schema.optionalKey<Schema.Struct<{
847
859
  readonly objects: Schema.optionalKey<Schema.Int>;
848
860
  readonly bytes: Schema.optionalKey<Schema.Int>;
849
861
  readonly entries: Schema.optionalKey<Schema.Int>;
850
862
  readonly milliseconds: Schema.optionalKey<Schema.Int>;
851
863
  }>>;
852
- readonly page: Schema.optionalKey<Schema.Struct<{
853
- readonly after: Schema.optionalKey<Schema.String>;
854
- readonly limit: Schema.optionalKey<Schema.Int>;
855
- }>>;
856
864
  }>>, never, Schema.toCodecJson<Schema.Struct<{
857
- readonly items: Schema.mutable<Schema.$Array<Schema.Struct<{
858
- status: Schema.Literals<readonly ["A", "D", "M", "R", "T"]>;
859
- path: Schema.String;
860
- from: Schema.optionalKey<Schema.String>;
861
- similarity: Schema.optionalKey<Schema.Number>;
862
- old: Schema.optionalKey<Schema.Struct<{
863
- readonly mode: Schema.String;
864
- readonly oid: Schema.String;
865
- }>>;
866
- new: Schema.optionalKey<Schema.Struct<{
867
- readonly mode: Schema.String;
868
- readonly oid: Schema.String;
869
- }>>;
870
- pathBytes: Schema.optionalKey<Schema.Uint8ArrayFromBase64>;
871
- fromPathBytes: Schema.optionalKey<Schema.Uint8ArrayFromBase64>;
872
- }>>>;
873
- readonly next: Schema.optionalKey<Schema.String>;
865
+ readonly tree: Schema.String;
874
866
  readonly renamesSkipped: Schema.optionalKey<Schema.Literals<readonly ["rename-limit", "memory-limit"]>>;
875
867
  }>>, Schema.toCodecJson<HttpApiSchema.encodeToWithHeaders<Schema.Codec<{
876
868
  readonly code: "ALREADY_EXISTS";
@@ -1271,20 +1263,28 @@ declare const TreesApiGroup_base: HttpApiGroup.HttpApiGroup<"trees", HttpApiEndp
1271
1263
  }>, {
1272
1264
  "ref0-code": Schema.String;
1273
1265
  'www-authenticate': Schema.String;
1274
- }>>, GitCallerMiddleware, GitRestServices> | HttpApiEndpoint.HttpApiEndpoint<"create", "POST", "/repos/:repo/-/trees", Schema.toCodecStringTree<Schema.Struct<{
1266
+ }>>, GitCallerMiddleware, GitRestServices> | HttpApiEndpoint.HttpApiEndpoint<"get", "GET", "/repos/:repo/-/trees/:oid", Schema.toCodecStringTree<Schema.Struct<{
1275
1267
  repo: Schema.String;
1276
- }>>, never, Schema.toCodecJson<Schema.Struct<{
1277
- readonly key: Schema.optionalKey<Schema.String>;
1278
- readonly base: Schema.optionalKey<Schema.String>;
1279
- readonly changes: Schema.$Array<Schema.Struct<{
1268
+ oid: Schema.String;
1269
+ }>>, Schema.toCodecStringTree<Schema.Struct<{
1270
+ objects: Schema.optionalKey<Schema.Int>;
1271
+ bytes: Schema.optionalKey<Schema.Int>;
1272
+ entries: Schema.optionalKey<Schema.Int>;
1273
+ milliseconds: Schema.optionalKey<Schema.Int>;
1274
+ after: Schema.optionalKey<Schema.String>;
1275
+ limit: Schema.optionalKey<Schema.Int>;
1276
+ recursive: Schema.optionalKey<Schema.Boolean>;
1277
+ }>>, never, never, Schema.toCodecJson<Schema.Struct<{
1278
+ readonly items: Schema.mutable<Schema.$Array<Schema.Struct<{
1279
+ readonly name: Schema.String;
1280
1280
  readonly path: Schema.String;
1281
- readonly mode: Schema.optionalKey<Schema.String>;
1282
- readonly oid: Schema.optionalKey<Schema.NullOr<Schema.String>>;
1283
- readonly content: Schema.optionalKey<Schema.String>;
1284
- readonly contentBytes: Schema.optionalKey<Schema.Uint8ArrayFromBase64>;
1285
- }>>;
1286
- }>>, never, Schema.toCodecJson<Schema.Struct<{
1287
- readonly oid: Schema.String;
1281
+ readonly mode: Schema.String;
1282
+ readonly type: Schema.Literals<readonly ["blob", "tree", "commit"]>;
1283
+ readonly oid: Schema.String;
1284
+ readonly size: Schema.optionalKey<Schema.Int>;
1285
+ readonly pathBytes: Schema.optionalKey<Schema.Uint8ArrayFromBase64>;
1286
+ }>>>;
1287
+ readonly next: Schema.optionalKey<Schema.String>;
1288
1288
  }>>, Schema.toCodecJson<HttpApiSchema.encodeToWithHeaders<Schema.Codec<{
1289
1289
  readonly code: "ALREADY_EXISTS";
1290
1290
  readonly message: string;
@@ -395,7 +395,7 @@ export declare const RepoStreamEvent: Schema.Union<readonly [Schema.Union<readon
395
395
  }>>;
396
396
  readonly type: Schema.Literals<readonly ["token.created", "token.revoked"]>;
397
397
  readonly token: Schema.String;
398
- readonly scope: Schema.Literals<readonly ["read", "report", "write"]>;
398
+ readonly scope: Schema.Literals<readonly ["read", "report", "write", "admin"]>;
399
399
  readonly subject: Schema.Struct<{
400
400
  readonly id: Schema.String;
401
401
  }>;
package/dist/rest.d.mts CHANGED
@@ -1,8 +1,2 @@
1
- import { RestClient, RestTokenCalls, createRestClient } from "./rest/client.mjs";
2
- import { tokenScopes, tokenStates } from "./contracts/tokens.mjs";
3
- import { RepoStreamEvent } from "./rest/wire.mjs";
4
- import { ListenInput, RestEvents } from "./rest/listen.mjs";
5
1
  import { RestHandler, createRestHandler } from "./rest/handler.mjs";
6
- import { Me } from "./rest/me.mjs";
7
- import { jobStates } from "@ref0/infra";
8
- export { type ListenInput, type Me, type RepoStreamEvent, type RestClient, type RestEvents, type RestHandler, type RestTokenCalls, createRestClient, createRestHandler, jobStates, tokenScopes, tokenStates };
2
+ export { type RestHandler, createRestHandler };
package/dist/rest.mjs CHANGED
@@ -1,5 +1 @@
1
- import { createRestClient } from "./rest/client.mjs";
2
- import { tokenScopes, tokenStates } from "./contracts/tokens.mjs";
3
- import { createRestHandler } from "./rest/handler.mjs";
4
- import { jobStates } from "@ref0/infra";
5
- export { createRestClient, createRestHandler, jobStates, tokenScopes, tokenStates };
1
+ export { createRestHandler } from "./rest/handler.mjs";
@@ -21,8 +21,11 @@ import { JoinedCalls } from "./joined.mjs";
21
21
  import { UploadsBase } from "./uploads.mjs";
22
22
  import { BucketUploads } from "@ref0/infra";
23
23
  import * as Layer from "effect/Layer";
24
- /** `Git.layer`'s options: settings only (Q834, Q1006). Push uploads are `Git.layerUploads`'. */
25
- export interface GitOptions extends Pick<GitServerOptions, 'fetchLimits' | 'basePath'> {}
24
+ /**
25
+ * `Git.layer`'s options: settings only (Q834, Q1006), with a platform's `maxDuration` (Q1190). Push
26
+ * uploads are `Git.layerUploads`'.
27
+ */
28
+ export interface GitOptions extends Pick<GitServerOptions, 'fetchLimits' | 'basePath' | 'maxDuration'> {}
26
29
  /**
27
30
  * Core's services, which every feature may require and `Git.layer` provides: `Git`, the repos'
28
31
  * records, `authorize`, refs, objects, events, the calls and the bases features build on.
@@ -36,6 +39,11 @@ export type GitServices = GitNeeds | Policy | Storage;
36
39
  * Git: core's services over the host's, then `features` over them, then the seal. A feature's
37
40
  * Layer registers a name and adds its hooks as it builds; a registration after the seal is a defect, and a
38
41
  * clash fails the build. `Bucket`, `Auth` and the rest of the host's services stay optional.
42
+ *
43
+ * Git logs through the runtime's Logger, its jobs' tries too. A host function's failure is at `Error`,
44
+ * with its cause as the host's code gave it, unredacted, and the `failure` ID its caller is told; a
45
+ * refusal is at `Debug`, with its `code`. A host whose functions' errors may carry a credential or a
46
+ * private name redacts them in its own Logger, as `HostFunctionName` says.
39
47
  */
40
48
  export declare const layer: <ROut = never, E = never, RIn = never>(options?: GitOptions, features?: Layer.Layer<ROut, E, RIn>) => Layer.Layer<CoreServices | ROut, GitError | E, GitServices | Exclude<RIn, CoreServices>>;
41
49
  /**
@@ -25,18 +25,32 @@ const after = /* @__PURE__ */ new Set(["post"]);
25
25
  /** A registration's answer: a `GitError` it fails with answers as Git's protocol refuses. */
26
26
  const answered = ({ handle, request }) => Effect.map(Effect.catch(handle(request), (error) => Effect.succeed(refusal(error))), Option.some);
27
27
  /**
28
- * `use` of `request` with a signal that also aborts when its fiber is interrupted: the server
29
- * stops only by its request's signal, which an interrupt of `Effect.promise` never reaches.
28
+ * `request` again with `signal`: the request itself, whose headers a browser's `Request` copies
29
+ * whole, `Content-Length` among them. Next.js hands a route a Proxy over its request, which
30
+ * `new Request` reads as a URL and refuses before it touches the body; that one is copied from its
31
+ * fields. The body passed again, the same stream, so `request` stays readable when no one reads it.
32
+ * `duplex` is the fetch spec's, which a stream body needs and the DOM types don't name yet.
30
33
  */
31
- const bound = (request, use) => Effect.suspend(() => {
32
- const interrupted = new AbortController();
34
+ const withSignal = (request, signal) => {
33
35
  const init = {
34
- signal: AbortSignal.any([request.signal, interrupted.signal]),
36
+ signal,
35
37
  body: request.body,
36
38
  duplex: "half"
37
39
  };
38
- const signalled = new Request(request, init);
39
- return Effect.onInterrupt(use(signalled), () => Effect.sync(() => interrupted.abort()));
40
+ return Effect.try(() => new Request(request, init)).pipe(Effect.orElseSucceed(() => new Request(request.url, {
41
+ ...init,
42
+ method: request.method,
43
+ headers: request.headers
44
+ })));
45
+ };
46
+ /**
47
+ * `use` of `request` with a signal that also aborts when its fiber is interrupted: the server
48
+ * stops only by its request's signal, which an interrupt of `Effect.promise` never reaches.
49
+ */
50
+ const bound = (request, use) => Effect.suspend(() => {
51
+ const interrupted = new AbortController();
52
+ const signal = AbortSignal.any([request.signal, interrupted.signal]);
53
+ return Effect.flatMap(withSignal(request, signal), (signalled) => Effect.onInterrupt(use(signalled), () => Effect.sync(() => interrupted.abort())));
40
54
  });
41
55
  /** Core: the server over the host's services, sealing `later`, and the `Git` service over it. */
42
56
  const core = (options) => Layer.effectContext(Effect.gen(function* () {
@@ -53,9 +67,9 @@ const core = (options) => Layer.effectContext(Effect.gen(function* () {
53
67
  };
54
68
  const policy = Context.get(context, Policy);
55
69
  const auth = Option.getOrUndefined(yield* Effect.serviceOption(Auth));
56
- const deciders = (reports) => ({
57
- policy: hostPolicy(policy, reports),
58
- auth: hostAuth(auth, reports)
70
+ const deciders = () => ({
71
+ policy: hostPolicy(policy),
72
+ auth: hostAuth(auth)
59
73
  });
60
74
  const hostRules = Context.getOption(context, Rules);
61
75
  const rules = Option.match(hostRules, {
@@ -109,6 +123,11 @@ const sealing = () => Layer.effectContext(Effect.gen(function* () {
109
123
  * Git: core's services over the host's, then `features` over them, then the seal. A feature's
110
124
  * Layer registers a name and adds its hooks as it builds; a registration after the seal is a defect, and a
111
125
  * clash fails the build. `Bucket`, `Auth` and the rest of the host's services stay optional.
126
+ *
127
+ * Git logs through the runtime's Logger, its jobs' tries too. A host function's failure is at `Error`,
128
+ * with its cause as the host's code gave it, unredacted, and the `failure` ID its caller is told; a
129
+ * refusal is at `Debug`, with its `code`. A host whose functions' errors may carry a credential or a
130
+ * private name redacts them in its own Logger, as `HostFunctionName` says.
112
131
  */
113
132
  const layer = (options = {}, features) => {
114
133
  const added = features ?? Layer.empty;
@@ -28,7 +28,7 @@ export interface JoinedAdapter {
28
28
  * goes with `joinLayer` and `createGitHubHandler` in 2c-3b.
29
29
  */
30
30
  export interface Joined {
31
- /** The server itself, for what goes through its own `fetch` or `syncOn`. */
31
+ /** The server itself, for what goes through its own `fetch`. */
32
32
  readonly server: GitServer;
33
33
  readonly basePath: string;
34
34
  /** The server's one queue's `keys`, or `undefined` with no queue. */
@@ -9,7 +9,6 @@ import "../contracts/rules.mjs";
9
9
  import { GitAdapter, GitServer, ProvidedBy, ServerSetup } from "../contracts/server.mjs";
10
10
  import "../contracts/services.mjs";
11
11
  import "../auth/auth.mjs";
12
- import "../auth/host-function.mjs";
13
12
  import "../auth/identify.mjs";
14
13
  import "../auth/policy.mjs";
15
14
  import "../auth/tokens-layer.mjs";