@zincapp/znvault-cli 4.24.3 → 4.24.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/auth.d.ts.map +1 -1
- package/dist/commands/auth.js +2 -0
- package/dist/commands/auth.js.map +1 -1
- package/dist/commands/completion.js +1 -1
- package/dist/commands/dynamic-secrets/index.d.ts.map +1 -1
- package/dist/commands/dynamic-secrets/index.js +7 -1
- package/dist/commands/dynamic-secrets/index.js.map +1 -1
- package/dist/commands/dynamic-secrets/permit.d.ts +2 -1
- package/dist/commands/dynamic-secrets/permit.d.ts.map +1 -1
- package/dist/commands/dynamic-secrets/permit.js +35 -0
- package/dist/commands/dynamic-secrets/permit.js.map +1 -1
- package/dist/commands/dynamic-secrets/recovery-types.d.ts +10 -0
- package/dist/commands/dynamic-secrets/recovery-types.d.ts.map +1 -1
- package/dist/commands/profile-api-key.d.ts +10 -0
- package/dist/commands/profile-api-key.d.ts.map +1 -0
- package/dist/commands/profile-api-key.js +97 -0
- package/dist/commands/profile-api-key.js.map +1 -0
- package/dist/lib/config/apikey.d.ts.map +1 -1
- package/dist/lib/config/apikey.js +18 -13
- package/dist/lib/config/apikey.js.map +1 -1
- package/dist/lib/config/credentials.d.ts.map +1 -1
- package/dist/lib/config/credentials.js +12 -7
- package/dist/lib/config/credentials.js.map +1 -1
- package/dist/lib/config/index.d.ts +1 -1
- package/dist/lib/config/index.d.ts.map +1 -1
- package/dist/lib/config/index.js +1 -1
- package/dist/lib/config/index.js.map +1 -1
- package/dist/lib/config/migration.d.ts.map +1 -1
- package/dist/lib/config/migration.js +24 -22
- package/dist/lib/config/migration.js.map +1 -1
- package/dist/lib/config/plugins.d.ts.map +1 -1
- package/dist/lib/config/plugins.js +35 -29
- package/dist/lib/config/plugins.js.map +1 -1
- package/dist/lib/config/profile-lock.d.ts +7 -0
- package/dist/lib/config/profile-lock.d.ts.map +1 -0
- package/dist/lib/config/profile-lock.js +65 -0
- package/dist/lib/config/profile-lock.js.map +1 -0
- package/dist/lib/config/profile.d.ts +5 -0
- package/dist/lib/config/profile.d.ts.map +1 -1
- package/dist/lib/config/profile.js +122 -64
- package/dist/lib/config/profile.js.map +1 -1
- package/dist/lib/config/store.d.ts +6 -0
- package/dist/lib/config/store.d.ts.map +1 -1
- package/dist/lib/config/store.js +49 -16
- package/dist/lib/config/store.js.map +1 -1
- package/dist/lib/config.d.ts +1 -1
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +1 -1
- package/dist/lib/config.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/config/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAUhC,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE9D,QAAQ;AACR,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEvG,YAAY;AACZ,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAErE,QAAQ;AACR,OAAO,EACL,sBAAsB,EACtB,0BAA0B,EAC1B,qBAAqB,EACrB,mBAAmB,EACnB,aAAa,GACd,MAAM,YAAY,CAAC;AAEpB,qBAAqB;AACrB,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,aAAa,EACb,aAAa,EACb,UAAU,EACV,aAAa,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/config/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAUhC,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE9D,QAAQ;AACR,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,aAAa,E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,yCAAyC;AACzC,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,WAAW,EACX,cAAc,GACf,MAAM,eAAe,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration.d.ts","sourceRoot":"","sources":["../../../src/lib/config/migration.ts"],"names":[],"mappings":"AAcA;;;GAGG;AACH,wBAAgB,cAAc,IAAI,IAAI,CAarC;
|
|
1
|
+
{"version":3,"file":"migration.d.ts","sourceRoot":"","sources":["../../../src/lib/config/migration.ts"],"names":[],"mappings":"AAcA;;;GAGG;AACH,wBAAgB,cAAc,IAAI,IAAI,CAarC;AAkCD;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAE1C"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Config migration from legacy format to profile-based format
|
|
4
4
|
*/
|
|
5
|
-
import { store } from './store.js';
|
|
5
|
+
import { store, withStoreMutation } from './store.js';
|
|
6
6
|
import { CONFIG_DEFAULTS, DEFAULT_PROFILE } from './types.js';
|
|
7
7
|
/**
|
|
8
8
|
* Flag to track if migration has been attempted
|
|
@@ -28,27 +28,29 @@ export function ensureMigrated() {
|
|
|
28
28
|
* Migrate legacy config to profile-based config
|
|
29
29
|
*/
|
|
30
30
|
function migrateIfNeeded() {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
31
|
+
withStoreMutation(() => {
|
|
32
|
+
// Check if we have legacy config (url at root level but no profiles)
|
|
33
|
+
const legacyUrl = store.get('url');
|
|
34
|
+
const profiles = store.get('profiles');
|
|
35
|
+
if (legacyUrl && Object.keys(profiles).length === 0) {
|
|
36
|
+
// Migrate legacy config to default profile
|
|
37
|
+
const defaultProfile = {
|
|
38
|
+
url: legacyUrl,
|
|
39
|
+
insecure: store.get('insecure') ?? CONFIG_DEFAULTS.insecure,
|
|
40
|
+
timeout: store.get('timeout') ?? CONFIG_DEFAULTS.timeout,
|
|
41
|
+
defaultTenant: store.get('defaultTenant'),
|
|
42
|
+
credentials: store.get('credentials'),
|
|
43
|
+
};
|
|
44
|
+
store.set('profiles', { [DEFAULT_PROFILE]: defaultProfile });
|
|
45
|
+
store.set('activeProfile', DEFAULT_PROFILE);
|
|
46
|
+
// Clean up legacy keys
|
|
47
|
+
store.delete('url');
|
|
48
|
+
store.delete('insecure');
|
|
49
|
+
store.delete('timeout');
|
|
50
|
+
store.delete('defaultTenant');
|
|
51
|
+
store.delete('credentials');
|
|
52
|
+
}
|
|
53
|
+
});
|
|
52
54
|
}
|
|
53
55
|
/**
|
|
54
56
|
* Reset migration state (for testing)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration.js","sourceRoot":"","sources":["../../../src/lib/config/migration.ts"],"names":[],"mappings":"AAAA,oCAAoC;AAEpC;;GAEG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"migration.js","sourceRoot":"","sources":["../../../src/lib/config/migration.ts"],"names":[],"mappings":"AAAA,oCAAoC;AAEpC;;GAEG;AAEH,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,eAAe,EAAgB,MAAM,YAAY,CAAC;AAE5E;;GAEG;AACH,IAAI,kBAAkB,GAAG,KAAK,CAAC;AAE/B;;;GAGG;AACH,MAAM,UAAU,cAAc;IAC5B,IAAI,kBAAkB;QAAE,OAAO;IAC/B,kBAAkB,GAAG,IAAI,CAAC;IAE1B,IAAI,CAAC;QACH,eAAe,EAAE,CAAC;IACpB,CAAC;IAAC,OAAO,KAAK,EAAE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CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB;IACjC,kBAAkB,GAAG,KAAK,CAAC;AAC7B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../../src/lib/config/plugins.ts"],"names":[],"mappings":"AAEA;;GAEG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAG9D;;GAEG;AACH,wBAAgB,UAAU,IAAI,eAAe,EAAE,CAE9C;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../../src/lib/config/plugins.ts"],"names":[],"mappings":"AAEA;;GAEG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAG9D;;GAEG;AACH,wBAAgB,UAAU,IAAI,eAAe,EAAE,CAE9C;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI,CAgBvD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAe3D;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAcjF;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,IAAI,CAEnC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Path: src/lib/config/plugins.ts
|
|
2
|
-
import { store } from './store.js';
|
|
2
|
+
import { store, withStoreMutation } from './store.js';
|
|
3
3
|
/**
|
|
4
4
|
* Get all configured plugins
|
|
5
5
|
*/
|
|
@@ -10,44 +10,50 @@ export function getPlugins() {
|
|
|
10
10
|
* Add a plugin configuration
|
|
11
11
|
*/
|
|
12
12
|
export function addPlugin(config) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
13
|
+
withStoreMutation(() => {
|
|
14
|
+
const plugins = getPlugins();
|
|
15
|
+
const source = config.package ?? config.path;
|
|
16
|
+
// Check for duplicate
|
|
17
|
+
const existing = plugins.findIndex(p => (p.package ?? p.path) === source);
|
|
18
|
+
if (existing >= 0) {
|
|
19
|
+
// Update existing
|
|
20
|
+
plugins[existing] = config;
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
plugins.push(config);
|
|
24
|
+
}
|
|
25
|
+
store.set('plugins', plugins);
|
|
26
|
+
});
|
|
25
27
|
}
|
|
26
28
|
/**
|
|
27
29
|
* Remove a plugin by package name or path
|
|
28
30
|
*/
|
|
29
31
|
export function removePlugin(packageOrPath) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
return withStoreMutation(() => {
|
|
33
|
+
const plugins = getPlugins();
|
|
34
|
+
const initialLength = plugins.length;
|
|
35
|
+
const filtered = plugins.filter(p => p.package !== packageOrPath && p.path !== packageOrPath);
|
|
36
|
+
if (filtered.length < initialLength) {
|
|
37
|
+
store.set('plugins', filtered);
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
return false;
|
|
41
|
+
});
|
|
38
42
|
}
|
|
39
43
|
/**
|
|
40
44
|
* Enable or disable a plugin
|
|
41
45
|
*/
|
|
42
46
|
export function setPluginEnabled(packageOrPath, enabled) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
plugin
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
return withStoreMutation(() => {
|
|
48
|
+
const plugins = getPlugins();
|
|
49
|
+
const plugin = plugins.find(p => p.package === packageOrPath || p.path === packageOrPath);
|
|
50
|
+
if (plugin) {
|
|
51
|
+
plugin.enabled = enabled;
|
|
52
|
+
store.set('plugins', plugins);
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
return false;
|
|
56
|
+
});
|
|
51
57
|
}
|
|
52
58
|
/**
|
|
53
59
|
* Clear all plugins
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.js","sourceRoot":"","sources":["../../../src/lib/config/plugins.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAOlC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"plugins.js","sourceRoot":"","sources":["../../../src/lib/config/plugins.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAOlC,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEtD;;GAEG;AACH,MAAM,UAAU,UAAU;IACxB,OAAO,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;AACpC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,MAAuB;IAC/C,iBAAiB,CAAC,GAAG,EAAE;QACrB,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;QAC7B,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC;QAE7C,sBAAsB;QACtB,MAAM,QAAQ,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK,MAAM,CAAC,CAAC;QAC1E,IAAI,QAAQ,IAAI,CAAC,EAAE,CAAC;YAClB,kBAAkB;YAClB,OAAO,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC;QAC7B,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,IAAI,C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,KAAK,CAAC,GAAG,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;AAC3B,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Execute one synchronous profile-store transaction under a cross-process
|
|
3
|
+
* lock. Profile mutations are deliberately tiny and synchronous; a dead
|
|
4
|
+
* process is reclaimable after the stale interval.
|
|
5
|
+
*/
|
|
6
|
+
export declare function withProfileMutationLock<T>(configPath: string, operation: () => T): T;
|
|
7
|
+
//# sourceMappingURL=profile-lock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile-lock.d.ts","sourceRoot":"","sources":["../../../src/lib/config/profile-lock.ts"],"names":[],"mappings":"AAgCA;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,GAAG,CAAC,CA4BpF"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { existsSync, lstatSync, mkdirSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { dirname, join } from 'node:path';
|
|
3
|
+
import lockfile from 'proper-lockfile';
|
|
4
|
+
const PROFILE_LOCK_STALE_MS = 10_000;
|
|
5
|
+
const PROFILE_LOCK_RETRY_MS = 100;
|
|
6
|
+
const PROFILE_LOCK_RETRIES = 50;
|
|
7
|
+
const sleepBuffer = new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT));
|
|
8
|
+
let heldDepth = 0;
|
|
9
|
+
function profileLockTarget(configPath) {
|
|
10
|
+
const directory = join(dirname(configPath), 'locks');
|
|
11
|
+
mkdirSync(directory, { recursive: true, mode: 0o700 });
|
|
12
|
+
const target = join(directory, 'profile-store.lock');
|
|
13
|
+
if (!existsSync(target)) {
|
|
14
|
+
try {
|
|
15
|
+
writeFileSync(target, '', { flag: 'wx', mode: 0o600 });
|
|
16
|
+
}
|
|
17
|
+
catch (error) {
|
|
18
|
+
if (error.code !== 'EEXIST') {
|
|
19
|
+
throw new Error('CLI profile store lock is unavailable');
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
const stat = lstatSync(target);
|
|
24
|
+
if (!stat.isFile() || stat.isSymbolicLink() || (stat.mode & 0o077) !== 0) {
|
|
25
|
+
throw new Error('CLI profile store lock is unsafe');
|
|
26
|
+
}
|
|
27
|
+
return target;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Execute one synchronous profile-store transaction under a cross-process
|
|
31
|
+
* lock. Profile mutations are deliberately tiny and synchronous; a dead
|
|
32
|
+
* process is reclaimable after the stale interval.
|
|
33
|
+
*/
|
|
34
|
+
export function withProfileMutationLock(configPath, operation) {
|
|
35
|
+
if (heldDepth > 0)
|
|
36
|
+
return operation();
|
|
37
|
+
let release;
|
|
38
|
+
const target = profileLockTarget(configPath);
|
|
39
|
+
for (let attempt = 0; attempt <= PROFILE_LOCK_RETRIES; attempt += 1) {
|
|
40
|
+
try {
|
|
41
|
+
release = lockfile.lockSync(target, { stale: PROFILE_LOCK_STALE_MS });
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
if (error.code !== 'ELOCKED') {
|
|
46
|
+
throw new Error('CLI profile store lock is unavailable');
|
|
47
|
+
}
|
|
48
|
+
if (attempt === PROFILE_LOCK_RETRIES) {
|
|
49
|
+
throw new Error('CLI profile store is busy');
|
|
50
|
+
}
|
|
51
|
+
Atomics.wait(sleepBuffer, 0, 0, PROFILE_LOCK_RETRY_MS);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (!release)
|
|
55
|
+
throw new Error('CLI profile store is busy');
|
|
56
|
+
heldDepth += 1;
|
|
57
|
+
try {
|
|
58
|
+
return operation();
|
|
59
|
+
}
|
|
60
|
+
finally {
|
|
61
|
+
heldDepth -= 1;
|
|
62
|
+
release();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
//# sourceMapping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,EAAE,CAAC;IACrB,CAAC;YAAS,CAAC;QACT,SAAS,IAAI,CAAC,CAAC;QACf,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC"}
|
|
@@ -11,6 +11,11 @@ export declare function getCurrentProfile(): Profile;
|
|
|
11
11
|
* Save profile data (invalidates cache)
|
|
12
12
|
*/
|
|
13
13
|
export declare function saveProfile(profileName: string, profile: Profile): void;
|
|
14
|
+
/**
|
|
15
|
+
* Atomically mutate authentication fields for exactly one existing profile.
|
|
16
|
+
* Generic profile writes preserve these fields and cannot clobber them.
|
|
17
|
+
*/
|
|
18
|
+
export declare function mutateProfileAuthentication(profileName: string, mutation: (profile: Profile) => Profile): Profile;
|
|
14
19
|
/**
|
|
15
20
|
* List all profiles
|
|
16
21
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../../src/lib/config/profile.ts"],"names":[],"mappings":"AAQA,OAAO,EAAoC,KAAK,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../../src/lib/config/profile.ts"],"names":[],"mappings":"AAQA,OAAO,EAAoC,KAAK,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AAgB9F;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAG7C;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAqB3C;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAOvE;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CACzC,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,GACtC,OAAO,CAoBT;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,WAAW,EAAE,CAW5C;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,EAAE,CAI3C;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAInD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAsClH;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAkBhD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAQhD;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAG5D;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAuBpE"}
|
|
@@ -2,10 +2,30 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Profile management operations
|
|
4
4
|
*/
|
|
5
|
-
import { store, getRuntimeProfile } from './store.js';
|
|
5
|
+
import { store, getRuntimeProfile, withStoreMutation } from './store.js';
|
|
6
6
|
import { ensureMigrated } from './migration.js';
|
|
7
7
|
import { CONFIG_DEFAULTS, DEFAULT_PROFILE } from './types.js';
|
|
8
8
|
import { getCachedProfile, cacheProfile, invalidateProfileCache } from './cache.js';
|
|
9
|
+
function preserveAuthentication(current, proposed) {
|
|
10
|
+
const next = { ...proposed };
|
|
11
|
+
if (current?.credentials !== undefined)
|
|
12
|
+
next.credentials = current.credentials;
|
|
13
|
+
else
|
|
14
|
+
delete next.credentials;
|
|
15
|
+
if (current?.apiKey !== undefined)
|
|
16
|
+
next.apiKey = current.apiKey;
|
|
17
|
+
else
|
|
18
|
+
delete next.apiKey;
|
|
19
|
+
if (current?.apiKeyId !== undefined)
|
|
20
|
+
next.apiKeyId = current.apiKeyId;
|
|
21
|
+
else
|
|
22
|
+
delete next.apiKeyId;
|
|
23
|
+
if (current?.apiKeyName !== undefined)
|
|
24
|
+
next.apiKeyName = current.apiKeyName;
|
|
25
|
+
else
|
|
26
|
+
delete next.apiKeyName;
|
|
27
|
+
return next;
|
|
28
|
+
}
|
|
9
29
|
/**
|
|
10
30
|
* Get the current active profile name
|
|
11
31
|
*/
|
|
@@ -39,11 +59,37 @@ export function getCurrentProfile() {
|
|
|
39
59
|
* Save profile data (invalidates cache)
|
|
40
60
|
*/
|
|
41
61
|
export function saveProfile(profileName, profile) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
62
|
+
withStoreMutation(() => {
|
|
63
|
+
const profiles = store.get('profiles');
|
|
64
|
+
profiles[profileName] = preserveAuthentication(profiles[profileName], profile);
|
|
65
|
+
store.set('profiles', profiles);
|
|
66
|
+
invalidateProfileCache(profileName);
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Atomically mutate authentication fields for exactly one existing profile.
|
|
71
|
+
* Generic profile writes preserve these fields and cannot clobber them.
|
|
72
|
+
*/
|
|
73
|
+
export function mutateProfileAuthentication(profileName, mutation) {
|
|
74
|
+
return withStoreMutation(() => {
|
|
75
|
+
const profiles = store.get('profiles');
|
|
76
|
+
const hasProfile = Object.prototype.hasOwnProperty.call(profiles, profileName);
|
|
77
|
+
if (!hasProfile && profileName !== DEFAULT_PROFILE) {
|
|
78
|
+
throw new Error(`Profile '${profileName}' not found`);
|
|
79
|
+
}
|
|
80
|
+
const current = hasProfile
|
|
81
|
+
? profiles[profileName]
|
|
82
|
+
: {
|
|
83
|
+
url: CONFIG_DEFAULTS.url,
|
|
84
|
+
insecure: CONFIG_DEFAULTS.insecure,
|
|
85
|
+
timeout: CONFIG_DEFAULTS.timeout,
|
|
86
|
+
};
|
|
87
|
+
const updated = mutation({ ...current });
|
|
88
|
+
profiles[profileName] = updated;
|
|
89
|
+
store.set('profiles', profiles);
|
|
90
|
+
invalidateProfileCache(profileName);
|
|
91
|
+
return updated;
|
|
92
|
+
});
|
|
47
93
|
}
|
|
48
94
|
/**
|
|
49
95
|
* List all profiles
|
|
@@ -85,34 +131,39 @@ export function profileExists(name) {
|
|
|
85
131
|
* Create a new profile
|
|
86
132
|
*/
|
|
87
133
|
export function createProfile(name, options) {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
let newProfile;
|
|
93
|
-
if (options.copyFrom) {
|
|
94
|
-
if (!(options.copyFrom in profiles)) {
|
|
95
|
-
throw new Error(`Source profile '${options.copyFrom}' not found`);
|
|
134
|
+
withStoreMutation(() => {
|
|
135
|
+
const profiles = store.get('profiles');
|
|
136
|
+
if (name in profiles) {
|
|
137
|
+
throw new Error(`Profile '${name}' already exists`);
|
|
96
138
|
}
|
|
97
|
-
newProfile
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
139
|
+
let newProfile;
|
|
140
|
+
if (options.copyFrom) {
|
|
141
|
+
if (!(options.copyFrom in profiles)) {
|
|
142
|
+
throw new Error(`Source profile '${options.copyFrom}' not found`);
|
|
143
|
+
}
|
|
144
|
+
newProfile = { ...profiles[options.copyFrom] };
|
|
145
|
+
delete newProfile.credentials;
|
|
146
|
+
delete newProfile.apiKey;
|
|
147
|
+
delete newProfile.apiKeyId;
|
|
148
|
+
delete newProfile.apiKeyName;
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
newProfile = {
|
|
152
|
+
url: options.url ?? CONFIG_DEFAULTS.url,
|
|
153
|
+
insecure: options.insecure ?? CONFIG_DEFAULTS.insecure,
|
|
154
|
+
timeout: CONFIG_DEFAULTS.timeout,
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
if (options.url) {
|
|
158
|
+
newProfile.url = options.url;
|
|
159
|
+
}
|
|
160
|
+
if (options.insecure !== undefined) {
|
|
161
|
+
newProfile.insecure = options.insecure;
|
|
162
|
+
}
|
|
163
|
+
profiles[name] = newProfile;
|
|
164
|
+
store.set('profiles', profiles);
|
|
165
|
+
invalidateProfileCache(name);
|
|
166
|
+
});
|
|
116
167
|
}
|
|
117
168
|
/**
|
|
118
169
|
* Delete a profile
|
|
@@ -121,27 +172,31 @@ export function deleteProfile(name) {
|
|
|
121
172
|
if (name === DEFAULT_PROFILE) {
|
|
122
173
|
throw new Error(`Cannot delete the '${DEFAULT_PROFILE}' profile`);
|
|
123
174
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
store.
|
|
134
|
-
|
|
175
|
+
withStoreMutation(() => {
|
|
176
|
+
const profiles = store.get('profiles');
|
|
177
|
+
if (!(name in profiles)) {
|
|
178
|
+
throw new Error(`Profile '${name}' not found`);
|
|
179
|
+
}
|
|
180
|
+
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
|
181
|
+
delete profiles[name];
|
|
182
|
+
store.set('profiles', profiles);
|
|
183
|
+
invalidateProfileCache(name);
|
|
184
|
+
if (store.get('activeProfile') === name) {
|
|
185
|
+
store.set('activeProfile', DEFAULT_PROFILE);
|
|
186
|
+
}
|
|
187
|
+
});
|
|
135
188
|
}
|
|
136
189
|
/**
|
|
137
190
|
* Switch active profile
|
|
138
191
|
*/
|
|
139
192
|
export function switchProfile(name) {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
193
|
+
withStoreMutation(() => {
|
|
194
|
+
const profiles = store.get('profiles');
|
|
195
|
+
if (!(name in profiles)) {
|
|
196
|
+
throw new Error(`Profile '${name}' not found`);
|
|
197
|
+
}
|
|
198
|
+
store.set('activeProfile', name);
|
|
199
|
+
});
|
|
145
200
|
}
|
|
146
201
|
/**
|
|
147
202
|
* Get a specific profile
|
|
@@ -157,20 +212,23 @@ export function renameProfile(oldName, newName) {
|
|
|
157
212
|
if (oldName === DEFAULT_PROFILE) {
|
|
158
213
|
throw new Error(`Cannot rename the '${DEFAULT_PROFILE}' profile`);
|
|
159
214
|
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
215
|
+
withStoreMutation(() => {
|
|
216
|
+
const profiles = store.get('profiles');
|
|
217
|
+
if (!(oldName in profiles)) {
|
|
218
|
+
throw new Error(`Profile '${oldName}' not found`);
|
|
219
|
+
}
|
|
220
|
+
if (newName in profiles) {
|
|
221
|
+
throw new Error(`Profile '${newName}' already exists`);
|
|
222
|
+
}
|
|
223
|
+
profiles[newName] = profiles[oldName];
|
|
224
|
+
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
|
225
|
+
delete profiles[oldName];
|
|
226
|
+
store.set('profiles', profiles);
|
|
227
|
+
invalidateProfileCache(oldName);
|
|
228
|
+
invalidateProfileCache(newName);
|
|
229
|
+
if (store.get('activeProfile') === oldName) {
|
|
230
|
+
store.set('activeProfile', newName);
|
|
231
|
+
}
|
|
232
|
+
});
|
|
175
233
|
}
|
|
176
234
|
//# sourceMappingURL=profile.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile.js","sourceRoot":"","sources":["../../../src/lib/config/profile.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAElC;;GAEG;AAEH,OAAO,EAAE,KAAK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AAG,QAAQ,CAAC,OAAO,CAAC,CAAC;QACtC,gEAAgE;QAChE,OAAO,QAAQ,CAAC,OAAO,CAAC,CAAC;QACzB,KAAK,CAAC,GAAG,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;QAChC,sBAAsB,CAAC,OAAO,CAAC,CAAC;QAChC,sBAAsB,CAAC,OAAO,CAAC,CAAC;QAChC,IAAI,KAAK,CAAC,GAAG,CAAC,eAAe,CAAC,KAAK,OAAO,EAAE,CAAC;YAC3C,KAAK,CAAC,GAAG,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;QACtC,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -9,6 +9,12 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import Conf from 'conf';
|
|
11
11
|
import type { ConfigStore } from './types.js';
|
|
12
|
+
/**
|
|
13
|
+
* Run a complete read-modify-write transaction against the shared config
|
|
14
|
+
* file. Every mutation must use this authority so another CLI process cannot
|
|
15
|
+
* rewrite a stale whole-file snapshot over profile authentication.
|
|
16
|
+
*/
|
|
17
|
+
export declare function withStoreMutation<T>(operation: () => T): T;
|
|
12
18
|
/**
|
|
13
19
|
* Store proxy that lazily initializes the underlying Conf instance.
|
|
14
20
|
* This ensures mocks are applied before the real Conf is created.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../src/lib/config/store.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AAEH,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../src/lib/config/store.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AAEH,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAmD9C;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,CAAC,GAAG,CAAC,CAG1D;AAUD;;;GAGG;AACH,eAAO,MAAM,KAAK,EAAE,IAAI,CAAC,WAAW,CAsBlC,CAAC;AAKH;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAE9D;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,GAAG,IAAI,CAEjD;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAElC;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAG1C"}
|