@bussolabs/closeyourit-cli 0.0.25 → 0.1.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 +23 -0
- package/dist/base.d.ts +10 -2
- package/dist/base.js +28 -10
- package/dist/commands/environments/create.d.ts +3 -0
- package/dist/commands/environments/create.js +11 -0
- package/dist/commands/environments/update.d.ts +3 -0
- package/dist/commands/environments/update.js +11 -0
- package/dist/commands/projects/github-map.d.ts +9 -0
- package/dist/commands/projects/github-map.js +44 -0
- package/dist/commands/projects/set-environment-capabilities.d.ts +13 -0
- package/dist/commands/projects/set-environment-capabilities.js +39 -0
- package/dist/commands/secrets/assets/archive.d.ts +11 -0
- package/dist/commands/secrets/assets/archive.js +17 -0
- package/dist/commands/secrets/assets/delegate.d.ts +10 -0
- package/dist/commands/secrets/assets/delegate.js +17 -0
- package/dist/commands/secrets/assets/download.d.ts +14 -0
- package/dist/commands/secrets/assets/download.js +25 -0
- package/dist/commands/secrets/assets/list.d.ts +10 -0
- package/dist/commands/secrets/assets/list.js +18 -0
- package/dist/commands/secrets/assets/purge.d.ts +12 -0
- package/dist/commands/secrets/assets/purge.js +22 -0
- package/dist/commands/secrets/assets/rollback.d.ts +11 -0
- package/dist/commands/secrets/assets/rollback.js +17 -0
- package/dist/commands/secrets/assets/shared-list.d.ts +5 -0
- package/dist/commands/secrets/assets/shared-list.js +15 -0
- package/dist/commands/secrets/assets/shared-upload.d.ts +11 -0
- package/dist/commands/secrets/assets/shared-upload.js +24 -0
- package/dist/commands/secrets/assets/undelegate.d.ts +10 -0
- package/dist/commands/secrets/assets/undelegate.js +17 -0
- package/dist/commands/secrets/assets/upload.d.ts +12 -0
- package/dist/commands/secrets/assets/upload.js +25 -0
- package/dist/commands/secrets/assets/versions.d.ts +10 -0
- package/dist/commands/secrets/assets/versions.js +18 -0
- package/dist/commands/service-accounts/create.d.ts +15 -0
- package/dist/commands/service-accounts/create.js +46 -0
- package/dist/commands/service-accounts/delete.d.ts +12 -0
- package/dist/commands/service-accounts/delete.js +25 -0
- package/dist/commands/service-accounts/list.d.ts +9 -0
- package/dist/commands/service-accounts/list.js +25 -0
- package/dist/commands/service-accounts/tokens/create.d.ts +10 -0
- package/dist/commands/service-accounts/tokens/create.js +27 -0
- package/dist/commands/service-accounts/tokens/revoke.d.ts +13 -0
- package/dist/commands/service-accounts/tokens/revoke.js +26 -0
- package/dist/lib/api.js +6 -0
- package/dist/lib/config.js +10 -1
- package/oclif.manifest.json +3609 -2639
- package/opencli.json +265 -1
- package/package.json +2 -2
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const base_1 = require("../../../base");
|
|
5
|
+
class SecretsAssetsUndelegate extends base_1.BaseCommand {
|
|
6
|
+
static args = { id: core_1.Args.string({ required: true }) };
|
|
7
|
+
static flags = { project: core_1.Flags.string({ char: 'p', required: true }) };
|
|
8
|
+
async run() {
|
|
9
|
+
const { args, flags } = await this.parse(SecretsAssetsUndelegate);
|
|
10
|
+
const projectId = await this.resolveProjectId(flags.project);
|
|
11
|
+
await this.api.delete(`/cli/v1/shared_secret_assets/${encodeURIComponent(args.id)}/undelegate?project_id=${encodeURIComponent(projectId)}`);
|
|
12
|
+
if (!this.jsonEnabled())
|
|
13
|
+
this.log(`Removed shared-asset delegation from ${flags.project}`);
|
|
14
|
+
return { undelegated: true, project_id: projectId };
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.default = SecretsAssetsUndelegate;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BaseCommand } from '../../../base';
|
|
2
|
+
export default class SecretsAssetsUpload extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
file: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
6
|
+
name: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
7
|
+
environment: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
|
+
description: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
9
|
+
project: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
|
+
};
|
|
11
|
+
run(): Promise<unknown>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const promises_1 = require("node:fs/promises");
|
|
4
|
+
const node_path_1 = require("node:path");
|
|
5
|
+
const core_1 = require("@oclif/core");
|
|
6
|
+
const base_1 = require("../../../base");
|
|
7
|
+
class SecretsAssetsUpload extends base_1.BaseCommand {
|
|
8
|
+
static description = 'Encrypt and upload a mobile CI secret file (never prints its contents)';
|
|
9
|
+
static flags = { ...base_1.projectFlag, file: core_1.Flags.string({ required: true }), name: core_1.Flags.string({ required: true }), environment: core_1.Flags.string(), description: core_1.Flags.string() };
|
|
10
|
+
async run() {
|
|
11
|
+
const { flags } = await this.parse(SecretsAssetsUpload);
|
|
12
|
+
const info = await (0, promises_1.stat)(flags.file).catch(() => undefined);
|
|
13
|
+
if (!info?.isFile())
|
|
14
|
+
this.error(`File not found or unreadable: ${flags.file}`, { exit: 2 });
|
|
15
|
+
if (info.size > 10 * 1024 * 1024)
|
|
16
|
+
this.error('Secret file exceeds 10 MiB', { exit: 2 });
|
|
17
|
+
const projectId = await this.resolveProjectId(flags.project);
|
|
18
|
+
const data = await (0, promises_1.readFile)(flags.file);
|
|
19
|
+
const res = await this.api.upload('POST', `/cli/v1/projects/${encodeURIComponent(projectId)}/secret_assets`, [{ field: 'file', filename: (0, node_path_1.basename)(flags.file), data: new Blob([data]) }], { body: { name: flags.name, environment: flags.environment, description: flags.description } });
|
|
20
|
+
if (!this.jsonEnabled())
|
|
21
|
+
this.log(`Encrypted and uploaded ${flags.name}`);
|
|
22
|
+
return res;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.default = SecretsAssetsUpload;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BaseCommand } from '../../../base';
|
|
2
|
+
export default class SecretsAssetsVersions extends BaseCommand {
|
|
3
|
+
static args: {
|
|
4
|
+
id: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
5
|
+
};
|
|
6
|
+
static flags: {
|
|
7
|
+
project: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
|
+
};
|
|
9
|
+
run(): Promise<unknown>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const base_1 = require("../../../base");
|
|
5
|
+
const output_1 = require("../../../lib/output");
|
|
6
|
+
class SecretsAssetsVersions extends base_1.BaseCommand {
|
|
7
|
+
static args = { id: core_1.Args.string({ required: true }) };
|
|
8
|
+
static flags = { ...base_1.projectFlag };
|
|
9
|
+
async run() {
|
|
10
|
+
const { args, flags } = await this.parse(SecretsAssetsVersions);
|
|
11
|
+
const projectId = await this.resolveProjectId(flags.project);
|
|
12
|
+
const res = await this.api.get(`/cli/v1/projects/${encodeURIComponent(projectId)}/secret_assets/${encodeURIComponent(args.id)}/versions`);
|
|
13
|
+
if (!this.jsonEnabled())
|
|
14
|
+
this.log((0, output_1.renderTable)(['VERSION', 'FILENAME', 'BYTES', 'CREATED'], (res.data ?? []).map((v) => [String(v.number ?? ''), String(v.filename ?? ''), String(v.byte_size ?? ''), String(v.created_at ?? '')])));
|
|
15
|
+
return res;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.default = SecretsAssetsVersions;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base';
|
|
2
|
+
export default class ServiceAccountsCreate extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
name: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
7
|
+
handle: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
|
+
project: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
9
|
+
group: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
|
+
role: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
11
|
+
'grant-secrets': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
12
|
+
'secret-environment': import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
13
|
+
};
|
|
14
|
+
run(): Promise<unknown>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const base_1 = require("../../base");
|
|
5
|
+
class ServiceAccountsCreate extends base_1.BaseCommand {
|
|
6
|
+
static description = 'Create a service account (AI member, CLI-only)';
|
|
7
|
+
static examples = [
|
|
8
|
+
'<%= config.bin %> service-accounts create --name "Deploy bot" --project CYI --grant-secrets --secret-environment staging',
|
|
9
|
+
];
|
|
10
|
+
static flags = {
|
|
11
|
+
name: core_1.Flags.string({ description: 'Display name', required: true }),
|
|
12
|
+
handle: core_1.Flags.string({ description: 'Handle (a-z, 0-9, underscore); derived from name if omitted' }),
|
|
13
|
+
project: core_1.Flags.string({ description: 'Grant visibility on a project key/id (repeatable)', multiple: true }),
|
|
14
|
+
group: core_1.Flags.string({ description: 'Grant visibility on a group name/id (repeatable)', multiple: true }),
|
|
15
|
+
role: core_1.Flags.string({ description: 'Assign a role name/id (repeatable)', multiple: true }),
|
|
16
|
+
'grant-secrets': core_1.Flags.boolean({ description: 'Grant read+write secrets on the visible projects', default: false }),
|
|
17
|
+
'secret-environment': core_1.Flags.string({
|
|
18
|
+
description: 'Restrict secret access to these environment codes (repeatable; empty = all environments)',
|
|
19
|
+
multiple: true,
|
|
20
|
+
}),
|
|
21
|
+
};
|
|
22
|
+
async run() {
|
|
23
|
+
const { flags } = await this.parse(ServiceAccountsCreate);
|
|
24
|
+
const projectIds = await Promise.all((flags.project ?? []).map((value) => this.resolveProjectId(value)));
|
|
25
|
+
const groupIds = await Promise.all((flags.group ?? []).map((value) => this.resolveGroupId(value)));
|
|
26
|
+
const roleIds = await Promise.all((flags.role ?? []).map((value) => this.resolveRoleId(value)));
|
|
27
|
+
const body = {
|
|
28
|
+
name: flags.name,
|
|
29
|
+
project_ids: projectIds,
|
|
30
|
+
group_ids: groupIds,
|
|
31
|
+
role_ids: roleIds,
|
|
32
|
+
grant_secrets: flags['grant-secrets'],
|
|
33
|
+
secret_environment_codes: flags['secret-environment'] ?? [],
|
|
34
|
+
};
|
|
35
|
+
if (flags.handle)
|
|
36
|
+
body.handle = flags.handle;
|
|
37
|
+
const res = await this.api.post('/cli/v1/service/accounts', body);
|
|
38
|
+
if (!this.jsonEnabled()) {
|
|
39
|
+
const id = res.data?.id ?? '<id>';
|
|
40
|
+
this.log(`Created service account ${id} (@${res.data?.handle ?? ''}).`);
|
|
41
|
+
this.log(`Mint a token with: service-accounts tokens create ${id} <name>`);
|
|
42
|
+
}
|
|
43
|
+
return res;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.default = ServiceAccountsCreate;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base';
|
|
2
|
+
export default class ServiceAccountsDelete extends BaseCommand {
|
|
3
|
+
static args: {
|
|
4
|
+
id: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
5
|
+
};
|
|
6
|
+
static description: string;
|
|
7
|
+
static examples: string[];
|
|
8
|
+
static flags: {
|
|
9
|
+
confirm: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
};
|
|
11
|
+
run(): Promise<unknown>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const base_1 = require("../../base");
|
|
5
|
+
class ServiceAccountsDelete extends base_1.BaseCommand {
|
|
6
|
+
static args = {
|
|
7
|
+
id: core_1.Args.string({ description: 'Service account id', required: true }),
|
|
8
|
+
};
|
|
9
|
+
static description = 'Delete a service account (revokes its tokens + removes org access; the secrets audit trail is kept)';
|
|
10
|
+
static examples = ['<%= config.bin %> service-accounts delete <id> --confirm'];
|
|
11
|
+
static flags = {
|
|
12
|
+
confirm: core_1.Flags.boolean({ description: 'Required: confirm the deletion' }),
|
|
13
|
+
};
|
|
14
|
+
async run() {
|
|
15
|
+
const { args, flags } = await this.parse(ServiceAccountsDelete);
|
|
16
|
+
if (!flags.confirm) {
|
|
17
|
+
this.error('Refusing to delete without --confirm.', { exit: 2 });
|
|
18
|
+
}
|
|
19
|
+
await this.api.delete(`/cli/v1/service/accounts/${encodeURIComponent(args.id)}`);
|
|
20
|
+
if (!this.jsonEnabled())
|
|
21
|
+
this.log(`Deleted service account ${args.id}`);
|
|
22
|
+
return { deleted: args.id };
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.default = ServiceAccountsDelete;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base';
|
|
2
|
+
export default class ServiceAccountsList extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
page: import("@oclif/core/lib/interfaces").OptionFlag<number, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
7
|
+
};
|
|
8
|
+
run(): Promise<unknown>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const base_1 = require("../../base");
|
|
4
|
+
const output_1 = require("../../lib/output");
|
|
5
|
+
class ServiceAccountsList extends base_1.BaseCommand {
|
|
6
|
+
static description = 'List the service accounts (AI members, CLI-only) in your organization';
|
|
7
|
+
static examples = ['<%= config.bin %> service-accounts list', '<%= config.bin %> service-accounts list --json'];
|
|
8
|
+
static flags = { ...base_1.pageFlag };
|
|
9
|
+
async run() {
|
|
10
|
+
const { flags } = await this.parse(ServiceAccountsList);
|
|
11
|
+
const res = await this.api.get(`/cli/v1/service/accounts?page=${flags.page}`);
|
|
12
|
+
const accounts = res.data ?? [];
|
|
13
|
+
if (!this.jsonEnabled()) {
|
|
14
|
+
this.log((0, output_1.renderTable)(['NAME', 'HANDLE', 'SECRET ENVS', 'TOKENS', 'ID'], accounts.map((account) => [
|
|
15
|
+
String(account.name ?? ''),
|
|
16
|
+
String(account.handle ?? ''),
|
|
17
|
+
(account.secret_environment_codes ?? []).join(',') || 'all',
|
|
18
|
+
String(account.active_tokens_count ?? 0),
|
|
19
|
+
String(account.id ?? ''),
|
|
20
|
+
])));
|
|
21
|
+
}
|
|
22
|
+
return res;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.default = ServiceAccountsList;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BaseCommand } from '../../../base';
|
|
2
|
+
export default class ServiceAccountsTokensCreate extends BaseCommand {
|
|
3
|
+
static args: {
|
|
4
|
+
account: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
5
|
+
name: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
6
|
+
};
|
|
7
|
+
static description: string;
|
|
8
|
+
static examples: string[];
|
|
9
|
+
run(): Promise<unknown>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const base_1 = require("../../../base");
|
|
5
|
+
class ServiceAccountsTokensCreate extends base_1.BaseCommand {
|
|
6
|
+
static args = {
|
|
7
|
+
account: core_1.Args.string({ description: 'Service account id', required: true }),
|
|
8
|
+
name: core_1.Args.string({ description: 'Token name (e.g. ci-deploy)', required: true }),
|
|
9
|
+
};
|
|
10
|
+
static description = 'Create a CLI token (cyi_u_) for a service account (the secret is shown only once)';
|
|
11
|
+
static examples = ['<%= config.bin %> service-accounts tokens create <account-id> ci-deploy'];
|
|
12
|
+
async run() {
|
|
13
|
+
const { args } = await this.parse(ServiceAccountsTokensCreate);
|
|
14
|
+
const res = await this.api.post(`/cli/v1/service/accounts/${encodeURIComponent(args.account)}/tokens`, { name: args.name });
|
|
15
|
+
const token = res.data ?? {};
|
|
16
|
+
if (!this.jsonEnabled()) {
|
|
17
|
+
this.log('Service account token created. Store the secret now — it is shown only once:');
|
|
18
|
+
this.log('');
|
|
19
|
+
this.log(` secret: ${token.secret ?? '-'}`);
|
|
20
|
+
this.log('');
|
|
21
|
+
this.log('Use it headless: CLOSEYOURIT_TOKEN=<secret> closeyourit secrets bundle -p KEY -e development');
|
|
22
|
+
this.warn('The secret cannot be retrieved again. If you lose it, revoke and create a new one.');
|
|
23
|
+
}
|
|
24
|
+
return res;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.default = ServiceAccountsTokensCreate;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BaseCommand } from '../../../base';
|
|
2
|
+
export default class ServiceAccountsTokensRevoke extends BaseCommand {
|
|
3
|
+
static args: {
|
|
4
|
+
account: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
5
|
+
id: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
6
|
+
};
|
|
7
|
+
static description: string;
|
|
8
|
+
static examples: string[];
|
|
9
|
+
static flags: {
|
|
10
|
+
confirm: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
};
|
|
12
|
+
run(): Promise<unknown>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const base_1 = require("../../../base");
|
|
5
|
+
class ServiceAccountsTokensRevoke extends base_1.BaseCommand {
|
|
6
|
+
static args = {
|
|
7
|
+
account: core_1.Args.string({ description: 'Service account id', required: true }),
|
|
8
|
+
id: core_1.Args.string({ description: 'Token id', required: true }),
|
|
9
|
+
};
|
|
10
|
+
static description = 'Revoke a service account CLI token (the agent using it loses access)';
|
|
11
|
+
static examples = ['<%= config.bin %> service-accounts tokens revoke <account-id> <token-id> --confirm'];
|
|
12
|
+
static flags = {
|
|
13
|
+
confirm: core_1.Flags.boolean({ description: 'Required: confirm the revocation' }),
|
|
14
|
+
};
|
|
15
|
+
async run() {
|
|
16
|
+
const { args, flags } = await this.parse(ServiceAccountsTokensRevoke);
|
|
17
|
+
if (!flags.confirm) {
|
|
18
|
+
this.error('Refusing to revoke without --confirm.', { exit: 2 });
|
|
19
|
+
}
|
|
20
|
+
await this.api.delete(`/cli/v1/service/accounts/${encodeURIComponent(args.account)}/tokens/${encodeURIComponent(args.id)}`);
|
|
21
|
+
if (!this.jsonEnabled())
|
|
22
|
+
this.log(`Revoked token ${args.id}`);
|
|
23
|
+
return { revoked: args.id };
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.default = ServiceAccountsTokensRevoke;
|
package/dist/lib/api.js
CHANGED
|
@@ -47,6 +47,12 @@ class CliApi {
|
|
|
47
47
|
const form = new FormData();
|
|
48
48
|
for (const file of files)
|
|
49
49
|
form.append(file.field, file.data, file.filename);
|
|
50
|
+
if (opts.body && typeof opts.body === 'object') {
|
|
51
|
+
for (const [key, value] of Object.entries(opts.body)) {
|
|
52
|
+
if (value !== undefined && value !== null)
|
|
53
|
+
form.append(key, String(value));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
50
56
|
const url = this.resolveUrl(path);
|
|
51
57
|
let res;
|
|
52
58
|
try {
|
package/dist/lib/config.js
CHANGED
|
@@ -56,6 +56,15 @@ function defaultApiUrl() {
|
|
|
56
56
|
const fromEnv = process.env.CLOSEYOURIT_API_URL;
|
|
57
57
|
return fromEnv && fromEnv.trim() !== '' ? fromEnv : DEFAULT_API_URL;
|
|
58
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Token from CLOSEYOURIT_TOKEN env, for headless/CI/agent use (overrides the stored config token).
|
|
61
|
+
* Lets a service account (cyi_u_) authenticate non-interactively without the device-flow login:
|
|
62
|
+
* CLOSEYOURIT_TOKEN=cyi_u_... cyi secrets bundle -p KEY -e development
|
|
63
|
+
*/
|
|
64
|
+
function envToken() {
|
|
65
|
+
const fromEnv = process.env.CLOSEYOURIT_TOKEN;
|
|
66
|
+
return fromEnv && fromEnv.trim() !== '' ? fromEnv.trim() : undefined;
|
|
67
|
+
}
|
|
59
68
|
function loadConfig() {
|
|
60
69
|
const file = configPath();
|
|
61
70
|
let parsed = {};
|
|
@@ -70,7 +79,7 @@ function loadConfig() {
|
|
|
70
79
|
}
|
|
71
80
|
return {
|
|
72
81
|
apiUrl: parsed.apiUrl && parsed.apiUrl.trim() !== '' ? parsed.apiUrl : defaultApiUrl(),
|
|
73
|
-
token: parsed.token,
|
|
82
|
+
token: envToken() ?? parsed.token,
|
|
74
83
|
account: parsed.account,
|
|
75
84
|
organization: parsed.organization,
|
|
76
85
|
};
|