@solidactions/cli 3.37.0 → 3.39.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 +12 -5
- package/dist/command-manifest.json +16 -4
- package/dist/commands/database-export.js +4 -2
- package/dist/commands/database.js +109 -21
- package/dist/index.js +16 -5
- package/dist/utils/database-kind-refusal.js +27 -0
- package/dist/utils/examples-ref.js +4 -4
- package/dist/utils/functions-sync.js +1 -0
- package/dist/utils/validate-items.js +5 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -100,6 +100,7 @@ active workspace. The complete command surface is:
|
|
|
100
100
|
|
|
101
101
|
```bash
|
|
102
102
|
solidactions database list --json
|
|
103
|
+
solidactions database list --include-deleted --json
|
|
103
104
|
solidactions database create analytics --from backup.sql --json
|
|
104
105
|
solidactions database delete analytics --yes --json
|
|
105
106
|
solidactions database undelete analytics --json
|
|
@@ -136,7 +137,9 @@ solidactions database rollback metrics 2 --yes --json
|
|
|
136
137
|
`dump` overwrites, `pull` overwrites, `drop-table`, and `import` prompt before
|
|
137
138
|
changing data; use `--yes` only when that change is already approved. A
|
|
138
139
|
database `delete` is a soft-delete, and its output shows the purge clock
|
|
139
|
-
during which `undelete` can restore it (either kind).
|
|
140
|
+
during which `undelete` can restore it (either kind). A deleted database
|
|
141
|
+
stays visible to `database list --include-deleted` until it is purged;
|
|
142
|
+
the default `database list` shows live databases only.
|
|
140
143
|
|
|
141
144
|
`create --kind` defaults to the standard (SQLite) kind; pass `--kind duckdb`
|
|
142
145
|
for an analytical database (waits for provisioning unless `--no-wait`).
|
|
@@ -150,7 +153,12 @@ refuse an analytical name with a one-line hint.
|
|
|
150
153
|
|
|
151
154
|
`create --kind duckdb_file` makes a DuckDB database file that your workflows
|
|
152
155
|
open, change and publish as numbered versions; it has no `--from`, `ingest` or
|
|
153
|
-
`exec` (change it from a workflow).
|
|
156
|
+
`exec` (change it from a workflow). Open it from a workflow with `openAnalytics`
|
|
157
|
+
from `@solidactions/sdk` 0.11.0 or newer (add `@duckdb/node-api` as a normal
|
|
158
|
+
dependency). The analytical verbs — `ingest`, `export`, `drop-table`,
|
|
159
|
+
`optimize`, `connect` and `wake` — do not apply to it: they are refused with
|
|
160
|
+
`kind_mismatch`, naming the kind and pointing at `query`, `schema`, `pull`,
|
|
161
|
+
`versions` and `rollback`. `pull <name> [path]` downloads the latest
|
|
154
162
|
published version as a plain DuckDB file (default
|
|
155
163
|
`.solidactions/databases/<name>.duckdb`; `--version <n>` picks an older one;
|
|
156
164
|
needs Node 22.15 or newer), verifies its size and checksum, and refuses a
|
|
@@ -158,8 +166,7 @@ download that does not match. It also refuses to pull over a target that has a
|
|
|
158
166
|
`<path>.wal` write-ahead file beside it, even with `--yes`: close the program
|
|
159
167
|
that has the database open (or remove that file) and pull again. `versions <name>` lists the published versions,
|
|
160
168
|
newest first, and `rollback <name> <version>` makes an earlier one current
|
|
161
|
-
after a `--yes` confirmation. `query` and `schema`
|
|
162
|
-
DuckDB databases arrive with the next release.
|
|
169
|
+
after a `--yes` confirmation. `query` and `schema` read the latest published version (read-only SQL on that version; `--limit` asks for fewer rows, and the server caps the rows it returns, 1000 by default) and answer `no_published_version` until a workflow has published one.
|
|
163
170
|
|
|
164
171
|
`ingest --mode replace` overwrites a table's contents with no `--yes` prompt
|
|
165
172
|
(unlike `drop-table`, which is a separate, rarer, schema-shaped operation) —
|
|
@@ -371,7 +378,7 @@ env:
|
|
|
371
378
|
- A global key, an `oauth:` name, and a `database:` name are **mutually exclusive**: bind each variable to exactly one. The platform enforces that server-side (HTTP 422), but do not rely on seeing that error: through CLI v3.6.0 the YAML parser keeps only the first form it recognizes — `oauth:` beats `database:` — so a declaration carrying both deploys silently as the wrong binding instead of failing.
|
|
372
379
|
- `project deploy` (including `--config-only`) syncs the *complete* `env:` list to the server on every run. Any previously YAML-sourced mapping whose name no longer appears in the list is deleted — removing or emptying `env:` prunes those mappings on the next deploy. Only mappings that were never YAML-declared survive: overriding a YAML-declared variable with `env set`/`env map` doesn't change its provenance, so removing its declaration still deletes the mapping.
|
|
373
380
|
- Create the workspace database first with `solidactions database create <name>` or in the web UI. Workspace-database bindings require `@solidactions/sdk >=0.8.0`.
|
|
374
|
-
- For a
|
|
381
|
+
- For a standard (libSQL) database, the workflow receives a typed `DatabaseVar` at `ctx.vars.<NAME>` at runtime, typically wrapped with the SDK's `createDatabaseClient()`; a `duckdb_file` database instead gets a plain database id string for `openAnalytics` (see the DuckDB database file paragraph above; needs `@solidactions/sdk` 0.11.0 or newer). The private transport payload uses `read_only`; SDK 0.8.0+ normalizes it to the public `DatabaseVar.readOnly` property. Use the typed SDK object rather than parsing the transport payload. See the SDK reference's [Workspace Databases](https://github.com/SolidActions/solidactions-ts-sdk/blob/main/docs/sdk-reference.md#workspace-databases) section for details.
|
|
375
382
|
|
|
376
383
|
## Commands
|
|
377
384
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema_version": 1,
|
|
3
3
|
"cli_name": "solidactions",
|
|
4
|
-
"cli_version": "3.
|
|
4
|
+
"cli_version": "3.39.0",
|
|
5
5
|
"global_options": [
|
|
6
6
|
{
|
|
7
7
|
"flags": "-V, --version",
|
|
@@ -411,6 +411,18 @@
|
|
|
411
411
|
"negated": false,
|
|
412
412
|
"hidden": false
|
|
413
413
|
},
|
|
414
|
+
{
|
|
415
|
+
"flags": "--include-deleted",
|
|
416
|
+
"long": "--include-deleted",
|
|
417
|
+
"short": null,
|
|
418
|
+
"description": "Include deleted databases (they can be restored with database undelete until they are purged)",
|
|
419
|
+
"required": false,
|
|
420
|
+
"value_required": false,
|
|
421
|
+
"value_optional": false,
|
|
422
|
+
"variadic": false,
|
|
423
|
+
"negated": false,
|
|
424
|
+
"hidden": false
|
|
425
|
+
},
|
|
414
426
|
{
|
|
415
427
|
"flags": "--json",
|
|
416
428
|
"long": "--json",
|
|
@@ -570,7 +582,7 @@
|
|
|
570
582
|
],
|
|
571
583
|
"name": "delete",
|
|
572
584
|
"aliases": [],
|
|
573
|
-
"description": "Delete a workspace database",
|
|
585
|
+
"description": "Delete a workspace database (soft-delete: database list --include-deleted still shows it until purged; restore with database undelete)",
|
|
574
586
|
"hidden": false,
|
|
575
587
|
"arguments": [
|
|
576
588
|
{
|
|
@@ -626,7 +638,7 @@
|
|
|
626
638
|
],
|
|
627
639
|
"name": "undelete",
|
|
628
640
|
"aliases": [],
|
|
629
|
-
"description": "Restore a deleted workspace database",
|
|
641
|
+
"description": "Restore a deleted workspace database (find it with database list --include-deleted)",
|
|
630
642
|
"hidden": false,
|
|
631
643
|
"arguments": [
|
|
632
644
|
{
|
|
@@ -735,7 +747,7 @@
|
|
|
735
747
|
"flags": "--limit <n>",
|
|
736
748
|
"long": "--limit",
|
|
737
749
|
"short": null,
|
|
738
|
-
"description": "
|
|
750
|
+
"description": "Maximum rows to return (analytical databases: up to 10000; DuckDB database files: the server caps it, 1000 by default)",
|
|
739
751
|
"required": false,
|
|
740
752
|
"value_required": true,
|
|
741
753
|
"value_optional": false,
|
|
@@ -47,6 +47,7 @@ const promises_1 = require("stream/promises");
|
|
|
47
47
|
const stream_1 = require("stream");
|
|
48
48
|
const api_1 = require("../utils/api");
|
|
49
49
|
const database_data_plane_1 = require("../utils/database-data-plane");
|
|
50
|
+
const database_kind_refusal_1 = require("../utils/database-kind-refusal");
|
|
50
51
|
const database_1 = require("./database");
|
|
51
52
|
function safeDownloadUrl(value) {
|
|
52
53
|
if (typeof value !== 'string')
|
|
@@ -358,8 +359,9 @@ async function databaseExportWithConfig(name, options, config, dependencies = {}
|
|
|
358
359
|
if (options.resume && options.wait === false)
|
|
359
360
|
throw new ExportCommandError('invalid_arguments', '--no-wait cannot be combined with --resume. Resume waits for and downloads the existing export.');
|
|
360
361
|
const database = await (0, database_1.requestDatabaseRecord)(name, config);
|
|
361
|
-
|
|
362
|
-
|
|
362
|
+
const exportRefusal = (0, database_kind_refusal_1.analyticalVerbKindMismatch)(name, database, 'export');
|
|
363
|
+
if (exportRefusal)
|
|
364
|
+
throw new ExportCommandError(exportRefusal.code, exportRefusal.message);
|
|
363
365
|
let metadata;
|
|
364
366
|
if (options.resume) {
|
|
365
367
|
try {
|
|
@@ -86,6 +86,7 @@ const url_1 = require("url");
|
|
|
86
86
|
const api_1 = require("../utils/api");
|
|
87
87
|
const database_data_plane_1 = require("../utils/database-data-plane");
|
|
88
88
|
const database_client_support_1 = require("../utils/database-client-support");
|
|
89
|
+
const database_kind_refusal_1 = require("../utils/database-kind-refusal");
|
|
89
90
|
const database_sql_import_1 = require("../utils/database-sql-import");
|
|
90
91
|
var database_sql_import_2 = require("../utils/database-sql-import");
|
|
91
92
|
Object.defineProperty(exports, "parseDatabaseImportSql", { enumerable: true, get: function () { return database_sql_import_2.parseDatabaseImportSql; } });
|
|
@@ -476,6 +477,43 @@ function renderAnalyticalSchema(schema) {
|
|
|
476
477
|
return `${table.name} — ${table.row_count} rows, last loaded ${table.last_loaded_at ?? 'never'}\n ${columns}`;
|
|
477
478
|
}).join('\n\n');
|
|
478
479
|
}
|
|
480
|
+
function stableDuckdbFileSchemaColumn(column) {
|
|
481
|
+
if (!column || typeof column.name !== 'string' || typeof column.type !== 'string') {
|
|
482
|
+
throw new database_data_plane_1.DatabaseOperationError('upstream_unavailable', 'The database response was invalid.');
|
|
483
|
+
}
|
|
484
|
+
return { name: column.name, type: column.type };
|
|
485
|
+
}
|
|
486
|
+
function stableDuckdbFileSchema(data) {
|
|
487
|
+
if (!data || !Array.isArray(data.tables)) {
|
|
488
|
+
throw new database_data_plane_1.DatabaseOperationError('upstream_unavailable', 'The database response was invalid.');
|
|
489
|
+
}
|
|
490
|
+
const tables = data.tables.map((table) => {
|
|
491
|
+
if (!table || typeof table.name !== 'string' || !Array.isArray(table.columns)) {
|
|
492
|
+
throw new database_data_plane_1.DatabaseOperationError('upstream_unavailable', 'The database response was invalid.');
|
|
493
|
+
}
|
|
494
|
+
return {
|
|
495
|
+
name: table.name,
|
|
496
|
+
columns: table.columns.map(stableDuckdbFileSchemaColumn),
|
|
497
|
+
};
|
|
498
|
+
});
|
|
499
|
+
if (data.note === undefined) {
|
|
500
|
+
return { tables };
|
|
501
|
+
}
|
|
502
|
+
if (typeof data.note !== 'string') {
|
|
503
|
+
throw new database_data_plane_1.DatabaseOperationError('upstream_unavailable', 'The database response was invalid.');
|
|
504
|
+
}
|
|
505
|
+
return { tables, note: data.note };
|
|
506
|
+
}
|
|
507
|
+
function renderDuckdbFileSchema(schema) {
|
|
508
|
+
if (schema.tables.length === 0) {
|
|
509
|
+
return 'No tables.';
|
|
510
|
+
}
|
|
511
|
+
const rendered = schema.tables.map((table) => {
|
|
512
|
+
const columns = table.columns.map((column) => `${column.name} (${column.type})`).join(', ');
|
|
513
|
+
return `${table.name}\n ${columns}`;
|
|
514
|
+
}).join('\n\n');
|
|
515
|
+
return schema.note === undefined ? rendered : `${rendered}\n\n${schema.note}`;
|
|
516
|
+
}
|
|
479
517
|
function databaseRecordSizeBytes(database) {
|
|
480
518
|
return database.kind === 'duckdb_file' ? database.bytes : database.size_bytes;
|
|
481
519
|
}
|
|
@@ -888,17 +926,26 @@ async function databaseListWithConfig(options, config, dependencies = {}) {
|
|
|
888
926
|
throw new database_data_plane_1.DatabaseOperationError('invalid_kind', `--kind must be "libsql", "duckdb" or "duckdb_file" (received "${options.kind}").`);
|
|
889
927
|
}
|
|
890
928
|
const data = stableListResponse(await (0, database_data_plane_1.requestDatabaseOperation)(config, { operation: 'list' }, requestDependencies(io)));
|
|
929
|
+
// The server returns soft-deleted rows (`deleted_at` set) for every kind;
|
|
930
|
+
// the default view hides them in the table and in `--json`, and
|
|
931
|
+
// `--include-deleted` shows them with their DELETED AT and PURGE AT.
|
|
932
|
+
const visible = options.includeDeleted === true
|
|
933
|
+
? data.databases
|
|
934
|
+
: data.databases.filter((database) => database.deleted_at === null);
|
|
891
935
|
const databases = options.kind
|
|
892
|
-
?
|
|
893
|
-
:
|
|
936
|
+
? visible.filter((database) => database.kind === options.kind)
|
|
937
|
+
: visible;
|
|
894
938
|
if (options.json) {
|
|
895
|
-
writeJson(io.stdout,
|
|
939
|
+
writeJson(io.stdout, { ...data, databases });
|
|
896
940
|
return;
|
|
897
941
|
}
|
|
898
942
|
io.stdout(`${renderDatabaseTable(databases)}\n${renderQuota(data.quota)}`);
|
|
899
943
|
}
|
|
900
944
|
const CREATE_POLL_INTERVAL_MS = 2_000;
|
|
901
945
|
const CREATE_POLL_TIMEOUT_MS = 5 * 60_000;
|
|
946
|
+
// Frozen contract 4 (wave cli-duckdb, Task 4): printed after the table,
|
|
947
|
+
// non-JSON only, for `--kind duckdb_file`.
|
|
948
|
+
const DUCKDB_FILE_CREATE_HINT = 'Open it from a workflow with openAnalytics from @solidactions/sdk 0.11.0 or newer; add @duckdb/node-api as a normal dependency (npm install @duckdb/node-api, not --save-dev). Run `solidactions database --help` for the rest.';
|
|
902
949
|
async function databaseCreateWithConfig(name, options, config, dependencies = {}) {
|
|
903
950
|
const io = resolveDependencies(dependencies);
|
|
904
951
|
if (!isKnownKindOption(options.kind)) {
|
|
@@ -977,6 +1024,9 @@ async function databaseCreateWithConfig(name, options, config, dependencies = {}
|
|
|
977
1024
|
return;
|
|
978
1025
|
}
|
|
979
1026
|
io.stdout(renderMutation('create', data.database));
|
|
1027
|
+
if (data.database.kind === 'duckdb_file') {
|
|
1028
|
+
io.stdout(DUCKDB_FILE_CREATE_HINT);
|
|
1029
|
+
}
|
|
980
1030
|
}
|
|
981
1031
|
// The "call show first, branch on `.kind`" helper every later analytical verb
|
|
982
1032
|
// (schema/query/exec/dump/pull/push/import/ingest) reuses to learn a
|
|
@@ -1075,19 +1125,17 @@ async function databaseUndeleteWithConfig(name, options, config, dependencies =
|
|
|
1075
1125
|
}
|
|
1076
1126
|
io.stdout(renderMutation('undelete', data.database));
|
|
1077
1127
|
}
|
|
1078
|
-
// `query` and `schema` on a DuckDB database file are the app's to answer (it
|
|
1079
|
-
// says `not_available` until queries ship). The answer is relayed as the
|
|
1080
|
-
// error; a success body would be a contract the CLI does not know yet, so it
|
|
1081
|
-
// is refused as an invalid response rather than guessed at.
|
|
1082
|
-
async function requestDuckdbFileNotAvailable(config, body, io) {
|
|
1083
|
-
await (0, database_data_plane_1.requestDatabaseOperation)(config, body, requestDependencies(io));
|
|
1084
|
-
throw new database_data_plane_1.DatabaseOperationError('upstream_unavailable', 'The database response was invalid.');
|
|
1085
|
-
}
|
|
1086
1128
|
async function databaseSchemaWithConfig(name, options, config, dependencies = {}) {
|
|
1087
1129
|
const io = resolveDependencies(dependencies);
|
|
1088
1130
|
const row = await requestDatabaseRecord(name, config, dependencies);
|
|
1089
1131
|
if (row.kind === 'duckdb_file') {
|
|
1090
|
-
await
|
|
1132
|
+
const schema = stableDuckdbFileSchema(await (0, database_data_plane_1.requestDatabaseOperation)(config, { operation: 'schema', name }, requestDependencies(io)));
|
|
1133
|
+
if (options.json) {
|
|
1134
|
+
writeJson(io.stdout, schema);
|
|
1135
|
+
return;
|
|
1136
|
+
}
|
|
1137
|
+
io.stdout(renderDuckdbFileSchema(schema));
|
|
1138
|
+
return;
|
|
1091
1139
|
}
|
|
1092
1140
|
if (row.kind === 'duckdb') {
|
|
1093
1141
|
// Read-intent, served from the cached catalog — never wakes a
|
|
@@ -1128,6 +1176,23 @@ function stableAnalyticalQueryResult(data) {
|
|
|
1128
1176
|
elapsed_ms: data.elapsed_ms,
|
|
1129
1177
|
};
|
|
1130
1178
|
}
|
|
1179
|
+
function stableDuckdbFileQueryResult(data) {
|
|
1180
|
+
if (!data
|
|
1181
|
+
|| !Array.isArray(data.columns)
|
|
1182
|
+
|| !data.columns.every((column) => typeof column === 'string')
|
|
1183
|
+
|| !Array.isArray(data.rows)
|
|
1184
|
+
|| !data.rows.every((row) => Array.isArray(row))
|
|
1185
|
+
|| typeof data.row_count !== 'number'
|
|
1186
|
+
|| typeof data.truncated !== 'boolean') {
|
|
1187
|
+
throw new database_data_plane_1.DatabaseOperationError('upstream_unavailable', 'The database response was invalid.');
|
|
1188
|
+
}
|
|
1189
|
+
return {
|
|
1190
|
+
columns: [...data.columns],
|
|
1191
|
+
rows: data.rows.map((row) => [...row]),
|
|
1192
|
+
row_count: data.row_count,
|
|
1193
|
+
truncated: data.truncated,
|
|
1194
|
+
};
|
|
1195
|
+
}
|
|
1131
1196
|
// CLI-surface cap (`services.analytical.query_row_limit_cli` on the server;
|
|
1132
1197
|
// `config/services.php`) — the server clamps to the same value when
|
|
1133
1198
|
// `row_limit` is omitted, so this is both the client-side validation bound
|
|
@@ -1178,7 +1243,27 @@ async function databaseQueryWithConfig(name, sql, options, config, dependencies
|
|
|
1178
1243
|
const io = resolveDependencies(dependencies);
|
|
1179
1244
|
const row = await requestDatabaseRecord(name, config, dependencies);
|
|
1180
1245
|
if (row.kind === 'duckdb_file') {
|
|
1181
|
-
|
|
1246
|
+
// The server clamps the rows it returns (`max(1, min($rowLimit ?? $rowCap, $rowCap))`),
|
|
1247
|
+
// so the CLI validates `>= 1` and integer only — never the 10,000 analytical bound.
|
|
1248
|
+
if (options.limit !== undefined && (Number.isNaN(options.limit) || !Number.isInteger(options.limit) || options.limit < 1)) {
|
|
1249
|
+
throw new database_data_plane_1.DatabaseOperationError('invalid_limit', `--limit must be a whole number of 1 or more (received "${options.limit}").`);
|
|
1250
|
+
}
|
|
1251
|
+
const body = { operation: 'query', name, sql };
|
|
1252
|
+
if (options.limit !== undefined) {
|
|
1253
|
+
body.row_limit = options.limit;
|
|
1254
|
+
}
|
|
1255
|
+
const result = stableDuckdbFileQueryResult(await (0, database_data_plane_1.requestDatabaseOperation)(config, body, requestDependencies(io)));
|
|
1256
|
+
if (options.json) {
|
|
1257
|
+
writeJson(io.stdout, result);
|
|
1258
|
+
return;
|
|
1259
|
+
}
|
|
1260
|
+
io.stdout(result.columns.length > 0
|
|
1261
|
+
? (0, table_1.renderTable)(result.columns, result.rows.map((resultRow) => resultRow.map(formatAnalyticalQueryValue))).join('\n')
|
|
1262
|
+
: 'No rows returned.');
|
|
1263
|
+
if (result.truncated) {
|
|
1264
|
+
io.stdout(`(truncated at ${result.row_count} rows)`);
|
|
1265
|
+
}
|
|
1266
|
+
return;
|
|
1182
1267
|
}
|
|
1183
1268
|
if (row.kind === 'duckdb') {
|
|
1184
1269
|
if (options.limit !== undefined && (Number.isNaN(options.limit) || options.limit < 1 || options.limit > ANALYTICAL_QUERY_ROW_LIMIT_CLI_MAX)) {
|
|
@@ -1999,8 +2084,9 @@ async function databaseIngestWithConfig(name, file, options, config, dependencie
|
|
|
1999
2084
|
}
|
|
2000
2085
|
const format = (0, database_ingest_digest_1.ingestFormatFromExtension)(file);
|
|
2001
2086
|
const row = await requestDatabaseRecord(name, config, dependencies);
|
|
2002
|
-
|
|
2003
|
-
|
|
2087
|
+
const ingestRefusal = (0, database_kind_refusal_1.analyticalVerbKindMismatch)(name, row, 'ingest');
|
|
2088
|
+
if (ingestRefusal) {
|
|
2089
|
+
throw ingestRefusal;
|
|
2004
2090
|
}
|
|
2005
2091
|
if (!row.id) {
|
|
2006
2092
|
throw new database_data_plane_1.DatabaseOperationError('upstream_unavailable', 'The database response was missing its id.');
|
|
@@ -2110,13 +2196,15 @@ async function databaseIngest(name, file, options, dependencies = {}) {
|
|
|
2110
2196
|
}
|
|
2111
2197
|
// Analytical-only guard shared by drop-table/optimize/connect/wake (mirrors
|
|
2112
2198
|
// `databaseIngestWithConfig`'s own check): unlike `refuseIfAnalytical`, which
|
|
2113
|
-
// refuses an analytical name on the SQLite-only verbs, these
|
|
2114
|
-
//
|
|
2115
|
-
//
|
|
2199
|
+
// refuses an analytical name on the SQLite-only verbs, these verbs only ever
|
|
2200
|
+
// operate on the analytical (duckdb) kind, so any other kind is the refusal —
|
|
2201
|
+
// before any operation-specific request goes out. A DuckDB database file gets
|
|
2202
|
+
// the sentence naming the kind (Frozen contract 3).
|
|
2116
2203
|
function refuseUnlessAnalytical(name, row, verb) {
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2204
|
+
const refusal = (0, database_kind_refusal_1.analyticalVerbKindMismatch)(name, row, verb);
|
|
2205
|
+
if (refusal) {
|
|
2206
|
+
throw refusal;
|
|
2207
|
+
}
|
|
2120
2208
|
}
|
|
2121
2209
|
/**
|
|
2122
2210
|
* Shared by `drop-table` and `optimize`: `admit()` on the server — the same
|
package/dist/index.js
CHANGED
|
@@ -287,8 +287,18 @@ list <project>\` shows it), and run locally with:
|
|
|
287
287
|
credentials live from SolidActions — short-lived, held in memory, never written
|
|
288
288
|
to a file — so Drizzle, @libsql/client and drizzle-kit work locally exactly as
|
|
289
289
|
they do in a deployed workflow, which gets the same credentials automatically.
|
|
290
|
-
|
|
291
|
-
straight to createDatabaseClient(), or to @libsql/client /
|
|
290
|
+
For a standard (libSQL) database, the variable arrives as {name, url, token,
|
|
291
|
+
readOnly} — pass it straight to createDatabaseClient(), or to @libsql/client /
|
|
292
|
+
Drizzle.
|
|
293
|
+
|
|
294
|
+
A DuckDB database file (--kind duckdb_file) is a different kind: bind it with
|
|
295
|
+
database: "<database name>" in solidactions.yaml the same way (the run env
|
|
296
|
+
carries its database id string), then open it in a workflow with openAnalytics
|
|
297
|
+
from @solidactions/sdk 0.11.0 or newer (add @duckdb/node-api as a normal
|
|
298
|
+
dependency: npm install @duckdb/node-api, not --save-dev). Read it with
|
|
299
|
+
\`solidactions database query\` and \`solidactions database schema\`, download
|
|
300
|
+
it with \`solidactions database pull\`, and list and restore versions with
|
|
301
|
+
\`solidactions database versions\` and \`solidactions database rollback\`.
|
|
292
302
|
|
|
293
303
|
'database import' is for BULK DATA LOADING only (pushing a .sql file into a
|
|
294
304
|
database). It is not how code reads or writes a database at run time.
|
|
@@ -299,6 +309,7 @@ database
|
|
|
299
309
|
.command('list')
|
|
300
310
|
.description('List workspace databases')
|
|
301
311
|
.option('--kind <kind>', 'Filter by kind: libsql, duckdb or duckdb_file')
|
|
312
|
+
.option('--include-deleted', 'Include deleted databases (they can be restored with database undelete until they are purged)')
|
|
302
313
|
.option('--json', 'Output as JSON')
|
|
303
314
|
.action(async (options) => {
|
|
304
315
|
await (0, database_1.databaseList)(options);
|
|
@@ -324,7 +335,7 @@ database
|
|
|
324
335
|
});
|
|
325
336
|
database
|
|
326
337
|
.command('delete')
|
|
327
|
-
.description('Delete a workspace database')
|
|
338
|
+
.description('Delete a workspace database (soft-delete: database list --include-deleted still shows it until purged; restore with database undelete)')
|
|
328
339
|
.argument('<name>', 'Database name')
|
|
329
340
|
.option('-y, --yes', 'Skip confirmation')
|
|
330
341
|
.option('--json', 'Output as JSON')
|
|
@@ -333,7 +344,7 @@ database
|
|
|
333
344
|
});
|
|
334
345
|
database
|
|
335
346
|
.command('undelete')
|
|
336
|
-
.description('Restore a deleted workspace database')
|
|
347
|
+
.description('Restore a deleted workspace database (find it with database list --include-deleted)')
|
|
337
348
|
.argument('<name>', 'Database name')
|
|
338
349
|
.option('--json', 'Output as JSON')
|
|
339
350
|
.action(async (name, options) => {
|
|
@@ -352,7 +363,7 @@ database
|
|
|
352
363
|
.description('Run a read-only SQL query')
|
|
353
364
|
.argument('<name>', 'Database name')
|
|
354
365
|
.argument('<sql>', 'SQL query')
|
|
355
|
-
.option('--limit <n>', '
|
|
366
|
+
.option('--limit <n>', 'Maximum rows to return (analytical databases: up to 10000; DuckDB database files: the server caps it, 1000 by default)', (value) => parseInt(value, 10))
|
|
356
367
|
.option('--json', 'Output as JSON')
|
|
357
368
|
.action(async (name, sql, options) => {
|
|
358
369
|
await (0, database_1.databaseQuery)(name, sql, options);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.analyticalVerbKindMismatch = analyticalVerbKindMismatch;
|
|
4
|
+
const database_data_plane_1 = require("./database-data-plane");
|
|
5
|
+
/**
|
|
6
|
+
* Frozen contract 3 (wave cli-duckdb, Task 4): the kind-mismatch refusal for
|
|
7
|
+
* the analytical-only verbs (`connect`, `wake`, `optimize`, `drop-table`,
|
|
8
|
+
* `ingest`, `export`) when the named database is not an analytical (duckdb)
|
|
9
|
+
* database.
|
|
10
|
+
*
|
|
11
|
+
* A DuckDB database file gets the sentence naming the kind; a standard
|
|
12
|
+
* (libsql) database keeps the exact sentence each call site threw before
|
|
13
|
+
* (the `ingest` wording for `verb === 'ingest'`, no normalizing). Returns
|
|
14
|
+
* null for an analytical (duckdb) database, which every caller lets through.
|
|
15
|
+
*/
|
|
16
|
+
function analyticalVerbKindMismatch(name, row, verb) {
|
|
17
|
+
if (row.kind === 'duckdb') {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
if (row.kind === 'duckdb_file') {
|
|
21
|
+
return new database_data_plane_1.DatabaseOperationError('kind_mismatch', `"${name}" is a DuckDB database file — \`database ${verb}\` does not apply to it. Read it with \`database query\` and \`database schema\`; download it with \`database pull\`; see its history with \`database versions\` and \`database rollback\`.`);
|
|
22
|
+
}
|
|
23
|
+
if (verb === 'ingest') {
|
|
24
|
+
return new database_data_plane_1.DatabaseOperationError('kind_mismatch', `"${name}" is not an analytical database — \`database ingest\` only loads data into analytical (duckdb) databases.`);
|
|
25
|
+
}
|
|
26
|
+
return new database_data_plane_1.DatabaseOperationError('kind_mismatch', `"${name}" is not an analytical database — \`database ${verb}\` only works on analytical (duckdb) databases.`);
|
|
27
|
+
}
|
|
@@ -28,9 +28,9 @@ exports.EXAMPLES_REF = void 0;
|
|
|
28
28
|
* users. If solidactions-examples ever starts publishing tags in step with the
|
|
29
29
|
* SDK, replace this with a derivation the way sdk-version.ts does.
|
|
30
30
|
*
|
|
31
|
-
* Currently: the merged solidactions-examples mainline
|
|
32
|
-
*
|
|
33
|
-
*
|
|
31
|
+
* Currently: the merged solidactions-examples mainline of wave cli-duckdb
|
|
32
|
+
* (examples PR #38: init template SDK ^0.11.0 and the DuckDB file API in
|
|
33
|
+
* the skills; cli#244, cli#246). It also still
|
|
34
34
|
* includes ex#34 "workspace-database + Drizzle example", which is what makes
|
|
35
35
|
* `ai examples` able to install workspace-database-drizzle (the runnable
|
|
36
36
|
* connect + drizzle-kit-migration example #140 exists to point people at).
|
|
@@ -38,4 +38,4 @@ exports.EXAMPLES_REF = void 0;
|
|
|
38
38
|
* repin EXAMPLES_REF to the examples repo's merged mainline SHA and verify the
|
|
39
39
|
* exact ref during the release ritual.
|
|
40
40
|
*/
|
|
41
|
-
exports.EXAMPLES_REF = '
|
|
41
|
+
exports.EXAMPLES_REF = '82719cfc1ba8a147900d808a106537787fe1bb06';
|
|
@@ -30,6 +30,7 @@ function listCodeFunctions(config) {
|
|
|
30
30
|
...(fn.mcp_tool_name === undefined ? {} : { mcp_tool_name: fn.mcp_tool_name }),
|
|
31
31
|
...(fn.timeout === undefined ? {} : { timeout: fn.timeout }),
|
|
32
32
|
...(fn.confirm === undefined ? {} : { confirm: fn.confirm }),
|
|
33
|
+
...(fn.confirm_text === undefined ? {} : { confirm_text: fn.confirm_text }),
|
|
33
34
|
...(fn.input_schema === undefined ? {} : { input_schema: fn.input_schema }),
|
|
34
35
|
};
|
|
35
36
|
});
|
|
@@ -159,6 +159,11 @@ function validateItems(config, sourceDir) {
|
|
|
159
159
|
if (webhookAuth !== undefined && (typeof webhookAuth !== 'string' || !WEBHOOK_AUTHS.includes(webhookAuth))) {
|
|
160
160
|
errors.push({ entry: entryLabel, field: 'webhook_auth', message: `${entryLabel}.webhook_auth: webhook_auth must be one of hmac, basic, header, none (got ${JSON.stringify(webhookAuth)}).` });
|
|
161
161
|
}
|
|
162
|
+
const confirmText = entry.confirm_text;
|
|
163
|
+
if (confirmText !== undefined && (typeof confirmText !== 'string' || [...confirmText].length > 255)) {
|
|
164
|
+
const got = typeof confirmText === 'string' ? `${[...confirmText].length} characters` : JSON.stringify(confirmText);
|
|
165
|
+
errors.push({ entry: entryLabel, field: 'confirm_text', message: `${entryLabel}.confirm_text: confirm_text must be a string of at most 255 characters (got ${got}).` });
|
|
166
|
+
}
|
|
162
167
|
});
|
|
163
168
|
return errors;
|
|
164
169
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solidactions/cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.39.0",
|
|
4
4
|
"description": "SolidActions CLI - Deploy and manage workflow automation",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"tar": "^7.5.22"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@solidactions/sdk": "^0.
|
|
58
|
+
"@solidactions/sdk": "^0.11.1",
|
|
59
59
|
"@types/archiver": "^8.0.0",
|
|
60
60
|
"@types/fs-extra": "^11.0.0",
|
|
61
61
|
"@types/js-yaml": "^4.0.9",
|