"Fossies" - the Fresh Open Source Software Archive

Member "cli-1.1260.0/src/lib/ecosystems/types.ts" (4 Dec 2023, 3255 Bytes) of package /linux/misc/snyk-cli-1.1260.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) TypeScript source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 import { DepGraphData } from '@snyk/dep-graph';
    2 import { SEVERITY } from '../snyk-test/common';
    3 import { RemediationChanges } from '../snyk-test/legacy';
    4 import { Options, ProjectAttributes, Tag } from '../types';
    5 
    6 export type Ecosystem = 'cpp' | 'docker' | 'code';
    7 
    8 export type FindingType = 'iacIssue';
    9 
   10 export interface PluginResponse {
   11   scanResults: ScanResult[];
   12 }
   13 
   14 export interface GitTarget {
   15   remoteUrl?: string;
   16   branch?: string;
   17 }
   18 
   19 export interface ContainerTarget {
   20   image: string;
   21 }
   22 
   23 export interface NamedTarget extends GitTarget {
   24   name: string; // Should be equal to the project name
   25 }
   26 
   27 export interface ScanResult {
   28   identity: Identity;
   29   facts: Facts[];
   30   findings?: Finding[];
   31   name?: string;
   32   policy?: string;
   33   target?: GitTarget | ContainerTarget | NamedTarget;
   34   analytics?: Analytics[];
   35   targetReference?: string;
   36 }
   37 
   38 export interface Analytics {
   39   name: string;
   40   data: unknown;
   41 }
   42 
   43 export interface Identity {
   44   type: string;
   45   targetFile?: string;
   46   args?: { [key: string]: string };
   47 }
   48 
   49 export interface Facts {
   50   type: string;
   51   data: any;
   52 }
   53 
   54 export interface Finding {
   55   type: FindingType;
   56   data: any;
   57 }
   58 
   59 interface UpgradePathItem {
   60   name: string;
   61   version: string;
   62   newVersion?: string;
   63   isDropped?: boolean;
   64 }
   65 
   66 export interface UpgradePath {
   67   path: UpgradePathItem[];
   68 }
   69 
   70 export interface FixInfo {
   71   upgradePaths: UpgradePath[];
   72   isPatchable: boolean;
   73   nearestFixedInVersion?: string;
   74 }
   75 
   76 export interface Issue {
   77   pkgName: string;
   78   pkgVersion?: string;
   79   issueId: string;
   80   fixInfo: FixInfo;
   81 }
   82 
   83 export interface IssuesData {
   84   [issueId: string]: {
   85     id: string;
   86     severity: SEVERITY;
   87     title: string;
   88   };
   89 }
   90 
   91 export interface DepsFilePaths {
   92   [pkgKey: string]: string[];
   93 }
   94 
   95 export interface FileSignaturesDetails {
   96   [pkgKey: string]: {
   97     confidence: number;
   98     filePaths: string[];
   99   };
  100 }
  101 
  102 export interface TestResult {
  103   issues: Issue[];
  104   issuesData: IssuesData;
  105   depGraphData: DepGraphData;
  106   depsFilePaths?: DepsFilePaths;
  107   fileSignaturesDetails?: FileSignaturesDetails;
  108   remediation?: RemediationChanges;
  109 }
  110 
  111 export interface EcosystemPlugin {
  112   scan: (options: Options) => Promise<PluginResponse>;
  113   display: (
  114     scanResults: ScanResult[],
  115     testResults: TestResult[],
  116     errors: string[],
  117     options: Options,
  118   ) => Promise<string>;
  119   test?: (
  120     paths: string[],
  121     options: Options,
  122   ) => Promise<{ readableResult: string; sarifResult?: string }>;
  123 }
  124 
  125 export interface EcosystemMonitorError {
  126   error: string;
  127   path: string;
  128   scanResult: ScanResult;
  129 }
  130 
  131 export interface MonitorDependenciesResponse {
  132   ok: boolean;
  133   org: string;
  134   id: string;
  135   isMonitored: boolean;
  136   licensesPolicy: any;
  137   uri: string;
  138   trialStarted: boolean;
  139   path: string;
  140   projectName: string;
  141 }
  142 
  143 export interface EcosystemMonitorResult extends MonitorDependenciesResponse {
  144   scanResult: ScanResult;
  145 }
  146 
  147 export interface MonitorDependenciesRequest {
  148   scanResult: ScanResult;
  149 
  150   /**
  151    * If provided, overrides the default project name (usually equivalent to the root package).
  152    * @deprecated Must not be set by new code! Prefer to set the "scanResult.name" within your plugin!
  153    */
  154   projectName?: string;
  155   policy?: string;
  156   method?: 'cli';
  157   tags?: Tag[];
  158   attributes?: ProjectAttributes;
  159 }