@ref0/git 0.12.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (247) hide show
  1. package/dist/access/private-refs.mjs +3 -3
  2. package/dist/auth/auth.d.mts +2 -2
  3. package/dist/auth/auth.mjs +3 -6
  4. package/dist/auth/authorize.mjs +1 -17
  5. package/dist/auth/helpers.mjs +3 -11
  6. package/dist/auth/host-services.mjs +11 -0
  7. package/dist/auth/policy.d.mts +27 -7
  8. package/dist/auth/policy.mjs +8 -4
  9. package/dist/auth/tokens-layer.d.mts +1 -2
  10. package/dist/auth/tokens-layer.mjs +2 -3
  11. package/dist/auth/tokens-public.d.mts +3 -3
  12. package/dist/auth/tokens.d.mts +1 -8
  13. package/dist/auth/tokens.mjs +1 -8
  14. package/dist/auth.d.mts +1 -4
  15. package/dist/auth.mjs +1 -3
  16. package/dist/client/git-http.mjs +18 -4
  17. package/dist/client/push-upload.mjs +33 -7
  18. package/dist/client/remote.mjs +94 -28
  19. package/dist/client/slice-push.d.mts +1 -1
  20. package/dist/contracts/access.d.mts +8 -8
  21. package/dist/contracts/actors.d.mts +2 -34
  22. package/dist/contracts/blobs.d.mts +2 -2
  23. package/dist/contracts/client.d.mts +8 -3
  24. package/dist/contracts/commits.d.mts +10 -2
  25. package/dist/contracts/commits.mjs +9 -1
  26. package/dist/contracts/files.d.mts +2 -2
  27. package/dist/contracts/forks.d.mts +11 -1
  28. package/dist/contracts/git.d.mts +18 -7
  29. package/dist/contracts/git.mjs +3 -2
  30. package/dist/contracts/lfs.d.mts +0 -7
  31. package/dist/contracts/objects.d.mts +80 -10
  32. package/dist/contracts/operations.d.mts +3 -0
  33. package/dist/contracts/operations.mjs +12 -2
  34. package/dist/contracts/push-uploads.d.mts +44 -5
  35. package/dist/contracts/push-uploads.mjs +7 -3
  36. package/dist/contracts/refs.d.mts +28 -6
  37. package/dist/contracts/remote.mjs +1 -3
  38. package/dist/contracts/repo-records.d.mts +1 -0
  39. package/dist/contracts/repos.d.mts +90 -2
  40. package/dist/contracts/repos.mjs +29 -2
  41. package/dist/contracts/result.d.mts +23 -18
  42. package/dist/contracts/result.mjs +17 -4
  43. package/dist/contracts/rules.d.mts +22 -22
  44. package/dist/contracts/server.d.mts +28 -77
  45. package/dist/contracts/signin.d.mts +1 -1
  46. package/dist/contracts/sync.d.mts +79 -19
  47. package/dist/contracts/sync.mjs +34 -10
  48. package/dist/contracts/tokens.d.mts +1 -6
  49. package/dist/contracts/tokens.mjs +1 -2
  50. package/dist/contracts/topics.d.mts +0 -5
  51. package/dist/contracts/work.d.mts +66 -2
  52. package/dist/contracts/work.mjs +8 -1
  53. package/dist/core/access.mjs +27 -5
  54. package/dist/core/ancestry.d.mts +9 -0
  55. package/dist/core/ancestry.mjs +6 -6
  56. package/dist/core/asked.mjs +42 -4
  57. package/dist/core/call-names.mjs +1 -0
  58. package/dist/core/call-services.mjs +2 -1
  59. package/dist/core/events/deliver.mjs +10 -2
  60. package/dist/core/forks.mjs +3 -3
  61. package/dist/core/imports.mjs +147 -9
  62. package/dist/core/index-job.mjs +9 -6
  63. package/dist/core/job-view.mjs +8 -9
  64. package/dist/core/mirror-rows.mjs +19 -4
  65. package/dist/core/objects/commits.mjs +16 -6
  66. package/dist/core/parts.d.mts +6 -1
  67. package/dist/core/parts.mjs +1 -4
  68. package/dist/core/purge.mjs +76 -6
  69. package/dist/core/push-decide.mjs +1 -1
  70. package/dist/core/push-files.d.mts +12 -0
  71. package/dist/core/push-files.mjs +225 -0
  72. package/dist/core/push-repo.d.mts +8 -0
  73. package/dist/core/push-repo.mjs +56 -0
  74. package/dist/core/push.d.mts +17 -0
  75. package/dist/core/push.mjs +98 -26
  76. package/dist/core/receipts.mjs +26 -10
  77. package/dist/core/ref-view.mjs +59 -5
  78. package/dist/core/refs.mjs +13 -8
  79. package/dist/core/repack.mjs +11 -8
  80. package/dist/core/repo-info.mjs +16 -9
  81. package/dist/core/repos.mjs +30 -14
  82. package/dist/core/seam.mjs +2 -2
  83. package/dist/core/view.d.mts +6 -0
  84. package/dist/core/view.mjs +45 -12
  85. package/dist/core/work.mjs +47 -22
  86. package/dist/effect.d.mts +3 -1
  87. package/dist/effect.mjs +3 -1
  88. package/dist/engine/reads.mjs +13 -6
  89. package/dist/engine/walk.mjs +4 -4
  90. package/dist/event-streams/event-streams.d.mts +1 -1
  91. package/dist/event-streams/event-streams.mjs +1 -1
  92. package/dist/event-streams/stream.d.mts +1 -1
  93. package/dist/event-streams/stream.mjs +1 -1
  94. package/dist/extend.d.mts +3 -3
  95. package/dist/extend.mjs +2 -2
  96. package/dist/http/answers.mjs +4 -2
  97. package/dist/http/core-parts.mjs +64 -15
  98. package/dist/http/handler.mjs +2 -2
  99. package/dist/http/node.mjs +5 -4
  100. package/dist/http/parts.d.mts +1 -0
  101. package/dist/http/push-upload-job.mjs +503 -0
  102. package/dist/http/push-uploads.d.mts +1 -0
  103. package/dist/http/push-uploads.mjs +114 -56
  104. package/dist/http/upload-pack.mjs +7 -6
  105. package/dist/index.d.mts +23 -24
  106. package/dist/index.mjs +4 -7
  107. package/dist/lfs/base.d.mts +7 -3
  108. package/dist/lfs/base.mjs +2 -1
  109. package/dist/lfs/copy.d.mts +46 -0
  110. package/dist/lfs/copy.mjs +26 -0
  111. package/dist/lfs/layer.mjs +4 -2
  112. package/dist/lfs/objects.d.mts +6 -0
  113. package/dist/lfs/objects.mjs +68 -41
  114. package/dist/lfs/rows.d.mts +13 -0
  115. package/dist/lfs/service.d.mts +1 -7
  116. package/dist/lfs/service.mjs +1 -9
  117. package/dist/lfs/upload-most.mjs +5 -5
  118. package/dist/node.d.mts +2 -2
  119. package/dist/protocol/bytes/sha256-hasher.d.mts +15 -0
  120. package/dist/protocol/bytes/sha256.d.mts +32 -0
  121. package/dist/protocol/bytes/sha256.mjs +105 -49
  122. package/dist/protocol/wire/advertisement.mjs +9 -4
  123. package/dist/protocol/wire/lines.d.mts +4 -2
  124. package/dist/protocol/wire/lines.mjs +11 -5
  125. package/dist/protocol/wire/push-uploads.mjs +13 -1
  126. package/dist/protocol/wire/v2.mjs +2 -2
  127. package/dist/protocol.d.mts +3 -1
  128. package/dist/protocol.mjs +3 -1
  129. package/dist/queue/advance.mjs +1 -1
  130. package/dist/queue/host.d.mts +1 -7
  131. package/dist/queue/host.mjs +1 -7
  132. package/dist/queue/layer.mjs +1 -1
  133. package/dist/queue/trim.mjs +1 -1
  134. package/dist/rest/blobs.d.mts +31 -23
  135. package/dist/rest/blobs.mjs +1 -1
  136. package/dist/rest/caller.d.mts +49 -9
  137. package/dist/rest/caller.mjs +1 -1
  138. package/dist/rest/client.d.mts +10 -3
  139. package/dist/rest/client.mjs +4 -0
  140. package/dist/rest/commits.d.mts +273 -240
  141. package/dist/rest/errors.d.mts +24 -4
  142. package/dist/rest/events.d.mts +9 -6
  143. package/dist/rest/events.mjs +1 -2
  144. package/dist/rest/files.d.mts +127 -115
  145. package/dist/rest/forks.d.mts +121 -97
  146. package/dist/rest/handler.mjs +4 -57
  147. package/dist/rest/handlers.d.mts +1 -1
  148. package/dist/rest/handlers.mjs +18 -4
  149. package/dist/rest/layer.mjs +2 -1
  150. package/dist/rest/me.d.mts +8 -4
  151. package/dist/rest/merges.d.mts +8 -4
  152. package/dist/rest/paths.mjs +1 -0
  153. package/dist/rest/queue.d.mts +282 -226
  154. package/dist/rest/refs.d.mts +205 -176
  155. package/dist/rest/repos.d.mts +108 -80
  156. package/dist/rest/tags.d.mts +24 -12
  157. package/dist/rest/tokens.d.mts +235 -211
  158. package/dist/rest/topics.d.mts +53 -33
  159. package/dist/rest/trees.d.mts +105 -89
  160. package/dist/rest/work.d.mts +467 -20
  161. package/dist/rest/work.mjs +8 -0
  162. package/dist/server/edge-node.d.mts +9 -13
  163. package/dist/server/edge-node.mjs +9 -12
  164. package/dist/server/git-layer.d.mts +1 -6
  165. package/dist/server/git-layer.mjs +2 -2
  166. package/dist/server/git-namespace.d.mts +3 -3
  167. package/dist/server/joined.d.mts +15 -22
  168. package/dist/server/joined.mjs +5 -29
  169. package/dist/server/lifecycle.mjs +107 -23
  170. package/dist/server/registry.mjs +9 -1
  171. package/dist/server/server.mjs +133 -212
  172. package/dist/storage/budget.mjs +2 -2
  173. package/dist/storage/clean-up.mjs +13 -10
  174. package/dist/storage/fetch.mjs +13 -8
  175. package/dist/storage/file-limits.mjs +24 -0
  176. package/dist/storage/index-build.d.mts +1 -0
  177. package/dist/storage/index-build.mjs +106 -62
  178. package/dist/storage/index-fetch.mjs +16 -3
  179. package/dist/storage/index-reach.mjs +33 -5
  180. package/dist/storage/index-remap.mjs +8 -1
  181. package/dist/storage/index-shallow.mjs +5 -3
  182. package/dist/storage/largest-files.mjs +48 -0
  183. package/dist/storage/lfs-pointers.mjs +10 -1
  184. package/dist/storage/loose.mjs +3 -1
  185. package/dist/storage/memory-budget.mjs +28 -4
  186. package/dist/storage/pack-reads.mjs +8 -8
  187. package/dist/storage/pack-receive.mjs +83 -25
  188. package/dist/storage/packs.mjs +37 -21
  189. package/dist/storage/prune-keep.mjs +203 -34
  190. package/dist/storage/prune-walk.mjs +54 -16
  191. package/dist/storage/prune.mjs +629 -196
  192. package/dist/storage/push-uploads.mjs +36 -12
  193. package/dist/storage/quarantine.mjs +9 -9
  194. package/dist/storage/ready.mjs +47 -19
  195. package/dist/storage/receive-bounds.mjs +29 -8
  196. package/dist/storage/receive-state.mjs +8 -0
  197. package/dist/storage/receive-steps.mjs +71 -18
  198. package/dist/storage/repack.d.mts +1 -1
  199. package/dist/storage/repack.mjs +1 -8
  200. package/dist/storage/rows.mjs +12 -1
  201. package/dist/storage/shallow.d.mts +1 -0
  202. package/dist/storage/shallow.mjs +26 -4
  203. package/dist/storage/stream-whole.mjs +5 -2
  204. package/dist/storage/visible.mjs +29 -1
  205. package/dist/storage/walk.mjs +2 -1
  206. package/dist/store/catalogue.mjs +1 -0
  207. package/dist/store/cursor-seal-namespace.d.mts +2 -0
  208. package/dist/store/cursor-seal-public.d.mts +5 -0
  209. package/dist/store/cursor-seal-public.mjs +5 -0
  210. package/dist/store/cursor-seal.d.mts +16 -2
  211. package/dist/store/cursor-seal.mjs +26 -14
  212. package/dist/store/errors.mjs +9 -1
  213. package/dist/store/records.d.mts +2 -0
  214. package/dist/store/records.mjs +9 -6
  215. package/dist/store/repo-record.d.mts +9 -7
  216. package/dist/store/repo-record.mjs +102 -19
  217. package/dist/store/scopes.mjs +10 -2
  218. package/dist/sync/bound.d.mts +2 -0
  219. package/dist/sync/bound.mjs +11 -2
  220. package/dist/sync/github.d.mts +6 -1
  221. package/dist/sync/github.mjs +55 -43
  222. package/dist/sync/http.mjs +36 -1
  223. package/dist/sync/import.mjs +1 -0
  224. package/dist/sync/layer.mjs +6 -2
  225. package/dist/sync/lfs-batch.mjs +119 -0
  226. package/dist/sync/lfs-copy.mjs +251 -0
  227. package/dist/sync/mirror.mjs +210 -137
  228. package/dist/sync/smart-http.mjs +4 -2
  229. package/dist/sync/step.mjs +25 -5
  230. package/dist/sync/tries.mjs +45 -14
  231. package/dist/sync.d.mts +2 -2
  232. package/dist/topics/host.mjs +1 -19
  233. package/dist/topics/layer.mjs +1 -1
  234. package/package.json +3 -8
  235. package/dist/auth/bridge.mjs +0 -30
  236. package/dist/auth/helpers.d.mts +0 -17
  237. package/dist/core/purge.d.mts +0 -8
  238. package/dist/core/registered-rows.d.mts +0 -5
  239. package/dist/core/repack.d.mts +0 -11
  240. package/dist/http/handler.d.mts +0 -2
  241. package/dist/rest/handler.d.mts +0 -21
  242. package/dist/rest.d.mts +0 -2
  243. package/dist/rest.mjs +0 -1
  244. package/dist/server/registry.d.mts +0 -16
  245. package/dist/server/server.d.mts +0 -36
  246. package/dist/storage/repack-job.d.mts +0 -3
  247. package/dist/topics/host.d.mts +0 -7
