@bluestep-systems/b6p-core 1.1.0 → 1.3.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 +199 -55
- 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 +40 -0
- package/dist/Err.js +58 -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/Gateway.d.ts +1 -0
- package/dist/constants/Gateway.js +1 -0
- package/dist/constants/Gateway.js.map +1 -1
- 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.d.ts +32 -0
- package/dist/gateway/GatewayClient.js +21 -2
- package/dist/gateway/GatewayClient.js.map +1 -1
- package/dist/gateway/GatewayKb.d.ts +56 -1
- package/dist/gateway/GatewayKb.js +205 -0
- package/dist/gateway/GatewayKb.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 +16 -3
- 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 +24 -0
- package/dist/testing/FakeGateway.js +176 -0
- package/dist/testing/FakeGateway.js.map +1 -1
- package/dist/types.d.ts +95 -0
- package/package.json +2 -2
|
@@ -0,0 +1,523 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.LIST_CREDENTIAL_ENTRIES = void 0;
|
|
37
|
+
exports.parseHelperEntries = parseHelperEntries;
|
|
38
|
+
exports.credentialContextMatch = credentialContextMatch;
|
|
39
|
+
exports.patternApplies = patternApplies;
|
|
40
|
+
exports.patternIsHost = patternIsHost;
|
|
41
|
+
exports.askedFor = askedFor;
|
|
42
|
+
exports.configPathKey = configPathKey;
|
|
43
|
+
exports.pairsOf = pairsOf;
|
|
44
|
+
exports.exactValuePattern = exactValuePattern;
|
|
45
|
+
exports.helperKeyFor = helperKeyFor;
|
|
46
|
+
exports.urlOfKey = urlOfKey;
|
|
47
|
+
const path = __importStar(require("node:path"));
|
|
48
|
+
const HELPER_KEY = /^credential\.(.*)\.helper$/i;
|
|
49
|
+
const INCLUDEIF_KEY = /^includeif\..*\.path$/i;
|
|
50
|
+
const USERNAME_KEY = /^credential\.(?:(.*)\.)?username$/i;
|
|
51
|
+
const GENERIC_HELPER_KEY = "credential.helper";
|
|
52
|
+
const FILE_ORIGIN = "file:";
|
|
53
|
+
/**
|
|
54
|
+
* The `git config` arguments that list every credential and conditional-include entry of the
|
|
55
|
+
* config in effect, includes followed, with scope and origin. No scope option: git 2.53's
|
|
56
|
+
* `--global` reads only the file it would write, which misses `$XDG_CONFIG_HOME/git/config` beside
|
|
57
|
+
* `~/.gitconfig`, and status needs every scope.
|
|
58
|
+
* @lastreviewed null
|
|
59
|
+
*/
|
|
60
|
+
exports.LIST_CREDENTIAL_ENTRIES = [
|
|
61
|
+
"--includes",
|
|
62
|
+
"--show-scope",
|
|
63
|
+
"--show-origin",
|
|
64
|
+
"--null",
|
|
65
|
+
"--get-regexp",
|
|
66
|
+
"^(credential|includeif)\\.",
|
|
67
|
+
];
|
|
68
|
+
/**
|
|
69
|
+
* The helper and conditional-include entries of `git config` output for
|
|
70
|
+
* {@link LIST_CREDENTIAL_ENTRIES}: each entry is `<scope>\0<origin>\0<key>\n<value>\0` (no `\n` for
|
|
71
|
+
* a key with no value), every scope kept.
|
|
72
|
+
* @lastreviewed null
|
|
73
|
+
*/
|
|
74
|
+
function parseHelperEntries(stdout) {
|
|
75
|
+
const fields = stdout.split("\0");
|
|
76
|
+
const entries = [];
|
|
77
|
+
for (let i = 0; i + 2 < fields.length; i += 3) {
|
|
78
|
+
const [scope, origin, record] = [fields[i], fields[i + 1], fields[i + 2]];
|
|
79
|
+
const newline = record.indexOf("\n");
|
|
80
|
+
const key = newline === -1 ? record : record.slice(0, newline);
|
|
81
|
+
const value = newline === -1 ? "" : record.slice(newline + 1);
|
|
82
|
+
const username = USERNAME_KEY.exec(key);
|
|
83
|
+
const url = username ? username[1] : HELPER_KEY.exec(key)?.[1];
|
|
84
|
+
const includeIf = INCLUDEIF_KEY.test(key);
|
|
85
|
+
if (!username && url === undefined && !includeIf && key.toLowerCase() !== GENERIC_HELPER_KEY) {
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
entries.push({
|
|
89
|
+
key,
|
|
90
|
+
value,
|
|
91
|
+
file: origin.startsWith(FILE_ORIGIN) ? origin.slice(FILE_ORIGIN.length) : null,
|
|
92
|
+
scope,
|
|
93
|
+
kind: includeIf ? "includeif" : username ? "username" : "helper",
|
|
94
|
+
url: url ?? null,
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
return entries;
|
|
98
|
+
}
|
|
99
|
+
function splitPort(authority) {
|
|
100
|
+
if (authority.startsWith("[")) {
|
|
101
|
+
const end = authority.indexOf("]");
|
|
102
|
+
const rest = end === -1 ? "" : authority.slice(end + 1);
|
|
103
|
+
return { host: authority.slice(0, end + 1), port: rest.startsWith(":") ? rest.slice(1) : "" };
|
|
104
|
+
}
|
|
105
|
+
const colon = authority.lastIndexOf(":");
|
|
106
|
+
return colon === -1
|
|
107
|
+
? { host: authority, port: "" }
|
|
108
|
+
: { host: authority.slice(0, colon), port: authority.slice(colon + 1) };
|
|
109
|
+
}
|
|
110
|
+
// git 2.53 urlmatch.c: the character classes of url_normalize_1 and append_normalized_escapes.
|
|
111
|
+
const URL_SCHEME_CHARS = /^[A-Za-z0-9+.-]*/;
|
|
112
|
+
const URL_HOST_CHARS = /^[A-Za-z0-9.\-_[:\]*]*/;
|
|
113
|
+
const URL_UNSAFE_CHARS = ' <>"%{}|\\^`';
|
|
114
|
+
const URL_RESERVED = ":/?#[]@!$&'()*+,;=";
|
|
115
|
+
// git's hex2chr: the byte two hex digits spell, or -1.
|
|
116
|
+
function hexByte(text, at) {
|
|
117
|
+
const pair = text.slice(at, at + 2);
|
|
118
|
+
return /^[0-9A-Fa-f]{2}$/.test(pair) ? parseInt(pair, 16) : -1;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* git's append_normalized_escapes with no extra escapes and the reserved delimiters left as found:
|
|
122
|
+
* `%XX` of an unreserved byte is decoded, an unsafe byte is escaped, every escape is uppercase.
|
|
123
|
+
* `null` for a `%` not followed by two hex digits (git then rejects the URL).
|
|
124
|
+
* @lastreviewed null
|
|
125
|
+
*/
|
|
126
|
+
function normalizeEscapes(text) {
|
|
127
|
+
const bytes = Buffer.from(text, "utf8");
|
|
128
|
+
let out = "";
|
|
129
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
130
|
+
let ch = bytes[i];
|
|
131
|
+
let wasEscaped = false;
|
|
132
|
+
if (ch === 0x25) {
|
|
133
|
+
const hex = bytes.subarray(i + 1, i + 3).toString("latin1");
|
|
134
|
+
const value = hex.length === 2 ? hexByte(hex, 0) : -1;
|
|
135
|
+
if (value < 0) {
|
|
136
|
+
return null;
|
|
137
|
+
}
|
|
138
|
+
ch = value;
|
|
139
|
+
i += 2;
|
|
140
|
+
wasEscaped = true;
|
|
141
|
+
}
|
|
142
|
+
const c = String.fromCharCode(ch);
|
|
143
|
+
if (ch <= 0x1f || ch >= 0x7f || URL_UNSAFE_CHARS.includes(c) || (wasEscaped && URL_RESERVED.includes(c))) {
|
|
144
|
+
out += `%${ch.toString(16).toUpperCase().padStart(2, "0")}`;
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
out += c;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return out;
|
|
151
|
+
}
|
|
152
|
+
// git's url_decode_mem: each `%XX` (but `%00`) becomes its byte; anything else stays as it is.
|
|
153
|
+
function urlDecode(text) {
|
|
154
|
+
const out = [];
|
|
155
|
+
const bytes = Buffer.from(text, "utf8");
|
|
156
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
157
|
+
if (bytes[i] === 0x25 && i + 2 < bytes.length) {
|
|
158
|
+
const value = hexByte(bytes.subarray(i + 1, i + 3).toString("latin1"), 0);
|
|
159
|
+
if (value > 0) {
|
|
160
|
+
out.push(value);
|
|
161
|
+
i += 2;
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
out.push(bytes[i]);
|
|
166
|
+
}
|
|
167
|
+
return Buffer.from(out).toString("utf8");
|
|
168
|
+
}
|
|
169
|
+
function normalizePattern(url) {
|
|
170
|
+
const spanned = URL_SCHEME_CHARS.exec(url)?.[0].length ?? 0;
|
|
171
|
+
if (spanned === 0 ||
|
|
172
|
+
!/^[A-Za-z]/.test(url) ||
|
|
173
|
+
spanned + 3 > url.length ||
|
|
174
|
+
url.slice(spanned, spanned + 3) !== "://") {
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
177
|
+
const scheme = url.slice(0, spanned).toLowerCase();
|
|
178
|
+
let rest = url.slice(spanned + 3);
|
|
179
|
+
const delimiter = rest.search(/[/?#]/);
|
|
180
|
+
let slash = delimiter === -1 ? rest.length : delimiter;
|
|
181
|
+
let user = null;
|
|
182
|
+
const at = rest.indexOf("@");
|
|
183
|
+
if (at !== -1 && at < slash) {
|
|
184
|
+
user = "";
|
|
185
|
+
if (at > 0) {
|
|
186
|
+
const userinfo = normalizeEscapes(rest.slice(0, at));
|
|
187
|
+
if (userinfo === null) {
|
|
188
|
+
return null;
|
|
189
|
+
}
|
|
190
|
+
const colon = userinfo.indexOf(":");
|
|
191
|
+
user = colon === -1 ? userinfo : userinfo.slice(0, colon);
|
|
192
|
+
}
|
|
193
|
+
rest = rest.slice(at + 1);
|
|
194
|
+
slash -= at + 1;
|
|
195
|
+
}
|
|
196
|
+
if (rest === "" || ":/?#".includes(rest[0])) {
|
|
197
|
+
return null; // A missing host: only file: URLs may have one.
|
|
198
|
+
}
|
|
199
|
+
let colon = slash - 1;
|
|
200
|
+
while (colon > 0 && rest[colon] !== ":" && rest[colon] !== "]") {
|
|
201
|
+
colon--;
|
|
202
|
+
}
|
|
203
|
+
if (rest[colon] !== ":") {
|
|
204
|
+
colon = slash;
|
|
205
|
+
}
|
|
206
|
+
if ((URL_HOST_CHARS.exec(rest)?.[0].length ?? 0) < colon) {
|
|
207
|
+
return null; // Invalid characters in the host, a `%` escape included.
|
|
208
|
+
}
|
|
209
|
+
const host = rest.slice(0, colon).toLowerCase();
|
|
210
|
+
let port = "";
|
|
211
|
+
if (colon < slash) {
|
|
212
|
+
const written = rest.slice(colon + 1, slash);
|
|
213
|
+
const digits = written === "" ? "" : written.replace(/^0+/, "") || "0";
|
|
214
|
+
if (digits !== "" && !(scheme === "https" && digits === "443") && !(scheme === "http" && digits === "80")) {
|
|
215
|
+
if (!/^\d+$/.test(digits) || digits.length > 5 || Number(digits) === 0 || Number(digits) > 65535) {
|
|
216
|
+
return null;
|
|
217
|
+
}
|
|
218
|
+
port = digits;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
const path = normalizePath(rest.slice(slash));
|
|
222
|
+
return path === null ? null : { scheme, user, host, port, path };
|
|
223
|
+
}
|
|
224
|
+
// The path loop of url_normalize_1: escapes normalized, `.` and `..` resolved, the rest appended.
|
|
225
|
+
function normalizePath(written) {
|
|
226
|
+
let rest = written.startsWith("/") ? written.slice(1) : written;
|
|
227
|
+
let norm = "/";
|
|
228
|
+
for (;;) {
|
|
229
|
+
const segmentStart = norm.length;
|
|
230
|
+
const found = rest.search(/[/?#]/);
|
|
231
|
+
const next = found === -1 ? rest.length : found;
|
|
232
|
+
const segment = normalizeEscapes(rest.slice(0, next));
|
|
233
|
+
if (segment === null) {
|
|
234
|
+
return null;
|
|
235
|
+
}
|
|
236
|
+
norm += segment;
|
|
237
|
+
let skipSlash = false;
|
|
238
|
+
if (segment === ".") {
|
|
239
|
+
if (segmentStart === 1) {
|
|
240
|
+
norm = norm.slice(0, -1);
|
|
241
|
+
skipSlash = true;
|
|
242
|
+
}
|
|
243
|
+
else {
|
|
244
|
+
norm = norm.slice(0, -2);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
else if (segment === "..") {
|
|
248
|
+
let previous = norm.length - 3;
|
|
249
|
+
if (previous <= 0) {
|
|
250
|
+
return null;
|
|
251
|
+
}
|
|
252
|
+
while (norm[--previous] !== "/") {
|
|
253
|
+
// Back to the slash before the previous segment.
|
|
254
|
+
}
|
|
255
|
+
if (previous === 0) {
|
|
256
|
+
norm = norm.slice(0, 1);
|
|
257
|
+
skipSlash = true;
|
|
258
|
+
}
|
|
259
|
+
else {
|
|
260
|
+
norm = norm.slice(0, previous);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
rest = rest.slice(next);
|
|
264
|
+
if (!rest.startsWith("/")) {
|
|
265
|
+
break;
|
|
266
|
+
}
|
|
267
|
+
rest = rest.slice(1);
|
|
268
|
+
if (!skipSlash) {
|
|
269
|
+
norm += "/";
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
if (rest !== "") {
|
|
273
|
+
const tail = normalizeEscapes(rest);
|
|
274
|
+
if (tail === null) {
|
|
275
|
+
return null;
|
|
276
|
+
}
|
|
277
|
+
norm += tail;
|
|
278
|
+
}
|
|
279
|
+
return norm;
|
|
280
|
+
}
|
|
281
|
+
// urlmatch.c match_host: label by label, a label that is exactly `*` matching any one.
|
|
282
|
+
function matchHost(have, pattern) {
|
|
283
|
+
let url = have;
|
|
284
|
+
let pat = pattern;
|
|
285
|
+
while (url !== "" && pat !== "") {
|
|
286
|
+
const urlDot = url.indexOf(".");
|
|
287
|
+
const patDot = pat.indexOf(".");
|
|
288
|
+
const urlLabel = urlDot === -1 ? url : url.slice(0, urlDot);
|
|
289
|
+
const patLabel = patDot === -1 ? pat : pat.slice(0, patDot);
|
|
290
|
+
if (patLabel !== "*" && patLabel !== urlLabel) {
|
|
291
|
+
return false;
|
|
292
|
+
}
|
|
293
|
+
url = urlDot === -1 ? "" : url.slice(urlDot + 1);
|
|
294
|
+
pat = patDot === -1 ? "" : pat.slice(patDot + 1);
|
|
295
|
+
}
|
|
296
|
+
return url === "" && pat === "";
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* credential.c match_partial_url, for a pattern git could not normalize: the pattern is split as
|
|
300
|
+
* credential_from_url_1 does with partial URLs allowed (parts percent-decoded), and each part it
|
|
301
|
+
* sets must equal the request's as written (case-sensitive), which is all git compares.
|
|
302
|
+
* @lastreviewed null
|
|
303
|
+
*/
|
|
304
|
+
function partialMatch(url, host) {
|
|
305
|
+
const protoEnd = url.indexOf("://");
|
|
306
|
+
const cp = protoEnd === -1 ? 0 : protoEnd + 3;
|
|
307
|
+
const at = url.indexOf("@", cp);
|
|
308
|
+
const colon = url.indexOf(":", cp);
|
|
309
|
+
const found = url.slice(cp).search(/[/?#]/);
|
|
310
|
+
const slash = found === -1 ? url.length : cp + found;
|
|
311
|
+
let username;
|
|
312
|
+
let hostStart = cp;
|
|
313
|
+
if (at !== -1 && slash > at) {
|
|
314
|
+
username = urlDecode(url.slice(cp, colon === -1 || at <= colon ? at : colon));
|
|
315
|
+
hostStart = at + 1;
|
|
316
|
+
}
|
|
317
|
+
const protocol = protoEnd > 0 ? url.slice(0, protoEnd) : undefined;
|
|
318
|
+
const wantHost = slash - hostStart > 0 ? urlDecode(url.slice(hostStart, slash)) : undefined;
|
|
319
|
+
let pathStart = slash;
|
|
320
|
+
while (url[pathStart] === "/") {
|
|
321
|
+
pathStart++;
|
|
322
|
+
}
|
|
323
|
+
const wantPath = pathStart < url.length ? urlDecode(url.slice(pathStart)) : undefined;
|
|
324
|
+
if ([username, protocol, wantHost, wantPath].some((part) => part?.includes("\n"))) {
|
|
325
|
+
return "no"; // git warns and skips the entry.
|
|
326
|
+
}
|
|
327
|
+
let match = "yes";
|
|
328
|
+
if (protocol !== undefined && protocol !== "https") {
|
|
329
|
+
return "no";
|
|
330
|
+
}
|
|
331
|
+
if (wantHost !== undefined) {
|
|
332
|
+
// The request's host is as the remote URL wrote it: b6p answers any case of the allowed host, and `:443` beside
|
|
333
|
+
// a default port, so a pattern naming one spelling matches only some of those requests.
|
|
334
|
+
const spellings = splitPort(host).port === "" ? [host, `${host}:443`] : [host];
|
|
335
|
+
if (!spellings.includes(wantHost.toLowerCase())) {
|
|
336
|
+
return "no";
|
|
337
|
+
}
|
|
338
|
+
match = "maybe";
|
|
339
|
+
}
|
|
340
|
+
if (username !== undefined) {
|
|
341
|
+
// A pattern naming any user may apply: the remote URL may name that user, and the helper may then
|
|
342
|
+
// answer `username=b6p`, after which git asks b6p, which answers (see credentialContextMatch).
|
|
343
|
+
match = "maybe";
|
|
344
|
+
}
|
|
345
|
+
if (wantPath !== undefined) {
|
|
346
|
+
match = "maybe"; // The request's path is the repository's.
|
|
347
|
+
}
|
|
348
|
+
return match;
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* How a `credential.<url>.*` entry (`url` the subsection, `null` for the generic entry) applies to
|
|
352
|
+
* the https requests b6p answers for `host` (`host[:port]`, as on the allowlist), following git
|
|
353
|
+
* 2.53's credential contexts exactly: every matching entry applies, in config order (select_all).
|
|
354
|
+
*
|
|
355
|
+
* - A pattern git can normalize (urlmatch.c url_normalize_1) matches by scheme (case-insensitive),
|
|
356
|
+
* host (case-insensitive, a whole `*` label matching any one label, no `%` escapes), port
|
|
357
|
+
* (leading zeros dropped, the scheme's default the same as none), the user when it names one,
|
|
358
|
+
* and the path as a prefix on a `/` boundary (escapes normalized, dot segments resolved).
|
|
359
|
+
* - Any other pattern (no scheme, a missing host as in `https://`, a `%` in the host, port 0) is
|
|
360
|
+
* matched as credential.c match_partial_url does: each part it names, percent-decoded, must
|
|
361
|
+
* equal the request's exactly. `https://` names only the protocol, so it matches every https
|
|
362
|
+
* request.
|
|
363
|
+
*
|
|
364
|
+
* A request's path, the case of its host and a username in the remote URL are not known here, so
|
|
365
|
+
* an entry that depends on them is `maybe`. A pattern naming any user is `maybe` for the host it
|
|
366
|
+
* names, never `no`: a remote URL naming that user (`https://alice@host`) brings its helper in, which
|
|
367
|
+
* may answer `username=b6p` without a password, and git then asks b6p, which answers with the token
|
|
368
|
+
* and hands it to every helper asked on `store`. (The partial-URL fallback also compares the
|
|
369
|
+
* username a `credential.username` entry has set so far, which can be any.)
|
|
370
|
+
* @lastreviewed null
|
|
371
|
+
*/
|
|
372
|
+
function credentialContextMatch(url, host) {
|
|
373
|
+
if (url === null) {
|
|
374
|
+
return "yes";
|
|
375
|
+
}
|
|
376
|
+
const pattern = normalizePattern(url);
|
|
377
|
+
if (pattern === null) {
|
|
378
|
+
return partialMatch(url, host);
|
|
379
|
+
}
|
|
380
|
+
const target = splitPort(host.toLowerCase());
|
|
381
|
+
if (pattern.scheme !== "https") {
|
|
382
|
+
return "no";
|
|
383
|
+
}
|
|
384
|
+
if (!matchHost(target.host, pattern.host)) {
|
|
385
|
+
return "no";
|
|
386
|
+
}
|
|
387
|
+
if (pattern.port !== (target.port === "443" ? "" : target.port)) {
|
|
388
|
+
return "no";
|
|
389
|
+
}
|
|
390
|
+
return pattern.user !== null || pattern.path !== "/" ? "maybe" : "yes";
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* Whether git may use a `credential.<url>.*` entry for a request b6p answers for `host`: its
|
|
394
|
+
* {@link credentialContextMatch} is `yes` or `maybe`.
|
|
395
|
+
* @lastreviewed null
|
|
396
|
+
*/
|
|
397
|
+
function patternApplies(url, host) {
|
|
398
|
+
return credentialContextMatch(url, host) !== "no";
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* Whether a URL pattern names exactly `https://<host>` in a form git normalizes (setup's own
|
|
402
|
+
* spelling, or another case or port spelling of it): no wildcard, user, path, query or other port.
|
|
403
|
+
* @lastreviewed null
|
|
404
|
+
*/
|
|
405
|
+
function patternIsHost(url, host) {
|
|
406
|
+
const pattern = normalizePattern(url);
|
|
407
|
+
const target = splitPort(host.toLowerCase());
|
|
408
|
+
return (pattern !== null &&
|
|
409
|
+
pattern.scheme === "https" &&
|
|
410
|
+
pattern.user === null &&
|
|
411
|
+
pattern.path === "/" &&
|
|
412
|
+
pattern.host === target.host &&
|
|
413
|
+
pattern.port === (target.port === "443" ? "" : target.port));
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* What git asks for `host`: every applying entry in order, each empty value clearing the list so
|
|
417
|
+
* far. `helpers` are b6p's own commands. Where an entry applies to only some of the requests
|
|
418
|
+
* ({@link credentialContextMatch} `maybe`), the answer takes the worst case for each question: a
|
|
419
|
+
* foreign helper counts as asked, and a reset or b6p's own entry counts as not applying when it
|
|
420
|
+
* would hide a foreign helper, and as applying when it would clear b6p.
|
|
421
|
+
*
|
|
422
|
+
* - `configured`: git certainly asks b6p and no other helper.
|
|
423
|
+
* - `alsoAsked`: the other helpers git may ask, in order, without repeats.
|
|
424
|
+
* - `others`: the entries that keep b6p from being the only helper asked: each other helper git
|
|
425
|
+
* may ask, each `includeIf` after the last reset (its file may add a helper in another
|
|
426
|
+
* repository), and the reset that may clear b6p when a b6p entry came before it.
|
|
427
|
+
* @lastreviewed null
|
|
428
|
+
*/
|
|
429
|
+
function askedFor(entries, host, helpers) {
|
|
430
|
+
let foreign = [];
|
|
431
|
+
let surelyB6p = false;
|
|
432
|
+
let clearedB6p = null;
|
|
433
|
+
for (const entry of entries) {
|
|
434
|
+
if (entry.kind === "username") {
|
|
435
|
+
continue;
|
|
436
|
+
}
|
|
437
|
+
if (entry.kind === "includeif") {
|
|
438
|
+
// Its file is read only where its condition holds; in another repository it may add a helper here.
|
|
439
|
+
foreign.push(entry);
|
|
440
|
+
continue;
|
|
441
|
+
}
|
|
442
|
+
const match = credentialContextMatch(entry.url, host);
|
|
443
|
+
if (match === "no") {
|
|
444
|
+
continue;
|
|
445
|
+
}
|
|
446
|
+
if (entry.value === "") {
|
|
447
|
+
if (match === "yes") {
|
|
448
|
+
foreign = [];
|
|
449
|
+
}
|
|
450
|
+
if (surelyB6p) {
|
|
451
|
+
clearedB6p = entry;
|
|
452
|
+
}
|
|
453
|
+
surelyB6p = false;
|
|
454
|
+
}
|
|
455
|
+
else if (helpers.has(entry.value)) {
|
|
456
|
+
surelyB6p ||= match === "yes";
|
|
457
|
+
}
|
|
458
|
+
else {
|
|
459
|
+
foreign.push(entry);
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
const others = foreign.map(({ key, value, file }) => ({ key, value, file }));
|
|
463
|
+
if (!surelyB6p && clearedB6p) {
|
|
464
|
+
others.push({ key: clearedB6p.key, value: clearedB6p.value, file: clearedB6p.file });
|
|
465
|
+
}
|
|
466
|
+
return {
|
|
467
|
+
configured: surelyB6p && foreign.length === 0,
|
|
468
|
+
alsoAsked: [...new Set(foreign.filter((e) => e.kind === "helper").map((e) => e.value))],
|
|
469
|
+
others,
|
|
470
|
+
};
|
|
471
|
+
}
|
|
472
|
+
/**
|
|
473
|
+
* The form of a config file path that two spellings of the same file share: on `win32`
|
|
474
|
+
* normalized with either slash and compared without case, on `posix` normalized.
|
|
475
|
+
* @lastreviewed null
|
|
476
|
+
*/
|
|
477
|
+
function configPathKey(file, style) {
|
|
478
|
+
return style === "win32" ? path.win32.normalize(file).toLowerCase() : path.posix.normalize(file);
|
|
479
|
+
}
|
|
480
|
+
function valuesOf(entries, file, key, style) {
|
|
481
|
+
const want = configPathKey(file, style);
|
|
482
|
+
return entries
|
|
483
|
+
.filter((e) => e.file !== null && e.key === key && configPathKey(e.file, style) === want)
|
|
484
|
+
.map((e) => e.value);
|
|
485
|
+
}
|
|
486
|
+
/**
|
|
487
|
+
* How many times `helper` directly follows an empty value among the values of `key` (exact
|
|
488
|
+
* spelling) in `file` (the pair setup writes), as git lists them.
|
|
489
|
+
* @lastreviewed null
|
|
490
|
+
*/
|
|
491
|
+
function pairsOf(entries, file, key, helper, style) {
|
|
492
|
+
const values = valuesOf(entries, file, key, style);
|
|
493
|
+
let pairs = 0;
|
|
494
|
+
for (let i = 0; i + 1 < values.length; i++) {
|
|
495
|
+
if (values[i] === "" && values[i + 1] === helper) {
|
|
496
|
+
pairs++;
|
|
497
|
+
i++;
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
return pairs;
|
|
501
|
+
}
|
|
502
|
+
/**
|
|
503
|
+
* The value as a POSIX extended regex matching exactly it (git's value-pattern).
|
|
504
|
+
* @lastreviewed null
|
|
505
|
+
*/
|
|
506
|
+
function exactValuePattern(value) {
|
|
507
|
+
return `^${value.replace(/[.[\]{}()\\*+?^$|]/g, "\\$&")}$`;
|
|
508
|
+
}
|
|
509
|
+
/**
|
|
510
|
+
* The key setup writes for `host`.
|
|
511
|
+
* @lastreviewed null
|
|
512
|
+
*/
|
|
513
|
+
function helperKeyFor(host) {
|
|
514
|
+
return `credential.https://${host}.helper`;
|
|
515
|
+
}
|
|
516
|
+
/**
|
|
517
|
+
* The URL pattern of a `credential.<url>.helper` key, or `null` for any other key.
|
|
518
|
+
* @lastreviewed null
|
|
519
|
+
*/
|
|
520
|
+
function urlOfKey(key) {
|
|
521
|
+
return HELPER_KEY.exec(key)?.[1] ?? null;
|
|
522
|
+
}
|
|
523
|
+
//# sourceMappingURL=credentialConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credentialConfig.js","sourceRoot":"","sources":["../../src/gitCredential/credentialConfig.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,IAAI,sCAAkB;AAqClC,MAAM,UAAU,GAAG,6BAA6B,CAAC;AACjD,MAAM,aAAa,GAAG,wBAAwB,CAAC;AAC/C,MAAM,YAAY,GAAG,oCAAoC,CAAC;AAC1D,MAAM,kBAAkB,GAAG,mBAAmB,CAAC;AAC/C,MAAM,WAAW,GAAG,OAAO,CAAC;AAE5B;;;;;;GAMG;AACU,QAAA,uBAAuB,GAAsB;IACxD,YAAY;IACZ,cAAc;IACd,eAAe;IACf,QAAQ;IACR,cAAc;IACd,4BAA4B;CAC7B,CAAC;AAEF;;;;;GAKG;A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M,GAAG,QAAQ,CAAC,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IACnD,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3C,IAAI,MAAM,CAAC,CAAC,CAAC,KAAK,EAAE,IAAI,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,MAAM,EAAE,CAAC;YACjD,KAAK,EAAE,CAAC;YACR,CAAC,EAAE,CAAC;QACN,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;GAGG;AACH,2BAAkC,KAAa;IAC7C,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,GAAG,CAAC;AAC7D,CAAC;AAED;;;GAGG;AACH,sBAA6B,IAAY;IACvC,OAAO,sBAAsB,IAAI,SAAS,CAAC;AAC7C,CAAC;AAED;;;GAGG;AACH,kBAAyB,GAAW;IAClC,OAAO,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;AAC3C,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The credential host of `url`: its `host` (lowercase, with the port only when it is not 443), or
|
|
3
|
+
* `null` when `url` is not https or carries a username or password. Only such a URL's host may
|
|
4
|
+
* join the allowlist.
|
|
5
|
+
* @lastreviewed null
|
|
6
|
+
*/
|
|
7
|
+
export declare function credentialHostOf(url: URL): string | null;
|
|
8
|
+
/**
|
|
9
|
+
* The host git asked about, in the form {@link credentialHostOf} gives, or `null` when it is not a
|
|
10
|
+
* bare host (with an optional port). The value must already be in that form, apart from case and
|
|
11
|
+
* an explicit `:443`: anything the URL parser would rewrite (an IPv4 shorthand, percent-escapes, an
|
|
12
|
+
* empty port) or that is not a host at all (a path, a userinfo, whitespace) is refused rather than
|
|
13
|
+
* normalized, so a lookalike can never normalize onto an allowed host. A trailing dot is kept, so
|
|
14
|
+
* such a host never equals an allowed one.
|
|
15
|
+
* @lastreviewed null
|
|
16
|
+
*/
|
|
17
|
+
export declare function requestedCredentialHost(host: string): string | null;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.credentialHostOf = credentialHostOf;
|
|
4
|
+
exports.requestedCredentialHost = requestedCredentialHost;
|
|
5
|
+
/**
|
|
6
|
+
* The credential host of `url`: its `host` (lowercase, with the port only when it is not 443), or
|
|
7
|
+
* `null` when `url` is not https or carries a username or password. Only such a URL's host may
|
|
8
|
+
* join the allowlist.
|
|
9
|
+
* @lastreviewed null
|
|
10
|
+
*/
|
|
11
|
+
function credentialHostOf(url) {
|
|
12
|
+
if (url.protocol !== "https:" || url.username !== "" || url.password !== "") {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
return url.host === "" ? null : url.host;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The host git asked about, in the form {@link credentialHostOf} gives, or `null` when it is not a
|
|
19
|
+
* bare host (with an optional port). The value must already be in that form, apart from case and
|
|
20
|
+
* an explicit `:443`: anything the URL parser would rewrite (an IPv4 shorthand, percent-escapes, an
|
|
21
|
+
* empty port) or that is not a host at all (a path, a userinfo, whitespace) is refused rather than
|
|
22
|
+
* normalized, so a lookalike can never normalize onto an allowed host. A trailing dot is kept, so
|
|
23
|
+
* such a host never equals an allowed one.
|
|
24
|
+
* @lastreviewed null
|
|
25
|
+
*/
|
|
26
|
+
function requestedCredentialHost(host) {
|
|
27
|
+
const lowered = host.toLowerCase();
|
|
28
|
+
// One host and at most one port, checked before the default port is dropped, so `host:8443:443` never becomes
|
|
29
|
+
// `host:8443`.
|
|
30
|
+
if (!/^(?:[a-z0-9.-]+|\[[0-9a-f:.]+\])(?::\d{1,5})?$/.test(lowered)) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
const withoutDefaultPort = lowered.endsWith(":443") ? lowered.slice(0, -":443".length) : lowered;
|
|
34
|
+
let parsed;
|
|
35
|
+
try {
|
|
36
|
+
parsed = new URL(`https://${withoutDefaultPort}/`);
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
const normalized = credentialHostOf(parsed);
|
|
42
|
+
return normalized === withoutDefaultPort && parsed.pathname === "/" ? normalized : null;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=hosts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hosts.js","sourceRoot":"","sources":["../../src/gitCredential/hosts.ts"],"names":[],"mappings":";;;;AAAA;;;;;GAKG;AACH,0BAAiC,GAAQ;IACvC,IAAI,GAAG,CAAC,QAAQ,KAAK,QAAQ,IAAI,GAAG,CAAC,QAAQ,KAAK,EAAE,IAAI,GAAG,CAAC,QAAQ,KAAK,EAAE,EAAE,CAAC;QAC5E,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,GAAG,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC;AAC3C,CAAC;AAED;;;;;;;;GAQG;AACH,iCAAwC,IAAY;IAClD,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;IACnC,8GAA8G;IAC9G,eAAe;IACf,IAAI,CAAC,gDAAgD,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QACpE,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,kBAAkB,GAAG,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;IACjG,IAAI,MAAW,CAAC;IAChB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,GAAG,CAAC,WAAW,kBAAkB,GAAG,CAAC,CAAC;IACrD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,UAAU,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAC5C,OAAO,UAAU,KAAK,kBAAkB,IAAI,MAAM,CAAC,QAAQ,KAAK,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC;AAC1F,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -44,19 +44,32 @@ export type { GatewayMarketplacePullOptions, GatewayMarketplacePullResult } from
|
|
|
44
44
|
export { GatewayKb } from "./gateway/GatewayKb";
|
|
45
45
|
export type { GatewayKbListOptions, GatewayKbPullOptions, GatewayKbPullResult, GatewayKbPushOptions, GatewayKbPushResult, } from "./gateway/GatewayKb";
|
|
46
46
|
export { GatewayClient, gatewayErrorFor, parseGatewayOrigin } from "./gateway/GatewayClient";
|
|
47
|
-
export type { GatewayClientOptions, GatewayRequestOptions, GatewaySequence } from "./gateway/GatewayClient";
|
|
47
|
+
export type { GatewayClientOptions, GatewayRequestOptions, GatewayResponse, GatewaySequence, } from "./gateway/GatewayClient";
|
|
48
48
|
export type { GatewayContext, GatewayFetch } from "./gateway/GatewayContext";
|
|
49
49
|
export { gatewayTokenProblem, redactToken } from "./gateway/GatewayToken";
|
|
50
|
-
export {
|
|
50
|
+
export { GIT_MATCHING_FLOOR, GIT_SETUP_FLOOR, GitCredentialService, parseCredentialRequest, parseGitVersion, } from "./gitCredential/GitCredentialService";
|
|
51
|
+
export type { GitCredentialCloneOptions, GitCredentialHelperOptions, GitCredentialHost, GitCredentialHostSource, GitCredentialHostStatus, GitCredentialKeptReset, GitCredentialKeptResetReason, GitCredentialRemoveOptions, GitCredentialRemoveResult, GitCredentialSetupResult, GitCredentialSetupStatus, GitCredentialStatusScope, } from "./gitCredential/GitCredentialService";
|
|
52
|
+
export type { GitCredentialContext } from "./gitCredential/GitCredentialContext";
|
|
53
|
+
export { editConfigFile, gitConfigRunner, resolveSymlink } from "./gitCredential/GitConfigRunner";
|
|
54
|
+
export type { GitConfigOutcome, GitConfigRunner, GitRunOptions } from "./gitCredential/GitConfigRunner";
|
|
55
|
+
export { appendPair, keepsEntries, pairsIn, parseConfigFile, removePair } from "./gitCredential/configFile";
|
|
56
|
+
export type { ConfigFileEntry } from "./gitCredential/configFile";
|
|
57
|
+
export { credentialHostOf, requestedCredentialHost } from "./gitCredential/hosts";
|
|
58
|
+
export { configPathKey, credentialContextMatch, patternApplies, patternIsHost } from "./gitCredential/credentialConfig";
|
|
59
|
+
export type { ConfigPathStyle, CredentialContextMatch, GitCredentialConfigEntry, } from "./gitCredential/credentialConfig";
|
|
60
|
+
export { ApiEndpoints, AuthTypes, BlueHQ, CryptoAlgorithms, ExtensionConfig, FileExtensions, FolderNames, Gateway, GitCredential, GitHubUrls, Http, MimeTypes, Numerical, OutputChannels, SettingsKeys, SpecialFiles, WebDAVElements, } from "./constants";
|
|
51
61
|
export { PseudoMap, TypedMap, Persistable, registerSerializable, revive, PrivateKeys, PublicKeys, PersistablePseudoMap, PublicPersistanceMap, PrivateGenericMap, TypedPersistable, PrivateTypedPersistable, } from "./persistence";
|
|
52
62
|
export type { SerializableClass, Serializable } from "./persistence";
|
|
53
63
|
export { SharedFilePersistence } from "./persistence/SharedFilePersistence";
|
|
54
64
|
export { OrgCache } from "./cache/OrgCache";
|
|
55
65
|
export { ScriptMetaDataStore } from "./cache/ScriptMetaDataStore";
|
|
66
|
+
export { GitCredentialHosts } from "./cache/GitCredentialHosts";
|
|
67
|
+
export { GIT_CONFIG_LOCK, GitCredentialResets } from "./cache/GitCredentialResets";
|
|
68
|
+
export type { GitCredentialResetRecord, GitCredentialResetState, GitCredentialResetsByFile, } from "./cache/GitCredentialResets";
|
|
56
69
|
export { UpdateService } from "./update/UpdateService";
|
|
57
70
|
export type { UpdateInfo, GithubRelease, ClientInfo, UpdateServiceConfig } from "./update/types";
|
|
58
71
|
export { MockFileSystem } from "./testing/MockFileSystem";
|
|
59
72
|
export { FakeGateway } from "./testing/FakeGateway";
|
|
60
73
|
export type { FakeGatewayFailure, FakeGatewayRequest, FakeGatewayRoute, FakeGatewayToken, FakeGatewayTokenOptions, } from "./testing/FakeGateway";
|
|
61
|
-
export type { ReadOnlyMap, JsonPrimitive, JsonArray, JsonObject, JsonValue, PrimitiveNestedObject, XMLResponse, SessionData, AuthParams, BearerAuthParams, MetaDataDotJsonContent, Settings, TsConfig, BlueHqAnyUrlResp, GqlParentNameResp, ScriptMetaData, SourceOps, OrgCacheElement, ScriptGqlResp, ScriptGQLGoodResp, ScriptGQLBadResp, SchemaRecipeName, SchemaRecipeFindingSeverity, SchemaRecipeFindingCode, SchemaRecipeFinding, SchemaRecipeResult, SchemaGateStage, SchemaRefusalCode, SchemaActionKind, SchemaDeltaKind, SchemaDelta, SchemaConflictReason, SchemaPlannedAction, SchemaMatchHit, SchemaRefusal, SchemaApplyRefusal, SchemaWarning, SchemaTestResult, SchemaAppliedObject, SchemaApplyResult, ConfigJsonContent, GatewayErrorCode, GatewayErrorBody, GatewayKnowledgeBase, GatewayKnowledgeBaseStatus, GatewayKnowledgeBaseList, GatewayMarketplaceRepo, GatewayMarketplaceRepoList, GatewayCreatedToken, GatewayExpiryCap, GatewayMintedToken, GatewayMintedTokenBody, GatewayTokenCreateRequest, GatewayTokenList, GatewayTokenRecord, GatewayTokenRevokeResult, GatewayTokenRotateResult, GatewayTokenSummary, } from "./types";
|
|
74
|
+
export type { ReadOnlyMap, JsonPrimitive, JsonArray, JsonObject, JsonValue, PrimitiveNestedObject, XMLResponse, SessionData, AuthParams, BearerAuthParams, MetaDataDotJsonContent, Settings, TsConfig, BlueHqAnyUrlResp, GqlParentNameResp, ScriptMetaData, SourceOps, OrgCacheElement, ScriptGqlResp, ScriptGQLGoodResp, ScriptGQLBadResp, SchemaRecipeName, SchemaRecipeFindingSeverity, SchemaRecipeFindingCode, SchemaRecipeFinding, SchemaRecipeResult, SchemaGateStage, SchemaRefusalCode, SchemaActionKind, SchemaDeltaKind, SchemaDelta, SchemaConflictReason, SchemaPlannedAction, SchemaMatchHit, SchemaRefusal, SchemaApplyRefusal, SchemaWarning, SchemaTestResult, SchemaAppliedObject, SchemaApplyResult, ConfigJsonContent, GatewayErrorCode, GatewayErrorBody, GatewayKnowledgeBase, GatewayKnowledgeBaseStatus, GatewayKnowledgeBaseList, GatewayKnowledgeBaseAccess, GatewayKnowledgeBaseAccessInput, GatewayKnowledgeBaseDetail, GatewayKnowledgeBaseVersion, GatewayKnowledgeBaseCreateRequest, GatewayKnowledgeBaseChanges, GatewayMarketplaceRepo, GatewayMarketplaceRepoList, GatewayCreatedToken, GatewayExpiryCap, GatewayMintedToken, GatewayMintedTokenBody, GatewayTokenCreateRequest, GatewayTokenList, GatewayTokenRecord, GatewayTokenRevokeResult, GatewayTokenRotateResult, GatewayTokenSummary, } from "./types";
|
|
62
75
|
export * as bsjsGit from "@bluestep-systems/b6p-core-bsjs-git";
|