@getstrata/starter 2.2.21 → 2.2.23
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 +19 -10
- package/dist/templates/package.json +3 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -2655,15 +2655,11 @@ BEGIN
|
|
|
2655
2655
|
END
|
|
2656
2656
|
$$`;
|
|
2657
2657
|
}
|
|
2658
|
-
|
|
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
|
|
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) {
|
|
@@ -2975,7 +2982,9 @@ function renderEnvExample(projectName, layers) {
|
|
|
2975
2982
|
lines.push("MAIL_HOST=localhost");
|
|
2976
2983
|
lines.push("MAIL_PORT=1025");
|
|
2977
2984
|
lines.push(`MAIL_FROM=noreply@${projectName}.local`);
|
|
2985
|
+
lines.push("# true selects verified implicit TLS; false is plaintext (local Mailpit). STARTTLS is not negotiated.");
|
|
2978
2986
|
lines.push("MAIL_SECURE=false");
|
|
2987
|
+
lines.push("MAIL_TIMEOUT_MS=10000");
|
|
2979
2988
|
} else {
|
|
2980
2989
|
lines.push("# MAIL_HOST=");
|
|
2981
2990
|
lines.push("# MAIL_FROM=");
|
|
@@ -3131,9 +3140,9 @@ function renderPackageJson(projectName, options = {}) {
|
|
|
3131
3140
|
"@getstrata/cli": "workspace:*",
|
|
3132
3141
|
"@getstrata/core": "workspace:*"
|
|
3133
3142
|
} : {
|
|
3134
|
-
"@getstrata/bootstrap": "^2.2.
|
|
3135
|
-
"@getstrata/cli": "^2.2.
|
|
3136
|
-
"@getstrata/core": "^2.2.
|
|
3143
|
+
"@getstrata/bootstrap": "^2.2.23",
|
|
3144
|
+
"@getstrata/cli": "^2.2.23",
|
|
3145
|
+
"@getstrata/core": "^2.2.23"
|
|
3137
3146
|
};
|
|
3138
3147
|
coreDeps.eta = "^4.6.0";
|
|
3139
3148
|
if (options.layers?.database === "mysql") {
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
"check": "tsc --noEmit"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@getstrata/bootstrap": "^2.2.
|
|
16
|
-
"@getstrata/cli": "^2.2.
|
|
17
|
-
"@getstrata/core": "^2.2.
|
|
15
|
+
"@getstrata/bootstrap": "^2.2.23",
|
|
16
|
+
"@getstrata/cli": "^2.2.23",
|
|
17
|
+
"@getstrata/core": "^2.2.23",
|
|
18
18
|
"eta": "^4.6.0"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|