@owlmeans/package-insights-depsdev 0.0.0-stage → 0.2.5-beta.0

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/README.md CHANGED
@@ -1,3 +1,56 @@
1
- # Temporary Holding Version
1
+ # @owlmeans/package-insights-depsdev
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The [deps.dev](https://deps.dev) adapter of [`@owlmeans/package-inspector`](https://github.com/owlmeans/common/tree/main/packages/package-inspector)'s
4
+ `PackageInsights` port: a release's publish date, advisory keys and source repository, and the
5
+ repository's stars and OpenSSF Scorecard — what the inspector's `install` policy dates releases from
6
+ (when a registry document is too large) and verifies a repository with.
7
+
8
+ ## Installation
9
+
10
+ ```sh
11
+ bun add @owlmeans/package-insights-depsdev@^0.2.5-beta.0 @owlmeans/package-inspector@^0.2.5-beta.0
12
+ ```
13
+
14
+ ## Usage
15
+
16
+ ```ts
17
+ import { createDepsDevInsights } from '@owlmeans/package-insights-depsdev'
18
+
19
+ const insights = createDepsDevInsights()
20
+ const release = await insights.version('exceljs', '4.4.0')
21
+ // { publishedAt: '2023-10-19T19:49:55Z', advisoryKeys: [], projects: [{ id: 'github.com/exceljs/exceljs', kind: 'source', … }], … }
22
+ const repository = await insights.project('github.com/exceljs/exceljs')
23
+ // { id, stars: 15517, forks: 2076, scorecard: 4, … }
24
+ ```
25
+
26
+ Pass it to `createPackageInspector({ registry, advisories, insights, policy: 'install' })`.
27
+
28
+ ## Configuration
29
+
30
+ | Option | Default | Purpose |
31
+ |---|---|---|
32
+ | `fetch` | global `fetch` | A pinned or proxied client |
33
+ | `apiUrl` | `https://api.deps.dev` | The API |
34
+ | `system` | `npm` | The deps.dev package system |
35
+ | `timeoutMs`, `retries`, `userAgent` | 10 s, 3, the package name | Per request |
36
+ | `cacheTtlMs` | 10 minutes | Answer reuse; `0` off |
37
+
38
+ ## License
39
+
40
+ MIT
41
+
42
+ <!-- owlmeans:agent-guidance:start -->
43
+ ## Agent guidance
44
+
45
+ This package ships embedded agent skills under `agent-meta/`. After installing your
46
+ `@owlmeans/*` packages, run the OwlMeans agent-skills installer to place them into
47
+ your project's skill store (`.agents/skills/`):
48
+
49
+ ```sh
50
+ npx @owlmeans/agent-skills@^0.2.5-beta.0
51
+ ```
52
+
53
+ The embedded files are version-matched to this package release. Do not edit them
54
+ directly — they are regenerated on each publish. To contribute guidance edits,
55
+ open a PR against the source monorepo.
56
+ <!-- owlmeans:agent-guidance:end -->
@@ -0,0 +1,16 @@
1
+ {
2
+ "schemaVersion": 3,
3
+ "package": "@owlmeans/package-insights-depsdev",
4
+ "version": "0.2.5-beta.0",
5
+ "generatedAt": "2026-11-30T14:51:12.683Z",
6
+ "canonicalRepo": "https://github.com/owlmeans/connect",
7
+ "entries": [
8
+ {
9
+ "kind": "skill",
10
+ "name": "package-insights-depsdev",
11
+ "category": "package-specific",
12
+ "file": "skills/package-insights-depsdev/SKILL.md",
13
+ "canonicalPath": ".agents/skills/package-insights-depsdev/SKILL.md"
14
+ }
15
+ ]
16
+ }
@@ -0,0 +1,79 @@
1
+ ---
2
+ name: package-insights-depsdev
3
+ description: "How to use @owlmeans/package-insights-depsdev (OwlMeans connect) — the deps.dev (v3) adapter of @owlmeans/package-inspector's PackageInsights port: createDepsDevInsights → version(name, version) (publish date, advisory keys, deprecation, licenses, verified provenance, related projects as source/issues with attestation) and project(id) (stars, forks, open issues, license, OpenSSF Scorecard), names and ids encoded as one path segment, cached answers, timeouts and retries over an injectable fetch. Auto-invoked when wiring the install policy's insights source, dating releases of an oversized npm packument, verifying a package's source repository or reading its Scorecard."
4
+ user-invocable: false
5
+ ---
6
+ <!-- AUTO-GENERATED — do not edit. Regenerate via sync-agent-meta. -->
7
+
8
+ # @owlmeans/package-insights-depsdev
9
+
10
+ **Layer:** Server (Node/Bun; any runtime with `fetch`)
11
+ **Repo:** OwlMeans connect — the deps.dev half; the port, rules and policy are common's
12
+ `@owlmeans/package-inspector`
13
+ **Install:** `"@owlmeans/package-insights-depsdev": "^0.2.5-beta.0"` in `dependencies`
14
+
15
+ ## Public API
16
+
17
+ | Symbol | Kind | Purpose |
18
+ |---|---|---|
19
+ | `createDepsDevInsights(opts?)` | factory | `DepsDevInsights` (a `PackageInsights`, `id` `'deps.dev'`): `version(name, version)` → `PackageVersionInsight \| null`, `project(id)` → `PackageProjectInsight \| null` |
20
+ | `DepsDevInsightsOptions` | interface | `fetch?`, `apiUrl?`, `system?` (`npm`), `timeoutMs?` (10 s), `retries?` (3), `userAgent?`, `cacheTtlMs?` (10 min, `0` off) |
21
+ | `DEPSDEV_INSIGHTS`, `DEPSDEV_API_URL`, `DEPSDEV_SYSTEM`, `DEPSDEV_TIMEOUT`, `DEPSDEV_RETRIES`, `DEPSDEV_MAX_BYTES`, `DEPSDEV_CACHE_TTL`, `DEPSDEV_CACHE_SIZE`, `DEPSDEV_USER_AGENT`, `DEPSDEV_SOURCE_RELATION`, `DEPSDEV_ISSUES_RELATION`, `DEPSDEV_UNVERIFIED_PROVENANCE` | const | `'deps.dev'`, `https://api.deps.dev`, `'npm'`, 10 s, 3, 2 MiB, 10 min, 5 000, `@owlmeans/package-insights-depsdev`, `SOURCE_REPO`, `ISSUE_TRACKER`, `UNVERIFIED_METADATA` |
22
+
23
+ ## Usage
24
+
25
+ ```typescript
26
+ import { createDepsDevInsights } from '@owlmeans/package-insights-depsdev'
27
+
28
+ const insights = createDepsDevInsights({ fetch })
29
+ const release = await insights.version('@modelcontextprotocol/sdk', '1.20.0')
30
+ // { publishedAt: '2025-10-09T21:00:24Z', advisoryKeys: [8 GHSA ids], provenance: true,
31
+ // projects: [{ id: 'github.com/modelcontextprotocol/typescript-sdk', kind: 'source', attested: true }], … }
32
+ const repository = await insights.project('github.com/exceljs/exceljs')
33
+ // { id, stars: 15517, forks: 2076, openIssues: 830, scorecard: 4, license: 'MIT', description }
34
+ ```
35
+
36
+ Hand it to `createPackageInspector({ registry, advisories, insights, policy: 'install' })` — see
37
+ [[package-inspector]] "Install policy".
38
+
39
+ ## What each member reads
40
+
41
+ - **`version`** — deps.dev v3 `GetVersion` (system, package name and version as path segments), each part encoded
42
+ whole (`@modelcontextprotocol%2Fsdk`): `publishedAt`, `advisoryKeys[].id` (deduplicated),
43
+ `isDeprecated` → `deprecated`, `licenses`, a `verified` entry in `slsaProvenances` or
44
+ `attestations` → `provenance: true`, `relatedProjects` → `projects` (`SOURCE_REPO` → `source`,
45
+ `ISSUE_TRACKER` → `issues`, else `other`; `attested` unless `relationProvenance` is
46
+ `UNVERIFIED_METADATA`).
47
+ - **`project`** — deps.dev v3 `GetProject` with the project id as one path segment, encoded whole (`github.com%2Fo%2Fr`):
48
+ `starsCount`, `forksCount`, `openIssuesCount`, `license`, `description`,
49
+ `scorecard.overallScore` → `scorecard` (0–10).
50
+ - A 404 is `null` (cached too); answers are cached `cacheTtlMs` per instance.
51
+
52
+ What the install policy uses it for: publish dates when the registry's version list is `partial`
53
+ (and the first publish when the registry gives none), the chosen release's provenance, the source
54
+ project that verifies a repository (an attested one even where the repository's manifest cannot be
55
+ read), and the Scorecard/stars reputation.
56
+
57
+ ## Rules
58
+
59
+ - Failures throw `PackageSourceError` (`deps.dev:<version|project>:<subject>:<status|timeout|unreachable|malformed|too-large>`);
60
+ the inspector turns it into `unknown` ("the deps.dev insights could not be asked").
61
+ - `advisoryKeys` carry no severity: advisories come from [[package-advisories-osv]] and the registry.
62
+ - Keep deps.dev's wire values here — the inspector stays source-neutral.
63
+
64
+ ## Tests
65
+
66
+ `bun test ./tests` in the package.
67
+
68
+ - `insights.spec` — a real local HTTP stand-in answering like deps.dev v3 (`startStandIn`; names and
69
+ ids must arrive as one encoded segment) over `fixtures.ts` (`xlsx`, `exceljs`,
70
+ `@modelcontextprotocol/sdk` and the `exceljs` project as deps.dev answered on 2026-11-27): mapping,
71
+ scoped encoding, provenance and attested relations, null and caching, another system, outages.
72
+ - `live.spec` — `PACKAGE_INSIGHTS_DEPSDEV_LIVE=1`: `exceljs@4.4.0`'s date and source repository with
73
+ stars and a Scorecard; `@modelcontextprotocol/sdk@1.20.0`'s eight advisory keys. Read-only.
74
+
75
+ ## Related
76
+
77
+ - [[package-inspector]] (`@owlmeans/package-inspector`) — the `PackageInsights` port and the install policy
78
+ - [[package-advisories-osv]] — the advisory database
79
+ - [[package-registry-npm]] — the registry whose oversized version lists this dates
@@ -0,0 +1,25 @@
1
+ /** The source id the deps.dev adapter reports under (`unavailable` findings). */
2
+ export declare const DEPSDEV_INSIGHTS = "deps.dev";
3
+ /** deps.dev's API (v3). */
4
+ export declare const DEPSDEV_API_URL = "https://api.deps.dev";
5
+ /** The package system the names belong to by default. */
6
+ export declare const DEPSDEV_SYSTEM = "npm";
7
+ /** Milliseconds before one request (headers and body) is abandoned. */
8
+ export declare const DEPSDEV_TIMEOUT = 10000;
9
+ /** Retries of a throttled (429) or briefly unavailable (502–504) request. */
10
+ export declare const DEPSDEV_RETRIES = 3;
11
+ /** The cap of one answer. */
12
+ export declare const DEPSDEV_MAX_BYTES: number;
13
+ /** How long an answer is reused, in ms; `0` disables the cache. */
14
+ export declare const DEPSDEV_CACHE_TTL: number;
15
+ /** The most answers kept. */
16
+ export declare const DEPSDEV_CACHE_SIZE = 5000;
17
+ /** The `user-agent` every request carries unless the options name another. */
18
+ export declare const DEPSDEV_USER_AGENT = "@owlmeans/package-insights-depsdev";
19
+ /** deps.dev's relation of a release to its source repository. */
20
+ export declare const DEPSDEV_SOURCE_RELATION = "SOURCE_REPO";
21
+ /** deps.dev's relation of a release to its issue tracker. */
22
+ export declare const DEPSDEV_ISSUES_RELATION = "ISSUE_TRACKER";
23
+ /** The provenance of a relation read from the package's own metadata only — not attested. */
24
+ export declare const DEPSDEV_UNVERIFIED_PROVENANCE = "UNVERIFIED_METADATA";
25
+ //# sourceMappingURL=consts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,eAAO,MAAM,gBAAgB,aAAa,CAAA;AAE1C,2BAA2B;AAC3B,eAAO,MAAM,eAAe,yBAAyB,CAAA;AAErD,yDAAyD;AACzD,eAAO,MAAM,cAAc,QAAQ,CAAA;AAEnC,uEAAuE;AACvE,eAAO,MAAM,eAAe,QAAS,CAAA;AAErC,6EAA6E;AAC7E,eAAO,MAAM,eAAe,IAAI,CAAA;AAEhC,6BAA6B;AAC7B,eAAO,MAAM,iBAAiB,QAAkB,CAAA;AAEhD,mEAAmE;AACnE,eAAO,MAAM,iBAAiB,QAAc,CAAA;AAE5C,6BAA6B;AAC7B,eAAO,MAAM,kBAAkB,OAAQ,CAAA;AAEvC,8EAA8E;AAC9E,eAAO,MAAM,kBAAkB,uCAAuC,CAAA;AAEtE,iEAAiE;AACjE,eAAO,MAAM,uBAAuB,gBAAgB,CAAA;AAEpD,6DAA6D;AAC7D,eAAO,MAAM,uBAAuB,kBAAkB,CAAA;AAEtD,6FAA6F;AAC7F,eAAO,MAAM,6BAA6B,wBAAwB,CAAA"}
@@ -0,0 +1,25 @@
1
+ /** The source id the deps.dev adapter reports under (`unavailable` findings). */
2
+ export const DEPSDEV_INSIGHTS = 'deps.dev';
3
+ /** deps.dev's API (v3). */
4
+ export const DEPSDEV_API_URL = 'https://api.deps.dev';
5
+ /** The package system the names belong to by default. */
6
+ export const DEPSDEV_SYSTEM = 'npm';
7
+ /** Milliseconds before one request (headers and body) is abandoned. */
8
+ export const DEPSDEV_TIMEOUT = 10_000;
9
+ /** Retries of a throttled (429) or briefly unavailable (502–504) request. */
10
+ export const DEPSDEV_RETRIES = 3;
11
+ /** The cap of one answer. */
12
+ export const DEPSDEV_MAX_BYTES = 2 * 1024 * 1024;
13
+ /** How long an answer is reused, in ms; `0` disables the cache. */
14
+ export const DEPSDEV_CACHE_TTL = 10 * 60_000;
15
+ /** The most answers kept. */
16
+ export const DEPSDEV_CACHE_SIZE = 5_000;
17
+ /** The `user-agent` every request carries unless the options name another. */
18
+ export const DEPSDEV_USER_AGENT = '@owlmeans/package-insights-depsdev';
19
+ /** deps.dev's relation of a release to its source repository. */
20
+ export const DEPSDEV_SOURCE_RELATION = 'SOURCE_REPO';
21
+ /** deps.dev's relation of a release to its issue tracker. */
22
+ export const DEPSDEV_ISSUES_RELATION = 'ISSUE_TRACKER';
23
+ /** The provenance of a relation read from the package's own metadata only — not attested. */
24
+ export const DEPSDEV_UNVERIFIED_PROVENANCE = 'UNVERIFIED_METADATA';
25
+ //# sourceMappingURL=consts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consts.js","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,MAAM,CAAC,MAAM,gBAAgB,GAAG,UAAU,CAAA;AAE1C,2BAA2B;AAC3B,MAAM,CAAC,MAAM,eAAe,GAAG,sBAAsB,CAAA;AAErD,yDAAyD;AACzD,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,CAAA;AAEnC,uEAAuE;AACvE,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAA;AAErC,6EAA6E;AAC7E,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAA;AAEhC,6BAA6B;AAC7B,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAA;AAEhD,mEAAmE;AACnE,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,GAAG,MAAM,CAAA;AAE5C,6BAA6B;AAC7B,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,CAAA;AAEvC,8EAA8E;AAC9E,MAAM,CAAC,MAAM,kBAAkB,GAAG,oCAAoC,CAAA;AAEtE,iEAAiE;AACjE,MAAM,CAAC,MAAM,uBAAuB,GAAG,aAAa,CAAA;AAEpD,6DAA6D;AAC7D,MAAM,CAAC,MAAM,uBAAuB,GAAG,eAAe,CAAA;AAEtD,6FAA6F;AAC7F,MAAM,CAAC,MAAM,6BAA6B,GAAG,qBAAqB,CAAA"}
@@ -0,0 +1,4 @@
1
+ export type * from './types.js';
2
+ export * from './consts.js';
3
+ export * from './insights.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,YAAY,CAAA;AAE/B,cAAc,aAAa,CAAA;AAE3B,cAAc,eAAe,CAAA"}
package/build/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export * from './consts.js';
2
+ export * from './insights.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,cAAc,aAAa,CAAA;AAE3B,cAAc,eAAe,CAAA"}
@@ -0,0 +1,17 @@
1
+ import type { DepsDevInsights, DepsDevInsightsOptions } from './types.js';
2
+ /**
3
+ * deps.dev (v3) behind the package inspector's `PackageInsights` port, over the injected `fetch`:
4
+ *
5
+ * - `version(name, version)` — `GET /v3/systems/<system>/packages/<name>/versions/<version>`: its
6
+ * publish date, advisory keys, deprecation, licenses, a verified provenance, and the related
7
+ * projects (`SOURCE_REPO` → `source`, `ISSUE_TRACKER` → `issues`; attested unless the relation was
8
+ * read from unverified metadata);
9
+ * - `project(id)` — `GET /v3/projects/<id>`: stars, forks, open issues, license and the OpenSSF
10
+ * Scorecard overall score.
11
+ *
12
+ * Names, versions and ids are encoded whole (`@scope%2Fname`, `github.com%2Fo%2Fr`). A 404 is `null`;
13
+ * any other failure throws `PackageSourceError` (`deps.dev:<version|project>:<subject>:<cause>`).
14
+ * Answers are cached for `cacheTtlMs`.
15
+ */
16
+ export declare const createDepsDevInsights: (options?: DepsDevInsightsOptions) => DepsDevInsights;
17
+ //# sourceMappingURL=insights.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"insights.d.ts","sourceRoot":"","sources":["../src/insights.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAA;AAGzE;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,qBAAqB,aAAa,sBAAsB,KAAQ,eA+G5E,CAAA"}
@@ -0,0 +1,114 @@
1
+ import { createPackageHttp, PackageSourceError } from '@owlmeans/package-inspector';
2
+ import { DEPSDEV_API_URL, DEPSDEV_CACHE_SIZE, DEPSDEV_CACHE_TTL, DEPSDEV_INSIGHTS, DEPSDEV_ISSUES_RELATION, DEPSDEV_MAX_BYTES, DEPSDEV_RETRIES, DEPSDEV_SOURCE_RELATION, DEPSDEV_SYSTEM, DEPSDEV_TIMEOUT, DEPSDEV_UNVERIFIED_PROVENANCE, DEPSDEV_USER_AGENT, } from './consts.js';
3
+ /**
4
+ * deps.dev (v3) behind the package inspector's `PackageInsights` port, over the injected `fetch`:
5
+ *
6
+ * - `version(name, version)` — `GET /v3/systems/<system>/packages/<name>/versions/<version>`: its
7
+ * publish date, advisory keys, deprecation, licenses, a verified provenance, and the related
8
+ * projects (`SOURCE_REPO` → `source`, `ISSUE_TRACKER` → `issues`; attested unless the relation was
9
+ * read from unverified metadata);
10
+ * - `project(id)` — `GET /v3/projects/<id>`: stars, forks, open issues, license and the OpenSSF
11
+ * Scorecard overall score.
12
+ *
13
+ * Names, versions and ids are encoded whole (`@scope%2Fname`, `github.com%2Fo%2Fr`). A 404 is `null`;
14
+ * any other failure throws `PackageSourceError` (`deps.dev:<version|project>:<subject>:<cause>`).
15
+ * Answers are cached for `cacheTtlMs`.
16
+ */
17
+ export const createDepsDevInsights = (options = {}) => {
18
+ const apiUrl = (options.apiUrl ?? DEPSDEV_API_URL).replace(/\/+$/, '');
19
+ const system = options.system ?? DEPSDEV_SYSTEM;
20
+ const cacheTtl = options.cacheTtlMs ?? DEPSDEV_CACHE_TTL;
21
+ const http = createPackageHttp({
22
+ fetch: options.fetch, timeoutMs: options.timeoutMs ?? DEPSDEV_TIMEOUT, userAgent: options.userAgent ?? DEPSDEV_USER_AGENT,
23
+ retries: options.retries ?? DEPSDEV_RETRIES, error: message => new PackageSourceError(message), scope: 'package-insights-depsdev',
24
+ });
25
+ const cache = new Map();
26
+ const remembered = (key) => {
27
+ const entry = cache.get(key);
28
+ return entry != null && Date.now() - entry.at < cacheTtl ? entry.value : undefined;
29
+ };
30
+ const remember = (key, value) => {
31
+ if (cacheTtl <= 0)
32
+ return;
33
+ cache.delete(key);
34
+ cache.set(key, { value, at: Date.now() });
35
+ for (const oldest of cache.keys()) {
36
+ if (cache.size <= DEPSDEV_CACHE_SIZE)
37
+ break;
38
+ cache.delete(oldest);
39
+ }
40
+ };
41
+ /** The document at `path`; `null` for a 404. */
42
+ const read = async (path, what, subject) => {
43
+ const label = `${DEPSDEV_INSIGHTS}:${what}:${subject}`;
44
+ const document = await http.json(`${apiUrl}${path}`, label, DEPSDEV_MAX_BYTES);
45
+ if (document == null) {
46
+ return null;
47
+ }
48
+ if (document.truncated || document.body == null || typeof document.body !== 'object') {
49
+ throw new PackageSourceError(`${label}:${document.truncated ? 'too-large' : 'malformed'}`);
50
+ }
51
+ return document.body;
52
+ };
53
+ const text = (value) => typeof value === 'string' && value.trim() !== '' ? value.trim() : undefined;
54
+ const count = (value) => typeof value === 'number' && Number.isFinite(value) ? value : undefined;
55
+ const kindOf = (relation) => relation === DEPSDEV_SOURCE_RELATION ? 'source' : relation === DEPSDEV_ISSUES_RELATION ? 'issues' : 'other';
56
+ const versionOf = (body) => {
57
+ const publishedAt = text(body.publishedAt);
58
+ const licenses = (body.licenses ?? []).flatMap(license => text(license) != null ? [text(license)] : []);
59
+ const provenance = [...body.slsaProvenances ?? [], ...body.attestations ?? []].some(entry => entry?.verified === true);
60
+ return {
61
+ ...(publishedAt != null ? { publishedAt } : {}),
62
+ advisoryKeys: [...new Set((body.advisoryKeys ?? []).flatMap(entry => text(entry?.id) != null ? [text(entry.id)] : []))],
63
+ projects: (body.relatedProjects ?? []).flatMap((entry) => {
64
+ const id = text(entry?.projectKey?.id);
65
+ return id != null
66
+ ? [{ id, kind: kindOf(entry.relationType), attested: entry.relationProvenance != null && entry.relationProvenance !== DEPSDEV_UNVERIFIED_PROVENANCE }]
67
+ : [];
68
+ }),
69
+ ...(typeof body.isDeprecated === 'boolean' ? { deprecated: body.isDeprecated } : {}),
70
+ ...(licenses.length > 0 ? { licenses } : {}),
71
+ ...(provenance ? { provenance } : {}),
72
+ };
73
+ };
74
+ const projectOf = (body, id) => {
75
+ const stars = count(body.starsCount);
76
+ const forks = count(body.forksCount);
77
+ const openIssues = count(body.openIssuesCount);
78
+ const scorecard = count(body.scorecard?.overallScore);
79
+ const license = text(body.license);
80
+ const description = text(body.description);
81
+ return {
82
+ id: text(body.projectKey?.id) ?? id,
83
+ ...(stars != null ? { stars } : {}), ...(forks != null ? { forks } : {}), ...(openIssues != null ? { openIssues } : {}),
84
+ ...(scorecard != null ? { scorecard } : {}), ...(license != null ? { license } : {}), ...(description != null ? { description } : {}),
85
+ };
86
+ };
87
+ const version = async (rawName, rawVersion) => {
88
+ const name = rawName.trim();
89
+ const wanted = rawVersion.trim();
90
+ const key = `version:${name}@${wanted}`;
91
+ const known = remembered(key);
92
+ if (known !== undefined) {
93
+ return known;
94
+ }
95
+ const body = await read(`/v3/systems/${encodeURIComponent(system)}/packages/${encodeURIComponent(name)}/versions/${encodeURIComponent(wanted)}`, 'version', `${name}@${wanted}`);
96
+ const insight = body != null ? versionOf(body) : null;
97
+ remember(key, insight);
98
+ return insight;
99
+ };
100
+ const project = async (rawId) => {
101
+ const id = rawId.trim();
102
+ const key = `project:${id}`;
103
+ const known = remembered(key);
104
+ if (known !== undefined) {
105
+ return known;
106
+ }
107
+ const body = await read(`/v3/projects/${encodeURIComponent(id)}`, 'project', id);
108
+ const insight = body != null ? projectOf(body, id) : null;
109
+ remember(key, insight);
110
+ return insight;
111
+ };
112
+ return { id: DEPSDEV_INSIGHTS, version, project };
113
+ };
114
+ //# sourceMappingURL=insights.js.map
@@ -0,0 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AAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;QACzD,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;QAEtB,OAAO,OAAO,CAAA;IAChB,CAAC,CAAA;IAED,OAAO,EAAE,EAAE,EAAE,gBAAgB,EAAE,OAAO,EAAE,OAAO,EAAE,CAAA;AACnD,CAAC,CAAA"}
@@ -0,0 +1,21 @@
1
+ import type { PackageFetch, PackageInsights } from '@owlmeans/package-inspector';
2
+ export interface DepsDevInsightsOptions {
3
+ /** Default: the global `fetch`. */
4
+ fetch?: PackageFetch;
5
+ /** Default `DEPSDEV_API_URL`. */
6
+ apiUrl?: string;
7
+ /** The deps.dev system of the names (`npm`, `pypi`, …). Default `DEPSDEV_SYSTEM`. */
8
+ system?: string;
9
+ /** Per request. Default `DEPSDEV_TIMEOUT`. */
10
+ timeoutMs?: number;
11
+ /** Default `DEPSDEV_RETRIES`. */
12
+ retries?: number;
13
+ /** Default `DEPSDEV_USER_AGENT`. */
14
+ userAgent?: string;
15
+ /** Default `DEPSDEV_CACHE_TTL`; `0` disables the cache. */
16
+ cacheTtlMs?: number;
17
+ }
18
+ /** deps.dev behind `@owlmeans/package-inspector`'s `PackageInsights` port (`id` `'deps.dev'`). */
19
+ export interface DepsDevInsights extends PackageInsights {
20
+ }
21
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAEhF,MAAM,WAAW,sBAAsB;IACrC,mCAAmC;IACnC,KAAK,CAAC,EAAE,YAAY,CAAA;IACpB,iCAAiC;IACjC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,qFAAqF;IACrF,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,8CAA8C;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,iCAAiC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,oCAAoC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,2DAA2D;IAC3D,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,kGAAkG;AAClG,MAAM,WAAW,eAAgB,SAAQ,eAAe;CAAG"}
package/build/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,37 @@
1
+ /** The fields of a deps.dev version answer the adapter reads. */
2
+ export interface DepsDevVersion {
3
+ publishedAt?: string;
4
+ isDeprecated?: boolean;
5
+ licenses?: string[];
6
+ advisoryKeys?: Array<{
7
+ id?: string;
8
+ }>;
9
+ relatedProjects?: Array<{
10
+ projectKey?: {
11
+ id?: string;
12
+ };
13
+ relationProvenance?: string;
14
+ relationType?: string;
15
+ }>;
16
+ slsaProvenances?: Array<{
17
+ verified?: boolean;
18
+ }>;
19
+ attestations?: Array<{
20
+ verified?: boolean;
21
+ }>;
22
+ }
23
+ /** The fields of a deps.dev project answer the adapter reads. */
24
+ export interface DepsDevProject {
25
+ projectKey?: {
26
+ id?: string;
27
+ };
28
+ starsCount?: number;
29
+ forksCount?: number;
30
+ openIssuesCount?: number;
31
+ license?: string;
32
+ description?: string;
33
+ scorecard?: {
34
+ overallScore?: number;
35
+ };
36
+ }
37
+ //# sourceMappingURL=types.local.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.local.d.ts","sourceRoot":"","sources":["../src/types.local.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,MAAM,WAAW,cAAc;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;IACnB,YAAY,CAAC,EAAE,KAAK,CAAC;QAAE,EAAE,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IACrC,eAAe,CAAC,EAAE,KAAK,CAAC;QAAE,UAAU,CAAC,EAAE;YAAE,EAAE,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;QAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IAC7G,eAAe,CAAC,EAAE,KAAK,CAAC;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC,CAAA;IAC/C,YAAY,CAAC,EAAE,KAAK,CAAC;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC,CAAA;CAC7C;AAED,iEAAiE;AACjE,MAAM,WAAW,cAAc;IAC7B,UAAU,CAAC,EAAE;QAAE,EAAE,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE;QAAE,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CACtC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.local.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.local.js","sourceRoot":"","sources":["../src/types.local.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,49 @@
1
1
  {
2
2
  "name": "@owlmeans/package-insights-depsdev",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.2.5-beta.0",
4
+ "description": "deps.dev adapter for @owlmeans/package-inspector: a release's publish date, advisory keys and source repository, and the repository's stars and OpenSSF Scorecard.",
5
+ "license": "MIT",
6
+ "homepage": "https://owlmeans.com/docs/",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/owlmeans/connect.git",
10
+ "directory": "packages/package-insights-depsdev"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/owlmeans/connect/issues"
14
+ },
15
+ "author": "Igor Tkachenko <igor.tkachenko@owlmeans.com> (https://owlmeans.com)",
16
+ "type": "module",
17
+ "scripts": {
18
+ "build": "tsc -b",
19
+ "dev": "sleep 71 && nodemon -e ts,tsx,json --watch src --exec \"tsc -p ./tsconfig.json\"",
20
+ "watch": "tsc -b -w --preserveWatchOutput --pretty",
21
+ "test": "bun test ./tests"
22
+ },
23
+ "main": "build/index.js",
24
+ "module": "build/index.js",
25
+ "types": "build/index.d.ts",
26
+ "exports": {
27
+ ".": {
28
+ "import": "./build/index.js",
29
+ "require": "./build/index.js",
30
+ "default": "./build/index.js",
31
+ "module": "./build/index.js",
32
+ "types": "./build/index.d.ts"
33
+ }
34
+ },
35
+ "dependencies": {
36
+ "@owlmeans/package-inspector": "^0.2.5-beta.0"
37
+ },
38
+ "devDependencies": {
39
+ "@owlmeans/dep-config": "^0.2.5-beta.0",
40
+ "@owlmeans/test": "^0.2.5-beta.0",
41
+ "@types/bun": "^1.4.4",
42
+ "@types/node": "^26.6.5",
43
+ "nodemon": "^3.1.14",
44
+ "typescript": "^7.0.2"
45
+ },
46
+ "publishConfig": {
47
+ "access": "public"
48
+ }
49
+ }
package/src/consts.ts ADDED
@@ -0,0 +1,35 @@
1
+ /** The source id the deps.dev adapter reports under (`unavailable` findings). */
2
+ export const DEPSDEV_INSIGHTS = 'deps.dev'
3
+
4
+ /** deps.dev's API (v3). */
5
+ export const DEPSDEV_API_URL = 'https://api.deps.dev'
6
+
7
+ /** The package system the names belong to by default. */
8
+ export const DEPSDEV_SYSTEM = 'npm'
9
+
10
+ /** Milliseconds before one request (headers and body) is abandoned. */
11
+ export const DEPSDEV_TIMEOUT = 10_000
12
+
13
+ /** Retries of a throttled (429) or briefly unavailable (502–504) request. */
14
+ export const DEPSDEV_RETRIES = 3
15
+
16
+ /** The cap of one answer. */
17
+ export const DEPSDEV_MAX_BYTES = 2 * 1024 * 1024
18
+
19
+ /** How long an answer is reused, in ms; `0` disables the cache. */
20
+ export const DEPSDEV_CACHE_TTL = 10 * 60_000
21
+
22
+ /** The most answers kept. */
23
+ export const DEPSDEV_CACHE_SIZE = 5_000
24
+
25
+ /** The `user-agent` every request carries unless the options name another. */
26
+ export const DEPSDEV_USER_AGENT = '@owlmeans/package-insights-depsdev'
27
+
28
+ /** deps.dev's relation of a release to its source repository. */
29
+ export const DEPSDEV_SOURCE_RELATION = 'SOURCE_REPO'
30
+
31
+ /** deps.dev's relation of a release to its issue tracker. */
32
+ export const DEPSDEV_ISSUES_RELATION = 'ISSUE_TRACKER'
33
+
34
+ /** The provenance of a relation read from the package's own metadata only — not attested. */
35
+ export const DEPSDEV_UNVERIFIED_PROVENANCE = 'UNVERIFIED_METADATA'
package/src/index.ts ADDED
@@ -0,0 +1,5 @@
1
+ export type * from './types.js'
2
+
3
+ export * from './consts.js'
4
+
5
+ export * from './insights.js'
@@ -0,0 +1,135 @@
1
+ import { createPackageHttp, PackageSourceError } from '@owlmeans/package-inspector'
2
+ import type { PackageProjectInsight, PackageProjectRef, PackageVersionInsight } from '@owlmeans/package-inspector'
3
+ import {
4
+ DEPSDEV_API_URL, DEPSDEV_CACHE_SIZE, DEPSDEV_CACHE_TTL, DEPSDEV_INSIGHTS, DEPSDEV_ISSUES_RELATION, DEPSDEV_MAX_BYTES, DEPSDEV_RETRIES,
5
+ DEPSDEV_SOURCE_RELATION, DEPSDEV_SYSTEM, DEPSDEV_TIMEOUT, DEPSDEV_UNVERIFIED_PROVENANCE, DEPSDEV_USER_AGENT,
6
+ } from './consts.js'
7
+ import type { DepsDevInsights, DepsDevInsightsOptions } from './types.js'
8
+ import type { DepsDevProject, DepsDevVersion } from './types.local.js'
9
+
10
+ /**
11
+ * deps.dev (v3) behind the package inspector's `PackageInsights` port, over the injected `fetch`:
12
+ *
13
+ * - `version(name, version)` — `GET /v3/systems/<system>/packages/<name>/versions/<version>`: its
14
+ * publish date, advisory keys, deprecation, licenses, a verified provenance, and the related
15
+ * projects (`SOURCE_REPO` → `source`, `ISSUE_TRACKER` → `issues`; attested unless the relation was
16
+ * read from unverified metadata);
17
+ * - `project(id)` — `GET /v3/projects/<id>`: stars, forks, open issues, license and the OpenSSF
18
+ * Scorecard overall score.
19
+ *
20
+ * Names, versions and ids are encoded whole (`@scope%2Fname`, `github.com%2Fo%2Fr`). A 404 is `null`;
21
+ * any other failure throws `PackageSourceError` (`deps.dev:<version|project>:<subject>:<cause>`).
22
+ * Answers are cached for `cacheTtlMs`.
23
+ */
24
+ export const createDepsDevInsights = (options: DepsDevInsightsOptions = {}): DepsDevInsights => {
25
+ const apiUrl = (options.apiUrl ?? DEPSDEV_API_URL).replace(/\/+$/, '')
26
+ const system = options.system ?? DEPSDEV_SYSTEM
27
+ const cacheTtl = options.cacheTtlMs ?? DEPSDEV_CACHE_TTL
28
+ const http = createPackageHttp({
29
+ fetch: options.fetch, timeoutMs: options.timeoutMs ?? DEPSDEV_TIMEOUT, userAgent: options.userAgent ?? DEPSDEV_USER_AGENT,
30
+ retries: options.retries ?? DEPSDEV_RETRIES, error: message => new PackageSourceError(message), scope: 'package-insights-depsdev',
31
+ })
32
+ const cache = new Map<string, { value: unknown, at: number }>()
33
+
34
+ const remembered = <T>(key: string): T | undefined => {
35
+ const entry = cache.get(key)
36
+ return entry != null && Date.now() - entry.at < cacheTtl ? entry.value as T : undefined
37
+ }
38
+
39
+ const remember = (key: string, value: unknown): void => {
40
+ if (cacheTtl <= 0) return
41
+ cache.delete(key)
42
+ cache.set(key, { value, at: Date.now() })
43
+ for (const oldest of cache.keys()) {
44
+ if (cache.size <= DEPSDEV_CACHE_SIZE) break
45
+ cache.delete(oldest)
46
+ }
47
+ }
48
+
49
+ /** The document at `path`; `null` for a 404. */
50
+ const read = async <T>(path: string, what: string, subject: string): Promise<T | null> => {
51
+ const label = `${DEPSDEV_INSIGHTS}:${what}:${subject}`
52
+ const document = await http.json<T>(`${apiUrl}${path}`, label, DEPSDEV_MAX_BYTES)
53
+ if (document == null) {
54
+ return null
55
+ }
56
+ if (document.truncated || document.body == null || typeof document.body !== 'object') {
57
+ throw new PackageSourceError(`${label}:${document.truncated ? 'too-large' : 'malformed'}`)
58
+ }
59
+
60
+ return document.body
61
+ }
62
+
63
+ const text = (value: unknown): string | undefined => typeof value === 'string' && value.trim() !== '' ? value.trim() : undefined
64
+ const count = (value: unknown): number | undefined => typeof value === 'number' && Number.isFinite(value) ? value : undefined
65
+
66
+ const kindOf = (relation: string | undefined): PackageProjectRef['kind'] =>
67
+ relation === DEPSDEV_SOURCE_RELATION ? 'source' : relation === DEPSDEV_ISSUES_RELATION ? 'issues' : 'other'
68
+
69
+ const versionOf = (body: DepsDevVersion): PackageVersionInsight => {
70
+ const publishedAt = text(body.publishedAt)
71
+ const licenses = (body.licenses ?? []).flatMap(license => text(license) != null ? [text(license)!] : [])
72
+ const provenance = [...body.slsaProvenances ?? [], ...body.attestations ?? []].some(entry => entry?.verified === true)
73
+ return {
74
+ ...(publishedAt != null ? { publishedAt } : {}),
75
+ advisoryKeys: [...new Set((body.advisoryKeys ?? []).flatMap(entry => text(entry?.id) != null ? [text(entry.id)!] : []))],
76
+ projects: (body.relatedProjects ?? []).flatMap((entry): PackageProjectRef[] => {
77
+ const id = text(entry?.projectKey?.id)
78
+ return id != null
79
+ ? [{ id, kind: kindOf(entry.relationType), attested: entry.relationProvenance != null && entry.relationProvenance !== DEPSDEV_UNVERIFIED_PROVENANCE }]
80
+ : []
81
+ }),
82
+ ...(typeof body.isDeprecated === 'boolean' ? { deprecated: body.isDeprecated } : {}),
83
+ ...(licenses.length > 0 ? { licenses } : {}),
84
+ ...(provenance ? { provenance } : {}),
85
+ }
86
+ }
87
+
88
+ const projectOf = (body: DepsDevProject, id: string): PackageProjectInsight => {
89
+ const stars = count(body.starsCount)
90
+ const forks = count(body.forksCount)
91
+ const openIssues = count(body.openIssuesCount)
92
+ const scorecard = count(body.scorecard?.overallScore)
93
+ const license = text(body.license)
94
+ const description = text(body.description)
95
+ return {
96
+ id: text(body.projectKey?.id) ?? id,
97
+ ...(stars != null ? { stars } : {}), ...(forks != null ? { forks } : {}), ...(openIssues != null ? { openIssues } : {}),
98
+ ...(scorecard != null ? { scorecard } : {}), ...(license != null ? { license } : {}), ...(description != null ? { description } : {}),
99
+ }
100
+ }
101
+
102
+ const version: DepsDevInsights['version'] = async (rawName, rawVersion) => {
103
+ const name = rawName.trim()
104
+ const wanted = rawVersion.trim()
105
+ const key = `version:${name}@${wanted}`
106
+ const known = remembered<PackageVersionInsight | null>(key)
107
+ if (known !== undefined) {
108
+ return known
109
+ }
110
+ const body = await read<DepsDevVersion>(
111
+ `/v3/systems/${encodeURIComponent(system)}/packages/${encodeURIComponent(name)}/versions/${encodeURIComponent(wanted)}`,
112
+ 'version', `${name}@${wanted}`,
113
+ )
114
+ const insight = body != null ? versionOf(body) : null
115
+ remember(key, insight)
116
+
117
+ return insight
118
+ }
119
+
120
+ const project: DepsDevInsights['project'] = async rawId => {
121
+ const id = rawId.trim()
122
+ const key = `project:${id}`
123
+ const known = remembered<PackageProjectInsight | null>(key)
124
+ if (known !== undefined) {
125
+ return known
126
+ }
127
+ const body = await read<DepsDevProject>(`/v3/projects/${encodeURIComponent(id)}`, 'project', id)
128
+ const insight = body != null ? projectOf(body, id) : null
129
+ remember(key, insight)
130
+
131
+ return insight
132
+ }
133
+
134
+ return { id: DEPSDEV_INSIGHTS, version, project }
135
+ }
@@ -0,0 +1,21 @@
1
+ /** The fields of a deps.dev version answer the adapter reads. */
2
+ export interface DepsDevVersion {
3
+ publishedAt?: string
4
+ isDeprecated?: boolean
5
+ licenses?: string[]
6
+ advisoryKeys?: Array<{ id?: string }>
7
+ relatedProjects?: Array<{ projectKey?: { id?: string }, relationProvenance?: string, relationType?: string }>
8
+ slsaProvenances?: Array<{ verified?: boolean }>
9
+ attestations?: Array<{ verified?: boolean }>
10
+ }
11
+
12
+ /** The fields of a deps.dev project answer the adapter reads. */
13
+ export interface DepsDevProject {
14
+ projectKey?: { id?: string }
15
+ starsCount?: number
16
+ forksCount?: number
17
+ openIssuesCount?: number
18
+ license?: string
19
+ description?: string
20
+ scorecard?: { overallScore?: number }
21
+ }
package/src/types.ts ADDED
@@ -0,0 +1,21 @@
1
+ import type { PackageFetch, PackageInsights } from '@owlmeans/package-inspector'
2
+
3
+ export interface DepsDevInsightsOptions {
4
+ /** Default: the global `fetch`. */
5
+ fetch?: PackageFetch
6
+ /** Default `DEPSDEV_API_URL`. */
7
+ apiUrl?: string
8
+ /** The deps.dev system of the names (`npm`, `pypi`, …). Default `DEPSDEV_SYSTEM`. */
9
+ system?: string
10
+ /** Per request. Default `DEPSDEV_TIMEOUT`. */
11
+ timeoutMs?: number
12
+ /** Default `DEPSDEV_RETRIES`. */
13
+ retries?: number
14
+ /** Default `DEPSDEV_USER_AGENT`. */
15
+ userAgent?: string
16
+ /** Default `DEPSDEV_CACHE_TTL`; `0` disables the cache. */
17
+ cacheTtlMs?: number
18
+ }
19
+
20
+ /** deps.dev behind `@owlmeans/package-inspector`'s `PackageInsights` port (`id` `'deps.dev'`). */
21
+ export interface DepsDevInsights extends PackageInsights {}
@@ -0,0 +1,49 @@
1
+ import { makeGates } from '@owlmeans/test'
2
+ import type { DepsDevInsightsOptions } from '../src/index.js'
3
+ import { PROJECTS, VERSIONS } from './fixtures.js'
4
+
5
+ export const gates = makeGates({ live: ['PACKAGE_INSIGHTS_DEPSDEV_LIVE'] })
6
+
7
+ export interface StandIn {
8
+ options: DepsDevInsightsOptions
9
+ /** Every request served, as its raw (still encoded) path. */
10
+ calls: string[]
11
+ stop: () => void
12
+ }
13
+
14
+ const json = (body: unknown, status = 200): Response =>
15
+ new Response(JSON.stringify(body), { status, headers: { 'content-type': 'application/json' } })
16
+
17
+ /**
18
+ * A real local HTTP server answering like deps.dev v3 from the fixtures — names, versions and ids
19
+ * must arrive encoded as ONE path segment each, as deps.dev requires. `flaky` answers 503.
20
+ */
21
+ export const startStandIn = (): StandIn => {
22
+ const calls: string[] = []
23
+ const server = Bun.serve({
24
+ port: 0,
25
+ fetch: request => {
26
+ const raw = new URL(request.url).pathname
27
+ calls.push(raw)
28
+ const version = /^\/v3\/systems\/([^/]+)\/packages\/([^/]+)\/versions\/([^/]+)$/.exec(raw)
29
+ if (version != null) {
30
+ const [system, name, wanted] = version.slice(1).map(decodeURIComponent)
31
+ if (name === 'flaky') return json({ error: 'unavailable' }, 503)
32
+ const body = VERSIONS[`${system}/${name}@${wanted}`]
33
+ return body != null ? json(body) : json({ code: 5, message: 'version not found' }, 404)
34
+ }
35
+ const project = /^\/v3\/projects\/([^/]+)$/.exec(raw)
36
+ if (project != null) {
37
+ const body = PROJECTS[decodeURIComponent(project[1])]
38
+ return body != null ? json(body) : json({ code: 5, message: 'project not found' }, 404)
39
+ }
40
+ return json({ code: 12, message: 'unknown path' }, 404)
41
+ },
42
+ })
43
+
44
+ return {
45
+ options: { apiUrl: `http://127.0.0.1:${server.port}`, timeoutMs: 2_000, retries: 0 },
46
+ calls,
47
+ stop: () => { void server.stop(true) },
48
+ }
49
+ }
@@ -0,0 +1,47 @@
1
+ /**
2
+ * deps.dev answers the stand-in serves: `xlsx`, `exceljs`, `@modelcontextprotocol/sdk` and the
3
+ * `exceljs` project are the public answers of 2026-11-27 (trimmed); `acme-*` is invented.
4
+ */
5
+
6
+ /** Version answers by `<system>/<name>@<version>`. */
7
+ export const VERSIONS: Record<string, Record<string, unknown>> = {
8
+ 'npm/xlsx@0.18.5': {
9
+ versionKey: { system: 'NPM', name: 'xlsx', version: '0.18.5' }, publishedAt: '2022-03-24T14:23:09Z', isDefault: true, isDeprecated: false,
10
+ deprecatedReason: '', licenses: ['Apache-2.0'], advisoryKeys: [{ id: 'GHSA-4r6h-8v6p-xvw6' }, { id: 'GHSA-5pgg-2g8v-p4x9' }],
11
+ links: [{ label: 'HOMEPAGE', url: 'https://sheetjs.com/' }, { label: 'SOURCE_REPO', url: 'git://github.com/SheetJS/sheetjs.git' }],
12
+ slsaProvenances: [], attestations: [], registries: ['https://registry.npmjs.org/'],
13
+ relatedProjects: [
14
+ { projectKey: { id: 'github.com/sheetjs/sheetjs' }, relationProvenance: 'UNVERIFIED_METADATA', relationType: 'ISSUE_TRACKER' },
15
+ { projectKey: { id: 'github.com/sheetjs/sheetjs' }, relationProvenance: 'UNVERIFIED_METADATA', relationType: 'SOURCE_REPO' },
16
+ ],
17
+ },
18
+ 'npm/exceljs@4.4.0': {
19
+ versionKey: { system: 'NPM', name: 'exceljs', version: '4.4.0' }, publishedAt: '2023-10-19T19:49:55Z', isDefault: true, isDeprecated: false,
20
+ licenses: ['MIT'], advisoryKeys: [], slsaProvenances: [], attestations: [],
21
+ relatedProjects: [
22
+ { projectKey: { id: 'github.com/exceljs/exceljs' }, relationProvenance: 'UNVERIFIED_METADATA', relationType: 'ISSUE_TRACKER' },
23
+ { projectKey: { id: 'github.com/exceljs/exceljs' }, relationProvenance: 'UNVERIFIED_METADATA', relationType: 'SOURCE_REPO' },
24
+ ],
25
+ },
26
+ 'npm/@modelcontextprotocol/sdk@1.20.0': {
27
+ versionKey: { system: 'NPM', name: '@modelcontextprotocol/sdk', version: '1.20.0' }, publishedAt: '2025-10-09T21:00:24Z', isDefault: false,
28
+ isDeprecated: false, licenses: ['MIT'],
29
+ advisoryKeys: [
30
+ { id: 'GHSA-345p-7cg4-v4c7' }, { id: 'GHSA-46jr-4wx8-v453' }, { id: 'GHSA-6prh-2h8m-c8cw' }, { id: 'GHSA-6qxp-vccf-f47h' },
31
+ { id: 'GHSA-8r9q-7v3j-jr4g' }, { id: 'GHSA-f897-62hf-6gxq' }, { id: 'GHSA-rvq5-wwqv-78pq' }, { id: 'GHSA-w48q-cv73-mx4w' },
32
+ ],
33
+ slsaProvenances: [{ sourceRepository: 'https://github.com/modelcontextprotocol/typescript-sdk', verified: true }],
34
+ attestations: [{ type: 'https://slsa.dev/provenance/v1', verified: true }],
35
+ relatedProjects: [{ projectKey: { id: 'github.com/modelcontextprotocol/typescript-sdk' }, relationProvenance: 'SLSA_ATTESTATION', relationType: 'SOURCE_REPO' }],
36
+ },
37
+ 'npm/acme-deprecated@1.0.0': { publishedAt: '2024-01-01T00:00:00Z', isDeprecated: true, advisoryKeys: [{ id: 'GHSA-x' }, { id: 'GHSA-x' }, {}], relatedProjects: [{}] },
38
+ }
39
+
40
+ /** Project answers by id. */
41
+ export const PROJECTS: Record<string, Record<string, unknown>> = {
42
+ 'github.com/exceljs/exceljs': {
43
+ projectKey: { id: 'github.com/exceljs/exceljs' }, openIssuesCount: 830, starsCount: 15517, forksCount: 2076, license: 'MIT',
44
+ description: 'Excel Workbook Manager', homepage: '',
45
+ scorecard: { date: '2026-08-24T00:00:00Z', repository: { name: 'github.com/exceljs/exceljs' }, overallScore: 4, checks: [] },
46
+ },
47
+ }
@@ -0,0 +1,69 @@
1
+ import { afterAll, describe, expect, test } from 'bun:test'
2
+ import { PackageSourceError } from '@owlmeans/package-inspector'
3
+ import { createDepsDevInsights, DEPSDEV_INSIGHTS } from '../src/index.js'
4
+ import type { DepsDevInsightsOptions } from '../src/index.js'
5
+ import { startStandIn } from './context.js'
6
+
7
+ const standIn = startStandIn()
8
+ afterAll(() => standIn.stop())
9
+
10
+ const insightsOf = (extra: DepsDevInsightsOptions = {}) => createDepsDevInsights({ ...standIn.options, ...extra })
11
+ const callsAfter = (mark: number): string[] => standIn.calls.slice(mark)
12
+
13
+ describe('@owlmeans/package-insights-depsdev — version', () => {
14
+ test('a release\'s date, advisory keys, licenses and related projects, normalised', async () => {
15
+ const insights = insightsOf()
16
+
17
+ expect(insights.id).toBe(DEPSDEV_INSIGHTS)
18
+ expect(await insights.version('xlsx', '0.18.5')).toEqual({
19
+ publishedAt: '2022-03-24T14:23:09Z', advisoryKeys: ['GHSA-4r6h-8v6p-xvw6', 'GHSA-5pgg-2g8v-p4x9'], deprecated: false, licenses: ['Apache-2.0'],
20
+ projects: [
21
+ { id: 'github.com/sheetjs/sheetjs', kind: 'issues', attested: false }, { id: 'github.com/sheetjs/sheetjs', kind: 'source', attested: false },
22
+ ],
23
+ })
24
+ expect(await insights.version('acme-deprecated', '1.0.0')).toEqual({
25
+ publishedAt: '2024-01-01T00:00:00Z', advisoryKeys: ['GHSA-x'], projects: [], deprecated: true,
26
+ })
27
+ })
28
+
29
+ test('a scoped name is encoded as one segment; a verified attestation is provenance and an attested relation', async () => {
30
+ const mark = standIn.calls.length
31
+ const sdk = await insightsOf().version('@modelcontextprotocol/sdk', '1.20.0')
32
+
33
+ expect(sdk?.advisoryKeys).toHaveLength(8)
34
+ expect(sdk?.provenance).toBe(true)
35
+ expect(sdk?.projects).toEqual([{ id: 'github.com/modelcontextprotocol/typescript-sdk', kind: 'source', attested: true }])
36
+ expect(callsAfter(mark)).toEqual(['/v3/systems/npm/packages/%40modelcontextprotocol%2Fsdk/versions/1.20.0'])
37
+ })
38
+
39
+ test('an unknown release is null; answers are cached', async () => {
40
+ const insights = insightsOf()
41
+ const mark = standIn.calls.length
42
+
43
+ expect(await insights.version('exceljs', '9.9.9')).toBeNull()
44
+ expect(await insights.version('exceljs', '9.9.9')).toBeNull()
45
+ expect((await insights.version('exceljs', '4.4.0'))?.publishedAt).toBe('2023-10-19T19:49:55Z')
46
+ expect((await insights.version('exceljs', '4.4.0'))?.publishedAt).toBe('2023-10-19T19:49:55Z')
47
+ expect(callsAfter(mark)).toEqual(['/v3/systems/npm/packages/exceljs/versions/9.9.9', '/v3/systems/npm/packages/exceljs/versions/4.4.0'])
48
+ expect(await insightsOf({ system: 'pypi' }).version('exceljs', '4.4.0')).toBeNull()
49
+ })
50
+ })
51
+
52
+ describe('@owlmeans/package-insights-depsdev — project', () => {
53
+ test('stars, forks, open issues, license and the Scorecard; the id encoded whole; unknown is null', async () => {
54
+ const mark = standIn.calls.length
55
+
56
+ expect(await insightsOf().project('github.com/exceljs/exceljs')).toEqual({
57
+ id: 'github.com/exceljs/exceljs', stars: 15517, forks: 2076, openIssues: 830, scorecard: 4, license: 'MIT', description: 'Excel Workbook Manager',
58
+ })
59
+ expect(callsAfter(mark)).toEqual(['/v3/projects/github.com%2Fexceljs%2Fexceljs'])
60
+ expect(await insightsOf().project('github.com/acme/none')).toBeNull()
61
+ })
62
+
63
+ test('an outage or an unreachable host is a PackageSourceError naming the cause', async () => {
64
+ const outage = await insightsOf().version('flaky', '1.0.0').catch((e: unknown) => e)
65
+ expect([outage instanceof PackageSourceError, (outage as Error).message]).toEqual([true, 'package-inspector:source:deps.dev:version:flaky@1.0.0:503'])
66
+ const unreachable = await insightsOf({ apiUrl: 'http://127.0.0.1:9' }).project('github.com/a/b').catch((e: unknown) => e)
67
+ expect((unreachable as Error).message).toBe('package-inspector:source:deps.dev:project:github.com/a/b:unreachable')
68
+ })
69
+ })
@@ -0,0 +1,27 @@
1
+ import { describe, expect, test } from 'bun:test'
2
+ import { isSkip } from '@owlmeans/test'
3
+ import { createDepsDevInsights } from '../src/index.js'
4
+ import { gates } from './context.js'
5
+
6
+ const gate = gates.live
7
+ const it = isSkip(gate) ? test.skip : test
8
+ const skipped = isSkip(gate) ? ` (skipped: ${gate.reason})` : ''
9
+
10
+ /** The public deps.dev API — `PACKAGE_INSIGHTS_DEPSDEV_LIVE=1`. Read-only. */
11
+ describe(`@owlmeans/package-insights-depsdev — live deps.dev${skipped}`, () => {
12
+ it('exceljs@4.4.0: its date and source repository, the repository with stars and a Scorecard', async () => {
13
+ const insights = createDepsDevInsights()
14
+ const release = await insights.version('exceljs', '4.4.0')
15
+ expect(release?.publishedAt).toBe('2023-10-19T19:49:55Z')
16
+ const source = release?.projects.find(entry => entry.kind === 'source')
17
+ expect(source?.id).toBe('github.com/exceljs/exceljs')
18
+ const project = await insights.project(source!.id)
19
+ expect(project?.stars).toBeGreaterThan(1_000)
20
+ expect(typeof project?.scorecard).toBe('number')
21
+ }, 60_000)
22
+
23
+ it('@modelcontextprotocol/sdk@1.20.0 links eight advisories', async () => {
24
+ const release = await createDepsDevInsights().version('@modelcontextprotocol/sdk', '1.20.0')
25
+ expect(release?.advisoryKeys.length).toBeGreaterThanOrEqual(8)
26
+ }, 60_000)
27
+ })
@@ -0,0 +1,12 @@
1
+ {
2
+ "extends": [
3
+ "@owlmeans/dep-config/tsconfig.base.json",
4
+ "@owlmeans/dep-config/tsconfig.node.json"
5
+ ],
6
+ "compilerOptions": {
7
+ "types": ["bun"],
8
+ "rootDir": "../",
9
+ "noEmit": true
10
+ },
11
+ "include": ["./**/*", "../src/**/*"]
12
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,16 @@
1
+ {
2
+ "extends": [
3
+ "@owlmeans/dep-config/tsconfig.base.json",
4
+ "@owlmeans/dep-config/tsconfig.node.json"
5
+ ],
6
+ "compilerOptions": {
7
+ "rootDir": "./src/",
8
+ "outDir": "./build/"
9
+ },
10
+ "exclude": [
11
+ "./dist/**/*",
12
+ "./build/**/*",
13
+ "./tests/**/*",
14
+ "./*.ts"
15
+ ]
16
+ }