@@ -1,4 +1,4 @@
1
- import { runnerIn } from "../store/crossing.mjs";
1
+ import { runnerIn, untilAborted } from "../store/crossing.mjs";
2
2
  import { gitError, gitErrorFrom, isGitError } from "../contracts/result.mjs";
3
3
  import { openRepo } from "../core/access.mjs";
4
4
  import { CoreParts } from "../core/parts.mjs";
@@ -13,10 +13,12 @@ import { collections } from "../store/scopes.mjs";
13
13
  import { ProviderRefused, saidOf } from "./said.mjs";
14
14
  import { quoted } from "../protocol/bytes/text.mjs";
15
15
  import { responseToWeb } from "./http.mjs";
16
- import { callLimitIn, spentRefusalOf, tryUnlessSpent } from "../contracts/calls-spent.mjs";
16
+ import { callLimitIn, spentAt, spentOf, spentRefusalOf } from "../contracts/calls-spent.mjs";
17
+ import { chargeCall } from "../store/call-count.mjs";
17
18
  import * as Effect from "effect/Effect";
18
19
  import * as HttpClient from "effect/http/HttpClient";
19
20
  import * as Schema from "effect/Schema";
21
+ import * as Cause from "effect/Cause";
20
22
  import * as Predicate from "effect/Predicate";
