create-strata 2.2.20 → 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.20",
3135
- "@getstrata/cli": "^2.2.20",
3136
- "@getstrata/core": "^2.2.20"
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") {
@@ -3413,7 +3420,11 @@ ${next.join(`
3413
3420
  `)}
3414
3421
  \`\`\`
3415
3422
 
3416
- Open http://localhost:3000. Health check: \`GET /health\`. Redis worker: \`bun run queue:work\` (requires \`REDIS_URL\`). Durable events: \`bun run outbox:work\` after \`bun run db:migrate\`. Add listeners in \`src/outbox/registry.ts\` before publishing.
3423
+ Open http://localhost:3000. Health check: \`GET /health\`. Discover registered commands with \`bunx strata help\`. \`dev\` and \`start\` run HTTP only; workers are explicit, separate processes.
3424
+
3425
+ ${layers.queue === "redis" ? "Redis jobs need `bun run queue:work` in another terminal (requires `REDIS_URL`).\n\n" : `The synchronous queue handles jobs inline; no Redis queue worker is needed for it.
3426
+
3427
+ `}For durable events, add listeners in \`src/outbox/registry.ts\`, apply \`bun run db:migrate\`, then run \`bun run outbox:work\` in another terminal. Apps that do not publish durable events do not need this worker. Durable cache invalidation also needs the outbox worker when explicitly configured. Use the same application environment, database, Redis URL and \`APP_KEY_PREFIX\` for HTTP and its workers. An idle worker is normal; startup output confirms entry into polling, not dependency health. Stop HTTP and workers before resetting the development database.
3417
3428
 
3418
3429
  ${renderSupportingToolsReadme(layers)}${layers.auth !== "headers" ? `
3419
3430
  For the first production admin, apply migrations and run \`bunx strata auth:provision-admin --email operator@example.test --name "Initial Operator" --password-stdin${layers.tenancy !== "none" ? " --tenant 1" : ""} < /run/secrets/initial_admin_password\` before admitting traffic. Supply your own private secret-manager-mounted file, not a demo password. Passwords require at least 16 characters and at most 72 UTF-8 bytes. Tenant-enabled applications require an existing tenant ID; this command does not create tenants. It refuses existing admins/accounts, records a transactional one-time claim, and does not mark email verified or enroll MFA. Additional admins and recovery remain explicit application administration. The command does not migrate or seed automatically.
@@ -12,9 +12,9 @@
12
12
  "check": "tsc --noEmit"
13
13
  },
14
14
  "dependencies": {
15
- "@getstrata/bootstrap": "^2.2.20",
16
- "@getstrata/cli": "^2.2.20",
17
- "@getstrata/core": "^2.2.20",
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": "create-strata",
3
- "version": "2.2.20",
3
+ "version": "2.2.22",
4
4
  "description": "Create a new Strata app. Interactive wizard; choose each layer; one database engine.",
5
5
  "type": "module",
6
6
  "license": "MIT",