@solidactions/cli 3.16.0 → 3.18.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 +29 -4
- package/dist/command-manifest.json +388 -1
- package/dist/commands/database-push.js +6 -0
- package/dist/commands/database.js +753 -12
- package/dist/index.js +59 -0
- package/dist/utils/database-data-plane.js +13 -2
- package/dist/utils/database-ingest-digest.js +56 -0
- package/dist/utils/mutating-commands.js +16 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -111,13 +111,38 @@ solidactions database pull analytics --writable
|
|
|
111
111
|
solidactions database import analytics backup.sql --yes
|
|
112
112
|
solidactions database import analytics backup.sql --resume <checkpoint> --yes
|
|
113
113
|
solidactions database push analytics complete.db --yes
|
|
114
|
+
solidactions database create analytics --kind duckdb --json
|
|
115
|
+
solidactions database list --kind duckdb --json
|
|
116
|
+
solidactions database show analytics --json
|
|
117
|
+
solidactions database ingest analytics data.parquet --table events --json
|
|
118
|
+
solidactions database ingest analytics data.csv --table events --mode replace --json
|
|
119
|
+
solidactions database drop-table analytics events --yes --json
|
|
120
|
+
solidactions database optimize analytics --wait --json
|
|
121
|
+
solidactions database connect analytics --json
|
|
122
|
+
solidactions database wake analytics --json
|
|
123
|
+
solidactions database query analytics "select category, sum(amount) from events group by 1" --limit 1000 --json
|
|
114
124
|
```
|
|
115
125
|
|
|
116
126
|
`--json` produces machine-readable output where supported. `delete`, `exec`,
|
|
117
|
-
`dump` overwrites, `pull` overwrites, and `import` prompt before
|
|
118
|
-
use `--yes` only when that change is already approved. A
|
|
119
|
-
soft-delete, and its output shows the purge clock
|
|
120
|
-
restore it.
|
|
127
|
+
`dump` overwrites, `pull` overwrites, `drop-table`, and `import` prompt before
|
|
128
|
+
changing data; use `--yes` only when that change is already approved. A
|
|
129
|
+
database `delete` is a soft-delete, and its output shows the purge clock
|
|
130
|
+
during which `undelete` can restore it (either kind).
|
|
131
|
+
|
|
132
|
+
`create --kind` defaults to the standard (SQLite) kind; pass `--kind duckdb`
|
|
133
|
+
for an analytical database (waits for provisioning unless `--no-wait`).
|
|
134
|
+
`--from` only applies to the standard kind — `create --kind duckdb --from
|
|
135
|
+
<file>` is rejected up front, before the database is created, since SQL
|
|
136
|
+
import is meaningless for an analytical database; load one with `ingest`
|
|
137
|
+
after creation. Analytical verbs — `ingest`, `drop-table`, `optimize`,
|
|
138
|
+
`connect`, `wake` — only work against a `duckdb` database. `dump`, `pull`,
|
|
139
|
+
`push`, `import`, and `exec` are for the standard (SQLite) kind only and
|
|
140
|
+
refuse an analytical name with a one-line hint.
|
|
141
|
+
|
|
142
|
+
`ingest --mode replace` overwrites a table's contents with no `--yes` prompt
|
|
143
|
+
(unlike `drop-table`, which is a separate, rarer, schema-shaped operation) —
|
|
144
|
+
this is the normal, expected way to refresh an analytical table from an
|
|
145
|
+
unattended pipeline, so it is not gated behind confirmation.
|
|
121
146
|
|
|
122
147
|
`query` is read-only SQL; use `exec` for writes. `schema`, `query`, `exec`,
|
|
123
148
|
`pull --writable`, and imports use ephemeral scoped access held only in memory.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema_version": 1,
|
|
3
3
|
"cli_name": "solidactions",
|
|
4
|
-
"cli_version": "3.
|
|
4
|
+
"cli_version": "3.18.0",
|
|
5
5
|
"global_options": [
|
|
6
6
|
{
|
|
7
7
|
"flags": "-V, --version",
|
|
@@ -399,6 +399,18 @@
|
|
|
399
399
|
"hidden": false,
|
|
400
400
|
"arguments": [],
|
|
401
401
|
"options": [
|
|
402
|
+
{
|
|
403
|
+
"flags": "--kind <kind>",
|
|
404
|
+
"long": "--kind",
|
|
405
|
+
"short": null,
|
|
406
|
+
"description": "Filter by kind: libsql or duckdb",
|
|
407
|
+
"required": false,
|
|
408
|
+
"value_required": true,
|
|
409
|
+
"value_optional": false,
|
|
410
|
+
"variadic": false,
|
|
411
|
+
"negated": false,
|
|
412
|
+
"hidden": false
|
|
413
|
+
},
|
|
402
414
|
{
|
|
403
415
|
"flags": "--json",
|
|
404
416
|
"long": "--json",
|
|
@@ -443,6 +455,19 @@
|
|
|
443
455
|
}
|
|
444
456
|
],
|
|
445
457
|
"options": [
|
|
458
|
+
{
|
|
459
|
+
"flags": "--kind <kind>",
|
|
460
|
+
"long": "--kind",
|
|
461
|
+
"short": null,
|
|
462
|
+
"description": "Database kind: libsql (default) or duckdb",
|
|
463
|
+
"required": false,
|
|
464
|
+
"value_required": true,
|
|
465
|
+
"value_optional": false,
|
|
466
|
+
"variadic": false,
|
|
467
|
+
"negated": false,
|
|
468
|
+
"hidden": false,
|
|
469
|
+
"default": "libsql"
|
|
470
|
+
},
|
|
446
471
|
{
|
|
447
472
|
"flags": "--from <file.sql>",
|
|
448
473
|
"long": "--from",
|
|
@@ -455,6 +480,63 @@
|
|
|
455
480
|
"negated": false,
|
|
456
481
|
"hidden": false
|
|
457
482
|
},
|
|
483
|
+
{
|
|
484
|
+
"flags": "--no-wait",
|
|
485
|
+
"long": "--no-wait",
|
|
486
|
+
"short": null,
|
|
487
|
+
"description": "Do not wait for analytical (duckdb) provisioning to finish",
|
|
488
|
+
"required": false,
|
|
489
|
+
"value_required": false,
|
|
490
|
+
"value_optional": false,
|
|
491
|
+
"variadic": false,
|
|
492
|
+
"negated": true,
|
|
493
|
+
"hidden": false,
|
|
494
|
+
"default": true
|
|
495
|
+
},
|
|
496
|
+
{
|
|
497
|
+
"flags": "--json",
|
|
498
|
+
"long": "--json",
|
|
499
|
+
"short": null,
|
|
500
|
+
"description": "Output as JSON",
|
|
501
|
+
"required": false,
|
|
502
|
+
"value_required": false,
|
|
503
|
+
"value_optional": false,
|
|
504
|
+
"variadic": false,
|
|
505
|
+
"negated": false,
|
|
506
|
+
"hidden": false
|
|
507
|
+
},
|
|
508
|
+
{
|
|
509
|
+
"flags": "-h, --help",
|
|
510
|
+
"long": "--help",
|
|
511
|
+
"short": "-h",
|
|
512
|
+
"description": "display help for command",
|
|
513
|
+
"required": false,
|
|
514
|
+
"value_required": false,
|
|
515
|
+
"value_optional": false,
|
|
516
|
+
"variadic": false,
|
|
517
|
+
"negated": false,
|
|
518
|
+
"hidden": false
|
|
519
|
+
}
|
|
520
|
+
]
|
|
521
|
+
},
|
|
522
|
+
{
|
|
523
|
+
"path": [
|
|
524
|
+
"database",
|
|
525
|
+
"show"
|
|
526
|
+
],
|
|
527
|
+
"name": "show",
|
|
528
|
+
"aliases": [],
|
|
529
|
+
"description": "Show database details",
|
|
530
|
+
"hidden": false,
|
|
531
|
+
"arguments": [
|
|
532
|
+
{
|
|
533
|
+
"name": "name",
|
|
534
|
+
"required": true,
|
|
535
|
+
"variadic": false,
|
|
536
|
+
"description": "Database name"
|
|
537
|
+
}
|
|
538
|
+
],
|
|
539
|
+
"options": [
|
|
458
540
|
{
|
|
459
541
|
"flags": "--json",
|
|
460
542
|
"long": "--json",
|
|
@@ -649,6 +731,18 @@
|
|
|
649
731
|
}
|
|
650
732
|
],
|
|
651
733
|
"options": [
|
|
734
|
+
{
|
|
735
|
+
"flags": "--limit <n>",
|
|
736
|
+
"long": "--limit",
|
|
737
|
+
"short": null,
|
|
738
|
+
"description": "Row cap for analytical queries (max 10000)",
|
|
739
|
+
"required": false,
|
|
740
|
+
"value_required": true,
|
|
741
|
+
"value_optional": false,
|
|
742
|
+
"variadic": false,
|
|
743
|
+
"negated": false,
|
|
744
|
+
"hidden": false
|
|
745
|
+
},
|
|
652
746
|
{
|
|
653
747
|
"flags": "--json",
|
|
654
748
|
"long": "--json",
|
|
@@ -985,6 +1079,299 @@
|
|
|
985
1079
|
}
|
|
986
1080
|
]
|
|
987
1081
|
},
|
|
1082
|
+
{
|
|
1083
|
+
"path": [
|
|
1084
|
+
"database",
|
|
1085
|
+
"ingest"
|
|
1086
|
+
],
|
|
1087
|
+
"name": "ingest",
|
|
1088
|
+
"aliases": [],
|
|
1089
|
+
"description": "Load a batch of rows into an analytical database",
|
|
1090
|
+
"hidden": false,
|
|
1091
|
+
"arguments": [
|
|
1092
|
+
{
|
|
1093
|
+
"name": "name",
|
|
1094
|
+
"required": true,
|
|
1095
|
+
"variadic": false,
|
|
1096
|
+
"description": "Database name"
|
|
1097
|
+
},
|
|
1098
|
+
{
|
|
1099
|
+
"name": "file",
|
|
1100
|
+
"required": true,
|
|
1101
|
+
"variadic": false,
|
|
1102
|
+
"description": "Parquet, CSV, or JSONL file to load"
|
|
1103
|
+
}
|
|
1104
|
+
],
|
|
1105
|
+
"options": [
|
|
1106
|
+
{
|
|
1107
|
+
"flags": "--table <table>",
|
|
1108
|
+
"long": "--table",
|
|
1109
|
+
"short": null,
|
|
1110
|
+
"description": "Target table name",
|
|
1111
|
+
"required": true,
|
|
1112
|
+
"value_required": true,
|
|
1113
|
+
"value_optional": false,
|
|
1114
|
+
"variadic": false,
|
|
1115
|
+
"negated": false,
|
|
1116
|
+
"hidden": false
|
|
1117
|
+
},
|
|
1118
|
+
{
|
|
1119
|
+
"flags": "--mode <mode>",
|
|
1120
|
+
"long": "--mode",
|
|
1121
|
+
"short": null,
|
|
1122
|
+
"description": "append (default) or replace",
|
|
1123
|
+
"required": false,
|
|
1124
|
+
"value_required": true,
|
|
1125
|
+
"value_optional": false,
|
|
1126
|
+
"variadic": false,
|
|
1127
|
+
"negated": false,
|
|
1128
|
+
"hidden": false,
|
|
1129
|
+
"default": "append"
|
|
1130
|
+
},
|
|
1131
|
+
{
|
|
1132
|
+
"flags": "--batch-id <id>",
|
|
1133
|
+
"long": "--batch-id",
|
|
1134
|
+
"short": null,
|
|
1135
|
+
"description": "Idempotency key (default: derived from the file, table, and mode)",
|
|
1136
|
+
"required": false,
|
|
1137
|
+
"value_required": true,
|
|
1138
|
+
"value_optional": false,
|
|
1139
|
+
"variadic": false,
|
|
1140
|
+
"negated": false,
|
|
1141
|
+
"hidden": false
|
|
1142
|
+
},
|
|
1143
|
+
{
|
|
1144
|
+
"flags": "--json",
|
|
1145
|
+
"long": "--json",
|
|
1146
|
+
"short": null,
|
|
1147
|
+
"description": "Output as JSON",
|
|
1148
|
+
"required": false,
|
|
1149
|
+
"value_required": false,
|
|
1150
|
+
"value_optional": false,
|
|
1151
|
+
"variadic": false,
|
|
1152
|
+
"negated": false,
|
|
1153
|
+
"hidden": false
|
|
1154
|
+
},
|
|
1155
|
+
{
|
|
1156
|
+
"flags": "-h, --help",
|
|
1157
|
+
"long": "--help",
|
|
1158
|
+
"short": "-h",
|
|
1159
|
+
"description": "display help for command",
|
|
1160
|
+
"required": false,
|
|
1161
|
+
"value_required": false,
|
|
1162
|
+
"value_optional": false,
|
|
1163
|
+
"variadic": false,
|
|
1164
|
+
"negated": false,
|
|
1165
|
+
"hidden": false
|
|
1166
|
+
}
|
|
1167
|
+
]
|
|
1168
|
+
},
|
|
1169
|
+
{
|
|
1170
|
+
"path": [
|
|
1171
|
+
"database",
|
|
1172
|
+
"drop-table"
|
|
1173
|
+
],
|
|
1174
|
+
"name": "drop-table",
|
|
1175
|
+
"aliases": [],
|
|
1176
|
+
"description": "Delete one table from an analytical database and free its space",
|
|
1177
|
+
"hidden": false,
|
|
1178
|
+
"arguments": [
|
|
1179
|
+
{
|
|
1180
|
+
"name": "name",
|
|
1181
|
+
"required": true,
|
|
1182
|
+
"variadic": false,
|
|
1183
|
+
"description": "Database name"
|
|
1184
|
+
},
|
|
1185
|
+
{
|
|
1186
|
+
"name": "table",
|
|
1187
|
+
"required": true,
|
|
1188
|
+
"variadic": false,
|
|
1189
|
+
"description": "Table name"
|
|
1190
|
+
}
|
|
1191
|
+
],
|
|
1192
|
+
"options": [
|
|
1193
|
+
{
|
|
1194
|
+
"flags": "-y, --yes",
|
|
1195
|
+
"long": "--yes",
|
|
1196
|
+
"short": "-y",
|
|
1197
|
+
"description": "Skip confirmation",
|
|
1198
|
+
"required": false,
|
|
1199
|
+
"value_required": false,
|
|
1200
|
+
"value_optional": false,
|
|
1201
|
+
"variadic": false,
|
|
1202
|
+
"negated": false,
|
|
1203
|
+
"hidden": false
|
|
1204
|
+
},
|
|
1205
|
+
{
|
|
1206
|
+
"flags": "--json",
|
|
1207
|
+
"long": "--json",
|
|
1208
|
+
"short": null,
|
|
1209
|
+
"description": "Output as JSON",
|
|
1210
|
+
"required": false,
|
|
1211
|
+
"value_required": false,
|
|
1212
|
+
"value_optional": false,
|
|
1213
|
+
"variadic": false,
|
|
1214
|
+
"negated": false,
|
|
1215
|
+
"hidden": false
|
|
1216
|
+
},
|
|
1217
|
+
{
|
|
1218
|
+
"flags": "-h, --help",
|
|
1219
|
+
"long": "--help",
|
|
1220
|
+
"short": "-h",
|
|
1221
|
+
"description": "display help for command",
|
|
1222
|
+
"required": false,
|
|
1223
|
+
"value_required": false,
|
|
1224
|
+
"value_optional": false,
|
|
1225
|
+
"variadic": false,
|
|
1226
|
+
"negated": false,
|
|
1227
|
+
"hidden": false
|
|
1228
|
+
}
|
|
1229
|
+
]
|
|
1230
|
+
},
|
|
1231
|
+
{
|
|
1232
|
+
"path": [
|
|
1233
|
+
"database",
|
|
1234
|
+
"optimize"
|
|
1235
|
+
],
|
|
1236
|
+
"name": "optimize",
|
|
1237
|
+
"aliases": [],
|
|
1238
|
+
"description": "Consolidate an analytical database's stored files now",
|
|
1239
|
+
"hidden": false,
|
|
1240
|
+
"arguments": [
|
|
1241
|
+
{
|
|
1242
|
+
"name": "name",
|
|
1243
|
+
"required": true,
|
|
1244
|
+
"variadic": false,
|
|
1245
|
+
"description": "Database name"
|
|
1246
|
+
}
|
|
1247
|
+
],
|
|
1248
|
+
"options": [
|
|
1249
|
+
{
|
|
1250
|
+
"flags": "--wait",
|
|
1251
|
+
"long": "--wait",
|
|
1252
|
+
"short": null,
|
|
1253
|
+
"description": "Wait for optimize to finish and print files before/after",
|
|
1254
|
+
"required": false,
|
|
1255
|
+
"value_required": false,
|
|
1256
|
+
"value_optional": false,
|
|
1257
|
+
"variadic": false,
|
|
1258
|
+
"negated": false,
|
|
1259
|
+
"hidden": false
|
|
1260
|
+
},
|
|
1261
|
+
{
|
|
1262
|
+
"flags": "--json",
|
|
1263
|
+
"long": "--json",
|
|
1264
|
+
"short": null,
|
|
1265
|
+
"description": "Output as JSON",
|
|
1266
|
+
"required": false,
|
|
1267
|
+
"value_required": false,
|
|
1268
|
+
"value_optional": false,
|
|
1269
|
+
"variadic": false,
|
|
1270
|
+
"negated": false,
|
|
1271
|
+
"hidden": false
|
|
1272
|
+
},
|
|
1273
|
+
{
|
|
1274
|
+
"flags": "-h, --help",
|
|
1275
|
+
"long": "--help",
|
|
1276
|
+
"short": "-h",
|
|
1277
|
+
"description": "display help for command",
|
|
1278
|
+
"required": false,
|
|
1279
|
+
"value_required": false,
|
|
1280
|
+
"value_optional": false,
|
|
1281
|
+
"variadic": false,
|
|
1282
|
+
"negated": false,
|
|
1283
|
+
"hidden": false
|
|
1284
|
+
}
|
|
1285
|
+
]
|
|
1286
|
+
},
|
|
1287
|
+
{
|
|
1288
|
+
"path": [
|
|
1289
|
+
"database",
|
|
1290
|
+
"connect"
|
|
1291
|
+
],
|
|
1292
|
+
"name": "connect",
|
|
1293
|
+
"aliases": [],
|
|
1294
|
+
"description": "Show how to connect to an analytical database",
|
|
1295
|
+
"hidden": false,
|
|
1296
|
+
"arguments": [
|
|
1297
|
+
{
|
|
1298
|
+
"name": "name",
|
|
1299
|
+
"required": true,
|
|
1300
|
+
"variadic": false,
|
|
1301
|
+
"description": "Database name"
|
|
1302
|
+
}
|
|
1303
|
+
],
|
|
1304
|
+
"options": [
|
|
1305
|
+
{
|
|
1306
|
+
"flags": "--json",
|
|
1307
|
+
"long": "--json",
|
|
1308
|
+
"short": null,
|
|
1309
|
+
"description": "Output as JSON",
|
|
1310
|
+
"required": false,
|
|
1311
|
+
"value_required": false,
|
|
1312
|
+
"value_optional": false,
|
|
1313
|
+
"variadic": false,
|
|
1314
|
+
"negated": false,
|
|
1315
|
+
"hidden": false
|
|
1316
|
+
},
|
|
1317
|
+
{
|
|
1318
|
+
"flags": "-h, --help",
|
|
1319
|
+
"long": "--help",
|
|
1320
|
+
"short": "-h",
|
|
1321
|
+
"description": "display help for command",
|
|
1322
|
+
"required": false,
|
|
1323
|
+
"value_required": false,
|
|
1324
|
+
"value_optional": false,
|
|
1325
|
+
"variadic": false,
|
|
1326
|
+
"negated": false,
|
|
1327
|
+
"hidden": false
|
|
1328
|
+
}
|
|
1329
|
+
]
|
|
1330
|
+
},
|
|
1331
|
+
{
|
|
1332
|
+
"path": [
|
|
1333
|
+
"database",
|
|
1334
|
+
"wake"
|
|
1335
|
+
],
|
|
1336
|
+
"name": "wake",
|
|
1337
|
+
"aliases": [],
|
|
1338
|
+
"description": "Wake an idle analytical database and wait for it to become active",
|
|
1339
|
+
"hidden": false,
|
|
1340
|
+
"arguments": [
|
|
1341
|
+
{
|
|
1342
|
+
"name": "name",
|
|
1343
|
+
"required": true,
|
|
1344
|
+
"variadic": false,
|
|
1345
|
+
"description": "Database name"
|
|
1346
|
+
}
|
|
1347
|
+
],
|
|
1348
|
+
"options": [
|
|
1349
|
+
{
|
|
1350
|
+
"flags": "--json",
|
|
1351
|
+
"long": "--json",
|
|
1352
|
+
"short": null,
|
|
1353
|
+
"description": "Output as JSON",
|
|
1354
|
+
"required": false,
|
|
1355
|
+
"value_required": false,
|
|
1356
|
+
"value_optional": false,
|
|
1357
|
+
"variadic": false,
|
|
1358
|
+
"negated": false,
|
|
1359
|
+
"hidden": false
|
|
1360
|
+
},
|
|
1361
|
+
{
|
|
1362
|
+
"flags": "-h, --help",
|
|
1363
|
+
"long": "--help",
|
|
1364
|
+
"short": "-h",
|
|
1365
|
+
"description": "display help for command",
|
|
1366
|
+
"required": false,
|
|
1367
|
+
"value_required": false,
|
|
1368
|
+
"value_optional": false,
|
|
1369
|
+
"variadic": false,
|
|
1370
|
+
"negated": false,
|
|
1371
|
+
"hidden": false
|
|
1372
|
+
}
|
|
1373
|
+
]
|
|
1374
|
+
},
|
|
988
1375
|
{
|
|
989
1376
|
"path": [
|
|
990
1377
|
"database",
|
|
@@ -48,6 +48,7 @@ const path_1 = __importDefault(require("path"));
|
|
|
48
48
|
const url_1 = require("url");
|
|
49
49
|
const client_1 = require("@libsql/client");
|
|
50
50
|
const database_data_plane_1 = require("../utils/database-data-plane");
|
|
51
|
+
const database_1 = require("./database");
|
|
51
52
|
const MAX_BYTES = 20_000_000_000;
|
|
52
53
|
const PAGE_SIZE = 4096;
|
|
53
54
|
const POLL_MS = 2_000;
|
|
@@ -251,6 +252,11 @@ function stableOperation(data) {
|
|
|
251
252
|
return operation;
|
|
252
253
|
}
|
|
253
254
|
async function databasePushWithConfig(name, file, options, config, dependencies = {}) {
|
|
255
|
+
// Kind refusal fires first (matches `import`'s ordering): pushing an
|
|
256
|
+
// analytical name without --yes previously reported "confirmation_required"
|
|
257
|
+
// first, a less useful first error since adding --yes would only surface
|
|
258
|
+
// kind_mismatch on the next run anyway.
|
|
259
|
+
await (0, database_1.refuseIfAnalytical)(config, name, 'sqlite-only', { post: dependencies.post });
|
|
254
260
|
if (!options.yes)
|
|
255
261
|
throw new database_data_plane_1.DatabaseOperationError('confirmation_required', 'Database push is destructive and requires --yes.');
|
|
256
262
|
const key = options.idempotencyKey ?? (0, crypto_1.randomUUID)();
|