@bctrl/cli 0.1.3 → 0.1.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/README.md +95 -95
- package/dist/api/auth.d.ts +5 -6
- package/dist/api/auth.js +4 -5
- package/dist/api/client.d.ts +1 -0
- package/dist/api/client.js +3 -0
- package/dist/api/errors.js +2 -2
- package/dist/bin/bctrl.js +0 -0
- package/dist/commands/ai/index.js +71 -106
- package/dist/commands/{browser → api-key}/index.d.ts +1 -1
- package/dist/commands/api-key/index.js +47 -0
- package/dist/commands/auth/login.js +2 -1
- package/dist/commands/auth/status.js +5 -0
- package/dist/commands/browser-extension/index.d.ts +3 -0
- package/dist/commands/browser-extension/index.js +85 -0
- package/dist/commands/file/index.js +26 -21
- package/dist/commands/{invocation → help}/index.d.ts +1 -1
- package/dist/commands/help/index.js +17 -0
- package/dist/commands/proxy/index.d.ts +3 -0
- package/dist/commands/proxy/index.js +72 -0
- package/dist/commands/run/index.js +227 -160
- package/dist/commands/runtime/index.js +343 -118
- package/dist/commands/shared/help.d.ts +1 -0
- package/dist/commands/shared/help.js +10 -6
- package/dist/commands/shared/operation.d.ts +83 -0
- package/dist/commands/shared/{rest.js → operation.js} +81 -32
- package/dist/commands/space/index.js +62 -68
- package/dist/commands/space/list.d.ts +1 -11
- package/dist/commands/space/list.js +12 -20
- package/dist/commands/subaccount/index.js +56 -125
- package/dist/commands/tool/index.js +28 -22
- package/dist/commands/tool-call/index.js +11 -6
- package/dist/commands/toolset/index.js +16 -15
- package/dist/commands/usage/index.d.ts +3 -0
- package/dist/commands/usage/index.js +13 -0
- package/dist/commands/vault/index.js +115 -34
- package/dist/config/auth-store.d.ts +10 -12
- package/dist/config/auth-store.js +4 -5
- package/dist/generated/help.d.ts +5992 -71
- package/dist/generated/help.js +7918 -123
- package/dist/generated/openapi-routes.d.ts +391 -0
- package/dist/generated/openapi-routes.js +100 -0
- package/dist/generated/openapi-types.d.ts +13755 -0
- package/dist/generated/openapi-types.js +5 -0
- package/dist/openapi.d.ts +20 -0
- package/dist/openapi.js +1 -0
- package/dist/root.js +10 -4
- package/package.json +47 -45
- package/dist/commands/browser/index.js +0 -53
- package/dist/commands/invocation/index.js +0 -36
- package/dist/commands/shared/rest.d.ts +0 -54
|
@@ -1,40 +1,46 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
|
-
import {
|
|
2
|
+
import { parsePositiveInteger } from '../shared/options.js';
|
|
3
|
+
import { createOperationDeleteCommand, createOperationJsonBodyCommand, createOperationListCommand, createOperationViewCommand, } from '../shared/operation.js';
|
|
3
4
|
export function createToolCommand(factory) {
|
|
4
|
-
const command = new Command('tool').description('Manage
|
|
5
|
-
command.addCommand(
|
|
5
|
+
const command = new Command('tool').description('Manage tools');
|
|
6
|
+
command.addCommand(createOperationListCommand(factory, {
|
|
7
|
+
operationId: 'tools.list',
|
|
6
8
|
description: 'List tools',
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
configure: (cmd) => cmd
|
|
10
|
+
.option('--space <id>', 'Filter by space id')
|
|
11
|
+
.option('-L, --limit <number>', 'Maximum number of results to return', parsePositiveInteger)
|
|
12
|
+
.option('--cursor <cursor>', 'Pagination cursor'),
|
|
13
|
+
query: (options) => ({
|
|
14
|
+
spaceId: typeof options.space === 'string' ? options.space : undefined,
|
|
15
|
+
limit: typeof options.limit === 'number' ? options.limit : undefined,
|
|
16
|
+
cursor: typeof options.cursor === 'string' ? options.cursor : undefined,
|
|
17
|
+
}),
|
|
10
18
|
}));
|
|
11
|
-
command.addCommand(
|
|
12
|
-
|
|
13
|
-
|
|
19
|
+
command.addCommand(createOperationViewCommand(factory, {
|
|
20
|
+
operationId: 'tools.get',
|
|
21
|
+
name: 'get',
|
|
22
|
+
description: 'Get a tool',
|
|
14
23
|
}));
|
|
15
|
-
command.addCommand(
|
|
24
|
+
command.addCommand(createOperationJsonBodyCommand(factory, {
|
|
25
|
+
operationId: 'tools.create',
|
|
16
26
|
name: 'create',
|
|
17
27
|
description: 'Create a tool',
|
|
18
|
-
method: 'post',
|
|
19
|
-
path: '/tools',
|
|
20
28
|
}));
|
|
21
|
-
command.addCommand(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
path: '/tools/{id}',
|
|
29
|
+
command.addCommand(createOperationJsonBodyCommand(factory, {
|
|
30
|
+
operationId: 'tools.update',
|
|
31
|
+
name: 'patch',
|
|
32
|
+
description: 'Update a tool',
|
|
26
33
|
argNames: ['id'],
|
|
27
34
|
}));
|
|
28
|
-
command.addCommand(
|
|
35
|
+
command.addCommand(createOperationJsonBodyCommand(factory, {
|
|
36
|
+
operationId: 'tools.test',
|
|
29
37
|
name: 'test',
|
|
30
38
|
description: 'Test a tool',
|
|
31
|
-
method: 'post',
|
|
32
|
-
path: '/tools/{id}/test',
|
|
33
39
|
argNames: ['id'],
|
|
34
40
|
}));
|
|
35
|
-
command.addCommand(
|
|
41
|
+
command.addCommand(createOperationDeleteCommand(factory, {
|
|
42
|
+
operationId: 'tools.delete',
|
|
36
43
|
description: 'Delete a tool',
|
|
37
|
-
path: '/tools/{id}',
|
|
38
44
|
}));
|
|
39
45
|
return command;
|
|
40
46
|
}
|
|
@@ -1,25 +1,30 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
|
-
import {
|
|
2
|
+
import { createOperationListCommand, createOperationViewCommand } from '../shared/operation.js';
|
|
3
3
|
export function createToolCallCommand(factory) {
|
|
4
4
|
const command = new Command('tool-call').description('Inspect BCTRL tool calls');
|
|
5
|
-
command.addCommand(
|
|
5
|
+
command.addCommand(createOperationListCommand(factory, {
|
|
6
|
+
operationId: 'tool-calls.list',
|
|
6
7
|
description: 'List tool calls',
|
|
7
|
-
path: '/tool-calls',
|
|
8
8
|
configure: (cmd) => cmd
|
|
9
|
+
.option('--space <id>', 'Space id')
|
|
9
10
|
.option('--tool <id>', 'Filter by tool id')
|
|
10
11
|
.option('--run <id>', 'Filter by run id')
|
|
11
12
|
.option('--invocation <id>', 'Filter by invocation id')
|
|
12
|
-
.option('--status <status>', 'Filter by status')
|
|
13
|
+
.option('--status <status>', 'Filter by status')
|
|
14
|
+
.option('--actor <actor>', 'Filter by actor'),
|
|
13
15
|
query: (options) => ({
|
|
16
|
+
spaceId: typeof options.space === 'string' ? options.space : undefined,
|
|
14
17
|
toolId: typeof options.tool === 'string' ? options.tool : undefined,
|
|
15
18
|
runId: typeof options.run === 'string' ? options.run : undefined,
|
|
16
19
|
invocationId: typeof options.invocation === 'string' ? options.invocation : undefined,
|
|
17
20
|
status: typeof options.status === 'string' ? options.status : undefined,
|
|
21
|
+
actor: typeof options.actor === 'string' ? options.actor : undefined,
|
|
18
22
|
}),
|
|
19
23
|
}));
|
|
20
|
-
command.addCommand(
|
|
24
|
+
command.addCommand(createOperationViewCommand(factory, {
|
|
25
|
+
operationId: 'tool-calls.get',
|
|
26
|
+
name: 'get',
|
|
21
27
|
description: 'View a tool call',
|
|
22
|
-
path: '/tool-calls/{id}',
|
|
23
28
|
}));
|
|
24
29
|
return command;
|
|
25
30
|
}
|
|
@@ -1,33 +1,34 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
|
-
import {
|
|
2
|
+
import { createOperationDeleteCommand, createOperationJsonBodyCommand, createOperationListCommand, createOperationViewCommand, } from '../shared/operation.js';
|
|
3
3
|
export function createToolsetCommand(factory) {
|
|
4
4
|
const command = new Command('toolset').description('Manage BCTRL toolsets');
|
|
5
|
-
command.addCommand(
|
|
5
|
+
command.addCommand(createOperationListCommand(factory, {
|
|
6
|
+
operationId: 'toolsets.list',
|
|
6
7
|
description: 'List toolsets',
|
|
7
|
-
path: '/toolsets',
|
|
8
8
|
configure: (cmd) => cmd.option('--space <id>', 'Filter by space id'),
|
|
9
|
-
query: (options) => ({
|
|
9
|
+
query: (options) => ({
|
|
10
|
+
spaceId: typeof options.space === 'string' ? options.space : undefined,
|
|
11
|
+
}),
|
|
10
12
|
}));
|
|
11
|
-
command.addCommand(
|
|
13
|
+
command.addCommand(createOperationViewCommand(factory, {
|
|
14
|
+
operationId: 'toolsets.get',
|
|
15
|
+
name: 'get',
|
|
12
16
|
description: 'View a toolset',
|
|
13
|
-
path: '/toolsets/{id}',
|
|
14
17
|
}));
|
|
15
|
-
command.addCommand(
|
|
18
|
+
command.addCommand(createOperationJsonBodyCommand(factory, {
|
|
19
|
+
operationId: 'toolsets.create',
|
|
16
20
|
name: 'create',
|
|
17
21
|
description: 'Create a toolset',
|
|
18
|
-
method: 'post',
|
|
19
|
-
path: '/toolsets',
|
|
20
22
|
}));
|
|
21
|
-
command.addCommand(
|
|
22
|
-
|
|
23
|
+
command.addCommand(createOperationJsonBodyCommand(factory, {
|
|
24
|
+
operationId: 'toolsets.update',
|
|
25
|
+
name: 'patch',
|
|
23
26
|
description: 'Edit a toolset',
|
|
24
|
-
method: 'patch',
|
|
25
|
-
path: '/toolsets/{id}',
|
|
26
27
|
argNames: ['id'],
|
|
27
28
|
}));
|
|
28
|
-
command.addCommand(
|
|
29
|
+
command.addCommand(createOperationDeleteCommand(factory, {
|
|
30
|
+
operationId: 'toolsets.delete',
|
|
29
31
|
description: 'Delete a toolset',
|
|
30
|
-
path: '/toolsets/{id}',
|
|
31
32
|
}));
|
|
32
33
|
return command;
|
|
33
34
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { addOutputFlags } from '../shared/output.js';
|
|
3
|
+
import { outputFlags, requestOperationAndPrint } from '../shared/operation.js';
|
|
4
|
+
export function createUsageCommand(factory) {
|
|
5
|
+
const command = addOutputFlags(new Command('usage').description('Get organization usage'));
|
|
6
|
+
command.action(async (options) => {
|
|
7
|
+
await requestOperationAndPrint(factory, 'usage.get', { output: outputFlags(options) });
|
|
8
|
+
});
|
|
9
|
+
command.addCommand(addOutputFlags(new Command('get').description('Get organization usage')).action(async (options) => {
|
|
10
|
+
await requestOperationAndPrint(factory, 'usage.get', { output: outputFlags(options) });
|
|
11
|
+
}));
|
|
12
|
+
return command;
|
|
13
|
+
}
|
|
@@ -3,14 +3,14 @@ import { CliError } from '../../runtime/errors.js';
|
|
|
3
3
|
import { readJsonFile, readText } from '../shared/io.js';
|
|
4
4
|
import { parsePositiveInteger } from '../shared/options.js';
|
|
5
5
|
import { addOutputFlags } from '../shared/output.js';
|
|
6
|
-
import {
|
|
6
|
+
import { createOperationDeleteCommand, createOperationJsonBodyCommand, createOperationListCommand, createOperationViewCommand, outputFlags, requestOperationAndPrint, } from '../shared/operation.js';
|
|
7
7
|
export function createVaultCommand(factory) {
|
|
8
8
|
const command = new Command('vault').description('Manage vault secrets and TOTP codes');
|
|
9
|
-
command.addCommand(
|
|
9
|
+
command.addCommand(createOperationListCommand(factory, {
|
|
10
|
+
operationId: 'vault.secrets.list',
|
|
10
11
|
description: 'List vault secret metadata',
|
|
11
|
-
path: '/vault/secrets',
|
|
12
12
|
configure: (cmd) => cmd
|
|
13
|
-
.option('--prefix <prefix>', 'Filter by secret
|
|
13
|
+
.option('--prefix <prefix>', 'Filter by secret key prefix')
|
|
14
14
|
.option('--origin <origin>', 'Filter by origin')
|
|
15
15
|
.option('--has-totp', 'Only show secrets with TOTP')
|
|
16
16
|
.option('-L, --limit <number>', 'Maximum number of results to return', parsePositiveInteger),
|
|
@@ -21,15 +21,19 @@ export function createVaultCommand(factory) {
|
|
|
21
21
|
limit: typeof options.limit === 'number' ? options.limit : undefined,
|
|
22
22
|
}),
|
|
23
23
|
}));
|
|
24
|
-
command.addCommand(
|
|
24
|
+
command.addCommand(createOperationViewCommand(factory, {
|
|
25
|
+
operationId: 'vault.secrets.get',
|
|
26
|
+
name: 'get',
|
|
25
27
|
description: 'View vault secret metadata',
|
|
26
|
-
|
|
28
|
+
argName: 'key',
|
|
27
29
|
}));
|
|
28
30
|
command.addCommand(createVaultReadCommand(factory));
|
|
29
31
|
command.addCommand(createVaultSetCommand(factory));
|
|
30
|
-
command.addCommand(
|
|
32
|
+
command.addCommand(createVaultPatchCommand(factory));
|
|
33
|
+
command.addCommand(createOperationDeleteCommand(factory, {
|
|
34
|
+
operationId: 'vault.secrets.delete',
|
|
31
35
|
description: 'Delete a vault secret',
|
|
32
|
-
|
|
36
|
+
argNames: ['key'],
|
|
33
37
|
}));
|
|
34
38
|
command.addCommand(createVaultTotpCommand(factory));
|
|
35
39
|
return command;
|
|
@@ -37,60 +41,137 @@ export function createVaultCommand(factory) {
|
|
|
37
41
|
function createVaultReadCommand(factory) {
|
|
38
42
|
return addOutputFlags(new Command('read')
|
|
39
43
|
.description('Read a vault secret value')
|
|
40
|
-
.argument('<
|
|
41
|
-
.option('--reveal', 'Allow printing a secret to an interactive terminal'))
|
|
42
|
-
.action(async (id, options) => {
|
|
44
|
+
.argument('<key>')
|
|
45
|
+
.option('--reveal', 'Allow printing a secret to an interactive terminal')).action(async (key, options) => {
|
|
43
46
|
if (factory.io.isStdoutTTY() && options.reveal !== true) {
|
|
44
47
|
throw new CliError('Refusing to print a secret to a terminal without --reveal');
|
|
45
48
|
}
|
|
46
|
-
await
|
|
47
|
-
|
|
49
|
+
await requestOperationAndPrint(factory, 'vault.secrets.value', {
|
|
50
|
+
pathParams: { key },
|
|
51
|
+
output: outputFlags(options),
|
|
48
52
|
});
|
|
49
53
|
});
|
|
50
54
|
}
|
|
51
55
|
function createVaultSetCommand(factory) {
|
|
52
|
-
return
|
|
56
|
+
return createOperationJsonBodyCommand(factory, {
|
|
57
|
+
operationId: 'vault.secrets.upsert',
|
|
53
58
|
name: 'set',
|
|
54
59
|
description: 'Create or replace a vault secret',
|
|
55
|
-
|
|
56
|
-
path: '/vault/secrets',
|
|
57
|
-
argNames: ['id'],
|
|
60
|
+
argNames: ['key'],
|
|
58
61
|
configure: (cmd) => cmd
|
|
62
|
+
.option('--type <type>', 'Secret type: login or value')
|
|
63
|
+
.option('--value <value>', 'Generic secret value')
|
|
64
|
+
.option('--value-from-file <path>', 'Read generic secret value from file, or - for stdin')
|
|
59
65
|
.option('--username <value>', 'Credential username')
|
|
60
66
|
.option('--password <value>', 'Credential password')
|
|
61
67
|
.option('--password-from-file <path>', 'Read password from file, or - for stdin')
|
|
62
|
-
.option('--totp <secret>', 'TOTP seed')
|
|
68
|
+
.option('--totp-secret <secret>', 'TOTP seed')
|
|
63
69
|
.option('--label <label>', 'Display label')
|
|
64
70
|
.option('--origin <origin...>', 'Allowed origin')
|
|
65
71
|
.option('--origin-pattern <pattern...>', 'Allowed origin pattern')
|
|
66
72
|
.option('--input <path>', 'Read full JSON request body from file, or - for stdin'),
|
|
67
73
|
body: async (args, options) => {
|
|
68
|
-
if (typeof options.input === 'string')
|
|
69
|
-
return readJsonFile(options.input);
|
|
74
|
+
if (typeof options.input === 'string') {
|
|
75
|
+
return (await readJsonFile(options.input));
|
|
76
|
+
}
|
|
70
77
|
const password = typeof options.passwordFromFile === 'string'
|
|
71
78
|
? (await readText(options.passwordFromFile)).trimEnd()
|
|
72
79
|
: options.password;
|
|
80
|
+
const value = typeof options.valueFromFile === 'string'
|
|
81
|
+
? (await readText(options.valueFromFile)).trimEnd()
|
|
82
|
+
: options.value;
|
|
83
|
+
const common = {
|
|
84
|
+
label: options.label,
|
|
85
|
+
origins: options.origin,
|
|
86
|
+
originPatterns: options.originPattern,
|
|
87
|
+
};
|
|
88
|
+
const type = options.type === 'value' || options.type === 'login'
|
|
89
|
+
? options.type
|
|
90
|
+
: typeof value === 'string'
|
|
91
|
+
? 'value'
|
|
92
|
+
: 'login';
|
|
93
|
+
if (typeof options.type === 'string' &&
|
|
94
|
+
options.type !== 'value' &&
|
|
95
|
+
options.type !== 'login') {
|
|
96
|
+
throw new CliError('Vault secret type must be "login" or "value"');
|
|
97
|
+
}
|
|
98
|
+
if (type === 'value') {
|
|
99
|
+
if (typeof value !== 'string') {
|
|
100
|
+
throw new CliError('Vault value secrets require --value, --value-from-file, or --input');
|
|
101
|
+
}
|
|
102
|
+
return {
|
|
103
|
+
...common,
|
|
104
|
+
type: 'value',
|
|
105
|
+
value,
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
if (typeof options.username !== 'string' || typeof password !== 'string') {
|
|
109
|
+
throw new CliError('Vault login secrets require --username and --password, --password-from-file, or --input');
|
|
110
|
+
}
|
|
73
111
|
return {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
},
|
|
80
|
-
metadata: {
|
|
81
|
-
label: options.label,
|
|
82
|
-
origins: options.origin,
|
|
83
|
-
originPatterns: options.originPattern,
|
|
84
|
-
},
|
|
112
|
+
...common,
|
|
113
|
+
type: 'login',
|
|
114
|
+
username: options.username,
|
|
115
|
+
password,
|
|
116
|
+
totpSecret: options.totpSecret,
|
|
85
117
|
};
|
|
86
118
|
},
|
|
87
119
|
});
|
|
88
120
|
}
|
|
121
|
+
function createVaultPatchCommand(factory) {
|
|
122
|
+
return createOperationJsonBodyCommand(factory, {
|
|
123
|
+
operationId: 'vault.secrets.update',
|
|
124
|
+
name: 'patch',
|
|
125
|
+
description: 'Update a vault secret',
|
|
126
|
+
argNames: ['key'],
|
|
127
|
+
configure: (cmd) => cmd
|
|
128
|
+
.option('--value <value>', 'Generic secret value')
|
|
129
|
+
.option('--value-from-file <path>', 'Read generic secret value from file, or - for stdin')
|
|
130
|
+
.option('--username <value>', 'Credential username')
|
|
131
|
+
.option('--password <value>', 'Credential password')
|
|
132
|
+
.option('--password-from-file <path>', 'Read password from file, or - for stdin')
|
|
133
|
+
.option('--totp-secret <secret>', 'TOTP seed')
|
|
134
|
+
.option('--clear-totp', 'Remove the TOTP seed')
|
|
135
|
+
.option('--label <label>', 'Display label')
|
|
136
|
+
.option('--clear-label', 'Remove the display label')
|
|
137
|
+
.option('--origin <origin...>', 'Allowed origin')
|
|
138
|
+
.option('--clear-origins', 'Remove origins')
|
|
139
|
+
.option('--origin-pattern <pattern...>', 'Allowed origin pattern')
|
|
140
|
+
.option('--clear-origin-patterns', 'Remove origin patterns')
|
|
141
|
+
.option('--input <path>', 'Read full JSON request body from file, or - for stdin'),
|
|
142
|
+
body: async (_args, options) => {
|
|
143
|
+
if (typeof options.input === 'string') {
|
|
144
|
+
return (await readJsonFile(options.input));
|
|
145
|
+
}
|
|
146
|
+
const password = typeof options.passwordFromFile === 'string'
|
|
147
|
+
? (await readText(options.passwordFromFile)).trimEnd()
|
|
148
|
+
: options.password;
|
|
149
|
+
const value = typeof options.valueFromFile === 'string'
|
|
150
|
+
? (await readText(options.valueFromFile)).trimEnd()
|
|
151
|
+
: options.value;
|
|
152
|
+
const body = {
|
|
153
|
+
value,
|
|
154
|
+
username: options.username,
|
|
155
|
+
password,
|
|
156
|
+
totpSecret: options.clearTotp === true ? null : options.totpSecret,
|
|
157
|
+
label: options.clearLabel === true ? null : options.label,
|
|
158
|
+
origins: options.clearOrigins === true ? null : options.origin,
|
|
159
|
+
originPatterns: options.clearOriginPatterns === true ? null : options.originPattern,
|
|
160
|
+
};
|
|
161
|
+
if (!Object.values(body).some((value) => value !== undefined)) {
|
|
162
|
+
throw new CliError('Vault patch requires at least one field or --input');
|
|
163
|
+
}
|
|
164
|
+
return body;
|
|
165
|
+
},
|
|
166
|
+
});
|
|
167
|
+
}
|
|
89
168
|
function createVaultTotpCommand(factory) {
|
|
90
169
|
return addOutputFlags(new Command('totp')
|
|
91
170
|
.description('Generate the current TOTP code for a vault secret')
|
|
92
|
-
.argument('<
|
|
93
|
-
|
|
94
|
-
|
|
171
|
+
.argument('<key>')).action(async (key, options) => {
|
|
172
|
+
await requestOperationAndPrint(factory, 'vault.secrets.totp', {
|
|
173
|
+
pathParams: { key },
|
|
174
|
+
output: outputFlags(options),
|
|
175
|
+
});
|
|
95
176
|
});
|
|
96
177
|
}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const StoredWhoamiSchema: z.ZodObject<{
|
|
3
|
-
authenticated: z.ZodLiteral<true>;
|
|
4
3
|
email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
scope: z.ZodEnum<{
|
|
5
|
+
organization: "organization";
|
|
7
6
|
subaccount: "subaccount";
|
|
8
7
|
}>;
|
|
9
8
|
organizationId: z.ZodString;
|
|
10
|
-
subaccountId: z.
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
subaccountId: z.ZodNullable<z.ZodString>;
|
|
10
|
+
defaultSpaceId: z.ZodString;
|
|
11
|
+
keyId: z.ZodString;
|
|
13
12
|
plan: z.ZodString;
|
|
14
13
|
}, z.core.$strict>;
|
|
15
14
|
export type StoredWhoami = z.infer<typeof StoredWhoamiSchema>;
|
|
@@ -17,16 +16,15 @@ export declare const StoredAuthSchema: z.ZodObject<{
|
|
|
17
16
|
apiBaseUrl: z.ZodString;
|
|
18
17
|
token: z.ZodString;
|
|
19
18
|
whoami: z.ZodObject<{
|
|
20
|
-
authenticated: z.ZodLiteral<true>;
|
|
21
19
|
email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
scope: z.ZodEnum<{
|
|
21
|
+
organization: "organization";
|
|
24
22
|
subaccount: "subaccount";
|
|
25
23
|
}>;
|
|
26
24
|
organizationId: z.ZodString;
|
|
27
|
-
subaccountId: z.
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
subaccountId: z.ZodNullable<z.ZodString>;
|
|
26
|
+
defaultSpaceId: z.ZodString;
|
|
27
|
+
keyId: z.ZodString;
|
|
30
28
|
plan: z.ZodString;
|
|
31
29
|
}, z.core.$strict>;
|
|
32
30
|
createdAt: z.ZodString;
|
|
@@ -5,13 +5,12 @@ import { z } from 'zod';
|
|
|
5
5
|
const DEFAULT_AUTH_FILE_NAME = 'auth.json';
|
|
6
6
|
export const StoredWhoamiSchema = z
|
|
7
7
|
.object({
|
|
8
|
-
authenticated: z.literal(true),
|
|
9
8
|
email: z.string().email().nullable().optional(),
|
|
10
|
-
|
|
9
|
+
scope: z.enum(['organization', 'subaccount']),
|
|
11
10
|
organizationId: z.string().min(1),
|
|
12
|
-
subaccountId: z.string().min(1).nullable()
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
subaccountId: z.string().min(1).nullable(),
|
|
12
|
+
defaultSpaceId: z.string().min(1),
|
|
13
|
+
keyId: z.string().min(1),
|
|
15
14
|
plan: z.string().min(1),
|
|
16
15
|
})
|
|
17
16
|
.strict();
|