@ref0/git 0.7.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/access/private-refs.mjs +0 -2
- package/dist/auth/authorize.mjs +31 -24
- package/dist/auth/bridge.mjs +8 -8
- package/dist/auth/fences.d.mts +0 -1
- package/dist/auth/fences.mjs +1 -1
- package/dist/auth/grants.d.mts +0 -1
- package/dist/auth/grants.mjs +2 -2
- package/dist/auth/host-function.d.mts +1 -7
- package/dist/auth/host-function.mjs +38 -38
- package/dist/auth/identify.d.mts +0 -1
- package/dist/auth/identify.mjs +1 -1
- package/dist/auth/policy.d.mts +7 -4
- package/dist/auth/policy.mjs +13 -10
- package/dist/auth/token-rows.mjs +2 -5
- package/dist/auth/tokens-layer.d.mts +0 -2
- package/dist/auth/tokens-public.d.mts +3 -3
- package/dist/auth/tokens-public.mjs +4 -2
- package/dist/auth/tokens.d.mts +6 -1
- package/dist/auth/tokens.mjs +7 -1
- package/dist/client/client.d.mts +22 -15
- package/dist/client/client.mjs +31 -27
- package/dist/client/git-http.mjs +22 -5
- package/dist/client/local.mjs +1 -1
- package/dist/client/namespace.d.mts +2 -0
- package/dist/client/push-upload.d.mts +1 -0
- package/dist/client/push-upload.mjs +169 -2
- package/dist/client/remote-helper.mjs +2 -4
- package/dist/client/remote.mjs +37 -15
- package/dist/client/run-remote-helper.mjs +4 -4
- package/dist/client/transport.mjs +26 -19
- package/dist/contracts/actors.d.mts +57 -28
- package/dist/contracts/actors.mjs +38 -2
- package/dist/contracts/authorize.d.mts +21 -15
- package/dist/contracts/callers.mjs +40 -0
- package/dist/contracts/calls-spent.d.mts +2 -12
- package/dist/contracts/calls-spent.mjs +4 -5
- package/dist/contracts/client.d.mts +16 -9
- package/dist/contracts/events.d.mts +82 -14
- package/dist/contracts/events.mjs +35 -9
- package/dist/contracts/files.d.mts +42 -42
- package/dist/contracts/forks.d.mts +0 -24
- package/dist/contracts/git-hooks.d.mts +217 -0
- package/dist/contracts/git-hooks.mjs +3 -1
- package/dist/contracts/git.d.mts +13 -3
- package/dist/contracts/grants.d.mts +46 -27
- package/dist/contracts/lfs.d.mts +17 -4
- package/dist/contracts/merges.d.mts +7 -7
- package/dist/contracts/objects.d.mts +38 -4
- package/dist/contracts/opaque.mjs +19 -1
- package/dist/contracts/operations.d.mts +8 -1
- package/dist/contracts/operations.mjs +209 -0
- package/dist/contracts/queue.d.mts +6 -5
- package/dist/contracts/queue.mjs +9 -20
- package/dist/contracts/remote.d.mts +13 -4
- package/dist/contracts/remote.mjs +3 -3
- package/dist/contracts/repos.d.mts +11 -40
- package/dist/contracts/repos.mjs +11 -10
- package/dist/contracts/result.d.mts +28 -11
- package/dist/contracts/result.mjs +32 -2
- package/dist/contracts/rules.d.mts +706 -46
- package/dist/contracts/rules.mjs +81 -2
- package/dist/contracts/server.d.mts +5 -275
- package/dist/contracts/services.d.mts +0 -3
- package/dist/contracts/services.mjs +1 -3
- package/dist/contracts/signin.d.mts +2 -2
- package/dist/contracts/signin.mjs +4 -5
- package/dist/contracts/sync.d.mts +1 -4
- package/dist/contracts/tokens.d.mts +29 -17
- package/dist/contracts/tokens.mjs +14 -3
- package/dist/contracts/topics.d.mts +38 -11
- package/dist/contracts/topics.mjs +8 -2
- package/dist/core/access.d.mts +0 -2
- package/dist/core/access.mjs +15 -4
- package/dist/core/ancestry.mjs +5 -4
- package/dist/core/events/deliver.mjs +19 -1
- package/dist/core/forks.mjs +30 -11
- package/dist/core/hooks/groups.d.mts +0 -1
- package/dist/core/hooks/groups.mjs +8 -9
- package/dist/core/index-job.mjs +23 -1
- package/dist/core/index-lost.d.mts +11 -0
- package/dist/core/index-lost.mjs +55 -0
- package/dist/core/loose-tally.mjs +46 -0
- package/dist/core/objects/commit-writes.mjs +1 -1
- package/dist/core/objects/commits.mjs +10 -9
- package/dist/core/objects/merges.mjs +1 -1
- package/dist/core/objects/reading.mjs +28 -13
- package/dist/core/objects/trees.mjs +1 -1
- package/dist/core/objects/writing.mjs +1 -0
- package/dist/core/parts.d.mts +7 -0
- package/dist/core/promise.mjs +1 -15
- package/dist/core/publish.mjs +9 -5
- package/dist/core/purge.mjs +30 -12
- package/dist/core/push.mjs +39 -16
- package/dist/core/ref-view.mjs +14 -6
- package/dist/core/repack.mjs +54 -27
- package/dist/core/repo-info.mjs +8 -6
- package/dist/core/repos.mjs +1 -0
- package/dist/core/rules/check.mjs +10 -10
- package/dist/core/rules/context.d.mts +3 -1
- package/dist/core/rules/context.mjs +16 -13
- package/dist/core/rules/fetch.mjs +17 -23
- package/dist/core/tokens.mjs +2 -1
- package/dist/core/view.d.mts +10 -1
- package/dist/core/view.mjs +15 -6
- package/dist/effect.d.mts +3 -6
- package/dist/effect.mjs +3 -6
- package/dist/engine/commits.mjs +23 -50
- package/dist/engine/failures.d.mts +1 -2
- package/dist/engine/failures.mjs +1 -3
- package/dist/engine/merge-base-walk.mjs +57 -142
- package/dist/engine/merge-bases.mjs +9 -7
- package/dist/engine/merge.mjs +20 -17
- package/dist/engine/parts.d.mts +1 -0
- package/dist/engine/parts.mjs +1 -1
- package/dist/engine/walk.mjs +15 -11
- package/dist/extend.d.mts +1 -2
- package/dist/extend.mjs +1 -2
- package/dist/http/core-parts.mjs +18 -10
- package/dist/http/handler.mjs +11 -31
- package/dist/http/parts.d.mts +0 -1
- package/dist/index.d.mts +29 -22
- package/dist/index.mjs +5 -2
- package/dist/lfs/base.d.mts +6 -3
- package/dist/lfs/base.mjs +2 -1
- package/dist/lfs/layer.d.mts +4 -3
- package/dist/lfs/layer.mjs +23 -9
- package/dist/lfs/objects.mjs +93 -41
- package/dist/lfs/pointers.mjs +69 -18
- package/dist/lfs/purge.mjs +6 -2
- package/dist/lfs/rows.mjs +24 -7
- package/dist/lfs/service.d.mts +6 -3
- package/dist/lfs/service.mjs +8 -2
- package/dist/lfs/upkeep.mjs +47 -28
- package/dist/lfs/upload-most.mjs +47 -0
- package/dist/lfs/uploaded.mjs +59 -0
- package/dist/protocol/bytes/sha256-hasher.mjs +51 -0
- package/dist/protocol/bytes/streams.mjs +84 -2
- package/dist/protocol/bytes/text.mjs +6 -1
- package/dist/protocol/diff/read.d.mts +1 -0
- package/dist/protocol/diff/read.mjs +5 -2
- package/dist/protocol/objects/commit.d.mts +7 -0
- package/dist/protocol/objects/commit.mjs +5 -1
- package/dist/protocol/objects/fsck.mjs +6 -3
- package/dist/queue/advance.mjs +77 -18
- package/dist/queue/calls.mjs +4 -14
- package/dist/queue/host.d.mts +4 -0
- package/dist/queue/lanes.mjs +1 -1
- package/dist/queue/layer.mjs +4 -2
- package/dist/queue/limits.mjs +18 -2
- package/dist/queue/rows.mjs +10 -1
- package/dist/queue/schedule.mjs +1 -1
- package/dist/queue/search.mjs +3 -4
- package/dist/queue/trim.mjs +2 -2
- package/dist/rest/client-namespace.d.mts +2 -0
- package/dist/rest/client.d.mts +32 -8
- package/dist/rest/client.mjs +308 -382
- package/dist/rest/commits.d.mts +150 -150
- package/dist/rest/files.d.mts +18 -18
- package/dist/rest/forks.d.mts +77 -89
- package/dist/rest/handlers.mjs +2 -1
- package/dist/rest/listen.d.mts +8 -6
- package/dist/rest/listen.mjs +31 -75
- package/dist/rest/me.d.mts +2 -2
- package/dist/rest/merges.d.mts +7 -7
- package/dist/rest/refs.d.mts +27 -27
- package/dist/rest/repos.d.mts +40 -52
- package/dist/rest/tokens.d.mts +12 -12
- package/dist/rest/topics.d.mts +13 -13
- package/dist/rest/trees.d.mts +66 -66
- package/dist/rest/wire.d.mts +20 -2
- package/dist/rest/work.d.mts +39 -39
- package/dist/rest.d.mts +1 -7
- package/dist/rest.mjs +1 -5
- package/dist/server/git-layer.d.mts +10 -2
- package/dist/server/git-layer.mjs +29 -10
- package/dist/server/joined.d.mts +12 -6
- package/dist/server/joined.mjs +3 -2
- package/dist/server/registry.mjs +11 -5
- package/dist/server/server.d.mts +0 -1
- package/dist/server/server.mjs +42 -49
- package/dist/signin/context.d.mts +0 -1
- package/dist/signin/context.mjs +5 -9
- package/dist/storage/clean-up.mjs +3 -1
- package/dist/storage/fsck.mjs +12 -2
- package/dist/storage/graph-rebuild.mjs +262 -0
- package/dist/storage/index-bitmaps.mjs +16 -10
- package/dist/storage/index-build.mjs +160 -24
- package/dist/storage/index-graph.d.mts +1 -0
- package/dist/storage/index-graph.mjs +29 -5
- package/dist/storage/index-layers.d.mts +1 -0
- package/dist/storage/index-layers.mjs +5 -2
- package/dist/storage/index-reach.mjs +7 -5
- package/dist/storage/index-remap.mjs +5 -5
- package/dist/storage/index-visible.mjs +16 -5
- package/dist/storage/lfs-pointers.d.mts +5 -5
- package/dist/storage/lfs-pointers.mjs +37 -11
- package/dist/storage/links.mjs +3 -3
- package/dist/storage/loose.mjs +4 -1
- package/dist/storage/memory-budget.mjs +1 -1
- package/dist/storage/merge-fence.mjs +81 -19
- package/dist/storage/merge-most.mjs +1 -0
- package/dist/storage/merge-row.mjs +16 -4
- package/dist/storage/merge-stream.mjs +9 -6
- package/dist/storage/object-rows.mjs +17 -1
- package/dist/storage/pack-order.d.mts +1 -0
- package/dist/storage/pack-order.mjs +18 -1
- package/dist/storage/pack-receive.mjs +10 -6
- package/dist/storage/packs.mjs +58 -27
- package/dist/storage/prune-walk.mjs +5 -2
- package/dist/storage/prune.mjs +168 -70
- package/dist/storage/ready.d.mts +1 -1
- package/dist/storage/ready.mjs +12 -3
- package/dist/storage/receive-bounds.mjs +3 -2
- package/dist/storage/receive-state.mjs +1 -1
- package/dist/storage/repack-contained.mjs +22 -14
- package/dist/storage/repack.d.mts +1 -1
- package/dist/storage/repack.mjs +3 -2
- package/dist/storage/unpack.mjs +7 -0
- package/dist/storage/visible.mjs +3 -2
- package/dist/storage/walk.d.mts +1 -0
- package/dist/storage/walk.mjs +9 -5
- package/dist/storage/wants.mjs +17 -11
- package/dist/store/call-count.d.mts +31 -3
- package/dist/store/call-count.mjs +51 -20
- package/dist/store/errors.d.mts +7 -1
- package/dist/store/errors.mjs +7 -1
- package/dist/store/job-try.mjs +3 -1
- package/dist/store/records.mjs +26 -5
- package/dist/store/repo-record.mjs +36 -12
- package/dist/store/scopes.mjs +15 -2
- package/dist/sync/bound.d.mts +1 -1
- package/dist/sync/import.mjs +15 -3
- package/dist/sync/layer.d.mts +5 -1
- package/dist/sync/layer.mjs +11 -9
- package/dist/sync/mirror.mjs +1 -1
- package/dist/sync/step.mjs +15 -15
- package/dist/topics/advance.mjs +11 -10
- package/dist/topics/layer.mjs +1 -1
- package/dist/topics/members.mjs +38 -9
- package/package.json +3 -3
- package/dist/engine/merge-base-walk.d.mts +0 -3
- package/dist/server/routes.d.mts +0 -32
- package/dist/server/routes.mjs +0 -69
- package/dist/sync/bridge.d.mts +0 -6
- package/dist/sync/bridge.mjs +0 -29
package/dist/lfs/objects.mjs
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { nativeSha256Hasher } from "../protocol/bytes/sha256-hasher.mjs";
|
|
2
|
+
import { gathered } from "../protocol/bytes/streams.mjs";
|
|
2
3
|
import { contended, openFor } from "../core/access.mjs";
|
|
4
|
+
import { ownWriter } from "../core/own-writes.mjs";
|
|
5
|
+
import { sweepDue } from "../core/receipts.mjs";
|
|
3
6
|
import { seenIn } from "../core/objects/reading.mjs";
|
|
4
7
|
import { checkRead, readRefusal } from "../core/rules/fetch.mjs";
|
|
5
8
|
import { utf8 } from "../protocol/bytes/text.mjs";
|
|
@@ -10,6 +13,8 @@ import { bucketCall, bucketDo, bucketFailed, bucketStream } from "../storage/cal
|
|
|
10
13
|
import { isLfsOid, lfsPointerText } from "../protocol/objects/lfs-pointer.mjs";
|
|
11
14
|
import { ListedRow, UploadRow, largestObject, lfsCollections, linkLife, listedKey, listedRead, objectKey, stagingId, stagingKey, stagingRead, streamMost, uploadGrace, uploadKey, uploadRead } from "./rows.mjs";
|
|
12
15
|
import { BatchRequest, VerifyRequest, batchMost, bodyOf, lfsAnswer } from "./wire.mjs";
|
|
16
|
+
import { uploadedRow } from "./uploaded.mjs";
|
|
17
|
+
import { pastMost, uploadPieceBytes } from "./upload-most.mjs";
|
|
13
18
|
import { fail, gitError, httpStatus } from "../contracts/result.mjs";
|
|
14
19
|
import * as Clock$1 from "effect/Clock";
|
|
15
20
|
import * as Effect from "effect/Effect";
|
|
@@ -20,10 +25,12 @@ import * as DateTime from "effect/DateTime";
|
|
|
20
25
|
// src/lfs/objects.ts
|
|
21
26
|
/**
|
|
22
27
|
* Each object's rows, read with the repo's record and the fence's rows at one version, the fence
|
|
23
|
-
* checked; `also`'s rows after them.
|
|
28
|
+
* checked; `also`'s rows after them. An object's upload row is the caller's own, as `uploader`
|
|
29
|
+
* names it. A repo deleted since it opened is `NOT_FOUND`.
|
|
24
30
|
*/
|
|
25
31
|
const objectRows = /* @__PURE__ */ Effect.fnUntraced(function* (rows, caller, repo, oids, also = []) {
|
|
26
|
-
const
|
|
32
|
+
const uploader = (yield* ownWriter(caller)) ?? "anonymous";
|
|
33
|
+
const own = oids.flatMap((oid) => [listedRead(oid), uploadRead(oid, uploader)]);
|
|
27
34
|
const { version, results } = yield* rows.readFenced(caller, repo, [...own, ...also]);
|
|
28
35
|
const found = /* @__PURE__ */ new Map();
|
|
29
36
|
for (const [at, oid] of oids.entries()) {
|
|
@@ -35,6 +42,7 @@ const objectRows = /* @__PURE__ */ Effect.fnUntraced(function* (rows, caller, re
|
|
|
35
42
|
}
|
|
36
43
|
return {
|
|
37
44
|
version,
|
|
45
|
+
uploader,
|
|
38
46
|
rows: found,
|
|
39
47
|
also: results.slice(own.length)
|
|
40
48
|
};
|
|
@@ -141,9 +149,15 @@ const batch = /* @__PURE__ */ Effect.fnUntraced(function* (parts, call) {
|
|
|
141
149
|
if (body.objects.length > 1e3) return yield* fail("RESOURCE_EXHAUSTED", `A batch names at most ${batchMost} objects`);
|
|
142
150
|
const upload = body.operation === "upload";
|
|
143
151
|
const repo = yield* openFor(call.caller, call.repo, upload);
|
|
144
|
-
const
|
|
152
|
+
const most = upload && parts.signed === void 0 ? parts.uploadMost : void 0;
|
|
153
|
+
const refusalOf = (oid, size) => {
|
|
154
|
+
if (!isLfsOid(oid)) return "An oid is a SHA-256, as 64 lowercase hex digits";
|
|
155
|
+
if (!validSize(size)) return `A size is 0 to ${largestObject} bytes`;
|
|
156
|
+
return most !== void 0 && size > most.bytes ? pastMost(most) : void 0;
|
|
157
|
+
};
|
|
158
|
+
const valid = body.objects.filter(({ oid, size }) => refusalOf(oid, size) === void 0);
|
|
145
159
|
const answers = upload ? yield* uploads(parts, call, repo, valid) : yield* downloads(parts, call, repo, valid);
|
|
146
|
-
const objects = body.objects.map(({ oid, size }) => answers.get(oid) ?? objectError(oid, size, 422,
|
|
160
|
+
const objects = body.objects.map(({ oid, size }) => answers.get(oid) ?? objectError(oid, size, 422, refusalOf(oid, size) ?? ""));
|
|
147
161
|
return lfsAnswer(200, {
|
|
148
162
|
transfer: "basic",
|
|
149
163
|
objects,
|
|
@@ -208,8 +222,9 @@ const downloads = /* @__PURE__ */ Effect.fnUntraced(function* (parts, call, repo
|
|
|
208
222
|
/**
|
|
209
223
|
* Upload links for the objects not yet listed. Each gets its upload row first, in one commit at
|
|
210
224
|
* the read's version, so upkeep, which deletes an unlisted object's bytes only past its row's
|
|
211
|
-
* `removeAt`, never deletes bytes a link given now may still write.
|
|
212
|
-
* so its links all write one key
|
|
225
|
+
* `removeAt`, never deletes bytes a link given now may still write. Each row is the caller's own,
|
|
226
|
+
* and a row kept keeps its generation, so its links all write one key no other caller's write; a
|
|
227
|
+
* new row gets a new one.
|
|
213
228
|
*/
|
|
214
229
|
const uploads = /* @__PURE__ */ Effect.fnUntraced(function* (parts, call, repo, objects) {
|
|
215
230
|
const oids = objects.map(({ oid }) => oid);
|
|
@@ -228,18 +243,21 @@ const uploads = /* @__PURE__ */ Effect.fnUntraced(function* (parts, call, repo,
|
|
|
228
243
|
generation: before?.generation ?? randomText(16)
|
|
229
244
|
};
|
|
230
245
|
return {
|
|
231
|
-
|
|
232
|
-
|
|
246
|
+
oid,
|
|
247
|
+
row: {
|
|
248
|
+
...uploadKey(oid, read.uploader),
|
|
249
|
+
value
|
|
250
|
+
}
|
|
233
251
|
};
|
|
234
252
|
});
|
|
235
253
|
if (put.length > 0) {
|
|
236
254
|
if (!(yield* parts.rows.commit(repo.internalId, read.version, {
|
|
237
|
-
put,
|
|
255
|
+
put: put.map(({ row }) => row),
|
|
238
256
|
wake: removeAt
|
|
239
257
|
})).ok) continue;
|
|
240
258
|
}
|
|
241
259
|
const answers = /* @__PURE__ */ new Map();
|
|
242
|
-
const generations = new Map(put.map((row) => [
|
|
260
|
+
const generations = new Map(put.map(({ oid, row }) => [oid, row.value.generation]));
|
|
243
261
|
for (const { oid, size } of objects) {
|
|
244
262
|
const generation = generations.get(oid);
|
|
245
263
|
const key = generation === void 0 ? void 0 : objectKey(repo.internalId, oid, generation);
|
|
@@ -272,16 +290,18 @@ const uploadActions = /* @__PURE__ */ Effect.fnUntraced(function* (parts, call,
|
|
|
272
290
|
});
|
|
273
291
|
/**
|
|
274
292
|
* `POST objects/verify`, after a signed upload: lists the object once the bucket holds bytes at
|
|
275
|
-
*
|
|
276
|
-
* upkeep's commit that drops the upload row to
|
|
277
|
-
* expects.
|
|
293
|
+
* the caller's own upload row's key that it checked against its oid, which only the caller's links
|
|
294
|
+
* wrote. The rows are read before the bucket, so upkeep's commit that drops the upload row to
|
|
295
|
+
* delete the bytes moves the version this commit expects.
|
|
278
296
|
*/
|
|
279
297
|
const verify = /* @__PURE__ */ Effect.fnUntraced(function* (parts, call) {
|
|
280
298
|
const { oid, size } = yield* bodyOf(call.request, VerifyRequest);
|
|
281
299
|
if (!isLfsOid(oid)) return yield* fail("INVALID_ARGUMENT", "An oid is a SHA-256, as 64 lowercase hex digits");
|
|
282
300
|
const { rows: registered, signed } = parts;
|
|
283
301
|
const repo = yield* openFor(call.caller, call.repo, true);
|
|
302
|
+
const writer = yield* ownWriter(call.caller);
|
|
284
303
|
for (let tries = 0; tries < 5; tries += 1) {
|
|
304
|
+
const at = yield* Clock$1.currentTimeMillis;
|
|
285
305
|
const read = yield* objectRows(registered, call.caller, repo, [oid]);
|
|
286
306
|
const rows = read.rows.get(oid);
|
|
287
307
|
const unseen = (yield* unseenRows(call.caller, repo, [oid], read.rows)).has(oid);
|
|
@@ -290,16 +310,21 @@ const verify = /* @__PURE__ */ Effect.fnUntraced(function* (parts, call) {
|
|
|
290
310
|
const stored = signed === void 0 || key === void 0 ? void 0 : yield* bucketCall(Effect.map(signed.head(key), Option.getOrUndefined));
|
|
291
311
|
if (stored?.sha256 !== oid) return yield* fail("FAILED_PRECONDITION", "The bucket holds no bytes for this object", { hint: "Upload it again" });
|
|
292
312
|
if (stored.size !== size) return yield* fail("INVALID_ARGUMENT", `This object is ${stored.size} bytes, not ${size}`);
|
|
293
|
-
|
|
294
|
-
|
|
313
|
+
const own = writer === void 0 ? [] : [uploadedRow(writer, oid, at)];
|
|
314
|
+
const writes = unseen ? { put: own } : {
|
|
295
315
|
put: [{
|
|
296
316
|
...listedKey(oid),
|
|
297
317
|
value: {
|
|
298
318
|
size: stored.size,
|
|
299
319
|
key
|
|
300
320
|
}
|
|
301
|
-
}],
|
|
302
|
-
delete: [uploadKey(oid)]
|
|
321
|
+
}, ...own],
|
|
322
|
+
delete: [uploadKey(oid, read.uploader)]
|
|
323
|
+
};
|
|
324
|
+
if (writes.put.length === 0) return lfsAnswer(200, { message: "Verified" });
|
|
325
|
+
if ((yield* registered.commit(repo.internalId, read.version, {
|
|
326
|
+
...writes,
|
|
327
|
+
wake: sweepDue(at)
|
|
303
328
|
})).ok) return lfsAnswer(200, { message: "Verified" });
|
|
304
329
|
}
|
|
305
330
|
return yield* contended();
|
|
@@ -311,6 +336,9 @@ const verify = /* @__PURE__ */ Effect.fnUntraced(function* (parts, call) {
|
|
|
311
336
|
*/
|
|
312
337
|
const receive = /* @__PURE__ */ Effect.fnUntraced(function* (parts, call, oid) {
|
|
313
338
|
if (!isLfsOid(oid)) return yield* fail("INVALID_ARGUMENT", "An oid is a SHA-256, as 64 lowercase hex digits");
|
|
339
|
+
const length = lengthOf(call.request);
|
|
340
|
+
if (length === void 0) return lfsAnswer(411, { message: noLength });
|
|
341
|
+
if (length > parts.uploadMost.bytes) return lfsAnswer(413, { message: pastMost(parts.uploadMost) });
|
|
314
342
|
const { rows: registered, bucket } = parts;
|
|
315
343
|
const repo = yield* openFor(call.caller, call.repo, true);
|
|
316
344
|
const started = yield* Clock$1.currentTimeMillis;
|
|
@@ -320,6 +348,7 @@ const receive = /* @__PURE__ */ Effect.fnUntraced(function* (parts, call, oid) {
|
|
|
320
348
|
if (rows?.listed !== void 0 && !unseen) return yield* answered(call.request);
|
|
321
349
|
const upload = rows?.upload;
|
|
322
350
|
if (upload === void 0 || upload.expiresAt < started) return yield* fail("FAILED_PRECONDITION", "No upload link for this object is live", { hint: "Ask the batch API again" });
|
|
351
|
+
if (upload.size > parts.uploadMost.bytes) return lfsAnswer(413, { message: pastMost(parts.uploadMost) });
|
|
323
352
|
const id = randomText(16);
|
|
324
353
|
const key = stagingKey(repo.internalId, id);
|
|
325
354
|
const staged = stagingId(started + uploadGrace, id);
|
|
@@ -335,15 +364,8 @@ const receive = /* @__PURE__ */ Effect.fnUntraced(function* (parts, call, oid) {
|
|
|
335
364
|
wake: started + uploadGrace
|
|
336
365
|
});
|
|
337
366
|
const hashed = hashing(call.request.body, upload.size);
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
onError: (cause) => new Unavailable({
|
|
341
|
-
message: bucketFailed,
|
|
342
|
-
cause
|
|
343
|
-
})
|
|
344
|
-
});
|
|
345
|
-
yield* Effect.uninterruptible(bucketDo(bucket.put(key, body, { size: upload.size }))).pipe(Effect.mapError((error) => hashed.past() ? pastSize(upload.size) : error));
|
|
346
|
-
if (hashed.sha256() !== oid) {
|
|
367
|
+
yield* Effect.uninterruptible(bucketDo(bucket.put(key, hashed.body, { size: upload.size }))).pipe(Effect.mapError((error) => hashed.past() ? pastSize(upload.size) : error));
|
|
368
|
+
if ((yield* hashed.hasher.hex) !== oid) {
|
|
347
369
|
yield* dropStaged(parts, repo.internalId, key, staged);
|
|
348
370
|
return yield* fail("INVALID_ARGUMENT", "The bytes' SHA-256 isn't the oid");
|
|
349
371
|
}
|
|
@@ -372,6 +394,14 @@ const dropStaged = /* @__PURE__ */ Effect.fnUntraced(function* (parts, repo, key
|
|
|
372
394
|
yield* parts.rows.commit(repo, read.version, { delete: [row] });
|
|
373
395
|
}));
|
|
374
396
|
});
|
|
397
|
+
/** Why a PUT with no `content-length` is refused. */
|
|
398
|
+
const noLength = "An upload needs its Content-Length: git-lfs sends one, and this request had none";
|
|
399
|
+
/** A request's `content-length`, or none where it has none, or one that isn't a length. */
|
|
400
|
+
const lengthOf = (request) => {
|
|
401
|
+
const header = request.headers.get("content-length");
|
|
402
|
+
const length = header === null || !/^\d+$/.test(header) ? NaN : Number(header);
|
|
403
|
+
return Number.isSafeInteger(length) ? length : void 0;
|
|
404
|
+
};
|
|
375
405
|
const pastSize = (size) => gitError("INVALID_ARGUMENT", `The bytes run past the ${size} the batch named`);
|
|
376
406
|
/**
|
|
377
407
|
* An answer to a request whose body isn't needed: the body is let go first, and a cancel that
|
|
@@ -381,27 +411,48 @@ const answered = (request) => Effect.promise(async () => {
|
|
|
381
411
|
await request.body?.cancel();
|
|
382
412
|
return lfsAnswer(200, { message: "Already uploaded" });
|
|
383
413
|
});
|
|
384
|
-
/**
|
|
414
|
+
/**
|
|
415
|
+
* `body` as it streams to the bucket, gathered into pieces of `uploadPieceBytes`, counted, and
|
|
416
|
+
* hashed through the runtime's own SHA-256, each piece's write awaited before it goes on, failing
|
|
417
|
+
* past `most` bytes. No piece reaches more than one byte past what `most` leaves, so a body that
|
|
418
|
+
* runs past it is read no further than that byte's chunk.
|
|
419
|
+
*/
|
|
385
420
|
const hashing = (body, most) => {
|
|
386
|
-
const
|
|
421
|
+
const hasher = nativeSha256Hasher();
|
|
387
422
|
let size = 0;
|
|
388
|
-
const
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
423
|
+
const read = Stream.fromReadableStream({
|
|
424
|
+
evaluate: () => body === null ? new ReadableStream({ start: (controller) => controller.close() }) : gathered(body, (given) => Math.min(uploadPieceBytes, Math.max(1, most - given + 1))),
|
|
425
|
+
onError: (cause) => new Unavailable({
|
|
426
|
+
message: bucketFailed,
|
|
427
|
+
cause
|
|
428
|
+
})
|
|
429
|
+
});
|
|
394
430
|
return {
|
|
395
|
-
|
|
431
|
+
body: Stream.mapEffect(read, (chunk) => {
|
|
432
|
+
size += chunk.length;
|
|
433
|
+
if (size > most) return Effect.fail(pastSize(most));
|
|
434
|
+
return Effect.as(hasher.write(chunk), chunk);
|
|
435
|
+
}),
|
|
396
436
|
past: () => size > most,
|
|
397
|
-
|
|
437
|
+
hasher
|
|
398
438
|
};
|
|
399
439
|
};
|
|
400
440
|
/** Lists a Worker upload's bytes at their staging key, in the commit that drops its staging row. */
|
|
401
441
|
const listStaged = /* @__PURE__ */ Effect.fnUntraced(function* (registered, caller, repo, staged) {
|
|
442
|
+
const writer = yield* ownWriter(caller);
|
|
402
443
|
for (let tries = 0; tries < 5; tries += 1) {
|
|
444
|
+
const at = yield* Clock$1.currentTimeMillis;
|
|
445
|
+
const own = writer === void 0 ? [] : [uploadedRow(writer, staged.oid, at)];
|
|
403
446
|
const read = yield* objectRows(registered, caller, repo, [staged.oid], [stagingRead(staged.staged)]);
|
|
404
|
-
if (read.rows.get(staged.oid)?.listed !== void 0)
|
|
447
|
+
if (read.rows.get(staged.oid)?.listed !== void 0) {
|
|
448
|
+
const answer = lfsAnswer(200, { message: staged.unseen ? "Uploaded" : "Already uploaded" });
|
|
449
|
+
if (own.length === 0) return answer;
|
|
450
|
+
if ((yield* registered.commit(repo.internalId, read.version, {
|
|
451
|
+
put: own,
|
|
452
|
+
wake: sweepDue(at)
|
|
453
|
+
})).ok) return answer;
|
|
454
|
+
continue;
|
|
455
|
+
}
|
|
405
456
|
if ((read.also[0] ?? []).length === 0 || (yield* Clock$1.currentTimeMillis) > staged.deadline) return yield* fail("DEADLINE_EXCEEDED", "The upload ran too long", { hint: "Upload it again" });
|
|
406
457
|
if ((yield* registered.commit(repo.internalId, read.version, {
|
|
407
458
|
put: [{
|
|
@@ -410,11 +461,12 @@ const listStaged = /* @__PURE__ */ Effect.fnUntraced(function* (registered, call
|
|
|
410
461
|
size: staged.size,
|
|
411
462
|
key: staged.key
|
|
412
463
|
}
|
|
413
|
-
}],
|
|
414
|
-
delete: [uploadKey(staged.oid), {
|
|
464
|
+
}, ...own],
|
|
465
|
+
delete: [uploadKey(staged.oid, read.uploader), {
|
|
415
466
|
collection: lfsCollections.staging,
|
|
416
467
|
id: staged.staged
|
|
417
|
-
}]
|
|
468
|
+
}],
|
|
469
|
+
wake: sweepDue(at)
|
|
418
470
|
})).ok) return lfsAnswer(200, { message: "Uploaded" });
|
|
419
471
|
}
|
|
420
472
|
return yield* contended();
|
package/dist/lfs/pointers.mjs
CHANGED
|
@@ -2,18 +2,28 @@ import { gitError } from "../contracts/result.mjs";
|
|
|
2
2
|
import { bytesOf } from "../storage/wants.mjs";
|
|
3
3
|
import { deadlineOf, timed, within } from "../engine/reads.mjs";
|
|
4
4
|
import { decodeCommit } from "../protocol/objects/commit.mjs";
|
|
5
|
-
import { isTreeMode } from "../protocol/objects/object.mjs";
|
|
5
|
+
import { isTreeMode, objectId } from "../protocol/objects/object.mjs";
|
|
6
6
|
import { parseTreeBytes } from "../protocol/objects/tree.mjs";
|
|
7
|
-
import {
|
|
7
|
+
import { ownWriter } from "../core/own-writes.mjs";
|
|
8
|
+
import { utf8 } from "../protocol/bytes/text.mjs";
|
|
9
|
+
import { lfsPointerText } from "../protocol/objects/lfs-pointer.mjs";
|
|
10
|
+
import { lfsOidAt, lfsSizeAt, pointersOfBlob } from "../storage/lfs-pointers.mjs";
|
|
8
11
|
import { listedOf } from "./objects.mjs";
|
|
12
|
+
import { uploadedOf } from "./uploaded.mjs";
|
|
13
|
+
import * as Clock$1 from "effect/Clock";
|
|
9
14
|
import * as Effect from "effect/Effect";
|
|
10
15
|
// src/lfs/pointers.ts
|
|
11
16
|
/**
|
|
12
17
|
* LFS's push rule: a ref whose new tip holds, in a tree the push carries, a Git LFS pointer the
|
|
13
|
-
* push carries to an object the repo
|
|
14
|
-
* can't download.
|
|
15
|
-
* the
|
|
16
|
-
*
|
|
18
|
+
* push carries to an object the repo doesn't hold for the pusher is refused, so a clone never
|
|
19
|
+
* meets a pointer it can't download. The repo holds it for the pusher when it lists the object at
|
|
20
|
+
* the size the pointer names, and, for a pusher whose view is narrowed, as under `access` one who
|
|
21
|
+
* doesn't read every pattern is, when a ref it sees reaches the object's pointer or it sent the
|
|
22
|
+
* object's bytes within `uploadedKept` (#1943). So a hidden object's oid and size alone push no
|
|
23
|
+
* pointer to it, and the refusal is the one an unlisted object gets, telling nothing of it. It
|
|
24
|
+
* starts from the pointers the receive found among the push's blobs, and reads the listed rows of
|
|
25
|
+
* the oids they name. Only when one is refused does it walk each new tip's trees, the push's own
|
|
26
|
+
* alone, for where that pointer sits.
|
|
17
27
|
*/
|
|
18
28
|
/**
|
|
19
29
|
* How long the walk for an unlisted pointer may take, across every ref of one push. A push's
|
|
@@ -27,7 +37,10 @@ const pushCheckMilliseconds = 6e4;
|
|
|
27
37
|
const fileModes = /* @__PURE__ */ new Set(["100644", "100755"]);
|
|
28
38
|
/**
|
|
29
39
|
* The check, over the repo's listed rows in LFS's registration's `rows`: each ref it refuses, with why.
|
|
30
|
-
* It answers only for the refs it's asked of, and may be asked twice.
|
|
40
|
+
* It answers only for the refs it's asked of, and may be asked twice. It checks every push,
|
|
41
|
+
* whatever the repo's `.gitattributes` say: one can come in the same push, sit on another ref or in
|
|
42
|
+
* a folder, so none says which files are pointers. Its cost is bounded already, as the receive
|
|
43
|
+
* reads only the push's new blobs of at most 1,024 bytes for pointers, in its own pass.
|
|
31
44
|
*/
|
|
32
45
|
const pointerCheck = /* @__PURE__ */ Effect.fnUntraced(function* (rows, input) {
|
|
33
46
|
const refused = /* @__PURE__ */ new Map();
|
|
@@ -40,7 +53,7 @@ const pointerCheck = /* @__PURE__ */ Effect.fnUntraced(function* (rows, input) {
|
|
|
40
53
|
}
|
|
41
54
|
const { lfsPointers } = input.objects;
|
|
42
55
|
if (lfsPointers.count === 0 || tips.size === 0) return refused;
|
|
43
|
-
const unlisted = yield* unlistedOf(rows, input
|
|
56
|
+
const unlisted = yield* unlistedOf(rows, input);
|
|
44
57
|
if (unlisted === void 0) return refused;
|
|
45
58
|
const deadline = yield* deadlineOf(pushCheckMilliseconds, "walk-limit");
|
|
46
59
|
const walk = Effect.forEach(tips, ([ref, tip]) => Effect.map(missingAt(input, unlisted, tip, deadline), (missing) => [ref, missing]));
|
|
@@ -49,28 +62,66 @@ const pointerCheck = /* @__PURE__ */ Effect.fnUntraced(function* (rows, input) {
|
|
|
49
62
|
return refused;
|
|
50
63
|
});
|
|
51
64
|
/**
|
|
52
|
-
* Which of
|
|
53
|
-
*
|
|
54
|
-
*
|
|
65
|
+
* Which of the push's pointers name an object the repo doesn't hold for the pusher, one bit an
|
|
66
|
+
* entry, or `undefined` when it holds every one: unlisted, or listed at another size, then, of the
|
|
67
|
+
* rest, those `unprovenOf` leaves. It reads a chunk of entries at a time, so it keeps no more than
|
|
68
|
+
* one read's rows beside the bits and the entries left to prove.
|
|
55
69
|
*/
|
|
56
|
-
const unlistedOf = /* @__PURE__ */ Effect.fnUntraced(function* (rows,
|
|
70
|
+
const unlistedOf = /* @__PURE__ */ Effect.fnUntraced(function* (rows, input) {
|
|
71
|
+
const pointers = input.objects.lfsPointers;
|
|
57
72
|
const unlisted = new Uint8Array(Math.ceil(pointers.count / 8));
|
|
73
|
+
const listedAt = [];
|
|
58
74
|
let any = false;
|
|
75
|
+
const refuse = (at) => {
|
|
76
|
+
unlisted[at >>> 3] = (unlisted[at >>> 3] ?? 0) | 1 << (at & 7);
|
|
77
|
+
any = true;
|
|
78
|
+
};
|
|
59
79
|
for (let from = 0; from < pointers.count; from += 100) {
|
|
60
80
|
const to = Math.min(from + 100, pointers.count);
|
|
61
81
|
const oids = Array.from({ length: to - from }, (_, at) => lfsOidAt(pointers, from + at));
|
|
62
|
-
const listed = yield* listedOf(rows, repo, [...new Set(oids)]);
|
|
63
|
-
for (const [at, oid] of oids.entries())
|
|
64
|
-
|
|
65
|
-
unlisted[from + at >>> 3] = (unlisted[from + at >>> 3] ?? 0) | 1 << (from + at & 7);
|
|
66
|
-
any = true;
|
|
67
|
-
}
|
|
82
|
+
const listed = yield* listedOf(rows, input.objects.repo, [...new Set(oids)]);
|
|
83
|
+
for (const [at, oid] of oids.entries()) if (listed.get(oid)?.size === lfsSizeAt(pointers, from + at)) listedAt.push(from + at);
|
|
84
|
+
else refuse(from + at);
|
|
68
85
|
}
|
|
86
|
+
const unproven = yield* unprovenOf(rows, input, listedAt);
|
|
87
|
+
for (const at of listedAt) if (unproven.has(lfsOidAt(pointers, at))) refuse(at);
|
|
69
88
|
return any ? {
|
|
70
89
|
pointers,
|
|
71
90
|
unlisted
|
|
72
91
|
} : void 0;
|
|
73
92
|
});
|
|
93
|
+
/**
|
|
94
|
+
* The oids of `entries`, each listed at its pointer's size, that the pusher hasn't shown it holds:
|
|
95
|
+
* none for a pusher whose view isn't narrowed. Else those whose pointer, as git-lfs writes it, no
|
|
96
|
+
* ref the pusher sees reaches, as `seenIn` asks of every one at once, less those the pusher
|
|
97
|
+
* uploaded within `uploadedKept`.
|
|
98
|
+
*/
|
|
99
|
+
const unprovenOf = /* @__PURE__ */ Effect.fnUntraced(function* (rows, input, entries) {
|
|
100
|
+
const { lfsPointers: pointers, repo } = input.objects;
|
|
101
|
+
const unproven = /* @__PURE__ */ new Set();
|
|
102
|
+
if (entries.length === 0) return unproven;
|
|
103
|
+
const blobs = /* @__PURE__ */ new Map();
|
|
104
|
+
const sized = new Map(entries.map((at) => [lfsOidAt(pointers, at), lfsSizeAt(pointers, at)]));
|
|
105
|
+
for (const [oid, size] of sized) {
|
|
106
|
+
const text = lfsPointerText({
|
|
107
|
+
oid,
|
|
108
|
+
size
|
|
109
|
+
});
|
|
110
|
+
blobs.set(yield* objectId({
|
|
111
|
+
type: "blob",
|
|
112
|
+
bytes: utf8(text)
|
|
113
|
+
}), oid);
|
|
114
|
+
}
|
|
115
|
+
const seen = yield* input.seen([...blobs.keys()]);
|
|
116
|
+
if (seen === void 0) return unproven;
|
|
117
|
+
const unseen = [...blobs].flatMap(([blob, oid]) => seen.has(blob) ? [] : [oid]);
|
|
118
|
+
if (unseen.length === 0) return unproven;
|
|
119
|
+
const writer = yield* ownWriter(input.caller);
|
|
120
|
+
const at = yield* Clock$1.currentTimeMillis;
|
|
121
|
+
const own = writer === void 0 ? /* @__PURE__ */ new Set() : yield* uploadedOf(rows, repo, writer, unseen, at);
|
|
122
|
+
for (const oid of unseen) if (!own.has(oid)) unproven.add(oid);
|
|
123
|
+
return unproven;
|
|
124
|
+
});
|
|
74
125
|
/** The unlisted LFS oids the pointers of the blob `blob` name, if any. */
|
|
75
126
|
const unlistedNamed = ({ pointers, unlisted }, blob) => {
|
|
76
127
|
const { from, to } = pointersOfBlob(pointers, blob);
|
package/dist/lfs/purge.mjs
CHANGED
|
@@ -24,11 +24,15 @@ const lfsPurge = (rows, bucket) => /* @__PURE__ */ Effect.fnUntraced(function* (
|
|
|
24
24
|
{
|
|
25
25
|
collection: lfsCollections.locks,
|
|
26
26
|
limit: 500
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
collection: lfsCollections.uploaded,
|
|
30
|
+
limit: 500
|
|
27
31
|
}
|
|
28
32
|
]);
|
|
29
|
-
const [uploads = [], staging = [], ending = [], listed = [], locks = []] = snapshot.results;
|
|
33
|
+
const [uploads = [], staging = [], ending = [], listed = [], locks = [], uploaded = []] = snapshot.results;
|
|
30
34
|
if (uploads.length + staging.length + ending.length > 0) return "waits";
|
|
31
|
-
const found = listed.length > 0 ? listed : locks;
|
|
35
|
+
const found = listed.length > 0 ? listed : locks.length > 0 ? locks : uploaded;
|
|
32
36
|
if (found.length === 0) return "done";
|
|
33
37
|
const keys = yield* Effect.forEach(listed, (row) => Effect.map(decodeRow(ListedRow, row, `LFS object ${row.id}`), (object) => object.key));
|
|
34
38
|
yield* Effect.forEach(keys, (key) => bucketDo(bucket.remove(key)), {
|
package/dist/lfs/rows.mjs
CHANGED
|
@@ -11,14 +11,16 @@ import * as Schema from "effect/Schema";
|
|
|
11
11
|
const lfsCollections = {
|
|
12
12
|
/** Each LFS object the repo lists, by its oid. Only a deleted repo unlists. */
|
|
13
13
|
objects: "lfs/objects",
|
|
14
|
-
/** Each LFS object an upload link was given for, by its oid, until listed. */
|
|
14
|
+
/** Each LFS object an upload link was given for, by its oid and its uploader, until listed. */
|
|
15
15
|
uploads: "lfs/uploads",
|
|
16
16
|
/** A Worker upload's staging key, by its due `removeAt` and its ID. */
|
|
17
17
|
staging: "lfs/staging",
|
|
18
18
|
/** An LFS object upkeep is deleting, by its oid, which no verify lists. */
|
|
19
19
|
ending: "lfs/ending",
|
|
20
20
|
/** Each LFS lock, by its path's SHA-256. */
|
|
21
|
-
locks: "lfs/locks"
|
|
21
|
+
locks: "lfs/locks",
|
|
22
|
+
/** Each object a caller sent bytes for, by the day, the caller's writer and the oid. */
|
|
23
|
+
uploaded: "lfs/uploaded"
|
|
22
24
|
};
|
|
23
25
|
/**
|
|
24
26
|
* The largest object LFS takes: R2's largest put in one request, 5 GiB less 5 MiB, since a
|
|
@@ -33,6 +35,11 @@ const linkLife = /* @__PURE__ */ millis("15 minutes");
|
|
|
33
35
|
*/
|
|
34
36
|
const uploadGrace = /* @__PURE__ */ millis("1 day");
|
|
35
37
|
/**
|
|
38
|
+
* How long a caller's upload counts as its own, for the pointer rule: a day from its verified
|
|
39
|
+
* bytes, so a pointer it pushes to them passes though no ref it sees reaches them yet.
|
|
40
|
+
*/
|
|
41
|
+
const uploadedKept = /* @__PURE__ */ millis("1 day");
|
|
42
|
+
/**
|
|
36
43
|
* A listed object: its bytes are at `key`, checked. A signed upload's are at its upload row's
|
|
37
44
|
* `objectKey`, and a Worker upload's stay at the staging key they streamed to, which only they
|
|
38
45
|
* were ever written to.
|
|
@@ -86,10 +93,20 @@ const listedKey = (oid) => ({
|
|
|
86
93
|
collection: lfsCollections.objects,
|
|
87
94
|
id: oid
|
|
88
95
|
});
|
|
89
|
-
|
|
96
|
+
/**
|
|
97
|
+
* Who an upload row is for: `ownWriter`'s SHA-256 of the caller's actor ID, or this for a caller
|
|
98
|
+
* with none. Each uploader's row has its own generation, so its signed links write a key no other
|
|
99
|
+
* caller's links write, and a verify heads only the caller's own: bytes another caller sent prove
|
|
100
|
+
* nothing of this one (#1943).
|
|
101
|
+
*/
|
|
102
|
+
const anonymousUploader = "anonymous";
|
|
103
|
+
const uploadId = (oid, uploader) => `${oid}.${uploader}`;
|
|
104
|
+
const uploadKey = (oid, uploader) => ({
|
|
90
105
|
collection: lfsCollections.uploads,
|
|
91
|
-
id: oid
|
|
106
|
+
id: uploadId(oid, uploader)
|
|
92
107
|
});
|
|
108
|
+
/** The oid an upload row's ID names, before its uploader. */
|
|
109
|
+
const uploadOid = (id) => id.slice(0, id.indexOf("."));
|
|
93
110
|
/** An ending row's key: its upload's oid and generation, so two generations' rows never meet. */
|
|
94
111
|
const endingKey = (oid, generation) => ({
|
|
95
112
|
collection: lfsCollections.ending,
|
|
@@ -113,8 +130,8 @@ const listedRead = (oid) => ({
|
|
|
113
130
|
collection: lfsCollections.objects,
|
|
114
131
|
id: oid
|
|
115
132
|
});
|
|
116
|
-
const uploadRead = (oid) => ({
|
|
133
|
+
const uploadRead = (oid, uploader) => ({
|
|
117
134
|
collection: lfsCollections.uploads,
|
|
118
|
-
id: oid
|
|
135
|
+
id: uploadId(oid, uploader)
|
|
119
136
|
});
|
|
120
|
-
export { EndingRow, ListedRow, LockRow, StagingRow, UploadRow, endingKey, largestObject, lfsCollections, linkLife, listedKey, listedRead, lockKey, lockRead, objectKey, stagingId, stagingKey, stagingRead, streamMost, uploadGrace, uploadKey, uploadRead };
|
|
137
|
+
export { EndingRow, ListedRow, LockRow, StagingRow, UploadRow, anonymousUploader, endingKey, largestObject, lfsCollections, linkLife, listedKey, listedRead, lockKey, lockRead, objectKey, stagingId, stagingKey, stagingRead, streamMost, uploadGrace, uploadKey, uploadOid, uploadRead, uploadedKept };
|
package/dist/lfs/service.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LfsFeature } from "../contracts/lfs.mjs";
|
|
1
|
+
import { LfsFeature, LfsOptions } from "../contracts/lfs.mjs";
|
|
2
2
|
import { GitError } from "../contracts/result.mjs";
|
|
3
3
|
import "../core/parts.mjs";
|
|
4
4
|
import { LfsCall } from "./objects.mjs";
|
|
@@ -10,5 +10,8 @@ export interface LfsRoute extends LfsCall {
|
|
|
10
10
|
}
|
|
11
11
|
/** Git LFS's API for a server's repos, its objects in `bucket`. */
|
|
12
12
|
export type LfsService = (call: LfsRoute) => Effect.Effect<Response, GitError>;
|
|
13
|
-
/**
|
|
14
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Turns on Git LFS, its objects in the adapter's bucket: a server without it has no LFS. `options`
|
|
15
|
+
* win over the adapter's `RequestLimits`, as `LfsOptions` says.
|
|
16
|
+
*/
|
|
17
|
+
export declare const lfs: (options?: LfsOptions) => LfsFeature;
|
package/dist/lfs/service.mjs
CHANGED
|
@@ -4,8 +4,14 @@ import { batch, receive, send, verify } from "./objects.mjs";
|
|
|
4
4
|
import { lfsAnswer } from "./wire.mjs";
|
|
5
5
|
import * as Effect from "effect/Effect";
|
|
6
6
|
// src/lfs/service.ts
|
|
7
|
-
/**
|
|
8
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Turns on Git LFS, its objects in the adapter's bucket: a server without it has no LFS. `options`
|
|
9
|
+
* win over the adapter's `RequestLimits`, as `LfsOptions` says.
|
|
10
|
+
*/
|
|
11
|
+
const lfs = (options = {}) => ({
|
|
12
|
+
...options,
|
|
13
|
+
kind: "lfs"
|
|
14
|
+
});
|
|
9
15
|
const methodNotAllowed = (allow) => Effect.succeed(lfsAnswer(405, { message: "Method not allowed" }, { allow }));
|
|
10
16
|
/** LFS's routes over `parts`, provided `needs`, the server's services, which `openRepo` reads. */
|
|
11
17
|
const lfsService = (needs, parts) => (call) => Effect.provideContext(served(parts, call), needs);
|