@ref0/git 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/client.d.mts +16 -9
- package/dist/contracts/events.d.mts +12 -10
- package/dist/contracts/events.mjs +8 -6
- 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/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 +20 -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 +3 -3
- package/dist/contracts/queue.mjs +5 -18
- 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/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/loose-tally.mjs +46 -0
- package/dist/core/objects/writing.mjs +1 -0
- package/dist/core/promise.mjs +1 -15
- package/dist/core/purge.mjs +14 -9
- package/dist/core/push.mjs +13 -6
- package/dist/core/ref-view.mjs +14 -6
- package/dist/core/repack.mjs +19 -14
- 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/effect.d.mts +2 -4
- package/dist/effect.mjs +2 -4
- package/dist/engine/commits.mjs +19 -47
- 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 +5 -5
- package/dist/engine/merge.mjs +16 -14
- package/dist/extend.d.mts +1 -2
- package/dist/extend.mjs +1 -2
- package/dist/http/core-parts.mjs +1 -2
- package/dist/http/handler.mjs +11 -31
- package/dist/http/parts.d.mts +0 -1
- package/dist/index.d.mts +28 -21
- 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 +90 -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 +44 -26
- package/dist/lfs/upload-most.mjs +41 -0
- package/dist/lfs/uploaded.mjs +59 -0
- package/dist/protocol/bytes/sha256-hasher.mjs +51 -0
- package/dist/protocol/bytes/text.mjs +6 -1
- package/dist/protocol/objects/fsck.mjs +6 -3
- package/dist/queue/advance.mjs +38 -8
- package/dist/queue/calls.mjs +4 -14
- package/dist/queue/lanes.mjs +1 -1
- package/dist/queue/rows.mjs +8 -0
- package/dist/queue/schedule.mjs +1 -1
- package/dist/queue/search.mjs +3 -4
- 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 +240 -240
- package/dist/rest/files.d.mts +18 -18
- package/dist/rest/forks.d.mts +45 -57
- 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 +139 -139
- package/dist/rest/repos.d.mts +54 -66
- package/dist/rest/tokens.d.mts +12 -12
- package/dist/rest/topics.d.mts +110 -110
- package/dist/rest/trees.d.mts +66 -66
- package/dist/rest/wire.d.mts +1 -1
- 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 +1 -1
- package/dist/server/server.d.mts +0 -1
- package/dist/server/server.mjs +26 -45
- 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-build.mjs +100 -12
- package/dist/storage/lfs-pointers.d.mts +5 -5
- package/dist/storage/lfs-pointers.mjs +37 -11
- 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-receive.mjs +10 -6
- package/dist/storage/packs.mjs +58 -27
- package/dist/storage/prune.mjs +68 -40
- package/dist/storage/ready.d.mts +1 -1
- package/dist/storage/ready.mjs +12 -3
- 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/store/call-count.d.mts +23 -3
- package/dist/store/call-count.mjs +36 -13
- package/dist/store/records.mjs +10 -4
- package/dist/store/repo-record.mjs +29 -12
- package/dist/store/scopes.mjs +6 -1
- package/dist/sync/import.mjs +14 -2
- package/dist/sync/layer.d.mts +5 -1
- package/dist/sync/layer.mjs +7 -2
- package/dist/sync/step.mjs +15 -15
- package/dist/topics/advance.mjs +7 -6
- 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/server/routes.mjs
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { Auth } from "../auth/auth.mjs";
|
|
2
|
-
import { hostAuth, hostPolicy } from "../auth/bridge.mjs";
|
|
3
|
-
import { Policy } from "../auth/policy.mjs";
|
|
4
|
-
import { createRestHandler } from "../rest/handler.mjs";
|
|
5
|
-
import { serverWith } from "./server.mjs";
|
|
6
|
-
import * as Effect from "effect/Effect";
|
|
7
|
-
import * as Option from "effect/Option";
|
|
8
|
-
import { Bucket } from "@ref0/infra";
|
|
9
|
-
import * as Context from "effect/Context";
|
|
10
|
-
import * as Layer from "effect/Layer";
|
|
11
|
-
import * as HttpServerResponse from "effect/http/HttpServerResponse";
|
|
12
|
-
import * as HttpRouter from "effect/http/HttpRouter";
|
|
13
|
-
import * as HttpServerRequest from "effect/http/HttpServerRequest";
|
|
14
|
-
// src/server/routes.ts
|
|
15
|
-
/** Every path under `base`, as the router matches it. */
|
|
16
|
-
const pathUnder = (base) => {
|
|
17
|
-
const trimmed = base.replace(/^\/+|\/+$/g, "");
|
|
18
|
-
return trimmed === "" ? "*" : `/${trimmed}/*`;
|
|
19
|
-
};
|
|
20
|
-
/** Objects that need no bucket, as `needsBucket` says: `createGitServer` checks it again. */
|
|
21
|
-
const looseOnly = (objects) => {
|
|
22
|
-
if (objects.needsBucket) throw new TypeError("GitServer.routes' objects need a Bucket: provide one");
|
|
23
|
-
return {
|
|
24
|
-
...objects,
|
|
25
|
-
needsBucket: false
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
/** The options of a server with a bucket, with `lfs` only when the host passed `lfs()`. */
|
|
29
|
-
const withBucket = ({ lfs, ...rest }) => lfs === void 0 ? rest : {
|
|
30
|
-
...rest,
|
|
31
|
-
lfs
|
|
32
|
-
};
|
|
33
|
-
/** The options of a server with no bucket, which `lfs()` needs: `createGitServer` checks it again. */
|
|
34
|
-
const withoutLfs = ({ lfs, ...rest }) => {
|
|
35
|
-
if (lfs !== void 0) throw new TypeError("GitServer.routes' lfs() needs a Bucket: provide one");
|
|
36
|
-
return rest;
|
|
37
|
-
};
|
|
38
|
-
/**
|
|
39
|
-
* Git's routes on a host's `HttpRouter`: the server `createGitServer` makes from `options`, over
|
|
40
|
-
* the host's services, its `Records`, `JobQueue`, `CallLimits` and `Bucket`, deciding with its `Policy` and `Auth`.
|
|
41
|
-
* Every URL under `basePath` answers as `createRestHandler`'s `fetch` does: REST's, then Git's
|
|
42
|
-
* protocol, then a JSON `404`. The server closes with the Layer.
|
|
43
|
-
*/
|
|
44
|
-
const routes = (options) => HttpRouter.use((router) => Effect.gen(function* () {
|
|
45
|
-
const context = yield* Effect.context();
|
|
46
|
-
const adapter = Layer.succeedContext(context);
|
|
47
|
-
const bucket = Context.getOrUndefined(context, Bucket.Bucket);
|
|
48
|
-
const policy = yield* Policy;
|
|
49
|
-
const auth = Option.getOrUndefined(yield* Effect.serviceOption(Auth));
|
|
50
|
-
const deciders = (reports) => ({
|
|
51
|
-
policy: hostPolicy(policy, reports),
|
|
52
|
-
auth: hostAuth(auth, reports)
|
|
53
|
-
});
|
|
54
|
-
const made = () => bucket === void 0 ? serverWith({
|
|
55
|
-
...withoutLfs(options),
|
|
56
|
-
objects: looseOnly(options.objects),
|
|
57
|
-
adapter
|
|
58
|
-
}, deciders) : serverWith({
|
|
59
|
-
...withBucket(options),
|
|
60
|
-
adapter: Layer.merge(adapter, Layer.succeed(Bucket.Bucket, bucket))
|
|
61
|
-
}, deciders);
|
|
62
|
-
const git = yield* Effect.acquireRelease(Effect.sync(made), (made) => Effect.promise(() => made.close()));
|
|
63
|
-
const rest = createRestHandler(git);
|
|
64
|
-
const serve = (request) => Effect.orDie(HttpServerRequest.toWeb(request)).pipe(Effect.flatMap((web) => Effect.promise(() => rest.fetch(web))), Effect.map((response) => HttpServerResponse.raw(response)));
|
|
65
|
-
yield* router.add("*", pathUnder(options.basePath ?? ""), serve);
|
|
66
|
-
}));
|
|
67
|
-
/** The server's calls as Effects, and its routes as a Layer a host's router serves. */
|
|
68
|
-
const GitServer = Object.assign(Context.Service("@ref0/git/GitServer"), { routes });
|
|
69
|
-
export { GitServer };
|
package/dist/sync/bridge.d.mts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { GitError, Result } from "../contracts/result.mjs";
|
|
2
|
-
import { Sync } from "../contracts/sync.mjs";
|
|
3
|
-
import { GitServer } from "../contracts/server.mjs";
|
|
4
|
-
import * as Effect from "effect/Effect";
|
|
5
|
-
/** The temporary Promise bridge for createGitServer's worlds; step 2c-1b deletes it. */
|
|
6
|
-
export declare const syncOn: <A>(git: GitServer, effect: Effect.Effect<A, GitError, Sync>, signal?: AbortSignal) => Promise<Result<A>>;
|
package/dist/sync/bridge.mjs
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Sync } from "../contracts/sync.mjs";
|
|
2
|
-
import { fail } from "../contracts/result.mjs";
|
|
3
|
-
import { seamOf } from "../core/seam.mjs";
|
|
4
|
-
import { exitOn, resultIn, uncounted } from "../store/crossing.mjs";
|
|
5
|
-
import { openDoor, throughBridge } from "../store/promises.mjs";
|
|
6
|
-
import * as Effect from "effect/Effect";
|
|
7
|
-
import * as Option from "effect/Option";
|
|
8
|
-
import * as Exit from "effect/Exit";
|
|
9
|
-
import * as Result from "effect/Result";
|
|
10
|
-
// src/sync/bridge.ts
|
|
11
|
-
/** The temporary Promise bridge for createGitServer's worlds; step 2c-1b deletes it. */
|
|
12
|
-
const syncOn = (git, effect, signal) => {
|
|
13
|
-
const seam = seamOf(git);
|
|
14
|
-
const call = Effect.flatMap(Effect.serviceOption(Sync), (sync) => Option.isSome(sync) ? Effect.provideService(effect, Sync, sync.value) : noSync());
|
|
15
|
-
return resultIn(throughBridge(seam?.door ?? openDoor)(Effect.gen(function* () {
|
|
16
|
-
yield* seam?.parts ?? Effect.void;
|
|
17
|
-
const exit = yield* Effect.promise((stopped) => exitOn(git.runtime, Effect.result(call), uncounted("a host's sync call: no Git request"), stopped));
|
|
18
|
-
if (Exit.isFailure(exit)) return yield* Effect.orDie(Effect.failCause(exit.cause));
|
|
19
|
-
const result = exit.value;
|
|
20
|
-
return yield* Result.isSuccess(result) ? Effect.succeed(result.success) : Effect.fail(result.failure);
|
|
21
|
-
})), uncounted("a host's sync call: no Git request"), signal);
|
|
22
|
-
};
|
|
23
|
-
/** The feature-off answer, read before a world can call the feature. */
|
|
24
|
-
const noSync = () => fail("NOT_FOUND", "This server doesn't offer import or mirroring", {
|
|
25
|
-
hint: "This server doesn't offer import or mirroring",
|
|
26
|
-
hostHint: "Compose Sync.layer({ providers }) with Git.layer to offer import or mirroring",
|
|
27
|
-
context: { reason: "no-sync" }
|
|
28
|
-
});
|
|
29
|
-
export { syncOn };
|