@ref0/git 0.11.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/access/private-refs.mjs +8 -7
- package/dist/auth/auth.d.mts +2 -2
- package/dist/auth/auth.mjs +3 -6
- package/dist/auth/authorize.mjs +1 -17
- package/dist/auth/helpers.mjs +3 -11
- package/dist/auth/host-services.mjs +11 -0
- package/dist/auth/policy.d.mts +27 -7
- package/dist/auth/policy.mjs +8 -4
- package/dist/auth/tokens-layer.d.mts +1 -2
- package/dist/auth/tokens-layer.mjs +2 -3
- package/dist/auth/tokens-public.d.mts +3 -3
- package/dist/auth/tokens.d.mts +1 -8
- package/dist/auth/tokens.mjs +1 -8
- package/dist/auth.d.mts +1 -4
- package/dist/auth.mjs +1 -3
- package/dist/client/git-http.mjs +18 -4
- package/dist/client/push-upload.mjs +33 -7
- package/dist/client/remote.mjs +94 -28
- package/dist/client/slice-push.d.mts +1 -1
- package/dist/contracts/access.d.mts +8 -8
- package/dist/contracts/actors.d.mts +2 -34
- package/dist/contracts/blobs.d.mts +2 -2
- package/dist/contracts/client.d.mts +8 -3
- package/dist/contracts/commits.d.mts +10 -2
- package/dist/contracts/commits.mjs +9 -1
- package/dist/contracts/files.d.mts +2 -2
- package/dist/contracts/forks.d.mts +14 -3
- package/dist/contracts/git.d.mts +41 -12
- package/dist/contracts/git.mjs +3 -2
- package/dist/contracts/lfs.d.mts +0 -7
- package/dist/contracts/objects.d.mts +80 -10
- package/dist/contracts/operations.d.mts +3 -0
- package/dist/contracts/operations.mjs +12 -2
- package/dist/contracts/push-uploads.d.mts +44 -5
- package/dist/contracts/push-uploads.mjs +7 -3
- package/dist/contracts/refs.d.mts +28 -6
- package/dist/contracts/remote.mjs +1 -3
- package/dist/contracts/repo-records.d.mts +1 -0
- package/dist/contracts/repos.d.mts +90 -2
- package/dist/contracts/repos.mjs +29 -2
- package/dist/contracts/result.d.mts +30 -23
- package/dist/contracts/result.mjs +24 -9
- package/dist/contracts/rules.d.mts +22 -22
- package/dist/contracts/server.d.mts +28 -77
- package/dist/contracts/signin.d.mts +1 -1
- package/dist/contracts/sync.d.mts +90 -19
- package/dist/contracts/sync.mjs +34 -10
- package/dist/contracts/tokens.d.mts +1 -6
- package/dist/contracts/tokens.mjs +1 -2
- package/dist/contracts/topics.d.mts +0 -5
- package/dist/contracts/work.d.mts +66 -2
- package/dist/contracts/work.mjs +8 -1
- package/dist/core/access.d.mts +1 -0
- package/dist/core/access.mjs +34 -13
- package/dist/core/ancestry.d.mts +9 -0
- package/dist/core/ancestry.mjs +6 -6
- package/dist/core/asked.mjs +68 -0
- package/dist/core/call-names.mjs +1 -0
- package/dist/core/call-services.mjs +2 -1
- package/dist/core/events/deliver.d.mts +1 -0
- package/dist/core/events/deliver.mjs +15 -3
- package/dist/core/forks.mjs +42 -16
- package/dist/core/imports.mjs +156 -13
- package/dist/core/index-job.mjs +9 -6
- package/dist/core/job-view.mjs +8 -9
- package/dist/core/mirror-rows.mjs +19 -4
- package/dist/core/objects/commits.mjs +16 -6
- package/dist/core/objects/reading.mjs +17 -9
- package/dist/core/parts.d.mts +8 -2
- package/dist/core/parts.mjs +1 -4
- package/dist/core/purge.mjs +76 -6
- package/dist/core/push-decide.mjs +1 -1
- package/dist/core/push-files.d.mts +12 -0
- package/dist/core/push-files.mjs +225 -0
- package/dist/core/push-repo.d.mts +8 -0
- package/dist/core/push-repo.mjs +56 -0
- package/dist/core/push.d.mts +17 -0
- package/dist/core/push.mjs +107 -32
- package/dist/core/receipts.mjs +26 -10
- package/dist/core/ref-view.mjs +59 -5
- package/dist/core/refs.mjs +18 -10
- package/dist/core/registered-rows.mjs +7 -5
- package/dist/core/repack.mjs +16 -11
- package/dist/core/repo-info.mjs +16 -9
- package/dist/core/repos.mjs +30 -14
- package/dist/core/saved-caller-views.d.mts +18 -0
- package/dist/core/saved-caller-views.mjs +17 -4
- package/dist/core/saved-callers-public.d.mts +3 -3
- package/dist/core/saved-callers-public.mjs +3 -2
- package/dist/core/saved-callers.d.mts +7 -0
- package/dist/core/seam.mjs +2 -2
- package/dist/core/view.d.mts +6 -0
- package/dist/core/view.mjs +45 -12
- package/dist/core/work.mjs +47 -22
- package/dist/effect.d.mts +3 -1
- package/dist/effect.mjs +3 -1
- package/dist/engine/reads.mjs +13 -6
- package/dist/engine/walk.mjs +4 -4
- package/dist/event-streams/event-streams.d.mts +1 -1
- package/dist/event-streams/event-streams.mjs +1 -1
- package/dist/event-streams/stream.d.mts +1 -1
- package/dist/event-streams/stream.mjs +1 -1
- package/dist/extend.d.mts +4 -3
- package/dist/extend.mjs +3 -2
- package/dist/http/answers.mjs +4 -2
- package/dist/http/core-parts.mjs +64 -15
- package/dist/http/handler.mjs +2 -2
- package/dist/http/node.mjs +5 -4
- package/dist/http/parts.d.mts +1 -0
- package/dist/http/push-upload-job.mjs +503 -0
- package/dist/http/push-uploads.d.mts +1 -0
- package/dist/http/push-uploads.mjs +120 -59
- package/dist/http/upload-pack.mjs +7 -6
- package/dist/index.d.mts +23 -24
- package/dist/index.mjs +4 -7
- package/dist/lfs/base.d.mts +7 -3
- package/dist/lfs/base.mjs +2 -1
- package/dist/lfs/copy.d.mts +46 -0
- package/dist/lfs/copy.mjs +26 -0
- package/dist/lfs/layer.mjs +4 -2
- package/dist/lfs/locks.mjs +14 -9
- package/dist/lfs/objects.d.mts +6 -0
- package/dist/lfs/objects.mjs +95 -61
- package/dist/lfs/rows.d.mts +13 -0
- package/dist/lfs/service.d.mts +1 -7
- package/dist/lfs/service.mjs +1 -9
- package/dist/lfs/upload-most.mjs +5 -5
- package/dist/node.d.mts +2 -2
- package/dist/protocol/bytes/sha256-hasher.d.mts +15 -0
- package/dist/protocol/bytes/sha256.d.mts +32 -0
- package/dist/protocol/bytes/sha256.mjs +105 -49
- package/dist/protocol/wire/advertisement.mjs +9 -4
- package/dist/protocol/wire/lines.d.mts +4 -2
- package/dist/protocol/wire/lines.mjs +11 -5
- package/dist/protocol/wire/push-uploads.mjs +13 -1
- package/dist/protocol/wire/v2.mjs +2 -2
- package/dist/protocol.d.mts +3 -1
- package/dist/protocol.mjs +3 -1
- package/dist/queue/advance.mjs +1 -1
- package/dist/queue/calls.mjs +21 -1
- package/dist/queue/host.d.mts +1 -7
- package/dist/queue/host.mjs +1 -7
- package/dist/queue/layer.mjs +1 -1
- package/dist/queue/trim.mjs +1 -1
- package/dist/rest/blobs.d.mts +16 -8
- package/dist/rest/blobs.mjs +1 -1
- package/dist/rest/caller.d.mts +49 -9
- package/dist/rest/caller.mjs +1 -1
- package/dist/rest/client.d.mts +10 -3
- package/dist/rest/client.mjs +4 -0
- package/dist/rest/commits.d.mts +272 -239
- package/dist/rest/errors.d.mts +24 -4
- package/dist/rest/events.d.mts +9 -6
- package/dist/rest/events.mjs +1 -2
- package/dist/rest/files.d.mts +112 -100
- package/dist/rest/forks.d.mts +146 -122
- package/dist/rest/handler.mjs +4 -57
- package/dist/rest/handlers.d.mts +1 -1
- package/dist/rest/handlers.mjs +18 -4
- package/dist/rest/layer.mjs +10 -2
- package/dist/rest/me.d.mts +8 -4
- package/dist/rest/merges.d.mts +8 -4
- package/dist/rest/paths.mjs +1 -0
- package/dist/rest/queue.d.mts +292 -236
- package/dist/rest/refs.d.mts +98 -69
- package/dist/rest/repos.d.mts +133 -105
- package/dist/rest/tags.d.mts +100 -88
- package/dist/rest/tokens.d.mts +192 -168
- package/dist/rest/topics.d.mts +154 -134
- package/dist/rest/trees.d.mts +32 -16
- package/dist/rest/work.d.mts +467 -20
- package/dist/rest/work.mjs +8 -0
- package/dist/server/edge-node.d.mts +9 -13
- package/dist/server/edge-node.mjs +9 -12
- package/dist/server/git-layer.d.mts +1 -6
- package/dist/server/git-layer.mjs +2 -2
- package/dist/server/git-namespace.d.mts +4 -4
- package/dist/server/joined.d.mts +15 -22
- package/dist/server/joined.mjs +5 -29
- package/dist/server/lifecycle.mjs +107 -23
- package/dist/server/registry.mjs +9 -1
- package/dist/server/server.mjs +139 -216
- package/dist/storage/budget.mjs +2 -2
- package/dist/storage/clean-up.mjs +13 -10
- package/dist/storage/fetch.mjs +13 -8
- package/dist/storage/file-limits.mjs +24 -0
- package/dist/storage/index-build.d.mts +1 -0
- package/dist/storage/index-build.mjs +106 -62
- package/dist/storage/index-fetch.mjs +16 -3
- package/dist/storage/index-reach.mjs +33 -5
- package/dist/storage/index-remap.mjs +8 -1
- package/dist/storage/index-shallow.mjs +5 -3
- package/dist/storage/largest-files.mjs +48 -0
- package/dist/storage/lfs-pointers.mjs +10 -1
- package/dist/storage/loose.mjs +3 -1
- package/dist/storage/memory-budget.mjs +154 -8
- package/dist/storage/merge-cut.mjs +5 -4
- package/dist/storage/pack-reads.mjs +246 -34
- package/dist/storage/pack-receive.mjs +83 -25
- package/dist/storage/packs.mjs +37 -21
- package/dist/storage/prune-keep.mjs +203 -34
- package/dist/storage/prune-seen.mjs +11 -6
- package/dist/storage/prune-walk.mjs +219 -81
- package/dist/storage/prune.mjs +629 -196
- package/dist/storage/push-uploads.mjs +36 -12
- package/dist/storage/quarantine.mjs +9 -7
- package/dist/storage/ready.mjs +47 -19
- package/dist/storage/receive-bounds.mjs +29 -8
- package/dist/storage/receive-state.mjs +8 -0
- package/dist/storage/receive-steps.mjs +71 -18
- package/dist/storage/repack.d.mts +1 -1
- package/dist/storage/repack.mjs +1 -8
- package/dist/storage/rows.mjs +12 -1
- package/dist/storage/shallow.d.mts +1 -0
- package/dist/storage/shallow.mjs +26 -4
- package/dist/storage/stream-whole.mjs +5 -2
- package/dist/storage/visible.mjs +29 -1
- package/dist/storage/walk.mjs +2 -1
- package/dist/store/catalogue.mjs +1 -0
- package/dist/store/cursor-seal-namespace.d.mts +2 -0
- package/dist/store/cursor-seal-public.d.mts +5 -0
- package/dist/store/cursor-seal-public.mjs +5 -0
- package/dist/store/cursor-seal.d.mts +16 -2
- package/dist/store/cursor-seal.mjs +26 -14
- package/dist/store/errors.mjs +9 -1
- package/dist/store/records.d.mts +2 -0
- package/dist/store/records.mjs +9 -6
- package/dist/store/repo-record.d.mts +27 -0
- package/dist/store/repo-record.mjs +141 -4
- package/dist/store/scopes.mjs +10 -2
- package/dist/sync/bound.d.mts +2 -0
- package/dist/sync/bound.mjs +11 -2
- package/dist/sync/github.d.mts +6 -1
- package/dist/sync/github.mjs +63 -42
- package/dist/sync/http.mjs +36 -1
- package/dist/sync/import.mjs +4 -2
- package/dist/sync/layer.mjs +6 -2
- package/dist/sync/lfs-batch.mjs +119 -0
- package/dist/sync/lfs-copy.mjs +251 -0
- package/dist/sync/mirror.mjs +227 -147
- package/dist/sync/said.mjs +204 -0
- package/dist/sync/smart-http.mjs +4 -2
- package/dist/sync/step.mjs +33 -13
- package/dist/sync/tries.mjs +71 -24
- package/dist/sync.d.mts +2 -2
- package/dist/topics/advance.mjs +10 -3
- package/dist/topics/host.mjs +1 -19
- package/dist/topics/layer.mjs +1 -1
- package/package.json +3 -8
- package/dist/auth/bridge.mjs +0 -30
- package/dist/auth/helpers.d.mts +0 -17
- package/dist/core/purge.d.mts +0 -8
- package/dist/core/registered-rows.d.mts +0 -4
- package/dist/core/repack.d.mts +0 -11
- package/dist/http/handler.d.mts +0 -2
- package/dist/rest/handler.d.mts +0 -21
- package/dist/rest.d.mts +0 -2
- package/dist/rest.mjs +0 -1
- package/dist/server/registry.d.mts +0 -16
- package/dist/server/server.d.mts +0 -36
- package/dist/storage/repack-job.d.mts +0 -3
- package/dist/topics/host.d.mts +0 -7
package/dist/core/imports.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { SyncSource } from "../contracts/sync.mjs";
|
|
1
|
+
import { ImportLfsReason, SyncSource } from "../contracts/sync.mjs";
|
|
2
|
+
import { readAsked } from "./asked.mjs";
|
|
2
3
|
import { KeptError, keptError } from "./receipts.mjs";
|
|
3
4
|
import { SavedCaller } from "./saved-callers.mjs";
|
|
4
5
|
import { hexOf } from "../protocol/bytes/hex.mjs";
|
|
@@ -33,6 +34,8 @@ import * as Base64 from "effect/encoding/Base64";
|
|
|
33
34
|
* - `receiving`: a segment staged and received in steps, as `ImportReceiving` says;
|
|
34
35
|
* - `restaged`: whether clean-up ended the stage of the segment the import fetches or receives
|
|
35
36
|
* now once already, so ending it again fails the import, until that segment lands or halves;
|
|
37
|
+
* - `lfs`: where its copy of the history's Git LFS objects stands, as `ImportLfs` says, on a
|
|
38
|
+
* server with `Lfs.layer`;
|
|
36
39
|
* - `error`: a failed import's last try's, which never carries a credential.
|
|
37
40
|
*/
|
|
38
41
|
/**
|
|
@@ -54,6 +57,32 @@ const ImportReceiving = /* @__PURE__ */ Schema.Struct({
|
|
|
54
57
|
})
|
|
55
58
|
});
|
|
56
59
|
/**
|
|
60
|
+
* An import's copy of the Git LFS objects its history points at: `pages` of pointers, which each
|
|
61
|
+
* segment's landing writes beside the record as its receive found them, as `lfsPageKey` says; the
|
|
62
|
+
* copy's cursor, entry `entry` of page `page`; and what it has done so far, `copied` objects of
|
|
63
|
+
* `bytes`, `missing`, those the source didn't give, and `named`, how many of them the record
|
|
64
|
+
* names, as `missedCounted` counts them.
|
|
65
|
+
*/
|
|
66
|
+
const ImportLfs = /* @__PURE__ */ Schema.Struct({
|
|
67
|
+
pages: Schema.Int,
|
|
68
|
+
page: Schema.Int,
|
|
69
|
+
entry: Schema.Int,
|
|
70
|
+
copied: Schema.Int,
|
|
71
|
+
bytes: Schema.Int,
|
|
72
|
+
missing: Schema.Int,
|
|
73
|
+
named: Schema.Int
|
|
74
|
+
});
|
|
75
|
+
/** An import's LFS copy before its first page. */
|
|
76
|
+
const noImportLfs = {
|
|
77
|
+
pages: 0,
|
|
78
|
+
page: 0,
|
|
79
|
+
entry: 0,
|
|
80
|
+
copied: 0,
|
|
81
|
+
bytes: 0,
|
|
82
|
+
missing: 0,
|
|
83
|
+
named: 0
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
57
86
|
* An import's record. `by`: who started it, as `SavedCaller` keeps them, asked again before each
|
|
58
87
|
* step, so the import fetches, publishes and offers the remote only what they may still see.
|
|
59
88
|
*/
|
|
@@ -76,6 +105,7 @@ const ImportRow = /* @__PURE__ */ Schema.Struct({
|
|
|
76
105
|
bytes: Schema.Int,
|
|
77
106
|
receiving: Schema.optionalKey(ImportReceiving),
|
|
78
107
|
restaged: Schema.optionalKey(Schema.Literal(true)),
|
|
108
|
+
lfs: Schema.optionalKey(ImportLfs),
|
|
79
109
|
error: Schema.optionalKey(KeptError)
|
|
80
110
|
});
|
|
81
111
|
/**
|
|
@@ -132,6 +162,84 @@ const tipPageRow = (page, tips) => ({
|
|
|
132
162
|
/** The keys of pages `from` to `to`, `to` left out. */
|
|
133
163
|
const tipPageKeys = (from, to) => Array.from({ length: Math.max(0, to - from) }, (_, at) => tipPageKey(from + at));
|
|
134
164
|
/**
|
|
165
|
+
* One page of the LFS pointers a segment's receive found, `imports/lfs/<page>` beside the record:
|
|
166
|
+
* at most `pageEntries` of them, 58,368 B as the table lays them out, kept as base64, about 78 KB.
|
|
167
|
+
* A segment's landing writes its pages in the commit that lands it, so a landed segment's
|
|
168
|
+
* pointers are never lost, and the copy deletes each page as its cursor passes it.
|
|
169
|
+
*/
|
|
170
|
+
const LfsPage = /* @__PURE__ */ Schema.Struct({ pointers: Schema.String });
|
|
171
|
+
/** LFS page `page`'s key, zero-padded so the pages list in their order. */
|
|
172
|
+
const lfsPageKey = (page) => ({
|
|
173
|
+
collection: collections.imports,
|
|
174
|
+
id: `lfs/${String(page).padStart(6, "0")}`
|
|
175
|
+
});
|
|
176
|
+
const lfsPageRow = (page, pointers) => ({
|
|
177
|
+
...lfsPageKey(page),
|
|
178
|
+
value: { pointers: Base64.encode(pointers) }
|
|
179
|
+
});
|
|
180
|
+
/**
|
|
181
|
+
* The most pages of LFS pointers an import keeps, 4,194,304 pointers: each unread one is a key
|
|
182
|
+
* the commit that ends the import deletes, beside the tips' pages, within its 10,000 writes.
|
|
183
|
+
* Pointers a segment finds past it are counted `missing`, unnamed.
|
|
184
|
+
*/
|
|
185
|
+
const importLfsPagesMost = 4096;
|
|
186
|
+
const lfsPageKeys = (from, to) => Array.from({ length: Math.max(0, to - from) }, (_, at) => lfsPageKey(from + at));
|
|
187
|
+
/**
|
|
188
|
+
* The most LFS objects an import's record names as missing, `imports/lfs-missing/<oid>`: past it
|
|
189
|
+
* they're counted, not named, so an import of a source missing many keeps a bounded record.
|
|
190
|
+
*/
|
|
191
|
+
const importLfsMissedMost = 1e3;
|
|
192
|
+
const lfsMissedPrefix = "lfs-missing/";
|
|
193
|
+
/** An LFS object the source didn't give, kept by its oid once the import ends. */
|
|
194
|
+
const LfsMissedRow = /* @__PURE__ */ Schema.Struct({
|
|
195
|
+
size: Schema.Int,
|
|
196
|
+
reason: ImportLfsReason
|
|
197
|
+
});
|
|
198
|
+
const lfsMissedKey = (oid) => ({
|
|
199
|
+
collection: collections.imports,
|
|
200
|
+
id: `${lfsMissedPrefix}${oid}`
|
|
201
|
+
});
|
|
202
|
+
const lfsMissedRow = (missed) => ({
|
|
203
|
+
...lfsMissedKey(missed.oid),
|
|
204
|
+
value: {
|
|
205
|
+
size: missed.size,
|
|
206
|
+
reason: missed.reason
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
/**
|
|
210
|
+
* What a step's `missed` adds to the record's `lfs`, `held` the oids it names already: each new
|
|
211
|
+
* one counted once and named, while the record names fewer than `importLfsMissedMost`, by its row.
|
|
212
|
+
* One the record names is counted no more, wherever its pointers are. Past the names, an object
|
|
213
|
+
* missed again on a later step counts again, since no row says it was.
|
|
214
|
+
*/
|
|
215
|
+
const missedCounted = (lfs, missed, held) => {
|
|
216
|
+
const fresh = missed.filter(({ oid }) => !held.has(oid));
|
|
217
|
+
const named = fresh.slice(0, Math.max(0, importLfsMissedMost - lfs.named));
|
|
218
|
+
return {
|
|
219
|
+
missing: lfs.missing + fresh.length,
|
|
220
|
+
named: lfs.named + named.length,
|
|
221
|
+
put: named.map(lfsMissedRow)
|
|
222
|
+
};
|
|
223
|
+
};
|
|
224
|
+
/**
|
|
225
|
+
* Of `oids`, those the import's record names as missing, as the store holds them now: the copy's
|
|
226
|
+
* commit expects the version its step read, so a record that moved since fails it.
|
|
227
|
+
*/
|
|
228
|
+
const lfsMissedHeld = /* @__PURE__ */ Effect.fnUntraced(function* (store, internalId, oids) {
|
|
229
|
+
if (oids.length === 0) return /* @__PURE__ */ new Set();
|
|
230
|
+
const snapshot = yield* storeCall(() => store.read(repoScope(internalId), oids.map(lfsMissedKey)));
|
|
231
|
+
return new Set(snapshot.results.flatMap(([row]) => row === void 0 ? [] : [row.id.slice(12)]));
|
|
232
|
+
});
|
|
233
|
+
const lfsPageGone = (page) => gitError("DATA_LOSS", `The import's page ${page} of LFS pointers is gone`, { hint: failedHint });
|
|
234
|
+
/** Page `page` of the import's LFS pointers, as the table lays them out. */
|
|
235
|
+
const readLfsPage = /* @__PURE__ */ Effect.fnUntraced(function* (store, internalId, page) {
|
|
236
|
+
const [[held] = []] = (yield* storeCall(() => store.read(repoScope(internalId), [lfsPageKey(page)]))).results;
|
|
237
|
+
if (held === void 0) return yield* Effect.fail(lfsPageGone(page));
|
|
238
|
+
const { pointers } = yield* decodeRow(LfsPage, held, `The import's LFS page ${page}`);
|
|
239
|
+
const bytes = Base64.decode(pointers);
|
|
240
|
+
return Result.isSuccess(bytes) ? bytes.success : yield* Effect.fail(lfsPageGone(page));
|
|
241
|
+
});
|
|
242
|
+
/**
|
|
135
243
|
* What every end of an import deletes in the commit that ends it, publish's, a failure's and a
|
|
136
244
|
* cancel's: each key it keeps only while it runs, its cut, the record of the segment `row` is
|
|
137
245
|
* receiving in steps, whose keys the quarantine's clean-up takes, and the pages of tips it hasn't
|
|
@@ -140,7 +248,8 @@ const tipPageKeys = (from, to) => Array.from({ length: Math.max(0, to - from) },
|
|
|
140
248
|
const importEndDeletes = (row) => [
|
|
141
249
|
{ ...cutKey },
|
|
142
250
|
...row?.receiving === void 0 ? [] : [receiveKey(row.receiving.pack)],
|
|
143
|
-
...tipPageKeys(row?.publishedPages ?? 0, row?.tipPages ?? 0)
|
|
251
|
+
...tipPageKeys(row?.publishedPages ?? 0, row?.tipPages ?? 0),
|
|
252
|
+
...lfsPageKeys(row?.lfs?.page ?? 0, row?.lfs?.pages ?? 0)
|
|
144
253
|
];
|
|
145
254
|
const pageMissing = (page) => gitError("DATA_LOSS", `The import's page ${page} of tips is gone`, { hint: failedHint });
|
|
146
255
|
/** Pages `from` to `to` of the import's tips, `to` left out, in one read. */
|
|
@@ -229,13 +338,17 @@ const failedRow = (row, error) => ({
|
|
|
229
338
|
/** What a failed import's error says to do: no try comes after the last, whatever it said. */
|
|
230
339
|
const failedHint = "Delete the repo, then import it again";
|
|
231
340
|
const stoppedTry = keptError(gitError("UNAVAILABLE", "The import's last try stopped", { hint: failedHint }));
|
|
232
|
-
/**
|
|
233
|
-
|
|
234
|
-
|
|
341
|
+
/**
|
|
342
|
+
* The repo's import row, cancel row and cut, in one read: with `asked`, its record too, held to it
|
|
343
|
+
* as `asAsked` says.
|
|
344
|
+
*/
|
|
345
|
+
const readImport = /* @__PURE__ */ Effect.fnUntraced(function* (store, internalId, asked) {
|
|
346
|
+
const reads = [
|
|
235
347
|
{ ...importKey },
|
|
236
348
|
{ ...cancelKey },
|
|
237
349
|
{ ...cutKey }
|
|
238
|
-
]
|
|
350
|
+
];
|
|
351
|
+
const snapshot = yield* readAsked(store, internalId, reads, [], asked);
|
|
239
352
|
const [[own] = [], [cancel] = [], [held] = []] = snapshot.results;
|
|
240
353
|
const row = own === void 0 ? void 0 : yield* decodeRow(ImportRow, own, "Import");
|
|
241
354
|
const cut = held === void 0 ? {} : yield* cutOf(held, row?.roots ?? []);
|
|
@@ -247,14 +360,44 @@ const readImport = /* @__PURE__ */ Effect.fnUntraced(function* (store, internalI
|
|
|
247
360
|
};
|
|
248
361
|
});
|
|
249
362
|
/**
|
|
250
|
-
* `JoinedCalls.importState`: the repo's import as its row
|
|
251
|
-
* `undefined` for a repo no import made. A running row whose job has gone
|
|
252
|
-
* read writes nothing, where `importLive` commits it `failed`.
|
|
363
|
+
* `JoinedCalls.importState`: the repo's import as its row, cancel row and missed LFS objects hold
|
|
364
|
+
* it, in one read, or `undefined` for a repo no import made. A running row whose job has gone
|
|
365
|
+
* stays `running`: this read writes nothing, where `importLive` commits it `failed`.
|
|
253
366
|
*/
|
|
254
367
|
const importStateOf = /* @__PURE__ */ Effect.fnUntraced(function* (store, internalId) {
|
|
255
|
-
const
|
|
256
|
-
|
|
257
|
-
|
|
368
|
+
const reads = [
|
|
369
|
+
{ ...importKey },
|
|
370
|
+
{ ...cancelKey },
|
|
371
|
+
{
|
|
372
|
+
collection: collections.imports,
|
|
373
|
+
prefix: lfsMissedPrefix,
|
|
374
|
+
limit: importLfsMissedMost
|
|
375
|
+
}
|
|
376
|
+
];
|
|
377
|
+
const [[own] = [], [cancel] = [], missedRows = []] = (yield* readAsked(store, internalId, reads, [])).results;
|
|
378
|
+
if (own === void 0) return void 0;
|
|
379
|
+
const row = yield* decodeRow(ImportRow, own, "Import");
|
|
380
|
+
const state = row.state === "running" && cancel !== void 0 ? "cancelled" : row.state;
|
|
381
|
+
if (row.lfs === void 0) return { state };
|
|
382
|
+
const missed = [];
|
|
383
|
+
for (const missedRow of missedRows) {
|
|
384
|
+
const { size, reason } = yield* decodeRow(LfsMissedRow, missedRow, "Missed LFS object");
|
|
385
|
+
missed.push({
|
|
386
|
+
oid: missedRow.id.slice(12),
|
|
387
|
+
size,
|
|
388
|
+
reason
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
const { copied, bytes, missing } = row.lfs;
|
|
392
|
+
return {
|
|
393
|
+
state,
|
|
394
|
+
lfs: {
|
|
395
|
+
copied,
|
|
396
|
+
bytes,
|
|
397
|
+
missing,
|
|
398
|
+
missed
|
|
399
|
+
}
|
|
400
|
+
};
|
|
258
401
|
});
|
|
259
402
|
/** Whether the repo's `sync.import` job is waiting or running: a try is due or under way. */
|
|
260
403
|
const jobLive = /* @__PURE__ */ Effect.fnUntraced(function* (store, internalId) {
|
|
@@ -293,4 +436,4 @@ const importLive = /* @__PURE__ */ Effect.fnUntraced(function* (store, internalI
|
|
|
293
436
|
}
|
|
294
437
|
return true;
|
|
295
438
|
});
|
|
296
|
-
export { ImportReceiving, ImportRow, cancelKey, cutKey, cutRow, failedHint, failedRow, importEndDeletes, importKey, importLive, importRow, importStateOf, readImport, readTipPages, stoppedTry, tipPageKey, tipPageRow, tipPagesOf, tipRowBytes };
|
|
439
|
+
export { ImportLfs, ImportReceiving, ImportRow, cancelKey, cutKey, cutRow, failedHint, failedRow, importEndDeletes, importKey, importLfsMissedMost, importLfsPagesMost, importLive, importRow, importStateOf, lfsMissedHeld, lfsPageKey, lfsPageRow, missedCounted, noImportLfs, readImport, readLfsPage, readTipPages, stoppedTry, tipPageKey, tipPageRow, tipPagesOf, tipRowBytes };
|
package/dist/core/index-job.mjs
CHANGED
|
@@ -6,10 +6,10 @@ import { resultCall, storeCall } from "../store/errors.mjs";
|
|
|
6
6
|
import { decodePacks } from "../store/git-store.mjs";
|
|
7
7
|
import { appendEvents, decodeOutbox, outboxReads, repoEnvelope } from "../store/outbox.mjs";
|
|
8
8
|
import { WholeRepo, wholeRefs } from "../store/ref-rows.mjs";
|
|
9
|
-
import { readRecord } from "../store/repo-record.mjs";
|
|
9
|
+
import { readRecord, rootsOf } from "../store/repo-record.mjs";
|
|
10
10
|
import { budgetedInput } from "../store/call-count.mjs";
|
|
11
11
|
import { gitJob } from "../store/job-try.mjs";
|
|
12
|
-
import { collections, jobRepo, newChangeId, repoScope } from "../store/scopes.mjs";
|
|
12
|
+
import { collections, jobRepo, newChangeId, repoRootsKey, repoScope } from "../store/scopes.mjs";
|
|
13
13
|
import { settleName } from "../store/settle.mjs";
|
|
14
14
|
import { SealedObjects } from "./view.mjs";
|
|
15
15
|
import { fail } from "../contracts/result.mjs";
|
|
@@ -55,7 +55,8 @@ const indexWhole = /* @__PURE__ */ WholeRepo.mint();
|
|
|
55
55
|
const tryReads = [
|
|
56
56
|
{ collection: collections.refs },
|
|
57
57
|
{ collection: collections.packs },
|
|
58
|
-
indexRowKey
|
|
58
|
+
indexRowKey,
|
|
59
|
+
repoRootsKey
|
|
59
60
|
];
|
|
60
61
|
/** A try's reads with `events`: the outbox a refusal's event goes to, too. */
|
|
61
62
|
const eventReads = [...tryReads, ...outboxReads];
|
|
@@ -201,16 +202,17 @@ const refusedEvent = (repo, refusal) => ({
|
|
|
201
202
|
error: refusalError(refusal)
|
|
202
203
|
});
|
|
203
204
|
/**
|
|
204
|
-
* A try's read: the repo's record, refs, packs
|
|
205
|
-
* one version, and the step's input over them. `undefined` for a repo with no record.
|
|
205
|
+
* A try's read: the repo's record, refs, packs, `index` row and roots, and with `events` the
|
|
206
|
+
* outbox, at one version, and the step's input over them. `undefined` for a repo with no record.
|
|
206
207
|
*/
|
|
207
208
|
const readTry = /* @__PURE__ */ Effect.fnUntraced(function* (parts, store, internalId, of) {
|
|
208
209
|
const reads = keepsEvents(parts.events) ? eventReads : tryReads;
|
|
209
210
|
const { record, snapshot } = yield* readRecord(store, internalId, reads);
|
|
210
211
|
if (record === void 0) return void 0;
|
|
211
|
-
const [, refRows = [], packRows = [], indexRows = [], headRows = [], cursorRows = []] = snapshot.results;
|
|
212
|
+
const [, refRows = [], packRows = [], indexRows = [], rootRows, headRows = [], cursorRows = []] = snapshot.results;
|
|
212
213
|
const refs = yield* wholeRefs(indexWhole, refRows);
|
|
213
214
|
const packs = yield* decodePacks(packRows);
|
|
215
|
+
const roots = yield* rootsOf(rootRows);
|
|
214
216
|
const listed = {
|
|
215
217
|
repo: internalId,
|
|
216
218
|
version: snapshot.version,
|
|
@@ -227,6 +229,7 @@ const readTry = /* @__PURE__ */ Effect.fnUntraced(function* (parts, store, inter
|
|
|
227
229
|
if (of.failed !== void 0 && record.deleted !== true) input.failed = of.failed;
|
|
228
230
|
const [row] = indexRows;
|
|
229
231
|
if (row !== void 0) input.row = row.value;
|
|
232
|
+
if (roots.size > 0) input.roots = [...roots];
|
|
230
233
|
if (of.lastCheck === true) input.lastCheck = true;
|
|
231
234
|
return {
|
|
232
235
|
record,
|
package/dist/core/job-view.mjs
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { advanceName } from "../store/queue-jobs.mjs";
|
|
2
|
-
import { mirrorJobName } from "../store/records.mjs";
|
|
3
2
|
// src/core/job-view.ts
|
|
4
3
|
/**
|
|
5
4
|
* The job kinds in a repo's scope that a caller who doesn't see every ref may see, each keyed by
|
|
6
|
-
* the ref it's of:
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* whole repo, its upkeep's, its index builds', its
|
|
11
|
-
* failure or progress how big the repo is, which a
|
|
12
|
-
* `git.deliver.<name>`, a hidden push alone saves.
|
|
5
|
+
* the ref it's of: an advance's target. Such a caller sees one only when it sees the ref. Deny by
|
|
6
|
+
* default: every other kind, and any kind added later that isn't here, is seen only by a caller
|
|
7
|
+
* who sees every ref (#2195). A candidate's build and timeout name its ref under `refs/queue/`
|
|
8
|
+
* (Q749), a trim its target or the ID it trimmed up to, a mirror's job pushes each ref its
|
|
9
|
+
* destination's mirrors name, and a job over the whole repo, its upkeep's, its index builds', its
|
|
10
|
+
* listing's or its import's, may say in its failure or progress how big the repo is, which a
|
|
11
|
+
* hidden push moves. A delivery's job, `git.deliver.<name>`, a hidden push alone saves.
|
|
13
12
|
*/
|
|
14
|
-
const refKeyed = /* @__PURE__ */ new Set([
|
|
13
|
+
const refKeyed = /* @__PURE__ */ new Set([advanceName]);
|
|
15
14
|
/**
|
|
16
15
|
* Whether a caller with `refView` sees `job`: `list`, `retry` and `discard` answer one it doesn't
|
|
17
16
|
* as a missing one, and the event stream leaves out its `repo.work.failed`.
|
|
@@ -1,18 +1,33 @@
|
|
|
1
1
|
import { MirrorPause, MirrorPush, SyncSource } from "../contracts/sync.mjs";
|
|
2
|
+
import { Sha256 } from "../protocol/bytes/sha256.mjs";
|
|
3
|
+
import { utf8 } from "../protocol/bytes/text.mjs";
|
|
2
4
|
import { SavedCaller } from "./saved-callers.mjs";
|
|
3
5
|
import * as Schema from "effect/Schema";
|
|
4
6
|
// src/core/mirror-rows.ts
|
|
5
7
|
/**
|
|
6
8
|
* A mirror's row in `mirrors`, by its ref's full name: where it pushes, by provider name, whether
|
|
7
|
-
* it's paused and why, `
|
|
8
|
-
*
|
|
9
|
-
* job while it's
|
|
9
|
+
* it's paused and why, `deletes` when the upstream's ref goes once the ref here does, `lastPushed`,
|
|
10
|
+
* the last push the destination took, and `by`, who saved it, whom each try asks again before it
|
|
11
|
+
* reads the ref. A push that moves the ref, or deletes it, saves its destination's job while it's
|
|
12
|
+
* `active`.
|
|
10
13
|
*/
|
|
11
14
|
const MirrorRow = /* @__PURE__ */ Schema.Struct({
|
|
12
15
|
destination: SyncSource,
|
|
13
16
|
state: Schema.Literals(["active", "paused"]),
|
|
14
17
|
paused: Schema.optionalKey(MirrorPause),
|
|
18
|
+
deletes: Schema.optionalKey(Schema.Literal(true)),
|
|
15
19
|
lastPushed: Schema.optionalKey(MirrorPush),
|
|
16
20
|
by: SavedCaller
|
|
17
21
|
});
|
|
18
|
-
|
|
22
|
+
/** `destination` as one text, its provider's length first, so no two destinations share one. */
|
|
23
|
+
const destinationText = ({ provider, repo }) => `${provider.length}:${provider}${repo}`;
|
|
24
|
+
/**
|
|
25
|
+
* `sync.mirror`'s key for `destination`: its digest, 64 hex digits however long its `repo`, so one
|
|
26
|
+
* job a destination pushes each of its refs, and a key stays within a job key's bytes.
|
|
27
|
+
*/
|
|
28
|
+
const mirrorJobKey = (destination) => {
|
|
29
|
+
const digest = new Sha256();
|
|
30
|
+
digest.update(utf8(destinationText(destination)));
|
|
31
|
+
return digest.hex();
|
|
32
|
+
};
|
|
33
|
+
export { MirrorRow, destinationText, mirrorJobKey };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { fail } from "../../contracts/result.mjs";
|
|
1
2
|
import { namedCommit } from "../../engine/commits.mjs";
|
|
2
3
|
import { diffTrees } from "../../engine/diff.mjs";
|
|
3
4
|
import { fromDiff } from "../../engine/failures.mjs";
|
|
4
5
|
import { mergeBases } from "../../engine/merge-bases.mjs";
|
|
5
|
-
import { badCursor, deadlineOf, limitsOf, timed } from "../../engine/reads.mjs";
|
|
6
|
+
import { badCursor, deadlineOf, limitsOf, logLimitMost, timed } from "../../engine/reads.mjs";
|
|
6
7
|
import { countHistory, walkHistory, walkPath } from "../../engine/walk.mjs";
|
|
7
8
|
import { isOid } from "../../protocol/bytes/text.mjs";
|
|
8
9
|
import { ReadTally } from "../../protocol/diff/read.mjs";
|
|
@@ -13,6 +14,8 @@ import { linesOf } from "./lines.mjs";
|
|
|
13
14
|
import { notAnOid, treeish } from "./trees.mjs";
|
|
14
15
|
import * as Effect from "effect/Effect";
|
|
15
16
|
// src/core/objects/commits.ts
|
|
17
|
+
/** A log that names both `exclude` and `path`, which no walk here lists together. */
|
|
18
|
+
const excludeWithPath = () => fail("INVALID_ARGUMENT", "A log takes `exclude` or `path`, not both", { hint: "List the range without `path`, or the path without `exclude`" });
|
|
16
19
|
/**
|
|
17
20
|
* `commits.*`: a commit, a history, merge bases, a diff and a comparison, each over the commits
|
|
18
21
|
* its revisions named when its first page opened. A later page's cursor holds those commits, so
|
|
@@ -31,18 +34,25 @@ const commitCalls = (bound) => {
|
|
|
31
34
|
return yield* timed(commit, deadline);
|
|
32
35
|
}, Effect.scoped),
|
|
33
36
|
list: Effect.fnUntraced(function* (repo, input) {
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
const
|
|
37
|
+
const exclude = input.exclude ?? [];
|
|
38
|
+
if (exclude.length > 0 && input.path !== void 0) return yield* excludeWithPath();
|
|
39
|
+
const digest = yield* heldDigest("commits.list", [
|
|
40
|
+
input.ref,
|
|
41
|
+
input.path ?? "",
|
|
42
|
+
...exclude.map((revision) => `^${revision}`)
|
|
43
|
+
]);
|
|
44
|
+
const held = yield* heldOf(input.page?.after, digest, 1 + exclude.length);
|
|
45
|
+
const opened = yield* openRead(callerOf(input), repo, held?.oids ?? [input.ref, ...exclude], input.internalId);
|
|
37
46
|
const tips = opened.oids;
|
|
38
|
-
const [tip = ""] = tips;
|
|
47
|
+
const [tip = "", ...haves] = tips;
|
|
39
48
|
const page = innerPage(input.page, held);
|
|
40
49
|
const { read, roots } = opened;
|
|
41
50
|
const listing = input.path === void 0 ? yield* walkHistory(read, {
|
|
42
51
|
...input,
|
|
43
52
|
wants: [tip],
|
|
53
|
+
haves,
|
|
44
54
|
page
|
|
45
|
-
}, void 0, roots) : yield* walkPath(read, {
|
|
55
|
+
}, void 0, roots, logLimitMost) : yield* walkPath(read, {
|
|
46
56
|
...input,
|
|
47
57
|
want: tip,
|
|
48
58
|
path: input.path,
|
|
@@ -13,7 +13,8 @@ import { objectsFace, objectsOnce, readOnce, scopedReader, startingOnce } from "
|
|
|
13
13
|
import { callScope } from "../../store/call-count.mjs";
|
|
14
14
|
import { resultIn } from "../../store/crossing.mjs";
|
|
15
15
|
import { allotmentWithin } from "../../contracts/object-values.mjs";
|
|
16
|
-
import { openKeyed, openRepo } from "../access.mjs";
|
|
16
|
+
import { confirmed, openKeyed, openRepo } from "../access.mjs";
|
|
17
|
+
import { asAsked } from "../asked.mjs";
|
|
17
18
|
import { isRefName } from "../names.mjs";
|
|
18
19
|
import { SealedObjects, viewOf } from "../view.mjs";
|
|
19
20
|
import { answerFailed } from "../../contracts/calls-spent.mjs";
|
|
@@ -60,18 +61,19 @@ const openReads = [packsRead, repoRootsKey];
|
|
|
60
61
|
* The repo `repo` names, opened for `caller` to read, with `revisions` resolved: each a full ID as
|
|
61
62
|
* it is, `HEAD` the default branch's tip, and a ref name the first of its refs held. A revision
|
|
62
63
|
* no ref answers is `NOT_FOUND`. `HEAD` reads the repo again, its default branch with it, so its
|
|
63
|
-
* packs and refs are read at that later version.
|
|
64
|
+
* packs and refs are read at that later version. The open confirms on that read, as `readOpened`
|
|
65
|
+
* says.
|
|
64
66
|
*/
|
|
65
67
|
const openRead = /* @__PURE__ */ Effect.fnUntraced(function* (caller, repo, revisions = [], internalId) {
|
|
66
68
|
const { asked, reads } = yield* readsOf(revisions);
|
|
67
69
|
const opened = yield* openRepo(caller, {
|
|
68
70
|
kind: "read",
|
|
69
71
|
repo
|
|
70
|
-
}, reads, internalId);
|
|
72
|
+
}, reads, internalId, "first-read");
|
|
71
73
|
return yield* readOpened(caller, repo, revisions, {
|
|
72
74
|
asked,
|
|
73
75
|
reads
|
|
74
|
-
}, opened);
|
|
76
|
+
}, opened, "first-read");
|
|
75
77
|
});
|
|
76
78
|
/**
|
|
77
79
|
* `openRead` for a write `keyed` by a key: `undefined`, with nothing asked of `authorize`, once
|
|
@@ -88,7 +90,7 @@ const openKeyedRead = /* @__PURE__ */ Effect.fnUntraced(function* (caller, repo,
|
|
|
88
90
|
return yield* readOpened(caller, repo, revisions, {
|
|
89
91
|
asked,
|
|
90
92
|
reads
|
|
91
|
-
}, opened);
|
|
93
|
+
}, opened, "skip");
|
|
92
94
|
});
|
|
93
95
|
/** The refs each revision may name, and the reads of them, the packs and roots a repo opens with. */
|
|
94
96
|
const readsOf = (revisions) => Effect.map(askedOf(revisions), (asked) => ({
|
|
@@ -105,15 +107,20 @@ const oneShotRead = (seen, listed, scope) => {
|
|
|
105
107
|
const objects = objectsFace(seen);
|
|
106
108
|
return (input) => resultIn(readOnce(objects, listed, input), scope, input.signal);
|
|
107
109
|
};
|
|
108
|
-
/**
|
|
109
|
-
|
|
110
|
+
/**
|
|
111
|
+
* A repo resolved with `reads`, its revisions resolved too, as `openRead` says. With `first-read`,
|
|
112
|
+
* the open read nothing after `authorize` answered: the read again for `HEAD` or a narrowed view
|
|
113
|
+
* holds the repo to what was asked, as `asAsked` says, and a read that needs neither confirms in a
|
|
114
|
+
* call of its own, before anything is read from the open's record.
|
|
115
|
+
*/
|
|
116
|
+
const readOpened = /* @__PURE__ */ Effect.fnUntraced(function* (caller, repo, revisions, { asked, reads }, opened, confirm) {
|
|
110
117
|
const core = yield* CoreParts;
|
|
111
118
|
let { record } = opened;
|
|
112
119
|
let results = opened.snapshot.results.slice(1);
|
|
113
120
|
let version = opened.snapshot.version;
|
|
114
121
|
let index;
|
|
115
122
|
const view = yield* viewOf(caller, opened);
|
|
116
|
-
const every = yield* view.narrowed;
|
|
123
|
+
const every = yield* view.narrowed.pipe(Effect.catch((error) => confirm === "first-read" ? Effect.andThen(confirmed(opened), Effect.fail(error)) : Effect.fail(error)));
|
|
117
124
|
const roots = yield* rootsOf(results[1]);
|
|
118
125
|
let refsAt = openReads.length;
|
|
119
126
|
if (revisions.includes("HEAD") || every) {
|
|
@@ -126,6 +133,7 @@ const readOpened = /* @__PURE__ */ Effect.fnUntraced(function* (caller, repo, re
|
|
|
126
133
|
...reads.slice(openReads.length),
|
|
127
134
|
...refReads([record.defaultBranch])
|
|
128
135
|
]);
|
|
136
|
+
if (confirm === "first-read") yield* asAsked(opened, again.record);
|
|
129
137
|
if (again.record === void 0 || again.record.deleted === true) return yield* fail("NOT_FOUND", `No repo '${repo}'`);
|
|
130
138
|
record = again.record;
|
|
131
139
|
results = again.snapshot.results.slice(1);
|
|
@@ -135,7 +143,7 @@ const readOpened = /* @__PURE__ */ Effect.fnUntraced(function* (caller, repo, re
|
|
|
135
143
|
index = results[2]?.[0]?.value;
|
|
136
144
|
results = results.slice(0, 2);
|
|
137
145
|
}
|
|
138
|
-
}
|
|
146
|
+
} else if (confirm === "first-read") yield* confirmed(opened);
|
|
139
147
|
const packs = yield* decodePacks(results[0] ?? []);
|
|
140
148
|
const held = yield* view.refs(results.slice(refsAt).flat());
|
|
141
149
|
const listed = {
|
package/dist/core/parts.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Authorize } from "../contracts/authorize.mjs";
|
|
2
|
-
import "../contracts/actors.mjs";
|
|
3
2
|
import { AccessOption } from "../contracts/access.mjs";
|
|
4
3
|
import { EffectiveLimits } from "../contracts/objects.mjs";
|
|
5
4
|
import { JobQueue as JobQueue$1, RecordStore } from "../contracts/promises.mjs";
|
|
@@ -10,6 +9,8 @@ import { EventLog } from "../contracts/events.mjs";
|
|
|
10
9
|
import { HiddenRefs } from "../protocol/wire/lines.mjs";
|
|
11
10
|
import { IndexLost } from "./index-lost.mjs";
|
|
12
11
|
import { PushChecks } from "./access.mjs";
|
|
12
|
+
import { PushFiles } from "./push-files.mjs";
|
|
13
|
+
import { PushRepo } from "./push-repo.mjs";
|
|
13
14
|
import { RefIndex } from "./ref-index.mjs";
|
|
14
15
|
import { SealedObjects } from "./view.mjs";
|
|
15
16
|
import { Changes } from "./changes.mjs";
|
|
@@ -19,7 +20,8 @@ import { JobDefinition, JobInput, Moment } from "@ref0/infra";
|
|
|
19
20
|
import * as Context from "effect/Context";
|
|
20
21
|
/**
|
|
21
22
|
* A prefix a registration publishes, `RegisterInput.publishes`: refs `Git.host` writes under it on
|
|
22
|
-
* someone's behalf, `refs.update`'s `onBehalfOf`, which every reader of the repo sees.
|
|
23
|
+
* someone's behalf, `refs.update`'s `onBehalfOf`, which every reader of the repo sees. A new fork
|
|
24
|
+
* copies none of them: the host writes them from rows of the source's, which the fork doesn't copy.
|
|
23
25
|
*/
|
|
24
26
|
export interface PublishedRefs {
|
|
25
27
|
readonly prefix: `refs/${string}/`;
|
|
@@ -127,6 +129,10 @@ export interface ObjectsFields {
|
|
|
127
129
|
* fetch by them. Upkeep's `RepackParts` carry them too, for a deleted repo's `leaving` rows.
|
|
128
130
|
*/
|
|
129
131
|
readonly fetchLimits: EffectiveLimits;
|
|
132
|
+
/** The server's `pushes.files`, resolved: GitHub's sizes, `defaultPushFiles`, when left out. */
|
|
133
|
+
readonly files?: PushFiles;
|
|
134
|
+
/** The server's `pushes.repo`, resolved: GitHub's, `defaultPushRepo`, when left out. */
|
|
135
|
+
readonly repo?: PushRepo;
|
|
130
136
|
}
|
|
131
137
|
declare const ObjectsParts_base: Context.ServiceClass<ObjectsParts, "@ref0/git/core/ObjectsParts", ObjectsFields>;
|
|
132
138
|
/** The server's sealed objects, which each boundary provides beside `CoreParts`. */
|
package/dist/core/parts.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Authorize } from "../contracts/authorize.mjs";
|
|
2
2
|
import { hostAuthorize } from "../auth/authorize.mjs";
|
|
3
|
-
import { isHost } from "../contracts/git.mjs";
|
|
4
3
|
import { Changes } from "./changes.mjs";
|
|
5
4
|
import { Objects } from "./objects/objects.mjs";
|
|
6
5
|
import { Rules } from "../contracts/rules.mjs";
|
|
@@ -54,8 +53,6 @@ const asHost = (effect) => effect.pipe(decidingWith(hostAuthorize), Effect.updat
|
|
|
54
53
|
...Struct.omit(parts, ["access"]),
|
|
55
54
|
host: true
|
|
56
55
|
})));
|
|
57
|
-
/** `effect` as `by` makes it: host code's, as `asHost` says, when `by` is `Git.host`. */
|
|
58
|
-
const acting = (by, effect) => isHost(by) ? asHost(effect) : effect;
|
|
59
56
|
/** Core's binding and one push's ref bound, given to Sync.layer as it builds. */
|
|
60
57
|
var SyncBase = class extends (/* @__PURE__ */ Context.Service()("@ref0/git/SyncBase")) {};
|
|
61
|
-
export { CoreParts, ObjectsParts, QueueParts, SyncBase,
|
|
58
|
+
export { CoreParts, ObjectsParts, QueueParts, SyncBase, asHost, coreContext, decidingWith, overStore };
|