create-strata 2.2.56 → 2.2.58

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
@@ -3175,6 +3175,7 @@ function renderConfigProvider(layers) {
3175
3175
  APP_PORT_CONFIG_KEY,
3176
3176
  CORE_CONFIG_TOKEN,
3177
3177
  CORE_PUBLIC_TENANCY_TOKEN,
3178
+ CSRF_TARGET_ORIGIN_CONFIG_KEY,
3178
3179
  DATABASE_URL_CONFIG_KEY,
3179
3180
  REDIS_URL_CONFIG_KEY,
3180
3181
  } from "@getstrata/bootstrap/config";
@@ -3189,6 +3190,8 @@ const configProvider: ServiceProvider = {
3189
3190
  const appConfig = loadConfig();
3190
3191
 
3191
3192
  container.set(CORE_CONFIG_TOKEN, config);
3193
+ if (process.env.CSRF_TARGET_ORIGIN !== undefined)
3194
+ config.set(CSRF_TARGET_ORIGIN_CONFIG_KEY, process.env.CSRF_TARGET_ORIGIN);
3192
3195
  // One approved origin for the starter tenant. Multi-tenant apps replace this lookup.
3193
3196
  if (isProductionEnv()) {
3194
3197
  const publicHost = normalizeTenantHostname(new URL(appConfig.appUrl).host);
@@ -3477,6 +3480,8 @@ function renderCliRegisterTs(layers) {
3477
3480
  const commands: StrataCommandMap = {${layers && authNeedsUsers(layers.auth) ? `
3478
3481
  "auth:provision-admin": async () => (await import("./initialAdmin.ts")).initialAdminCommand,` : ""}
3479
3482
  "make:module": async () => (await import("@getstrata/cli/scaffold")).makeModuleCommand,
3483
+ "make:model": async () => (await import("@getstrata/cli/scaffold")).makeModelCommand,
3484
+ "make:view": async () => (await import("@getstrata/cli/scaffold")).makeViewCommand,
3480
3485
  "make:policy": async () => (await import("@getstrata/cli/scaffold")).makePolicyCommand,
3481
3486
  "make:job": async () => (await import("@getstrata/cli/scaffold")).makeJobCommand,
3482
3487
  "make:listener": async () => (await import("@getstrata/cli/scaffold")).makeListenerCommand,
@@ -4139,11 +4144,15 @@ function postgresAppRolePrivilegeSql(options) {
4139
4144
  const role = assertSafeSqlIdentifier(options.role ?? POSTGRES_APP_ROLE, "role name");
4140
4145
  return `GRANT CONNECT ON DATABASE ${database} TO ${role};
4141
4146
  GRANT USAGE ON SCHEMA public TO ${role};
4142
- GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO ${role};
4143
- GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO ${role};
4147
+ REVOKE ALL PRIVILEGES ON ALL TABLES IN SCHEMA public FROM ${role};
4148
+ GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA public TO ${role};
4149
+ REVOKE ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public FROM ${role};
4150
+ GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA public TO ${role};
4144
4151
  GRANT EXECUTE ON ALL FUNCTIONS IN SCHEMA public TO ${role};
4145
- ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON TABLES TO ${role};
4146
- ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON SEQUENCES TO ${role};
4152
+ ALTER DEFAULT PRIVILEGES IN SCHEMA public REVOKE ALL ON TABLES FROM ${role};
4153
+ ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT, INSERT, UPDATE, DELETE ON TABLES TO ${role};
4154
+ ALTER DEFAULT PRIVILEGES IN SCHEMA public REVOKE ALL ON SEQUENCES FROM ${role};
4155
+ ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT USAGE, SELECT ON SEQUENCES TO ${role};
4147
4156
  ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT EXECUTE ON FUNCTIONS TO ${role};
4148
4157
  `;
4149
4158
  }
@@ -4296,6 +4305,8 @@ function renderEnvExample(projectName, layers) {
4296
4305
  "# Total graceful shutdown budget in milliseconds; keep deployment grace longer.",
4297
4306
  "SHUTDOWN_TIMEOUT_MS=30000",
4298
4307
  "APP_URL=http://localhost:3000",
4308
+ "# Opt-in for HTTPS termination with a preserved public Host; does not trust forwarding headers.",
4309
+ "# CSRF_TARGET_ORIGIN=https://app.example.com",
4299
4310
  `DATABASE_URL=${defaultDatabaseUrl(layers, projectName)}`,
4300
4311
  ...postgresAppRoleEnvNotes(layers),
4301
4312
  ...layers.database === "postgres" ? [`MIGRATION_DATABASE_URL=${defaultMigrationDatabaseUrl(layers, projectName)}`] : [],
@@ -4473,9 +4484,9 @@ function renderPackageJson(projectName, options = {}) {
4473
4484
  "@getstrata/cli": "workspace:*",
4474
4485
  "@getstrata/core": "workspace:*"
4475
4486
  } : {
4476
- "@getstrata/bootstrap": "^2.2.56",
4477
- "@getstrata/cli": "^2.2.56",
4478
- "@getstrata/core": "^2.2.56"
4487
+ "@getstrata/bootstrap": "^2.2.58",
4488
+ "@getstrata/cli": "^2.2.58",
4489
+ "@getstrata/core": "^2.2.58"
4479
4490
  };
4480
4491
  coreDeps.eta = "^4.6.0";
4481
4492
  if (options.layers?.database === "mysql") {
@@ -1,6 +1,8 @@
1
1
  DATABASE_URL=postgresql://postgres:dev-postgres-change-me@localhost:5432/{{PROJECT_NAME}}
2
2
  PORT=3000
3
3
  APP_URL=http://localhost:3000
4
+ # Opt-in for HTTPS termination with a preserved public Host; does not trust forwarding headers.
5
+ # CSRF_TARGET_ORIGIN=https://app.example.com
4
6
  APP_ENV=local
5
7
  APP_NAME={{PROJECT_NAME}}
6
8
  # Cookie/Redis namespace. Unset defaults to `strata`.
@@ -12,9 +12,9 @@
12
12
  "check": "tsc --noEmit"
13
13
  },
14
14
  "dependencies": {
15
- "@getstrata/bootstrap": "^2.2.56",
16
- "@getstrata/cli": "^2.2.56",
17
- "@getstrata/core": "^2.2.56",
15
+ "@getstrata/bootstrap": "^2.2.58",
16
+ "@getstrata/cli": "^2.2.58",
17
+ "@getstrata/core": "^2.2.58",
18
18
  "eta": "^4.6.0"
19
19
  },
20
20
  "devDependencies": {
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  APP_PORT_CONFIG_KEY,
3
3
  CORE_CONFIG_TOKEN,
4
+ CSRF_TARGET_ORIGIN_CONFIG_KEY,
4
5
  DATABASE_URL_CONFIG_KEY,
5
6
  REDIS_URL_CONFIG_KEY,
6
7
  } from "@getstrata/bootstrap/config";
@@ -13,6 +14,8 @@ const configProvider: ServiceProvider = {
13
14
  const appConfig = loadConfig();
14
15
 
15
16
  container.set(CORE_CONFIG_TOKEN, config);
17
+ if (process.env.CSRF_TARGET_ORIGIN !== undefined)
18
+ config.set(CSRF_TARGET_ORIGIN_CONFIG_KEY, process.env.CSRF_TARGET_ORIGIN);
16
19
  config.set(DATABASE_URL_CONFIG_KEY, appConfig.databaseUrl);
17
20
  config.set(APP_PORT_CONFIG_KEY, appConfig.port);
18
21
  config.set(REDIS_URL_CONFIG_KEY, process.env.REDIS_URL ?? "");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-strata",
3
- "version": "2.2.56",
3
+ "version": "2.2.58",
4
4
  "description": "Create a new Strata app. Interactive wizard; choose each layer; one database engine.",
5
5
  "type": "module",
6
6
  "license": "MIT",