@backstage/plugin-auth-backend 0.15.1-next.1 → 0.15.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @backstage/plugin-auth-backend
2
2
 
3
+ ## 0.15.1
4
+
5
+ ### Patch Changes
6
+
7
+ - c676a9e07b: Fixed a bug in auth plugin on the backend where it ignores the skip migration database options when using the database provider.
8
+ - 2d7d6028e1: Updated dependency `@google-cloud/firestore` to `^6.0.0`.
9
+ - Updated dependencies
10
+ - @backstage/backend-common@0.15.0
11
+ - @backstage/plugin-auth-node@0.2.4
12
+
3
13
  ## 0.15.1-next.1
4
14
 
5
15
  ### Patch Changes
package/dist/index.cjs.js CHANGED
@@ -2790,23 +2790,27 @@ const parseDate = (date) => {
2790
2790
  };
2791
2791
  class DatabaseKeyStore {
2792
2792
  static async create(options) {
2793
+ var _a;
2793
2794
  const { database } = options;
2794
- await database.migrate.latest({
2795
- directory: migrationsDir
2796
- });
2797
- return new DatabaseKeyStore(options);
2795
+ const client = await database.getClient();
2796
+ if (!((_a = database.migrations) == null ? void 0 : _a.skip)) {
2797
+ await client.migrate.latest({
2798
+ directory: migrationsDir
2799
+ });
2800
+ }
2801
+ return new DatabaseKeyStore(client);
2798
2802
  }
2799
- constructor(options) {
2800
- this.database = options.database;
2803
+ constructor(client) {
2804
+ this.client = client;
2801
2805
  }
2802
2806
  async addKey(key) {
2803
- await this.database(TABLE).insert({
2807
+ await this.client(TABLE).insert({
2804
2808
  kid: key.kid,
2805
2809
  key: JSON.stringify(key)
2806
2810
  });
2807
2811
  }
2808
2812
  async listKeys() {
2809
- const rows = await this.database(TABLE).select();
2813
+ const rows = await this.client(TABLE).select();
2810
2814
  return {
2811
2815
  items: rows.map((row) => ({
2812
2816
  key: JSON.parse(row.key),
@@ -2815,7 +2819,7 @@ class DatabaseKeyStore {
2815
2819
  };
2816
2820
  }
2817
2821
  async removeKeys(kids) {
2818
- await this.database(TABLE).delete().whereIn("kid", kids);
2822
+ await this.client(TABLE).delete().whereIn("kid", kids);
2819
2823
  }
2820
2824
  }
2821
2825
 
@@ -2925,9 +2929,7 @@ class KeyStores {
2925
2929
  if (!database) {
2926
2930
  throw new Error("This KeyStore provider requires a database");
2927
2931
  }
2928
- return await DatabaseKeyStore.create({
2929
- database: await database.getClient()
2930
- });
2932
+ return await DatabaseKeyStore.create({ database });
2931
2933
  }
2932
2934
  if (provider === "memory") {
2933
2935
  return new MemoryKeyStore();