@renovatebot/osv-offline-db 4.4.0 → 4.4.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/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { OsvOfflineDb } from './lib/db.ts';
2
- export { DatabaseIndexBuilder, type DatabaseRecord, getIndexFileName, } from './lib/db-index.ts';
2
+ export { DatabaseIndexBuilder, type DatabaseRecord, getIndexFileName } from './lib/db-index.ts';
3
3
  export { Ecosystem, ecosystems } from './lib/ecosystem.ts';
4
4
  export { type SplitEcosystem, type SplitFile, type SplitIndex, getSplitFileName, parseSplitIndex, splitIndexSchema, } from './lib/split-index.ts';
5
5
  export * as Osv from './lib/osv.ts';
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export { OsvOfflineDb } from "./lib/db.js";
2
- export { DatabaseIndexBuilder, getIndexFileName, } from "./lib/db-index.js";
2
+ export { DatabaseIndexBuilder, getIndexFileName } from "./lib/db-index.js";
3
3
  export { ecosystems } from "./lib/ecosystem.js";
4
4
  export { getSplitFileName, parseSplitIndex, splitIndexSchema, } from "./lib/split-index.js";
5
5
  export * as Osv from "./lib/osv.js";
@@ -41,10 +41,7 @@ export class DatabaseIndexBuilder {
41
41
  ...(this.last && { last: this.last }),
42
42
  packages: Object.fromEntries(Array.from(this.index, ([name, pointers]) => [
43
43
  name,
44
- pointers.map(({ offset, length }) => [
45
- offset,
46
- length,
47
- ]),
44
+ pointers.map(({ offset, length }) => [offset, length]),
48
45
  ])),
49
46
  };
50
47
  return JSON.stringify(file);
@@ -63,9 +60,7 @@ export function parseIndex(content, size) {
63
60
  catch {
64
61
  return null;
65
62
  }
66
- if (file?.size !== size ||
67
- typeof file.packages !== 'object' ||
68
- file.packages === null) {
63
+ if (file?.size !== size || typeof file.packages !== 'object' || file.packages === null) {
69
64
  return null;
70
65
  }
71
66
  const index = new Map(Object.entries(file.packages).map(([name, pointers]) => [
package/dist/lib/db.js CHANGED
@@ -1,12 +1,12 @@
1
- import { readFile, stat } from 'node:fs/promises';
2
1
  import { closeSync, createReadStream, read as fsRead, openSync } from 'node:fs';
3
- import { promisify } from 'node:util';
4
- import path from 'node:path';
2
+ import { readFile, stat } from 'node:fs/promises';
5
3
  import { tmpdir } from 'node:os';
4
+ import path from 'node:path';
6
5
  import readline from 'node:readline';
6
+ import { promisify } from 'node:util';
7
+ import debug from 'debug';
7
8
  import { DatabaseIndexBuilder, getIndexFileName, parseIndex, } from "./db-index.js";
8
9
  import { packageToPurl } from "./purl-helper.js";
9
- import debug from 'debug';
10
10
  const logger = debug('osv-offline:db');
11
11
  const readAsync = promisify(fsRead);
12
12
  export class OsvOfflineDb {
@@ -156,12 +156,12 @@ export class OsvOfflineDb {
156
156
  return [];
157
157
  }
158
158
  const advisories = await Promise.all(pointers.map((pointer) => this._readRecord(data, pointer)));
159
- if (this.disposed)
159
+ if (this.disposed) {
160
160
  return [];
161
+ }
161
162
  const targetPurl = packageToPurl(ecosystem, packageName);
162
163
  return advisories.filter((vuln) => vuln.affected?.some((a) => a.package?.name === packageName &&
163
- (a.package.ecosystem === ecosystem ||
164
- a.package.ecosystem.startsWith(`${ecosystem}:`)) &&
164
+ (a.package.ecosystem === ecosystem || a.package.ecosystem.startsWith(`${ecosystem}:`)) &&
165
165
  a.package.purl === targetPurl));
166
166
  }
167
167
  [Symbol.dispose]() {
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@renovatebot/osv-offline-db",
3
- "version": "4.4.0",
4
- "main": "dist/index.js",
3
+ "version": "4.4.1",
5
4
  "license": "MIT",
6
- "type": "module",
7
- "publishConfig": {
8
- "access": "public"
9
- },
10
5
  "repository": {
11
6
  "type": "git",
12
7
  "url": "https://github.com/renovatebot/osv-offline.git"
13
8
  },
9
+ "type": "module",
10
+ "main": "dist/index.js",
11
+ "publishConfig": {
12
+ "access": "public"
13
+ },
14
14
  "dependencies": {
15
15
  "debug": "^4.4.3"
16
16
  },
@@ -20,7 +20,8 @@
20
20
  "@types/debug": "4.1.13",
21
21
  "@types/fs-extra": "11.0.4",
22
22
  "@types/node": "24.19.2",
23
- "fs-extra": "11.4.1"
23
+ "fs-extra": "11.4.1",
24
+ "vitest": "4.1.12"
24
25
  },
25
26
  "engines": {
26
27
  "node": ">=24.11.0",