@rebasepro/cli 0.29.0 → 0.29.2
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/dist/{apps-Dg0NnmmJ.js → apps-MKQbgDtN.js} +3 -3
- package/dist/{apps-Dg0NnmmJ.js.map → apps-MKQbgDtN.js.map} +1 -1
- package/dist/{auth-DifFaOyq.js → auth-Bv0rTbQX.js} +3 -3
- package/dist/{auth-DifFaOyq.js.map → auth-Bv0rTbQX.js.map} +1 -1
- package/dist/{build-1Zo35L6a.js → build-BuKTnec8.js} +3 -3
- package/dist/{build-1Zo35L6a.js.map → build-BuKTnec8.js.map} +1 -1
- package/dist/{bundle-CTkzO2WG.js → bundle-BAH4FCju.js} +2 -2
- package/dist/{bundle-CTkzO2WG.js.map → bundle-BAH4FCju.js.map} +1 -1
- package/dist/{cloud-CFotGK2-.js → cloud-DWL-lxU_.js} +6 -6
- package/dist/cloud-DWL-lxU_.js.map +1 -0
- package/dist/commands/cloud/context.d.ts +1 -1
- package/dist/commands/doctor.d.ts +1 -0
- package/dist/{console-BXB6-8GT.js → console-CdwIYOMV.js} +2 -2
- package/dist/{console-BXB6-8GT.js.map → console-CdwIYOMV.js.map} +1 -1
- package/dist/{context-DN1b9pCR.js → context-AXdAh-q8.js} +2 -2
- package/dist/{context-DN1b9pCR.js.map → context-AXdAh-q8.js.map} +1 -1
- package/dist/{db-KzlqddGD.js → db-DBbKpjYX.js} +35 -6
- package/dist/{db-KzlqddGD.js.map → db-DBbKpjYX.js.map} +1 -1
- package/dist/{dev-CzOazEHW.js → dev-C93d4QIv.js} +2 -2
- package/dist/{dev-CzOazEHW.js.map → dev-C93d4QIv.js.map} +1 -1
- package/dist/{doctor-BuqSHNrd.js → doctor-BBPQUO2g.js} +12 -4
- package/dist/{doctor-BuqSHNrd.js.map → doctor-BBPQUO2g.js.map} +1 -1
- package/dist/eject-DABcDnPN.js.map +1 -1
- package/dist/{fold-static-vbZJeo37.js → fold-static-BWzxNn06.js} +2 -2
- package/dist/{fold-static-vbZJeo37.js.map → fold-static-BWzxNn06.js.map} +1 -1
- package/dist/{generate_sdk-DCUUogIP.js → generate_sdk-DNmNuFuW.js} +2 -2
- package/dist/{generate_sdk-DCUUogIP.js.map → generate_sdk-DNmNuFuW.js.map} +1 -1
- package/dist/index.es.js +21 -21
- package/dist/{init-YzfyEffT.js → init-vL1DWOeC.js} +2 -2
- package/dist/{init-YzfyEffT.js.map → init-vL1DWOeC.js.map} +1 -1
- package/dist/manifest-BtzDy7KQ.js.map +1 -1
- package/dist/{normalize-imports-xpSL_GuU.js → normalize-imports-Bd5Y4yLp.js} +2 -2
- package/dist/{normalize-imports-xpSL_GuU.js.map → normalize-imports-Bd5Y4yLp.js.map} +1 -1
- package/dist/resources/status.d.ts +2 -2
- package/dist/{schema-CApM25cs.js → schema-DtLPsXbT.js} +3 -3
- package/dist/{schema-CApM25cs.js.map → schema-DtLPsXbT.js.map} +1 -1
- package/dist/schema-reconcile-DkArN9jF.js +2 -0
- package/dist/{start-28EztR4R.js → start-YOr3X5Zm.js} +2 -2
- package/dist/{start-28EztR4R.js.map → start-YOr3X5Zm.js.map} +1 -1
- package/dist/status-BREvtzJm.js.map +1 -1
- package/dist/{verify-D7UsV_qe.js → verify-Y3rWSgfA.js} +2 -2
- package/dist/{verify-D7UsV_qe.js.map → verify-Y3rWSgfA.js.map} +1 -1
- package/package.json +8 -8
- package/templates/generated-schemas/blank.ts +8 -8
- package/templates/generated-schemas/blog.ts +33 -33
- package/templates/generated-schemas/ecommerce.ts +23 -23
- package/templates/overlays/baas/ai-instructions.md +1 -1
- package/templates/template/.cursorrules +1 -1
- package/templates/template/.github/copilot-instructions.md +1 -1
- package/templates/template/.windsurfrules +1 -1
- package/templates/template/AGENTS.md +1 -1
- package/templates/template/CLAUDE.md +1 -1
- package/templates/template/ai-instructions.md +1 -1
- package/templates/template/backend/functions/hello.ts +4 -3
- package/dist/cloud-CFotGK2-.js.map +0 -1
- package/dist/schema-reconcile-CX1_6Xqm.js +0 -2
|
@@ -982,20 +982,26 @@ async function restoreAppRole(target) {
|
|
|
982
982
|
client.on("error", () => void 0);
|
|
983
983
|
try {
|
|
984
984
|
await client.connect();
|
|
985
|
-
const { detectConnectionPosture, ensureAppRole,
|
|
985
|
+
const { cliRlsSettings, detectConnectionPosture, ensureAppRole, readRecordedRequestRoles } = await import("@rebasepro/server-postgres");
|
|
986
986
|
const runSql = async (text) => (await client.query(text)).rows;
|
|
987
|
+
const settings = cliRlsSettings(await readRecordedRequestRoles(runSql));
|
|
988
|
+
const roleList = settings.roles.map((r) => `"${r}"`).join(", ");
|
|
987
989
|
if (!(await detectConnectionPosture(runSql)).privileged) {
|
|
988
|
-
console.log(chalk.yellow(` ⚠ Could not re-grant
|
|
990
|
+
console.log(chalk.yellow(` ⚠ Could not re-grant ${roleList} — this connection may not create roles.`));
|
|
989
991
|
console.log(chalk.gray(" The copy has its RLS policies but no privileges behind them;"));
|
|
990
992
|
console.log(chalk.gray(" `rebase dev` or `rebase db push` will provision them."));
|
|
991
993
|
return;
|
|
992
994
|
}
|
|
993
995
|
const { rows } = await client.query("SELECT nspname AS \"schema\" FROM pg_namespace");
|
|
994
996
|
const schemas = provisionableSchemas(rows);
|
|
995
|
-
await ensureAppRole(runSql, schemas
|
|
996
|
-
|
|
997
|
+
for (const role of settings.roles) await ensureAppRole(runSql, schemas, {
|
|
998
|
+
role,
|
|
999
|
+
provisionRole: settings.provisionRole,
|
|
1000
|
+
grants: settings.grants
|
|
1001
|
+
});
|
|
1002
|
+
console.log(chalk.gray(` ✓ Re-granted ${roleList} on ${schemas.length} schema(s) — pg_dump strips privileges.`));
|
|
997
1003
|
} catch (error) {
|
|
998
|
-
console.log(chalk.yellow(` ⚠ Restored, but could not re-grant
|
|
1004
|
+
console.log(chalk.yellow(` ⚠ Restored, but could not re-grant the request role: ${error instanceof Error ? error.message : String(error)}`));
|
|
999
1005
|
console.log(chalk.gray(" Run `rebase db push` (or start `rebase dev`) to provision it."));
|
|
1000
1006
|
} finally {
|
|
1001
1007
|
await client.end().catch(() => void 0);
|
|
@@ -1394,6 +1400,27 @@ var DB_ACTION_HELP = {
|
|
|
1394
1400
|
DATABASE_FLAGS_HELP
|
|
1395
1401
|
]
|
|
1396
1402
|
},
|
|
1403
|
+
"request-role": {
|
|
1404
|
+
usage: "rebase db request-role migrate --to <role[,role]> [--dry-run] [--yes]",
|
|
1405
|
+
summary: "Move this database's signed-in and anonymous requests to another Postgres role.",
|
|
1406
|
+
notes: [
|
|
1407
|
+
"Creates the new role if it is missing, re-issues in this database only every grant the old role holds, re-points policies that name it, and records the new role.",
|
|
1408
|
+
"The old role is the one recorded in rebase.schema_meta, or rebase_user. It is left as it is: another database on the cluster may use it.",
|
|
1409
|
+
"--dry-run prints the statements, and the REVOKEs that would take the old role's grants back, and changes nothing.",
|
|
1410
|
+
"On a terminal it asks first; with no terminal it refuses without --yes.",
|
|
1411
|
+
"Then set REBASE_RLS_REQUEST_ROLE (or rls.requestRole) to the new role on every server that uses this database.",
|
|
1412
|
+
DATABASE_FLAGS_HELP
|
|
1413
|
+
]
|
|
1414
|
+
},
|
|
1415
|
+
provision: {
|
|
1416
|
+
usage: "rebase db provision --print",
|
|
1417
|
+
summary: "Print the SQL that sets up the request role(s) for this database, for an administrator to run. Runs nothing.",
|
|
1418
|
+
notes: [
|
|
1419
|
+
"The role(s) are REBASE_RLS_REQUEST_ROLE when set, else the ones recorded in the database, else rebase_user.",
|
|
1420
|
+
"Use it with REBASE_RLS_PROVISION_ROLE=never, when roles are created by a DBA or by infrastructure code.",
|
|
1421
|
+
DATABASE_FLAGS_HELP
|
|
1422
|
+
]
|
|
1423
|
+
},
|
|
1397
1424
|
branch: {
|
|
1398
1425
|
usage: "rebase db branch <create|list|switch|delete|info|diff|prune> [name]",
|
|
1399
1426
|
summary: "Database branching.",
|
|
@@ -1489,6 +1516,8 @@ ${chalk.green.bold("Commands")}
|
|
|
1489
1516
|
${chalk.blue.bold("backup")} Create a backup with pg_dump (--out <path|s3://…>)
|
|
1490
1517
|
${chalk.blue.bold("restore")} Restore a backup with pg_restore (destructive; asks, or --yes)
|
|
1491
1518
|
${chalk.blue.bold("backups")} List stored backups (db backup list is the same)
|
|
1519
|
+
${chalk.blue.bold("request-role")} Move requests to another Postgres role (migrate --to <role>)
|
|
1520
|
+
${chalk.blue.bold("provision")} Print the SQL that sets up the request role (--print)
|
|
1492
1521
|
|
|
1493
1522
|
${chalk.green.bold("Examples")}
|
|
1494
1523
|
${dbExamples(devDatabaseKind())}
|
|
@@ -1539,4 +1568,4 @@ function dbExamples(kind) {
|
|
|
1539
1568
|
//#endregion
|
|
1540
1569
|
export { DATABASE_SOURCE_ENV, DB_SUBCOMMANDS, absolutizeLocalPathArgs, databaseUrlOf, dbCommand, ensureDockerDatabase, argsFromCommand as n, resolveDriverCli, runDriverDbCommand, runDriverSchemaCommand, spawnDriverCli, reportSpawnFailure as t };
|
|
1541
1570
|
|
|
1542
|
-
//# sourceMappingURL=db-
|
|
1571
|
+
//# sourceMappingURL=db-DBbKpjYX.js.map
|