@renovatebot/osv-offline 2.1.2 → 2.2.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.
@@ -5,7 +5,7 @@ export declare class OsvOffline {
5
5
  /**
6
6
  * Asynchronous code required as part of class instantiation
7
7
  */
8
- private initialize;
8
+ private static initialize;
9
9
  /**
10
10
  * Asynchronously creates a new instance of {@link OsvOffline}
11
11
  * @returns A new instance of {@link OsvOffline}
@@ -18,4 +18,5 @@ export declare class OsvOffline {
18
18
  * @returns An array of {@link Osv.Vulnerability} or an empty array if none are found
19
19
  */
20
20
  getVulnerabilities(ecosystem: Ecosystem, packageName: string): Promise<Osv.Vulnerability[]>;
21
+ [Symbol.dispose](): void;
21
22
  }
@@ -10,27 +10,27 @@ const debug_1 = __importDefault(require("debug"));
10
10
  const logger = (0, debug_1.default)('osv-offline:download');
11
11
  class OsvOffline {
12
12
  osvOfflineDb;
13
- // eslint-disable-next-line @typescript-eslint/no-empty-function
14
- constructor() { }
13
+ constructor() {
14
+ logger('Initializing databases ...');
15
+ this.osvOfflineDb = osv_offline_db_1.OsvOfflineDb.create();
16
+ logger('Initializing databases done.');
17
+ }
15
18
  /**
16
19
  * Asynchronous code required as part of class instantiation
17
20
  */
18
- async initialize() {
21
+ static async initialize() {
19
22
  const result = await (0, download_1.tryDownloadDb)();
20
23
  if (!result.success) {
21
24
  throw result.error;
22
25
  }
23
- logger('Initializing databases ...');
24
- this.osvOfflineDb = osv_offline_db_1.OsvOfflineDb.create();
25
- logger('Initializing databases done.');
26
26
  }
27
27
  /**
28
28
  * Asynchronously creates a new instance of {@link OsvOffline}
29
29
  * @returns A new instance of {@link OsvOffline}
30
30
  */
31
31
  static async create() {
32
+ await OsvOffline.initialize();
32
33
  const instance = new OsvOffline();
33
- await instance.initialize();
34
34
  return instance;
35
35
  }
36
36
  /**
@@ -42,5 +42,8 @@ class OsvOffline {
42
42
  async getVulnerabilities(ecosystem, packageName) {
43
43
  return this.osvOfflineDb.query(ecosystem, packageName);
44
44
  }
45
+ [Symbol.dispose]() {
46
+ this.osvOfflineDb?.[Symbol.dispose]();
47
+ }
45
48
  }
46
49
  exports.OsvOffline = OsvOffline;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@renovatebot/osv-offline",
3
- "version": "2.1.2",
3
+ "version": "2.2.1",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "license": "MIT",
@@ -15,17 +15,17 @@
15
15
  "dependencies": {
16
16
  "adm-zip": "~0.5.16",
17
17
  "debug": "^4.4.3",
18
- "fs-extra": "^11.3.3",
18
+ "fs-extra": "^11.3.4",
19
19
  "got": "^14.6.6",
20
20
  "luxon": "^3.7.2",
21
- "@renovatebot/osv-offline-db": "2.1.2"
21
+ "@renovatebot/osv-offline-db": "2.2.1"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@types/adm-zip": "0.5.7",
25
25
  "@types/debug": "4.1.12",
26
26
  "@types/fs-extra": "11.0.4",
27
27
  "@types/luxon": "3.7.1",
28
- "@types/node": "22.19.11"
28
+ "@types/node": "22.19.13"
29
29
  },
30
30
  "engines": {
31
31
  "node": ">=22.12.0"