@indigoai-us/hq-cli 5.103.4 → 5.103.6
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/CHANGELOG.md +4 -0
- package/dist/commands/api-keys.js +11 -2
- package/dist/utils/vault-api.js +5 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -190,7 +190,11 @@ export function registerApiKeysCommand(program) {
|
|
|
190
190
|
const deployCapabilities = capabilities.filter((cap) => cap === "deploy:write" || cap === "deploy:read");
|
|
191
191
|
const expiresAt = parseExpires(opts.expires);
|
|
192
192
|
const token = await requireCognitoForApiKeys("api-keys create");
|
|
193
|
-
|
|
193
|
+
// The company selector the caller typed (a slug, e.g. `indigo`, unless
|
|
194
|
+
// they passed a raw uid). Kept so the metadata can lead with the slug
|
|
195
|
+
// instead of only the resolved uid.
|
|
196
|
+
const companyRef = apiKeys.opts().company;
|
|
197
|
+
const companyUid = await getCompanyUid(token, companyRef);
|
|
194
198
|
const res = await vaultApiFetch({
|
|
195
199
|
token,
|
|
196
200
|
path: "/v1/api-keys",
|
|
@@ -224,7 +228,12 @@ export function registerApiKeysCommand(program) {
|
|
|
224
228
|
console.log(chalk.bold("Metadata"));
|
|
225
229
|
console.log(` Key ID: ${data.apiKey.keyId}`);
|
|
226
230
|
console.log(` Name: ${data.apiKey.name}`);
|
|
227
|
-
|
|
231
|
+
// Lead with the slug the caller typed (uid in parens, since the key is
|
|
232
|
+
// uid-bound); fall back to the bare uid when they passed a uid or relied
|
|
233
|
+
// on a single active membership.
|
|
234
|
+
console.log(` Company: ${companyRef && companyRef !== data.apiKey.companyUid
|
|
235
|
+
? `${companyRef} (${data.apiKey.companyUid})`
|
|
236
|
+
: data.apiKey.companyUid}`);
|
|
228
237
|
console.log(` Permission: ${data.apiKey.scope.permission}`);
|
|
229
238
|
console.log(` Capabilities: ${formatCapabilities(data.apiKey.scope.capabilities ?? capabilities)}`);
|
|
230
239
|
console.log(` Prefixes: ${formatPrefixes(data.apiKey.scope.allowedPrefixes)}`);
|
package/dist/utils/vault-api.js
CHANGED
|
@@ -368,10 +368,12 @@ async function resolveCompanyFromMemberships(token) {
|
|
|
368
368
|
if (active.length === 1) {
|
|
369
369
|
return active[0].companyUid;
|
|
370
370
|
}
|
|
371
|
-
|
|
372
|
-
|
|
371
|
+
// Prefer the slug (the documented `--company` input) over the raw uid; fall
|
|
372
|
+
// back to the uid only when the server did not enrich a slug.
|
|
373
|
+
const picks = active.map((m) => ` --company ${m.companySlug ?? m.companyUid}`);
|
|
374
|
+
throw new CompanySelectionError(`Multiple active companies found. Re-run with --company <slug> to ` +
|
|
373
375
|
`pick one:\n` +
|
|
374
|
-
|
|
376
|
+
picks.join('\n'));
|
|
375
377
|
}
|
|
376
378
|
export async function getCompanyUid(token, companySlug) {
|
|
377
379
|
// Vault API keys are company-bound. Entity slug resolution has no keyed
|