@bluestep-systems/b6p-core 1.2.0 → 1.4.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/README.md +133 -2
- package/dist/B6PCore.d.ts +22 -0
- package/dist/B6PCore.js +60 -8
- package/dist/B6PCore.js.map +1 -1
- package/dist/Err.d.ts +39 -0
- package/dist/Err.js +57 -0
- package/dist/Err.js.map +1 -1
- package/dist/cache/GitCredentialHosts.d.ts +46 -0
- package/dist/cache/GitCredentialHosts.js +90 -0
- package/dist/cache/GitCredentialHosts.js.map +1 -0
- package/dist/cache/GitCredentialResets.d.ts +89 -0
- package/dist/cache/GitCredentialResets.js +119 -0
- package/dist/cache/GitCredentialResets.js.map +1 -0
- package/dist/constants/GitCredential.d.ts +19 -0
- package/dist/constants/GitCredential.js +24 -0
- package/dist/constants/GitCredential.js.map +1 -0
- package/dist/constants/index.d.ts +1 -0
- package/dist/constants/index.js +3 -1
- package/dist/constants/index.js.map +1 -1
- package/dist/gateway/GatewayClient.js +10 -0
- package/dist/gateway/GatewayClient.js.map +1 -1
- package/dist/gateway/GatewayMarketplace.d.ts +28 -4
- package/dist/gateway/GatewayMarketplace.js +141 -5
- package/dist/gateway/GatewayMarketplace.js.map +1 -1
- package/dist/gitCredential/GitConfigRunner.d.ts +97 -0
- package/dist/gitCredential/GitConfigRunner.js +244 -0
- package/dist/gitCredential/GitConfigRunner.js.map +1 -0
- package/dist/gitCredential/GitCredentialContext.d.ts +39 -0
- package/dist/gitCredential/GitCredentialContext.js +3 -0
- package/dist/gitCredential/GitCredentialContext.js.map +1 -0
- package/dist/gitCredential/GitCredentialService.d.ts +390 -0
- package/dist/gitCredential/GitCredentialService.js +594 -0
- package/dist/gitCredential/GitCredentialService.js.map +1 -0
- package/dist/gitCredential/configFile.d.ts +71 -0
- package/dist/gitCredential/configFile.js +289 -0
- package/dist/gitCredential/configFile.js.map +1 -0
- package/dist/gitCredential/credentialConfig.d.ts +146 -0
- package/dist/gitCredential/credentialConfig.js +523 -0
- package/dist/gitCredential/credentialConfig.js.map +1 -0
- package/dist/gitCredential/hosts.d.ts +17 -0
- package/dist/gitCredential/hosts.js +44 -0
- package/dist/gitCredential/hosts.js.map +1 -0
- package/dist/index.d.ts +15 -2
- package/dist/index.js +34 -2
- package/dist/index.js.map +1 -1
- package/dist/persistence/PersistenceKeys.d.ts +12 -1
- package/dist/persistence/PersistenceKeys.js +11 -0
- package/dist/persistence/PersistenceKeys.js.map +1 -1
- package/dist/persistence/SharedFilePersistence.d.ts +30 -11
- package/dist/persistence/SharedFilePersistence.js +66 -13
- package/dist/persistence/SharedFilePersistence.js.map +1 -1
- package/dist/persistence/exitCleanup.d.ts +37 -0
- package/dist/persistence/exitCleanup.js +142 -0
- package/dist/persistence/exitCleanup.js.map +1 -0
- package/dist/persistence/fileLock.d.ts +57 -0
- package/dist/persistence/fileLock.js +252 -0
- package/dist/persistence/fileLock.js.map +1 -0
- package/dist/persistence/lockedMutation.d.ts +26 -0
- package/dist/persistence/lockedMutation.js +45 -0
- package/dist/persistence/lockedMutation.js.map +1 -0
- package/dist/providers.d.ts +15 -0
- package/dist/script/ScriptContext.d.ts +7 -0
- package/dist/script/ScriptService.d.ts +6 -0
- package/dist/script/ScriptService.js +14 -0
- package/dist/script/ScriptService.js.map +1 -1
- package/dist/testing/FakeGateway.d.ts +15 -1
- package/dist/testing/FakeGateway.js +53 -1
- package/dist/testing/FakeGateway.js.map +1 -1
- package/dist/types.d.ts +53 -1
- package/package.json +2 -2
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
import { type GitCredentialConfigEntry } from "./credentialConfig";
|
|
2
|
+
import type { GitCredentialContext } from "./GitCredentialContext";
|
|
3
|
+
/**
|
|
4
|
+
* Where an allowed host comes from.
|
|
5
|
+
*
|
|
6
|
+
* - `gateway`: the configured gateway (`settings.gatewayUrl`), when it is https.
|
|
7
|
+
* - `script-pull`: a tenant host a script pull reached with the stored token.
|
|
8
|
+
* @lastreviewed null
|
|
9
|
+
*/
|
|
10
|
+
export type GitCredentialHostSource = "gateway" | "script-pull";
|
|
11
|
+
/**
|
|
12
|
+
* A host b6p answers git's credential requests for.
|
|
13
|
+
* @lastreviewed null
|
|
14
|
+
*/
|
|
15
|
+
export interface GitCredentialHost {
|
|
16
|
+
/**
|
|
17
|
+
* `host` or `host:port` (the port only when it is not 443), lowercase.
|
|
18
|
+
* @lastreviewed null
|
|
19
|
+
*/
|
|
20
|
+
readonly host: string;
|
|
21
|
+
readonly source: GitCredentialHostSource;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* An allowed host and what git does with its credential requests, given the user's global git
|
|
25
|
+
* config (see {@link GitCredentialService.setupStatus}).
|
|
26
|
+
* @lastreviewed null
|
|
27
|
+
*/
|
|
28
|
+
export interface GitCredentialHostStatus extends GitCredentialHost {
|
|
29
|
+
/**
|
|
30
|
+
* Whether b6p is the only helper git asks for this host, so no other helper sees the token or is
|
|
31
|
+
* told to store it.
|
|
32
|
+
* @lastreviewed null
|
|
33
|
+
*/
|
|
34
|
+
readonly configured: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* The other helpers git asks for this host, in order. A storing helper (such as `store`) here
|
|
37
|
+
* would keep a copy of the token.
|
|
38
|
+
* @lastreviewed null
|
|
39
|
+
*/
|
|
40
|
+
readonly alsoAsked: string[];
|
|
41
|
+
/**
|
|
42
|
+
* The config entries that keep b6p from being the only helper: each other helper git asks, and
|
|
43
|
+
* the reset that clears b6p's entry when one comes after it. Setup never moves or deletes the
|
|
44
|
+
* user's entries, so these stay until the user moves them before b6p's reset or removes them.
|
|
45
|
+
* @lastreviewed null
|
|
46
|
+
*/
|
|
47
|
+
readonly others: GitCredentialConfigEntry[];
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* What {@link GitCredentialService.setupStatus} found.
|
|
51
|
+
* @lastreviewed null
|
|
52
|
+
*/
|
|
53
|
+
export interface GitCredentialSetupStatus {
|
|
54
|
+
/**
|
|
55
|
+
* Every allowed host, with whether it is set up.
|
|
56
|
+
* @lastreviewed null
|
|
57
|
+
*/
|
|
58
|
+
readonly hosts: GitCredentialHostStatus[];
|
|
59
|
+
/**
|
|
60
|
+
* Whether every allowed host is set up. `false` when there is no allowed host.
|
|
61
|
+
* @lastreviewed null
|
|
62
|
+
*/
|
|
63
|
+
readonly configured: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* The generic helpers (`credential.helper`) in the config read, which apply to every https host
|
|
66
|
+
* that has no reset of its own after them.
|
|
67
|
+
* @lastreviewed null
|
|
68
|
+
*/
|
|
69
|
+
readonly otherHelpers: string[];
|
|
70
|
+
/**
|
|
71
|
+
* Which config was read, as {@link GitCredentialStatusScope} says.
|
|
72
|
+
* @lastreviewed null
|
|
73
|
+
*/
|
|
74
|
+
readonly scope: GitCredentialStatusScope;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Which git config a status covers.
|
|
78
|
+
*
|
|
79
|
+
* - `global`: the system, global and command-line config (`git -c`, `GIT_CONFIG_COUNT`), read
|
|
80
|
+
* outside any repository.
|
|
81
|
+
* - `global+here`: those and the local and worktree config of the one repository the status was
|
|
82
|
+
* read in.
|
|
83
|
+
*
|
|
84
|
+
* Neither covers another repository's own config: a helper set in some other clone's
|
|
85
|
+
* `.git/config`, or in a file an `includeIf` reads only there, is seen only by a status read in
|
|
86
|
+
* that clone ({@link GitCredentialService.cloneStatus}). An `includeIf` after b6p's entries is
|
|
87
|
+
* counted as a helper that may be asked.
|
|
88
|
+
* @lastreviewed null
|
|
89
|
+
*/
|
|
90
|
+
export type GitCredentialStatusScope = "global" | "global+here";
|
|
91
|
+
/**
|
|
92
|
+
* What {@link GitCredentialService.setupGit} changed.
|
|
93
|
+
* @lastreviewed null
|
|
94
|
+
*/
|
|
95
|
+
export interface GitCredentialSetupResult {
|
|
96
|
+
/**
|
|
97
|
+
* The hosts b6p's reset and helper were written for.
|
|
98
|
+
* @lastreviewed null
|
|
99
|
+
*/
|
|
100
|
+
readonly added: string[];
|
|
101
|
+
/**
|
|
102
|
+
* The hosts that were set up already and were left as they were.
|
|
103
|
+
* @lastreviewed null
|
|
104
|
+
*/
|
|
105
|
+
readonly alreadyConfigured: string[];
|
|
106
|
+
/**
|
|
107
|
+
* Every allowed host as it stands after the setup. A host written for can still be
|
|
108
|
+
* `configured: false` when a later entry of the user's applies to it (see
|
|
109
|
+
* {@link GitCredentialHostStatus.others}).
|
|
110
|
+
* @lastreviewed null
|
|
111
|
+
*/
|
|
112
|
+
readonly hosts: GitCredentialHostStatus[];
|
|
113
|
+
/**
|
|
114
|
+
* As {@link GitCredentialSetupStatus.otherHelpers}; left in place.
|
|
115
|
+
* @lastreviewed null
|
|
116
|
+
*/
|
|
117
|
+
readonly otherHelpers: string[];
|
|
118
|
+
/**
|
|
119
|
+
* Resets of b6p's for a host set up again that were left in place (see
|
|
120
|
+
* {@link GitCredentialKeptReset}).
|
|
121
|
+
* @lastreviewed null
|
|
122
|
+
*/
|
|
123
|
+
readonly keptResets: GitCredentialKeptReset[];
|
|
124
|
+
/**
|
|
125
|
+
* Which config `hosts` was read from ({@link GitCredentialStatusScope}).
|
|
126
|
+
* @lastreviewed null
|
|
127
|
+
*/
|
|
128
|
+
readonly scope: GitCredentialStatusScope;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Why a reset b6p wrote was left in the user's git config.
|
|
132
|
+
*
|
|
133
|
+
* - `shared-key`: the same key in the same file has other empty values too, and `git config`
|
|
134
|
+
* (which removes by value) cannot take out b6p's alone.
|
|
135
|
+
* - `unconfirmed`: a setup or removal was interrupted, and the file no longer shows which of the
|
|
136
|
+
* key's empty values is b6p's, so none is removed. b6p forgets it once reported.
|
|
137
|
+
* @lastreviewed null
|
|
138
|
+
*/
|
|
139
|
+
export type GitCredentialKeptResetReason = "shared-key" | "unconfirmed";
|
|
140
|
+
/**
|
|
141
|
+
* A reset b6p wrote and left in place.
|
|
142
|
+
* @lastreviewed null
|
|
143
|
+
*/
|
|
144
|
+
export interface GitCredentialKeptReset {
|
|
145
|
+
/**
|
|
146
|
+
* The URL pattern of its key (`https://host`, as written).
|
|
147
|
+
* @lastreviewed null
|
|
148
|
+
*/
|
|
149
|
+
readonly url: string;
|
|
150
|
+
/**
|
|
151
|
+
* The file it is in.
|
|
152
|
+
* @lastreviewed null
|
|
153
|
+
*/
|
|
154
|
+
readonly file: string;
|
|
155
|
+
readonly reason: GitCredentialKeptResetReason;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* What {@link GitCredentialService.removeGit} took out.
|
|
159
|
+
* @lastreviewed null
|
|
160
|
+
*/
|
|
161
|
+
export interface GitCredentialRemoveResult {
|
|
162
|
+
/**
|
|
163
|
+
* The URL patterns b6p's entries were removed for (`https://host`, as written), whether or not
|
|
164
|
+
* that host is still allowed.
|
|
165
|
+
* @lastreviewed null
|
|
166
|
+
*/
|
|
167
|
+
readonly removed: string[];
|
|
168
|
+
/**
|
|
169
|
+
* The resets b6p wrote that were left in place, each with why.
|
|
170
|
+
* @lastreviewed null
|
|
171
|
+
*/
|
|
172
|
+
readonly keptResets: GitCredentialKeptReset[];
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Options naming the helper command written into git config.
|
|
176
|
+
* @lastreviewed null
|
|
177
|
+
*/
|
|
178
|
+
export interface GitCredentialHelperOptions {
|
|
179
|
+
/**
|
|
180
|
+
* The command git runs (default {@link GitCredential.DEFAULT_HELPER}). A consumer installed
|
|
181
|
+
* somewhere `b6p` is not on PATH, or one that is not the CLI, passes its own.
|
|
182
|
+
* @lastreviewed null
|
|
183
|
+
*/
|
|
184
|
+
readonly helper?: string;
|
|
185
|
+
/**
|
|
186
|
+
* The directory to read git's config from (default the process's): inside a repository, its
|
|
187
|
+
* local and worktree config count too.
|
|
188
|
+
* @lastreviewed null
|
|
189
|
+
*/
|
|
190
|
+
readonly cwd?: string;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Options for {@link GitCredentialService.cloneStatus}.
|
|
194
|
+
* @lastreviewed null
|
|
195
|
+
*/
|
|
196
|
+
export interface GitCredentialCloneOptions {
|
|
197
|
+
/**
|
|
198
|
+
* The command b6p's entries carry (default {@link GitCredential.DEFAULT_HELPER}).
|
|
199
|
+
* @lastreviewed null
|
|
200
|
+
*/
|
|
201
|
+
readonly helper?: string;
|
|
202
|
+
/**
|
|
203
|
+
* The remote whose URL names the host (default `origin`).
|
|
204
|
+
* @lastreviewed null
|
|
205
|
+
*/
|
|
206
|
+
readonly remote?: string;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* The oldest git whose credential contexts {@link credentialContextMatch} follows: the partial-URL
|
|
210
|
+
* fallback (credential.c `match_partial_url`) arrived in git 2.27.0 and is unchanged through 2.53.
|
|
211
|
+
* Status, setup and removal refuse an older git.
|
|
212
|
+
* @lastreviewed null
|
|
213
|
+
*/
|
|
214
|
+
export declare const GIT_MATCHING_FLOOR = "2.27.0";
|
|
215
|
+
/**
|
|
216
|
+
* The oldest git that reports the file `git config --global` writes (`git var GIT_CONFIG_GLOBAL`),
|
|
217
|
+
* which setup needs.
|
|
218
|
+
* @lastreviewed null
|
|
219
|
+
*/
|
|
220
|
+
export declare const GIT_SETUP_FLOOR = "2.42.0";
|
|
221
|
+
/**
|
|
222
|
+
* The `major.minor.patch` of `git --version` output (`git version 2.45.1.windows.1`,
|
|
223
|
+
* `git version 2.39.3 (Apple Git-146)`), or `null`.
|
|
224
|
+
* @lastreviewed null
|
|
225
|
+
*/
|
|
226
|
+
export declare function parseGitVersion(output: string): [number, number, number] | null;
|
|
227
|
+
/**
|
|
228
|
+
* Options naming the helper commands {@link GitCredentialService.removeGit} takes out.
|
|
229
|
+
* @lastreviewed null
|
|
230
|
+
*/
|
|
231
|
+
export interface GitCredentialRemoveOptions {
|
|
232
|
+
/**
|
|
233
|
+
* The commands to remove (default just {@link GitCredential.DEFAULT_HELPER}). An entry with any
|
|
234
|
+
* other value is left alone.
|
|
235
|
+
* @lastreviewed null
|
|
236
|
+
*/
|
|
237
|
+
readonly helpers?: readonly string[];
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* The `key=value` attributes of one credential request as git writes them (git-credential(1),
|
|
241
|
+
* "INPUT/OUTPUT FORMAT"): one per line, up to a blank line or the end. A repeated key keeps its
|
|
242
|
+
* last value; the `key[]=` multi-valued ones are not needed here and are skipped.
|
|
243
|
+
* @lastreviewed null
|
|
244
|
+
*/
|
|
245
|
+
export declare function parseCredentialRequest(input: string): Map<string, string>;
|
|
246
|
+
/**
|
|
247
|
+
* b6p as git's credential helper: plain `git fetch`, `pull` and `push` in a knowledge-base clone
|
|
248
|
+
* (the gateway) or a script's draft (a tenant) use the stored `b6pt_` token without asking, the
|
|
249
|
+
* way `gh auth setup-git` does for github.com.
|
|
250
|
+
*
|
|
251
|
+
* It answers only for an allowlist ({@link allowedHosts}): the configured gateway's host when it is
|
|
252
|
+
* https, and the tenant hosts script pulls reached with the token. The match is exact on
|
|
253
|
+
* `host[:port]`, https only, and a request naming another user, or carrying a `url=` git never
|
|
254
|
+
* sends a helper, gets nothing. For anything else it
|
|
255
|
+
* answers nothing, so git asks its other helpers.
|
|
256
|
+
*
|
|
257
|
+
* The token goes only to stdout, as the answer to `get`: never into argv, a log line or a message.
|
|
258
|
+
* @lastreviewed null
|
|
259
|
+
*/
|
|
260
|
+
export declare class GitCredentialService {
|
|
261
|
+
private readonly ctx;
|
|
262
|
+
constructor(ctx: GitCredentialContext);
|
|
263
|
+
/**
|
|
264
|
+
* The hosts answered for, the gateway first. An unusable gateway URL, or one that is not https
|
|
265
|
+
* (loopback http, used in development), contributes none.
|
|
266
|
+
* @lastreviewed null
|
|
267
|
+
*/
|
|
268
|
+
allowedHosts(): Promise<GitCredentialHost[]>;
|
|
269
|
+
/**
|
|
270
|
+
* Answer one credential-helper call: `action` is git's argument (`get`, `store` or `erase`) and
|
|
271
|
+
* `input` what git wrote on stdin. Returns what to write on stdout; the caller then exits 0.
|
|
272
|
+
* Never throws.
|
|
273
|
+
*
|
|
274
|
+
* - `get` answers `username` and `password` (the stored token) only for an https request to an
|
|
275
|
+
* allowed host, and nothing otherwise.
|
|
276
|
+
* - `store` does nothing: the token enters only through the consumer's own sign-in, so git has
|
|
277
|
+
* nothing to teach b6p.
|
|
278
|
+
* - `erase` does nothing either. git sends it after any refusal of the credential (a 401), and the
|
|
279
|
+
* stored token is the one credential every b6p operation shares: one tenant refusing it, or a
|
|
280
|
+
* moment's outage answered with a 401, would otherwise sign b6p out everywhere. A token that is
|
|
281
|
+
* really revoked is replaced through the consumer's sign-in, as before.
|
|
282
|
+
* - Any other action does nothing, as git expects of a helper.
|
|
283
|
+
* @lastreviewed null
|
|
284
|
+
*/
|
|
285
|
+
answer(action: string, input: string): Promise<string>;
|
|
286
|
+
/**
|
|
287
|
+
* Every allowed host and whether b6p is the only helper git asks for it, with the other helpers
|
|
288
|
+
* and the entries responsible when it is not, plus the generic helpers. Read from the config in
|
|
289
|
+
* effect in `cwd` (default the process's directory): system, global (`~/.gitconfig`,
|
|
290
|
+
* `$XDG_CONFIG_HOME/git/config`), the command line and `GIT_CONFIG_COUNT`, and inside a
|
|
291
|
+
* repository its local and worktree config, with what they include. `scope` says which; no
|
|
292
|
+
* status covers another repository's own config ({@link GitCredentialStatusScope}).
|
|
293
|
+
*
|
|
294
|
+
* Entries match as git's credential contexts do ({@link credentialContextMatch}). Where an entry
|
|
295
|
+
* applies to only some requests (one scoped to a path, say), another helper counts as asked and a
|
|
296
|
+
* reset or b6p's own entry as not applying, and an `includeIf` after the last reset counts as a
|
|
297
|
+
* helper that may be asked, so a host is `configured` only when git certainly asks b6p alone.
|
|
298
|
+
* Changes nothing.
|
|
299
|
+
*
|
|
300
|
+
* @throws {Err.GitCredentialSetupError} when git is missing or older than {@link GIT_MATCHING_FLOOR}.
|
|
301
|
+
* @lastreviewed null
|
|
302
|
+
*/
|
|
303
|
+
setupStatus(options?: GitCredentialHelperOptions): Promise<GitCredentialSetupStatus>;
|
|
304
|
+
/**
|
|
305
|
+
* Whether git asks b6p alone for the host of one clone's remote (`origin` by default), reading
|
|
306
|
+
* the config in effect in that clone (its local and worktree config included), so a consumer can
|
|
307
|
+
* warn after a `kb pull` or `script pull` that git there would also ask another helper. `null`
|
|
308
|
+
* when the clone has no such remote, or its URL's host is not an allowed one. Changes nothing.
|
|
309
|
+
*
|
|
310
|
+
* @throws {Err.GitCredentialSetupError} when git is missing or older than {@link GIT_MATCHING_FLOOR}.
|
|
311
|
+
* @lastreviewed null
|
|
312
|
+
*/
|
|
313
|
+
cloneStatus(dir: string, options?: GitCredentialCloneOptions): Promise<GitCredentialHostStatus | null>;
|
|
314
|
+
/**
|
|
315
|
+
* Make b6p the helper git asks for every allowed host, in the user's global git config, the way
|
|
316
|
+
* `gh auth setup-git` does: a new `[credential "https://<host>"]` section holding an empty
|
|
317
|
+
* `helper =` (a reset, so no earlier helper such as `store` or `cache` answers that host or keeps
|
|
318
|
+
* the token) and then `helper =` b6p's command, appended in one edit to the file git itself says
|
|
319
|
+
* `git config --global` writes ({@link GitConfigRunner.globalFile}), under git's own lock on that
|
|
320
|
+
* file, so the pair is written whole or not at all.
|
|
321
|
+
*
|
|
322
|
+
* A host is repaired when the system and global config (the files setup can change) do not
|
|
323
|
+
* certainly make git ask b6p alone; one that does is left alone, so a second run changes
|
|
324
|
+
* nothing. b6p's own entries for a repaired host, and its reset pairs
|
|
325
|
+
* ({@link GitCredentialResetState}), are taken out first, so neither line is ever doubled. Every
|
|
326
|
+
* pair written is recorded ({@link GitCredentialResets}) before and after the edit. The user's
|
|
327
|
+
* entries are never moved or deleted: one that still applies after b6p's (a `*.bluestep.net`
|
|
328
|
+
* helper later in the config, a repository's own helper, say) leaves the host
|
|
329
|
+
* `configured: false` in `hosts` (read as {@link setupStatus} reads, in `cwd`), with the entry in
|
|
330
|
+
* `others`.
|
|
331
|
+
*
|
|
332
|
+
* The whole run holds the git config lock ({@link GitCredentialResets.exclusive}), so two setups,
|
|
333
|
+
* or a setup and a removal, never interleave, in one process or several.
|
|
334
|
+
*
|
|
335
|
+
* @throws {Err.GitCredentialSetupError} when git is missing or older than {@link GIT_SETUP_FLOOR}, a
|
|
336
|
+
* config file cannot be read, locked or written, or `git config` fails.
|
|
337
|
+
* @lastreviewed null
|
|
338
|
+
*/
|
|
339
|
+
setupGit(options?: GitCredentialHelperOptions): Promise<GitCredentialSetupResult>;
|
|
340
|
+
/**
|
|
341
|
+
* Take b6p out of the user's global git config: each reset pair that is b6p's
|
|
342
|
+
* ({@link GitCredentialResetState}) with one of `helpers` after it, both lines in one edit under
|
|
343
|
+
* git's lock on the file, then every other `credential.<url>.helper` entry whose value is one of
|
|
344
|
+
* `helpers`, for any URL and in any spelling (a host no longer allowed included), each from the
|
|
345
|
+
* file it came from. Only system-independent global files are edited; a repository's config is
|
|
346
|
+
* never touched. A reset b6p did not write, or whose ownership is not certain, is never removed,
|
|
347
|
+
* whatever sits next to it; one b6p wrote but cannot tell apart is reported in `keptResets`.
|
|
348
|
+
* Holds the git config lock throughout, as {@link setupGit} does.
|
|
349
|
+
*
|
|
350
|
+
* @throws {Err.GitCredentialSetupError} when git is missing or older than {@link GIT_MATCHING_FLOOR},
|
|
351
|
+
* a config file cannot be locked or written, or `git config` fails.
|
|
352
|
+
* @lastreviewed null
|
|
353
|
+
*/
|
|
354
|
+
removeGit(options?: GitCredentialRemoveOptions): Promise<GitCredentialRemoveResult>;
|
|
355
|
+
private statusOf;
|
|
356
|
+
private get pathStyle();
|
|
357
|
+
private scopeAt;
|
|
358
|
+
private requireGit;
|
|
359
|
+
private gitVersion;
|
|
360
|
+
/**
|
|
361
|
+
* Append b6p's reset-then-`helper` pair for `host` to `file` in one edit under git's lock,
|
|
362
|
+
* recorded `adding` (with the pairs the key had) before and `installed` after; when the edit
|
|
363
|
+
* throws, the record is settled from the file as it then is. The edit is refused when the file no
|
|
364
|
+
* longer holds what the record counted, or does not parse.
|
|
365
|
+
* @lastreviewed null
|
|
366
|
+
*/
|
|
367
|
+
private install;
|
|
368
|
+
/**
|
|
369
|
+
* Take out b6p's entries for the URLs `urls` passes, in global files only. First each reset pair of
|
|
370
|
+
* b6p's (`owned`) whose helper is one of `helpers` (or, for `pairs: "any"`, whatever its helper,
|
|
371
|
+
* as setup replacing its own pair does): re-read under git's lock on its file, and removed, both
|
|
372
|
+
* lines in that one edit, only when the file holds exactly one such pair. A file with several,
|
|
373
|
+
* and every `unconfirmed` claim, is reported and forgotten, and only its helper lines go, so what
|
|
374
|
+
* is left is an inert reset. Then b6p's other helper entries, each spelling from its own file.
|
|
375
|
+
* @lastreviewed null
|
|
376
|
+
*/
|
|
377
|
+
private removeFor;
|
|
378
|
+
/**
|
|
379
|
+
* Settle every reset record against the config as it is now ({@link GitCredentialResetState})
|
|
380
|
+
* and return the claims that stand: `owned` (installed, its pair in place) and `unconfirmed`.
|
|
381
|
+
* Ownership is never inferred from a count of empty values: an installed record whose helper no
|
|
382
|
+
* longer directly follows an empty value of its key in its file is dropped, and an addition that
|
|
383
|
+
* left the file with any number of pairs but the two it predicts becomes `unconfirmed`.
|
|
384
|
+
* @lastreviewed null
|
|
385
|
+
*/
|
|
386
|
+
private settleResets;
|
|
387
|
+
private get;
|
|
388
|
+
private gatewayHost;
|
|
389
|
+
private helperEntries;
|
|
390
|
+
}
|