@adonis-agora/authkit-server 0.52.0 → 0.52.1

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.
@@ -87,5 +87,23 @@ export async function recoverLostInteraction(ctx) {
87
87
  return ctx.response.redirect(loginUrl);
88
88
  }
89
89
  ctx.response.status(400);
90
- return render(ctx, 'session-expired', { loginUrl, brand });
90
+ const body = await render(ctx, 'session-expired', { loginUrl, brand });
91
+ // ESCREVE o body na resposta. Diferente do dispatch normal de rota — onde o
92
+ // `useReturnValue`/`canWriteResponseBody` do http-server envia o valor
93
+ // retornado — o caminho de exception handler DESCARTA o retorno de
94
+ // `InteractionSessionLostException.handle()`. Por isso o modo `screen`
95
+ // precisa fazer o `send` ele mesmo, senão o corpo nunca sai (400 vazio).
96
+ //
97
+ // Replica fielmente o contrato `canWriteResponseBody` do http-server
98
+ // (`value !== undefined && !hasLazyBody && value !== ctx.response`): o guard
99
+ // `hasLazyBody` evita double-write se algum renderer já tiver escrito, e
100
+ // cobre os DOIS renderers built-in (Edge via `view.render` e Inertia via
101
+ // `inertia.render`) — ambos RETORNAM o payload em vez de escrever.
102
+ const res = ctx.response;
103
+ if (body !== undefined && !res.hasLazyBody && body !== ctx.response) {
104
+ res.send(body);
105
+ }
106
+ // Mantém o `return body` para o caminho de dispatch normal (caso a recuperação
107
+ // seja chamada fora do exception handler); no exception path ele é ignorado.
108
+ return body;
91
109
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adonis-agora/authkit-server",
3
- "version": "0.52.0",
3
+ "version": "0.52.1",
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",