@preventive/triage 1.0.0-alpha.66 → 1.0.0-alpha.68
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/common/bundle-imports.js +20 -0
- package/common/bundle-metadata.js +1 -1
- package/common/bundle-reasons.d.ts +4 -0
- package/common/bundle-reasons.js +38 -1
- package/common/bundle-sources.d.ts +1 -0
- package/common/bundle-sources.js +22 -0
- package/common/managed/npm-packages.js +3 -3
- package/common/managed/routes.js +37 -18
- package/common/managed/stasis-config.ts +7 -0
- package/out/activity.js +4 -4
- package/out/{chunk-J2FWBXFV.js → chunk-2F3CYNPZ.js} +1 -1
- package/out/chunk-2HGKTQ5Q.js +52 -0
- package/out/chunk-4RS3NDOG.js +1 -0
- package/out/chunk-CGRIZ5M5.js +1 -0
- package/out/{chunk-Z6VEV2QL.js → chunk-D37M7J4B.js} +1 -1
- package/out/chunk-GZ46SSTF.js +1 -0
- package/out/{chunk-IZ6MYRYB.js → chunk-HETCVNO4.js} +1 -1
- package/out/chunk-MPXVKVPF.js +3 -0
- package/out/{chunk-24AKGEH3.js → chunk-NB4JBTKK.js} +1 -1
- package/out/{chunk-OVGR4D3M.js → chunk-OAWY4T6R.js} +1 -1
- package/out/chunk-QPGM3DTI.js +42 -0
- package/out/chunk-SCN2TBP2.js +247 -0
- package/out/chunk-VG5RH6KN.js +2 -0
- package/out/chunk-WFDXHPT2.js +12 -0
- package/out/client-managed-import.js +2 -2
- package/out/client-managed.js +19 -19
- package/out/compare.js +12 -12
- package/out/dialogs.js +38 -38
- package/out/graph.js +8 -8
- package/out/index.html +9 -9
- package/out/scan.js +2 -2
- package/out/view.css +1 -1
- package/out/view.js +15 -15
- package/package.json +11 -8
- package/server-managed/activity.ts +21 -12
- package/server-managed/bundle-build-diagnostics.d.ts +1 -1
- package/server-managed/bundle-build-worker.js +140 -19
- package/server-managed/bundle-build.ts +102 -21
- package/server-managed/bundle-cache.ts +28 -6
- package/server-managed/bundle-dependency-reviews.ts +38 -22
- package/server-managed/commit-lockfiles.ts +2 -1
- package/server-managed/db-neon.ts +5 -2
- package/server-managed/dependency-review-comments.ts +38 -16
- package/server-managed/dependency-reviews.ts +17 -14
- package/server-managed/http.ts +178 -70
- package/server-managed/locked-packages.ts +34 -14
- package/server-managed/lockfile-scope.ts +10 -1
- package/server-managed/npm-kept.ts +10 -0
- package/server-managed/npm-patch.ts +188 -53
- package/server-managed/public-workspace.ts +3 -2
- package/server-managed/pull-dependencies.ts +58 -37
- package/server-managed/pull-dependency-reviews.ts +35 -22
- package/server-managed/report-sources.ts +6 -3
- package/server-managed/repository-dependency-reviews.ts +4 -2
- package/server-managed/repository-issues.ts +14 -11
- package/server-managed/stasis-dependencies.ts +170 -0
- package/out/chunk-65PLAG3I.js +0 -12
- package/out/chunk-DCBXCBLL.js +0 -52
- package/out/chunk-F3UI65ZI.js +0 -42
- package/out/chunk-FAG6E5RC.js +0 -3
- package/out/chunk-OBZWBTZL.js +0 -247
- package/out/chunk-PTFQKLKO.js +0 -1
- package/out/chunk-QVKFY4FA.js +0 -1
- package/out/chunk-SYXT3SFP.js +0 -2
- package/out/chunk-WL3SPQB4.js +0 -1
- /package/out/{chunk-WCPJDAYA.js → chunk-D6NVKGGG.js} +0 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { bundleSourcemapImports } from './bundle-sourcemap.js'
|
|
2
|
+
|
|
3
|
+
// Include every recorded platform/condition variant; a Metro resolution can
|
|
4
|
+
// be a platform -> file map instead of a single resolved path. A sourcemap
|
|
5
|
+
// records no imports: its edges are what bundle-sourcemap.js reads of it.
|
|
6
|
+
export function bundleImportsAsMap(details) {
|
|
7
|
+
if (details?.kind === 'sourcemap') return bundleSourcemapImports(details)
|
|
8
|
+
const result = new Map()
|
|
9
|
+
if (details?.kind !== 'stasis' || !details.bundle) return result
|
|
10
|
+
for (const byParent of details.bundle.imports.values()) {
|
|
11
|
+
for (const [parent, specMap] of byParent) {
|
|
12
|
+
if (!result.has(parent)) result.set(parent, new Set())
|
|
13
|
+
for (const resolved of specMap.values()) {
|
|
14
|
+
const targets = typeof resolved === 'string' ? [resolved] : resolved instanceof Map ? resolved.values() : []
|
|
15
|
+
for (const target of targets) if (typeof target === 'string') result.get(parent).add(target)
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return result
|
|
20
|
+
}
|
|
@@ -210,7 +210,7 @@ export function parseBundleMetadata(data, integrity) {
|
|
|
210
210
|
}
|
|
211
211
|
|
|
212
212
|
function parseSourcemapEdges(rows, files) {
|
|
213
|
-
if (!Array.isArray(rows)) throw new
|
|
213
|
+
if (!Array.isArray(rows)) throw new TypeError('Invalid sourcemap edges')
|
|
214
214
|
return rows.map((row) => {
|
|
215
215
|
if (!Array.isArray(row) || ![2, 3].includes(row.length) || row[0] === row[1] || (row.length === 3 && typeof row[2] !== 'string')
|
|
216
216
|
|| row.slice(0, 2).some((i) => !Number.isSafeInteger(i) || i < 0 || i >= files.length)) throw new Error('Invalid sourcemap edges')
|
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
import type { BundleDetails } from './bundle-metadata.js'
|
|
2
2
|
export function bundleReasons(details: BundleDetails, sourcePaths?: Iterable<string>): Map<string, Set<string>>
|
|
3
|
+
export interface BundleScopes { ids: string[]; has(id: unknown): boolean; files(id: string): Set<string> | null }
|
|
4
|
+
export function bundleScopes(details: BundleDetails, sourcePaths?: Iterable<string>): BundleScopes
|
|
5
|
+
export function scopeLabel(id: string): string
|
|
6
|
+
export function scopeOptions(scopes: BundleScopes): { id: string; label: string }[]
|
package/common/bundle-reasons.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { bundleFileSizes } from './bundle-sources.js'
|
|
2
|
+
import { bundleImportsAsMap } from './bundle-imports.js'
|
|
3
|
+
|
|
4
|
+
const sizedPaths = (details) => [...bundleFileSizes(details)].filter(([, size]) => size != null).map(([path]) => path)
|
|
2
5
|
|
|
3
6
|
// Reason metadata attributes files to consumers (run, build plugins, etc.).
|
|
4
7
|
// It is informational and can be absent on older/single-consumer bundles.
|
|
@@ -6,7 +9,7 @@ export function bundleReasons(details, sourcePaths) {
|
|
|
6
9
|
const reasons = new Map()
|
|
7
10
|
const raw = details?.kind === 'stasis' ? details.bundle?.reason : null
|
|
8
11
|
if (!raw || typeof raw !== 'object' || Array.isArray(raw)) return reasons
|
|
9
|
-
const paths = new Set(sourcePaths ??
|
|
12
|
+
const paths = new Set(sourcePaths ?? sizedPaths(details))
|
|
10
13
|
for (const [reason, files] of Object.entries(raw).toSorted(([a], [b]) => a.localeCompare(b))) {
|
|
11
14
|
if (!reason || !Array.isArray(files)) continue
|
|
12
15
|
const present = new Set(files.filter((file) => typeof file === 'string' && paths.has(file)))
|
|
@@ -19,3 +22,37 @@ export function bundleReasons(details, sourcePaths) {
|
|
|
19
22
|
return reasons
|
|
20
23
|
}
|
|
21
24
|
|
|
25
|
+
// What a bundle's views filter by, each by its id: a reason (`reason:<name>`),
|
|
26
|
+
// or one of its entry points instead (`entry:<path>`), by the files it reaches
|
|
27
|
+
// through the recorded imports. Entry points are offered only where some
|
|
28
|
+
// reason records more than one of them, a bundle recording no reasons
|
|
29
|
+
// counting as one: with one each, a reason's files already are its entry
|
|
30
|
+
// point's.
|
|
31
|
+
export function bundleScopes(details, sourcePaths) {
|
|
32
|
+
const given = sourcePaths && [...sourcePaths]
|
|
33
|
+
const reasons = bundleReasons(details, given)
|
|
34
|
+
const recorded = details?.kind === 'stasis' ? [...details.bundle?.entries ?? []] : []
|
|
35
|
+
const paths = new Set(recorded.length > 1 ? given ?? sizedPaths(details) : [])
|
|
36
|
+
const entries = new Set(recorded.filter((entry) => paths.has(entry)))
|
|
37
|
+
const lists = Object.values(details?.bundle?.reason ?? {}).filter(Array.isArray)
|
|
38
|
+
const several = (files) => new Set(files.filter((file) => entries.has(file))).size > 1
|
|
39
|
+
if (entries.size < 2 || (lists.length > 0 && !lists.some(several))) entries.clear()
|
|
40
|
+
const ids = [...[...reasons.keys()].map((reason) => `reason:${reason}`), ...[...entries].toSorted().map((entry) => `entry:${entry}`)]
|
|
41
|
+
return {
|
|
42
|
+
ids,
|
|
43
|
+
has: (id) => ids.includes(id),
|
|
44
|
+
// A scope's files; null, for every file, for an id that is none of them.
|
|
45
|
+
files(id) {
|
|
46
|
+
if (!ids.includes(id)) return null
|
|
47
|
+
if (id.startsWith('reason:')) return reasons.get(scopeLabel(id))
|
|
48
|
+
const imports = bundleImportsAsMap(details), reached = new Set([scopeLabel(id)])
|
|
49
|
+
// A Set is walked through what is added to it on the way.
|
|
50
|
+
for (const file of reached) for (const target of imports.get(file) ?? []) reached.add(target)
|
|
51
|
+
return new Set([...reached].filter((file) => paths.has(file)))
|
|
52
|
+
},
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// A scope's name as shown: its reason's, or its entry point's path.
|
|
57
|
+
export const scopeLabel = (id) => id.slice(id.indexOf(':') + 1)
|
|
58
|
+
export const scopeOptions = (scopes) => scopes.ids.map((id) => ({ id, label: scopeLabel(id) }))
|
|
@@ -4,4 +4,5 @@ export function bundleSourceLines(content: string): number
|
|
|
4
4
|
export function bundleSourceOrder(sources: Map<string, string>): { paths: string[]; numbers: Map<string, number> }
|
|
5
5
|
export function bundleFilesAsMap(details: BundleDetails): Map<string, string | { format: 'base64'; data: string }>
|
|
6
6
|
export function bundlePackageDirs(details: BundleDetails): Map<string, string> | null
|
|
7
|
+
export function bundlePackageRepos(details: BundleDetails, dirs?: ReadonlySet<string> | null): Map<string, { github: string; directory?: string; commit: string }>
|
|
7
8
|
export function bundlePackageVersions(details: BundleDetails, paths?: Iterable<string> | null, keyOf?: (dir: string, info: { name: string; version: string }) => string): Map<string, Set<string>>
|
package/common/bundle-sources.js
CHANGED
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
// a new bundle kind or field handled here is visible to both.
|
|
28
28
|
|
|
29
29
|
import { Bundle } from '@exodus/stasis-core/bundle'
|
|
30
|
+
import { bundleCommitHash } from './bundle-commit.js'
|
|
30
31
|
import { sourcemapEntries } from './bundle-sourcemap.js'
|
|
31
32
|
import { utf8ByteLength } from './utf8.js'
|
|
32
33
|
|
|
@@ -298,6 +299,27 @@ export function bundlePackageDirs(details) {
|
|
|
298
299
|
return map
|
|
299
300
|
}
|
|
300
301
|
|
|
302
|
+
// The repository and commit each package in a (stasis) bundle records
|
|
303
|
+
// for itself, by its module directory (bundlePackageDirs's values): what
|
|
304
|
+
// Stasis stamps on a module from its package.json `repository`, at its
|
|
305
|
+
// `gitHead`. Only modules recording both a GitHub repository and a full
|
|
306
|
+
// commit, and never the root module, whose repository is the bundle's.
|
|
307
|
+
// `dirs`, when given, limits it to those directories. Empty for anything
|
|
308
|
+
// else, sourcemaps and v0 bundles among them.
|
|
309
|
+
export function bundlePackageRepos(details, dirs = null) {
|
|
310
|
+
const repos = new Map()
|
|
311
|
+
if (details?.kind !== 'stasis' || !details.bundle?.modules) return repos
|
|
312
|
+
for (const [dir, info] of details.bundle.modules) {
|
|
313
|
+
if (dir === '.' || (dirs && !dirs.has(dir))) continue
|
|
314
|
+
const github = info?.repo?.github
|
|
315
|
+
const commit = bundleCommitHash(info?.repo?.commit)
|
|
316
|
+
if (typeof github !== 'string' || github === '' || !commit) continue
|
|
317
|
+
const directory = typeof info.repo.directory === 'string' ? info.repo.directory : ''
|
|
318
|
+
repos.set(dir, { github, ...(directory ? { directory } : {}), commit })
|
|
319
|
+
}
|
|
320
|
+
return repos
|
|
321
|
+
}
|
|
322
|
+
|
|
301
323
|
// Map each named npm dependency a (stasis) bundle carries to the set of
|
|
302
324
|
// concrete versions present for it: `Map<name, Set<version>>`. Only
|
|
303
325
|
// `node_modules/...` modules that carry both a name and a non-empty
|
|
@@ -10,9 +10,9 @@ const PACKAGE_SPEC = /^(?=.{1,256}$)[\dA-Za-z][\w.+-]*$/u
|
|
|
10
10
|
// npm's rule for a scope: lowercase, and not starting with `.` or `_`.
|
|
11
11
|
const SCOPE = /^@[\da-z~-][\w.~-]*$/u
|
|
12
12
|
export const MAX_TEAM_NPM_SCOPES = 100
|
|
13
|
-
// A pnpm patch's hash as a lockfile
|
|
14
|
-
//
|
|
15
|
-
const PATCH_HASH = /^
|
|
13
|
+
// A pnpm patch's hash as a lockfile of pnpm 10 or later names it, by which
|
|
14
|
+
// its reviews read it: a sha256 in hex. One pnpm 9 names by an md5 is none.
|
|
15
|
+
const PATCH_HASH = /^[\da-f]{64}$/u
|
|
16
16
|
|
|
17
17
|
export function isNpmPackageName(value) {
|
|
18
18
|
return typeof value === 'string' && PACKAGE_NAME.test(value)
|
package/common/managed/routes.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Managed client pages only. API paths and E2E share hashes are not routes.
|
|
2
2
|
import { BUNDLE_TABS } from '../bundle-tabs.js'
|
|
3
3
|
import { MAX_FINDING_ID_LENGTH, isLinkableFindingId } from '../finding-id.js'
|
|
4
|
+
import { isGithubRepoName } from '../github-pr.ts'
|
|
4
5
|
import { isNpmPackageName, isNpmPackageSpec, isPatchHash, isPatchPath } from './npm-packages.js'
|
|
5
6
|
import { filtersOf, filtersQuery } from './team-filters.js'
|
|
6
7
|
|
|
@@ -101,11 +102,16 @@ export function managedRoutePath(route) {
|
|
|
101
102
|
// its mode past the Overview: `/compare/<version>/code` or `/diff`. Review
|
|
102
103
|
// names the version reviewed against, and, of a version as a pnpm patch
|
|
103
104
|
// changes it, the patch (`patch`): its hash, and where it is read, a
|
|
104
|
-
// repository by its id,
|
|
105
|
-
//
|
|
105
|
+
// repository by its id, or by its name (`owner/name`) in its place, a commit
|
|
106
|
+
// and its file's path there, or none, the patch looked for there,
|
|
107
|
+
// `?patch=<hash>&repo=<repo id or name>&commit=<commit>&path=<path>`, or by
|
|
108
|
+
// its hash alone, which only one kept answers (`?patch=<hash>`); and,
|
|
109
|
+
// against a version as a patch changes it, that patch by its hash alone
|
|
110
|
+
// (`basePatch`, `&basePatch=<hash>`).
|
|
106
111
|
export const NPM_TABS = new Set(['overview', 'code', 'search', 'compare', 'review', 'treemap'])
|
|
107
112
|
// A patch as the server reads one (server-managed/npm-patch.ts requestedPatch).
|
|
108
|
-
const isPatch = patch => isPatchHash(patch?.hash) &&
|
|
113
|
+
const isPatch = patch => isPatchHash(patch?.hash) && (patch.repoId == null ? patch.commit == null && patch.path == null
|
|
114
|
+
: (isRepoId(patch.repoId) || typeof patch.repoId === 'string' && isGithubRepoName(patch.repoId)) && COMMIT.test(patch.commit ?? '') && (patch.path == null || isPatchPath(patch.path)))
|
|
109
115
|
function npmPackagePath(route) {
|
|
110
116
|
if (route.packageName == null) return '/npm'
|
|
111
117
|
const tab = route.bundleTab ?? 'overview'
|
|
@@ -113,11 +119,12 @@ function npmPackagePath(route) {
|
|
|
113
119
|
|| (route.compareSpec != null && !isNpmPackageSpec(route.compareSpec))) return null
|
|
114
120
|
if (tab === 'review') {
|
|
115
121
|
if (route.reviewPackage != null && !isNpmPackageName(route.reviewPackage) || route.reviewSpec != null && !isNpmPackageSpec(route.reviewSpec)
|
|
116
|
-
|| route.patch != null && !isPatch(route.patch)) return null
|
|
122
|
+
|| route.patch != null && !isPatch(route.patch) || route.basePatch != null && (!isPatchHash(route.basePatch) || route.reviewPackage == null)) return null
|
|
117
123
|
const base = route.reviewPackage == null ? '' : `/${route.reviewPackage}${route.reviewSpec == null ? '' : `@${route.reviewSpec}`}`
|
|
118
|
-
const patch = route
|
|
119
|
-
|
|
120
|
-
|
|
124
|
+
const { patch } = route
|
|
125
|
+
const query = [...patch == null ? [] : [`patch=${patch.hash}`], ...patch?.repoId == null ? [] : [`repo=${patch.repoId}&commit=${patch.commit}`],
|
|
126
|
+
...patch?.path == null ? [] : [`path=${patch.path.split('/').map(encodeURIComponent).join('/')}`], ...route.basePatch == null ? [] : [`basePatch=${route.basePatch}`]].join('&')
|
|
127
|
+
return `/npm/${route.packageName}${route.packageSpec == null ? '' : `@${route.packageSpec}`}/review${base}${query ? `?${query}` : ''}`
|
|
121
128
|
}
|
|
122
129
|
const file = tab === 'code' && isLineNumber(route.file) ? `/${route.file}` : ''
|
|
123
130
|
const lines = file && isLineNumber(route.line)
|
|
@@ -133,11 +140,14 @@ function parseNpmRoute(path, hash, search) {
|
|
|
133
140
|
|| review[3] != null && !isNpmPackageName(review[3]) || review[4] != null && !isNpmPackageSpec(review[4])) return null
|
|
134
141
|
// The full dependency form is canonical; a bare version is a shortcut.
|
|
135
142
|
const versionOnly = review[3] && /^\d+\.\d+\.\d+(?:[-+].*)?$/u.test(review[3]) && review[4] == null
|
|
136
|
-
const
|
|
137
|
-
? {
|
|
138
|
-
|
|
143
|
+
const at = ['repo', 'commit', 'path'].some(key => search.has(key))
|
|
144
|
+
? { repoId: /^[1-9]\d*$/u.test(search.get('repo') ?? '') ? Number(search.get('repo')) : search.get('repo'), commit: search.get('commit') } : {}
|
|
145
|
+
const patch = search.has('patch') ? { hash: search.get('patch'), ...at, ...search.has('path') ? { path: search.get('path') } : {} } : null
|
|
146
|
+
const basePatch = search.get('basePatch')
|
|
147
|
+
if (patch && !isPatch(patch) || basePatch !== null && (!isPatchHash(basePatch) || !review[3])) return null
|
|
139
148
|
return { view: 'npm', packageName: review[1], packageSpec: review[2] ?? null, bundleTab: 'review',
|
|
140
|
-
...(review[3] ? { reviewPackage: versionOnly ? review[1] : review[3], reviewSpec: versionOnly ? review[3] : review[4] ?? null } : {}), ...(patch ? { patch } : {})
|
|
149
|
+
...(review[3] ? { reviewPackage: versionOnly ? review[1] : review[3], reviewSpec: versionOnly ? review[3] : review[4] ?? null } : {}), ...(patch ? { patch } : {}),
|
|
150
|
+
...(basePatch ? { basePatch } : {}) }
|
|
141
151
|
}
|
|
142
152
|
const match = /^\/npm(?:\/((?:@[^/@]+\/)?[^/@]+)(?:@([^/]+))?(?:\/(code|search|compare|treemap)(?:\/([^/]+)(?:\/([a-z]+))?)?)?)?$/u.exec(path)
|
|
143
153
|
if (!match) return undefined
|
|
@@ -319,13 +329,19 @@ export function resolveManagedRoute(route, teams, adminBundles = []) {
|
|
|
319
329
|
if (!['findings', 'files'].includes(route.view)) return route
|
|
320
330
|
const { teamSlug, reportSlug, ...rest } = route
|
|
321
331
|
const matches = teams.filter(team => team.slug === teamSlug)
|
|
322
|
-
|
|
323
|
-
const
|
|
332
|
+
const team = teamSlug && matches.length === 1 ? matches[0] : null
|
|
333
|
+
const ids = new Set(teams.flatMap(entry => entry.reports ?? []).filter(report => report.slug === reportSlug).map(report => report.id))
|
|
334
|
+
const reportId = reportSlug != null && ids.size === 1 ? [...ids][0] : null
|
|
335
|
+
// A finding's link has to name its finding alone. Its team and report are
|
|
336
|
+
// where it was copied, and its reader may hold the finding elsewhere: each
|
|
337
|
+
// resolves where its slug names one alone, the report in any team, and
|
|
338
|
+
// else to null, for the finding's lookup to prefer
|
|
339
|
+
// (ui/view/managed-finding-link.js). `teamOnly` tells a link to a team's
|
|
340
|
+
// own findings from one whose report resolved to none.
|
|
341
|
+
if (rest.finding) return { ...rest, teamId: team?.id ?? null, reportId, teamOnly: reportSlug == null }
|
|
342
|
+
if (!team) return null
|
|
324
343
|
if (reportSlug == null) return { ...rest, teamId: team.id, reportId: null }
|
|
325
|
-
|
|
326
|
-
const ids = new Set(reports.map(report => report.id))
|
|
327
|
-
const report = (team.reports ?? []).find(entry => entry.slug === reportSlug)
|
|
328
|
-
return report && ids.size === 1 ? { ...rest, teamId: team.id, reportId: report.id } : null
|
|
344
|
+
return (team.reports ?? []).some(entry => entry.id === reportId) ? { ...rest, teamId: team.id, reportId } : null
|
|
329
345
|
}
|
|
330
346
|
|
|
331
347
|
export function managedRouteForIds(route, teams, adminBundles = []) {
|
|
@@ -359,5 +375,8 @@ export function managedRouteForIds(route, teams, adminBundles = []) {
|
|
|
359
375
|
const report = reportId == null ? null : team?.reports?.find(entry => entry.id === reportId)
|
|
360
376
|
if (!team?.slug || (reportId != null && !report?.slug)) return null
|
|
361
377
|
const result = { ...rest, teamSlug: team.slug, reportSlug: report?.slug ?? null }
|
|
362
|
-
|
|
378
|
+
// Its slugs have to name this team and report, which a finding's link
|
|
379
|
+
// resolves without.
|
|
380
|
+
const resolved = resolveManagedRoute(result, teams)
|
|
381
|
+
return resolved?.teamId === team.id && resolved.reportId === (report?.id ?? null) ? result : null
|
|
363
382
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Whether `path` names a stasis.config.json a repository's dependency review
|
|
2
|
+
// may hold to in a lockfile's place (server-managed/lockfile-scope.ts): a
|
|
3
|
+
// file of that name, none of a package installed, under a node_modules.
|
|
4
|
+
export function isStasisConfig(path: string): boolean {
|
|
5
|
+
const names = path.split('/')
|
|
6
|
+
return names.at(-1) === 'stasis.config.json' && !names.includes('node_modules')
|
|
7
|
+
}
|