gitd-client 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/compare-convert.d.ts +6 -0
- package/dist/compare-convert.js +33 -0
- package/dist/convert.d.ts +6 -2
- package/dist/convert.js +54 -6
- package/dist/credential-convert.d.ts +3 -0
- package/dist/credential-convert.js +27 -0
- package/dist/credential-types.d.ts +57 -0
- package/dist/credential-types.js +1 -0
- package/dist/credentials.d.ts +27 -0
- package/dist/credentials.js +66 -0
- package/dist/endpoint-types.d.ts +28 -0
- package/dist/endpoint-types.js +1 -0
- package/dist/endpoint.d.ts +18 -0
- package/dist/endpoint.js +49 -0
- package/dist/gen/gitd/v1/gitd_pb.d.ts +2154 -151
- package/dist/gen/gitd/v1/gitd_pb.js +565 -17
- package/dist/gitd.d.ts +46 -5
- package/dist/gitd.js +137 -11
- package/dist/index.d.ts +6 -0
- package/dist/index.js +3 -0
- package/dist/publishing-convert.d.ts +8 -0
- package/dist/publishing-convert.js +74 -0
- package/dist/publishing-types.d.ts +72 -0
- package/dist/publishing-types.js +1 -0
- package/dist/publishing.d.ts +23 -0
- package/dist/publishing.js +40 -0
- package/dist/types.d.ts +113 -7
- package/dist/warm-convert.d.ts +4 -0
- package/dist/warm-convert.js +12 -0
- package/package.json +1 -1
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Progress } from "./gen/gitd/v1/gitd_pb.js";
|
|
2
|
+
import type { OpenedPullRequest, Provenance } from "./publishing-types.js";
|
|
2
3
|
/** How a workspace was made: a layer on a shared template, a block clone, or every file written. */
|
|
3
4
|
export type StrategyName = "overlay" | "reflink" | "copy";
|
|
4
5
|
/** Where a workspace ended up. */
|
|
@@ -8,7 +9,7 @@ export interface Workspace {
|
|
|
8
9
|
/** The branch it follows; empty when detached at a commit. */
|
|
9
10
|
branch: string;
|
|
10
11
|
strategy: StrategyName;
|
|
11
|
-
/** An overlay workspace's template (lower)
|
|
12
|
+
/** An overlay workspace's template (lower), its own layer (upper, work), and its warm layer. */
|
|
12
13
|
layers?: Layers;
|
|
13
14
|
/** Submodules that could not be checked out, and why. */
|
|
14
15
|
pendingSubmodules: PendingSubmodule[];
|
|
@@ -19,6 +20,21 @@ export interface Layers {
|
|
|
19
20
|
lower: string;
|
|
20
21
|
upper: string;
|
|
21
22
|
work: string;
|
|
23
|
+
/** The warm layer between the template and its own, when it stands on one; else empty. */
|
|
24
|
+
warm: string;
|
|
25
|
+
}
|
|
26
|
+
/** A layer sealed from a workspace — what installing its dependencies wrote — for later ones to stand on. */
|
|
27
|
+
export interface WarmLayer {
|
|
28
|
+
url: string;
|
|
29
|
+
name: string;
|
|
30
|
+
/** Workspaces stand on it at this commit only. */
|
|
31
|
+
commit: string;
|
|
32
|
+
sealedAt: Date;
|
|
33
|
+
sealedFrom: string;
|
|
34
|
+
/** Files it changes that git does not ignore, e.g. a lock file rewritten. */
|
|
35
|
+
changedFiles: number;
|
|
36
|
+
/** Workspaces standing on it now. */
|
|
37
|
+
users: number;
|
|
22
38
|
}
|
|
23
39
|
export interface PendingSubmodule {
|
|
24
40
|
path: string;
|
|
@@ -43,10 +59,20 @@ export interface Submodule {
|
|
|
43
59
|
commit: string;
|
|
44
60
|
checkedOut: boolean;
|
|
45
61
|
}
|
|
46
|
-
/**
|
|
62
|
+
/** Why gitd refused something: its reason (POLICY_REFUSED, AUTH_REQUIRED, …) and what was said. */
|
|
63
|
+
export interface Refusal {
|
|
64
|
+
reason: string;
|
|
65
|
+
said: string;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* What a publish pushed: the workspace's repository first, then each submodule; the pull
|
|
69
|
+
* request it opened, or why it could not, the branch being published either way.
|
|
70
|
+
*/
|
|
47
71
|
export interface Published {
|
|
48
72
|
branch: string;
|
|
49
73
|
repositories: PublishedRepository[];
|
|
74
|
+
pullRequest?: OpenedPullRequest;
|
|
75
|
+
pullRequestRefused?: Refusal;
|
|
50
76
|
}
|
|
51
77
|
export interface PublishedRepository {
|
|
52
78
|
url: string;
|
|
@@ -56,6 +82,70 @@ export interface PublishedRepository {
|
|
|
56
82
|
/** The subjects of the new commits, newest first. */
|
|
57
83
|
subjects: string[];
|
|
58
84
|
}
|
|
85
|
+
/** How a file changed. */
|
|
86
|
+
export type ChangeKind = "added" | "modified" | "deleted";
|
|
87
|
+
/** A file changed, relative to the workspace, with its lines; a binary one counts none. */
|
|
88
|
+
export interface ChangedFile {
|
|
89
|
+
path: string;
|
|
90
|
+
kind: ChangeKind;
|
|
91
|
+
addedLines: number;
|
|
92
|
+
removedLines: number;
|
|
93
|
+
binary: boolean;
|
|
94
|
+
}
|
|
95
|
+
/** What was changed in a workspace since gitd put it on `base`, committed or not. */
|
|
96
|
+
export interface Changes {
|
|
97
|
+
base: string;
|
|
98
|
+
/** Read from the agent's own layer, with no git run in the workspace. */
|
|
99
|
+
fromLayer: boolean;
|
|
100
|
+
files: ChangedFile[];
|
|
101
|
+
}
|
|
102
|
+
/** The unified diff of a workspace's changes. */
|
|
103
|
+
export interface Diff {
|
|
104
|
+
base: string;
|
|
105
|
+
diff: string;
|
|
106
|
+
/** Cut short at maxBytes. */
|
|
107
|
+
truncated: boolean;
|
|
108
|
+
}
|
|
109
|
+
export interface DiffOptions {
|
|
110
|
+
/** Only these files, relative to the workspace. */
|
|
111
|
+
files?: string[];
|
|
112
|
+
/** At most this many bytes: 512 KiB by default, never more than 8 MiB. */
|
|
113
|
+
maxBytes?: number;
|
|
114
|
+
includeIgnored?: boolean;
|
|
115
|
+
}
|
|
116
|
+
/** One work: a workspace by its path, or a branch gitd published or its pool holds. */
|
|
117
|
+
export type Side = {
|
|
118
|
+
workspace: string;
|
|
119
|
+
} | {
|
|
120
|
+
branch: string;
|
|
121
|
+
};
|
|
122
|
+
export interface CompareOptions {
|
|
123
|
+
/** The repository, when both sides are branches. */
|
|
124
|
+
url?: string;
|
|
125
|
+
withDiff?: boolean;
|
|
126
|
+
maxBytes?: number;
|
|
127
|
+
includeIgnored?: boolean;
|
|
128
|
+
}
|
|
129
|
+
/** How two works differ, from the first to the second. */
|
|
130
|
+
export interface Comparison {
|
|
131
|
+
files: ChangedFile[];
|
|
132
|
+
diff: string;
|
|
133
|
+
truncated: boolean;
|
|
134
|
+
}
|
|
135
|
+
/** Two works that do not merge cleanly, and the files they conflict on. */
|
|
136
|
+
export interface Conflict {
|
|
137
|
+
first: Side;
|
|
138
|
+
second: Side;
|
|
139
|
+
paths: string[];
|
|
140
|
+
}
|
|
141
|
+
/** What happened to a workspace. */
|
|
142
|
+
export interface WorkspaceEvent {
|
|
143
|
+
kind: "made" | "changed" | "published" | "refused" | "removed";
|
|
144
|
+
path: string;
|
|
145
|
+
time: Date;
|
|
146
|
+
branch: string;
|
|
147
|
+
detail: string;
|
|
148
|
+
}
|
|
59
149
|
/** Which gitd answers, and how it makes workspaces on its machine. */
|
|
60
150
|
export interface Info {
|
|
61
151
|
version: string;
|
|
@@ -76,7 +166,15 @@ export interface Probe {
|
|
|
76
166
|
/** Why it cannot be read, when denied. */
|
|
77
167
|
denied?: string;
|
|
78
168
|
}
|
|
79
|
-
/**
|
|
169
|
+
/** A change to the credentials or publishing settings, as the audit log keeps it. */
|
|
170
|
+
export interface ConfigurationChange {
|
|
171
|
+
/** connection_added, connection_removed, settings_set or settings_removed. */
|
|
172
|
+
action: string;
|
|
173
|
+
/** The credential's id, or the settings' prefix. */
|
|
174
|
+
subject: string;
|
|
175
|
+
urlPrefix: string;
|
|
176
|
+
}
|
|
177
|
+
/** One publish, done or refused, or one change to credentials or settings, as the audit log keeps it. */
|
|
80
178
|
export interface AuditEntry {
|
|
81
179
|
time: Date;
|
|
82
180
|
/** The workspace's path, as the caller gave it. */
|
|
@@ -87,10 +185,13 @@ export interface AuditEntry {
|
|
|
87
185
|
/** What was pushed, the workspace's repository first; empty when refused. */
|
|
88
186
|
repositories: PublishedRepository[];
|
|
89
187
|
/** Why it was refused, when it was. */
|
|
90
|
-
refused?:
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
188
|
+
refused?: Refusal;
|
|
189
|
+
/** Who asked for the work, as the publish said. */
|
|
190
|
+
requestedBy: string;
|
|
191
|
+
pullRequest?: OpenedPullRequest;
|
|
192
|
+
pullRequestRefused?: Refusal;
|
|
193
|
+
change?: ConfigurationChange;
|
|
194
|
+
provenance?: Provenance;
|
|
94
195
|
}
|
|
95
196
|
export interface AuditOptions {
|
|
96
197
|
/** Only the publishes from this time on. */
|
|
@@ -115,6 +216,11 @@ export interface PrepareOptions extends Progressing {
|
|
|
115
216
|
fullHistory?: boolean;
|
|
116
217
|
/** A preference; gitd falls back to copy when it cannot run here. */
|
|
117
218
|
strategy?: StrategyName;
|
|
219
|
+
/**
|
|
220
|
+
* A warm layer to stand on, its dependencies installed already: the workspace is then made
|
|
221
|
+
* by overlay, at the commit the layer was sealed at, or not at all.
|
|
222
|
+
*/
|
|
223
|
+
warm?: string;
|
|
118
224
|
}
|
|
119
225
|
export interface UpdateOptions extends Progressing {
|
|
120
226
|
/** The branch to follow; default: the one it follows. */
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { WarmLayer as WarmLayerMessage } from "./gen/gitd/v1/gitd_pb.js";
|
|
2
|
+
import type { WarmLayer } from "./types.js";
|
|
3
|
+
/** A warm layer as gitd answers it, read as this client's. */
|
|
4
|
+
export declare function toWarmLayer(warm: WarmLayerMessage | undefined): WarmLayer;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** A warm layer as gitd answers it, read as this client's. */
|
|
2
|
+
export function toWarmLayer(warm) {
|
|
3
|
+
return {
|
|
4
|
+
url: warm?.url ?? "",
|
|
5
|
+
name: warm?.name ?? "",
|
|
6
|
+
commit: warm?.commit ?? "",
|
|
7
|
+
sealedAt: new Date(Number(warm?.sealedAt ?? 0n) * 1000),
|
|
8
|
+
sealedFrom: warm?.sealedFrom ?? "",
|
|
9
|
+
changedFiles: warm?.changedFiles ?? 0,
|
|
10
|
+
users: warm?.users ?? 0,
|
|
11
|
+
};
|
|
12
|
+
}
|