@somewhere-cloud/cli 0.38.166 → 0.38.168
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/CHANGELOG.md +8 -0
- package/dist/lib/bundle.js +44 -0
- package/dist/lib/bundle.js.map +3 -3
- package/npm-shrinkwrap.json +2 -2
- package/package.json +2 -2
- package/runtime/DECLARED-DATA-VENDOR.json +4 -4
- package/runtime/PLATFORM-SOURCE.json +1 -1
- package/runtime/SOURCE-LINT-VENDOR.json +2 -2
- package/runtime/declared-data.cjs +12 -2
- package/runtime/source-lint.cjs +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.38.168
|
|
4
|
+
|
|
5
|
+
- Use `somewhere db import --source supabase` to plan a copy, import rows into declared tables, and read the job receipt.
|
|
6
|
+
|
|
7
|
+
## 0.38.167
|
|
8
|
+
|
|
9
|
+
- Updates local checks for public settings to match the platform.
|
|
10
|
+
|
|
3
11
|
## 0.38.166
|
|
4
12
|
|
|
5
13
|
- New projects include a signed-in check list. Run it with `somewhere test --only checks/signed-in.json`.
|
package/dist/lib/bundle.js
CHANGED
|
@@ -86845,6 +86845,48 @@ var init_restore = __esm({
|
|
|
86845
86845
|
}
|
|
86846
86846
|
});
|
|
86847
86847
|
|
|
86848
|
+
// dist/commands/db-import.js
|
|
86849
|
+
function registerDbImport(db) {
|
|
86850
|
+
db.command("import [tables...]").description("Generate a table declaration or plan and copy rows from Supabase").option("--source <source>", "Set to supabase to import from the app\u2019s Supabase Data API").option("--project <id>", "Project ID (defaults to the linked project)").option("--all", "Copy all exposed Supabase tables").option("--order-by <column>", "Stable unique column for a table without a single supported primary key").option("--resume", "Skip existing destination primary keys").option("--job <id>", "Read the progress and receipt of a Supabase import job").action(async (tables, options2) => {
|
|
86851
|
+
if (options2.source !== void 0 && options2.source !== "supabase") {
|
|
86852
|
+
error("--source must be supabase when provided.");
|
|
86853
|
+
process.exitCode = 1;
|
|
86854
|
+
return;
|
|
86855
|
+
}
|
|
86856
|
+
const supabase = options2.source === "supabase";
|
|
86857
|
+
if (!supabase && (tables.length !== 1 || options2.all || options2.orderBy || options2.resume || options2.job)) {
|
|
86858
|
+
error("Name one table to generate its declaration, or use --source supabase.");
|
|
86859
|
+
process.exitCode = 1;
|
|
86860
|
+
return;
|
|
86861
|
+
}
|
|
86862
|
+
if (options2.all && tables.length || options2.job && (options2.all || tables.length || options2.orderBy || options2.resume)) {
|
|
86863
|
+
error("Choose one import operation: name tables, use --all, or read --job.");
|
|
86864
|
+
process.exitCode = 1;
|
|
86865
|
+
return;
|
|
86866
|
+
}
|
|
86867
|
+
const project = resolveProjectRef(options2.project);
|
|
86868
|
+
const body = supabase ? {
|
|
86869
|
+
source: "supabase",
|
|
86870
|
+
tables: options2.all ? "all" : tables.length ? tables : void 0,
|
|
86871
|
+
order_by: options2.orderBy,
|
|
86872
|
+
resume: options2.resume,
|
|
86873
|
+
job_id: options2.job
|
|
86874
|
+
} : { table: tables[0] };
|
|
86875
|
+
const client = new ApiClient(getToken());
|
|
86876
|
+
printJson(await client.call("POST", "/v1/db/import", { project_id: project, ...body }, void 0, { timeoutMs: 9e4 }));
|
|
86877
|
+
});
|
|
86878
|
+
}
|
|
86879
|
+
var init_db_import = __esm({
|
|
86880
|
+
"dist/commands/db-import.js"() {
|
|
86881
|
+
"use strict";
|
|
86882
|
+
init_client();
|
|
86883
|
+
init_config();
|
|
86884
|
+
init_output();
|
|
86885
|
+
init_platform_command();
|
|
86886
|
+
__name(registerDbImport, "registerDbImport");
|
|
86887
|
+
}
|
|
86888
|
+
});
|
|
86889
|
+
|
|
86848
86890
|
// dist/commands/db-rows.js
|
|
86849
86891
|
function registerDbRows(db) {
|
|
86850
86892
|
db.command("rows <table>").description("Read declared managed rows from production data (read-only; developer access required)").option("--project <id>", "Project ID (defaults to the linked project)").option("--where <column=value>", "Equality filter; value is text unless a JSON number or null; repeat for AND", (value, previous) => [...previous, value], []).option("--limit <number>", "Maximum rows, 1\u2013500", "50").option("--offset <number>", "Rows to skip", "0").option("--json", "Print the complete managed inspection response as JSON").action(async (tableName, opts) => {
|
|
@@ -86974,6 +87016,7 @@ async function backgroundExport(client, projectId, plane, output, json, spinner)
|
|
|
86974
87016
|
function registerDb(program2) {
|
|
86975
87017
|
const db = program2.command("db").description("Inspect managed production rows or run SQL against your raw database");
|
|
86976
87018
|
registerDbRows(db);
|
|
87019
|
+
registerDbImport(db);
|
|
86977
87020
|
db.command("query <sql>").description("Run a SQL query against the project database").option("--project <id>", "Project ID (defaults to .somewhere.json)").option("--json", "Print raw JSON instead of a table").action(async (sql, opts) => {
|
|
86978
87021
|
const client = new ApiClient(getToken());
|
|
86979
87022
|
let projectId = opts.project;
|
|
@@ -87249,6 +87292,7 @@ var init_db = __esm({
|
|
|
87249
87292
|
"dist/commands/db.js"() {
|
|
87250
87293
|
"use strict";
|
|
87251
87294
|
init_cli_invocation();
|
|
87295
|
+
init_db_import();
|
|
87252
87296
|
init_db_rows();
|
|
87253
87297
|
init_spinner();
|
|
87254
87298
|
init_client();
|