@getstrata/starter 2.2.21 → 2.2.22

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/cli.js CHANGED
@@ -2655,15 +2655,11 @@ BEGIN
2655
2655
  END
2656
2656
  $$`;
2657
2657
  }
2658
- function postgresAppRoleSql(options) {
2658
+ var POSTGRES_PRIVILEGE_LOCK_SQL = "SELECT pg_advisory_xact_lock(hashtext('strata:postgres-privileges'), hashtext(current_database()))";
2659
+ function postgresAppRolePrivilegeSql(options) {
2659
2660
  const database = assertSafeSqlIdentifier(options.database, "database name");
2660
2661
  const role = assertSafeSqlIdentifier(options.role ?? POSTGRES_APP_ROLE, "role name");
2661
- return `-- Application login role. FORCE RLS applies because this role is NOSUPERUSER and NOBYPASSRLS.
2662
- -- Superuser remains for CREATE ROLE / CREATE DATABASE / GRANT / migrate / migrate:fresh DROP.
2663
- -- This script is repeatable on an already-existing volume (not only docker-entrypoint-initdb.d).
2664
- ${postgresAppRoleCreateSql(options)};
2665
-
2666
- GRANT CONNECT ON DATABASE ${database} TO ${role};
2662
+ return `GRANT CONNECT ON DATABASE ${database} TO ${role};
2667
2663
  GRANT USAGE, CREATE ON SCHEMA public TO ${role};
2668
2664
  GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO ${role};
2669
2665
  GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO ${role};
@@ -2673,6 +2669,17 @@ ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON SEQUENCES TO ${role};
2673
2669
  ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT EXECUTE ON FUNCTIONS TO ${role};
2674
2670
  `;
2675
2671
  }
2672
+ function postgresAppRoleSql(options) {
2673
+ const privileges = postgresAppRolePrivilegeSql(options);
2674
+ return `-- Application login role. FORCE RLS applies because this role is NOSUPERUSER and NOBYPASSRLS.
2675
+ -- Superuser remains for CREATE ROLE / CREATE DATABASE / GRANT / migrate / migrate:fresh DROP.
2676
+ -- This script is repeatable on an already-existing volume (not only docker-entrypoint-initdb.d).
2677
+ ${POSTGRES_PRIVILEGE_LOCK_SQL};
2678
+ ${postgresAppRoleCreateSql(options)};
2679
+
2680
+ ${privileges}
2681
+ `;
2682
+ }
2676
2683
 
2677
2684
  // ../../src/core/tenant/enableTenantRls.ts
2678
2685
  function assertSafeIdentifier(identifier) {
@@ -3131,9 +3138,9 @@ function renderPackageJson(projectName, options = {}) {
3131
3138
  "@getstrata/cli": "workspace:*",
3132
3139
  "@getstrata/core": "workspace:*"
3133
3140
  } : {
3134
- "@getstrata/bootstrap": "^2.2.21",
3135
- "@getstrata/cli": "^2.2.21",
3136
- "@getstrata/core": "^2.2.21"
3141
+ "@getstrata/bootstrap": "^2.2.22",
3142
+ "@getstrata/cli": "^2.2.22",
3143
+ "@getstrata/core": "^2.2.22"
3137
3144
  };
3138
3145
  coreDeps.eta = "^4.6.0";
3139
3146
  if (options.layers?.database === "mysql") {
@@ -12,9 +12,9 @@
12
12
  "check": "tsc --noEmit"
13
13
  },
14
14
  "dependencies": {
15
- "@getstrata/bootstrap": "^2.2.21",
16
- "@getstrata/cli": "^2.2.21",
17
- "@getstrata/core": "^2.2.21",
15
+ "@getstrata/bootstrap": "^2.2.22",
16
+ "@getstrata/cli": "^2.2.22",
17
+ "@getstrata/core": "^2.2.22",
18
18
  "eta": "^4.6.0"
19
19
  },
20
20
  "devDependencies": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getstrata/starter",
3
- "version": "2.2.21",
3
+ "version": "2.2.22",
4
4
  "description": "Interactive create-strata wizard. Choose each layer; one database engine.",
5
5
  "type": "module",
6
6
  "license": "MIT",