@adonis-agora/authkit-sdk 1.0.0-rc.1 → 1.0.0-rc.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @adonis-agora/authkit-sdk
2
2
 
3
+ ## 1.0.0-rc.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#473](https://github.com/DavideCarvalho/adonis-agora-authkit/pull/473) [`427c4a3`](https://github.com/DavideCarvalho/adonis-agora-authkit/commit/427c4a301907dc78d8e7c5405d4e73e29b8a2be4) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - Every table AuthKit owns now uses one Lucid connection: `schema.connection` (default: the primary connection). Before, some of them followed other connections, so with the account model on a named connection the boot created a table on one connection and the code read it on another:
8
+
9
+ - `auth_settings` (runtime settings, the settings CLI, `authkit:expire-scan`, the SDK's embedded driver) followed the account model's connection.
10
+ - `auth_mfa` and `auth_password_history` used the account model's connection.
11
+ - The built-in organization models had no connection, so they always used the primary one.
12
+ - `adapters.database()` and the `lucid` keystore without their own `connection` used the primary connection.
13
+
14
+ They all use `schema.connection` now; `adapters.database({ connection })` and `jwks.store: { driver: 'lucid', connection }` still win when set. The app's account table stays on the account model's connection, and the boot adds the `login_methods` column there. If your app had `schema.connection` unset and the account model on a named connection, those tables move to the primary connection: set `schema.connection` to the connection where they already are.
15
+
3
16
  ## 1.0.0-rc.1
4
17
 
5
18
  ### Minor Changes
@@ -494,7 +494,7 @@ export async function createEmbeddedAuthkit(opts) {
494
494
  catch {
495
495
  return { data: [] };
496
496
  }
497
- const connection = cfg.accountStore?.connectionName;
497
+ const connection = cfg.schema?.connection;
498
498
  const svc = new RuntimeSettings(db, connection ? { connection } : {});
499
499
  const rows = await svc.listSettings();
500
500
  return {
@@ -515,7 +515,7 @@ export async function createEmbeddedAuthkit(opts) {
515
515
  catch {
516
516
  throw new Error('Runtime settings not available.');
517
517
  }
518
- const connection = cfg.accountStore?.connectionName;
518
+ const connection = cfg.schema?.connection;
519
519
  const svc = new RuntimeSettings(db, connection ? { connection } : {});
520
520
  const value = await svc.getSetting(key);
521
521
  if (value === null)
@@ -531,7 +531,7 @@ export async function createEmbeddedAuthkit(opts) {
531
531
  catch {
532
532
  throw new Error('Runtime settings not available.');
533
533
  }
534
- const connection = cfg.accountStore?.connectionName;
534
+ const connection = cfg.schema?.connection;
535
535
  const svc = new RuntimeSettings(db, connection ? { connection } : {});
536
536
  await svc.setSetting(key, value, null);
537
537
  const saved = await svc.getSetting(key);
@@ -552,7 +552,7 @@ export async function createEmbeddedAuthkit(opts) {
552
552
  catch {
553
553
  throw new Error('Runtime settings not available.');
554
554
  }
555
- const connection = cfg.accountStore?.connectionName;
555
+ const connection = cfg.schema?.connection;
556
556
  const svc = new RuntimeSettings(db, connection ? { connection } : {});
557
557
  await svc.deleteSetting(key);
558
558
  await cfg.audit?.record({
@@ -571,7 +571,7 @@ export async function createEmbeddedAuthkit(opts) {
571
571
  let settingsSvc = null;
572
572
  try {
573
573
  const db = await app.container.make('lucid.db');
574
- const connection = cfg.accountStore?.connectionName;
574
+ const connection = cfg.schema?.connection;
575
575
  settingsSvc = new RuntimeSettings(db, connection ? { connection } : {});
576
576
  }
577
577
  catch {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adonis-agora/authkit-sdk",
3
- "version": "1.0.0-rc.1",
3
+ "version": "1.0.0-rc.2",
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",
@@ -51,7 +51,7 @@
51
51
  }
52
52
  },
53
53
  "devDependencies": {
54
- "@adonis-agora/authkit-server": "1.0.0-rc.3",
54
+ "@adonis-agora/authkit-server": "1.0.0-rc.11",
55
55
  "@adonisjs/core": "7.6.0",
56
56
  "@adonisjs/tsconfig": "2.0.0",
57
57
  "@japa/assert": "4.2.0",