@appland/scanner 1.83.0 → 1.84.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.
Files changed (146) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/built/algorithms/dataStructures/graph/Graph.d.ts +29 -0
  3. package/built/algorithms/dataStructures/graph/GraphEdge.d.ts +10 -0
  4. package/built/algorithms/dataStructures/graph/GraphVertex.d.ts +21 -0
  5. package/built/algorithms/dataStructures/linked-list/LinkedList.d.ts +16 -0
  6. package/built/algorithms/dataStructures/linked-list/LinkedListNode.d.ts +6 -0
  7. package/built/algorithms/graph/depth-first-search/index.d.ts +8 -0
  8. package/built/algorithms/graph/detect-cycle/index.d.ts +8 -0
  9. package/built/algorithms/hash/hashV1.d.ts +6 -0
  10. package/built/algorithms/hash/hashV2.d.ts +53 -0
  11. package/built/algorithms/utils/Comparator.d.ts +11 -0
  12. package/built/analyzer/recordSecrets.d.ts +6 -0
  13. package/built/analyzer/secretsRegexes.d.ts +5 -0
  14. package/built/appMapIndex.d.ts +8 -0
  15. package/built/check.d.ts +18 -0
  16. package/built/checkInstance.d.ts +16 -0
  17. package/built/cli/appmapDirFromConfig.d.ts +1 -0
  18. package/built/cli/ci/command.d.ts +8 -0
  19. package/built/cli/ci/options.d.ts +10 -0
  20. package/built/cli/codeVersionArgs.d.ts +2 -0
  21. package/built/cli/exitCode.d.ts +6 -0
  22. package/built/cli/fail.d.ts +1 -0
  23. package/built/cli/handleWorkingDirectory.d.ts +1 -0
  24. package/built/cli/merge/command.d.ts +8 -0
  25. package/built/cli/merge/options.d.ts +7 -0
  26. package/built/cli/reportUploadURL.d.ts +3 -0
  27. package/built/cli/resolveAppId.d.ts +1 -0
  28. package/built/cli/scan/breakpoint.d.ts +41 -0
  29. package/built/cli/scan/command.d.ts +8 -0
  30. package/built/cli/scan/formatReport.d.ts +2 -0
  31. package/built/cli/scan/interactiveScan.d.ts +8 -0
  32. package/built/cli/scan/options.d.ts +8 -0
  33. package/built/cli/scan/scanner.d.ts +9 -0
  34. package/built/cli/scan/singleScan.d.ts +12 -0
  35. package/built/cli/scan/ui/interactiveProgess.d.ts +42 -0
  36. package/built/cli/scan/ui/scanContext.d.ts +17 -0
  37. package/built/cli/scan/ui/state/addBreakpoint.d.ts +3 -0
  38. package/built/cli/scan/ui/state/eval.d.ts +3 -0
  39. package/built/cli/scan/ui/state/hint.d.ts +3 -0
  40. package/built/cli/scan/ui/state/hitBreakpoint.d.ts +3 -0
  41. package/built/cli/scan/ui/state/initial.d.ts +3 -0
  42. package/built/cli/scan/ui/state/scan.d.ts +3 -0
  43. package/built/cli/scan/ui/state.d.ts +2 -0
  44. package/built/cli/scan/ui/userInteraction.d.ts +18 -0
  45. package/built/cli/scan/watchScan.d.ts +33 -0
  46. package/built/cli/scan.d.ts +9 -0
  47. package/built/cli/scanArgs.d.ts +2 -0
  48. package/built/cli/scanOptions.d.ts +9 -0
  49. package/built/cli/updateCommitStatus.d.ts +1 -0
  50. package/built/cli/upload/command.d.ts +8 -0
  51. package/built/cli/upload/options.d.ts +11 -0
  52. package/built/cli/upload/pruneAppMap.d.ts +4 -0
  53. package/built/cli/upload.d.ts +5 -0
  54. package/built/cli/validateFile.d.ts +1 -0
  55. package/built/cli.d.ts +2 -0
  56. package/built/configuration/configurationProvider.d.ts +9 -0
  57. package/built/configuration/types/checkConfig.d.ts +18 -0
  58. package/built/configuration/types/configuration.d.ts +7 -0
  59. package/built/configuration/types/matchEventConfig.d.ts +7 -0
  60. package/built/configuration/types/matchPatternConfig.d.ts +6 -0
  61. package/built/database/index.d.ts +17 -0
  62. package/built/database/visit.d.ts +6 -0
  63. package/built/errors.d.ts +4 -0
  64. package/built/eventUtil.d.ts +3 -0
  65. package/built/findings.d.ts +3 -0
  66. package/built/index.d.ts +75 -0
  67. package/built/integration/appland/location.d.ts +5 -0
  68. package/built/integration/appland/retry.d.ts +5 -0
  69. package/built/integration/appland/retryOptions.d.ts +4 -0
  70. package/built/integration/appland/scannerJob/create.d.ts +11 -0
  71. package/built/integration/appland/scannerJob/merge.d.ts +5 -0
  72. package/built/integration/appland/scannerJob.d.ts +11 -0
  73. package/built/integration/github/commitStatus.d.ts +3 -0
  74. package/built/integration/vars.d.ts +12 -0
  75. package/built/lastGitOrFSModifiedDate.d.ts +6 -0
  76. package/built/openapi/index.d.ts +4 -0
  77. package/built/progressReporter.d.ts +16 -0
  78. package/built/report/appMapMetadata.d.ts +0 -0
  79. package/built/report/findingSummary.d.ts +11 -0
  80. package/built/report/findingsReport.d.ts +3 -0
  81. package/built/report/scanResults.d.ts +19 -0
  82. package/built/report/scanSummary.d.ts +20 -0
  83. package/built/report/summaryReport.d.ts +2 -0
  84. package/built/ruleChecker.d.ts +13 -0
  85. package/built/ruleInstance.d.ts +6 -0
  86. package/built/rules/authzBeforeAuthn.d.ts +3 -0
  87. package/built/rules/circularDependency.d.ts +3 -0
  88. package/built/rules/deprecated-crypto-algorithm/metadata.d.ts +4 -0
  89. package/built/rules/deprecated-crypto-algorithm/rule.d.ts +3 -0
  90. package/built/rules/deserializationOfUntrustedData.d.ts +3 -0
  91. package/built/rules/execOfUntrustedCommand.d.ts +3 -0
  92. package/built/rules/http-500/metadata.d.ts +3 -0
  93. package/built/rules/http-500/rule.d.ts +2 -0
  94. package/built/rules/illegalPackageDependency.d.ts +3 -0
  95. package/built/rules/incompatibleHttpClientRequest.d.ts +3 -0
  96. package/built/rules/insecureCompare.d.ts +3 -0
  97. package/built/rules/jobNotCancelled.d.ts +3 -0
  98. package/built/rules/jwtAlgorithmNone.d.ts +24 -0
  99. package/built/rules/jwtUnverifiedSignature.d.ts +23 -0
  100. package/built/rules/lib/analyzeDataFlow.d.ts +23 -0
  101. package/built/rules/lib/hasParameterOrReceiver.d.ts +3 -0
  102. package/built/rules/lib/isCommand.d.ts +2 -0
  103. package/built/rules/lib/matchEvent.d.ts +4 -0
  104. package/built/rules/lib/matchPattern.d.ts +4 -0
  105. package/built/rules/lib/metadata.d.ts +9 -0
  106. package/built/rules/lib/openapiProvider.d.ts +3 -0
  107. package/built/rules/lib/parseRuleDescription.d.ts +1 -0
  108. package/built/rules/lib/precedingEvents.d.ts +2 -0
  109. package/built/rules/lib/rpcWithoutProtection.d.ts +6 -0
  110. package/built/rules/lib/sanitizesData.d.ts +2 -0
  111. package/built/rules/lib/util.d.ts +20 -0
  112. package/built/rules/logoutWithoutSessionReset.d.ts +3 -0
  113. package/built/rules/missingAuthentication.d.ts +3 -0
  114. package/built/rules/missingContentType.d.ts +3 -0
  115. package/built/rules/nPlusOneQuery.d.ts +3 -0
  116. package/built/rules/queryFromInvalidPackage.d.ts +3 -0
  117. package/built/rules/queryFromView.d.ts +3 -0
  118. package/built/rules/rpcWithoutCircuitBreaker.d.ts +3 -0
  119. package/built/rules/saveWithoutValidation.d.ts +3 -0
  120. package/built/rules/secretInLog.d.ts +3 -0
  121. package/built/rules/slowFunctionCall.d.ts +3 -0
  122. package/built/rules/slowHttpServerRequest.d.ts +3 -0
  123. package/built/rules/slowQuery.d.ts +3 -0
  124. package/built/rules/too-many-joins/metadata.d.ts +3 -0
  125. package/built/rules/too-many-joins/options.d.ts +6 -0
  126. package/built/rules/too-many-joins/rule.d.ts +7 -0
  127. package/built/rules/tooManyUpdates.d.ts +3 -0
  128. package/built/rules/unauthenticated-encryption/metadata.d.ts +3 -0
  129. package/built/rules/unauthenticated-encryption/rule.d.ts +2 -0
  130. package/built/rules/unbatchedMaterializedQuery.d.ts +3 -0
  131. package/built/rules/updateInGetRequest.d.ts +3 -0
  132. package/built/scan.d.ts +5 -0
  133. package/built/scope/commandScope.d.ts +6 -0
  134. package/built/scope/httpClientRequestScope.d.ts +6 -0
  135. package/built/scope/httpServerRequestScope.d.ts +6 -0
  136. package/built/scope/rootScope.d.ts +6 -0
  137. package/built/scope/scopeImpl.d.ts +8 -0
  138. package/built/scope/scopeIterator.d.ts +6 -0
  139. package/built/scope/sqlTransactionScope.d.ts +13 -0
  140. package/built/sqlWarning.d.ts +2 -0
  141. package/built/telemetry.d.ts +50 -0
  142. package/built/util/eventAggregator.d.ts +20 -0
  143. package/built/util/isAncestorPath.d.ts +1 -0
  144. package/built/wellKnownLabels.d.ts +5 -0
  145. package/package.json +7 -8
  146. package/src/types.d.ts +0 -72
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ # [@appland/scanner-v1.84.0](https://github.com/getappmap/appmap-js/compare/@appland/scanner-v1.83.1...@appland/scanner-v1.84.0) (2023-11-07)
2
+
3
+
4
+ ### Features
5
+
6
+ * Update @appland/openapi to 1.7.0 ([1718173](https://github.com/getappmap/appmap-js/commit/17181733221e46a371266b6b3d9c18966b4db099))
7
+
8
+ # [@appland/scanner-v1.83.1](https://github.com/getappmap/appmap-js/compare/@appland/scanner-v1.83.0...@appland/scanner-v1.83.1) (2023-10-02)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * Export primary types ([5b845d6](https://github.com/getappmap/appmap-js/commit/5b845d60bf3a200e98f29011f8084468bb0e5f43))
14
+
1
15
  # [@appland/scanner-v1.83.0](https://github.com/getappmap/appmap-js/compare/@appland/scanner-v1.82.1...@appland/scanner-v1.83.0) (2023-09-01)
2
16
 
3
17
 
@@ -0,0 +1,29 @@
1
+ import GraphEdge from './GraphEdge';
2
+ import GraphVertex from './GraphVertex';
3
+ export default class Graph {
4
+ vertices: Record<string, GraphVertex>;
5
+ edges: Record<string, GraphEdge>;
6
+ isDirected: boolean;
7
+ /**
8
+ * @param {boolean} isDirected
9
+ */
10
+ constructor(isDirected?: boolean);
11
+ get vertexCount(): number;
12
+ addVertex(newVertex: GraphVertex): Graph;
13
+ getVertexByKey(vertexKey: string): GraphVertex | null;
14
+ getNeighbors(vertex: GraphVertex): GraphVertex[];
15
+ getAllVertices(): GraphVertex[];
16
+ getAllEdges(): GraphEdge[];
17
+ addEdge(edge: GraphEdge): Graph;
18
+ deleteEdge(edge: GraphEdge): void;
19
+ findEdge(startVertex: GraphVertex, endVertex: GraphVertex): GraphEdge | null;
20
+ findVertexByKey(vertexKey: string): GraphVertex | null;
21
+ getWeight(): number;
22
+ /**
23
+ * Reverse all the edges in directed graph.
24
+ */
25
+ reverse(): Graph;
26
+ getVerticesIndices(): Record<string, number>;
27
+ getAdjacencyMatrix(): number[][];
28
+ toString(): string;
29
+ }
@@ -0,0 +1,10 @@
1
+ import GraphVertex from './GraphVertex';
2
+ export default class GraphEdge {
3
+ startVertex: GraphVertex;
4
+ endVertex: GraphVertex;
5
+ weight: number;
6
+ constructor(startVertex: GraphVertex, endVertex: GraphVertex, weight?: number);
7
+ getKey(): string;
8
+ reverse(): GraphEdge;
9
+ toString(): string;
10
+ }
@@ -0,0 +1,21 @@
1
+ import GraphEdge from './GraphEdge';
2
+ import LinkedList from '../linked-list/LinkedList';
3
+ export default class GraphVertex {
4
+ value: string;
5
+ edges: LinkedList<GraphEdge>;
6
+ /**
7
+ * @param {*} value
8
+ */
9
+ constructor(value: string);
10
+ addEdge(edge: GraphEdge): GraphVertex;
11
+ deleteEdge(edge: GraphEdge): void;
12
+ getNeighbors(): GraphVertex[];
13
+ getEdges(): GraphEdge[];
14
+ getDegree(): number;
15
+ hasEdge(requiredEdge: GraphEdge): boolean;
16
+ hasNeighbor(vertex: GraphVertex): boolean;
17
+ findEdge(vertex: GraphVertex): GraphEdge | null;
18
+ getKey(): string;
19
+ deleteAllEdges(): GraphVertex;
20
+ toString(callback?: undefined | ((value: string) => string)): string;
21
+ }
@@ -0,0 +1,16 @@
1
+ import LinkedListNode from './LinkedListNode';
2
+ import Comparator from '../../utils/Comparator';
3
+ export default class LinkedList<T> {
4
+ head: LinkedListNode<T> | null;
5
+ tail: LinkedListNode<T> | null;
6
+ compare: Comparator<T>;
7
+ constructor(comparatorFunction: (a: T, b: T) => number);
8
+ prepend(value: T): LinkedList<T>;
9
+ append(value: T): LinkedList<T>;
10
+ delete(value: T): LinkedListNode<T> | null;
11
+ find(value?: T | undefined, callback?: undefined | ((value: T) => boolean)): LinkedListNode<T> | null;
12
+ deleteTail(): LinkedListNode<T> | null;
13
+ deleteHead(): LinkedListNode<T> | null;
14
+ toArray(): LinkedListNode<T>[];
15
+ toString(callback?: undefined | ((value: T) => string)): string;
16
+ }
@@ -0,0 +1,6 @@
1
+ export default class LinkedListNode<T> {
2
+ value: T;
3
+ next: LinkedListNode<T> | null;
4
+ constructor(value: T, next?: null | LinkedListNode<T>);
5
+ toString(callback?: undefined | ((value: T) => string)): string;
6
+ }
@@ -0,0 +1,8 @@
1
+ import Graph from '../../dataStructures/graph/Graph';
2
+ import GraphVertex from '../../dataStructures/graph/GraphVertex';
3
+ export interface Callbacks {
4
+ allowTraversal: (previousVertex: GraphVertex | null, currentVertex: GraphVertex, nextVertex: GraphVertex) => boolean;
5
+ enterVertex: (currentVertex: GraphVertex, previousVertex: GraphVertex | null) => boolean;
6
+ leaveVertex: (currentVertex: GraphVertex, previousVertex: GraphVertex | null) => void;
7
+ }
8
+ export declare function depthFirstSearch(graph: Graph, startVertex: GraphVertex, callbacks: Callbacks): void;
@@ -0,0 +1,8 @@
1
+ import Graph from '../../dataStructures/graph/Graph';
2
+ import GraphVertex from '../../dataStructures/graph/GraphVertex';
3
+ /**
4
+ * Detect cycle in directed graph using Depth First Search.
5
+ *
6
+ * @returns the cycle of vertexes, not including the final vertex which is the same as the first.
7
+ */
8
+ export default function detectDirectedCycle(graph: Graph): GraphVertex[][];
@@ -0,0 +1,6 @@
1
+ import { Event } from '@appland/models';
2
+ export default class HashV1 {
3
+ private hash;
4
+ constructor(ruleId: string, findingEvent: Event, relatedEvents: Event[]);
5
+ digest(): string;
6
+ }
@@ -0,0 +1,53 @@
1
+ import { Event } from '@appland/models';
2
+ /**
3
+ * Captures stack entries from distinct packages. Ancestors of the event are traversed up to the
4
+ * command or root. Then, starting from the command or root, subsequent events which come from the
5
+ * same package as their preceding event are removed. Then the last N entries remaining in the
6
+ * stack are collected.
7
+ *
8
+ * @param event leaf event
9
+ * @param participatingEvents output collector
10
+ * @param depth number of events to include in the output
11
+ */
12
+ export declare function captureStack(event: Event, depth?: number): Event[];
13
+ /**
14
+ * Builds a hash (digest) of a finding. The digest is constructed by first building a canonical
15
+ * string of the finding, of the form:
16
+ *
17
+ * ```
18
+ * [
19
+ * algorithmVersion=2
20
+ * rule=<rule-id>
21
+ * findingEvent.<property1>=value1
22
+ * ...
23
+ * findingEvent.<propertyN>=valueN
24
+ * participatingEvent.<eventName1>=value1
25
+ * ...
26
+ * participatingEvent.<eventName1>=valueN
27
+ * ...
28
+ * participatingEvent.<eventNameN>=value1
29
+ * ...
30
+ * participatingEvent.<eventNameN>=valueN
31
+ * stack[1]=value1
32
+ * ...
33
+ * stack[1]=valueN
34
+ * ...
35
+ * stack[3]=value1
36
+ * ...
37
+ * stack[3]=valueN
38
+ * ]
39
+ * ```
40
+ *
41
+ * Participating events are sorted by the event name. Properties of each event are sorted by
42
+ * the property name. Event properties are provided by `Event#stableProperties`.
43
+ *
44
+ * The partial stack included in the finding hash removes subsequent function calls from the
45
+ * same package.
46
+ */
47
+ export default class HashV2 {
48
+ private hashEntries;
49
+ private hash;
50
+ constructor(ruleId: string, findingEvent: Event, participatingEvents: Record<string, Event>);
51
+ get canonicalString(): string;
52
+ digest(): string;
53
+ }
@@ -0,0 +1,11 @@
1
+ export default class Comparator<T> {
2
+ compare: (a: T, b: T) => number;
3
+ constructor(compareFunction: (a: T, b: T) => number);
4
+ static defaultCompareFunction<T>(a: T, b: T): number;
5
+ equal(a: T, b: T): boolean;
6
+ lessThan(a: T, b: T): boolean;
7
+ greaterThan(a: T, b: T): boolean;
8
+ lessThanOrEqual(a: T, b: T): boolean;
9
+ greaterThanOrEqual(a: T, b: T): boolean;
10
+ reverse(): void;
11
+ }
@@ -0,0 +1,6 @@
1
+ import { Event } from '@appland/models';
2
+ export declare type Secret = {
3
+ generatorEvent: Event;
4
+ value: string;
5
+ };
6
+ export default function (secrets: Secret[], e: Event): void;
@@ -0,0 +1,5 @@
1
+ declare const REGEXES: {
2
+ [key: string]: RegExp[];
3
+ };
4
+ export declare const looksSecret: (string: string) => boolean;
5
+ export default REGEXES;
@@ -0,0 +1,8 @@
1
+ import { AppMap, Event } from '@appland/models';
2
+ import { QueryAST } from './types';
3
+ export default class AppMapIndex {
4
+ appMap: AppMap;
5
+ constructor(appMap: AppMap);
6
+ sqlAST(event: Event): QueryAST | undefined;
7
+ sqlNormalized(event: Event): string;
8
+ }
@@ -0,0 +1,18 @@
1
+ import { Event } from '@appland/models';
2
+ import { ImpactDomain, ScopeName } from './index';
3
+ import { AppMapIndex, EventFilter } from './types';
4
+ import RuleInstance from './ruleInstance';
5
+ export default class Check {
6
+ rule: RuleInstance;
7
+ id: string;
8
+ impactDomain?: ImpactDomain;
9
+ options: Record<string, unknown>;
10
+ scope: ScopeName;
11
+ includeScope: EventFilter[];
12
+ excludeScope: EventFilter[];
13
+ includeEvent: EventFilter[];
14
+ excludeEvent: EventFilter[];
15
+ constructor(rule: RuleInstance, options?: Record<string, unknown>);
16
+ filterScope(event: Event, appMapIndex: AppMapIndex): boolean;
17
+ toString(): string;
18
+ }
@@ -0,0 +1,16 @@
1
+ import { Event } from '@appland/models';
2
+ import Check from './check';
3
+ import { AppMapIndex, RuleLogic } from './types';
4
+ import { ImpactDomain, ScopeName } from './index';
5
+ export default class CheckInstance {
6
+ check: Check;
7
+ ruleLogic: RuleLogic;
8
+ constructor(check: Check);
9
+ get checkImpactDomain(): ImpactDomain | undefined;
10
+ get checkId(): string;
11
+ get ruleId(): string;
12
+ get title(): string;
13
+ get scope(): ScopeName;
14
+ get enumerateScope(): boolean;
15
+ filterEvent(event: Event, appMapIndex: AppMapIndex): boolean;
16
+ }
@@ -0,0 +1 @@
1
+ export declare function appmapDirFromConfig(): Promise<string | undefined>;
@@ -0,0 +1,8 @@
1
+ import { Arguments, Argv } from 'yargs';
2
+ declare const _default: {
3
+ command: string;
4
+ describe: string;
5
+ builder(args: Argv): Argv;
6
+ handler(options: Arguments): Promise<void>;
7
+ };
8
+ export default _default;
@@ -0,0 +1,10 @@
1
+ import ScanOptions from '../scanOptions';
2
+ export default interface CommandOptions extends ScanOptions {
3
+ fail?: boolean;
4
+ upload: boolean;
5
+ updateCommitStatus: boolean;
6
+ mergeKey?: string;
7
+ branch?: string;
8
+ commit?: string;
9
+ environment?: string;
10
+ }
@@ -0,0 +1,2 @@
1
+ import { Argv } from 'yargs';
2
+ export default function (args: Argv): void;
@@ -0,0 +1,6 @@
1
+ export declare enum ExitCode {
2
+ ValidationError = 1,
3
+ AbortError = 2,
4
+ RuntimeError = 3,
5
+ Finding = 10
6
+ }
@@ -0,0 +1 @@
1
+ export default function fail(numFindings: number): void;
@@ -0,0 +1 @@
1
+ export declare function handleWorkingDirectory(directory?: string): void;
@@ -0,0 +1,8 @@
1
+ import { Arguments, Argv } from 'yargs';
2
+ declare const _default: {
3
+ command: string;
4
+ describe: string;
5
+ builder(args: Argv): Argv;
6
+ handler(options: Arguments): Promise<void>;
7
+ };
8
+ export default _default;
@@ -0,0 +1,7 @@
1
+ export default interface CommandOptions {
2
+ verbose?: boolean;
3
+ mergeKey: string;
4
+ app?: string;
5
+ fail?: boolean;
6
+ updateCommitStatus: boolean;
7
+ }
@@ -0,0 +1,3 @@
1
+ /// <reference types="node" />
2
+ import { URL } from 'url';
3
+ export default function reportUploadURL(numFindings: number, url?: URL): void;
@@ -0,0 +1 @@
1
+ export default function (appIdArg: string | undefined, appMapDir: string | undefined): Promise<string>;
@@ -0,0 +1,41 @@
1
+ import { AppMap } from '@appland/client';
2
+ import { Event } from '@appland/models';
3
+ import Check from '../../check';
4
+ import { MatchResult } from '../../types';
5
+ export declare type ExecutionContext = {
6
+ counter: number;
7
+ depth: number;
8
+ eventName: string;
9
+ appMap?: AppMap;
10
+ appMapFileName?: string;
11
+ check?: Check;
12
+ event?: Event;
13
+ matchResult?: string | boolean | MatchResult[];
14
+ };
15
+ export interface Breakpoint {
16
+ condition: (context: ExecutionContext) => boolean;
17
+ }
18
+ export declare class BreakOnCounter implements Breakpoint {
19
+ private readonly counter;
20
+ constructor(counter: number);
21
+ condition(context: ExecutionContext): boolean;
22
+ toString(): string;
23
+ }
24
+ export declare class BreakOnEvent implements Breakpoint {
25
+ eventName: RegExp;
26
+ constructor(eventName: string);
27
+ condition(context: ExecutionContext): boolean;
28
+ toString(): string;
29
+ }
30
+ export declare class BreakOnLabel implements Breakpoint {
31
+ label: RegExp;
32
+ constructor(label: string);
33
+ condition(context: ExecutionContext): boolean;
34
+ toString(): string;
35
+ }
36
+ export declare class BreakOnCodeObject implements Breakpoint {
37
+ codeObject: RegExp;
38
+ constructor(codeObject: string);
39
+ condition(context: ExecutionContext): boolean;
40
+ toString(): string;
41
+ }
@@ -0,0 +1,8 @@
1
+ import { Arguments, Argv } from 'yargs';
2
+ declare const _default: {
3
+ command: string;
4
+ describe: string;
5
+ builder(args: Argv): Argv;
6
+ handler(options: Arguments): Promise<void>;
7
+ };
8
+ export default _default;
@@ -0,0 +1,2 @@
1
+ import { ScanResults } from '../../report/scanResults';
2
+ export declare function formatReport(rawScanResults: ScanResults): string;
@@ -0,0 +1,8 @@
1
+ import Configuration from '../../configuration/types/configuration';
2
+ declare type InteractiveScanOptions = {
3
+ configuration: Configuration;
4
+ appmapFile?: string | string[];
5
+ appmapDir?: string;
6
+ };
7
+ export default function interactiveScan(options: InteractiveScanOptions): Promise<void>;
8
+ export {};
@@ -0,0 +1,8 @@
1
+ import ScanOptions from '../scanOptions';
2
+ export default interface CommandOptions extends ScanOptions {
3
+ all: boolean;
4
+ interactive: boolean;
5
+ watch: boolean;
6
+ appmapFile?: string | string[];
7
+ ide?: string;
8
+ }
@@ -0,0 +1,9 @@
1
+ import { FindingStatusListItem } from '@appland/client/dist/src';
2
+ import Configuration from '../../configuration/types/configuration';
3
+ import { ScanResults } from '../../report/scanResults';
4
+ export interface Scanner {
5
+ scan(): Promise<ScanResults>;
6
+ scan(skipErrors: boolean): Promise<ScanResults>;
7
+ fetchFindingStatus(appId?: string, appMapDir?: string): Promise<FindingStatusListItem[]>;
8
+ }
9
+ export default function scanner(reportAllFindings: boolean, configuration: Configuration, files: string[]): Promise<Scanner>;
@@ -0,0 +1,12 @@
1
+ import Configuration from '../../configuration/types/configuration';
2
+ declare type SingleScanOptions = {
3
+ appmapFile?: string | string[];
4
+ appmapDir?: string;
5
+ configuration: Configuration;
6
+ reportAllFindings: boolean;
7
+ reportFile: string;
8
+ appId?: string;
9
+ ide?: string;
10
+ };
11
+ export default function singleScan(options: SingleScanOptions): Promise<void>;
12
+ export {};
@@ -0,0 +1,42 @@
1
+ /// <reference types="node" />
2
+ import { AppMap, Event } from '@appland/models';
3
+ import EventEmitter from 'events';
4
+ import AppMapIndex from '../../../appMapIndex';
5
+ import Check from '../../../check';
6
+ import ProgressReporter from '../../../progressReporter';
7
+ import { MatchResult } from '../../../types';
8
+ import { ScopeName } from '../../../index';
9
+ import { Breakpoint } from '../breakpoint';
10
+ declare type ContextVariables = {
11
+ event?: Event;
12
+ matchResult?: string | boolean | MatchResult[];
13
+ };
14
+ export default class InteractiveProgress extends EventEmitter implements ProgressReporter {
15
+ breakpoints: Breakpoint[];
16
+ depth: number;
17
+ counter: number;
18
+ appMap?: AppMap;
19
+ appMapFileName?: string;
20
+ check?: Check;
21
+ scope?: Event;
22
+ event?: Event;
23
+ breakpointResolver?: () => void;
24
+ constructor();
25
+ initialize(): void;
26
+ addBreakpoint(breakpoint: Breakpoint): void;
27
+ removeBreakpoint(breakpoint: Breakpoint): void;
28
+ get prefix(): string;
29
+ resume(): void;
30
+ breakOn(eventName: string, variables: ContextVariables): Promise<void>;
31
+ beginAppMap(appMapFileName: string, appMap: AppMap): Promise<void>;
32
+ beginCheck(check: Check): Promise<void>;
33
+ filterScope(scopeName: ScopeName, scope: Event): Promise<void>;
34
+ enterScope(scope: Event): Promise<void>;
35
+ filterEvent(event: Event): Promise<void>;
36
+ matchResult(event: Event, matchResult: string | boolean | MatchResult[] | undefined): Promise<void>;
37
+ matchEvent(event: Event, _appMapIndex: AppMapIndex): Promise<void>;
38
+ leaveScope(): Promise<void>;
39
+ endCheck(): Promise<void>;
40
+ endAppMap(): Promise<void>;
41
+ }
42
+ export {};
@@ -0,0 +1,17 @@
1
+ /// <reference types="node" />
2
+ import EventEmitter from 'events';
3
+ import Check from '../../../check';
4
+ import RuleChecker from '../../../ruleChecker';
5
+ import { Breakpoint } from '../breakpoint';
6
+ import InteractiveProgress from './interactiveProgess';
7
+ export default class ScanContext extends EventEmitter {
8
+ checks: Check[];
9
+ files: string[];
10
+ progress: InteractiveProgress;
11
+ checker: RuleChecker;
12
+ breakpoint?: Breakpoint;
13
+ isScanning: boolean;
14
+ constructor(checks: Check[], files: string[]);
15
+ scan(): void;
16
+ protected doScan(): Promise<void>;
17
+ }
@@ -0,0 +1,3 @@
1
+ import ScanContext from '../scanContext';
2
+ import { State } from '../state';
3
+ export default function addBreakpoint(context: ScanContext): Promise<State>;
@@ -0,0 +1,3 @@
1
+ import ScanContext from '../scanContext';
2
+ import { State } from '../state';
3
+ export default function initial(context: ScanContext): Promise<State | undefined>;
@@ -0,0 +1,3 @@
1
+ import ScanContext from '../scanContext';
2
+ import { State } from '../state';
3
+ export default function hint(_context: ScanContext): Promise<State>;
@@ -0,0 +1,3 @@
1
+ import ScanContext from '../scanContext';
2
+ import { State } from '../state';
3
+ export default function hitBreakpoint(context: ScanContext): Promise<State>;
@@ -0,0 +1,3 @@
1
+ import ScanContext from '../scanContext';
2
+ import { State } from '../state';
3
+ export default function initial(_context: ScanContext): Promise<State | undefined>;
@@ -0,0 +1,3 @@
1
+ import ScanContext from '../scanContext';
2
+ import { State } from '../state';
3
+ export default function scan(context: ScanContext): Promise<State>;
@@ -0,0 +1,2 @@
1
+ import ScanContext from './scanContext';
2
+ export declare type State = (context: ScanContext) => Promise<State | undefined>;
@@ -0,0 +1,18 @@
1
+ import { Answers, QuestionCollection } from 'inquirer';
2
+ interface SpinnerOptions {
3
+ supressSpinner?: boolean;
4
+ }
5
+ export declare class UserInteraction {
6
+ private spinner;
7
+ prompt(questions: QuestionCollection, opts?: SpinnerOptions): Promise<Answers>;
8
+ continue(msg: string): Promise<void>;
9
+ confirm(msg: string): Promise<boolean>;
10
+ progress(msg: string): void;
11
+ success(msg?: string, align?: 'center' | 'left' | 'right'): void;
12
+ error(msg?: unknown): void;
13
+ warn(msg?: string): void;
14
+ get status(): string;
15
+ set status(value: string);
16
+ }
17
+ declare const UI: UserInteraction;
18
+ export default UI;
@@ -0,0 +1,33 @@
1
+ /// <reference types="node" />
2
+ import * as chokidar from 'chokidar';
3
+ import { TimestampedConfiguration } from '../../configuration/configurationProvider';
4
+ import EventEmitter from 'events';
5
+ export declare type WatchScanOptions = {
6
+ appId?: string;
7
+ appmapDir: string;
8
+ configFile: string;
9
+ };
10
+ declare module 'async' {
11
+ interface QueueObject<T> {
12
+ [Symbol.iterator](): Iterator<T>;
13
+ }
14
+ }
15
+ export declare class Watcher {
16
+ private options;
17
+ config?: TimestampedConfiguration;
18
+ appmapWatcher?: chokidar.FSWatcher;
19
+ appmapPoller?: chokidar.FSWatcher;
20
+ configWatcher?: chokidar.FSWatcher;
21
+ scanEventEmitter: EventEmitter;
22
+ constructor(options: WatchScanOptions);
23
+ watch(): Promise<void>;
24
+ isError(error: unknown, code: string): boolean;
25
+ watcherErrorFunction(error: Error): Promise<void>;
26
+ close(): Promise<void>;
27
+ private queue;
28
+ private processing;
29
+ protected enqueue(mtimePath: string): void;
30
+ protected scan(mtimePath: string): Promise<void>;
31
+ protected reloadConfig(): Promise<void>;
32
+ }
33
+ export default function watchScan(options: WatchScanOptions): Promise<void>;
@@ -0,0 +1,9 @@
1
+ import { Metadata } from '@appland/models';
2
+ import Check from '../check';
3
+ import { Finding } from '../index';
4
+ declare type Result = {
5
+ appMapMetadata: Record<string, Metadata>;
6
+ findings: Finding[];
7
+ };
8
+ export default function scan(files: string[], checks: Check[], skipErrors?: boolean): Promise<Result>;
9
+ export {};
@@ -0,0 +1,2 @@
1
+ import { Argv } from 'yargs';
2
+ export default function (args: Argv): void;
@@ -0,0 +1,9 @@
1
+ export default interface ScanOptions {
2
+ app?: string;
3
+ apiKey?: string;
4
+ directory?: string;
5
+ appmapDir?: string;
6
+ config: string;
7
+ reportFile: string;
8
+ verbose?: boolean;
9
+ }
@@ -0,0 +1 @@
1
+ export default function updateCommitStatus(numFindings: number, numChecks: number): Promise<void>;
@@ -0,0 +1,8 @@
1
+ import { Arguments, Argv } from 'yargs';
2
+ declare const _default: {
3
+ command: string;
4
+ describe: string;
5
+ builder(args: Argv): Argv;
6
+ handler(options: Arguments): Promise<void>;
7
+ };
8
+ export default _default;
@@ -0,0 +1,11 @@
1
+ export default interface CommandOptions {
2
+ verbose?: boolean;
3
+ reportFile: string;
4
+ directory?: string;
5
+ appmapDir?: string;
6
+ app?: string;
7
+ mergeKey?: string;
8
+ branch?: string;
9
+ commit?: string;
10
+ environment?: string;
11
+ }
@@ -0,0 +1,4 @@
1
+ import { AppMapBuilder } from '@appland/models';
2
+ export declare function maxAppMapSize(): number;
3
+ export declare function pruneAppMap(builder: AppMapBuilder, maxSize: number): AppMapBuilder;
4
+ export declare function buildAppMap(appMapJson: Record<string, unknown>): AppMapBuilder;