@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,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One variable of a git config file, as git 2.53's parser (config.c `git_parse_source`,
|
|
3
|
+
* `get_base_var`, `get_extended_base_var`, `get_value`, `parse_value`) reads it, with where its text
|
|
4
|
+
* sits in the file.
|
|
5
|
+
* @lastreviewed null
|
|
6
|
+
*/
|
|
7
|
+
export interface ConfigFileEntry {
|
|
8
|
+
/**
|
|
9
|
+
* The key as `git config` prints it: section (and a `[section.sub]` subsection) lowercase, a
|
|
10
|
+
* quoted subsection as written, name lowercase.
|
|
11
|
+
* @lastreviewed null
|
|
12
|
+
*/
|
|
13
|
+
readonly key: string;
|
|
14
|
+
/**
|
|
15
|
+
* The value, `null` for a key with no `=`.
|
|
16
|
+
* @lastreviewed null
|
|
17
|
+
*/
|
|
18
|
+
readonly value: string | null;
|
|
19
|
+
/**
|
|
20
|
+
* Where its line starts and where its last line (continuations included) ends, after the newline.
|
|
21
|
+
* @lastreviewed null
|
|
22
|
+
*/
|
|
23
|
+
readonly lineStart: number;
|
|
24
|
+
readonly lineEnd: number;
|
|
25
|
+
/**
|
|
26
|
+
* Whether nothing but whitespace precedes it on its first line (no section header before it).
|
|
27
|
+
* @lastreviewed null
|
|
28
|
+
*/
|
|
29
|
+
readonly ownLine: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* The section header it is under: its line's start and end, or `-1` before any header.
|
|
32
|
+
* @lastreviewed null
|
|
33
|
+
*/
|
|
34
|
+
readonly headerStart: number;
|
|
35
|
+
readonly headerEnd: number;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Parse a git config file's text. `null` where git would reject it (a bad header, an unknown escape,
|
|
39
|
+
* an unterminated quote), so nothing is edited in a file git itself cannot read. The text is the
|
|
40
|
+
* file's bytes, one latin1 character each, as `editConfigFile` reads it (a JavaScript string of the
|
|
41
|
+
* same ASCII content parses the same way).
|
|
42
|
+
* @lastreviewed null
|
|
43
|
+
*/
|
|
44
|
+
export declare function parseConfigFile(text: string): ConfigFileEntry[] | null;
|
|
45
|
+
/**
|
|
46
|
+
* The places in a parsed file where `helper` directly follows an empty value among `key`'s
|
|
47
|
+
* values (the pair setup writes), counted as git sees them, wherever they sit on their lines (a
|
|
48
|
+
* reset on its section's header line included): each as the two entries.
|
|
49
|
+
* @lastreviewed null
|
|
50
|
+
*/
|
|
51
|
+
export declare function pairsIn(entries: readonly ConfigFileEntry[], key: string, helper: string): [ConfigFileEntry, ConfigFileEntry][];
|
|
52
|
+
/**
|
|
53
|
+
* `text` with a new `[credential "<url>"]` section appended, holding a reset and then `helper`.
|
|
54
|
+
* The file is first made to end cleanly: a last line without a newline gets one, and a last line
|
|
55
|
+
* ending in an unescaped `\` (a value continued onto the next line) is followed by an empty line,
|
|
56
|
+
* which ends the continued value with nothing added, so git reads every existing value as before.
|
|
57
|
+
* @lastreviewed null
|
|
58
|
+
*/
|
|
59
|
+
export declare function appendPair(text: string, url: string, helper: string): string;
|
|
60
|
+
/**
|
|
61
|
+
* `text` without the two lines of `pair`, and without their section header too when nothing but
|
|
62
|
+
* whitespace is left under it.
|
|
63
|
+
* @lastreviewed null
|
|
64
|
+
*/
|
|
65
|
+
export declare function removePair(text: string, entries: readonly ConfigFileEntry[], pair: [ConfigFileEntry, ConfigFileEntry]): string;
|
|
66
|
+
/**
|
|
67
|
+
* Whether `after` holds every entry of `before`, keys and values as git reads them, in order, and
|
|
68
|
+
* then exactly `added` more.
|
|
69
|
+
* @lastreviewed null
|
|
70
|
+
*/
|
|
71
|
+
export declare function keepsEntries(before: readonly ConfigFileEntry[], after: readonly ConfigFileEntry[], added: number): boolean;
|
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseConfigFile = parseConfigFile;
|
|
4
|
+
exports.pairsIn = pairsIn;
|
|
5
|
+
exports.appendPair = appendPair;
|
|
6
|
+
exports.removePair = removePair;
|
|
7
|
+
exports.keepsEntries = keepsEntries;
|
|
8
|
+
const isKeyChar = (c) => /^[A-Za-z0-9-]$/.test(c);
|
|
9
|
+
// git's own isspace (ctype.c): space, tab, LF and CR only.
|
|
10
|
+
const isSpace = (c) => c === " " || c === "\t" || c === "\n" || c === "\r";
|
|
11
|
+
/**
|
|
12
|
+
* Parse a git config file's text. `null` where git would reject it (a bad header, an unknown escape,
|
|
13
|
+
* an unterminated quote), so nothing is edited in a file git itself cannot read. The text is the
|
|
14
|
+
* file's bytes, one latin1 character each, as `editConfigFile` reads it (a JavaScript string of the
|
|
15
|
+
* same ASCII content parses the same way).
|
|
16
|
+
* @lastreviewed null
|
|
17
|
+
*/
|
|
18
|
+
function parseConfigFile(text) {
|
|
19
|
+
let pos = text.startsWith("\xEF\xBB\xBF") ? 3 : text.startsWith("\uFEFF") ? 1 : 0;
|
|
20
|
+
// get_next_char: CRLF reads as LF, the end of the text as a final LF.
|
|
21
|
+
const next = () => {
|
|
22
|
+
if (pos >= text.length) {
|
|
23
|
+
pos = text.length + 1;
|
|
24
|
+
return "\n";
|
|
25
|
+
}
|
|
26
|
+
let c = text[pos++];
|
|
27
|
+
if (c === "\r" && text[pos] === "\n") {
|
|
28
|
+
c = text[pos++];
|
|
29
|
+
}
|
|
30
|
+
return c;
|
|
31
|
+
};
|
|
32
|
+
const eof = () => pos > text.length;
|
|
33
|
+
const lineStartOf = (at) => text.lastIndexOf("\n", at - 1) + 1;
|
|
34
|
+
const entries = [];
|
|
35
|
+
let stem = "";
|
|
36
|
+
let headerStart = -1;
|
|
37
|
+
let headerEnd = -1;
|
|
38
|
+
let comment = false;
|
|
39
|
+
for (;;) {
|
|
40
|
+
const at = pos;
|
|
41
|
+
const c = next();
|
|
42
|
+
if (c === "\n") {
|
|
43
|
+
if (eof()) {
|
|
44
|
+
return entries;
|
|
45
|
+
}
|
|
46
|
+
comment = false;
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
if (comment || isSpace(c)) {
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
if (c === "#" || c === ";") {
|
|
53
|
+
comment = true;
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
if (c === "[") {
|
|
57
|
+
headerStart = lineStartOf(at);
|
|
58
|
+
let name = "";
|
|
59
|
+
for (;;) {
|
|
60
|
+
const h = next();
|
|
61
|
+
if (eof()) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
if (h === "]") {
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
if (isSpace(h)) {
|
|
68
|
+
if (h === "\n") {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
let q = next();
|
|
72
|
+
while (isSpace(q)) {
|
|
73
|
+
if (q === "\n") {
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
q = next();
|
|
77
|
+
}
|
|
78
|
+
if (q !== '"') {
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
name += ".";
|
|
82
|
+
for (;;) {
|
|
83
|
+
let s = next();
|
|
84
|
+
if (s === "\n") {
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
if (s === '"') {
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
if (s === "\\") {
|
|
91
|
+
s = next();
|
|
92
|
+
if (s === "\n") {
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
name += s;
|
|
97
|
+
}
|
|
98
|
+
if (next() !== "]") {
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
if (!isKeyChar(h) && h !== ".") {
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
name += h.toLowerCase();
|
|
107
|
+
}
|
|
108
|
+
if (name === "") {
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
stem = `${name}.`;
|
|
112
|
+
const close = text.indexOf("\n", pos - 1);
|
|
113
|
+
headerEnd = close === -1 ? text.length : close + 1;
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
if (!/^[A-Za-z]$/.test(c)) {
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
const lineStart = lineStartOf(at);
|
|
120
|
+
const ownLine = text.slice(lineStart, at).trim() === "" && lineStart >= headerEnd;
|
|
121
|
+
let name = c.toLowerCase();
|
|
122
|
+
let k = next();
|
|
123
|
+
while (!eof() && isKeyChar(k)) {
|
|
124
|
+
name += k.toLowerCase();
|
|
125
|
+
k = next();
|
|
126
|
+
}
|
|
127
|
+
while (k === " " || k === "\t") {
|
|
128
|
+
k = next();
|
|
129
|
+
}
|
|
130
|
+
let value = null;
|
|
131
|
+
if (k !== "\n") {
|
|
132
|
+
if (k !== "=") {
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
value = parseValue(next);
|
|
136
|
+
if (value === null) {
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
entries.push({
|
|
141
|
+
key: stem + name,
|
|
142
|
+
value,
|
|
143
|
+
lineStart,
|
|
144
|
+
lineEnd: Math.min(pos, text.length),
|
|
145
|
+
ownLine,
|
|
146
|
+
headerStart,
|
|
147
|
+
headerEnd,
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
// parse_value: quotes, the escapes git knows, `;`/`#` comments outside quotes, trailing blanks dropped.
|
|
152
|
+
function parseValue(next) {
|
|
153
|
+
let quote = false;
|
|
154
|
+
let comment = false;
|
|
155
|
+
let value = "";
|
|
156
|
+
let trimLen = 0;
|
|
157
|
+
for (;;) {
|
|
158
|
+
let c = next();
|
|
159
|
+
if (c === "\n") {
|
|
160
|
+
if (quote) {
|
|
161
|
+
return null;
|
|
162
|
+
}
|
|
163
|
+
return trimLen ? value.slice(0, trimLen) : value;
|
|
164
|
+
}
|
|
165
|
+
if (comment) {
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
if (isSpace(c) && !quote) {
|
|
169
|
+
if (!trimLen) {
|
|
170
|
+
trimLen = value.length;
|
|
171
|
+
}
|
|
172
|
+
if (value.length) {
|
|
173
|
+
value += c;
|
|
174
|
+
}
|
|
175
|
+
continue;
|
|
176
|
+
}
|
|
177
|
+
if (!quote && (c === ";" || c === "#")) {
|
|
178
|
+
comment = true;
|
|
179
|
+
continue;
|
|
180
|
+
}
|
|
181
|
+
trimLen = 0;
|
|
182
|
+
if (c === "\\") {
|
|
183
|
+
c = next();
|
|
184
|
+
if (c === "\n") {
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
187
|
+
const escaped = { t: "\t", b: "\b", n: "\n", "\\": "\\", '"': '"' };
|
|
188
|
+
if (!(c in escaped)) {
|
|
189
|
+
return null;
|
|
190
|
+
}
|
|
191
|
+
value += escaped[c];
|
|
192
|
+
continue;
|
|
193
|
+
}
|
|
194
|
+
if (c === '"') {
|
|
195
|
+
quote = !quote;
|
|
196
|
+
continue;
|
|
197
|
+
}
|
|
198
|
+
value += c;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* The places in a parsed file where `helper` directly follows an empty value among `key`'s
|
|
203
|
+
* values (the pair setup writes), counted as git sees them, wherever they sit on their lines (a
|
|
204
|
+
* reset on its section's header line included): each as the two entries.
|
|
205
|
+
* @lastreviewed null
|
|
206
|
+
*/
|
|
207
|
+
function pairsIn(entries, key, helper) {
|
|
208
|
+
const values = entries.filter((e) => e.key === key);
|
|
209
|
+
const pairs = [];
|
|
210
|
+
for (let i = 0; i + 1 < values.length; i++) {
|
|
211
|
+
const [reset, after] = [values[i], values[i + 1]];
|
|
212
|
+
if (reset.value === "" && after.value === helper) {
|
|
213
|
+
pairs.push([reset, after]);
|
|
214
|
+
i++;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
return pairs;
|
|
218
|
+
}
|
|
219
|
+
function quoteValue(value) {
|
|
220
|
+
return `"${value.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/\t/g, "\\t")}"`;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* `text` with a new `[credential "<url>"]` section appended, holding a reset and then `helper`.
|
|
224
|
+
* The file is first made to end cleanly: a last line without a newline gets one, and a last line
|
|
225
|
+
* ending in an unescaped `\` (a value continued onto the next line) is followed by an empty line,
|
|
226
|
+
* which ends the continued value with nothing added, so git reads every existing value as before.
|
|
227
|
+
* @lastreviewed null
|
|
228
|
+
*/
|
|
229
|
+
function appendPair(text, url, helper) {
|
|
230
|
+
const body = text.endsWith("\r\n") ? text.slice(0, -2) : text.endsWith("\n") ? text.slice(0, -1) : text;
|
|
231
|
+
const continued = (/\\+$/.exec(body)?.[0].length ?? 0) % 2 === 1;
|
|
232
|
+
let head = text === "" || body !== text ? text : `${text}\n`;
|
|
233
|
+
if (continued) {
|
|
234
|
+
head += "\n";
|
|
235
|
+
}
|
|
236
|
+
const sub = url.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
|
237
|
+
return `${head}[credential "${sub}"]\n\thelper =\n\thelper = ${quoteValue(helper)}\n`;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* `text` without the two lines of `pair`, and without their section header too when nothing but
|
|
241
|
+
* whitespace is left under it.
|
|
242
|
+
* @lastreviewed null
|
|
243
|
+
*/
|
|
244
|
+
function removePair(text, entries, pair) {
|
|
245
|
+
const [reset, helper] = pair;
|
|
246
|
+
const cut = [
|
|
247
|
+
[helper.lineStart, helper.lineEnd],
|
|
248
|
+
[reset.lineStart, reset.lineEnd],
|
|
249
|
+
];
|
|
250
|
+
const header = reset.headerStart;
|
|
251
|
+
if (header !== -1 && header === helper.headerStart) {
|
|
252
|
+
const others = entries.filter((e) => e.headerStart === header && e !== reset && e !== helper);
|
|
253
|
+
const sectionEnd = nextHeaderAfter(text, entries, reset.headerEnd);
|
|
254
|
+
const rest = text.slice(reset.headerEnd, reset.lineStart) +
|
|
255
|
+
text.slice(reset.lineEnd, helper.lineStart) +
|
|
256
|
+
text.slice(helper.lineEnd, sectionEnd);
|
|
257
|
+
const headerLine = text.slice(header, reset.headerEnd);
|
|
258
|
+
if (others.length === 0 && rest.trim() === "" && /^\s*\[[^\]]*\]\s*$/.test(headerLine)) {
|
|
259
|
+
cut.splice(0, 2, [header, sectionEnd]);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
let out = text;
|
|
263
|
+
for (const [start, end] of cut.sort((a, b) => b[0] - a[0])) {
|
|
264
|
+
out = out.slice(0, start) + out.slice(end);
|
|
265
|
+
}
|
|
266
|
+
return out;
|
|
267
|
+
}
|
|
268
|
+
function nextHeaderAfter(text, entries, from) {
|
|
269
|
+
const starts = entries.map((e) => e.headerStart).filter((h) => h >= from);
|
|
270
|
+
let end = starts.length ? Math.min(...starts) : text.length;
|
|
271
|
+
// A later header with no variables under it is not in `entries`: look for a `[` starting a line.
|
|
272
|
+
const re = /^[ \t]*\[/gm;
|
|
273
|
+
re.lastIndex = from;
|
|
274
|
+
const m = re.exec(text);
|
|
275
|
+
if (m && m.index < end) {
|
|
276
|
+
end = m.index;
|
|
277
|
+
}
|
|
278
|
+
return end;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Whether `after` holds every entry of `before`, keys and values as git reads them, in order, and
|
|
282
|
+
* then exactly `added` more.
|
|
283
|
+
* @lastreviewed null
|
|
284
|
+
*/
|
|
285
|
+
function keepsEntries(before, after, added) {
|
|
286
|
+
return (after.length === before.length + added &&
|
|
287
|
+
before.every((entry, i) => entry.key === after[i].key && entry.value === after[i].value));
|
|
288
|
+
}
|
|
289
|
+
//# sourceMappingURL=configFile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configFile.js","sourceRoot":"","sources":["../../src/gitCredential/configFile.ts"],"names":[],"mappings":";;;;;;;AAqCA,MAAM,SAAS,GAAG,CAAC,CAAS,EAAW,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACnE,2DAA2D;AAC3D,MAAM,OAAO,GAAG,CAAC,CAAS,EAAW,EAAE,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,IAAI,CAAC;AAE5F;;;;;;GAMG;AACH,yBAAgC,IAAY;IAC1C,IAAI,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,C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C,MAAM,CAAC;IAC5D,iGAAiG;IACjG,MAAM,EAAE,GAAG,aAAa,CAAC;IACzB,EAAE,CAAC,SAAS,GAAG,IAAI,CAAC;IACpB,MAAM,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACxB,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,GAAG,GAAG,EAAE,CAAC;QACvB,GAAG,GAAG,CAAC,CAAC,KAAK,CAAC;IAChB,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;;GAIG;AACH,sBACE,MAAkC,EAClC,KAAiC,EACjC,KAAa;IAEb,OAAO,CACL,KAAK,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM,GAAG,KAAK;QACtC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,KAAK,CAAC,KAAK,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CACzF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One `credential.helper` or `credential.<url>.helper` entry, or an `includeIf.<condition>.path`
|
|
3
|
+
* entry, of the git config in effect where it was read (system, global, the repository's local
|
|
4
|
+
* and worktree files, the command line and `GIT_CONFIG_COUNT`, and what they include), in git's
|
|
5
|
+
* order.
|
|
6
|
+
* @lastreviewed null
|
|
7
|
+
*/
|
|
8
|
+
export interface GitCredentialConfigEntry {
|
|
9
|
+
/**
|
|
10
|
+
* The key exactly as git prints it: section and name lowercase, the URL subsection as written
|
|
11
|
+
* (git treats it as case-sensitive when writing).
|
|
12
|
+
* @lastreviewed null
|
|
13
|
+
*/
|
|
14
|
+
readonly key: string;
|
|
15
|
+
readonly value: string;
|
|
16
|
+
/**
|
|
17
|
+
* The file it came from, or `null` when it did not come from a file.
|
|
18
|
+
* @lastreviewed null
|
|
19
|
+
*/
|
|
20
|
+
readonly file: string | null;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* A {@link GitCredentialConfigEntry} with its scope (`system`, `global`, `local`, `worktree`,
|
|
24
|
+
* `command`), what it is (a credential helper, or a conditional include whose file may add one in
|
|
25
|
+
* another repository), and for a helper its URL pattern: the subsection (`""` for
|
|
26
|
+
* `[credential ""]`), or `null` for the generic `credential.helper`.
|
|
27
|
+
* @lastreviewed null
|
|
28
|
+
*/
|
|
29
|
+
export interface HelperEntry extends GitCredentialConfigEntry {
|
|
30
|
+
readonly scope: string;
|
|
31
|
+
readonly kind: "helper" | "includeif" | "username";
|
|
32
|
+
readonly url: string | null;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The `git config` arguments that list every credential and conditional-include entry of the
|
|
36
|
+
* config in effect, includes followed, with scope and origin. No scope option: git 2.53's
|
|
37
|
+
* `--global` reads only the file it would write, which misses `$XDG_CONFIG_HOME/git/config` beside
|
|
38
|
+
* `~/.gitconfig`, and status needs every scope.
|
|
39
|
+
* @lastreviewed null
|
|
40
|
+
*/
|
|
41
|
+
export declare const LIST_CREDENTIAL_ENTRIES: readonly string[];
|
|
42
|
+
/**
|
|
43
|
+
* The helper and conditional-include entries of `git config` output for
|
|
44
|
+
* {@link LIST_CREDENTIAL_ENTRIES}: each entry is `<scope>\0<origin>\0<key>\n<value>\0` (no `\n` for
|
|
45
|
+
* a key with no value), every scope kept.
|
|
46
|
+
* @lastreviewed null
|
|
47
|
+
*/
|
|
48
|
+
export declare function parseHelperEntries(stdout: string): HelperEntry[];
|
|
49
|
+
/**
|
|
50
|
+
* Whether a `credential.<url>.*` entry applies to the requests b6p answers for one allowed host:
|
|
51
|
+
*
|
|
52
|
+
* - `yes`: to every one of them, whatever the repository path, the spelling of the host or the
|
|
53
|
+
* username in the remote URL;
|
|
54
|
+
* - `no`: to none;
|
|
55
|
+
* - `maybe`: to some (an entry scoped to a path, one naming the `b6p` user, a partial-URL entry
|
|
56
|
+
* whose host git compares as written).
|
|
57
|
+
* @lastreviewed null
|
|
58
|
+
*/
|
|
59
|
+
export type CredentialContextMatch = "yes" | "no" | "maybe";
|
|
60
|
+
/**
|
|
61
|
+
* How a `credential.<url>.*` entry (`url` the subsection, `null` for the generic entry) applies to
|
|
62
|
+
* the https requests b6p answers for `host` (`host[:port]`, as on the allowlist), following git
|
|
63
|
+
* 2.53's credential contexts exactly: every matching entry applies, in config order (select_all).
|
|
64
|
+
*
|
|
65
|
+
* - A pattern git can normalize (urlmatch.c url_normalize_1) matches by scheme (case-insensitive),
|
|
66
|
+
* host (case-insensitive, a whole `*` label matching any one label, no `%` escapes), port
|
|
67
|
+
* (leading zeros dropped, the scheme's default the same as none), the user when it names one,
|
|
68
|
+
* and the path as a prefix on a `/` boundary (escapes normalized, dot segments resolved).
|
|
69
|
+
* - Any other pattern (no scheme, a missing host as in `https://`, a `%` in the host, port 0) is
|
|
70
|
+
* matched as credential.c match_partial_url does: each part it names, percent-decoded, must
|
|
71
|
+
* equal the request's exactly. `https://` names only the protocol, so it matches every https
|
|
72
|
+
* request.
|
|
73
|
+
*
|
|
74
|
+
* A request's path, the case of its host and a username in the remote URL are not known here, so
|
|
75
|
+
* an entry that depends on them is `maybe`. A pattern naming any user is `maybe` for the host it
|
|
76
|
+
* names, never `no`: a remote URL naming that user (`https://alice@host`) brings its helper in, which
|
|
77
|
+
* may answer `username=b6p` without a password, and git then asks b6p, which answers with the token
|
|
78
|
+
* and hands it to every helper asked on `store`. (The partial-URL fallback also compares the
|
|
79
|
+
* username a `credential.username` entry has set so far, which can be any.)
|
|
80
|
+
* @lastreviewed null
|
|
81
|
+
*/
|
|
82
|
+
export declare function credentialContextMatch(url: string | null, host: string): CredentialContextMatch;
|
|
83
|
+
/**
|
|
84
|
+
* Whether git may use a `credential.<url>.*` entry for a request b6p answers for `host`: its
|
|
85
|
+
* {@link credentialContextMatch} is `yes` or `maybe`.
|
|
86
|
+
* @lastreviewed null
|
|
87
|
+
*/
|
|
88
|
+
export declare function patternApplies(url: string | null, host: string): boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Whether a URL pattern names exactly `https://<host>` in a form git normalizes (setup's own
|
|
91
|
+
* spelling, or another case or port spelling of it): no wildcard, user, path, query or other port.
|
|
92
|
+
* @lastreviewed null
|
|
93
|
+
*/
|
|
94
|
+
export declare function patternIsHost(url: string, host: string): boolean;
|
|
95
|
+
/**
|
|
96
|
+
* What git asks for `host`: every applying entry in order, each empty value clearing the list so
|
|
97
|
+
* far. `helpers` are b6p's own commands. Where an entry applies to only some of the requests
|
|
98
|
+
* ({@link credentialContextMatch} `maybe`), the answer takes the worst case for each question: a
|
|
99
|
+
* foreign helper counts as asked, and a reset or b6p's own entry counts as not applying when it
|
|
100
|
+
* would hide a foreign helper, and as applying when it would clear b6p.
|
|
101
|
+
*
|
|
102
|
+
* - `configured`: git certainly asks b6p and no other helper.
|
|
103
|
+
* - `alsoAsked`: the other helpers git may ask, in order, without repeats.
|
|
104
|
+
* - `others`: the entries that keep b6p from being the only helper asked: each other helper git
|
|
105
|
+
* may ask, each `includeIf` after the last reset (its file may add a helper in another
|
|
106
|
+
* repository), and the reset that may clear b6p when a b6p entry came before it.
|
|
107
|
+
* @lastreviewed null
|
|
108
|
+
*/
|
|
109
|
+
export declare function askedFor(entries: readonly HelperEntry[], host: string, helpers: ReadonlySet<string>): {
|
|
110
|
+
configured: boolean;
|
|
111
|
+
alsoAsked: string[];
|
|
112
|
+
others: GitCredentialConfigEntry[];
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* How config file paths are spelled and compared: `win32` (git for Windows reports forward
|
|
116
|
+
* slashes, a path b6p builds has backslashes, and the file system ignores case) or `posix`.
|
|
117
|
+
* @lastreviewed null
|
|
118
|
+
*/
|
|
119
|
+
export type ConfigPathStyle = "posix" | "win32";
|
|
120
|
+
/**
|
|
121
|
+
* The form of a config file path that two spellings of the same file share: on `win32`
|
|
122
|
+
* normalized with either slash and compared without case, on `posix` normalized.
|
|
123
|
+
* @lastreviewed null
|
|
124
|
+
*/
|
|
125
|
+
export declare function configPathKey(file: string, style: ConfigPathStyle): string;
|
|
126
|
+
/**
|
|
127
|
+
* How many times `helper` directly follows an empty value among the values of `key` (exact
|
|
128
|
+
* spelling) in `file` (the pair setup writes), as git lists them.
|
|
129
|
+
* @lastreviewed null
|
|
130
|
+
*/
|
|
131
|
+
export declare function pairsOf(entries: readonly HelperEntry[], file: string, key: string, helper: string, style: ConfigPathStyle): number;
|
|
132
|
+
/**
|
|
133
|
+
* The value as a POSIX extended regex matching exactly it (git's value-pattern).
|
|
134
|
+
* @lastreviewed null
|
|
135
|
+
*/
|
|
136
|
+
export declare function exactValuePattern(value: string): string;
|
|
137
|
+
/**
|
|
138
|
+
* The key setup writes for `host`.
|
|
139
|
+
* @lastreviewed null
|
|
140
|
+
*/
|
|
141
|
+
export declare function helperKeyFor(host: string): string;
|
|
142
|
+
/**
|
|
143
|
+
* The URL pattern of a `credential.<url>.helper` key, or `null` for any other key.
|
|
144
|
+
* @lastreviewed null
|
|
145
|
+
*/
|
|
146
|
+
export declare function urlOfKey(key: string): string | null;
|