@bluestep-systems/b6p-core 1.2.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 +119 -0
- 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 +15 -0
- package/dist/Err.js +21 -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/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 +14 -1
- 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/package.json +2 -2
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GitCredentialHosts = void 0;
|
|
4
|
+
const hosts_1 = require("../gitCredential/hosts");
|
|
5
|
+
const PersistenceKeys_1 = require("../persistence/PersistenceKeys");
|
|
6
|
+
const lockedMutation_1 = require("../persistence/lockedMutation");
|
|
7
|
+
function isRecordedHosts(value) {
|
|
8
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
return Object.values(value).every((entry) => typeof entry === "object" && entry !== null && typeof entry.recordedAt === "number");
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The tenant hosts b6p can `script pull` from: each one is recorded when a pull through that host's
|
|
15
|
+
* git proxy succeeded with the stored token. Together with the gateway's host they are the hosts
|
|
16
|
+
* {@link GitCredentialService} answers git's credential requests for.
|
|
17
|
+
*
|
|
18
|
+
* Core has no other source it could trust for this. The gateway does not list a token's tenant
|
|
19
|
+
* hosts, the org cache forgets a host after three days unused, and no host rule (such as "any
|
|
20
|
+
* `*.bluestep.net`") is taken on faith: a pull that worked is the proof.
|
|
21
|
+
*
|
|
22
|
+
* Every read and write goes to persistence, never to a copy held in memory, so a recording made by
|
|
23
|
+
* another process (the extension beside the CLI, say) is seen and kept. Each record or forget is
|
|
24
|
+
* one locked read-modify-write ({@link mutatePublic}), so neither loses the other's change: within
|
|
25
|
+
* the process always, and across processes where the persistence has a lock
|
|
26
|
+
* (`SharedFilePersistence` does).
|
|
27
|
+
* @lastreviewed null
|
|
28
|
+
*/
|
|
29
|
+
class GitCredentialHosts {
|
|
30
|
+
persistence;
|
|
31
|
+
constructor(persistence) {
|
|
32
|
+
this.persistence = persistence;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The recorded hosts, sorted. A malformed stored value reads as none.
|
|
36
|
+
* @lastreviewed null
|
|
37
|
+
*/
|
|
38
|
+
async hosts() {
|
|
39
|
+
return [...toMap(await this.persistence.get(PersistenceKeys_1.PublicKeys.GIT_CREDENTIAL_HOSTS)).keys()].sort();
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Record the host of `url`, a URL a script pull just reached with the stored token. A URL that
|
|
43
|
+
* is not https or carries credentials is not recorded.
|
|
44
|
+
* @returns whether the host is now recorded
|
|
45
|
+
* @lastreviewed null
|
|
46
|
+
*/
|
|
47
|
+
async record(url) {
|
|
48
|
+
let parsed;
|
|
49
|
+
try {
|
|
50
|
+
parsed = new URL(url);
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
const host = (0, hosts_1.credentialHostOf)(parsed);
|
|
56
|
+
if (host === null) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
return this.mutate((recorded) => {
|
|
60
|
+
recorded.set(host, { recordedAt: Date.now() });
|
|
61
|
+
return true;
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Forget `host`, so it is no longer answered for.
|
|
66
|
+
* @returns whether it was recorded
|
|
67
|
+
* @lastreviewed null
|
|
68
|
+
*/
|
|
69
|
+
async forget(host) {
|
|
70
|
+
return this.mutate((recorded) => recorded.delete(host));
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* One read-modify-write of the stored map through {@link mutatePublic}: queued in this process
|
|
74
|
+
* across every instance on the same persistence, and under the persistence's lock across
|
|
75
|
+
* processes when it has one.
|
|
76
|
+
* @lastreviewed null
|
|
77
|
+
*/
|
|
78
|
+
mutate(change) {
|
|
79
|
+
return (0, lockedMutation_1.mutatePublic)(this.persistence, PersistenceKeys_1.PublicKeys.GIT_CREDENTIAL_HOSTS, (current) => {
|
|
80
|
+
const recorded = toMap(current);
|
|
81
|
+
const changed = change(recorded);
|
|
82
|
+
return { changed, next: Object.fromEntries(recorded), result: changed };
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
exports.GitCredentialHosts = GitCredentialHosts;
|
|
87
|
+
function toMap(stored) {
|
|
88
|
+
return new Map(isRecordedHosts(stored) ? Object.entries(stored) : []);
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=GitCredentialHosts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GitCredentialHosts.js","sourceRoot":"","sources":["../../src/cache/GitCredentialHosts.ts"],"names":[],"mappings":";;;AAAA,kDAA0D;AAC1D,oEAA4D;AAE5D,kEAA6D;AAY7D,SAAS,eAAe,CAAC,KAAc;IACrC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACxE,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,MAAM,CAAC,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AAC;IAC1D,CAAC;IAED;;;;;OAKG;IACK,MAAM,CAAC,MAAwD;QACrE,OAAO,IAAA,6BAAY,EAAC,IAAI,CAAC,WAAW,EAAE,4BAAU,CAAC,oBAAoB,EAAE,CAAC,OAAO,EAAE,EAAE;YACjF,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC;YAChC,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;YACjC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAkB,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;QAC3F,CAAC,CAAC,CAAC;IACL,CAAC;CACF;;AAED,SAAS,KAAK,CAAC,MAAe;IAC5B,OAAO,IAAI,GAAG,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AACxE,CAAC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { type ConfigPathStyle } from "../gitCredential/credentialConfig";
|
|
2
|
+
import type { Persistence } from "../providers";
|
|
3
|
+
/**
|
|
4
|
+
* Where b6p's reset under one key in one file stands. b6p writes its reset and its helper as one
|
|
5
|
+
* pair, in one edit of the file, and removes the pair the same way, so the file never holds one
|
|
6
|
+
* without the other.
|
|
7
|
+
*
|
|
8
|
+
* - `installed`: b6p wrote the pair. It stays b6p's only while `helper` directly follows an empty
|
|
9
|
+
* value among that key's values in that file; once it does not (the user took b6p's helper out,
|
|
10
|
+
* say), b6p drops the record and claims nothing.
|
|
11
|
+
* - `adding`: b6p is about to append the pair; the key then had `pairsBefore` such pairs in the
|
|
12
|
+
* file. Settled as not done when it still has that many, as `installed` when it has one more, and
|
|
13
|
+
* as `unconfirmed` otherwise.
|
|
14
|
+
* - `unconfirmed`: the file does not show which pair is b6p's. Nothing is removed for it; the next
|
|
15
|
+
* setup or removal that covers the key reports it and forgets it.
|
|
16
|
+
* @lastreviewed null
|
|
17
|
+
*/
|
|
18
|
+
export type GitCredentialResetState = "installed" | "adding" | "unconfirmed";
|
|
19
|
+
/**
|
|
20
|
+
* b6p's reset under one exact key in one file.
|
|
21
|
+
* @lastreviewed null
|
|
22
|
+
*/
|
|
23
|
+
export interface GitCredentialResetRecord {
|
|
24
|
+
readonly state: GitCredentialResetState;
|
|
25
|
+
/**
|
|
26
|
+
* The helper command written straight after the reset.
|
|
27
|
+
* @lastreviewed null
|
|
28
|
+
*/
|
|
29
|
+
readonly helper: string;
|
|
30
|
+
/**
|
|
31
|
+
* For `adding`: how many reset-then-`helper` pairs the key had in the file just before.
|
|
32
|
+
* @lastreviewed null
|
|
33
|
+
*/
|
|
34
|
+
readonly pairsBefore?: number;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Every record: file path (one spelling per file: the first b6p recorded, as git reported it) →
|
|
38
|
+
* exact config key (as written, case kept) → record.
|
|
39
|
+
* @lastreviewed null
|
|
40
|
+
*/
|
|
41
|
+
export type GitCredentialResetsByFile = Record<string, Record<string, GitCredentialResetRecord>>;
|
|
42
|
+
/**
|
|
43
|
+
* The name of the lock every setup and removal of b6p's git config entries holds from start to
|
|
44
|
+
* end ({@link GitCredentialResets.exclusive}).
|
|
45
|
+
* @lastreviewed null
|
|
46
|
+
*/
|
|
47
|
+
export declare const GIT_CONFIG_LOCK = "b6p:git_credential_config";
|
|
48
|
+
/**
|
|
49
|
+
* Which `helper =` resets in the user's git config b6p wrote, so removal takes out only those and
|
|
50
|
+
* never one the user wrote, whatever sits next to it. Public state `b6p:git_credential_resets`:
|
|
51
|
+
* `{ "<file>": { "<exact key>": { state, helper, pairsBefore? } } }`.
|
|
52
|
+
*
|
|
53
|
+
* An addition is written here before it is made (`adding`) and again after it, so
|
|
54
|
+
* a run that stopped between the two is settled by the next one from the file
|
|
55
|
+
* ({@link GitCredentialResetState}). Each write is a locked read-modify-write
|
|
56
|
+
* ({@link mutatePublic}), and the whole of a setup or removal runs inside {@link exclusive}.
|
|
57
|
+
*
|
|
58
|
+
* A file is recorded under one spelling: every write for another spelling of the same file (by
|
|
59
|
+
* `pathStyle`, as `configPathKey` compares them) goes to the one already recorded, so recording,
|
|
60
|
+
* settling and removal always meet the same entry.
|
|
61
|
+
*
|
|
62
|
+
* The record outlives `clearSettings()` and `clearAll()` (see `B6PCore`), because the entries it
|
|
63
|
+
* describes stay in the user's git config until a removal takes them out.
|
|
64
|
+
* @lastreviewed null
|
|
65
|
+
*/
|
|
66
|
+
export declare class GitCredentialResets {
|
|
67
|
+
private readonly persistence;
|
|
68
|
+
private readonly pathStyle;
|
|
69
|
+
constructor(persistence: Persistence, pathStyle?: ConfigPathStyle);
|
|
70
|
+
/**
|
|
71
|
+
* Every record, read under the record's lock, so a write of it (or `B6PCore`'s clear, which keeps
|
|
72
|
+
* it) is never seen halfway.
|
|
73
|
+
* @lastreviewed null
|
|
74
|
+
*/
|
|
75
|
+
all(): Promise<GitCredentialResetsByFile>;
|
|
76
|
+
/**
|
|
77
|
+
* Replace the record for `key` in `file`; `undefined` removes it.
|
|
78
|
+
* @lastreviewed null
|
|
79
|
+
*/
|
|
80
|
+
put(file: string, key: string, record: GitCredentialResetRecord | undefined): Promise<void>;
|
|
81
|
+
/**
|
|
82
|
+
* Run `work` holding the git config lock ({@link GIT_CONFIG_LOCK}): in this process after every
|
|
83
|
+
* earlier holder on the same persistence object, and across processes under
|
|
84
|
+
* `Persistence.withLock` when the persistence has it. One setup or removal holds it from reading
|
|
85
|
+
* the config to settling the last record, so two never interleave.
|
|
86
|
+
* @lastreviewed null
|
|
87
|
+
*/
|
|
88
|
+
exclusive<T>(work: () => Promise<T>): Promise<T>;
|
|
89
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GitCredentialResets = exports.GIT_CONFIG_LOCK = void 0;
|
|
4
|
+
const credentialConfig_1 = require("../gitCredential/credentialConfig");
|
|
5
|
+
const lockedMutation_1 = require("../persistence/lockedMutation");
|
|
6
|
+
const PersistenceKeys_1 = require("../persistence/PersistenceKeys");
|
|
7
|
+
const STATES = new Set(["installed", "adding", "unconfirmed"]);
|
|
8
|
+
function isRecord(value) {
|
|
9
|
+
if (typeof value !== "object" || value === null) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
const r = value;
|
|
13
|
+
if (!STATES.has(r.state) || typeof r.helper !== "string") {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
return r.state === "adding"
|
|
17
|
+
? Number.isInteger(r.pairsBefore) && (r.pairsBefore ?? -1) >= 0
|
|
18
|
+
: r.pairsBefore === undefined;
|
|
19
|
+
}
|
|
20
|
+
// The spelling `file` is stored under in `all`: the one already there for the same file, else `file`.
|
|
21
|
+
function spellingIn(all, file, style) {
|
|
22
|
+
const want = (0, credentialConfig_1.configPathKey)(file, style);
|
|
23
|
+
return Object.keys(all).find((known) => (0, credentialConfig_1.configPathKey)(known, style) === want) ?? file;
|
|
24
|
+
}
|
|
25
|
+
// The valid records, two spellings of one file (C:/Users/… and C:\Users\… on Windows) merged under the first.
|
|
26
|
+
function clean(stored, style) {
|
|
27
|
+
const out = {};
|
|
28
|
+
if (typeof stored !== "object" || stored === null || Array.isArray(stored)) {
|
|
29
|
+
return out;
|
|
30
|
+
}
|
|
31
|
+
for (const [file, keys] of Object.entries(stored)) {
|
|
32
|
+
if (typeof keys !== "object" || keys === null) {
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
for (const [key, record] of Object.entries(keys)) {
|
|
36
|
+
if (isRecord(record)) {
|
|
37
|
+
const spelling = spellingIn(out, file, style);
|
|
38
|
+
(out[spelling] ??= {})[key] ??= record;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return out;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The name of the lock every setup and removal of b6p's git config entries holds from start to
|
|
46
|
+
* end ({@link GitCredentialResets.exclusive}).
|
|
47
|
+
* @lastreviewed null
|
|
48
|
+
*/
|
|
49
|
+
exports.GIT_CONFIG_LOCK = "b6p:git_credential_config";
|
|
50
|
+
/**
|
|
51
|
+
* Which `helper =` resets in the user's git config b6p wrote, so removal takes out only those and
|
|
52
|
+
* never one the user wrote, whatever sits next to it. Public state `b6p:git_credential_resets`:
|
|
53
|
+
* `{ "<file>": { "<exact key>": { state, helper, pairsBefore? } } }`.
|
|
54
|
+
*
|
|
55
|
+
* An addition is written here before it is made (`adding`) and again after it, so
|
|
56
|
+
* a run that stopped between the two is settled by the next one from the file
|
|
57
|
+
* ({@link GitCredentialResetState}). Each write is a locked read-modify-write
|
|
58
|
+
* ({@link mutatePublic}), and the whole of a setup or removal runs inside {@link exclusive}.
|
|
59
|
+
*
|
|
60
|
+
* A file is recorded under one spelling: every write for another spelling of the same file (by
|
|
61
|
+
* `pathStyle`, as `configPathKey` compares them) goes to the one already recorded, so recording,
|
|
62
|
+
* settling and removal always meet the same entry.
|
|
63
|
+
*
|
|
64
|
+
* The record outlives `clearSettings()` and `clearAll()` (see `B6PCore`), because the entries it
|
|
65
|
+
* describes stay in the user's git config until a removal takes them out.
|
|
66
|
+
* @lastreviewed null
|
|
67
|
+
*/
|
|
68
|
+
class GitCredentialResets {
|
|
69
|
+
persistence;
|
|
70
|
+
pathStyle;
|
|
71
|
+
constructor(persistence, pathStyle = process.platform === "win32" ? "win32" : "posix") {
|
|
72
|
+
this.persistence = persistence;
|
|
73
|
+
this.pathStyle = pathStyle;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Every record, read under the record's lock, so a write of it (or `B6PCore`'s clear, which keeps
|
|
77
|
+
* it) is never seen halfway.
|
|
78
|
+
* @lastreviewed null
|
|
79
|
+
*/
|
|
80
|
+
async all() {
|
|
81
|
+
return (0, lockedMutation_1.exclusive)(this.persistence, PersistenceKeys_1.PublicKeys.GIT_CREDENTIAL_RESETS, async () => clean(await this.persistence.get(PersistenceKeys_1.PublicKeys.GIT_CREDENTIAL_RESETS), this.pathStyle));
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Replace the record for `key` in `file`; `undefined` removes it.
|
|
85
|
+
* @lastreviewed null
|
|
86
|
+
*/
|
|
87
|
+
async put(file, key, record) {
|
|
88
|
+
await (0, lockedMutation_1.mutatePublic)(this.persistence, PersistenceKeys_1.PublicKeys.GIT_CREDENTIAL_RESETS, (current) => {
|
|
89
|
+
const all = clean(current, this.pathStyle);
|
|
90
|
+
file = spellingIn(all, file, this.pathStyle);
|
|
91
|
+
const keys = { ...(all[file] ?? {}) };
|
|
92
|
+
if (record === undefined) {
|
|
93
|
+
delete keys[key];
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
keys[key] = record;
|
|
97
|
+
}
|
|
98
|
+
if (Object.keys(keys).length === 0) {
|
|
99
|
+
delete all[file];
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
all[file] = keys;
|
|
103
|
+
}
|
|
104
|
+
return { changed: true, next: all, result: undefined };
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Run `work` holding the git config lock ({@link GIT_CONFIG_LOCK}): in this process after every
|
|
109
|
+
* earlier holder on the same persistence object, and across processes under
|
|
110
|
+
* `Persistence.withLock` when the persistence has it. One setup or removal holds it from reading
|
|
111
|
+
* the config to settling the last record, so two never interleave.
|
|
112
|
+
* @lastreviewed null
|
|
113
|
+
*/
|
|
114
|
+
exclusive(work) {
|
|
115
|
+
return (0, lockedMutation_1.exclusive)(this.persistence, exports.GIT_CONFIG_LOCK, work);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
exports.GitCredentialResets = GitCredentialResets;
|
|
119
|
+
//# sourceMappingURL=GitCredentialResets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GitCredentialResets.js","sourceRoot":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3
|
+
* @lastreviewed null
|
|
4
|
+
*/
|
|
5
|
+
export declare namespace GitCredential {
|
|
6
|
+
/**
|
|
7
|
+
* The username answered with the token. Both git proxies (the platform's and the gateway's) read
|
|
8
|
+
* only the Basic password, but Basic needs a username; this is the one `bsjs-git` sends.
|
|
9
|
+
* @lastreviewed null
|
|
10
|
+
*/
|
|
11
|
+
const USERNAME = "b6p";
|
|
12
|
+
/**
|
|
13
|
+
* The helper command written into git config by default: git runs `<command> get|store|erase`
|
|
14
|
+
* through the shell, so the leading `!` makes it a shell command rather than a
|
|
15
|
+
* `git credential-<name>` program.
|
|
16
|
+
* @lastreviewed null
|
|
17
|
+
*/
|
|
18
|
+
const DEFAULT_HELPER = "!b6p auth git-credential";
|
|
19
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GitCredential = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Constants for b6p as git's credential helper ({@link GitCredentialService}).
|
|
6
|
+
* @lastreviewed null
|
|
7
|
+
*/
|
|
8
|
+
var GitCredential;
|
|
9
|
+
(function (GitCredential) {
|
|
10
|
+
/**
|
|
11
|
+
* The username answered with the token. Both git proxies (the platform's and the gateway's) read
|
|
12
|
+
* only the Basic password, but Basic needs a username; this is the one `bsjs-git` sends.
|
|
13
|
+
* @lastreviewed null
|
|
14
|
+
*/
|
|
15
|
+
GitCredential.USERNAME = "b6p";
|
|
16
|
+
/**
|
|
17
|
+
* The helper command written into git config by default: git runs `<command> get|store|erase`
|
|
18
|
+
* through the shell, so the leading `!` makes it a shell command rather than a
|
|
19
|
+
* `git credential-<name>` program.
|
|
20
|
+
* @lastreviewed null
|
|
21
|
+
*/
|
|
22
|
+
GitCredential.DEFAULT_HELPER = "!b6p auth git-credential";
|
|
23
|
+
})(GitCredential || (exports.GitCredential = GitCredential = {}));
|
|
24
|
+
//# sourceMappingURL=GitCredential.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GitCredential.js","sourceRoot":"","sources":["../../src/constants/GitCredential.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,IAAiB,aAAa,CAe7B;AAfD,WAAiB,aAAa;IAC5B;;;;OAIG;IACU,sBAAQ,GAAG,KAAK,CAAC;IAE9B;;;;;OAKG;IACU,4BAAc,GAAG,0BAA0B,CAAC;AAC3D,CAAC,EAfgB,aAAa,aAAb,aAAa,GAAb,aAAa,QAe7B"}
|
|
@@ -13,6 +13,7 @@ export { ExtensionConfig } from "./ExtensionConfig";
|
|
|
13
13
|
export { FileExtensions } from "./FileExtensions";
|
|
14
14
|
export { FolderNames } from "./FolderNames";
|
|
15
15
|
export { Gateway } from "./Gateway";
|
|
16
|
+
export { GitCredential } from "./GitCredential";
|
|
16
17
|
export { GitHubUrls } from "./GitHubUrls";
|
|
17
18
|
export { Http } from "./Http";
|
|
18
19
|
export { MimeTypes } from "./MimeTypes";
|
package/dist/constants/index.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* @lastreviewed 2025-10-07
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.Numerical = exports.WebDAVElements = exports.SettingsKeys = exports.SpecialFiles = exports.OutputChannels = exports.MimeTypes = exports.Http = exports.GitHubUrls = exports.Gateway = exports.FolderNames = exports.FileExtensions = exports.ExtensionConfig = exports.CryptoAlgorithms = exports.BlueHQ = exports.AuthTypes = exports.ApiEndpoints = void 0;
|
|
10
|
+
exports.Numerical = exports.WebDAVElements = exports.SettingsKeys = exports.SpecialFiles = exports.OutputChannels = exports.MimeTypes = exports.Http = exports.GitHubUrls = exports.GitCredential = exports.Gateway = exports.FolderNames = exports.FileExtensions = exports.ExtensionConfig = exports.CryptoAlgorithms = exports.BlueHQ = exports.AuthTypes = exports.ApiEndpoints = void 0;
|
|
11
11
|
var ApiEndpoints_1 = require("./ApiEndpoints");
|
|
12
12
|
Object.defineProperty(exports, "ApiEndpoints", { enumerable: true, get: function () { return ApiEndpoints_1.ApiEndpoints; } });
|
|
13
13
|
var AuthTypes_1 = require("./AuthTypes");
|
|
@@ -24,6 +24,8 @@ var FolderNames_1 = require("./FolderNames");
|
|
|
24
24
|
Object.defineProperty(exports, "FolderNames", { enumerable: true, get: function () { return FolderNames_1.FolderNames; } });
|
|
25
25
|
var Gateway_1 = require("./Gateway");
|
|
26
26
|
Object.defineProperty(exports, "Gateway", { enumerable: true, get: function () { return Gateway_1.Gateway; } });
|
|
27
|
+
var GitCredential_1 = require("./GitCredential");
|
|
28
|
+
Object.defineProperty(exports, "GitCredential", { enumerable: true, get: function () { return GitCredential_1.GitCredential; } });
|
|
27
29
|
var GitHubUrls_1 = require("./GitHubUrls");
|
|
28
30
|
Object.defineProperty(exports, "GitHubUrls", { enumerable: true, get: function () { return GitHubUrls_1.GitHubUrls; } });
|
|
29
31
|
var Http_1 = require("./Http");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AACrB,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;AAClB,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AACf,uDAAsD;AAA7C,oHAAA,gBAAgB,OAAA;AACzB,qDAAoD;AAA3C,kHAAA,eAAe,OAAA;AACxB,mDAAkD;AAAzC,gHAAA,cAAc,OAAA;AACvB,6CAA4C;AAAnC,0GAAA,WAAW,OAAA;AACpB,qCAAoC;AAA3B,kGAAA,OAAO,OAAA;AAChB,2CAA0C;AAAjC,wGAAA,UAAU,OAAA;AACnB,+BAA8B;AAArB,4FAAA,IAAI,OAAA;AACb,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;AAClB,mDAAkD;AAAzC,gHAAA,cAAc,OAAA;AACvB,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AACrB,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AACrB,mDAAkD;AAAzC,gHAAA,cAAc,OAAA;AACvB,yCAAwC;AAA/B,sGAAA,SAAS,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AACrB,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;AAClB,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AACf,uDAAsD;AAA7C,oHAAA,gBAAgB,OAAA;AACzB,qDAAoD;AAA3C,kHAAA,eAAe,OAAA;AACxB,mDAAkD;AAAzC,gHAAA,cAAc,OAAA;AACvB,6CAA4C;AAAnC,0GAAA,WAAW,OAAA;AACpB,qCAAoC;AAA3B,kGAAA,OAAO,OAAA;AAChB,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AACtB,2CAA0C;AAAjC,wGAAA,UAAU,OAAA;AACnB,+BAA8B;AAArB,4FAAA,IAAI,OAAA;AACb,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;AAClB,mDAAkD;AAAzC,gHAAA,cAAc,OAAA;AACvB,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AACrB,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AACrB,mDAAkD;AAAzC,gHAAA,cAAc,OAAA;AACvB,yCAAwC;AAA/B,sGAAA,SAAS,OAAA"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import type { ConfigPathStyle } from "./credentialConfig";
|
|
2
|
+
/**
|
|
3
|
+
* What one `git config …` run printed and how it ended.
|
|
4
|
+
* @lastreviewed null
|
|
5
|
+
*/
|
|
6
|
+
export interface GitConfigOutcome {
|
|
7
|
+
/**
|
|
8
|
+
* git's exit code: 0 on success, 1 for a key or pattern that matched nothing, more for a real failure.
|
|
9
|
+
* `-1` when git could not be started (not installed).
|
|
10
|
+
* @lastreviewed null
|
|
11
|
+
*/
|
|
12
|
+
readonly code: number;
|
|
13
|
+
readonly stdout: string;
|
|
14
|
+
readonly stderr: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Where a git command runs.
|
|
18
|
+
* @lastreviewed null
|
|
19
|
+
*/
|
|
20
|
+
export interface GitRunOptions {
|
|
21
|
+
/**
|
|
22
|
+
* The directory git runs in (default the process's), which decides the repository whose local
|
|
23
|
+
* and worktree config git reads.
|
|
24
|
+
* @lastreviewed null
|
|
25
|
+
*/
|
|
26
|
+
readonly cwd?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Runs git for the credential helper's setup. The arguments never carry a token: only config keys,
|
|
30
|
+
* value patterns, file names and helper commands pass through here.
|
|
31
|
+
* @lastreviewed null
|
|
32
|
+
*/
|
|
33
|
+
export interface GitConfigRunner {
|
|
34
|
+
/**
|
|
35
|
+
* Run `git config <args>` and report the outcome; never throws. The caller names the scope
|
|
36
|
+
* (`--file <path>`), or none for a read of every scope.
|
|
37
|
+
* @lastreviewed null
|
|
38
|
+
*/
|
|
39
|
+
run(args: readonly string[], options?: GitRunOptions): Promise<GitConfigOutcome>;
|
|
40
|
+
/**
|
|
41
|
+
* Run `git <args>` (`--version`, `var`, `rev-parse`) and report the outcome; never throws.
|
|
42
|
+
* @lastreviewed null
|
|
43
|
+
*/
|
|
44
|
+
git(args: readonly string[], options?: GitRunOptions): Promise<GitConfigOutcome>;
|
|
45
|
+
/**
|
|
46
|
+
* The file `git config --global` writes, as git itself reports it: the paths
|
|
47
|
+
* `git var GIT_CONFIG_GLOBAL` prints (git 2.42 or later; `$XDG_CONFIG_HOME/git/config` first when
|
|
48
|
+
* there is one, then `~/.gitconfig` or `$GIT_CONFIG_GLOBAL`), chosen by git's rule (config.c
|
|
49
|
+
* `git_global_config`): the last, unless it cannot be read and the XDG one can. Never worked out
|
|
50
|
+
* from `HOME` or `USERPROFILE`, which Git for Windows does not always use.
|
|
51
|
+
* @throws {Err.GitCredentialSetupError} when git does not report one.
|
|
52
|
+
* @lastreviewed null
|
|
53
|
+
*/
|
|
54
|
+
globalFile(): Promise<string>;
|
|
55
|
+
/**
|
|
56
|
+
* Edit the config file `file` the way git does (lockfile.c): create `<file>.lock` exclusively,
|
|
57
|
+
* with the file's mode (waiting briefly while another git holds it), let `edit` turn the file's
|
|
58
|
+
* current bytes (one latin1 character each) into the new ones (`null` to leave it), write them to
|
|
59
|
+
* the lock and rename it over the file. A symlink is followed to its target, even a missing one,
|
|
60
|
+
* as git does, so it stays a link. Every git writer takes the same lock, so nothing another
|
|
61
|
+
* writer does lands between `edit`'s read and the write. Returns whether the file changed.
|
|
62
|
+
* @lastreviewed null
|
|
63
|
+
*/
|
|
64
|
+
editFile(file: string, edit: (text: string) => string | null): Promise<boolean>;
|
|
65
|
+
/**
|
|
66
|
+
* How config file paths are compared (see `configPathKey`): `win32` on Windows, where git
|
|
67
|
+
* reports `C:/Users/…` for a file b6p names `C:\\Users\\…`, and `posix` elsewhere. Absent, the
|
|
68
|
+
* platform's.
|
|
69
|
+
* @lastreviewed null
|
|
70
|
+
*/
|
|
71
|
+
readonly pathStyle?: ConfigPathStyle;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Where git writes when asked to write `file`: the target of a symlink, followed as lockfile.c
|
|
75
|
+
* `resolve_symlink` does (up to five links, a relative target taken from the link's directory), even
|
|
76
|
+
* when the target does not exist yet, so the link stays a link.
|
|
77
|
+
* @lastreviewed null
|
|
78
|
+
*/
|
|
79
|
+
export declare function resolveSymlink(file: string): Promise<string>;
|
|
80
|
+
/**
|
|
81
|
+
* Edit a config file under git's lock protocol ({@link GitConfigRunner.editFile}). The file is read
|
|
82
|
+
* and written as bytes: `edit` gets each byte as one character (latin1) and must return text in the
|
|
83
|
+
* same form, so bytes that are not UTF-8 (a cp1252 name, say) pass through unchanged. The lock is
|
|
84
|
+
* created owner-only and set to the file's mode, read under the lock, before anything is written,
|
|
85
|
+
* so the copy is never more readable than the file. Until it is renamed or removed, the lock is
|
|
86
|
+
* removed if the process stops (`exitCleanup.ts`), and only while it is still the file (inode) this
|
|
87
|
+
* call created.
|
|
88
|
+
* @lastreviewed null
|
|
89
|
+
*/
|
|
90
|
+
export declare function editConfigFile(file: string, edit: (text: string) => string | null): Promise<boolean>;
|
|
91
|
+
/**
|
|
92
|
+
* The default {@link GitConfigRunner}: the `git` executable on PATH, with `env` (default
|
|
93
|
+
* `process.env`) as its environment, so a test can point `HOME`, `XDG_CONFIG_HOME` or
|
|
94
|
+
* `GIT_CONFIG_GLOBAL` at scratch files.
|
|
95
|
+
* @lastreviewed null
|
|
96
|
+
*/
|
|
97
|
+
export declare function gitConfigRunner(env?: NodeJS.ProcessEnv): GitConfigRunner;
|