@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.
Files changed (56) hide show
  1. package/dist/{apps-Dg0NnmmJ.js → apps-MKQbgDtN.js} +3 -3
  2. package/dist/{apps-Dg0NnmmJ.js.map → apps-MKQbgDtN.js.map} +1 -1
  3. package/dist/{auth-DifFaOyq.js → auth-Bv0rTbQX.js} +3 -3
  4. package/dist/{auth-DifFaOyq.js.map → auth-Bv0rTbQX.js.map} +1 -1
  5. package/dist/{build-1Zo35L6a.js → build-BuKTnec8.js} +3 -3
  6. package/dist/{build-1Zo35L6a.js.map → build-BuKTnec8.js.map} +1 -1
  7. package/dist/{bundle-CTkzO2WG.js → bundle-BAH4FCju.js} +2 -2
  8. package/dist/{bundle-CTkzO2WG.js.map → bundle-BAH4FCju.js.map} +1 -1
  9. package/dist/{cloud-CFotGK2-.js → cloud-DWL-lxU_.js} +6 -6
  10. package/dist/cloud-DWL-lxU_.js.map +1 -0
  11. package/dist/commands/cloud/context.d.ts +1 -1
  12. package/dist/commands/doctor.d.ts +1 -0
  13. package/dist/{console-BXB6-8GT.js → console-CdwIYOMV.js} +2 -2
  14. package/dist/{console-BXB6-8GT.js.map → console-CdwIYOMV.js.map} +1 -1
  15. package/dist/{context-DN1b9pCR.js → context-AXdAh-q8.js} +2 -2
  16. package/dist/{context-DN1b9pCR.js.map → context-AXdAh-q8.js.map} +1 -1
  17. package/dist/{db-KzlqddGD.js → db-DBbKpjYX.js} +35 -6
  18. package/dist/{db-KzlqddGD.js.map → db-DBbKpjYX.js.map} +1 -1
  19. package/dist/{dev-CzOazEHW.js → dev-C93d4QIv.js} +2 -2
  20. package/dist/{dev-CzOazEHW.js.map → dev-C93d4QIv.js.map} +1 -1
  21. package/dist/{doctor-BuqSHNrd.js → doctor-BBPQUO2g.js} +12 -4
  22. package/dist/{doctor-BuqSHNrd.js.map → doctor-BBPQUO2g.js.map} +1 -1
  23. package/dist/eject-DABcDnPN.js.map +1 -1
  24. package/dist/{fold-static-vbZJeo37.js → fold-static-BWzxNn06.js} +2 -2
  25. package/dist/{fold-static-vbZJeo37.js.map → fold-static-BWzxNn06.js.map} +1 -1
  26. package/dist/{generate_sdk-DCUUogIP.js → generate_sdk-DNmNuFuW.js} +2 -2
  27. package/dist/{generate_sdk-DCUUogIP.js.map → generate_sdk-DNmNuFuW.js.map} +1 -1
  28. package/dist/index.es.js +21 -21
  29. package/dist/{init-YzfyEffT.js → init-vL1DWOeC.js} +2 -2
  30. package/dist/{init-YzfyEffT.js.map → init-vL1DWOeC.js.map} +1 -1
  31. package/dist/manifest-BtzDy7KQ.js.map +1 -1
  32. package/dist/{normalize-imports-xpSL_GuU.js → normalize-imports-Bd5Y4yLp.js} +2 -2
  33. package/dist/{normalize-imports-xpSL_GuU.js.map → normalize-imports-Bd5Y4yLp.js.map} +1 -1
  34. package/dist/resources/status.d.ts +2 -2
  35. package/dist/{schema-CApM25cs.js → schema-DtLPsXbT.js} +3 -3
  36. package/dist/{schema-CApM25cs.js.map → schema-DtLPsXbT.js.map} +1 -1
  37. package/dist/schema-reconcile-DkArN9jF.js +2 -0
  38. package/dist/{start-28EztR4R.js → start-YOr3X5Zm.js} +2 -2
  39. package/dist/{start-28EztR4R.js.map → start-YOr3X5Zm.js.map} +1 -1
  40. package/dist/status-BREvtzJm.js.map +1 -1
  41. package/dist/{verify-D7UsV_qe.js → verify-Y3rWSgfA.js} +2 -2
  42. package/dist/{verify-D7UsV_qe.js.map → verify-Y3rWSgfA.js.map} +1 -1
  43. package/package.json +8 -8
  44. package/templates/generated-schemas/blank.ts +8 -8
  45. package/templates/generated-schemas/blog.ts +33 -33
  46. package/templates/generated-schemas/ecommerce.ts +23 -23
  47. package/templates/overlays/baas/ai-instructions.md +1 -1
  48. package/templates/template/.cursorrules +1 -1
  49. package/templates/template/.github/copilot-instructions.md +1 -1
  50. package/templates/template/.windsurfrules +1 -1
  51. package/templates/template/AGENTS.md +1 -1
  52. package/templates/template/CLAUDE.md +1 -1
  53. package/templates/template/ai-instructions.md +1 -1
  54. package/templates/template/backend/functions/hello.ts +4 -3
  55. package/dist/cloud-CFotGK2-.js.map +0 -1
  56. 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, REBASE_USER_ROLE } = await import("@rebasepro/server-postgres");
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 the "${REBASE_USER_ROLE}" role — this connection may not create roles.`));
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
- console.log(chalk.gray(` ✓ Re-granted "${REBASE_USER_ROLE}" on ${schemas.length} schema(s) — pg_dump strips privileges.`));
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 "rebase_user": ${error instanceof Error ? error.message : String(error)}`));
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-KzlqddGD.js.map
1571
+ //# sourceMappingURL=db-DBbKpjYX.js.map