create-kontrolia-auth 2.4.0 → 2.4.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.
@@ -1 +1 @@
1
- {"version":3,"file":"deployment.d.ts","sourceRoot":"","sources":["../../src/steps/deployment.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AA8JpD;;;;GAIG;AACH,wBAAsB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAoJ3F"}
1
+ {"version":3,"file":"deployment.d.ts","sourceRoot":"","sources":["../../src/steps/deployment.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAiLpD;;;;GAIG;AACH,wBAAsB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAsJ3F"}
@@ -2,6 +2,26 @@ import * as p from "@clack/prompts";
2
2
  import { readEnvFile, updateEnvValue, writeEnvFile } from "../utils/files.js";
3
3
  import { registerOAuthClient } from "../utils/oauth-client.js";
4
4
  import { createVercelProject, detectCurrentBranch, detectGitHubRepo, triggerVercelDeployment } from "../utils/vercel-api.js";
5
+ /**
6
+ * Catches a `http://` URL for a real domain before it gets baked into env
7
+ * vars — this exact typo shipped once already and broke CORS silently: the
8
+ * browser sends `Origin: https://panel.example.com`, the server only
9
+ * allow-lists the `http://` variant from this value, and every fetch()
10
+ * from admin-panel to auth-server fails with an unhelpful "Failed to
11
+ * fetch" that gives no hint the mismatch is just one character. `http://`
12
+ * is still fine for localhost/127.0.0.1 since nothing serves plain HTTP
13
+ * during local dev.
14
+ */
15
+ function validateDeployUrl(value) {
16
+ if (!value.trim())
17
+ return "Requerido";
18
+ if (/^http:\/\/(localhost|127\.0\.0\.1)(:\d+)?\/?$/i.test(value.trim()))
19
+ return undefined;
20
+ if (!/^https:\/\//i.test(value.trim())) {
21
+ return 'Usa https:// para un dominio real (http:// solo vale para localhost) — si no, el navegador bloquea las llamadas entre auth-server y admin-panel por CORS.';
22
+ }
23
+ return undefined;
24
+ }
5
25
  const NEXT_STEPS = {
6
26
  docker: "Ya está: los servicios auth-server y admin-panel viven en el mismo docker/docker-compose.yml. Corre `docker compose -f docker/docker-compose.yml up -d` para tenerlos arriba.",
7
27
  vercel: "Lo más confiable con un monorepo pnpm es conectar el repo desde el dashboard (no desplegar carpetas sueltas por CLI):\n" +
@@ -156,6 +176,7 @@ export async function askDeploymentStep(repoRoot, db) {
156
176
  placeholder: "http://localhost:3000",
157
177
  defaultValue: "http://localhost:3000",
158
178
  initialValue: prevAuthServerUrl,
179
+ validate: validateDeployUrl,
159
180
  });
160
181
  if (p.isCancel(authServerUrl)) {
161
182
  p.cancel("Instalación cancelada.");
@@ -166,6 +187,7 @@ export async function askDeploymentStep(repoRoot, db) {
166
187
  placeholder: "http://localhost:3001",
167
188
  defaultValue: "http://localhost:3001",
168
189
  initialValue: prevAdminPanelUrl,
190
+ validate: validateDeployUrl,
169
191
  });
170
192
  if (p.isCancel(adminPanelUrl)) {
171
193
  p.cancel("Instalación cancelada.");
@@ -1 +1 @@
1
- {"version":3,"file":"supabase-management-api.d.ts","sourceRoot":"","sources":["../../src/utils/supabase-management-api.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,OAAO,CAAC;IACZ,qCAAqC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAGpE;AASD;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CA+BtH;AAED;;;;;GAKG;AACH,wBAAsB,2BAA2B,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAgBjH;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAgBvG"}
1
+ {"version":3,"file":"supabase-management-api.d.ts","sourceRoot":"","sources":["../../src/utils/supabase-management-api.ts"],"names":[],"mappings":"AAcA,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,OAAO,CAAC;IACZ,qCAAqC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAGpE;AASD;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CA+BtH;AAED;;;;;GAKG;AACH,wBAAsB,2BAA2B,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAgBjH;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAgBvG"}
@@ -1,6 +1,16 @@
1
1
  const CUSTOM_ACCESS_TOKEN_HOOK_URI = "pg-functions://postgres/kontrolia_auth/custom_access_token_hook";
2
- /** GoTrue's internal route for the OAuth 2.1 authorization endpoint — the API rejects oauth_server_enabled without it. */
3
- const OAUTH_SERVER_AUTHORIZATION_PATH = "/oauth/authorize";
2
+ /**
3
+ * NOT GoTrue's own /auth/v1/oauth/authorize endpoint (that one is fixed,
4
+ * not configurable) — this is the path on OUR OWN app (auth-server) that
5
+ * GoTrue redirects the browser to, with an `authorization_id` query param,
6
+ * so the app can render its consent screen. Must match the route
7
+ * auth-server actually serves (apps/auth-server/app/oauth/consent/page.tsx)
8
+ * and the value docker-compose.yml already sets for self-hosted
9
+ * (GOTRUE_OAUTH_SERVER_AUTHORIZATION_PATH). Getting this wrong doesn't
10
+ * surface as an error on enable — it silently breaks every OAuth
11
+ * authorization attempt afterward, redirecting to a path nothing serves.
12
+ */
13
+ const OAUTH_SERVER_AUTHORIZATION_PATH = "/oauth/consent";
4
14
  /**
5
15
  * Extracts the project ref (subdomain) from a Supabase Cloud URL, e.g.
6
16
  * "https://abcxyz.supabase.co" -> "abcxyz". Returns null for anything else
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-kontrolia-auth",
3
- "version": "2.4.0",
3
+ "version": "2.4.2",
4
4
  "license": "MIT",
5
5
  "description": "Turnkey installer for KontrolIA Auth. `npx create-kontrolia-auth mi-app` checks requirements, downloads the repo, installs deps, and runs a wizard: (1) connect to an existing Supabase project or create a new self-hosted one via Docker; (2) where to deploy auth-server/admin-panel (Docker, Vercel, Railway, Render, Coolify). Also exposes `update`, `migrate` and `doctor` subcommands.",
6
6
  "keywords": [