@sequenceholdings/studio-cli 0.6.0 → 0.6.3
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 +186 -21
- package/dist/app/commands.d.ts +1 -1
- package/dist/app/commands.js +8 -4
- package/dist/app/deploy.js +4 -3
- package/dist/app/env-bindings.d.ts +3 -4
- package/dist/app/env-bindings.js +14 -77
- package/dist/app/readme.js +2 -2
- package/dist/app/repository-admission.d.ts +5 -0
- package/dist/app/repository-admission.js +32 -0
- package/dist/app/scaffold-files.js +8 -1
- package/dist/artifact/delegate.d.ts +4 -0
- package/dist/artifact/delegate.js +18 -8
- package/dist/artifact/sandbox.d.ts +29 -0
- package/dist/artifact/sandbox.js +109 -0
- package/dist/atlas-client.d.ts +1 -0
- package/dist/atlas-client.js +11 -2
- package/dist/command-contract.d.ts +8 -2
- package/dist/command-contract.js +3 -2
- package/dist/command-help.d.ts +7 -4
- package/dist/command-help.js +43 -3
- package/dist/feedback/commands.d.ts +3 -0
- package/dist/feedback/commands.js +108 -0
- package/dist/main.d.ts +1 -0
- package/dist/main.js +8 -13
- package/dist/orm/delegate.js +30 -11
- package/dist/orm/discover-schema.d.ts +196 -0
- package/dist/orm/discover-schema.js +84 -0
- package/dist/orm/discover.d.ts +13 -0
- package/dist/orm/discover.js +289 -0
- package/dist/pipeline/source.js +3 -0
- package/dist/repos/commands.js +9 -0
- package/dist/repos/identity-file.d.ts +17 -0
- package/dist/repos/identity-file.js +39 -0
- package/dist/repos/identity.d.ts +2 -0
- package/dist/repos/identity.js +69 -0
- package/dist/update-check.d.ts +3 -1
- package/dist/update-check.js +38 -12
- package/package.json +7 -7
package/dist/main.js
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* seq-studio templates <sub> publish and synchronize Git-backed templates
|
|
15
15
|
* seq-studio pipeline <sub> discover, query, author and operate Data Pipelines
|
|
16
16
|
* seq-studio auth <sub> manage Git authentication
|
|
17
|
+
* seq-studio feedback submit submit agent feedback
|
|
17
18
|
* seq-studio service-accounts <sub> provision runtime identities
|
|
18
19
|
* seq-studio access <sub> manage runtime resource access
|
|
19
20
|
* seq-studio envs <sub> add/list environments
|
|
@@ -25,7 +26,6 @@
|
|
|
25
26
|
import { parseArgs } from './argv.js';
|
|
26
27
|
import { renderCapabilities } from './command-contract.js';
|
|
27
28
|
import { staticHelp } from './command-help.js';
|
|
28
|
-
import { SANDBOX_BASE_URL_ENV, SANDBOX_TOKEN_FILE_ENV } from './sandbox-auth.js';
|
|
29
29
|
// Lazy-load artifact delegate: published @sequenceholdings/artifact-studio/cli
|
|
30
30
|
// still auto-runs runCli() at module load; importing it here breaks doctor/process.
|
|
31
31
|
const TOP_LEVEL_USAGE = `usage:
|
|
@@ -38,10 +38,11 @@ const TOP_LEVEL_USAGE = `usage:
|
|
|
38
38
|
seq-studio storage <sub> [args] init | validate | apply | list | show | mkdir | upload | download | access | trash | restore | purge | operations | abort | delete
|
|
39
39
|
seq-studio agents <sub> [args] init | validate | bundle | plan | apply | list | show | voice (internal)
|
|
40
40
|
seq-studio secrets <sub> [args] create | set | list | attach | detach | apply
|
|
41
|
-
seq-studio repos <sub> [args] list | namespaces | show | create | clone | pull | pulls | delete | ci
|
|
41
|
+
seq-studio repos <sub> [args] list | namespaces | show | identity | create | clone | pull | pulls | delete | ci
|
|
42
42
|
seq-studio templates <sub> [args] publish | sync | list
|
|
43
43
|
seq-studio pipeline <sub> [args] list | assets | search | describe | schema | sample | query | init | validate | repin-orm | codegen | plan | adopt | unbind | deploy | status | migrate | promote | rollback | run-now
|
|
44
44
|
seq-studio auth <sub> [args] whoami | git-credential
|
|
45
|
+
seq-studio feedback submit --file report.json [-e <env>] [--json]
|
|
45
46
|
seq-studio orm <sub> [args] init | generate | validate | plan | apply | execute | read | sql | diff | migrate-from-yaml | import
|
|
46
47
|
seq-studio service-accounts <sub> list | show | create (requires provisioning authority)
|
|
47
48
|
seq-studio access <sub> definitions | list | grant | revoke | resolve
|
|
@@ -93,12 +94,13 @@ const SUBCOMMANDS = {
|
|
|
93
94
|
storage: new Set(['init', 'validate', 'apply', 'list', 'show', 'mkdir', 'upload', 'import', 'uploads', 'reconcile', 'download', 'access', 'trash', 'restore', 'purge', 'operations', 'abort', 'delete']),
|
|
94
95
|
agents: new Set(['init', 'validate', 'bundle', 'plan', 'apply', 'list', 'show', 'voice']),
|
|
95
96
|
secrets: new Set(['create', 'set', 'list', 'attach', 'detach', 'apply', 'versions', 'set-default', 'pin']),
|
|
96
|
-
repos: new Set(['list', 'namespaces', 'show', 'create', 'clone', 'pull', 'pulls', 'delete', 'ci']),
|
|
97
|
+
repos: new Set(['list', 'namespaces', 'show', 'identity', 'create', 'clone', 'pull', 'pulls', 'delete', 'ci']),
|
|
97
98
|
templates: new Set(['publish', 'sync', 'list']),
|
|
98
99
|
'service-accounts': new Set(['list', 'show', 'create']),
|
|
99
100
|
access: new Set(['definitions', 'resolve', 'list', 'grant', 'revoke']),
|
|
100
101
|
auth: new Set(['whoami', 'git-credential', 'pat']),
|
|
101
|
-
|
|
102
|
+
feedback: new Set(['submit']),
|
|
103
|
+
orm: new Set(['init', 'generate', 'validate', 'plan', 'apply', 'execute', 'namespaces', 'describe', 'read', 'sql', 'diff', 'migrate-from-yaml', 'import']),
|
|
102
104
|
pipeline: new Set(['list', 'assets', 'search', 'describe', 'schema', 'sample', 'query', 'init', 'validate', 'repin-orm', 'codegen', 'adopt', 'unbind', 'plan', 'deploy', 'status', 'migrate', 'promote', 'rollback', 'run-now']),
|
|
103
105
|
envs: new Set(['add', 'list']),
|
|
104
106
|
};
|
|
@@ -116,15 +118,6 @@ export async function run(argv = process.argv.slice(2)) {
|
|
|
116
118
|
console.error('Artifact Studio does not accept --token bearer injection. Authenticate with seq-studio login.');
|
|
117
119
|
return 1;
|
|
118
120
|
}
|
|
119
|
-
// Same rule as --token: Artifact Studio uses only credentials the CLI obtained
|
|
120
|
-
// and realm-checked itself, never an injected bearer, so sandbox token mode
|
|
121
|
-
// does not reach it. Help stays available.
|
|
122
|
-
if (namespace === 'artifact' && !hasHelpFlag(sub, rest) &&
|
|
123
|
-
(process.env[SANDBOX_BASE_URL_ENV]?.trim() || process.env[SANDBOX_TOKEN_FILE_ENV]?.trim())) {
|
|
124
|
-
console.error(`Artifact Studio commands are not available in sandbox token mode (${SANDBOX_BASE_URL_ENV} / ${SANDBOX_TOKEN_FILE_ENV}). ` +
|
|
125
|
-
'Deploy artifacts from a signed-in seq-studio session.');
|
|
126
|
-
return 1;
|
|
127
|
-
}
|
|
128
121
|
if (hasHelpFlag(sub, rest) && sub && !['help', '--help', '-h'].includes(sub) &&
|
|
129
122
|
SUBCOMMANDS[namespace] && !SUBCOMMANDS[namespace].has(sub)) {
|
|
130
123
|
console.error(`unknown ${namespace} command: ${sub}. See seq-studio ${namespace} --help.`);
|
|
@@ -191,6 +184,8 @@ export async function run(argv = process.argv.slice(2)) {
|
|
|
191
184
|
const { runAccessCommand } = await import('./access/commands.js');
|
|
192
185
|
return runAccessCommand(sub, parseArgs(rest));
|
|
193
186
|
}
|
|
187
|
+
case 'feedback':
|
|
188
|
+
return (await import('./feedback/commands.js')).runFeedbackCommand(sub, parseArgs(rest));
|
|
194
189
|
case 'auth': {
|
|
195
190
|
const { runAuthCommand } = await import('./auth-cmds/commands.js');
|
|
196
191
|
return runAuthCommand(sub, parseArgs(rest));
|
package/dist/orm/delegate.js
CHANGED
|
@@ -15,7 +15,7 @@ import { explicitOrSandboxEnv, normalizeShortEnvFlag, readEnvFromArgv } from '..
|
|
|
15
15
|
import { REQUIRE_EXPLICIT_ENV_MESSAGE } from '../env-flags.js';
|
|
16
16
|
import { resolveFunctionSourceDir } from '../functions/source-selection.js';
|
|
17
17
|
import { warnBeforeHostDeploy } from '../manifest-roles-notice.js';
|
|
18
|
-
import { ORM_HELP } from '../command-help.js';
|
|
18
|
+
import { ORM_DISCOVER_HELP, ORM_HELP } from '../command-help.js';
|
|
19
19
|
/**
|
|
20
20
|
* ORM subcommands that talk to Atlas — must not silently target `local`.
|
|
21
21
|
* `init`, `generate`, `validate`, `diff`, `migrate-from-yaml`, and `import` are offline.
|
|
@@ -41,6 +41,10 @@ const ORM_USAGE = `usage:
|
|
|
41
41
|
read rows of a deployed v2 namespace as the caller (row-level security applies)
|
|
42
42
|
seq-studio orm sql <namespace> --query <sql> | --file <path> -e <env> [--param name[:type]=v]... | [--params <json-object>] [--json|--jsonl]
|
|
43
43
|
run read-only SQL against a deployed v2 namespace as the caller
|
|
44
|
+
seq-studio orm namespaces -e <env> [--limit N] [--offset N] [--json]
|
|
45
|
+
list the namespaces you can read
|
|
46
|
+
seq-studio orm describe <namespace> [<table>] -e <env> [--json]
|
|
47
|
+
show a namespace's tables, views, and persisted operations, or one table's columns and actions
|
|
44
48
|
seq-studio orm diff [dir] write/verify the committed migration standalone (--check is the offline CI gate; --allow-destructive consents; --rebase records a v1 -> v2 conversion)
|
|
45
49
|
seq-studio orm migrate-from-yaml <dir> convert a v1 YAML namespace to the v2 TypeScript format (offline; migrations/ preserved)
|
|
46
50
|
seq-studio orm import [dir] --spec <file> | --table <t> --from <schema.table> --map <target=source,...>
|
|
@@ -191,21 +195,36 @@ async function loadOrmCli() {
|
|
|
191
195
|
return null;
|
|
192
196
|
}
|
|
193
197
|
}
|
|
198
|
+
/**
|
|
199
|
+
* Subcommands seq-studio implements itself rather than forwarding to the ORM
|
|
200
|
+
* CLI: discovery reads Atlas's registry, and ad-hoc reads go through the ORM
|
|
201
|
+
* client. None of them needs a namespace directory.
|
|
202
|
+
*/
|
|
203
|
+
const NATIVE_ORM_SUBS = new Set(['namespaces', 'describe', 'read', 'sql']);
|
|
204
|
+
async function runNativeOrmCommand(sub, rest) {
|
|
205
|
+
const help = rest.includes('--help') || rest.includes('-h');
|
|
206
|
+
if (sub === 'namespaces' || sub === 'describe') {
|
|
207
|
+
if (help) {
|
|
208
|
+
console.log(ORM_DISCOVER_HELP);
|
|
209
|
+
return 0;
|
|
210
|
+
}
|
|
211
|
+
const { ormDescribeCommand, ormNamespacesCommand } = await import('./discover.js');
|
|
212
|
+
return sub === 'namespaces' ? ormNamespacesCommand(parseArgs(rest)) : ormDescribeCommand(parseArgs(rest));
|
|
213
|
+
}
|
|
214
|
+
const { ORM_READ_USAGE, ormReadCommand, ormSqlCommand } = await import('./read.js');
|
|
215
|
+
if (help) {
|
|
216
|
+
console.log(ORM_READ_USAGE);
|
|
217
|
+
return 0;
|
|
218
|
+
}
|
|
219
|
+
return sub === 'read' ? ormReadCommand(parseArgs(rest)) : ormSqlCommand(parseArgs(rest));
|
|
220
|
+
}
|
|
194
221
|
export async function runOrmCommand(sub, rest) {
|
|
195
222
|
if (!sub || sub === 'help' || sub === '--help' || sub === '-h') {
|
|
196
223
|
console.log(ORM_USAGE);
|
|
197
224
|
return sub ? 0 : 1;
|
|
198
225
|
}
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
const { ORM_READ_USAGE, ormReadCommand, ormSqlCommand } = await import('./read.js');
|
|
202
|
-
if (rest.includes('--help') || rest.includes('-h')) {
|
|
203
|
-
console.log(ORM_READ_USAGE);
|
|
204
|
-
return 0;
|
|
205
|
-
}
|
|
206
|
-
const args = parseArgs(rest);
|
|
207
|
-
return sub === 'read' ? ormReadCommand(args) : ormSqlCommand(args);
|
|
208
|
-
}
|
|
226
|
+
if (NATIVE_ORM_SUBS.has(sub))
|
|
227
|
+
return runNativeOrmCommand(sub, rest);
|
|
209
228
|
const normalized = normalizeShortEnvFlag(rest);
|
|
210
229
|
if (normalized.includes('--help') || normalized.includes('-h')) {
|
|
211
230
|
console.log(ORM_HELP);
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Response shapes `orm namespaces` / `orm describe` rely on. Objects are loose:
|
|
3
|
+
* only the fields the CLI renders are checked, and `--json` passes the rest
|
|
4
|
+
* through unchanged.
|
|
5
|
+
*/
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
export declare const namespaceListSchema: z.ZodObject<{
|
|
8
|
+
namespaces: z.ZodArray<z.ZodObject<{
|
|
9
|
+
id: z.ZodString;
|
|
10
|
+
description: z.ZodNullable<z.ZodString>;
|
|
11
|
+
definition_format: z.ZodNullable<z.ZodNumber>;
|
|
12
|
+
table_count: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
13
|
+
operation_count: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
14
|
+
archived_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
15
|
+
}, z.core.$loose>>;
|
|
16
|
+
total: z.ZodNumber;
|
|
17
|
+
limit: z.ZodNumber;
|
|
18
|
+
offset: z.ZodNumber;
|
|
19
|
+
}, z.core.$loose>;
|
|
20
|
+
declare const columnSchema: z.ZodObject<{
|
|
21
|
+
name: z.ZodString;
|
|
22
|
+
type: z.ZodString;
|
|
23
|
+
enum_name: z.ZodNullable<z.ZodString>;
|
|
24
|
+
nullable: z.ZodBoolean;
|
|
25
|
+
unique: z.ZodBoolean;
|
|
26
|
+
primary_key: z.ZodBoolean;
|
|
27
|
+
description: z.ZodNullable<z.ZodString>;
|
|
28
|
+
deprecated: z.ZodOptional<z.ZodBoolean>;
|
|
29
|
+
}, z.core.$loose>;
|
|
30
|
+
declare const tableSchema: z.ZodObject<{
|
|
31
|
+
source: z.ZodNullable<z.ZodString>;
|
|
32
|
+
actions: z.ZodArray<z.ZodObject<{
|
|
33
|
+
name: z.ZodString;
|
|
34
|
+
description: z.ZodNullable<z.ZodString>;
|
|
35
|
+
requires: z.ZodNullable<z.ZodString>;
|
|
36
|
+
params: z.ZodArray<z.ZodObject<{
|
|
37
|
+
name: z.ZodString;
|
|
38
|
+
type: z.ZodString;
|
|
39
|
+
nullable: z.ZodBoolean;
|
|
40
|
+
}, z.core.$loose>>;
|
|
41
|
+
}, z.core.$loose>>;
|
|
42
|
+
internal: z.ZodOptional<z.ZodBoolean>;
|
|
43
|
+
description: z.ZodNullable<z.ZodString>;
|
|
44
|
+
primary_key: z.ZodArray<z.ZodString>;
|
|
45
|
+
columns: z.ZodArray<z.ZodObject<{
|
|
46
|
+
name: z.ZodString;
|
|
47
|
+
type: z.ZodString;
|
|
48
|
+
enum_name: z.ZodNullable<z.ZodString>;
|
|
49
|
+
nullable: z.ZodBoolean;
|
|
50
|
+
unique: z.ZodBoolean;
|
|
51
|
+
primary_key: z.ZodBoolean;
|
|
52
|
+
description: z.ZodNullable<z.ZodString>;
|
|
53
|
+
deprecated: z.ZodOptional<z.ZodBoolean>;
|
|
54
|
+
}, z.core.$loose>>;
|
|
55
|
+
links: z.ZodArray<z.ZodObject<{
|
|
56
|
+
name: z.ZodString;
|
|
57
|
+
kind: z.ZodNullable<z.ZodString>;
|
|
58
|
+
target: z.ZodNullable<z.ZodString>;
|
|
59
|
+
on: z.ZodString;
|
|
60
|
+
namespace: z.ZodOptional<z.ZodString>;
|
|
61
|
+
}, z.core.$loose>>;
|
|
62
|
+
table: z.ZodString;
|
|
63
|
+
}, z.core.$loose>;
|
|
64
|
+
declare const viewSchema: z.ZodObject<{
|
|
65
|
+
description: z.ZodNullable<z.ZodString>;
|
|
66
|
+
primary_key: z.ZodArray<z.ZodString>;
|
|
67
|
+
columns: z.ZodArray<z.ZodObject<{
|
|
68
|
+
name: z.ZodString;
|
|
69
|
+
type: z.ZodString;
|
|
70
|
+
enum_name: z.ZodNullable<z.ZodString>;
|
|
71
|
+
nullable: z.ZodBoolean;
|
|
72
|
+
unique: z.ZodBoolean;
|
|
73
|
+
primary_key: z.ZodBoolean;
|
|
74
|
+
description: z.ZodNullable<z.ZodString>;
|
|
75
|
+
deprecated: z.ZodOptional<z.ZodBoolean>;
|
|
76
|
+
}, z.core.$loose>>;
|
|
77
|
+
links: z.ZodArray<z.ZodObject<{
|
|
78
|
+
name: z.ZodString;
|
|
79
|
+
kind: z.ZodNullable<z.ZodString>;
|
|
80
|
+
target: z.ZodNullable<z.ZodString>;
|
|
81
|
+
on: z.ZodString;
|
|
82
|
+
namespace: z.ZodOptional<z.ZodString>;
|
|
83
|
+
}, z.core.$loose>>;
|
|
84
|
+
view: z.ZodString;
|
|
85
|
+
}, z.core.$loose>;
|
|
86
|
+
export declare const schemaViewSchema: z.ZodObject<{
|
|
87
|
+
namespace: z.ZodString;
|
|
88
|
+
description: z.ZodNullable<z.ZodString>;
|
|
89
|
+
version_id: z.ZodString;
|
|
90
|
+
definition_format: z.ZodNumber;
|
|
91
|
+
enums: z.ZodArray<z.ZodObject<{
|
|
92
|
+
name: z.ZodString;
|
|
93
|
+
values: z.ZodArray<z.ZodString>;
|
|
94
|
+
}, z.core.$loose>>;
|
|
95
|
+
tables: z.ZodArray<z.ZodObject<{
|
|
96
|
+
source: z.ZodNullable<z.ZodString>;
|
|
97
|
+
actions: z.ZodArray<z.ZodObject<{
|
|
98
|
+
name: z.ZodString;
|
|
99
|
+
description: z.ZodNullable<z.ZodString>;
|
|
100
|
+
requires: z.ZodNullable<z.ZodString>;
|
|
101
|
+
params: z.ZodArray<z.ZodObject<{
|
|
102
|
+
name: z.ZodString;
|
|
103
|
+
type: z.ZodString;
|
|
104
|
+
nullable: z.ZodBoolean;
|
|
105
|
+
}, z.core.$loose>>;
|
|
106
|
+
}, z.core.$loose>>;
|
|
107
|
+
internal: z.ZodOptional<z.ZodBoolean>;
|
|
108
|
+
description: z.ZodNullable<z.ZodString>;
|
|
109
|
+
primary_key: z.ZodArray<z.ZodString>;
|
|
110
|
+
columns: z.ZodArray<z.ZodObject<{
|
|
111
|
+
name: z.ZodString;
|
|
112
|
+
type: z.ZodString;
|
|
113
|
+
enum_name: z.ZodNullable<z.ZodString>;
|
|
114
|
+
nullable: z.ZodBoolean;
|
|
115
|
+
unique: z.ZodBoolean;
|
|
116
|
+
primary_key: z.ZodBoolean;
|
|
117
|
+
description: z.ZodNullable<z.ZodString>;
|
|
118
|
+
deprecated: z.ZodOptional<z.ZodBoolean>;
|
|
119
|
+
}, z.core.$loose>>;
|
|
120
|
+
links: z.ZodArray<z.ZodObject<{
|
|
121
|
+
name: z.ZodString;
|
|
122
|
+
kind: z.ZodNullable<z.ZodString>;
|
|
123
|
+
target: z.ZodNullable<z.ZodString>;
|
|
124
|
+
on: z.ZodString;
|
|
125
|
+
namespace: z.ZodOptional<z.ZodString>;
|
|
126
|
+
}, z.core.$loose>>;
|
|
127
|
+
table: z.ZodString;
|
|
128
|
+
}, z.core.$loose>>;
|
|
129
|
+
views: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
130
|
+
description: z.ZodNullable<z.ZodString>;
|
|
131
|
+
primary_key: z.ZodArray<z.ZodString>;
|
|
132
|
+
columns: z.ZodArray<z.ZodObject<{
|
|
133
|
+
name: z.ZodString;
|
|
134
|
+
type: z.ZodString;
|
|
135
|
+
enum_name: z.ZodNullable<z.ZodString>;
|
|
136
|
+
nullable: z.ZodBoolean;
|
|
137
|
+
unique: z.ZodBoolean;
|
|
138
|
+
primary_key: z.ZodBoolean;
|
|
139
|
+
description: z.ZodNullable<z.ZodString>;
|
|
140
|
+
deprecated: z.ZodOptional<z.ZodBoolean>;
|
|
141
|
+
}, z.core.$loose>>;
|
|
142
|
+
links: z.ZodArray<z.ZodObject<{
|
|
143
|
+
name: z.ZodString;
|
|
144
|
+
kind: z.ZodNullable<z.ZodString>;
|
|
145
|
+
target: z.ZodNullable<z.ZodString>;
|
|
146
|
+
on: z.ZodString;
|
|
147
|
+
namespace: z.ZodOptional<z.ZodString>;
|
|
148
|
+
}, z.core.$loose>>;
|
|
149
|
+
view: z.ZodString;
|
|
150
|
+
}, z.core.$loose>>>;
|
|
151
|
+
}, z.core.$loose>;
|
|
152
|
+
declare const operationSchema: z.ZodObject<{
|
|
153
|
+
name: z.ZodString;
|
|
154
|
+
kind: z.ZodString;
|
|
155
|
+
requires: z.ZodNullable<z.ZodObject<{
|
|
156
|
+
capability: z.ZodOptional<z.ZodString>;
|
|
157
|
+
role: z.ZodOptional<z.ZodString>;
|
|
158
|
+
}, z.core.$loose>>;
|
|
159
|
+
mutation_roots: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
160
|
+
table: z.ZodString;
|
|
161
|
+
op: z.ZodString;
|
|
162
|
+
}, z.core.$loose>>>;
|
|
163
|
+
}, z.core.$loose>;
|
|
164
|
+
export declare const operationsPageSchema: z.ZodObject<{
|
|
165
|
+
operations: z.ZodArray<z.ZodObject<{
|
|
166
|
+
name: z.ZodString;
|
|
167
|
+
kind: z.ZodString;
|
|
168
|
+
requires: z.ZodNullable<z.ZodObject<{
|
|
169
|
+
capability: z.ZodOptional<z.ZodString>;
|
|
170
|
+
role: z.ZodOptional<z.ZodString>;
|
|
171
|
+
}, z.core.$loose>>;
|
|
172
|
+
mutation_roots: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
173
|
+
table: z.ZodString;
|
|
174
|
+
op: z.ZodString;
|
|
175
|
+
}, z.core.$loose>>>;
|
|
176
|
+
}, z.core.$loose>>;
|
|
177
|
+
total: z.ZodNumber;
|
|
178
|
+
}, z.core.$loose>;
|
|
179
|
+
export type SchemaView = z.infer<typeof schemaViewSchema>;
|
|
180
|
+
export type Operation = z.infer<typeof operationSchema>;
|
|
181
|
+
export type Column = z.infer<typeof columnSchema>;
|
|
182
|
+
export type Relation = {
|
|
183
|
+
kind: 'table';
|
|
184
|
+
name: string;
|
|
185
|
+
relation: z.infer<typeof tableSchema>;
|
|
186
|
+
} | {
|
|
187
|
+
kind: 'view';
|
|
188
|
+
name: string;
|
|
189
|
+
relation: z.infer<typeof viewSchema>;
|
|
190
|
+
};
|
|
191
|
+
export declare function parseResponse<T>({ schema, body, what }: {
|
|
192
|
+
schema: z.ZodType<T>;
|
|
193
|
+
body: unknown;
|
|
194
|
+
what: string;
|
|
195
|
+
}): T;
|
|
196
|
+
export {};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Response shapes `orm namespaces` / `orm describe` rely on. Objects are loose:
|
|
3
|
+
* only the fields the CLI renders are checked, and `--json` passes the rest
|
|
4
|
+
* through unchanged.
|
|
5
|
+
*/
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
const namespaceSummarySchema = z.looseObject({
|
|
8
|
+
id: z.string(),
|
|
9
|
+
description: z.string().nullable(),
|
|
10
|
+
definition_format: z.number().nullable(),
|
|
11
|
+
table_count: z.number().nullable().optional(),
|
|
12
|
+
operation_count: z.number().nullable().optional(),
|
|
13
|
+
archived_at: z.string().nullable().optional(),
|
|
14
|
+
});
|
|
15
|
+
export const namespaceListSchema = z.looseObject({
|
|
16
|
+
namespaces: z.array(namespaceSummarySchema),
|
|
17
|
+
total: z.number(),
|
|
18
|
+
limit: z.number(),
|
|
19
|
+
offset: z.number(),
|
|
20
|
+
});
|
|
21
|
+
const requiresSchema = z.looseObject({ capability: z.string().optional(), role: z.string().optional() }).nullable();
|
|
22
|
+
const columnSchema = z.looseObject({
|
|
23
|
+
name: z.string(),
|
|
24
|
+
type: z.string(),
|
|
25
|
+
enum_name: z.string().nullable(),
|
|
26
|
+
nullable: z.boolean(),
|
|
27
|
+
unique: z.boolean(),
|
|
28
|
+
primary_key: z.boolean(),
|
|
29
|
+
description: z.string().nullable(),
|
|
30
|
+
deprecated: z.boolean().optional(),
|
|
31
|
+
});
|
|
32
|
+
const linkSchema = z.looseObject({
|
|
33
|
+
name: z.string(),
|
|
34
|
+
kind: z.string().nullable(),
|
|
35
|
+
target: z.string().nullable(),
|
|
36
|
+
on: z.string(),
|
|
37
|
+
namespace: z.string().optional(),
|
|
38
|
+
});
|
|
39
|
+
const actionSchema = z.looseObject({
|
|
40
|
+
name: z.string(),
|
|
41
|
+
description: z.string().nullable(),
|
|
42
|
+
requires: z.string().nullable(),
|
|
43
|
+
params: z.array(z.looseObject({ name: z.string(), type: z.string(), nullable: z.boolean() })),
|
|
44
|
+
});
|
|
45
|
+
const relationFields = {
|
|
46
|
+
description: z.string().nullable(),
|
|
47
|
+
primary_key: z.array(z.string()),
|
|
48
|
+
columns: z.array(columnSchema),
|
|
49
|
+
links: z.array(linkSchema),
|
|
50
|
+
};
|
|
51
|
+
const tableSchema = z.looseObject({
|
|
52
|
+
table: z.string(),
|
|
53
|
+
...relationFields,
|
|
54
|
+
source: z.string().nullable(),
|
|
55
|
+
actions: z.array(actionSchema),
|
|
56
|
+
internal: z.boolean().optional(),
|
|
57
|
+
});
|
|
58
|
+
const viewSchema = z.looseObject({ view: z.string(), ...relationFields });
|
|
59
|
+
export const schemaViewSchema = z.looseObject({
|
|
60
|
+
namespace: z.string(),
|
|
61
|
+
description: z.string().nullable(),
|
|
62
|
+
version_id: z.string(),
|
|
63
|
+
definition_format: z.number(),
|
|
64
|
+
enums: z.array(z.looseObject({ name: z.string(), values: z.array(z.string()) })),
|
|
65
|
+
tables: z.array(tableSchema),
|
|
66
|
+
views: z.array(viewSchema).default([]),
|
|
67
|
+
});
|
|
68
|
+
const operationSchema = z.looseObject({
|
|
69
|
+
name: z.string(),
|
|
70
|
+
kind: z.string(),
|
|
71
|
+
requires: requiresSchema,
|
|
72
|
+
mutation_roots: z.array(z.looseObject({ table: z.string(), op: z.string() })).default([]),
|
|
73
|
+
});
|
|
74
|
+
export const operationsPageSchema = z.looseObject({
|
|
75
|
+
operations: z.array(operationSchema),
|
|
76
|
+
total: z.number(),
|
|
77
|
+
});
|
|
78
|
+
export function parseResponse({ schema, body, what }) {
|
|
79
|
+
const parsed = schema.safeParse(body);
|
|
80
|
+
if (!parsed.success) {
|
|
81
|
+
throw new Error(`Unexpected ${what} response from Atlas: ${parsed.error.issues[0]?.message ?? 'invalid shape'}.`);
|
|
82
|
+
}
|
|
83
|
+
return parsed.data;
|
|
84
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `seq-studio orm namespaces` / `orm describe` — find the ORM data the caller
|
|
3
|
+
* can read before querying it with `orm read` / `orm sql`.
|
|
4
|
+
*
|
|
5
|
+
* Both are read-only views over Atlas's namespace registry, authorized as the
|
|
6
|
+
* caller: `namespaces` lists only namespaces the caller can read, and
|
|
7
|
+
* `describe` answers 404 for a namespace that is missing or unreadable alike.
|
|
8
|
+
* `describe` joins the active version's compiled schema with its active
|
|
9
|
+
* persisted-operation set.
|
|
10
|
+
*/
|
|
11
|
+
import type { ParsedArgs } from '../process/commands.js';
|
|
12
|
+
export declare function ormNamespacesCommand(args: ParsedArgs): Promise<number>;
|
|
13
|
+
export declare function ormDescribeCommand(args: ParsedArgs): Promise<number>;
|