@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/contracts/rules.mjs
CHANGED
|
@@ -1,13 +1,92 @@
|
|
|
1
|
+
import { Actor, ActorId } from "./actors.mjs";
|
|
2
|
+
import { actingWith } from "./callers.mjs";
|
|
3
|
+
import "./engine.mjs";
|
|
4
|
+
import { Oid, RepoName } from "./ids.mjs";
|
|
5
|
+
import { FetchRequest } from "./object-values.mjs";
|
|
6
|
+
import { EffectValue, FunctionValue, RequestValue, StreamValue } from "./opaque.mjs";
|
|
7
|
+
import { RefSource, RefUpdate } from "./refs.mjs";
|
|
8
|
+
import { RepoStats } from "./repos.mjs";
|
|
1
9
|
import * as Schema from "effect/Schema";
|
|
2
10
|
import * as Context from "effect/Context";
|
|
3
11
|
// src/contracts/rules.ts
|
|
12
|
+
const PushFacts = /* @__PURE__ */ Schema.Struct({
|
|
13
|
+
bytes: Schema.Number,
|
|
14
|
+
objects: Schema.Number,
|
|
15
|
+
updates: Schema.mutable(Schema.Array(RefUpdate))
|
|
16
|
+
});
|
|
17
|
+
Schema.Boolean;
|
|
18
|
+
/**
|
|
19
|
+
* The Schema of a shape typed `PushContext & { …fields }`, with `PushContext`'s request, Effect
|
|
20
|
+
* and Stream held as themselves.
|
|
21
|
+
*/
|
|
22
|
+
const pushContextWith = (fields) => actingWith({
|
|
23
|
+
repo: RepoName,
|
|
24
|
+
subject: Schema.optionalKey(ActorId),
|
|
25
|
+
source: RefSource,
|
|
26
|
+
push: PushFacts,
|
|
27
|
+
stats: RepoStats,
|
|
28
|
+
request: Schema.optionalKey(RequestValue),
|
|
29
|
+
pushOptions: Schema.optionalKey(Schema.Array(Schema.String)),
|
|
30
|
+
changes: EffectValue(),
|
|
31
|
+
commitChanges: StreamValue(),
|
|
32
|
+
...fields
|
|
33
|
+
});
|
|
34
|
+
FunctionValue();
|
|
35
|
+
/** What every fetch rule's input names: the caller's actor and the repo. */
|
|
36
|
+
const FetchRuleOf = /* @__PURE__ */ Schema.Struct({
|
|
37
|
+
actor: Actor,
|
|
38
|
+
repo: RepoName
|
|
39
|
+
});
|
|
40
|
+
({
|
|
41
|
+
...FetchRuleOf.fields,
|
|
42
|
+
...FetchRequest.fields
|
|
43
|
+
}), Schema.Literal("git");
|
|
44
|
+
const FetchRawTarget = /* @__PURE__ */ Schema.Struct({
|
|
45
|
+
kind: Schema.Literal("raw"),
|
|
46
|
+
oid: Oid
|
|
47
|
+
});
|
|
48
|
+
const FetchArchiveTarget = /* @__PURE__ */ Schema.Struct({
|
|
49
|
+
kind: Schema.Literal("archive"),
|
|
50
|
+
oid: Oid
|
|
51
|
+
});
|
|
52
|
+
const FetchLfsTarget = /* @__PURE__ */ Schema.Struct({
|
|
53
|
+
kind: Schema.Literal("lfs"),
|
|
54
|
+
oid: Schema.String,
|
|
55
|
+
size: Schema.Number
|
|
56
|
+
});
|
|
57
|
+
/**
|
|
58
|
+
* Bytes read outside Git's protocol, once Git found them visible to the caller: a blob's raw
|
|
59
|
+
* bytes, an archive of a commit, checked as it's linked and again as it's downloaded, or a Git
|
|
60
|
+
* LFS object, by its SHA-256 and size. A hidden or missing object never reaches a rule.
|
|
61
|
+
*/
|
|
62
|
+
const FetchReadTarget = /* @__PURE__ */ Schema.Union([
|
|
63
|
+
FetchRawTarget,
|
|
64
|
+
FetchArchiveTarget,
|
|
65
|
+
FetchLfsTarget
|
|
66
|
+
]);
|
|
67
|
+
const readRuleOf = {
|
|
68
|
+
...FetchRuleOf.fields,
|
|
69
|
+
request: Schema.optionalKey(RequestValue)
|
|
70
|
+
};
|
|
71
|
+
Schema.Struct({
|
|
72
|
+
...readRuleOf,
|
|
73
|
+
...FetchRawTarget.fields
|
|
74
|
+
}), Schema.Struct({
|
|
75
|
+
...readRuleOf,
|
|
76
|
+
...FetchArchiveTarget.fields
|
|
77
|
+
}), Schema.Struct({
|
|
78
|
+
...readRuleOf,
|
|
79
|
+
...FetchLfsTarget.fields
|
|
80
|
+
});
|
|
81
|
+
Schema.optional(RequestValue);
|
|
4
82
|
/** A depth a fetch rule sets: a whole number above 0. */
|
|
5
83
|
const RuledDepth = /* @__PURE__ */ Schema.Int.check(Schema.isGreaterThan(0));
|
|
6
|
-
|
|
84
|
+
/** A depth is all a fetch rule may set: a client that asked for no filter is never given one. */
|
|
85
|
+
const FetchAdjustment = /* @__PURE__ */ Schema.Struct({ depth: Schema.optionalKey(RuledDepth) });
|
|
7
86
|
/**
|
|
8
87
|
* The host's push and fetch rules. Core reads it with `Effect.serviceOption` where it reads the
|
|
9
88
|
* rules, after its own checks: a server with none runs none. Only core reads it, so it has no
|
|
10
89
|
* accessors, as `Policy` has none.
|
|
11
90
|
*/
|
|
12
91
|
var Rules = class extends (/* @__PURE__ */ Context.Service()("@ref0/git/Rules")) {};
|
|
13
|
-
export { RuledDepth, Rules };
|
|
92
|
+
export { FetchAdjustment, FetchReadTarget, PushFacts, RuledDepth, Rules, pushContextWith };
|
|
@@ -7,7 +7,6 @@ import { CommitCalls, Commits } from "./commits.mjs";
|
|
|
7
7
|
import { Events } from "./events.mjs";
|
|
8
8
|
import { FileCalls, Files } from "./files.mjs";
|
|
9
9
|
import { ForkCalls, Forks } from "./forks.mjs";
|
|
10
|
-
import { RepoName } from "./ids.mjs";
|
|
11
10
|
import { LfsCalls, LfsFeature } from "./lfs.mjs";
|
|
12
11
|
import { MergeCalls } from "./merges.mjs";
|
|
13
12
|
import { EffectiveLimits, IndexedObjectsFactory, ObjectsFactory } from "./objects.mjs";
|
|
@@ -18,14 +17,13 @@ import { RepoCalls, Repos } from "./repos.mjs";
|
|
|
18
17
|
import { RepoRecords } from "./repo-records.mjs";
|
|
19
18
|
import { TagCalls, Tags } from "./tags.mjs";
|
|
20
19
|
import { TreeCalls, Trees } from "./trees.mjs";
|
|
21
|
-
import {
|
|
20
|
+
import { GitError, Result } from "./result.mjs";
|
|
22
21
|
import { FetchRule, PushRule, Rules } from "./rules.mjs";
|
|
23
22
|
import { SignInLayerOptions } from "./signin.mjs";
|
|
24
23
|
import { TokenCalls, TokensFeature } from "./tokens.mjs";
|
|
25
24
|
import { Work, WorkCalls } from "./work.mjs";
|
|
26
25
|
import { TopicCalls, TopicsFactory } from "./topics.mjs";
|
|
27
26
|
import * as Effect from "effect/Effect";
|
|
28
|
-
import * as Schema from "effect/Schema";
|
|
29
27
|
import { Bucket, CallLimits, JobQueue, Records } from "@ref0/infra";
|
|
30
28
|
import * as Layer from "effect/Layer";
|
|
31
29
|
import * as ManagedRuntime from "effect/ManagedRuntime";
|
|
@@ -44,273 +42,6 @@ export type GitNeeds = Records.Records | JobQueue.JobQueue | CallLimits.CallLimi
|
|
|
44
42
|
export type GitAdapter = Layer.Layer<never, Error> | readonly Layer.Layer<never, Error>[];
|
|
45
43
|
/** What `adapter` gives. */
|
|
46
44
|
export type ProvidedBy<A extends GitAdapter> = A extends readonly (infer L extends Layer.Any)[] ? Layer.Success<L> : A extends Layer.Any ? Layer.Success<A> : never;
|
|
47
|
-
export declare const ResolveInput: Schema.Struct<{
|
|
48
|
-
readonly actor: Schema.Union<readonly [Schema.Struct<{
|
|
49
|
-
readonly id: Schema.String;
|
|
50
|
-
readonly anonymous: Schema.optionalKey<Schema.Literal<false>>;
|
|
51
|
-
readonly meta: Schema.optionalKey<Schema.Unknown>;
|
|
52
|
-
}>, Schema.Struct<{
|
|
53
|
-
readonly anonymous: Schema.Literal<true>;
|
|
54
|
-
readonly meta: Schema.optionalKey<Schema.Unknown>;
|
|
55
|
-
}>]>;
|
|
56
|
-
readonly url: Schema.declare<URL, URL>;
|
|
57
|
-
readonly path: Schema.String;
|
|
58
|
-
readonly signal: Schema.declare<AbortSignal, AbortSignal>;
|
|
59
|
-
}>;
|
|
60
|
-
export type ResolveInput = typeof ResolveInput.Type;
|
|
61
|
-
/** Names the repo an HTTP request means, after identification. Direct calls name it already. */
|
|
62
|
-
export type Resolve = (input: ResolveInput) => Awaitable<RepoName | undefined>;
|
|
63
|
-
export declare const HostFunctionFailure: Schema.Struct<{
|
|
64
|
-
/** Also returned to the caller, in the error's context. */
|
|
65
|
-
readonly id: Schema.String;
|
|
66
|
-
readonly function: Schema.Literals<readonly ["auth", "authorize", "approvalPage", "grants", "rules.push", "rules.fetch", "hooks", "resolve", "join", "queue.merge", "queue.lanes", "queue.bisect", "queue.schedule", "topics.prepare", "topics.required"]>;
|
|
67
|
-
readonly timedOut: Schema.Boolean;
|
|
68
|
-
readonly repo: Schema.optionalKey<Schema.String>;
|
|
69
|
-
readonly operation: Schema.optionalKey<Schema.Union<readonly [Schema.Struct<{
|
|
70
|
-
readonly kind: Schema.Literals<readonly ["fetch", "read", "object.create", "repo.create", "repo.update", "repo.delete"]>;
|
|
71
|
-
readonly repo: Schema.String;
|
|
72
|
-
}>, Schema.Struct<{
|
|
73
|
-
readonly kind: Schema.Literal<"push">;
|
|
74
|
-
readonly repo: Schema.String;
|
|
75
|
-
readonly updates: Schema.$Array<Schema.Struct<{
|
|
76
|
-
readonly ref: Schema.String;
|
|
77
|
-
readonly from: Schema.NullOr<Schema.String>;
|
|
78
|
-
readonly to: Schema.NullOr<Schema.String>;
|
|
79
|
-
}>>;
|
|
80
|
-
}>, Schema.Struct<{
|
|
81
|
-
readonly kind: Schema.Literal<"files.allow">;
|
|
82
|
-
readonly repo: Schema.String;
|
|
83
|
-
readonly ref: Schema.String;
|
|
84
|
-
readonly paths: Schema.$Array<Schema.String>;
|
|
85
|
-
}>, Schema.Struct<{
|
|
86
|
-
readonly kind: Schema.Literals<readonly ["protect.bypass", "lock.bypass"]>;
|
|
87
|
-
readonly repo: Schema.String;
|
|
88
|
-
readonly ref: Schema.String;
|
|
89
|
-
readonly move: Schema.Literals<readonly ["fast-forward", "force", "delete"]>;
|
|
90
|
-
readonly source: Schema.Literals<readonly ["git", "api", "queue", "import"]>;
|
|
91
|
-
}>, Schema.Struct<{
|
|
92
|
-
readonly kind: Schema.Literal<"repo.list">;
|
|
93
|
-
readonly prefix: Schema.optionalKey<Schema.String>;
|
|
94
|
-
}>, Schema.Struct<{
|
|
95
|
-
readonly kind: Schema.Literals<readonly ["fork.create", "fork.sync"]>;
|
|
96
|
-
readonly repo: Schema.String;
|
|
97
|
-
readonly holder: Schema.String;
|
|
98
|
-
}>, Schema.Union<readonly [Schema.Union<readonly [Schema.Struct<{
|
|
99
|
-
readonly repo: Schema.String;
|
|
100
|
-
readonly prefix: Schema.optionalKey<Schema.Never>;
|
|
101
|
-
readonly subject: Schema.Struct<{
|
|
102
|
-
readonly id: Schema.String;
|
|
103
|
-
}>;
|
|
104
|
-
readonly actor: Schema.optionalKey<Schema.Struct<{
|
|
105
|
-
readonly id: Schema.String;
|
|
106
|
-
}>>;
|
|
107
|
-
readonly kind: Schema.Literal<"token.create">;
|
|
108
|
-
}>, Schema.Struct<{
|
|
109
|
-
readonly prefix: Schema.String;
|
|
110
|
-
readonly repo: Schema.optionalKey<Schema.Never>;
|
|
111
|
-
readonly subject: Schema.Struct<{
|
|
112
|
-
readonly id: Schema.String;
|
|
113
|
-
}>;
|
|
114
|
-
readonly actor: Schema.optionalKey<Schema.Struct<{
|
|
115
|
-
readonly id: Schema.String;
|
|
116
|
-
}>>;
|
|
117
|
-
readonly kind: Schema.Literal<"token.create">;
|
|
118
|
-
}>]>, Schema.Union<readonly [Schema.Struct<{
|
|
119
|
-
readonly repo: Schema.String;
|
|
120
|
-
readonly prefix: Schema.optionalKey<Schema.Never>;
|
|
121
|
-
readonly kind: Schema.Literal<"token.revoke">;
|
|
122
|
-
readonly subject: Schema.Struct<{
|
|
123
|
-
readonly id: Schema.String;
|
|
124
|
-
}>;
|
|
125
|
-
}>, Schema.Struct<{
|
|
126
|
-
readonly prefix: Schema.String;
|
|
127
|
-
readonly repo: Schema.optionalKey<Schema.Never>;
|
|
128
|
-
readonly kind: Schema.Literal<"token.revoke">;
|
|
129
|
-
readonly subject: Schema.Struct<{
|
|
130
|
-
readonly id: Schema.String;
|
|
131
|
-
}>;
|
|
132
|
-
}>]>, Schema.Struct<{
|
|
133
|
-
readonly repo: Schema.String;
|
|
134
|
-
readonly prefix: Schema.optionalKey<Schema.Never>;
|
|
135
|
-
readonly kind: Schema.Literal<"token.list">;
|
|
136
|
-
}>, Schema.Struct<{
|
|
137
|
-
readonly prefix: Schema.String;
|
|
138
|
-
readonly repo: Schema.optionalKey<Schema.Never>;
|
|
139
|
-
readonly kind: Schema.Literal<"token.list">;
|
|
140
|
-
}>]>, Schema.Struct<{
|
|
141
|
-
readonly kind: Schema.Literal<"queue.add">;
|
|
142
|
-
readonly repo: Schema.String;
|
|
143
|
-
readonly entry: Schema.Struct<{
|
|
144
|
-
readonly target: Schema.String;
|
|
145
|
-
readonly source: Schema.String;
|
|
146
|
-
readonly head: Schema.String;
|
|
147
|
-
readonly key: Schema.String;
|
|
148
|
-
readonly priority: Schema.optionalKey<Schema.Number>;
|
|
149
|
-
readonly meta: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
150
|
-
}>;
|
|
151
|
-
}>, Schema.Struct<{
|
|
152
|
-
readonly kind: Schema.Literals<readonly ["queue.hold", "queue.restart"]>;
|
|
153
|
-
readonly repo: Schema.String;
|
|
154
|
-
readonly target: Schema.String;
|
|
155
|
-
readonly entry: Schema.optionalKey<Schema.String>;
|
|
156
|
-
}>, Schema.Struct<{
|
|
157
|
-
readonly kind: Schema.Literal<"queue.remove">;
|
|
158
|
-
readonly repo: Schema.String;
|
|
159
|
-
readonly entry: Schema.String;
|
|
160
|
-
}>, Schema.Struct<{
|
|
161
|
-
readonly kind: Schema.Literals<readonly ["queue.report", "queue.retry"]>;
|
|
162
|
-
readonly repo: Schema.String;
|
|
163
|
-
readonly candidate: Schema.String;
|
|
164
|
-
}>, Schema.Struct<{
|
|
165
|
-
readonly kind: Schema.Literal<"queue.release">;
|
|
166
|
-
readonly repo: Schema.String;
|
|
167
|
-
readonly hold: Schema.String;
|
|
168
|
-
}>, Schema.Struct<{
|
|
169
|
-
readonly kind: Schema.Literals<readonly ["topic.add", "topic.remove", "topic.report", "topic.read"]>;
|
|
170
|
-
readonly topic: Schema.optionalKey<Schema.String>;
|
|
171
|
-
}>, Schema.Struct<{
|
|
172
|
-
readonly kind: Schema.Literals<readonly ["work.list", "work.retry", "work.discard"]>;
|
|
173
|
-
readonly repo: Schema.String;
|
|
174
|
-
readonly name: Schema.optionalKey<Schema.String>;
|
|
175
|
-
readonly key: Schema.optionalKey<Schema.String>;
|
|
176
|
-
}>, Schema.Struct<{
|
|
177
|
-
readonly kind: Schema.Literal<"refs.private">;
|
|
178
|
-
readonly repo: Schema.String;
|
|
179
|
-
readonly patterns: Schema.$Array<Schema.String>;
|
|
180
|
-
}>, Schema.Struct<{
|
|
181
|
-
readonly kind: Schema.Literal<"me">;
|
|
182
|
-
}>]>>;
|
|
183
|
-
}>;
|
|
184
|
-
export type HostFunctionFailure = typeof HostFunctionFailure.Type;
|
|
185
|
-
export declare const Refusal: Schema.Struct<{
|
|
186
|
-
readonly code: Schema.Literals<readonly ("ALREADY_EXISTS" | "DATA_LOSS" | "DEADLINE_EXCEEDED" | "FAILED_PRECONDITION" | "INTERNAL" | "INVALID_ARGUMENT" | "NOT_ALLOWED" | "NOT_FOUND" | "RESOURCE_EXHAUSTED" | "UNAUTHENTICATED" | "UNAVAILABLE")[]>;
|
|
187
|
-
readonly message: Schema.String;
|
|
188
|
-
readonly function: Schema.optionalKey<Schema.Literals<readonly ["auth", "authorize", "approvalPage", "grants", "rules.push", "rules.fetch", "hooks", "resolve", "join", "queue.merge", "queue.lanes", "queue.bisect", "queue.schedule", "topics.prepare", "topics.required"]>>;
|
|
189
|
-
readonly repo: Schema.optionalKey<Schema.String>;
|
|
190
|
-
readonly operation: Schema.optionalKey<Schema.Union<readonly [Schema.Struct<{
|
|
191
|
-
readonly kind: Schema.Literals<readonly ["fetch", "read", "object.create", "repo.create", "repo.update", "repo.delete"]>;
|
|
192
|
-
readonly repo: Schema.String;
|
|
193
|
-
}>, Schema.Struct<{
|
|
194
|
-
readonly kind: Schema.Literal<"push">;
|
|
195
|
-
readonly repo: Schema.String;
|
|
196
|
-
readonly updates: Schema.$Array<Schema.Struct<{
|
|
197
|
-
readonly ref: Schema.String;
|
|
198
|
-
readonly from: Schema.NullOr<Schema.String>;
|
|
199
|
-
readonly to: Schema.NullOr<Schema.String>;
|
|
200
|
-
}>>;
|
|
201
|
-
}>, Schema.Struct<{
|
|
202
|
-
readonly kind: Schema.Literal<"files.allow">;
|
|
203
|
-
readonly repo: Schema.String;
|
|
204
|
-
readonly ref: Schema.String;
|
|
205
|
-
readonly paths: Schema.$Array<Schema.String>;
|
|
206
|
-
}>, Schema.Struct<{
|
|
207
|
-
readonly kind: Schema.Literals<readonly ["protect.bypass", "lock.bypass"]>;
|
|
208
|
-
readonly repo: Schema.String;
|
|
209
|
-
readonly ref: Schema.String;
|
|
210
|
-
readonly move: Schema.Literals<readonly ["fast-forward", "force", "delete"]>;
|
|
211
|
-
readonly source: Schema.Literals<readonly ["git", "api", "queue", "import"]>;
|
|
212
|
-
}>, Schema.Struct<{
|
|
213
|
-
readonly kind: Schema.Literal<"repo.list">;
|
|
214
|
-
readonly prefix: Schema.optionalKey<Schema.String>;
|
|
215
|
-
}>, Schema.Struct<{
|
|
216
|
-
readonly kind: Schema.Literals<readonly ["fork.create", "fork.sync"]>;
|
|
217
|
-
readonly repo: Schema.String;
|
|
218
|
-
readonly holder: Schema.String;
|
|
219
|
-
}>, Schema.Union<readonly [Schema.Union<readonly [Schema.Struct<{
|
|
220
|
-
readonly repo: Schema.String;
|
|
221
|
-
readonly prefix: Schema.optionalKey<Schema.Never>;
|
|
222
|
-
readonly subject: Schema.Struct<{
|
|
223
|
-
readonly id: Schema.String;
|
|
224
|
-
}>;
|
|
225
|
-
readonly actor: Schema.optionalKey<Schema.Struct<{
|
|
226
|
-
readonly id: Schema.String;
|
|
227
|
-
}>>;
|
|
228
|
-
readonly kind: Schema.Literal<"token.create">;
|
|
229
|
-
}>, Schema.Struct<{
|
|
230
|
-
readonly prefix: Schema.String;
|
|
231
|
-
readonly repo: Schema.optionalKey<Schema.Never>;
|
|
232
|
-
readonly subject: Schema.Struct<{
|
|
233
|
-
readonly id: Schema.String;
|
|
234
|
-
}>;
|
|
235
|
-
readonly actor: Schema.optionalKey<Schema.Struct<{
|
|
236
|
-
readonly id: Schema.String;
|
|
237
|
-
}>>;
|
|
238
|
-
readonly kind: Schema.Literal<"token.create">;
|
|
239
|
-
}>]>, Schema.Union<readonly [Schema.Struct<{
|
|
240
|
-
readonly repo: Schema.String;
|
|
241
|
-
readonly prefix: Schema.optionalKey<Schema.Never>;
|
|
242
|
-
readonly kind: Schema.Literal<"token.revoke">;
|
|
243
|
-
readonly subject: Schema.Struct<{
|
|
244
|
-
readonly id: Schema.String;
|
|
245
|
-
}>;
|
|
246
|
-
}>, Schema.Struct<{
|
|
247
|
-
readonly prefix: Schema.String;
|
|
248
|
-
readonly repo: Schema.optionalKey<Schema.Never>;
|
|
249
|
-
readonly kind: Schema.Literal<"token.revoke">;
|
|
250
|
-
readonly subject: Schema.Struct<{
|
|
251
|
-
readonly id: Schema.String;
|
|
252
|
-
}>;
|
|
253
|
-
}>]>, Schema.Struct<{
|
|
254
|
-
readonly repo: Schema.String;
|
|
255
|
-
readonly prefix: Schema.optionalKey<Schema.Never>;
|
|
256
|
-
readonly kind: Schema.Literal<"token.list">;
|
|
257
|
-
}>, Schema.Struct<{
|
|
258
|
-
readonly prefix: Schema.String;
|
|
259
|
-
readonly repo: Schema.optionalKey<Schema.Never>;
|
|
260
|
-
readonly kind: Schema.Literal<"token.list">;
|
|
261
|
-
}>]>, Schema.Struct<{
|
|
262
|
-
readonly kind: Schema.Literal<"queue.add">;
|
|
263
|
-
readonly repo: Schema.String;
|
|
264
|
-
readonly entry: Schema.Struct<{
|
|
265
|
-
readonly target: Schema.String;
|
|
266
|
-
readonly source: Schema.String;
|
|
267
|
-
readonly head: Schema.String;
|
|
268
|
-
readonly key: Schema.String;
|
|
269
|
-
readonly priority: Schema.optionalKey<Schema.Number>;
|
|
270
|
-
readonly meta: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
271
|
-
}>;
|
|
272
|
-
}>, Schema.Struct<{
|
|
273
|
-
readonly kind: Schema.Literals<readonly ["queue.hold", "queue.restart"]>;
|
|
274
|
-
readonly repo: Schema.String;
|
|
275
|
-
readonly target: Schema.String;
|
|
276
|
-
readonly entry: Schema.optionalKey<Schema.String>;
|
|
277
|
-
}>, Schema.Struct<{
|
|
278
|
-
readonly kind: Schema.Literal<"queue.remove">;
|
|
279
|
-
readonly repo: Schema.String;
|
|
280
|
-
readonly entry: Schema.String;
|
|
281
|
-
}>, Schema.Struct<{
|
|
282
|
-
readonly kind: Schema.Literals<readonly ["queue.report", "queue.retry"]>;
|
|
283
|
-
readonly repo: Schema.String;
|
|
284
|
-
readonly candidate: Schema.String;
|
|
285
|
-
}>, Schema.Struct<{
|
|
286
|
-
readonly kind: Schema.Literal<"queue.release">;
|
|
287
|
-
readonly repo: Schema.String;
|
|
288
|
-
readonly hold: Schema.String;
|
|
289
|
-
}>, Schema.Struct<{
|
|
290
|
-
readonly kind: Schema.Literals<readonly ["topic.add", "topic.remove", "topic.report", "topic.read"]>;
|
|
291
|
-
readonly topic: Schema.optionalKey<Schema.String>;
|
|
292
|
-
}>, Schema.Struct<{
|
|
293
|
-
readonly kind: Schema.Literals<readonly ["work.list", "work.retry", "work.discard"]>;
|
|
294
|
-
readonly repo: Schema.String;
|
|
295
|
-
readonly name: Schema.optionalKey<Schema.String>;
|
|
296
|
-
readonly key: Schema.optionalKey<Schema.String>;
|
|
297
|
-
}>, Schema.Struct<{
|
|
298
|
-
readonly kind: Schema.Literal<"refs.private">;
|
|
299
|
-
readonly repo: Schema.String;
|
|
300
|
-
readonly patterns: Schema.$Array<Schema.String>;
|
|
301
|
-
}>, Schema.Struct<{
|
|
302
|
-
readonly kind: Schema.Literal<"me">;
|
|
303
|
-
}>]>>;
|
|
304
|
-
readonly actor: Schema.optionalKey<Schema.Union<readonly [Schema.Struct<{
|
|
305
|
-
readonly id: Schema.String;
|
|
306
|
-
readonly anonymous: Schema.optionalKey<Schema.Literal<false>>;
|
|
307
|
-
readonly meta: Schema.optionalKey<Schema.Unknown>;
|
|
308
|
-
}>, Schema.Struct<{
|
|
309
|
-
readonly anonymous: Schema.Literal<true>;
|
|
310
|
-
readonly meta: Schema.optionalKey<Schema.Unknown>;
|
|
311
|
-
}>]>>;
|
|
312
|
-
}>;
|
|
313
|
-
export type Refusal = typeof Refusal.Type;
|
|
314
45
|
/** Each piece adds its own options: C's are these. */
|
|
315
46
|
export interface GitServerOptions<A extends GitAdapter = GitAdapter> {
|
|
316
47
|
readonly adapter: A;
|
|
@@ -351,14 +82,13 @@ export interface GitServerOptions<A extends GitAdapter = GitAdapter> {
|
|
|
351
82
|
*/
|
|
352
83
|
readonly rules?: readonly (PushRule | FetchRule | Effect.Effect<PushRule | FetchRule, GitError>)[];
|
|
353
84
|
readonly basePath?: string;
|
|
354
|
-
readonly resolve?: Resolve;
|
|
355
|
-
readonly onError?: (cause: unknown, failed: HostFunctionFailure) => void;
|
|
356
|
-
readonly onRefused?: (refusal: Refusal) => void;
|
|
357
85
|
/**
|
|
358
86
|
* The most one fetch may send and how long it may stream: Git's HTTP limits each fetch by them,
|
|
359
87
|
* and a fetch whose own `limits` pass them is refused. A deleted repo's packs stay readable for
|
|
360
|
-
* their time, so no clone is cut by clean-up. By default 2,000,000 objects, 4 GiB and an hour
|
|
361
|
-
*
|
|
88
|
+
* their time, so no clone is cut by clean-up. By default 2,000,000 objects, 4 GiB and an hour,
|
|
89
|
+
* which streams about 3.6 GB at 1 MB/s. The time guards every reader of a pack: a request's
|
|
90
|
+
* fetch, and the jobs and forks that read under their own leases, which a platform's request cap
|
|
91
|
+
* doesn't bound. A host may lower it as far as `pruneFloor`, an hour, never below.
|
|
362
92
|
*/
|
|
363
93
|
readonly fetchLimits?: EffectiveLimits;
|
|
364
94
|
/** A large push's pack straight to the bucket: off unless set, and a bucket that signs parts. */
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Caller } from "./actors.mjs";
|
|
2
|
-
import { GitClient as GitClient$1 } from "./client.mjs";
|
|
3
2
|
import { GitError, Result } from "./result.mjs";
|
|
4
3
|
import { GitStore as GitStore$1 } from "./store.mjs";
|
|
5
4
|
import * as Effect from "effect/Effect";
|
|
@@ -15,7 +14,5 @@ export type EffectCalls<T, R = never> = { readonly [K in keyof T]: NonNullable<T
|
|
|
15
14
|
* direct calls do. A call module's service holds these, and its accessors pass `by` on.
|
|
16
15
|
*/
|
|
17
16
|
export type ByCalls<T, R = never> = EffectCalls<{ readonly [K in keyof T]: T[K] extends ((...args: infer Args) => infer Answer) ? (...args: [...Args, by?: Caller]) => Answer : never; }, R>;
|
|
18
|
-
/** A client of one remote, as `effectGitClient` makes it. */
|
|
19
|
-
export declare const GitClient: Context.Service<EffectCalls<GitClient$1, never>, EffectCalls<GitClient$1, never>>;
|
|
20
17
|
export declare const GitStore: Context.Service<EffectCalls<GitStore$1, never>, EffectCalls<GitStore$1, never>>;
|
|
21
18
|
export declare const GitCaller: Context.Service<Caller<unknown>, Caller<unknown>>;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import * as Context from "effect/Context";
|
|
2
2
|
// src/contracts/services.ts
|
|
3
|
-
/** A client of one remote, as `effectGitClient` makes it. */
|
|
4
|
-
const GitClient = /* @__PURE__ */ Context.Service("@ref0/git/GitClient");
|
|
5
3
|
const GitStore = /* @__PURE__ */ Context.Service("@ref0/git/GitStore");
|
|
6
4
|
const GitCaller = /* @__PURE__ */ Context.Service("@ref0/git/GitCaller");
|
|
7
|
-
export { GitCaller,
|
|
5
|
+
export { GitCaller, GitStore };
|
|
@@ -131,7 +131,7 @@ export declare const ConfirmApprovalPage: Schema.Struct<{
|
|
|
131
131
|
/** Where the browser goes with the code once approved. */
|
|
132
132
|
readonly redirectUri: Schema.String;
|
|
133
133
|
}>]>;
|
|
134
|
-
readonly decide: Schema.declare<(decision: ApprovalDecision) => Effect.Effect<Response, GitError>,
|
|
134
|
+
readonly decide: Schema.declare<(decision: ApprovalDecision) => Effect.Effect<Response, GitError>, (decision: ApprovalDecision) => Effect.Effect<Response, GitError>>;
|
|
135
135
|
}>;
|
|
136
136
|
export type ConfirmApprovalPage = typeof ConfirmApprovalPage.Type;
|
|
137
137
|
export declare const ApprovalPageInput: Schema.Union<readonly [Schema.Struct<{
|
|
@@ -165,7 +165,7 @@ export declare const ApprovalPageInput: Schema.Union<readonly [Schema.Struct<{
|
|
|
165
165
|
/** Where the browser goes with the code once approved. */
|
|
166
166
|
readonly redirectUri: Schema.String;
|
|
167
167
|
}>]>;
|
|
168
|
-
readonly decide: Schema.declare<(decision: ApprovalDecision) => Effect.Effect<Response, GitError>,
|
|
168
|
+
readonly decide: Schema.declare<(decision: ApprovalDecision) => Effect.Effect<Response, GitError>, (decision: ApprovalDecision) => Effect.Effect<Response, GitError>>;
|
|
169
169
|
}>]>;
|
|
170
170
|
export type ApprovalPageInput = typeof ApprovalPageInput.Type;
|
|
171
171
|
/** The person's token, for the repo or prefix, scope and expiry the host chose. */
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import "./actors.mjs";
|
|
2
2
|
import { RepoName } from "./ids.mjs";
|
|
3
|
-
import { AbortSignalValue, RequestValue } from "./opaque.mjs";
|
|
3
|
+
import { AbortSignalValue, FunctionValue, RequestValue } from "./opaque.mjs";
|
|
4
4
|
import { Moment } from "./repos.mjs";
|
|
5
|
-
import {
|
|
5
|
+
import { grantScopes } from "./tokens.mjs";
|
|
6
6
|
import * as Schema from "effect/Schema";
|
|
7
|
-
import * as Predicate from "effect/Predicate";
|
|
8
7
|
// src/contracts/signin.ts
|
|
9
8
|
/**
|
|
10
9
|
* The GitHub scope a device asks for so its token can push, as gh does: Git's refusal of a push
|
|
@@ -43,8 +42,8 @@ const ApprovalPageContext = /* @__PURE__ */ Schema.Struct({
|
|
|
43
42
|
signal: AbortSignalValue
|
|
44
43
|
});
|
|
45
44
|
({ ...ApprovalPageContext.fields }), Schema.Literal("enter-code"), Schema.Literal("/login/device"), Schema.optionalKey(Schema.Literals(["invalid-code", "expired-code"]));
|
|
46
|
-
({ ...ApprovalPageContext.fields }), Schema.Literal("confirm"),
|
|
47
|
-
Schema.Literal("approve"), Schema.Union([RepoName, Schema.Struct({ prefix: Schema.String })]), Schema.Literals(
|
|
45
|
+
({ ...ApprovalPageContext.fields }), Schema.Literal("confirm"), FunctionValue();
|
|
46
|
+
Schema.Literal("approve"), Schema.Union([RepoName, Schema.Struct({ prefix: Schema.String })]), Schema.Literals(grantScopes), Schema.Union([Moment, Schema.Date]);
|
|
48
47
|
Schema.Literal("deny");
|
|
49
48
|
Schema.String, Schema.String, Schema.String, Schema.Number, Schema.Number;
|
|
50
49
|
Schema.String, Schema.Literal("bearer"), Schema.String;
|
|
@@ -19,7 +19,7 @@ export declare const SyncRemote: Schema.Struct<{
|
|
|
19
19
|
readonly password: Schema.String;
|
|
20
20
|
}>, Schema.Struct<{
|
|
21
21
|
readonly token: Schema.String;
|
|
22
|
-
}>]>, Schema.declare<(input: CredentialInput) => Awaitable<ClientCredential>,
|
|
22
|
+
}>]>, Schema.declare<(input: CredentialInput) => Awaitable<ClientCredential>, (input: CredentialInput) => Awaitable<ClientCredential>>]>>;
|
|
23
23
|
readonly transport: Schema.optionalKey<Schema.declare<(request: Request) => Promise<Response>, (request: Request) => Promise<Response>>>;
|
|
24
24
|
}>;
|
|
25
25
|
export type SyncRemote = typeof SyncRemote.Type;
|
|
@@ -222,9 +222,6 @@ export declare const importRepo: (input: SyncImportInput) => Effect.Effect<{
|
|
|
222
222
|
readonly packs?: number;
|
|
223
223
|
readonly packBytes?: number;
|
|
224
224
|
readonly ownBytes?: number;
|
|
225
|
-
readonly looseObjects?: number;
|
|
226
|
-
readonly looseBytes?: number;
|
|
227
|
-
readonly leavingBytes?: number;
|
|
228
225
|
readonly pushedAt?: number;
|
|
229
226
|
readonly maintainedAt?: number;
|
|
230
227
|
};
|
|
@@ -7,9 +7,21 @@ import { Listing } from "@ref0/infra";
|
|
|
7
7
|
import * as Context from "effect/Context";
|
|
8
8
|
export declare const TokenId: Schema.String;
|
|
9
9
|
export type TokenId = typeof TokenId.Type;
|
|
10
|
-
/**
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
/**
|
|
11
|
+
* The scopes a grant may hold, a sign-in's or an extension's, and what Git's ceiling on a repo
|
|
12
|
+
* answers: `read`, then `report`, then `write`.
|
|
13
|
+
*/
|
|
14
|
+
export declare const grantScopes: readonly ['read', 'report', 'write'];
|
|
15
|
+
export declare const GrantScope: Schema.Literals<readonly ["read", "report", "write"]>;
|
|
16
|
+
export type GrantScope = typeof GrantScope.Type;
|
|
17
|
+
/**
|
|
18
|
+
* Each scope a token can have, a ceiling `authorize` can narrow: the grant scopes, then `admin`.
|
|
19
|
+
* An `admin` token reaches every operation kind, as a host's own sign-in does, and covers only
|
|
20
|
+
* the whole host, `{ prefix: '' }`. Its ceiling never opens past the host's `Policy`: a policy
|
|
21
|
+
* that doesn't accept `admin` refuses it, as `Policy.signedIn` does.
|
|
22
|
+
*/
|
|
23
|
+
export declare const tokenScopes: readonly ["read", "report", "write", "admin"];
|
|
24
|
+
export declare const TokenScope: Schema.Literals<readonly ["read", "report", "write", "admin"]>;
|
|
13
25
|
export type TokenScope = typeof TokenScope.Type;
|
|
14
26
|
/** One repo, or every repo whose ID starts with `prefix`, which ends in `/` or is empty. */
|
|
15
27
|
export declare const TokenCoverage: Schema.Union<readonly [Schema.Struct<{
|
|
@@ -26,7 +38,7 @@ export type TokenCoverage = typeof TokenCoverage.Type;
|
|
|
26
38
|
*/
|
|
27
39
|
export declare const TokenFields: Schema.Struct<{
|
|
28
40
|
readonly id: Schema.String;
|
|
29
|
-
readonly scope: Schema.Literals<readonly ["read", "report", "write"]>;
|
|
41
|
+
readonly scope: Schema.Literals<readonly ["read", "report", "write", "admin"]>;
|
|
30
42
|
readonly expiresAt: Schema.Number;
|
|
31
43
|
readonly createdAt: Schema.Number;
|
|
32
44
|
}>;
|
|
@@ -36,14 +48,14 @@ export declare const TokenInfo: Schema.Union<readonly [Schema.Struct<{
|
|
|
36
48
|
readonly repo: Schema.String;
|
|
37
49
|
readonly prefix: Schema.optionalKey<Schema.Never>;
|
|
38
50
|
readonly id: Schema.String;
|
|
39
|
-
readonly scope: Schema.Literals<readonly ["read", "report", "write"]>;
|
|
51
|
+
readonly scope: Schema.Literals<readonly ["read", "report", "write", "admin"]>;
|
|
40
52
|
readonly expiresAt: Schema.Number;
|
|
41
53
|
readonly createdAt: Schema.Number;
|
|
42
54
|
}>, Schema.Struct<{
|
|
43
55
|
readonly prefix: Schema.String;
|
|
44
56
|
readonly repo: Schema.optionalKey<Schema.Never>;
|
|
45
57
|
readonly id: Schema.String;
|
|
46
|
-
readonly scope: Schema.Literals<readonly ["read", "report", "write"]>;
|
|
58
|
+
readonly scope: Schema.Literals<readonly ["read", "report", "write", "admin"]>;
|
|
47
59
|
readonly expiresAt: Schema.Number;
|
|
48
60
|
readonly createdAt: Schema.Number;
|
|
49
61
|
}>]>;
|
|
@@ -52,7 +64,7 @@ export declare const TokenRecord: Schema.Union<readonly [Schema.Struct<{
|
|
|
52
64
|
readonly repo: Schema.String;
|
|
53
65
|
readonly prefix: Schema.optionalKey<Schema.Never>;
|
|
54
66
|
readonly id: Schema.String;
|
|
55
|
-
readonly scope: Schema.Literals<readonly ["read", "report", "write"]>;
|
|
67
|
+
readonly scope: Schema.Literals<readonly ["read", "report", "write", "admin"]>;
|
|
56
68
|
readonly expiresAt: Schema.Number;
|
|
57
69
|
readonly createdAt: Schema.Number;
|
|
58
70
|
readonly subject: Schema.Struct<{
|
|
@@ -66,7 +78,7 @@ export declare const TokenRecord: Schema.Union<readonly [Schema.Struct<{
|
|
|
66
78
|
readonly prefix: Schema.String;
|
|
67
79
|
readonly repo: Schema.optionalKey<Schema.Never>;
|
|
68
80
|
readonly id: Schema.String;
|
|
69
|
-
readonly scope: Schema.Literals<readonly ["read", "report", "write"]>;
|
|
81
|
+
readonly scope: Schema.Literals<readonly ["read", "report", "write", "admin"]>;
|
|
70
82
|
readonly expiresAt: Schema.Number;
|
|
71
83
|
readonly createdAt: Schema.Number;
|
|
72
84
|
readonly subject: Schema.Struct<{
|
|
@@ -83,7 +95,7 @@ export declare const CreatedToken: Schema.Union<readonly [Schema.Struct<{
|
|
|
83
95
|
readonly repo: Schema.String;
|
|
84
96
|
readonly prefix: Schema.optionalKey<Schema.Never>;
|
|
85
97
|
readonly id: Schema.String;
|
|
86
|
-
readonly scope: Schema.Literals<readonly ["read", "report", "write"]>;
|
|
98
|
+
readonly scope: Schema.Literals<readonly ["read", "report", "write", "admin"]>;
|
|
87
99
|
readonly expiresAt: Schema.Number;
|
|
88
100
|
readonly createdAt: Schema.Number;
|
|
89
101
|
readonly subject: Schema.Struct<{
|
|
@@ -98,7 +110,7 @@ export declare const CreatedToken: Schema.Union<readonly [Schema.Struct<{
|
|
|
98
110
|
readonly prefix: Schema.String;
|
|
99
111
|
readonly repo: Schema.optionalKey<Schema.Never>;
|
|
100
112
|
readonly id: Schema.String;
|
|
101
|
-
readonly scope: Schema.Literals<readonly ["read", "report", "write"]>;
|
|
113
|
+
readonly scope: Schema.Literals<readonly ["read", "report", "write", "admin"]>;
|
|
102
114
|
readonly expiresAt: Schema.Number;
|
|
103
115
|
readonly createdAt: Schema.Number;
|
|
104
116
|
readonly subject: Schema.Struct<{
|
|
@@ -121,7 +133,7 @@ export declare const TokenTarget: Schema.Union<readonly [Schema.String, Schema.S
|
|
|
121
133
|
export type TokenTarget = typeof TokenTarget.Type;
|
|
122
134
|
/** `subject` answers for the token; `actor` acts for them, and is left out when it's the same party. */
|
|
123
135
|
export declare const TokenCreate: Schema.Struct<{
|
|
124
|
-
readonly scope: Schema.Literals<readonly ["read", "report", "write"]>;
|
|
136
|
+
readonly scope: Schema.Literals<readonly ["read", "report", "write", "admin"]>;
|
|
125
137
|
readonly expiresAt: Schema.Union<readonly [Schema.Number, Schema.Date]>;
|
|
126
138
|
readonly subject: Schema.Struct<{
|
|
127
139
|
readonly id: Schema.String;
|
|
@@ -197,7 +209,7 @@ export declare const create: (target: TokenTarget, input: TokenCreateInput) => E
|
|
|
197
209
|
readonly repo: string;
|
|
198
210
|
readonly prefix?: never;
|
|
199
211
|
readonly id: string;
|
|
200
|
-
readonly scope: "read" | "report" | "write";
|
|
212
|
+
readonly scope: "admin" | "read" | "report" | "write";
|
|
201
213
|
readonly expiresAt: number;
|
|
202
214
|
readonly createdAt: number;
|
|
203
215
|
readonly subject: {
|
|
@@ -212,7 +224,7 @@ export declare const create: (target: TokenTarget, input: TokenCreateInput) => E
|
|
|
212
224
|
readonly prefix: string;
|
|
213
225
|
readonly repo?: never;
|
|
214
226
|
readonly id: string;
|
|
215
|
-
readonly scope: "read" | "report" | "write";
|
|
227
|
+
readonly scope: "admin" | "read" | "report" | "write";
|
|
216
228
|
readonly expiresAt: number;
|
|
217
229
|
readonly createdAt: number;
|
|
218
230
|
readonly subject: {
|
|
@@ -228,7 +240,7 @@ export declare const list: (target: TokenTarget, input?: TokenListInput) => Effe
|
|
|
228
240
|
readonly repo: string;
|
|
229
241
|
readonly prefix?: never;
|
|
230
242
|
readonly id: string;
|
|
231
|
-
readonly scope: "read" | "report" | "write";
|
|
243
|
+
readonly scope: "admin" | "read" | "report" | "write";
|
|
232
244
|
readonly expiresAt: number;
|
|
233
245
|
readonly createdAt: number;
|
|
234
246
|
readonly subject: {
|
|
@@ -242,7 +254,7 @@ export declare const list: (target: TokenTarget, input?: TokenListInput) => Effe
|
|
|
242
254
|
readonly prefix: string;
|
|
243
255
|
readonly repo?: never;
|
|
244
256
|
readonly id: string;
|
|
245
|
-
readonly scope: "read" | "report" | "write";
|
|
257
|
+
readonly scope: "admin" | "read" | "report" | "write";
|
|
246
258
|
readonly expiresAt: number;
|
|
247
259
|
readonly createdAt: number;
|
|
248
260
|
readonly subject: {
|
|
@@ -257,7 +269,7 @@ export declare const get: (token: TokenId, input?: CallInput) => Effect.Effect<{
|
|
|
257
269
|
readonly repo: string;
|
|
258
270
|
readonly prefix?: never;
|
|
259
271
|
readonly id: string;
|
|
260
|
-
readonly scope: "read" | "report" | "write";
|
|
272
|
+
readonly scope: "admin" | "read" | "report" | "write";
|
|
261
273
|
readonly expiresAt: number;
|
|
262
274
|
readonly createdAt: number;
|
|
263
275
|
readonly subject: {
|
|
@@ -271,7 +283,7 @@ export declare const get: (token: TokenId, input?: CallInput) => Effect.Effect<{
|
|
|
271
283
|
readonly prefix: string;
|
|
272
284
|
readonly repo?: never;
|
|
273
285
|
readonly id: string;
|
|
274
|
-
readonly scope: "read" | "report" | "write";
|
|
286
|
+
readonly scope: "admin" | "read" | "report" | "write";
|
|
275
287
|
readonly expiresAt: number;
|
|
276
288
|
readonly createdAt: number;
|
|
277
289
|
readonly subject: {
|