21
23
  import * as HttpClientRequest from "effect/http/HttpClientRequest";
22
24
  // src/sync/tries.ts
@@ -74,17 +76,32 @@ const unknownProvider = (name) => gitError("INVALID_ARGUMENT", `No provider name
74
76
  });
75
77
  /** `message`, then what a refusal said when its provider kept some of it, quoted. */
76
78
  const withSaid = (message, said) => said === void 0 ? message : `${message}. Its refusal said: ${quoted(said)}`;
77
- /** A provider that threw: what its own call's refusal said when it kept some, else nothing of it. */
78
- const providerFailed = (name, cause) => gitError("UNAVAILABLE", withSaid(`The '${name}' provider made no remote for this try`, cause instanceof ProviderRefused ? cause.said : void 0), { hint: "The job tries again" });
79
+ /** The refusal a provider failed with: itself when it died of one, or the cause its `GitError` holds. */
80
+ const refusalIn = (cause) => {
81
+ if (cause instanceof ProviderRefused) return cause;
82
+ return isGitError(cause) && cause.cause instanceof ProviderRefused ? cause.cause : void 0;
83
+ };
84
+ /**
85
+ * A provider that failed: what its own call's refusal said when it kept some, as a
86
+ * `ProviderRefused` it failed with or under, else nothing of it.
87
+ */
88
+ const providerFailed = (name, cause) => gitError("UNAVAILABLE", withSaid(`The '${name}' provider made no remote for this try`, refusalIn(cause)?.said), { hint: "The job tries again" });
79
89
  /**
80
- * The provider's remote for this try: a provider that has gone since fails the job for good,
81
- * naming it, and one that throws fails this try with a message that names no secret.
90
+ * The provider's remote for this try, its Effect run in the try's fiber, so the calls it makes are
91
+ * charged to the try's budget, and interrupted once `signal` aborts: a provider that has gone
92
+ * since fails the job for good, naming it, and one that fails or dies fails this try with a
93
+ * message that names no secret. A spent call bound stays the defect it is, so the try stops whole.
82
94
  */
83
95
  const remoteOf = /* @__PURE__ */ Effect.fnUntraced(function* (bound, source, signal, access = "read") {
84
96
  const { provider: name, repo } = source;
85
97
  const provider = bound.providers.get(name);
86
98
  if (provider === void 0) return yield* forGood(unknownProvider(name));
87
- return yield* tryUnlessSpent(() => provider.remote(repo, access, signal), (cause) => providerFailed(name, cause));
99
+ return yield* untilAborted(provider.remote(repo, access), signal).pipe(Effect.catchCause((cause) => {
100
+ if (Cause.hasInterruptsOnly(cause)) return Effect.interrupt;
101
+ const thrown = spentOf(cause) ?? Cause.squash(cause);
102
+ if (spentAt(thrown) !== void 0) return Effect.die(thrown);
103
+ return Effect.fail(providerFailed(name, thrown));
104
+ }));
88
105
  });
89
106
  /**
90
107
  * `send`, each refusal's body dropped once `heard` keeps what its provider's `fields` said: the
@@ -115,17 +132,31 @@ const fromRemote = (call, heard) => (error) => spentRefusalOf(error) ?? gitError
115
132
  /** The fields of a refusal's JSON body `source`'s provider marks safe to keep: none it doesn't. */
116
133
  const keptFieldsOf = (bound, source) => bound.providers.get(source.provider)?.keptFields ?? [];
117
134
  /**
118
- * The client's smart HTTP to `remote`, with its credentials and transport, and what its refusals
119
- * said in `fields`, as `bodiless` keeps it.
135
+ * Requests to `remote` as sent, no credential added: through the bound's charged client, or
136
+ * `remote.transport`, whose each call is charged one subrequest before it runs, so a host's
137
+ * sender, a service binding's say, is counted as Git's own client is. A body streams through
138
+ * either, never collected.
120
139
  */
121
- const httpOf = /* @__PURE__ */ Effect.fnUntraced(function* (remote, fields) {
140
+ const senderOf = /* @__PURE__ */ Effect.fnUntraced(function* (remote) {
122
141
  const client = yield* HttpClient.HttpClient;
123
- const context = yield* Effect.context();
142
+ const { transport } = remote;
143
+ return (request) => transport === void 0 ? client.execute(HttpClientRequest.fromWeb(request)).pipe(Effect.flatMap(responseToWeb)) : Effect.andThen(chargeCall("fetch"), transport(request));
144
+ });
145
+ /**
146
+ * The client's smart HTTP to `remote`, with its credentials, each request run in the caller's
147
+ * context: through the bound's charged client, or `remote.transport`, whose each call is charged
148
+ * one subrequest before it runs, so a host's sender, a service binding's say, is counted as Git's
149
+ * own client is. A request the transport sends again it charges itself. It answers what its
150
+ * refusals said in `fields` beside it, as `bodiless` keeps it.
151
+ */
152
+ const httpOf = /* @__PURE__ */ Effect.fnUntraced(function* (remote, fields) {
153
+ const sent = yield* senderOf(remote);
154
+ const run = runnerIn(yield* Effect.context());
124
155
  const heard = { said: void 0 };
125
- const send = (request) => runnerIn(context)(client.execute(HttpClientRequest.fromWeb(request)).pipe(Effect.flatMap(responseToWeb)), request.signal);
156
+ const send = (request) => run(sent(request), request.signal);
126
157
  const options = {
127
158
  url: remote.url,
128
- transport: bodiless(remote.transport ?? send, fields, heard)
159
+ transport: bodiless(send, fields, heard)
129
160
  };
130
161
  if (remote.credentials !== void 0) options.credentials = remote.credentials;
131
162
  return {
@@ -164,4 +195,4 @@ const openedFor = /* @__PURE__ */ Effect.fnUntraced(function* (caller, internalI
164
195
  refs
165
196
  };
166
197
  });
167
- export { ForGood, SyncTryError, forGood, fromRemote, httpOf, keptFieldsOf, openedFor, remoteOf, syncObjects, syncRetry, syncTryError, syncWhole, thrownOf, tried, unknownProvider };
198
+ export { ForGood, SyncTryError, forGood, fromRemote, httpOf, keptFieldsOf, openedFor, remoteOf, senderOf, syncObjects, syncRetry, syncTryError, syncWhole, thrownOf, tried, unknownProvider };
package/dist/sync.d.mts CHANGED
@@ -1,6 +1,6 @@
1
- import { GitHubAppCredentials, ImportJobData, ImportPhase, ImportProgress, ImportState, ImportedMove, MirrorJobData, MirrorPause, MirrorState, ReportImportProgress, Sync, SyncCancelInput, SyncGitHubOptions, SyncImportInput, SyncLayerOptions, SyncMirrorInput, SyncMirrorsInput, SyncProvider, SyncPublishInput, SyncRemote, SyncRemoveMirrorInput, SyncSource, SyncTrigger, cancelImport, importRepo, importedPullRefs, mirror, mirrors, publishImported, removeMirror } from "./contracts/sync.mjs";
1
+ import { GitHubAppCredentials, ImportJobData, ImportLfsMissed, ImportLfsReason, ImportPhase, ImportProgress, ImportState, ImportStatus, ImportedMove, MirrorJobData, MirrorPause, MirrorState, ReportImportProgress, Sync, SyncCancelInput, SyncGitHubOptions, SyncImportInput, SyncLayerOptions, SyncMirrorInput, SyncMirrorsInput, SyncProvider, SyncPublishInput, SyncRemote, SyncRemoveMirrorInput, SyncSource, SyncTransport, SyncTrigger, cancelImport, importRepo, importedPullRefs, mirror, mirrors, publishImported, removeMirror } from "./contracts/sync.mjs";
2
2
  import { github, webhookBodyBytes } from "./sync/github.mjs";
3
3
  import { partialImporter } from "./sync/import.mjs";
4
4
  import { layer } from "./sync/layer.mjs";
5
5
  import { smartHttp } from "./sync/smart-http.mjs";
6
- export { type GitHubAppCredentials, type ImportJobData, type ImportPhase, type ImportProgress, type ImportState, type ImportedMove, type MirrorJobData, type MirrorPause, type MirrorState, type ReportImportProgress, Sync, type SyncCancelInput, type SyncGitHubOptions, type SyncImportInput, type SyncLayerOptions, type SyncMirrorInput, type SyncMirrorsInput, type SyncProvider, type SyncPublishInput, type SyncRemote, type SyncRemoveMirrorInput, type SyncSource, type SyncTrigger, cancelImport, github, importRepo as import, importedPullRefs, layer, mirror, mirrors, partialImporter, publishImported, removeMirror, smartHttp, webhookBodyBytes };
6
+ export { type GitHubAppCredentials, type ImportJobData, type ImportLfsMissed, type ImportLfsReason, type ImportPhase, type ImportProgress, type ImportState, type ImportStatus, type ImportedMove, type MirrorJobData, type MirrorPause, type MirrorState, type ReportImportProgress, Sync, type SyncCancelInput, type SyncGitHubOptions, type SyncImportInput, type SyncLayerOptions, type SyncMirrorInput, type SyncMirrorsInput, type SyncProvider, type SyncPublishInput, type SyncRemote, type SyncRemoveMirrorInput, type SyncSource, type SyncTransport, type SyncTrigger, cancelImport, github, importRepo as import, importedPullRefs, layer, mirror, mirrors, partialImporter, publishImported, removeMirror, smartHttp, webhookBodyBytes };
@@ -4,14 +4,6 @@ import "../queue/schedule.mjs";
4
4
  import * as Predicate from "effect/Predicate";
5
5
  import * as Context from "effect/Context";
6
6
  // src/topics/host.ts
7
- /** What `topics()` checked, by the factory it made, so a server takes only those. */
8
- var TopicsFactoryValue = class {
9
- kind = "topics";
10
- options;
11
- constructor(options) {
12
- this.options = options;
13
- }
14
- };
15
7
  /** The topics host, private to its calls and jobs. */
16
8
  var TopicsHost = class extends (/* @__PURE__ */ Context.Service()("@ref0/git/topics/TopicsHost")) {};
17
9
  /** What a `prepare` try may run past its call, to save the answer. */
@@ -71,14 +63,4 @@ const checkTopics = (options) => {
71
63
  if (prepare !== void 0) checked.prepare = checkPrepare(prepare);
72
64
  return checked;
73
65
  };
74
- /** The temporary factory, holding the checked options until 2c removes createGitServer. */
75
- const topics = (options = {}) => {
76
- checkTopics(options);
77
- return Object.freeze(new TopicsFactoryValue(options));
78
- };
79
- /** The options held by a factory this bridge made; other values are a setup error. */
80
- const topicsOptions = (factory) => {
81
- if (!(factory instanceof TopicsFactoryValue)) throw new TypeError("options.topics must be one topics() made");
82
- return factory.options;
83
- };
84
- export { TopicsHost, checkTopics, saveMargin, topics, topicsOptions };
66
+ export { TopicsHost, checkTopics, saveMargin };
@@ -3,7 +3,7 @@ import { Events } from "../contracts/events.mjs";
3
3
  import { register } from "../contracts/git.mjs";
4
4
  import { MergeQueue } from "../contracts/queue.mjs";
5
5
  import { gitError } from "../contracts/result.mjs";
6
- import { acting } from "../core/parts.mjs";
6
+ import { acting } from "../core/access.mjs";
7
7
  import { QueueInternals } from "../queue/host.mjs";
8
8
  import { topicJobs } from "./advance.mjs";
9
9
  import { topicCalls } from "./calls.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ref0/git",
3
- "version": "0.12.0",
3
+ "version": "0.14.0",
4
4
  "private": false,
5
5
  "description": "Git hosting as a library: a server, a client and their merges",
6
6
  "license": "Apache-2.0",
@@ -50,11 +50,6 @@
50
50
  "import": "./dist/remote-helper.mjs",
51
51
  "default": "./dist/remote-helper.mjs"
52
52
  },
53
- "./rest": {
54
- "types": "./dist/rest.d.mts",
55
- "import": "./dist/rest.mjs",
56
- "default": "./dist/rest.mjs"
57
- },
58
53
  "./sync": {
59
54
  "types": "./dist/sync.d.mts",
60
55
  "import": "./dist/sync.mjs",
@@ -62,12 +57,12 @@
62
57
  }
63
58
  },
64
59
  "dependencies": {
65
- "@ref0/infra": "0.12.0",
60
+ "@ref0/infra": "0.14.0",
66
61
  "pako": "2.1.0"
67
62
  },
68
63
  "devDependencies": {
69
64
  "@effect/vitest": "4.1.7",
70
- "@ref0/xdiff-wasm": "0.12.0",
65
+ "@ref0/xdiff-wasm": "0.14.0",
71
66
  "effect": "4.1.7",
72
67
  "vite-plus": "1.8.0",
73
68
  "vitest": "5.1.1"
@@ -1,30 +0,0 @@
1
- import { aboutOf, inputOf } from "./authorize.mjs";
2
- import { runIn, uncounted } from "../store/crossing.mjs";
3
- import { hostCall } from "./host-function.mjs";
4
- import { signedIn } from "./policy.mjs";
5
- import * as Effect from "effect/Effect";
6
- import * as Option from "effect/Option";
7
- // src/auth/bridge.ts
8
- /**
9
- * The `Policy` of a server made with `authorize`, or `Policy.signedIn` with none. Each answer runs
10
- * as a host function: a throw is `UNAVAILABLE`, and the host's log names it as `'authorize'`'s.
11
- */
12
- const policyOf = (hook) => hook === void 0 ? signedIn : { authorize: (input) => hostCall("authorize", aboutOf(input.caller, input.operation), (signal) => hook({
13
- ...inputOf(input),
14
- signal
15
- })) };
16
- /** A host's own `Policy` and `Auth` make no call through Git's doors. */
17
- const hostDecider = /* @__PURE__ */ uncounted("the host's own Policy and Auth");
18
- /**
19
- * The host's `Policy` as `Git.layer` asks it: a host function, like the `authorize` option,
20
- * so a failure or a defect is `UNAVAILABLE` and reaches the host's log, never the caller as it is.
21
- */
22
- const hostPolicy = (policy) => ({ authorize: (input) => hostCall("authorize", aboutOf(input.caller, input.operation), (signal) => runIn(policy.authorize(input), hostDecider, signal)) });
23
- /** The host's `Auth` as `Git.layer` asks it, a host function like the `auth` option. */
24
- const hostAuth = (auth) => auth === void 0 ? void 0 : { identify: (input) => hostCall("auth", {}, (signal) => runIn(auth.identify(input), hostDecider, signal)) };
25
- /** The `Auth` of a server made with `auth`, which runs as a host function, as `'auth'`'s. */
26
- const authOf = (hook) => hook === void 0 ? void 0 : { identify: (input) => Effect.map(hostCall("auth", {}, (signal) => hook({
27
- ...input,
28
- signal
29
- })), Option.fromNullishOr) };
30
- export { authOf, hostAuth, hostPolicy, policyOf };
@@ -1,17 +0,0 @@
1
- import { GitAuth, NamedActor } from "../contracts/actors.mjs";
2
- export interface BearerOptions {
3
- readonly token: string;
4
- readonly actor: NamedActor;
5
- }
6
- export interface BasicOptions {
7
- readonly username: string;
8
- readonly password: string;
9
- readonly actor: NamedActor;
10
- }
11
- /**
12
- * An `auth` that knows one secret, as `actor`: sent as a Bearer token, or as Basic's password,
13
- * as Git sends one from its credential helper. The admin's secret is an ordinary actor this way.
14
- */
15
- export declare const bearer: (options: BearerOptions) => GitAuth;
16
- /** An `auth` that knows one Basic username and password, as `actor`. */
17
- export declare const basic: (options: BasicOptions) => GitAuth;
@@ -1,8 +0,0 @@
1
- import "../contracts/promises.mjs";
2
- import "../contracts/git.mjs";
3
- import "../contracts/result.mjs";
4
- import "../contracts/ids.mjs";
5
- import "../contracts/objects.mjs";
6
- import "effect/Effect";
7
- import "effect/Schema";
8
- import { JobDefinition, JobInput, Moment } from "@ref0/infra";
@@ -1,5 +0,0 @@
1
- import "../contracts/git.mjs";
2
- import "../contracts/objects.mjs";
3
- import "../contracts/promises.mjs";
4
- import "../auth/fences.mjs";
5
- import { JobInput, Moment } from "@ref0/infra";
@@ -1,11 +0,0 @@
1
- import "../contracts/events.mjs";
2
- import "../contracts/promises.mjs";
3
- import "../contracts/ids.mjs";
4
- import "../contracts/git.mjs";
5
- import "../contracts/objects.mjs";
6
- import "../contracts/result.mjs";
7
- import "../storage/repack-job.mjs";
8
- import "./events/deliver.mjs";
9
- import "./view.mjs";
10
- import "effect/Effect";
11
- import { JobDefinition, JobInput, Moment } from "@ref0/infra";
@@ -1,2 +0,0 @@
1
- import "./parts.mjs";
2
- import "effect/Effect";
@@ -1,21 +0,0 @@
1
- import "../contracts/ids.mjs";
2
- import "../contracts/result.mjs";
3
- import { GitServer } from "../contracts/server.mjs";
4
- import "../store/call-count.mjs";
5
- import "../store/promises.mjs";
6
- import "./caller.mjs";
7
- import "effect/Effect";
8
- import "effect/Context";
9
- /** A URL's answer, or `undefined` for a URL the route doesn't own. */
10
- export type RestRoute = (request: Request) => Promise<Response | undefined>;
11
- export interface RestHandler {
12
- /** REST's URLs, then Git's, then a JSON 404. */
13
- readonly fetch: (request: Request) => Promise<Response>;
14
- /** REST's URLs, then Git's; `undefined` for a URL neither owns. */
15
- readonly route: RestRoute;
16
- }
17
- /**
18
- * Git's REST API over a server `createGitServer` made: `fetch` answers REST's URLs, then Git's
19
- * `route`, then a JSON `404`; `route` answers the same and `undefined` outside them.
20
- */
21
- export declare const createRestHandler: (git: GitServer) => RestHandler;
package/dist/rest.d.mts DELETED
@@ -1,2 +0,0 @@
1
- import { RestHandler, createRestHandler } from "./rest/handler.mjs";
2
- export { type RestHandler, createRestHandler };
package/dist/rest.mjs DELETED
@@ -1 +0,0 @@
1
- export { createRestHandler } from "./rest/handler.mjs";
@@ -1,16 +0,0 @@
1
- import "../contracts/git.mjs";
2
- import "../contracts/grants.mjs";
3
- import "../contracts/ids.mjs";
4
- import "../core/registered-rows.mjs";
5
- import "../core/events/deliver.mjs";
6
- import "../core/purge.mjs";
7
- import "../core/parts.mjs";
8
- import "../contracts/result.mjs";
9
- import "../contracts/rules.mjs";
10
- import "../core/hooks/groups.mjs";
11
- import "../core/hooks/order.mjs";
12
- import "../core/repack.mjs";
13
- import "../core/rules/context.mjs";
14
- import "../protocol/wire/lines.mjs";
15
- import "effect/Effect";
16
- import { JobDefinition, Records } from "@ref0/infra";
@@ -1,36 +0,0 @@
1
- import "../core/seam.mjs";
2
- import "./git-layer.mjs";
3
- import "../contracts/actors.mjs";
4
- import "../contracts/result.mjs";
5
- import "../contracts/authorize.mjs";
6
- import "../contracts/repo-records.mjs";
7
- import "../contracts/refs.mjs";
8
- import "../contracts/rules.mjs";
9
- import { GitAdapter, GitServer, ProvidedBy, ServerSetup } from "../contracts/server.mjs";
10
- import "../contracts/services.mjs";
11
- import "../auth/auth.mjs";
12
- import "../auth/identify.mjs";
13
- import "../auth/policy.mjs";
14
- import "../auth/tokens-layer.mjs";
15
- import "../contracts/events.mjs";
16
- import "../event-streams/event-streams.mjs";
17
- import "../lfs/base.mjs";
18
- import "./uploads.mjs";
19
- import "../http/handler.mjs";
20
- import "../queue/host.mjs";
21
- import "../topics/layer.mjs";
22
- import "./joined.mjs";
23
- import "./registry.mjs";
24
- import "../core/parts.mjs";
25
- import "../core/saved-caller-views.mjs";
26
- import "../core/objects/objects.mjs";
27
- import "effect/Effect";
28
- import "effect/Context";
29
- import "effect/Layer";
30
- /**
31
- * A Git server over one adapter: its calls, `identify`, and `fetch` and `route`, Git's Smart HTTP
32
- * over its core and its sign-in, which answer `404` and `undefined` outside their URLs. Its
33
- * runtime builds the adapter's Layers and Git's wiring once the tick that made it ends, which
34
- * registers Git's jobs on the adapter's queue, and never runs them: the host starts them.
35
- */
36
- export declare const createGitServer: <const A extends GitAdapter>(options: ServerSetup<A>) => GitServer<ProvidedBy<A>>;
@@ -1,3 +0,0 @@
1
- import "../contracts/result.mjs";
2
- import "effect/Schema";
3
- import { Job, JobInput, Key, Moment } from "@ref0/infra";
@@ -1,7 +0,0 @@
1
- import "../contracts/promises.mjs";
2
- import "../contracts/git.mjs";
3
- import { TopicsFactory, TopicsLayerOptions } from "../contracts/topics.mjs";
4
- import "../queue/host.mjs";
5
- import "effect/Context";
6
- /** The temporary factory, holding the checked options until 2c removes createGitServer. */
7
- export declare const topics: (options?: TopicsLayerOptions) => TopicsFactory;