@adonis-agora/authkit-server 0.61.1 → 0.61.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.
@@ -260,5 +260,30 @@ export async function ensureAuthkitSchema(db, options = {}) {
260
260
  report.altered[def.name].push(column);
261
261
  }
262
262
  }
263
+ // Coluna `login_methods` em `auth.users` — a tabela é HOST-owned (não está em
264
+ // TABLES porque o nome/shape são decisão do app), mas a LI B consome a coluna
265
+ // (LoginMethodsPreferenceCapability). Alguns deploys de host só migram o schema
266
+ // do domínio, não o schema `auth` — então a migration manual da coluna pode
267
+ // nunca rodar, e isso derrubava TODO login/callback OIDC com "column users.login_methods
268
+ // does not exist" no instante em que o model passou a declará-la.
269
+ // Aqui garantimos: SE `auth.users` existe E a coluna falta, adicionamos. Nunca
270
+ // criamos a tabela (host-owned). Aditivo + idempotente — roda em todo boot.
271
+ try {
272
+ if (await tableExists(conn, 'users')) {
273
+ if (!(await columnExists(conn, 'users', 'login_methods'))) {
274
+ await conn.schema.alterTable('users', (t) => {
275
+ t.jsonb('login_methods').nullable();
276
+ });
277
+ report.altered.users = ['login_methods'];
278
+ }
279
+ }
280
+ }
281
+ catch (error) {
282
+ // Tabela host-owned pode não existir num banco que nunca criou users — não
283
+ // é erro: fail-soft (a migração do host cuida). Nunca criar a tabela aqui.
284
+ if (!(await tableExists(conn, 'users'))) {
285
+ throw error; // alguém criou entre o probe e o ALTER — repropaga se sumiu
286
+ }
287
+ }
263
288
  return report;
264
289
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adonis-agora/authkit-server",
3
- "version": "0.61.1",
3
+ "version": "0.61.2",
4
4
  "description": "AdonisJS OIDC/OAuth2 provider (Identity Provider) toolkit: ejectable auth server with sessions, rate-limiting, MFA/TOTP, audit log, federated logout and OpenTelemetry metrics.",
5
5
  "license": "MIT",
6
6
  "author": "dudousxd",