@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
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Awaitable, GitError } from "./result.mjs";
|
|
2
1
|
import { ActorInput } from "./actors.mjs";
|
|
2
|
+
import { Awaitable, GitError, Result } from "./result.mjs";
|
|
3
|
+
import * as Effect from "effect/Effect";
|
|
3
4
|
import * as Schema from "effect/Schema";
|
|
4
5
|
/** What a client sends as Basic: Git's own credential, such as `x-access-token` and a token. */
|
|
5
6
|
export declare const BasicCredential: Schema.Struct<{
|
|
@@ -28,7 +29,7 @@ export declare const ClientCredentials: Schema.Union<readonly [Schema.Union<read
|
|
|
28
29
|
readonly password: Schema.String;
|
|
29
30
|
}>, Schema.Struct<{
|
|
30
31
|
readonly token: Schema.String;
|
|
31
|
-
}>]>, Schema.declare<(input: CredentialInput) => Awaitable<ClientCredential>,
|
|
32
|
+
}>]>, Schema.declare<(input: CredentialInput) => Awaitable<ClientCredential>, (input: CredentialInput) => Awaitable<ClientCredential>>]>;
|
|
32
33
|
export type ClientCredentials = typeof ClientCredentials.Type;
|
|
33
34
|
/** A request that failed: its status, or `0` when no answer came, and its error when it sent one. */
|
|
34
35
|
export declare const TransportFailure: Schema.Struct<{
|
|
@@ -67,5 +68,13 @@ export interface RemoteOptions {
|
|
|
67
68
|
* either: REST names a repo by its path alone, so a remote couldn't hold a call to one (Q705).
|
|
68
69
|
*/
|
|
69
70
|
export type WithoutActor<Input> = Input extends ActorInput ? Omit<Input, 'actor' | 'internalId'> : Input;
|
|
70
|
-
/** A
|
|
71
|
-
export type
|
|
71
|
+
/** A call's input without `signal`: interrupting the call's fiber stops it. */
|
|
72
|
+
export type WithoutSignal<Input> = Input extends object ? Omit<Input, 'signal'> : Input;
|
|
73
|
+
/** A call's answer as a remote gives it: an Effect that fails with the call's `GitError`. */
|
|
74
|
+
type RemoteAnswer<Answer> = Answer extends Promise<Result<infer A>> ? Effect.Effect<A, GitError> : Answer;
|
|
75
|
+
/**
|
|
76
|
+
* A group of server calls as a remote makes them: each an Effect, its input without `actor` or
|
|
77
|
+
* `signal`.
|
|
78
|
+
*/
|
|
79
|
+
export type RemoteCalls<Calls> = { readonly [Key in keyof Calls]-?: NonNullable<Calls[Key]> extends ((...args: infer Args) => infer Answer) ? (...args: { [Index in keyof Args]: WithoutSignal<WithoutActor<Args[Index]>>; }) => RemoteAnswer<Answer> : RemoteCalls<NonNullable<Calls[Key]>>; };
|
|
80
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { FunctionValue } from "./opaque.mjs";
|
|
1
2
|
import { GitErrorValue } from "./result.mjs";
|
|
2
3
|
import * as Schema from "effect/Schema";
|
|
3
|
-
import * as Predicate from "effect/Predicate";
|
|
4
4
|
// src/contracts/remote.ts
|
|
5
5
|
/** What a client sends as Basic: Git's own credential, such as `x-access-token` and a token. */
|
|
6
6
|
const BasicCredential = /* @__PURE__ */ Schema.Struct({
|
|
@@ -10,9 +10,9 @@ const BasicCredential = /* @__PURE__ */ Schema.Struct({
|
|
|
10
10
|
const BearerCredential = /* @__PURE__ */ Schema.Struct({ token: Schema.String });
|
|
11
11
|
const ClientCredential = /* @__PURE__ */ Schema.Union([BasicCredential, BearerCredential]);
|
|
12
12
|
/** A value, or a function for short-lived credentials: after a 401 it runs once more. */
|
|
13
|
-
const ClientCredentials = /* @__PURE__ */ Schema.Union([ClientCredential,
|
|
13
|
+
const ClientCredentials = /* @__PURE__ */ Schema.Union([ClientCredential, FunctionValue()]);
|
|
14
14
|
/** A request's sender in place of `fetch`, held as itself. */
|
|
15
|
-
const Transport = /* @__PURE__ */
|
|
15
|
+
const Transport = /* @__PURE__ */ FunctionValue();
|
|
16
16
|
/** A request that failed: its status, or `0` when no answer came, and its error when it sent one. */
|
|
17
17
|
const TransportFailure = /* @__PURE__ */ Schema.Struct({
|
|
18
18
|
status: Schema.Int,
|
|
@@ -15,12 +15,19 @@ type Moment$1 = typeof Moment$1.Type;
|
|
|
15
15
|
export declare const RepoStats: Schema.Struct<{
|
|
16
16
|
readonly repo: Schema.String;
|
|
17
17
|
readonly refs: Schema.Number;
|
|
18
|
+
/** The packs the repo lists. */
|
|
18
19
|
readonly packs: Schema.Number;
|
|
20
|
+
/**
|
|
21
|
+
* The bytes of the packs the repo lists, shared with forks or not, and of the pack kept ready for
|
|
22
|
+
* a shallow clone of the default branch, which no list names.
|
|
23
|
+
*/
|
|
19
24
|
readonly packBytes: Schema.Number;
|
|
25
|
+
/**
|
|
26
|
+
* The bytes a quota counts: `packBytes`, and the objects the repo keeps as rows, every object of
|
|
27
|
+
* a `loose()` repo's and a small push's that `packs()` keeps until its next repack, each its row's
|
|
28
|
+
* bytes as the store holds it.
|
|
29
|
+
*/
|
|
20
30
|
readonly ownBytes: Schema.Number;
|
|
21
|
-
readonly looseObjects: Schema.Number;
|
|
22
|
-
readonly looseBytes: Schema.Number;
|
|
23
|
-
readonly leavingBytes: Schema.Number;
|
|
24
31
|
/**
|
|
25
32
|
* When the core last committed a move of one of the repo's refs: a push, a write that names a
|
|
26
33
|
* ref, `refs.update`, a merge or a queue's publish, but not the queue's own refs alone. None
|
|
@@ -39,7 +46,7 @@ export type RepoStats = typeof RepoStats.Type;
|
|
|
39
46
|
* every field: every caller of a server with no `access`, and one `refs.private` lets read every
|
|
40
47
|
* pattern of the repo's, as it does on a repo with none. One a private pattern restricts gets only
|
|
41
48
|
* what its own view counts: `repo`, the `refs` it sees and the `pushedAt` of those refs. The pack
|
|
42
|
-
*
|
|
49
|
+
* count, the bytes and `maintainedAt` are left out, never zero, since a push to a ref
|
|
43
50
|
* it can't see moves them.
|
|
44
51
|
*/
|
|
45
52
|
export declare const RepoInfoStats: Schema.Struct<{
|
|
@@ -51,12 +58,6 @@ export declare const RepoInfoStats: Schema.Struct<{
|
|
|
51
58
|
readonly packBytes: Schema.optionalKey<Schema.Number>;
|
|
52
59
|
/** As `RepoStats` counts it; left out for a caller a private pattern restricts. */
|
|
53
60
|
readonly ownBytes: Schema.optionalKey<Schema.Number>;
|
|
54
|
-
/** As `RepoStats` counts it; left out for a caller a private pattern restricts. */
|
|
55
|
-
readonly looseObjects: Schema.optionalKey<Schema.Number>;
|
|
56
|
-
/** As `RepoStats` counts it; left out for a caller a private pattern restricts. */
|
|
57
|
-
readonly looseBytes: Schema.optionalKey<Schema.Number>;
|
|
58
|
-
/** As `RepoStats` counts it; left out for a caller a private pattern restricts. */
|
|
59
|
-
readonly leavingBytes: Schema.optionalKey<Schema.Number>;
|
|
60
61
|
/** When a ref this caller sees last moved: the whole repo's for a caller with the whole view. */
|
|
61
62
|
readonly pushedAt: Schema.optionalKey<Schema.Number>;
|
|
62
63
|
/** As `RepoStats` keeps it; left out for a caller a private pattern restricts. */
|
|
@@ -116,12 +117,6 @@ export declare const RepoInfo: Schema.Struct<{
|
|
|
116
117
|
readonly packBytes: Schema.optionalKey<Schema.Number>;
|
|
117
118
|
/** As `RepoStats` counts it; left out for a caller a private pattern restricts. */
|
|
118
119
|
readonly ownBytes: Schema.optionalKey<Schema.Number>;
|
|
119
|
-
/** As `RepoStats` counts it; left out for a caller a private pattern restricts. */
|
|
120
|
-
readonly looseObjects: Schema.optionalKey<Schema.Number>;
|
|
121
|
-
/** As `RepoStats` counts it; left out for a caller a private pattern restricts. */
|
|
122
|
-
readonly looseBytes: Schema.optionalKey<Schema.Number>;
|
|
123
|
-
/** As `RepoStats` counts it; left out for a caller a private pattern restricts. */
|
|
124
|
-
readonly leavingBytes: Schema.optionalKey<Schema.Number>;
|
|
125
120
|
/** When a ref this caller sees last moved: the whole repo's for a caller with the whole view. */
|
|
126
121
|
readonly pushedAt: Schema.optionalKey<Schema.Number>;
|
|
127
122
|
/** As `RepoStats` keeps it; left out for a caller a private pattern restricts. */
|
|
@@ -311,9 +306,6 @@ declare const Repos_base: Context.ServiceClass<Repos, "@ref0/git/Repos", EffectC
|
|
|
311
306
|
readonly packs?: number;
|
|
312
307
|
readonly packBytes?: number;
|
|
313
308
|
readonly ownBytes?: number;
|
|
314
|
-
readonly looseObjects?: number;
|
|
315
|
-
readonly looseBytes?: number;
|
|
316
|
-
readonly leavingBytes?: number;
|
|
317
309
|
readonly pushedAt?: number;
|
|
318
310
|
readonly maintainedAt?: number;
|
|
319
311
|
};
|
|
@@ -341,9 +333,6 @@ declare const Repos_base: Context.ServiceClass<Repos, "@ref0/git/Repos", EffectC
|
|
|
341
333
|
readonly packs?: number;
|
|
342
334
|
readonly packBytes?: number;
|
|
343
335
|
readonly ownBytes?: number;
|
|
344
|
-
readonly looseObjects?: number;
|
|
345
|
-
readonly looseBytes?: number;
|
|
346
|
-
readonly leavingBytes?: number;
|
|
347
336
|
readonly pushedAt?: number;
|
|
348
337
|
readonly maintainedAt?: number;
|
|
349
338
|
};
|
|
@@ -372,9 +361,6 @@ declare const Repos_base: Context.ServiceClass<Repos, "@ref0/git/Repos", EffectC
|
|
|
372
361
|
readonly packs?: number;
|
|
373
362
|
readonly packBytes?: number;
|
|
374
363
|
readonly ownBytes?: number;
|
|
375
|
-
readonly looseObjects?: number;
|
|
376
|
-
readonly looseBytes?: number;
|
|
377
|
-
readonly leavingBytes?: number;
|
|
378
364
|
readonly pushedAt?: number;
|
|
379
365
|
readonly maintainedAt?: number;
|
|
380
366
|
};
|
|
@@ -402,9 +388,6 @@ declare const Repos_base: Context.ServiceClass<Repos, "@ref0/git/Repos", EffectC
|
|
|
402
388
|
readonly packs?: number;
|
|
403
389
|
readonly packBytes?: number;
|
|
404
390
|
readonly ownBytes?: number;
|
|
405
|
-
readonly looseObjects?: number;
|
|
406
|
-
readonly looseBytes?: number;
|
|
407
|
-
readonly leavingBytes?: number;
|
|
408
391
|
readonly pushedAt?: number;
|
|
409
392
|
readonly maintainedAt?: number;
|
|
410
393
|
};
|
|
@@ -439,9 +422,6 @@ export declare const create: (input: RepoCreateInput, by?: Caller) => Effect.Eff
|
|
|
439
422
|
readonly packs?: number;
|
|
440
423
|
readonly packBytes?: number;
|
|
441
424
|
readonly ownBytes?: number;
|
|
442
|
-
readonly looseObjects?: number;
|
|
443
|
-
readonly looseBytes?: number;
|
|
444
|
-
readonly leavingBytes?: number;
|
|
445
425
|
readonly pushedAt?: number;
|
|
446
426
|
readonly maintainedAt?: number;
|
|
447
427
|
};
|
|
@@ -469,9 +449,6 @@ export declare const get: (repo: RepoName, input: ActorInput & Pick<RepoInput, '
|
|
|
469
449
|
readonly packs?: number;
|
|
470
450
|
readonly packBytes?: number;
|
|
471
451
|
readonly ownBytes?: number;
|
|
472
|
-
readonly looseObjects?: number;
|
|
473
|
-
readonly looseBytes?: number;
|
|
474
|
-
readonly leavingBytes?: number;
|
|
475
452
|
readonly pushedAt?: number;
|
|
476
453
|
readonly maintainedAt?: number;
|
|
477
454
|
};
|
|
@@ -500,9 +477,6 @@ export declare const update: (repo: RepoName, input: RepoUpdateInput, by?: Calle
|
|
|
500
477
|
readonly packs?: number;
|
|
501
478
|
readonly packBytes?: number;
|
|
502
479
|
readonly ownBytes?: number;
|
|
503
|
-
readonly looseObjects?: number;
|
|
504
|
-
readonly looseBytes?: number;
|
|
505
|
-
readonly leavingBytes?: number;
|
|
506
480
|
readonly pushedAt?: number;
|
|
507
481
|
readonly maintainedAt?: number;
|
|
508
482
|
};
|
|
@@ -530,9 +504,6 @@ export declare const rename: (repo: RepoName, input: RepoRenameInput, by?: Calle
|
|
|
530
504
|
readonly packs?: number;
|
|
531
505
|
readonly packBytes?: number;
|
|
532
506
|
readonly ownBytes?: number;
|
|
533
|
-
readonly looseObjects?: number;
|
|
534
|
-
readonly looseBytes?: number;
|
|
535
|
-
readonly leavingBytes?: number;
|
|
536
507
|
readonly pushedAt?: number;
|
|
537
508
|
readonly maintainedAt?: number;
|
|
538
509
|
};
|
package/dist/contracts/repos.mjs
CHANGED
|
@@ -29,12 +29,19 @@ const Moment = Schema.Number;
|
|
|
29
29
|
const RepoStats = /* @__PURE__ */ Schema.Struct({
|
|
30
30
|
repo: RepoName,
|
|
31
31
|
refs: Schema.Number,
|
|
32
|
+
/** The packs the repo lists. */
|
|
32
33
|
packs: Schema.Number,
|
|
34
|
+
/**
|
|
35
|
+
* The bytes of the packs the repo lists, shared with forks or not, and of the pack kept ready for
|
|
36
|
+
* a shallow clone of the default branch, which no list names.
|
|
37
|
+
*/
|
|
33
38
|
packBytes: Schema.Number,
|
|
39
|
+
/**
|
|
40
|
+
* The bytes a quota counts: `packBytes`, and the objects the repo keeps as rows, every object of
|
|
41
|
+
* a `loose()` repo's and a small push's that `packs()` keeps until its next repack, each its row's
|
|
42
|
+
* bytes as the store holds it.
|
|
43
|
+
*/
|
|
34
44
|
ownBytes: Schema.Number,
|
|
35
|
-
looseObjects: Schema.Number,
|
|
36
|
-
looseBytes: Schema.Number,
|
|
37
|
-
leavingBytes: Schema.Number,
|
|
38
45
|
/**
|
|
39
46
|
* When the core last committed a move of one of the repo's refs: a push, a write that names a
|
|
40
47
|
* ref, `refs.update`, a merge or a queue's publish, but not the queue's own refs alone. None
|
|
@@ -52,7 +59,7 @@ const RepoStats = /* @__PURE__ */ Schema.Struct({
|
|
|
52
59
|
* every field: every caller of a server with no `access`, and one `refs.private` lets read every
|
|
53
60
|
* pattern of the repo's, as it does on a repo with none. One a private pattern restricts gets only
|
|
54
61
|
* what its own view counts: `repo`, the `refs` it sees and the `pushedAt` of those refs. The pack
|
|
55
|
-
*
|
|
62
|
+
* count, the bytes and `maintainedAt` are left out, never zero, since a push to a ref
|
|
56
63
|
* it can't see moves them.
|
|
57
64
|
*/
|
|
58
65
|
const RepoInfoStats = /* @__PURE__ */ Schema.Struct({
|
|
@@ -64,12 +71,6 @@ const RepoInfoStats = /* @__PURE__ */ Schema.Struct({
|
|
|
64
71
|
packBytes: Schema.optionalKey(Schema.Number),
|
|
65
72
|
/** As `RepoStats` counts it; left out for a caller a private pattern restricts. */
|
|
66
73
|
ownBytes: Schema.optionalKey(Schema.Number),
|
|
67
|
-
/** As `RepoStats` counts it; left out for a caller a private pattern restricts. */
|
|
68
|
-
looseObjects: Schema.optionalKey(Schema.Number),
|
|
69
|
-
/** As `RepoStats` counts it; left out for a caller a private pattern restricts. */
|
|
70
|
-
looseBytes: Schema.optionalKey(Schema.Number),
|
|
71
|
-
/** As `RepoStats` counts it; left out for a caller a private pattern restricts. */
|
|
72
|
-
leavingBytes: Schema.optionalKey(Schema.Number),
|
|
73
74
|
/** When a ref this caller sees last moved: the whole repo's for a caller with the whole view. */
|
|
74
75
|
pushedAt: RepoStats.fields.pushedAt,
|
|
75
76
|
/** As `RepoStats` keeps it; left out for a caller a private pattern restricts. */
|
|
@@ -150,7 +150,7 @@ export declare const DataLossContext: Schema.StructWithRest<Schema.Struct<{
|
|
|
150
150
|
reason: Schema.optionalKey<Schema.Union<readonly [Schema.Literals<readonly ["event-version", "graph-length", "merge-incomplete"]>, Schema.decodeTo<Schema.String, Schema.String, never, never>]>>;
|
|
151
151
|
}>, readonly [Schema.$Record<Schema.String, Schema.Union<readonly [Schema.decodeTo<Schema.String, Schema.String, never, never>, Schema.Number, Schema.Boolean, Schema.$Array<Schema.decodeTo<Schema.String, Schema.String, never, never>>, Schema.Undefined]>>]>;
|
|
152
152
|
export type DataLossContext = typeof DataLossContext.Type;
|
|
153
|
-
/** `id`: the logged host-function failure's, which
|
|
153
|
+
/** `id`: the logged host-function failure's, which its log line is annotated with as `failure`. */
|
|
154
154
|
export declare const HostErrorContext: Schema.StructWithRest<Schema.Struct<{
|
|
155
155
|
id: Schema.optionalKey<Schema.decodeTo<Schema.String, Schema.String, never, never>>;
|
|
156
156
|
}>, readonly [Schema.$Record<Schema.String, Schema.Union<readonly [Schema.decodeTo<Schema.String, Schema.String, never, never>, Schema.Number, Schema.Boolean, Schema.$Array<Schema.decodeTo<Schema.String, Schema.String, never, never>>, Schema.Undefined]>>]>;
|
|
@@ -390,19 +390,27 @@ export declare const gitError: <Code extends GitErrorCode>(code: Code, message:
|
|
|
390
390
|
/** Whether `told`, a `reason: <told>` line's, is a reason a refusal names. */
|
|
391
391
|
export declare const isRefusalReason: (told: string) => told is RefusalReason;
|
|
392
392
|
/** A host function's refusal: `code` is `NOT_ALLOWED` when it's left out. */
|
|
393
|
-
export
|
|
394
|
-
readonly code
|
|
395
|
-
readonly message:
|
|
396
|
-
readonly hint
|
|
397
|
-
readonly context
|
|
398
|
-
}
|
|
399
|
-
export
|
|
400
|
-
|
|
401
|
-
|
|
393
|
+
export declare const RejectInput: Schema.Struct<{
|
|
394
|
+
readonly code: Schema.decodeTo<Schema.optionalKey<Schema.toType<Schema.Literals<readonly ("ALREADY_EXISTS" | "DATA_LOSS" | "DEADLINE_EXCEEDED" | "FAILED_PRECONDITION" | "INTERNAL" | "INVALID_ARGUMENT" | "NOT_ALLOWED" | "NOT_FOUND" | "RESOURCE_EXHAUSTED" | "UNAUTHENTICATED" | "UNAVAILABLE")[]>>>, Schema.optional<Schema.Literals<readonly ("ALREADY_EXISTS" | "DATA_LOSS" | "DEADLINE_EXCEEDED" | "FAILED_PRECONDITION" | "INTERNAL" | "INVALID_ARGUMENT" | "NOT_ALLOWED" | "NOT_FOUND" | "RESOURCE_EXHAUSTED" | "UNAUTHENTICATED" | "UNAVAILABLE")[]>>, never, never>;
|
|
395
|
+
readonly message: Schema.String;
|
|
396
|
+
readonly hint: Schema.decodeTo<Schema.optionalKey<Schema.toType<Schema.String>>, Schema.optional<Schema.String>, never, never>;
|
|
397
|
+
readonly context: Schema.decodeTo<Schema.optionalKey<Schema.toType<Schema.StructWithRest<Schema.Struct<{}>, readonly [Schema.$Record<Schema.String, Schema.Union<readonly [Schema.decodeTo<Schema.String, Schema.String, never, never>, Schema.Number, Schema.Boolean, Schema.$Array<Schema.decodeTo<Schema.String, Schema.String, never, never>>, Schema.Undefined]>>]>>>, Schema.optional<Schema.StructWithRest<Schema.Struct<{}>, readonly [Schema.$Record<Schema.String, Schema.Union<readonly [Schema.decodeTo<Schema.String, Schema.String, never, never>, Schema.Number, Schema.Boolean, Schema.$Array<Schema.decodeTo<Schema.String, Schema.String, never, never>>, Schema.Undefined]>>]>>, never, never>;
|
|
398
|
+
}>;
|
|
399
|
+
export type RejectInput = typeof RejectInput.Type;
|
|
400
|
+
export declare const Rejected: Schema.Struct<{
|
|
401
|
+
readonly code: Schema.decodeTo<Schema.optionalKey<Schema.toType<Schema.Literals<readonly ("ALREADY_EXISTS" | "DATA_LOSS" | "DEADLINE_EXCEEDED" | "FAILED_PRECONDITION" | "INTERNAL" | "INVALID_ARGUMENT" | "NOT_ALLOWED" | "NOT_FOUND" | "RESOURCE_EXHAUSTED" | "UNAUTHENTICATED" | "UNAVAILABLE")[]>>>, Schema.optional<Schema.Literals<readonly ("ALREADY_EXISTS" | "DATA_LOSS" | "DEADLINE_EXCEEDED" | "FAILED_PRECONDITION" | "INTERNAL" | "INVALID_ARGUMENT" | "NOT_ALLOWED" | "NOT_FOUND" | "RESOURCE_EXHAUSTED" | "UNAUTHENTICATED" | "UNAVAILABLE")[]>>, never, never>;
|
|
402
|
+
readonly message: Schema.String;
|
|
403
|
+
readonly hint: Schema.decodeTo<Schema.optionalKey<Schema.toType<Schema.String>>, Schema.optional<Schema.String>, never, never>;
|
|
404
|
+
readonly context: Schema.decodeTo<Schema.optionalKey<Schema.toType<Schema.StructWithRest<Schema.Struct<{}>, readonly [Schema.$Record<Schema.String, Schema.Union<readonly [Schema.decodeTo<Schema.String, Schema.String, never, never>, Schema.Number, Schema.Boolean, Schema.$Array<Schema.decodeTo<Schema.String, Schema.String, never, never>>, Schema.Undefined]>>]>>>, Schema.optional<Schema.StructWithRest<Schema.Struct<{}>, readonly [Schema.$Record<Schema.String, Schema.Union<readonly [Schema.decodeTo<Schema.String, Schema.String, never, never>, Schema.Number, Schema.Boolean, Schema.$Array<Schema.decodeTo<Schema.String, Schema.String, never, never>>, Schema.Undefined]>>]>>, never, never>;
|
|
405
|
+
readonly kind: Schema.Literal<"reject">;
|
|
406
|
+
}>;
|
|
407
|
+
export type Rejected = typeof Rejected.Type;
|
|
408
|
+
/** An accept: `decisionAnswer` reads one with its value's Schema. */
|
|
402
409
|
export interface Accepted<Data = undefined> {
|
|
403
410
|
readonly kind: 'accept';
|
|
404
411
|
readonly value?: Data;
|
|
405
412
|
}
|
|
413
|
+
/** A host check's answer: `decisionAnswer` reads one a host's JavaScript gave. */
|
|
406
414
|
export type DecisionAnswer<Data = undefined> = Accepted<Data> | Rejected;
|
|
407
415
|
/** With no value, it fits any answer: a fetch rule's as well as a push rule's. */
|
|
408
416
|
export declare function accept(): Accepted<never>;
|
|
@@ -412,7 +420,16 @@ export declare function accept<Data>(value: Data): Accepted<Data>;
|
|
|
412
420
|
* `message` off its enumerable keys, so a spread of one would drop it.
|
|
413
421
|
*/
|
|
414
422
|
export declare const reject: ({ code, message, hint, context }: RejectInput) => Rejected;
|
|
415
|
-
|
|
423
|
+
/**
|
|
424
|
+
* The host functions Git runs, by the name its logs give each. When one throws, fails or runs past
|
|
425
|
+
* its timeout, its caller gets a fixed sentence and a failure ID, and the runtime's Logger gets a
|
|
426
|
+
* line at `Error`: `<name> failed` or `<name> ran out of time`, annotated `function`, `failure` (that
|
|
427
|
+
* ID), and `repo` and `operation` (the operation's kind) where the call has them. Its cause is the
|
|
428
|
+
* host's own error, unredacted, so a credential or a private ref name an `Auth`, a grant resolver or
|
|
429
|
+
* a rule puts in its error reaches the Logger as written: cleaning it is the host's Logger's job. A
|
|
430
|
+
* refusal is a line at `Debug`, `<name> refused: <message>`, annotated `code` beside the rest.
|
|
431
|
+
*/
|
|
432
|
+
export declare const HostFunctionName: Schema.Literals<readonly ["auth", "authorize", "approvalPage", "grants", "rules.push", "rules.fetch", "hooks", "join", "queue.merge", "queue.lanes", "queue.bisect", "queue.schedule", "topics.prepare", "topics.required"]>;
|
|
416
433
|
export type HostFunctionName = typeof HostFunctionName.Type;
|
|
417
434
|
export type Awaitable<T> = T | Promise<T>;
|
|
418
435
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as Effect from "effect/Effect";
|
|
2
|
+
import * as Option from "effect/Option";
|
|
2
3
|
import * as Schema from "effect/Schema";
|
|
3
4
|
import * as Predicate from "effect/Predicate";
|
|
4
5
|
import * as SchemaTransformation from "effect/SchemaTransformation";
|
|
@@ -251,7 +252,7 @@ const DataLossReason = /* @__PURE__ */ Schema.Literals([
|
|
|
251
252
|
"merge-incomplete"
|
|
252
253
|
]);
|
|
253
254
|
const DataLossContext = contextOf({ reason: reasonOf(DataLossReason) });
|
|
254
|
-
/** `id`: the logged host-function failure's, which
|
|
255
|
+
/** `id`: the logged host-function failure's, which its log line is annotated with as `failure`. */
|
|
255
256
|
const HostErrorContext = contextOf({ id: Schema.optionalKey(BodyText) });
|
|
256
257
|
/**
|
|
257
258
|
* `busy`: the server's memory, held by other calls, had no room for this one in time.
|
|
@@ -388,6 +389,35 @@ const gitErrorFrom = (fields, over = {}) => {
|
|
|
388
389
|
const refusalReasons = /* @__PURE__ */ new Set(refusalReasonLists.flatMap((reasons) => reasons.literals));
|
|
389
390
|
/** Whether `told`, a `reason: <told>` line's, is a reason a refusal names. */
|
|
390
391
|
const isRefusalReason = (told) => refusalReasons.has(told);
|
|
392
|
+
/**
|
|
393
|
+
* An optional field a host's JavaScript may also answer as `undefined`, which reads as left out: so
|
|
394
|
+
* its type stays the field's own, as `reject()` writes it, and `join`'s explicit `undefined` still
|
|
395
|
+
* refuses (#1877).
|
|
396
|
+
*/
|
|
397
|
+
const answeredOptional = (schema) => Schema.optional(schema).pipe(Schema.decodeTo(Schema.optionalKey(Schema.toType(schema)), SchemaTransformation.transformOptional({
|
|
398
|
+
decode: Option.filter(Predicate.isNotUndefined),
|
|
399
|
+
encode: (value) => value
|
|
400
|
+
})));
|
|
401
|
+
/** A host function's refusal: `code` is `NOT_ALLOWED` when it's left out. */
|
|
402
|
+
const RejectInput = /* @__PURE__ */ Schema.Struct({
|
|
403
|
+
code: answeredOptional(GitErrorCode),
|
|
404
|
+
message: Schema.String,
|
|
405
|
+
hint: answeredOptional(Schema.String),
|
|
406
|
+
context: answeredOptional(ErrorContext)
|
|
407
|
+
});
|
|
408
|
+
const Rejected = /* @__PURE__ */ Schema.Struct({
|
|
409
|
+
kind: Schema.Literal("reject"),
|
|
410
|
+
...RejectInput.fields
|
|
411
|
+
});
|
|
412
|
+
/**
|
|
413
|
+
* A host check's answer, `accept()` with a `value` that `value` reads or `reject()`, as a host's
|
|
414
|
+
* JavaScript may answer anything: a push rule's, a hook group's, a fetch rule's, `join`'s and
|
|
415
|
+
* `prepare`'s. Its type is `DecisionAnswer` of `value`'s.
|
|
416
|
+
*/
|
|
417
|
+
const decisionAnswer = (value) => Schema.Union([Schema.Struct({
|
|
418
|
+
kind: Schema.Literal("accept"),
|
|
419
|
+
value: answeredOptional(value)
|
|
420
|
+
}), Rejected]);
|
|
391
421
|
function accept(...value) {
|
|
392
422
|
return value.length === 0 ? { kind: "accept" } : {
|
|
393
423
|
kind: "accept",
|
|
@@ -408,4 +438,4 @@ const reject = ({ code, message, hint, context }) => {
|
|
|
408
438
|
if (context !== void 0) rejected.context = context;
|
|
409
439
|
return rejected;
|
|
410
440
|
};
|
|
411
|
-
export { ContextValue, DataLossContext, DataLossReason, ErrorContext, ExistingContext, ExistingReason, GitErrorBody, GitErrorCode, GitErrorTagged, GitErrorValue, HostErrorContext, InvalidInputContext, InvalidInputReason, MissingContext, MissingReason, NotAllowedContext, NotAllowedReason, PreconditionContext, PreconditionReason, ResourceContext, ResourceReason, UnavailableContext, UnavailableReason, Verdict, accept, fail, gitError, gitErrorBodies, gitErrorFrom, httpStatus, isGitError, isGitErrorCode, isRefusalReason, refusalCodeHeader, reject };
|
|
441
|
+
export { ContextValue, DataLossContext, DataLossReason, ErrorContext, ExistingContext, ExistingReason, GitErrorBody, GitErrorCode, GitErrorTagged, GitErrorValue, HostErrorContext, InvalidInputContext, InvalidInputReason, MissingContext, MissingReason, NotAllowedContext, NotAllowedReason, PreconditionContext, PreconditionReason, RejectInput, Rejected, ResourceContext, ResourceReason, UnavailableContext, UnavailableReason, Verdict, accept, decisionAnswer, fail, gitError, gitErrorBodies, gitErrorFrom, httpStatus, isGitError, isGitErrorCode, isRefusalReason, refusalCodeHeader, reject };
|