@adonis-agora/authkit-sdk 0.6.2 → 0.6.3

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.
@@ -5,6 +5,12 @@ const ACTOR = { actorId: null, ip: null, source: 'admin-api' };
5
5
  * services that only touch `request.protocol()`/`request.host()` (used when
6
6
  * composing the password-reset URL) and `request.ip()`. We deliberately do NOT
7
7
  * import `@adonisjs/core/http` here — out-of-band SDK calls have no real request.
8
+ *
9
+ * It also carries `containerResolver.app` and `logger`, which is all the server's
10
+ * default mailer reads (host config for the sender, branding and locale; the
11
+ * logger for the dev fallback). Without them, an SDK-created organization
12
+ * invitation reached the database and no inbox — the same silent failure the
13
+ * missing `onOrgInvitation` fallback caused on the HTTP path.
8
14
  */
9
15
  function fakeCtx(app) {
10
16
  const origin = (app.config.get('authkit.issuer', '') || '').replace(/\/+$/, '');
@@ -26,6 +32,16 @@ function fakeCtx(app) {
26
32
  host: () => host,
27
33
  ip: () => null,
28
34
  },
35
+ containerResolver: { app },
36
+ // Pino-shaped shim. `ApplicationService` exposes no logger synchronously (it
37
+ // is a container binding), and the only thing the server's default mailer
38
+ // does with it is the dev-time "no @adonisjs/mail installed, here is the
39
+ // link" notice. Dropping the field would make that notice vanish, which is
40
+ // the one case where an SDK caller most needs to be told nothing was sent.
41
+ logger: {
42
+ info: (...args) => console.info(...args),
43
+ error: (...args) => console.error(...args),
44
+ },
29
45
  };
30
46
  }
31
47
  /**
@@ -406,7 +422,9 @@ export async function createEmbeddedAuthkit(opts) {
406
422
  },
407
423
  invitations: {
408
424
  async create(orgId, input) {
409
- const result = await orgsService.createInvitation(orgId, input, ACTOR, origin);
425
+ // `ctx` is what lets the server fall back to its own invitation email
426
+ // when the host defines no `mail.onOrgInvitation` hook.
427
+ const result = await orgsService.createInvitation(orgId, input, ACTOR, origin, null, ctx);
410
428
  if (!result.ok)
411
429
  throw new Error('Organização não encontrada.');
412
430
  return invitationDto(result.invitation);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adonis-agora/authkit-sdk",
3
- "version": "0.6.2",
3
+ "version": "0.6.3",
4
4
  "description": "Backend SDK for the AuthKit Admin API with one typed interface and two drivers: remote (HTTP/Bearer) and embedded (in-process when the IdP runs in the same AdonisJS app).",
5
5
  "license": "MIT",
6
6
  "author": "dudousxd",
@@ -54,7 +54,7 @@
54
54
  "@poppinss/ts-exec": "1.4.4",
55
55
  "@types/node": "25.9.1",
56
56
  "typescript": "6.0.3",
57
- "@adonis-agora/authkit-server": "0.57.1"
57
+ "@adonis-agora/authkit-server": "0.58.0"
58
58
  },
59
59
  "scripts": {
60
60
  "build": "tsc",